aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acexcep.h6
-rw-r--r--include/acpi/acpi_bus.h19
-rw-r--r--include/acpi/acpi_drivers.h33
-rw-r--r--include/acpi/acpiosxf.h5
-rw-r--r--include/acpi/acpixf.h22
-rw-r--r--include/acpi/actbl.h74
-rw-r--r--include/acpi/actbl1.h6
-rw-r--r--include/acpi/actypes.h18
-rw-r--r--include/acpi/processor.h5
-rw-r--r--include/acpi/video.h13
-rw-r--r--include/asm-arm/.gitignore2
-rw-r--r--include/asm-arm/plat-s3c24xx/regs-iis.h77
-rw-r--r--include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h72
-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/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.h180
-rw-r--r--include/asm-frv/hw_irq.h16
-rw-r--r--include/asm-frv/ide.h24
-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.h58
-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/atomic.h4
-rw-r--r--include/asm-generic/bug.h9
-rw-r--r--include/asm-generic/dma-mapping.h308
-rw-r--r--include/asm-generic/fcntl.h12
-rw-r--r--include/asm-generic/gpio.h5
-rw-r--r--include/asm-generic/percpu.h35
-rw-r--r--include/asm-generic/sections.h2
-rw-r--r--include/asm-generic/siginfo.h16
-rw-r--r--include/asm-generic/statfs.h5
-rw-r--r--include/asm-generic/topology.h10
-rw-r--r--include/asm-generic/vmlinux.lds.h106
-rw-r--r--include/asm-h8300/timer.h25
-rw-r--r--include/asm-m32r/Kbuild1
-rw-r--r--include/asm-m32r/addrspace.h57
-rw-r--r--include/asm-m32r/assembler.h229
-rw-r--r--include/asm-m32r/atomic.h318
-rw-r--r--include/asm-m32r/auxvec.h4
-rw-r--r--include/asm-m32r/bitops.h275
-rw-r--r--include/asm-m32r/bug.h4
-rw-r--r--include/asm-m32r/bugs.h19
-rw-r--r--include/asm-m32r/byteorder.h10
-rw-r--r--include/asm-m32r/cache.h8
-rw-r--r--include/asm-m32r/cachectl.h26
-rw-r--r--include/asm-m32r/cacheflush.h69
-rw-r--r--include/asm-m32r/checksum.h204
-rw-r--r--include/asm-m32r/cputime.h6
-rw-r--r--include/asm-m32r/current.h15
-rw-r--r--include/asm-m32r/delay.h26
-rw-r--r--include/asm-m32r/device.h7
-rw-r--r--include/asm-m32r/div64.h1
-rw-r--r--include/asm-m32r/dma.h12
-rw-r--r--include/asm-m32r/elf.h134
-rw-r--r--include/asm-m32r/emergency-restart.h6
-rw-r--r--include/asm-m32r/errno.h6
-rw-r--r--include/asm-m32r/fb.h19
-rw-r--r--include/asm-m32r/fcntl.h1
-rw-r--r--include/asm-m32r/flat.h146
-rw-r--r--include/asm-m32r/futex.h6
-rw-r--r--include/asm-m32r/hardirq.h36
-rw-r--r--include/asm-m32r/hw_irq.h4
-rw-r--r--include/asm-m32r/io.h200
-rw-r--r--include/asm-m32r/ioctl.h1
-rw-r--r--include/asm-m32r/ioctls.h87
-rw-r--r--include/asm-m32r/ipcbuf.h29
-rw-r--r--include/asm-m32r/irq.h90
-rw-r--r--include/asm-m32r/irq_regs.h1
-rw-r--r--include/asm-m32r/kdebug.h1
-rw-r--r--include/asm-m32r/kmap_types.h29
-rw-r--r--include/asm-m32r/linkage.h7
-rw-r--r--include/asm-m32r/local.h366
-rw-r--r--include/asm-m32r/m32102.h314
-rw-r--r--include/asm-m32r/m32104ut/m32104ut_pld.h161
-rw-r--r--include/asm-m32r/m32700ut/m32700ut_lan.h103
-rw-r--r--include/asm-m32r/m32700ut/m32700ut_lcd.h55
-rw-r--r--include/asm-m32r/m32700ut/m32700ut_pld.h259
-rw-r--r--include/asm-m32r/m32r.h160
-rw-r--r--include/asm-m32r/m32r_mp_fpga.h313
-rw-r--r--include/asm-m32r/mappi2/mappi2_pld.h150
-rw-r--r--include/asm-m32r/mappi3/mappi3_pld.h142
-rw-r--r--include/asm-m32r/mc146818rtc.h29
-rw-r--r--include/asm-m32r/mman.h17
-rw-r--r--include/asm-m32r/mmu.h21
-rw-r--r--include/asm-m32r/mmu_context.h164
-rw-r--r--include/asm-m32r/mmzone.h59
-rw-r--r--include/asm-m32r/module.h10
-rw-r--r--include/asm-m32r/msgbuf.h31
-rw-r--r--include/asm-m32r/mutex.h9
-rw-r--r--include/asm-m32r/opsput/opsput_lan.h52
-rw-r--r--include/asm-m32r/opsput/opsput_lcd.h55
-rw-r--r--include/asm-m32r/opsput/opsput_pld.h255
-rw-r--r--include/asm-m32r/page.h87
-rw-r--r--include/asm-m32r/param.h23
-rw-r--r--include/asm-m32r/pci.h8
-rw-r--r--include/asm-m32r/percpu.h6
-rw-r--r--include/asm-m32r/pgalloc.h76
-rw-r--r--include/asm-m32r/pgtable-2level.h78
-rw-r--r--include/asm-m32r/pgtable.h363
-rw-r--r--include/asm-m32r/poll.h1
-rw-r--r--include/asm-m32r/posix_types.h118
-rw-r--r--include/asm-m32r/processor.h147
-rw-r--r--include/asm-m32r/ptrace.h148
-rw-r--r--include/asm-m32r/resource.h6
-rw-r--r--include/asm-m32r/rtc.h65
-rw-r--r--include/asm-m32r/s1d13806.h199
-rw-r--r--include/asm-m32r/scatterlist.h21
-rw-r--r--include/asm-m32r/sections.h7
-rw-r--r--include/asm-m32r/segment.h10
-rw-r--r--include/asm-m32r/sembuf.h25
-rw-r--r--include/asm-m32r/serial.h9
-rw-r--r--include/asm-m32r/setup.h38
-rw-r--r--include/asm-m32r/shmbuf.h42
-rw-r--r--include/asm-m32r/shmparam.h6
-rw-r--r--include/asm-m32r/sigcontext.h39
-rw-r--r--include/asm-m32r/siginfo.h6
-rw-r--r--include/asm-m32r/signal.h166
-rw-r--r--include/asm-m32r/smp.h119
-rw-r--r--include/asm-m32r/socket.h57
-rw-r--r--include/asm-m32r/sockios.h13
-rw-r--r--include/asm-m32r/spinlock.h323
-rw-r--r--include/asm-m32r/spinlock_types.h23
-rw-r--r--include/asm-m32r/stat.h87
-rw-r--r--include/asm-m32r/statfs.h6
-rw-r--r--include/asm-m32r/string.h13
-rw-r--r--include/asm-m32r/swab.h10
-rw-r--r--include/asm-m32r/syscall.h8
-rw-r--r--include/asm-m32r/system.h431
-rw-r--r--include/asm-m32r/termbits.h199
-rw-r--r--include/asm-m32r/termios.h91
-rw-r--r--include/asm-m32r/thread_info.h184
-rw-r--r--include/asm-m32r/timex.h27
-rw-r--r--include/asm-m32r/tlb.h20
-rw-r--r--include/asm-m32r/tlbflush.h97
-rw-r--r--include/asm-m32r/topology.h6
-rw-r--r--include/asm-m32r/types.h30
-rw-r--r--include/asm-m32r/uaccess.h693
-rw-r--r--include/asm-m32r/ucontext.h12
-rw-r--r--include/asm-m32r/unaligned.h18
-rw-r--r--include/asm-m32r/unistd.h389
-rw-r--r--include/asm-m32r/user.h52
-rw-r--r--include/asm-m32r/vga.h20
-rw-r--r--include/asm-m32r/xor.h6
-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/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.h114
-rw-r--r--include/asm-mn10300/hw_irq.h14
-rw-r--r--include/asm-mn10300/ide.h39
-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.h124
-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.h57
-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/crypto/aes.h6
-rw-r--r--include/crypto/compress.h145
-rw-r--r--include/crypto/cryptd.h27
-rw-r--r--include/crypto/crypto_wq.h7
-rw-r--r--include/crypto/hash.h5
-rw-r--r--include/crypto/internal/compress.h28
-rw-r--r--include/drm/drm.h21
-rw-r--r--include/drm/drmP.h145
-rw-r--r--include/drm/drm_crtc.h6
-rw-r--r--include/drm/drm_crtc_helper.h3
-rw-r--r--include/drm/drm_edid.h2
-rw-r--r--include/drm/drm_mode.h153
-rw-r--r--include/drm/drm_os_linux.h19
-rw-r--r--include/drm/drm_pciids.h118
-rw-r--r--include/drm/i915_drm.h143
-rw-r--r--include/drm/mga_drm.h18
-rw-r--r--include/drm/radeon_drm.h9
-rw-r--r--include/drm/via_drm.h42
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/acpi.h37
-rw-r--r--include/linux/agpgart.h14
-rw-r--r--include/linux/arcdevice.h9
-rw-r--r--include/linux/async_tx.h9
-rw-r--r--include/linux/ata.h51
-rw-r--r--include/linux/ath9k_platform.h28
-rw-r--r--include/linux/atmlec.h5
-rw-r--r--include/linux/atmmpc.h45
-rw-r--r--include/linux/audit.h9
-rw-r--r--include/linux/auto_dev-ioctl.h7
-rw-r--r--include/linux/auto_fs.h6
-rw-r--r--include/linux/backing-dev.h12
-rw-r--r--include/linux/binfmts.h17
-rw-r--r--include/linux/bio.h145
-rw-r--r--include/linux/bitops.h19
-rw-r--r--include/linux/blkdev.h61
-rw-r--r--include/linux/blktrace_api.h5
-rw-r--r--include/linux/bootmem.h42
-rw-r--r--include/linux/bsg.h10
-rw-r--r--include/linux/buffer_head.h24
-rw-r--r--include/linux/capability.h23
-rw-r--r--include/linux/cgroup.h142
-rw-r--r--include/linux/clk.h17
-rw-r--r--include/linux/clocksource.h138
-rw-r--r--include/linux/cm4000_cs.h10
-rw-r--r--include/linux/cn_proc.h20
-rw-r--r--include/linux/coda_psdev.h15
-rw-r--r--include/linux/com20020.h1
-rw-r--r--include/linux/compat.h14
-rw-r--r--include/linux/compiler-gcc.h10
-rw-r--r--include/linux/compiler-gcc4.h6
-rw-r--r--include/linux/compiler.h13
-rw-r--r--include/linux/connector.h12
-rw-r--r--include/linux/console.h4
-rw-r--r--include/linux/cpu.h16
-rw-r--r--include/linux/cpufreq.h1
-rw-r--r--include/linux/cpuset.h37
-rw-r--r--include/linux/crypto.h4
-rw-r--r--include/linux/cyclades.h6
-rw-r--r--include/linux/dca.h20
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/dccp.h51
-rw-r--r--include/linux/debug_locks.h8
-rw-r--r--include/linux/debugfs.h8
-rw-r--r--include/linux/decompress/bunzip2.h10
-rw-r--r--include/linux/decompress/generic.h33
-rw-r--r--include/linux/decompress/inflate.h13
-rw-r--r--include/linux/decompress/mm.h87
-rw-r--r--include/linux/decompress/unlzma.h12
-rw-r--r--include/linux/device-mapper.h4
-rw-r--r--include/linux/device.h39
-rw-r--r--include/linux/dlm_netlink.h18
-rw-r--r--include/linux/dm-dirty-log.h13
-rw-r--r--include/linux/dm-ioctl.h42
-rw-r--r--include/linux/dma-debug.h174
-rw-r--r--include/linux/dma-mapping.h50
-rw-r--r--include/linux/dma_remapping.h1
-rw-r--r--include/linux/dmaengine.h37
-rw-r--r--include/linux/dmar.h63
-rw-r--r--include/linux/dmi.h7
-rw-r--r--include/linux/ds1wm.h12
-rw-r--r--include/linux/dst.h587
-rw-r--r--include/linux/dvb/audio.h2
-rw-r--r--include/linux/dvb/video.h24
-rw-r--r--include/linux/dw_dmac.h19
-rw-r--r--include/linux/dynamic_debug.h88
-rw-r--r--include/linux/dynamic_printk.h93
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/elfcore.h9
-rw-r--r--include/linux/errqueue.h1
-rw-r--r--include/linux/etherdevice.h21
-rw-r--r--include/linux/ethtool.h89
-rw-r--r--include/linux/eventfd.h12
-rw-r--r--include/linux/eventpoll.h1
-rw-r--r--include/linux/ext3_fs.h6
-rw-r--r--include/linux/fb.h19
-rw-r--r--include/linux/fdtable.h4
-rw-r--r--include/linux/fiemap.h2
-rw-r--r--include/linux/firewire-cdev.h218
-rw-r--r--include/linux/fs.h353
-rw-r--r--include/linux/fs_struct.h7
-rw-r--r--include/linux/fscache-cache.h505
-rw-r--r--include/linux/fscache.h618
-rw-r--r--include/linux/fsl_devices.h35
-rw-r--r--include/linux/ftrace.h243
-rw-r--r--include/linux/ftrace_irq.h2
-rw-r--r--include/linux/gen_stats.h2
-rw-r--r--include/linux/genhd.h6
-rw-r--r--include/linux/gfp.h1
-rw-r--r--include/linux/hardirq.h75
-rw-r--r--include/linux/hdlc.h5
-rw-r--r--include/linux/hdlcdrv.h3
-rw-r--r--include/linux/hdreg.h67
-rw-r--r--include/linux/hid.h23
-rw-r--r--include/linux/highmem.h17
-rw-r--r--include/linux/hrtimer.h5
-rw-r--r--include/linux/i2c-algo-pca.h33
-rw-r--r--include/linux/i2c-algo-sgi.h26
-rw-r--r--include/linux/i2c-id.h38
-rw-r--r--include/linux/i2c-pca-platform.h2
-rw-r--r--include/linux/i2c.h6
-rw-r--r--include/linux/i2c/at24.h4
-rw-r--r--include/linux/i2c/s6000.h10
-rw-r--r--include/linux/i2c/twl4030.h47
-rw-r--r--include/linux/ibmtr.h2
-rw-r--r--include/linux/ide.h418
-rw-r--r--include/linux/idr.h1
-rw-r--r--include/linux/ieee80211.h198
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_arcnet.h27
-rw-r--r--include/linux/if_ether.h9
-rw-r--r--include/linux/if_frad.h1
-rw-r--r--include/linux/if_pppol2tp.h2
-rw-r--r--include/linux/if_pppox.h20
-rw-r--r--include/linux/if_tun.h2
-rw-r--r--include/linux/if_tunnel.h16
-rw-r--r--include/linux/ima.h61
-rw-r--r--include/linux/in6.h2
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init.h13
-rw-r--r--include/linux/init_task.h16
-rw-r--r--include/linux/input.h25
-rw-r--r--include/linux/intel-iommu.h27
-rw-r--r--include/linux/interrupt.h108
-rw-r--r--include/linux/iommu.h13
-rw-r--r--include/linux/ip_vs.h26
-rw-r--r--include/linux/ipc_namespace.h65
-rw-r--r--include/linux/ipmi.h2
-rw-r--r--include/linux/ipmi_msgdefs.h8
-rw-r--r--include/linux/ipmi_smi.h2
-rw-r--r--include/linux/irq.h124
-rw-r--r--include/linux/irqflags.h8
-rw-r--r--include/linux/irqnr.h9
-rw-r--r--include/linux/irqreturn.h30
-rw-r--r--include/linux/ivtv.h10
-rw-r--r--include/linux/ivtvfb.h2
-rw-r--r--include/linux/jbd.h10
-rw-r--r--include/linux/jbd2.h9
-rw-r--r--include/linux/jffs2.h27
-rw-r--r--include/linux/kallsyms.h15
-rw-r--r--include/linux/kernel.h184
-rw-r--r--include/linux/kernel_stat.h13
-rw-r--r--include/linux/key.h1
-rw-r--r--include/linux/kmod.h11
-rw-r--r--include/linux/kobject.h3
-rw-r--r--include/linux/kprobes.h74
-rw-r--r--include/linux/kvm.h117
-rw-r--r--include/linux/kvm_host.h62
-rw-r--r--include/linux/kvm_types.h13
-rw-r--r--include/linux/latencytop.h10
-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/libata.h24
-rw-r--r--include/linux/lm_interface.h277
-rw-r--r--include/linux/lockd/lockd.h8
-rw-r--r--include/linux/lockd/xdr.h12
-rw-r--r--include/linux/lockd/xdr4.h10
-rw-r--r--include/linux/lockdep.h67
-rw-r--r--include/linux/loop.h1
-rw-r--r--include/linux/magic.h1
-rw-r--r--include/linux/major.h1
-rw-r--r--include/linux/maple.h62
-rw-r--r--include/linux/matroxfb.h2
-rw-r--r--include/linux/memcontrol.h26
-rw-r--r--include/linux/memory.h17
-rw-r--r--include/linux/mfd/ds1wm.h6
-rw-r--r--include/linux/mfd/htc-pasic3.h1
-rw-r--r--include/linux/mfd/pcf50633/core.h2
-rw-r--r--include/linux/mfd/pcf50633/mbc.h1
-rw-r--r--include/linux/mfd/wm8350/audio.h1
-rw-r--r--include/linux/mfd/wm8350/core.h2
-rw-r--r--include/linux/mfd/wm8400-audio.h1
-rw-r--r--include/linux/mg_disk.h206
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/cmd.h1
-rw-r--r--include/linux/mlx4/device.h6
-rw-r--r--include/linux/mm.h9
-rw-r--r--include/linux/mm_types.h7
-rw-r--r--include/linux/mman.h9
-rw-r--r--include/linux/mmc/host.h5
-rw-r--r--include/linux/mmiotrace.h78
-rw-r--r--include/linux/mmzone.h14
-rw-r--r--include/linux/mnt_namespace.h2
-rw-r--r--include/linux/mod_devicetable.h9
-rw-r--r--include/linux/module.h68
-rw-r--r--include/linux/moduleparam.h10
-rw-r--r--include/linux/mount.h1
-rw-r--r--include/linux/mpage.h10
-rw-r--r--include/linux/mroute.h18
-rw-r--r--include/linux/mroute6.h2
-rw-r--r--include/linux/msi.h13
-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/mutex.h5
-rw-r--r--include/linux/ncp_fs.h2
-rw-r--r--include/linux/ncp_no.h26
-rw-r--r--include/linux/neighbour.h1
-rw-r--r--include/linux/net.h8
-rw-r--r--include/linux/net_dropmon.h56
-rw-r--r--include/linux/net_tstamp.h104
-rw-r--r--include/linux/netdevice.h135
-rw-r--r--include/linux/netfilter/Kbuild8
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h6
-rw-r--r--include/linux/netfilter/nfnetlink.h5
-rw-r--r--include/linux/netfilter/nfnetlink_compat.h7
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h1
-rw-r--r--include/linux/netfilter/nfnetlink_log.h32
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h24
-rw-r--r--include/linux/netfilter/x_tables.h135
-rw-r--r--include/linux/netfilter/xt_CLASSIFY.h4
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h8
-rw-r--r--include/linux/netfilter/xt_CONNSECMARK.h4
-rw-r--r--include/linux/netfilter/xt_DSCP.h7
-rw-r--r--include/linux/netfilter/xt_LED.h13
-rw-r--r--include/linux/netfilter/xt_MARK.h6
-rw-r--r--include/linux/netfilter/xt_NFLOG.h12
-rw-r--r--include/linux/netfilter/xt_NFQUEUE.h4
-rw-r--r--include/linux/netfilter/xt_RATEEST.h6
-rw-r--r--include/linux/netfilter/xt_SECMARK.h6
-rw-r--r--include/linux/netfilter/xt_TCPMSS.h4
-rw-r--r--include/linux/netfilter/xt_cluster.h15
-rw-r--r--include/linux/netfilter/xt_connbytes.h6
-rw-r--r--include/linux/netfilter/xt_connmark.h8
-rw-r--r--include/linux/netfilter/xt_conntrack.h12
-rw-r--r--include/linux/netfilter/xt_dccp.h14
-rw-r--r--include/linux/netfilter/xt_dscp.h12
-rw-r--r--include/linux/netfilter/xt_esp.h6
-rw-r--r--include/linux/netfilter/xt_hashlimit.h32
-rw-r--r--include/linux/netfilter/xt_iprange.h4
-rw-r--r--include/linux/netfilter/xt_length.h6
-rw-r--r--include/linux/netfilter/xt_limit.h17
-rw-r--r--include/linux/netfilter/xt_mark.h8
-rw-r--r--include/linux/netfilter/xt_multiport.h18
-rw-r--r--include/linux/netfilter/xt_owner.h8
-rw-r--r--include/linux/netfilter/xt_physdev.h6
-rw-r--r--include/linux/netfilter/xt_policy.h14
-rw-r--r--include/linux/netfilter/xt_quota.h4
-rw-r--r--include/linux/netfilter/xt_rateest.h14
-rw-r--r--include/linux/netfilter/xt_realm.h8
-rw-r--r--include/linux/netfilter/xt_recent.h12
-rw-r--r--include/linux/netfilter/xt_sctp.h36
-rw-r--r--include/linux/netfilter/xt_statistic.h19
-rw-r--r--include/linux/netfilter/xt_string.h12
-rw-r--r--include/linux/netfilter/xt_tcpmss.h6
-rw-r--r--include/linux/netfilter/xt_tcpudp.h20
-rw-r--r--include/linux/netfilter_bridge.h4
-rw-r--r--include/linux/netfilter_ipv4/ipt_owner.h8
-rw-r--r--include/linux/netfilter_ipv6/Kbuild1
-rw-r--r--include/linux/netfilter_ipv6/ip6t_owner.h8
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/netpoll.h13
-rw-r--r--include/linux/nfs.h1
-rw-r--r--include/linux/nfs4.h138
-rw-r--r--include/linux/nfs_fs.h19
-rw-r--r--include/linux/nfs_fs_sb.h16
-rw-r--r--include/linux/nfs_iostat.h12
-rw-r--r--include/linux/nfs_xdr.h63
-rw-r--r--include/linux/nfsacl.h3
-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/nl80211.h261
-rw-r--r--include/linux/nls.h19
-rw-r--r--include/linux/nsproxy.h1
-rw-r--r--include/linux/nubus.h2
-rw-r--r--include/linux/of_platform.h10
-rw-r--r--include/linux/page-debug-flags.h30
-rw-r--r--include/linux/page-flags.h60
-rw-r--r--include/linux/page_cgroup.h13
-rw-r--r--include/linux/pagemap.h17
-rw-r--r--include/linux/pagevec.h1
-rw-r--r--include/linux/parport_pc.h11
-rw-r--r--include/linux/pci-acpi.h67
-rw-r--r--include/linux/pci.h67
-rw-r--r--include/linux/pci_ids.h53
-rw-r--r--include/linux/pci_regs.h38
-rw-r--r--include/linux/pcieport_if.h36
-rw-r--r--include/linux/pda_power.h2
-rw-r--r--include/linux/percpu-defs.h84
-rw-r--r--include/linux/percpu.h191
-rw-r--r--include/linux/pfkeyv2.h242
-rw-r--r--include/linux/phy.h9
-rw-r--r--include/linux/pim.h4
-rw-r--r--include/linux/pipe_fs_i.h5
-rw-r--r--include/linux/pktcdvd.h1
-rw-r--r--include/linux/platform_device.h49
-rw-r--r--include/linux/plist.h9
-rw-r--r--include/linux/pm.h11
-rw-r--r--include/linux/poison.h3
-rw-r--r--include/linux/power_supply.h2
-rw-r--r--include/linux/ppp_channel.h6
-rw-r--r--include/linux/ppp_defs.h4
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--include/linux/ptrace.h1
-rw-r--r--include/linux/pwm.h2
-rw-r--r--include/linux/quota.h11
-rw-r--r--include/linux/quotaops.h119
-rw-r--r--include/linux/raid/bitmap.h288
-rw-r--r--include/linux/raid/linear.h31
-rw-r--r--include/linux/raid/md.h81
-rw-r--r--include/linux/raid/md_k.h402
-rw-r--r--include/linux/raid/md_u.h35
-rw-r--r--include/linux/raid/multipath.h42
-rw-r--r--include/linux/raid/pq.h132
-rw-r--r--include/linux/raid/raid0.h30
-rw-r--r--include/linux/raid/raid1.h134
-rw-r--r--include/linux/raid/raid10.h123
-rw-r--r--include/linux/raid/raid5.h402
-rw-r--r--include/linux/raid/xor.h2
-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.h30
-rw-r--r--include/linux/rds.h250
-rw-r--r--include/linux/regulator/bq24022.h3
-rw-r--r--include/linux/regulator/consumer.h6
-rw-r--r--include/linux/regulator/driver.h82
-rw-r--r--include/linux/regulator/fixed.h3
-rw-r--r--include/linux/regulator/machine.h12
-rw-r--r--include/linux/reiserfs_acl.h22
-rw-r--r--include/linux/reiserfs_fs.h218
-rw-r--r--include/linux/reiserfs_fs_i.h4
-rw-r--r--include/linux/reiserfs_fs_sb.h33
-rw-r--r--include/linux/reiserfs_xattr.h154
-rw-r--r--include/linux/ring_buffer.h38
-rw-r--r--include/linux/rtc-v3020.h6
-rw-r--r--include/linux/rtc.h6
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/sched.h158
-rw-r--r--include/linux/sctp.h92
-rw-r--r--include/linux/seccomp.h2
-rw-r--r--include/linux/section-names.h6
-rw-r--r--include/linux/security.h37
-rw-r--r--include/linux/selinux_netlink.h6
-rw-r--r--include/linux/seq_file.h9
-rw-r--r--include/linux/serial_core.h5
-rw-r--r--include/linux/serial_max3100.h52
-rw-r--r--include/linux/serio.h2
-rw-r--r--include/linux/sh_cmt.h13
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/sht15.h24
-rw-r--r--include/linux/skbuff.h127
-rw-r--r--include/linux/slab_def.h68
-rw-r--r--include/linux/slob_def.h9
-rw-r--r--include/linux/slow-work.h95
-rw-r--r--include/linux/slub_def.h70
-rw-r--r--include/linux/smp.h13
-rw-r--r--include/linux/smsc911x.h3
-rw-r--r--include/linux/socket.h9
-rw-r--r--include/linux/sockios.h3
-rw-r--r--include/linux/sonypi.h8
-rw-r--r--include/linux/spi/eeprom.h6
-rw-r--r--include/linux/spi/libertas_spi.h32
-rw-r--r--include/linux/spi/spi.h13
-rw-r--r--include/linux/spi/spi_gpio.h6
-rw-r--r--include/linux/spinlock.h6
-rw-r--r--include/linux/splice.h12
-rw-r--r--include/linux/ssb/ssb.h4
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h224
-rw-r--r--include/linux/ssb/ssb_regs.h36
-rw-r--r--include/linux/stackprotector.h16
-rw-r--r--include/linux/string.h17
-rw-r--r--include/linux/stringify.h4
-rw-r--r--include/linux/sunrpc/svc.h25
-rw-r--r--include/linux/sunrpc/svc_xprt.h52
-rw-r--r--include/linux/sunrpc/xdr.h42
-rw-r--r--include/linux/sunrpc/xprt.h3
-rw-r--r--include/linux/suspend.h39
-rw-r--r--include/linux/suspend_ioctls.h11
-rw-r--r--include/linux/swap.h7
-rw-r--r--include/linux/swiotlb.h41
-rw-r--r--include/linux/synclink.h1
-rw-r--r--include/linux/syscalls.h66
-rw-r--r--include/linux/sysctl.h1
-rw-r--r--include/linux/tcp.h23
-rw-r--r--include/linux/thermal.h48
-rw-r--r--include/linux/time.h8
-rw-r--r--include/linux/timecompare.h125
-rw-r--r--include/linux/timer.h115
-rw-r--r--include/linux/timeriomem-rng.h21
-rw-r--r--include/linux/times.h8
-rw-r--r--include/linux/timex.h2
-rw-r--r--include/linux/topology.h17
-rw-r--r--include/linux/tpm.h35
-rw-r--r--include/linux/trace_clock.h19
-rw-r--r--include/linux/tracehook.h15
-rw-r--r--include/linux/tracepoint.h116
-rw-r--r--include/linux/tty_driver.h6
-rw-r--r--include/linux/types.h19
-rw-r--r--include/linux/uio_driver.h4
-rw-r--r--include/linux/usb.h193
-rw-r--r--include/linux/usb/cdc.h3
-rw-r--r--include/linux/usb/ch9.h183
-rw-r--r--include/linux/usb/composite.h8
-rw-r--r--include/linux/usb/gadget.h6
-rw-r--r--include/linux/usb/musb.h5
-rw-r--r--include/linux/usb/otg.h8
-rw-r--r--include/linux/usb/quirks.h3
-rw-r--r--include/linux/usb/rndis_host.h85
-rw-r--r--include/linux/usb/serial.h10
-rw-r--r--include/linux/usb/usbnet.h5
-rw-r--r--include/linux/usb/wusb.h3
-rw-r--r--include/linux/usb_usual.h21
-rw-r--r--include/linux/utime.h4
-rw-r--r--include/linux/video_decoder.h48
-rw-r--r--include/linux/video_encoder.h23
-rw-r--r--include/linux/videodev.h18
-rw-r--r--include/linux/videodev2.h74
-rw-r--r--include/linux/virtio_net.h72
-rw-r--r--include/linux/vmalloc.h4
-rw-r--r--include/linux/wait.h35
-rw-r--r--include/linux/wimax/debug.h2
-rw-r--r--include/linux/wimax/i2400m.h69
-rw-r--r--include/linux/wireless.h12
-rw-r--r--include/linux/workqueue.h5
-rw-r--r--include/linux/writeback.h6
-rw-r--r--include/linux/xfrm.h2
-rw-r--r--include/media/bt819.h33
-rw-r--r--include/media/cx2341x.h6
-rw-r--r--include/media/cx25840.h12
-rw-r--r--include/media/ir-common.h3
-rw-r--r--include/media/ir-kbd-i2c.h3
-rw-r--r--include/media/msp3400.h4
-rw-r--r--include/media/ov772x.h40
-rw-r--r--include/media/saa7146.h10
-rw-r--r--include/media/saa7146_vv.h17
-rw-r--r--include/media/sh_mobile_ceu.h5
-rw-r--r--include/media/soc_camera.h24
-rw-r--r--include/media/tvaudio.h19
-rw-r--r--include/media/v4l2-chip-ident.h94
-rw-r--r--include/media/v4l2-common.h159
-rw-r--r--include/media/v4l2-dev.h2
-rw-r--r--include/media/v4l2-device.h40
-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-ioctl.h2
-rw-r--r--include/media/v4l2-subdev.h137
-rw-r--r--include/media/videobuf-core.h1
-rw-r--r--include/mtd/inftl-user.h36
-rw-r--r--include/mtd/jffs2-user.h5
-rw-r--r--include/mtd/mtd-abi.h70
-rw-r--r--include/mtd/nftl-user.h32
-rw-r--r--include/mtd/ubi-user.h72
-rw-r--r--include/net/9p/client.h1
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/atmclip.h1
-rw-r--r--include/net/ax88796.h13
-rw-r--r--include/net/bluetooth/bluetooth.h12
-rw-r--r--include/net/bluetooth/hci.h9
-rw-r--r--include/net/bluetooth/hci_core.h93
-rw-r--r--include/net/bluetooth/l2cap.h13
-rw-r--r--include/net/bluetooth/rfcomm.h20
-rw-r--r--include/net/cfg80211.h417
-rw-r--r--include/net/cipso_ipv4.h17
-rw-r--r--include/net/dsa.h42
-rw-r--r--include/net/ethoc.h22
-rw-r--r--include/net/ieee80211.h1185
-rw-r--r--include/net/ieee80211_radiotap.h4
-rw-r--r--include/net/if_inet6.h5
-rw-r--r--include/net/inet_ecn.h4
-rw-r--r--include/net/inet_frag.h3
-rw-r--r--include/net/inet_hashtables.h4
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/ip_vs.h4
-rw-r--r--include/net/ipv6.h4
-rw-r--r--include/net/ipx.h2
-rw-r--r--include/net/mac80211.h342
-rw-r--r--include/net/net_namespace.h27
-rw-r--r--include/net/netfilter/nf_conntrack.h16
-rw-r--r--include/net/netfilter/nf_conntrack_core.h3
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h5
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h2
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h7
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h17
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h6
-rw-r--r--include/net/netfilter/nf_log.h11
-rw-r--r--include/net/netfilter/nf_nat.h1
-rw-r--r--include/net/netlabel.h17
-rw-r--r--include/net/netlink.h1
-rw-r--r--include/net/netns/conntrack.h5
-rw-r--r--include/net/netns/ipv4.h13
-rw-r--r--include/net/netrom.h4
-rw-r--r--include/net/phonet/phonet.h1
-rw-r--r--include/net/phonet/pn_dev.h5
-rw-r--r--include/net/pkt_sched.h1
-rw-r--r--include/net/psnap.h6
-rw-r--r--include/net/sch_generic.h28
-rw-r--r--include/net/sctp/checksum.h14
-rw-r--r--include/net/sctp/command.h3
-rw-r--r--include/net/sctp/sctp.h9
-rw-r--r--include/net/sctp/structs.h7
-rw-r--r--include/net/sock.h49
-rw-r--r--include/net/tcp.h66
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/net/wireless.h86
-rw-r--r--include/rdma/ib_cm.h12
-rw-r--r--include/rdma/ib_mad.h4
-rw-r--r--include/rdma/ib_smi.h34
-rw-r--r--include/rdma/ib_verbs.h2
-rw-r--r--include/scsi/fc/fc_fcoe.h11
-rw-r--r--include/scsi/fc/fc_fip.h237
-rw-r--r--include/scsi/fc/fc_fs.h6
-rw-r--r--include/scsi/fc_frame.h19
-rw-r--r--include/scsi/fc_transport_fcoe.h54
-rw-r--r--include/scsi/libfc.h213
-rw-r--r--include/scsi/libfcoe.h250
-rw-r--r--include/scsi/libiscsi.h21
-rw-r--r--include/scsi/osd_attributes.h327
-rw-r--r--include/scsi/osd_initiator.h433
-rw-r--r--include/scsi/osd_protocol.h625
-rw-r--r--include/scsi/osd_sec.h45
-rw-r--r--include/scsi/osd_sense.h260
-rw-r--r--include/scsi/osd_types.h40
-rw-r--r--include/scsi/scsi.h31
-rw-r--r--include/scsi/scsi_cmnd.h15
-rw-r--r--include/scsi/scsi_device.h10
-rw-r--r--include/scsi/scsi_scan.h11
-rw-r--r--include/scsi/scsi_transport_iscsi.h4
-rw-r--r--include/sound/ad1816a.h2
-rw-r--r--include/sound/asound.h194
-rw-r--r--include/sound/atmel-abdac.h23
-rw-r--r--include/sound/atmel-ac97c.h40
-rw-r--r--include/sound/control.h52
-rw-r--r--include/sound/core.h36
-rw-r--r--include/sound/emu10k1.h11
-rw-r--r--include/sound/hwdep.h38
-rw-r--r--include/sound/jack.h7
-rw-r--r--include/sound/pcm.h6
-rw-r--r--include/sound/rawmidi.h1
-rw-r--r--include/sound/sb.h4
-rw-r--r--include/sound/sfnt_info.h14
-rw-r--r--include/sound/soc-dai.h2
-rw-r--r--include/sound/soc-dapm.h31
-rw-r--r--include/sound/soc.h69
-rw-r--r--include/sound/tea575x-tuner.h8
-rw-r--r--include/sound/uda1341.h126
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/wss.h1
-rw-r--r--include/trace/block.h70
-rw-r--r--include/trace/irq.h9
-rw-r--r--include/trace/irq_event_types.h55
-rw-r--r--include/trace/kmemtrace.h63
-rw-r--r--include/trace/lockdep.h9
-rw-r--r--include/trace/lockdep_event_types.h44
-rw-r--r--include/trace/power.h32
-rw-r--r--include/trace/sched.h49
-rw-r--r--include/trace/sched_event_types.h337
-rw-r--r--include/trace/skb.h11
-rw-r--r--include/trace/syscall.h35
-rw-r--r--include/trace/trace_event_types.h5
-rw-r--r--include/trace/trace_events.h5
-rw-r--r--include/trace/workqueue.h25
-rw-r--r--include/video/aty128.h2
-rw-r--r--include/video/broadsheetfb.h59
-rw-r--r--include/video/cirrus.h2
-rw-r--r--include/video/cyblafb.h175
-rw-r--r--include/video/newport.h4
-rw-r--r--include/video/radeon.h564
-rw-r--r--include/video/s1d13xxxfb.h16
-rw-r--r--include/video/tdfx.h26
954 files changed, 18665 insertions, 36407 deletions
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index eda04546cdf6..473d584b1d31 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -103,8 +103,9 @@
103#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER) 103#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
104#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER) 104#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)
105#define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) 105#define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER)
106#define AE_BAD_ADDRESS (acpi_status) (0x0009 | AE_CODE_PROGRAMMER)
106 107
107#define AE_CODE_PGM_MAX 0x0008 108#define AE_CODE_PGM_MAX 0x0009
108 109
109/* 110/*
110 * Acpi table exceptions 111 * Acpi table exceptions
@@ -224,7 +225,8 @@ char const *acpi_gbl_exception_names_pgm[] = {
224 "AE_BAD_HEX_CONSTANT", 225 "AE_BAD_HEX_CONSTANT",
225 "AE_BAD_OCTAL_CONSTANT", 226 "AE_BAD_OCTAL_CONSTANT",
226 "AE_BAD_DECIMAL_CONSTANT", 227 "AE_BAD_DECIMAL_CONSTANT",
227 "AE_MISSING_ARGUMENTS" 228 "AE_MISSING_ARGUMENTS",
229 "AE_BAD_ADDRESS"
228}; 230};
229 231
230char const *acpi_gbl_exception_names_tbl[] = { 232char const *acpi_gbl_exception_names_tbl[] = {
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index e9f6574930ef..c34b11022908 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -88,44 +88,30 @@ struct acpi_device;
88 88
89typedef int (*acpi_op_add) (struct acpi_device * device); 89typedef int (*acpi_op_add) (struct acpi_device * device);
90typedef int (*acpi_op_remove) (struct acpi_device * device, int type); 90typedef int (*acpi_op_remove) (struct acpi_device * device, int type);
91typedef int (*acpi_op_lock) (struct acpi_device * device, int type);
92typedef int (*acpi_op_start) (struct acpi_device * device); 91typedef int (*acpi_op_start) (struct acpi_device * device);
93typedef int (*acpi_op_stop) (struct acpi_device * device, int type); 92typedef int (*acpi_op_stop) (struct acpi_device * device, int type);
94typedef int (*acpi_op_suspend) (struct acpi_device * device, 93typedef int (*acpi_op_suspend) (struct acpi_device * device,
95 pm_message_t state); 94 pm_message_t state);
96typedef int (*acpi_op_resume) (struct acpi_device * device); 95typedef int (*acpi_op_resume) (struct acpi_device * device);
97typedef int (*acpi_op_scan) (struct acpi_device * device);
98typedef int (*acpi_op_bind) (struct acpi_device * device); 96typedef int (*acpi_op_bind) (struct acpi_device * device);
99typedef int (*acpi_op_unbind) (struct acpi_device * device); 97typedef int (*acpi_op_unbind) (struct acpi_device * device);
100typedef int (*acpi_op_shutdown) (struct acpi_device * device); 98typedef void (*acpi_op_notify) (struct acpi_device * device, u32 event);
101 99
102struct acpi_bus_ops { 100struct acpi_bus_ops {
103 u32 acpi_op_add:1; 101 u32 acpi_op_add:1;
104 u32 acpi_op_remove:1;
105 u32 acpi_op_lock:1;
106 u32 acpi_op_start:1; 102 u32 acpi_op_start:1;
107 u32 acpi_op_stop:1;
108 u32 acpi_op_suspend:1;
109 u32 acpi_op_resume:1;
110 u32 acpi_op_scan:1;
111 u32 acpi_op_bind:1;
112 u32 acpi_op_unbind:1;
113 u32 acpi_op_shutdown:1;
114 u32 reserved:21;
115}; 103};
116 104
117struct acpi_device_ops { 105struct acpi_device_ops {
118 acpi_op_add add; 106 acpi_op_add add;
119 acpi_op_remove remove; 107 acpi_op_remove remove;
120 acpi_op_lock lock;
121 acpi_op_start start; 108 acpi_op_start start;
122 acpi_op_stop stop; 109 acpi_op_stop stop;
123 acpi_op_suspend suspend; 110 acpi_op_suspend suspend;
124 acpi_op_resume resume; 111 acpi_op_resume resume;
125 acpi_op_scan scan;
126 acpi_op_bind bind; 112 acpi_op_bind bind;
127 acpi_op_unbind unbind; 113 acpi_op_unbind unbind;
128 acpi_op_shutdown shutdown; 114 acpi_op_notify notify;
129}; 115};
130 116
131struct acpi_driver { 117struct acpi_driver {
@@ -284,7 +270,6 @@ struct acpi_device {
284 struct list_head children; 270 struct list_head children;
285 struct list_head node; 271 struct list_head node;
286 struct list_head wakeup_list; 272 struct list_head wakeup_list;
287 struct list_head g_list;
288 struct acpi_device_status status; 273 struct acpi_device_status status;
289 struct acpi_device_flags flags; 274 struct acpi_device_flags flags;
290 struct acpi_device_pnp pnp; 275 struct acpi_device_pnp pnp;
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index 5fc1bb0f4a90..0352c8f0b05b 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -67,6 +67,16 @@
67#define ACPI_BAY_HID "LNXIOBAY" 67#define ACPI_BAY_HID "LNXIOBAY"
68#define ACPI_DOCK_HID "LNXDOCK" 68#define ACPI_DOCK_HID "LNXDOCK"
69 69
70/*
71 * For fixed hardware buttons, we fabricate acpi_devices with HID
72 * ACPI_BUTTON_HID_POWERF or ACPI_BUTTON_HID_SLEEPF. Fixed hardware
73 * signals only an event; it doesn't supply a notification value.
74 * To allow drivers to treat notifications from fixed hardware the
75 * same as those from real devices, we turn the events into this
76 * notification value.
77 */
78#define ACPI_FIXED_HARDWARE_EVENT 0x100
79
70/* -------------------------------------------------------------------------- 80/* --------------------------------------------------------------------------
71 PCI 81 PCI
72 -------------------------------------------------------------------------- */ 82 -------------------------------------------------------------------------- */
@@ -99,24 +109,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain,
99 int bus); 109 int bus);
100 110
101/* -------------------------------------------------------------------------- 111/* --------------------------------------------------------------------------
102 Power Resource
103 -------------------------------------------------------------------------- */
104
105int acpi_device_sleep_wake(struct acpi_device *dev,
106 int enable, int sleep_state, int dev_state);
107int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state);
108int acpi_disable_wakeup_device_power(struct acpi_device *dev);
109int acpi_power_get_inferred_state(struct acpi_device *device);
110int acpi_power_transition(struct acpi_device *device, int state);
111extern int acpi_power_nocheck;
112
113/* --------------------------------------------------------------------------
114 Embedded Controller
115 -------------------------------------------------------------------------- */
116int acpi_ec_ecdt_probe(void);
117int acpi_boot_ec_enable(void);
118
119/* --------------------------------------------------------------------------
120 Processor 112 Processor
121 -------------------------------------------------------------------------- */ 113 -------------------------------------------------------------------------- */
122 114
@@ -165,9 +157,4 @@ static inline void unregister_hotplug_dock_device(acpi_handle handle)
165} 157}
166#endif 158#endif
167 159
168/*--------------------------------------------------------------------------
169 Suspend/Resume
170 -------------------------------------------------------------------------- */
171extern int acpi_sleep_init(void);
172
173#endif /*__ACPI_DRIVERS_H__*/ 160#endif /*__ACPI_DRIVERS_H__*/
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index a62720a7edc0..3e798593b17b 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -144,6 +144,7 @@ void __iomem *acpi_os_map_memory(acpi_physical_address where,
144 acpi_size length); 144 acpi_size length);
145 145
146void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); 146void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
147void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
147 148
148#ifdef ACPI_FUTURE_USAGE 149#ifdef ACPI_FUTURE_USAGE
149acpi_status 150acpi_status
@@ -241,10 +242,6 @@ acpi_os_derive_pci_id(acpi_handle rhandle,
241acpi_status acpi_os_validate_interface(char *interface); 242acpi_status acpi_os_validate_interface(char *interface);
242acpi_status acpi_osi_invalidate(char* interface); 243acpi_status acpi_osi_invalidate(char* interface);
243 244
244acpi_status
245acpi_os_validate_address(u8 space_id, acpi_physical_address address,
246 acpi_size length, char *name);
247
248u64 acpi_os_get_timer(void); 245u64 acpi_os_get_timer(void);
249 246
250acpi_status acpi_os_signal(u32 function, void *info); 247acpi_status acpi_os_signal(u32 function, void *info);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index c8e8cf45830f..4db89e98535d 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20081204 50#define ACPI_CA_VERSION 0x20090320
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -130,6 +130,10 @@ acpi_get_table_header(acpi_string signature,
130 struct acpi_table_header *out_table_header); 130 struct acpi_table_header *out_table_header);
131 131
132acpi_status 132acpi_status
133acpi_get_table_with_size(acpi_string signature,
134 u32 instance, struct acpi_table_header **out_table,
135 acpi_size *tbl_size);
136acpi_status
133acpi_get_table(acpi_string signature, 137acpi_get_table(acpi_string signature,
134 u32 instance, struct acpi_table_header **out_table); 138 u32 instance, struct acpi_table_header **out_table);
135 139
@@ -187,14 +191,12 @@ acpi_evaluate_object(acpi_handle object,
187 struct acpi_object_list *parameter_objects, 191 struct acpi_object_list *parameter_objects,
188 struct acpi_buffer *return_object_buffer); 192 struct acpi_buffer *return_object_buffer);
189 193
190#ifdef ACPI_FUTURE_USAGE
191acpi_status 194acpi_status
192acpi_evaluate_object_typed(acpi_handle object, 195acpi_evaluate_object_typed(acpi_handle object,
193 acpi_string pathname, 196 acpi_string pathname,
194 struct acpi_object_list *external_params, 197 struct acpi_object_list *external_params,
195 struct acpi_buffer *return_buffer, 198 struct acpi_buffer *return_buffer,
196 acpi_object_type return_type); 199 acpi_object_type return_type);
197#endif
198 200
199acpi_status 201acpi_status
200acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); 202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer);
@@ -345,17 +347,15 @@ acpi_resource_to_address64(struct acpi_resource *resource,
345 */ 347 */
346acpi_status acpi_reset(void); 348acpi_status acpi_reset(void);
347 349
348acpi_status acpi_get_register(u32 register_id, u32 * return_value); 350acpi_status acpi_read_bit_register(u32 register_id, u32 *return_value);
349 351
350acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value); 352acpi_status acpi_write_bit_register(u32 register_id, u32 value);
351 353
352acpi_status acpi_set_register(u32 register_id, u32 value); 354acpi_status acpi_set_firmware_waking_vector(u32 physical_address);
353 355
354acpi_status 356#if ACPI_MACHINE_WIDTH == 64
355acpi_set_firmware_waking_vector(u32 physical_address); 357acpi_status acpi_set_firmware_waking_vector64(u64 physical_address);
356 358#endif
357acpi_status
358acpi_set_firmware_waking_vector64(u64 physical_address);
359 359
360acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg); 360acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg);
361 361
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index bf8d4cfd8cf5..222733d01f36 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -214,11 +214,11 @@ struct acpi_table_fadt {
214 u16 flush_size; /* Processor's memory cache line width, in bytes */ 214 u16 flush_size; /* Processor's memory cache line width, in bytes */
215 u16 flush_stride; /* Number of flush strides that need to be read */ 215 u16 flush_stride; /* Number of flush strides that need to be read */
216 u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */ 216 u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */
217 u8 duty_width; /* Processor duty cycle value bit width in P_CNT register. */ 217 u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */
218 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */ 218 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */
219 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */ 219 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */
220 u8 century; /* Index to century in RTC CMOS RAM */ 220 u8 century; /* Index to century in RTC CMOS RAM */
221 u16 boot_flags; /* IA-PC Boot Architecture Flags. See Table 5-10 for description */ 221 u16 boot_flags; /* IA-PC Boot Architecture Flags (see below for individual flags) */
222 u8 reserved; /* Reserved, must be zero */ 222 u8 reserved; /* Reserved, must be zero */
223 u32 flags; /* Miscellaneous flag bits (see below for individual flags) */ 223 u32 flags; /* Miscellaneous flag bits (see below for individual flags) */
224 struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */ 224 struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */
@@ -236,32 +236,41 @@ struct acpi_table_fadt {
236 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ 236 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
237}; 237};
238 238
239/* FADT Boot Architecture Flags (boot_flags) */
240
241#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */
242#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */
243#define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */
244#define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */
245#define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */
246
247#define FADT2_REVISION_ID 3
248
239/* FADT flags */ 249/* FADT flags */
240 250
241#define ACPI_FADT_WBINVD (1) /* 00: The wbinvd instruction works properly */ 251#define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */
242#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: The wbinvd flushes but does not invalidate */ 252#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */
243#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: All processors support C1 state */ 253#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */
244#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: C2 state works on MP system */ 254#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */
245#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: Power button is handled as a generic feature */ 255#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */
246#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: Sleep button is handled as a generic feature, or not present */ 256#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */
247#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: RTC wakeup stat not in fixed register space */ 257#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status not in fixed register space */
248#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: RTC wakeup possible from S4 */ 258#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */
249#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: tmr_val is 32 bits 0=24-bits */ 259#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */
250#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: Docking supported */ 260#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */
251#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: System reset via the FADT RESET_REG supported */ 261#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: [V2] System reset via the FADT RESET_REG supported */
252#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: No internal expansion capabilities and case is sealed */ 262#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: [V3] No internal expansion capabilities and case is sealed */
253#define ACPI_FADT_HEADLESS (1<<12) /* 12: No local video capabilities or local input devices */ 263#define ACPI_FADT_HEADLESS (1<<12) /* 12: [V3] No local video capabilities or local input devices */
254#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: Must execute native instruction after writing SLP_TYPx register */ 264#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: [V3] Must execute native instruction after writing SLP_TYPx register */
255#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ 265#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: [V4] System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
256#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ 266#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: [V4] OSPM should use platform-provided timer (ACPI 3.0) */
257#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ 267#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: [V4] Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
258#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: System is compatible with remote power on (ACPI 3.0) */ 268#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */
259#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: All local APICs must use cluster model (ACPI 3.0) */ 269#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */
260#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */ 270#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */
271
272/* FADT Prefered Power Management Profiles */
261 273
262/*
263 * FADT Prefered Power Management Profiles
264 */
265enum acpi_prefered_pm_profiles { 274enum acpi_prefered_pm_profiles {
266 PM_UNSPECIFIED = 0, 275 PM_UNSPECIFIED = 0,
267 PM_DESKTOP = 1, 276 PM_DESKTOP = 1,
@@ -272,16 +281,6 @@ enum acpi_prefered_pm_profiles {
272 PM_APPLIANCE_PC = 6 281 PM_APPLIANCE_PC = 6
273}; 282};
274 283
275/* FADT Boot Arch Flags */
276
277#define BAF_LEGACY_DEVICES 0x0001
278#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
279#define BAF_MSI_NOT_SUPPORTED 0x0008
280#define BAF_PCIE_ASPM_CONTROL 0x0010
281
282#define FADT2_REVISION_ID 3
283#define FADT2_MINUS_REVISION_ID 2
284
285/* Reset to default packing */ 284/* Reset to default packing */
286 285
287#pragma pack() 286#pragma pack()
@@ -310,8 +309,9 @@ struct acpi_table_desc {
310#define ACPI_TABLE_ORIGIN_UNKNOWN (0) 309#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
311#define ACPI_TABLE_ORIGIN_MAPPED (1) 310#define ACPI_TABLE_ORIGIN_MAPPED (1)
312#define ACPI_TABLE_ORIGIN_ALLOCATED (2) 311#define ACPI_TABLE_ORIGIN_ALLOCATED (2)
313#define ACPI_TABLE_ORIGIN_MASK (3) 312#define ACPI_TABLE_ORIGIN_OVERRIDE (4)
314#define ACPI_TABLE_IS_LOADED (4) 313#define ACPI_TABLE_ORIGIN_MASK (7)
314#define ACPI_TABLE_IS_LOADED (8)
315 315
316/* 316/*
317 * Get the remaining ACPI tables 317 * Get the remaining ACPI tables
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 18963b968114..59ade0752473 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -1016,9 +1016,9 @@ struct acpi_madt_interrupt_source {
1016struct acpi_madt_local_x2apic { 1016struct acpi_madt_local_x2apic {
1017 struct acpi_subtable_header header; 1017 struct acpi_subtable_header header;
1018 u16 reserved; /* Reserved - must be zero */ 1018 u16 reserved; /* Reserved - must be zero */
1019 u32 local_apic_id; /* Processor X2_APIC ID */ 1019 u32 local_apic_id; /* Processor x2APIC ID */
1020 u32 lapic_flags; 1020 u32 lapic_flags;
1021 u32 uid; /* Extended X2_APIC processor ID */ 1021 u32 uid; /* ACPI processor UID */
1022}; 1022};
1023 1023
1024/* 10: Local X2APIC NMI (07/2008) */ 1024/* 10: Local X2APIC NMI (07/2008) */
@@ -1026,7 +1026,7 @@ struct acpi_madt_local_x2apic {
1026struct acpi_madt_local_x2apic_nmi { 1026struct acpi_madt_local_x2apic_nmi {
1027 struct acpi_subtable_header header; 1027 struct acpi_subtable_header header;
1028 u16 inti_flags; 1028 u16 inti_flags;
1029 u32 uid; /* Processor X2_APIC ID */ 1029 u32 uid; /* ACPI processor UID */
1030 u8 lint; /* LINTn to which NMI is connected */ 1030 u8 lint; /* LINTn to which NMI is connected */
1031 u8 reserved[3]; 1031 u8 reserved[3];
1032}; 1032};
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index a20aab510173..f555d927f7c0 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -777,17 +777,25 @@ typedef u8 acpi_adr_space_type;
777#define ACPI_BITREG_SCI_ENABLE 0x0E 777#define ACPI_BITREG_SCI_ENABLE 0x0E
778#define ACPI_BITREG_BUS_MASTER_RLD 0x0F 778#define ACPI_BITREG_BUS_MASTER_RLD 0x0F
779#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 779#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10
780#define ACPI_BITREG_SLEEP_TYPE_A 0x11 780#define ACPI_BITREG_SLEEP_TYPE 0x11
781#define ACPI_BITREG_SLEEP_TYPE_B 0x12 781#define ACPI_BITREG_SLEEP_ENABLE 0x12
782#define ACPI_BITREG_SLEEP_ENABLE 0x13
783 782
784/* PM2 Control register */ 783/* PM2 Control register */
785 784
786#define ACPI_BITREG_ARB_DISABLE 0x14 785#define ACPI_BITREG_ARB_DISABLE 0x13
787 786
788#define ACPI_BITREG_MAX 0x14 787#define ACPI_BITREG_MAX 0x13
789#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 788#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
790 789
790/* Status register values. A 1 clears a status bit. 0 = no effect */
791
792#define ACPI_CLEAR_STATUS 1
793
794/* Enable and Control register values */
795
796#define ACPI_ENABLE_EVENT 1
797#define ACPI_DISABLE_EVENT 0
798
791/* 799/*
792 * External ACPI object definition 800 * External ACPI object definition
793 */ 801 */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 0574add2a1e3..4927c063347c 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -84,7 +84,6 @@ struct acpi_processor_power {
84 struct acpi_processor_cx *state; 84 struct acpi_processor_cx *state;
85 unsigned long bm_check_timestamp; 85 unsigned long bm_check_timestamp;
86 u32 default_state; 86 u32 default_state;
87 u32 bm_activity;
88 int count; 87 int count;
89 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; 88 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
90 int timer_broadcast_on_state; 89 int timer_broadcast_on_state;
@@ -322,7 +321,7 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
322int acpi_processor_tstate_has_changed(struct acpi_processor *pr); 321int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
323int acpi_processor_get_throttling_info(struct acpi_processor *pr); 322int acpi_processor_get_throttling_info(struct acpi_processor *pr);
324extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state); 323extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
325extern struct file_operations acpi_processor_throttling_fops; 324extern const struct file_operations acpi_processor_throttling_fops;
326extern void acpi_processor_throttling_init(void); 325extern void acpi_processor_throttling_init(void);
327/* in processor_idle.c */ 326/* in processor_idle.c */
328int acpi_processor_power_init(struct acpi_processor *pr, 327int acpi_processor_power_init(struct acpi_processor *pr,
@@ -336,7 +335,7 @@ extern struct cpuidle_driver acpi_idle_driver;
336 335
337/* in processor_thermal.c */ 336/* in processor_thermal.c */
338int acpi_processor_get_limit_info(struct acpi_processor *pr); 337int acpi_processor_get_limit_info(struct acpi_processor *pr);
339extern struct file_operations acpi_processor_limit_fops; 338extern const struct file_operations acpi_processor_limit_fops;
340extern struct thermal_cooling_device_ops processor_cooling_ops; 339extern struct thermal_cooling_device_ops processor_cooling_ops;
341#ifdef CONFIG_CPU_FREQ 340#ifdef CONFIG_CPU_FREQ
342void acpi_thermal_cpufreq_init(void); 341void acpi_thermal_cpufreq_init(void);
diff --git a/include/acpi/video.h b/include/acpi/video.h
new file mode 100644
index 000000000000..af6fe95fd3d0
--- /dev/null
+++ b/include/acpi/video.h
@@ -0,0 +1,13 @@
1#ifndef __ACPI_VIDEO_H
2#define __ACPI_VIDEO_H
3
4#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
5extern int acpi_video_register(void);
6extern int acpi_video_exit(void);
7#else
8static inline int acpi_video_register(void) { return 0; }
9static inline void acpi_video_exit(void) { return; }
10#endif
11
12#endif
13
diff --git a/include/asm-arm/.gitignore b/include/asm-arm/.gitignore
deleted file mode 100644
index e02c15d158fc..000000000000
--- a/include/asm-arm/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
1arch
2mach-types.h
diff --git a/include/asm-arm/plat-s3c24xx/regs-iis.h b/include/asm-arm/plat-s3c24xx/regs-iis.h
deleted file mode 100644
index a6f1d5df13b4..000000000000
--- a/include/asm-arm/plat-s3c24xx/regs-iis.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-iis.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * S3C2410 IIS register definition
11*/
12
13#ifndef __ASM_ARCH_REGS_IIS_H
14#define __ASM_ARCH_REGS_IIS_H
15
16#define S3C2410_IISCON (0x00)
17
18#define S3C2410_IISCON_LRINDEX (1<<8)
19#define S3C2410_IISCON_TXFIFORDY (1<<7)
20#define S3C2410_IISCON_RXFIFORDY (1<<6)
21#define S3C2410_IISCON_TXDMAEN (1<<5)
22#define S3C2410_IISCON_RXDMAEN (1<<4)
23#define S3C2410_IISCON_TXIDLE (1<<3)
24#define S3C2410_IISCON_RXIDLE (1<<2)
25#define S3C2410_IISCON_PSCEN (1<<1)
26#define S3C2410_IISCON_IISEN (1<<0)
27
28#define S3C2410_IISMOD (0x04)
29
30#define S3C2440_IISMOD_MPLL (1<<9)
31#define S3C2410_IISMOD_SLAVE (1<<8)
32#define S3C2410_IISMOD_NOXFER (0<<6)
33#define S3C2410_IISMOD_RXMODE (1<<6)
34#define S3C2410_IISMOD_TXMODE (2<<6)
35#define S3C2410_IISMOD_TXRXMODE (3<<6)
36#define S3C2410_IISMOD_LR_LLOW (0<<5)
37#define S3C2410_IISMOD_LR_RLOW (1<<5)
38#define S3C2410_IISMOD_IIS (0<<4)
39#define S3C2410_IISMOD_MSB (1<<4)
40#define S3C2410_IISMOD_8BIT (0<<3)
41#define S3C2410_IISMOD_16BIT (1<<3)
42#define S3C2410_IISMOD_BITMASK (1<<3)
43#define S3C2410_IISMOD_256FS (0<<2)
44#define S3C2410_IISMOD_384FS (1<<2)
45#define S3C2410_IISMOD_16FS (0<<0)
46#define S3C2410_IISMOD_32FS (1<<0)
47#define S3C2410_IISMOD_48FS (2<<0)
48#define S3C2410_IISMOD_FS_MASK (3<<0)
49
50#define S3C2410_IISPSR (0x08)
51#define S3C2410_IISPSR_INTMASK (31<<5)
52#define S3C2410_IISPSR_INTSHIFT (5)
53#define S3C2410_IISPSR_EXTMASK (31<<0)
54#define S3C2410_IISPSR_EXTSHFIT (0)
55
56#define S3C2410_IISFCON (0x0c)
57
58#define S3C2410_IISFCON_TXDMA (1<<15)
59#define S3C2410_IISFCON_RXDMA (1<<14)
60#define S3C2410_IISFCON_TXENABLE (1<<13)
61#define S3C2410_IISFCON_RXENABLE (1<<12)
62#define S3C2410_IISFCON_TXMASK (0x3f << 6)
63#define S3C2410_IISFCON_TXSHIFT (6)
64#define S3C2410_IISFCON_RXMASK (0x3f)
65#define S3C2410_IISFCON_RXSHIFT (0)
66
67#define S3C2400_IISFCON_TXDMA (1<<11)
68#define S3C2400_IISFCON_RXDMA (1<<10)
69#define S3C2400_IISFCON_TXENABLE (1<<9)
70#define S3C2400_IISFCON_RXENABLE (1<<8)
71#define S3C2400_IISFCON_TXMASK (0x07 << 4)
72#define S3C2400_IISFCON_TXSHIFT (4)
73#define S3C2400_IISFCON_RXMASK (0x07)
74#define S3C2400_IISFCON_RXSHIFT (0)
75
76#define S3C2410_IISFIFO (0x10)
77#endif /* __ASM_ARCH_REGS_IIS_H */
diff --git a/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h b/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
deleted file mode 100644
index 25d4058bcfed..000000000000
--- a/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/* linux/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
2 *
3 * Copyright 2007 Simtec Electronics <linux@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * S3C2412 IIS register definition
11*/
12
13#ifndef __ASM_ARCH_REGS_S3C2412_IIS_H
14#define __ASM_ARCH_REGS_S3C2412_IIS_H
15
16#define S3C2412_IISCON (0x00)
17#define S3C2412_IISMOD (0x04)
18#define S3C2412_IISFIC (0x08)
19#define S3C2412_IISPSR (0x0C)
20#define S3C2412_IISTXD (0x10)
21#define S3C2412_IISRXD (0x14)
22
23#define S3C2412_IISCON_LRINDEX (1 << 11)
24#define S3C2412_IISCON_TXFIFO_EMPTY (1 << 10)
25#define S3C2412_IISCON_RXFIFO_EMPTY (1 << 9)
26#define S3C2412_IISCON_TXFIFO_FULL (1 << 8)
27#define S3C2412_IISCON_RXFIFO_FULL (1 << 7)
28#define S3C2412_IISCON_TXDMA_PAUSE (1 << 6)
29#define S3C2412_IISCON_RXDMA_PAUSE (1 << 5)
30#define S3C2412_IISCON_TXCH_PAUSE (1 << 4)
31#define S3C2412_IISCON_RXCH_PAUSE (1 << 3)
32#define S3C2412_IISCON_TXDMA_ACTIVE (1 << 2)
33#define S3C2412_IISCON_RXDMA_ACTIVE (1 << 1)
34#define S3C2412_IISCON_IIS_ACTIVE (1 << 0)
35
36#define S3C2412_IISMOD_MASTER_INTERNAL (0 << 10)
37#define S3C2412_IISMOD_MASTER_EXTERNAL (1 << 10)
38#define S3C2412_IISMOD_SLAVE (2 << 10)
39#define S3C2412_IISMOD_MASTER_MASK (3 << 10)
40#define S3C2412_IISMOD_MODE_TXONLY (0 << 8)
41#define S3C2412_IISMOD_MODE_RXONLY (1 << 8)
42#define S3C2412_IISMOD_MODE_TXRX (2 << 8)
43#define S3C2412_IISMOD_MODE_MASK (3 << 8)
44#define S3C2412_IISMOD_LR_LLOW (0 << 7)
45#define S3C2412_IISMOD_LR_RLOW (1 << 7)
46#define S3C2412_IISMOD_SDF_IIS (0 << 5)
47#define S3C2412_IISMOD_SDF_MSB (0 << 5)
48#define S3C2412_IISMOD_SDF_LSB (0 << 5)
49#define S3C2412_IISMOD_SDF_MASK (3 << 5)
50#define S3C2412_IISMOD_RCLK_256FS (0 << 3)
51#define S3C2412_IISMOD_RCLK_512FS (1 << 3)
52#define S3C2412_IISMOD_RCLK_384FS (2 << 3)
53#define S3C2412_IISMOD_RCLK_768FS (3 << 3)
54#define S3C2412_IISMOD_RCLK_MASK (3 << 3)
55#define S3C2412_IISMOD_BCLK_32FS (0 << 1)
56#define S3C2412_IISMOD_BCLK_48FS (1 << 1)
57#define S3C2412_IISMOD_BCLK_16FS (2 << 1)
58#define S3C2412_IISMOD_BCLK_24FS (3 << 1)
59#define S3C2412_IISMOD_BCLK_MASK (3 << 1)
60#define S3C2412_IISMOD_8BIT (1 << 0)
61
62#define S3C2412_IISPSR_PSREN (1 << 15)
63
64#define S3C2412_IISFIC_TXFLUSH (1 << 15)
65#define S3C2412_IISFIC_RXFLUSH (1 << 7)
66#define S3C2412_IISFIC_TXCOUNT(x) (((x) >> 8) & 0xf)
67#define S3C2412_IISFIC_RXCOUNT(x) (((x) >> 0) & 0xf)
68
69
70
71#endif /* __ASM_ARCH_REGS_S3C2412_IIS_H */
72
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/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 26cefcde5cee..000000000000
--- a/include/asm-frv/highmem.h
+++ /dev/null
@@ -1,180 +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 <asm/mem-layout.h>
22#include <asm/spr-regs.h>
23#include <asm/mb-regs.h>
24
25#define NR_TLB_LINES 64 /* number of lines in the TLB */
26
27#ifndef __ASSEMBLY__
28
29#include <linux/interrupt.h>
30#include <asm/kmap_types.h>
31#include <asm/pgtable.h>
32
33#ifdef CONFIG_DEBUG_HIGHMEM
34#define HIGHMEM_DEBUG 1
35#else
36#define HIGHMEM_DEBUG 0
37#endif
38
39/* declarations for highmem.c */
40extern unsigned long highstart_pfn, highend_pfn;
41
42#define kmap_prot PAGE_KERNEL
43#define kmap_pte ______kmap_pte_in_TLB
44extern pte_t *pkmap_page_table;
45
46#define flush_cache_kmaps() do { } while (0)
47
48/*
49 * Right now we initialize only a single pte table. It can be extended
50 * easily, subsequent pte tables have to be allocated in one physical
51 * chunk of RAM.
52 */
53#define LAST_PKMAP PTRS_PER_PTE
54#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
55#define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
56#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
57
58extern void *kmap_high(struct page *page);
59extern void kunmap_high(struct page *page);
60
61extern void *kmap(struct page *page);
62extern void kunmap(struct page *page);
63
64extern struct page *kmap_atomic_to_page(void *ptr);
65
66#endif /* !__ASSEMBLY__ */
67
68/*
69 * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
70 * gives a more generic (and caching) interface. But kmap_atomic can
71 * be used in IRQ contexts, so in some (very limited) cases we need
72 * it.
73 */
74#define KMAP_ATOMIC_CACHE_DAMR 8
75
76#ifndef __ASSEMBLY__
77
78#define __kmap_atomic_primary(type, paddr, ampr) \
79({ \
80 unsigned long damlr, dampr; \
81 \
82 dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \
83 \
84 if (type != __KM_CACHE) \
85 asm volatile("movgs %0,dampr"#ampr :: "r"(dampr) : "memory"); \
86 else \
87 asm volatile("movgs %0,iampr"#ampr"\n" \
88 "movgs %0,dampr"#ampr"\n" \
89 :: "r"(dampr) : "memory" \
90 ); \
91 \
92 asm("movsg damlr"#ampr",%0" : "=r"(damlr)); \
93 \
94 /*printk("DAMR"#ampr": PRIM sl=%d L=%08lx P=%08lx\n", type, damlr, dampr);*/ \
95 \
96 (void *) damlr; \
97})
98
99#define __kmap_atomic_secondary(slot, paddr) \
100({ \
101 unsigned long damlr = KMAP_ATOMIC_SECONDARY_FRAME + (slot) * PAGE_SIZE; \
102 unsigned long dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \
103 \
104 asm volatile("movgs %0,tplr \n" \
105 "movgs %1,tppr \n" \
106 "tlbpr %0,gr0,#2,#1" \
107 : : "r"(damlr), "r"(dampr) : "memory"); \
108 \
109 /*printk("TLB: SECN sl=%d L=%08lx P=%08lx\n", slot, damlr, dampr);*/ \
110 \
111 (void *) damlr; \
112})
113
114static inline void *kmap_atomic(struct page *page, enum km_type type)
115{
116 unsigned long paddr;
117
118 pagefault_disable();
119 paddr = page_to_phys(page);
120
121 switch (type) {
122 case 0: return __kmap_atomic_primary(0, paddr, 2);
123 case 1: return __kmap_atomic_primary(1, paddr, 3);
124 case 2: return __kmap_atomic_primary(2, paddr, 4);
125 case 3: return __kmap_atomic_primary(3, paddr, 5);
126 case 4: return __kmap_atomic_primary(4, paddr, 6);
127 case 5: return __kmap_atomic_primary(5, paddr, 7);
128 case 6: return __kmap_atomic_primary(6, paddr, 8);
129 case 7: return __kmap_atomic_primary(7, paddr, 9);
130 case 8: return __kmap_atomic_primary(8, paddr, 10);
131
132 case 9 ... 9 + NR_TLB_LINES - 1:
133 return __kmap_atomic_secondary(type - 9, paddr);
134
135 default:
136 BUG();
137 return NULL;
138 }
139}
140
141#define __kunmap_atomic_primary(type, ampr) \
142do { \
143 asm volatile("movgs gr0,dampr"#ampr"\n" ::: "memory"); \
144 if (type == __KM_CACHE) \
145 asm volatile("movgs gr0,iampr"#ampr"\n" ::: "memory"); \
146} while(0)
147
148#define __kunmap_atomic_secondary(slot, vaddr) \
149do { \
150 asm volatile("tlbpr %0,gr0,#4,#1" : : "r"(vaddr) : "memory"); \
151} while(0)
152
153static inline void kunmap_atomic(void *kvaddr, enum km_type type)
154{
155 switch (type) {
156 case 0: __kunmap_atomic_primary(0, 2); break;
157 case 1: __kunmap_atomic_primary(1, 3); break;
158 case 2: __kunmap_atomic_primary(2, 4); break;
159 case 3: __kunmap_atomic_primary(3, 5); break;
160 case 4: __kunmap_atomic_primary(4, 6); break;
161 case 5: __kunmap_atomic_primary(5, 7); break;
162 case 6: __kunmap_atomic_primary(6, 8); break;
163 case 7: __kunmap_atomic_primary(7, 9); break;
164 case 8: __kunmap_atomic_primary(8, 10); break;
165
166 case 9 ... 9 + NR_TLB_LINES - 1:
167 __kunmap_atomic_secondary(type - 9, kvaddr);
168 break;
169
170 default:
171 BUG();
172 }
173 pagefault_enable();
174}
175
176#endif /* !__ASSEMBLY__ */
177
178#endif /* __KERNEL__ */
179
180#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/ide.h b/include/asm-frv/ide.h
deleted file mode 100644
index 361076611855..000000000000
--- a/include/asm-frv/ide.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* ide.h: FRV IDE declarations
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_IDE_H
13#define _ASM_IDE_H
14
15#ifdef __KERNEL__
16
17#include <asm/setup.h>
18#include <asm/io.h>
19#include <asm/irq.h>
20
21#include <asm-generic/ide_iops.h>
22
23#endif /* __KERNEL__ */
24#endif /* _ASM_IDE_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 e51ca67b9356..000000000000
--- a/include/asm-frv/socket.h
+++ /dev/null
@@ -1,58 +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#endif /* _ASM_SOCKET_H */
58
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 afb3396ba5ed..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 <asm/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/atomic.h b/include/asm-generic/atomic.h
index 7abdaa91ccd3..3673a13b6703 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -132,9 +132,9 @@ static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)
132#define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l)) 132#define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l))
133 133
134#define atomic_long_cmpxchg(l, old, new) \ 134#define atomic_long_cmpxchg(l, old, new) \
135 (atomic_cmpxchg((atomic64_t *)(l), (old), (new))) 135 (atomic64_cmpxchg((atomic64_t *)(l), (old), (new)))
136#define atomic_long_xchg(v, new) \ 136#define atomic_long_xchg(v, new) \
137 (atomic_xchg((atomic64_t *)(l), (new))) 137 (atomic64_xchg((atomic64_t *)(l), (new)))
138 138
139#else /* BITS_PER_LONG == 64 */ 139#else /* BITS_PER_LONG == 64 */
140 140
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 37b82cb96c89..4b6755984d24 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -58,12 +58,13 @@ struct bug_entry {
58 */ 58 */
59#ifndef __WARN 59#ifndef __WARN
60#ifndef __ASSEMBLY__ 60#ifndef __ASSEMBLY__
61extern void warn_slowpath(const char *file, const int line, 61extern void warn_slowpath_fmt(const char *file, const int line,
62 const char *fmt, ...) __attribute__((format(printf, 3, 4))); 62 const char *fmt, ...) __attribute__((format(printf, 3, 4)));
63extern void warn_slowpath_null(const char *file, const int line);
63#define WANT_WARN_ON_SLOWPATH 64#define WANT_WARN_ON_SLOWPATH
64#endif 65#endif
65#define __WARN() warn_slowpath(__FILE__, __LINE__, NULL) 66#define __WARN() warn_slowpath_null(__FILE__, __LINE__)
66#define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg) 67#define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg)
67#else 68#else
68#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0) 69#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
69#endif 70#endif
@@ -88,7 +89,7 @@ extern void warn_slowpath(const char *file, const int line,
88 89
89#else /* !CONFIG_BUG */ 90#else /* !CONFIG_BUG */
90#ifndef HAVE_ARCH_BUG 91#ifndef HAVE_ARCH_BUG
91#define BUG() 92#define BUG() do {} while(0)
92#endif 93#endif
93 94
94#ifndef HAVE_ARCH_BUG_ON 95#ifndef HAVE_ARCH_BUG_ON
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
deleted file mode 100644
index 189486c3f92e..000000000000
--- a/include/asm-generic/dma-mapping.h
+++ /dev/null
@@ -1,308 +0,0 @@
1/* Copyright (C) 2002 by James.Bottomley@HansenPartnership.com
2 *
3 * Implements the generic device dma API via the existing pci_ one
4 * for unconverted architectures
5 */
6
7#ifndef _ASM_GENERIC_DMA_MAPPING_H
8#define _ASM_GENERIC_DMA_MAPPING_H
9
10
11#ifdef CONFIG_PCI
12
13/* we implement the API below in terms of the existing PCI one,
14 * so include it */
15#include <linux/pci.h>
16/* need struct page definitions */
17#include <linux/mm.h>
18
19static inline int
20dma_supported(struct device *dev, u64 mask)
21{
22 BUG_ON(dev->bus != &pci_bus_type);
23
24 return pci_dma_supported(to_pci_dev(dev), mask);
25}
26
27static inline int
28dma_set_mask(struct device *dev, u64 dma_mask)
29{
30 BUG_ON(dev->bus != &pci_bus_type);
31
32 return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
33}
34
35static inline void *
36dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
37 gfp_t flag)
38{
39 BUG_ON(dev->bus != &pci_bus_type);
40
41 return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle);
42}
43
44static inline void
45dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
46 dma_addr_t dma_handle)
47{
48 BUG_ON(dev->bus != &pci_bus_type);
49
50 pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
51}
52
53static inline dma_addr_t
54dma_map_single(struct device *dev, void *cpu_addr, size_t size,
55 enum dma_data_direction direction)
56{
57 BUG_ON(dev->bus != &pci_bus_type);
58
59 return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
60}
61
62static inline void
63dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
64 enum dma_data_direction direction)
65{
66 BUG_ON(dev->bus != &pci_bus_type);
67
68 pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
69}
70
71static inline dma_addr_t
72dma_map_page(struct device *dev, struct page *page,
73 unsigned long offset, size_t size,
74 enum dma_data_direction direction)
75{
76 BUG_ON(dev->bus != &pci_bus_type);
77
78 return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
79}
80
81static inline void
82dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
83 enum dma_data_direction direction)
84{
85 BUG_ON(dev->bus != &pci_bus_type);
86
87 pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
88}
89
90static inline int
91dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
92 enum dma_data_direction direction)
93{
94 BUG_ON(dev->bus != &pci_bus_type);
95
96 return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
97}
98
99static inline void
100dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
101 enum dma_data_direction direction)
102{
103 BUG_ON(dev->bus != &pci_bus_type);
104
105 pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
106}
107
108static inline void
109dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
110 enum dma_data_direction direction)
111{
112 BUG_ON(dev->bus != &pci_bus_type);
113
114 pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle,
115 size, (int)direction);
116}
117
118static inline void
119dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
120 enum dma_data_direction direction)
121{
122 BUG_ON(dev->bus != &pci_bus_type);
123
124 pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle,
125 size, (int)direction);
126}
127
128static inline void
129dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
130 enum dma_data_direction direction)
131{
132 BUG_ON(dev->bus != &pci_bus_type);
133
134 pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction);
135}
136
137static inline void
138dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
139 enum dma_data_direction direction)
140{
141 BUG_ON(dev->bus != &pci_bus_type);
142
143 pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction);
144}
145
146static inline int
147dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
148{
149 return pci_dma_mapping_error(to_pci_dev(dev), dma_addr);
150}
151
152
153#else
154
155static inline int
156dma_supported(struct device *dev, u64 mask)
157{
158 return 0;
159}
160
161static inline int
162dma_set_mask(struct device *dev, u64 dma_mask)
163{
164 BUG();
165 return 0;
166}
167
168static inline void *
169dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
170 gfp_t flag)
171{
172 BUG();
173 return NULL;
174}
175
176static inline void
177dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
178 dma_addr_t dma_handle)
179{
180 BUG();
181}
182
183static inline dma_addr_t
184dma_map_single(struct device *dev, void *cpu_addr, size_t size,
185 enum dma_data_direction direction)
186{
187 BUG();
188 return 0;
189}
190
191static inline void
192dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
193 enum dma_data_direction direction)
194{
195 BUG();
196}
197
198static inline dma_addr_t
199dma_map_page(struct device *dev, struct page *page,
200 unsigned long offset, size_t size,
201 enum dma_data_direction direction)
202{
203 BUG();
204 return 0;
205}
206
207static inline void
208dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
209 enum dma_data_direction direction)
210{
211 BUG();
212}
213
214static inline int
215dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
216 enum dma_data_direction direction)
217{
218 BUG();
219 return 0;
220}
221
222static inline void
223dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
224 enum dma_data_direction direction)
225{
226 BUG();
227}
228
229static inline void
230dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
231 enum dma_data_direction direction)
232{
233 BUG();
234}
235
236static inline void
237dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
238 enum dma_data_direction direction)
239{
240 BUG();
241}
242
243static inline void
244dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
245 enum dma_data_direction direction)
246{
247 BUG();
248}
249
250static inline void
251dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
252 enum dma_data_direction direction)
253{
254 BUG();
255}
256
257static inline int
258dma_error(dma_addr_t dma_addr)
259{
260 return 0;
261}
262
263#endif
264
265/* Now for the API extensions over the pci_ one */
266
267#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
268#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
269#define dma_is_consistent(d, h) (1)
270
271static inline int
272dma_get_cache_alignment(void)
273{
274 /* no easy way to get cache size on all processors, so return
275 * the maximum possible, to be safe */
276 return (1 << INTERNODE_CACHE_SHIFT);
277}
278
279static inline void
280dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
281 unsigned long offset, size_t size,
282 enum dma_data_direction direction)
283{
284 /* just sync everything, that's all the pci API can do */
285 dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
286}
287
288static inline void
289dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
290 unsigned long offset, size_t size,
291 enum dma_data_direction direction)
292{
293 /* just sync everything, that's all the pci API can do */
294 dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
295}
296
297static inline void
298dma_cache_sync(struct device *dev, void *vaddr, size_t size,
299 enum dma_data_direction direction)
300{
301 /* could define this in terms of the dma_cache ... operations,
302 * but if you get this on a platform, you should convert the platform
303 * to using the generic device DMA API */
304 BUG();
305}
306
307#endif
308
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index b8477414c5c8..4d3e48373e74 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -117,9 +117,9 @@
117struct flock { 117struct flock {
118 short l_type; 118 short l_type;
119 short l_whence; 119 short l_whence;
120 off_t l_start; 120 __kernel_off_t l_start;
121 off_t l_len; 121 __kernel_off_t l_len;
122 pid_t l_pid; 122 __kernel_pid_t l_pid;
123 __ARCH_FLOCK_PAD 123 __ARCH_FLOCK_PAD
124}; 124};
125#endif 125#endif
@@ -140,9 +140,9 @@ struct flock {
140struct flock64 { 140struct flock64 {
141 short l_type; 141 short l_type;
142 short l_whence; 142 short l_whence;
143 loff_t l_start; 143 __kernel_loff_t l_start;
144 loff_t l_len; 144 __kernel_loff_t l_len;
145 pid_t l_pid; 145 __kernel_pid_t l_pid;
146 __ARCH_FLOCK64_PAD 146 __ARCH_FLOCK64_PAD
147}; 147};
148#endif 148#endif
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 81797ec9ab29..d6c379dc64fa 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -55,6 +55,10 @@ struct module;
55 * handled is (base + ngpio - 1). 55 * handled is (base + ngpio - 1).
56 * @can_sleep: flag must be set iff get()/set() methods sleep, as they 56 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
57 * must while accessing GPIO expander chips over I2C or SPI 57 * must while accessing GPIO expander chips over I2C or SPI
58 * @names: if set, must be an array of strings to use as alternative
59 * names for the GPIOs in this chip. Any entry in the array
60 * may be NULL if there is no alias for the GPIO, however the
61 * array must be @ngpio entries long.
58 * 62 *
59 * A gpio_chip can help platforms abstract various sources of GPIOs so 63 * A gpio_chip can help platforms abstract various sources of GPIOs so
60 * they can all be accessed through a common programing interface. 64 * they can all be accessed through a common programing interface.
@@ -92,6 +96,7 @@ struct gpio_chip {
92 struct gpio_chip *chip); 96 struct gpio_chip *chip);
93 int base; 97 int base;
94 u16 ngpio; 98 u16 ngpio;
99 char **names;
95 unsigned can_sleep:1; 100 unsigned can_sleep:1;
96 unsigned exported:1; 101 unsigned exported:1;
97}; 102};
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index b0e63c672ebd..d7d50d7ee51e 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -1,13 +1,9 @@
1#ifndef _ASM_GENERIC_PERCPU_H_ 1#ifndef _ASM_GENERIC_PERCPU_H_
2#define _ASM_GENERIC_PERCPU_H_ 2#define _ASM_GENERIC_PERCPU_H_
3
3#include <linux/compiler.h> 4#include <linux/compiler.h>
4#include <linux/threads.h> 5#include <linux/threads.h>
5 6#include <linux/percpu-defs.h>
6/*
7 * Determine the real variable name from the name visible in the
8 * kernel sources.
9 */
10#define per_cpu_var(var) per_cpu__##var
11 7
12#ifdef CONFIG_SMP 8#ifdef CONFIG_SMP
13 9
@@ -73,11 +69,32 @@ extern void setup_per_cpu_areas(void);
73 69
74#endif /* SMP */ 70#endif /* SMP */
75 71
72#ifndef PER_CPU_BASE_SECTION
73#ifdef CONFIG_SMP
74#define PER_CPU_BASE_SECTION ".data.percpu"
75#else
76#define PER_CPU_BASE_SECTION ".data"
77#endif
78#endif
79
80#ifdef CONFIG_SMP
81
82#ifdef MODULE
83#define PER_CPU_SHARED_ALIGNED_SECTION ""
84#else
85#define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned"
86#endif
87#define PER_CPU_FIRST_SECTION ".first"
88
89#else
90
91#define PER_CPU_SHARED_ALIGNED_SECTION ""
92#define PER_CPU_FIRST_SECTION ""
93
94#endif
95
76#ifndef PER_CPU_ATTRIBUTES 96#ifndef PER_CPU_ATTRIBUTES
77#define PER_CPU_ATTRIBUTES 97#define PER_CPU_ATTRIBUTES
78#endif 98#endif
79 99
80#define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \
81 __typeof__(type) per_cpu_var(name)
82
83#endif /* _ASM_GENERIC_PERCPU_H_ */ 100#endif /* _ASM_GENERIC_PERCPU_H_ */
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 79a7ff925bf8..4ce48e878530 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -9,7 +9,7 @@ extern char __bss_start[], __bss_stop[];
9extern char __init_begin[], __init_end[]; 9extern char __init_begin[], __init_end[];
10extern char _sinittext[], _einittext[]; 10extern char _sinittext[], _einittext[];
11extern char _end[]; 11extern char _end[];
12extern char __per_cpu_start[], __per_cpu_end[]; 12extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[];
13extern char __kprobes_text_start[], __kprobes_text_end[]; 13extern char __kprobes_text_start[], __kprobes_text_end[];
14extern char __initdata_begin[], __initdata_end[]; 14extern char __initdata_begin[], __initdata_end[];
15extern char __start_rodata[], __end_rodata[]; 15extern char __start_rodata[], __end_rodata[];
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 969570167e9e..c840719a8c59 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -23,7 +23,7 @@ typedef union sigval {
23#endif 23#endif
24 24
25#ifndef __ARCH_SI_UID_T 25#ifndef __ARCH_SI_UID_T
26#define __ARCH_SI_UID_T uid_t 26#define __ARCH_SI_UID_T __kernel_uid32_t
27#endif 27#endif
28 28
29/* 29/*
@@ -47,13 +47,13 @@ typedef struct siginfo {
47 47
48 /* kill() */ 48 /* kill() */
49 struct { 49 struct {
50 pid_t _pid; /* sender's pid */ 50 __kernel_pid_t _pid; /* sender's pid */
51 __ARCH_SI_UID_T _uid; /* sender's uid */ 51 __ARCH_SI_UID_T _uid; /* sender's uid */
52 } _kill; 52 } _kill;
53 53
54 /* POSIX.1b timers */ 54 /* POSIX.1b timers */
55 struct { 55 struct {
56 timer_t _tid; /* timer id */ 56 __kernel_timer_t _tid; /* timer id */
57 int _overrun; /* overrun count */ 57 int _overrun; /* overrun count */
58 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; 58 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
59 sigval_t _sigval; /* same as below */ 59 sigval_t _sigval; /* same as below */
@@ -62,18 +62,18 @@ typedef struct siginfo {
62 62
63 /* POSIX.1b signals */ 63 /* POSIX.1b signals */
64 struct { 64 struct {
65 pid_t _pid; /* sender's pid */ 65 __kernel_pid_t _pid; /* sender's pid */
66 __ARCH_SI_UID_T _uid; /* sender's uid */ 66 __ARCH_SI_UID_T _uid; /* sender's uid */
67 sigval_t _sigval; 67 sigval_t _sigval;
68 } _rt; 68 } _rt;
69 69
70 /* SIGCHLD */ 70 /* SIGCHLD */
71 struct { 71 struct {
72 pid_t _pid; /* which child */ 72 __kernel_pid_t _pid; /* which child */
73 __ARCH_SI_UID_T _uid; /* sender's uid */ 73 __ARCH_SI_UID_T _uid; /* sender's uid */
74 int _status; /* exit code */ 74 int _status; /* exit code */
75 clock_t _utime; 75 __kernel_clock_t _utime;
76 clock_t _stime; 76 __kernel_clock_t _stime;
77 } _sigchld; 77 } _sigchld;
78 78
79 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 79 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
@@ -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-generic/statfs.h b/include/asm-generic/statfs.h
index 6129d6802149..3b4fb3e52f0d 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -1,8 +1,9 @@
1#ifndef _GENERIC_STATFS_H 1#ifndef _GENERIC_STATFS_H
2#define _GENERIC_STATFS_H 2#define _GENERIC_STATFS_H
3 3
4#ifndef __KERNEL_STRICT_NAMES 4#include <linux/types.h>
5# include <linux/types.h> 5
6#ifdef __KERNEL__
6typedef __kernel_fsid_t fsid_t; 7typedef __kernel_fsid_t fsid_t;
7#endif 8#endif
8 9
diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h
index 0e9e2bc0ee96..88bada2ebc4b 100644
--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -43,20 +43,10 @@
43#ifndef cpumask_of_node 43#ifndef cpumask_of_node
44#define cpumask_of_node(node) ((void)node, cpu_online_mask) 44#define cpumask_of_node(node) ((void)node, cpu_online_mask)
45#endif 45#endif
46#ifndef node_to_first_cpu
47#define node_to_first_cpu(node) ((void)(node),0)
48#endif
49#ifndef pcibus_to_node 46#ifndef pcibus_to_node
50#define pcibus_to_node(bus) ((void)(bus), -1) 47#define pcibus_to_node(bus) ((void)(bus), -1)
51#endif 48#endif
52 49
53#ifndef pcibus_to_cpumask
54#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
55 CPU_MASK_ALL : \
56 node_to_cpumask(pcibus_to_node(bus)) \
57 )
58#endif
59
60#ifndef cpumask_of_pcibus 50#ifndef cpumask_of_pcibus
61#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 51#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
62 cpu_all_mask : \ 52 cpu_all_mask : \
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index c61fab1dd2f8..89853bcd27a6 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -1,3 +1,5 @@
1#include <linux/section-names.h>
2
1#ifndef LOAD_OFFSET 3#ifndef LOAD_OFFSET
2#define LOAD_OFFSET 0 4#define LOAD_OFFSET 0
3#endif 5#endif
@@ -61,10 +63,33 @@
61#define BRANCH_PROFILE() 63#define BRANCH_PROFILE()
62#endif 64#endif
63 65
66#ifdef CONFIG_EVENT_TRACER
67#define FTRACE_EVENTS() VMLINUX_SYMBOL(__start_ftrace_events) = .; \
68 *(_ftrace_events) \
69 VMLINUX_SYMBOL(__stop_ftrace_events) = .;
70#else
71#define FTRACE_EVENTS()
72#endif
73
74#ifdef CONFIG_TRACING
75#define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
76 *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
77 VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
78#else
79#define TRACE_PRINTKS()
80#endif
81
82#ifdef CONFIG_FTRACE_SYSCALLS
83#define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
84 *(__syscalls_metadata) \
85 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
86#else
87#define TRACE_SYSCALLS()
88#endif
89
64/* .data section */ 90/* .data section */
65#define DATA_DATA \ 91#define DATA_DATA \
66 *(.data) \ 92 *(.data) \
67 *(.data.init.refok) \
68 *(.ref.data) \ 93 *(.ref.data) \
69 DEV_KEEP(init.data) \ 94 DEV_KEEP(init.data) \
70 DEV_KEEP(exit.data) \ 95 DEV_KEEP(exit.data) \
@@ -80,8 +105,16 @@
80 VMLINUX_SYMBOL(__start___tracepoints) = .; \ 105 VMLINUX_SYMBOL(__start___tracepoints) = .; \
81 *(__tracepoints) \ 106 *(__tracepoints) \
82 VMLINUX_SYMBOL(__stop___tracepoints) = .; \ 107 VMLINUX_SYMBOL(__stop___tracepoints) = .; \
108 /* implement dynamic printk debug */ \
109 . = ALIGN(8); \
110 VMLINUX_SYMBOL(__start___verbose) = .; \
111 *(__verbose) \
112 VMLINUX_SYMBOL(__stop___verbose) = .; \
83 LIKELY_PROFILE() \ 113 LIKELY_PROFILE() \
84 BRANCH_PROFILE() 114 BRANCH_PROFILE() \
115 TRACE_PRINTKS() \
116 FTRACE_EVENTS() \
117 TRACE_SYSCALLS()
85 118
86#define RO_DATA(align) \ 119#define RO_DATA(align) \
87 . = ALIGN((align)); \ 120 . = ALIGN((align)); \
@@ -255,8 +288,6 @@
255 *(.text.hot) \ 288 *(.text.hot) \
256 *(.text) \ 289 *(.text) \
257 *(.ref.text) \ 290 *(.ref.text) \
258 *(.text.init.refok) \
259 *(.exit.text.refok) \
260 DEV_KEEP(init.text) \ 291 DEV_KEEP(init.text) \
261 DEV_KEEP(exit.text) \ 292 DEV_KEEP(exit.text) \
262 CPU_KEEP(init.text) \ 293 CPU_KEEP(init.text) \
@@ -299,7 +330,7 @@
299#endif 330#endif
300 331
301/* Section used for early init (in .S files) */ 332/* Section used for early init (in .S files) */
302#define HEAD_TEXT *(.head.text) 333#define HEAD_TEXT *(HEAD_TEXT_SECTION)
303 334
304/* init and exit section handling */ 335/* init and exit section handling */
305#define INIT_DATA \ 336#define INIT_DATA \
@@ -309,15 +340,7 @@
309 CPU_DISCARD(init.data) \ 340 CPU_DISCARD(init.data) \
310 CPU_DISCARD(init.rodata) \ 341 CPU_DISCARD(init.rodata) \
311 MEM_DISCARD(init.data) \ 342 MEM_DISCARD(init.data) \
312 MEM_DISCARD(init.rodata) \ 343 MEM_DISCARD(init.rodata)
313 /* implement dynamic printk debug */ \
314 VMLINUX_SYMBOL(__start___verbose_strings) = .; \
315 *(__verbose_strings) \
316 VMLINUX_SYMBOL(__stop___verbose_strings) = .; \
317 . = ALIGN(8); \
318 VMLINUX_SYMBOL(__start___verbose) = .; \
319 *(__verbose) \
320 VMLINUX_SYMBOL(__stop___verbose) = .;
321 344
322#define INIT_TEXT \ 345#define INIT_TEXT \
323 *(.init.text) \ 346 *(.init.text) \
@@ -430,12 +453,59 @@
430 *(.initcall7.init) \ 453 *(.initcall7.init) \
431 *(.initcall7s.init) 454 *(.initcall7s.init)
432 455
456/**
457 * PERCPU_VADDR - define output section for percpu area
458 * @vaddr: explicit base address (optional)
459 * @phdr: destination PHDR (optional)
460 *
461 * Macro which expands to output section for percpu area. If @vaddr
462 * is not blank, it specifies explicit base address and all percpu
463 * symbols will be offset from the given address. If blank, @vaddr
464 * always equals @laddr + LOAD_OFFSET.
465 *
466 * @phdr defines the output PHDR to use if not blank. Be warned that
467 * output PHDR is sticky. If @phdr is specified, the next output
468 * section in the linker script will go there too. @phdr should have
469 * a leading colon.
470 *
471 * Note that this macros defines __per_cpu_load as an absolute symbol.
472 * If there is no need to put the percpu section at a predetermined
473 * address, use PERCPU().
474 */
475#define PERCPU_VADDR(vaddr, phdr) \
476 VMLINUX_SYMBOL(__per_cpu_load) = .; \
477 .data.percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
478 - LOAD_OFFSET) { \
479 VMLINUX_SYMBOL(__per_cpu_start) = .; \
480 *(.data.percpu.first) \
481 *(.data.percpu.page_aligned) \
482 *(.data.percpu) \
483 *(.data.percpu.shared_aligned) \
484 VMLINUX_SYMBOL(__per_cpu_end) = .; \
485 } phdr \
486 . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data.percpu);
487
488/**
489 * PERCPU - define output section for percpu area, simple version
490 * @align: required alignment
491 *
492 * Align to @align and outputs output section for percpu area. This
493 * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
494 * __per_cpu_start will be identical.
495 *
496 * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
497 * that __per_cpu_load is defined as a relative symbol against
498 * .data.percpu which is required for relocatable x86_32
499 * configuration.
500 */
433#define PERCPU(align) \ 501#define PERCPU(align) \
434 . = ALIGN(align); \ 502 . = ALIGN(align); \
435 VMLINUX_SYMBOL(__per_cpu_start) = .; \ 503 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \
436 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ 504 VMLINUX_SYMBOL(__per_cpu_load) = .; \
505 VMLINUX_SYMBOL(__per_cpu_start) = .; \
506 *(.data.percpu.first) \
437 *(.data.percpu.page_aligned) \ 507 *(.data.percpu.page_aligned) \
438 *(.data.percpu) \ 508 *(.data.percpu) \
439 *(.data.percpu.shared_aligned) \ 509 *(.data.percpu.shared_aligned) \
440 } \ 510 VMLINUX_SYMBOL(__per_cpu_end) = .; \
441 VMLINUX_SYMBOL(__per_cpu_end) = .; 511 }
diff --git a/include/asm-h8300/timer.h b/include/asm-h8300/timer.h
deleted file mode 100644
index def80464d38f..000000000000
--- a/include/asm-h8300/timer.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __H8300_TIMER_H
2#define __H8300_TIMER_H
3
4void h8300_timer_tick(void);
5void h8300_timer_setup(void);
6void h8300_gettod(unsigned int *year, unsigned int *mon, unsigned int *day,
7 unsigned int *hour, unsigned int *min, unsigned int *sec);
8
9#define TIMER_FREQ (CONFIG_CPU_CLOCK*10000) /* Timer input freq. */
10
11#define calc_param(cnt, div, rate, limit) \
12do { \
13 cnt = TIMER_FREQ / HZ; \
14 for (div = 0; div < ARRAY_SIZE(divide_rate); div++) { \
15 if (rate[div] == 0) \
16 continue; \
17 if ((cnt / rate[div]) > limit) \
18 break; \
19 } \
20 if (div == ARRAY_SIZE(divide_rate)) \
21 panic("Timer counter overflow"); \
22 cnt /= divide_rate[div]; \
23} while(0)
24
25#endif
diff --git a/include/asm-m32r/Kbuild b/include/asm-m32r/Kbuild
deleted file mode 100644
index c68e1680da01..000000000000
--- a/include/asm-m32r/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1include include/asm-generic/Kbuild.asm
diff --git a/include/asm-m32r/addrspace.h b/include/asm-m32r/addrspace.h
deleted file mode 100644
index 81782c122da4..000000000000
--- a/include/asm-m32r/addrspace.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2001 by Hiroyuki Kondo
7 *
8 * Defitions for the address spaces of the M32R CPUs.
9 */
10#ifndef __ASM_M32R_ADDRSPACE_H
11#define __ASM_M32R_ADDRSPACE_H
12
13/*
14 * Memory segments (32bit kernel mode addresses)
15 */
16#define KUSEG 0x00000000
17#define KSEG0 0x80000000
18#define KSEG1 0xa0000000
19#define KSEG2 0xc0000000
20#define KSEG3 0xe0000000
21
22#define K0BASE KSEG0
23
24/*
25 * Returns the kernel segment base of a given address
26 */
27#ifndef __ASSEMBLY__
28#define KSEGX(a) (((unsigned long)(a)) & 0xe0000000)
29#else
30#define KSEGX(a) ((a) & 0xe0000000)
31#endif
32
33/*
34 * Returns the physical address of a KSEG0/KSEG1 address
35 */
36#ifndef __ASSEMBLY__
37#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
38#else
39#define PHYSADDR(a) ((a) & 0x1fffffff)
40#endif
41
42/*
43 * Map an address to a certain kernel segment
44 */
45#ifndef __ASSEMBLY__
46#define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG0))
47#define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG1))
48#define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG2))
49#define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG3))
50#else
51#define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0)
52#define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1)
53#define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2)
54#define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3)
55#endif
56
57#endif /* __ASM_M32R_ADDRSPACE_H */
diff --git a/include/asm-m32r/assembler.h b/include/asm-m32r/assembler.h
deleted file mode 100644
index 26351539b5ff..000000000000
--- a/include/asm-m32r/assembler.h
+++ /dev/null
@@ -1,229 +0,0 @@
1#ifndef _ASM_M32R_ASSEMBLER_H
2#define _ASM_M32R_ASSEMBLER_H
3
4/*
5 * linux/asm-m32r/assembler.h
6 *
7 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
8 *
9 * This file contains M32R architecture specific macro definitions.
10 */
11
12
13#ifndef __STR
14#ifdef __ASSEMBLY__
15#define __STR(x) x
16#else
17#define __STR(x) #x
18#endif
19#endif /* __STR */
20
21#ifdef CONFIG_SMP
22#define M32R_LOCK __STR(lock)
23#define M32R_UNLOCK __STR(unlock)
24#else
25#define M32R_LOCK __STR(ld)
26#define M32R_UNLOCK __STR(st)
27#endif
28
29#ifdef __ASSEMBLY__
30#undef ENTRY
31#define ENTRY(name) ENTRY_M name
32 .macro ENTRY_M name
33 .global \name
34 ALIGN
35\name:
36 .endm
37#endif
38
39
40/**
41 * LDIMM - load immediate value
42 * STI - enable interruption
43 * CLI - disable interruption
44 */
45
46#ifdef __ASSEMBLY__
47
48#define LDIMM(reg,x) LDIMM reg x
49 .macro LDIMM reg x
50 seth \reg, #high(\x)
51 or3 \reg, \reg, #low(\x)
52 .endm
53
54#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
55#define ENABLE_INTERRUPTS(reg) ENABLE_INTERRUPTS reg
56 .macro ENABLE_INTERRUPTS reg
57 setpsw #0x40 -> nop
58 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1).
59 .endm
60
61#define DISABLE_INTERRUPTS(reg) DISABLE_INTERRUPTS reg
62 .macro DISABLE_INTERRUPTS reg
63 clrpsw #0x40 -> nop
64 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1).
65 .endm
66#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
67#define ENABLE_INTERRUPTS(reg) ENABLE_INTERRUPTS reg
68 .macro ENABLE_INTERRUPTS reg
69 mvfc \reg, psw
70 or3 \reg, \reg, #0x0040
71 mvtc \reg, psw
72 .endm
73
74#define DISABLE_INTERRUPTS(reg) DISABLE_INTERRUPTS reg
75 .macro DISABLE_INTERRUPTS reg
76 mvfc \reg, psw
77 and3 \reg, \reg, #0xffbf
78 mvtc \reg, psw
79 .endm
80#endif /* CONFIG_CHIP_M32102 */
81
82 .macro SAVE_ALL
83 push r0 ; orig_r0
84 push sp ; spi (r15)
85 push lr ; r14
86 push r13
87 mvfc r13, cr3 ; spu
88 push r13
89 mvfc r13, bbpc
90 push r13
91 mvfc r13, bbpsw
92 push r13
93 mvfc r13, bpc
94 push r13
95 mvfc r13, psw
96 push r13
97#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
98 mvfaclo r13, a1
99 push r13
100 mvfachi r13, a1
101 push r13
102 mvfaclo r13, a0
103 push r13
104 mvfachi r13, a0
105 push r13
106#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
107 mvfaclo r13
108 push r13
109 mvfachi r13
110 push r13
111 ldi r13, #0
112 push r13 ; dummy push acc1h
113 push r13 ; dummy push acc1l
114#else
115#error unknown isa configuration
116#endif
117 ldi r13, #-1
118 push r13 ; syscall_nr (default: -1)
119 push r12
120 push r11
121 push r10
122 push r9
123 push r8
124 push r7
125 push r3
126 push r2
127 push r1
128 push r0
129 addi sp, #-4 ; room for implicit pt_regs parameter
130 push r6
131 push r5
132 push r4
133 .endm
134
135 .macro RESTORE_ALL
136 pop r4
137 pop r5
138 pop r6
139 addi sp, #4
140 pop r0
141 pop r1
142 pop r2
143 pop r3
144 pop r7
145 pop r8
146 pop r9
147 pop r10
148 pop r11
149 pop r12
150 addi r15, #4 ; Skip syscall number
151#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
152 pop r13
153 mvtachi r13, a0
154 pop r13
155 mvtaclo r13, a0
156 pop r13
157 mvtachi r13, a1
158 pop r13
159 mvtaclo r13, a1
160#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
161 pop r13 ; dummy pop acc1h
162 pop r13 ; dummy pop acc1l
163 pop r13
164 mvtachi r13
165 pop r13
166 mvtaclo r13
167#else
168#error unknown isa configuration
169#endif
170 pop r14
171 mvtc r14, psw
172 pop r14
173 mvtc r14, bpc
174 addi sp, #8 ; Skip bbpsw, bbpc
175 pop r14
176 mvtc r14, cr3 ; spu
177 pop r13
178 pop lr ; r14
179 pop sp ; spi (r15)
180 addi sp, #4 ; Skip orig_r0
181 .fillinsn
1821: rte
183 .section .fixup,"ax"
1842: bl do_exit
185 .previous
186 .section __ex_table,"a"
187 ALIGN
188 .long 1b, 2b
189 .previous
190 .endm
191
192#define GET_CURRENT(reg) get_current reg
193 .macro get_current reg
194 ldi \reg, #-8192
195 and \reg, sp
196 .endm
197
198#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
199 .macro SWITCH_TO_KERNEL_STACK
200 ; switch to kernel stack (spi)
201 clrpsw #0x80 -> nop
202 .endm
203#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
204 .macro SWITCH_TO_KERNEL_STACK
205 push r0 ; save r0 for working
206 mvfc r0, psw
207 and3 r0, r0, #0x00ff7f
208 mvtc r0, psw
209 slli r0, #16
210 bltz r0, 1f ; check BSM-bit
211;
212 ;; called from kernel context: previous stack = spi
213 pop r0 ; retrieve r0
214 bra 2f
215 .fillinsn
2161:
217 ;; called from user context: previous stack = spu
218 mvfc r0, cr3 ; spu
219 addi r0, #4
220 mvtc r0, cr3 ; spu
221 ld r0, @(-4,r0) ; retrieve r0
222 .fillinsn
2232:
224 .endm
225#endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
226
227#endif /* __ASSEMBLY__ */
228
229#endif /* _ASM_M32R_ASSEMBLER_H */
diff --git a/include/asm-m32r/atomic.h b/include/asm-m32r/atomic.h
deleted file mode 100644
index 2eed30f84080..000000000000
--- a/include/asm-m32r/atomic.h
+++ /dev/null
@@ -1,318 +0,0 @@
1#ifndef _ASM_M32R_ATOMIC_H
2#define _ASM_M32R_ATOMIC_H
3
4/*
5 * linux/include/asm-m32r/atomic.h
6 *
7 * M32R version:
8 * Copyright (C) 2001, 2002 Hitoshi Yamamoto
9 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
10 */
11
12#include <linux/types.h>
13#include <asm/assembler.h>
14#include <asm/system.h>
15
16/*
17 * Atomic operations that C can't guarantee us. Useful for
18 * resource counting etc..
19 */
20
21#define ATOMIC_INIT(i) { (i) }
22
23/**
24 * atomic_read - read atomic variable
25 * @v: pointer of type atomic_t
26 *
27 * Atomically reads the value of @v.
28 */
29#define atomic_read(v) ((v)->counter)
30
31/**
32 * atomic_set - set atomic variable
33 * @v: pointer of type atomic_t
34 * @i: required value
35 *
36 * Atomically sets the value of @v to @i.
37 */
38#define atomic_set(v,i) (((v)->counter) = (i))
39
40/**
41 * atomic_add_return - add integer to atomic variable and return it
42 * @i: integer value to add
43 * @v: pointer of type atomic_t
44 *
45 * Atomically adds @i to @v and return (@i + @v).
46 */
47static __inline__ int atomic_add_return(int i, atomic_t *v)
48{
49 unsigned long flags;
50 int result;
51
52 local_irq_save(flags);
53 __asm__ __volatile__ (
54 "# atomic_add_return \n\t"
55 DCACHE_CLEAR("%0", "r4", "%1")
56 M32R_LOCK" %0, @%1; \n\t"
57 "add %0, %2; \n\t"
58 M32R_UNLOCK" %0, @%1; \n\t"
59 : "=&r" (result)
60 : "r" (&v->counter), "r" (i)
61 : "memory"
62#ifdef CONFIG_CHIP_M32700_TS1
63 , "r4"
64#endif /* CONFIG_CHIP_M32700_TS1 */
65 );
66 local_irq_restore(flags);
67
68 return result;
69}
70
71/**
72 * atomic_sub_return - subtract integer from atomic variable and return it
73 * @i: integer value to subtract
74 * @v: pointer of type atomic_t
75 *
76 * Atomically subtracts @i from @v and return (@v - @i).
77 */
78static __inline__ int atomic_sub_return(int i, atomic_t *v)
79{
80 unsigned long flags;
81 int result;
82
83 local_irq_save(flags);
84 __asm__ __volatile__ (
85 "# atomic_sub_return \n\t"
86 DCACHE_CLEAR("%0", "r4", "%1")
87 M32R_LOCK" %0, @%1; \n\t"
88 "sub %0, %2; \n\t"
89 M32R_UNLOCK" %0, @%1; \n\t"
90 : "=&r" (result)
91 : "r" (&v->counter), "r" (i)
92 : "memory"
93#ifdef CONFIG_CHIP_M32700_TS1
94 , "r4"
95#endif /* CONFIG_CHIP_M32700_TS1 */
96 );
97 local_irq_restore(flags);
98
99 return result;
100}
101
102/**
103 * atomic_add - add integer to atomic variable
104 * @i: integer value to add
105 * @v: pointer of type atomic_t
106 *
107 * Atomically adds @i to @v.
108 */
109#define atomic_add(i,v) ((void) atomic_add_return((i), (v)))
110
111/**
112 * atomic_sub - subtract the atomic variable
113 * @i: integer value to subtract
114 * @v: pointer of type atomic_t
115 *
116 * Atomically subtracts @i from @v.
117 */
118#define atomic_sub(i,v) ((void) atomic_sub_return((i), (v)))
119
120/**
121 * atomic_sub_and_test - subtract value from variable and test result
122 * @i: integer value to subtract
123 * @v: pointer of type atomic_t
124 *
125 * Atomically subtracts @i from @v and returns
126 * true if the result is zero, or false for all
127 * other cases.
128 */
129#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
130
131/**
132 * atomic_inc_return - increment atomic variable and return it
133 * @v: pointer of type atomic_t
134 *
135 * Atomically increments @v by 1 and returns the result.
136 */
137static __inline__ int atomic_inc_return(atomic_t *v)
138{
139 unsigned long flags;
140 int result;
141
142 local_irq_save(flags);
143 __asm__ __volatile__ (
144 "# atomic_inc_return \n\t"
145 DCACHE_CLEAR("%0", "r4", "%1")
146 M32R_LOCK" %0, @%1; \n\t"
147 "addi %0, #1; \n\t"
148 M32R_UNLOCK" %0, @%1; \n\t"
149 : "=&r" (result)
150 : "r" (&v->counter)
151 : "memory"
152#ifdef CONFIG_CHIP_M32700_TS1
153 , "r4"
154#endif /* CONFIG_CHIP_M32700_TS1 */
155 );
156 local_irq_restore(flags);
157
158 return result;
159}
160
161/**
162 * atomic_dec_return - decrement atomic variable and return it
163 * @v: pointer of type atomic_t
164 *
165 * Atomically decrements @v by 1 and returns the result.
166 */
167static __inline__ int atomic_dec_return(atomic_t *v)
168{
169 unsigned long flags;
170 int result;
171
172 local_irq_save(flags);
173 __asm__ __volatile__ (
174 "# atomic_dec_return \n\t"
175 DCACHE_CLEAR("%0", "r4", "%1")
176 M32R_LOCK" %0, @%1; \n\t"
177 "addi %0, #-1; \n\t"
178 M32R_UNLOCK" %0, @%1; \n\t"
179 : "=&r" (result)
180 : "r" (&v->counter)
181 : "memory"
182#ifdef CONFIG_CHIP_M32700_TS1
183 , "r4"
184#endif /* CONFIG_CHIP_M32700_TS1 */
185 );
186 local_irq_restore(flags);
187
188 return result;
189}
190
191/**
192 * atomic_inc - increment atomic variable
193 * @v: pointer of type atomic_t
194 *
195 * Atomically increments @v by 1.
196 */
197#define atomic_inc(v) ((void)atomic_inc_return(v))
198
199/**
200 * atomic_dec - decrement atomic variable
201 * @v: pointer of type atomic_t
202 *
203 * Atomically decrements @v by 1.
204 */
205#define atomic_dec(v) ((void)atomic_dec_return(v))
206
207/**
208 * atomic_inc_and_test - increment and test
209 * @v: pointer of type atomic_t
210 *
211 * Atomically increments @v by 1
212 * and returns true if the result is zero, or false for all
213 * other cases.
214 */
215#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
216
217/**
218 * atomic_dec_and_test - decrement and test
219 * @v: pointer of type atomic_t
220 *
221 * Atomically decrements @v by 1 and
222 * returns true if the result is 0, or false for all
223 * other cases.
224 */
225#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)
226
227/**
228 * atomic_add_negative - add and test if negative
229 * @v: pointer of type atomic_t
230 * @i: integer value to add
231 *
232 * Atomically adds @i to @v and returns true
233 * if the result is negative, or false when
234 * result is greater than or equal to zero.
235 */
236#define atomic_add_negative(i,v) (atomic_add_return((i), (v)) < 0)
237
238#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
239#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
240
241/**
242 * atomic_add_unless - add unless the number is a given value
243 * @v: pointer of type atomic_t
244 * @a: the amount to add to v...
245 * @u: ...unless v is equal to u.
246 *
247 * Atomically adds @a to @v, so long as it was not @u.
248 * Returns non-zero if @v was not @u, and zero otherwise.
249 */
250static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
251{
252 int c, old;
253 c = atomic_read(v);
254 for (;;) {
255 if (unlikely(c == (u)))
256 break;
257 old = atomic_cmpxchg((v), c, c + (a));
258 if (likely(old == c))
259 break;
260 c = old;
261 }
262 return c != (u);
263}
264
265#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
266
267static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t *addr)
268{
269 unsigned long flags;
270 unsigned long tmp;
271
272 local_irq_save(flags);
273 __asm__ __volatile__ (
274 "# atomic_clear_mask \n\t"
275 DCACHE_CLEAR("%0", "r5", "%1")
276 M32R_LOCK" %0, @%1; \n\t"
277 "and %0, %2; \n\t"
278 M32R_UNLOCK" %0, @%1; \n\t"
279 : "=&r" (tmp)
280 : "r" (addr), "r" (~mask)
281 : "memory"
282#ifdef CONFIG_CHIP_M32700_TS1
283 , "r5"
284#endif /* CONFIG_CHIP_M32700_TS1 */
285 );
286 local_irq_restore(flags);
287}
288
289static __inline__ void atomic_set_mask(unsigned long mask, atomic_t *addr)
290{
291 unsigned long flags;
292 unsigned long tmp;
293
294 local_irq_save(flags);
295 __asm__ __volatile__ (
296 "# atomic_set_mask \n\t"
297 DCACHE_CLEAR("%0", "r5", "%1")
298 M32R_LOCK" %0, @%1; \n\t"
299 "or %0, %2; \n\t"
300 M32R_UNLOCK" %0, @%1; \n\t"
301 : "=&r" (tmp)
302 : "r" (addr), "r" (mask)
303 : "memory"
304#ifdef CONFIG_CHIP_M32700_TS1
305 , "r5"
306#endif /* CONFIG_CHIP_M32700_TS1 */
307 );
308 local_irq_restore(flags);
309}
310
311/* Atomic operations are already serializing on m32r */
312#define smp_mb__before_atomic_dec() barrier()
313#define smp_mb__after_atomic_dec() barrier()
314#define smp_mb__before_atomic_inc() barrier()
315#define smp_mb__after_atomic_inc() barrier()
316
317#include <asm-generic/atomic.h>
318#endif /* _ASM_M32R_ATOMIC_H */
diff --git a/include/asm-m32r/auxvec.h b/include/asm-m32r/auxvec.h
deleted file mode 100644
index f76dcc860fae..000000000000
--- a/include/asm-m32r/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef _ASM_M32R__AUXVEC_H
2#define _ASM_M32R__AUXVEC_H
3
4#endif /* _ASM_M32R__AUXVEC_H */
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h
deleted file mode 100644
index aaddf0d57603..000000000000
--- a/include/asm-m32r/bitops.h
+++ /dev/null
@@ -1,275 +0,0 @@
1#ifndef _ASM_M32R_BITOPS_H
2#define _ASM_M32R_BITOPS_H
3
4/*
5 * linux/include/asm-m32r/bitops.h
6 *
7 * Copyright 1992, Linus Torvalds.
8 *
9 * M32R version:
10 * Copyright (C) 2001, 2002 Hitoshi Yamamoto
11 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
12 */
13
14#ifndef _LINUX_BITOPS_H
15#error only <linux/bitops.h> can be included directly
16#endif
17
18#include <linux/compiler.h>
19#include <asm/assembler.h>
20#include <asm/system.h>
21#include <asm/byteorder.h>
22#include <asm/types.h>
23
24/*
25 * These have to be done with inline assembly: that way the bit-setting
26 * is guaranteed to be atomic. All bit operations return 0 if the bit
27 * was cleared before the operation and != 0 if it was not.
28 *
29 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
30 */
31
32/**
33 * set_bit - Atomically set a bit in memory
34 * @nr: the bit to set
35 * @addr: the address to start counting from
36 *
37 * This function is atomic and may not be reordered. See __set_bit()
38 * if you do not require the atomic guarantees.
39 * Note that @nr may be almost arbitrarily large; this function is not
40 * restricted to acting on a single-word quantity.
41 */
42static __inline__ void set_bit(int nr, volatile void * addr)
43{
44 __u32 mask;
45 volatile __u32 *a = addr;
46 unsigned long flags;
47 unsigned long tmp;
48
49 a += (nr >> 5);
50 mask = (1 << (nr & 0x1F));
51
52 local_irq_save(flags);
53 __asm__ __volatile__ (
54 DCACHE_CLEAR("%0", "r6", "%1")
55 M32R_LOCK" %0, @%1; \n\t"
56 "or %0, %2; \n\t"
57 M32R_UNLOCK" %0, @%1; \n\t"
58 : "=&r" (tmp)
59 : "r" (a), "r" (mask)
60 : "memory"
61#ifdef CONFIG_CHIP_M32700_TS1
62 , "r6"
63#endif /* CONFIG_CHIP_M32700_TS1 */
64 );
65 local_irq_restore(flags);
66}
67
68/**
69 * clear_bit - Clears a bit in memory
70 * @nr: Bit to clear
71 * @addr: Address to start counting from
72 *
73 * clear_bit() is atomic and may not be reordered. However, it does
74 * not contain a memory barrier, so if it is used for locking purposes,
75 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
76 * in order to ensure changes are visible on other processors.
77 */
78static __inline__ void clear_bit(int nr, volatile void * addr)
79{
80 __u32 mask;
81 volatile __u32 *a = addr;
82 unsigned long flags;
83 unsigned long tmp;
84
85 a += (nr >> 5);
86 mask = (1 << (nr & 0x1F));
87
88 local_irq_save(flags);
89
90 __asm__ __volatile__ (
91 DCACHE_CLEAR("%0", "r6", "%1")
92 M32R_LOCK" %0, @%1; \n\t"
93 "and %0, %2; \n\t"
94 M32R_UNLOCK" %0, @%1; \n\t"
95 : "=&r" (tmp)
96 : "r" (a), "r" (~mask)
97 : "memory"
98#ifdef CONFIG_CHIP_M32700_TS1
99 , "r6"
100#endif /* CONFIG_CHIP_M32700_TS1 */
101 );
102 local_irq_restore(flags);
103}
104
105#define smp_mb__before_clear_bit() barrier()
106#define smp_mb__after_clear_bit() barrier()
107
108/**
109 * change_bit - Toggle a bit in memory
110 * @nr: Bit to clear
111 * @addr: Address to start counting from
112 *
113 * change_bit() is atomic and may not be reordered.
114 * Note that @nr may be almost arbitrarily large; this function is not
115 * restricted to acting on a single-word quantity.
116 */
117static __inline__ void change_bit(int nr, volatile void * addr)
118{
119 __u32 mask;
120 volatile __u32 *a = addr;
121 unsigned long flags;
122 unsigned long tmp;
123
124 a += (nr >> 5);
125 mask = (1 << (nr & 0x1F));
126
127 local_irq_save(flags);
128 __asm__ __volatile__ (
129 DCACHE_CLEAR("%0", "r6", "%1")
130 M32R_LOCK" %0, @%1; \n\t"
131 "xor %0, %2; \n\t"
132 M32R_UNLOCK" %0, @%1; \n\t"
133 : "=&r" (tmp)
134 : "r" (a), "r" (mask)
135 : "memory"
136#ifdef CONFIG_CHIP_M32700_TS1
137 , "r6"
138#endif /* CONFIG_CHIP_M32700_TS1 */
139 );
140 local_irq_restore(flags);
141}
142
143/**
144 * test_and_set_bit - Set a bit and return its old value
145 * @nr: Bit to set
146 * @addr: Address to count from
147 *
148 * This operation is atomic and cannot be reordered.
149 * It also implies a memory barrier.
150 */
151static __inline__ int test_and_set_bit(int nr, volatile void * addr)
152{
153 __u32 mask, oldbit;
154 volatile __u32 *a = addr;
155 unsigned long flags;
156 unsigned long tmp;
157
158 a += (nr >> 5);
159 mask = (1 << (nr & 0x1F));
160
161 local_irq_save(flags);
162 __asm__ __volatile__ (
163 DCACHE_CLEAR("%0", "%1", "%2")
164 M32R_LOCK" %0, @%2; \n\t"
165 "mv %1, %0; \n\t"
166 "and %0, %3; \n\t"
167 "or %1, %3; \n\t"
168 M32R_UNLOCK" %1, @%2; \n\t"
169 : "=&r" (oldbit), "=&r" (tmp)
170 : "r" (a), "r" (mask)
171 : "memory"
172 );
173 local_irq_restore(flags);
174
175 return (oldbit != 0);
176}
177
178/**
179 * test_and_clear_bit - Clear a bit and return its old value
180 * @nr: Bit to set
181 * @addr: Address to count from
182 *
183 * This operation is atomic and cannot be reordered.
184 * It also implies a memory barrier.
185 */
186static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
187{
188 __u32 mask, oldbit;
189 volatile __u32 *a = addr;
190 unsigned long flags;
191 unsigned long tmp;
192
193 a += (nr >> 5);
194 mask = (1 << (nr & 0x1F));
195
196 local_irq_save(flags);
197
198 __asm__ __volatile__ (
199 DCACHE_CLEAR("%0", "%1", "%3")
200 M32R_LOCK" %0, @%3; \n\t"
201 "mv %1, %0; \n\t"
202 "and %0, %2; \n\t"
203 "not %2, %2; \n\t"
204 "and %1, %2; \n\t"
205 M32R_UNLOCK" %1, @%3; \n\t"
206 : "=&r" (oldbit), "=&r" (tmp), "+r" (mask)
207 : "r" (a)
208 : "memory"
209 );
210 local_irq_restore(flags);
211
212 return (oldbit != 0);
213}
214
215/**
216 * test_and_change_bit - Change a bit and return its old value
217 * @nr: Bit to set
218 * @addr: Address to count from
219 *
220 * This operation is atomic and cannot be reordered.
221 * It also implies a memory barrier.
222 */
223static __inline__ int test_and_change_bit(int nr, volatile void * addr)
224{
225 __u32 mask, oldbit;
226 volatile __u32 *a = addr;
227 unsigned long flags;
228 unsigned long tmp;
229
230 a += (nr >> 5);
231 mask = (1 << (nr & 0x1F));
232
233 local_irq_save(flags);
234 __asm__ __volatile__ (
235 DCACHE_CLEAR("%0", "%1", "%2")
236 M32R_LOCK" %0, @%2; \n\t"
237 "mv %1, %0; \n\t"
238 "and %0, %3; \n\t"
239 "xor %1, %3; \n\t"
240 M32R_UNLOCK" %1, @%2; \n\t"
241 : "=&r" (oldbit), "=&r" (tmp)
242 : "r" (a), "r" (mask)
243 : "memory"
244 );
245 local_irq_restore(flags);
246
247 return (oldbit != 0);
248}
249
250#include <asm-generic/bitops/non-atomic.h>
251#include <asm-generic/bitops/ffz.h>
252#include <asm-generic/bitops/__ffs.h>
253#include <asm-generic/bitops/fls.h>
254#include <asm-generic/bitops/__fls.h>
255#include <asm-generic/bitops/fls64.h>
256
257#ifdef __KERNEL__
258
259#include <asm-generic/bitops/sched.h>
260#include <asm-generic/bitops/find.h>
261#include <asm-generic/bitops/ffs.h>
262#include <asm-generic/bitops/hweight.h>
263#include <asm-generic/bitops/lock.h>
264
265#endif /* __KERNEL__ */
266
267#ifdef __KERNEL__
268
269#include <asm-generic/bitops/ext2-non-atomic.h>
270#include <asm-generic/bitops/ext2-atomic.h>
271#include <asm-generic/bitops/minix.h>
272
273#endif /* __KERNEL__ */
274
275#endif /* _ASM_M32R_BITOPS_H */
diff --git a/include/asm-m32r/bug.h b/include/asm-m32r/bug.h
deleted file mode 100644
index 4cc0462c15b8..000000000000
--- a/include/asm-m32r/bug.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef _M32R_BUG_H
2#define _M32R_BUG_H
3#include <asm-generic/bug.h>
4#endif
diff --git a/include/asm-m32r/bugs.h b/include/asm-m32r/bugs.h
deleted file mode 100644
index f77214eff136..000000000000
--- a/include/asm-m32r/bugs.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _ASM_M32R_BUGS_H
2#define _ASM_M32R_BUGS_H
3
4/*
5 * This is included by init/main.c to check for architecture-dependent bugs.
6 *
7 * Needs:
8 * void check_bugs(void);
9 */
10#include <asm/processor.h>
11
12static void __init check_bugs(void)
13{
14 extern unsigned long loops_per_jiffy;
15
16 current_cpu_data.loops_per_jiffy = loops_per_jiffy;
17}
18
19#endif /* _ASM_M32R_BUGS_H */
diff --git a/include/asm-m32r/byteorder.h b/include/asm-m32r/byteorder.h
deleted file mode 100644
index 21855d8b028b..000000000000
--- a/include/asm-m32r/byteorder.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _ASM_M32R_BYTEORDER_H
2#define _ASM_M32R_BYTEORDER_H
3
4#if defined(__LITTLE_ENDIAN__)
5# include <linux/byteorder/little_endian.h>
6#else
7# include <linux/byteorder/big_endian.h>
8#endif
9
10#endif /* _ASM_M32R_BYTEORDER_H */
diff --git a/include/asm-m32r/cache.h b/include/asm-m32r/cache.h
deleted file mode 100644
index 40b3ee98193d..000000000000
--- a/include/asm-m32r/cache.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _ASM_M32R_CACHE_H
2#define _ASM_M32R_CACHE_H
3
4/* L1 cache line size */
5#define L1_CACHE_SHIFT 4
6#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
7
8#endif /* _ASM_M32R_CACHE_H */
diff --git a/include/asm-m32r/cachectl.h b/include/asm-m32r/cachectl.h
deleted file mode 100644
index 2aab8f6fff41..000000000000
--- a/include/asm-m32r/cachectl.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * cachectl.h -- defines for M32R cache control system calls
3 *
4 * Copyright (C) 2003 by Kazuhiro Inaoka
5 */
6#ifndef __ASM_M32R_CACHECTL
7#define __ASM_M32R_CACHECTL
8
9/*
10 * Options for cacheflush system call
11 *
12 * cacheflush() is currently fluch_cache_all().
13 */
14#define ICACHE (1<<0) /* flush instruction cache */
15#define DCACHE (1<<1) /* writeback and flush data cache */
16#define BCACHE (ICACHE|DCACHE) /* flush both caches */
17
18/*
19 * Caching modes for the cachectl(2) call
20 *
21 * cachectl(2) is currently not supported and returns ENOSYS.
22 */
23#define CACHEABLE 0 /* make pages cacheable */
24#define UNCACHEABLE 1 /* make pages uncacheable */
25
26#endif /* __ASM_M32R_CACHECTL */
diff --git a/include/asm-m32r/cacheflush.h b/include/asm-m32r/cacheflush.h
deleted file mode 100644
index 78587c958146..000000000000
--- a/include/asm-m32r/cacheflush.h
+++ /dev/null
@@ -1,69 +0,0 @@
1#ifndef _ASM_M32R_CACHEFLUSH_H
2#define _ASM_M32R_CACHEFLUSH_H
3
4#include <linux/mm.h>
5
6extern void _flush_cache_all(void);
7extern void _flush_cache_copyback_all(void);
8
9#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
10#define flush_cache_all() do { } while (0)
11#define flush_cache_mm(mm) do { } while (0)
12#define flush_cache_dup_mm(mm) do { } while (0)
13#define flush_cache_range(vma, start, end) do { } while (0)
14#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
15#define flush_dcache_page(page) do { } while (0)
16#define flush_dcache_mmap_lock(mapping) do { } while (0)
17#define flush_dcache_mmap_unlock(mapping) do { } while (0)
18#ifndef CONFIG_SMP
19#define flush_icache_range(start, end) _flush_cache_copyback_all()
20#define flush_icache_page(vma,pg) _flush_cache_copyback_all()
21#define flush_icache_user_range(vma,pg,adr,len) _flush_cache_copyback_all()
22#define flush_cache_sigtramp(addr) _flush_cache_copyback_all()
23#else /* CONFIG_SMP */
24extern void smp_flush_cache_all(void);
25#define flush_icache_range(start, end) smp_flush_cache_all()
26#define flush_icache_page(vma,pg) smp_flush_cache_all()
27#define flush_icache_user_range(vma,pg,adr,len) smp_flush_cache_all()
28#define flush_cache_sigtramp(addr) _flush_cache_copyback_all()
29#endif /* CONFIG_SMP */
30#elif defined(CONFIG_CHIP_M32102)
31#define flush_cache_all() do { } while (0)
32#define flush_cache_mm(mm) do { } while (0)
33#define flush_cache_dup_mm(mm) do { } while (0)
34#define flush_cache_range(vma, start, end) do { } while (0)
35#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
36#define flush_dcache_page(page) do { } while (0)
37#define flush_dcache_mmap_lock(mapping) do { } while (0)
38#define flush_dcache_mmap_unlock(mapping) do { } while (0)
39#define flush_icache_range(start, end) _flush_cache_all()
40#define flush_icache_page(vma,pg) _flush_cache_all()
41#define flush_icache_user_range(vma,pg,adr,len) _flush_cache_all()
42#define flush_cache_sigtramp(addr) _flush_cache_all()
43#else
44#define flush_cache_all() do { } while (0)
45#define flush_cache_mm(mm) do { } while (0)
46#define flush_cache_dup_mm(mm) do { } while (0)
47#define flush_cache_range(vma, start, end) do { } while (0)
48#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
49#define flush_dcache_page(page) do { } while (0)
50#define flush_dcache_mmap_lock(mapping) do { } while (0)
51#define flush_dcache_mmap_unlock(mapping) do { } while (0)
52#define flush_icache_range(start, end) do { } while (0)
53#define flush_icache_page(vma,pg) do { } while (0)
54#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
55#define flush_cache_sigtramp(addr) do { } while (0)
56#endif /* CONFIG_CHIP_* */
57
58#define flush_cache_vmap(start, end) do { } while (0)
59#define flush_cache_vunmap(start, end) do { } while (0)
60
61#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
62do { \
63 memcpy(dst, src, len); \
64 flush_icache_user_range(vma, page, vaddr, len); \
65} while (0)
66#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
67 memcpy(dst, src, len)
68
69#endif /* _ASM_M32R_CACHEFLUSH_H */
diff --git a/include/asm-m32r/checksum.h b/include/asm-m32r/checksum.h
deleted file mode 100644
index a7a7c4f44abe..000000000000
--- a/include/asm-m32r/checksum.h
+++ /dev/null
@@ -1,204 +0,0 @@
1#ifdef __KERNEL__
2#ifndef _ASM_M32R_CHECKSUM_H
3#define _ASM_M32R_CHECKSUM_H
4
5/*
6 * include/asm-m32r/checksum.h
7 *
8 * IP/TCP/UDP checksum routines
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 *
14 * Some code taken from mips and parisc architecture.
15 *
16 * Copyright (C) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata
17 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
18 */
19
20#include <linux/in6.h>
21
22/*
23 * computes the checksum of a memory block at buff, length len,
24 * and adds in "sum" (32-bit)
25 *
26 * returns a 32-bit number suitable for feeding into itself
27 * or csum_tcpudp_magic
28 *
29 * this function must be called with even lengths, except
30 * for the last fragment, which may be odd
31 *
32 * it's best to have buff aligned on a 32-bit boundary
33 */
34asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
35
36/*
37 * The same as csum_partial, but copies from src while it checksums.
38 *
39 * Here even more important to align src and dst on a 32-bit (or even
40 * better 64-bit) boundary
41 */
42extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,
43 int len, __wsum sum);
44
45/*
46 * This is a new version of the above that records errors it finds in *errp,
47 * but continues and zeros thre rest of the buffer.
48 */
49extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
50 int len, __wsum sum,
51 int *err_ptr);
52
53/*
54 * Fold a partial checksum
55 */
56
57static inline __sum16 csum_fold(__wsum sum)
58{
59 unsigned long tmpreg;
60 __asm__(
61 " sll3 %1, %0, #16 \n"
62 " cmp %0, %0 \n"
63 " addx %0, %1 \n"
64 " ldi %1, #0 \n"
65 " srli %0, #16 \n"
66 " addx %0, %1 \n"
67 " xor3 %0, %0, #0x0000ffff \n"
68 : "=r" (sum), "=&r" (tmpreg)
69 : "0" (sum)
70 : "cbit"
71 );
72 return (__force __sum16)sum;
73}
74
75/*
76 * This is a version of ip_compute_csum() optimized for IP headers,
77 * which always checksum on 4 octet boundaries.
78 */
79static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
80{
81 unsigned long tmpreg0, tmpreg1;
82 __wsum sum;
83
84 __asm__ __volatile__(
85 " ld %0, @%1+ \n"
86 " addi %2, #-4 \n"
87 "# bgez %2, 2f \n"
88 " cmp %0, %0 \n"
89 " ld %3, @%1+ \n"
90 " ld %4, @%1+ \n"
91 " addx %0, %3 \n"
92 " ld %3, @%1+ \n"
93 " addx %0, %4 \n"
94 " addx %0, %3 \n"
95 " .fillinsn\n"
96 "1: \n"
97 " ld %4, @%1+ \n"
98 " addi %2, #-1 \n"
99 " addx %0, %4 \n"
100 " bgtz %2, 1b \n"
101 "\n"
102 " ldi %3, #0 \n"
103 " addx %0, %3 \n"
104 " .fillinsn\n"
105 "2: \n"
106 /* Since the input registers which are loaded with iph and ihl
107 are modified, we must also specify them as outputs, or gcc
108 will assume they contain their original values. */
109 : "=&r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmpreg0), "=&r" (tmpreg1)
110 : "1" (iph), "2" (ihl)
111 : "cbit", "memory");
112
113 return csum_fold(sum);
114}
115
116static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
117 unsigned short len,
118 unsigned short proto,
119 __wsum sum)
120{
121#if defined(__LITTLE_ENDIAN)
122 unsigned long len_proto = (proto + len) << 8;
123#else
124 unsigned long len_proto = proto + len;
125#endif
126 unsigned long tmpreg;
127
128 __asm__(
129 " cmp %0, %0 \n"
130 " addx %0, %2 \n"
131 " addx %0, %3 \n"
132 " addx %0, %4 \n"
133 " ldi %1, #0 \n"
134 " addx %0, %1 \n"
135 : "=r" (sum), "=&r" (tmpreg)
136 : "r" (daddr), "r" (saddr), "r" (len_proto), "0" (sum)
137 : "cbit"
138 );
139
140 return sum;
141}
142
143/*
144 * computes the checksum of the TCP/UDP pseudo-header
145 * returns a 16-bit checksum, already complemented
146 */
147static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
148 unsigned short len,
149 unsigned short proto,
150 __wsum sum)
151{
152 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
153}
154
155/*
156 * this routine is used for miscellaneous IP-like checksums, mainly
157 * in icmp.c
158 */
159
160static inline __sum16 ip_compute_csum(const void *buff, int len)
161{
162 return csum_fold (csum_partial(buff, len, 0));
163}
164
165#define _HAVE_ARCH_IPV6_CSUM
166static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
167 const struct in6_addr *daddr,
168 __u32 len, unsigned short proto,
169 __wsum sum)
170{
171 unsigned long tmpreg0, tmpreg1, tmpreg2, tmpreg3;
172 __asm__(
173 " ld %1, @(%5) \n"
174 " ld %2, @(4,%5) \n"
175 " ld %3, @(8,%5) \n"
176 " ld %4, @(12,%5) \n"
177 " add %0, %1 \n"
178 " addx %0, %2 \n"
179 " addx %0, %3 \n"
180 " addx %0, %4 \n"
181 " ld %1, @(%6) \n"
182 " ld %2, @(4,%6) \n"
183 " ld %3, @(8,%6) \n"
184 " ld %4, @(12,%6) \n"
185 " addx %0, %1 \n"
186 " addx %0, %2 \n"
187 " addx %0, %3 \n"
188 " addx %0, %4 \n"
189 " addx %0, %7 \n"
190 " addx %0, %8 \n"
191 " ldi %1, #0 \n"
192 " addx %0, %1 \n"
193 : "=&r" (sum), "=&r" (tmpreg0), "=&r" (tmpreg1),
194 "=&r" (tmpreg2), "=&r" (tmpreg3)
195 : "r" (saddr), "r" (daddr),
196 "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)
197 : "cbit"
198 );
199
200 return csum_fold(sum);
201}
202
203#endif /* _ASM_M32R_CHECKSUM_H */
204#endif /* __KERNEL__ */
diff --git a/include/asm-m32r/cputime.h b/include/asm-m32r/cputime.h
deleted file mode 100644
index 0a47550df2b7..000000000000
--- a/include/asm-m32r/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __M32R_CPUTIME_H
2#define __M32R_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __M32R_CPUTIME_H */
diff --git a/include/asm-m32r/current.h b/include/asm-m32r/current.h
deleted file mode 100644
index 7859d864f2c2..000000000000
--- a/include/asm-m32r/current.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASM_M32R_CURRENT_H
2#define _ASM_M32R_CURRENT_H
3
4#include <linux/thread_info.h>
5
6struct task_struct;
7
8static __inline__ struct task_struct *get_current(void)
9{
10 return current_thread_info()->task;
11}
12
13#define current (get_current())
14
15#endif /* _ASM_M32R_CURRENT_H */
diff --git a/include/asm-m32r/delay.h b/include/asm-m32r/delay.h
deleted file mode 100644
index 9dd9e999ea69..000000000000
--- a/include/asm-m32r/delay.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef _ASM_M32R_DELAY_H
2#define _ASM_M32R_DELAY_H
3
4/*
5 * Copyright (C) 1993 Linus Torvalds
6 *
7 * Delay routines calling functions in arch/m32r/lib/delay.c
8 */
9
10extern void __bad_udelay(void);
11extern void __bad_ndelay(void);
12
13extern void __udelay(unsigned long usecs);
14extern void __ndelay(unsigned long nsecs);
15extern void __const_udelay(unsigned long xloops);
16extern void __delay(unsigned long loops);
17
18#define udelay(n) (__builtin_constant_p(n) ? \
19 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \
20 __udelay(n))
21
22#define ndelay(n) (__builtin_constant_p(n) ? \
23 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
24 __ndelay(n))
25
26#endif /* _ASM_M32R_DELAY_H */
diff --git a/include/asm-m32r/device.h b/include/asm-m32r/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/include/asm-m32r/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-m32r/div64.h b/include/asm-m32r/div64.h
deleted file mode 100644
index 6cd978cefb28..000000000000
--- a/include/asm-m32r/div64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/div64.h>
diff --git a/include/asm-m32r/dma.h b/include/asm-m32r/dma.h
deleted file mode 100644
index 52f6a22dd232..000000000000
--- a/include/asm-m32r/dma.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_M32R_DMA_H
2#define _ASM_M32R_DMA_H
3
4#include <asm/io.h>
5
6/*
7 * The maximum address that we can perform a DMA transfer
8 * to on this platform
9 */
10#define MAX_DMA_ADDRESS (PAGE_OFFSET+0x20000000)
11
12#endif /* _ASM_M32R_DMA_H */
diff --git a/include/asm-m32r/elf.h b/include/asm-m32r/elf.h
deleted file mode 100644
index 0cc34c94bf2b..000000000000
--- a/include/asm-m32r/elf.h
+++ /dev/null
@@ -1,134 +0,0 @@
1#ifndef _ASM_M32R__ELF_H
2#define _ASM_M32R__ELF_H
3
4/*
5 * ELF-specific definitions.
6 *
7 * Copyright (C) 1999-2004, Renesas Technology Corp.
8 * Hirokazu Takata <takata at linux-m32r.org>
9 */
10
11#include <asm/ptrace.h>
12#include <asm/user.h>
13#include <asm/page.h>
14
15/* M32R relocation types */
16#define R_M32R_NONE 0
17#define R_M32R_16 1
18#define R_M32R_32 2
19#define R_M32R_24 3
20#define R_M32R_10_PCREL 4
21#define R_M32R_18_PCREL 5
22#define R_M32R_26_PCREL 6
23#define R_M32R_HI16_ULO 7
24#define R_M32R_HI16_SLO 8
25#define R_M32R_LO16 9
26#define R_M32R_SDA16 10
27#define R_M32R_GNU_VTINHERIT 11
28#define R_M32R_GNU_VTENTRY 12
29
30#define R_M32R_16_RELA 33
31#define R_M32R_32_RELA 34
32#define R_M32R_24_RELA 35
33#define R_M32R_10_PCREL_RELA 36
34#define R_M32R_18_PCREL_RELA 37
35#define R_M32R_26_PCREL_RELA 38
36#define R_M32R_HI16_ULO_RELA 39
37#define R_M32R_HI16_SLO_RELA 40
38#define R_M32R_LO16_RELA 41
39#define R_M32R_SDA16_RELA 42
40#define R_M32R_RELA_GNU_VTINHERIT 43
41#define R_M32R_RELA_GNU_VTENTRY 44
42
43#define R_M32R_GOT24 48
44#define R_M32R_26_PLTREL 49
45#define R_M32R_COPY 50
46#define R_M32R_GLOB_DAT 51
47#define R_M32R_JMP_SLOT 52
48#define R_M32R_RELATIVE 53
49#define R_M32R_GOTOFF 54
50#define R_M32R_GOTPC24 55
51#define R_M32R_GOT16_HI_ULO 56
52#define R_M32R_GOT16_HI_SLO 57
53#define R_M32R_GOT16_LO 58
54#define R_M32R_GOTPC_HI_ULO 59
55#define R_M32R_GOTPC_HI_SLO 60
56#define R_M32R_GOTPC_LO 61
57#define R_M32R_GOTOFF_HI_ULO 62
58#define R_M32R_GOTOFF_HI_SLO 63
59#define R_M32R_GOTOFF_LO 64
60
61#define R_M32R_NUM 256
62
63/*
64 * ELF register definitions..
65 */
66#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
67
68typedef unsigned long elf_greg_t;
69typedef elf_greg_t elf_gregset_t[ELF_NGREG];
70
71/* We have no FP mumumu. */
72typedef double elf_fpreg_t;
73typedef elf_fpreg_t elf_fpregset_t;
74
75/*
76 * This is used to ensure we don't load something for the wrong architecture.
77 */
78#define elf_check_arch(x) \
79 (((x)->e_machine == EM_M32R) || ((x)->e_machine == EM_CYGNUS_M32R))
80
81/*
82 * These are used to set parameters in the core dumps.
83 */
84#define ELF_CLASS ELFCLASS32
85#if defined(__LITTLE_ENDIAN)
86#define ELF_DATA ELFDATA2LSB
87#elif defined(__BIG_ENDIAN)
88#define ELF_DATA ELFDATA2MSB
89#else
90#error no endian defined
91#endif
92#define ELF_ARCH EM_M32R
93
94/* r0 is set by ld.so to a pointer to a function which might be
95 * registered using 'atexit'. This provides a mean for the dynamic
96 * linker to call DT_FINI functions for shared libraries that have
97 * been loaded before the code runs.
98 *
99 * So that we can use the same startup file with static executables,
100 * we start programs with a value of 0 to indicate that there is no
101 * such function.
102 */
103#define ELF_PLAT_INIT(_r, load_addr) (_r)->r0 = 0
104
105#define USE_ELF_CORE_DUMP
106#define ELF_EXEC_PAGESIZE PAGE_SIZE
107
108/*
109 * This is the location that an ET_DYN program is loaded if exec'ed.
110 * Typical use of this is to invoke "./ld.so someprog" to test out a
111 * new version of the loader. We need to make sure that it is out of
112 * the way of the program that it will "exec", and that there is
113 * sufficient room for the brk.
114 */
115#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
116
117/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
118 now struct_user_regs, they are different) */
119
120#define ELF_CORE_COPY_REGS(pr_reg, regs) \
121 memcpy((char *)pr_reg, (char *)regs, sizeof (struct pt_regs));
122
123/* This yields a mask that user programs can use to figure out what
124 instruction set this CPU supports. */
125#define ELF_HWCAP (0)
126
127/* This yields a string that ld.so will use to load implementation
128 specific libraries for optimization. This is more specific in
129 intent than poking at uname or /proc/cpuinfo. */
130#define ELF_PLATFORM (NULL)
131
132#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
133
134#endif /* _ASM_M32R__ELF_H */
diff --git a/include/asm-m32r/emergency-restart.h b/include/asm-m32r/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/include/asm-m32r/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-m32r/errno.h b/include/asm-m32r/errno.h
deleted file mode 100644
index 777149262aad..000000000000
--- a/include/asm-m32r/errno.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_M32R_ERRNO_H
2#define _ASM_M32R_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#endif /* _ASM_M32R_ERRNO_H */
diff --git a/include/asm-m32r/fb.h b/include/asm-m32r/fb.h
deleted file mode 100644
index d92e99cd8c8a..000000000000
--- a/include/asm-m32r/fb.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/include/asm-m32r/fcntl.h b/include/asm-m32r/fcntl.h
deleted file mode 100644
index 46ab12db5739..000000000000
--- a/include/asm-m32r/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/fcntl.h>
diff --git a/include/asm-m32r/flat.h b/include/asm-m32r/flat.h
deleted file mode 100644
index d851cf0c4aa5..000000000000
--- a/include/asm-m32r/flat.h
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * include/asm-m32r/flat.h
3 *
4 * uClinux flat-format executables
5 *
6 * Copyright (C) 2004 Kazuhiro Inaoka
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive for
10 * more details.
11 */
12#ifndef __ASM_M32R_FLAT_H
13#define __ASM_M32R_FLAT_H
14
15#define flat_stack_align(sp) (*sp += (*sp & 3 ? (4 - (*sp & 3)): 0))
16#define flat_argvp_envp_on_stack() 0
17#define flat_old_ram_flag(flags) (flags)
18#define flat_set_persistent(relval, p) 0
19#define flat_reloc_valid(reloc, size) \
20 (((reloc) - textlen_for_m32r_lo16_data) <= (size))
21#define flat_get_addr_from_rp(rp, relval, flags, persistent) \
22 m32r_flat_get_addr_from_rp(rp, relval, (text_len) )
23
24#define flat_put_addr_at_rp(rp, addr, relval) \
25 m32r_flat_put_addr_at_rp(rp, addr, relval)
26
27/* Convert a relocation entry into an address. */
28static inline unsigned long
29flat_get_relocate_addr (unsigned long relval)
30{
31 return relval & 0x00ffffff; /* Mask out top 8-bits */
32}
33
34#define flat_m32r_get_reloc_type(relval) ((relval) >> 24)
35
36#define M32R_SETH_OPCODE 0xd0c00000 /* SETH instruction code */
37
38#define FLAT_M32R_32 0x00 /* 32bits reloc */
39#define FLAT_M32R_24 0x01 /* unsigned 24bits reloc */
40#define FLAT_M32R_16 0x02 /* 16bits reloc */
41#define FLAT_M32R_LO16 0x03 /* signed low 16bits reloc (low()) */
42#define FLAT_M32R_LO16_DATA 0x04 /* signed low 16bits reloc (low())
43 for a symbol in .data section */
44 /* High 16bits of an address used
45 when the lower 16bbits are treated
46 as unsigned.
47 To create SETH instruction only.
48 0x1X: X means a number of register.
49 0x10 - 0x3F are reserved. */
50#define FLAT_M32R_HI16_ULO 0x10 /* reloc for SETH Rn,#high(imm16) */
51 /* High 16bits of an address used
52 when the lower 16bbits are treated
53 as signed.
54 To create SETH instruction only.
55 0x2X: X means a number of register.
56 0x20 - 0x4F are reserved. */
57#define FLAT_M32R_HI16_SLO 0x20 /* reloc for SETH Rn,#shigh(imm16) */
58
59static unsigned long textlen_for_m32r_lo16_data = 0;
60
61static inline unsigned long m32r_flat_get_addr_from_rp (unsigned long *rp,
62 unsigned long relval,
63 unsigned long textlen)
64{
65 unsigned int reloc = flat_m32r_get_reloc_type (relval);
66 textlen_for_m32r_lo16_data = 0;
67 if (reloc & 0xf0) {
68 unsigned long addr = htonl(*rp);
69 switch (reloc & 0xf0)
70 {
71 case FLAT_M32R_HI16_ULO:
72 case FLAT_M32R_HI16_SLO:
73 if (addr == 0) {
74 /* put "seth Rn,#0x0" instead of 0 (addr). */
75 *rp = (M32R_SETH_OPCODE | ((reloc & 0x0f)<<24));
76 }
77 return addr;
78 default:
79 break;
80 }
81 } else {
82 switch (reloc)
83 {
84 case FLAT_M32R_LO16:
85 return htonl(*rp) & 0xFFFF;
86 case FLAT_M32R_LO16_DATA:
87 /* FIXME: The return value will decrease by textlen
88 at m32r_flat_put_addr_at_rp () */
89 textlen_for_m32r_lo16_data = textlen;
90 return (htonl(*rp) & 0xFFFF) + textlen;
91 case FLAT_M32R_16:
92 return htons(*(unsigned short *)rp) & 0xFFFF;
93 case FLAT_M32R_24:
94 return htonl(*rp) & 0xFFFFFF;
95 case FLAT_M32R_32:
96 return htonl(*rp);
97 default:
98 break;
99 }
100 }
101 return ~0; /* bogus value */
102}
103
104static inline void m32r_flat_put_addr_at_rp (unsigned long *rp,
105 unsigned long addr,
106 unsigned long relval)
107{
108 unsigned int reloc = flat_m32r_get_reloc_type (relval);
109 if (reloc & 0xf0) {
110 unsigned long Rn = reloc & 0x0f; /* get a number of register */
111 Rn <<= 24; /* 0x0R000000 */
112 reloc &= 0xf0;
113 switch (reloc)
114 {
115 case FLAT_M32R_HI16_ULO: /* To create SETH Rn,#high(imm16) */
116 *rp = (M32R_SETH_OPCODE | Rn
117 | ((addr >> 16) & 0xFFFF));
118 break;
119 case FLAT_M32R_HI16_SLO: /* To create SETH Rn,#shigh(imm16) */
120 *rp = (M32R_SETH_OPCODE | Rn
121 | (((addr >> 16) + ((addr & 0x8000) ? 1 : 0))
122 & 0xFFFF));
123 break;
124 }
125 } else {
126 switch (reloc) {
127 case FLAT_M32R_LO16_DATA:
128 addr -= textlen_for_m32r_lo16_data;
129 textlen_for_m32r_lo16_data = 0;
130 case FLAT_M32R_LO16:
131 *rp = (htonl(*rp) & 0xFFFF0000) | (addr & 0xFFFF);
132 break;
133 case FLAT_M32R_16:
134 *(unsigned short *)rp = addr & 0xFFFF;
135 break;
136 case FLAT_M32R_24:
137 *rp = (htonl(*rp) & 0xFF000000) | (addr & 0xFFFFFF);
138 break;
139 case FLAT_M32R_32:
140 *rp = addr;
141 break;
142 }
143 }
144}
145
146#endif /* __ASM_M32R_FLAT_H */
diff --git a/include/asm-m32r/futex.h b/include/asm-m32r/futex.h
deleted file mode 100644
index 6a332a9f099c..000000000000
--- a/include/asm-m32r/futex.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#include <asm-generic/futex.h>
5
6#endif
diff --git a/include/asm-m32r/hardirq.h b/include/asm-m32r/hardirq.h
deleted file mode 100644
index cb8aa762f235..000000000000
--- a/include/asm-m32r/hardirq.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifdef __KERNEL__
2#ifndef __ASM_HARDIRQ_H
3#define __ASM_HARDIRQ_H
4
5#include <linux/threads.h>
6#include <linux/irq.h>
7
8typedef struct {
9 unsigned int __softirq_pending;
10} ____cacheline_aligned irq_cpustat_t;
11
12#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
13
14#if NR_IRQS > 256
15#define HARDIRQ_BITS 9
16#else
17#define HARDIRQ_BITS 8
18#endif
19
20/*
21 * The hardirq mask has to be large enough to have
22 * space for potentially all IRQ sources in the system
23 * nesting on a single CPU:
24 */
25#if (1 << HARDIRQ_BITS) < NR_IRQS
26# error HARDIRQ_BITS is too low!
27#endif
28
29static inline void ack_bad_irq(int irq)
30{
31 printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);
32 BUG();
33}
34
35#endif /* __ASM_HARDIRQ_H */
36#endif /* __KERNEL__ */
diff --git a/include/asm-m32r/hw_irq.h b/include/asm-m32r/hw_irq.h
deleted file mode 100644
index 7138537cda03..000000000000
--- a/include/asm-m32r/hw_irq.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef _ASM_M32R_HW_IRQ_H
2#define _ASM_M32R_HW_IRQ_H
3
4#endif /* _ASM_M32R_HW_IRQ_H */
diff --git a/include/asm-m32r/io.h b/include/asm-m32r/io.h
deleted file mode 100644
index d06933bd6318..000000000000
--- a/include/asm-m32r/io.h
+++ /dev/null
@@ -1,200 +0,0 @@
1#ifndef _ASM_M32R_IO_H
2#define _ASM_M32R_IO_H
3
4#include <linux/string.h>
5#include <linux/compiler.h>
6#include <asm/page.h> /* __va */
7
8#ifdef __KERNEL__
9
10#define IO_SPACE_LIMIT 0xFFFFFFFF
11
12/**
13 * virt_to_phys - map virtual addresses to physical
14 * @address: address to remap
15 *
16 * The returned physical address is the physical (CPU) mapping for
17 * the memory address given. It is only valid to use this function on
18 * addresses directly mapped or allocated via kmalloc.
19 *
20 * This function does not give bus mappings for DMA transfers. In
21 * almost all conceivable cases a device driver should not be using
22 * this function
23 */
24
25static inline unsigned long virt_to_phys(volatile void * address)
26{
27 return __pa(address);
28}
29
30/**
31 * phys_to_virt - map physical address to virtual
32 * @address: address to remap
33 *
34 * The returned virtual address is a current CPU mapping for
35 * the memory address given. It is only valid to use this function on
36 * addresses that have a kernel mapping
37 *
38 * This function does not handle bus mappings for DMA transfers. In
39 * almost all conceivable cases a device driver should not be using
40 * this function
41 */
42
43static inline void *phys_to_virt(unsigned long address)
44{
45 return __va(address);
46}
47
48extern void __iomem *
49__ioremap(unsigned long offset, unsigned long size, unsigned long flags);
50
51/**
52 * ioremap - map bus memory into CPU space
53 * @offset: bus address of the memory
54 * @size: size of the resource to map
55 *
56 * ioremap performs a platform specific sequence of operations to
57 * make bus memory CPU accessible via the readb/readw/readl/writeb/
58 * writew/writel functions and the other mmio helpers. The returned
59 * address is not guaranteed to be usable directly as a virtual
60 * address.
61 */
62
63static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
64{
65 return __ioremap(offset, size, 0);
66}
67
68extern void iounmap(volatile void __iomem *addr);
69#define ioremap_nocache(off,size) ioremap(off,size)
70
71/*
72 * IO bus memory addresses are also 1:1 with the physical address
73 */
74#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
75#define page_to_bus page_to_phys
76#define virt_to_bus virt_to_phys
77
78extern unsigned char _inb(unsigned long);
79extern unsigned short _inw(unsigned long);
80extern unsigned long _inl(unsigned long);
81extern unsigned char _inb_p(unsigned long);
82extern unsigned short _inw_p(unsigned long);
83extern unsigned long _inl_p(unsigned long);
84extern void _outb(unsigned char, unsigned long);
85extern void _outw(unsigned short, unsigned long);
86extern void _outl(unsigned long, unsigned long);
87extern void _outb_p(unsigned char, unsigned long);
88extern void _outw_p(unsigned short, unsigned long);
89extern void _outl_p(unsigned long, unsigned long);
90extern void _insb(unsigned int, void *, unsigned long);
91extern void _insw(unsigned int, void *, unsigned long);
92extern void _insl(unsigned int, void *, unsigned long);
93extern void _outsb(unsigned int, const void *, unsigned long);
94extern void _outsw(unsigned int, const void *, unsigned long);
95extern void _outsl(unsigned int, const void *, unsigned long);
96
97static inline unsigned char _readb(unsigned long addr)
98{
99 return *(volatile unsigned char __force *)addr;
100}
101
102static inline unsigned short _readw(unsigned long addr)
103{
104 return *(volatile unsigned short __force *)addr;
105}
106
107static inline unsigned long _readl(unsigned long addr)
108{
109 return *(volatile unsigned long __force *)addr;
110}
111
112static inline void _writeb(unsigned char b, unsigned long addr)
113{
114 *(volatile unsigned char __force *)addr = b;
115}
116
117static inline void _writew(unsigned short w, unsigned long addr)
118{
119 *(volatile unsigned short __force *)addr = w;
120}
121
122static inline void _writel(unsigned long l, unsigned long addr)
123{
124 *(volatile unsigned long __force *)addr = l;
125}
126
127#define inb _inb
128#define inw _inw
129#define inl _inl
130#define outb _outb
131#define outw _outw
132#define outl _outl
133
134#define inb_p _inb_p
135#define inw_p _inw_p
136#define inl_p _inl_p
137#define outb_p _outb_p
138#define outw_p _outw_p
139#define outl_p _outl_p
140
141#define insb _insb
142#define insw _insw
143#define insl _insl
144#define outsb _outsb
145#define outsw _outsw
146#define outsl _outsl
147
148#define readb(addr) _readb((unsigned long)(addr))
149#define readw(addr) _readw((unsigned long)(addr))
150#define readl(addr) _readl((unsigned long)(addr))
151#define __raw_readb readb
152#define __raw_readw readw
153#define __raw_readl readl
154#define readb_relaxed readb
155#define readw_relaxed readw
156#define readl_relaxed readl
157
158#define writeb(val, addr) _writeb((val), (unsigned long)(addr))
159#define writew(val, addr) _writew((val), (unsigned long)(addr))
160#define writel(val, addr) _writel((val), (unsigned long)(addr))
161#define __raw_writeb writeb
162#define __raw_writew writew
163#define __raw_writel writel
164
165#define mmiowb()
166
167#define flush_write_buffers() do { } while (0) /* M32R_FIXME */
168
169static inline void
170memset_io(volatile void __iomem *addr, unsigned char val, int count)
171{
172 memset((void __force *) addr, val, count);
173}
174
175static inline void
176memcpy_fromio(void *dst, volatile void __iomem *src, int count)
177{
178 memcpy(dst, (void __force *) src, count);
179}
180
181static inline void
182memcpy_toio(volatile void __iomem *dst, const void *src, int count)
183{
184 memcpy((void __force *) dst, src, count);
185}
186
187/*
188 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
189 * access
190 */
191#define xlate_dev_mem_ptr(p) __va(p)
192
193/*
194 * Convert a virtual cached pointer to an uncached pointer
195 */
196#define xlate_dev_kmem_ptr(p) p
197
198#endif /* __KERNEL__ */
199
200#endif /* _ASM_M32R_IO_H */
diff --git a/include/asm-m32r/ioctl.h b/include/asm-m32r/ioctl.h
deleted file mode 100644
index b279fe06dfe5..000000000000
--- a/include/asm-m32r/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/include/asm-m32r/ioctls.h b/include/asm-m32r/ioctls.h
deleted file mode 100644
index b9f54bb5d7cf..000000000000
--- a/include/asm-m32r/ioctls.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef __ARCH_M32R_IOCTLS_H__
2#define __ARCH_M32R_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 /* Clashes with SNDCTL_TMR_START sound ioctl */
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 (of pty-mux device) */
55#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
56
57#define FIONCLEX 0x5450
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 TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
73#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
74#define FIOQSIZE 0x5460
75
76/* Used for packet mode */
77#define TIOCPKT_DATA 0
78#define TIOCPKT_FLUSHREAD 1
79#define TIOCPKT_FLUSHWRITE 2
80#define TIOCPKT_STOP 4
81#define TIOCPKT_START 8
82#define TIOCPKT_NOSTOP 16
83#define TIOCPKT_DOSTOP 32
84
85#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
86
87#endif /* __ARCH_M32R_IOCTLS_H__ */
diff --git a/include/asm-m32r/ipcbuf.h b/include/asm-m32r/ipcbuf.h
deleted file mode 100644
index 8d2d7c8ffdb0..000000000000
--- a/include/asm-m32r/ipcbuf.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _ASM_M32R_IPCBUF_H
2#define _ASM_M32R_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for m32r 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_M32R_IPCBUF_H */
diff --git a/include/asm-m32r/irq.h b/include/asm-m32r/irq.h
deleted file mode 100644
index 242028b4d86a..000000000000
--- a/include/asm-m32r/irq.h
+++ /dev/null
@@ -1,90 +0,0 @@
1#ifdef __KERNEL__
2#ifndef _ASM_M32R_IRQ_H
3#define _ASM_M32R_IRQ_H
4
5
6#if defined(CONFIG_PLAT_USRV)
7/*
8 * IRQ definitions for M32700UT
9 * M32700 Chip: 64 interrupts
10 * ICU of M32700UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin
11 */
12#define M32700UT_NUM_CPU_IRQ (64)
13#define M32700UT_NUM_PLD_IRQ (32)
14#define M32700UT_IRQ_BASE 0
15#define M32700UT_CPU_IRQ_BASE M32700UT_IRQ_BASE
16#define M32700UT_PLD_IRQ_BASE (M32700UT_CPU_IRQ_BASE + M32700UT_NUM_CPU_IRQ)
17
18#define NR_IRQS (M32700UT_NUM_CPU_IRQ + M32700UT_NUM_PLD_IRQ)
19#elif defined(CONFIG_PLAT_M32700UT)
20/*
21 * IRQ definitions for M32700UT(Rev.C) + M32R-LAN
22 * M32700 Chip: 64 interrupts
23 * ICU of M32700UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin
24 * ICU of M32R-LCD-on-board PLD: 32 interrupts cascaded to INT2# chip pin
25 * ICU of M32R-LAN-on-board PLD: 32 interrupts cascaded to INT0# chip pin
26 */
27#define M32700UT_NUM_CPU_IRQ (64)
28#define M32700UT_NUM_PLD_IRQ (32)
29#define M32700UT_NUM_LCD_PLD_IRQ (32)
30#define M32700UT_NUM_LAN_PLD_IRQ (32)
31#define M32700UT_IRQ_BASE 0
32#define M32700UT_CPU_IRQ_BASE (M32700UT_IRQ_BASE)
33#define M32700UT_PLD_IRQ_BASE \
34 (M32700UT_CPU_IRQ_BASE + M32700UT_NUM_CPU_IRQ)
35#define M32700UT_LCD_PLD_IRQ_BASE \
36 (M32700UT_PLD_IRQ_BASE + M32700UT_NUM_PLD_IRQ)
37#define M32700UT_LAN_PLD_IRQ_BASE \
38 (M32700UT_LCD_PLD_IRQ_BASE + M32700UT_NUM_LCD_PLD_IRQ)
39
40#define NR_IRQS \
41 (M32700UT_NUM_CPU_IRQ + M32700UT_NUM_PLD_IRQ \
42 + M32700UT_NUM_LCD_PLD_IRQ + M32700UT_NUM_LAN_PLD_IRQ)
43#elif defined(CONFIG_PLAT_OPSPUT)
44/*
45 * IRQ definitions for OPSPUT + M32R-LAN
46 * OPSP Chip: 64 interrupts
47 * ICU of OPSPUT-on-board PLD: 32 interrupts cascaded to INT1# chip pin
48 * ICU of M32R-LCD-on-board PLD: 32 interrupts cascaded to INT2# chip pin
49 * ICU of M32R-LAN-on-board PLD: 32 interrupts cascaded to INT0# chip pin
50 */
51#define OPSPUT_NUM_CPU_IRQ (64)
52#define OPSPUT_NUM_PLD_IRQ (32)
53#define OPSPUT_NUM_LCD_PLD_IRQ (32)
54#define OPSPUT_NUM_LAN_PLD_IRQ (32)
55#define OPSPUT_IRQ_BASE 0
56#define OPSPUT_CPU_IRQ_BASE (OPSPUT_IRQ_BASE)
57#define OPSPUT_PLD_IRQ_BASE \
58 (OPSPUT_CPU_IRQ_BASE + OPSPUT_NUM_CPU_IRQ)
59#define OPSPUT_LCD_PLD_IRQ_BASE \
60 (OPSPUT_PLD_IRQ_BASE + OPSPUT_NUM_PLD_IRQ)
61#define OPSPUT_LAN_PLD_IRQ_BASE \
62 (OPSPUT_LCD_PLD_IRQ_BASE + OPSPUT_NUM_LCD_PLD_IRQ)
63
64#define NR_IRQS \
65 (OPSPUT_NUM_CPU_IRQ + OPSPUT_NUM_PLD_IRQ \
66 + OPSPUT_NUM_LCD_PLD_IRQ + OPSPUT_NUM_LAN_PLD_IRQ)
67
68#elif defined(CONFIG_PLAT_M32104UT)
69/*
70 * IRQ definitions for M32104UT
71 * M32104 Chip: 64 interrupts
72 * ICU of M32104UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin
73 */
74#define M32104UT_NUM_CPU_IRQ (64)
75#define M32104UT_NUM_PLD_IRQ (32)
76#define M32104UT_IRQ_BASE 0
77#define M32104UT_CPU_IRQ_BASE M32104UT_IRQ_BASE
78#define M32104UT_PLD_IRQ_BASE (M32104UT_CPU_IRQ_BASE + M32104UT_NUM_CPU_IRQ)
79
80#define NR_IRQS \
81 (M32104UT_NUM_CPU_IRQ + M32104UT_NUM_PLD_IRQ)
82
83#else
84#define NR_IRQS 64
85#endif
86
87#define irq_canonicalize(irq) (irq)
88
89#endif /* _ASM_M32R_IRQ_H */
90#endif /* __KERNEL__ */
diff --git a/include/asm-m32r/irq_regs.h b/include/asm-m32r/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/include/asm-m32r/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/include/asm-m32r/kdebug.h b/include/asm-m32r/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/include/asm-m32r/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/include/asm-m32r/kmap_types.h b/include/asm-m32r/kmap_types.h
deleted file mode 100644
index fa94dc6410ea..000000000000
--- a/include/asm-m32r/kmap_types.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef __M32R_KMAP_TYPES_H
2#define __M32R_KMAP_TYPES_H
3
4#ifdef CONFIG_DEBUG_HIGHMEM
5# define D(n) __KM_FENCE_##n ,
6#else
7# define D(n)
8#endif
9
10enum km_type {
11D(0) KM_BOUNCE_READ,
12D(1) KM_SKB_SUNRPC_DATA,
13D(2) KM_SKB_DATA_SOFTIRQ,
14D(3) KM_USER0,
15D(4) KM_USER1,
16D(5) KM_BIO_SRC_IRQ,
17D(6) KM_BIO_DST_IRQ,
18D(7) KM_PTE0,
19D(8) KM_PTE1,
20D(9) KM_IRQ0,
21D(10) KM_IRQ1,
22D(11) KM_SOFTIRQ0,
23D(12) KM_SOFTIRQ1,
24D(13) KM_TYPE_NR
25};
26
27#undef D
28
29#endif /* __M32R_KMAP_TYPES_H */
diff --git a/include/asm-m32r/linkage.h b/include/asm-m32r/linkage.h
deleted file mode 100644
index a9fb151cf648..000000000000
--- a/include/asm-m32r/linkage.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4#define __ALIGN .balign 4
5#define __ALIGN_STR ".balign 4"
6
7#endif /* __ASM_LINKAGE_H */
diff --git a/include/asm-m32r/local.h b/include/asm-m32r/local.h
deleted file mode 100644
index 22256d138630..000000000000
--- a/include/asm-m32r/local.h
+++ /dev/null
@@ -1,366 +0,0 @@
1#ifndef __M32R_LOCAL_H
2#define __M32R_LOCAL_H
3
4/*
5 * linux/include/asm-m32r/local.h
6 *
7 * M32R version:
8 * Copyright (C) 2001, 2002 Hitoshi Yamamoto
9 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
10 * Copyright (C) 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
11 */
12
13#include <linux/percpu.h>
14#include <asm/assembler.h>
15#include <asm/system.h>
16#include <asm/local.h>
17
18/*
19 * Atomic operations that C can't guarantee us. Useful for
20 * resource counting etc..
21 */
22
23/*
24 * Make sure gcc doesn't try to be clever and move things around
25 * on us. We need to use _exactly_ the address the user gave us,
26 * not some alias that contains the same information.
27 */
28typedef struct { volatile int counter; } local_t;
29
30#define LOCAL_INIT(i) { (i) }
31
32/**
33 * local_read - read local variable
34 * @l: pointer of type local_t
35 *
36 * Atomically reads the value of @l.
37 */
38#define local_read(l) ((l)->counter)
39
40/**
41 * local_set - set local variable
42 * @l: pointer of type local_t
43 * @i: required value
44 *
45 * Atomically sets the value of @l to @i.
46 */
47#define local_set(l, i) (((l)->counter) = (i))
48
49/**
50 * local_add_return - add long to local variable and return it
51 * @i: long value to add
52 * @l: pointer of type local_t
53 *
54 * Atomically adds @i to @l and return (@i + @l).
55 */
56static inline long local_add_return(long i, local_t *l)
57{
58 unsigned long flags;
59 long result;
60
61 local_irq_save(flags);
62 __asm__ __volatile__ (
63 "# local_add_return \n\t"
64 DCACHE_CLEAR("%0", "r4", "%1")
65 "ld %0, @%1; \n\t"
66 "add %0, %2; \n\t"
67 "st %0, @%1; \n\t"
68 : "=&r" (result)
69 : "r" (&l->counter), "r" (i)
70 : "memory"
71#ifdef CONFIG_CHIP_M32700_TS1
72 , "r4"
73#endif /* CONFIG_CHIP_M32700_TS1 */
74 );
75 local_irq_restore(flags);
76
77 return result;
78}
79
80/**
81 * local_sub_return - subtract long from local variable and return it
82 * @i: long value to subtract
83 * @l: pointer of type local_t
84 *
85 * Atomically subtracts @i from @l and return (@l - @i).
86 */
87static inline long local_sub_return(long i, local_t *l)
88{
89 unsigned long flags;
90 long result;
91
92 local_irq_save(flags);
93 __asm__ __volatile__ (
94 "# local_sub_return \n\t"
95 DCACHE_CLEAR("%0", "r4", "%1")
96 "ld %0, @%1; \n\t"
97 "sub %0, %2; \n\t"
98 "st %0, @%1; \n\t"
99 : "=&r" (result)
100 : "r" (&l->counter), "r" (i)
101 : "memory"
102#ifdef CONFIG_CHIP_M32700_TS1
103 , "r4"
104#endif /* CONFIG_CHIP_M32700_TS1 */
105 );
106 local_irq_restore(flags);
107
108 return result;
109}
110
111/**
112 * local_add - add long to local variable
113 * @i: long value to add
114 * @l: pointer of type local_t
115 *
116 * Atomically adds @i to @l.
117 */
118#define local_add(i, l) ((void) local_add_return((i), (l)))
119
120/**
121 * local_sub - subtract the local variable
122 * @i: long value to subtract
123 * @l: pointer of type local_t
124 *
125 * Atomically subtracts @i from @l.
126 */
127#define local_sub(i, l) ((void) local_sub_return((i), (l)))
128
129/**
130 * local_sub_and_test - subtract value from variable and test result
131 * @i: integer value to subtract
132 * @l: pointer of type local_t
133 *
134 * Atomically subtracts @i from @l and returns
135 * true if the result is zero, or false for all
136 * other cases.
137 */
138#define local_sub_and_test(i, l) (local_sub_return((i), (l)) == 0)
139
140/**
141 * local_inc_return - increment local variable and return it
142 * @l: pointer of type local_t
143 *
144 * Atomically increments @l by 1 and returns the result.
145 */
146static inline long local_inc_return(local_t *l)
147{
148 unsigned long flags;
149 long result;
150
151 local_irq_save(flags);
152 __asm__ __volatile__ (
153 "# local_inc_return \n\t"
154 DCACHE_CLEAR("%0", "r4", "%1")
155 "ld %0, @%1; \n\t"
156 "addi %0, #1; \n\t"
157 "st %0, @%1; \n\t"
158 : "=&r" (result)
159 : "r" (&l->counter)
160 : "memory"
161#ifdef CONFIG_CHIP_M32700_TS1
162 , "r4"
163#endif /* CONFIG_CHIP_M32700_TS1 */
164 );
165 local_irq_restore(flags);
166
167 return result;
168}
169
170/**
171 * local_dec_return - decrement local variable and return it
172 * @l: pointer of type local_t
173 *
174 * Atomically decrements @l by 1 and returns the result.
175 */
176static inline long local_dec_return(local_t *l)
177{
178 unsigned long flags;
179 long result;
180
181 local_irq_save(flags);
182 __asm__ __volatile__ (
183 "# local_dec_return \n\t"
184 DCACHE_CLEAR("%0", "r4", "%1")
185 "ld %0, @%1; \n\t"
186 "addi %0, #-1; \n\t"
187 "st %0, @%1; \n\t"
188 : "=&r" (result)
189 : "r" (&l->counter)
190 : "memory"
191#ifdef CONFIG_CHIP_M32700_TS1
192 , "r4"
193#endif /* CONFIG_CHIP_M32700_TS1 */
194 );
195 local_irq_restore(flags);
196
197 return result;
198}
199
200/**
201 * local_inc - increment local variable
202 * @l: pointer of type local_t
203 *
204 * Atomically increments @l by 1.
205 */
206#define local_inc(l) ((void)local_inc_return(l))
207
208/**
209 * local_dec - decrement local variable
210 * @l: pointer of type local_t
211 *
212 * Atomically decrements @l by 1.
213 */
214#define local_dec(l) ((void)local_dec_return(l))
215
216/**
217 * local_inc_and_test - increment and test
218 * @l: pointer of type local_t
219 *
220 * Atomically increments @l by 1
221 * and returns true if the result is zero, or false for all
222 * other cases.
223 */
224#define local_inc_and_test(l) (local_inc_return(l) == 0)
225
226/**
227 * local_dec_and_test - decrement and test
228 * @l: pointer of type local_t
229 *
230 * Atomically decrements @l by 1 and
231 * returns true if the result is 0, or false for all
232 * other cases.
233 */
234#define local_dec_and_test(l) (local_dec_return(l) == 0)
235
236/**
237 * local_add_negative - add and test if negative
238 * @l: pointer of type local_t
239 * @i: integer value to add
240 *
241 * Atomically adds @i to @l and returns true
242 * if the result is negative, or false when
243 * result is greater than or equal to zero.
244 */
245#define local_add_negative(i, l) (local_add_return((i), (l)) < 0)
246
247#define local_cmpxchg(l, o, n) (cmpxchg_local(&((l)->counter), (o), (n)))
248#define local_xchg(v, new) (xchg_local(&((l)->counter), new))
249
250/**
251 * local_add_unless - add unless the number is a given value
252 * @l: pointer of type local_t
253 * @a: the amount to add to l...
254 * @u: ...unless l is equal to u.
255 *
256 * Atomically adds @a to @l, so long as it was not @u.
257 * Returns non-zero if @l was not @u, and zero otherwise.
258 */
259static inline int local_add_unless(local_t *l, long a, long u)
260{
261 long c, old;
262 c = local_read(l);
263 for (;;) {
264 if (unlikely(c == (u)))
265 break;
266 old = local_cmpxchg((l), c, c + (a));
267 if (likely(old == c))
268 break;
269 c = old;
270 }
271 return c != (u);
272}
273
274#define local_inc_not_zero(l) local_add_unless((l), 1, 0)
275
276static inline void local_clear_mask(unsigned long mask, local_t *addr)
277{
278 unsigned long flags;
279 unsigned long tmp;
280
281 local_irq_save(flags);
282 __asm__ __volatile__ (
283 "# local_clear_mask \n\t"
284 DCACHE_CLEAR("%0", "r5", "%1")
285 "ld %0, @%1; \n\t"
286 "and %0, %2; \n\t"
287 "st %0, @%1; \n\t"
288 : "=&r" (tmp)
289 : "r" (addr), "r" (~mask)
290 : "memory"
291#ifdef CONFIG_CHIP_M32700_TS1
292 , "r5"
293#endif /* CONFIG_CHIP_M32700_TS1 */
294 );
295 local_irq_restore(flags);
296}
297
298static inline void local_set_mask(unsigned long mask, local_t *addr)
299{
300 unsigned long flags;
301 unsigned long tmp;
302
303 local_irq_save(flags);
304 __asm__ __volatile__ (
305 "# local_set_mask \n\t"
306 DCACHE_CLEAR("%0", "r5", "%1")
307 "ld %0, @%1; \n\t"
308 "or %0, %2; \n\t"
309 "st %0, @%1; \n\t"
310 : "=&r" (tmp)
311 : "r" (addr), "r" (mask)
312 : "memory"
313#ifdef CONFIG_CHIP_M32700_TS1
314 , "r5"
315#endif /* CONFIG_CHIP_M32700_TS1 */
316 );
317 local_irq_restore(flags);
318}
319
320/* Atomic operations are already serializing on m32r */
321#define smp_mb__before_local_dec() barrier()
322#define smp_mb__after_local_dec() barrier()
323#define smp_mb__before_local_inc() barrier()
324#define smp_mb__after_local_inc() barrier()
325
326/* Use these for per-cpu local_t variables: on some archs they are
327 * much more efficient than these naive implementations. Note they take
328 * a variable, not an address.
329 */
330
331#define __local_inc(l) ((l)->a.counter++)
332#define __local_dec(l) ((l)->a.counter++)
333#define __local_add(i, l) ((l)->a.counter += (i))
334#define __local_sub(i, l) ((l)->a.counter -= (i))
335
336/* Use these for per-cpu local_t variables: on some archs they are
337 * much more efficient than these naive implementations. Note they take
338 * a variable, not an address.
339 */
340
341/* Need to disable preemption for the cpu local counters otherwise we could
342 still access a variable of a previous CPU in a non local way. */
343#define cpu_local_wrap_v(l) \
344 ({ local_t res__; \
345 preempt_disable(); \
346 res__ = (l); \
347 preempt_enable(); \
348 res__; })
349#define cpu_local_wrap(l) \
350 ({ preempt_disable(); \
351 l; \
352 preempt_enable(); }) \
353
354#define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
355#define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
356#define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l)))
357#define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l)))
358#define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l)))
359#define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l)))
360
361#define __cpu_local_inc(l) cpu_local_inc(l)
362#define __cpu_local_dec(l) cpu_local_dec(l)
363#define __cpu_local_add(i, l) cpu_local_add((i), (l))
364#define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
365
366#endif /* __M32R_LOCAL_H */
diff --git a/include/asm-m32r/m32102.h b/include/asm-m32r/m32102.h
deleted file mode 100644
index 52807f8db166..000000000000
--- a/include/asm-m32r/m32102.h
+++ /dev/null
@@ -1,314 +0,0 @@
1#ifndef _M32102_H_
2#define _M32102_H_
3
4/*
5 * Renesas M32R 32102 group
6 *
7 * Copyright (c) 2001 Hitoshi Yamamoto
8 * Copyright (c) 2003, 2004 Renesas Technology Corp.
9 */
10
11/*======================================================================*
12 * Special Function Register
13 *======================================================================*/
14#if !defined(CONFIG_CHIP_M32104)
15#define M32R_SFR_OFFSET (0x00E00000) /* 0x00E00000-0x00EFFFFF 1[MB] */
16#else
17#define M32R_SFR_OFFSET (0x00700000) /* 0x00700000-0x007FFFFF 1[MB] */
18#endif
19
20/*
21 * Clock and Power Management registers.
22 */
23#define M32R_CPM_OFFSET (0x000F4000+M32R_SFR_OFFSET)
24
25#define M32R_CPM_CPUCLKCR_PORTL (0x00+M32R_CPM_OFFSET)
26#define M32R_CPM_CLKMOD_PORTL (0x04+M32R_CPM_OFFSET)
27#define M32R_CPM_PLLCR_PORTL (0x08+M32R_CPM_OFFSET)
28
29/*
30 * DMA Controller registers.
31 */
32#define M32R_DMA_OFFSET (0x000F8000+M32R_SFR_OFFSET)
33
34#define M32R_DMAEN_PORTL (0x000+M32R_DMA_OFFSET)
35#define M32R_DMAISTS_PORTL (0x004+M32R_DMA_OFFSET)
36#define M32R_DMAEDET_PORTL (0x008+M32R_DMA_OFFSET)
37#define M32R_DMAASTS_PORTL (0x00c+M32R_DMA_OFFSET)
38
39#define M32R_DMA0CR0_PORTL (0x100+M32R_DMA_OFFSET)
40#define M32R_DMA0CR1_PORTL (0x104+M32R_DMA_OFFSET)
41#define M32R_DMA0CSA_PORTL (0x108+M32R_DMA_OFFSET)
42#define M32R_DMA0RSA_PORTL (0x10c+M32R_DMA_OFFSET)
43#define M32R_DMA0CDA_PORTL (0x110+M32R_DMA_OFFSET)
44#define M32R_DMA0RDA_PORTL (0x114+M32R_DMA_OFFSET)
45#define M32R_DMA0CBCUT_PORTL (0x118+M32R_DMA_OFFSET)
46#define M32R_DMA0RBCUT_PORTL (0x11c+M32R_DMA_OFFSET)
47
48#define M32R_DMA1CR0_PORTL (0x200+M32R_DMA_OFFSET)
49#define M32R_DMA1CR1_PORTL (0x204+M32R_DMA_OFFSET)
50#define M32R_DMA1CSA_PORTL (0x208+M32R_DMA_OFFSET)
51#define M32R_DMA1RSA_PORTL (0x20c+M32R_DMA_OFFSET)
52#define M32R_DMA1CDA_PORTL (0x210+M32R_DMA_OFFSET)
53#define M32R_DMA1RDA_PORTL (0x214+M32R_DMA_OFFSET)
54#define M32R_DMA1CBCUT_PORTL (0x218+M32R_DMA_OFFSET)
55#define M32R_DMA1RBCUT_PORTL (0x21c+M32R_DMA_OFFSET)
56
57/*
58 * Multi Function Timer registers.
59 */
60#define M32R_MFT_OFFSET (0x000FC000+M32R_SFR_OFFSET)
61
62#define M32R_MFTCR_PORTL (0x000+M32R_MFT_OFFSET) /* MFT control */
63#define M32R_MFTRPR_PORTL (0x004+M32R_MFT_OFFSET) /* MFT real port */
64
65#define M32R_MFT0_OFFSET (0x100+M32R_MFT_OFFSET)
66#define M32R_MFT0MOD_PORTL (0x00+M32R_MFT0_OFFSET) /* MFT0 mode */
67#define M32R_MFT0BOS_PORTL (0x04+M32R_MFT0_OFFSET) /* MFT0 b-port output status */
68#define M32R_MFT0CUT_PORTL (0x08+M32R_MFT0_OFFSET) /* MFT0 count */
69#define M32R_MFT0RLD_PORTL (0x0C+M32R_MFT0_OFFSET) /* MFT0 reload */
70#define M32R_MFT0CMPRLD_PORTL (0x10+M32R_MFT0_OFFSET) /* MFT0 compare reload */
71
72#define M32R_MFT1_OFFSET (0x200+M32R_MFT_OFFSET)
73#define M32R_MFT1MOD_PORTL (0x00+M32R_MFT1_OFFSET) /* MFT1 mode */
74#define M32R_MFT1BOS_PORTL (0x04+M32R_MFT1_OFFSET) /* MFT1 b-port output status */
75#define M32R_MFT1CUT_PORTL (0x08+M32R_MFT1_OFFSET) /* MFT1 count */
76#define M32R_MFT1RLD_PORTL (0x0C+M32R_MFT1_OFFSET) /* MFT1 reload */
77#define M32R_MFT1CMPRLD_PORTL (0x10+M32R_MFT1_OFFSET) /* MFT1 compare reload */
78
79#define M32R_MFT2_OFFSET (0x300+M32R_MFT_OFFSET)
80#define M32R_MFT2MOD_PORTL (0x00+M32R_MFT2_OFFSET) /* MFT2 mode */
81#define M32R_MFT2BOS_PORTL (0x04+M32R_MFT2_OFFSET) /* MFT2 b-port output status */
82#define M32R_MFT2CUT_PORTL (0x08+M32R_MFT2_OFFSET) /* MFT2 count */
83#define M32R_MFT2RLD_PORTL (0x0C+M32R_MFT2_OFFSET) /* MFT2 reload */
84#define M32R_MFT2CMPRLD_PORTL (0x10+M32R_MFT2_OFFSET) /* MFT2 compare reload */
85
86#define M32R_MFT3_OFFSET (0x400+M32R_MFT_OFFSET)
87#define M32R_MFT3MOD_PORTL (0x00+M32R_MFT3_OFFSET) /* MFT3 mode */
88#define M32R_MFT3BOS_PORTL (0x04+M32R_MFT3_OFFSET) /* MFT3 b-port output status */
89#define M32R_MFT3CUT_PORTL (0x08+M32R_MFT3_OFFSET) /* MFT3 count */
90#define M32R_MFT3RLD_PORTL (0x0C+M32R_MFT3_OFFSET) /* MFT3 reload */
91#define M32R_MFT3CMPRLD_PORTL (0x10+M32R_MFT3_OFFSET) /* MFT3 compare reload */
92
93#define M32R_MFT4_OFFSET (0x500+M32R_MFT_OFFSET)
94#define M32R_MFT4MOD_PORTL (0x00+M32R_MFT4_OFFSET) /* MFT4 mode */
95#define M32R_MFT4BOS_PORTL (0x04+M32R_MFT4_OFFSET) /* MFT4 b-port output status */
96#define M32R_MFT4CUT_PORTL (0x08+M32R_MFT4_OFFSET) /* MFT4 count */
97#define M32R_MFT4RLD_PORTL (0x0C+M32R_MFT4_OFFSET) /* MFT4 reload */
98#define M32R_MFT4CMPRLD_PORTL (0x10+M32R_MFT4_OFFSET) /* MFT4 compare reload */
99
100#define M32R_MFT5_OFFSET (0x600+M32R_MFT_OFFSET)
101#define M32R_MFT5MOD_PORTL (0x00+M32R_MFT5_OFFSET) /* MFT4 mode */
102#define M32R_MFT5BOS_PORTL (0x04+M32R_MFT5_OFFSET) /* MFT4 b-port output status */
103#define M32R_MFT5CUT_PORTL (0x08+M32R_MFT5_OFFSET) /* MFT4 count */
104#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */
105#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */
106
107#if (defined(CONFIG_CHIP_M32700) && !defined(CONFIG_PLAT_MAPPI2)) \
108 || defined(CONFIG_CHIP_M32104)
109#define M32R_MFTCR_MFT0MSK (1UL<<31) /* b0 */
110#define M32R_MFTCR_MFT1MSK (1UL<<30) /* b1 */
111#define M32R_MFTCR_MFT2MSK (1UL<<29) /* b2 */
112#define M32R_MFTCR_MFT3MSK (1UL<<28) /* b3 */
113#define M32R_MFTCR_MFT4MSK (1UL<<27) /* b4 */
114#define M32R_MFTCR_MFT5MSK (1UL<<26) /* b5 */
115#define M32R_MFTCR_MFT0EN (1UL<<23) /* b8 */
116#define M32R_MFTCR_MFT1EN (1UL<<22) /* b9 */
117#define M32R_MFTCR_MFT2EN (1UL<<21) /* b10 */
118#define M32R_MFTCR_MFT3EN (1UL<<20) /* b11 */
119#define M32R_MFTCR_MFT4EN (1UL<<19) /* b12 */
120#define M32R_MFTCR_MFT5EN (1UL<<18) /* b13 */
121#else
122#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */
123#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */
124#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */
125#define M32R_MFTCR_MFT3MSK (1UL<<12) /* b19 */
126#define M32R_MFTCR_MFT4MSK (1UL<<11) /* b20 */
127#define M32R_MFTCR_MFT5MSK (1UL<<10) /* b21 */
128#define M32R_MFTCR_MFT0EN (1UL<<7) /* b24 */
129#define M32R_MFTCR_MFT1EN (1UL<<6) /* b25 */
130#define M32R_MFTCR_MFT2EN (1UL<<5) /* b26 */
131#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */
132#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */
133#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */
134#endif
135
136#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */
137#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */
138#define M32R_MFTMOD_GTSEL000 (0UL<<8) /* b21-23 : 000 */
139#define M32R_MFTMOD_GTSEL001 (1UL<<8) /* b21-23 : 001 */
140#define M32R_MFTMOD_GTSEL010 (2UL<<8) /* b21-23 : 010 */
141#define M32R_MFTMOD_GTSEL011 (3UL<<8) /* b21-23 : 011 */
142#define M32R_MFTMOD_GTSEL110 (6UL<<8) /* b21-23 : 110 */
143#define M32R_MFTMOD_GTSEL111 (7UL<<8) /* b21-23 : 111 */
144#define M32R_MFTMOD_CMSEL (1UL<<3) /* b28 */
145#define M32R_MFTMOD_CSSEL000 (0UL<<0) /* b29-b31 : 000 */
146#define M32R_MFTMOD_CSSEL001 (1UL<<0) /* b29-b31 : 001 */
147#define M32R_MFTMOD_CSSEL010 (2UL<<0) /* b29-b31 : 010 */
148#define M32R_MFTMOD_CSSEL011 (3UL<<0) /* b29-b31 : 011 */
149#define M32R_MFTMOD_CSSEL100 (4UL<<0) /* b29-b31 : 100 */
150#define M32R_MFTMOD_CSSEL110 (6UL<<0) /* b29-b31 : 110 */
151
152/*
153 * Serial I/O registers.
154 */
155#define M32R_SIO_OFFSET (0x000FD000+M32R_SFR_OFFSET)
156
157#define M32R_SIO0_CR_PORTL (0x000+M32R_SIO_OFFSET)
158#define M32R_SIO0_MOD0_PORTL (0x004+M32R_SIO_OFFSET)
159#define M32R_SIO0_MOD1_PORTL (0x008+M32R_SIO_OFFSET)
160#define M32R_SIO0_STS_PORTL (0x00C+M32R_SIO_OFFSET)
161#define M32R_SIO0_TRCR_PORTL (0x010+M32R_SIO_OFFSET)
162#define M32R_SIO0_BAUR_PORTL (0x014+M32R_SIO_OFFSET)
163#define M32R_SIO0_RBAUR_PORTL (0x018+M32R_SIO_OFFSET)
164#define M32R_SIO0_TXB_PORTL (0x01C+M32R_SIO_OFFSET)
165#define M32R_SIO0_RXB_PORTL (0x020+M32R_SIO_OFFSET)
166
167/*
168 * Interrupt Control Unit registers.
169 */
170#define M32R_ICU_OFFSET (0x000FF000+M32R_SFR_OFFSET)
171#define M32R_ICU_ISTS_PORTL (0x004+M32R_ICU_OFFSET)
172#define M32R_ICU_IREQ0_PORTL (0x008+M32R_ICU_OFFSET)
173#define M32R_ICU_IREQ1_PORTL (0x00C+M32R_ICU_OFFSET)
174#define M32R_ICU_SBICR_PORTL (0x018+M32R_ICU_OFFSET)
175#define M32R_ICU_IMASK_PORTL (0x01C+M32R_ICU_OFFSET)
176#define M32R_ICU_CR1_PORTL (0x200+M32R_ICU_OFFSET) /* INT0 */
177#define M32R_ICU_CR2_PORTL (0x204+M32R_ICU_OFFSET) /* INT1 */
178#define M32R_ICU_CR3_PORTL (0x208+M32R_ICU_OFFSET) /* INT2 */
179#define M32R_ICU_CR4_PORTL (0x20C+M32R_ICU_OFFSET) /* INT3 */
180#define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */
181#define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */
182#define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */
183#define M32R_ICU_CR8_PORTL (0x219+M32R_ICU_OFFSET) /* INT7 */
184#define M32R_ICU_CR16_PORTL (0x23C+M32R_ICU_OFFSET) /* MFT0 */
185#define M32R_ICU_CR17_PORTL (0x240+M32R_ICU_OFFSET) /* MFT1 */
186#define M32R_ICU_CR18_PORTL (0x244+M32R_ICU_OFFSET) /* MFT2 */
187#define M32R_ICU_CR19_PORTL (0x248+M32R_ICU_OFFSET) /* MFT3 */
188#define M32R_ICU_CR20_PORTL (0x24C+M32R_ICU_OFFSET) /* MFT4 */
189#define M32R_ICU_CR21_PORTL (0x250+M32R_ICU_OFFSET) /* MFT5 */
190#define M32R_ICU_CR32_PORTL (0x27C+M32R_ICU_OFFSET) /* DMA0 */
191#define M32R_ICU_CR33_PORTL (0x280+M32R_ICU_OFFSET) /* DMA1 */
192#define M32R_ICU_CR48_PORTL (0x2BC+M32R_ICU_OFFSET) /* SIO0 */
193#define M32R_ICU_CR49_PORTL (0x2C0+M32R_ICU_OFFSET) /* SIO0 */
194#define M32R_ICU_CR50_PORTL (0x2C4+M32R_ICU_OFFSET) /* SIO1 */
195#define M32R_ICU_CR51_PORTL (0x2C8+M32R_ICU_OFFSET) /* SIO1 */
196#define M32R_ICU_CR52_PORTL (0x2CC+M32R_ICU_OFFSET) /* SIO2 */
197#define M32R_ICU_CR53_PORTL (0x2D0+M32R_ICU_OFFSET) /* SIO2 */
198#define M32R_ICU_CR54_PORTL (0x2D4+M32R_ICU_OFFSET) /* SIO3 */
199#define M32R_ICU_CR55_PORTL (0x2D8+M32R_ICU_OFFSET) /* SIO3 */
200#define M32R_ICU_CR56_PORTL (0x2DC+M32R_ICU_OFFSET) /* SIO4 */
201#define M32R_ICU_CR57_PORTL (0x2E0+M32R_ICU_OFFSET) /* SIO4 */
202
203#ifdef CONFIG_SMP
204#define M32R_ICU_IPICR0_PORTL (0x2dc+M32R_ICU_OFFSET) /* IPI0 */
205#define M32R_ICU_IPICR1_PORTL (0x2e0+M32R_ICU_OFFSET) /* IPI1 */
206#define M32R_ICU_IPICR2_PORTL (0x2e4+M32R_ICU_OFFSET) /* IPI2 */
207#define M32R_ICU_IPICR3_PORTL (0x2e8+M32R_ICU_OFFSET) /* IPI3 */
208#define M32R_ICU_IPICR4_PORTL (0x2ec+M32R_ICU_OFFSET) /* IPI4 */
209#define M32R_ICU_IPICR5_PORTL (0x2f0+M32R_ICU_OFFSET) /* IPI5 */
210#define M32R_ICU_IPICR6_PORTL (0x2f4+M32R_ICU_OFFSET) /* IPI6 */
211#define M32R_ICU_IPICR7_PORTL (0x2f8+M32R_ICU_OFFSET) /* IPI7 */
212#endif /* CONFIG_SMP */
213
214#define M32R_ICUIMASK_IMSK0 (0UL<<16) /* b13-b15: Disable interrupt */
215#define M32R_ICUIMASK_IMSK1 (1UL<<16) /* b13-b15: Enable level 0 interrupt */
216#define M32R_ICUIMASK_IMSK2 (2UL<<16) /* b13-b15: Enable level 0,1 interrupt */
217#define M32R_ICUIMASK_IMSK3 (3UL<<16) /* b13-b15: Enable level 0-2 interrupt */
218#define M32R_ICUIMASK_IMSK4 (4UL<<16) /* b13-b15: Enable level 0-3 interrupt */
219#define M32R_ICUIMASK_IMSK5 (5UL<<16) /* b13-b15: Enable level 0-4 interrupt */
220#define M32R_ICUIMASK_IMSK6 (6UL<<16) /* b13-b15: Enable level 0-5 interrupt */
221#define M32R_ICUIMASK_IMSK7 (7UL<<16) /* b13-b15: Enable level 0-6 interrupt */
222
223#define M32R_ICUCR_IEN (1UL<<12) /* b19: Interrupt enable */
224#define M32R_ICUCR_IRQ (1UL<<8) /* b23: Interrupt request */
225#define M32R_ICUCR_ISMOD00 (0UL<<4) /* b26-b27: Interrupt sense mode Edge HtoL */
226#define M32R_ICUCR_ISMOD01 (1UL<<4) /* b26-b27: Interrupt sense mode Level L */
227#define M32R_ICUCR_ISMOD10 (2UL<<4) /* b26-b27: Interrupt sense mode Edge LtoH*/
228#define M32R_ICUCR_ISMOD11 (3UL<<4) /* b26-b27: Interrupt sense mode Level H */
229#define M32R_ICUCR_ILEVEL0 (0UL<<0) /* b29-b31: Interrupt priority level 0 */
230#define M32R_ICUCR_ILEVEL1 (1UL<<0) /* b29-b31: Interrupt priority level 1 */
231#define M32R_ICUCR_ILEVEL2 (2UL<<0) /* b29-b31: Interrupt priority level 2 */
232#define M32R_ICUCR_ILEVEL3 (3UL<<0) /* b29-b31: Interrupt priority level 3 */
233#define M32R_ICUCR_ILEVEL4 (4UL<<0) /* b29-b31: Interrupt priority level 4 */
234#define M32R_ICUCR_ILEVEL5 (5UL<<0) /* b29-b31: Interrupt priority level 5 */
235#define M32R_ICUCR_ILEVEL6 (6UL<<0) /* b29-b31: Interrupt priority level 6 */
236#define M32R_ICUCR_ILEVEL7 (7UL<<0) /* b29-b31: Disable interrupt */
237
238#define M32R_IRQ_INT0 (1) /* INT0 */
239#define M32R_IRQ_INT1 (2) /* INT1 */
240#define M32R_IRQ_INT2 (3) /* INT2 */
241#define M32R_IRQ_INT3 (4) /* INT3 */
242#define M32R_IRQ_INT4 (5) /* INT4 */
243#define M32R_IRQ_INT5 (6) /* INT5 */
244#define M32R_IRQ_INT6 (7) /* INT6 */
245#define M32R_IRQ_MFT0 (16) /* MFT0 */
246#define M32R_IRQ_MFT1 (17) /* MFT1 */
247#define M32R_IRQ_MFT2 (18) /* MFT2 */
248#define M32R_IRQ_MFT3 (19) /* MFT3 */
249#ifdef CONFIG_CHIP_M32104
250#define M32R_IRQ_MFTX0 (24) /* MFTX0 */
251#define M32R_IRQ_MFTX1 (25) /* MFTX1 */
252#define M32R_IRQ_DMA0 (32) /* DMA0 */
253#define M32R_IRQ_DMA1 (33) /* DMA1 */
254#define M32R_IRQ_DMA2 (34) /* DMA2 */
255#define M32R_IRQ_DMA3 (35) /* DMA3 */
256#define M32R_IRQ_SIO0_R (40) /* SIO0 send */
257#define M32R_IRQ_SIO0_S (41) /* SIO0 receive */
258#define M32R_IRQ_SIO1_R (42) /* SIO1 send */
259#define M32R_IRQ_SIO1_S (43) /* SIO1 receive */
260#define M32R_IRQ_SIO2_R (44) /* SIO2 send */
261#define M32R_IRQ_SIO2_S (45) /* SIO2 receive */
262#define M32R_IRQ_SIO3_R (46) /* SIO3 send */
263#define M32R_IRQ_SIO3_S (47) /* SIO3 receive */
264#define M32R_IRQ_ADC (56) /* ADC */
265#define M32R_IRQ_PC (57) /* PC */
266#else /* ! M32104 */
267#define M32R_IRQ_DMA0 (32) /* DMA0 */
268#define M32R_IRQ_DMA1 (33) /* DMA1 */
269#define M32R_IRQ_SIO0_R (48) /* SIO0 send */
270#define M32R_IRQ_SIO0_S (49) /* SIO0 receive */
271#define M32R_IRQ_SIO1_R (50) /* SIO1 send */
272#define M32R_IRQ_SIO1_S (51) /* SIO1 receive */
273#define M32R_IRQ_SIO2_R (52) /* SIO2 send */
274#define M32R_IRQ_SIO2_S (53) /* SIO2 receive */
275#define M32R_IRQ_SIO3_R (54) /* SIO3 send */
276#define M32R_IRQ_SIO3_S (55) /* SIO3 receive */
277#define M32R_IRQ_SIO4_R (56) /* SIO4 send */
278#define M32R_IRQ_SIO4_S (57) /* SIO4 receive */
279#endif /* ! M32104 */
280
281#ifdef CONFIG_SMP
282#define M32R_IRQ_IPI0 (56)
283#define M32R_IRQ_IPI1 (57)
284#define M32R_IRQ_IPI2 (58)
285#define M32R_IRQ_IPI3 (59)
286#define M32R_IRQ_IPI4 (60)
287#define M32R_IRQ_IPI5 (61)
288#define M32R_IRQ_IPI6 (62)
289#define M32R_IRQ_IPI7 (63)
290#define M32R_CPUID_PORTL (0xffffffe0)
291
292#define M32R_FPGA_TOP (0x000F0000+M32R_SFR_OFFSET)
293
294#define M32R_FPGA_NUM_OF_CPUS_PORTL (0x00+M32R_FPGA_TOP)
295#define M32R_FPGA_CPU_NAME0_PORTL (0x10+M32R_FPGA_TOP)
296#define M32R_FPGA_CPU_NAME1_PORTL (0x14+M32R_FPGA_TOP)
297#define M32R_FPGA_CPU_NAME2_PORTL (0x18+M32R_FPGA_TOP)
298#define M32R_FPGA_CPU_NAME3_PORTL (0x1c+M32R_FPGA_TOP)
299#define M32R_FPGA_MODEL_ID0_PORTL (0x20+M32R_FPGA_TOP)
300#define M32R_FPGA_MODEL_ID1_PORTL (0x24+M32R_FPGA_TOP)
301#define M32R_FPGA_MODEL_ID2_PORTL (0x28+M32R_FPGA_TOP)
302#define M32R_FPGA_MODEL_ID3_PORTL (0x2c+M32R_FPGA_TOP)
303#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP)
304#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP)
305
306#endif /* CONFIG_SMP */
307
308#ifndef __ASSEMBLY__
309typedef struct {
310 unsigned long icucr; /* ICU Control Register */
311} icu_data_t;
312#endif
313
314#endif /* _M32102_H_ */
diff --git a/include/asm-m32r/m32104ut/m32104ut_pld.h b/include/asm-m32r/m32104ut/m32104ut_pld.h
deleted file mode 100644
index 2dc89d68b6d9..000000000000
--- a/include/asm-m32r/m32104ut/m32104ut_pld.h
+++ /dev/null
@@ -1,161 +0,0 @@
1#ifndef _M32104UT_M32104UT_PLD_H
2#define _M32104UT_M32104UT_PLD_H
3
4/*
5 * include/asm-m32r/m32104ut/m32104ut_pld.h
6 *
7 * Definitions for Programable Logic Device(PLD) on M32104UT board.
8 * Based on m32700ut_pld.h
9 *
10 * Copyright (c) 2002 Takeo Takahashi
11 * Copyright (c) 2005 Naoto Sugai
12 *
13 * This file is subject to the terms and conditions of the GNU General
14 * Public License. See the file "COPYING" in the main directory of
15 * this archive for more details.
16 */
17
18#if defined(CONFIG_PLAT_M32104UT)
19#define PLD_PLAT_BASE 0x02c00000
20#else
21#error "no platform configuration"
22#endif
23
24#ifndef __ASSEMBLY__
25/*
26 * C functions use non-cache address.
27 */
28#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */)
29#define __reg8 (volatile unsigned char *)
30#define __reg16 (volatile unsigned short *)
31#define __reg32 (volatile unsigned int *)
32#else
33#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET)
34#define __reg8
35#define __reg16
36#define __reg32
37#endif /* __ASSEMBLY__ */
38
39/* CFC */
40#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
41#define PLD_CFSTS __reg16(PLD_BASE + 0x0002)
42#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004)
43#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006)
44
45/* MMC */
46#define PLD_MMCCR __reg16(PLD_BASE + 0x4000)
47#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002)
48#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006)
49#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a)
50#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c)
51#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e)
52#define PLD_MMCDET __reg16(PLD_BASE + 0x4010)
53#define PLD_MMCWP __reg16(PLD_BASE + 0x4012)
54#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000)
55#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000)
56#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000)
57#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006)
58
59/* ICU
60 * ICUISTS: status register
61 * ICUIREQ0: request register
62 * ICUIREQ1: request register
63 * ICUCR3: control register for CFIREQ# interrupt
64 * ICUCR4: control register for CFC Card insert interrupt
65 * ICUCR5: control register for CFC Card eject interrupt
66 * ICUCR6: control register for external interrupt
67 * ICUCR11: control register for MMC Card insert/eject interrupt
68 * ICUCR13: control register for SC error interrupt
69 * ICUCR14: control register for SC receive interrupt
70 * ICUCR15: control register for SC send interrupt
71 */
72
73#define PLD_IRQ_INT0 (M32104UT_PLD_IRQ_BASE + 0) /* None */
74#define PLD_IRQ_CFIREQ (M32104UT_PLD_IRQ_BASE + 3) /* CF IREQ */
75#define PLD_IRQ_CFC_INSERT (M32104UT_PLD_IRQ_BASE + 4) /* CF Insert */
76#define PLD_IRQ_CFC_EJECT (M32104UT_PLD_IRQ_BASE + 5) /* CF Eject */
77#define PLD_IRQ_EXINT (M32104UT_PLD_IRQ_BASE + 6) /* EXINT */
78#define PLD_IRQ_MMCCARD (M32104UT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */
79#define PLD_IRQ_SC_ERROR (M32104UT_PLD_IRQ_BASE + 13) /* SC error */
80#define PLD_IRQ_SC_RCV (M32104UT_PLD_IRQ_BASE + 14) /* SC receive */
81#define PLD_IRQ_SC_SND (M32104UT_PLD_IRQ_BASE + 15) /* SC send */
82
83#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002)
84#define PLD_ICUISTS_VECB_MASK (0xf000)
85#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK)
86#define PLD_ICUISTS_ISN_MASK (0x07c0)
87#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK)
88#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104)
89#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106)
90#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108)
91#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a)
92#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114)
93#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118)
94#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a)
95#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c)
96#define PLD_ICUCR_IEN (0x1000)
97#define PLD_ICUCR_IREQ (0x0100)
98#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */
99#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */
100#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */
101#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */
102#define PLD_ICUCR_ILEVEL0 (0x0000)
103#define PLD_ICUCR_ILEVEL1 (0x0001)
104#define PLD_ICUCR_ILEVEL2 (0x0002)
105#define PLD_ICUCR_ILEVEL3 (0x0003)
106#define PLD_ICUCR_ILEVEL4 (0x0004)
107#define PLD_ICUCR_ILEVEL5 (0x0005)
108#define PLD_ICUCR_ILEVEL6 (0x0006)
109#define PLD_ICUCR_ILEVEL7 (0x0007)
110
111/* Power Control of MMC and CF */
112#define PLD_CPCR __reg16(PLD_BASE + 0x14000)
113#define PLD_CPCR_CDP 0x0001
114
115/* LED Control
116 *
117 * 1: DIP swich side
118 * 2: Reset switch side
119 */
120#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002)
121#define PLD_IOLED_1_ON 0x001
122#define PLD_IOLED_1_OFF 0x000
123#define PLD_IOLED_2_ON 0x002
124#define PLD_IOLED_2_OFF 0x000
125
126/* DIP Switch
127 * 0: Write-protect of Flash Memory (0:protected, 1:non-protected)
128 * 1: -
129 * 2: -
130 * 3: -
131 */
132#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004)
133#define PLD_IOSWSTS_IOSW2 0x0200
134#define PLD_IOSWSTS_IOSW1 0x0100
135#define PLD_IOSWSTS_IOWP0 0x0001
136
137/* CRC */
138#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000)
139#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002)
140#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004)
141#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006)
142#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008)
143#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a)
144
145/* RTC */
146#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000)
147#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002)
148#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004)
149#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006)
150#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008)
151
152/* SIM Card */
153#define PLD_SCCR __reg16(PLD_BASE + 0x38000)
154#define PLD_SCMOD __reg16(PLD_BASE + 0x38004)
155#define PLD_SCSTS __reg16(PLD_BASE + 0x38006)
156#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008)
157#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a)
158#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
159#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
160
161#endif /* _M32104UT_M32104UT_PLD_H */
diff --git a/include/asm-m32r/m32700ut/m32700ut_lan.h b/include/asm-m32r/m32700ut/m32700ut_lan.h
deleted file mode 100644
index aae810a4fb2c..000000000000
--- a/include/asm-m32r/m32700ut/m32700ut_lan.h
+++ /dev/null
@@ -1,103 +0,0 @@
1#ifndef _M32700UT_M32700UT_LAN_H
2#define _M32700UT_M32700UT_LAN_H
3
4/*
5 * include/asm-m32r/m32700ut/m32700ut_lan.h
6 *
7 * M32700UT-LAN board
8 *
9 * Copyright (c) 2002 Takeo Takahashi
10 *
11 * This file is subject to the terms and conditions of the GNU General
12 * Public License. See the file "COPYING" in the main directory of
13 * this archive for more details.
14 */
15
16#ifndef __ASSEMBLY__
17/*
18 * C functions use non-cache address.
19 */
20#define M32700UT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */)
21#else
22#define M32700UT_LAN_BASE (0x10000000 + NONCACHE_OFFSET)
23#endif /* __ASSEMBLY__ */
24
25/* ICU
26 * ICUISTS: status register
27 * ICUIREQ0: request register
28 * ICUIREQ1: request register
29 * ICUCR3: control register for CFIREQ# interrupt
30 * ICUCR4: control register for CFC Card insert interrupt
31 * ICUCR5: control register for CFC Card eject interrupt
32 * ICUCR6: control register for external interrupt
33 * ICUCR11: control register for MMC Card insert/eject interrupt
34 * ICUCR13: control register for SC error interrupt
35 * ICUCR14: control register for SC receive interrupt
36 * ICUCR15: control register for SC send interrupt
37 * ICUCR16: control register for SIO0 receive interrupt
38 * ICUCR17: control register for SIO0 send interrupt
39 */
40#define M32700UT_LAN_IRQ_LAN (M32700UT_LAN_PLD_IRQ_BASE + 1) /* LAN */
41#define M32700UT_LAN_IRQ_I2C (M32700UT_LAN_PLD_IRQ_BASE + 3) /* I2C */
42
43#define M32700UT_LAN_ICUISTS __reg16(M32700UT_LAN_BASE + 0xc0002)
44#define M32700UT_LAN_ICUISTS_VECB_MASK (0xf000)
45#define M32700UT_LAN_VECB(x) ((x) & M32700UT_LAN_ICUISTS_VECB_MASK)
46#define M32700UT_LAN_ICUISTS_ISN_MASK (0x07c0)
47#define M32700UT_LAN_ICUISTS_ISN(x) ((x) & M32700UT_LAN_ICUISTS_ISN_MASK)
48#define M32700UT_LAN_ICUIREQ0 __reg16(M32700UT_LAN_BASE + 0xc0004)
49#define M32700UT_LAN_ICUCR1 __reg16(M32700UT_LAN_BASE + 0xc0010)
50#define M32700UT_LAN_ICUCR3 __reg16(M32700UT_LAN_BASE + 0xc0014)
51
52/*
53 * AR register on PLD
54 */
55#define ARVCR0 __reg32(M32700UT_LAN_BASE + 0x40000)
56#define ARVCR0_VDS 0x00080000
57#define ARVCR0_RST 0x00010000
58#define ARVCR1 __reg32(M32700UT_LAN_BASE + 0x40004)
59#define ARVCR1_QVGA 0x02000000
60#define ARVCR1_NORMAL 0x01000000
61#define ARVCR1_HIEN 0x00010000
62#define ARVHCOUNT __reg32(M32700UT_LAN_BASE + 0x40008)
63#define ARDATA __reg32(M32700UT_LAN_BASE + 0x40010)
64#define ARINTSEL __reg32(M32700UT_LAN_BASE + 0x40014)
65#define ARINTSEL_INT3 0x10000000 /* CPU INT3 */
66#define ARDATA32 __reg32(M32700UT_LAN_BASE + 0x04040010) // Block 5
67/*
68#define ARINTSEL_SEL2 0x00002000
69#define ARINTSEL_SEL3 0x00001000
70#define ARINTSEL_SEL6 0x00000200
71#define ARINTSEL_SEL7 0x00000100
72#define ARINTSEL_SEL9 0x00000040
73#define ARINTSEL_SEL10 0x00000020
74#define ARINTSEL_SEL11 0x00000010
75#define ARINTSEL_SEL12 0x00000008
76*/
77
78/*
79 * I2C register on PLD
80 */
81#define PLDI2CCR __reg32(M32700UT_LAN_BASE + 0x40040)
82#define PLDI2CCR_ES0 0x00000001 /* enable I2C interface */
83#define PLDI2CMOD __reg32(M32700UT_LAN_BASE + 0x40044)
84#define PLDI2CMOD_ACKCLK 0x00000200
85#define PLDI2CMOD_DTWD 0x00000100
86#define PLDI2CMOD_10BT 0x00000004
87#define PLDI2CMOD_ATM_NORMAL 0x00000000
88#define PLDI2CMOD_ATM_AUTO 0x00000003
89#define PLDI2CACK __reg32(M32700UT_LAN_BASE + 0x40048)
90#define PLDI2CACK_ACK 0x00000001
91#define PLDI2CFREQ __reg32(M32700UT_LAN_BASE + 0x4004c)
92#define PLDI2CCND __reg32(M32700UT_LAN_BASE + 0x40050)
93#define PLDI2CCND_START 0x00000001
94#define PLDI2CCND_STOP 0x00000002
95#define PLDI2CSTEN __reg32(M32700UT_LAN_BASE + 0x40054)
96#define PLDI2CSTEN_STEN 0x00000001
97#define PLDI2CDATA __reg32(M32700UT_LAN_BASE + 0x40060)
98#define PLDI2CSTS __reg32(M32700UT_LAN_BASE + 0x40064)
99#define PLDI2CSTS_TRX 0x00000020
100#define PLDI2CSTS_BB 0x00000010
101#define PLDI2CSTS_NOACK 0x00000001 /* 0:ack, 1:noack */
102
103#endif /* _M32700UT_M32700UT_LAN_H */
diff --git a/include/asm-m32r/m32700ut/m32700ut_lcd.h b/include/asm-m32r/m32700ut/m32700ut_lcd.h
deleted file mode 100644
index 4c2489079788..000000000000
--- a/include/asm-m32r/m32700ut/m32700ut_lcd.h
+++ /dev/null
@@ -1,55 +0,0 @@
1#ifndef _M32700UT_M32700UT_LCD_H
2#define _M32700UT_M32700UT_LCD_H
3
4/*
5 * include/asm-m32r/m32700ut/m32700ut_lcd.h
6 *
7 * M32700UT-LCD board
8 *
9 * Copyright (c) 2002 Takeo Takahashi
10 *
11 * This file is subject to the terms and conditions of the GNU General
12 * Public License. See the file "COPYING" in the main directory of
13 * this archive for more details.
14 */
15
16#ifndef __ASSEMBLY__
17/*
18 * C functions use non-cache address.
19 */
20#define M32700UT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */)
21#else
22#define M32700UT_LCD_BASE (0x10000000 + NONCACHE_OFFSET)
23#endif /* __ASSEMBLY__ */
24
25/*
26 * ICU
27 */
28#define M32700UT_LCD_IRQ_BAT_INT (M32700UT_LCD_PLD_IRQ_BASE + 1)
29#define M32700UT_LCD_IRQ_USB_INT1 (M32700UT_LCD_PLD_IRQ_BASE + 2)
30#define M32700UT_LCD_IRQ_AUDT0 (M32700UT_LCD_PLD_IRQ_BASE + 3)
31#define M32700UT_LCD_IRQ_AUDT2 (M32700UT_LCD_PLD_IRQ_BASE + 4)
32#define M32700UT_LCD_IRQ_BATSIO_RCV (M32700UT_LCD_PLD_IRQ_BASE + 16)
33#define M32700UT_LCD_IRQ_BATSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 17)
34#define M32700UT_LCD_IRQ_ASNDSIO_RCV (M32700UT_LCD_PLD_IRQ_BASE + 18)
35#define M32700UT_LCD_IRQ_ASNDSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 19)
36#define M32700UT_LCD_IRQ_ACNLSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 21)
37
38#define M32700UT_LCD_ICUISTS __reg16(M32700UT_LCD_BASE + 0x300002)
39#define M32700UT_LCD_ICUISTS_VECB_MASK (0xf000)
40#define M32700UT_LCD_VECB(x) ((x) & M32700UT_LCD_ICUISTS_VECB_MASK)
41#define M32700UT_LCD_ICUISTS_ISN_MASK (0x07c0)
42#define M32700UT_LCD_ICUISTS_ISN(x) ((x) & M32700UT_LCD_ICUISTS_ISN_MASK)
43#define M32700UT_LCD_ICUIREQ0 __reg16(M32700UT_LCD_BASE + 0x300004)
44#define M32700UT_LCD_ICUIREQ1 __reg16(M32700UT_LCD_BASE + 0x300006)
45#define M32700UT_LCD_ICUCR1 __reg16(M32700UT_LCD_BASE + 0x300020)
46#define M32700UT_LCD_ICUCR2 __reg16(M32700UT_LCD_BASE + 0x300022)
47#define M32700UT_LCD_ICUCR3 __reg16(M32700UT_LCD_BASE + 0x300024)
48#define M32700UT_LCD_ICUCR4 __reg16(M32700UT_LCD_BASE + 0x300026)
49#define M32700UT_LCD_ICUCR16 __reg16(M32700UT_LCD_BASE + 0x300030)
50#define M32700UT_LCD_ICUCR17 __reg16(M32700UT_LCD_BASE + 0x300032)
51#define M32700UT_LCD_ICUCR18 __reg16(M32700UT_LCD_BASE + 0x300034)
52#define M32700UT_LCD_ICUCR19 __reg16(M32700UT_LCD_BASE + 0x300036)
53#define M32700UT_LCD_ICUCR21 __reg16(M32700UT_LCD_BASE + 0x30003a)
54
55#endif /* _M32700UT_M32700UT_LCD_H */
diff --git a/include/asm-m32r/m32700ut/m32700ut_pld.h b/include/asm-m32r/m32700ut/m32700ut_pld.h
deleted file mode 100644
index 57623beb44cb..000000000000
--- a/include/asm-m32r/m32700ut/m32700ut_pld.h
+++ /dev/null
@@ -1,259 +0,0 @@
1#ifndef _M32700UT_M32700UT_PLD_H
2#define _M32700UT_M32700UT_PLD_H
3
4/*
5 * include/asm-m32r/m32700ut/m32700ut_pld.h
6 *
7 * Definitions for Programable Logic Device(PLD) on M32700UT board.
8 *
9 * Copyright (c) 2002 Takeo Takahashi
10 *
11 * This file is subject to the terms and conditions of the GNU General
12 * Public License. See the file "COPYING" in the main directory of
13 * this archive for more details.
14 */
15
16#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV)
17#define PLD_PLAT_BASE 0x04c00000
18#else
19#error "no platform configuration"
20#endif
21
22#ifndef __ASSEMBLY__
23/*
24 * C functions use non-cache address.
25 */
26#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */)
27#define __reg8 (volatile unsigned char *)
28#define __reg16 (volatile unsigned short *)
29#define __reg32 (volatile unsigned int *)
30#else
31#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET)
32#define __reg8
33#define __reg16
34#define __reg32
35#endif /* __ASSEMBLY__ */
36
37/* CFC */
38#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
39#define PLD_CFSTS __reg16(PLD_BASE + 0x0002)
40#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004)
41#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006)
42#define PLD_CFVENCR __reg16(PLD_BASE + 0x0008)
43#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a)
44#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c)
45#define PLD_IDERSTCR __reg16(PLD_BASE + 0x0010)
46
47/* MMC */
48#define PLD_MMCCR __reg16(PLD_BASE + 0x4000)
49#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002)
50#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006)
51#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a)
52#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c)
53#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e)
54#define PLD_MMCDET __reg16(PLD_BASE + 0x4010)
55#define PLD_MMCWP __reg16(PLD_BASE + 0x4012)
56#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000)
57#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000)
58#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000)
59#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006)
60
61/* ICU
62 * ICUISTS: status register
63 * ICUIREQ0: request register
64 * ICUIREQ1: request register
65 * ICUCR3: control register for CFIREQ# interrupt
66 * ICUCR4: control register for CFC Card insert interrupt
67 * ICUCR5: control register for CFC Card eject interrupt
68 * ICUCR6: control register for external interrupt
69 * ICUCR11: control register for MMC Card insert/eject interrupt
70 * ICUCR13: control register for SC error interrupt
71 * ICUCR14: control register for SC receive interrupt
72 * ICUCR15: control register for SC send interrupt
73 * ICUCR16: control register for SIO0 receive interrupt
74 * ICUCR17: control register for SIO0 send interrupt
75 */
76#if !defined(CONFIG_PLAT_USRV)
77#define PLD_IRQ_INT0 (M32700UT_PLD_IRQ_BASE + 0) /* None */
78#define PLD_IRQ_INT1 (M32700UT_PLD_IRQ_BASE + 1) /* reserved */
79#define PLD_IRQ_INT2 (M32700UT_PLD_IRQ_BASE + 2) /* reserved */
80#define PLD_IRQ_CFIREQ (M32700UT_PLD_IRQ_BASE + 3) /* CF IREQ */
81#define PLD_IRQ_CFC_INSERT (M32700UT_PLD_IRQ_BASE + 4) /* CF Insert */
82#define PLD_IRQ_CFC_EJECT (M32700UT_PLD_IRQ_BASE + 5) /* CF Eject */
83#define PLD_IRQ_EXINT (M32700UT_PLD_IRQ_BASE + 6) /* EXINT */
84#define PLD_IRQ_INT7 (M32700UT_PLD_IRQ_BASE + 7) /* reserved */
85#define PLD_IRQ_INT8 (M32700UT_PLD_IRQ_BASE + 8) /* reserved */
86#define PLD_IRQ_INT9 (M32700UT_PLD_IRQ_BASE + 9) /* reserved */
87#define PLD_IRQ_INT10 (M32700UT_PLD_IRQ_BASE + 10) /* reserved */
88#define PLD_IRQ_MMCCARD (M32700UT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */
89#define PLD_IRQ_INT12 (M32700UT_PLD_IRQ_BASE + 12) /* reserved */
90#define PLD_IRQ_SC_ERROR (M32700UT_PLD_IRQ_BASE + 13) /* SC error */
91#define PLD_IRQ_SC_RCV (M32700UT_PLD_IRQ_BASE + 14) /* SC receive */
92#define PLD_IRQ_SC_SND (M32700UT_PLD_IRQ_BASE + 15) /* SC send */
93#define PLD_IRQ_SIO0_RCV (M32700UT_PLD_IRQ_BASE + 16) /* SIO receive */
94#define PLD_IRQ_SIO0_SND (M32700UT_PLD_IRQ_BASE + 17) /* SIO send */
95#define PLD_IRQ_INT18 (M32700UT_PLD_IRQ_BASE + 18) /* reserved */
96#define PLD_IRQ_INT19 (M32700UT_PLD_IRQ_BASE + 19) /* reserved */
97#define PLD_IRQ_INT20 (M32700UT_PLD_IRQ_BASE + 20) /* reserved */
98#define PLD_IRQ_INT21 (M32700UT_PLD_IRQ_BASE + 21) /* reserved */
99#define PLD_IRQ_INT22 (M32700UT_PLD_IRQ_BASE + 22) /* reserved */
100#define PLD_IRQ_INT23 (M32700UT_PLD_IRQ_BASE + 23) /* reserved */
101#define PLD_IRQ_INT24 (M32700UT_PLD_IRQ_BASE + 24) /* reserved */
102#define PLD_IRQ_INT25 (M32700UT_PLD_IRQ_BASE + 25) /* reserved */
103#define PLD_IRQ_INT26 (M32700UT_PLD_IRQ_BASE + 26) /* reserved */
104#define PLD_IRQ_INT27 (M32700UT_PLD_IRQ_BASE + 27) /* reserved */
105#define PLD_IRQ_INT28 (M32700UT_PLD_IRQ_BASE + 28) /* reserved */
106#define PLD_IRQ_INT29 (M32700UT_PLD_IRQ_BASE + 29) /* reserved */
107#define PLD_IRQ_INT30 (M32700UT_PLD_IRQ_BASE + 30) /* reserved */
108#define PLD_IRQ_INT31 (M32700UT_PLD_IRQ_BASE + 31) /* reserved */
109
110#else /* CONFIG_PLAT_USRV */
111
112#define PLD_IRQ_INT0 (M32700UT_PLD_IRQ_BASE + 0) /* None */
113#define PLD_IRQ_INT1 (M32700UT_PLD_IRQ_BASE + 1) /* reserved */
114#define PLD_IRQ_INT2 (M32700UT_PLD_IRQ_BASE + 2) /* reserved */
115#define PLD_IRQ_CF0 (M32700UT_PLD_IRQ_BASE + 3) /* CF0# */
116#define PLD_IRQ_CF1 (M32700UT_PLD_IRQ_BASE + 4) /* CF1# */
117#define PLD_IRQ_CF2 (M32700UT_PLD_IRQ_BASE + 5) /* CF2# */
118#define PLD_IRQ_CF3 (M32700UT_PLD_IRQ_BASE + 6) /* CF3# */
119#define PLD_IRQ_CF4 (M32700UT_PLD_IRQ_BASE + 7) /* CF4# */
120#define PLD_IRQ_INT8 (M32700UT_PLD_IRQ_BASE + 8) /* reserved */
121#define PLD_IRQ_INT9 (M32700UT_PLD_IRQ_BASE + 9) /* reserved */
122#define PLD_IRQ_INT10 (M32700UT_PLD_IRQ_BASE + 10) /* reserved */
123#define PLD_IRQ_INT11 (M32700UT_PLD_IRQ_BASE + 11) /* reserved */
124#define PLD_IRQ_UART0 (M32700UT_PLD_IRQ_BASE + 12) /* UARTIRQ0 */
125#define PLD_IRQ_UART1 (M32700UT_PLD_IRQ_BASE + 13) /* UARTIRQ1 */
126#define PLD_IRQ_INT14 (M32700UT_PLD_IRQ_BASE + 14) /* reserved */
127#define PLD_IRQ_INT15 (M32700UT_PLD_IRQ_BASE + 15) /* reserved */
128#define PLD_IRQ_SNDINT (M32700UT_PLD_IRQ_BASE + 16) /* SNDINT# */
129#define PLD_IRQ_INT17 (M32700UT_PLD_IRQ_BASE + 17) /* reserved */
130#define PLD_IRQ_INT18 (M32700UT_PLD_IRQ_BASE + 18) /* reserved */
131#define PLD_IRQ_INT19 (M32700UT_PLD_IRQ_BASE + 19) /* reserved */
132#define PLD_IRQ_INT20 (M32700UT_PLD_IRQ_BASE + 20) /* reserved */
133#define PLD_IRQ_INT21 (M32700UT_PLD_IRQ_BASE + 21) /* reserved */
134#define PLD_IRQ_INT22 (M32700UT_PLD_IRQ_BASE + 22) /* reserved */
135#define PLD_IRQ_INT23 (M32700UT_PLD_IRQ_BASE + 23) /* reserved */
136#define PLD_IRQ_INT24 (M32700UT_PLD_IRQ_BASE + 24) /* reserved */
137#define PLD_IRQ_INT25 (M32700UT_PLD_IRQ_BASE + 25) /* reserved */
138#define PLD_IRQ_INT26 (M32700UT_PLD_IRQ_BASE + 26) /* reserved */
139#define PLD_IRQ_INT27 (M32700UT_PLD_IRQ_BASE + 27) /* reserved */
140#define PLD_IRQ_INT28 (M32700UT_PLD_IRQ_BASE + 28) /* reserved */
141#define PLD_IRQ_INT29 (M32700UT_PLD_IRQ_BASE + 29) /* reserved */
142#define PLD_IRQ_INT30 (M32700UT_PLD_IRQ_BASE + 30) /* reserved */
143
144#endif /* CONFIG_PLAT_USRV */
145
146#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002)
147#define PLD_ICUISTS_VECB_MASK (0xf000)
148#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK)
149#define PLD_ICUISTS_ISN_MASK (0x07c0)
150#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK)
151#define PLD_ICUIREQ0 __reg16(PLD_BASE + 0x8004)
152#define PLD_ICUIREQ1 __reg16(PLD_BASE + 0x8006)
153#define PLD_ICUCR1 __reg16(PLD_BASE + 0x8100)
154#define PLD_ICUCR2 __reg16(PLD_BASE + 0x8102)
155#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104)
156#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106)
157#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108)
158#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a)
159#define PLD_ICUCR7 __reg16(PLD_BASE + 0x810c)
160#define PLD_ICUCR8 __reg16(PLD_BASE + 0x810e)
161#define PLD_ICUCR9 __reg16(PLD_BASE + 0x8110)
162#define PLD_ICUCR10 __reg16(PLD_BASE + 0x8112)
163#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114)
164#define PLD_ICUCR12 __reg16(PLD_BASE + 0x8116)
165#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118)
166#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a)
167#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c)
168#define PLD_ICUCR16 __reg16(PLD_BASE + 0x811e)
169#define PLD_ICUCR17 __reg16(PLD_BASE + 0x8120)
170#define PLD_ICUCR_IEN (0x1000)
171#define PLD_ICUCR_IREQ (0x0100)
172#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */
173#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */
174#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */
175#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */
176#define PLD_ICUCR_ILEVEL0 (0x0000)
177#define PLD_ICUCR_ILEVEL1 (0x0001)
178#define PLD_ICUCR_ILEVEL2 (0x0002)
179#define PLD_ICUCR_ILEVEL3 (0x0003)
180#define PLD_ICUCR_ILEVEL4 (0x0004)
181#define PLD_ICUCR_ILEVEL5 (0x0005)
182#define PLD_ICUCR_ILEVEL6 (0x0006)
183#define PLD_ICUCR_ILEVEL7 (0x0007)
184
185/* Power Control of MMC and CF */
186#define PLD_CPCR __reg16(PLD_BASE + 0x14000)
187#define PLD_CPCR_CF 0x0001
188#define PLD_CPCR_MMC 0x0002
189
190/* LED Control
191 *
192 * 1: DIP swich side
193 * 2: Reset switch side
194 */
195#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002)
196#define PLD_IOLED_1_ON 0x001
197#define PLD_IOLED_1_OFF 0x000
198#define PLD_IOLED_2_ON 0x002
199#define PLD_IOLED_2_OFF 0x000
200
201/* DIP Switch
202 * 0: Write-protect of Flash Memory (0:protected, 1:non-protected)
203 * 1: -
204 * 2: -
205 * 3: -
206 */
207#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004)
208#define PLD_IOSWSTS_IOSW2 0x0200
209#define PLD_IOSWSTS_IOSW1 0x0100
210#define PLD_IOSWSTS_IOWP0 0x0001
211
212/* CRC */
213#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000)
214#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002)
215#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004)
216#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006)
217#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008)
218#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a)
219
220/* RTC */
221#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000)
222#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002)
223#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004)
224#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006)
225#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008)
226
227/* SIO0 */
228#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000)
229#define PLD_ESIO0CR_TXEN 0x0001
230#define PLD_ESIO0CR_RXEN 0x0002
231#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002)
232#define PLD_ESIO0MOD0_CTSS 0x0040
233#define PLD_ESIO0MOD0_RTSS 0x0080
234#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004)
235#define PLD_ESIO0MOD1_LMFS 0x0010
236#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006)
237#define PLD_ESIO0STS_TEMP 0x0001
238#define PLD_ESIO0STS_TXCP 0x0002
239#define PLD_ESIO0STS_RXCP 0x0004
240#define PLD_ESIO0STS_TXSC 0x0100
241#define PLD_ESIO0STS_RXSC 0x0200
242#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP)
243#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008)
244#define PLD_ESIO0INTCR_TXIEN 0x0002
245#define PLD_ESIO0INTCR_RXCEN 0x0004
246#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a)
247#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c)
248#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e)
249
250/* SIM Card */
251#define PLD_SCCR __reg16(PLD_BASE + 0x38000)
252#define PLD_SCMOD __reg16(PLD_BASE + 0x38004)
253#define PLD_SCSTS __reg16(PLD_BASE + 0x38006)
254#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008)
255#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a)
256#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
257#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
258
259#endif /* _M32700UT_M32700UT_PLD.H */
diff --git a/include/asm-m32r/m32r.h b/include/asm-m32r/m32r.h
deleted file mode 100644
index 214b44b40757..000000000000
--- a/include/asm-m32r/m32r.h
+++ /dev/null
@@ -1,160 +0,0 @@
1#ifndef _ASM_M32R_M32R_H_
2#define _ASM_M32R_M32R_H_
3
4/*
5 * Renesas M32R processor
6 *
7 * Copyright (C) 2003, 2004 Renesas Technology Corp.
8 */
9
10
11/* Chip type */
12#if defined(CONFIG_CHIP_XNUX_MP) || defined(CONFIG_CHIP_XNUX2_MP)
13#include <asm/m32r_mp_fpga.h>
14#elif defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \
15 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \
16 || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
17#include <asm/m32102.h>
18#endif
19
20/* Platform type */
21#if defined(CONFIG_PLAT_M32700UT)
22#include <asm/m32700ut/m32700ut_pld.h>
23#include <asm/m32700ut/m32700ut_lan.h>
24#include <asm/m32700ut/m32700ut_lcd.h>
25/* for ei_handler:linux/arch/m32r/kernel/entry.S */
26#define M32R_INT1ICU_ISTS PLD_ICUISTS
27#define M32R_INT1ICU_IRQ_BASE M32700UT_PLD_IRQ_BASE
28#define M32R_INT0ICU_ISTS M32700UT_LAN_ICUISTS
29#define M32R_INT0ICU_IRQ_BASE M32700UT_LAN_PLD_IRQ_BASE
30#define M32R_INT2ICU_ISTS M32700UT_LCD_ICUISTS
31#define M32R_INT2ICU_IRQ_BASE M32700UT_LCD_PLD_IRQ_BASE
32#endif /* CONFIG_PLAT_M32700UT */
33
34#if defined(CONFIG_PLAT_OPSPUT)
35#include <asm/opsput/opsput_pld.h>
36#include <asm/opsput/opsput_lan.h>
37#include <asm/opsput/opsput_lcd.h>
38/* for ei_handler:linux/arch/m32r/kernel/entry.S */
39#define M32R_INT1ICU_ISTS PLD_ICUISTS
40#define M32R_INT1ICU_IRQ_BASE OPSPUT_PLD_IRQ_BASE
41#define M32R_INT0ICU_ISTS OPSPUT_LAN_ICUISTS
42#define M32R_INT0ICU_IRQ_BASE OPSPUT_LAN_PLD_IRQ_BASE
43#define M32R_INT2ICU_ISTS OPSPUT_LCD_ICUISTS
44#define M32R_INT2ICU_IRQ_BASE OPSPUT_LCD_PLD_IRQ_BASE
45#endif /* CONFIG_PLAT_OPSPUT */
46
47#if defined(CONFIG_PLAT_MAPPI2)
48#include <asm/mappi2/mappi2_pld.h>
49#endif /* CONFIG_PLAT_MAPPI2 */
50
51#if defined(CONFIG_PLAT_MAPPI3)
52#include <asm/mappi3/mappi3_pld.h>
53#endif /* CONFIG_PLAT_MAPPI3 */
54
55#if defined(CONFIG_PLAT_USRV)
56#include <asm/m32700ut/m32700ut_pld.h>
57/* for ei_handler:linux/arch/m32r/kernel/entry.S */
58#define M32R_INT1ICU_ISTS PLD_ICUISTS
59#define M32R_INT1ICU_IRQ_BASE M32700UT_PLD_IRQ_BASE
60#endif
61
62#if defined(CONFIG_PLAT_M32104UT)
63#include <asm/m32104ut/m32104ut_pld.h>
64/* for ei_handler:linux/arch/m32r/kernel/entry.S */
65#define M32R_INT1ICU_ISTS PLD_ICUISTS
66#define M32R_INT1ICU_IRQ_BASE M32104UT_PLD_IRQ_BASE
67#endif /* CONFIG_PLAT_M32104 */
68
69/*
70 * M32R Register
71 */
72
73/*
74 * MMU Register
75 */
76
77#define MMU_REG_BASE (0xffff0000)
78#define ITLB_BASE (0xfe000000)
79#define DTLB_BASE (0xfe000800)
80
81#define NR_TLB_ENTRIES CONFIG_TLB_ENTRIES
82
83#define MATM MMU_REG_BASE /* MMU Address Translation Mode
84 Register */
85#define MPSZ (0x04 + MMU_REG_BASE) /* MMU Page Size Designation Register */
86#define MASID (0x08 + MMU_REG_BASE) /* MMU Address Space ID Register */
87#define MESTS (0x0c + MMU_REG_BASE) /* MMU Exception Status Register */
88#define MDEVA (0x10 + MMU_REG_BASE) /* MMU Operand Exception Virtual
89 Address Register */
90#define MDEVP (0x14 + MMU_REG_BASE) /* MMU Operand Exception Virtual Page
91 Number Register */
92#define MPTB (0x18 + MMU_REG_BASE) /* MMU Page Table Base Register */
93#define MSVA (0x20 + MMU_REG_BASE) /* MMU Search Virtual Address
94 Register */
95#define MTOP (0x24 + MMU_REG_BASE) /* MMU TLB Operation Register */
96#define MIDXI (0x28 + MMU_REG_BASE) /* MMU Index Register for
97 Instruciton */
98#define MIDXD (0x2c + MMU_REG_BASE) /* MMU Index Register for Operand */
99
100#define MATM_offset (MATM - MMU_REG_BASE)
101#define MPSZ_offset (MPSZ - MMU_REG_BASE)
102#define MASID_offset (MASID - MMU_REG_BASE)
103#define MESTS_offset (MESTS - MMU_REG_BASE)
104#define MDEVA_offset (MDEVA - MMU_REG_BASE)
105#define MDEVP_offset (MDEVP - MMU_REG_BASE)
106#define MPTB_offset (MPTB - MMU_REG_BASE)
107#define MSVA_offset (MSVA - MMU_REG_BASE)
108#define MTOP_offset (MTOP - MMU_REG_BASE)
109#define MIDXI_offset (MIDXI - MMU_REG_BASE)
110#define MIDXD_offset (MIDXD - MMU_REG_BASE)
111
112#define MESTS_IT (1 << 0) /* Instruction TLB miss */
113#define MESTS_IA (1 << 1) /* Instruction Access Exception */
114#define MESTS_DT (1 << 4) /* Operand TLB miss */
115#define MESTS_DA (1 << 5) /* Operand Access Exception */
116#define MESTS_DRW (1 << 6) /* Operand Write Exception Flag */
117
118/*
119 * PSW (Processor Status Word)
120 */
121
122/* PSW bit */
123#define M32R_PSW_BIT_SM (7) /* Stack Mode */
124#define M32R_PSW_BIT_IE (6) /* Interrupt Enable */
125#define M32R_PSW_BIT_PM (3) /* Processor Mode [0:Supervisor,1:User] */
126#define M32R_PSW_BIT_C (0) /* Condition */
127#define M32R_PSW_BIT_BSM (7+8) /* Backup Stack Mode */
128#define M32R_PSW_BIT_BIE (6+8) /* Backup Interrupt Enable */
129#define M32R_PSW_BIT_BPM (3+8) /* Backup Processor Mode */
130#define M32R_PSW_BIT_BC (0+8) /* Backup Condition */
131
132/* PSW bit map */
133#define M32R_PSW_SM (1UL<< M32R_PSW_BIT_SM) /* Stack Mode */
134#define M32R_PSW_IE (1UL<< M32R_PSW_BIT_IE) /* Interrupt Enable */
135#define M32R_PSW_PM (1UL<< M32R_PSW_BIT_PM) /* Processor Mode */
136#define M32R_PSW_C (1UL<< M32R_PSW_BIT_C) /* Condition */
137#define M32R_PSW_BSM (1UL<< M32R_PSW_BIT_BSM) /* Backup Stack Mode */
138#define M32R_PSW_BIE (1UL<< M32R_PSW_BIT_BIE) /* Backup Interrupt Enable */
139#define M32R_PSW_BPM (1UL<< M32R_PSW_BIT_BPM) /* Backup Processor Mode */
140#define M32R_PSW_BC (1UL<< M32R_PSW_BIT_BC) /* Backup Condition */
141
142/*
143 * Direct address to SFR
144 */
145
146#include <asm/page.h>
147#ifdef CONFIG_MMU
148#define NONCACHE_OFFSET (__PAGE_OFFSET + 0x20000000)
149#else
150#define NONCACHE_OFFSET __PAGE_OFFSET
151#endif /* CONFIG_MMU */
152
153#define M32R_ICU_ISTS_ADDR M32R_ICU_ISTS_PORTL+NONCACHE_OFFSET
154#define M32R_ICU_IPICR_ADDR M32R_ICU_IPICR0_PORTL+NONCACHE_OFFSET
155#define M32R_ICU_IMASK_ADDR M32R_ICU_IMASK_PORTL+NONCACHE_OFFSET
156#define M32R_FPGA_CPU_NAME_ADDR M32R_FPGA_CPU_NAME0_PORTL+NONCACHE_OFFSET
157#define M32R_FPGA_MODEL_ID_ADDR M32R_FPGA_MODEL_ID0_PORTL+NONCACHE_OFFSET
158#define M32R_FPGA_VERSION_ADDR M32R_FPGA_VERSION0_PORTL+NONCACHE_OFFSET
159
160#endif /* _ASM_M32R_M32R_H_ */
diff --git a/include/asm-m32r/m32r_mp_fpga.h b/include/asm-m32r/m32r_mp_fpga.h
deleted file mode 100644
index 976d2b995919..000000000000
--- a/include/asm-m32r/m32r_mp_fpga.h
+++ /dev/null
@@ -1,313 +0,0 @@
1#ifndef _ASM_M32R_M32R_MP_FPGA_
2#define _ASM_M32R_M32R_MP_FPGA_
3
4/*
5 * Renesas M32R-MP-FPGA
6 *
7 * Copyright (c) 2002 Hitoshi Yamamoto
8 * Copyright (c) 2003, 2004 Renesas Technology Corp.
9 */
10
11/*
12 * ========================================================
13 * M32R-MP-FPGA Memory Map
14 * ========================================================
15 * 0x00000000 : Block#0 : 64[MB]
16 * 0x03E00000 : SFR
17 * 0x03E00000 : reserved
18 * 0x03EF0000 : FPGA
19 * 0x03EF1000 : reserved
20 * 0x03EF4000 : CKM
21 * 0x03EF4000 : BSELC
22 * 0x03EF5000 : reserved
23 * 0x03EFC000 : MFT
24 * 0x03EFD000 : SIO
25 * 0x03EFE000 : reserved
26 * 0x03EFF000 : ICU
27 * 0x03F00000 : Internal SRAM 64[KB]
28 * 0x03F10000 : reserved
29 * --------------------------------------------------------
30 * 0x04000000 : Block#1 : 64[MB]
31 * 0x04000000 : Debug board SRAM 4[MB]
32 * 0x04400000 : reserved
33 * --------------------------------------------------------
34 * 0x08000000 : Block#2 : 64[MB]
35 * --------------------------------------------------------
36 * 0x0C000000 : Block#3 : 64[MB]
37 * --------------------------------------------------------
38 * 0x10000000 : Block#4 : 64[MB]
39 * --------------------------------------------------------
40 * 0x14000000 : Block#5 : 64[MB]
41 * --------------------------------------------------------
42 * 0x18000000 : Block#6 : 64[MB]
43 * --------------------------------------------------------
44 * 0x1C000000 : Block#7 : 64[MB]
45 * --------------------------------------------------------
46 * 0xFE000000 : TLB
47 * 0xFE000000 : ITLB
48 * 0xFE000080 : reserved
49 * 0xFE000800 : DTLB
50 * 0xFE000880 : reserved
51 * --------------------------------------------------------
52 * 0xFF000000 : System area
53 * 0xFFFF0000 : MMU
54 * 0xFFFF0030 : reserved
55 * 0xFFFF8000 : Debug function
56 * 0xFFFFA000 : reserved
57 * 0xFFFFC000 : CPU control
58 * 0xFFFFFFFF
59 * ========================================================
60 */
61
62/*======================================================================*
63 * Special Function Register
64 *======================================================================*/
65#define M32R_SFR_OFFSET (0x00E00000) /* 0x03E00000-0x03EFFFFF 1[MB] */
66
67/*
68 * FPGA registers.
69 */
70#define M32R_FPGA_TOP (0x000F0000+M32R_SFR_OFFSET)
71
72#define M32R_FPGA_NUM_OF_CPUS_PORTL (0x00+M32R_FPGA_TOP)
73#define M32R_FPGA_CPU_NAME0_PORTL (0x10+M32R_FPGA_TOP)
74#define M32R_FPGA_CPU_NAME1_PORTL (0x14+M32R_FPGA_TOP)
75#define M32R_FPGA_CPU_NAME2_PORTL (0x18+M32R_FPGA_TOP)
76#define M32R_FPGA_CPU_NAME3_PORTL (0x1C+M32R_FPGA_TOP)
77#define M32R_FPGA_MODEL_ID0_PORTL (0x20+M32R_FPGA_TOP)
78#define M32R_FPGA_MODEL_ID1_PORTL (0x24+M32R_FPGA_TOP)
79#define M32R_FPGA_MODEL_ID2_PORTL (0x28+M32R_FPGA_TOP)
80#define M32R_FPGA_MODEL_ID3_PORTL (0x2C+M32R_FPGA_TOP)
81#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP)
82#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP)
83
84/*
85 * Clock and Power Manager registers.
86 */
87#define M32R_CPM_OFFSET (0x000F4000+M32R_SFR_OFFSET)
88
89#define M32R_CPM_CPUCLKCR_PORTL (0x00+M32R_CPM_OFFSET)
90#define M32R_CPM_CLKMOD_PORTL (0x04+M32R_CPM_OFFSET)
91#define M32R_CPM_PLLCR_PORTL (0x08+M32R_CPM_OFFSET)
92
93/*
94 * Block SELect Controller registers.
95 */
96#define M32R_BSELC_OFFSET (0x000F5000+M32R_SFR_OFFSET)
97
98#define M32R_BSEL0_CR0_PORTL (0x000+M32R_BSELC_OFFSET)
99#define M32R_BSEL0_CR1_PORTL (0x004+M32R_BSELC_OFFSET)
100#define M32R_BSEL1_CR0_PORTL (0x100+M32R_BSELC_OFFSET)
101#define M32R_BSEL1_CR1_PORTL (0x104+M32R_BSELC_OFFSET)
102#define M32R_BSEL2_CR0_PORTL (0x200+M32R_BSELC_OFFSET)
103#define M32R_BSEL2_CR1_PORTL (0x204+M32R_BSELC_OFFSET)
104#define M32R_BSEL3_CR0_PORTL (0x300+M32R_BSELC_OFFSET)
105#define M32R_BSEL3_CR1_PORTL (0x304+M32R_BSELC_OFFSET)
106#define M32R_BSEL4_CR0_PORTL (0x400+M32R_BSELC_OFFSET)
107#define M32R_BSEL4_CR1_PORTL (0x404+M32R_BSELC_OFFSET)
108#define M32R_BSEL5_CR0_PORTL (0x500+M32R_BSELC_OFFSET)
109#define M32R_BSEL5_CR1_PORTL (0x504+M32R_BSELC_OFFSET)
110#define M32R_BSEL6_CR0_PORTL (0x600+M32R_BSELC_OFFSET)
111#define M32R_BSEL6_CR1_PORTL (0x604+M32R_BSELC_OFFSET)
112#define M32R_BSEL7_CR0_PORTL (0x700+M32R_BSELC_OFFSET)
113#define M32R_BSEL7_CR1_PORTL (0x704+M32R_BSELC_OFFSET)
114
115/*
116 * Multi Function Timer registers.
117 */
118#define M32R_MFT_OFFSET (0x000FC000+M32R_SFR_OFFSET)
119
120#define M32R_MFTCR_PORTL (0x000+M32R_MFT_OFFSET) /* MFT control */
121#define M32R_MFTRPR_PORTL (0x004+M32R_MFT_OFFSET) /* MFT real port */
122
123#define M32R_MFT0_OFFSET (0x100+M32R_MFT_OFFSET)
124#define M32R_MFT0MOD_PORTL (0x00+M32R_MFT0_OFFSET) /* MFT0 mode */
125#define M32R_MFT0BOS_PORTL (0x04+M32R_MFT0_OFFSET) /* MFT0 b-port output status */
126#define M32R_MFT0CUT_PORTL (0x08+M32R_MFT0_OFFSET) /* MFT0 count */
127#define M32R_MFT0RLD_PORTL (0x0C+M32R_MFT0_OFFSET) /* MFT0 reload */
128#define M32R_MFT0CMPRLD_PORTL (0x10+M32R_MFT0_OFFSET) /* MFT0 compare reload */
129
130#define M32R_MFT1_OFFSET (0x200+M32R_MFT_OFFSET)
131#define M32R_MFT1MOD_PORTL (0x00+M32R_MFT1_OFFSET) /* MFT1 mode */
132#define M32R_MFT1BOS_PORTL (0x04+M32R_MFT1_OFFSET) /* MFT1 b-port output status */
133#define M32R_MFT1CUT_PORTL (0x08+M32R_MFT1_OFFSET) /* MFT1 count */
134#define M32R_MFT1RLD_PORTL (0x0C+M32R_MFT1_OFFSET) /* MFT1 reload */
135#define M32R_MFT1CMPRLD_PORTL (0x10+M32R_MFT1_OFFSET) /* MFT1 compare reload */
136
137#define M32R_MFT2_OFFSET (0x300+M32R_MFT_OFFSET)
138#define M32R_MFT2MOD_PORTL (0x00+M32R_MFT2_OFFSET) /* MFT2 mode */
139#define M32R_MFT2BOS_PORTL (0x04+M32R_MFT2_OFFSET) /* MFT2 b-port output status */
140#define M32R_MFT2CUT_PORTL (0x08+M32R_MFT2_OFFSET) /* MFT2 count */
141#define M32R_MFT2RLD_PORTL (0x0C+M32R_MFT2_OFFSET) /* MFT2 reload */
142#define M32R_MFT2CMPRLD_PORTL (0x10+M32R_MFT2_OFFSET) /* MFT2 compare reload */
143
144#define M32R_MFT3_OFFSET (0x400+M32R_MFT_OFFSET)
145#define M32R_MFT3MOD_PORTL (0x00+M32R_MFT3_OFFSET) /* MFT3 mode */
146#define M32R_MFT3BOS_PORTL (0x04+M32R_MFT3_OFFSET) /* MFT3 b-port output status */
147#define M32R_MFT3CUT_PORTL (0x08+M32R_MFT3_OFFSET) /* MFT3 count */
148#define M32R_MFT3RLD_PORTL (0x0C+M32R_MFT3_OFFSET) /* MFT3 reload */
149#define M32R_MFT3CMPRLD_PORTL (0x10+M32R_MFT3_OFFSET) /* MFT3 compare reload */
150
151#define M32R_MFT4_OFFSET (0x500+M32R_MFT_OFFSET)
152#define M32R_MFT4MOD_PORTL (0x00+M32R_MFT4_OFFSET) /* MFT4 mode */
153#define M32R_MFT4BOS_PORTL (0x04+M32R_MFT4_OFFSET) /* MFT4 b-port output status */
154#define M32R_MFT4CUT_PORTL (0x08+M32R_MFT4_OFFSET) /* MFT4 count */
155#define M32R_MFT4RLD_PORTL (0x0C+M32R_MFT4_OFFSET) /* MFT4 reload */
156#define M32R_MFT4CMPRLD_PORTL (0x10+M32R_MFT4_OFFSET) /* MFT4 compare reload */
157
158#define M32R_MFT5_OFFSET (0x600+M32R_MFT_OFFSET)
159#define M32R_MFT5MOD_PORTL (0x00+M32R_MFT5_OFFSET) /* MFT4 mode */
160#define M32R_MFT5BOS_PORTL (0x04+M32R_MFT5_OFFSET) /* MFT4 b-port output status */
161#define M32R_MFT5CUT_PORTL (0x08+M32R_MFT5_OFFSET) /* MFT4 count */
162#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */
163#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */
164
165#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */
166#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */
167#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */
168#define M32R_MFTCR_MFT3MSK (1UL<<12) /* b19 */
169#define M32R_MFTCR_MFT4MSK (1UL<<11) /* b20 */
170#define M32R_MFTCR_MFT5MSK (1UL<<10) /* b21 */
171#define M32R_MFTCR_MFT0EN (1UL<<7) /* b24 */
172#define M32R_MFTCR_MFT1EN (1UL<<6) /* b25 */
173#define M32R_MFTCR_MFT2EN (1UL<<5) /* b26 */
174#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */
175#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */
176#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */
177
178#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */
179#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */
180#define M32R_MFTMOD_GTSEL000 (0UL<<8) /* b21-23 : 000 */
181#define M32R_MFTMOD_GTSEL001 (1UL<<8) /* b21-23 : 001 */
182#define M32R_MFTMOD_GTSEL010 (2UL<<8) /* b21-23 : 010 */
183#define M32R_MFTMOD_GTSEL011 (3UL<<8) /* b21-23 : 011 */
184#define M32R_MFTMOD_GTSEL110 (6UL<<8) /* b21-23 : 110 */
185#define M32R_MFTMOD_GTSEL111 (7UL<<8) /* b21-23 : 111 */
186#define M32R_MFTMOD_CMSEL (1UL<<3) /* b28 */
187#define M32R_MFTMOD_CSSEL000 (0UL<<0) /* b29-b31 : 000 */
188#define M32R_MFTMOD_CSSEL001 (1UL<<0) /* b29-b31 : 001 */
189#define M32R_MFTMOD_CSSEL010 (2UL<<0) /* b29-b31 : 010 */
190#define M32R_MFTMOD_CSSEL011 (3UL<<0) /* b29-b31 : 011 */
191#define M32R_MFTMOD_CSSEL100 (4UL<<0) /* b29-b31 : 100 */
192#define M32R_MFTMOD_CSSEL110 (6UL<<0) /* b29-b31 : 110 */
193
194/*
195 * Serial I/O registers.
196 */
197#define M32R_SIO_OFFSET (0x000FD000+M32R_SFR_OFFSET)
198
199#define M32R_SIO0_CR_PORTL (0x000+M32R_SIO_OFFSET)
200#define M32R_SIO0_MOD0_PORTL (0x004+M32R_SIO_OFFSET)
201#define M32R_SIO0_MOD1_PORTL (0x008+M32R_SIO_OFFSET)
202#define M32R_SIO0_STS_PORTL (0x00C+M32R_SIO_OFFSET)
203#define M32R_SIO0_TRCR_PORTL (0x010+M32R_SIO_OFFSET)
204#define M32R_SIO0_BAUR_PORTL (0x014+M32R_SIO_OFFSET)
205#define M32R_SIO0_RBAUR_PORTL (0x018+M32R_SIO_OFFSET)
206#define M32R_SIO0_TXB_PORTL (0x01C+M32R_SIO_OFFSET)
207#define M32R_SIO0_RXB_PORTL (0x020+M32R_SIO_OFFSET)
208
209/*
210 * Interrupt Control Unit registers.
211 */
212#define M32R_ICU_OFFSET (0x000FF000+M32R_SFR_OFFSET)
213
214#define M32R_ICU_ISTS_PORTL (0x004+M32R_ICU_OFFSET)
215#define M32R_ICU_IREQ0_PORTL (0x008+M32R_ICU_OFFSET)
216#define M32R_ICU_IREQ1_PORTL (0x00C+M32R_ICU_OFFSET)
217#define M32R_ICU_SBICR_PORTL (0x018+M32R_ICU_OFFSET)
218#define M32R_ICU_IMASK_PORTL (0x01C+M32R_ICU_OFFSET)
219#define M32R_ICU_CR1_PORTL (0x200+M32R_ICU_OFFSET) /* INT0 */
220#define M32R_ICU_CR2_PORTL (0x204+M32R_ICU_OFFSET) /* INT1 */
221#define M32R_ICU_CR3_PORTL (0x208+M32R_ICU_OFFSET) /* INT2 */
222#define M32R_ICU_CR4_PORTL (0x20C+M32R_ICU_OFFSET) /* INT3 */
223#define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */
224#define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */
225#define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */
226#define M32R_ICU_CR8_PORTL (0x218+M32R_ICU_OFFSET) /* INT7 */
227#define M32R_ICU_CR32_PORTL (0x27C+M32R_ICU_OFFSET) /* SIO0 RX */
228#define M32R_ICU_CR33_PORTL (0x280+M32R_ICU_OFFSET) /* SIO0 TX */
229#define M32R_ICU_CR40_PORTL (0x29C+M32R_ICU_OFFSET) /* DMAC0 */
230#define M32R_ICU_CR41_PORTL (0x2A0+M32R_ICU_OFFSET) /* DMAC1 */
231#define M32R_ICU_CR48_PORTL (0x2BC+M32R_ICU_OFFSET) /* MFT0 */
232#define M32R_ICU_CR49_PORTL (0x2C0+M32R_ICU_OFFSET) /* MFT1 */
233#define M32R_ICU_CR50_PORTL (0x2C4+M32R_ICU_OFFSET) /* MFT2 */
234#define M32R_ICU_CR51_PORTL (0x2C8+M32R_ICU_OFFSET) /* MFT3 */
235#define M32R_ICU_CR52_PORTL (0x2CC+M32R_ICU_OFFSET) /* MFT4 */
236#define M32R_ICU_CR53_PORTL (0x2D0+M32R_ICU_OFFSET) /* MFT5 */
237#define M32R_ICU_IPICR0_PORTL (0x2DC+M32R_ICU_OFFSET) /* IPI0 */
238#define M32R_ICU_IPICR1_PORTL (0x2E0+M32R_ICU_OFFSET) /* IPI1 */
239#define M32R_ICU_IPICR2_PORTL (0x2E4+M32R_ICU_OFFSET) /* IPI2 */
240#define M32R_ICU_IPICR3_PORTL (0x2E8+M32R_ICU_OFFSET) /* IPI3 */
241#define M32R_ICU_IPICR4_PORTL (0x2EC+M32R_ICU_OFFSET) /* IPI4 */
242#define M32R_ICU_IPICR5_PORTL (0x2F0+M32R_ICU_OFFSET) /* IPI5 */
243#define M32R_ICU_IPICR6_PORTL (0x2F4+M32R_ICU_OFFSET) /* IPI6 */
244#define M32R_ICU_IPICR7_PORTL (0x2FC+M32R_ICU_OFFSET) /* IPI7 */
245
246#define M32R_ICUISTS_VECB(val) ((val>>28) & 0xF)
247#define M32R_ICUISTS_ISN(val) ((val>>22) & 0x3F)
248#define M32R_ICUISTS_PIML(val) ((val>>16) & 0x7)
249
250#define M32R_ICUIMASK_IMSK0 (0UL<<16) /* b13-b15: Disable interrupt */
251#define M32R_ICUIMASK_IMSK1 (1UL<<16) /* b13-b15: Enable level 0 interrupt */
252#define M32R_ICUIMASK_IMSK2 (2UL<<16) /* b13-b15: Enable level 0,1 interrupt */
253#define M32R_ICUIMASK_IMSK3 (3UL<<16) /* b13-b15: Enable level 0-2 interrupt */
254#define M32R_ICUIMASK_IMSK4 (4UL<<16) /* b13-b15: Enable level 0-3 interrupt */
255#define M32R_ICUIMASK_IMSK5 (5UL<<16) /* b13-b15: Enable level 0-4 interrupt */
256#define M32R_ICUIMASK_IMSK6 (6UL<<16) /* b13-b15: Enable level 0-5 interrupt */
257#define M32R_ICUIMASK_IMSK7 (7UL<<16) /* b13-b15: Enable level 0-6 interrupt */
258
259#define M32R_ICUCR_IEN (1UL<<12) /* b19: Interrupt enable */
260#define M32R_ICUCR_IRQ (1UL<<8) /* b23: Interrupt request */
261#define M32R_ICUCR_ISMOD00 (0UL<<4) /* b26-b27: Interrupt sense mode Edge HtoL */
262#define M32R_ICUCR_ISMOD01 (1UL<<4) /* b26-b27: Interrupt sense mode Level L */
263#define M32R_ICUCR_ISMOD10 (2UL<<4) /* b26-b27: Interrupt sense mode Edge LtoH*/
264#define M32R_ICUCR_ISMOD11 (3UL<<4) /* b26-b27: Interrupt sense mode Level H */
265#define M32R_ICUCR_ILEVEL0 (0UL<<0) /* b29-b31: Interrupt priority level 0 */
266#define M32R_ICUCR_ILEVEL1 (1UL<<0) /* b29-b31: Interrupt priority level 1 */
267#define M32R_ICUCR_ILEVEL2 (2UL<<0) /* b29-b31: Interrupt priority level 2 */
268#define M32R_ICUCR_ILEVEL3 (3UL<<0) /* b29-b31: Interrupt priority level 3 */
269#define M32R_ICUCR_ILEVEL4 (4UL<<0) /* b29-b31: Interrupt priority level 4 */
270#define M32R_ICUCR_ILEVEL5 (5UL<<0) /* b29-b31: Interrupt priority level 5 */
271#define M32R_ICUCR_ILEVEL6 (6UL<<0) /* b29-b31: Interrupt priority level 6 */
272#define M32R_ICUCR_ILEVEL7 (7UL<<0) /* b29-b31: Disable interrupt */
273#define M32R_ICUCR_ILEVEL_MASK (7UL)
274
275#define M32R_IRQ_INT0 (1) /* INT0 */
276#define M32R_IRQ_INT1 (2) /* INT1 */
277#define M32R_IRQ_INT2 (3) /* INT2 */
278#define M32R_IRQ_INT3 (4) /* INT3 */
279#define M32R_IRQ_INT4 (5) /* INT4 */
280#define M32R_IRQ_INT5 (6) /* INT5 */
281#define M32R_IRQ_INT6 (7) /* INT6 */
282#define M32R_IRQ_INT7 (8) /* INT7 */
283#define M32R_IRQ_MFT0 (16) /* MFT0 */
284#define M32R_IRQ_MFT1 (17) /* MFT1 */
285#define M32R_IRQ_MFT2 (18) /* MFT2 */
286#define M32R_IRQ_MFT3 (19) /* MFT3 */
287#define M32R_IRQ_MFT4 (20) /* MFT4 */
288#define M32R_IRQ_MFT5 (21) /* MFT5 */
289#define M32R_IRQ_DMAC0 (32) /* DMAC0 */
290#define M32R_IRQ_DMAC1 (33) /* DMAC1 */
291#define M32R_IRQ_SIO0_R (48) /* SIO0 receive */
292#define M32R_IRQ_SIO0_S (49) /* SIO0 send */
293#define M32R_IRQ_SIO1_R (50) /* SIO1 send */
294#define M32R_IRQ_SIO1_S (51) /* SIO1 receive */
295#define M32R_IRQ_IPI0 (56) /* IPI0 */
296#define M32R_IRQ_IPI1 (57) /* IPI1 */
297#define M32R_IRQ_IPI2 (58) /* IPI2 */
298#define M32R_IRQ_IPI3 (59) /* IPI3 */
299#define M32R_IRQ_IPI4 (60) /* IPI4 */
300#define M32R_IRQ_IPI5 (61) /* IPI5 */
301#define M32R_IRQ_IPI6 (62) /* IPI6 */
302#define M32R_IRQ_IPI7 (63) /* IPI7 */
303
304/*======================================================================*
305 * CPU
306 *======================================================================*/
307
308#define M32R_CPUID_PORTL (0xFFFFFFE0)
309#define M32R_MCICAR_PORTL (0xFFFFFFF0)
310#define M32R_MCDCAR_PORTL (0xFFFFFFF4)
311#define M32R_MCCR_PORTL (0xFFFFFFFC)
312
313#endif /* _ASM_M32R_M32R_MP_FPGA_ */
diff --git a/include/asm-m32r/mappi2/mappi2_pld.h b/include/asm-m32r/mappi2/mappi2_pld.h
deleted file mode 100644
index 2624c9db7255..000000000000
--- a/include/asm-m32r/mappi2/mappi2_pld.h
+++ /dev/null
@@ -1,150 +0,0 @@
1#ifndef _MAPPI2_PLD_H
2#define _MAPPI2_PLD_H
3
4/*
5 * include/asm-m32r/mappi2/mappi2_pld.h
6 *
7 * Definitions for Extended IO Logic on MAPPI2 board.
8 * based on m32700ut_pld.h
9 *
10 * This file is subject to the terms and conditions of the GNU General
11 * Public License. See the file "COPYING" in the main directory of
12 * this archive for more details.
13 */
14
15#ifndef __ASSEMBLY__
16/* FIXME:
17 * Some C functions use non-cache address, so can't define non-cache address.
18 */
19#define PLD_BASE (0x10c00000 /* + NONCACHE_OFFSET */)
20#define __reg8 (volatile unsigned char *)
21#define __reg16 (volatile unsigned short *)
22#define __reg32 (volatile unsigned int *)
23#else
24#define PLD_BASE (0x10c00000 + NONCACHE_OFFSET)
25#define __reg8
26#define __reg16
27#define __reg32
28#endif /* __ASSEMBLY__ */
29
30/* CFC */
31#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
32#define PLD_CFSTS __reg16(PLD_BASE + 0x0002)
33#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004)
34#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006)
35#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a)
36#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c)
37
38/* MMC */
39#define PLD_MMCCR __reg16(PLD_BASE + 0x4000)
40#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002)
41#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006)
42#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a)
43#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c)
44#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e)
45#define PLD_MMCDET __reg16(PLD_BASE + 0x4010)
46#define PLD_MMCWP __reg16(PLD_BASE + 0x4012)
47#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000)
48#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000)
49#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000)
50#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006)
51
52/* Power Control of MMC and CF */
53#define PLD_CPCR __reg16(PLD_BASE + 0x14000)
54
55
56/*==== ICU ====*/
57#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */
58#define M32R_IRQ_I2C (28) /* I2C-BUS */
59#if 1
60#define PLD_IRQ_CFIREQ (40) /* CFC Card Interrupt */
61#define PLD_IRQ_CFC_INSERT (41) /* CFC Card Insert */
62#define PLD_IRQ_CFC_EJECT (42) /* CFC Card Eject */
63#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */
64#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */
65#else
66#define PLD_IRQ_CFIREQ (34) /* CFC Card Interrupt */
67#define PLD_IRQ_CFC_INSERT (35) /* CFC Card Insert */
68#define PLD_IRQ_CFC_EJECT (36) /* CFC Card Eject */
69#define PLD_IRQ_MMCCARD (37) /* MMC Card Insert */
70#define PLD_IRQ_MMCIRQ (38) /* MMC Transfer Done */
71#endif
72
73
74#if 0
75/* LED Control
76 *
77 * 1: DIP swich side
78 * 2: Reset switch side
79 */
80#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002)
81#define PLD_IOLED_1_ON 0x001
82#define PLD_IOLED_1_OFF 0x000
83#define PLD_IOLED_2_ON 0x002
84#define PLD_IOLED_2_OFF 0x000
85
86/* DIP Switch
87 * 0: Write-protect of Flash Memory (0:protected, 1:non-protected)
88 * 1: -
89 * 2: -
90 * 3: -
91 */
92#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004)
93#define PLD_IOSWSTS_IOSW2 0x0200
94#define PLD_IOSWSTS_IOSW1 0x0100
95#define PLD_IOSWSTS_IOWP0 0x0001
96
97#endif
98
99/* CRC */
100#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000)
101#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002)
102#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004)
103#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006)
104#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008)
105#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a)
106
107
108#if 0
109/* RTC */
110#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000)
111#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002)
112#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004)
113#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006)
114#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008)
115
116/* SIO0 */
117#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000)
118#define PLD_ESIO0CR_TXEN 0x0001
119#define PLD_ESIO0CR_RXEN 0x0002
120#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002)
121#define PLD_ESIO0MOD0_CTSS 0x0040
122#define PLD_ESIO0MOD0_RTSS 0x0080
123#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004)
124#define PLD_ESIO0MOD1_LMFS 0x0010
125#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006)
126#define PLD_ESIO0STS_TEMP 0x0001
127#define PLD_ESIO0STS_TXCP 0x0002
128#define PLD_ESIO0STS_RXCP 0x0004
129#define PLD_ESIO0STS_TXSC 0x0100
130#define PLD_ESIO0STS_RXSC 0x0200
131#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP)
132#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008)
133#define PLD_ESIO0INTCR_TXIEN 0x0002
134#define PLD_ESIO0INTCR_RXCEN 0x0004
135#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a)
136#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c)
137#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e)
138
139/* SIM Card */
140#define PLD_SCCR __reg16(PLD_BASE + 0x38000)
141#define PLD_SCMOD __reg16(PLD_BASE + 0x38004)
142#define PLD_SCSTS __reg16(PLD_BASE + 0x38006)
143#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008)
144#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a)
145#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
146#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
147
148#endif
149
150#endif /* _MAPPI2_PLD.H */
diff --git a/include/asm-m32r/mappi3/mappi3_pld.h b/include/asm-m32r/mappi3/mappi3_pld.h
deleted file mode 100644
index 451c40ee70af..000000000000
--- a/include/asm-m32r/mappi3/mappi3_pld.h
+++ /dev/null
@@ -1,142 +0,0 @@
1#ifndef _MAPPI3_PLD_H
2#define _MAPPI3_PLD_H
3
4/*
5 * include/asm-m32r/mappi3/mappi3_pld.h
6 *
7 * Definitions for Extended IO Logic on MAPPI3 board.
8 * based on m32700ut_pld.h
9 *
10 * This file is subject to the terms and conditions of the GNU General
11 * Public License. See the file "COPYING" in the main directory of
12 * this archive for more details.
13 */
14
15#ifndef __ASSEMBLY__
16/* FIXME:
17 * Some C functions use non-cache address, so can't define non-cache address.
18 */
19#define PLD_BASE (0x1c000000 /* + NONCACHE_OFFSET */)
20#define __reg8 (volatile unsigned char *)
21#define __reg16 (volatile unsigned short *)
22#define __reg32 (volatile unsigned int *)
23#else
24#define PLD_BASE (0x1c000000 + NONCACHE_OFFSET)
25#define __reg8
26#define __reg16
27#define __reg32
28#endif /* __ASSEMBLY__ */
29
30/* CFC */
31#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
32#define PLD_CFSTS __reg16(PLD_BASE + 0x0002)
33#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004)
34#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006)
35#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a)
36#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c)
37
38/* MMC */
39#define PLD_MMCCR __reg16(PLD_BASE + 0x4000)
40#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002)
41#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006)
42#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a)
43#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c)
44#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e)
45#define PLD_MMCDET __reg16(PLD_BASE + 0x4010)
46#define PLD_MMCWP __reg16(PLD_BASE + 0x4012)
47#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000)
48#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000)
49#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000)
50#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006)
51
52/* Power Control of MMC and CF */
53#define PLD_CPCR __reg16(PLD_BASE + 0x14000)
54
55/* ICU */
56#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */
57#define M32R_IRQ_I2C (28) /* I2C-BUS */
58#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */
59#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert & Eject */
60#define PLD_IRQ_IDEIREQ (8) /* INT7 IDE Interrupt */
61#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */
62#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */
63
64#if 0
65/* LED Control
66 *
67 * 1: DIP swich side
68 * 2: Reset switch side
69 */
70#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002)
71#define PLD_IOLED_1_ON 0x001
72#define PLD_IOLED_1_OFF 0x000
73#define PLD_IOLED_2_ON 0x002
74#define PLD_IOLED_2_OFF 0x000
75
76/* DIP Switch
77 * 0: Write-protect of Flash Memory (0:protected, 1:non-protected)
78 * 1: -
79 * 2: -
80 * 3: -
81 */
82#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004)
83#define PLD_IOSWSTS_IOSW2 0x0200
84#define PLD_IOSWSTS_IOSW1 0x0100
85#define PLD_IOSWSTS_IOWP0 0x0001
86
87#endif
88
89/* CRC */
90#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000)
91#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002)
92#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004)
93#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006)
94#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008)
95#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a)
96
97#if 0
98/* RTC */
99#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000)
100#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002)
101#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004)
102#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006)
103#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008)
104
105/* SIO0 */
106#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000)
107#define PLD_ESIO0CR_TXEN 0x0001
108#define PLD_ESIO0CR_RXEN 0x0002
109#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002)
110#define PLD_ESIO0MOD0_CTSS 0x0040
111#define PLD_ESIO0MOD0_RTSS 0x0080
112#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004)
113#define PLD_ESIO0MOD1_LMFS 0x0010
114#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006)
115#define PLD_ESIO0STS_TEMP 0x0001
116#define PLD_ESIO0STS_TXCP 0x0002
117#define PLD_ESIO0STS_RXCP 0x0004
118#define PLD_ESIO0STS_TXSC 0x0100
119#define PLD_ESIO0STS_RXSC 0x0200
120#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP)
121#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008)
122#define PLD_ESIO0INTCR_TXIEN 0x0002
123#define PLD_ESIO0INTCR_RXCEN 0x0004
124#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a)
125#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c)
126#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e)
127
128/* SIM Card */
129#define PLD_SCCR __reg16(PLD_BASE + 0x38000)
130#define PLD_SCMOD __reg16(PLD_BASE + 0x38004)
131#define PLD_SCSTS __reg16(PLD_BASE + 0x38006)
132#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008)
133#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a)
134#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
135#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
136
137#endif
138
139/* Reset Control */
140#define PLD_REBOOT __reg16(PLD_BASE + 0x38000)
141
142#endif /* _MAPPI3_PLD.H */
diff --git a/include/asm-m32r/mc146818rtc.h b/include/asm-m32r/mc146818rtc.h
deleted file mode 100644
index aa1b7bf84f51..000000000000
--- a/include/asm-m32r/mc146818rtc.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Machine dependent access functions for RTC registers.
3 */
4#ifndef _ASM_MC146818RTC_H
5#define _ASM_MC146818RTC_H
6
7#include <asm/io.h>
8
9#ifndef RTC_PORT
10#define RTC_PORT(x) ((x))
11#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
12#endif
13
14/*
15 * The yet supported machines all access the RTC index register via
16 * an ISA port access but the way to access the date register differs ...
17 */
18#define CMOS_READ(addr) ({ \
19outb_p((addr),RTC_PORT(0)); \
20inb_p(RTC_PORT(1)); \
21})
22#define CMOS_WRITE(val, addr) ({ \
23outb_p((addr),RTC_PORT(0)); \
24outb_p((val),RTC_PORT(1)); \
25})
26
27#define RTC_IRQ 8
28
29#endif /* _ASM_MC146818RTC_H */
diff --git a/include/asm-m32r/mman.h b/include/asm-m32r/mman.h
deleted file mode 100644
index 516a8973b130..000000000000
--- a/include/asm-m32r/mman.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __M32R_MMAN_H__
2#define __M32R_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 /* __M32R_MMAN_H__ */
diff --git a/include/asm-m32r/mmu.h b/include/asm-m32r/mmu.h
deleted file mode 100644
index 150cb92bb666..000000000000
--- a/include/asm-m32r/mmu.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _ASM_M32R_MMU_H
2#define _ASM_M32R_MMU_H
3
4#if !defined(CONFIG_MMU)
5
6typedef struct {
7 unsigned long end_brk;
8} mm_context_t;
9
10#else /* CONFIG_MMU */
11
12/* Default "unsigned long" context */
13#ifndef CONFIG_SMP
14typedef unsigned long mm_context_t;
15#else
16typedef unsigned long mm_context_t[NR_CPUS];
17#endif
18
19#endif /* CONFIG_MMU */
20
21#endif /* _ASM_M32R_MMU_H */
diff --git a/include/asm-m32r/mmu_context.h b/include/asm-m32r/mmu_context.h
deleted file mode 100644
index 91909e5dd9d0..000000000000
--- a/include/asm-m32r/mmu_context.h
+++ /dev/null
@@ -1,164 +0,0 @@
1#ifndef _ASM_M32R_MMU_CONTEXT_H
2#define _ASM_M32R_MMU_CONTEXT_H
3#ifdef __KERNEL__
4
5#include <asm/m32r.h>
6
7#define MMU_CONTEXT_ASID_MASK (0x000000FF)
8#define MMU_CONTEXT_VERSION_MASK (0xFFFFFF00)
9#define MMU_CONTEXT_FIRST_VERSION (0x00000100)
10#define NO_CONTEXT (0x00000000)
11
12#ifndef __ASSEMBLY__
13
14#include <asm/atomic.h>
15#include <asm/pgalloc.h>
16#include <asm/mmu.h>
17#include <asm/tlbflush.h>
18#include <asm-generic/mm_hooks.h>
19
20/*
21 * Cache of MMU context last used.
22 */
23#ifndef CONFIG_SMP
24extern unsigned long mmu_context_cache_dat;
25#define mmu_context_cache mmu_context_cache_dat
26#define mm_context(mm) mm->context
27#else /* not CONFIG_SMP */
28extern unsigned long mmu_context_cache_dat[];
29#define mmu_context_cache mmu_context_cache_dat[smp_processor_id()]
30#define mm_context(mm) mm->context[smp_processor_id()]
31#endif /* not CONFIG_SMP */
32
33#define set_tlb_tag(entry, tag) (*entry = (tag & PAGE_MASK)|get_asid())
34#define set_tlb_data(entry, data) (*entry = (data | _PAGE_PRESENT))
35
36#ifdef CONFIG_MMU
37#define enter_lazy_tlb(mm, tsk) do { } while (0)
38
39static inline void get_new_mmu_context(struct mm_struct *mm)
40{
41 unsigned long mc = ++mmu_context_cache;
42
43 if (!(mc & MMU_CONTEXT_ASID_MASK)) {
44 /* We exhaust ASID of this version.
45 Flush all TLB and start new cycle. */
46 local_flush_tlb_all();
47 /* Fix version if needed.
48 Note that we avoid version #0 to distingush NO_CONTEXT. */
49 if (!mc)
50 mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION;
51 }
52 mm_context(mm) = mc;
53}
54
55/*
56 * Get MMU context if needed.
57 */
58static inline void get_mmu_context(struct mm_struct *mm)
59{
60 if (mm) {
61 unsigned long mc = mmu_context_cache;
62
63 /* Check if we have old version of context.
64 If it's old, we need to get new context with new version. */
65 if ((mm_context(mm) ^ mc) & MMU_CONTEXT_VERSION_MASK)
66 get_new_mmu_context(mm);
67 }
68}
69
70/*
71 * Initialize the context related info for a new mm_struct
72 * instance.
73 */
74static inline int init_new_context(struct task_struct *tsk,
75 struct mm_struct *mm)
76{
77#ifndef CONFIG_SMP
78 mm->context = NO_CONTEXT;
79#else /* CONFIG_SMP */
80 int num_cpus = num_online_cpus();
81 int i;
82
83 for (i = 0 ; i < num_cpus ; i++)
84 mm->context[i] = NO_CONTEXT;
85#endif /* CONFIG_SMP */
86
87 return 0;
88}
89
90/*
91 * Destroy context related info for an mm_struct that is about
92 * to be put to rest.
93 */
94#define destroy_context(mm) do { } while (0)
95
96static inline void set_asid(unsigned long asid)
97{
98 *(volatile unsigned long *)MASID = (asid & MMU_CONTEXT_ASID_MASK);
99}
100
101static inline unsigned long get_asid(void)
102{
103 unsigned long asid;
104
105 asid = *(volatile long *)MASID;
106 asid &= MMU_CONTEXT_ASID_MASK;
107
108 return asid;
109}
110
111/*
112 * After we have set current->mm to a new value, this activates
113 * the context for the new mm so we see the new mappings.
114 */
115static inline void activate_context(struct mm_struct *mm)
116{
117 get_mmu_context(mm);
118 set_asid(mm_context(mm) & MMU_CONTEXT_ASID_MASK);
119}
120
121static inline void switch_mm(struct mm_struct *prev,
122 struct mm_struct *next, struct task_struct *tsk)
123{
124#ifdef CONFIG_SMP
125 int cpu = smp_processor_id();
126#endif /* CONFIG_SMP */
127
128 if (prev != next) {
129#ifdef CONFIG_SMP
130 cpu_set(cpu, next->cpu_vm_mask);
131#endif /* CONFIG_SMP */
132 /* Set MPTB = next->pgd */
133 *(volatile unsigned long *)MPTB = (unsigned long)next->pgd;
134 activate_context(next);
135 }
136#ifdef CONFIG_SMP
137 else
138 if (!cpu_test_and_set(cpu, next->cpu_vm_mask))
139 activate_context(next);
140#endif /* CONFIG_SMP */
141}
142
143#define deactivate_mm(tsk, mm) do { } while (0)
144
145#define activate_mm(prev, next) \
146 switch_mm((prev), (next), NULL)
147
148#else /* not CONFIG_MMU */
149#define get_mmu_context(mm) do { } while (0)
150#define init_new_context(tsk,mm) (0)
151#define destroy_context(mm) do { } while (0)
152#define set_asid(asid) do { } while (0)
153#define get_asid() (0)
154#define activate_context(mm) do { } while (0)
155#define switch_mm(prev,next,tsk) do { } while (0)
156#define deactivate_mm(mm,tsk) do { } while (0)
157#define activate_mm(prev,next) do { } while (0)
158#define enter_lazy_tlb(mm,tsk) do { } while (0)
159#endif /* not CONFIG_MMU */
160
161#endif /* not __ASSEMBLY__ */
162
163#endif /* __KERNEL__ */
164#endif /* _ASM_M32R_MMU_CONTEXT_H */
diff --git a/include/asm-m32r/mmzone.h b/include/asm-m32r/mmzone.h
deleted file mode 100644
index 9f3b5accda88..000000000000
--- a/include/asm-m32r/mmzone.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002
3 *
4 */
5
6#ifndef _ASM_MMZONE_H_
7#define _ASM_MMZONE_H_
8
9#include <asm/smp.h>
10
11#ifdef CONFIG_DISCONTIGMEM
12
13extern struct pglist_data *node_data[];
14#define NODE_DATA(nid) (node_data[nid])
15
16#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn)
17#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
18#define node_end_pfn(nid) \
19({ \
20 pg_data_t *__pgdat = NODE_DATA(nid); \
21 __pgdat->node_start_pfn + __pgdat->node_spanned_pages - 1; \
22})
23
24#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
25/*
26 * pfn_valid should be made as fast as possible, and the current definition
27 * is valid for machines that are NUMA, but still contiguous, which is what
28 * is currently supported. A more generalised, but slower definition would
29 * be something like this - mbligh:
30 * ( pfn_to_pgdat(pfn) && ((pfn) < node_end_pfn(pfn_to_nid(pfn))) )
31 */
32#if 1 /* M32R_FIXME */
33#define pfn_valid(pfn) (1)
34#else
35#define pfn_valid(pfn) ((pfn) < num_physpages)
36#endif
37
38/*
39 * generic node memory support, the following assumptions apply:
40 */
41
42static __inline__ int pfn_to_nid(unsigned long pfn)
43{
44 int node;
45
46 for (node = 0 ; node < MAX_NUMNODES ; node++)
47 if (pfn >= node_start_pfn(node) && pfn <= node_end_pfn(node))
48 break;
49
50 return node;
51}
52
53static __inline__ struct pglist_data *pfn_to_pgdat(unsigned long pfn)
54{
55 return(NODE_DATA(pfn_to_nid(pfn)));
56}
57
58#endif /* CONFIG_DISCONTIGMEM */
59#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-m32r/module.h b/include/asm-m32r/module.h
deleted file mode 100644
index eb73ee011215..000000000000
--- a/include/asm-m32r/module.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _ASM_M32R_MODULE_H
2#define _ASM_M32R_MODULE_H
3
4struct mod_arch_specific { };
5
6#define Elf_Shdr Elf32_Shdr
7#define Elf_Sym Elf32_Sym
8#define Elf_Ehdr Elf32_Ehdr
9
10#endif /* _ASM_M32R_MODULE_H */
diff --git a/include/asm-m32r/msgbuf.h b/include/asm-m32r/msgbuf.h
deleted file mode 100644
index 0d5a877b813e..000000000000
--- a/include/asm-m32r/msgbuf.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _ASM_M32R_MSGBUF_H
2#define _ASM_M32R_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for m32r 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_M32R_MSGBUF_H */
diff --git a/include/asm-m32r/mutex.h b/include/asm-m32r/mutex.h
deleted file mode 100644
index 458c1f7fbc18..000000000000
--- a/include/asm-m32r/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-m32r/opsput/opsput_lan.h b/include/asm-m32r/opsput/opsput_lan.h
deleted file mode 100644
index a5f18dd1ab20..000000000000
--- a/include/asm-m32r/opsput/opsput_lan.h
+++ /dev/null
@@ -1,52 +0,0 @@
1#ifndef _OPSPUT_OPSPUT_LAN_H
2#define _OPSPUT_OPSPUT_LAN_H
3
4/*
5 * include/asm-m32r/opsput/opsput_lan.h
6 *
7 * OPSPUT-LAN board
8 *
9 * Copyright (c) 2002-2004 Takeo Takahashi, Mamoru Sakugawa
10 *
11 * This file is subject to the terms and conditions of the GNU General
12 * Public License. See the file "COPYING" in the main directory of
13 * this archive for more details.
14 */
15
16#ifndef __ASSEMBLY__
17/*
18 * C functions use non-cache address.
19 */
20#define OPSPUT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */)
21#else
22#define OPSPUT_LAN_BASE (0x10000000 + NONCACHE_OFFSET)
23#endif /* __ASSEMBLY__ */
24
25/* ICU
26 * ICUISTS: status register
27 * ICUIREQ0: request register
28 * ICUIREQ1: request register
29 * ICUCR3: control register for CFIREQ# interrupt
30 * ICUCR4: control register for CFC Card insert interrupt
31 * ICUCR5: control register for CFC Card eject interrupt
32 * ICUCR6: control register for external interrupt
33 * ICUCR11: control register for MMC Card insert/eject interrupt
34 * ICUCR13: control register for SC error interrupt
35 * ICUCR14: control register for SC receive interrupt
36 * ICUCR15: control register for SC send interrupt
37 * ICUCR16: control register for SIO0 receive interrupt
38 * ICUCR17: control register for SIO0 send interrupt
39 */
40#define OPSPUT_LAN_IRQ_LAN (OPSPUT_LAN_PLD_IRQ_BASE + 1) /* LAN */
41#define OPSPUT_LAN_IRQ_I2C (OPSPUT_LAN_PLD_IRQ_BASE + 3) /* I2C */
42
43#define OPSPUT_LAN_ICUISTS __reg16(OPSPUT_LAN_BASE + 0xc0002)
44#define OPSPUT_LAN_ICUISTS_VECB_MASK (0xf000)
45#define OPSPUT_LAN_VECB(x) ((x) & OPSPUT_LAN_ICUISTS_VECB_MASK)
46#define OPSPUT_LAN_ICUISTS_ISN_MASK (0x07c0)
47#define OPSPUT_LAN_ICUISTS_ISN(x) ((x) & OPSPUT_LAN_ICUISTS_ISN_MASK)
48#define OPSPUT_LAN_ICUIREQ0 __reg16(OPSPUT_LAN_BASE + 0xc0004)
49#define OPSPUT_LAN_ICUCR1 __reg16(OPSPUT_LAN_BASE + 0xc0010)
50#define OPSPUT_LAN_ICUCR3 __reg16(OPSPUT_LAN_BASE + 0xc0014)
51
52#endif /* _OPSPUT_OPSPUT_LAN_H */
diff --git a/include/asm-m32r/opsput/opsput_lcd.h b/include/asm-m32r/opsput/opsput_lcd.h
deleted file mode 100644
index 369c9f0832a6..000000000000
--- a/include/asm-m32r/opsput/opsput_lcd.h
+++ /dev/null
@@ -1,55 +0,0 @@
1#ifndef _OPSPUT_OPSPUT_LCD_H
2#define _OPSPUT_OPSPUT_LCD_H
3
4/*
5 * include/asm-m32r/opsput/opsput_lcd.h
6 *
7 * OPSPUT-LCD board
8 *
9 * Copyright (c) 2002 Takeo Takahashi
10 *
11 * This file is subject to the terms and conditions of the GNU General
12 * Public License. See the file "COPYING" in the main directory of
13 * this archive for more details.
14 */
15
16#ifndef __ASSEMBLY__
17/*
18 * C functions use non-cache address.
19 */
20#define OPSPUT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */)
21#else
22#define OPSPUT_LCD_BASE (0x10000000 + NONCACHE_OFFSET)
23#endif /* __ASSEMBLY__ */
24
25/*
26 * ICU
27 */
28#define OPSPUT_LCD_IRQ_BAT_INT (OPSPUT_LCD_PLD_IRQ_BASE + 1)
29#define OPSPUT_LCD_IRQ_USB_INT1 (OPSPUT_LCD_PLD_IRQ_BASE + 2)
30#define OPSPUT_LCD_IRQ_AUDT0 (OPSPUT_LCD_PLD_IRQ_BASE + 3)
31#define OPSPUT_LCD_IRQ_AUDT2 (OPSPUT_LCD_PLD_IRQ_BASE + 4)
32#define OPSPUT_LCD_IRQ_BATSIO_RCV (OPSPUT_LCD_PLD_IRQ_BASE + 16)
33#define OPSPUT_LCD_IRQ_BATSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 17)
34#define OPSPUT_LCD_IRQ_ASNDSIO_RCV (OPSPUT_LCD_PLD_IRQ_BASE + 18)
35#define OPSPUT_LCD_IRQ_ASNDSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 19)
36#define OPSPUT_LCD_IRQ_ACNLSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 21)
37
38#define OPSPUT_LCD_ICUISTS __reg16(OPSPUT_LCD_BASE + 0x300002)
39#define OPSPUT_LCD_ICUISTS_VECB_MASK (0xf000)
40#define OPSPUT_LCD_VECB(x) ((x) & OPSPUT_LCD_ICUISTS_VECB_MASK)
41#define OPSPUT_LCD_ICUISTS_ISN_MASK (0x07c0)
42#define OPSPUT_LCD_ICUISTS_ISN(x) ((x) & OPSPUT_LCD_ICUISTS_ISN_MASK)
43#define OPSPUT_LCD_ICUIREQ0 __reg16(OPSPUT_LCD_BASE + 0x300004)
44#define OPSPUT_LCD_ICUIREQ1 __reg16(OPSPUT_LCD_BASE + 0x300006)
45#define OPSPUT_LCD_ICUCR1 __reg16(OPSPUT_LCD_BASE + 0x300020)
46#define OPSPUT_LCD_ICUCR2 __reg16(OPSPUT_LCD_BASE + 0x300022)
47#define OPSPUT_LCD_ICUCR3 __reg16(OPSPUT_LCD_BASE + 0x300024)
48#define OPSPUT_LCD_ICUCR4 __reg16(OPSPUT_LCD_BASE + 0x300026)
49#define OPSPUT_LCD_ICUCR16 __reg16(OPSPUT_LCD_BASE + 0x300030)
50#define OPSPUT_LCD_ICUCR17 __reg16(OPSPUT_LCD_BASE + 0x300032)
51#define OPSPUT_LCD_ICUCR18 __reg16(OPSPUT_LCD_BASE + 0x300034)
52#define OPSPUT_LCD_ICUCR19 __reg16(OPSPUT_LCD_BASE + 0x300036)
53#define OPSPUT_LCD_ICUCR21 __reg16(OPSPUT_LCD_BASE + 0x30003a)
54
55#endif /* _OPSPUT_OPSPUT_LCD_H */
diff --git a/include/asm-m32r/opsput/opsput_pld.h b/include/asm-m32r/opsput/opsput_pld.h
deleted file mode 100644
index 3f11ea1aac2d..000000000000
--- a/include/asm-m32r/opsput/opsput_pld.h
+++ /dev/null
@@ -1,255 +0,0 @@
1#ifndef _OPSPUT_OPSPUT_PLD_H
2#define _OPSPUT_OPSPUT_PLD_H
3
4/*
5 * include/asm-m32r/opsput/opsput_pld.h
6 *
7 * Definitions for Programable Logic Device(PLD) on OPSPUT board.
8 *
9 * Copyright (c) 2002 Takeo Takahashi
10 *
11 * This file is subject to the terms and conditions of the GNU General
12 * Public License. See the file "COPYING" in the main directory of
13 * this archive for more details.
14 */
15
16#define PLD_PLAT_BASE 0x1cc00000
17
18#ifndef __ASSEMBLY__
19/*
20 * C functions use non-cache address.
21 */
22#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */)
23#define __reg8 (volatile unsigned char *)
24#define __reg16 (volatile unsigned short *)
25#define __reg32 (volatile unsigned int *)
26#else
27#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET)
28#define __reg8
29#define __reg16
30#define __reg32
31#endif /* __ASSEMBLY__ */
32
33/* CFC */
34#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
35#define PLD_CFSTS __reg16(PLD_BASE + 0x0002)
36#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004)
37#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006)
38#define PLD_CFVENCR __reg16(PLD_BASE + 0x0008)
39#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a)
40#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c)
41#define PLD_IDERSTCR __reg16(PLD_BASE + 0x0010)
42
43/* MMC */
44#define PLD_MMCCR __reg16(PLD_BASE + 0x4000)
45#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002)
46#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006)
47#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a)
48#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c)
49#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e)
50#define PLD_MMCDET __reg16(PLD_BASE + 0x4010)
51#define PLD_MMCWP __reg16(PLD_BASE + 0x4012)
52#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000)
53#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000)
54#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000)
55#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006)
56
57/* ICU
58 * ICUISTS: status register
59 * ICUIREQ0: request register
60 * ICUIREQ1: request register
61 * ICUCR3: control register for CFIREQ# interrupt
62 * ICUCR4: control register for CFC Card insert interrupt
63 * ICUCR5: control register for CFC Card eject interrupt
64 * ICUCR6: control register for external interrupt
65 * ICUCR11: control register for MMC Card insert/eject interrupt
66 * ICUCR13: control register for SC error interrupt
67 * ICUCR14: control register for SC receive interrupt
68 * ICUCR15: control register for SC send interrupt
69 * ICUCR16: control register for SIO0 receive interrupt
70 * ICUCR17: control register for SIO0 send interrupt
71 */
72#if !defined(CONFIG_PLAT_USRV)
73#define PLD_IRQ_INT0 (OPSPUT_PLD_IRQ_BASE + 0) /* None */
74#define PLD_IRQ_INT1 (OPSPUT_PLD_IRQ_BASE + 1) /* reserved */
75#define PLD_IRQ_INT2 (OPSPUT_PLD_IRQ_BASE + 2) /* reserved */
76#define PLD_IRQ_CFIREQ (OPSPUT_PLD_IRQ_BASE + 3) /* CF IREQ */
77#define PLD_IRQ_CFC_INSERT (OPSPUT_PLD_IRQ_BASE + 4) /* CF Insert */
78#define PLD_IRQ_CFC_EJECT (OPSPUT_PLD_IRQ_BASE + 5) /* CF Eject */
79#define PLD_IRQ_EXINT (OPSPUT_PLD_IRQ_BASE + 6) /* EXINT */
80#define PLD_IRQ_INT7 (OPSPUT_PLD_IRQ_BASE + 7) /* reserved */
81#define PLD_IRQ_INT8 (OPSPUT_PLD_IRQ_BASE + 8) /* reserved */
82#define PLD_IRQ_INT9 (OPSPUT_PLD_IRQ_BASE + 9) /* reserved */
83#define PLD_IRQ_INT10 (OPSPUT_PLD_IRQ_BASE + 10) /* reserved */
84#define PLD_IRQ_MMCCARD (OPSPUT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */
85#define PLD_IRQ_INT12 (OPSPUT_PLD_IRQ_BASE + 12) /* reserved */
86#define PLD_IRQ_SC_ERROR (OPSPUT_PLD_IRQ_BASE + 13) /* SC error */
87#define PLD_IRQ_SC_RCV (OPSPUT_PLD_IRQ_BASE + 14) /* SC receive */
88#define PLD_IRQ_SC_SND (OPSPUT_PLD_IRQ_BASE + 15) /* SC send */
89#define PLD_IRQ_SIO0_RCV (OPSPUT_PLD_IRQ_BASE + 16) /* SIO receive */
90#define PLD_IRQ_SIO0_SND (OPSPUT_PLD_IRQ_BASE + 17) /* SIO send */
91#define PLD_IRQ_INT18 (OPSPUT_PLD_IRQ_BASE + 18) /* reserved */
92#define PLD_IRQ_INT19 (OPSPUT_PLD_IRQ_BASE + 19) /* reserved */
93#define PLD_IRQ_INT20 (OPSPUT_PLD_IRQ_BASE + 20) /* reserved */
94#define PLD_IRQ_INT21 (OPSPUT_PLD_IRQ_BASE + 21) /* reserved */
95#define PLD_IRQ_INT22 (OPSPUT_PLD_IRQ_BASE + 22) /* reserved */
96#define PLD_IRQ_INT23 (OPSPUT_PLD_IRQ_BASE + 23) /* reserved */
97#define PLD_IRQ_INT24 (OPSPUT_PLD_IRQ_BASE + 24) /* reserved */
98#define PLD_IRQ_INT25 (OPSPUT_PLD_IRQ_BASE + 25) /* reserved */
99#define PLD_IRQ_INT26 (OPSPUT_PLD_IRQ_BASE + 26) /* reserved */
100#define PLD_IRQ_INT27 (OPSPUT_PLD_IRQ_BASE + 27) /* reserved */
101#define PLD_IRQ_INT28 (OPSPUT_PLD_IRQ_BASE + 28) /* reserved */
102#define PLD_IRQ_INT29 (OPSPUT_PLD_IRQ_BASE + 29) /* reserved */
103#define PLD_IRQ_INT30 (OPSPUT_PLD_IRQ_BASE + 30) /* reserved */
104#define PLD_IRQ_INT31 (OPSPUT_PLD_IRQ_BASE + 31) /* reserved */
105
106#else /* CONFIG_PLAT_USRV */
107
108#define PLD_IRQ_INT0 (OPSPUT_PLD_IRQ_BASE + 0) /* None */
109#define PLD_IRQ_INT1 (OPSPUT_PLD_IRQ_BASE + 1) /* reserved */
110#define PLD_IRQ_INT2 (OPSPUT_PLD_IRQ_BASE + 2) /* reserved */
111#define PLD_IRQ_CF0 (OPSPUT_PLD_IRQ_BASE + 3) /* CF0# */
112#define PLD_IRQ_CF1 (OPSPUT_PLD_IRQ_BASE + 4) /* CF1# */
113#define PLD_IRQ_CF2 (OPSPUT_PLD_IRQ_BASE + 5) /* CF2# */
114#define PLD_IRQ_CF3 (OPSPUT_PLD_IRQ_BASE + 6) /* CF3# */
115#define PLD_IRQ_CF4 (OPSPUT_PLD_IRQ_BASE + 7) /* CF4# */
116#define PLD_IRQ_INT8 (OPSPUT_PLD_IRQ_BASE + 8) /* reserved */
117#define PLD_IRQ_INT9 (OPSPUT_PLD_IRQ_BASE + 9) /* reserved */
118#define PLD_IRQ_INT10 (OPSPUT_PLD_IRQ_BASE + 10) /* reserved */
119#define PLD_IRQ_INT11 (OPSPUT_PLD_IRQ_BASE + 11) /* reserved */
120#define PLD_IRQ_UART0 (OPSPUT_PLD_IRQ_BASE + 12) /* UARTIRQ0 */
121#define PLD_IRQ_UART1 (OPSPUT_PLD_IRQ_BASE + 13) /* UARTIRQ1 */
122#define PLD_IRQ_INT14 (OPSPUT_PLD_IRQ_BASE + 14) /* reserved */
123#define PLD_IRQ_INT15 (OPSPUT_PLD_IRQ_BASE + 15) /* reserved */
124#define PLD_IRQ_SNDINT (OPSPUT_PLD_IRQ_BASE + 16) /* SNDINT# */
125#define PLD_IRQ_INT17 (OPSPUT_PLD_IRQ_BASE + 17) /* reserved */
126#define PLD_IRQ_INT18 (OPSPUT_PLD_IRQ_BASE + 18) /* reserved */
127#define PLD_IRQ_INT19 (OPSPUT_PLD_IRQ_BASE + 19) /* reserved */
128#define PLD_IRQ_INT20 (OPSPUT_PLD_IRQ_BASE + 20) /* reserved */
129#define PLD_IRQ_INT21 (OPSPUT_PLD_IRQ_BASE + 21) /* reserved */
130#define PLD_IRQ_INT22 (OPSPUT_PLD_IRQ_BASE + 22) /* reserved */
131#define PLD_IRQ_INT23 (OPSPUT_PLD_IRQ_BASE + 23) /* reserved */
132#define PLD_IRQ_INT24 (OPSPUT_PLD_IRQ_BASE + 24) /* reserved */
133#define PLD_IRQ_INT25 (OPSPUT_PLD_IRQ_BASE + 25) /* reserved */
134#define PLD_IRQ_INT26 (OPSPUT_PLD_IRQ_BASE + 26) /* reserved */
135#define PLD_IRQ_INT27 (OPSPUT_PLD_IRQ_BASE + 27) /* reserved */
136#define PLD_IRQ_INT28 (OPSPUT_PLD_IRQ_BASE + 28) /* reserved */
137#define PLD_IRQ_INT29 (OPSPUT_PLD_IRQ_BASE + 29) /* reserved */
138#define PLD_IRQ_INT30 (OPSPUT_PLD_IRQ_BASE + 30) /* reserved */
139
140#endif /* CONFIG_PLAT_USRV */
141
142#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002)
143#define PLD_ICUISTS_VECB_MASK (0xf000)
144#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK)
145#define PLD_ICUISTS_ISN_MASK (0x07c0)
146#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK)
147#define PLD_ICUIREQ0 __reg16(PLD_BASE + 0x8004)
148#define PLD_ICUIREQ1 __reg16(PLD_BASE + 0x8006)
149#define PLD_ICUCR1 __reg16(PLD_BASE + 0x8100)
150#define PLD_ICUCR2 __reg16(PLD_BASE + 0x8102)
151#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104)
152#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106)
153#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108)
154#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a)
155#define PLD_ICUCR7 __reg16(PLD_BASE + 0x810c)
156#define PLD_ICUCR8 __reg16(PLD_BASE + 0x810e)
157#define PLD_ICUCR9 __reg16(PLD_BASE + 0x8110)
158#define PLD_ICUCR10 __reg16(PLD_BASE + 0x8112)
159#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114)
160#define PLD_ICUCR12 __reg16(PLD_BASE + 0x8116)
161#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118)
162#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a)
163#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c)
164#define PLD_ICUCR16 __reg16(PLD_BASE + 0x811e)
165#define PLD_ICUCR17 __reg16(PLD_BASE + 0x8120)
166#define PLD_ICUCR_IEN (0x1000)
167#define PLD_ICUCR_IREQ (0x0100)
168#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */
169#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */
170#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */
171#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */
172#define PLD_ICUCR_ILEVEL0 (0x0000)
173#define PLD_ICUCR_ILEVEL1 (0x0001)
174#define PLD_ICUCR_ILEVEL2 (0x0002)
175#define PLD_ICUCR_ILEVEL3 (0x0003)
176#define PLD_ICUCR_ILEVEL4 (0x0004)
177#define PLD_ICUCR_ILEVEL5 (0x0005)
178#define PLD_ICUCR_ILEVEL6 (0x0006)
179#define PLD_ICUCR_ILEVEL7 (0x0007)
180
181/* Power Control of MMC and CF */
182#define PLD_CPCR __reg16(PLD_BASE + 0x14000)
183#define PLD_CPCR_CF 0x0001
184#define PLD_CPCR_MMC 0x0002
185
186/* LED Control
187 *
188 * 1: DIP swich side
189 * 2: Reset switch side
190 */
191#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002)
192#define PLD_IOLED_1_ON 0x001
193#define PLD_IOLED_1_OFF 0x000
194#define PLD_IOLED_2_ON 0x002
195#define PLD_IOLED_2_OFF 0x000
196
197/* DIP Switch
198 * 0: Write-protect of Flash Memory (0:protected, 1:non-protected)
199 * 1: -
200 * 2: -
201 * 3: -
202 */
203#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004)
204#define PLD_IOSWSTS_IOSW2 0x0200
205#define PLD_IOSWSTS_IOSW1 0x0100
206#define PLD_IOSWSTS_IOWP0 0x0001
207
208/* CRC */
209#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000)
210#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002)
211#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004)
212#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006)
213#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008)
214#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a)
215
216/* RTC */
217#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000)
218#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002)
219#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004)
220#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006)
221#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008)
222
223/* SIO0 */
224#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000)
225#define PLD_ESIO0CR_TXEN 0x0001
226#define PLD_ESIO0CR_RXEN 0x0002
227#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002)
228#define PLD_ESIO0MOD0_CTSS 0x0040
229#define PLD_ESIO0MOD0_RTSS 0x0080
230#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004)
231#define PLD_ESIO0MOD1_LMFS 0x0010
232#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006)
233#define PLD_ESIO0STS_TEMP 0x0001
234#define PLD_ESIO0STS_TXCP 0x0002
235#define PLD_ESIO0STS_RXCP 0x0004
236#define PLD_ESIO0STS_TXSC 0x0100
237#define PLD_ESIO0STS_RXSC 0x0200
238#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP)
239#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008)
240#define PLD_ESIO0INTCR_TXIEN 0x0002
241#define PLD_ESIO0INTCR_RXCEN 0x0004
242#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a)
243#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c)
244#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e)
245
246/* SIM Card */
247#define PLD_SCCR __reg16(PLD_BASE + 0x38000)
248#define PLD_SCMOD __reg16(PLD_BASE + 0x38004)
249#define PLD_SCSTS __reg16(PLD_BASE + 0x38006)
250#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008)
251#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a)
252#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
253#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
254
255#endif /* _OPSPUT_OPSPUT_PLD.H */
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h
deleted file mode 100644
index c9333089fe11..000000000000
--- a/include/asm-m32r/page.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef _ASM_M32R_PAGE_H
2#define _ASM_M32R_PAGE_H
3
4/* PAGE_SHIFT determines the page size */
5#define PAGE_SHIFT 12
6#define PAGE_SIZE (1UL << PAGE_SHIFT)
7#define PAGE_MASK (~(PAGE_SIZE-1))
8
9#ifndef __ASSEMBLY__
10
11extern void clear_page(void *to);
12extern void copy_page(void *to, void *from);
13
14#define clear_user_page(page, vaddr, pg) clear_page(page)
15#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
16
17#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
18 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
19#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
20
21/*
22 * These are used to make use of C type-checking..
23 */
24typedef struct { unsigned long pte; } pte_t;
25typedef struct { unsigned long pmd; } pmd_t;
26typedef struct { unsigned long pgd; } pgd_t;
27#define pte_val(x) ((x).pte)
28#define PTE_MASK PAGE_MASK
29
30typedef struct { unsigned long pgprot; } pgprot_t;
31typedef struct page *pgtable_t;
32
33#define pmd_val(x) ((x).pmd)
34#define pgd_val(x) ((x).pgd)
35#define pgprot_val(x) ((x).pgprot)
36
37#define __pte(x) ((pte_t) { (x) } )
38#define __pmd(x) ((pmd_t) { (x) } )
39#define __pgd(x) ((pgd_t) { (x) } )
40#define __pgprot(x) ((pgprot_t) { (x) } )
41
42#endif /* !__ASSEMBLY__ */
43
44/*
45 * This handles the memory map.. We could make this a config
46 * option, but too many people screw it up, and too few need
47 * it.
48 *
49 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
50 * a virtual address space of one gigabyte, which limits the
51 * amount of physical memory you can use to about 950MB.
52 *
53 * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
54 * and CONFIG_HIGHMEM64G options in the kernel configuration.
55 */
56
57#define __MEMORY_START CONFIG_MEMORY_START
58#define __MEMORY_SIZE CONFIG_MEMORY_SIZE
59
60#ifdef CONFIG_MMU
61#define __PAGE_OFFSET (0x80000000)
62#else
63#define __PAGE_OFFSET (0x00000000)
64#endif
65
66#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
67#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
68#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
69
70#ifndef CONFIG_DISCONTIGMEM
71#define PFN_BASE (CONFIG_MEMORY_START >> PAGE_SHIFT)
72#define ARCH_PFN_OFFSET PFN_BASE
73#define pfn_valid(pfn) (((pfn) - PFN_BASE) < max_mapnr)
74#endif /* !CONFIG_DISCONTIGMEM */
75
76#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
77#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
78
79#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
80 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC )
81
82#define devmem_is_allowed(x) 1
83
84#include <asm-generic/memory_model.h>
85#include <asm-generic/page.h>
86
87#endif /* _ASM_M32R_PAGE_H */
diff --git a/include/asm-m32r/param.h b/include/asm-m32r/param.h
deleted file mode 100644
index 94c770196048..000000000000
--- a/include/asm-m32r/param.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _ASM_M32R_PARAM_H
2#define _ASM_M32R_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 4096
15
16#ifndef NOGROUP
17#define NOGROUP (-1)
18#endif
19
20#define MAXHOSTNAMELEN 64 /* max length of hostname */
21
22#endif /* _ASM_M32R_PARAM_H */
23
diff --git a/include/asm-m32r/pci.h b/include/asm-m32r/pci.h
deleted file mode 100644
index fe785d167db6..000000000000
--- a/include/asm-m32r/pci.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _ASM_M32R_PCI_H
2#define _ASM_M32R_PCI_H
3
4#include <asm-generic/pci.h>
5
6#define PCI_DMA_BUS_IS_PHYS (1)
7
8#endif /* _ASM_M32R_PCI_H */
diff --git a/include/asm-m32r/percpu.h b/include/asm-m32r/percpu.h
deleted file mode 100644
index e3169301fe66..000000000000
--- a/include/asm-m32r/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ARCH_M32R_PERCPU__
2#define __ARCH_M32R_PERCPU__
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ARCH_M32R_PERCPU__ */
diff --git a/include/asm-m32r/pgalloc.h b/include/asm-m32r/pgalloc.h
deleted file mode 100644
index f11a2b909cdb..000000000000
--- a/include/asm-m32r/pgalloc.h
+++ /dev/null
@@ -1,76 +0,0 @@
1#ifndef _ASM_M32R_PGALLOC_H
2#define _ASM_M32R_PGALLOC_H
3
4#include <linux/mm.h>
5
6#include <asm/io.h>
7
8#define pmd_populate_kernel(mm, pmd, pte) \
9 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte)))
10
11static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
12 pgtable_t pte)
13{
14 set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte)));
15}
16#define pmd_pgtable(pmd) pmd_page(pmd)
17
18/*
19 * Allocate and free page tables.
20 */
21static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm)
22{
23 pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
24
25 return pgd;
26}
27
28static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
29{
30 free_page((unsigned long)pgd);
31}
32
33static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
34 unsigned long address)
35{
36 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
37
38 return pte;
39}
40
41static __inline__ pgtable_t pte_alloc_one(struct mm_struct *mm,
42 unsigned long address)
43{
44 struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO);
45
46 pgtable_page_ctor(pte);
47 return pte;
48}
49
50static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
51{
52 free_page((unsigned long)pte);
53}
54
55static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
56{
57 pgtable_page_dtor(pte);
58 __free_page(pte);
59}
60
61#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, (pte))
62
63/*
64 * allocating and freeing a pmd is trivial: the 1-entry pmd is
65 * inside the pgd, so has no extra memory associated with it.
66 * (In the PAE case we free the pmds as part of the pgd.)
67 */
68
69#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
70#define pmd_free(mm, x) do { } while (0)
71#define __pmd_free_tlb(tlb, x) do { } while (0)
72#define pgd_populate(mm, pmd, pte) BUG()
73
74#define check_pgt_cache() do { } while (0)
75
76#endif /* _ASM_M32R_PGALLOC_H */
diff --git a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h
deleted file mode 100644
index bca3475f9595..000000000000
--- a/include/asm-m32r/pgtable-2level.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef _ASM_M32R_PGTABLE_2LEVEL_H
2#define _ASM_M32R_PGTABLE_2LEVEL_H
3#ifdef __KERNEL__
4
5/*
6 * traditional M32R two-level paging structure:
7 */
8
9#define PGDIR_SHIFT 22
10#define PTRS_PER_PGD 1024
11
12/*
13 * the M32R is two-level, so we don't really have any
14 * PMD directory physically.
15 */
16#define PMD_SHIFT 22
17#define PTRS_PER_PMD 1
18
19#define PTRS_PER_PTE 1024
20
21#define pte_ERROR(e) \
22 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
23#define pmd_ERROR(e) \
24 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
25#define pgd_ERROR(e) \
26 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
27
28/*
29 * The "pgd_xxx()" functions here are trivial for a folded two-level
30 * setup: the pgd is never bad, and a pmd always exists (as it's folded
31 * into the pgd entry)
32 */
33static inline int pgd_none(pgd_t pgd) { return 0; }
34static inline int pgd_bad(pgd_t pgd) { return 0; }
35static inline int pgd_present(pgd_t pgd) { return 1; }
36#define pgd_clear(xp) do { } while (0)
37
38/*
39 * Certain architectures need to do special things when PTEs
40 * within a page table are directly modified. Thus, the following
41 * hook is made available.
42 */
43#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
44#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
45
46/*
47 * (pmds are folded into pgds so this doesnt get actually called,
48 * but the define is needed for a generic inline function.)
49 */
50#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
51#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval)
52
53#define pgd_page_vaddr(pgd) \
54((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
55
56#ifndef CONFIG_DISCONTIGMEM
57#define pgd_page(pgd) (mem_map + ((pgd_val(pgd) >> PAGE_SHIFT) - PFN_BASE))
58#endif /* !CONFIG_DISCONTIGMEM */
59
60static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address)
61{
62 return (pmd_t *) dir;
63}
64
65#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0))
66#define pte_same(a, b) (pte_val(a) == pte_val(b))
67#define pte_page(x) pfn_to_page(pte_pfn(x))
68#define pte_none(x) (!pte_val(x))
69#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
70#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
71#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
72
73#define PTE_FILE_MAX_BITS 29
74#define pte_to_pgoff(pte) (((pte_val(pte) >> 2) & 0x7f) | (((pte_val(pte) >> 10)) << 7))
75#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7f) << 2) | (((off) >> 7) << 10) | _PAGE_FILE })
76
77#endif /* __KERNEL__ */
78#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
deleted file mode 100644
index e6359c566b50..000000000000
--- a/include/asm-m32r/pgtable.h
+++ /dev/null
@@ -1,363 +0,0 @@
1#ifndef _ASM_M32R_PGTABLE_H
2#define _ASM_M32R_PGTABLE_H
3
4#include <asm-generic/4level-fixup.h>
5
6#ifdef __KERNEL__
7/*
8 * The Linux memory management assumes a three-level page table setup. On
9 * the M32R, we use that, but "fold" the mid level into the top-level page
10 * table, so that we physically have the same two-level page table as the
11 * M32R mmu expects.
12 *
13 * This file contains the functions and defines necessary to modify and use
14 * the M32R page table tree.
15 */
16
17/* CAUTION!: If you change macro definitions in this file, you might have to
18 * change arch/m32r/mmu.S manually.
19 */
20
21#ifndef __ASSEMBLY__
22
23#include <linux/threads.h>
24#include <linux/bitops.h>
25#include <asm/processor.h>
26#include <asm/addrspace.h>
27#include <asm/page.h>
28
29struct mm_struct;
30struct vm_area_struct;
31
32extern pgd_t swapper_pg_dir[1024];
33extern void paging_init(void);
34
35/*
36 * ZERO_PAGE is a global shared page that is always zero: used
37 * for zero-mapped memory areas etc..
38 */
39extern unsigned long empty_zero_page[1024];
40#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
41
42#endif /* !__ASSEMBLY__ */
43
44#ifndef __ASSEMBLY__
45#include <asm/pgtable-2level.h>
46#endif
47
48#define pgtable_cache_init() do { } while (0)
49
50#define PMD_SIZE (1UL << PMD_SHIFT)
51#define PMD_MASK (~(PMD_SIZE - 1))
52#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
53#define PGDIR_MASK (~(PGDIR_SIZE - 1))
54
55#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
56#define FIRST_USER_ADDRESS 0
57
58#ifndef __ASSEMBLY__
59/* Just any arbitrary offset to the start of the vmalloc VM area: the
60 * current 8MB value just means that there will be a 8MB "hole" after the
61 * physical memory until the kernel virtual memory starts. That means that
62 * any out-of-bounds memory accesses will hopefully be caught.
63 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
64 * area for the same reason. ;)
65 */
66#define VMALLOC_START KSEG2
67#define VMALLOC_END KSEG3
68
69/*
70 * M32R TLB format
71 *
72 * [0] [1:19] [20:23] [24:31]
73 * +-----------------------+----+-------------+
74 * | VPN |0000| ASID |
75 * +-----------------------+----+-------------+
76 * +-+---------------------+----+-+---+-+-+-+-+
77 * |0 PPN |0000|N|AC |L|G|V| |
78 * +-+---------------------+----+-+---+-+-+-+-+
79 * RWX
80 */
81
82#define _PAGE_BIT_DIRTY 0 /* software: page changed */
83#define _PAGE_BIT_FILE 0 /* when !present: nonlinear file
84 mapping */
85#define _PAGE_BIT_PRESENT 1 /* Valid: page is valid */
86#define _PAGE_BIT_GLOBAL 2 /* Global */
87#define _PAGE_BIT_LARGE 3 /* Large */
88#define _PAGE_BIT_EXEC 4 /* Execute */
89#define _PAGE_BIT_WRITE 5 /* Write */
90#define _PAGE_BIT_READ 6 /* Read */
91#define _PAGE_BIT_NONCACHABLE 7 /* Non cachable */
92#define _PAGE_BIT_ACCESSED 8 /* software: page referenced */
93#define _PAGE_BIT_PROTNONE 9 /* software: if not present */
94
95#define _PAGE_DIRTY (1UL << _PAGE_BIT_DIRTY)
96#define _PAGE_FILE (1UL << _PAGE_BIT_FILE)
97#define _PAGE_PRESENT (1UL << _PAGE_BIT_PRESENT)
98#define _PAGE_GLOBAL (1UL << _PAGE_BIT_GLOBAL)
99#define _PAGE_LARGE (1UL << _PAGE_BIT_LARGE)
100#define _PAGE_EXEC (1UL << _PAGE_BIT_EXEC)
101#define _PAGE_WRITE (1UL << _PAGE_BIT_WRITE)
102#define _PAGE_READ (1UL << _PAGE_BIT_READ)
103#define _PAGE_NONCACHABLE (1UL << _PAGE_BIT_NONCACHABLE)
104#define _PAGE_ACCESSED (1UL << _PAGE_BIT_ACCESSED)
105#define _PAGE_PROTNONE (1UL << _PAGE_BIT_PROTNONE)
106
107#define _PAGE_TABLE \
108 ( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED \
109 | _PAGE_DIRTY )
110#define _KERNPG_TABLE \
111 ( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED \
112 | _PAGE_DIRTY )
113#define _PAGE_CHG_MASK \
114 ( PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY )
115
116#ifdef CONFIG_MMU
117#define PAGE_NONE \
118 __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
119#define PAGE_SHARED \
120 __pgprot(_PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED)
121#define PAGE_SHARED_EXEC \
122 __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_WRITE | _PAGE_READ \
123 | _PAGE_ACCESSED)
124#define PAGE_COPY \
125 __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_ACCESSED)
126#define PAGE_COPY_EXEC \
127 __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_ACCESSED)
128#define PAGE_READONLY \
129 __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_ACCESSED)
130#define PAGE_READONLY_EXEC \
131 __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_ACCESSED)
132
133#define __PAGE_KERNEL \
134 ( _PAGE_PRESENT | _PAGE_EXEC | _PAGE_WRITE | _PAGE_READ | _PAGE_DIRTY \
135 | _PAGE_ACCESSED )
136#define __PAGE_KERNEL_RO ( __PAGE_KERNEL & ~_PAGE_WRITE )
137#define __PAGE_KERNEL_NOCACHE ( __PAGE_KERNEL | _PAGE_NONCACHABLE)
138
139#define MAKE_GLOBAL(x) __pgprot((x) | _PAGE_GLOBAL)
140
141#define PAGE_KERNEL MAKE_GLOBAL(__PAGE_KERNEL)
142#define PAGE_KERNEL_RO MAKE_GLOBAL(__PAGE_KERNEL_RO)
143#define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE)
144
145#else
146#define PAGE_NONE __pgprot(0)
147#define PAGE_SHARED __pgprot(0)
148#define PAGE_SHARED_EXEC __pgprot(0)
149#define PAGE_COPY __pgprot(0)
150#define PAGE_COPY_EXEC __pgprot(0)
151#define PAGE_READONLY __pgprot(0)
152#define PAGE_READONLY_EXEC __pgprot(0)
153
154#define PAGE_KERNEL __pgprot(0)
155#define PAGE_KERNEL_RO __pgprot(0)
156#define PAGE_KERNEL_NOCACHE __pgprot(0)
157#endif /* CONFIG_MMU */
158
159 /* xwr */
160#define __P000 PAGE_NONE
161#define __P001 PAGE_READONLY
162#define __P010 PAGE_COPY
163#define __P011 PAGE_COPY
164#define __P100 PAGE_READONLY_EXEC
165#define __P101 PAGE_READONLY_EXEC
166#define __P110 PAGE_COPY_EXEC
167#define __P111 PAGE_COPY_EXEC
168
169#define __S000 PAGE_NONE
170#define __S001 PAGE_READONLY
171#define __S010 PAGE_SHARED
172#define __S011 PAGE_SHARED
173#define __S100 PAGE_READONLY_EXEC
174#define __S101 PAGE_READONLY_EXEC
175#define __S110 PAGE_SHARED_EXEC
176#define __S111 PAGE_SHARED_EXEC
177
178/* page table for 0-4MB for everybody */
179
180#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))
181#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
182
183#define pmd_none(x) (!pmd_val(x))
184#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
185#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
186#define pmd_bad(x) ((pmd_val(x) & ~PAGE_MASK) != _KERNPG_TABLE)
187
188#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT))
189
190/*
191 * The following only work if pte_present() is true.
192 * Undefined behaviour if not..
193 */
194static inline int pte_dirty(pte_t pte)
195{
196 return pte_val(pte) & _PAGE_DIRTY;
197}
198
199static inline int pte_young(pte_t pte)
200{
201 return pte_val(pte) & _PAGE_ACCESSED;
202}
203
204static inline int pte_write(pte_t pte)
205{
206 return pte_val(pte) & _PAGE_WRITE;
207}
208
209/*
210 * The following only works if pte_present() is not true.
211 */
212static inline int pte_file(pte_t pte)
213{
214 return pte_val(pte) & _PAGE_FILE;
215}
216
217static inline int pte_special(pte_t pte)
218{
219 return 0;
220}
221
222static inline pte_t pte_mkclean(pte_t pte)
223{
224 pte_val(pte) &= ~_PAGE_DIRTY;
225 return pte;
226}
227
228static inline pte_t pte_mkold(pte_t pte)
229{
230 pte_val(pte) &= ~_PAGE_ACCESSED;
231 return pte;
232}
233
234static inline pte_t pte_wrprotect(pte_t pte)
235{
236 pte_val(pte) &= ~_PAGE_WRITE;
237 return pte;
238}
239
240static inline pte_t pte_mkdirty(pte_t pte)
241{
242 pte_val(pte) |= _PAGE_DIRTY;
243 return pte;
244}
245
246static inline pte_t pte_mkyoung(pte_t pte)
247{
248 pte_val(pte) |= _PAGE_ACCESSED;
249 return pte;
250}
251
252static inline pte_t pte_mkwrite(pte_t pte)
253{
254 pte_val(pte) |= _PAGE_WRITE;
255 return pte;
256}
257
258static inline pte_t pte_mkspecial(pte_t pte)
259{
260 return pte;
261}
262
263static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
264{
265 return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep);
266}
267
268static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
269{
270 clear_bit(_PAGE_BIT_WRITE, ptep);
271}
272
273/*
274 * Macro and implementation to make a page protection as uncachable.
275 */
276static inline pgprot_t pgprot_noncached(pgprot_t _prot)
277{
278 unsigned long prot = pgprot_val(_prot);
279
280 prot |= _PAGE_NONCACHABLE;
281 return __pgprot(prot);
282}
283
284#define pgprot_writecombine(prot) pgprot_noncached(prot)
285
286/*
287 * Conversion functions: convert a page and protection to a page entry,
288 * and a page entry and page directory to the page they refer to.
289 */
290#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), pgprot)
291
292static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
293{
294 set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) \
295 | pgprot_val(newprot)));
296
297 return pte;
298}
299
300/*
301 * Conversion functions: convert a page and protection to a page entry,
302 * and a page entry and page directory to the page they refer to.
303 */
304
305static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
306{
307 pmd_val(*pmdp) = (((unsigned long) ptep) & PAGE_MASK);
308}
309
310#define pmd_page_vaddr(pmd) \
311 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
312
313#ifndef CONFIG_DISCONTIGMEM
314#define pmd_page(pmd) (mem_map + ((pmd_val(pmd) >> PAGE_SHIFT) - PFN_BASE))
315#endif /* !CONFIG_DISCONTIGMEM */
316
317/* to find an entry in a page-table-directory. */
318#define pgd_index(address) \
319 (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
320
321#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
322
323/* to find an entry in a kernel page-table-directory */
324#define pgd_offset_k(address) pgd_offset(&init_mm, address)
325
326#define pmd_index(address) \
327 (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
328
329#define pte_index(address) \
330 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
331#define pte_offset_kernel(dir, address) \
332 ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address))
333#define pte_offset_map(dir, address) \
334 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
335#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
336#define pte_unmap(pte) do { } while (0)
337#define pte_unmap_nested(pte) do { } while (0)
338
339/* Encode and de-code a swap entry */
340#define __swp_type(x) (((x).val >> 2) & 0x1f)
341#define __swp_offset(x) ((x).val >> 10)
342#define __swp_entry(type, offset) \
343 ((swp_entry_t) { ((type) << 2) | ((offset) << 10) })
344#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
345#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
346
347#endif /* !__ASSEMBLY__ */
348
349/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
350#define kern_addr_valid(addr) (1)
351
352#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
353 remap_pfn_range(vma, vaddr, pfn, size, prot)
354
355#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
356#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
357#define __HAVE_ARCH_PTEP_SET_WRPROTECT
358#define __HAVE_ARCH_PTE_SAME
359#include <asm-generic/pgtable.h>
360
361#endif /* __KERNEL__ */
362
363#endif /* _ASM_M32R_PGTABLE_H */
diff --git a/include/asm-m32r/poll.h b/include/asm-m32r/poll.h
deleted file mode 100644
index c98509d3149e..000000000000
--- a/include/asm-m32r/poll.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/poll.h>
diff --git a/include/asm-m32r/posix_types.h b/include/asm-m32r/posix_types.h
deleted file mode 100644
index b309c5858637..000000000000
--- a/include/asm-m32r/posix_types.h
+++ /dev/null
@@ -1,118 +0,0 @@
1#ifndef _ASM_M32R_POSIX_TYPES_H
2#define _ASM_M32R_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
48static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
49{
50 unsigned long __tmp = __fd / __NFDBITS;
51 unsigned long __rem = __fd % __NFDBITS;
52 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
53}
54
55#undef __FD_CLR
56static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
57{
58 unsigned long __tmp = __fd / __NFDBITS;
59 unsigned long __rem = __fd % __NFDBITS;
60 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
61}
62
63
64#undef __FD_ISSET
65static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
66{
67 unsigned long __tmp = __fd / __NFDBITS;
68 unsigned long __rem = __fd % __NFDBITS;
69 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
70}
71
72/*
73 * This will unroll the loop for the normal constant case (8 ints,
74 * for a 256-bit fd_set)
75 */
76#undef __FD_ZERO
77static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
78{
79 unsigned long *__tmp = __p->fds_bits;
80 int __i;
81
82 if (__builtin_constant_p(__FDSET_LONGS)) {
83 switch (__FDSET_LONGS) {
84 case 16:
85 __tmp[ 0] = 0; __tmp[ 1] = 0;
86 __tmp[ 2] = 0; __tmp[ 3] = 0;
87 __tmp[ 4] = 0; __tmp[ 5] = 0;
88 __tmp[ 6] = 0; __tmp[ 7] = 0;
89 __tmp[ 8] = 0; __tmp[ 9] = 0;
90 __tmp[10] = 0; __tmp[11] = 0;
91 __tmp[12] = 0; __tmp[13] = 0;
92 __tmp[14] = 0; __tmp[15] = 0;
93 return;
94
95 case 8:
96 __tmp[ 0] = 0; __tmp[ 1] = 0;
97 __tmp[ 2] = 0; __tmp[ 3] = 0;
98 __tmp[ 4] = 0; __tmp[ 5] = 0;
99 __tmp[ 6] = 0; __tmp[ 7] = 0;
100 return;
101
102 case 4:
103 __tmp[ 0] = 0; __tmp[ 1] = 0;
104 __tmp[ 2] = 0; __tmp[ 3] = 0;
105 return;
106 }
107 }
108 __i = __FDSET_LONGS;
109 while (__i) {
110 __i--;
111 *__tmp = 0;
112 __tmp++;
113 }
114}
115
116#endif /* defined(__KERNEL__) */
117
118#endif /* _ASM_M32R_POSIX_TYPES_H */
diff --git a/include/asm-m32r/processor.h b/include/asm-m32r/processor.h
deleted file mode 100644
index 1a997fc148a2..000000000000
--- a/include/asm-m32r/processor.h
+++ /dev/null
@@ -1,147 +0,0 @@
1#ifndef _ASM_M32R_PROCESSOR_H
2#define _ASM_M32R_PROCESSOR_H
3
4/*
5 * include/asm-m32r/processor.h
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (C) 1994 Linus Torvalds
12 * Copyright (C) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto
13 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
14 */
15
16#include <linux/kernel.h>
17#include <asm/cache.h>
18#include <asm/ptrace.h> /* pt_regs */
19
20/*
21 * Default implementation of macro that returns current
22 * instruction pointer ("program counter").
23 */
24#define current_text_addr() ({ __label__ _l; _l: &&_l; })
25
26/*
27 * CPU type and hardware bug flags. Kept separately for each CPU.
28 * Members of this structure are referenced in head.S, so think twice
29 * before touching them. [mj]
30 */
31
32struct cpuinfo_m32r {
33 unsigned long pgtable_cache_sz;
34 unsigned long cpu_clock;
35 unsigned long bus_clock;
36 unsigned long timer_divide;
37 unsigned long loops_per_jiffy;
38};
39
40/*
41 * capabilities of CPUs
42 */
43
44extern struct cpuinfo_m32r boot_cpu_data;
45
46#ifdef CONFIG_SMP
47extern struct cpuinfo_m32r cpu_data[];
48#define current_cpu_data cpu_data[smp_processor_id()]
49#else
50#define cpu_data (&boot_cpu_data)
51#define current_cpu_data boot_cpu_data
52#endif
53
54/*
55 * User space process size: 2GB (default).
56 */
57#ifdef CONFIG_MMU
58#define TASK_SIZE (0x80000000UL)
59#else
60#define TASK_SIZE (0x00400000UL)
61#endif
62
63#ifdef __KERNEL__
64#define STACK_TOP TASK_SIZE
65#define STACK_TOP_MAX STACK_TOP
66#endif
67
68/* This decides where the kernel will search for a free chunk of vm
69 * space during mmap's.
70 */
71#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
72
73typedef struct {
74 unsigned long seg;
75} mm_segment_t;
76
77#define MAX_TRAPS 10
78
79struct debug_trap {
80 int nr_trap;
81 unsigned long addr[MAX_TRAPS];
82 unsigned long insn[MAX_TRAPS];
83};
84
85struct thread_struct {
86 unsigned long address;
87 unsigned long trap_no; /* Trap number */
88 unsigned long error_code; /* Error code of trap */
89 unsigned long lr; /* saved pc */
90 unsigned long sp; /* user stack pointer */
91 struct debug_trap debug_trap;
92};
93
94#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
95
96#define INIT_THREAD { \
97 .sp = INIT_SP, \
98}
99
100/*
101 * Do necessary setup to start up a newly executed thread.
102 */
103
104/* User process Backup PSW */
105#define USERPS_BPSW (M32R_PSW_BSM|M32R_PSW_BIE|M32R_PSW_BPM)
106
107#define start_thread(regs, new_pc, new_spu) \
108 do { \
109 set_fs(USER_DS); \
110 regs->psw = (regs->psw | USERPS_BPSW) & 0x0000FFFFUL; \
111 regs->bpc = new_pc; \
112 regs->spu = new_spu; \
113 } while (0)
114
115/* Forward declaration, a strange C thing */
116struct task_struct;
117struct mm_struct;
118
119/* Free all resources held by a thread. */
120extern void release_thread(struct task_struct *);
121
122#define prepare_to_copy(tsk) do { } while (0)
123
124/*
125 * create a kernel thread without removing it from tasklists
126 */
127extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
128
129/* Copy and release all segment info associated with a VM */
130extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
131extern void release_segments(struct mm_struct * mm);
132
133extern unsigned long thread_saved_pc(struct task_struct *);
134
135/* Copy and release all segment info associated with a VM */
136#define copy_segments(p, mm) do { } while (0)
137#define release_segments(mm) do { } while (0)
138
139unsigned long get_wchan(struct task_struct *p);
140#define KSTK_EIP(tsk) ((tsk)->thread.lr)
141#define KSTK_ESP(tsk) ((tsk)->thread.sp)
142
143#define THREAD_SIZE (2*PAGE_SIZE)
144
145#define cpu_relax() barrier()
146
147#endif /* _ASM_M32R_PROCESSOR_H */
diff --git a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h
deleted file mode 100644
index a0755b982028..000000000000
--- a/include/asm-m32r/ptrace.h
+++ /dev/null
@@ -1,148 +0,0 @@
1#ifndef _ASM_M32R_PTRACE_H
2#define _ASM_M32R_PTRACE_H
3
4/*
5 * linux/include/asm-m32r/ptrace.h
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * M32R version:
12 * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org>
13 */
14
15/* 0 - 13 are integer registers (general purpose registers). */
16#define PT_R4 0
17#define PT_R5 1
18#define PT_R6 2
19#define PT_REGS 3
20#define PT_R0 4
21#define PT_R1 5
22#define PT_R2 6
23#define PT_R3 7
24#define PT_R7 8
25#define PT_R8 9
26#define PT_R9 10
27#define PT_R10 11
28#define PT_R11 12
29#define PT_R12 13
30#define PT_SYSCNR 14
31#define PT_R13 PT_FP
32#define PT_R14 PT_LR
33#define PT_R15 PT_SP
34
35/* processor status and miscellaneous context registers. */
36#define PT_ACC0H 15
37#define PT_ACC0L 16
38#define PT_ACC1H 17 /* ISA_DSP_LEVEL2 only */
39#define PT_ACC1L 18 /* ISA_DSP_LEVEL2 only */
40#define PT_PSW 19
41#define PT_BPC 20
42#define PT_BBPSW 21
43#define PT_BBPC 22
44#define PT_SPU 23
45#define PT_FP 24
46#define PT_LR 25
47#define PT_SPI 26
48#define PT_ORIGR0 27
49
50/* virtual pt_reg entry for gdb */
51#define PT_PC 30
52#define PT_CBR 31
53#define PT_EVB 32
54
55
56/* Control registers. */
57#define SPR_CR0 PT_PSW
58#define SPR_CR1 PT_CBR /* read only */
59#define SPR_CR2 PT_SPI
60#define SPR_CR3 PT_SPU
61#define SPR_CR4
62#define SPR_CR5 PT_EVB /* part of M32R/E, M32R/I core only */
63#define SPR_CR6 PT_BPC
64#define SPR_CR7
65#define SPR_CR8 PT_BBPSW
66#define SPR_CR9
67#define SPR_CR10
68#define SPR_CR11
69#define SPR_CR12
70#define SPR_CR13 PT_WR
71#define SPR_CR14 PT_BBPC
72#define SPR_CR15
73
74/* this struct defines the way the registers are stored on the
75 stack during a system call. */
76struct pt_regs {
77 /* Saved main processor registers. */
78 unsigned long r4;
79 unsigned long r5;
80 unsigned long r6;
81 struct pt_regs *pt_regs;
82 unsigned long r0;
83 unsigned long r1;
84 unsigned long r2;
85 unsigned long r3;
86 unsigned long r7;
87 unsigned long r8;
88 unsigned long r9;
89 unsigned long r10;
90 unsigned long r11;
91 unsigned long r12;
92 long syscall_nr;
93
94 /* Saved main processor status and miscellaneous context registers. */
95 unsigned long acc0h;
96 unsigned long acc0l;
97 unsigned long acc1h; /* ISA_DSP_LEVEL2 only */
98 unsigned long acc1l; /* ISA_DSP_LEVEL2 only */
99 unsigned long psw;
100 unsigned long bpc; /* saved PC for TRAP syscalls */
101 unsigned long bbpsw;
102 unsigned long bbpc;
103 unsigned long spu; /* saved user stack */
104 unsigned long fp;
105 unsigned long lr; /* saved PC for JL syscalls */
106 unsigned long spi; /* saved kernel stack */
107 unsigned long orig_r0;
108};
109
110/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
111#define PTRACE_GETREGS 12
112#define PTRACE_SETREGS 13
113
114#define PTRACE_OLDSETOPTIONS 21
115
116/* options set using PTRACE_SETOPTIONS */
117#define PTRACE_O_TRACESYSGOOD 0x00000001
118
119#ifdef __KERNEL__
120
121#include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */
122
123struct task_struct;
124extern void init_debug_traps(struct task_struct *);
125#define arch_ptrace_attach(child) \
126 init_debug_traps(child)
127
128#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2)
129#define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0)
130#elif defined(CONFIG_ISA_M32R)
131#define user_mode(regs) ((M32R_PSW_BSM & (regs)->psw) != 0)
132#else
133#error unknown isa configuration
134#endif
135
136#define instruction_pointer(regs) ((regs)->bpc)
137#define profile_pc(regs) instruction_pointer(regs)
138
139extern void show_regs(struct pt_regs *);
140
141extern void withdraw_debug_trap(struct pt_regs *regs);
142
143#define task_pt_regs(task) \
144 ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1)
145
146#endif /* __KERNEL */
147
148#endif /* _ASM_M32R_PTRACE_H */
diff --git a/include/asm-m32r/resource.h b/include/asm-m32r/resource.h
deleted file mode 100644
index b1ce766e37a0..000000000000
--- a/include/asm-m32r/resource.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_M32R_RESOURCE_H
2#define _ASM_M32R_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif /* _ASM_M32R_RESOURCE_H */
diff --git a/include/asm-m32r/rtc.h b/include/asm-m32r/rtc.h
deleted file mode 100644
index 0340633f3f4d..000000000000
--- a/include/asm-m32r/rtc.h
+++ /dev/null
@@ -1,65 +0,0 @@
1#ifndef __RTC_H__
2#define __RTC_H__
3
4 /* Dallas DS1302 clock/calendar register numbers. */
5# define RTC_SECONDS 0
6# define RTC_MINUTES 1
7# define RTC_HOURS 2
8# define RTC_DAY_OF_MONTH 3
9# define RTC_MONTH 4
10# define RTC_WEEKDAY 5
11# define RTC_YEAR 6
12# define RTC_CONTROL 7
13
14 /* Bits in CONTROL register. */
15# define RTC_CONTROL_WRITEPROTECT 0x80
16# define RTC_TRICKLECHARGER 8
17
18 /* Bits in TRICKLECHARGER register TCS TCS TCS TCS DS DS RS RS. */
19# define RTC_TCR_PATTERN 0xA0 /* 1010xxxx */
20# define RTC_TCR_1DIOD 0x04 /* xxxx01xx */
21# define RTC_TCR_2DIOD 0x08 /* xxxx10xx */
22# define RTC_TCR_DISABLED 0x00 /* xxxxxx00 Disabled */
23# define RTC_TCR_2KOHM 0x01 /* xxxxxx01 2KOhm */
24# define RTC_TCR_4KOHM 0x02 /* xxxxxx10 4kOhm */
25# define RTC_TCR_8KOHM 0x03 /* xxxxxx11 8kOhm */
26
27#ifdef CONFIG_DS1302
28extern unsigned char ds1302_readreg(int reg);
29extern void ds1302_writereg(int reg, unsigned char val);
30extern int ds1302_init(void);
31# define CMOS_READ(x) ds1302_readreg(x)
32# define CMOS_WRITE(val,reg) ds1302_writereg(reg,val)
33# define RTC_INIT() ds1302_init()
34#else
35 /* No RTC configured so we shouldn't try to access any. */
36# define CMOS_READ(x) 42
37# define CMOS_WRITE(x,y)
38# define RTC_INIT() (-1)
39#endif
40
41/*
42 * The struct used to pass data via the following ioctl. Similar to the
43 * struct tm in <time.h>, but it needs to be here so that the kernel
44 * source is self contained, allowing cross-compiles, etc. etc.
45 */
46struct rtc_time {
47 int tm_sec;
48 int tm_min;
49 int tm_hour;
50 int tm_mday;
51 int tm_mon;
52 int tm_year;
53 int tm_wday;
54 int tm_yday;
55 int tm_isdst;
56};
57
58/* ioctl() calls that are permitted to the /dev/rtc interface. */
59#define RTC_MAGIC 'p'
60#define RTC_RD_TIME _IOR(RTC_MAGIC, 0x09, struct rtc_time) /* Read RTC time. */
61#define RTC_SET_TIME _IOW(RTC_MAGIC, 0x0a, struct rtc_time) /* Set RTC time. */
62#define RTC_SET_CHARGE _IOW(RTC_MAGIC, 0x0b, int)
63#define RTC_MAX_IOCTL 0x0b
64
65#endif /* __RTC_H__ */
diff --git a/include/asm-m32r/s1d13806.h b/include/asm-m32r/s1d13806.h
deleted file mode 100644
index 248d36a82d79..000000000000
--- a/include/asm-m32r/s1d13806.h
+++ /dev/null
@@ -1,199 +0,0 @@
1//----------------------------------------------------------------------------
2//
3// File generated by S1D13806CFG.EXE
4//
5// Copyright (c) 2000,2001 Epson Research and Development, Inc.
6// All rights reserved.
7//
8//----------------------------------------------------------------------------
9
10// Panel: (active) 640x480 77Hz STN Single 8-bit (PCLK=CLKI=25.175MHz)
11// Memory: Embedded SDRAM (MCLK=CLKI3=50.000MHz) (BUSCLK=33.333MHz)
12
13#define SWIVEL_VIEW 0 /* 0:none, 1:90 not completed */
14
15static struct s1d13xxxfb_regval s1d13xxxfb_initregs[] = {
16
17 {0x0001,0x00}, // Miscellaneous Register
18 {0x01FC,0x00}, // Display Mode Register
19#if defined(CONFIG_PLAT_MAPPI)
20 {0x0004,0x00}, // General IO Pins Configuration Register 0
21 {0x0005,0x00}, // General IO Pins Configuration Register 1
22 {0x0008,0x00}, // General IO Pins Control Register 0
23 {0x0009,0x00}, // General IO Pins Control Register 1
24 {0x0010,0x00}, // Memory Clock Configuration Register
25 {0x0014,0x00}, // LCD Pixel Clock Configuration Register
26 {0x0018,0x00}, // CRT/TV Pixel Clock Configuration Register
27 {0x001C,0x00}, // MediaPlug Clock Configuration Register
28/*
29 * .. 10MHz: 0x00
30 * .. 30MHz: 0x01
31 * 30MHz ..: 0x02
32 */
33 {0x001E,0x02}, // CPU To Memory Wait State Select Register
34 {0x0021,0x02}, // DRAM Refresh Rate Register
35 {0x002A,0x11}, // DRAM Timings Control Register 0
36 {0x002B,0x13}, // DRAM Timings Control Register 1
37 {0x0020,0x80}, // Memory Configuration Register
38 {0x0030,0x25}, // Panel Type Register
39 {0x0031,0x00}, // MOD Rate Register
40 {0x0032,0x4F}, // LCD Horizontal Display Width Register
41 {0x0034,0x12}, // LCD Horizontal Non-Display Period Register
42 {0x0035,0x01}, // TFT FPLINE Start Position Register
43 {0x0036,0x0B}, // TFT FPLINE Pulse Width Register
44 {0x0038,0xDF}, // LCD Vertical Display Height Register 0
45 {0x0039,0x01}, // LCD Vertical Display Height Register 1
46 {0x003A,0x2C}, // LCD Vertical Non-Display Period Register
47 {0x003B,0x0A}, // TFT FPFRAME Start Position Register
48 {0x003C,0x01}, // TFT FPFRAME Pulse Width Register
49
50 {0x0041,0x00}, // LCD Miscellaneous Register
51 {0x0042,0x00}, // LCD Display Start Address Register 0
52 {0x0043,0x00}, // LCD Display Start Address Register 1
53 {0x0044,0x00}, // LCD Display Start Address Register 2
54
55#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3)
56 {0x0004,0x07}, // GPIO[0:7] direction
57 {0x0005,0x00}, // GPIO[8:12] direction
58 {0x0008,0x00}, // GPIO[0:7] data
59 {0x0009,0x00}, // GPIO[8:12] data
60 {0x0008,0x04}, // LCD panel Vcc on
61 {0x0008,0x05}, // LCD panel reset
62 {0x0010,0x01}, // Memory Clock Configuration Register
63 {0x0014,0x30}, // LCD Pixel Clock Configuration Register (CLKI 22MHz/4)
64 {0x0018,0x00}, // CRT/TV Pixel Clock Configuration Register
65 {0x001C,0x00}, // MediaPlug Clock Configuration Register(10MHz)
66 {0x001E,0x00}, // CPU To Memory Wait State Select Register
67 {0x0020,0x80}, // Memory Configuration Register
68 {0x0021,0x03}, // DRAM Refresh Rate Register
69 {0x002A,0x00}, // DRAM Timings Control Register 0
70 {0x002B,0x01}, // DRAM Timings Control Register 1
71 {0x0030,0x25}, // Panel Type Register
72 {0x0031,0x00}, // MOD Rate Register
73 {0x0032,0x1d}, // LCD Horizontal Display Width Register
74 {0x0034,0x05}, // LCD Horizontal Non-Display Period Register
75 {0x0035,0x01}, // TFT FPLINE Start Position Register
76 {0x0036,0x01}, // TFT FPLINE Pulse Width Register
77 {0x0038,0x3F}, // LCD Vertical Display Height Register 0
78 {0x0039,0x01}, // LCD Vertical Display Height Register 1
79 {0x003A,0x0b}, // LCD Vertical Non-Display Period Register
80 {0x003B,0x07}, // TFT FPFRAME Start Position Register
81 {0x003C,0x02}, // TFT FPFRAME Pulse Width Register
82
83 {0x0041,0x00}, // LCD Miscellaneous Register
84#if (SWIVEL_VIEW == 0)
85 {0x0042,0x00}, // LCD Display Start Address Register 0
86 {0x0043,0x00}, // LCD Display Start Address Register 1
87 {0x0044,0x00}, // LCD Display Start Address Register 2
88
89#elif (SWIVEL_VIEW == 1)
90 // 1024 - W(320) = 0x2C0
91 {0x0042,0xC0}, // LCD Display Start Address Register 0
92 {0x0043,0x02}, // LCD Display Start Address Register 1
93 {0x0044,0x00}, // LCD Display Start Address Register 2
94 // 1024
95 {0x0046,0x00}, // LCD Memory Address Offset Register 0
96 {0x0047,0x02}, // LCD Memory Address Offset Register 1
97#else
98#error unsupported SWIVEL_VIEW mode
99#endif
100#else
101#error no platform configuration
102#endif /* CONFIG_PLAT_XXX */
103
104 {0x0048,0x00}, // LCD Pixel Panning Register
105 {0x004A,0x00}, // LCD Display FIFO High Threshold Control Register
106 {0x004B,0x00}, // LCD Display FIFO Low Threshold Control Register
107 {0x0050,0x4F}, // CRT/TV Horizontal Display Width Register
108 {0x0052,0x13}, // CRT/TV Horizontal Non-Display Period Register
109 {0x0053,0x01}, // CRT/TV HRTC Start Position Register
110 {0x0054,0x0B}, // CRT/TV HRTC Pulse Width Register
111 {0x0056,0xDF}, // CRT/TV Vertical Display Height Register 0
112 {0x0057,0x01}, // CRT/TV Vertical Display Height Register 1
113 {0x0058,0x2B}, // CRT/TV Vertical Non-Display Period Register
114 {0x0059,0x09}, // CRT/TV VRTC Start Position Register
115 {0x005A,0x01}, // CRT/TV VRTC Pulse Width Register
116 {0x005B,0x10}, // TV Output Control Register
117
118 {0x0062,0x00}, // CRT/TV Display Start Address Register 0
119 {0x0063,0x00}, // CRT/TV Display Start Address Register 1
120 {0x0064,0x00}, // CRT/TV Display Start Address Register 2
121
122 {0x0068,0x00}, // CRT/TV Pixel Panning Register
123 {0x006A,0x00}, // CRT/TV Display FIFO High Threshold Control Register
124 {0x006B,0x00}, // CRT/TV Display FIFO Low Threshold Control Register
125 {0x0070,0x00}, // LCD Ink/Cursor Control Register
126 {0x0071,0x01}, // LCD Ink/Cursor Start Address Register
127 {0x0072,0x00}, // LCD Cursor X Position Register 0
128 {0x0073,0x00}, // LCD Cursor X Position Register 1
129 {0x0074,0x00}, // LCD Cursor Y Position Register 0
130 {0x0075,0x00}, // LCD Cursor Y Position Register 1
131 {0x0076,0x00}, // LCD Ink/Cursor Blue Color 0 Register
132 {0x0077,0x00}, // LCD Ink/Cursor Green Color 0 Register
133 {0x0078,0x00}, // LCD Ink/Cursor Red Color 0 Register
134 {0x007A,0x1F}, // LCD Ink/Cursor Blue Color 1 Register
135 {0x007B,0x3F}, // LCD Ink/Cursor Green Color 1 Register
136 {0x007C,0x1F}, // LCD Ink/Cursor Red Color 1 Register
137 {0x007E,0x00}, // LCD Ink/Cursor FIFO Threshold Register
138 {0x0080,0x00}, // CRT/TV Ink/Cursor Control Register
139 {0x0081,0x01}, // CRT/TV Ink/Cursor Start Address Register
140 {0x0082,0x00}, // CRT/TV Cursor X Position Register 0
141 {0x0083,0x00}, // CRT/TV Cursor X Position Register 1
142 {0x0084,0x00}, // CRT/TV Cursor Y Position Register 0
143 {0x0085,0x00}, // CRT/TV Cursor Y Position Register 1
144 {0x0086,0x00}, // CRT/TV Ink/Cursor Blue Color 0 Register
145 {0x0087,0x00}, // CRT/TV Ink/Cursor Green Color 0 Register
146 {0x0088,0x00}, // CRT/TV Ink/Cursor Red Color 0 Register
147 {0x008A,0x1F}, // CRT/TV Ink/Cursor Blue Color 1 Register
148 {0x008B,0x3F}, // CRT/TV Ink/Cursor Green Color 1 Register
149 {0x008C,0x1F}, // CRT/TV Ink/Cursor Red Color 1 Register
150 {0x008E,0x00}, // CRT/TV Ink/Cursor FIFO Threshold Register
151 {0x0100,0x00}, // BitBlt Control Register 0
152 {0x0101,0x00}, // BitBlt Control Register 1
153 {0x0102,0x00}, // BitBlt ROP Code/Color Expansion Register
154 {0x0103,0x00}, // BitBlt Operation Register
155 {0x0104,0x00}, // BitBlt Source Start Address Register 0
156 {0x0105,0x00}, // BitBlt Source Start Address Register 1
157 {0x0106,0x00}, // BitBlt Source Start Address Register 2
158 {0x0108,0x00}, // BitBlt Destination Start Address Register 0
159 {0x0109,0x00}, // BitBlt Destination Start Address Register 1
160 {0x010A,0x00}, // BitBlt Destination Start Address Register 2
161 {0x010C,0x00}, // BitBlt Memory Address Offset Register 0
162 {0x010D,0x00}, // BitBlt Memory Address Offset Register 1
163 {0x0110,0x00}, // BitBlt Width Register 0
164 {0x0111,0x00}, // BitBlt Width Register 1
165 {0x0112,0x00}, // BitBlt Height Register 0
166 {0x0113,0x00}, // BitBlt Height Register 1
167 {0x0114,0x00}, // BitBlt Background Color Register 0
168 {0x0115,0x00}, // BitBlt Background Color Register 1
169 {0x0118,0x00}, // BitBlt Foreground Color Register 0
170 {0x0119,0x00}, // BitBlt Foreground Color Register 1
171 {0x01E0,0x00}, // Look-Up Table Mode Register
172 {0x01E2,0x00}, // Look-Up Table Address Register
173 {0x01F0,0x10}, // Power Save Configuration Register
174 {0x01F1,0x00}, // Power Save Status Register
175 {0x01F4,0x00}, // CPU-to-Memory Access Watchdog Timer Register
176#if (SWIVEL_VIEW == 0)
177 {0x01FC,0x01}, // Display Mode Register(0x01:LCD, 0x02:CRT, 0x03:LCD&CRT)
178#elif (SWIVEL_VIEW == 1)
179 {0x01FC,0x41}, // Display Mode Register(0x01:LCD, 0x02:CRT, 0x03:LCD&CRT)
180#else
181#error unsupported SWIVEL_VIEW mode
182#endif /* SWIVEL_VIEW */
183
184#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3)
185 {0x0008,0x07}, // LCD panel Vdd & Vg on
186#endif
187
188 {0x0040,0x05}, // LCD Display Mode Register (2:4bpp,3:8bpp,5:16bpp)
189#if defined(CONFIG_PLAT_MAPPI)
190 {0x0046,0x80}, // LCD Memory Address Offset Register 0
191 {0x0047,0x02}, // LCD Memory Address Offset Register 1
192#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3)
193 {0x0046,0xf0}, // LCD Memory Address Offset Register 0
194 {0x0047,0x00}, // LCD Memory Address Offset Register 1
195#endif
196 {0x0060,0x05}, // CRT/TV Display Mode Register (2:4bpp,3:8bpp,5:16bpp)
197 {0x0066,0x80}, // CRT/TV Memory Address Offset Register 0 // takeo
198 {0x0067,0x02}, // CRT/TV Memory Address Offset Register 1
199};
diff --git a/include/asm-m32r/scatterlist.h b/include/asm-m32r/scatterlist.h
deleted file mode 100644
index 1ed372c73d0b..000000000000
--- a/include/asm-m32r/scatterlist.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _ASM_M32R_SCATTERLIST_H
2#define _ASM_M32R_SCATTERLIST_H
3
4#include <asm/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 char * address; /* Location data is to be transferred to, NULL for
11 * highmem page */
12 unsigned long page_link;
13 unsigned int offset;/* for highmem, page offset */
14
15 dma_addr_t dma_address;
16 unsigned int length;
17};
18
19#define ISA_DMA_THRESHOLD (0x1fffffff)
20
21#endif /* _ASM_M32R_SCATTERLIST_H */
diff --git a/include/asm-m32r/sections.h b/include/asm-m32r/sections.h
deleted file mode 100644
index 5e5d21c4908a..000000000000
--- a/include/asm-m32r/sections.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _M32R_SECTIONS_H
2#define _M32R_SECTIONS_H
3
4/* nothing to see, move along */
5#include <asm-generic/sections.h>
6
7#endif /* _M32R_SECTIONS_H */
diff --git a/include/asm-m32r/segment.h b/include/asm-m32r/segment.h
deleted file mode 100644
index 42b11aeb3249..000000000000
--- a/include/asm-m32r/segment.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _ASM_M32R_SEGMENT_H
2#define _ASM_M32R_SEGMENT_H
3
4#define __KERNEL_CS 0x10
5#define __KERNEL_DS 0x18
6
7#define __USER_CS 0x23
8#define __USER_DS 0x2B
9
10#endif /* _ASM_M32R_SEGMENT_H */
diff --git a/include/asm-m32r/sembuf.h b/include/asm-m32r/sembuf.h
deleted file mode 100644
index c9873d6890e2..000000000000
--- a/include/asm-m32r/sembuf.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _ASM_M32R_SEMBUF_H
2#define _ASM_M32R_SEMBUF_H
3
4/*
5 * The semid64_ds structure for m32r 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_M32R_SEMBUF_H */
diff --git a/include/asm-m32r/serial.h b/include/asm-m32r/serial.h
deleted file mode 100644
index 5ac244c72f15..000000000000
--- a/include/asm-m32r/serial.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _ASM_M32R_SERIAL_H
2#define _ASM_M32R_SERIAL_H
3
4/* include/asm-m32r/serial.h */
5
6
7#define BASE_BAUD 115200
8
9#endif /* _ASM_M32R_SERIAL_H */
diff --git a/include/asm-m32r/setup.h b/include/asm-m32r/setup.h
deleted file mode 100644
index c637ab992394..000000000000
--- a/include/asm-m32r/setup.h
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifndef _ASM_M32R_SETUP_H
2#define _ASM_M32R_SETUP_H
3
4/*
5 * This is set up by the setup-routine at boot-time
6 */
7
8#define COMMAND_LINE_SIZE 512
9
10#ifdef __KERNEL__
11
12#define PARAM ((unsigned char *)empty_zero_page)
13
14#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000))
15#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004))
16#define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008))
17#define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c))
18#define INITRD_START (*(unsigned long *) (PARAM+0x010))
19#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014))
20
21#define M32R_CPUCLK (*(unsigned long *) (PARAM+0x018))
22#define M32R_BUSCLK (*(unsigned long *) (PARAM+0x01c))
23#define M32R_TIMER_DIVIDE (*(unsigned long *) (PARAM+0x020))
24
25#define COMMAND_LINE ((char *) (PARAM+0x100))
26
27#define SCREEN_INFO (*(struct screen_info *) (PARAM+0x200))
28
29#define RAMDISK_IMAGE_START_MASK (0x07FF)
30#define RAMDISK_PROMPT_FLAG (0x8000)
31#define RAMDISK_LOAD_FLAG (0x4000)
32
33extern unsigned long memory_start;
34extern unsigned long memory_end;
35
36#endif /* __KERNEL__ */
37
38#endif /* _ASM_M32R_SETUP_H */
diff --git a/include/asm-m32r/shmbuf.h b/include/asm-m32r/shmbuf.h
deleted file mode 100644
index b0cdf0aa7d65..000000000000
--- a/include/asm-m32r/shmbuf.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _ASM_M32R_SHMBUF_H
2#define _ASM_M32R_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for M32R 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_M32R_SHMBUF_H */
diff --git a/include/asm-m32r/shmparam.h b/include/asm-m32r/shmparam.h
deleted file mode 100644
index 35986d81a528..000000000000
--- a/include/asm-m32r/shmparam.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_M32R_SHMPARAM_H
2#define _ASM_M32R_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _ASM_M32R_SHMPARAM_H */
diff --git a/include/asm-m32r/sigcontext.h b/include/asm-m32r/sigcontext.h
deleted file mode 100644
index da4a9c36d09b..000000000000
--- a/include/asm-m32r/sigcontext.h
+++ /dev/null
@@ -1,39 +0,0 @@
1#ifndef _ASM_M32R_SIGCONTEXT_H
2#define _ASM_M32R_SIGCONTEXT_H
3
4struct sigcontext {
5 /* CPU registers */
6 /* Saved main processor registers. */
7 unsigned long sc_r4;
8 unsigned long sc_r5;
9 unsigned long sc_r6;
10 struct pt_regs *sc_pt_regs;
11 unsigned long sc_r0;
12 unsigned long sc_r1;
13 unsigned long sc_r2;
14 unsigned long sc_r3;
15 unsigned long sc_r7;
16 unsigned long sc_r8;
17 unsigned long sc_r9;
18 unsigned long sc_r10;
19 unsigned long sc_r11;
20 unsigned long sc_r12;
21
22 /* Saved main processor status and miscellaneous context registers. */
23 unsigned long sc_acc0h;
24 unsigned long sc_acc0l;
25 unsigned long sc_acc1h; /* ISA_DSP_LEVEL2 only */
26 unsigned long sc_acc1l; /* ISA_DSP_LEVEL2 only */
27 unsigned long sc_psw;
28 unsigned long sc_bpc; /* saved PC for TRAP syscalls */
29 unsigned long sc_bbpsw;
30 unsigned long sc_bbpc;
31 unsigned long sc_spu; /* saved user stack */
32 unsigned long sc_fp;
33 unsigned long sc_lr; /* saved PC for JL syscalls */
34 unsigned long sc_spi; /* saved kernel stack */
35
36 unsigned long oldmask;
37};
38
39#endif /* _ASM_M32R_SIGCONTEXT_H */
diff --git a/include/asm-m32r/siginfo.h b/include/asm-m32r/siginfo.h
deleted file mode 100644
index 7d9cd9ebfd0e..000000000000
--- a/include/asm-m32r/siginfo.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _M32R_SIGINFO_H
2#define _M32R_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif /* _M32R_SIGINFO_H */
diff --git a/include/asm-m32r/signal.h b/include/asm-m32r/signal.h
deleted file mode 100644
index 1a607066bc64..000000000000
--- a/include/asm-m32r/signal.h
+++ /dev/null
@@ -1,166 +0,0 @@
1#ifndef _ASM_M32R_SIGNAL_H
2#define _ASM_M32R_SIGNAL_H
3
4#include <linux/types.h>
5#include <linux/time.h>
6#include <linux/compiler.h>
7
8/* Avoid too many header ordering problems. */
9struct siginfo;
10
11#ifdef __KERNEL__
12/* Most things should be clean enough to redefine this at will, if care
13 is taken to make libc match. */
14
15#define _NSIG 64
16#define _NSIG_BPW 32
17#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
18
19typedef unsigned long old_sigset_t; /* at least 32 bits */
20
21typedef struct {
22 unsigned long sig[_NSIG_WORDS];
23} sigset_t;
24
25#else
26/* Here we must cater to libcs that poke about in kernel headers. */
27
28#define NSIG 32
29typedef unsigned long sigset_t;
30
31#endif /* __KERNEL__ */
32
33#define SIGHUP 1
34#define SIGINT 2
35#define SIGQUIT 3
36#define SIGILL 4
37#define SIGTRAP 5
38#define SIGABRT 6
39#define SIGIOT 6
40#define SIGBUS 7
41#define SIGFPE 8
42#define SIGKILL 9
43#define SIGUSR1 10
44#define SIGSEGV 11
45#define SIGUSR2 12
46#define SIGPIPE 13
47#define SIGALRM 14
48#define SIGTERM 15
49#define SIGSTKFLT 16
50#define SIGCHLD 17
51#define SIGCONT 18
52#define SIGSTOP 19
53#define SIGTSTP 20
54#define SIGTTIN 21
55#define SIGTTOU 22
56#define SIGURG 23
57#define SIGXCPU 24
58#define SIGXFSZ 25
59#define SIGVTALRM 26
60#define SIGPROF 27
61#define SIGWINCH 28
62#define SIGIO 29
63#define SIGPOLL SIGIO
64/*
65#define SIGLOST 29
66*/
67#define SIGPWR 30
68#define SIGSYS 31
69#define SIGUNUSED 31
70
71/* These should not be considered constants from userland. */
72#define SIGRTMIN 32
73#define SIGRTMAX _NSIG
74
75/*
76 * SA_FLAGS values:
77 *
78 * SA_ONSTACK indicates that a registered stack_t will be used.
79 * SA_RESTART flag to get restarting signals (which were the default long ago)
80 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
81 * SA_RESETHAND clears the handler when the signal is delivered.
82 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
83 * SA_NODEFER prevents the current signal from being masked in the handler.
84 *
85 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
86 * Unix names RESETHAND and NODEFER respectively.
87 */
88#define SA_NOCLDSTOP 0x00000001u
89#define SA_NOCLDWAIT 0x00000002u
90#define SA_SIGINFO 0x00000004u
91#define SA_ONSTACK 0x08000000u
92#define SA_RESTART 0x10000000u
93#define SA_NODEFER 0x40000000u
94#define SA_RESETHAND 0x80000000u
95
96#define SA_NOMASK SA_NODEFER
97#define SA_ONESHOT SA_RESETHAND
98
99#define SA_RESTORER 0x04000000
100
101/*
102 * sigaltstack controls
103 */
104#define SS_ONSTACK 1
105#define SS_DISABLE 2
106
107#define MINSIGSTKSZ 2048
108#define SIGSTKSZ 8192
109
110#include <asm-generic/signal.h>
111
112#ifdef __KERNEL__
113struct old_sigaction {
114 __sighandler_t sa_handler;
115 old_sigset_t sa_mask;
116 unsigned long sa_flags;
117 __sigrestore_t sa_restorer;
118};
119
120struct sigaction {
121 __sighandler_t sa_handler;
122 unsigned long sa_flags;
123 __sigrestore_t sa_restorer;
124 sigset_t sa_mask; /* mask last for extensibility */
125};
126
127struct k_sigaction {
128 struct sigaction sa;
129};
130#else
131/* Here we must cater to libcs that poke about in kernel headers. */
132
133struct sigaction {
134 union {
135 __sighandler_t _sa_handler;
136 void (*_sa_sigaction)(int, struct siginfo *, void *);
137 } _u;
138 sigset_t sa_mask;
139 unsigned long sa_flags;
140 void (*sa_restorer)(void);
141};
142
143#define sa_handler _u._sa_handler
144#define sa_sigaction _u._sa_sigaction
145
146#endif /* __KERNEL__ */
147
148typedef struct sigaltstack {
149 void __user *ss_sp;
150 int ss_flags;
151 size_t ss_size;
152} stack_t;
153
154#ifdef __KERNEL__
155#include <asm/sigcontext.h>
156
157#undef __HAVE_ARCH_SIG_BITOPS
158
159struct pt_regs;
160extern int do_signal(struct pt_regs *regs, sigset_t *oldset);
161
162#define ptrace_signal_deliver(regs, cookie) do { } while (0)
163
164#endif /* __KERNEL__ */
165
166#endif /* _ASM_M32R_SIGNAL_H */
diff --git a/include/asm-m32r/smp.h b/include/asm-m32r/smp.h
deleted file mode 100644
index b96a6d2ffbc3..000000000000
--- a/include/asm-m32r/smp.h
+++ /dev/null
@@ -1,119 +0,0 @@
1#ifndef _ASM_M32R_SMP_H
2#define _ASM_M32R_SMP_H
3
4#ifdef CONFIG_SMP
5#ifndef __ASSEMBLY__
6
7#include <linux/cpumask.h>
8#include <linux/spinlock.h>
9#include <linux/threads.h>
10#include <asm/m32r.h>
11
12#define PHYSID_ARRAY_SIZE 1
13
14struct physid_mask
15{
16 unsigned long mask[PHYSID_ARRAY_SIZE];
17};
18
19typedef struct physid_mask physid_mask_t;
20
21#define physid_set(physid, map) set_bit(physid, (map).mask)
22#define physid_clear(physid, map) clear_bit(physid, (map).mask)
23#define physid_isset(physid, map) test_bit(physid, (map).mask)
24#define physid_test_and_set(physid, map) test_and_set_bit(physid, (map).mask)
25
26#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
27#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
28#define physids_clear(map) bitmap_zero((map).mask, MAX_APICS)
29#define physids_complement(dst, src) bitmap_complement((dst).mask,(src).mask, MAX_APICS)
30#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
31#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
32#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS)
33#define physids_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
34#define physids_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
35#define physids_coerce(map) ((map).mask[0])
36
37#define physids_promote(physids) \
38 ({ \
39 physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
40 __physid_mask.mask[0] = physids; \
41 __physid_mask; \
42 })
43
44#define physid_mask_of_physid(physid) \
45 ({ \
46 physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
47 physid_set(physid, __physid_mask); \
48 __physid_mask; \
49 })
50
51#define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
52#define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
53
54extern physid_mask_t phys_cpu_present_map;
55
56/*
57 * Some lowlevel functions might want to know about
58 * the real CPU ID <-> CPU # mapping.
59 */
60extern volatile int cpu_2_physid[NR_CPUS];
61#define cpu_to_physid(cpu_id) cpu_2_physid[cpu_id]
62
63#define raw_smp_processor_id() (current_thread_info()->cpu)
64
65extern cpumask_t cpu_callout_map;
66
67static __inline__ int hard_smp_processor_id(void)
68{
69 return (int)*(volatile long *)M32R_CPUID_PORTL;
70}
71
72static __inline__ int cpu_logical_map(int cpu)
73{
74 return cpu;
75}
76
77static __inline__ int cpu_number_map(int cpu)
78{
79 return cpu;
80}
81
82static __inline__ unsigned int num_booting_cpus(void)
83{
84 return cpus_weight(cpu_callout_map);
85}
86
87extern void smp_send_timer(void);
88extern unsigned long send_IPI_mask_phys(cpumask_t, int, int);
89
90extern void arch_send_call_function_single_ipi(int cpu);
91extern void arch_send_call_function_ipi(cpumask_t mask);
92
93#endif /* not __ASSEMBLY__ */
94
95#define NO_PROC_ID (0xff) /* No processor magic marker */
96
97#define PROC_CHANGE_PENALTY (15) /* Schedule penalty */
98
99/*
100 * M32R-mp IPI
101 */
102#define RESCHEDULE_IPI (M32R_IRQ_IPI0-M32R_IRQ_IPI0)
103#define INVALIDATE_TLB_IPI (M32R_IRQ_IPI1-M32R_IRQ_IPI0)
104#define CALL_FUNCTION_IPI (M32R_IRQ_IPI2-M32R_IRQ_IPI0)
105#define LOCAL_TIMER_IPI (M32R_IRQ_IPI3-M32R_IRQ_IPI0)
106#define INVALIDATE_CACHE_IPI (M32R_IRQ_IPI4-M32R_IRQ_IPI0)
107#define CPU_BOOT_IPI (M32R_IRQ_IPI5-M32R_IRQ_IPI0)
108#define CALL_FUNC_SINGLE_IPI (M32R_IRQ_IPI6-M32R_IRQ_IPI0)
109
110#define IPI_SHIFT (0)
111#define NR_IPIS (8)
112
113#else /* CONFIG_SMP */
114
115#define hard_smp_processor_id() 0
116
117#endif /* CONFIG_SMP */
118
119#endif /* _ASM_M32R_SMP_H */
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
deleted file mode 100644
index 9a0e20012224..000000000000
--- a/include/asm-m32r/socket.h
+++ /dev/null
@@ -1,57 +0,0 @@
1#ifndef _ASM_M32R_SOCKET_H
2#define _ASM_M32R_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockoptions(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#endif /* _ASM_M32R_SOCKET_H */
diff --git a/include/asm-m32r/sockios.h b/include/asm-m32r/sockios.h
deleted file mode 100644
index 6c1fb9b43bdb..000000000000
--- a/include/asm-m32r/sockios.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_M32R_SOCKIOS_H
2#define _ASM_M32R_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 (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif /* _ASM_M32R_SOCKIOS_H */
diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h
deleted file mode 100644
index f5cfba81ee10..000000000000
--- a/include/asm-m32r/spinlock.h
+++ /dev/null
@@ -1,323 +0,0 @@
1#ifndef _ASM_M32R_SPINLOCK_H
2#define _ASM_M32R_SPINLOCK_H
3
4/*
5 * linux/include/asm-m32r/spinlock.h
6 *
7 * M32R version:
8 * Copyright (C) 2001, 2002 Hitoshi Yamamoto
9 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
10 */
11
12#include <linux/compiler.h>
13#include <asm/atomic.h>
14#include <asm/page.h>
15
16/*
17 * Your basic SMP spinlocks, allowing only a single CPU anywhere
18 *
19 * (the type definitions are in asm/spinlock_types.h)
20 *
21 * Simple spin lock operations. There are two variants, one clears IRQ's
22 * on the local processor, one does not.
23 *
24 * We make no fairness assumptions. They have a cost.
25 */
26
27#define __raw_spin_is_locked(x) (*(volatile int *)(&(x)->slock) <= 0)
28#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
29#define __raw_spin_unlock_wait(x) \
30 do { cpu_relax(); } while (__raw_spin_is_locked(x))
31
32/**
33 * __raw_spin_trylock - Try spin lock and return a result
34 * @lock: Pointer to the lock variable
35 *
36 * __raw_spin_trylock() tries to get the lock and returns a result.
37 * On the m32r, the result value is 1 (= Success) or 0 (= Failure).
38 */
39static inline int __raw_spin_trylock(raw_spinlock_t *lock)
40{
41 int oldval;
42 unsigned long tmp1, tmp2;
43
44 /*
45 * lock->slock : =1 : unlock
46 * : <=0 : lock
47 * {
48 * oldval = lock->slock; <--+ need atomic operation
49 * lock->slock = 0; <--+
50 * }
51 */
52 __asm__ __volatile__ (
53 "# __raw_spin_trylock \n\t"
54 "ldi %1, #0; \n\t"
55 "mvfc %2, psw; \n\t"
56 "clrpsw #0x40 -> nop; \n\t"
57 DCACHE_CLEAR("%0", "r6", "%3")
58 "lock %0, @%3; \n\t"
59 "unlock %1, @%3; \n\t"
60 "mvtc %2, psw; \n\t"
61 : "=&r" (oldval), "=&r" (tmp1), "=&r" (tmp2)
62 : "r" (&lock->slock)
63 : "memory"
64#ifdef CONFIG_CHIP_M32700_TS1
65 , "r6"
66#endif /* CONFIG_CHIP_M32700_TS1 */
67 );
68
69 return (oldval > 0);
70}
71
72static inline void __raw_spin_lock(raw_spinlock_t *lock)
73{
74 unsigned long tmp0, tmp1;
75
76 /*
77 * lock->slock : =1 : unlock
78 * : <=0 : lock
79 *
80 * for ( ; ; ) {
81 * lock->slock -= 1; <-- need atomic operation
82 * if (lock->slock == 0) break;
83 * for ( ; lock->slock <= 0 ; );
84 * }
85 */
86 __asm__ __volatile__ (
87 "# __raw_spin_lock \n\t"
88 ".fillinsn \n"
89 "1: \n\t"
90 "mvfc %1, psw; \n\t"
91 "clrpsw #0x40 -> nop; \n\t"
92 DCACHE_CLEAR("%0", "r6", "%2")
93 "lock %0, @%2; \n\t"
94 "addi %0, #-1; \n\t"
95 "unlock %0, @%2; \n\t"
96 "mvtc %1, psw; \n\t"
97 "bltz %0, 2f; \n\t"
98 LOCK_SECTION_START(".balign 4 \n\t")
99 ".fillinsn \n"
100 "2: \n\t"
101 "ld %0, @%2; \n\t"
102 "bgtz %0, 1b; \n\t"
103 "bra 2b; \n\t"
104 LOCK_SECTION_END
105 : "=&r" (tmp0), "=&r" (tmp1)
106 : "r" (&lock->slock)
107 : "memory"
108#ifdef CONFIG_CHIP_M32700_TS1
109 , "r6"
110#endif /* CONFIG_CHIP_M32700_TS1 */
111 );
112}
113
114static inline void __raw_spin_unlock(raw_spinlock_t *lock)
115{
116 mb();
117 lock->slock = 1;
118}
119
120/*
121 * Read-write spinlocks, allowing multiple readers
122 * but only one writer.
123 *
124 * NOTE! it is quite common to have readers in interrupts
125 * but no interrupt writers. For those circumstances we
126 * can "mix" irq-safe locks - any writer needs to get a
127 * irq-safe write-lock, but readers can get non-irqsafe
128 * read-locks.
129 *
130 * On x86, we implement read-write locks as a 32-bit counter
131 * with the high bit (sign) being the "contended" bit.
132 *
133 * The inline assembly is non-obvious. Think about it.
134 *
135 * Changed to use the same technique as rw semaphores. See
136 * semaphore.h for details. -ben
137 */
138
139/**
140 * read_can_lock - would read_trylock() succeed?
141 * @lock: the rwlock in question.
142 */
143#define __raw_read_can_lock(x) ((int)(x)->lock > 0)
144
145/**
146 * write_can_lock - would write_trylock() succeed?
147 * @lock: the rwlock in question.
148 */
149#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
150
151static inline void __raw_read_lock(raw_rwlock_t *rw)
152{
153 unsigned long tmp0, tmp1;
154
155 /*
156 * rw->lock : >0 : unlock
157 * : <=0 : lock
158 *
159 * for ( ; ; ) {
160 * rw->lock -= 1; <-- need atomic operation
161 * if (rw->lock >= 0) break;
162 * rw->lock += 1; <-- need atomic operation
163 * for ( ; rw->lock <= 0 ; );
164 * }
165 */
166 __asm__ __volatile__ (
167 "# read_lock \n\t"
168 ".fillinsn \n"
169 "1: \n\t"
170 "mvfc %1, psw; \n\t"
171 "clrpsw #0x40 -> nop; \n\t"
172 DCACHE_CLEAR("%0", "r6", "%2")
173 "lock %0, @%2; \n\t"
174 "addi %0, #-1; \n\t"
175 "unlock %0, @%2; \n\t"
176 "mvtc %1, psw; \n\t"
177 "bltz %0, 2f; \n\t"
178 LOCK_SECTION_START(".balign 4 \n\t")
179 ".fillinsn \n"
180 "2: \n\t"
181 "clrpsw #0x40 -> nop; \n\t"
182 DCACHE_CLEAR("%0", "r6", "%2")
183 "lock %0, @%2; \n\t"
184 "addi %0, #1; \n\t"
185 "unlock %0, @%2; \n\t"
186 "mvtc %1, psw; \n\t"
187 ".fillinsn \n"
188 "3: \n\t"
189 "ld %0, @%2; \n\t"
190 "bgtz %0, 1b; \n\t"
191 "bra 3b; \n\t"
192 LOCK_SECTION_END
193 : "=&r" (tmp0), "=&r" (tmp1)
194 : "r" (&rw->lock)
195 : "memory"
196#ifdef CONFIG_CHIP_M32700_TS1
197 , "r6"
198#endif /* CONFIG_CHIP_M32700_TS1 */
199 );
200}
201
202static inline void __raw_write_lock(raw_rwlock_t *rw)
203{
204 unsigned long tmp0, tmp1, tmp2;
205
206 /*
207 * rw->lock : =RW_LOCK_BIAS_STR : unlock
208 * : !=RW_LOCK_BIAS_STR : lock
209 *
210 * for ( ; ; ) {
211 * rw->lock -= RW_LOCK_BIAS_STR; <-- need atomic operation
212 * if (rw->lock == 0) break;
213 * rw->lock += RW_LOCK_BIAS_STR; <-- need atomic operation
214 * for ( ; rw->lock != RW_LOCK_BIAS_STR ; ) ;
215 * }
216 */
217 __asm__ __volatile__ (
218 "# write_lock \n\t"
219 "seth %1, #high(" RW_LOCK_BIAS_STR "); \n\t"
220 "or3 %1, %1, #low(" RW_LOCK_BIAS_STR "); \n\t"
221 ".fillinsn \n"
222 "1: \n\t"
223 "mvfc %2, psw; \n\t"
224 "clrpsw #0x40 -> nop; \n\t"
225 DCACHE_CLEAR("%0", "r7", "%3")
226 "lock %0, @%3; \n\t"
227 "sub %0, %1; \n\t"
228 "unlock %0, @%3; \n\t"
229 "mvtc %2, psw; \n\t"
230 "bnez %0, 2f; \n\t"
231 LOCK_SECTION_START(".balign 4 \n\t")
232 ".fillinsn \n"
233 "2: \n\t"
234 "clrpsw #0x40 -> nop; \n\t"
235 DCACHE_CLEAR("%0", "r7", "%3")
236 "lock %0, @%3; \n\t"
237 "add %0, %1; \n\t"
238 "unlock %0, @%3; \n\t"
239 "mvtc %2, psw; \n\t"
240 ".fillinsn \n"
241 "3: \n\t"
242 "ld %0, @%3; \n\t"
243 "beq %0, %1, 1b; \n\t"
244 "bra 3b; \n\t"
245 LOCK_SECTION_END
246 : "=&r" (tmp0), "=&r" (tmp1), "=&r" (tmp2)
247 : "r" (&rw->lock)
248 : "memory"
249#ifdef CONFIG_CHIP_M32700_TS1
250 , "r7"
251#endif /* CONFIG_CHIP_M32700_TS1 */
252 );
253}
254
255static inline void __raw_read_unlock(raw_rwlock_t *rw)
256{
257 unsigned long tmp0, tmp1;
258
259 __asm__ __volatile__ (
260 "# read_unlock \n\t"
261 "mvfc %1, psw; \n\t"
262 "clrpsw #0x40 -> nop; \n\t"
263 DCACHE_CLEAR("%0", "r6", "%2")
264 "lock %0, @%2; \n\t"
265 "addi %0, #1; \n\t"
266 "unlock %0, @%2; \n\t"
267 "mvtc %1, psw; \n\t"
268 : "=&r" (tmp0), "=&r" (tmp1)
269 : "r" (&rw->lock)
270 : "memory"
271#ifdef CONFIG_CHIP_M32700_TS1
272 , "r6"
273#endif /* CONFIG_CHIP_M32700_TS1 */
274 );
275}
276
277static inline void __raw_write_unlock(raw_rwlock_t *rw)
278{
279 unsigned long tmp0, tmp1, tmp2;
280
281 __asm__ __volatile__ (
282 "# write_unlock \n\t"
283 "seth %1, #high(" RW_LOCK_BIAS_STR "); \n\t"
284 "or3 %1, %1, #low(" RW_LOCK_BIAS_STR "); \n\t"
285 "mvfc %2, psw; \n\t"
286 "clrpsw #0x40 -> nop; \n\t"
287 DCACHE_CLEAR("%0", "r7", "%3")
288 "lock %0, @%3; \n\t"
289 "add %0, %1; \n\t"
290 "unlock %0, @%3; \n\t"
291 "mvtc %2, psw; \n\t"
292 : "=&r" (tmp0), "=&r" (tmp1), "=&r" (tmp2)
293 : "r" (&rw->lock)
294 : "memory"
295#ifdef CONFIG_CHIP_M32700_TS1
296 , "r7"
297#endif /* CONFIG_CHIP_M32700_TS1 */
298 );
299}
300
301static inline int __raw_read_trylock(raw_rwlock_t *lock)
302{
303 atomic_t *count = (atomic_t*)lock;
304 if (atomic_dec_return(count) >= 0)
305 return 1;
306 atomic_inc(count);
307 return 0;
308}
309
310static inline int __raw_write_trylock(raw_rwlock_t *lock)
311{
312 atomic_t *count = (atomic_t *)lock;
313 if (atomic_sub_and_test(RW_LOCK_BIAS, count))
314 return 1;
315 atomic_add(RW_LOCK_BIAS, count);
316 return 0;
317}
318
319#define _raw_spin_relax(lock) cpu_relax()
320#define _raw_read_relax(lock) cpu_relax()
321#define _raw_write_relax(lock) cpu_relax()
322
323#endif /* _ASM_M32R_SPINLOCK_H */
diff --git a/include/asm-m32r/spinlock_types.h b/include/asm-m32r/spinlock_types.h
deleted file mode 100644
index 83f52105c0e4..000000000000
--- a/include/asm-m32r/spinlock_types.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _ASM_M32R_SPINLOCK_TYPES_H
2#define _ASM_M32R_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile int slock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
13
14typedef struct {
15 volatile int lock;
16} raw_rwlock_t;
17
18#define RW_LOCK_BIAS 0x01000000
19#define RW_LOCK_BIAS_STR "0x01000000"
20
21#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
22
23#endif /* _ASM_M32R_SPINLOCK_TYPES_H */
diff --git a/include/asm-m32r/stat.h b/include/asm-m32r/stat.h
deleted file mode 100644
index da4518f82d6d..000000000000
--- a/include/asm-m32r/stat.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef _ASM_M32R_STAT_H
2#define _ASM_M32R_STAT_H
3
4#include <asm/byteorder.h>
5
6struct __old_kernel_stat {
7 unsigned short st_dev;
8 unsigned short st_ino;
9 unsigned short st_mode;
10 unsigned short st_nlink;
11 unsigned short st_uid;
12 unsigned short st_gid;
13 unsigned short st_rdev;
14 unsigned long st_size;
15 unsigned long st_atime;
16 unsigned long st_mtime;
17 unsigned long st_ctime;
18};
19
20#define STAT_HAVE_NSEC 1
21
22struct stat {
23 unsigned short st_dev;
24 unsigned short __pad1;
25 unsigned long st_ino;
26 unsigned short st_mode;
27 unsigned short st_nlink;
28 unsigned short st_uid;
29 unsigned short st_gid;
30 unsigned short st_rdev;
31 unsigned short __pad2;
32 unsigned long st_size;
33 unsigned long st_blksize;
34 unsigned long st_blocks;
35 unsigned long st_atime;
36 unsigned long st_atime_nsec;
37 unsigned long st_mtime;
38 unsigned long st_mtime_nsec;
39 unsigned long st_ctime;
40 unsigned long st_ctime_nsec;
41 unsigned long __unused4;
42 unsigned long __unused5;
43};
44
45/* This matches struct stat64 in glibc2.1, hence the absolutely
46 * insane amounts of padding around dev_t's.
47 */
48struct stat64 {
49 unsigned long long st_dev;
50 unsigned char __pad0[4];
51#define STAT64_HAS_BROKEN_ST_INO
52 unsigned long __st_ino;
53
54 unsigned int st_mode;
55 unsigned int st_nlink;
56
57 unsigned long st_uid;
58 unsigned long st_gid;
59
60 unsigned long long st_rdev;
61 unsigned char __pad3[4];
62
63 long long st_size;
64 unsigned long st_blksize;
65
66#if defined(__BIG_ENDIAN)
67 unsigned long __pad4; /* future possible st_blocks high bits */
68 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
69#elif defined(__LITTLE_ENDIAN)
70 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
71 unsigned long __pad4; /* future possible st_blocks high bits */
72#else
73#error no endian defined
74#endif
75 unsigned long st_atime;
76 unsigned long st_atime_nsec;
77
78 unsigned long st_mtime;
79 unsigned long st_mtime_nsec;
80
81 unsigned long st_ctime;
82 unsigned long st_ctime_nsec;
83
84 unsigned long long st_ino;
85};
86
87#endif /* _ASM_M32R_STAT_H */
diff --git a/include/asm-m32r/statfs.h b/include/asm-m32r/statfs.h
deleted file mode 100644
index 6eb4c6007e6b..000000000000
--- a/include/asm-m32r/statfs.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_M32R_STATFS_H
2#define _ASM_M32R_STATFS_H
3
4#include <asm-generic/statfs.h>
5
6#endif /* _ASM_M32R_STATFS_H */
diff --git a/include/asm-m32r/string.h b/include/asm-m32r/string.h
deleted file mode 100644
index e61e2b0bfc1f..000000000000
--- a/include/asm-m32r/string.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_M32R_STRING_H
2#define _ASM_M32R_STRING_H
3
4#define __HAVE_ARCH_STRLEN
5extern size_t strlen(const char * s);
6
7#define __HAVE_ARCH_MEMCPY
8extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
9
10#define __HAVE_ARCH_MEMSET
11extern void *memset(void *__s, int __c, size_t __count);
12
13#endif /* _ASM_M32R_STRING_H */
diff --git a/include/asm-m32r/swab.h b/include/asm-m32r/swab.h
deleted file mode 100644
index 97973e101825..000000000000
--- a/include/asm-m32r/swab.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _ASM_M32R_SWAB_H
2#define _ASM_M32R_SWAB_H
3
4#include <asm/types.h>
5
6#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
7# define __SWAB_64_THRU_32__
8#endif
9
10#endif /* _ASM_M32R_SWAB_H */
diff --git a/include/asm-m32r/syscall.h b/include/asm-m32r/syscall.h
deleted file mode 100644
index 25f316f2b78d..000000000000
--- a/include/asm-m32r/syscall.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _ASM_M32R_SYSCALL_H
2#define _ASM_M32R_SYSCALL_H
3
4/* Definitions for the system call vector. */
5#define SYSCALL_VECTOR "2"
6#define SYSCALL_VECTOR_ADDRESS "0xa0"
7
8#endif /* _ASM_M32R_SYSCALL_H */
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
deleted file mode 100644
index c980f5ba8de7..000000000000
--- a/include/asm-m32r/system.h
+++ /dev/null
@@ -1,431 +0,0 @@
1#ifndef _ASM_M32R_SYSTEM_H
2#define _ASM_M32R_SYSTEM_H
3
4/*
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *
9 * Copyright (C) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto
10 * Copyright (C) 2004, 2006 Hirokazu Takata <takata at linux-m32r.org>
11 */
12
13#include <linux/compiler.h>
14#include <asm/assembler.h>
15
16#ifdef __KERNEL__
17
18/*
19 * switch_to(prev, next) should switch from task `prev' to `next'
20 * `prev' will never be the same as `next'.
21 *
22 * `next' and `prev' should be struct task_struct, but it isn't always defined
23 */
24
25#if defined(CONFIG_FRAME_POINTER) || \
26 !defined(CONFIG_SCHED_OMIT_FRAME_POINTER)
27#define M32R_PUSH_FP " push fp\n"
28#define M32R_POP_FP " pop fp\n"
29#else
30#define M32R_PUSH_FP ""
31#define M32R_POP_FP ""
32#endif
33
34#define switch_to(prev, next, last) do { \
35 __asm__ __volatile__ ( \
36 " seth lr, #high(1f) \n" \
37 " or3 lr, lr, #low(1f) \n" \
38 " st lr, @%4 ; store old LR \n" \
39 " ld lr, @%5 ; load new LR \n" \
40 M32R_PUSH_FP \
41 " st sp, @%2 ; store old SP \n" \
42 " ld sp, @%3 ; load new SP \n" \
43 " push %1 ; store `prev' on new stack \n" \
44 " jmp lr \n" \
45 " .fillinsn \n" \
46 "1: \n" \
47 " pop %0 ; restore `__last' from new stack \n" \
48 M32R_POP_FP \
49 : "=r" (last) \
50 : "0" (prev), \
51 "r" (&(prev->thread.sp)), "r" (&(next->thread.sp)), \
52 "r" (&(prev->thread.lr)), "r" (&(next->thread.lr)) \
53 : "memory", "lr" \
54 ); \
55} while(0)
56
57/* Interrupt Control */
58#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104)
59#define local_irq_enable() \
60 __asm__ __volatile__ ("setpsw #0x40 -> nop": : :"memory")
61#define local_irq_disable() \
62 __asm__ __volatile__ ("clrpsw #0x40 -> nop": : :"memory")
63#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
64static inline void local_irq_enable(void)
65{
66 unsigned long tmpreg;
67 __asm__ __volatile__(
68 "mvfc %0, psw; \n\t"
69 "or3 %0, %0, #0x0040; \n\t"
70 "mvtc %0, psw; \n\t"
71 : "=&r" (tmpreg) : : "cbit", "memory");
72}
73
74static inline void local_irq_disable(void)
75{
76 unsigned long tmpreg0, tmpreg1;
77 __asm__ __volatile__(
78 "ld24 %0, #0 ; Use 32-bit insn. \n\t"
79 "mvfc %1, psw ; No interrupt can be accepted here. \n\t"
80 "mvtc %0, psw \n\t"
81 "and3 %0, %1, #0xffbf \n\t"
82 "mvtc %0, psw \n\t"
83 : "=&r" (tmpreg0), "=&r" (tmpreg1) : : "cbit", "memory");
84}
85#endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
86
87#define local_save_flags(x) \
88 __asm__ __volatile__("mvfc %0,psw" : "=r"(x) : /* no input */)
89
90#define local_irq_restore(x) \
91 __asm__ __volatile__("mvtc %0,psw" : /* no outputs */ \
92 : "r" (x) : "cbit", "memory")
93
94#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
95#define local_irq_save(x) \
96 __asm__ __volatile__( \
97 "mvfc %0, psw; \n\t" \
98 "clrpsw #0x40 -> nop; \n\t" \
99 : "=r" (x) : /* no input */ : "memory")
100#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
101#define local_irq_save(x) \
102 ({ \
103 unsigned long tmpreg; \
104 __asm__ __volatile__( \
105 "ld24 %1, #0 \n\t" \
106 "mvfc %0, psw \n\t" \
107 "mvtc %1, psw \n\t" \
108 "and3 %1, %0, #0xffbf \n\t" \
109 "mvtc %1, psw \n\t" \
110 : "=r" (x), "=&r" (tmpreg) \
111 : : "cbit", "memory"); \
112 })
113#endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
114
115#define irqs_disabled() \
116 ({ \
117 unsigned long flags; \
118 local_save_flags(flags); \
119 !(flags & 0x40); \
120 })
121
122#define nop() __asm__ __volatile__ ("nop" : : )
123
124#define xchg(ptr, x) \
125 ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
126#define xchg_local(ptr, x) \
127 ((__typeof__(*(ptr)))__xchg_local((unsigned long)(x), (ptr), \
128 sizeof(*(ptr))))
129
130extern void __xchg_called_with_bad_pointer(void);
131
132#ifdef CONFIG_CHIP_M32700_TS1
133#define DCACHE_CLEAR(reg0, reg1, addr) \
134 "seth "reg1", #high(dcache_dummy); \n\t" \
135 "or3 "reg1", "reg1", #low(dcache_dummy); \n\t" \
136 "lock "reg0", @"reg1"; \n\t" \
137 "add3 "reg0", "addr", #0x1000; \n\t" \
138 "ld "reg0", @"reg0"; \n\t" \
139 "add3 "reg0", "addr", #0x2000; \n\t" \
140 "ld "reg0", @"reg0"; \n\t" \
141 "unlock "reg0", @"reg1"; \n\t"
142 /* FIXME: This workaround code cannot handle kernel modules
143 * correctly under SMP environment.
144 */
145#else /* CONFIG_CHIP_M32700_TS1 */
146#define DCACHE_CLEAR(reg0, reg1, addr)
147#endif /* CONFIG_CHIP_M32700_TS1 */
148
149static __always_inline unsigned long
150__xchg(unsigned long x, volatile void *ptr, int size)
151{
152 unsigned long flags;
153 unsigned long tmp = 0;
154
155 local_irq_save(flags);
156
157 switch (size) {
158#ifndef CONFIG_SMP
159 case 1:
160 __asm__ __volatile__ (
161 "ldb %0, @%2 \n\t"
162 "stb %1, @%2 \n\t"
163 : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory");
164 break;
165 case 2:
166 __asm__ __volatile__ (
167 "ldh %0, @%2 \n\t"
168 "sth %1, @%2 \n\t"
169 : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory");
170 break;
171 case 4:
172 __asm__ __volatile__ (
173 "ld %0, @%2 \n\t"
174 "st %1, @%2 \n\t"
175 : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory");
176 break;
177#else /* CONFIG_SMP */
178 case 4:
179 __asm__ __volatile__ (
180 DCACHE_CLEAR("%0", "r4", "%2")
181 "lock %0, @%2; \n\t"
182 "unlock %1, @%2; \n\t"
183 : "=&r" (tmp) : "r" (x), "r" (ptr)
184 : "memory"
185#ifdef CONFIG_CHIP_M32700_TS1
186 , "r4"
187#endif /* CONFIG_CHIP_M32700_TS1 */
188 );
189 break;
190#endif /* CONFIG_SMP */
191 default:
192 __xchg_called_with_bad_pointer();
193 }
194
195 local_irq_restore(flags);
196
197 return (tmp);
198}
199
200static __always_inline unsigned long
201__xchg_local(unsigned long x, volatile void *ptr, int size)
202{
203 unsigned long flags;
204 unsigned long tmp = 0;
205
206 local_irq_save(flags);
207
208 switch (size) {
209 case 1:
210 __asm__ __volatile__ (
211 "ldb %0, @%2 \n\t"
212 "stb %1, @%2 \n\t"
213 : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory");
214 break;
215 case 2:
216 __asm__ __volatile__ (
217 "ldh %0, @%2 \n\t"
218 "sth %1, @%2 \n\t"
219 : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory");
220 break;
221 case 4:
222 __asm__ __volatile__ (
223 "ld %0, @%2 \n\t"
224 "st %1, @%2 \n\t"
225 : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory");
226 break;
227 default:
228 __xchg_called_with_bad_pointer();
229 }
230
231 local_irq_restore(flags);
232
233 return (tmp);
234}
235
236#define __HAVE_ARCH_CMPXCHG 1
237
238static inline unsigned long
239__cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
240{
241 unsigned long flags;
242 unsigned int retval;
243
244 local_irq_save(flags);
245 __asm__ __volatile__ (
246 DCACHE_CLEAR("%0", "r4", "%1")
247 M32R_LOCK" %0, @%1; \n"
248 " bne %0, %2, 1f; \n"
249 M32R_UNLOCK" %3, @%1; \n"
250 " bra 2f; \n"
251 " .fillinsn \n"
252 "1:"
253 M32R_UNLOCK" %0, @%1; \n"
254 " .fillinsn \n"
255 "2:"
256 : "=&r" (retval)
257 : "r" (p), "r" (old), "r" (new)
258 : "cbit", "memory"
259#ifdef CONFIG_CHIP_M32700_TS1
260 , "r4"
261#endif /* CONFIG_CHIP_M32700_TS1 */
262 );
263 local_irq_restore(flags);
264
265 return retval;
266}
267
268static inline unsigned long
269__cmpxchg_local_u32(volatile unsigned int *p, unsigned int old,
270 unsigned int new)
271{
272 unsigned long flags;
273 unsigned int retval;
274
275 local_irq_save(flags);
276 __asm__ __volatile__ (
277 DCACHE_CLEAR("%0", "r4", "%1")
278 "ld %0, @%1; \n"
279 " bne %0, %2, 1f; \n"
280 "st %3, @%1; \n"
281 " bra 2f; \n"
282 " .fillinsn \n"
283 "1:"
284 "st %0, @%1; \n"
285 " .fillinsn \n"
286 "2:"
287 : "=&r" (retval)
288 : "r" (p), "r" (old), "r" (new)
289 : "cbit", "memory"
290#ifdef CONFIG_CHIP_M32700_TS1
291 , "r4"
292#endif /* CONFIG_CHIP_M32700_TS1 */
293 );
294 local_irq_restore(flags);
295
296 return retval;
297}
298
299/* This function doesn't exist, so you'll get a linker error
300 if something tries to do an invalid cmpxchg(). */
301extern void __cmpxchg_called_with_bad_pointer(void);
302
303static inline unsigned long
304__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
305{
306 switch (size) {
307 case 4:
308 return __cmpxchg_u32(ptr, old, new);
309#if 0 /* we don't have __cmpxchg_u64 */
310 case 8:
311 return __cmpxchg_u64(ptr, old, new);
312#endif /* 0 */
313 }
314 __cmpxchg_called_with_bad_pointer();
315 return old;
316}
317
318#define cmpxchg(ptr, o, n) \
319 ((__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)(o), \
320 (unsigned long)(n), sizeof(*(ptr))))
321
322#include <asm-generic/cmpxchg-local.h>
323
324static inline unsigned long __cmpxchg_local(volatile void *ptr,
325 unsigned long old,
326 unsigned long new, int size)
327{
328 switch (size) {
329 case 4:
330 return __cmpxchg_local_u32(ptr, old, new);
331 default:
332 return __cmpxchg_local_generic(ptr, old, new, size);
333 }
334
335 return old;
336}
337
338/*
339 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
340 * them available.
341 */
342#define cmpxchg_local(ptr, o, n) \
343 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
344 (unsigned long)(n), sizeof(*(ptr))))
345#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
346
347#endif /* __KERNEL__ */
348
349/*
350 * Memory barrier.
351 *
352 * mb() prevents loads and stores being reordered across this point.
353 * rmb() prevents loads being reordered across this point.
354 * wmb() prevents stores being reordered across this point.
355 */
356#define mb() barrier()
357#define rmb() mb()
358#define wmb() mb()
359
360/**
361 * read_barrier_depends - Flush all pending reads that subsequents reads
362 * depend on.
363 *
364 * No data-dependent reads from memory-like regions are ever reordered
365 * over this barrier. All reads preceding this primitive are guaranteed
366 * to access memory (but not necessarily other CPUs' caches) before any
367 * reads following this primitive that depend on the data return by
368 * any of the preceding reads. This primitive is much lighter weight than
369 * rmb() on most CPUs, and is never heavier weight than is
370 * rmb().
371 *
372 * These ordering constraints are respected by both the local CPU
373 * and the compiler.
374 *
375 * Ordering is not guaranteed by anything other than these primitives,
376 * not even by data dependencies. See the documentation for
377 * memory_barrier() for examples and URLs to more information.
378 *
379 * For example, the following code would force ordering (the initial
380 * value of "a" is zero, "b" is one, and "p" is "&a"):
381 *
382 * <programlisting>
383 * CPU 0 CPU 1
384 *
385 * b = 2;
386 * memory_barrier();
387 * p = &b; q = p;
388 * read_barrier_depends();
389 * d = *q;
390 * </programlisting>
391 *
392 *
393 * because the read of "*q" depends on the read of "p" and these
394 * two reads are separated by a read_barrier_depends(). However,
395 * the following code, with the same initial values for "a" and "b":
396 *
397 * <programlisting>
398 * CPU 0 CPU 1
399 *
400 * a = 2;
401 * memory_barrier();
402 * b = 3; y = b;
403 * read_barrier_depends();
404 * x = a;
405 * </programlisting>
406 *
407 * does not enforce ordering, since there is no data dependency between
408 * the read of "a" and the read of "b". Therefore, on some CPUs, such
409 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
410 * in cases like this where there are no data dependencies.
411 **/
412
413#define read_barrier_depends() do { } while (0)
414
415#ifdef CONFIG_SMP
416#define smp_mb() mb()
417#define smp_rmb() rmb()
418#define smp_wmb() wmb()
419#define smp_read_barrier_depends() read_barrier_depends()
420#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
421#else
422#define smp_mb() barrier()
423#define smp_rmb() barrier()
424#define smp_wmb() barrier()
425#define smp_read_barrier_depends() do { } while (0)
426#define set_mb(var, value) do { var = value; barrier(); } while (0)
427#endif
428
429#define arch_align_stack(x) (x)
430
431#endif /* _ASM_M32R_SYSTEM_H */
diff --git a/include/asm-m32r/termbits.h b/include/asm-m32r/termbits.h
deleted file mode 100644
index bc104008b55b..000000000000
--- a/include/asm-m32r/termbits.h
+++ /dev/null
@@ -1,199 +0,0 @@
1#ifndef _ASM_M32R_TERMBITS_H
2#define _ASM_M32R_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/* c_iflag bits */
62#define IGNBRK 0000001
63#define BRKINT 0000002
64#define IGNPAR 0000004
65#define PARMRK 0000010
66#define INPCK 0000020
67#define ISTRIP 0000040
68#define INLCR 0000100
69#define IGNCR 0000200
70#define ICRNL 0000400
71#define IUCLC 0001000
72#define IXON 0002000
73#define IXANY 0004000
74#define IXOFF 0010000
75#define IMAXBEL 0020000
76#define IUTF8 0040000
77
78/* c_oflag bits */
79#define OPOST 0000001
80#define OLCUC 0000002
81#define ONLCR 0000004
82#define OCRNL 0000010
83#define ONOCR 0000020
84#define ONLRET 0000040
85#define OFILL 0000100
86#define OFDEL 0000200
87#define NLDLY 0000400
88#define NL0 0000000
89#define NL1 0000400
90#define CRDLY 0003000
91#define CR0 0000000
92#define CR1 0001000
93#define CR2 0002000
94#define CR3 0003000
95#define TABDLY 0014000
96#define TAB0 0000000
97#define TAB1 0004000
98#define TAB2 0010000
99#define TAB3 0014000
100#define XTABS 0014000
101#define BSDLY 0020000
102#define BS0 0000000
103#define BS1 0020000
104#define VTDLY 0040000
105#define VT0 0000000
106#define VT1 0040000
107#define FFDLY 0100000
108#define FF0 0000000
109#define FF1 0100000
110
111/* c_cflag bit meaning */
112#define CBAUD 0010017
113#define B0 0000000 /* hang up */
114#define B50 0000001
115#define B75 0000002
116#define B110 0000003
117#define B134 0000004
118#define B150 0000005
119#define B200 0000006
120#define B300 0000007
121#define B600 0000010
122#define B1200 0000011
123#define B1800 0000012
124#define B2400 0000013
125#define B4800 0000014
126#define B9600 0000015
127#define B19200 0000016
128#define B38400 0000017
129#define EXTA B19200
130#define EXTB B38400
131#define CSIZE 0000060
132#define CS5 0000000
133#define CS6 0000020
134#define CS7 0000040
135#define CS8 0000060
136#define CSTOPB 0000100
137#define CREAD 0000200
138#define PARENB 0000400
139#define PARODD 0001000
140#define HUPCL 0002000
141#define CLOCAL 0004000
142#define CBAUDEX 0010000
143#define BOTHER 0010000
144#define B57600 0010001
145#define B115200 0010002
146#define B230400 0010003
147#define B460800 0010004
148#define B500000 0010005
149#define B576000 0010006
150#define B921600 0010007
151#define B1000000 0010010
152#define B1152000 0010011
153#define B1500000 0010012
154#define B2000000 0010013
155#define B2500000 0010014
156#define B3000000 0010015
157#define B3500000 0010016
158#define B4000000 0010017
159#define CIBAUD 002003600000 /** input baud rate */
160#define CTVB 004000000000 /* VisioBraille Terminal flow control */
161#define CMSPAR 010000000000 /* mark or space (stick) parity */
162#define CRTSCTS 020000000000 /* flow control */
163
164#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
165
166/* c_lflag bits */
167#define ISIG 0000001
168#define ICANON 0000002
169#define XCASE 0000004
170#define ECHO 0000010
171#define ECHOE 0000020
172#define ECHOK 0000040
173#define ECHONL 0000100
174#define NOFLSH 0000200
175#define TOSTOP 0000400
176#define ECHOCTL 0001000
177#define ECHOPRT 0002000
178#define ECHOKE 0004000
179#define FLUSHO 0010000
180#define PENDIN 0040000
181#define IEXTEN 0100000
182
183/* tcflow() and TCXONC use these */
184#define TCOOFF 0
185#define TCOON 1
186#define TCIOFF 2
187#define TCION 3
188
189/* tcflush() and TCFLSH use these */
190#define TCIFLUSH 0
191#define TCOFLUSH 1
192#define TCIOFLUSH 2
193
194/* tcsetattr uses these */
195#define TCSANOW 0
196#define TCSADRAIN 1
197#define TCSAFLUSH 2
198
199#endif /* _ASM_M32R_TERMBITS_H */
diff --git a/include/asm-m32r/termios.h b/include/asm-m32r/termios.h
deleted file mode 100644
index 93ce79fd342a..000000000000
--- a/include/asm-m32r/termios.h
+++ /dev/null
@@ -1,91 +0,0 @@
1#ifndef _M32R_TERMIOS_H
2#define _M32R_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/* modem lines */
25#define TIOCM_LE 0x001
26#define TIOCM_DTR 0x002
27#define TIOCM_RTS 0x004
28#define TIOCM_ST 0x008
29#define TIOCM_SR 0x010
30#define TIOCM_CTS 0x020
31#define TIOCM_CAR 0x040
32#define TIOCM_RNG 0x080
33#define TIOCM_DSR 0x100
34#define TIOCM_CD TIOCM_CAR
35#define TIOCM_RI TIOCM_RNG
36#define TIOCM_OUT1 0x2000
37#define TIOCM_OUT2 0x4000
38#define TIOCM_LOOP 0x8000
39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41
42#ifdef __KERNEL__
43#include <linux/module.h>
44
45/* intr=^C quit=^\ erase=del kill=^U
46 eof=^D vtime=\0 vmin=\1 sxtc=\0
47 start=^Q stop=^S susp=^Z eol=\0
48 reprint=^R discard=^U werase=^W lnext=^V
49 eol2=\0
50*/
51#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
52
53/*
54 * Translate a "termio" structure into a "termios". Ugh.
55 */
56#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
57 unsigned short __tmp; \
58 get_user(__tmp,&(termio)->x); \
59 *(unsigned short *) &(termios)->x = __tmp; \
60}
61
62#define user_termio_to_kernel_termios(termios, termio) \
63({ \
64 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
65 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
66 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
67 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
68 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
69})
70
71/*
72 * Translate a "termios" structure into a "termio". Ugh.
73 */
74#define kernel_termios_to_user_termio(termio, termios) \
75({ \
76 put_user((termios)->c_iflag, &(termio)->c_iflag); \
77 put_user((termios)->c_oflag, &(termio)->c_oflag); \
78 put_user((termios)->c_cflag, &(termio)->c_cflag); \
79 put_user((termios)->c_lflag, &(termio)->c_lflag); \
80 put_user((termios)->c_line, &(termio)->c_line); \
81 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
82})
83
84#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
85#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
86#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
87#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
88
89#endif /* __KERNEL__ */
90
91#endif /* _M32R_TERMIOS_H */
diff --git a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h
deleted file mode 100644
index 8589d462df27..000000000000
--- a/include/asm-m32r/thread_info.h
+++ /dev/null
@@ -1,184 +0,0 @@
1#ifndef _ASM_M32R_THREAD_INFO_H
2#define _ASM_M32R_THREAD_INFO_H
3
4/* thread_info.h: m32r low-level thread information
5 *
6 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
7 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
8 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
9 */
10
11#ifdef __KERNEL__
12
13#ifndef __ASSEMBLY__
14#include <asm/processor.h>
15#endif
16
17/*
18 * low level task data that entry.S needs immediate access to
19 * - this struct should fit entirely inside of one cache line
20 * - this struct shares the supervisor stack pages
21 * - if the contents of this structure are changed, the assembly constants must also be changed
22 */
23#ifndef __ASSEMBLY__
24
25struct thread_info {
26 struct task_struct *task; /* main task structure */
27 struct exec_domain *exec_domain; /* execution domain */
28 unsigned long flags; /* low level flags */
29 unsigned long status; /* thread-synchronous flags */
30 __u32 cpu; /* current CPU */
31 int preempt_count; /* 0 => preemptable, <0 => BUG */
32
33 mm_segment_t addr_limit; /* thread address space:
34 0-0xBFFFFFFF for user-thread
35 0-0xFFFFFFFF for kernel-thread
36 */
37 struct restart_block restart_block;
38
39 __u8 supervisor_stack[0];
40};
41
42#else /* !__ASSEMBLY__ */
43
44/* offsets into the thread_info struct for assembly code access */
45#define TI_TASK 0x00000000
46#define TI_EXEC_DOMAIN 0x00000004
47#define TI_FLAGS 0x00000008
48#define TI_STATUS 0x0000000C
49#define TI_CPU 0x00000010
50#define TI_PRE_COUNT 0x00000014
51#define TI_ADDR_LIMIT 0x00000018
52#define TI_RESTART_BLOCK 0x000001C
53
54#endif
55
56#define PREEMPT_ACTIVE 0x10000000
57
58/*
59 * macros/functions for gaining access to the thread information structure
60 *
61 * preempt_count needs to be 1 initially, until the scheduler is functional.
62 */
63#ifndef __ASSEMBLY__
64
65#define INIT_THREAD_INFO(tsk) \
66{ \
67 .task = &tsk, \
68 .exec_domain = &default_exec_domain, \
69 .flags = 0, \
70 .cpu = 0, \
71 .preempt_count = 1, \
72 .addr_limit = KERNEL_DS, \
73 .restart_block = { \
74 .fn = do_no_restart_syscall, \
75 }, \
76}
77
78#define init_thread_info (init_thread_union.thread_info)
79#define init_stack (init_thread_union.stack)
80
81#define THREAD_SIZE (2*PAGE_SIZE)
82
83/* how to get the thread information struct from C */
84static inline struct thread_info *current_thread_info(void)
85{
86 struct thread_info *ti;
87
88 __asm__ __volatile__ (
89 "ldi %0, #%1 \n\t"
90 "and %0, sp \n\t"
91 : "=r" (ti) : "i" (~(THREAD_SIZE - 1))
92 );
93
94 return ti;
95}
96
97#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
98
99/* thread information allocation */
100#ifdef CONFIG_DEBUG_STACK_USAGE
101#define alloc_thread_info(tsk) \
102 ({ \
103 struct thread_info *ret; \
104 \
105 ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \
106 \
107 ret; \
108 })
109#else
110#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
111#endif
112
113#define free_thread_info(info) kfree(info)
114
115#define TI_FLAG_FAULT_CODE_SHIFT 28
116
117static inline void set_thread_fault_code(unsigned int val)
118{
119 struct thread_info *ti = current_thread_info();
120 ti->flags = (ti->flags & (~0 >> (32 - TI_FLAG_FAULT_CODE_SHIFT)))
121 | (val << TI_FLAG_FAULT_CODE_SHIFT);
122}
123
124static inline unsigned int get_thread_fault_code(void)
125{
126 struct thread_info *ti = current_thread_info();
127 return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT;
128}
129
130#else /* !__ASSEMBLY__ */
131
132#define THREAD_SIZE 8192
133
134/* how to get the thread information struct from ASM */
135#define GET_THREAD_INFO(reg) GET_THREAD_INFO reg
136 .macro GET_THREAD_INFO reg
137 ldi \reg, #-THREAD_SIZE
138 and \reg, sp
139 .endm
140
141#endif
142
143/*
144 * thread information flags
145 * - these are process state flags that various assembly files may need to access
146 * - pending work-to-be-done flags are in LSW
147 * - other flags in MSW
148 */
149#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
150#define TIF_SIGPENDING 1 /* signal pending */
151#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
152#define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
153#define TIF_IRET 4 /* return with iret */
154#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */
155#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
156#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
157#define TIF_MEMDIE 18 /* OOM killer killed process */
158#define TIF_FREEZE 19 /* is freezing for suspend */
159
160#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
161#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
162#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
163#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
164#define _TIF_IRET (1<<TIF_IRET)
165#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
166#define _TIF_USEDFPU (1<<TIF_USEDFPU)
167#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
168#define _TIF_FREEZE (1<<TIF_FREEZE)
169
170#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
171#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
172
173/*
174 * Thread-synchronous status.
175 *
176 * This is different from the flags in that nobody else
177 * ever touches our thread-synchronous status, so we don't
178 * have to worry about atomic accesses.
179 */
180#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
181
182#endif /* __KERNEL__ */
183
184#endif /* _ASM_M32R_THREAD_INFO_H */
diff --git a/include/asm-m32r/timex.h b/include/asm-m32r/timex.h
deleted file mode 100644
index bb9fe4feb12d..000000000000
--- a/include/asm-m32r/timex.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _ASM_M32R_TIMEX_H
2#define _ASM_M32R_TIMEX_H
3
4/*
5 * linux/include/asm-m32r/timex.h
6 *
7 * m32r architecture timex specifications
8 */
9
10#define CLOCK_TICK_RATE (CONFIG_BUS_CLOCK / CONFIG_TIMER_DIVIDE)
11#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
12
13#ifdef __KERNEL__
14/*
15 * Standard way to access the cycle counter.
16 * Currently only used on SMP.
17 */
18
19typedef unsigned long long cycles_t;
20
21static __inline__ cycles_t get_cycles (void)
22{
23 return 0;
24}
25#endif /* __KERNEL__ */
26
27#endif /* _ASM_M32R_TIMEX_H */
diff --git a/include/asm-m32r/tlb.h b/include/asm-m32r/tlb.h
deleted file mode 100644
index c7ebd8d48f3b..000000000000
--- a/include/asm-m32r/tlb.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _M32R_TLB_H
2#define _M32R_TLB_H
3
4/*
5 * x86 doesn't need any special per-pte or
6 * per-vma handling..
7 */
8#define tlb_start_vma(tlb, vma) do { } while (0)
9#define tlb_end_vma(tlb, vma) do { } while (0)
10#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0)
11
12/*
13 * .. because we flush the whole mm when it
14 * fills up.
15 */
16#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
17
18#include <asm-generic/tlb.h>
19
20#endif /* _M32R_TLB_H */
diff --git a/include/asm-m32r/tlbflush.h b/include/asm-m32r/tlbflush.h
deleted file mode 100644
index 0ef95307784e..000000000000
--- a/include/asm-m32r/tlbflush.h
+++ /dev/null
@@ -1,97 +0,0 @@
1#ifndef _ASM_M32R_TLBFLUSH_H
2#define _ASM_M32R_TLBFLUSH_H
3
4#include <asm/m32r.h>
5
6/*
7 * TLB flushing:
8 *
9 * - flush_tlb() flushes the current mm struct TLBs
10 * - flush_tlb_all() flushes all processes TLBs
11 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
12 * - flush_tlb_page(vma, vmaddr) flushes one page
13 * - flush_tlb_range(vma, start, end) flushes a range of pages
14 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
15 */
16
17extern void local_flush_tlb_all(void);
18extern void local_flush_tlb_mm(struct mm_struct *);
19extern void local_flush_tlb_page(struct vm_area_struct *, unsigned long);
20extern void local_flush_tlb_range(struct vm_area_struct *, unsigned long,
21 unsigned long);
22
23#ifndef CONFIG_SMP
24#ifdef CONFIG_MMU
25#define flush_tlb_all() local_flush_tlb_all()
26#define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
27#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page)
28#define flush_tlb_range(vma, start, end) \
29 local_flush_tlb_range(vma, start, end)
30#define flush_tlb_kernel_range(start, end) local_flush_tlb_all()
31#else /* CONFIG_MMU */
32#define flush_tlb_all() do { } while (0)
33#define flush_tlb_mm(mm) do { } while (0)
34#define flush_tlb_page(vma, vmaddr) do { } while (0)
35#define flush_tlb_range(vma, start, end) do { } while (0)
36#endif /* CONFIG_MMU */
37#else /* CONFIG_SMP */
38extern void smp_flush_tlb_all(void);
39extern void smp_flush_tlb_mm(struct mm_struct *);
40extern void smp_flush_tlb_page(struct vm_area_struct *, unsigned long);
41extern void smp_flush_tlb_range(struct vm_area_struct *, unsigned long,
42 unsigned long);
43
44#define flush_tlb_all() smp_flush_tlb_all()
45#define flush_tlb_mm(mm) smp_flush_tlb_mm(mm)
46#define flush_tlb_page(vma, page) smp_flush_tlb_page(vma, page)
47#define flush_tlb_range(vma, start, end) \
48 smp_flush_tlb_range(vma, start, end)
49#define flush_tlb_kernel_range(start, end) smp_flush_tlb_all()
50#endif /* CONFIG_SMP */
51
52static __inline__ void __flush_tlb_page(unsigned long page)
53{
54 unsigned int tmpreg0, tmpreg1, tmpreg2;
55
56 __asm__ __volatile__ (
57 "seth %0, #high(%4) \n\t"
58 "st %3, @(%5, %0) \n\t"
59 "ldi %1, #1 \n\t"
60 "st %1, @(%6, %0) \n\t"
61 "add3 %1, %0, %7 \n\t"
62 ".fillinsn \n"
63 "1: \n\t"
64 "ld %2, @(%6, %0) \n\t"
65 "bnez %2, 1b \n\t"
66 "ld %0, @%1+ \n\t"
67 "ld %1, @%1 \n\t"
68 "st %2, @+%0 \n\t"
69 "st %2, @+%1 \n\t"
70 : "=&r" (tmpreg0), "=&r" (tmpreg1), "=&r" (tmpreg2)
71 : "r" (page), "i" (MMU_REG_BASE), "i" (MSVA_offset),
72 "i" (MTOP_offset), "i" (MIDXI_offset)
73 : "memory"
74 );
75}
76
77static __inline__ void __flush_tlb_all(void)
78{
79 unsigned int tmpreg0, tmpreg1;
80
81 __asm__ __volatile__ (
82 "seth %0, #high(%2) \n\t"
83 "or3 %0, %0, #low(%2) \n\t"
84 "ldi %1, #0xc \n\t"
85 "st %1, @%0 \n\t"
86 ".fillinsn \n"
87 "1: \n\t"
88 "ld %1, @%0 \n\t"
89 "bnez %1, 1b \n\t"
90 : "=&r" (tmpreg0), "=&r" (tmpreg1)
91 : "i" (MTOP) : "memory"
92 );
93}
94
95extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
96
97#endif /* _ASM_M32R_TLBFLUSH_H */
diff --git a/include/asm-m32r/topology.h b/include/asm-m32r/topology.h
deleted file mode 100644
index d607eb32bd7e..000000000000
--- a/include/asm-m32r/topology.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_M32R_TOPOLOGY_H
2#define _ASM_M32R_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* _ASM_M32R_TOPOLOGY_H */
diff --git a/include/asm-m32r/types.h b/include/asm-m32r/types.h
deleted file mode 100644
index bc9f7fff0ac3..000000000000
--- a/include/asm-m32r/types.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef _ASM_M32R_TYPES_H
2#define _ASM_M32R_TYPES_H
3
4#include <asm-generic/int-ll64.h>
5
6#ifndef __ASSEMBLY__
7
8typedef unsigned short umode_t;
9
10#endif /* __ASSEMBLY__ */
11
12/*
13 * These aren't exported outside the kernel to avoid name space clashes
14 */
15#ifdef __KERNEL__
16
17#define BITS_PER_LONG 32
18
19#ifndef __ASSEMBLY__
20
21/* DMA addresses are 32-bits wide. */
22
23typedef u32 dma_addr_t;
24typedef u64 dma64_addr_t;
25
26#endif /* __ASSEMBLY__ */
27
28#endif /* __KERNEL__ */
29
30#endif /* _ASM_M32R_TYPES_H */
diff --git a/include/asm-m32r/uaccess.h b/include/asm-m32r/uaccess.h
deleted file mode 100644
index 1c7047bea200..000000000000
--- a/include/asm-m32r/uaccess.h
+++ /dev/null
@@ -1,693 +0,0 @@
1#ifndef _ASM_M32R_UACCESS_H
2#define _ASM_M32R_UACCESS_H
3
4/*
5 * linux/include/asm-m32r/uaccess.h
6 *
7 * M32R version.
8 * Copyright (C) 2004, 2006 Hirokazu Takata <takata at linux-m32r.org>
9 */
10
11/*
12 * User space memory access functions
13 */
14#include <linux/errno.h>
15#include <linux/thread_info.h>
16#include <asm/page.h>
17#include <asm/setup.h>
18
19#define VERIFY_READ 0
20#define VERIFY_WRITE 1
21
22/*
23 * The fs value determines whether argument validity checking should be
24 * performed or not. If get_fs() == USER_DS, checking is performed, with
25 * get_fs() == KERNEL_DS, checking is bypassed.
26 *
27 * For historical reasons, these macros are grossly misnamed.
28 */
29
30#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
31
32#ifdef CONFIG_MMU
33
34#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
35#define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
36#define get_ds() (KERNEL_DS)
37#define get_fs() (current_thread_info()->addr_limit)
38#define set_fs(x) (current_thread_info()->addr_limit = (x))
39
40#else /* not CONFIG_MMU */
41
42#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
43#define USER_DS MAKE_MM_SEG(0xFFFFFFFF)
44#define get_ds() (KERNEL_DS)
45
46static inline mm_segment_t get_fs(void)
47{
48 return USER_DS;
49}
50
51static inline void set_fs(mm_segment_t s)
52{
53}
54
55#endif /* not CONFIG_MMU */
56
57#define segment_eq(a,b) ((a).seg == (b).seg)
58
59#define __addr_ok(addr) \
60 ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
61
62/*
63 * Test whether a block of memory is a valid user space address.
64 * Returns 0 if the range is valid, nonzero otherwise.
65 *
66 * This is equivalent to the following test:
67 * (u33)addr + (u33)size >= (u33)current->addr_limit.seg
68 *
69 * This needs 33-bit arithmetic. We have a carry...
70 */
71#define __range_ok(addr,size) ({ \
72 unsigned long flag, roksum; \
73 __chk_user_ptr(addr); \
74 asm ( \
75 " cmpu %1, %1 ; clear cbit\n" \
76 " addx %1, %3 ; set cbit if overflow\n" \
77 " subx %0, %0\n" \
78 " cmpu %4, %1\n" \
79 " subx %0, %5\n" \
80 : "=&r" (flag), "=r" (roksum) \
81 : "1" (addr), "r" ((int)(size)), \
82 "r" (current_thread_info()->addr_limit.seg), "r" (0) \
83 : "cbit" ); \
84 flag; })
85
86/**
87 * access_ok: - Checks if a user space pointer is valid
88 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
89 * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
90 * to write to a block, it is always safe to read from it.
91 * @addr: User space pointer to start of block to check
92 * @size: Size of block to check
93 *
94 * Context: User context only. This function may sleep.
95 *
96 * Checks if a pointer to a block of memory in user space is valid.
97 *
98 * Returns true (nonzero) if the memory block may be valid, false (zero)
99 * if it is definitely invalid.
100 *
101 * Note that, depending on architecture, this function probably just
102 * checks that the pointer is in the user space range - after calling
103 * this function, memory access functions may still return -EFAULT.
104 */
105#ifdef CONFIG_MMU
106#define access_ok(type,addr,size) (likely(__range_ok(addr,size) == 0))
107#else
108static inline int access_ok(int type, const void *addr, unsigned long size)
109{
110 unsigned long val = (unsigned long)addr;
111
112 return ((val >= memory_start) && ((val + size) < memory_end));
113}
114#endif /* CONFIG_MMU */
115
116/*
117 * The exception table consists of pairs of addresses: the first is the
118 * address of an instruction that is allowed to fault, and the second is
119 * the address at which the program should continue. No registers are
120 * modified, so it is entirely up to the continuation code to figure out
121 * what to do.
122 *
123 * All the routines below use bits of fixup code that are out of line
124 * with the main instruction path. This means when everything is well,
125 * we don't even have to jump over them. Further, they do not intrude
126 * on our cache or tlb entries.
127 */
128
129struct exception_table_entry
130{
131 unsigned long insn, fixup;
132};
133
134extern int fixup_exception(struct pt_regs *regs);
135
136/*
137 * These are the main single-value transfer routines. They automatically
138 * use the right size if we just have the right pointer type.
139 *
140 * This gets kind of ugly. We want to return _two_ values in "get_user()"
141 * and yet we don't want to do any pointers, because that is too much
142 * of a performance impact. Thus we have a few rather ugly macros here,
143 * and hide all the uglyness from the user.
144 *
145 * The "__xxx" versions of the user access functions are versions that
146 * do not verify the address space, that must have been done previously
147 * with a separate "access_ok()" call (this is used when we do multiple
148 * accesses to the same area of user memory).
149 */
150
151/* Careful: we have to cast the result to the type of the pointer for sign
152 reasons */
153/**
154 * get_user: - Get a simple variable from user space.
155 * @x: Variable to store result.
156 * @ptr: Source address, in user space.
157 *
158 * Context: User context only. This function may sleep.
159 *
160 * This macro copies a single simple variable from user space to kernel
161 * space. It supports simple types like char and int, but not larger
162 * data types like structures or arrays.
163 *
164 * @ptr must have pointer-to-simple-variable type, and the result of
165 * dereferencing @ptr must be assignable to @x without a cast.
166 *
167 * Returns zero on success, or -EFAULT on error.
168 * On error, the variable @x is set to zero.
169 */
170#define get_user(x,ptr) \
171 __get_user_check((x),(ptr),sizeof(*(ptr)))
172
173/**
174 * put_user: - Write a simple value into user space.
175 * @x: Value to copy to user space.
176 * @ptr: Destination address, in user space.
177 *
178 * Context: User context only. This function may sleep.
179 *
180 * This macro copies a single simple value from kernel space to user
181 * space. It supports simple types like char and int, but not larger
182 * data types like structures or arrays.
183 *
184 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
185 * to the result of dereferencing @ptr.
186 *
187 * Returns zero on success, or -EFAULT on error.
188 */
189#define put_user(x,ptr) \
190 __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
191
192/**
193 * __get_user: - Get a simple variable from user space, with less checking.
194 * @x: Variable to store result.
195 * @ptr: Source address, in user space.
196 *
197 * Context: User context only. This function may sleep.
198 *
199 * This macro copies a single simple variable from user space to kernel
200 * space. It supports simple types like char and int, but not larger
201 * data types like structures or arrays.
202 *
203 * @ptr must have pointer-to-simple-variable type, and the result of
204 * dereferencing @ptr must be assignable to @x without a cast.
205 *
206 * Caller must check the pointer with access_ok() before calling this
207 * function.
208 *
209 * Returns zero on success, or -EFAULT on error.
210 * On error, the variable @x is set to zero.
211 */
212#define __get_user(x,ptr) \
213 __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
214
215#define __get_user_nocheck(x,ptr,size) \
216({ \
217 long __gu_err = 0; \
218 unsigned long __gu_val; \
219 might_sleep(); \
220 __get_user_size(__gu_val,(ptr),(size),__gu_err); \
221 (x) = (__typeof__(*(ptr)))__gu_val; \
222 __gu_err; \
223})
224
225#define __get_user_check(x,ptr,size) \
226({ \
227 long __gu_err = -EFAULT; \
228 unsigned long __gu_val = 0; \
229 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
230 might_sleep(); \
231 if (access_ok(VERIFY_READ,__gu_addr,size)) \
232 __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \
233 (x) = (__typeof__(*(ptr)))__gu_val; \
234 __gu_err; \
235})
236
237extern long __get_user_bad(void);
238
239#define __get_user_size(x,ptr,size,retval) \
240do { \
241 retval = 0; \
242 __chk_user_ptr(ptr); \
243 switch (size) { \
244 case 1: __get_user_asm(x,ptr,retval,"ub"); break; \
245 case 2: __get_user_asm(x,ptr,retval,"uh"); break; \
246 case 4: __get_user_asm(x,ptr,retval,""); break; \
247 default: (x) = __get_user_bad(); \
248 } \
249} while (0)
250
251#define __get_user_asm(x, addr, err, itype) \
252 __asm__ __volatile__( \
253 " .fillinsn\n" \
254 "1: ld"itype" %1,@%2\n" \
255 " .fillinsn\n" \
256 "2:\n" \
257 ".section .fixup,\"ax\"\n" \
258 " .balign 4\n" \
259 "3: ldi %0,%3\n" \
260 " seth r14,#high(2b)\n" \
261 " or3 r14,r14,#low(2b)\n" \
262 " jmp r14\n" \
263 ".previous\n" \
264 ".section __ex_table,\"a\"\n" \
265 " .balign 4\n" \
266 " .long 1b,3b\n" \
267 ".previous" \
268 : "=&r" (err), "=&r" (x) \
269 : "r" (addr), "i" (-EFAULT), "0" (err) \
270 : "r14", "memory")
271
272/**
273 * __put_user: - Write a simple value into user space, with less checking.
274 * @x: Value to copy to user space.
275 * @ptr: Destination address, in user space.
276 *
277 * Context: User context only. This function may sleep.
278 *
279 * This macro copies a single simple value from kernel space to user
280 * space. It supports simple types like char and int, but not larger
281 * data types like structures or arrays.
282 *
283 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
284 * to the result of dereferencing @ptr.
285 *
286 * Caller must check the pointer with access_ok() before calling this
287 * function.
288 *
289 * Returns zero on success, or -EFAULT on error.
290 */
291#define __put_user(x,ptr) \
292 __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
293
294
295#define __put_user_nocheck(x,ptr,size) \
296({ \
297 long __pu_err; \
298 might_sleep(); \
299 __put_user_size((x),(ptr),(size),__pu_err); \
300 __pu_err; \
301})
302
303
304#define __put_user_check(x,ptr,size) \
305({ \
306 long __pu_err = -EFAULT; \
307 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
308 might_sleep(); \
309 if (access_ok(VERIFY_WRITE,__pu_addr,size)) \
310 __put_user_size((x),__pu_addr,(size),__pu_err); \
311 __pu_err; \
312})
313
314#if defined(__LITTLE_ENDIAN__)
315#define __put_user_u64(x, addr, err) \
316 __asm__ __volatile__( \
317 " .fillinsn\n" \
318 "1: st %L1,@%2\n" \
319 " .fillinsn\n" \
320 "2: st %H1,@(4,%2)\n" \
321 " .fillinsn\n" \
322 "3:\n" \
323 ".section .fixup,\"ax\"\n" \
324 " .balign 4\n" \
325 "4: ldi %0,%3\n" \
326 " seth r14,#high(3b)\n" \
327 " or3 r14,r14,#low(3b)\n" \
328 " jmp r14\n" \
329 ".previous\n" \
330 ".section __ex_table,\"a\"\n" \
331 " .balign 4\n" \
332 " .long 1b,4b\n" \
333 " .long 2b,4b\n" \
334 ".previous" \
335 : "=&r" (err) \
336 : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err) \
337 : "r14", "memory")
338
339#elif defined(__BIG_ENDIAN__)
340#define __put_user_u64(x, addr, err) \
341 __asm__ __volatile__( \
342 " .fillinsn\n" \
343 "1: st %H1,@%2\n" \
344 " .fillinsn\n" \
345 "2: st %L1,@(4,%2)\n" \
346 " .fillinsn\n" \
347 "3:\n" \
348 ".section .fixup,\"ax\"\n" \
349 " .balign 4\n" \
350 "4: ldi %0,%3\n" \
351 " seth r14,#high(3b)\n" \
352 " or3 r14,r14,#low(3b)\n" \
353 " jmp r14\n" \
354 ".previous\n" \
355 ".section __ex_table,\"a\"\n" \
356 " .balign 4\n" \
357 " .long 1b,4b\n" \
358 " .long 2b,4b\n" \
359 ".previous" \
360 : "=&r" (err) \
361 : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err) \
362 : "r14", "memory")
363#else
364#error no endian defined
365#endif
366
367extern void __put_user_bad(void);
368
369#define __put_user_size(x,ptr,size,retval) \
370do { \
371 retval = 0; \
372 __chk_user_ptr(ptr); \
373 switch (size) { \
374 case 1: __put_user_asm(x,ptr,retval,"b"); break; \
375 case 2: __put_user_asm(x,ptr,retval,"h"); break; \
376 case 4: __put_user_asm(x,ptr,retval,""); break; \
377 case 8: __put_user_u64((__typeof__(*ptr))(x),ptr,retval); break;\
378 default: __put_user_bad(); \
379 } \
380} while (0)
381
382struct __large_struct { unsigned long buf[100]; };
383#define __m(x) (*(struct __large_struct *)(x))
384
385/*
386 * Tell gcc we read from memory instead of writing: this is because
387 * we do not write to any memory gcc knows about, so there are no
388 * aliasing issues.
389 */
390#define __put_user_asm(x, addr, err, itype) \
391 __asm__ __volatile__( \
392 " .fillinsn\n" \
393 "1: st"itype" %1,@%2\n" \
394 " .fillinsn\n" \
395 "2:\n" \
396 ".section .fixup,\"ax\"\n" \
397 " .balign 4\n" \
398 "3: ldi %0,%3\n" \
399 " seth r14,#high(2b)\n" \
400 " or3 r14,r14,#low(2b)\n" \
401 " jmp r14\n" \
402 ".previous\n" \
403 ".section __ex_table,\"a\"\n" \
404 " .balign 4\n" \
405 " .long 1b,3b\n" \
406 ".previous" \
407 : "=&r" (err) \
408 : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err) \
409 : "r14", "memory")
410
411/*
412 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault
413 * we return the initial request size (1, 2 or 4), as copy_*_user should do.
414 * If a store crosses a page boundary and gets a fault, the m32r will not write
415 * anything, so this is accurate.
416 */
417
418/*
419 * Copy To/From Userspace
420 */
421
422/* Generic arbitrary sized copy. */
423/* Return the number of bytes NOT copied. */
424#define __copy_user(to,from,size) \
425do { \
426 unsigned long __dst, __src, __c; \
427 __asm__ __volatile__ ( \
428 " mv r14, %0\n" \
429 " or r14, %1\n" \
430 " beq %0, %1, 9f\n" \
431 " beqz %2, 9f\n" \
432 " and3 r14, r14, #3\n" \
433 " bnez r14, 2f\n" \
434 " and3 %2, %2, #3\n" \
435 " beqz %3, 2f\n" \
436 " addi %0, #-4 ; word_copy \n" \
437 " .fillinsn\n" \
438 "0: ld r14, @%1+\n" \
439 " addi %3, #-1\n" \
440 " .fillinsn\n" \
441 "1: st r14, @+%0\n" \
442 " bnez %3, 0b\n" \
443 " beqz %2, 9f\n" \
444 " addi %0, #4\n" \
445 " .fillinsn\n" \
446 "2: ldb r14, @%1 ; byte_copy \n" \
447 " .fillinsn\n" \
448 "3: stb r14, @%0\n" \
449 " addi %1, #1\n" \
450 " addi %2, #-1\n" \
451 " addi %0, #1\n" \
452 " bnez %2, 2b\n" \
453 " .fillinsn\n" \
454 "9:\n" \
455 ".section .fixup,\"ax\"\n" \
456 " .balign 4\n" \
457 "5: addi %3, #1\n" \
458 " addi %1, #-4\n" \
459 " .fillinsn\n" \
460 "6: slli %3, #2\n" \
461 " add %2, %3\n" \
462 " addi %0, #4\n" \
463 " .fillinsn\n" \
464 "7: seth r14, #high(9b)\n" \
465 " or3 r14, r14, #low(9b)\n" \
466 " jmp r14\n" \
467 ".previous\n" \
468 ".section __ex_table,\"a\"\n" \
469 " .balign 4\n" \
470 " .long 0b,6b\n" \
471 " .long 1b,5b\n" \
472 " .long 2b,9b\n" \
473 " .long 3b,9b\n" \
474 ".previous\n" \
475 : "=&r" (__dst), "=&r" (__src), "=&r" (size), \
476 "=&r" (__c) \
477 : "0" (to), "1" (from), "2" (size), "3" (size / 4) \
478 : "r14", "memory"); \
479} while (0)
480
481#define __copy_user_zeroing(to,from,size) \
482do { \
483 unsigned long __dst, __src, __c; \
484 __asm__ __volatile__ ( \
485 " mv r14, %0\n" \
486 " or r14, %1\n" \
487 " beq %0, %1, 9f\n" \
488 " beqz %2, 9f\n" \
489 " and3 r14, r14, #3\n" \
490 " bnez r14, 2f\n" \
491 " and3 %2, %2, #3\n" \
492 " beqz %3, 2f\n" \
493 " addi %0, #-4 ; word_copy \n" \
494 " .fillinsn\n" \
495 "0: ld r14, @%1+\n" \
496 " addi %3, #-1\n" \
497 " .fillinsn\n" \
498 "1: st r14, @+%0\n" \
499 " bnez %3, 0b\n" \
500 " beqz %2, 9f\n" \
501 " addi %0, #4\n" \
502 " .fillinsn\n" \
503 "2: ldb r14, @%1 ; byte_copy \n" \
504 " .fillinsn\n" \
505 "3: stb r14, @%0\n" \
506 " addi %1, #1\n" \
507 " addi %2, #-1\n" \
508 " addi %0, #1\n" \
509 " bnez %2, 2b\n" \
510 " .fillinsn\n" \
511 "9:\n" \
512 ".section .fixup,\"ax\"\n" \
513 " .balign 4\n" \
514 "5: addi %3, #1\n" \
515 " addi %1, #-4\n" \
516 " .fillinsn\n" \
517 "6: slli %3, #2\n" \
518 " add %2, %3\n" \
519 " addi %0, #4\n" \
520 " .fillinsn\n" \
521 "7: ldi r14, #0 ; store zero \n" \
522 " .fillinsn\n" \
523 "8: addi %2, #-1\n" \
524 " stb r14, @%0 ; ACE? \n" \
525 " addi %0, #1\n" \
526 " bnez %2, 8b\n" \
527 " seth r14, #high(9b)\n" \
528 " or3 r14, r14, #low(9b)\n" \
529 " jmp r14\n" \
530 ".previous\n" \
531 ".section __ex_table,\"a\"\n" \
532 " .balign 4\n" \
533 " .long 0b,6b\n" \
534 " .long 1b,5b\n" \
535 " .long 2b,7b\n" \
536 " .long 3b,7b\n" \
537 ".previous\n" \
538 : "=&r" (__dst), "=&r" (__src), "=&r" (size), \
539 "=&r" (__c) \
540 : "0" (to), "1" (from), "2" (size), "3" (size / 4) \
541 : "r14", "memory"); \
542} while (0)
543
544
545/* We let the __ versions of copy_from/to_user inline, because they're often
546 * used in fast paths and have only a small space overhead.
547 */
548static inline unsigned long __generic_copy_from_user_nocheck(void *to,
549 const void __user *from, unsigned long n)
550{
551 __copy_user_zeroing(to,from,n);
552 return n;
553}
554
555static inline unsigned long __generic_copy_to_user_nocheck(void __user *to,
556 const void *from, unsigned long n)
557{
558 __copy_user(to,from,n);
559 return n;
560}
561
562unsigned long __generic_copy_to_user(void __user *, const void *, unsigned long);
563unsigned long __generic_copy_from_user(void *, const void __user *, unsigned long);
564
565/**
566 * __copy_to_user: - Copy a block of data into user space, with less checking.
567 * @to: Destination address, in user space.
568 * @from: Source address, in kernel space.
569 * @n: Number of bytes to copy.
570 *
571 * Context: User context only. This function may sleep.
572 *
573 * Copy data from kernel space to user space. Caller must check
574 * the specified block with access_ok() before calling this function.
575 *
576 * Returns number of bytes that could not be copied.
577 * On success, this will be zero.
578 */
579#define __copy_to_user(to,from,n) \
580 __generic_copy_to_user_nocheck((to),(from),(n))
581
582#define __copy_to_user_inatomic __copy_to_user
583#define __copy_from_user_inatomic __copy_from_user
584
585/**
586 * copy_to_user: - Copy a block of data into user space.
587 * @to: Destination address, in user space.
588 * @from: Source address, in kernel space.
589 * @n: Number of bytes to copy.
590 *
591 * Context: User context only. This function may sleep.
592 *
593 * Copy data from kernel space to user space.
594 *
595 * Returns number of bytes that could not be copied.
596 * On success, this will be zero.
597 */
598#define copy_to_user(to,from,n) \
599({ \
600 might_sleep(); \
601 __generic_copy_to_user((to),(from),(n)); \
602})
603
604/**
605 * __copy_from_user: - Copy a block of data from user space, with less checking. * @to: Destination address, in kernel space.
606 * @from: Source address, in user space.
607 * @n: Number of bytes to copy.
608 *
609 * Context: User context only. This function may sleep.
610 *
611 * Copy data from user space to kernel space. Caller must check
612 * the specified block with access_ok() before calling this function.
613 *
614 * Returns number of bytes that could not be copied.
615 * On success, this will be zero.
616 *
617 * If some data could not be copied, this function will pad the copied
618 * data to the requested size using zero bytes.
619 */
620#define __copy_from_user(to,from,n) \
621 __generic_copy_from_user_nocheck((to),(from),(n))
622
623/**
624 * copy_from_user: - Copy a block of data from user space.
625 * @to: Destination address, in kernel space.
626 * @from: Source address, in user space.
627 * @n: Number of bytes to copy.
628 *
629 * Context: User context only. This function may sleep.
630 *
631 * Copy data from user space to kernel space.
632 *
633 * Returns number of bytes that could not be copied.
634 * On success, this will be zero.
635 *
636 * If some data could not be copied, this function will pad the copied
637 * data to the requested size using zero bytes.
638 */
639#define copy_from_user(to,from,n) \
640({ \
641 might_sleep(); \
642 __generic_copy_from_user((to),(from),(n)); \
643})
644
645long __must_check strncpy_from_user(char *dst, const char __user *src,
646 long count);
647long __must_check __strncpy_from_user(char *dst,
648 const char __user *src, long count);
649
650/**
651 * __clear_user: - Zero a block of memory in user space, with less checking.
652 * @to: Destination address, in user space.
653 * @n: Number of bytes to zero.
654 *
655 * Zero a block of memory in user space. Caller must check
656 * the specified block with access_ok() before calling this function.
657 *
658 * Returns number of bytes that could not be cleared.
659 * On success, this will be zero.
660 */
661unsigned long __clear_user(void __user *mem, unsigned long len);
662
663/**
664 * clear_user: - Zero a block of memory in user space.
665 * @to: Destination address, in user space.
666 * @n: Number of bytes to zero.
667 *
668 * Zero a block of memory in user space. Caller must check
669 * the specified block with access_ok() before calling this function.
670 *
671 * Returns number of bytes that could not be cleared.
672 * On success, this will be zero.
673 */
674unsigned long clear_user(void __user *mem, unsigned long len);
675
676/**
677 * strlen_user: - Get the size of a string in user space.
678 * @str: The string to measure.
679 *
680 * Context: User context only. This function may sleep.
681 *
682 * Get the size of a NUL-terminated string in user space.
683 *
684 * Returns the size of the string INCLUDING the terminating NUL.
685 * On exception, returns 0.
686 *
687 * If there is a limit on the length of a valid string, you may wish to
688 * consider using strnlen_user() instead.
689 */
690#define strlen_user(str) strnlen_user(str, ~0UL >> 1)
691long strnlen_user(const char __user *str, long n);
692
693#endif /* _ASM_M32R_UACCESS_H */
diff --git a/include/asm-m32r/ucontext.h b/include/asm-m32r/ucontext.h
deleted file mode 100644
index 09324741eec3..000000000000
--- a/include/asm-m32r/ucontext.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_M32R_UCONTEXT_H
2#define _ASM_M32R_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 /* _ASM_M32R_UCONTEXT_H */
diff --git a/include/asm-m32r/unaligned.h b/include/asm-m32r/unaligned.h
deleted file mode 100644
index 377eb20d1ec6..000000000000
--- a/include/asm-m32r/unaligned.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _ASM_M32R_UNALIGNED_H
2#define _ASM_M32R_UNALIGNED_H
3
4#if defined(__LITTLE_ENDIAN__)
5# include <linux/unaligned/le_memmove.h>
6# include <linux/unaligned/be_byteshift.h>
7# include <linux/unaligned/generic.h>
8# define get_unaligned __get_unaligned_le
9# define put_unaligned __put_unaligned_le
10#else
11# include <linux/unaligned/be_memmove.h>
12# include <linux/unaligned/le_byteshift.h>
13# include <linux/unaligned/generic.h>
14# define get_unaligned __get_unaligned_be
15# define put_unaligned __put_unaligned_be
16#endif
17
18#endif /* _ASM_M32R_UNALIGNED_H */
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
deleted file mode 100644
index cf701c933249..000000000000
--- a/include/asm-m32r/unistd.h
+++ /dev/null
@@ -1,389 +0,0 @@
1#ifndef _ASM_M32R_UNISTD_H
2#define _ASM_M32R_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/* 16 is unused */
25/* 17 is unused */
26/* 18 is unused */
27#define __NR_lseek 19
28#define __NR_getpid 20
29#define __NR_mount 21
30#define __NR_umount 22
31/* 23 is unused */
32/* 24 is unused */
33#define __NR_stime 25
34#define __NR_ptrace 26
35#define __NR_alarm 27
36/* 28 is unused */
37#define __NR_pause 29
38#define __NR_utime 30
39/* 31 is unused */
40#define __NR_cachectl 32 /* old #define __NR_gtty 32*/
41#define __NR_access 33
42/* 34 is unused */
43/* 35 is unused */
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/* 44 is unused */
53#define __NR_brk 45
54/* 46 is unused */
55/* 47 is unused (getgid16) */
56/* 48 is unused */
57/* 49 is unused */
58/* 50 is unused */
59#define __NR_acct 51
60#define __NR_umount2 52
61/* 53 is unused */
62#define __NR_ioctl 54
63/* 55 is unused (fcntl) */
64/* 56 is unused */
65#define __NR_setpgid 57
66/* 58 is unused */
67/* 59 is unused */
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/* 67 is unused */
76/* 68 is unused*/
77/* 69 is unused*/
78/* 70 is unused */
79/* 71 is unused */
80/* 72 is unused */
81/* 73 is unused */
82#define __NR_sethostname 74
83#define __NR_setrlimit 75
84/* 76 is unused (old getrlimit) */
85#define __NR_getrusage 77
86#define __NR_gettimeofday 78
87#define __NR_settimeofday 79
88/* 80 is unused */
89/* 81 is unused */
90/* 82 is unused */
91#define __NR_symlink 83
92/* 84 is unused */
93#define __NR_readlink 85
94#define __NR_uselib 86
95#define __NR_swapon 87
96#define __NR_reboot 88
97/* 89 is unused */
98/* 90 is unused */
99#define __NR_munmap 91
100#define __NR_truncate 92
101#define __NR_ftruncate 93
102#define __NR_fchmod 94
103/* 95 is unused */
104#define __NR_getpriority 96
105#define __NR_setpriority 97
106/* 98 is unused */
107#define __NR_statfs 99
108#define __NR_fstatfs 100
109/* 101 is unused */
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/* 109 is unused */
118/* 110 is unused */
119#define __NR_vhangup 111
120/* 112 is unused */
121/* 113 is unused */
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/* 119 is unused */
128#define __NR_clone 120
129#define __NR_setdomainname 121
130#define __NR_uname 122
131/* 123 is unused */
132#define __NR_adjtimex 124
133#define __NR_mprotect 125
134/* 126 is unused */
135/* 127 is unused */
136#define __NR_init_module 128
137#define __NR_delete_module 129
138/* 130 is unused */
139#define __NR_quotactl 131
140#define __NR_getpgid 132
141#define __NR_fchdir 133
142#define __NR_bdflush 134
143#define __NR_sysfs 135
144#define __NR_personality 136
145/* 137 is unused */
146/* 138 is unused */
147/* 139 is unused */
148#define __NR__llseek 140
149#define __NR_getdents 141
150#define __NR__newselect 142
151#define __NR_flock 143
152#define __NR_msync 144
153#define __NR_readv 145
154#define __NR_writev 146
155#define __NR_getsid 147
156#define __NR_fdatasync 148
157#define __NR__sysctl 149
158#define __NR_mlock 150
159#define __NR_munlock 151
160#define __NR_mlockall 152
161#define __NR_munlockall 153
162#define __NR_sched_setparam 154
163#define __NR_sched_getparam 155
164#define __NR_sched_setscheduler 156
165#define __NR_sched_getscheduler 157
166#define __NR_sched_yield 158
167#define __NR_sched_get_priority_max 159
168#define __NR_sched_get_priority_min 160
169#define __NR_sched_rr_get_interval 161
170#define __NR_nanosleep 162
171#define __NR_mremap 163
172/* 164 is unused */
173/* 165 is unused */
174#define __NR_tas 166
175/* 167 is unused */
176#define __NR_poll 168
177#define __NR_nfsservctl 169
178/* 170 is unused */
179/* 171 is unused */
180#define __NR_prctl 172
181#define __NR_rt_sigreturn 173
182#define __NR_rt_sigaction 174
183#define __NR_rt_sigprocmask 175
184#define __NR_rt_sigpending 176
185#define __NR_rt_sigtimedwait 177
186#define __NR_rt_sigqueueinfo 178
187#define __NR_rt_sigsuspend 179
188#define __NR_pread64 180
189#define __NR_pwrite64 181
190/* 182 is unused */
191#define __NR_getcwd 183
192#define __NR_capget 184
193#define __NR_capset 185
194#define __NR_sigaltstack 186
195#define __NR_sendfile 187
196/* 188 is unused */
197/* 189 is unused */
198#define __NR_vfork 190
199#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
200#define __NR_mmap2 192
201#define __NR_truncate64 193
202#define __NR_ftruncate64 194
203#define __NR_stat64 195
204#define __NR_lstat64 196
205#define __NR_fstat64 197
206#define __NR_lchown32 198
207#define __NR_getuid32 199
208#define __NR_getgid32 200
209#define __NR_geteuid32 201
210#define __NR_getegid32 202
211#define __NR_setreuid32 203
212#define __NR_setregid32 204
213#define __NR_getgroups32 205
214#define __NR_setgroups32 206
215#define __NR_fchown32 207
216#define __NR_setresuid32 208
217#define __NR_getresuid32 209
218#define __NR_setresgid32 210
219#define __NR_getresgid32 211
220#define __NR_chown32 212
221#define __NR_setuid32 213
222#define __NR_setgid32 214
223#define __NR_setfsuid32 215
224#define __NR_setfsgid32 216
225#define __NR_pivot_root 217
226#define __NR_mincore 218
227#define __NR_madvise 219
228#define __NR_getdents64 220
229#define __NR_fcntl64 221
230/* 222 is unused */
231/* 223 is unused */
232#define __NR_gettid 224
233#define __NR_readahead 225
234#define __NR_setxattr 226
235#define __NR_lsetxattr 227
236#define __NR_fsetxattr 228
237#define __NR_getxattr 229
238#define __NR_lgetxattr 230
239#define __NR_fgetxattr 231
240#define __NR_listxattr 232
241#define __NR_llistxattr 233
242#define __NR_flistxattr 234
243#define __NR_removexattr 235
244#define __NR_lremovexattr 236
245#define __NR_fremovexattr 237
246#define __NR_tkill 238
247#define __NR_sendfile64 239
248#define __NR_futex 240
249#define __NR_sched_setaffinity 241
250#define __NR_sched_getaffinity 242
251#define __NR_set_thread_area 243
252#define __NR_get_thread_area 244
253#define __NR_io_setup 245
254#define __NR_io_destroy 246
255#define __NR_io_getevents 247
256#define __NR_io_submit 248
257#define __NR_io_cancel 249
258#define __NR_fadvise64 250
259/* 251 is unused */
260#define __NR_exit_group 252
261#define __NR_lookup_dcookie 253
262#define __NR_epoll_create 254
263#define __NR_epoll_ctl 255
264#define __NR_epoll_wait 256
265#define __NR_remap_file_pages 257
266#define __NR_set_tid_address 258
267#define __NR_timer_create 259
268#define __NR_timer_settime (__NR_timer_create+1)
269#define __NR_timer_gettime (__NR_timer_create+2)
270#define __NR_timer_getoverrun (__NR_timer_create+3)
271#define __NR_timer_delete (__NR_timer_create+4)
272#define __NR_clock_settime (__NR_timer_create+5)
273#define __NR_clock_gettime (__NR_timer_create+6)
274#define __NR_clock_getres (__NR_timer_create+7)
275#define __NR_clock_nanosleep (__NR_timer_create+8)
276#define __NR_statfs64 268
277#define __NR_fstatfs64 269
278#define __NR_tgkill 270
279#define __NR_utimes 271
280#define __NR_fadvise64_64 272
281#define __NR_vserver 273
282#define __NR_mbind 274
283#define __NR_get_mempolicy 275
284#define __NR_set_mempolicy 276
285#define __NR_mq_open 277
286#define __NR_mq_unlink (__NR_mq_open+1)
287#define __NR_mq_timedsend (__NR_mq_open+2)
288#define __NR_mq_timedreceive (__NR_mq_open+3)
289#define __NR_mq_notify (__NR_mq_open+4)
290#define __NR_mq_getsetattr (__NR_mq_open+5)
291#define __NR_kexec_load 283
292#define __NR_waitid 284
293/* 285 is unused */
294#define __NR_add_key 286
295#define __NR_request_key 287
296#define __NR_keyctl 288
297#define __NR_ioprio_set 289
298#define __NR_ioprio_get 290
299#define __NR_inotify_init 291
300#define __NR_inotify_add_watch 292
301#define __NR_inotify_rm_watch 293
302#define __NR_migrate_pages 294
303#define __NR_openat 295
304#define __NR_mkdirat 296
305#define __NR_mknodat 297
306#define __NR_fchownat 298
307#define __NR_futimesat 299
308#define __NR_fstatat64 300
309#define __NR_unlinkat 301
310#define __NR_renameat 302
311#define __NR_linkat 303
312#define __NR_symlinkat 304
313#define __NR_readlinkat 305
314#define __NR_fchmodat 306
315#define __NR_faccessat 307
316#define __NR_pselect6 308
317#define __NR_ppoll 309
318#define __NR_unshare 310
319#define __NR_set_robust_list 311
320#define __NR_get_robust_list 312
321#define __NR_splice 313
322#define __NR_sync_file_range 314
323#define __NR_tee 315
324#define __NR_vmsplice 316
325#define __NR_move_pages 317
326#define __NR_getcpu 318
327#define __NR_epoll_pwait 319
328#define __NR_utimensat 320
329#define __NR_signalfd 321
330/* #define __NR_timerfd 322 removed */
331#define __NR_eventfd 323
332#define __NR_fallocate 324
333
334#ifdef __KERNEL__
335
336#define NR_syscalls 325
337
338#define __ARCH_WANT_IPC_PARSE_VERSION
339#define __ARCH_WANT_STAT64
340#define __ARCH_WANT_SYS_ALARM
341#define __ARCH_WANT_SYS_GETHOSTNAME
342#define __ARCH_WANT_SYS_PAUSE
343#define __ARCH_WANT_SYS_TIME
344#define __ARCH_WANT_SYS_UTIME
345#define __ARCH_WANT_SYS_WAITPID
346#define __ARCH_WANT_SYS_SOCKETCALL
347#define __ARCH_WANT_SYS_FADVISE64
348#define __ARCH_WANT_SYS_GETPGRP
349#define __ARCH_WANT_SYS_LLSEEK
350#define __ARCH_WANT_SYS_OLD_GETRLIMIT /*will be unused*/
351#define __ARCH_WANT_SYS_OLDUMOUNT
352#define __ARCH_WANT_SYS_RT_SIGACTION
353
354#define __IGNORE_lchown
355#define __IGNORE_setuid
356#define __IGNORE_getuid
357#define __IGNORE_setgid
358#define __IGNORE_getgid
359#define __IGNORE_geteuid
360#define __IGNORE_getegid
361#define __IGNORE_fcntl
362#define __IGNORE_setreuid
363#define __IGNORE_setregid
364#define __IGNORE_getrlimit
365#define __IGNORE_getgroups
366#define __IGNORE_setgroups
367#define __IGNORE_select
368#define __IGNORE_mmap
369#define __IGNORE_fchown
370#define __IGNORE_setfsuid
371#define __IGNORE_setfsgid
372#define __IGNORE_setresuid
373#define __IGNORE_getresuid
374#define __IGNORE_setresgid
375#define __IGNORE_getresgid
376#define __IGNORE_chown
377
378/*
379 * "Conditional" syscalls
380 *
381 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
382 * but it doesn't work on all toolchains, so we just do it by hand
383 */
384#ifndef cond_syscall
385#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
386#endif
387
388#endif /* __KERNEL__ */
389#endif /* _ASM_M32R_UNISTD_H */
diff --git a/include/asm-m32r/user.h b/include/asm-m32r/user.h
deleted file mode 100644
index 03b3c11c2aff..000000000000
--- a/include/asm-m32r/user.h
+++ /dev/null
@@ -1,52 +0,0 @@
1#ifndef _ASM_M32R_USER_H
2#define _ASM_M32R_USER_H
3
4#include <linux/types.h>
5#include <asm/ptrace.h>
6#include <asm/page.h>
7
8/*
9 * Core file format: The core file is written in such a way that gdb
10 * can understand it and provide useful information to the user (under
11 * linux we use the `trad-core' bfd).
12 *
13 * The actual file contents are as follows:
14 * UPAGE: 1 page consisting of a user struct that tells gdb
15 * what is present in the file. Directly after this is a
16 * copy of the task_struct, which is currently not used by gdb,
17 * but it may come in handy at some point. All of the registers
18 * are stored as part of the upage. The upage should always be
19 * only one page.
20 * DATA: The data area is stored. We use current->end_text to
21 * current->brk to pick up all of the user variables, plus any memory
22 * that may have been sbrk'ed. No attempt is made to determine if a
23 * page is demand-zero or if a page is totally unused, we just cover
24 * the entire range. All of the addresses are rounded in such a way
25 * that an integral number of pages is written.
26 * STACK: We need the stack information in order to get a meaningful
27 * backtrace. We need to write the data from usp to
28 * current->start_stack, so we round each of these off in order to be
29 * able to write an integer number of pages.
30 */
31
32struct user {
33 struct pt_regs regs; /* entire machine state */
34 size_t u_tsize; /* text size (pages) */
35 size_t u_dsize; /* data size (pages) */
36 size_t u_ssize; /* stack size (pages) */
37 unsigned long start_code; /* text starting address */
38 unsigned long start_data; /* data starting address */
39 unsigned long start_stack; /* stack starting address */
40 long int signal; /* signal causing core dump */
41 unsigned long u_ar0; /* help gdb find registers */
42 unsigned long magic; /* identifies a core file */
43 char u_comm[32]; /* user command name */
44};
45
46#define NBPG PAGE_SIZE
47#define UPAGES 1
48#define HOST_TEXT_START_ADDR (u.start_code)
49#define HOST_DATA_START_ADDR (u.start_data)
50#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
51
52#endif /* _ASM_M32R_USER_H */
diff --git a/include/asm-m32r/vga.h b/include/asm-m32r/vga.h
deleted file mode 100644
index a1b63061c06f..000000000000
--- a/include/asm-m32r/vga.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_M32R_VGA_H
2#define _ASM_M32R_VGA_H
3
4/*
5 * Access to VGA videoram
6 *
7 * (c) 1998 Martin Mares <mj@ucw.cz>
8 */
9
10/*
11 * On the PC, we can just recalculate addresses and then
12 * access the videoram directly without any black magic.
13 */
14
15#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x)
16
17#define vga_readb(x) (*(x))
18#define vga_writeb(x,y) (*(y) = (x))
19
20#endif /* _ASM_M32R_VGA_H */
diff --git a/include/asm-m32r/xor.h b/include/asm-m32r/xor.h
deleted file mode 100644
index 6d525259df3e..000000000000
--- a/include/asm-m32r/xor.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_M32R_XOR_H
2#define _ASM_M32R_XOR_H
3
4#include <asm-generic/xor.h>
5
6#endif /* _ASM_M32R_XOR_H */
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/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 5256854c0453..000000000000
--- a/include/asm-mn10300/highmem.h
+++ /dev/null
@@ -1,114 +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 <asm/kmap_types.h>
20#include <asm/pgtable.h>
21
22/* undef for production */
23#undef HIGHMEM_DEBUG
24
25/* declarations for highmem.c */
26extern unsigned long highstart_pfn, highend_pfn;
27
28extern pte_t *kmap_pte;
29extern pgprot_t kmap_prot;
30extern pte_t *pkmap_page_table;
31
32extern void __init kmap_init(void);
33
34/*
35 * Right now we initialize only a single pte table. It can be extended
36 * easily, subsequent pte tables have to be allocated in one physical
37 * chunk of RAM.
38 */
39#define PKMAP_BASE 0xfe000000UL
40#define LAST_PKMAP 1024
41#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
42#define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
43#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
44
45extern unsigned long kmap_high(struct page *page);
46extern void kunmap_high(struct page *page);
47
48static inline unsigned long kmap(struct page *page)
49{
50 if (in_interrupt())
51 BUG();
52 if (page < highmem_start_page)
53 return page_address(page);
54 return kmap_high(page);
55}
56
57static inline void kunmap(struct page *page)
58{
59 if (in_interrupt())
60 BUG();
61 if (page < highmem_start_page)
62 return;
63 kunmap_high(page);
64}
65
66/*
67 * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
68 * gives a more generic (and caching) interface. But kmap_atomic can
69 * be used in IRQ contexts, so in some (very limited) cases we need
70 * it.
71 */
72static inline unsigned long kmap_atomic(struct page *page, enum km_type type)
73{
74 enum fixed_addresses idx;
75 unsigned long vaddr;
76
77 if (page < highmem_start_page)
78 return page_address(page);
79
80 idx = type + KM_TYPE_NR * smp_processor_id();
81 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
82#if HIGHMEM_DEBUG
83 if (!pte_none(*(kmap_pte - idx)))
84 BUG();
85#endif
86 set_pte(kmap_pte - idx, mk_pte(page, kmap_prot));
87 __flush_tlb_one(vaddr);
88
89 return vaddr;
90}
91
92static inline void kunmap_atomic(unsigned long vaddr, enum km_type type)
93{
94#if HIGHMEM_DEBUG
95 enum fixed_addresses idx = type + KM_TYPE_NR * smp_processor_id();
96
97 if (vaddr < FIXADDR_START) /* FIXME */
98 return;
99
100 if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx))
101 BUG();
102
103 /*
104 * force other mappings to Oops if they'll try to access
105 * this pte without first remap it
106 */
107 pte_clear(kmap_pte - idx);
108 __flush_tlb_one(vaddr);
109#endif
110}
111
112#endif /* __KERNEL__ */
113
114#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/ide.h b/include/asm-mn10300/ide.h
deleted file mode 100644
index 6adcdd92e83d..000000000000
--- a/include/asm-mn10300/ide.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/* MN10300 Arch-specific IDE code
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/ide.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#ifndef _ASM_IDE_H
14#define _ASM_IDE_H
15
16#ifdef __KERNEL__
17
18#include <asm/intctl-regs.h>
19
20#undef SUPPORT_SLOW_DATA_PORTS
21#define SUPPORT_SLOW_DATA_PORTS 0
22
23#undef SUPPORT_VLB_SYNC
24#define SUPPORT_VLB_SYNC 0
25
26/*
27 * some bits needed for parts of the IDE subsystem to compile
28 */
29#define __ide_mm_insw(port, addr, n) \
30 insw((unsigned long) (port), (addr), (n))
31#define __ide_mm_insl(port, addr, n) \
32 insl((unsigned long) (port), (addr), (n))
33#define __ide_mm_outsw(port, addr, n) \
34 outsw((unsigned long) (port), (addr), (n))
35#define __ide_mm_outsl(port, addr, n) \
36 outsl((unsigned long) (port), (addr), (n))
37
38#endif /* __KERNEL__ */
39#endif /* _ASM_IDE_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 cd9cc5c89cea..000000000000
--- a/include/asm-mn10300/pci.h
+++ /dev/null
@@ -1,124 +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
124#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 80af9c4ccad7..000000000000
--- a/include/asm-mn10300/socket.h
+++ /dev/null
@@ -1,57 +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#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 4504d1b4b477..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 <asm/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/crypto/aes.h b/include/crypto/aes.h
index 656a4c66a568..7524ba3b6f3c 100644
--- a/include/crypto/aes.h
+++ b/include/crypto/aes.h
@@ -17,10 +17,14 @@
17#define AES_MAX_KEYLENGTH (15 * 16) 17#define AES_MAX_KEYLENGTH (15 * 16)
18#define AES_MAX_KEYLENGTH_U32 (AES_MAX_KEYLENGTH / sizeof(u32)) 18#define AES_MAX_KEYLENGTH_U32 (AES_MAX_KEYLENGTH / sizeof(u32))
19 19
20/*
21 * Please ensure that the first two fields are 16-byte aligned
22 * relative to the start of the structure, i.e., don't move them!
23 */
20struct crypto_aes_ctx { 24struct crypto_aes_ctx {
21 u32 key_length;
22 u32 key_enc[AES_MAX_KEYLENGTH_U32]; 25 u32 key_enc[AES_MAX_KEYLENGTH_U32];
23 u32 key_dec[AES_MAX_KEYLENGTH_U32]; 26 u32 key_dec[AES_MAX_KEYLENGTH_U32];
27 u32 key_length;
24}; 28};
25 29
26extern const u32 crypto_ft_tab[4][256]; 30extern const u32 crypto_ft_tab[4][256];
diff --git a/include/crypto/compress.h b/include/crypto/compress.h
new file mode 100644
index 000000000000..86163ef24219
--- /dev/null
+++ b/include/crypto/compress.h
@@ -0,0 +1,145 @@
1/*
2 * Compress: Compression algorithms under the cryptographic API.
3 *
4 * Copyright 2008 Sony 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; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program.
17 * If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _CRYPTO_COMPRESS_H
21#define _CRYPTO_COMPRESS_H
22
23#include <linux/crypto.h>
24
25
26struct comp_request {
27 const void *next_in; /* next input byte */
28 void *next_out; /* next output byte */
29 unsigned int avail_in; /* bytes available at next_in */
30 unsigned int avail_out; /* bytes available at next_out */
31};
32
33enum zlib_comp_params {
34 ZLIB_COMP_LEVEL = 1, /* e.g. Z_DEFAULT_COMPRESSION */
35 ZLIB_COMP_METHOD, /* e.g. Z_DEFLATED */
36 ZLIB_COMP_WINDOWBITS, /* e.g. MAX_WBITS */
37 ZLIB_COMP_MEMLEVEL, /* e.g. DEF_MEM_LEVEL */
38 ZLIB_COMP_STRATEGY, /* e.g. Z_DEFAULT_STRATEGY */
39 __ZLIB_COMP_MAX,
40};
41
42#define ZLIB_COMP_MAX (__ZLIB_COMP_MAX - 1)
43
44
45enum zlib_decomp_params {
46 ZLIB_DECOMP_WINDOWBITS = 1, /* e.g. DEF_WBITS */
47 __ZLIB_DECOMP_MAX,
48};
49
50#define ZLIB_DECOMP_MAX (__ZLIB_DECOMP_MAX - 1)
51
52
53struct crypto_pcomp {
54 struct crypto_tfm base;
55};
56
57struct pcomp_alg {
58 int (*compress_setup)(struct crypto_pcomp *tfm, void *params,
59 unsigned int len);
60 int (*compress_init)(struct crypto_pcomp *tfm);
61 int (*compress_update)(struct crypto_pcomp *tfm,
62 struct comp_request *req);
63 int (*compress_final)(struct crypto_pcomp *tfm,
64 struct comp_request *req);
65 int (*decompress_setup)(struct crypto_pcomp *tfm, void *params,
66 unsigned int len);
67 int (*decompress_init)(struct crypto_pcomp *tfm);
68 int (*decompress_update)(struct crypto_pcomp *tfm,
69 struct comp_request *req);
70 int (*decompress_final)(struct crypto_pcomp *tfm,
71 struct comp_request *req);
72
73 struct crypto_alg base;
74};
75
76extern struct crypto_pcomp *crypto_alloc_pcomp(const char *alg_name, u32 type,
77 u32 mask);
78
79static inline struct crypto_tfm *crypto_pcomp_tfm(struct crypto_pcomp *tfm)
80{
81 return &tfm->base;
82}
83
84static inline void crypto_free_pcomp(struct crypto_pcomp *tfm)
85{
86 crypto_destroy_tfm(tfm, crypto_pcomp_tfm(tfm));
87}
88
89static inline struct pcomp_alg *__crypto_pcomp_alg(struct crypto_alg *alg)
90{
91 return container_of(alg, struct pcomp_alg, base);
92}
93
94static inline struct pcomp_alg *crypto_pcomp_alg(struct crypto_pcomp *tfm)
95{
96 return __crypto_pcomp_alg(crypto_pcomp_tfm(tfm)->__crt_alg);
97}
98
99static inline int crypto_compress_setup(struct crypto_pcomp *tfm,
100 void *params, unsigned int len)
101{
102 return crypto_pcomp_alg(tfm)->compress_setup(tfm, params, len);
103}
104
105static inline int crypto_compress_init(struct crypto_pcomp *tfm)
106{
107 return crypto_pcomp_alg(tfm)->compress_init(tfm);
108}
109
110static inline int crypto_compress_update(struct crypto_pcomp *tfm,
111 struct comp_request *req)
112{
113 return crypto_pcomp_alg(tfm)->compress_update(tfm, req);
114}
115
116static inline int crypto_compress_final(struct crypto_pcomp *tfm,
117 struct comp_request *req)
118{
119 return crypto_pcomp_alg(tfm)->compress_final(tfm, req);
120}
121
122static inline int crypto_decompress_setup(struct crypto_pcomp *tfm,
123 void *params, unsigned int len)
124{
125 return crypto_pcomp_alg(tfm)->decompress_setup(tfm, params, len);
126}
127
128static inline int crypto_decompress_init(struct crypto_pcomp *tfm)
129{
130 return crypto_pcomp_alg(tfm)->decompress_init(tfm);
131}
132
133static inline int crypto_decompress_update(struct crypto_pcomp *tfm,
134 struct comp_request *req)
135{
136 return crypto_pcomp_alg(tfm)->decompress_update(tfm, req);
137}
138
139static inline int crypto_decompress_final(struct crypto_pcomp *tfm,
140 struct comp_request *req)
141{
142 return crypto_pcomp_alg(tfm)->decompress_final(tfm, req);
143}
144
145#endif /* _CRYPTO_COMPRESS_H */
diff --git a/include/crypto/cryptd.h b/include/crypto/cryptd.h
new file mode 100644
index 000000000000..55fa7bbdbc71
--- /dev/null
+++ b/include/crypto/cryptd.h
@@ -0,0 +1,27 @@
1/*
2 * Software async crypto daemon
3 */
4
5#ifndef _CRYPTO_CRYPT_H
6#define _CRYPTO_CRYPT_H
7
8#include <linux/crypto.h>
9#include <linux/kernel.h>
10
11struct cryptd_ablkcipher {
12 struct crypto_ablkcipher base;
13};
14
15static inline struct cryptd_ablkcipher *__cryptd_ablkcipher_cast(
16 struct crypto_ablkcipher *tfm)
17{
18 return (struct cryptd_ablkcipher *)tfm;
19}
20
21/* alg_name should be algorithm to be cryptd-ed */
22struct cryptd_ablkcipher *cryptd_alloc_ablkcipher(const char *alg_name,
23 u32 type, u32 mask);
24struct crypto_blkcipher *cryptd_ablkcipher_child(struct cryptd_ablkcipher *tfm);
25void cryptd_free_ablkcipher(struct cryptd_ablkcipher *tfm);
26
27#endif
diff --git a/include/crypto/crypto_wq.h b/include/crypto/crypto_wq.h
new file mode 100644
index 000000000000..a7d252daf91b
--- /dev/null
+++ b/include/crypto/crypto_wq.h
@@ -0,0 +1,7 @@
1#ifndef CRYPTO_WQ_H
2#define CRYPTO_WQ_H
3
4#include <linux/workqueue.h>
5
6extern struct workqueue_struct *kcrypto_wq;
7#endif
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index d797e119e3d5..d56bb71617c3 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -231,6 +231,11 @@ static inline unsigned int crypto_shash_alignmask(
231 return crypto_tfm_alg_alignmask(crypto_shash_tfm(tfm)); 231 return crypto_tfm_alg_alignmask(crypto_shash_tfm(tfm));
232} 232}
233 233
234static inline unsigned int crypto_shash_blocksize(struct crypto_shash *tfm)
235{
236 return crypto_tfm_alg_blocksize(crypto_shash_tfm(tfm));
237}
238
234static inline struct shash_alg *__crypto_shash_alg(struct crypto_alg *alg) 239static inline struct shash_alg *__crypto_shash_alg(struct crypto_alg *alg)
235{ 240{
236 return container_of(alg, struct shash_alg, base); 241 return container_of(alg, struct shash_alg, base);
diff --git a/include/crypto/internal/compress.h b/include/crypto/internal/compress.h
new file mode 100644
index 000000000000..178a888d1d93
--- /dev/null
+++ b/include/crypto/internal/compress.h
@@ -0,0 +1,28 @@
1/*
2 * Compress: Compression algorithms under the cryptographic API.
3 *
4 * Copyright 2008 Sony 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; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program.
17 * If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _CRYPTO_INTERNAL_COMPRESS_H
21#define _CRYPTO_INTERNAL_COMPRESS_H
22
23#include <crypto/compress.h>
24
25extern int crypto_register_pcomp(struct pcomp_alg *alg);
26extern int crypto_unregister_pcomp(struct pcomp_alg *alg);
27
28#endif /* _CRYPTO_INTERNAL_COMPRESS_H */
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 8e77357334ad..7cb50bdde46d 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -36,8 +36,7 @@
36#ifndef _DRM_H_ 36#ifndef _DRM_H_
37#define _DRM_H_ 37#define _DRM_H_
38 38
39#if defined(__KERNEL__) 39#include <linux/types.h>
40#endif
41#include <asm/ioctl.h> /* For _IO* macros */ 40#include <asm/ioctl.h> /* For _IO* macros */
42#define DRM_IOCTL_NR(n) _IOC_NR(n) 41#define DRM_IOCTL_NR(n) _IOC_NR(n)
43#define DRM_IOC_VOID _IOC_NONE 42#define DRM_IOC_VOID _IOC_NONE
@@ -497,8 +496,8 @@ union drm_wait_vblank {
497 * \sa drmModesetCtl(). 496 * \sa drmModesetCtl().
498 */ 497 */
499struct drm_modeset_ctl { 498struct drm_modeset_ctl {
500 uint32_t crtc; 499 __u32 crtc;
501 uint32_t cmd; 500 __u32 cmd;
502}; 501};
503 502
504/** 503/**
@@ -574,29 +573,29 @@ struct drm_set_version {
574/** DRM_IOCTL_GEM_CLOSE ioctl argument type */ 573/** DRM_IOCTL_GEM_CLOSE ioctl argument type */
575struct drm_gem_close { 574struct drm_gem_close {
576 /** Handle of the object to be closed. */ 575 /** Handle of the object to be closed. */
577 uint32_t handle; 576 __u32 handle;
578 uint32_t pad; 577 __u32 pad;
579}; 578};
580 579
581/** DRM_IOCTL_GEM_FLINK ioctl argument type */ 580/** DRM_IOCTL_GEM_FLINK ioctl argument type */
582struct drm_gem_flink { 581struct drm_gem_flink {
583 /** Handle for the object being named */ 582 /** Handle for the object being named */
584 uint32_t handle; 583 __u32 handle;
585 584
586 /** Returned global name */ 585 /** Returned global name */
587 uint32_t name; 586 __u32 name;
588}; 587};
589 588
590/** DRM_IOCTL_GEM_OPEN ioctl argument type */ 589/** DRM_IOCTL_GEM_OPEN ioctl argument type */
591struct drm_gem_open { 590struct drm_gem_open {
592 /** Name of object being opened */ 591 /** Name of object being opened */
593 uint32_t name; 592 __u32 name;
594 593
595 /** Returned handle for the object */ 594 /** Returned handle for the object */
596 uint32_t handle; 595 __u32 handle;
597 596
598 /** Returned size of the object */ 597 /** Returned size of the object */
599 uint64_t size; 598 __u64 size;
600}; 599};
601 600
602#include "drm_mode.h" 601#include "drm_mode.h"
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e5f4ae989abf..c8c422151431 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -281,16 +281,16 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
281 281
282struct drm_ioctl_desc { 282struct drm_ioctl_desc {
283 unsigned int cmd; 283 unsigned int cmd;
284 drm_ioctl_t *func;
285 int flags; 284 int flags;
285 drm_ioctl_t *func;
286}; 286};
287 287
288/** 288/**
289 * Creates a driver or general drm_ioctl_desc array entry for the given 289 * Creates a driver or general drm_ioctl_desc array entry for the given
290 * ioctl, for use by drm_ioctl(). 290 * ioctl, for use by drm_ioctl().
291 */ 291 */
292#define DRM_IOCTL_DEF(ioctl, func, flags) \ 292#define DRM_IOCTL_DEF(ioctl, _func, _flags) \
293 [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags} 293 [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags}
294 294
295struct drm_magic_entry { 295struct drm_magic_entry {
296 struct list_head head; 296 struct list_head head;
@@ -523,19 +523,32 @@ struct drm_mm {
523 523
524 524
525/** 525/**
526 * Kernel side of a mapping
527 */
528struct drm_local_map {
529 resource_size_t offset; /**< Requested physical address (0 for SAREA)*/
530 unsigned long size; /**< Requested physical size (bytes) */
531 enum drm_map_type type; /**< Type of memory to map */
532 enum drm_map_flags flags; /**< Flags */
533 void *handle; /**< User-space: "Handle" to pass to mmap() */
534 /**< Kernel-space: kernel-virtual address */
535 int mtrr; /**< MTRR slot used */
536};
537
538typedef struct drm_local_map drm_local_map_t;
539
540/**
526 * Mappings list 541 * Mappings list
527 */ 542 */
528struct drm_map_list { 543struct drm_map_list {
529 struct list_head head; /**< list head */ 544 struct list_head head; /**< list head */
530 struct drm_hash_item hash; 545 struct drm_hash_item hash;
531 struct drm_map *map; /**< mapping */ 546 struct drm_local_map *map; /**< mapping */
532 uint64_t user_token; 547 uint64_t user_token;
533 struct drm_master *master; 548 struct drm_master *master;
534 struct drm_mm_node *file_offset_node; /**< fake offset */ 549 struct drm_mm_node *file_offset_node; /**< fake offset */
535}; 550};
536 551
537typedef struct drm_map drm_local_map_t;
538
539/** 552/**
540 * Context handle list 553 * Context handle list
541 */ 554 */
@@ -560,7 +573,7 @@ struct drm_ati_pcigart_info {
560 dma_addr_t bus_addr; 573 dma_addr_t bus_addr;
561 dma_addr_t table_mask; 574 dma_addr_t table_mask;
562 struct drm_dma_handle *table_handle; 575 struct drm_dma_handle *table_handle;
563 drm_local_map_t mapping; 576 struct drm_local_map mapping;
564 int table_size; 577 int table_size;
565}; 578};
566 579
@@ -675,7 +688,6 @@ struct drm_driver {
675 int (*kernel_context_switch) (struct drm_device *dev, int old, 688 int (*kernel_context_switch) (struct drm_device *dev, int old,
676 int new); 689 int new);
677 void (*kernel_context_switch_unlock) (struct drm_device *dev); 690 void (*kernel_context_switch_unlock) (struct drm_device *dev);
678 int (*dri_library_name) (struct drm_device *dev, char *buf);
679 691
680 /** 692 /**
681 * get_vblank_counter - get raw hardware vblank counter 693 * get_vblank_counter - get raw hardware vblank counter
@@ -747,8 +759,8 @@ struct drm_driver {
747 struct drm_file *file_priv); 759 struct drm_file *file_priv);
748 void (*reclaim_buffers_idlelocked) (struct drm_device *dev, 760 void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
749 struct drm_file *file_priv); 761 struct drm_file *file_priv);
750 unsigned long (*get_map_ofs) (struct drm_map * map); 762 resource_size_t (*get_map_ofs) (struct drm_local_map * map);
751 unsigned long (*get_reg_ofs) (struct drm_device *dev); 763 resource_size_t (*get_reg_ofs) (struct drm_device *dev);
752 void (*set_version) (struct drm_device *dev, 764 void (*set_version) (struct drm_device *dev,
753 struct drm_set_version *sv); 765 struct drm_set_version *sv);
754 766
@@ -758,6 +770,8 @@ struct drm_driver {
758 770
759 int (*proc_init)(struct drm_minor *minor); 771 int (*proc_init)(struct drm_minor *minor);
760 void (*proc_cleanup)(struct drm_minor *minor); 772 void (*proc_cleanup)(struct drm_minor *minor);
773 int (*debugfs_init)(struct drm_minor *minor);
774 void (*debugfs_cleanup)(struct drm_minor *minor);
761 775
762 /** 776 /**
763 * Driver-specific constructor for drm_gem_objects, to set up 777 * Driver-specific constructor for drm_gem_objects, to set up
@@ -793,6 +807,48 @@ struct drm_driver {
793#define DRM_MINOR_CONTROL 2 807#define DRM_MINOR_CONTROL 2
794#define DRM_MINOR_RENDER 3 808#define DRM_MINOR_RENDER 3
795 809
810
811/**
812 * debugfs node list. This structure represents a debugfs file to
813 * be created by the drm core
814 */
815struct drm_debugfs_list {
816 const char *name; /** file name */
817 int (*show)(struct seq_file*, void*); /** show callback */
818 u32 driver_features; /**< Required driver features for this entry */
819};
820
821/**
822 * debugfs node structure. This structure represents a debugfs file.
823 */
824struct drm_debugfs_node {
825 struct list_head list;
826 struct drm_minor *minor;
827 struct drm_debugfs_list *debugfs_ent;
828 struct dentry *dent;
829};
830
831/**
832 * Info file list entry. This structure represents a debugfs or proc file to
833 * be created by the drm core
834 */
835struct drm_info_list {
836 const char *name; /** file name */
837 int (*show)(struct seq_file*, void*); /** show callback */
838 u32 driver_features; /**< Required driver features for this entry */
839 void *data;
840};
841
842/**
843 * debugfs node structure. This structure represents a debugfs file.
844 */
845struct drm_info_node {
846 struct list_head list;
847 struct drm_minor *minor;
848 struct drm_info_list *info_ent;
849 struct dentry *dent;
850};
851
796/** 852/**
797 * DRM minor structure. This structure represents a drm minor number. 853 * DRM minor structure. This structure represents a drm minor number.
798 */ 854 */
@@ -802,7 +858,12 @@ struct drm_minor {
802 dev_t device; /**< Device number for mknod */ 858 dev_t device; /**< Device number for mknod */
803 struct device kdev; /**< Linux device */ 859 struct device kdev; /**< Linux device */
804 struct drm_device *dev; 860 struct drm_device *dev;
805 struct proc_dir_entry *dev_root; /**< proc directory entry */ 861
862 struct proc_dir_entry *proc_root; /**< proc directory entry */
863 struct drm_info_node proc_nodes;
864 struct dentry *debugfs_root;
865 struct drm_info_node debugfs_nodes;
866
806 struct drm_master *master; /* currently active master for this node */ 867 struct drm_master *master; /* currently active master for this node */
807 struct list_head master_list; 868 struct list_head master_list;
808 struct drm_mode_group mode_group; 869 struct drm_mode_group mode_group;
@@ -932,7 +993,7 @@ struct drm_device {
932 sigset_t sigmask; 993 sigset_t sigmask;
933 994
934 struct drm_driver *driver; 995 struct drm_driver *driver;
935 drm_local_map_t *agp_buffer_map; 996 struct drm_local_map *agp_buffer_map;
936 unsigned int agp_buffer_token; 997 unsigned int agp_buffer_token;
937 struct drm_minor *control; /**< Control node for card */ 998 struct drm_minor *control; /**< Control node for card */
938 struct drm_minor *primary; /**< render type primary screen head */ 999 struct drm_minor *primary; /**< render type primary screen head */
@@ -1049,8 +1110,8 @@ extern int drm_release(struct inode *inode, struct file *filp);
1049extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 1110extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1050extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); 1111extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1051extern void drm_vm_open_locked(struct vm_area_struct *vma); 1112extern void drm_vm_open_locked(struct vm_area_struct *vma);
1052extern unsigned long drm_core_get_map_ofs(struct drm_map * map); 1113extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map);
1053extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); 1114extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev);
1054extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1115extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1055 1116
1056 /* Memory management support (drm_memory.h) */ 1117 /* Memory management support (drm_memory.h) */
@@ -1153,13 +1214,13 @@ extern int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv
1153 /* Buffer management support (drm_bufs.h) */ 1214 /* Buffer management support (drm_bufs.h) */
1154extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request); 1215extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request);
1155extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request); 1216extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request);
1156extern int drm_addmap(struct drm_device *dev, unsigned int offset, 1217extern int drm_addmap(struct drm_device *dev, resource_size_t offset,
1157 unsigned int size, enum drm_map_type type, 1218 unsigned int size, enum drm_map_type type,
1158 enum drm_map_flags flags, drm_local_map_t ** map_ptr); 1219 enum drm_map_flags flags, struct drm_local_map **map_ptr);
1159extern int drm_addmap_ioctl(struct drm_device *dev, void *data, 1220extern int drm_addmap_ioctl(struct drm_device *dev, void *data,
1160 struct drm_file *file_priv); 1221 struct drm_file *file_priv);
1161extern int drm_rmmap(struct drm_device *dev, drm_local_map_t *map); 1222extern int drm_rmmap(struct drm_device *dev, struct drm_local_map *map);
1162extern int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map); 1223extern int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map);
1163extern int drm_rmmap_ioctl(struct drm_device *dev, void *data, 1224extern int drm_rmmap_ioctl(struct drm_device *dev, void *data,
1164 struct drm_file *file_priv); 1225 struct drm_file *file_priv);
1165extern int drm_addbufs(struct drm_device *dev, void *data, 1226extern int drm_addbufs(struct drm_device *dev, void *data,
@@ -1173,10 +1234,10 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
1173extern int drm_mapbufs(struct drm_device *dev, void *data, 1234extern int drm_mapbufs(struct drm_device *dev, void *data,
1174 struct drm_file *file_priv); 1235 struct drm_file *file_priv);
1175extern int drm_order(unsigned long size); 1236extern int drm_order(unsigned long size);
1176extern unsigned long drm_get_resource_start(struct drm_device *dev, 1237extern resource_size_t drm_get_resource_start(struct drm_device *dev,
1238 unsigned int resource);
1239extern resource_size_t drm_get_resource_len(struct drm_device *dev,
1177 unsigned int resource); 1240 unsigned int resource);
1178extern unsigned long drm_get_resource_len(struct drm_device *dev,
1179 unsigned int resource);
1180 1241
1181 /* DMA support (drm_dma.h) */ 1242 /* DMA support (drm_dma.h) */
1182extern int drm_dma_setup(struct drm_device *dev); 1243extern int drm_dma_setup(struct drm_device *dev);
@@ -1252,22 +1313,48 @@ extern struct drm_master *drm_master_get(struct drm_master *master);
1252extern void drm_master_put(struct drm_master **master); 1313extern void drm_master_put(struct drm_master **master);
1253extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1314extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
1254 struct drm_driver *driver); 1315 struct drm_driver *driver);
1255extern int drm_put_dev(struct drm_device *dev); 1316extern void drm_put_dev(struct drm_device *dev);
1256extern int drm_put_minor(struct drm_minor **minor); 1317extern int drm_put_minor(struct drm_minor **minor);
1257extern unsigned int drm_debug; 1318extern unsigned int drm_debug;
1258 1319
1259extern struct class *drm_class; 1320extern struct class *drm_class;
1260extern struct proc_dir_entry *drm_proc_root; 1321extern struct proc_dir_entry *drm_proc_root;
1322extern struct dentry *drm_debugfs_root;
1261 1323
1262extern struct idr drm_minors_idr; 1324extern struct idr drm_minors_idr;
1263 1325
1264extern drm_local_map_t *drm_getsarea(struct drm_device *dev); 1326extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1265 1327
1266 /* Proc support (drm_proc.h) */ 1328 /* Proc support (drm_proc.h) */
1267extern int drm_proc_init(struct drm_minor *minor, int minor_id, 1329extern int drm_proc_init(struct drm_minor *minor, int minor_id,
1268 struct proc_dir_entry *root); 1330 struct proc_dir_entry *root);
1269extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); 1331extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
1270 1332
1333 /* Debugfs support */
1334#if defined(CONFIG_DEBUG_FS)
1335extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1336 struct dentry *root);
1337extern int drm_debugfs_create_files(struct drm_info_list *files, int count,
1338 struct dentry *root, struct drm_minor *minor);
1339extern int drm_debugfs_remove_files(struct drm_info_list *files, int count,
1340 struct drm_minor *minor);
1341extern int drm_debugfs_cleanup(struct drm_minor *minor);
1342#endif
1343
1344 /* Info file support */
1345extern int drm_name_info(struct seq_file *m, void *data);
1346extern int drm_vm_info(struct seq_file *m, void *data);
1347extern int drm_queues_info(struct seq_file *m, void *data);
1348extern int drm_bufs_info(struct seq_file *m, void *data);
1349extern int drm_vblank_info(struct seq_file *m, void *data);
1350extern int drm_clients_info(struct seq_file *m, void* data);
1351extern int drm_gem_name_info(struct seq_file *m, void *data);
1352extern int drm_gem_object_info(struct seq_file *m, void* data);
1353
1354#if DRM_DEBUG_CODE
1355extern int drm_vma_info(struct seq_file *m, void *data);
1356#endif
1357
1271 /* Scatter Gather Support (drm_scatter.h) */ 1358 /* Scatter Gather Support (drm_scatter.h) */
1272extern void drm_sg_cleanup(struct drm_sg_mem * entry); 1359extern void drm_sg_cleanup(struct drm_sg_mem * entry);
1273extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, 1360extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
@@ -1378,12 +1465,12 @@ int drm_gem_open_ioctl(struct drm_device *dev, void *data,
1378void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); 1465void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
1379void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); 1466void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
1380 1467
1381extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev); 1468extern void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev);
1382extern void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev); 1469extern void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
1383extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev); 1470extern void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
1384 1471
1385static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, 1472static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1386 unsigned int token) 1473 unsigned int token)
1387{ 1474{
1388 struct drm_map_list *_entry; 1475 struct drm_map_list *_entry;
1389 list_for_each_entry(_entry, &dev->maplist, head) 1476 list_for_each_entry(_entry, &dev->maplist, head)
@@ -1410,7 +1497,7 @@ static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1410 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1497 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1411} 1498}
1412 1499
1413static __inline__ void drm_core_dropmap(struct drm_map *map) 1500static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1414{ 1501{
1415} 1502}
1416 1503
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5ded1acfb543..3c1924c010e8 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -550,7 +550,7 @@ struct drm_mode_config {
550 int min_width, min_height; 550 int min_width, min_height;
551 int max_width, max_height; 551 int max_width, max_height;
552 struct drm_mode_config_funcs *funcs; 552 struct drm_mode_config_funcs *funcs;
553 unsigned long fb_base; 553 resource_size_t fb_base;
554 554
555 /* pointers to standard properties */ 555 /* pointers to standard properties */
556 struct list_head property_blob_list; 556 struct list_head property_blob_list;
@@ -613,7 +613,8 @@ extern void drm_fb_release(struct drm_file *file_priv);
613extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 613extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
614extern struct edid *drm_get_edid(struct drm_connector *connector, 614extern struct edid *drm_get_edid(struct drm_connector *connector,
615 struct i2c_adapter *adapter); 615 struct i2c_adapter *adapter);
616extern unsigned char *drm_do_probe_ddc_edid(struct i2c_adapter *adapter); 616extern int drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
617 unsigned char *buf, int len);
617extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 618extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
618extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 619extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
619extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 620extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
@@ -731,4 +732,5 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
731 void *data, struct drm_file *file_priv); 732 void *data, struct drm_file *file_priv);
732extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 733extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
733 void *data, struct drm_file *file_priv); 734 void *data, struct drm_file *file_priv);
735extern bool drm_detect_hdmi_monitor(struct edid *edid);
734#endif /* __DRM_CRTC_H__ */ 736#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index c7d4b2e606a5..ec073d8288d9 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -33,7 +33,6 @@
33#ifndef __DRM_CRTC_HELPER_H__ 33#ifndef __DRM_CRTC_HELPER_H__
34#define __DRM_CRTC_HELPER_H__ 34#define __DRM_CRTC_HELPER_H__
35 35
36#include <linux/i2c.h>
37#include <linux/spinlock.h> 36#include <linux/spinlock.h>
38#include <linux/types.h> 37#include <linux/types.h>
39#include <linux/idr.h> 38#include <linux/idr.h>
@@ -92,7 +91,7 @@ struct drm_connector_helper_funcs {
92extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY); 91extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY);
93extern void drm_helper_disable_unused_functions(struct drm_device *dev); 92extern void drm_helper_disable_unused_functions(struct drm_device *dev);
94extern int drm_helper_hotplug_stage_two(struct drm_device *dev); 93extern int drm_helper_hotplug_stage_two(struct drm_device *dev);
95extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow); 94extern bool drm_helper_initial_config(struct drm_device *dev);
96extern int drm_crtc_helper_set_config(struct drm_mode_set *set); 95extern int drm_crtc_helper_set_config(struct drm_mode_set *set);
97extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, 96extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
98 struct drm_display_mode *mode, 97 struct drm_display_mode *mode,
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index ff8d27af4786..a11cc9d32591 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -69,8 +69,8 @@ struct detailed_pixel_timing {
69 u8 hborder; 69 u8 hborder;
70 u8 vborder; 70 u8 vborder;
71 u8 unknown0:1; 71 u8 unknown0:1;
72 u8 vsync_positive:1;
73 u8 hsync_positive:1; 72 u8 hsync_positive:1;
73 u8 vsync_positive:1;
74 u8 separate_sync:2; 74 u8 separate_sync:2;
75 u8 stereo:1; 75 u8 stereo:1;
76 u8 unknown6:1; 76 u8 unknown6:1;
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 601d2bd839f6..ae304cc73c90 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -27,11 +27,8 @@
27#ifndef _DRM_MODE_H 27#ifndef _DRM_MODE_H
28#define _DRM_MODE_H 28#define _DRM_MODE_H
29 29
30#if !defined(__KERNEL__) && !defined(_KERNEL)
31#include <stdint.h>
32#else
33#include <linux/kernel.h> 30#include <linux/kernel.h>
34#endif 31#include <linux/types.h>
35 32
36#define DRM_DISPLAY_INFO_LEN 32 33#define DRM_DISPLAY_INFO_LEN 32
37#define DRM_CONNECTOR_NAME_LEN 32 34#define DRM_CONNECTOR_NAME_LEN 32
@@ -81,41 +78,41 @@
81#define DRM_MODE_DITHERING_ON 1 78#define DRM_MODE_DITHERING_ON 1
82 79
83struct drm_mode_modeinfo { 80struct drm_mode_modeinfo {
84 uint32_t clock; 81 __u32 clock;
85 uint16_t hdisplay, hsync_start, hsync_end, htotal, hskew; 82 __u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
86 uint16_t vdisplay, vsync_start, vsync_end, vtotal, vscan; 83 __u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
87 84
88 uint32_t vrefresh; /* vertical refresh * 1000 */ 85 __u32 vrefresh; /* vertical refresh * 1000 */
89 86
90 uint32_t flags; 87 __u32 flags;
91 uint32_t type; 88 __u32 type;
92 char name[DRM_DISPLAY_MODE_LEN]; 89 char name[DRM_DISPLAY_MODE_LEN];
93}; 90};
94 91
95struct drm_mode_card_res { 92struct drm_mode_card_res {
96 uint64_t fb_id_ptr; 93 __u64 fb_id_ptr;
97 uint64_t crtc_id_ptr; 94 __u64 crtc_id_ptr;
98 uint64_t connector_id_ptr; 95 __u64 connector_id_ptr;
99 uint64_t encoder_id_ptr; 96 __u64 encoder_id_ptr;
100 uint32_t count_fbs; 97 __u32 count_fbs;
101 uint32_t count_crtcs; 98 __u32 count_crtcs;
102 uint32_t count_connectors; 99 __u32 count_connectors;
103 uint32_t count_encoders; 100 __u32 count_encoders;
104 uint32_t min_width, max_width; 101 __u32 min_width, max_width;
105 uint32_t min_height, max_height; 102 __u32 min_height, max_height;
106}; 103};
107 104
108struct drm_mode_crtc { 105struct drm_mode_crtc {
109 uint64_t set_connectors_ptr; 106 __u64 set_connectors_ptr;
110 uint32_t count_connectors; 107 __u32 count_connectors;
111 108
112 uint32_t crtc_id; /**< Id */ 109 __u32 crtc_id; /**< Id */
113 uint32_t fb_id; /**< Id of framebuffer */ 110 __u32 fb_id; /**< Id of framebuffer */
114 111
115 uint32_t x, y; /**< Position on the frameuffer */ 112 __u32 x, y; /**< Position on the frameuffer */
116 113
117 uint32_t gamma_size; 114 __u32 gamma_size;
118 uint32_t mode_valid; 115 __u32 mode_valid;
119 struct drm_mode_modeinfo mode; 116 struct drm_mode_modeinfo mode;
120}; 117};
121 118
@@ -126,13 +123,13 @@ struct drm_mode_crtc {
126#define DRM_MODE_ENCODER_TVDAC 4 123#define DRM_MODE_ENCODER_TVDAC 4
127 124
128struct drm_mode_get_encoder { 125struct drm_mode_get_encoder {
129 uint32_t encoder_id; 126 __u32 encoder_id;
130 uint32_t encoder_type; 127 __u32 encoder_type;
131 128
132 uint32_t crtc_id; /**< Id of crtc */ 129 __u32 crtc_id; /**< Id of crtc */
133 130
134 uint32_t possible_crtcs; 131 __u32 possible_crtcs;
135 uint32_t possible_clones; 132 __u32 possible_clones;
136}; 133};
137 134
138/* This is for connectors with multiple signal types. */ 135/* This is for connectors with multiple signal types. */
@@ -161,23 +158,23 @@ struct drm_mode_get_encoder {
161 158
162struct drm_mode_get_connector { 159struct drm_mode_get_connector {
163 160
164 uint64_t encoders_ptr; 161 __u64 encoders_ptr;
165 uint64_t modes_ptr; 162 __u64 modes_ptr;
166 uint64_t props_ptr; 163 __u64 props_ptr;
167 uint64_t prop_values_ptr; 164 __u64 prop_values_ptr;
168 165
169 uint32_t count_modes; 166 __u32 count_modes;
170 uint32_t count_props; 167 __u32 count_props;
171 uint32_t count_encoders; 168 __u32 count_encoders;
172 169
173 uint32_t encoder_id; /**< Current Encoder */ 170 __u32 encoder_id; /**< Current Encoder */
174 uint32_t connector_id; /**< Id */ 171 __u32 connector_id; /**< Id */
175 uint32_t connector_type; 172 __u32 connector_type;
176 uint32_t connector_type_id; 173 __u32 connector_type_id;
177 174
178 uint32_t connection; 175 __u32 connection;
179 uint32_t mm_width, mm_height; /**< HxW in millimeters */ 176 __u32 mm_width, mm_height; /**< HxW in millimeters */
180 uint32_t subpixel; 177 __u32 subpixel;
181}; 178};
182 179
183#define DRM_MODE_PROP_PENDING (1<<0) 180#define DRM_MODE_PROP_PENDING (1<<0)
@@ -187,46 +184,46 @@ struct drm_mode_get_connector {
187#define DRM_MODE_PROP_BLOB (1<<4) 184#define DRM_MODE_PROP_BLOB (1<<4)
188 185
189struct drm_mode_property_enum { 186struct drm_mode_property_enum {
190 uint64_t value; 187 __u64 value;
191 char name[DRM_PROP_NAME_LEN]; 188 char name[DRM_PROP_NAME_LEN];
192}; 189};
193 190
194struct drm_mode_get_property { 191struct drm_mode_get_property {
195 uint64_t values_ptr; /* values and blob lengths */ 192 __u64 values_ptr; /* values and blob lengths */
196 uint64_t enum_blob_ptr; /* enum and blob id ptrs */ 193 __u64 enum_blob_ptr; /* enum and blob id ptrs */
197 194
198 uint32_t prop_id; 195 __u32 prop_id;
199 uint32_t flags; 196 __u32 flags;
200 char name[DRM_PROP_NAME_LEN]; 197 char name[DRM_PROP_NAME_LEN];
201 198
202 uint32_t count_values; 199 __u32 count_values;
203 uint32_t count_enum_blobs; 200 __u32 count_enum_blobs;
204}; 201};
205 202
206struct drm_mode_connector_set_property { 203struct drm_mode_connector_set_property {
207 uint64_t value; 204 __u64 value;
208 uint32_t prop_id; 205 __u32 prop_id;
209 uint32_t connector_id; 206 __u32 connector_id;
210}; 207};
211 208
212struct drm_mode_get_blob { 209struct drm_mode_get_blob {
213 uint32_t blob_id; 210 __u32 blob_id;
214 uint32_t length; 211 __u32 length;
215 uint64_t data; 212 __u64 data;
216}; 213};
217 214
218struct drm_mode_fb_cmd { 215struct drm_mode_fb_cmd {
219 uint32_t fb_id; 216 __u32 fb_id;
220 uint32_t width, height; 217 __u32 width, height;
221 uint32_t pitch; 218 __u32 pitch;
222 uint32_t bpp; 219 __u32 bpp;
223 uint32_t depth; 220 __u32 depth;
224 /* driver specific handle */ 221 /* driver specific handle */
225 uint32_t handle; 222 __u32 handle;
226}; 223};
227 224
228struct drm_mode_mode_cmd { 225struct drm_mode_mode_cmd {
229 uint32_t connector_id; 226 __u32 connector_id;
230 struct drm_mode_modeinfo mode; 227 struct drm_mode_modeinfo mode;
231}; 228};
232 229
@@ -248,24 +245,24 @@ struct drm_mode_mode_cmd {
248 * y 245 * y
249 */ 246 */
250struct drm_mode_cursor { 247struct drm_mode_cursor {
251 uint32_t flags; 248 __u32 flags;
252 uint32_t crtc_id; 249 __u32 crtc_id;
253 int32_t x; 250 __s32 x;
254 int32_t y; 251 __s32 y;
255 uint32_t width; 252 __u32 width;
256 uint32_t height; 253 __u32 height;
257 /* driver specific handle */ 254 /* driver specific handle */
258 uint32_t handle; 255 __u32 handle;
259}; 256};
260 257
261struct drm_mode_crtc_lut { 258struct drm_mode_crtc_lut {
262 uint32_t crtc_id; 259 __u32 crtc_id;
263 uint32_t gamma_size; 260 __u32 gamma_size;
264 261
265 /* pointers to arrays */ 262 /* pointers to arrays */
266 uint64_t red; 263 __u64 red;
267 uint64_t green; 264 __u64 green;
268 uint64_t blue; 265 __u64 blue;
269}; 266};
270 267
271#endif 268#endif
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h
index 8dbd2572b7c3..26641e95e0a4 100644
--- a/include/drm/drm_os_linux.h
+++ b/include/drm/drm_os_linux.h
@@ -6,6 +6,19 @@
6#include <linux/interrupt.h> /* For task queue support */ 6#include <linux/interrupt.h> /* For task queue support */
7#include <linux/delay.h> 7#include <linux/delay.h>
8 8
9#ifndef readq
10static inline u64 readq(void __iomem *reg)
11{
12 return ((u64) readl(reg)) | (((u64) readl(reg + 4UL)) << 32);
13}
14
15static inline void writeq(u64 val, void __iomem *reg)
16{
17 writel(val & 0xffffffff, reg);
18 writel(val >> 32, reg + 0x4UL);
19}
20#endif
21
9/** Current process ID */ 22/** Current process ID */
10#define DRM_CURRENTPID task_pid_nr(current) 23#define DRM_CURRENTPID task_pid_nr(current)
11#define DRM_SUSER(p) capable(CAP_SYS_ADMIN) 24#define DRM_SUSER(p) capable(CAP_SYS_ADMIN)
@@ -23,6 +36,12 @@
23/** Write a dword into a MMIO region */ 36/** Write a dword into a MMIO region */
24#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset)) 37#define DRM_WRITE32(map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset))
25/** Read memory barrier */ 38/** Read memory barrier */
39
40/** Read a qword from a MMIO region - be careful using these unless you really understand them */
41#define DRM_READ64(map, offset) readq(((void __iomem *)(map)->handle) + (offset))
42/** Write a qword into a MMIO region */
43#define DRM_WRITE64(map, offset, val) writeq(val, ((void __iomem *)(map)->handle) + (offset))
44
26#define DRM_READMEMORYBARRIER() rmb() 45#define DRM_READMEMORYBARRIER() rmb()
27/** Write memory barrier */ 46/** Write memory barrier */
28#define DRM_WRITEMEMORYBARRIER() wmb() 47#define DRM_WRITEMEMORYBARRIER() wmb()
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 5165f240aa68..fc55db780199 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -239,10 +239,123 @@
239 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 239 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
240 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 240 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
241 {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 241 {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
242 {0x1002, 0x793f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
243 {0x1002, 0x7941, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
244 {0x1002, 0x7942, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS600|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
242 {0x1002, 0x796c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 245 {0x1002, 0x796c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
243 {0x1002, 0x796d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 246 {0x1002, 0x796d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
244 {0x1002, 0x796e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 247 {0x1002, 0x796e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
245 {0x1002, 0x796f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 248 {0x1002, 0x796f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
249 {0x1002, 0x9400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
250 {0x1002, 0x9401, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
251 {0x1002, 0x9402, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
252 {0x1002, 0x9403, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
253 {0x1002, 0x9405, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
254 {0x1002, 0x940A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
255 {0x1002, 0x940B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
256 {0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
257 {0x1002, 0x9440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
258 {0x1002, 0x9441, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
259 {0x1002, 0x9442, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
260 {0x1002, 0x9444, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
261 {0x1002, 0x9446, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
262 {0x1002, 0x944A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
263 {0x1002, 0x944B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
264 {0x1002, 0x944C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
265 {0x1002, 0x944E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
266 {0x1002, 0x9450, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
267 {0x1002, 0x9452, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
268 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
269 {0x1002, 0x945A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
270 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
271 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
272 {0x1002, 0x946B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
273 {0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
274 {0x1002, 0x947B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
275 {0x1002, 0x9480, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
276 {0x1002, 0x9487, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
277 {0x1002, 0x9488, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
278 {0x1002, 0x9489, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
279 {0x1002, 0x948F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
280 {0x1002, 0x9490, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
281 {0x1002, 0x9491, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
282 {0x1002, 0x9498, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
283 {0x1002, 0x949C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
284 {0x1002, 0x949E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
285 {0x1002, 0x949F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV730|RADEON_NEW_MEMMAP}, \
286 {0x1002, 0x94C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
287 {0x1002, 0x94C1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
288 {0x1002, 0x94C3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
289 {0x1002, 0x94C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
290 {0x1002, 0x94C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
291 {0x1002, 0x94C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
292 {0x1002, 0x94C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
293 {0x1002, 0x94C8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
294 {0x1002, 0x94C9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
295 {0x1002, 0x94CB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
296 {0x1002, 0x94CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
297 {0x1002, 0x94CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV610|RADEON_NEW_MEMMAP}, \
298 {0x1002, 0x9500, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
299 {0x1002, 0x9501, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
300 {0x1002, 0x9504, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
301 {0x1002, 0x9505, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
302 {0x1002, 0x9506, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
303 {0x1002, 0x9507, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
304 {0x1002, 0x9508, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
305 {0x1002, 0x9509, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
306 {0x1002, 0x950F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
307 {0x1002, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
308 {0x1002, 0x9515, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
309 {0x1002, 0x9517, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
310 {0x1002, 0x9519, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV670|RADEON_NEW_MEMMAP}, \
311 {0x1002, 0x9540, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
312 {0x1002, 0x9541, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
313 {0x1002, 0x9542, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
314 {0x1002, 0x954E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
315 {0x1002, 0x954F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_NEW_MEMMAP}, \
316 {0x1002, 0x9552, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
317 {0x1002, 0x9553, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
318 {0x1002, 0x9555, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV710|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
319 {0x1002, 0x9580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
320 {0x1002, 0x9581, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
321 {0x1002, 0x9583, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
322 {0x1002, 0x9586, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
323 {0x1002, 0x9587, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
324 {0x1002, 0x9588, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
325 {0x1002, 0x9589, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
326 {0x1002, 0x958A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
327 {0x1002, 0x958B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
328 {0x1002, 0x958C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
329 {0x1002, 0x958D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
330 {0x1002, 0x958E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_NEW_MEMMAP}, \
331 {0x1002, 0x958F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV630|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
332 {0x1002, 0x9590, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
333 {0x1002, 0x9591, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
334 {0x1002, 0x9593, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
335 {0x1002, 0x9595, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
336 {0x1002, 0x9596, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
337 {0x1002, 0x9597, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
338 {0x1002, 0x9598, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
339 {0x1002, 0x9599, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \
340 {0x1002, 0x959B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
341 {0x1002, 0x95C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
342 {0x1002, 0x95C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
343 {0x1002, 0x95C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
344 {0x1002, 0x95C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
345 {0x1002, 0x95C9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
346 {0x1002, 0x95C2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
347 {0x1002, 0x95C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
348 {0x1002, 0x95CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
349 {0x1002, 0x95CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
350 {0x1002, 0x95CE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
351 {0x1002, 0x95CF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \
352 {0x1002, 0x9610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
353 {0x1002, 0x9611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
354 {0x1002, 0x9612, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
355 {0x1002, 0x9613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
356 {0x1002, 0x9614, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
357 {0x1002, 0x9615, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
358 {0x1002, 0x9616, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS780|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
246 {0, 0, 0} 359 {0, 0, 0}
247 360
248#define r128_PCI_IDS \ 361#define r128_PCI_IDS \
@@ -359,6 +472,7 @@
359 {0x8086, 0x2562, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 472 {0x8086, 0x2562, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
360 {0x8086, 0x3582, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ 473 {0x8086, 0x3582, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
361 {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}, \
362 {0, 0, 0} 476 {0, 0, 0}
363 477
364#define gamma_PCI_IDS \ 478#define gamma_PCI_IDS \
@@ -418,4 +532,8 @@
418 {0x8086, 0x2e02, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 532 {0x8086, 0x2e02, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
419 {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 533 {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
420 {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}, \
535 {0x8086, 0x2e32, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
536 {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
537 {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
538 {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
421 {0, 0, 0} 539 {0, 0, 0}
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 912cd52db965..95962fa8398a 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -30,7 +30,7 @@
30/* Please note that modifications to all structs defined here are 30/* Please note that modifications to all structs defined here are
31 * subject to backwards-compatibility constraints. 31 * subject to backwards-compatibility constraints.
32 */ 32 */
33 33#include <linux/types.h>
34#include "drm.h" 34#include "drm.h"
35 35
36/* Each region is a minimum of 16k, and there are at most 255 of them. 36/* Each region is a minimum of 16k, and there are at most 255 of them.
@@ -116,15 +116,15 @@ typedef struct _drm_i915_sarea {
116 116
117 /* fill out some space for old userspace triple buffer */ 117 /* fill out some space for old userspace triple buffer */
118 drm_handle_t unused_handle; 118 drm_handle_t unused_handle;
119 uint32_t unused1, unused2, unused3; 119 __u32 unused1, unused2, unused3;
120 120
121 /* buffer object handles for static buffers. May change 121 /* buffer object handles for static buffers. May change
122 * over the lifetime of the client. 122 * over the lifetime of the client.
123 */ 123 */
124 uint32_t front_bo_handle; 124 __u32 front_bo_handle;
125 uint32_t back_bo_handle; 125 __u32 back_bo_handle;
126 uint32_t unused_bo_handle; 126 __u32 unused_bo_handle;
127 uint32_t depth_bo_handle; 127 __u32 depth_bo_handle;
128 128
129} drm_i915_sarea_t; 129} drm_i915_sarea_t;
130 130
@@ -327,7 +327,7 @@ typedef struct drm_i915_vblank_swap {
327} drm_i915_vblank_swap_t; 327} drm_i915_vblank_swap_t;
328 328
329typedef struct drm_i915_hws_addr { 329typedef struct drm_i915_hws_addr {
330 uint64_t addr; 330 __u64 addr;
331} drm_i915_hws_addr_t; 331} drm_i915_hws_addr_t;
332 332
333struct drm_i915_gem_init { 333struct drm_i915_gem_init {
@@ -335,12 +335,12 @@ struct drm_i915_gem_init {
335 * Beginning offset in the GTT to be managed by the DRM memory 335 * Beginning offset in the GTT to be managed by the DRM memory
336 * manager. 336 * manager.
337 */ 337 */
338 uint64_t gtt_start; 338 __u64 gtt_start;
339 /** 339 /**
340 * Ending offset in the GTT to be managed by the DRM memory 340 * Ending offset in the GTT to be managed by the DRM memory
341 * manager. 341 * manager.
342 */ 342 */
343 uint64_t gtt_end; 343 __u64 gtt_end;
344}; 344};
345 345
346struct drm_i915_gem_create { 346struct drm_i915_gem_create {
@@ -349,94 +349,94 @@ struct drm_i915_gem_create {
349 * 349 *
350 * The (page-aligned) allocated size for the object will be returned. 350 * The (page-aligned) allocated size for the object will be returned.
351 */ 351 */
352 uint64_t size; 352 __u64 size;
353 /** 353 /**
354 * Returned handle for the object. 354 * Returned handle for the object.
355 * 355 *
356 * Object handles are nonzero. 356 * Object handles are nonzero.
357 */ 357 */
358 uint32_t handle; 358 __u32 handle;
359 uint32_t pad; 359 __u32 pad;
360}; 360};
361 361
362struct drm_i915_gem_pread { 362struct drm_i915_gem_pread {
363 /** Handle for the object being read. */ 363 /** Handle for the object being read. */
364 uint32_t handle; 364 __u32 handle;
365 uint32_t pad; 365 __u32 pad;
366 /** Offset into the object to read from */ 366 /** Offset into the object to read from */
367 uint64_t offset; 367 __u64 offset;
368 /** Length of data to read */ 368 /** Length of data to read */
369 uint64_t size; 369 __u64 size;
370 /** 370 /**
371 * Pointer to write the data into. 371 * Pointer to write the data into.
372 * 372 *
373 * This is a fixed-size type for 32/64 compatibility. 373 * This is a fixed-size type for 32/64 compatibility.
374 */ 374 */
375 uint64_t data_ptr; 375 __u64 data_ptr;
376}; 376};
377 377
378struct drm_i915_gem_pwrite { 378struct drm_i915_gem_pwrite {
379 /** Handle for the object being written to. */ 379 /** Handle for the object being written to. */
380 uint32_t handle; 380 __u32 handle;
381 uint32_t pad; 381 __u32 pad;
382 /** Offset into the object to write to */ 382 /** Offset into the object to write to */
383 uint64_t offset; 383 __u64 offset;
384 /** Length of data to write */ 384 /** Length of data to write */
385 uint64_t size; 385 __u64 size;
386 /** 386 /**
387 * Pointer to read the data from. 387 * Pointer to read the data from.
388 * 388 *
389 * This is a fixed-size type for 32/64 compatibility. 389 * This is a fixed-size type for 32/64 compatibility.
390 */ 390 */
391 uint64_t data_ptr; 391 __u64 data_ptr;
392}; 392};
393 393
394struct drm_i915_gem_mmap { 394struct drm_i915_gem_mmap {
395 /** Handle for the object being mapped. */ 395 /** Handle for the object being mapped. */
396 uint32_t handle; 396 __u32 handle;
397 uint32_t pad; 397 __u32 pad;
398 /** Offset in the object to map. */ 398 /** Offset in the object to map. */
399 uint64_t offset; 399 __u64 offset;
400 /** 400 /**
401 * Length of data to map. 401 * Length of data to map.
402 * 402 *
403 * The value will be page-aligned. 403 * The value will be page-aligned.
404 */ 404 */
405 uint64_t size; 405 __u64 size;
406 /** 406 /**
407 * Returned pointer the data was mapped at. 407 * Returned pointer the data was mapped at.
408 * 408 *
409 * This is a fixed-size type for 32/64 compatibility. 409 * This is a fixed-size type for 32/64 compatibility.
410 */ 410 */
411 uint64_t addr_ptr; 411 __u64 addr_ptr;
412}; 412};
413 413
414struct drm_i915_gem_mmap_gtt { 414struct drm_i915_gem_mmap_gtt {
415 /** Handle for the object being mapped. */ 415 /** Handle for the object being mapped. */
416 uint32_t handle; 416 __u32 handle;
417 uint32_t pad; 417 __u32 pad;
418 /** 418 /**
419 * Fake offset to use for subsequent mmap call 419 * Fake offset to use for subsequent mmap call
420 * 420 *
421 * This is a fixed-size type for 32/64 compatibility. 421 * This is a fixed-size type for 32/64 compatibility.
422 */ 422 */
423 uint64_t offset; 423 __u64 offset;
424}; 424};
425 425
426struct drm_i915_gem_set_domain { 426struct drm_i915_gem_set_domain {
427 /** Handle for the object */ 427 /** Handle for the object */
428 uint32_t handle; 428 __u32 handle;
429 429
430 /** New read domains */ 430 /** New read domains */
431 uint32_t read_domains; 431 __u32 read_domains;
432 432
433 /** New write domain */ 433 /** New write domain */
434 uint32_t write_domain; 434 __u32 write_domain;
435}; 435};
436 436
437struct drm_i915_gem_sw_finish { 437struct drm_i915_gem_sw_finish {
438 /** Handle for the object */ 438 /** Handle for the object */
439 uint32_t handle; 439 __u32 handle;
440}; 440};
441 441
442struct drm_i915_gem_relocation_entry { 442struct drm_i915_gem_relocation_entry {
@@ -448,16 +448,16 @@ struct drm_i915_gem_relocation_entry {
448 * a relocation list for state buffers and not re-write it per 448 * a relocation list for state buffers and not re-write it per
449 * exec using the buffer. 449 * exec using the buffer.
450 */ 450 */
451 uint32_t target_handle; 451 __u32 target_handle;
452 452
453 /** 453 /**
454 * Value to be added to the offset of the target buffer to make up 454 * Value to be added to the offset of the target buffer to make up
455 * the relocation entry. 455 * the relocation entry.
456 */ 456 */
457 uint32_t delta; 457 __u32 delta;
458 458
459 /** Offset in the buffer the relocation entry will be written into */ 459 /** Offset in the buffer the relocation entry will be written into */
460 uint64_t offset; 460 __u64 offset;
461 461
462 /** 462 /**
463 * Offset value of the target buffer that the relocation entry was last 463 * Offset value of the target buffer that the relocation entry was last
@@ -467,12 +467,12 @@ struct drm_i915_gem_relocation_entry {
467 * and writing the relocation. This value is written back out by 467 * and writing the relocation. This value is written back out by
468 * the execbuffer ioctl when the relocation is written. 468 * the execbuffer ioctl when the relocation is written.
469 */ 469 */
470 uint64_t presumed_offset; 470 __u64 presumed_offset;
471 471
472 /** 472 /**
473 * Target memory domains read by this operation. 473 * Target memory domains read by this operation.
474 */ 474 */
475 uint32_t read_domains; 475 __u32 read_domains;
476 476
477 /** 477 /**
478 * Target memory domains written by this operation. 478 * Target memory domains written by this operation.
@@ -481,7 +481,7 @@ struct drm_i915_gem_relocation_entry {
481 * execbuffer operation, so that where there are conflicts, 481 * execbuffer operation, so that where there are conflicts,
482 * the application will get -EINVAL back. 482 * the application will get -EINVAL back.
483 */ 483 */
484 uint32_t write_domain; 484 __u32 write_domain;
485}; 485};
486 486
487/** @{ 487/** @{
@@ -512,24 +512,24 @@ struct drm_i915_gem_exec_object {
512 * User's handle for a buffer to be bound into the GTT for this 512 * User's handle for a buffer to be bound into the GTT for this
513 * operation. 513 * operation.
514 */ 514 */
515 uint32_t handle; 515 __u32 handle;
516 516
517 /** Number of relocations to be performed on this buffer */ 517 /** Number of relocations to be performed on this buffer */
518 uint32_t relocation_count; 518 __u32 relocation_count;
519 /** 519 /**
520 * Pointer to array of struct drm_i915_gem_relocation_entry containing 520 * Pointer to array of struct drm_i915_gem_relocation_entry containing
521 * the relocations to be performed in this buffer. 521 * the relocations to be performed in this buffer.
522 */ 522 */
523 uint64_t relocs_ptr; 523 __u64 relocs_ptr;
524 524
525 /** Required alignment in graphics aperture */ 525 /** Required alignment in graphics aperture */
526 uint64_t alignment; 526 __u64 alignment;
527 527
528 /** 528 /**
529 * Returned value of the updated offset of the object, for future 529 * Returned value of the updated offset of the object, for future
530 * presumed_offset writes. 530 * presumed_offset writes.
531 */ 531 */
532 uint64_t offset; 532 __u64 offset;
533}; 533};
534 534
535struct drm_i915_gem_execbuffer { 535struct drm_i915_gem_execbuffer {
@@ -543,44 +543,44 @@ struct drm_i915_gem_execbuffer {
543 * a buffer is performing refer to buffers that have already appeared 543 * a buffer is performing refer to buffers that have already appeared
544 * in the validate list. 544 * in the validate list.
545 */ 545 */
546 uint64_t buffers_ptr; 546 __u64 buffers_ptr;
547 uint32_t buffer_count; 547 __u32 buffer_count;
548 548
549 /** Offset in the batchbuffer to start execution from. */ 549 /** Offset in the batchbuffer to start execution from. */
550 uint32_t batch_start_offset; 550 __u32 batch_start_offset;
551 /** Bytes used in batchbuffer from batch_start_offset */ 551 /** Bytes used in batchbuffer from batch_start_offset */
552 uint32_t batch_len; 552 __u32 batch_len;
553 uint32_t DR1; 553 __u32 DR1;
554 uint32_t DR4; 554 __u32 DR4;
555 uint32_t num_cliprects; 555 __u32 num_cliprects;
556 /** This is a struct drm_clip_rect *cliprects */ 556 /** This is a struct drm_clip_rect *cliprects */
557 uint64_t cliprects_ptr; 557 __u64 cliprects_ptr;
558}; 558};
559 559
560struct drm_i915_gem_pin { 560struct drm_i915_gem_pin {
561 /** Handle of the buffer to be pinned. */ 561 /** Handle of the buffer to be pinned. */
562 uint32_t handle; 562 __u32 handle;
563 uint32_t pad; 563 __u32 pad;
564 564
565 /** alignment required within the aperture */ 565 /** alignment required within the aperture */
566 uint64_t alignment; 566 __u64 alignment;
567 567
568 /** Returned GTT offset of the buffer. */ 568 /** Returned GTT offset of the buffer. */
569 uint64_t offset; 569 __u64 offset;
570}; 570};
571 571
572struct drm_i915_gem_unpin { 572struct drm_i915_gem_unpin {
573 /** Handle of the buffer to be unpinned. */ 573 /** Handle of the buffer to be unpinned. */
574 uint32_t handle; 574 __u32 handle;
575 uint32_t pad; 575 __u32 pad;
576}; 576};
577 577
578struct drm_i915_gem_busy { 578struct drm_i915_gem_busy {
579 /** Handle of the buffer to check for busy */ 579 /** Handle of the buffer to check for busy */
580 uint32_t handle; 580 __u32 handle;
581 581
582 /** Return busy status (1 if busy, 0 if idle) */ 582 /** Return busy status (1 if busy, 0 if idle) */
583 uint32_t busy; 583 __u32 busy;
584}; 584};
585 585
586#define I915_TILING_NONE 0 586#define I915_TILING_NONE 0
@@ -594,10 +594,13 @@ 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 */
600 uint32_t handle; 603 __u32 handle;
601 604
602 /** 605 /**
603 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 606 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
@@ -611,47 +614,47 @@ struct drm_i915_gem_set_tiling {
611 * 614 *
612 * Buffer contents become undefined when changing tiling_mode. 615 * Buffer contents become undefined when changing tiling_mode.
613 */ 616 */
614 uint32_t tiling_mode; 617 __u32 tiling_mode;
615 618
616 /** 619 /**
617 * Stride in bytes for the object when in I915_TILING_X or 620 * Stride in bytes for the object when in I915_TILING_X or
618 * I915_TILING_Y. 621 * I915_TILING_Y.
619 */ 622 */
620 uint32_t stride; 623 __u32 stride;
621 624
622 /** 625 /**
623 * Returned address bit 6 swizzling required for CPU access through 626 * Returned address bit 6 swizzling required for CPU access through
624 * mmap mapping. 627 * mmap mapping.
625 */ 628 */
626 uint32_t swizzle_mode; 629 __u32 swizzle_mode;
627}; 630};
628 631
629struct drm_i915_gem_get_tiling { 632struct drm_i915_gem_get_tiling {
630 /** Handle of the buffer to get tiling state for. */ 633 /** Handle of the buffer to get tiling state for. */
631 uint32_t handle; 634 __u32 handle;
632 635
633 /** 636 /**
634 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 637 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
635 * I915_TILING_Y). 638 * I915_TILING_Y).
636 */ 639 */
637 uint32_t tiling_mode; 640 __u32 tiling_mode;
638 641
639 /** 642 /**
640 * Returned address bit 6 swizzling required for CPU access through 643 * Returned address bit 6 swizzling required for CPU access through
641 * mmap mapping. 644 * mmap mapping.
642 */ 645 */
643 uint32_t swizzle_mode; 646 __u32 swizzle_mode;
644}; 647};
645 648
646struct drm_i915_gem_get_aperture { 649struct drm_i915_gem_get_aperture {
647 /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ 650 /** Total size of the aperture used by i915_gem_execbuffer, in bytes */
648 uint64_t aper_size; 651 __u64 aper_size;
649 652
650 /** 653 /**
651 * Available space in the aperture used by i915_gem_execbuffer, in 654 * Available space in the aperture used by i915_gem_execbuffer, in
652 * bytes 655 * bytes
653 */ 656 */
654 uint64_t aper_available_size; 657 __u64 aper_available_size;
655}; 658};
656 659
657#endif /* _I915_DRM_H_ */ 660#endif /* _I915_DRM_H_ */
diff --git a/include/drm/mga_drm.h b/include/drm/mga_drm.h
index 944b50a5ff24..325fd6fb4a42 100644
--- a/include/drm/mga_drm.h
+++ b/include/drm/mga_drm.h
@@ -35,6 +35,8 @@
35#ifndef __MGA_DRM_H__ 35#ifndef __MGA_DRM_H__
36#define __MGA_DRM_H__ 36#define __MGA_DRM_H__
37 37
38#include <linux/types.h>
39
38/* WARNING: If you change any of these defines, make sure to change the 40/* WARNING: If you change any of these defines, make sure to change the
39 * defines in the Xserver file (mga_sarea.h) 41 * defines in the Xserver file (mga_sarea.h)
40 */ 42 */
@@ -255,8 +257,8 @@ typedef struct _drm_mga_sarea {
255#define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t) 257#define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t)
256#define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t) 258#define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t)
257#define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t) 259#define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t)
258#define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, uint32_t) 260#define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, __u32)
259#define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, uint32_t) 261#define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, __u32)
260#define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t) 262#define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t)
261 263
262typedef struct _drm_mga_warp_index { 264typedef struct _drm_mga_warp_index {
@@ -310,7 +312,7 @@ typedef struct drm_mga_dma_bootstrap {
310 */ 312 */
311 /*@{ */ 313 /*@{ */
312 unsigned long texture_handle; /**< Handle used to map AGP textures. */ 314 unsigned long texture_handle; /**< Handle used to map AGP textures. */
313 uint32_t texture_size; /**< Size of the AGP texture region. */ 315 __u32 texture_size; /**< Size of the AGP texture region. */
314 /*@} */ 316 /*@} */
315 317
316 /** 318 /**
@@ -319,7 +321,7 @@ typedef struct drm_mga_dma_bootstrap {
319 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be 321 * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be
320 * filled in with the actual AGP mode. If AGP was not available 322 * filled in with the actual AGP mode. If AGP was not available
321 */ 323 */
322 uint32_t primary_size; 324 __u32 primary_size;
323 325
324 /** 326 /**
325 * Requested number of secondary DMA buffers. 327 * Requested number of secondary DMA buffers.
@@ -329,7 +331,7 @@ typedef struct drm_mga_dma_bootstrap {
329 * allocated. Particularly when PCI DMA is used, this may be 331 * allocated. Particularly when PCI DMA is used, this may be
330 * (subtantially) less than the number requested. 332 * (subtantially) less than the number requested.
331 */ 333 */
332 uint32_t secondary_bin_count; 334 __u32 secondary_bin_count;
333 335
334 /** 336 /**
335 * Requested size of each secondary DMA buffer. 337 * Requested size of each secondary DMA buffer.
@@ -338,7 +340,7 @@ typedef struct drm_mga_dma_bootstrap {
338 * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed 340 * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed
339 * to reduce dma_mga_dma_bootstrap::secondary_bin_size. 341 * to reduce dma_mga_dma_bootstrap::secondary_bin_size.
340 */ 342 */
341 uint32_t secondary_bin_size; 343 __u32 secondary_bin_size;
342 344
343 /** 345 /**
344 * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X, 346 * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X,
@@ -350,12 +352,12 @@ typedef struct drm_mga_dma_bootstrap {
350 * filled in with the actual AGP mode. If AGP was not available 352 * filled in with the actual AGP mode. If AGP was not available
351 * (i.e., PCI DMA was used), this value will be zero. 353 * (i.e., PCI DMA was used), this value will be zero.
352 */ 354 */
353 uint32_t agp_mode; 355 __u32 agp_mode;
354 356
355 /** 357 /**
356 * Desired AGP GART size, measured in megabytes. 358 * Desired AGP GART size, measured in megabytes.
357 */ 359 */
358 uint8_t agp_size; 360 __u8 agp_size;
359} drm_mga_dma_bootstrap_t; 361} drm_mga_dma_bootstrap_t;
360 362
361typedef struct drm_mga_clear { 363typedef struct drm_mga_clear {
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 73ff51f12311..fe3e3a4b4aed 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -33,6 +33,8 @@
33#ifndef __RADEON_DRM_H__ 33#ifndef __RADEON_DRM_H__
34#define __RADEON_DRM_H__ 34#define __RADEON_DRM_H__
35 35
36#include <linux/types.h>
37
36/* WARNING: If you change any of these defines, make sure to change the 38/* WARNING: If you change any of these defines, make sure to change the
37 * defines in the X server file (radeon_sarea.h) 39 * defines in the X server file (radeon_sarea.h)
38 */ 40 */
@@ -304,6 +306,8 @@ typedef union {
304 306
305#define RADEON_SCRATCH_REG_OFFSET 32 307#define RADEON_SCRATCH_REG_OFFSET 32
306 308
309#define R600_SCRATCH_REG_OFFSET 256
310
307#define RADEON_NR_SAREA_CLIPRECTS 12 311#define RADEON_NR_SAREA_CLIPRECTS 12
308 312
309/* There are 2 heaps (local/GART). Each region within a heap is a 313/* There are 2 heaps (local/GART). Each region within a heap is a
@@ -526,7 +530,8 @@ typedef struct drm_radeon_init {
526 RADEON_INIT_CP = 0x01, 530 RADEON_INIT_CP = 0x01,
527 RADEON_CLEANUP_CP = 0x02, 531 RADEON_CLEANUP_CP = 0x02,
528 RADEON_INIT_R200_CP = 0x03, 532 RADEON_INIT_R200_CP = 0x03,
529 RADEON_INIT_R300_CP = 0x04 533 RADEON_INIT_R300_CP = 0x04,
534 RADEON_INIT_R600_CP = 0x05
530 } func; 535 } func;
531 unsigned long sarea_priv_offset; 536 unsigned long sarea_priv_offset;
532 int is_pci; 537 int is_pci;
@@ -722,7 +727,7 @@ typedef struct drm_radeon_irq_wait {
722 727
723typedef struct drm_radeon_setparam { 728typedef struct drm_radeon_setparam {
724 unsigned int param; 729 unsigned int param;
725 int64_t value; 730 __s64 value;
726} drm_radeon_setparam_t; 731} drm_radeon_setparam_t;
727 732
728#define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */ 733#define RADEON_SETPARAM_FB_LOCATION 1 /* determined framebuffer location */
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h
index a3b5c102b067..170786e5c2ff 100644
--- a/include/drm/via_drm.h
+++ b/include/drm/via_drm.h
@@ -24,6 +24,8 @@
24#ifndef _VIA_DRM_H_ 24#ifndef _VIA_DRM_H_
25#define _VIA_DRM_H_ 25#define _VIA_DRM_H_
26 26
27#include <linux/types.h>
28
27/* WARNING: These defines must be the same as what the Xserver uses. 29/* WARNING: These defines must be the same as what the Xserver uses.
28 * if you change them, you must change the defines in the Xserver. 30 * if you change them, you must change the defines in the Xserver.
29 */ 31 */
@@ -114,19 +116,19 @@
114#define VIA_MEM_UNKNOWN 4 116#define VIA_MEM_UNKNOWN 4
115 117
116typedef struct { 118typedef struct {
117 uint32_t offset; 119 __u32 offset;
118 uint32_t size; 120 __u32 size;
119} drm_via_agp_t; 121} drm_via_agp_t;
120 122
121typedef struct { 123typedef struct {
122 uint32_t offset; 124 __u32 offset;
123 uint32_t size; 125 __u32 size;
124} drm_via_fb_t; 126} drm_via_fb_t;
125 127
126typedef struct { 128typedef struct {
127 uint32_t context; 129 __u32 context;
128 uint32_t type; 130 __u32 type;
129 uint32_t size; 131 __u32 size;
130 unsigned long index; 132 unsigned long index;
131 unsigned long offset; 133 unsigned long offset;
132} drm_via_mem_t; 134} drm_via_mem_t;
@@ -148,9 +150,9 @@ typedef struct _drm_via_futex {
148 VIA_FUTEX_WAIT = 0x00, 150 VIA_FUTEX_WAIT = 0x00,
149 VIA_FUTEX_WAKE = 0X01 151 VIA_FUTEX_WAKE = 0X01
150 } func; 152 } func;
151 uint32_t ms; 153 __u32 ms;
152 uint32_t lock; 154 __u32 lock;
153 uint32_t val; 155 __u32 val;
154} drm_via_futex_t; 156} drm_via_futex_t;
155 157
156typedef struct _drm_via_dma_init { 158typedef struct _drm_via_dma_init {
@@ -211,7 +213,7 @@ typedef struct _drm_via_cmdbuf_size {
211 VIA_CMDBUF_LAG = 0x02 213 VIA_CMDBUF_LAG = 0x02
212 } func; 214 } func;
213 int wait; 215 int wait;
214 uint32_t size; 216 __u32 size;
215} drm_via_cmdbuf_size_t; 217} drm_via_cmdbuf_size_t;
216 218
217typedef enum { 219typedef enum {
@@ -236,8 +238,8 @@ enum drm_via_irqs {
236struct drm_via_wait_irq_request { 238struct drm_via_wait_irq_request {
237 unsigned irq; 239 unsigned irq;
238 via_irq_seq_type_t type; 240 via_irq_seq_type_t type;
239 uint32_t sequence; 241 __u32 sequence;
240 uint32_t signal; 242 __u32 signal;
241}; 243};
242 244
243typedef union drm_via_irqwait { 245typedef union drm_via_irqwait {
@@ -246,7 +248,7 @@ typedef union drm_via_irqwait {
246} drm_via_irqwait_t; 248} drm_via_irqwait_t;
247 249
248typedef struct drm_via_blitsync { 250typedef struct drm_via_blitsync {
249 uint32_t sync_handle; 251 __u32 sync_handle;
250 unsigned engine; 252 unsigned engine;
251} drm_via_blitsync_t; 253} drm_via_blitsync_t;
252 254
@@ -257,16 +259,16 @@ typedef struct drm_via_blitsync {
257 */ 259 */
258 260
259typedef struct drm_via_dmablit { 261typedef struct drm_via_dmablit {
260 uint32_t num_lines; 262 __u32 num_lines;
261 uint32_t line_length; 263 __u32 line_length;
262 264
263 uint32_t fb_addr; 265 __u32 fb_addr;
264 uint32_t fb_stride; 266 __u32 fb_stride;
265 267
266 unsigned char *mem_addr; 268 unsigned char *mem_addr;
267 uint32_t mem_stride; 269 __u32 mem_stride;
268 270
269 uint32_t flags; 271 __u32 flags;
270 int to_fb; 272 int to_fb;
271 273
272 drm_via_blitsync_t sync; 274 drm_via_blitsync_t sync;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 106c3ba50844..ca9b9b9bd331 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -67,6 +67,7 @@ header-y += falloc.h
67header-y += fd.h 67header-y += fd.h
68header-y += fdreg.h 68header-y += fdreg.h
69header-y += fib_rules.h 69header-y += fib_rules.h
70header-y += fiemap.h
70header-y += firewire-cdev.h 71header-y += firewire-cdev.h
71header-y += firewire-constants.h 72header-y += firewire-constants.h
72header-y += fuse.h 73header-y += fuse.h
@@ -115,6 +116,7 @@ header-y += mqueue.h
115header-y += mtio.h 116header-y += mtio.h
116header-y += ncp_no.h 117header-y += ncp_no.h
117header-y += neighbour.h 118header-y += neighbour.h
119header-y += net_dropmon.h
118header-y += netfilter_arp.h 120header-y += netfilter_arp.h
119header-y += netrom.h 121header-y += netrom.h
120header-y += nfs2.h 122header-y += nfs2.h
@@ -157,8 +159,6 @@ header-y += ultrasound.h
157header-y += un.h 159header-y += un.h
158header-y += utime.h 160header-y += utime.h
159header-y += veth.h 161header-y += veth.h
160header-y += video_decoder.h
161header-y += video_encoder.h
162header-y += videotext.h 162header-y += videotext.h
163header-y += x25.h 163header-y += x25.h
164 164
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 6fce2fc2d124..88be890ee3c7 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -79,6 +79,7 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table);
79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); 79typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
80 80
81char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 81char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
82void __acpi_unmap_table(char *map, unsigned long size);
82int early_acpi_boot_init(void); 83int early_acpi_boot_init(void);
83int acpi_boot_init (void); 84int acpi_boot_init (void);
84int acpi_boot_table_init (void); 85int acpi_boot_table_init (void);
@@ -96,6 +97,7 @@ void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
96/* the following four functions are architecture-dependent */ 97/* the following four functions are architecture-dependent */
97void acpi_numa_slit_init (struct acpi_table_slit *slit); 98void acpi_numa_slit_init (struct acpi_table_slit *slit);
98void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); 99void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
100void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa);
99void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); 101void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
100void acpi_numa_arch_fixup(void); 102void acpi_numa_arch_fixup(void);
101 103
@@ -109,6 +111,7 @@ int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
109int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); 111int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
110void acpi_irq_stats_init(void); 112void acpi_irq_stats_init(void);
111extern u32 acpi_irq_handled; 113extern u32 acpi_irq_handled;
114extern u32 acpi_irq_not_handled;
112 115
113extern struct acpi_mcfg_allocation *pci_mmcfg_config; 116extern struct acpi_mcfg_allocation *pci_mmcfg_config;
114extern int pci_mmcfg_config_num; 117extern int pci_mmcfg_config_num;
@@ -256,6 +259,40 @@ void __init acpi_no_s4_hw_signature(void);
256void __init acpi_old_suspend_ordering(void); 259void __init acpi_old_suspend_ordering(void);
257void __init acpi_s4_no_nvs(void); 260void __init acpi_s4_no_nvs(void);
258#endif /* CONFIG_PM_SLEEP */ 261#endif /* CONFIG_PM_SLEEP */
262
263#define OSC_QUERY_TYPE 0
264#define OSC_SUPPORT_TYPE 1
265#define OSC_CONTROL_TYPE 2
266#define OSC_SUPPORT_MASKS 0x1f
267
268/* _OSC DW0 Definition */
269#define OSC_QUERY_ENABLE 1
270#define OSC_REQUEST_ERROR 2
271#define OSC_INVALID_UUID_ERROR 4
272#define OSC_INVALID_REVISION_ERROR 8
273#define OSC_CAPABILITIES_MASK_ERROR 16
274
275/* _OSC DW1 Definition (OS Support Fields) */
276#define OSC_EXT_PCI_CONFIG_SUPPORT 1
277#define OSC_ACTIVE_STATE_PWR_SUPPORT 2
278#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4
279#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8
280#define OSC_MSI_SUPPORT 16
281
282/* _OSC DW1 Definition (OS Control Fields) */
283#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1
284#define OSC_SHPC_NATIVE_HP_CONTROL 2
285#define OSC_PCI_EXPRESS_PME_CONTROL 4
286#define OSC_PCI_EXPRESS_AER_CONTROL 8
287#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16
288
289#define OSC_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
290 OSC_SHPC_NATIVE_HP_CONTROL | \
291 OSC_PCI_EXPRESS_PME_CONTROL | \
292 OSC_PCI_EXPRESS_AER_CONTROL | \
293 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
294
295extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags);
259#else /* CONFIG_ACPI */ 296#else /* CONFIG_ACPI */
260 297
261static inline int early_acpi_boot_init(void) 298static inline int early_acpi_boot_init(void)
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index 110c600c885f..f6778eceb8f4 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -77,20 +77,20 @@ typedef struct _agp_setup {
77 * The "prot" down below needs still a "sleep" flag somehow ... 77 * The "prot" down below needs still a "sleep" flag somehow ...
78 */ 78 */
79typedef struct _agp_segment { 79typedef struct _agp_segment {
80 off_t pg_start; /* starting page to populate */ 80 __kernel_off_t pg_start; /* starting page to populate */
81 size_t pg_count; /* number of pages */ 81 __kernel_size_t pg_count; /* number of pages */
82 int prot; /* prot flags for mmap */ 82 int prot; /* prot flags for mmap */
83} agp_segment; 83} agp_segment;
84 84
85typedef struct _agp_region { 85typedef struct _agp_region {
86 pid_t pid; /* pid of process */ 86 __kernel_pid_t pid; /* pid of process */
87 size_t seg_count; /* number of segments */ 87 __kernel_size_t seg_count; /* number of segments */
88 struct _agp_segment *seg_list; 88 struct _agp_segment *seg_list;
89} agp_region; 89} agp_region;
90 90
91typedef struct _agp_allocate { 91typedef struct _agp_allocate {
92 int key; /* tag of allocation */ 92 int key; /* tag of allocation */
93 size_t pg_count; /* number of pages */ 93 __kernel_size_t pg_count;/* number of pages */
94 __u32 type; /* 0 == normal, other devspec */ 94 __u32 type; /* 0 == normal, other devspec */
95 __u32 physical; /* device specific (some devices 95 __u32 physical; /* device specific (some devices
96 * need a phys address of the 96 * need a phys address of the
@@ -100,7 +100,7 @@ typedef struct _agp_allocate {
100 100
101typedef struct _agp_bind { 101typedef struct _agp_bind {
102 int key; /* tag of allocation */ 102 int key; /* tag of allocation */
103 off_t pg_start; /* starting page to populate */ 103 __kernel_off_t pg_start;/* starting page to populate */
104} agp_bind; 104} agp_bind;
105 105
106typedef struct _agp_unbind { 106typedef struct _agp_unbind {
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index a1916078fd08..cd4bcb6989ce 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -235,8 +235,6 @@ struct Outgoing {
235 235
236 236
237struct arcnet_local { 237struct arcnet_local {
238 struct net_device_stats stats;
239
240 uint8_t config, /* current value of CONFIG register */ 238 uint8_t config, /* current value of CONFIG register */
241 timeout, /* Extended timeout for COM20020 */ 239 timeout, /* Extended timeout for COM20020 */
242 backplane, /* Backplane flag for COM20020 */ 240 backplane, /* Backplane flag for COM20020 */
@@ -335,7 +333,12 @@ void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
335 333
336void arcnet_unregister_proto(struct ArcProto *proto); 334void arcnet_unregister_proto(struct ArcProto *proto);
337irqreturn_t arcnet_interrupt(int irq, void *dev_id); 335irqreturn_t arcnet_interrupt(int irq, void *dev_id);
338struct net_device *alloc_arcdev(char *name); 336struct net_device *alloc_arcdev(const char *name);
337
338int arcnet_open(struct net_device *dev);
339int arcnet_close(struct net_device *dev);
340int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev);
341void arcnet_timeout(struct net_device *dev);
339 342
340#endif /* __KERNEL__ */ 343#endif /* __KERNEL__ */
341#endif /* _LINUX_ARCDEVICE_H */ 344#endif /* _LINUX_ARCDEVICE_H */
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 45f6297821bd..5fc2ef8d97fa 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -21,6 +21,15 @@
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23 23
24/* on architectures without dma-mapping capabilities we need to ensure
25 * that the asynchronous path compiles away
26 */
27#ifdef CONFIG_HAS_DMA
28#define __async_inline
29#else
30#define __async_inline __always_inline
31#endif
32
24/** 33/**
25 * dma_chan_ref - object used to manage dma channels received from the 34 * dma_chan_ref - object used to manage dma channels received from the
26 * dmaengine core. 35 * dmaengine core.
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 08a86d5cdf1b..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
@@ -89,6 +91,9 @@ enum {
89 ATA_ID_DLF = 128, 91 ATA_ID_DLF = 128,
90 ATA_ID_CSFO = 129, 92 ATA_ID_CSFO = 129,
91 ATA_ID_CFA_POWER = 160, 93 ATA_ID_CFA_POWER = 160,
94 ATA_ID_CFA_KEY_MGMT = 162,
95 ATA_ID_CFA_MODES = 163,
96 ATA_ID_DATA_SET_MGMT = 169,
92 ATA_ID_ROT_SPEED = 217, 97 ATA_ID_ROT_SPEED = 217,
93 ATA_ID_PIO4 = (1 << 1), 98 ATA_ID_PIO4 = (1 << 1),
94 99
@@ -106,6 +111,8 @@ enum {
106 ATA_PIO5 = ATA_PIO4 | (1 << 5), 111 ATA_PIO5 = ATA_PIO4 | (1 << 5),
107 ATA_PIO6 = ATA_PIO5 | (1 << 6), 112 ATA_PIO6 = ATA_PIO5 | (1 << 6),
108 113
114 ATA_PIO4_ONLY = (1 << 4),
115
109 ATA_SWDMA0 = (1 << 0), 116 ATA_SWDMA0 = (1 << 0),
110 ATA_SWDMA1 = ATA_SWDMA0 | (1 << 1), 117 ATA_SWDMA1 = ATA_SWDMA0 | (1 << 1),
111 ATA_SWDMA2 = ATA_SWDMA1 | (1 << 2), 118 ATA_SWDMA2 = ATA_SWDMA1 | (1 << 2),
@@ -115,6 +122,8 @@ enum {
115 ATA_MWDMA0 = (1 << 0), 122 ATA_MWDMA0 = (1 << 0),
116 ATA_MWDMA1 = ATA_MWDMA0 | (1 << 1), 123 ATA_MWDMA1 = ATA_MWDMA0 | (1 << 1),
117 ATA_MWDMA2 = ATA_MWDMA1 | (1 << 2), 124 ATA_MWDMA2 = ATA_MWDMA1 | (1 << 2),
125 ATA_MWDMA3 = ATA_MWDMA2 | (1 << 3),
126 ATA_MWDMA4 = ATA_MWDMA3 | (1 << 4),
118 127
119 ATA_MWDMA12_ONLY = (1 << 1) | (1 << 2), 128 ATA_MWDMA12_ONLY = (1 << 1) | (1 << 2),
120 ATA_MWDMA2_ONLY = (1 << 2), 129 ATA_MWDMA2_ONLY = (1 << 2),
@@ -129,6 +138,8 @@ enum {
129 ATA_UDMA7 = ATA_UDMA6 | (1 << 7), 138 ATA_UDMA7 = ATA_UDMA6 | (1 << 7),
130 /* ATA_UDMA7 is just for completeness... doesn't exist (yet?). */ 139 /* ATA_UDMA7 is just for completeness... doesn't exist (yet?). */
131 140
141 ATA_UDMA24_ONLY = (1 << 2) | (1 << 4),
142
132 ATA_UDMA_MASK_40C = ATA_UDMA2, /* udma0-2 */ 143 ATA_UDMA_MASK_40C = ATA_UDMA2, /* udma0-2 */
133 144
134 /* DMA-related */ 145 /* DMA-related */
@@ -240,10 +251,9 @@ enum {
240 ATA_CMD_SMART = 0xB0, 251 ATA_CMD_SMART = 0xB0,
241 ATA_CMD_MEDIA_LOCK = 0xDE, 252 ATA_CMD_MEDIA_LOCK = 0xDE,
242 ATA_CMD_MEDIA_UNLOCK = 0xDF, 253 ATA_CMD_MEDIA_UNLOCK = 0xDF,
254 ATA_CMD_DSM = 0x06,
243 /* marked obsolete in the ATA/ATAPI-7 spec */ 255 /* marked obsolete in the ATA/ATAPI-7 spec */
244 ATA_CMD_RESTORE = 0x10, 256 ATA_CMD_RESTORE = 0x10,
245 /* EXABYTE specific */
246 ATA_EXABYTE_ENABLE_NEST = 0xF0,
247 257
248 /* READ_LOG_EXT pages */ 258 /* READ_LOG_EXT pages */
249 ATA_LOG_SATA_NCQ = 0x10, 259 ATA_LOG_SATA_NCQ = 0x10,
@@ -315,6 +325,9 @@ enum {
315 ATA_SMART_READ_VALUES = 0xD0, 325 ATA_SMART_READ_VALUES = 0xD0,
316 ATA_SMART_READ_THRESHOLDS = 0xD1, 326 ATA_SMART_READ_THRESHOLDS = 0xD1,
317 327
328 /* feature values for Data Set Management */
329 ATA_DSM_TRIM = 0x01,
330
318 /* password used in LBA Mid / LBA High for executing SMART commands */ 331 /* password used in LBA Mid / LBA High for executing SMART commands */
319 ATA_SMART_LBAM_PASS = 0x4F, 332 ATA_SMART_LBAM_PASS = 0x4F,
320 ATA_SMART_LBAH_PASS = 0xC2, 333 ATA_SMART_LBAH_PASS = 0xC2,
@@ -717,6 +730,14 @@ static inline int ata_id_has_unload(const u16 *id)
717 return 0; 730 return 0;
718} 731}
719 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
720static inline int ata_id_current_chs_valid(const u16 *id) 741static inline int ata_id_current_chs_valid(const u16 *id)
721{ 742{
722 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 743 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -857,6 +878,32 @@ static inline void ata_id_to_hd_driveid(u16 *id)
857#endif 878#endif
858} 879}
859 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
860static inline int is_multi_taskfile(struct ata_taskfile *tf) 907static inline int is_multi_taskfile(struct ata_taskfile *tf)
861{ 908{
862 return (tf->command == ATA_CMD_READ_MULTI) || 909 return (tf->command == ATA_CMD_READ_MULTI) ||
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
new file mode 100644
index 000000000000..b847fc7b93f9
--- /dev/null
+++ b/include/linux/ath9k_platform.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (c) 2008 Atheros Communications Inc.
3 * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
4 * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#ifndef _LINUX_ATH9K_PLATFORM_H
20#define _LINUX_ATH9K_PLATFORM_H
21
22#define ATH9K_PLAT_EEP_MAX_WORDS 2048
23
24struct ath9k_platform_data {
25 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
26};
27
28#endif /* _LINUX_ATH9K_PLATFORM_H */
diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
index 6f5a1bab8f50..39c917fd1b96 100644
--- a/include/linux/atmlec.h
+++ b/include/linux/atmlec.h
@@ -11,6 +11,7 @@
11#include <linux/atmioc.h> 11#include <linux/atmioc.h>
12#include <linux/atm.h> 12#include <linux/atm.h>
13#include <linux/if_ether.h> 13#include <linux/if_ether.h>
14#include <linux/types.h>
14 15
15/* ATM lec daemon control socket */ 16/* ATM lec daemon control socket */
16#define ATMLEC_CTRL _IO('a', ATMIOC_LANE) 17#define ATMLEC_CTRL _IO('a', ATMIOC_LANE)
@@ -78,8 +79,8 @@ struct atmlec_msg {
78 } normal; 79 } normal;
79 struct atmlec_config_msg config; 80 struct atmlec_config_msg config;
80 struct { 81 struct {
81 uint16_t lec_id; /* requestor lec_id */ 82 __u16 lec_id; /* requestor lec_id */
82 uint32_t tran_id; /* transaction id */ 83 __u32 tran_id; /* transaction id */
83 unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */ 84 unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */
84 unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */ 85 unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */
85 } proxy; /* 86 } proxy; /*
diff --git a/include/linux/atmmpc.h b/include/linux/atmmpc.h
index ea1650425a12..2aba5787fa63 100644
--- a/include/linux/atmmpc.h
+++ b/include/linux/atmmpc.h
@@ -4,6 +4,7 @@
4#include <linux/atmapi.h> 4#include <linux/atmapi.h>
5#include <linux/atmioc.h> 5#include <linux/atmioc.h>
6#include <linux/atm.h> 6#include <linux/atm.h>
7#include <linux/types.h>
7 8
8#define ATMMPC_CTRL _IO('a', ATMIOC_MPOA) 9#define ATMMPC_CTRL _IO('a', ATMIOC_MPOA)
9#define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1) 10#define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1)
@@ -18,39 +19,39 @@ struct atmmpc_ioc {
18}; 19};
19 20
20typedef struct in_ctrl_info { 21typedef struct in_ctrl_info {
21 uint8_t Last_NHRP_CIE_code; 22 __u8 Last_NHRP_CIE_code;
22 uint8_t Last_Q2931_cause_value; 23 __u8 Last_Q2931_cause_value;
23 uint8_t eg_MPC_ATM_addr[ATM_ESA_LEN]; 24 __u8 eg_MPC_ATM_addr[ATM_ESA_LEN];
24 __be32 tag; 25 __be32 tag;
25 __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */ 26 __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */
26 uint16_t holding_time; 27 __u16 holding_time;
27 uint32_t request_id; 28 __u32 request_id;
28} in_ctrl_info; 29} in_ctrl_info;
29 30
30typedef struct eg_ctrl_info { 31typedef struct eg_ctrl_info {
31 uint8_t DLL_header[256]; 32 __u8 DLL_header[256];
32 uint8_t DH_length; 33 __u8 DH_length;
33 __be32 cache_id; 34 __be32 cache_id;
34 __be32 tag; 35 __be32 tag;
35 __be32 mps_ip; 36 __be32 mps_ip;
36 __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */ 37 __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */
37 uint8_t in_MPC_data_ATM_addr[ATM_ESA_LEN]; 38 __u8 in_MPC_data_ATM_addr[ATM_ESA_LEN];
38 uint16_t holding_time; 39 __u16 holding_time;
39} eg_ctrl_info; 40} eg_ctrl_info;
40 41
41struct mpc_parameters { 42struct mpc_parameters {
42 uint16_t mpc_p1; /* Shortcut-Setup Frame Count */ 43 __u16 mpc_p1; /* Shortcut-Setup Frame Count */
43 uint16_t mpc_p2; /* Shortcut-Setup Frame Time */ 44 __u16 mpc_p2; /* Shortcut-Setup Frame Time */
44 uint8_t mpc_p3[8]; /* Flow-detection Protocols */ 45 __u8 mpc_p3[8]; /* Flow-detection Protocols */
45 uint16_t mpc_p4; /* MPC Initial Retry Time */ 46 __u16 mpc_p4; /* MPC Initial Retry Time */
46 uint16_t mpc_p5; /* MPC Retry Time Maximum */ 47 __u16 mpc_p5; /* MPC Retry Time Maximum */
47 uint16_t mpc_p6; /* Hold Down Time */ 48 __u16 mpc_p6; /* Hold Down Time */
48} ; 49} ;
49 50
50struct k_message { 51struct k_message {
51 uint16_t type; 52 __u16 type;
52 __be32 ip_mask; 53 __be32 ip_mask;
53 uint8_t MPS_ctrl[ATM_ESA_LEN]; 54 __u8 MPS_ctrl[ATM_ESA_LEN];
54 union { 55 union {
55 in_ctrl_info in_info; 56 in_ctrl_info in_info;
56 eg_ctrl_info eg_info; 57 eg_ctrl_info eg_info;
@@ -61,11 +62,11 @@ struct k_message {
61 62
62struct llc_snap_hdr { 63struct llc_snap_hdr {
63 /* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */ 64 /* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */
64 uint8_t dsap; /* Destination Service Access Point (0xAA) */ 65 __u8 dsap; /* Destination Service Access Point (0xAA) */
65 uint8_t ssap; /* Source Service Access Point (0xAA) */ 66 __u8 ssap; /* Source Service Access Point (0xAA) */
66 uint8_t ui; /* Unnumbered Information (0x03) */ 67 __u8 ui; /* Unnumbered Information (0x03) */
67 uint8_t org[3]; /* Organizational identification (0x000000) */ 68 __u8 org[3]; /* Organizational identification (0x000000) */
68 uint8_t type[2]; /* Ether type (for IP) (0x0800) */ 69 __u8 type[2]; /* Ether type (for IP) (0x0800) */
69}; 70};
70 71
71/* TLVs this MPC recognizes */ 72/* TLVs this MPC recognizes */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 67e5dbfc2961..4fa2810b675e 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -36,7 +36,8 @@
36 * 1500 - 1599 kernel LSPP events 36 * 1500 - 1599 kernel LSPP events
37 * 1600 - 1699 kernel crypto events 37 * 1600 - 1699 kernel crypto events
38 * 1700 - 1799 kernel anomaly records 38 * 1700 - 1799 kernel anomaly records
39 * 1800 - 1999 future kernel use (maybe integrity labels and related events) 39 * 1800 - 1899 kernel integrity events
40 * 1900 - 1999 future kernel use
40 * 2000 is for otherwise unclassified kernel audit messages (legacy) 41 * 2000 is for otherwise unclassified kernel audit messages (legacy)
41 * 2001 - 2099 unused (kernel) 42 * 2001 - 2099 unused (kernel)
42 * 2100 - 2199 user space anomaly records 43 * 2100 - 2199 user space anomaly records
@@ -125,6 +126,12 @@
125#define AUDIT_LAST_KERN_ANOM_MSG 1799 126#define AUDIT_LAST_KERN_ANOM_MSG 1799
126#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */ 127#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */
127#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */ 128#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */
129#define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */
130#define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */
131#define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */
132#define AUDIT_INTEGRITY_HASH 1803 /* Integrity HASH type */
133#define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */
134#define AUDIT_INTEGRITY_RULE 1805 /* policy rule */
128 135
129#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ 136#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */
130 137
diff --git a/include/linux/auto_dev-ioctl.h b/include/linux/auto_dev-ioctl.h
index 91a773993a5c..850f39b33e74 100644
--- a/include/linux/auto_dev-ioctl.h
+++ b/include/linux/auto_dev-ioctl.h
@@ -10,8 +10,13 @@
10#ifndef _LINUX_AUTO_DEV_IOCTL_H 10#ifndef _LINUX_AUTO_DEV_IOCTL_H
11#define _LINUX_AUTO_DEV_IOCTL_H 11#define _LINUX_AUTO_DEV_IOCTL_H
12 12
13#include <linux/auto_fs.h>
14
15#ifdef __KERNEL__
13#include <linux/string.h> 16#include <linux/string.h>
14#include <linux/types.h> 17#else
18#include <string.h>
19#endif /* __KERNEL__ */
15 20
16#define AUTOFS_DEVICE_NAME "autofs" 21#define AUTOFS_DEVICE_NAME "autofs"
17 22
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index c21e5972a3e8..63265852b7d1 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -17,11 +17,13 @@
17#ifdef __KERNEL__ 17#ifdef __KERNEL__
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/limits.h> 19#include <linux/limits.h>
20#include <linux/types.h>
21#include <linux/ioctl.h>
22#else
20#include <asm/types.h> 23#include <asm/types.h>
24#include <sys/ioctl.h>
21#endif /* __KERNEL__ */ 25#endif /* __KERNEL__ */
22 26
23#include <linux/ioctl.h>
24
25/* This file describes autofs v3 */ 27/* This file describes autofs v3 */
26#define AUTOFS_PROTO_VERSION 3 28#define AUTOFS_PROTO_VERSION 3
27 29
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/binfmts.h b/include/linux/binfmts.h
index 77b4a9e46004..61ee18c1bdb4 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -35,8 +35,7 @@ struct linux_binprm{
35#endif 35#endif
36 struct mm_struct *mm; 36 struct mm_struct *mm;
37 unsigned long p; /* current top of mem */ 37 unsigned long p; /* current top of mem */
38 unsigned int sh_bang:1, 38 unsigned int
39 misc_bang:1,
40 cred_prepared:1,/* true if creds already prepared (multiple 39 cred_prepared:1,/* true if creds already prepared (multiple
41 * preps happen for interpreters) */ 40 * preps happen for interpreters) */
42 cap_effective:1;/* true if has elevated effective capabilities, 41 cap_effective:1;/* true if has elevated effective capabilities,
@@ -83,7 +82,19 @@ struct linux_binfmt {
83 int hasvdso; 82 int hasvdso;
84}; 83};
85 84
86extern int register_binfmt(struct linux_binfmt *); 85extern int __register_binfmt(struct linux_binfmt *fmt, int insert);
86
87/* Registration of default binfmt handlers */
88static inline int register_binfmt(struct linux_binfmt *fmt)
89{
90 return __register_binfmt(fmt, 0);
91}
92/* Same as above, but adds a new binfmt at the top of the list */
93static inline int insert_binfmt(struct linux_binfmt *fmt)
94{
95 return __register_binfmt(fmt, 1);
96}
97
87extern void unregister_binfmt(struct linux_binfmt *); 98extern void unregister_binfmt(struct linux_binfmt *);
88 99
89extern int prepare_binprm(struct linux_binprm *); 100extern int prepare_binprm(struct linux_binprm *);
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 1b16108a5417..7b214fd672a2 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -132,6 +132,7 @@ struct bio {
132 * top 4 bits of bio flags indicate the pool this bio came from 132 * top 4 bits of bio flags indicate the pool this bio came from
133 */ 133 */
134#define BIO_POOL_BITS (4) 134#define BIO_POOL_BITS (4)
135#define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1)
135#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS) 136#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
136#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET) 137#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
137#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET) 138#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
@@ -145,20 +146,21 @@ struct bio {
145 * bit 2 -- barrier 146 * bit 2 -- barrier
146 * Insert a serialization point in the IO queue, forcing previously 147 * Insert a serialization point in the IO queue, forcing previously
147 * submitted IO to be completed before this one is issued. 148 * submitted IO to be completed before this one is issued.
148 * bit 3 -- synchronous I/O hint: the block layer will unplug immediately 149 * bit 3 -- synchronous I/O hint.
149 * Note that this does NOT indicate that the IO itself is sync, just 150 * bit 4 -- Unplug the device immediately after submitting this bio.
150 * that the block layer will not postpone issue of this IO by plugging. 151 * bit 5 -- metadata request
151 * bit 4 -- metadata request
152 * Used for tracing to differentiate metadata and data IO. May also 152 * Used for tracing to differentiate metadata and data IO. May also
153 * get some preferential treatment in the IO scheduler 153 * get some preferential treatment in the IO scheduler
154 * bit 5 -- discard sectors 154 * bit 6 -- discard sectors
155 * Informs the lower level device that this range of sectors is no longer 155 * 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 156 * used by the file system and may thus be freed by the device. Used
157 * for flash based storage. 157 * for flash based storage.
158 * bit 6 -- fail fast device errors 158 * bit 7 -- fail fast device errors
159 * bit 7 -- fail fast transport errors 159 * bit 8 -- fail fast transport errors
160 * bit 8 -- fail fast driver errors 160 * bit 9 -- fail fast driver errors
161 * Don't want driver retries for any fast fail whatever the reason. 161 * Don't want driver retries for any fast fail whatever the reason.
162 * bit 10 -- Tell the IO scheduler not to wait for more requests after this
163 one has been submitted, even if it is a SYNC request.
162 */ 164 */
163#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ 165#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */
164#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ 166#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */
@@ -170,6 +172,7 @@ struct bio {
170#define BIO_RW_FAILFAST_DEV 7 172#define BIO_RW_FAILFAST_DEV 7
171#define BIO_RW_FAILFAST_TRANSPORT 8 173#define BIO_RW_FAILFAST_TRANSPORT 8
172#define BIO_RW_FAILFAST_DRIVER 9 174#define BIO_RW_FAILFAST_DRIVER 9
175#define BIO_RW_NOIDLE 10
173 176
174#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) 177#define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag)))
175 178
@@ -188,6 +191,7 @@ struct bio {
188#define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD) 191#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) 192#define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META)
190#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD) 193#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD)
194#define bio_noidle(bio) bio_rw_flagged(bio, BIO_RW_NOIDLE)
191 195
192/* 196/*
193 * upper 16 bits of bi_rw define the io priority of this bio 197 * upper 16 bits of bi_rw define the io priority of this bio
@@ -426,9 +430,6 @@ struct bio_set {
426 unsigned int front_pad; 430 unsigned int front_pad;
427 431
428 mempool_t *bio_pool; 432 mempool_t *bio_pool;
429#if defined(CONFIG_BLK_DEV_INTEGRITY)
430 mempool_t *bio_integrity_pool;
431#endif
432 mempool_t *bvec_pool; 433 mempool_t *bvec_pool;
433}; 434};
434 435
@@ -504,6 +505,115 @@ static inline int bio_has_data(struct bio *bio)
504 return bio && bio->bi_io_vec != NULL; 505 return bio && bio->bi_io_vec != NULL;
505} 506}
506 507
508/*
509 * BIO list managment for use by remapping drivers (e.g. DM or MD).
510 *
511 * A bio_list anchors a singly-linked list of bios chained through the bi_next
512 * member of the bio. The bio_list also caches the last list member to allow
513 * fast access to the tail.
514 */
515struct bio_list {
516 struct bio *head;
517 struct bio *tail;
518};
519
520static inline int bio_list_empty(const struct bio_list *bl)
521{
522 return bl->head == NULL;
523}
524
525static inline void bio_list_init(struct bio_list *bl)
526{
527 bl->head = bl->tail = NULL;
528}
529
530#define bio_list_for_each(bio, bl) \
531 for (bio = (bl)->head; bio; bio = bio->bi_next)
532
533static inline unsigned bio_list_size(const struct bio_list *bl)
534{
535 unsigned sz = 0;
536 struct bio *bio;
537
538 bio_list_for_each(bio, bl)
539 sz++;
540
541 return sz;
542}
543
544static inline void bio_list_add(struct bio_list *bl, struct bio *bio)
545{
546 bio->bi_next = NULL;
547
548 if (bl->tail)
549 bl->tail->bi_next = bio;
550 else
551 bl->head = bio;
552
553 bl->tail = bio;
554}
555
556static inline void bio_list_add_head(struct bio_list *bl, struct bio *bio)
557{
558 bio->bi_next = bl->head;
559
560 bl->head = bio;
561
562 if (!bl->tail)
563 bl->tail = bio;
564}
565
566static inline void bio_list_merge(struct bio_list *bl, struct bio_list *bl2)
567{
568 if (!bl2->head)
569 return;
570
571 if (bl->tail)
572 bl->tail->bi_next = bl2->head;
573 else
574 bl->head = bl2->head;
575
576 bl->tail = bl2->tail;
577}
578
579static inline void bio_list_merge_head(struct bio_list *bl,
580 struct bio_list *bl2)
581{
582 if (!bl2->head)
583 return;
584
585 if (bl->head)
586 bl2->tail->bi_next = bl->head;
587 else
588 bl->tail = bl2->tail;
589
590 bl->head = bl2->head;
591}
592
593static inline struct bio *bio_list_pop(struct bio_list *bl)
594{
595 struct bio *bio = bl->head;
596
597 if (bio) {
598 bl->head = bl->head->bi_next;
599 if (!bl->head)
600 bl->tail = NULL;
601
602 bio->bi_next = NULL;
603 }
604
605 return bio;
606}
607
608static inline struct bio *bio_list_get(struct bio_list *bl)
609{
610 struct bio *bio = bl->head;
611
612 bl->head = bl->tail = NULL;
613
614 return bio;
615}
616
507#if defined(CONFIG_BLK_DEV_INTEGRITY) 617#if defined(CONFIG_BLK_DEV_INTEGRITY)
508 618
509#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) 619#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))
@@ -519,9 +629,8 @@ static inline int bio_has_data(struct bio *bio)
519 629
520#define bio_integrity(bio) (bio->bi_integrity != NULL) 630#define bio_integrity(bio) (bio->bi_integrity != NULL)
521 631
522extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *);
523extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); 632extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
524extern void bio_integrity_free(struct bio *, struct bio_set *); 633extern void bio_integrity_free(struct bio *);
525extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); 634extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
526extern int bio_integrity_enabled(struct bio *bio); 635extern int bio_integrity_enabled(struct bio *bio);
527extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); 636extern int bio_integrity_set_tag(struct bio *, void *, unsigned int);
@@ -531,27 +640,21 @@ extern void bio_integrity_endio(struct bio *, int);
531extern void bio_integrity_advance(struct bio *, unsigned int); 640extern void bio_integrity_advance(struct bio *, unsigned int);
532extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); 641extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int);
533extern void bio_integrity_split(struct bio *, struct bio_pair *, int); 642extern void bio_integrity_split(struct bio *, struct bio_pair *, int);
534extern int bio_integrity_clone(struct bio *, struct bio *, struct bio_set *); 643extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t);
535extern int bioset_integrity_create(struct bio_set *, int);
536extern void bioset_integrity_free(struct bio_set *);
537extern void bio_integrity_init_slab(void);
538 644
539#else /* CONFIG_BLK_DEV_INTEGRITY */ 645#else /* CONFIG_BLK_DEV_INTEGRITY */
540 646
541#define bio_integrity(a) (0) 647#define bio_integrity(a) (0)
542#define bioset_integrity_create(a, b) (0)
543#define bio_integrity_prep(a) (0) 648#define bio_integrity_prep(a) (0)
544#define bio_integrity_enabled(a) (0) 649#define bio_integrity_enabled(a) (0)
545#define bio_integrity_clone(a, b, c) (0) 650#define bio_integrity_clone(a, b, c) (0)
546#define bioset_integrity_free(a) do { } while (0) 651#define bio_integrity_free(a) do { } while (0)
547#define bio_integrity_free(a, b) do { } while (0)
548#define bio_integrity_endio(a, b) do { } while (0) 652#define bio_integrity_endio(a, b) do { } while (0)
549#define bio_integrity_advance(a, b) do { } while (0) 653#define bio_integrity_advance(a, b) do { } while (0)
550#define bio_integrity_trim(a, b, c) do { } while (0) 654#define bio_integrity_trim(a, b, c) do { } while (0)
551#define bio_integrity_split(a, b, c) do { } while (0) 655#define bio_integrity_split(a, b, c) do { } while (0)
552#define bio_integrity_set_tag(a, b, c) do { } while (0) 656#define bio_integrity_set_tag(a, b, c) do { } while (0)
553#define bio_integrity_get_tag(a, b, c) do { } while (0) 657#define bio_integrity_get_tag(a, b, c) do { } while (0)
554#define bio_integrity_init_slab(a) do { } while (0)
555 658
556#endif /* CONFIG_BLK_DEV_INTEGRITY */ 659#endif /* CONFIG_BLK_DEV_INTEGRITY */
557 660
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 61829139795a..c05a29cb9bb2 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -112,6 +112,25 @@ static inline unsigned fls_long(unsigned long l)
112 return fls64(l); 112 return fls64(l);
113} 113}
114 114
115/**
116 * __ffs64 - find first set bit in a 64 bit word
117 * @word: The 64 bit word
118 *
119 * On 64 bit arches this is a synomyn for __ffs
120 * The result is not defined if no bits are set, so check that @word
121 * is non-zero before calling this.
122 */
123static inline unsigned long __ffs64(u64 word)
124{
125#if BITS_PER_LONG == 32
126 if (((u32)word) == 0UL)
127 return __ffs((u32)(word >> 32)) + 32;
128#elif BITS_PER_LONG != 64
129#error BITS_PER_LONG not 32 or 64
130#endif
131 return __ffs((unsigned long)word);
132}
133
115#ifdef __KERNEL__ 134#ifdef __KERNEL__
116#ifdef CONFIG_GENERIC_FIND_FIRST_BIT 135#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
117 136
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 465d6babc847..b4f71f1a4af7 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,13 @@ 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 */
121 __REQ_IO_STAT, /* account I/O stat */
112 __REQ_NR_BITS, /* stops here */ 122 __REQ_NR_BITS, /* stops here */
113}; 123};
114 124
@@ -135,7 +145,8 @@ enum rq_flag_bits {
135#define REQ_RW_META (1 << __REQ_RW_META) 145#define REQ_RW_META (1 << __REQ_RW_META)
136#define REQ_COPY_USER (1 << __REQ_COPY_USER) 146#define REQ_COPY_USER (1 << __REQ_COPY_USER)
137#define REQ_INTEGRITY (1 << __REQ_INTEGRITY) 147#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
138#define REQ_UNPLUG (1 << __REQ_UNPLUG) 148#define REQ_NOIDLE (1 << __REQ_NOIDLE)
149#define REQ_IO_STAT (1 << __REQ_IO_STAT)
139 150
140#define BLK_MAX_CDB 16 151#define BLK_MAX_CDB 16
141 152
@@ -438,8 +449,8 @@ struct request_queue
438#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ 449#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
439#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 450#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
440#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */ 451#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
441#define QUEUE_FLAG_READFULL 3 /* read queue has been filled */ 452#define QUEUE_FLAG_SYNCFULL 3 /* read queue has been filled */
442#define QUEUE_FLAG_WRITEFULL 4 /* write queue has been filled */ 453#define QUEUE_FLAG_ASYNCFULL 4 /* write queue has been filled */
443#define QUEUE_FLAG_DEAD 5 /* queue being torn down */ 454#define QUEUE_FLAG_DEAD 5 /* queue being torn down */
444#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ 455#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
445#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 456#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
@@ -589,6 +600,8 @@ enum {
589 blk_failfast_transport(rq) || \ 600 blk_failfast_transport(rq) || \
590 blk_failfast_driver(rq)) 601 blk_failfast_driver(rq))
591#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) 602#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
603#define blk_rq_io_stat(rq) ((rq)->cmd_flags & REQ_IO_STAT)
604#define blk_rq_quiet(rq) ((rq)->cmd_flags & REQ_QUIET)
592 605
593#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq))) 606#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
594 607
@@ -611,32 +624,42 @@ enum {
611#define rq_data_dir(rq) ((rq)->cmd_flags & 1) 624#define rq_data_dir(rq) ((rq)->cmd_flags & 1)
612 625
613/* 626/*
614 * We regard a request as sync, if it's a READ or a SYNC write. 627 * We regard a request as sync, if either a read or a sync write
615 */ 628 */
616#define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->cmd_flags & REQ_RW_SYNC) 629static inline bool rw_is_sync(unsigned int rw_flags)
630{
631 return !(rw_flags & REQ_RW) || (rw_flags & REQ_RW_SYNC);
632}
633
634static inline bool rq_is_sync(struct request *rq)
635{
636 return rw_is_sync(rq->cmd_flags);
637}
638
617#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META) 639#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
640#define rq_noidle(rq) ((rq)->cmd_flags & REQ_NOIDLE)
618 641
619static inline int blk_queue_full(struct request_queue *q, int rw) 642static inline int blk_queue_full(struct request_queue *q, int sync)
620{ 643{
621 if (rw == READ) 644 if (sync)
622 return test_bit(QUEUE_FLAG_READFULL, &q->queue_flags); 645 return test_bit(QUEUE_FLAG_SYNCFULL, &q->queue_flags);
623 return test_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags); 646 return test_bit(QUEUE_FLAG_ASYNCFULL, &q->queue_flags);
624} 647}
625 648
626static inline void blk_set_queue_full(struct request_queue *q, int rw) 649static inline void blk_set_queue_full(struct request_queue *q, int sync)
627{ 650{
628 if (rw == READ) 651 if (sync)
629 queue_flag_set(QUEUE_FLAG_READFULL, q); 652 queue_flag_set(QUEUE_FLAG_SYNCFULL, q);
630 else 653 else
631 queue_flag_set(QUEUE_FLAG_WRITEFULL, q); 654 queue_flag_set(QUEUE_FLAG_ASYNCFULL, q);
632} 655}
633 656
634static inline void blk_clear_queue_full(struct request_queue *q, int rw) 657static inline void blk_clear_queue_full(struct request_queue *q, int sync)
635{ 658{
636 if (rw == READ) 659 if (sync)
637 queue_flag_clear(QUEUE_FLAG_READFULL, q); 660 queue_flag_clear(QUEUE_FLAG_SYNCFULL, q);
638 else 661 else
639 queue_flag_clear(QUEUE_FLAG_WRITEFULL, q); 662 queue_flag_clear(QUEUE_FLAG_ASYNCFULL, q);
640} 663}
641 664
642 665
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 6e915878e88c..d960889e92ef 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -144,6 +144,9 @@ struct blk_user_trace_setup {
144 144
145#ifdef __KERNEL__ 145#ifdef __KERNEL__
146#if defined(CONFIG_BLK_DEV_IO_TRACE) 146#if defined(CONFIG_BLK_DEV_IO_TRACE)
147
148#include <linux/sysfs.h>
149
147struct blk_trace { 150struct blk_trace {
148 int trace_state; 151 int trace_state;
149 struct rchan *rchan; 152 struct rchan *rchan;
@@ -194,6 +197,8 @@ extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
194extern int blk_trace_startstop(struct request_queue *q, int start); 197extern int blk_trace_startstop(struct request_queue *q, int start);
195extern int blk_trace_remove(struct request_queue *q); 198extern int blk_trace_remove(struct request_queue *q);
196 199
200extern struct attribute_group blk_trace_attr_group;
201
197#else /* !CONFIG_BLK_DEV_IO_TRACE */ 202#else /* !CONFIG_BLK_DEV_IO_TRACE */
198#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) 203#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
199#define blk_trace_shutdown(q) do { } while (0) 204#define blk_trace_shutdown(q) do { } while (0)
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 95837bfb5256..bc3ab7073695 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -65,23 +65,20 @@ extern void free_bootmem(unsigned long addr, unsigned long size);
65#define BOOTMEM_DEFAULT 0 65#define BOOTMEM_DEFAULT 0
66#define BOOTMEM_EXCLUSIVE (1<<0) 66#define BOOTMEM_EXCLUSIVE (1<<0)
67 67
68extern int reserve_bootmem(unsigned long addr,
69 unsigned long size,
70 int flags);
68extern int reserve_bootmem_node(pg_data_t *pgdat, 71extern int reserve_bootmem_node(pg_data_t *pgdat,
69 unsigned long physaddr, 72 unsigned long physaddr,
70 unsigned long size, 73 unsigned long size,
71 int flags); 74 int flags);
72#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
73extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
74#endif
75 75
76extern void *__alloc_bootmem_nopanic(unsigned long size, 76extern void *__alloc_bootmem(unsigned long size,
77 unsigned long align, 77 unsigned long align,
78 unsigned long goal); 78 unsigned long goal);
79extern void *__alloc_bootmem(unsigned long size, 79extern void *__alloc_bootmem_nopanic(unsigned long size,
80 unsigned long align, 80 unsigned long align,
81 unsigned long goal); 81 unsigned long goal);
82extern void *__alloc_bootmem_low(unsigned long size,
83 unsigned long align,
84 unsigned long goal);
85extern void *__alloc_bootmem_node(pg_data_t *pgdat, 82extern void *__alloc_bootmem_node(pg_data_t *pgdat,
86 unsigned long size, 83 unsigned long size,
87 unsigned long align, 84 unsigned long align,
@@ -90,30 +87,35 @@ extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat,
90 unsigned long size, 87 unsigned long size,
91 unsigned long align, 88 unsigned long align,
92 unsigned long goal); 89 unsigned long goal);
90extern void *__alloc_bootmem_low(unsigned long size,
91 unsigned long align,
92 unsigned long goal);
93extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, 93extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
94 unsigned long size, 94 unsigned long size,
95 unsigned long align, 95 unsigned long align,
96 unsigned long goal); 96 unsigned long goal);
97#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 97
98#define alloc_bootmem(x) \ 98#define alloc_bootmem(x) \
99 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 99 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
100#define alloc_bootmem_nopanic(x) \ 100#define alloc_bootmem_nopanic(x) \
101 __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 101 __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
102#define alloc_bootmem_low(x) \
103 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
104#define alloc_bootmem_pages(x) \ 102#define alloc_bootmem_pages(x) \
105 __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 103 __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
106#define alloc_bootmem_pages_nopanic(x) \ 104#define alloc_bootmem_pages_nopanic(x) \
107 __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 105 __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
108#define alloc_bootmem_low_pages(x) \
109 __alloc_bootmem_low(x, PAGE_SIZE, 0)
110#define alloc_bootmem_node(pgdat, x) \ 106#define alloc_bootmem_node(pgdat, x) \
111 __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 107 __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
112#define alloc_bootmem_pages_node(pgdat, x) \ 108#define alloc_bootmem_pages_node(pgdat, x) \
113 __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 109 __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
110#define alloc_bootmem_pages_node_nopanic(pgdat, x) \
111 __alloc_bootmem_node_nopanic(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
112
113#define alloc_bootmem_low(x) \
114 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
115#define alloc_bootmem_low_pages(x) \
116 __alloc_bootmem_low(x, PAGE_SIZE, 0)
114#define alloc_bootmem_low_pages_node(pgdat, x) \ 117#define alloc_bootmem_low_pages_node(pgdat, x) \
115 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) 118 __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0)
116#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
117 119
118extern int reserve_bootmem_generic(unsigned long addr, unsigned long size, 120extern int reserve_bootmem_generic(unsigned long addr, unsigned long size,
119 int flags); 121 int flags);
@@ -144,10 +146,10 @@ extern void *alloc_large_system_hash(const char *tablename,
144 146
145#define HASH_EARLY 0x00000001 /* Allocating during early boot? */ 147#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
146 148
147/* Only NUMA needs hash distribution. 149/* Only NUMA needs hash distribution. 64bit NUMA architectures have
148 * IA64 and x86_64 have sufficient vmalloc space. 150 * sufficient vmalloc space.
149 */ 151 */
150#if defined(CONFIG_NUMA) && (defined(CONFIG_IA64) || defined(CONFIG_X86_64)) 152#if defined(CONFIG_NUMA) && defined(CONFIG_64BIT)
151#define HASHDIST_DEFAULT 1 153#define HASHDIST_DEFAULT 1
152#else 154#else
153#define HASHDIST_DEFAULT 0 155#define HASHDIST_DEFAULT 0
diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index cf0303a60611..ecb4730d0868 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -1,12 +1,22 @@
1#ifndef BSG_H 1#ifndef BSG_H
2#define BSG_H 2#define BSG_H
3 3
4#include <linux/types.h>
5
4#define BSG_PROTOCOL_SCSI 0 6#define BSG_PROTOCOL_SCSI 0
5 7
6#define BSG_SUB_PROTOCOL_SCSI_CMD 0 8#define BSG_SUB_PROTOCOL_SCSI_CMD 0
7#define BSG_SUB_PROTOCOL_SCSI_TMF 1 9#define BSG_SUB_PROTOCOL_SCSI_TMF 1
8#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 10#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2
9 11
12/*
13 * For flags member below
14 * sg.h sg_io_hdr also has bits defined for it's flags member. However
15 * none of these bits are implemented/used by bsg. The bits below are
16 * allocated to not conflict with sg.h ones anyway.
17 */
18#define BSG_FLAG_Q_AT_TAIL 0x10 /* default, == 0 at this bit, is Q_AT_HEAD */
19
10struct sg_io_v4 { 20struct sg_io_v4 {
11 __s32 guard; /* [i] 'Q' to differentiate from v3 */ 21 __s32 guard; /* [i] 'Q' to differentiate from v3 */
12 __u32 protocol; /* [i] 0 -> SCSI , .... */ 22 __u32 protocol; /* [i] 0 -> SCSI , .... */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index bd7ac793be19..16ed0284d780 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -155,6 +155,7 @@ void create_empty_buffers(struct page *, unsigned long,
155 unsigned long b_state); 155 unsigned long b_state);
156void end_buffer_read_sync(struct buffer_head *bh, int uptodate); 156void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
157void end_buffer_write_sync(struct buffer_head *bh, int uptodate); 157void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
158void end_buffer_async_write(struct buffer_head *bh, int uptodate);
158 159
159/* Things to do with buffers at mapping->private_list */ 160/* Things to do with buffers at mapping->private_list */
160void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode); 161void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode);
@@ -165,15 +166,8 @@ int sync_mapping_buffers(struct address_space *mapping);
165void unmap_underlying_metadata(struct block_device *bdev, sector_t block); 166void unmap_underlying_metadata(struct block_device *bdev, sector_t block);
166 167
167void mark_buffer_async_write(struct buffer_head *bh); 168void mark_buffer_async_write(struct buffer_head *bh);
168void invalidate_bdev(struct block_device *);
169int sync_blockdev(struct block_device *bdev);
170void __wait_on_buffer(struct buffer_head *); 169void __wait_on_buffer(struct buffer_head *);
171wait_queue_head_t *bh_waitq_head(struct buffer_head *bh); 170wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
172int fsync_bdev(struct block_device *);
173struct super_block *freeze_bdev(struct block_device *);
174int thaw_bdev(struct block_device *, struct super_block *);
175int fsync_super(struct super_block *);
176int fsync_no_super(struct block_device *);
177struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block, 171struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
178 unsigned size); 172 unsigned size);
179struct buffer_head *__getblk(struct block_device *bdev, sector_t block, 173struct buffer_head *__getblk(struct block_device *bdev, sector_t block,
@@ -204,6 +198,8 @@ extern int buffer_heads_over_limit;
204void block_invalidatepage(struct page *page, unsigned long offset); 198void block_invalidatepage(struct page *page, unsigned long offset);
205int block_write_full_page(struct page *page, get_block_t *get_block, 199int block_write_full_page(struct page *page, get_block_t *get_block,
206 struct writeback_control *wbc); 200 struct writeback_control *wbc);
201int block_write_full_page_endio(struct page *page, get_block_t *get_block,
202 struct writeback_control *wbc, bh_end_io_t *handler);
207int block_read_full_page(struct page*, get_block_t*); 203int block_read_full_page(struct page*, get_block_t*);
208int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, 204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
209 unsigned long from); 205 unsigned long from);
@@ -223,7 +219,7 @@ int cont_write_begin(struct file *, struct address_space *, loff_t,
223 get_block_t *, loff_t *); 219 get_block_t *, loff_t *);
224int generic_cont_expand_simple(struct inode *inode, loff_t size); 220int generic_cont_expand_simple(struct inode *inode, loff_t size);
225int block_commit_write(struct page *page, unsigned from, unsigned to); 221int block_commit_write(struct page *page, unsigned from, unsigned to);
226int block_page_mkwrite(struct vm_area_struct *vma, struct page *page, 222int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
227 get_block_t get_block); 223 get_block_t get_block);
228void block_sync_page(struct page *); 224void block_sync_page(struct page *);
229sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 225sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
@@ -339,22 +335,10 @@ extern int __set_page_dirty_buffers(struct page *page);
339 335
340static inline void buffer_init(void) {} 336static inline void buffer_init(void) {}
341static inline int try_to_free_buffers(struct page *page) { return 1; } 337static inline int try_to_free_buffers(struct page *page) { return 1; }
342static inline int sync_blockdev(struct block_device *bdev) { return 0; }
343static inline int inode_has_buffers(struct inode *inode) { return 0; } 338static inline int inode_has_buffers(struct inode *inode) { return 0; }
344static inline void invalidate_inode_buffers(struct inode *inode) {} 339static inline void invalidate_inode_buffers(struct inode *inode) {}
345static inline int remove_inode_buffers(struct inode *inode) { return 1; } 340static inline int remove_inode_buffers(struct inode *inode) { return 1; }
346static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; } 341static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; }
347static inline void invalidate_bdev(struct block_device *bdev) {}
348
349static inline struct super_block *freeze_bdev(struct block_device *sb)
350{
351 return NULL;
352}
353
354static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
355{
356 return 0;
357}
358 342
359#endif /* CONFIG_BLOCK */ 343#endif /* CONFIG_BLOCK */
360#endif /* _LINUX_BUFFER_HEAD_H */ 344#endif /* _LINUX_BUFFER_HEAD_H */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 1b9872556131..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,9 +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 \
396# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \ 410 | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \
397 CAP_FS_MASK_B1 } }) 411 CAP_FS_MASK_B1 } })
412# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \
413 | CAP_TO_MASK(CAP_SYS_RESOURCE), \
414 CAP_FS_MASK_B1 } })
398 415
399#endif /* _KERNEL_CAPABILITY_U32S != 2 */ 416#endif /* _KERNEL_CAPABILITY_U32S != 2 */
400 417
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 499900d0cee7..665fa70e4094 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -15,6 +15,7 @@
15#include <linux/cgroupstats.h> 15#include <linux/cgroupstats.h>
16#include <linux/prio_heap.h> 16#include <linux/prio_heap.h>
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/idr.h>
18 19
19#ifdef CONFIG_CGROUPS 20#ifdef CONFIG_CGROUPS
20 21
@@ -22,6 +23,7 @@ struct cgroupfs_root;
22struct cgroup_subsys; 23struct cgroup_subsys;
23struct inode; 24struct inode;
24struct cgroup; 25struct cgroup;
26struct css_id;
25 27
26extern int cgroup_init_early(void); 28extern int cgroup_init_early(void);
27extern int cgroup_init(void); 29extern int cgroup_init(void);
@@ -47,18 +49,24 @@ enum cgroup_subsys_id {
47 49
48/* Per-subsystem/per-cgroup state maintained by the system. */ 50/* Per-subsystem/per-cgroup state maintained by the system. */
49struct cgroup_subsys_state { 51struct cgroup_subsys_state {
50 /* The cgroup that this subsystem is attached to. Useful 52 /*
53 * The cgroup that this subsystem is attached to. Useful
51 * for subsystems that want to know about the cgroup 54 * for subsystems that want to know about the cgroup
52 * hierarchy structure */ 55 * hierarchy structure
56 */
53 struct cgroup *cgroup; 57 struct cgroup *cgroup;
54 58
55 /* State maintained by the cgroup system to allow subsystems 59 /*
60 * State maintained by the cgroup system to allow subsystems
56 * to be "busy". Should be accessed via css_get(), 61 * to be "busy". Should be accessed via css_get(),
57 * css_tryget() and and css_put(). */ 62 * css_tryget() and and css_put().
63 */
58 64
59 atomic_t refcnt; 65 atomic_t refcnt;
60 66
61 unsigned long flags; 67 unsigned long flags;
68 /* ID for this css, if possible */
69 struct css_id *id;
62}; 70};
63 71
64/* bits in struct cgroup_subsys_state flags field */ 72/* bits in struct cgroup_subsys_state flags field */
@@ -120,19 +128,26 @@ static inline void css_put(struct cgroup_subsys_state *css)
120enum { 128enum {
121 /* Control Group is dead */ 129 /* Control Group is dead */
122 CGRP_REMOVED, 130 CGRP_REMOVED,
123 /* Control Group has previously had a child cgroup or a task, 131 /*
124 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */ 132 * Control Group has previously had a child cgroup or a task,
133 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
134 */
125 CGRP_RELEASABLE, 135 CGRP_RELEASABLE,
126 /* Control Group requires release notifications to userspace */ 136 /* Control Group requires release notifications to userspace */
127 CGRP_NOTIFY_ON_RELEASE, 137 CGRP_NOTIFY_ON_RELEASE,
138 /*
139 * A thread in rmdir() is wating for this cgroup.
140 */
141 CGRP_WAIT_ON_RMDIR,
128}; 142};
129 143
130struct cgroup { 144struct cgroup {
131 unsigned long flags; /* "unsigned long" so bitops work */ 145 unsigned long flags; /* "unsigned long" so bitops work */
132 146
133 /* count users of this cgroup. >0 means busy, but doesn't 147 /*
134 * necessarily indicate the number of tasks in the 148 * count users of this cgroup. >0 means busy, but doesn't
135 * cgroup */ 149 * necessarily indicate the number of tasks in the cgroup
150 */
136 atomic_t count; 151 atomic_t count;
137 152
138 /* 153 /*
@@ -142,7 +157,7 @@ struct cgroup {
142 struct list_head sibling; /* my parent's children */ 157 struct list_head sibling; /* my parent's children */
143 struct list_head children; /* my children */ 158 struct list_head children; /* my children */
144 159
145 struct cgroup *parent; /* my parent */ 160 struct cgroup *parent; /* my parent */
146 struct dentry *dentry; /* cgroup fs entry, RCU protected */ 161 struct dentry *dentry; /* cgroup fs entry, RCU protected */
147 162
148 /* Private pointers for each registered subsystem */ 163 /* Private pointers for each registered subsystem */
@@ -177,11 +192,12 @@ struct cgroup {
177 struct rcu_head rcu_head; 192 struct rcu_head rcu_head;
178}; 193};
179 194
180/* A css_set is a structure holding pointers to a set of 195/*
196 * A css_set is a structure holding pointers to a set of
181 * cgroup_subsys_state objects. This saves space in the task struct 197 * cgroup_subsys_state objects. This saves space in the task struct
182 * object and speeds up fork()/exit(), since a single inc/dec and a 198 * object and speeds up fork()/exit(), since a single inc/dec and a
183 * list_add()/del() can bump the reference count on the entire 199 * list_add()/del() can bump the reference count on the entire cgroup
184 * cgroup set for a task. 200 * set for a task.
185 */ 201 */
186 202
187struct css_set { 203struct css_set {
@@ -226,13 +242,8 @@ struct cgroup_map_cb {
226 void *state; 242 void *state;
227}; 243};
228 244
229/* struct cftype: 245/*
230 * 246 * struct cftype: handler definitions for cgroup control files
231 * The files in the cgroup filesystem mostly have a very simple read/write
232 * handling, some common function will take care of it. Nevertheless some cases
233 * (read tasks) are special and therefore I define this structure for every
234 * kind of file.
235 *
236 * 247 *
237 * When reading/writing to a file: 248 * When reading/writing to a file:
238 * - the cgroup to use is file->f_dentry->d_parent->d_fsdata 249 * - the cgroup to use is file->f_dentry->d_parent->d_fsdata
@@ -241,10 +252,17 @@ struct cgroup_map_cb {
241 252
242#define MAX_CFTYPE_NAME 64 253#define MAX_CFTYPE_NAME 64
243struct cftype { 254struct cftype {
244 /* By convention, the name should begin with the name of the 255 /*
245 * subsystem, followed by a period */ 256 * By convention, the name should begin with the name of the
257 * subsystem, followed by a period
258 */
246 char name[MAX_CFTYPE_NAME]; 259 char name[MAX_CFTYPE_NAME];
247 int private; 260 int private;
261 /*
262 * If not 0, file mode is set to this value, otherwise it will
263 * be figured out automatically
264 */
265 mode_t mode;
248 266
249 /* 267 /*
250 * If non-zero, defines the maximum length of string that can 268 * If non-zero, defines the maximum length of string that can
@@ -319,15 +337,20 @@ struct cgroup_scanner {
319 void (*process_task)(struct task_struct *p, 337 void (*process_task)(struct task_struct *p,
320 struct cgroup_scanner *scan); 338 struct cgroup_scanner *scan);
321 struct ptr_heap *heap; 339 struct ptr_heap *heap;
340 void *data;
322}; 341};
323 342
324/* Add a new file to the given cgroup directory. Should only be 343/*
325 * called by subsystems from within a populate() method */ 344 * Add a new file to the given cgroup directory. Should only be
345 * called by subsystems from within a populate() method
346 */
326int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys, 347int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
327 const struct cftype *cft); 348 const struct cftype *cft);
328 349
329/* Add a set of new files to the given cgroup directory. Should 350/*
330 * only be called by subsystems from within a populate() method */ 351 * Add a set of new files to the given cgroup directory. Should
352 * only be called by subsystems from within a populate() method
353 */
331int cgroup_add_files(struct cgroup *cgrp, 354int cgroup_add_files(struct cgroup *cgrp,
332 struct cgroup_subsys *subsys, 355 struct cgroup_subsys *subsys,
333 const struct cftype cft[], 356 const struct cftype cft[],
@@ -339,15 +362,18 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
339 362
340int cgroup_task_count(const struct cgroup *cgrp); 363int cgroup_task_count(const struct cgroup *cgrp);
341 364
342/* Return true if the cgroup is a descendant of the current cgroup */ 365/* Return true if cgrp is a descendant of the task's cgroup */
343int cgroup_is_descendant(const struct cgroup *cgrp); 366int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task);
344 367
345/* Control Group subsystem type. See Documentation/cgroups.txt for details */ 368/*
369 * Control Group subsystem type.
370 * See Documentation/cgroups/cgroups.txt for details
371 */
346 372
347struct cgroup_subsys { 373struct cgroup_subsys {
348 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss, 374 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
349 struct cgroup *cgrp); 375 struct cgroup *cgrp);
350 void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 376 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
351 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 377 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
352 int (*can_attach)(struct cgroup_subsys *ss, 378 int (*can_attach)(struct cgroup_subsys *ss,
353 struct cgroup *cgrp, struct task_struct *tsk); 379 struct cgroup *cgrp, struct task_struct *tsk);
@@ -364,6 +390,11 @@ struct cgroup_subsys {
364 int active; 390 int active;
365 int disabled; 391 int disabled;
366 int early_init; 392 int early_init;
393 /*
394 * True if this subsys uses ID. ID is not available before cgroup_init()
395 * (not available in early_init time.)
396 */
397 bool use_id;
367#define MAX_CGROUP_TYPE_NAMELEN 32 398#define MAX_CGROUP_TYPE_NAMELEN 32
368 const char *name; 399 const char *name;
369 400
@@ -386,6 +417,9 @@ struct cgroup_subsys {
386 */ 417 */
387 struct cgroupfs_root *root; 418 struct cgroupfs_root *root;
388 struct list_head sibling; 419 struct list_head sibling;
420 /* used when use_id == true */
421 struct idr idr;
422 spinlock_t id_lock;
389}; 423};
390 424
391#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; 425#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
@@ -419,7 +453,8 @@ struct cgroup_iter {
419 struct list_head *task; 453 struct list_head *task;
420}; 454};
421 455
422/* To iterate across the tasks in a cgroup: 456/*
457 * To iterate across the tasks in a cgroup:
423 * 458 *
424 * 1) call cgroup_iter_start to intialize an iterator 459 * 1) call cgroup_iter_start to intialize an iterator
425 * 460 *
@@ -428,9 +463,10 @@ struct cgroup_iter {
428 * 463 *
429 * 3) call cgroup_iter_end() to destroy the iterator. 464 * 3) call cgroup_iter_end() to destroy the iterator.
430 * 465 *
431 * Or, call cgroup_scan_tasks() to iterate through every task in a cpuset. 466 * Or, call cgroup_scan_tasks() to iterate through every task in a
432 * - cgroup_scan_tasks() holds the css_set_lock when calling the test_task() 467 * cgroup - cgroup_scan_tasks() holds the css_set_lock when calling
433 * callback, but not while calling the process_task() callback. 468 * the test_task() callback, but not while calling the process_task()
469 * callback.
434 */ 470 */
435void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it); 471void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it);
436struct task_struct *cgroup_iter_next(struct cgroup *cgrp, 472struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
@@ -439,6 +475,44 @@ void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
439int cgroup_scan_tasks(struct cgroup_scanner *scan); 475int cgroup_scan_tasks(struct cgroup_scanner *scan);
440int cgroup_attach_task(struct cgroup *, struct task_struct *); 476int cgroup_attach_task(struct cgroup *, struct task_struct *);
441 477
478/*
479 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
480 * if cgroup_subsys.use_id == true. It can be used for looking up and scanning.
481 * CSS ID is assigned at cgroup allocation (create) automatically
482 * and removed when subsys calls free_css_id() function. This is because
483 * the lifetime of cgroup_subsys_state is subsys's matter.
484 *
485 * Looking up and scanning function should be called under rcu_read_lock().
486 * Taking cgroup_mutex()/hierarchy_mutex() is not necessary for following calls.
487 * But the css returned by this routine can be "not populated yet" or "being
488 * destroyed". The caller should check css and cgroup's status.
489 */
490
491/*
492 * Typically Called at ->destroy(), or somewhere the subsys frees
493 * cgroup_subsys_state.
494 */
495void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);
496
497/* Find a cgroup_subsys_state which has given ID */
498
499struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id);
500
501/*
502 * Get a cgroup whose id is greater than or equal to id under tree of root.
503 * Returning a cgroup_subsys_state or NULL.
504 */
505struct cgroup_subsys_state *css_get_next(struct cgroup_subsys *ss, int id,
506 struct cgroup_subsys_state *root, int *foundid);
507
508/* Returns true if root is ancestor of cg */
509bool css_is_ancestor(struct cgroup_subsys_state *cg,
510 const struct cgroup_subsys_state *root);
511
512/* Get id and depth of css */
513unsigned short css_id(struct cgroup_subsys_state *css);
514unsigned short css_depth(struct cgroup_subsys_state *css);
515
442#else /* !CONFIG_CGROUPS */ 516#else /* !CONFIG_CGROUPS */
443 517
444static inline int cgroup_init_early(void) { return 0; } 518static inline int cgroup_init_early(void) { return 0; }
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 778777316ea4..1db9bbf444a3 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -125,4 +125,21 @@ int clk_set_parent(struct clk *clk, struct clk *parent);
125 */ 125 */
126struct clk *clk_get_parent(struct clk *clk); 126struct clk *clk_get_parent(struct clk *clk);
127 127
128/**
129 * clk_get_sys - get a clock based upon the device name
130 * @dev_id: device name
131 * @con_id: connection ID
132 *
133 * Returns a struct clk corresponding to the clock producer, or
134 * valid IS_ERR() condition containing errno. The implementation
135 * uses @dev_id and @con_id to determine the clock consumer, and
136 * thereby the clock producer. In contrast to clk_get() this function
137 * takes the device name instead of the device itself for identification.
138 *
139 * Drivers must assume that the clock source is not enabled.
140 *
141 * clk_get_sys should not be called from within interrupt context.
142 */
143struct clk *clk_get_sys(const char *dev_id, const char *con_id);
144
128#endif 145#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index f88d32f8ff7c..5a40d14daa9f 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -22,8 +22,109 @@ typedef u64 cycle_t;
22struct clocksource; 22struct clocksource;
23 23
24/** 24/**
25 * struct cyclecounter - hardware abstraction for a free running counter
26 * Provides completely state-free accessors to the underlying hardware.
27 * Depending on which hardware it reads, the cycle counter may wrap
28 * around quickly. Locking rules (if necessary) have to be defined
29 * by the implementor and user of specific instances of this API.
30 *
31 * @read: returns the current cycle value
32 * @mask: bitmask for two's complement
33 * subtraction of non 64 bit counters,
34 * see CLOCKSOURCE_MASK() helper macro
35 * @mult: cycle to nanosecond multiplier
36 * @shift: cycle to nanosecond divisor (power of two)
37 */
38struct cyclecounter {
39 cycle_t (*read)(const struct cyclecounter *cc);
40 cycle_t mask;
41 u32 mult;
42 u32 shift;
43};
44
45/**
46 * struct timecounter - layer above a %struct cyclecounter which counts nanoseconds
47 * Contains the state needed by timecounter_read() to detect
48 * cycle counter wrap around. Initialize with
49 * timecounter_init(). Also used to convert cycle counts into the
50 * corresponding nanosecond counts with timecounter_cyc2time(). Users
51 * of this code are responsible for initializing the underlying
52 * cycle counter hardware, locking issues and reading the time
53 * more often than the cycle counter wraps around. The nanosecond
54 * counter will only wrap around after ~585 years.
55 *
56 * @cc: the cycle counter used by this instance
57 * @cycle_last: most recent cycle counter value seen by
58 * timecounter_read()
59 * @nsec: continuously increasing count
60 */
61struct timecounter {
62 const struct cyclecounter *cc;
63 cycle_t cycle_last;
64 u64 nsec;
65};
66
67/**
68 * cyclecounter_cyc2ns - converts cycle counter cycles to nanoseconds
69 * @tc: Pointer to cycle counter.
70 * @cycles: Cycles
71 *
72 * XXX - This could use some mult_lxl_ll() asm optimization. Same code
73 * as in cyc2ns, but with unsigned result.
74 */
75static inline u64 cyclecounter_cyc2ns(const struct cyclecounter *cc,
76 cycle_t cycles)
77{
78 u64 ret = (u64)cycles;
79 ret = (ret * cc->mult) >> cc->shift;
80 return ret;
81}
82
83/**
84 * timecounter_init - initialize a time counter
85 * @tc: Pointer to time counter which is to be initialized/reset
86 * @cc: A cycle counter, ready to be used.
87 * @start_tstamp: Arbitrary initial time stamp.
88 *
89 * After this call the current cycle register (roughly) corresponds to
90 * the initial time stamp. Every call to timecounter_read() increments
91 * the time stamp counter by the number of elapsed nanoseconds.
92 */
93extern void timecounter_init(struct timecounter *tc,
94 const struct cyclecounter *cc,
95 u64 start_tstamp);
96
97/**
98 * timecounter_read - return nanoseconds elapsed since timecounter_init()
99 * plus the initial time stamp
100 * @tc: Pointer to time counter.
101 *
102 * In other words, keeps track of time since the same epoch as
103 * the function which generated the initial time stamp.
104 */
105extern u64 timecounter_read(struct timecounter *tc);
106
107/**
108 * timecounter_cyc2time - convert a cycle counter to same
109 * time base as values returned by
110 * timecounter_read()
111 * @tc: Pointer to time counter.
112 * @cycle: a value returned by tc->cc->read()
113 *
114 * Cycle counts that are converted correctly as long as they
115 * fall into the interval [-1/2 max cycle count, +1/2 max cycle count],
116 * with "max cycle count" == cs->mask+1.
117 *
118 * This allows conversion of cycle counter values which were generated
119 * in the past.
120 */
121extern u64 timecounter_cyc2time(struct timecounter *tc,
122 cycle_t cycle_tstamp);
123
124/**
25 * struct clocksource - hardware abstraction for a free running counter 125 * struct clocksource - hardware abstraction for a free running counter
26 * Provides mostly state-free accessors to the underlying hardware. 126 * Provides mostly state-free accessors to the underlying hardware.
127 * This is the structure used for system time.
27 * 128 *
28 * @name: ptr to clocksource name 129 * @name: ptr to clocksource name
29 * @list: list head for registration 130 * @list: list head for registration
@@ -42,7 +143,9 @@ struct clocksource;
42 * 400-499: Perfect 143 * 400-499: Perfect
43 * The ideal clocksource. A must-use where 144 * The ideal clocksource. A must-use where
44 * available. 145 * available.
45 * @read: returns a cycle value 146 * @read: returns a cycle value, passes clocksource as argument
147 * @enable: optional function to enable the clocksource
148 * @disable: optional function to disable the clocksource
46 * @mask: bitmask for two's complement 149 * @mask: bitmask for two's complement
47 * subtraction of non 64 bit counters 150 * subtraction of non 64 bit counters
48 * @mult: cycle to nanosecond multiplier (adjusted by NTP) 151 * @mult: cycle to nanosecond multiplier (adjusted by NTP)
@@ -61,7 +164,9 @@ struct clocksource {
61 char *name; 164 char *name;
62 struct list_head list; 165 struct list_head list;
63 int rating; 166 int rating;
64 cycle_t (*read)(void); 167 cycle_t (*read)(struct clocksource *cs);
168 int (*enable)(struct clocksource *cs);
169 void (*disable)(struct clocksource *cs);
65 cycle_t mask; 170 cycle_t mask;
66 u32 mult; 171 u32 mult;
67 u32 mult_orig; 172 u32 mult_orig;
@@ -170,7 +275,34 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
170 */ 275 */
171static inline cycle_t clocksource_read(struct clocksource *cs) 276static inline cycle_t clocksource_read(struct clocksource *cs)
172{ 277{
173 return cs->read(); 278 return cs->read(cs);
279}
280
281/**
282 * clocksource_enable: - enable clocksource
283 * @cs: pointer to clocksource
284 *
285 * Enables the specified clocksource. The clocksource callback
286 * function should start up the hardware and setup mult and field
287 * members of struct clocksource to reflect hardware capabilities.
288 */
289static inline int clocksource_enable(struct clocksource *cs)
290{
291 return cs->enable ? cs->enable(cs) : 0;
292}
293
294/**
295 * clocksource_disable: - disable clocksource
296 * @cs: pointer to clocksource
297 *
298 * Disables the specified clocksource. The clocksource callback
299 * function should power down the now unused hardware block to
300 * save power.
301 */
302static inline void clocksource_disable(struct clocksource *cs)
303{
304 if (cs->disable)
305 cs->disable(cs);
174} 306}
175 307
176/** 308/**
diff --git a/include/linux/cm4000_cs.h b/include/linux/cm4000_cs.h
index 605ebe24bb2e..72bfefdbd767 100644
--- a/include/linux/cm4000_cs.h
+++ b/include/linux/cm4000_cs.h
@@ -1,6 +1,8 @@
1#ifndef _CM4000_H_ 1#ifndef _CM4000_H_
2#define _CM4000_H_ 2#define _CM4000_H_
3 3
4#include <linux/types.h>
5
4#define MAX_ATR 33 6#define MAX_ATR 33
5 7
6#define CM4000_MAX_DEV 4 8#define CM4000_MAX_DEV 4
@@ -10,9 +12,9 @@
10 * not to break compilation of userspace apps. -HW */ 12 * not to break compilation of userspace apps. -HW */
11 13
12typedef struct atreq { 14typedef struct atreq {
13 int32_t atr_len; 15 __s32 atr_len;
14 unsigned char atr[64]; 16 unsigned char atr[64];
15 int32_t power_act; 17 __s32 power_act;
16 unsigned char bIFSD; 18 unsigned char bIFSD;
17 unsigned char bIFSC; 19 unsigned char bIFSC;
18} atreq_t; 20} atreq_t;
@@ -22,13 +24,13 @@ typedef struct atreq {
22 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace 24 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
23 * will lay out the structure members differently than the 64bit kernel. 25 * will lay out the structure members differently than the 64bit kernel.
24 * 26 *
25 * I've changed "ptsreq.protocol" from "unsigned long" to "u_int32_t". 27 * I've changed "ptsreq.protocol" from "unsigned long" to "__u32".
26 * On 32bit this will make no difference. With 64bit kernels, it will make 28 * On 32bit this will make no difference. With 64bit kernels, it will make
27 * 32bit apps work, too. 29 * 32bit apps work, too.
28 */ 30 */
29 31
30typedef struct ptsreq { 32typedef struct ptsreq {
31 u_int32_t protocol; /*T=0: 2^0, T=1: 2^1*/ 33 __u32 protocol; /*T=0: 2^0, T=1: 2^1*/
32 unsigned char flags; 34 unsigned char flags;
33 unsigned char pts1; 35 unsigned char pts1;
34 unsigned char pts2; 36 unsigned char pts2;
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index 1c86d65bc4b9..b8125b2eb665 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -65,20 +65,20 @@ struct proc_event {
65 } ack; 65 } ack;
66 66
67 struct fork_proc_event { 67 struct fork_proc_event {
68 pid_t parent_pid; 68 __kernel_pid_t parent_pid;
69 pid_t parent_tgid; 69 __kernel_pid_t parent_tgid;
70 pid_t child_pid; 70 __kernel_pid_t child_pid;
71 pid_t child_tgid; 71 __kernel_pid_t child_tgid;
72 } fork; 72 } fork;
73 73
74 struct exec_proc_event { 74 struct exec_proc_event {
75 pid_t process_pid; 75 __kernel_pid_t process_pid;
76 pid_t process_tgid; 76 __kernel_pid_t process_tgid;
77 } exec; 77 } exec;
78 78
79 struct id_proc_event { 79 struct id_proc_event {
80 pid_t process_pid; 80 __kernel_pid_t process_pid;
81 pid_t process_tgid; 81 __kernel_pid_t process_tgid;
82 union { 82 union {
83 __u32 ruid; /* task uid */ 83 __u32 ruid; /* task uid */
84 __u32 rgid; /* task gid */ 84 __u32 rgid; /* task gid */
@@ -90,8 +90,8 @@ struct proc_event {
90 } id; 90 } id;
91 91
92 struct exit_proc_event { 92 struct exit_proc_event {
93 pid_t process_pid; 93 __kernel_pid_t process_pid;
94 pid_t process_tgid; 94 __kernel_pid_t process_tgid;
95 __u32 exit_code, exit_signal; 95 __u32 exit_code, exit_signal;
96 } exit; 96 } exit;
97 } event_data; 97 } event_data;
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 07ae8f846055..5b5d4731f956 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -6,6 +6,7 @@
6#define CODA_PSDEV_MAJOR 67 6#define CODA_PSDEV_MAJOR 67
7#define MAX_CODADEVS 5 /* how many do we allow */ 7#define MAX_CODADEVS 5 /* how many do we allow */
8 8
9#ifdef __KERNEL__
9struct kstatfs; 10struct kstatfs;
10 11
11/* communication pending/processing queues */ 12/* communication pending/processing queues */
@@ -24,7 +25,6 @@ static inline struct venus_comm *coda_vcp(struct super_block *sb)
24 return (struct venus_comm *)((sb)->s_fs_info); 25 return (struct venus_comm *)((sb)->s_fs_info);
25} 26}
26 27
27
28/* upcalls */ 28/* upcalls */
29int venus_rootfid(struct super_block *sb, struct CodaFid *fidp); 29int venus_rootfid(struct super_block *sb, struct CodaFid *fidp);
30int venus_getattr(struct super_block *sb, struct CodaFid *fid, 30int venus_getattr(struct super_block *sb, struct CodaFid *fid,
@@ -64,6 +64,12 @@ int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb);
64int venus_fsync(struct super_block *sb, struct CodaFid *fid); 64int venus_fsync(struct super_block *sb, struct CodaFid *fid);
65int venus_statfs(struct dentry *dentry, struct kstatfs *sfs); 65int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
66 66
67/*
68 * Statistics
69 */
70
71extern struct venus_comm coda_comms[];
72#endif /* __KERNEL__ */
67 73
68/* messages between coda filesystem in kernel and Venus */ 74/* messages between coda filesystem in kernel and Venus */
69struct upc_req { 75struct upc_req {
@@ -82,11 +88,4 @@ struct upc_req {
82#define REQ_WRITE 0x4 88#define REQ_WRITE 0x4
83#define REQ_ABORT 0x8 89#define REQ_ABORT 0x8
84 90
85
86/*
87 * Statistics
88 */
89
90extern struct venus_comm coda_comms[];
91
92#endif 91#endif
diff --git a/include/linux/com20020.h b/include/linux/com20020.h
index ac6d9a43e085..5dcfb944b6ce 100644
--- a/include/linux/com20020.h
+++ b/include/linux/com20020.h
@@ -29,6 +29,7 @@
29 29
30int com20020_check(struct net_device *dev); 30int com20020_check(struct net_device *dev);
31int com20020_found(struct net_device *dev, int shared); 31int com20020_found(struct net_device *dev, int shared);
32extern const struct net_device_ops com20020_netdev_ops;
32 33
33/* The number of low I/O ports used by the card. */ 34/* The number of low I/O ports used by the card. */
34#define ARCNET_TOTAL_SIZE 8 35#define ARCNET_TOTAL_SIZE 8
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 3fd2194ff573..f2ded21f9a3c 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -125,6 +125,13 @@ struct compat_dirent {
125 char d_name[256]; 125 char d_name[256];
126}; 126};
127 127
128struct compat_ustat {
129 compat_daddr_t f_tfree;
130 compat_ino_t f_tinode;
131 char f_fname[6];
132 char f_fpack[6];
133};
134
128typedef union compat_sigval { 135typedef union compat_sigval {
129 compat_int_t sival_int; 136 compat_int_t sival_int;
130 compat_uptr_t sival_ptr; 137 compat_uptr_t sival_ptr;
@@ -178,11 +185,18 @@ long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
178 unsigned nsems, const struct compat_timespec __user *timeout); 185 unsigned nsems, const struct compat_timespec __user *timeout);
179asmlinkage long compat_sys_keyctl(u32 option, 186asmlinkage long compat_sys_keyctl(u32 option,
180 u32 arg2, u32 arg3, u32 arg4, u32 arg5); 187 u32 arg2, u32 arg3, u32 arg4, u32 arg5);
188asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32);
181 189
182asmlinkage ssize_t compat_sys_readv(unsigned long fd, 190asmlinkage ssize_t compat_sys_readv(unsigned long fd,
183 const struct compat_iovec __user *vec, unsigned long vlen); 191 const struct compat_iovec __user *vec, unsigned long vlen);
184asmlinkage ssize_t compat_sys_writev(unsigned long fd, 192asmlinkage ssize_t compat_sys_writev(unsigned long fd,
185 const struct compat_iovec __user *vec, unsigned long vlen); 193 const struct compat_iovec __user *vec, unsigned long vlen);
194asmlinkage ssize_t compat_sys_preadv(unsigned long fd,
195 const struct compat_iovec __user *vec,
196 unsigned long vlen, u32 pos_low, u32 pos_high);
197asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
198 const struct compat_iovec __user *vec,
199 unsigned long vlen, u32 pos_low, u32 pos_high);
186 200
187int compat_do_execve(char * filename, compat_uptr_t __user *argv, 201int compat_do_execve(char * filename, compat_uptr_t __user *argv,
188 compat_uptr_t __user *envp, struct pt_regs * regs); 202 compat_uptr_t __user *envp, struct pt_regs * regs);
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 1514d534deeb..a3ed7cb8ca34 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -52,7 +52,15 @@
52#define __deprecated __attribute__((deprecated)) 52#define __deprecated __attribute__((deprecated))
53#define __packed __attribute__((packed)) 53#define __packed __attribute__((packed))
54#define __weak __attribute__((weak)) 54#define __weak __attribute__((weak))
55#define __naked __attribute__((naked)) 55
56/*
57 * it doesn't make sense on ARM (currently the only user of __naked) to trace
58 * naked functions because then mcount is called without stack and frame pointer
59 * being set up and there is no chance to restore the lr register to the value
60 * before mcount was called.
61 */
62#define __naked __attribute__((naked)) notrace
63
56#define __noreturn __attribute__((noreturn)) 64#define __noreturn __attribute__((noreturn))
57 65
58/* 66/*
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 09992718f9e8..450fa597c94d 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -3,8 +3,10 @@
3#endif 3#endif
4 4
5/* GCC 4.1.[01] miscompiles __weak */ 5/* GCC 4.1.[01] miscompiles __weak */
6#if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 6#ifdef __KERNEL__
7# error Your version of gcc miscompiles the __weak directive 7# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1
8# error Your version of gcc miscompiles the __weak directive
9# endif
8#endif 10#endif
9 11
10#define __used __attribute__((__used__)) 12#define __used __attribute__((__used__))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index d95da1020f1c..37bcb50a4d7c 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -68,6 +68,7 @@ struct ftrace_branch_data {
68 unsigned long miss; 68 unsigned long miss;
69 unsigned long hit; 69 unsigned long hit;
70 }; 70 };
71 unsigned long miss_hit[2];
71 }; 72 };
72}; 73};
73 74
@@ -75,7 +76,8 @@ struct ftrace_branch_data {
75 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code 76 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
76 * to disable branch tracing on a per file basis. 77 * to disable branch tracing on a per file basis.
77 */ 78 */
78#if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING) 79#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
80 && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
79void 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);
80 82
81#define likely_notrace(x) __builtin_expect(!!(x), 1) 83#define likely_notrace(x) __builtin_expect(!!(x), 1)
@@ -113,7 +115,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
113 * "Define 'is'", Bill Clinton 115 * "Define 'is'", Bill Clinton
114 * "Define 'if'", Steven Rostedt 116 * "Define 'if'", Steven Rostedt
115 */ 117 */
116#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) : \
117 ({ \ 121 ({ \
118 int ______r; \ 122 int ______r; \
119 static struct ftrace_branch_data \ 123 static struct ftrace_branch_data \
@@ -125,10 +129,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
125 .line = __LINE__, \ 129 .line = __LINE__, \
126 }; \ 130 }; \
127 ______r = !!(cond); \ 131 ______r = !!(cond); \
128 if (______r) \ 132 ______f.miss_hit[______r]++; \
129 ______f.hit++; \
130 else \
131 ______f.miss++; \
132 ______r; \ 133 ______r; \
133 })) 134 }))
134#endif /* CONFIG_PROFILE_ALL_BRANCHES */ 135#endif /* CONFIG_PROFILE_ALL_BRANCHES */
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 34f2789d9b9b..b9966e64604e 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -39,8 +39,10 @@
39#define CN_IDX_V86D 0x4 39#define CN_IDX_V86D 0x4
40#define CN_VAL_V86D_UVESAFB 0x1 40#define CN_VAL_V86D_UVESAFB 0x1
41#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */ 41#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */
42#define CN_DST_IDX 0x6
43#define CN_DST_VAL 0x1
42 44
43#define CN_NETLINK_USERS 6 45#define CN_NETLINK_USERS 7
44 46
45/* 47/*
46 * Maximum connector's message size. 48 * Maximum connector's message size.
@@ -109,6 +111,12 @@ struct cn_queue_dev {
109 unsigned char name[CN_CBQ_NAMELEN]; 111 unsigned char name[CN_CBQ_NAMELEN];
110 112
111 struct workqueue_struct *cn_queue; 113 struct workqueue_struct *cn_queue;
114 /* Sent to kevent to create cn_queue only when needed */
115 struct work_struct wq_creation;
116 /* Tell if the wq_creation job is pending/completed */
117 atomic_t wq_requested;
118 /* Wait for cn_queue to be created */
119 wait_queue_head_t wq_created;
112 120
113 struct list_head queue_list; 121 struct list_head queue_list;
114 spinlock_t queue_lock; 122 spinlock_t queue_lock;
@@ -164,6 +172,8 @@ int cn_netlink_send(struct cn_msg *, u32, gfp_t);
164int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *)); 172int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *));
165void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 173void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
166 174
175int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work);
176
167struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *); 177struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *);
168void cn_queue_free_dev(struct cn_queue_dev *dev); 178void cn_queue_free_dev(struct cn_queue_dev *dev);
169 179
diff --git a/include/linux/console.h b/include/linux/console.h
index a67a90cf8268..dcca5339ceb3 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -137,8 +137,8 @@ extern void resume_console(void);
137int mda_console_init(void); 137int mda_console_init(void);
138void prom_con_init(void); 138void prom_con_init(void);
139 139
140void vcs_make_sysfs(struct tty_struct *tty); 140void vcs_make_sysfs(int index);
141void vcs_remove_sysfs(struct tty_struct *tty); 141void vcs_remove_sysfs(int index);
142 142
143/* Some debug stub to catch some of the obvious races in the VT code */ 143/* Some debug stub to catch some of the obvious races in the VT code */
144#if 1 144#if 1
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index c2747ac2ae43..2643d848df90 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -23,7 +23,6 @@
23#include <linux/node.h> 23#include <linux/node.h>
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/cpumask.h> 25#include <linux/cpumask.h>
26#include <linux/mutex.h>
27 26
28struct cpu { 27struct cpu {
29 int node_id; /* The node which contains the CPU */ 28 int node_id; /* The node which contains the CPU */
@@ -103,16 +102,6 @@ extern struct sysdev_class cpu_sysdev_class;
103#ifdef CONFIG_HOTPLUG_CPU 102#ifdef CONFIG_HOTPLUG_CPU
104/* Stop CPUs going up and down. */ 103/* Stop CPUs going up and down. */
105 104
106static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
107{
108 mutex_lock(cpu_hp_mutex);
109}
110
111static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
112{
113 mutex_unlock(cpu_hp_mutex);
114}
115
116extern void get_online_cpus(void); 105extern void get_online_cpus(void);
117extern void put_online_cpus(void); 106extern void put_online_cpus(void);
118#define hotcpu_notifier(fn, pri) { \ 107#define hotcpu_notifier(fn, pri) { \
@@ -126,11 +115,6 @@ int cpu_down(unsigned int cpu);
126 115
127#else /* CONFIG_HOTPLUG_CPU */ 116#else /* CONFIG_HOTPLUG_CPU */
128 117
129static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
130{ }
131static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
132{ }
133
134#define get_online_cpus() do { } while (0) 118#define get_online_cpus() do { } while (0)
135#define put_online_cpus() do { } while (0) 119#define put_online_cpus() do { } while (0)
136#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) 120#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 384b38d3e8e2..161042746afc 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -234,7 +234,6 @@ struct cpufreq_driver {
234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); 234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
235 int (*resume) (struct cpufreq_policy *policy); 235 int (*resume) (struct cpufreq_policy *policy);
236 struct freq_attr **attr; 236 struct freq_attr **attr;
237 bool hide_interface;
238}; 237};
239 238
240/* flags */ 239/* flags */
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 90c6074a36ca..05ea1dd7d681 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -12,6 +12,7 @@
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/nodemask.h> 13#include <linux/nodemask.h>
14#include <linux/cgroup.h> 14#include <linux/cgroup.h>
15#include <linux/mm.h>
15 16
16#ifdef CONFIG_CPUSETS 17#ifdef CONFIG_CPUSETS
17 18
@@ -29,19 +30,29 @@ void cpuset_init_current_mems_allowed(void);
29void cpuset_update_task_memory_state(void); 30void cpuset_update_task_memory_state(void);
30int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); 31int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
31 32
32extern int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask); 33extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask);
33extern int __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask); 34extern int __cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask);
34 35
35static int inline cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask) 36static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
36{ 37{
37 return number_of_cpusets <= 1 || 38 return number_of_cpusets <= 1 ||
38 __cpuset_zone_allowed_softwall(z, gfp_mask); 39 __cpuset_node_allowed_softwall(node, gfp_mask);
39} 40}
40 41
41static int inline cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask) 42static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask)
42{ 43{
43 return number_of_cpusets <= 1 || 44 return number_of_cpusets <= 1 ||
44 __cpuset_zone_allowed_hardwall(z, gfp_mask); 45 __cpuset_node_allowed_hardwall(node, gfp_mask);
46}
47
48static inline int cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask)
49{
50 return cpuset_node_allowed_softwall(zone_to_nid(z), gfp_mask);
51}
52
53static inline int cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)
54{
55 return cpuset_node_allowed_hardwall(zone_to_nid(z), gfp_mask);
45} 56}
46 57
47extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1, 58extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
@@ -90,12 +101,12 @@ static inline void cpuset_init_smp(void) {}
90static inline void cpuset_cpus_allowed(struct task_struct *p, 101static inline void cpuset_cpus_allowed(struct task_struct *p,
91 struct cpumask *mask) 102 struct cpumask *mask)
92{ 103{
93 *mask = cpu_possible_map; 104 cpumask_copy(mask, cpu_possible_mask);
94} 105}
95static inline void cpuset_cpus_allowed_locked(struct task_struct *p, 106static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
96 struct cpumask *mask) 107 struct cpumask *mask)
97{ 108{
98 *mask = cpu_possible_map; 109 cpumask_copy(mask, cpu_possible_mask);
99} 110}
100 111
101static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) 112static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
@@ -112,6 +123,16 @@ static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
112 return 1; 123 return 1;
113} 124}
114 125
126static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
127{
128 return 1;
129}
130
131static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask)
132{
133 return 1;
134}
135
115static inline int cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask) 136static inline int cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask)
116{ 137{
117 return 1; 138 return 1;
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 1f2e9020acc6..ec29fa268b94 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -40,6 +40,7 @@
40#define CRYPTO_ALG_TYPE_SHASH 0x00000009 40#define CRYPTO_ALG_TYPE_SHASH 0x00000009
41#define CRYPTO_ALG_TYPE_AHASH 0x0000000a 41#define CRYPTO_ALG_TYPE_AHASH 0x0000000a
42#define CRYPTO_ALG_TYPE_RNG 0x0000000c 42#define CRYPTO_ALG_TYPE_RNG 0x0000000c
43#define CRYPTO_ALG_TYPE_PCOMPRESS 0x0000000f
43 44
44#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e 45#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
45#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c 46#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c
@@ -548,9 +549,6 @@ struct crypto_attr_u32 {
548 * Transform user interface. 549 * Transform user interface.
549 */ 550 */
550 551
551struct crypto_tfm *crypto_alloc_tfm(const char *alg_name,
552 const struct crypto_type *frontend,
553 u32 type, u32 mask);
554struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); 552struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
555void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm); 553void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm);
556 554
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index d06fbf286346..788850ba4e75 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -82,9 +82,9 @@ struct cyclades_monitor {
82 * open) 82 * open)
83 */ 83 */
84struct cyclades_idle_stats { 84struct cyclades_idle_stats {
85 time_t in_use; /* Time device has been in use (secs) */ 85 __kernel_time_t in_use; /* Time device has been in use (secs) */
86 time_t recv_idle; /* Time since last char received (secs) */ 86 __kernel_time_t recv_idle; /* Time since last char received (secs) */
87 time_t xmit_idle; /* Time since last char transmitted (secs) */ 87 __kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */
88 unsigned long recv_bytes; /* Bytes received */ 88 unsigned long recv_bytes; /* Bytes received */
89 unsigned long xmit_bytes; /* Bytes transmitted */ 89 unsigned long xmit_bytes; /* Bytes transmitted */
90 unsigned long overruns; /* Input overruns */ 90 unsigned long overruns; /* Input overruns */
diff --git a/include/linux/dca.h b/include/linux/dca.h
index b00a753eda53..9c20c7e87d0a 100644
--- a/include/linux/dca.h
+++ b/include/linux/dca.h
@@ -1,3 +1,23 @@
1/*
2 * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
1#ifndef DCA_H 21#ifndef DCA_H
2#define DCA_H 22#define DCA_H
3/* DCA Provider API */ 23/* DCA Provider API */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index c66d22487bf8..15156364d196 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -112,7 +112,7 @@ struct dentry {
112 struct list_head d_subdirs; /* our children */ 112 struct list_head d_subdirs; /* our children */
113 struct list_head d_alias; /* inode alias list */ 113 struct list_head d_alias; /* inode alias list */
114 unsigned long d_time; /* used by d_revalidate */ 114 unsigned long d_time; /* used by d_revalidate */
115 struct dentry_operations *d_op; 115 const struct dentry_operations *d_op;
116 struct super_block *d_sb; /* The root of the dentry tree */ 116 struct super_block *d_sb; /* The root of the dentry tree */
117 void *d_fsdata; /* fs-specific data */ 117 void *d_fsdata; /* fs-specific data */
118 118
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 61734e27abb7..7434a8353e23 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -355,46 +355,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
355 return __dccp_hdr_len(dccp_hdr(skb)); 355 return __dccp_hdr_len(dccp_hdr(skb));
356} 356}
357 357
358
359/* initial values for each feature */
360#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
361#define DCCPF_INITIAL_ACK_RATIO 2
362#define DCCPF_INITIAL_CCID DCCPC_CCID2
363/* FIXME: for now we're default to 1 but it should really be 0 */
364#define DCCPF_INITIAL_SEND_NDP_COUNT 1
365
366/**
367 * struct dccp_minisock - Minimal DCCP connection representation
368 *
369 * Will be used to pass the state from dccp_request_sock to dccp_sock.
370 *
371 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
372 * @dccpms_pending - List of features being negotiated
373 * @dccpms_conf -
374 */
375struct dccp_minisock {
376 __u64 dccpms_sequence_window;
377 struct list_head dccpms_pending;
378 struct list_head dccpms_conf;
379};
380
381struct dccp_opt_conf {
382 __u8 *dccpoc_val;
383 __u8 dccpoc_len;
384};
385
386struct dccp_opt_pend {
387 struct list_head dccpop_node;
388 __u8 dccpop_type;
389 __u8 dccpop_feat;
390 __u8 *dccpop_val;
391 __u8 dccpop_len;
392 int dccpop_conf;
393 struct dccp_opt_conf *dccpop_sc;
394};
395
396extern void dccp_minisock_init(struct dccp_minisock *dmsk);
397
398/** 358/**
399 * struct dccp_request_sock - represent DCCP-specific connection request 359 * struct dccp_request_sock - represent DCCP-specific connection request
400 * @dreq_inet_rsk: structure inherited from 360 * @dreq_inet_rsk: structure inherited from
@@ -483,13 +443,14 @@ struct dccp_ackvec;
483 * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo 443 * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo
484 * @dccps_l_ack_ratio - feature-local Ack Ratio 444 * @dccps_l_ack_ratio - feature-local Ack Ratio
485 * @dccps_r_ack_ratio - feature-remote Ack Ratio 445 * @dccps_r_ack_ratio - feature-remote Ack Ratio
446 * @dccps_l_seq_win - local Sequence Window (influences ack number validity)
447 * @dccps_r_seq_win - remote Sequence Window (influences seq number validity)
486 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 448 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
487 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 449 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
488 * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2) 450 * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2)
489 * @dccps_ndp_count - number of Non Data Packets since last data packet 451 * @dccps_ndp_count - number of Non Data Packets since last data packet
490 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) 452 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
491 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4) 453 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4)
492 * @dccps_minisock - associated minisock (accessed via dccp_msk)
493 * @dccps_featneg - tracks feature-negotiation state (mostly during handshake) 454 * @dccps_featneg - tracks feature-negotiation state (mostly during handshake)
494 * @dccps_hc_rx_ackvec - rx half connection ack vector 455 * @dccps_hc_rx_ackvec - rx half connection ack vector
495 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) 456 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
@@ -523,12 +484,13 @@ struct dccp_sock {
523 __u32 dccps_timestamp_time; 484 __u32 dccps_timestamp_time;
524 __u16 dccps_l_ack_ratio; 485 __u16 dccps_l_ack_ratio;
525 __u16 dccps_r_ack_ratio; 486 __u16 dccps_r_ack_ratio;
487 __u64 dccps_l_seq_win:48;
488 __u64 dccps_r_seq_win:48;
526 __u8 dccps_pcslen:4; 489 __u8 dccps_pcslen:4;
527 __u8 dccps_pcrlen:4; 490 __u8 dccps_pcrlen:4;
528 __u8 dccps_send_ndp_count:1; 491 __u8 dccps_send_ndp_count:1;
529 __u64 dccps_ndp_count:48; 492 __u64 dccps_ndp_count:48;
530 unsigned long dccps_rate_last; 493 unsigned long dccps_rate_last;
531 struct dccp_minisock dccps_minisock;
532 struct list_head dccps_featneg; 494 struct list_head dccps_featneg;
533 struct dccp_ackvec *dccps_hc_rx_ackvec; 495 struct dccp_ackvec *dccps_hc_rx_ackvec;
534 struct ccid *dccps_hc_rx_ccid; 496 struct ccid *dccps_hc_rx_ccid;
@@ -546,11 +508,6 @@ static inline struct dccp_sock *dccp_sk(const struct sock *sk)
546 return (struct dccp_sock *)sk; 508 return (struct dccp_sock *)sk;
547} 509}
548 510
549static inline struct dccp_minisock *dccp_msk(const struct sock *sk)
550{
551 return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock;
552}
553
554static inline const char *dccp_role(const struct sock *sk) 511static inline const char *dccp_role(const struct sock *sk)
555{ 512{
556 switch (dccp_sk(sk)->dccps_role) { 513 switch (dccp_sk(sk)->dccps_role) {
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/debugfs.h b/include/linux/debugfs.h
index af0e01d4c663..eb5c2ba2f81a 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -71,6 +71,9 @@ struct dentry *debugfs_create_bool(const char *name, mode_t mode,
71struct dentry *debugfs_create_blob(const char *name, mode_t mode, 71struct dentry *debugfs_create_blob(const char *name, mode_t mode,
72 struct dentry *parent, 72 struct dentry *parent,
73 struct debugfs_blob_wrapper *blob); 73 struct debugfs_blob_wrapper *blob);
74
75bool debugfs_initialized(void);
76
74#else 77#else
75 78
76#include <linux/err.h> 79#include <linux/err.h>
@@ -183,6 +186,11 @@ static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode,
183 return ERR_PTR(-ENODEV); 186 return ERR_PTR(-ENODEV);
184} 187}
185 188
189static inline bool debugfs_initialized(void)
190{
191 return false;
192}
193
186#endif 194#endif
187 195
188#endif 196#endif
diff --git a/include/linux/decompress/bunzip2.h b/include/linux/decompress/bunzip2.h
new file mode 100644
index 000000000000..115272137a9c
--- /dev/null
+++ b/include/linux/decompress/bunzip2.h
@@ -0,0 +1,10 @@
1#ifndef DECOMPRESS_BUNZIP2_H
2#define DECOMPRESS_BUNZIP2_H
3
4int bunzip2(unsigned char *inbuf, int len,
5 int(*fill)(void*, unsigned int),
6 int(*flush)(void*, unsigned int),
7 unsigned char *output,
8 int *pos,
9 void(*error)(char *x));
10#endif
diff --git a/include/linux/decompress/generic.h b/include/linux/decompress/generic.h
new file mode 100644
index 000000000000..6dfb856327bb
--- /dev/null
+++ b/include/linux/decompress/generic.h
@@ -0,0 +1,33 @@
1#ifndef DECOMPRESS_GENERIC_H
2#define DECOMPRESS_GENERIC_H
3
4/* Minimal chunksize to be read.
5 *Bzip2 prefers at least 4096
6 *Lzma prefers 0x10000 */
7#define COMPR_IOBUF_SIZE 4096
8
9typedef int (*decompress_fn) (unsigned char *inbuf, int len,
10 int(*fill)(void*, unsigned int),
11 int(*writebb)(void*, unsigned int),
12 unsigned char *output,
13 int *posp,
14 void(*error)(char *x));
15
16/* inbuf - input buffer
17 *len - len of pre-read data in inbuf
18 *fill - function to fill inbuf if empty
19 *writebb - function to write out outbug
20 *posp - if non-null, input position (number of bytes read) will be
21 * returned here
22 *
23 *If len != 0, the inbuf is initialized (with as much data), and fill
24 *should not be called
25 *If len = 0, the inbuf is allocated, but empty. Its size is IOBUF_SIZE
26 *fill should be called (repeatedly...) to read data, at most IOBUF_SIZE
27 */
28
29/* Utility routine to detect the decompression method */
30decompress_fn decompress_method(const unsigned char *inbuf, int len,
31 const char **name);
32
33#endif
diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h
new file mode 100644
index 000000000000..f9b06ccc3e5c
--- /dev/null
+++ b/include/linux/decompress/inflate.h
@@ -0,0 +1,13 @@
1#ifndef INFLATE_H
2#define INFLATE_H
3
4/* Other housekeeping constants */
5#define INBUFSIZ 4096
6
7int gunzip(unsigned char *inbuf, int len,
8 int(*fill)(void*, unsigned int),
9 int(*flush)(void*, unsigned int),
10 unsigned char *output,
11 int *pos,
12 void(*error_fn)(char *x));
13#endif
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h
new file mode 100644
index 000000000000..12ff8c3f1d05
--- /dev/null
+++ b/include/linux/decompress/mm.h
@@ -0,0 +1,87 @@
1/*
2 * linux/compr_mm.h
3 *
4 * Memory management for pre-boot and ramdisk uncompressors
5 *
6 * Authors: Alain Knaff <alain@knaff.lu>
7 *
8 */
9
10#ifndef DECOMPR_MM_H
11#define DECOMPR_MM_H
12
13#ifdef STATIC
14
15/* Code active when included from pre-boot environment: */
16
17/* A trivial malloc implementation, adapted from
18 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
19 */
20static unsigned long malloc_ptr;
21static int malloc_count;
22
23static void *malloc(int size)
24{
25 void *p;
26
27 if (size < 0)
28 error("Malloc error");
29 if (!malloc_ptr)
30 malloc_ptr = free_mem_ptr;
31
32 malloc_ptr = (malloc_ptr + 3) & ~3; /* Align */
33
34 p = (void *)malloc_ptr;
35 malloc_ptr += size;
36
37 if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr)
38 error("Out of memory");
39
40 malloc_count++;
41 return p;
42}
43
44static void free(void *where)
45{
46 malloc_count--;
47 if (!malloc_count)
48 malloc_ptr = free_mem_ptr;
49}
50
51#define large_malloc(a) malloc(a)
52#define large_free(a) free(a)
53
54#define set_error_fn(x)
55
56#define INIT
57
58#else /* STATIC */
59
60/* Code active when compiled standalone for use when loading ramdisk: */
61
62#include <linux/kernel.h>
63#include <linux/fs.h>
64#include <linux/string.h>
65#include <linux/vmalloc.h>
66
67/* Use defines rather than static inline in order to avoid spurious
68 * warnings when not needed (indeed large_malloc / large_free are not
69 * needed by inflate */
70
71#define malloc(a) kmalloc(a, GFP_KERNEL)
72#define free(a) kfree(a)
73
74#define large_malloc(a) vmalloc(a)
75#define large_free(a) vfree(a)
76
77static void(*error)(char *m);
78#define set_error_fn(x) error = x;
79
80#define INIT __init
81#define STATIC
82
83#include <linux/init.h>
84
85#endif /* STATIC */
86
87#endif /* DECOMPR_MM_H */
diff --git a/include/linux/decompress/unlzma.h b/include/linux/decompress/unlzma.h
new file mode 100644
index 000000000000..7796538f1bf4
--- /dev/null
+++ b/include/linux/decompress/unlzma.h
@@ -0,0 +1,12 @@
1#ifndef DECOMPRESS_UNLZMA_H
2#define DECOMPRESS_UNLZMA_H
3
4int unlzma(unsigned char *, int,
5 int(*fill)(void*, unsigned int),
6 int(*flush)(void*, unsigned int),
7 unsigned char *output,
8 int *posp,
9 void(*error)(char *x)
10 );
11
12#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 8209e08969f9..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;
@@ -139,6 +138,9 @@ struct target_type {
139 dm_ioctl_fn ioctl; 138 dm_ioctl_fn ioctl;
140 dm_merge_fn merge; 139 dm_merge_fn merge;
141 dm_busy_fn busy; 140 dm_busy_fn busy;
141
142 /* For internal device-mapper use. */
143 struct list_head list;
142}; 144};
143 145
144struct io_restrictions { 146struct io_restrictions {
diff --git a/include/linux/device.h b/include/linux/device.h
index 47f343c7bdda..6a69caaac18a 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -28,6 +28,7 @@
28#define BUS_ID_SIZE 20 28#define BUS_ID_SIZE 20
29 29
30struct device; 30struct device;
31struct device_private;
31struct device_driver; 32struct device_driver;
32struct driver_private; 33struct driver_private;
33struct class; 34struct class;
@@ -147,7 +148,7 @@ extern void put_driver(struct device_driver *drv);
147extern struct device_driver *driver_find(const char *name, 148extern struct device_driver *driver_find(const char *name,
148 struct bus_type *bus); 149 struct bus_type *bus);
149extern int driver_probe_done(void); 150extern int driver_probe_done(void);
150extern int wait_for_device_probe(void); 151extern void wait_for_device_probe(void);
151 152
152 153
153/* sysfs interface for exporting driver attributes */ 154/* sysfs interface for exporting driver attributes */
@@ -367,15 +368,11 @@ struct device_dma_parameters {
367}; 368};
368 369
369struct device { 370struct device {
370 struct klist klist_children;
371 struct klist_node knode_parent; /* node in sibling list */
372 struct klist_node knode_driver;
373 struct klist_node knode_bus;
374 struct device *parent; 371 struct device *parent;
375 372
373 struct device_private *p;
374
376 struct kobject kobj; 375 struct kobject kobj;
377 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
378 unsigned uevent_suppress:1;
379 const char *init_name; /* initial name of the device */ 376 const char *init_name; /* initial name of the device */
380 struct device_type *type; 377 struct device_type *type;
381 378
@@ -387,8 +384,13 @@ struct device {
387 struct device_driver *driver; /* which driver has allocated this 384 struct device_driver *driver; /* which driver has allocated this
388 device */ 385 device */
389 void *driver_data; /* data private to the driver */ 386 void *driver_data; /* data private to the driver */
390 void *platform_data; /* Platform specific data, device 387
391 core doesn't touch it */ 388 void *platform_data; /* We will remove platform_data
389 field if all platform devices
390 pass its platform specific data
391 from platform_device->platform_data,
392 other kind of devices should not
393 use platform_data. */
392 struct dev_pm_info power; 394 struct dev_pm_info power;
393 395
394#ifdef CONFIG_NUMA 396#ifdef CONFIG_NUMA
@@ -427,8 +429,7 @@ struct device {
427 429
428static inline const char *dev_name(const struct device *dev) 430static inline const char *dev_name(const struct device *dev)
429{ 431{
430 /* will be changed into kobject_name(&dev->kobj) in the near future */ 432 return kobject_name(&dev->kobj);
431 return dev->bus_id;
432} 433}
433 434
434extern int dev_set_name(struct device *dev, const char *name, ...) 435extern int dev_set_name(struct device *dev, const char *name, ...)
@@ -463,6 +464,16 @@ static inline void dev_set_drvdata(struct device *dev, void *data)
463 dev->driver_data = data; 464 dev->driver_data = data;
464} 465}
465 466
467static inline unsigned int dev_get_uevent_suppress(const struct device *dev)
468{
469 return dev->kobj.uevent_suppress;
470}
471
472static inline void dev_set_uevent_suppress(struct device *dev, int val)
473{
474 dev->kobj.uevent_suppress = val;
475}
476
466static inline int device_is_registered(struct device *dev) 477static inline int device_is_registered(struct device *dev)
467{ 478{
468 return dev->kobj.state_in_sysfs; 479 return dev->kobj.state_in_sysfs;
@@ -483,7 +494,8 @@ extern int device_for_each_child(struct device *dev, void *data,
483extern struct device *device_find_child(struct device *dev, void *data, 494extern struct device *device_find_child(struct device *dev, void *data,
484 int (*match)(struct device *dev, void *data)); 495 int (*match)(struct device *dev, void *data));
485extern int device_rename(struct device *dev, char *new_name); 496extern int device_rename(struct device *dev, char *new_name);
486extern int device_move(struct device *dev, struct device *new_parent); 497extern int device_move(struct device *dev, struct device *new_parent,
498 enum dpm_order dpm_order);
487 499
488/* 500/*
489 * Root device objects for grouping under /sys/devices 501 * Root device objects for grouping under /sys/devices
@@ -539,6 +551,7 @@ extern int (*platform_notify_remove)(struct device *dev);
539extern struct device *get_device(struct device *dev); 551extern struct device *get_device(struct device *dev);
540extern void put_device(struct device *dev); 552extern void put_device(struct device *dev);
541 553
554extern void wait_for_device_probe(void);
542 555
543/* drivers/base/power/shutdown.c */ 556/* drivers/base/power/shutdown.c */
544extern void device_shutdown(void); 557extern void device_shutdown(void);
@@ -570,7 +583,7 @@ extern const char *dev_driver_string(const struct device *dev);
570#if defined(DEBUG) 583#if defined(DEBUG)
571#define dev_dbg(dev, format, arg...) \ 584#define dev_dbg(dev, format, arg...) \
572 dev_printk(KERN_DEBUG , dev , format , ## arg) 585 dev_printk(KERN_DEBUG , dev , format , ## arg)
573#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 586#elif defined(CONFIG_DYNAMIC_DEBUG)
574#define dev_dbg(dev, format, ...) do { \ 587#define dev_dbg(dev, format, ...) do { \
575 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 588 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
576 } while (0) 589 } while (0)
diff --git a/include/linux/dlm_netlink.h b/include/linux/dlm_netlink.h
index 19276332707a..647c8ef27227 100644
--- a/include/linux/dlm_netlink.h
+++ b/include/linux/dlm_netlink.h
@@ -9,6 +9,8 @@
9#ifndef _DLM_NETLINK_H 9#ifndef _DLM_NETLINK_H
10#define _DLM_NETLINK_H 10#define _DLM_NETLINK_H
11 11
12#include <linux/types.h>
13
12enum { 14enum {
13 DLM_STATUS_WAITING = 1, 15 DLM_STATUS_WAITING = 1,
14 DLM_STATUS_GRANTED = 2, 16 DLM_STATUS_GRANTED = 2,
@@ -18,16 +20,16 @@ enum {
18#define DLM_LOCK_DATA_VERSION 1 20#define DLM_LOCK_DATA_VERSION 1
19 21
20struct dlm_lock_data { 22struct dlm_lock_data {
21 uint16_t version; 23 __u16 version;
22 uint32_t lockspace_id; 24 __u32 lockspace_id;
23 int nodeid; 25 int nodeid;
24 int ownpid; 26 int ownpid;
25 uint32_t id; 27 __u32 id;
26 uint32_t remid; 28 __u32 remid;
27 uint64_t xid; 29 __u64 xid;
28 int8_t status; 30 __s8 status;
29 int8_t grmode; 31 __s8 grmode;
30 int8_t rqmode; 32 __s8 rqmode;
31 unsigned long timestamp; 33 unsigned long timestamp;
32 int resource_namelen; 34 int resource_namelen;
33 char resource_name[DLM_RESNAME_MAXLEN]; 35 char resource_name[DLM_RESNAME_MAXLEN];
diff --git a/include/linux/dm-dirty-log.h b/include/linux/dm-dirty-log.h
index 600c5fb2daad..5e8b11d88f6f 100644
--- a/include/linux/dm-dirty-log.h
+++ b/include/linux/dm-dirty-log.h
@@ -28,6 +28,9 @@ struct dm_dirty_log_type {
28 const char *name; 28 const char *name;
29 struct module *module; 29 struct module *module;
30 30
31 /* For internal device-mapper use */
32 struct list_head list;
33
31 int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti, 34 int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti,
32 unsigned argc, char **argv); 35 unsigned argc, char **argv);
33 void (*dtr)(struct dm_dirty_log *log); 36 void (*dtr)(struct dm_dirty_log *log);
@@ -113,6 +116,16 @@ struct dm_dirty_log_type {
113 */ 116 */
114 int (*status)(struct dm_dirty_log *log, status_type_t status_type, 117 int (*status)(struct dm_dirty_log *log, status_type_t status_type,
115 char *result, unsigned maxlen); 118 char *result, unsigned maxlen);
119
120 /*
121 * is_remote_recovering is necessary for cluster mirroring. It provides
122 * a way to detect recovery on another node, so we aren't writing
123 * concurrently. This function is likely to block (when a cluster log
124 * is used).
125 *
126 * Returns: 0, 1
127 */
128 int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region);
116}; 129};
117 130
118int dm_dirty_log_type_register(struct dm_dirty_log_type *type); 131int dm_dirty_log_type_register(struct dm_dirty_log_type *type);
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index 28c2940eb30d..48e44ee2b466 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -113,20 +113,20 @@ struct dm_ioctl {
113 * return -ENOTTY) fill out this field, even if the 113 * return -ENOTTY) fill out this field, even if the
114 * command failed. 114 * command failed.
115 */ 115 */
116 uint32_t version[3]; /* in/out */ 116 __u32 version[3]; /* in/out */
117 uint32_t data_size; /* total size of data passed in 117 __u32 data_size; /* total size of data passed in
118 * including this struct */ 118 * including this struct */
119 119
120 uint32_t data_start; /* offset to start of data 120 __u32 data_start; /* offset to start of data
121 * relative to start of this struct */ 121 * relative to start of this struct */
122 122
123 uint32_t target_count; /* in/out */ 123 __u32 target_count; /* in/out */
124 int32_t open_count; /* out */ 124 __s32 open_count; /* out */
125 uint32_t flags; /* in/out */ 125 __u32 flags; /* in/out */
126 uint32_t event_nr; /* in/out */ 126 __u32 event_nr; /* in/out */
127 uint32_t padding; 127 __u32 padding;
128 128
129 uint64_t dev; /* in/out */ 129 __u64 dev; /* in/out */
130 130
131 char name[DM_NAME_LEN]; /* device name */ 131 char name[DM_NAME_LEN]; /* device name */
132 char uuid[DM_UUID_LEN]; /* unique identifier for 132 char uuid[DM_UUID_LEN]; /* unique identifier for
@@ -139,9 +139,9 @@ struct dm_ioctl {
139 * dm_ioctl. 139 * dm_ioctl.
140 */ 140 */
141struct dm_target_spec { 141struct dm_target_spec {
142 uint64_t sector_start; 142 __u64 sector_start;
143 uint64_t length; 143 __u64 length;
144 int32_t status; /* used when reading from kernel only */ 144 __s32 status; /* used when reading from kernel only */
145 145
146 /* 146 /*
147 * Location of the next dm_target_spec. 147 * Location of the next dm_target_spec.
@@ -153,7 +153,7 @@ struct dm_target_spec {
153 * (that follows the dm_ioctl struct) to the start of the "next" 153 * (that follows the dm_ioctl struct) to the start of the "next"
154 * dm_target_spec. 154 * dm_target_spec.
155 */ 155 */
156 uint32_t next; 156 __u32 next;
157 157
158 char target_type[DM_MAX_TYPE_NAME]; 158 char target_type[DM_MAX_TYPE_NAME];
159 159
@@ -168,17 +168,17 @@ struct dm_target_spec {
168 * Used to retrieve the target dependencies. 168 * Used to retrieve the target dependencies.
169 */ 169 */
170struct dm_target_deps { 170struct dm_target_deps {
171 uint32_t count; /* Array size */ 171 __u32 count; /* Array size */
172 uint32_t padding; /* unused */ 172 __u32 padding; /* unused */
173 uint64_t dev[0]; /* out */ 173 __u64 dev[0]; /* out */
174}; 174};
175 175
176/* 176/*
177 * Used to get a list of all dm devices. 177 * Used to get a list of all dm devices.
178 */ 178 */
179struct dm_name_list { 179struct dm_name_list {
180 uint64_t dev; 180 __u64 dev;
181 uint32_t next; /* offset to the next record from 181 __u32 next; /* offset to the next record from
182 the _start_ of this */ 182 the _start_ of this */
183 char name[0]; 183 char name[0];
184}; 184};
@@ -187,8 +187,8 @@ struct dm_name_list {
187 * Used to retrieve the target versions 187 * Used to retrieve the target versions
188 */ 188 */
189struct dm_target_versions { 189struct dm_target_versions {
190 uint32_t next; 190 __u32 next;
191 uint32_t version[3]; 191 __u32 version[3];
192 192
193 char name[0]; 193 char name[0];
194}; 194};
@@ -197,7 +197,7 @@ struct dm_target_versions {
197 * Used to pass message to a target 197 * Used to pass message to a target
198 */ 198 */
199struct dm_target_msg { 199struct dm_target_msg {
200 uint64_t sector; /* Device sector */ 200 __u64 sector; /* Device sector */
201 201
202 char message[0]; 202 char message[0];
203}; 203};
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
new file mode 100644
index 000000000000..28d53cb7b5a2
--- /dev/null
+++ b/include/linux/dma-debug.h
@@ -0,0 +1,174 @@
1/*
2 * Copyright (C) 2008 Advanced Micro Devices, Inc.
3 *
4 * Author: Joerg Roedel <joerg.roedel@amd.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __DMA_DEBUG_H
21#define __DMA_DEBUG_H
22
23#include <linux/types.h>
24
25struct device;
26struct scatterlist;
27struct bus_type;
28
29#ifdef CONFIG_DMA_API_DEBUG
30
31extern void dma_debug_add_bus(struct bus_type *bus);
32
33extern void dma_debug_init(u32 num_entries);
34
35extern void debug_dma_map_page(struct device *dev, struct page *page,
36 size_t offset, size_t size,
37 int direction, dma_addr_t dma_addr,
38 bool map_single);
39
40extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
41 size_t size, int direction, bool map_single);
42
43extern void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
44 int nents, int mapped_ents, int direction);
45
46extern void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
47 int nelems, int dir);
48
49extern void debug_dma_alloc_coherent(struct device *dev, size_t size,
50 dma_addr_t dma_addr, void *virt);
51
52extern void debug_dma_free_coherent(struct device *dev, size_t size,
53 void *virt, dma_addr_t addr);
54
55extern void debug_dma_sync_single_for_cpu(struct device *dev,
56 dma_addr_t dma_handle, size_t size,
57 int direction);
58
59extern void debug_dma_sync_single_for_device(struct device *dev,
60 dma_addr_t dma_handle,
61 size_t size, int direction);
62
63extern void debug_dma_sync_single_range_for_cpu(struct device *dev,
64 dma_addr_t dma_handle,
65 unsigned long offset,
66 size_t size,
67 int direction);
68
69extern void debug_dma_sync_single_range_for_device(struct device *dev,
70 dma_addr_t dma_handle,
71 unsigned long offset,
72 size_t size, int direction);
73
74extern void debug_dma_sync_sg_for_cpu(struct device *dev,
75 struct scatterlist *sg,
76 int nelems, int direction);
77
78extern void debug_dma_sync_sg_for_device(struct device *dev,
79 struct scatterlist *sg,
80 int nelems, int direction);
81
82extern void debug_dma_dump_mappings(struct device *dev);
83
84#else /* CONFIG_DMA_API_DEBUG */
85
86static inline void dma_debug_add_bus(struct bus_type *bus)
87{
88}
89
90static inline void dma_debug_init(u32 num_entries)
91{
92}
93
94static inline void debug_dma_map_page(struct device *dev, struct page *page,
95 size_t offset, size_t size,
96 int direction, dma_addr_t dma_addr,
97 bool map_single)
98{
99}
100
101static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr,
102 size_t size, int direction,
103 bool map_single)
104{
105}
106
107static inline void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
108 int nents, int mapped_ents, int direction)
109{
110}
111
112static inline void debug_dma_unmap_sg(struct device *dev,
113 struct scatterlist *sglist,
114 int nelems, int dir)
115{
116}
117
118static inline void debug_dma_alloc_coherent(struct device *dev, size_t size,
119 dma_addr_t dma_addr, void *virt)
120{
121}
122
123static inline void debug_dma_free_coherent(struct device *dev, size_t size,
124 void *virt, dma_addr_t addr)
125{
126}
127
128static inline void debug_dma_sync_single_for_cpu(struct device *dev,
129 dma_addr_t dma_handle,
130 size_t size, int direction)
131{
132}
133
134static inline void debug_dma_sync_single_for_device(struct device *dev,
135 dma_addr_t dma_handle,
136 size_t size, int direction)
137{
138}
139
140static inline void debug_dma_sync_single_range_for_cpu(struct device *dev,
141 dma_addr_t dma_handle,
142 unsigned long offset,
143 size_t size,
144 int direction)
145{
146}
147
148static inline void debug_dma_sync_single_range_for_device(struct device *dev,
149 dma_addr_t dma_handle,
150 unsigned long offset,
151 size_t size,
152 int direction)
153{
154}
155
156static inline void debug_dma_sync_sg_for_cpu(struct device *dev,
157 struct scatterlist *sg,
158 int nelems, int direction)
159{
160}
161
162static inline void debug_dma_sync_sg_for_device(struct device *dev,
163 struct scatterlist *sg,
164 int nelems, int direction)
165{
166}
167
168static inline void debug_dma_dump_mappings(struct device *dev)
169{
170}
171
172#endif /* CONFIG_DMA_API_DEBUG */
173
174#endif /* __DMA_DEBUG_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ba9114ec5d3a..8083b6a36a38 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/err.h> 5#include <linux/err.h>
6#include <linux/dma-attrs.h>
7#include <linux/scatterlist.h>
6 8
7/* These definitions mirror those in pci.h, so they can be used 9/* These definitions mirror those in pci.h, so they can be used
8 * interchangeably with their PCI_ counterparts */ 10 * interchangeably with their PCI_ counterparts */
@@ -13,6 +15,52 @@ enum dma_data_direction {
13 DMA_NONE = 3, 15 DMA_NONE = 3,
14}; 16};
15 17
18struct dma_map_ops {
19 void* (*alloc_coherent)(struct device *dev, size_t size,
20 dma_addr_t *dma_handle, gfp_t gfp);
21 void (*free_coherent)(struct device *dev, size_t size,
22 void *vaddr, dma_addr_t dma_handle);
23 dma_addr_t (*map_page)(struct device *dev, struct page *page,
24 unsigned long offset, size_t size,
25 enum dma_data_direction dir,
26 struct dma_attrs *attrs);
27 void (*unmap_page)(struct device *dev, dma_addr_t dma_handle,
28 size_t size, enum dma_data_direction dir,
29 struct dma_attrs *attrs);
30 int (*map_sg)(struct device *dev, struct scatterlist *sg,
31 int nents, enum dma_data_direction dir,
32 struct dma_attrs *attrs);
33 void (*unmap_sg)(struct device *dev,
34 struct scatterlist *sg, int nents,
35 enum dma_data_direction dir,
36 struct dma_attrs *attrs);
37 void (*sync_single_for_cpu)(struct device *dev,
38 dma_addr_t dma_handle, size_t size,
39 enum dma_data_direction dir);
40 void (*sync_single_for_device)(struct device *dev,
41 dma_addr_t dma_handle, size_t size,
42 enum dma_data_direction dir);
43 void (*sync_single_range_for_cpu)(struct device *dev,
44 dma_addr_t dma_handle,
45 unsigned long offset,
46 size_t size,
47 enum dma_data_direction dir);
48 void (*sync_single_range_for_device)(struct device *dev,
49 dma_addr_t dma_handle,
50 unsigned long offset,
51 size_t size,
52 enum dma_data_direction dir);
53 void (*sync_sg_for_cpu)(struct device *dev,
54 struct scatterlist *sg, int nents,
55 enum dma_data_direction dir);
56 void (*sync_sg_for_device)(struct device *dev,
57 struct scatterlist *sg, int nents,
58 enum dma_data_direction dir);
59 int (*mapping_error)(struct device *dev, dma_addr_t dma_addr);
60 int (*dma_supported)(struct device *dev, u64 mask);
61 int is_phys;
62};
63
16#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) 64#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
17 65
18/* 66/*
@@ -67,7 +115,7 @@ static inline u64 dma_get_mask(struct device *dev)
67{ 115{
68 if (dev && dev->dma_mask && *dev->dma_mask) 116 if (dev && dev->dma_mask && *dev->dma_mask)
69 return *dev->dma_mask; 117 return *dev->dma_mask;
70 return DMA_32BIT_MASK; 118 return DMA_BIT_MASK(32);
71} 119}
72 120
73extern u64 dma_get_required_mask(struct device *dev); 121extern u64 dma_get_required_mask(struct device *dev);
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index af1dab41674b..1a455f1f86d7 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -11,6 +11,7 @@
11 11
12#define DMA_PTE_READ (1) 12#define DMA_PTE_READ (1)
13#define DMA_PTE_WRITE (2) 13#define DMA_PTE_WRITE (2)
14#define DMA_PTE_SNP (1 << 11)
14 15
15struct intel_iommu; 16struct intel_iommu;
16struct dmar_domain; 17struct dmar_domain;
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index f0413845f20e..2e2aa3df170c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -23,9 +23,6 @@
23 23
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/uio.h> 25#include <linux/uio.h>
26#include <linux/kref.h>
27#include <linux/completion.h>
28#include <linux/rcupdate.h>
29#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
30 27
31/** 28/**
@@ -97,7 +94,6 @@ typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t;
97 94
98/** 95/**
99 * struct dma_chan_percpu - the per-CPU part of struct dma_chan 96 * struct dma_chan_percpu - the per-CPU part of struct dma_chan
100 * @refcount: local_t used for open-coded "bigref" counting
101 * @memcpy_count: transaction counter 97 * @memcpy_count: transaction counter
102 * @bytes_transferred: byte counter 98 * @bytes_transferred: byte counter
103 */ 99 */
@@ -114,9 +110,6 @@ struct dma_chan_percpu {
114 * @cookie: last cookie value returned to client 110 * @cookie: last cookie value returned to client
115 * @chan_id: channel ID for sysfs 111 * @chan_id: channel ID for sysfs
116 * @dev: class device for sysfs 112 * @dev: class device for sysfs
117 * @refcount: kref, used in "bigref" slow-mode
118 * @slow_ref: indicates that the DMA channel is free
119 * @rcu: the DMA channel's RCU head
120 * @device_node: used to add this to the device chan list 113 * @device_node: used to add this to the device chan list
121 * @local: per-cpu pointer to a struct dma_chan_percpu 114 * @local: per-cpu pointer to a struct dma_chan_percpu
122 * @client-count: how many clients are using this channel 115 * @client-count: how many clients are using this channel
@@ -209,12 +202,11 @@ struct dma_async_tx_descriptor {
209/** 202/**
210 * struct dma_device - info on the entity supplying DMA services 203 * struct dma_device - info on the entity supplying DMA services
211 * @chancnt: how many DMA channels are supported 204 * @chancnt: how many DMA channels are supported
205 * @privatecnt: how many DMA channels are requested by dma_request_channel
212 * @channels: the list of struct dma_chan 206 * @channels: the list of struct dma_chan
213 * @global_node: list_head for global dma_device_list 207 * @global_node: list_head for global dma_device_list
214 * @cap_mask: one or more dma_capability flags 208 * @cap_mask: one or more dma_capability flags
215 * @max_xor: maximum number of xor sources, 0 if no capability 209 * @max_xor: maximum number of xor sources, 0 if no capability
216 * @refcount: reference count
217 * @done: IO completion struct
218 * @dev_id: unique device ID 210 * @dev_id: unique device ID
219 * @dev: struct device reference for dma mapping api 211 * @dev: struct device reference for dma mapping api
220 * @device_alloc_chan_resources: allocate resources and return the 212 * @device_alloc_chan_resources: allocate resources and return the
@@ -227,11 +219,13 @@ struct dma_async_tx_descriptor {
227 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 219 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
228 * @device_prep_slave_sg: prepares a slave dma operation 220 * @device_prep_slave_sg: prepares a slave dma operation
229 * @device_terminate_all: terminate all pending operations 221 * @device_terminate_all: terminate all pending operations
222 * @device_is_tx_complete: poll for transaction completion
230 * @device_issue_pending: push pending transactions to hardware 223 * @device_issue_pending: push pending transactions to hardware
231 */ 224 */
232struct dma_device { 225struct dma_device {
233 226
234 unsigned int chancnt; 227 unsigned int chancnt;
228 unsigned int privatecnt;
235 struct list_head channels; 229 struct list_head channels;
236 struct list_head global_node; 230 struct list_head global_node;
237 dma_cap_mask_t cap_mask; 231 dma_cap_mask_t cap_mask;
@@ -296,6 +290,24 @@ static inline void net_dmaengine_put(void)
296} 290}
297#endif 291#endif
298 292
293#ifdef CONFIG_ASYNC_TX_DMA
294#define async_dmaengine_get() dmaengine_get()
295#define async_dmaengine_put() dmaengine_put()
296#define async_dma_find_channel(type) dma_find_channel(type)
297#else
298static inline void async_dmaengine_get(void)
299{
300}
301static inline void async_dmaengine_put(void)
302{
303}
304static inline struct dma_chan *
305async_dma_find_channel(enum dma_transaction_type type)
306{
307 return NULL;
308}
309#endif
310
299dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, 311dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
300 void *dest, void *src, size_t len); 312 void *dest, void *src, size_t len);
301dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan, 313dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
@@ -342,6 +354,13 @@ __dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp)
342 set_bit(tx_type, dstp->bits); 354 set_bit(tx_type, dstp->bits);
343} 355}
344 356
357#define dma_cap_clear(tx, mask) __dma_cap_clear((tx), &(mask))
358static inline void
359__dma_cap_clear(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp)
360{
361 clear_bit(tx_type, dstp->bits);
362}
363
345#define dma_cap_zero(mask) __dma_cap_zero(&(mask)) 364#define dma_cap_zero(mask) __dma_cap_zero(&(mask))
346static inline void __dma_cap_zero(dma_cap_mask_t *dstp) 365static inline void __dma_cap_zero(dma_cap_mask_t *dstp)
347{ 366{
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index f28440784cf0..e397dc342cda 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -24,16 +24,17 @@
24#include <linux/acpi.h> 24#include <linux/acpi.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/msi.h> 26#include <linux/msi.h>
27#include <linux/irqreturn.h>
27 28
28#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
29struct intel_iommu; 29struct intel_iommu;
30 30#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
31struct dmar_drhd_unit { 31struct dmar_drhd_unit {
32 struct list_head list; /* list of drhd units */ 32 struct list_head list; /* list of drhd units */
33 struct acpi_dmar_header *hdr; /* ACPI header */ 33 struct acpi_dmar_header *hdr; /* ACPI header */
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,12 +45,20 @@ 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
50/* Intel IOMMU detection */ 59/* Intel IOMMU detection */
51extern void detect_intel_iommu(void); 60extern void detect_intel_iommu(void);
52 61extern int enable_drhd_fault_handling(void);
53 62
54extern int parse_ioapics_under_ir(void); 63extern int parse_ioapics_under_ir(void);
55extern int alloc_iommu(struct dmar_drhd_unit *); 64extern int alloc_iommu(struct dmar_drhd_unit *);
@@ -63,12 +72,12 @@ static inline int dmar_table_init(void)
63{ 72{
64 return -ENODEV; 73 return -ENODEV;
65} 74}
75static inline int enable_drhd_fault_handling(void)
76{
77 return -1;
78}
66#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */ 79#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */
67 80
68#ifdef CONFIG_INTR_REMAP
69extern int intr_remapping_enabled;
70extern int enable_intr_remapping(int);
71
72struct irte { 81struct irte {
73 union { 82 union {
74 struct { 83 struct {
@@ -97,6 +106,12 @@ struct irte {
97 __u64 high; 106 __u64 high;
98 }; 107 };
99}; 108};
109#ifdef CONFIG_INTR_REMAP
110extern int intr_remapping_enabled;
111extern int enable_intr_remapping(int);
112extern void disable_intr_remapping(void);
113extern int reenable_intr_remapping(int);
114
100extern int get_irte(int irq, struct irte *entry); 115extern int get_irte(int irq, struct irte *entry);
101extern int modify_irte(int irq, struct irte *irte_modified); 116extern int modify_irte(int irq, struct irte *irte_modified);
102extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count); 117extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
@@ -111,14 +126,40 @@ extern int irq_remapped(int irq);
111extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); 126extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
112extern struct intel_iommu *map_ioapic_to_ir(int apic); 127extern struct intel_iommu *map_ioapic_to_ir(int apic);
113#else 128#else
129static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
130{
131 return -1;
132}
133static inline int modify_irte(int irq, struct irte *irte_modified)
134{
135 return -1;
136}
137static inline int free_irte(int irq)
138{
139 return -1;
140}
141static inline int map_irq_to_irte_handle(int irq, u16 *sub_handle)
142{
143 return -1;
144}
145static inline int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
146 u16 sub_handle)
147{
148 return -1;
149}
150static inline struct intel_iommu *map_dev_to_ir(struct pci_dev *dev)
151{
152 return NULL;
153}
154static inline struct intel_iommu *map_ioapic_to_ir(int apic)
155{
156 return NULL;
157}
114#define irq_remapped(irq) (0) 158#define irq_remapped(irq) (0)
115#define enable_intr_remapping(mode) (-1) 159#define enable_intr_remapping(mode) (-1)
116#define intr_remapping_enabled (0) 160#define intr_remapping_enabled (0)
117#endif 161#endif
118 162
119#ifdef CONFIG_DMAR
120extern const char *dmar_get_fault_reason(u8 fault_reason);
121
122/* Can't use the common MSI interrupt functions 163/* Can't use the common MSI interrupt functions
123 * since DMAR is not a pci device 164 * since DMAR is not a pci device
124 */ 165 */
@@ -127,8 +168,10 @@ extern void dmar_msi_mask(unsigned int irq);
127extern void dmar_msi_read(int irq, struct msi_msg *msg); 168extern void dmar_msi_read(int irq, struct msi_msg *msg);
128extern void dmar_msi_write(int irq, struct msi_msg *msg); 169extern void dmar_msi_write(int irq, struct msi_msg *msg);
129extern int dmar_set_interrupt(struct intel_iommu *iommu); 170extern int dmar_set_interrupt(struct intel_iommu *iommu);
171extern irqreturn_t dmar_fault(int irq, void *dev_id);
130extern int arch_setup_dmar_msi(unsigned int irq); 172extern int arch_setup_dmar_msi(unsigned int irq);
131 173
174#ifdef CONFIG_DMAR
132extern int iommu_detected, no_iommu; 175extern int iommu_detected, no_iommu;
133extern struct list_head dmar_rmrr_units; 176extern struct list_head dmar_rmrr_units;
134struct dmar_rmrr_unit { 177struct dmar_rmrr_unit {
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index d741b9ceb0e0..bb5489c82c99 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -47,7 +47,8 @@ extern int dmi_get_year(int field);
47extern int dmi_name_in_vendors(const char *str); 47extern int dmi_name_in_vendors(const char *str);
48extern int dmi_name_in_serial(const char *str); 48extern int dmi_name_in_serial(const char *str);
49extern int dmi_available; 49extern int dmi_available;
50extern int dmi_walk(void (*decode)(const struct dmi_header *)); 50extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
51 void *private_data);
51extern bool dmi_match(enum dmi_field f, const char *str); 52extern bool dmi_match(enum dmi_field f, const char *str);
52 53
53#else 54#else
@@ -61,8 +62,8 @@ static inline int dmi_get_year(int year) { return 0; }
61static inline int dmi_name_in_vendors(const char *s) { return 0; } 62static inline int dmi_name_in_vendors(const char *s) { return 0; }
62static inline int dmi_name_in_serial(const char *s) { return 0; } 63static inline int dmi_name_in_serial(const char *s) { return 0; }
63#define dmi_available 0 64#define dmi_available 0
64static inline int dmi_walk(void (*decode)(const struct dmi_header *)) 65static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
65 { return -1; } 66 void *private_data) { return -1; }
66static inline bool dmi_match(enum dmi_field f, const char *str) 67static inline bool dmi_match(enum dmi_field f, const char *str)
67 { return false; } 68 { return false; }
68static inline const struct dmi_system_id * 69static inline const struct dmi_system_id *
diff --git a/include/linux/ds1wm.h b/include/linux/ds1wm.h
deleted file mode 100644
index d3c65e48a2e7..000000000000
--- a/include/linux/ds1wm.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/* platform data for the DS1WM driver */
2
3struct ds1wm_platform_data {
4 int bus_shift; /* number of shifts needed to calculate the
5 * offset between DS1WM registers;
6 * e.g. on h5xxx and h2200 this is 2
7 * (registers aligned to 4-byte boundaries),
8 * while on hx4700 this is 1 */
9 int active_high;
10 void (*enable)(struct platform_device *pdev);
11 void (*disable)(struct platform_device *pdev);
12};
diff --git a/include/linux/dst.h b/include/linux/dst.h
new file mode 100644
index 000000000000..e26fed84b1aa
--- /dev/null
+++ b/include/linux/dst.h
@@ -0,0 +1,587 @@
1/*
2 * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
3 * All rights reserved.
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 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __DST_H
17#define __DST_H
18
19#include <linux/types.h>
20#include <linux/connector.h>
21
22#define DST_NAMELEN 32
23#define DST_NAME "dst"
24
25enum {
26 /* Remove node with given id from storage */
27 DST_DEL_NODE = 0,
28 /* Add remote node with given id to the storage */
29 DST_ADD_REMOTE,
30 /* Add local node with given id to the storage to be exported and used by remote peers */
31 DST_ADD_EXPORT,
32 /* Crypto initialization command (hash/cipher used to protect the connection) */
33 DST_CRYPTO,
34 /* Security attributes for given connection (permissions for example) */
35 DST_SECURITY,
36 /* Register given node in the block layer subsystem */
37 DST_START,
38 DST_CMD_MAX
39};
40
41struct dst_ctl
42{
43 /* Storage name */
44 char name[DST_NAMELEN];
45 /* Command flags */
46 __u32 flags;
47 /* Command itself (see above) */
48 __u32 cmd;
49 /* Maximum number of pages per single request in this device */
50 __u32 max_pages;
51 /* Stale/error transaction scanning timeout in milliseconds */
52 __u32 trans_scan_timeout;
53 /* Maximum number of retry sends before completing transaction as broken */
54 __u32 trans_max_retries;
55 /* Storage size */
56 __u64 size;
57};
58
59/* Reply command carries completion status */
60struct dst_ctl_ack
61{
62 struct cn_msg msg;
63 int error;
64 int unused[3];
65};
66
67/*
68 * Unfortunaltely socket address structure is not exported to userspace
69 * and is redefined there.
70 */
71#define SADDR_MAX_DATA 128
72
73struct saddr {
74 /* address family, AF_xxx */
75 unsigned short sa_family;
76 /* 14 bytes of protocol address */
77 char sa_data[SADDR_MAX_DATA];
78 /* Number of bytes used in sa_data */
79 unsigned short sa_data_len;
80};
81
82/* Address structure */
83struct dst_network_ctl
84{
85 /* Socket type: datagram, stream...*/
86 unsigned int type;
87 /* Let me guess, is it a Jupiter diameter? */
88 unsigned int proto;
89 /* Peer's address */
90 struct saddr addr;
91};
92
93struct dst_crypto_ctl
94{
95 /* Cipher and hash names */
96 char cipher_algo[DST_NAMELEN];
97 char hash_algo[DST_NAMELEN];
98
99 /* Key sizes. Can be zero for digest for example */
100 unsigned int cipher_keysize, hash_keysize;
101 /* Alignment. Calculated by the DST itself. */
102 unsigned int crypto_attached_size;
103 /* Number of threads to perform crypto operations */
104 int thread_num;
105};
106
107/* Export security attributes have this bits checked in when client connects */
108#define DST_PERM_READ (1<<0)
109#define DST_PERM_WRITE (1<<1)
110
111/*
112 * Right now it is simple model, where each remote address
113 * is assigned to set of permissions it is allowed to perform.
114 * In real world block device does not know anything but
115 * reading and writing, so it should be more than enough.
116 */
117struct dst_secure_user
118{
119 unsigned int permissions;
120 struct saddr addr;
121};
122
123/*
124 * Export control command: device to export and network address to accept
125 * clients to work with given device
126 */
127struct dst_export_ctl
128{
129 char device[DST_NAMELEN];
130 struct dst_network_ctl ctl;
131};
132
133enum {
134 DST_CFG = 1, /* Request remote configuration */
135 DST_IO, /* IO command */
136 DST_IO_RESPONSE, /* IO response */
137 DST_PING, /* Keepalive message */
138 DST_NCMD_MAX,
139};
140
141struct dst_cmd
142{
143 /* Network command itself, see above */
144 __u32 cmd;
145 /*
146 * Size of the attached data
147 * (in most cases, for READ command it means how many bytes were requested)
148 */
149 __u32 size;
150 /* Crypto size: number of attached bytes with digest/hmac */
151 __u32 csize;
152 /* Here we can carry secret data */
153 __u32 reserved;
154 /* Read/write bits, see how they are encoded in bio structure */
155 __u64 rw;
156 /* BIO flags */
157 __u64 flags;
158 /* Unique command id (like transaction ID) */
159 __u64 id;
160 /* Sector to start IO from */
161 __u64 sector;
162 /* Hash data is placed after this header */
163 __u8 hash[0];
164};
165
166/*
167 * Convert command to/from network byte order.
168 * We do not use hton*() functions, since there is
169 * no 64-bit implementation.
170 */
171static inline void dst_convert_cmd(struct dst_cmd *c)
172{
173 c->cmd = __cpu_to_be32(c->cmd);
174 c->csize = __cpu_to_be32(c->csize);
175 c->size = __cpu_to_be32(c->size);
176 c->sector = __cpu_to_be64(c->sector);
177 c->id = __cpu_to_be64(c->id);
178 c->flags = __cpu_to_be64(c->flags);
179 c->rw = __cpu_to_be64(c->rw);
180}
181
182/* Transaction id */
183typedef __u64 dst_gen_t;
184
185#ifdef __KERNEL__
186
187#include <linux/blkdev.h>
188#include <linux/bio.h>
189#include <linux/device.h>
190#include <linux/mempool.h>
191#include <linux/net.h>
192#include <linux/poll.h>
193#include <linux/rbtree.h>
194
195#ifdef CONFIG_DST_DEBUG
196#define dprintk(f, a...) printk(KERN_NOTICE f, ##a)
197#else
198static inline void __attribute__ ((format (printf, 1, 2)))
199 dprintk(const char *fmt, ...) {}
200#endif
201
202struct dst_node;
203
204struct dst_trans
205{
206 /* DST node we are working with */
207 struct dst_node *n;
208
209 /* Entry inside transaction tree */
210 struct rb_node trans_entry;
211
212 /* Merlin kills this transaction when this memory cell equals zero */
213 atomic_t refcnt;
214
215 /* How this transaction should be processed by crypto engine */
216 short enc;
217 /* How many times this transaction was resent */
218 short retries;
219 /* Completion status */
220 int error;
221
222 /* When did we send it to the remote peer */
223 long send_time;
224
225 /* My name is...
226 * Well, computers does not speak, they have unique id instead */
227 dst_gen_t gen;
228
229 /* Block IO we are working with */
230 struct bio *bio;
231
232 /* Network command for above block IO request */
233 struct dst_cmd cmd;
234};
235
236struct dst_crypto_engine
237{
238 /* What should we do with all block requests */
239 struct crypto_hash *hash;
240 struct crypto_ablkcipher *cipher;
241
242 /* Pool of pages used to encrypt data into before sending */
243 int page_num;
244 struct page **pages;
245
246 /* What to do with current request */
247 int enc;
248 /* Who we are and where do we go */
249 struct scatterlist *src, *dst;
250
251 /* Maximum timeout waiting for encryption to be completed */
252 long timeout;
253 /* IV is a 64-bit sequential counter */
254 u64 iv;
255
256 /* Secret data */
257 void *private;
258
259 /* Cached temporary data lives here */
260 int size;
261 void *data;
262};
263
264struct dst_state
265{
266 /* The main state protection */
267 struct mutex state_lock;
268
269 /* Polling machinery for sockets */
270 wait_queue_t wait;
271 wait_queue_head_t *whead;
272 /* Most of events are being waited here */
273 wait_queue_head_t thread_wait;
274
275 /* Who owns this? */
276 struct dst_node *node;
277
278 /* Network address for this state */
279 struct dst_network_ctl ctl;
280
281 /* Permissions to work with: read-only or rw connection */
282 u32 permissions;
283
284 /* Called when we need to clean private data */
285 void (* cleanup)(struct dst_state *st);
286
287 /* Used by the server: BIO completion queues BIOs here */
288 struct list_head request_list;
289 spinlock_t request_lock;
290
291 /* Guess what? No, it is not number of planets */
292 atomic_t refcnt;
293
294 /* This flags is set when connection should be dropped */
295 int need_exit;
296
297 /*
298 * Socket to work with. Second pointer is used for
299 * lockless check if socket was changed before performing
300 * next action (like working with cached polling result)
301 */
302 struct socket *socket, *read_socket;
303
304 /* Cached preallocated data */
305 void *data;
306 unsigned int size;
307
308 /* Currently processed command */
309 struct dst_cmd cmd;
310};
311
312struct dst_info
313{
314 /* Device size */
315 u64 size;
316
317 /* Local device name for export devices */
318 char local[DST_NAMELEN];
319
320 /* Network setup */
321 struct dst_network_ctl net;
322
323 /* Sysfs bits use this */
324 struct device device;
325};
326
327struct dst_node
328{
329 struct list_head node_entry;
330
331 /* Hi, my name is stored here */
332 char name[DST_NAMELEN];
333 /* My cache name is stored here */
334 char cache_name[DST_NAMELEN];
335
336 /* Block device attached to given node.
337 * Only valid for exporting nodes */
338 struct block_device *bdev;
339 /* Network state machine for given peer */
340 struct dst_state *state;
341
342 /* Block IO machinery */
343 struct request_queue *queue;
344 struct gendisk *disk;
345
346 /* Number of threads in processing pool */
347 int thread_num;
348 /* Maximum number of pages in single IO */
349 int max_pages;
350
351 /* I'm that big in bytes */
352 loff_t size;
353
354 /* Exported to userspace node information */
355 struct dst_info *info;
356
357 /*
358 * Security attribute list.
359 * Used only by exporting node currently.
360 */
361 struct list_head security_list;
362 struct mutex security_lock;
363
364 /*
365 * When this unerflows below zero, university collapses.
366 * But this will not happen, since node will be freed,
367 * when reference counter reaches zero.
368 */
369 atomic_t refcnt;
370
371 /* How precisely should I be started? */
372 int (*start)(struct dst_node *);
373
374 /* Crypto capabilities */
375 struct dst_crypto_ctl crypto;
376 u8 *hash_key;
377 u8 *cipher_key;
378
379 /* Pool of processing thread */
380 struct thread_pool *pool;
381
382 /* Transaction IDs live here */
383 atomic_long_t gen;
384
385 /*
386 * How frequently and how many times transaction
387 * tree should be scanned to drop stale objects.
388 */
389 long trans_scan_timeout;
390 int trans_max_retries;
391
392 /* Small gnomes live here */
393 struct rb_root trans_root;
394 struct mutex trans_lock;
395
396 /*
397 * Transaction cache/memory pool.
398 * It is big enough to contain not only transaction
399 * itself, but additional crypto data (digest/hmac).
400 */
401 struct kmem_cache *trans_cache;
402 mempool_t *trans_pool;
403
404 /* This entity scans transaction tree */
405 struct delayed_work trans_work;
406
407 wait_queue_head_t wait;
408};
409
410/* Kernel representation of the security attribute */
411struct dst_secure
412{
413 struct list_head sec_entry;
414 struct dst_secure_user sec;
415};
416
417int dst_process_bio(struct dst_node *n, struct bio *bio);
418
419int dst_node_init_connected(struct dst_node *n, struct dst_network_ctl *r);
420int dst_node_init_listened(struct dst_node *n, struct dst_export_ctl *le);
421
422static inline struct dst_state *dst_state_get(struct dst_state *st)
423{
424 BUG_ON(atomic_read(&st->refcnt) == 0);
425 atomic_inc(&st->refcnt);
426 return st;
427}
428
429void dst_state_put(struct dst_state *st);
430
431struct dst_state *dst_state_alloc(struct dst_node *n);
432int dst_state_socket_create(struct dst_state *st);
433void dst_state_socket_release(struct dst_state *st);
434
435void dst_state_exit_connected(struct dst_state *st);
436
437int dst_state_schedule_receiver(struct dst_state *st);
438
439void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str);
440
441static inline void dst_state_lock(struct dst_state *st)
442{
443 mutex_lock(&st->state_lock);
444}
445
446static inline void dst_state_unlock(struct dst_state *st)
447{
448 mutex_unlock(&st->state_lock);
449}
450
451void dst_poll_exit(struct dst_state *st);
452int dst_poll_init(struct dst_state *st);
453
454static inline unsigned int dst_state_poll(struct dst_state *st)
455{
456 unsigned int revents = POLLHUP | POLLERR;
457
458 dst_state_lock(st);
459 if (st->socket)
460 revents = st->socket->ops->poll(NULL, st->socket, NULL);
461 dst_state_unlock(st);
462
463 return revents;
464}
465
466static inline int dst_thread_setup(void *private, void *data)
467{
468 return 0;
469}
470
471void dst_node_put(struct dst_node *n);
472
473static inline struct dst_node *dst_node_get(struct dst_node *n)
474{
475 atomic_inc(&n->refcnt);
476 return n;
477}
478
479int dst_data_recv(struct dst_state *st, void *data, unsigned int size);
480int dst_recv_cdata(struct dst_state *st, void *cdata);
481int dst_data_send_header(struct socket *sock,
482 void *data, unsigned int size, int more);
483
484int dst_send_bio(struct dst_state *st, struct dst_cmd *cmd, struct bio *bio);
485
486int dst_process_io(struct dst_state *st);
487int dst_export_crypto(struct dst_node *n, struct bio *bio);
488int dst_export_send_bio(struct bio *bio);
489int dst_start_export(struct dst_node *n);
490
491int __init dst_export_init(void);
492void dst_export_exit(void);
493
494/* Private structure for export block IO requests */
495struct dst_export_priv
496{
497 struct list_head request_entry;
498 struct dst_state *state;
499 struct bio *bio;
500 struct dst_cmd cmd;
501};
502
503static inline void dst_trans_get(struct dst_trans *t)
504{
505 atomic_inc(&t->refcnt);
506}
507
508struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen);
509int dst_trans_remove(struct dst_trans *t);
510int dst_trans_remove_nolock(struct dst_trans *t);
511void dst_trans_put(struct dst_trans *t);
512
513/*
514 * Convert bio into network command.
515 */
516static inline void dst_bio_to_cmd(struct bio *bio, struct dst_cmd *cmd,
517 u32 command, u64 id)
518{
519 cmd->cmd = command;
520 cmd->flags = (bio->bi_flags << BIO_POOL_BITS) >> BIO_POOL_BITS;
521 cmd->rw = bio->bi_rw;
522 cmd->size = bio->bi_size;
523 cmd->csize = 0;
524 cmd->id = id;
525 cmd->sector = bio->bi_sector;
526};
527
528int dst_trans_send(struct dst_trans *t);
529int dst_trans_crypto(struct dst_trans *t);
530
531int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl);
532void dst_node_crypto_exit(struct dst_node *n);
533
534static inline int dst_need_crypto(struct dst_node *n)
535{
536 struct dst_crypto_ctl *c = &n->crypto;
537 /*
538 * Logical OR is appropriate here, but boolean one produces
539 * more optimal code, so it is used instead.
540 */
541 return (c->hash_algo[0] | c->cipher_algo[0]);
542}
543
544int dst_node_trans_init(struct dst_node *n, unsigned int size);
545void dst_node_trans_exit(struct dst_node *n);
546
547/*
548 * Pool of threads.
549 * Ready list contains threads currently free to be used,
550 * active one contains threads with some work scheduled for them.
551 * Caller can wait in given queue when thread is ready.
552 */
553struct thread_pool
554{
555 int thread_num;
556 struct mutex thread_lock;
557 struct list_head ready_list, active_list;
558
559 wait_queue_head_t wait;
560};
561
562void thread_pool_del_worker(struct thread_pool *p);
563void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id);
564int thread_pool_add_worker(struct thread_pool *p,
565 char *name,
566 unsigned int id,
567 void *(* init)(void *data),
568 void (* cleanup)(void *data),
569 void *data);
570
571void thread_pool_destroy(struct thread_pool *p);
572struct thread_pool *thread_pool_create(int num, char *name,
573 void *(* init)(void *data),
574 void (* cleanup)(void *data),
575 void *data);
576
577int thread_pool_schedule(struct thread_pool *p,
578 int (* setup)(void *stored_private, void *setup_data),
579 int (* action)(void *stored_private, void *setup_data),
580 void *setup_data, long timeout);
581int thread_pool_schedule_private(struct thread_pool *p,
582 int (* setup)(void *private, void *data),
583 int (* action)(void *private, void *data),
584 void *data, long timeout, void *id);
585
586#endif /* __KERNEL__ */
587#endif /* __DST_H */
diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h
index bb0df2aaebfa..fec66bd24f22 100644
--- a/include/linux/dvb/audio.h
+++ b/include/linux/dvb/audio.h
@@ -76,7 +76,7 @@ struct audio_karaoke{ /* if Vocal1 or Vocal2 are non-zero, they get mixed */
76} audio_karaoke_t; /* into left and right */ 76} audio_karaoke_t; /* into left and right */
77 77
78 78
79typedef uint16_t audio_attributes_t; 79typedef __u16 audio_attributes_t;
80/* bits: descr. */ 80/* bits: descr. */
81/* 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */ 81/* 15-13 audio coding mode (0=ac3, 2=mpeg1, 3=mpeg2ext, 4=LPCM, 6=DTS, */
82/* 12 multichannel extension */ 82/* 12 multichannel extension */
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index bd49c3ebf916..1d750c0fd86e 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -132,12 +132,12 @@ struct video_command {
132#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3) 132#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3)
133 133
134struct video_event { 134struct video_event {
135 int32_t type; 135 __s32 type;
136#define VIDEO_EVENT_SIZE_CHANGED 1 136#define VIDEO_EVENT_SIZE_CHANGED 1
137#define VIDEO_EVENT_FRAME_RATE_CHANGED 2 137#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
138#define VIDEO_EVENT_DECODER_STOPPED 3 138#define VIDEO_EVENT_DECODER_STOPPED 3
139#define VIDEO_EVENT_VSYNC 4 139#define VIDEO_EVENT_VSYNC 4
140 time_t timestamp; 140 __kernel_time_t timestamp;
141 union { 141 union {
142 video_size_t size; 142 video_size_t size;
143 unsigned int frame_rate; /* in frames per 1000sec */ 143 unsigned int frame_rate; /* in frames per 1000sec */
@@ -157,25 +157,25 @@ struct video_status {
157 157
158struct video_still_picture { 158struct video_still_picture {
159 char __user *iFrame; /* pointer to a single iframe in memory */ 159 char __user *iFrame; /* pointer to a single iframe in memory */
160 int32_t size; 160 __s32 size;
161}; 161};
162 162
163 163
164typedef 164typedef
165struct video_highlight { 165struct video_highlight {
166 int active; /* 1=show highlight, 0=hide highlight */ 166 int active; /* 1=show highlight, 0=hide highlight */
167 uint8_t contrast1; /* 7- 4 Pattern pixel contrast */ 167 __u8 contrast1; /* 7- 4 Pattern pixel contrast */
168 /* 3- 0 Background pixel contrast */ 168 /* 3- 0 Background pixel contrast */
169 uint8_t contrast2; /* 7- 4 Emphasis pixel-2 contrast */ 169 __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */
170 /* 3- 0 Emphasis pixel-1 contrast */ 170 /* 3- 0 Emphasis pixel-1 contrast */
171 uint8_t color1; /* 7- 4 Pattern pixel color */ 171 __u8 color1; /* 7- 4 Pattern pixel color */
172 /* 3- 0 Background pixel color */ 172 /* 3- 0 Background pixel color */
173 uint8_t color2; /* 7- 4 Emphasis pixel-2 color */ 173 __u8 color2; /* 7- 4 Emphasis pixel-2 color */
174 /* 3- 0 Emphasis pixel-1 color */ 174 /* 3- 0 Emphasis pixel-1 color */
175 uint32_t ypos; /* 23-22 auto action mode */ 175 __u32 ypos; /* 23-22 auto action mode */
176 /* 21-12 start y */ 176 /* 21-12 start y */
177 /* 9- 0 end y */ 177 /* 9- 0 end y */
178 uint32_t xpos; /* 23-22 button color number */ 178 __u32 xpos; /* 23-22 button color number */
179 /* 21-12 start x */ 179 /* 21-12 start x */
180 /* 9- 0 end x */ 180 /* 9- 0 end x */
181} video_highlight_t; 181} video_highlight_t;
@@ -189,17 +189,17 @@ typedef struct video_spu {
189 189
190typedef struct video_spu_palette { /* SPU Palette information */ 190typedef struct video_spu_palette { /* SPU Palette information */
191 int length; 191 int length;
192 uint8_t __user *palette; 192 __u8 __user *palette;
193} video_spu_palette_t; 193} video_spu_palette_t;
194 194
195 195
196typedef struct video_navi_pack { 196typedef struct video_navi_pack {
197 int length; /* 0 ... 1024 */ 197 int length; /* 0 ... 1024 */
198 uint8_t data[1024]; 198 __u8 data[1024];
199} video_navi_pack_t; 199} video_navi_pack_t;
200 200
201 201
202typedef uint16_t video_attributes_t; 202typedef __u16 video_attributes_t;
203/* bits: descr. */ 203/* bits: descr. */
204/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */ 204/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
205/* 13-12 TV system (0=525/60, 1=625/50) */ 205/* 13-12 TV system (0=525/60, 1=625/50) */
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index d797dde247f7..c8aad713a046 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -74,4 +74,23 @@ struct dw_dma_slave {
74#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */ 74#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */
75#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */ 75#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */
76 76
77/* DMA API extensions */
78struct dw_cyclic_desc {
79 struct dw_desc **desc;
80 unsigned long periods;
81 void (*period_callback)(void *param);
82 void *period_callback_param;
83};
84
85struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
86 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
87 enum dma_data_direction direction);
88void dw_dma_cyclic_free(struct dma_chan *chan);
89int dw_dma_cyclic_start(struct dma_chan *chan);
90void dw_dma_cyclic_stop(struct dma_chan *chan);
91
92dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan);
93
94dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan);
95
77#endif /* DW_DMAC_H */ 96#endif /* DW_DMAC_H */
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
new file mode 100644
index 000000000000..a0d9422a1569
--- /dev/null
+++ b/include/linux/dynamic_debug.h
@@ -0,0 +1,88 @@
1#ifndef _DYNAMIC_DEBUG_H
2#define _DYNAMIC_DEBUG_H
3
4/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
5 * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
6 * use independent hash functions, to reduce the chance of false positives.
7 */
8extern long long dynamic_debug_enabled;
9extern long long dynamic_debug_enabled2;
10
11/*
12 * An instance of this structure is created in a special
13 * ELF section at every dynamic debug callsite. At runtime,
14 * the special section is treated as an array of these.
15 */
16struct _ddebug {
17 /*
18 * These fields are used to drive the user interface
19 * for selecting and displaying debug callsites.
20 */
21 const char *modname;
22 const char *function;
23 const char *filename;
24 const char *format;
25 char primary_hash;
26 char secondary_hash;
27 unsigned int lineno:24;
28 /*
29 * The flags field controls the behaviour at the callsite.
30 * The bits here are changed dynamically when the user
31 * writes commands to <debugfs>/dynamic_debug/ddebug
32 */
33#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
34#define _DPRINTK_FLAGS_DEFAULT 0
35 unsigned int flags:8;
36} __attribute__((aligned(8)));
37
38
39int ddebug_add_module(struct _ddebug *tab, unsigned int n,
40 const char *modname);
41
42#if defined(CONFIG_DYNAMIC_DEBUG)
43extern int ddebug_remove_module(char *mod_name);
44
45#define __dynamic_dbg_enabled(dd) ({ \
46 int __ret = 0; \
47 if (unlikely((dynamic_debug_enabled & (1LL << DEBUG_HASH)) && \
48 (dynamic_debug_enabled2 & (1LL << DEBUG_HASH2)))) \
49 if (unlikely(dd.flags)) \
50 __ret = 1; \
51 __ret; })
52
53#define dynamic_pr_debug(fmt, ...) do { \
54 static struct _ddebug descriptor \
55 __used \
56 __attribute__((section("__verbose"), aligned(8))) = \
57 { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
58 DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
59 if (__dynamic_dbg_enabled(descriptor)) \
60 printk(KERN_DEBUG KBUILD_MODNAME ":" pr_fmt(fmt), \
61 ##__VA_ARGS__); \
62 } while (0)
63
64
65#define dynamic_dev_dbg(dev, fmt, ...) do { \
66 static struct _ddebug descriptor \
67 __used \
68 __attribute__((section("__verbose"), aligned(8))) = \
69 { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
70 DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
71 if (__dynamic_dbg_enabled(descriptor)) \
72 dev_printk(KERN_DEBUG, dev, \
73 KBUILD_MODNAME ": " fmt, \
74 ##__VA_ARGS__); \
75 } while (0)
76
77#else
78
79static inline int ddebug_remove_module(char *mod)
80{
81 return 0;
82}
83
84#define dynamic_pr_debug(fmt, ...) do { } while (0)
85#define dynamic_dev_dbg(dev, format, ...) do { } while (0)
86#endif
87
88#endif
diff --git a/include/linux/dynamic_printk.h b/include/linux/dynamic_printk.h
deleted file mode 100644
index 2d528d009074..000000000000
--- a/include/linux/dynamic_printk.h
+++ /dev/null
@@ -1,93 +0,0 @@
1#ifndef _DYNAMIC_PRINTK_H
2#define _DYNAMIC_PRINTK_H
3
4#define DYNAMIC_DEBUG_HASH_BITS 6
5#define DEBUG_HASH_TABLE_SIZE (1 << DYNAMIC_DEBUG_HASH_BITS)
6
7#define TYPE_BOOLEAN 1
8
9#define DYNAMIC_ENABLED_ALL 0
10#define DYNAMIC_ENABLED_NONE 1
11#define DYNAMIC_ENABLED_SOME 2
12
13extern int dynamic_enabled;
14
15/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
16 * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
17 * use independent hash functions, to reduce the chance of false positives.
18 */
19extern long long dynamic_printk_enabled;
20extern long long dynamic_printk_enabled2;
21
22struct mod_debug {
23 char *modname;
24 char *logical_modname;
25 char *flag_names;
26 int type;
27 int hash;
28 int hash2;
29} __attribute__((aligned(8)));
30
31int register_dynamic_debug_module(char *mod_name, int type, char *share_name,
32 char *flags, int hash, int hash2);
33
34#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
35extern int unregister_dynamic_debug_module(char *mod_name);
36extern int __dynamic_dbg_enabled_helper(char *modname, int type,
37 int value, int hash);
38
39#define __dynamic_dbg_enabled(module, type, value, level, hash) ({ \
40 int __ret = 0; \
41 if (unlikely((dynamic_printk_enabled & (1LL << DEBUG_HASH)) && \
42 (dynamic_printk_enabled2 & (1LL << DEBUG_HASH2)))) \
43 __ret = __dynamic_dbg_enabled_helper(module, type, \
44 value, hash);\
45 __ret; })
46
47#define dynamic_pr_debug(fmt, ...) do { \
48 static char mod_name[] \
49 __attribute__((section("__verbose_strings"))) \
50 = KBUILD_MODNAME; \
51 static struct mod_debug descriptor \
52 __used \
53 __attribute__((section("__verbose"), aligned(8))) = \
54 { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\
55 if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \
56 0, 0, DEBUG_HASH)) \
57 printk(KERN_DEBUG KBUILD_MODNAME ":" fmt, \
58 ##__VA_ARGS__); \
59 } while (0)
60
61#define dynamic_dev_dbg(dev, format, ...) do { \
62 static char mod_name[] \
63 __attribute__((section("__verbose_strings"))) \
64 = KBUILD_MODNAME; \
65 static struct mod_debug descriptor \
66 __used \
67 __attribute__((section("__verbose"), aligned(8))) = \
68 { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\
69 if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \
70 0, 0, DEBUG_HASH)) \
71 dev_printk(KERN_DEBUG, dev, \
72 KBUILD_MODNAME ": " format, \
73 ##__VA_ARGS__); \
74 } while (0)
75
76#else
77
78static inline int unregister_dynamic_debug_module(const char *mod_name)
79{
80 return 0;
81}
82static inline int __dynamic_dbg_enabled_helper(char *modname, int type,
83 int value, int hash)
84{
85 return 0;
86}
87
88#define __dynamic_dbg_enabled(module, type, value, level, hash) ({ 0; })
89#define dynamic_pr_debug(fmt, ...) do { } while (0)
90#define dynamic_dev_dbg(dev, format, ...) do { } while (0)
91#endif
92
93#endif
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/elfcore.h b/include/linux/elfcore.h
index 5ca54d77079f..7605c5e9589f 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -111,6 +111,15 @@ static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *re
111#endif 111#endif
112} 112}
113 113
114static inline void elf_core_copy_kernel_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
115{
116#ifdef ELF_CORE_COPY_KERNEL_REGS
117 ELF_CORE_COPY_KERNEL_REGS((*elfregs), regs);
118#else
119 elf_core_copy_regs(elfregs, regs);
120#endif
121}
122
114static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) 123static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs)
115{ 124{
116#ifdef ELF_CORE_COPY_TASK_REGS 125#ifdef ELF_CORE_COPY_TASK_REGS
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h
index ceb1454b6977..ec12cc74366f 100644
--- a/include/linux/errqueue.h
+++ b/include/linux/errqueue.h
@@ -18,6 +18,7 @@ struct sock_extended_err
18#define SO_EE_ORIGIN_LOCAL 1 18#define SO_EE_ORIGIN_LOCAL 1
19#define SO_EE_ORIGIN_ICMP 2 19#define SO_EE_ORIGIN_ICMP 2
20#define SO_EE_ORIGIN_ICMP6 3 20#define SO_EE_ORIGIN_ICMP6 3
21#define SO_EE_ORIGIN_TIMESTAMPING 4
21 22
22#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) 23#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
23 24
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 1cb0f0b90926..a1f17abba7dc 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -184,4 +184,25 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
184} 184}
185#endif /* __KERNEL__ */ 185#endif /* __KERNEL__ */
186 186
187/**
188 * compare_ether_header - Compare two Ethernet headers
189 * @a: Pointer to Ethernet header
190 * @b: Pointer to Ethernet header
191 *
192 * Compare two ethernet headers, returns 0 if equal.
193 * This assumes that the network header (i.e., IP header) is 4-byte
194 * aligned OR the platform can handle unaligned access. This is the
195 * case for all packets coming into netif_receive_skb or similar
196 * entry points.
197 */
198
199static inline int compare_ether_header(const void *a, const void *b)
200{
201 u32 *a32 = (u32 *)((u8 *)a + 2);
202 u32 *b32 = (u32 *)((u8 *)b + 2);
203
204 return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) |
205 (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]);
206}
207
187#endif /* _LINUX_ETHERDEVICE_H */ 208#endif /* _LINUX_ETHERDEVICE_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 27c67a542235..131b127b70f8 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -7,6 +7,7 @@
7 * Portions Copyright 2002 Intel (eli.kupermann@intel.com, 7 * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
8 * christopher.leech@intel.com, 8 * christopher.leech@intel.com,
9 * scott.feldman@intel.com) 9 * scott.feldman@intel.com)
10 * Portions Copyright (C) Sun Microsystems 2008
10 */ 11 */
11 12
12#ifndef _LINUX_ETHTOOL_H 13#ifndef _LINUX_ETHTOOL_H
@@ -287,10 +288,75 @@ enum ethtool_flags {
287 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ 288 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
288}; 289};
289 290
290struct ethtool_rxnfc { 291/* The following structures are for supporting RX network flow
291 __u32 cmd; 292 * classification configuration. Note, all multibyte fields, e.g.,
293 * ip4src, ip4dst, psrc, pdst, spi, etc. are expected to be in network
294 * byte order.
295 */
296struct ethtool_tcpip4_spec {
297 __be32 ip4src;
298 __be32 ip4dst;
299 __be16 psrc;
300 __be16 pdst;
301 __u8 tos;
302};
303
304struct ethtool_ah_espip4_spec {
305 __be32 ip4src;
306 __be32 ip4dst;
307 __be32 spi;
308 __u8 tos;
309};
310
311struct ethtool_rawip4_spec {
312 __be32 ip4src;
313 __be32 ip4dst;
314 __u8 hdata[64];
315};
316
317struct ethtool_ether_spec {
318 __be16 ether_type;
319 __u8 frame_size;
320 __u8 eframe[16];
321};
322
323#define ETH_RX_NFC_IP4 1
324#define ETH_RX_NFC_IP6 2
325
326struct ethtool_usrip4_spec {
327 __be32 ip4src;
328 __be32 ip4dst;
329 __be32 l4_4_bytes;
330 __u8 tos;
331 __u8 ip_ver;
332 __u8 proto;
333};
334
335struct ethtool_rx_flow_spec {
292 __u32 flow_type; 336 __u32 flow_type;
293 __u64 data; 337 union {
338 struct ethtool_tcpip4_spec tcp_ip4_spec;
339 struct ethtool_tcpip4_spec udp_ip4_spec;
340 struct ethtool_tcpip4_spec sctp_ip4_spec;
341 struct ethtool_ah_espip4_spec ah_ip4_spec;
342 struct ethtool_ah_espip4_spec esp_ip4_spec;
343 struct ethtool_rawip4_spec raw_ip4_spec;
344 struct ethtool_ether_spec ether_spec;
345 struct ethtool_usrip4_spec usr_ip4_spec;
346 __u8 hdata[64];
347 } h_u, m_u; /* entry, mask */
348 __u64 ring_cookie;
349 __u32 location;
350};
351
352struct ethtool_rxnfc {
353 __u32 cmd;
354 __u32 flow_type;
355 /* The rx flow hash value or the rule DB size */
356 __u64 data;
357 struct ethtool_rx_flow_spec fs;
358 __u32 rule_cnt;
359 __u32 rule_locs[0];
294}; 360};
295 361
296#ifdef __KERNEL__ 362#ifdef __KERNEL__
@@ -417,8 +483,8 @@ struct ethtool_ops {
417 /* the following hooks are obsolete */ 483 /* the following hooks are obsolete */
418 int (*self_test_count)(struct net_device *);/* use get_sset_count */ 484 int (*self_test_count)(struct net_device *);/* use get_sset_count */
419 int (*get_stats_count)(struct net_device *);/* use get_sset_count */ 485 int (*get_stats_count)(struct net_device *);/* use get_sset_count */
420 int (*get_rxhash)(struct net_device *, struct ethtool_rxnfc *); 486 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *);
421 int (*set_rxhash)(struct net_device *, struct ethtool_rxnfc *); 487 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
422}; 488};
423#endif /* __KERNEL__ */ 489#endif /* __KERNEL__ */
424 490
@@ -469,6 +535,12 @@ struct ethtool_ops {
469#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 535#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
470#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ 536#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
471#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ 537#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
538#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
539#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
540#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
541#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
542#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
543#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
472 544
473/* compatibility with older code */ 545/* compatibility with older code */
474#define SPARC_ETH_GSET ETHTOOL_GSET 546#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -565,9 +637,13 @@ struct ethtool_ops {
565#define UDP_V6_FLOW 0x06 637#define UDP_V6_FLOW 0x06
566#define SCTP_V6_FLOW 0x07 638#define SCTP_V6_FLOW 0x07
567#define AH_ESP_V6_FLOW 0x08 639#define AH_ESP_V6_FLOW 0x08
640#define AH_V4_FLOW 0x09
641#define ESP_V4_FLOW 0x0a
642#define AH_V6_FLOW 0x0b
643#define ESP_V6_FLOW 0x0c
644#define IP_USER_FLOW 0x0d
568 645
569/* L3-L4 network traffic flow hash options */ 646/* L3-L4 network traffic flow hash options */
570#define RXH_DEV_PORT (1 << 0)
571#define RXH_L2DA (1 << 1) 647#define RXH_L2DA (1 << 1)
572#define RXH_VLAN (1 << 2) 648#define RXH_VLAN (1 << 2)
573#define RXH_L3_PROTO (1 << 3) 649#define RXH_L3_PROTO (1 << 3)
@@ -577,5 +653,6 @@ struct ethtool_ops {
577#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ 653#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
578#define RXH_DISCARD (1 << 31) 654#define RXH_DISCARD (1 << 31)
579 655
656#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
580 657
581#endif /* _LINUX_ETHTOOL_H */ 658#endif /* _LINUX_ETHTOOL_H */
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index a667637b54e3..f45a8ae5f828 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -13,10 +13,20 @@
13/* For O_CLOEXEC and O_NONBLOCK */ 13/* For O_CLOEXEC and O_NONBLOCK */
14#include <linux/fcntl.h> 14#include <linux/fcntl.h>
15 15
16/* Flags for eventfd2. */ 16/*
17 * CAREFUL: Check include/asm-generic/fcntl.h when defining
18 * new flags, since they might collide with O_* ones. We want
19 * to re-use O_* flags that couldn't possibly have a meaning
20 * from eventfd, in order to leave a free define-space for
21 * shared O_* flags.
22 */
23#define EFD_SEMAPHORE (1 << 0)
17#define EFD_CLOEXEC O_CLOEXEC 24#define EFD_CLOEXEC O_CLOEXEC
18#define EFD_NONBLOCK O_NONBLOCK 25#define EFD_NONBLOCK O_NONBLOCK
19 26
27#define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
28#define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE)
29
20struct file *eventfd_fget(int fd); 30struct file *eventfd_fget(int fd);
21int eventfd_signal(struct file *file, int n); 31int eventfd_signal(struct file *file, int n);
22 32
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index f1e1d3c47125..f6856a5a1d4b 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -61,7 +61,6 @@ struct file;
61static inline void eventpoll_init_file(struct file *file) 61static inline void eventpoll_init_file(struct file *file)
62{ 62{
63 INIT_LIST_HEAD(&file->f_ep_links); 63 INIT_LIST_HEAD(&file->f_ep_links);
64 spin_lock_init(&file->f_ep_lock);
65} 64}
66 65
67 66
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index dd495b8c3091..634a5e5aba3e 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -208,6 +208,7 @@ static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags)
208#define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */ 208#define EXT3_STATE_JDATA 0x00000001 /* journaled data exists */
209#define EXT3_STATE_NEW 0x00000002 /* inode is newly created */ 209#define EXT3_STATE_NEW 0x00000002 /* inode is newly created */
210#define EXT3_STATE_XATTR 0x00000004 /* has in-inode xattrs */ 210#define EXT3_STATE_XATTR 0x00000004 /* has in-inode xattrs */
211#define EXT3_STATE_FLUSH_ON_CLOSE 0x00000008
211 212
212/* Used to pass group descriptor data when online resize is done */ 213/* Used to pass group descriptor data when online resize is done */
213struct ext3_new_group_input { 214struct ext3_new_group_input {
@@ -893,9 +894,8 @@ extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
893 u64 start, u64 len); 894 u64 start, u64 len);
894 895
895/* ioctl.c */ 896/* ioctl.c */
896extern int ext3_ioctl (struct inode *, struct file *, unsigned int, 897extern long ext3_ioctl(struct file *, unsigned int, unsigned long);
897 unsigned long); 898extern long ext3_compat_ioctl(struct file *, unsigned int, unsigned long);
898extern long ext3_compat_ioctl (struct file *, unsigned int, unsigned long);
899 899
900/* namei.c */ 900/* namei.c */
901extern int ext3_orphan_add(handle_t *, struct inode *); 901extern int ext3_orphan_add(handle_t *, struct inode *);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 31527e17076b..330c4b1bfcaa 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -123,6 +123,7 @@ struct dentry;
123#define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */ 123#define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */
124#define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */ 124#define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */
125#define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */ 125#define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */
126#define FB_ACCEL_CIRRUS_ALPINE 53 /* Cirrus Logic 543x/544x/5480 */
126#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */ 127#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */
127#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */ 128#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */
128#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */ 129#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */
@@ -172,8 +173,12 @@ struct fb_fix_screeninfo {
172/* 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,
173 * 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
174 * 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
175 * stream and is written to video memory as that unmodified. This implies 176 * stream and is written to video memory as that unmodified.
176 * 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).
177 */ 182 */
178struct fb_bitfield { 183struct fb_bitfield {
179 __u32 offset; /* beginning of bitfield */ 184 __u32 offset; /* beginning of bitfield */
@@ -960,15 +965,7 @@ extern struct fb_info *registered_fb[FB_MAX];
960extern int num_registered_fb; 965extern int num_registered_fb;
961extern struct class *fb_class; 966extern struct class *fb_class;
962 967
963static inline int lock_fb_info(struct fb_info *info) 968extern int lock_fb_info(struct fb_info *info);
964{
965 mutex_lock(&info->lock);
966 if (!info->fbops) {
967 mutex_unlock(&info->lock);
968 return 0;
969 }
970 return 1;
971}
972 969
973static inline void unlock_fb_info(struct fb_info *info) 970static inline void unlock_fb_info(struct fb_info *info)
974{ 971{
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/firewire-cdev.h b/include/linux/firewire-cdev.h
index 4d078e99c017..c6b3ca3af6df 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -25,10 +25,12 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/firewire-constants.h> 26#include <linux/firewire-constants.h>
27 27
28#define FW_CDEV_EVENT_BUS_RESET 0x00 28#define FW_CDEV_EVENT_BUS_RESET 0x00
29#define FW_CDEV_EVENT_RESPONSE 0x01 29#define FW_CDEV_EVENT_RESPONSE 0x01
30#define FW_CDEV_EVENT_REQUEST 0x02 30#define FW_CDEV_EVENT_REQUEST 0x02
31#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 31#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03
32#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04
33#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05
32 34
33/** 35/**
34 * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types 36 * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types
@@ -136,7 +138,24 @@ struct fw_cdev_event_request {
136 * This event is sent when the controller has completed an &fw_cdev_iso_packet 138 * This event is sent when the controller has completed an &fw_cdev_iso_packet
137 * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers 139 * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers
138 * stripped of all packets up until and including the interrupt packet are 140 * stripped of all packets up until and including the interrupt packet are
139 * returned in the @header field. 141 * returned in the @header field. The amount of header data per packet is as
142 * specified at iso context creation by &fw_cdev_create_iso_context.header_size.
143 *
144 * In version 1 of this ABI, header data consisted of the 1394 isochronous
145 * packet header, followed by quadlets from the packet payload if
146 * &fw_cdev_create_iso_context.header_size > 4.
147 *
148 * In version 2 of this ABI, header data consist of the 1394 isochronous
149 * packet header, followed by a timestamp quadlet if
150 * &fw_cdev_create_iso_context.header_size > 4, followed by quadlets from the
151 * packet payload if &fw_cdev_create_iso_context.header_size > 8.
152 *
153 * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
154 *
155 * Format of 1394 iso packet header: 16 bits len, 2 bits tag, 6 bits channel,
156 * 4 bits tcode, 4 bits sy, in big endian byte order. Format of timestamp:
157 * 16 bits invalid, 3 bits cycleSeconds, 13 bits cycleCount, in big endian byte
158 * order.
140 */ 159 */
141struct fw_cdev_event_iso_interrupt { 160struct fw_cdev_event_iso_interrupt {
142 __u64 closure; 161 __u64 closure;
@@ -147,12 +166,44 @@ struct fw_cdev_event_iso_interrupt {
147}; 166};
148 167
149/** 168/**
169 * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
170 * @closure: See &fw_cdev_event_common;
171 * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
172 * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
173 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
174 * @handle: Reference by which an allocated resource can be deallocated
175 * @channel: Isochronous channel which was (de)allocated, if any
176 * @bandwidth: Bandwidth allocation units which were (de)allocated, if any
177 *
178 * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous
179 * resource was allocated at the IRM. The client has to check @channel and
180 * @bandwidth for whether the allocation actually succeeded.
181 *
182 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous
183 * resource was deallocated at the IRM. It is also sent when automatic
184 * reallocation after a bus reset failed.
185 *
186 * @channel is <0 if no channel was (de)allocated or if reallocation failed.
187 * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed.
188 */
189struct fw_cdev_event_iso_resource {
190 __u64 closure;
191 __u32 type;
192 __u32 handle;
193 __s32 channel;
194 __s32 bandwidth;
195};
196
197/**
150 * union fw_cdev_event - Convenience union of fw_cdev_event_ types 198 * union fw_cdev_event - Convenience union of fw_cdev_event_ types
151 * @common: Valid for all types 199 * @common: Valid for all types
152 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET 200 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
153 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE 201 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
154 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST 202 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST
155 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT 203 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
204 * @iso_resource: Valid if @common.type ==
205 * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
206 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
156 * 207 *
157 * Convenience union for userspace use. Events could be read(2) into an 208 * Convenience union for userspace use. Events could be read(2) into an
158 * appropriately aligned char buffer and then cast to this union for further 209 * appropriately aligned char buffer and then cast to this union for further
@@ -163,33 +214,47 @@ struct fw_cdev_event_iso_interrupt {
163 * not fit will be discarded so that the next read(2) will return a new event. 214 * not fit will be discarded so that the next read(2) will return a new event.
164 */ 215 */
165union fw_cdev_event { 216union fw_cdev_event {
166 struct fw_cdev_event_common common; 217 struct fw_cdev_event_common common;
167 struct fw_cdev_event_bus_reset bus_reset; 218 struct fw_cdev_event_bus_reset bus_reset;
168 struct fw_cdev_event_response response; 219 struct fw_cdev_event_response response;
169 struct fw_cdev_event_request request; 220 struct fw_cdev_event_request request;
170 struct fw_cdev_event_iso_interrupt iso_interrupt; 221 struct fw_cdev_event_iso_interrupt iso_interrupt;
222 struct fw_cdev_event_iso_resource iso_resource;
171}; 223};
172 224
173#define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info) 225/* available since kernel version 2.6.22 */
174#define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request) 226#define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info)
175#define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate) 227#define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request)
176#define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate) 228#define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate)
177#define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response) 229#define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate)
178#define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset) 230#define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response)
179#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) 231#define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset)
180#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) 232#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor)
233#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor)
234#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context)
235#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso)
236#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso)
237#define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso)
181 238
182#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context) 239/* available since kernel version 2.6.24 */
183#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) 240#define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer)
184#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso)
185#define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso)
186#define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer)
187 241
188/* FW_CDEV_VERSION History 242/* available since kernel version 2.6.30 */
189 * 243#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource)
190 * 1 Feb 18, 2007: Initial version. 244#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate)
245#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource)
246#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource)
247#define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */
248#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request)
249#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
250
251/*
252 * FW_CDEV_VERSION History
253 * 1 (2.6.22) - initial version
254 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if
255 * &fw_cdev_create_iso_context.header_size is 8 or more
191 */ 256 */
192#define FW_CDEV_VERSION 1 257#define FW_CDEV_VERSION 2
193 258
194/** 259/**
195 * struct fw_cdev_get_info - General purpose information ioctl 260 * struct fw_cdev_get_info - General purpose information ioctl
@@ -201,7 +266,7 @@ union fw_cdev_event {
201 * case, @rom_length is updated with the actual length of the 266 * case, @rom_length is updated with the actual length of the
202 * configuration ROM. 267 * configuration ROM.
203 * @rom: If non-zero, address of a buffer to be filled by a copy of the 268 * @rom: If non-zero, address of a buffer to be filled by a copy of the
204 * local node's configuration ROM 269 * device's configuration ROM
205 * @bus_reset: If non-zero, address of a buffer to be filled by a 270 * @bus_reset: If non-zero, address of a buffer to be filled by a
206 * &struct fw_cdev_event_bus_reset with the current state 271 * &struct fw_cdev_event_bus_reset with the current state
207 * of the bus. This does not cause a bus reset to happen. 272 * of the bus. This does not cause a bus reset to happen.
@@ -229,7 +294,7 @@ struct fw_cdev_get_info {
229 * Send a request to the device. This ioctl implements all outgoing requests. 294 * Send a request to the device. This ioctl implements all outgoing requests.
230 * Both quadlet and block request specify the payload as a pointer to the data 295 * Both quadlet and block request specify the payload as a pointer to the data
231 * in the @data field. Once the transaction completes, the kernel writes an 296 * in the @data field. Once the transaction completes, the kernel writes an
232 * &fw_cdev_event_request event back. The @closure field is passed back to 297 * &fw_cdev_event_response event back. The @closure field is passed back to
233 * user space in the response event. 298 * user space in the response event.
234 */ 299 */
235struct fw_cdev_send_request { 300struct fw_cdev_send_request {
@@ -284,9 +349,9 @@ struct fw_cdev_allocate {
284}; 349};
285 350
286/** 351/**
287 * struct fw_cdev_deallocate - Free an address range allocation 352 * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource
288 * @handle: Handle to the address range, as returned by the kernel when the 353 * @handle: Handle to the address range or iso resource, as returned by the
289 * range was allocated 354 * kernel when the range or resource was allocated
290 */ 355 */
291struct fw_cdev_deallocate { 356struct fw_cdev_deallocate {
292 __u32 handle; 357 __u32 handle;
@@ -329,6 +394,9 @@ struct fw_cdev_initiate_bus_reset {
329 * If successful, the kernel adds the descriptor and writes back a handle to the 394 * If successful, the kernel adds the descriptor and writes back a handle to the
330 * kernel-side object to be used for later removal of the descriptor block and 395 * kernel-side object to be used for later removal of the descriptor block and
331 * immediate key. 396 * immediate key.
397 *
398 * This ioctl affects the configuration ROMs of all local nodes.
399 * The ioctl only succeeds on device files which represent a local node.
332 */ 400 */
333struct fw_cdev_add_descriptor { 401struct fw_cdev_add_descriptor {
334 __u32 immediate; 402 __u32 immediate;
@@ -344,7 +412,7 @@ struct fw_cdev_add_descriptor {
344 * descriptor was added 412 * descriptor was added
345 * 413 *
346 * Remove a descriptor block and accompanying immediate key from the local 414 * Remove a descriptor block and accompanying immediate key from the local
347 * node's configuration ROM. 415 * nodes' configuration ROMs.
348 */ 416 */
349struct fw_cdev_remove_descriptor { 417struct fw_cdev_remove_descriptor {
350 __u32 handle; 418 __u32 handle;
@@ -370,6 +438,9 @@ struct fw_cdev_remove_descriptor {
370 * 438 *
371 * If a context was successfully created, the kernel writes back a handle to the 439 * If a context was successfully created, the kernel writes back a handle to the
372 * context, which must be passed in for subsequent operations on that context. 440 * context, which must be passed in for subsequent operations on that context.
441 *
442 * Note that the effect of a @header_size > 4 depends on
443 * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt.
373 */ 444 */
374struct fw_cdev_create_iso_context { 445struct fw_cdev_create_iso_context {
375 __u32 type; 446 __u32 type;
@@ -473,10 +544,91 @@ struct fw_cdev_stop_iso {
473 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer 544 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer
474 * and also the system clock. This allows to express the receive time of an 545 * and also the system clock. This allows to express the receive time of an
475 * isochronous packet as a system time with microsecond accuracy. 546 * isochronous packet as a system time with microsecond accuracy.
547 *
548 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
549 * 12 bits cycleOffset, in host byte order.
476 */ 550 */
477struct fw_cdev_get_cycle_timer { 551struct fw_cdev_get_cycle_timer {
478 __u64 local_time; 552 __u64 local_time;
479 __u32 cycle_timer; 553 __u32 cycle_timer;
480}; 554};
481 555
556/**
557 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
558 * @closure: Passed back to userspace in correponding iso resource events
559 * @channels: Isochronous channels of which one is to be (de)allocated
560 * @bandwidth: Isochronous bandwidth units to be (de)allocated
561 * @handle: Handle to the allocation, written by the kernel (only valid in
562 * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls)
563 *
564 * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an
565 * isochronous channel and/or of isochronous bandwidth at the isochronous
566 * resource manager (IRM). Only one of the channels specified in @channels is
567 * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after
568 * communication with the IRM, indicating success or failure in the event data.
569 * The kernel will automatically reallocate the resources after bus resets.
570 * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event
571 * will be sent. The kernel will also automatically deallocate the resources
572 * when the file descriptor is closed.
573 *
574 * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate
575 * deallocation of resources which were allocated as described above.
576 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
577 *
578 * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation
579 * without automatic re- or deallocation.
580 * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation,
581 * indicating success or failure in its data.
582 *
583 * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like
584 * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed
585 * instead of allocated.
586 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
587 *
588 * To summarize, %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE allocates iso resources
589 * for the lifetime of the fd or handle.
590 * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
591 * for the duration of a bus generation.
592 *
593 * @channels is a host-endian bitfield with the least significant bit
594 * representing channel 0 and the most significant bit representing channel 63:
595 * 1ULL << c for each channel c that is a candidate for (de)allocation.
596 *
597 * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send
598 * one quadlet of data (payload or header data) at speed S1600.
599 */
600struct fw_cdev_allocate_iso_resource {
601 __u64 closure;
602 __u64 channels;
603 __u32 bandwidth;
604 __u32 handle;
605};
606
607/**
608 * struct fw_cdev_send_stream_packet - send an asynchronous stream packet
609 * @length: Length of outgoing payload, in bytes
610 * @tag: Data format tag
611 * @channel: Isochronous channel to transmit to
612 * @sy: Synchronization code
613 * @closure: Passed back to userspace in the response event
614 * @data: Userspace pointer to payload
615 * @generation: The bus generation where packet is valid
616 * @speed: Speed to transmit at
617 *
618 * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet
619 * to every device which is listening to the specified channel. The kernel
620 * writes an &fw_cdev_event_response event which indicates success or failure of
621 * the transmission.
622 */
623struct fw_cdev_send_stream_packet {
624 __u32 length;
625 __u32 tag;
626 __u32 channel;
627 __u32 sy;
628 __u64 closure;
629 __u64 data;
630 __u32 generation;
631 __u32 speed;
632};
633
482#endif /* _LINUX_FIREWIRE_CDEV_H */ 634#endif /* _LINUX_FIREWIRE_CDEV_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 92734c0012e6..5bed436f4353 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -87,6 +87,60 @@ struct inodes_stat_t {
87 */ 87 */
88#define FMODE_NOCMTIME ((__force fmode_t)2048) 88#define FMODE_NOCMTIME ((__force fmode_t)2048)
89 89
90/*
91 * The below are the various read and write types that we support. Some of
92 * them include behavioral modifiers that send information down to the
93 * block layer and IO scheduler. Terminology:
94 *
95 * The block layer uses device plugging to defer IO a little bit, in
96 * the hope that we will see more IO very shortly. This increases
97 * coalescing of adjacent IO and thus reduces the number of IOs we
98 * have to send to the device. It also allows for better queuing,
99 * if the IO isn't mergeable. If the caller is going to be waiting
100 * for the IO, then he must ensure that the device is unplugged so
101 * that the IO is dispatched to the driver.
102 *
103 * All IO is handled async in Linux. This is fine for background
104 * writes, but for reads or writes that someone waits for completion
105 * on, we want to notify the block layer and IO scheduler so that they
106 * know about it. That allows them to make better scheduling
107 * decisions. So when the below references 'sync' and 'async', it
108 * is referencing this priority hint.
109 *
110 * With that in mind, the available types are:
111 *
112 * READ A normal read operation. Device will be plugged.
113 * READ_SYNC A synchronous read. Device is not plugged, caller can
114 * immediately wait on this read without caring about
115 * unplugging.
116 * READA Used for read-ahead operations. Lower priority, and the
117 * block layer could (in theory) choose to ignore this
118 * request if it runs into resource problems.
119 * WRITE A normal async write. Device will be plugged.
120 * SWRITE Like WRITE, but a special case for ll_rw_block() that
121 * tells it to lock the buffer first. Normally a buffer
122 * must be locked before doing IO.
123 * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down
124 * the hint that someone will be waiting on this IO
125 * shortly. The device must still be unplugged explicitly,
126 * WRITE_SYNC_PLUG does not do this as we could be
127 * submitting more writes before we actually wait on any
128 * of them.
129 * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device
130 * immediately after submission. The write equivalent
131 * of READ_SYNC.
132 * WRITE_ODIRECT Special case write for O_DIRECT only.
133 * SWRITE_SYNC
134 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.
135 * See SWRITE.
136 * WRITE_BARRIER Like WRITE, but tells the block layer that all
137 * previously submitted writes must be safely on storage
138 * before this one is started. Also guarantees that when
139 * this write is complete, it itself is also safely on
140 * storage. Prevents reordering of writes on both sides
141 * of this IO.
142 *
143 */
90#define RW_MASK 1 144#define RW_MASK 1
91#define RWA_MASK 2 145#define RWA_MASK 2
92#define READ 0 146#define READ 0
@@ -95,9 +149,18 @@ struct inodes_stat_t {
95#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 149#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
96#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 150#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
97#define READ_META (READ | (1 << BIO_RW_META)) 151#define READ_META (READ | (1 << BIO_RW_META))
98#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 152#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)) 153#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
154#define WRITE_ODIRECT (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
155#define SWRITE_SYNC_PLUG \
156 (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
157#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
100#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 158#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
159
160/*
161 * These aren't really reads or writes, they pass down information about
162 * parts of device that are now unused by the file system.
163 */
101#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) 164#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
102#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) 165#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
103 166
@@ -141,6 +204,7 @@ struct inodes_stat_t {
141#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ 204#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
142#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 205#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
143#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 206#define MS_I_VERSION (1<<23) /* Update inode I_version field */
207#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
144#define MS_ACTIVE (1<<30) 208#define MS_ACTIVE (1<<30)
145#define MS_NOUSER (1<<31) 209#define MS_NOUSER (1<<31)
146 210
@@ -733,9 +797,6 @@ enum inode_i_mutex_lock_class
733 I_MUTEX_QUOTA 797 I_MUTEX_QUOTA
734}; 798};
735 799
736extern void inode_double_lock(struct inode *inode1, struct inode *inode2);
737extern void inode_double_unlock(struct inode *inode1, struct inode *inode2);
738
739/* 800/*
740 * NOTE: in a 32bit arch with a preemptable kernel and 801 * NOTE: in a 32bit arch with a preemptable kernel and
741 * an UP compile the i_size_read/write must be atomic 802 * an UP compile the i_size_read/write must be atomic
@@ -848,6 +909,7 @@ struct file {
848#define f_dentry f_path.dentry 909#define f_dentry f_path.dentry
849#define f_vfsmnt f_path.mnt 910#define f_vfsmnt f_path.mnt
850 const struct file_operations *f_op; 911 const struct file_operations *f_op;
912 spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */
851 atomic_long_t f_count; 913 atomic_long_t f_count;
852 unsigned int f_flags; 914 unsigned int f_flags;
853 fmode_t f_mode; 915 fmode_t f_mode;
@@ -866,7 +928,6 @@ struct file {
866#ifdef CONFIG_EPOLL 928#ifdef CONFIG_EPOLL
867 /* Used by fs/eventpoll.c to link all the hooks to this file */ 929 /* Used by fs/eventpoll.c to link all the hooks to this file */
868 struct list_head f_ep_links; 930 struct list_head f_ep_links;
869 spinlock_t f_ep_lock;
870#endif /* #ifdef CONFIG_EPOLL */ 931#endif /* #ifdef CONFIG_EPOLL */
871 struct address_space *f_mapping; 932 struct address_space *f_mapping;
872#ifdef CONFIG_DEBUG_WRITECOUNT 933#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -1063,34 +1124,147 @@ extern int lease_modify(struct file_lock **, int);
1063extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1124extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1064extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1125extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1065#else /* !CONFIG_FILE_LOCKING */ 1126#else /* !CONFIG_FILE_LOCKING */
1066#define fcntl_getlk(a, b) ({ -EINVAL; }) 1127static inline int fcntl_getlk(struct file *file, struct flock __user *user)
1067#define fcntl_setlk(a, b, c, d) ({ -EACCES; }) 1128{
1129 return -EINVAL;
1130}
1131
1132static inline int fcntl_setlk(unsigned int fd, struct file *file,
1133 unsigned int cmd, struct flock __user *user)
1134{
1135 return -EACCES;
1136}
1137
1068#if BITS_PER_LONG == 32 1138#if BITS_PER_LONG == 32
1069#define fcntl_getlk64(a, b) ({ -EINVAL; }) 1139static inline int fcntl_getlk64(struct file *file, struct flock64 __user *user)
1070#define fcntl_setlk64(a, b, c, d) ({ -EACCES; }) 1140{
1141 return -EINVAL;
1142}
1143
1144static inline int fcntl_setlk64(unsigned int fd, struct file *file,
1145 unsigned int cmd, struct flock64 __user *user)
1146{
1147 return -EACCES;
1148}
1071#endif 1149#endif
1072#define fcntl_setlease(a, b, c) ({ 0; }) 1150static inline int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
1073#define fcntl_getlease(a) ({ 0; }) 1151{
1074#define locks_init_lock(a) ({ }) 1152 return 0;
1075#define __locks_copy_lock(a, b) ({ }) 1153}
1076#define locks_copy_lock(a, b) ({ }) 1154
1077#define locks_remove_posix(a, b) ({ }) 1155static inline int fcntl_getlease(struct file *filp)
1078#define locks_remove_flock(a) ({ }) 1156{
1079#define posix_test_lock(a, b) ({ 0; }) 1157 return 0;
1080#define posix_lock_file(a, b, c) ({ -ENOLCK; }) 1158}
1081#define posix_lock_file_wait(a, b) ({ -ENOLCK; }) 1159
1082#define posix_unblock_lock(a, b) (-ENOENT) 1160static inline void locks_init_lock(struct file_lock *fl)
1083#define vfs_test_lock(a, b) ({ 0; }) 1161{
1084#define vfs_lock_file(a, b, c, d) (-ENOLCK) 1162 return;
1085#define vfs_cancel_lock(a, b) ({ 0; }) 1163}
1086#define flock_lock_file_wait(a, b) ({ -ENOLCK; }) 1164
1087#define __break_lease(a, b) ({ 0; }) 1165static inline void __locks_copy_lock(struct file_lock *new, struct file_lock *fl)
1088#define lease_get_mtime(a, b) ({ }) 1166{
1089#define generic_setlease(a, b, c) ({ -EINVAL; }) 1167 return;
1090#define vfs_setlease(a, b, c) ({ -EINVAL; }) 1168}
1091#define lease_modify(a, b) ({ -EINVAL; }) 1169
1092#define lock_may_read(a, b, c) ({ 1; }) 1170static inline void locks_copy_lock(struct file_lock *new, struct file_lock *fl)
1093#define lock_may_write(a, b, c) ({ 1; }) 1171{
1172 return;
1173}
1174
1175static inline void locks_remove_posix(struct file *filp, fl_owner_t owner)
1176{
1177 return;
1178}
1179
1180static inline void locks_remove_flock(struct file *filp)
1181{
1182 return;
1183}
1184
1185static inline void posix_test_lock(struct file *filp, struct file_lock *fl)
1186{
1187 return;
1188}
1189
1190static inline int posix_lock_file(struct file *filp, struct file_lock *fl,
1191 struct file_lock *conflock)
1192{
1193 return -ENOLCK;
1194}
1195
1196static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
1197{
1198 return -ENOLCK;
1199}
1200
1201static inline int posix_unblock_lock(struct file *filp,
1202 struct file_lock *waiter)
1203{
1204 return -ENOENT;
1205}
1206
1207static inline int vfs_test_lock(struct file *filp, struct file_lock *fl)
1208{
1209 return 0;
1210}
1211
1212static inline int vfs_lock_file(struct file *filp, unsigned int cmd,
1213 struct file_lock *fl, struct file_lock *conf)
1214{
1215 return -ENOLCK;
1216}
1217
1218static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
1219{
1220 return 0;
1221}
1222
1223static inline int flock_lock_file_wait(struct file *filp,
1224 struct file_lock *request)
1225{
1226 return -ENOLCK;
1227}
1228
1229static inline int __break_lease(struct inode *inode, unsigned int mode)
1230{
1231 return 0;
1232}
1233
1234static inline void lease_get_mtime(struct inode *inode, struct timespec *time)
1235{
1236 return;
1237}
1238
1239static inline int generic_setlease(struct file *filp, long arg,
1240 struct file_lock **flp)
1241{
1242 return -EINVAL;
1243}
1244
1245static inline int vfs_setlease(struct file *filp, long arg,
1246 struct file_lock **lease)
1247{
1248 return -EINVAL;
1249}
1250
1251static inline int lease_modify(struct file_lock **before, int arg)
1252{
1253 return -EINVAL;
1254}
1255
1256static inline int lock_may_read(struct inode *inode, loff_t start,
1257 unsigned long len)
1258{
1259 return 1;
1260}
1261
1262static inline int lock_may_write(struct inode *inode, loff_t start,
1263 unsigned long len)
1264{
1265 return 1;
1266}
1267
1094#endif /* !CONFIG_FILE_LOCKING */ 1268#endif /* !CONFIG_FILE_LOCKING */
1095 1269
1096 1270
@@ -1581,6 +1755,9 @@ struct file_system_type {
1581 struct lock_class_key i_alloc_sem_key; 1755 struct lock_class_key i_alloc_sem_key;
1582}; 1756};
1583 1757
1758extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data,
1759 int (*fill_super)(struct super_block *, void *, int),
1760 struct vfsmount *mnt);
1584extern int get_sb_bdev(struct file_system_type *fs_type, 1761extern int get_sb_bdev(struct file_system_type *fs_type,
1585 int flags, const char *dev_name, void *data, 1762 int flags, const char *dev_name, void *data,
1586 int (*fill_super)(struct super_block *, void *, int), 1763 int (*fill_super)(struct super_block *, void *, int),
@@ -1606,7 +1783,7 @@ struct super_block *sget(struct file_system_type *type,
1606extern int get_sb_pseudo(struct file_system_type *, char *, 1783extern int get_sb_pseudo(struct file_system_type *, char *,
1607 const struct super_operations *ops, unsigned long, 1784 const struct super_operations *ops, unsigned long,
1608 struct vfsmount *mnt); 1785 struct vfsmount *mnt);
1609extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1786extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1610int __put_super_and_need_restart(struct super_block *sb); 1787int __put_super_and_need_restart(struct super_block *sb);
1611 1788
1612/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1789/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
@@ -1627,6 +1804,8 @@ extern void drop_collected_mounts(struct vfsmount *);
1627 1804
1628extern int vfs_statfs(struct dentry *, struct kstatfs *); 1805extern int vfs_statfs(struct dentry *, struct kstatfs *);
1629 1806
1807extern int current_umask(void);
1808
1630/* /sys/fs */ 1809/* /sys/fs */
1631extern struct kobject *fs_kobj; 1810extern struct kobject *fs_kobj;
1632 1811
@@ -1687,13 +1866,44 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1687 return 0; 1866 return 0;
1688} 1867}
1689#else /* !CONFIG_FILE_LOCKING */ 1868#else /* !CONFIG_FILE_LOCKING */
1690#define locks_mandatory_locked(a) ({ 0; }) 1869static inline int locks_mandatory_locked(struct inode *inode)
1691#define locks_mandatory_area(a, b, c, d, e) ({ 0; }) 1870{
1692#define __mandatory_lock(a) ({ 0; }) 1871 return 0;
1693#define mandatory_lock(a) ({ 0; }) 1872}
1694#define locks_verify_locked(a) ({ 0; }) 1873
1695#define locks_verify_truncate(a, b, c) ({ 0; }) 1874static inline int locks_mandatory_area(int rw, struct inode *inode,
1696#define break_lease(a, b) ({ 0; }) 1875 struct file *filp, loff_t offset,
1876 size_t count)
1877{
1878 return 0;
1879}
1880
1881static inline int __mandatory_lock(struct inode *inode)
1882{
1883 return 0;
1884}
1885
1886static inline int mandatory_lock(struct inode *inode)
1887{
1888 return 0;
1889}
1890
1891static inline int locks_verify_locked(struct inode *inode)
1892{
1893 return 0;
1894}
1895
1896static inline int locks_verify_truncate(struct inode *inode, struct file *filp,
1897 size_t size)
1898{
1899 return 0;
1900}
1901
1902static inline int break_lease(struct inode *inode, unsigned int mode)
1903{
1904 return 0;
1905}
1906
1697#endif /* CONFIG_FILE_LOCKING */ 1907#endif /* CONFIG_FILE_LOCKING */
1698 1908
1699/* fs/open.c */ 1909/* fs/open.c */
@@ -1730,8 +1940,28 @@ extern void bd_set_size(struct block_device *, loff_t size);
1730extern void bd_forget(struct inode *inode); 1940extern void bd_forget(struct inode *inode);
1731extern void bdput(struct block_device *); 1941extern void bdput(struct block_device *);
1732extern struct block_device *open_by_devnum(dev_t, fmode_t); 1942extern struct block_device *open_by_devnum(dev_t, fmode_t);
1943extern void invalidate_bdev(struct block_device *);
1944extern int sync_blockdev(struct block_device *bdev);
1945extern struct super_block *freeze_bdev(struct block_device *);
1946extern void emergency_thaw_all(void);
1947extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
1948extern int fsync_bdev(struct block_device *);
1949extern int fsync_super(struct super_block *);
1950extern int fsync_no_super(struct block_device *);
1733#else 1951#else
1734static inline void bd_forget(struct inode *inode) {} 1952static inline void bd_forget(struct inode *inode) {}
1953static inline int sync_blockdev(struct block_device *bdev) { return 0; }
1954static inline void invalidate_bdev(struct block_device *bdev) {}
1955
1956static inline struct super_block *freeze_bdev(struct block_device *sb)
1957{
1958 return NULL;
1959}
1960
1961static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
1962{
1963 return 0;
1964}
1735#endif 1965#endif
1736extern const struct file_operations def_blk_fops; 1966extern const struct file_operations def_blk_fops;
1737extern const struct file_operations def_chr_fops; 1967extern const struct file_operations def_chr_fops;
@@ -1881,7 +2111,6 @@ static inline void allow_write_access(struct file *file)
1881 if (file) 2111 if (file)
1882 atomic_inc(&file->f_path.dentry->d_inode->i_writecount); 2112 atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
1883} 2113}
1884extern int do_pipe(int *);
1885extern int do_pipe_flags(int *, int); 2114extern int do_pipe_flags(int *, int);
1886extern struct file *create_read_pipe(struct file *f, int flags); 2115extern struct file *create_read_pipe(struct file *f, int flags);
1887extern struct file *create_write_pipe(int flags); 2116extern struct file *create_write_pipe(int flags);
@@ -1977,8 +2206,6 @@ extern ssize_t generic_file_splice_read(struct file *, loff_t *,
1977 struct pipe_inode_info *, size_t, unsigned int); 2206 struct pipe_inode_info *, size_t, unsigned int);
1978extern ssize_t generic_file_splice_write(struct pipe_inode_info *, 2207extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
1979 struct file *, loff_t *, size_t, unsigned int); 2208 struct file *, loff_t *, size_t, unsigned int);
1980extern ssize_t generic_file_splice_write_nolock(struct pipe_inode_info *,
1981 struct file *, loff_t *, size_t, unsigned int);
1982extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2209extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
1983 struct file *out, loff_t *, size_t len, unsigned int flags); 2210 struct file *out, loff_t *, size_t len, unsigned int flags);
1984extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, 2211extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
@@ -2072,9 +2299,8 @@ extern int vfs_readdir(struct file *, filldir_t, void *);
2072 2299
2073extern int vfs_stat(char __user *, struct kstat *); 2300extern int vfs_stat(char __user *, struct kstat *);
2074extern int vfs_lstat(char __user *, struct kstat *); 2301extern int vfs_lstat(char __user *, struct kstat *);
2075extern int vfs_stat_fd(int dfd, char __user *, struct kstat *);
2076extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *);
2077extern int vfs_fstat(unsigned int, struct kstat *); 2302extern int vfs_fstat(unsigned int, struct kstat *);
2303extern int vfs_fstatat(int , char __user *, struct kstat *, int);
2078 2304
2079extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2305extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2080 unsigned long arg); 2306 unsigned long arg);
@@ -2171,19 +2397,7 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf,
2171 size_t size, loff_t *pos); 2397 size_t size, loff_t *pos);
2172int simple_transaction_release(struct inode *inode, struct file *file); 2398int simple_transaction_release(struct inode *inode, struct file *file);
2173 2399
2174static inline void simple_transaction_set(struct file *file, size_t n) 2400void simple_transaction_set(struct file *file, size_t n);
2175{
2176 struct simple_transaction_argresp *ar = file->private_data;
2177
2178 BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
2179
2180 /*
2181 * The barrier ensures that ar->size will really remain zero until
2182 * ar->data is ready for reading.
2183 */
2184 smp_mb();
2185 ar->size = n;
2186}
2187 2401
2188/* 2402/*
2189 * simple attribute files 2403 * simple attribute files
@@ -2230,32 +2444,11 @@ ssize_t simple_attr_read(struct file *file, char __user *buf,
2230ssize_t simple_attr_write(struct file *file, const char __user *buf, 2444ssize_t simple_attr_write(struct file *file, const char __user *buf,
2231 size_t len, loff_t *ppos); 2445 size_t len, loff_t *ppos);
2232 2446
2233
2234#ifdef CONFIG_SECURITY
2235static inline char *alloc_secdata(void)
2236{
2237 return (char *)get_zeroed_page(GFP_KERNEL);
2238}
2239
2240static inline void free_secdata(void *secdata)
2241{
2242 free_page((unsigned long)secdata);
2243}
2244#else
2245static inline char *alloc_secdata(void)
2246{
2247 return (char *)1;
2248}
2249
2250static inline void free_secdata(void *secdata)
2251{ }
2252#endif /* CONFIG_SECURITY */
2253
2254struct ctl_table; 2447struct ctl_table;
2255int proc_nr_files(struct ctl_table *table, int write, struct file *filp, 2448int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
2256 void __user *buffer, size_t *lenp, loff_t *ppos); 2449 void __user *buffer, size_t *lenp, loff_t *ppos);
2257 2450
2258int get_filesystem_list(char * buf); 2451int __init get_filesystem_list(char *buf);
2259 2452
2260#endif /* __KERNEL__ */ 2453#endif /* __KERNEL__ */
2261#endif /* _LINUX_FS_H */ 2454#endif /* _LINUX_FS_H */
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index a97c053d3a9a..78a05bfcd8eb 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -4,9 +4,10 @@
4#include <linux/path.h> 4#include <linux/path.h>
5 5
6struct fs_struct { 6struct fs_struct {
7 atomic_t count; 7 int users;
8 rwlock_t lock; 8 rwlock_t lock;
9 int umask; 9 int umask;
10 int in_exec;
10 struct path root, pwd; 11 struct path root, pwd;
11}; 12};
12 13
@@ -16,6 +17,8 @@ extern void exit_fs(struct task_struct *);
16extern void set_fs_root(struct fs_struct *, struct path *); 17extern void set_fs_root(struct fs_struct *, struct path *);
17extern void set_fs_pwd(struct fs_struct *, struct path *); 18extern void set_fs_pwd(struct fs_struct *, struct path *);
18extern struct fs_struct *copy_fs_struct(struct fs_struct *); 19extern struct fs_struct *copy_fs_struct(struct fs_struct *);
19extern void put_fs_struct(struct fs_struct *); 20extern void free_fs_struct(struct fs_struct *);
21extern void daemonize_fs_struct(void);
22extern int unshare_fs_struct(void);
20 23
21#endif /* _LINUX_FS_STRUCT_H */ 24#endif /* _LINUX_FS_STRUCT_H */
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
new file mode 100644
index 000000000000..84d3532dd3ea
--- /dev/null
+++ b/include/linux/fscache-cache.h
@@ -0,0 +1,505 @@
1/* General filesystem caching backing cache interface
2 *
3 * Copyright (C) 2004-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 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 * NOTE!!! See:
12 *
13 * Documentation/filesystems/caching/backend-api.txt
14 *
15 * for a description of the cache backend interface declared here.
16 */
17
18#ifndef _LINUX_FSCACHE_CACHE_H
19#define _LINUX_FSCACHE_CACHE_H
20
21#include <linux/fscache.h>
22#include <linux/sched.h>
23#include <linux/slow-work.h>
24
25#define NR_MAXCACHES BITS_PER_LONG
26
27struct fscache_cache;
28struct fscache_cache_ops;
29struct fscache_object;
30struct fscache_operation;
31
32/*
33 * cache tag definition
34 */
35struct fscache_cache_tag {
36 struct list_head link;
37 struct fscache_cache *cache; /* cache referred to by this tag */
38 unsigned long flags;
39#define FSCACHE_TAG_RESERVED 0 /* T if tag is reserved for a cache */
40 atomic_t usage;
41 char name[0]; /* tag name */
42};
43
44/*
45 * cache definition
46 */
47struct fscache_cache {
48 const struct fscache_cache_ops *ops;
49 struct fscache_cache_tag *tag; /* tag representing this cache */
50 struct kobject *kobj; /* system representation of this cache */
51 struct list_head link; /* link in list of caches */
52 size_t max_index_size; /* maximum size of index data */
53 char identifier[36]; /* cache label */
54
55 /* node management */
56 struct work_struct op_gc; /* operation garbage collector */
57 struct list_head object_list; /* list of data/index objects */
58 struct list_head op_gc_list; /* list of ops to be deleted */
59 spinlock_t object_list_lock;
60 spinlock_t op_gc_list_lock;
61 atomic_t object_count; /* no. of live objects in this cache */
62 struct fscache_object *fsdef; /* object for the fsdef index */
63 unsigned long flags;
64#define FSCACHE_IOERROR 0 /* cache stopped on I/O error */
65#define FSCACHE_CACHE_WITHDRAWN 1 /* cache has been withdrawn */
66};
67
68extern wait_queue_head_t fscache_cache_cleared_wq;
69
70/*
71 * operation to be applied to a cache object
72 * - retrieval initiation operations are done in the context of the process
73 * that issued them, and not in an async thread pool
74 */
75typedef void (*fscache_operation_release_t)(struct fscache_operation *op);
76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op);
77
78struct fscache_operation {
79 union {
80 struct work_struct fast_work; /* record for fast ops */
81 struct slow_work slow_work; /* record for (very) slow ops */
82 };
83 struct list_head pend_link; /* link in object->pending_ops */
84 struct fscache_object *object; /* object to be operated upon */
85
86 unsigned long flags;
87#define FSCACHE_OP_TYPE 0x000f /* operation type */
88#define FSCACHE_OP_FAST 0x0001 /* - fast op, processor may not sleep for disk */
89#define FSCACHE_OP_SLOW 0x0002 /* - (very) slow op, processor may sleep for disk */
90#define FSCACHE_OP_MYTHREAD 0x0003 /* - processing is done be issuing thread, not pool */
91#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
92#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
93#define FSCACHE_OP_DEAD 6 /* op is now dead */
94
95 atomic_t usage;
96 unsigned debug_id; /* debugging ID */
97
98 /* operation processor callback
99 * - can be NULL if FSCACHE_OP_WAITING is going to be used to perform
100 * the op in a non-pool thread */
101 fscache_operation_processor_t processor;
102
103 /* operation releaser */
104 fscache_operation_release_t release;
105};
106
107extern atomic_t fscache_op_debug_id;
108extern const struct slow_work_ops fscache_op_slow_work_ops;
109
110extern void fscache_enqueue_operation(struct fscache_operation *);
111extern void fscache_put_operation(struct fscache_operation *);
112
113/**
114 * fscache_operation_init - Do basic initialisation of an operation
115 * @op: The operation to initialise
116 * @release: The release function to assign
117 *
118 * Do basic initialisation of an operation. The caller must still set flags,
119 * object, either fast_work or slow_work if necessary, and processor if needed.
120 */
121static inline void fscache_operation_init(struct fscache_operation *op,
122 fscache_operation_release_t release)
123{
124 atomic_set(&op->usage, 1);
125 op->debug_id = atomic_inc_return(&fscache_op_debug_id);
126 op->release = release;
127 INIT_LIST_HEAD(&op->pend_link);
128}
129
130/**
131 * fscache_operation_init_slow - Do additional initialisation of a slow op
132 * @op: The operation to initialise
133 * @processor: The processor function to assign
134 *
135 * Do additional initialisation of an operation as required for slow work.
136 */
137static inline
138void fscache_operation_init_slow(struct fscache_operation *op,
139 fscache_operation_processor_t processor)
140{
141 op->processor = processor;
142 slow_work_init(&op->slow_work, &fscache_op_slow_work_ops);
143}
144
145/*
146 * data read operation
147 */
148struct fscache_retrieval {
149 struct fscache_operation op;
150 struct address_space *mapping; /* netfs pages */
151 fscache_rw_complete_t end_io_func; /* function to call on I/O completion */
152 void *context; /* netfs read context (pinned) */
153 struct list_head to_do; /* list of things to be done by the backend */
154 unsigned long start_time; /* time at which retrieval started */
155};
156
157typedef int (*fscache_page_retrieval_func_t)(struct fscache_retrieval *op,
158 struct page *page,
159 gfp_t gfp);
160
161typedef int (*fscache_pages_retrieval_func_t)(struct fscache_retrieval *op,
162 struct list_head *pages,
163 unsigned *nr_pages,
164 gfp_t gfp);
165
166/**
167 * fscache_get_retrieval - Get an extra reference on a retrieval operation
168 * @op: The retrieval operation to get a reference on
169 *
170 * Get an extra reference on a retrieval operation.
171 */
172static inline
173struct fscache_retrieval *fscache_get_retrieval(struct fscache_retrieval *op)
174{
175 atomic_inc(&op->op.usage);
176 return op;
177}
178
179/**
180 * fscache_enqueue_retrieval - Enqueue a retrieval operation for processing
181 * @op: The retrieval operation affected
182 *
183 * Enqueue a retrieval operation for processing by the FS-Cache thread pool.
184 */
185static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op)
186{
187 fscache_enqueue_operation(&op->op);
188}
189
190/**
191 * fscache_put_retrieval - Drop a reference to a retrieval operation
192 * @op: The retrieval operation affected
193 *
194 * Drop a reference to a retrieval operation.
195 */
196static inline void fscache_put_retrieval(struct fscache_retrieval *op)
197{
198 fscache_put_operation(&op->op);
199}
200
201/*
202 * cached page storage work item
203 * - used to do three things:
204 * - batch writes to the cache
205 * - do cache writes asynchronously
206 * - defer writes until cache object lookup completion
207 */
208struct fscache_storage {
209 struct fscache_operation op;
210 pgoff_t store_limit; /* don't write more than this */
211};
212
213/*
214 * cache operations
215 */
216struct fscache_cache_ops {
217 /* name of cache provider */
218 const char *name;
219
220 /* allocate an object record for a cookie */
221 struct fscache_object *(*alloc_object)(struct fscache_cache *cache,
222 struct fscache_cookie *cookie);
223
224 /* look up the object for a cookie */
225 void (*lookup_object)(struct fscache_object *object);
226
227 /* finished looking up */
228 void (*lookup_complete)(struct fscache_object *object);
229
230 /* increment the usage count on this object (may fail if unmounting) */
231 struct fscache_object *(*grab_object)(struct fscache_object *object);
232
233 /* pin an object in the cache */
234 int (*pin_object)(struct fscache_object *object);
235
236 /* unpin an object in the cache */
237 void (*unpin_object)(struct fscache_object *object);
238
239 /* store the updated auxilliary data on an object */
240 void (*update_object)(struct fscache_object *object);
241
242 /* discard the resources pinned by an object and effect retirement if
243 * necessary */
244 void (*drop_object)(struct fscache_object *object);
245
246 /* dispose of a reference to an object */
247 void (*put_object)(struct fscache_object *object);
248
249 /* sync a cache */
250 void (*sync_cache)(struct fscache_cache *cache);
251
252 /* notification that the attributes of a non-index object (such as
253 * i_size) have changed */
254 int (*attr_changed)(struct fscache_object *object);
255
256 /* reserve space for an object's data and associated metadata */
257 int (*reserve_space)(struct fscache_object *object, loff_t i_size);
258
259 /* request a backing block for a page be read or allocated in the
260 * cache */
261 fscache_page_retrieval_func_t read_or_alloc_page;
262
263 /* request backing blocks for a list of pages be read or allocated in
264 * the cache */
265 fscache_pages_retrieval_func_t read_or_alloc_pages;
266
267 /* request a backing block for a page be allocated in the cache so that
268 * it can be written directly */
269 fscache_page_retrieval_func_t allocate_page;
270
271 /* request backing blocks for pages be allocated in the cache so that
272 * they can be written directly */
273 fscache_pages_retrieval_func_t allocate_pages;
274
275 /* write a page to its backing block in the cache */
276 int (*write_page)(struct fscache_storage *op, struct page *page);
277
278 /* detach backing block from a page (optional)
279 * - must release the cookie lock before returning
280 * - may sleep
281 */
282 void (*uncache_page)(struct fscache_object *object,
283 struct page *page);
284
285 /* dissociate a cache from all the pages it was backing */
286 void (*dissociate_pages)(struct fscache_cache *cache);
287};
288
289/*
290 * data file or index object cookie
291 * - a file will only appear in one cache
292 * - a request to cache a file may or may not be honoured, subject to
293 * constraints such as disk space
294 * - indices are created on disk just-in-time
295 */
296struct fscache_cookie {
297 atomic_t usage; /* number of users of this cookie */
298 atomic_t n_children; /* number of children of this cookie */
299 spinlock_t lock;
300 struct hlist_head backing_objects; /* object(s) backing this file/index */
301 const struct fscache_cookie_def *def; /* definition */
302 struct fscache_cookie *parent; /* parent of this entry */
303 void *netfs_data; /* back pointer to netfs */
304 struct radix_tree_root stores; /* pages to be stored on this cookie */
305#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
306
307 unsigned long flags;
308#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
309#define FSCACHE_COOKIE_CREATING 1 /* T if non-index object being created still */
310#define FSCACHE_COOKIE_NO_DATA_YET 2 /* T if new object with no cached data yet */
311#define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */
312#define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */
313#define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */
314};
315
316extern struct fscache_cookie fscache_fsdef_index;
317
318/*
319 * on-disk cache file or index handle
320 */
321struct fscache_object {
322 enum fscache_object_state {
323 FSCACHE_OBJECT_INIT, /* object in initial unbound state */
324 FSCACHE_OBJECT_LOOKING_UP, /* looking up object */
325 FSCACHE_OBJECT_CREATING, /* creating object */
326
327 /* active states */
328 FSCACHE_OBJECT_AVAILABLE, /* cleaning up object after creation */
329 FSCACHE_OBJECT_ACTIVE, /* object is usable */
330 FSCACHE_OBJECT_UPDATING, /* object is updating */
331
332 /* terminal states */
333 FSCACHE_OBJECT_DYING, /* object waiting for accessors to finish */
334 FSCACHE_OBJECT_LC_DYING, /* object cleaning up after lookup/create */
335 FSCACHE_OBJECT_ABORT_INIT, /* abort the init state */
336 FSCACHE_OBJECT_RELEASING, /* releasing object */
337 FSCACHE_OBJECT_RECYCLING, /* retiring object */
338 FSCACHE_OBJECT_WITHDRAWING, /* withdrawing object */
339 FSCACHE_OBJECT_DEAD, /* object is now dead */
340 } state;
341
342 int debug_id; /* debugging ID */
343 int n_children; /* number of child objects */
344 int n_ops; /* number of ops outstanding on object */
345 int n_obj_ops; /* number of object ops outstanding on object */
346 int n_in_progress; /* number of ops in progress */
347 int n_exclusive; /* number of exclusive ops queued */
348 spinlock_t lock; /* state and operations lock */
349
350 unsigned long lookup_jif; /* time at which lookup started */
351 unsigned long event_mask; /* events this object is interested in */
352 unsigned long events; /* events to be processed by this object
353 * (order is important - using fls) */
354#define FSCACHE_OBJECT_EV_REQUEUE 0 /* T if object should be requeued */
355#define FSCACHE_OBJECT_EV_UPDATE 1 /* T if object should be updated */
356#define FSCACHE_OBJECT_EV_CLEARED 2 /* T if accessors all gone */
357#define FSCACHE_OBJECT_EV_ERROR 3 /* T if fatal error occurred during processing */
358#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */
359#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */
360#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */
361
362 unsigned long flags;
363#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */
364#define FSCACHE_OBJECT_PENDING_WRITE 1 /* T if object has pending write */
365#define FSCACHE_OBJECT_WAITING 2 /* T if object is waiting on its parent */
366
367 struct list_head cache_link; /* link in cache->object_list */
368 struct hlist_node cookie_link; /* link in cookie->backing_objects */
369 struct fscache_cache *cache; /* cache that supplied this object */
370 struct fscache_cookie *cookie; /* netfs's file/index object */
371 struct fscache_object *parent; /* parent object */
372 struct slow_work work; /* attention scheduling record */
373 struct list_head dependents; /* FIFO of dependent objects */
374 struct list_head dep_link; /* link in parent's dependents list */
375 struct list_head pending_ops; /* unstarted operations on this object */
376 pgoff_t store_limit; /* current storage limit */
377};
378
379extern const char *fscache_object_states[];
380
381#define fscache_object_is_active(obj) \
382 (!test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \
383 (obj)->state >= FSCACHE_OBJECT_AVAILABLE && \
384 (obj)->state < FSCACHE_OBJECT_DYING)
385
386extern const struct slow_work_ops fscache_object_slow_work_ops;
387
388/**
389 * fscache_object_init - Initialise a cache object description
390 * @object: Object description
391 *
392 * Initialise a cache object description to its basic values.
393 *
394 * See Documentation/filesystems/caching/backend-api.txt for a complete
395 * description.
396 */
397static inline
398void fscache_object_init(struct fscache_object *object,
399 struct fscache_cookie *cookie,
400 struct fscache_cache *cache)
401{
402 atomic_inc(&cache->object_count);
403
404 object->state = FSCACHE_OBJECT_INIT;
405 spin_lock_init(&object->lock);
406 INIT_LIST_HEAD(&object->cache_link);
407 INIT_HLIST_NODE(&object->cookie_link);
408 vslow_work_init(&object->work, &fscache_object_slow_work_ops);
409 INIT_LIST_HEAD(&object->dependents);
410 INIT_LIST_HEAD(&object->dep_link);
411 INIT_LIST_HEAD(&object->pending_ops);
412 object->n_children = 0;
413 object->n_ops = object->n_in_progress = object->n_exclusive = 0;
414 object->events = object->event_mask = 0;
415 object->flags = 0;
416 object->store_limit = 0;
417 object->cache = cache;
418 object->cookie = cookie;
419 object->parent = NULL;
420}
421
422extern void fscache_object_lookup_negative(struct fscache_object *object);
423extern void fscache_obtained_object(struct fscache_object *object);
424
425/**
426 * fscache_object_destroyed - Note destruction of an object in a cache
427 * @cache: The cache from which the object came
428 *
429 * Note the destruction and deallocation of an object record in a cache.
430 */
431static inline void fscache_object_destroyed(struct fscache_cache *cache)
432{
433 if (atomic_dec_and_test(&cache->object_count))
434 wake_up_all(&fscache_cache_cleared_wq);
435}
436
437/**
438 * fscache_object_lookup_error - Note an object encountered an error
439 * @object: The object on which the error was encountered
440 *
441 * Note that an object encountered a fatal error (usually an I/O error) and
442 * that it should be withdrawn as soon as possible.
443 */
444static inline void fscache_object_lookup_error(struct fscache_object *object)
445{
446 set_bit(FSCACHE_OBJECT_EV_ERROR, &object->events);
447}
448
449/**
450 * fscache_set_store_limit - Set the maximum size to be stored in an object
451 * @object: The object to set the maximum on
452 * @i_size: The limit to set in bytes
453 *
454 * Set the maximum size an object is permitted to reach, implying the highest
455 * byte that may be written. Intended to be called by the attr_changed() op.
456 *
457 * See Documentation/filesystems/caching/backend-api.txt for a complete
458 * description.
459 */
460static inline
461void fscache_set_store_limit(struct fscache_object *object, loff_t i_size)
462{
463 object->store_limit = i_size >> PAGE_SHIFT;
464 if (i_size & ~PAGE_MASK)
465 object->store_limit++;
466}
467
468/**
469 * fscache_end_io - End a retrieval operation on a page
470 * @op: The FS-Cache operation covering the retrieval
471 * @page: The page that was to be fetched
472 * @error: The error code (0 if successful)
473 *
474 * Note the end of an operation to retrieve a page, as covered by a particular
475 * operation record.
476 */
477static inline void fscache_end_io(struct fscache_retrieval *op,
478 struct page *page, int error)
479{
480 op->end_io_func(page, op->context, error);
481}
482
483/*
484 * out-of-line cache backend functions
485 */
486extern void fscache_init_cache(struct fscache_cache *cache,
487 const struct fscache_cache_ops *ops,
488 const char *idfmt,
489 ...) __attribute__ ((format (printf, 3, 4)));
490
491extern int fscache_add_cache(struct fscache_cache *cache,
492 struct fscache_object *fsdef,
493 const char *tagname);
494extern void fscache_withdraw_cache(struct fscache_cache *cache);
495
496extern void fscache_io_error(struct fscache_cache *cache);
497
498extern void fscache_mark_pages_cached(struct fscache_retrieval *op,
499 struct pagevec *pagevec);
500
501extern enum fscache_checkaux fscache_check_aux(struct fscache_object *object,
502 const void *data,
503 uint16_t datalen);
504
505#endif /* _LINUX_FSCACHE_CACHE_H */
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
new file mode 100644
index 000000000000..6d8ee466e0a0
--- /dev/null
+++ b/include/linux/fscache.h
@@ -0,0 +1,618 @@
1/* General filesystem caching interface
2 *
3 * Copyright (C) 2004-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 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 * NOTE!!! See:
12 *
13 * Documentation/filesystems/caching/netfs-api.txt
14 *
15 * for a description of the network filesystem interface declared here.
16 */
17
18#ifndef _LINUX_FSCACHE_H
19#define _LINUX_FSCACHE_H
20
21#include <linux/fs.h>
22#include <linux/list.h>
23#include <linux/pagemap.h>
24#include <linux/pagevec.h>
25
26#if defined(CONFIG_FSCACHE) || defined(CONFIG_FSCACHE_MODULE)
27#define fscache_available() (1)
28#define fscache_cookie_valid(cookie) (cookie)
29#else
30#define fscache_available() (0)
31#define fscache_cookie_valid(cookie) (0)
32#endif
33
34
35/*
36 * overload PG_private_2 to give us PG_fscache - this is used to indicate that
37 * a page is currently backed by a local disk cache
38 */
39#define PageFsCache(page) PagePrivate2((page))
40#define SetPageFsCache(page) SetPagePrivate2((page))
41#define ClearPageFsCache(page) ClearPagePrivate2((page))
42#define TestSetPageFsCache(page) TestSetPagePrivate2((page))
43#define TestClearPageFsCache(page) TestClearPagePrivate2((page))
44
45/* pattern used to fill dead space in an index entry */
46#define FSCACHE_INDEX_DEADFILL_PATTERN 0x79
47
48struct pagevec;
49struct fscache_cache_tag;
50struct fscache_cookie;
51struct fscache_netfs;
52
53typedef void (*fscache_rw_complete_t)(struct page *page,
54 void *context,
55 int error);
56
57/* result of index entry consultation */
58enum fscache_checkaux {
59 FSCACHE_CHECKAUX_OKAY, /* entry okay as is */
60 FSCACHE_CHECKAUX_NEEDS_UPDATE, /* entry requires update */
61 FSCACHE_CHECKAUX_OBSOLETE, /* entry requires deletion */
62};
63
64/*
65 * fscache cookie definition
66 */
67struct fscache_cookie_def {
68 /* name of cookie type */
69 char name[16];
70
71 /* cookie type */
72 uint8_t type;
73#define FSCACHE_COOKIE_TYPE_INDEX 0
74#define FSCACHE_COOKIE_TYPE_DATAFILE 1
75
76 /* select the cache into which to insert an entry in this index
77 * - optional
78 * - should return a cache identifier or NULL to cause the cache to be
79 * inherited from the parent if possible or the first cache picked
80 * for a non-index file if not
81 */
82 struct fscache_cache_tag *(*select_cache)(
83 const void *parent_netfs_data,
84 const void *cookie_netfs_data);
85
86 /* get an index key
87 * - should store the key data in the buffer
88 * - should return the amount of amount stored
89 * - not permitted to return an error
90 * - the netfs data from the cookie being used as the source is
91 * presented
92 */
93 uint16_t (*get_key)(const void *cookie_netfs_data,
94 void *buffer,
95 uint16_t bufmax);
96
97 /* get certain file attributes from the netfs data
98 * - this function can be absent for an index
99 * - not permitted to return an error
100 * - the netfs data from the cookie being used as the source is
101 * presented
102 */
103 void (*get_attr)(const void *cookie_netfs_data, uint64_t *size);
104
105 /* get the auxilliary data from netfs data
106 * - this function can be absent if the index carries no state data
107 * - should store the auxilliary data in the buffer
108 * - should return the amount of amount stored
109 * - not permitted to return an error
110 * - the netfs data from the cookie being used as the source is
111 * presented
112 */
113 uint16_t (*get_aux)(const void *cookie_netfs_data,
114 void *buffer,
115 uint16_t bufmax);
116
117 /* consult the netfs about the state of an object
118 * - this function can be absent if the index carries no state data
119 * - the netfs data from the cookie being used as the target is
120 * presented, as is the auxilliary data
121 */
122 enum fscache_checkaux (*check_aux)(void *cookie_netfs_data,
123 const void *data,
124 uint16_t datalen);
125
126 /* get an extra reference on a read context
127 * - this function can be absent if the completion function doesn't
128 * require a context
129 */
130 void (*get_context)(void *cookie_netfs_data, void *context);
131
132 /* release an extra reference on a read context
133 * - this function can be absent if the completion function doesn't
134 * require a context
135 */
136 void (*put_context)(void *cookie_netfs_data, void *context);
137
138 /* indicate pages that now have cache metadata retained
139 * - this function should mark the specified pages as now being cached
140 * - the pages will have been marked with PG_fscache before this is
141 * called, so this is optional
142 */
143 void (*mark_pages_cached)(void *cookie_netfs_data,
144 struct address_space *mapping,
145 struct pagevec *cached_pvec);
146
147 /* indicate the cookie is no longer cached
148 * - this function is called when the backing store currently caching
149 * a cookie is removed
150 * - the netfs should use this to clean up any markers indicating
151 * cached pages
152 * - this is mandatory for any object that may have data
153 */
154 void (*now_uncached)(void *cookie_netfs_data);
155};
156
157/*
158 * fscache cached network filesystem type
159 * - name, version and ops must be filled in before registration
160 * - all other fields will be set during registration
161 */
162struct fscache_netfs {
163 uint32_t version; /* indexing version */
164 const char *name; /* filesystem name */
165 struct fscache_cookie *primary_index;
166 struct list_head link; /* internal link */
167};
168
169/*
170 * slow-path functions for when there is actually caching available, and the
171 * netfs does actually have a valid token
172 * - these are not to be called directly
173 * - these are undefined symbols when FS-Cache is not configured and the
174 * optimiser takes care of not using them
175 */
176extern int __fscache_register_netfs(struct fscache_netfs *);
177extern void __fscache_unregister_netfs(struct fscache_netfs *);
178extern struct fscache_cache_tag *__fscache_lookup_cache_tag(const char *);
179extern void __fscache_release_cache_tag(struct fscache_cache_tag *);
180
181extern struct fscache_cookie *__fscache_acquire_cookie(
182 struct fscache_cookie *,
183 const struct fscache_cookie_def *,
184 void *);
185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int);
186extern void __fscache_update_cookie(struct fscache_cookie *);
187extern int __fscache_attr_changed(struct fscache_cookie *);
188extern int __fscache_read_or_alloc_page(struct fscache_cookie *,
189 struct page *,
190 fscache_rw_complete_t,
191 void *,
192 gfp_t);
193extern int __fscache_read_or_alloc_pages(struct fscache_cookie *,
194 struct address_space *,
195 struct list_head *,
196 unsigned *,
197 fscache_rw_complete_t,
198 void *,
199 gfp_t);
200extern int __fscache_alloc_page(struct fscache_cookie *, struct page *, gfp_t);
201extern int __fscache_write_page(struct fscache_cookie *, struct page *, gfp_t);
202extern void __fscache_uncache_page(struct fscache_cookie *, struct page *);
203extern bool __fscache_check_page_write(struct fscache_cookie *, struct page *);
204extern void __fscache_wait_on_page_write(struct fscache_cookie *, struct page *);
205
206/**
207 * fscache_register_netfs - Register a filesystem as desiring caching services
208 * @netfs: The description of the filesystem
209 *
210 * Register a filesystem as desiring caching services if they're available.
211 *
212 * See Documentation/filesystems/caching/netfs-api.txt for a complete
213 * description.
214 */
215static inline
216int fscache_register_netfs(struct fscache_netfs *netfs)
217{
218 if (fscache_available())
219 return __fscache_register_netfs(netfs);
220 else
221 return 0;
222}
223
224/**
225 * fscache_unregister_netfs - Indicate that a filesystem no longer desires
226 * caching services
227 * @netfs: The description of the filesystem
228 *
229 * Indicate that a filesystem no longer desires caching services for the
230 * moment.
231 *
232 * See Documentation/filesystems/caching/netfs-api.txt for a complete
233 * description.
234 */
235static inline
236void fscache_unregister_netfs(struct fscache_netfs *netfs)
237{
238 if (fscache_available())
239 __fscache_unregister_netfs(netfs);
240}
241
242/**
243 * fscache_lookup_cache_tag - Look up a cache tag
244 * @name: The name of the tag to search for
245 *
246 * Acquire a specific cache referral tag that can be used to select a specific
247 * cache in which to cache an index.
248 *
249 * See Documentation/filesystems/caching/netfs-api.txt for a complete
250 * description.
251 */
252static inline
253struct fscache_cache_tag *fscache_lookup_cache_tag(const char *name)
254{
255 if (fscache_available())
256 return __fscache_lookup_cache_tag(name);
257 else
258 return NULL;
259}
260
261/**
262 * fscache_release_cache_tag - Release a cache tag
263 * @tag: The tag to release
264 *
265 * Release a reference to a cache referral tag previously looked up.
266 *
267 * See Documentation/filesystems/caching/netfs-api.txt for a complete
268 * description.
269 */
270static inline
271void fscache_release_cache_tag(struct fscache_cache_tag *tag)
272{
273 if (fscache_available())
274 __fscache_release_cache_tag(tag);
275}
276
277/**
278 * fscache_acquire_cookie - Acquire a cookie to represent a cache object
279 * @parent: The cookie that's to be the parent of this one
280 * @def: A description of the cache object, including callback operations
281 * @netfs_data: An arbitrary piece of data to be kept in the cookie to
282 * represent the cache object to the netfs
283 *
284 * This function is used to inform FS-Cache about part of an index hierarchy
285 * that can be used to locate files. This is done by requesting a cookie for
286 * each index in the path to the file.
287 *
288 * See Documentation/filesystems/caching/netfs-api.txt for a complete
289 * description.
290 */
291static inline
292struct fscache_cookie *fscache_acquire_cookie(
293 struct fscache_cookie *parent,
294 const struct fscache_cookie_def *def,
295 void *netfs_data)
296{
297 if (fscache_cookie_valid(parent))
298 return __fscache_acquire_cookie(parent, def, netfs_data);
299 else
300 return NULL;
301}
302
303/**
304 * fscache_relinquish_cookie - Return the cookie to the cache, maybe discarding
305 * it
306 * @cookie: The cookie being returned
307 * @retire: True if the cache object the cookie represents is to be discarded
308 *
309 * This function returns a cookie to the cache, forcibly discarding the
310 * associated cache object if retire is set to true.
311 *
312 * See Documentation/filesystems/caching/netfs-api.txt for a complete
313 * description.
314 */
315static inline
316void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
317{
318 if (fscache_cookie_valid(cookie))
319 __fscache_relinquish_cookie(cookie, retire);
320}
321
322/**
323 * fscache_update_cookie - Request that a cache object be updated
324 * @cookie: The cookie representing the cache object
325 *
326 * Request an update of the index data for the cache object associated with the
327 * cookie.
328 *
329 * See Documentation/filesystems/caching/netfs-api.txt for a complete
330 * description.
331 */
332static inline
333void fscache_update_cookie(struct fscache_cookie *cookie)
334{
335 if (fscache_cookie_valid(cookie))
336 __fscache_update_cookie(cookie);
337}
338
339/**
340 * fscache_pin_cookie - Pin a data-storage cache object in its cache
341 * @cookie: The cookie representing the cache object
342 *
343 * Permit data-storage cache objects to be pinned in the cache.
344 *
345 * See Documentation/filesystems/caching/netfs-api.txt for a complete
346 * description.
347 */
348static inline
349int fscache_pin_cookie(struct fscache_cookie *cookie)
350{
351 return -ENOBUFS;
352}
353
354/**
355 * fscache_pin_cookie - Unpin a data-storage cache object in its cache
356 * @cookie: The cookie representing the cache object
357 *
358 * Permit data-storage cache objects to be unpinned from the cache.
359 *
360 * See Documentation/filesystems/caching/netfs-api.txt for a complete
361 * description.
362 */
363static inline
364void fscache_unpin_cookie(struct fscache_cookie *cookie)
365{
366}
367
368/**
369 * fscache_attr_changed - Notify cache that an object's attributes changed
370 * @cookie: The cookie representing the cache object
371 *
372 * Send a notification to the cache indicating that an object's attributes have
373 * changed. This includes the data size. These attributes will be obtained
374 * through the get_attr() cookie definition op.
375 *
376 * See Documentation/filesystems/caching/netfs-api.txt for a complete
377 * description.
378 */
379static inline
380int fscache_attr_changed(struct fscache_cookie *cookie)
381{
382 if (fscache_cookie_valid(cookie))
383 return __fscache_attr_changed(cookie);
384 else
385 return -ENOBUFS;
386}
387
388/**
389 * fscache_reserve_space - Reserve data space for a cached object
390 * @cookie: The cookie representing the cache object
391 * @i_size: The amount of space to be reserved
392 *
393 * Reserve an amount of space in the cache for the cache object attached to a
394 * cookie so that a write to that object within the space can always be
395 * honoured.
396 *
397 * See Documentation/filesystems/caching/netfs-api.txt for a complete
398 * description.
399 */
400static inline
401int fscache_reserve_space(struct fscache_cookie *cookie, loff_t size)
402{
403 return -ENOBUFS;
404}
405
406/**
407 * fscache_read_or_alloc_page - Read a page from the cache or allocate a block
408 * in which to store it
409 * @cookie: The cookie representing the cache object
410 * @page: The netfs page to fill if possible
411 * @end_io_func: The callback to invoke when and if the page is filled
412 * @context: An arbitrary piece of data to pass on to end_io_func()
413 * @gfp: The conditions under which memory allocation should be made
414 *
415 * Read a page from the cache, or if that's not possible make a potential
416 * one-block reservation in the cache into which the page may be stored once
417 * fetched from the server.
418 *
419 * If the page is not backed by the cache object, or if it there's some reason
420 * it can't be, -ENOBUFS will be returned and nothing more will be done for
421 * that page.
422 *
423 * Else, if that page is backed by the cache, a read will be initiated directly
424 * to the netfs's page and 0 will be returned by this function. The
425 * end_io_func() callback will be invoked when the operation terminates on a
426 * completion or failure. Note that the callback may be invoked before the
427 * return.
428 *
429 * Else, if the page is unbacked, -ENODATA is returned and a block may have
430 * been allocated in the cache.
431 *
432 * See Documentation/filesystems/caching/netfs-api.txt for a complete
433 * description.
434 */
435static inline
436int fscache_read_or_alloc_page(struct fscache_cookie *cookie,
437 struct page *page,
438 fscache_rw_complete_t end_io_func,
439 void *context,
440 gfp_t gfp)
441{
442 if (fscache_cookie_valid(cookie))
443 return __fscache_read_or_alloc_page(cookie, page, end_io_func,
444 context, gfp);
445 else
446 return -ENOBUFS;
447}
448
449/**
450 * fscache_read_or_alloc_pages - Read pages from the cache and/or allocate
451 * blocks in which to store them
452 * @cookie: The cookie representing the cache object
453 * @mapping: The netfs inode mapping to which the pages will be attached
454 * @pages: A list of potential netfs pages to be filled
455 * @end_io_func: The callback to invoke when and if each page is filled
456 * @context: An arbitrary piece of data to pass on to end_io_func()
457 * @gfp: The conditions under which memory allocation should be made
458 *
459 * Read a set of pages from the cache, or if that's not possible, attempt to
460 * make a potential one-block reservation for each page in the cache into which
461 * that page may be stored once fetched from the server.
462 *
463 * If some pages are not backed by the cache object, or if it there's some
464 * reason they can't be, -ENOBUFS will be returned and nothing more will be
465 * done for that pages.
466 *
467 * Else, if some of the pages are backed by the cache, a read will be initiated
468 * directly to the netfs's page and 0 will be returned by this function. The
469 * end_io_func() callback will be invoked when the operation terminates on a
470 * completion or failure. Note that the callback may be invoked before the
471 * return.
472 *
473 * Else, if a page is unbacked, -ENODATA is returned and a block may have
474 * been allocated in the cache.
475 *
476 * Because the function may want to return all of -ENOBUFS, -ENODATA and 0 in
477 * regard to different pages, the return values are prioritised in that order.
478 * Any pages submitted for reading are removed from the pages list.
479 *
480 * See Documentation/filesystems/caching/netfs-api.txt for a complete
481 * description.
482 */
483static inline
484int fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
485 struct address_space *mapping,
486 struct list_head *pages,
487 unsigned *nr_pages,
488 fscache_rw_complete_t end_io_func,
489 void *context,
490 gfp_t gfp)
491{
492 if (fscache_cookie_valid(cookie))
493 return __fscache_read_or_alloc_pages(cookie, mapping, pages,
494 nr_pages, end_io_func,
495 context, gfp);
496 else
497 return -ENOBUFS;
498}
499
500/**
501 * fscache_alloc_page - Allocate a block in which to store a page
502 * @cookie: The cookie representing the cache object
503 * @page: The netfs page to allocate a page for
504 * @gfp: The conditions under which memory allocation should be made
505 *
506 * Request Allocation a block in the cache in which to store a netfs page
507 * without retrieving any contents from the cache.
508 *
509 * If the page is not backed by a file then -ENOBUFS will be returned and
510 * nothing more will be done, and no reservation will be made.
511 *
512 * Else, a block will be allocated if one wasn't already, and 0 will be
513 * returned
514 *
515 * See Documentation/filesystems/caching/netfs-api.txt for a complete
516 * description.
517 */
518static inline
519int fscache_alloc_page(struct fscache_cookie *cookie,
520 struct page *page,
521 gfp_t gfp)
522{
523 if (fscache_cookie_valid(cookie))
524 return __fscache_alloc_page(cookie, page, gfp);
525 else
526 return -ENOBUFS;
527}
528
529/**
530 * fscache_write_page - Request storage of a page in the cache
531 * @cookie: The cookie representing the cache object
532 * @page: The netfs page to store
533 * @gfp: The conditions under which memory allocation should be made
534 *
535 * Request the contents of the netfs page be written into the cache. This
536 * request may be ignored if no cache block is currently allocated, in which
537 * case it will return -ENOBUFS.
538 *
539 * If a cache block was already allocated, a write will be initiated and 0 will
540 * be returned. The PG_fscache_write page bit is set immediately and will then
541 * be cleared at the completion of the write to indicate the success or failure
542 * of the operation. Note that the completion may happen before the return.
543 *
544 * See Documentation/filesystems/caching/netfs-api.txt for a complete
545 * description.
546 */
547static inline
548int fscache_write_page(struct fscache_cookie *cookie,
549 struct page *page,
550 gfp_t gfp)
551{
552 if (fscache_cookie_valid(cookie))
553 return __fscache_write_page(cookie, page, gfp);
554 else
555 return -ENOBUFS;
556}
557
558/**
559 * fscache_uncache_page - Indicate that caching is no longer required on a page
560 * @cookie: The cookie representing the cache object
561 * @page: The netfs page that was being cached.
562 *
563 * Tell the cache that we no longer want a page to be cached and that it should
564 * remove any knowledge of the netfs page it may have.
565 *
566 * Note that this cannot cancel any outstanding I/O operations between this
567 * page and the cache.
568 *
569 * See Documentation/filesystems/caching/netfs-api.txt for a complete
570 * description.
571 */
572static inline
573void fscache_uncache_page(struct fscache_cookie *cookie,
574 struct page *page)
575{
576 if (fscache_cookie_valid(cookie))
577 __fscache_uncache_page(cookie, page);
578}
579
580/**
581 * fscache_check_page_write - Ask if a page is being writing to the cache
582 * @cookie: The cookie representing the cache object
583 * @page: The netfs page that is being cached.
584 *
585 * Ask the cache if a page is being written to the cache.
586 *
587 * See Documentation/filesystems/caching/netfs-api.txt for a complete
588 * description.
589 */
590static inline
591bool fscache_check_page_write(struct fscache_cookie *cookie,
592 struct page *page)
593{
594 if (fscache_cookie_valid(cookie))
595 return __fscache_check_page_write(cookie, page);
596 return false;
597}
598
599/**
600 * fscache_wait_on_page_write - Wait for a page to complete writing to the cache
601 * @cookie: The cookie representing the cache object
602 * @page: The netfs page that is being cached.
603 *
604 * Ask the cache to wake us up when a page is no longer being written to the
605 * cache.
606 *
607 * See Documentation/filesystems/caching/netfs-api.txt for a complete
608 * description.
609 */
610static inline
611void fscache_wait_on_page_write(struct fscache_cookie *cookie,
612 struct page *page)
613{
614 if (fscache_cookie_valid(cookie))
615 __fscache_wait_on_page_write(cookie, page);
616}
617
618#endif /* _LINUX_FSCACHE_H */
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index d9051d717d27..244677cc082b 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -18,7 +18,6 @@
18#define _FSL_DEVICE_H_ 18#define _FSL_DEVICE_H_
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/phy.h>
22 21
23/* 22/*
24 * Some conventions on how we handle peripherals on Freescale chips 23 * Some conventions on how we handle peripherals on Freescale chips
@@ -44,31 +43,6 @@
44 * 43 *
45 */ 44 */
46 45
47struct gianfar_platform_data {
48 /* device specific information */
49 u32 device_flags;
50 char bus_id[BUS_ID_SIZE];
51 phy_interface_t interface;
52};
53
54struct gianfar_mdio_data {
55 /* board specific information */
56 int irq[32];
57};
58
59/* Flags in gianfar_platform_data */
60#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */
61#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */
62
63struct fsl_i2c_platform_data {
64 /* device specific information */
65 u32 device_flags;
66};
67
68/* Flags related to I2C device features */
69#define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001
70#define FSL_I2C_DEV_CLOCK_5200 0x00000002
71
72enum fsl_usb2_operating_modes { 46enum fsl_usb2_operating_modes {
73 FSL_USB2_MPH_HOST, 47 FSL_USB2_MPH_HOST,
74 FSL_USB2_DR_HOST, 48 FSL_USB2_DR_HOST,
@@ -95,15 +69,20 @@ struct fsl_usb2_platform_data {
95#define FSL_USB2_PORT0_ENABLED 0x00000001 69#define FSL_USB2_PORT0_ENABLED 0x00000001
96#define FSL_USB2_PORT1_ENABLED 0x00000002 70#define FSL_USB2_PORT1_ENABLED 0x00000002
97 71
72struct spi_device;
73
98struct fsl_spi_platform_data { 74struct fsl_spi_platform_data {
99 u32 initial_spmode; /* initial SPMODE value */ 75 u32 initial_spmode; /* initial SPMODE value */
100 u16 bus_num; 76 s16 bus_num;
101 bool qe_mode; 77 bool qe_mode;
102 /* board specific information */ 78 /* board specific information */
103 u16 max_chipselect; 79 u16 max_chipselect;
80 void (*cs_control)(struct spi_device *spi, bool on);
81 u32 sysclk;
82
83 /* Legacy hooks, used by mpc52xx_psc_spi driver. */
104 void (*activate_cs)(u8 cs, u8 polarity); 84 void (*activate_cs)(u8 cs, u8 polarity);
105 void (*deactivate_cs)(u8 cs, u8 polarity); 85 void (*deactivate_cs)(u8 cs, u8 polarity);
106 u32 sysclk;
107}; 86};
108 87
109struct mpc8xx_pcmcia_ops { 88struct mpc8xx_pcmcia_ops {
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 677432b9cb7e..8a0c2f221e6b 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -1,15 +1,18 @@
1#ifndef _LINUX_FTRACE_H 1#ifndef _LINUX_FTRACE_H
2#define _LINUX_FTRACE_H 2#define _LINUX_FTRACE_H
3 3
4#include <linux/linkage.h> 4#include <linux/trace_clock.h>
5#include <linux/fs.h>
6#include <linux/ktime.h>
7#include <linux/init.h>
8#include <linux/types.h>
9#include <linux/module.h>
10#include <linux/kallsyms.h> 5#include <linux/kallsyms.h>
6#include <linux/linkage.h>
11#include <linux/bitops.h> 7#include <linux/bitops.h>
8#include <linux/module.h>
9#include <linux/ktime.h>
12#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/fs.h>
14
15#include <asm/ftrace.h>
13 16
14#ifdef CONFIG_FUNCTION_TRACER 17#ifdef CONFIG_FUNCTION_TRACER
15 18
@@ -95,9 +98,41 @@ stack_trace_sysctl(struct ctl_table *table, int write,
95 loff_t *ppos); 98 loff_t *ppos);
96#endif 99#endif
97 100
101struct ftrace_func_command {
102 struct list_head list;
103 char *name;
104 int (*func)(char *func, char *cmd,
105 char *params, int enable);
106};
107
98#ifdef CONFIG_DYNAMIC_FTRACE 108#ifdef CONFIG_DYNAMIC_FTRACE
99/* asm/ftrace.h must be defined for archs supporting dynamic ftrace */ 109
100#include <asm/ftrace.h> 110int ftrace_arch_code_modify_prepare(void);
111int ftrace_arch_code_modify_post_process(void);
112
113struct seq_file;
114
115struct ftrace_probe_ops {
116 void (*func)(unsigned long ip,
117 unsigned long parent_ip,
118 void **data);
119 int (*callback)(unsigned long ip, void **data);
120 void (*free)(void **data);
121 int (*print)(struct seq_file *m,
122 unsigned long ip,
123 struct ftrace_probe_ops *ops,
124 void *data);
125};
126
127extern int
128register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
129 void *data);
130extern void
131unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
132 void *data);
133extern void
134unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
135extern void unregister_ftrace_function_probe_all(char *glob);
101 136
102enum { 137enum {
103 FTRACE_FL_FREE = (1 << 0), 138 FTRACE_FL_FREE = (1 << 0),
@@ -110,15 +145,23 @@ enum {
110}; 145};
111 146
112struct dyn_ftrace { 147struct dyn_ftrace {
113 struct list_head list; 148 union {
114 unsigned long ip; /* address of mcount call-site */ 149 unsigned long ip; /* address of mcount call-site */
115 unsigned long flags; 150 struct dyn_ftrace *freelist;
116 struct dyn_arch_ftrace arch; 151 };
152 union {
153 unsigned long flags;
154 struct dyn_ftrace *newlist;
155 };
156 struct dyn_arch_ftrace arch;
117}; 157};
118 158
119int ftrace_force_update(void); 159int ftrace_force_update(void);
120void ftrace_set_filter(unsigned char *buf, int len, int reset); 160void ftrace_set_filter(unsigned char *buf, int len, int reset);
121 161
162int register_ftrace_command(struct ftrace_func_command *cmd);
163int unregister_ftrace_command(struct ftrace_func_command *cmd);
164
122/* defined in arch */ 165/* defined in arch */
123extern int ftrace_ip_converted(unsigned long ip); 166extern int ftrace_ip_converted(unsigned long ip);
124extern int ftrace_dyn_arch_init(void *data); 167extern int ftrace_dyn_arch_init(void *data);
@@ -126,6 +169,10 @@ extern int ftrace_update_ftrace_func(ftrace_func_t func);
126extern void ftrace_caller(void); 169extern void ftrace_caller(void);
127extern void ftrace_call(void); 170extern void ftrace_call(void);
128extern void mcount_call(void); 171extern void mcount_call(void);
172
173#ifndef FTRACE_ADDR
174#define FTRACE_ADDR ((unsigned long)ftrace_caller)
175#endif
129#ifdef CONFIG_FUNCTION_GRAPH_TRACER 176#ifdef CONFIG_FUNCTION_GRAPH_TRACER
130extern void ftrace_graph_caller(void); 177extern void ftrace_graph_caller(void);
131extern int ftrace_enable_ftrace_graph_caller(void); 178extern int ftrace_enable_ftrace_graph_caller(void);
@@ -136,7 +183,7 @@ static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; }
136#endif 183#endif
137 184
138/** 185/**
139 * ftrace_make_nop - convert code into top 186 * ftrace_make_nop - convert code into nop
140 * @mod: module structure if called by module load initialization 187 * @mod: module structure if called by module load initialization
141 * @rec: the mcount call site record 188 * @rec: the mcount call site record
142 * @addr: the address that the call site should be calling 189 * @addr: the address that the call site should be calling
@@ -181,7 +228,6 @@ extern int ftrace_make_nop(struct module *mod,
181 */ 228 */
182extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); 229extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
183 230
184
185/* May be defined in arch */ 231/* May be defined in arch */
186extern int ftrace_arch_read_dyn_info(char *buf, int size); 232extern int ftrace_arch_read_dyn_info(char *buf, int size);
187 233
@@ -198,6 +244,14 @@ extern void ftrace_enable_daemon(void);
198# define ftrace_disable_daemon() do { } while (0) 244# define ftrace_disable_daemon() do { } while (0)
199# define ftrace_enable_daemon() do { } while (0) 245# define ftrace_enable_daemon() do { } while (0)
200static inline void ftrace_release(void *start, unsigned long size) { } 246static inline void ftrace_release(void *start, unsigned long size) { }
247static inline int register_ftrace_command(struct ftrace_func_command *cmd)
248{
249 return -EINVAL;
250}
251static inline int unregister_ftrace_command(char *cmd_name)
252{
253 return -EINVAL;
254}
201#endif /* CONFIG_DYNAMIC_FTRACE */ 255#endif /* CONFIG_DYNAMIC_FTRACE */
202 256
203/* totally disable ftrace - can not re-enable after this */ 257/* totally disable ftrace - can not re-enable after this */
@@ -233,24 +287,25 @@ static inline void __ftrace_enabled_restore(int enabled)
233#endif 287#endif
234} 288}
235 289
236#ifdef CONFIG_FRAME_POINTER 290#ifndef HAVE_ARCH_CALLER_ADDR
237/* TODO: need to fix this for ARM */ 291# ifdef CONFIG_FRAME_POINTER
238# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) 292# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
239# define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1)) 293# define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
240# define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2)) 294# define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
241# define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3)) 295# define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
242# define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4)) 296# define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
243# define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5)) 297# define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
244# define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6)) 298# define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
245#else 299# else
246# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) 300# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
247# define CALLER_ADDR1 0UL 301# define CALLER_ADDR1 0UL
248# define CALLER_ADDR2 0UL 302# define CALLER_ADDR2 0UL
249# define CALLER_ADDR3 0UL 303# define CALLER_ADDR3 0UL
250# define CALLER_ADDR4 0UL 304# define CALLER_ADDR4 0UL
251# define CALLER_ADDR5 0UL 305# define CALLER_ADDR5 0UL
252# define CALLER_ADDR6 0UL 306# define CALLER_ADDR6 0UL
253#endif 307# endif
308#endif /* ifndef HAVE_ARCH_CALLER_ADDR */
254 309
255#ifdef CONFIG_IRQSOFF_TRACER 310#ifdef CONFIG_IRQSOFF_TRACER
256 extern void time_hardirqs_on(unsigned long a0, unsigned long a1); 311 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
@@ -268,54 +323,6 @@ static inline void __ftrace_enabled_restore(int enabled)
268# define trace_preempt_off(a0, a1) do { } while (0) 323# define trace_preempt_off(a0, a1) do { } while (0)
269#endif 324#endif
270 325
271#ifdef CONFIG_TRACING
272extern int ftrace_dump_on_oops;
273
274extern void tracing_start(void);
275extern void tracing_stop(void);
276extern void ftrace_off_permanent(void);
277
278extern void
279ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
280
281/**
282 * ftrace_printk - printf formatting in the ftrace buffer
283 * @fmt: the printf format for printing
284 *
285 * Note: __ftrace_printk is an internal function for ftrace_printk and
286 * the @ip is passed in via the ftrace_printk macro.
287 *
288 * This function allows a kernel developer to debug fast path sections
289 * that printk is not appropriate for. By scattering in various
290 * printk like tracing in the code, a developer can quickly see
291 * where problems are occurring.
292 *
293 * This is intended as a debugging tool for the developer only.
294 * Please refrain from leaving ftrace_printks scattered around in
295 * your code.
296 */
297# define ftrace_printk(fmt...) __ftrace_printk(_THIS_IP_, fmt)
298extern int
299__ftrace_printk(unsigned long ip, const char *fmt, ...)
300 __attribute__ ((format (printf, 2, 3)));
301extern void ftrace_dump(void);
302#else
303static inline void
304ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
305static inline int
306ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
307
308static inline void tracing_start(void) { }
309static inline void tracing_stop(void) { }
310static inline void ftrace_off_permanent(void) { }
311static inline int
312ftrace_printk(const char *fmt, ...)
313{
314 return 0;
315}
316static inline void ftrace_dump(void) { }
317#endif
318
319#ifdef CONFIG_FTRACE_MCOUNT_RECORD 326#ifdef CONFIG_FTRACE_MCOUNT_RECORD
320extern void ftrace_init(void); 327extern void ftrace_init(void);
321extern void ftrace_init_module(struct module *mod, 328extern void ftrace_init_module(struct module *mod,
@@ -327,36 +334,6 @@ ftrace_init_module(struct module *mod,
327 unsigned long *start, unsigned long *end) { } 334 unsigned long *start, unsigned long *end) { }
328#endif 335#endif
329 336
330enum {
331 POWER_NONE = 0,
332 POWER_CSTATE = 1,
333 POWER_PSTATE = 2,
334};
335
336struct power_trace {
337#ifdef CONFIG_POWER_TRACER
338 ktime_t stamp;
339 ktime_t end;
340 int type;
341 int state;
342#endif
343};
344
345#ifdef CONFIG_POWER_TRACER
346extern void trace_power_start(struct power_trace *it, unsigned int type,
347 unsigned int state);
348extern void trace_power_mark(struct power_trace *it, unsigned int type,
349 unsigned int state);
350extern void trace_power_end(struct power_trace *it);
351#else
352static inline void trace_power_start(struct power_trace *it, unsigned int type,
353 unsigned int state) { }
354static inline void trace_power_mark(struct power_trace *it, unsigned int type,
355 unsigned int state) { }
356static inline void trace_power_end(struct power_trace *it) { }
357#endif
358
359
360/* 337/*
361 * Structure that defines an entry function trace. 338 * Structure that defines an entry function trace.
362 */ 339 */
@@ -379,6 +356,32 @@ struct ftrace_graph_ret {
379 356
380#ifdef CONFIG_FUNCTION_GRAPH_TRACER 357#ifdef CONFIG_FUNCTION_GRAPH_TRACER
381 358
359/* for init task */
360#define INIT_FTRACE_GRAPH .ret_stack = NULL,
361
362/*
363 * Stack of return addresses for functions
364 * of a thread.
365 * Used in struct thread_info
366 */
367struct ftrace_ret_stack {
368 unsigned long ret;
369 unsigned long func;
370 unsigned long long calltime;
371};
372
373/*
374 * Primary handler of a function return.
375 * It relays on ftrace_return_to_handler.
376 * Defined in entry_32/64.S
377 */
378extern void return_to_handler(void);
379
380extern int
381ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth);
382extern void
383ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret);
384
382/* 385/*
383 * Sometimes we don't want to trace a function with the function 386 * Sometimes we don't want to trace a function with the function
384 * graph tracer but we want them to keep traced by the usual function 387 * graph tracer but we want them to keep traced by the usual function
@@ -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>
@@ -490,6 +494,21 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk)
490 return tsk->trace & TSK_TRACE_FL_GRAPH; 494 return tsk->trace & TSK_TRACE_FL_GRAPH;
491} 495}
492 496
497extern int ftrace_dump_on_oops;
498
493#endif /* CONFIG_TRACING */ 499#endif /* CONFIG_TRACING */
494 500
501
502#ifdef CONFIG_HW_BRANCH_TRACER
503
504void trace_hw_branch(u64 from, u64 to);
505void trace_hw_branch_oops(void);
506
507#else /* CONFIG_HW_BRANCH_TRACER */
508
509static inline void trace_hw_branch(u64 from, u64 to) {}
510static inline void trace_hw_branch_oops(void) {}
511
512#endif /* CONFIG_HW_BRANCH_TRACER */
513
495#endif /* _LINUX_FTRACE_H */ 514#endif /* _LINUX_FTRACE_H */
diff --git a/include/linux/ftrace_irq.h b/include/linux/ftrace_irq.h
index 366a054d0b05..dca7bf8cffe2 100644
--- a/include/linux/ftrace_irq.h
+++ b/include/linux/ftrace_irq.h
@@ -2,7 +2,7 @@
2#define _LINUX_FTRACE_IRQ_H 2#define _LINUX_FTRACE_IRQ_H
3 3
4 4
5#if defined(CONFIG_DYNAMIC_FTRACE) || defined(CONFIG_FUNCTION_GRAPH_TRACER) 5#ifdef CONFIG_FTRACE_NMI_ENTER
6extern void ftrace_nmi_enter(void); 6extern void ftrace_nmi_enter(void);
7extern void ftrace_nmi_exit(void); 7extern void ftrace_nmi_exit(void);
8#else 8#else
diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h
index 13f4e74609ac..0ffa41df0ee8 100644
--- a/include/linux/gen_stats.h
+++ b/include/linux/gen_stats.h
@@ -22,7 +22,7 @@ struct gnet_stats_basic
22{ 22{
23 __u64 bytes; 23 __u64 bytes;
24 __u32 packets; 24 __u32 packets;
25}; 25} __attribute__ ((packed));
26 26
27/** 27/**
28 * struct gnet_stats_rate_est - rate estimator 28 * struct gnet_stats_rate_est - rate estimator
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 16948eaecae3..a1a28caed23d 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -214,6 +214,7 @@ static inline void disk_put_part(struct hd_struct *part)
214#define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */ 214#define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */
215#define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */ 215#define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */
216#define DISK_PITER_INCL_PART0 (1 << 2) /* include partition 0 */ 216#define DISK_PITER_INCL_PART0 (1 << 2) /* include partition 0 */
217#define DISK_PITER_INCL_EMPTY_PART0 (1 << 3) /* include empty partition 0 */
217 218
218struct disk_part_iter { 219struct disk_part_iter {
219 struct gendisk *disk; 220 struct gendisk *disk;
@@ -333,11 +334,10 @@ static inline void part_dec_in_flight(struct hd_struct *part)
333 part_to_disk(part)->part0.in_flight--; 334 part_to_disk(part)->part0.in_flight--;
334} 335}
335 336
336/* drivers/block/ll_rw_blk.c */ 337/* block/blk-core.c */
337extern void part_round_stats(int cpu, struct hd_struct *part); 338extern void part_round_stats(int cpu, struct hd_struct *part);
338 339
339/* drivers/block/genhd.c */ 340/* block/genhd.c */
340extern int get_blkdev_list(char *, int);
341extern void add_disk(struct gendisk *disk); 341extern void add_disk(struct gendisk *disk);
342extern void del_gendisk(struct gendisk *gp); 342extern void del_gendisk(struct gendisk *gp);
343extern void unlink_gendisk(struct gendisk *gp); 343extern void unlink_gendisk(struct gendisk *gp);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index dd20cd78faa8..0bbc15f54536 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -4,6 +4,7 @@
4#include <linux/mmzone.h> 4#include <linux/mmzone.h>
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <linux/linkage.h> 6#include <linux/linkage.h>
7#include <linux/topology.h>
7 8
8struct vm_area_struct; 9struct vm_area_struct;
9 10
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index f83288347dda..45257475623c 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -15,55 +15,61 @@
15 * - bits 0-7 are the preemption count (max preemption depth: 256) 15 * - bits 0-7 are the preemption count (max preemption depth: 256)
16 * - bits 8-15 are the softirq count (max # of softirqs: 256) 16 * - bits 8-15 are the softirq count (max # of softirqs: 256)
17 * 17 *
18 * The hardirq count can be overridden per architecture, the default is: 18 * The hardirq count can in theory reach the same as NR_IRQS.
19 * In reality, the number of nested IRQS is limited to the stack
20 * size as well. For archs with over 1000 IRQS it is not practical
21 * to expect that they will all nest. We give a max of 10 bits for
22 * hardirq nesting. An arch may choose to give less than 10 bits.
23 * m68k expects it to be 8.
19 * 24 *
20 * - bits 16-27 are the hardirq count (max # of hardirqs: 4096) 25 * - bits 16-25 are the hardirq count (max # of nested hardirqs: 1024)
21 * - ( bit 28 is the PREEMPT_ACTIVE flag. ) 26 * - bit 26 is the NMI_MASK
27 * - bit 28 is the PREEMPT_ACTIVE flag
22 * 28 *
23 * PREEMPT_MASK: 0x000000ff 29 * PREEMPT_MASK: 0x000000ff
24 * SOFTIRQ_MASK: 0x0000ff00 30 * SOFTIRQ_MASK: 0x0000ff00
25 * HARDIRQ_MASK: 0x0fff0000 31 * HARDIRQ_MASK: 0x03ff0000
32 * NMI_MASK: 0x04000000
26 */ 33 */
27#define PREEMPT_BITS 8 34#define PREEMPT_BITS 8
28#define SOFTIRQ_BITS 8 35#define SOFTIRQ_BITS 8
36#define NMI_BITS 1
29 37
30#ifndef HARDIRQ_BITS 38#define MAX_HARDIRQ_BITS 10
31#define HARDIRQ_BITS 12
32 39
33#ifndef MAX_HARDIRQS_PER_CPU 40#ifndef HARDIRQ_BITS
34#define MAX_HARDIRQS_PER_CPU NR_IRQS 41# define HARDIRQ_BITS MAX_HARDIRQ_BITS
35#endif 42#endif
36 43
37/* 44#if HARDIRQ_BITS > MAX_HARDIRQ_BITS
38 * The hardirq mask has to be large enough to have space for potentially 45#error HARDIRQ_BITS too high!
39 * all IRQ sources in the system nesting on a single CPU.
40 */
41#if (1 << HARDIRQ_BITS) < MAX_HARDIRQS_PER_CPU
42# error HARDIRQ_BITS is too low!
43#endif
44#endif 46#endif
45 47
46#define PREEMPT_SHIFT 0 48#define PREEMPT_SHIFT 0
47#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) 49#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS)
48#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) 50#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS)
51#define NMI_SHIFT (HARDIRQ_SHIFT + HARDIRQ_BITS)
49 52
50#define __IRQ_MASK(x) ((1UL << (x))-1) 53#define __IRQ_MASK(x) ((1UL << (x))-1)
51 54
52#define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) 55#define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
53#define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) 56#define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
54#define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) 57#define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
58#define NMI_MASK (__IRQ_MASK(NMI_BITS) << NMI_SHIFT)
55 59
56#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) 60#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT)
57#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) 61#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)
58#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) 62#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT)
63#define NMI_OFFSET (1UL << NMI_SHIFT)
59 64
60#if PREEMPT_ACTIVE < (1 << (HARDIRQ_SHIFT + HARDIRQ_BITS)) 65#if PREEMPT_ACTIVE < (1 << (NMI_SHIFT + NMI_BITS))
61#error PREEMPT_ACTIVE is too low! 66#error PREEMPT_ACTIVE is too low!
62#endif 67#endif
63 68
64#define hardirq_count() (preempt_count() & HARDIRQ_MASK) 69#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
65#define softirq_count() (preempt_count() & SOFTIRQ_MASK) 70#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
66#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) 71#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \
72 | NMI_MASK))
67 73
68/* 74/*
69 * Are we doing bottom half or hardware interrupt processing? 75 * Are we doing bottom half or hardware interrupt processing?
@@ -73,6 +79,11 @@
73#define in_softirq() (softirq_count()) 79#define in_softirq() (softirq_count())
74#define in_interrupt() (irq_count()) 80#define in_interrupt() (irq_count())
75 81
82/*
83 * Are we in NMI context?
84 */
85#define in_nmi() (preempt_count() & NMI_MASK)
86
76#if defined(CONFIG_PREEMPT) 87#if defined(CONFIG_PREEMPT)
77# define PREEMPT_INATOMIC_BASE kernel_locked() 88# define PREEMPT_INATOMIC_BASE kernel_locked()
78# define PREEMPT_CHECK_OFFSET 1 89# define PREEMPT_CHECK_OFFSET 1
@@ -105,7 +116,7 @@
105# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET 116# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
106#endif 117#endif
107 118
108#ifdef CONFIG_SMP 119#if defined(CONFIG_SMP) || defined(CONFIG_GENERIC_HARDIRQS)
109extern void synchronize_irq(unsigned int irq); 120extern void synchronize_irq(unsigned int irq);
110#else 121#else
111# define synchronize_irq(irq) barrier() 122# define synchronize_irq(irq) barrier()
@@ -164,20 +175,24 @@ extern void irq_enter(void);
164 */ 175 */
165extern void irq_exit(void); 176extern void irq_exit(void);
166 177
167#define nmi_enter() \ 178#define nmi_enter() \
168 do { \ 179 do { \
169 ftrace_nmi_enter(); \ 180 ftrace_nmi_enter(); \
170 lockdep_off(); \ 181 BUG_ON(in_nmi()); \
171 rcu_nmi_enter(); \ 182 add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \
172 __irq_enter(); \ 183 lockdep_off(); \
184 rcu_nmi_enter(); \
185 trace_hardirq_enter(); \
173 } while (0) 186 } while (0)
174 187
175#define nmi_exit() \ 188#define nmi_exit() \
176 do { \ 189 do { \
177 __irq_exit(); \ 190 trace_hardirq_exit(); \
178 rcu_nmi_exit(); \ 191 rcu_nmi_exit(); \
179 lockdep_on(); \ 192 lockdep_on(); \
180 ftrace_nmi_exit(); \ 193 BUG_ON(!in_nmi()); \
194 sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \
195 ftrace_nmi_exit(); \
181 } while (0) 196 } while (0)
182 197
183#endif /* LINUX_HARDIRQ_H */ 198#endif /* LINUX_HARDIRQ_H */
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index fd47a151665e..6a6e701f1631 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -38,6 +38,7 @@ struct hdlc_proto {
38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr); 38 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev); 39 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
40 int (*netif_rx)(struct sk_buff *skb); 40 int (*netif_rx)(struct sk_buff *skb);
41 int (*xmit)(struct sk_buff *skb, struct net_device *dev);
41 struct module *module; 42 struct module *module;
42 struct hdlc_proto *next; /* next protocol in the list */ 43 struct hdlc_proto *next; /* next protocol in the list */
43}; 44};
@@ -102,6 +103,10 @@ static __inline__ void debug_frame(const struct sk_buff *skb)
102int hdlc_open(struct net_device *dev); 103int hdlc_open(struct net_device *dev);
103/* Must be called by hardware driver when HDLC device is being closed */ 104/* Must be called by hardware driver when HDLC device is being closed */
104void hdlc_close(struct net_device *dev); 105void hdlc_close(struct net_device *dev);
106/* May be used by hardware driver */
107int hdlc_change_mtu(struct net_device *dev, int new_mtu);
108/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */
109int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev);
105 110
106int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto, 111int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
107 size_t size); 112 size_t size);
diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h
index bf6302f6b5f8..c010b4a785b8 100644
--- a/include/linux/hdlcdrv.h
+++ b/include/linux/hdlcdrv.h
@@ -215,7 +215,7 @@ struct hdlcdrv_state {
215 215
216 struct hdlcdrv_hdlctx { 216 struct hdlcdrv_hdlctx {
217 struct hdlcdrv_hdlcbuffer hbuf; 217 struct hdlcdrv_hdlcbuffer hbuf;
218 long in_hdlc_tx; 218 unsigned long in_hdlc_tx;
219 /* 219 /*
220 * 0 = send flags 220 * 0 = send flags
221 * 1 = send txtail (flags) 221 * 1 = send txtail (flags)
@@ -241,7 +241,6 @@ struct hdlcdrv_state {
241 struct hdlcdrv_bitbuffer bitbuf_hdlc; 241 struct hdlcdrv_bitbuffer bitbuf_hdlc;
242#endif /* HDLCDRV_DEBUG */ 242#endif /* HDLCDRV_DEBUG */
243 243
244 struct net_device_stats stats;
245 int ptt_keyed; 244 int ptt_keyed;
246 245
247 /* queued skb for transmission */ 246 /* queued skb for transmission */
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index c37e9241fae7..29ee2873f4a8 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -1,68 +1,6 @@
1#ifndef _LINUX_HDREG_H 1#ifndef _LINUX_HDREG_H
2#define _LINUX_HDREG_H 2#define _LINUX_HDREG_H
3 3
4#ifdef __KERNEL__
5#include <linux/ata.h>
6
7/*
8 * This file contains some defines for the AT-hd-controller.
9 * Various sources.
10 */
11
12/* ide.c has its own port definitions in "ide.h" */
13
14#define HD_IRQ 14
15
16/* Hd controller regs. Ref: IBM AT Bios-listing */
17#define HD_DATA 0x1f0 /* _CTL when writing */
18#define HD_ERROR 0x1f1 /* see err-bits */
19#define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
20#define HD_SECTOR 0x1f3 /* starting sector */
21#define HD_LCYL 0x1f4 /* starting cylinder */
22#define HD_HCYL 0x1f5 /* high byte of starting cyl */
23#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
24#define HD_STATUS 0x1f7 /* see status-bits */
25#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
26#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
27#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
28
29#define HD_CMD 0x3f6 /* used for resets */
30#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
31
32/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
33
34/* Bits of HD_STATUS */
35#define ERR_STAT 0x01
36#define INDEX_STAT 0x02
37#define ECC_STAT 0x04 /* Corrected error */
38#define DRQ_STAT 0x08
39#define SEEK_STAT 0x10
40#define SRV_STAT 0x10
41#define WRERR_STAT 0x20
42#define READY_STAT 0x40
43#define BUSY_STAT 0x80
44
45/* Bits for HD_ERROR */
46#define MARK_ERR 0x01 /* Bad address mark */
47#define ILI_ERR 0x01 /* Illegal Length Indication (ATAPI) */
48#define TRK0_ERR 0x02 /* couldn't find track 0 */
49#define EOM_ERR 0x02 /* End Of Media (ATAPI) */
50#define ABRT_ERR 0x04 /* Command aborted */
51#define MCR_ERR 0x08 /* media change request */
52#define ID_ERR 0x10 /* ID field not found */
53#define MC_ERR 0x20 /* media changed */
54#define ECC_ERR 0x40 /* Uncorrectable ECC error */
55#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
56#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
57#define LFS_ERR 0xf0 /* Last Failed Sense (ATAPI) */
58
59/* Bits of HD_NSECTOR */
60#define CD 0x01
61#define IO 0x02
62#define REL 0x04
63#define TAG_MASK 0xf8
64#endif /* __KERNEL__ */
65
66#include <linux/types.h> 4#include <linux/types.h>
67 5
68/* 6/*
@@ -191,6 +129,7 @@ typedef struct hd_drive_hob_hdr {
191#define TASKFILE_INVALID 0x7fff 129#define TASKFILE_INVALID 0x7fff
192#endif 130#endif
193 131
132#ifndef __KERNEL__
194/* ATA/ATAPI Commands pre T13 Spec */ 133/* ATA/ATAPI Commands pre T13 Spec */
195#define WIN_NOP 0x00 134#define WIN_NOP 0x00
196/* 135/*
@@ -379,6 +318,7 @@ typedef struct hd_drive_hob_hdr {
379#define SECURITY_ERASE_UNIT 0xBD 318#define SECURITY_ERASE_UNIT 0xBD
380#define SECURITY_FREEZE_LOCK 0xBE 319#define SECURITY_FREEZE_LOCK 0xBE
381#define SECURITY_DISABLE_PASSWORD 0xBF 320#define SECURITY_DISABLE_PASSWORD 0xBF
321#endif /* __KERNEL__ */
382 322
383struct hd_geometry { 323struct hd_geometry {
384 unsigned char heads; 324 unsigned char heads;
@@ -448,6 +388,7 @@ enum {
448 388
449#define __NEW_HD_DRIVE_ID 389#define __NEW_HD_DRIVE_ID
450 390
391#ifndef __KERNEL__
451/* 392/*
452 * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec. 393 * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec.
453 * 394 *
@@ -511,7 +452,6 @@ struct hd_driveid {
511 unsigned short words69_70[2]; /* reserved words 69-70 452 unsigned short words69_70[2]; /* reserved words 69-70
512 * future command overlap and queuing 453 * future command overlap and queuing
513 */ 454 */
514 /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
515 unsigned short words71_74[4]; /* reserved words 71-74 455 unsigned short words71_74[4]; /* reserved words 71-74
516 * for IDENTIFY PACKET DEVICE command 456 * for IDENTIFY PACKET DEVICE command
517 */ 457 */
@@ -700,6 +640,7 @@ struct hd_driveid {
700 * 7:0 Signature 640 * 7:0 Signature
701 */ 641 */
702}; 642};
643#endif /* __KERNEL__ */
703 644
704/* 645/*
705 * IDE "nice" flags. These are used on a per drive basis to determine 646 * IDE "nice" flags. These are used on a per drive basis to determine
diff --git a/include/linux/hid.h b/include/linux/hid.h
index fa8ee9cef7be..a72876e43589 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -270,6 +270,7 @@ struct hid_item {
270 270
271#define HID_QUIRK_INVERT 0x00000001 271#define HID_QUIRK_INVERT 0x00000001
272#define HID_QUIRK_NOTOUCH 0x00000002 272#define HID_QUIRK_NOTOUCH 0x00000002
273#define HID_QUIRK_IGNORE 0x00000004
273#define HID_QUIRK_NOGET 0x00000008 274#define HID_QUIRK_NOGET 0x00000008
274#define HID_QUIRK_BADPAD 0x00000020 275#define HID_QUIRK_BADPAD 0x00000020
275#define HID_QUIRK_MULTI_INPUT 0x00000040 276#define HID_QUIRK_MULTI_INPUT 0x00000040
@@ -603,12 +604,17 @@ struct hid_ll_driver {
603 int (*open)(struct hid_device *hdev); 604 int (*open)(struct hid_device *hdev);
604 void (*close)(struct hid_device *hdev); 605 void (*close)(struct hid_device *hdev);
605 606
607 int (*power)(struct hid_device *hdev, int level);
608
606 int (*hidinput_input_event) (struct input_dev *idev, unsigned int type, 609 int (*hidinput_input_event) (struct input_dev *idev, unsigned int type,
607 unsigned int code, int value); 610 unsigned int code, int value);
608 611
609 int (*parse)(struct hid_device *hdev); 612 int (*parse)(struct hid_device *hdev);
610}; 613};
611 614
615#define PM_HINT_FULLON 1<<5
616#define PM_HINT_NORMAL 1<<1
617
612/* Applications from HID Usage Tables 4/8/99 Version 1.1 */ 618/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
613/* We ignore a few input applications that are not widely used */ 619/* We ignore a few input applications that are not widely used */
614#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) 620#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002))
@@ -641,6 +647,7 @@ int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int
641void hid_output_report(struct hid_report *report, __u8 *data); 647void hid_output_report(struct hid_report *report, __u8 *data);
642struct hid_device *hid_allocate_device(void); 648struct hid_device *hid_allocate_device(void);
643int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 649int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
650int hid_check_keys_pressed(struct hid_device *hid);
644int hid_connect(struct hid_device *hid, unsigned int connect_mask); 651int hid_connect(struct hid_device *hid, unsigned int connect_mask);
645 652
646/** 653/**
@@ -791,21 +798,5 @@ dbg_hid(const char *fmt, ...)
791 __FILE__ , ## arg) 798 __FILE__ , ## arg)
792#endif /* HID_FF */ 799#endif /* HID_FF */
793 800
794#ifdef __KERNEL__
795#ifdef CONFIG_HID_COMPAT
796#define HID_COMPAT_LOAD_DRIVER(name) \
797/* prototype to avoid sparse warning */ \
798extern void hid_compat_##name(void); \
799void hid_compat_##name(void) { } \
800EXPORT_SYMBOL(hid_compat_##name)
801#else
802#define HID_COMPAT_LOAD_DRIVER(name)
803#endif /* HID_COMPAT */
804#define HID_COMPAT_CALL_DRIVER(name) do { \
805 extern void hid_compat_##name(void); \
806 hid_compat_##name(); \
807} while (0)
808#endif /* __KERNEL__ */
809
810#endif 801#endif
811 802
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 13875ce9112a..1fcb7126a01f 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -19,8 +19,21 @@ static inline void flush_kernel_dcache_page(struct page *page)
19} 19}
20#endif 20#endif
21 21
22#ifdef CONFIG_HIGHMEM 22#include <asm/kmap_types.h>
23
24#if defined(CONFIG_DEBUG_HIGHMEM) && defined(CONFIG_TRACE_IRQFLAGS_SUPPORT)
25
26void debug_kmap_atomic(enum km_type type);
23 27
28#else
29
30static inline void debug_kmap_atomic(enum km_type type)
31{
32}
33
34#endif
35
36#ifdef CONFIG_HIGHMEM
24#include <asm/highmem.h> 37#include <asm/highmem.h>
25 38
26/* declarations for linux/mm/highmem.c */ 39/* declarations for linux/mm/highmem.c */
@@ -44,8 +57,6 @@ static inline void *kmap(struct page *page)
44 57
45#define kunmap(page) do { (void) (page); } while (0) 58#define kunmap(page) do { (void) (page); } while (0)
46 59
47#include <asm/kmap_types.h>
48
49static inline void *kmap_atomic(struct page *page, enum km_type idx) 60static inline void *kmap_atomic(struct page *page, enum km_type idx)
50{ 61{
51 pagefault_disable(); 62 pagefault_disable();
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-pca.h b/include/linux/i2c-algo-pca.h
index adcb3dc7ac26..1364d62e2fbe 100644
--- a/include/linux/i2c-algo-pca.h
+++ b/include/linux/i2c-algo-pca.h
@@ -1,7 +1,14 @@
1#ifndef _LINUX_I2C_ALGO_PCA_H 1#ifndef _LINUX_I2C_ALGO_PCA_H
2#define _LINUX_I2C_ALGO_PCA_H 2#define _LINUX_I2C_ALGO_PCA_H
3 3
4/* Clock speeds for the bus */ 4/* Chips known to the pca algo */
5#define I2C_PCA_CHIP_9564 0x00
6#define I2C_PCA_CHIP_9665 0x01
7
8/* Internal period for PCA9665 oscilator */
9#define I2C_PCA_OSC_PER 3 /* e10-8s */
10
11/* Clock speeds for the bus for PCA9564*/
5#define I2C_PCA_CON_330kHz 0x00 12#define I2C_PCA_CON_330kHz 0x00
6#define I2C_PCA_CON_288kHz 0x01 13#define I2C_PCA_CON_288kHz 0x01
7#define I2C_PCA_CON_217kHz 0x02 14#define I2C_PCA_CON_217kHz 0x02
@@ -18,6 +25,26 @@
18#define I2C_PCA_ADR 0x02 /* OWN ADR Read/Write */ 25#define I2C_PCA_ADR 0x02 /* OWN ADR Read/Write */
19#define I2C_PCA_CON 0x03 /* CONTROL Read/Write */ 26#define I2C_PCA_CON 0x03 /* CONTROL Read/Write */
20 27
28/* PCA9665 registers */
29#define I2C_PCA_INDPTR 0x00 /* INDIRECT Pointer Write Only */
30#define I2C_PCA_IND 0x02 /* INDIRECT Read/Write */
31
32/* PCA9665 indirect registers */
33#define I2C_PCA_ICOUNT 0x00 /* Byte Count for buffered mode */
34#define I2C_PCA_IADR 0x01 /* OWN ADR */
35#define I2C_PCA_ISCLL 0x02 /* SCL LOW period */
36#define I2C_PCA_ISCLH 0x03 /* SCL HIGH period */
37#define I2C_PCA_ITO 0x04 /* TIMEOUT */
38#define I2C_PCA_IPRESET 0x05 /* Parallel bus reset */
39#define I2C_PCA_IMODE 0x06 /* I2C Bus mode */
40
41/* PCA9665 I2C bus mode */
42#define I2C_PCA_MODE_STD 0x00 /* Standard mode */
43#define I2C_PCA_MODE_FAST 0x01 /* Fast mode */
44#define I2C_PCA_MODE_FASTP 0x02 /* Fast Plus mode */
45#define I2C_PCA_MODE_TURBO 0x03 /* Turbo mode */
46
47
21#define I2C_PCA_CON_AA 0x80 /* Assert Acknowledge */ 48#define I2C_PCA_CON_AA 0x80 /* Assert Acknowledge */
22#define I2C_PCA_CON_ENSIO 0x40 /* Enable */ 49#define I2C_PCA_CON_ENSIO 0x40 /* Enable */
23#define I2C_PCA_CON_STA 0x20 /* Start */ 50#define I2C_PCA_CON_STA 0x20 /* Start */
@@ -31,7 +58,9 @@ struct i2c_algo_pca_data {
31 int (*read_byte) (void *data, int reg); 58 int (*read_byte) (void *data, int reg);
32 int (*wait_for_completion) (void *data); 59 int (*wait_for_completion) (void *data);
33 void (*reset_chip) (void *data); 60 void (*reset_chip) (void *data);
34 /* i2c_clock values are defined in linux/i2c-algo-pca.h */ 61 /* For PCA9564, use one of the predefined frequencies:
62 * 330000, 288000, 217000, 146000, 88000, 59000, 44000, 36000
63 * For PCA9665, use the frequency you want here. */
35 unsigned int i2c_clock; 64 unsigned int i2c_clock;
36}; 65};
37 66
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 1ffc23bc5d1e..c9087de5c6c6 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -33,46 +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
75#define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */
76 40
77/* 41/*
78 * ---- Adapter types ---------------------------------------------------- 42 * ---- Adapter types ----------------------------------------------------
@@ -87,6 +51,8 @@
87#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ 51#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
88#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) */
89#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 */
55#define I2C_HW_B_HDPVR 0x010025 /* Hauppauge HD PVR */
90 56
91/* --- SGI adapters */ 57/* --- SGI adapters */
92#define I2C_HW_SGI_VINO 0x160000 58#define I2C_HW_SGI_VINO 0x160000
diff --git a/include/linux/i2c-pca-platform.h b/include/linux/i2c-pca-platform.h
index 3d191873f2d1..aba33759dec4 100644
--- a/include/linux/i2c-pca-platform.h
+++ b/include/linux/i2c-pca-platform.h
@@ -6,7 +6,7 @@ struct i2c_pca9564_pf_platform_data {
6 * not supplied (negative value), but it 6 * not supplied (negative value), but it
7 * cannot exit some error conditions then */ 7 * cannot exit some error conditions then */
8 int i2c_clock_speed; /* values are defined in linux/i2c-algo-pca.h */ 8 int i2c_clock_speed; /* values are defined in linux/i2c-algo-pca.h */
9 int timeout; /* timeout = this value * 10us */ 9 int timeout; /* timeout in jiffies */
10}; 10};
11 11
12#endif /* I2C_PCA9564_PLATFORM_H */ 12#endif /* I2C_PCA9564_PLATFORM_H */
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/at24.h b/include/linux/i2c/at24.h
index f6edd522a929..8ace93024d60 100644
--- a/include/linux/i2c/at24.h
+++ b/include/linux/i2c/at24.h
@@ -2,6 +2,7 @@
2#define _LINUX_AT24_H 2#define _LINUX_AT24_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/memory.h>
5 6
6/* 7/*
7 * As seen through Linux I2C, differences between the most common types of I2C 8 * As seen through Linux I2C, differences between the most common types of I2C
@@ -23,6 +24,9 @@ struct at24_platform_data {
23#define AT24_FLAG_READONLY 0x40 /* sysfs-entry will be read-only */ 24#define AT24_FLAG_READONLY 0x40 /* sysfs-entry will be read-only */
24#define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be world-readable */ 25#define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be world-readable */
25#define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses (24c00) */ 26#define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses (24c00) */
27
28 void (*setup)(struct memory_accessor *, void *context);
29 void *context;
26}; 30};
27 31
28#endif /* _LINUX_AT24_H */ 32#endif /* _LINUX_AT24_H */
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/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index 8137f660a5cc..0dc80ef24975 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -218,6 +218,53 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
218 218
219/*----------------------------------------------------------------------*/ 219/*----------------------------------------------------------------------*/
220 220
221/* Power bus message definitions */
222
223#define DEV_GRP_NULL 0x0
224#define DEV_GRP_P1 0x1
225#define DEV_GRP_P2 0x2
226#define DEV_GRP_P3 0x4
227
228#define RES_GRP_RES 0x0
229#define RES_GRP_PP 0x1
230#define RES_GRP_RC 0x2
231#define RES_GRP_PP_RC 0x3
232#define RES_GRP_PR 0x4
233#define RES_GRP_PP_PR 0x5
234#define RES_GRP_RC_PR 0x6
235#define RES_GRP_ALL 0x7
236
237#define RES_TYPE2_R0 0x0
238
239#define RES_TYPE_ALL 0x7
240
241#define RES_STATE_WRST 0xF
242#define RES_STATE_ACTIVE 0xE
243#define RES_STATE_SLEEP 0x8
244#define RES_STATE_OFF 0x0
245
246/*
247 * Power Bus Message Format ... these can be sent individually by Linux,
248 * but are usually part of downloaded scripts that are run when various
249 * power events are triggered.
250 *
251 * Broadcast Message (16 Bits):
252 * DEV_GRP[15:13] MT[12] RES_GRP[11:9] RES_TYPE2[8:7] RES_TYPE[6:4]
253 * RES_STATE[3:0]
254 *
255 * Singular Message (16 Bits):
256 * DEV_GRP[15:13] MT[12] RES_ID[11:4] RES_STATE[3:0]
257 */
258
259#define MSG_BROADCAST(devgrp, grp, type, type2, state) \
260 ( (devgrp) << 13 | 1 << 12 | (grp) << 9 | (type2) << 7 \
261 | (type) << 4 | (state))
262
263#define MSG_SINGULAR(devgrp, id, state) \
264 ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state))
265
266/*----------------------------------------------------------------------*/
267
221struct twl4030_bci_platform_data { 268struct twl4030_bci_platform_data {
222 int *battery_tmp_tbl; 269 int *battery_tmp_tbl;
223 unsigned int tblsize; 270 unsigned int tblsize;
diff --git a/include/linux/ibmtr.h b/include/linux/ibmtr.h
index 1c7a0dd5536a..06695b74d405 100644
--- a/include/linux/ibmtr.h
+++ b/include/linux/ibmtr.h
@@ -207,7 +207,7 @@ struct tok_info {
207 unsigned short exsap_station_id; 207 unsigned short exsap_station_id;
208 unsigned short global_int_enable; 208 unsigned short global_int_enable;
209 struct sk_buff *current_skb; 209 struct sk_buff *current_skb;
210 struct net_device_stats tr_stats; 210
211 unsigned char auto_speedsave; 211 unsigned char auto_speedsave;
212 open_state open_status, sap_status; 212 open_state open_status, sap_status;
213 enum {MANUAL, AUTOMATIC} open_mode; 213 enum {MANUAL, AUTOMATIC} open_mode;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index fe235b65207e..ff65fffb078f 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -26,7 +26,7 @@
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/mutex.h> 27#include <asm/mutex.h>
28 28
29#if defined(CONFIG_CRIS) || defined(CONFIG_FRV) 29#if defined(CONFIG_CRIS) || defined(CONFIG_FRV) || defined(CONFIG_MN10300)
30# define SUPPORT_VLB_SYNC 0 30# define SUPPORT_VLB_SYNC 0
31#else 31#else
32# define SUPPORT_VLB_SYNC 1 32# define SUPPORT_VLB_SYNC 1
@@ -40,6 +40,13 @@
40#define ERROR_RESET 3 /* Reset controller every 4th retry */ 40#define ERROR_RESET 3 /* Reset controller every 4th retry */
41#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 41#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
42 42
43/* Error codes returned in rq->errors to the higher part of the driver. */
44enum {
45 IDE_DRV_ERROR_GENERAL = 101,
46 IDE_DRV_ERROR_FILEMARK = 102,
47 IDE_DRV_ERROR_EOD = 103,
48};
49
43/* 50/*
44 * Definitions for accessing IDE controller registers 51 * Definitions for accessing IDE controller registers
45 */ 52 */
@@ -193,42 +200,8 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
193 hw->io_ports.ctl_addr = ctl_addr; 200 hw->io_ports.ctl_addr = ctl_addr;
194} 201}
195 202
196/* for IDE PCI controllers in legacy mode, temporary */
197static inline int __ide_default_irq(unsigned long base)
198{
199 switch (base) {
200#ifdef CONFIG_IA64
201 case 0x1f0: return isa_irq_to_vector(14);
202 case 0x170: return isa_irq_to_vector(15);
203#else
204 case 0x1f0: return 14;
205 case 0x170: return 15;
206#endif
207 }
208 return 0;
209}
210
211#if defined(CONFIG_ARM) || defined(CONFIG_FRV) || defined(CONFIG_M68K) || \
212 defined(CONFIG_MIPS) || defined(CONFIG_MN10300) || defined(CONFIG_PARISC) \
213 || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || defined(CONFIG_SPARC64)
214#include <asm/ide.h>
215#else
216#include <asm-generic/ide_iops.h>
217#endif
218
219#define MAX_HWIFS 10 203#define MAX_HWIFS 10
220 204
221/* Currently only m68k, apus and m8xx need it */
222#ifndef IDE_ARCH_ACK_INTR
223# define ide_ack_intr(hwif) (1)
224#endif
225
226/* Currently only Atari needs it */
227#ifndef IDE_ARCH_LOCK
228# define ide_release_lock() do {} while (0)
229# define ide_get_lock(hdlr, data) do {} while (0)
230#endif /* IDE_ARCH_LOCK */
231
232/* 205/*
233 * Now for the data we need to maintain per-drive: ide_drive_t 206 * Now for the data we need to maintain per-drive: ide_drive_t
234 */ 207 */
@@ -267,108 +240,92 @@ typedef enum {
267} ide_startstop_t; 240} ide_startstop_t;
268 241
269enum { 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 {
270 IDE_TFLAG_LBA48 = (1 << 0), 265 IDE_TFLAG_LBA48 = (1 << 0),
271 IDE_TFLAG_FLAGGED = (1 << 2), 266 IDE_TFLAG_WRITE = (1 << 1),
272 IDE_TFLAG_OUT_DATA = (1 << 3), 267 IDE_TFLAG_CUSTOM_HANDLER = (1 << 2),
273 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), 268 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 3),
274 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5),
275 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6),
276 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
277 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
278 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
279 IDE_TFLAG_OUT_HOB_NSECT |
280 IDE_TFLAG_OUT_HOB_LBAL |
281 IDE_TFLAG_OUT_HOB_LBAM |
282 IDE_TFLAG_OUT_HOB_LBAH,
283 IDE_TFLAG_OUT_FEATURE = (1 << 9),
284 IDE_TFLAG_OUT_NSECT = (1 << 10),
285 IDE_TFLAG_OUT_LBAL = (1 << 11),
286 IDE_TFLAG_OUT_LBAM = (1 << 12),
287 IDE_TFLAG_OUT_LBAH = (1 << 13),
288 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
289 IDE_TFLAG_OUT_NSECT |
290 IDE_TFLAG_OUT_LBAL |
291 IDE_TFLAG_OUT_LBAM |
292 IDE_TFLAG_OUT_LBAH,
293 IDE_TFLAG_OUT_DEVICE = (1 << 14),
294 IDE_TFLAG_WRITE = (1 << 15),
295 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16),
296 IDE_TFLAG_IN_DATA = (1 << 17),
297 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18),
298 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19),
299 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20),
300 IDE_TFLAG_IN_HOB_NSECT = (1 << 21),
301 IDE_TFLAG_IN_HOB_LBAL = (1 << 22),
302 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
303 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
304 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
305 IDE_TFLAG_IN_HOB_LBAM |
306 IDE_TFLAG_IN_HOB_LBAH,
307 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
308 IDE_TFLAG_IN_HOB_NSECT |
309 IDE_TFLAG_IN_HOB_LBA,
310 IDE_TFLAG_IN_FEATURE = (1 << 1),
311 IDE_TFLAG_IN_NSECT = (1 << 25),
312 IDE_TFLAG_IN_LBAL = (1 << 26),
313 IDE_TFLAG_IN_LBAM = (1 << 27),
314 IDE_TFLAG_IN_LBAH = (1 << 28),
315 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
316 IDE_TFLAG_IN_LBAM |
317 IDE_TFLAG_IN_LBAH,
318 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
319 IDE_TFLAG_IN_LBA,
320 IDE_TFLAG_IN_DEVICE = (1 << 29),
321 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
322 IDE_TFLAG_IN_HOB,
323 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
324 IDE_TFLAG_IN_TF,
325 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
326 IDE_TFLAG_IN_DEVICE,
327 /* force 16-bit I/O operations */ 269 /* force 16-bit I/O operations */
328 IDE_TFLAG_IO_16BIT = (1 << 30), 270 IDE_TFLAG_IO_16BIT = (1 << 4),
329 /* ide_task_t was allocated using kmalloc() */ 271 /* struct ide_cmd was allocated using kmalloc() */
330 IDE_TFLAG_DYN = (1 << 31), 272 IDE_TFLAG_DYN = (1 << 5),
273 IDE_TFLAG_FS = (1 << 6),
274 IDE_TFLAG_MULTI_PIO = (1 << 7),
331}; 275};
332 276
333struct ide_taskfile { 277enum {
334 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */ 278 IDE_FTFLAG_FLAGGED = (1 << 0),
279 IDE_FTFLAG_SET_IN_FLAGS = (1 << 1),
280 IDE_FTFLAG_OUT_DATA = (1 << 2),
281 IDE_FTFLAG_IN_DATA = (1 << 3),
282};
335 283
336 u8 hob_feature; /* 1-5: additional data to support LBA48 */ 284struct ide_taskfile {
337 u8 hob_nsect; 285 u8 data; /* 0: data byte (for TASKFILE ioctl) */
338 u8 hob_lbal; 286 union { /* 1: */
339 u8 hob_lbam; 287 u8 error; /* read: error */
340 u8 hob_lbah; 288 u8 feature; /* write: feature */
289 };
290 u8 nsect; /* 2: number of sectors */
291 u8 lbal; /* 3: LBA low */
292 u8 lbam; /* 4: LBA mid */
293 u8 lbah; /* 5: LBA high */
294 u8 device; /* 6: device select */
295 union { /* 7: */
296 u8 status; /* read: status */
297 u8 command; /* write: command */
298 };
299};
341 300
342 u8 data; /* 6: low data byte (for TASKFILE IOCTL) */ 301struct ide_cmd {
302 struct ide_taskfile tf;
303 struct ide_taskfile hob;
304 struct {
305 struct {
306 u8 tf;
307 u8 hob;
308 } out, in;
309 } valid;
343 310
344 union { /*  7: */ 311 u8 tf_flags;
345 u8 error; /* read: error */ 312 u8 ftf_flags; /* for TASKFILE ioctl */
346 u8 feature; /* write: feature */ 313 int protocol;
347 };
348 314
349 u8 nsect; /* 8: number of sectors */ 315 int sg_nents; /* number of sg entries */
350 u8 lbal; /* 9: LBA low */ 316 int orig_sg_nents;
351 u8 lbam; /* 10: LBA mid */ 317 int sg_dma_direction; /* DMA transfer direction */
352 u8 lbah; /* 11: LBA high */
353 318
354 u8 device; /* 12: device select */ 319 unsigned int nbytes;
320 unsigned int nleft;
321 unsigned int last_xfer_len;
355 322
356 union { /* 13: */ 323 struct scatterlist *cursg;
357 u8 status; /*  read: status  */ 324 unsigned int cursg_ofs;
358 u8 command; /* write: command */
359 };
360};
361 325
362typedef struct ide_task_s {
363 union {
364 struct ide_taskfile tf;
365 u8 tf_array[14];
366 };
367 u32 tf_flags;
368 int data_phase;
369 struct request *rq; /* copy of request */ 326 struct request *rq; /* copy of request */
370 void *special; /* valid_t generally */ 327 void *special; /* valid_t generally */
371} ide_task_t; 328};
372 329
373/* ATAPI packet command flags */ 330/* ATAPI packet command flags */
374enum { 331enum {
@@ -380,15 +337,13 @@ enum {
380 PC_FLAG_DMA_IN_PROGRESS = (1 << 4), 337 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
381 PC_FLAG_DMA_ERROR = (1 << 5), 338 PC_FLAG_DMA_ERROR = (1 << 5),
382 PC_FLAG_WRITING = (1 << 6), 339 PC_FLAG_WRITING = (1 << 6),
383 /* command timed out */
384 PC_FLAG_TIMEDOUT = (1 << 7),
385}; 340};
386 341
387/* 342/*
388 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes. 343 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
389 * This is used for several packet commands (not for READ/WRITE commands). 344 * This is used for several packet commands (not for READ/WRITE commands).
390 */ 345 */
391#define IDE_PC_BUFFER_SIZE 256 346#define IDE_PC_BUFFER_SIZE 64
392#define ATAPI_WAIT_PC (60 * HZ) 347#define ATAPI_WAIT_PC (60 * HZ)
393 348
394struct ide_atapi_pc { 349struct ide_atapi_pc {
@@ -426,9 +381,6 @@ struct ide_atapi_pc {
426 struct idetape_bh *bh; 381 struct idetape_bh *bh;
427 char *b_data; 382 char *b_data;
428 383
429 struct scatterlist *sg;
430 unsigned int sg_cnt;
431
432 unsigned long timeout; 384 unsigned long timeout;
433}; 385};
434 386
@@ -452,7 +404,6 @@ struct ide_disk_ops {
452 int); 404 int);
453 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, 405 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *,
454 sector_t); 406 sector_t);
455 int (*end_request)(struct ide_drive_s *, int, int);
456 int (*ioctl)(struct ide_drive_s *, struct block_device *, 407 int (*ioctl)(struct ide_drive_s *, struct block_device *,
457 fmode_t, unsigned int, unsigned long); 408 fmode_t, unsigned int, unsigned long);
458}; 409};
@@ -470,11 +421,6 @@ enum {
470 IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3), 421 IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3),
471 /* TOC track numbers are in BCD. */ 422 /* TOC track numbers are in BCD. */
472 IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4), 423 IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4),
473 /*
474 * Drive does not provide data in multiples of SECTOR_SIZE
475 * when more than one interrupt is needed.
476 */
477 IDE_AFLAG_LIMIT_NFRAMES = (1 << 5),
478 /* Saved TOC information is current. */ 424 /* Saved TOC information is current. */
479 IDE_AFLAG_TOC_VALID = (1 << 6), 425 IDE_AFLAG_TOC_VALID = (1 << 6),
480 /* We think that the drive door is locked. */ 426 /* We think that the drive door is locked. */
@@ -528,8 +474,6 @@ enum {
528 IDE_DFLAG_NICE1 = (1 << 5), 474 IDE_DFLAG_NICE1 = (1 << 5),
529 /* device is physically present */ 475 /* device is physically present */
530 IDE_DFLAG_PRESENT = (1 << 6), 476 IDE_DFLAG_PRESENT = (1 << 6),
531 /* device ejected hint */
532 IDE_DFLAG_DEAD = (1 << 7),
533 /* id read from device (synthetic if not set) */ 477 /* id read from device (synthetic if not set) */
534 IDE_DFLAG_ID_READ = (1 << 8), 478 IDE_DFLAG_ID_READ = (1 << 8),
535 IDE_DFLAG_NOPROBE = (1 << 9), 479 IDE_DFLAG_NOPROBE = (1 << 9),
@@ -621,7 +565,7 @@ struct ide_drive_s {
621 565
622 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ 566 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
623 unsigned int cyl; /* "real" number of cyls */ 567 unsigned int cyl; /* "real" number of cyls */
624 unsigned int drive_data; /* used by set_pio_mode/selectproc */ 568 unsigned int drive_data; /* used by set_pio_mode/dev_select() */
625 unsigned int failures; /* current failure count */ 569 unsigned int failures; /* current failure count */
626 unsigned int max_failures; /* maximum allowed failure count */ 570 unsigned int max_failures; /* maximum allowed failure count */
627 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ 571 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */
@@ -643,8 +587,11 @@ struct ide_drive_s {
643 /* current packet command */ 587 /* current packet command */
644 struct ide_atapi_pc *pc; 588 struct ide_atapi_pc *pc;
645 589
590 /* last failed packet command */
591 struct ide_atapi_pc *failed_pc;
592
646 /* callback for packet commands */ 593 /* callback for packet commands */
647 void (*pc_callback)(struct ide_drive_s *, int); 594 int (*pc_callback)(struct ide_drive_s *, int);
648 595
649 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); 596 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
650 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, 597 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
@@ -674,16 +621,16 @@ struct ide_tp_ops {
674 void (*exec_command)(struct hwif_s *, u8); 621 void (*exec_command)(struct hwif_s *, u8);
675 u8 (*read_status)(struct hwif_s *); 622 u8 (*read_status)(struct hwif_s *);
676 u8 (*read_altstatus)(struct hwif_s *); 623 u8 (*read_altstatus)(struct hwif_s *);
624 void (*write_devctl)(struct hwif_s *, u8);
677 625
678 void (*set_irq)(struct hwif_s *, int); 626 void (*dev_select)(ide_drive_t *);
679 627 void (*tf_load)(ide_drive_t *, struct ide_taskfile *, u8);
680 void (*tf_load)(ide_drive_t *, struct ide_task_s *); 628 void (*tf_read)(ide_drive_t *, struct ide_taskfile *, u8);
681 void (*tf_read)(ide_drive_t *, struct ide_task_s *);
682 629
683 void (*input_data)(ide_drive_t *, struct request *, void *, 630 void (*input_data)(ide_drive_t *, struct ide_cmd *,
684 unsigned int); 631 void *, unsigned int);
685 void (*output_data)(ide_drive_t *, struct request *, void *, 632 void (*output_data)(ide_drive_t *, struct ide_cmd *,
686 unsigned int); 633 void *, unsigned int);
687}; 634};
688 635
689extern const struct ide_tp_ops default_tp_ops; 636extern const struct ide_tp_ops default_tp_ops;
@@ -694,7 +641,6 @@ extern const struct ide_tp_ops default_tp_ops;
694 * @init_dev: host specific initialization of a device 641 * @init_dev: host specific initialization of a device
695 * @set_pio_mode: routine to program host for PIO mode 642 * @set_pio_mode: routine to program host for PIO mode
696 * @set_dma_mode: routine to program host for DMA mode 643 * @set_dma_mode: routine to program host for DMA mode
697 * @selectproc: tweaks hardware to select drive
698 * @reset_poll: chipset polling based on hba specifics 644 * @reset_poll: chipset polling based on hba specifics
699 * @pre_reset: chipset specific changes to default for device-hba resets 645 * @pre_reset: chipset specific changes to default for device-hba resets
700 * @resetproc: routine to reset controller after a disk reset 646 * @resetproc: routine to reset controller after a disk reset
@@ -711,7 +657,6 @@ struct ide_port_ops {
711 void (*init_dev)(ide_drive_t *); 657 void (*init_dev)(ide_drive_t *);
712 void (*set_pio_mode)(ide_drive_t *, const u8); 658 void (*set_pio_mode)(ide_drive_t *, const u8);
713 void (*set_dma_mode)(ide_drive_t *, const u8); 659 void (*set_dma_mode)(ide_drive_t *, const u8);
714 void (*selectproc)(ide_drive_t *);
715 int (*reset_poll)(ide_drive_t *); 660 int (*reset_poll)(ide_drive_t *);
716 void (*pre_reset)(ide_drive_t *); 661 void (*pre_reset)(ide_drive_t *);
717 void (*resetproc)(ide_drive_t *); 662 void (*resetproc)(ide_drive_t *);
@@ -727,13 +672,15 @@ struct ide_port_ops {
727 672
728struct ide_dma_ops { 673struct ide_dma_ops {
729 void (*dma_host_set)(struct ide_drive_s *, int); 674 void (*dma_host_set)(struct ide_drive_s *, int);
730 int (*dma_setup)(struct ide_drive_s *); 675 int (*dma_setup)(struct ide_drive_s *, struct ide_cmd *);
731 void (*dma_exec_cmd)(struct ide_drive_s *, u8);
732 void (*dma_start)(struct ide_drive_s *); 676 void (*dma_start)(struct ide_drive_s *);
733 int (*dma_end)(struct ide_drive_s *); 677 int (*dma_end)(struct ide_drive_s *);
734 int (*dma_test_irq)(struct ide_drive_s *); 678 int (*dma_test_irq)(struct ide_drive_s *);
735 void (*dma_lost_irq)(struct ide_drive_s *); 679 void (*dma_lost_irq)(struct ide_drive_s *);
736 void (*dma_timeout)(struct ide_drive_s *); 680 /* below ones are optional */
681 int (*dma_check)(struct ide_drive_s *, struct ide_cmd *);
682 int (*dma_timer_expiry)(struct ide_drive_s *);
683 void (*dma_clear)(struct ide_drive_s *);
737 /* 684 /*
738 * The following method is optional and only required to be 685 * The following method is optional and only required to be
739 * implemented for the SFF-8038i compatible controllers. 686 * implemented for the SFF-8038i compatible controllers.
@@ -796,18 +743,8 @@ typedef struct hwif_s {
796 /* Scatter-gather list used to build the above */ 743 /* Scatter-gather list used to build the above */
797 struct scatterlist *sg_table; 744 struct scatterlist *sg_table;
798 int sg_max_nents; /* Maximum number of entries in it */ 745 int sg_max_nents; /* Maximum number of entries in it */
799 int sg_nents; /* Current number of entries in it */
800 int sg_dma_direction; /* dma transfer direction */
801 746
802 /* data phase of the active command (currently only valid for PIO/DMA) */ 747 struct ide_cmd cmd; /* current command */
803 int data_phase;
804
805 struct ide_task_s task; /* current command */
806
807 unsigned int nsect;
808 unsigned int nleft;
809 struct scatterlist *cursg;
810 unsigned int cursg_ofs;
811 748
812 int rqsize; /* max sectors per request */ 749 int rqsize; /* max sectors per request */
813 int irq; /* our irq number */ 750 int irq; /* our irq number */
@@ -865,8 +802,18 @@ struct ide_host {
865 ide_hwif_t *ports[MAX_HOST_PORTS + 1]; 802 ide_hwif_t *ports[MAX_HOST_PORTS + 1];
866 unsigned int n_ports; 803 unsigned int n_ports;
867 struct device *dev[2]; 804 struct device *dev[2];
868 unsigned int (*init_chipset)(struct pci_dev *); 805
806 int (*init_chipset)(struct pci_dev *);
807
808 void (*get_lock)(irq_handler_t, void *);
809 void (*release_lock)(void);
810
811 irq_handler_t irq_handler;
812
869 unsigned long host_flags; 813 unsigned long host_flags;
814
815 int irq_flags;
816
870 void *host_priv; 817 void *host_priv;
871 ide_hwif_t *cur_port; /* for hosts requiring serialization */ 818 ide_hwif_t *cur_port; /* for hosts requiring serialization */
872 819
@@ -883,7 +830,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
883typedef int (ide_expiry_t)(ide_drive_t *); 830typedef int (ide_expiry_t)(ide_drive_t *);
884 831
885/* used by ide-cd, ide-floppy, etc. */ 832/* used by ide-cd, ide-floppy, etc. */
886typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); 833typedef void (xfer_func_t)(ide_drive_t *, struct ide_cmd *, void *, unsigned);
887 834
888extern struct mutex ide_setting_mtx; 835extern struct mutex ide_setting_mtx;
889 836
@@ -1059,10 +1006,11 @@ enum {
1059}; 1006};
1060 1007
1061/* DRV_NAME has to be defined in the driver before using the macro below */ 1008/* DRV_NAME has to be defined in the driver before using the macro below */
1062#define __ide_debug_log(lvl, fmt, args...) \ 1009#define __ide_debug_log(lvl, fmt, args...) \
1063{ \ 1010{ \
1064 if (unlikely(drive->debug_mask & lvl)) \ 1011 if (unlikely(drive->debug_mask & lvl)) \
1065 printk(KERN_INFO DRV_NAME ": " fmt, ## args); \ 1012 printk(KERN_INFO DRV_NAME ": %s: " fmt "\n", \
1013 __func__, ## args); \
1066} 1014}
1067 1015
1068/* 1016/*
@@ -1101,7 +1049,7 @@ int generic_ide_resume(struct device *);
1101 1049
1102void ide_complete_power_step(ide_drive_t *, struct request *); 1050void ide_complete_power_step(ide_drive_t *, struct request *);
1103ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); 1051ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *);
1104void ide_complete_pm_request(ide_drive_t *, struct request *); 1052void ide_complete_pm_rq(ide_drive_t *, struct request *);
1105void ide_check_pm_state(ide_drive_t *, struct request *); 1053void ide_check_pm_state(ide_drive_t *, struct request *);
1106 1054
1107/* 1055/*
@@ -1113,7 +1061,6 @@ void ide_check_pm_state(ide_drive_t *, struct request *);
1113struct ide_driver { 1061struct ide_driver {
1114 const char *version; 1062 const char *version;
1115 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 1063 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
1116 int (*end_request)(ide_drive_t *, int, int);
1117 struct device_driver gen_driver; 1064 struct device_driver gen_driver;
1118 int (*probe)(ide_drive_t *); 1065 int (*probe)(ide_drive_t *);
1119 void (*remove)(ide_drive_t *); 1066 void (*remove)(ide_drive_t *);
@@ -1144,16 +1091,15 @@ int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned l
1144extern int ide_vlb_clk; 1091extern int ide_vlb_clk;
1145extern int ide_pci_clk; 1092extern int ide_pci_clk;
1146 1093
1147extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); 1094unsigned int ide_rq_bytes(struct request *);
1148int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 1095int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int);
1149 int uptodate, int nr_sectors); 1096void ide_kill_rq(ide_drive_t *, struct request *);
1150 1097
1151extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); 1098void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
1099void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
1152 1100
1153void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, 1101void ide_execute_command(ide_drive_t *, struct ide_cmd *, ide_handler_t *,
1154 ide_expiry_t *); 1102 unsigned int);
1155
1156void ide_execute_pkt_cmd(ide_drive_t *);
1157 1103
1158void ide_pad_transfer(ide_drive_t *, int, int); 1104void ide_pad_transfer(ide_drive_t *, int, int);
1159 1105
@@ -1167,41 +1113,37 @@ int ide_busy_sleep(ide_hwif_t *, unsigned long, int);
1167 1113
1168int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1114int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
1169 1115
1116ide_startstop_t ide_do_park_unpark(ide_drive_t *, struct request *);
1117ide_startstop_t ide_do_devset(ide_drive_t *, struct request *);
1118
1170extern ide_startstop_t ide_do_reset (ide_drive_t *); 1119extern ide_startstop_t ide_do_reset (ide_drive_t *);
1171 1120
1172extern int ide_devset_execute(ide_drive_t *drive, 1121extern int ide_devset_execute(ide_drive_t *drive,
1173 const struct ide_devset *setting, int arg); 1122 const struct ide_devset *setting, int arg);
1174 1123
1175extern void ide_do_drive_cmd(ide_drive_t *, struct request *); 1124void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8);
1125int ide_complete_rq(ide_drive_t *, int, unsigned int);
1176 1126
1177extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1127void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd);
1178 1128void ide_tf_dump(const char *, struct ide_cmd *);
1179void ide_tf_dump(const char *, struct ide_taskfile *);
1180 1129
1181void ide_exec_command(ide_hwif_t *, u8); 1130void ide_exec_command(ide_hwif_t *, u8);
1182u8 ide_read_status(ide_hwif_t *); 1131u8 ide_read_status(ide_hwif_t *);
1183u8 ide_read_altstatus(ide_hwif_t *); 1132u8 ide_read_altstatus(ide_hwif_t *);
1133void ide_write_devctl(ide_hwif_t *, u8);
1184 1134
1185void ide_set_irq(ide_hwif_t *, int); 1135void ide_dev_select(ide_drive_t *);
1186 1136void ide_tf_load(ide_drive_t *, struct ide_taskfile *, u8);
1187void ide_tf_load(ide_drive_t *, ide_task_t *); 1137void ide_tf_read(ide_drive_t *, struct ide_taskfile *, u8);
1188void ide_tf_read(ide_drive_t *, ide_task_t *);
1189 1138
1190void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); 1139void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
1191void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); 1140void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
1192 1141
1193int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int);
1194
1195extern void SELECT_DRIVE(ide_drive_t *);
1196void SELECT_MASK(ide_drive_t *, int); 1142void SELECT_MASK(ide_drive_t *, int);
1197 1143
1198u8 ide_read_error(ide_drive_t *); 1144u8 ide_read_error(ide_drive_t *);
1199void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); 1145void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *);
1200 1146
1201extern int drive_is_ready(ide_drive_t *);
1202
1203void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
1204
1205int ide_check_atapi_device(ide_drive_t *, const char *); 1147int ide_check_atapi_device(ide_drive_t *, const char *);
1206 1148
1207void ide_init_pc(struct ide_atapi_pc *); 1149void ide_init_pc(struct ide_atapi_pc *);
@@ -1238,16 +1180,20 @@ int ide_cd_expiry(ide_drive_t *);
1238 1180
1239int ide_cd_get_xferlen(struct request *); 1181int ide_cd_get_xferlen(struct request *);
1240 1182
1241ide_startstop_t ide_issue_pc(ide_drive_t *); 1183ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_cmd *);
1184
1185ide_startstop_t do_rw_taskfile(ide_drive_t *, struct ide_cmd *);
1242 1186
1243ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 1187void ide_pio_bytes(ide_drive_t *, struct ide_cmd *, unsigned int, unsigned int);
1244 1188
1245void task_end_request(ide_drive_t *, struct request *, u8); 1189void ide_finish_cmd(ide_drive_t *, struct ide_cmd *, u8);
1246 1190
1247int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); 1191int ide_raw_taskfile(ide_drive_t *, struct ide_cmd *, u8 *, u16);
1248int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); 1192int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *);
1249 1193
1250int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 1194int ide_taskfile_ioctl(ide_drive_t *, unsigned long);
1195
1196int ide_dev_read_id(ide_drive_t *, u8, u16 *);
1251 1197
1252extern int ide_driveid_update(ide_drive_t *); 1198extern int ide_driveid_update(ide_drive_t *);
1253extern int ide_config_drive_speed(ide_drive_t *, u8); 1199extern int ide_config_drive_speed(ide_drive_t *, u8);
@@ -1278,7 +1224,7 @@ static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev)
1278 return 0; 1224 return 0;
1279} 1225}
1280 1226
1281void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, 1227void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *,
1282 hw_regs_t *, hw_regs_t **); 1228 hw_regs_t *, hw_regs_t **);
1283void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 1229void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1284 1230
@@ -1347,10 +1293,10 @@ enum {
1347 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), 1293 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19),
1348 /* serialize ports */ 1294 /* serialize ports */
1349 IDE_HFLAG_SERIALIZE = (1 << 20), 1295 IDE_HFLAG_SERIALIZE = (1 << 20),
1350 /* use legacy IRQs */ 1296 /* host is DTC2278 */
1351 IDE_HFLAG_LEGACY_IRQS = (1 << 21), 1297 IDE_HFLAG_DTC2278 = (1 << 21),
1352 /* force use of legacy IRQs */ 1298 /* 4 devices on a single set of I/O ports */
1353 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), 1299 IDE_HFLAG_4DRIVES = (1 << 22),
1354 /* host is TRM290 */ 1300 /* host is TRM290 */
1355 IDE_HFLAG_TRM290 = (1 << 23), 1301 IDE_HFLAG_TRM290 = (1 << 23),
1356 /* use 32-bit I/O ops */ 1302 /* use 32-bit I/O ops */
@@ -1378,7 +1324,12 @@ enum {
1378 1324
1379struct ide_port_info { 1325struct ide_port_info {
1380 char *name; 1326 char *name;
1381 unsigned int (*init_chipset)(struct pci_dev *); 1327
1328 int (*init_chipset)(struct pci_dev *);
1329
1330 void (*get_lock)(irq_handler_t, void *);
1331 void (*release_lock)(void);
1332
1382 void (*init_iops)(ide_hwif_t *); 1333 void (*init_iops)(ide_hwif_t *);
1383 void (*init_hwif)(ide_hwif_t *); 1334 void (*init_hwif)(ide_hwif_t *);
1384 int (*init_dma)(ide_hwif_t *, 1335 int (*init_dma)(ide_hwif_t *,
@@ -1395,6 +1346,9 @@ struct ide_port_info {
1395 u16 max_sectors; /* if < than the default one */ 1346 u16 max_sectors; /* if < than the default one */
1396 1347
1397 u32 host_flags; 1348 u32 host_flags;
1349
1350 int irq_flags;
1351
1398 u8 pio_mask; 1352 u8 pio_mask;
1399 u8 swdma_mask; 1353 u8 swdma_mask;
1400 u8 mwdma_mask; 1354 u8 mwdma_mask;
@@ -1414,8 +1368,8 @@ int ide_pci_resume(struct pci_dev *);
1414#define ide_pci_resume NULL 1368#define ide_pci_resume NULL
1415#endif 1369#endif
1416 1370
1417void ide_map_sg(ide_drive_t *, struct request *); 1371void ide_map_sg(ide_drive_t *, struct ide_cmd *);
1418void ide_init_sg_cmd(ide_drive_t *, struct request *); 1372void ide_init_sg_cmd(struct ide_cmd *, unsigned int);
1419 1373
1420#define BAD_DMA_DRIVE 0 1374#define BAD_DMA_DRIVE 0
1421#define GOOD_DMA_DRIVE 1 1375#define GOOD_DMA_DRIVE 1
@@ -1449,18 +1403,18 @@ ide_startstop_t ide_dma_intr(ide_drive_t *);
1449int ide_allocate_dma_engine(ide_hwif_t *); 1403int ide_allocate_dma_engine(ide_hwif_t *);
1450void ide_release_dma_engine(ide_hwif_t *); 1404void ide_release_dma_engine(ide_hwif_t *);
1451 1405
1452int ide_build_sglist(ide_drive_t *, struct request *); 1406int ide_dma_prepare(ide_drive_t *, struct ide_cmd *);
1453void ide_destroy_dmatable(ide_drive_t *); 1407void ide_dma_unmap_sg(ide_drive_t *, struct ide_cmd *);
1454 1408
1455#ifdef CONFIG_BLK_DEV_IDEDMA_SFF 1409#ifdef CONFIG_BLK_DEV_IDEDMA_SFF
1456int config_drive_for_dma(ide_drive_t *); 1410int config_drive_for_dma(ide_drive_t *);
1457extern int ide_build_dmatable(ide_drive_t *, struct request *); 1411int ide_build_dmatable(ide_drive_t *, struct ide_cmd *);
1458void ide_dma_host_set(ide_drive_t *, int); 1412void ide_dma_host_set(ide_drive_t *, int);
1459extern int ide_dma_setup(ide_drive_t *); 1413int ide_dma_setup(ide_drive_t *, struct ide_cmd *);
1460void ide_dma_exec_cmd(ide_drive_t *, u8);
1461extern void ide_dma_start(ide_drive_t *); 1414extern void ide_dma_start(ide_drive_t *);
1462int ide_dma_end(ide_drive_t *); 1415int ide_dma_end(ide_drive_t *);
1463int ide_dma_test_irq(ide_drive_t *); 1416int ide_dma_test_irq(ide_drive_t *);
1417int ide_dma_sff_timer_expiry(ide_drive_t *);
1464u8 ide_dma_sff_read_status(ide_hwif_t *); 1418u8 ide_dma_sff_read_status(ide_hwif_t *);
1465extern const struct ide_dma_ops sff_dma_ops; 1419extern const struct ide_dma_ops sff_dma_ops;
1466#else 1420#else
@@ -1468,7 +1422,7 @@ static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
1468#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ 1422#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
1469 1423
1470void ide_dma_lost_irq(ide_drive_t *); 1424void ide_dma_lost_irq(ide_drive_t *);
1471void ide_dma_timeout(ide_drive_t *); 1425ide_startstop_t ide_dma_timeout_retry(ide_drive_t *, int);
1472 1426
1473#else 1427#else
1474static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } 1428static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
@@ -1480,21 +1434,29 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; }
1480static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1434static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1481static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1435static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1482static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } 1436static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1437static inline ide_startstop_t ide_dma_intr(ide_drive_t *drive) { return ide_stopped; }
1438static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; }
1483static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } 1439static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
1440static inline int ide_dma_prepare(ide_drive_t *drive,
1441 struct ide_cmd *cmd) { return 1; }
1442static inline void ide_dma_unmap_sg(ide_drive_t *drive,
1443 struct ide_cmd *cmd) { ; }
1484#endif /* CONFIG_BLK_DEV_IDEDMA */ 1444#endif /* CONFIG_BLK_DEV_IDEDMA */
1485 1445
1486#ifdef CONFIG_BLK_DEV_IDEACPI 1446#ifdef CONFIG_BLK_DEV_IDEACPI
1447int ide_acpi_init(void);
1487extern int ide_acpi_exec_tfs(ide_drive_t *drive); 1448extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1488extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1449extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1489extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1450extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1490extern void ide_acpi_init(ide_hwif_t *hwif); 1451void ide_acpi_init_port(ide_hwif_t *);
1491void ide_acpi_port_init_devices(ide_hwif_t *); 1452void ide_acpi_port_init_devices(ide_hwif_t *);
1492extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); 1453extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1493#else 1454#else
1455static inline int ide_acpi_init(void) { return 0; }
1494static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } 1456static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
1495static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1457static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1496static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1458static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1497static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } 1459static inline void ide_acpi_init_port(ide_hwif_t *hwif) { ; }
1498static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; } 1460static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1499static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} 1461static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1500#endif 1462#endif
@@ -1528,11 +1490,9 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1528 hwif->hwif_data = data; 1490 hwif->hwif_data = data;
1529} 1491}
1530 1492
1531const char *ide_xfer_verbose(u8 mode);
1532extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1493extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1533extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1534 1494
1535u64 ide_get_lba_addr(struct ide_taskfile *, int); 1495u64 ide_get_lba_addr(struct ide_cmd *, int);
1536u8 ide_dump_status(ide_drive_t *, const char *, u8); 1496u8 ide_dump_status(ide_drive_t *, const char *, u8);
1537 1497
1538struct ide_timing { 1498struct ide_timing {
@@ -1569,14 +1529,18 @@ void ide_timing_merge(struct ide_timing *, struct ide_timing *,
1569 struct ide_timing *, unsigned int); 1529 struct ide_timing *, unsigned int);
1570int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int); 1530int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
1571 1531
1532#ifdef CONFIG_IDE_XFER_MODE
1572int ide_scan_pio_blacklist(char *); 1533int ide_scan_pio_blacklist(char *);
1573 1534const char *ide_xfer_verbose(u8);
1574u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1535u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1575
1576int ide_set_pio_mode(ide_drive_t *, u8); 1536int ide_set_pio_mode(ide_drive_t *, u8);
1577int ide_set_dma_mode(ide_drive_t *, u8); 1537int ide_set_dma_mode(ide_drive_t *, u8);
1578
1579void ide_set_pio(ide_drive_t *, u8); 1538void ide_set_pio(ide_drive_t *, u8);
1539int ide_set_xfer_rate(ide_drive_t *, u8);
1540#else
1541static inline void ide_set_pio(ide_drive_t *drive, u8 pio) { ; }
1542static inline int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) { return -1; }
1543#endif
1580 1544
1581static inline void ide_set_max_pio(ide_drive_t *drive) 1545static inline void ide_set_max_pio(ide_drive_t *drive)
1582{ 1546{
@@ -1609,6 +1573,10 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1609#define ide_port_for_each_dev(i, dev, port) \ 1573#define ide_port_for_each_dev(i, dev, port) \
1610 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) 1574 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)
1611 1575
1576#define ide_port_for_each_present_dev(i, dev, port) \
1577 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) \
1578 if ((dev)->dev_flags & IDE_DFLAG_PRESENT)
1579
1612#define ide_host_for_each_port(i, port, host) \ 1580#define ide_host_for_each_port(i, port, host) \
1613 for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++) 1581 for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++)
1614 1582
diff --git a/include/linux/idr.h b/include/linux/idr.h
index dd846df8cd32..e968db71e33a 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -106,6 +106,7 @@ int idr_get_new(struct idr *idp, void *ptr, int *id);
106int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); 106int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
107int idr_for_each(struct idr *idp, 107int idr_for_each(struct idr *idp,
108 int (*fn)(int id, void *p, void *data), void *data); 108 int (*fn)(int id, void *p, void *data), void *data);
109void *idr_get_next(struct idr *idp, int *nextid);
109void *idr_replace(struct idr *idp, void *ptr, int id); 110void *idr_replace(struct idr *idp, void *ptr, int id);
110void idr_remove(struct idr *idp, int id); 111void idr_remove(struct idr *idp, int id);
111void idr_remove_all(struct idr *idp); 112void idr_remove_all(struct idr *idp);
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index c4e6ca1a6306..4b501b48ce86 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -18,6 +18,22 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/byteorder.h> 19#include <asm/byteorder.h>
20 20
21/*
22 * DS bit usage
23 *
24 * TA = transmitter address
25 * RA = receiver address
26 * DA = destination address
27 * SA = source address
28 *
29 * ToDS FromDS A1(RA) A2(TA) A3 A4 Use
30 * -----------------------------------------------------------------
31 * 0 0 DA SA BSSID - IBSS/DLS
32 * 0 1 DA BSSID SA - AP -> STA
33 * 1 0 BSSID SA DA - AP <- STA
34 * 1 1 RA TA DA SA unspecified (WDS)
35 */
36
21#define FCS_LEN 4 37#define FCS_LEN 4
22 38
23#define IEEE80211_FCTL_VERS 0x0003 39#define IEEE80211_FCTL_VERS 0x0003
@@ -527,6 +543,8 @@ struct ieee80211_tim_ie {
527 u8 virtual_map[0]; 543 u8 virtual_map[0];
528} __attribute__ ((packed)); 544} __attribute__ ((packed));
529 545
546#define WLAN_SA_QUERY_TR_ID_LEN 16
547
530struct ieee80211_mgmt { 548struct ieee80211_mgmt {
531 __le16 frame_control; 549 __le16 frame_control;
532 __le16 duration; 550 __le16 duration;
@@ -646,6 +664,10 @@ struct ieee80211_mgmt {
646 u8 action_code; 664 u8 action_code;
647 u8 variable[0]; 665 u8 variable[0];
648 } __attribute__((packed)) mesh_action; 666 } __attribute__((packed)) mesh_action;
667 struct {
668 u8 action;
669 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
670 } __attribute__ ((packed)) sa_query;
649 } u; 671 } u;
650 } __attribute__ ((packed)) action; 672 } __attribute__ ((packed)) action;
651 } u; 673 } u;
@@ -655,6 +677,15 @@ struct ieee80211_mgmt {
655#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) 677#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
656 678
657 679
680/* Management MIC information element (IEEE 802.11w) */
681struct ieee80211_mmie {
682 u8 element_id;
683 u8 length;
684 __le16 key_id;
685 u8 sequence_number[6];
686 u8 mic[8];
687} __attribute__ ((packed));
688
658/* Control frames */ 689/* Control frames */
659struct ieee80211_rts { 690struct ieee80211_rts {
660 __le16 frame_control; 691 __le16 frame_control;
@@ -836,6 +867,7 @@ struct ieee80211_ht_info {
836/* Authentication algorithms */ 867/* Authentication algorithms */
837#define WLAN_AUTH_OPEN 0 868#define WLAN_AUTH_OPEN 0
838#define WLAN_AUTH_SHARED_KEY 1 869#define WLAN_AUTH_SHARED_KEY 1
870#define WLAN_AUTH_FT 2
839#define WLAN_AUTH_LEAP 128 871#define WLAN_AUTH_LEAP 128
840 872
841#define WLAN_AUTH_CHALLENGE_LEN 128 873#define WLAN_AUTH_CHALLENGE_LEN 128
@@ -899,6 +931,9 @@ enum ieee80211_statuscode {
899 /* 802.11g */ 931 /* 802.11g */
900 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, 932 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
901 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, 933 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
934 /* 802.11w */
935 WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30,
936 WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31,
902 /* 802.11i */ 937 /* 802.11i */
903 WLAN_STATUS_INVALID_IE = 40, 938 WLAN_STATUS_INVALID_IE = 40,
904 WLAN_STATUS_INVALID_GROUP_CIPHER = 41, 939 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
@@ -1018,6 +1053,8 @@ enum ieee80211_eid {
1018 WLAN_EID_HT_INFORMATION = 61, 1053 WLAN_EID_HT_INFORMATION = 61,
1019 /* 802.11i */ 1054 /* 802.11i */
1020 WLAN_EID_RSN = 48, 1055 WLAN_EID_RSN = 48,
1056 WLAN_EID_TIMEOUT_INTERVAL = 56,
1057 WLAN_EID_MMIE = 76 /* 802.11w */,
1021 WLAN_EID_WPA = 221, 1058 WLAN_EID_WPA = 221,
1022 WLAN_EID_GENERIC = 221, 1059 WLAN_EID_GENERIC = 221,
1023 WLAN_EID_VENDOR_SPECIFIC = 221, 1060 WLAN_EID_VENDOR_SPECIFIC = 221,
@@ -1030,6 +1067,8 @@ enum ieee80211_category {
1030 WLAN_CATEGORY_QOS = 1, 1067 WLAN_CATEGORY_QOS = 1,
1031 WLAN_CATEGORY_DLS = 2, 1068 WLAN_CATEGORY_DLS = 2,
1032 WLAN_CATEGORY_BACK = 3, 1069 WLAN_CATEGORY_BACK = 3,
1070 WLAN_CATEGORY_PUBLIC = 4,
1071 WLAN_CATEGORY_SA_QUERY = 8,
1033 WLAN_CATEGORY_WMM = 17, 1072 WLAN_CATEGORY_WMM = 17,
1034}; 1073};
1035 1074
@@ -1104,6 +1143,12 @@ struct ieee80211_country_ie_triplet {
1104 }; 1143 };
1105} __attribute__ ((packed)); 1144} __attribute__ ((packed));
1106 1145
1146enum ieee80211_timeout_interval_type {
1147 WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */,
1148 WLAN_TIMEOUT_KEY_LIFETIME = 2 /* 802.11r */,
1149 WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */,
1150};
1151
1107/* BACK action code */ 1152/* BACK action code */
1108enum ieee80211_back_actioncode { 1153enum ieee80211_back_actioncode {
1109 WLAN_ACTION_ADDBA_REQ = 0, 1154 WLAN_ACTION_ADDBA_REQ = 0,
@@ -1118,6 +1163,13 @@ enum ieee80211_back_parties {
1118 WLAN_BACK_TIMER = 2, 1163 WLAN_BACK_TIMER = 2,
1119}; 1164};
1120 1165
1166/* SA Query action */
1167enum ieee80211_sa_query_action {
1168 WLAN_ACTION_SA_QUERY_REQUEST = 0,
1169 WLAN_ACTION_SA_QUERY_RESPONSE = 1,
1170};
1171
1172
1121/* A-MSDU 802.11n */ 1173/* A-MSDU 802.11n */
1122#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080 1174#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
1123 1175
@@ -1128,6 +1180,7 @@ enum ieee80211_back_parties {
1128/* reserved: 0x000FAC03 */ 1180/* reserved: 0x000FAC03 */
1129#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04 1181#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
1130#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 1182#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1183#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
1131 1184
1132#define WLAN_MAX_KEY_LEN 32 1185#define WLAN_MAX_KEY_LEN 32
1133 1186
@@ -1185,4 +1238,149 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1185 return hdr->addr1; 1238 return hdr->addr1;
1186} 1239}
1187 1240
1241/**
1242 * ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame
1243 * @hdr: the frame (buffer must include at least the first octet of payload)
1244 */
1245static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1246{
1247 if (ieee80211_is_disassoc(hdr->frame_control) ||
1248 ieee80211_is_deauth(hdr->frame_control))
1249 return true;
1250
1251 if (ieee80211_is_action(hdr->frame_control)) {
1252 u8 *category;
1253
1254 /*
1255 * Action frames, excluding Public Action frames, are Robust
1256 * Management Frames. However, if we are looking at a Protected
1257 * frame, skip the check since the data may be encrypted and
1258 * the frame has already been found to be a Robust Management
1259 * Frame (by the other end).
1260 */
1261 if (ieee80211_has_protected(hdr->frame_control))
1262 return true;
1263 category = ((u8 *) hdr) + 24;
1264 return *category != WLAN_CATEGORY_PUBLIC;
1265 }
1266
1267 return false;
1268}
1269
1270/**
1271 * ieee80211_fhss_chan_to_freq - get channel frequency
1272 * @channel: the FHSS channel
1273 *
1274 * Convert IEEE802.11 FHSS channel to frequency (MHz)
1275 * Ref IEEE 802.11-2007 section 14.6
1276 */
1277static inline int ieee80211_fhss_chan_to_freq(int channel)
1278{
1279 if ((channel > 1) && (channel < 96))
1280 return channel + 2400;
1281 else
1282 return -1;
1283}
1284
1285/**
1286 * ieee80211_freq_to_fhss_chan - get channel
1287 * @freq: the channels frequency
1288 *
1289 * Convert frequency (MHz) to IEEE802.11 FHSS channel
1290 * Ref IEEE 802.11-2007 section 14.6
1291 */
1292static inline int ieee80211_freq_to_fhss_chan(int freq)
1293{
1294 if ((freq > 2401) && (freq < 2496))
1295 return freq - 2400;
1296 else
1297 return -1;
1298}
1299
1300/**
1301 * ieee80211_dsss_chan_to_freq - get channel center frequency
1302 * @channel: the DSSS channel
1303 *
1304 * Convert IEEE802.11 DSSS channel to the center frequency (MHz).
1305 * Ref IEEE 802.11-2007 section 15.6
1306 */
1307static inline int ieee80211_dsss_chan_to_freq(int channel)
1308{
1309 if ((channel > 0) && (channel < 14))
1310 return 2407 + (channel * 5);
1311 else if (channel == 14)
1312 return 2484;
1313 else
1314 return -1;
1315}
1316
1317/**
1318 * ieee80211_freq_to_dsss_chan - get channel
1319 * @freq: the frequency
1320 *
1321 * Convert frequency (MHz) to IEEE802.11 DSSS channel
1322 * Ref IEEE 802.11-2007 section 15.6
1323 *
1324 * This routine selects the channel with the closest center frequency.
1325 */
1326static inline int ieee80211_freq_to_dsss_chan(int freq)
1327{
1328 if ((freq >= 2410) && (freq < 2475))
1329 return (freq - 2405) / 5;
1330 else if ((freq >= 2482) && (freq < 2487))
1331 return 14;
1332 else
1333 return -1;
1334}
1335
1336/* Convert IEEE802.11 HR DSSS channel to frequency (MHz) and back
1337 * Ref IEEE 802.11-2007 section 18.4.6.2
1338 *
1339 * The channels and frequencies are the same as those defined for DSSS
1340 */
1341#define ieee80211_hr_chan_to_freq(chan) ieee80211_dsss_chan_to_freq(chan)
1342#define ieee80211_freq_to_hr_chan(freq) ieee80211_freq_to_dsss_chan(freq)
1343
1344/* Convert IEEE802.11 ERP channel to frequency (MHz) and back
1345 * Ref IEEE 802.11-2007 section 19.4.2
1346 */
1347#define ieee80211_erp_chan_to_freq(chan) ieee80211_hr_chan_to_freq(chan)
1348#define ieee80211_freq_to_erp_chan(freq) ieee80211_freq_to_hr_chan(freq)
1349
1350/**
1351 * ieee80211_ofdm_chan_to_freq - get channel center frequency
1352 * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
1353 * @channel: the OFDM channel
1354 *
1355 * Convert IEEE802.11 OFDM channel to center frequency (MHz)
1356 * Ref IEEE 802.11-2007 section 17.3.8.3.2
1357 */
1358static inline int ieee80211_ofdm_chan_to_freq(int s_freq, int channel)
1359{
1360 if ((channel > 0) && (channel <= 200) &&
1361 (s_freq >= 4000))
1362 return s_freq + (channel * 5);
1363 else
1364 return -1;
1365}
1366
1367/**
1368 * ieee80211_freq_to_ofdm_channel - get channel
1369 * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
1370 * @freq: the frequency
1371 *
1372 * Convert frequency (MHz) to IEEE802.11 OFDM channel
1373 * Ref IEEE 802.11-2007 section 17.3.8.3.2
1374 *
1375 * This routine selects the channel with the closest center frequency.
1376 */
1377static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
1378{
1379 if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) &&
1380 (s_freq >= 4000))
1381 return (freq + 2 - s_freq) / 5;
1382 else
1383 return -1;
1384}
1385
1188#endif /* LINUX_IEEE80211_H */ 1386#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if.h b/include/linux/if.h
index 2a6e29620a96..1108f3e099e3 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -66,6 +66,7 @@
66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ 66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ 67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */ 68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
69#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */
69 70
70#define IF_GET_IFACE 0x0001 /* for querying only */ 71#define IF_GET_IFACE 0x0001 /* for querying only */
71#define IF_GET_PROTO 0x0002 72#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arcnet.h b/include/linux/if_arcnet.h
index 27ea2ac445ad..0835debab115 100644
--- a/include/linux/if_arcnet.h
+++ b/include/linux/if_arcnet.h
@@ -16,6 +16,7 @@
16#ifndef _LINUX_IF_ARCNET_H 16#ifndef _LINUX_IF_ARCNET_H
17#define _LINUX_IF_ARCNET_H 17#define _LINUX_IF_ARCNET_H
18 18
19#include <linux/types.h>
19#include <linux/if_ether.h> 20#include <linux/if_ether.h>
20 21
21 22
@@ -57,10 +58,10 @@
57 */ 58 */
58struct arc_rfc1201 59struct arc_rfc1201
59{ 60{
60 uint8_t proto; /* protocol ID field - varies */ 61 __u8 proto; /* protocol ID field - varies */
61 uint8_t split_flag; /* for use with split packets */ 62 __u8 split_flag; /* for use with split packets */
62 __be16 sequence; /* sequence number */ 63 __be16 sequence; /* sequence number */
63 uint8_t payload[0]; /* space remaining in packet (504 bytes)*/ 64 __u8 payload[0]; /* space remaining in packet (504 bytes)*/
64}; 65};
65#define RFC1201_HDR_SIZE 4 66#define RFC1201_HDR_SIZE 4
66 67
@@ -70,8 +71,8 @@ struct arc_rfc1201
70 */ 71 */
71struct arc_rfc1051 72struct arc_rfc1051
72{ 73{
73 uint8_t proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */ 74 __u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */
74 uint8_t payload[0]; /* 507 bytes */ 75 __u8 payload[0]; /* 507 bytes */
75}; 76};
76#define RFC1051_HDR_SIZE 1 77#define RFC1051_HDR_SIZE 1
77 78
@@ -82,20 +83,20 @@ struct arc_rfc1051
82 */ 83 */
83struct arc_eth_encap 84struct arc_eth_encap
84{ 85{
85 uint8_t proto; /* Always ARC_P_ETHER */ 86 __u8 proto; /* Always ARC_P_ETHER */
86 struct ethhdr eth; /* standard ethernet header (yuck!) */ 87 struct ethhdr eth; /* standard ethernet header (yuck!) */
87 uint8_t payload[0]; /* 493 bytes */ 88 __u8 payload[0]; /* 493 bytes */
88}; 89};
89#define ETH_ENCAP_HDR_SIZE 14 90#define ETH_ENCAP_HDR_SIZE 14
90 91
91 92
92struct arc_cap 93struct arc_cap
93{ 94{
94 uint8_t proto; 95 __u8 proto;
95 uint8_t cookie[sizeof(int)]; /* Actually NOT sent over the network */ 96 __u8 cookie[sizeof(int)]; /* Actually NOT sent over the network */
96 union { 97 union {
97 uint8_t ack; 98 __u8 ack;
98 uint8_t raw[0]; /* 507 bytes */ 99 __u8 raw[0]; /* 507 bytes */
99 } mes; 100 } mes;
100}; 101};
101 102
@@ -109,7 +110,7 @@ struct arc_cap
109 */ 110 */
110struct arc_hardware 111struct arc_hardware
111{ 112{
112 uint8_t source, /* source ARCnet - filled in automagically */ 113 __u8 source, /* source ARCnet - filled in automagically */
113 dest, /* destination ARCnet - 0 for broadcast */ 114 dest, /* destination ARCnet - 0 for broadcast */
114 offset[2]; /* offset bytes (some weird semantics) */ 115 offset[2]; /* offset bytes (some weird semantics) */
115}; 116};
@@ -130,7 +131,7 @@ struct archdr
130 struct arc_rfc1051 rfc1051; 131 struct arc_rfc1051 rfc1051;
131 struct arc_eth_encap eth_encap; 132 struct arc_eth_encap eth_encap;
132 struct arc_cap cap; 133 struct arc_cap cap;
133 uint8_t raw[0]; /* 508 bytes */ 134 __u8 raw[0]; /* 508 bytes */
134 } soft; 135 } soft;
135}; 136};
136 137
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 7f3c735f422b..cfe4fe1b7132 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -17,7 +17,7 @@
17 * as published by the Free Software Foundation; either version 17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20 20
21#ifndef _LINUX_IF_ETHER_H 21#ifndef _LINUX_IF_ETHER_H
22#define _LINUX_IF_ETHER_H 22#define _LINUX_IF_ETHER_H
23 23
@@ -25,7 +25,7 @@
25 25
26/* 26/*
27 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble 27 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
28 * and FCS/CRC (frame check sequence). 28 * and FCS/CRC (frame check sequence).
29 */ 29 */
30 30
31#define ETH_ALEN 6 /* Octets in one ethernet addr */ 31#define ETH_ALEN 6 /* Octets in one ethernet addr */
@@ -78,12 +78,13 @@
78#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 78#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
79#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 79#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
80#define ETH_P_TIPC 0x88CA /* TIPC */ 80#define ETH_P_TIPC 0x88CA /* TIPC */
81#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
81#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ 82#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
82 83
83/* 84/*
84 * Non DIX types. Won't clash for 1500 types. 85 * Non DIX types. Won't clash for 1500 types.
85 */ 86 */
86 87
87#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ 88#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */
88#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ 89#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */
89#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ 90#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */
@@ -109,7 +110,7 @@
109/* 110/*
110 * This is an Ethernet frame header. 111 * This is an Ethernet frame header.
111 */ 112 */
112 113
113struct ethhdr { 114struct ethhdr {
114 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ 115 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
115 unsigned char h_source[ETH_ALEN]; /* source ether addr */ 116 unsigned char h_source[ETH_ALEN]; /* source ether addr */
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 60e16a551dd6..673f2209453d 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -153,7 +153,6 @@ struct frhdr
153 153
154struct dlci_local 154struct dlci_local
155{ 155{
156 struct net_device_stats stats;
157 struct net_device *master; 156 struct net_device *master;
158 struct net_device *slave; 157 struct net_device *slave;
159 struct dlci_conf config; 158 struct dlci_conf config;
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index c7a66882b6d0..3a14b088c8ec 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -26,7 +26,7 @@
26 */ 26 */
27struct pppol2tp_addr 27struct pppol2tp_addr
28{ 28{
29 pid_t pid; /* pid that owns the fd. 29 __kernel_pid_t pid; /* pid that owns the fd.
30 * 0 => current */ 30 * 0 => current */
31 int fd; /* FD of UDP socket to use */ 31 int fd; /* FD of UDP socket to use */
32 32
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 30c88b2245ff..90b5fae5d714 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -95,16 +95,16 @@ struct pppoe_tag {
95} __attribute ((packed)); 95} __attribute ((packed));
96 96
97/* Tag identifiers */ 97/* Tag identifiers */
98#define PTT_EOL __constant_htons(0x0000) 98#define PTT_EOL __cpu_to_be16(0x0000)
99#define PTT_SRV_NAME __constant_htons(0x0101) 99#define PTT_SRV_NAME __cpu_to_be16(0x0101)
100#define PTT_AC_NAME __constant_htons(0x0102) 100#define PTT_AC_NAME __cpu_to_be16(0x0102)
101#define PTT_HOST_UNIQ __constant_htons(0x0103) 101#define PTT_HOST_UNIQ __cpu_to_be16(0x0103)
102#define PTT_AC_COOKIE __constant_htons(0x0104) 102#define PTT_AC_COOKIE __cpu_to_be16(0x0104)
103#define PTT_VENDOR __constant_htons(0x0105) 103#define PTT_VENDOR __cpu_to_be16(0x0105)
104#define PTT_RELAY_SID __constant_htons(0x0110) 104#define PTT_RELAY_SID __cpu_to_be16(0x0110)
105#define PTT_SRV_ERR __constant_htons(0x0201) 105#define PTT_SRV_ERR __cpu_to_be16(0x0201)
106#define PTT_SYS_ERR __constant_htons(0x0202) 106#define PTT_SYS_ERR __cpu_to_be16(0x0202)
107#define PTT_GEN_ERR __constant_htons(0x0203) 107#define PTT_GEN_ERR __cpu_to_be16(0x0203)
108 108
109struct pppoe_hdr { 109struct pppoe_hdr {
110#if defined(__LITTLE_ENDIAN_BITFIELD) 110#if defined(__LITTLE_ENDIAN_BITFIELD)
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 8529f57ba263..049d6c9428db 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -46,6 +46,8 @@
46#define TUNSETOFFLOAD _IOW('T', 208, unsigned int) 46#define TUNSETOFFLOAD _IOW('T', 208, unsigned int)
47#define TUNSETTXFILTER _IOW('T', 209, unsigned int) 47#define TUNSETTXFILTER _IOW('T', 209, unsigned int)
48#define TUNGETIFF _IOR('T', 210, unsigned int) 48#define TUNGETIFF _IOR('T', 210, unsigned int)
49#define TUNGETSNDBUF _IOR('T', 211, int)
50#define TUNSETSNDBUF _IOW('T', 212, int)
49 51
50/* TUNSETIFF ifr flags */ 52/* TUNSETIFF ifr flags */
51#define IFF_TUN 0x0001 53#define IFF_TUN 0x0001
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 82c43624c067..5a9aae4adb44 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -16,14 +16,14 @@
16#define SIOCDELPRL (SIOCDEVPRIVATE + 6) 16#define SIOCDELPRL (SIOCDEVPRIVATE + 6)
17#define SIOCCHGPRL (SIOCDEVPRIVATE + 7) 17#define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
18 18
19#define GRE_CSUM __constant_htons(0x8000) 19#define GRE_CSUM __cpu_to_be16(0x8000)
20#define GRE_ROUTING __constant_htons(0x4000) 20#define GRE_ROUTING __cpu_to_be16(0x4000)
21#define GRE_KEY __constant_htons(0x2000) 21#define GRE_KEY __cpu_to_be16(0x2000)
22#define GRE_SEQ __constant_htons(0x1000) 22#define GRE_SEQ __cpu_to_be16(0x1000)
23#define GRE_STRICT __constant_htons(0x0800) 23#define GRE_STRICT __cpu_to_be16(0x0800)
24#define GRE_REC __constant_htons(0x0700) 24#define GRE_REC __cpu_to_be16(0x0700)
25#define GRE_FLAGS __constant_htons(0x00F8) 25#define GRE_FLAGS __cpu_to_be16(0x00F8)
26#define GRE_VERSION __constant_htons(0x0007) 26#define GRE_VERSION __cpu_to_be16(0x0007)
27 27
28struct ip_tunnel_parm 28struct ip_tunnel_parm
29{ 29{
diff --git a/include/linux/ima.h b/include/linux/ima.h
new file mode 100644
index 000000000000..0e2aa45cb0ce
--- /dev/null
+++ b/include/linux/ima.h
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2008 IBM Corporation
3 * Author: Mimi Zohar <zohar@us.ibm.com>
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, version 2 of the License.
8 */
9
10#ifndef _LINUX_IMA_H
11#define _LINUX_IMA_H
12
13#include <linux/fs.h>
14struct linux_binprm;
15
16#ifdef CONFIG_IMA
17extern int ima_bprm_check(struct linux_binprm *bprm);
18extern int ima_inode_alloc(struct inode *inode);
19extern void ima_inode_free(struct inode *inode);
20extern int ima_path_check(struct path *path, int mask);
21extern void ima_file_free(struct file *file);
22extern int ima_file_mmap(struct file *file, unsigned long prot);
23extern void ima_shm_check(struct file *file);
24
25#else
26static inline int ima_bprm_check(struct linux_binprm *bprm)
27{
28 return 0;
29}
30
31static inline int ima_inode_alloc(struct inode *inode)
32{
33 return 0;
34}
35
36static inline void ima_inode_free(struct inode *inode)
37{
38 return;
39}
40
41static inline int ima_path_check(struct path *path, int mask)
42{
43 return 0;
44}
45
46static inline void ima_file_free(struct file *file)
47{
48 return;
49}
50
51static inline int ima_file_mmap(struct file *file, unsigned long prot)
52{
53 return 0;
54}
55
56static inline void ima_shm_check(struct file *file)
57{
58 return;
59}
60#endif /* CONFIG_IMA_H */
61#endif /* _LINUX_IMA_H */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index bc492048c349..718bf21c5754 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -44,11 +44,11 @@ struct in6_addr
44 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined 44 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
45 * in network byte order, not in host byte order as are the IPv4 equivalents 45 * in network byte order, not in host byte order as are the IPv4 equivalents
46 */ 46 */
47#ifdef __KERNEL__
47extern const struct in6_addr in6addr_any; 48extern const struct in6_addr in6addr_any;
48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 49#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
49extern const struct in6_addr in6addr_loopback; 50extern const struct in6_addr in6addr_loopback;
50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } 51#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
51#ifdef __KERNEL__
52extern const struct in6_addr in6addr_linklocal_allnodes; 52extern const struct in6_addr in6addr_linklocal_allnodes;
53#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \ 53#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
54 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } 54 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 06fcdb45106b..acef2a770b6b 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -108,6 +108,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
108#define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER) 108#define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER)
109#define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE) 109#define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
110#define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE) 110#define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
111#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
111 112
112struct in_ifaddr 113struct in_ifaddr
113{ 114{
diff --git a/include/linux/init.h b/include/linux/init.h
index 68cb0265d009..0e06c176f185 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -2,6 +2,8 @@
2#define _LINUX_INIT_H 2#define _LINUX_INIT_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/section-names.h>
6#include <linux/stringify.h>
5 7
6/* These macros are used to mark some functions or 8/* These macros are used to mark some functions or
7 * initialized data (doesn't apply to uninitialized data) 9 * initialized data (doesn't apply to uninitialized data)
@@ -60,14 +62,6 @@
60#define __refdata __section(.ref.data) 62#define __refdata __section(.ref.data)
61#define __refconst __section(.ref.rodata) 63#define __refconst __section(.ref.rodata)
62 64
63/* backward compatibility note
64 * A few places hardcode the old section names:
65 * .text.init.refok
66 * .data.init.refok
67 * .exit.text.refok
68 * They should be converted to use the defines from this file
69 */
70
71/* compatibility defines */ 65/* compatibility defines */
72#define __init_refok __ref 66#define __init_refok __ref
73#define __initdata_refok __refdata 67#define __initdata_refok __refdata
@@ -107,7 +101,7 @@
107#define __memexitconst __section(.memexit.rodata) 101#define __memexitconst __section(.memexit.rodata)
108 102
109/* For assembly routines */ 103/* For assembly routines */
110#define __HEAD .section ".head.text","ax" 104#define __HEAD .section __stringify(HEAD_TEXT_SECTION),"ax"
111#define __INIT .section ".init.text","ax" 105#define __INIT .section ".init.text","ax"
112#define __FINIT .previous 106#define __FINIT .previous
113 107
@@ -247,6 +241,7 @@ struct obs_kernel_param {
247 241
248/* Relies on boot_command_line being set */ 242/* Relies on boot_command_line being set */
249void __init parse_early_param(void); 243void __init parse_early_param(void);
244void __init parse_early_options(char *cmdline);
250#endif /* __ASSEMBLY__ */ 245#endif /* __ASSEMBLY__ */
251 246
252/** 247/**
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index e752d973fa21..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, \
@@ -147,6 +135,7 @@ extern struct cred init_cred;
147 .nr_cpus_allowed = NR_CPUS, \ 135 .nr_cpus_allowed = NR_CPUS, \
148 }, \ 136 }, \
149 .tasks = LIST_HEAD_INIT(tsk.tasks), \ 137 .tasks = LIST_HEAD_INIT(tsk.tasks), \
138 .pushable_tasks = PLIST_NODE_INIT(tsk.pushable_tasks, MAX_PRIO), \
150 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \ 139 .ptraced = LIST_HEAD_INIT(tsk.ptraced), \
151 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \ 140 .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
152 .real_parent = &tsk, \ 141 .real_parent = &tsk, \
@@ -184,6 +173,7 @@ extern struct cred init_cred;
184 INIT_IDS \ 173 INIT_IDS \
185 INIT_TRACE_IRQFLAGS \ 174 INIT_TRACE_IRQFLAGS \
186 INIT_LOCKDEP \ 175 INIT_LOCKDEP \
176 INIT_FTRACE_GRAPH \
187} 177}
188 178
189 179
diff --git a/include/linux/input.h b/include/linux/input.h
index 1249a0c20a38..0e6ff5de3588 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -106,6 +106,7 @@ struct input_absinfo {
106 106
107#define SYN_REPORT 0 107#define SYN_REPORT 0
108#define SYN_CONFIG 1 108#define SYN_CONFIG 1
109#define SYN_MT_REPORT 2
109 110
110/* 111/*
111 * Keys and buttons 112 * Keys and buttons
@@ -445,6 +446,7 @@ struct input_absinfo {
445#define BTN_STYLUS2 0x14c 446#define BTN_STYLUS2 0x14c
446#define BTN_TOOL_DOUBLETAP 0x14d 447#define BTN_TOOL_DOUBLETAP 0x14d
447#define BTN_TOOL_TRIPLETAP 0x14e 448#define BTN_TOOL_TRIPLETAP 0x14e
449#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
448 450
449#define BTN_WHEEL 0x150 451#define BTN_WHEEL 0x150
450#define BTN_GEAR_DOWN 0x150 452#define BTN_GEAR_DOWN 0x150
@@ -644,6 +646,17 @@ struct input_absinfo {
644#define ABS_TOOL_WIDTH 0x1c 646#define ABS_TOOL_WIDTH 0x1c
645#define ABS_VOLUME 0x20 647#define ABS_VOLUME 0x20
646#define ABS_MISC 0x28 648#define ABS_MISC 0x28
649
650#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
651#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
652#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
653#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
654#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
655#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */
656#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */
657#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
658#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
659
647#define ABS_MAX 0x3f 660#define ABS_MAX 0x3f
648#define ABS_CNT (ABS_MAX+1) 661#define ABS_CNT (ABS_MAX+1)
649 662
@@ -661,6 +674,7 @@ struct input_absinfo {
661#define SW_DOCK 0x05 /* set = plugged into dock */ 674#define SW_DOCK 0x05 /* set = plugged into dock */
662#define SW_LINEOUT_INSERT 0x06 /* set = inserted */ 675#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
663#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ 676#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
677#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */
664#define SW_MAX 0x0f 678#define SW_MAX 0x0f
665#define SW_CNT (SW_MAX+1) 679#define SW_CNT (SW_MAX+1)
666 680
@@ -742,6 +756,12 @@ struct input_absinfo {
742#define BUS_ATARI 0x1B 756#define BUS_ATARI 0x1B
743 757
744/* 758/*
759 * MT_TOOL types
760 */
761#define MT_TOOL_FINGER 0
762#define MT_TOOL_PEN 1
763
764/*
745 * Values describing the status of a force-feedback effect 765 * Values describing the status of a force-feedback effect
746 */ 766 */
747#define FF_STATUS_STOPPED 0x00 767#define FF_STATUS_STOPPED 0x00
@@ -1310,6 +1330,11 @@ static inline void input_sync(struct input_dev *dev)
1310 input_event(dev, EV_SYN, SYN_REPORT, 0); 1330 input_event(dev, EV_SYN, SYN_REPORT, 0);
1311} 1331}
1312 1332
1333static inline void input_mt_sync(struct input_dev *dev)
1334{
1335 input_event(dev, EV_SYN, SYN_MT_REPORT, 0);
1336}
1337
1313void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); 1338void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1314 1339
1315static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1340static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index d2e3cbfba14f..aa8c53171233 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -123,7 +123,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
123#define ecap_eim_support(e) ((e >> 4) & 0x1) 123#define ecap_eim_support(e) ((e >> 4) & 0x1)
124#define ecap_ir_support(e) ((e >> 3) & 0x1) 124#define ecap_ir_support(e) ((e >> 3) & 0x1)
125#define ecap_max_handle_mask(e) ((e >> 20) & 0xf) 125#define ecap_max_handle_mask(e) ((e >> 20) & 0xf)
126 126#define ecap_sc_support(e) ((e >> 7) & 0x1) /* Snooping Control */
127 127
128/* IOTLB_REG */ 128/* IOTLB_REG */
129#define DMA_TLB_FLUSH_GRANU_OFFSET 60 129#define DMA_TLB_FLUSH_GRANU_OFFSET 60
@@ -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;
@@ -292,6 +302,8 @@ struct intel_iommu {
292 spinlock_t register_lock; /* protect register handling */ 302 spinlock_t register_lock; /* protect register handling */
293 int seq_id; /* sequence id of the iommu */ 303 int seq_id; /* sequence id of the iommu */
294 int agaw; /* agaw of this iommu */ 304 int agaw; /* agaw of this iommu */
305 unsigned int irq;
306 unsigned char name[13]; /* Device Name */
295 307
296#ifdef CONFIG_DMAR 308#ifdef CONFIG_DMAR
297 unsigned long *domain_ids; /* bitmap of domains */ 309 unsigned long *domain_ids; /* bitmap of domains */
@@ -299,11 +311,11 @@ struct intel_iommu {
299 spinlock_t lock; /* protect context, domain ids */ 311 spinlock_t lock; /* protect context, domain ids */
300 struct root_entry *root_entry; /* virtual address */ 312 struct root_entry *root_entry; /* virtual address */
301 313
302 unsigned int irq;
303 unsigned char name[7]; /* Device Name */
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
@@ -321,6 +333,8 @@ extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev);
321extern int alloc_iommu(struct dmar_drhd_unit *drhd); 333extern 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);
336extern void dmar_disable_qi(struct intel_iommu *iommu);
337extern int dmar_reenable_qi(struct intel_iommu *iommu);
324extern void qi_global_iec(struct intel_iommu *iommu); 338extern void qi_global_iec(struct intel_iommu *iommu);
325 339
326extern 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,
@@ -331,11 +345,4 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
331 345
332extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 346extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
333 347
334extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t);
335extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t);
336extern dma_addr_t intel_map_single(struct device *, phys_addr_t, size_t, int);
337extern void intel_unmap_single(struct device *, dma_addr_t, size_t, int);
338extern int intel_map_sg(struct device *, struct scatterlist *, int, int);
339extern void intel_unmap_sg(struct device *, struct scatterlist *, int, int);
340
341#endif 348#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 9127f6b51a39..91bb76f44f14 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -59,8 +59,34 @@
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
76/**
77 * struct irqaction - per interrupt action descriptor
78 * @handler: interrupt handler function
79 * @flags: flags (see IRQF_* above)
80 * @mask: no comment as it is useless and about to be removed
81 * @name: name of the device
82 * @dev_id: cookie to identify the device
83 * @next: pointer to the next irqaction for shared interrupts
84 * @irq: interrupt number
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
89 */
64struct irqaction { 90struct irqaction {
65 irq_handler_t handler; 91 irq_handler_t handler;
66 unsigned long flags; 92 unsigned long flags;
@@ -70,18 +96,68 @@ struct irqaction {
70 struct irqaction *next; 96 struct irqaction *next;
71 int irq; 97 int irq;
72 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;
73}; 102};
74 103
75extern irqreturn_t no_action(int cpl, void *dev_id); 104extern irqreturn_t no_action(int cpl, void *dev_id);
76extern int __must_check request_irq(unsigned int, irq_handler_t handler, 105
77 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
78extern void free_irq(unsigned int, void *); 143extern void free_irq(unsigned int, void *);
79 144
80struct device; 145struct device;
81 146
82extern int __must_check devm_request_irq(struct device *dev, unsigned int irq, 147extern int __must_check
83 irq_handler_t handler, unsigned long irqflags, 148devm_request_threaded_irq(struct device *dev, unsigned int irq,
84 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
85extern 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);
86 162
87/* 163/*
@@ -106,6 +182,15 @@ extern void disable_irq_nosync(unsigned int irq);
106extern void disable_irq(unsigned int irq); 182extern void disable_irq(unsigned int irq);
107extern void enable_irq(unsigned int irq); 183extern void enable_irq(unsigned int irq);
108 184
185/* The following three functions are for the core kernel use only. */
186extern void suspend_device_irqs(void);
187extern void resume_device_irqs(void);
188#ifdef CONFIG_PM_SLEEP
189extern int check_wakeup_irqs(void);
190#else
191static inline int check_wakeup_irqs(void) { return 0; }
192#endif
193
109#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 194#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
110 195
111extern cpumask_var_t irq_default_affinity; 196extern cpumask_var_t irq_default_affinity;
@@ -258,6 +343,11 @@ enum
258 NR_SOFTIRQS 343 NR_SOFTIRQS
259}; 344};
260 345
346/* map softirq index to softirq name. update 'softirq_to_name' in
347 * kernel/softirq.c when adding a new softirq.
348 */
349extern char *softirq_to_name[NR_SOFTIRQS];
350
261/* softirq mask and active fields moved to irq_cpustat_t in 351/* softirq mask and active fields moved to irq_cpustat_t in
262 * asm/hardirq.h to get better cache usage. KAO 352 * asm/hardirq.h to get better cache usage. KAO
263 */ 353 */
@@ -274,6 +364,7 @@ extern void softirq_init(void);
274#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)
275extern void raise_softirq_irqoff(unsigned int nr); 365extern void raise_softirq_irqoff(unsigned int nr);
276extern void raise_softirq(unsigned int nr); 366extern void raise_softirq(unsigned int nr);
367extern void wakeup_softirqd(void);
277 368
278/* This is the worklist that queues up per-cpu softirq work. 369/* This is the worklist that queues up per-cpu softirq work.
279 * 370 *
@@ -462,11 +553,18 @@ static inline void init_irq_proc(void)
462} 553}
463#endif 554#endif
464 555
556#if defined(CONFIG_GENERIC_HARDIRQS) && defined(CONFIG_DEBUG_SHIRQ)
557extern void debug_poll_all_shared_irqs(void);
558#else
559static inline void debug_poll_all_shared_irqs(void) { }
560#endif
561
465int show_interrupts(struct seq_file *p, void *v); 562int show_interrupts(struct seq_file *p, void *v);
466 563
467struct irq_desc; 564struct irq_desc;
468 565
469extern int early_irq_init(void); 566extern int early_irq_init(void);
567extern int arch_probe_nr_irqs(void);
470extern int arch_early_irq_init(void); 568extern int arch_early_irq_init(void);
471extern int arch_init_chip_data(struct irq_desc *desc, int cpu); 569extern int arch_init_chip_data(struct irq_desc *desc, int cpu);
472 570
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 8a7bfb1b6ca0..3af4ffd591b9 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -21,6 +21,7 @@
21 21
22#define IOMMU_READ (1) 22#define IOMMU_READ (1)
23#define IOMMU_WRITE (2) 23#define IOMMU_WRITE (2)
24#define IOMMU_CACHE (4) /* DMA cache coherency */
24 25
25struct device; 26struct device;
26 27
@@ -28,6 +29,8 @@ struct iommu_domain {
28 void *priv; 29 void *priv;
29}; 30};
30 31
32#define IOMMU_CAP_CACHE_COHERENCY 0x1
33
31struct iommu_ops { 34struct iommu_ops {
32 int (*domain_init)(struct iommu_domain *domain); 35 int (*domain_init)(struct iommu_domain *domain);
33 void (*domain_destroy)(struct iommu_domain *domain); 36 void (*domain_destroy)(struct iommu_domain *domain);
@@ -39,6 +42,8 @@ struct iommu_ops {
39 size_t size); 42 size_t size);
40 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, 43 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
41 unsigned long iova); 44 unsigned long iova);
45 int (*domain_has_cap)(struct iommu_domain *domain,
46 unsigned long cap);
42}; 47};
43 48
44#ifdef CONFIG_IOMMU_API 49#ifdef CONFIG_IOMMU_API
@@ -57,6 +62,8 @@ extern void iommu_unmap_range(struct iommu_domain *domain, unsigned long iova,
57 size_t size); 62 size_t size);
58extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 63extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
59 unsigned long iova); 64 unsigned long iova);
65extern int iommu_domain_has_cap(struct iommu_domain *domain,
66 unsigned long cap);
60 67
61#else /* CONFIG_IOMMU_API */ 68#else /* CONFIG_IOMMU_API */
62 69
@@ -107,6 +114,12 @@ static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
107 return 0; 114 return 0;
108} 115}
109 116
117static inline int domain_has_cap(struct iommu_domain *domain,
118 unsigned long cap)
119{
120 return 0;
121}
122
110#endif /* CONFIG_IOMMU_API */ 123#endif /* CONFIG_IOMMU_API */
111 124
112#endif /* __LINUX_IOMMU_H */ 125#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index 0f434a28fb58..148265e63e8d 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -96,10 +96,10 @@
96 */ 96 */
97struct ip_vs_service_user { 97struct ip_vs_service_user {
98 /* virtual service addresses */ 98 /* virtual service addresses */
99 u_int16_t protocol; 99 __u16 protocol;
100 __be32 addr; /* virtual ip address */ 100 __be32 addr; /* virtual ip address */
101 __be16 port; 101 __be16 port;
102 u_int32_t fwmark; /* firwall mark of service */ 102 __u32 fwmark; /* firwall mark of service */
103 103
104 /* virtual service options */ 104 /* virtual service options */
105 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 105 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
@@ -119,8 +119,8 @@ struct ip_vs_dest_user {
119 int weight; /* destination weight */ 119 int weight; /* destination weight */
120 120
121 /* thresholds for active connections */ 121 /* thresholds for active connections */
122 u_int32_t u_threshold; /* upper threshold */ 122 __u32 u_threshold; /* upper threshold */
123 u_int32_t l_threshold; /* lower threshold */ 123 __u32 l_threshold; /* lower threshold */
124}; 124};
125 125
126 126
@@ -159,10 +159,10 @@ struct ip_vs_getinfo {
159/* The argument to IP_VS_SO_GET_SERVICE */ 159/* The argument to IP_VS_SO_GET_SERVICE */
160struct ip_vs_service_entry { 160struct ip_vs_service_entry {
161 /* which service: user fills in these */ 161 /* which service: user fills in these */
162 u_int16_t protocol; 162 __u16 protocol;
163 __be32 addr; /* virtual address */ 163 __be32 addr; /* virtual address */
164 __be16 port; 164 __be16 port;
165 u_int32_t fwmark; /* firwall mark of service */ 165 __u32 fwmark; /* firwall mark of service */
166 166
167 /* service options */ 167 /* service options */
168 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 168 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
@@ -184,12 +184,12 @@ struct ip_vs_dest_entry {
184 unsigned conn_flags; /* connection flags */ 184 unsigned conn_flags; /* connection flags */
185 int weight; /* destination weight */ 185 int weight; /* destination weight */
186 186
187 u_int32_t u_threshold; /* upper threshold */ 187 __u32 u_threshold; /* upper threshold */
188 u_int32_t l_threshold; /* lower threshold */ 188 __u32 l_threshold; /* lower threshold */
189 189
190 u_int32_t activeconns; /* active connections */ 190 __u32 activeconns; /* active connections */
191 u_int32_t inactconns; /* inactive connections */ 191 __u32 inactconns; /* inactive connections */
192 u_int32_t persistconns; /* persistent connections */ 192 __u32 persistconns; /* persistent connections */
193 193
194 /* statistics */ 194 /* statistics */
195 struct ip_vs_stats_user stats; 195 struct ip_vs_stats_user stats;
@@ -199,10 +199,10 @@ struct ip_vs_dest_entry {
199/* The argument to IP_VS_SO_GET_DESTS */ 199/* The argument to IP_VS_SO_GET_DESTS */
200struct ip_vs_get_dests { 200struct ip_vs_get_dests {
201 /* which service: user fills in these */ 201 /* which service: user fills in these */
202 u_int16_t protocol; 202 __u16 protocol;
203 __be32 addr; /* virtual address */ 203 __be32 addr; /* virtual address */
204 __be16 port; 204 __be16 port;
205 u_int32_t fwmark; /* firwall mark of service */ 205 __u32 fwmark; /* firwall mark of service */
206 206
207 /* number of real servers */ 207 /* number of real servers */
208 unsigned int num_dests; 208 unsigned int num_dests;
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/ipmi.h b/include/linux/ipmi.h
index 7ebdb4fb4e54..65aae34759de 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -198,6 +198,8 @@ struct kernel_ipmi_msg {
198 response. When you send a 198 response. When you send a
199 response message, this will 199 response message, this will
200 be returned. */ 200 be returned. */
201#define IPMI_OEM_RECV_TYPE 5 /* The response for OEM Channels */
202
201/* Note that async events and received commands do not have a completion 203/* Note that async events and received commands do not have a completion
202 code as the first byte of the incoming data, unlike a response. */ 204 code as the first byte of the incoming data, unlike a response. */
203 205
diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h
index b56a158d587a..df97e6e31e87 100644
--- a/include/linux/ipmi_msgdefs.h
+++ b/include/linux/ipmi_msgdefs.h
@@ -58,6 +58,12 @@
58#define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 58#define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35
59#define IPMI_GET_CHANNEL_INFO_CMD 0x42 59#define IPMI_GET_CHANNEL_INFO_CMD 0x42
60 60
61/* Bit for BMC global enables. */
62#define IPMI_BMC_RCV_MSG_INTR 0x01
63#define IPMI_BMC_EVT_MSG_INTR 0x02
64#define IPMI_BMC_EVT_MSG_BUFF 0x04
65#define IPMI_BMC_SYS_LOG 0x08
66
61#define IPMI_NETFN_STORAGE_REQUEST 0x0a 67#define IPMI_NETFN_STORAGE_REQUEST 0x0a
62#define IPMI_NETFN_STORAGE_RESPONSE 0x0b 68#define IPMI_NETFN_STORAGE_RESPONSE 0x0b
63#define IPMI_ADD_SEL_ENTRY_CMD 0x44 69#define IPMI_ADD_SEL_ENTRY_CMD 0x44
@@ -109,5 +115,7 @@
109#define IPMI_CHANNEL_MEDIUM_USB1 10 115#define IPMI_CHANNEL_MEDIUM_USB1 10
110#define IPMI_CHANNEL_MEDIUM_USB2 11 116#define IPMI_CHANNEL_MEDIUM_USB2 11
111#define IPMI_CHANNEL_MEDIUM_SYSINTF 12 117#define IPMI_CHANNEL_MEDIUM_SYSINTF 12
118#define IPMI_CHANNEL_MEDIUM_OEM_MIN 0x60
119#define IPMI_CHANNEL_MEDIUM_OEM_MAX 0x7f
112 120
113#endif /* __LINUX_IPMI_MSGDEFS_H */ 121#endif /* __LINUX_IPMI_MSGDEFS_H */
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 62b73668b602..f7c9c75a2775 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -230,6 +230,6 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg)
230 automatically be dstroyed when the interface is destroyed. */ 230 automatically be dstroyed when the interface is destroyed. */
231int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name, 231int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
232 read_proc_t *read_proc, 232 read_proc_t *read_proc,
233 void *data, struct module *owner); 233 void *data);
234 234
235#endif /* __LINUX_IPMI_SMI_H */ 235#endif /* __LINUX_IPMI_SMI_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index f899b502f186..b7cbeed972e4 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -17,9 +17,12 @@
17#include <linux/cache.h> 17#include <linux/cache.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/cpumask.h> 19#include <linux/cpumask.h>
20#include <linux/gfp.h>
20#include <linux/irqreturn.h> 21#include <linux/irqreturn.h>
21#include <linux/irqnr.h> 22#include <linux/irqnr.h>
22#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/topology.h>
25#include <linux/wait.h>
23 26
24#include <asm/irq.h> 27#include <asm/irq.h>
25#include <asm/ptrace.h> 28#include <asm/ptrace.h>
@@ -65,6 +68,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
65#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ 68#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */
66#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ 69#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */
67#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/ 70#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/
71#define IRQ_SUSPENDED 0x04000000 /* IRQ has gone through suspend sequence */
68 72
69#ifdef CONFIG_IRQ_PER_CPU 73#ifdef CONFIG_IRQ_PER_CPU
70# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 74# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
@@ -155,17 +159,17 @@ struct irq_2_iommu;
155 * @affinity: IRQ affinity on SMP 159 * @affinity: IRQ affinity on SMP
156 * @cpu: cpu index useful for balancing 160 * @cpu: cpu index useful for balancing
157 * @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
158 * @dir: /proc/irq/ procfs entry 164 * @dir: /proc/irq/ procfs entry
159 * @name: flow handler name for /proc/interrupts output 165 * @name: flow handler name for /proc/interrupts output
160 */ 166 */
161struct irq_desc { 167struct irq_desc {
162 unsigned int irq; 168 unsigned int irq;
163#ifdef CONFIG_SPARSE_IRQ
164 struct timer_rand_state *timer_rand_state; 169 struct timer_rand_state *timer_rand_state;
165 unsigned int *kstat_irqs; 170 unsigned int *kstat_irqs;
166# ifdef CONFIG_INTR_REMAP 171#ifdef CONFIG_INTR_REMAP
167 struct irq_2_iommu *irq_2_iommu; 172 struct irq_2_iommu *irq_2_iommu;
168# endif
169#endif 173#endif
170 irq_flow_handler_t handle_irq; 174 irq_flow_handler_t handle_irq;
171 struct irq_chip *chip; 175 struct irq_chip *chip;
@@ -182,12 +186,14 @@ struct irq_desc {
182 unsigned int irqs_unhandled; 186 unsigned int irqs_unhandled;
183 spinlock_t lock; 187 spinlock_t lock;
184#ifdef CONFIG_SMP 188#ifdef CONFIG_SMP
185 cpumask_t affinity; 189 cpumask_var_t affinity;
186 unsigned int cpu; 190 unsigned int cpu;
187#endif
188#ifdef CONFIG_GENERIC_PENDING_IRQ 191#ifdef CONFIG_GENERIC_PENDING_IRQ
189 cpumask_t pending_mask; 192 cpumask_var_t pending_mask;
193#endif
190#endif 194#endif
195 atomic_t threads_active;
196 wait_queue_head_t wait_for_threads;
191#ifdef CONFIG_PROC_FS 197#ifdef CONFIG_PROC_FS
192 struct proc_dir_entry *dir; 198 struct proc_dir_entry *dir;
193#endif 199#endif
@@ -202,12 +208,6 @@ extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc
202extern struct irq_desc irq_desc[NR_IRQS]; 208extern struct irq_desc irq_desc[NR_IRQS];
203#else /* CONFIG_SPARSE_IRQ */ 209#else /* CONFIG_SPARSE_IRQ */
204extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); 210extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);
205
206#define kstat_irqs_this_cpu(DESC) \
207 ((DESC)->kstat_irqs[smp_processor_id()])
208#define kstat_incr_irqs_this_cpu(irqno, DESC) \
209 ((DESC)->kstat_irqs[smp_processor_id()]++)
210
211#endif /* CONFIG_SPARSE_IRQ */ 211#endif /* CONFIG_SPARSE_IRQ */
212 212
213extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); 213extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
@@ -226,7 +226,6 @@ irq_remap_to_desc(unsigned int irq, struct irq_desc *desc)
226 * Migration helpers for obsolete names, they will go away: 226 * Migration helpers for obsolete names, they will go away:
227 */ 227 */
228#define hw_interrupt_type irq_chip 228#define hw_interrupt_type irq_chip
229typedef struct irq_chip hw_irq_controller;
230#define no_irq_type no_irq_chip 229#define no_irq_type no_irq_chip
231typedef struct irq_desc irq_desc_t; 230typedef struct irq_desc irq_desc_t;
232 231
@@ -236,6 +235,7 @@ typedef struct irq_desc irq_desc_t;
236#include <asm/hw_irq.h> 235#include <asm/hw_irq.h>
237 236
238extern int setup_irq(unsigned int irq, struct irqaction *new); 237extern int setup_irq(unsigned int irq, struct irqaction *new);
238extern void remove_irq(unsigned int irq, struct irqaction *act);
239 239
240#ifdef CONFIG_GENERIC_HARDIRQS 240#ifdef CONFIG_GENERIC_HARDIRQS
241 241
@@ -280,7 +280,7 @@ static inline int irq_balancing_disabled(unsigned int irq)
280} 280}
281 281
282/* Handle irq action chains: */ 282/* Handle irq action chains: */
283extern int handle_IRQ_event(unsigned int irq, struct irqaction *action); 283extern irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action);
284 284
285/* 285/*
286 * Built-in IRQ handlers for various IRQ types, 286 * Built-in IRQ handlers for various IRQ types,
@@ -325,7 +325,7 @@ static inline void generic_handle_irq(unsigned int irq)
325 325
326/* Handling of unhandled and spurious interrupts: */ 326/* Handling of unhandled and spurious interrupts: */
327extern void note_interrupt(unsigned int irq, struct irq_desc *desc, 327extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
328 int action_ret); 328 irqreturn_t action_ret);
329 329
330/* Resending of interrupts :*/ 330/* Resending of interrupts :*/
331void check_irq_resend(struct irq_desc *desc, unsigned int irq); 331void check_irq_resend(struct irq_desc *desc, unsigned int irq);
@@ -422,4 +422,98 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
422 422
423#endif /* !CONFIG_S390 */ 423#endif /* !CONFIG_S390 */
424 424
425#ifdef CONFIG_SMP
426/**
427 * init_alloc_desc_masks - allocate cpumasks for irq_desc
428 * @desc: pointer to irq_desc struct
429 * @cpu: cpu which will be handling the cpumasks
430 * @boot: true if need bootmem
431 *
432 * Allocates affinity and pending_mask cpumask if required.
433 * Returns true if successful (or not required).
434 * Side effect: affinity has all bits set, pending_mask has all bits clear.
435 */
436static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu,
437 bool boot)
438{
439 int node;
440
441 if (boot) {
442 alloc_bootmem_cpumask_var(&desc->affinity);
443 cpumask_setall(desc->affinity);
444
445#ifdef CONFIG_GENERIC_PENDING_IRQ
446 alloc_bootmem_cpumask_var(&desc->pending_mask);
447 cpumask_clear(desc->pending_mask);
448#endif
449 return true;
450 }
451
452 node = cpu_to_node(cpu);
453
454 if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node))
455 return false;
456 cpumask_setall(desc->affinity);
457
458#ifdef CONFIG_GENERIC_PENDING_IRQ
459 if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) {
460 free_cpumask_var(desc->affinity);
461 return false;
462 }
463 cpumask_clear(desc->pending_mask);
464#endif
465 return true;
466}
467
468/**
469 * init_copy_desc_masks - copy cpumasks for irq_desc
470 * @old_desc: pointer to old irq_desc struct
471 * @new_desc: pointer to new irq_desc struct
472 *
473 * Insures affinity and pending_masks are copied to new irq_desc.
474 * If !CONFIG_CPUMASKS_OFFSTACK the cpumasks are embedded in the
475 * irq_desc struct so the copy is redundant.
476 */
477
478static inline void init_copy_desc_masks(struct irq_desc *old_desc,
479 struct irq_desc *new_desc)
480{
481#ifdef CONFIG_CPUMASKS_OFFSTACK
482 cpumask_copy(new_desc->affinity, old_desc->affinity);
483
484#ifdef CONFIG_GENERIC_PENDING_IRQ
485 cpumask_copy(new_desc->pending_mask, old_desc->pending_mask);
486#endif
487#endif
488}
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
500#else /* !CONFIG_SMP */
501
502static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu,
503 bool boot)
504{
505 return true;
506}
507
508static inline void init_copy_desc_masks(struct irq_desc *old_desc,
509 struct irq_desc *new_desc)
510{
511}
512
513static inline void free_desc_masks(struct irq_desc *old_desc,
514 struct irq_desc *new_desc)
515{
516}
517#endif /* CONFIG_SMP */
518
425#endif /* _LINUX_IRQ_H */ 519#endif /* _LINUX_IRQ_H */
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index 74bde13224c9..b02a3f1d46a0 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -24,8 +24,8 @@
24# define trace_softirqs_enabled(p) ((p)->softirqs_enabled) 24# define trace_softirqs_enabled(p) ((p)->softirqs_enabled)
25# define trace_hardirq_enter() do { current->hardirq_context++; } while (0) 25# define trace_hardirq_enter() do { current->hardirq_context++; } while (0)
26# define trace_hardirq_exit() do { current->hardirq_context--; } while (0) 26# define trace_hardirq_exit() do { current->hardirq_context--; } while (0)
27# define trace_softirq_enter() do { current->softirq_context++; } while (0) 27# define lockdep_softirq_enter() do { current->softirq_context++; } while (0)
28# define trace_softirq_exit() do { current->softirq_context--; } while (0) 28# define lockdep_softirq_exit() do { current->softirq_context--; } while (0)
29# define INIT_TRACE_IRQFLAGS .softirqs_enabled = 1, 29# define INIT_TRACE_IRQFLAGS .softirqs_enabled = 1,
30#else 30#else
31# define trace_hardirqs_on() do { } while (0) 31# define trace_hardirqs_on() do { } while (0)
@@ -38,8 +38,8 @@
38# define trace_softirqs_enabled(p) 0 38# define trace_softirqs_enabled(p) 0
39# define trace_hardirq_enter() do { } while (0) 39# define trace_hardirq_enter() do { } while (0)
40# define trace_hardirq_exit() do { } while (0) 40# define trace_hardirq_exit() do { } while (0)
41# define trace_softirq_enter() do { } while (0) 41# define lockdep_softirq_enter() do { } while (0)
42# define trace_softirq_exit() do { } while (0) 42# define lockdep_softirq_exit() do { } while (0)
43# define INIT_TRACE_IRQFLAGS 43# define INIT_TRACE_IRQFLAGS
44#endif 44#endif
45 45
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 86af92e9e84c..ec87b212ff7d 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -20,6 +20,7 @@
20 20
21# define for_each_irq_desc_reverse(irq, desc) \ 21# define for_each_irq_desc_reverse(irq, desc) \
22 for (irq = nr_irqs - 1; irq >= 0; irq--) 22 for (irq = nr_irqs - 1; irq >= 0; irq--)
23
23#else /* CONFIG_GENERIC_HARDIRQS */ 24#else /* CONFIG_GENERIC_HARDIRQS */
24 25
25extern int nr_irqs; 26extern int nr_irqs;
@@ -28,13 +29,17 @@ extern struct irq_desc *irq_to_desc(unsigned int irq);
28# define for_each_irq_desc(irq, desc) \ 29# define for_each_irq_desc(irq, desc) \
29 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ 30 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
30 irq++, desc = irq_to_desc(irq)) \ 31 irq++, desc = irq_to_desc(irq)) \
31 if (desc) 32 if (!desc) \
33 ; \
34 else
32 35
33 36
34# define for_each_irq_desc_reverse(irq, desc) \ 37# define for_each_irq_desc_reverse(irq, desc) \
35 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ 38 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
36 irq--, desc = irq_to_desc(irq)) \ 39 irq--, desc = irq_to_desc(irq)) \
37 if (desc) 40 if (!desc) \
41 ; \
42 else
38 43
39#endif /* CONFIG_GENERIC_HARDIRQS */ 44#endif /* CONFIG_GENERIC_HARDIRQS */
40 45
diff --git a/include/linux/irqreturn.h b/include/linux/irqreturn.h
index 881883c2009d..819acaaac3f5 100644
--- a/include/linux/irqreturn.h
+++ b/include/linux/irqreturn.h
@@ -1,25 +1,19 @@
1/* irqreturn.h */
2#ifndef _LINUX_IRQRETURN_H 1#ifndef _LINUX_IRQRETURN_H
3#define _LINUX_IRQRETURN_H 2#define _LINUX_IRQRETURN_H
4 3
5/* 4/**
6 * For 2.4.x compatibility, 2.4.x can use 5 * enum irqreturn
7 * 6 * @IRQ_NONE interrupt was not from this device
8 * typedef void irqreturn_t; 7 * @IRQ_HANDLED interrupt was handled by this device
9 * #define IRQ_NONE 8 * @IRQ_WAKE_THREAD handler requests to wake the handler thread
10 * #define IRQ_HANDLED
11 * #define IRQ_RETVAL(x)
12 *
13 * To mix old-style and new-style irq handler returns.
14 *
15 * IRQ_NONE means we didn't handle it.
16 * IRQ_HANDLED means that we did have a valid interrupt and handled it.
17 * IRQ_RETVAL(x) selects on the two depending on x being non-zero (for handled)
18 */ 9 */
19typedef int irqreturn_t; 10enum irqreturn {
11 IRQ_NONE,
12 IRQ_HANDLED,
13 IRQ_WAKE_THREAD,
14};
20 15
21#define IRQ_NONE (0) 16typedef enum irqreturn irqreturn_t;
22#define IRQ_HANDLED (1) 17#define IRQ_RETVAL(x) ((x) != IRQ_NONE)
23#define IRQ_RETVAL(x) ((x) != 0)
24 18
25#endif 19#endif
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h
index f2720280b9ec..062d20f74322 100644
--- a/include/linux/ivtv.h
+++ b/include/linux/ivtv.h
@@ -60,10 +60,10 @@ struct ivtv_dma_frame {
60 60
61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame) 61#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame)
62 62
63/* These are the VBI types as they appear in the embedded VBI private packets. */ 63/* Deprecated defines: applications should use the defines from videodev2.h */
64#define IVTV_SLICED_TYPE_TELETEXT_B (1) 64#define IVTV_SLICED_TYPE_TELETEXT_B V4L2_MPEG_VBI_IVTV_TELETEXT_B
65#define IVTV_SLICED_TYPE_CAPTION_525 (4) 65#define IVTV_SLICED_TYPE_CAPTION_525 V4L2_MPEG_VBI_IVTV_CAPTION_525
66#define IVTV_SLICED_TYPE_WSS_625 (5) 66#define IVTV_SLICED_TYPE_WSS_625 V4L2_MPEG_VBI_IVTV_WSS_625
67#define IVTV_SLICED_TYPE_VPS (7) 67#define IVTV_SLICED_TYPE_VPS V4L2_MPEG_VBI_IVTV_VPS
68 68
69#endif /* _LINUX_IVTV_H */ 69#endif /* _LINUX_IVTV_H */
diff --git a/include/linux/ivtvfb.h b/include/linux/ivtvfb.h
index e20af47b59ad..9d88b29ddf55 100644
--- a/include/linux/ivtvfb.h
+++ b/include/linux/ivtvfb.h
@@ -33,6 +33,6 @@ struct ivtvfb_dma_frame {
33}; 33};
34 34
35#define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame) 35#define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame)
36#define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t) 36#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
37 37
38#endif 38#endif
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 64246dce5663..c2049a04fa0b 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -35,7 +35,7 @@
35#define journal_oom_retry 1 35#define journal_oom_retry 1
36 36
37/* 37/*
38 * Define JBD_PARANIOD_IOFAIL to cause a kernel BUG() if ext3 finds 38 * Define JBD_PARANOID_IOFAIL to cause a kernel BUG() if ext3 finds
39 * certain classes of error which can occur due to failed IOs. Under 39 * certain classes of error which can occur due to failed IOs. Under
40 * normal use we want ext3 to continue after such errors, because 40 * normal use we want ext3 to continue after such errors, because
41 * hardware _can_ fail, but for debugging purposes when running tests on 41 * hardware _can_ fail, but for debugging purposes when running tests on
@@ -552,6 +552,11 @@ struct transaction_s
552 */ 552 */
553 int t_handle_count; 553 int t_handle_count;
554 554
555 /*
556 * This transaction is being forced and some process is
557 * waiting for it to finish.
558 */
559 int t_synchronous_commit:1;
555}; 560};
556 561
557/** 562/**
@@ -973,7 +978,8 @@ extern void journal_destroy_revoke(journal_t *);
973extern int journal_revoke (handle_t *, 978extern int journal_revoke (handle_t *,
974 unsigned long, struct buffer_head *); 979 unsigned long, struct buffer_head *);
975extern int journal_cancel_revoke(handle_t *, struct journal_head *); 980extern int journal_cancel_revoke(handle_t *, struct journal_head *);
976extern void journal_write_revoke_records(journal_t *, transaction_t *); 981extern void journal_write_revoke_records(journal_t *,
982 transaction_t *, int);
977 983
978/* Recovery revoke support */ 984/* Recovery revoke support */
979extern int journal_set_revoke(journal_t *, unsigned long, tid_t); 985extern int journal_set_revoke(journal_t *, unsigned long, tid_t);
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 4d248b3f1323..cc02393bfce8 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -649,6 +649,12 @@ struct transaction_s
649 int t_handle_count; 649 int t_handle_count;
650 650
651 /* 651 /*
652 * This transaction is being forced and some process is
653 * waiting for it to finish.
654 */
655 int t_synchronous_commit:1;
656
657 /*
652 * For use by the filesystem to store fs-specific data 658 * For use by the filesystem to store fs-specific data
653 * structures associated with the transaction 659 * structures associated with the transaction
654 */ 660 */
@@ -1187,7 +1193,8 @@ extern int jbd2_journal_init_revoke_caches(void);
1187extern void jbd2_journal_destroy_revoke(journal_t *); 1193extern void jbd2_journal_destroy_revoke(journal_t *);
1188extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *); 1194extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *);
1189extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *); 1195extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *);
1190extern void jbd2_journal_write_revoke_records(journal_t *, transaction_t *); 1196extern void jbd2_journal_write_revoke_records(journal_t *,
1197 transaction_t *, int);
1191 1198
1192/* Recovery revoke support */ 1199/* Recovery revoke support */
1193extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t); 1200extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index da720bc3eb15..2b32d638147d 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -12,6 +12,7 @@
12#ifndef __LINUX_JFFS2_H__ 12#ifndef __LINUX_JFFS2_H__
13#define __LINUX_JFFS2_H__ 13#define __LINUX_JFFS2_H__
14 14
15#include <linux/types.h>
15#include <linux/magic.h> 16#include <linux/magic.h>
16 17
17/* You must include something which defines the C99 uintXX_t types. 18/* You must include something which defines the C99 uintXX_t types.
@@ -91,15 +92,15 @@
91 byteswapping */ 92 byteswapping */
92 93
93typedef struct { 94typedef struct {
94 uint32_t v32; 95 __u32 v32;
95} __attribute__((packed)) jint32_t; 96} __attribute__((packed)) jint32_t;
96 97
97typedef struct { 98typedef struct {
98 uint32_t m; 99 __u32 m;
99} __attribute__((packed)) jmode_t; 100} __attribute__((packed)) jmode_t;
100 101
101typedef struct { 102typedef struct {
102 uint16_t v16; 103 __u16 v16;
103} __attribute__((packed)) jint16_t; 104} __attribute__((packed)) jint16_t;
104 105
105struct jffs2_unknown_node 106struct jffs2_unknown_node
@@ -121,12 +122,12 @@ struct jffs2_raw_dirent
121 jint32_t version; 122 jint32_t version;
122 jint32_t ino; /* == zero for unlink */ 123 jint32_t ino; /* == zero for unlink */
123 jint32_t mctime; 124 jint32_t mctime;
124 uint8_t nsize; 125 __u8 nsize;
125 uint8_t type; 126 __u8 type;
126 uint8_t unused[2]; 127 __u8 unused[2];
127 jint32_t node_crc; 128 jint32_t node_crc;
128 jint32_t name_crc; 129 jint32_t name_crc;
129 uint8_t name[0]; 130 __u8 name[0];
130}; 131};
131 132
132/* The JFFS2 raw inode structure: Used for storage on physical media. */ 133/* The JFFS2 raw inode structure: Used for storage on physical media. */
@@ -153,12 +154,12 @@ struct jffs2_raw_inode
153 jint32_t offset; /* Where to begin to write. */ 154 jint32_t offset; /* Where to begin to write. */
154 jint32_t csize; /* (Compressed) data size */ 155 jint32_t csize; /* (Compressed) data size */
155 jint32_t dsize; /* Size of the node's data. (after decompression) */ 156 jint32_t dsize; /* Size of the node's data. (after decompression) */
156 uint8_t compr; /* Compression algorithm used */ 157 __u8 compr; /* Compression algorithm used */
157 uint8_t usercompr; /* Compression algorithm requested by the user */ 158 __u8 usercompr; /* Compression algorithm requested by the user */
158 jint16_t flags; /* See JFFS2_INO_FLAG_* */ 159 jint16_t flags; /* See JFFS2_INO_FLAG_* */
159 jint32_t data_crc; /* CRC for the (compressed) data. */ 160 jint32_t data_crc; /* CRC for the (compressed) data. */
160 jint32_t node_crc; /* CRC for the raw inode (excluding data) */ 161 jint32_t node_crc; /* CRC for the raw inode (excluding data) */
161 uint8_t data[0]; 162 __u8 data[0];
162}; 163};
163 164
164struct jffs2_raw_xattr { 165struct jffs2_raw_xattr {
@@ -168,12 +169,12 @@ struct jffs2_raw_xattr {
168 jint32_t hdr_crc; 169 jint32_t hdr_crc;
169 jint32_t xid; /* XATTR identifier number */ 170 jint32_t xid; /* XATTR identifier number */
170 jint32_t version; 171 jint32_t version;
171 uint8_t xprefix; 172 __u8 xprefix;
172 uint8_t name_len; 173 __u8 name_len;
173 jint16_t value_len; 174 jint16_t value_len;
174 jint32_t data_crc; 175 jint32_t data_crc;
175 jint32_t node_crc; 176 jint32_t node_crc;
176 uint8_t data[0]; 177 __u8 data[0];
177} __attribute__((packed)); 178} __attribute__((packed));
178 179
179struct jffs2_raw_xref 180struct jffs2_raw_xref
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index f3fe34391d8e..792274269f2b 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -13,10 +13,17 @@
13#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ 13#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
14 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) 14 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
15 15
16struct module;
17
16#ifdef CONFIG_KALLSYMS 18#ifdef CONFIG_KALLSYMS
17/* Lookup the address for a symbol. Returns 0 if not found. */ 19/* Lookup the address for a symbol. Returns 0 if not found. */
18unsigned long kallsyms_lookup_name(const char *name); 20unsigned long kallsyms_lookup_name(const char *name);
19 21
22/* Call a function on each kallsyms symbol in the core kernel */
23int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
24 unsigned long),
25 void *data);
26
20extern int kallsyms_lookup_size_offset(unsigned long addr, 27extern int kallsyms_lookup_size_offset(unsigned long addr,
21 unsigned long *symbolsize, 28 unsigned long *symbolsize,
22 unsigned long *offset); 29 unsigned long *offset);
@@ -43,6 +50,14 @@ static inline unsigned long kallsyms_lookup_name(const char *name)
43 return 0; 50 return 0;
44} 51}
45 52
53static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *,
54 struct module *,
55 unsigned long),
56 void *data)
57{
58 return 0;
59}
60
46static inline int kallsyms_lookup_size_offset(unsigned long addr, 61static inline int kallsyms_lookup_size_offset(unsigned long addr,
47 unsigned long *symbolsize, 62 unsigned long *symbolsize,
48 unsigned long *offset) 63 unsigned long *offset)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 7fa371898e3e..883cd44ff765 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -16,7 +16,7 @@
16#include <linux/log2.h> 16#include <linux/log2.h>
17#include <linux/typecheck.h> 17#include <linux/typecheck.h>
18#include <linux/ratelimit.h> 18#include <linux/ratelimit.h>
19#include <linux/dynamic_printk.h> 19#include <linux/dynamic_debug.h>
20#include <asm/byteorder.h> 20#include <asm/byteorder.h>
21#include <asm/bug.h> 21#include <asm/bug.h>
22 22
@@ -242,6 +242,20 @@ extern struct ratelimit_state printk_ratelimit_state;
242extern int printk_ratelimit(void); 242extern int printk_ratelimit(void);
243extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, 243extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
244 unsigned int interval_msec); 244 unsigned int interval_msec);
245
246/*
247 * Print a one-time message (analogous to WARN_ONCE() et al):
248 */
249#define printk_once(x...) ({ \
250 static int __print_once = 1; \
251 \
252 if (__print_once) { \
253 __print_once = 0; \
254 printk(x); \
255 } \
256})
257
258void log_buf_kexec_setup(void);
245#else 259#else
246static inline int vprintk(const char *s, va_list args) 260static inline int vprintk(const char *s, va_list args)
247 __attribute__ ((format (printf, 1, 0))); 261 __attribute__ ((format (printf, 1, 0)));
@@ -253,6 +267,13 @@ static inline int printk_ratelimit(void) { return 0; }
253static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ 267static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
254 unsigned int interval_msec) \ 268 unsigned int interval_msec) \
255 { return false; } 269 { return false; }
270
271/* No effect, but we still get type checking even in the !PRINTK case: */
272#define printk_once(x...) printk(x)
273
274static inline void log_buf_kexec_setup(void)
275{
276}
256#endif 277#endif
257 278
258extern int printk_needs_cpu(int cpu); 279extern int printk_needs_cpu(int cpu);
@@ -353,14 +374,26 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
353 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) 374 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
354#define pr_info(fmt, ...) \ 375#define pr_info(fmt, ...) \
355 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 376 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
377#define pr_cont(fmt, ...) \
378 printk(KERN_CONT fmt, ##__VA_ARGS__)
379
380/* pr_devel() should produce zero code unless DEBUG is defined */
381#ifdef DEBUG
382#define pr_devel(fmt, ...) \
383 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
384#else
385#define pr_devel(fmt, ...) \
386 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
387#endif
356 388
357/* If you are writing a driver, please use dev_dbg instead */ 389/* If you are writing a driver, please use dev_dbg instead */
358#if defined(DEBUG) 390#if defined(DEBUG)
359#define pr_debug(fmt, ...) \ 391#define pr_debug(fmt, ...) \
360 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 392 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
361#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 393#elif defined(CONFIG_DYNAMIC_DEBUG)
394/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
362#define pr_debug(fmt, ...) do { \ 395#define pr_debug(fmt, ...) do { \
363 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ 396 dynamic_pr_debug(fmt, ##__VA_ARGS__); \
364 } while (0) 397 } while (0)
365#else 398#else
366#define pr_debug(fmt, ...) \ 399#define pr_debug(fmt, ...) \
@@ -368,6 +401,139 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
368#endif 401#endif
369 402
370/* 403/*
404 * General tracing related utility functions - trace_printk(),
405 * tracing_on/tracing_off and tracing_start()/tracing_stop
406 *
407 * Use tracing_on/tracing_off when you want to quickly turn on or off
408 * tracing. It simply enables or disables the recording of the trace events.
409 * This also corresponds to the user space debugfs/tracing/tracing_on
410 * file, which gives a means for the kernel and userspace to interact.
411 * Place a tracing_off() in the kernel where you want tracing to end.
412 * From user space, examine the trace, and then echo 1 > tracing_on
413 * to continue tracing.
414 *
415 * tracing_stop/tracing_start has slightly more overhead. It is used
416 * by things like suspend to ram where disabling the recording of the
417 * trace is not enough, but tracing must actually stop because things
418 * like calling smp_processor_id() may crash the system.
419 *
420 * Most likely, you want to use tracing_on/tracing_off.
421 */
422#ifdef CONFIG_RING_BUFFER
423void tracing_on(void);
424void tracing_off(void);
425/* trace_off_permanent stops recording with no way to bring it back */
426void tracing_off_permanent(void);
427int tracing_is_on(void);
428#else
429static inline void tracing_on(void) { }
430static inline void tracing_off(void) { }
431static inline void tracing_off_permanent(void) { }
432static inline int tracing_is_on(void) { return 0; }
433#endif
434#ifdef CONFIG_TRACING
435extern void tracing_start(void);
436extern void tracing_stop(void);
437extern void ftrace_off_permanent(void);
438
439extern void
440ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
441
442static inline void __attribute__ ((format (printf, 1, 2)))
443____trace_printk_check_format(const char *fmt, ...)
444{
445}
446#define __trace_printk_check_format(fmt, args...) \
447do { \
448 if (0) \
449 ____trace_printk_check_format(fmt, ##args); \
450} while (0)
451
452/**
453 * trace_printk - printf formatting in the ftrace buffer
454 * @fmt: the printf format for printing
455 *
456 * Note: __trace_printk is an internal function for trace_printk and
457 * the @ip is passed in via the trace_printk macro.
458 *
459 * This function allows a kernel developer to debug fast path sections
460 * that printk is not appropriate for. By scattering in various
461 * printk like tracing in the code, a developer can quickly see
462 * where problems are occurring.
463 *
464 * This is intended as a debugging tool for the developer only.
465 * Please refrain from leaving trace_printks scattered around in
466 * your code.
467 */
468
469#define trace_printk(fmt, args...) \
470do { \
471 __trace_printk_check_format(fmt, ##args); \
472 if (__builtin_constant_p(fmt)) { \
473 static const char *trace_printk_fmt \
474 __attribute__((section("__trace_printk_fmt"))) = \
475 __builtin_constant_p(fmt) ? fmt : NULL; \
476 \
477 __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \
478 } else \
479 __trace_printk(_THIS_IP_, fmt, ##args); \
480} while (0)
481
482extern int
483__trace_bprintk(unsigned long ip, const char *fmt, ...)
484 __attribute__ ((format (printf, 2, 3)));
485
486extern int
487__trace_printk(unsigned long ip, const char *fmt, ...)
488 __attribute__ ((format (printf, 2, 3)));
489
490/*
491 * The double __builtin_constant_p is because gcc will give us an error
492 * if we try to allocate the static variable to fmt if it is not a
493 * constant. Even with the outer if statement.
494 */
495#define ftrace_vprintk(fmt, vargs) \
496do { \
497 if (__builtin_constant_p(fmt)) { \
498 static const char *trace_printk_fmt \
499 __attribute__((section("__trace_printk_fmt"))) = \
500 __builtin_constant_p(fmt) ? fmt : NULL; \
501 \
502 __ftrace_vbprintk(_THIS_IP_, trace_printk_fmt, vargs); \
503 } else \
504 __ftrace_vprintk(_THIS_IP_, fmt, vargs); \
505} while (0)
506
507extern int
508__ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap);
509
510extern int
511__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
512
513extern void ftrace_dump(void);
514#else
515static inline void
516ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
517static inline int
518trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
519
520static inline void tracing_start(void) { }
521static inline void tracing_stop(void) { }
522static inline void ftrace_off_permanent(void) { }
523static inline int
524trace_printk(const char *fmt, ...)
525{
526 return 0;
527}
528static inline int
529ftrace_vprintk(const char *fmt, va_list ap)
530{
531 return 0;
532}
533static inline void ftrace_dump(void) { }
534#endif /* CONFIG_TRACING */
535
536/*
371 * Display an IP address in readable format. 537 * Display an IP address in readable format.
372 */ 538 */
373 539
@@ -378,18 +544,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
378 ((unsigned char *)&addr)[3] 544 ((unsigned char *)&addr)[3]
379#define NIPQUAD_FMT "%u.%u.%u.%u" 545#define NIPQUAD_FMT "%u.%u.%u.%u"
380 546
381#if defined(__LITTLE_ENDIAN)
382#define HIPQUAD(addr) \
383 ((unsigned char *)&addr)[3], \
384 ((unsigned char *)&addr)[2], \
385 ((unsigned char *)&addr)[1], \
386 ((unsigned char *)&addr)[0]
387#elif defined(__BIG_ENDIAN)
388#define HIPQUAD NIPQUAD
389#else
390#error "Please fix asm/byteorder.h"
391#endif /* __LITTLE_ENDIAN */
392
393/* 547/*
394 * min()/max()/clamp() macros that also do 548 * min()/max()/clamp() macros that also do
395 * strict type-checking.. See the 549 * strict type-checking.. See the
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 570d20413119..0c8b89f28a95 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -28,7 +28,7 @@ struct cpu_usage_stat {
28 28
29struct kernel_stat { 29struct kernel_stat {
30 struct cpu_usage_stat cpustat; 30 struct cpu_usage_stat cpustat;
31#ifndef CONFIG_SPARSE_IRQ 31#ifndef CONFIG_GENERIC_HARDIRQS
32 unsigned int irqs[NR_IRQS]; 32 unsigned int irqs[NR_IRQS];
33#endif 33#endif
34}; 34};
@@ -41,7 +41,7 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
41 41
42extern unsigned long long nr_context_switches(void); 42extern unsigned long long nr_context_switches(void);
43 43
44#ifndef CONFIG_SPARSE_IRQ 44#ifndef CONFIG_GENERIC_HARDIRQS
45#define kstat_irqs_this_cpu(irq) \ 45#define kstat_irqs_this_cpu(irq) \
46 (kstat_this_cpu.irqs[irq]) 46 (kstat_this_cpu.irqs[irq])
47 47
@@ -52,16 +52,19 @@ static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
52{ 52{
53 kstat_this_cpu.irqs[irq]++; 53 kstat_this_cpu.irqs[irq]++;
54} 54}
55#endif
56
57 55
58#ifndef CONFIG_SPARSE_IRQ
59static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) 56static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
60{ 57{
61 return kstat_cpu(cpu).irqs[irq]; 58 return kstat_cpu(cpu).irqs[irq];
62} 59}
63#else 60#else
61#include <linux/irq.h>
64extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); 62extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
63#define kstat_irqs_this_cpu(DESC) \
64 ((DESC)->kstat_irqs[smp_processor_id()])
65#define kstat_incr_irqs_this_cpu(irqno, DESC) \
66 ((DESC)->kstat_irqs[smp_processor_id()]++)
67
65#endif 68#endif
66 69
67/* 70/*
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 92213a9194e1..384ca8bbf1ac 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -29,10 +29,15 @@
29#ifdef CONFIG_MODULES 29#ifdef CONFIG_MODULES
30/* modprobe exit status on success, -ve on error. Return value 30/* modprobe exit status on success, -ve on error. Return value
31 * usually useless though. */ 31 * usually useless though. */
32extern int request_module(const char * name, ...) __attribute__ ((format (printf, 1, 2))); 32extern int __request_module(bool wait, const char *name, ...) \
33#define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) 33 __attribute__((format(printf, 2, 3)));
34#define request_module(mod...) __request_module(true, mod)
35#define request_module_nowait(mod...) __request_module(false, mod)
36#define try_then_request_module(x, mod...) \
37 ((x) ?: (__request_module(true, mod), (x)))
34#else 38#else
35static 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; }
36#define try_then_request_module(x, mod...) (x) 41#define try_then_request_module(x, mod...) (x)
37#endif 42#endif
38 43
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 5437ac0276e2..58ae8e00fcdd 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -68,10 +68,13 @@ struct kobject {
68 unsigned int state_in_sysfs:1; 68 unsigned int state_in_sysfs:1;
69 unsigned int state_add_uevent_sent:1; 69 unsigned int state_add_uevent_sent:1;
70 unsigned int state_remove_uevent_sent:1; 70 unsigned int state_remove_uevent_sent:1;
71 unsigned int uevent_suppress:1;
71}; 72};
72 73
73extern int kobject_set_name(struct kobject *kobj, const char *name, ...) 74extern int kobject_set_name(struct kobject *kobj, const char *name, ...)
74 __attribute__((format(printf, 2, 3))); 75 __attribute__((format(printf, 2, 3)));
76extern int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
77 va_list vargs);
75 78
76static inline const char *kobject_name(const struct kobject *kobj) 79static inline const char *kobject_name(const struct kobject *kobj)
77{ 80{
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 32851eef48f0..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
@@ -182,6 +196,14 @@ struct kprobe_blackpoint {
182DECLARE_PER_CPU(struct kprobe *, current_kprobe); 196DECLARE_PER_CPU(struct kprobe *, current_kprobe);
183DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 197DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
184 198
199/*
200 * For #ifdef avoidance:
201 */
202static inline int kprobes_built_in(void)
203{
204 return 1;
205}
206
185#ifdef CONFIG_KRETPROBES 207#ifdef CONFIG_KRETPROBES
186extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, 208extern void arch_prepare_kretprobe(struct kretprobe_instance *ri,
187 struct pt_regs *regs); 209 struct pt_regs *regs);
@@ -271,8 +293,19 @@ void unregister_kretprobes(struct kretprobe **rps, int num);
271void kprobe_flush_task(struct task_struct *tk); 293void kprobe_flush_task(struct task_struct *tk);
272void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); 294void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
273 295
274#else /* CONFIG_KPROBES */ 296int disable_kprobe(struct kprobe *kp);
297int enable_kprobe(struct kprobe *kp);
275 298
299#else /* !CONFIG_KPROBES: */
300
301static inline int kprobes_built_in(void)
302{
303 return 0;
304}
305static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
306{
307 return 0;
308}
276static inline struct kprobe *get_kprobe(void *addr) 309static inline struct kprobe *get_kprobe(void *addr)
277{ 310{
278 return NULL; 311 return NULL;
@@ -329,5 +362,30 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num)
329static inline void kprobe_flush_task(struct task_struct *tk) 362static inline void kprobe_flush_task(struct task_struct *tk)
330{ 363{
331} 364}
332#endif /* CONFIG_KPROBES */ 365static inline int disable_kprobe(struct kprobe *kp)
333#endif /* _LINUX_KPROBES_H */ 366{
367 return -ENOSYS;
368}
369static inline int enable_kprobe(struct kprobe *kp)
370{
371 return -ENOSYS;
372}
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
391#endif /* _LINUX_KPROBES_H */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 0424326f1679..8cc137911b34 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -48,7 +48,10 @@ struct kvm_irq_level {
48 * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47.. 48 * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47..
49 * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23.. 49 * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23..
50 */ 50 */
51 __u32 irq; 51 union {
52 __u32 irq;
53 __s32 status;
54 };
52 __u32 level; 55 __u32 level;
53}; 56};
54 57
@@ -126,6 +129,7 @@ struct kvm_run {
126 __u64 data_offset; /* relative to kvm_run start */ 129 __u64 data_offset; /* relative to kvm_run start */
127 } io; 130 } io;
128 struct { 131 struct {
132 struct kvm_debug_exit_arch arch;
129 } debug; 133 } debug;
130 /* KVM_EXIT_MMIO */ 134 /* KVM_EXIT_MMIO */
131 struct { 135 struct {
@@ -217,21 +221,6 @@ struct kvm_interrupt {
217 __u32 irq; 221 __u32 irq;
218}; 222};
219 223
220struct kvm_breakpoint {
221 __u32 enabled;
222 __u32 padding;
223 __u64 address;
224};
225
226/* for KVM_DEBUG_GUEST */
227struct kvm_debug_guest {
228 /* int */
229 __u32 enabled;
230 __u32 pad;
231 struct kvm_breakpoint breakpoints[4];
232 __u32 singlestep;
233};
234
235/* for KVM_GET_DIRTY_LOG */ 224/* for KVM_GET_DIRTY_LOG */
236struct kvm_dirty_log { 225struct kvm_dirty_log {
237 __u32 slot; 226 __u32 slot;
@@ -292,6 +281,17 @@ struct kvm_s390_interrupt {
292 __u64 parm64; 281 __u64 parm64;
293}; 282};
294 283
284/* for KVM_SET_GUEST_DEBUG */
285
286#define KVM_GUESTDBG_ENABLE 0x00000001
287#define KVM_GUESTDBG_SINGLESTEP 0x00000002
288
289struct kvm_guest_debug {
290 __u32 control;
291 __u32 pad;
292 struct kvm_guest_debug_arch arch;
293};
294
295#define KVM_TRC_SHIFT 16 295#define KVM_TRC_SHIFT 16
296/* 296/*
297 * kvm trace categories 297 * kvm trace categories
@@ -396,6 +396,59 @@ struct kvm_trace_rec {
396#ifdef __KVM_HAVE_USER_NMI 396#ifdef __KVM_HAVE_USER_NMI
397#define KVM_CAP_USER_NMI 22 397#define KVM_CAP_USER_NMI 22
398#endif 398#endif
399#ifdef __KVM_HAVE_GUEST_DEBUG
400#define KVM_CAP_SET_GUEST_DEBUG 23
401#endif
402#ifdef __KVM_HAVE_PIT
403#define KVM_CAP_REINJECT_CONTROL 24
404#endif
405#ifdef __KVM_HAVE_IOAPIC
406#define KVM_CAP_IRQ_ROUTING 25
407#endif
408#define KVM_CAP_IRQ_INJECT_STATUS 26
409#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
410#define KVM_CAP_DEVICE_DEASSIGNMENT 27
411#endif
412/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */
413#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
414
415#ifdef KVM_CAP_IRQ_ROUTING
416
417struct kvm_irq_routing_irqchip {
418 __u32 irqchip;
419 __u32 pin;
420};
421
422struct kvm_irq_routing_msi {
423 __u32 address_lo;
424 __u32 address_hi;
425 __u32 data;
426 __u32 pad;
427};
428
429/* gsi routing entry types */
430#define KVM_IRQ_ROUTING_IRQCHIP 1
431#define KVM_IRQ_ROUTING_MSI 2
432
433struct kvm_irq_routing_entry {
434 __u32 gsi;
435 __u32 type;
436 __u32 flags;
437 __u32 pad;
438 union {
439 struct kvm_irq_routing_irqchip irqchip;
440 struct kvm_irq_routing_msi msi;
441 __u32 pad[8];
442 } u;
443};
444
445struct kvm_irq_routing {
446 __u32 nr;
447 __u32 flags;
448 struct kvm_irq_routing_entry entries[0];
449};
450
451#endif
399 452
400/* 453/*
401 * ioctls for VM fds 454 * ioctls for VM fds
@@ -421,14 +474,19 @@ struct kvm_trace_rec {
421#define KVM_CREATE_PIT _IO(KVMIO, 0x64) 474#define KVM_CREATE_PIT _IO(KVMIO, 0x64)
422#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) 475#define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state)
423#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) 476#define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state)
477#define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level)
424#define KVM_REGISTER_COALESCED_MMIO \ 478#define KVM_REGISTER_COALESCED_MMIO \
425 _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) 479 _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
426#define KVM_UNREGISTER_COALESCED_MMIO \ 480#define KVM_UNREGISTER_COALESCED_MMIO \
427 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) 481 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
428#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ 482#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \
429 struct kvm_assigned_pci_dev) 483 struct kvm_assigned_pci_dev)
484#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
430#define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \ 485#define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \
431 struct kvm_assigned_irq) 486 struct kvm_assigned_irq)
487#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)
488#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \
489 struct kvm_assigned_pci_dev)
432 490
433/* 491/*
434 * ioctls for vcpu fds 492 * ioctls for vcpu fds
@@ -440,7 +498,8 @@ struct kvm_trace_rec {
440#define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs) 498#define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs)
441#define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) 499#define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation)
442#define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) 500#define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt)
443#define KVM_DEBUG_GUEST _IOW(KVMIO, 0x87, struct kvm_debug_guest) 501/* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */
502#define KVM_DEBUG_GUEST __KVM_DEPRECATED_DEBUG_GUEST
444#define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) 503#define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs)
445#define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) 504#define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs)
446#define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) 505#define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid)
@@ -469,6 +528,29 @@ struct kvm_trace_rec {
469#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) 528#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
470/* Available with KVM_CAP_NMI */ 529/* Available with KVM_CAP_NMI */
471#define KVM_NMI _IO(KVMIO, 0x9a) 530#define KVM_NMI _IO(KVMIO, 0x9a)
531/* Available with KVM_CAP_SET_GUEST_DEBUG */
532#define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug)
533
534/*
535 * Deprecated interfaces
536 */
537struct kvm_breakpoint {
538 __u32 enabled;
539 __u32 padding;
540 __u64 address;
541};
542
543struct kvm_debug_guest {
544 __u32 enabled;
545 __u32 pad;
546 struct kvm_breakpoint breakpoints[4];
547 __u32 singlestep;
548};
549
550#define __KVM_DEPRECATED_DEBUG_GUEST _IOW(KVMIO, 0x87, struct kvm_debug_guest)
551
552#define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *)
553#define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *)
472 554
473#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) 555#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
474#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) 556#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
@@ -522,6 +604,7 @@ struct kvm_assigned_irq {
522 604
523#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 605#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
524 606
607#define KVM_DEV_IRQ_ASSIGN_MSI_ACTION KVM_DEV_IRQ_ASSIGN_ENABLE_MSI
525#define KVM_DEV_IRQ_ASSIGN_ENABLE_MSI (1 << 0) 608#define KVM_DEV_IRQ_ASSIGN_ENABLE_MSI (1 << 0)
526 609
527#endif 610#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index bf6f703642fc..894a56e365e8 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -37,6 +37,7 @@
37#define KVM_REQ_PENDING_TIMER 5 37#define KVM_REQ_PENDING_TIMER 5
38#define KVM_REQ_UNHALT 6 38#define KVM_REQ_UNHALT 6
39#define KVM_REQ_MMU_SYNC 7 39#define KVM_REQ_MMU_SYNC 7
40#define KVM_REQ_KVMCLOCK_UPDATE 8
40 41
41#define KVM_USERSPACE_IRQ_SOURCE_ID 0 42#define KVM_USERSPACE_IRQ_SOURCE_ID 0
42 43
@@ -73,7 +74,7 @@ struct kvm_vcpu {
73 struct kvm_run *run; 74 struct kvm_run *run;
74 int guest_mode; 75 int guest_mode;
75 unsigned long requests; 76 unsigned long requests;
76 struct kvm_guest_debug guest_debug; 77 unsigned long guest_debug;
77 int fpu_active; 78 int fpu_active;
78 int guest_fpu_loaded; 79 int guest_fpu_loaded;
79 wait_queue_head_t wq; 80 wait_queue_head_t wq;
@@ -107,6 +108,20 @@ struct kvm_memory_slot {
107 int user_alloc; 108 int user_alloc;
108}; 109};
109 110
111struct kvm_kernel_irq_routing_entry {
112 u32 gsi;
113 int (*set)(struct kvm_kernel_irq_routing_entry *e,
114 struct kvm *kvm, int level);
115 union {
116 struct {
117 unsigned irqchip;
118 unsigned pin;
119 } irqchip;
120 struct msi_msg msi;
121 };
122 struct list_head link;
123};
124
110struct kvm { 125struct kvm {
111 struct mutex lock; /* protects the vcpus array and APIC accesses */ 126 struct mutex lock; /* protects the vcpus array and APIC accesses */
112 spinlock_t mmu_lock; 127 spinlock_t mmu_lock;
@@ -127,6 +142,11 @@ struct kvm {
127 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; 142 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
128#endif 143#endif
129 144
145#ifdef CONFIG_HAVE_KVM_IRQCHIP
146 struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
147 struct hlist_head mask_notifier_list;
148#endif
149
130#ifdef KVM_ARCH_WANT_MMU_NOTIFIER 150#ifdef KVM_ARCH_WANT_MMU_NOTIFIER
131 struct mmu_notifier mmu_notifier; 151 struct mmu_notifier mmu_notifier;
132 unsigned long mmu_notifier_seq; 152 unsigned long mmu_notifier_seq;
@@ -237,7 +257,6 @@ int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
237 int user_alloc); 257 int user_alloc);
238long kvm_arch_vm_ioctl(struct file *filp, 258long kvm_arch_vm_ioctl(struct file *filp,
239 unsigned int ioctl, unsigned long arg); 259 unsigned int ioctl, unsigned long arg);
240void kvm_arch_destroy_vm(struct kvm *kvm);
241 260
242int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu); 261int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
243int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu); 262int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
@@ -255,8 +274,8 @@ int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
255 struct kvm_mp_state *mp_state); 274 struct kvm_mp_state *mp_state);
256int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, 275int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
257 struct kvm_mp_state *mp_state); 276 struct kvm_mp_state *mp_state);
258int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, 277int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
259 struct kvm_debug_guest *dbg); 278 struct kvm_guest_debug *dbg);
260int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); 279int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
261 280
262int kvm_arch_init(void *opaque); 281int kvm_arch_init(void *opaque);
@@ -310,7 +329,6 @@ struct kvm_assigned_dev_kernel {
310 int host_irq; 329 int host_irq;
311 bool host_irq_disabled; 330 bool host_irq_disabled;
312 int guest_irq; 331 int guest_irq;
313 struct msi_msg guest_msi;
314#define KVM_ASSIGNED_DEV_GUEST_INTX (1 << 0) 332#define KVM_ASSIGNED_DEV_GUEST_INTX (1 << 0)
315#define KVM_ASSIGNED_DEV_GUEST_MSI (1 << 1) 333#define KVM_ASSIGNED_DEV_GUEST_MSI (1 << 1)
316#define KVM_ASSIGNED_DEV_HOST_INTX (1 << 8) 334#define KVM_ASSIGNED_DEV_HOST_INTX (1 << 8)
@@ -321,8 +339,21 @@ struct kvm_assigned_dev_kernel {
321 struct pci_dev *dev; 339 struct pci_dev *dev;
322 struct kvm *kvm; 340 struct kvm *kvm;
323}; 341};
324void kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level); 342
325void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi); 343struct kvm_irq_mask_notifier {
344 void (*func)(struct kvm_irq_mask_notifier *kimn, bool masked);
345 int irq;
346 struct hlist_node link;
347};
348
349void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq,
350 struct kvm_irq_mask_notifier *kimn);
351void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
352 struct kvm_irq_mask_notifier *kimn);
353void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask);
354
355int kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level);
356void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
326void kvm_register_irq_ack_notifier(struct kvm *kvm, 357void kvm_register_irq_ack_notifier(struct kvm *kvm,
327 struct kvm_irq_ack_notifier *kian); 358 struct kvm_irq_ack_notifier *kian);
328void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian); 359void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian);
@@ -464,4 +495,21 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
464} 495}
465#endif 496#endif
466 497
498#ifdef CONFIG_HAVE_KVM_IRQCHIP
499
500#define KVM_MAX_IRQ_ROUTES 1024
501
502int kvm_setup_default_irq_routing(struct kvm *kvm);
503int kvm_set_irq_routing(struct kvm *kvm,
504 const struct kvm_irq_routing_entry *entries,
505 unsigned nr,
506 unsigned flags);
507void kvm_free_irq_routing(struct kvm *kvm);
508
509#else
510
511static inline void kvm_free_irq_routing(struct kvm *kvm) {}
512
513#endif
514
467#endif 515#endif
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index 9b6f395c9625..2b8318c83e53 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -40,17 +40,4 @@ typedef unsigned long hfn_t;
40 40
41typedef hfn_t pfn_t; 41typedef hfn_t pfn_t;
42 42
43struct kvm_pio_request {
44 unsigned long count;
45 int cur_count;
46 struct page *guest_pages[2];
47 unsigned guest_page_offset;
48 int in;
49 int port;
50 int size;
51 int string;
52 int down;
53 int rep;
54};
55
56#endif /* __KVM_TYPES_H__ */ 43#endif /* __KVM_TYPES_H__ */
diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h
index 901c2d6377a8..b0e99898527c 100644
--- a/include/linux/latencytop.h
+++ b/include/linux/latencytop.h
@@ -9,6 +9,7 @@
9#ifndef _INCLUDE_GUARD_LATENCYTOP_H_ 9#ifndef _INCLUDE_GUARD_LATENCYTOP_H_
10#define _INCLUDE_GUARD_LATENCYTOP_H_ 10#define _INCLUDE_GUARD_LATENCYTOP_H_
11 11
12#include <linux/compiler.h>
12#ifdef CONFIG_LATENCYTOP 13#ifdef CONFIG_LATENCYTOP
13 14
14#define LT_SAVECOUNT 32 15#define LT_SAVECOUNT 32
@@ -24,7 +25,14 @@ struct latency_record {
24 25
25struct task_struct; 26struct task_struct;
26 27
27void account_scheduler_latency(struct task_struct *task, int usecs, int inter); 28extern int latencytop_enabled;
29void __account_scheduler_latency(struct task_struct *task, int usecs, int inter);
30static inline void
31account_scheduler_latency(struct task_struct *task, int usecs, int inter)
32{
33 if (unlikely(latencytop_enabled))
34 __account_scheduler_latency(task, usecs, inter);
35}
28 36
29void clear_all_latency_tracing(struct task_struct *p); 37void clear_all_latency_tracing(struct task_struct *p);
30 38
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/libata.h b/include/linux/libata.h
index 5d87bc09a1f5..3d501db36a26 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -209,6 +209,7 @@ enum {
209 209
210 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 210 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
211 211
212
212 /* struct ata_port pflags */ 213 /* struct ata_port pflags */
213 ATA_PFLAG_EH_PENDING = (1 << 0), /* EH pending */ 214 ATA_PFLAG_EH_PENDING = (1 << 0), /* EH pending */
214 ATA_PFLAG_EH_IN_PROGRESS = (1 << 1), /* EH in progress */ 215 ATA_PFLAG_EH_IN_PROGRESS = (1 << 1), /* EH in progress */
@@ -225,6 +226,9 @@ enum {
225 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 226 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
226 ATA_PFLAG_INIT_GTM_VALID = (1 << 19), /* initial gtm data valid */ 227 ATA_PFLAG_INIT_GTM_VALID = (1 << 19), /* initial gtm data valid */
227 228
229 ATA_PFLAG_PIO32 = (1 << 20), /* 32bit PIO */
230 ATA_PFLAG_PIO32CHANGE = (1 << 21), /* 32bit PIO can be turned on/off */
231
228 /* struct ata_queued_cmd flags */ 232 /* struct ata_queued_cmd flags */
229 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ 233 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
230 ATA_QCFLAG_DMAMAP = (1 << 1), /* SG table is DMA mapped */ 234 ATA_QCFLAG_DMAMAP = (1 << 1), /* SG table is DMA mapped */
@@ -275,7 +279,7 @@ enum {
275 * advised to wait only for the following duration before 279 * advised to wait only for the following duration before
276 * doing SRST. 280 * doing SRST.
277 */ 281 */
278 ATA_TMOUT_PMP_SRST_WAIT = 1000, 282 ATA_TMOUT_PMP_SRST_WAIT = 5000,
279 283
280 /* ATA bus states */ 284 /* ATA bus states */
281 BUS_UNKNOWN = 0, 285 BUS_UNKNOWN = 0,
@@ -379,7 +383,7 @@ enum {
379 ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */ 383 ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */
380 ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands 384 ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands
381 not multiple of 16 bytes */ 385 not multiple of 16 bytes */
382 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firwmare update warning */ 386 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firmware update warning */
383 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ 387 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */
384 388
385 /* DMA mask for user DMA control: User visible values; DO NOT 389 /* DMA mask for user DMA control: User visible values; DO NOT
@@ -530,6 +534,7 @@ struct ata_queued_cmd {
530 unsigned long flags; /* ATA_QCFLAG_xxx */ 534 unsigned long flags; /* ATA_QCFLAG_xxx */
531 unsigned int tag; 535 unsigned int tag;
532 unsigned int n_elem; 536 unsigned int n_elem;
537 unsigned int orig_n_elem;
533 538
534 int dma_dir; 539 int dma_dir;
535 540
@@ -688,7 +693,10 @@ struct ata_port {
688 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ 693 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
689 struct ata_port_operations *ops; 694 struct ata_port_operations *ops;
690 spinlock_t *lock; 695 spinlock_t *lock;
696 /* Flags owned by the EH context. Only EH should touch these once the
697 port is active */
691 unsigned long flags; /* ATA_FLAG_xxx */ 698 unsigned long flags; /* ATA_FLAG_xxx */
699 /* Flags that change dynamically, protected by ap->lock */
692 unsigned int pflags; /* ATA_PFLAG_xxx */ 700 unsigned int pflags; /* ATA_PFLAG_xxx */
693 unsigned int print_id; /* user visible unique port ID */ 701 unsigned int print_id; /* user visible unique port ID */
694 unsigned int port_no; /* 0 based port no. inside the host */ 702 unsigned int port_no; /* 0 based port no. inside the host */
@@ -750,7 +758,8 @@ struct ata_port {
750 acpi_handle acpi_handle; 758 acpi_handle acpi_handle;
751 struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ 759 struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */
752#endif 760#endif
753 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 761 /* owned by EH */
762 u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned;
754}; 763};
755 764
756/* The following initializer overrides a method to NULL whether one of 765/* The following initializer overrides a method to NULL whether one of
@@ -793,6 +802,7 @@ struct ata_port_operations {
793 ata_reset_fn_t pmp_hardreset; 802 ata_reset_fn_t pmp_hardreset;
794 ata_postreset_fn_t pmp_postreset; 803 ata_postreset_fn_t pmp_postreset;
795 void (*error_handler)(struct ata_port *ap); 804 void (*error_handler)(struct ata_port *ap);
805 void (*lost_interrupt)(struct ata_port *ap);
796 void (*post_internal_cmd)(struct ata_queued_cmd *qc); 806 void (*post_internal_cmd)(struct ata_queued_cmd *qc);
797 807
798 /* 808 /*
@@ -834,6 +844,8 @@ struct ata_port_operations {
834 void (*bmdma_start)(struct ata_queued_cmd *qc); 844 void (*bmdma_start)(struct ata_queued_cmd *qc);
835 void (*bmdma_stop)(struct ata_queued_cmd *qc); 845 void (*bmdma_stop)(struct ata_queued_cmd *qc);
836 u8 (*bmdma_status)(struct ata_port *ap); 846 u8 (*bmdma_status)(struct ata_port *ap);
847
848 void (*drain_fifo)(struct ata_queued_cmd *qc);
837#endif /* CONFIG_ATA_SFF */ 849#endif /* CONFIG_ATA_SFF */
838 850
839 ssize_t (*em_show)(struct ata_port *ap, char *buf); 851 ssize_t (*em_show)(struct ata_port *ap, char *buf);
@@ -1006,6 +1018,9 @@ extern int ata_cable_sata(struct ata_port *ap);
1006extern int ata_cable_ignore(struct ata_port *ap); 1018extern int ata_cable_ignore(struct ata_port *ap);
1007extern int ata_cable_unknown(struct ata_port *ap); 1019extern int ata_cable_unknown(struct ata_port *ap);
1008 1020
1021extern void ata_pio_queue_task(struct ata_port *ap, void *data,
1022 unsigned long delay);
1023
1009/* Timing helpers */ 1024/* Timing helpers */
1010extern unsigned int ata_pio_need_iordy(const struct ata_device *); 1025extern unsigned int ata_pio_need_iordy(const struct ata_device *);
1011extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); 1026extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
@@ -1570,6 +1585,7 @@ extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
1570extern unsigned int ata_sff_host_intr(struct ata_port *ap, 1585extern unsigned int ata_sff_host_intr(struct ata_port *ap,
1571 struct ata_queued_cmd *qc); 1586 struct ata_queued_cmd *qc);
1572extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); 1587extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance);
1588extern void ata_sff_lost_interrupt(struct ata_port *ap);
1573extern void ata_sff_freeze(struct ata_port *ap); 1589extern void ata_sff_freeze(struct ata_port *ap);
1574extern void ata_sff_thaw(struct ata_port *ap); 1590extern void ata_sff_thaw(struct ata_port *ap);
1575extern int ata_sff_prereset(struct ata_link *link, unsigned long deadline); 1591extern int ata_sff_prereset(struct ata_link *link, unsigned long deadline);
@@ -1582,9 +1598,11 @@ extern int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
1582extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class, 1598extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1583 unsigned long deadline); 1599 unsigned long deadline);
1584extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes); 1600extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes);
1601extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc);
1585extern void ata_sff_error_handler(struct ata_port *ap); 1602extern void ata_sff_error_handler(struct ata_port *ap);
1586extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc); 1603extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc);
1587extern int ata_sff_port_start(struct ata_port *ap); 1604extern int ata_sff_port_start(struct ata_port *ap);
1605extern int ata_sff_port_start32(struct ata_port *ap);
1588extern void ata_sff_std_ports(struct ata_ioports *ioaddr); 1606extern void ata_sff_std_ports(struct ata_ioports *ioaddr);
1589extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev, 1607extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev,
1590 unsigned long xfer_mask); 1608 unsigned long xfer_mask);
diff --git a/include/linux/lm_interface.h b/include/linux/lm_interface.h
deleted file mode 100644
index 2ed8fa1b762b..000000000000
--- a/include/linux/lm_interface.h
+++ /dev/null
@@ -1,277 +0,0 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#ifndef __LM_INTERFACE_DOT_H__
11#define __LM_INTERFACE_DOT_H__
12
13
14typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
15
16/*
17 * lm_mount() flags
18 *
19 * LM_MFLAG_SPECTATOR
20 * GFS is asking to join the filesystem's lockspace, but it doesn't want to
21 * modify the filesystem. The lock module shouldn't assign a journal to the FS
22 * mount. It shouldn't send recovery callbacks to the FS mount. If the node
23 * dies or withdraws, all locks can be wiped immediately.
24 *
25 * LM_MFLAG_CONV_NODROP
26 * Do not allow the dlm to internally resolve conversion deadlocks by demoting
27 * the lock to unlocked and then reacquiring it in the requested mode. Instead,
28 * it should cancel the request and return LM_OUT_CONV_DEADLK.
29 */
30
31#define LM_MFLAG_SPECTATOR 0x00000001
32#define LM_MFLAG_CONV_NODROP 0x00000002
33
34/*
35 * lm_lockstruct flags
36 *
37 * LM_LSFLAG_LOCAL
38 * The lock_nolock module returns LM_LSFLAG_LOCAL to GFS, indicating that GFS
39 * can make single-node optimizations.
40 */
41
42#define LM_LSFLAG_LOCAL 0x00000001
43
44/*
45 * lm_lockname types
46 */
47
48#define LM_TYPE_RESERVED 0x00
49#define LM_TYPE_NONDISK 0x01
50#define LM_TYPE_INODE 0x02
51#define LM_TYPE_RGRP 0x03
52#define LM_TYPE_META 0x04
53#define LM_TYPE_IOPEN 0x05
54#define LM_TYPE_FLOCK 0x06
55#define LM_TYPE_PLOCK 0x07
56#define LM_TYPE_QUOTA 0x08
57#define LM_TYPE_JOURNAL 0x09
58
59/*
60 * lm_lock() states
61 *
62 * SHARED is compatible with SHARED, not with DEFERRED or EX.
63 * DEFERRED is compatible with DEFERRED, not with SHARED or EX.
64 */
65
66#define LM_ST_UNLOCKED 0
67#define LM_ST_EXCLUSIVE 1
68#define LM_ST_DEFERRED 2
69#define LM_ST_SHARED 3
70
71/*
72 * lm_lock() flags
73 *
74 * LM_FLAG_TRY
75 * Don't wait to acquire the lock if it can't be granted immediately.
76 *
77 * LM_FLAG_TRY_1CB
78 * Send one blocking callback if TRY is set and the lock is not granted.
79 *
80 * LM_FLAG_NOEXP
81 * GFS sets this flag on lock requests it makes while doing journal recovery.
82 * These special requests should not be blocked due to the recovery like
83 * ordinary locks would be.
84 *
85 * LM_FLAG_ANY
86 * A SHARED request may also be granted in DEFERRED, or a DEFERRED request may
87 * also be granted in SHARED. The preferred state is whichever is compatible
88 * with other granted locks, or the specified state if no other locks exist.
89 *
90 * LM_FLAG_PRIORITY
91 * Override fairness considerations. Suppose a lock is held in a shared state
92 * and there is a pending request for the deferred state. A shared lock
93 * request with the priority flag would be allowed to bypass the deferred
94 * request and directly join the other shared lock. A shared lock request
95 * without the priority flag might be forced to wait until the deferred
96 * requested had acquired and released the lock.
97 */
98
99#define LM_FLAG_TRY 0x00000001
100#define LM_FLAG_TRY_1CB 0x00000002
101#define LM_FLAG_NOEXP 0x00000004
102#define LM_FLAG_ANY 0x00000008
103#define LM_FLAG_PRIORITY 0x00000010
104
105/*
106 * lm_lock() and lm_async_cb return flags
107 *
108 * LM_OUT_ST_MASK
109 * Masks the lower two bits of lock state in the returned value.
110 *
111 * LM_OUT_CACHEABLE
112 * The lock hasn't been released so GFS can continue to cache data for it.
113 *
114 * LM_OUT_CANCELED
115 * The lock request was canceled.
116 *
117 * LM_OUT_ASYNC
118 * The result of the request will be returned in an LM_CB_ASYNC callback.
119 *
120 * LM_OUT_CONV_DEADLK
121 * The lock request was canceled do to a conversion deadlock.
122 */
123
124#define LM_OUT_ST_MASK 0x00000003
125#define LM_OUT_CANCELED 0x00000008
126#define LM_OUT_ASYNC 0x00000080
127#define LM_OUT_ERROR 0x00000100
128
129/*
130 * lm_callback_t types
131 *
132 * LM_CB_NEED_E LM_CB_NEED_D LM_CB_NEED_S
133 * Blocking callback, a remote node is requesting the given lock in
134 * EXCLUSIVE, DEFERRED, or SHARED.
135 *
136 * LM_CB_NEED_RECOVERY
137 * The given journal needs to be recovered.
138 *
139 * LM_CB_ASYNC
140 * The given lock has been granted.
141 */
142
143#define LM_CB_NEED_E 257
144#define LM_CB_NEED_D 258
145#define LM_CB_NEED_S 259
146#define LM_CB_NEED_RECOVERY 260
147#define LM_CB_ASYNC 262
148
149/*
150 * lm_recovery_done() messages
151 */
152
153#define LM_RD_GAVEUP 308
154#define LM_RD_SUCCESS 309
155
156
157struct lm_lockname {
158 u64 ln_number;
159 unsigned int ln_type;
160};
161
162#define lm_name_equal(name1, name2) \
163 (((name1)->ln_number == (name2)->ln_number) && \
164 ((name1)->ln_type == (name2)->ln_type)) \
165
166struct lm_async_cb {
167 struct lm_lockname lc_name;
168 int lc_ret;
169};
170
171struct lm_lockstruct;
172
173struct lm_lockops {
174 const char *lm_proto_name;
175
176 /*
177 * Mount/Unmount
178 */
179
180 int (*lm_mount) (char *table_name, char *host_data,
181 lm_callback_t cb, void *cb_data,
182 unsigned int min_lvb_size, int flags,
183 struct lm_lockstruct *lockstruct,
184 struct kobject *fskobj);
185
186 void (*lm_others_may_mount) (void *lockspace);
187
188 void (*lm_unmount) (void *lockspace);
189
190 void (*lm_withdraw) (void *lockspace);
191
192 /*
193 * Lock oriented operations
194 */
195
196 int (*lm_get_lock) (void *lockspace, struct lm_lockname *name, void **lockp);
197
198 void (*lm_put_lock) (void *lock);
199
200 unsigned int (*lm_lock) (void *lock, unsigned int cur_state,
201 unsigned int req_state, unsigned int flags);
202
203 unsigned int (*lm_unlock) (void *lock, unsigned int cur_state);
204
205 void (*lm_cancel) (void *lock);
206
207 int (*lm_hold_lvb) (void *lock, char **lvbp);
208 void (*lm_unhold_lvb) (void *lock, char *lvb);
209
210 /*
211 * Posix Lock oriented operations
212 */
213
214 int (*lm_plock_get) (void *lockspace, struct lm_lockname *name,
215 struct file *file, struct file_lock *fl);
216
217 int (*lm_plock) (void *lockspace, struct lm_lockname *name,
218 struct file *file, int cmd, struct file_lock *fl);
219
220 int (*lm_punlock) (void *lockspace, struct lm_lockname *name,
221 struct file *file, struct file_lock *fl);
222
223 /*
224 * Client oriented operations
225 */
226
227 void (*lm_recovery_done) (void *lockspace, unsigned int jid,
228 unsigned int message);
229
230 struct module *lm_owner;
231};
232
233/*
234 * lm_mount() return values
235 *
236 * ls_jid - the journal ID this node should use
237 * ls_first - this node is the first to mount the file system
238 * ls_lvb_size - size in bytes of lock value blocks
239 * ls_lockspace - lock module's context for this file system
240 * ls_ops - lock module's functions
241 * ls_flags - lock module features
242 */
243
244struct lm_lockstruct {
245 unsigned int ls_jid;
246 unsigned int ls_first;
247 unsigned int ls_lvb_size;
248 void *ls_lockspace;
249 const struct lm_lockops *ls_ops;
250 int ls_flags;
251};
252
253/*
254 * Lock module bottom interface. A lock module makes itself available to GFS
255 * with these functions.
256 */
257
258int gfs2_register_lockproto(const struct lm_lockops *proto);
259void gfs2_unregister_lockproto(const struct lm_lockops *proto);
260
261/*
262 * Lock module top interface. GFS calls these functions when mounting or
263 * unmounting a file system.
264 */
265
266int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
267 lm_callback_t cb, void *cb_data,
268 unsigned int min_lvb_size, int flags,
269 struct lm_lockstruct *lockstruct,
270 struct kobject *fskobj);
271
272void gfs2_unmount_lockproto(struct lm_lockstruct *lockstruct);
273
274void gfs2_withdraw_lockproto(struct lm_lockstruct *lockstruct);
275
276#endif /* __LM_INTERFACE_DOT_H__ */
277
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index aa6fe7026de7..51855dfd8adb 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -346,6 +346,7 @@ static inline int __nlm_cmp_addr4(const struct sockaddr *sap1,
346 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; 346 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
347} 347}
348 348
349#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
349static inline int __nlm_cmp_addr6(const struct sockaddr *sap1, 350static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
350 const struct sockaddr *sap2) 351 const struct sockaddr *sap2)
351{ 352{
@@ -353,6 +354,13 @@ static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
353 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2; 354 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
354 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr); 355 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
355} 356}
357#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
358static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
359 const struct sockaddr *sap2)
360{
361 return 0;
362}
363#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
356 364
357/* 365/*
358 * Compare two host addresses 366 * Compare two host addresses
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/lockdep.h b/include/linux/lockdep.h
index 23bf02fb124f..da5a5a1f4cd2 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -20,43 +20,10 @@ struct lockdep_map;
20#include <linux/stacktrace.h> 20#include <linux/stacktrace.h>
21 21
22/* 22/*
23 * Lock-class usage-state bits: 23 * We'd rather not expose kernel/lockdep_states.h this wide, but we do need
24 * the total number of states... :-(
24 */ 25 */
25enum lock_usage_bit 26#define XXX_LOCK_USAGE_STATES (1+3*4)
26{
27 LOCK_USED = 0,
28 LOCK_USED_IN_HARDIRQ,
29 LOCK_USED_IN_SOFTIRQ,
30 LOCK_ENABLED_SOFTIRQS,
31 LOCK_ENABLED_HARDIRQS,
32 LOCK_USED_IN_HARDIRQ_READ,
33 LOCK_USED_IN_SOFTIRQ_READ,
34 LOCK_ENABLED_SOFTIRQS_READ,
35 LOCK_ENABLED_HARDIRQS_READ,
36 LOCK_USAGE_STATES
37};
38
39/*
40 * Usage-state bitmasks:
41 */
42#define LOCKF_USED (1 << LOCK_USED)
43#define LOCKF_USED_IN_HARDIRQ (1 << LOCK_USED_IN_HARDIRQ)
44#define LOCKF_USED_IN_SOFTIRQ (1 << LOCK_USED_IN_SOFTIRQ)
45#define LOCKF_ENABLED_HARDIRQS (1 << LOCK_ENABLED_HARDIRQS)
46#define LOCKF_ENABLED_SOFTIRQS (1 << LOCK_ENABLED_SOFTIRQS)
47
48#define LOCKF_ENABLED_IRQS (LOCKF_ENABLED_HARDIRQS | LOCKF_ENABLED_SOFTIRQS)
49#define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ)
50
51#define LOCKF_USED_IN_HARDIRQ_READ (1 << LOCK_USED_IN_HARDIRQ_READ)
52#define LOCKF_USED_IN_SOFTIRQ_READ (1 << LOCK_USED_IN_SOFTIRQ_READ)
53#define LOCKF_ENABLED_HARDIRQS_READ (1 << LOCK_ENABLED_HARDIRQS_READ)
54#define LOCKF_ENABLED_SOFTIRQS_READ (1 << LOCK_ENABLED_SOFTIRQS_READ)
55
56#define LOCKF_ENABLED_IRQS_READ \
57 (LOCKF_ENABLED_HARDIRQS_READ | LOCKF_ENABLED_SOFTIRQS_READ)
58#define LOCKF_USED_IN_IRQ_READ \
59 (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ)
60 27
61#define MAX_LOCKDEP_SUBCLASSES 8UL 28#define MAX_LOCKDEP_SUBCLASSES 8UL
62 29
@@ -97,7 +64,7 @@ struct lock_class {
97 * IRQ/softirq usage tracking bits: 64 * IRQ/softirq usage tracking bits:
98 */ 65 */
99 unsigned long usage_mask; 66 unsigned long usage_mask;
100 struct stack_trace usage_traces[LOCK_USAGE_STATES]; 67 struct stack_trace usage_traces[XXX_LOCK_USAGE_STATES];
101 68
102 /* 69 /*
103 * These fields represent a directed graph of lock dependencies, 70 * These fields represent a directed graph of lock dependencies,
@@ -324,7 +291,11 @@ static inline void lock_set_subclass(struct lockdep_map *lock,
324 lock_set_class(lock, lock->name, lock->key, subclass, ip); 291 lock_set_class(lock, lock->name, lock->key, subclass, ip);
325} 292}
326 293
327# define INIT_LOCKDEP .lockdep_recursion = 0, 294extern void lockdep_set_current_reclaim_state(gfp_t gfp_mask);
295extern void lockdep_clear_current_reclaim_state(void);
296extern void lockdep_trace_alloc(gfp_t mask);
297
298# define INIT_LOCKDEP .lockdep_recursion = 0, .lockdep_reclaim_gfp = 0,
328 299
329#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) 300#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
330 301
@@ -342,6 +313,9 @@ static inline void lockdep_on(void)
342# define lock_release(l, n, i) do { } while (0) 313# define lock_release(l, n, i) do { } while (0)
343# define lock_set_class(l, n, k, s, i) do { } while (0) 314# define lock_set_class(l, n, k, s, i) do { } while (0)
344# define lock_set_subclass(l, s, i) do { } while (0) 315# define lock_set_subclass(l, s, i) do { } while (0)
316# define lockdep_set_current_reclaim_state(g) do { } while (0)
317# define lockdep_clear_current_reclaim_state() do { } while (0)
318# define lockdep_trace_alloc(g) do { } while (0)
345# define lockdep_init() do { } while (0) 319# define lockdep_init() do { } while (0)
346# define lockdep_info() do { } while (0) 320# define lockdep_info() do { } while (0)
347# define lockdep_init_map(lock, name, key, sub) \ 321# define lockdep_init_map(lock, name, key, sub) \
@@ -390,6 +364,23 @@ do { \
390 364
391#endif /* CONFIG_LOCK_STAT */ 365#endif /* CONFIG_LOCK_STAT */
392 366
367#ifdef CONFIG_LOCKDEP
368
369/*
370 * On lockdep we dont want the hand-coded irq-enable of
371 * _raw_*_lock_flags() code, because lockdep assumes
372 * that interrupts are not re-enabled during lock-acquire:
373 */
374#define LOCK_CONTENDED_FLAGS(_lock, try, lock, lockfl, flags) \
375 LOCK_CONTENDED((_lock), (try), (lock))
376
377#else /* CONFIG_LOCKDEP */
378
379#define LOCK_CONTENDED_FLAGS(_lock, try, lock, lockfl, flags) \
380 lockfl((_lock), (flags))
381
382#endif /* CONFIG_LOCKDEP */
383
393#ifdef CONFIG_GENERIC_HARDIRQS 384#ifdef CONFIG_GENERIC_HARDIRQS
394extern void early_init_irq_lock_class(void); 385extern void early_init_irq_lock_class(void);
395#else 386#else
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 6ffd6db5bb0d..40725447f5e0 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -160,5 +160,6 @@ int loop_unregister_transfer(int number);
160#define LOOP_SET_STATUS64 0x4C04 160#define LOOP_SET_STATUS64 0x4C04
161#define LOOP_GET_STATUS64 0x4C05 161#define LOOP_GET_STATUS64 0x4C05
162#define LOOP_CHANGE_FD 0x4C06 162#define LOOP_CHANGE_FD 0x4C06
163#define LOOP_SET_CAPACITY 0x4C07
163 164
164#endif 165#endif
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 0b4df7eba852..5b4e28bcb788 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -49,4 +49,5 @@
49#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA 49#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA
50#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA 50#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA
51 51
52#define STACK_END_MAGIC 0x57AC6E9D
52#endif /* __LINUX_MAGIC_H__ */ 53#endif /* __LINUX_MAGIC_H__ */
diff --git a/include/linux/major.h b/include/linux/major.h
index 88249452b935..058ec15dd060 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -171,5 +171,6 @@
171#define VIOTAPE_MAJOR 230 171#define VIOTAPE_MAJOR 230
172 172
173#define BLOCK_EXT_MAJOR 259 173#define BLOCK_EXT_MAJOR 259
174#define SCSI_OSD_MAJOR 260 /* open-osd's OSD scsi device */
174 175
175#endif 176#endif
diff --git a/include/linux/maple.h b/include/linux/maple.h
index c23d3f51ba40..d9a51b9b3300 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
@@ -8,33 +8,49 @@ extern struct bus_type maple_bus_type;
8 8
9/* Maple Bus command and response codes */ 9/* Maple Bus command and response codes */
10enum maple_code { 10enum maple_code {
11 MAPLE_RESPONSE_FILEERR = -5, 11 MAPLE_RESPONSE_FILEERR = -5,
12 MAPLE_RESPONSE_AGAIN = -4, /* request should be retransmitted */ 12 MAPLE_RESPONSE_AGAIN, /* retransmit */
13 MAPLE_RESPONSE_BADCMD = -3, 13 MAPLE_RESPONSE_BADCMD,
14 MAPLE_RESPONSE_BADFUNC = -2, 14 MAPLE_RESPONSE_BADFUNC,
15 MAPLE_RESPONSE_NONE = -1, /* unit didn't respond at all */ 15 MAPLE_RESPONSE_NONE, /* unit didn't respond*/
16 MAPLE_COMMAND_DEVINFO = 1, 16 MAPLE_COMMAND_DEVINFO = 1,
17 MAPLE_COMMAND_ALLINFO = 2, 17 MAPLE_COMMAND_ALLINFO,
18 MAPLE_COMMAND_RESET = 3, 18 MAPLE_COMMAND_RESET,
19 MAPLE_COMMAND_KILL = 4, 19 MAPLE_COMMAND_KILL,
20 MAPLE_RESPONSE_DEVINFO = 5, 20 MAPLE_RESPONSE_DEVINFO,
21 MAPLE_RESPONSE_ALLINFO = 6, 21 MAPLE_RESPONSE_ALLINFO,
22 MAPLE_RESPONSE_OK = 7, 22 MAPLE_RESPONSE_OK,
23 MAPLE_RESPONSE_DATATRF = 8, 23 MAPLE_RESPONSE_DATATRF,
24 MAPLE_COMMAND_GETCOND = 9, 24 MAPLE_COMMAND_GETCOND,
25 MAPLE_COMMAND_GETMINFO = 10, 25 MAPLE_COMMAND_GETMINFO,
26 MAPLE_COMMAND_BREAD = 11, 26 MAPLE_COMMAND_BREAD,
27 MAPLE_COMMAND_BWRITE = 12, 27 MAPLE_COMMAND_BWRITE,
28 MAPLE_COMMAND_SETCOND = 14 28 MAPLE_COMMAND_BSYNC,
29 MAPLE_COMMAND_SETCOND,
30 MAPLE_COMMAND_MICCONTROL
31};
32
33enum maple_file_errors {
34 MAPLE_FILEERR_INVALID_PARTITION = 0x01000000,
35 MAPLE_FILEERR_PHASE_ERROR = 0x02000000,
36 MAPLE_FILEERR_INVALID_BLOCK = 0x04000000,
37 MAPLE_FILEERR_WRITE_ERROR = 0x08000000,
38 MAPLE_FILEERR_INVALID_WRITE_LENGTH = 0x10000000,
39 MAPLE_FILEERR_BAD_CRC = 0x20000000
40};
41
42struct maple_buffer {
43 char bufx[0x400];
44 void *buf;
29}; 45};
30 46
31struct mapleq { 47struct mapleq {
32 struct list_head list; 48 struct list_head list;
33 struct maple_device *dev; 49 struct maple_device *dev;
34 void *sendbuf, *recvbuf, *recvbufdcsp; 50 struct maple_buffer *recvbuf;
51 void *sendbuf, *recvbuf_p2;
35 unsigned char length; 52 unsigned char length;
36 enum maple_code command; 53 enum maple_code command;
37 struct mutex mutex;
38}; 54};
39 55
40struct maple_devinfo { 56struct maple_devinfo {
@@ -52,11 +68,15 @@ struct maple_device {
52 struct maple_driver *driver; 68 struct maple_driver *driver;
53 struct mapleq *mq; 69 struct mapleq *mq;
54 void (*callback) (struct mapleq * mq); 70 void (*callback) (struct mapleq * mq);
71 void (*fileerr_handler)(struct maple_device *mdev, void *recvbuf);
72 int (*can_unload)(struct maple_device *mdev);
55 unsigned long when, interval, function; 73 unsigned long when, interval, function;
56 struct maple_devinfo devinfo; 74 struct maple_devinfo devinfo;
57 unsigned char port, unit; 75 unsigned char port, unit;
58 char product_name[32]; 76 char product_name[32];
59 char product_licence[64]; 77 char product_licence[64];
78 atomic_t busy;
79 wait_queue_head_t maple_wait;
60 struct device dev; 80 struct device dev;
61}; 81};
62 82
@@ -72,7 +92,7 @@ void maple_getcond_callback(struct maple_device *dev,
72int maple_driver_register(struct maple_driver *); 92int maple_driver_register(struct maple_driver *);
73void maple_driver_unregister(struct maple_driver *); 93void maple_driver_unregister(struct maple_driver *);
74 94
75int maple_add_packet_sleeps(struct maple_device *mdev, u32 function, 95int maple_add_packet(struct maple_device *mdev, u32 function,
76 u32 command, u32 length, void *data); 96 u32 command, u32 length, void *data);
77void maple_clear_dev(struct maple_device *mdev); 97void maple_clear_dev(struct maple_device *mdev);
78 98
diff --git a/include/linux/matroxfb.h b/include/linux/matroxfb.h
index 404f678e734b..2203121a43e9 100644
--- a/include/linux/matroxfb.h
+++ b/include/linux/matroxfb.h
@@ -37,7 +37,7 @@ enum matroxfb_ctrl_id {
37 MATROXFB_CID_LAST 37 MATROXFB_CID_LAST
38}; 38};
39 39
40#define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t) 40#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
41 41
42#endif 42#endif
43 43
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 326f45c86530..25b9ca93d232 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -56,7 +56,7 @@ extern void mem_cgroup_move_lists(struct page *page,
56 enum lru_list from, enum lru_list to); 56 enum lru_list from, enum lru_list to);
57extern void mem_cgroup_uncharge_page(struct page *page); 57extern void mem_cgroup_uncharge_page(struct page *page);
58extern void mem_cgroup_uncharge_cache_page(struct page *page); 58extern void mem_cgroup_uncharge_cache_page(struct page *page);
59extern int mem_cgroup_shrink_usage(struct page *page, 59extern int mem_cgroup_shmem_charge_fallback(struct page *page,
60 struct mm_struct *mm, gfp_t gfp_mask); 60 struct mm_struct *mm, gfp_t gfp_mask);
61 61
62extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 62extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
@@ -75,7 +75,7 @@ int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
75{ 75{
76 struct mem_cgroup *mem; 76 struct mem_cgroup *mem;
77 rcu_read_lock(); 77 rcu_read_lock();
78 mem = mem_cgroup_from_task((mm)->owner); 78 mem = mem_cgroup_from_task(rcu_dereference((mm)->owner));
79 rcu_read_unlock(); 79 rcu_read_unlock();
80 return cgroup == mem; 80 return cgroup == mem;
81} 81}
@@ -88,9 +88,6 @@ extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
88/* 88/*
89 * For memory reclaim. 89 * For memory reclaim.
90 */ 90 */
91extern int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem);
92extern long mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem);
93
94extern int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem); 91extern int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem);
95extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem, 92extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
96 int priority); 93 int priority);
@@ -104,6 +101,8 @@ struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
104 struct zone *zone); 101 struct zone *zone);
105struct zone_reclaim_stat* 102struct zone_reclaim_stat*
106mem_cgroup_get_reclaim_stat_from_page(struct page *page); 103mem_cgroup_get_reclaim_stat_from_page(struct page *page);
104extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
105 struct task_struct *p);
107 106
108#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 107#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
109extern int do_swap_account; 108extern int do_swap_account;
@@ -156,7 +155,7 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page)
156{ 155{
157} 156}
158 157
159static inline int mem_cgroup_shrink_usage(struct page *page, 158static inline int mem_cgroup_shmem_charge_fallback(struct page *page,
160 struct mm_struct *mm, gfp_t gfp_mask) 159 struct mm_struct *mm, gfp_t gfp_mask)
161{ 160{
162 return 0; 161 return 0;
@@ -209,16 +208,6 @@ static inline void mem_cgroup_end_migration(struct mem_cgroup *mem,
209{ 208{
210} 209}
211 210
212static inline int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem)
213{
214 return 0;
215}
216
217static inline int mem_cgroup_reclaim_imbalance(struct mem_cgroup *mem)
218{
219 return 0;
220}
221
222static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem) 211static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem)
223{ 212{
224 return 0; 213 return 0;
@@ -270,6 +259,11 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page)
270 return NULL; 259 return NULL;
271} 260}
272 261
262static inline void
263mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
264{
265}
266
273#endif /* CONFIG_CGROUP_MEM_CONT */ 267#endif /* CONFIG_CGROUP_MEM_CONT */
274 268
275#endif /* _LINUX_MEMCONTROL_H */ 269#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 3fdc10806d31..37fa19b34ef5 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -99,4 +99,21 @@ enum mem_add_context { BOOT, HOTPLUG };
99#define hotplug_memory_notifier(fn, pri) do { } while (0) 99#define hotplug_memory_notifier(fn, pri) do { } while (0)
100#endif 100#endif
101 101
102/*
103 * 'struct memory_accessor' is a generic interface to provide
104 * in-kernel access to persistent memory such as i2c or SPI EEPROMs
105 */
106struct memory_accessor {
107 ssize_t (*read)(struct memory_accessor *, char *buf, off_t offset,
108 size_t count);
109 ssize_t (*write)(struct memory_accessor *, const char *buf,
110 off_t offset, size_t count);
111};
112
113/*
114 * Kernel text modification mutex, used for code patching. Users of this lock
115 * can sleep.
116 */
117extern struct mutex text_mutex;
118
102#endif /* _LINUX_MEMORY_H_ */ 119#endif /* _LINUX_MEMORY_H_ */
diff --git a/include/linux/mfd/ds1wm.h b/include/linux/mfd/ds1wm.h
new file mode 100644
index 000000000000..be469a357cbb
--- /dev/null
+++ b/include/linux/mfd/ds1wm.h
@@ -0,0 +1,6 @@
1/* MFD cell driver data for the DS1WM driver */
2
3struct ds1wm_driver_data {
4 int active_high;
5 int clock_rate;
6};
diff --git a/include/linux/mfd/htc-pasic3.h b/include/linux/mfd/htc-pasic3.h
index b4294f12c4f8..3d3ed67bd969 100644
--- a/include/linux/mfd/htc-pasic3.h
+++ b/include/linux/mfd/htc-pasic3.h
@@ -48,7 +48,6 @@ struct pasic3_leds_machinfo {
48 48
49struct pasic3_platform_data { 49struct pasic3_platform_data {
50 struct pasic3_leds_machinfo *led_pdata; 50 struct pasic3_leds_machinfo *led_pdata;
51 unsigned int bus_shift;
52 unsigned int clock_rate; 51 unsigned int clock_rate;
53}; 52};
54 53
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/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
index af95a1d2f3a1..d899dc0223ba 100644
--- a/include/linux/mfd/wm8350/audio.h
+++ b/include/linux/mfd/wm8350/audio.h
@@ -490,6 +490,7 @@
490/* 490/*
491 * R231 (0xE7) - Jack Status 491 * R231 (0xE7) - Jack Status
492 */ 492 */
493#define WM8350_JACK_L_LVL 0x0800
493#define WM8350_JACK_R_LVL 0x0400 494#define WM8350_JACK_R_LVL 0x0400
494 495
495/* 496/*
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 980669d50dca..42cca672f340 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -640,9 +640,11 @@ struct wm8350 {
640 * 640 *
641 * @init: Function called during driver initialisation. Should be 641 * @init: Function called during driver initialisation. Should be
642 * used by the platform to configure GPIO functions and similar. 642 * used by the platform to configure GPIO functions and similar.
643 * @irq_high: Set if WM8350 IRQ is active high.
643 */ 644 */
644struct wm8350_platform_data { 645struct wm8350_platform_data {
645 int (*init)(struct wm8350 *wm8350); 646 int (*init)(struct wm8350 *wm8350);
647 int irq_high;
646}; 648};
647 649
648 650
diff --git a/include/linux/mfd/wm8400-audio.h b/include/linux/mfd/wm8400-audio.h
index b6640e018046..e06ed3eb1d0a 100644
--- a/include/linux/mfd/wm8400-audio.h
+++ b/include/linux/mfd/wm8400-audio.h
@@ -1181,6 +1181,7 @@
1181#define WM8400_FLL_OUTDIV_SHIFT 0 /* FLL_OUTDIV - [2:0] */ 1181#define WM8400_FLL_OUTDIV_SHIFT 0 /* FLL_OUTDIV - [2:0] */
1182#define WM8400_FLL_OUTDIV_WIDTH 3 /* FLL_OUTDIV - [2:0] */ 1182#define WM8400_FLL_OUTDIV_WIDTH 3 /* FLL_OUTDIV - [2:0] */
1183 1183
1184struct wm8400;
1184void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400); 1185void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400);
1185 1186
1186#endif 1187#endif
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/miscdevice.h b/include/linux/miscdevice.h
index a820f816a49e..beb6ec99cfef 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -26,6 +26,7 @@
26#define TUN_MINOR 200 26#define TUN_MINOR 200
27#define MWAVE_MINOR 219 /* ACP/Mwave Modem */ 27#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
28#define MPT_MINOR 220 28#define MPT_MINOR 220
29#define MPT2SAS_MINOR 221
29#define HPET_MINOR 228 30#define HPET_MINOR 228
30#define FUSE_MINOR 229 31#define FUSE_MINOR 229
31#define KVM_MINOR 232 32#define KVM_MINOR 232
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index cf9c679ab38b..0f82293a82ed 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -55,6 +55,7 @@ enum {
55 MLX4_CMD_CLOSE_PORT = 0xa, 55 MLX4_CMD_CLOSE_PORT = 0xa,
56 MLX4_CMD_QUERY_HCA = 0xb, 56 MLX4_CMD_QUERY_HCA = 0xb,
57 MLX4_CMD_QUERY_PORT = 0x43, 57 MLX4_CMD_QUERY_PORT = 0x43,
58 MLX4_CMD_SENSE_PORT = 0x4d,
58 MLX4_CMD_SET_PORT = 0xc, 59 MLX4_CMD_SET_PORT = 0xc,
59 MLX4_CMD_ACCESS_DDR = 0x2e, 60 MLX4_CMD_ACCESS_DDR = 0x2e,
60 MLX4_CMD_MAP_ICM = 0xffa, 61 MLX4_CMD_MAP_ICM = 0xffa,
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 8f659cc29960..3aff8a6a389e 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -155,8 +155,9 @@ enum mlx4_qp_region {
155}; 155};
156 156
157enum mlx4_port_type { 157enum mlx4_port_type {
158 MLX4_PORT_TYPE_IB = 1 << 0, 158 MLX4_PORT_TYPE_IB = 1,
159 MLX4_PORT_TYPE_ETH = 1 << 1, 159 MLX4_PORT_TYPE_ETH = 2,
160 MLX4_PORT_TYPE_AUTO = 3
160}; 161};
161 162
162enum mlx4_special_vlan_idx { 163enum mlx4_special_vlan_idx {
@@ -237,6 +238,7 @@ struct mlx4_caps {
237 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; 238 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1];
238 u8 supported_type[MLX4_MAX_PORTS + 1]; 239 u8 supported_type[MLX4_MAX_PORTS + 1];
239 u32 port_mask; 240 u32 port_mask;
241 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1];
240}; 242};
241 243
242struct mlx4_buf_list { 244struct mlx4_buf_list {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 065cdf8c09fb..bff1f0d475c7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -104,6 +104,7 @@ extern unsigned int kobjsize(const void *objp);
104#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ 104#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
105#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 105#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
106#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ 106#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */
107#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */
107 108
108#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 109#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
109#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 110#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -134,6 +135,7 @@ extern pgprot_t protection_map[16];
134 135
135#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */ 136#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */
136#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ 137#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
138#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */
137 139
138/* 140/*
139 * This interface is used by x86 PAT code to identify a pfn mapping that is 141 * This interface is used by x86 PAT code to identify a pfn mapping that is
@@ -145,7 +147,7 @@ extern pgprot_t protection_map[16];
145 */ 147 */
146static inline int is_linear_pfn_mapping(struct vm_area_struct *vma) 148static inline int is_linear_pfn_mapping(struct vm_area_struct *vma)
147{ 149{
148 return ((vma->vm_flags & VM_PFNMAP) && vma->vm_pgoff); 150 return (vma->vm_flags & VM_PFN_AT_MMAP);
149} 151}
150 152
151static inline int is_pfn_mapping(struct vm_area_struct *vma) 153static inline int is_pfn_mapping(struct vm_area_struct *vma)
@@ -186,7 +188,7 @@ struct vm_operations_struct {
186 188
187 /* notification that a previously read-only page is about to become 189 /* notification that a previously read-only page is about to become
188 * writable, if an error is returned it will cause a SIGBUS */ 190 * writable, if an error is returned it will cause a SIGBUS */
189 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); 191 int (*page_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf);
190 192
191 /* called by access_process_vm when get_user_pages() fails, typically 193 /* called by access_process_vm when get_user_pages() fails, typically
192 * for use by special VMAs that can switch between memory and hardware 194 * for use by special VMAs that can switch between memory and hardware
@@ -833,6 +835,7 @@ int __set_page_dirty_nobuffers(struct page *page);
833int __set_page_dirty_no_writeback(struct page *page); 835int __set_page_dirty_no_writeback(struct page *page);
834int redirty_page_for_writepage(struct writeback_control *wbc, 836int redirty_page_for_writepage(struct writeback_control *wbc,
835 struct page *page); 837 struct page *page);
838void account_page_dirtied(struct page *page, struct address_space *mapping);
836int set_page_dirty(struct page *page); 839int set_page_dirty(struct page *page);
837int set_page_dirty_lock(struct page *page); 840int set_page_dirty_lock(struct page *page);
838int clear_page_dirty_for_io(struct page *page); 841int clear_page_dirty_for_io(struct page *page);
@@ -1076,7 +1079,7 @@ static inline void setup_per_cpu_pageset(void) {}
1076#endif 1079#endif
1077 1080
1078/* nommu.c */ 1081/* nommu.c */
1079extern atomic_t mmap_pages_allocated; 1082extern atomic_long_t mmap_pages_allocated;
1080 1083
1081/* prio_tree.c */ 1084/* prio_tree.c */
1082void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); 1085void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 92915e81443f..0e80e26ecf21 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -11,6 +11,7 @@
11#include <linux/rwsem.h> 11#include <linux/rwsem.h>
12#include <linux/completion.h> 12#include <linux/completion.h>
13#include <linux/cpumask.h> 13#include <linux/cpumask.h>
14#include <linux/page-debug-flags.h>
14#include <asm/page.h> 15#include <asm/page.h>
15#include <asm/mmu.h> 16#include <asm/mmu.h>
16 17
@@ -94,6 +95,9 @@ struct page {
94 void *virtual; /* Kernel virtual address (NULL if 95 void *virtual; /* Kernel virtual address (NULL if
95 not kmapped, ie. highmem) */ 96 not kmapped, ie. highmem) */
96#endif /* WANT_PAGE_VIRTUAL */ 97#endif /* WANT_PAGE_VIRTUAL */
98#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
99 unsigned long debug_flags; /* Use atomic bitops on this */
100#endif
97}; 101};
98 102
99/* 103/*
@@ -276,4 +280,7 @@ struct mm_struct {
276#endif 280#endif
277}; 281};
278 282
283/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */
284#define mm_cpumask(mm) (&(mm)->cpu_vm_mask)
285
279#endif /* _LINUX_MM_TYPES_H */ 286#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 30d1073bac3b..9872d6ca58ae 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -12,21 +12,18 @@
12 12
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/percpu_counter.h>
15 16
16#include <asm/atomic.h> 17#include <asm/atomic.h>
17 18
18extern int sysctl_overcommit_memory; 19extern int sysctl_overcommit_memory;
19extern int sysctl_overcommit_ratio; 20extern int sysctl_overcommit_ratio;
20extern atomic_long_t vm_committed_space; 21extern struct percpu_counter vm_committed_as;
21 22
22#ifdef CONFIG_SMP
23extern void vm_acct_memory(long pages);
24#else
25static inline void vm_acct_memory(long pages) 23static inline void vm_acct_memory(long pages)
26{ 24{
27 atomic_long_add(pages, &vm_committed_space); 25 percpu_counter_add(&vm_committed_as, pages);
28} 26}
29#endif
30 27
31static inline void vm_unacct_memory(long pages) 28static inline void vm_unacct_memory(long pages)
32{ 29{
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 4e457256bd33..3e7615e9087e 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -192,5 +192,10 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host)
192 wake_up_process(host->sdio_irq_thread); 192 wake_up_process(host->sdio_irq_thread);
193} 193}
194 194
195struct regulator;
196
197int mmc_regulator_get_ocrmask(struct regulator *supply);
198int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit);
199
195#endif 200#endif
196 201
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h
index 139d7c88d9c9..3d1b7bde1283 100644
--- a/include/linux/mmiotrace.h
+++ b/include/linux/mmiotrace.h
@@ -1,5 +1,5 @@
1#ifndef MMIOTRACE_H 1#ifndef _LINUX_MMIOTRACE_H
2#define MMIOTRACE_H 2#define _LINUX_MMIOTRACE_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/list.h> 5#include <linux/list.h>
@@ -13,28 +13,34 @@ typedef void (*kmmio_post_handler_t)(struct kmmio_probe *,
13 unsigned long condition, struct pt_regs *); 13 unsigned long condition, struct pt_regs *);
14 14
15struct kmmio_probe { 15struct kmmio_probe {
16 struct list_head list; /* kmmio internal list */ 16 /* kmmio internal list: */
17 unsigned long addr; /* start location of the probe point */ 17 struct list_head list;
18 unsigned long len; /* length of the probe region */ 18 /* start location of the probe point: */
19 kmmio_pre_handler_t pre_handler; /* Called before addr is executed. */ 19 unsigned long addr;
20 kmmio_post_handler_t post_handler; /* Called after addr is executed */ 20 /* length of the probe region: */
21 void *private; 21 unsigned long len;
22 /* Called before addr is executed: */
23 kmmio_pre_handler_t pre_handler;
24 /* Called after addr is executed: */
25 kmmio_post_handler_t post_handler;
26 void *private;
22}; 27};
23 28
29extern unsigned int kmmio_count;
30
31extern int register_kmmio_probe(struct kmmio_probe *p);
32extern void unregister_kmmio_probe(struct kmmio_probe *p);
33
34#ifdef CONFIG_MMIOTRACE
24/* kmmio is active by some kmmio_probes? */ 35/* kmmio is active by some kmmio_probes? */
25static inline int is_kmmio_active(void) 36static inline int is_kmmio_active(void)
26{ 37{
27 extern unsigned int kmmio_count;
28 return kmmio_count; 38 return kmmio_count;
29} 39}
30 40
31extern int register_kmmio_probe(struct kmmio_probe *p);
32extern void unregister_kmmio_probe(struct kmmio_probe *p);
33
34/* Called from page fault handler. */ 41/* Called from page fault handler. */
35extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); 42extern int kmmio_handler(struct pt_regs *regs, unsigned long addr);
36 43
37#ifdef CONFIG_MMIOTRACE
38/* Called from ioremap.c */ 44/* Called from ioremap.c */
39extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, 45extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size,
40 void __iomem *addr); 46 void __iomem *addr);
@@ -43,7 +49,17 @@ extern void mmiotrace_iounmap(volatile void __iomem *addr);
43/* For anyone to insert markers. Remember trailing newline. */ 49/* For anyone to insert markers. Remember trailing newline. */
44extern int mmiotrace_printk(const char *fmt, ...) 50extern int mmiotrace_printk(const char *fmt, ...)
45 __attribute__ ((format (printf, 1, 2))); 51 __attribute__ ((format (printf, 1, 2)));
46#else 52#else /* !CONFIG_MMIOTRACE: */
53static inline int is_kmmio_active(void)
54{
55 return 0;
56}
57
58static inline int kmmio_handler(struct pt_regs *regs, unsigned long addr)
59{
60 return 0;
61}
62
47static inline void mmiotrace_ioremap(resource_size_t offset, 63static inline void mmiotrace_ioremap(resource_size_t offset,
48 unsigned long size, void __iomem *addr) 64 unsigned long size, void __iomem *addr)
49{ 65{
@@ -63,28 +79,28 @@ static inline int mmiotrace_printk(const char *fmt, ...)
63#endif /* CONFIG_MMIOTRACE */ 79#endif /* CONFIG_MMIOTRACE */
64 80
65enum mm_io_opcode { 81enum mm_io_opcode {
66 MMIO_READ = 0x1, /* struct mmiotrace_rw */ 82 MMIO_READ = 0x1, /* struct mmiotrace_rw */
67 MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ 83 MMIO_WRITE = 0x2, /* struct mmiotrace_rw */
68 MMIO_PROBE = 0x3, /* struct mmiotrace_map */ 84 MMIO_PROBE = 0x3, /* struct mmiotrace_map */
69 MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ 85 MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */
70 MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */ 86 MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */
71}; 87};
72 88
73struct mmiotrace_rw { 89struct mmiotrace_rw {
74 resource_size_t phys; /* PCI address of register */ 90 resource_size_t phys; /* PCI address of register */
75 unsigned long value; 91 unsigned long value;
76 unsigned long pc; /* optional program counter */ 92 unsigned long pc; /* optional program counter */
77 int map_id; 93 int map_id;
78 unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */ 94 unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */
79 unsigned char width; /* size of register access in bytes */ 95 unsigned char width; /* size of register access in bytes */
80}; 96};
81 97
82struct mmiotrace_map { 98struct mmiotrace_map {
83 resource_size_t phys; /* base address in PCI space */ 99 resource_size_t phys; /* base address in PCI space */
84 unsigned long virt; /* base virtual address */ 100 unsigned long virt; /* base virtual address */
85 unsigned long len; /* mapping size */ 101 unsigned long len; /* mapping size */
86 int map_id; 102 int map_id;
87 unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */ 103 unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */
88}; 104};
89 105
90/* in kernel/trace/trace_mmiotrace.c */ 106/* in kernel/trace/trace_mmiotrace.c */
@@ -94,4 +110,4 @@ extern void mmio_trace_rw(struct mmiotrace_rw *rw);
94extern void mmio_trace_mapping(struct mmiotrace_map *map); 110extern void mmio_trace_mapping(struct mmiotrace_map *map);
95extern int mmio_trace_printk(const char *fmt, va_list args); 111extern int mmio_trace_printk(const char *fmt, va_list args);
96 112
97#endif /* MMIOTRACE_H */ 113#endif /* _LINUX_MMIOTRACE_H */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 1aca6cebbb78..186ec6ab334d 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -764,12 +764,6 @@ extern int numa_zonelist_order_handler(struct ctl_table *, int,
764extern char numa_zonelist_order[]; 764extern char numa_zonelist_order[];
765#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */ 765#define NUMA_ZONELIST_ORDER_LEN 16 /* string buffer size */
766 766
767#include <linux/topology.h>
768/* Returns the number of the current Node. */
769#ifndef numa_node_id
770#define numa_node_id() (cpu_to_node(raw_smp_processor_id()))
771#endif
772
773#ifndef CONFIG_NEED_MULTIPLE_NODES 767#ifndef CONFIG_NEED_MULTIPLE_NODES
774 768
775extern struct pglist_data contig_page_data; 769extern struct pglist_data contig_page_data;
@@ -806,6 +800,14 @@ extern struct zone *next_zone(struct zone *zone);
806 zone; \ 800 zone; \
807 zone = next_zone(zone)) 801 zone = next_zone(zone))
808 802
803#define for_each_populated_zone(zone) \
804 for (zone = (first_online_pgdat())->node_zones; \
805 zone; \
806 zone = next_zone(zone)) \
807 if (!populated_zone(zone)) \
808 ; /* do nothing */ \
809 else
810
809static inline struct zone *zonelist_zone(struct zoneref *zoneref) 811static inline struct zone *zonelist_zone(struct zoneref *zoneref)
810{ 812{
811 return zoneref->zone; 813 return zoneref->zone;
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 830bbcd449d6..3a059298cc19 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -22,6 +22,8 @@ struct proc_mounts {
22 int event; 22 int event;
23}; 23};
24 24
25struct fs_struct;
26
25extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 27extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
26 struct fs_struct *); 28 struct fs_struct *);
27extern void __put_mnt_ns(struct mnt_namespace *ns); 29extern void __put_mnt_ns(struct mnt_namespace *ns);
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index fde86671f48f..1bf5900ffe43 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -454,4 +454,13 @@ struct dmi_system_id {
454 454
455#define DMI_MATCH(a, b) { a, b } 455#define DMI_MATCH(a, b) { a, b }
456 456
457#define PLATFORM_NAME_SIZE 20
458#define PLATFORM_MODULE_PREFIX "platform:"
459
460struct platform_device_id {
461 char name[PLATFORM_NAME_SIZE];
462 kernel_ulong_t driver_data
463 __attribute__((aligned(sizeof(kernel_ulong_t))));
464};
465
457#endif /* LINUX_MOD_DEVICETABLE_H */ 466#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 145a75528cc1..627ac082e2a6 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -248,6 +248,10 @@ struct module
248 const unsigned long *crcs; 248 const unsigned long *crcs;
249 unsigned int num_syms; 249 unsigned int num_syms;
250 250
251 /* Kernel parameters. */
252 struct kernel_param *kp;
253 unsigned int num_kp;
254
251 /* GPL-only exported symbols. */ 255 /* GPL-only exported symbols. */
252 unsigned int num_gpl_syms; 256 unsigned int num_gpl_syms;
253 const struct kernel_symbol *gpl_syms; 257 const struct kernel_symbol *gpl_syms;
@@ -329,6 +333,11 @@ struct module
329 unsigned int num_tracepoints; 333 unsigned int num_tracepoints;
330#endif 334#endif
331 335
336#ifdef CONFIG_TRACING
337 const char **trace_bprintk_fmt_start;
338 unsigned int num_trace_bprintk_fmt;
339#endif
340
332#ifdef CONFIG_MODULE_UNLOAD 341#ifdef CONFIG_MODULE_UNLOAD
333 /* What modules depend on me? */ 342 /* What modules depend on me? */
334 struct list_head modules_which_use_me; 343 struct list_head modules_which_use_me;
@@ -350,6 +359,8 @@ struct module
350#define MODULE_ARCH_INIT {} 359#define MODULE_ARCH_INIT {}
351#endif 360#endif
352 361
362extern struct mutex module_mutex;
363
353/* FIXME: It'd be nice to isolate modules during init, too, so they 364/* FIXME: It'd be nice to isolate modules during init, too, so they
354 aren't used before they (may) fail. But presently too much code 365 aren't used before they (may) fail. But presently too much code
355 (IDE & SCSI) require entry into the module during init.*/ 366 (IDE & SCSI) require entry into the module during init.*/
@@ -358,10 +369,10 @@ static inline int module_is_live(struct module *mod)
358 return mod->state != MODULE_STATE_GOING; 369 return mod->state != MODULE_STATE_GOING;
359} 370}
360 371
361/* Is this address in a module? (second is with no locks, for oops) */
362struct module *module_text_address(unsigned long addr);
363struct module *__module_text_address(unsigned long addr); 372struct module *__module_text_address(unsigned long addr);
364int is_module_address(unsigned long addr); 373struct module *__module_address(unsigned long addr);
374bool is_module_address(unsigned long addr);
375bool is_module_text_address(unsigned long addr);
365 376
366static inline int within_module_core(unsigned long addr, struct module *mod) 377static inline int within_module_core(unsigned long addr, struct module *mod)
367{ 378{
@@ -375,6 +386,31 @@ static inline int within_module_init(unsigned long addr, struct module *mod)
375 addr < (unsigned long)mod->module_init + mod->init_size; 386 addr < (unsigned long)mod->module_init + mod->init_size;
376} 387}
377 388
389/* Search for module by name: must hold module_mutex. */
390struct module *find_module(const char *name);
391
392struct symsearch {
393 const struct kernel_symbol *start, *stop;
394 const unsigned long *crcs;
395 enum {
396 NOT_GPL_ONLY,
397 GPL_ONLY,
398 WILL_BE_GPL_ONLY,
399 } licence;
400 bool unused;
401};
402
403/* Search for an exported symbol by name. */
404const struct kernel_symbol *find_symbol(const char *name,
405 struct module **owner,
406 const unsigned long **crc,
407 bool gplok,
408 bool warn);
409
410/* Walk the exported symbol table */
411bool each_symbol(bool (*fn)(const struct symsearch *arr, struct module *owner,
412 unsigned int symnum, void *data), void *data);
413
378/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if 414/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
379 symnum out of range. */ 415 symnum out of range. */
380int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, 416int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
@@ -383,6 +419,10 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
383/* Look for this name: can be of form module:name. */ 419/* Look for this name: can be of form module:name. */
384unsigned long module_kallsyms_lookup_name(const char *name); 420unsigned long module_kallsyms_lookup_name(const char *name);
385 421
422int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
423 struct module *, unsigned long),
424 void *data);
425
386extern void __module_put_and_exit(struct module *mod, long code) 426extern void __module_put_and_exit(struct module *mod, long code)
387 __attribute__((noreturn)); 427 __attribute__((noreturn));
388#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); 428#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code);
@@ -444,6 +484,7 @@ static inline void __module_get(struct module *module)
444#define symbol_put_addr(p) do { } while(0) 484#define symbol_put_addr(p) do { } while(0)
445 485
446#endif /* CONFIG_MODULE_UNLOAD */ 486#endif /* CONFIG_MODULE_UNLOAD */
487int use_module(struct module *a, struct module *b);
447 488
448/* This is a #define so the string doesn't get put in every .o file */ 489/* This is a #define so the string doesn't get put in every .o file */
449#define module_name(mod) \ 490#define module_name(mod) \
@@ -490,21 +531,24 @@ search_module_extables(unsigned long addr)
490 return NULL; 531 return NULL;
491} 532}
492 533
493/* Is this address in a module? */ 534static inline struct module *__module_address(unsigned long addr)
494static inline struct module *module_text_address(unsigned long addr)
495{ 535{
496 return NULL; 536 return NULL;
497} 537}
498 538
499/* Is this address in a module? (don't take a lock, we're oopsing) */
500static inline struct module *__module_text_address(unsigned long addr) 539static inline struct module *__module_text_address(unsigned long addr)
501{ 540{
502 return NULL; 541 return NULL;
503} 542}
504 543
505static inline int is_module_address(unsigned long addr) 544static inline bool is_module_address(unsigned long addr)
506{ 545{
507 return 0; 546 return false;
547}
548
549static inline bool is_module_text_address(unsigned long addr)
550{
551 return false;
508} 552}
509 553
510/* Get/put a kernel symbol (calls should be symmetric) */ 554/* Get/put a kernel symbol (calls should be symmetric) */
@@ -559,6 +603,14 @@ static inline unsigned long module_kallsyms_lookup_name(const char *name)
559 return 0; 603 return 0;
560} 604}
561 605
606static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
607 struct module *,
608 unsigned long),
609 void *data)
610{
611 return 0;
612}
613
562static inline int register_module_notifier(struct notifier_block * nb) 614static inline int register_module_notifier(struct notifier_block * nb)
563{ 615{
564 /* no events will happen anyway, so this can always succeed */ 616 /* no events will happen anyway, so this can always succeed */
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index e4af3399ef48..a4f0b931846c 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -138,6 +138,16 @@ extern int parse_args(const char *name,
138 unsigned num, 138 unsigned num,
139 int (*unknown)(char *param, char *val)); 139 int (*unknown)(char *param, char *val));
140 140
141/* Called by module remove. */
142#ifdef CONFIG_SYSFS
143extern void destroy_params(const struct kernel_param *params, unsigned num);
144#else
145static inline void destroy_params(const struct kernel_param *params,
146 unsigned num)
147{
148}
149#endif /* !CONFIG_SYSFS */
150
141/* All the helper functions */ 151/* All the helper functions */
142/* The macros to do compile-time type checking stolen from Jakub 152/* The macros to do compile-time type checking stolen from Jakub
143 Jelinek, who IIRC came up with this idea for the 2.4 module init code. */ 153 Jelinek, who IIRC came up with this idea for the 2.4 module init code. */
diff --git a/include/linux/mount.h b/include/linux/mount.h
index cab2a85e2ee8..51f55f903aff 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -27,6 +27,7 @@ struct mnt_namespace;
27#define MNT_NODIRATIME 0x10 27#define MNT_NODIRATIME 0x10
28#define MNT_RELATIME 0x20 28#define MNT_RELATIME 0x20
29#define MNT_READONLY 0x40 /* does the user want this to be r/o? */ 29#define MNT_READONLY 0x40 /* does the user want this to be r/o? */
30#define MNT_STRICTATIME 0x80
30 31
31#define MNT_SHRINKABLE 0x100 32#define MNT_SHRINKABLE 0x100
32#define MNT_IMBALANCED_WRITE_COUNT 0x200 /* just for debugging */ 33#define MNT_IMBALANCED_WRITE_COUNT 0x200 /* just for debugging */
diff --git a/include/linux/mpage.h b/include/linux/mpage.h
index 5c42821da2d1..068a0c9946af 100644
--- a/include/linux/mpage.h
+++ b/include/linux/mpage.h
@@ -11,21 +11,11 @@
11 */ 11 */
12#ifdef CONFIG_BLOCK 12#ifdef CONFIG_BLOCK
13 13
14struct mpage_data {
15 struct bio *bio;
16 sector_t last_block_in_bio;
17 get_block_t *get_block;
18 unsigned use_writepage;
19};
20
21struct writeback_control; 14struct writeback_control;
22 15
23struct bio *mpage_bio_submit(int rw, struct bio *bio);
24int mpage_readpages(struct address_space *mapping, struct list_head *pages, 16int mpage_readpages(struct address_space *mapping, struct list_head *pages,
25 unsigned nr_pages, get_block_t get_block); 17 unsigned nr_pages, get_block_t get_block);
26int mpage_readpage(struct page *page, get_block_t get_block); 18int mpage_readpage(struct page *page, get_block_t get_block);
27int __mpage_writepage(struct page *page, struct writeback_control *wbc,
28 void *data);
29int mpage_writepages(struct address_space *mapping, 19int mpage_writepages(struct address_space *mapping,
30 struct writeback_control *wbc, get_block_t get_block); 20 struct writeback_control *wbc, get_block_t get_block);
31int mpage_writepage(struct page *page, get_block_t *get_block, 21int mpage_writepage(struct page *page, get_block_t *get_block,
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 8a455694d682..0d45b4e8d367 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -193,6 +193,9 @@ struct vif_device
193struct mfc_cache 193struct mfc_cache
194{ 194{
195 struct mfc_cache *next; /* Next entry on cache line */ 195 struct mfc_cache *next; /* Next entry on cache line */
196#ifdef CONFIG_NET_NS
197 struct net *mfc_net;
198#endif
196 __be32 mfc_mcastgrp; /* Group the entry belongs to */ 199 __be32 mfc_mcastgrp; /* Group the entry belongs to */
197 __be32 mfc_origin; /* Source of packet */ 200 __be32 mfc_origin; /* Source of packet */
198 vifi_t mfc_parent; /* Source interface */ 201 vifi_t mfc_parent; /* Source interface */
@@ -215,6 +218,18 @@ struct mfc_cache
215 } mfc_un; 218 } mfc_un;
216}; 219};
217 220
221static inline
222struct net *mfc_net(const struct mfc_cache *mfc)
223{
224 return read_pnet(&mfc->mfc_net);
225}
226
227static inline
228void mfc_net_set(struct mfc_cache *mfc, struct net *net)
229{
230 write_pnet(&mfc->mfc_net, hold_net(net));
231}
232
218#define MFC_STATIC 1 233#define MFC_STATIC 1
219#define MFC_NOTIFY 2 234#define MFC_NOTIFY 2
220 235
@@ -241,7 +256,8 @@ struct mfc_cache
241 256
242#ifdef __KERNEL__ 257#ifdef __KERNEL__
243struct rtmsg; 258struct rtmsg;
244extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); 259extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
260 struct rtmsg *rtm, int nowait);
245#endif 261#endif
246 262
247#endif 263#endif
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 5375faca1f72..43dc97e32183 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -65,7 +65,7 @@ struct mif6ctl {
65 mifi_t mif6c_mifi; /* Index of MIF */ 65 mifi_t mif6c_mifi; /* Index of MIF */
66 unsigned char mif6c_flags; /* MIFF_ flags */ 66 unsigned char mif6c_flags; /* MIFF_ flags */
67 unsigned char vifc_threshold; /* ttl limit */ 67 unsigned char vifc_threshold; /* ttl limit */
68 u_short mif6c_pifi; /* the index of the physical IF */ 68 __u16 mif6c_pifi; /* the index of the physical IF */
69 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ 69 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */
70}; 70};
71 71
diff --git a/include/linux/msi.h b/include/linux/msi.h
index d2b8a1e8ca11..6991ab5b24d1 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -20,20 +20,23 @@ extern void write_msi_msg(unsigned int irq, struct msi_msg *msg);
20 20
21struct msi_desc { 21struct msi_desc {
22 struct { 22 struct {
23 __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */ 23 __u8 is_msix : 1;
24 __u8 multiple: 3; /* log2 number of messages */
24 __u8 maskbit : 1; /* mask-pending bit supported ? */ 25 __u8 maskbit : 1; /* mask-pending bit supported ? */
25 __u8 masked : 1;
26 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 26 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
27 __u8 pos; /* Location of the msi capability */ 27 __u8 pos; /* Location of the msi capability */
28 __u32 maskbits_mask; /* mask bits mask */
29 __u16 entry_nr; /* specific enabled entry */ 28 __u16 entry_nr; /* specific enabled entry */
30 unsigned default_irq; /* default pre-assigned irq */ 29 unsigned default_irq; /* default pre-assigned irq */
31 }msi_attrib; 30 } msi_attrib;
32 31
32 u32 masked; /* mask bits */
33 unsigned int irq; 33 unsigned int irq;
34 struct list_head list; 34 struct list_head list;
35 35
36 void __iomem *mask_base; 36 union {
37 void __iomem *mask_base;
38 u8 mask_pos;
39 };
37 struct pci_dev *dev; 40 struct pci_dev *dev;
38 41
39 /* Last set MSI message */ 42 /* Last set MSI message */
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/mutex.h b/include/linux/mutex.h
index 7a0e5c4f8072..3069ec7e0ab8 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -50,8 +50,10 @@ struct mutex {
50 atomic_t count; 50 atomic_t count;
51 spinlock_t wait_lock; 51 spinlock_t wait_lock;
52 struct list_head wait_list; 52 struct list_head wait_list;
53#ifdef CONFIG_DEBUG_MUTEXES 53#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
54 struct thread_info *owner; 54 struct thread_info *owner;
55#endif
56#ifdef CONFIG_DEBUG_MUTEXES
55 const char *name; 57 const char *name;
56 void *magic; 58 void *magic;
57#endif 59#endif
@@ -68,7 +70,6 @@ struct mutex_waiter {
68 struct list_head list; 70 struct list_head list;
69 struct task_struct *task; 71 struct task_struct *task;
70#ifdef CONFIG_DEBUG_MUTEXES 72#ifdef CONFIG_DEBUG_MUTEXES
71 struct mutex *lock;
72 void *magic; 73 void *magic;
73#endif 74#endif
74}; 75};
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index f69e66d151cc..30b06c893944 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -204,7 +204,7 @@ void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
204/* linux/fs/ncpfs/dir.c */ 204/* linux/fs/ncpfs/dir.c */
205extern const struct inode_operations ncp_dir_inode_operations; 205extern const struct inode_operations ncp_dir_inode_operations;
206extern const struct file_operations ncp_dir_operations; 206extern const struct file_operations ncp_dir_operations;
207extern struct dentry_operations ncp_root_dentry_operations; 207extern const struct dentry_operations ncp_root_dentry_operations;
208int ncp_conn_logged_in(struct super_block *); 208int ncp_conn_logged_in(struct super_block *);
209int ncp_date_dos2unix(__le16 time, __le16 date); 209int ncp_date_dos2unix(__le16 time, __le16 date);
210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
diff --git a/include/linux/ncp_no.h b/include/linux/ncp_no.h
index f56a696a7cc6..cddaa48fb182 100644
--- a/include/linux/ncp_no.h
+++ b/include/linux/ncp_no.h
@@ -2,18 +2,18 @@
2#define _NCP_NO 2#define _NCP_NO
3 3
4/* these define the attribute byte as seen by NCP */ 4/* these define the attribute byte as seen by NCP */
5#define aRONLY (__constant_cpu_to_le32(1)) 5#define aRONLY (__cpu_to_le32(1))
6#define aHIDDEN (__constant_cpu_to_le32(2)) 6#define aHIDDEN (__cpu_to_le32(2))
7#define aSYSTEM (__constant_cpu_to_le32(4)) 7#define aSYSTEM (__cpu_to_le32(4))
8#define aEXECUTE (__constant_cpu_to_le32(8)) 8#define aEXECUTE (__cpu_to_le32(8))
9#define aDIR (__constant_cpu_to_le32(0x10)) 9#define aDIR (__cpu_to_le32(0x10))
10#define aARCH (__constant_cpu_to_le32(0x20)) 10#define aARCH (__cpu_to_le32(0x20))
11#define aSHARED (__constant_cpu_to_le32(0x80)) 11#define aSHARED (__cpu_to_le32(0x80))
12#define aDONTSUBALLOCATE (__constant_cpu_to_le32(1L<<11)) 12#define aDONTSUBALLOCATE (__cpu_to_le32(1L<<11))
13#define aTRANSACTIONAL (__constant_cpu_to_le32(1L<<12)) 13#define aTRANSACTIONAL (__cpu_to_le32(1L<<12))
14#define aPURGE (__constant_cpu_to_le32(1L<<16)) 14#define aPURGE (__cpu_to_le32(1L<<16))
15#define aRENAMEINHIBIT (__constant_cpu_to_le32(1L<<17)) 15#define aRENAMEINHIBIT (__cpu_to_le32(1L<<17))
16#define aDELETEINHIBIT (__constant_cpu_to_le32(1L<<18)) 16#define aDELETEINHIBIT (__cpu_to_le32(1L<<18))
17#define aDONTCOMPRESS (__constant_cpu_to_le32(1L<<27)) 17#define aDONTCOMPRESS (__cpu_to_le32(1L<<27))
18 18
19#endif /* _NCP_NO */ 19#endif /* _NCP_NO */
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
index 8730d5dae1bc..12c9de138451 100644
--- a/include/linux/neighbour.h
+++ b/include/linux/neighbour.h
@@ -31,6 +31,7 @@ enum
31 * Neighbor Cache Entry Flags 31 * Neighbor Cache Entry Flags
32 */ 32 */
33 33
34#define NTF_USE 0x01
34#define NTF_PROXY 0x08 /* == ATF_PUBL */ 35#define NTF_PROXY 0x08 /* == ATF_PUBL */
35#define NTF_ROUTER 0x80 36#define NTF_ROUTER 0x80
36 37
diff --git a/include/linux/net.h b/include/linux/net.h
index 4515efae4c39..4fc2ffd527f9 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -129,11 +129,15 @@ struct socket {
129 socket_state state; 129 socket_state state;
130 short type; 130 short type;
131 unsigned long flags; 131 unsigned long flags;
132 const struct proto_ops *ops; 132 /*
133 * Please keep fasync_list & wait fields in the same cache line
134 */
133 struct fasync_struct *fasync_list; 135 struct fasync_struct *fasync_list;
136 wait_queue_head_t wait;
137
134 struct file *file; 138 struct file *file;
135 struct sock *sk; 139 struct sock *sk;
136 wait_queue_head_t wait; 140 const struct proto_ops *ops;
137}; 141};
138 142
139struct vm_area_struct; 143struct vm_area_struct;
diff --git a/include/linux/net_dropmon.h b/include/linux/net_dropmon.h
new file mode 100644
index 000000000000..0217fb81a630
--- /dev/null
+++ b/include/linux/net_dropmon.h
@@ -0,0 +1,56 @@
1#ifndef __NET_DROPMON_H
2#define __NET_DROPMON_H
3
4#include <linux/netlink.h>
5
6struct net_dm_drop_point {
7 __u8 pc[8];
8 __u32 count;
9};
10
11#define NET_DM_CFG_VERSION 0
12#define NET_DM_CFG_ALERT_COUNT 1
13#define NET_DM_CFG_ALERT_DELAY 2
14#define NET_DM_CFG_MAX 3
15
16struct net_dm_config_entry {
17 __u32 type;
18 __u64 data __attribute__((aligned(8)));
19};
20
21struct net_dm_config_msg {
22 __u32 entries;
23 struct net_dm_config_entry options[0];
24};
25
26struct net_dm_alert_msg {
27 __u32 entries;
28 struct net_dm_drop_point points[0];
29};
30
31struct net_dm_user_msg {
32 union {
33 struct net_dm_config_msg user;
34 struct net_dm_alert_msg alert;
35 } u;
36};
37
38
39/* These are the netlink message types for this protocol */
40
41enum {
42 NET_DM_CMD_UNSPEC = 0,
43 NET_DM_CMD_ALERT,
44 NET_DM_CMD_CONFIG,
45 NET_DM_CMD_START,
46 NET_DM_CMD_STOP,
47 _NET_DM_CMD_MAX,
48};
49
50#define NET_DM_CMD_MAX (_NET_DM_CMD_MAX - 1)
51
52/*
53 * Our group identifiers
54 */
55#define NET_DM_GRP_ALERT 1
56#endif
diff --git a/include/linux/net_tstamp.h b/include/linux/net_tstamp.h
new file mode 100644
index 000000000000..a3b8546354ac
--- /dev/null
+++ b/include/linux/net_tstamp.h
@@ -0,0 +1,104 @@
1/*
2 * Userspace API for hardware time stamping of network packets
3 *
4 * Copyright (C) 2008,2009 Intel Corporation
5 * Author: Patrick Ohly <patrick.ohly@intel.com>
6 *
7 */
8
9#ifndef _NET_TIMESTAMPING_H
10#define _NET_TIMESTAMPING_H
11
12#include <linux/socket.h> /* for SO_TIMESTAMPING */
13
14/* SO_TIMESTAMPING gets an integer bit field comprised of these values */
15enum {
16 SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),
17 SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1),
18 SOF_TIMESTAMPING_RX_HARDWARE = (1<<2),
19 SOF_TIMESTAMPING_RX_SOFTWARE = (1<<3),
20 SOF_TIMESTAMPING_SOFTWARE = (1<<4),
21 SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5),
22 SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6),
23 SOF_TIMESTAMPING_MASK =
24 (SOF_TIMESTAMPING_RAW_HARDWARE - 1) |
25 SOF_TIMESTAMPING_RAW_HARDWARE
26};
27
28/**
29 * struct hwtstamp_config - %SIOCSHWTSTAMP parameter
30 *
31 * @flags: no flags defined right now, must be zero
32 * @tx_type: one of HWTSTAMP_TX_*
33 * @rx_type: one of one of HWTSTAMP_FILTER_*
34 *
35 * %SIOCSHWTSTAMP expects a &struct ifreq with a ifr_data pointer to
36 * this structure. dev_ifsioc() in the kernel takes care of the
37 * translation between 32 bit userspace and 64 bit kernel. The
38 * structure is intentionally chosen so that it has the same layout on
39 * 32 and 64 bit systems, don't break this!
40 */
41struct hwtstamp_config {
42 int flags;
43 int tx_type;
44 int rx_filter;
45};
46
47/* possible values for hwtstamp_config->tx_type */
48enum {
49 /*
50 * No outgoing packet will need hardware time stamping;
51 * should a packet arrive which asks for it, no hardware
52 * time stamping will be done.
53 */
54 HWTSTAMP_TX_OFF,
55
56 /*
57 * Enables hardware time stamping for outgoing packets;
58 * the sender of the packet decides which are to be
59 * time stamped by setting %SOF_TIMESTAMPING_TX_SOFTWARE
60 * before sending the packet.
61 */
62 HWTSTAMP_TX_ON,
63};
64
65/* possible values for hwtstamp_config->rx_filter */
66enum {
67 /* time stamp no incoming packet at all */
68 HWTSTAMP_FILTER_NONE,
69
70 /* time stamp any incoming packet */
71 HWTSTAMP_FILTER_ALL,
72
73 /* return value: time stamp all packets requested plus some others */
74 HWTSTAMP_FILTER_SOME,
75
76 /* PTP v1, UDP, any kind of event packet */
77 HWTSTAMP_FILTER_PTP_V1_L4_EVENT,
78 /* PTP v1, UDP, Sync packet */
79 HWTSTAMP_FILTER_PTP_V1_L4_SYNC,
80 /* PTP v1, UDP, Delay_req packet */
81 HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ,
82 /* PTP v2, UDP, any kind of event packet */
83 HWTSTAMP_FILTER_PTP_V2_L4_EVENT,
84 /* PTP v2, UDP, Sync packet */
85 HWTSTAMP_FILTER_PTP_V2_L4_SYNC,
86 /* PTP v2, UDP, Delay_req packet */
87 HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ,
88
89 /* 802.AS1, Ethernet, any kind of event packet */
90 HWTSTAMP_FILTER_PTP_V2_L2_EVENT,
91 /* 802.AS1, Ethernet, Sync packet */
92 HWTSTAMP_FILTER_PTP_V2_L2_SYNC,
93 /* 802.AS1, Ethernet, Delay_req packet */
94 HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ,
95
96 /* PTP v2/802.AS1, any layer, any kind of event packet */
97 HWTSTAMP_FILTER_PTP_V2_EVENT,
98 /* PTP v2/802.AS1, any layer, Sync packet */
99 HWTSTAMP_FILTER_PTP_V2_SYNC,
100 /* PTP v2/802.AS1, any layer, Delay_req packet */
101 HWTSTAMP_FILTER_PTP_V2_DELAY_REQ,
102};
103
104#endif /* _NET_TIMESTAMPING_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ec54785d34f9..5a96a1a406e9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -32,6 +32,7 @@
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
33#include <linux/timer.h> 33#include <linux/timer.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/mm.h>
35#include <asm/atomic.h> 36#include <asm/atomic.h>
36#include <asm/cache.h> 37#include <asm/cache.h>
37#include <asm/byteorder.h> 38#include <asm/byteorder.h>
@@ -96,14 +97,14 @@ struct wireless_dev;
96 * Compute the worst case header length according to the protocols 97 * Compute the worst case header length according to the protocols
97 * used. 98 * used.
98 */ 99 */
99 100
100#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 101#if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
101# if defined(CONFIG_MAC80211_MESH) 102# if defined(CONFIG_MAC80211_MESH)
102# define LL_MAX_HEADER 128 103# define LL_MAX_HEADER 128
103# else 104# else
104# define LL_MAX_HEADER 96 105# define LL_MAX_HEADER 96
105# endif 106# endif
106#elif defined(CONFIG_TR) 107#elif defined(CONFIG_TR) || defined(CONFIG_TR_MODULE)
107# define LL_MAX_HEADER 48 108# define LL_MAX_HEADER 48
108#else 109#else
109# define LL_MAX_HEADER 32 110# define LL_MAX_HEADER 32
@@ -124,7 +125,7 @@ struct wireless_dev;
124 * Network device statistics. Akin to the 2.0 ether stats but 125 * Network device statistics. Akin to the 2.0 ether stats but
125 * with byte counters. 126 * with byte counters.
126 */ 127 */
127 128
128struct net_device_stats 129struct net_device_stats
129{ 130{
130 unsigned long rx_packets; /* total packets received */ 131 unsigned long rx_packets; /* total packets received */
@@ -285,7 +286,7 @@ enum netdev_state_t
285 286
286/* 287/*
287 * This structure holds at boot time configured netdevice settings. They 288 * This structure holds at boot time configured netdevice settings. They
288 * are then used in the device probing. 289 * are then used in the device probing.
289 */ 290 */
290struct netdev_boot_setup { 291struct netdev_boot_setup {
291 char name[IFNAMSIZ]; 292 char name[IFNAMSIZ];
@@ -314,6 +315,9 @@ struct napi_struct {
314 spinlock_t poll_lock; 315 spinlock_t poll_lock;
315 int poll_owner; 316 int poll_owner;
316#endif 317#endif
318
319 unsigned int gro_count;
320
317 struct net_device *dev; 321 struct net_device *dev;
318 struct list_head dev_list; 322 struct list_head dev_list;
319 struct sk_buff *gro_list; 323 struct sk_buff *gro_list;
@@ -327,6 +331,14 @@ enum
327 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ 331 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
328}; 332};
329 333
334enum {
335 GRO_MERGED,
336 GRO_MERGED_FREE,
337 GRO_HELD,
338 GRO_NORMAL,
339 GRO_DROP,
340};
341
330extern void __napi_schedule(struct napi_struct *n); 342extern void __napi_schedule(struct napi_struct *n);
331 343
332static inline int napi_disable_pending(struct napi_struct *n) 344static inline int napi_disable_pending(struct napi_struct *n)
@@ -488,7 +500,7 @@ struct netdev_queue {
488 * 500 *
489 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr); 501 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
490 * This function is called when the Media Access Control address 502 * This function is called when the Media Access Control address
491 * needs to be changed. If not this interface is not defined, the 503 * needs to be changed. If this interface is not defined, the
492 * mac address can not be changed. 504 * mac address can not be changed.
493 * 505 *
494 * int (*ndo_validate_addr)(struct net_device *dev); 506 * int (*ndo_validate_addr)(struct net_device *dev);
@@ -582,6 +594,14 @@ struct net_device_ops {
582#define HAVE_NETDEV_POLL 594#define HAVE_NETDEV_POLL
583 void (*ndo_poll_controller)(struct net_device *dev); 595 void (*ndo_poll_controller)(struct net_device *dev);
584#endif 596#endif
597#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
598 int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
599 u16 xid,
600 struct scatterlist *sgl,
601 unsigned int sgc);
602 int (*ndo_fcoe_ddp_done)(struct net_device *dev,
603 u16 xid);
604#endif
585}; 605};
586 606
587/* 607/*
@@ -650,14 +670,17 @@ struct net_device
650#define NETIF_F_GRO 16384 /* Generic receive offload */ 670#define NETIF_F_GRO 16384 /* Generic receive offload */
651#define NETIF_F_LRO 32768 /* large receive offload */ 671#define NETIF_F_LRO 32768 /* large receive offload */
652 672
673#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
674
653 /* Segmentation offload features */ 675 /* Segmentation offload features */
654#define NETIF_F_GSO_SHIFT 16 676#define NETIF_F_GSO_SHIFT 16
655#define NETIF_F_GSO_MASK 0xffff0000 677#define NETIF_F_GSO_MASK 0x00ff0000
656#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) 678#define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
657#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT) 679#define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT)
658#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT) 680#define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT)
659#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT) 681#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT)
660#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) 682#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
683#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
661 684
662 /* List of features with software fallbacks. */ 685 /* List of features with software fallbacks. */
663#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6) 686#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
@@ -740,7 +763,7 @@ struct net_device
740 void *dsa_ptr; /* dsa specific data */ 763 void *dsa_ptr; /* dsa specific data */
741#endif 764#endif
742 void *atalk_ptr; /* AppleTalk link */ 765 void *atalk_ptr; /* AppleTalk link */
743 void *ip_ptr; /* IPv4 specific data */ 766 void *ip_ptr; /* IPv4 specific data */
744 void *dn_ptr; /* DECnet specific data */ 767 void *dn_ptr; /* DECnet specific data */
745 void *ip6_ptr; /* IPv6 specific data */ 768 void *ip6_ptr; /* IPv6 specific data */
746 void *ec_ptr; /* Econet specific data */ 769 void *ec_ptr; /* Econet specific data */
@@ -753,7 +776,7 @@ struct net_device
753 */ 776 */
754 unsigned long last_rx; /* Time of last Rx */ 777 unsigned long last_rx; /* Time of last Rx */
755 /* Interface address info used in eth_type_trans() */ 778 /* Interface address info used in eth_type_trans() */
756 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 779 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
757 because most packets are unicast) */ 780 because most packets are unicast) */
758 781
759 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 782 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
@@ -840,6 +863,11 @@ struct net_device
840 struct dcbnl_rtnl_ops *dcbnl_ops; 863 struct dcbnl_rtnl_ops *dcbnl_ops;
841#endif 864#endif
842 865
866#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
867 /* max exchange id for FCoE LRO by ddp */
868 unsigned int fcoe_ddp_xid;
869#endif
870
843#ifdef CONFIG_COMPAT_NET_DEV_OPS 871#ifdef CONFIG_COMPAT_NET_DEV_OPS
844 struct { 872 struct {
845 int (*init)(struct net_device *dev); 873 int (*init)(struct net_device *dev);
@@ -984,6 +1012,9 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
984void netif_napi_del(struct napi_struct *napi); 1012void netif_napi_del(struct napi_struct *napi);
985 1013
986struct napi_gro_cb { 1014struct napi_gro_cb {
1015 /* This indicates where we are processing relative to skb->data. */
1016 int data_offset;
1017
987 /* This is non-zero if the packet may be of the same flow. */ 1018 /* This is non-zero if the packet may be of the same flow. */
988 int same_flow; 1019 int same_flow;
989 1020
@@ -1079,6 +1110,7 @@ extern void synchronize_net(void);
1079extern int register_netdevice_notifier(struct notifier_block *nb); 1110extern int register_netdevice_notifier(struct notifier_block *nb);
1080extern int unregister_netdevice_notifier(struct notifier_block *nb); 1111extern int unregister_netdevice_notifier(struct notifier_block *nb);
1081extern int init_dummy_netdev(struct net_device *dev); 1112extern int init_dummy_netdev(struct net_device *dev);
1113extern void netdev_resync_ops(struct net_device *dev);
1082 1114
1083extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); 1115extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1084extern struct net_device *dev_get_by_index(struct net *net, int ifindex); 1116extern struct net_device *dev_get_by_index(struct net *net, int ifindex);
@@ -1087,6 +1119,36 @@ extern int dev_restart(struct net_device *dev);
1087#ifdef CONFIG_NETPOLL_TRAP 1119#ifdef CONFIG_NETPOLL_TRAP
1088extern int netpoll_trap(void); 1120extern int netpoll_trap(void);
1089#endif 1121#endif
1122extern void *skb_gro_header(struct sk_buff *skb, unsigned int hlen);
1123extern int skb_gro_receive(struct sk_buff **head,
1124 struct sk_buff *skb);
1125
1126static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1127{
1128 return NAPI_GRO_CB(skb)->data_offset;
1129}
1130
1131static inline unsigned int skb_gro_len(const struct sk_buff *skb)
1132{
1133 return skb->len - NAPI_GRO_CB(skb)->data_offset;
1134}
1135
1136static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
1137{
1138 NAPI_GRO_CB(skb)->data_offset += len;
1139}
1140
1141static inline void skb_gro_reset_offset(struct sk_buff *skb)
1142{
1143 NAPI_GRO_CB(skb)->data_offset = 0;
1144}
1145
1146static inline void *skb_gro_mac_header(struct sk_buff *skb)
1147{
1148 return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) :
1149 page_address(skb_shinfo(skb)->frags[0].page) +
1150 skb_shinfo(skb)->frags[0].page_offset;
1151}
1090 1152
1091static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1153static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
1092 unsigned short type, 1154 unsigned short type,
@@ -1375,12 +1437,15 @@ extern int netif_receive_skb(struct sk_buff *skb);
1375extern void napi_gro_flush(struct napi_struct *napi); 1437extern void napi_gro_flush(struct napi_struct *napi);
1376extern int dev_gro_receive(struct napi_struct *napi, 1438extern int dev_gro_receive(struct napi_struct *napi,
1377 struct sk_buff *skb); 1439 struct sk_buff *skb);
1440extern int napi_skb_finish(int ret, struct sk_buff *skb);
1378extern int napi_gro_receive(struct napi_struct *napi, 1441extern int napi_gro_receive(struct napi_struct *napi,
1379 struct sk_buff *skb); 1442 struct sk_buff *skb);
1380extern void napi_reuse_skb(struct napi_struct *napi, 1443extern void napi_reuse_skb(struct napi_struct *napi,
1381 struct sk_buff *skb); 1444 struct sk_buff *skb);
1382extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, 1445extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
1383 struct napi_gro_fraginfo *info); 1446 struct napi_gro_fraginfo *info);
1447extern int napi_frags_finish(struct napi_struct *napi,
1448 struct sk_buff *skb, int ret);
1384extern int napi_gro_frags(struct napi_struct *napi, 1449extern int napi_gro_frags(struct napi_struct *napi,
1385 struct napi_gro_fraginfo *info); 1450 struct napi_gro_fraginfo *info);
1386extern void netif_nit_deliver(struct sk_buff *skb); 1451extern void netif_nit_deliver(struct sk_buff *skb);
@@ -1574,56 +1639,6 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1574 return (1 << debug_value) - 1; 1639 return (1 << debug_value) - 1;
1575} 1640}
1576 1641
1577/* Test if receive needs to be scheduled but only if up */
1578static inline int netif_rx_schedule_prep(struct napi_struct *napi)
1579{
1580 return napi_schedule_prep(napi);
1581}
1582
1583/* Add interface to tail of rx poll list. This assumes that _prep has
1584 * already been called and returned 1.
1585 */
1586static inline void __netif_rx_schedule(struct napi_struct *napi)
1587{
1588 __napi_schedule(napi);
1589}
1590
1591/* Try to reschedule poll. Called by irq handler. */
1592
1593static inline void netif_rx_schedule(struct napi_struct *napi)
1594{
1595 if (netif_rx_schedule_prep(napi))
1596 __netif_rx_schedule(napi);
1597}
1598
1599/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
1600static inline int netif_rx_reschedule(struct napi_struct *napi)
1601{
1602 if (napi_schedule_prep(napi)) {
1603 __netif_rx_schedule(napi);
1604 return 1;
1605 }
1606 return 0;
1607}
1608
1609/* same as netif_rx_complete, except that local_irq_save(flags)
1610 * has already been issued
1611 */
1612static inline void __netif_rx_complete(struct napi_struct *napi)
1613{
1614 __napi_complete(napi);
1615}
1616
1617/* Remove interface from poll list: it must be in the poll list
1618 * on current cpu. This primitive is called by dev->poll(), when
1619 * it completes the work. The device cannot be out of poll list at this
1620 * moment, it is BUG().
1621 */
1622static inline void netif_rx_complete(struct napi_struct *napi)
1623{
1624 napi_complete(napi);
1625}
1626
1627static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 1642static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
1628{ 1643{
1629 spin_lock(&txq->_xmit_lock); 1644 spin_lock(&txq->_xmit_lock);
@@ -1874,7 +1889,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1874 1889
1875 if (dev->priv_flags & IFF_SLAVE_INACTIVE) { 1890 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1876 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1891 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1877 skb->protocol == __constant_htons(ETH_P_ARP)) 1892 skb->protocol == __cpu_to_be16(ETH_P_ARP))
1878 return 0; 1893 return 0;
1879 1894
1880 if (master->priv_flags & IFF_MASTER_ALB) { 1895 if (master->priv_flags & IFF_MASTER_ALB) {
@@ -1883,7 +1898,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1883 return 0; 1898 return 0;
1884 } 1899 }
1885 if (master->priv_flags & IFF_MASTER_8023AD && 1900 if (master->priv_flags & IFF_MASTER_8023AD &&
1886 skb->protocol == __constant_htons(ETH_P_SLOW)) 1901 skb->protocol == __cpu_to_be16(ETH_P_SLOW))
1887 return 0; 1902 return 0;
1888 1903
1889 return 1; 1904 return 1;
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 5a8af875bce2..af9d2fb97212 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -7,16 +7,21 @@ header-y += xt_CLASSIFY.h
7header-y += xt_CONNMARK.h 7header-y += xt_CONNMARK.h
8header-y += xt_CONNSECMARK.h 8header-y += xt_CONNSECMARK.h
9header-y += xt_DSCP.h 9header-y += xt_DSCP.h
10header-y += xt_LED.h
10header-y += xt_MARK.h 11header-y += xt_MARK.h
11header-y += xt_NFLOG.h 12header-y += xt_NFLOG.h
12header-y += xt_NFQUEUE.h 13header-y += xt_NFQUEUE.h
13header-y += xt_RATEEST.h 14header-y += xt_RATEEST.h
14header-y += xt_SECMARK.h 15header-y += xt_SECMARK.h
15header-y += xt_TCPMSS.h 16header-y += xt_TCPMSS.h
17header-y += xt_TCPOPTSTRIP.h
18header-y += xt_TPROXY.h
16header-y += xt_comment.h 19header-y += xt_comment.h
17header-y += xt_connbytes.h 20header-y += xt_connbytes.h
21header-y += xt_connlimit.h
18header-y += xt_connmark.h 22header-y += xt_connmark.h
19header-y += xt_conntrack.h 23header-y += xt_conntrack.h
24header-y += xt_cluster.h
20header-y += xt_dccp.h 25header-y += xt_dccp.h
21header-y += xt_dscp.h 26header-y += xt_dscp.h
22header-y += xt_esp.h 27header-y += xt_esp.h
@@ -30,6 +35,7 @@ header-y += xt_mark.h
30header-y += xt_multiport.h 35header-y += xt_multiport.h
31header-y += xt_owner.h 36header-y += xt_owner.h
32header-y += xt_pkttype.h 37header-y += xt_pkttype.h
38header-y += xt_quota.h
33header-y += xt_rateest.h 39header-y += xt_rateest.h
34header-y += xt_realm.h 40header-y += xt_realm.h
35header-y += xt_recent.h 41header-y += xt_recent.h
@@ -39,6 +45,8 @@ header-y += xt_statistic.h
39header-y += xt_string.h 45header-y += xt_string.h
40header-y += xt_tcpmss.h 46header-y += xt_tcpmss.h
41header-y += xt_tcpudp.h 47header-y += xt_tcpudp.h
48header-y += xt_time.h
49header-y += xt_u32.h
42 50
43unifdef-y += nf_conntrack_common.h 51unifdef-y += nf_conntrack_common.h
44unifdef-y += nf_conntrack_ftp.h 52unifdef-y += nf_conntrack_ftp.h
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index a049df4f2236..3066789b972a 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -2,6 +2,8 @@
2#define _NF_CONNTRACK_TCP_H 2#define _NF_CONNTRACK_TCP_H
3/* TCP tracking. */ 3/* TCP tracking. */
4 4
5#include <linux/types.h>
6
5/* This is exposed to userspace (ctnetlink) */ 7/* This is exposed to userspace (ctnetlink) */
6enum tcp_conntrack { 8enum tcp_conntrack {
7 TCP_CONNTRACK_NONE, 9 TCP_CONNTRACK_NONE,
@@ -34,8 +36,8 @@ enum tcp_conntrack {
34#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10 36#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10
35 37
36struct nf_ct_tcp_flags { 38struct nf_ct_tcp_flags {
37 u_int8_t flags; 39 __u8 flags;
38 u_int8_t mask; 40 __u8 mask;
39}; 41};
40 42
41#ifdef __KERNEL__ 43#ifdef __KERNEL__
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 7d8e0455ccac..c600083cbdf5 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -25,8 +25,8 @@ enum nfnetlink_groups {
25/* General form of address family dependent message. 25/* General form of address family dependent message.
26 */ 26 */
27struct nfgenmsg { 27struct nfgenmsg {
28 u_int8_t nfgen_family; /* AF_xxx */ 28 __u8 nfgen_family; /* AF_xxx */
29 u_int8_t version; /* nfnetlink version */ 29 __u8 version; /* nfnetlink version */
30 __be16 res_id; /* resource id */ 30 __be16 res_id; /* resource id */
31}; 31};
32 32
@@ -76,6 +76,7 @@ extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
76extern int nfnetlink_has_listeners(unsigned int group); 76extern int nfnetlink_has_listeners(unsigned int group);
77extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, 77extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
78 int echo); 78 int echo);
79extern void nfnetlink_set_err(u32 pid, u32 group, int error);
79extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); 80extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
80 81
81extern void nfnl_lock(void); 82extern void nfnl_lock(void);
diff --git a/include/linux/netfilter/nfnetlink_compat.h b/include/linux/netfilter/nfnetlink_compat.h
index e1451760c9cd..eda55cabceec 100644
--- a/include/linux/netfilter/nfnetlink_compat.h
+++ b/include/linux/netfilter/nfnetlink_compat.h
@@ -1,5 +1,8 @@
1#ifndef _NFNETLINK_COMPAT_H 1#ifndef _NFNETLINK_COMPAT_H
2#define _NFNETLINK_COMPAT_H 2#define _NFNETLINK_COMPAT_H
3
4#include <linux/types.h>
5
3#ifndef __KERNEL__ 6#ifndef __KERNEL__
4/* Old nfnetlink macros for userspace */ 7/* Old nfnetlink macros for userspace */
5 8
@@ -20,8 +23,8 @@
20 23
21struct nfattr 24struct nfattr
22{ 25{
23 u_int16_t nfa_len; 26 __u16 nfa_len;
24 u_int16_t nfa_type; /* we use 15 bits for the type, and the highest 27 __u16 nfa_type; /* we use 15 bits for the type, and the highest
25 * bit to indicate whether the payload is nested */ 28 * bit to indicate whether the payload is nested */
26}; 29};
27 30
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 29fe9ea1d346..1a865e48b8eb 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -100,6 +100,7 @@ enum ctattr_protoinfo_tcp {
100enum ctattr_protoinfo_dccp { 100enum ctattr_protoinfo_dccp {
101 CTA_PROTOINFO_DCCP_UNSPEC, 101 CTA_PROTOINFO_DCCP_UNSPEC,
102 CTA_PROTOINFO_DCCP_STATE, 102 CTA_PROTOINFO_DCCP_STATE,
103 CTA_PROTOINFO_DCCP_ROLE,
103 __CTA_PROTOINFO_DCCP_MAX, 104 __CTA_PROTOINFO_DCCP_MAX,
104}; 105};
105#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) 106#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index f661731f3cb1..d3bab7a2c9b7 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -17,14 +17,14 @@ enum nfulnl_msg_types {
17 17
18struct nfulnl_msg_packet_hdr { 18struct nfulnl_msg_packet_hdr {
19 __be16 hw_protocol; /* hw protocol (network order) */ 19 __be16 hw_protocol; /* hw protocol (network order) */
20 u_int8_t hook; /* netfilter hook */ 20 __u8 hook; /* netfilter hook */
21 u_int8_t _pad; 21 __u8 _pad;
22}; 22};
23 23
24struct nfulnl_msg_packet_hw { 24struct nfulnl_msg_packet_hw {
25 __be16 hw_addrlen; 25 __be16 hw_addrlen;
26 u_int16_t _pad; 26 __u16 _pad;
27 u_int8_t hw_addr[8]; 27 __u8 hw_addr[8];
28}; 28};
29 29
30struct nfulnl_msg_packet_timestamp { 30struct nfulnl_msg_packet_timestamp {
@@ -35,12 +35,12 @@ struct nfulnl_msg_packet_timestamp {
35enum nfulnl_attr_type { 35enum nfulnl_attr_type {
36 NFULA_UNSPEC, 36 NFULA_UNSPEC,
37 NFULA_PACKET_HDR, 37 NFULA_PACKET_HDR,
38 NFULA_MARK, /* u_int32_t nfmark */ 38 NFULA_MARK, /* __u32 nfmark */
39 NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */ 39 NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */
40 NFULA_IFINDEX_INDEV, /* u_int32_t ifindex */ 40 NFULA_IFINDEX_INDEV, /* __u32 ifindex */
41 NFULA_IFINDEX_OUTDEV, /* u_int32_t ifindex */ 41 NFULA_IFINDEX_OUTDEV, /* __u32 ifindex */
42 NFULA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */ 42 NFULA_IFINDEX_PHYSINDEV, /* __u32 ifindex */
43 NFULA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */ 43 NFULA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */
44 NFULA_HWADDR, /* nfulnl_msg_packet_hw */ 44 NFULA_HWADDR, /* nfulnl_msg_packet_hw */
45 NFULA_PAYLOAD, /* opaque data payload */ 45 NFULA_PAYLOAD, /* opaque data payload */
46 NFULA_PREFIX, /* string prefix */ 46 NFULA_PREFIX, /* string prefix */
@@ -65,23 +65,23 @@ enum nfulnl_msg_config_cmds {
65}; 65};
66 66
67struct nfulnl_msg_config_cmd { 67struct nfulnl_msg_config_cmd {
68 u_int8_t command; /* nfulnl_msg_config_cmds */ 68 __u8 command; /* nfulnl_msg_config_cmds */
69} __attribute__ ((packed)); 69} __attribute__ ((packed));
70 70
71struct nfulnl_msg_config_mode { 71struct nfulnl_msg_config_mode {
72 __be32 copy_range; 72 __be32 copy_range;
73 u_int8_t copy_mode; 73 __u8 copy_mode;
74 u_int8_t _pad; 74 __u8 _pad;
75} __attribute__ ((packed)); 75} __attribute__ ((packed));
76 76
77enum nfulnl_attr_config { 77enum nfulnl_attr_config {
78 NFULA_CFG_UNSPEC, 78 NFULA_CFG_UNSPEC,
79 NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */ 79 NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */
80 NFULA_CFG_MODE, /* nfulnl_msg_config_mode */ 80 NFULA_CFG_MODE, /* nfulnl_msg_config_mode */
81 NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */ 81 NFULA_CFG_NLBUFSIZ, /* __u32 buffer size */
82 NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */ 82 NFULA_CFG_TIMEOUT, /* __u32 in 1/100 s */
83 NFULA_CFG_QTHRESH, /* u_int32_t */ 83 NFULA_CFG_QTHRESH, /* __u32 */
84 NFULA_CFG_FLAGS, /* u_int16_t */ 84 NFULA_CFG_FLAGS, /* __u16 */
85 __NFULA_CFG_MAX 85 __NFULA_CFG_MAX
86}; 86};
87#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1) 87#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index 83e789633e35..2455fe5f4e01 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -15,13 +15,13 @@ enum nfqnl_msg_types {
15struct nfqnl_msg_packet_hdr { 15struct nfqnl_msg_packet_hdr {
16 __be32 packet_id; /* unique ID of packet in queue */ 16 __be32 packet_id; /* unique ID of packet in queue */
17 __be16 hw_protocol; /* hw protocol (network order) */ 17 __be16 hw_protocol; /* hw protocol (network order) */
18 u_int8_t hook; /* netfilter hook */ 18 __u8 hook; /* netfilter hook */
19} __attribute__ ((packed)); 19} __attribute__ ((packed));
20 20
21struct nfqnl_msg_packet_hw { 21struct nfqnl_msg_packet_hw {
22 __be16 hw_addrlen; 22 __be16 hw_addrlen;
23 u_int16_t _pad; 23 __u16 _pad;
24 u_int8_t hw_addr[8]; 24 __u8 hw_addr[8];
25}; 25};
26 26
27struct nfqnl_msg_packet_timestamp { 27struct nfqnl_msg_packet_timestamp {
@@ -33,12 +33,12 @@ enum nfqnl_attr_type {
33 NFQA_UNSPEC, 33 NFQA_UNSPEC,
34 NFQA_PACKET_HDR, 34 NFQA_PACKET_HDR,
35 NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */ 35 NFQA_VERDICT_HDR, /* nfqnl_msg_verdict_hrd */
36 NFQA_MARK, /* u_int32_t nfmark */ 36 NFQA_MARK, /* __u32 nfmark */
37 NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */ 37 NFQA_TIMESTAMP, /* nfqnl_msg_packet_timestamp */
38 NFQA_IFINDEX_INDEV, /* u_int32_t ifindex */ 38 NFQA_IFINDEX_INDEV, /* __u32 ifindex */
39 NFQA_IFINDEX_OUTDEV, /* u_int32_t ifindex */ 39 NFQA_IFINDEX_OUTDEV, /* __u32 ifindex */
40 NFQA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */ 40 NFQA_IFINDEX_PHYSINDEV, /* __u32 ifindex */
41 NFQA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */ 41 NFQA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */
42 NFQA_HWADDR, /* nfqnl_msg_packet_hw */ 42 NFQA_HWADDR, /* nfqnl_msg_packet_hw */
43 NFQA_PAYLOAD, /* opaque data payload */ 43 NFQA_PAYLOAD, /* opaque data payload */
44 44
@@ -61,8 +61,8 @@ enum nfqnl_msg_config_cmds {
61}; 61};
62 62
63struct nfqnl_msg_config_cmd { 63struct nfqnl_msg_config_cmd {
64 u_int8_t command; /* nfqnl_msg_config_cmds */ 64 __u8 command; /* nfqnl_msg_config_cmds */
65 u_int8_t _pad; 65 __u8 _pad;
66 __be16 pf; /* AF_xxx for PF_[UN]BIND */ 66 __be16 pf; /* AF_xxx for PF_[UN]BIND */
67}; 67};
68 68
@@ -74,7 +74,7 @@ enum nfqnl_config_mode {
74 74
75struct nfqnl_msg_config_params { 75struct nfqnl_msg_config_params {
76 __be32 copy_range; 76 __be32 copy_range;
77 u_int8_t copy_mode; /* enum nfqnl_config_mode */ 77 __u8 copy_mode; /* enum nfqnl_config_mode */
78} __attribute__ ((packed)); 78} __attribute__ ((packed));
79 79
80 80
@@ -82,7 +82,7 @@ enum nfqnl_attr_config {
82 NFQA_CFG_UNSPEC, 82 NFQA_CFG_UNSPEC,
83 NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ 83 NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */
84 NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ 84 NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */
85 NFQA_CFG_QUEUE_MAXLEN, /* u_int32_t */ 85 NFQA_CFG_QUEUE_MAXLEN, /* __u32 */
86 __NFQA_CFG_MAX 86 __NFQA_CFG_MAX
87}; 87};
88#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) 88#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index c7ee8744d26b..c9efe039dc57 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -1,6 +1,8 @@
1#ifndef _X_TABLES_H 1#ifndef _X_TABLES_H
2#define _X_TABLES_H 2#define _X_TABLES_H
3 3
4#include <linux/types.h>
5
4#define XT_FUNCTION_MAXNAMELEN 30 6#define XT_FUNCTION_MAXNAMELEN 30
5#define XT_TABLE_MAXNAMELEN 32 7#define XT_TABLE_MAXNAMELEN 32
6 8
@@ -8,22 +10,22 @@ struct xt_entry_match
8{ 10{
9 union { 11 union {
10 struct { 12 struct {
11 u_int16_t match_size; 13 __u16 match_size;
12 14
13 /* Used by userspace */ 15 /* Used by userspace */
14 char name[XT_FUNCTION_MAXNAMELEN-1]; 16 char name[XT_FUNCTION_MAXNAMELEN-1];
15 17
16 u_int8_t revision; 18 __u8 revision;
17 } user; 19 } user;
18 struct { 20 struct {
19 u_int16_t match_size; 21 __u16 match_size;
20 22
21 /* Used inside the kernel */ 23 /* Used inside the kernel */
22 struct xt_match *match; 24 struct xt_match *match;
23 } kernel; 25 } kernel;
24 26
25 /* Total length */ 27 /* Total length */
26 u_int16_t match_size; 28 __u16 match_size;
27 } u; 29 } u;
28 30
29 unsigned char data[0]; 31 unsigned char data[0];
@@ -33,22 +35,22 @@ struct xt_entry_target
33{ 35{
34 union { 36 union {
35 struct { 37 struct {
36 u_int16_t target_size; 38 __u16 target_size;
37 39
38 /* Used by userspace */ 40 /* Used by userspace */
39 char name[XT_FUNCTION_MAXNAMELEN-1]; 41 char name[XT_FUNCTION_MAXNAMELEN-1];
40 42
41 u_int8_t revision; 43 __u8 revision;
42 } user; 44 } user;
43 struct { 45 struct {
44 u_int16_t target_size; 46 __u16 target_size;
45 47
46 /* Used inside the kernel */ 48 /* Used inside the kernel */
47 struct xt_target *target; 49 struct xt_target *target;
48 } kernel; 50 } kernel;
49 51
50 /* Total length */ 52 /* Total length */
51 u_int16_t target_size; 53 __u16 target_size;
52 } u; 54 } u;
53 55
54 unsigned char data[0]; 56 unsigned char data[0];
@@ -74,7 +76,7 @@ struct xt_get_revision
74{ 76{
75 char name[XT_FUNCTION_MAXNAMELEN-1]; 77 char name[XT_FUNCTION_MAXNAMELEN-1];
76 78
77 u_int8_t revision; 79 __u8 revision;
78}; 80};
79 81
80/* CONTINUE verdict for targets */ 82/* CONTINUE verdict for targets */
@@ -90,10 +92,10 @@ struct xt_get_revision
90 */ 92 */
91struct _xt_align 93struct _xt_align
92{ 94{
93 u_int8_t u8; 95 __u8 u8;
94 u_int16_t u16; 96 __u16 u16;
95 u_int32_t u32; 97 __u32 u32;
96 u_int64_t u64; 98 __u64 u64;
97}; 99};
98 100
99#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \ 101#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) \
@@ -109,7 +111,7 @@ struct _xt_align
109 111
110struct xt_counters 112struct xt_counters
111{ 113{
112 u_int64_t pcnt, bcnt; /* Packet and byte counters */ 114 __u64 pcnt, bcnt; /* Packet and byte counters */
113}; 115};
114 116
115/* The argument to IPT_SO_ADD_COUNTERS. */ 117/* The argument to IPT_SO_ADD_COUNTERS. */
@@ -349,23 +351,19 @@ struct xt_table
349{ 351{
350 struct list_head list; 352 struct list_head list;
351 353
352 /* A unique name... */
353 const char name[XT_TABLE_MAXNAMELEN];
354
355 /* What hooks you will enter on */ 354 /* What hooks you will enter on */
356 unsigned int valid_hooks; 355 unsigned int valid_hooks;
357 356
358 /* Lock for the curtain */
359 rwlock_t lock;
360
361 /* Man behind the curtain... */ 357 /* Man behind the curtain... */
362 //struct ip6t_table_info *private; 358 struct xt_table_info *private;
363 void *private;
364 359
365 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 360 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
366 struct module *me; 361 struct module *me;
367 362
368 u_int8_t af; /* address/protocol family */ 363 u_int8_t af; /* address/protocol family */
364
365 /* A unique name... */
366 const char name[XT_TABLE_MAXNAMELEN];
369}; 367};
370 368
371#include <linux/netfilter_ipv4.h> 369#include <linux/netfilter_ipv4.h>
@@ -386,7 +384,7 @@ struct xt_table_info
386 384
387 /* ipt_entry tables: one per CPU */ 385 /* ipt_entry tables: one per CPU */
388 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */ 386 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */
389 char *entries[1]; 387 void *entries[1];
390}; 388};
391 389
392#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \ 390#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
@@ -434,6 +432,97 @@ extern void xt_proto_fini(struct net *net, u_int8_t af);
434extern struct xt_table_info *xt_alloc_table_info(unsigned int size); 432extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
435extern void xt_free_table_info(struct xt_table_info *info); 433extern void xt_free_table_info(struct xt_table_info *info);
436 434
435/*
436 * Per-CPU spinlock associated with per-cpu table entries, and
437 * with a counter for the "reading" side that allows a recursive
438 * reader to avoid taking the lock and deadlocking.
439 *
440 * "reading" is used by ip/arp/ip6 tables rule processing which runs per-cpu.
441 * It needs to ensure that the rules are not being changed while the packet
442 * is being processed. In some cases, the read lock will be acquired
443 * twice on the same CPU; this is okay because of the count.
444 *
445 * "writing" is used when reading counters.
446 * During replace any readers that are using the old tables have to complete
447 * before freeing the old table. This is handled by the write locking
448 * necessary for reading the counters.
449 */
450struct xt_info_lock {
451 spinlock_t lock;
452 unsigned char readers;
453};
454DECLARE_PER_CPU(struct xt_info_lock, xt_info_locks);
455
456/*
457 * Note: we need to ensure that preemption is disabled before acquiring
458 * the per-cpu-variable, so we do it as a two step process rather than
459 * using "spin_lock_bh()".
460 *
461 * We _also_ need to disable bottom half processing before updating our
462 * nesting count, to make sure that the only kind of re-entrancy is this
463 * code being called by itself: since the count+lock is not an atomic
464 * operation, we can allow no races.
465 *
466 * _Only_ that special combination of being per-cpu and never getting
467 * re-entered asynchronously means that the count is safe.
468 */
469static inline void xt_info_rdlock_bh(void)
470{
471 struct xt_info_lock *lock;
472
473 local_bh_disable();
474 lock = &__get_cpu_var(xt_info_locks);
475 if (likely(!lock->readers++))
476 spin_lock(&lock->lock);
477}
478
479static inline void xt_info_rdunlock_bh(void)
480{
481 struct xt_info_lock *lock = &__get_cpu_var(xt_info_locks);
482
483 if (likely(!--lock->readers))
484 spin_unlock(&lock->lock);
485 local_bh_enable();
486}
487
488/*
489 * The "writer" side needs to get exclusive access to the lock,
490 * regardless of readers. This must be called with bottom half
491 * processing (and thus also preemption) disabled.
492 */
493static inline void xt_info_wrlock(unsigned int cpu)
494{
495 spin_lock(&per_cpu(xt_info_locks, cpu).lock);
496}
497
498static inline void xt_info_wrunlock(unsigned int cpu)
499{
500 spin_unlock(&per_cpu(xt_info_locks, cpu).lock);
501}
502
503/*
504 * This helper is performance critical and must be inlined
505 */
506static inline unsigned long ifname_compare_aligned(const char *_a,
507 const char *_b,
508 const char *_mask)
509{
510 const unsigned long *a = (const unsigned long *)_a;
511 const unsigned long *b = (const unsigned long *)_b;
512 const unsigned long *mask = (const unsigned long *)_mask;
513 unsigned long ret;
514
515 ret = (a[0] ^ b[0]) & mask[0];
516 if (IFNAMSIZ > sizeof(unsigned long))
517 ret |= (a[1] ^ b[1]) & mask[1];
518 if (IFNAMSIZ > 2 * sizeof(unsigned long))
519 ret |= (a[2] ^ b[2]) & mask[2];
520 if (IFNAMSIZ > 3 * sizeof(unsigned long))
521 ret |= (a[3] ^ b[3]) & mask[3];
522 BUILD_BUG_ON(IFNAMSIZ > 4 * sizeof(unsigned long));
523 return ret;
524}
525
437#ifdef CONFIG_COMPAT 526#ifdef CONFIG_COMPAT
438#include <net/compat.h> 527#include <net/compat.h>
439 528
diff --git a/include/linux/netfilter/xt_CLASSIFY.h b/include/linux/netfilter/xt_CLASSIFY.h
index 58111355255d..a813bf14dd63 100644
--- a/include/linux/netfilter/xt_CLASSIFY.h
+++ b/include/linux/netfilter/xt_CLASSIFY.h
@@ -1,8 +1,10 @@
1#ifndef _XT_CLASSIFY_H 1#ifndef _XT_CLASSIFY_H
2#define _XT_CLASSIFY_H 2#define _XT_CLASSIFY_H
3 3
4#include <linux/types.h>
5
4struct xt_classify_target_info { 6struct xt_classify_target_info {
5 u_int32_t priority; 7 __u32 priority;
6}; 8};
7 9
8#endif /*_XT_CLASSIFY_H */ 10#endif /*_XT_CLASSIFY_H */
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
index 4e58ba43c289..7635c8ffdadb 100644
--- a/include/linux/netfilter/xt_CONNMARK.h
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -1,6 +1,8 @@
1#ifndef _XT_CONNMARK_H_target 1#ifndef _XT_CONNMARK_H_target
2#define _XT_CONNMARK_H_target 2#define _XT_CONNMARK_H_target
3 3
4#include <linux/types.h>
5
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com> 6/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com> 7 * by Henrik Nordstrom <hno@marasystems.com>
6 * 8 *
@@ -19,12 +21,12 @@ enum {
19struct xt_connmark_target_info { 21struct xt_connmark_target_info {
20 unsigned long mark; 22 unsigned long mark;
21 unsigned long mask; 23 unsigned long mask;
22 u_int8_t mode; 24 __u8 mode;
23}; 25};
24 26
25struct xt_connmark_tginfo1 { 27struct xt_connmark_tginfo1 {
26 u_int32_t ctmark, ctmask, nfmask; 28 __u32 ctmark, ctmask, nfmask;
27 u_int8_t mode; 29 __u8 mode;
28}; 30};
29 31
30#endif /*_XT_CONNMARK_H_target*/ 32#endif /*_XT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter/xt_CONNSECMARK.h b/include/linux/netfilter/xt_CONNSECMARK.h
index c6bd75469ba2..b973ff80fa1e 100644
--- a/include/linux/netfilter/xt_CONNSECMARK.h
+++ b/include/linux/netfilter/xt_CONNSECMARK.h
@@ -1,13 +1,15 @@
1#ifndef _XT_CONNSECMARK_H_target 1#ifndef _XT_CONNSECMARK_H_target
2#define _XT_CONNSECMARK_H_target 2#define _XT_CONNSECMARK_H_target
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 CONNSECMARK_SAVE = 1, 7 CONNSECMARK_SAVE = 1,
6 CONNSECMARK_RESTORE, 8 CONNSECMARK_RESTORE,
7}; 9};
8 10
9struct xt_connsecmark_target_info { 11struct xt_connsecmark_target_info {
10 u_int8_t mode; 12 __u8 mode;
11}; 13};
12 14
13#endif /*_XT_CONNSECMARK_H_target */ 15#endif /*_XT_CONNSECMARK_H_target */
diff --git a/include/linux/netfilter/xt_DSCP.h b/include/linux/netfilter/xt_DSCP.h
index 14da1968e2c6..648e0b3bed29 100644
--- a/include/linux/netfilter/xt_DSCP.h
+++ b/include/linux/netfilter/xt_DSCP.h
@@ -11,15 +11,16 @@
11#ifndef _XT_DSCP_TARGET_H 11#ifndef _XT_DSCP_TARGET_H
12#define _XT_DSCP_TARGET_H 12#define _XT_DSCP_TARGET_H
13#include <linux/netfilter/xt_dscp.h> 13#include <linux/netfilter/xt_dscp.h>
14#include <linux/types.h>
14 15
15/* target info */ 16/* target info */
16struct xt_DSCP_info { 17struct xt_DSCP_info {
17 u_int8_t dscp; 18 __u8 dscp;
18}; 19};
19 20
20struct xt_tos_target_info { 21struct xt_tos_target_info {
21 u_int8_t tos_value; 22 __u8 tos_value;
22 u_int8_t tos_mask; 23 __u8 tos_mask;
23}; 24};
24 25
25#endif /* _XT_DSCP_TARGET_H */ 26#endif /* _XT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter/xt_LED.h b/include/linux/netfilter/xt_LED.h
new file mode 100644
index 000000000000..4c91a0d770d0
--- /dev/null
+++ b/include/linux/netfilter/xt_LED.h
@@ -0,0 +1,13 @@
1#ifndef _XT_LED_H
2#define _XT_LED_H
3
4struct xt_led_info {
5 char id[27]; /* Unique ID for this trigger in the LED class */
6 __u8 always_blink; /* Blink even if the LED is already on */
7 __u32 delay; /* Delay until LED is switched off after trigger */
8
9 /* Kernel data used in the module */
10 void *internal_data __attribute__((aligned(8)));
11};
12
13#endif /* _XT_LED_H */
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
index 778b278fd9f2..028304bcc0b1 100644
--- a/include/linux/netfilter/xt_MARK.h
+++ b/include/linux/netfilter/xt_MARK.h
@@ -1,6 +1,8 @@
1#ifndef _XT_MARK_H_target 1#ifndef _XT_MARK_H_target
2#define _XT_MARK_H_target 2#define _XT_MARK_H_target
3 3
4#include <linux/types.h>
5
4/* Version 0 */ 6/* Version 0 */
5struct xt_mark_target_info { 7struct xt_mark_target_info {
6 unsigned long mark; 8 unsigned long mark;
@@ -15,11 +17,11 @@ enum {
15 17
16struct xt_mark_target_info_v1 { 18struct xt_mark_target_info_v1 {
17 unsigned long mark; 19 unsigned long mark;
18 u_int8_t mode; 20 __u8 mode;
19}; 21};
20 22
21struct xt_mark_tginfo2 { 23struct xt_mark_tginfo2 {
22 u_int32_t mark, mask; 24 __u32 mark, mask;
23}; 25};
24 26
25#endif /*_XT_MARK_H_target */ 27#endif /*_XT_MARK_H_target */
diff --git a/include/linux/netfilter/xt_NFLOG.h b/include/linux/netfilter/xt_NFLOG.h
index 4b36aeb46a10..87b58311ce6b 100644
--- a/include/linux/netfilter/xt_NFLOG.h
+++ b/include/linux/netfilter/xt_NFLOG.h
@@ -1,17 +1,19 @@
1#ifndef _XT_NFLOG_TARGET 1#ifndef _XT_NFLOG_TARGET
2#define _XT_NFLOG_TARGET 2#define _XT_NFLOG_TARGET
3 3
4#include <linux/types.h>
5
4#define XT_NFLOG_DEFAULT_GROUP 0x1 6#define XT_NFLOG_DEFAULT_GROUP 0x1
5#define XT_NFLOG_DEFAULT_THRESHOLD 0 7#define XT_NFLOG_DEFAULT_THRESHOLD 0
6 8
7#define XT_NFLOG_MASK 0x0 9#define XT_NFLOG_MASK 0x0
8 10
9struct xt_nflog_info { 11struct xt_nflog_info {
10 u_int32_t len; 12 __u32 len;
11 u_int16_t group; 13 __u16 group;
12 u_int16_t threshold; 14 __u16 threshold;
13 u_int16_t flags; 15 __u16 flags;
14 u_int16_t pad; 16 __u16 pad;
15 char prefix[64]; 17 char prefix[64];
16}; 18};
17 19
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h
index 9a9af79f74d2..982a89f78272 100644
--- a/include/linux/netfilter/xt_NFQUEUE.h
+++ b/include/linux/netfilter/xt_NFQUEUE.h
@@ -8,9 +8,11 @@
8#ifndef _XT_NFQ_TARGET_H 8#ifndef _XT_NFQ_TARGET_H
9#define _XT_NFQ_TARGET_H 9#define _XT_NFQ_TARGET_H
10 10
11#include <linux/types.h>
12
11/* target info */ 13/* target info */
12struct xt_NFQ_info { 14struct xt_NFQ_info {
13 u_int16_t queuenum; 15 __u16 queuenum;
14}; 16};
15 17
16#endif /* _XT_NFQ_TARGET_H */ 18#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/linux/netfilter/xt_RATEEST.h b/include/linux/netfilter/xt_RATEEST.h
index f79e3133cbea..6605e20ad8cf 100644
--- a/include/linux/netfilter/xt_RATEEST.h
+++ b/include/linux/netfilter/xt_RATEEST.h
@@ -1,10 +1,12 @@
1#ifndef _XT_RATEEST_TARGET_H 1#ifndef _XT_RATEEST_TARGET_H
2#define _XT_RATEEST_TARGET_H 2#define _XT_RATEEST_TARGET_H
3 3
4#include <linux/types.h>
5
4struct xt_rateest_target_info { 6struct xt_rateest_target_info {
5 char name[IFNAMSIZ]; 7 char name[IFNAMSIZ];
6 int8_t interval; 8 __s8 interval;
7 u_int8_t ewma_log; 9 __u8 ewma_log;
8 10
9 /* Used internally by the kernel */ 11 /* Used internally by the kernel */
10 struct xt_rateest *est __attribute__((aligned(8))); 12 struct xt_rateest *est __attribute__((aligned(8)));
diff --git a/include/linux/netfilter/xt_SECMARK.h b/include/linux/netfilter/xt_SECMARK.h
index c53fbffa997d..6fcd3448b186 100644
--- a/include/linux/netfilter/xt_SECMARK.h
+++ b/include/linux/netfilter/xt_SECMARK.h
@@ -1,6 +1,8 @@
1#ifndef _XT_SECMARK_H_target 1#ifndef _XT_SECMARK_H_target
2#define _XT_SECMARK_H_target 2#define _XT_SECMARK_H_target
3 3
4#include <linux/types.h>
5
4/* 6/*
5 * This is intended for use by various security subsystems (but not 7 * This is intended for use by various security subsystems (but not
6 * at the same time). 8 * at the same time).
@@ -12,12 +14,12 @@
12#define SECMARK_SELCTX_MAX 256 14#define SECMARK_SELCTX_MAX 256
13 15
14struct xt_secmark_target_selinux_info { 16struct xt_secmark_target_selinux_info {
15 u_int32_t selsid; 17 __u32 selsid;
16 char selctx[SECMARK_SELCTX_MAX]; 18 char selctx[SECMARK_SELCTX_MAX];
17}; 19};
18 20
19struct xt_secmark_target_info { 21struct xt_secmark_target_info {
20 u_int8_t mode; 22 __u8 mode;
21 union { 23 union {
22 struct xt_secmark_target_selinux_info sel; 24 struct xt_secmark_target_selinux_info sel;
23 } u; 25 } u;
diff --git a/include/linux/netfilter/xt_TCPMSS.h b/include/linux/netfilter/xt_TCPMSS.h
index 53a292cd47f3..9a6960afc134 100644
--- a/include/linux/netfilter/xt_TCPMSS.h
+++ b/include/linux/netfilter/xt_TCPMSS.h
@@ -1,8 +1,10 @@
1#ifndef _XT_TCPMSS_H 1#ifndef _XT_TCPMSS_H
2#define _XT_TCPMSS_H 2#define _XT_TCPMSS_H
3 3
4#include <linux/types.h>
5
4struct xt_tcpmss_info { 6struct xt_tcpmss_info {
5 u_int16_t mss; 7 __u16 mss;
6}; 8};
7 9
8#define XT_TCPMSS_CLAMP_PMTU 0xffff 10#define XT_TCPMSS_CLAMP_PMTU 0xffff
diff --git a/include/linux/netfilter/xt_cluster.h b/include/linux/netfilter/xt_cluster.h
new file mode 100644
index 000000000000..5e0a0d07b526
--- /dev/null
+++ b/include/linux/netfilter/xt_cluster.h
@@ -0,0 +1,15 @@
1#ifndef _XT_CLUSTER_MATCH_H
2#define _XT_CLUSTER_MATCH_H
3
4enum xt_cluster_flags {
5 XT_CLUSTER_F_INV = (1 << 0)
6};
7
8struct xt_cluster_match_info {
9 u_int32_t total_nodes;
10 u_int32_t node_mask;
11 u_int32_t hash_seed;
12 u_int32_t flags;
13};
14
15#endif /* _XT_CLUSTER_MATCH_H */
diff --git a/include/linux/netfilter/xt_connbytes.h b/include/linux/netfilter/xt_connbytes.h
index c022c989754d..52bd6153b996 100644
--- a/include/linux/netfilter/xt_connbytes.h
+++ b/include/linux/netfilter/xt_connbytes.h
@@ -1,6 +1,8 @@
1#ifndef _XT_CONNBYTES_H 1#ifndef _XT_CONNBYTES_H
2#define _XT_CONNBYTES_H 2#define _XT_CONNBYTES_H
3 3
4#include <linux/types.h>
5
4enum xt_connbytes_what { 6enum xt_connbytes_what {
5 XT_CONNBYTES_PKTS, 7 XT_CONNBYTES_PKTS,
6 XT_CONNBYTES_BYTES, 8 XT_CONNBYTES_BYTES,
@@ -19,7 +21,7 @@ struct xt_connbytes_info
19 aligned_u64 from; /* count to be matched */ 21 aligned_u64 from; /* count to be matched */
20 aligned_u64 to; /* count to be matched */ 22 aligned_u64 to; /* count to be matched */
21 } count; 23 } count;
22 u_int8_t what; /* ipt_connbytes_what */ 24 __u8 what; /* ipt_connbytes_what */
23 u_int8_t direction; /* ipt_connbytes_direction */ 25 __u8 direction; /* ipt_connbytes_direction */
24}; 26};
25#endif 27#endif
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
index 359ef86918dc..571e266d004c 100644
--- a/include/linux/netfilter/xt_connmark.h
+++ b/include/linux/netfilter/xt_connmark.h
@@ -1,6 +1,8 @@
1#ifndef _XT_CONNMARK_H 1#ifndef _XT_CONNMARK_H
2#define _XT_CONNMARK_H 2#define _XT_CONNMARK_H
3 3
4#include <linux/types.h>
5
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com> 6/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com> 7 * by Henrik Nordstrom <hno@marasystems.com>
6 * 8 *
@@ -12,12 +14,12 @@
12 14
13struct xt_connmark_info { 15struct xt_connmark_info {
14 unsigned long mark, mask; 16 unsigned long mark, mask;
15 u_int8_t invert; 17 __u8 invert;
16}; 18};
17 19
18struct xt_connmark_mtinfo1 { 20struct xt_connmark_mtinfo1 {
19 u_int32_t mark, mask; 21 __u32 mark, mask;
20 u_int8_t invert; 22 __u8 invert;
21}; 23};
22 24
23#endif /*_XT_CONNMARK_H*/ 25#endif /*_XT_CONNMARK_H*/
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 8f5345275393..3430c7751948 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -63,9 +63,9 @@ struct xt_conntrack_info
63 unsigned long expires_min, expires_max; 63 unsigned long expires_min, expires_max;
64 64
65 /* Flags word */ 65 /* Flags word */
66 u_int8_t flags; 66 __u8 flags;
67 /* Inverse flags */ 67 /* Inverse flags */
68 u_int8_t invflags; 68 __u8 invflags;
69}; 69};
70 70
71struct xt_conntrack_mtinfo1 { 71struct xt_conntrack_mtinfo1 {
@@ -73,12 +73,12 @@ struct xt_conntrack_mtinfo1 {
73 union nf_inet_addr origdst_addr, origdst_mask; 73 union nf_inet_addr origdst_addr, origdst_mask;
74 union nf_inet_addr replsrc_addr, replsrc_mask; 74 union nf_inet_addr replsrc_addr, replsrc_mask;
75 union nf_inet_addr repldst_addr, repldst_mask; 75 union nf_inet_addr repldst_addr, repldst_mask;
76 u_int32_t expires_min, expires_max; 76 __u32 expires_min, expires_max;
77 u_int16_t l4proto; 77 __u16 l4proto;
78 __be16 origsrc_port, origdst_port; 78 __be16 origsrc_port, origdst_port;
79 __be16 replsrc_port, repldst_port; 79 __be16 replsrc_port, repldst_port;
80 u_int16_t match_flags, invert_flags; 80 __u16 match_flags, invert_flags;
81 u_int8_t state_mask, status_mask; 81 __u8 state_mask, status_mask;
82}; 82};
83 83
84#endif /*_XT_CONNTRACK_H*/ 84#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_dccp.h b/include/linux/netfilter/xt_dccp.h
index e0221b9d32cb..a579e1b6f040 100644
--- a/include/linux/netfilter/xt_dccp.h
+++ b/include/linux/netfilter/xt_dccp.h
@@ -1,6 +1,8 @@
1#ifndef _XT_DCCP_H_ 1#ifndef _XT_DCCP_H_
2#define _XT_DCCP_H_ 2#define _XT_DCCP_H_
3 3
4#include <linux/types.h>
5
4#define XT_DCCP_SRC_PORTS 0x01 6#define XT_DCCP_SRC_PORTS 0x01
5#define XT_DCCP_DEST_PORTS 0x02 7#define XT_DCCP_DEST_PORTS 0x02
6#define XT_DCCP_TYPE 0x04 8#define XT_DCCP_TYPE 0x04
@@ -9,14 +11,14 @@
9#define XT_DCCP_VALID_FLAGS 0x0f 11#define XT_DCCP_VALID_FLAGS 0x0f
10 12
11struct xt_dccp_info { 13struct xt_dccp_info {
12 u_int16_t dpts[2]; /* Min, Max */ 14 __u16 dpts[2]; /* Min, Max */
13 u_int16_t spts[2]; /* Min, Max */ 15 __u16 spts[2]; /* Min, Max */
14 16
15 u_int16_t flags; 17 __u16 flags;
16 u_int16_t invflags; 18 __u16 invflags;
17 19
18 u_int16_t typemask; 20 __u16 typemask;
19 u_int8_t option; 21 __u8 option;
20}; 22};
21 23
22#endif /* _XT_DCCP_H_ */ 24#endif /* _XT_DCCP_H_ */
diff --git a/include/linux/netfilter/xt_dscp.h b/include/linux/netfilter/xt_dscp.h
index f49bc1a648dc..15f8932ad5ce 100644
--- a/include/linux/netfilter/xt_dscp.h
+++ b/include/linux/netfilter/xt_dscp.h
@@ -10,20 +10,22 @@
10#ifndef _XT_DSCP_H 10#ifndef _XT_DSCP_H
11#define _XT_DSCP_H 11#define _XT_DSCP_H
12 12
13#include <linux/types.h>
14
13#define XT_DSCP_MASK 0xfc /* 11111100 */ 15#define XT_DSCP_MASK 0xfc /* 11111100 */
14#define XT_DSCP_SHIFT 2 16#define XT_DSCP_SHIFT 2
15#define XT_DSCP_MAX 0x3f /* 00111111 */ 17#define XT_DSCP_MAX 0x3f /* 00111111 */
16 18
17/* match info */ 19/* match info */
18struct xt_dscp_info { 20struct xt_dscp_info {
19 u_int8_t dscp; 21 __u8 dscp;
20 u_int8_t invert; 22 __u8 invert;
21}; 23};
22 24
23struct xt_tos_match_info { 25struct xt_tos_match_info {
24 u_int8_t tos_mask; 26 __u8 tos_mask;
25 u_int8_t tos_value; 27 __u8 tos_value;
26 u_int8_t invert; 28 __u8 invert;
27}; 29};
28 30
29#endif /* _XT_DSCP_H */ 31#endif /* _XT_DSCP_H */
diff --git a/include/linux/netfilter/xt_esp.h b/include/linux/netfilter/xt_esp.h
index 9380fb1c27da..ef6fa4747d0a 100644
--- a/include/linux/netfilter/xt_esp.h
+++ b/include/linux/netfilter/xt_esp.h
@@ -1,10 +1,12 @@
1#ifndef _XT_ESP_H 1#ifndef _XT_ESP_H
2#define _XT_ESP_H 2#define _XT_ESP_H
3 3
4#include <linux/types.h>
5
4struct xt_esp 6struct xt_esp
5{ 7{
6 u_int32_t spis[2]; /* Security Parameter Index */ 8 __u32 spis[2]; /* Security Parameter Index */
7 u_int8_t invflags; /* Inverse flags */ 9 __u8 invflags; /* Inverse flags */
8}; 10};
9 11
10/* Values for "invflags" field in struct xt_esp. */ 12/* Values for "invflags" field in struct xt_esp. */
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index 51b18d83b477..b1925b5925e9 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -1,6 +1,8 @@
1#ifndef _XT_HASHLIMIT_H 1#ifndef _XT_HASHLIMIT_H
2#define _XT_HASHLIMIT_H 2#define _XT_HASHLIMIT_H
3 3
4#include <linux/types.h>
5
4/* timings are in milliseconds. */ 6/* timings are in milliseconds. */
5#define XT_HASHLIMIT_SCALE 10000 7#define XT_HASHLIMIT_SCALE 10000
6/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
@@ -18,15 +20,15 @@ enum {
18}; 20};
19 21
20struct hashlimit_cfg { 22struct hashlimit_cfg {
21 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */ 23 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
22 u_int32_t avg; /* Average secs between packets * scale */ 24 __u32 avg; /* Average secs between packets * scale */
23 u_int32_t burst; /* Period multiplier for upper limit. */ 25 __u32 burst; /* Period multiplier for upper limit. */
24 26
25 /* user specified */ 27 /* user specified */
26 u_int32_t size; /* how many buckets */ 28 __u32 size; /* how many buckets */
27 u_int32_t max; /* max number of entries */ 29 __u32 max; /* max number of entries */
28 u_int32_t gc_interval; /* gc interval */ 30 __u32 gc_interval; /* gc interval */
29 u_int32_t expire; /* when do entries expire? */ 31 __u32 expire; /* when do entries expire? */
30}; 32};
31 33
32struct xt_hashlimit_info { 34struct xt_hashlimit_info {
@@ -42,17 +44,17 @@ struct xt_hashlimit_info {
42}; 44};
43 45
44struct hashlimit_cfg1 { 46struct hashlimit_cfg1 {
45 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */ 47 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
46 u_int32_t avg; /* Average secs between packets * scale */ 48 __u32 avg; /* Average secs between packets * scale */
47 u_int32_t burst; /* Period multiplier for upper limit. */ 49 __u32 burst; /* Period multiplier for upper limit. */
48 50
49 /* user specified */ 51 /* user specified */
50 u_int32_t size; /* how many buckets */ 52 __u32 size; /* how many buckets */
51 u_int32_t max; /* max number of entries */ 53 __u32 max; /* max number of entries */
52 u_int32_t gc_interval; /* gc interval */ 54 __u32 gc_interval; /* gc interval */
53 u_int32_t expire; /* when do entries expire? */ 55 __u32 expire; /* when do entries expire? */
54 56
55 u_int8_t srcmask, dstmask; 57 __u8 srcmask, dstmask;
56}; 58};
57 59
58struct xt_hashlimit_mtinfo1 { 60struct xt_hashlimit_mtinfo1 {
diff --git a/include/linux/netfilter/xt_iprange.h b/include/linux/netfilter/xt_iprange.h
index a4299c7d3680..c1f21a779a45 100644
--- a/include/linux/netfilter/xt_iprange.h
+++ b/include/linux/netfilter/xt_iprange.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_NETFILTER_XT_IPRANGE_H 1#ifndef _LINUX_NETFILTER_XT_IPRANGE_H
2#define _LINUX_NETFILTER_XT_IPRANGE_H 1 2#define _LINUX_NETFILTER_XT_IPRANGE_H 1
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 IPRANGE_SRC = 1 << 0, /* match source IP address */ 7 IPRANGE_SRC = 1 << 0, /* match source IP address */
6 IPRANGE_DST = 1 << 1, /* match destination IP address */ 8 IPRANGE_DST = 1 << 1, /* match destination IP address */
@@ -11,7 +13,7 @@ enum {
11struct xt_iprange_mtinfo { 13struct xt_iprange_mtinfo {
12 union nf_inet_addr src_min, src_max; 14 union nf_inet_addr src_min, src_max;
13 union nf_inet_addr dst_min, dst_max; 15 union nf_inet_addr dst_min, dst_max;
14 u_int8_t flags; 16 __u8 flags;
15}; 17};
16 18
17#endif /* _LINUX_NETFILTER_XT_IPRANGE_H */ 19#endif /* _LINUX_NETFILTER_XT_IPRANGE_H */
diff --git a/include/linux/netfilter/xt_length.h b/include/linux/netfilter/xt_length.h
index 7c2b439f73fe..b82ed7c4b1e0 100644
--- a/include/linux/netfilter/xt_length.h
+++ b/include/linux/netfilter/xt_length.h
@@ -1,9 +1,11 @@
1#ifndef _XT_LENGTH_H 1#ifndef _XT_LENGTH_H
2#define _XT_LENGTH_H 2#define _XT_LENGTH_H
3 3
4#include <linux/types.h>
5
4struct xt_length_info { 6struct xt_length_info {
5 u_int16_t min, max; 7 __u16 min, max;
6 u_int8_t invert; 8 __u8 invert;
7}; 9};
8 10
9#endif /*_XT_LENGTH_H*/ 11#endif /*_XT_LENGTH_H*/
diff --git a/include/linux/netfilter/xt_limit.h b/include/linux/netfilter/xt_limit.h
index b3ce65375ecb..bb47fc4d2ade 100644
--- a/include/linux/netfilter/xt_limit.h
+++ b/include/linux/netfilter/xt_limit.h
@@ -1,21 +1,24 @@
1#ifndef _XT_RATE_H 1#ifndef _XT_RATE_H
2#define _XT_RATE_H 2#define _XT_RATE_H
3 3
4#include <linux/types.h>
5
4/* timings are in milliseconds. */ 6/* timings are in milliseconds. */
5#define XT_LIMIT_SCALE 10000 7#define XT_LIMIT_SCALE 10000
6 8
9struct xt_limit_priv;
10
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 11/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
8 seconds, or one every 59 hours. */ 12 seconds, or one every 59 hours. */
9struct xt_rateinfo { 13struct xt_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */ 14 __u32 avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */ 15 __u32 burst; /* Period multiplier for upper limit. */
12 16
13 /* Used internally by the kernel */ 17 /* Used internally by the kernel */
14 unsigned long prev; 18 unsigned long prev; /* moved to xt_limit_priv */
15 u_int32_t credit; 19 __u32 credit; /* moved to xt_limit_priv */
16 u_int32_t credit_cap, cost; 20 __u32 credit_cap, cost;
17 21
18 /* Ugly, ugly fucker. */ 22 struct xt_limit_priv *master;
19 struct xt_rateinfo *master;
20}; 23};
21#endif /*_XT_RATE_H*/ 24#endif /*_XT_RATE_H*/
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
index fae74bc3f34e..6fa460a3cc29 100644
--- a/include/linux/netfilter/xt_mark.h
+++ b/include/linux/netfilter/xt_mark.h
@@ -1,14 +1,16 @@
1#ifndef _XT_MARK_H 1#ifndef _XT_MARK_H
2#define _XT_MARK_H 2#define _XT_MARK_H
3 3
4#include <linux/types.h>
5
4struct xt_mark_info { 6struct xt_mark_info {
5 unsigned long mark, mask; 7 unsigned long mark, mask;
6 u_int8_t invert; 8 __u8 invert;
7}; 9};
8 10
9struct xt_mark_mtinfo1 { 11struct xt_mark_mtinfo1 {
10 u_int32_t mark, mask; 12 __u32 mark, mask;
11 u_int8_t invert; 13 __u8 invert;
12}; 14};
13 15
14#endif /*_XT_MARK_H*/ 16#endif /*_XT_MARK_H*/
diff --git a/include/linux/netfilter/xt_multiport.h b/include/linux/netfilter/xt_multiport.h
index d49ee4183710..185db499fcbc 100644
--- a/include/linux/netfilter/xt_multiport.h
+++ b/include/linux/netfilter/xt_multiport.h
@@ -1,6 +1,8 @@
1#ifndef _XT_MULTIPORT_H 1#ifndef _XT_MULTIPORT_H
2#define _XT_MULTIPORT_H 2#define _XT_MULTIPORT_H
3 3
4#include <linux/types.h>
5
4enum xt_multiport_flags 6enum xt_multiport_flags
5{ 7{
6 XT_MULTIPORT_SOURCE, 8 XT_MULTIPORT_SOURCE,
@@ -13,18 +15,18 @@ enum xt_multiport_flags
13/* Must fit inside union xt_matchinfo: 16 bytes */ 15/* Must fit inside union xt_matchinfo: 16 bytes */
14struct xt_multiport 16struct xt_multiport
15{ 17{
16 u_int8_t flags; /* Type of comparison */ 18 __u8 flags; /* Type of comparison */
17 u_int8_t count; /* Number of ports */ 19 __u8 count; /* Number of ports */
18 u_int16_t ports[XT_MULTI_PORTS]; /* Ports */ 20 __u16 ports[XT_MULTI_PORTS]; /* Ports */
19}; 21};
20 22
21struct xt_multiport_v1 23struct xt_multiport_v1
22{ 24{
23 u_int8_t flags; /* Type of comparison */ 25 __u8 flags; /* Type of comparison */
24 u_int8_t count; /* Number of ports */ 26 __u8 count; /* Number of ports */
25 u_int16_t ports[XT_MULTI_PORTS]; /* Ports */ 27 __u16 ports[XT_MULTI_PORTS]; /* Ports */
26 u_int8_t pflags[XT_MULTI_PORTS]; /* Port flags */ 28 __u8 pflags[XT_MULTI_PORTS]; /* Port flags */
27 u_int8_t invert; /* Invert flag */ 29 __u8 invert; /* Invert flag */
28}; 30};
29 31
30#endif /*_XT_MULTIPORT_H*/ 32#endif /*_XT_MULTIPORT_H*/
diff --git a/include/linux/netfilter/xt_owner.h b/include/linux/netfilter/xt_owner.h
index c84e52cfe415..2081761714b5 100644
--- a/include/linux/netfilter/xt_owner.h
+++ b/include/linux/netfilter/xt_owner.h
@@ -1,6 +1,8 @@
1#ifndef _XT_OWNER_MATCH_H 1#ifndef _XT_OWNER_MATCH_H
2#define _XT_OWNER_MATCH_H 2#define _XT_OWNER_MATCH_H
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 XT_OWNER_UID = 1 << 0, 7 XT_OWNER_UID = 1 << 0,
6 XT_OWNER_GID = 1 << 1, 8 XT_OWNER_GID = 1 << 1,
@@ -8,9 +10,9 @@ enum {
8}; 10};
9 11
10struct xt_owner_match_info { 12struct xt_owner_match_info {
11 u_int32_t uid_min, uid_max; 13 __u32 uid_min, uid_max;
12 u_int32_t gid_min, gid_max; 14 __u32 gid_min, gid_max;
13 u_int8_t match, invert; 15 __u8 match, invert;
14}; 16};
15 17
16#endif /* _XT_OWNER_MATCH_H */ 18#endif /* _XT_OWNER_MATCH_H */
diff --git a/include/linux/netfilter/xt_physdev.h b/include/linux/netfilter/xt_physdev.h
index 25a7a1815b5b..8555e399886d 100644
--- a/include/linux/netfilter/xt_physdev.h
+++ b/include/linux/netfilter/xt_physdev.h
@@ -1,6 +1,8 @@
1#ifndef _XT_PHYSDEV_H 1#ifndef _XT_PHYSDEV_H
2#define _XT_PHYSDEV_H 2#define _XT_PHYSDEV_H
3 3
4#include <linux/types.h>
5
4#ifdef __KERNEL__ 6#ifdef __KERNEL__
5#include <linux/if.h> 7#include <linux/if.h>
6#endif 8#endif
@@ -17,8 +19,8 @@ struct xt_physdev_info {
17 char in_mask[IFNAMSIZ]; 19 char in_mask[IFNAMSIZ];
18 char physoutdev[IFNAMSIZ]; 20 char physoutdev[IFNAMSIZ];
19 char out_mask[IFNAMSIZ]; 21 char out_mask[IFNAMSIZ];
20 u_int8_t invert; 22 __u8 invert;
21 u_int8_t bitmask; 23 __u8 bitmask;
22}; 24};
23 25
24#endif /*_XT_PHYSDEV_H*/ 26#endif /*_XT_PHYSDEV_H*/
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h
index 053d8cc65464..7bb64e7c853d 100644
--- a/include/linux/netfilter/xt_policy.h
+++ b/include/linux/netfilter/xt_policy.h
@@ -1,6 +1,8 @@
1#ifndef _XT_POLICY_H 1#ifndef _XT_POLICY_H
2#define _XT_POLICY_H 2#define _XT_POLICY_H
3 3
4#include <linux/types.h>
5
4#define XT_POLICY_MAX_ELEM 4 6#define XT_POLICY_MAX_ELEM 4
5 7
6enum xt_policy_flags 8enum xt_policy_flags
@@ -19,7 +21,7 @@ enum xt_policy_modes
19 21
20struct xt_policy_spec 22struct xt_policy_spec
21{ 23{
22 u_int8_t saddr:1, 24 __u8 saddr:1,
23 daddr:1, 25 daddr:1,
24 proto:1, 26 proto:1,
25 mode:1, 27 mode:1,
@@ -55,9 +57,9 @@ struct xt_policy_elem
55#endif 57#endif
56 }; 58 };
57 __be32 spi; 59 __be32 spi;
58 u_int32_t reqid; 60 __u32 reqid;
59 u_int8_t proto; 61 __u8 proto;
60 u_int8_t mode; 62 __u8 mode;
61 63
62 struct xt_policy_spec match; 64 struct xt_policy_spec match;
63 struct xt_policy_spec invert; 65 struct xt_policy_spec invert;
@@ -66,8 +68,8 @@ struct xt_policy_elem
66struct xt_policy_info 68struct xt_policy_info
67{ 69{
68 struct xt_policy_elem pol[XT_POLICY_MAX_ELEM]; 70 struct xt_policy_elem pol[XT_POLICY_MAX_ELEM];
69 u_int16_t flags; 71 __u16 flags;
70 u_int16_t len; 72 __u16 len;
71}; 73};
72 74
73#endif /* _XT_POLICY_H */ 75#endif /* _XT_POLICY_H */
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
index 4c8368d781e5..8dc89dfc1361 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/linux/netfilter/xt_quota.h
@@ -6,13 +6,15 @@ enum xt_quota_flags {
6}; 6};
7#define XT_QUOTA_MASK 0x1 7#define XT_QUOTA_MASK 0x1
8 8
9struct xt_quota_priv;
10
9struct xt_quota_info { 11struct xt_quota_info {
10 u_int32_t flags; 12 u_int32_t flags;
11 u_int32_t pad; 13 u_int32_t pad;
12 14
13 /* Used internally by the kernel */ 15 /* Used internally by the kernel */
14 aligned_u64 quota; 16 aligned_u64 quota;
15 struct xt_quota_info *master; 17 struct xt_quota_priv *master;
16}; 18};
17 19
18#endif /* _XT_QUOTA_H */ 20#endif /* _XT_QUOTA_H */
diff --git a/include/linux/netfilter/xt_rateest.h b/include/linux/netfilter/xt_rateest.h
index 2010cb74250f..d40a6196842a 100644
--- a/include/linux/netfilter/xt_rateest.h
+++ b/include/linux/netfilter/xt_rateest.h
@@ -1,6 +1,8 @@
1#ifndef _XT_RATEEST_MATCH_H 1#ifndef _XT_RATEEST_MATCH_H
2#define _XT_RATEEST_MATCH_H 2#define _XT_RATEEST_MATCH_H
3 3
4#include <linux/types.h>
5
4enum xt_rateest_match_flags { 6enum xt_rateest_match_flags {
5 XT_RATEEST_MATCH_INVERT = 1<<0, 7 XT_RATEEST_MATCH_INVERT = 1<<0,
6 XT_RATEEST_MATCH_ABS = 1<<1, 8 XT_RATEEST_MATCH_ABS = 1<<1,
@@ -20,12 +22,12 @@ enum xt_rateest_match_mode {
20struct xt_rateest_match_info { 22struct xt_rateest_match_info {
21 char name1[IFNAMSIZ]; 23 char name1[IFNAMSIZ];
22 char name2[IFNAMSIZ]; 24 char name2[IFNAMSIZ];
23 u_int16_t flags; 25 __u16 flags;
24 u_int16_t mode; 26 __u16 mode;
25 u_int32_t bps1; 27 __u32 bps1;
26 u_int32_t pps1; 28 __u32 pps1;
27 u_int32_t bps2; 29 __u32 bps2;
28 u_int32_t pps2; 30 __u32 pps2;
29 31
30 /* Used internally by the kernel */ 32 /* Used internally by the kernel */
31 struct xt_rateest *est1 __attribute__((aligned(8))); 33 struct xt_rateest *est1 __attribute__((aligned(8)));
diff --git a/include/linux/netfilter/xt_realm.h b/include/linux/netfilter/xt_realm.h
index 220e87245716..d4a82ee56a02 100644
--- a/include/linux/netfilter/xt_realm.h
+++ b/include/linux/netfilter/xt_realm.h
@@ -1,10 +1,12 @@
1#ifndef _XT_REALM_H 1#ifndef _XT_REALM_H
2#define _XT_REALM_H 2#define _XT_REALM_H
3 3
4#include <linux/types.h>
5
4struct xt_realm_info { 6struct xt_realm_info {
5 u_int32_t id; 7 __u32 id;
6 u_int32_t mask; 8 __u32 mask;
7 u_int8_t invert; 9 __u8 invert;
8}; 10};
9 11
10#endif /* _XT_REALM_H */ 12#endif /* _XT_REALM_H */
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h
index 5cfeb81c6794..d2c276609925 100644
--- a/include/linux/netfilter/xt_recent.h
+++ b/include/linux/netfilter/xt_recent.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_NETFILTER_XT_RECENT_H 1#ifndef _LINUX_NETFILTER_XT_RECENT_H
2#define _LINUX_NETFILTER_XT_RECENT_H 1 2#define _LINUX_NETFILTER_XT_RECENT_H 1
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 XT_RECENT_CHECK = 1 << 0, 7 XT_RECENT_CHECK = 1 << 0,
6 XT_RECENT_SET = 1 << 1, 8 XT_RECENT_SET = 1 << 1,
@@ -15,12 +17,12 @@ enum {
15}; 17};
16 18
17struct xt_recent_mtinfo { 19struct xt_recent_mtinfo {
18 u_int32_t seconds; 20 __u32 seconds;
19 u_int32_t hit_count; 21 __u32 hit_count;
20 u_int8_t check_set; 22 __u8 check_set;
21 u_int8_t invert; 23 __u8 invert;
22 char name[XT_RECENT_NAME_LEN]; 24 char name[XT_RECENT_NAME_LEN];
23 u_int8_t side; 25 __u8 side;
24}; 26};
25 27
26#endif /* _LINUX_NETFILTER_XT_RECENT_H */ 28#endif /* _LINUX_NETFILTER_XT_RECENT_H */
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
index 32000ba6ecef..29287be696a2 100644
--- a/include/linux/netfilter/xt_sctp.h
+++ b/include/linux/netfilter/xt_sctp.h
@@ -1,6 +1,8 @@
1#ifndef _XT_SCTP_H_ 1#ifndef _XT_SCTP_H_
2#define _XT_SCTP_H_ 2#define _XT_SCTP_H_
3 3
4#include <linux/types.h>
5
4#define XT_SCTP_SRC_PORTS 0x01 6#define XT_SCTP_SRC_PORTS 0x01
5#define XT_SCTP_DEST_PORTS 0x02 7#define XT_SCTP_DEST_PORTS 0x02
6#define XT_SCTP_CHUNK_TYPES 0x04 8#define XT_SCTP_CHUNK_TYPES 0x04
@@ -8,49 +10,49 @@
8#define XT_SCTP_VALID_FLAGS 0x07 10#define XT_SCTP_VALID_FLAGS 0x07
9 11
10struct xt_sctp_flag_info { 12struct xt_sctp_flag_info {
11 u_int8_t chunktype; 13 __u8 chunktype;
12 u_int8_t flag; 14 __u8 flag;
13 u_int8_t flag_mask; 15 __u8 flag_mask;
14}; 16};
15 17
16#define XT_NUM_SCTP_FLAGS 4 18#define XT_NUM_SCTP_FLAGS 4
17 19
18struct xt_sctp_info { 20struct xt_sctp_info {
19 u_int16_t dpts[2]; /* Min, Max */ 21 __u16 dpts[2]; /* Min, Max */
20 u_int16_t spts[2]; /* Min, Max */ 22 __u16 spts[2]; /* Min, Max */
21 23
22 u_int32_t chunkmap[256 / sizeof (u_int32_t)]; /* Bit mask of chunks to be matched according to RFC 2960 */ 24 __u32 chunkmap[256 / sizeof (__u32)]; /* Bit mask of chunks to be matched according to RFC 2960 */
23 25
24#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */ 26#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */
25#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */ 27#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */
26#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */ 28#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */
27 29
28 u_int32_t chunk_match_type; 30 __u32 chunk_match_type;
29 struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS]; 31 struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS];
30 int flag_count; 32 int flag_count;
31 33
32 u_int32_t flags; 34 __u32 flags;
33 u_int32_t invflags; 35 __u32 invflags;
34}; 36};
35 37
36#define bytes(type) (sizeof(type) * 8) 38#define bytes(type) (sizeof(type) * 8)
37 39
38#define SCTP_CHUNKMAP_SET(chunkmap, type) \ 40#define SCTP_CHUNKMAP_SET(chunkmap, type) \
39 do { \ 41 do { \
40 (chunkmap)[type / bytes(u_int32_t)] |= \ 42 (chunkmap)[type / bytes(__u32)] |= \
41 1 << (type % bytes(u_int32_t)); \ 43 1 << (type % bytes(__u32)); \
42 } while (0) 44 } while (0)
43 45
44#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ 46#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
45 do { \ 47 do { \
46 (chunkmap)[type / bytes(u_int32_t)] &= \ 48 (chunkmap)[type / bytes(__u32)] &= \
47 ~(1 << (type % bytes(u_int32_t))); \ 49 ~(1 << (type % bytes(__u32))); \
48 } while (0) 50 } while (0)
49 51
50#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ 52#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
51({ \ 53({ \
52 ((chunkmap)[type / bytes (u_int32_t)] & \ 54 ((chunkmap)[type / bytes (__u32)] & \
53 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \ 55 (1 << (type % bytes (__u32)))) ? 1: 0; \
54}) 56})
55 57
56#define SCTP_CHUNKMAP_RESET(chunkmap) \ 58#define SCTP_CHUNKMAP_RESET(chunkmap) \
@@ -65,7 +67,7 @@ struct xt_sctp_info {
65#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ 67#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
66 __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap)) 68 __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
67static inline bool 69static inline bool
68__sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n) 70__sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n)
69{ 71{
70 unsigned int i; 72 unsigned int i;
71 for (i = 0; i < n; ++i) 73 for (i = 0; i < n; ++i)
@@ -77,7 +79,7 @@ __sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n)
77#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \ 79#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
78 __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap)) 80 __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
79static inline bool 81static inline bool
80__sctp_chunkmap_is_all_set(const u_int32_t *chunkmap, unsigned int n) 82__sctp_chunkmap_is_all_set(const __u32 *chunkmap, unsigned int n)
81{ 83{
82 unsigned int i; 84 unsigned int i;
83 for (i = 0; i < n; ++i) 85 for (i = 0; i < n; ++i)
diff --git a/include/linux/netfilter/xt_statistic.h b/include/linux/netfilter/xt_statistic.h
index 3d38bc975048..4e983ef0c968 100644
--- a/include/linux/netfilter/xt_statistic.h
+++ b/include/linux/netfilter/xt_statistic.h
@@ -1,6 +1,8 @@
1#ifndef _XT_STATISTIC_H 1#ifndef _XT_STATISTIC_H
2#define _XT_STATISTIC_H 2#define _XT_STATISTIC_H
3 3
4#include <linux/types.h>
5
4enum xt_statistic_mode { 6enum xt_statistic_mode {
5 XT_STATISTIC_MODE_RANDOM, 7 XT_STATISTIC_MODE_RANDOM,
6 XT_STATISTIC_MODE_NTH, 8 XT_STATISTIC_MODE_NTH,
@@ -13,21 +15,22 @@ enum xt_statistic_flags {
13}; 15};
14#define XT_STATISTIC_MASK 0x1 16#define XT_STATISTIC_MASK 0x1
15 17
18struct xt_statistic_priv;
19
16struct xt_statistic_info { 20struct xt_statistic_info {
17 u_int16_t mode; 21 __u16 mode;
18 u_int16_t flags; 22 __u16 flags;
19 union { 23 union {
20 struct { 24 struct {
21 u_int32_t probability; 25 __u32 probability;
22 } random; 26 } random;
23 struct { 27 struct {
24 u_int32_t every; 28 __u32 every;
25 u_int32_t packet; 29 __u32 packet;
26 /* Used internally by the kernel */ 30 __u32 count; /* unused */
27 u_int32_t count;
28 } nth; 31 } nth;
29 } u; 32 } u;
30 struct xt_statistic_info *master __attribute__((aligned(8))); 33 struct xt_statistic_priv *master __attribute__((aligned(8)));
31}; 34};
32 35
33#endif /* _XT_STATISTIC_H */ 36#endif /* _XT_STATISTIC_H */
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
index 8a6ba7bbef9f..ecbb95fc89ed 100644
--- a/include/linux/netfilter/xt_string.h
+++ b/include/linux/netfilter/xt_string.h
@@ -1,6 +1,8 @@
1#ifndef _XT_STRING_H 1#ifndef _XT_STRING_H
2#define _XT_STRING_H 2#define _XT_STRING_H
3 3
4#include <linux/types.h>
5
4#define XT_STRING_MAX_PATTERN_SIZE 128 6#define XT_STRING_MAX_PATTERN_SIZE 128
5#define XT_STRING_MAX_ALGO_NAME_SIZE 16 7#define XT_STRING_MAX_ALGO_NAME_SIZE 16
6 8
@@ -11,18 +13,18 @@ enum {
11 13
12struct xt_string_info 14struct xt_string_info
13{ 15{
14 u_int16_t from_offset; 16 __u16 from_offset;
15 u_int16_t to_offset; 17 __u16 to_offset;
16 char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; 18 char algo[XT_STRING_MAX_ALGO_NAME_SIZE];
17 char pattern[XT_STRING_MAX_PATTERN_SIZE]; 19 char pattern[XT_STRING_MAX_PATTERN_SIZE];
18 u_int8_t patlen; 20 __u8 patlen;
19 union { 21 union {
20 struct { 22 struct {
21 u_int8_t invert; 23 __u8 invert;
22 } v0; 24 } v0;
23 25
24 struct { 26 struct {
25 u_int8_t flags; 27 __u8 flags;
26 } v1; 28 } v1;
27 } u; 29 } u;
28 30
diff --git a/include/linux/netfilter/xt_tcpmss.h b/include/linux/netfilter/xt_tcpmss.h
index e03274c4c790..fbac56b9e667 100644
--- a/include/linux/netfilter/xt_tcpmss.h
+++ b/include/linux/netfilter/xt_tcpmss.h
@@ -1,9 +1,11 @@
1#ifndef _XT_TCPMSS_MATCH_H 1#ifndef _XT_TCPMSS_MATCH_H
2#define _XT_TCPMSS_MATCH_H 2#define _XT_TCPMSS_MATCH_H
3 3
4#include <linux/types.h>
5
4struct xt_tcpmss_match_info { 6struct xt_tcpmss_match_info {
5 u_int16_t mss_min, mss_max; 7 __u16 mss_min, mss_max;
6 u_int8_t invert; 8 __u8 invert;
7}; 9};
8 10
9#endif /*_XT_TCPMSS_MATCH_H*/ 11#endif /*_XT_TCPMSS_MATCH_H*/
diff --git a/include/linux/netfilter/xt_tcpudp.h b/include/linux/netfilter/xt_tcpudp.h
index 78bc65f11adf..a490a0bc1d29 100644
--- a/include/linux/netfilter/xt_tcpudp.h
+++ b/include/linux/netfilter/xt_tcpudp.h
@@ -1,15 +1,17 @@
1#ifndef _XT_TCPUDP_H 1#ifndef _XT_TCPUDP_H
2#define _XT_TCPUDP_H 2#define _XT_TCPUDP_H
3 3
4#include <linux/types.h>
5
4/* TCP matching stuff */ 6/* TCP matching stuff */
5struct xt_tcp 7struct xt_tcp
6{ 8{
7 u_int16_t spts[2]; /* Source port range. */ 9 __u16 spts[2]; /* Source port range. */
8 u_int16_t dpts[2]; /* Destination port range. */ 10 __u16 dpts[2]; /* Destination port range. */
9 u_int8_t option; /* TCP Option iff non-zero*/ 11 __u8 option; /* TCP Option iff non-zero*/
10 u_int8_t flg_mask; /* TCP flags mask byte */ 12 __u8 flg_mask; /* TCP flags mask byte */
11 u_int8_t flg_cmp; /* TCP flags compare byte */ 13 __u8 flg_cmp; /* TCP flags compare byte */
12 u_int8_t invflags; /* Inverse flags */ 14 __u8 invflags; /* Inverse flags */
13}; 15};
14 16
15/* Values for "inv" field in struct ipt_tcp. */ 17/* Values for "inv" field in struct ipt_tcp. */
@@ -22,9 +24,9 @@ struct xt_tcp
22/* UDP matching stuff */ 24/* UDP matching stuff */
23struct xt_udp 25struct xt_udp
24{ 26{
25 u_int16_t spts[2]; /* Source port range. */ 27 __u16 spts[2]; /* Source port range. */
26 u_int16_t dpts[2]; /* Destination port range. */ 28 __u16 dpts[2]; /* Destination port range. */
27 u_int8_t invflags; /* Inverse flags */ 29 __u8 invflags; /* Inverse flags */
28}; 30};
29 31
30/* Values for "invflags" field in struct ipt_udp. */ 32/* Values for "invflags" field in struct ipt_udp. */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 499aa9375901..f8105e54716a 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -59,9 +59,9 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
59static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) 59static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
60{ 60{
61 switch (skb->protocol) { 61 switch (skb->protocol) {
62 case __constant_htons(ETH_P_8021Q): 62 case __cpu_to_be16(ETH_P_8021Q):
63 return VLAN_HLEN; 63 return VLAN_HLEN;
64 case __constant_htons(ETH_P_PPP_SES): 64 case __cpu_to_be16(ETH_P_PPP_SES):
65 return PPPOE_SES_HLEN; 65 return PPPOE_SES_HLEN;
66 default: 66 default:
67 return 0; 67 return 0;
diff --git a/include/linux/netfilter_ipv4/ipt_owner.h b/include/linux/netfilter_ipv4/ipt_owner.h
index 92f4bdac54ef..a78445be9992 100644
--- a/include/linux/netfilter_ipv4/ipt_owner.h
+++ b/include/linux/netfilter_ipv4/ipt_owner.h
@@ -9,10 +9,10 @@
9#define IPT_OWNER_COMM 0x10 9#define IPT_OWNER_COMM 0x10
10 10
11struct ipt_owner_info { 11struct ipt_owner_info {
12 uid_t uid; 12 __kernel_uid32_t uid;
13 gid_t gid; 13 __kernel_gid32_t gid;
14 pid_t pid; 14 __kernel_pid_t pid;
15 pid_t sid; 15 __kernel_pid_t sid;
16 char comm[16]; 16 char comm[16];
17 u_int8_t match, invert; /* flags */ 17 u_int8_t match, invert; /* flags */
18}; 18};
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
index 8887a5fcd1d0..aca4bd1f6d7c 100644
--- a/include/linux/netfilter_ipv6/Kbuild
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -11,6 +11,7 @@ header-y += ip6t_length.h
11header-y += ip6t_limit.h 11header-y += ip6t_limit.h
12header-y += ip6t_mac.h 12header-y += ip6t_mac.h
13header-y += ip6t_mark.h 13header-y += ip6t_mark.h
14header-y += ip6t_mh.h
14header-y += ip6t_multiport.h 15header-y += ip6t_multiport.h
15header-y += ip6t_opts.h 16header-y += ip6t_opts.h
16header-y += ip6t_owner.h 17header-y += ip6t_owner.h
diff --git a/include/linux/netfilter_ipv6/ip6t_owner.h b/include/linux/netfilter_ipv6/ip6t_owner.h
index 19937da3d101..ec5cc7a38c42 100644
--- a/include/linux/netfilter_ipv6/ip6t_owner.h
+++ b/include/linux/netfilter_ipv6/ip6t_owner.h
@@ -8,10 +8,10 @@
8#define IP6T_OWNER_SID 0x08 8#define IP6T_OWNER_SID 0x08
9 9
10struct ip6t_owner_info { 10struct ip6t_owner_info {
11 uid_t uid; 11 __kernel_uid32_t uid;
12 gid_t gid; 12 __kernel_gid32_t gid;
13 pid_t pid; 13 __kernel_pid_t pid;
14 pid_t sid; 14 __kernel_pid_t sid;
15 u_int8_t match, invert; /* flags */ 15 u_int8_t match, invert; /* flags */
16}; 16};
17 17
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 51b09a1f46c3..5ba398e90304 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -103,6 +103,8 @@ struct nlmsgerr
103#define NETLINK_ADD_MEMBERSHIP 1 103#define NETLINK_ADD_MEMBERSHIP 1
104#define NETLINK_DROP_MEMBERSHIP 2 104#define NETLINK_DROP_MEMBERSHIP 2
105#define NETLINK_PKTINFO 3 105#define NETLINK_PKTINFO 3
106#define NETLINK_BROADCAST_ERROR 4
107#define NETLINK_NO_ENOBUFS 5
106 108
107struct nl_pktinfo 109struct nl_pktinfo
108{ 110{
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index e38d3c9dccda..2524267210d3 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -18,7 +18,7 @@ struct netpoll {
18 const char *name; 18 const char *name;
19 void (*rx_hook)(struct netpoll *, int, char *, int); 19 void (*rx_hook)(struct netpoll *, int, char *, int);
20 20
21 u32 local_ip, remote_ip; 21 __be32 local_ip, remote_ip;
22 u16 local_port, remote_port; 22 u16 local_port, remote_port;
23 u8 remote_mac[ETH_ALEN]; 23 u8 remote_mac[ETH_ALEN];
24}; 24};
@@ -63,6 +63,13 @@ static inline int netpoll_rx(struct sk_buff *skb)
63 return ret; 63 return ret;
64} 64}
65 65
66static inline int netpoll_rx_on(struct sk_buff *skb)
67{
68 struct netpoll_info *npinfo = skb->dev->npinfo;
69
70 return npinfo && (npinfo->rx_np || npinfo->rx_flags);
71}
72
66static inline int netpoll_receive_skb(struct sk_buff *skb) 73static inline int netpoll_receive_skb(struct sk_buff *skb)
67{ 74{
68 if (!list_empty(&skb->dev->napi_list)) 75 if (!list_empty(&skb->dev->napi_list))
@@ -99,6 +106,10 @@ static inline int netpoll_rx(struct sk_buff *skb)
99{ 106{
100 return 0; 107 return 0;
101} 108}
109static inline int netpoll_rx_on(struct sk_buff *skb)
110{
111 return 0;
112}
102static inline int netpoll_receive_skb(struct sk_buff *skb) 113static inline int netpoll_receive_skb(struct sk_buff *skb)
103{ 114{
104 return 0; 115 return 0;
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/nfs_fs.h b/include/linux/nfs_fs.h
index db867b04ac3c..fdffb413b192 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -166,8 +166,7 @@ struct nfs_inode {
166 */ 166 */
167 struct radix_tree_root nfs_page_tree; 167 struct radix_tree_root nfs_page_tree;
168 168
169 unsigned long ncommit, 169 unsigned long npages;
170 npages;
171 170
172 /* Open contexts for shared mmap writes */ 171 /* Open contexts for shared mmap writes */
173 struct list_head open_files; 172 struct list_head open_files;
@@ -186,6 +185,9 @@ struct nfs_inode {
186 fmode_t delegation_state; 185 fmode_t delegation_state;
187 struct rw_semaphore rwsem; 186 struct rw_semaphore rwsem;
188#endif /* CONFIG_NFS_V4*/ 187#endif /* CONFIG_NFS_V4*/
188#ifdef CONFIG_NFS_FSCACHE
189 struct fscache_cookie *fscache;
190#endif
189 struct inode vfs_inode; 191 struct inode vfs_inode;
190}; 192};
191 193
@@ -207,6 +209,9 @@ struct nfs_inode {
207#define NFS_INO_STALE (1) /* possible stale inode */ 209#define NFS_INO_STALE (1) /* possible stale inode */
208#define NFS_INO_ACL_LRU_SET (2) /* Inode is on the LRU list */ 210#define NFS_INO_ACL_LRU_SET (2) /* Inode is on the LRU list */
209#define NFS_INO_MOUNTPOINT (3) /* inode is remote mountpoint */ 211#define NFS_INO_MOUNTPOINT (3) /* inode is remote mountpoint */
212#define NFS_INO_FLUSHING (4) /* inode is flushing out data */
213#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */
214#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */
210 215
211static inline struct nfs_inode *NFS_I(const struct inode *inode) 216static inline struct nfs_inode *NFS_I(const struct inode *inode)
212{ 217{
@@ -260,6 +265,11 @@ static inline int NFS_STALE(const struct inode *inode)
260 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags); 265 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
261} 266}
262 267
268static inline int NFS_FSCACHE(const struct inode *inode)
269{
270 return test_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags);
271}
272
263static inline __u64 NFS_FILEID(const struct inode *inode) 273static inline __u64 NFS_FILEID(const struct inode *inode)
264{ 274{
265 return NFS_I(inode)->fileid; 275 return NFS_I(inode)->fileid;
@@ -415,7 +425,7 @@ extern const struct inode_operations nfs_dir_inode_operations;
415extern const struct inode_operations nfs3_dir_inode_operations; 425extern const struct inode_operations nfs3_dir_inode_operations;
416#endif /* CONFIG_NFS_V3 */ 426#endif /* CONFIG_NFS_V3 */
417extern const struct file_operations nfs_dir_operations; 427extern const struct file_operations nfs_dir_operations;
418extern struct dentry_operations nfs_dentry_operations; 428extern const struct dentry_operations nfs_dentry_operations;
419 429
420extern void nfs_force_lookup_revalidate(struct inode *dir); 430extern void nfs_force_lookup_revalidate(struct inode *dir);
421extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 431extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
@@ -506,6 +516,8 @@ extern int nfs_readpages(struct file *, struct address_space *,
506 struct list_head *, unsigned); 516 struct list_head *, unsigned);
507extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); 517extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
508extern void nfs_readdata_release(void *data); 518extern void nfs_readdata_release(void *data);
519extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
520 struct page *);
509 521
510/* 522/*
511 * Allocate nfs_read_data structures 523 * Allocate nfs_read_data structures
@@ -583,6 +595,7 @@ extern void * nfs_root_data(void);
583#define NFSDBG_CALLBACK 0x0100 595#define NFSDBG_CALLBACK 0x0100
584#define NFSDBG_CLIENT 0x0200 596#define NFSDBG_CLIENT 0x0200
585#define NFSDBG_MOUNT 0x0400 597#define NFSDBG_MOUNT 0x0400
598#define NFSDBG_FSCACHE 0x0800
586#define NFSDBG_ALL 0xFFFF 599#define NFSDBG_ALL 0xFFFF
587 600
588#ifdef __KERNEL__ 601#ifdef __KERNEL__
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 9bb81aec91cf..6ad75948cbf7 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -64,6 +64,10 @@ struct nfs_client {
64 char cl_ipaddr[48]; 64 char cl_ipaddr[48];
65 unsigned char cl_id_uniquifier; 65 unsigned char cl_id_uniquifier;
66#endif 66#endif
67
68#ifdef CONFIG_NFS_FSCACHE
69 struct fscache_cookie *fscache; /* client index cache cookie */
70#endif
67}; 71};
68 72
69/* 73/*
@@ -96,16 +100,28 @@ struct nfs_server {
96 unsigned int acdirmin; 100 unsigned int acdirmin;
97 unsigned int acdirmax; 101 unsigned int acdirmax;
98 unsigned int namelen; 102 unsigned int namelen;
103 unsigned int options; /* extra options enabled by mount */
104#define NFS_OPTION_FSCACHE 0x00000001 /* - local caching enabled */
99 105
100 struct nfs_fsid fsid; 106 struct nfs_fsid fsid;
101 __u64 maxfilesize; /* maximum file size */ 107 __u64 maxfilesize; /* maximum file size */
102 unsigned long mount_time; /* when this fs was mounted */ 108 unsigned long mount_time; /* when this fs was mounted */
103 dev_t s_dev; /* superblock dev numbers */ 109 dev_t s_dev; /* superblock dev numbers */
104 110
111#ifdef CONFIG_NFS_FSCACHE
112 struct nfs_fscache_key *fscache_key; /* unique key for superblock */
113 struct fscache_cookie *fscache; /* superblock cookie */
114#endif
115
105#ifdef CONFIG_NFS_V4 116#ifdef CONFIG_NFS_V4
106 u32 attr_bitmask[2];/* V4 bitmask representing the set 117 u32 attr_bitmask[2];/* V4 bitmask representing the set
107 of attributes supported on this 118 of attributes supported on this
108 filesystem */ 119 filesystem */
120 u32 cache_consistency_bitmask[2];
121 /* V4 bitmask representing the subset
122 of change attribute, size, ctime
123 and mtime attributes supported by
124 the server */
109 u32 acl_bitmask; /* V4 bitmask representing the ACEs 125 u32 acl_bitmask; /* V4 bitmask representing the ACEs
110 that are supported on this 126 that are supported on this
111 filesystem */ 127 filesystem */
diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h
index 1cb9a3fed2b3..68b10f5f8907 100644
--- a/include/linux/nfs_iostat.h
+++ b/include/linux/nfs_iostat.h
@@ -116,4 +116,16 @@ enum nfs_stat_eventcounters {
116 __NFSIOS_COUNTSMAX, 116 __NFSIOS_COUNTSMAX,
117}; 117};
118 118
119/*
120 * NFS local caching servicing counters
121 */
122enum nfs_stat_fscachecounters {
123 NFSIOS_FSCACHE_PAGES_READ_OK,
124 NFSIOS_FSCACHE_PAGES_READ_FAIL,
125 NFSIOS_FSCACHE_PAGES_WRITTEN_OK,
126 NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL,
127 NFSIOS_FSCACHE_PAGES_UNCACHED,
128 __NFSIOS_FSCACHEMAX,
129};
130
119#endif /* _LINUX_NFS_IOSTAT */ 131#endif /* _LINUX_NFS_IOSTAT */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index a550b528319f..b89c34e40bc2 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -27,12 +27,8 @@ static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid
27} 27}
28 28
29struct nfs_fattr { 29struct nfs_fattr {
30 unsigned short valid; /* which fields are valid */ 30 unsigned int valid; /* which fields are valid */
31 __u64 pre_size; /* pre_op_attr.size */ 31 umode_t mode;
32 struct timespec pre_mtime; /* pre_op_attr.mtime */
33 struct timespec pre_ctime; /* pre_op_attr.ctime */
34 enum nfs_ftype type; /* always use NFSv2 types */
35 __u32 mode;
36 __u32 nlink; 32 __u32 nlink;
37 __u32 uid; 33 __u32 uid;
38 __u32 gid; 34 __u32 gid;
@@ -52,19 +48,55 @@ struct nfs_fattr {
52 struct timespec atime; 48 struct timespec atime;
53 struct timespec mtime; 49 struct timespec mtime;
54 struct timespec ctime; 50 struct timespec ctime;
55 __u32 bitmap[2]; /* NFSv4 returned attribute bitmap */
56 __u64 change_attr; /* NFSv4 change attribute */ 51 __u64 change_attr; /* NFSv4 change attribute */
57 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ 52 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
53 __u64 pre_size; /* pre_op_attr.size */
54 struct timespec pre_mtime; /* pre_op_attr.mtime */
55 struct timespec pre_ctime; /* pre_op_attr.ctime */
58 unsigned long time_start; 56 unsigned long time_start;
59 unsigned long gencount; 57 unsigned long gencount;
60}; 58};
61 59
62#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ 60#define NFS_ATTR_FATTR_TYPE (1U << 0)
63#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ 61#define NFS_ATTR_FATTR_MODE (1U << 1)
64#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ 62#define NFS_ATTR_FATTR_NLINK (1U << 2)
65#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */ 63#define NFS_ATTR_FATTR_OWNER (1U << 3)
66#define NFS_ATTR_WCC_V4 0x0010 /* pre-op change attribute */ 64#define NFS_ATTR_FATTR_GROUP (1U << 4)
67#define NFS_ATTR_FATTR_V4_REFERRAL 0x0020 /* NFSv4 referral */ 65#define NFS_ATTR_FATTR_RDEV (1U << 5)
66#define NFS_ATTR_FATTR_SIZE (1U << 6)
67#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
68#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
69#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
70#define NFS_ATTR_FATTR_FSID (1U << 10)
71#define NFS_ATTR_FATTR_FILEID (1U << 11)
72#define NFS_ATTR_FATTR_ATIME (1U << 12)
73#define NFS_ATTR_FATTR_MTIME (1U << 13)
74#define NFS_ATTR_FATTR_CTIME (1U << 14)
75#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
76#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
77#define NFS_ATTR_FATTR_CHANGE (1U << 17)
78#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
79#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
80
81#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
82 | NFS_ATTR_FATTR_MODE \
83 | NFS_ATTR_FATTR_NLINK \
84 | NFS_ATTR_FATTR_OWNER \
85 | NFS_ATTR_FATTR_GROUP \
86 | NFS_ATTR_FATTR_RDEV \
87 | NFS_ATTR_FATTR_SIZE \
88 | NFS_ATTR_FATTR_FSID \
89 | NFS_ATTR_FATTR_FILEID \
90 | NFS_ATTR_FATTR_ATIME \
91 | NFS_ATTR_FATTR_MTIME \
92 | NFS_ATTR_FATTR_CTIME)
93#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
94 | NFS_ATTR_FATTR_BLOCKS_USED)
95#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
96 | NFS_ATTR_FATTR_SPACE_USED)
97#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
98 | NFS_ATTR_FATTR_SPACE_USED \
99 | NFS_ATTR_FATTR_CHANGE)
68 100
69/* 101/*
70 * Info on the file system 102 * Info on the file system
@@ -406,6 +438,8 @@ struct nfs3_setaclargs {
406 int mask; 438 int mask;
407 struct posix_acl * acl_access; 439 struct posix_acl * acl_access;
408 struct posix_acl * acl_default; 440 struct posix_acl * acl_default;
441 size_t len;
442 unsigned int npages;
409 struct page ** pages; 443 struct page ** pages;
410}; 444};
411 445
@@ -783,7 +817,7 @@ struct nfs_access_entry;
783 */ 817 */
784struct nfs_rpc_ops { 818struct nfs_rpc_ops {
785 u32 version; /* Protocol version */ 819 u32 version; /* Protocol version */
786 struct dentry_operations *dentry_ops; 820 const struct dentry_operations *dentry_ops;
787 const struct inode_operations *dir_inode_ops; 821 const struct inode_operations *dir_inode_ops;
788 const struct inode_operations *file_inode_ops; 822 const struct inode_operations *file_inode_ops;
789 823
@@ -834,6 +868,7 @@ struct nfs_rpc_ops {
834 int (*lock)(struct file *, int, struct file_lock *); 868 int (*lock)(struct file *, int, struct file_lock *);
835 int (*lock_check_bounds)(const struct file_lock *); 869 int (*lock_check_bounds)(const struct file_lock *);
836 void (*clear_acl_cache)(struct inode *); 870 void (*clear_acl_cache)(struct inode *);
871 void (*close_context)(struct nfs_open_context *ctx, int);
837}; 872};
838 873
839/* 874/*
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h
index 54487a99beb8..43011b69297c 100644
--- a/include/linux/nfsacl.h
+++ b/include/linux/nfsacl.h
@@ -37,6 +37,9 @@
37#define NFSACL_MAXPAGES ((2*(8+12*NFS_ACL_MAX_ENTRIES) + PAGE_SIZE-1) \ 37#define NFSACL_MAXPAGES ((2*(8+12*NFS_ACL_MAX_ENTRIES) + PAGE_SIZE-1) \
38 >> PAGE_SHIFT) 38 >> PAGE_SHIFT)
39 39
40#define NFS_ACL_MAX_ENTRIES_INLINE (5)
41#define NFS_ACL_INLINE_BUFSIZE ((2*(2+3*NFS_ACL_MAX_ENTRIES_INLINE)) << 2)
42
40static inline unsigned int 43static inline unsigned int
41nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default) 44nfsacl_size(struct posix_acl *acl_access, struct posix_acl *acl_default)
42{ 45{
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/nl80211.h b/include/linux/nl80211.h
index e86ed59f9ad5..cbe8ce3bf486 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -47,7 +47,7 @@
47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or 47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
48 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, 48 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or 49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or
50 * %NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET. 50 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE.
51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
53 * %NL80211_ATTR_WIPHY_NAME. 53 * %NL80211_ATTR_WIPHY_NAME.
@@ -72,8 +72,8 @@
72 * 72 *
73 * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified 73 * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified
74 * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. 74 * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC.
75 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT or 75 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
76 * %NL80211_ATTR_KEY_THRESHOLD. 76 * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
77 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, 77 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
78 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER 78 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER
79 * attributes. 79 * attributes.
@@ -84,7 +84,7 @@
84 * %NL80222_CMD_NEW_BEACON message) 84 * %NL80222_CMD_NEW_BEACON message)
85 * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface 85 * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface
86 * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, 86 * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD,
87 * %NL80211_BEACON_HEAD and %NL80211_BEACON_TAIL attributes. 87 * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes.
88 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, 88 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface,
89 * parameters are like for %NL80211_CMD_SET_BEACON. 89 * parameters are like for %NL80211_CMD_SET_BEACON.
90 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it 90 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
@@ -113,6 +113,8 @@
113 * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by 113 * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by
114 * %NL80211_ATTR_IFINDEX. 114 * %NL80211_ATTR_IFINDEX.
115 * 115 *
116 * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set
117 * regulatory domain.
116 * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command 118 * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
117 * after being queried by the kernel. CRDA replies by sending a regulatory 119 * after being queried by the kernel. CRDA replies by sending a regulatory
118 * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our 120 * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
@@ -133,6 +135,70 @@
133 * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the 135 * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the
134 * interface identified by %NL80211_ATTR_IFINDEX 136 * interface identified by %NL80211_ATTR_IFINDEX
135 * 137 *
138 * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The
139 * interface is identified with %NL80211_ATTR_IFINDEX and the management
140 * frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be
141 * added to the end of the specified management frame is specified with
142 * %NL80211_ATTR_IE. If the command succeeds, the requested data will be
143 * added to all specified management frames generated by
144 * kernel/firmware/driver.
145 * Note: This command has been removed and it is only reserved at this
146 * point to avoid re-using existing command number. The functionality this
147 * command was planned for has been provided with cleaner design with the
148 * option to specify additional IEs in NL80211_CMD_TRIGGER_SCAN,
149 * NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE,
150 * NL80211_CMD_DEAUTHENTICATE, and NL80211_CMD_DISASSOCIATE.
151 *
152 * @NL80211_CMD_GET_SCAN: get scan results
153 * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
154 * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
155 * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
156 * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
157 * partial scan results may be available
158 *
159 * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain
160 * has been changed and provides details of the request information
161 * that caused the change such as who initiated the regulatory request
162 * (%NL80211_ATTR_REG_INITIATOR), the wiphy_idx
163 * (%NL80211_ATTR_REG_ALPHA2) on which the request was made from if
164 * the initiator was %NL80211_REGDOM_SET_BY_COUNTRY_IE or
165 * %NL80211_REGDOM_SET_BY_DRIVER, the type of regulatory domain
166 * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is
167 * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on
168 * to (%NL80211_ATTR_REG_ALPHA2).
169 *
170 * @NL80211_CMD_AUTHENTICATE: authentication request and notification.
171 * This command is used both as a command (request to authenticate) and
172 * as an event on the "mlme" multicast group indicating completion of the
173 * authentication process.
174 * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the
175 * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and
176 * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify
177 * the SSID (mainly for association, but is included in authentication
178 * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used
179 * to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE
180 * is used to specify the authentication type. %NL80211_ATTR_IE is used to
181 * define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs)
182 * to be added to the frame.
183 * When used as an event, this reports reception of an Authentication
184 * frame in station and IBSS modes when the local MLME processed the
185 * frame, i.e., it was for the local STA and was received in correct
186 * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the
187 * MLME SAP interface (kernel providing MLME, userspace SME). The
188 * included NL80211_ATTR_FRAME attribute contains the management frame
189 * (including both the header and frame body, but not FCS).
190 * @NL80211_CMD_ASSOCIATE: association request and notification; like
191 * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
192 * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
193 * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
194 * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
195 * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
196 * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
197 * primitives).
198 * @NL80211_CMD_DISASSOCIATE: disassociation request and notification; like
199 * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to
200 * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives).
201 *
136 * @NL80211_CMD_MAX: highest used command number 202 * @NL80211_CMD_MAX: highest used command number
137 * @__NL80211_CMD_AFTER_LAST: internal use 203 * @__NL80211_CMD_AFTER_LAST: internal use
138 */ 204 */
@@ -178,6 +244,22 @@ enum nl80211_commands {
178 NL80211_CMD_GET_MESH_PARAMS, 244 NL80211_CMD_GET_MESH_PARAMS,
179 NL80211_CMD_SET_MESH_PARAMS, 245 NL80211_CMD_SET_MESH_PARAMS,
180 246
247 NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */,
248
249 NL80211_CMD_GET_REG,
250
251 NL80211_CMD_GET_SCAN,
252 NL80211_CMD_TRIGGER_SCAN,
253 NL80211_CMD_NEW_SCAN_RESULTS,
254 NL80211_CMD_SCAN_ABORTED,
255
256 NL80211_CMD_REG_CHANGE,
257
258 NL80211_CMD_AUTHENTICATE,
259 NL80211_CMD_ASSOCIATE,
260 NL80211_CMD_DEAUTHENTICATE,
261 NL80211_CMD_DISASSOCIATE,
262
181 /* add new commands above here */ 263 /* add new commands above here */
182 264
183 /* used to define NL80211_CMD_MAX below */ 265 /* used to define NL80211_CMD_MAX below */
@@ -190,6 +272,12 @@ enum nl80211_commands {
190 * here 272 * here
191 */ 273 */
192#define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS 274#define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS
275#define NL80211_CMD_SET_MGMT_EXTRA_IE NL80211_CMD_SET_MGMT_EXTRA_IE
276#define NL80211_CMD_REG_CHANGE NL80211_CMD_REG_CHANGE
277#define NL80211_CMD_AUTHENTICATE NL80211_CMD_AUTHENTICATE
278#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE
279#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE
280#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
193 281
194/** 282/**
195 * enum nl80211_attrs - nl80211 netlink attributes 283 * enum nl80211_attrs - nl80211 netlink attributes
@@ -284,6 +372,42 @@ enum nl80211_commands {
284 * supported interface types, each a flag attribute with the number 372 * supported interface types, each a flag attribute with the number
285 * of the interface mode. 373 * of the interface mode.
286 * 374 *
375 * @NL80211_ATTR_MGMT_SUBTYPE: Management frame subtype for
376 * %NL80211_CMD_SET_MGMT_EXTRA_IE.
377 *
378 * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with
379 * %NL80211_CMD_SET_MGMT_EXTRA_IE).
380 *
381 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
382 * a single scan request, a wiphy attribute.
383 *
384 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
385 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
386 * scanning and include a zero-length SSID (wildcard) for wildcard scan
387 * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the
388 * scan result list changes (BSS expired or added) so that applications
389 * can verify that they got a single, consistent snapshot (when all dump
390 * messages carried the same generation number)
391 * @NL80211_ATTR_BSS: scan result BSS
392 *
393 * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain
394 * currently in effect. This could be any of the %NL80211_REGDOM_SET_BY_*
395 * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently
396 * set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*)
397 *
398 * @NL80211_ATTR_SUPPORTED_COMMANDS: wiphy attribute that specifies
399 * an array of command numbers (i.e. a mapping index to command number)
400 * that the driver for the given wiphy supports.
401 *
402 * @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header
403 * and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and
404 * NL80211_CMD_ASSOCIATE events
405 * @NL80211_ATTR_SSID: SSID (binary attribute, 0..32 octets)
406 * @NL80211_ATTR_AUTH_TYPE: AuthenticationType, see &enum nl80211_auth_type,
407 * represented as a u32
408 * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and
409 * %NL80211_CMD_DISASSOCIATE, u16
410 *
287 * @NL80211_ATTR_MAX: highest attribute number currently defined 411 * @NL80211_ATTR_MAX: highest attribute number currently defined
288 * @__NL80211_ATTR_AFTER_LAST: internal use 412 * @__NL80211_ATTR_AFTER_LAST: internal use
289 */ 413 */
@@ -346,6 +470,28 @@ enum nl80211_attrs {
346 NL80211_ATTR_WIPHY_FREQ, 470 NL80211_ATTR_WIPHY_FREQ,
347 NL80211_ATTR_WIPHY_CHANNEL_TYPE, 471 NL80211_ATTR_WIPHY_CHANNEL_TYPE,
348 472
473 NL80211_ATTR_KEY_DEFAULT_MGMT,
474
475 NL80211_ATTR_MGMT_SUBTYPE,
476 NL80211_ATTR_IE,
477
478 NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
479
480 NL80211_ATTR_SCAN_FREQUENCIES,
481 NL80211_ATTR_SCAN_SSIDS,
482 NL80211_ATTR_SCAN_GENERATION,
483 NL80211_ATTR_BSS,
484
485 NL80211_ATTR_REG_INITIATOR,
486 NL80211_ATTR_REG_TYPE,
487
488 NL80211_ATTR_SUPPORTED_COMMANDS,
489
490 NL80211_ATTR_FRAME,
491 NL80211_ATTR_SSID,
492 NL80211_ATTR_AUTH_TYPE,
493 NL80211_ATTR_REASON_CODE,
494
349 /* add attributes here, update the policy in nl80211.c */ 495 /* add attributes here, update the policy in nl80211.c */
350 496
351 __NL80211_ATTR_AFTER_LAST, 497 __NL80211_ATTR_AFTER_LAST,
@@ -360,7 +506,15 @@ enum nl80211_attrs {
360#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES 506#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
361#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS 507#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
362#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ 508#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ
363#define NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET 509#define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE
510#define NL80211_ATTR_MGMT_SUBTYPE NL80211_ATTR_MGMT_SUBTYPE
511#define NL80211_ATTR_IE NL80211_ATTR_IE
512#define NL80211_ATTR_REG_INITIATOR NL80211_ATTR_REG_INITIATOR
513#define NL80211_ATTR_REG_TYPE NL80211_ATTR_REG_TYPE
514#define NL80211_ATTR_FRAME NL80211_ATTR_FRAME
515#define NL80211_ATTR_SSID NL80211_ATTR_SSID
516#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE
517#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE
364 518
365#define NL80211_MAX_SUPP_RATES 32 519#define NL80211_MAX_SUPP_RATES 32
366#define NL80211_MAX_SUPP_REG_RULES 32 520#define NL80211_MAX_SUPP_REG_RULES 32
@@ -412,12 +566,14 @@ enum nl80211_iftype {
412 * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames 566 * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
413 * with short barker preamble 567 * with short barker preamble
414 * @NL80211_STA_FLAG_WME: station is WME/QoS capable 568 * @NL80211_STA_FLAG_WME: station is WME/QoS capable
569 * @NL80211_STA_FLAG_MFP: station uses management frame protection
415 */ 570 */
416enum nl80211_sta_flags { 571enum nl80211_sta_flags {
417 __NL80211_STA_FLAG_INVALID, 572 __NL80211_STA_FLAG_INVALID,
418 NL80211_STA_FLAG_AUTHORIZED, 573 NL80211_STA_FLAG_AUTHORIZED,
419 NL80211_STA_FLAG_SHORT_PREAMBLE, 574 NL80211_STA_FLAG_SHORT_PREAMBLE,
420 NL80211_STA_FLAG_WME, 575 NL80211_STA_FLAG_WME,
576 NL80211_STA_FLAG_MFP,
421 577
422 /* keep last */ 578 /* keep last */
423 __NL80211_STA_FLAG_AFTER_LAST, 579 __NL80211_STA_FLAG_AFTER_LAST,
@@ -465,6 +621,9 @@ enum nl80211_rate_info {
465 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) 621 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
466 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute 622 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
467 * containing info as possible, see &enum nl80211_sta_info_txrate. 623 * containing info as possible, see &enum nl80211_sta_info_txrate.
624 * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station)
625 * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this
626 * station)
468 */ 627 */
469enum nl80211_sta_info { 628enum nl80211_sta_info {
470 __NL80211_STA_INFO_INVALID, 629 __NL80211_STA_INFO_INVALID,
@@ -476,6 +635,8 @@ enum nl80211_sta_info {
476 NL80211_STA_INFO_PLINK_STATE, 635 NL80211_STA_INFO_PLINK_STATE,
477 NL80211_STA_INFO_SIGNAL, 636 NL80211_STA_INFO_SIGNAL,
478 NL80211_STA_INFO_TX_BITRATE, 637 NL80211_STA_INFO_TX_BITRATE,
638 NL80211_STA_INFO_RX_PACKETS,
639 NL80211_STA_INFO_TX_PACKETS,
479 640
480 /* keep last */ 641 /* keep last */
481 __NL80211_STA_INFO_AFTER_LAST, 642 __NL80211_STA_INFO_AFTER_LAST,
@@ -607,6 +768,48 @@ enum nl80211_bitrate_attr {
607}; 768};
608 769
609/** 770/**
771 * enum nl80211_initiator - Indicates the initiator of a reg domain request
772 * @NL80211_REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world
773 * regulatory domain.
774 * @NL80211_REGDOM_SET_BY_USER: User asked the wireless core to set the
775 * regulatory domain.
776 * @NL80211_REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the
777 * wireless core it thinks its knows the regulatory domain we should be in.
778 * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an
779 * 802.11 country information element with regulatory information it
780 * thinks we should consider.
781 */
782enum nl80211_reg_initiator {
783 NL80211_REGDOM_SET_BY_CORE,
784 NL80211_REGDOM_SET_BY_USER,
785 NL80211_REGDOM_SET_BY_DRIVER,
786 NL80211_REGDOM_SET_BY_COUNTRY_IE,
787};
788
789/**
790 * enum nl80211_reg_type - specifies the type of regulatory domain
791 * @NL80211_REGDOM_TYPE_COUNTRY: the regulatory domain set is one that pertains
792 * to a specific country. When this is set you can count on the
793 * ISO / IEC 3166 alpha2 country code being valid.
794 * @NL80211_REGDOM_TYPE_WORLD: the regulatory set domain is the world regulatory
795 * domain.
796 * @NL80211_REGDOM_TYPE_CUSTOM_WORLD: the regulatory domain set is a custom
797 * driver specific world regulatory domain. These do not apply system-wide
798 * and are only applicable to the individual devices which have requested
799 * them to be applied.
800 * @NL80211_REGDOM_TYPE_INTERSECTION: the regulatory domain set is the product
801 * of an intersection between two regulatory domains -- the previously
802 * set regulatory domain on the system and the last accepted regulatory
803 * domain request to be processed.
804 */
805enum nl80211_reg_type {
806 NL80211_REGDOM_TYPE_COUNTRY,
807 NL80211_REGDOM_TYPE_WORLD,
808 NL80211_REGDOM_TYPE_CUSTOM_WORLD,
809 NL80211_REGDOM_TYPE_INTERSECTION,
810};
811
812/**
610 * enum nl80211_reg_rule_attr - regulatory rule attributes 813 * enum nl80211_reg_rule_attr - regulatory rule attributes
611 * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional 814 * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional
612 * considerations for a given frequency range. These are the 815 * considerations for a given frequency range. These are the
@@ -811,4 +1014,52 @@ enum nl80211_channel_type {
811 NL80211_CHAN_HT40MINUS, 1014 NL80211_CHAN_HT40MINUS,
812 NL80211_CHAN_HT40PLUS 1015 NL80211_CHAN_HT40PLUS
813}; 1016};
1017
1018/**
1019 * enum nl80211_bss - netlink attributes for a BSS
1020 *
1021 * @__NL80211_BSS_INVALID: invalid
1022 * @NL80211_BSS_FREQUENCY: frequency in MHz (u32)
1023 * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64)
1024 * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16)
1025 * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16)
1026 * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the
1027 * raw information elements from the probe response/beacon (bin)
1028 * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon
1029 * in mBm (100 * dBm) (s32)
1030 * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
1031 * in unspecified units, scaled to 0..100 (u8)
1032 * @__NL80211_BSS_AFTER_LAST: internal
1033 * @NL80211_BSS_MAX: highest BSS attribute
1034 */
1035enum nl80211_bss {
1036 __NL80211_BSS_INVALID,
1037 NL80211_BSS_BSSID,
1038 NL80211_BSS_FREQUENCY,
1039 NL80211_BSS_TSF,
1040 NL80211_BSS_BEACON_INTERVAL,
1041 NL80211_BSS_CAPABILITY,
1042 NL80211_BSS_INFORMATION_ELEMENTS,
1043 NL80211_BSS_SIGNAL_MBM,
1044 NL80211_BSS_SIGNAL_UNSPEC,
1045
1046 /* keep last */
1047 __NL80211_BSS_AFTER_LAST,
1048 NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1
1049};
1050
1051/**
1052 * enum nl80211_auth_type - AuthenticationType
1053 *
1054 * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication
1055 * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only)
1056 * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
1057 * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
1058 */
1059enum nl80211_auth_type {
1060 NL80211_AUTHTYPE_OPEN_SYSTEM,
1061 NL80211_AUTHTYPE_SHARED_KEY,
1062 NL80211_AUTHTYPE_FT,
1063 NL80211_AUTHTYPE_NETWORK_EAP,
1064};
814#endif /* __LINUX_NL80211_H */ 1065#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nls.h b/include/linux/nls.h
index 6a882208301a..52b1a76c1b43 100644
--- a/include/linux/nls.h
+++ b/include/linux/nls.h
@@ -58,6 +58,25 @@ static inline int nls_strnicmp(struct nls_table *t, const unsigned char *s1,
58 return 0; 58 return 0;
59} 59}
60 60
61/*
62 * nls_nullsize - return length of null character for codepage
63 * @codepage - codepage for which to return length of NULL terminator
64 *
65 * Since we can't guarantee that the null terminator will be a particular
66 * length, we have to check against the codepage. If there's a problem
67 * determining it, assume a single-byte NULL terminator.
68 */
69static inline int
70nls_nullsize(const struct nls_table *codepage)
71{
72 int charlen;
73 char tmp[NLS_MAX_CHARSET_SIZE];
74
75 charlen = codepage->uni2char(0, tmp, NLS_MAX_CHARSET_SIZE);
76
77 return charlen > 0 ? charlen : 1;
78}
79
61#define MODULE_ALIAS_NLS(name) MODULE_ALIAS("nls_" __stringify(name)) 80#define MODULE_ALIAS_NLS(name) MODULE_ALIAS("nls_" __stringify(name))
62 81
63#endif /* _LINUX_NLS_H */ 82#endif /* _LINUX_NLS_H */
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index afad7dec1b36..7b370c7cfeff 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -8,6 +8,7 @@ struct mnt_namespace;
8struct uts_namespace; 8struct uts_namespace;
9struct ipc_namespace; 9struct ipc_namespace;
10struct pid_namespace; 10struct pid_namespace;
11struct fs_struct;
11 12
12/* 13/*
13 * A structure to contain pointers to all per-process 14 * A structure to contain pointers to all per-process
diff --git a/include/linux/nubus.h b/include/linux/nubus.h
index 7382af374731..e137b3c486a7 100644
--- a/include/linux/nubus.h
+++ b/include/linux/nubus.h
@@ -237,6 +237,7 @@ struct nubus_dirent
237 int mask; 237 int mask;
238}; 238};
239 239
240#ifdef __KERNEL__
240struct nubus_board { 241struct nubus_board {
241 struct nubus_board* next; 242 struct nubus_board* next;
242 struct nubus_dev* first_dev; 243 struct nubus_dev* first_dev;
@@ -351,6 +352,7 @@ void nubus_get_rsrc_mem(void* dest,
351void nubus_get_rsrc_str(void* dest, 352void nubus_get_rsrc_str(void* dest,
352 const struct nubus_dirent *dirent, 353 const struct nubus_dirent *dirent,
353 int maxlen); 354 int maxlen);
355#endif /* __KERNEL__ */
354 356
355/* We'd like to get rid of this eventually. Only daynaport.c uses it now. */ 357/* We'd like to get rid of this eventually. Only daynaport.c uses it now. */
356static inline void *nubus_slot_addr(int slot) 358static inline void *nubus_slot_addr(int slot)
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 3d327b67d7e2..908406651330 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -51,6 +51,16 @@ extern int of_register_driver(struct of_platform_driver *drv,
51 struct bus_type *bus); 51 struct bus_type *bus);
52extern void of_unregister_driver(struct of_platform_driver *drv); 52extern void of_unregister_driver(struct of_platform_driver *drv);
53 53
54/* Platform drivers register/unregister */
55static inline int of_register_platform_driver(struct of_platform_driver *drv)
56{
57 return of_register_driver(drv, &of_platform_bus_type);
58}
59static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
60{
61 of_unregister_driver(drv);
62}
63
54#include <asm/of_platform.h> 64#include <asm/of_platform.h>
55 65
56extern struct of_device *of_find_device_by_node(struct device_node *np); 66extern struct of_device *of_find_device_by_node(struct device_node *np);
diff --git a/include/linux/page-debug-flags.h b/include/linux/page-debug-flags.h
new file mode 100644
index 000000000000..b0638fd91e92
--- /dev/null
+++ b/include/linux/page-debug-flags.h
@@ -0,0 +1,30 @@
1#ifndef LINUX_PAGE_DEBUG_FLAGS_H
2#define LINUX_PAGE_DEBUG_FLAGS_H
3
4/*
5 * page->debug_flags bits:
6 *
7 * PAGE_DEBUG_FLAG_POISON is set for poisoned pages. This is used to
8 * implement generic debug pagealloc feature. The pages are filled with
9 * poison patterns and set this flag after free_pages(). The poisoned
10 * pages are verified whether the patterns are not corrupted and clear
11 * the flag before alloc_pages().
12 */
13
14enum page_debug_flags {
15 PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */
16};
17
18/*
19 * Ensure that CONFIG_WANT_PAGE_DEBUG_FLAGS reliably
20 * gets turned off when no debug features are enabling it!
21 */
22
23#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
24#if !defined(CONFIG_PAGE_POISONING) \
25/* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */
26#error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features!
27#endif
28#endif /* CONFIG_WANT_PAGE_DEBUG_FLAGS */
29
30#endif /* LINUX_PAGE_DEBUG_FLAGS_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 219a523ecdb0..62214c7d2d93 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -82,6 +82,7 @@ enum pageflags {
82 PG_arch_1, 82 PG_arch_1,
83 PG_reserved, 83 PG_reserved,
84 PG_private, /* If pagecache, has fs-private data */ 84 PG_private, /* If pagecache, has fs-private data */
85 PG_private_2, /* If pagecache, has fs aux data */
85 PG_writeback, /* Page is under writeback */ 86 PG_writeback, /* Page is under writeback */
86#ifdef CONFIG_PAGEFLAGS_EXTENDED 87#ifdef CONFIG_PAGEFLAGS_EXTENDED
87 PG_head, /* A head page */ 88 PG_head, /* A head page */
@@ -96,6 +97,8 @@ enum pageflags {
96 PG_swapbacked, /* Page is backed by RAM/swap */ 97 PG_swapbacked, /* Page is backed by RAM/swap */
97#ifdef CONFIG_UNEVICTABLE_LRU 98#ifdef CONFIG_UNEVICTABLE_LRU
98 PG_unevictable, /* Page is "unevictable" */ 99 PG_unevictable, /* Page is "unevictable" */
100#endif
101#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
99 PG_mlocked, /* Page is vma mlocked */ 102 PG_mlocked, /* Page is vma mlocked */
100#endif 103#endif
101#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 104#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
@@ -106,6 +109,12 @@ enum pageflags {
106 /* Filesystems */ 109 /* Filesystems */
107 PG_checked = PG_owner_priv_1, 110 PG_checked = PG_owner_priv_1,
108 111
112 /* Two page bits are conscripted by FS-Cache to maintain local caching
113 * state. These bits are set on pages belonging to the netfs's inodes
114 * when those inodes are being locally cached.
115 */
116 PG_fscache = PG_private_2, /* page backed by cache */
117
109 /* XEN */ 118 /* XEN */
110 PG_pinned = PG_owner_priv_1, 119 PG_pinned = PG_owner_priv_1,
111 PG_savepinned = PG_dirty, 120 PG_savepinned = PG_dirty,
@@ -180,7 +189,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; }
180 189
181struct page; /* forward declaration */ 190struct page; /* forward declaration */
182 191
183TESTPAGEFLAG(Locked, locked) 192TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked)
184PAGEFLAG(Error, error) 193PAGEFLAG(Error, error)
185PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) 194PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
186PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) 195PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
@@ -192,8 +201,6 @@ PAGEFLAG(Checked, checked) /* Used by some filesystems */
192PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */ 201PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */
193PAGEFLAG(SavePinned, savepinned); /* Xen */ 202PAGEFLAG(SavePinned, savepinned); /* Xen */
194PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) 203PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
195PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
196 __SETPAGEFLAG(Private, private)
197PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) 204PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
198 205
199__PAGEFLAG(SlobPage, slob_page) 206__PAGEFLAG(SlobPage, slob_page)
@@ -203,6 +210,16 @@ __PAGEFLAG(SlubFrozen, slub_frozen)
203__PAGEFLAG(SlubDebug, slub_debug) 210__PAGEFLAG(SlubDebug, slub_debug)
204 211
205/* 212/*
213 * Private page markings that may be used by the filesystem that owns the page
214 * for its own purposes.
215 * - PG_private and PG_private_2 cause releasepage() and co to be invoked
216 */
217PAGEFLAG(Private, private) __SETPAGEFLAG(Private, private)
218 __CLEARPAGEFLAG(Private, private)
219PAGEFLAG(Private2, private_2) TESTSCFLAG(Private2, private_2)
220PAGEFLAG(OwnerPriv1, owner_priv_1) TESTCLEARFLAG(OwnerPriv1, owner_priv_1)
221
222/*
206 * Only test-and-set exist for PG_writeback. The unconditional operators are 223 * Only test-and-set exist for PG_writeback. The unconditional operators are
207 * risky: they bypass page accounting. 224 * risky: they bypass page accounting.
208 */ 225 */
@@ -234,20 +251,20 @@ PAGEFLAG_FALSE(SwapCache)
234#ifdef CONFIG_UNEVICTABLE_LRU 251#ifdef CONFIG_UNEVICTABLE_LRU
235PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) 252PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
236 TESTCLEARFLAG(Unevictable, unevictable) 253 TESTCLEARFLAG(Unevictable, unevictable)
254#else
255PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable)
256 SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable)
257 __CLEARPAGEFLAG_NOOP(Unevictable)
258#endif
237 259
260#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
238#define MLOCK_PAGES 1 261#define MLOCK_PAGES 1
239PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) 262PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
240 TESTSCFLAG(Mlocked, mlocked) 263 TESTSCFLAG(Mlocked, mlocked)
241
242#else 264#else
243
244#define MLOCK_PAGES 0 265#define MLOCK_PAGES 0
245PAGEFLAG_FALSE(Mlocked) 266PAGEFLAG_FALSE(Mlocked)
246 SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked) 267 SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked)
247
248PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable)
249 SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable)
250 __CLEARPAGEFLAG_NOOP(Unevictable)
251#endif 268#endif
252 269
253#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 270#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
@@ -367,9 +384,13 @@ static inline void __ClearPageTail(struct page *page)
367 384
368#ifdef CONFIG_UNEVICTABLE_LRU 385#ifdef CONFIG_UNEVICTABLE_LRU
369#define __PG_UNEVICTABLE (1 << PG_unevictable) 386#define __PG_UNEVICTABLE (1 << PG_unevictable)
370#define __PG_MLOCKED (1 << PG_mlocked)
371#else 387#else
372#define __PG_UNEVICTABLE 0 388#define __PG_UNEVICTABLE 0
389#endif
390
391#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
392#define __PG_MLOCKED (1 << PG_mlocked)
393#else
373#define __PG_MLOCKED 0 394#define __PG_MLOCKED 0
374#endif 395#endif
375 396
@@ -378,9 +399,10 @@ static inline void __ClearPageTail(struct page *page)
378 * these flags set. It they are, there is a problem. 399 * these flags set. It they are, there is a problem.
379 */ 400 */
380#define PAGE_FLAGS_CHECK_AT_FREE \ 401#define PAGE_FLAGS_CHECK_AT_FREE \
381 (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \ 402 (1 << PG_lru | 1 << PG_locked | \
382 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ 403 1 << PG_private | 1 << PG_private_2 | \
383 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 404 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
405 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
384 __PG_UNEVICTABLE | __PG_MLOCKED) 406 __PG_UNEVICTABLE | __PG_MLOCKED)
385 407
386/* 408/*
@@ -391,4 +413,16 @@ static inline void __ClearPageTail(struct page *page)
391#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) 413#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)
392 414
393#endif /* !__GENERATING_BOUNDS_H */ 415#endif /* !__GENERATING_BOUNDS_H */
416
417/**
418 * page_has_private - Determine if page has private stuff
419 * @page: The page to be checked
420 *
421 * Determine if a page has private stuff, indicating that release routines
422 * should be invoked upon it.
423 */
424#define page_has_private(page) \
425 ((page)->flags & ((1 << PG_private) | \
426 (1 << PG_private_2)))
427
394#endif /* PAGE_FLAGS_H */ 428#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 602cc1fdee90..7339c7bf7331 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -91,24 +91,23 @@ static inline void page_cgroup_init(void)
91 91
92#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 92#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
93#include <linux/swap.h> 93#include <linux/swap.h>
94extern struct mem_cgroup * 94extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
95swap_cgroup_record(swp_entry_t ent, struct mem_cgroup *mem); 95extern unsigned short lookup_swap_cgroup(swp_entry_t ent);
96extern struct mem_cgroup *lookup_swap_cgroup(swp_entry_t ent);
97extern int swap_cgroup_swapon(int type, unsigned long max_pages); 96extern int swap_cgroup_swapon(int type, unsigned long max_pages);
98extern void swap_cgroup_swapoff(int type); 97extern void swap_cgroup_swapoff(int type);
99#else 98#else
100#include <linux/swap.h> 99#include <linux/swap.h>
101 100
102static inline 101static inline
103struct mem_cgroup *swap_cgroup_record(swp_entry_t ent, struct mem_cgroup *mem) 102unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
104{ 103{
105 return NULL; 104 return 0;
106} 105}
107 106
108static inline 107static inline
109struct mem_cgroup *lookup_swap_cgroup(swp_entry_t ent) 108unsigned short lookup_swap_cgroup(swp_entry_t ent)
110{ 109{
111 return NULL; 110 return 0;
112} 111}
113 112
114static inline int 113static inline int
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 01ca0856caff..34da5230faab 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -18,9 +18,14 @@
18 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page 18 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page
19 * allocation mode flags. 19 * allocation mode flags.
20 */ 20 */
21#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */ 21enum mapping_flags {
22#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */ 22 AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */
23#define AS_MM_ALL_LOCKS (__GFP_BITS_SHIFT + 2) /* under mm_take_all_locks() */ 23 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */
24 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
25#ifdef CONFIG_UNEVICTABLE_LRU
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27#endif
28};
24 29
25static inline void mapping_set_error(struct address_space *mapping, int error) 30static inline void mapping_set_error(struct address_space *mapping, int error)
26{ 31{
@@ -33,7 +38,6 @@ static inline void mapping_set_error(struct address_space *mapping, int error)
33} 38}
34 39
35#ifdef CONFIG_UNEVICTABLE_LRU 40#ifdef CONFIG_UNEVICTABLE_LRU
36#define AS_UNEVICTABLE (__GFP_BITS_SHIFT + 2) /* e.g., ramdisk, SHM_LOCK */
37 41
38static inline void mapping_set_unevictable(struct address_space *mapping) 42static inline void mapping_set_unevictable(struct address_space *mapping)
39{ 43{
@@ -380,6 +384,11 @@ static inline void wait_on_page_writeback(struct page *page)
380extern void end_page_writeback(struct page *page); 384extern void end_page_writeback(struct page *page);
381 385
382/* 386/*
387 * Add an arbitrary waiter to a page's wait queue
388 */
389extern void add_page_wait_queue(struct page *page, wait_queue_t *waiter);
390
391/*
383 * Fault a userspace page into pagetables. Return non-zero on a fault. 392 * Fault a userspace page into pagetables. Return non-zero on a fault.
384 * 393 *
385 * This assumes that two userspace pages are always sufficient. That's 394 * This assumes that two userspace pages are always sufficient. That's
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index 7b2886fa7fdc..bab82f4c571c 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -24,7 +24,6 @@ void __pagevec_release(struct pagevec *pvec);
24void __pagevec_free(struct pagevec *pvec); 24void __pagevec_free(struct pagevec *pvec);
25void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru); 25void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
26void pagevec_strip(struct pagevec *pvec); 26void pagevec_strip(struct pagevec *pvec);
27void pagevec_swap_free(struct pagevec *pvec);
28unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 27unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
29 pgoff_t start, unsigned nr_pages); 28 pgoff_t start, unsigned nr_pages);
30unsigned pagevec_lookup_tag(struct pagevec *pvec, 29unsigned pagevec_lookup_tag(struct pagevec *pvec,
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-acpi.h b/include/linux/pci-acpi.h
index 042c166f65d5..092e82e0048c 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -10,72 +10,25 @@
10 10
11#include <linux/acpi.h> 11#include <linux/acpi.h>
12 12
13#define OSC_QUERY_TYPE 0
14#define OSC_SUPPORT_TYPE 1
15#define OSC_CONTROL_TYPE 2
16#define OSC_SUPPORT_MASKS 0x1f
17
18/*
19 * _OSC DW0 Definition
20 */
21#define OSC_QUERY_ENABLE 1
22#define OSC_REQUEST_ERROR 2
23#define OSC_INVALID_UUID_ERROR 4
24#define OSC_INVALID_REVISION_ERROR 8
25#define OSC_CAPABILITIES_MASK_ERROR 16
26
27/*
28 * _OSC DW1 Definition (OS Support Fields)
29 */
30#define OSC_EXT_PCI_CONFIG_SUPPORT 1
31#define OSC_ACTIVE_STATE_PWR_SUPPORT 2
32#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4
33#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8
34#define OSC_MSI_SUPPORT 16
35
36/*
37 * _OSC DW1 Definition (OS Control Fields)
38 */
39#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1
40#define OSC_SHPC_NATIVE_HP_CONTROL 2
41#define OSC_PCI_EXPRESS_PME_CONTROL 4
42#define OSC_PCI_EXPRESS_AER_CONTROL 8
43#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16
44
45#define OSC_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
46 OSC_SHPC_NATIVE_HP_CONTROL | \
47 OSC_PCI_EXPRESS_PME_CONTROL | \
48 OSC_PCI_EXPRESS_AER_CONTROL | \
49 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
50
51#ifdef CONFIG_ACPI 13#ifdef CONFIG_ACPI
52extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
53int pci_acpi_osc_support(acpi_handle handle, u32 flags);
54static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 14static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
55{ 15{
56 /* Find root host bridge */ 16 struct pci_bus *pbus = pdev->bus;
57 while (pdev->bus->self) 17 /* Find a PCI root bus */
58 pdev = pdev->bus->self; 18 while (pbus->parent)
59 19 pbus = pbus->parent;
60 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus), 20 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
61 pdev->bus->number); 21 pbus->number);
62} 22}
63 23
64static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) 24static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
65{ 25{
66 int seg = pci_domain_nr(pbus), busnr = pbus->number; 26 if (pbus->parent)
67 struct pci_dev *bridge = pbus->self; 27 return DEVICE_ACPI_HANDLE(&(pbus->self->dev));
68 if (bridge) 28 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
69 return DEVICE_ACPI_HANDLE(&(bridge->dev)); 29 pbus->number);
70 return acpi_get_pci_rootbridge_handle(seg, busnr);
71} 30}
72#else 31#else
73#if !defined(AE_ERROR)
74typedef u32 acpi_status;
75#define AE_ERROR (acpi_status) (0x0001)
76#endif
77static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
78{return AE_ERROR;}
79static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 32static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
80{ return NULL; } 33{ return NULL; }
81#endif 34#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7bd624bfdcfd..72698d89e767 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -52,6 +52,7 @@
52#include <asm/atomic.h> 52#include <asm/atomic.h>
53#include <linux/device.h> 53#include <linux/device.h>
54#include <linux/io.h> 54#include <linux/io.h>
55#include <linux/irqreturn.h>
55 56
56/* Include the ID list */ 57/* Include the ID list */
57#include <linux/pci_ids.h> 58#include <linux/pci_ids.h>
@@ -93,6 +94,12 @@ enum {
93 /* #6: expansion ROM resource */ 94 /* #6: expansion ROM resource */
94 PCI_ROM_RESOURCE, 95 PCI_ROM_RESOURCE,
95 96
97 /* device specific resources */
98#ifdef CONFIG_PCI_IOV
99 PCI_IOV_RESOURCES,
100 PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS - 1,
101#endif
102
96 /* resources assigned to buses behind the bridge */ 103 /* resources assigned to buses behind the bridge */
97#define PCI_BRIDGE_RESOURCE_NUM 4 104#define PCI_BRIDGE_RESOURCE_NUM 4
98 105
@@ -180,6 +187,7 @@ struct pci_cap_saved_state {
180 187
181struct pcie_link_state; 188struct pcie_link_state;
182struct pci_vpd; 189struct pci_vpd;
190struct pci_sriov;
183 191
184/* 192/*
185 * The pci_dev structure is used to describe PCI devices. 193 * The pci_dev structure is used to describe PCI devices.
@@ -257,6 +265,8 @@ struct pci_dev {
257 unsigned int is_managed:1; 265 unsigned int is_managed:1;
258 unsigned int is_pcie:1; 266 unsigned int is_pcie:1;
259 unsigned int state_saved:1; 267 unsigned int state_saved:1;
268 unsigned int is_physfn:1;
269 unsigned int is_virtfn:1;
260 pci_dev_flags_t dev_flags; 270 pci_dev_flags_t dev_flags;
261 atomic_t enable_cnt; /* pci_enable_device has been called */ 271 atomic_t enable_cnt; /* pci_enable_device has been called */
262 272
@@ -270,6 +280,12 @@ struct pci_dev {
270 struct list_head msi_list; 280 struct list_head msi_list;
271#endif 281#endif
272 struct pci_vpd *vpd; 282 struct pci_vpd *vpd;
283#ifdef CONFIG_PCI_IOV
284 union {
285 struct pci_sriov *sriov; /* SR-IOV capability related */
286 struct pci_dev *physfn; /* the PF this VF is associated with */
287 };
288#endif
273}; 289};
274 290
275extern struct pci_dev *alloc_pci_dev(void); 291extern struct pci_dev *alloc_pci_dev(void);
@@ -341,6 +357,15 @@ struct pci_bus {
341#define pci_bus_b(n) list_entry(n, struct pci_bus, node) 357#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
342#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 358#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
343 359
360/*
361 * Returns true if the pci bus is root (behind host-pci bridge),
362 * false otherwise
363 */
364static inline bool pci_is_root_bus(struct pci_bus *pbus)
365{
366 return !(pbus->parent);
367}
368
344#ifdef CONFIG_PCI_MSI 369#ifdef CONFIG_PCI_MSI
345static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 370static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
346{ 371{
@@ -528,7 +553,7 @@ void pcibios_update_irq(struct pci_dev *, int irq);
528/* Generic PCI functions used internally */ 553/* Generic PCI functions used internally */
529 554
530extern struct pci_bus *pci_find_bus(int domain, int busnr); 555extern struct pci_bus *pci_find_bus(int domain, int busnr);
531void pci_bus_add_devices(struct pci_bus *bus); 556void pci_bus_add_devices(const struct pci_bus *bus);
532struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 557struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
533 struct pci_ops *ops, void *sysdata); 558 struct pci_ops *ops, void *sysdata);
534static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, 559static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
@@ -649,6 +674,11 @@ int __must_check pci_reenable_device(struct pci_dev *);
649int __must_check pcim_enable_device(struct pci_dev *pdev); 674int __must_check pcim_enable_device(struct pci_dev *pdev);
650void pcim_pin_device(struct pci_dev *pdev); 675void pcim_pin_device(struct pci_dev *pdev);
651 676
677static inline int pci_is_enabled(struct pci_dev *pdev)
678{
679 return (atomic_read(&pdev->enable_cnt) > 0);
680}
681
652static inline int pci_is_managed(struct pci_dev *pdev) 682static inline int pci_is_managed(struct pci_dev *pdev)
653{ 683{
654 return pdev->is_managed; 684 return pdev->is_managed;
@@ -689,6 +719,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
689/* Power management related routines */ 719/* Power management related routines */
690int pci_save_state(struct pci_dev *dev); 720int pci_save_state(struct pci_dev *dev);
691int pci_restore_state(struct pci_dev *dev); 721int pci_restore_state(struct pci_dev *dev);
722int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state);
692int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 723int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
693pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 724pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
694bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 725bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
@@ -701,6 +732,9 @@ int pci_back_from_sleep(struct pci_dev *dev);
701 732
702/* Functions for PCI Hotplug drivers to use */ 733/* Functions for PCI Hotplug drivers to use */
703int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 734int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
735#ifdef CONFIG_HOTPLUG
736unsigned int pci_rescan_bus(struct pci_bus *bus);
737#endif
704 738
705/* Vital product data routines */ 739/* Vital product data routines */
706ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); 740ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
@@ -708,7 +742,7 @@ ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void
708int pci_vpd_truncate(struct pci_dev *dev, size_t size); 742int pci_vpd_truncate(struct pci_dev *dev, size_t size);
709 743
710/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 744/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
711void pci_bus_assign_resources(struct pci_bus *bus); 745void pci_bus_assign_resources(const struct pci_bus *bus);
712void pci_bus_size_bridges(struct pci_bus *bus); 746void pci_bus_size_bridges(struct pci_bus *bus);
713int pci_claim_resource(struct pci_dev *, int); 747int pci_claim_resource(struct pci_dev *, int);
714void pci_assign_unassigned_resources(void); 748void pci_assign_unassigned_resources(void);
@@ -789,7 +823,7 @@ struct msix_entry {
789 823
790 824
791#ifndef CONFIG_PCI_MSI 825#ifndef CONFIG_PCI_MSI
792static inline int pci_enable_msi(struct pci_dev *dev) 826static inline int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
793{ 827{
794 return -1; 828 return -1;
795} 829}
@@ -799,6 +833,10 @@ static inline void pci_msi_shutdown(struct pci_dev *dev)
799static inline void pci_disable_msi(struct pci_dev *dev) 833static inline void pci_disable_msi(struct pci_dev *dev)
800{ } 834{ }
801 835
836static inline int pci_msix_table_size(struct pci_dev *dev)
837{
838 return 0;
839}
802static inline int pci_enable_msix(struct pci_dev *dev, 840static inline int pci_enable_msix(struct pci_dev *dev,
803 struct msix_entry *entries, int nvec) 841 struct msix_entry *entries, int nvec)
804{ 842{
@@ -820,9 +858,10 @@ static inline int pci_msi_enabled(void)
820 return 0; 858 return 0;
821} 859}
822#else 860#else
823extern int pci_enable_msi(struct pci_dev *dev); 861extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
824extern void pci_msi_shutdown(struct pci_dev *dev); 862extern void pci_msi_shutdown(struct pci_dev *dev);
825extern void pci_disable_msi(struct pci_dev *dev); 863extern void pci_disable_msi(struct pci_dev *dev);
864extern int pci_msix_table_size(struct pci_dev *dev);
826extern int pci_enable_msix(struct pci_dev *dev, 865extern int pci_enable_msix(struct pci_dev *dev,
827 struct msix_entry *entries, int nvec); 866 struct msix_entry *entries, int nvec);
828extern void pci_msix_shutdown(struct pci_dev *dev); 867extern void pci_msix_shutdown(struct pci_dev *dev);
@@ -841,6 +880,8 @@ static inline int pcie_aspm_enabled(void)
841extern int pcie_aspm_enabled(void); 880extern int pcie_aspm_enabled(void);
842#endif 881#endif
843 882
883#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1)
884
844#ifdef CONFIG_HT_IRQ 885#ifdef CONFIG_HT_IRQ
845/* The functions a driver should call */ 886/* The functions a driver should call */
846int ht_create_irq(struct pci_dev *dev, int idx); 887int ht_create_irq(struct pci_dev *dev, int idx);
@@ -1194,5 +1235,23 @@ int pci_ext_cfg_avail(struct pci_dev *dev);
1194 1235
1195void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1236void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1196 1237
1238#ifdef CONFIG_PCI_IOV
1239extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1240extern void pci_disable_sriov(struct pci_dev *dev);
1241extern irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1242#else
1243static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1244{
1245 return -ENODEV;
1246}
1247static inline void pci_disable_sriov(struct pci_dev *dev)
1248{
1249}
1250static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
1251{
1252 return IRQ_NONE;
1253}
1254#endif
1255
1197#endif /* __KERNEL__ */ 1256#endif /* __KERNEL__ */
1198#endif /* LINUX_PCI_H */ 1257#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index aca8c458aa8a..06ba90c211a5 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -526,6 +526,7 @@
526#define PCI_DEVICE_ID_AMD_OPUS_7443 0x7443 526#define PCI_DEVICE_ID_AMD_OPUS_7443 0x7443
527#define PCI_DEVICE_ID_AMD_VIPER_7443 0x7443 527#define PCI_DEVICE_ID_AMD_VIPER_7443 0x7443
528#define PCI_DEVICE_ID_AMD_OPUS_7445 0x7445 528#define PCI_DEVICE_ID_AMD_OPUS_7445 0x7445
529#define PCI_DEVICE_ID_AMD_8111_PCI 0x7460
529#define PCI_DEVICE_ID_AMD_8111_LPC 0x7468 530#define PCI_DEVICE_ID_AMD_8111_LPC 0x7468
530#define PCI_DEVICE_ID_AMD_8111_IDE 0x7469 531#define PCI_DEVICE_ID_AMD_8111_IDE 0x7469
531#define PCI_DEVICE_ID_AMD_8111_SMBUS2 0x746a 532#define PCI_DEVICE_ID_AMD_8111_SMBUS2 0x746a
@@ -834,6 +835,8 @@
834#define PCI_DEVICE_ID_PROMISE_20276 0x5275 835#define PCI_DEVICE_ID_PROMISE_20276 0x5275
835#define PCI_DEVICE_ID_PROMISE_20277 0x7275 836#define PCI_DEVICE_ID_PROMISE_20277 0x7275
836 837
838#define PCI_VENDOR_ID_FOXCONN 0x105b
839
837#define PCI_VENDOR_ID_UMC 0x1060 840#define PCI_VENDOR_ID_UMC 0x1060
838#define PCI_DEVICE_ID_UMC_UM8673F 0x0101 841#define PCI_DEVICE_ID_UMC_UM8673F 0x0101
839#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a 842#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a
@@ -941,6 +944,32 @@
941#define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801 944#define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801
942#define PCI_DEVICE_ID_SUN_CASSINI 0xabba 945#define PCI_DEVICE_ID_SUN_CASSINI 0xabba
943 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
944#define PCI_VENDOR_ID_CMD 0x1095 973#define PCI_VENDOR_ID_CMD 0x1095
945#define PCI_DEVICE_ID_CMD_643 0x0643 974#define PCI_DEVICE_ID_CMD_643 0x0643
946#define PCI_DEVICE_ID_CMD_646 0x0646 975#define PCI_DEVICE_ID_CMD_646 0x0646
@@ -1235,6 +1264,7 @@
1235#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 1264#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1236#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 1265#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
1237#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453 1266#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453
1267#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_SMBUS 0x0542
1238#define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C 1268#define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C
1239#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D 1269#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D
1240#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E 1270#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E
@@ -1245,11 +1275,14 @@
1245#define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF 1275#define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF
1246#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 1276#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560
1247#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C 1277#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C
1278#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752
1248#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 1279#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759
1249#define PCI_DEVICE_ID_NVIDIA_NVENET_32 0x0760 1280#define PCI_DEVICE_ID_NVIDIA_NVENET_32 0x0760
1250#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761 1281#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761
1251#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762 1282#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762
1252#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763 1283#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763
1284#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8
1285#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2
1253#define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0 1286#define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0
1254#define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1 1287#define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1
1255#define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2 1288#define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2
@@ -1473,6 +1506,7 @@
1473#define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214 1506#define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214
1474#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 1507#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217
1475#define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227 1508#define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227
1509#define PCI_DEVICE_ID_SERVERWORKS_HT1100LD 0x0408
1476 1510
1477#define PCI_VENDOR_ID_SBE 0x1176 1511#define PCI_VENDOR_ID_SBE 0x1176
1478#define PCI_DEVICE_ID_SBE_WANXL100 0x0301 1512#define PCI_DEVICE_ID_SBE_WANXL100 0x0301
@@ -1971,6 +2005,8 @@
1971 2005
1972#define PCI_VENDOR_ID_SAMSUNG 0x144d 2006#define PCI_VENDOR_ID_SAMSUNG 0x144d
1973 2007
2008#define PCI_VENDOR_ID_AMBIT 0x1468
2009
1974#define PCI_VENDOR_ID_MYRICOM 0x14c1 2010#define PCI_VENDOR_ID_MYRICOM 0x14c1
1975 2011
1976#define PCI_VENDOR_ID_TITAN 0x14D2 2012#define PCI_VENDOR_ID_TITAN 0x14D2
@@ -2112,6 +2148,8 @@
2112#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c 2148#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c
2113#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274 2149#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274
2114 2150
2151#define PCI_VENDOR_ID_DFI 0x15bd
2152
2115#define PCI_VENDOR_ID_QUICKNET 0x15e2 2153#define PCI_VENDOR_ID_QUICKNET 0x15e2
2116#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500 2154#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500
2117 2155
@@ -2215,10 +2253,20 @@
2215 2253
2216#define PCI_VENDOR_ID_TOPSPIN 0x1867 2254#define PCI_VENDOR_ID_TOPSPIN 0x1867
2217 2255
2256#define PCI_VENDOR_ID_SILAN 0x1904
2257
2218#define PCI_VENDOR_ID_TDI 0x192E 2258#define PCI_VENDOR_ID_TDI 0x192E
2219#define PCI_DEVICE_ID_TDI_EHCI 0x0101 2259#define PCI_DEVICE_ID_TDI_EHCI 0x0101
2220 2260
2221#define PCI_VENDOR_ID_FREESCALE 0x1957 2261#define PCI_VENDOR_ID_FREESCALE 0x1957
2262#define PCI_DEVICE_ID_MPC8315E 0x00b4
2263#define PCI_DEVICE_ID_MPC8315 0x00b5
2264#define PCI_DEVICE_ID_MPC8314E 0x00b6
2265#define PCI_DEVICE_ID_MPC8314 0x00b7
2266#define PCI_DEVICE_ID_MPC8378E 0x00c4
2267#define PCI_DEVICE_ID_MPC8378 0x00c5
2268#define PCI_DEVICE_ID_MPC8377E 0x00c6
2269#define PCI_DEVICE_ID_MPC8377 0x00c7
2222#define PCI_DEVICE_ID_MPC8548E 0x0012 2270#define PCI_DEVICE_ID_MPC8548E 0x0012
2223#define PCI_DEVICE_ID_MPC8548 0x0013 2271#define PCI_DEVICE_ID_MPC8548 0x0013
2224#define PCI_DEVICE_ID_MPC8543E 0x0014 2272#define PCI_DEVICE_ID_MPC8543E 0x0014
@@ -2263,6 +2311,8 @@
2263#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 2311#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600
2264#define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff 2312#define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff
2265 2313
2314#define PCI_VENDOR_ID_QMI 0x1a32
2315
2266#define PCI_VENDOR_ID_TEKRAM 0x1de1 2316#define PCI_VENDOR_ID_TEKRAM 0x1de1
2267#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2317#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
2268 2318
@@ -2373,6 +2423,7 @@
2373#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c 2423#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c
2374#define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0 2424#define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0
2375#define PCI_DEVICE_ID_INTEL_82801DB_1 0x24c1 2425#define PCI_DEVICE_ID_INTEL_82801DB_1 0x24c1
2426#define PCI_DEVICE_ID_INTEL_82801DB_2 0x24c2
2376#define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3 2427#define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3
2377#define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5 2428#define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5
2378#define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6 2429#define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6
@@ -2463,6 +2514,8 @@
2463#define PCI_DEVICE_ID_INTEL_IOAT_TBG3 0x3433 2514#define PCI_DEVICE_ID_INTEL_IOAT_TBG3 0x3433
2464#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2515#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2465#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
2466#define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580 2519#define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580
2467#define PCI_DEVICE_ID_INTEL_82855GM_IG 0x3582 2520#define PCI_DEVICE_ID_INTEL_82855GM_IG 0x3582
2468#define PCI_DEVICE_ID_INTEL_E7520_MCH 0x3590 2521#define PCI_DEVICE_ID_INTEL_E7520_MCH 0x3590
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 027815b4635e..616bf8b3c8b5 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -235,7 +235,7 @@
235#define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */ 235#define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */
236#define PCI_PM_CTRL 4 /* PM control and status register */ 236#define PCI_PM_CTRL 4 /* PM control and status register */
237#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ 237#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
238#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ 238#define PCI_PM_CTRL_NO_SOFT_RESET 0x0008 /* No reset for D3hot->D0 */
239#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ 239#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
240#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ 240#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
241#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ 241#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
@@ -375,6 +375,8 @@
375#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ 375#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */
376#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ 376#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
377#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ 377#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
378#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */
379#define PCI_EXP_TYPE_RC_EC 0x10 /* Root Complex Event Collector */
378#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ 380#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
379#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ 381#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
380#define PCI_EXP_DEVCAP 4 /* Device capabilities */ 382#define PCI_EXP_DEVCAP 4 /* Device capabilities */
@@ -487,6 +489,8 @@
487#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ 489#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */
488#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ 490#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */
489#define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */ 491#define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */
492#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */
493#define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */
490 494
491/* Extended Capabilities (PCI-X 2.0 and Express) */ 495/* Extended Capabilities (PCI-X 2.0 and Express) */
492#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) 496#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
@@ -498,6 +502,7 @@
498#define PCI_EXT_CAP_ID_DSN 3 502#define PCI_EXT_CAP_ID_DSN 3
499#define PCI_EXT_CAP_ID_PWR 4 503#define PCI_EXT_CAP_ID_PWR 4
500#define PCI_EXT_CAP_ID_ARI 14 504#define PCI_EXT_CAP_ID_ARI 14
505#define PCI_EXT_CAP_ID_SRIOV 16
501 506
502/* Advanced Error Reporting */ 507/* Advanced Error Reporting */
503#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ 508#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
@@ -615,4 +620,35 @@
615#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ 620#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */
616#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ 621#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */
617 622
623/* Single Root I/O Virtualization */
624#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */
625#define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */
626#define PCI_SRIOV_CAP_INTR(x) ((x) >> 21) /* Interrupt Message Number */
627#define PCI_SRIOV_CTRL 0x08 /* SR-IOV Control */
628#define PCI_SRIOV_CTRL_VFE 0x01 /* VF Enable */
629#define PCI_SRIOV_CTRL_VFM 0x02 /* VF Migration Enable */
630#define PCI_SRIOV_CTRL_INTR 0x04 /* VF Migration Interrupt Enable */
631#define PCI_SRIOV_CTRL_MSE 0x08 /* VF Memory Space Enable */
632#define PCI_SRIOV_CTRL_ARI 0x10 /* ARI Capable Hierarchy */
633#define PCI_SRIOV_STATUS 0x0a /* SR-IOV Status */
634#define PCI_SRIOV_STATUS_VFM 0x01 /* VF Migration Status */
635#define PCI_SRIOV_INITIAL_VF 0x0c /* Initial VFs */
636#define PCI_SRIOV_TOTAL_VF 0x0e /* Total VFs */
637#define PCI_SRIOV_NUM_VF 0x10 /* Number of VFs */
638#define PCI_SRIOV_FUNC_LINK 0x12 /* Function Dependency Link */
639#define PCI_SRIOV_VF_OFFSET 0x14 /* First VF Offset */
640#define PCI_SRIOV_VF_STRIDE 0x16 /* Following VF Stride */
641#define PCI_SRIOV_VF_DID 0x1a /* VF Device ID */
642#define PCI_SRIOV_SUP_PGSIZE 0x1c /* Supported Page Sizes */
643#define PCI_SRIOV_SYS_PGSIZE 0x20 /* System Page Size */
644#define PCI_SRIOV_BAR 0x24 /* VF BAR0 */
645#define PCI_SRIOV_NUM_BARS 6 /* Number of VF BARs */
646#define PCI_SRIOV_VFM 0x3c /* VF Migration State Array Offset*/
647#define PCI_SRIOV_VFM_BIR(x) ((x) & 7) /* State BIR */
648#define PCI_SRIOV_VFM_OFFSET(x) ((x) & ~7) /* State Offset */
649#define PCI_SRIOV_VFM_UA 0x0 /* Inactive.Unavailable */
650#define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */
651#define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */
652#define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */
653
618#endif /* LINUX_PCI_REGS_H */ 654#endif /* LINUX_PCI_REGS_H */
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index 6cd91e3f9820..b4c79545330b 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -16,29 +16,30 @@
16#define PCIE_ANY_PORT 7 16#define PCIE_ANY_PORT 7
17 17
18/* Service Type */ 18/* Service Type */
19#define PCIE_PORT_SERVICE_PME 1 /* Power Management Event */ 19#define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */
20#define PCIE_PORT_SERVICE_AER 2 /* Advanced Error Reporting */ 20#define PCIE_PORT_SERVICE_PME (1 << PCIE_PORT_SERVICE_PME_SHIFT)
21#define PCIE_PORT_SERVICE_HP 4 /* Native Hotplug */ 21#define PCIE_PORT_SERVICE_AER_SHIFT 1 /* Advanced Error Reporting */
22#define PCIE_PORT_SERVICE_VC 8 /* Virtual Channel */ 22#define PCIE_PORT_SERVICE_AER (1 << PCIE_PORT_SERVICE_AER_SHIFT)
23#define PCIE_PORT_SERVICE_HP_SHIFT 2 /* Native Hotplug */
24#define PCIE_PORT_SERVICE_HP (1 << PCIE_PORT_SERVICE_HP_SHIFT)
25#define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */
26#define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT)
23 27
24/* Root/Upstream/Downstream Port's Interrupt Mode */ 28/* Root/Upstream/Downstream Port's Interrupt Mode */
29#define PCIE_PORT_NO_IRQ (-1)
25#define PCIE_PORT_INTx_MODE 0 30#define PCIE_PORT_INTx_MODE 0
26#define PCIE_PORT_MSI_MODE 1 31#define PCIE_PORT_MSI_MODE 1
27#define PCIE_PORT_MSIX_MODE 2 32#define PCIE_PORT_MSIX_MODE 2
28 33
29struct pcie_port_service_id { 34struct pcie_port_data {
30 __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/ 35 int port_type; /* Type of the port */
31 __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */ 36 int port_irq_mode; /* [0:INTx | 1:MSI | 2:MSI-X] */
32 __u32 class, class_mask; /* (class,subclass,prog-if) triplet */
33 __u32 port_type, service_type; /* Port Entity */
34 kernel_ulong_t driver_data;
35}; 37};
36 38
37struct pcie_device { 39struct pcie_device {
38 int irq; /* Service IRQ/MSI/MSI-X Vector */ 40 int irq; /* Service IRQ/MSI/MSI-X Vector */
39 int interrupt_mode; /* [0:INTx | 1:MSI | 2:MSI-X] */ 41 struct pci_dev *port; /* Root/Upstream/Downstream Port */
40 struct pcie_port_service_id id; /* Service ID */ 42 u32 service; /* Port service this device represents */
41 struct pci_dev *port; /* Root/Upstream/Downstream Port */
42 void *priv_data; /* Service Private Data */ 43 void *priv_data; /* Service Private Data */
43 struct device device; /* Generic Device Interface */ 44 struct device device; /* Generic Device Interface */
44}; 45};
@@ -56,10 +57,9 @@ static inline void* get_service_data(struct pcie_device *dev)
56 57
57struct pcie_port_service_driver { 58struct pcie_port_service_driver {
58 const char *name; 59 const char *name;
59 int (*probe) (struct pcie_device *dev, 60 int (*probe) (struct pcie_device *dev);
60 const struct pcie_port_service_id *id);
61 void (*remove) (struct pcie_device *dev); 61 void (*remove) (struct pcie_device *dev);
62 int (*suspend) (struct pcie_device *dev, pm_message_t state); 62 int (*suspend) (struct pcie_device *dev);
63 int (*resume) (struct pcie_device *dev); 63 int (*resume) (struct pcie_device *dev);
64 64
65 /* Service Error Recovery Handler */ 65 /* Service Error Recovery Handler */
@@ -68,7 +68,9 @@ struct pcie_port_service_driver {
68 /* Link Reset Capability - AER service driver specific */ 68 /* Link Reset Capability - AER service driver specific */
69 pci_ers_result_t (*reset_link) (struct pci_dev *dev); 69 pci_ers_result_t (*reset_link) (struct pci_dev *dev);
70 70
71 const struct pcie_port_service_id *id_table; 71 int port_type; /* Type of the port this driver can handle */
72 u32 service; /* Port service this device represents */
73
72 struct device_driver driver; 74 struct device_driver driver;
73}; 75};
74#define to_service_driver(d) \ 76#define to_service_driver(d) \
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-defs.h b/include/linux/percpu-defs.h
new file mode 100644
index 000000000000..8f921d74f49f
--- /dev/null
+++ b/include/linux/percpu-defs.h
@@ -0,0 +1,84 @@
1#ifndef _LINUX_PERCPU_DEFS_H
2#define _LINUX_PERCPU_DEFS_H
3
4/*
5 * Determine the real variable name from the name visible in the
6 * kernel sources.
7 */
8#define per_cpu_var(var) per_cpu__##var
9
10/*
11 * Base implementations of per-CPU variable declarations and definitions, where
12 * the section in which the variable is to be placed is provided by the
13 * 'section' argument. This may be used to affect the parameters governing the
14 * variable's storage.
15 *
16 * NOTE! The sections for the DECLARE and for the DEFINE must match, lest
17 * linkage errors occur due the compiler generating the wrong code to access
18 * that section.
19 */
20#define DECLARE_PER_CPU_SECTION(type, name, section) \
21 extern \
22 __attribute__((__section__(PER_CPU_BASE_SECTION section))) \
23 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
24
25#define DEFINE_PER_CPU_SECTION(type, name, section) \
26 __attribute__((__section__(PER_CPU_BASE_SECTION section))) \
27 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
28
29/*
30 * Variant on the per-CPU variable declaration/definition theme used for
31 * ordinary per-CPU variables.
32 */
33#define DECLARE_PER_CPU(type, name) \
34 DECLARE_PER_CPU_SECTION(type, name, "")
35
36#define DEFINE_PER_CPU(type, name) \
37 DEFINE_PER_CPU_SECTION(type, name, "")
38
39/*
40 * Declaration/definition used for per-CPU variables that must come first in
41 * the set of variables.
42 */
43#define DECLARE_PER_CPU_FIRST(type, name) \
44 DECLARE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION)
45
46#define DEFINE_PER_CPU_FIRST(type, name) \
47 DEFINE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION)
48
49/*
50 * Declaration/definition used for per-CPU variables that must be cacheline
51 * aligned under SMP conditions so that, whilst a particular instance of the
52 * data corresponds to a particular CPU, inefficiencies due to direct access by
53 * other CPUs are reduced by preventing the data from unnecessarily spanning
54 * cachelines.
55 *
56 * An example of this would be statistical data, where each CPU's set of data
57 * is updated by that CPU alone, but the data from across all CPUs is collated
58 * by a CPU processing a read from a proc file.
59 */
60#define DECLARE_PER_CPU_SHARED_ALIGNED(type, name) \
61 DECLARE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
62 ____cacheline_aligned_in_smp
63
64#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
65 DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
66 ____cacheline_aligned_in_smp
67
68/*
69 * Declaration/definition used for per-CPU variables that must be page aligned.
70 */
71#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \
72 DECLARE_PER_CPU_SECTION(type, name, ".page_aligned")
73
74#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
75 DEFINE_PER_CPU_SECTION(type, name, ".page_aligned")
76
77/*
78 * Intermodule exports for per-CPU variables.
79 */
80#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
81#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
82
83
84#endif /* _LINUX_PERCPU_DEFS_H */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 9f2a3751873a..1581ff235c7e 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -5,53 +5,22 @@
5#include <linux/slab.h> /* For kmalloc() */ 5#include <linux/slab.h> /* For kmalloc() */
6#include <linux/smp.h> 6#include <linux/smp.h>
7#include <linux/cpumask.h> 7#include <linux/cpumask.h>
8#include <linux/pfn.h>
8 9
9#include <asm/percpu.h> 10#include <asm/percpu.h>
10 11
11#ifdef CONFIG_SMP 12/* enough to cover all DEFINE_PER_CPUs in modules */
12#define DEFINE_PER_CPU(type, name) \
13 __attribute__((__section__(".data.percpu"))) \
14 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
15
16#ifdef MODULE
17#define SHARED_ALIGNED_SECTION ".data.percpu"
18#else
19#define SHARED_ALIGNED_SECTION ".data.percpu.shared_aligned"
20#endif
21
22#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
23 __attribute__((__section__(SHARED_ALIGNED_SECTION))) \
24 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \
25 ____cacheline_aligned_in_smp
26
27#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
28 __attribute__((__section__(".data.percpu.page_aligned"))) \
29 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
30#else
31#define DEFINE_PER_CPU(type, name) \
32 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
33
34#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
35 DEFINE_PER_CPU(type, name)
36
37#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
38 DEFINE_PER_CPU(type, name)
39#endif
40
41#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
42#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
43
44/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
45#ifndef PERCPU_ENOUGH_ROOM
46#ifdef CONFIG_MODULES 13#ifdef CONFIG_MODULES
47#define PERCPU_MODULE_RESERVE 8192 14#define PERCPU_MODULE_RESERVE (8 << 10)
48#else 15#else
49#define PERCPU_MODULE_RESERVE 0 16#define PERCPU_MODULE_RESERVE 0
50#endif 17#endif
51 18
19#ifndef PERCPU_ENOUGH_ROOM
52#define PERCPU_ENOUGH_ROOM \ 20#define PERCPU_ENOUGH_ROOM \
53 (__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE) 21 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
54#endif /* PERCPU_ENOUGH_ROOM */ 22 PERCPU_MODULE_RESERVE)
23#endif
55 24
56/* 25/*
57 * Must be an lvalue. Since @var must be a simple identifier, 26 * Must be an lvalue. Since @var must be a simple identifier,
@@ -65,52 +34,146 @@
65 34
66#ifdef CONFIG_SMP 35#ifdef CONFIG_SMP
67 36
37#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA
38
39/* minimum unit size, also is the maximum supported allocation size */
40#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10)
41
42/*
43 * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy
44 * back on the first chunk for dynamic percpu allocation if arch is
45 * manually allocating and mapping it for faster access (as a part of
46 * large page mapping for example).
47 *
48 * The following values give between one and two pages of free space
49 * after typical minimal boot (2-way SMP, single disk and NIC) with
50 * both defconfig and a distro config on x86_64 and 32. More
51 * intelligent way to determine this would be nice.
52 */
53#if BITS_PER_LONG > 32
54#define PERCPU_DYNAMIC_RESERVE (20 << 10)
55#else
56#define PERCPU_DYNAMIC_RESERVE (12 << 10)
57#endif
58
59extern void *pcpu_base_addr;
60
61typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno);
62typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr);
63
64extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn,
65 size_t static_size, size_t reserved_size,
66 ssize_t dyn_size, ssize_t unit_size,
67 void *base_addr,
68 pcpu_populate_pte_fn_t populate_pte_fn);
69
70extern ssize_t __init pcpu_embed_first_chunk(
71 size_t static_size, size_t reserved_size,
72 ssize_t dyn_size, ssize_t unit_size);
73
74/*
75 * Use this to get to a cpu's version of the per-cpu object
76 * dynamically allocated. Non-atomic access to the current CPU's
77 * version should probably be combined with get_cpu()/put_cpu().
78 */
79#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)))
80
81extern void *__alloc_reserved_percpu(size_t size, size_t align);
82
83#else /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */
84
68struct percpu_data { 85struct percpu_data {
69 void *ptrs[1]; 86 void *ptrs[1];
70}; 87};
71 88
72#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) 89#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata)
73/* 90
74 * Use this to get to a cpu's version of the per-cpu object dynamically 91#define per_cpu_ptr(ptr, cpu) \
75 * allocated. Non-atomic access to the current CPU's version should 92({ \
76 * probably be combined with get_cpu()/put_cpu(). 93 struct percpu_data *__p = __percpu_disguise(ptr); \
77 */ 94 (__typeof__(ptr))__p->ptrs[(cpu)]; \
78#define percpu_ptr(ptr, cpu) \
79({ \
80 struct percpu_data *__p = __percpu_disguise(ptr); \
81 (__typeof__(ptr))__p->ptrs[(cpu)]; \
82}) 95})
83 96
84extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); 97#endif /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */
85extern void percpu_free(void *__pdata); 98
99extern void *__alloc_percpu(size_t size, size_t align);
100extern void free_percpu(void *__pdata);
86 101
87#else /* CONFIG_SMP */ 102#else /* CONFIG_SMP */
88 103
89#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 104#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
90 105
91static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) 106static inline void *__alloc_percpu(size_t size, size_t align)
92{ 107{
93 return kzalloc(size, gfp); 108 /*
109 * Can't easily make larger alignment work with kmalloc. WARN
110 * on it. Larger alignment should only be used for module
111 * percpu sections on SMP for which this path isn't used.
112 */
113 WARN_ON_ONCE(align > SMP_CACHE_BYTES);
114 return kzalloc(size, GFP_KERNEL);
94} 115}
95 116
96static inline void percpu_free(void *__pdata) 117static inline void free_percpu(void *p)
97{ 118{
98 kfree(__pdata); 119 kfree(p);
99} 120}
100 121
101#endif /* CONFIG_SMP */ 122#endif /* CONFIG_SMP */
102 123
103#define percpu_alloc_mask(size, gfp, mask) \ 124#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type), \
104 __percpu_alloc_mask((size), (gfp), &(mask)) 125 __alignof__(type))
105 126
106#define percpu_alloc(size, gfp) percpu_alloc_mask((size), (gfp), cpu_online_map) 127/*
128 * Optional methods for optimized non-lvalue per-cpu variable access.
129 *
130 * @var can be a percpu variable or a field of it and its size should
131 * equal char, int or long. percpu_read() evaluates to a lvalue and
132 * all others to void.
133 *
134 * These operations are guaranteed to be atomic w.r.t. preemption.
135 * The generic versions use plain get/put_cpu_var(). Archs are
136 * encouraged to implement single-instruction alternatives which don't
137 * require preemption protection.
138 */
139#ifndef percpu_read
140# define percpu_read(var) \
141 ({ \
142 typeof(per_cpu_var(var)) __tmp_var__; \
143 __tmp_var__ = get_cpu_var(var); \
144 put_cpu_var(var); \
145 __tmp_var__; \
146 })
147#endif
107 148
108/* (legacy) interface for use without CPU hotplug handling */ 149#define __percpu_generic_to_op(var, val, op) \
150do { \
151 get_cpu_var(var) op val; \
152 put_cpu_var(var); \
153} while (0)
109 154
110#define __alloc_percpu(size) percpu_alloc_mask((size), GFP_KERNEL, \ 155#ifndef percpu_write
111 cpu_possible_map) 156# define percpu_write(var, val) __percpu_generic_to_op(var, (val), =)
112#define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type)) 157#endif
113#define free_percpu(ptr) percpu_free((ptr)) 158
114#define per_cpu_ptr(ptr, cpu) percpu_ptr((ptr), (cpu)) 159#ifndef percpu_add
160# define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=)
161#endif
162
163#ifndef percpu_sub
164# define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=)
165#endif
166
167#ifndef percpu_and
168# define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=)
169#endif
170
171#ifndef percpu_or
172# define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=)
173#endif
174
175#ifndef percpu_xor
176# define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=)
177#endif
115 178
116#endif /* __LINUX_PERCPU_H */ 179#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 01b262959f2e..228b0b6306b0 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -12,187 +12,187 @@
12#define PFKEYV2_REVISION 199806L 12#define PFKEYV2_REVISION 199806L
13 13
14struct sadb_msg { 14struct sadb_msg {
15 uint8_t sadb_msg_version; 15 __u8 sadb_msg_version;
16 uint8_t sadb_msg_type; 16 __u8 sadb_msg_type;
17 uint8_t sadb_msg_errno; 17 __u8 sadb_msg_errno;
18 uint8_t sadb_msg_satype; 18 __u8 sadb_msg_satype;
19 uint16_t sadb_msg_len; 19 __u16 sadb_msg_len;
20 uint16_t sadb_msg_reserved; 20 __u16 sadb_msg_reserved;
21 uint32_t sadb_msg_seq; 21 __u32 sadb_msg_seq;
22 uint32_t sadb_msg_pid; 22 __u32 sadb_msg_pid;
23} __attribute__((packed)); 23} __attribute__((packed));
24/* sizeof(struct sadb_msg) == 16 */ 24/* sizeof(struct sadb_msg) == 16 */
25 25
26struct sadb_ext { 26struct sadb_ext {
27 uint16_t sadb_ext_len; 27 __u16 sadb_ext_len;
28 uint16_t sadb_ext_type; 28 __u16 sadb_ext_type;
29} __attribute__((packed)); 29} __attribute__((packed));
30/* sizeof(struct sadb_ext) == 4 */ 30/* sizeof(struct sadb_ext) == 4 */
31 31
32struct sadb_sa { 32struct sadb_sa {
33 uint16_t sadb_sa_len; 33 __u16 sadb_sa_len;
34 uint16_t sadb_sa_exttype; 34 __u16 sadb_sa_exttype;
35 __be32 sadb_sa_spi; 35 __be32 sadb_sa_spi;
36 uint8_t sadb_sa_replay; 36 __u8 sadb_sa_replay;
37 uint8_t sadb_sa_state; 37 __u8 sadb_sa_state;
38 uint8_t sadb_sa_auth; 38 __u8 sadb_sa_auth;
39 uint8_t sadb_sa_encrypt; 39 __u8 sadb_sa_encrypt;
40 uint32_t sadb_sa_flags; 40 __u32 sadb_sa_flags;
41} __attribute__((packed)); 41} __attribute__((packed));
42/* sizeof(struct sadb_sa) == 16 */ 42/* sizeof(struct sadb_sa) == 16 */
43 43
44struct sadb_lifetime { 44struct sadb_lifetime {
45 uint16_t sadb_lifetime_len; 45 __u16 sadb_lifetime_len;
46 uint16_t sadb_lifetime_exttype; 46 __u16 sadb_lifetime_exttype;
47 uint32_t sadb_lifetime_allocations; 47 __u32 sadb_lifetime_allocations;
48 uint64_t sadb_lifetime_bytes; 48 __u64 sadb_lifetime_bytes;
49 uint64_t sadb_lifetime_addtime; 49 __u64 sadb_lifetime_addtime;
50 uint64_t sadb_lifetime_usetime; 50 __u64 sadb_lifetime_usetime;
51} __attribute__((packed)); 51} __attribute__((packed));
52/* sizeof(struct sadb_lifetime) == 32 */ 52/* sizeof(struct sadb_lifetime) == 32 */
53 53
54struct sadb_address { 54struct sadb_address {
55 uint16_t sadb_address_len; 55 __u16 sadb_address_len;
56 uint16_t sadb_address_exttype; 56 __u16 sadb_address_exttype;
57 uint8_t sadb_address_proto; 57 __u8 sadb_address_proto;
58 uint8_t sadb_address_prefixlen; 58 __u8 sadb_address_prefixlen;
59 uint16_t sadb_address_reserved; 59 __u16 sadb_address_reserved;
60} __attribute__((packed)); 60} __attribute__((packed));
61/* sizeof(struct sadb_address) == 8 */ 61/* sizeof(struct sadb_address) == 8 */
62 62
63struct sadb_key { 63struct sadb_key {
64 uint16_t sadb_key_len; 64 __u16 sadb_key_len;
65 uint16_t sadb_key_exttype; 65 __u16 sadb_key_exttype;
66 uint16_t sadb_key_bits; 66 __u16 sadb_key_bits;
67 uint16_t sadb_key_reserved; 67 __u16 sadb_key_reserved;
68} __attribute__((packed)); 68} __attribute__((packed));
69/* sizeof(struct sadb_key) == 8 */ 69/* sizeof(struct sadb_key) == 8 */
70 70
71struct sadb_ident { 71struct sadb_ident {
72 uint16_t sadb_ident_len; 72 __u16 sadb_ident_len;
73 uint16_t sadb_ident_exttype; 73 __u16 sadb_ident_exttype;
74 uint16_t sadb_ident_type; 74 __u16 sadb_ident_type;
75 uint16_t sadb_ident_reserved; 75 __u16 sadb_ident_reserved;
76 uint64_t sadb_ident_id; 76 __u64 sadb_ident_id;
77} __attribute__((packed)); 77} __attribute__((packed));
78/* sizeof(struct sadb_ident) == 16 */ 78/* sizeof(struct sadb_ident) == 16 */
79 79
80struct sadb_sens { 80struct sadb_sens {
81 uint16_t sadb_sens_len; 81 __u16 sadb_sens_len;
82 uint16_t sadb_sens_exttype; 82 __u16 sadb_sens_exttype;
83 uint32_t sadb_sens_dpd; 83 __u32 sadb_sens_dpd;
84 uint8_t sadb_sens_sens_level; 84 __u8 sadb_sens_sens_level;
85 uint8_t sadb_sens_sens_len; 85 __u8 sadb_sens_sens_len;
86 uint8_t sadb_sens_integ_level; 86 __u8 sadb_sens_integ_level;
87 uint8_t sadb_sens_integ_len; 87 __u8 sadb_sens_integ_len;
88 uint32_t sadb_sens_reserved; 88 __u32 sadb_sens_reserved;
89} __attribute__((packed)); 89} __attribute__((packed));
90/* sizeof(struct sadb_sens) == 16 */ 90/* sizeof(struct sadb_sens) == 16 */
91 91
92/* followed by: 92/* followed by:
93 uint64_t sadb_sens_bitmap[sens_len]; 93 __u64 sadb_sens_bitmap[sens_len];
94 uint64_t sadb_integ_bitmap[integ_len]; */ 94 __u64 sadb_integ_bitmap[integ_len]; */
95 95
96struct sadb_prop { 96struct sadb_prop {
97 uint16_t sadb_prop_len; 97 __u16 sadb_prop_len;
98 uint16_t sadb_prop_exttype; 98 __u16 sadb_prop_exttype;
99 uint8_t sadb_prop_replay; 99 __u8 sadb_prop_replay;
100 uint8_t sadb_prop_reserved[3]; 100 __u8 sadb_prop_reserved[3];
101} __attribute__((packed)); 101} __attribute__((packed));
102/* sizeof(struct sadb_prop) == 8 */ 102/* sizeof(struct sadb_prop) == 8 */
103 103
104/* followed by: 104/* followed by:
105 struct sadb_comb sadb_combs[(sadb_prop_len + 105 struct sadb_comb sadb_combs[(sadb_prop_len +
106 sizeof(uint64_t) - sizeof(struct sadb_prop)) / 106 sizeof(__u64) - sizeof(struct sadb_prop)) /
107 sizeof(struct sadb_comb)]; */ 107 sizeof(struct sadb_comb)]; */
108 108
109struct sadb_comb { 109struct sadb_comb {
110 uint8_t sadb_comb_auth; 110 __u8 sadb_comb_auth;
111 uint8_t sadb_comb_encrypt; 111 __u8 sadb_comb_encrypt;
112 uint16_t sadb_comb_flags; 112 __u16 sadb_comb_flags;
113 uint16_t sadb_comb_auth_minbits; 113 __u16 sadb_comb_auth_minbits;
114 uint16_t sadb_comb_auth_maxbits; 114 __u16 sadb_comb_auth_maxbits;
115 uint16_t sadb_comb_encrypt_minbits; 115 __u16 sadb_comb_encrypt_minbits;
116 uint16_t sadb_comb_encrypt_maxbits; 116 __u16 sadb_comb_encrypt_maxbits;
117 uint32_t sadb_comb_reserved; 117 __u32 sadb_comb_reserved;
118 uint32_t sadb_comb_soft_allocations; 118 __u32 sadb_comb_soft_allocations;
119 uint32_t sadb_comb_hard_allocations; 119 __u32 sadb_comb_hard_allocations;
120 uint64_t sadb_comb_soft_bytes; 120 __u64 sadb_comb_soft_bytes;
121 uint64_t sadb_comb_hard_bytes; 121 __u64 sadb_comb_hard_bytes;
122 uint64_t sadb_comb_soft_addtime; 122 __u64 sadb_comb_soft_addtime;
123 uint64_t sadb_comb_hard_addtime; 123 __u64 sadb_comb_hard_addtime;
124 uint64_t sadb_comb_soft_usetime; 124 __u64 sadb_comb_soft_usetime;
125 uint64_t sadb_comb_hard_usetime; 125 __u64 sadb_comb_hard_usetime;
126} __attribute__((packed)); 126} __attribute__((packed));
127/* sizeof(struct sadb_comb) == 72 */ 127/* sizeof(struct sadb_comb) == 72 */
128 128
129struct sadb_supported { 129struct sadb_supported {
130 uint16_t sadb_supported_len; 130 __u16 sadb_supported_len;
131 uint16_t sadb_supported_exttype; 131 __u16 sadb_supported_exttype;
132 uint32_t sadb_supported_reserved; 132 __u32 sadb_supported_reserved;
133} __attribute__((packed)); 133} __attribute__((packed));
134/* sizeof(struct sadb_supported) == 8 */ 134/* sizeof(struct sadb_supported) == 8 */
135 135
136/* followed by: 136/* followed by:
137 struct sadb_alg sadb_algs[(sadb_supported_len + 137 struct sadb_alg sadb_algs[(sadb_supported_len +
138 sizeof(uint64_t) - sizeof(struct sadb_supported)) / 138 sizeof(__u64) - sizeof(struct sadb_supported)) /
139 sizeof(struct sadb_alg)]; */ 139 sizeof(struct sadb_alg)]; */
140 140
141struct sadb_alg { 141struct sadb_alg {
142 uint8_t sadb_alg_id; 142 __u8 sadb_alg_id;
143 uint8_t sadb_alg_ivlen; 143 __u8 sadb_alg_ivlen;
144 uint16_t sadb_alg_minbits; 144 __u16 sadb_alg_minbits;
145 uint16_t sadb_alg_maxbits; 145 __u16 sadb_alg_maxbits;
146 uint16_t sadb_alg_reserved; 146 __u16 sadb_alg_reserved;
147} __attribute__((packed)); 147} __attribute__((packed));
148/* sizeof(struct sadb_alg) == 8 */ 148/* sizeof(struct sadb_alg) == 8 */
149 149
150struct sadb_spirange { 150struct sadb_spirange {
151 uint16_t sadb_spirange_len; 151 __u16 sadb_spirange_len;
152 uint16_t sadb_spirange_exttype; 152 __u16 sadb_spirange_exttype;
153 uint32_t sadb_spirange_min; 153 __u32 sadb_spirange_min;
154 uint32_t sadb_spirange_max; 154 __u32 sadb_spirange_max;
155 uint32_t sadb_spirange_reserved; 155 __u32 sadb_spirange_reserved;
156} __attribute__((packed)); 156} __attribute__((packed));
157/* sizeof(struct sadb_spirange) == 16 */ 157/* sizeof(struct sadb_spirange) == 16 */
158 158
159struct sadb_x_kmprivate { 159struct sadb_x_kmprivate {
160 uint16_t sadb_x_kmprivate_len; 160 __u16 sadb_x_kmprivate_len;
161 uint16_t sadb_x_kmprivate_exttype; 161 __u16 sadb_x_kmprivate_exttype;
162 uint32_t sadb_x_kmprivate_reserved; 162 __u32 sadb_x_kmprivate_reserved;
163} __attribute__((packed)); 163} __attribute__((packed));
164/* sizeof(struct sadb_x_kmprivate) == 8 */ 164/* sizeof(struct sadb_x_kmprivate) == 8 */
165 165
166struct sadb_x_sa2 { 166struct sadb_x_sa2 {
167 uint16_t sadb_x_sa2_len; 167 __u16 sadb_x_sa2_len;
168 uint16_t sadb_x_sa2_exttype; 168 __u16 sadb_x_sa2_exttype;
169 uint8_t sadb_x_sa2_mode; 169 __u8 sadb_x_sa2_mode;
170 uint8_t sadb_x_sa2_reserved1; 170 __u8 sadb_x_sa2_reserved1;
171 uint16_t sadb_x_sa2_reserved2; 171 __u16 sadb_x_sa2_reserved2;
172 uint32_t sadb_x_sa2_sequence; 172 __u32 sadb_x_sa2_sequence;
173 uint32_t sadb_x_sa2_reqid; 173 __u32 sadb_x_sa2_reqid;
174} __attribute__((packed)); 174} __attribute__((packed));
175/* sizeof(struct sadb_x_sa2) == 16 */ 175/* sizeof(struct sadb_x_sa2) == 16 */
176 176
177struct sadb_x_policy { 177struct sadb_x_policy {
178 uint16_t sadb_x_policy_len; 178 __u16 sadb_x_policy_len;
179 uint16_t sadb_x_policy_exttype; 179 __u16 sadb_x_policy_exttype;
180 uint16_t sadb_x_policy_type; 180 __u16 sadb_x_policy_type;
181 uint8_t sadb_x_policy_dir; 181 __u8 sadb_x_policy_dir;
182 uint8_t sadb_x_policy_reserved; 182 __u8 sadb_x_policy_reserved;
183 uint32_t sadb_x_policy_id; 183 __u32 sadb_x_policy_id;
184 uint32_t sadb_x_policy_priority; 184 __u32 sadb_x_policy_priority;
185} __attribute__((packed)); 185} __attribute__((packed));
186/* sizeof(struct sadb_x_policy) == 16 */ 186/* sizeof(struct sadb_x_policy) == 16 */
187 187
188struct sadb_x_ipsecrequest { 188struct sadb_x_ipsecrequest {
189 uint16_t sadb_x_ipsecrequest_len; 189 __u16 sadb_x_ipsecrequest_len;
190 uint16_t sadb_x_ipsecrequest_proto; 190 __u16 sadb_x_ipsecrequest_proto;
191 uint8_t sadb_x_ipsecrequest_mode; 191 __u8 sadb_x_ipsecrequest_mode;
192 uint8_t sadb_x_ipsecrequest_level; 192 __u8 sadb_x_ipsecrequest_level;
193 uint16_t sadb_x_ipsecrequest_reserved1; 193 __u16 sadb_x_ipsecrequest_reserved1;
194 uint32_t sadb_x_ipsecrequest_reqid; 194 __u32 sadb_x_ipsecrequest_reqid;
195 uint32_t sadb_x_ipsecrequest_reserved2; 195 __u32 sadb_x_ipsecrequest_reserved2;
196} __attribute__((packed)); 196} __attribute__((packed));
197/* sizeof(struct sadb_x_ipsecrequest) == 16 */ 197/* sizeof(struct sadb_x_ipsecrequest) == 16 */
198 198
@@ -200,38 +200,38 @@ struct sadb_x_ipsecrequest {
200 * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06 200 * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06
201 */ 201 */
202struct sadb_x_nat_t_type { 202struct sadb_x_nat_t_type {
203 uint16_t sadb_x_nat_t_type_len; 203 __u16 sadb_x_nat_t_type_len;
204 uint16_t sadb_x_nat_t_type_exttype; 204 __u16 sadb_x_nat_t_type_exttype;
205 uint8_t sadb_x_nat_t_type_type; 205 __u8 sadb_x_nat_t_type_type;
206 uint8_t sadb_x_nat_t_type_reserved[3]; 206 __u8 sadb_x_nat_t_type_reserved[3];
207} __attribute__((packed)); 207} __attribute__((packed));
208/* sizeof(struct sadb_x_nat_t_type) == 8 */ 208/* sizeof(struct sadb_x_nat_t_type) == 8 */
209 209
210/* Pass a NAT Traversal port (Source or Dest port) */ 210/* Pass a NAT Traversal port (Source or Dest port) */
211struct sadb_x_nat_t_port { 211struct sadb_x_nat_t_port {
212 uint16_t sadb_x_nat_t_port_len; 212 __u16 sadb_x_nat_t_port_len;
213 uint16_t sadb_x_nat_t_port_exttype; 213 __u16 sadb_x_nat_t_port_exttype;
214 __be16 sadb_x_nat_t_port_port; 214 __be16 sadb_x_nat_t_port_port;
215 uint16_t sadb_x_nat_t_port_reserved; 215 __u16 sadb_x_nat_t_port_reserved;
216} __attribute__((packed)); 216} __attribute__((packed));
217/* sizeof(struct sadb_x_nat_t_port) == 8 */ 217/* sizeof(struct sadb_x_nat_t_port) == 8 */
218 218
219/* Generic LSM security context */ 219/* Generic LSM security context */
220struct sadb_x_sec_ctx { 220struct sadb_x_sec_ctx {
221 uint16_t sadb_x_sec_len; 221 __u16 sadb_x_sec_len;
222 uint16_t sadb_x_sec_exttype; 222 __u16 sadb_x_sec_exttype;
223 uint8_t sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ 223 __u8 sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */
224 uint8_t sadb_x_ctx_doi; 224 __u8 sadb_x_ctx_doi;
225 uint16_t sadb_x_ctx_len; 225 __u16 sadb_x_ctx_len;
226} __attribute__((packed)); 226} __attribute__((packed));
227/* sizeof(struct sadb_sec_ctx) = 8 */ 227/* sizeof(struct sadb_sec_ctx) = 8 */
228 228
229/* Used by MIGRATE to pass addresses IKE will use to perform 229/* Used by MIGRATE to pass addresses IKE will use to perform
230 * negotiation with the peer */ 230 * negotiation with the peer */
231struct sadb_x_kmaddress { 231struct sadb_x_kmaddress {
232 uint16_t sadb_x_kmaddress_len; 232 __u16 sadb_x_kmaddress_len;
233 uint16_t sadb_x_kmaddress_exttype; 233 __u16 sadb_x_kmaddress_exttype;
234 uint32_t sadb_x_kmaddress_reserved; 234 __u32 sadb_x_kmaddress_reserved;
235} __attribute__((packed)); 235} __attribute__((packed));
236/* sizeof(struct sadb_x_kmaddress) == 8 */ 236/* sizeof(struct sadb_x_kmaddress) == 8 */
237 237
diff --git a/include/linux/phy.h b/include/linux/phy.h
index d7e54d98869f..97e40cb6b588 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -315,8 +315,7 @@ struct phy_device {
315 315
316 /* Interrupt and Polling infrastructure */ 316 /* Interrupt and Polling infrastructure */
317 struct work_struct phy_queue; 317 struct work_struct phy_queue;
318 struct work_struct state_queue; 318 struct delayed_work state_queue;
319 struct timer_list phy_timer;
320 atomic_t irq_disable; 319 atomic_t irq_disable;
321 320
322 struct mutex lock; 321 struct mutex lock;
@@ -389,6 +388,12 @@ struct phy_driver {
389 /* Enables or disables interrupts */ 388 /* Enables or disables interrupts */
390 int (*config_intr)(struct phy_device *phydev); 389 int (*config_intr)(struct phy_device *phydev);
391 390
391 /*
392 * Checks if the PHY generated an interrupt.
393 * For multi-PHY devices with shared PHY interrupt pin
394 */
395 int (*did_interrupt)(struct phy_device *phydev);
396
392 /* Clears up any memory if needed */ 397 /* Clears up any memory if needed */
393 void (*remove)(struct phy_device *phydev); 398 void (*remove)(struct phy_device *phydev);
394 399
diff --git a/include/linux/pim.h b/include/linux/pim.h
index 1ba0661561a4..252bf6644c51 100644
--- a/include/linux/pim.h
+++ b/include/linux/pim.h
@@ -4,14 +4,14 @@
4#include <asm/byteorder.h> 4#include <asm/byteorder.h>
5 5
6/* Message types - V1 */ 6/* Message types - V1 */
7#define PIM_V1_VERSION __constant_htonl(0x10000000) 7#define PIM_V1_VERSION cpu_to_be32(0x10000000)
8#define PIM_V1_REGISTER 1 8#define PIM_V1_REGISTER 1
9 9
10/* Message types - V2 */ 10/* Message types - V2 */
11#define PIM_VERSION 2 11#define PIM_VERSION 2
12#define PIM_REGISTER 1 12#define PIM_REGISTER 1
13 13
14#define PIM_NULL_REGISTER __constant_htonl(0x40000000) 14#define PIM_NULL_REGISTER cpu_to_be32(0x40000000)
15 15
16/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ 16/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
17struct pimreghdr 17struct pimreghdr
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 8e4120285f72..c8f038554e80 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -134,6 +134,11 @@ struct pipe_buf_operations {
134 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */ 134 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
135#define PIPE_SIZE PAGE_SIZE 135#define PIPE_SIZE PAGE_SIZE
136 136
137/* Pipe lock and unlock operations */
138void pipe_lock(struct pipe_inode_info *);
139void pipe_unlock(struct pipe_inode_info *);
140void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *);
141
137/* Drop the inode semaphore and wait for a pipe event, atomically */ 142/* Drop the inode semaphore and wait for a pipe event, atomically */
138void pipe_wait(struct pipe_inode_info *pipe); 143void pipe_wait(struct pipe_inode_info *pipe);
139 144
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h
index 04b4d7330e6d..d745f5b6c7b0 100644
--- a/include/linux/pktcdvd.h
+++ b/include/linux/pktcdvd.h
@@ -113,6 +113,7 @@ struct pkt_ctrl_command {
113#include <linux/cdrom.h> 113#include <linux/cdrom.h>
114#include <linux/kobject.h> 114#include <linux/kobject.h>
115#include <linux/sysfs.h> 115#include <linux/sysfs.h>
116#include <linux/mempool.h>
116 117
117/* default bio write queue congestion marks */ 118/* default bio write queue congestion marks */
118#define PKT_WRITE_CONGESTION_ON 10000 119#define PKT_WRITE_CONGESTION_ON 10000
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 9a342699c607..72736fd8223c 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -12,6 +12,7 @@
12#define _PLATFORM_DEVICE_H_ 12#define _PLATFORM_DEVICE_H_
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/mod_devicetable.h>
15 16
16struct platform_device { 17struct platform_device {
17 const char * name; 18 const char * name;
@@ -19,8 +20,13 @@ struct platform_device {
19 struct device dev; 20 struct device dev;
20 u32 num_resources; 21 u32 num_resources;
21 struct resource * resource; 22 struct resource * resource;
23 void *platform_data;
24
25 struct platform_device_id *id_entry;
22}; 26};
23 27
28#define platform_get_device_id(pdev) ((pdev)->id_entry)
29
24#define to_platform_device(x) container_of((x), struct platform_device, dev) 30#define to_platform_device(x) container_of((x), struct platform_device, dev)
25 31
26extern int platform_device_register(struct platform_device *); 32extern int platform_device_register(struct platform_device *);
@@ -56,6 +62,7 @@ struct platform_driver {
56 int (*resume_early)(struct platform_device *); 62 int (*resume_early)(struct platform_device *);
57 int (*resume)(struct platform_device *); 63 int (*resume)(struct platform_device *);
58 struct device_driver driver; 64 struct device_driver driver;
65 struct platform_device_id *id_table;
59}; 66};
60 67
61extern int platform_driver_register(struct platform_driver *); 68extern int platform_driver_register(struct platform_driver *);
@@ -70,4 +77,46 @@ extern int platform_driver_probe(struct platform_driver *driver,
70#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) 77#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
71#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) 78#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data))
72 79
80/* early platform driver interface */
81struct early_platform_driver {
82 const char *class_str;
83 struct platform_driver *pdrv;
84 struct list_head list;
85 int requested_id;
86};
87
88#define EARLY_PLATFORM_ID_UNSET -2
89#define EARLY_PLATFORM_ID_ERROR -3
90
91extern int early_platform_driver_register(struct early_platform_driver *epdrv,
92 char *buf);
93extern void early_platform_add_devices(struct platform_device **devs, int num);
94
95static inline int is_early_platform_device(struct platform_device *pdev)
96{
97 return !pdev->dev.driver;
98}
99
100extern void early_platform_driver_register_all(char *class_str);
101extern int early_platform_driver_probe(char *class_str,
102 int nr_probe, int user_only);
103extern void early_platform_cleanup(void);
104
105
106#ifndef MODULE
107#define early_platform_init(class_string, platform_driver) \
108static __initdata struct early_platform_driver early_driver = { \
109 .class_str = class_string, \
110 .pdrv = platform_driver, \
111 .requested_id = EARLY_PLATFORM_ID_UNSET, \
112}; \
113static int __init early_platform_driver_setup_func(char *buf) \
114{ \
115 return early_platform_driver_register(&early_driver, buf); \
116} \
117early_param(class_string, early_platform_driver_setup_func)
118#else /* MODULE */
119#define early_platform_init(class_string, platform_driver)
120#endif /* MODULE */
121
73#endif /* _PLATFORM_DEVICE_H_ */ 122#endif /* _PLATFORM_DEVICE_H_ */
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 85de2f055874..45926d77d6ac 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -96,6 +96,10 @@ struct plist_node {
96# define PLIST_HEAD_LOCK_INIT(_lock) 96# define PLIST_HEAD_LOCK_INIT(_lock)
97#endif 97#endif
98 98
99#define _PLIST_HEAD_INIT(head) \
100 .prio_list = LIST_HEAD_INIT((head).prio_list), \
101 .node_list = LIST_HEAD_INIT((head).node_list)
102
99/** 103/**
100 * PLIST_HEAD_INIT - static struct plist_head initializer 104 * PLIST_HEAD_INIT - static struct plist_head initializer
101 * @head: struct plist_head variable name 105 * @head: struct plist_head variable name
@@ -103,8 +107,7 @@ struct plist_node {
103 */ 107 */
104#define PLIST_HEAD_INIT(head, _lock) \ 108#define PLIST_HEAD_INIT(head, _lock) \
105{ \ 109{ \
106 .prio_list = LIST_HEAD_INIT((head).prio_list), \ 110 _PLIST_HEAD_INIT(head), \
107 .node_list = LIST_HEAD_INIT((head).node_list), \
108 PLIST_HEAD_LOCK_INIT(&(_lock)) \ 111 PLIST_HEAD_LOCK_INIT(&(_lock)) \
109} 112}
110 113
@@ -116,7 +119,7 @@ struct plist_node {
116#define PLIST_NODE_INIT(node, __prio) \ 119#define PLIST_NODE_INIT(node, __prio) \
117{ \ 120{ \
118 .prio = (__prio), \ 121 .prio = (__prio), \
119 .plist = PLIST_HEAD_INIT((node).plist, NULL), \ 122 .plist = { _PLIST_HEAD_INIT((node).plist) }, \
120} 123}
121 124
122/** 125/**
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 24ba5f67b3a3..1d4e2d289821 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -400,6 +400,9 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
400 400
401#else /* !CONFIG_PM_SLEEP */ 401#else /* !CONFIG_PM_SLEEP */
402 402
403#define device_pm_lock() do {} while (0)
404#define device_pm_unlock() do {} while (0)
405
403static inline int device_suspend(pm_message_t state) 406static inline int device_suspend(pm_message_t state)
404{ 407{
405 return 0; 408 return 0;
@@ -409,6 +412,14 @@ static inline int device_suspend(pm_message_t state)
409 412
410#endif /* !CONFIG_PM_SLEEP */ 413#endif /* !CONFIG_PM_SLEEP */
411 414
415/* How to reorder dpm_list after device_move() */
416enum dpm_order {
417 DPM_ORDER_NONE,
418 DPM_ORDER_DEV_AFTER_PARENT,
419 DPM_ORDER_PARENT_BEFORE_DEV,
420 DPM_ORDER_DEV_LAST,
421};
422
412/* 423/*
413 * Global Power Management flags 424 * Global Power Management flags
414 * Used to keep APM and ACPI from both being active 425 * Used to keep APM and ACPI from both being active
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 9f31683728fd..6729f7dcd60e 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -17,6 +17,9 @@
17 */ 17 */
18#define TIMER_ENTRY_STATIC ((void *) 0x74737461) 18#define TIMER_ENTRY_STATIC ((void *) 0x74737461)
19 19
20/********** mm/debug-pagealloc.c **********/
21#define PAGE_POISON 0xaa
22
20/********** mm/slab.c **********/ 23/********** mm/slab.c **********/
21/* 24/*
22 * Magic nums for obj red zoning. 25 * Magic nums for obj red zoning.
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 8ff25e0e7f7a..594c494ac3f0 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -73,6 +73,8 @@ enum power_supply_property {
73 POWER_SUPPLY_PROP_VOLTAGE_AVG, 73 POWER_SUPPLY_PROP_VOLTAGE_AVG,
74 POWER_SUPPLY_PROP_CURRENT_NOW, 74 POWER_SUPPLY_PROP_CURRENT_NOW,
75 POWER_SUPPLY_PROP_CURRENT_AVG, 75 POWER_SUPPLY_PROP_CURRENT_AVG,
76 POWER_SUPPLY_PROP_POWER_NOW,
77 POWER_SUPPLY_PROP_POWER_AVG,
76 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, 78 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
77 POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN, 79 POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN,
78 POWER_SUPPLY_PROP_CHARGE_FULL, 80 POWER_SUPPLY_PROP_CHARGE_FULL,
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
index a942892d6dfe..0d3fa63e90ea 100644
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -22,6 +22,7 @@
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/skbuff.h> 23#include <linux/skbuff.h>
24#include <linux/poll.h> 24#include <linux/poll.h>
25#include <net/net_namespace.h>
25 26
26struct ppp_channel; 27struct ppp_channel;
27 28
@@ -39,8 +40,8 @@ struct ppp_channel {
39 int mtu; /* max transmit packet size */ 40 int mtu; /* max transmit packet size */
40 int hdrlen; /* amount of headroom channel needs */ 41 int hdrlen; /* amount of headroom channel needs */
41 void *ppp; /* opaque to channel */ 42 void *ppp; /* opaque to channel */
42 /* the following are not used at present */
43 int speed; /* transfer rate (bytes/second) */ 43 int speed; /* transfer rate (bytes/second) */
44 /* the following is not used at present */
44 int latency; /* overhead time in milliseconds */ 45 int latency; /* overhead time in milliseconds */
45}; 46};
46 47
@@ -56,6 +57,9 @@ extern void ppp_input(struct ppp_channel *, struct sk_buff *);
56 that we may have missed a packet. */ 57 that we may have missed a packet. */
57extern void ppp_input_error(struct ppp_channel *, int code); 58extern void ppp_input_error(struct ppp_channel *, int code);
58 59
60/* Attach a channel to a given PPP unit in specified net. */
61extern int ppp_register_net_channel(struct net *, struct ppp_channel *);
62
59/* Attach a channel to a given PPP unit. */ 63/* Attach a channel to a given PPP unit. */
60extern int ppp_register_channel(struct ppp_channel *); 64extern int ppp_register_channel(struct ppp_channel *);
61 65
diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h
index 1c866bda2018..0f93ed6b4a88 100644
--- a/include/linux/ppp_defs.h
+++ b/include/linux/ppp_defs.h
@@ -177,8 +177,8 @@ struct ppp_comp_stats {
177 * the last NP packet was sent or received. 177 * the last NP packet was sent or received.
178 */ 178 */
179struct ppp_idle { 179struct ppp_idle {
180 time_t xmit_idle; /* time since last NP packet sent */ 180 __kernel_time_t xmit_idle; /* time since last NP packet sent */
181 time_t recv_idle; /* time since last NP packet received */ 181 __kernel_time_t recv_idle; /* time since last NP packet received */
182}; 182};
183 183
184#endif /* _PPP_DEFS_H_ */ 184#endif /* _PPP_DEFS_H_ */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index b8bdb96eff78..fbfa3d44d33d 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -41,9 +41,6 @@ enum {
41 * while parent/subdir create the directory structure (every 41 * while parent/subdir create the directory structure (every
42 * /proc file has a parent, but "subdir" is NULL for all 42 * /proc file has a parent, but "subdir" is NULL for all
43 * non-directory entries). 43 * non-directory entries).
44 *
45 * "owner" is used to protect module
46 * from unloading while proc_dir_entry is in use
47 */ 44 */
48 45
49typedef int (read_proc_t)(char *page, char **start, off_t off, 46typedef int (read_proc_t)(char *page, char **start, off_t off,
@@ -70,7 +67,6 @@ struct proc_dir_entry {
70 * somewhere. 67 * somewhere.
71 */ 68 */
72 const struct file_operations *proc_fops; 69 const struct file_operations *proc_fops;
73 struct module *owner;
74 struct proc_dir_entry *next, *parent, *subdir; 70 struct proc_dir_entry *next, *parent, *subdir;
75 void *data; 71 void *data;
76 read_proc_t *read_proc; 72 read_proc_t *read_proc;
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 98b93ca4db06..67c15653fc23 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -94,6 +94,7 @@ extern void ptrace_notify(int exit_code);
94extern void __ptrace_link(struct task_struct *child, 94extern void __ptrace_link(struct task_struct *child,
95 struct task_struct *new_parent); 95 struct task_struct *new_parent);
96extern void __ptrace_unlink(struct task_struct *child); 96extern void __ptrace_unlink(struct task_struct *child);
97extern void exit_ptrace(struct task_struct *tracer);
97extern void ptrace_fork(struct task_struct *task, unsigned long clone_flags); 98extern void ptrace_fork(struct task_struct *task, unsigned long clone_flags);
98#define PTRACE_MODE_READ 1 99#define PTRACE_MODE_READ 1
99#define PTRACE_MODE_ATTACH 2 100#define PTRACE_MODE_ATTACH 2
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 3945f803d514..7c775751392c 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -28,4 +28,4 @@ int pwm_enable(struct pwm_device *pwm);
28 */ 28 */
29void pwm_disable(struct pwm_device *pwm); 29void pwm_disable(struct pwm_device *pwm);
30 30
31#endif /* __ASM_ARCH_PWM_H */ 31#endif /* __LINUX_PWM_H */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index d72d5d84fde5..78c48895b12a 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -198,6 +198,7 @@ struct mem_dqblk {
198 qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ 198 qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
199 qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */ 199 qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */
200 qsize_t dqb_curspace; /* current used space */ 200 qsize_t dqb_curspace; /* current used space */
201 qsize_t dqb_rsvspace; /* current reserved space for delalloc*/
201 qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */ 202 qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */
202 qsize_t dqb_isoftlimit; /* preferred inode limit */ 203 qsize_t dqb_isoftlimit; /* preferred inode limit */
203 qsize_t dqb_curinodes; /* current # allocated inodes */ 204 qsize_t dqb_curinodes; /* current # allocated inodes */
@@ -276,8 +277,6 @@ struct dquot {
276 struct mem_dqblk dq_dqb; /* Diskquota usage */ 277 struct mem_dqblk dq_dqb; /* Diskquota usage */
277}; 278};
278 279
279#define NODQUOT (struct dquot *)NULL
280
281#define QUOTA_OK 0 280#define QUOTA_OK 0
282#define NO_QUOTA 1 281#define NO_QUOTA 1
283 282
@@ -308,6 +307,14 @@ struct dquot_operations {
308 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ 307 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */
309 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ 308 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
310 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */ 309 int (*write_info) (struct super_block *, int); /* Write of quota "superblock" */
310 /* reserve quota for delayed block allocation */
311 int (*reserve_space) (struct inode *, qsize_t, int);
312 /* claim reserved quota for delayed alloc */
313 int (*claim_space) (struct inode *, qsize_t);
314 /* release rsved quota for delayed alloc */
315 void (*release_rsv) (struct inode *, qsize_t);
316 /* get reserved quota for delayed alloc */
317 qsize_t (*get_reserved_space) (struct inode *);
311}; 318};
312 319
313/* Operations handling requests from userspace */ 320/* Operations handling requests from userspace */
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 0b35b3a1be05..36353d95c8db 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -35,6 +35,11 @@ void dquot_destroy(struct dquot *dquot);
35int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); 35int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
36int dquot_alloc_inode(const struct inode *inode, qsize_t number); 36int dquot_alloc_inode(const struct inode *inode, qsize_t number);
37 37
38int dquot_reserve_space(struct inode *inode, qsize_t number, int prealloc);
39int dquot_claim_space(struct inode *inode, qsize_t number);
40void dquot_release_reserved_space(struct inode *inode, qsize_t number);
41qsize_t dquot_get_reserved_space(struct inode *inode);
42
38int dquot_free_space(struct inode *inode, qsize_t number); 43int dquot_free_space(struct inode *inode, qsize_t number);
39int dquot_free_inode(const struct inode *inode, qsize_t number); 44int dquot_free_inode(const struct inode *inode, qsize_t number);
40 45
@@ -183,6 +188,16 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
183 return ret; 188 return ret;
184} 189}
185 190
191static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
192{
193 if (sb_any_quota_active(inode->i_sb)) {
194 /* Used space is updated in alloc_space() */
195 if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA)
196 return 1;
197 }
198 return 0;
199}
200
186static inline int vfs_dq_alloc_inode(struct inode *inode) 201static inline int vfs_dq_alloc_inode(struct inode *inode)
187{ 202{
188 if (sb_any_quota_active(inode->i_sb)) { 203 if (sb_any_quota_active(inode->i_sb)) {
@@ -193,6 +208,31 @@ static inline int vfs_dq_alloc_inode(struct inode *inode)
193 return 0; 208 return 0;
194} 209}
195 210
211/*
212 * Convert in-memory reserved quotas to real consumed quotas
213 */
214static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
215{
216 if (sb_any_quota_active(inode->i_sb)) {
217 if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA)
218 return 1;
219 } else
220 inode_add_bytes(inode, nr);
221
222 mark_inode_dirty(inode);
223 return 0;
224}
225
226/*
227 * Release reserved (in-memory) quotas
228 */
229static inline
230void vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
231{
232 if (sb_any_quota_active(inode->i_sb))
233 inode->i_sb->dq_op->release_rsv(inode, nr);
234}
235
196static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) 236static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
197{ 237{
198 if (sb_any_quota_active(inode->i_sb)) 238 if (sb_any_quota_active(inode->i_sb))
@@ -339,6 +379,22 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
339 return 0; 379 return 0;
340} 380}
341 381
382static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
383{
384 return 0;
385}
386
387static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
388{
389 return vfs_dq_alloc_space(inode, nr);
390}
391
392static inline
393int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
394{
395 return 0;
396}
397
342static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) 398static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
343{ 399{
344 inode_sub_bytes(inode, nr); 400 inode_sub_bytes(inode, nr);
@@ -354,67 +410,48 @@ static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
354 410
355static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr) 411static inline int vfs_dq_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
356{ 412{
357 return vfs_dq_prealloc_space_nodirty(inode, 413 return vfs_dq_prealloc_space_nodirty(inode, nr << inode->i_blkbits);
358 nr << inode->i_sb->s_blocksize_bits);
359} 414}
360 415
361static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr) 416static inline int vfs_dq_prealloc_block(struct inode *inode, qsize_t nr)
362{ 417{
363 return vfs_dq_prealloc_space(inode, 418 return vfs_dq_prealloc_space(inode, nr << inode->i_blkbits);
364 nr << inode->i_sb->s_blocksize_bits);
365} 419}
366 420
367static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr) 421static inline int vfs_dq_alloc_block_nodirty(struct inode *inode, qsize_t nr)
368{ 422{
369 return vfs_dq_alloc_space_nodirty(inode, 423 return vfs_dq_alloc_space_nodirty(inode, nr << inode->i_blkbits);
370 nr << inode->i_sb->s_blocksize_bits);
371} 424}
372 425
373static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr) 426static inline int vfs_dq_alloc_block(struct inode *inode, qsize_t nr)
374{ 427{
375 return vfs_dq_alloc_space(inode, 428 return vfs_dq_alloc_space(inode, nr << inode->i_blkbits);
376 nr << inode->i_sb->s_blocksize_bits); 429}
430
431static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr)
432{
433 return vfs_dq_reserve_space(inode, nr << inode->i_blkbits);
434}
435
436static inline int vfs_dq_claim_block(struct inode *inode, qsize_t nr)
437{
438 return vfs_dq_claim_space(inode, nr << inode->i_blkbits);
439}
440
441static inline
442void vfs_dq_release_reservation_block(struct inode *inode, qsize_t nr)
443{
444 vfs_dq_release_reservation_space(inode, nr << inode->i_blkbits);
377} 445}
378 446
379static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr) 447static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)
380{ 448{
381 vfs_dq_free_space_nodirty(inode, nr << inode->i_sb->s_blocksize_bits); 449 vfs_dq_free_space_nodirty(inode, nr << inode->i_blkbits);
382} 450}
383 451
384static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr) 452static inline void vfs_dq_free_block(struct inode *inode, qsize_t nr)
385{ 453{
386 vfs_dq_free_space(inode, nr << inode->i_sb->s_blocksize_bits); 454 vfs_dq_free_space(inode, nr << inode->i_blkbits);
387} 455}
388 456
389/*
390 * Define uppercase equivalents for compatibility with old function names
391 * Can go away when we think all users have been converted (15/04/2008)
392 */
393#define DQUOT_INIT(inode) vfs_dq_init(inode)
394#define DQUOT_DROP(inode) vfs_dq_drop(inode)
395#define DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr) \
396 vfs_dq_prealloc_space_nodirty(inode, nr)
397#define DQUOT_PREALLOC_SPACE(inode, nr) vfs_dq_prealloc_space(inode, nr)
398#define DQUOT_ALLOC_SPACE_NODIRTY(inode, nr) \
399 vfs_dq_alloc_space_nodirty(inode, nr)
400#define DQUOT_ALLOC_SPACE(inode, nr) vfs_dq_alloc_space(inode, nr)
401#define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) \
402 vfs_dq_prealloc_block_nodirty(inode, nr)
403#define DQUOT_PREALLOC_BLOCK(inode, nr) vfs_dq_prealloc_block(inode, nr)
404#define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) \
405 vfs_dq_alloc_block_nodirty(inode, nr)
406#define DQUOT_ALLOC_BLOCK(inode, nr) vfs_dq_alloc_block(inode, nr)
407#define DQUOT_ALLOC_INODE(inode) vfs_dq_alloc_inode(inode)
408#define DQUOT_FREE_SPACE_NODIRTY(inode, nr) \
409 vfs_dq_free_space_nodirty(inode, nr)
410#define DQUOT_FREE_SPACE(inode, nr) vfs_dq_free_space(inode, nr)
411#define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) \
412 vfs_dq_free_block_nodirty(inode, nr)
413#define DQUOT_FREE_BLOCK(inode, nr) vfs_dq_free_block(inode, nr)
414#define DQUOT_FREE_INODE(inode) vfs_dq_free_inode(inode)
415#define DQUOT_TRANSFER(inode, iattr) vfs_dq_transfer(inode, iattr)
416#define DQUOT_SYNC(sb) vfs_dq_sync(sb)
417#define DQUOT_OFF(sb, remount) vfs_dq_off(sb, remount)
418#define DQUOT_ON_REMOUNT(sb) vfs_dq_quota_on_remount(sb)
419
420#endif /* _LINUX_QUOTAOPS_ */ 457#endif /* _LINUX_QUOTAOPS_ */
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
deleted file mode 100644
index e98900671ca9..000000000000
--- a/include/linux/raid/bitmap.h
+++ /dev/null
@@ -1,288 +0,0 @@
1/*
2 * bitmap.h: Copyright (C) Peter T. Breuer (ptb@ot.uc3m.es) 2003
3 *
4 * additions: Copyright (C) 2003-2004, Paul Clements, SteelEye Technology, Inc.
5 */
6#ifndef BITMAP_H
7#define BITMAP_H 1
8
9#define BITMAP_MAJOR_LO 3
10/* version 4 insists the bitmap is in little-endian order
11 * with version 3, it is host-endian which is non-portable
12 */
13#define BITMAP_MAJOR_HI 4
14#define BITMAP_MAJOR_HOSTENDIAN 3
15
16#define BITMAP_MINOR 39
17
18/*
19 * in-memory bitmap:
20 *
21 * Use 16 bit block counters to track pending writes to each "chunk".
22 * The 2 high order bits are special-purpose, the first is a flag indicating
23 * whether a resync is needed. The second is a flag indicating whether a
24 * resync is active.
25 * This means that the counter is actually 14 bits:
26 *
27 * +--------+--------+------------------------------------------------+
28 * | resync | resync | counter |
29 * | needed | active | |
30 * | (0-1) | (0-1) | (0-16383) |
31 * +--------+--------+------------------------------------------------+
32 *
33 * The "resync needed" bit is set when:
34 * a '1' bit is read from storage at startup.
35 * a write request fails on some drives
36 * a resync is aborted on a chunk with 'resync active' set
37 * It is cleared (and resync-active set) when a resync starts across all drives
38 * of the chunk.
39 *
40 *
41 * The "resync active" bit is set when:
42 * a resync is started on all drives, and resync_needed is set.
43 * resync_needed will be cleared (as long as resync_active wasn't already set).
44 * It is cleared when a resync completes.
45 *
46 * The counter counts pending write requests, plus the on-disk bit.
47 * When the counter is '1' and the resync bits are clear, the on-disk
48 * bit can be cleared aswell, thus setting the counter to 0.
49 * When we set a bit, or in the counter (to start a write), if the fields is
50 * 0, we first set the disk bit and set the counter to 1.
51 *
52 * If the counter is 0, the on-disk bit is clear and the stipe is clean
53 * Anything that dirties the stipe pushes the counter to 2 (at least)
54 * and sets the on-disk bit (lazily).
55 * If a periodic sweep find the counter at 2, it is decremented to 1.
56 * If the sweep find the counter at 1, the on-disk bit is cleared and the
57 * counter goes to zero.
58 *
59 * Also, we'll hijack the "map" pointer itself and use it as two 16 bit block
60 * counters as a fallback when "page" memory cannot be allocated:
61 *
62 * Normal case (page memory allocated):
63 *
64 * page pointer (32-bit)
65 *
66 * [ ] ------+
67 * |
68 * +-------> [ ][ ]..[ ] (4096 byte page == 2048 counters)
69 * c1 c2 c2048
70 *
71 * Hijacked case (page memory allocation failed):
72 *
73 * hijacked page pointer (32-bit)
74 *
75 * [ ][ ] (no page memory allocated)
76 * counter #1 (16-bit) counter #2 (16-bit)
77 *
78 */
79
80#ifdef __KERNEL__
81
82#define PAGE_BITS (PAGE_SIZE << 3)
83#define PAGE_BIT_SHIFT (PAGE_SHIFT + 3)
84
85typedef __u16 bitmap_counter_t;
86#define COUNTER_BITS 16
87#define COUNTER_BIT_SHIFT 4
88#define COUNTER_BYTE_RATIO (COUNTER_BITS / 8)
89#define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3)
90
91#define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1)))
92#define RESYNC_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 2)))
93#define COUNTER_MAX ((bitmap_counter_t) RESYNC_MASK - 1)
94#define NEEDED(x) (((bitmap_counter_t) x) & NEEDED_MASK)
95#define RESYNC(x) (((bitmap_counter_t) x) & RESYNC_MASK)
96#define COUNTER(x) (((bitmap_counter_t) x) & COUNTER_MAX)
97
98/* how many counters per page? */
99#define PAGE_COUNTER_RATIO (PAGE_BITS / COUNTER_BITS)
100/* same, except a shift value for more efficient bitops */
101#define PAGE_COUNTER_SHIFT (PAGE_BIT_SHIFT - COUNTER_BIT_SHIFT)
102/* same, except a mask value for more efficient bitops */
103#define PAGE_COUNTER_MASK (PAGE_COUNTER_RATIO - 1)
104
105#define BITMAP_BLOCK_SIZE 512
106#define BITMAP_BLOCK_SHIFT 9
107
108/* how many blocks per chunk? (this is variable) */
109#define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->chunksize >> BITMAP_BLOCK_SHIFT)
110#define CHUNK_BLOCK_SHIFT(bitmap) ((bitmap)->chunkshift - BITMAP_BLOCK_SHIFT)
111#define CHUNK_BLOCK_MASK(bitmap) (CHUNK_BLOCK_RATIO(bitmap) - 1)
112
113/* when hijacked, the counters and bits represent even larger "chunks" */
114/* there will be 1024 chunks represented by each counter in the page pointers */
115#define PAGEPTR_BLOCK_RATIO(bitmap) \
116 (CHUNK_BLOCK_RATIO(bitmap) << PAGE_COUNTER_SHIFT >> 1)
117#define PAGEPTR_BLOCK_SHIFT(bitmap) \
118 (CHUNK_BLOCK_SHIFT(bitmap) + PAGE_COUNTER_SHIFT - 1)
119#define PAGEPTR_BLOCK_MASK(bitmap) (PAGEPTR_BLOCK_RATIO(bitmap) - 1)
120
121/*
122 * on-disk bitmap:
123 *
124 * Use one bit per "chunk" (block set). We do the disk I/O on the bitmap
125 * file a page at a time. There's a superblock at the start of the file.
126 */
127
128/* map chunks (bits) to file pages - offset by the size of the superblock */
129#define CHUNK_BIT_OFFSET(chunk) ((chunk) + (sizeof(bitmap_super_t) << 3))
130
131#endif
132
133/*
134 * bitmap structures:
135 */
136
137#define BITMAP_MAGIC 0x6d746962
138
139/* use these for bitmap->flags and bitmap->sb->state bit-fields */
140enum bitmap_state {
141 BITMAP_STALE = 0x002, /* the bitmap file is out of date or had -EIO */
142 BITMAP_WRITE_ERROR = 0x004, /* A write error has occurred */
143 BITMAP_HOSTENDIAN = 0x8000,
144};
145
146/* the superblock at the front of the bitmap file -- little endian */
147typedef struct bitmap_super_s {
148 __le32 magic; /* 0 BITMAP_MAGIC */
149 __le32 version; /* 4 the bitmap major for now, could change... */
150 __u8 uuid[16]; /* 8 128 bit uuid - must match md device uuid */
151 __le64 events; /* 24 event counter for the bitmap (1)*/
152 __le64 events_cleared;/*32 event counter when last bit cleared (2) */
153 __le64 sync_size; /* 40 the size of the md device's sync range(3) */
154 __le32 state; /* 48 bitmap state information */
155 __le32 chunksize; /* 52 the bitmap chunk size in bytes */
156 __le32 daemon_sleep; /* 56 seconds between disk flushes */
157 __le32 write_behind; /* 60 number of outstanding write-behind writes */
158
159 __u8 pad[256 - 64]; /* set to zero */
160} bitmap_super_t;
161
162/* notes:
163 * (1) This event counter is updated before the eventcounter in the md superblock
164 * When a bitmap is loaded, it is only accepted if this event counter is equal
165 * to, or one greater than, the event counter in the superblock.
166 * (2) This event counter is updated when the other one is *if*and*only*if* the
167 * array is not degraded. As bits are not cleared when the array is degraded,
168 * this represents the last time that any bits were cleared.
169 * If a device is being added that has an event count with this value or
170 * higher, it is accepted as conforming to the bitmap.
171 * (3)This is the number of sectors represented by the bitmap, and is the range that
172 * resync happens across. For raid1 and raid5/6 it is the size of individual
173 * devices. For raid10 it is the size of the array.
174 */
175
176#ifdef __KERNEL__
177
178/* the in-memory bitmap is represented by bitmap_pages */
179struct bitmap_page {
180 /*
181 * map points to the actual memory page
182 */
183 char *map;
184 /*
185 * in emergencies (when map cannot be alloced), hijack the map
186 * pointer and use it as two counters itself
187 */
188 unsigned int hijacked:1;
189 /*
190 * count of dirty bits on the page
191 */
192 unsigned int count:31;
193};
194
195/* keep track of bitmap file pages that have pending writes on them */
196struct page_list {
197 struct list_head list;
198 struct page *page;
199};
200
201/* the main bitmap structure - one per mddev */
202struct bitmap {
203 struct bitmap_page *bp;
204 unsigned long pages; /* total number of pages in the bitmap */
205 unsigned long missing_pages; /* number of pages not yet allocated */
206
207 mddev_t *mddev; /* the md device that the bitmap is for */
208
209 int counter_bits; /* how many bits per block counter */
210
211 /* bitmap chunksize -- how much data does each bit represent? */
212 unsigned long chunksize;
213 unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */
214 unsigned long chunks; /* total number of data chunks for the array */
215
216 /* We hold a count on the chunk currently being synced, and drop
217 * it when the last block is started. If the resync is aborted
218 * midway, we need to be able to drop that count, so we remember
219 * the counted chunk..
220 */
221 unsigned long syncchunk;
222
223 __u64 events_cleared;
224 int need_sync;
225
226 /* bitmap spinlock */
227 spinlock_t lock;
228
229 long offset; /* offset from superblock if file is NULL */
230 struct file *file; /* backing disk file */
231 struct page *sb_page; /* cached copy of the bitmap file superblock */
232 struct page **filemap; /* list of cache pages for the file */
233 unsigned long *filemap_attr; /* attributes associated w/ filemap pages */
234 unsigned long file_pages; /* number of pages in the file */
235 int last_page_size; /* bytes in the last page */
236
237 unsigned long flags;
238
239 int allclean;
240
241 unsigned long max_write_behind; /* write-behind mode */
242 atomic_t behind_writes;
243
244 /*
245 * the bitmap daemon - periodically wakes up and sweeps the bitmap
246 * file, cleaning up bits and flushing out pages to disk as necessary
247 */
248 unsigned long daemon_lastrun; /* jiffies of last run */
249 unsigned long daemon_sleep; /* how many seconds between updates? */
250 unsigned long last_end_sync; /* when we lasted called end_sync to
251 * update bitmap with resync progress */
252
253 atomic_t pending_writes; /* pending writes to the bitmap file */
254 wait_queue_head_t write_wait;
255 wait_queue_head_t overflow_wait;
256
257};
258
259/* the bitmap API */
260
261/* these are used only by md/bitmap */
262int bitmap_create(mddev_t *mddev);
263void bitmap_flush(mddev_t *mddev);
264void bitmap_destroy(mddev_t *mddev);
265
266void bitmap_print_sb(struct bitmap *bitmap);
267void bitmap_update_sb(struct bitmap *bitmap);
268
269int bitmap_setallbits(struct bitmap *bitmap);
270void bitmap_write_all(struct bitmap *bitmap);
271
272void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e);
273
274/* these are exported */
275int bitmap_startwrite(struct bitmap *bitmap, sector_t offset,
276 unsigned long sectors, int behind);
277void bitmap_endwrite(struct bitmap *bitmap, sector_t offset,
278 unsigned long sectors, int success, int behind);
279int bitmap_start_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int degraded);
280void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, int *blocks, int aborted);
281void bitmap_close_sync(struct bitmap *bitmap);
282void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector);
283
284void bitmap_unplug(struct bitmap *bitmap);
285void bitmap_daemon_work(struct bitmap *bitmap);
286#endif
287
288#endif
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h
deleted file mode 100644
index f38b9c586afb..000000000000
--- a/include/linux/raid/linear.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _LINEAR_H
2#define _LINEAR_H
3
4#include <linux/raid/md.h>
5
6struct dev_info {
7 mdk_rdev_t *rdev;
8 sector_t num_sectors;
9 sector_t start_sector;
10};
11
12typedef struct dev_info dev_info_t;
13
14struct linear_private_data
15{
16 struct linear_private_data *prev; /* earlier version */
17 dev_info_t **hash_table;
18 sector_t spacing;
19 sector_t array_sectors;
20 int sector_shift; /* shift before dividing
21 * by spacing
22 */
23 dev_info_t disks[0];
24};
25
26
27typedef struct linear_private_data linear_conf_t;
28
29#define mddev_to_conf(mddev) ((linear_conf_t *) mddev->private)
30
31#endif
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
deleted file mode 100644
index 82bea14cae1a..000000000000
--- a/include/linux/raid/md.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 md.h : Multiple Devices driver for Linux
3 Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman
4 Copyright (C) 1994-96 Marc ZYNGIER
5 <zyngier@ufr-info-p7.ibp.fr> or
6 <maz@gloups.fdn.fr>
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 as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 You should have received a copy of the GNU General Public License
14 (for example /usr/src/linux/COPYING); if not, write to the Free
15 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16*/
17
18#ifndef _MD_H
19#define _MD_H
20
21#include <linux/blkdev.h>
22#include <linux/seq_file.h>
23
24/*
25 * 'md_p.h' holds the 'physical' layout of RAID devices
26 * 'md_u.h' holds the user <=> kernel API
27 *
28 * 'md_k.h' holds kernel internal definitions
29 */
30
31#include <linux/raid/md_p.h>
32#include <linux/raid/md_u.h>
33#include <linux/raid/md_k.h>
34
35#ifdef CONFIG_MD
36
37/*
38 * Different major versions are not compatible.
39 * Different minor versions are only downward compatible.
40 * Different patchlevel versions are downward and upward compatible.
41 */
42#define MD_MAJOR_VERSION 0
43#define MD_MINOR_VERSION 90
44/*
45 * MD_PATCHLEVEL_VERSION indicates kernel functionality.
46 * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
47 * and major_version/minor_version accordingly
48 * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
49 * in the super status byte
50 * >=3 means that bitmap superblock version 4 is supported, which uses
51 * little-ending representation rather than host-endian
52 */
53#define MD_PATCHLEVEL_VERSION 3
54
55extern int mdp_major;
56
57extern int register_md_personality(struct mdk_personality *p);
58extern int unregister_md_personality(struct mdk_personality *p);
59extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev),
60 mddev_t *mddev, const char *name);
61extern void md_unregister_thread(mdk_thread_t *thread);
62extern void md_wakeup_thread(mdk_thread_t *thread);
63extern void md_check_recovery(mddev_t *mddev);
64extern void md_write_start(mddev_t *mddev, struct bio *bi);
65extern void md_write_end(mddev_t *mddev);
66extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
67extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev);
68
69extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
70 sector_t sector, int size, struct page *page);
71extern void md_super_wait(mddev_t *mddev);
72extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
73 struct page *page, int rw);
74extern void md_do_sync(mddev_t *mddev);
75extern void md_new_event(mddev_t *mddev);
76extern int md_allow_write(mddev_t *mddev);
77extern void md_wait_for_blocked_rdev(mdk_rdev_t *rdev, mddev_t *mddev);
78
79#endif /* CONFIG_MD */
80#endif
81
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
deleted file mode 100644
index 9743e4dbc918..000000000000
--- a/include/linux/raid/md_k.h
+++ /dev/null
@@ -1,402 +0,0 @@
1/*
2 md_k.h : kernel internal structure of the Linux MD driver
3 Copyright (C) 1996-98 Ingo Molnar, Gadi Oxman
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, or (at your option)
8 any later version.
9
10 You should have received a copy of the GNU General Public License
11 (for example /usr/src/linux/COPYING); if not, write to the Free
12 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13*/
14
15#ifndef _MD_K_H
16#define _MD_K_H
17
18/* and dm-bio-list.h is not under include/linux because.... ??? */
19#include "../../../drivers/md/dm-bio-list.h"
20
21#ifdef CONFIG_BLOCK
22
23#define LEVEL_MULTIPATH (-4)
24#define LEVEL_LINEAR (-1)
25#define LEVEL_FAULTY (-5)
26
27/* we need a value for 'no level specified' and 0
28 * means 'raid0', so we need something else. This is
29 * for internal use only
30 */
31#define LEVEL_NONE (-1000000)
32
33#define MaxSector (~(sector_t)0)
34
35typedef struct mddev_s mddev_t;
36typedef struct mdk_rdev_s mdk_rdev_t;
37
38/*
39 * options passed in raidrun:
40 */
41
42/* Currently this must fit in an 'int' */
43#define MAX_CHUNK_SIZE (1<<30)
44
45/*
46 * MD's 'extended' device
47 */
48struct mdk_rdev_s
49{
50 struct list_head same_set; /* RAID devices within the same set */
51
52 sector_t size; /* Device size (in blocks) */
53 mddev_t *mddev; /* RAID array if running */
54 long last_events; /* IO event timestamp */
55
56 struct block_device *bdev; /* block device handle */
57
58 struct page *sb_page;
59 int sb_loaded;
60 __u64 sb_events;
61 sector_t data_offset; /* start of data in array */
62 sector_t sb_start; /* offset of the super block (in 512byte sectors) */
63 int sb_size; /* bytes in the superblock */
64 int preferred_minor; /* autorun support */
65
66 struct kobject kobj;
67
68 /* A device can be in one of three states based on two flags:
69 * Not working: faulty==1 in_sync==0
70 * Fully working: faulty==0 in_sync==1
71 * Working, but not
72 * in sync with array
73 * faulty==0 in_sync==0
74 *
75 * It can never have faulty==1, in_sync==1
76 * This reduces the burden of testing multiple flags in many cases
77 */
78
79 unsigned long flags;
80#define Faulty 1 /* device is known to have a fault */
81#define In_sync 2 /* device is in_sync with rest of array */
82#define WriteMostly 4 /* Avoid reading if at all possible */
83#define BarriersNotsupp 5 /* BIO_RW_BARRIER is not supported */
84#define AllReserved 6 /* If whole device is reserved for
85 * one array */
86#define AutoDetected 7 /* added by auto-detect */
87#define Blocked 8 /* An error occured on an externally
88 * managed array, don't allow writes
89 * until it is cleared */
90#define StateChanged 9 /* Faulty or Blocked has changed during
91 * interrupt, so it needs to be
92 * notified by the thread */
93 wait_queue_head_t blocked_wait;
94
95 int desc_nr; /* descriptor index in the superblock */
96 int raid_disk; /* role of device in array */
97 int saved_raid_disk; /* role that device used to have in the
98 * array and could again if we did a partial
99 * resync from the bitmap
100 */
101 sector_t recovery_offset;/* If this device has been partially
102 * recovered, this is where we were
103 * up to.
104 */
105
106 atomic_t nr_pending; /* number of pending requests.
107 * only maintained for arrays that
108 * support hot removal
109 */
110 atomic_t read_errors; /* number of consecutive read errors that
111 * we have tried to ignore.
112 */
113 atomic_t corrected_errors; /* number of corrected read errors,
114 * for reporting to userspace and storing
115 * in superblock.
116 */
117 struct work_struct del_work; /* used for delayed sysfs removal */
118
119 struct sysfs_dirent *sysfs_state; /* handle for 'state'
120 * sysfs entry */
121};
122
123struct mddev_s
124{
125 void *private;
126 struct mdk_personality *pers;
127 dev_t unit;
128 int md_minor;
129 struct list_head disks;
130 unsigned long flags;
131#define MD_CHANGE_DEVS 0 /* Some device status has changed */
132#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */
133#define MD_CHANGE_PENDING 2 /* superblock update in progress */
134
135 int ro;
136
137 struct gendisk *gendisk;
138
139 struct kobject kobj;
140 int hold_active;
141#define UNTIL_IOCTL 1
142#define UNTIL_STOP 2
143
144 /* Superblock information */
145 int major_version,
146 minor_version,
147 patch_version;
148 int persistent;
149 int external; /* metadata is
150 * managed externally */
151 char metadata_type[17]; /* externally set*/
152 int chunk_size;
153 time_t ctime, utime;
154 int level, layout;
155 char clevel[16];
156 int raid_disks;
157 int max_disks;
158 sector_t size; /* used size of component devices */
159 sector_t array_sectors; /* exported array size */
160 __u64 events;
161
162 char uuid[16];
163
164 /* If the array is being reshaped, we need to record the
165 * new shape and an indication of where we are up to.
166 * This is written to the superblock.
167 * If reshape_position is MaxSector, then no reshape is happening (yet).
168 */
169 sector_t reshape_position;
170 int delta_disks, new_level, new_layout, new_chunk;
171
172 struct mdk_thread_s *thread; /* management thread */
173 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */
174 sector_t curr_resync; /* last block scheduled */
175 unsigned long resync_mark; /* a recent timestamp */
176 sector_t resync_mark_cnt;/* blocks written at resync_mark */
177 sector_t curr_mark_cnt; /* blocks scheduled now */
178
179 sector_t resync_max_sectors; /* may be set by personality */
180
181 sector_t resync_mismatches; /* count of sectors where
182 * parity/replica mismatch found
183 */
184
185 /* allow user-space to request suspension of IO to regions of the array */
186 sector_t suspend_lo;
187 sector_t suspend_hi;
188 /* if zero, use the system-wide default */
189 int sync_speed_min;
190 int sync_speed_max;
191
192 /* resync even though the same disks are shared among md-devices */
193 int parallel_resync;
194
195 int ok_start_degraded;
196 /* recovery/resync flags
197 * NEEDED: we might need to start a resync/recover
198 * RUNNING: a thread is running, or about to be started
199 * SYNC: actually doing a resync, not a recovery
200 * RECOVER: doing recovery, or need to try it.
201 * INTR: resync needs to be aborted for some reason
202 * DONE: thread is done and is waiting to be reaped
203 * REQUEST: user-space has requested a sync (used with SYNC)
204 * CHECK: user-space request for for check-only, no repair
205 * RESHAPE: A reshape is happening
206 *
207 * If neither SYNC or RESHAPE are set, then it is a recovery.
208 */
209#define MD_RECOVERY_RUNNING 0
210#define MD_RECOVERY_SYNC 1
211#define MD_RECOVERY_RECOVER 2
212#define MD_RECOVERY_INTR 3
213#define MD_RECOVERY_DONE 4
214#define MD_RECOVERY_NEEDED 5
215#define MD_RECOVERY_REQUESTED 6
216#define MD_RECOVERY_CHECK 7
217#define MD_RECOVERY_RESHAPE 8
218#define MD_RECOVERY_FROZEN 9
219
220 unsigned long recovery;
221 int recovery_disabled; /* if we detect that recovery
222 * will always fail, set this
223 * so we don't loop trying */
224
225 int in_sync; /* know to not need resync */
226 struct mutex reconfig_mutex;
227 atomic_t active; /* general refcount */
228 atomic_t openers; /* number of active opens */
229
230 int changed; /* true if we might need to reread partition info */
231 int degraded; /* whether md should consider
232 * adding a spare
233 */
234 int barriers_work; /* initialised to true, cleared as soon
235 * as a barrier request to slave
236 * fails. Only supported
237 */
238 struct bio *biolist; /* bios that need to be retried
239 * because BIO_RW_BARRIER is not supported
240 */
241
242 atomic_t recovery_active; /* blocks scheduled, but not written */
243 wait_queue_head_t recovery_wait;
244 sector_t recovery_cp;
245 sector_t resync_min; /* user requested sync
246 * starts here */
247 sector_t resync_max; /* resync should pause
248 * when it gets here */
249
250 struct sysfs_dirent *sysfs_state; /* handle for 'array_state'
251 * file in sysfs.
252 */
253 struct sysfs_dirent *sysfs_action; /* handle for 'sync_action' */
254
255 struct work_struct del_work; /* used for delayed sysfs removal */
256
257 spinlock_t write_lock;
258 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
259 atomic_t pending_writes; /* number of active superblock writes */
260
261 unsigned int safemode; /* if set, update "clean" superblock
262 * when no writes pending.
263 */
264 unsigned int safemode_delay;
265 struct timer_list safemode_timer;
266 atomic_t writes_pending;
267 struct request_queue *queue; /* for plugging ... */
268
269 atomic_t write_behind; /* outstanding async IO */
270 unsigned int max_write_behind; /* 0 = sync */
271
272 struct bitmap *bitmap; /* the bitmap for the device */
273 struct file *bitmap_file; /* the bitmap file */
274 long bitmap_offset; /* offset from superblock of
275 * start of bitmap. May be
276 * negative, but not '0'
277 */
278 long default_bitmap_offset; /* this is the offset to use when
279 * hot-adding a bitmap. It should
280 * eventually be settable by sysfs.
281 */
282
283 struct list_head all_mddevs;
284};
285
286
287static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev)
288{
289 int faulty = test_bit(Faulty, &rdev->flags);
290 if (atomic_dec_and_test(&rdev->nr_pending) && faulty)
291 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
292}
293
294static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
295{
296 atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
297}
298
299struct mdk_personality
300{
301 char *name;
302 int level;
303 struct list_head list;
304 struct module *owner;
305 int (*make_request)(struct request_queue *q, struct bio *bio);
306 int (*run)(mddev_t *mddev);
307 int (*stop)(mddev_t *mddev);
308 void (*status)(struct seq_file *seq, mddev_t *mddev);
309 /* error_handler must set ->faulty and clear ->in_sync
310 * if appropriate, and should abort recovery if needed
311 */
312 void (*error_handler)(mddev_t *mddev, mdk_rdev_t *rdev);
313 int (*hot_add_disk) (mddev_t *mddev, mdk_rdev_t *rdev);
314 int (*hot_remove_disk) (mddev_t *mddev, int number);
315 int (*spare_active) (mddev_t *mddev);
316 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster);
317 int (*resize) (mddev_t *mddev, sector_t sectors);
318 int (*check_reshape) (mddev_t *mddev);
319 int (*start_reshape) (mddev_t *mddev);
320 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size);
321 /* quiesce moves between quiescence states
322 * 0 - fully active
323 * 1 - no new requests allowed
324 * others - reserved
325 */
326 void (*quiesce) (mddev_t *mddev, int state);
327};
328
329
330struct md_sysfs_entry {
331 struct attribute attr;
332 ssize_t (*show)(mddev_t *, char *);
333 ssize_t (*store)(mddev_t *, const char *, size_t);
334};
335
336
337static inline char * mdname (mddev_t * mddev)
338{
339 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
340}
341
342/*
343 * iterates through some rdev ringlist. It's safe to remove the
344 * current 'rdev'. Dont touch 'tmp' though.
345 */
346#define rdev_for_each_list(rdev, tmp, head) \
347 list_for_each_entry_safe(rdev, tmp, head, same_set)
348
349/*
350 * iterates through the 'same array disks' ringlist
351 */
352#define rdev_for_each(rdev, tmp, mddev) \
353 list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set)
354
355#define rdev_for_each_rcu(rdev, mddev) \
356 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
357
358typedef struct mdk_thread_s {
359 void (*run) (mddev_t *mddev);
360 mddev_t *mddev;
361 wait_queue_head_t wqueue;
362 unsigned long flags;
363 struct task_struct *tsk;
364 unsigned long timeout;
365} mdk_thread_t;
366
367#define THREAD_WAKEUP 0
368
369#define __wait_event_lock_irq(wq, condition, lock, cmd) \
370do { \
371 wait_queue_t __wait; \
372 init_waitqueue_entry(&__wait, current); \
373 \
374 add_wait_queue(&wq, &__wait); \
375 for (;;) { \
376 set_current_state(TASK_UNINTERRUPTIBLE); \
377 if (condition) \
378 break; \
379 spin_unlock_irq(&lock); \
380 cmd; \
381 schedule(); \
382 spin_lock_irq(&lock); \
383 } \
384 current->state = TASK_RUNNING; \
385 remove_wait_queue(&wq, &__wait); \
386} while (0)
387
388#define wait_event_lock_irq(wq, condition, lock, cmd) \
389do { \
390 if (condition) \
391 break; \
392 __wait_event_lock_irq(wq, condition, lock, cmd); \
393} while (0)
394
395static inline void safe_put_page(struct page *p)
396{
397 if (p) put_page(p);
398}
399
400#endif /* CONFIG_BLOCK */
401#endif
402
diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h
index 7192035fc4b0..fb1abb3367e9 100644
--- a/include/linux/raid/md_u.h
+++ b/include/linux/raid/md_u.h
@@ -15,6 +15,24 @@
15#ifndef _MD_U_H 15#ifndef _MD_U_H
16#define _MD_U_H 16#define _MD_U_H
17 17
18/*
19 * Different major versions are not compatible.
20 * Different minor versions are only downward compatible.
21 * Different patchlevel versions are downward and upward compatible.
22 */
23#define MD_MAJOR_VERSION 0
24#define MD_MINOR_VERSION 90
25/*
26 * MD_PATCHLEVEL_VERSION indicates kernel functionality.
27 * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
28 * and major_version/minor_version accordingly
29 * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
30 * in the super status byte
31 * >=3 means that bitmap superblock version 4 is supported, which uses
32 * little-ending representation rather than host-endian
33 */
34#define MD_PATCHLEVEL_VERSION 3
35
18/* ioctls */ 36/* ioctls */
19 37
20/* status */ 38/* status */
@@ -46,6 +64,12 @@
46#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) 64#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
47#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) 65#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
48 66
67/* 63 partitions with the alternate major number (mdp) */
68#define MdpMinorShift 6
69#ifdef __KERNEL__
70extern int mdp_major;
71#endif
72
49typedef struct mdu_version_s { 73typedef struct mdu_version_s {
50 int major; 74 int major;
51 int minor; 75 int minor;
@@ -85,6 +109,17 @@ typedef struct mdu_array_info_s {
85 109
86} mdu_array_info_t; 110} mdu_array_info_t;
87 111
112/* non-obvious values for 'level' */
113#define LEVEL_MULTIPATH (-4)
114#define LEVEL_LINEAR (-1)
115#define LEVEL_FAULTY (-5)
116
117/* we need a value for 'no level specified' and 0
118 * means 'raid0', so we need something else. This is
119 * for internal use only
120 */
121#define LEVEL_NONE (-1000000)
122
88typedef struct mdu_disk_info_s { 123typedef struct mdu_disk_info_s {
89 /* 124 /*
90 * configuration/status of one particular disk 125 * configuration/status of one particular disk
diff --git a/include/linux/raid/multipath.h b/include/linux/raid/multipath.h
deleted file mode 100644
index 6f53fc177a47..000000000000
--- a/include/linux/raid/multipath.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _MULTIPATH_H
2#define _MULTIPATH_H
3
4#include <linux/raid/md.h>
5
6struct multipath_info {
7 mdk_rdev_t *rdev;
8};
9
10struct multipath_private_data {
11 mddev_t *mddev;
12 struct multipath_info *multipaths;
13 int raid_disks;
14 int working_disks;
15 spinlock_t device_lock;
16 struct list_head retry_list;
17
18 mempool_t *pool;
19};
20
21typedef struct multipath_private_data multipath_conf_t;
22
23/*
24 * this is the only point in the RAID code where we violate
25 * C type safety. mddev->private is an 'opaque' pointer.
26 */
27#define mddev_to_conf(mddev) ((multipath_conf_t *) mddev->private)
28
29/*
30 * this is our 'private' 'collective' MULTIPATH buffer head.
31 * it contains information about what kind of IO operations were started
32 * for this MULTIPATH operation, and about their status:
33 */
34
35struct multipath_bh {
36 mddev_t *mddev;
37 struct bio *master_bio;
38 struct bio bio;
39 int path;
40 struct list_head retry_list;
41};
42#endif
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
new file mode 100644
index 000000000000..d92480f8285c
--- /dev/null
+++ b/include/linux/raid/pq.h
@@ -0,0 +1,132 @@
1/* -*- linux-c -*- ------------------------------------------------------- *
2 *
3 * Copyright 2003 H. Peter Anvin - All Rights Reserved
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, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
10 *
11 * ----------------------------------------------------------------------- */
12
13#ifndef LINUX_RAID_RAID6_H
14#define LINUX_RAID_RAID6_H
15
16#ifdef __KERNEL__
17
18/* Set to 1 to use kernel-wide empty_zero_page */
19#define RAID6_USE_EMPTY_ZERO_PAGE 0
20#include <linux/blkdev.h>
21
22/* We need a pre-zeroed page... if we don't want to use the kernel-provided
23 one define it here */
24#if RAID6_USE_EMPTY_ZERO_PAGE
25# define raid6_empty_zero_page empty_zero_page
26#else
27extern const char raid6_empty_zero_page[PAGE_SIZE];
28#endif
29
30#else /* ! __KERNEL__ */
31/* Used for testing in user space */
32
33#include <errno.h>
34#include <inttypes.h>
35#include <limits.h>
36#include <stddef.h>
37#include <sys/mman.h>
38#include <sys/types.h>
39
40/* Not standard, but glibc defines it */
41#define BITS_PER_LONG __WORDSIZE
42
43typedef uint8_t u8;
44typedef uint16_t u16;
45typedef uint32_t u32;
46typedef uint64_t u64;
47
48#ifndef PAGE_SIZE
49# define PAGE_SIZE 4096
50#endif
51extern const char raid6_empty_zero_page[PAGE_SIZE];
52
53#define __init
54#define __exit
55#define __attribute_const__ __attribute__((const))
56#define noinline __attribute__((noinline))
57
58#define preempt_enable()
59#define preempt_disable()
60#define cpu_has_feature(x) 1
61#define enable_kernel_altivec()
62#define disable_kernel_altivec()
63
64#define EXPORT_SYMBOL(sym)
65#define MODULE_LICENSE(licence)
66#define subsys_initcall(x)
67#define module_exit(x)
68#endif /* __KERNEL__ */
69
70/* Routine choices */
71struct raid6_calls {
72 void (*gen_syndrome)(int, size_t, void **);
73 int (*valid)(void); /* Returns 1 if this routine set is usable */
74 const char *name; /* Name of this routine set */
75 int prefer; /* Has special performance attribute */
76};
77
78/* Selected algorithm */
79extern struct raid6_calls raid6_call;
80
81/* Algorithm list */
82extern const struct raid6_calls * const raid6_algos[];
83int raid6_select_algo(void);
84
85/* Return values from chk_syndrome */
86#define RAID6_OK 0
87#define RAID6_P_BAD 1
88#define RAID6_Q_BAD 2
89#define RAID6_PQ_BAD 3
90
91/* Galois field tables */
92extern const u8 raid6_gfmul[256][256] __attribute__((aligned(256)));
93extern const u8 raid6_gfexp[256] __attribute__((aligned(256)));
94extern const u8 raid6_gfinv[256] __attribute__((aligned(256)));
95extern const u8 raid6_gfexi[256] __attribute__((aligned(256)));
96
97/* Recovery routines */
98void raid6_2data_recov(int disks, size_t bytes, int faila, int failb,
99 void **ptrs);
100void raid6_datap_recov(int disks, size_t bytes, int faila, void **ptrs);
101void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
102 void **ptrs);
103
104/* Some definitions to allow code to be compiled for testing in userspace */
105#ifndef __KERNEL__
106
107# define jiffies raid6_jiffies()
108# define printk printf
109# define GFP_KERNEL 0
110# define __get_free_pages(x, y) ((unsigned long)mmap(NULL, PAGE_SIZE << (y), \
111 PROT_READ|PROT_WRITE, \
112 MAP_PRIVATE|MAP_ANONYMOUS,\
113 0, 0))
114# define free_pages(x, y) munmap((void *)(x), (y)*PAGE_SIZE)
115
116static inline void cpu_relax(void)
117{
118 /* Nothing */
119}
120
121#undef HZ
122#define HZ 1000
123static inline uint32_t raid6_jiffies(void)
124{
125 struct timeval tv;
126 gettimeofday(&tv, NULL);
127 return tv.tv_sec*1000 + tv.tv_usec/1000;
128}
129
130#endif /* ! __KERNEL__ */
131
132#endif /* LINUX_RAID_RAID6_H */
diff --git a/include/linux/raid/raid0.h b/include/linux/raid/raid0.h
deleted file mode 100644
index fd42aa87c391..000000000000
--- a/include/linux/raid/raid0.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef _RAID0_H
2#define _RAID0_H
3
4#include <linux/raid/md.h>
5
6struct strip_zone
7{
8 sector_t zone_start; /* Zone offset in md_dev (in sectors) */
9 sector_t dev_start; /* Zone offset in real dev (in sectors) */
10 sector_t sectors; /* Zone size in sectors */
11 int nb_dev; /* # of devices attached to the zone */
12 mdk_rdev_t **dev; /* Devices attached to the zone */
13};
14
15struct raid0_private_data
16{
17 struct strip_zone **hash_table; /* Table of indexes into strip_zone */
18 struct strip_zone *strip_zone;
19 mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */
20 int nr_strip_zones;
21
22 sector_t spacing;
23 int sector_shift; /* shift this before divide by spacing */
24};
25
26typedef struct raid0_private_data raid0_conf_t;
27
28#define mddev_to_conf(mddev) ((raid0_conf_t *) mddev->private)
29
30#endif
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
deleted file mode 100644
index 0a9ba7c3302e..000000000000
--- a/include/linux/raid/raid1.h
+++ /dev/null
@@ -1,134 +0,0 @@
1#ifndef _RAID1_H
2#define _RAID1_H
3
4#include <linux/raid/md.h>
5
6typedef struct mirror_info mirror_info_t;
7
8struct mirror_info {
9 mdk_rdev_t *rdev;
10 sector_t head_position;
11};
12
13/*
14 * memory pools need a pointer to the mddev, so they can force an unplug
15 * when memory is tight, and a count of the number of drives that the
16 * pool was allocated for, so they know how much to allocate and free.
17 * mddev->raid_disks cannot be used, as it can change while a pool is active
18 * These two datums are stored in a kmalloced struct.
19 */
20
21struct pool_info {
22 mddev_t *mddev;
23 int raid_disks;
24};
25
26
27typedef struct r1bio_s r1bio_t;
28
29struct r1_private_data_s {
30 mddev_t *mddev;
31 mirror_info_t *mirrors;
32 int raid_disks;
33 int last_used;
34 sector_t next_seq_sect;
35 spinlock_t device_lock;
36
37 struct list_head retry_list;
38 /* queue pending writes and submit them on unplug */
39 struct bio_list pending_bio_list;
40 /* queue of writes that have been unplugged */
41 struct bio_list flushing_bio_list;
42
43 /* for use when syncing mirrors: */
44
45 spinlock_t resync_lock;
46 int nr_pending;
47 int nr_waiting;
48 int nr_queued;
49 int barrier;
50 sector_t next_resync;
51 int fullsync; /* set to 1 if a full sync is needed,
52 * (fresh device added).
53 * Cleared when a sync completes.
54 */
55
56 wait_queue_head_t wait_barrier;
57
58 struct pool_info *poolinfo;
59
60 struct page *tmppage;
61
62 mempool_t *r1bio_pool;
63 mempool_t *r1buf_pool;
64};
65
66typedef struct r1_private_data_s conf_t;
67
68/*
69 * this is the only point in the RAID code where we violate
70 * C type safety. mddev->private is an 'opaque' pointer.
71 */
72#define mddev_to_conf(mddev) ((conf_t *) mddev->private)
73
74/*
75 * this is our 'private' RAID1 bio.
76 *
77 * it contains information about what kind of IO operations were started
78 * for this RAID1 operation, and about their status:
79 */
80
81struct r1bio_s {
82 atomic_t remaining; /* 'have we finished' count,
83 * used from IRQ handlers
84 */
85 atomic_t behind_remaining; /* number of write-behind ios remaining
86 * in this BehindIO request
87 */
88 sector_t sector;
89 int sectors;
90 unsigned long state;
91 mddev_t *mddev;
92 /*
93 * original bio going to /dev/mdx
94 */
95 struct bio *master_bio;
96 /*
97 * if the IO is in READ direction, then this is where we read
98 */
99 int read_disk;
100
101 struct list_head retry_list;
102 struct bitmap_update *bitmap_update;
103 /*
104 * if the IO is in WRITE direction, then multiple bios are used.
105 * We choose the number when they are allocated.
106 */
107 struct bio *bios[0];
108 /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/
109};
110
111/* when we get a read error on a read-only array, we redirect to another
112 * device without failing the first device, or trying to over-write to
113 * correct the read error. To keep track of bad blocks on a per-bio
114 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
115 */
116#define IO_BLOCKED ((struct bio*)1)
117
118/* bits for r1bio.state */
119#define R1BIO_Uptodate 0
120#define R1BIO_IsSync 1
121#define R1BIO_Degraded 2
122#define R1BIO_BehindIO 3
123#define R1BIO_Barrier 4
124#define R1BIO_BarrierRetry 5
125/* For write-behind requests, we call bi_end_io when
126 * the last non-write-behind device completes, providing
127 * any write was successful. Otherwise we call when
128 * any write-behind write succeeds, otherwise we call
129 * with failure when last write completes (and all failed).
130 * Record that bi_end_io was called with this flag...
131 */
132#define R1BIO_Returned 6
133
134#endif
diff --git a/include/linux/raid/raid10.h b/include/linux/raid/raid10.h
deleted file mode 100644
index e9091cfeb286..000000000000
--- a/include/linux/raid/raid10.h
+++ /dev/null
@@ -1,123 +0,0 @@
1#ifndef _RAID10_H
2#define _RAID10_H
3
4#include <linux/raid/md.h>
5
6typedef struct mirror_info mirror_info_t;
7
8struct mirror_info {
9 mdk_rdev_t *rdev;
10 sector_t head_position;
11};
12
13typedef struct r10bio_s r10bio_t;
14
15struct r10_private_data_s {
16 mddev_t *mddev;
17 mirror_info_t *mirrors;
18 int raid_disks;
19 spinlock_t device_lock;
20
21 /* geometry */
22 int near_copies; /* number of copies layed out raid0 style */
23 int far_copies; /* number of copies layed out
24 * at large strides across drives
25 */
26 int far_offset; /* far_copies are offset by 1 stripe
27 * instead of many
28 */
29 int copies; /* near_copies * far_copies.
30 * must be <= raid_disks
31 */
32 sector_t stride; /* distance between far copies.
33 * This is size / far_copies unless
34 * far_offset, in which case it is
35 * 1 stripe.
36 */
37
38 int chunk_shift; /* shift from chunks to sectors */
39 sector_t chunk_mask;
40
41 struct list_head retry_list;
42 /* queue pending writes and submit them on unplug */
43 struct bio_list pending_bio_list;
44
45
46 spinlock_t resync_lock;
47 int nr_pending;
48 int nr_waiting;
49 int nr_queued;
50 int barrier;
51 sector_t next_resync;
52 int fullsync; /* set to 1 if a full sync is needed,
53 * (fresh device added).
54 * Cleared when a sync completes.
55 */
56
57 wait_queue_head_t wait_barrier;
58
59 mempool_t *r10bio_pool;
60 mempool_t *r10buf_pool;
61 struct page *tmppage;
62};
63
64typedef struct r10_private_data_s conf_t;
65
66/*
67 * this is the only point in the RAID code where we violate
68 * C type safety. mddev->private is an 'opaque' pointer.
69 */
70#define mddev_to_conf(mddev) ((conf_t *) mddev->private)
71
72/*
73 * this is our 'private' RAID10 bio.
74 *
75 * it contains information about what kind of IO operations were started
76 * for this RAID10 operation, and about their status:
77 */
78
79struct r10bio_s {
80 atomic_t remaining; /* 'have we finished' count,
81 * used from IRQ handlers
82 */
83 sector_t sector; /* virtual sector number */
84 int sectors;
85 unsigned long state;
86 mddev_t *mddev;
87 /*
88 * original bio going to /dev/mdx
89 */
90 struct bio *master_bio;
91 /*
92 * if the IO is in READ direction, then this is where we read
93 */
94 int read_slot;
95
96 struct list_head retry_list;
97 /*
98 * if the IO is in WRITE direction, then multiple bios are used,
99 * one for each copy.
100 * When resyncing we also use one for each copy.
101 * When reconstructing, we use 2 bios, one for read, one for write.
102 * We choose the number when they are allocated.
103 */
104 struct {
105 struct bio *bio;
106 sector_t addr;
107 int devnum;
108 } devs[0];
109};
110
111/* when we get a read error on a read-only array, we redirect to another
112 * device without failing the first device, or trying to over-write to
113 * correct the read error. To keep track of bad blocks on a per-bio
114 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
115 */
116#define IO_BLOCKED ((struct bio*)1)
117
118/* bits for r10bio.state */
119#define R10BIO_Uptodate 0
120#define R10BIO_IsSync 1
121#define R10BIO_IsRecover 2
122#define R10BIO_Degraded 3
123#endif
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
deleted file mode 100644
index 3b2672792457..000000000000
--- a/include/linux/raid/raid5.h
+++ /dev/null
@@ -1,402 +0,0 @@
1#ifndef _RAID5_H
2#define _RAID5_H
3
4#include <linux/raid/md.h>
5#include <linux/raid/xor.h>
6
7/*
8 *
9 * Each stripe contains one buffer per disc. Each buffer can be in
10 * one of a number of states stored in "flags". Changes between
11 * these states happen *almost* exclusively under a per-stripe
12 * spinlock. Some very specific changes can happen in bi_end_io, and
13 * these are not protected by the spin lock.
14 *
15 * The flag bits that are used to represent these states are:
16 * R5_UPTODATE and R5_LOCKED
17 *
18 * State Empty == !UPTODATE, !LOCK
19 * We have no data, and there is no active request
20 * State Want == !UPTODATE, LOCK
21 * A read request is being submitted for this block
22 * State Dirty == UPTODATE, LOCK
23 * Some new data is in this buffer, and it is being written out
24 * State Clean == UPTODATE, !LOCK
25 * We have valid data which is the same as on disc
26 *
27 * The possible state transitions are:
28 *
29 * Empty -> Want - on read or write to get old data for parity calc
30 * Empty -> Dirty - on compute_parity to satisfy write/sync request.(RECONSTRUCT_WRITE)
31 * Empty -> Clean - on compute_block when computing a block for failed drive
32 * Want -> Empty - on failed read
33 * Want -> Clean - on successful completion of read request
34 * Dirty -> Clean - on successful completion of write request
35 * Dirty -> Clean - on failed write
36 * Clean -> Dirty - on compute_parity to satisfy write/sync (RECONSTRUCT or RMW)
37 *
38 * The Want->Empty, Want->Clean, Dirty->Clean, transitions
39 * all happen in b_end_io at interrupt time.
40 * Each sets the Uptodate bit before releasing the Lock bit.
41 * This leaves one multi-stage transition:
42 * Want->Dirty->Clean
43 * This is safe because thinking that a Clean buffer is actually dirty
44 * will at worst delay some action, and the stripe will be scheduled
45 * for attention after the transition is complete.
46 *
47 * There is one possibility that is not covered by these states. That
48 * is if one drive has failed and there is a spare being rebuilt. We
49 * can't distinguish between a clean block that has been generated
50 * from parity calculations, and a clean block that has been
51 * successfully written to the spare ( or to parity when resyncing).
52 * To distingush these states we have a stripe bit STRIPE_INSYNC that
53 * is set whenever a write is scheduled to the spare, or to the parity
54 * disc if there is no spare. A sync request clears this bit, and
55 * when we find it set with no buffers locked, we know the sync is
56 * complete.
57 *
58 * Buffers for the md device that arrive via make_request are attached
59 * to the appropriate stripe in one of two lists linked on b_reqnext.
60 * One list (bh_read) for read requests, one (bh_write) for write.
61 * There should never be more than one buffer on the two lists
62 * together, but we are not guaranteed of that so we allow for more.
63 *
64 * If a buffer is on the read list when the associated cache buffer is
65 * Uptodate, the data is copied into the read buffer and it's b_end_io
66 * routine is called. This may happen in the end_request routine only
67 * if the buffer has just successfully been read. end_request should
68 * remove the buffers from the list and then set the Uptodate bit on
69 * the buffer. Other threads may do this only if they first check
70 * that the Uptodate bit is set. Once they have checked that they may
71 * take buffers off the read queue.
72 *
73 * When a buffer on the write list is committed for write it is copied
74 * into the cache buffer, which is then marked dirty, and moved onto a
75 * third list, the written list (bh_written). Once both the parity
76 * block and the cached buffer are successfully written, any buffer on
77 * a written list can be returned with b_end_io.
78 *
79 * The write list and read list both act as fifos. The read list is
80 * protected by the device_lock. The write and written lists are
81 * protected by the stripe lock. The device_lock, which can be
82 * claimed while the stipe lock is held, is only for list
83 * manipulations and will only be held for a very short time. It can
84 * be claimed from interrupts.
85 *
86 *
87 * Stripes in the stripe cache can be on one of two lists (or on
88 * neither). The "inactive_list" contains stripes which are not
89 * currently being used for any request. They can freely be reused
90 * for another stripe. The "handle_list" contains stripes that need
91 * to be handled in some way. Both of these are fifo queues. Each
92 * stripe is also (potentially) linked to a hash bucket in the hash
93 * table so that it can be found by sector number. Stripes that are
94 * not hashed must be on the inactive_list, and will normally be at
95 * the front. All stripes start life this way.
96 *
97 * The inactive_list, handle_list and hash bucket lists are all protected by the
98 * device_lock.
99 * - stripes on the inactive_list never have their stripe_lock held.
100 * - stripes have a reference counter. If count==0, they are on a list.
101 * - If a stripe might need handling, STRIPE_HANDLE is set.
102 * - When refcount reaches zero, then if STRIPE_HANDLE it is put on
103 * handle_list else inactive_list
104 *
105 * This, combined with the fact that STRIPE_HANDLE is only ever
106 * cleared while a stripe has a non-zero count means that if the
107 * refcount is 0 and STRIPE_HANDLE is set, then it is on the
108 * handle_list and if recount is 0 and STRIPE_HANDLE is not set, then
109 * the stripe is on inactive_list.
110 *
111 * The possible transitions are:
112 * activate an unhashed/inactive stripe (get_active_stripe())
113 * lockdev check-hash unlink-stripe cnt++ clean-stripe hash-stripe unlockdev
114 * activate a hashed, possibly active stripe (get_active_stripe())
115 * lockdev check-hash if(!cnt++)unlink-stripe unlockdev
116 * attach a request to an active stripe (add_stripe_bh())
117 * lockdev attach-buffer unlockdev
118 * handle a stripe (handle_stripe())
119 * lockstripe clrSTRIPE_HANDLE ...
120 * (lockdev check-buffers unlockdev) ..
121 * change-state ..
122 * record io/ops needed unlockstripe schedule io/ops
123 * release an active stripe (release_stripe())
124 * lockdev if (!--cnt) { if STRIPE_HANDLE, add to handle_list else add to inactive-list } unlockdev
125 *
126 * The refcount counts each thread that have activated the stripe,
127 * plus raid5d if it is handling it, plus one for each active request
128 * on a cached buffer, and plus one if the stripe is undergoing stripe
129 * operations.
130 *
131 * Stripe operations are performed outside the stripe lock,
132 * the stripe operations are:
133 * -copying data between the stripe cache and user application buffers
134 * -computing blocks to save a disk access, or to recover a missing block
135 * -updating the parity on a write operation (reconstruct write and
136 * read-modify-write)
137 * -checking parity correctness
138 * -running i/o to disk
139 * These operations are carried out by raid5_run_ops which uses the async_tx
140 * api to (optionally) offload operations to dedicated hardware engines.
141 * When requesting an operation handle_stripe sets the pending bit for the
142 * operation and increments the count. raid5_run_ops is then run whenever
143 * the count is non-zero.
144 * There are some critical dependencies between the operations that prevent some
145 * from being requested while another is in flight.
146 * 1/ Parity check operations destroy the in cache version of the parity block,
147 * so we prevent parity dependent operations like writes and compute_blocks
148 * from starting while a check is in progress. Some dma engines can perform
149 * the check without damaging the parity block, in these cases the parity
150 * block is re-marked up to date (assuming the check was successful) and is
151 * not re-read from disk.
152 * 2/ When a write operation is requested we immediately lock the affected
153 * blocks, and mark them as not up to date. This causes new read requests
154 * to be held off, as well as parity checks and compute block operations.
155 * 3/ Once a compute block operation has been requested handle_stripe treats
156 * that block as if it is up to date. raid5_run_ops guaruntees that any
157 * operation that is dependent on the compute block result is initiated after
158 * the compute block completes.
159 */
160
161/*
162 * Operations state - intermediate states that are visible outside of sh->lock
163 * In general _idle indicates nothing is running, _run indicates a data
164 * processing operation is active, and _result means the data processing result
165 * is stable and can be acted upon. For simple operations like biofill and
166 * compute that only have an _idle and _run state they are indicated with
167 * sh->state flags (STRIPE_BIOFILL_RUN and STRIPE_COMPUTE_RUN)
168 */
169/**
170 * enum check_states - handles syncing / repairing a stripe
171 * @check_state_idle - check operations are quiesced
172 * @check_state_run - check operation is running
173 * @check_state_result - set outside lock when check result is valid
174 * @check_state_compute_run - check failed and we are repairing
175 * @check_state_compute_result - set outside lock when compute result is valid
176 */
177enum check_states {
178 check_state_idle = 0,
179 check_state_run, /* parity check */
180 check_state_check_result,
181 check_state_compute_run, /* parity repair */
182 check_state_compute_result,
183};
184
185/**
186 * enum reconstruct_states - handles writing or expanding a stripe
187 */
188enum reconstruct_states {
189 reconstruct_state_idle = 0,
190 reconstruct_state_prexor_drain_run, /* prexor-write */
191 reconstruct_state_drain_run, /* write */
192 reconstruct_state_run, /* expand */
193 reconstruct_state_prexor_drain_result,
194 reconstruct_state_drain_result,
195 reconstruct_state_result,
196};
197
198struct stripe_head {
199 struct hlist_node hash;
200 struct list_head lru; /* inactive_list or handle_list */
201 struct raid5_private_data *raid_conf;
202 sector_t sector; /* sector of this row */
203 int pd_idx; /* parity disk index */
204 unsigned long state; /* state flags */
205 atomic_t count; /* nr of active thread/requests */
206 spinlock_t lock;
207 int bm_seq; /* sequence number for bitmap flushes */
208 int disks; /* disks in stripe */
209 enum check_states check_state;
210 enum reconstruct_states reconstruct_state;
211 /* stripe_operations
212 * @target - STRIPE_OP_COMPUTE_BLK target
213 */
214 struct stripe_operations {
215 int target;
216 u32 zero_sum_result;
217 } ops;
218 struct r5dev {
219 struct bio req;
220 struct bio_vec vec;
221 struct page *page;
222 struct bio *toread, *read, *towrite, *written;
223 sector_t sector; /* sector of this page */
224 unsigned long flags;
225 } dev[1]; /* allocated with extra space depending of RAID geometry */
226};
227
228/* stripe_head_state - collects and tracks the dynamic state of a stripe_head
229 * for handle_stripe. It is only valid under spin_lock(sh->lock);
230 */
231struct stripe_head_state {
232 int syncing, expanding, expanded;
233 int locked, uptodate, to_read, to_write, failed, written;
234 int to_fill, compute, req_compute, non_overwrite;
235 int failed_num;
236 unsigned long ops_request;
237};
238
239/* r6_state - extra state data only relevant to r6 */
240struct r6_state {
241 int p_failed, q_failed, qd_idx, failed_num[2];
242};
243
244/* Flags */
245#define R5_UPTODATE 0 /* page contains current data */
246#define R5_LOCKED 1 /* IO has been submitted on "req" */
247#define R5_OVERWRITE 2 /* towrite covers whole page */
248/* and some that are internal to handle_stripe */
249#define R5_Insync 3 /* rdev && rdev->in_sync at start */
250#define R5_Wantread 4 /* want to schedule a read */
251#define R5_Wantwrite 5
252#define R5_Overlap 7 /* There is a pending overlapping request on this block */
253#define R5_ReadError 8 /* seen a read error here recently */
254#define R5_ReWrite 9 /* have tried to over-write the readerror */
255
256#define R5_Expanded 10 /* This block now has post-expand data */
257#define R5_Wantcompute 11 /* compute_block in progress treat as
258 * uptodate
259 */
260#define R5_Wantfill 12 /* dev->toread contains a bio that needs
261 * filling
262 */
263#define R5_Wantdrain 13 /* dev->towrite needs to be drained */
264/*
265 * Write method
266 */
267#define RECONSTRUCT_WRITE 1
268#define READ_MODIFY_WRITE 2
269/* not a write method, but a compute_parity mode */
270#define CHECK_PARITY 3
271
272/*
273 * Stripe state
274 */
275#define STRIPE_HANDLE 2
276#define STRIPE_SYNCING 3
277#define STRIPE_INSYNC 4
278#define STRIPE_PREREAD_ACTIVE 5
279#define STRIPE_DELAYED 6
280#define STRIPE_DEGRADED 7
281#define STRIPE_BIT_DELAY 8
282#define STRIPE_EXPANDING 9
283#define STRIPE_EXPAND_SOURCE 10
284#define STRIPE_EXPAND_READY 11
285#define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */
286#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */
287#define STRIPE_BIOFILL_RUN 14
288#define STRIPE_COMPUTE_RUN 15
289/*
290 * Operation request flags
291 */
292#define STRIPE_OP_BIOFILL 0
293#define STRIPE_OP_COMPUTE_BLK 1
294#define STRIPE_OP_PREXOR 2
295#define STRIPE_OP_BIODRAIN 3
296#define STRIPE_OP_POSTXOR 4
297#define STRIPE_OP_CHECK 5
298
299/*
300 * Plugging:
301 *
302 * To improve write throughput, we need to delay the handling of some
303 * stripes until there has been a chance that several write requests
304 * for the one stripe have all been collected.
305 * In particular, any write request that would require pre-reading
306 * is put on a "delayed" queue until there are no stripes currently
307 * in a pre-read phase. Further, if the "delayed" queue is empty when
308 * a stripe is put on it then we "plug" the queue and do not process it
309 * until an unplug call is made. (the unplug_io_fn() is called).
310 *
311 * When preread is initiated on a stripe, we set PREREAD_ACTIVE and add
312 * it to the count of prereading stripes.
313 * When write is initiated, or the stripe refcnt == 0 (just in case) we
314 * clear the PREREAD_ACTIVE flag and decrement the count
315 * Whenever the 'handle' queue is empty and the device is not plugged, we
316 * move any strips from delayed to handle and clear the DELAYED flag and set
317 * PREREAD_ACTIVE.
318 * In stripe_handle, if we find pre-reading is necessary, we do it if
319 * PREREAD_ACTIVE is set, else we set DELAYED which will send it to the delayed queue.
320 * HANDLE gets cleared if stripe_handle leave nothing locked.
321 */
322
323
324struct disk_info {
325 mdk_rdev_t *rdev;
326};
327
328struct raid5_private_data {
329 struct hlist_head *stripe_hashtbl;
330 mddev_t *mddev;
331 struct disk_info *spare;
332 int chunk_size, level, algorithm;
333 int max_degraded;
334 int raid_disks;
335 int max_nr_stripes;
336
337 /* used during an expand */
338 sector_t expand_progress; /* MaxSector when no expand happening */
339 sector_t expand_lo; /* from here up to expand_progress it out-of-bounds
340 * as we haven't flushed the metadata yet
341 */
342 int previous_raid_disks;
343
344 struct list_head handle_list; /* stripes needing handling */
345 struct list_head hold_list; /* preread ready stripes */
346 struct list_head delayed_list; /* stripes that have plugged requests */
347 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */
348 struct bio *retry_read_aligned; /* currently retrying aligned bios */
349 struct bio *retry_read_aligned_list; /* aligned bios retry list */
350 atomic_t preread_active_stripes; /* stripes with scheduled io */
351 atomic_t active_aligned_reads;
352 atomic_t pending_full_writes; /* full write backlog */
353 int bypass_count; /* bypassed prereads */
354 int bypass_threshold; /* preread nice */
355 struct list_head *last_hold; /* detect hold_list promotions */
356
357 atomic_t reshape_stripes; /* stripes with pending writes for reshape */
358 /* unfortunately we need two cache names as we temporarily have
359 * two caches.
360 */
361 int active_name;
362 char cache_name[2][20];
363 struct kmem_cache *slab_cache; /* for allocating stripes */
364
365 int seq_flush, seq_write;
366 int quiesce;
367
368 int fullsync; /* set to 1 if a full sync is needed,
369 * (fresh device added).
370 * Cleared when a sync completes.
371 */
372
373 struct page *spare_page; /* Used when checking P/Q in raid6 */
374
375 /*
376 * Free stripes pool
377 */
378 atomic_t active_stripes;
379 struct list_head inactive_list;
380 wait_queue_head_t wait_for_stripe;
381 wait_queue_head_t wait_for_overlap;
382 int inactive_blocked; /* release of inactive stripes blocked,
383 * waiting for 25% to be free
384 */
385 int pool_size; /* number of disks in stripeheads in pool */
386 spinlock_t device_lock;
387 struct disk_info *disks;
388};
389
390typedef struct raid5_private_data raid5_conf_t;
391
392#define mddev_to_conf(mddev) ((raid5_conf_t *) mddev->private)
393
394/*
395 * Our supported algorithms
396 */
397#define ALGORITHM_LEFT_ASYMMETRIC 0
398#define ALGORITHM_RIGHT_ASYMMETRIC 1
399#define ALGORITHM_LEFT_SYMMETRIC 2
400#define ALGORITHM_RIGHT_SYMMETRIC 3
401
402#endif
diff --git a/include/linux/raid/xor.h b/include/linux/raid/xor.h
index 3e120587eada..5a210959e3f8 100644
--- a/include/linux/raid/xor.h
+++ b/include/linux/raid/xor.h
@@ -1,8 +1,6 @@
1#ifndef _XOR_H 1#ifndef _XOR_H
2#define _XOR_H 2#define _XOR_H
3 3
4#include <linux/raid/md.h>
5
6#define MAX_XOR_BLOCKS 4 4#define MAX_XOR_BLOCKS 4
7 5
8extern void xor_blocks(unsigned int count, unsigned int bytes, 6extern void xor_blocks(unsigned int count, unsigned int bytes,
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..58b2aa5312b9 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
@@ -162,9 +161,8 @@ struct rcu_data {
162 unsigned long offline_fqs; /* Kicked due to being offline. */ 161 unsigned long offline_fqs; /* Kicked due to being offline. */
163 unsigned long resched_ipi; /* Sent a resched IPI. */ 162 unsigned long resched_ipi; /* Sent a resched IPI. */
164 163
165 /* 5) state to allow this CPU to force_quiescent_state on others */ 164 /* 5) For future __rcu_pending statistics. */
166 long n_rcu_pending; /* rcu_pending() calls since boot. */ 165 long n_rcu_pending; /* rcu_pending() calls since boot. */
167 long n_rcu_pending_force_qs; /* when to force quiescent states. */
168 166
169 int cpu; 167 int cpu;
170}; 168};
@@ -236,30 +234,8 @@ struct rcu_state {
236#endif /* #ifdef CONFIG_NO_HZ */ 234#endif /* #ifdef CONFIG_NO_HZ */
237}; 235};
238 236
239extern struct rcu_state rcu_state; 237extern void rcu_qsctr_inc(int cpu);
240DECLARE_PER_CPU(struct rcu_data, rcu_data); 238extern 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 239
264extern int rcu_pending(int cpu); 240extern int rcu_pending(int cpu);
265extern int rcu_needs_cpu(int cpu); 241extern int rcu_needs_cpu(int cpu);
diff --git a/include/linux/rds.h b/include/linux/rds.h
new file mode 100644
index 000000000000..d91dc91f5443
--- /dev/null
+++ b/include/linux/rds.h
@@ -0,0 +1,250 @@
1/*
2 * Copyright (c) 2008 Oracle. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 *
32 */
33
34#ifndef _LINUX_RDS_H
35#define _LINUX_RDS_H
36
37#include <linux/types.h>
38
39/* These sparse annotated types shouldn't be in any user
40 * visible header file. We should clean this up rather
41 * than kludging around them. */
42#ifndef __KERNEL__
43#define __be16 u_int16_t
44#define __be32 u_int32_t
45#define __be64 u_int64_t
46#endif
47
48#define RDS_IB_ABI_VERSION 0x301
49
50/*
51 * setsockopt/getsockopt for SOL_RDS
52 */
53#define RDS_CANCEL_SENT_TO 1
54#define RDS_GET_MR 2
55#define RDS_FREE_MR 3
56/* deprecated: RDS_BARRIER 4 */
57#define RDS_RECVERR 5
58#define RDS_CONG_MONITOR 6
59
60/*
61 * Control message types for SOL_RDS.
62 *
63 * CMSG_RDMA_ARGS (sendmsg)
64 * Request a RDMA transfer to/from the specified
65 * memory ranges.
66 * The cmsg_data is a struct rds_rdma_args.
67 * RDS_CMSG_RDMA_DEST (recvmsg, sendmsg)
68 * Kernel informs application about intended
69 * source/destination of a RDMA transfer
70 * RDS_CMSG_RDMA_MAP (sendmsg)
71 * Application asks kernel to map the given
72 * memory range into a IB MR, and send the
73 * R_Key along in an RDS extension header.
74 * The cmsg_data is a struct rds_get_mr_args,
75 * the same as for the GET_MR setsockopt.
76 * RDS_CMSG_RDMA_STATUS (recvmsg)
77 * Returns the status of a completed RDMA operation.
78 */
79#define RDS_CMSG_RDMA_ARGS 1
80#define RDS_CMSG_RDMA_DEST 2
81#define RDS_CMSG_RDMA_MAP 3
82#define RDS_CMSG_RDMA_STATUS 4
83#define RDS_CMSG_CONG_UPDATE 5
84
85#define RDS_INFO_FIRST 10000
86#define RDS_INFO_COUNTERS 10000
87#define RDS_INFO_CONNECTIONS 10001
88/* 10002 aka RDS_INFO_FLOWS is deprecated */
89#define RDS_INFO_SEND_MESSAGES 10003
90#define RDS_INFO_RETRANS_MESSAGES 10004
91#define RDS_INFO_RECV_MESSAGES 10005
92#define RDS_INFO_SOCKETS 10006
93#define RDS_INFO_TCP_SOCKETS 10007
94#define RDS_INFO_IB_CONNECTIONS 10008
95#define RDS_INFO_CONNECTION_STATS 10009
96#define RDS_INFO_IWARP_CONNECTIONS 10010
97#define RDS_INFO_LAST 10010
98
99struct rds_info_counter {
100 u_int8_t name[32];
101 u_int64_t value;
102} __attribute__((packed));
103
104#define RDS_INFO_CONNECTION_FLAG_SENDING 0x01
105#define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02
106#define RDS_INFO_CONNECTION_FLAG_CONNECTED 0x04
107
108#define TRANSNAMSIZ 16
109
110struct rds_info_connection {
111 u_int64_t next_tx_seq;
112 u_int64_t next_rx_seq;
113 __be32 laddr;
114 __be32 faddr;
115 u_int8_t transport[TRANSNAMSIZ]; /* null term ascii */
116 u_int8_t flags;
117} __attribute__((packed));
118
119struct rds_info_flow {
120 __be32 laddr;
121 __be32 faddr;
122 u_int32_t bytes;
123 __be16 lport;
124 __be16 fport;
125} __attribute__((packed));
126
127#define RDS_INFO_MESSAGE_FLAG_ACK 0x01
128#define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02
129
130struct rds_info_message {
131 u_int64_t seq;
132 u_int32_t len;
133 __be32 laddr;
134 __be32 faddr;
135 __be16 lport;
136 __be16 fport;
137 u_int8_t flags;
138} __attribute__((packed));
139
140struct rds_info_socket {
141 u_int32_t sndbuf;
142 __be32 bound_addr;
143 __be32 connected_addr;
144 __be16 bound_port;
145 __be16 connected_port;
146 u_int32_t rcvbuf;
147 u_int64_t inum;
148} __attribute__((packed));
149
150#define RDS_IB_GID_LEN 16
151struct rds_info_rdma_connection {
152 __be32 src_addr;
153 __be32 dst_addr;
154 uint8_t src_gid[RDS_IB_GID_LEN];
155 uint8_t dst_gid[RDS_IB_GID_LEN];
156
157 uint32_t max_send_wr;
158 uint32_t max_recv_wr;
159 uint32_t max_send_sge;
160 uint32_t rdma_mr_max;
161 uint32_t rdma_mr_size;
162};
163
164/*
165 * Congestion monitoring.
166 * Congestion control in RDS happens at the host connection
167 * level by exchanging a bitmap marking congested ports.
168 * By default, a process sleeping in poll() is always woken
169 * up when the congestion map is updated.
170 * With explicit monitoring, an application can have more
171 * fine-grained control.
172 * The application installs a 64bit mask value in the socket,
173 * where each bit corresponds to a group of ports.
174 * When a congestion update arrives, RDS checks the set of
175 * ports that are now uncongested against the list bit mask
176 * installed in the socket, and if they overlap, we queue a
177 * cong_notification on the socket.
178 *
179 * To install the congestion monitor bitmask, use RDS_CONG_MONITOR
180 * with the 64bit mask.
181 * Congestion updates are received via RDS_CMSG_CONG_UPDATE
182 * control messages.
183 *
184 * The correspondence between bits and ports is
185 * 1 << (portnum % 64)
186 */
187#define RDS_CONG_MONITOR_SIZE 64
188#define RDS_CONG_MONITOR_BIT(port) (((unsigned int) port) % RDS_CONG_MONITOR_SIZE)
189#define RDS_CONG_MONITOR_MASK(port) (1ULL << RDS_CONG_MONITOR_BIT(port))
190
191/*
192 * RDMA related types
193 */
194
195/*
196 * This encapsulates a remote memory location.
197 * In the current implementation, it contains the R_Key
198 * of the remote memory region, and the offset into it
199 * (so that the application does not have to worry about
200 * alignment).
201 */
202typedef u_int64_t rds_rdma_cookie_t;
203
204struct rds_iovec {
205 u_int64_t addr;
206 u_int64_t bytes;
207};
208
209struct rds_get_mr_args {
210 struct rds_iovec vec;
211 u_int64_t cookie_addr;
212 uint64_t flags;
213};
214
215struct rds_free_mr_args {
216 rds_rdma_cookie_t cookie;
217 u_int64_t flags;
218};
219
220struct rds_rdma_args {
221 rds_rdma_cookie_t cookie;
222 struct rds_iovec remote_vec;
223 u_int64_t local_vec_addr;
224 u_int64_t nr_local;
225 u_int64_t flags;
226 u_int64_t user_token;
227};
228
229struct rds_rdma_notify {
230 u_int64_t user_token;
231 int32_t status;
232};
233
234#define RDS_RDMA_SUCCESS 0
235#define RDS_RDMA_REMOTE_ERROR 1
236#define RDS_RDMA_CANCELED 2
237#define RDS_RDMA_DROPPED 3
238#define RDS_RDMA_OTHER_ERROR 4
239
240/*
241 * Common set of flags for all RDMA related structs
242 */
243#define RDS_RDMA_READWRITE 0x0001
244#define RDS_RDMA_FENCE 0x0002 /* use FENCE for immediate send */
245#define RDS_RDMA_INVALIDATE 0x0004 /* invalidate R_Key after freeing MR */
246#define RDS_RDMA_USE_ONCE 0x0008 /* free MR after use */
247#define RDS_RDMA_DONTWAIT 0x0010 /* Don't wait in SET_BARRIER */
248#define RDS_RDMA_NOTIFY_ME 0x0020 /* Notify when operation completes */
249
250#endif /* IB_RDS_H */
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h
index e84b0a9feda5..a6d014005d49 100644
--- a/include/linux/regulator/bq24022.h
+++ b/include/linux/regulator/bq24022.h
@@ -10,6 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13struct regulator_init_data;
14
13/** 15/**
14 * bq24022_mach_info - platform data for bq24022 16 * bq24022_mach_info - platform data for bq24022
15 * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging 17 * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging
@@ -18,4 +20,5 @@
18struct bq24022_mach_info { 20struct bq24022_mach_info {
19 int gpio_nce; 21 int gpio_nce;
20 int gpio_iset2; 22 int gpio_iset2;
23 struct regulator_init_data *init_data;
21}; 24};
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 801bf77ff4e2..277f4b964df5 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. 4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 * 5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> 6 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
@@ -88,6 +88,7 @@
88 * FAIL Regulator output has failed. 88 * FAIL Regulator output has failed.
89 * OVER_TEMP Regulator over temp. 89 * OVER_TEMP Regulator over temp.
90 * FORCE_DISABLE Regulator shut down by software. 90 * FORCE_DISABLE Regulator shut down by software.
91 * VOLTAGE_CHANGE Regulator voltage changed.
91 * 92 *
92 * NOTE: These events can be OR'ed together when passed into handler. 93 * NOTE: These events can be OR'ed together when passed into handler.
93 */ 94 */
@@ -98,6 +99,7 @@
98#define REGULATOR_EVENT_FAIL 0x08 99#define REGULATOR_EVENT_FAIL 0x08
99#define REGULATOR_EVENT_OVER_TEMP 0x10 100#define REGULATOR_EVENT_OVER_TEMP 0x10
100#define REGULATOR_EVENT_FORCE_DISABLE 0x20 101#define REGULATOR_EVENT_FORCE_DISABLE 0x20
102#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40
101 103
102struct regulator; 104struct regulator;
103 105
@@ -140,6 +142,8 @@ int regulator_bulk_disable(int num_consumers,
140void regulator_bulk_free(int num_consumers, 142void regulator_bulk_free(int num_consumers,
141 struct regulator_bulk_data *consumers); 143 struct regulator_bulk_data *consumers);
142 144
145int regulator_count_voltages(struct regulator *regulator);
146int regulator_list_voltage(struct regulator *regulator, unsigned selector);
143int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); 147int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
144int regulator_get_voltage(struct regulator *regulator); 148int regulator_get_voltage(struct regulator *regulator);
145int regulator_set_current_limit(struct regulator *regulator, 149int regulator_set_current_limit(struct regulator *regulator,
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 2dae05705f13..225f733e7533 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. 4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 * 5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> 6 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
@@ -21,25 +21,39 @@
21struct regulator_dev; 21struct regulator_dev;
22struct regulator_init_data; 22struct regulator_init_data;
23 23
24enum regulator_status {
25 REGULATOR_STATUS_OFF,
26 REGULATOR_STATUS_ON,
27 REGULATOR_STATUS_ERROR,
28 /* fast/normal/idle/standby are flavors of "on" */
29 REGULATOR_STATUS_FAST,
30 REGULATOR_STATUS_NORMAL,
31 REGULATOR_STATUS_IDLE,
32 REGULATOR_STATUS_STANDBY,
33};
34
24/** 35/**
25 * struct regulator_ops - regulator operations. 36 * struct regulator_ops - regulator operations.
26 * 37 *
27 * This struct describes regulator operations which can be implemented by 38 * @enable: Configure the regulator as enabled.
28 * regulator chip drivers. 39 * @disable: Configure the regulator as disabled.
29 *
30 * @enable: Enable the regulator.
31 * @disable: Disable the regulator.
32 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise. 40 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise.
33 * 41 *
34 * @set_voltage: Set the voltage for the regulator within the range specified. 42 * @set_voltage: Set the voltage for the regulator within the range specified.
35 * The driver should select the voltage closest to min_uV. 43 * The driver should select the voltage closest to min_uV.
36 * @get_voltage: Return the currently configured voltage for the regulator. 44 * @get_voltage: Return the currently configured voltage for the regulator.
45 * @list_voltage: Return one of the supported voltages, in microvolts; zero
46 * if the selector indicates a voltage that is unusable on this system;
47 * or negative errno. Selectors range from zero to one less than
48 * regulator_desc.n_voltages. Voltages may be reported in any order.
37 * 49 *
38 * @set_current_limit: Configure a limit for a current-limited regulator. 50 * @set_current_limit: Configure a limit for a current-limited regulator.
39 * @get_current_limit: Get the limit for a current-limited regulator. 51 * @get_current_limit: Get the configured limit for a current-limited regulator.
40 * 52 *
41 * @set_mode: Set the operating mode for the regulator. 53 * @set_mode: Set the configured operating mode for the regulator.
42 * @get_mode: Get the current operating mode for the regulator. 54 * @get_mode: Get the configured operating mode for the regulator.
55 * @get_status: Return actual (not as-configured) status of regulator, as a
56 * REGULATOR_STATUS value (or negative errno)
43 * @get_optimum_mode: Get the most efficient operating mode for the regulator 57 * @get_optimum_mode: Get the most efficient operating mode for the regulator
44 * when running with the specified parameters. 58 * when running with the specified parameters.
45 * 59 *
@@ -51,9 +65,15 @@ struct regulator_init_data;
51 * suspended. 65 * suspended.
52 * @set_suspend_mode: Set the operating mode for the regulator when the 66 * @set_suspend_mode: Set the operating mode for the regulator when the
53 * system is suspended. 67 * system is suspended.
68 *
69 * This struct describes regulator operations which can be implemented by
70 * regulator chip drivers.
54 */ 71 */
55struct regulator_ops { 72struct regulator_ops {
56 73
74 /* enumerate supported voltages */
75 int (*list_voltage) (struct regulator_dev *, unsigned selector);
76
57 /* get/set regulator voltage */ 77 /* get/set regulator voltage */
58 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV); 78 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV);
59 int (*get_voltage) (struct regulator_dev *); 79 int (*get_voltage) (struct regulator_dev *);
@@ -72,6 +92,13 @@ struct regulator_ops {
72 int (*set_mode) (struct regulator_dev *, unsigned int mode); 92 int (*set_mode) (struct regulator_dev *, unsigned int mode);
73 unsigned int (*get_mode) (struct regulator_dev *); 93 unsigned int (*get_mode) (struct regulator_dev *);
74 94
95 /* report regulator status ... most other accessors report
96 * control inputs, this reports results of combining inputs
97 * from Linux (and other sources) with the actual load.
98 * returns REGULATOR_STATUS_* or negative errno.
99 */
100 int (*get_status)(struct regulator_dev *);
101
75 /* get most efficient regulator operating mode for load */ 102 /* get most efficient regulator operating mode for load */
76 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV, 103 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
77 int output_uV, int load_uA); 104 int output_uV, int load_uA);
@@ -106,6 +133,7 @@ enum regulator_type {
106 * 133 *
107 * @name: Identifying name for the regulator. 134 * @name: Identifying name for the regulator.
108 * @id: Numerical identifier for the regulator. 135 * @id: Numerical identifier for the regulator.
136 * @n_voltages: Number of selectors available for ops.list_voltage().
109 * @ops: Regulator operations table. 137 * @ops: Regulator operations table.
110 * @irq: Interrupt number for the regulator. 138 * @irq: Interrupt number for the regulator.
111 * @type: Indicates if the regulator is a voltage or current regulator. 139 * @type: Indicates if the regulator is a voltage or current regulator.
@@ -114,14 +142,48 @@ enum regulator_type {
114struct regulator_desc { 142struct regulator_desc {
115 const char *name; 143 const char *name;
116 int id; 144 int id;
145 unsigned n_voltages;
117 struct regulator_ops *ops; 146 struct regulator_ops *ops;
118 int irq; 147 int irq;
119 enum regulator_type type; 148 enum regulator_type type;
120 struct module *owner; 149 struct module *owner;
121}; 150};
122 151
152/*
153 * struct regulator_dev
154 *
155 * Voltage / Current regulator class device. One for each
156 * regulator.
157 *
158 * This should *not* be used directly by anything except the regulator
159 * core and notification injection (which should take the mutex and do
160 * no other direct access).
161 */
162struct regulator_dev {
163 struct regulator_desc *desc;
164 int use_count;
165
166 /* lists we belong to */
167 struct list_head list; /* list of all regulators */
168 struct list_head slist; /* list of supplied regulators */
169
170 /* lists we own */
171 struct list_head consumer_list; /* consumers we supply */
172 struct list_head supply_list; /* regulators we supply */
173
174 struct blocking_notifier_head notifier;
175 struct mutex mutex; /* consumer lock */
176 struct module *owner;
177 struct device dev;
178 struct regulation_constraints *constraints;
179 struct regulator_dev *supply; /* for tree */
180
181 void *reg_data; /* regulator_dev data */
182};
183
123struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 184struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
124 struct device *dev, void *driver_data); 185 struct device *dev, struct regulator_init_data *init_data,
186 void *driver_data);
125void regulator_unregister(struct regulator_dev *rdev); 187void regulator_unregister(struct regulator_dev *rdev);
126 188
127int regulator_notifier_call_chain(struct regulator_dev *rdev, 189int regulator_notifier_call_chain(struct regulator_dev *rdev,
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index 1387a5d2190e..91b4da31f1b5 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -14,9 +14,12 @@
14#ifndef __REGULATOR_FIXED_H 14#ifndef __REGULATOR_FIXED_H
15#define __REGULATOR_FIXED_H 15#define __REGULATOR_FIXED_H
16 16
17struct regulator_init_data;
18
17struct fixed_voltage_config { 19struct fixed_voltage_config {
18 const char *supply_name; 20 const char *supply_name;
19 int microvolts; 21 int microvolts;
22 struct regulator_init_data *init_data;
20}; 23};
21 24
22#endif 25#endif
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 3794773b23d2..bac64fa390f2 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. 4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 * 5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> 6 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
@@ -73,7 +73,9 @@ struct regulator_state {
73 * 73 *
74 * @always_on: Set if the regulator should never be disabled. 74 * @always_on: Set if the regulator should never be disabled.
75 * @boot_on: Set if the regulator is enabled when the system is initially 75 * @boot_on: Set if the regulator is enabled when the system is initially
76 * started. 76 * started. If the regulator is not enabled by the hardware or
77 * bootloader then it will be enabled when the constraints are
78 * applied.
77 * @apply_uV: Apply the voltage constraint when initialising. 79 * @apply_uV: Apply the voltage constraint when initialising.
78 * 80 *
79 * @input_uV: Input voltage for regulator when supplied by another regulator. 81 * @input_uV: Input voltage for regulator when supplied by another regulator.
@@ -83,6 +85,7 @@ struct regulator_state {
83 * @state_standby: State for regulator when system is suspended in standby 85 * @state_standby: State for regulator when system is suspended in standby
84 * mode. 86 * mode.
85 * @initial_state: Suspend state to set by default. 87 * @initial_state: Suspend state to set by default.
88 * @initial_mode: Mode to set at startup.
86 */ 89 */
87struct regulation_constraints { 90struct regulation_constraints {
88 91
@@ -111,6 +114,9 @@ struct regulation_constraints {
111 struct regulator_state state_standby; 114 struct regulator_state state_standby;
112 suspend_state_t initial_state; /* suspend state to set at init */ 115 suspend_state_t initial_state; /* suspend state to set at init */
113 116
117 /* mode to set on startup */
118 unsigned int initial_mode;
119
114 /* constriant flags */ 120 /* constriant flags */
115 unsigned always_on:1; /* regulator never off when system is on */ 121 unsigned always_on:1; /* regulator never off when system is on */
116 unsigned boot_on:1; /* bootloader/firmware enabled regulator */ 122 unsigned boot_on:1; /* bootloader/firmware enabled regulator */
@@ -160,4 +166,6 @@ struct regulator_init_data {
160 166
161int regulator_suspend_prepare(suspend_state_t state); 167int regulator_suspend_prepare(suspend_state_t state);
162 168
169void regulator_has_full_constraints(void);
170
163#endif 171#endif
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index fe00f781a622..8cc65757e47a 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -49,13 +49,12 @@ static inline int reiserfs_acl_count(size_t size)
49#ifdef CONFIG_REISERFS_FS_POSIX_ACL 49#ifdef CONFIG_REISERFS_FS_POSIX_ACL
50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type); 50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
51int reiserfs_acl_chmod(struct inode *inode); 51int reiserfs_acl_chmod(struct inode *inode);
52int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry, 52int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
53 struct inode *dir, struct dentry *dentry,
53 struct inode *inode); 54 struct inode *inode);
54int reiserfs_cache_default_acl(struct inode *dir); 55int reiserfs_cache_default_acl(struct inode *dir);
55extern int reiserfs_xattr_posix_acl_init(void) __init; 56extern struct xattr_handler reiserfs_posix_acl_default_handler;
56extern int reiserfs_xattr_posix_acl_exit(void); 57extern struct xattr_handler reiserfs_posix_acl_access_handler;
57extern struct reiserfs_xattr_handler posix_acl_default_handler;
58extern struct reiserfs_xattr_handler posix_acl_access_handler;
59 58
60static inline void reiserfs_init_acl_access(struct inode *inode) 59static inline void reiserfs_init_acl_access(struct inode *inode)
61{ 60{
@@ -75,23 +74,14 @@ static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
75 return NULL; 74 return NULL;
76} 75}
77 76
78static inline int reiserfs_xattr_posix_acl_init(void)
79{
80 return 0;
81}
82
83static inline int reiserfs_xattr_posix_acl_exit(void)
84{
85 return 0;
86}
87
88static inline int reiserfs_acl_chmod(struct inode *inode) 77static inline int reiserfs_acl_chmod(struct inode *inode)
89{ 78{
90 return 0; 79 return 0;
91} 80}
92 81
93static inline int 82static inline int
94reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry, 83reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
84 const struct inode *dir, struct dentry *dentry,
95 struct inode *inode) 85 struct inode *inode)
96{ 86{
97 return 0; 87 return 0;
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index bc5114d35e99..2245c78d5876 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -28,8 +28,6 @@
28#include <linux/reiserfs_fs_sb.h> 28#include <linux/reiserfs_fs_sb.h>
29#endif 29#endif
30 30
31struct fid;
32
33/* 31/*
34 * include/linux/reiser_fs.h 32 * include/linux/reiser_fs.h
35 * 33 *
@@ -37,6 +35,31 @@ struct fid;
37 * 35 *
38 */ 36 */
39 37
38/* ioctl's command */
39#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
40/* define following flags to be the same as in ext2, so that chattr(1),
41 lsattr(1) will work with us. */
42#define REISERFS_IOC_GETFLAGS FS_IOC_GETFLAGS
43#define REISERFS_IOC_SETFLAGS FS_IOC_SETFLAGS
44#define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION
45#define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION
46
47#ifdef __KERNEL__
48/* the 32 bit compat definitions with int argument */
49#define REISERFS_IOC32_UNPACK _IOW(0xCD, 1, int)
50#define REISERFS_IOC32_GETFLAGS FS_IOC32_GETFLAGS
51#define REISERFS_IOC32_SETFLAGS FS_IOC32_SETFLAGS
52#define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION
53#define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION
54
55/* Locking primitives */
56/* Right now we are still falling back to (un)lock_kernel, but eventually that
57 would evolve into real per-fs locks */
58#define reiserfs_write_lock( sb ) lock_kernel()
59#define reiserfs_write_unlock( sb ) unlock_kernel()
60
61struct fid;
62
40/* in reading the #defines, it may help to understand that they employ 63/* in reading the #defines, it may help to understand that they employ
41 the following abbreviations: 64 the following abbreviations:
42 65
@@ -79,15 +102,21 @@ struct fid;
79*/ 102*/
80#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ 103#define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */
81 104
82void reiserfs_warning(struct super_block *s, const char *fmt, ...); 105void __reiserfs_warning(struct super_block *s, const char *id,
106 const char *func, const char *fmt, ...);
107#define reiserfs_warning(s, id, fmt, args...) \
108 __reiserfs_warning(s, id, __func__, fmt, ##args)
83/* assertions handling */ 109/* assertions handling */
84 110
85/** always check a condition and panic if it's false. */ 111/** always check a condition and panic if it's false. */
86#define __RASSERT( cond, scond, format, args... ) \ 112#define __RASSERT(cond, scond, format, args...) \
87if( !( cond ) ) \ 113do { \
88 reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \ 114 if (!(cond)) \
89 __FILE__ ":%i:%s: " format "\n", \ 115 reiserfs_panic(NULL, "assertion failure", "(" #cond ") at " \
90 in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __func__ , ##args ) 116 __FILE__ ":%i:%s: " format "\n", \
117 in_interrupt() ? -1 : task_pid_nr(current), \
118 __LINE__, __func__ , ##args); \
119} while (0)
91 120
92#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) 121#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
93 122
@@ -171,7 +200,11 @@ struct reiserfs_super_block {
171 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */ 200 __le32 s_flags; /* Right now used only by inode-attributes, if enabled */
172 unsigned char s_uuid[16]; /* filesystem unique identifier */ 201 unsigned char s_uuid[16]; /* filesystem unique identifier */
173 unsigned char s_label[16]; /* filesystem volume label */ 202 unsigned char s_label[16]; /* filesystem volume label */
174 char s_unused[88]; /* zero filled by mkreiserfs and 203 __le16 s_mnt_count; /* Count of mounts since last fsck */
204 __le16 s_max_mnt_count; /* Maximum mounts before check */
205 __le32 s_lastcheck; /* Timestamp of last fsck */
206 __le32 s_check_interval; /* Interval between checks */
207 char s_unused[76]; /* zero filled by mkreiserfs and
175 * reiserfs_convert_objectid_map_v1() 208 * reiserfs_convert_objectid_map_v1()
176 * so any additions must be updated 209 * so any additions must be updated
177 * there as well. */ 210 * there as well. */
@@ -553,10 +586,8 @@ static inline int uniqueness2type(__u32 uniqueness)
553 return TYPE_DIRECT; 586 return TYPE_DIRECT;
554 case V1_DIRENTRY_UNIQUENESS: 587 case V1_DIRENTRY_UNIQUENESS:
555 return TYPE_DIRENTRY; 588 return TYPE_DIRENTRY;
556 default:
557 reiserfs_warning(NULL, "vs-500: unknown uniqueness %d",
558 uniqueness);
559 case V1_ANY_UNIQUENESS: 589 case V1_ANY_UNIQUENESS:
590 default:
560 return TYPE_ANY; 591 return TYPE_ANY;
561 } 592 }
562} 593}
@@ -573,9 +604,8 @@ static inline __u32 type2uniqueness(int type)
573 return V1_DIRECT_UNIQUENESS; 604 return V1_DIRECT_UNIQUENESS;
574 case TYPE_DIRENTRY: 605 case TYPE_DIRENTRY:
575 return V1_DIRENTRY_UNIQUENESS; 606 return V1_DIRENTRY_UNIQUENESS;
576 default:
577 reiserfs_warning(NULL, "vs-501: unknown type %d", type);
578 case TYPE_ANY: 607 case TYPE_ANY:
608 default:
579 return V1_ANY_UNIQUENESS; 609 return V1_ANY_UNIQUENESS;
580 } 610 }
581} 611}
@@ -687,9 +717,9 @@ static inline void cpu_key_k_offset_dec(struct cpu_key *key)
687#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key))) 717#define is_indirect_cpu_ih(ih) (is_indirect_cpu_key (&((ih)->ih_key)))
688#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key))) 718#define is_statdata_cpu_ih(ih) (is_statdata_cpu_key (&((ih)->ih_key)))
689 719
690#define I_K_KEY_IN_ITEM(p_s_ih, p_s_key, n_blocksize) \ 720#define I_K_KEY_IN_ITEM(ih, key, n_blocksize) \
691 ( ! COMP_SHORT_KEYS(p_s_ih, p_s_key) && \ 721 (!COMP_SHORT_KEYS(ih, key) && \
692 I_OFF_BYTE_IN_ITEM(p_s_ih, k_offset (p_s_key), n_blocksize) ) 722 I_OFF_BYTE_IN_ITEM(ih, k_offset(key), n_blocksize))
693 723
694/* maximal length of item */ 724/* maximal length of item */
695#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE) 725#define MAX_ITEM_LEN(block_size) (block_size - BLKH_SIZE - IH_SIZE)
@@ -698,6 +728,7 @@ static inline void cpu_key_k_offset_dec(struct cpu_key *key)
698/* object identifier for root dir */ 728/* object identifier for root dir */
699#define REISERFS_ROOT_OBJECTID 2 729#define REISERFS_ROOT_OBJECTID 2
700#define REISERFS_ROOT_PARENT_OBJECTID 1 730#define REISERFS_ROOT_PARENT_OBJECTID 1
731
701extern struct reiserfs_key root_key; 732extern struct reiserfs_key root_key;
702 733
703/* 734/*
@@ -744,25 +775,25 @@ struct block_head {
744#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */ 775#define DISK_LEAF_NODE_LEVEL 1 /* Leaf node level. */
745 776
746/* Given the buffer head of a formatted node, resolve to the block head of that node. */ 777/* Given the buffer head of a formatted node, resolve to the block head of that node. */
747#define B_BLK_HEAD(p_s_bh) ((struct block_head *)((p_s_bh)->b_data)) 778#define B_BLK_HEAD(bh) ((struct block_head *)((bh)->b_data))
748/* Number of items that are in buffer. */ 779/* Number of items that are in buffer. */
749#define B_NR_ITEMS(p_s_bh) (blkh_nr_item(B_BLK_HEAD(p_s_bh))) 780#define B_NR_ITEMS(bh) (blkh_nr_item(B_BLK_HEAD(bh)))
750#define B_LEVEL(p_s_bh) (blkh_level(B_BLK_HEAD(p_s_bh))) 781#define B_LEVEL(bh) (blkh_level(B_BLK_HEAD(bh)))
751#define B_FREE_SPACE(p_s_bh) (blkh_free_space(B_BLK_HEAD(p_s_bh))) 782#define B_FREE_SPACE(bh) (blkh_free_space(B_BLK_HEAD(bh)))
752 783
753#define PUT_B_NR_ITEMS(p_s_bh,val) do { set_blkh_nr_item(B_BLK_HEAD(p_s_bh),val); } while (0) 784#define PUT_B_NR_ITEMS(bh, val) do { set_blkh_nr_item(B_BLK_HEAD(bh), val); } while (0)
754#define PUT_B_LEVEL(p_s_bh,val) do { set_blkh_level(B_BLK_HEAD(p_s_bh),val); } while (0) 785#define PUT_B_LEVEL(bh, val) do { set_blkh_level(B_BLK_HEAD(bh), val); } while (0)
755#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) 786#define PUT_B_FREE_SPACE(bh, val) do { set_blkh_free_space(B_BLK_HEAD(bh), val); } while (0)
756 787
757/* Get right delimiting key. -- little endian */ 788/* Get right delimiting key. -- little endian */
758#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)))) 789#define B_PRIGHT_DELIM_KEY(bh) (&(blk_right_delim_key(B_BLK_HEAD(bh))))
759 790
760/* Does the buffer contain a disk leaf. */ 791/* Does the buffer contain a disk leaf. */
761#define B_IS_ITEMS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) == DISK_LEAF_NODE_LEVEL) 792#define B_IS_ITEMS_LEVEL(bh) (B_LEVEL(bh) == DISK_LEAF_NODE_LEVEL)
762 793
763/* Does the buffer contain a disk internal node */ 794/* Does the buffer contain a disk internal node */
764#define B_IS_KEYS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) > DISK_LEAF_NODE_LEVEL \ 795#define B_IS_KEYS_LEVEL(bh) (B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL \
765 && B_LEVEL(p_s_bh) <= MAX_HEIGHT) 796 && B_LEVEL(bh) <= MAX_HEIGHT)
766 797
767/***************************************************************************/ 798/***************************************************************************/
768/* STAT DATA */ 799/* STAT DATA */
@@ -1112,12 +1143,13 @@ struct disk_child {
1112#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0) 1143#define put_dc_size(dc_p, val) do { (dc_p)->dc_size = cpu_to_le16(val); } while(0)
1113 1144
1114/* Get disk child by buffer header and position in the tree node. */ 1145/* Get disk child by buffer header and position in the tree node. */
1115#define B_N_CHILD(p_s_bh,n_pos) ((struct disk_child *)\ 1146#define B_N_CHILD(bh, n_pos) ((struct disk_child *)\
1116((p_s_bh)->b_data+BLKH_SIZE+B_NR_ITEMS(p_s_bh)*KEY_SIZE+DC_SIZE*(n_pos))) 1147((bh)->b_data + BLKH_SIZE + B_NR_ITEMS(bh) * KEY_SIZE + DC_SIZE * (n_pos)))
1117 1148
1118/* Get disk child number by buffer header and position in the tree node. */ 1149/* Get disk child number by buffer header and position in the tree node. */
1119#define B_N_CHILD_NUM(p_s_bh,n_pos) (dc_block_number(B_N_CHILD(p_s_bh,n_pos))) 1150#define B_N_CHILD_NUM(bh, n_pos) (dc_block_number(B_N_CHILD(bh, n_pos)))
1120#define PUT_B_N_CHILD_NUM(p_s_bh,n_pos, val) (put_dc_block_number(B_N_CHILD(p_s_bh,n_pos), val )) 1151#define PUT_B_N_CHILD_NUM(bh, n_pos, val) \
1152 (put_dc_block_number(B_N_CHILD(bh, n_pos), val))
1121 1153
1122 /* maximal value of field child_size in structure disk_child */ 1154 /* maximal value of field child_size in structure disk_child */
1123 /* child size is the combined size of all items and their headers */ 1155 /* child size is the combined size of all items and their headers */
@@ -1188,33 +1220,33 @@ struct treepath {
1188struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} 1220struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,}
1189 1221
1190/* Get path element by path and path position. */ 1222/* Get path element by path and path position. */
1191#define PATH_OFFSET_PELEMENT(p_s_path,n_offset) ((p_s_path)->path_elements +(n_offset)) 1223#define PATH_OFFSET_PELEMENT(path, n_offset) ((path)->path_elements + (n_offset))
1192 1224
1193/* Get buffer header at the path by path and path position. */ 1225/* Get buffer header at the path by path and path position. */
1194#define PATH_OFFSET_PBUFFER(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_buffer) 1226#define PATH_OFFSET_PBUFFER(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_buffer)
1195 1227
1196/* Get position in the element at the path by path and path position. */ 1228/* Get position in the element at the path by path and path position. */
1197#define PATH_OFFSET_POSITION(p_s_path,n_offset) (PATH_OFFSET_PELEMENT(p_s_path,n_offset)->pe_position) 1229#define PATH_OFFSET_POSITION(path, n_offset) (PATH_OFFSET_PELEMENT(path, n_offset)->pe_position)
1198 1230
1199#define PATH_PLAST_BUFFER(p_s_path) (PATH_OFFSET_PBUFFER((p_s_path), (p_s_path)->path_length)) 1231#define PATH_PLAST_BUFFER(path) (PATH_OFFSET_PBUFFER((path), (path)->path_length))
1200 /* you know, to the person who didn't 1232 /* you know, to the person who didn't
1201 write this the macro name does not 1233 write this the macro name does not
1202 at first suggest what it does. 1234 at first suggest what it does.
1203 Maybe POSITION_FROM_PATH_END? Or 1235 Maybe POSITION_FROM_PATH_END? Or
1204 maybe we should just focus on 1236 maybe we should just focus on
1205 dumping paths... -Hans */ 1237 dumping paths... -Hans */
1206#define PATH_LAST_POSITION(p_s_path) (PATH_OFFSET_POSITION((p_s_path), (p_s_path)->path_length)) 1238#define PATH_LAST_POSITION(path) (PATH_OFFSET_POSITION((path), (path)->path_length))
1207 1239
1208#define PATH_PITEM_HEAD(p_s_path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(p_s_path),PATH_LAST_POSITION(p_s_path)) 1240#define PATH_PITEM_HEAD(path) B_N_PITEM_HEAD(PATH_PLAST_BUFFER(path), PATH_LAST_POSITION(path))
1209 1241
1210/* in do_balance leaf has h == 0 in contrast with path structure, 1242/* in do_balance leaf has h == 0 in contrast with path structure,
1211 where root has level == 0. That is why we need these defines */ 1243 where root has level == 0. That is why we need these defines */
1212#define PATH_H_PBUFFER(p_s_path, h) PATH_OFFSET_PBUFFER (p_s_path, p_s_path->path_length - (h)) /* tb->S[h] */ 1244#define PATH_H_PBUFFER(path, h) PATH_OFFSET_PBUFFER (path, path->path_length - (h)) /* tb->S[h] */
1213#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */ 1245#define PATH_H_PPARENT(path, h) PATH_H_PBUFFER (path, (h) + 1) /* tb->F[h] or tb->S[0]->b_parent */
1214#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h)) 1246#define PATH_H_POSITION(path, h) PATH_OFFSET_POSITION (path, path->path_length - (h))
1215#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */ 1247#define PATH_H_B_ITEM_ORDER(path, h) PATH_H_POSITION(path, h + 1) /* tb->S[h]->b_item_order */
1216 1248
1217#define PATH_H_PATH_OFFSET(p_s_path, n_h) ((p_s_path)->path_length - (n_h)) 1249#define PATH_H_PATH_OFFSET(path, n_h) ((path)->path_length - (n_h))
1218 1250
1219#define get_last_bh(path) PATH_PLAST_BUFFER(path) 1251#define get_last_bh(path) PATH_PLAST_BUFFER(path)
1220#define get_ih(path) PATH_PITEM_HEAD(path) 1252#define get_ih(path) PATH_PITEM_HEAD(path)
@@ -1444,6 +1476,16 @@ struct buffer_info {
1444 int bi_position; 1476 int bi_position;
1445}; 1477};
1446 1478
1479static inline struct super_block *sb_from_tb(struct tree_balance *tb)
1480{
1481 return tb ? tb->tb_sb : NULL;
1482}
1483
1484static inline struct super_block *sb_from_bi(struct buffer_info *bi)
1485{
1486 return bi ? sb_from_tb(bi->tb) : NULL;
1487}
1488
1447/* there are 4 types of items: stat data, directory item, indirect, direct. 1489/* there are 4 types of items: stat data, directory item, indirect, direct.
1448+-------------------+------------+--------------+------------+ 1490+-------------------+------------+--------------+------------+
1449| | k_offset | k_uniqueness | mergeable? | 1491| | k_offset | k_uniqueness | mergeable? |
@@ -1494,7 +1536,7 @@ extern struct item_operations *item_ops[TYPE_ANY + 1];
1494#define COMP_SHORT_KEYS comp_short_keys 1536#define COMP_SHORT_KEYS comp_short_keys
1495 1537
1496/* number of blocks pointed to by the indirect item */ 1538/* number of blocks pointed to by the indirect item */
1497#define I_UNFM_NUM(p_s_ih) ( ih_item_len(p_s_ih) / UNFM_P_SIZE ) 1539#define I_UNFM_NUM(ih) (ih_item_len(ih) / UNFM_P_SIZE)
1498 1540
1499/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */ 1541/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */
1500#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size)) 1542#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size))
@@ -1540,7 +1582,6 @@ struct reiserfs_iget_args {
1540/* FUNCTION DECLARATIONS */ 1582/* FUNCTION DECLARATIONS */
1541/***************************************************************************/ 1583/***************************************************************************/
1542 1584
1543/*#ifdef __KERNEL__*/
1544#define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12) 1585#define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12)
1545 1586
1546#define journal_trans_half(blocksize) \ 1587#define journal_trans_half(blocksize) \
@@ -1598,6 +1639,10 @@ struct reiserfs_journal_header {
1598#define JOURNAL_MAX_COMMIT_AGE 30 1639#define JOURNAL_MAX_COMMIT_AGE 30
1599#define JOURNAL_MAX_TRANS_AGE 30 1640#define JOURNAL_MAX_TRANS_AGE 30
1600#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9) 1641#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)
1642#define JOURNAL_BLOCKS_PER_OBJECT(sb) (JOURNAL_PER_BALANCE_CNT * 3 + \
1643 2 * (REISERFS_QUOTA_INIT_BLOCKS(sb) + \
1644 REISERFS_QUOTA_TRANS_BLOCKS(sb)))
1645
1601#ifdef CONFIG_QUOTA 1646#ifdef CONFIG_QUOTA
1602/* We need to update data and inode (atime) */ 1647/* We need to update data and inode (atime) */
1603#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0) 1648#define REISERFS_QUOTA_TRANS_BLOCKS(s) (REISERFS_SB(s)->s_mount_opt & (1<<REISERFS_QUOTA) ? 2 : 0)
@@ -1672,7 +1717,7 @@ struct reiserfs_transaction_handle {
1672 int t_refcount; 1717 int t_refcount;
1673 int t_blocks_logged; /* number of blocks this writer has logged */ 1718 int t_blocks_logged; /* number of blocks this writer has logged */
1674 int t_blocks_allocated; /* number of blocks this writer allocated */ 1719 int t_blocks_allocated; /* number of blocks this writer allocated */
1675 unsigned long t_trans_id; /* sanity check, equals the current trans id */ 1720 unsigned int t_trans_id; /* sanity check, equals the current trans id */
1676 void *t_handle_save; /* save existing current->journal_info */ 1721 void *t_handle_save; /* save existing current->journal_info */
1677 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block 1722 unsigned displace_new_blocks:1; /* if new block allocation occurres, that block
1678 should be displaced from others */ 1723 should be displaced from others */
@@ -1748,13 +1793,13 @@ int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *,
1748int journal_mark_freed(struct reiserfs_transaction_handle *, 1793int journal_mark_freed(struct reiserfs_transaction_handle *,
1749 struct super_block *, b_blocknr_t blocknr); 1794 struct super_block *, b_blocknr_t blocknr);
1750int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); 1795int journal_transaction_should_end(struct reiserfs_transaction_handle *, int);
1751int reiserfs_in_journal(struct super_block *p_s_sb, unsigned int bmap_nr, 1796int reiserfs_in_journal(struct super_block *sb, unsigned int bmap_nr,
1752 int bit_nr, int searchall, b_blocknr_t *next); 1797 int bit_nr, int searchall, b_blocknr_t *next);
1753int journal_begin(struct reiserfs_transaction_handle *, 1798int journal_begin(struct reiserfs_transaction_handle *,
1754 struct super_block *p_s_sb, unsigned long); 1799 struct super_block *sb, unsigned long);
1755int journal_join_abort(struct reiserfs_transaction_handle *, 1800int journal_join_abort(struct reiserfs_transaction_handle *,
1756 struct super_block *p_s_sb, unsigned long); 1801 struct super_block *sb, unsigned long);
1757void reiserfs_journal_abort(struct super_block *sb, int errno); 1802void reiserfs_abort_journal(struct super_block *sb, int errno);
1758void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); 1803void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
1759int reiserfs_allocate_list_bitmaps(struct super_block *s, 1804int reiserfs_allocate_list_bitmaps(struct super_block *s,
1760 struct reiserfs_list_bitmap *, unsigned int); 1805 struct reiserfs_list_bitmap *, unsigned int);
@@ -1771,8 +1816,8 @@ int reiserfs_convert_objectid_map_v1(struct super_block *);
1771 1816
1772/* stree.c */ 1817/* stree.c */
1773int B_IS_IN_TREE(const struct buffer_head *); 1818int B_IS_IN_TREE(const struct buffer_head *);
1774extern void copy_item_head(struct item_head *p_v_to, 1819extern void copy_item_head(struct item_head *to,
1775 const struct item_head *p_v_from); 1820 const struct item_head *from);
1776 1821
1777// first key is in cpu form, second - le 1822// first key is in cpu form, second - le
1778extern int comp_short_keys(const struct reiserfs_key *le_key, 1823extern int comp_short_keys(const struct reiserfs_key *le_key,
@@ -1807,20 +1852,20 @@ static inline void copy_key(struct reiserfs_key *to,
1807 memcpy(to, from, KEY_SIZE); 1852 memcpy(to, from, KEY_SIZE);
1808} 1853}
1809 1854
1810int comp_items(const struct item_head *stored_ih, const struct treepath *p_s_path); 1855int comp_items(const struct item_head *stored_ih, const struct treepath *path);
1811const struct reiserfs_key *get_rkey(const struct treepath *p_s_chk_path, 1856const struct reiserfs_key *get_rkey(const struct treepath *chk_path,
1812 const struct super_block *p_s_sb); 1857 const struct super_block *sb);
1813int search_by_key(struct super_block *, const struct cpu_key *, 1858int search_by_key(struct super_block *, const struct cpu_key *,
1814 struct treepath *, int); 1859 struct treepath *, int);
1815#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) 1860#define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL)
1816int search_for_position_by_key(struct super_block *p_s_sb, 1861int search_for_position_by_key(struct super_block *sb,
1817 const struct cpu_key *p_s_cpu_key, 1862 const struct cpu_key *cpu_key,
1818 struct treepath *p_s_search_path); 1863 struct treepath *search_path);
1819extern void decrement_bcount(struct buffer_head *p_s_bh); 1864extern void decrement_bcount(struct buffer_head *bh);
1820void decrement_counters_in_path(struct treepath *p_s_search_path); 1865void decrement_counters_in_path(struct treepath *search_path);
1821void pathrelse(struct treepath *p_s_search_path); 1866void pathrelse(struct treepath *search_path);
1822int reiserfs_check_path(struct treepath *p); 1867int reiserfs_check_path(struct treepath *p);
1823void pathrelse_and_restore(struct super_block *s, struct treepath *p_s_search_path); 1868void pathrelse_and_restore(struct super_block *s, struct treepath *search_path);
1824 1869
1825int reiserfs_insert_item(struct reiserfs_transaction_handle *th, 1870int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
1826 struct treepath *path, 1871 struct treepath *path,
@@ -1843,14 +1888,14 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
1843int reiserfs_delete_item(struct reiserfs_transaction_handle *th, 1888int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
1844 struct treepath *path, 1889 struct treepath *path,
1845 const struct cpu_key *key, 1890 const struct cpu_key *key,
1846 struct inode *inode, struct buffer_head *p_s_un_bh); 1891 struct inode *inode, struct buffer_head *un_bh);
1847 1892
1848void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, 1893void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
1849 struct inode *inode, struct reiserfs_key *key); 1894 struct inode *inode, struct reiserfs_key *key);
1850int reiserfs_delete_object(struct reiserfs_transaction_handle *th, 1895int reiserfs_delete_object(struct reiserfs_transaction_handle *th,
1851 struct inode *p_s_inode); 1896 struct inode *inode);
1852int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, 1897int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
1853 struct inode *p_s_inode, struct page *, 1898 struct inode *inode, struct page *,
1854 int update_timestamps); 1899 int update_timestamps);
1855 1900
1856#define i_block_size(inode) ((inode)->i_sb->s_blocksize) 1901#define i_block_size(inode) ((inode)->i_sb->s_blocksize)
@@ -1894,10 +1939,12 @@ void make_le_item_head(struct item_head *ih, const struct cpu_key *key,
1894 loff_t offset, int type, int length, int entry_count); 1939 loff_t offset, int type, int length, int entry_count);
1895struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key); 1940struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key);
1896 1941
1942struct reiserfs_security_handle;
1897int reiserfs_new_inode(struct reiserfs_transaction_handle *th, 1943int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1898 struct inode *dir, int mode, 1944 struct inode *dir, int mode,
1899 const char *symname, loff_t i_size, 1945 const char *symname, loff_t i_size,
1900 struct dentry *dentry, struct inode *inode); 1946 struct dentry *dentry, struct inode *inode,
1947 struct reiserfs_security_handle *security);
1901 1948
1902void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th, 1949void reiserfs_update_sd_size(struct reiserfs_transaction_handle *th,
1903 struct inode *inode, loff_t size); 1950 struct inode *inode, loff_t size);
@@ -1955,7 +2002,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
1955#define PROC_INFO_MAX( sb, field, value ) VOID_V 2002#define PROC_INFO_MAX( sb, field, value ) VOID_V
1956#define PROC_INFO_INC( sb, field ) VOID_V 2003#define PROC_INFO_INC( sb, field ) VOID_V
1957#define PROC_INFO_ADD( sb, field, val ) VOID_V 2004#define PROC_INFO_ADD( sb, field, val ) VOID_V
1958#define PROC_INFO_BH_STAT( p_s_sb, p_s_bh, n_node_level ) VOID_V 2005#define PROC_INFO_BH_STAT(sb, bh, n_node_level) VOID_V
1959#endif 2006#endif
1960 2007
1961/* dir.c */ 2008/* dir.c */
@@ -1963,6 +2010,7 @@ extern const struct inode_operations reiserfs_dir_inode_operations;
1963extern const struct inode_operations reiserfs_symlink_inode_operations; 2010extern const struct inode_operations reiserfs_symlink_inode_operations;
1964extern const struct inode_operations reiserfs_special_inode_operations; 2011extern const struct inode_operations reiserfs_special_inode_operations;
1965extern const struct file_operations reiserfs_dir_operations; 2012extern const struct file_operations reiserfs_dir_operations;
2013int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *);
1966 2014
1967/* tail_conversion.c */ 2015/* tail_conversion.c */
1968int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, 2016int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
@@ -1979,13 +2027,20 @@ extern const struct address_space_operations reiserfs_address_space_operations;
1979 2027
1980/* fix_nodes.c */ 2028/* fix_nodes.c */
1981 2029
1982int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, 2030int fix_nodes(int n_op_mode, struct tree_balance *tb,
1983 struct item_head *p_s_ins_ih, const void *); 2031 struct item_head *ins_ih, const void *);
1984void unfix_nodes(struct tree_balance *); 2032void unfix_nodes(struct tree_balance *);
1985 2033
1986/* prints.c */ 2034/* prints.c */
1987void reiserfs_panic(struct super_block *s, const char *fmt, ...) 2035void __reiserfs_panic(struct super_block *s, const char *id,
2036 const char *function, const char *fmt, ...)
1988 __attribute__ ((noreturn)); 2037 __attribute__ ((noreturn));
2038#define reiserfs_panic(s, id, fmt, args...) \
2039 __reiserfs_panic(s, id, __func__, fmt, ##args)
2040void __reiserfs_error(struct super_block *s, const char *id,
2041 const char *function, const char *fmt, ...);
2042#define reiserfs_error(s, id, fmt, args...) \
2043 __reiserfs_error(s, id, __func__, fmt, ##args)
1989void reiserfs_info(struct super_block *s, const char *fmt, ...); 2044void reiserfs_info(struct super_block *s, const char *fmt, ...);
1990void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...); 2045void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...);
1991void print_indirect_item(struct buffer_head *bh, int item_num); 2046void print_indirect_item(struct buffer_head *bh, int item_num);
@@ -2022,7 +2077,7 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int pasted_item_num,
2022 int zeros_number); 2077 int zeros_number);
2023void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num, 2078void leaf_cut_from_buffer(struct buffer_info *bi, int cut_item_num,
2024 int pos_in_item, int cut_size); 2079 int pos_in_item, int cut_size);
2025void leaf_paste_entries(struct buffer_head *bh, int item_num, int before, 2080void leaf_paste_entries(struct buffer_info *bi, int item_num, int before,
2026 int new_entry_count, struct reiserfs_de_head *new_dehs, 2081 int new_entry_count, struct reiserfs_de_head *new_dehs,
2027 const char *records, int paste_size); 2082 const char *records, int paste_size);
2028/* ibalance.c */ 2083/* ibalance.c */
@@ -2178,29 +2233,6 @@ long reiserfs_compat_ioctl(struct file *filp,
2178 unsigned int cmd, unsigned long arg); 2233 unsigned int cmd, unsigned long arg);
2179int reiserfs_unpack(struct inode *inode, struct file *filp); 2234int reiserfs_unpack(struct inode *inode, struct file *filp);
2180 2235
2181/* ioctl's command */ 2236#endif /* __KERNEL__ */
2182#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
2183/* define following flags to be the same as in ext2, so that chattr(1),
2184 lsattr(1) will work with us. */
2185#define REISERFS_IOC_GETFLAGS FS_IOC_GETFLAGS
2186#define REISERFS_IOC_SETFLAGS FS_IOC_SETFLAGS
2187#define REISERFS_IOC_GETVERSION FS_IOC_GETVERSION
2188#define REISERFS_IOC_SETVERSION FS_IOC_SETVERSION
2189
2190/* the 32 bit compat definitions with int argument */
2191#define REISERFS_IOC32_UNPACK _IOW(0xCD, 1, int)
2192#define REISERFS_IOC32_GETFLAGS FS_IOC32_GETFLAGS
2193#define REISERFS_IOC32_SETFLAGS FS_IOC32_SETFLAGS
2194#define REISERFS_IOC32_GETVERSION FS_IOC32_GETVERSION
2195#define REISERFS_IOC32_SETVERSION FS_IOC32_SETVERSION
2196
2197/* Locking primitives */
2198/* Right now we are still falling back to (un)lock_kernel, but eventually that
2199 would evolve into real per-fs locks */
2200#define reiserfs_write_lock( sb ) lock_kernel()
2201#define reiserfs_write_unlock( sb ) unlock_kernel()
2202
2203/* xattr stuff */
2204#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem)
2205 2237
2206#endif /* _LINUX_REISER_FS_H */ 2238#endif /* _LINUX_REISER_FS_H */
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index ce3663fb0101..76360b36ac33 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -51,7 +51,7 @@ struct reiserfs_inode_info {
51 /* we use these for fsync or O_SYNC to decide which transaction 51 /* we use these for fsync or O_SYNC to decide which transaction
52 ** needs to be committed in order for this inode to be properly 52 ** needs to be committed in order for this inode to be properly
53 ** flushed */ 53 ** flushed */
54 unsigned long i_trans_id; 54 unsigned int i_trans_id;
55 struct reiserfs_journal_list *i_jl; 55 struct reiserfs_journal_list *i_jl;
56 struct mutex i_mmap; 56 struct mutex i_mmap;
57#ifdef CONFIG_REISERFS_FS_POSIX_ACL 57#ifdef CONFIG_REISERFS_FS_POSIX_ACL
@@ -59,7 +59,7 @@ struct reiserfs_inode_info {
59 struct posix_acl *i_acl_default; 59 struct posix_acl *i_acl_default;
60#endif 60#endif
61#ifdef CONFIG_REISERFS_FS_XATTR 61#ifdef CONFIG_REISERFS_FS_XATTR
62 struct rw_semaphore xattr_sem; 62 struct rw_semaphore i_xattr_sem;
63#endif 63#endif
64 struct inode vfs_inode; 64 struct inode vfs_inode;
65}; 65};
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index bda6b562a1e0..6b361d23a499 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -14,7 +14,7 @@ typedef enum {
14} reiserfs_super_block_flags; 14} reiserfs_super_block_flags;
15 15
16/* struct reiserfs_super_block accessors/mutators 16/* struct reiserfs_super_block accessors/mutators
17 * since this is a disk structure, it will always be in 17 * since this is a disk structure, it will always be in
18 * little endian format. */ 18 * little endian format. */
19#define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count)) 19#define sb_block_count(sbp) (le32_to_cpu((sbp)->s_v1.s_block_count))
20#define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v)) 20#define set_sb_block_count(sbp,v) ((sbp)->s_v1.s_block_count = cpu_to_le32(v))
@@ -73,6 +73,9 @@ typedef enum {
73#define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version)) 73#define sb_version(sbp) (le16_to_cpu((sbp)->s_v1.s_version))
74#define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v)) 74#define set_sb_version(sbp,v) ((sbp)->s_v1.s_version = cpu_to_le16(v))
75 75
76#define sb_mnt_count(sbp) (le16_to_cpu((sbp)->s_mnt_count))
77#define set_sb_mnt_count(sbp, v) ((sbp)->s_mnt_count = cpu_to_le16(v))
78
76#define sb_reserved_for_journal(sbp) \ 79#define sb_reserved_for_journal(sbp) \
77 (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal)) 80 (le16_to_cpu((sbp)->s_v1.s_reserved_for_journal))
78#define set_sb_reserved_for_journal(sbp,v) \ 81#define set_sb_reserved_for_journal(sbp,v) \
@@ -80,16 +83,16 @@ typedef enum {
80 83
81/* LOGGING -- */ 84/* LOGGING -- */
82 85
83/* These all interelate for performance. 86/* These all interelate for performance.
84** 87**
85** If the journal block count is smaller than n transactions, you lose speed. 88** If the journal block count is smaller than n transactions, you lose speed.
86** I don't know what n is yet, I'm guessing 8-16. 89** I don't know what n is yet, I'm guessing 8-16.
87** 90**
88** typical transaction size depends on the application, how often fsync is 91** typical transaction size depends on the application, how often fsync is
89** called, and how many metadata blocks you dirty in a 30 second period. 92** called, and how many metadata blocks you dirty in a 30 second period.
90** The more small files (<16k) you use, the larger your transactions will 93** The more small files (<16k) you use, the larger your transactions will
91** be. 94** be.
92** 95**
93** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal 96** If your journal fills faster than dirty buffers get flushed to disk, it must flush them before allowing the journal
94** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough 97** to wrap, which slows things down. If you need high speed meta data updates, the journal should be big enough
95** to prevent wrapping before dirty meta blocks get to disk. 98** to prevent wrapping before dirty meta blocks get to disk.
@@ -153,7 +156,7 @@ struct reiserfs_journal_list {
153 atomic_t j_commit_left; 156 atomic_t j_commit_left;
154 atomic_t j_older_commits_done; /* all commits older than this on disk */ 157 atomic_t j_older_commits_done; /* all commits older than this on disk */
155 struct mutex j_commit_mutex; 158 struct mutex j_commit_mutex;
156 unsigned long j_trans_id; 159 unsigned int j_trans_id;
157 time_t j_timestamp; 160 time_t j_timestamp;
158 struct reiserfs_list_bitmap *j_list_bitmap; 161 struct reiserfs_list_bitmap *j_list_bitmap;
159 struct buffer_head *j_commit_bh; /* commit buffer head */ 162 struct buffer_head *j_commit_bh; /* commit buffer head */
@@ -182,7 +185,7 @@ struct reiserfs_journal {
182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ 185 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
183 186
184 unsigned long j_state; 187 unsigned long j_state;
185 unsigned long j_trans_id; 188 unsigned int j_trans_id;
186 unsigned long j_mount_id; 189 unsigned long j_mount_id;
187 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ 190 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */
188 unsigned long j_len; /* length of current waiting commit */ 191 unsigned long j_len; /* length of current waiting commit */
@@ -190,7 +193,7 @@ struct reiserfs_journal {
190 atomic_t j_wcount; /* count of writers for current commit */ 193 atomic_t j_wcount; /* count of writers for current commit */
191 unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */ 194 unsigned long j_bcount; /* batch count. allows turning X transactions into 1 */
192 unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */ 195 unsigned long j_first_unflushed_offset; /* first unflushed transactions offset */
193 unsigned long j_last_flush_trans_id; /* last fully flushed journal timestamp */ 196 unsigned j_last_flush_trans_id; /* last fully flushed journal timestamp */
194 struct buffer_head *j_header_bh; 197 struct buffer_head *j_header_bh;
195 198
196 time_t j_trans_start_time; /* time this transaction started */ 199 time_t j_trans_start_time; /* time this transaction started */
@@ -223,10 +226,10 @@ struct reiserfs_journal {
223 int j_num_work_lists; /* number that need attention from kreiserfsd */ 226 int j_num_work_lists; /* number that need attention from kreiserfsd */
224 227
225 /* debugging to make sure things are flushed in order */ 228 /* debugging to make sure things are flushed in order */
226 int j_last_flush_id; 229 unsigned int j_last_flush_id;
227 230
228 /* debugging to make sure things are committed in order */ 231 /* debugging to make sure things are committed in order */
229 int j_last_commit_id; 232 unsigned int j_last_commit_id;
230 233
231 struct list_head j_bitmap_nodes; 234 struct list_head j_bitmap_nodes;
232 struct list_head j_dirty_buffers; 235 struct list_head j_dirty_buffers;
@@ -239,7 +242,7 @@ struct reiserfs_journal {
239 242
240 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */ 243 struct reiserfs_list_bitmap j_list_bitmap[JOURNAL_NUM_BITMAPS]; /* array of bitmaps to record the deleted blocks */
241 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */ 244 struct reiserfs_journal_cnode *j_hash_table[JOURNAL_HASH_SIZE]; /* hash table for real buffer heads in current trans */
242 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all 245 struct reiserfs_journal_cnode *j_list_hash_table[JOURNAL_HASH_SIZE]; /* hash table for all the real buffer heads in all
243 the transactions */ 246 the transactions */
244 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */ 247 struct list_head j_prealloc_list; /* list of inodes which have preallocated blocks */
245 int j_persistent_trans; 248 int j_persistent_trans;
@@ -399,10 +402,7 @@ struct reiserfs_sb_info {
399 int reserved_blocks; /* amount of blocks reserved for further allocations */ 402 int reserved_blocks; /* amount of blocks reserved for further allocations */
400 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */ 403 spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */
401 struct dentry *priv_root; /* root of /.reiserfs_priv */ 404 struct dentry *priv_root; /* root of /.reiserfs_priv */
402#ifdef CONFIG_REISERFS_FS_XATTR
403 struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */ 405 struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */
404 struct rw_semaphore xattr_dir_sem;
405#endif
406 int j_errno; 406 int j_errno;
407#ifdef CONFIG_QUOTA 407#ifdef CONFIG_QUOTA
408 char *s_qf_names[MAXQUOTAS]; 408 char *s_qf_names[MAXQUOTAS];
@@ -426,7 +426,7 @@ enum reiserfs_mount_options {
426 partition will be dealt with in a 426 partition will be dealt with in a
427 manner of 3.5.x */ 427 manner of 3.5.x */
428 428
429/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting 429/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting
430** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option 430** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option
431** is not required. If the normal autodection code can't determine which 431** is not required. If the normal autodection code can't determine which
432** hash to use (because both hashes had the same value for a file) 432** hash to use (because both hashes had the same value for a file)
@@ -451,7 +451,6 @@ enum reiserfs_mount_options {
451 REISERFS_NO_UNHASHED_RELOCATION, 451 REISERFS_NO_UNHASHED_RELOCATION,
452 REISERFS_HASHED_RELOCATION, 452 REISERFS_HASHED_RELOCATION,
453 REISERFS_ATTRS, 453 REISERFS_ATTRS,
454 REISERFS_XATTRS,
455 REISERFS_XATTRS_USER, 454 REISERFS_XATTRS_USER,
456 REISERFS_POSIXACL, 455 REISERFS_POSIXACL,
457 REISERFS_BARRIER_NONE, 456 REISERFS_BARRIER_NONE,
@@ -489,7 +488,7 @@ enum reiserfs_mount_options {
489#define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG)) 488#define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG))
490#define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED)) 489#define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED))
491#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) 490#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK))
492#define reiserfs_xattrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS)) 491#define reiserfs_xattrs(s) ((s)->s_xattr != NULL)
493#define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER)) 492#define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER))
494#define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL)) 493#define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL))
495#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) 494#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index af135ae895db..dcae01e63e40 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -15,6 +15,12 @@ struct reiserfs_xattr_header {
15 __le32 h_hash; /* hash of the value */ 15 __le32 h_hash; /* hash of the value */
16}; 16};
17 17
18struct reiserfs_security_handle {
19 char *name;
20 void *value;
21 size_t length;
22};
23
18#ifdef __KERNEL__ 24#ifdef __KERNEL__
19 25
20#include <linux/init.h> 26#include <linux/init.h>
@@ -29,22 +35,13 @@ struct iattr;
29struct super_block; 35struct super_block;
30struct nameidata; 36struct nameidata;
31 37
32struct reiserfs_xattr_handler { 38int reiserfs_xattr_register_handlers(void) __init;
33 char *prefix; 39void reiserfs_xattr_unregister_handlers(void);
34 int (*init) (void); 40int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
35 void (*exit) (void); 41int reiserfs_delete_xattrs(struct inode *inode);
36 int (*get) (struct inode * inode, const char *name, void *buffer, 42int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
37 size_t size);
38 int (*set) (struct inode * inode, const char *name, const void *buffer,
39 size_t size, int flags);
40 int (*del) (struct inode * inode, const char *name);
41 int (*list) (struct inode * inode, const char *name, int namelen,
42 char *out);
43 struct list_head handlers;
44};
45 43
46#ifdef CONFIG_REISERFS_FS_XATTR 44#ifdef CONFIG_REISERFS_FS_XATTR
47#define is_reiserfs_priv_object(inode) IS_PRIVATE(inode)
48#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 45#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
49ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, 46ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
50 void *buffer, size_t size); 47 void *buffer, size_t size);
@@ -52,104 +49,97 @@ int reiserfs_setxattr(struct dentry *dentry, const char *name,
52 const void *value, size_t size, int flags); 49 const void *value, size_t size, int flags);
53ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); 50ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
54int reiserfs_removexattr(struct dentry *dentry, const char *name); 51int reiserfs_removexattr(struct dentry *dentry, const char *name);
55int reiserfs_delete_xattrs(struct inode *inode);
56int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
57int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
58int reiserfs_permission(struct inode *inode, int mask); 52int reiserfs_permission(struct inode *inode, int mask);
59 53
60int reiserfs_xattr_del(struct inode *, const char *); 54int reiserfs_xattr_get(struct inode *, const char *, void *, size_t);
61int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
62int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); 55int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
63 56int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *,
64extern struct reiserfs_xattr_handler user_handler; 57 struct inode *, const char *, const void *,
65extern struct reiserfs_xattr_handler trusted_handler; 58 size_t, int);
66extern struct reiserfs_xattr_handler security_handler; 59
67 60extern struct xattr_handler reiserfs_xattr_user_handler;
68int reiserfs_xattr_register_handlers(void) __init; 61extern struct xattr_handler reiserfs_xattr_trusted_handler;
69void reiserfs_xattr_unregister_handlers(void); 62extern struct xattr_handler reiserfs_xattr_security_handler;
70 63#ifdef CONFIG_REISERFS_FS_SECURITY
71static inline void reiserfs_write_lock_xattrs(struct super_block *sb) 64int reiserfs_security_init(struct inode *dir, struct inode *inode,
72{ 65 struct reiserfs_security_handle *sec);
73 down_write(&REISERFS_XATTR_DIR_SEM(sb)); 66int reiserfs_security_write(struct reiserfs_transaction_handle *th,
74} 67 struct inode *inode,
75static inline void reiserfs_write_unlock_xattrs(struct super_block *sb) 68 struct reiserfs_security_handle *sec);
76{ 69void reiserfs_security_free(struct reiserfs_security_handle *sec);
77 up_write(&REISERFS_XATTR_DIR_SEM(sb)); 70#endif
78} 71
79static inline void reiserfs_read_lock_xattrs(struct super_block *sb) 72#define xattr_size(size) ((size) + sizeof(struct reiserfs_xattr_header))
80{ 73static inline loff_t reiserfs_xattr_nblocks(struct inode *inode, loff_t size)
81 down_read(&REISERFS_XATTR_DIR_SEM(sb));
82}
83
84static inline void reiserfs_read_unlock_xattrs(struct super_block *sb)
85{ 74{
86 up_read(&REISERFS_XATTR_DIR_SEM(sb)); 75 loff_t ret = 0;
76 if (reiserfs_file_data_log(inode)) {
77 ret = _ROUND_UP(xattr_size(size), inode->i_sb->s_blocksize);
78 ret >>= inode->i_sb->s_blocksize_bits;
79 }
80 return ret;
87} 81}
88 82
89static inline void reiserfs_write_lock_xattr_i(struct inode *inode) 83/* We may have to create up to 3 objects: xattr root, xattr dir, xattr file.
90{ 84 * Let's try to be smart about it.
91 down_write(&REISERFS_I(inode)->xattr_sem); 85 * xattr root: We cache it. If it's not cached, we may need to create it.
92} 86 * xattr dir: If anything has been loaded for this inode, we can set a flag
93static inline void reiserfs_write_unlock_xattr_i(struct inode *inode) 87 * saying so.
88 * xattr file: Since we don't cache xattrs, we can't tell. We always include
89 * blocks for it.
90 *
91 * However, since root and dir can be created between calls - YOU MUST SAVE
92 * THIS VALUE.
93 */
94static inline size_t reiserfs_xattr_jcreate_nblocks(struct inode *inode)
94{ 95{
95 up_write(&REISERFS_I(inode)->xattr_sem); 96 size_t nblocks = JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
96}
97static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
98{
99 down_read(&REISERFS_I(inode)->xattr_sem);
100}
101 97
102static inline void reiserfs_read_unlock_xattr_i(struct inode *inode) 98 if ((REISERFS_I(inode)->i_flags & i_has_xattr_dir) == 0) {
103{ 99 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
104 up_read(&REISERFS_I(inode)->xattr_sem); 100 if (REISERFS_SB(inode->i_sb)->xattr_root == NULL)
105} 101 nblocks += JOURNAL_BLOCKS_PER_OBJECT(inode->i_sb);
102 }
106 103
107static inline void reiserfs_mark_inode_private(struct inode *inode) 104 return nblocks;
108{
109 inode->i_flags |= S_PRIVATE;
110} 105}
111 106
112static inline void reiserfs_init_xattr_rwsem(struct inode *inode) 107static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
113{ 108{
114 init_rwsem(&REISERFS_I(inode)->xattr_sem); 109 init_rwsem(&REISERFS_I(inode)->i_xattr_sem);
115} 110}
116 111
117#else 112#else
118 113
119#define is_reiserfs_priv_object(inode) 0
120#define reiserfs_mark_inode_private(inode) do {;} while(0)
121#define reiserfs_getxattr NULL 114#define reiserfs_getxattr NULL
122#define reiserfs_setxattr NULL 115#define reiserfs_setxattr NULL
123#define reiserfs_listxattr NULL 116#define reiserfs_listxattr NULL
124#define reiserfs_removexattr NULL 117#define reiserfs_removexattr NULL
125#define reiserfs_write_lock_xattrs(sb) do {;} while(0)
126#define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
127#define reiserfs_read_lock_xattrs(sb)
128#define reiserfs_read_unlock_xattrs(sb)
129 118
130#define reiserfs_permission NULL 119#define reiserfs_permission NULL
131 120
132#define reiserfs_xattr_register_handlers() 0 121static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
133#define reiserfs_xattr_unregister_handlers()
134
135static inline int reiserfs_delete_xattrs(struct inode *inode)
136{ 122{
137 return 0; 123}
138}; 124#endif /* CONFIG_REISERFS_FS_XATTR */
139static inline int reiserfs_chown_xattrs(struct inode *inode, 125
140 struct iattr *attrs) 126#ifndef CONFIG_REISERFS_FS_SECURITY
127static inline int reiserfs_security_init(struct inode *dir,
128 struct inode *inode,
129 struct reiserfs_security_handle *sec)
141{ 130{
142 return 0; 131 return 0;
143}; 132}
144static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags) 133static inline int
134reiserfs_security_write(struct reiserfs_transaction_handle *th,
135 struct inode *inode,
136 struct reiserfs_security_handle *sec)
145{ 137{
146 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
147 return 0; 138 return 0;
148};
149static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
150{
151} 139}
152#endif /* CONFIG_REISERFS_FS_XATTR */ 140static inline void reiserfs_security_free(struct reiserfs_security_handle *sec)
141{}
142#endif
153 143
154#endif /* __KERNEL__ */ 144#endif /* __KERNEL__ */
155 145
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index b3b359660082..e1b7b2173885 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -8,7 +8,7 @@ struct ring_buffer;
8struct ring_buffer_iter; 8struct ring_buffer_iter;
9 9
10/* 10/*
11 * Don't reference this struct directly, use functions below. 11 * Don't refer to this struct directly, use functions below.
12 */ 12 */
13struct ring_buffer_event { 13struct ring_buffer_event {
14 u32 type:2, len:3, time_delta:27; 14 u32 type:2, len:3, time_delta:27;
@@ -18,10 +18,13 @@ struct ring_buffer_event {
18/** 18/**
19 * enum ring_buffer_type - internal ring buffer types 19 * enum ring_buffer_type - internal ring buffer types
20 * 20 *
21 * @RINGBUF_TYPE_PADDING: Left over page padding 21 * @RINGBUF_TYPE_PADDING: Left over page padding or discarded event
22 * array is ignored 22 * If time_delta is 0:
23 * size is variable depending on how much 23 * array is ignored
24 * size is variable depending on how much
24 * padding is needed 25 * padding is needed
26 * If time_delta is non zero:
27 * everything else same as RINGBUF_TYPE_DATA
25 * 28 *
26 * @RINGBUF_TYPE_TIME_EXTEND: Extend the time delta 29 * @RINGBUF_TYPE_TIME_EXTEND: Extend the time delta
27 * array[0] = time delta (28 .. 59) 30 * array[0] = time delta (28 .. 59)
@@ -65,6 +68,8 @@ ring_buffer_event_time_delta(struct ring_buffer_event *event)
65 return event->time_delta; 68 return event->time_delta;
66} 69}
67 70
71void ring_buffer_event_discard(struct ring_buffer_event *event);
72
68/* 73/*
69 * size is in bytes for each per CPU buffer. 74 * size is in bytes for each per CPU buffer.
70 */ 75 */
@@ -74,13 +79,10 @@ void ring_buffer_free(struct ring_buffer *buffer);
74 79
75int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); 80int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size);
76 81
77struct ring_buffer_event * 82struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer,
78ring_buffer_lock_reserve(struct ring_buffer *buffer, 83 unsigned long length);
79 unsigned long length,
80 unsigned long *flags);
81int ring_buffer_unlock_commit(struct ring_buffer *buffer, 84int ring_buffer_unlock_commit(struct ring_buffer *buffer,
82 struct ring_buffer_event *event, 85 struct ring_buffer_event *event);
83 unsigned long flags);
84int ring_buffer_write(struct ring_buffer *buffer, 86int ring_buffer_write(struct ring_buffer *buffer,
85 unsigned long length, void *data); 87 unsigned long length, void *data);
86 88
@@ -121,17 +123,19 @@ unsigned long ring_buffer_overruns(struct ring_buffer *buffer);
121unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu); 123unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);
122unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); 124unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
123 125
124u64 ring_buffer_time_stamp(int cpu); 126u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu);
125void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); 127void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer,
128 int cpu, u64 *ts);
129void ring_buffer_set_clock(struct ring_buffer *buffer,
130 u64 (*clock)(void));
131
132size_t ring_buffer_page_len(void *page);
126 133
127void tracing_on(void);
128void tracing_off(void);
129void tracing_off_permanent(void);
130 134
131void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); 135void *ring_buffer_alloc_read_page(struct ring_buffer *buffer);
132void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); 136void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data);
133int ring_buffer_read_page(struct ring_buffer *buffer, 137int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page,
134 void **data_page, int cpu, int full); 138 size_t len, int cpu, int full);
135 139
136enum ring_buffer_flags { 140enum ring_buffer_flags {
137 RB_FL_OVERWRITE = 1 << 0, 141 RB_FL_OVERWRITE = 1 << 0,
diff --git a/include/linux/rtc-v3020.h b/include/linux/rtc-v3020.h
index bf74e63c98fe..8ba646e610d9 100644
--- a/include/linux/rtc-v3020.h
+++ b/include/linux/rtc-v3020.h
@@ -14,6 +14,12 @@
14 * is used depends on the board. */ 14 * is used depends on the board. */
15struct v3020_platform_data { 15struct v3020_platform_data {
16 int leftshift; /* (1<<(leftshift)) & readl() */ 16 int leftshift; /* (1<<(leftshift)) & readl() */
17
18 int use_gpio:1;
19 unsigned int gpio_cs;
20 unsigned int gpio_wr;
21 unsigned int gpio_rd;
22 unsigned int gpio_io;
17}; 23};
18 24
19#define V3020_STATUS_0 0x00 25#define V3020_STATUS_0 0x00
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 4046b75563c1..60f88a7fb13d 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -99,6 +99,7 @@ struct rtc_pll_info {
99 99
100#ifdef __KERNEL__ 100#ifdef __KERNEL__
101 101
102#include <linux/types.h>
102#include <linux/interrupt.h> 103#include <linux/interrupt.h>
103 104
104extern int rtc_month_days(unsigned int month, unsigned int year); 105extern int rtc_month_days(unsigned int month, unsigned int year);
@@ -232,6 +233,11 @@ int rtc_register(rtc_task_t *task);
232int rtc_unregister(rtc_task_t *task); 233int rtc_unregister(rtc_task_t *task);
233int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 234int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
234 235
236static inline bool is_leap_year(unsigned int year)
237{
238 return (!(year % 4) && (year % 100)) || !(year % 400);
239}
240
235#endif /* __KERNEL__ */ 241#endif /* __KERNEL__ */
236 242
237#endif /* _LINUX_RTC_H_ */ 243#endif /* _LINUX_RTC_H_ */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 1e5f6730ff31..ba3254ecf7fb 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -217,6 +217,7 @@ enum
217#define RTPROT_DNROUTED 13 /* DECnet routing daemon */ 217#define RTPROT_DNROUTED 13 /* DECnet routing daemon */
218#define RTPROT_XORP 14 /* XORP */ 218#define RTPROT_XORP 14 /* XORP */
219#define RTPROT_NTK 15 /* Netsukuku */ 219#define RTPROT_NTK 15 /* Netsukuku */
220#define RTPROT_DHCP 16 /* DHCP client */
220 221
221/* rtm_scope 222/* rtm_scope
222 223
@@ -622,8 +623,8 @@ static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
622 623
623extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo); 624extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
624extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid); 625extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
625extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group, 626extern void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid,
626 struct nlmsghdr *nlh, gfp_t flags); 627 u32 group, struct nlmsghdr *nlh, gfp_t flags);
627extern void rtnl_set_sk_err(struct net *net, u32 group, int error); 628extern void rtnl_set_sk_err(struct net *net, u32 group, int error);
628extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); 629extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
629extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, 630extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8c216e057c94..b4c38bc8049c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -68,7 +68,7 @@ struct sched_param {
68#include <linux/smp.h> 68#include <linux/smp.h>
69#include <linux/sem.h> 69#include <linux/sem.h>
70#include <linux/signal.h> 70#include <linux/signal.h>
71#include <linux/fs_struct.h> 71#include <linux/path.h>
72#include <linux/compiler.h> 72#include <linux/compiler.h>
73#include <linux/completion.h> 73#include <linux/completion.h>
74#include <linux/pid.h> 74#include <linux/pid.h>
@@ -97,6 +97,7 @@ struct futex_pi_state;
97struct robust_list_head; 97struct robust_list_head;
98struct bio; 98struct bio;
99struct bts_tracer; 99struct bts_tracer;
100struct fs_struct;
100 101
101/* 102/*
102 * List of flags we want to share for kernel threads, 103 * List of flags we want to share for kernel threads,
@@ -137,6 +138,8 @@ extern unsigned long nr_uninterruptible(void);
137extern unsigned long nr_active(void); 138extern unsigned long nr_active(void);
138extern unsigned long nr_iowait(void); 139extern unsigned long nr_iowait(void);
139 140
141extern unsigned long get_parent_ip(unsigned long addr);
142
140struct seq_file; 143struct seq_file;
141struct cfs_rq; 144struct cfs_rq;
142struct task_group; 145struct task_group;
@@ -202,7 +205,8 @@ extern unsigned long long time_sync_thresh;
202#define task_is_stopped_or_traced(task) \ 205#define task_is_stopped_or_traced(task) \
203 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) 206 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
204#define task_contributes_to_load(task) \ 207#define task_contributes_to_load(task) \
205 ((task->state & TASK_UNINTERRUPTIBLE) != 0) 208 ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \
209 (task->flags & PF_FROZEN) == 0)
206 210
207#define __set_task_state(tsk, state_value) \ 211#define __set_task_state(tsk, state_value) \
208 do { (tsk)->state = (state_value); } while (0) 212 do { (tsk)->state = (state_value); } while (0)
@@ -297,17 +301,11 @@ extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
297 struct file *filp, void __user *buffer, 301 struct file *filp, void __user *buffer,
298 size_t *lenp, loff_t *ppos); 302 size_t *lenp, loff_t *ppos);
299extern unsigned int softlockup_panic; 303extern unsigned int softlockup_panic;
300extern unsigned long sysctl_hung_task_check_count;
301extern unsigned long sysctl_hung_task_timeout_secs;
302extern unsigned long sysctl_hung_task_warnings;
303extern int softlockup_thresh; 304extern int softlockup_thresh;
304#else 305#else
305static inline void softlockup_tick(void) 306static inline void softlockup_tick(void)
306{ 307{
307} 308}
308static inline void spawn_softlockup_task(void)
309{
310}
311static inline void touch_softlockup_watchdog(void) 309static inline void touch_softlockup_watchdog(void)
312{ 310{
313} 311}
@@ -316,6 +314,15 @@ static inline void touch_all_softlockup_watchdogs(void)
316} 314}
317#endif 315#endif
318 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
319 326
320/* Attach to any functions which should be ignored in wchan output. */ 327/* Attach to any functions which should be ignored in wchan output. */
321#define __sched __attribute__((__section__(".sched.text"))) 328#define __sched __attribute__((__section__(".sched.text")))
@@ -331,7 +338,9 @@ extern signed long schedule_timeout(signed long timeout);
331extern signed long schedule_timeout_interruptible(signed long timeout); 338extern signed long schedule_timeout_interruptible(signed long timeout);
332extern signed long schedule_timeout_killable(signed long timeout); 339extern signed long schedule_timeout_killable(signed long timeout);
333extern signed long schedule_timeout_uninterruptible(signed long timeout); 340extern signed long schedule_timeout_uninterruptible(signed long timeout);
341asmlinkage void __schedule(void);
334asmlinkage void schedule(void); 342asmlinkage void schedule(void);
343extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner);
335 344
336struct nsproxy; 345struct nsproxy;
337struct user_namespace; 346struct user_namespace;
@@ -389,8 +398,15 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
389 (mm)->hiwater_vm = (mm)->total_vm; \ 398 (mm)->hiwater_vm = (mm)->total_vm; \
390} while (0) 399} while (0)
391 400
392#define get_mm_hiwater_rss(mm) max((mm)->hiwater_rss, get_mm_rss(mm)) 401static inline unsigned long get_mm_hiwater_rss(struct mm_struct *mm)
393#define get_mm_hiwater_vm(mm) max((mm)->hiwater_vm, (mm)->total_vm) 402{
403 return max(mm->hiwater_rss, get_mm_rss(mm));
404}
405
406static inline unsigned long get_mm_hiwater_vm(struct mm_struct *mm)
407{
408 return max(mm->hiwater_vm, mm->total_vm);
409}
394 410
395extern void set_dumpable(struct mm_struct *mm, int value); 411extern void set_dumpable(struct mm_struct *mm, int value);
396extern int get_dumpable(struct mm_struct *mm); 412extern int get_dumpable(struct mm_struct *mm);
@@ -538,25 +554,8 @@ struct signal_struct {
538 554
539 struct list_head cpu_timers[3]; 555 struct list_head cpu_timers[3];
540 556
541 /* job control IDs */
542
543 /*
544 * pgrp and session fields are deprecated.
545 * use the task_session_Xnr and task_pgrp_Xnr routines below
546 */
547
548 union {
549 pid_t pgrp __deprecated;
550 pid_t __pgrp;
551 };
552
553 struct pid *tty_old_pgrp; 557 struct pid *tty_old_pgrp;
554 558
555 union {
556 pid_t session __deprecated;
557 pid_t __session;
558 };
559
560 /* boolean value for session group leader */ 559 /* boolean value for session group leader */
561 int leader; 560 int leader;
562 561
@@ -998,6 +997,7 @@ struct sched_class {
998 struct rq *busiest, struct sched_domain *sd, 997 struct rq *busiest, struct sched_domain *sd,
999 enum cpu_idle_type idle); 998 enum cpu_idle_type idle);
1000 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 999 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1000 int (*needs_post_schedule) (struct rq *this_rq);
1001 void (*post_schedule) (struct rq *this_rq); 1001 void (*post_schedule) (struct rq *this_rq);
1002 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); 1002 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task);
1003 1003
@@ -1052,6 +1052,10 @@ struct sched_entity {
1052 u64 last_wakeup; 1052 u64 last_wakeup;
1053 u64 avg_overlap; 1053 u64 avg_overlap;
1054 1054
1055 u64 start_runtime;
1056 u64 avg_wakeup;
1057 u64 nr_migrations;
1058
1055#ifdef CONFIG_SCHEDSTATS 1059#ifdef CONFIG_SCHEDSTATS
1056 u64 wait_start; 1060 u64 wait_start;
1057 u64 wait_max; 1061 u64 wait_max;
@@ -1067,7 +1071,6 @@ struct sched_entity {
1067 u64 exec_max; 1071 u64 exec_max;
1068 u64 slice_max; 1072 u64 slice_max;
1069 1073
1070 u64 nr_migrations;
1071 u64 nr_migrations_cold; 1074 u64 nr_migrations_cold;
1072 u64 nr_failed_migrations_affine; 1075 u64 nr_failed_migrations_affine;
1073 u64 nr_failed_migrations_running; 1076 u64 nr_failed_migrations_running;
@@ -1164,6 +1167,7 @@ struct task_struct {
1164#endif 1167#endif
1165 1168
1166 struct list_head tasks; 1169 struct list_head tasks;
1170 struct plist_node pushable_tasks;
1167 1171
1168 struct mm_struct *mm, *active_mm; 1172 struct mm_struct *mm, *active_mm;
1169 1173
@@ -1175,13 +1179,14 @@ struct task_struct {
1175 /* ??? */ 1179 /* ??? */
1176 unsigned int personality; 1180 unsigned int personality;
1177 unsigned did_exec:1; 1181 unsigned did_exec:1;
1182 unsigned in_execve:1; /* Tell the LSMs that the process is doing an
1183 * execve */
1178 pid_t pid; 1184 pid_t pid;
1179 pid_t tgid; 1185 pid_t tgid;
1180 1186
1181#ifdef CONFIG_CC_STACKPROTECTOR
1182 /* Canary value for the -fstack-protector gcc feature */ 1187 /* Canary value for the -fstack-protector gcc feature */
1183 unsigned long stack_canary; 1188 unsigned long stack_canary;
1184#endif 1189
1185 /* 1190 /*
1186 * pointers to (original) parent process, youngest child, younger sibling, 1191 * pointers to (original) parent process, youngest child, younger sibling,
1187 * older sibling, respectively. (p->father can be replaced with 1192 * older sibling, respectively. (p->father can be replaced with
@@ -1254,9 +1259,8 @@ struct task_struct {
1254/* ipc stuff */ 1259/* ipc stuff */
1255 struct sysv_sem sysvsem; 1260 struct sysv_sem sysvsem;
1256#endif 1261#endif
1257#ifdef CONFIG_DETECT_SOFTLOCKUP 1262#ifdef CONFIG_DETECT_HUNG_TASK
1258/* hung task detection */ 1263/* hung task detection */
1259 unsigned long last_switch_timestamp;
1260 unsigned long last_switch_count; 1264 unsigned long last_switch_count;
1261#endif 1265#endif
1262/* CPU-specific state of this task */ 1266/* CPU-specific state of this task */
@@ -1293,6 +1297,11 @@ struct task_struct {
1293/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 1297/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */
1294 spinlock_t alloc_lock; 1298 spinlock_t alloc_lock;
1295 1299
1300#ifdef CONFIG_GENERIC_HARDIRQS
1301 /* IRQ handler threads */
1302 struct irqaction *irqaction;
1303#endif
1304
1296 /* Protection of the PI data structures: */ 1305 /* Protection of the PI data structures: */
1297 spinlock_t pi_lock; 1306 spinlock_t pi_lock;
1298 1307
@@ -1328,6 +1337,7 @@ struct task_struct {
1328 int lockdep_depth; 1337 int lockdep_depth;
1329 unsigned int lockdep_recursion; 1338 unsigned int lockdep_recursion;
1330 struct held_lock held_locks[MAX_LOCK_DEPTH]; 1339 struct held_lock held_locks[MAX_LOCK_DEPTH];
1340 gfp_t lockdep_reclaim_gfp;
1331#endif 1341#endif
1332 1342
1333/* journalling filesystem info */ 1343/* journalling filesystem info */
@@ -1405,6 +1415,8 @@ struct task_struct {
1405 int curr_ret_stack; 1415 int curr_ret_stack;
1406 /* Stack of return addresses for return function tracing */ 1416 /* Stack of return addresses for return function tracing */
1407 struct ftrace_ret_stack *ret_stack; 1417 struct ftrace_ret_stack *ret_stack;
1418 /* time stamp for last schedule */
1419 unsigned long long ftrace_timestamp;
1408 /* 1420 /*
1409 * Number of functions that haven't been traced 1421 * Number of functions that haven't been traced
1410 * because of depth overrun. 1422 * because of depth overrun.
@@ -1419,6 +1431,9 @@ struct task_struct {
1419#endif 1431#endif
1420}; 1432};
1421 1433
1434/* Future-safe accessor for struct task_struct's cpus_allowed. */
1435#define tsk_cpumask(tsk) (&(tsk)->cpus_allowed)
1436
1422/* 1437/*
1423 * Priority of a process goes from 0..MAX_PRIO-1, valid RT 1438 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
1424 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH 1439 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
@@ -1450,16 +1465,6 @@ static inline int rt_task(struct task_struct *p)
1450 return rt_prio(p->prio); 1465 return rt_prio(p->prio);
1451} 1466}
1452 1467
1453static inline void set_task_session(struct task_struct *tsk, pid_t session)
1454{
1455 tsk->signal->__session = session;
1456}
1457
1458static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp)
1459{
1460 tsk->signal->__pgrp = pgrp;
1461}
1462
1463static inline struct pid *task_pid(struct task_struct *task) 1468static inline struct pid *task_pid(struct task_struct *task)
1464{ 1469{
1465 return task->pids[PIDTYPE_PID].pid; 1470 return task->pids[PIDTYPE_PID].pid;
@@ -1470,6 +1475,11 @@ static inline struct pid *task_tgid(struct task_struct *task)
1470 return task->group_leader->pids[PIDTYPE_PID].pid; 1475 return task->group_leader->pids[PIDTYPE_PID].pid;
1471} 1476}
1472 1477
1478/*
1479 * Without tasklist or rcu lock it is not safe to dereference
1480 * the result of task_pgrp/task_session even if task == current,
1481 * we can race with another thread doing sys_setsid/sys_setpgid.
1482 */
1473static inline struct pid *task_pgrp(struct task_struct *task) 1483static inline struct pid *task_pgrp(struct task_struct *task)
1474{ 1484{
1475 return task->group_leader->pids[PIDTYPE_PGID].pid; 1485 return task->group_leader->pids[PIDTYPE_PGID].pid;
@@ -1495,17 +1505,23 @@ struct pid_namespace;
1495 * 1505 *
1496 * see also pid_nr() etc in include/linux/pid.h 1506 * see also pid_nr() etc in include/linux/pid.h
1497 */ 1507 */
1508pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
1509 struct pid_namespace *ns);
1498 1510
1499static inline pid_t task_pid_nr(struct task_struct *tsk) 1511static inline pid_t task_pid_nr(struct task_struct *tsk)
1500{ 1512{
1501 return tsk->pid; 1513 return tsk->pid;
1502} 1514}
1503 1515
1504pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns); 1516static inline pid_t task_pid_nr_ns(struct task_struct *tsk,
1517 struct pid_namespace *ns)
1518{
1519 return __task_pid_nr_ns(tsk, PIDTYPE_PID, ns);
1520}
1505 1521
1506static inline pid_t task_pid_vnr(struct task_struct *tsk) 1522static inline pid_t task_pid_vnr(struct task_struct *tsk)
1507{ 1523{
1508 return pid_vnr(task_pid(tsk)); 1524 return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
1509} 1525}
1510 1526
1511 1527
@@ -1522,31 +1538,34 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1522} 1538}
1523 1539
1524 1540
1525static inline pid_t task_pgrp_nr(struct task_struct *tsk) 1541static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk,
1542 struct pid_namespace *ns)
1526{ 1543{
1527 return tsk->signal->__pgrp; 1544 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns);
1528} 1545}
1529 1546
1530pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1531
1532static inline pid_t task_pgrp_vnr(struct task_struct *tsk) 1547static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
1533{ 1548{
1534 return pid_vnr(task_pgrp(tsk)); 1549 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, NULL);
1535} 1550}
1536 1551
1537 1552
1538static inline pid_t task_session_nr(struct task_struct *tsk) 1553static inline pid_t task_session_nr_ns(struct task_struct *tsk,
1554 struct pid_namespace *ns)
1539{ 1555{
1540 return tsk->signal->__session; 1556 return __task_pid_nr_ns(tsk, PIDTYPE_SID, ns);
1541} 1557}
1542 1558
1543pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1544
1545static inline pid_t task_session_vnr(struct task_struct *tsk) 1559static inline pid_t task_session_vnr(struct task_struct *tsk)
1546{ 1560{
1547 return pid_vnr(task_session(tsk)); 1561 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
1548} 1562}
1549 1563
1564/* obsolete, do not use */
1565static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1566{
1567 return task_pgrp_nr_ns(tsk, &init_pid_ns);
1568}
1550 1569
1551/** 1570/**
1552 * pid_alive - check that a task structure is not stale 1571 * pid_alive - check that a task structure is not stale
@@ -1670,6 +1689,16 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1670 return set_cpus_allowed_ptr(p, &new_mask); 1689 return set_cpus_allowed_ptr(p, &new_mask);
1671} 1690}
1672 1691
1692/*
1693 * Architectures can set this to 1 if they have specified
1694 * CONFIG_HAVE_UNSTABLE_SCHED_CLOCK in their arch Kconfig,
1695 * but then during bootup it turns out that sched_clock()
1696 * is reliable after all:
1697 */
1698#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
1699extern int sched_clock_stable;
1700#endif
1701
1673extern unsigned long long sched_clock(void); 1702extern unsigned long long sched_clock(void);
1674 1703
1675extern void sched_clock_init(void); 1704extern void sched_clock_init(void);
@@ -1946,7 +1975,8 @@ extern void mm_release(struct task_struct *, struct mm_struct *);
1946/* Allocate a new mm structure and copy contents from tsk->mm */ 1975/* Allocate a new mm structure and copy contents from tsk->mm */
1947extern struct mm_struct *dup_mm(struct task_struct *tsk); 1976extern struct mm_struct *dup_mm(struct task_struct *tsk);
1948 1977
1949extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); 1978extern int copy_thread(unsigned long, unsigned long, unsigned long,
1979 struct task_struct *, struct pt_regs *);
1950extern void flush_thread(void); 1980extern void flush_thread(void);
1951extern void exit_thread(void); 1981extern void exit_thread(void);
1952 1982
@@ -2031,6 +2061,11 @@ static inline int thread_group_empty(struct task_struct *p)
2031#define delay_group_leader(p) \ 2061#define delay_group_leader(p) \
2032 (thread_group_leader(p) && !thread_group_empty(p)) 2062 (thread_group_leader(p) && !thread_group_empty(p))
2033 2063
2064static inline int task_detached(struct task_struct *p)
2065{
2066 return p->exit_signal == -1;
2067}
2068
2034/* 2069/*
2035 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring 2070 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
2036 * subscriptions and synchronises with wait4(). Also used in procfs. Also 2071 * subscriptions and synchronises with wait4(). Also used in procfs. Also
@@ -2087,6 +2122,19 @@ static inline int object_is_on_stack(void *obj)
2087 2122
2088extern void thread_info_cache_init(void); 2123extern void thread_info_cache_init(void);
2089 2124
2125#ifdef CONFIG_DEBUG_STACK_USAGE
2126static inline unsigned long stack_not_used(struct task_struct *p)
2127{
2128 unsigned long *n = end_of_stack(p);
2129
2130 do { /* Skip over canary */
2131 n++;
2132 } while (!*n);
2133
2134 return (unsigned long)n - (unsigned long)end_of_stack(p);
2135}
2136#endif
2137
2090/* set thread flags in other task's structures 2138/* set thread flags in other task's structures
2091 * - see asm/thread_info.h for TIF_xxxx flags available 2139 * - see asm/thread_info.h for TIF_xxxx flags available
2092 */ 2140 */
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 8ba1c320f975..c2731bfe04d8 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -60,7 +60,7 @@ typedef struct sctphdr {
60 __be16 source; 60 __be16 source;
61 __be16 dest; 61 __be16 dest;
62 __be32 vtag; 62 __be32 vtag;
63 __be32 checksum; 63 __le32 checksum;
64} __attribute__((packed)) sctp_sctphdr_t; 64} __attribute__((packed)) sctp_sctphdr_t;
65 65
66#ifdef __KERNEL__ 66#ifdef __KERNEL__
@@ -172,35 +172,35 @@ typedef struct sctp_paramhdr {
172typedef enum { 172typedef enum {
173 173
174 /* RFC 2960 Section 3.3.5 */ 174 /* RFC 2960 Section 3.3.5 */
175 SCTP_PARAM_HEARTBEAT_INFO = __constant_htons(1), 175 SCTP_PARAM_HEARTBEAT_INFO = cpu_to_be16(1),
176 /* RFC 2960 Section 3.3.2.1 */ 176 /* RFC 2960 Section 3.3.2.1 */
177 SCTP_PARAM_IPV4_ADDRESS = __constant_htons(5), 177 SCTP_PARAM_IPV4_ADDRESS = cpu_to_be16(5),
178 SCTP_PARAM_IPV6_ADDRESS = __constant_htons(6), 178 SCTP_PARAM_IPV6_ADDRESS = cpu_to_be16(6),
179 SCTP_PARAM_STATE_COOKIE = __constant_htons(7), 179 SCTP_PARAM_STATE_COOKIE = cpu_to_be16(7),
180 SCTP_PARAM_UNRECOGNIZED_PARAMETERS = __constant_htons(8), 180 SCTP_PARAM_UNRECOGNIZED_PARAMETERS = cpu_to_be16(8),
181 SCTP_PARAM_COOKIE_PRESERVATIVE = __constant_htons(9), 181 SCTP_PARAM_COOKIE_PRESERVATIVE = cpu_to_be16(9),
182 SCTP_PARAM_HOST_NAME_ADDRESS = __constant_htons(11), 182 SCTP_PARAM_HOST_NAME_ADDRESS = cpu_to_be16(11),
183 SCTP_PARAM_SUPPORTED_ADDRESS_TYPES = __constant_htons(12), 183 SCTP_PARAM_SUPPORTED_ADDRESS_TYPES = cpu_to_be16(12),
184 SCTP_PARAM_ECN_CAPABLE = __constant_htons(0x8000), 184 SCTP_PARAM_ECN_CAPABLE = cpu_to_be16(0x8000),
185 185
186 /* AUTH Extension Section 3 */ 186 /* AUTH Extension Section 3 */
187 SCTP_PARAM_RANDOM = __constant_htons(0x8002), 187 SCTP_PARAM_RANDOM = cpu_to_be16(0x8002),
188 SCTP_PARAM_CHUNKS = __constant_htons(0x8003), 188 SCTP_PARAM_CHUNKS = cpu_to_be16(0x8003),
189 SCTP_PARAM_HMAC_ALGO = __constant_htons(0x8004), 189 SCTP_PARAM_HMAC_ALGO = cpu_to_be16(0x8004),
190 190
191 /* Add-IP: Supported Extensions, Section 4.2 */ 191 /* Add-IP: Supported Extensions, Section 4.2 */
192 SCTP_PARAM_SUPPORTED_EXT = __constant_htons(0x8008), 192 SCTP_PARAM_SUPPORTED_EXT = cpu_to_be16(0x8008),
193 193
194 /* PR-SCTP Sec 3.1 */ 194 /* PR-SCTP Sec 3.1 */
195 SCTP_PARAM_FWD_TSN_SUPPORT = __constant_htons(0xc000), 195 SCTP_PARAM_FWD_TSN_SUPPORT = cpu_to_be16(0xc000),
196 196
197 /* Add-IP Extension. Section 3.2 */ 197 /* Add-IP Extension. Section 3.2 */
198 SCTP_PARAM_ADD_IP = __constant_htons(0xc001), 198 SCTP_PARAM_ADD_IP = cpu_to_be16(0xc001),
199 SCTP_PARAM_DEL_IP = __constant_htons(0xc002), 199 SCTP_PARAM_DEL_IP = cpu_to_be16(0xc002),
200 SCTP_PARAM_ERR_CAUSE = __constant_htons(0xc003), 200 SCTP_PARAM_ERR_CAUSE = cpu_to_be16(0xc003),
201 SCTP_PARAM_SET_PRIMARY = __constant_htons(0xc004), 201 SCTP_PARAM_SET_PRIMARY = cpu_to_be16(0xc004),
202 SCTP_PARAM_SUCCESS_REPORT = __constant_htons(0xc005), 202 SCTP_PARAM_SUCCESS_REPORT = cpu_to_be16(0xc005),
203 SCTP_PARAM_ADAPTATION_LAYER_IND = __constant_htons(0xc006), 203 SCTP_PARAM_ADAPTATION_LAYER_IND = cpu_to_be16(0xc006),
204 204
205} sctp_param_t; /* enum */ 205} sctp_param_t; /* enum */
206 206
@@ -212,13 +212,13 @@ typedef enum {
212 * 212 *
213 */ 213 */
214typedef enum { 214typedef enum {
215 SCTP_PARAM_ACTION_DISCARD = __constant_htons(0x0000), 215 SCTP_PARAM_ACTION_DISCARD = cpu_to_be16(0x0000),
216 SCTP_PARAM_ACTION_DISCARD_ERR = __constant_htons(0x4000), 216 SCTP_PARAM_ACTION_DISCARD_ERR = cpu_to_be16(0x4000),
217 SCTP_PARAM_ACTION_SKIP = __constant_htons(0x8000), 217 SCTP_PARAM_ACTION_SKIP = cpu_to_be16(0x8000),
218 SCTP_PARAM_ACTION_SKIP_ERR = __constant_htons(0xc000), 218 SCTP_PARAM_ACTION_SKIP_ERR = cpu_to_be16(0xc000),
219} sctp_param_action_t; 219} sctp_param_action_t;
220 220
221enum { SCTP_PARAM_ACTION_MASK = __constant_htons(0xc000), }; 221enum { SCTP_PARAM_ACTION_MASK = cpu_to_be16(0xc000), };
222 222
223/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */ 223/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
224 224
@@ -457,17 +457,17 @@ typedef struct sctp_operr_chunk {
457 */ 457 */
458typedef enum { 458typedef enum {
459 459
460 SCTP_ERROR_NO_ERROR = __constant_htons(0x00), 460 SCTP_ERROR_NO_ERROR = cpu_to_be16(0x00),
461 SCTP_ERROR_INV_STRM = __constant_htons(0x01), 461 SCTP_ERROR_INV_STRM = cpu_to_be16(0x01),
462 SCTP_ERROR_MISS_PARAM = __constant_htons(0x02), 462 SCTP_ERROR_MISS_PARAM = cpu_to_be16(0x02),
463 SCTP_ERROR_STALE_COOKIE = __constant_htons(0x03), 463 SCTP_ERROR_STALE_COOKIE = cpu_to_be16(0x03),
464 SCTP_ERROR_NO_RESOURCE = __constant_htons(0x04), 464 SCTP_ERROR_NO_RESOURCE = cpu_to_be16(0x04),
465 SCTP_ERROR_DNS_FAILED = __constant_htons(0x05), 465 SCTP_ERROR_DNS_FAILED = cpu_to_be16(0x05),
466 SCTP_ERROR_UNKNOWN_CHUNK = __constant_htons(0x06), 466 SCTP_ERROR_UNKNOWN_CHUNK = cpu_to_be16(0x06),
467 SCTP_ERROR_INV_PARAM = __constant_htons(0x07), 467 SCTP_ERROR_INV_PARAM = cpu_to_be16(0x07),
468 SCTP_ERROR_UNKNOWN_PARAM = __constant_htons(0x08), 468 SCTP_ERROR_UNKNOWN_PARAM = cpu_to_be16(0x08),
469 SCTP_ERROR_NO_DATA = __constant_htons(0x09), 469 SCTP_ERROR_NO_DATA = cpu_to_be16(0x09),
470 SCTP_ERROR_COOKIE_IN_SHUTDOWN = __constant_htons(0x0a), 470 SCTP_ERROR_COOKIE_IN_SHUTDOWN = cpu_to_be16(0x0a),
471 471
472 472
473 /* SCTP Implementation Guide: 473 /* SCTP Implementation Guide:
@@ -476,9 +476,9 @@ typedef enum {
476 * 13 Protocol Violation 476 * 13 Protocol Violation
477 */ 477 */
478 478
479 SCTP_ERROR_RESTART = __constant_htons(0x0b), 479 SCTP_ERROR_RESTART = cpu_to_be16(0x0b),
480 SCTP_ERROR_USER_ABORT = __constant_htons(0x0c), 480 SCTP_ERROR_USER_ABORT = cpu_to_be16(0x0c),
481 SCTP_ERROR_PROTO_VIOLATION = __constant_htons(0x0d), 481 SCTP_ERROR_PROTO_VIOLATION = cpu_to_be16(0x0d),
482 482
483 /* ADDIP Section 3.3 New Error Causes 483 /* ADDIP Section 3.3 New Error Causes
484 * 484 *
@@ -493,11 +493,11 @@ typedef enum {
493 * 0x0103 Association Aborted due to illegal ASCONF-ACK 493 * 0x0103 Association Aborted due to illegal ASCONF-ACK
494 * 0x0104 Request refused - no authorization. 494 * 0x0104 Request refused - no authorization.
495 */ 495 */
496 SCTP_ERROR_DEL_LAST_IP = __constant_htons(0x0100), 496 SCTP_ERROR_DEL_LAST_IP = cpu_to_be16(0x0100),
497 SCTP_ERROR_RSRC_LOW = __constant_htons(0x0101), 497 SCTP_ERROR_RSRC_LOW = cpu_to_be16(0x0101),
498 SCTP_ERROR_DEL_SRC_IP = __constant_htons(0x0102), 498 SCTP_ERROR_DEL_SRC_IP = cpu_to_be16(0x0102),
499 SCTP_ERROR_ASCONF_ACK = __constant_htons(0x0103), 499 SCTP_ERROR_ASCONF_ACK = cpu_to_be16(0x0103),
500 SCTP_ERROR_REQ_REFUSED = __constant_htons(0x0104), 500 SCTP_ERROR_REQ_REFUSED = cpu_to_be16(0x0104),
501 501
502 /* AUTH Section 4. New Error Cause 502 /* AUTH Section 4. New Error Cause
503 * 503 *
@@ -509,7 +509,7 @@ typedef enum {
509 * -------------------------------------------------------------- 509 * --------------------------------------------------------------
510 * 0x0105 Unsupported HMAC Identifier 510 * 0x0105 Unsupported HMAC Identifier
511 */ 511 */
512 SCTP_ERROR_UNSUP_HMAC = __constant_htons(0x0105) 512 SCTP_ERROR_UNSUP_HMAC = cpu_to_be16(0x0105)
513} sctp_error_t; 513} sctp_error_t;
514 514
515 515
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 262a8dccfa81..167c33361d9c 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -21,6 +21,8 @@ extern long prctl_set_seccomp(unsigned long);
21 21
22#else /* CONFIG_SECCOMP */ 22#else /* CONFIG_SECCOMP */
23 23
24#include <linux/errno.h>
25
24typedef struct { } seccomp_t; 26typedef struct { } seccomp_t;
25 27
26#define secure_computing(x) do { } while (0) 28#define secure_computing(x) do { } while (0)
diff --git a/include/linux/section-names.h b/include/linux/section-names.h
new file mode 100644
index 000000000000..c956f4eb2adf
--- /dev/null
+++ b/include/linux/section-names.h
@@ -0,0 +1,6 @@
1#ifndef __LINUX_SECTION_NAMES_H
2#define __LINUX_SECTION_NAMES_H
3
4#define HEAD_TEXT_SECTION .head.text
5
6#endif /* !__LINUX_SECTION_NAMES_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 1f2ab6353c00..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 */
@@ -880,11 +881,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
880 * @sock contains the listening socket structure. 881 * @sock contains the listening socket structure.
881 * @newsock contains the newly created server socket for connection. 882 * @newsock contains the newly created server socket for connection.
882 * Return 0 if permission is granted. 883 * Return 0 if permission is granted.
883 * @socket_post_accept:
884 * This hook allows a security module to copy security
885 * information into the newly created socket's inode.
886 * @sock contains the listening socket structure.
887 * @newsock contains the newly created server socket for connection.
888 * @socket_sendmsg: 884 * @socket_sendmsg:
889 * Check permission before transmitting a message to another socket. 885 * Check permission before transmitting a message to another socket.
890 * @sock contains the socket structure. 886 * @sock contains the socket structure.
@@ -1554,8 +1550,6 @@ struct security_operations {
1554 struct sockaddr *address, int addrlen); 1550 struct sockaddr *address, int addrlen);
1555 int (*socket_listen) (struct socket *sock, int backlog); 1551 int (*socket_listen) (struct socket *sock, int backlog);
1556 int (*socket_accept) (struct socket *sock, struct socket *newsock); 1552 int (*socket_accept) (struct socket *sock, struct socket *newsock);
1557 void (*socket_post_accept) (struct socket *sock,
1558 struct socket *newsock);
1559 int (*socket_sendmsg) (struct socket *sock, 1553 int (*socket_sendmsg) (struct socket *sock,
1560 struct msghdr *msg, int size); 1554 struct msghdr *msg, int size);
1561 int (*socket_recvmsg) (struct socket *sock, 1555 int (*socket_recvmsg) (struct socket *sock,
@@ -2537,7 +2531,6 @@ int security_socket_bind(struct socket *sock, struct sockaddr *address, int addr
2537int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen); 2531int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen);
2538int security_socket_listen(struct socket *sock, int backlog); 2532int security_socket_listen(struct socket *sock, int backlog);
2539int security_socket_accept(struct socket *sock, struct socket *newsock); 2533int security_socket_accept(struct socket *sock, struct socket *newsock);
2540void security_socket_post_accept(struct socket *sock, struct socket *newsock);
2541int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size); 2534int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size);
2542int security_socket_recvmsg(struct socket *sock, struct msghdr *msg, 2535int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
2543 int size, int flags); 2536 int size, int flags);
@@ -2616,11 +2609,6 @@ static inline int security_socket_accept(struct socket *sock,
2616 return 0; 2609 return 0;
2617} 2610}
2618 2611
2619static inline void security_socket_post_accept(struct socket *sock,
2620 struct socket *newsock)
2621{
2622}
2623
2624static inline int security_socket_sendmsg(struct socket *sock, 2612static inline int security_socket_sendmsg(struct socket *sock,
2625 struct msghdr *msg, int size) 2613 struct msghdr *msg, int size)
2626{ 2614{
@@ -2966,5 +2954,28 @@ static inline void securityfs_remove(struct dentry *dentry)
2966 2954
2967#endif 2955#endif
2968 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
2969#endif /* ! __LINUX_SECURITY_H */ 2980#endif /* ! __LINUX_SECURITY_H */
2970 2981
diff --git a/include/linux/selinux_netlink.h b/include/linux/selinux_netlink.h
index bbf489decd84..d239797785cf 100644
--- a/include/linux/selinux_netlink.h
+++ b/include/linux/selinux_netlink.h
@@ -12,6 +12,8 @@
12#ifndef _LINUX_SELINUX_NETLINK_H 12#ifndef _LINUX_SELINUX_NETLINK_H
13#define _LINUX_SELINUX_NETLINK_H 13#define _LINUX_SELINUX_NETLINK_H
14 14
15#include <linux/types.h>
16
15/* Message types. */ 17/* Message types. */
16#define SELNL_MSG_BASE 0x10 18#define SELNL_MSG_BASE 0x10
17enum { 19enum {
@@ -38,11 +40,11 @@ enum selinux_nlgroups {
38 40
39/* Message structures */ 41/* Message structures */
40struct selnl_msg_setenforce { 42struct selnl_msg_setenforce {
41 int32_t val; 43 __s32 val;
42}; 44};
43 45
44struct selnl_msg_policyload { 46struct selnl_msg_policyload {
45 u_int32_t seqno; 47 __u32 seqno;
46}; 48};
47 49
48#endif /* _LINUX_SELINUX_NETLINK_H */ 50#endif /* _LINUX_SELINUX_NETLINK_H */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index f616f31576d7..004f3b3342c5 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -55,7 +55,7 @@ int seq_bitmap(struct seq_file *m, const unsigned long *bits,
55 unsigned int nr_bits); 55 unsigned int nr_bits);
56static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask) 56static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask)
57{ 57{
58 return seq_bitmap(m, mask->bits, nr_cpu_ids); 58 return seq_bitmap(m, cpumask_bits(mask), nr_cpu_ids);
59} 59}
60 60
61static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask) 61static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
@@ -63,12 +63,13 @@ static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
63 return seq_bitmap(m, mask->bits, MAX_NUMNODES); 63 return seq_bitmap(m, mask->bits, MAX_NUMNODES);
64} 64}
65 65
66int seq_bitmap_list(struct seq_file *m, unsigned long *bits, 66int seq_bitmap_list(struct seq_file *m, const unsigned long *bits,
67 unsigned int nr_bits); 67 unsigned int nr_bits);
68 68
69static inline int seq_cpumask_list(struct seq_file *m, cpumask_t *mask) 69static inline int seq_cpumask_list(struct seq_file *m,
70 const struct cpumask *mask)
70{ 71{
71 return seq_bitmap_list(m, mask->bits, NR_CPUS); 72 return seq_bitmap_list(m, cpumask_bits(mask), nr_cpu_ids);
72} 73}
73 74
74static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask) 75static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask)
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/serio.h b/include/linux/serio.h
index 1bcb357a01a1..e0417e4d3f15 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -212,7 +212,7 @@ static inline void serio_unpin_driver(struct serio *serio)
212#define SERIO_FUJITSU 0x35 212#define SERIO_FUJITSU 0x35
213#define SERIO_ZHENHUA 0x36 213#define SERIO_ZHENHUA 0x36
214#define SERIO_INEXIO 0x37 214#define SERIO_INEXIO 0x37
215#define SERIO_TOUCHIT213 0x37 215#define SERIO_TOUCHIT213 0x38
216#define SERIO_W8001 0x39 216#define SERIO_W8001 0x39
217 217
218#endif 218#endif
diff --git a/include/linux/sh_cmt.h b/include/linux/sh_cmt.h
new file mode 100644
index 000000000000..68cacde5954f
--- /dev/null
+++ b/include/linux/sh_cmt.h
@@ -0,0 +1,13 @@
1#ifndef __SH_CMT_H__
2#define __SH_CMT_H__
3
4struct sh_cmt_config {
5 char *name;
6 unsigned long channel_offset;
7 int timer_bit;
8 char *clk;
9 unsigned long clockevent_rating;
10 unsigned long clocksource_rating;
11};
12
13#endif /* __SH_CMT_H__ */
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 68e212ff9dde..eb1423a0078d 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -85,6 +85,7 @@ struct intc_desc symbol __initdata = { \
85} 85}
86#endif 86#endif
87 87
88unsigned int intc_evt2irq(unsigned int vector);
88void __init register_intc_controller(struct intc_desc *desc); 89void __init register_intc_controller(struct intc_desc *desc);
89int intc_set_priority(unsigned int irq, unsigned int prio); 90int intc_set_priority(unsigned int irq, unsigned int prio);
90 91
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/skbuff.h b/include/linux/skbuff.h
index 9dcf956ad18a..5fd389162f01 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -29,9 +29,6 @@
29#include <linux/dmaengine.h> 29#include <linux/dmaengine.h>
30#include <linux/hrtimer.h> 30#include <linux/hrtimer.h>
31 31
32#define HAVE_ALLOC_SKB /* For the drivers to know */
33#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
34
35/* Don't change this without changing skb_csum_unnecessary! */ 32/* Don't change this without changing skb_csum_unnecessary! */
36#define CHECKSUM_NONE 0 33#define CHECKSUM_NONE 0
37#define CHECKSUM_UNNECESSARY 1 34#define CHECKSUM_UNNECESSARY 1
@@ -135,6 +132,56 @@ struct skb_frag_struct {
135 __u32 size; 132 __u32 size;
136}; 133};
137 134
135#define HAVE_HW_TIME_STAMP
136
137/**
138 * struct skb_shared_hwtstamps - hardware time stamps
139 * @hwtstamp: hardware time stamp transformed into duration
140 * since arbitrary point in time
141 * @syststamp: hwtstamp transformed to system time base
142 *
143 * Software time stamps generated by ktime_get_real() are stored in
144 * skb->tstamp. The relation between the different kinds of time
145 * stamps is as follows:
146 *
147 * syststamp and tstamp can be compared against each other in
148 * arbitrary combinations. The accuracy of a
149 * syststamp/tstamp/"syststamp from other device" comparison is
150 * limited by the accuracy of the transformation into system time
151 * base. This depends on the device driver and its underlying
152 * hardware.
153 *
154 * hwtstamps can only be compared against other hwtstamps from
155 * the same device.
156 *
157 * This structure is attached to packets as part of the
158 * &skb_shared_info. Use skb_hwtstamps() to get a pointer.
159 */
160struct skb_shared_hwtstamps {
161 ktime_t hwtstamp;
162 ktime_t syststamp;
163};
164
165/**
166 * struct skb_shared_tx - instructions for time stamping of outgoing packets
167 * @hardware: generate hardware time stamp
168 * @software: generate software time stamp
169 * @in_progress: device driver is going to provide
170 * hardware time stamp
171 * @flags: all shared_tx flags
172 *
173 * These flags are attached to packets as part of the
174 * &skb_shared_info. Use skb_tx() to get a pointer.
175 */
176union skb_shared_tx {
177 struct {
178 __u8 hardware:1,
179 software:1,
180 in_progress:1;
181 };
182 __u8 flags;
183};
184
138/* This data is invariant across clones and lives at 185/* This data is invariant across clones and lives at
139 * the end of the header data, ie. at skb->end. 186 * the end of the header data, ie. at skb->end.
140 */ 187 */
@@ -146,10 +193,12 @@ struct skb_shared_info {
146 unsigned short gso_segs; 193 unsigned short gso_segs;
147 unsigned short gso_type; 194 unsigned short gso_type;
148 __be32 ip6_frag_id; 195 __be32 ip6_frag_id;
196 union skb_shared_tx tx_flags;
149#ifdef CONFIG_HAS_DMA 197#ifdef CONFIG_HAS_DMA
150 unsigned int num_dma_maps; 198 unsigned int num_dma_maps;
151#endif 199#endif
152 struct sk_buff *frag_list; 200 struct sk_buff *frag_list;
201 struct skb_shared_hwtstamps hwtstamps;
153 skb_frag_t frags[MAX_SKB_FRAGS]; 202 skb_frag_t frags[MAX_SKB_FRAGS];
154#ifdef CONFIG_HAS_DMA 203#ifdef CONFIG_HAS_DMA
155 dma_addr_t dma_maps[MAX_SKB_FRAGS + 1]; 204 dma_addr_t dma_maps[MAX_SKB_FRAGS + 1];
@@ -188,6 +237,8 @@ enum {
188 SKB_GSO_TCP_ECN = 1 << 3, 237 SKB_GSO_TCP_ECN = 1 << 3,
189 238
190 SKB_GSO_TCPV6 = 1 << 4, 239 SKB_GSO_TCPV6 = 1 << 4,
240
241 SKB_GSO_FCOE = 1 << 5,
191}; 242};
192 243
193#if BITS_PER_LONG > 32 244#if BITS_PER_LONG > 32
@@ -373,6 +424,7 @@ extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb,
373#endif 424#endif
374 425
375extern void kfree_skb(struct sk_buff *skb); 426extern void kfree_skb(struct sk_buff *skb);
427extern void consume_skb(struct sk_buff *skb);
376extern void __kfree_skb(struct sk_buff *skb); 428extern void __kfree_skb(struct sk_buff *skb);
377extern struct sk_buff *__alloc_skb(unsigned int size, 429extern struct sk_buff *__alloc_skb(unsigned int size,
378 gfp_t priority, int fclone, int node); 430 gfp_t priority, int fclone, int node);
@@ -411,7 +463,8 @@ extern int skb_to_sgvec(struct sk_buff *skb,
411extern int skb_cow_data(struct sk_buff *skb, int tailbits, 463extern int skb_cow_data(struct sk_buff *skb, int tailbits,
412 struct sk_buff **trailer); 464 struct sk_buff **trailer);
413extern int skb_pad(struct sk_buff *skb, int pad); 465extern int skb_pad(struct sk_buff *skb, int pad);
414#define dev_kfree_skb(a) kfree_skb(a) 466#define dev_kfree_skb(a) consume_skb(a)
467#define dev_consume_skb(a) kfree_skb_clean(a)
415extern void skb_over_panic(struct sk_buff *skb, int len, 468extern void skb_over_panic(struct sk_buff *skb, int len,
416 void *here); 469 void *here);
417extern void skb_under_panic(struct sk_buff *skb, int len, 470extern void skb_under_panic(struct sk_buff *skb, int len,
@@ -459,6 +512,16 @@ static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
459/* Internal */ 512/* Internal */
460#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB))) 513#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB)))
461 514
515static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb)
516{
517 return &skb_shinfo(skb)->hwtstamps;
518}
519
520static inline union skb_shared_tx *skb_tx(struct sk_buff *skb)
521{
522 return &skb_shinfo(skb)->tx_flags;
523}
524
462/** 525/**
463 * skb_queue_empty - check if a queue is empty 526 * skb_queue_empty - check if a queue is empty
464 * @list: queue head 527 * @list: queue head
@@ -1278,7 +1341,7 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1278 * The networking layer reserves some headroom in skb data (via 1341 * The networking layer reserves some headroom in skb data (via
1279 * dev_alloc_skb). This is used to avoid having to reallocate skb data when 1342 * dev_alloc_skb). This is used to avoid having to reallocate skb data when
1280 * the header has to grow. In the default case, if the header has to grow 1343 * the header has to grow. In the default case, if the header has to grow
1281 * 16 bytes or less we avoid the reallocation. 1344 * 32 bytes or less we avoid the reallocation.
1282 * 1345 *
1283 * Unfortunately this headroom changes the DMA alignment of the resulting 1346 * Unfortunately this headroom changes the DMA alignment of the resulting
1284 * network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive 1347 * network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive
@@ -1286,11 +1349,11 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1286 * perhaps setting it to a cacheline in size (since that will maintain 1349 * perhaps setting it to a cacheline in size (since that will maintain
1287 * cacheline alignment of the DMA). It must be a power of 2. 1350 * cacheline alignment of the DMA). It must be a power of 2.
1288 * 1351 *
1289 * Various parts of the networking layer expect at least 16 bytes of 1352 * Various parts of the networking layer expect at least 32 bytes of
1290 * headroom, you should not reduce this. 1353 * headroom, you should not reduce this.
1291 */ 1354 */
1292#ifndef NET_SKB_PAD 1355#ifndef NET_SKB_PAD
1293#define NET_SKB_PAD 16 1356#define NET_SKB_PAD 32
1294#endif 1357#endif
1295 1358
1296extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); 1359extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
@@ -1678,8 +1741,6 @@ extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
1678 int shiftlen); 1741 int shiftlen);
1679 1742
1680extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); 1743extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
1681extern int skb_gro_receive(struct sk_buff **head,
1682 struct sk_buff *skb);
1683 1744
1684static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1745static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1685 int len, void *buffer) 1746 int len, void *buffer)
@@ -1726,6 +1787,11 @@ static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
1726 1787
1727extern void skb_init(void); 1788extern void skb_init(void);
1728 1789
1790static inline ktime_t skb_get_ktime(const struct sk_buff *skb)
1791{
1792 return skb->tstamp;
1793}
1794
1729/** 1795/**
1730 * skb_get_timestamp - get timestamp from a skb 1796 * skb_get_timestamp - get timestamp from a skb
1731 * @skb: skb to get stamp from 1797 * @skb: skb to get stamp from
@@ -1735,11 +1801,18 @@ extern void skb_init(void);
1735 * This function converts the offset back to a struct timeval and stores 1801 * This function converts the offset back to a struct timeval and stores
1736 * it in stamp. 1802 * it in stamp.
1737 */ 1803 */
1738static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp) 1804static inline void skb_get_timestamp(const struct sk_buff *skb,
1805 struct timeval *stamp)
1739{ 1806{
1740 *stamp = ktime_to_timeval(skb->tstamp); 1807 *stamp = ktime_to_timeval(skb->tstamp);
1741} 1808}
1742 1809
1810static inline void skb_get_timestampns(const struct sk_buff *skb,
1811 struct timespec *stamp)
1812{
1813 *stamp = ktime_to_timespec(skb->tstamp);
1814}
1815
1743static inline void __net_timestamp(struct sk_buff *skb) 1816static inline void __net_timestamp(struct sk_buff *skb)
1744{ 1817{
1745 skb->tstamp = ktime_get_real(); 1818 skb->tstamp = ktime_get_real();
@@ -1755,6 +1828,20 @@ static inline ktime_t net_invalid_timestamp(void)
1755 return ktime_set(0, 0); 1828 return ktime_set(0, 0);
1756} 1829}
1757 1830
1831/**
1832 * skb_tstamp_tx - queue clone of skb with send time stamps
1833 * @orig_skb: the original outgoing packet
1834 * @hwtstamps: hardware time stamps, may be NULL if not available
1835 *
1836 * If the skb has a socket associated, then this function clones the
1837 * skb (thus sharing the actual data and optional structures), stores
1838 * the optional hardware time stamping information (if non NULL) or
1839 * generates a software time stamp (otherwise), then queues the clone
1840 * to the error queue of the socket. Errors are silently ignored.
1841 */
1842extern void skb_tstamp_tx(struct sk_buff *orig_skb,
1843 struct skb_shared_hwtstamps *hwtstamps);
1844
1758extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 1845extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1759extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 1846extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1760 1847
@@ -1885,7 +1972,7 @@ static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping)
1885 skb->queue_mapping = queue_mapping; 1972 skb->queue_mapping = queue_mapping;
1886} 1973}
1887 1974
1888static inline u16 skb_get_queue_mapping(struct sk_buff *skb) 1975static inline u16 skb_get_queue_mapping(const struct sk_buff *skb)
1889{ 1976{
1890 return skb->queue_mapping; 1977 return skb->queue_mapping;
1891} 1978}
@@ -1895,6 +1982,24 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu
1895 to->queue_mapping = from->queue_mapping; 1982 to->queue_mapping = from->queue_mapping;
1896} 1983}
1897 1984
1985static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue)
1986{
1987 skb->queue_mapping = rx_queue + 1;
1988}
1989
1990static inline u16 skb_get_rx_queue(const struct sk_buff *skb)
1991{
1992 return skb->queue_mapping - 1;
1993}
1994
1995static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)
1996{
1997 return (skb->queue_mapping != 0);
1998}
1999
2000extern u16 skb_tx_hash(const struct net_device *dev,
2001 const struct sk_buff *skb);
2002
1898#ifdef CONFIG_XFRM 2003#ifdef CONFIG_XFRM
1899static inline struct sec_path *skb_sec_path(struct sk_buff *skb) 2004static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
1900{ 2005{
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 6ca6a7b66d75..5ac9b0bcaf9a 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -14,6 +14,7 @@
14#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ 14#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */
15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ 15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <trace/kmemtrace.h>
17 18
18/* Size description struct for general caches. */ 19/* Size description struct for general caches. */
19struct cache_sizes { 20struct cache_sizes {
@@ -28,8 +29,26 @@ extern struct cache_sizes malloc_sizes[];
28void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 29void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
29void *__kmalloc(size_t size, gfp_t flags); 30void *__kmalloc(size_t size, gfp_t flags);
30 31
31static inline void *kmalloc(size_t size, gfp_t flags) 32#ifdef CONFIG_KMEMTRACE
33extern void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags);
34extern size_t slab_buffer_size(struct kmem_cache *cachep);
35#else
36static __always_inline void *
37kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags)
32{ 38{
39 return kmem_cache_alloc(cachep, flags);
40}
41static inline size_t slab_buffer_size(struct kmem_cache *cachep)
42{
43 return 0;
44}
45#endif
46
47static __always_inline void *kmalloc(size_t size, gfp_t flags)
48{
49 struct kmem_cache *cachep;
50 void *ret;
51
33 if (__builtin_constant_p(size)) { 52 if (__builtin_constant_p(size)) {
34 int i = 0; 53 int i = 0;
35 54
@@ -47,10 +66,17 @@ static inline void *kmalloc(size_t size, gfp_t flags)
47found: 66found:
48#ifdef CONFIG_ZONE_DMA 67#ifdef CONFIG_ZONE_DMA
49 if (flags & GFP_DMA) 68 if (flags & GFP_DMA)
50 return kmem_cache_alloc(malloc_sizes[i].cs_dmacachep, 69 cachep = malloc_sizes[i].cs_dmacachep;
51 flags); 70 else
52#endif 71#endif
53 return kmem_cache_alloc(malloc_sizes[i].cs_cachep, flags); 72 cachep = malloc_sizes[i].cs_cachep;
73
74 ret = kmem_cache_alloc_notrace(cachep, flags);
75
76 trace_kmalloc(_THIS_IP_, ret,
77 size, slab_buffer_size(cachep), flags);
78
79 return ret;
54 } 80 }
55 return __kmalloc(size, flags); 81 return __kmalloc(size, flags);
56} 82}
@@ -59,8 +85,25 @@ found:
59extern void *__kmalloc_node(size_t size, gfp_t flags, int node); 85extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
60extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 86extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
61 87
62static inline void *kmalloc_node(size_t size, gfp_t flags, int node) 88#ifdef CONFIG_KMEMTRACE
89extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
90 gfp_t flags,
91 int nodeid);
92#else
93static __always_inline void *
94kmem_cache_alloc_node_notrace(struct kmem_cache *cachep,
95 gfp_t flags,
96 int nodeid)
97{
98 return kmem_cache_alloc_node(cachep, flags, nodeid);
99}
100#endif
101
102static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
63{ 103{
104 struct kmem_cache *cachep;
105 void *ret;
106
64 if (__builtin_constant_p(size)) { 107 if (__builtin_constant_p(size)) {
65 int i = 0; 108 int i = 0;
66 109
@@ -78,11 +121,18 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
78found: 121found:
79#ifdef CONFIG_ZONE_DMA 122#ifdef CONFIG_ZONE_DMA
80 if (flags & GFP_DMA) 123 if (flags & GFP_DMA)
81 return kmem_cache_alloc_node(malloc_sizes[i].cs_dmacachep, 124 cachep = malloc_sizes[i].cs_dmacachep;
82 flags, node); 125 else
83#endif 126#endif
84 return kmem_cache_alloc_node(malloc_sizes[i].cs_cachep, 127 cachep = malloc_sizes[i].cs_cachep;
85 flags, node); 128
129 ret = kmem_cache_alloc_node_notrace(cachep, flags, node);
130
131 trace_kmalloc_node(_THIS_IP_, ret,
132 size, slab_buffer_size(cachep),
133 flags, node);
134
135 return ret;
86 } 136 }
87 return __kmalloc_node(size, flags, node); 137 return __kmalloc_node(size, flags, node);
88} 138}
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 59a3fa476ab9..0ec00b39d006 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -3,14 +3,15 @@
3 3
4void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 4void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
5 5
6static inline void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags) 6static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
7 gfp_t flags)
7{ 8{
8 return kmem_cache_alloc_node(cachep, flags, -1); 9 return kmem_cache_alloc_node(cachep, flags, -1);
9} 10}
10 11
11void *__kmalloc_node(size_t size, gfp_t flags, int node); 12void *__kmalloc_node(size_t size, gfp_t flags, int node);
12 13
13static inline void *kmalloc_node(size_t size, gfp_t flags, int node) 14static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
14{ 15{
15 return __kmalloc_node(size, flags, node); 16 return __kmalloc_node(size, flags, node);
16} 17}
@@ -23,12 +24,12 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
23 * kmalloc is the normal method of allocating memory 24 * kmalloc is the normal method of allocating memory
24 * in the kernel. 25 * in the kernel.
25 */ 26 */
26static inline void *kmalloc(size_t size, gfp_t flags) 27static __always_inline void *kmalloc(size_t size, gfp_t flags)
27{ 28{
28 return __kmalloc_node(size, flags, -1); 29 return __kmalloc_node(size, flags, -1);
29} 30}
30 31
31static inline void *__kmalloc(size_t size, gfp_t flags) 32static __always_inline void *__kmalloc(size_t size, gfp_t flags)
32{ 33{
33 return kmalloc(size, flags); 34 return kmalloc(size, flags);
34} 35}
diff --git a/include/linux/slow-work.h b/include/linux/slow-work.h
new file mode 100644
index 000000000000..b65c8881f07a
--- /dev/null
+++ b/include/linux/slow-work.h
@@ -0,0 +1,95 @@
1/* Worker thread pool for slow items, such as filesystem lookups or mkdirs
2 *
3 * Copyright (C) 2008 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 * See Documentation/slow-work.txt
12 */
13
14#ifndef _LINUX_SLOW_WORK_H
15#define _LINUX_SLOW_WORK_H
16
17#ifdef CONFIG_SLOW_WORK
18
19#include <linux/sysctl.h>
20
21struct slow_work;
22
23/*
24 * The operations used to support slow work items
25 */
26struct slow_work_ops {
27 /* get a ref on a work item
28 * - return 0 if successful, -ve if not
29 */
30 int (*get_ref)(struct slow_work *work);
31
32 /* discard a ref to a work item */
33 void (*put_ref)(struct slow_work *work);
34
35 /* execute a work item */
36 void (*execute)(struct slow_work *work);
37};
38
39/*
40 * A slow work item
41 * - A reference is held on the parent object by the thread pool when it is
42 * queued
43 */
44struct slow_work {
45 unsigned long flags;
46#define SLOW_WORK_PENDING 0 /* item pending (further) execution */
47#define SLOW_WORK_EXECUTING 1 /* item currently executing */
48#define SLOW_WORK_ENQ_DEFERRED 2 /* item enqueue deferred */
49#define SLOW_WORK_VERY_SLOW 3 /* item is very slow */
50 const struct slow_work_ops *ops; /* operations table for this item */
51 struct list_head link; /* link in queue */
52};
53
54/**
55 * slow_work_init - Initialise a slow work item
56 * @work: The work item to initialise
57 * @ops: The operations to use to handle the slow work item
58 *
59 * Initialise a slow work item.
60 */
61static inline void slow_work_init(struct slow_work *work,
62 const struct slow_work_ops *ops)
63{
64 work->flags = 0;
65 work->ops = ops;
66 INIT_LIST_HEAD(&work->link);
67}
68
69/**
70 * vslow_work_init - Initialise a very slow work item
71 * @work: The work item to initialise
72 * @ops: The operations to use to handle the slow work item
73 *
74 * Initialise a very slow work item. This item will be restricted such that
75 * only a certain number of the pool threads will be able to execute items of
76 * this type.
77 */
78static inline void vslow_work_init(struct slow_work *work,
79 const struct slow_work_ops *ops)
80{
81 work->flags = 1 << SLOW_WORK_VERY_SLOW;
82 work->ops = ops;
83 INIT_LIST_HEAD(&work->link);
84}
85
86extern int slow_work_enqueue(struct slow_work *work);
87extern int slow_work_register_user(void);
88extern void slow_work_unregister_user(void);
89
90#ifdef CONFIG_SYSCTL
91extern ctl_table slow_work_sysctls[];
92#endif
93
94#endif /* CONFIG_SLOW_WORK */
95#endif /* _LINUX_SLOW_WORK_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 2f5c16b1aacd..5046f90c1171 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -10,6 +10,7 @@
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include <linux/workqueue.h> 11#include <linux/workqueue.h>
12#include <linux/kobject.h> 12#include <linux/kobject.h>
13#include <trace/kmemtrace.h>
13 14
14enum stat_item { 15enum stat_item {
15 ALLOC_FASTPATH, /* Allocation from cpu slab */ 16 ALLOC_FASTPATH, /* Allocation from cpu slab */
@@ -46,7 +47,6 @@ struct kmem_cache_cpu {
46struct kmem_cache_node { 47struct kmem_cache_node {
47 spinlock_t list_lock; /* Protect partial list and nr_partial */ 48 spinlock_t list_lock; /* Protect partial list and nr_partial */
48 unsigned long nr_partial; 49 unsigned long nr_partial;
49 unsigned long min_partial;
50 struct list_head partial; 50 struct list_head partial;
51#ifdef CONFIG_SLUB_DEBUG 51#ifdef CONFIG_SLUB_DEBUG
52 atomic_long_t nr_slabs; 52 atomic_long_t nr_slabs;
@@ -89,6 +89,7 @@ struct kmem_cache {
89 void (*ctor)(void *); 89 void (*ctor)(void *);
90 int inuse; /* Offset to metadata */ 90 int inuse; /* Offset to metadata */
91 int align; /* Alignment */ 91 int align; /* Alignment */
92 unsigned long min_partial;
92 const char *name; /* Name (only for display!) */ 93 const char *name; /* Name (only for display!) */
93 struct list_head list; /* List of slab caches */ 94 struct list_head list; /* List of slab caches */
94#ifdef CONFIG_SLUB_DEBUG 95#ifdef CONFIG_SLUB_DEBUG
@@ -121,10 +122,23 @@ struct kmem_cache {
121#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) 122#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
122 123
123/* 124/*
125 * Maximum kmalloc object size handled by SLUB. Larger object allocations
126 * are passed through to the page allocator. The page allocator "fastpath"
127 * is relatively slow so we need this value sufficiently high so that
128 * performance critical objects are allocated through the SLUB fastpath.
129 *
130 * This should be dropped to PAGE_SIZE / 2 once the page allocator
131 * "fastpath" becomes competitive with the slab allocator fastpaths.
132 */
133#define SLUB_MAX_SIZE (2 * PAGE_SIZE)
134
135#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2)
136
137/*
124 * We keep the general caches in an array of slab caches that are used for 138 * We keep the general caches in an array of slab caches that are used for
125 * 2^x bytes of allocations. 139 * 2^x bytes of allocations.
126 */ 140 */
127extern struct kmem_cache kmalloc_caches[PAGE_SHIFT + 1]; 141extern struct kmem_cache kmalloc_caches[SLUB_PAGE_SHIFT];
128 142
129/* 143/*
130 * Sorry that the following has to be that ugly but some versions of GCC 144 * Sorry that the following has to be that ugly but some versions of GCC
@@ -204,15 +218,32 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
204void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 218void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
205void *__kmalloc(size_t size, gfp_t flags); 219void *__kmalloc(size_t size, gfp_t flags);
206 220
221#ifdef CONFIG_KMEMTRACE
222extern void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags);
223#else
224static __always_inline void *
225kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags)
226{
227 return kmem_cache_alloc(s, gfpflags);
228}
229#endif
230
207static __always_inline void *kmalloc_large(size_t size, gfp_t flags) 231static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
208{ 232{
209 return (void *)__get_free_pages(flags | __GFP_COMP, get_order(size)); 233 unsigned int order = get_order(size);
234 void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order);
235
236 trace_kmalloc(_THIS_IP_, ret, size, PAGE_SIZE << order, flags);
237
238 return ret;
210} 239}
211 240
212static __always_inline void *kmalloc(size_t size, gfp_t flags) 241static __always_inline void *kmalloc(size_t size, gfp_t flags)
213{ 242{
243 void *ret;
244
214 if (__builtin_constant_p(size)) { 245 if (__builtin_constant_p(size)) {
215 if (size > PAGE_SIZE) 246 if (size > SLUB_MAX_SIZE)
216 return kmalloc_large(size, flags); 247 return kmalloc_large(size, flags);
217 248
218 if (!(flags & SLUB_DMA)) { 249 if (!(flags & SLUB_DMA)) {
@@ -221,7 +252,11 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
221 if (!s) 252 if (!s)
222 return ZERO_SIZE_PTR; 253 return ZERO_SIZE_PTR;
223 254
224 return kmem_cache_alloc(s, flags); 255 ret = kmem_cache_alloc_notrace(s, flags);
256
257 trace_kmalloc(_THIS_IP_, ret, size, s->size, flags);
258
259 return ret;
225 } 260 }
226 } 261 }
227 return __kmalloc(size, flags); 262 return __kmalloc(size, flags);
@@ -231,16 +266,37 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
231void *__kmalloc_node(size_t size, gfp_t flags, int node); 266void *__kmalloc_node(size_t size, gfp_t flags, int node);
232void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 267void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
233 268
269#ifdef CONFIG_KMEMTRACE
270extern void *kmem_cache_alloc_node_notrace(struct kmem_cache *s,
271 gfp_t gfpflags,
272 int node);
273#else
274static __always_inline void *
275kmem_cache_alloc_node_notrace(struct kmem_cache *s,
276 gfp_t gfpflags,
277 int node)
278{
279 return kmem_cache_alloc_node(s, gfpflags, node);
280}
281#endif
282
234static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) 283static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
235{ 284{
285 void *ret;
286
236 if (__builtin_constant_p(size) && 287 if (__builtin_constant_p(size) &&
237 size <= PAGE_SIZE && !(flags & SLUB_DMA)) { 288 size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) {
238 struct kmem_cache *s = kmalloc_slab(size); 289 struct kmem_cache *s = kmalloc_slab(size);
239 290
240 if (!s) 291 if (!s)
241 return ZERO_SIZE_PTR; 292 return ZERO_SIZE_PTR;
242 293
243 return kmem_cache_alloc_node(s, flags, node); 294 ret = kmem_cache_alloc_node_notrace(s, flags, node);
295
296 trace_kmalloc_node(_THIS_IP_, ret,
297 size, s->size, flags, node);
298
299 return ret;
244 } 300 }
245 return __kmalloc_node(size, flags, node); 301 return __kmalloc_node(size, flags, node);
246} 302}
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 715196b09d67..a69db820eed6 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -38,7 +38,7 @@ int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
38/* 38/*
39 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc. 39 * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc.
40 * (defined in asm header): 40 * (defined in asm header):
41 */ 41 */
42 42
43/* 43/*
44 * stops all CPUs but the current one: 44 * stops all CPUs but the current one:
@@ -82,7 +82,8 @@ smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info,
82 return 0; 82 return 0;
83} 83}
84 84
85void __smp_call_function_single(int cpuid, struct call_single_data *data); 85void __smp_call_function_single(int cpuid, struct call_single_data *data,
86 int wait);
86 87
87/* 88/*
88 * Generic and arch helpers 89 * Generic and arch helpers
@@ -121,6 +122,8 @@ extern unsigned int setup_max_cpus;
121 122
122#else /* !SMP */ 123#else /* !SMP */
123 124
125static inline void smp_send_stop(void) { }
126
124/* 127/*
125 * These macros fold the SMP functionality into a single CPU system 128 * These macros fold the SMP functionality into a single CPU system
126 */ 129 */
@@ -176,6 +179,12 @@ static inline void init_call_single_data(void)
176#define put_cpu() preempt_enable() 179#define put_cpu() preempt_enable()
177#define put_cpu_no_resched() preempt_enable_no_resched() 180#define put_cpu_no_resched() preempt_enable_no_resched()
178 181
182/*
183 * Callback to arch code if there's nosmp or maxcpus=0 on the
184 * boot command line:
185 */
186extern void arch_disable_smp_support(void);
187
179void smp_setup_processor_id(void); 188void smp_setup_processor_id(void);
180 189
181#endif /* __LINUX_SMP_H */ 190#endif /* __LINUX_SMP_H */
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index 1cbf0313adde..b32725075d71 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -43,5 +43,8 @@ struct smsc911x_platform_config {
43/* Constants for flags */ 43/* Constants for flags */
44#define SMSC911X_USE_16BIT (BIT(0)) 44#define SMSC911X_USE_16BIT (BIT(0))
45#define SMSC911X_USE_32BIT (BIT(1)) 45#define SMSC911X_USE_32BIT (BIT(1))
46#define SMSC911X_FORCE_INTERNAL_PHY (BIT(2))
47#define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3))
48#define SMSC911X_SAVE_MAC_ADDRESS (BIT(4))
46 49
47#endif /* __LINUX_SMSC911X_H__ */ 50#endif /* __LINUX_SMSC911X_H__ */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 20fc4bbfca42..421afb4d29b0 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -24,10 +24,12 @@ struct __kernel_sockaddr_storage {
24#include <linux/types.h> /* pid_t */ 24#include <linux/types.h> /* pid_t */
25#include <linux/compiler.h> /* __user */ 25#include <linux/compiler.h> /* __user */
26 26
27#ifdef CONFIG_PROC_FS 27#ifdef __KERNEL__
28# ifdef CONFIG_PROC_FS
28struct seq_file; 29struct seq_file;
29extern void socket_seq_show(struct seq_file *seq); 30extern void socket_seq_show(struct seq_file *seq);
30#endif 31# endif
32#endif /* __KERNEL__ */
31 33
32typedef unsigned short sa_family_t; 34typedef unsigned short sa_family_t;
33 35
@@ -179,6 +181,7 @@ struct ucred {
179#define AF_ASH 18 /* Ash */ 181#define AF_ASH 18 /* Ash */
180#define AF_ECONET 19 /* Acorn Econet */ 182#define AF_ECONET 19 /* Acorn Econet */
181#define AF_ATMSVC 20 /* ATM SVCs */ 183#define AF_ATMSVC 20 /* ATM SVCs */
184#define AF_RDS 21 /* RDS sockets */
182#define AF_SNA 22 /* Linux SNA Project (nutters!) */ 185#define AF_SNA 22 /* Linux SNA Project (nutters!) */
183#define AF_IRDA 23 /* IRDA sockets */ 186#define AF_IRDA 23 /* IRDA sockets */
184#define AF_PPPOX 24 /* PPPoX sockets */ 187#define AF_PPPOX 24 /* PPPoX sockets */
@@ -217,6 +220,7 @@ struct ucred {
217#define PF_ASH AF_ASH 220#define PF_ASH AF_ASH
218#define PF_ECONET AF_ECONET 221#define PF_ECONET AF_ECONET
219#define PF_ATMSVC AF_ATMSVC 222#define PF_ATMSVC AF_ATMSVC
223#define PF_RDS AF_RDS
220#define PF_SNA AF_SNA 224#define PF_SNA AF_SNA
221#define PF_IRDA AF_IRDA 225#define PF_IRDA AF_IRDA
222#define PF_PPPOX AF_PPPOX 226#define PF_PPPOX AF_PPPOX
@@ -298,6 +302,7 @@ struct ucred {
298#define SOL_PPPOL2TP 273 302#define SOL_PPPOL2TP 273
299#define SOL_BLUETOOTH 274 303#define SOL_BLUETOOTH 274
300#define SOL_PNPIPE 275 304#define SOL_PNPIPE 275
305#define SOL_RDS 276
301 306
302/* IPX options */ 307/* IPX options */
303#define IPX_TYPE 1 308#define IPX_TYPE 1
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index abef7596655a..241f179347d9 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -122,6 +122,9 @@
122#define SIOCBRADDIF 0x89a2 /* add interface to bridge */ 122#define SIOCBRADDIF 0x89a2 /* add interface to bridge */
123#define SIOCBRDELIF 0x89a3 /* remove interface from bridge */ 123#define SIOCBRDELIF 0x89a3 /* remove interface from bridge */
124 124
125/* hardware time stamping: parameters in linux/net_tstamp.h */
126#define SIOCSHWTSTAMP 0x89b0
127
125/* Device private ioctl calls */ 128/* Device private ioctl calls */
126 129
127/* 130/*
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index f41ffd7c2dd9..34c4475ac4a2 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -103,6 +103,14 @@
103#define SONYPI_EVENT_WIRELESS_OFF 61 103#define SONYPI_EVENT_WIRELESS_OFF 61
104#define SONYPI_EVENT_ZOOM_IN_PRESSED 62 104#define SONYPI_EVENT_ZOOM_IN_PRESSED 62
105#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63 105#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63
106#define SONYPI_EVENT_CD_EJECT_PRESSED 64
107#define SONYPI_EVENT_MODEKEY_PRESSED 65
108#define SONYPI_EVENT_PKEY_P4 66
109#define SONYPI_EVENT_PKEY_P5 67
110#define SONYPI_EVENT_SETTINGKEY_PRESSED 68
111#define SONYPI_EVENT_VOLUME_INC_PRESSED 69
112#define SONYPI_EVENT_VOLUME_DEC_PRESSED 70
113#define SONYPI_EVENT_BRIGHTNESS_PRESSED 71
106 114
107/* get/set brightness */ 115/* get/set brightness */
108#define SONYPI_IOCGBRT _IOR('v', 0, __u8) 116#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
diff --git a/include/linux/spi/eeprom.h b/include/linux/spi/eeprom.h
index 1085212c446e..306e7b1c69ed 100644
--- a/include/linux/spi/eeprom.h
+++ b/include/linux/spi/eeprom.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_SPI_EEPROM_H 1#ifndef __LINUX_SPI_EEPROM_H
2#define __LINUX_SPI_EEPROM_H 2#define __LINUX_SPI_EEPROM_H
3 3
4#include <linux/memory.h>
5
4/* 6/*
5 * Put one of these structures in platform_data for SPI EEPROMS handled 7 * Put one of these structures in platform_data for SPI EEPROMS handled
6 * by the "at25" driver. On SPI, most EEPROMS understand the same core 8 * by the "at25" driver. On SPI, most EEPROMS understand the same core
@@ -17,6 +19,10 @@ struct spi_eeprom {
17#define EE_ADDR2 0x0002 /* 16 bit addrs */ 19#define EE_ADDR2 0x0002 /* 16 bit addrs */
18#define EE_ADDR3 0x0004 /* 24 bit addrs */ 20#define EE_ADDR3 0x0004 /* 24 bit addrs */
19#define EE_READONLY 0x0008 /* disallow writes */ 21#define EE_READONLY 0x0008 /* disallow writes */
22
23 /* for exporting this chip's data to other kernel code */
24 void (*setup)(struct memory_accessor *mem, void *context);
25 void *context;
20}; 26};
21 27
22#endif /* __LINUX_SPI_EEPROM_H */ 28#endif /* __LINUX_SPI_EEPROM_H */
diff --git a/include/linux/spi/libertas_spi.h b/include/linux/spi/libertas_spi.h
new file mode 100644
index 000000000000..79506f5f9e67
--- /dev/null
+++ b/include/linux/spi/libertas_spi.h
@@ -0,0 +1,32 @@
1/*
2 * board-specific data for the libertas_spi driver.
3 *
4 * Copyright 2008 Analog Devices Inc.
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 (at
9 * your option) any later version.
10 */
11#ifndef _LIBERTAS_SPI_H_
12#define _LIBERTAS_SPI_H_
13
14struct spi_device;
15
16struct libertas_spi_platform_data {
17 /* There are two ways to read data from the WLAN module's SPI
18 * interface. Setting 0 or 1 here controls which one is used.
19 *
20 * Usually you want to set use_dummy_writes = 1.
21 * However, if that doesn't work or if you are using a slow SPI clock
22 * speed, you may want to use 0 here. */
23 u16 use_dummy_writes;
24
25 /* GPIO number to use as chip select */
26 u16 gpio_cs;
27
28 /* Board specific setup/teardown */
29 int (*setup)(struct spi_device *spi);
30 int (*teardown)(struct spi_device *spi);
31};
32#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 68bb1c501d0d..a0faa18f7b1b 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,7 +240,17 @@ struct spi_master {
239 */ 240 */
240 u16 num_chipselect; 241 u16 num_chipselect;
241 242
242 /* setup mode and clock, etc (spi driver may call many times) */ 243 /* some SPI controllers pose alignment requirements on DMAable
244 * buffers; let protocol drivers know about these requirements.
245 */
246 u16 dma_alignment;
247
248 /* Setup mode and clock, etc (spi driver may call many times).
249 *
250 * IMPORTANT: this may be called when transfers to another
251 * device are active. DO NOT UPDATE SHARED REGISTERS in ways
252 * which could break those transfers.
253 */
243 int (*setup)(struct spi_device *spi); 254 int (*setup)(struct spi_device *spi);
244 255
245 /* bidirectional bulk transfers 256 /* bidirectional bulk transfers
diff --git a/include/linux/spi/spi_gpio.h b/include/linux/spi/spi_gpio.h
index 0f01a0f1f40c..ca6782ee4b9f 100644
--- a/include/linux/spi/spi_gpio.h
+++ b/include/linux/spi/spi_gpio.h
@@ -25,10 +25,16 @@
25 * ... 25 * ...
26 * }; 26 * };
27 * 27 *
28 * If chipselect is not used (there's only one device on the bus), assign
29 * SPI_GPIO_NO_CHIPSELECT to the controller_data:
30 * .controller_data = (void *) SPI_GPIO_NO_CHIPSELECT;
31 *
28 * If the bitbanged bus is later switched to a "native" controller, 32 * If the bitbanged bus is later switched to a "native" controller,
29 * that platform_device and controller_data should be removed. 33 * that platform_device and controller_data should be removed.
30 */ 34 */
31 35
36#define SPI_GPIO_NO_CHIPSELECT ((unsigned long)-1l)
37
32/** 38/**
33 * struct spi_gpio_platform_data - parameter for bitbanged SPI master 39 * struct spi_gpio_platform_data - parameter for bitbanged SPI master
34 * @sck: number of the GPIO used for clock output 40 * @sck: number of the GPIO used for clock output
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index a0c66a2e00ad..252b245cfcf4 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -153,9 +153,11 @@ do { \
153 extern int _raw_spin_trylock(spinlock_t *lock); 153 extern int _raw_spin_trylock(spinlock_t *lock);
154 extern void _raw_spin_unlock(spinlock_t *lock); 154 extern void _raw_spin_unlock(spinlock_t *lock);
155 extern void _raw_read_lock(rwlock_t *lock); 155 extern void _raw_read_lock(rwlock_t *lock);
156#define _raw_read_lock_flags(lock, flags) _raw_read_lock(lock)
156 extern int _raw_read_trylock(rwlock_t *lock); 157 extern int _raw_read_trylock(rwlock_t *lock);
157 extern void _raw_read_unlock(rwlock_t *lock); 158 extern void _raw_read_unlock(rwlock_t *lock);
158 extern void _raw_write_lock(rwlock_t *lock); 159 extern void _raw_write_lock(rwlock_t *lock);
160#define _raw_write_lock_flags(lock, flags) _raw_write_lock(lock)
159 extern int _raw_write_trylock(rwlock_t *lock); 161 extern int _raw_write_trylock(rwlock_t *lock);
160 extern void _raw_write_unlock(rwlock_t *lock); 162 extern void _raw_write_unlock(rwlock_t *lock);
161#else 163#else
@@ -165,9 +167,13 @@ do { \
165# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock) 167# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock)
166# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) 168# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
167# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) 169# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock)
170# define _raw_read_lock_flags(lock, flags) \
171 __raw_read_lock_flags(&(lock)->raw_lock, *(flags))
168# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) 172# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock)
169# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock) 173# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock)
170# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock) 174# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock)
175# define _raw_write_lock_flags(lock, flags) \
176 __raw_write_lock_flags(&(lock)->raw_lock, *(flags))
171# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) 177# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock)
172# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock) 178# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock)
173#endif 179#endif
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 528dcb93c2f2..5f3faa9d15ae 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -36,6 +36,8 @@ struct splice_desc {
36 void *data; /* cookie */ 36 void *data; /* cookie */
37 } u; 37 } u;
38 loff_t pos; /* file position */ 38 loff_t pos; /* file position */
39 size_t num_spliced; /* number of bytes already spliced */
40 bool need_wakeup; /* need to wake up writer */
39}; 41};
40 42
41struct partial_page { 43struct partial_page {
@@ -66,6 +68,16 @@ extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
66 splice_actor *); 68 splice_actor *);
67extern ssize_t __splice_from_pipe(struct pipe_inode_info *, 69extern ssize_t __splice_from_pipe(struct pipe_inode_info *,
68 struct splice_desc *, splice_actor *); 70 struct splice_desc *, splice_actor *);
71extern int splice_from_pipe_feed(struct pipe_inode_info *, struct splice_desc *,
72 splice_actor *);
73extern int splice_from_pipe_next(struct pipe_inode_info *,
74 struct splice_desc *);
75extern void splice_from_pipe_begin(struct splice_desc *);
76extern void splice_from_pipe_end(struct pipe_inode_info *,
77 struct splice_desc *);
78extern int pipe_to_file(struct pipe_inode_info *, struct pipe_buffer *,
79 struct splice_desc *);
80
69extern ssize_t splice_to_pipe(struct pipe_inode_info *, 81extern ssize_t splice_to_pipe(struct pipe_inode_info *,
70 struct splice_pipe_desc *); 82 struct splice_pipe_desc *);
71extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *, 83extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 17d9b58f6379..5ae8fa22d331 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -339,6 +339,10 @@ extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
339 339
340extern void ssb_bus_unregister(struct ssb_bus *bus); 340extern void ssb_bus_unregister(struct ssb_bus *bus);
341 341
342/* Set a fallback SPROM.
343 * See kdoc at the function definition for complete documentation. */
344extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
345
342/* Suspend a SSB bus. 346/* Suspend a SSB bus.
343 * Call this from the parent bus suspend routine. */ 347 * Call this from the parent bus suspend routine. */
344extern int ssb_bus_suspend(struct ssb_bus *bus); 348extern int ssb_bus_suspend(struct ssb_bus *bus);
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 7d7e03dcf77c..d3b1d18922f2 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -181,6 +181,16 @@
181#define SSB_CHIPCO_PROG_WAITCNT 0x0124 181#define SSB_CHIPCO_PROG_WAITCNT 0x0124
182#define SSB_CHIPCO_FLASH_CFG 0x0128 182#define SSB_CHIPCO_FLASH_CFG 0x0128
183#define SSB_CHIPCO_FLASH_WAITCNT 0x012C 183#define SSB_CHIPCO_FLASH_WAITCNT 0x012C
184#define SSB_CHIPCO_CLKCTLST 0x01E0 /* Clock control and status (rev >= 20) */
185#define SSB_CHIPCO_CLKCTLST_FORCEALP 0x00000001 /* Force ALP request */
186#define SSB_CHIPCO_CLKCTLST_FORCEHT 0x00000002 /* Force HT request */
187#define SSB_CHIPCO_CLKCTLST_FORCEILP 0x00000004 /* Force ILP request */
188#define SSB_CHIPCO_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */
189#define SSB_CHIPCO_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
190#define SSB_CHIPCO_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
191#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00010000 /* HT available */
192#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00020000 /* APL available */
193#define SSB_CHIPCO_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
184#define SSB_CHIPCO_UART0_DATA 0x0300 194#define SSB_CHIPCO_UART0_DATA 0x0300
185#define SSB_CHIPCO_UART0_IMR 0x0304 195#define SSB_CHIPCO_UART0_IMR 0x0304
186#define SSB_CHIPCO_UART0_FCR 0x0308 196#define SSB_CHIPCO_UART0_FCR 0x0308
@@ -197,6 +207,196 @@
197#define SSB_CHIPCO_UART1_LSR 0x0414 207#define SSB_CHIPCO_UART1_LSR 0x0414
198#define SSB_CHIPCO_UART1_MSR 0x0418 208#define SSB_CHIPCO_UART1_MSR 0x0418
199#define SSB_CHIPCO_UART1_SCRATCH 0x041C 209#define SSB_CHIPCO_UART1_SCRATCH 0x041C
210/* PMU registers (rev >= 20) */
211#define SSB_CHIPCO_PMU_CTL 0x0600 /* PMU control */
212#define SSB_CHIPCO_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */
213#define SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT 16
214#define SSB_CHIPCO_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */
215#define SSB_CHIPCO_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */
216#define SSB_CHIPCO_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */
217#define SSB_CHIPCO_PMU_CTL_XTALFREQ 0x0000007C /* Crystal freq */
218#define SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT 2
219#define SSB_CHIPCO_PMU_CTL_ILPDIVEN 0x00000002 /* ILP div enable */
220#define SSB_CHIPCO_PMU_CTL_LPOSEL 0x00000001 /* LPO sel */
221#define SSB_CHIPCO_PMU_CAP 0x0604 /* PMU capabilities */
222#define SSB_CHIPCO_PMU_CAP_REVISION 0x000000FF /* Revision mask */
223#define SSB_CHIPCO_PMU_STAT 0x0608 /* PMU status */
224#define SSB_CHIPCO_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */
225#define SSB_CHIPCO_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */
226#define SSB_CHIPCO_PMU_STAT_HAVEALP 0x00000008 /* ALP available */
227#define SSB_CHIPCO_PMU_STAT_HAVEHT 0x00000004 /* HT available */
228#define SSB_CHIPCO_PMU_STAT_RESINIT 0x00000003 /* Res init */
229#define SSB_CHIPCO_PMU_RES_STAT 0x060C /* PMU res status */
230#define SSB_CHIPCO_PMU_RES_PEND 0x0610 /* PMU res pending */
231#define SSB_CHIPCO_PMU_TIMER 0x0614 /* PMU timer */
232#define SSB_CHIPCO_PMU_MINRES_MSK 0x0618 /* PMU min res mask */
233#define SSB_CHIPCO_PMU_MAXRES_MSK 0x061C /* PMU max res mask */
234#define SSB_CHIPCO_PMU_RES_TABSEL 0x0620 /* PMU res table sel */
235#define SSB_CHIPCO_PMU_RES_DEPMSK 0x0624 /* PMU res dep mask */
236#define SSB_CHIPCO_PMU_RES_UPDNTM 0x0628 /* PMU res updown timer */
237#define SSB_CHIPCO_PMU_RES_TIMER 0x062C /* PMU res timer */
238#define SSB_CHIPCO_PMU_CLKSTRETCH 0x0630 /* PMU clockstretch */
239#define SSB_CHIPCO_PMU_WATCHDOG 0x0634 /* PMU watchdog */
240#define SSB_CHIPCO_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */
241#define SSB_CHIPCO_PMU_RES_REQT 0x0644 /* PMU res req timer */
242#define SSB_CHIPCO_PMU_RES_REQM 0x0648 /* PMU res req mask */
243#define SSB_CHIPCO_CHIPCTL_ADDR 0x0650
244#define SSB_CHIPCO_CHIPCTL_DATA 0x0654
245#define SSB_CHIPCO_REGCTL_ADDR 0x0658
246#define SSB_CHIPCO_REGCTL_DATA 0x065C
247#define SSB_CHIPCO_PLLCTL_ADDR 0x0660
248#define SSB_CHIPCO_PLLCTL_DATA 0x0664
249
250
251
252/** PMU PLL registers */
253
254/* PMU rev 0 PLL registers */
255#define SSB_PMU0_PLLCTL0 0
256#define SSB_PMU0_PLLCTL0_PDIV_MSK 0x00000001
257#define SSB_PMU0_PLLCTL0_PDIV_FREQ 25000 /* kHz */
258#define SSB_PMU0_PLLCTL1 1
259#define SSB_PMU0_PLLCTL1_WILD_IMSK 0xF0000000 /* Wild int mask (low nibble) */
260#define SSB_PMU0_PLLCTL1_WILD_IMSK_SHIFT 28
261#define SSB_PMU0_PLLCTL1_WILD_FMSK 0x0FFFFF00 /* Wild frac mask */
262#define SSB_PMU0_PLLCTL1_WILD_FMSK_SHIFT 8
263#define SSB_PMU0_PLLCTL1_STOPMOD 0x00000040 /* Stop mod */
264#define SSB_PMU0_PLLCTL2 2
265#define SSB_PMU0_PLLCTL2_WILD_IMSKHI 0x0000000F /* Wild int mask (high nibble) */
266#define SSB_PMU0_PLLCTL2_WILD_IMSKHI_SHIFT 0
267
268/* PMU rev 1 PLL registers */
269#define SSB_PMU1_PLLCTL0 0
270#define SSB_PMU1_PLLCTL0_P1DIV 0x00F00000 /* P1 div */
271#define SSB_PMU1_PLLCTL0_P1DIV_SHIFT 20
272#define SSB_PMU1_PLLCTL0_P2DIV 0x0F000000 /* P2 div */
273#define SSB_PMU1_PLLCTL0_P2DIV_SHIFT 24
274#define SSB_PMU1_PLLCTL1 1
275#define SSB_PMU1_PLLCTL1_M1DIV 0x000000FF /* M1 div */
276#define SSB_PMU1_PLLCTL1_M1DIV_SHIFT 0
277#define SSB_PMU1_PLLCTL1_M2DIV 0x0000FF00 /* M2 div */
278#define SSB_PMU1_PLLCTL1_M2DIV_SHIFT 8
279#define SSB_PMU1_PLLCTL1_M3DIV 0x00FF0000 /* M3 div */
280#define SSB_PMU1_PLLCTL1_M3DIV_SHIFT 16
281#define SSB_PMU1_PLLCTL1_M4DIV 0xFF000000 /* M4 div */
282#define SSB_PMU1_PLLCTL1_M4DIV_SHIFT 24
283#define SSB_PMU1_PLLCTL2 2
284#define SSB_PMU1_PLLCTL2_M5DIV 0x000000FF /* M5 div */
285#define SSB_PMU1_PLLCTL2_M5DIV_SHIFT 0
286#define SSB_PMU1_PLLCTL2_M6DIV 0x0000FF00 /* M6 div */
287#define SSB_PMU1_PLLCTL2_M6DIV_SHIFT 8
288#define SSB_PMU1_PLLCTL2_NDIVMODE 0x000E0000 /* NDIV mode */
289#define SSB_PMU1_PLLCTL2_NDIVMODE_SHIFT 17
290#define SSB_PMU1_PLLCTL2_NDIVINT 0x1FF00000 /* NDIV int */
291#define SSB_PMU1_PLLCTL2_NDIVINT_SHIFT 20
292#define SSB_PMU1_PLLCTL3 3
293#define SSB_PMU1_PLLCTL3_NDIVFRAC 0x00FFFFFF /* NDIV frac */
294#define SSB_PMU1_PLLCTL3_NDIVFRAC_SHIFT 0
295#define SSB_PMU1_PLLCTL4 4
296#define SSB_PMU1_PLLCTL5 5
297#define SSB_PMU1_PLLCTL5_CLKDRV 0xFFFFFF00 /* clk drv */
298#define SSB_PMU1_PLLCTL5_CLKDRV_SHIFT 8
299
300/* BCM4312 PLL resource numbers. */
301#define SSB_PMURES_4312_SWITCHER_BURST 0
302#define SSB_PMURES_4312_SWITCHER_PWM 1
303#define SSB_PMURES_4312_PA_REF_LDO 2
304#define SSB_PMURES_4312_CORE_LDO_BURST 3
305#define SSB_PMURES_4312_CORE_LDO_PWM 4
306#define SSB_PMURES_4312_RADIO_LDO 5
307#define SSB_PMURES_4312_ILP_REQUEST 6
308#define SSB_PMURES_4312_BG_FILTBYP 7
309#define SSB_PMURES_4312_TX_FILTBYP 8
310#define SSB_PMURES_4312_RX_FILTBYP 9
311#define SSB_PMURES_4312_XTAL_PU 10
312#define SSB_PMURES_4312_ALP_AVAIL 11
313#define SSB_PMURES_4312_BB_PLL_FILTBYP 12
314#define SSB_PMURES_4312_RF_PLL_FILTBYP 13
315#define SSB_PMURES_4312_HT_AVAIL 14
316
317/* BCM4325 PLL resource numbers. */
318#define SSB_PMURES_4325_BUCK_BOOST_BURST 0
319#define SSB_PMURES_4325_CBUCK_BURST 1
320#define SSB_PMURES_4325_CBUCK_PWM 2
321#define SSB_PMURES_4325_CLDO_CBUCK_BURST 3
322#define SSB_PMURES_4325_CLDO_CBUCK_PWM 4
323#define SSB_PMURES_4325_BUCK_BOOST_PWM 5
324#define SSB_PMURES_4325_ILP_REQUEST 6
325#define SSB_PMURES_4325_ABUCK_BURST 7
326#define SSB_PMURES_4325_ABUCK_PWM 8
327#define SSB_PMURES_4325_LNLDO1_PU 9
328#define SSB_PMURES_4325_LNLDO2_PU 10
329#define SSB_PMURES_4325_LNLDO3_PU 11
330#define SSB_PMURES_4325_LNLDO4_PU 12
331#define SSB_PMURES_4325_XTAL_PU 13
332#define SSB_PMURES_4325_ALP_AVAIL 14
333#define SSB_PMURES_4325_RX_PWRSW_PU 15
334#define SSB_PMURES_4325_TX_PWRSW_PU 16
335#define SSB_PMURES_4325_RFPLL_PWRSW_PU 17
336#define SSB_PMURES_4325_LOGEN_PWRSW_PU 18
337#define SSB_PMURES_4325_AFE_PWRSW_PU 19
338#define SSB_PMURES_4325_BBPLL_PWRSW_PU 20
339#define SSB_PMURES_4325_HT_AVAIL 21
340
341/* BCM4328 PLL resource numbers. */
342#define SSB_PMURES_4328_EXT_SWITCHER_PWM 0
343#define SSB_PMURES_4328_BB_SWITCHER_PWM 1
344#define SSB_PMURES_4328_BB_SWITCHER_BURST 2
345#define SSB_PMURES_4328_BB_EXT_SWITCHER_BURST 3
346#define SSB_PMURES_4328_ILP_REQUEST 4
347#define SSB_PMURES_4328_RADIO_SWITCHER_PWM 5
348#define SSB_PMURES_4328_RADIO_SWITCHER_BURST 6
349#define SSB_PMURES_4328_ROM_SWITCH 7
350#define SSB_PMURES_4328_PA_REF_LDO 8
351#define SSB_PMURES_4328_RADIO_LDO 9
352#define SSB_PMURES_4328_AFE_LDO 10
353#define SSB_PMURES_4328_PLL_LDO 11
354#define SSB_PMURES_4328_BG_FILTBYP 12
355#define SSB_PMURES_4328_TX_FILTBYP 13
356#define SSB_PMURES_4328_RX_FILTBYP 14
357#define SSB_PMURES_4328_XTAL_PU 15
358#define SSB_PMURES_4328_XTAL_EN 16
359#define SSB_PMURES_4328_BB_PLL_FILTBYP 17
360#define SSB_PMURES_4328_RF_PLL_FILTBYP 18
361#define SSB_PMURES_4328_BB_PLL_PU 19
362
363/* BCM5354 PLL resource numbers. */
364#define SSB_PMURES_5354_EXT_SWITCHER_PWM 0
365#define SSB_PMURES_5354_BB_SWITCHER_PWM 1
366#define SSB_PMURES_5354_BB_SWITCHER_BURST 2
367#define SSB_PMURES_5354_BB_EXT_SWITCHER_BURST 3
368#define SSB_PMURES_5354_ILP_REQUEST 4
369#define SSB_PMURES_5354_RADIO_SWITCHER_PWM 5
370#define SSB_PMURES_5354_RADIO_SWITCHER_BURST 6
371#define SSB_PMURES_5354_ROM_SWITCH 7
372#define SSB_PMURES_5354_PA_REF_LDO 8
373#define SSB_PMURES_5354_RADIO_LDO 9
374#define SSB_PMURES_5354_AFE_LDO 10
375#define SSB_PMURES_5354_PLL_LDO 11
376#define SSB_PMURES_5354_BG_FILTBYP 12
377#define SSB_PMURES_5354_TX_FILTBYP 13
378#define SSB_PMURES_5354_RX_FILTBYP 14
379#define SSB_PMURES_5354_XTAL_PU 15
380#define SSB_PMURES_5354_XTAL_EN 16
381#define SSB_PMURES_5354_BB_PLL_FILTBYP 17
382#define SSB_PMURES_5354_RF_PLL_FILTBYP 18
383#define SSB_PMURES_5354_BB_PLL_PU 19
384
385
386
387/** Chip specific Chip-Status register contents. */
388#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL 0x00000003
389#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL 0 /* OTP is powered up, use def. CIS, no SPROM */
390#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */
391#define SSB_CHIPCO_CHST_4325_OTP_SEL 2 /* OTP is powered up, no SPROM */
392#define SSB_CHIPCO_CHST_4325_OTP_PWRDN 3 /* OTP is powered down, SPROM is present */
393#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE 0x00000004
394#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE_SHIFT 2
395#define SSB_CHIPCO_CHST_4325_RCAL_VALID 0x00000008
396#define SSB_CHIPCO_CHST_4325_RCAL_VALID_SHIFT 3
397#define SSB_CHIPCO_CHST_4325_RCAL_VALUE 0x000001F0
398#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT 4
399#define SSB_CHIPCO_CHST_4325_PMUTOP_2B 0x00000200 /* 1 for 2b, 0 for to 2a */
200 400
201 401
202 402
@@ -353,11 +553,20 @@
353struct ssb_device; 553struct ssb_device;
354struct ssb_serial_port; 554struct ssb_serial_port;
355 555
556/* Data for the PMU, if available.
557 * Check availability with ((struct ssb_chipcommon)->capabilities & SSB_CHIPCO_CAP_PMU)
558 */
559struct ssb_chipcommon_pmu {
560 u8 rev; /* PMU revision */
561 u32 crystalfreq; /* The active crystal frequency (in kHz) */
562};
563
356struct ssb_chipcommon { 564struct ssb_chipcommon {
357 struct ssb_device *dev; 565 struct ssb_device *dev;
358 u32 capabilities; 566 u32 capabilities;
359 /* Fast Powerup Delay constant */ 567 /* Fast Powerup Delay constant */
360 u16 fast_pwrup_delay; 568 u16 fast_pwrup_delay;
569 struct ssb_chipcommon_pmu pmu;
361}; 570};
362 571
363static inline bool ssb_chipco_available(struct ssb_chipcommon *cc) 572static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
@@ -365,6 +574,17 @@ static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
365 return (cc->dev != NULL); 574 return (cc->dev != NULL);
366} 575}
367 576
577/* Register access */
578#define chipco_read32(cc, offset) ssb_read32((cc)->dev, offset)
579#define chipco_write32(cc, offset, val) ssb_write32((cc)->dev, offset, val)
580
581#define chipco_mask32(cc, offset, mask) \
582 chipco_write32(cc, offset, chipco_read32(cc, offset) & (mask))
583#define chipco_set32(cc, offset, set) \
584 chipco_write32(cc, offset, chipco_read32(cc, offset) | (set))
585#define chipco_maskset32(cc, offset, mask, set) \
586 chipco_write32(cc, offset, (chipco_read32(cc, offset) & (mask)) | (set))
587
368extern void ssb_chipcommon_init(struct ssb_chipcommon *cc); 588extern void ssb_chipcommon_init(struct ssb_chipcommon *cc);
369 589
370extern void ssb_chipco_suspend(struct ssb_chipcommon *cc); 590extern void ssb_chipco_suspend(struct ssb_chipcommon *cc);
@@ -406,4 +626,8 @@ extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
406 struct ssb_serial_port *ports); 626 struct ssb_serial_port *ports);
407#endif /* CONFIG_SSB_SERIAL */ 627#endif /* CONFIG_SSB_SERIAL */
408 628
629/* PMU support */
630extern void ssb_pmu_init(struct ssb_chipcommon *cc);
631
632
409#endif /* LINUX_SSB_CHIPCO_H_ */ 633#endif /* LINUX_SSB_CHIPCO_H_ */
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 99a0f991e850..a01b982b5783 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -326,6 +326,42 @@
326#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */ 326#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */
327#define SSB_SPROM5_GPIOB_P3_SHIFT 8 327#define SSB_SPROM5_GPIOB_P3_SHIFT 8
328 328
329/* SPROM Revision 8 */
330#define SSB_SPROM8_BFLLO 0x1084 /* Boardflags (low 16 bits) */
331#define SSB_SPROM8_BFLHI 0x1086 /* Boardflags Hi */
332#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */
333#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */
334#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/
335#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
336#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8
337#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */
338#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0
339#define SSB_SPROM8_AGAIN01 0x109E /* Antenna Gain (in dBm Q5.2) */
340#define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */
341#define SSB_SPROM8_AGAIN0_SHIFT 0
342#define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */
343#define SSB_SPROM8_AGAIN1_SHIFT 8
344#define SSB_SPROM8_AGAIN23 0x10A0
345#define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */
346#define SSB_SPROM8_AGAIN2_SHIFT 0
347#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */
348#define SSB_SPROM8_AGAIN3_SHIFT 8
349#define SSB_SPROM8_GPIOA 0x1096 /*Gen. Purpose IO # 0 and 1 */
350#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */
351#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */
352#define SSB_SPROM8_GPIOA_P1_SHIFT 8
353#define SSB_SPROM8_GPIOB 0x1098 /* Gen. Purpose IO # 2 and 3 */
354#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
355#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
356#define SSB_SPROM8_GPIOB_P3_SHIFT 8
357#define SSB_SPROM8_MAXP_BG 0x10C0 /* Max Power BG in path 1 */
358#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
359#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
360#define SSB_SPROM8_ITSSI_BG_SHIFT 8
361#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power A in path 1 */
362#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power A */
363#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
364#define SSB_SPROM8_ITSSI_A_SHIFT 8
329 365
330/* Values for SSB_SPROM1_BINF_CCODE */ 366/* Values for SSB_SPROM1_BINF_CCODE */
331enum { 367enum {
diff --git a/include/linux/stackprotector.h b/include/linux/stackprotector.h
new file mode 100644
index 000000000000..6f3e54c704c0
--- /dev/null
+++ b/include/linux/stackprotector.h
@@ -0,0 +1,16 @@
1#ifndef _LINUX_STACKPROTECTOR_H
2#define _LINUX_STACKPROTECTOR_H 1
3
4#include <linux/compiler.h>
5#include <linux/sched.h>
6#include <linux/random.h>
7
8#ifdef CONFIG_CC_STACKPROTECTOR
9# include <asm/stackprotector.h>
10#else
11static inline void boot_init_stack_canary(void)
12{
13}
14#endif
15
16#endif
diff --git a/include/linux/string.h b/include/linux/string.h
index d18fc198aa2f..489019ef1694 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -10,8 +10,10 @@
10#include <linux/compiler.h> /* for inline */ 10#include <linux/compiler.h> /* for inline */
11#include <linux/types.h> /* for size_t */ 11#include <linux/types.h> /* for size_t */
12#include <linux/stddef.h> /* for NULL */ 12#include <linux/stddef.h> /* for NULL */
13#include <stdarg.h>
13 14
14extern char *strndup_user(const char __user *, long); 15extern char *strndup_user(const char __user *, long);
16extern void *memdup_user(const void __user *, size_t);
15 17
16/* 18/*
17 * Include machine specific inline routines 19 * Include machine specific inline routines
@@ -111,8 +113,23 @@ extern void argv_free(char **argv);
111 113
112extern bool sysfs_streq(const char *s1, const char *s2); 114extern bool sysfs_streq(const char *s1, const char *s2);
113 115
116#ifdef CONFIG_BINARY_PRINTF
117int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args);
118int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf);
119int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4);
120#endif
121
114extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, 122extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
115 const void *from, size_t available); 123 const void *from, size_t available);
116 124
125/**
126 * strstarts - does @str start with @prefix?
127 * @str: string to examine
128 * @prefix: prefix to look for.
129 */
130static inline bool strstarts(const char *str, const char *prefix)
131{
132 return strncmp(str, prefix, strlen(prefix)) == 0;
133}
117#endif 134#endif
118#endif /* _LINUX_STRING_H_ */ 135#endif /* _LINUX_STRING_H_ */
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 3435d24bfe55..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/*
@@ -69,7 +80,6 @@ struct svc_serv {
69 struct list_head sv_tempsocks; /* all temporary sockets */ 80 struct list_head sv_tempsocks; /* all temporary sockets */
70 int sv_tmpcnt; /* count of temporary sockets */ 81 int sv_tmpcnt; /* count of temporary sockets */
71 struct timer_list sv_temptimer; /* timer for aging temporary sockets */ 82 struct timer_list sv_temptimer; /* timer for aging temporary sockets */
72 sa_family_t sv_family; /* listener's address family */
73 83
74 char * sv_name; /* service name */ 84 char * sv_name; /* service name */
75 85
@@ -84,6 +94,8 @@ struct svc_serv {
84 struct module * sv_module; /* optional module to count when 94 struct module * sv_module; /* optional module to count when
85 * adding threads */ 95 * adding threads */
86 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 */
87}; 99};
88 100
89/* 101/*
@@ -219,6 +231,7 @@ struct svc_rqst {
219 struct svc_cred rq_cred; /* auth info */ 231 struct svc_cred rq_cred; /* auth info */
220 void * rq_xprt_ctxt; /* transport specific context ptr */ 232 void * rq_xprt_ctxt; /* transport specific context ptr */
221 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 */
222 235
223 size_t rq_xprt_hlen; /* xprt header len */ 236 size_t rq_xprt_hlen; /* xprt header len */
224 struct xdr_buf rq_arg; 237 struct xdr_buf rq_arg;
@@ -264,6 +277,7 @@ struct svc_rqst {
264 * cache pages */ 277 * cache pages */
265 wait_queue_head_t rq_wait; /* synchronization */ 278 wait_queue_head_t rq_wait; /* synchronization */
266 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 */
267}; 281};
268 282
269/* 283/*
@@ -385,19 +399,20 @@ struct svc_procedure {
385/* 399/*
386 * Function prototypes. 400 * Function prototypes.
387 */ 401 */
388struct svc_serv *svc_create(struct svc_program *, unsigned int, sa_family_t, 402struct svc_serv *svc_create(struct svc_program *, unsigned int,
389 void (*shutdown)(struct svc_serv *)); 403 void (*shutdown)(struct svc_serv *));
390struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, 404struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
391 struct svc_pool *pool); 405 struct svc_pool *pool);
392void svc_exit_thread(struct svc_rqst *); 406void svc_exit_thread(struct svc_rqst *);
393struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 407struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
394 sa_family_t, void (*shutdown)(struct svc_serv *), 408 void (*shutdown)(struct svc_serv *),
395 svc_thread_fn, struct module *); 409 svc_thread_fn, struct module *);
396int 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);
397void svc_destroy(struct svc_serv *); 412void svc_destroy(struct svc_serv *);
398int svc_process(struct svc_rqst *); 413int svc_process(struct svc_rqst *);
399int svc_register(const struct svc_serv *, const unsigned short, 414int svc_register(const struct svc_serv *, const int,
400 const unsigned short); 415 const unsigned short, const unsigned short);
401 416
402void svc_wake_up(struct svc_serv *); 417void svc_wake_up(struct svc_serv *);
403void svc_reserve(struct svc_rqst *rqstp, int space); 418void svc_reserve(struct svc_rqst *rqstp, int space);
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 0127daca4354..0d9cb6ef28b0 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -71,7 +71,8 @@ int svc_reg_xprt_class(struct svc_xprt_class *);
71void svc_unreg_xprt_class(struct svc_xprt_class *); 71void svc_unreg_xprt_class(struct svc_xprt_class *);
72void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *, 72void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *,
73 struct svc_serv *); 73 struct svc_serv *);
74int svc_create_xprt(struct svc_serv *, char *, unsigned short, int); 74int svc_create_xprt(struct svc_serv *, const char *, const int,
75 const unsigned short, int);
75void svc_xprt_enqueue(struct svc_xprt *xprt); 76void svc_xprt_enqueue(struct svc_xprt *xprt);
76void svc_xprt_received(struct svc_xprt *); 77void svc_xprt_received(struct svc_xprt *);
77void svc_xprt_put(struct svc_xprt *xprt); 78void svc_xprt_put(struct svc_xprt *xprt);
@@ -80,7 +81,8 @@ void svc_close_xprt(struct svc_xprt *xprt);
80void svc_delete_xprt(struct svc_xprt *xprt); 81void svc_delete_xprt(struct svc_xprt *xprt);
81int svc_port_is_privileged(struct sockaddr *sin); 82int svc_port_is_privileged(struct sockaddr *sin);
82int svc_print_xprts(char *buf, int maxlen); 83int svc_print_xprts(char *buf, int maxlen);
83struct svc_xprt *svc_find_xprt(struct svc_serv *, char *, int, int); 84struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
85 const sa_family_t af, const unsigned short port);
84int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen); 86int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen);
85 87
86static inline void svc_xprt_get(struct svc_xprt *xprt) 88static inline void svc_xprt_get(struct svc_xprt *xprt)
@@ -88,29 +90,32 @@ static inline void svc_xprt_get(struct svc_xprt *xprt)
88 kref_get(&xprt->xpt_ref); 90 kref_get(&xprt->xpt_ref);
89} 91}
90static inline void svc_xprt_set_local(struct svc_xprt *xprt, 92static inline void svc_xprt_set_local(struct svc_xprt *xprt,
91 struct sockaddr *sa, int salen) 93 const struct sockaddr *sa,
94 const size_t salen)
92{ 95{
93 memcpy(&xprt->xpt_local, sa, salen); 96 memcpy(&xprt->xpt_local, sa, salen);
94 xprt->xpt_locallen = salen; 97 xprt->xpt_locallen = salen;
95} 98}
96static inline void svc_xprt_set_remote(struct svc_xprt *xprt, 99static inline void svc_xprt_set_remote(struct svc_xprt *xprt,
97 struct sockaddr *sa, int salen) 100 const struct sockaddr *sa,
101 const size_t salen)
98{ 102{
99 memcpy(&xprt->xpt_remote, sa, salen); 103 memcpy(&xprt->xpt_remote, sa, salen);
100 xprt->xpt_remotelen = salen; 104 xprt->xpt_remotelen = salen;
101} 105}
102static inline unsigned short svc_addr_port(struct sockaddr *sa) 106static inline unsigned short svc_addr_port(const struct sockaddr *sa)
103{ 107{
104 unsigned short ret = 0; 108 const struct sockaddr_in *sin = (const struct sockaddr_in *)sa;
109 const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)sa;
110
105 switch (sa->sa_family) { 111 switch (sa->sa_family) {
106 case AF_INET: 112 case AF_INET:
107 ret = ntohs(((struct sockaddr_in *)sa)->sin_port); 113 return ntohs(sin->sin_port);
108 break;
109 case AF_INET6: 114 case AF_INET6:
110 ret = ntohs(((struct sockaddr_in6 *)sa)->sin6_port); 115 return ntohs(sin6->sin6_port);
111 break;
112 } 116 }
113 return ret; 117
118 return 0;
114} 119}
115 120
116static inline size_t svc_addr_len(struct sockaddr *sa) 121static inline size_t svc_addr_len(struct sockaddr *sa)
@@ -124,36 +129,39 @@ static inline size_t svc_addr_len(struct sockaddr *sa)
124 return -EAFNOSUPPORT; 129 return -EAFNOSUPPORT;
125} 130}
126 131
127static inline unsigned short svc_xprt_local_port(struct svc_xprt *xprt) 132static inline unsigned short svc_xprt_local_port(const struct svc_xprt *xprt)
128{ 133{
129 return svc_addr_port((struct sockaddr *)&xprt->xpt_local); 134 return svc_addr_port((const struct sockaddr *)&xprt->xpt_local);
130} 135}
131 136
132static inline unsigned short svc_xprt_remote_port(struct svc_xprt *xprt) 137static inline unsigned short svc_xprt_remote_port(const struct svc_xprt *xprt)
133{ 138{
134 return svc_addr_port((struct sockaddr *)&xprt->xpt_remote); 139 return svc_addr_port((const struct sockaddr *)&xprt->xpt_remote);
135} 140}
136 141
137static inline char *__svc_print_addr(struct sockaddr *addr, 142static inline char *__svc_print_addr(const struct sockaddr *addr,
138 char *buf, size_t len) 143 char *buf, const size_t len)
139{ 144{
145 const struct sockaddr_in *sin = (const struct sockaddr_in *)addr;
146 const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)addr;
147
140 switch (addr->sa_family) { 148 switch (addr->sa_family) {
141 case AF_INET: 149 case AF_INET:
142 snprintf(buf, len, "%pI4, port=%u", 150 snprintf(buf, len, "%pI4, port=%u", &sin->sin_addr,
143 &((struct sockaddr_in *)addr)->sin_addr, 151 ntohs(sin->sin_port));
144 ntohs(((struct sockaddr_in *) addr)->sin_port));
145 break; 152 break;
146 153
147 case AF_INET6: 154 case AF_INET6:
148 snprintf(buf, len, "%pI6, port=%u", 155 snprintf(buf, len, "%pI6, port=%u",
149 &((struct sockaddr_in6 *)addr)->sin6_addr, 156 &sin6->sin6_addr,
150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port)); 157 ntohs(sin6->sin6_port));
151 break; 158 break;
152 159
153 default: 160 default:
154 snprintf(buf, len, "unknown address type: %d", addr->sa_family); 161 snprintf(buf, len, "unknown address type: %d", addr->sa_family);
155 break; 162 break;
156 } 163 }
164
157 return buf; 165 return buf;
158} 166}
159#endif /* SUNRPC_SVC_XPRT_H */ 167#endif /* SUNRPC_SVC_XPRT_H */
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/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 11fc71d50c1e..08afe43118f4 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -235,6 +235,7 @@ static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *
235 */ 235 */
236int xprt_register_transport(struct xprt_class *type); 236int xprt_register_transport(struct xprt_class *type);
237int xprt_unregister_transport(struct xprt_class *type); 237int xprt_unregister_transport(struct xprt_class *type);
238int xprt_load_transport(const char *);
238void xprt_set_retrans_timeout_def(struct rpc_task *task); 239void xprt_set_retrans_timeout_def(struct rpc_task *task);
239void xprt_set_retrans_timeout_rtt(struct rpc_task *task); 240void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
240void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 241void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
@@ -259,6 +260,8 @@ void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie);
259#define XPRT_BOUND (4) 260#define XPRT_BOUND (4)
260#define XPRT_BINDING (5) 261#define XPRT_BINDING (5)
261#define XPRT_CLOSING (6) 262#define XPRT_CLOSING (6)
263#define XPRT_CONNECTION_ABORT (7)
264#define XPRT_CONNECTION_CLOSE (8)
262 265
263static inline void xprt_set_connected(struct rpc_xprt *xprt) 266static inline void xprt_set_connected(struct rpc_xprt *xprt)
264{ 267{
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index c7d9bb1832ba..795032edfc46 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -1,9 +1,6 @@
1#ifndef _LINUX_SUSPEND_H 1#ifndef _LINUX_SUSPEND_H
2#define _LINUX_SUSPEND_H 2#define _LINUX_SUSPEND_H
3 3
4#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32) || defined(CONFIG_PPC64)
5#include <asm/suspend.h>
6#endif
7#include <linux/swap.h> 4#include <linux/swap.h>
8#include <linux/notifier.h> 5#include <linux/notifier.h>
9#include <linux/init.h> 6#include <linux/init.h>
@@ -61,10 +58,17 @@ typedef int __bitwise suspend_state_t;
61 * by @begin(). 58 * by @begin().
62 * @prepare() is called right after devices have been suspended (ie. the 59 * @prepare() is called right after devices have been suspended (ie. the
63 * appropriate .suspend() method has been executed for each device) and 60 * appropriate .suspend() method has been executed for each device) and
64 * before the nonboot CPUs are disabled (it is executed with IRQs enabled). 61 * before device drivers' late suspend callbacks are executed. It returns
65 * This callback is optional. It returns 0 on success or a negative 62 * 0 on success or a negative error code otherwise, in which case the
66 * error code otherwise, in which case the system cannot enter the desired 63 * system cannot enter the desired sleep state (@prepare_late(), @enter(),
67 * sleep state (@enter() and @finish() will not be called in that case). 64 * @wake(), and @finish() will not be called in that case).
65 *
66 * @prepare_late: Finish preparing the platform for entering the system sleep
67 * state indicated by @begin().
68 * @prepare_late is called before disabling nonboot CPUs and after
69 * device drivers' late suspend callbacks have been executed. It returns
70 * 0 on success or a negative error code otherwise, in which case the
71 * system cannot enter the desired sleep state (@enter() and @wake()).
68 * 72 *
69 * @enter: Enter the system sleep state indicated by @begin() or represented by 73 * @enter: Enter the system sleep state indicated by @begin() or represented by
70 * the argument if @begin() is not implemented. 74 * the argument if @begin() is not implemented.
@@ -72,19 +76,26 @@ typedef int __bitwise suspend_state_t;
72 * error code otherwise, in which case the system cannot enter the desired 76 * error code otherwise, in which case the system cannot enter the desired
73 * sleep state. 77 * sleep state.
74 * 78 *
75 * @finish: Called when the system has just left a sleep state, right after 79 * @wake: Called when the system has just left a sleep state, right after
76 * the nonboot CPUs have been enabled and before devices are resumed (it is 80 * the nonboot CPUs have been enabled and before device drivers' early
77 * executed with IRQs enabled). 81 * resume callbacks are executed.
82 * This callback is optional, but should be implemented by the platforms
83 * that implement @prepare_late(). If implemented, it is always called
84 * after @enter(), even if @enter() fails.
85 *
86 * @finish: Finish wake-up of the platform.
87 * @finish is called right prior to calling device drivers' regular suspend
88 * callbacks.
78 * This callback is optional, but should be implemented by the platforms 89 * This callback is optional, but should be implemented by the platforms
79 * that implement @prepare(). If implemented, it is always called after 90 * that implement @prepare(). If implemented, it is always called after
80 * @enter() (even if @enter() fails). 91 * @enter() and @wake(), if implemented, even if any of them fails.
81 * 92 *
82 * @end: Called by the PM core right after resuming devices, to indicate to 93 * @end: Called by the PM core right after resuming devices, to indicate to
83 * the platform that the system has returned to the working state or 94 * the platform that the system has returned to the working state or
84 * the transition to the sleep state has been aborted. 95 * the transition to the sleep state has been aborted.
85 * This callback is optional, but should be implemented by the platforms 96 * This callback is optional, but should be implemented by the platforms
86 * that implement @begin(), but platforms implementing @begin() should 97 * that implement @begin(). Accordingly, platforms implementing @begin()
87 * also provide a @end() which cleans up transitions aborted before 98 * should also provide a @end() which cleans up transitions aborted before
88 * @enter(). 99 * @enter().
89 * 100 *
90 * @recover: Recover the platform from a suspend failure. 101 * @recover: Recover the platform from a suspend failure.
@@ -96,7 +107,9 @@ struct platform_suspend_ops {
96 int (*valid)(suspend_state_t state); 107 int (*valid)(suspend_state_t state);
97 int (*begin)(suspend_state_t state); 108 int (*begin)(suspend_state_t state);
98 int (*prepare)(void); 109 int (*prepare)(void);
110 int (*prepare_late)(void);
99 int (*enter)(suspend_state_t state); 111 int (*enter)(suspend_state_t state);
112 void (*wake)(void);
100 void (*finish)(void); 113 void (*finish)(void);
101 void (*end)(void); 114 void (*end)(void);
102 void (*recover)(void); 115 void (*recover)(void);
diff --git a/include/linux/suspend_ioctls.h b/include/linux/suspend_ioctls.h
index 2c6faec96bde..0b30382984fe 100644
--- a/include/linux/suspend_ioctls.h
+++ b/include/linux/suspend_ioctls.h
@@ -1,14 +1,15 @@
1#ifndef _LINUX_SUSPEND_IOCTLS_H 1#ifndef _LINUX_SUSPEND_IOCTLS_H
2#define _LINUX_SUSPEND_IOCTLS_H 2#define _LINUX_SUSPEND_IOCTLS_H
3 3
4#include <linux/types.h>
4/* 5/*
5 * This structure is used to pass the values needed for the identification 6 * This structure is used to pass the values needed for the identification
6 * of the resume swap area from a user space to the kernel via the 7 * of the resume swap area from a user space to the kernel via the
7 * SNAPSHOT_SET_SWAP_AREA ioctl 8 * SNAPSHOT_SET_SWAP_AREA ioctl
8 */ 9 */
9struct resume_swap_area { 10struct resume_swap_area {
10 loff_t offset; 11 __kernel_loff_t offset;
11 u_int32_t dev; 12 __u32 dev;
12} __attribute__((packed)); 13} __attribute__((packed));
13 14
14#define SNAPSHOT_IOC_MAGIC '3' 15#define SNAPSHOT_IOC_MAGIC '3'
@@ -20,13 +21,13 @@ struct resume_swap_area {
20#define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11) 21#define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11)
21#define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \ 22#define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \
22 struct resume_swap_area) 23 struct resume_swap_area)
23#define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, loff_t) 24#define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, __kernel_loff_t)
24#define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15) 25#define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15)
25#define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16) 26#define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16)
26#define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int) 27#define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int)
27#define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18) 28#define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18)
28#define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, loff_t) 29#define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, __kernel_loff_t)
29#define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, loff_t) 30#define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, __kernel_loff_t)
30#define SNAPSHOT_IOC_MAXNR 20 31#define SNAPSHOT_IOC_MAXNR 20
31 32
32#endif /* _LINUX_SUSPEND_IOCTLS_H */ 33#endif /* _LINUX_SUSPEND_IOCTLS_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index d30215578877..62d81435347a 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -212,7 +212,7 @@ static inline void lru_cache_add_active_file(struct page *page)
212 212
213/* linux/mm/vmscan.c */ 213/* linux/mm/vmscan.c */
214extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 214extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
215 gfp_t gfp_mask); 215 gfp_t gfp_mask, nodemask_t *mask);
216extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 216extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
217 gfp_t gfp_mask, bool noswap, 217 gfp_t gfp_mask, bool noswap,
218 unsigned int swappiness); 218 unsigned int swappiness);
@@ -382,6 +382,11 @@ static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask,
382 return NULL; 382 return NULL;
383} 383}
384 384
385static inline int swap_writepage(struct page *p, struct writeback_control *wbc)
386{
387 return 0;
388}
389
385static inline struct page *lookup_swap_cache(swp_entry_t swp) 390static inline struct page *lookup_swap_cache(swp_entry_t swp)
386{ 391{
387 return NULL; 392 return NULL;
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index dedd3c0cfe30..ac9ff54f7cb3 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -31,7 +31,7 @@ extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev,
31 phys_addr_t address); 31 phys_addr_t address);
32extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address); 32extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address);
33 33
34extern int swiotlb_arch_range_needs_mapping(void *ptr, size_t size); 34extern int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size);
35 35
36extern void 36extern void
37*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 37*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
@@ -41,20 +41,13 @@ extern void
41swiotlb_free_coherent(struct device *hwdev, size_t size, 41swiotlb_free_coherent(struct device *hwdev, size_t size,
42 void *vaddr, dma_addr_t dma_handle); 42 void *vaddr, dma_addr_t dma_handle);
43 43
44extern dma_addr_t 44extern dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
45swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir); 45 unsigned long offset, size_t size,
46 46 enum dma_data_direction dir,
47extern void 47 struct dma_attrs *attrs);
48swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, 48extern void swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
49 size_t size, int dir); 49 size_t size, enum dma_data_direction dir,
50 50 struct dma_attrs *attrs);
51extern dma_addr_t
52swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
53 int dir, struct dma_attrs *attrs);
54
55extern void
56swiotlb_unmap_single_attrs(struct device *hwdev, dma_addr_t dev_addr,
57 size_t size, int dir, struct dma_attrs *attrs);
58 51
59extern int 52extern int
60swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, 53swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
@@ -66,36 +59,38 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
66 59
67extern int 60extern int
68swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, 61swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
69 int dir, struct dma_attrs *attrs); 62 enum dma_data_direction dir, struct dma_attrs *attrs);
70 63
71extern void 64extern void
72swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl, 65swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
73 int nelems, int dir, struct dma_attrs *attrs); 66 int nelems, enum dma_data_direction dir,
67 struct dma_attrs *attrs);
74 68
75extern void 69extern void
76swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, 70swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
77 size_t size, int dir); 71 size_t size, enum dma_data_direction dir);
78 72
79extern void 73extern void
80swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, 74swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
81 int nelems, int dir); 75 int nelems, enum dma_data_direction dir);
82 76
83extern void 77extern void
84swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr, 78swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
85 size_t size, int dir); 79 size_t size, enum dma_data_direction dir);
86 80
87extern void 81extern void
88swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, 82swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
89 int nelems, int dir); 83 int nelems, enum dma_data_direction dir);
90 84
91extern void 85extern void
92swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr, 86swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
93 unsigned long offset, size_t size, int dir); 87 unsigned long offset, size_t size,
88 enum dma_data_direction dir);
94 89
95extern void 90extern void
96swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr, 91swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
97 unsigned long offset, size_t size, 92 unsigned long offset, size_t size,
98 int dir); 93 enum dma_data_direction dir);
99 94
100extern int 95extern int
101swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); 96swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 99b8bdb17b2b..0ff2779c44d0 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -125,6 +125,7 @@
125#define MGSL_MODE_MONOSYNC 3 125#define MGSL_MODE_MONOSYNC 3
126#define MGSL_MODE_BISYNC 4 126#define MGSL_MODE_BISYNC 4
127#define MGSL_MODE_RAW 6 127#define MGSL_MODE_RAW 6
128#define MGSL_MODE_BASE_CLOCK 7
128 129
129#define MGSL_BUS_TYPE_ISA 1 130#define MGSL_BUS_TYPE_ISA 1
130#define MGSL_BUS_TYPE_EISA 2 131#define MGSL_BUS_TYPE_EISA 2
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index f9f900cfd066..40617c1d8976 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -65,6 +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 <trace/syscall.h>
68 69
69#define __SC_DECL1(t1, a1) t1 a1 70#define __SC_DECL1(t1, a1) t1 a1
70#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__) 71#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__)
@@ -95,7 +96,46 @@ struct old_linux_dirent;
95#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) 96#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
96#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) 97#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
97 98
99#ifdef CONFIG_FTRACE_SYSCALLS
100#define __SC_STR_ADECL1(t, a) #a
101#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__)
102#define __SC_STR_ADECL3(t, a, ...) #a, __SC_STR_ADECL2(__VA_ARGS__)
103#define __SC_STR_ADECL4(t, a, ...) #a, __SC_STR_ADECL3(__VA_ARGS__)
104#define __SC_STR_ADECL5(t, a, ...) #a, __SC_STR_ADECL4(__VA_ARGS__)
105#define __SC_STR_ADECL6(t, a, ...) #a, __SC_STR_ADECL5(__VA_ARGS__)
106
107#define __SC_STR_TDECL1(t, a) #t
108#define __SC_STR_TDECL2(t, a, ...) #t, __SC_STR_TDECL1(__VA_ARGS__)
109#define __SC_STR_TDECL3(t, a, ...) #t, __SC_STR_TDECL2(__VA_ARGS__)
110#define __SC_STR_TDECL4(t, a, ...) #t, __SC_STR_TDECL3(__VA_ARGS__)
111#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__)
112#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__)
113
114#define SYSCALL_METADATA(sname, nb) \
115 static const struct syscall_metadata __used \
116 __attribute__((__aligned__(4))) \
117 __attribute__((section("__syscalls_metadata"))) \
118 __syscall_meta_##sname = { \
119 .name = "sys"#sname, \
120 .nb_args = nb, \
121 .types = types_##sname, \
122 .args = args_##sname, \
123 }
124
125#define SYSCALL_DEFINE0(sname) \
126 static const struct syscall_metadata __used \
127 __attribute__((__aligned__(4))) \
128 __attribute__((section("__syscalls_metadata"))) \
129 __syscall_meta_##sname = { \
130 .name = "sys_"#sname, \
131 .nb_args = 0, \
132 }; \
133 asmlinkage long sys_##sname(void)
134
135#else
98#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) 136#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
137#endif
138
99#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) 139#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
100#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) 140#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
101#define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__) 141#define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
@@ -108,7 +148,7 @@ struct old_linux_dirent;
108 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \ 148 asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n" \
109 "\t.globl ." #alias "\n\t.set ." #alias ", ." #name) 149 "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
110#else 150#else
111#ifdef CONFIG_ALPHA 151#if defined(CONFIG_ALPHA) || defined(CONFIG_MIPS)
112#define SYSCALL_ALIAS(alias, name) \ 152#define SYSCALL_ALIAS(alias, name) \
113 asm ( #alias " = " #name "\n\t.globl " #alias) 153 asm ( #alias " = " #name "\n\t.globl " #alias)
114#else 154#else
@@ -117,10 +157,26 @@ struct old_linux_dirent;
117#endif 157#endif
118#endif 158#endif
119 159
160#ifdef CONFIG_FTRACE_SYSCALLS
161#define SYSCALL_DEFINEx(x, sname, ...) \
162 static const char *types_##sname[] = { \
163 __SC_STR_TDECL##x(__VA_ARGS__) \
164 }; \
165 static const char *args_##sname[] = { \
166 __SC_STR_ADECL##x(__VA_ARGS__) \
167 }; \
168 SYSCALL_METADATA(sname, x); \
169 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
170#else
171#define SYSCALL_DEFINEx(x, sname, ...) \
172 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
173#endif
174
120#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 175#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
121 176
122#define SYSCALL_DEFINE(name) static inline long SYSC_##name 177#define SYSCALL_DEFINE(name) static inline long SYSC_##name
123#define SYSCALL_DEFINEx(x, name, ...) \ 178
179#define __SYSCALL_DEFINEx(x, name, ...) \
124 asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)); \ 180 asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)); \
125 static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)); \ 181 static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)); \
126 asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__)) \ 182 asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__)) \
@@ -134,7 +190,7 @@ struct old_linux_dirent;
134#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ 190#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
135 191
136#define SYSCALL_DEFINE(name) asmlinkage long sys_##name 192#define SYSCALL_DEFINE(name) asmlinkage long sys_##name
137#define SYSCALL_DEFINEx(x, name, ...) \ 193#define __SYSCALL_DEFINEx(x, name, ...) \
138 asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)) 194 asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__))
139 195
140#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ 196#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
@@ -461,6 +517,10 @@ asmlinkage long sys_pread64(unsigned int fd, char __user *buf,
461 size_t count, loff_t pos); 517 size_t count, loff_t pos);
462asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf, 518asmlinkage long sys_pwrite64(unsigned int fd, const char __user *buf,
463 size_t count, loff_t pos); 519 size_t count, loff_t pos);
520asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec,
521 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
522asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec,
523 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
464asmlinkage long sys_getcwd(char __user *buf, unsigned long size); 524asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
465asmlinkage long sys_mkdir(const char __user *pathname, int mode); 525asmlinkage long sys_mkdir(const char __user *pathname, int mode);
466asmlinkage long sys_chdir(const char __user *filename); 526asmlinkage long sys_chdir(const char __user *filename);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 39d471d1163b..e76d3b22a466 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -490,6 +490,7 @@ enum
490 NET_IPV4_CONF_ARP_IGNORE=19, 490 NET_IPV4_CONF_ARP_IGNORE=19,
491 NET_IPV4_CONF_PROMOTE_SECONDARIES=20, 491 NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
492 NET_IPV4_CONF_ARP_ACCEPT=21, 492 NET_IPV4_CONF_ARP_ACCEPT=21,
493 NET_IPV4_CONF_ARP_NOTIFY=22,
493 __NET_IPV4_CONF_MAX 494 __NET_IPV4_CONF_MAX
494}; 495};
495 496
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index fe77e1499ab7..9d5078bd23a3 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -69,16 +69,16 @@ union tcp_word_hdr {
69#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) 69#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
70 70
71enum { 71enum {
72 TCP_FLAG_CWR = __constant_htonl(0x00800000), 72 TCP_FLAG_CWR = __cpu_to_be32(0x00800000),
73 TCP_FLAG_ECE = __constant_htonl(0x00400000), 73 TCP_FLAG_ECE = __cpu_to_be32(0x00400000),
74 TCP_FLAG_URG = __constant_htonl(0x00200000), 74 TCP_FLAG_URG = __cpu_to_be32(0x00200000),
75 TCP_FLAG_ACK = __constant_htonl(0x00100000), 75 TCP_FLAG_ACK = __cpu_to_be32(0x00100000),
76 TCP_FLAG_PSH = __constant_htonl(0x00080000), 76 TCP_FLAG_PSH = __cpu_to_be32(0x00080000),
77 TCP_FLAG_RST = __constant_htonl(0x00040000), 77 TCP_FLAG_RST = __cpu_to_be32(0x00040000),
78 TCP_FLAG_SYN = __constant_htonl(0x00020000), 78 TCP_FLAG_SYN = __cpu_to_be32(0x00020000),
79 TCP_FLAG_FIN = __constant_htonl(0x00010000), 79 TCP_FLAG_FIN = __cpu_to_be32(0x00010000),
80 TCP_RESERVED_BITS = __constant_htonl(0x0F000000), 80 TCP_RESERVED_BITS = __cpu_to_be32(0x0F000000),
81 TCP_DATA_OFFSET = __constant_htonl(0xF0000000) 81 TCP_DATA_OFFSET = __cpu_to_be32(0xF0000000)
82}; 82};
83 83
84/* TCP socket options */ 84/* TCP socket options */
@@ -218,7 +218,6 @@ struct tcp_options_received {
218 snd_wscale : 4, /* Window scaling received from sender */ 218 snd_wscale : 4, /* Window scaling received from sender */
219 rcv_wscale : 4; /* Window scaling to send to receiver */ 219 rcv_wscale : 4; /* Window scaling to send to receiver */
220/* SACKs data */ 220/* SACKs data */
221 u8 eff_sacks; /* Size of SACK array to send with next packet */
222 u8 num_sacks; /* Number of SACK blocks */ 221 u8 num_sacks; /* Number of SACK blocks */
223 u16 user_mss; /* mss requested by user in ioctl */ 222 u16 user_mss; /* mss requested by user in ioctl */
224 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ 223 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
@@ -249,7 +248,7 @@ struct tcp_sock {
249 /* inet_connection_sock has to be the first member of tcp_sock */ 248 /* inet_connection_sock has to be the first member of tcp_sock */
250 struct inet_connection_sock inet_conn; 249 struct inet_connection_sock inet_conn;
251 u16 tcp_header_len; /* Bytes of tcp header to send */ 250 u16 tcp_header_len; /* Bytes of tcp header to send */
252 u16 xmit_size_goal; /* Goal for segmenting output packets */ 251 u16 xmit_size_goal_segs; /* Goal for segmenting output packets */
253 252
254/* 253/*
255 * Header prediction flags 254 * Header prediction flags
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 917707e6151d..1de8b9eb841b 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -27,27 +27,46 @@
27 27
28#include <linux/idr.h> 28#include <linux/idr.h>
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/workqueue.h>
30 31
31struct thermal_zone_device; 32struct thermal_zone_device;
32struct thermal_cooling_device; 33struct thermal_cooling_device;
33 34
35enum thermal_device_mode {
36 THERMAL_DEVICE_DISABLED = 0,
37 THERMAL_DEVICE_ENABLED,
38};
39
40enum thermal_trip_type {
41 THERMAL_TRIP_ACTIVE = 0,
42 THERMAL_TRIP_PASSIVE,
43 THERMAL_TRIP_HOT,
44 THERMAL_TRIP_CRITICAL,
45};
46
34struct thermal_zone_device_ops { 47struct thermal_zone_device_ops {
35 int (*bind) (struct thermal_zone_device *, 48 int (*bind) (struct thermal_zone_device *,
36 struct thermal_cooling_device *); 49 struct thermal_cooling_device *);
37 int (*unbind) (struct thermal_zone_device *, 50 int (*unbind) (struct thermal_zone_device *,
38 struct thermal_cooling_device *); 51 struct thermal_cooling_device *);
39 int (*get_temp) (struct thermal_zone_device *, char *); 52 int (*get_temp) (struct thermal_zone_device *, unsigned long *);
40 int (*get_mode) (struct thermal_zone_device *, char *); 53 int (*get_mode) (struct thermal_zone_device *,
41 int (*set_mode) (struct thermal_zone_device *, const char *); 54 enum thermal_device_mode *);
42 int (*get_trip_type) (struct thermal_zone_device *, int, char *); 55 int (*set_mode) (struct thermal_zone_device *,
43 int (*get_trip_temp) (struct thermal_zone_device *, int, char *); 56 enum thermal_device_mode);
57 int (*get_trip_type) (struct thermal_zone_device *, int,
58 enum thermal_trip_type *);
59 int (*get_trip_temp) (struct thermal_zone_device *, int,
60 unsigned long *);
44 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); 61 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
62 int (*notify) (struct thermal_zone_device *, int,
63 enum thermal_trip_type);
45}; 64};
46 65
47struct thermal_cooling_device_ops { 66struct thermal_cooling_device_ops {
48 int (*get_max_state) (struct thermal_cooling_device *, char *); 67 int (*get_max_state) (struct thermal_cooling_device *, unsigned long *);
49 int (*get_cur_state) (struct thermal_cooling_device *, char *); 68 int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *);
50 int (*set_cur_state) (struct thermal_cooling_device *, unsigned int); 69 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
51}; 70};
52 71
53#define THERMAL_TRIPS_NONE -1 72#define THERMAL_TRIPS_NONE -1
@@ -88,11 +107,19 @@ struct thermal_zone_device {
88 struct device device; 107 struct device device;
89 void *devdata; 108 void *devdata;
90 int trips; 109 int trips;
110 int tc1;
111 int tc2;
112 int passive_delay;
113 int polling_delay;
114 int last_temperature;
115 bool passive;
116 unsigned int forced_passive;
91 struct thermal_zone_device_ops *ops; 117 struct thermal_zone_device_ops *ops;
92 struct list_head cooling_devices; 118 struct list_head cooling_devices;
93 struct idr idr; 119 struct idr idr;
94 struct mutex lock; /* protect cooling devices list */ 120 struct mutex lock; /* protect cooling devices list */
95 struct list_head node; 121 struct list_head node;
122 struct delayed_work poll_queue;
96#if defined(CONFIG_THERMAL_HWMON) 123#if defined(CONFIG_THERMAL_HWMON)
97 struct list_head hwmon_node; 124 struct list_head hwmon_node;
98 struct thermal_hwmon_device *hwmon; 125 struct thermal_hwmon_device *hwmon;
@@ -104,13 +131,16 @@ struct thermal_zone_device {
104struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, 131struct thermal_zone_device *thermal_zone_device_register(char *, int, void *,
105 struct 132 struct
106 thermal_zone_device_ops 133 thermal_zone_device_ops
107 *); 134 *, int tc1, int tc2,
135 int passive_freq,
136 int polling_freq);
108void thermal_zone_device_unregister(struct thermal_zone_device *); 137void thermal_zone_device_unregister(struct thermal_zone_device *);
109 138
110int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, 139int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
111 struct thermal_cooling_device *); 140 struct thermal_cooling_device *);
112int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, 141int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
113 struct thermal_cooling_device *); 142 struct thermal_cooling_device *);
143void thermal_zone_device_update(struct thermal_zone_device *);
114struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, 144struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
115 struct 145 struct
116 thermal_cooling_device_ops 146 thermal_cooling_device_ops
diff --git a/include/linux/time.h b/include/linux/time.h
index fbbd2a1c92ba..242f62499bb7 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -12,14 +12,14 @@
12#ifndef _STRUCT_TIMESPEC 12#ifndef _STRUCT_TIMESPEC
13#define _STRUCT_TIMESPEC 13#define _STRUCT_TIMESPEC
14struct timespec { 14struct timespec {
15 time_t tv_sec; /* seconds */ 15 __kernel_time_t tv_sec; /* seconds */
16 long tv_nsec; /* nanoseconds */ 16 long tv_nsec; /* nanoseconds */
17}; 17};
18#endif 18#endif
19 19
20struct timeval { 20struct timeval {
21 time_t tv_sec; /* seconds */ 21 __kernel_time_t tv_sec; /* seconds */
22 suseconds_t tv_usec; /* microseconds */ 22 __kernel_suseconds_t tv_usec; /* microseconds */
23}; 23};
24 24
25struct timezone { 25struct timezone {
diff --git a/include/linux/timecompare.h b/include/linux/timecompare.h
new file mode 100644
index 000000000000..546e2234e4b3
--- /dev/null
+++ b/include/linux/timecompare.h
@@ -0,0 +1,125 @@
1/*
2 * Utility code which helps transforming between two different time
3 * bases, called "source" and "target" time in this code.
4 *
5 * Source time has to be provided via the timecounter API while target
6 * time is accessed via a function callback whose prototype
7 * intentionally matches ktime_get() and ktime_get_real(). These
8 * interfaces where chosen like this so that the code serves its
9 * initial purpose without additional glue code.
10 *
11 * This purpose is synchronizing a hardware clock in a NIC with system
12 * time, in order to implement the Precision Time Protocol (PTP,
13 * IEEE1588) with more accurate hardware assisted time stamping. In
14 * that context only synchronization against system time (=
15 * ktime_get_real()) is currently needed. But this utility code might
16 * become useful in other situations, which is why it was written as
17 * general purpose utility code.
18 *
19 * The source timecounter is assumed to return monotonically
20 * increasing time (but this code does its best to compensate if that
21 * is not the case) whereas target time may jump.
22 *
23 * The target time corresponding to a source time is determined by
24 * reading target time, reading source time, reading target time
25 * again, then assuming that average target time corresponds to source
26 * time. In other words, the assumption is that reading the source
27 * time is slow and involves equal time for sending the request and
28 * receiving the reply, whereas reading target time is assumed to be
29 * fast.
30 *
31 * Copyright (C) 2009 Intel Corporation.
32 * Author: Patrick Ohly <patrick.ohly@intel.com>
33 *
34 * This program is free software; you can redistribute it and/or modify it
35 * under the terms and conditions of the GNU General Public License,
36 * version 2, as published by the Free Software Foundation.
37 *
38 * This program is distributed in the hope it will be useful, but WITHOUT
39 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
40 * FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for
41 * more details.
42 *
43 * You should have received a copy of the GNU General Public License along with
44 * this program; if not, write to the Free Software Foundation, Inc.,
45 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
46 */
47#ifndef _LINUX_TIMECOMPARE_H
48#define _LINUX_TIMECOMPARE_H
49
50#include <linux/clocksource.h>
51#include <linux/ktime.h>
52
53/**
54 * struct timecompare - stores state and configuration for the two clocks
55 *
56 * Initialize to zero, then set source/target/num_samples.
57 *
58 * Transformation between source time and target time is done with:
59 * target_time = source_time + offset +
60 * (source_time - last_update) * skew /
61 * TIMECOMPARE_SKEW_RESOLUTION
62 *
63 * @source: used to get source time stamps via timecounter_read()
64 * @target: function returning target time (for example, ktime_get
65 * for monotonic time, or ktime_get_real for wall clock)
66 * @num_samples: number of times that source time and target time are to
67 * be compared when determining their offset
68 * @offset: (target time - source time) at the time of the last update
69 * @skew: average (target time - source time) / delta source time *
70 * TIMECOMPARE_SKEW_RESOLUTION
71 * @last_update: last source time stamp when time offset was measured
72 */
73struct timecompare {
74 struct timecounter *source;
75 ktime_t (*target)(void);
76 int num_samples;
77
78 s64 offset;
79 s64 skew;
80 u64 last_update;
81};
82
83/**
84 * timecompare_transform - transform source time stamp into target time base
85 * @sync: context for time sync
86 * @source_tstamp: the result of timecounter_read() or
87 * timecounter_cyc2time()
88 */
89extern ktime_t timecompare_transform(struct timecompare *sync,
90 u64 source_tstamp);
91
92/**
93 * timecompare_offset - measure current (target time - source time) offset
94 * @sync: context for time sync
95 * @offset: average offset during sample period returned here
96 * @source_tstamp: average source time during sample period returned here
97 *
98 * Returns number of samples used. Might be zero (= no result) in the
99 * unlikely case that target time was monotonically decreasing for all
100 * samples (= broken).
101 */
102extern int timecompare_offset(struct timecompare *sync,
103 s64 *offset,
104 u64 *source_tstamp);
105
106extern void __timecompare_update(struct timecompare *sync,
107 u64 source_tstamp);
108
109/**
110 * timecompare_update - update offset and skew by measuring current offset
111 * @sync: context for time sync
112 * @source_tstamp: the result of timecounter_read() or
113 * timecounter_cyc2time(), pass zero to force update
114 *
115 * Updates are only done at most once per second.
116 */
117static inline void timecompare_update(struct timecompare *sync,
118 u64 source_tstamp)
119{
120 if (!source_tstamp ||
121 (s64)(source_tstamp - sync->last_update) >= NSEC_PER_SEC)
122 __timecompare_update(sync, source_tstamp);
123}
124
125#endif /* _LINUX_TIMECOMPARE_H */
diff --git a/include/linux/timer.h b/include/linux/timer.h
index daf9685b861c..6cdb6f3331f1 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -5,6 +5,7 @@
5#include <linux/ktime.h> 5#include <linux/ktime.h>
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7#include <linux/debugobjects.h> 7#include <linux/debugobjects.h>
8#include <linux/stringify.h>
8 9
9struct tvec_base; 10struct tvec_base;
10 11
@@ -21,52 +22,126 @@ struct timer_list {
21 char start_comm[16]; 22 char start_comm[16];
22 int start_pid; 23 int start_pid;
23#endif 24#endif
25#ifdef CONFIG_LOCKDEP
26 struct lockdep_map lockdep_map;
27#endif
24}; 28};
25 29
26extern struct tvec_base boot_tvec_bases; 30extern struct tvec_base boot_tvec_bases;
27 31
32#ifdef CONFIG_LOCKDEP
33/*
34 * NB: because we have to copy the lockdep_map, setting the lockdep_map key
35 * (second argument) here is required, otherwise it could be initialised to
36 * the copy of the lockdep_map later! We use the pointer to and the string
37 * "<file>:<line>" as the key resp. the name of the lockdep_map.
38 */
39#define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) \
40 .lockdep_map = STATIC_LOCKDEP_MAP_INIT(_kn, &_kn),
41#else
42#define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn)
43#endif
44
28#define TIMER_INITIALIZER(_function, _expires, _data) { \ 45#define TIMER_INITIALIZER(_function, _expires, _data) { \
29 .entry = { .prev = TIMER_ENTRY_STATIC }, \ 46 .entry = { .prev = TIMER_ENTRY_STATIC }, \
30 .function = (_function), \ 47 .function = (_function), \
31 .expires = (_expires), \ 48 .expires = (_expires), \
32 .data = (_data), \ 49 .data = (_data), \
33 .base = &boot_tvec_bases, \ 50 .base = &boot_tvec_bases, \
51 __TIMER_LOCKDEP_MAP_INITIALIZER( \
52 __FILE__ ":" __stringify(__LINE__)) \
34 } 53 }
35 54
36#define DEFINE_TIMER(_name, _function, _expires, _data) \ 55#define DEFINE_TIMER(_name, _function, _expires, _data) \
37 struct timer_list _name = \ 56 struct timer_list _name = \
38 TIMER_INITIALIZER(_function, _expires, _data) 57 TIMER_INITIALIZER(_function, _expires, _data)
39 58
40void init_timer(struct timer_list *timer); 59void init_timer_key(struct timer_list *timer,
41void init_timer_deferrable(struct timer_list *timer); 60 const char *name,
61 struct lock_class_key *key);
62void init_timer_deferrable_key(struct timer_list *timer,
63 const char *name,
64 struct lock_class_key *key);
65
66#ifdef CONFIG_LOCKDEP
67#define init_timer(timer) \
68 do { \
69 static struct lock_class_key __key; \
70 init_timer_key((timer), #timer, &__key); \
71 } while (0)
72
73#define init_timer_deferrable(timer) \
74 do { \
75 static struct lock_class_key __key; \
76 init_timer_deferrable_key((timer), #timer, &__key); \
77 } while (0)
78
79#define init_timer_on_stack(timer) \
80 do { \
81 static struct lock_class_key __key; \
82 init_timer_on_stack_key((timer), #timer, &__key); \
83 } while (0)
84
85#define setup_timer(timer, fn, data) \
86 do { \
87 static struct lock_class_key __key; \
88 setup_timer_key((timer), #timer, &__key, (fn), (data));\
89 } while (0)
90
91#define setup_timer_on_stack(timer, fn, data) \
92 do { \
93 static struct lock_class_key __key; \
94 setup_timer_on_stack_key((timer), #timer, &__key, \
95 (fn), (data)); \
96 } while (0)
97#else
98#define init_timer(timer)\
99 init_timer_key((timer), NULL, NULL)
100#define init_timer_deferrable(timer)\
101 init_timer_deferrable_key((timer), NULL, NULL)
102#define init_timer_on_stack(timer)\
103 init_timer_on_stack_key((timer), NULL, NULL)
104#define setup_timer(timer, fn, data)\
105 setup_timer_key((timer), NULL, NULL, (fn), (data))
106#define setup_timer_on_stack(timer, fn, data)\
107 setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
108#endif
42 109
43#ifdef CONFIG_DEBUG_OBJECTS_TIMERS 110#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
44extern void init_timer_on_stack(struct timer_list *timer); 111extern void init_timer_on_stack_key(struct timer_list *timer,
112 const char *name,
113 struct lock_class_key *key);
45extern void destroy_timer_on_stack(struct timer_list *timer); 114extern void destroy_timer_on_stack(struct timer_list *timer);
46#else 115#else
47static inline void destroy_timer_on_stack(struct timer_list *timer) { } 116static inline void destroy_timer_on_stack(struct timer_list *timer) { }
48static inline void init_timer_on_stack(struct timer_list *timer) 117static inline void init_timer_on_stack_key(struct timer_list *timer,
118 const char *name,
119 struct lock_class_key *key)
49{ 120{
50 init_timer(timer); 121 init_timer_key(timer, name, key);
51} 122}
52#endif 123#endif
53 124
54static inline void setup_timer(struct timer_list * timer, 125static inline void setup_timer_key(struct timer_list * timer,
126 const char *name,
127 struct lock_class_key *key,
55 void (*function)(unsigned long), 128 void (*function)(unsigned long),
56 unsigned long data) 129 unsigned long data)
57{ 130{
58 timer->function = function; 131 timer->function = function;
59 timer->data = data; 132 timer->data = data;
60 init_timer(timer); 133 init_timer_key(timer, name, key);
61} 134}
62 135
63static inline void setup_timer_on_stack(struct timer_list *timer, 136static inline void setup_timer_on_stack_key(struct timer_list *timer,
137 const char *name,
138 struct lock_class_key *key,
64 void (*function)(unsigned long), 139 void (*function)(unsigned long),
65 unsigned long data) 140 unsigned long data)
66{ 141{
67 timer->function = function; 142 timer->function = function;
68 timer->data = data; 143 timer->data = data;
69 init_timer_on_stack(timer); 144 init_timer_on_stack_key(timer, name, key);
70} 145}
71 146
72/** 147/**
@@ -86,8 +161,8 @@ static inline int timer_pending(const struct timer_list * timer)
86 161
87extern void add_timer_on(struct timer_list *timer, int cpu); 162extern void add_timer_on(struct timer_list *timer, int cpu);
88extern int del_timer(struct timer_list * timer); 163extern int del_timer(struct timer_list * timer);
89extern int __mod_timer(struct timer_list *timer, unsigned long expires);
90extern int mod_timer(struct timer_list *timer, unsigned long expires); 164extern int mod_timer(struct timer_list *timer, unsigned long expires);
165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
91 166
92/* 167/*
93 * The jiffies value which is added to now, when there is no timer 168 * The jiffies value which is added to now, when there is no timer
@@ -146,25 +221,7 @@ static inline void timer_stats_timer_clear_start_info(struct timer_list *timer)
146} 221}
147#endif 222#endif
148 223
149/** 224extern void add_timer(struct timer_list *timer);
150 * add_timer - start a timer
151 * @timer: the timer to be added
152 *
153 * The kernel will do a ->function(->data) callback from the
154 * timer interrupt at the ->expires point in the future. The
155 * current time is 'jiffies'.
156 *
157 * The timer's ->expires, ->function (and if the handler uses it, ->data)
158 * fields must be set prior calling this function.
159 *
160 * Timers with an ->expires field in the past will be executed in the next
161 * timer tick.
162 */
163static inline void add_timer(struct timer_list *timer)
164{
165 BUG_ON(timer_pending(timer));
166 __mod_timer(timer, timer->expires);
167}
168 225
169#ifdef CONFIG_SMP 226#ifdef CONFIG_SMP
170 extern int try_to_del_timer_sync(struct timer_list *timer); 227 extern int try_to_del_timer_sync(struct timer_list *timer);
diff --git a/include/linux/timeriomem-rng.h b/include/linux/timeriomem-rng.h
new file mode 100644
index 000000000000..3e08a1c86830
--- /dev/null
+++ b/include/linux/timeriomem-rng.h
@@ -0,0 +1,21 @@
1/*
2 * linux/include/linux/timeriomem-rng.h
3 *
4 * Copyright (c) 2009 Alexander Clouter <alex@digriz.org.uk>
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/completion.h>
12
13struct timeriomem_rng_data {
14 struct completion completion;
15 unsigned int present:1;
16
17 void __iomem *address;
18
19 /* measures in usecs */
20 unsigned int period;
21};
diff --git a/include/linux/times.h b/include/linux/times.h
index e2d3020742a6..87b62615cedd 100644
--- a/include/linux/times.h
+++ b/include/linux/times.h
@@ -4,10 +4,10 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct tms { 6struct tms {
7 clock_t tms_utime; 7 __kernel_clock_t tms_utime;
8 clock_t tms_stime; 8 __kernel_clock_t tms_stime;
9 clock_t tms_cutime; 9 __kernel_clock_t tms_cutime;
10 clock_t tms_cstime; 10 __kernel_clock_t tms_cstime;
11}; 11};
12 12
13#endif 13#endif
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 998a55d80acf..aa3475fcff64 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -190,7 +190,7 @@ struct timex {
190 * offset and maximum frequency tolerance. 190 * offset and maximum frequency tolerance.
191 */ 191 */
192#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 192#define SHIFT_USEC 16 /* frequency offset scale (shift) */
193#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) 193#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
194#define PPM_SCALE_INV_SHIFT 19 194#define PPM_SCALE_INV_SHIFT 19
195#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ 195#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
196 PPM_SCALE + 1) 196 PPM_SCALE + 1)
diff --git a/include/linux/topology.h b/include/linux/topology.h
index e632d29f0544..7402c1a27c4f 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -38,11 +38,7 @@
38#endif 38#endif
39 39
40#ifndef nr_cpus_node 40#ifndef nr_cpus_node
41#define nr_cpus_node(node) \ 41#define nr_cpus_node(node) cpumask_weight(cpumask_of_node(node))
42 ({ \
43 node_to_cpumask_ptr(__tmp__, node); \
44 cpus_weight(*__tmp__); \
45 })
46#endif 42#endif
47 43
48#define for_each_node_with_cpus(node) \ 44#define for_each_node_with_cpus(node) \
@@ -193,5 +189,16 @@ int arch_update_cpu_topology(void);
193#ifndef topology_core_siblings 189#ifndef topology_core_siblings
194#define topology_core_siblings(cpu) cpumask_of_cpu(cpu) 190#define topology_core_siblings(cpu) cpumask_of_cpu(cpu)
195#endif 191#endif
192#ifndef topology_thread_cpumask
193#define topology_thread_cpumask(cpu) cpumask_of(cpu)
194#endif
195#ifndef topology_core_cpumask
196#define topology_core_cpumask(cpu) cpumask_of(cpu)
197#endif
198
199/* Returns the number of the current Node. */
200#ifndef numa_node_id
201#define numa_node_id() (cpu_to_node(raw_smp_processor_id()))
202#endif
196 203
197#endif /* _LINUX_TOPOLOGY_H */ 204#endif /* _LINUX_TOPOLOGY_H */
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
new file mode 100644
index 000000000000..3338b3f5c21a
--- /dev/null
+++ b/include/linux/tpm.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2004,2007,2008 IBM Corporation
3 *
4 * Authors:
5 * Leendert van Doorn <leendert@watson.ibm.com>
6 * Dave Safford <safford@watson.ibm.com>
7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com>
9 * Debora Velarde <dvelarde@us.ibm.com>
10 *
11 * Maintained by: <tpmdd_devel@lists.sourceforge.net>
12 *
13 * Device driver for TCG/TCPA TPM (trusted platform module).
14 * Specifications at www.trustedcomputinggroup.org
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation, version 2 of the
19 * License.
20 *
21 */
22#ifndef __LINUX_TPM_H__
23#define __LINUX_TPM_H__
24
25/*
26 * Chip num is this value or a valid tpm idx
27 */
28#define TPM_ANY_NUM 0xFFFF
29
30#if defined(CONFIG_TCG_TPM)
31
32extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf);
33extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash);
34#endif
35#endif
diff --git a/include/linux/trace_clock.h b/include/linux/trace_clock.h
new file mode 100644
index 000000000000..7a8130384087
--- /dev/null
+++ b/include/linux/trace_clock.h
@@ -0,0 +1,19 @@
1#ifndef _LINUX_TRACE_CLOCK_H
2#define _LINUX_TRACE_CLOCK_H
3
4/*
5 * 3 trace clock variants, with differing scalability/precision
6 * tradeoffs:
7 *
8 * - local: CPU-local trace clock
9 * - medium: scalable global clock with some jitter
10 * - global: globally monotonic, serialized clock
11 */
12#include <linux/compiler.h>
13#include <linux/types.h>
14
15extern u64 notrace trace_clock_local(void);
16extern u64 notrace trace_clock(void);
17extern u64 notrace trace_clock_global(void);
18
19#endif /* _LINUX_TRACE_CLOCK_H */
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 6186a789d6c7..c7aa154f4bfc 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -388,17 +388,14 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
388 * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal 388 * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal
389 * @task: task receiving the signal 389 * @task: task receiving the signal
390 * @sig: signal number being sent 390 * @sig: signal number being sent
391 * @handler: %SIG_IGN or %SIG_DFL
392 * 391 *
393 * Return zero iff tracing doesn't care to examine this ignored signal, 392 * Return zero iff tracing doesn't care to examine this ignored signal,
394 * so it can short-circuit normal delivery and never even get queued. 393 * so it can short-circuit normal delivery and never even get queued.
395 * Either @handler is %SIG_DFL and @sig's default is ignore, or it's %SIG_IGN.
396 * 394 *
397 * Called with @task->sighand->siglock held. 395 * Called with @task->sighand->siglock held.
398 */ 396 */
399static inline int tracehook_consider_ignored_signal(struct task_struct *task, 397static inline int tracehook_consider_ignored_signal(struct task_struct *task,
400 int sig, 398 int sig)
401 void __user *handler)
402{ 399{
403 return (task_ptrace(task) & PT_PTRACED) != 0; 400 return (task_ptrace(task) & PT_PTRACED) != 0;
404} 401}
@@ -407,19 +404,17 @@ static inline int tracehook_consider_ignored_signal(struct task_struct *task,
407 * tracehook_consider_fatal_signal - suppress special handling of fatal signal 404 * tracehook_consider_fatal_signal - suppress special handling of fatal signal
408 * @task: task receiving the signal 405 * @task: task receiving the signal
409 * @sig: signal number being sent 406 * @sig: signal number being sent
410 * @handler: %SIG_DFL or %SIG_IGN
411 * 407 *
412 * Return nonzero to prevent special handling of this termination signal. 408 * Return nonzero to prevent special handling of this termination signal.
413 * Normally @handler is %SIG_DFL. It can be %SIG_IGN if @sig is ignored, 409 * Normally handler for signal is %SIG_DFL. It can be %SIG_IGN if @sig is
414 * in which case force_sig() is about to reset it to %SIG_DFL. 410 * ignored, in which case force_sig() is about to reset it to %SIG_DFL.
415 * When this returns zero, this signal might cause a quick termination 411 * When this returns zero, this signal might cause a quick termination
416 * that does not give the debugger a chance to intercept the signal. 412 * that does not give the debugger a chance to intercept the signal.
417 * 413 *
418 * Called with or without @task->sighand->siglock held. 414 * Called with or without @task->sighand->siglock held.
419 */ 415 */
420static inline int tracehook_consider_fatal_signal(struct task_struct *task, 416static inline int tracehook_consider_fatal_signal(struct task_struct *task,
421 int sig, 417 int sig)
422 void __user *handler)
423{ 418{
424 return (task_ptrace(task) & PT_PTRACED) != 0; 419 return (task_ptrace(task) & PT_PTRACED) != 0;
425} 420}
@@ -507,7 +502,7 @@ static inline int tracehook_notify_jctl(int notify, int why)
507static inline int tracehook_notify_death(struct task_struct *task, 502static inline int tracehook_notify_death(struct task_struct *task,
508 void **death_cookie, int group_dead) 503 void **death_cookie, int group_dead)
509{ 504{
510 if (task->exit_signal == -1) 505 if (task_detached(task))
511 return task->ptrace ? SIGCHLD : DEATH_REAP; 506 return task->ptrace ? SIGCHLD : DEATH_REAP;
512 507
513 /* 508 /*
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 757005458366..d35a7ee7611f 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -31,8 +31,8 @@ struct tracepoint {
31 * Keep in sync with vmlinux.lds.h. 31 * Keep in sync with vmlinux.lds.h.
32 */ 32 */
33 33
34#define TPPROTO(args...) args 34#define TP_PROTO(args...) args
35#define TPARGS(args...) args 35#define TP_ARGS(args...) args
36 36
37#ifdef CONFIG_TRACEPOINTS 37#ifdef CONFIG_TRACEPOINTS
38 38
@@ -65,7 +65,7 @@ struct tracepoint {
65 { \ 65 { \
66 if (unlikely(__tracepoint_##name.state)) \ 66 if (unlikely(__tracepoint_##name.state)) \
67 __DO_TRACE(&__tracepoint_##name, \ 67 __DO_TRACE(&__tracepoint_##name, \
68 TPPROTO(proto), TPARGS(args)); \ 68 TP_PROTO(proto), TP_ARGS(args)); \
69 } \ 69 } \
70 static inline int register_trace_##name(void (*probe)(proto)) \ 70 static inline int register_trace_##name(void (*probe)(proto)) \
71 { \ 71 { \
@@ -153,4 +153,114 @@ static inline void tracepoint_synchronize_unregister(void)
153 synchronize_sched(); 153 synchronize_sched();
154} 154}
155 155
156#define PARAMS(args...) args
157#define TRACE_FORMAT(name, proto, args, fmt) \
158 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
159
160
161/*
162 * For use with the TRACE_EVENT macro:
163 *
164 * We define a tracepoint, its arguments, its printk format
165 * and its 'fast binay record' layout.
166 *
167 * Firstly, name your tracepoint via TRACE_EVENT(name : the
168 * 'subsystem_event' notation is fine.
169 *
170 * Think about this whole construct as the
171 * 'trace_sched_switch() function' from now on.
172 *
173 *
174 * TRACE_EVENT(sched_switch,
175 *
176 * *
177 * * A function has a regular function arguments
178 * * prototype, declare it via TP_PROTO():
179 * *
180 *
181 * TP_PROTO(struct rq *rq, struct task_struct *prev,
182 * struct task_struct *next),
183 *
184 * *
185 * * Define the call signature of the 'function'.
186 * * (Design sidenote: we use this instead of a
187 * * TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.)
188 * *
189 *
190 * TP_ARGS(rq, prev, next),
191 *
192 * *
193 * * Fast binary tracing: define the trace record via
194 * * TP_STRUCT__entry(). You can think about it like a
195 * * regular C structure local variable definition.
196 * *
197 * * This is how the trace record is structured and will
198 * * be saved into the ring buffer. These are the fields
199 * * that will be exposed to user-space in
200 * * /debug/tracing/events/<*>/format.
201 * *
202 * * The declared 'local variable' is called '__entry'
203 * *
204 * * __field(pid_t, prev_prid) is equivalent to a standard declariton:
205 * *
206 * * pid_t prev_pid;
207 * *
208 * * __array(char, prev_comm, TASK_COMM_LEN) is equivalent to:
209 * *
210 * * char prev_comm[TASK_COMM_LEN];
211 * *
212 *
213 * TP_STRUCT__entry(
214 * __array( char, prev_comm, TASK_COMM_LEN )
215 * __field( pid_t, prev_pid )
216 * __field( int, prev_prio )
217 * __array( char, next_comm, TASK_COMM_LEN )
218 * __field( pid_t, next_pid )
219 * __field( int, next_prio )
220 * ),
221 *
222 * *
223 * * Assign the entry into the trace record, by embedding
224 * * a full C statement block into TP_fast_assign(). You
225 * * can refer to the trace record as '__entry' -
226 * * otherwise you can put arbitrary C code in here.
227 * *
228 * * Note: this C code will execute every time a trace event
229 * * happens, on an active tracepoint.
230 * *
231 *
232 * TP_fast_assign(
233 * memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
234 * __entry->prev_pid = prev->pid;
235 * __entry->prev_prio = prev->prio;
236 * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
237 * __entry->next_pid = next->pid;
238 * __entry->next_prio = next->prio;
239 * )
240 *
241 * *
242 * * Formatted output of a trace record via TP_printk().
243 * * This is how the tracepoint will appear under ftrace
244 * * plugins that make use of this tracepoint.
245 * *
246 * * (raw-binary tracing wont actually perform this step.)
247 * *
248 *
249 * TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
250 * __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
251 * __entry->next_comm, __entry->next_pid, __entry->next_prio),
252 *
253 * );
254 *
255 * This macro construct is thus used for the regular printk format
256 * tracing setup, it is used to construct a function pointer based
257 * tracepoint callback (this is used by programmatic plugins and
258 * can also by used by generic instrumentation like SystemTap), and
259 * it is also used to expose a structured trace record in
260 * /debug/tracing/events/.
261 */
262
263#define TRACE_EVENT(name, proto, args, struct, assign, print) \
264 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
265
156#endif 266#endif
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 08e088334dba..bcba84ea2d86 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -252,8 +252,6 @@ struct tty_operations {
252 void (*set_ldisc)(struct tty_struct *tty); 252 void (*set_ldisc)(struct tty_struct *tty);
253 void (*wait_until_sent)(struct tty_struct *tty, int timeout); 253 void (*wait_until_sent)(struct tty_struct *tty, int timeout);
254 void (*send_xchar)(struct tty_struct *tty, char ch); 254 void (*send_xchar)(struct tty_struct *tty, char ch);
255 int (*read_proc)(char *page, char **start, off_t off,
256 int count, int *eof, void *data);
257 int (*tiocmget)(struct tty_struct *tty, struct file *file); 255 int (*tiocmget)(struct tty_struct *tty, struct file *file);
258 int (*tiocmset)(struct tty_struct *tty, struct file *file, 256 int (*tiocmset)(struct tty_struct *tty, struct file *file,
259 unsigned int set, unsigned int clear); 257 unsigned int set, unsigned int clear);
@@ -264,6 +262,7 @@ struct tty_operations {
264 int (*poll_get_char)(struct tty_driver *driver, int line); 262 int (*poll_get_char)(struct tty_driver *driver, int line);
265 void (*poll_put_char)(struct tty_driver *driver, int line, char ch); 263 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
266#endif 264#endif
265 const struct file_operations *proc_fops;
267}; 266};
268 267
269struct tty_driver { 268struct tty_driver {
@@ -310,7 +309,8 @@ extern void tty_set_operations(struct tty_driver *driver,
310extern struct tty_driver *tty_find_polling_driver(char *name, int *line); 309extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
311 310
312extern void tty_driver_kref_put(struct tty_driver *driver); 311extern void tty_driver_kref_put(struct tty_driver *driver);
313extern 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)
314{ 314{
315 kref_get(&d->kref); 315 kref_get(&d->kref);
316 return d; 316 return d;
diff --git a/include/linux/types.h b/include/linux/types.h
index 712ca53bc348..5abe354020f9 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -1,6 +1,9 @@
1#ifndef _LINUX_TYPES_H 1#ifndef _LINUX_TYPES_H
2#define _LINUX_TYPES_H 2#define _LINUX_TYPES_H
3 3
4#include <asm/types.h>
5
6#ifndef __ASSEMBLY__
4#ifdef __KERNEL__ 7#ifdef __KERNEL__
5 8
6#define DECLARE_BITMAP(name,bits) \ 9#define DECLARE_BITMAP(name,bits) \
@@ -9,9 +12,8 @@
9#endif 12#endif
10 13
11#include <linux/posix_types.h> 14#include <linux/posix_types.h>
12#include <asm/types.h>
13 15
14#ifndef __KERNEL_STRICT_NAMES 16#ifdef __KERNEL__
15 17
16typedef __u32 __kernel_dev_t; 18typedef __u32 __kernel_dev_t;
17 19
@@ -29,7 +31,6 @@ typedef __kernel_timer_t timer_t;
29typedef __kernel_clockid_t clockid_t; 31typedef __kernel_clockid_t clockid_t;
30typedef __kernel_mqd_t mqd_t; 32typedef __kernel_mqd_t mqd_t;
31 33
32#ifdef __KERNEL__
33typedef _Bool bool; 34typedef _Bool bool;
34 35
35typedef __kernel_uid32_t uid_t; 36typedef __kernel_uid32_t uid_t;
@@ -45,14 +46,6 @@ typedef __kernel_old_uid_t old_uid_t;
45typedef __kernel_old_gid_t old_gid_t; 46typedef __kernel_old_gid_t old_gid_t;
46#endif /* CONFIG_UID16 */ 47#endif /* CONFIG_UID16 */
47 48
48/* libc5 includes this file to define uid_t, thus uid_t can never change
49 * when it is included by non-kernel code
50 */
51#else
52typedef __kernel_uid_t uid_t;
53typedef __kernel_gid_t gid_t;
54#endif /* __KERNEL__ */
55
56#if defined(__GNUC__) 49#if defined(__GNUC__)
57typedef __kernel_loff_t loff_t; 50typedef __kernel_loff_t loff_t;
58#endif 51#endif
@@ -154,7 +147,7 @@ typedef unsigned long blkcnt_t;
154#define pgoff_t unsigned long 147#define pgoff_t unsigned long
155#endif 148#endif
156 149
157#endif /* __KERNEL_STRICT_NAMES */ 150#endif /* __KERNEL__ */
158 151
159/* 152/*
160 * Below are truly Linux-specific types that should never collide with 153 * Below are truly Linux-specific types that should never collide with
@@ -212,5 +205,5 @@ struct ustat {
212}; 205};
213 206
214#endif /* __KERNEL__ */ 207#endif /* __KERNEL__ */
215 208#endif /* __ASSEMBLY__ */
216#endif /* _LINUX_TYPES_H */ 209#endif /* _LINUX_TYPES_H */
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index a0bb6bd2e5c1..5dcc9ff72f69 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -22,6 +22,7 @@ struct uio_map;
22 22
23/** 23/**
24 * struct uio_mem - description of a UIO memory region 24 * struct uio_mem - description of a UIO memory region
25 * @name: name of the memory region for identification
25 * @addr: address of the device's memory 26 * @addr: address of the device's memory
26 * @size: size of IO 27 * @size: size of IO
27 * @memtype: type of memory addr points to 28 * @memtype: type of memory addr points to
@@ -29,6 +30,7 @@ struct uio_map;
29 * @map: for use by the UIO core only. 30 * @map: for use by the UIO core only.
30 */ 31 */
31struct uio_mem { 32struct uio_mem {
33 const char *name;
32 unsigned long addr; 34 unsigned long addr;
33 unsigned long size; 35 unsigned long size;
34 int memtype; 36 int memtype;
@@ -42,12 +44,14 @@ struct uio_portio;
42 44
43/** 45/**
44 * struct uio_port - description of a UIO port region 46 * struct uio_port - description of a UIO port region
47 * @name: name of the port region for identification
45 * @start: start of port region 48 * @start: start of port region
46 * @size: size of port region 49 * @size: size of port region
47 * @porttype: type of port (see UIO_PORT_* below) 50 * @porttype: type of port (see UIO_PORT_* below)
48 * @portio: for use by the UIO core only. 51 * @portio: for use by the UIO core only.
49 */ 52 */
50struct uio_port { 53struct uio_port {
54 const char *name;
51 unsigned long start; 55 unsigned long start;
52 unsigned long size; 56 unsigned long size;
53 int porttype; 57 int porttype;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 88079fd60235..3aa2cd1f8d08 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -643,186 +643,6 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
643 643
644/*-------------------------------------------------------------------------*/ 644/*-------------------------------------------------------------------------*/
645 645
646/**
647 * usb_endpoint_num - get the endpoint's number
648 * @epd: endpoint to be checked
649 *
650 * Returns @epd's number: 0 to 15.
651 */
652static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
653{
654 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
655}
656
657/**
658 * usb_endpoint_type - get the endpoint's transfer type
659 * @epd: endpoint to be checked
660 *
661 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
662 * to @epd's transfer type.
663 */
664static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
665{
666 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
667}
668
669/**
670 * usb_endpoint_dir_in - check if the endpoint has IN direction
671 * @epd: endpoint to be checked
672 *
673 * Returns true if the endpoint is of type IN, otherwise it returns false.
674 */
675static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
676{
677 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
678}
679
680/**
681 * usb_endpoint_dir_out - check if the endpoint has OUT direction
682 * @epd: endpoint to be checked
683 *
684 * Returns true if the endpoint is of type OUT, otherwise it returns false.
685 */
686static inline int usb_endpoint_dir_out(
687 const struct usb_endpoint_descriptor *epd)
688{
689 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
690}
691
692/**
693 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
694 * @epd: endpoint to be checked
695 *
696 * Returns true if the endpoint is of type bulk, otherwise it returns false.
697 */
698static inline int usb_endpoint_xfer_bulk(
699 const struct usb_endpoint_descriptor *epd)
700{
701 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
702 USB_ENDPOINT_XFER_BULK);
703}
704
705/**
706 * usb_endpoint_xfer_control - check if the endpoint has control transfer type
707 * @epd: endpoint to be checked
708 *
709 * Returns true if the endpoint is of type control, otherwise it returns false.
710 */
711static inline int usb_endpoint_xfer_control(
712 const struct usb_endpoint_descriptor *epd)
713{
714 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
715 USB_ENDPOINT_XFER_CONTROL);
716}
717
718/**
719 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
720 * @epd: endpoint to be checked
721 *
722 * Returns true if the endpoint is of type interrupt, otherwise it returns
723 * false.
724 */
725static inline int usb_endpoint_xfer_int(
726 const struct usb_endpoint_descriptor *epd)
727{
728 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
729 USB_ENDPOINT_XFER_INT);
730}
731
732/**
733 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
734 * @epd: endpoint to be checked
735 *
736 * Returns true if the endpoint is of type isochronous, otherwise it returns
737 * false.
738 */
739static inline int usb_endpoint_xfer_isoc(
740 const struct usb_endpoint_descriptor *epd)
741{
742 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
743 USB_ENDPOINT_XFER_ISOC);
744}
745
746/**
747 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
748 * @epd: endpoint to be checked
749 *
750 * Returns true if the endpoint has bulk transfer type and IN direction,
751 * otherwise it returns false.
752 */
753static inline int usb_endpoint_is_bulk_in(
754 const struct usb_endpoint_descriptor *epd)
755{
756 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
757}
758
759/**
760 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
761 * @epd: endpoint to be checked
762 *
763 * Returns true if the endpoint has bulk transfer type and OUT direction,
764 * otherwise it returns false.
765 */
766static inline int usb_endpoint_is_bulk_out(
767 const struct usb_endpoint_descriptor *epd)
768{
769 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
770}
771
772/**
773 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
774 * @epd: endpoint to be checked
775 *
776 * Returns true if the endpoint has interrupt transfer type and IN direction,
777 * otherwise it returns false.
778 */
779static inline int usb_endpoint_is_int_in(
780 const struct usb_endpoint_descriptor *epd)
781{
782 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
783}
784
785/**
786 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
787 * @epd: endpoint to be checked
788 *
789 * Returns true if the endpoint has interrupt transfer type and OUT direction,
790 * otherwise it returns false.
791 */
792static inline int usb_endpoint_is_int_out(
793 const struct usb_endpoint_descriptor *epd)
794{
795 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
796}
797
798/**
799 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
800 * @epd: endpoint to be checked
801 *
802 * Returns true if the endpoint has isochronous transfer type and IN direction,
803 * otherwise it returns false.
804 */
805static inline int usb_endpoint_is_isoc_in(
806 const struct usb_endpoint_descriptor *epd)
807{
808 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
809}
810
811/**
812 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
813 * @epd: endpoint to be checked
814 *
815 * Returns true if the endpoint has isochronous transfer type and OUT direction,
816 * otherwise it returns false.
817 */
818static inline int usb_endpoint_is_isoc_out(
819 const struct usb_endpoint_descriptor *epd)
820{
821 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
822}
823
824/*-------------------------------------------------------------------------*/
825
826#define USB_DEVICE_ID_MATCH_DEVICE \ 646#define USB_DEVICE_ID_MATCH_DEVICE \
827 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) 647 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
828#define USB_DEVICE_ID_MATCH_DEV_RANGE \ 648#define USB_DEVICE_ID_MATCH_DEV_RANGE \
@@ -1357,8 +1177,8 @@ struct urb {
1357 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1177 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
1358 void *transfer_buffer; /* (in) associated data buffer */ 1178 void *transfer_buffer; /* (in) associated data buffer */
1359 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1179 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1360 int transfer_buffer_length; /* (in) data buffer length */ 1180 u32 transfer_buffer_length; /* (in) data buffer length */
1361 int actual_length; /* (return) actual transfer length */ 1181 u32 actual_length; /* (return) actual transfer length */
1362 unsigned char *setup_packet; /* (in) setup packet (control only) */ 1182 unsigned char *setup_packet; /* (in) setup packet (control only) */
1363 dma_addr_t setup_dma; /* (in) dma addr for setup_packet */ 1183 dma_addr_t setup_dma; /* (in) dma addr for setup_packet */
1364 int start_frame; /* (modify) start frame (ISO) */ 1184 int start_frame; /* (modify) start frame (ISO) */
@@ -1567,6 +1387,7 @@ extern int usb_string(struct usb_device *dev, int index,
1567extern int usb_clear_halt(struct usb_device *dev, int pipe); 1387extern int usb_clear_halt(struct usb_device *dev, int pipe);
1568extern int usb_reset_configuration(struct usb_device *dev); 1388extern int usb_reset_configuration(struct usb_device *dev);
1569extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); 1389extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);
1390extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr);
1570 1391
1571/* this request isn't really synchronous, but it belongs with the others */ 1392/* this request isn't really synchronous, but it belongs with the others */
1572extern int usb_driver_set_configuration(struct usb_device *udev, int config); 1393extern int usb_driver_set_configuration(struct usb_device *udev, int config);
@@ -1671,14 +1492,6 @@ void usb_sg_wait(struct usb_sg_request *io);
1671#define usb_pipecontrol(pipe) (usb_pipetype((pipe)) == PIPE_CONTROL) 1492#define usb_pipecontrol(pipe) (usb_pipetype((pipe)) == PIPE_CONTROL)
1672#define usb_pipebulk(pipe) (usb_pipetype((pipe)) == PIPE_BULK) 1493#define usb_pipebulk(pipe) (usb_pipetype((pipe)) == PIPE_BULK)
1673 1494
1674/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
1675#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
1676#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
1677#define usb_settoggle(dev, ep, out, bit) \
1678 ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | \
1679 ((bit) << (ep)))
1680
1681
1682static inline unsigned int __create_pipe(struct usb_device *dev, 1495static inline unsigned int __create_pipe(struct usb_device *dev,
1683 unsigned int endpoint) 1496 unsigned int endpoint)
1684{ 1497{
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 3c86ed25a04c..c24124a42ce5 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -17,6 +17,7 @@
17#define USB_CDC_SUBCLASS_DMM 0x09 17#define USB_CDC_SUBCLASS_DMM 0x09
18#define USB_CDC_SUBCLASS_MDLM 0x0a 18#define USB_CDC_SUBCLASS_MDLM 0x0a
19#define USB_CDC_SUBCLASS_OBEX 0x0b 19#define USB_CDC_SUBCLASS_OBEX 0x0b
20#define USB_CDC_SUBCLASS_EEM 0x0c
20 21
21#define USB_CDC_PROTO_NONE 0 22#define USB_CDC_PROTO_NONE 0
22 23
@@ -28,6 +29,8 @@
28#define USB_CDC_ACM_PROTO_AT_CDMA 6 29#define USB_CDC_ACM_PROTO_AT_CDMA 6
29#define USB_CDC_ACM_PROTO_VENDOR 0xff 30#define USB_CDC_ACM_PROTO_VENDOR 0xff
30 31
32#define USB_CDC_PROTO_EEM 7
33
31/*-------------------------------------------------------------------------*/ 34/*-------------------------------------------------------------------------*/
32 35
33/* 36/*
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 9b42baed3900..b145119a90da 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -102,7 +102,7 @@
102#define USB_REQ_LOOPBACK_DATA_READ 0x16 102#define USB_REQ_LOOPBACK_DATA_READ 0x16
103#define USB_REQ_SET_INTERFACE_DS 0x17 103#define USB_REQ_SET_INTERFACE_DS 0x17
104 104
105/* The Link Power Mangement (LPM) ECN defines USB_REQ_TEST_AND_SET command, 105/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
106 * used by hubs to put ports into a new L1 suspend state, except that it 106 * used by hubs to put ports into a new L1 suspend state, except that it
107 * forgot to define its number ... 107 * forgot to define its number ...
108 */ 108 */
@@ -353,6 +353,185 @@ struct usb_endpoint_descriptor {
353#define USB_ENDPOINT_XFER_INT 3 353#define USB_ENDPOINT_XFER_INT 3
354#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 354#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
355 355
356/*-------------------------------------------------------------------------*/
357
358/**
359 * usb_endpoint_num - get the endpoint's number
360 * @epd: endpoint to be checked
361 *
362 * Returns @epd's number: 0 to 15.
363 */
364static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
365{
366 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
367}
368
369/**
370 * usb_endpoint_type - get the endpoint's transfer type
371 * @epd: endpoint to be checked
372 *
373 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
374 * to @epd's transfer type.
375 */
376static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
377{
378 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
379}
380
381/**
382 * usb_endpoint_dir_in - check if the endpoint has IN direction
383 * @epd: endpoint to be checked
384 *
385 * Returns true if the endpoint is of type IN, otherwise it returns false.
386 */
387static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
388{
389 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
390}
391
392/**
393 * usb_endpoint_dir_out - check if the endpoint has OUT direction
394 * @epd: endpoint to be checked
395 *
396 * Returns true if the endpoint is of type OUT, otherwise it returns false.
397 */
398static inline int usb_endpoint_dir_out(
399 const struct usb_endpoint_descriptor *epd)
400{
401 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
402}
403
404/**
405 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
406 * @epd: endpoint to be checked
407 *
408 * Returns true if the endpoint is of type bulk, otherwise it returns false.
409 */
410static inline int usb_endpoint_xfer_bulk(
411 const struct usb_endpoint_descriptor *epd)
412{
413 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
414 USB_ENDPOINT_XFER_BULK);
415}
416
417/**
418 * usb_endpoint_xfer_control - check if the endpoint has control transfer type
419 * @epd: endpoint to be checked
420 *
421 * Returns true if the endpoint is of type control, otherwise it returns false.
422 */
423static inline int usb_endpoint_xfer_control(
424 const struct usb_endpoint_descriptor *epd)
425{
426 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
427 USB_ENDPOINT_XFER_CONTROL);
428}
429
430/**
431 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
432 * @epd: endpoint to be checked
433 *
434 * Returns true if the endpoint is of type interrupt, otherwise it returns
435 * false.
436 */
437static inline int usb_endpoint_xfer_int(
438 const struct usb_endpoint_descriptor *epd)
439{
440 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
441 USB_ENDPOINT_XFER_INT);
442}
443
444/**
445 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
446 * @epd: endpoint to be checked
447 *
448 * Returns true if the endpoint is of type isochronous, otherwise it returns
449 * false.
450 */
451static inline int usb_endpoint_xfer_isoc(
452 const struct usb_endpoint_descriptor *epd)
453{
454 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
455 USB_ENDPOINT_XFER_ISOC);
456}
457
458/**
459 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
460 * @epd: endpoint to be checked
461 *
462 * Returns true if the endpoint has bulk transfer type and IN direction,
463 * otherwise it returns false.
464 */
465static inline int usb_endpoint_is_bulk_in(
466 const struct usb_endpoint_descriptor *epd)
467{
468 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
469}
470
471/**
472 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
473 * @epd: endpoint to be checked
474 *
475 * Returns true if the endpoint has bulk transfer type and OUT direction,
476 * otherwise it returns false.
477 */
478static inline int usb_endpoint_is_bulk_out(
479 const struct usb_endpoint_descriptor *epd)
480{
481 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
482}
483
484/**
485 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
486 * @epd: endpoint to be checked
487 *
488 * Returns true if the endpoint has interrupt transfer type and IN direction,
489 * otherwise it returns false.
490 */
491static inline int usb_endpoint_is_int_in(
492 const struct usb_endpoint_descriptor *epd)
493{
494 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
495}
496
497/**
498 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
499 * @epd: endpoint to be checked
500 *
501 * Returns true if the endpoint has interrupt transfer type and OUT direction,
502 * otherwise it returns false.
503 */
504static inline int usb_endpoint_is_int_out(
505 const struct usb_endpoint_descriptor *epd)
506{
507 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
508}
509
510/**
511 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
512 * @epd: endpoint to be checked
513 *
514 * Returns true if the endpoint has isochronous transfer type and IN direction,
515 * otherwise it returns false.
516 */
517static inline int usb_endpoint_is_isoc_in(
518 const struct usb_endpoint_descriptor *epd)
519{
520 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
521}
522
523/**
524 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
525 * @epd: endpoint to be checked
526 *
527 * Returns true if the endpoint has isochronous transfer type and OUT direction,
528 * otherwise it returns false.
529 */
530static inline int usb_endpoint_is_isoc_out(
531 const struct usb_endpoint_descriptor *epd)
532{
533 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
534}
356 535
357/*-------------------------------------------------------------------------*/ 536/*-------------------------------------------------------------------------*/
358 537
@@ -584,8 +763,8 @@ enum usb_device_state {
584 /* chapter 9 and authentication (wireless) device states */ 763 /* chapter 9 and authentication (wireless) device states */
585 USB_STATE_ATTACHED, 764 USB_STATE_ATTACHED,
586 USB_STATE_POWERED, /* wired */ 765 USB_STATE_POWERED, /* wired */
587 USB_STATE_UNAUTHENTICATED, /* auth */
588 USB_STATE_RECONNECTING, /* auth */ 766 USB_STATE_RECONNECTING, /* auth */
767 USB_STATE_UNAUTHENTICATED, /* auth */
589 USB_STATE_DEFAULT, /* limited function */ 768 USB_STATE_DEFAULT, /* limited function */
590 USB_STATE_ADDRESS, 769 USB_STATE_ADDRESS,
591 USB_STATE_CONFIGURED, /* most functions */ 770 USB_STATE_CONFIGURED, /* most functions */
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 935c380ffe47..acd7b0f06c8a 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -244,6 +244,10 @@ int usb_add_config(struct usb_composite_dev *,
244 * value; it should return zero on successful initialization. 244 * value; it should return zero on successful initialization.
245 * @unbind: Reverses @bind(); called as a side effect of unregistering 245 * @unbind: Reverses @bind(); called as a side effect of unregistering
246 * this driver. 246 * this driver.
247 * @suspend: Notifies when the host stops sending USB traffic,
248 * after function notifications
249 * @resume: Notifies configuration when the host restarts USB traffic,
250 * before function notifications
247 * 251 *
248 * Devices default to reporting self powered operation. Devices which rely 252 * Devices default to reporting self powered operation. Devices which rely
249 * on bus powered operation should report this in their @bind() method. 253 * on bus powered operation should report this in their @bind() method.
@@ -268,6 +272,10 @@ struct usb_composite_driver {
268 272
269 int (*bind)(struct usb_composite_dev *); 273 int (*bind)(struct usb_composite_dev *);
270 int (*unbind)(struct usb_composite_dev *); 274 int (*unbind)(struct usb_composite_dev *);
275
276 /* global suspend hooks */
277 void (*suspend)(struct usb_composite_dev *);
278 void (*resume)(struct usb_composite_dev *);
271}; 279};
272 280
273extern int usb_composite_register(struct usb_composite_driver *); 281extern int usb_composite_register(struct usb_composite_driver *);
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 0460a746480c..bbf45d500b6d 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -598,6 +598,7 @@ static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
598/** 598/**
599 * usb_gadget_vbus_connect - Notify controller that VBUS is powered 599 * usb_gadget_vbus_connect - Notify controller that VBUS is powered
600 * @gadget:The device which now has VBUS power. 600 * @gadget:The device which now has VBUS power.
601 * Context: can sleep
601 * 602 *
602 * This call is used by a driver for an external transceiver (or GPIO) 603 * This call is used by a driver for an external transceiver (or GPIO)
603 * that detects a VBUS power session starting. Common responses include 604 * that detects a VBUS power session starting. Common responses include
@@ -636,6 +637,7 @@ static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
636/** 637/**
637 * usb_gadget_vbus_disconnect - notify controller about VBUS session end 638 * usb_gadget_vbus_disconnect - notify controller about VBUS session end
638 * @gadget:the device whose VBUS supply is being described 639 * @gadget:the device whose VBUS supply is being described
640 * Context: can sleep
639 * 641 *
640 * This call is used by a driver for an external transceiver (or GPIO) 642 * This call is used by a driver for an external transceiver (or GPIO)
641 * that detects a VBUS power session ending. Common responses include 643 * that detects a VBUS power session ending. Common responses include
@@ -792,19 +794,20 @@ struct usb_gadget_driver {
792/** 794/**
793 * usb_gadget_register_driver - register a gadget driver 795 * usb_gadget_register_driver - register a gadget driver
794 * @driver:the driver being registered 796 * @driver:the driver being registered
797 * Context: can sleep
795 * 798 *
796 * Call this in your gadget driver's module initialization function, 799 * Call this in your gadget driver's module initialization function,
797 * to tell the underlying usb controller driver about your driver. 800 * to tell the underlying usb controller driver about your driver.
798 * The driver's bind() function will be called to bind it to a 801 * The driver's bind() function will be called to bind it to a
799 * gadget before this registration call returns. It's expected that 802 * gadget before this registration call returns. It's expected that
800 * the bind() functions will be in init sections. 803 * the bind() functions will be in init sections.
801 * This function must be called in a context that can sleep.
802 */ 804 */
803int usb_gadget_register_driver(struct usb_gadget_driver *driver); 805int usb_gadget_register_driver(struct usb_gadget_driver *driver);
804 806
805/** 807/**
806 * usb_gadget_unregister_driver - unregister a gadget driver 808 * usb_gadget_unregister_driver - unregister a gadget driver
807 * @driver:the driver being unregistered 809 * @driver:the driver being unregistered
810 * Context: can sleep
808 * 811 *
809 * Call this in your gadget driver's module cleanup function, 812 * Call this in your gadget driver's module cleanup function,
810 * to tell the underlying usb controller that your driver is 813 * to tell the underlying usb controller that your driver is
@@ -813,7 +816,6 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver);
813 * to unbind() and clean up any device state, before this procedure 816 * to unbind() and clean up any device state, before this procedure
814 * finally returns. It's expected that the unbind() functions 817 * finally returns. It's expected that the unbind() functions
815 * will in in exit sections, so may not be linked in some kernels. 818 * will in in exit sections, so may not be linked in some kernels.
816 * This function must be called in a context that can sleep.
817 */ 819 */
818int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); 820int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
819 821
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index d6aad0ea6033..d43755669261 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -7,6 +7,9 @@
7 * key configuration differences between boards. 7 * key configuration differences between boards.
8 */ 8 */
9 9
10#ifndef __LINUX_USB_MUSB_H
11#define __LINUX_USB_MUSB_H
12
10/* The USB role is defined by the connector used on the board, so long as 13/* The USB role is defined by the connector used on the board, so long as
11 * standards are being followed. (Developer boards sometimes won't.) 14 * standards are being followed. (Developer boards sometimes won't.)
12 */ 15 */
@@ -101,3 +104,5 @@ extern int __init tusb6010_setup_interface(
101extern int tusb6010_platform_retime(unsigned is_refclk); 104extern int tusb6010_platform_retime(unsigned is_refclk);
102 105
103#endif /* OMAP2 */ 106#endif /* OMAP2 */
107
108#endif /* __LINUX_USB_MUSB_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 94df4fe6c6c0..1aaa826396a1 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -80,12 +80,17 @@ struct otg_transceiver {
80 80
81/* for board-specific init logic */ 81/* for board-specific init logic */
82extern int otg_set_transceiver(struct otg_transceiver *); 82extern int otg_set_transceiver(struct otg_transceiver *);
83#ifdef CONFIG_NOP_USB_XCEIV
84extern void usb_nop_xceiv_register(void);
85extern void usb_nop_xceiv_unregister(void);
86#endif
83 87
84 88
85/* for usb host and peripheral controller drivers */ 89/* for usb host and peripheral controller drivers */
86extern struct otg_transceiver *otg_get_transceiver(void); 90extern struct otg_transceiver *otg_get_transceiver(void);
87extern void otg_put_transceiver(struct otg_transceiver *); 91extern void otg_put_transceiver(struct otg_transceiver *);
88 92
93/* Context: can sleep */
89static inline int 94static inline int
90otg_start_hnp(struct otg_transceiver *otg) 95otg_start_hnp(struct otg_transceiver *otg)
91{ 96{
@@ -102,6 +107,8 @@ otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
102 107
103 108
104/* for usb peripheral controller drivers */ 109/* for usb peripheral controller drivers */
110
111/* Context: can sleep */
105static inline int 112static inline int
106otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph) 113otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph)
107{ 114{
@@ -114,6 +121,7 @@ otg_set_power(struct otg_transceiver *otg, unsigned mA)
114 return otg->set_power(otg, mA); 121 return otg->set_power(otg, mA);
115} 122}
116 123
124/* Context: can sleep */
117static inline int 125static inline int
118otg_set_suspend(struct otg_transceiver *otg, int suspend) 126otg_set_suspend(struct otg_transceiver *otg, int suspend)
119{ 127{
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 7f6c603db654..2526f3bbd273 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -16,4 +16,7 @@
16/* device can't handle Set-Interface requests */ 16/* device can't handle Set-Interface requests */
17#define USB_QUIRK_NO_SET_INTF 0x00000004 17#define USB_QUIRK_NO_SET_INTF 0x00000004
18 18
19/* device can't handle its Configuration or Interface strings */
20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008
21
19#endif /* __LINUX_USB_QUIRKS_H */ 22#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 0a6e6d4b929a..37836b937d97 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -49,48 +49,45 @@ struct rndis_msg_hdr {
49 */ 49 */
50#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000) 50#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000)
51 51
52 52#define RNDIS_MSG_COMPLETION cpu_to_le32(0x80000000)
53#define ccpu2 __constant_cpu_to_le32
54
55#define RNDIS_MSG_COMPLETION ccpu2(0x80000000)
56 53
57/* codes for "msg_type" field of rndis messages; 54/* codes for "msg_type" field of rndis messages;
58 * only the data channel uses packet messages (maybe batched); 55 * only the data channel uses packet messages (maybe batched);
59 * everything else goes on the control channel. 56 * everything else goes on the control channel.
60 */ 57 */
61#define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */ 58#define RNDIS_MSG_PACKET cpu_to_le32(0x00000001) /* 1-N packets */
62#define RNDIS_MSG_INIT ccpu2(0x00000002) 59#define RNDIS_MSG_INIT cpu_to_le32(0x00000002)
63#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION) 60#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
64#define RNDIS_MSG_HALT ccpu2(0x00000003) 61#define RNDIS_MSG_HALT cpu_to_le32(0x00000003)
65#define RNDIS_MSG_QUERY ccpu2(0x00000004) 62#define RNDIS_MSG_QUERY cpu_to_le32(0x00000004)
66#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION) 63#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
67#define RNDIS_MSG_SET ccpu2(0x00000005) 64#define RNDIS_MSG_SET cpu_to_le32(0x00000005)
68#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION) 65#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
69#define RNDIS_MSG_RESET ccpu2(0x00000006) 66#define RNDIS_MSG_RESET cpu_to_le32(0x00000006)
70#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION) 67#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
71#define RNDIS_MSG_INDICATE ccpu2(0x00000007) 68#define RNDIS_MSG_INDICATE cpu_to_le32(0x00000007)
72#define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008) 69#define RNDIS_MSG_KEEPALIVE cpu_to_le32(0x00000008)
73#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) 70#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
74 71
75/* codes for "status" field of completion messages */ 72/* codes for "status" field of completion messages */
76#define RNDIS_STATUS_SUCCESS ccpu2(0x00000000) 73#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000)
77#define RNDIS_STATUS_FAILURE ccpu2(0xc0000001) 74#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001)
78#define RNDIS_STATUS_INVALID_DATA ccpu2(0xc0010015) 75#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015)
79#define RNDIS_STATUS_NOT_SUPPORTED ccpu2(0xc00000bb) 76#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb)
80#define RNDIS_STATUS_MEDIA_CONNECT ccpu2(0x4001000b) 77#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b)
81#define RNDIS_STATUS_MEDIA_DISCONNECT ccpu2(0x4001000c) 78#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c)
82 79
83/* codes for OID_GEN_PHYSICAL_MEDIUM */ 80/* codes for OID_GEN_PHYSICAL_MEDIUM */
84#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED ccpu2(0x00000000) 81#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000)
85#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN ccpu2(0x00000001) 82#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN cpu_to_le32(0x00000001)
86#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM ccpu2(0x00000002) 83#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM cpu_to_le32(0x00000002)
87#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE ccpu2(0x00000003) 84#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE cpu_to_le32(0x00000003)
88#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE ccpu2(0x00000004) 85#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE cpu_to_le32(0x00000004)
89#define RNDIS_PHYSICAL_MEDIUM_DSL ccpu2(0x00000005) 86#define RNDIS_PHYSICAL_MEDIUM_DSL cpu_to_le32(0x00000005)
90#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL ccpu2(0x00000006) 87#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL cpu_to_le32(0x00000006)
91#define RNDIS_PHYSICAL_MEDIUM_1394 ccpu2(0x00000007) 88#define RNDIS_PHYSICAL_MEDIUM_1394 cpu_to_le32(0x00000007)
92#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN ccpu2(0x00000008) 89#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN cpu_to_le32(0x00000008)
93#define RNDIS_PHYSICAL_MEDIUM_MAX ccpu2(0x00000009) 90#define RNDIS_PHYSICAL_MEDIUM_MAX cpu_to_le32(0x00000009)
94 91
95struct rndis_data_hdr { 92struct rndis_data_hdr {
96 __le32 msg_type; /* RNDIS_MSG_PACKET */ 93 __le32 msg_type; /* RNDIS_MSG_PACKET */
@@ -228,24 +225,24 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */
228 * there are gobs more that may optionally be supported. We'll avoid as much 225 * there are gobs more that may optionally be supported. We'll avoid as much
229 * of that mess as possible. 226 * of that mess as possible.
230 */ 227 */
231#define OID_802_3_PERMANENT_ADDRESS ccpu2(0x01010101) 228#define OID_802_3_PERMANENT_ADDRESS cpu_to_le32(0x01010101)
232#define OID_GEN_MAXIMUM_FRAME_SIZE ccpu2(0x00010106) 229#define OID_GEN_MAXIMUM_FRAME_SIZE cpu_to_le32(0x00010106)
233#define OID_GEN_CURRENT_PACKET_FILTER ccpu2(0x0001010e) 230#define OID_GEN_CURRENT_PACKET_FILTER cpu_to_le32(0x0001010e)
234#define OID_GEN_PHYSICAL_MEDIUM ccpu2(0x00010202) 231#define OID_GEN_PHYSICAL_MEDIUM cpu_to_le32(0x00010202)
235 232
236/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ 233/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
237#define RNDIS_PACKET_TYPE_DIRECTED ccpu2(0x00000001) 234#define RNDIS_PACKET_TYPE_DIRECTED cpu_to_le32(0x00000001)
238#define RNDIS_PACKET_TYPE_MULTICAST ccpu2(0x00000002) 235#define RNDIS_PACKET_TYPE_MULTICAST cpu_to_le32(0x00000002)
239#define RNDIS_PACKET_TYPE_ALL_MULTICAST ccpu2(0x00000004) 236#define RNDIS_PACKET_TYPE_ALL_MULTICAST cpu_to_le32(0x00000004)
240#define RNDIS_PACKET_TYPE_BROADCAST ccpu2(0x00000008) 237#define RNDIS_PACKET_TYPE_BROADCAST cpu_to_le32(0x00000008)
241#define RNDIS_PACKET_TYPE_SOURCE_ROUTING ccpu2(0x00000010) 238#define RNDIS_PACKET_TYPE_SOURCE_ROUTING cpu_to_le32(0x00000010)
242#define RNDIS_PACKET_TYPE_PROMISCUOUS ccpu2(0x00000020) 239#define RNDIS_PACKET_TYPE_PROMISCUOUS cpu_to_le32(0x00000020)
243#define RNDIS_PACKET_TYPE_SMT ccpu2(0x00000040) 240#define RNDIS_PACKET_TYPE_SMT cpu_to_le32(0x00000040)
244#define RNDIS_PACKET_TYPE_ALL_LOCAL ccpu2(0x00000080) 241#define RNDIS_PACKET_TYPE_ALL_LOCAL cpu_to_le32(0x00000080)
245#define RNDIS_PACKET_TYPE_GROUP ccpu2(0x00001000) 242#define RNDIS_PACKET_TYPE_GROUP cpu_to_le32(0x00001000)
246#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL ccpu2(0x00002000) 243#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL cpu_to_le32(0x00002000)
247#define RNDIS_PACKET_TYPE_FUNCTIONAL ccpu2(0x00004000) 244#define RNDIS_PACKET_TYPE_FUNCTIONAL cpu_to_le32(0x00004000)
248#define RNDIS_PACKET_TYPE_MAC_FRAME ccpu2(0x00008000) 245#define RNDIS_PACKET_TYPE_MAC_FRAME cpu_to_le32(0x00008000)
249 246
250/* default filter used with RNDIS devices */ 247/* default filter used with RNDIS devices */
251#define RNDIS_DEFAULT_FILTER ( \ 248#define RNDIS_DEFAULT_FILTER ( \
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 0b8617a9176d..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.
@@ -130,7 +133,8 @@ struct usb_serial {
130 struct usb_device *dev; 133 struct usb_device *dev;
131 struct usb_serial_driver *type; 134 struct usb_serial_driver *type;
132 struct usb_interface *interface; 135 struct usb_interface *interface;
133 unsigned char disconnected; 136 unsigned char disconnected:1;
137 unsigned char suspending:1;
134 unsigned char minor; 138 unsigned char minor;
135 unsigned char num_ports; 139 unsigned char num_ports;
136 unsigned char num_port_pointers; 140 unsigned char num_port_pointers;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 7d3822243074..36fabb95c7d3 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -176,6 +176,11 @@ struct skb_data { /* skb->cb is one of these */
176 size_t length; 176 size_t length;
177}; 177};
178 178
179extern int usbnet_open (struct net_device *net);
180extern int usbnet_stop (struct net_device *net);
181extern int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net);
182extern void usbnet_tx_timeout (struct net_device *net);
183extern int usbnet_change_mtu (struct net_device *net, int new_mtu);
179 184
180extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); 185extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
181extern void usbnet_defer_kevent (struct usbnet *, int); 186extern void usbnet_defer_kevent (struct usbnet *, int);
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
index 5f401b644ed5..429c631d2aad 100644
--- a/include/linux/usb/wusb.h
+++ b/include/linux/usb/wusb.h
@@ -80,8 +80,7 @@ struct wusb_ckhdid {
80 u8 data[16]; 80 u8 data[16];
81} __attribute__((packed)); 81} __attribute__((packed));
82 82
83const static 83static const struct wusb_ckhdid wusb_ckhdid_zero = { .data = { 0 } };
84struct wusb_ckhdid wusb_ckhdid_zero = { .data = { 0 } };
85 84
86#define WUSB_CKHDID_STRSIZE (3 * sizeof(struct wusb_ckhdid) + 1) 85#define WUSB_CKHDID_STRSIZE (3 * sizeof(struct wusb_ckhdid) + 1)
87 86
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 1eea1ab68dc4..3d15fb9bc116 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -96,39 +96,26 @@ enum { US_DO_ALL_FLAGS };
96#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */ 96#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */
97#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */ 97#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */
98#define US_PR_BULK 0x50 /* bulk only */ 98#define US_PR_BULK 0x50 /* bulk only */
99#ifdef CONFIG_USB_STORAGE_USBAT 99
100#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */ 100#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */
101#endif
102#ifdef CONFIG_USB_STORAGE_SDDR09
103#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */ 101#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
104#endif
105#ifdef CONFIG_USB_STORAGE_SDDR55
106#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */ 102#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */
107#endif
108#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */ 103#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
109#ifdef CONFIG_USB_STORAGE_FREECOM
110#define US_PR_FREECOM 0xf1 /* Freecom */ 104#define US_PR_FREECOM 0xf1 /* Freecom */
111#endif
112#ifdef CONFIG_USB_STORAGE_DATAFAB
113#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */ 105#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
114#endif
115#ifdef CONFIG_USB_STORAGE_JUMPSHOT
116#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */ 106#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
117#endif
118#ifdef CONFIG_USB_STORAGE_ALAUDA
119#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */ 107#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
120#endif
121#ifdef CONFIG_USB_STORAGE_KARMA
122#define US_PR_KARMA 0xf5 /* Rio Karma */ 108#define US_PR_KARMA 0xf5 /* Rio Karma */
123#endif
124 109
125#define US_PR_DEVICE 0xff /* Use device's value */ 110#define US_PR_DEVICE 0xff /* Use device's value */
126 111
127/* 112/*
128 */ 113 */
114extern int usb_usual_ignore_device(struct usb_interface *intf);
115extern struct usb_device_id usb_storage_usb_ids[];
116
129#ifdef CONFIG_USB_LIBUSUAL 117#ifdef CONFIG_USB_LIBUSUAL
130 118
131extern struct usb_device_id storage_usb_ids[];
132extern void usb_usual_set_present(int type); 119extern void usb_usual_set_present(int type);
133extern void usb_usual_clear_present(int type); 120extern void usb_usual_clear_present(int type);
134extern int usb_usual_check_type(const struct usb_device_id *, int type); 121extern int usb_usual_check_type(const struct usb_device_id *, int type);
diff --git a/include/linux/utime.h b/include/linux/utime.h
index 640be6a1959e..5cdf673afbdb 100644
--- a/include/linux/utime.h
+++ b/include/linux/utime.h
@@ -4,8 +4,8 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct utimbuf { 6struct utimbuf {
7 time_t actime; 7 __kernel_time_t actime;
8 time_t modtime; 8 __kernel_time_t modtime;
9}; 9};
10 10
11#endif 11#endif
diff --git a/include/linux/video_decoder.h b/include/linux/video_decoder.h
deleted file mode 100644
index e26c0c86a6ea..000000000000
--- a/include/linux/video_decoder.h
+++ /dev/null
@@ -1,48 +0,0 @@
1#ifndef _LINUX_VIDEO_DECODER_H
2#define _LINUX_VIDEO_DECODER_H
3
4#include <linux/types.h>
5
6#define HAVE_VIDEO_DECODER 1
7
8struct video_decoder_capability { /* this name is too long */
9 __u32 flags;
10#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */
11#define VIDEO_DECODER_NTSC 2 /* can decode NTSC */
12#define VIDEO_DECODER_SECAM 4 /* can decode SECAM */
13#define VIDEO_DECODER_AUTO 8 /* can autosense norm */
14#define VIDEO_DECODER_CCIR 16 /* CCIR-601 pixel rate (720 pixels per line) instead of square pixel rate */
15 int inputs; /* number of inputs */
16 int outputs; /* number of outputs */
17};
18
19/*
20DECODER_GET_STATUS returns the following flags. The only one you need is
21DECODER_STATUS_GOOD, the others are just nice things to know.
22*/
23#define DECODER_STATUS_GOOD 1 /* receiving acceptable input */
24#define DECODER_STATUS_COLOR 2 /* receiving color information */
25#define DECODER_STATUS_PAL 4 /* auto detected */
26#define DECODER_STATUS_NTSC 8 /* auto detected */
27#define DECODER_STATUS_SECAM 16 /* auto detected */
28
29struct video_decoder_init {
30 unsigned char len;
31 const unsigned char *data;
32};
33
34#define DECODER_GET_CAPABILITIES _IOR('d', 1, struct video_decoder_capability)
35#define DECODER_GET_STATUS _IOR('d', 2, int)
36#define DECODER_SET_NORM _IOW('d', 3, int)
37#define DECODER_SET_INPUT _IOW('d', 4, int) /* 0 <= input < #inputs */
38#define DECODER_SET_OUTPUT _IOW('d', 5, int) /* 0 <= output < #outputs */
39#define DECODER_ENABLE_OUTPUT _IOW('d', 6, int) /* boolean output enable control */
40#define DECODER_SET_PICTURE _IOW('d', 7, struct video_picture)
41#define DECODER_SET_GPIO _IOW('d', 8, int) /* switch general purpose pin */
42#define DECODER_INIT _IOW('d', 9, struct video_decoder_init) /* init internal registers at once */
43#define DECODER_SET_VBI_BYPASS _IOW('d', 10, int) /* switch vbi bypass */
44
45#define DECODER_DUMP _IO('d', 192) /* debug hook */
46
47
48#endif
diff --git a/include/linux/video_encoder.h b/include/linux/video_encoder.h
deleted file mode 100644
index b7b6423bbb8a..000000000000
--- a/include/linux/video_encoder.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _LINUX_VIDEO_ENCODER_H
2#define _LINUX_VIDEO_ENCODER_H
3
4#include <linux/types.h>
5
6struct video_encoder_capability { /* this name is too long */
7 __u32 flags;
8#define VIDEO_ENCODER_PAL 1 /* can encode PAL signal */
9#define VIDEO_ENCODER_NTSC 2 /* can encode NTSC */
10#define VIDEO_ENCODER_SECAM 4 /* can encode SECAM */
11#define VIDEO_ENCODER_CCIR 16 /* CCIR-601 pixel rate (720 pixels per line) instead of square pixel rate */
12 int inputs; /* number of inputs */
13 int outputs; /* number of outputs */
14};
15
16#define ENCODER_GET_CAPABILITIES _IOR('e', 1, struct video_encoder_capability)
17#define ENCODER_SET_NORM _IOW('e', 2, int)
18#define ENCODER_SET_INPUT _IOW('e', 3, int) /* 0 <= input < #inputs */
19#define ENCODER_SET_OUTPUT _IOW('e', 4, int) /* 0 <= output < #outputs */
20#define ENCODER_ENABLE_OUTPUT _IOW('e', 5, int) /* boolean output enable control */
21
22
23#endif
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 837f392fbe97..b19eab140977 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -16,6 +16,23 @@
16#include <linux/ioctl.h> 16#include <linux/ioctl.h>
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18 18
19#if defined(__MIN_V4L1) && defined (__KERNEL__)
20
21/*
22 * Used by those V4L2 core functions that need a minimum V4L1 support,
23 * in order to allow V4L1 Compatibilty code compilation.
24 */
25
26struct video_mbuf
27{
28 int size; /* Total memory to map */
29 int frames; /* Frames */
30 int offsets[VIDEO_MAX_FRAME];
31};
32
33#define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */
34
35#else
19#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) 36#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
20 37
21#define VID_TYPE_CAPTURE 1 /* Can capture */ 38#define VID_TYPE_CAPTURE 1 /* Can capture */
@@ -312,6 +329,7 @@ struct video_code
312#define VID_PLAY_END_MARK 14 329#define VID_PLAY_END_MARK 14
313 330
314#endif /* CONFIG_VIDEO_V4L1_COMPAT */ 331#endif /* CONFIG_VIDEO_V4L1_COMPAT */
332#endif /* __MIN_V4L1 */
315 333
316#endif /* __LINUX_VIDEODEV_H */ 334#endif /* __LINUX_VIDEODEV_H */
317 335
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 5571dbe1c0ad..ebb2ea6b4995 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -344,6 +344,8 @@ struct v4l2_pix_format {
344#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ 344#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
345#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ 345#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
346#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ 346#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
347#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
348#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
347#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 349#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
348#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ 350#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
349 351
@@ -735,6 +737,11 @@ struct v4l2_input {
735#define V4L2_IN_ST_NO_SIGNAL 0x00000002 737#define V4L2_IN_ST_NO_SIGNAL 0x00000002
736#define V4L2_IN_ST_NO_COLOR 0x00000004 738#define V4L2_IN_ST_NO_COLOR 0x00000004
737 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
738/* field 'status' - analog */ 745/* field 'status' - analog */
739#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 */
740#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ 747#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
@@ -829,6 +836,7 @@ struct v4l2_querymenu {
829#define V4L2_CTRL_FLAG_UPDATE 0x0008 836#define V4L2_CTRL_FLAG_UPDATE 0x0008
830#define V4L2_CTRL_FLAG_INACTIVE 0x0010 837#define V4L2_CTRL_FLAG_INACTIVE 0x0010
831#define V4L2_CTRL_FLAG_SLIDER 0x0020 838#define V4L2_CTRL_FLAG_SLIDER 0x0020
839#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
832 840
833/* Query flag, to be ORed with the control ID */ 841/* Query flag, to be ORed with the control ID */
834#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 842#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
@@ -879,8 +887,15 @@ enum v4l2_power_line_frequency {
879#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) 887#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
880#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) 888#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
881#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) 889#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
890#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
891enum v4l2_colorfx {
892 V4L2_COLORFX_NONE = 0,
893 V4L2_COLORFX_BW = 1,
894 V4L2_COLORFX_SEPIA = 2,
895};
896
882/* last CID + 1 */ 897/* last CID + 1 */
883#define V4L2_CID_LASTP1 (V4L2_CID_BASE+31) 898#define V4L2_CID_LASTP1 (V4L2_CID_BASE+32)
884 899
885/* MPEG-class control IDs defined by V4L2 */ 900/* MPEG-class control IDs defined by V4L2 */
886#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 901#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1339,6 +1354,53 @@ struct v4l2_sliced_vbi_data {
1339}; 1354};
1340 1355
1341/* 1356/*
1357 * Sliced VBI data inserted into MPEG Streams
1358 */
1359
1360/*
1361 * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
1362 *
1363 * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an
1364 * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
1365 * data
1366 *
1367 * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
1368 * definitions are not included here. See the MPEG-2 specifications for details
1369 * on these headers.
1370 */
1371
1372/* Line type IDs */
1373#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1)
1374#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4)
1375#define V4L2_MPEG_VBI_IVTV_WSS_625 (5)
1376#define V4L2_MPEG_VBI_IVTV_VPS (7)
1377
1378struct v4l2_mpeg_vbi_itv0_line {
1379 __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */
1380 __u8 data[42]; /* Sliced VBI data for the line */
1381} __attribute__ ((packed));
1382
1383struct v4l2_mpeg_vbi_itv0 {
1384 __le32 linemask[2]; /* Bitmasks of VBI service lines present */
1385 struct v4l2_mpeg_vbi_itv0_line line[35];
1386} __attribute__ ((packed));
1387
1388struct v4l2_mpeg_vbi_ITV0 {
1389 struct v4l2_mpeg_vbi_itv0_line line[36];
1390} __attribute__ ((packed));
1391
1392#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0"
1393#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0"
1394
1395struct v4l2_mpeg_vbi_fmt_ivtv {
1396 __u8 magic[4];
1397 union {
1398 struct v4l2_mpeg_vbi_itv0 itv0;
1399 struct v4l2_mpeg_vbi_ITV0 ITV0;
1400 };
1401} __attribute__ ((packed));
1402
1403/*
1342 * A G G R E G A T E S T R U C T U R E S 1404 * A G G R E G A T E S T R U C T U R E S
1343 */ 1405 */
1344 1406
@@ -1403,14 +1465,6 @@ struct v4l2_dbg_chip_ident {
1403 __u32 revision; /* chip revision, chip specific */ 1465 __u32 revision; /* chip revision, chip specific */
1404} __attribute__ ((packed)); 1466} __attribute__ ((packed));
1405 1467
1406/* VIDIOC_G_CHIP_IDENT_OLD: Deprecated, do not use */
1407struct v4l2_chip_ident_old {
1408 __u32 match_type; /* Match type */
1409 __u32 match_chip; /* Match this chip, meaning determined by match_type */
1410 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
1411 __u32 revision; /* chip revision, chip specific */
1412};
1413
1414/* 1468/*
1415 * I O C T L C O D E S F O R V I D E O D E V I C E S 1469 * I O C T L C O D E S F O R V I D E O D E V I C E S
1416 * 1470 *
@@ -1488,8 +1542,6 @@ struct v4l2_chip_ident_old {
1488/* Experimental, meant for debugging, testing and internal use. 1542/* Experimental, meant for debugging, testing and internal use.
1489 Never use this ioctl in applications! */ 1543 Never use this ioctl in applications! */
1490#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) 1544#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
1491/* This is deprecated and will go away in 2.6.30 */
1492#define VIDIOC_G_CHIP_IDENT_OLD _IOWR('V', 81, struct v4l2_chip_ident_old)
1493#endif 1545#endif
1494 1546
1495#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1547#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 3efa86c3ecb3..cec79adbe3ea 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -4,6 +4,7 @@
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/virtio_config.h> 6#include <linux/virtio_config.h>
7#include <linux/if_ether.h>
7 8
8/* The ID for virtio_net */ 9/* The ID for virtio_net */
9#define VIRTIO_ID_NET 1 10#define VIRTIO_ID_NET 1
@@ -22,11 +23,19 @@
22#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ 23#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
23#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ 24#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
24#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */ 25#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */
26#define VIRTIO_NET_F_STATUS 16 /* virtio_net_config.status available */
27#define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */
28#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */
29#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */
30
31#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
25 32
26struct virtio_net_config 33struct virtio_net_config
27{ 34{
28 /* The config defining mac address (if VIRTIO_NET_F_MAC) */ 35 /* The config defining mac address (if VIRTIO_NET_F_MAC) */
29 __u8 mac[6]; 36 __u8 mac[6];
37 /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */
38 __u16 status;
30} __attribute__((packed)); 39} __attribute__((packed));
31 40
32/* This is the first element of the scatter-gather list. If you don't 41/* This is the first element of the scatter-gather list. If you don't
@@ -54,4 +63,67 @@ struct virtio_net_hdr_mrg_rxbuf {
54 __u16 num_buffers; /* Number of merged rx buffers */ 63 __u16 num_buffers; /* Number of merged rx buffers */
55}; 64};
56 65
66/*
67 * Control virtqueue data structures
68 *
69 * The control virtqueue expects a header in the first sg entry
70 * and an ack/status response in the last entry. Data for the
71 * command goes in between.
72 */
73struct virtio_net_ctrl_hdr {
74 __u8 class;
75 __u8 cmd;
76} __attribute__((packed));
77
78typedef __u8 virtio_net_ctrl_ack;
79
80#define VIRTIO_NET_OK 0
81#define VIRTIO_NET_ERR 1
82
83/*
84 * Control the RX mode, ie. promisucous and allmulti. PROMISC and
85 * ALLMULTI commands require an "out" sg entry containing a 1 byte
86 * state value, zero = disable, non-zero = enable. These commands
87 * are supported with the VIRTIO_NET_F_CTRL_RX feature.
88 */
89#define VIRTIO_NET_CTRL_RX 0
90 #define VIRTIO_NET_CTRL_RX_PROMISC 0
91 #define VIRTIO_NET_CTRL_RX_ALLMULTI 1
92
93/*
94 * Control the MAC filter table.
95 *
96 * The MAC filter table is managed by the hypervisor, the guest should
97 * assume the size is infinite. Filtering should be considered
98 * non-perfect, ie. based on hypervisor resources, the guest may
99 * received packets from sources not specified in the filter list.
100 *
101 * In addition to the class/cmd header, the TABLE_SET command requires
102 * two out scatterlists. Each contains a 4 byte count of entries followed
103 * by a concatenated byte stream of the ETH_ALEN MAC addresses. The
104 * first sg list contains unicast addresses, the second is for multicast.
105 * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature
106 * is available.
107 */
108struct virtio_net_ctrl_mac {
109 __u32 entries;
110 __u8 macs[][ETH_ALEN];
111} __attribute__((packed));
112
113#define VIRTIO_NET_CTRL_MAC 1
114 #define VIRTIO_NET_CTRL_MAC_TABLE_SET 0
115
116/*
117 * Control VLAN filtering
118 *
119 * The VLAN filter table is controlled via a simple ADD/DEL interface.
120 * VLAN IDs not added may be filterd by the hypervisor. Del is the
121 * opposite of add. Both commands expect an out entry containing a 2
122 * byte VLAN ID. VLAN filterting is available with the
123 * VIRTIO_NET_F_CTRL_VLAN feature bit.
124 */
125#define VIRTIO_NET_CTRL_VLAN 2
126 #define VIRTIO_NET_CTRL_VLAN_ADD 0
127 #define VIRTIO_NET_CTRL_VLAN_DEL 1
128
57#endif /* _LINUX_VIRTIO_NET_H */ 129#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 9c0890c7a06a..a43ebec3a7b9 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -95,6 +95,9 @@ extern struct vm_struct *remove_vm_area(const void *addr);
95 95
96extern int map_vm_area(struct vm_struct *area, pgprot_t prot, 96extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
97 struct page ***pages); 97 struct page ***pages);
98extern int map_kernel_range_noflush(unsigned long start, unsigned long size,
99 pgprot_t prot, struct page **pages);
100extern void unmap_kernel_range_noflush(unsigned long addr, unsigned long size);
98extern void unmap_kernel_range(unsigned long addr, unsigned long size); 101extern void unmap_kernel_range(unsigned long addr, unsigned long size);
99 102
100/* Allocate/destroy a 'vmalloc' VM area. */ 103/* Allocate/destroy a 'vmalloc' VM area. */
@@ -110,5 +113,6 @@ extern long vwrite(char *buf, char *addr, unsigned long count);
110 */ 113 */
111extern rwlock_t vmlist_lock; 114extern rwlock_t vmlist_lock;
112extern struct vm_struct *vmlist; 115extern struct vm_struct *vmlist;
116extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
113 117
114#endif /* _LINUX_VMALLOC_H */ 118#endif /* _LINUX_VMALLOC_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a210ede73b56..bc024632f365 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -135,8 +135,11 @@ static inline void __remove_wait_queue(wait_queue_head_t *head,
135void __wake_up_common(wait_queue_head_t *q, unsigned int mode, 135void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
136 int nr_exclusive, int sync, void *key); 136 int nr_exclusive, int sync, void *key);
137void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 137void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
138extern void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); 138void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
139extern void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); 139void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr,
140 void *key);
141void __wake_up_locked(wait_queue_head_t *q, unsigned int mode);
142void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
140void __wake_up_bit(wait_queue_head_t *, void *, int); 143void __wake_up_bit(wait_queue_head_t *, void *, int);
141int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 144int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
142int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); 145int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
@@ -155,21 +158,17 @@ wait_queue_head_t *bit_waitqueue(void *, int);
155#define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) 158#define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL)
156#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1) 159#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1)
157 160
158#ifdef CONFIG_DEBUG_LOCK_ALLOC
159/* 161/*
160 * macro to avoid include hell 162 * Wakeup macros to be used to report events to the targets.
161 */ 163 */
162#define wake_up_nested(x, s) \ 164#define wake_up_poll(x, m) \
163do { \ 165 __wake_up(x, TASK_NORMAL, 1, (void *) (m))
164 unsigned long flags; \ 166#define wake_up_locked_poll(x, m) \
165 \ 167 __wake_up_locked_key((x), TASK_NORMAL, (void *) (m))
166 spin_lock_irqsave_nested(&(x)->lock, flags, (s)); \ 168#define wake_up_interruptible_poll(x, m) \
167 wake_up_locked(x); \ 169 __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m))
168 spin_unlock_irqrestore(&(x)->lock, flags); \ 170#define wake_up_interruptible_sync_poll(x, m) \
169} while (0) 171 __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m))
170#else
171#define wake_up_nested(x, s) wake_up(x)
172#endif
173 172
174#define __wait_event(wq, condition) \ 173#define __wait_event(wq, condition) \
175do { \ 174do { \
@@ -441,13 +440,15 @@ void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait,
441int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 440int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
442int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 441int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
443 442
444#define DEFINE_WAIT(name) \ 443#define DEFINE_WAIT_FUNC(name, function) \
445 wait_queue_t name = { \ 444 wait_queue_t name = { \
446 .private = current, \ 445 .private = current, \
447 .func = autoremove_wake_function, \ 446 .func = function, \
448 .task_list = LIST_HEAD_INIT((name).task_list), \ 447 .task_list = LIST_HEAD_INIT((name).task_list), \
449 } 448 }
450 449
450#define DEFINE_WAIT(name) DEFINE_WAIT_FUNC(name, autoremove_wake_function)
451
451#define DEFINE_WAIT_BIT(name, word, bit) \ 452#define DEFINE_WAIT_BIT(name, word, bit) \
452 struct wait_bit_queue name = { \ 453 struct wait_bit_queue name = { \
453 .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ 454 .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h
index ba0c49399a83..c703e0340423 100644
--- a/include/linux/wimax/debug.h
+++ b/include/linux/wimax/debug.h
@@ -178,7 +178,7 @@ void __d_head(char *head, size_t head_size,
178 WARN_ON(1); 178 WARN_ON(1);
179 } else 179 } else
180 snprintf(head, head_size, "%s %s: ", 180 snprintf(head, head_size, "%s %s: ",
181 dev_driver_string(dev), dev->bus_id); 181 dev_driver_string(dev), dev_name(dev));
182} 182}
183 183
184 184
diff --git a/include/linux/wimax/i2400m.h b/include/linux/wimax/i2400m.h
index 74198f5bb4dc..d5148a7889a6 100644
--- a/include/linux/wimax/i2400m.h
+++ b/include/linux/wimax/i2400m.h
@@ -207,6 +207,7 @@ enum i2400m_pt {
207 I2400M_PT_TRACE, /* For device debug */ 207 I2400M_PT_TRACE, /* For device debug */
208 I2400M_PT_RESET_WARM, /* device reset */ 208 I2400M_PT_RESET_WARM, /* device reset */
209 I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */ 209 I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */
210 I2400M_PT_EDATA, /* Extended RX data */
210 I2400M_PT_ILLEGAL 211 I2400M_PT_ILLEGAL
211}; 212};
212 213
@@ -221,6 +222,48 @@ struct i2400m_pl_data_hdr {
221} __attribute__((packed)); 222} __attribute__((packed));
222 223
223 224
225/*
226 * Payload for an extended data packet
227 *
228 * New in fw v1.4
229 *
230 * @reorder: if this payload has to be reorder or not (and how)
231 * @cs: the type of data in the packet, as defined per (802.16e
232 * T11.13.19.1). Currently only 2 (IPv4 packet) supported.
233 *
234 * This is prefixed to each and every INCOMING DATA packet.
235 */
236struct i2400m_pl_edata_hdr {
237 __le32 reorder; /* bits defined in i2400m_ro */
238 __u8 cs;
239 __u8 reserved[11];
240} __attribute__((packed));
241
242enum i2400m_cs {
243 I2400M_CS_IPV4_0 = 0,
244 I2400M_CS_IPV4 = 2,
245};
246
247enum i2400m_ro {
248 I2400M_RO_NEEDED = 0x01,
249 I2400M_RO_TYPE = 0x03,
250 I2400M_RO_TYPE_SHIFT = 1,
251 I2400M_RO_CIN = 0x0f,
252 I2400M_RO_CIN_SHIFT = 4,
253 I2400M_RO_FBN = 0x07ff,
254 I2400M_RO_FBN_SHIFT = 8,
255 I2400M_RO_SN = 0x07ff,
256 I2400M_RO_SN_SHIFT = 21,
257};
258
259enum i2400m_ro_type {
260 I2400M_RO_TYPE_RESET = 0,
261 I2400M_RO_TYPE_PACKET,
262 I2400M_RO_TYPE_WS,
263 I2400M_RO_TYPE_PACKET_WS,
264};
265
266
224/* Misc constants */ 267/* Misc constants */
225enum { 268enum {
226 I2400M_PL_PAD = 16, /* Payload data size alignment */ 269 I2400M_PL_PAD = 16, /* Payload data size alignment */
@@ -381,6 +424,9 @@ enum i2400m_tlv {
381 I2400M_TLV_RF_STATUS = 163, 424 I2400M_TLV_RF_STATUS = 163,
382 I2400M_TLV_DEVICE_RESET_TYPE = 132, 425 I2400M_TLV_DEVICE_RESET_TYPE = 132,
383 I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601, 426 I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601,
427 I2400M_TLV_CONFIG_IDLE_TIMEOUT = 611,
428 I2400M_TLV_CONFIG_D2H_DATA_FORMAT = 614,
429 I2400M_TLV_CONFIG_DL_HOST_REORDER = 615,
384}; 430};
385 431
386 432
@@ -509,4 +555,27 @@ struct i2400m_tlv_media_status {
509 __le32 media_status; 555 __le32 media_status;
510} __attribute__((packed)); 556} __attribute__((packed));
511 557
558
559/* New in v1.4 */
560struct i2400m_tlv_config_idle_timeout {
561 struct i2400m_tlv_hdr hdr;
562 __le32 timeout; /* 100 to 300000 ms [5min], 100 increments
563 * 0 disabled */
564} __attribute__((packed));
565
566/* New in v1.4 -- for backward compat, will be removed */
567struct i2400m_tlv_config_d2h_data_format {
568 struct i2400m_tlv_hdr hdr;
569 __u8 format; /* 0 old format, 1 enhanced */
570 __u8 reserved[3];
571} __attribute__((packed));
572
573/* New in v1.4 */
574struct i2400m_tlv_config_dl_host_reorder {
575 struct i2400m_tlv_hdr hdr;
576 __u8 reorder; /* 0 disabled, 1 enabled */
577 __u8 reserved[3];
578} __attribute__((packed));
579
580
512#endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */ 581#endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index d7958f9b52cb..cb24204851f7 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -577,18 +577,22 @@
577#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 577#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8
578#define IW_AUTH_ROAMING_CONTROL 9 578#define IW_AUTH_ROAMING_CONTROL 9
579#define IW_AUTH_PRIVACY_INVOKED 10 579#define IW_AUTH_PRIVACY_INVOKED 10
580#define IW_AUTH_CIPHER_GROUP_MGMT 11
581#define IW_AUTH_MFP 12
580 582
581/* IW_AUTH_WPA_VERSION values (bit field) */ 583/* IW_AUTH_WPA_VERSION values (bit field) */
582#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 584#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001
583#define IW_AUTH_WPA_VERSION_WPA 0x00000002 585#define IW_AUTH_WPA_VERSION_WPA 0x00000002
584#define IW_AUTH_WPA_VERSION_WPA2 0x00000004 586#define IW_AUTH_WPA_VERSION_WPA2 0x00000004
585 587
586/* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */ 588/* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT
589 * values (bit field) */
587#define IW_AUTH_CIPHER_NONE 0x00000001 590#define IW_AUTH_CIPHER_NONE 0x00000001
588#define IW_AUTH_CIPHER_WEP40 0x00000002 591#define IW_AUTH_CIPHER_WEP40 0x00000002
589#define IW_AUTH_CIPHER_TKIP 0x00000004 592#define IW_AUTH_CIPHER_TKIP 0x00000004
590#define IW_AUTH_CIPHER_CCMP 0x00000008 593#define IW_AUTH_CIPHER_CCMP 0x00000008
591#define IW_AUTH_CIPHER_WEP104 0x00000010 594#define IW_AUTH_CIPHER_WEP104 0x00000010
595#define IW_AUTH_CIPHER_AES_CMAC 0x00000020
592 596
593/* IW_AUTH_KEY_MGMT values (bit field) */ 597/* IW_AUTH_KEY_MGMT values (bit field) */
594#define IW_AUTH_KEY_MGMT_802_1X 1 598#define IW_AUTH_KEY_MGMT_802_1X 1
@@ -604,6 +608,11 @@
604#define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming 608#define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming
605 * control */ 609 * control */
606 610
611/* IW_AUTH_MFP (management frame protection) values */
612#define IW_AUTH_MFP_DISABLED 0 /* MFP disabled */
613#define IW_AUTH_MFP_OPTIONAL 1 /* MFP optional */
614#define IW_AUTH_MFP_REQUIRED 2 /* MFP required */
615
607/* SIOCSIWENCODEEXT definitions */ 616/* SIOCSIWENCODEEXT definitions */
608#define IW_ENCODE_SEQ_MAX_SIZE 8 617#define IW_ENCODE_SEQ_MAX_SIZE 8
609/* struct iw_encode_ext ->alg */ 618/* struct iw_encode_ext ->alg */
@@ -612,6 +621,7 @@
612#define IW_ENCODE_ALG_TKIP 2 621#define IW_ENCODE_ALG_TKIP 2
613#define IW_ENCODE_ALG_CCMP 3 622#define IW_ENCODE_ALG_CCMP 3
614#define IW_ENCODE_ALG_PMK 4 623#define IW_ENCODE_ALG_PMK 4
624#define IW_ENCODE_ALG_AES_CMAC 5
615/* struct iw_encode_ext ->ext_flags */ 625/* struct iw_encode_ext ->ext_flags */
616#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 626#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001
617#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 627#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 3cd51e579ab1..13e1adf55c4c 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -41,6 +41,11 @@ struct delayed_work {
41 struct timer_list timer; 41 struct timer_list timer;
42}; 42};
43 43
44static inline struct delayed_work *to_delayed_work(struct work_struct *work)
45{
46 return container_of(work, struct delayed_work, work);
47}
48
44struct execute_work { 49struct execute_work {
45 struct work_struct work; 50 struct work_struct work;
46}; 51};
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 7300ecdc480c..9c1ed1fb6ddb 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -109,8 +109,8 @@ extern int dirty_background_ratio;
109extern unsigned long dirty_background_bytes; 109extern unsigned long dirty_background_bytes;
110extern int vm_dirty_ratio; 110extern int vm_dirty_ratio;
111extern unsigned long vm_dirty_bytes; 111extern unsigned long vm_dirty_bytes;
112extern int dirty_writeback_interval; 112extern unsigned int dirty_writeback_interval;
113extern int dirty_expire_interval; 113extern unsigned int dirty_expire_interval;
114extern int vm_highmem_is_dirtyable; 114extern int vm_highmem_is_dirtyable;
115extern int block_dump; 115extern int block_dump;
116extern int laptop_mode; 116extern int laptop_mode;
@@ -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/linux/xfrm.h b/include/linux/xfrm.h
index 52f3abd453a1..2d4ec15abaca 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -58,7 +58,7 @@ struct xfrm_selector
58 __u8 prefixlen_s; 58 __u8 prefixlen_s;
59 __u8 proto; 59 __u8 proto;
60 int ifindex; 60 int ifindex;
61 uid_t user; 61 __kernel_uid32_t user;
62}; 62};
63 63
64#define XFRM_INF (~(__u64)0) 64#define XFRM_INF (~(__u64)0)
diff --git a/include/media/bt819.h b/include/media/bt819.h
new file mode 100644
index 000000000000..38f666bde77a
--- /dev/null
+++ b/include/media/bt819.h
@@ -0,0 +1,33 @@
1/*
2 bt819.h - bt819 notifications
3
4 Copyright (C) 2009 Hans Verkuil (hverkuil@xs4all.nl)
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., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _BT819_H_
22#define _BT819_H_
23
24#include <linux/ioctl.h>
25
26/* v4l2_device notifications. */
27
28/* Needed to reset the FIFO buffer when changing the input
29 or the video standard. */
30#define BT819_FIFO_RESET_LOW _IO('b', 0)
31#define BT819_FIFO_RESET_HIGH _IO('b', 1)
32
33#endif
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index 9ec4d5889ef5..9ebe8558b9b6 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -1,5 +1,5 @@
1/* 1/*
2 cx23415/6 header containing common defines. 2 cx23415/6/8 header containing common defines.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@ enum cx2341x_port {
28enum cx2341x_cap { 28enum cx2341x_cap {
29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0, 29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0,
30 CX2341X_CAP_HAS_TS = 1 << 1, 30 CX2341X_CAP_HAS_TS = 1 << 1,
31 CX2341X_CAP_HAS_AC3 = 1 << 2,
31}; 32};
32 33
33struct cx2341x_mpeg_params { 34struct cx2341x_mpeg_params {
@@ -47,11 +48,12 @@ struct cx2341x_mpeg_params {
47 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq; 48 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;
48 enum v4l2_mpeg_audio_encoding audio_encoding; 49 enum v4l2_mpeg_audio_encoding audio_encoding;
49 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate; 50 enum v4l2_mpeg_audio_l2_bitrate audio_l2_bitrate;
51 enum v4l2_mpeg_audio_ac3_bitrate audio_ac3_bitrate;
50 enum v4l2_mpeg_audio_mode audio_mode; 52 enum v4l2_mpeg_audio_mode audio_mode;
51 enum v4l2_mpeg_audio_mode_extension audio_mode_extension; 53 enum v4l2_mpeg_audio_mode_extension audio_mode_extension;
52 enum v4l2_mpeg_audio_emphasis audio_emphasis; 54 enum v4l2_mpeg_audio_emphasis audio_emphasis;
53 enum v4l2_mpeg_audio_crc audio_crc; 55 enum v4l2_mpeg_audio_crc audio_crc;
54 u16 audio_properties; 56 u32 audio_properties;
55 u16 audio_mute; 57 u16 audio_mute;
56 58
57 /* video */ 59 /* video */
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index db431d513f2f..2c3fbaa33f74 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -21,6 +21,18 @@
21#ifndef _CX25840_H_ 21#ifndef _CX25840_H_
22#define _CX25840_H_ 22#define _CX25840_H_
23 23
24/* Note that the cx25840 driver requires that the bridge driver calls the
25 v4l2_subdev's init operation in order to load the driver's firmware.
26 Without this the audio standard detection will fail and you will
27 only get mono.
28
29 Since loading the firmware is often problematic when the driver is
30 compiled into the kernel I recommend postponing calling this function
31 until the first open of the video device. Another reason for
32 postponing it is that loading this firmware takes a long time (seconds)
33 due to the slow i2c bus speed. So it will speed up the boot process if
34 you can avoid loading the fw as long as the video device isn't used. */
35
24enum cx25840_video_input { 36enum cx25840_video_input {
25 /* Composite video inputs In1-In8 */ 37 /* Composite video inputs In1-In8 */
26 CX25840_COMPOSITE1 = 1, 38 CX25840_COMPOSITE1 = 1,
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 5bf2ea00678c..7b5b91f60425 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -111,6 +111,7 @@ extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE];
111extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE]; 111extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE];
112extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE]; 112extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE];
113extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE]; 113extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE];
114extern IR_KEYTAB_TYPE ir_codes_avermedia_cardbus[IR_KEYTAB_SIZE];
114extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE]; 115extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE];
115extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; 116extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE];
116extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE]; 117extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE];
@@ -159,6 +160,8 @@ extern IR_KEYTAB_TYPE ir_codes_real_audio_220_32_keys[IR_KEYTAB_SIZE];
159extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE]; 160extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE];
160extern IR_KEYTAB_TYPE ir_codes_ati_tv_wonder_hd_600[IR_KEYTAB_SIZE]; 161extern IR_KEYTAB_TYPE ir_codes_ati_tv_wonder_hd_600[IR_KEYTAB_SIZE];
161extern IR_KEYTAB_TYPE ir_codes_kworld_plus_tv_analog[IR_KEYTAB_SIZE]; 162extern IR_KEYTAB_TYPE ir_codes_kworld_plus_tv_analog[IR_KEYTAB_SIZE];
163extern IR_KEYTAB_TYPE ir_codes_kaiomy[IR_KEYTAB_SIZE];
164extern IR_KEYTAB_TYPE ir_codes_dm1105_nec[IR_KEYTAB_SIZE];
162#endif 165#endif
163 166
164/* 167/*
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 00fa57eb9fde..07963d705400 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -14,8 +14,7 @@ struct IR_i2c {
14 /* Used to avoid fast repeating */ 14 /* Used to avoid fast repeating */
15 unsigned char old; 15 unsigned char old;
16 16
17 struct work_struct work; 17 struct delayed_work work;
18 struct timer_list timer;
19 char phys[32]; 18 char phys[32];
20 int (*get_key)(struct IR_i2c*, u32*, u32*); 19 int (*get_key)(struct IR_i2c*, u32*, u32*);
21}; 20};
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 e391d55edb95..30d9629198ef 100644
--- a/include/media/ov772x.h
+++ b/include/media/ov772x.h
@@ -13,9 +13,49 @@
13 13
14#include <media/soc_camera.h> 14#include <media/soc_camera.h>
15 15
16/* for flags */
17#define OV772X_FLAG_VFLIP 0x00000001 /* Vertical flip image */
18#define OV772X_FLAG_HFLIP 0x00000002 /* Horizontal flip image */
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 */
16struct ov772x_camera_info { 54struct ov772x_camera_info {
17 unsigned long buswidth; 55 unsigned long buswidth;
56 unsigned long flags;
18 struct soc_camera_link link; 57 struct soc_camera_link link;
58 struct ov772x_edge_ctrl edgectrl;
19}; 59};
20 60
21#endif /* __OV772X_H__ */ 61#endif /* __OV772X_H__ */
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index c5a6e22a4b37..7a9f76ecbbbd 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -13,11 +13,12 @@
13#include <linux/stringify.h> 13#include <linux/stringify.h>
14#include <linux/mutex.h> 14#include <linux/mutex.h>
15#include <linux/scatterlist.h> 15#include <linux/scatterlist.h>
16#include <media/v4l2-device.h>
16 17
17#include <linux/vmalloc.h> /* for vmalloc() */ 18#include <linux/vmalloc.h> /* for vmalloc() */
18#include <linux/mm.h> /* for vmalloc_to_page() */ 19#include <linux/mm.h> /* for vmalloc_to_page() */
19 20
20#define SAA7146_VERSION_CODE 0x000500 /* 0.5.0 */ 21#define SAA7146_VERSION_CODE 0x000600 /* 0.6.0 */
21 22
22#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) 23#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr)))
23#define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) 24#define saa7146_read(sxy,adr) readl(sxy->mem+(adr))
@@ -110,6 +111,8 @@ struct saa7146_dev
110 111
111 struct list_head item; 112 struct list_head item;
112 113
114 struct v4l2_device v4l2_dev;
115
113 /* different device locks */ 116 /* different device locks */
114 spinlock_t slock; 117 spinlock_t slock;
115 struct mutex lock; 118 struct mutex lock;
@@ -145,6 +148,11 @@ struct saa7146_dev
145 struct saa7146_dma d_rps1; 148 struct saa7146_dma d_rps1;
146}; 149};
147 150
151static inline struct saa7146_dev *to_saa7146_dev(struct v4l2_device *v4l2_dev)
152{
153 return container_of(v4l2_dev, struct saa7146_dev, v4l2_dev);
154}
155
148/* from saa7146_i2c.c */ 156/* from saa7146_i2c.c */
149int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); 157int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate);
150 158
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index c8d0b23fde29..eed5fccc83f3 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -150,16 +150,6 @@ struct saa7146_vv
150 unsigned int resources; /* resource management for device */ 150 unsigned int resources; /* resource management for device */
151}; 151};
152 152
153#define SAA7146_EXCLUSIVE 0x1
154#define SAA7146_BEFORE 0x2
155#define SAA7146_AFTER 0x4
156
157struct saa7146_extension_ioctls
158{
159 unsigned int cmd;
160 int flags;
161};
162
163/* flags */ 153/* flags */
164#define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */ 154#define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */
165 155
@@ -176,8 +166,10 @@ struct saa7146_ext_vv
176 int num_stds; 166 int num_stds;
177 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); 167 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *);
178 168
179 struct saa7146_extension_ioctls *ioctls; 169 /* the extension can override this */
180 long (*ioctl)(struct saa7146_fh *, unsigned int cmd, void *arg); 170 struct v4l2_ioctl_ops ops;
171 /* pointer to the saa7146 core ops */
172 const struct v4l2_ioctl_ops *core_ops;
181 173
182 struct v4l2_file_operations vbi_fops; 174 struct v4l2_file_operations vbi_fops;
183}; 175};
@@ -213,6 +205,7 @@ void saa7146_set_hps_source_and_sync(struct saa7146_dev *saa, int source, int sy
213void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data); 205void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data);
214 206
215/* from saa7146_video.c */ 207/* from saa7146_video.c */
208extern const struct v4l2_ioctl_ops saa7146_video_ioctl_ops;
216extern struct saa7146_use_ops saa7146_video_uops; 209extern struct saa7146_use_ops saa7146_video_uops;
217int saa7146_start_preview(struct saa7146_fh *fh); 210int saa7146_start_preview(struct saa7146_fh *fh);
218int saa7146_stop_preview(struct saa7146_fh *fh); 211int saa7146_stop_preview(struct saa7146_fh *fh);
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index b5dbefea3740..0f3524cff435 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -1,10 +1,11 @@
1#ifndef __ASM_SH_MOBILE_CEU_H__ 1#ifndef __ASM_SH_MOBILE_CEU_H__
2#define __ASM_SH_MOBILE_CEU_H__ 2#define __ASM_SH_MOBILE_CEU_H__
3 3
4#include <media/soc_camera.h> 4#define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */
5#define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */
5 6
6struct sh_mobile_ceu_info { 7struct sh_mobile_ceu_info {
7 unsigned long flags; /* SOCAM_... */ 8 unsigned long flags;
8}; 9};
9 10
10#endif /* __ASM_SH_MOBILE_CEU_H__ */ 11#endif /* __ASM_SH_MOBILE_CEU_H__ */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 7440d9250665..37013688af44 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -45,6 +45,7 @@ struct soc_camera_device {
45 int num_formats; 45 int num_formats;
46 struct soc_camera_format_xlate *user_formats; 46 struct soc_camera_format_xlate *user_formats;
47 int num_user_formats; 47 int num_user_formats;
48 enum v4l2_field field; /* Preserve field over close() */
48 struct module *owner; 49 struct module *owner;
49 void *host_priv; /* Per-device host private data */ 50 void *host_priv; /* Per-device host private data */
50 /* soc_camera.c private count. Only accessed with .video_lock held */ 51 /* soc_camera.c private count. Only accessed with .video_lock held */
@@ -74,7 +75,8 @@ struct soc_camera_host_ops {
74 int (*resume)(struct soc_camera_device *); 75 int (*resume)(struct soc_camera_device *);
75 int (*get_formats)(struct soc_camera_device *, int, 76 int (*get_formats)(struct soc_camera_device *, int,
76 struct soc_camera_format_xlate *); 77 struct soc_camera_format_xlate *);
77 int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *); 78 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *);
79 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
78 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 80 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
79 void (*init_videobuf)(struct videobuf_queue *, 81 void (*init_videobuf)(struct videobuf_queue *,
80 struct soc_camera_device *); 82 struct soc_camera_device *);
@@ -93,13 +95,18 @@ struct soc_camera_host_ops {
93struct soc_camera_link { 95struct soc_camera_link {
94 /* Camera bus id, used to match a camera and a bus */ 96 /* Camera bus id, used to match a camera and a bus */
95 int bus_id; 97 int bus_id;
96 /* GPIO number to switch between 8 and 10 bit modes */
97 unsigned int gpio;
98 /* Per camera SOCAM_SENSOR_* bus flags */ 98 /* Per camera SOCAM_SENSOR_* bus flags */
99 unsigned long flags; 99 unsigned long flags;
100 /* Optional callbacks to power on or off and reset the sensor */ 100 /* Optional callbacks to power on or off and reset the sensor */
101 int (*power)(struct device *, int); 101 int (*power)(struct device *, int);
102 int (*reset)(struct device *); 102 int (*reset)(struct device *);
103 /*
104 * some platforms may support different data widths than the sensors
105 * native ones due to different data line routing. Let the board code
106 * overwrite the width flags.
107 */
108 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags);
109 unsigned long (*query_bus_param)(struct soc_camera_link *);
103}; 110};
104 111
105static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) 112static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
@@ -159,7 +166,8 @@ struct soc_camera_ops {
159 int (*release)(struct soc_camera_device *); 166 int (*release)(struct soc_camera_device *);
160 int (*start_capture)(struct soc_camera_device *); 167 int (*start_capture)(struct soc_camera_device *);
161 int (*stop_capture)(struct soc_camera_device *); 168 int (*stop_capture)(struct soc_camera_device *);
162 int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *); 169 int (*set_crop)(struct soc_camera_device *, struct v4l2_rect *);
170 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
163 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 171 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
164 unsigned long (*query_bus_param)(struct soc_camera_device *); 172 unsigned long (*query_bus_param)(struct soc_camera_device *);
165 int (*set_bus_param)(struct soc_camera_device *, unsigned long); 173 int (*set_bus_param)(struct soc_camera_device *, unsigned long);
@@ -239,15 +247,19 @@ static inline struct v4l2_queryctrl const *soc_camera_find_qctrl(
239static inline unsigned long soc_camera_bus_param_compatible( 247static inline unsigned long soc_camera_bus_param_compatible(
240 unsigned long camera_flags, unsigned long bus_flags) 248 unsigned long camera_flags, unsigned long bus_flags)
241{ 249{
242 unsigned long common_flags, hsync, vsync, pclk; 250 unsigned long common_flags, hsync, vsync, pclk, data, buswidth, mode;
243 251
244 common_flags = camera_flags & bus_flags; 252 common_flags = camera_flags & bus_flags;
245 253
246 hsync = common_flags & (SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW); 254 hsync = common_flags & (SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_HSYNC_ACTIVE_LOW);
247 vsync = common_flags & (SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW); 255 vsync = common_flags & (SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW);
248 pclk = common_flags & (SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING); 256 pclk = common_flags & (SOCAM_PCLK_SAMPLE_RISING | SOCAM_PCLK_SAMPLE_FALLING);
257 data = common_flags & (SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_LOW);
258 mode = common_flags & (SOCAM_MASTER | SOCAM_SLAVE);
259 buswidth = common_flags & SOCAM_DATAWIDTH_MASK;
249 260
250 return (!hsync || !vsync || !pclk) ? 0 : common_flags; 261 return (!hsync || !vsync || !pclk || !data || !mode || !buswidth) ? 0 :
262 common_flags;
251} 263}
252 264
253extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 265extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
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-chip-ident.h b/include/media/v4l2-chip-ident.h
index 9aaf652b20ef..1be461a29077 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -37,10 +37,8 @@ enum {
37 /* module saa7110: just ident 100 */ 37 /* module saa7110: just ident 100 */
38 V4L2_IDENT_SAA7110 = 100, 38 V4L2_IDENT_SAA7110 = 100,
39 39
40 /* module saa7111: just ident 101 */ 40 /* module saa7115: reserved range 101-149 */
41 V4L2_IDENT_SAA7111 = 101, 41 V4L2_IDENT_SAA7111 = 101,
42
43 /* module saa7115: reserved range 102-149 */
44 V4L2_IDENT_SAA7113 = 103, 42 V4L2_IDENT_SAA7113 = 103,
45 V4L2_IDENT_SAA7114 = 104, 43 V4L2_IDENT_SAA7114 = 104,
46 V4L2_IDENT_SAA7115 = 105, 44 V4L2_IDENT_SAA7115 = 105,
@@ -63,44 +61,96 @@ enum {
63 V4L2_IDENT_OV7720 = 251, 61 V4L2_IDENT_OV7720 = 251,
64 V4L2_IDENT_OV7725 = 252, 62 V4L2_IDENT_OV7725 = 252,
65 63
66 /* Conexant MPEG encoder/decoders: reserved range 410-420 */ 64 /* module saa7146: reserved range 300-309 */
65 V4L2_IDENT_SAA7146 = 300,
66
67 /* Conexant MPEG encoder/decoders: reserved range 400-420 */
68 V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */
67 V4L2_IDENT_CX23415 = 415, 69 V4L2_IDENT_CX23415 = 415,
68 V4L2_IDENT_CX23416 = 416, 70 V4L2_IDENT_CX23416 = 416,
69 V4L2_IDENT_CX23418 = 418, 71 V4L2_IDENT_CX23418 = 418,
70 72
73 /* module au0828 */
74 V4L2_IDENT_AU0828 = 828,
75
76 /* module indycam: just ident 2000 */
77 V4L2_IDENT_INDYCAM = 2000,
78
79 /* module bt819: reserved range 810-819 */
80 V4L2_IDENT_BT815A = 815,
81 V4L2_IDENT_BT817A = 817,
82 V4L2_IDENT_BT819A = 819,
83
84 /* module bt856: just ident 856 */
85 V4L2_IDENT_BT856 = 856,
86
87 /* module bt866: just ident 866 */
88 V4L2_IDENT_BT866 = 866,
89
90 /* module ks0127: reserved range 1120-1129 */
91 V4L2_IDENT_KS0122S = 1122,
92 V4L2_IDENT_KS0127 = 1127,
93 V4L2_IDENT_KS0127B = 1128,
94
71 /* module vp27smpx: just ident 2700 */ 95 /* module vp27smpx: just ident 2700 */
72 V4L2_IDENT_VP27SMPX = 2700, 96 V4L2_IDENT_VP27SMPX = 2700,
73 97
98 /* module vpx3220: reserved range: 3210-3229 */
99 V4L2_IDENT_VPX3214C = 3214,
100 V4L2_IDENT_VPX3216B = 3216,
101 V4L2_IDENT_VPX3220A = 3220,
102
74 /* module tvp5150 */ 103 /* module tvp5150 */
75 V4L2_IDENT_TVP5150 = 5150, 104 V4L2_IDENT_TVP5150 = 5150,
76 105
106 /* module saa5246a: just ident 5246 */
107 V4L2_IDENT_SAA5246A = 5246,
108
109 /* module saa5249: just ident 5249 */
110 V4L2_IDENT_SAA5249 = 5249,
111
77 /* module cs5345: just ident 5345 */ 112 /* module cs5345: just ident 5345 */
78 V4L2_IDENT_CS5345 = 5345, 113 V4L2_IDENT_CS5345 = 5345,
79 114
115 /* module tea6415c: just ident 6415 */
116 V4L2_IDENT_TEA6415C = 6415,
117
118 /* module tea6420: just ident 6420 */
119 V4L2_IDENT_TEA6420 = 6420,
120
121 /* module saa6588: just ident 6588 */
122 V4L2_IDENT_SAA6588 = 6588,
123
80 /* module saa6752hs: reserved range 6750-6759 */ 124 /* module saa6752hs: reserved range 6750-6759 */
81 V4L2_IDENT_SAA6752HS = 6752, 125 V4L2_IDENT_SAA6752HS = 6752,
82 V4L2_IDENT_SAA6752HS_AC3 = 6753, 126 V4L2_IDENT_SAA6752HS_AC3 = 6753,
83 127
128 /* module adv7170: just ident 7170 */
129 V4L2_IDENT_ADV7170 = 7170,
130
131 /* module adv7175: just ident 7175 */
132 V4L2_IDENT_ADV7175 = 7175,
133
134 /* module saa7185: just ident 7185 */
135 V4L2_IDENT_SAA7185 = 7185,
136
137 /* module saa7191: just ident 7191 */
138 V4L2_IDENT_SAA7191 = 7191,
139
84 /* module wm8739: just ident 8739 */ 140 /* module wm8739: just ident 8739 */
85 V4L2_IDENT_WM8739 = 8739, 141 V4L2_IDENT_WM8739 = 8739,
86 142
87 /* module wm8775: just ident 8775 */ 143 /* module wm8775: just ident 8775 */
88 V4L2_IDENT_WM8775 = 8775, 144 V4L2_IDENT_WM8775 = 8775,
89 145
90 /* module tw9910: just ident 9910 */ 146 /* module tda9840: just ident 9840 */
91 V4L2_IDENT_TW9910 = 9910, 147 V4L2_IDENT_TDA9840 = 9840,
92
93 /* module cs53132a: just ident 53132 */
94 V4L2_IDENT_CS53l32A = 53132,
95
96 /* module upd64031a: just ident 64031 */
97 V4L2_IDENT_UPD64031A = 64031,
98 148
99 /* module upd64083: just ident 64083 */ 149 /* module cafe_ccic, just ident 8801 */
100 V4L2_IDENT_UPD64083 = 64083, 150 V4L2_IDENT_CAFE = 8801,
101 151
102 /* module m52790: just ident 52790 */ 152 /* module tw9910: just ident 9910 */
103 V4L2_IDENT_M52790 = 52790, 153 V4L2_IDENT_TW9910 = 9910,
104 154
105 /* module msp3400: reserved range 34000-34999 and 44000-44999 */ 155 /* module msp3400: reserved range 34000-34999 and 44000-44999 */
106 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only 156 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
@@ -178,6 +228,18 @@ enum {
178 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ 228 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
179 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ 229 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
180 V4L2_IDENT_MT9T031 = 45020, 230 V4L2_IDENT_MT9T031 = 45020,
231
232 /* module cs53132a: just ident 53132 */
233 V4L2_IDENT_CS53l32A = 53132,
234
235 /* module upd64031a: just ident 64031 */
236 V4L2_IDENT_UPD64031A = 64031,
237
238 /* module upd64083: just ident 64083 */
239 V4L2_IDENT_UPD64083 = 64083,
240
241 /* module m52790: just ident 52790 */
242 V4L2_IDENT_M52790 = 52790,
181}; 243};
182 244
183#endif 245#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 95e74f1874e1..c48c24e4d0fa 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -102,11 +102,15 @@ int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
102const char *v4l2_ctrl_get_name(u32 id); 102const char *v4l2_ctrl_get_name(u32 id);
103const char **v4l2_ctrl_get_menu(u32 id); 103const char **v4l2_ctrl_get_menu(u32 id);
104int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); 104int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
105int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl);
106int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, 105int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
107 struct v4l2_queryctrl *qctrl, const char **menu_items); 106 struct v4l2_queryctrl *qctrl, const char **menu_items);
108#define V4L2_CTRL_MENU_IDS_END (0xffffffff) 107#define V4L2_CTRL_MENU_IDS_END (0xffffffff)
109int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids); 108int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids);
109
110/* Note: ctrl_classes points to an array of u32 pointers. Each u32 array is a
111 0-terminated array of control IDs. Each array must be sorted low to high
112 and belong to the same control class. The array of u32 pointers must also
113 be sorted, from low class IDs to high class IDs. */
110u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); 114u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
111 115
112/* ------------------------------------------------------------------------- */ 116/* ------------------------------------------------------------------------- */
@@ -121,7 +125,7 @@ int v4l2_chip_match_host(const struct v4l2_dbg_match *match);
121 125
122/* ------------------------------------------------------------------------- */ 126/* ------------------------------------------------------------------------- */
123 127
124/* Helper function for I2C legacy drivers */ 128/* I2C Helper functions */
125 129
126struct i2c_driver; 130struct i2c_driver;
127struct i2c_adapter; 131struct i2c_adapter;
@@ -131,157 +135,62 @@ struct v4l2_device;
131struct v4l2_subdev; 135struct v4l2_subdev;
132struct v4l2_subdev_ops; 136struct v4l2_subdev_ops;
133 137
134int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver,
135 const char *name,
136 int (*probe)(struct i2c_client *, const struct i2c_device_id *));
137 138
138/* Load an i2c module and return an initialized v4l2_subdev struct. 139/* Load an i2c module and return an initialized v4l2_subdev struct.
139 Only call request_module if module_name != NULL. 140 Only call request_module if module_name != NULL.
140 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. */
141struct 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,
142 const char *module_name, const char *client_type, u8 addr); 144 const char *module_name, const char *client_type, u8 addr);
143/* 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.
144 Only call request_module if module_name != NULL. 146 Only call request_module if module_name != NULL.
145 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. */
146struct 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,
147 const char *module_name, const char *client_type, 150 const char *module_name, const char *client_type,
148 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);
149/* Initialize an v4l2_subdev with data from an i2c_client struct */ 156/* Initialize an v4l2_subdev with data from an i2c_client struct */
150void 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,
151 const struct v4l2_subdev_ops *ops); 158 const struct v4l2_subdev_ops *ops);
159/* Return i2c client address of v4l2_subdev. */
160unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd);
161
162enum v4l2_i2c_tuner_type {
163 ADDRS_RADIO, /* Radio tuner addresses */
164 ADDRS_DEMOD, /* Demod tuner addresses */
165 ADDRS_TV, /* TV tuner addresses */
166 /* TV tuner addresses if demod is present, this excludes
167 addresses used by the demodulator from the list of
168 candidates. */
169 ADDRS_TV_WITH_DEMOD,
170};
171/* Return a list of I2C tuner addresses to probe. Use only if the tuner
172 addresses are unknown. */
173const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type);
152 174
153/* ------------------------------------------------------------------------- */ 175/* ------------------------------------------------------------------------- */
154 176
155/* Internal ioctls */ 177/* Note: these remaining ioctls/structs should be removed as well, but they are
156 178 still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and
157/* VIDIOC_INT_DECODE_VBI_LINE */ 179 v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup
158struct v4l2_decode_vbi_line { 180 is needed in those modules. */
159 u32 is_second_field; /* Set to 0 for the first (odd) field,
160 set to 1 for the second (even) field. */
161 u8 *p; /* Pointer to the sliced VBI data from the decoder.
162 On exit points to the start of the payload. */
163 u32 line; /* Line number of the sliced VBI data (1-23) */
164 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */
165};
166 181
182/* s_config */
167struct v4l2_priv_tun_config { 183struct v4l2_priv_tun_config {
168 int tuner; 184 int tuner;
169 void *priv; 185 void *priv;
170}; 186};
171
172/* audio ioctls */
173
174/* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */
175#define AUDC_SET_RADIO _IO('d',88)
176
177/* tuner ioctls */
178
179/* Sets tuner type and its I2C addr */
180#define TUNER_SET_TYPE_ADDR _IOW('d', 90, int)
181
182/* Puts tuner on powersaving state, disabling it, except for i2c. To be replaced
183 by VIDIOC_INT_S_STANDBY. */
184#define TUNER_SET_STANDBY _IOW('d', 91, int)
185
186/* Sets tda9887 specific stuff, like port1, port2 and qss */
187#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)
188 188
189/* Switch the tuner to a specific tuner mode. Replacement of AUDC_SET_RADIO */
190#define VIDIOC_INT_S_TUNER_MODE _IOW('d', 93, enum v4l2_tuner_type)
191
192/* Generic standby command. Passing -1 (all bits set to 1) will put the whole
193 chip into standby mode, value 0 will make the chip fully active. Specific
194 bits can be used by certain chips to enable/disable specific subsystems.
195 Replacement of TUNER_SET_STANDBY. */
196#define VIDIOC_INT_S_STANDBY _IOW('d', 94, u32)
197
198/* 100, 101 used by VIDIOC_DBG_[SG]_REGISTER */
199
200/* Generic reset command. The argument selects which subsystems to reset.
201 Passing 0 will always reset the whole chip. */
202#define VIDIOC_INT_RESET _IOW ('d', 102, u32) 189#define VIDIOC_INT_RESET _IOW ('d', 102, u32)
203 190
204/* Set the frequency (in Hz) of the audio clock output.
205 Used to slave an audio processor to the video decoder, ensuring that audio
206 and video remain synchronized.
207 Usual values for the frequency are 48000, 44100 or 32000 Hz.
208 If the frequency is not supported, then -EINVAL is returned. */
209#define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOW ('d', 103, u32)
210
211/* Video decoders that support sliced VBI need to implement this ioctl.
212 Field p of the v4l2_sliced_vbi_line struct is set to the start of the VBI
213 data that was generated by the decoder. The driver then parses the sliced
214 VBI data and sets the other fields in the struct accordingly. The pointer p
215 is updated to point to the start of the payload which can be copied
216 verbatim into the data field of the v4l2_sliced_vbi_data struct. If no
217 valid VBI data was found, then the type field is set to 0 on return. */
218#define VIDIOC_INT_DECODE_VBI_LINE _IOWR('d', 104, struct v4l2_decode_vbi_line)
219
220/* Used to generate VBI signals on a video signal. v4l2_sliced_vbi_data is
221 filled with the data packets that should be output. Note that if you set
222 the line field to 0, then that VBI signal is disabled. If no
223 valid VBI data was found, then the type field is set to 0 on return. */
224#define VIDIOC_INT_S_VBI_DATA _IOW ('d', 105, struct v4l2_sliced_vbi_data)
225
226/* Used to obtain the sliced VBI packet from a readback register. Not all
227 video decoders support this. If no data is available because the readback
228 register contains invalid or erroneous data -EIO is returned. Note that
229 you must fill in the 'id' member and the 'field' member (to determine
230 whether CC data from the first or second field should be obtained). */
231#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data)
232
233/* Sets I2S speed in bps. This is used to provide a standard way to select I2S
234 clock used by driving digital audio streams at some board designs.
235 Usual values for the frequency are 1024000 and 2048000.
236 If the frequency is not supported, then -EINVAL is returned. */
237#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
238
239/* Routing definition, device dependent. It specifies which inputs (if any)
240 should be routed to which outputs (if any). */
241struct v4l2_routing { 191struct v4l2_routing {
242 u32 input; 192 u32 input;
243 u32 output; 193 u32 output;
244}; 194};
245 195
246/* These internal commands should be used to define the inputs and outputs
247 of an audio/video chip. They will replace the v4l2 API commands
248 VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT
249 that are meant to be used by the user.
250 The internal commands should be used to switch inputs/outputs
251 because only the driver knows how to map a 'Television' input to the precise
252 input/output routing of an A/D converter, or a DSP, or a video digitizer.
253 These four commands should only be sent directly to an i2c device, they
254 should not be broadcast as the routing is very device specific. */
255#define VIDIOC_INT_S_AUDIO_ROUTING _IOW ('d', 109, struct v4l2_routing)
256#define VIDIOC_INT_G_AUDIO_ROUTING _IOR ('d', 110, struct v4l2_routing)
257#define VIDIOC_INT_S_VIDEO_ROUTING _IOW ('d', 111, struct v4l2_routing)
258#define VIDIOC_INT_G_VIDEO_ROUTING _IOR ('d', 112, struct v4l2_routing)
259
260struct v4l2_crystal_freq {
261 u32 freq; /* frequency in Hz of the crystal */
262 u32 flags; /* device specific flags */
263};
264
265/* Sets the frequency of the crystal used to generate the clocks.
266 An extra flags field allows device specific configuration regarding
267 clock frequency dividers, etc. If not used, then set flags to 0.
268 If the frequency is not supported, then -EINVAL is returned. */
269#define VIDIOC_INT_S_CRYSTAL_FREQ _IOW('d', 113, struct v4l2_crystal_freq)
270
271/* Initialize the sensor registors to some sort of reasonable
272 default values. */
273#define VIDIOC_INT_INIT _IOW('d', 114, u32)
274
275/* Set v4l2_std_id for video OUTPUT devices. This is ignored by
276 video input devices. */
277#define VIDIOC_INT_S_STD_OUTPUT _IOW('d', 115, v4l2_std_id)
278
279/* Get v4l2_std_id for video OUTPUT devices. This is ignored by
280 video input devices. */
281#define VIDIOC_INT_G_STD_OUTPUT _IOW('d', 116, v4l2_std_id)
282
283/* Set GPIO pins. Very simple right now, might need to be extended with
284 a v4l2_gpio struct if a direction is also needed. */
285#define VIDIOC_INT_S_GPIO _IOW('d', 117, u32)
286
287#endif /* V4L2_COMMON_H_ */ 196#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index e36faab8459b..2058dd45e915 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -40,6 +40,8 @@ struct v4l2_file_operations {
40 unsigned int (*poll) (struct file *, struct poll_table_struct *); 40 unsigned int (*poll) (struct file *, struct poll_table_struct *);
41 long (*ioctl) (struct file *, unsigned int, unsigned long); 41 long (*ioctl) (struct file *, unsigned int, unsigned long);
42 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 42 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
43 unsigned long (*get_unmapped_area) (struct file *, unsigned long,
44 unsigned long, unsigned long, unsigned long);
43 int (*mmap) (struct file *, struct vm_area_struct *); 45 int (*mmap) (struct file *, struct vm_area_struct *);
44 int (*open) (struct file *); 46 int (*open) (struct file *);
45 int (*release) (struct file *); 47 int (*release) (struct file *);
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 55e41afd95ef..0dd3e8e8653e 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -33,7 +33,9 @@
33#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16) 33#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16)
34 34
35struct v4l2_device { 35struct v4l2_device {
36 /* dev->driver_data points to this struct */ 36 /* dev->driver_data points to this struct.
37 Note: dev might be NULL if there is no parent device
38 as is the case with e.g. ISA devices. */
37 struct device *dev; 39 struct device *dev;
38 /* used to keep track of the registered subdevs */ 40 /* used to keep track of the registered subdevs */
39 struct list_head subdevs; 41 struct list_head subdevs;
@@ -42,33 +44,43 @@ struct v4l2_device {
42 spinlock_t lock; 44 spinlock_t lock;
43 /* unique device name, by default the driver name + bus ID */ 45 /* unique device name, by default the driver name + bus ID */
44 char name[V4L2_DEVICE_NAME_SIZE]; 46 char name[V4L2_DEVICE_NAME_SIZE];
47 /* notify callback called by some sub-devices. */
48 void (*notify)(struct v4l2_subdev *sd,
49 unsigned int notification, void *arg);
45}; 50};
46 51
47/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev */ 52/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev.
53 dev may be NULL in rare cases (ISA devices). In that case you
54 must fill in the v4l2_dev->name field before calling this function. */
48int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); 55int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev);
49/* Set v4l2_dev->dev->driver_data to NULL and unregister all sub-devices */ 56/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects.
57 Since the parent disappears this ensures that v4l2_dev doesn't have an
58 invalid parent pointer. */
59void v4l2_device_disconnect(struct v4l2_device *v4l2_dev);
60/* Unregister all sub-devices and any other resources related to v4l2_dev. */
50void v4l2_device_unregister(struct v4l2_device *v4l2_dev); 61void v4l2_device_unregister(struct v4l2_device *v4l2_dev);
51 62
52/* Register a subdev with a v4l2 device. While registered the subdev module 63/* Register a subdev with a v4l2 device. While registered the subdev module
53 is marked as in-use. An error is returned if the module is no longer 64 is marked as in-use. An error is returned if the module is no longer
54 loaded when you attempt to register it. */ 65 loaded when you attempt to register it. */
55int __must_check v4l2_device_register_subdev(struct v4l2_device *dev, struct v4l2_subdev *sd); 66int __must_check v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
67 struct v4l2_subdev *sd);
56/* Unregister a subdev with a v4l2 device. Can also be called if the subdev 68/* Unregister a subdev with a v4l2 device. Can also be called if the subdev
57 wasn't registered. In that case it will do nothing. */ 69 wasn't registered. In that case it will do nothing. */
58void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); 70void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
59 71
60/* Iterate over all subdevs. */ 72/* Iterate over all subdevs. */
61#define v4l2_device_for_each_subdev(sd, dev) \ 73#define v4l2_device_for_each_subdev(sd, v4l2_dev) \
62 list_for_each_entry(sd, &(dev)->subdevs, list) 74 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list)
63 75
64/* Call the specified callback for all subdevs matching the condition. 76/* Call the specified callback for all subdevs matching the condition.
65 Ignore any errors. Note that you cannot add or delete a subdev 77 Ignore any errors. Note that you cannot add or delete a subdev
66 while walking the subdevs list. */ 78 while walking the subdevs list. */
67#define __v4l2_device_call_subdevs(dev, cond, o, f, args...) \ 79#define __v4l2_device_call_subdevs(v4l2_dev, cond, o, f, args...) \
68 do { \ 80 do { \
69 struct v4l2_subdev *sd; \ 81 struct v4l2_subdev *sd; \
70 \ 82 \
71 list_for_each_entry(sd, &(dev)->subdevs, list) \ 83 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) \
72 if ((cond) && sd->ops->o && sd->ops->o->f) \ 84 if ((cond) && sd->ops->o && sd->ops->o->f) \
73 sd->ops->o->f(sd , ##args); \ 85 sd->ops->o->f(sd , ##args); \
74 } while (0) 86 } while (0)
@@ -77,12 +89,12 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
77 If the callback returns an error other than 0 or -ENOIOCTLCMD, then 89 If the callback returns an error other than 0 or -ENOIOCTLCMD, then
78 return with that error code. Note that you cannot add or delete a 90 return with that error code. Note that you cannot add or delete a
79 subdev while walking the subdevs list. */ 91 subdev while walking the subdevs list. */
80#define __v4l2_device_call_subdevs_until_err(dev, cond, o, f, args...) \ 92#define __v4l2_device_call_subdevs_until_err(v4l2_dev, cond, o, f, args...) \
81({ \ 93({ \
82 struct v4l2_subdev *sd; \ 94 struct v4l2_subdev *sd; \
83 long err = 0; \ 95 long err = 0; \
84 \ 96 \
85 list_for_each_entry(sd, &(dev)->subdevs, list) { \ 97 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) { \
86 if ((cond) && sd->ops->o && sd->ops->o->f) \ 98 if ((cond) && sd->ops->o && sd->ops->o->f) \
87 err = sd->ops->o->f(sd , ##args); \ 99 err = sd->ops->o->f(sd , ##args); \
88 if (err && err != -ENOIOCTLCMD) \ 100 if (err && err != -ENOIOCTLCMD) \
@@ -94,16 +106,16 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
94/* Call the specified callback for all subdevs matching grp_id (if 0, then 106/* Call the specified callback for all subdevs matching grp_id (if 0, then
95 match them all). Ignore any errors. Note that you cannot add or delete 107 match them all). Ignore any errors. Note that you cannot add or delete
96 a subdev while walking the subdevs list. */ 108 a subdev while walking the subdevs list. */
97#define v4l2_device_call_all(dev, grpid, o, f, args...) \ 109#define v4l2_device_call_all(v4l2_dev, grpid, o, f, args...) \
98 __v4l2_device_call_subdevs(dev, \ 110 __v4l2_device_call_subdevs(v4l2_dev, \
99 !(grpid) || sd->grp_id == (grpid), o, f , ##args) 111 !(grpid) || sd->grp_id == (grpid), o, f , ##args)
100 112
101/* Call the specified callback for all subdevs matching grp_id (if 0, then 113/* Call the specified callback for all subdevs matching grp_id (if 0, then
102 match them all). If the callback returns an error other than 0 or 114 match them all). If the callback returns an error other than 0 or
103 -ENOIOCTLCMD, then return with that error code. Note that you cannot 115 -ENOIOCTLCMD, then return with that error code. Note that you cannot
104 add or delete a subdev while walking the subdevs list. */ 116 add or delete a subdev while walking the subdevs list. */
105#define v4l2_device_call_until_err(dev, grpid, o, f, args...) \ 117#define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) \
106 __v4l2_device_call_subdevs_until_err(dev, \ 118 __v4l2_device_call_subdevs_until_err(v4l2_dev, \
107 !(grpid) || sd->grp_id == (grpid), o, f , ##args) 119 !(grpid) || sd->grp_id == (grpid), o, f , ##args)
108 120
109#endif 121#endif
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-ioctl.h b/include/media/v4l2-ioctl.h
index b01c044868d0..7a4529defa88 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -15,6 +15,7 @@
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/compiler.h> /* need __user */ 16#include <linux/compiler.h> /* need __user */
17#ifdef CONFIG_VIDEO_V4L1_COMPAT 17#ifdef CONFIG_VIDEO_V4L1_COMPAT
18#define __MIN_V4L1
18#include <linux/videodev.h> 19#include <linux/videodev.h>
19#else 20#else
20#include <linux/videodev2.h> 21#include <linux/videodev2.h>
@@ -267,6 +268,7 @@ struct v4l2_ioctl_ops {
267 268
268/* Video standard functions */ 269/* Video standard functions */
269extern const char *v4l2_norm_to_name(v4l2_std_id id); 270extern const char *v4l2_norm_to_name(v4l2_std_id id);
271extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
270extern int v4l2_video_std_construct(struct v4l2_standard *vs, 272extern int v4l2_video_std_construct(struct v4l2_standard *vs,
271 int id, const char *name); 273 int id, const char *name);
272/* Prints the ioctl in a human-readable format */ 274/* Prints the ioctl in a human-readable format */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 37b09e56e943..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,17 +78,36 @@ 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);
79 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); 104 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
80 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); 105 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
106 int (*g_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);
108 int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
81 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);
82 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); 111 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
83#ifdef CONFIG_VIDEO_ADV_DEBUG 112#ifdef CONFIG_VIDEO_ADV_DEBUG
84 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);
@@ -86,6 +115,16 @@ struct v4l2_subdev_core_ops {
86#endif 115#endif
87}; 116};
88 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 */
89struct v4l2_subdev_tuner_ops { 128struct v4l2_subdev_tuner_ops {
90 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); 129 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
91 int (*s_radio)(struct v4l2_subdev *sd); 130 int (*s_radio)(struct v4l2_subdev *sd);
@@ -93,28 +132,93 @@ struct v4l2_subdev_tuner_ops {
93 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); 132 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
94 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 133 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
95 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 134 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
96 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
97 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);
98 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);
99}; 138};
100 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 */
101struct v4l2_subdev_audio_ops { 160struct v4l2_subdev_audio_ops {
102 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq); 161 int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
103 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq); 162 int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
104 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);
105}; 164};
106 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 */
107struct v4l2_subdev_video_ops { 203struct v4l2_subdev_video_ops {
108 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);
109 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);
110 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);
111 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);
112 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);
113 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap); 209 int (*g_sliced_vbi_cap)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_cap *cap);
114 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); 210 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
211 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
212 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
115 int (*s_stream)(struct v4l2_subdev *sd, int enable); 213 int (*s_stream)(struct v4l2_subdev *sd, int enable);
116 int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); 214 int (*enum_fmt)(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmtdesc);
117 int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt); 215 int (*g_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
216 int (*try_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
217 int (*s_fmt)(struct v4l2_subdev *sd, struct v4l2_format *fmt);
218 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
219 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
220 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
221 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
118}; 222};
119 223
120struct v4l2_subdev_ops { 224struct v4l2_subdev_ops {
@@ -132,7 +236,7 @@ struct v4l2_subdev_ops {
132struct v4l2_subdev { 236struct v4l2_subdev {
133 struct list_head list; 237 struct list_head list;
134 struct module *owner; 238 struct module *owner;
135 struct v4l2_device *dev; 239 struct v4l2_device *v4l2_dev;
136 const struct v4l2_subdev_ops *ops; 240 const struct v4l2_subdev_ops *ops;
137 /* name must be unique */ 241 /* name must be unique */
138 char name[V4L2_SUBDEV_NAME_SIZE]; 242 char name[V4L2_SUBDEV_NAME_SIZE];
@@ -152,18 +256,6 @@ static inline void *v4l2_get_subdevdata(const struct v4l2_subdev *sd)
152 return sd->priv; 256 return sd->priv;
153} 257}
154 258
155/* Convert an ioctl-type command to the proper v4l2_subdev_ops function call.
156 This is used by subdev modules that can be called by both old-style ioctl
157 commands and through the v4l2_subdev_ops.
158
159 The ioctl API of the subdev driver can call this function to call the
160 right ops based on the ioctl cmd and arg.
161
162 Once all subdev drivers have been converted and all drivers no longer
163 use the ioctl interface, then this function can be removed.
164 */
165int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg);
166
167static inline void v4l2_subdev_init(struct v4l2_subdev *sd, 259static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
168 const struct v4l2_subdev_ops *ops) 260 const struct v4l2_subdev_ops *ops)
169{ 261{
@@ -171,7 +263,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
171 /* ops->core MUST be set */ 263 /* ops->core MUST be set */
172 BUG_ON(!ops || !ops->core); 264 BUG_ON(!ops || !ops->core);
173 sd->ops = ops; 265 sd->ops = ops;
174 sd->dev = NULL; 266 sd->v4l2_dev = NULL;
175 sd->name[0] = '\0'; 267 sd->name[0] = '\0';
176 sd->grp_id = 0; 268 sd->grp_id = 0;
177 sd->priv = NULL; 269 sd->priv = NULL;
@@ -186,4 +278,9 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
186 (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \ 278 (!(sd) ? -ENODEV : (((sd) && (sd)->ops->o && (sd)->ops->o->f) ? \
187 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) 279 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
188 280
281/* Send a notification to v4l2_device. */
282#define v4l2_subdev_notify(sd, notification, arg) \
283 ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \
284 (sd)->v4l2_dev->notify((sd), (notification), (arg)))
285
189#endif 286#endif
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 874f1340d049..1c5946c44758 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -18,6 +18,7 @@
18 18
19#include <linux/poll.h> 19#include <linux/poll.h>
20#ifdef CONFIG_VIDEO_V4L1_COMPAT 20#ifdef CONFIG_VIDEO_V4L1_COMPAT
21#define __MIN_V4L1
21#include <linux/videodev.h> 22#include <linux/videodev.h>
22#endif 23#endif
23#include <linux/videodev2.h> 24#include <linux/videodev2.h>
diff --git a/include/mtd/inftl-user.h b/include/mtd/inftl-user.h
index d409d489d900..8376bd1a9e01 100644
--- a/include/mtd/inftl-user.h
+++ b/include/mtd/inftl-user.h
@@ -16,33 +16,33 @@
16/* Block Control Information */ 16/* Block Control Information */
17 17
18struct inftl_bci { 18struct inftl_bci {
19 uint8_t ECCsig[6]; 19 __u8 ECCsig[6];
20 uint8_t Status; 20 __u8 Status;
21 uint8_t Status1; 21 __u8 Status1;
22} __attribute__((packed)); 22} __attribute__((packed));
23 23
24struct inftl_unithead1 { 24struct inftl_unithead1 {
25 uint16_t virtualUnitNo; 25 __u16 virtualUnitNo;
26 uint16_t prevUnitNo; 26 __u16 prevUnitNo;
27 uint8_t ANAC; 27 __u8 ANAC;
28 uint8_t NACs; 28 __u8 NACs;
29 uint8_t parityPerField; 29 __u8 parityPerField;
30 uint8_t discarded; 30 __u8 discarded;
31} __attribute__((packed)); 31} __attribute__((packed));
32 32
33struct inftl_unithead2 { 33struct inftl_unithead2 {
34 uint8_t parityPerField; 34 __u8 parityPerField;
35 uint8_t ANAC; 35 __u8 ANAC;
36 uint16_t prevUnitNo; 36 __u16 prevUnitNo;
37 uint16_t virtualUnitNo; 37 __u16 virtualUnitNo;
38 uint8_t NACs; 38 __u8 NACs;
39 uint8_t discarded; 39 __u8 discarded;
40} __attribute__((packed)); 40} __attribute__((packed));
41 41
42struct inftl_unittail { 42struct inftl_unittail {
43 uint8_t Reserved[4]; 43 __u8 Reserved[4];
44 uint16_t EraseMark; 44 __u16 EraseMark;
45 uint16_t EraseMark1; 45 __u16 EraseMark1;
46} __attribute__((packed)); 46} __attribute__((packed));
47 47
48union inftl_uci { 48union inftl_uci {
diff --git a/include/mtd/jffs2-user.h b/include/mtd/jffs2-user.h
index 001685d7fa88..fa94b0eb67c1 100644
--- a/include/mtd/jffs2-user.h
+++ b/include/mtd/jffs2-user.h
@@ -7,6 +7,7 @@
7 7
8/* This file is blessed for inclusion by userspace */ 8/* This file is blessed for inclusion by userspace */
9#include <linux/jffs2.h> 9#include <linux/jffs2.h>
10#include <linux/types.h>
10#include <endian.h> 11#include <endian.h>
11#include <byteswap.h> 12#include <byteswap.h>
12 13
@@ -19,8 +20,8 @@
19 20
20extern int target_endian; 21extern int target_endian;
21 22
22#define t16(x) ({ uint16_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); }) 23#define t16(x) ({ __u16 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
23#define t32(x) ({ uint32_t __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); }) 24#define t32(x) ({ __u32 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
24 25
25#define cpu_to_je16(x) ((jint16_t){t16(x)}) 26#define cpu_to_je16(x) ((jint16_t){t16(x)})
26#define cpu_to_je32(x) ((jint32_t){t32(x)}) 27#define cpu_to_je32(x) ((jint32_t){t32(x)})
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index c6c61cd5a254..b6595b3c68b6 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -5,14 +5,16 @@
5#ifndef __MTD_ABI_H__ 5#ifndef __MTD_ABI_H__
6#define __MTD_ABI_H__ 6#define __MTD_ABI_H__
7 7
8#include <linux/types.h>
9
8struct erase_info_user { 10struct erase_info_user {
9 uint32_t start; 11 __u32 start;
10 uint32_t length; 12 __u32 length;
11}; 13};
12 14
13struct mtd_oob_buf { 15struct mtd_oob_buf {
14 uint32_t start; 16 __u32 start;
15 uint32_t length; 17 __u32 length;
16 unsigned char __user *ptr; 18 unsigned char __user *ptr;
17}; 19};
18 20
@@ -48,30 +50,30 @@ struct mtd_oob_buf {
48#define MTD_OTP_USER 2 50#define MTD_OTP_USER 2
49 51
50struct mtd_info_user { 52struct mtd_info_user {
51 uint8_t type; 53 __u8 type;
52 uint32_t flags; 54 __u32 flags;
53 uint32_t size; // Total size of the MTD 55 __u32 size; // Total size of the MTD
54 uint32_t erasesize; 56 __u32 erasesize;
55 uint32_t writesize; 57 __u32 writesize;
56 uint32_t oobsize; // Amount of OOB data per block (e.g. 16) 58 __u32 oobsize; // Amount of OOB data per block (e.g. 16)
57 /* The below two fields are obsolete and broken, do not use them 59 /* The below two fields are obsolete and broken, do not use them
58 * (TODO: remove at some point) */ 60 * (TODO: remove at some point) */
59 uint32_t ecctype; 61 __u32 ecctype;
60 uint32_t eccsize; 62 __u32 eccsize;
61}; 63};
62 64
63struct region_info_user { 65struct region_info_user {
64 uint32_t offset; /* At which this region starts, 66 __u32 offset; /* At which this region starts,
65 * from the beginning of the MTD */ 67 * from the beginning of the MTD */
66 uint32_t erasesize; /* For this region */ 68 __u32 erasesize; /* For this region */
67 uint32_t numblocks; /* Number of blocks in this region */ 69 __u32 numblocks; /* Number of blocks in this region */
68 uint32_t regionindex; 70 __u32 regionindex;
69}; 71};
70 72
71struct otp_info { 73struct otp_info {
72 uint32_t start; 74 __u32 start;
73 uint32_t length; 75 __u32 length;
74 uint32_t locked; 76 __u32 locked;
75}; 77};
76 78
77#define MEMGETINFO _IOR('M', 1, struct mtd_info_user) 79#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
@@ -84,8 +86,8 @@ struct otp_info {
84#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) 86#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user)
85#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo) 87#define MEMSETOOBSEL _IOW('M', 9, struct nand_oobinfo)
86#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) 88#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo)
87#define MEMGETBADBLOCK _IOW('M', 11, loff_t) 89#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t)
88#define MEMSETBADBLOCK _IOW('M', 12, loff_t) 90#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t)
89#define OTPSELECT _IOR('M', 13, int) 91#define OTPSELECT _IOR('M', 13, int)
90#define OTPGETREGIONCOUNT _IOW('M', 14, int) 92#define OTPGETREGIONCOUNT _IOW('M', 14, int)
91#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info) 93#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info)
@@ -99,15 +101,15 @@ struct otp_info {
99 * interfaces 101 * interfaces
100 */ 102 */
101struct nand_oobinfo { 103struct nand_oobinfo {
102 uint32_t useecc; 104 __u32 useecc;
103 uint32_t eccbytes; 105 __u32 eccbytes;
104 uint32_t oobfree[8][2]; 106 __u32 oobfree[8][2];
105 uint32_t eccpos[32]; 107 __u32 eccpos[32];
106}; 108};
107 109
108struct nand_oobfree { 110struct nand_oobfree {
109 uint32_t offset; 111 __u32 offset;
110 uint32_t length; 112 __u32 length;
111}; 113};
112 114
113#define MTD_MAX_OOBFREE_ENTRIES 8 115#define MTD_MAX_OOBFREE_ENTRIES 8
@@ -116,9 +118,9 @@ struct nand_oobfree {
116 * diagnosis and to allow creation of raw images 118 * diagnosis and to allow creation of raw images
117 */ 119 */
118struct nand_ecclayout { 120struct nand_ecclayout {
119 uint32_t eccbytes; 121 __u32 eccbytes;
120 uint32_t eccpos[64]; 122 __u32 eccpos[64];
121 uint32_t oobavail; 123 __u32 oobavail;
122 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES]; 124 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
123}; 125};
124 126
@@ -131,10 +133,10 @@ struct nand_ecclayout {
131 * @bbtblocks: number of blocks reserved for bad block tables 133 * @bbtblocks: number of blocks reserved for bad block tables
132 */ 134 */
133struct mtd_ecc_stats { 135struct mtd_ecc_stats {
134 uint32_t corrected; 136 __u32 corrected;
135 uint32_t failed; 137 __u32 failed;
136 uint32_t badblocks; 138 __u32 badblocks;
137 uint32_t bbtblocks; 139 __u32 bbtblocks;
138}; 140};
139 141
140/* 142/*
diff --git a/include/mtd/nftl-user.h b/include/mtd/nftl-user.h
index 390d21c080aa..98e9e57f22de 100644
--- a/include/mtd/nftl-user.h
+++ b/include/mtd/nftl-user.h
@@ -6,33 +6,35 @@
6#ifndef __MTD_NFTL_USER_H__ 6#ifndef __MTD_NFTL_USER_H__
7#define __MTD_NFTL_USER_H__ 7#define __MTD_NFTL_USER_H__
8 8
9#include <linux/types.h>
10
9/* Block Control Information */ 11/* Block Control Information */
10 12
11struct nftl_bci { 13struct nftl_bci {
12 unsigned char ECCSig[6]; 14 unsigned char ECCSig[6];
13 uint8_t Status; 15 __u8 Status;
14 uint8_t Status1; 16 __u8 Status1;
15}__attribute__((packed)); 17}__attribute__((packed));
16 18
17/* Unit Control Information */ 19/* Unit Control Information */
18 20
19struct nftl_uci0 { 21struct nftl_uci0 {
20 uint16_t VirtUnitNum; 22 __u16 VirtUnitNum;
21 uint16_t ReplUnitNum; 23 __u16 ReplUnitNum;
22 uint16_t SpareVirtUnitNum; 24 __u16 SpareVirtUnitNum;
23 uint16_t SpareReplUnitNum; 25 __u16 SpareReplUnitNum;
24} __attribute__((packed)); 26} __attribute__((packed));
25 27
26struct nftl_uci1 { 28struct nftl_uci1 {
27 uint32_t WearInfo; 29 __u32 WearInfo;
28 uint16_t EraseMark; 30 __u16 EraseMark;
29 uint16_t EraseMark1; 31 __u16 EraseMark1;
30} __attribute__((packed)); 32} __attribute__((packed));
31 33
32struct nftl_uci2 { 34struct nftl_uci2 {
33 uint16_t FoldMark; 35 __u16 FoldMark;
34 uint16_t FoldMark1; 36 __u16 FoldMark1;
35 uint32_t unused; 37 __u32 unused;
36} __attribute__((packed)); 38} __attribute__((packed));
37 39
38union nftl_uci { 40union nftl_uci {
@@ -50,9 +52,9 @@ struct nftl_oob {
50 52
51struct NFTLMediaHeader { 53struct NFTLMediaHeader {
52 char DataOrgID[6]; 54 char DataOrgID[6];
53 uint16_t NumEraseUnits; 55 __u16 NumEraseUnits;
54 uint16_t FirstPhysicalEUN; 56 __u16 FirstPhysicalEUN;
55 uint32_t FormattedSize; 57 __u32 FormattedSize;
56 unsigned char UnitSizeFactor; 58 unsigned char UnitSizeFactor;
57} __attribute__((packed)); 59} __attribute__((packed));
58 60
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index 296efae3525e..466a8320f1e6 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -21,6 +21,8 @@
21#ifndef __UBI_USER_H__ 21#ifndef __UBI_USER_H__
22#define __UBI_USER_H__ 22#define __UBI_USER_H__
23 23
24#include <linux/types.h>
25
24/* 26/*
25 * UBI device creation (the same as MTD device attachment) 27 * UBI device creation (the same as MTD device attachment)
26 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 28 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -152,7 +154,7 @@
152/* Create an UBI volume */ 154/* Create an UBI volume */
153#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req) 155#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
154/* Remove an UBI volume */ 156/* Remove an UBI volume */
155#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, int32_t) 157#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, __s32)
156/* Re-size an UBI volume */ 158/* Re-size an UBI volume */
157#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req) 159#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
158/* Re-name volumes */ 160/* Re-name volumes */
@@ -165,24 +167,24 @@
165/* Attach an MTD device */ 167/* Attach an MTD device */
166#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req) 168#define UBI_IOCATT _IOW(UBI_CTRL_IOC_MAGIC, 64, struct ubi_attach_req)
167/* Detach an MTD device */ 169/* Detach an MTD device */
168#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, int32_t) 170#define UBI_IOCDET _IOW(UBI_CTRL_IOC_MAGIC, 65, __s32)
169 171
170/* ioctl commands of UBI volume character devices */ 172/* ioctl commands of UBI volume character devices */
171 173
172#define UBI_VOL_IOC_MAGIC 'O' 174#define UBI_VOL_IOC_MAGIC 'O'
173 175
174/* Start UBI volume update */ 176/* Start UBI volume update */
175#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t) 177#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, __s64)
176/* LEB erasure command, used for debugging, disabled by default */ 178/* LEB erasure command, used for debugging, disabled by default */
177#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t) 179#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, __s32)
178/* Atomic LEB change command */ 180/* Atomic LEB change command */
179#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, int32_t) 181#define UBI_IOCEBCH _IOW(UBI_VOL_IOC_MAGIC, 2, __s32)
180/* Map LEB command */ 182/* Map LEB command */
181#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req) 183#define UBI_IOCEBMAP _IOW(UBI_VOL_IOC_MAGIC, 3, struct ubi_map_req)
182/* Unmap LEB command */ 184/* Unmap LEB command */
183#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, int32_t) 185#define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, __s32)
184/* Check if LEB is mapped command */ 186/* Check if LEB is mapped command */
185#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, int32_t) 187#define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32)
186/* Set an UBI volume property */ 188/* Set an UBI volume property */
187#define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req) 189#define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req)
188 190
@@ -260,10 +262,10 @@ enum {
260 * sub-page of the first page and add needed padding. 262 * sub-page of the first page and add needed padding.
261 */ 263 */
262struct ubi_attach_req { 264struct ubi_attach_req {
263 int32_t ubi_num; 265 __s32 ubi_num;
264 int32_t mtd_num; 266 __s32 mtd_num;
265 int32_t vid_hdr_offset; 267 __s32 vid_hdr_offset;
266 int8_t padding[12]; 268 __s8 padding[12];
267}; 269};
268 270
269/** 271/**
@@ -298,13 +300,13 @@ struct ubi_attach_req {
298 * BLOBs, without caring about how to properly align them. 300 * BLOBs, without caring about how to properly align them.
299 */ 301 */
300struct ubi_mkvol_req { 302struct ubi_mkvol_req {
301 int32_t vol_id; 303 __s32 vol_id;
302 int32_t alignment; 304 __s32 alignment;
303 int64_t bytes; 305 __s64 bytes;
304 int8_t vol_type; 306 __s8 vol_type;
305 int8_t padding1; 307 __s8 padding1;
306 int16_t name_len; 308 __s16 name_len;
307 int8_t padding2[4]; 309 __s8 padding2[4];
308 char name[UBI_MAX_VOLUME_NAME + 1]; 310 char name[UBI_MAX_VOLUME_NAME + 1];
309} __attribute__ ((packed)); 311} __attribute__ ((packed));
310 312
@@ -320,8 +322,8 @@ struct ubi_mkvol_req {
320 * zero number of bytes). 322 * zero number of bytes).
321 */ 323 */
322struct ubi_rsvol_req { 324struct ubi_rsvol_req {
323 int64_t bytes; 325 __s64 bytes;
324 int32_t vol_id; 326 __s32 vol_id;
325} __attribute__ ((packed)); 327} __attribute__ ((packed));
326 328
327/** 329/**
@@ -356,12 +358,12 @@ struct ubi_rsvol_req {
356 * re-name request. 358 * re-name request.
357 */ 359 */
358struct ubi_rnvol_req { 360struct ubi_rnvol_req {
359 int32_t count; 361 __s32 count;
360 int8_t padding1[12]; 362 __s8 padding1[12];
361 struct { 363 struct {
362 int32_t vol_id; 364 __s32 vol_id;
363 int16_t name_len; 365 __s16 name_len;
364 int8_t padding2[2]; 366 __s8 padding2[2];
365 char name[UBI_MAX_VOLUME_NAME + 1]; 367 char name[UBI_MAX_VOLUME_NAME + 1];
366 } ents[UBI_MAX_RNVOL]; 368 } ents[UBI_MAX_RNVOL];
367} __attribute__ ((packed)); 369} __attribute__ ((packed));
@@ -375,10 +377,10 @@ struct ubi_rnvol_req {
375 * @padding: reserved for future, not used, has to be zeroed 377 * @padding: reserved for future, not used, has to be zeroed
376 */ 378 */
377struct ubi_leb_change_req { 379struct ubi_leb_change_req {
378 int32_t lnum; 380 __s32 lnum;
379 int32_t bytes; 381 __s32 bytes;
380 int8_t dtype; 382 __s8 dtype;
381 int8_t padding[7]; 383 __s8 padding[7];
382} __attribute__ ((packed)); 384} __attribute__ ((packed));
383 385
384/** 386/**
@@ -388,9 +390,9 @@ struct ubi_leb_change_req {
388 * @padding: reserved for future, not used, has to be zeroed 390 * @padding: reserved for future, not used, has to be zeroed
389 */ 391 */
390struct ubi_map_req { 392struct ubi_map_req {
391 int32_t lnum; 393 __s32 lnum;
392 int8_t dtype; 394 __s8 dtype;
393 int8_t padding[3]; 395 __s8 padding[3];
394} __attribute__ ((packed)); 396} __attribute__ ((packed));
395 397
396 398
@@ -402,9 +404,9 @@ struct ubi_map_req {
402 * @value: value to set 404 * @value: value to set
403 */ 405 */
404struct ubi_set_prop_req { 406struct ubi_set_prop_req {
405 uint8_t property; 407 __u8 property;
406 uint8_t padding[7]; 408 __u8 padding[7];
407 uint64_t value; 409 __u64 value;
408} __attribute__ ((packed)); 410} __attribute__ ((packed));
409 411
410#endif /* __UBI_USER_H__ */ 412#endif /* __UBI_USER_H__ */
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 4012e07162e5..e26812274b75 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -98,7 +98,6 @@ enum p9_req_status_t {
98struct p9_req_t { 98struct p9_req_t {
99 int status; 99 int status;
100 int t_err; 100 int t_err;
101 u16 flush_tag;
102 wait_queue_head_t *wq; 101 wait_queue_head_t *wq;
103 struct p9_fcall *tc; 102 struct p9_fcall *tc;
104 struct p9_fcall *rc; 103 struct p9_fcall *rc;
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index c216de528b08..7b55ab215a64 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -88,8 +88,8 @@ extern int ipv6_dev_get_saddr(struct net *net,
88extern int ipv6_get_lladdr(struct net_device *dev, 88extern int ipv6_get_lladdr(struct net_device *dev,
89 struct in6_addr *addr, 89 struct in6_addr *addr,
90 unsigned char banned_flags); 90 unsigned char banned_flags);
91extern int ipv6_rcv_saddr_equal(const struct sock *sk, 91extern int ipv6_rcv_saddr_equal(const struct sock *sk,
92 const struct sock *sk2); 92 const struct sock *sk2);
93extern void addrconf_join_solict(struct net_device *dev, 93extern void addrconf_join_solict(struct net_device *dev,
94 struct in6_addr *addr); 94 struct in6_addr *addr);
95extern void addrconf_leave_solict(struct inet6_dev *idev, 95extern void addrconf_leave_solict(struct inet6_dev *idev,
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index b5a51a7bb364..467c531b8a7e 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -50,7 +50,6 @@ struct atmarp_entry {
50struct clip_priv { 50struct clip_priv {
51 int number; /* for convenience ... */ 51 int number; /* for convenience ... */
52 spinlock_t xoff_lock; /* ensures that pop is atomic (SMP) */ 52 spinlock_t xoff_lock; /* ensures that pop is atomic (SMP) */
53 struct net_device_stats stats;
54 struct net_device *next; /* next CLIP interface */ 53 struct net_device *next; /* next CLIP interface */
55}; 54};
56 55
diff --git a/include/net/ax88796.h b/include/net/ax88796.h
index 51329dae44e6..b9a3beca0ce4 100644
--- a/include/net/ax88796.h
+++ b/include/net/ax88796.h
@@ -15,14 +15,17 @@
15#define AXFLG_HAS_EEPROM (1<<0) 15#define AXFLG_HAS_EEPROM (1<<0)
16#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */ 16#define AXFLG_MAC_FROMDEV (1<<1) /* device already has MAC */
17#define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */ 17#define AXFLG_HAS_93CX6 (1<<2) /* use eeprom_93cx6 driver */
18#define AXFLG_MAC_FROMPLATFORM (1<<3) /* MAC given by platform data */
18 19
19struct ax_plat_data { 20struct ax_plat_data {
20 unsigned int flags; 21 unsigned int flags;
21 unsigned char wordlength; /* 1 or 2 */ 22 unsigned char wordlength; /* 1 or 2 */
22 unsigned char dcr_val; /* default value for DCR */ 23 unsigned char dcr_val; /* default value for DCR */
23 unsigned char rcr_val; /* default value for RCR */ 24 unsigned char rcr_val; /* default value for RCR */
24 unsigned char gpoc_val; /* default value for GPOC */ 25 unsigned char gpoc_val; /* default value for GPOC */
25 u32 *reg_offsets; /* register offsets */ 26 u32 *reg_offsets; /* register offsets */
27 u8 *mac_addr; /* MAC addr (only used when
28 AXFLG_MAC_FROMPLATFORM is used */
26}; 29};
27 30
28#endif /* __NET_AX88796_PLAT_H */ 31#endif /* __NET_AX88796_PLAT_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index a04f8463ac7e..3ad5390a4dd5 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -53,6 +53,17 @@
53#define SOL_SCO 17 53#define SOL_SCO 17
54#define SOL_RFCOMM 18 54#define SOL_RFCOMM 18
55 55
56#define BT_SECURITY 4
57struct bt_security {
58 __u8 level;
59};
60#define BT_SECURITY_SDP 0
61#define BT_SECURITY_LOW 1
62#define BT_SECURITY_MEDIUM 2
63#define BT_SECURITY_HIGH 3
64
65#define BT_DEFER_SETUP 7
66
56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 67#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
57#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) 68#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
58#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) 69#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
@@ -108,6 +119,7 @@ struct bt_sock {
108 bdaddr_t dst; 119 bdaddr_t dst;
109 struct list_head accept_q; 120 struct list_head accept_q;
110 struct sock *parent; 121 struct sock *parent;
122 u32 defer_setup;
111}; 123};
112 124
113struct bt_sock_list { 125struct bt_sock_list {
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3645139e68c7..ed3aea1605e8 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -101,6 +101,7 @@ enum {
101/* HCI timeouts */ 101/* HCI timeouts */
102#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */ 102#define HCI_CONNECT_TIMEOUT (40000) /* 40 seconds */
103#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */ 103#define HCI_DISCONN_TIMEOUT (2000) /* 2 seconds */
104#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
104#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 105#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
105#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 106#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
106 107
@@ -133,8 +134,13 @@ enum {
133#define ESCO_EV3 0x0008 134#define ESCO_EV3 0x0008
134#define ESCO_EV4 0x0010 135#define ESCO_EV4 0x0010
135#define ESCO_EV5 0x0020 136#define ESCO_EV5 0x0020
137#define ESCO_2EV3 0x0040
138#define ESCO_3EV3 0x0080
139#define ESCO_2EV5 0x0100
140#define ESCO_3EV5 0x0200
136 141
137#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) 142#define SCO_ESCO_MASK (ESCO_HV1 | ESCO_HV2 | ESCO_HV3)
143#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
138 144
139/* ACL flags */ 145/* ACL flags */
140#define ACL_CONT 0x01 146#define ACL_CONT 0x01
@@ -176,6 +182,9 @@ enum {
176#define LMP_EV5 0x02 182#define LMP_EV5 0x02
177 183
178#define LMP_SNIFF_SUBR 0x02 184#define LMP_SNIFF_SUBR 0x02
185#define LMP_EDR_ESCO_2M 0x20
186#define LMP_EDR_ESCO_3M 0x40
187#define LMP_EDR_3S_ESCO 0x80
179 188
180#define LMP_SIMPLE_PAIR 0x08 189#define LMP_SIMPLE_PAIR 0x08
181 190
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 46a43b721dd6..73aead222b32 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -169,7 +169,9 @@ struct hci_conn {
169 __u16 link_policy; 169 __u16 link_policy;
170 __u32 link_mode; 170 __u32 link_mode;
171 __u8 auth_type; 171 __u8 auth_type;
172 __u8 sec_level;
172 __u8 power_save; 173 __u8 power_save;
174 __u16 disc_timeout;
173 unsigned long pend; 175 unsigned long pend;
174 176
175 unsigned int sent; 177 unsigned int sent;
@@ -179,7 +181,8 @@ struct hci_conn {
179 struct timer_list disc_timer; 181 struct timer_list disc_timer;
180 struct timer_list idle_timer; 182 struct timer_list idle_timer;
181 183
182 struct work_struct work; 184 struct work_struct work_add;
185 struct work_struct work_del;
183 186
184 struct device dev; 187 struct device dev;
185 188
@@ -325,12 +328,11 @@ int hci_conn_del(struct hci_conn *conn);
325void hci_conn_hash_flush(struct hci_dev *hdev); 328void hci_conn_hash_flush(struct hci_dev *hdev);
326void hci_conn_check_pending(struct hci_dev *hdev); 329void hci_conn_check_pending(struct hci_dev *hdev);
327 330
328struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 auth_type); 331struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type);
329int hci_conn_check_link_mode(struct hci_conn *conn); 332int hci_conn_check_link_mode(struct hci_conn *conn);
330int hci_conn_auth(struct hci_conn *conn); 333int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type);
331int hci_conn_encrypt(struct hci_conn *conn);
332int hci_conn_change_link_key(struct hci_conn *conn); 334int hci_conn_change_link_key(struct hci_conn *conn);
333int hci_conn_switch_role(struct hci_conn *conn, uint8_t role); 335int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
334 336
335void hci_conn_enter_active_mode(struct hci_conn *conn); 337void hci_conn_enter_active_mode(struct hci_conn *conn);
336void hci_conn_enter_sniff_mode(struct hci_conn *conn); 338void hci_conn_enter_sniff_mode(struct hci_conn *conn);
@@ -348,9 +350,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
348 if (conn->type == ACL_LINK) { 350 if (conn->type == ACL_LINK) {
349 del_timer(&conn->idle_timer); 351 del_timer(&conn->idle_timer);
350 if (conn->state == BT_CONNECTED) { 352 if (conn->state == BT_CONNECTED) {
351 timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT); 353 timeo = msecs_to_jiffies(conn->disc_timeout);
352 if (!conn->out) 354 if (!conn->out)
353 timeo *= 5; 355 timeo *= 2;
354 } else 356 } else
355 timeo = msecs_to_jiffies(10); 357 timeo = msecs_to_jiffies(10);
356 } else 358 } else
@@ -455,6 +457,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
455 457
456int hci_register_sysfs(struct hci_dev *hdev); 458int hci_register_sysfs(struct hci_dev *hdev);
457void hci_unregister_sysfs(struct hci_dev *hdev); 459void hci_unregister_sysfs(struct hci_dev *hdev);
460void hci_conn_init_sysfs(struct hci_conn *conn);
458void hci_conn_add_sysfs(struct hci_conn *conn); 461void hci_conn_add_sysfs(struct hci_conn *conn);
459void hci_conn_del_sysfs(struct hci_conn *conn); 462void hci_conn_del_sysfs(struct hci_conn *conn);
460 463
@@ -470,26 +473,26 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
470 473
471/* ----- HCI protocols ----- */ 474/* ----- HCI protocols ----- */
472struct hci_proto { 475struct hci_proto {
473 char *name; 476 char *name;
474 unsigned int id; 477 unsigned int id;
475 unsigned long flags; 478 unsigned long flags;
476 479
477 void *priv; 480 void *priv;
478 481
479 int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type); 482 int (*connect_ind) (struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type);
480 int (*connect_cfm) (struct hci_conn *conn, __u8 status); 483 int (*connect_cfm) (struct hci_conn *conn, __u8 status);
481 int (*disconn_ind) (struct hci_conn *conn, __u8 reason); 484 int (*disconn_ind) (struct hci_conn *conn);
485 int (*disconn_cfm) (struct hci_conn *conn, __u8 reason);
482 int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, __u16 flags); 486 int (*recv_acldata) (struct hci_conn *conn, struct sk_buff *skb, __u16 flags);
483 int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb); 487 int (*recv_scodata) (struct hci_conn *conn, struct sk_buff *skb);
484 int (*auth_cfm) (struct hci_conn *conn, __u8 status); 488 int (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
485 int (*encrypt_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
486}; 489};
487 490
488static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type) 491static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type)
489{ 492{
490 register struct hci_proto *hp; 493 register struct hci_proto *hp;
491 int mask = 0; 494 int mask = 0;
492 495
493 hp = hci_proto[HCI_PROTO_L2CAP]; 496 hp = hci_proto[HCI_PROTO_L2CAP];
494 if (hp && hp->connect_ind) 497 if (hp && hp->connect_ind)
495 mask |= hp->connect_ind(hdev, bdaddr, type); 498 mask |= hp->connect_ind(hdev, bdaddr, type);
@@ -514,30 +517,52 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
514 hp->connect_cfm(conn, status); 517 hp->connect_cfm(conn, status);
515} 518}
516 519
517static inline void hci_proto_disconn_ind(struct hci_conn *conn, __u8 reason) 520static inline int hci_proto_disconn_ind(struct hci_conn *conn)
518{ 521{
519 register struct hci_proto *hp; 522 register struct hci_proto *hp;
523 int reason = 0x13;
520 524
521 hp = hci_proto[HCI_PROTO_L2CAP]; 525 hp = hci_proto[HCI_PROTO_L2CAP];
522 if (hp && hp->disconn_ind) 526 if (hp && hp->disconn_ind)
523 hp->disconn_ind(conn, reason); 527 reason = hp->disconn_ind(conn);
524 528
525 hp = hci_proto[HCI_PROTO_SCO]; 529 hp = hci_proto[HCI_PROTO_SCO];
526 if (hp && hp->disconn_ind) 530 if (hp && hp->disconn_ind)
527 hp->disconn_ind(conn, reason); 531 reason = hp->disconn_ind(conn);
532
533 return reason;
534}
535
536static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
537{
538 register struct hci_proto *hp;
539
540 hp = hci_proto[HCI_PROTO_L2CAP];
541 if (hp && hp->disconn_cfm)
542 hp->disconn_cfm(conn, reason);
543
544 hp = hci_proto[HCI_PROTO_SCO];
545 if (hp && hp->disconn_cfm)
546 hp->disconn_cfm(conn, reason);
528} 547}
529 548
530static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) 549static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
531{ 550{
532 register struct hci_proto *hp; 551 register struct hci_proto *hp;
552 __u8 encrypt;
553
554 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
555 return;
556
557 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
533 558
534 hp = hci_proto[HCI_PROTO_L2CAP]; 559 hp = hci_proto[HCI_PROTO_L2CAP];
535 if (hp && hp->auth_cfm) 560 if (hp && hp->security_cfm)
536 hp->auth_cfm(conn, status); 561 hp->security_cfm(conn, status, encrypt);
537 562
538 hp = hci_proto[HCI_PROTO_SCO]; 563 hp = hci_proto[HCI_PROTO_SCO];
539 if (hp && hp->auth_cfm) 564 if (hp && hp->security_cfm)
540 hp->auth_cfm(conn, status); 565 hp->security_cfm(conn, status, encrypt);
541} 566}
542 567
543static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) 568static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt)
@@ -545,12 +570,12 @@ static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u
545 register struct hci_proto *hp; 570 register struct hci_proto *hp;
546 571
547 hp = hci_proto[HCI_PROTO_L2CAP]; 572 hp = hci_proto[HCI_PROTO_L2CAP];
548 if (hp && hp->encrypt_cfm) 573 if (hp && hp->security_cfm)
549 hp->encrypt_cfm(conn, status, encrypt); 574 hp->security_cfm(conn, status, encrypt);
550 575
551 hp = hci_proto[HCI_PROTO_SCO]; 576 hp = hci_proto[HCI_PROTO_SCO];
552 if (hp && hp->encrypt_cfm) 577 if (hp && hp->security_cfm)
553 hp->encrypt_cfm(conn, status, encrypt); 578 hp->security_cfm(conn, status, encrypt);
554} 579}
555 580
556int hci_register_proto(struct hci_proto *hproto); 581int hci_register_proto(struct hci_proto *hproto);
@@ -562,8 +587,7 @@ struct hci_cb {
562 587
563 char *name; 588 char *name;
564 589
565 void (*auth_cfm) (struct hci_conn *conn, __u8 status); 590 void (*security_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
566 void (*encrypt_cfm) (struct hci_conn *conn, __u8 status, __u8 encrypt);
567 void (*key_change_cfm) (struct hci_conn *conn, __u8 status); 591 void (*key_change_cfm) (struct hci_conn *conn, __u8 status);
568 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); 592 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role);
569}; 593};
@@ -571,14 +595,20 @@ struct hci_cb {
571static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) 595static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
572{ 596{
573 struct list_head *p; 597 struct list_head *p;
598 __u8 encrypt;
574 599
575 hci_proto_auth_cfm(conn, status); 600 hci_proto_auth_cfm(conn, status);
576 601
602 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
603 return;
604
605 encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
606
577 read_lock_bh(&hci_cb_list_lock); 607 read_lock_bh(&hci_cb_list_lock);
578 list_for_each(p, &hci_cb_list) { 608 list_for_each(p, &hci_cb_list) {
579 struct hci_cb *cb = list_entry(p, struct hci_cb, list); 609 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
580 if (cb->auth_cfm) 610 if (cb->security_cfm)
581 cb->auth_cfm(conn, status); 611 cb->security_cfm(conn, status, encrypt);
582 } 612 }
583 read_unlock_bh(&hci_cb_list_lock); 613 read_unlock_bh(&hci_cb_list_lock);
584} 614}
@@ -587,13 +617,16 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encr
587{ 617{
588 struct list_head *p; 618 struct list_head *p;
589 619
620 if (conn->sec_level == BT_SECURITY_SDP)
621 conn->sec_level = BT_SECURITY_LOW;
622
590 hci_proto_encrypt_cfm(conn, status, encrypt); 623 hci_proto_encrypt_cfm(conn, status, encrypt);
591 624
592 read_lock_bh(&hci_cb_list_lock); 625 read_lock_bh(&hci_cb_list_lock);
593 list_for_each(p, &hci_cb_list) { 626 list_for_each(p, &hci_cb_list) {
594 struct hci_cb *cb = list_entry(p, struct hci_cb, list); 627 struct hci_cb *cb = list_entry(p, struct hci_cb, list);
595 if (cb->encrypt_cfm) 628 if (cb->security_cfm)
596 cb->encrypt_cfm(conn, status, encrypt); 629 cb->security_cfm(conn, status, encrypt);
597 } 630 }
598 read_unlock_bh(&hci_cb_list_lock); 631 read_unlock_bh(&hci_cb_list_lock);
599} 632}
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 73e115bc12dd..f566aa1f0a4c 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -37,6 +37,7 @@ struct sockaddr_l2 {
37 sa_family_t l2_family; 37 sa_family_t l2_family;
38 __le16 l2_psm; 38 __le16 l2_psm;
39 bdaddr_t l2_bdaddr; 39 bdaddr_t l2_bdaddr;
40 __le16 l2_cid;
40}; 41};
41 42
42/* L2CAP socket options */ 43/* L2CAP socket options */
@@ -185,6 +186,7 @@ struct l2cap_info_rsp {
185/* info type */ 186/* info type */
186#define L2CAP_IT_CL_MTU 0x0001 187#define L2CAP_IT_CL_MTU 0x0001
187#define L2CAP_IT_FEAT_MASK 0x0002 188#define L2CAP_IT_FEAT_MASK 0x0002
189#define L2CAP_IT_FIXED_CHAN 0x0003
188 190
189/* info result */ 191/* info result */
190#define L2CAP_IR_SUCCESS 0x0000 192#define L2CAP_IR_SUCCESS 0x0000
@@ -219,11 +221,14 @@ struct l2cap_conn {
219 __u8 rx_ident; 221 __u8 rx_ident;
220 __u8 tx_ident; 222 __u8 tx_ident;
221 223
224 __u8 disc_reason;
225
222 struct l2cap_chan_list chan_list; 226 struct l2cap_chan_list chan_list;
223}; 227};
224 228
225#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 229#define L2CAP_INFO_CL_MTU_REQ_SENT 0x01
226#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x02 230#define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04
231#define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08
227 232
228/* ----- L2CAP channel and socket info ----- */ 233/* ----- L2CAP channel and socket info ----- */
229#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 234#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
@@ -237,8 +242,9 @@ struct l2cap_pinfo {
237 __u16 imtu; 242 __u16 imtu;
238 __u16 omtu; 243 __u16 omtu;
239 __u16 flush_to; 244 __u16 flush_to;
240 245 __u8 sec_level;
241 __u32 link_mode; 246 __u8 role_switch;
247 __u8 force_reliable;
242 248
243 __u8 conf_req[64]; 249 __u8 conf_req[64];
244 __u8 conf_len; 250 __u8 conf_len;
@@ -257,6 +263,7 @@ struct l2cap_pinfo {
257#define L2CAP_CONF_REQ_SENT 0x01 263#define L2CAP_CONF_REQ_SENT 0x01
258#define L2CAP_CONF_INPUT_DONE 0x02 264#define L2CAP_CONF_INPUT_DONE 0x02
259#define L2CAP_CONF_OUTPUT_DONE 0x04 265#define L2CAP_CONF_OUTPUT_DONE 0x04
266#define L2CAP_CONF_CONNECT_PEND 0x80
260 267
261#define L2CAP_CONF_MAX_RETRIES 2 268#define L2CAP_CONF_MAX_RETRIES 2
262 269
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 4dc8d92a4638..80072611d26a 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -183,8 +183,9 @@ struct rfcomm_dlc {
183 u8 remote_v24_sig; 183 u8 remote_v24_sig;
184 u8 mscex; 184 u8 mscex;
185 u8 out; 185 u8 out;
186 186 u8 sec_level;
187 u32 link_mode; 187 u8 role_switch;
188 u32 defer_setup;
188 189
189 uint mtu; 190 uint mtu;
190 uint cfc; 191 uint cfc;
@@ -202,10 +203,12 @@ struct rfcomm_dlc {
202#define RFCOMM_RX_THROTTLED 0 203#define RFCOMM_RX_THROTTLED 0
203#define RFCOMM_TX_THROTTLED 1 204#define RFCOMM_TX_THROTTLED 1
204#define RFCOMM_TIMED_OUT 2 205#define RFCOMM_TIMED_OUT 2
205#define RFCOMM_MSC_PENDING 3 206#define RFCOMM_MSC_PENDING 3
206#define RFCOMM_AUTH_PENDING 4 207#define RFCOMM_SEC_PENDING 4
207#define RFCOMM_AUTH_ACCEPT 5 208#define RFCOMM_AUTH_PENDING 5
208#define RFCOMM_AUTH_REJECT 6 209#define RFCOMM_AUTH_ACCEPT 6
210#define RFCOMM_AUTH_REJECT 7
211#define RFCOMM_DEFER_SETUP 8
209 212
210/* Scheduling flags and events */ 213/* Scheduling flags and events */
211#define RFCOMM_SCHED_STATE 0 214#define RFCOMM_SCHED_STATE 0
@@ -239,6 +242,7 @@ int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason);
239int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); 242int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb);
240int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); 243int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig);
241int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); 244int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig);
245void rfcomm_dlc_accept(struct rfcomm_dlc *d);
242 246
243#define rfcomm_dlc_lock(d) spin_lock(&d->lock) 247#define rfcomm_dlc_lock(d) spin_lock(&d->lock)
244#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) 248#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock)
@@ -304,7 +308,8 @@ struct rfcomm_pinfo {
304 struct bt_sock bt; 308 struct bt_sock bt;
305 struct rfcomm_dlc *dlc; 309 struct rfcomm_dlc *dlc;
306 u8 channel; 310 u8 channel;
307 u32 link_mode; 311 u8 sec_level;
312 u8 role_switch;
308}; 313};
309 314
310int rfcomm_init_sockets(void); 315int rfcomm_init_sockets(void);
@@ -333,7 +338,6 @@ struct rfcomm_dev_req {
333 bdaddr_t src; 338 bdaddr_t src;
334 bdaddr_t dst; 339 bdaddr_t dst;
335 u8 channel; 340 u8 channel;
336
337}; 341};
338 342
339struct rfcomm_dev_info { 343struct rfcomm_dev_info {
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 23c0ab74ded6..5389afdc1297 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4,6 +4,10 @@
4#include <linux/netlink.h> 4#include <linux/netlink.h>
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6#include <linux/nl80211.h> 6#include <linux/nl80211.h>
7#include <linux/if_ether.h>
8#include <linux/ieee80211.h>
9#include <linux/wireless.h>
10#include <net/iw_handler.h>
7#include <net/genetlink.h> 11#include <net/genetlink.h>
8/* remove once we remove the wext stuff */ 12/* remove once we remove the wext stuff */
9#include <net/iw_handler.h> 13#include <net/iw_handler.h>
@@ -112,12 +116,14 @@ struct beacon_parameters {
112 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames 116 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
113 * with short preambles 117 * with short preambles
114 * @STATION_FLAG_WME: station is WME/QoS capable 118 * @STATION_FLAG_WME: station is WME/QoS capable
119 * @STATION_FLAG_MFP: station uses management frame protection
115 */ 120 */
116enum station_flags { 121enum station_flags {
117 STATION_FLAG_CHANGED = 1<<0, 122 STATION_FLAG_CHANGED = 1<<0,
118 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED, 123 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED,
119 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE, 124 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
120 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME, 125 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME,
126 STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP,
121}; 127};
122 128
123/** 129/**
@@ -172,6 +178,8 @@ struct station_parameters {
172 * @STATION_INFO_SIGNAL: @signal filled 178 * @STATION_INFO_SIGNAL: @signal filled
173 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled 179 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
174 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 180 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
181 * @STATION_INFO_RX_PACKETS: @rx_packets filled
182 * @STATION_INFO_TX_PACKETS: @tx_packets filled
175 */ 183 */
176enum station_info_flags { 184enum station_info_flags {
177 STATION_INFO_INACTIVE_TIME = 1<<0, 185 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -182,6 +190,8 @@ enum station_info_flags {
182 STATION_INFO_PLINK_STATE = 1<<5, 190 STATION_INFO_PLINK_STATE = 1<<5,
183 STATION_INFO_SIGNAL = 1<<6, 191 STATION_INFO_SIGNAL = 1<<6,
184 STATION_INFO_TX_BITRATE = 1<<7, 192 STATION_INFO_TX_BITRATE = 1<<7,
193 STATION_INFO_RX_PACKETS = 1<<8,
194 STATION_INFO_TX_PACKETS = 1<<9,
185}; 195};
186 196
187/** 197/**
@@ -229,6 +239,8 @@ struct rate_info {
229 * @plink_state: mesh peer link state 239 * @plink_state: mesh peer link state
230 * @signal: signal strength of last received packet in dBm 240 * @signal: signal strength of last received packet in dBm
231 * @txrate: current unicast bitrate to this station 241 * @txrate: current unicast bitrate to this station
242 * @rx_packets: packets received from this station
243 * @tx_packets: packets transmitted to this station
232 */ 244 */
233struct station_info { 245struct station_info {
234 u32 filled; 246 u32 filled;
@@ -240,6 +252,8 @@ struct station_info {
240 u8 plink_state; 252 u8 plink_state;
241 s8 signal; 253 s8 signal;
242 struct rate_info txrate; 254 struct rate_info txrate;
255 u32 rx_packets;
256 u32 tx_packets;
243}; 257};
244 258
245/** 259/**
@@ -335,24 +349,50 @@ struct bss_parameters {
335}; 349};
336 350
337/** 351/**
338 * enum reg_set_by - Indicates who is trying to set the regulatory domain 352 * enum environment_cap - Environment parsed from country IE
339 * @REGDOM_SET_BY_INIT: regulatory domain was set by initialization. We will be 353 * @ENVIRON_ANY: indicates country IE applies to both indoor and
340 * using a static world regulatory domain by default. 354 * outdoor operation.
341 * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain. 355 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
342 * @REGDOM_SET_BY_USER: User asked the wireless core to set the 356 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
343 * regulatory domain. 357 */
344 * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core 358enum environment_cap {
345 * it thinks its knows the regulatory domain we should be in. 359 ENVIRON_ANY,
346 * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country 360 ENVIRON_INDOOR,
347 * information element with regulatory information it thinks we 361 ENVIRON_OUTDOOR,
348 * should consider. 362};
363
364/**
365 * struct regulatory_request - used to keep track of regulatory requests
366 *
367 * @wiphy_idx: this is set if this request's initiator is
368 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
369 * can be used by the wireless core to deal with conflicts
370 * and potentially inform users of which devices specifically
371 * cased the conflicts.
372 * @initiator: indicates who sent this request, could be any of
373 * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
374 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
375 * regulatory domain. We have a few special codes:
376 * 00 - World regulatory domain
377 * 99 - built by driver but a specific alpha2 cannot be determined
378 * 98 - result of an intersection between two regulatory domains
379 * @intersect: indicates whether the wireless core should intersect
380 * the requested regulatory domain with the presently set regulatory
381 * domain.
382 * @country_ie_checksum: checksum of the last processed and accepted
383 * country IE
384 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
385 * indoor, or if it doesn't matter
386 * @list: used to insert into the reg_requests_list linked list
349 */ 387 */
350enum reg_set_by { 388struct regulatory_request {
351 REGDOM_SET_BY_INIT, 389 int wiphy_idx;
352 REGDOM_SET_BY_CORE, 390 enum nl80211_reg_initiator initiator;
353 REGDOM_SET_BY_USER, 391 char alpha2[2];
354 REGDOM_SET_BY_DRIVER, 392 bool intersect;
355 REGDOM_SET_BY_COUNTRY_IE, 393 u32 country_ie_checksum;
394 enum environment_cap country_ie_env;
395 struct list_head list;
356}; 396};
357 397
358struct ieee80211_freq_range { 398struct ieee80211_freq_range {
@@ -438,6 +478,187 @@ struct wiphy;
438struct ieee80211_channel; 478struct ieee80211_channel;
439 479
440/** 480/**
481 * struct cfg80211_ssid - SSID description
482 * @ssid: the SSID
483 * @ssid_len: length of the ssid
484 */
485struct cfg80211_ssid {
486 u8 ssid[IEEE80211_MAX_SSID_LEN];
487 u8 ssid_len;
488};
489
490/**
491 * struct cfg80211_scan_request - scan request description
492 *
493 * @ssids: SSIDs to scan for (active scan only)
494 * @n_ssids: number of SSIDs
495 * @channels: channels to scan on.
496 * @n_channels: number of channels for each band
497 * @ie: optional information element(s) to add into Probe Request or %NULL
498 * @ie_len: length of ie in octets
499 * @wiphy: the wiphy this was for
500 * @ifidx: the interface index
501 */
502struct cfg80211_scan_request {
503 struct cfg80211_ssid *ssids;
504 int n_ssids;
505 struct ieee80211_channel **channels;
506 u32 n_channels;
507 u8 *ie;
508 size_t ie_len;
509
510 /* internal */
511 struct wiphy *wiphy;
512 int ifidx;
513};
514
515/**
516 * enum cfg80211_signal_type - signal type
517 *
518 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
519 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
520 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
521 */
522enum cfg80211_signal_type {
523 CFG80211_SIGNAL_TYPE_NONE,
524 CFG80211_SIGNAL_TYPE_MBM,
525 CFG80211_SIGNAL_TYPE_UNSPEC,
526};
527
528/**
529 * struct cfg80211_bss - BSS description
530 *
531 * This structure describes a BSS (which may also be a mesh network)
532 * for use in scan results and similar.
533 *
534 * @bssid: BSSID of the BSS
535 * @tsf: timestamp of last received update
536 * @beacon_interval: the beacon interval as from the frame
537 * @capability: the capability field in host byte order
538 * @information_elements: the information elements (Note that there
539 * is no guarantee that these are well-formed!)
540 * @len_information_elements: total length of the information elements
541 * @signal: signal strength value (type depends on the wiphy's signal_type)
542 * @hold: BSS should not expire
543 * @free_priv: function pointer to free private data
544 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
545 */
546struct cfg80211_bss {
547 struct ieee80211_channel *channel;
548
549 u8 bssid[ETH_ALEN];
550 u64 tsf;
551 u16 beacon_interval;
552 u16 capability;
553 u8 *information_elements;
554 size_t len_information_elements;
555
556 s32 signal;
557
558 void (*free_priv)(struct cfg80211_bss *bss);
559 u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
560};
561
562/**
563 * struct cfg80211_auth_request - Authentication request data
564 *
565 * This structure provides information needed to complete IEEE 802.11
566 * authentication.
567 * NOTE: This structure will likely change when more code from mac80211 is
568 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
569 * Before using this in a driver that does not use mac80211, it would be better
570 * to check the status of that work and better yet, volunteer to work on it.
571 *
572 * @chan: The channel to use or %NULL if not specified (auto-select based on
573 * scan results)
574 * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
575 * this field is required to be present; if the driver wants to help with
576 * BSS selection, it should use (yet to be added) MLME event to allow user
577 * space SME to be notified of roaming candidate, so that the SME can then
578 * use the authentication request with the recommended BSSID and whatever
579 * other data may be needed for authentication/association
580 * @ssid: SSID or %NULL if not yet available
581 * @ssid_len: Length of ssid in octets
582 * @auth_type: Authentication type (algorithm)
583 * @ie: Extra IEs to add to Authentication frame or %NULL
584 * @ie_len: Length of ie buffer in octets
585 */
586struct cfg80211_auth_request {
587 struct ieee80211_channel *chan;
588 u8 *peer_addr;
589 const u8 *ssid;
590 size_t ssid_len;
591 enum nl80211_auth_type auth_type;
592 const u8 *ie;
593 size_t ie_len;
594};
595
596/**
597 * struct cfg80211_assoc_request - (Re)Association request data
598 *
599 * This structure provides information needed to complete IEEE 802.11
600 * (re)association.
601 * NOTE: This structure will likely change when more code from mac80211 is
602 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
603 * Before using this in a driver that does not use mac80211, it would be better
604 * to check the status of that work and better yet, volunteer to work on it.
605 *
606 * @chan: The channel to use or %NULL if not specified (auto-select based on
607 * scan results)
608 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
609 * to be present and the STA must be in State 2 (authenticated) with the
610 * peer STA
611 * @ssid: SSID
612 * @ssid_len: Length of ssid in octets
613 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
614 * @ie_len: Length of ie buffer in octets
615 */
616struct cfg80211_assoc_request {
617 struct ieee80211_channel *chan;
618 u8 *peer_addr;
619 const u8 *ssid;
620 size_t ssid_len;
621 const u8 *ie;
622 size_t ie_len;
623};
624
625/**
626 * struct cfg80211_deauth_request - Deauthentication request data
627 *
628 * This structure provides information needed to complete IEEE 802.11
629 * deauthentication.
630 *
631 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
632 * to be present and the STA must be authenticated with the peer STA
633 * @ie: Extra IEs to add to Deauthentication frame or %NULL
634 * @ie_len: Length of ie buffer in octets
635 */
636struct cfg80211_deauth_request {
637 u8 *peer_addr;
638 u16 reason_code;
639 const u8 *ie;
640 size_t ie_len;
641};
642
643/**
644 * struct cfg80211_disassoc_request - Disassociation request data
645 *
646 * This structure provides information needed to complete IEEE 802.11
647 * disassocation.
648 *
649 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
650 * to be present and the STA must be associated with the peer STA
651 * @ie: Extra IEs to add to Disassociation frame or %NULL
652 * @ie_len: Length of ie buffer in octets
653 */
654struct cfg80211_disassoc_request {
655 u8 *peer_addr;
656 u16 reason_code;
657 const u8 *ie;
658 size_t ie_len;
659};
660
661/**
441 * struct cfg80211_ops - backend description for wireless configuration 662 * struct cfg80211_ops - backend description for wireless configuration
442 * 663 *
443 * This struct is registered by fullmac card drivers and/or wireless stacks 664 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -450,6 +671,9 @@ struct ieee80211_channel;
450 * wireless extensions but this is subject to reevaluation as soon as this 671 * wireless extensions but this is subject to reevaluation as soon as this
451 * code is used more widely and we have a first user without wext. 672 * code is used more widely and we have a first user without wext.
452 * 673 *
674 * @suspend: wiphy device needs to be suspended
675 * @resume: wiphy device needs to be resumed
676 *
453 * @add_virtual_intf: create a new virtual interface with the given name, 677 * @add_virtual_intf: create a new virtual interface with the given name,
454 * must set the struct wireless_dev's iftype. 678 * must set the struct wireless_dev's iftype.
455 * 679 *
@@ -471,6 +695,8 @@ struct ieee80211_channel;
471 * 695 *
472 * @set_default_key: set the default key on an interface 696 * @set_default_key: set the default key on an interface
473 * 697 *
698 * @set_default_mgmt_key: set the default management frame key on an interface
699 *
474 * @add_beacon: Add a beacon with given parameters, @head, @interval 700 * @add_beacon: Add a beacon with given parameters, @head, @interval
475 * and @dtim_period will be valid, @tail is optional. 701 * and @dtim_period will be valid, @tail is optional.
476 * @set_beacon: Change the beacon parameters for an access point mode 702 * @set_beacon: Change the beacon parameters for an access point mode
@@ -497,8 +723,21 @@ struct ieee80211_channel;
497 * @set_txq_params: Set TX queue parameters 723 * @set_txq_params: Set TX queue parameters
498 * 724 *
499 * @set_channel: Set channel 725 * @set_channel: Set channel
726 *
727 * @scan: Request to do a scan. If returning zero, the scan request is given
728 * the driver, and will be valid until passed to cfg80211_scan_done().
729 * For scan results, call cfg80211_inform_bss(); you can call this outside
730 * the scan/scan_done bracket too.
731 *
732 * @auth: Request to authenticate with the specified peer
733 * @assoc: Request to (re)associate with the specified peer
734 * @deauth: Request to deauthenticate from the specified peer
735 * @disassoc: Request to disassociate from the specified peer
500 */ 736 */
501struct cfg80211_ops { 737struct cfg80211_ops {
738 int (*suspend)(struct wiphy *wiphy);
739 int (*resume)(struct wiphy *wiphy);
740
502 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 741 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
503 enum nl80211_iftype type, u32 *flags, 742 enum nl80211_iftype type, u32 *flags,
504 struct vif_params *params); 743 struct vif_params *params);
@@ -518,6 +757,9 @@ struct cfg80211_ops {
518 int (*set_default_key)(struct wiphy *wiphy, 757 int (*set_default_key)(struct wiphy *wiphy,
519 struct net_device *netdev, 758 struct net_device *netdev,
520 u8 key_index); 759 u8 key_index);
760 int (*set_default_mgmt_key)(struct wiphy *wiphy,
761 struct net_device *netdev,
762 u8 key_index);
521 763
522 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 764 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
523 struct beacon_parameters *info); 765 struct beacon_parameters *info);
@@ -564,6 +806,18 @@ struct cfg80211_ops {
564 int (*set_channel)(struct wiphy *wiphy, 806 int (*set_channel)(struct wiphy *wiphy,
565 struct ieee80211_channel *chan, 807 struct ieee80211_channel *chan,
566 enum nl80211_channel_type channel_type); 808 enum nl80211_channel_type channel_type);
809
810 int (*scan)(struct wiphy *wiphy, struct net_device *dev,
811 struct cfg80211_scan_request *request);
812
813 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
814 struct cfg80211_auth_request *req);
815 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
816 struct cfg80211_assoc_request *req);
817 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
818 struct cfg80211_deauth_request *req);
819 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
820 struct cfg80211_disassoc_request *req);
567}; 821};
568 822
569/* temporary wext handlers */ 823/* temporary wext handlers */
@@ -574,5 +828,134 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
574 u32 *mode, char *extra); 828 u32 *mode, char *extra);
575int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 829int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
576 u32 *mode, char *extra); 830 u32 *mode, char *extra);
831int cfg80211_wext_siwscan(struct net_device *dev,
832 struct iw_request_info *info,
833 union iwreq_data *wrqu, char *extra);
834int cfg80211_wext_giwscan(struct net_device *dev,
835 struct iw_request_info *info,
836 struct iw_point *data, char *extra);
837int cfg80211_wext_giwrange(struct net_device *dev,
838 struct iw_request_info *info,
839 struct iw_point *data, char *extra);
840
841/**
842 * cfg80211_scan_done - notify that scan finished
843 *
844 * @request: the corresponding scan request
845 * @aborted: set to true if the scan was aborted for any reason,
846 * userspace will be notified of that
847 */
848void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
849
850/**
851 * cfg80211_inform_bss - inform cfg80211 of a new BSS
852 *
853 * @wiphy: the wiphy reporting the BSS
854 * @bss: the found BSS
855 * @signal: the signal strength, type depends on the wiphy's signal_type
856 * @gfp: context flags
857 *
858 * This informs cfg80211 that BSS information was found and
859 * the BSS should be updated/added.
860 */
861struct cfg80211_bss*
862cfg80211_inform_bss_frame(struct wiphy *wiphy,
863 struct ieee80211_channel *channel,
864 struct ieee80211_mgmt *mgmt, size_t len,
865 s32 signal, gfp_t gfp);
866
867struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
868 struct ieee80211_channel *channel,
869 const u8 *bssid,
870 const u8 *ssid, size_t ssid_len,
871 u16 capa_mask, u16 capa_val);
872static inline struct cfg80211_bss *
873cfg80211_get_ibss(struct wiphy *wiphy,
874 struct ieee80211_channel *channel,
875 const u8 *ssid, size_t ssid_len)
876{
877 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
878 WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
879}
880
881struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
882 struct ieee80211_channel *channel,
883 const u8 *meshid, size_t meshidlen,
884 const u8 *meshcfg);
885void cfg80211_put_bss(struct cfg80211_bss *bss);
886/**
887 * cfg80211_unlink_bss - unlink BSS from internal data structures
888 * @wiphy: the wiphy
889 * @bss: the bss to remove
890 *
891 * This function removes the given BSS from the internal data structures
892 * thereby making it no longer show up in scan results etc. Use this
893 * function when you detect a BSS is gone. Normally BSSes will also time
894 * out, so it is not necessary to use this function at all.
895 */
896void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
897
898/**
899 * cfg80211_send_rx_auth - notification of processed authentication
900 * @dev: network device
901 * @buf: authentication frame (header + body)
902 * @len: length of the frame data
903 *
904 * This function is called whenever an authentication has been processed in
905 * station mode.
906 */
907void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
908
909/**
910 * cfg80211_send_rx_assoc - notification of processed association
911 * @dev: network device
912 * @buf: (re)association response frame (header + body)
913 * @len: length of the frame data
914 *
915 * This function is called whenever a (re)association response has been
916 * processed in station mode.
917 */
918void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
919
920/**
921 * cfg80211_send_rx_deauth - notification of processed deauthentication
922 * @dev: network device
923 * @buf: deauthentication frame (header + body)
924 * @len: length of the frame data
925 *
926 * This function is called whenever deauthentication has been processed in
927 * station mode.
928 */
929void cfg80211_send_rx_deauth(struct net_device *dev, const u8 *buf,
930 size_t len);
931
932/**
933 * cfg80211_send_rx_disassoc - notification of processed disassociation
934 * @dev: network device
935 * @buf: disassociation response frame (header + body)
936 * @len: length of the frame data
937 *
938 * This function is called whenever disassociation has been processed in
939 * station mode.
940 */
941void cfg80211_send_rx_disassoc(struct net_device *dev, const u8 *buf,
942 size_t len);
943
944/**
945 * cfg80211_hold_bss - exclude bss from expiration
946 * @bss: bss which should not expire
947 *
948 * In a case when the BSS is not updated but it shouldn't expire this
949 * function can be used to mark the BSS to be excluded from expiration.
950 */
951void cfg80211_hold_bss(struct cfg80211_bss *bss);
952
953/**
954 * cfg80211_unhold_bss - remove expiration exception from the BSS
955 * @bss: bss which can expire again
956 *
957 * This function marks the BSS to be expirable again.
958 */
959void cfg80211_unhold_bss(struct cfg80211_bss *bss);
577 960
578#endif /* __NET_CFG80211_H */ 961#endif /* __NET_CFG80211_H */
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index bedc7f62e35d..abd443604c9f 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -40,6 +40,7 @@
40#include <linux/net.h> 40#include <linux/net.h>
41#include <linux/skbuff.h> 41#include <linux/skbuff.h>
42#include <net/netlabel.h> 42#include <net/netlabel.h>
43#include <net/request_sock.h>
43#include <asm/atomic.h> 44#include <asm/atomic.h>
44 45
45/* known doi values */ 46/* known doi values */
@@ -215,6 +216,10 @@ int cipso_v4_sock_setattr(struct sock *sk,
215 const struct netlbl_lsm_secattr *secattr); 216 const struct netlbl_lsm_secattr *secattr);
216void cipso_v4_sock_delattr(struct sock *sk); 217void cipso_v4_sock_delattr(struct sock *sk);
217int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr); 218int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr);
219int cipso_v4_req_setattr(struct request_sock *req,
220 const struct cipso_v4_doi *doi_def,
221 const struct netlbl_lsm_secattr *secattr);
222void cipso_v4_req_delattr(struct request_sock *req);
218int cipso_v4_skbuff_setattr(struct sk_buff *skb, 223int cipso_v4_skbuff_setattr(struct sk_buff *skb,
219 const struct cipso_v4_doi *doi_def, 224 const struct cipso_v4_doi *doi_def,
220 const struct netlbl_lsm_secattr *secattr); 225 const struct netlbl_lsm_secattr *secattr);
@@ -247,6 +252,18 @@ static inline int cipso_v4_sock_getattr(struct sock *sk,
247 return -ENOSYS; 252 return -ENOSYS;
248} 253}
249 254
255static inline int cipso_v4_req_setattr(struct request_sock *req,
256 const struct cipso_v4_doi *doi_def,
257 const struct netlbl_lsm_secattr *secattr)
258{
259 return -ENOSYS;
260}
261
262static inline void cipso_v4_req_delattr(struct request_sock *req)
263{
264 return;
265}
266
250static inline int cipso_v4_skbuff_setattr(struct sk_buff *skb, 267static inline int cipso_v4_skbuff_setattr(struct sk_buff *skb,
251 const struct cipso_v4_doi *doi_def, 268 const struct cipso_v4_doi *doi_def,
252 const struct netlbl_lsm_secattr *secattr) 269 const struct netlbl_lsm_secattr *secattr)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 52e97bfca5a1..839f768f9e35 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * include/net/dsa.h - Driver for Distributed Switch Architecture switch chips 2 * include/net/dsa.h - Driver for Distributed Switch Architecture switch chips
3 * Copyright (c) 2008 Marvell Semiconductor 3 * Copyright (c) 2008-2009 Marvell Semiconductor
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 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 6 * it under the terms of the GNU General Public License as published by
@@ -11,23 +11,47 @@
11#ifndef __LINUX_NET_DSA_H 11#ifndef __LINUX_NET_DSA_H
12#define __LINUX_NET_DSA_H 12#define __LINUX_NET_DSA_H
13 13
14#define DSA_MAX_PORTS 12 14#define DSA_MAX_SWITCHES 4
15#define DSA_MAX_PORTS 12
16
17struct dsa_chip_data {
18 /*
19 * How to access the switch configuration registers.
20 */
21 struct device *mii_bus;
22 int sw_addr;
23
24 /*
25 * The names of the switch's ports. Use "cpu" to
26 * designate the switch port that the cpu is connected to,
27 * "dsa" to indicate that this port is a DSA link to
28 * another switch, NULL to indicate the port is unused,
29 * or any other string to indicate this is a physical port.
30 */
31 char *port_names[DSA_MAX_PORTS];
32
33 /*
34 * An array (with nr_chips elements) of which element [a]
35 * indicates which port on this switch should be used to
36 * send packets to that are destined for switch a. Can be
37 * NULL if there is only one switch chip.
38 */
39 s8 *rtable;
40};
15 41
16struct dsa_platform_data { 42struct dsa_platform_data {
17 /* 43 /*
18 * Reference to a Linux network interface that connects 44 * Reference to a Linux network interface that connects
19 * to the switch chip. 45 * to the root switch chip of the tree.
20 */ 46 */
21 struct device *netdev; 47 struct device *netdev;
22 48
23 /* 49 /*
24 * How to access the switch configuration registers, and 50 * Info structs describing each of the switch chips
25 * the names of the switch ports (use "cpu" to designate 51 * connected via this network interface.
26 * the switch port that the cpu is connected to).
27 */ 52 */
28 struct device *mii_bus; 53 int nr_chips;
29 int sw_addr; 54 struct dsa_chip_data *chip;
30 char *port_names[DSA_MAX_PORTS];
31}; 55};
32 56
33extern bool dsa_uses_dsa_tags(void *dsa_ptr); 57extern bool dsa_uses_dsa_tags(void *dsa_ptr);
diff --git a/include/net/ethoc.h b/include/net/ethoc.h
new file mode 100644
index 000000000000..96f3789b27bc
--- /dev/null
+++ b/include/net/ethoc.h
@@ -0,0 +1,22 @@
1/*
2 * linux/include/net/ethoc.h
3 *
4 * Copyright (C) 2008-2009 Avionic Design GmbH
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Written by Thierry Reding <thierry.reding@avionic-design.de>
11 */
12
13#ifndef LINUX_NET_ETHOC_H
14#define LINUX_NET_ETHOC_H 1
15
16struct ethoc_platform_data {
17 u8 hwaddr[IFHWADDRLEN];
18 s8 phy_id;
19};
20
21#endif /* !LINUX_NET_ETHOC_H */
22
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
deleted file mode 100644
index adb7cf31f781..000000000000
--- a/include/net/ieee80211.h
+++ /dev/null
@@ -1,1185 +0,0 @@
1/*
2 * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11
3 * remains copyright by the original authors
4 *
5 * Portions of the merged code are based on Host AP (software wireless
6 * LAN access point) driver for Intersil Prism2/2.5/3.
7 *
8 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
9 * <j@w1.fi>
10 * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
11 *
12 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13 * <jketreno@linux.intel.com>
14 * Copyright (c) 2004-2005, Intel Corporation
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation. See README and COPYING for
19 * more details.
20 *
21 * API Version History
22 * 1.0.x -- Initial version
23 * 1.1.x -- Added radiotap, QoS, TIM, ieee80211_geo APIs,
24 * various structure changes, and crypto API init method
25 */
26#ifndef IEEE80211_H
27#define IEEE80211_H
28#include <linux/if_ether.h> /* ETH_ALEN */
29#include <linux/kernel.h> /* ARRAY_SIZE */
30#include <linux/wireless.h>
31#include <linux/ieee80211.h>
32
33#include <net/lib80211.h>
34
35#define IEEE80211_VERSION "git-1.1.13"
36
37#define IEEE80211_DATA_LEN 2304
38/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
39 6.2.1.1.2.
40
41 The figure in section 7.1.2 suggests a body size of up to 2312
42 bytes is allowed, which is a bit confusing, I suspect this
43 represents the 2304 bytes of real data, plus a possible 8 bytes of
44 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
45
46#define IEEE80211_1ADDR_LEN 10
47#define IEEE80211_2ADDR_LEN 16
48#define IEEE80211_3ADDR_LEN 24
49#define IEEE80211_4ADDR_LEN 30
50#define IEEE80211_FCS_LEN 4
51#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
52#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
53
54#define MIN_FRAG_THRESHOLD 256U
55#define MAX_FRAG_THRESHOLD 2346U
56
57/* Frame control field constants */
58#define IEEE80211_FCTL_VERS 0x0003
59#define IEEE80211_FCTL_FTYPE 0x000c
60#define IEEE80211_FCTL_STYPE 0x00f0
61#define IEEE80211_FCTL_TODS 0x0100
62#define IEEE80211_FCTL_FROMDS 0x0200
63#define IEEE80211_FCTL_MOREFRAGS 0x0400
64#define IEEE80211_FCTL_RETRY 0x0800
65#define IEEE80211_FCTL_PM 0x1000
66#define IEEE80211_FCTL_MOREDATA 0x2000
67#define IEEE80211_FCTL_PROTECTED 0x4000
68#define IEEE80211_FCTL_ORDER 0x8000
69
70#define IEEE80211_FTYPE_MGMT 0x0000
71#define IEEE80211_FTYPE_CTL 0x0004
72#define IEEE80211_FTYPE_DATA 0x0008
73
74/* management */
75#define IEEE80211_STYPE_ASSOC_REQ 0x0000
76#define IEEE80211_STYPE_ASSOC_RESP 0x0010
77#define IEEE80211_STYPE_REASSOC_REQ 0x0020
78#define IEEE80211_STYPE_REASSOC_RESP 0x0030
79#define IEEE80211_STYPE_PROBE_REQ 0x0040
80#define IEEE80211_STYPE_PROBE_RESP 0x0050
81#define IEEE80211_STYPE_BEACON 0x0080
82#define IEEE80211_STYPE_ATIM 0x0090
83#define IEEE80211_STYPE_DISASSOC 0x00A0
84#define IEEE80211_STYPE_AUTH 0x00B0
85#define IEEE80211_STYPE_DEAUTH 0x00C0
86#define IEEE80211_STYPE_ACTION 0x00D0
87
88/* control */
89#define IEEE80211_STYPE_PSPOLL 0x00A0
90#define IEEE80211_STYPE_RTS 0x00B0
91#define IEEE80211_STYPE_CTS 0x00C0
92#define IEEE80211_STYPE_ACK 0x00D0
93#define IEEE80211_STYPE_CFEND 0x00E0
94#define IEEE80211_STYPE_CFENDACK 0x00F0
95
96/* data */
97#define IEEE80211_STYPE_DATA 0x0000
98#define IEEE80211_STYPE_DATA_CFACK 0x0010
99#define IEEE80211_STYPE_DATA_CFPOLL 0x0020
100#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
101#define IEEE80211_STYPE_NULLFUNC 0x0040
102#define IEEE80211_STYPE_CFACK 0x0050
103#define IEEE80211_STYPE_CFPOLL 0x0060
104#define IEEE80211_STYPE_CFACKPOLL 0x0070
105#define IEEE80211_STYPE_QOS_DATA 0x0080
106
107#define IEEE80211_SCTL_FRAG 0x000F
108#define IEEE80211_SCTL_SEQ 0xFFF0
109
110/* QOS control */
111#define IEEE80211_QCTL_TID 0x000F
112
113/* debug macros */
114
115#ifdef CONFIG_IEEE80211_DEBUG
116extern u32 ieee80211_debug_level;
117#define IEEE80211_DEBUG(level, fmt, args...) \
118do { if (ieee80211_debug_level & (level)) \
119 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \
120 in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
121static inline bool ieee80211_ratelimit_debug(u32 level)
122{
123 return (ieee80211_debug_level & level) && net_ratelimit();
124}
125#else
126#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
127static inline bool ieee80211_ratelimit_debug(u32 level)
128{
129 return false;
130}
131#endif /* CONFIG_IEEE80211_DEBUG */
132
133/*
134 * To use the debug system:
135 *
136 * If you are defining a new debug classification, simply add it to the #define
137 * list here in the form of:
138 *
139 * #define IEEE80211_DL_xxxx VALUE
140 *
141 * shifting value to the left one bit from the previous entry. xxxx should be
142 * the name of the classification (for example, WEP)
143 *
144 * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your
145 * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want
146 * to send output to that classification.
147 *
148 * To add your debug level to the list of levels seen when you perform
149 *
150 * % cat /proc/net/ieee80211/debug_level
151 *
152 * you simply need to add your entry to the ieee80211_debug_level array.
153 *
154 * If you do not see debug_level in /proc/net/ieee80211 then you do not have
155 * CONFIG_IEEE80211_DEBUG defined in your kernel configuration
156 *
157 */
158
159#define IEEE80211_DL_INFO (1<<0)
160#define IEEE80211_DL_WX (1<<1)
161#define IEEE80211_DL_SCAN (1<<2)
162#define IEEE80211_DL_STATE (1<<3)
163#define IEEE80211_DL_MGMT (1<<4)
164#define IEEE80211_DL_FRAG (1<<5)
165#define IEEE80211_DL_DROP (1<<7)
166
167#define IEEE80211_DL_TX (1<<8)
168#define IEEE80211_DL_RX (1<<9)
169#define IEEE80211_DL_QOS (1<<31)
170
171#define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a)
172#define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a)
173#define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a)
174
175#define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a)
176#define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a)
177#define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)
178#define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)
179#define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)
180#define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)
181#define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)
182#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
183#define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a)
184#include <linux/netdevice.h>
185#include <linux/if_arp.h> /* ARPHRD_ETHER */
186
187#ifndef WIRELESS_SPY
188#define WIRELESS_SPY /* enable iwspy support */
189#endif
190#include <net/iw_handler.h> /* new driver API */
191
192#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
193
194#ifndef ETH_P_80211_RAW
195#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
196#endif
197
198/* IEEE 802.11 defines */
199
200#define P80211_OUI_LEN 3
201
202struct ieee80211_snap_hdr {
203
204 u8 dsap; /* always 0xAA */
205 u8 ssap; /* always 0xAA */
206 u8 ctrl; /* always 0x03 */
207 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
208
209} __attribute__ ((packed));
210
211#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
212
213#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
214#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
215#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
216
217#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
218#define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
219
220/* Action categories - 802.11h */
221enum ieee80211_actioncategories {
222 WLAN_ACTION_SPECTRUM_MGMT = 0,
223 /* Reserved 1-127 */
224 /* Error 128-255 */
225};
226
227/* Action details - 802.11h */
228enum ieee80211_actiondetails {
229 WLAN_ACTION_CATEGORY_MEASURE_REQUEST = 0,
230 WLAN_ACTION_CATEGORY_MEASURE_REPORT = 1,
231 WLAN_ACTION_CATEGORY_TPC_REQUEST = 2,
232 WLAN_ACTION_CATEGORY_TPC_REPORT = 3,
233 WLAN_ACTION_CATEGORY_CHANNEL_SWITCH = 4,
234 /* 5 - 255 Reserved */
235};
236
237#define IEEE80211_STATMASK_SIGNAL (1<<0)
238#define IEEE80211_STATMASK_RSSI (1<<1)
239#define IEEE80211_STATMASK_NOISE (1<<2)
240#define IEEE80211_STATMASK_RATE (1<<3)
241#define IEEE80211_STATMASK_WEMASK 0x7
242
243#define IEEE80211_CCK_MODULATION (1<<0)
244#define IEEE80211_OFDM_MODULATION (1<<1)
245
246#define IEEE80211_24GHZ_BAND (1<<0)
247#define IEEE80211_52GHZ_BAND (1<<1)
248
249#define IEEE80211_CCK_RATE_1MB 0x02
250#define IEEE80211_CCK_RATE_2MB 0x04
251#define IEEE80211_CCK_RATE_5MB 0x0B
252#define IEEE80211_CCK_RATE_11MB 0x16
253#define IEEE80211_OFDM_RATE_6MB 0x0C
254#define IEEE80211_OFDM_RATE_9MB 0x12
255#define IEEE80211_OFDM_RATE_12MB 0x18
256#define IEEE80211_OFDM_RATE_18MB 0x24
257#define IEEE80211_OFDM_RATE_24MB 0x30
258#define IEEE80211_OFDM_RATE_36MB 0x48
259#define IEEE80211_OFDM_RATE_48MB 0x60
260#define IEEE80211_OFDM_RATE_54MB 0x6C
261#define IEEE80211_BASIC_RATE_MASK 0x80
262
263#define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
264#define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
265#define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
266#define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
267#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
268#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
269#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
270#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
271#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
272#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
273#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
274#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
275
276#define IEEE80211_CCK_RATES_MASK 0x0000000F
277#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
278 IEEE80211_CCK_RATE_2MB_MASK)
279#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
280 IEEE80211_CCK_RATE_5MB_MASK | \
281 IEEE80211_CCK_RATE_11MB_MASK)
282
283#define IEEE80211_OFDM_RATES_MASK 0x00000FF0
284#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
285 IEEE80211_OFDM_RATE_12MB_MASK | \
286 IEEE80211_OFDM_RATE_24MB_MASK)
287#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
288 IEEE80211_OFDM_RATE_9MB_MASK | \
289 IEEE80211_OFDM_RATE_18MB_MASK | \
290 IEEE80211_OFDM_RATE_36MB_MASK | \
291 IEEE80211_OFDM_RATE_48MB_MASK | \
292 IEEE80211_OFDM_RATE_54MB_MASK)
293#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
294 IEEE80211_CCK_DEFAULT_RATES_MASK)
295
296#define IEEE80211_NUM_OFDM_RATES 8
297#define IEEE80211_NUM_CCK_RATES 4
298#define IEEE80211_OFDM_SHIFT_MASK_A 4
299
300/* NOTE: This data is for statistical purposes; not all hardware provides this
301 * information for frames received.
302 * For ieee80211_rx_mgt, you need to set at least the 'len' parameter.
303 */
304struct ieee80211_rx_stats {
305 u32 mac_time;
306 s8 rssi;
307 u8 signal;
308 u8 noise;
309 u16 rate; /* in 100 kbps */
310 u8 received_channel;
311 u8 control;
312 u8 mask;
313 u8 freq;
314 u16 len;
315 u64 tsf;
316 u32 beacon_time;
317};
318
319/* IEEE 802.11 requires that STA supports concurrent reception of at least
320 * three fragmented frames. This define can be increased to support more
321 * concurrent frames, but it should be noted that each entry can consume about
322 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
323#define IEEE80211_FRAG_CACHE_LEN 4
324
325struct ieee80211_frag_entry {
326 unsigned long first_frag_time;
327 unsigned int seq;
328 unsigned int last_frag;
329 struct sk_buff *skb;
330 u8 src_addr[ETH_ALEN];
331 u8 dst_addr[ETH_ALEN];
332};
333
334struct ieee80211_stats {
335 unsigned int tx_unicast_frames;
336 unsigned int tx_multicast_frames;
337 unsigned int tx_fragments;
338 unsigned int tx_unicast_octets;
339 unsigned int tx_multicast_octets;
340 unsigned int tx_deferred_transmissions;
341 unsigned int tx_single_retry_frames;
342 unsigned int tx_multiple_retry_frames;
343 unsigned int tx_retry_limit_exceeded;
344 unsigned int tx_discards;
345 unsigned int rx_unicast_frames;
346 unsigned int rx_multicast_frames;
347 unsigned int rx_fragments;
348 unsigned int rx_unicast_octets;
349 unsigned int rx_multicast_octets;
350 unsigned int rx_fcs_errors;
351 unsigned int rx_discards_no_buffer;
352 unsigned int tx_discards_wrong_sa;
353 unsigned int rx_discards_undecryptable;
354 unsigned int rx_message_in_msg_fragments;
355 unsigned int rx_message_in_bad_msg_fragments;
356};
357
358struct ieee80211_device;
359
360#define SEC_KEY_1 (1<<0)
361#define SEC_KEY_2 (1<<1)
362#define SEC_KEY_3 (1<<2)
363#define SEC_KEY_4 (1<<3)
364#define SEC_ACTIVE_KEY (1<<4)
365#define SEC_AUTH_MODE (1<<5)
366#define SEC_UNICAST_GROUP (1<<6)
367#define SEC_LEVEL (1<<7)
368#define SEC_ENABLED (1<<8)
369#define SEC_ENCRYPT (1<<9)
370
371#define SEC_LEVEL_0 0 /* None */
372#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
373#define SEC_LEVEL_2 2 /* Level 1 + TKIP */
374#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
375#define SEC_LEVEL_3 4 /* Level 2 + CCMP */
376
377#define SEC_ALG_NONE 0
378#define SEC_ALG_WEP 1
379#define SEC_ALG_TKIP 2
380#define SEC_ALG_CCMP 3
381
382#define WEP_KEYS 4
383#define WEP_KEY_LEN 13
384#define SCM_KEY_LEN 32
385#define SCM_TEMPORAL_KEY_LENGTH 16
386
387struct ieee80211_security {
388 u16 active_key:2, enabled:1, unicast_uses_group:1, encrypt:1;
389 u8 auth_mode;
390 u8 encode_alg[WEP_KEYS];
391 u8 key_sizes[WEP_KEYS];
392 u8 keys[WEP_KEYS][SCM_KEY_LEN];
393 u8 level;
394 u16 flags;
395} __attribute__ ((packed));
396
397/*
398
399 802.11 data frame from AP
400
401 ,-------------------------------------------------------------------.
402Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
403 |------|------|---------|---------|---------|------|---------|------|
404Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
405 | | tion | (BSSID) | | | ence | data | |
406 `-------------------------------------------------------------------'
407
408Total: 28-2340 bytes
409
410*/
411
412#define BEACON_PROBE_SSID_ID_POSITION 12
413
414/* Management Frame Information Element Types */
415enum ieee80211_mfie {
416 MFIE_TYPE_SSID = 0,
417 MFIE_TYPE_RATES = 1,
418 MFIE_TYPE_FH_SET = 2,
419 MFIE_TYPE_DS_SET = 3,
420 MFIE_TYPE_CF_SET = 4,
421 MFIE_TYPE_TIM = 5,
422 MFIE_TYPE_IBSS_SET = 6,
423 MFIE_TYPE_COUNTRY = 7,
424 MFIE_TYPE_HOP_PARAMS = 8,
425 MFIE_TYPE_HOP_TABLE = 9,
426 MFIE_TYPE_REQUEST = 10,
427 MFIE_TYPE_CHALLENGE = 16,
428 MFIE_TYPE_POWER_CONSTRAINT = 32,
429 MFIE_TYPE_POWER_CAPABILITY = 33,
430 MFIE_TYPE_TPC_REQUEST = 34,
431 MFIE_TYPE_TPC_REPORT = 35,
432 MFIE_TYPE_SUPP_CHANNELS = 36,
433 MFIE_TYPE_CSA = 37,
434 MFIE_TYPE_MEASURE_REQUEST = 38,
435 MFIE_TYPE_MEASURE_REPORT = 39,
436 MFIE_TYPE_QUIET = 40,
437 MFIE_TYPE_IBSS_DFS = 41,
438 MFIE_TYPE_ERP_INFO = 42,
439 MFIE_TYPE_RSN = 48,
440 MFIE_TYPE_RATES_EX = 50,
441 MFIE_TYPE_GENERIC = 221,
442 MFIE_TYPE_QOS_PARAMETER = 222,
443};
444
445struct ieee80211_hdr_1addr {
446 __le16 frame_ctl;
447 __le16 duration_id;
448 u8 addr1[ETH_ALEN];
449 u8 payload[0];
450} __attribute__ ((packed));
451
452struct ieee80211_hdr_2addr {
453 __le16 frame_ctl;
454 __le16 duration_id;
455 u8 addr1[ETH_ALEN];
456 u8 addr2[ETH_ALEN];
457 u8 payload[0];
458} __attribute__ ((packed));
459
460struct ieee80211_hdr_3addr {
461 __le16 frame_ctl;
462 __le16 duration_id;
463 u8 addr1[ETH_ALEN];
464 u8 addr2[ETH_ALEN];
465 u8 addr3[ETH_ALEN];
466 __le16 seq_ctl;
467 u8 payload[0];
468} __attribute__ ((packed));
469
470struct ieee80211_hdr_4addr {
471 __le16 frame_ctl;
472 __le16 duration_id;
473 u8 addr1[ETH_ALEN];
474 u8 addr2[ETH_ALEN];
475 u8 addr3[ETH_ALEN];
476 __le16 seq_ctl;
477 u8 addr4[ETH_ALEN];
478 u8 payload[0];
479} __attribute__ ((packed));
480
481struct ieee80211_hdr_3addrqos {
482 __le16 frame_ctl;
483 __le16 duration_id;
484 u8 addr1[ETH_ALEN];
485 u8 addr2[ETH_ALEN];
486 u8 addr3[ETH_ALEN];
487 __le16 seq_ctl;
488 u8 payload[0];
489 __le16 qos_ctl;
490} __attribute__ ((packed));
491
492struct ieee80211_info_element {
493 u8 id;
494 u8 len;
495 u8 data[0];
496} __attribute__ ((packed));
497
498/*
499 * These are the data types that can make up management packets
500 *
501 u16 auth_algorithm;
502 u16 auth_sequence;
503 u16 beacon_interval;
504 u16 capability;
505 u8 current_ap[ETH_ALEN];
506 u16 listen_interval;
507 struct {
508 u16 association_id:14, reserved:2;
509 } __attribute__ ((packed));
510 u32 time_stamp[2];
511 u16 reason;
512 u16 status;
513*/
514
515struct ieee80211_auth {
516 struct ieee80211_hdr_3addr header;
517 __le16 algorithm;
518 __le16 transaction;
519 __le16 status;
520 /* challenge */
521 struct ieee80211_info_element info_element[0];
522} __attribute__ ((packed));
523
524struct ieee80211_channel_switch {
525 u8 id;
526 u8 len;
527 u8 mode;
528 u8 channel;
529 u8 count;
530} __attribute__ ((packed));
531
532struct ieee80211_action {
533 struct ieee80211_hdr_3addr header;
534 u8 category;
535 u8 action;
536 union {
537 struct ieee80211_action_exchange {
538 u8 token;
539 struct ieee80211_info_element info_element[0];
540 } exchange;
541 struct ieee80211_channel_switch channel_switch;
542
543 } format;
544} __attribute__ ((packed));
545
546struct ieee80211_disassoc {
547 struct ieee80211_hdr_3addr header;
548 __le16 reason;
549} __attribute__ ((packed));
550
551/* Alias deauth for disassoc */
552#define ieee80211_deauth ieee80211_disassoc
553
554struct ieee80211_probe_request {
555 struct ieee80211_hdr_3addr header;
556 /* SSID, supported rates */
557 struct ieee80211_info_element info_element[0];
558} __attribute__ ((packed));
559
560struct ieee80211_probe_response {
561 struct ieee80211_hdr_3addr header;
562 __le32 time_stamp[2];
563 __le16 beacon_interval;
564 __le16 capability;
565 /* SSID, supported rates, FH params, DS params,
566 * CF params, IBSS params, TIM (if beacon), RSN */
567 struct ieee80211_info_element info_element[0];
568} __attribute__ ((packed));
569
570/* Alias beacon for probe_response */
571#define ieee80211_beacon ieee80211_probe_response
572
573struct ieee80211_assoc_request {
574 struct ieee80211_hdr_3addr header;
575 __le16 capability;
576 __le16 listen_interval;
577 /* SSID, supported rates, RSN */
578 struct ieee80211_info_element info_element[0];
579} __attribute__ ((packed));
580
581struct ieee80211_reassoc_request {
582 struct ieee80211_hdr_3addr header;
583 __le16 capability;
584 __le16 listen_interval;
585 u8 current_ap[ETH_ALEN];
586 struct ieee80211_info_element info_element[0];
587} __attribute__ ((packed));
588
589struct ieee80211_assoc_response {
590 struct ieee80211_hdr_3addr header;
591 __le16 capability;
592 __le16 status;
593 __le16 aid;
594 /* supported rates */
595 struct ieee80211_info_element info_element[0];
596} __attribute__ ((packed));
597
598struct ieee80211_txb {
599 u8 nr_frags;
600 u8 encrypted;
601 u8 rts_included;
602 u8 reserved;
603 u16 frag_size;
604 u16 payload_size;
605 struct sk_buff *fragments[0];
606};
607
608/* SWEEP TABLE ENTRIES NUMBER */
609#define MAX_SWEEP_TAB_ENTRIES 42
610#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
611/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
612 * only use 8, and then use extended rates for the remaining supported
613 * rates. Other APs, however, stick all of their supported rates on the
614 * main rates information element... */
615#define MAX_RATES_LENGTH ((u8)12)
616#define MAX_RATES_EX_LENGTH ((u8)16)
617#define MAX_NETWORK_COUNT 128
618
619#define CRC_LENGTH 4U
620
621#define MAX_WPA_IE_LEN 64
622
623#define NETWORK_HAS_OFDM (1<<1)
624#define NETWORK_HAS_CCK (1<<2)
625
626/* QoS structure */
627#define NETWORK_HAS_QOS_PARAMETERS (1<<3)
628#define NETWORK_HAS_QOS_INFORMATION (1<<4)
629#define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
630 NETWORK_HAS_QOS_INFORMATION)
631
632/* 802.11h */
633#define NETWORK_HAS_POWER_CONSTRAINT (1<<5)
634#define NETWORK_HAS_CSA (1<<6)
635#define NETWORK_HAS_QUIET (1<<7)
636#define NETWORK_HAS_IBSS_DFS (1<<8)
637#define NETWORK_HAS_TPC_REPORT (1<<9)
638
639#define NETWORK_HAS_ERP_VALUE (1<<10)
640
641#define QOS_QUEUE_NUM 4
642#define QOS_OUI_LEN 3
643#define QOS_OUI_TYPE 2
644#define QOS_ELEMENT_ID 221
645#define QOS_OUI_INFO_SUB_TYPE 0
646#define QOS_OUI_PARAM_SUB_TYPE 1
647#define QOS_VERSION_1 1
648#define QOS_AIFSN_MIN_VALUE 2
649
650struct ieee80211_qos_information_element {
651 u8 elementID;
652 u8 length;
653 u8 qui[QOS_OUI_LEN];
654 u8 qui_type;
655 u8 qui_subtype;
656 u8 version;
657 u8 ac_info;
658} __attribute__ ((packed));
659
660struct ieee80211_qos_ac_parameter {
661 u8 aci_aifsn;
662 u8 ecw_min_max;
663 __le16 tx_op_limit;
664} __attribute__ ((packed));
665
666struct ieee80211_qos_parameter_info {
667 struct ieee80211_qos_information_element info_element;
668 u8 reserved;
669 struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
670} __attribute__ ((packed));
671
672struct ieee80211_qos_parameters {
673 __le16 cw_min[QOS_QUEUE_NUM];
674 __le16 cw_max[QOS_QUEUE_NUM];
675 u8 aifs[QOS_QUEUE_NUM];
676 u8 flag[QOS_QUEUE_NUM];
677 __le16 tx_op_limit[QOS_QUEUE_NUM];
678} __attribute__ ((packed));
679
680struct ieee80211_qos_data {
681 struct ieee80211_qos_parameters parameters;
682 int active;
683 int supported;
684 u8 param_count;
685 u8 old_param_count;
686};
687
688struct ieee80211_tim_parameters {
689 u8 tim_count;
690 u8 tim_period;
691} __attribute__ ((packed));
692
693/*******************************************************/
694
695enum { /* ieee80211_basic_report.map */
696 IEEE80211_BASIC_MAP_BSS = (1 << 0),
697 IEEE80211_BASIC_MAP_OFDM = (1 << 1),
698 IEEE80211_BASIC_MAP_UNIDENTIFIED = (1 << 2),
699 IEEE80211_BASIC_MAP_RADAR = (1 << 3),
700 IEEE80211_BASIC_MAP_UNMEASURED = (1 << 4),
701 /* Bits 5-7 are reserved */
702
703};
704struct ieee80211_basic_report {
705 u8 channel;
706 __le64 start_time;
707 __le16 duration;
708 u8 map;
709} __attribute__ ((packed));
710
711enum { /* ieee80211_measurement_request.mode */
712 /* Bit 0 is reserved */
713 IEEE80211_MEASUREMENT_ENABLE = (1 << 1),
714 IEEE80211_MEASUREMENT_REQUEST = (1 << 2),
715 IEEE80211_MEASUREMENT_REPORT = (1 << 3),
716 /* Bits 4-7 are reserved */
717};
718
719enum {
720 IEEE80211_REPORT_BASIC = 0, /* required */
721 IEEE80211_REPORT_CCA = 1, /* optional */
722 IEEE80211_REPORT_RPI = 2, /* optional */
723 /* 3-255 reserved */
724};
725
726struct ieee80211_measurement_params {
727 u8 channel;
728 __le64 start_time;
729 __le16 duration;
730} __attribute__ ((packed));
731
732struct ieee80211_measurement_request {
733 struct ieee80211_info_element ie;
734 u8 token;
735 u8 mode;
736 u8 type;
737 struct ieee80211_measurement_params params[0];
738} __attribute__ ((packed));
739
740struct ieee80211_measurement_report {
741 struct ieee80211_info_element ie;
742 u8 token;
743 u8 mode;
744 u8 type;
745 union {
746 struct ieee80211_basic_report basic[0];
747 } u;
748} __attribute__ ((packed));
749
750struct ieee80211_tpc_report {
751 u8 transmit_power;
752 u8 link_margin;
753} __attribute__ ((packed));
754
755struct ieee80211_channel_map {
756 u8 channel;
757 u8 map;
758} __attribute__ ((packed));
759
760struct ieee80211_ibss_dfs {
761 struct ieee80211_info_element ie;
762 u8 owner[ETH_ALEN];
763 u8 recovery_interval;
764 struct ieee80211_channel_map channel_map[0];
765};
766
767struct ieee80211_csa {
768 u8 mode;
769 u8 channel;
770 u8 count;
771} __attribute__ ((packed));
772
773struct ieee80211_quiet {
774 u8 count;
775 u8 period;
776 u8 duration;
777 u8 offset;
778} __attribute__ ((packed));
779
780struct ieee80211_network {
781 /* These entries are used to identify a unique network */
782 u8 bssid[ETH_ALEN];
783 u8 channel;
784 /* Ensure null-terminated for any debug msgs */
785 u8 ssid[IW_ESSID_MAX_SIZE + 1];
786 u8 ssid_len;
787
788 struct ieee80211_qos_data qos_data;
789
790 /* These are network statistics */
791 struct ieee80211_rx_stats stats;
792 u16 capability;
793 u8 rates[MAX_RATES_LENGTH];
794 u8 rates_len;
795 u8 rates_ex[MAX_RATES_EX_LENGTH];
796 u8 rates_ex_len;
797 unsigned long last_scanned;
798 u8 mode;
799 u32 flags;
800 u32 last_associate;
801 u32 time_stamp[2];
802 u16 beacon_interval;
803 u16 listen_interval;
804 u16 atim_window;
805 u8 erp_value;
806 u8 wpa_ie[MAX_WPA_IE_LEN];
807 size_t wpa_ie_len;
808 u8 rsn_ie[MAX_WPA_IE_LEN];
809 size_t rsn_ie_len;
810 struct ieee80211_tim_parameters tim;
811
812 /* 802.11h info */
813
814 /* Power Constraint - mandatory if spctrm mgmt required */
815 u8 power_constraint;
816
817 /* TPC Report - mandatory if spctrm mgmt required */
818 struct ieee80211_tpc_report tpc_report;
819
820 /* IBSS DFS - mandatory if spctrm mgmt required and IBSS
821 * NOTE: This is variable length and so must be allocated dynamically */
822 struct ieee80211_ibss_dfs *ibss_dfs;
823
824 /* Channel Switch Announcement - optional if spctrm mgmt required */
825 struct ieee80211_csa csa;
826
827 /* Quiet - optional if spctrm mgmt required */
828 struct ieee80211_quiet quiet;
829
830 struct list_head list;
831};
832
833enum ieee80211_state {
834 IEEE80211_UNINITIALIZED = 0,
835 IEEE80211_INITIALIZED,
836 IEEE80211_ASSOCIATING,
837 IEEE80211_ASSOCIATED,
838 IEEE80211_AUTHENTICATING,
839 IEEE80211_AUTHENTICATED,
840 IEEE80211_SHUTDOWN
841};
842
843#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
844#define DEFAULT_FTS 2346
845
846#define CFG_IEEE80211_RESERVE_FCS (1<<0)
847#define CFG_IEEE80211_COMPUTE_FCS (1<<1)
848#define CFG_IEEE80211_RTS (1<<2)
849
850#define IEEE80211_24GHZ_MIN_CHANNEL 1
851#define IEEE80211_24GHZ_MAX_CHANNEL 14
852#define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \
853 IEEE80211_24GHZ_MIN_CHANNEL + 1)
854
855#define IEEE80211_52GHZ_MIN_CHANNEL 34
856#define IEEE80211_52GHZ_MAX_CHANNEL 165
857#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
858 IEEE80211_52GHZ_MIN_CHANNEL + 1)
859
860enum {
861 IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
862 IEEE80211_CH_80211H_RULES = (1 << 1),
863 IEEE80211_CH_B_ONLY = (1 << 2),
864 IEEE80211_CH_NO_IBSS = (1 << 3),
865 IEEE80211_CH_UNIFORM_SPREADING = (1 << 4),
866 IEEE80211_CH_RADAR_DETECT = (1 << 5),
867 IEEE80211_CH_INVALID = (1 << 6),
868};
869
870struct ieee80211_channel {
871 u32 freq; /* in MHz */
872 u8 channel;
873 u8 flags;
874 u8 max_power; /* in dBm */
875};
876
877struct ieee80211_geo {
878 u8 name[4];
879 u8 bg_channels;
880 u8 a_channels;
881 struct ieee80211_channel bg[IEEE80211_24GHZ_CHANNELS];
882 struct ieee80211_channel a[IEEE80211_52GHZ_CHANNELS];
883};
884
885struct ieee80211_device {
886 struct net_device *dev;
887 struct ieee80211_security sec;
888
889 /* Bookkeeping structures */
890 struct net_device_stats stats;
891 struct ieee80211_stats ieee_stats;
892
893 struct ieee80211_geo geo;
894
895 /* Probe / Beacon management */
896 struct list_head network_free_list;
897 struct list_head network_list;
898 struct ieee80211_network *networks;
899 int scans;
900 int scan_age;
901
902 int iw_mode; /* operating mode (IW_MODE_*) */
903 struct iw_spy_data spy_data; /* iwspy support */
904
905 spinlock_t lock;
906
907 int tx_headroom; /* Set to size of any additional room needed at front
908 * of allocated Tx SKBs */
909 u32 config;
910
911 /* WEP and other encryption related settings at the device level */
912 int open_wep; /* Set to 1 to allow unencrypted frames */
913
914 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
915 * WEP key changes */
916
917 /* If the host performs {en,de}cryption, then set to 1 */
918 int host_encrypt;
919 int host_encrypt_msdu;
920 int host_decrypt;
921 /* host performs multicast decryption */
922 int host_mc_decrypt;
923
924 /* host should strip IV and ICV from protected frames */
925 /* meaningful only when hardware decryption is being used */
926 int host_strip_iv_icv;
927
928 int host_open_frag;
929 int host_build_iv;
930 int ieee802_1x; /* is IEEE 802.1X used */
931
932 /* WPA data */
933 int wpa_enabled;
934 int drop_unencrypted;
935 int privacy_invoked;
936 size_t wpa_ie_len;
937 u8 *wpa_ie;
938
939 struct lib80211_crypt_info crypt_info;
940
941 int bcrx_sta_key; /* use individual keys to override default keys even
942 * with RX of broad/multicast frames */
943
944 /* Fragmentation structures */
945 struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN];
946 unsigned int frag_next_idx;
947 u16 fts; /* Fragmentation Threshold */
948 u16 rts; /* RTS threshold */
949
950 /* Association info */
951 u8 bssid[ETH_ALEN];
952
953 enum ieee80211_state state;
954
955 int mode; /* A, B, G */
956 int modulation; /* CCK, OFDM */
957 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
958 int abg_true; /* ABG flag */
959
960 int perfect_rssi;
961 int worst_rssi;
962
963 u16 prev_seq_ctl; /* used to drop duplicate frames */
964
965 /* Callback functions */
966 void (*set_security) (struct net_device * dev,
967 struct ieee80211_security * sec);
968 int (*hard_start_xmit) (struct ieee80211_txb * txb,
969 struct net_device * dev, int pri);
970 int (*reset_port) (struct net_device * dev);
971 int (*is_queue_full) (struct net_device * dev, int pri);
972
973 int (*handle_management) (struct net_device * dev,
974 struct ieee80211_network * network, u16 type);
975 int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
976
977 /* Typical STA methods */
978 int (*handle_auth) (struct net_device * dev,
979 struct ieee80211_auth * auth);
980 int (*handle_deauth) (struct net_device * dev,
981 struct ieee80211_deauth * auth);
982 int (*handle_action) (struct net_device * dev,
983 struct ieee80211_action * action,
984 struct ieee80211_rx_stats * stats);
985 int (*handle_disassoc) (struct net_device * dev,
986 struct ieee80211_disassoc * assoc);
987 int (*handle_beacon) (struct net_device * dev,
988 struct ieee80211_beacon * beacon,
989 struct ieee80211_network * network);
990 int (*handle_probe_response) (struct net_device * dev,
991 struct ieee80211_probe_response * resp,
992 struct ieee80211_network * network);
993 int (*handle_probe_request) (struct net_device * dev,
994 struct ieee80211_probe_request * req,
995 struct ieee80211_rx_stats * stats);
996 int (*handle_assoc_response) (struct net_device * dev,
997 struct ieee80211_assoc_response * resp,
998 struct ieee80211_network * network);
999
1000 /* Typical AP methods */
1001 int (*handle_assoc_request) (struct net_device * dev);
1002 int (*handle_reassoc_request) (struct net_device * dev,
1003 struct ieee80211_reassoc_request * req);
1004
1005 /* This must be the last item so that it points to the data
1006 * allocated beyond this structure by alloc_ieee80211 */
1007 u8 priv[0];
1008};
1009
1010#define IEEE_A (1<<0)
1011#define IEEE_B (1<<1)
1012#define IEEE_G (1<<2)
1013#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
1014
1015static inline void *ieee80211_priv(struct net_device *dev)
1016{
1017 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
1018}
1019
1020static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
1021 int mode)
1022{
1023 /*
1024 * It is possible for both access points and our device to support
1025 * combinations of modes, so as long as there is one valid combination
1026 * of ap/device supported modes, then return success
1027 *
1028 */
1029 if ((mode & IEEE_A) &&
1030 (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
1031 (ieee->freq_band & IEEE80211_52GHZ_BAND))
1032 return 1;
1033
1034 if ((mode & IEEE_G) &&
1035 (ieee->modulation & IEEE80211_OFDM_MODULATION) &&
1036 (ieee->freq_band & IEEE80211_24GHZ_BAND))
1037 return 1;
1038
1039 if ((mode & IEEE_B) &&
1040 (ieee->modulation & IEEE80211_CCK_MODULATION) &&
1041 (ieee->freq_band & IEEE80211_24GHZ_BAND))
1042 return 1;
1043
1044 return 0;
1045}
1046
1047static inline int ieee80211_get_hdrlen(u16 fc)
1048{
1049 int hdrlen = IEEE80211_3ADDR_LEN;
1050 u16 stype = WLAN_FC_GET_STYPE(fc);
1051
1052 switch (WLAN_FC_GET_TYPE(fc)) {
1053 case IEEE80211_FTYPE_DATA:
1054 if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
1055 hdrlen = IEEE80211_4ADDR_LEN;
1056 if (stype & IEEE80211_STYPE_QOS_DATA)
1057 hdrlen += 2;
1058 break;
1059 case IEEE80211_FTYPE_CTL:
1060 switch (WLAN_FC_GET_STYPE(fc)) {
1061 case IEEE80211_STYPE_CTS:
1062 case IEEE80211_STYPE_ACK:
1063 hdrlen = IEEE80211_1ADDR_LEN;
1064 break;
1065 default:
1066 hdrlen = IEEE80211_2ADDR_LEN;
1067 break;
1068 }
1069 break;
1070 }
1071
1072 return hdrlen;
1073}
1074
1075static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr)
1076{
1077 switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control))) {
1078 case IEEE80211_1ADDR_LEN:
1079 return ((struct ieee80211_hdr_1addr *)hdr)->payload;
1080 case IEEE80211_2ADDR_LEN:
1081 return ((struct ieee80211_hdr_2addr *)hdr)->payload;
1082 case IEEE80211_3ADDR_LEN:
1083 return ((struct ieee80211_hdr_3addr *)hdr)->payload;
1084 case IEEE80211_4ADDR_LEN:
1085 return ((struct ieee80211_hdr_4addr *)hdr)->payload;
1086 }
1087 return NULL;
1088}
1089
1090static inline int ieee80211_is_ofdm_rate(u8 rate)
1091{
1092 switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
1093 case IEEE80211_OFDM_RATE_6MB:
1094 case IEEE80211_OFDM_RATE_9MB:
1095 case IEEE80211_OFDM_RATE_12MB:
1096 case IEEE80211_OFDM_RATE_18MB:
1097 case IEEE80211_OFDM_RATE_24MB:
1098 case IEEE80211_OFDM_RATE_36MB:
1099 case IEEE80211_OFDM_RATE_48MB:
1100 case IEEE80211_OFDM_RATE_54MB:
1101 return 1;
1102 }
1103 return 0;
1104}
1105
1106static inline int ieee80211_is_cck_rate(u8 rate)
1107{
1108 switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
1109 case IEEE80211_CCK_RATE_1MB:
1110 case IEEE80211_CCK_RATE_2MB:
1111 case IEEE80211_CCK_RATE_5MB:
1112 case IEEE80211_CCK_RATE_11MB:
1113 return 1;
1114 }
1115 return 0;
1116}
1117
1118/* ieee80211.c */
1119extern void free_ieee80211(struct net_device *dev);
1120extern struct net_device *alloc_ieee80211(int sizeof_priv);
1121
1122extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
1123
1124/* ieee80211_tx.c */
1125extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev);
1126extern void ieee80211_txb_free(struct ieee80211_txb *);
1127
1128/* ieee80211_rx.c */
1129extern void ieee80211_rx_any(struct ieee80211_device *ieee,
1130 struct sk_buff *skb, struct ieee80211_rx_stats *stats);
1131extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1132 struct ieee80211_rx_stats *rx_stats);
1133/* make sure to set stats->len */
1134extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
1135 struct ieee80211_hdr_4addr *header,
1136 struct ieee80211_rx_stats *stats);
1137extern void ieee80211_network_reset(struct ieee80211_network *network);
1138
1139/* ieee80211_geo.c */
1140extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device
1141 *ieee);
1142extern int ieee80211_set_geo(struct ieee80211_device *ieee,
1143 const struct ieee80211_geo *geo);
1144
1145extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee,
1146 u8 channel);
1147extern int ieee80211_channel_to_index(struct ieee80211_device *ieee,
1148 u8 channel);
1149extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq);
1150extern u8 ieee80211_get_channel_flags(struct ieee80211_device *ieee,
1151 u8 channel);
1152extern const struct ieee80211_channel *ieee80211_get_channel(struct
1153 ieee80211_device
1154 *ieee, u8 channel);
1155extern u32 ieee80211_channel_to_freq(struct ieee80211_device * ieee,
1156 u8 channel);
1157
1158/* ieee80211_wx.c */
1159extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
1160 struct iw_request_info *info,
1161 union iwreq_data *wrqu, char *key);
1162extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
1163 struct iw_request_info *info,
1164 union iwreq_data *wrqu, char *key);
1165extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
1166 struct iw_request_info *info,
1167 union iwreq_data *wrqu, char *key);
1168extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee,
1169 struct iw_request_info *info,
1170 union iwreq_data *wrqu, char *extra);
1171extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee,
1172 struct iw_request_info *info,
1173 union iwreq_data *wrqu, char *extra);
1174
1175static inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
1176{
1177 ieee->scans++;
1178}
1179
1180static inline int ieee80211_get_scans(struct ieee80211_device *ieee)
1181{
1182 return ieee->scans;
1183}
1184
1185#endif /* IEEE80211_H */
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 384698cb773a..23c3f3d97779 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -230,8 +230,10 @@ enum ieee80211_radiotap_type {
230 * 802.11 header and payload 230 * 802.11 header and payload
231 * (to 32-bit boundary) 231 * (to 32-bit boundary)
232 */ 232 */
233#define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* bad FCS */
234
233/* For IEEE80211_RADIOTAP_RX_FLAGS */ 235/* For IEEE80211_RADIOTAP_RX_FLAGS */
234#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */ 236#define IEEE80211_RADIOTAP_F_RX_BADPLCP 0x0002 /* frame has bad PLCP */
235 237
236/* For IEEE80211_RADIOTAP_TX_FLAGS */ 238/* For IEEE80211_RADIOTAP_TX_FLAGS */
237#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive 239#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index c8effa4b1feb..38b78132019b 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -39,8 +39,6 @@ struct inet6_ifaddr
39 39
40 __u32 valid_lft; 40 __u32 valid_lft;
41 __u32 prefered_lft; 41 __u32 prefered_lft;
42 unsigned long cstamp; /* created timestamp */
43 unsigned long tstamp; /* updated timestamp */
44 atomic_t refcnt; 42 atomic_t refcnt;
45 spinlock_t lock; 43 spinlock_t lock;
46 44
@@ -49,6 +47,9 @@ struct inet6_ifaddr
49 47
50 __u16 scope; 48 __u16 scope;
51 49
50 unsigned long cstamp; /* created timestamp */
51 unsigned long tstamp; /* updated timestamp */
52
52 struct timer_list timer; 53 struct timer_list timer;
53 54
54 struct inet6_dev *idev; 55 struct inet6_dev *idev;
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 7040a782c656..9b5d08f4f6e8 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -113,12 +113,12 @@ static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)
113static inline int INET_ECN_set_ce(struct sk_buff *skb) 113static inline int INET_ECN_set_ce(struct sk_buff *skb)
114{ 114{
115 switch (skb->protocol) { 115 switch (skb->protocol) {
116 case __constant_htons(ETH_P_IP): 116 case cpu_to_be16(ETH_P_IP):
117 if (skb->network_header + sizeof(struct iphdr) <= skb->tail) 117 if (skb->network_header + sizeof(struct iphdr) <= skb->tail)
118 return IP_ECN_set_ce(ip_hdr(skb)); 118 return IP_ECN_set_ce(ip_hdr(skb));
119 break; 119 break;
120 120
121 case __constant_htons(ETH_P_IPV6): 121 case cpu_to_be16(ETH_P_IPV6):
122 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail) 122 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail)
123 return IP6_ECN_set_ce(ipv6_hdr(skb)); 123 return IP6_ECN_set_ce(ipv6_hdr(skb));
124 break; 124 break;
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index e081eefd6f47..39f2dc943908 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -61,7 +61,8 @@ void inet_frag_destroy(struct inet_frag_queue *q,
61 struct inet_frags *f, int *work); 61 struct inet_frags *f, int *work);
62int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); 62int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f);
63struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, 63struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
64 struct inet_frags *f, void *key, unsigned int hash); 64 struct inet_frags *f, void *key, unsigned int hash)
65 __releases(&f->lock);
65 66
66static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) 67static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
67{ 68{
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index d0a043153cc6..a44e2248b2ef 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -82,6 +82,7 @@ struct inet_bind_bucket {
82#endif 82#endif
83 unsigned short port; 83 unsigned short port;
84 signed short fastreuse; 84 signed short fastreuse;
85 int num_owners;
85 struct hlist_node node; 86 struct hlist_node node;
86 struct hlist_head owners; 87 struct hlist_head owners;
87}; 88};
@@ -133,7 +134,7 @@ struct inet_hashinfo {
133 struct inet_bind_hashbucket *bhash; 134 struct inet_bind_hashbucket *bhash;
134 135
135 unsigned int bhash_size; 136 unsigned int bhash_size;
136 /* Note : 4 bytes padding on 64 bit arches */ 137 /* 4 bytes hole on 64 bit */
137 138
138 struct kmem_cache *bind_bucket_cachep; 139 struct kmem_cache *bind_bucket_cachep;
139 140
@@ -150,6 +151,7 @@ struct inet_hashinfo {
150 struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE] 151 struct inet_listen_hashbucket listening_hash[INET_LHTABLE_SIZE]
151 ____cacheline_aligned_in_smp; 152 ____cacheline_aligned_in_smp;
152 153
154 atomic_t bsockets;
153}; 155};
154 156
155static inline struct inet_ehash_bucket *inet_ehash_bucket( 157static inline struct inet_ehash_bucket *inet_ehash_bucket(
diff --git a/include/net/ip.h b/include/net/ip.h
index 10868139e656..4ac7577f98d0 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -55,6 +55,7 @@ struct ipcm_cookie
55 __be32 addr; 55 __be32 addr;
56 int oif; 56 int oif;
57 struct ip_options *opt; 57 struct ip_options *opt;
58 union skb_shared_tx shtx;
58}; 59};
59 60
60#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) 61#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb))
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index ab9b003ab671..bbae1e87efcd 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -184,8 +184,8 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
184/* 184/*
185 * The port number of FTP service (in network order). 185 * The port number of FTP service (in network order).
186 */ 186 */
187#define FTPPORT __constant_htons(21) 187#define FTPPORT cpu_to_be16(21)
188#define FTPDATA __constant_htons(20) 188#define FTPDATA cpu_to_be16(20)
189 189
190/* 190/*
191 * TCP State Values 191 * TCP State Values
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6d5b58a1c743..c1f16fc49ade 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -196,8 +196,8 @@ struct ip6_flowlabel
196 struct net *fl_net; 196 struct net *fl_net;
197}; 197};
198 198
199#define IPV6_FLOWINFO_MASK __constant_htonl(0x0FFFFFFF) 199#define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF)
200#define IPV6_FLOWLABEL_MASK __constant_htonl(0x000FFFFF) 200#define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF)
201 201
202struct ipv6_fl_socklist 202struct ipv6_fl_socklist
203{ 203{
diff --git a/include/net/ipx.h b/include/net/ipx.h
index 4cc0b4eca948..a14121dd1932 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -27,7 +27,7 @@ struct ipx_address {
27 27
28struct ipxhdr { 28struct ipxhdr {
29 __be16 ipx_checksum __attribute__ ((packed)); 29 __be16 ipx_checksum __attribute__ ((packed));
30#define IPX_NO_CHECKSUM __constant_htons(0xFFFF) 30#define IPX_NO_CHECKSUM cpu_to_be16(0xFFFF)
31 __be16 ipx_pktsize __attribute__ ((packed)); 31 __be16 ipx_pktsize __attribute__ ((packed));
32 __u8 ipx_tctrl; 32 __u8 ipx_tctrl;
33 __u8 ipx_type; 33 __u8 ipx_type;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 559422fc0943..3b83a80e3fe0 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -93,12 +93,9 @@ struct ieee80211_ht_bss_info {
93 * enum ieee80211_max_queues - maximum number of queues 93 * enum ieee80211_max_queues - maximum number of queues
94 * 94 *
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
96 * @IEEE80211_MAX_AMPDU_QUEUES: Maximum number of queues usable
97 * for A-MPDU operation.
98 */ 96 */
99enum ieee80211_max_queues { 97enum ieee80211_max_queues {
100 IEEE80211_MAX_QUEUES = 16, 98 IEEE80211_MAX_QUEUES = 4,
101 IEEE80211_MAX_AMPDU_QUEUES = 16,
102}; 99};
103 100
104/** 101/**
@@ -207,7 +204,7 @@ struct ieee80211_bss_conf {
207 u16 beacon_int; 204 u16 beacon_int;
208 u16 assoc_capability; 205 u16 assoc_capability;
209 u64 timestamp; 206 u64 timestamp;
210 u64 basic_rates; 207 u32 basic_rates;
211 struct ieee80211_bss_ht_conf ht; 208 struct ieee80211_bss_ht_conf ht;
212}; 209};
213 210
@@ -245,6 +242,12 @@ struct ieee80211_bss_conf {
245 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be 242 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
246 * set by rate control algorithms to indicate probe rate, will 243 * set by rate control algorithms to indicate probe rate, will
247 * be cleared for fragmented frames (except on the last fragment) 244 * be cleared for fragmented frames (except on the last fragment)
245 * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or
246 * set this flag in the driver; indicates that the rate control
247 * algorithm was used and should be notified of TX status
248 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
249 * used to indicate that a pending frame requires TX processing before
250 * it can be sent out.
248 */ 251 */
249enum mac80211_tx_control_flags { 252enum mac80211_tx_control_flags {
250 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 253 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -260,8 +263,30 @@ enum mac80211_tx_control_flags {
260 IEEE80211_TX_STAT_AMPDU = BIT(10), 263 IEEE80211_TX_STAT_AMPDU = BIT(10),
261 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), 264 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
262 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 265 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
266 IEEE80211_TX_INTFL_RCALGO = BIT(13),
267 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
263}; 268};
264 269
270/**
271 * enum mac80211_rate_control_flags - per-rate flags set by the
272 * Rate Control algorithm.
273 *
274 * These flags are set by the Rate control algorithm for each rate during tx,
275 * in the @flags member of struct ieee80211_tx_rate.
276 *
277 * @IEEE80211_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
278 * @IEEE80211_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
279 * This is set if the current BSS requires ERP protection.
280 * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
281 * @IEEE80211_TX_RC_MCS: HT rate.
282 * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
283 * Greenfield mode.
284 * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
285 * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
286 * adjacent 20 MHz channels, if the current channel type is
287 * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
288 * @IEEE80211_TX_RC_SHORT_GI: Short Guard interval should be used for this rate.
289 */
265enum mac80211_rate_control_flags { 290enum mac80211_rate_control_flags {
266 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0), 291 IEEE80211_TX_RC_USE_RTS_CTS = BIT(0),
267 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1), 292 IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1),
@@ -500,17 +525,6 @@ enum ieee80211_conf_flags {
500 IEEE80211_CONF_PS = (1<<1), 525 IEEE80211_CONF_PS = (1<<1),
501}; 526};
502 527
503/* XXX: remove all this once drivers stop trying to use it */
504static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
505{
506 return 0;
507}
508#define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
509
510struct ieee80211_ht_conf {
511 bool enabled;
512 enum nl80211_channel_type channel_type;
513};
514 528
515/** 529/**
516 * enum ieee80211_conf_changed - denotes which configuration changed 530 * enum ieee80211_conf_changed - denotes which configuration changed
@@ -520,10 +534,10 @@ struct ieee80211_ht_conf {
520 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 534 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
521 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 535 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
522 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed 536 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
537 * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed
523 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed 538 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
524 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed 539 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
525 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 540 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
526 * @IEEE80211_CONF_CHANGE_HT: HT configuration changed
527 */ 541 */
528enum ieee80211_conf_changed { 542enum ieee80211_conf_changed {
529 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), 543 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
@@ -531,10 +545,10 @@ enum ieee80211_conf_changed {
531 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 545 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
532 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 546 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
533 IEEE80211_CONF_CHANGE_PS = BIT(4), 547 IEEE80211_CONF_CHANGE_PS = BIT(4),
534 IEEE80211_CONF_CHANGE_POWER = BIT(5), 548 IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5),
535 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 549 IEEE80211_CONF_CHANGE_POWER = BIT(6),
536 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), 550 IEEE80211_CONF_CHANGE_CHANNEL = BIT(7),
537 IEEE80211_CONF_CHANGE_HT = BIT(8), 551 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8),
538}; 552};
539 553
540/** 554/**
@@ -547,8 +561,9 @@ enum ieee80211_conf_changed {
547 * @listen_interval: listen interval in units of beacon interval 561 * @listen_interval: listen interval in units of beacon interval
548 * @flags: configuration flags defined above 562 * @flags: configuration flags defined above
549 * @power_level: requested transmit power (in dBm) 563 * @power_level: requested transmit power (in dBm)
564 * @dynamic_ps_timeout: dynamic powersave timeout (in ms)
550 * @channel: the channel to tune to 565 * @channel: the channel to tune to
551 * @ht: the HT configuration for the device 566 * @channel_type: the channel (HT) type
552 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 567 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
553 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, 568 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
554 * but actually means the number of transmissions not the number of retries 569 * but actually means the number of transmissions not the number of retries
@@ -559,7 +574,7 @@ enum ieee80211_conf_changed {
559struct ieee80211_conf { 574struct ieee80211_conf {
560 int beacon_int; 575 int beacon_int;
561 u32 flags; 576 u32 flags;
562 int power_level; 577 int power_level, dynamic_ps_timeout;
563 578
564 u16 listen_interval; 579 u16 listen_interval;
565 bool radio_enabled; 580 bool radio_enabled;
@@ -567,7 +582,7 @@ struct ieee80211_conf {
567 u8 long_frame_max_tx_count, short_frame_max_tx_count; 582 u8 long_frame_max_tx_count, short_frame_max_tx_count;
568 583
569 struct ieee80211_channel *channel; 584 struct ieee80211_channel *channel;
570 struct ieee80211_ht_conf ht; 585 enum nl80211_channel_type channel_type;
571}; 586};
572 587
573/** 588/**
@@ -630,10 +645,12 @@ struct ieee80211_if_init_conf {
630 * @IEEE80211_IFCC_BSSID: The BSSID changed. 645 * @IEEE80211_IFCC_BSSID: The BSSID changed.
631 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed 646 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
632 * (currently AP and MESH only), use ieee80211_beacon_get(). 647 * (currently AP and MESH only), use ieee80211_beacon_get().
648 * @IEEE80211_IFCC_BEACON_ENABLED: The enable_beacon value changed.
633 */ 649 */
634enum ieee80211_if_conf_change { 650enum ieee80211_if_conf_change {
635 IEEE80211_IFCC_BSSID = BIT(0), 651 IEEE80211_IFCC_BSSID = BIT(0),
636 IEEE80211_IFCC_BEACON = BIT(1), 652 IEEE80211_IFCC_BEACON = BIT(1),
653 IEEE80211_IFCC_BEACON_ENABLED = BIT(2),
637}; 654};
638 655
639/** 656/**
@@ -641,13 +658,16 @@ enum ieee80211_if_conf_change {
641 * 658 *
642 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change. 659 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
643 * @bssid: BSSID of the network we are associated to/creating. 660 * @bssid: BSSID of the network we are associated to/creating.
661 * @enable_beacon: Indicates whether beacons can be sent.
662 * This is valid only for AP/IBSS/MESH modes.
644 * 663 *
645 * This structure is passed to the config_interface() callback of 664 * This structure is passed to the config_interface() callback of
646 * &struct ieee80211_hw. 665 * &struct ieee80211_hw.
647 */ 666 */
648struct ieee80211_if_conf { 667struct ieee80211_if_conf {
649 u32 changed; 668 u32 changed;
650 u8 *bssid; 669 const u8 *bssid;
670 bool enable_beacon;
651}; 671};
652 672
653/** 673/**
@@ -655,11 +675,13 @@ struct ieee80211_if_conf {
655 * @ALG_WEP: WEP40 or WEP104 675 * @ALG_WEP: WEP40 or WEP104
656 * @ALG_TKIP: TKIP 676 * @ALG_TKIP: TKIP
657 * @ALG_CCMP: CCMP (AES) 677 * @ALG_CCMP: CCMP (AES)
678 * @ALG_AES_CMAC: AES-128-CMAC
658 */ 679 */
659enum ieee80211_key_alg { 680enum ieee80211_key_alg {
660 ALG_WEP, 681 ALG_WEP,
661 ALG_TKIP, 682 ALG_TKIP,
662 ALG_CCMP, 683 ALG_CCMP,
684 ALG_AES_CMAC,
663}; 685};
664 686
665/** 687/**
@@ -688,12 +710,16 @@ enum ieee80211_key_len {
688 * generation in software. 710 * generation in software.
689 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates 711 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
690 * that the key is pairwise rather then a shared key. 712 * that the key is pairwise rather then a shared key.
713 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a
714 * CCMP key if it requires CCMP encryption of management frames (MFP) to
715 * be done in software.
691 */ 716 */
692enum ieee80211_key_flags { 717enum ieee80211_key_flags {
693 IEEE80211_KEY_FLAG_WMM_STA = 1<<0, 718 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
694 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 719 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1,
695 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 720 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
696 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 721 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
722 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4,
697}; 723};
698 724
699/** 725/**
@@ -714,8 +740,8 @@ enum ieee80211_key_flags {
714 * - Temporal Encryption Key (128 bits) 740 * - Temporal Encryption Key (128 bits)
715 * - Temporal Authenticator Tx MIC Key (64 bits) 741 * - Temporal Authenticator Tx MIC Key (64 bits)
716 * - Temporal Authenticator Rx MIC Key (64 bits) 742 * - Temporal Authenticator Rx MIC Key (64 bits)
717 * @icv_len: FIXME 743 * @icv_len: The ICV length for this key type
718 * @iv_len: FIXME 744 * @iv_len: The IV length for this key type
719 */ 745 */
720struct ieee80211_key_conf { 746struct ieee80211_key_conf {
721 enum ieee80211_key_alg alg; 747 enum ieee80211_key_alg alg;
@@ -759,7 +785,7 @@ enum set_key_cmd {
759 * sizeof(void *), size is determined in hw information. 785 * sizeof(void *), size is determined in hw information.
760 */ 786 */
761struct ieee80211_sta { 787struct ieee80211_sta {
762 u64 supp_rates[IEEE80211_NUM_BANDS]; 788 u32 supp_rates[IEEE80211_NUM_BANDS];
763 u8 addr[ETH_ALEN]; 789 u8 addr[ETH_ALEN];
764 u16 aid; 790 u16 aid;
765 struct ieee80211_sta_ht_cap ht_cap; 791 struct ieee80211_sta_ht_cap ht_cap;
@@ -833,11 +859,6 @@ enum ieee80211_tkip_key_type {
833 * expect values between 0 and @max_signal. 859 * expect values between 0 and @max_signal.
834 * If possible please provide dB or dBm instead. 860 * If possible please provide dB or dBm instead.
835 * 861 *
836 * @IEEE80211_HW_SIGNAL_DB:
837 * Hardware gives signal values in dB, decibel difference from an
838 * arbitrary, fixed reference. We expect values between 0 and @max_signal.
839 * If possible please provide dBm instead.
840 *
841 * @IEEE80211_HW_SIGNAL_DBM: 862 * @IEEE80211_HW_SIGNAL_DBM:
842 * Hardware gives signal values in dBm, decibel difference from 863 * Hardware gives signal values in dBm, decibel difference from
843 * one milliwatt. This is the preferred method since it is standardized 864 * one milliwatt. This is the preferred method since it is standardized
@@ -854,10 +875,22 @@ enum ieee80211_tkip_key_type {
854 * @IEEE80211_HW_AMPDU_AGGREGATION: 875 * @IEEE80211_HW_AMPDU_AGGREGATION:
855 * Hardware supports 11n A-MPDU aggregation. 876 * Hardware supports 11n A-MPDU aggregation.
856 * 877 *
857 * @IEEE80211_HW_NO_STACK_DYNAMIC_PS: 878 * @IEEE80211_HW_SUPPORTS_PS:
858 * Hardware which has dynamic power save support, meaning 879 * Hardware has power save support (i.e. can go to sleep).
859 * that power save is enabled in idle periods, and don't need support 880 *
860 * from stack. 881 * @IEEE80211_HW_PS_NULLFUNC_STACK:
882 * Hardware requires nullfunc frame handling in stack, implies
883 * stack support for dynamic PS.
884 *
885 * @IEEE80211_HW_SUPPORTS_DYNAMIC_PS:
886 * Hardware has support for dynamic PS.
887 *
888 * @IEEE80211_HW_MFP_CAPABLE:
889 * Hardware supports management frame protection (MFP, IEEE 802.11w).
890 *
891 * @IEEE80211_HW_BEACON_FILTER:
892 * Hardware supports dropping of irrelevant beacon frames to
893 * avoid waking up cpu.
861 */ 894 */
862enum ieee80211_hw_flags { 895enum ieee80211_hw_flags {
863 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 896 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
@@ -865,12 +898,15 @@ enum ieee80211_hw_flags {
865 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, 898 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,
866 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, 899 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
867 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, 900 IEEE80211_HW_SIGNAL_UNSPEC = 1<<5,
868 IEEE80211_HW_SIGNAL_DB = 1<<6, 901 IEEE80211_HW_SIGNAL_DBM = 1<<6,
869 IEEE80211_HW_SIGNAL_DBM = 1<<7, 902 IEEE80211_HW_NOISE_DBM = 1<<7,
870 IEEE80211_HW_NOISE_DBM = 1<<8, 903 IEEE80211_HW_SPECTRUM_MGMT = 1<<8,
871 IEEE80211_HW_SPECTRUM_MGMT = 1<<9, 904 IEEE80211_HW_AMPDU_AGGREGATION = 1<<9,
872 IEEE80211_HW_AMPDU_AGGREGATION = 1<<10, 905 IEEE80211_HW_SUPPORTS_PS = 1<<10,
873 IEEE80211_HW_NO_STACK_DYNAMIC_PS = 1<<11, 906 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
907 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
908 IEEE80211_HW_MFP_CAPABLE = 1<<13,
909 IEEE80211_HW_BEACON_FILTER = 1<<14,
874}; 910};
875 911
876/** 912/**
@@ -890,9 +926,8 @@ enum ieee80211_hw_flags {
890 * @workqueue: single threaded workqueue available for driver use, 926 * @workqueue: single threaded workqueue available for driver use,
891 * allocated by mac80211 on registration and flushed when an 927 * allocated by mac80211 on registration and flushed when an
892 * interface is removed. 928 * interface is removed.
893 * NOTICE: All work performed on this workqueue should NEVER 929 * NOTICE: All work performed on this workqueue must not
894 * acquire the RTNL lock (i.e. Don't use the function 930 * acquire the RTNL lock.
895 * ieee80211_iterate_active_interfaces())
896 * 931 *
897 * @priv: pointer to private area that was allocated for driver use 932 * @priv: pointer to private area that was allocated for driver use
898 * along with this structure. 933 * along with this structure.
@@ -914,12 +949,6 @@ enum ieee80211_hw_flags {
914 * data packets. WMM/QoS requires at least four, these 949 * data packets. WMM/QoS requires at least four, these
915 * queues need to have configurable access parameters. 950 * queues need to have configurable access parameters.
916 * 951 *
917 * @ampdu_queues: number of available hardware transmit queues
918 * for A-MPDU packets, these have no access parameters
919 * because they're used only for A-MPDU frames. Note that
920 * mac80211 will not currently use any of the regular queues
921 * for aggregation.
922 *
923 * @rate_control_algorithm: rate control algorithm for this hardware. 952 * @rate_control_algorithm: rate control algorithm for this hardware.
924 * If unset (NULL), the default algorithm will be used. Must be 953 * If unset (NULL), the default algorithm will be used. Must be
925 * set before calling ieee80211_register_hw(). 954 * set before calling ieee80211_register_hw().
@@ -944,7 +973,6 @@ struct ieee80211_hw {
944 int vif_data_size; 973 int vif_data_size;
945 int sta_data_size; 974 int sta_data_size;
946 u16 queues; 975 u16 queues;
947 u16 ampdu_queues;
948 u16 max_listen_interval; 976 u16 max_listen_interval;
949 s8 max_signal; 977 s8 max_signal;
950 u8 max_rates; 978 u8 max_rates;
@@ -952,6 +980,19 @@ struct ieee80211_hw {
952}; 980};
953 981
954/** 982/**
983 * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
984 *
985 * @wiphy: the &struct wiphy which we want to query
986 *
987 * mac80211 drivers can use this to get to their respective
988 * &struct ieee80211_hw. Drivers wishing to get to their own private
989 * structure can then access it via hw->priv. Note that mac802111 drivers should
990 * not use wiphy_priv() to try to get their private driver structure as this
991 * is already used internally by mac80211.
992 */
993struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
994
995/**
955 * SET_IEEE80211_DEV - set device for 802.11 hardware 996 * SET_IEEE80211_DEV - set device for 802.11 hardware
956 * 997 *
957 * @hw: the &struct ieee80211_hw to set the device for 998 * @hw: the &struct ieee80211_hw to set the device for
@@ -973,16 +1014,6 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
973 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); 1014 memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
974} 1015}
975 1016
976static inline int ieee80211_num_regular_queues(struct ieee80211_hw *hw)
977{
978 return hw->queues;
979}
980
981static inline int ieee80211_num_queues(struct ieee80211_hw *hw)
982{
983 return hw->queues + hw->ampdu_queues;
984}
985
986static inline struct ieee80211_rate * 1017static inline struct ieee80211_rate *
987ieee80211_get_tx_rate(const struct ieee80211_hw *hw, 1018ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
988 const struct ieee80211_tx_info *c) 1019 const struct ieee80211_tx_info *c)
@@ -1018,16 +1049,12 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1018 * 1049 *
1019 * The set_key() callback in the &struct ieee80211_ops for a given 1050 * The set_key() callback in the &struct ieee80211_ops for a given
1020 * device is called to enable hardware acceleration of encryption and 1051 * device is called to enable hardware acceleration of encryption and
1021 * decryption. The callback takes an @address parameter that will be 1052 * decryption. The callback takes a @sta parameter that will be NULL
1022 * the broadcast address for default keys, the other station's hardware 1053 * for default keys or keys used for transmission only, or point to
1023 * address for individual keys or the zero address for keys that will 1054 * the station information for the peer for individual keys.
1024 * be used only for transmission.
1025 * Multiple transmission keys with the same key index may be used when 1055 * Multiple transmission keys with the same key index may be used when
1026 * VLANs are configured for an access point. 1056 * VLANs are configured for an access point.
1027 * 1057 *
1028 * The @local_address parameter will always be set to our own address,
1029 * this is only relevant if you support multiple local addresses.
1030 *
1031 * When transmitting, the TX control data will use the @hw_key_idx 1058 * When transmitting, the TX control data will use the @hw_key_idx
1032 * selected by the driver by modifying the &struct ieee80211_key_conf 1059 * selected by the driver by modifying the &struct ieee80211_key_conf
1033 * pointed to by the @key parameter to the set_key() function. 1060 * pointed to by the @key parameter to the set_key() function.
@@ -1061,6 +1088,60 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1061 */ 1088 */
1062 1089
1063/** 1090/**
1091 * DOC: Powersave support
1092 *
1093 * mac80211 has support for various powersave implementations.
1094 *
1095 * First, it can support hardware that handles all powersaving by
1096 * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS
1097 * hardware flag. In that case, it will be told about the desired
1098 * powersave mode depending on the association status, and the driver
1099 * must take care of sending nullfunc frames when necessary, i.e. when
1100 * entering and leaving powersave mode. The driver is required to look at
1101 * the AID in beacons and signal to the AP that it woke up when it finds
1102 * traffic directed to it. This mode supports dynamic PS by simply
1103 * enabling/disabling PS.
1104 *
1105 * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS
1106 * flag to indicate that it can support dynamic PS mode itself (see below).
1107 *
1108 * Other hardware designs cannot send nullfunc frames by themselves and also
1109 * need software support for parsing the TIM bitmap. This is also supported
1110 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
1111 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1112 * required to pass up beacons. Additionally, in this case, mac80211 will
1113 * wake up the hardware when multicast traffic is announced in the beacon.
1114 *
1115 * FIXME: I don't think we can be fast enough in software when we want to
1116 * receive multicast traffic?
1117 *
1118 * Dynamic powersave mode is an extension to normal powersave mode in which
1119 * the hardware stays awake for a user-specified period of time after sending
1120 * a frame so that reply frames need not be buffered and therefore delayed
1121 * to the next wakeup. This can either be supported by hardware, in which case
1122 * the driver needs to look at the @dynamic_ps_timeout hardware configuration
1123 * value, or by the stack if all nullfunc handling is in the stack.
1124 */
1125
1126/**
1127 * DOC: Beacon filter support
1128 *
1129 * Some hardware have beacon filter support to reduce host cpu wakeups
1130 * which will reduce system power consumption. It usuallly works so that
1131 * the firmware creates a checksum of the beacon but omits all constantly
1132 * changing elements (TSF, TIM etc). Whenever the checksum changes the
1133 * beacon is forwarded to the host, otherwise it will be just dropped. That
1134 * way the host will only receive beacons where some relevant information
1135 * (for example ERP protection or WMM settings) have changed.
1136 *
1137 * Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag.
1138 * The driver needs to enable beacon filter support whenever power save is
1139 * enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled,
1140 * the stack will not check for beacon miss at all and the driver needs to
1141 * notify about complete loss of beacons with ieee80211_beacon_loss().
1142 */
1143
1144/**
1064 * DOC: Frame filtering 1145 * DOC: Frame filtering
1065 * 1146 *
1066 * mac80211 requires to see many management frames for proper 1147 * mac80211 requires to see many management frames for proper
@@ -1149,14 +1230,14 @@ enum ieee80211_filter_flags {
1149 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 1230 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
1150 * @IEEE80211_AMPDU_TX_START: start Tx aggregation 1231 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
1151 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation 1232 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
1152 * @IEEE80211_AMPDU_TX_RESUME: resume TX aggregation 1233 * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational
1153 */ 1234 */
1154enum ieee80211_ampdu_mlme_action { 1235enum ieee80211_ampdu_mlme_action {
1155 IEEE80211_AMPDU_RX_START, 1236 IEEE80211_AMPDU_RX_START,
1156 IEEE80211_AMPDU_RX_STOP, 1237 IEEE80211_AMPDU_RX_STOP,
1157 IEEE80211_AMPDU_TX_START, 1238 IEEE80211_AMPDU_TX_START,
1158 IEEE80211_AMPDU_TX_STOP, 1239 IEEE80211_AMPDU_TX_STOP,
1159 IEEE80211_AMPDU_TX_RESUME, 1240 IEEE80211_AMPDU_TX_OPERATIONAL,
1160}; 1241};
1161 1242
1162/** 1243/**
@@ -1172,6 +1253,8 @@ enum ieee80211_ampdu_mlme_action {
1172 * configuration in the TX control data. This handler should, 1253 * configuration in the TX control data. This handler should,
1173 * preferably, never fail and stop queues appropriately, more 1254 * preferably, never fail and stop queues appropriately, more
1174 * importantly, however, it must never fail for A-MPDU-queues. 1255 * importantly, however, it must never fail for A-MPDU-queues.
1256 * This function should return NETDEV_TX_OK except in very
1257 * limited cases.
1175 * Must be implemented and atomic. 1258 * Must be implemented and atomic.
1176 * 1259 *
1177 * @start: Called before the first netdevice attached to the hardware 1260 * @start: Called before the first netdevice attached to the hardware
@@ -1212,9 +1295,12 @@ enum ieee80211_ampdu_mlme_action {
1212 * 1295 *
1213 * @config: Handler for configuration requests. IEEE 802.11 code calls this 1296 * @config: Handler for configuration requests. IEEE 802.11 code calls this
1214 * function to change hardware configuration, e.g., channel. 1297 * function to change hardware configuration, e.g., channel.
1298 * This function should never fail but returns a negative error code
1299 * if it does.
1215 * 1300 *
1216 * @config_interface: Handler for configuration requests related to interfaces 1301 * @config_interface: Handler for configuration requests related to interfaces
1217 * (e.g. BSSID changes.) 1302 * (e.g. BSSID changes.)
1303 * Returns a negative error code which will be seen in userspace.
1218 * 1304 *
1219 * @bss_info_changed: Handler for configuration requests related to BSS 1305 * @bss_info_changed: Handler for configuration requests related to BSS
1220 * parameters that may vary during BSS's lifespan, and may affect low 1306 * parameters that may vary during BSS's lifespan, and may affect low
@@ -1232,8 +1318,9 @@ enum ieee80211_ampdu_mlme_action {
1232 * 1318 *
1233 * @set_key: See the section "Hardware crypto acceleration" 1319 * @set_key: See the section "Hardware crypto acceleration"
1234 * This callback can sleep, and is only called between add_interface 1320 * This callback can sleep, and is only called between add_interface
1235 * and remove_interface calls, i.e. while the interface with the 1321 * and remove_interface calls, i.e. while the given virtual interface
1236 * given local_address is enabled. 1322 * is enabled.
1323 * Returns a negative error code if the key can't be added.
1237 * 1324 *
1238 * @update_tkip_key: See the section "Hardware crypto acceleration" 1325 * @update_tkip_key: See the section "Hardware crypto acceleration"
1239 * This callback will be called in the context of Rx. Called for drivers 1326 * This callback will be called in the context of Rx. Called for drivers
@@ -1241,12 +1328,22 @@ enum ieee80211_ampdu_mlme_action {
1241 * 1328 *
1242 * @hw_scan: Ask the hardware to service the scan request, no need to start 1329 * @hw_scan: Ask the hardware to service the scan request, no need to start
1243 * the scan state machine in stack. The scan must honour the channel 1330 * the scan state machine in stack. The scan must honour the channel
1244 * configuration done by the regulatory agent in the wiphy's registered 1331 * configuration done by the regulatory agent in the wiphy's
1245 * bands. When the scan finishes, ieee80211_scan_completed() must be 1332 * registered bands. The hardware (or the driver) needs to make sure
1246 * called; note that it also must be called when the scan cannot finish 1333 * that power save is disabled. When the scan finishes,
1247 * because the hardware is turned off! Anything else is a bug! 1334 * ieee80211_scan_completed() must be called; note that it also must
1335 * be called when the scan cannot finish because the hardware is
1336 * turned off! Anything else is a bug! Returns a negative error code
1337 * which will be seen in userspace.
1338 *
1339 * @sw_scan_start: Notifier function that is called just before a software scan
1340 * is started. Can be NULL, if the driver doesn't need this notification.
1341 *
1342 * @sw_scan_complete: Notifier function that is called just after a software scan
1343 * finished. Can be NULL, if the driver doesn't need this notification.
1248 * 1344 *
1249 * @get_stats: return low-level statistics 1345 * @get_stats: Return low-level statistics.
1346 * Returns zero if statistics are available.
1250 * 1347 *
1251 * @get_tkip_seq: If your device implements TKIP encryption in hardware this 1348 * @get_tkip_seq: If your device implements TKIP encryption in hardware this
1252 * callback should be provided to read the TKIP transmit IVs (both IV32 1349 * callback should be provided to read the TKIP transmit IVs (both IV32
@@ -1260,16 +1357,21 @@ enum ieee80211_ampdu_mlme_action {
1260 * 1357 *
1261 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1358 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1262 * bursting) for a hardware TX queue. 1359 * bursting) for a hardware TX queue.
1360 * Returns a negative error code on failure.
1263 * 1361 *
1264 * @get_tx_stats: Get statistics of the current TX queue status. This is used 1362 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1265 * to get number of currently queued packets (queue length), maximum queue 1363 * to get number of currently queued packets (queue length), maximum queue
1266 * size (limit), and total number of packets sent using each TX queue 1364 * size (limit), and total number of packets sent using each TX queue
1267 * (count). The 'stats' pointer points to an array that has hw->queues + 1365 * (count). The 'stats' pointer points to an array that has hw->queues
1268 * hw->ampdu_queues items. 1366 * items.
1269 * 1367 *
1270 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, 1368 * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
1271 * this is only used for IBSS mode debugging and, as such, is not a 1369 * this is only used for IBSS mode BSSID merging and debugging. Is not a
1272 * required function. Must be atomic. 1370 * required function.
1371 *
1372 * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
1373 * Currently, this is only used for IBSS mode debugging. Is not a
1374 * required function.
1273 * 1375 *
1274 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize 1376 * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
1275 * with other STAs in the IBSS. This is only used in IBSS mode. This 1377 * with other STAs in the IBSS. This is only used in IBSS mode. This
@@ -1279,13 +1381,15 @@ enum ieee80211_ampdu_mlme_action {
1279 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. 1381 * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
1280 * This is needed only for IBSS mode and the result of this function is 1382 * This is needed only for IBSS mode and the result of this function is
1281 * used to determine whether to reply to Probe Requests. 1383 * used to determine whether to reply to Probe Requests.
1384 * Returns non-zero if this device sent the last beacon.
1282 * 1385 *
1283 * @ampdu_action: Perform a certain A-MPDU action 1386 * @ampdu_action: Perform a certain A-MPDU action
1284 * The RA/TID combination determines the destination and TID we want 1387 * The RA/TID combination determines the destination and TID we want
1285 * the ampdu action to be performed for. The action is defined through 1388 * the ampdu action to be performed for. The action is defined through
1286 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) 1389 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
1287 * is the first frame we expect to perform the action on. notice 1390 * is the first frame we expect to perform the action on. Notice
1288 * that TX/RX_STOP can pass NULL for this parameter. 1391 * that TX/RX_STOP can pass NULL for this parameter.
1392 * Returns a negative error code on failure.
1289 */ 1393 */
1290struct ieee80211_ops { 1394struct ieee80211_ops {
1291 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1395 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1310,12 +1414,15 @@ struct ieee80211_ops {
1310 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1414 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1311 bool set); 1415 bool set);
1312 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1416 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1313 const u8 *local_address, const u8 *address, 1417 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
1314 struct ieee80211_key_conf *key); 1418 struct ieee80211_key_conf *key);
1315 void (*update_tkip_key)(struct ieee80211_hw *hw, 1419 void (*update_tkip_key)(struct ieee80211_hw *hw,
1316 struct ieee80211_key_conf *conf, const u8 *address, 1420 struct ieee80211_key_conf *conf, const u8 *address,
1317 u32 iv32, u16 *phase1key); 1421 u32 iv32, u16 *phase1key);
1318 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); 1422 int (*hw_scan)(struct ieee80211_hw *hw,
1423 struct cfg80211_scan_request *req);
1424 void (*sw_scan_start)(struct ieee80211_hw *hw);
1425 void (*sw_scan_complete)(struct ieee80211_hw *hw);
1319 int (*get_stats)(struct ieee80211_hw *hw, 1426 int (*get_stats)(struct ieee80211_hw *hw,
1320 struct ieee80211_low_level_stats *stats); 1427 struct ieee80211_low_level_stats *stats);
1321 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, 1428 void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
@@ -1328,6 +1435,7 @@ struct ieee80211_ops {
1328 int (*get_tx_stats)(struct ieee80211_hw *hw, 1435 int (*get_tx_stats)(struct ieee80211_hw *hw,
1329 struct ieee80211_tx_queue_stats *stats); 1436 struct ieee80211_tx_queue_stats *stats);
1330 u64 (*get_tsf)(struct ieee80211_hw *hw); 1437 u64 (*get_tsf)(struct ieee80211_hw *hw);
1438 void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
1331 void (*reset_tsf)(struct ieee80211_hw *hw); 1439 void (*reset_tsf)(struct ieee80211_hw *hw);
1332 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1440 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1333 int (*ampdu_action)(struct ieee80211_hw *hw, 1441 int (*ampdu_action)(struct ieee80211_hw *hw,
@@ -1752,8 +1860,9 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
1752 * mac80211 that the scan finished. 1860 * mac80211 that the scan finished.
1753 * 1861 *
1754 * @hw: the hardware that finished the scan 1862 * @hw: the hardware that finished the scan
1863 * @aborted: set to true if scan was aborted
1755 */ 1864 */
1756void ieee80211_scan_completed(struct ieee80211_hw *hw); 1865void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
1757 1866
1758/** 1867/**
1759 * ieee80211_iterate_active_interfaces - iterate active interfaces 1868 * ieee80211_iterate_active_interfaces - iterate active interfaces
@@ -1882,10 +1991,30 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
1882struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, 1991struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1883 const u8 *addr); 1992 const u8 *addr);
1884 1993
1994/**
1995 * ieee80211_beacon_loss - inform hardware does not receive beacons
1996 *
1997 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1998 *
1999 * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and
2000 * IEEE80211_CONF_PS is set, the driver needs to inform whenever the
2001 * hardware is not receiving beacons with this function.
2002 */
2003void ieee80211_beacon_loss(struct ieee80211_vif *vif);
1885 2004
1886/* Rate control API */ 2005/* Rate control API */
1887 2006
1888/** 2007/**
2008 * enum rate_control_changed - flags to indicate which parameter changed
2009 *
2010 * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have
2011 * changed, rate control algorithm can update its internal state if needed.
2012 */
2013enum rate_control_changed {
2014 IEEE80211_RC_HT_CHANGED = BIT(0)
2015};
2016
2017/**
1889 * struct ieee80211_tx_rate_control - rate control information for/from RC algo 2018 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
1890 * 2019 *
1891 * @hw: The hardware the algorithm is invoked for. 2020 * @hw: The hardware the algorithm is invoked for.
@@ -1921,6 +2050,9 @@ struct rate_control_ops {
1921 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); 2050 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
1922 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, 2051 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
1923 struct ieee80211_sta *sta, void *priv_sta); 2052 struct ieee80211_sta *sta, void *priv_sta);
2053 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
2054 struct ieee80211_sta *sta,
2055 void *priv_sta, u32 changed);
1924 void (*free_sta)(void *priv, struct ieee80211_sta *sta, 2056 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
1925 void *priv_sta); 2057 void *priv_sta);
1926 2058
@@ -1962,4 +2094,34 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
1962int ieee80211_rate_control_register(struct rate_control_ops *ops); 2094int ieee80211_rate_control_register(struct rate_control_ops *ops);
1963void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 2095void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
1964 2096
2097static inline bool
2098conf_is_ht20(struct ieee80211_conf *conf)
2099{
2100 return conf->channel_type == NL80211_CHAN_HT20;
2101}
2102
2103static inline bool
2104conf_is_ht40_minus(struct ieee80211_conf *conf)
2105{
2106 return conf->channel_type == NL80211_CHAN_HT40MINUS;
2107}
2108
2109static inline bool
2110conf_is_ht40_plus(struct ieee80211_conf *conf)
2111{
2112 return conf->channel_type == NL80211_CHAN_HT40PLUS;
2113}
2114
2115static inline bool
2116conf_is_ht40(struct ieee80211_conf *conf)
2117{
2118 return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf);
2119}
2120
2121static inline bool
2122conf_is_ht(struct ieee80211_conf *conf)
2123{
2124 return conf->channel_type != NL80211_CHAN_NO_HT;
2125}
2126
1965#endif /* MAC80211_H */ 2127#endif /* MAC80211_H */
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 6fc13d905c5f..ded434b032a4 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -109,11 +109,6 @@ extern struct list_head net_namespace_list;
109#ifdef CONFIG_NET_NS 109#ifdef CONFIG_NET_NS
110extern void __put_net(struct net *net); 110extern void __put_net(struct net *net);
111 111
112static inline int net_alive(struct net *net)
113{
114 return net && atomic_read(&net->count);
115}
116
117static inline struct net *get_net(struct net *net) 112static inline struct net *get_net(struct net *net)
118{ 113{
119 atomic_inc(&net->count); 114 atomic_inc(&net->count);
@@ -145,11 +140,6 @@ int net_eq(const struct net *net1, const struct net *net2)
145} 140}
146#else 141#else
147 142
148static inline int net_alive(struct net *net)
149{
150 return 1;
151}
152
153static inline struct net *get_net(struct net *net) 143static inline struct net *get_net(struct net *net)
154{ 144{
155 return net; 145 return net;
@@ -234,6 +224,23 @@ struct pernet_operations {
234 void (*exit)(struct net *net); 224 void (*exit)(struct net *net);
235}; 225};
236 226
227/*
228 * Use these carefully. If you implement a network device and it
229 * needs per network namespace operations use device pernet operations,
230 * otherwise use pernet subsys operations.
231 *
232 * This is critically important. Most of the network code cleanup
233 * runs with the assumption that dev_remove_pack has been called so no
234 * new packets will arrive during and after the cleanup functions have
235 * been called. dev_remove_pack is not per namespace so instead the
236 * guarantee of no more packets arriving in a network namespace is
237 * provided by ensuring that all network devices and all sockets have
238 * left the network namespace before the cleanup methods are called.
239 *
240 * For the longest time the ipv4 icmp code was registered as a pernet
241 * device which caused kernel oops, and panics during network
242 * namespace cleanup. So please don't get this wrong.
243 */
237extern int register_pernet_subsys(struct pernet_operations *); 244extern int register_pernet_subsys(struct pernet_operations *);
238extern void unregister_pernet_subsys(struct pernet_operations *); 245extern void unregister_pernet_subsys(struct pernet_operations *);
239extern int register_pernet_gen_subsys(int *id, struct pernet_operations *); 246extern int register_pernet_gen_subsys(int *id, struct pernet_operations *);
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 2e0c53641cbe..6c3f964de9e1 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -91,8 +91,7 @@ struct nf_conn_help {
91#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> 91#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
92#include <net/netfilter/ipv6/nf_conntrack_ipv6.h> 92#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
93 93
94struct nf_conn 94struct nf_conn {
95{
96 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, 95 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
97 plus 1 for any connection(s) we are `master' for */ 96 plus 1 for any connection(s) we are `master' for */
98 struct nf_conntrack ct_general; 97 struct nf_conntrack ct_general;
@@ -126,7 +125,6 @@ struct nf_conn
126#ifdef CONFIG_NET_NS 125#ifdef CONFIG_NET_NS
127 struct net *ct_net; 126 struct net *ct_net;
128#endif 127#endif
129 struct rcu_head rcu;
130}; 128};
131 129
132static inline struct nf_conn * 130static inline struct nf_conn *
@@ -190,9 +188,13 @@ static inline void nf_ct_put(struct nf_conn *ct)
190extern int nf_ct_l3proto_try_module_get(unsigned short l3proto); 188extern int nf_ct_l3proto_try_module_get(unsigned short l3proto);
191extern void nf_ct_l3proto_module_put(unsigned short l3proto); 189extern void nf_ct_l3proto_module_put(unsigned short l3proto);
192 190
193extern struct hlist_head *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced); 191/*
194extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, 192 * Allocate a hashtable of hlist_head (if nulls == 0),
195 unsigned int size); 193 * or hlist_nulls_head (if nulls == 1)
194 */
195extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls);
196
197extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size);
196 198
197extern struct nf_conntrack_tuple_hash * 199extern struct nf_conntrack_tuple_hash *
198__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); 200__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple);
@@ -287,7 +289,7 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb)
287 289
288extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 290extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
289extern unsigned int nf_conntrack_htable_size; 291extern unsigned int nf_conntrack_htable_size;
290extern int nf_conntrack_max; 292extern unsigned int nf_conntrack_max;
291 293
292#define NF_CT_STAT_INC(net, count) \ 294#define NF_CT_STAT_INC(net, count) \
293 (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++) 295 (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++)
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index c25068e38516..5a449b44ba33 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -62,7 +62,8 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
62 if (ct && ct != &nf_conntrack_untracked) { 62 if (ct && ct != &nf_conntrack_untracked) {
63 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) 63 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
64 ret = __nf_conntrack_confirm(skb); 64 ret = __nf_conntrack_confirm(skb);
65 nf_ct_deliver_cached_events(ct); 65 if (likely(ret == NF_ACCEPT))
66 nf_ct_deliver_cached_events(ct);
66 } 67 }
67 return ret; 68 return ret;
68} 69}
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/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 66d65a7caa39..ee2a4b369a04 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -14,6 +14,8 @@
14 14
15struct module; 15struct module;
16 16
17#define NF_CT_HELPER_NAME_LEN 16
18
17struct nf_conntrack_helper 19struct nf_conntrack_helper
18{ 20{
19 struct hlist_node hnode; /* Internal use. */ 21 struct hlist_node hnode; /* Internal use. */
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 0378676c3dd8..9f99d36d5de9 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -53,10 +53,17 @@ struct nf_conntrack_l3proto
53 int (*tuple_to_nlattr)(struct sk_buff *skb, 53 int (*tuple_to_nlattr)(struct sk_buff *skb,
54 const struct nf_conntrack_tuple *t); 54 const struct nf_conntrack_tuple *t);
55 55
56 /*
57 * Calculate size of tuple nlattr
58 */
59 int (*nlattr_tuple_size)(void);
60
56 int (*nlattr_to_tuple)(struct nlattr *tb[], 61 int (*nlattr_to_tuple)(struct nlattr *tb[],
57 struct nf_conntrack_tuple *t); 62 struct nf_conntrack_tuple *t);
58 const struct nla_policy *nla_policy; 63 const struct nla_policy *nla_policy;
59 64
65 size_t nla_size;
66
60#ifdef CONFIG_SYSCTL 67#ifdef CONFIG_SYSCTL
61 struct ctl_table_header *ctl_table_header; 68 struct ctl_table_header *ctl_table_header;
62 struct ctl_path *ctl_table_path; 69 struct ctl_path *ctl_table_path;
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index debdaf75cecf..ba32ed7bdabe 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -64,16 +64,22 @@ struct nf_conntrack_l4proto
64 /* convert protoinfo to nfnetink attributes */ 64 /* convert protoinfo to nfnetink attributes */
65 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, 65 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
66 const struct nf_conn *ct); 66 const struct nf_conn *ct);
67 /* Calculate protoinfo nlattr size */
68 int (*nlattr_size)(void);
67 69
68 /* convert nfnetlink attributes to protoinfo */ 70 /* convert nfnetlink attributes to protoinfo */
69 int (*from_nlattr)(struct nlattr *tb[], struct nf_conn *ct); 71 int (*from_nlattr)(struct nlattr *tb[], struct nf_conn *ct);
70 72
71 int (*tuple_to_nlattr)(struct sk_buff *skb, 73 int (*tuple_to_nlattr)(struct sk_buff *skb,
72 const struct nf_conntrack_tuple *t); 74 const struct nf_conntrack_tuple *t);
75 /* Calculate tuple nlattr size */
76 int (*nlattr_tuple_size)(void);
73 int (*nlattr_to_tuple)(struct nlattr *tb[], 77 int (*nlattr_to_tuple)(struct nlattr *tb[],
74 struct nf_conntrack_tuple *t); 78 struct nf_conntrack_tuple *t);
75 const struct nla_policy *nla_policy; 79 const struct nla_policy *nla_policy;
76 80
81 size_t nla_size;
82
77#ifdef CONFIG_SYSCTL 83#ifdef CONFIG_SYSCTL
78 struct ctl_table_header **ctl_table_header; 84 struct ctl_table_header **ctl_table_header;
79 struct ctl_table *ctl_table; 85 struct ctl_table *ctl_table;
@@ -90,10 +96,7 @@ struct nf_conntrack_l4proto
90 struct module *me; 96 struct module *me;
91}; 97};
92 98
93/* Existing built-in protocols */ 99/* Existing built-in generic protocol */
94extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
95extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
96extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; 100extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
98 101
99#define MAX_NF_CT_PROTO 256 102#define MAX_NF_CT_PROTO 256
@@ -101,11 +104,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
101extern struct nf_conntrack_l4proto * 104extern struct nf_conntrack_l4proto *
102__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 105__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
103 106
104extern struct nf_conntrack_l4proto *
105nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t protocol);
106
107extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
108
109/* Protocol registration. */ 107/* Protocol registration. */
110extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); 108extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
111extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); 109extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);
@@ -115,6 +113,7 @@ extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
115 const struct nf_conntrack_tuple *tuple); 113 const struct nf_conntrack_tuple *tuple);
116extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[], 114extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
117 struct nf_conntrack_tuple *t); 115 struct nf_conntrack_tuple *t);
116extern int nf_ct_port_nlattr_tuple_size(void);
118extern const struct nla_policy nf_ct_port_nla_policy[]; 117extern const struct nla_policy nf_ct_port_nla_policy[];
119 118
120#ifdef CONFIG_SYSCTL 119#ifdef CONFIG_SYSCTL
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index f2f6aa73dc10..2628c154d40e 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -12,6 +12,7 @@
12 12
13#include <linux/netfilter/x_tables.h> 13#include <linux/netfilter/x_tables.h>
14#include <linux/netfilter/nf_conntrack_tuple_common.h> 14#include <linux/netfilter/nf_conntrack_tuple_common.h>
15#include <linux/list_nulls.h>
15 16
16/* A `tuple' is a structure containing the information to uniquely 17/* A `tuple' is a structure containing the information to uniquely
17 identify a connection. ie. if two packets have the same tuple, they 18 identify a connection. ie. if two packets have the same tuple, they
@@ -146,9 +147,8 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t)
146 ((enum ip_conntrack_dir)(h)->tuple.dst.dir) 147 ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
147 148
148/* Connections have two entries in the hash table: one for each way */ 149/* Connections have two entries in the hash table: one for each way */
149struct nf_conntrack_tuple_hash 150struct nf_conntrack_tuple_hash {
150{ 151 struct hlist_nulls_node hnnode;
151 struct hlist_node hnode;
152 struct nf_conntrack_tuple tuple; 152 struct nf_conntrack_tuple tuple;
153}; 153};
154 154
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index 7182c06974f4..920997f1aff0 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -1,6 +1,8 @@
1#ifndef _NF_LOG_H 1#ifndef _NF_LOG_H
2#define _NF_LOG_H 2#define _NF_LOG_H
3 3
4#include <linux/netfilter.h>
5
4/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will 6/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will
5 * disappear once iptables is replaced with pkttables. Please DO NOT use them 7 * disappear once iptables is replaced with pkttables. Please DO NOT use them
6 * for any new code! */ 8 * for any new code! */
@@ -40,12 +42,15 @@ struct nf_logger {
40 struct module *me; 42 struct module *me;
41 nf_logfn *logfn; 43 nf_logfn *logfn;
42 char *name; 44 char *name;
45 struct list_head list[NFPROTO_NUMPROTO];
43}; 46};
44 47
45/* Function to register/unregister log function. */ 48/* Function to register/unregister log function. */
46int nf_log_register(u_int8_t pf, const struct nf_logger *logger); 49int nf_log_register(u_int8_t pf, struct nf_logger *logger);
47void nf_log_unregister(const struct nf_logger *logger); 50void nf_log_unregister(struct nf_logger *logger);
48void nf_log_unregister_pf(u_int8_t pf); 51
52int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger);
53void nf_log_unbind_pf(u_int8_t pf);
49 54
50/* Calls the registered backend logging function */ 55/* Calls the registered backend logging function */
51void nf_log_packet(u_int8_t pf, 56void nf_log_packet(u_int8_t pf,
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 9dc1039ff78b..8df0b7f7fc6e 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -18,6 +18,7 @@ enum nf_nat_manip_type
18#define IP_NAT_RANGE_MAP_IPS 1 18#define IP_NAT_RANGE_MAP_IPS 1
19#define IP_NAT_RANGE_PROTO_SPECIFIED 2 19#define IP_NAT_RANGE_PROTO_SPECIFIED 2
20#define IP_NAT_RANGE_PROTO_RANDOM 4 20#define IP_NAT_RANGE_PROTO_RANDOM 4
21#define IP_NAT_RANGE_PERSISTENT 8
21 22
22/* NAT sequence number modifications */ 23/* NAT sequence number modifications */
23struct nf_nat_seq { 24struct nf_nat_seq {
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 749011eedc0b..60ebbc1fef46 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -36,6 +36,7 @@
36#include <linux/in.h> 36#include <linux/in.h>
37#include <linux/in6.h> 37#include <linux/in6.h>
38#include <net/netlink.h> 38#include <net/netlink.h>
39#include <net/request_sock.h>
39#include <asm/atomic.h> 40#include <asm/atomic.h>
40 41
41struct cipso_v4_doi; 42struct cipso_v4_doi;
@@ -406,6 +407,7 @@ int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap,
406 */ 407 */
407int netlbl_enabled(void); 408int netlbl_enabled(void);
408int netlbl_sock_setattr(struct sock *sk, 409int netlbl_sock_setattr(struct sock *sk,
410 u16 family,
409 const struct netlbl_lsm_secattr *secattr); 411 const struct netlbl_lsm_secattr *secattr);
410void netlbl_sock_delattr(struct sock *sk); 412void netlbl_sock_delattr(struct sock *sk);
411int netlbl_sock_getattr(struct sock *sk, 413int netlbl_sock_getattr(struct sock *sk,
@@ -413,6 +415,9 @@ int netlbl_sock_getattr(struct sock *sk,
413int netlbl_conn_setattr(struct sock *sk, 415int netlbl_conn_setattr(struct sock *sk,
414 struct sockaddr *addr, 416 struct sockaddr *addr,
415 const struct netlbl_lsm_secattr *secattr); 417 const struct netlbl_lsm_secattr *secattr);
418int netlbl_req_setattr(struct request_sock *req,
419 const struct netlbl_lsm_secattr *secattr);
420void netlbl_req_delattr(struct request_sock *req);
416int netlbl_skbuff_setattr(struct sk_buff *skb, 421int netlbl_skbuff_setattr(struct sk_buff *skb,
417 u16 family, 422 u16 family,
418 const struct netlbl_lsm_secattr *secattr); 423 const struct netlbl_lsm_secattr *secattr);
@@ -519,7 +524,8 @@ static inline int netlbl_enabled(void)
519 return 0; 524 return 0;
520} 525}
521static inline int netlbl_sock_setattr(struct sock *sk, 526static inline int netlbl_sock_setattr(struct sock *sk,
522 const struct netlbl_lsm_secattr *secattr) 527 u16 family,
528 const struct netlbl_lsm_secattr *secattr)
523{ 529{
524 return -ENOSYS; 530 return -ENOSYS;
525} 531}
@@ -537,6 +543,15 @@ static inline int netlbl_conn_setattr(struct sock *sk,
537{ 543{
538 return -ENOSYS; 544 return -ENOSYS;
539} 545}
546static inline int netlbl_req_setattr(struct request_sock *req,
547 const struct netlbl_lsm_secattr *secattr)
548{
549 return -ENOSYS;
550}
551static inline void netlbl_req_delattr(struct request_sock *req)
552{
553 return;
554}
540static inline int netlbl_skbuff_setattr(struct sk_buff *skb, 555static inline int netlbl_skbuff_setattr(struct sk_buff *skb,
541 u16 family, 556 u16 family,
542 const struct netlbl_lsm_secattr *secattr) 557 const struct netlbl_lsm_secattr *secattr)
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 8a6150a3f4c7..eddb50289d6d 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -230,6 +230,7 @@ extern int nla_validate(struct nlattr *head, int len, int maxtype,
230extern int nla_parse(struct nlattr *tb[], int maxtype, 230extern int nla_parse(struct nlattr *tb[], int maxtype,
231 struct nlattr *head, int len, 231 struct nlattr *head, int len,
232 const struct nla_policy *policy); 232 const struct nla_policy *policy);
233extern int nla_policy_len(const struct nla_policy *, int);
233extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); 234extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
234extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 235extern size_t nla_strlcpy(char *dst, const struct nlattr *nla,
235 size_t dstsize); 236 size_t dstsize);
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index f4498a62881b..9dc58402bc09 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -2,6 +2,7 @@
2#define __NETNS_CONNTRACK_H 2#define __NETNS_CONNTRACK_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/list_nulls.h>
5#include <asm/atomic.h> 6#include <asm/atomic.h>
6 7
7struct ctl_table_header; 8struct ctl_table_header;
@@ -10,9 +11,9 @@ struct nf_conntrack_ecache;
10struct netns_ct { 11struct netns_ct {
11 atomic_t count; 12 atomic_t count;
12 unsigned int expect_count; 13 unsigned int expect_count;
13 struct hlist_head *hash; 14 struct hlist_nulls_head *hash;
14 struct hlist_head *expect_hash; 15 struct hlist_head *expect_hash;
15 struct hlist_head unconfirmed; 16 struct hlist_nulls_head unconfirmed;
16 struct ip_conntrack_stat *stat; 17 struct ip_conntrack_stat *stat;
17#ifdef CONFIG_NF_CONNTRACK_EVENTS 18#ifdef CONFIG_NF_CONNTRACK_EVENTS
18 struct nf_conntrack_ecache *ecache; 19 struct nf_conntrack_ecache *ecache;
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 977f482d97a9..2eb3814d6258 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -54,5 +54,18 @@ struct netns_ipv4 {
54 54
55 struct timer_list rt_secret_timer; 55 struct timer_list rt_secret_timer;
56 atomic_t rt_genid; 56 atomic_t rt_genid;
57
58#ifdef CONFIG_IP_MROUTE
59 struct sock *mroute_sk;
60 struct mfc_cache **mfc_cache_array;
61 struct vif_device *vif_table;
62 int maxvif;
63 atomic_t cache_resolve_queue_len;
64 int mroute_do_assert;
65 int mroute_do_pim;
66#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
67 int mroute_reg_vif_num;
68#endif
69#endif
57}; 70};
58#endif 71#endif
diff --git a/include/net/netrom.h b/include/net/netrom.h
index f06852bba62a..15696b1fd30f 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -59,10 +59,6 @@ enum {
59#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */ 59#define NR_MAX_WINDOW_SIZE 127 /* Maximum Window Allowable - 127 */
60#define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */ 60#define NR_MAX_PACKET_SIZE 236 /* Maximum Packet Length - 236 */
61 61
62struct nr_private {
63 struct net_device_stats stats;
64};
65
66struct nr_sock { 62struct nr_sock {
67 struct sock sock; 63 struct sock sock;
68 ax25_address user_addr, source_addr, dest_addr; 64 ax25_address user_addr, source_addr, dest_addr;
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index 057b0a8a2885..d43f71b5ec00 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -105,7 +105,6 @@ void phonet_proto_unregister(int protocol, struct phonet_protocol *pp);
105 105
106int phonet_sysctl_init(void); 106int phonet_sysctl_init(void);
107void phonet_sysctl_exit(void); 107void phonet_sysctl_exit(void);
108void phonet_netlink_register(void);
109int isi_register(void); 108int isi_register(void);
110void isi_unregister(void); 109void isi_unregister(void);
111 110
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
index aa1c59a1d33f..5054dc5ea2c2 100644
--- a/include/net/phonet/pn_dev.h
+++ b/include/net/phonet/pn_dev.h
@@ -28,7 +28,7 @@ struct phonet_device_list {
28 spinlock_t lock; 28 spinlock_t lock;
29}; 29};
30 30
31extern struct phonet_device_list pndevs; 31struct phonet_device_list *phonet_device_list(struct net *net);
32 32
33struct phonet_device { 33struct phonet_device {
34 struct list_head list; 34 struct list_head list;
@@ -36,8 +36,9 @@ struct phonet_device {
36 DECLARE_BITMAP(addrs, 64); 36 DECLARE_BITMAP(addrs, 64);
37}; 37};
38 38
39void phonet_device_init(void); 39int phonet_device_init(void);
40void phonet_device_exit(void); 40void phonet_device_exit(void);
41int phonet_netlink_register(void);
41struct net_device *phonet_device_get(struct net *net); 42struct net_device *phonet_device_get(struct net *net);
42 43
43int phonet_address_add(struct net_device *dev, u8 addr); 44int phonet_address_add(struct net_device *dev, u8 addr);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 4082f39f5079..e37fe3129c17 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -85,6 +85,7 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
85 struct nlattr *tab); 85 struct nlattr *tab);
86extern void qdisc_put_rtab(struct qdisc_rate_table *tab); 86extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
87extern void qdisc_put_stab(struct qdisc_size_table *tab); 87extern void qdisc_put_stab(struct qdisc_size_table *tab);
88extern void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc);
88 89
89extern void __qdisc_run(struct Qdisc *q); 90extern void __qdisc_run(struct Qdisc *q);
90 91
diff --git a/include/net/psnap.h b/include/net/psnap.h
index b2e01cc3fc8a..fe456c295b04 100644
--- a/include/net/psnap.h
+++ b/include/net/psnap.h
@@ -1,7 +1,11 @@
1#ifndef _NET_PSNAP_H 1#ifndef _NET_PSNAP_H
2#define _NET_PSNAP_H 2#define _NET_PSNAP_H
3 3
4extern struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *orig_dev)); 4extern struct datalink_proto *
5register_snap_client(const unsigned char *desc,
6 int (*rcvfunc)(struct sk_buff *, struct net_device *,
7 struct packet_type *,
8 struct net_device *orig_dev));
5extern void unregister_snap_client(struct datalink_proto *proto); 9extern void unregister_snap_client(struct datalink_proto *proto);
6 10
7#endif 11#endif
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index f8c47429044a..964ffa0d8815 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -42,24 +42,17 @@ struct Qdisc
42 int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev); 42 int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev);
43 struct sk_buff * (*dequeue)(struct Qdisc *dev); 43 struct sk_buff * (*dequeue)(struct Qdisc *dev);
44 unsigned flags; 44 unsigned flags;
45#define TCQ_F_BUILTIN 1 45#define TCQ_F_BUILTIN 1
46#define TCQ_F_THROTTLED 2 46#define TCQ_F_THROTTLED 2
47#define TCQ_F_INGRESS 4 47#define TCQ_F_INGRESS 4
48#define TCQ_F_WARN_NONWC (1 << 16)
48 int padded; 49 int padded;
49 struct Qdisc_ops *ops; 50 struct Qdisc_ops *ops;
50 struct qdisc_size_table *stab; 51 struct qdisc_size_table *stab;
52 struct list_head list;
51 u32 handle; 53 u32 handle;
52 u32 parent; 54 u32 parent;
53 atomic_t refcnt; 55 atomic_t refcnt;
54 unsigned long state;
55 struct sk_buff *gso_skb;
56 struct sk_buff_head q;
57 struct netdev_queue *dev_queue;
58 struct Qdisc *next_sched;
59 struct list_head list;
60
61 struct gnet_stats_basic bstats;
62 struct gnet_stats_queue qstats;
63 struct gnet_stats_rate_est rate_est; 56 struct gnet_stats_rate_est rate_est;
64 int (*reshape_fail)(struct sk_buff *skb, 57 int (*reshape_fail)(struct sk_buff *skb,
65 struct Qdisc *q); 58 struct Qdisc *q);
@@ -70,6 +63,17 @@ struct Qdisc
70 * and it will live until better solution will be invented. 63 * and it will live until better solution will be invented.
71 */ 64 */
72 struct Qdisc *__parent; 65 struct Qdisc *__parent;
66 struct netdev_queue *dev_queue;
67 struct Qdisc *next_sched;
68
69 struct sk_buff *gso_skb;
70 /*
71 * For performance sake on SMP, we put highly modified fields at the end
72 */
73 unsigned long state;
74 struct sk_buff_head q;
75 struct gnet_stats_basic bstats;
76 struct gnet_stats_queue qstats;
73}; 77};
74 78
75struct Qdisc_class_ops 79struct Qdisc_class_ops
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index 2fec3c366e81..befc8d2a1b9f 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -46,14 +46,14 @@
46#include <net/sctp/sctp.h> 46#include <net/sctp/sctp.h>
47#include <linux/crc32c.h> 47#include <linux/crc32c.h>
48 48
49static inline __be32 sctp_crc32c(__be32 crc, u8 *buffer, u16 length) 49static inline __u32 sctp_crc32c(__u32 crc, u8 *buffer, u16 length)
50{ 50{
51 return (__force __be32)crc32c((__force u32)crc, buffer, length); 51 return crc32c(crc, buffer, length);
52} 52}
53 53
54static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length) 54static inline __u32 sctp_start_cksum(__u8 *buffer, __u16 length)
55{ 55{
56 __be32 crc = ~cpu_to_be32(0); 56 __u32 crc = ~(__u32)0;
57 __u8 zero[sizeof(__u32)] = {0}; 57 __u8 zero[sizeof(__u32)] = {0};
58 58
59 /* Optimize this routine to be SCTP specific, knowing how 59 /* Optimize this routine to be SCTP specific, knowing how
@@ -72,12 +72,12 @@ static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length)
72 return crc; 72 return crc;
73} 73}
74 74
75static inline __be32 sctp_update_cksum(__u8 *buffer, __u16 length, __be32 crc32) 75static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
76{ 76{
77 return sctp_crc32c(crc32, buffer, length); 77 return sctp_crc32c(crc32, buffer, length);
78} 78}
79 79
80static inline __be32 sctp_end_cksum(__be32 crc32) 80static inline __le32 sctp_end_cksum(__be32 crc32)
81{ 81{
82 return (__force __be32)~cpu_to_le32((__force u32)crc32); 82 return cpu_to_le32(~crc32);
83} 83}
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 88988ab03d75..3b966802e05d 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -77,7 +77,8 @@ typedef enum {
77 SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */ 77 SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */
78 SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */ 78 SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */
79 SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */ 79 SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */
80 SCTP_CMD_TRANSPORT_RESET, /* Reset the status of a transport. */ 80 SCTP_CMD_TRANSPORT_HB_SENT, /* Reset the status of a transport. */
81 SCTP_CMD_TRANSPORT_IDLE, /* Do manipulations on idle transport */
81 SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */ 82 SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */
82 SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */ 83 SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */
83 SCTP_CMD_REPORT_BAD_TAG, /* Verification tags didn't match. */ 84 SCTP_CMD_REPORT_BAD_TAG, /* Verification tags didn't match. */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index bbb7742195b0..9f80a7668289 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -62,13 +62,6 @@
62 * and will continue to evolve. 62 * and will continue to evolve.
63 */ 63 */
64 64
65
66
67#ifdef TEST_FRAME
68#undef CONFIG_SCTP_DBG_OBJCNT
69#undef CONFIG_SYSCTL
70#endif /* TEST_FRAME */
71
72#include <linux/types.h> 65#include <linux/types.h>
73#include <linux/slab.h> 66#include <linux/slab.h>
74#include <linux/in.h> 67#include <linux/in.h>
@@ -138,6 +131,8 @@ void sctp_write_space(struct sock *sk);
138unsigned int sctp_poll(struct file *file, struct socket *sock, 131unsigned int sctp_poll(struct file *file, struct socket *sock,
139 poll_table *wait); 132 poll_table *wait);
140void sctp_sock_rfree(struct sk_buff *skb); 133void sctp_sock_rfree(struct sk_buff *skb);
134void sctp_copy_sock(struct sock *newsk, struct sock *sk,
135 struct sctp_association *asoc);
141extern struct percpu_counter sctp_sockets_allocated; 136extern struct percpu_counter sctp_sockets_allocated;
142 137
143/* 138/*
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 9661d7b765f0..23f08fe1d50a 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -218,6 +218,10 @@ extern struct sctp_globals {
218 218
219 /* Flag to idicate if SCTP-AUTH is enabled */ 219 /* Flag to idicate if SCTP-AUTH is enabled */
220 int auth_enable; 220 int auth_enable;
221
222 /* Flag to indicate whether computing and verifying checksum
223 * is disabled. */
224 int checksum_disable;
221} sctp_globals; 225} sctp_globals;
222 226
223#define sctp_rto_initial (sctp_globals.rto_initial) 227#define sctp_rto_initial (sctp_globals.rto_initial)
@@ -252,6 +256,7 @@ extern struct sctp_globals {
252#define sctp_addip_noauth (sctp_globals.addip_noauth_enable) 256#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
253#define sctp_prsctp_enable (sctp_globals.prsctp_enable) 257#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
254#define sctp_auth_enable (sctp_globals.auth_enable) 258#define sctp_auth_enable (sctp_globals.auth_enable)
259#define sctp_checksum_disable (sctp_globals.checksum_disable)
255 260
256/* SCTP Socket type: UDP or TCP style. */ 261/* SCTP Socket type: UDP or TCP style. */
257typedef enum { 262typedef enum {
@@ -905,8 +910,10 @@ struct sctp_transport {
905 * should be set. Every time the RTT 910 * should be set. Every time the RTT
906 * calculation completes (i.e. the DATA chunk 911 * calculation completes (i.e. the DATA chunk
907 * is SACK'd) clear this flag. 912 * is SACK'd) clear this flag.
913 * hb_sent : a flag that signals that we have a pending heartbeat.
908 */ 914 */
909 __u8 rto_pending; 915 __u8 rto_pending;
916 __u8 hb_sent;
910 917
911 /* Flag to track the current fast recovery state */ 918 /* Flag to track the current fast recovery state */
912 __u8 fast_recovery; 919 __u8 fast_recovery;
diff --git a/include/net/sock.h b/include/net/sock.h
index eefeeaf7fc46..4bb1ff9fd15b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -158,7 +158,7 @@ struct sock_common {
158 * @sk_allocation: allocation mode 158 * @sk_allocation: allocation mode
159 * @sk_sndbuf: size of send buffer in bytes 159 * @sk_sndbuf: size of send buffer in bytes
160 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, 160 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
161 * %SO_OOBINLINE settings 161 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
162 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 162 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
163 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 163 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
164 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 164 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
@@ -488,6 +488,13 @@ enum sock_flags {
488 SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */ 488 SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */
489 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ 489 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
490 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ 490 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
491 SOCK_TIMESTAMPING_TX_HARDWARE, /* %SOF_TIMESTAMPING_TX_HARDWARE */
492 SOCK_TIMESTAMPING_TX_SOFTWARE, /* %SOF_TIMESTAMPING_TX_SOFTWARE */
493 SOCK_TIMESTAMPING_RX_HARDWARE, /* %SOF_TIMESTAMPING_RX_HARDWARE */
494 SOCK_TIMESTAMPING_RX_SOFTWARE, /* %SOF_TIMESTAMPING_RX_SOFTWARE */
495 SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */
496 SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */
497 SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */
491}; 498};
492 499
493static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 500static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -944,6 +951,11 @@ extern struct sk_buff *sock_alloc_send_skb(struct sock *sk,
944 unsigned long size, 951 unsigned long size,
945 int noblock, 952 int noblock,
946 int *errcode); 953 int *errcode);
954extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
955 unsigned long header_len,
956 unsigned long data_len,
957 int noblock,
958 int *errcode);
947extern void *sock_kmalloc(struct sock *sk, int size, 959extern void *sock_kmalloc(struct sock *sk, int size,
948 gfp_t priority); 960 gfp_t priority);
949extern void sock_kfree_s(struct sock *sk, void *mem, int size); 961extern void sock_kfree_s(struct sock *sk, void *mem, int size);
@@ -1340,14 +1352,45 @@ static __inline__ void
1340sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 1352sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1341{ 1353{
1342 ktime_t kt = skb->tstamp; 1354 ktime_t kt = skb->tstamp;
1355 struct skb_shared_hwtstamps *hwtstamps = skb_hwtstamps(skb);
1343 1356
1344 if (sock_flag(sk, SOCK_RCVTSTAMP)) 1357 /*
1358 * generate control messages if
1359 * - receive time stamping in software requested (SOCK_RCVTSTAMP
1360 * or SOCK_TIMESTAMPING_RX_SOFTWARE)
1361 * - software time stamp available and wanted
1362 * (SOCK_TIMESTAMPING_SOFTWARE)
1363 * - hardware time stamps available and wanted
1364 * (SOCK_TIMESTAMPING_SYS_HARDWARE or
1365 * SOCK_TIMESTAMPING_RAW_HARDWARE)
1366 */
1367 if (sock_flag(sk, SOCK_RCVTSTAMP) ||
1368 sock_flag(sk, SOCK_TIMESTAMPING_RX_SOFTWARE) ||
1369 (kt.tv64 && sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE)) ||
1370 (hwtstamps->hwtstamp.tv64 &&
1371 sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE)) ||
1372 (hwtstamps->syststamp.tv64 &&
1373 sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE)))
1345 __sock_recv_timestamp(msg, sk, skb); 1374 __sock_recv_timestamp(msg, sk, skb);
1346 else 1375 else
1347 sk->sk_stamp = kt; 1376 sk->sk_stamp = kt;
1348} 1377}
1349 1378
1350/** 1379/**
1380 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
1381 * @msg: outgoing packet
1382 * @sk: socket sending this packet
1383 * @shtx: filled with instructions for time stamping
1384 *
1385 * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if
1386 * parameters are invalid.
1387 */
1388extern int sock_tx_timestamp(struct msghdr *msg,
1389 struct sock *sk,
1390 union skb_shared_tx *shtx);
1391
1392
1393/**
1351 * sk_eat_skb - Release a skb if it is no longer needed 1394 * sk_eat_skb - Release a skb if it is no longer needed
1352 * @sk: socket to eat this skb from 1395 * @sk: socket to eat this skb from
1353 * @skb: socket buffer to eat 1396 * @skb: socket buffer to eat
@@ -1415,7 +1458,7 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
1415 return NULL; 1458 return NULL;
1416} 1459}
1417 1460
1418extern void sock_enable_timestamp(struct sock *sk); 1461extern void sock_enable_timestamp(struct sock *sk, int flag);
1419extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1462extern int sock_get_timestamp(struct sock *, struct timeval __user *);
1420extern int sock_get_timestampns(struct sock *, struct timespec __user *); 1463extern int sock_get_timestampns(struct sock *, struct timespec __user *);
1421 1464
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 218235de8963..646dbe3962ea 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -41,6 +41,7 @@
41#include <net/ip.h> 41#include <net/ip.h>
42#include <net/tcp_states.h> 42#include <net/tcp_states.h>
43#include <net/inet_ecn.h> 43#include <net/inet_ecn.h>
44#include <net/dst.h>
44 45
45#include <linux/seq_file.h> 46#include <linux/seq_file.h>
46 47
@@ -481,7 +482,16 @@ static inline void tcp_clear_xmit_timers(struct sock *sk)
481} 482}
482 483
483extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); 484extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);
484extern unsigned int tcp_current_mss(struct sock *sk, int large); 485extern unsigned int tcp_current_mss(struct sock *sk);
486
487/* Bound MSS / TSO packet size with the half of the window */
488static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
489{
490 if (tp->max_window && pktsize > (tp->max_window >> 1))
491 return max(tp->max_window >> 1, 68U - tp->tcp_header_len);
492 else
493 return pktsize;
494}
485 495
486/* tcp.c */ 496/* tcp.c */
487extern void tcp_get_info(struct sock *, struct tcp_info *); 497extern void tcp_get_info(struct sock *, struct tcp_info *);
@@ -521,6 +531,17 @@ static inline void tcp_fast_path_check(struct sock *sk)
521 tcp_fast_path_on(tp); 531 tcp_fast_path_on(tp);
522} 532}
523 533
534/* Compute the actual rto_min value */
535static inline u32 tcp_rto_min(struct sock *sk)
536{
537 struct dst_entry *dst = __sk_dst_get(sk);
538 u32 rto_min = TCP_RTO_MIN;
539
540 if (dst && dst_metric_locked(dst, RTAX_RTO_MIN))
541 rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
542 return rto_min;
543}
544
524/* Compute the actual receive window we are currently advertising. 545/* Compute the actual receive window we are currently advertising.
525 * Rcv_nxt can be after the window if our peer push more data 546 * Rcv_nxt can be after the window if our peer push more data
526 * than the offered window. 547 * than the offered window.
@@ -607,21 +628,6 @@ static inline int tcp_skb_mss(const struct sk_buff *skb)
607 return skb_shinfo(skb)->gso_size; 628 return skb_shinfo(skb)->gso_size;
608} 629}
609 630
610static inline void tcp_dec_pcount_approx_int(__u32 *count, const int decr)
611{
612 if (*count) {
613 *count -= decr;
614 if ((int)*count < 0)
615 *count = 0;
616 }
617}
618
619static inline void tcp_dec_pcount_approx(__u32 *count,
620 const struct sk_buff *skb)
621{
622 tcp_dec_pcount_approx_int(count, tcp_skb_pcount(skb));
623}
624
625/* Events passed to congestion control interface */ 631/* Events passed to congestion control interface */
626enum tcp_ca_event { 632enum tcp_ca_event {
627 CA_EVENT_TX_START, /* first transmit when no packets in flight */ 633 CA_EVENT_TX_START, /* first transmit when no packets in flight */
@@ -685,6 +691,7 @@ extern void tcp_get_allowed_congestion_control(char *buf, size_t len);
685extern int tcp_set_allowed_congestion_control(char *allowed); 691extern int tcp_set_allowed_congestion_control(char *allowed);
686extern int tcp_set_congestion_control(struct sock *sk, const char *name); 692extern int tcp_set_congestion_control(struct sock *sk, const char *name);
687extern void tcp_slow_start(struct tcp_sock *tp); 693extern void tcp_slow_start(struct tcp_sock *tp);
694extern void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
688 695
689extern struct tcp_congestion_ops tcp_init_congestion_ops; 696extern struct tcp_congestion_ops tcp_init_congestion_ops;
690extern u32 tcp_reno_ssthresh(struct sock *sk); 697extern u32 tcp_reno_ssthresh(struct sock *sk);
@@ -821,15 +828,15 @@ static inline void tcp_push_pending_frames(struct sock *sk)
821{ 828{
822 struct tcp_sock *tp = tcp_sk(sk); 829 struct tcp_sock *tp = tcp_sk(sk);
823 830
824 __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle); 831 __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle);
825} 832}
826 833
827static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) 834static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq)
828{ 835{
829 tp->snd_wl1 = seq; 836 tp->snd_wl1 = seq;
830} 837}
831 838
832static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) 839static inline void tcp_update_wl(struct tcp_sock *tp, u32 seq)
833{ 840{
834 tp->snd_wl1 = seq; 841 tp->snd_wl1 = seq;
835} 842}
@@ -900,7 +907,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
900 wake_up_interruptible(sk->sk_sleep); 907 wake_up_interruptible(sk->sk_sleep);
901 if (!inet_csk_ack_scheduled(sk)) 908 if (!inet_csk_ack_scheduled(sk))
902 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 909 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
903 (3 * TCP_RTO_MIN) / 4, 910 (3 * tcp_rto_min(sk)) / 4,
904 TCP_RTO_MAX); 911 TCP_RTO_MAX);
905 } 912 }
906 return 1; 913 return 1;
@@ -925,7 +932,6 @@ extern void tcp_done(struct sock *sk);
925static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) 932static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
926{ 933{
927 rx_opt->dsack = 0; 934 rx_opt->dsack = 0;
928 rx_opt->eff_sacks = 0;
929 rx_opt->num_sacks = 0; 935 rx_opt->num_sacks = 0;
930} 936}
931 937
@@ -997,11 +1003,21 @@ static inline int tcp_fin_time(const struct sock *sk)
997 return fin_timeout; 1003 return fin_timeout;
998} 1004}
999 1005
1000static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int rst) 1006static inline int tcp_paws_check(const struct tcp_options_received *rx_opt,
1007 int paws_win)
1001{ 1008{
1002 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) 1009 if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win)
1003 return 0; 1010 return 1;
1004 if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) 1011 if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS))
1012 return 1;
1013
1014 return 0;
1015}
1016
1017static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt,
1018 int rst)
1019{
1020 if (tcp_paws_check(rx_opt, 0))
1005 return 0; 1021 return 0;
1006 1022
1007 /* RST segments are not recommended to carry timestamp, 1023 /* RST segments are not recommended to carry timestamp,
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 876b6f2bb4fd..bfb240c6cf79 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -46,7 +46,7 @@ extern int datagram_send_ctl(struct net *net,
46 struct ipv6_txoptions *opt, 46 struct ipv6_txoptions *opt,
47 int *hlimit, int *tclass); 47 int *hlimit, int *tclass);
48 48
49#define LOOPBACK4_IPV6 __constant_htonl(0x7f000006) 49#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
50 50
51/* 51/*
52 * address family specific functions 52 * address family specific functions
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 21c5d966142d..64a76208580c 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -69,6 +69,9 @@ enum ieee80211_channel_flags {
69 * @band: band this channel belongs to. 69 * @band: band this channel belongs to.
70 * @max_antenna_gain: maximum antenna gain in dBi 70 * @max_antenna_gain: maximum antenna gain in dBi
71 * @max_power: maximum transmission power (in dBm) 71 * @max_power: maximum transmission power (in dBm)
72 * @beacon_found: helper to regulatory code to indicate when a beacon
73 * has been found on this channel. Use regulatory_hint_found_beacon()
74 * to enable this, this is is useful only on 5 GHz band.
72 * @orig_mag: internal use 75 * @orig_mag: internal use
73 * @orig_mpwr: internal use 76 * @orig_mpwr: internal use
74 */ 77 */
@@ -80,6 +83,7 @@ struct ieee80211_channel {
80 u32 flags; 83 u32 flags;
81 int max_antenna_gain; 84 int max_antenna_gain;
82 int max_power; 85 int max_power;
86 bool beacon_found;
83 u32 orig_flags; 87 u32 orig_flags;
84 int orig_mag, orig_mpwr; 88 int orig_mag, orig_mpwr;
85}; 89};
@@ -181,12 +185,26 @@ struct ieee80211_supported_band {
181 * struct wiphy - wireless hardware description 185 * struct wiphy - wireless hardware description
182 * @idx: the wiphy index assigned to this item 186 * @idx: the wiphy index assigned to this item
183 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 187 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
184 * @fw_handles_regulatory: tells us the firmware for this device 188 * @custom_regulatory: tells us the driver for this device
185 * has its own regulatory solution and cannot identify the 189 * has its own custom regulatory domain and cannot identify the
186 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 190 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
187 * we will disregard the first regulatory hint (when the 191 * we will disregard the first regulatory hint (when the
188 * initiator is %REGDOM_SET_BY_CORE). 192 * initiator is %REGDOM_SET_BY_CORE).
193 * @strict_regulatory: tells us the driver for this device will ignore
194 * regulatory domain settings until it gets its own regulatory domain
195 * via its regulatory_hint(). After its gets its own regulatory domain
196 * it will only allow further regulatory domain settings to further
197 * enhance compliance. For example if channel 13 and 14 are disabled
198 * by this regulatory domain no user regulatory domain can enable these
199 * channels at a later time. This can be used for devices which do not
200 * have calibration information gauranteed for frequencies or settings
201 * outside of its regulatory domain.
189 * @reg_notifier: the driver's regulatory notification callback 202 * @reg_notifier: the driver's regulatory notification callback
203 * @regd: the driver's regulatory domain, if one was requested via
204 * the regulatory_hint() API. This can be used by the driver
205 * on the reg_notifier() if it chooses to ignore future
206 * regulatory domain changes caused by other drivers.
207 * @signal_type: signal type reported in &struct cfg80211_bss.
190 */ 208 */
191struct wiphy { 209struct wiphy {
192 /* assign these fields before you register the wiphy */ 210 /* assign these fields before you register the wiphy */
@@ -197,7 +215,13 @@ struct wiphy {
197 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 215 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
198 u16 interface_modes; 216 u16 interface_modes;
199 217
200 bool fw_handles_regulatory; 218 bool custom_regulatory;
219 bool strict_regulatory;
220
221 enum cfg80211_signal_type signal_type;
222
223 int bss_priv_size;
224 u8 max_scan_ssids;
201 225
202 /* If multiple wiphys are registered and you're handed e.g. 226 /* If multiple wiphys are registered and you're handed e.g.
203 * a regular netdev with assigned ieee80211_ptr, you won't 227 * a regular netdev with assigned ieee80211_ptr, you won't
@@ -209,10 +233,13 @@ struct wiphy {
209 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 233 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
210 234
211 /* Lets us get back the wiphy on the callback */ 235 /* Lets us get back the wiphy on the callback */
212 int (*reg_notifier)(struct wiphy *wiphy, enum reg_set_by setby); 236 int (*reg_notifier)(struct wiphy *wiphy,
237 struct regulatory_request *request);
213 238
214 /* fields below are read-only, assigned by cfg80211 */ 239 /* fields below are read-only, assigned by cfg80211 */
215 240
241 const struct ieee80211_regdomain *regd;
242
216 /* the item in /sys/class/ieee80211/ points to this, 243 /* the item in /sys/class/ieee80211/ points to this,
217 * you need use set_wiphy_dev() (see below) */ 244 * you need use set_wiphy_dev() (see below) */
218 struct device dev; 245 struct device dev;
@@ -361,7 +388,7 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
361 */ 388 */
362struct ieee80211_rate * 389struct ieee80211_rate *
363ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 390ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
364 u64 basic_rates, int bitrate); 391 u32 basic_rates, int bitrate);
365 392
366/** 393/**
367 * regulatory_hint - driver hint to the wireless core a regulatory domain 394 * regulatory_hint - driver hint to the wireless core a regulatory domain
@@ -378,8 +405,15 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
378 * domain should be in or by providing a completely build regulatory domain. 405 * domain should be in or by providing a completely build regulatory domain.
379 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 406 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
380 * for a regulatory domain structure for the respective country. 407 * for a regulatory domain structure for the respective country.
408 *
409 * The wiphy must have been registered to cfg80211 prior to this call.
410 * For cfg80211 drivers this means you must first use wiphy_register(),
411 * for mac80211 drivers you must first use ieee80211_register_hw().
412 *
413 * Drivers should check the return value, its possible you can get
414 * an -ENOMEM.
381 */ 415 */
382extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2); 416extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
383 417
384/** 418/**
385 * regulatory_hint_11d - hints a country IE as a regulatory domain 419 * regulatory_hint_11d - hints a country IE as a regulatory domain
@@ -395,4 +429,44 @@ extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2);
395extern void regulatory_hint_11d(struct wiphy *wiphy, 429extern void regulatory_hint_11d(struct wiphy *wiphy,
396 u8 *country_ie, 430 u8 *country_ie,
397 u8 country_ie_len); 431 u8 country_ie_len);
432/**
433 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
434 * @wiphy: the wireless device we want to process the regulatory domain on
435 * @regd: the custom regulatory domain to use for this wiphy
436 *
437 * Drivers can sometimes have custom regulatory domains which do not apply
438 * to a specific country. Drivers can use this to apply such custom regulatory
439 * domains. This routine must be called prior to wiphy registration. The
440 * custom regulatory domain will be trusted completely and as such previous
441 * default channel settings will be disregarded. If no rule is found for a
442 * channel on the regulatory domain the channel will be disabled.
443 */
444extern void wiphy_apply_custom_regulatory(
445 struct wiphy *wiphy,
446 const struct ieee80211_regdomain *regd);
447
448/**
449 * freq_reg_info - get regulatory information for the given frequency
450 * @wiphy: the wiphy for which we want to process this rule for
451 * @center_freq: Frequency in KHz for which we want regulatory information for
452 * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
453 * you can set this to 0. If this frequency is allowed we then set
454 * this value to the maximum allowed bandwidth.
455 * @reg_rule: the regulatory rule which we have for this frequency
456 *
457 * Use this function to get the regulatory rule for a specific frequency on
458 * a given wireless device. If the device has a specific regulatory domain
459 * it wants to follow we respect that unless a country IE has been received
460 * and processed already.
461 *
462 * Returns 0 if it was able to find a valid regulatory rule which does
463 * apply to the given center_freq otherwise it returns non-zero. It will
464 * also return -ERANGE if we determine the given center_freq does not even have
465 * a regulatory rule for a frequency range in the center_freq's band. See
466 * freq_in_rule_band() for our current definition of a band -- this is purely
467 * subjective and right now its 802.11 specific.
468 */
469extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
470 const struct ieee80211_reg_rule **reg_rule);
471
398#endif /* __NET_WIRELESS_H */ 472#endif /* __NET_WIRELESS_H */
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index ec7c6d99ed3f..938858304300 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -314,12 +314,12 @@ struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
314 */ 314 */
315void ib_destroy_cm_id(struct ib_cm_id *cm_id); 315void ib_destroy_cm_id(struct ib_cm_id *cm_id);
316 316
317#define IB_SERVICE_ID_AGN_MASK __constant_cpu_to_be64(0xFF00000000000000ULL) 317#define IB_SERVICE_ID_AGN_MASK cpu_to_be64(0xFF00000000000000ULL)
318#define IB_CM_ASSIGN_SERVICE_ID __constant_cpu_to_be64(0x0200000000000000ULL) 318#define IB_CM_ASSIGN_SERVICE_ID cpu_to_be64(0x0200000000000000ULL)
319#define IB_CMA_SERVICE_ID __constant_cpu_to_be64(0x0000000001000000ULL) 319#define IB_CMA_SERVICE_ID cpu_to_be64(0x0000000001000000ULL)
320#define IB_CMA_SERVICE_ID_MASK __constant_cpu_to_be64(0xFFFFFFFFFF000000ULL) 320#define IB_CMA_SERVICE_ID_MASK cpu_to_be64(0xFFFFFFFFFF000000ULL)
321#define IB_SDP_SERVICE_ID __constant_cpu_to_be64(0x0000000000010000ULL) 321#define IB_SDP_SERVICE_ID cpu_to_be64(0x0000000000010000ULL)
322#define IB_SDP_SERVICE_ID_MASK __constant_cpu_to_be64(0xFFFFFFFFFFFF0000ULL) 322#define IB_SDP_SERVICE_ID_MASK cpu_to_be64(0xFFFFFFFFFFFF0000ULL)
323 323
324struct ib_cm_compare_data { 324struct ib_cm_compare_data {
325 u8 data[IB_CM_COMPARE_SIZE]; 325 u8 data[IB_CM_COMPARE_SIZE];
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index 5f6c40fffcf4..d3b9401b77b0 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -107,7 +107,7 @@
107#define IB_MGMT_RMPP_STATUS_ABORT_MAX 127 107#define IB_MGMT_RMPP_STATUS_ABORT_MAX 127
108 108
109#define IB_QP0 0 109#define IB_QP0 0
110#define IB_QP1 __constant_htonl(1) 110#define IB_QP1 cpu_to_be32(1)
111#define IB_QP1_QKEY 0x80010000 111#define IB_QP1_QKEY 0x80010000
112#define IB_QP_SET_QKEY 0x80000000 112#define IB_QP_SET_QKEY 0x80000000
113 113
@@ -290,7 +290,7 @@ static inline void ib_set_rmpp_resptime(struct ib_rmpp_hdr *rmpp_hdr, u8 rtime)
290 */ 290 */
291static inline void ib_set_rmpp_flags(struct ib_rmpp_hdr *rmpp_hdr, u8 flags) 291static inline void ib_set_rmpp_flags(struct ib_rmpp_hdr *rmpp_hdr, u8 flags)
292{ 292{
293 rmpp_hdr->rmpp_rtime_flags = (rmpp_hdr->rmpp_rtime_flags & 0xF1) | 293 rmpp_hdr->rmpp_rtime_flags = (rmpp_hdr->rmpp_rtime_flags & 0xF8) |
294 (flags & 0x7); 294 (flags & 0x7);
295} 295}
296 296
diff --git a/include/rdma/ib_smi.h b/include/rdma/ib_smi.h
index aaca0878668f..98b9086d769a 100644
--- a/include/rdma/ib_smi.h
+++ b/include/rdma/ib_smi.h
@@ -63,25 +63,25 @@ struct ib_smp {
63 u8 return_path[IB_SMP_MAX_PATH_HOPS]; 63 u8 return_path[IB_SMP_MAX_PATH_HOPS];
64} __attribute__ ((packed)); 64} __attribute__ ((packed));
65 65
66#define IB_SMP_DIRECTION __constant_htons(0x8000) 66#define IB_SMP_DIRECTION cpu_to_be16(0x8000)
67 67
68/* Subnet management attributes */ 68/* Subnet management attributes */
69#define IB_SMP_ATTR_NOTICE __constant_htons(0x0002) 69#define IB_SMP_ATTR_NOTICE cpu_to_be16(0x0002)
70#define IB_SMP_ATTR_NODE_DESC __constant_htons(0x0010) 70#define IB_SMP_ATTR_NODE_DESC cpu_to_be16(0x0010)
71#define IB_SMP_ATTR_NODE_INFO __constant_htons(0x0011) 71#define IB_SMP_ATTR_NODE_INFO cpu_to_be16(0x0011)
72#define IB_SMP_ATTR_SWITCH_INFO __constant_htons(0x0012) 72#define IB_SMP_ATTR_SWITCH_INFO cpu_to_be16(0x0012)
73#define IB_SMP_ATTR_GUID_INFO __constant_htons(0x0014) 73#define IB_SMP_ATTR_GUID_INFO cpu_to_be16(0x0014)
74#define IB_SMP_ATTR_PORT_INFO __constant_htons(0x0015) 74#define IB_SMP_ATTR_PORT_INFO cpu_to_be16(0x0015)
75#define IB_SMP_ATTR_PKEY_TABLE __constant_htons(0x0016) 75#define IB_SMP_ATTR_PKEY_TABLE cpu_to_be16(0x0016)
76#define IB_SMP_ATTR_SL_TO_VL_TABLE __constant_htons(0x0017) 76#define IB_SMP_ATTR_SL_TO_VL_TABLE cpu_to_be16(0x0017)
77#define IB_SMP_ATTR_VL_ARB_TABLE __constant_htons(0x0018) 77#define IB_SMP_ATTR_VL_ARB_TABLE cpu_to_be16(0x0018)
78#define IB_SMP_ATTR_LINEAR_FORWARD_TABLE __constant_htons(0x0019) 78#define IB_SMP_ATTR_LINEAR_FORWARD_TABLE cpu_to_be16(0x0019)
79#define IB_SMP_ATTR_RANDOM_FORWARD_TABLE __constant_htons(0x001A) 79#define IB_SMP_ATTR_RANDOM_FORWARD_TABLE cpu_to_be16(0x001A)
80#define IB_SMP_ATTR_MCAST_FORWARD_TABLE __constant_htons(0x001B) 80#define IB_SMP_ATTR_MCAST_FORWARD_TABLE cpu_to_be16(0x001B)
81#define IB_SMP_ATTR_SM_INFO __constant_htons(0x0020) 81#define IB_SMP_ATTR_SM_INFO cpu_to_be16(0x0020)
82#define IB_SMP_ATTR_VENDOR_DIAG __constant_htons(0x0030) 82#define IB_SMP_ATTR_VENDOR_DIAG cpu_to_be16(0x0030)
83#define IB_SMP_ATTR_LED_INFO __constant_htons(0x0031) 83#define IB_SMP_ATTR_LED_INFO cpu_to_be16(0x0031)
84#define IB_SMP_ATTR_VENDOR_MASK __constant_htons(0xFF00) 84#define IB_SMP_ATTR_VENDOR_MASK cpu_to_be16(0xFF00)
85 85
86struct ib_port_info { 86struct ib_port_info {
87 __be64 mkey; 87 __be64 mkey;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 936e333e7ce5..c179318edd92 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -388,7 +388,7 @@ enum {
388 IB_MULTICAST_QPN = 0xffffff 388 IB_MULTICAST_QPN = 0xffffff
389}; 389};
390 390
391#define IB_LID_PERMISSIVE __constant_htons(0xFFFF) 391#define IB_LID_PERMISSIVE cpu_to_be16(0xFFFF)
392 392
393enum ib_ah_flags { 393enum ib_ah_flags {
394 IB_AH_GRH = 1 394 IB_AH_GRH = 1
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h
index 57aaa8f0d613..ccb3dbe90463 100644
--- a/include/scsi/fc/fc_fcoe.h
+++ b/include/scsi/fc/fc_fcoe.h
@@ -25,17 +25,6 @@
25 */ 25 */
26 26
27/* 27/*
28 * The FCoE ethertype eventually goes in net/if_ether.h.
29 */
30#ifndef ETH_P_FCOE
31#define ETH_P_FCOE 0x8906 /* FCOE ether type */
32#endif
33
34#ifndef ETH_P_8021Q
35#define ETH_P_8021Q 0x8100
36#endif
37
38/*
39 * FC_FCOE_OUI hasn't been standardized yet. XXX TBD. 28 * FC_FCOE_OUI hasn't been standardized yet. XXX TBD.
40 */ 29 */
41#ifndef FC_FCOE_OUI 30#ifndef FC_FCOE_OUI
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/fc_fs.h b/include/scsi/fc/fc_fs.h
index 3e4801d2bdbb..ac4cd38c860e 100644
--- a/include/scsi/fc/fc_fs.h
+++ b/include/scsi/fc/fc_fs.h
@@ -149,6 +149,7 @@ enum fc_rctl {
149 * Well-known fabric addresses. 149 * Well-known fabric addresses.
150 */ 150 */
151enum fc_well_known_fid { 151enum fc_well_known_fid {
152 FC_FID_NONE = 0x000000, /* No destination */
152 FC_FID_BCAST = 0xffffff, /* broadcast */ 153 FC_FID_BCAST = 0xffffff, /* broadcast */
153 FC_FID_FLOGI = 0xfffffe, /* fabric login */ 154 FC_FID_FLOGI = 0xfffffe, /* fabric login */
154 FC_FID_FCTRL = 0xfffffd, /* fabric controller */ 155 FC_FID_FCTRL = 0xfffffd, /* fabric controller */
@@ -337,4 +338,9 @@ enum fc_pf_rjt_reason {
337 FC_RJT_VENDOR = 0xff, /* vendor specific reject */ 338 FC_RJT_VENDOR = 0xff, /* vendor specific reject */
338}; 339};
339 340
341/* default timeout values */
342
343#define FC_DEF_E_D_TOV 2000UL
344#define FC_DEF_R_A_TOV 10000UL
345
340#endif /* _FC_FS_H_ */ 346#endif /* _FC_FS_H_ */
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
index 04d34a71355f..59511057cee0 100644
--- a/include/scsi/fc_frame.h
+++ b/include/scsi/fc_frame.h
@@ -54,8 +54,7 @@
54#define fr_eof(fp) (fr_cb(fp)->fr_eof) 54#define fr_eof(fp) (fr_cb(fp)->fr_eof)
55#define fr_flags(fp) (fr_cb(fp)->fr_flags) 55#define fr_flags(fp) (fr_cb(fp)->fr_flags)
56#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload) 56#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload)
57#define fr_cmd(fp) (fr_cb(fp)->fr_cmd) 57#define fr_fsp(fp) (fr_cb(fp)->fr_fsp)
58#define fr_dir(fp) (fr_cmd(fp)->sc_data_direction)
59#define fr_crc(fp) (fr_cb(fp)->fr_crc) 58#define fr_crc(fp) (fr_cb(fp)->fr_crc)
60 59
61struct fc_frame { 60struct fc_frame {
@@ -66,7 +65,7 @@ struct fcoe_rcv_info {
66 struct packet_type *ptype; 65 struct packet_type *ptype;
67 struct fc_lport *fr_dev; /* transport layer private pointer */ 66 struct fc_lport *fr_dev; /* transport layer private pointer */
68 struct fc_seq *fr_seq; /* for use with exchange manager */ 67 struct fc_seq *fr_seq; /* for use with exchange manager */
69 struct scsi_cmnd *fr_cmd; /* for use of scsi command */ 68 struct fc_fcp_pkt *fr_fsp; /* for the corresponding fcp I/O */
70 u32 fr_crc; 69 u32 fr_crc;
71 u16 fr_max_payload; /* max FC payload */ 70 u16 fr_max_payload; /* max FC payload */
72 enum fc_sof fr_sof; /* start of frame delimiter */ 71 enum fc_sof fr_sof; /* start of frame delimiter */
@@ -218,20 +217,6 @@ static inline bool fc_frame_is_cmd(const struct fc_frame *fp)
218 return fc_frame_rctl(fp) == FC_RCTL_DD_UNSOL_CMD; 217 return fc_frame_rctl(fp) == FC_RCTL_DD_UNSOL_CMD;
219} 218}
220 219
221static inline bool fc_frame_is_read(const struct fc_frame *fp)
222{
223 if (fc_frame_is_cmd(fp) && fr_cmd(fp))
224 return fr_dir(fp) == DMA_FROM_DEVICE;
225 return false;
226}
227
228static inline bool fc_frame_is_write(const struct fc_frame *fp)
229{
230 if (fc_frame_is_cmd(fp) && fr_cmd(fp))
231 return fr_dir(fp) == DMA_TO_DEVICE;
232 return false;
233}
234
235/* 220/*
236 * Check for leaks. 221 * Check for leaks.
237 * Print the frame header of any currently allocated frame, assuming there 222 * Print the frame header of any currently allocated frame, assuming there
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 9f2876397dda..45f9cc642c46 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>
@@ -68,9 +69,6 @@
68/* 69/*
69 * FC HBA status 70 * FC HBA status
70 */ 71 */
71#define FC_PAUSE (1 << 1)
72#define FC_LINK_UP (1 << 0)
73
74enum fc_lport_state { 72enum fc_lport_state {
75 LPORT_ST_NONE = 0, 73 LPORT_ST_NONE = 0,
76 LPORT_ST_FLOGI, 74 LPORT_ST_FLOGI,
@@ -248,6 +246,7 @@ struct fc_fcp_pkt {
248 */ 246 */
249 struct fcp_cmnd cdb_cmd; 247 struct fcp_cmnd cdb_cmd;
250 size_t xfer_len; 248 size_t xfer_len;
249 u16 xfer_ddp; /* this xfer is ddped */
251 u32 xfer_contig_end; /* offset of end of contiguous xfer */ 250 u32 xfer_contig_end; /* offset of end of contiguous xfer */
252 u16 max_payload; /* max payload size in bytes */ 251 u16 max_payload; /* max payload size in bytes */
253 252
@@ -270,6 +269,15 @@ struct fc_fcp_pkt {
270 u8 recov_retry; /* count of recovery retries */ 269 u8 recov_retry; /* count of recovery retries */
271 struct fc_seq *recov_seq; /* sequence for REC or SRR */ 270 struct fc_seq *recov_seq; /* sequence for REC or SRR */
272}; 271};
272/*
273 * FC_FCP HELPER FUNCTIONS
274 *****************************/
275static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp)
276{
277 if (fsp && fsp->cmd)
278 return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE;
279 return false;
280}
273 281
274/* 282/*
275 * Structure and function definitions for managing Fibre Channel Exchanges 283 * Structure and function definitions for managing Fibre Channel Exchanges
@@ -339,31 +347,17 @@ struct fc_exch {
339 347
340struct libfc_function_template { 348struct libfc_function_template {
341 349
342 /**
343 * Mandatory Fields
344 *
345 * These handlers must be implemented by the LLD.
346 */
347
348 /* 350 /*
349 * Interface to send a FC frame 351 * Interface to send a FC frame
350 */
351 int (*frame_send)(struct fc_lport *lp, struct fc_frame *fp);
352
353 /**
354 * Optional Fields
355 * 352 *
356 * The LLD may choose to implement any of the following handlers. 353 * STATUS: REQUIRED
357 * If LLD doesn't specify hander and leaves its pointer NULL then
358 * the default libfc function will be used for that handler.
359 */
360
361 /**
362 * ELS/CT interfaces
363 */ 354 */
355 int (*frame_send)(struct fc_lport *lp, struct fc_frame *fp);
364 356
365 /* 357 /*
366 * elsct_send - sends ELS/CT frame 358 * Interface to send ELS/CT frames
359 *
360 * STATUS: OPTIONAL
367 */ 361 */
368 struct fc_seq *(*elsct_send)(struct fc_lport *lport, 362 struct fc_seq *(*elsct_send)(struct fc_lport *lport,
369 struct fc_rport *rport, 363 struct fc_rport *rport,
@@ -373,9 +367,6 @@ struct libfc_function_template {
373 struct fc_frame *fp, 367 struct fc_frame *fp,
374 void *arg), 368 void *arg),
375 void *arg, u32 timer_msec); 369 void *arg, u32 timer_msec);
376 /**
377 * Exhance Manager interfaces
378 */
379 370
380 /* 371 /*
381 * Send the FC frame payload using a new exchange and sequence. 372 * Send the FC frame payload using a new exchange and sequence.
@@ -407,6 +398,8 @@ struct libfc_function_template {
407 * timer_msec argument is specified. The timer is canceled when 398 * timer_msec argument is specified. The timer is canceled when
408 * it fires or when the exchange is done. The exchange timeout handler 399 * it fires or when the exchange is done. The exchange timeout handler
409 * is registered by EM layer. 400 * is registered by EM layer.
401 *
402 * STATUS: OPTIONAL
410 */ 403 */
411 struct fc_seq *(*exch_seq_send)(struct fc_lport *lp, 404 struct fc_seq *(*exch_seq_send)(struct fc_lport *lp,
412 struct fc_frame *fp, 405 struct fc_frame *fp,
@@ -418,14 +411,33 @@ struct libfc_function_template {
418 void *arg, unsigned int timer_msec); 411 void *arg, unsigned int timer_msec);
419 412
420 /* 413 /*
421 * send a frame using existing sequence and exchange. 414 * Sets up the DDP context for a given exchange id on the given
415 * scatterlist if LLD supports DDP for large receive.
416 *
417 * STATUS: OPTIONAL
418 */
419 int (*ddp_setup)(struct fc_lport *lp, u16 xid,
420 struct scatterlist *sgl, unsigned int sgc);
421 /*
422 * Completes the DDP transfer and returns the length of data DDPed
423 * for the given exchange id.
424 *
425 * STATUS: OPTIONAL
426 */
427 int (*ddp_done)(struct fc_lport *lp, u16 xid);
428 /*
429 * Send a frame using an existing sequence and exchange.
430 *
431 * STATUS: OPTIONAL
422 */ 432 */
423 int (*seq_send)(struct fc_lport *lp, struct fc_seq *sp, 433 int (*seq_send)(struct fc_lport *lp, struct fc_seq *sp,
424 struct fc_frame *fp); 434 struct fc_frame *fp);
425 435
426 /* 436 /*
427 * Send ELS response using mainly infomation 437 * Send an ELS response using infomation from a previous
428 * in exchange and sequence in EM layer. 438 * exchange and sequence.
439 *
440 * STATUS: OPTIONAL
429 */ 441 */
430 void (*seq_els_rsp_send)(struct fc_seq *sp, enum fc_els_cmd els_cmd, 442 void (*seq_els_rsp_send)(struct fc_seq *sp, enum fc_els_cmd els_cmd,
431 struct fc_seq_els_data *els_data); 443 struct fc_seq_els_data *els_data);
@@ -437,6 +449,8 @@ struct libfc_function_template {
437 * A timer_msec can be specified for abort timeout, if non-zero 449 * A timer_msec can be specified for abort timeout, if non-zero
438 * timer_msec value is specified then exchange resp handler 450 * timer_msec value is specified then exchange resp handler
439 * will be called with timeout error if no response to abort. 451 * will be called with timeout error if no response to abort.
452 *
453 * STATUS: OPTIONAL
440 */ 454 */
441 int (*seq_exch_abort)(const struct fc_seq *req_sp, 455 int (*seq_exch_abort)(const struct fc_seq *req_sp,
442 unsigned int timer_msec); 456 unsigned int timer_msec);
@@ -444,6 +458,8 @@ struct libfc_function_template {
444 /* 458 /*
445 * Indicate that an exchange/sequence tuple is complete and the memory 459 * Indicate that an exchange/sequence tuple is complete and the memory
446 * allocated for the related objects may be freed. 460 * allocated for the related objects may be freed.
461 *
462 * STATUS: OPTIONAL
447 */ 463 */
448 void (*exch_done)(struct fc_seq *sp); 464 void (*exch_done)(struct fc_seq *sp);
449 465
@@ -451,6 +467,8 @@ struct libfc_function_template {
451 * Assigns a EM and a free XID for an new exchange and then 467 * Assigns a EM and a free XID for an new exchange and then
452 * allocates a new exchange and sequence pair. 468 * allocates a new exchange and sequence pair.
453 * The fp can be used to determine free XID. 469 * The fp can be used to determine free XID.
470 *
471 * STATUS: OPTIONAL
454 */ 472 */
455 struct fc_exch *(*exch_get)(struct fc_lport *lp, struct fc_frame *fp); 473 struct fc_exch *(*exch_get)(struct fc_lport *lp, struct fc_frame *fp);
456 474
@@ -458,12 +476,16 @@ struct libfc_function_template {
458 * Release previously assigned XID by exch_get API. 476 * Release previously assigned XID by exch_get API.
459 * The LLD may implement this if XID is assigned by LLD 477 * The LLD may implement this if XID is assigned by LLD
460 * in exch_get(). 478 * in exch_get().
479 *
480 * STATUS: OPTIONAL
461 */ 481 */
462 void (*exch_put)(struct fc_lport *lp, struct fc_exch_mgr *mp, 482 void (*exch_put)(struct fc_lport *lp, struct fc_exch_mgr *mp,
463 u16 ex_id); 483 u16 ex_id);
464 484
465 /* 485 /*
466 * Start a new sequence on the same exchange/sequence tuple. 486 * Start a new sequence on the same exchange/sequence tuple.
487 *
488 * STATUS: OPTIONAL
467 */ 489 */
468 struct fc_seq *(*seq_start_next)(struct fc_seq *sp); 490 struct fc_seq *(*seq_start_next)(struct fc_seq *sp);
469 491
@@ -471,26 +493,38 @@ struct libfc_function_template {
471 * Reset an exchange manager, completing all sequences and exchanges. 493 * Reset an exchange manager, completing all sequences and exchanges.
472 * If s_id is non-zero, reset only exchanges originating from that FID. 494 * If s_id is non-zero, reset only exchanges originating from that FID.
473 * If d_id is non-zero, reset only exchanges sending to that FID. 495 * If d_id is non-zero, reset only exchanges sending to that FID.
496 *
497 * STATUS: OPTIONAL
474 */ 498 */
475 void (*exch_mgr_reset)(struct fc_exch_mgr *, 499 void (*exch_mgr_reset)(struct fc_lport *,
476 u32 s_id, u32 d_id); 500 u32 s_id, u32 d_id);
477 501
478 void (*rport_flush_queue)(void); 502 /*
479 /** 503 * Flush the rport work queue. Generally used before shutdown.
480 * Local Port interfaces 504 *
505 * STATUS: OPTIONAL
481 */ 506 */
507 void (*rport_flush_queue)(void);
482 508
483 /* 509 /*
484 * Receive a frame to a local port. 510 * Receive a frame for a local port.
511 *
512 * STATUS: OPTIONAL
485 */ 513 */
486 void (*lport_recv)(struct fc_lport *lp, struct fc_seq *sp, 514 void (*lport_recv)(struct fc_lport *lp, struct fc_seq *sp,
487 struct fc_frame *fp); 515 struct fc_frame *fp);
488 516
517 /*
518 * Reset the local port.
519 *
520 * STATUS: OPTIONAL
521 */
489 int (*lport_reset)(struct fc_lport *); 522 int (*lport_reset)(struct fc_lport *);
490 523
491 /** 524 /*
492 * Remote Port interfaces 525 * Create a remote port
493 */ 526 */
527 struct fc_rport *(*rport_create)(struct fc_disc_port *);
494 528
495 /* 529 /*
496 * Initiates the RP state machine. It is called from the LP module. 530 * Initiates the RP state machine. It is called from the LP module.
@@ -500,26 +534,33 @@ struct libfc_function_template {
500 * - PLOGI 534 * - PLOGI
501 * - PRLI 535 * - PRLI
502 * - RTV 536 * - RTV
537 *
538 * STATUS: OPTIONAL
503 */ 539 */
504 int (*rport_login)(struct fc_rport *rport); 540 int (*rport_login)(struct fc_rport *rport);
505 541
506 /* 542 /*
507 * Logoff, and remove the rport from the transport if 543 * Logoff, and remove the rport from the transport if
508 * it had been added. This will send a LOGO to the target. 544 * it had been added. This will send a LOGO to the target.
545 *
546 * STATUS: OPTIONAL
509 */ 547 */
510 int (*rport_logoff)(struct fc_rport *rport); 548 int (*rport_logoff)(struct fc_rport *rport);
511 549
512 /* 550 /*
513 * Recieve a request from a remote port. 551 * Recieve a request from a remote port.
552 *
553 * STATUS: OPTIONAL
514 */ 554 */
515 void (*rport_recv_req)(struct fc_seq *, struct fc_frame *, 555 void (*rport_recv_req)(struct fc_seq *, struct fc_frame *,
516 struct fc_rport *); 556 struct fc_rport *);
517 557
518 struct fc_rport *(*rport_lookup)(const struct fc_lport *, u32); 558 /*
519 559 * lookup an rport by it's port ID.
520 /** 560 *
521 * FCP interfaces 561 * STATUS: OPTIONAL
522 */ 562 */
563 struct fc_rport *(*rport_lookup)(const struct fc_lport *, u32);
523 564
524 /* 565 /*
525 * Send a fcp cmd from fsp pkt. 566 * Send a fcp cmd from fsp pkt.
@@ -527,30 +568,38 @@ struct libfc_function_template {
527 * 568 *
528 * The resp handler is called when FCP_RSP received. 569 * The resp handler is called when FCP_RSP received.
529 * 570 *
571 * STATUS: OPTIONAL
530 */ 572 */
531 int (*fcp_cmd_send)(struct fc_lport *lp, struct fc_fcp_pkt *fsp, 573 int (*fcp_cmd_send)(struct fc_lport *lp, struct fc_fcp_pkt *fsp,
532 void (*resp)(struct fc_seq *, struct fc_frame *fp, 574 void (*resp)(struct fc_seq *, struct fc_frame *fp,
533 void *arg)); 575 void *arg));
534 576
535 /* 577 /*
536 * Used at least durring linkdown and reset 578 * Cleanup the FCP layer, used durring link down and reset
579 *
580 * STATUS: OPTIONAL
537 */ 581 */
538 void (*fcp_cleanup)(struct fc_lport *lp); 582 void (*fcp_cleanup)(struct fc_lport *lp);
539 583
540 /* 584 /*
541 * Abort all I/O on a local port 585 * Abort all I/O on a local port
586 *
587 * STATUS: OPTIONAL
542 */ 588 */
543 void (*fcp_abort_io)(struct fc_lport *lp); 589 void (*fcp_abort_io)(struct fc_lport *lp);
544 590
545 /** 591 /*
546 * Discovery interfaces 592 * Receive a request for the discovery layer.
593 *
594 * STATUS: OPTIONAL
547 */ 595 */
548
549 void (*disc_recv_req)(struct fc_seq *, 596 void (*disc_recv_req)(struct fc_seq *,
550 struct fc_frame *, struct fc_lport *); 597 struct fc_frame *, struct fc_lport *);
551 598
552 /* 599 /*
553 * Start discovery for a local port. 600 * Start discovery for a local port.
601 *
602 * STATUS: OPTIONAL
554 */ 603 */
555 void (*disc_start)(void (*disc_callback)(struct fc_lport *, 604 void (*disc_start)(void (*disc_callback)(struct fc_lport *,
556 enum fc_disc_event), 605 enum fc_disc_event),
@@ -559,6 +608,8 @@ struct libfc_function_template {
559 /* 608 /*
560 * Stop discovery for a given lport. This will remove 609 * Stop discovery for a given lport. This will remove
561 * all discovered rports 610 * all discovered rports
611 *
612 * STATUS: OPTIONAL
562 */ 613 */
563 void (*disc_stop) (struct fc_lport *); 614 void (*disc_stop) (struct fc_lport *);
564 615
@@ -566,6 +617,8 @@ struct libfc_function_template {
566 * Stop discovery for a given lport. This will block 617 * Stop discovery for a given lport. This will block
567 * until all discovered rports are deleted from the 618 * until all discovered rports are deleted from the
568 * FC transport class 619 * FC transport class
620 *
621 * STATUS: OPTIONAL
569 */ 622 */
570 void (*disc_stop_final) (struct fc_lport *); 623 void (*disc_stop_final) (struct fc_lport *);
571}; 624};
@@ -584,6 +637,7 @@ struct fc_disc {
584 enum fc_disc_event); 637 enum fc_disc_event);
585 638
586 struct list_head rports; 639 struct list_head rports;
640 struct list_head rogue_rports;
587 struct fc_lport *lport; 641 struct fc_lport *lport;
588 struct mutex disc_mutex; 642 struct mutex disc_mutex;
589 struct fc_gpn_ft_resp partial_buf; /* partial name buffer */ 643 struct fc_gpn_ft_resp partial_buf; /* partial name buffer */
@@ -603,12 +657,14 @@ struct fc_lport {
603 657
604 /* Operational Information */ 658 /* Operational Information */
605 struct libfc_function_template tt; 659 struct libfc_function_template tt;
606 u16 link_status; 660 u8 link_up;
661 u8 qfull;
607 enum fc_lport_state state; 662 enum fc_lport_state state;
608 unsigned long boot_time; 663 unsigned long boot_time;
609 664
610 struct fc_host_statistics host_stats; 665 struct fc_host_statistics host_stats;
611 struct fcoe_dev_stats *dev_stats[NR_CPUS]; 666 struct fcoe_dev_stats *dev_stats;
667
612 u64 wwpn; 668 u64 wwpn;
613 u64 wwnn; 669 u64 wwnn;
614 u8 retry_count; 670 u8 retry_count;
@@ -626,6 +682,7 @@ struct fc_lport {
626 u16 link_speed; 682 u16 link_speed;
627 u16 link_supported_speeds; 683 u16 link_supported_speeds;
628 u16 lro_xid; /* max xid for fcoe lro */ 684 u16 lro_xid; /* max xid for fcoe lro */
685 unsigned int lso_max; /* max large send size */
629 struct fc_ns_fts fcts; /* FC-4 type masks */ 686 struct fc_ns_fts fcts; /* FC-4 type masks */
630 struct fc_els_rnid_gen rnid_gen; /* RNID information */ 687 struct fc_els_rnid_gen rnid_gen; /* RNID information */
631 688
@@ -637,14 +694,9 @@ struct fc_lport {
637 struct delayed_work disc_work; 694 struct delayed_work disc_work;
638}; 695};
639 696
640/** 697/*
641 * FC_LPORT HELPER FUNCTIONS 698 * FC_LPORT HELPER FUNCTIONS
642 *****************************/ 699 *****************************/
643static inline void *lport_priv(const struct fc_lport *lp)
644{
645 return (void *)(lp + 1);
646}
647
648static inline int fc_lport_test_ready(struct fc_lport *lp) 700static inline int fc_lport_test_ready(struct fc_lport *lp)
649{ 701{
650 return lp->state == LPORT_ST_READY; 702 return lp->state == LPORT_ST_READY;
@@ -668,8 +720,44 @@ static inline void fc_lport_state_enter(struct fc_lport *lp,
668 lp->state = state; 720 lp->state = state;
669} 721}
670 722
723static inline int fc_lport_init_stats(struct fc_lport *lp)
724{
725 /* allocate per cpu stats block */
726 lp->dev_stats = alloc_percpu(struct fcoe_dev_stats);
727 if (!lp->dev_stats)
728 return -ENOMEM;
729 return 0;
730}
731
732static inline void fc_lport_free_stats(struct fc_lport *lp)
733{
734 free_percpu(lp->dev_stats);
735}
736
737static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp)
738{
739 return per_cpu_ptr(lp->dev_stats, smp_processor_id());
740}
741
742static inline void *lport_priv(const struct fc_lport *lp)
743{
744 return (void *)(lp + 1);
745}
671 746
672/** 747/**
748 * libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport
749 * @sht: ptr to the scsi host templ
750 * @priv_size: size of private data after fc_lport
751 *
752 * Returns: ptr to Scsi_Host
753 */
754static inline struct Scsi_Host *
755libfc_host_alloc(struct scsi_host_template *sht, int priv_size)
756{
757 return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size);
758}
759
760/*
673 * LOCAL PORT LAYER 761 * LOCAL PORT LAYER
674 *****************************/ 762 *****************************/
675int fc_lport_init(struct fc_lport *lp); 763int fc_lport_init(struct fc_lport *lp);
@@ -704,12 +792,6 @@ void fc_linkup(struct fc_lport *);
704void fc_linkdown(struct fc_lport *); 792void fc_linkdown(struct fc_lport *);
705 793
706/* 794/*
707 * Pause and unpause traffic.
708 */
709void fc_pause(struct fc_lport *);
710void fc_unpause(struct fc_lport *);
711
712/*
713 * Configure the local port. 795 * Configure the local port.
714 */ 796 */
715int fc_lport_config(struct fc_lport *); 797int fc_lport_config(struct fc_lport *);
@@ -725,19 +807,19 @@ int fc_lport_reset(struct fc_lport *);
725int fc_set_mfs(struct fc_lport *lp, u32 mfs); 807int fc_set_mfs(struct fc_lport *lp, u32 mfs);
726 808
727 809
728/** 810/*
729 * REMOTE PORT LAYER 811 * REMOTE PORT LAYER
730 *****************************/ 812 *****************************/
731int fc_rport_init(struct fc_lport *lp); 813int fc_rport_init(struct fc_lport *lp);
732void fc_rport_terminate_io(struct fc_rport *rp); 814void fc_rport_terminate_io(struct fc_rport *rp);
733 815
734/** 816/*
735 * DISCOVERY LAYER 817 * DISCOVERY LAYER
736 *****************************/ 818 *****************************/
737int fc_disc_init(struct fc_lport *lp); 819int fc_disc_init(struct fc_lport *lp);
738 820
739 821
740/** 822/*
741 * SCSI LAYER 823 * SCSI LAYER
742 *****************************/ 824 *****************************/
743/* 825/*
@@ -798,7 +880,12 @@ int fc_change_queue_type(struct scsi_device *sdev, int tag_type);
798 */ 880 */
799void fc_fcp_destroy(struct fc_lport *); 881void fc_fcp_destroy(struct fc_lport *);
800 882
801/** 883/*
884 * Set up direct-data placement for this I/O request
885 */
886void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid);
887
888/*
802 * ELS/CT interface 889 * ELS/CT interface
803 *****************************/ 890 *****************************/
804/* 891/*
@@ -807,7 +894,7 @@ void fc_fcp_destroy(struct fc_lport *);
807int fc_elsct_init(struct fc_lport *lp); 894int fc_elsct_init(struct fc_lport *lp);
808 895
809 896
810/** 897/*
811 * EXCHANGE MANAGER LAYER 898 * EXCHANGE MANAGER LAYER
812 *****************************/ 899 *****************************/
813/* 900/*
@@ -916,7 +1003,7 @@ struct fc_seq *fc_seq_start_next(struct fc_seq *sp);
916 * If s_id is non-zero, reset only exchanges originating from that FID. 1003 * If s_id is non-zero, reset only exchanges originating from that FID.
917 * If d_id is non-zero, reset only exchanges sending to that FID. 1004 * If d_id is non-zero, reset only exchanges sending to that FID.
918 */ 1005 */
919void fc_exch_mgr_reset(struct fc_exch_mgr *, u32 s_id, u32 d_id); 1006void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id);
920 1007
921/* 1008/*
922 * Functions for fc_functions_template 1009 * Functions for fc_functions_template
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 89fdbb9a6a1b..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,157 +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 94 unsigned long sel_time;
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;
50 u8 dest_addr[ETH_ALEN]; 107 u8 dest_addr[ETH_ALEN];
51 u8 ctl_src_addr[ETH_ALEN]; 108 u8 ctl_src_addr[ETH_ALEN];
52 u8 data_src_addr[ETH_ALEN]; 109 u8 data_src_addr[ETH_ALEN];
53 /*
54 * fcoe protocol address learning related stuff
55 */
56 u16 flogi_oxid;
57 u8 flogi_progress;
58 u8 address_mode;
59};
60
61static inline struct fcoe_softc *fcoe_softc(
62 const struct fc_lport *lp)
63{
64 return (struct fcoe_softc *)lport_priv(lp);
65}
66
67static inline struct net_device *fcoe_netdev(
68 const struct fc_lport *lp)
69{
70 return fcoe_softc(lp)->real_dev;
71}
72
73static inline struct fcoe_hdr *skb_fcoe_header(const struct sk_buff *skb)
74{
75 return (struct fcoe_hdr *)skb_network_header(skb);
76}
77
78static inline int skb_fcoe_offset(const struct sk_buff *skb)
79{
80 return skb_network_offset(skb);
81}
82
83static inline struct fc_frame_header *skb_fc_header(const struct sk_buff *skb)
84{
85 return (struct fc_frame_header *)skb_transport_header(skb);
86}
87
88static inline int skb_fc_offset(const struct sk_buff *skb)
89{
90 return skb_transport_offset(skb);
91}
92
93static inline void skb_reset_fc_header(struct sk_buff *skb)
94{
95 skb_reset_network_header(skb);
96 skb_set_transport_header(skb, skb_network_offset(skb) +
97 sizeof(struct fcoe_hdr));
98}
99 110
100static inline bool skb_fc_is_data(const struct sk_buff *skb) 111 void (*send)(struct fcoe_ctlr *, struct sk_buff *);
101{ 112 void (*update_mac)(struct fcoe_ctlr *, u8 *old, u8 *new);
102 return skb_fc_header(skb)->fh_r_ctl == FC_RCTL_DD_SOL_DATA; 113 spinlock_t lock;
103} 114};
104
105static inline bool skb_fc_is_cmd(const struct sk_buff *skb)
106{
107 return skb_fc_header(skb)->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD;
108}
109
110static inline bool skb_fc_has_exthdr(const struct sk_buff *skb)
111{
112 return (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_VFTH) ||
113 (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_IFRH) ||
114 (skb_fc_header(skb)->fh_r_ctl == FC_RCTL_ENCH);
115}
116
117static inline bool skb_fc_is_roff(const struct sk_buff *skb)
118{
119 return skb_fc_header(skb)->fh_f_ctl[2] & FC_FC_REL_OFF;
120}
121 115
122static inline u16 skb_fc_oxid(const struct sk_buff *skb) 116/*
123{ 117 * struct fcoe_fcf - Fibre-Channel Forwarder.
124 return be16_to_cpu(skb_fc_header(skb)->fh_ox_id); 118 * @list: list linkage.
125} 119 * @time: system time (jiffies) when an advertisement was last received.
120 * @switch_name: WWN of switch from advertisement.
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;
126 139
127static inline u16 skb_fc_rxid(const struct sk_buff *skb) 140 u64 switch_name;
128{ 141 u64 fabric_name;
129 return be16_to_cpu(skb_fc_header(skb)->fh_rx_id); 142 u32 fc_map;
130} 143 u16 vfid;
144 u8 fcf_mac[ETH_ALEN];
131 145
132/* FIXME - DMA_BIDIRECTIONAL ? */ 146 u8 pri;
133#define skb_cb(skb) ((struct fcoe_rcv_info *)&((skb)->cb[0])) 147 u16 flags;
134#define skb_cmd(skb) (skb_cb(skb)->fr_cmd) 148 u32 fka_period;
135#define skb_dir(skb) (skb_cmd(skb)->sc_data_direction) 149};
136static inline bool skb_fc_is_read(const struct sk_buff *skb)
137{
138 if (skb_fc_is_cmd(skb) && skb_cmd(skb))
139 return skb_dir(skb) == DMA_FROM_DEVICE;
140 return false;
141}
142 150
143static inline bool skb_fc_is_write(const struct sk_buff *skb) 151/* FIP API functions */
144{ 152void fcoe_ctlr_init(struct fcoe_ctlr *);
145 if (skb_fc_is_cmd(skb) && skb_cmd(skb)) 153void fcoe_ctlr_destroy(struct fcoe_ctlr *);
146 return skb_dir(skb) == DMA_TO_DEVICE; 154void fcoe_ctlr_link_up(struct fcoe_ctlr *);
147 return false; 155int fcoe_ctlr_link_down(struct fcoe_ctlr *);
148} 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);
149 159
150/* libfcoe funcs */ 160/* libfcoe funcs */
151int fcoe_reset(struct Scsi_Host *shost); 161u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
152u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN],
153 unsigned int scheme, unsigned int port);
154
155u32 fcoe_fc_crc(struct fc_frame *fp);
156int fcoe_xmit(struct fc_lport *, struct fc_frame *);
157int fcoe_rcv(struct sk_buff *, struct net_device *,
158 struct packet_type *, struct net_device *);
159
160int fcoe_percpu_receive_thread(void *arg);
161void fcoe_clean_pending_queue(struct fc_lport *lp);
162void fcoe_percpu_clean(struct fc_lport *lp);
163void fcoe_watchdog(ulong vp);
164int fcoe_link_ok(struct fc_lport *lp);
165
166struct fc_lport *fcoe_hostlist_lookup(const struct net_device *);
167int fcoe_hostlist_add(const struct fc_lport *);
168int fcoe_hostlist_remove(const struct fc_lport *);
169
170struct Scsi_Host *fcoe_host_alloc(struct scsi_host_template *, int);
171int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *); 162int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *);
172 163
173/* fcoe sw hba */
174int __init fcoe_sw_init(void);
175int __exit fcoe_sw_exit(void);
176#endif /* _LIBFCOE_H */ 164#endif /* _LIBFCOE_H */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 7360e1916e75..0289f5745fb9 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -36,6 +36,7 @@ struct scsi_transport_template;
36struct scsi_host_template; 36struct scsi_host_template;
37struct scsi_device; 37struct scsi_device;
38struct Scsi_Host; 38struct Scsi_Host;
39struct scsi_target;
39struct scsi_cmnd; 40struct scsi_cmnd;
40struct socket; 41struct socket;
41struct iscsi_transport; 42struct iscsi_transport;
@@ -45,18 +46,10 @@ struct iscsi_session;
45struct iscsi_nopin; 46struct iscsi_nopin;
46struct device; 47struct device;
47 48
48/* #define DEBUG_SCSI */
49#ifdef DEBUG_SCSI
50#define debug_scsi(fmt...) printk(KERN_INFO "iscsi: " fmt)
51#else
52#define debug_scsi(fmt...)
53#endif
54
55#define ISCSI_DEF_XMIT_CMDS_MAX 128 /* must be power of 2 */ 49#define ISCSI_DEF_XMIT_CMDS_MAX 128 /* must be power of 2 */
56#define ISCSI_MGMT_CMDS_MAX 15 50#define ISCSI_MGMT_CMDS_MAX 15
57 51
58#define ISCSI_DEF_CMD_PER_LUN 32 52#define ISCSI_DEF_CMD_PER_LUN 32
59#define ISCSI_MAX_CMD_PER_LUN 128
60 53
61/* Task Mgmt states */ 54/* Task Mgmt states */
62enum { 55enum {
@@ -326,6 +319,9 @@ struct iscsi_host {
326 spinlock_t lock; 319 spinlock_t lock;
327 int num_sessions; 320 int num_sessions;
328 int state; 321 int state;
322
323 struct workqueue_struct *workq;
324 char workq_name[20];
329}; 325};
330 326
331/* 327/*
@@ -351,9 +347,11 @@ extern int iscsi_host_get_param(struct Scsi_Host *shost,
351 enum iscsi_host_param param, char *buf); 347 enum iscsi_host_param param, char *buf);
352extern int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev); 348extern int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev);
353extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, 349extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
354 int dd_data_size, uint16_t qdepth); 350 int dd_data_size,
351 bool xmit_can_sleep);
355extern void iscsi_host_remove(struct Scsi_Host *shost); 352extern void iscsi_host_remove(struct Scsi_Host *shost);
356extern void iscsi_host_free(struct Scsi_Host *shost); 353extern void iscsi_host_free(struct Scsi_Host *shost);
354extern int iscsi_target_alloc(struct scsi_target *starget);
357 355
358/* 356/*
359 * session management 357 * session management
@@ -382,11 +380,12 @@ extern void iscsi_conn_stop(struct iscsi_cls_conn *, int);
382extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, 380extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *,
383 int); 381 int);
384extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); 382extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
385extern void iscsi_session_failure(struct iscsi_cls_session *cls_session, 383extern void iscsi_session_failure(struct iscsi_session *session,
386 enum iscsi_err err); 384 enum iscsi_err err);
387extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, 385extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
388 enum iscsi_param param, char *buf); 386 enum iscsi_param param, char *buf);
389extern void iscsi_suspend_tx(struct iscsi_conn *conn); 387extern void iscsi_suspend_tx(struct iscsi_conn *conn);
388extern void iscsi_conn_queue_work(struct iscsi_conn *conn);
390 389
391#define iscsi_conn_printk(prefix, _c, fmt, a...) \ 390#define iscsi_conn_printk(prefix, _c, fmt, a...) \
392 iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ 391 iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \
diff --git a/include/scsi/osd_attributes.h b/include/scsi/osd_attributes.h
new file mode 100644
index 000000000000..f888a6fda073
--- /dev/null
+++ b/include/scsi/osd_attributes.h
@@ -0,0 +1,327 @@
1#ifndef __OSD_ATTRIBUTES_H__
2#define __OSD_ATTRIBUTES_H__
3
4#include "osd_protocol.h"
5
6/*
7 * Contains types and constants that define attribute pages and attribute
8 * numbers and their data types.
9 */
10
11#define ATTR_SET(pg, id, l, ptr) \
12 { .attr_page = pg, .attr_id = id, .len = l, .val_ptr = ptr }
13
14#define ATTR_DEF(pg, id, l) ATTR_SET(pg, id, l, NULL)
15
16/* osd-r10 4.7.3 Attributes pages */
17enum {
18 OSD_APAGE_OBJECT_FIRST = 0x0,
19 OSD_APAGE_OBJECT_DIRECTORY = 0,
20 OSD_APAGE_OBJECT_INFORMATION = 1,
21 OSD_APAGE_OBJECT_QUOTAS = 2,
22 OSD_APAGE_OBJECT_TIMESTAMP = 3,
23 OSD_APAGE_OBJECT_COLLECTIONS = 4,
24 OSD_APAGE_OBJECT_SECURITY = 5,
25 OSD_APAGE_OBJECT_LAST = 0x2fffffff,
26
27 OSD_APAGE_PARTITION_FIRST = 0x30000000,
28 OSD_APAGE_PARTITION_DIRECTORY = OSD_APAGE_PARTITION_FIRST + 0,
29 OSD_APAGE_PARTITION_INFORMATION = OSD_APAGE_PARTITION_FIRST + 1,
30 OSD_APAGE_PARTITION_QUOTAS = OSD_APAGE_PARTITION_FIRST + 2,
31 OSD_APAGE_PARTITION_TIMESTAMP = OSD_APAGE_PARTITION_FIRST + 3,
32 OSD_APAGE_PARTITION_SECURITY = OSD_APAGE_PARTITION_FIRST + 5,
33 OSD_APAGE_PARTITION_LAST = 0x5FFFFFFF,
34
35 OSD_APAGE_COLLECTION_FIRST = 0x60000000,
36 OSD_APAGE_COLLECTION_DIRECTORY = OSD_APAGE_COLLECTION_FIRST + 0,
37 OSD_APAGE_COLLECTION_INFORMATION = OSD_APAGE_COLLECTION_FIRST + 1,
38 OSD_APAGE_COLLECTION_TIMESTAMP = OSD_APAGE_COLLECTION_FIRST + 3,
39 OSD_APAGE_COLLECTION_SECURITY = OSD_APAGE_COLLECTION_FIRST + 5,
40 OSD_APAGE_COLLECTION_LAST = 0x8FFFFFFF,
41
42 OSD_APAGE_ROOT_FIRST = 0x90000000,
43 OSD_APAGE_ROOT_DIRECTORY = OSD_APAGE_ROOT_FIRST + 0,
44 OSD_APAGE_ROOT_INFORMATION = OSD_APAGE_ROOT_FIRST + 1,
45 OSD_APAGE_ROOT_QUOTAS = OSD_APAGE_ROOT_FIRST + 2,
46 OSD_APAGE_ROOT_TIMESTAMP = OSD_APAGE_ROOT_FIRST + 3,
47 OSD_APAGE_ROOT_SECURITY = OSD_APAGE_ROOT_FIRST + 5,
48 OSD_APAGE_ROOT_LAST = 0xBFFFFFFF,
49
50 OSD_APAGE_RESERVED_TYPE_FIRST = 0xC0000000,
51 OSD_APAGE_RESERVED_TYPE_LAST = 0xEFFFFFFF,
52
53 OSD_APAGE_COMMON_FIRST = 0xF0000000,
54 OSD_APAGE_COMMON_LAST = 0xFFFFFFFE,
55
56 OSD_APAGE_REQUEST_ALL = 0xFFFFFFFF,
57};
58
59/* subcategories of attr pages within each range above */
60enum {
61 OSD_APAGE_STD_FIRST = 0x0,
62 OSD_APAGE_STD_DIRECTORY = 0,
63 OSD_APAGE_STD_INFORMATION = 1,
64 OSD_APAGE_STD_QUOTAS = 2,
65 OSD_APAGE_STD_TIMESTAMP = 3,
66 OSD_APAGE_STD_COLLECTIONS = 4,
67 OSD_APAGE_STD_POLICY_SECURITY = 5,
68 OSD_APAGE_STD_LAST = 0x0000007F,
69
70 OSD_APAGE_RESERVED_FIRST = 0x00000080,
71 OSD_APAGE_RESERVED_LAST = 0x00007FFF,
72
73 OSD_APAGE_OTHER_STD_FIRST = 0x00008000,
74 OSD_APAGE_OTHER_STD_LAST = 0x0000EFFF,
75
76 OSD_APAGE_PUBLIC_FIRST = 0x0000F000,
77 OSD_APAGE_PUBLIC_LAST = 0x0000FFFF,
78
79 OSD_APAGE_APP_DEFINED_FIRST = 0x00010000,
80 OSD_APAGE_APP_DEFINED_LAST = 0x1FFFFFFF,
81
82 OSD_APAGE_VENDOR_SPECIFIC_FIRST = 0x20000000,
83 OSD_APAGE_VENDOR_SPECIFIC_LAST = 0x2FFFFFFF,
84};
85
86enum {
87 OSD_ATTR_PAGE_IDENTIFICATION = 0, /* in all pages 40 bytes */
88};
89
90struct page_identification {
91 u8 vendor_identification[8];
92 u8 page_identification[32];
93} __packed;
94
95struct osd_attr_page_header {
96 __be32 page_number;
97 __be32 page_length;
98} __packed;
99
100/* 7.1.2.8 Root Information attributes page (OSD_APAGE_ROOT_INFORMATION) */
101enum {
102 OSD_ATTR_RI_OSD_SYSTEM_ID = 0x3, /* 20 */
103 OSD_ATTR_RI_VENDOR_IDENTIFICATION = 0x4, /* 8 */
104 OSD_ATTR_RI_PRODUCT_IDENTIFICATION = 0x5, /* 16 */
105 OSD_ATTR_RI_PRODUCT_MODEL = 0x6, /* 32 */
106 OSD_ATTR_RI_PRODUCT_REVISION_LEVEL = 0x7, /* 4 */
107 OSD_ATTR_RI_PRODUCT_SERIAL_NUMBER = 0x8, /* variable */
108 OSD_ATTR_RI_OSD_NAME = 0x9, /* variable */
109 OSD_ATTR_RI_TOTAL_CAPACITY = 0x80, /* 8 */
110 OSD_ATTR_RI_USED_CAPACITY = 0x81, /* 8 */
111 OSD_ATTR_RI_NUMBER_OF_PARTITIONS = 0xC0, /* 8 */
112 OSD_ATTR_RI_CLOCK = 0x100, /* 6 */
113};
114/* Root_Information_attributes_page does not have a get_page structure */
115
116/* 7.1.2.9 Partition Information attributes page
117 * (OSD_APAGE_PARTITION_INFORMATION)
118 */
119enum {
120 OSD_ATTR_PI_PARTITION_ID = 0x1, /* 8 */
121 OSD_ATTR_PI_USERNAME = 0x9, /* variable */
122 OSD_ATTR_PI_USED_CAPACITY = 0x81, /* 8 */
123 OSD_ATTR_PI_NUMBER_OF_OBJECTS = 0xC1, /* 8 */
124};
125/* Partition Information attributes page does not have a get_page structure */
126
127/* 7.1.2.10 Collection Information attributes page
128 * (OSD_APAGE_COLLECTION_INFORMATION)
129 */
130enum {
131 OSD_ATTR_CI_PARTITION_ID = 0x1, /* 8 */
132 OSD_ATTR_CI_COLLECTION_OBJECT_ID = 0x2, /* 8 */
133 OSD_ATTR_CI_USERNAME = 0x9, /* variable */
134 OSD_ATTR_CI_USED_CAPACITY = 0x81, /* 8 */
135};
136/* Collection Information attributes page does not have a get_page structure */
137
138/* 7.1.2.11 User Object Information attributes page
139 * (OSD_APAGE_OBJECT_INFORMATION)
140 */
141enum {
142 OSD_ATTR_OI_PARTITION_ID = 0x1, /* 8 */
143 OSD_ATTR_OI_OBJECT_ID = 0x2, /* 8 */
144 OSD_ATTR_OI_USERNAME = 0x9, /* variable */
145 OSD_ATTR_OI_USED_CAPACITY = 0x81, /* 8 */
146 OSD_ATTR_OI_LOGICAL_LENGTH = 0x82, /* 8 */
147};
148/* Object Information attributes page does not have a get_page structure */
149
150/* 7.1.2.12 Root Quotas attributes page (OSD_APAGE_ROOT_QUOTAS) */
151enum {
152 OSD_ATTR_RQ_DEFAULT_MAXIMUM_USER_OBJECT_LENGTH = 0x1, /* 8 */
153 OSD_ATTR_RQ_PARTITION_CAPACITY_QUOTA = 0x10001, /* 8 */
154 OSD_ATTR_RQ_PARTITION_OBJECT_COUNT = 0x10002, /* 8 */
155 OSD_ATTR_RQ_PARTITION_COLLECTIONS_PER_USER_OBJECT = 0x10081, /* 4 */
156 OSD_ATTR_RQ_PARTITION_COUNT = 0x20002, /* 8 */
157};
158
159struct Root_Quotas_attributes_page {
160 struct osd_attr_page_header hdr; /* id=R+2, size=0x24 */
161 __be64 default_maximum_user_object_length;
162 __be64 partition_capacity_quota;
163 __be64 partition_object_count;
164 __be64 partition_collections_per_user_object;
165 __be64 partition_count;
166} __packed;
167
168/* 7.1.2.13 Partition Quotas attributes page (OSD_APAGE_PARTITION_QUOTAS)*/
169enum {
170 OSD_ATTR_PQ_DEFAULT_MAXIMUM_USER_OBJECT_LENGTH = 0x1, /* 8 */
171 OSD_ATTR_PQ_CAPACITY_QUOTA = 0x10001, /* 8 */
172 OSD_ATTR_PQ_OBJECT_COUNT = 0x10002, /* 8 */
173 OSD_ATTR_PQ_COLLECTIONS_PER_USER_OBJECT = 0x10081, /* 4 */
174};
175
176struct Partition_Quotas_attributes_page {
177 struct osd_attr_page_header hdr; /* id=P+2, size=0x1C */
178 __be64 default_maximum_user_object_length;
179 __be64 capacity_quota;
180 __be64 object_count;
181 __be64 collections_per_user_object;
182} __packed;
183
184/* 7.1.2.14 User Object Quotas attributes page (OSD_APAGE_OBJECT_QUOTAS) */
185enum {
186 OSD_ATTR_OQ_MAXIMUM_LENGTH = 0x1, /* 8 */
187};
188
189struct Object_Quotas_attributes_page {
190 struct osd_attr_page_header hdr; /* id=U+2, size=0x8 */
191 __be64 maximum_length;
192} __packed;
193
194/* 7.1.2.15 Root Timestamps attributes page (OSD_APAGE_ROOT_TIMESTAMP) */
195enum {
196 OSD_ATTR_RT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
197 OSD_ATTR_RT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
198 OSD_ATTR_RT_TIMESTAMP_BYPASS = 0xFFFFFFFE, /* 1 */
199};
200
201struct root_timestamps_attributes_page {
202 struct osd_attr_page_header hdr; /* id=R+3, size=0xD */
203 struct osd_timestamp attributes_accessed_time;
204 struct osd_timestamp attributes_modified_time;
205 u8 timestamp_bypass;
206} __packed;
207
208/* 7.1.2.16 Partition Timestamps attributes page
209 * (OSD_APAGE_PARTITION_TIMESTAMP)
210 */
211enum {
212 OSD_ATTR_PT_CREATED_TIME = 0x1, /* 6 */
213 OSD_ATTR_PT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
214 OSD_ATTR_PT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
215 OSD_ATTR_PT_DATA_ACCESSED_TIME = 0x4, /* 6 */
216 OSD_ATTR_PT_DATA_MODIFIED_TIME = 0x5, /* 6 */
217 OSD_ATTR_PT_TIMESTAMP_BYPASS = 0xFFFFFFFE, /* 1 */
218};
219
220struct partition_timestamps_attributes_page {
221 struct osd_attr_page_header hdr; /* id=P+3, size=0x1F */
222 struct osd_timestamp created_time;
223 struct osd_timestamp attributes_accessed_time;
224 struct osd_timestamp attributes_modified_time;
225 struct osd_timestamp data_accessed_time;
226 struct osd_timestamp data_modified_time;
227 u8 timestamp_bypass;
228} __packed;
229
230/* 7.1.2.17/18 Collection/Object Timestamps attributes page
231 * (OSD_APAGE_COLLECTION_TIMESTAMP/OSD_APAGE_OBJECT_TIMESTAMP)
232 */
233enum {
234 OSD_ATTR_OT_CREATED_TIME = 0x1, /* 6 */
235 OSD_ATTR_OT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
236 OSD_ATTR_OT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
237 OSD_ATTR_OT_DATA_ACCESSED_TIME = 0x4, /* 6 */
238 OSD_ATTR_OT_DATA_MODIFIED_TIME = 0x5, /* 6 */
239};
240
241/* same for collection */
242struct object_timestamps_attributes_page {
243 struct osd_attr_page_header hdr; /* id=C+3/3, size=0x1E */
244 struct osd_timestamp created_time;
245 struct osd_timestamp attributes_accessed_time;
246 struct osd_timestamp attributes_modified_time;
247 struct osd_timestamp data_accessed_time;
248 struct osd_timestamp data_modified_time;
249} __packed;
250
251/* 7.1.2.19 Collections attributes page */
252/* TBD */
253
254/* 7.1.2.20 Root Policy/Security attributes page (OSD_APAGE_ROOT_SECURITY) */
255enum {
256 OSD_ATTR_RS_DEFAULT_SECURITY_METHOD = 0x1, /* 1 */
257 OSD_ATTR_RS_OLDEST_VALID_NONCE_LIMIT = 0x2, /* 6 */
258 OSD_ATTR_RS_NEWEST_VALID_NONCE_LIMIT = 0x3, /* 6 */
259 OSD_ATTR_RS_PARTITION_DEFAULT_SECURITY_METHOD = 0x6, /* 1 */
260 OSD_ATTR_RS_SUPPORTED_SECURITY_METHODS = 0x7, /* 2 */
261 OSD_ATTR_RS_ADJUSTABLE_CLOCK = 0x9, /* 6 */
262 OSD_ATTR_RS_MASTER_KEY_IDENTIFIER = 0x7FFD, /* 0 or 7 */
263 OSD_ATTR_RS_ROOT_KEY_IDENTIFIER = 0x7FFE, /* 0 or 7 */
264 OSD_ATTR_RS_SUPPORTED_INTEGRITY_ALGORITHM_0 = 0x80000000,/* 1,(x16)*/
265 OSD_ATTR_RS_SUPPORTED_DH_GROUP_0 = 0x80000010,/* 1,(x16)*/
266};
267
268struct root_security_attributes_page {
269 struct osd_attr_page_header hdr; /* id=R+5, size=0x3F */
270 u8 default_security_method;
271 u8 partition_default_security_method;
272 __be16 supported_security_methods;
273 u8 mki_valid_rki_valid;
274 struct osd_timestamp oldest_valid_nonce_limit;
275 struct osd_timestamp newest_valid_nonce_limit;
276 struct osd_timestamp adjustable_clock;
277 u8 master_key_identifier[32-25];
278 u8 root_key_identifier[39-32];
279 u8 supported_integrity_algorithm[16];
280 u8 supported_dh_group[16];
281} __packed;
282
283/* 7.1.2.21 Partition Policy/Security attributes page
284 * (OSD_APAGE_PARTITION_SECURITY)
285 */
286enum {
287 OSD_ATTR_PS_DEFAULT_SECURITY_METHOD = 0x1, /* 1 */
288 OSD_ATTR_PS_OLDEST_VALID_NONCE = 0x2, /* 6 */
289 OSD_ATTR_PS_NEWEST_VALID_NONCE = 0x3, /* 6 */
290 OSD_ATTR_PS_REQUEST_NONCE_LIST_DEPTH = 0x4, /* 2 */
291 OSD_ATTR_PS_FROZEN_WORKING_KEY_BIT_MASK = 0x5, /* 2 */
292 OSD_ATTR_PS_PARTITION_KEY_IDENTIFIER = 0x7FFF, /* 0 or 7 */
293 OSD_ATTR_PS_WORKING_KEY_IDENTIFIER_FIRST = 0x8000, /* 0 or 7 */
294 OSD_ATTR_PS_WORKING_KEY_IDENTIFIER_LAST = 0x800F, /* 0 or 7 */
295 OSD_ATTR_PS_POLICY_ACCESS_TAG = 0x40000001, /* 4 */
296 OSD_ATTR_PS_USER_OBJECT_POLICY_ACCESS_TAG = 0x40000002, /* 4 */
297};
298
299struct partition_security_attributes_page {
300 struct osd_attr_page_header hdr; /* id=p+5, size=0x8f */
301 u8 reserved[3];
302 u8 default_security_method;
303 struct osd_timestamp oldest_valid_nonce;
304 struct osd_timestamp newest_valid_nonce;
305 __be16 request_nonce_list_depth;
306 __be16 frozen_working_key_bit_mask;
307 __be32 policy_access_tag;
308 __be32 user_object_policy_access_tag;
309 u8 pki_valid;
310 __be16 wki_00_0f_vld;
311 struct osd_key_identifier partition_key_identifier;
312 struct osd_key_identifier working_key_identifiers[16];
313} __packed;
314
315/* 7.1.2.22/23 Collection/Object Policy-Security attributes page
316 * (OSD_APAGE_COLLECTION_SECURITY/OSD_APAGE_OBJECT_SECURITY)
317 */
318enum {
319 OSD_ATTR_OS_POLICY_ACCESS_TAG = 0x40000001, /* 4 */
320};
321
322struct object_security_attributes_page {
323 struct osd_attr_page_header hdr; /* id=C+5/5, size=4 */
324 __be32 policy_access_tag;
325} __packed;
326
327#endif /*ndef __OSD_ATTRIBUTES_H__*/
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
new file mode 100644
index 000000000000..b24d9616eb46
--- /dev/null
+++ b/include/scsi/osd_initiator.h
@@ -0,0 +1,433 @@
1/*
2 * osd_initiator.h - OSD initiator API definition
3 *
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 *
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.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
12 *
13 */
14#ifndef __OSD_INITIATOR_H__
15#define __OSD_INITIATOR_H__
16
17#include "osd_protocol.h"
18#include "osd_types.h"
19
20#include <linux/blkdev.h>
21
22/* Note: "NI" in comments below means "Not Implemented yet" */
23
24/* Configure of code:
25 * #undef if you *don't* want OSD v1 support in runtime.
26 * If #defined the initiator will dynamically configure to encode OSD v1
27 * CDB's if the target is detected to be OSD v1 only.
28 * OSD v2 only commands, options, and attributes will be ignored if target
29 * is v1 only.
30 * If #defined will result in bigger/slower code (OK Slower maybe not)
31 * Q: Should this be CONFIG_SCSI_OSD_VER1_SUPPORT and set from Kconfig?
32 */
33#define OSD_VER1_SUPPORT y
34
35enum osd_std_version {
36 OSD_VER_NONE = 0,
37 OSD_VER1 = 1,
38 OSD_VER2 = 2,
39};
40
41/*
42 * Object-based Storage Device.
43 * This object represents an OSD device.
44 * It is not a full linux device in any way. It is only
45 * a place to hang resources associated with a Linux
46 * request Q and some default properties.
47 */
48struct osd_dev {
49 struct scsi_device *scsi_device;
50 unsigned def_timeout;
51
52#ifdef OSD_VER1_SUPPORT
53 enum osd_std_version version;
54#endif
55};
56
57/* Retrieve/return osd_dev(s) for use by Kernel clients */
58struct osd_dev *osduld_path_lookup(const char *dev_name); /*Use IS_ERR/ERR_PTR*/
59void osduld_put_device(struct osd_dev *od);
60
61/* Add/remove test ioctls from external modules */
62typedef int (do_test_fn)(struct osd_dev *od, unsigned cmd, unsigned long arg);
63int osduld_register_test(unsigned ioctl, do_test_fn *do_test);
64void osduld_unregister_test(unsigned ioctl);
65
66/* These are called by uld at probe time */
67void osd_dev_init(struct osd_dev *od, struct scsi_device *scsi_device);
68void osd_dev_fini(struct osd_dev *od);
69
70/* some hi level device operations */
71int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */
72
73/* we might want to use function vector in the future */
74static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v)
75{
76#ifdef OSD_VER1_SUPPORT
77 od->version = v;
78#endif
79}
80
81struct osd_request;
82typedef void (osd_req_done_fn)(struct osd_request *or, void *private);
83
84struct osd_request {
85 struct osd_cdb cdb;
86 struct osd_data_out_integrity_info out_data_integ;
87 struct osd_data_in_integrity_info in_data_integ;
88
89 struct osd_dev *osd_dev;
90 struct request *request;
91
92 struct _osd_req_data_segment {
93 void *buff;
94 unsigned alloc_size; /* 0 here means: don't call kfree */
95 unsigned total_bytes;
96 } set_attr, enc_get_attr, get_attr;
97
98 struct _osd_io_info {
99 struct bio *bio;
100 u64 total_bytes;
101 struct request *req;
102 struct _osd_req_data_segment *last_seg;
103 u8 *pad_buff;
104 } out, in;
105
106 gfp_t alloc_flags;
107 unsigned timeout;
108 unsigned retries;
109 u8 sense[OSD_MAX_SENSE_LEN];
110 enum osd_attributes_mode attributes_mode;
111
112 osd_req_done_fn *async_done;
113 void *async_private;
114 int async_error;
115};
116
117/* OSD Version control */
118static inline bool osd_req_is_ver1(struct osd_request *or)
119{
120#ifdef OSD_VER1_SUPPORT
121 return or->osd_dev->version == OSD_VER1;
122#else
123 return false;
124#endif
125}
126
127/*
128 * How to use the osd library:
129 *
130 * osd_start_request
131 * Allocates a request.
132 *
133 * osd_req_*
134 * Call one of, to encode the desired operation.
135 *
136 * osd_add_{get,set}_attr
137 * Optionally add attributes to the CDB, list or page mode.
138 *
139 * osd_finalize_request
140 * Computes final data out/in offsets and signs the request,
141 * making it ready for execution.
142 *
143 * osd_execute_request
144 * May be called to execute it through the block layer. Other wise submit
145 * the associated block request in some other way.
146 *
147 * After execution:
148 * osd_req_decode_sense
149 * Decodes sense information to verify execution results.
150 *
151 * osd_req_decode_get_attr
152 * Retrieve osd_add_get_attr_list() values if used.
153 *
154 * osd_end_request
155 * Must be called to deallocate the request.
156 */
157
158/**
159 * osd_start_request - Allocate and initialize an osd_request
160 *
161 * @osd_dev: OSD device that holds the scsi-device and default values
162 * that the request is associated with.
163 * @gfp: The allocation flags to use for request allocation, and all
164 * subsequent allocations. This will be stored at
165 * osd_request->alloc_flags, can be changed by user later
166 *
167 * Allocate osd_request and initialize all members to the
168 * default/initial state.
169 */
170struct osd_request *osd_start_request(struct osd_dev *od, gfp_t gfp);
171
172enum osd_req_options {
173 OSD_REQ_FUA = 0x08, /* Force Unit Access */
174 OSD_REQ_DPO = 0x10, /* Disable Page Out */
175
176 OSD_REQ_BYPASS_TIMESTAMPS = 0x80,
177};
178
179/**
180 * osd_finalize_request - Sign request and prepare request for execution
181 *
182 * @or: osd_request to prepare
183 * @options: combination of osd_req_options bit flags or 0.
184 * @cap: A Pointer to an OSD_CAP_LEN bytes buffer that is received from
185 * The security manager as capabilities for this cdb.
186 * @cap_key: The cryptographic key used to sign the cdb/data. Can be null
187 * if NOSEC is used.
188 *
189 * The actual request and bios are only allocated here, so are the get_attr
190 * buffers that will receive the returned attributes. Copy's @cap to cdb.
191 * Sign the cdb/data with @cap_key.
192 */
193int osd_finalize_request(struct osd_request *or,
194 u8 options, const void *cap, const u8 *cap_key);
195
196/**
197 * osd_execute_request - Execute the request synchronously through block-layer
198 *
199 * @or: osd_request to Executed
200 *
201 * Calls blk_execute_rq to q the command and waits for completion.
202 */
203int osd_execute_request(struct osd_request *or);
204
205/**
206 * osd_execute_request_async - Execute the request without waitting.
207 *
208 * @or: - osd_request to Executed
209 * @done: (Optional) - Called at end of execution
210 * @private: - Will be passed to @done function
211 *
212 * Calls blk_execute_rq_nowait to queue the command. When execution is done
213 * optionally calls @done with @private as parameter. @or->async_error will
214 * have the return code
215 */
216int osd_execute_request_async(struct osd_request *or,
217 osd_req_done_fn *done, void *private);
218
219/**
220 * osd_req_decode_sense_full - Decode sense information after execution.
221 *
222 * @or: - osd_request to examine
223 * @osi - Recievs a more detailed error report information (optional).
224 * @silent - Do not print to dmsg (Even if enabled)
225 * @bad_obj_list - Some commands act on multiple objects. Failed objects will
226 * be recieved here (optional)
227 * @max_obj - Size of @bad_obj_list.
228 * @bad_attr_list - List of failing attributes (optional)
229 * @max_attr - Size of @bad_attr_list.
230 *
231 * After execution, sense + return code can be analyzed using this function. The
232 * return code is the final disposition on the error. So it is possible that a
233 * CHECK_CONDITION was returned from target but this will return NO_ERROR, for
234 * example on recovered errors. All parameters are optional if caller does
235 * not need any returned information.
236 * Note: This function will also dump the error to dmsg according to settings
237 * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the
238 * command would routinely fail, to not spam the dmsg file.
239 */
240struct osd_sense_info {
241 int key; /* one of enum scsi_sense_keys */
242 int additional_code ; /* enum osd_additional_sense_codes */
243 union { /* Sense specific information */
244 u16 sense_info;
245 u16 cdb_field_offset; /* scsi_invalid_field_in_cdb */
246 };
247 union { /* Command specific information */
248 u64 command_info;
249 };
250
251 u32 not_initiated_command_functions; /* osd_command_functions_bits */
252 u32 completed_command_functions; /* osd_command_functions_bits */
253 struct osd_obj_id obj;
254 struct osd_attr attr;
255};
256
257int osd_req_decode_sense_full(struct osd_request *or,
258 struct osd_sense_info *osi, bool silent,
259 struct osd_obj_id *bad_obj_list, int max_obj,
260 struct osd_attr *bad_attr_list, int max_attr);
261
262static inline int osd_req_decode_sense(struct osd_request *or,
263 struct osd_sense_info *osi)
264{
265 return osd_req_decode_sense_full(or, osi, false, NULL, 0, NULL, 0);
266}
267
268/**
269 * osd_end_request - return osd_request to free store
270 *
271 * @or: osd_request to free
272 *
273 * Deallocate all osd_request resources (struct req's, BIOs, buffers, etc.)
274 */
275void osd_end_request(struct osd_request *or);
276
277/*
278 * CDB Encoding
279 *
280 * Note: call only one of the following methods.
281 */
282
283/*
284 * Device commands
285 */
286void osd_req_set_master_seed_xchg(struct osd_request *or, ...);/* NI */
287void osd_req_set_master_key(struct osd_request *or, ...);/* NI */
288
289void osd_req_format(struct osd_request *or, u64 tot_capacity);
290
291/* list all partitions
292 * @list header must be initialized to zero on first run.
293 *
294 * Call osd_is_obj_list_done() to find if we got the complete list.
295 */
296int osd_req_list_dev_partitions(struct osd_request *or,
297 osd_id initial_id, struct osd_obj_id_list *list, unsigned nelem);
298
299void osd_req_flush_obsd(struct osd_request *or,
300 enum osd_options_flush_scope_values);
301
302void osd_req_perform_scsi_command(struct osd_request *or,
303 const u8 *cdb, ...);/* NI */
304void osd_req_task_management(struct osd_request *or, ...);/* NI */
305
306/*
307 * Partition commands
308 */
309void osd_req_create_partition(struct osd_request *or, osd_id partition);
310void osd_req_remove_partition(struct osd_request *or, osd_id partition);
311
312void osd_req_set_partition_key(struct osd_request *or,
313 osd_id partition, u8 new_key_id[OSD_CRYPTO_KEYID_SIZE],
314 u8 seed[OSD_CRYPTO_SEED_SIZE]);/* NI */
315
316/* list all collections in the partition
317 * @list header must be init to zero on first run.
318 *
319 * Call osd_is_obj_list_done() to find if we got the complete list.
320 */
321int osd_req_list_partition_collections(struct osd_request *or,
322 osd_id partition, osd_id initial_id, struct osd_obj_id_list *list,
323 unsigned nelem);
324
325/* list all objects in the partition
326 * @list header must be init to zero on first run.
327 *
328 * Call osd_is_obj_list_done() to find if we got the complete list.
329 */
330int osd_req_list_partition_objects(struct osd_request *or,
331 osd_id partition, osd_id initial_id, struct osd_obj_id_list *list,
332 unsigned nelem);
333
334void osd_req_flush_partition(struct osd_request *or,
335 osd_id partition, enum osd_options_flush_scope_values);
336
337/*
338 * Collection commands
339 */
340void osd_req_create_collection(struct osd_request *or,
341 const struct osd_obj_id *);/* NI */
342void osd_req_remove_collection(struct osd_request *or,
343 const struct osd_obj_id *);/* NI */
344
345/* list all objects in the collection */
346int osd_req_list_collection_objects(struct osd_request *or,
347 const struct osd_obj_id *, osd_id initial_id,
348 struct osd_obj_id_list *list, unsigned nelem);
349
350/* V2 only filtered list of objects in the collection */
351void osd_req_query(struct osd_request *or, ...);/* NI */
352
353void osd_req_flush_collection(struct osd_request *or,
354 const struct osd_obj_id *, enum osd_options_flush_scope_values);
355
356void osd_req_get_member_attrs(struct osd_request *or, ...);/* V2-only NI */
357void osd_req_set_member_attrs(struct osd_request *or, ...);/* V2-only NI */
358
359/*
360 * Object commands
361 */
362void osd_req_create_object(struct osd_request *or, struct osd_obj_id *);
363void osd_req_remove_object(struct osd_request *or, struct osd_obj_id *);
364
365void osd_req_write(struct osd_request *or,
366 const struct osd_obj_id *, struct bio *data_out, u64 offset);
367void osd_req_append(struct osd_request *or,
368 const struct osd_obj_id *, struct bio *data_out);/* NI */
369void osd_req_create_write(struct osd_request *or,
370 const struct osd_obj_id *, struct bio *data_out, u64 offset);/* NI */
371void osd_req_clear(struct osd_request *or,
372 const struct osd_obj_id *, u64 offset, u64 len);/* NI */
373void osd_req_punch(struct osd_request *or,
374 const struct osd_obj_id *, u64 offset, u64 len);/* V2-only NI */
375
376void osd_req_flush_object(struct osd_request *or,
377 const struct osd_obj_id *, enum osd_options_flush_scope_values,
378 /*V2*/ u64 offset, /*V2*/ u64 len);
379
380void osd_req_read(struct osd_request *or,
381 const struct osd_obj_id *, struct bio *data_in, u64 offset);
382
383/*
384 * Root/Partition/Collection/Object Attributes commands
385 */
386
387/* get before set */
388void osd_req_get_attributes(struct osd_request *or, const struct osd_obj_id *);
389
390/* set before get */
391void osd_req_set_attributes(struct osd_request *or, const struct osd_obj_id *);
392
393/*
394 * Attributes appended to most commands
395 */
396
397/* Attributes List mode (or V2 CDB) */
398 /*
399 * TODO: In ver2 if at finalize time only one attr was set and no gets,
400 * then the Attributes CDB mode is used automatically to save IO.
401 */
402
403/* set a list of attributes. */
404int osd_req_add_set_attr_list(struct osd_request *or,
405 const struct osd_attr *, unsigned nelem);
406
407/* get a list of attributes */
408int osd_req_add_get_attr_list(struct osd_request *or,
409 const struct osd_attr *, unsigned nelem);
410
411/*
412 * Attributes list decoding
413 * Must be called after osd_request.request was executed
414 * It is called in a loop to decode the returned get_attr
415 * (see osd_add_get_attr)
416 */
417int osd_req_decode_get_attr_list(struct osd_request *or,
418 struct osd_attr *, int *nelem, void **iterator);
419
420/* Attributes Page mode */
421
422/*
423 * Read an attribute page and optionally set one attribute
424 *
425 * Retrieves the attribute page directly to a user buffer.
426 * @attr_page_data shall stay valid until end of execution.
427 * See osd_attributes.h for common page structures
428 */
429int osd_req_add_get_attr_page(struct osd_request *or,
430 u32 page_id, void *attr_page_data, unsigned max_page_len,
431 const struct osd_attr *set_one);
432
433#endif /* __OSD_LIB_H__ */
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
new file mode 100644
index 000000000000..62b2ab8c69d4
--- /dev/null
+++ b/include/scsi/osd_protocol.h
@@ -0,0 +1,625 @@
1/*
2 * osd_protocol.h - OSD T10 standard C definitions.
3 *
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 *
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.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
12 *
13 * This file contains types and constants that are defined by the protocol
14 * Note: All names and symbols are taken from the OSD standard's text.
15 */
16#ifndef __OSD_PROTOCOL_H__
17#define __OSD_PROTOCOL_H__
18
19#include <linux/types.h>
20#include <asm/unaligned.h>
21#include <scsi/scsi.h>
22
23enum {
24 OSDv1_ADDITIONAL_CDB_LENGTH = 192,
25 OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8,
26 OSDv1_CAP_LEN = 80,
27
28 /* Latest supported version */
29 OSDv2_ADDITIONAL_CDB_LENGTH = 228,
30 OSD_ADDITIONAL_CDB_LENGTH =
31 OSDv2_ADDITIONAL_CDB_LENGTH,
32 OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8,
33 OSD_CAP_LEN = 104,
34
35 OSD_SYSTEMID_LEN = 20,
36 OSDv1_CRYPTO_KEYID_SIZE = 20,
37 OSDv2_CRYPTO_KEYID_SIZE = 32,
38 OSD_CRYPTO_KEYID_SIZE = OSDv2_CRYPTO_KEYID_SIZE,
39 OSD_CRYPTO_SEED_SIZE = 4,
40 OSD_CRYPTO_NONCE_SIZE = 12,
41 OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */
42
43 OSD_PARTITION_FIRST_ID = 0x10000,
44 OSD_OBJECT_FIRST_ID = 0x10000,
45};
46
47/* (osd-r10 5.2.4)
48 * osd2r03: 5.2.3 Caching control bits
49 */
50enum osd_options_byte {
51 OSD_CDB_FUA = 0x08, /* Force Unit Access */
52 OSD_CDB_DPO = 0x10, /* Disable Page Out */
53};
54
55/*
56 * osd2r03: 5.2.5 Isolation.
57 * First 3 bits, V2-only.
58 * Also for attr 110h "default isolation method" at Root Information page
59 */
60enum osd_options_byte_isolation {
61 OSD_ISOLATION_DEFAULT = 0,
62 OSD_ISOLATION_NONE = 1,
63 OSD_ISOLATION_STRICT = 2,
64 OSD_ISOLATION_RANGE = 4,
65 OSD_ISOLATION_FUNCTIONAL = 5,
66 OSD_ISOLATION_VENDOR = 7,
67};
68
69/* (osd-r10: 6.7)
70 * osd2r03: 6.8 FLUSH, FLUSH COLLECTION, FLUSH OSD, FLUSH PARTITION
71 */
72enum osd_options_flush_scope_values {
73 OSD_CDB_FLUSH_ALL = 0,
74 OSD_CDB_FLUSH_ATTR_ONLY = 1,
75
76 OSD_CDB_FLUSH_ALL_RECURSIVE = 2,
77 /* V2-only */
78 OSD_CDB_FLUSH_ALL_RANGE = 2,
79};
80
81/* osd2r03: 5.2.10 Timestamps control */
82enum {
83 OSD_CDB_NORMAL_TIMESTAMPS = 0,
84 OSD_CDB_BYPASS_TIMESTAMPS = 0x7f,
85};
86
87/* (osd-r10: 5.2.2.1)
88 * osd2r03: 5.2.4.1 Get and set attributes CDB format selection
89 * 2 bits at second nibble of command_specific_options byte
90 */
91enum osd_attributes_mode {
92 /* V2-only */
93 OSD_CDB_SET_ONE_ATTR = 0x10,
94
95 OSD_CDB_GET_ATTR_PAGE_SET_ONE = 0x20,
96 OSD_CDB_GET_SET_ATTR_LISTS = 0x30,
97
98 OSD_CDB_GET_SET_ATTR_MASK = 0x30,
99};
100
101/* (osd-r10: 4.12.5)
102 * osd2r03: 4.14.5 Data-In and Data-Out buffer offsets
103 * byte offset = mantissa * (2^(exponent+8))
104 * struct {
105 * unsigned mantissa: 28;
106 * int exponent: 04;
107 * }
108 */
109typedef __be32 __bitwise osd_cdb_offset;
110
111enum {
112 OSD_OFFSET_UNUSED = 0xFFFFFFFF,
113 OSD_OFFSET_MAX_BITS = 28,
114
115 OSDv1_OFFSET_MIN_SHIFT = 8,
116 OSD_OFFSET_MIN_SHIFT = 3,
117 OSD_OFFSET_MAX_SHIFT = 16,
118};
119
120/* Return the smallest allowed encoded offset that contains @offset.
121 *
122 * The actual encoded offset returned is @offset + *padding.
123 * (up to max_shift, non-inclusive)
124 */
125osd_cdb_offset __osd_encode_offset(u64 offset, unsigned *padding,
126 int min_shift, int max_shift);
127
128/* Minimum alignment is 256 bytes
129 * Note: Seems from std v1 that exponent can be from 0+8 to 0xE+8 (inclusive)
130 * which is 8 to 23 but IBM code restricts it to 16, so be it.
131 */
132static inline osd_cdb_offset osd_encode_offset_v1(u64 offset, unsigned *padding)
133{
134 return __osd_encode_offset(offset, padding,
135 OSDv1_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT);
136}
137
138/* Minimum 8 bytes alignment
139 * Same as v1 but since exponent can be signed than a less than
140 * 256 alignment can be reached with small offsets (<2GB)
141 */
142static inline osd_cdb_offset osd_encode_offset_v2(u64 offset, unsigned *padding)
143{
144 return __osd_encode_offset(offset, padding,
145 OSD_OFFSET_MIN_SHIFT, OSD_OFFSET_MAX_SHIFT);
146}
147
148/* osd2r03: 5.2.1 Overview */
149struct osd_cdb_head {
150 struct scsi_varlen_cdb_hdr varlen_cdb;
151/*10*/ u8 options;
152 u8 command_specific_options;
153 u8 timestamp_control;
154/*13*/ u8 reserved1[3];
155/*16*/ __be64 partition;
156/*24*/ __be64 object;
157/*32*/ union { /* V1 vs V2 alignment differences */
158 struct __osdv1_cdb_addr_len {
159/*32*/ __be32 list_identifier;/* Rarely used */
160/*36*/ __be64 length;
161/*44*/ __be64 start_address;
162 } __packed v1;
163
164 struct __osdv2_cdb_addr_len {
165 /* called allocation_length in some commands */
166/*32*/ __be64 length;
167/*40*/ __be64 start_address;
168 union {
169/*48*/ __be32 list_identifier;/* Rarely used */
170 /* OSD2r05 5.2.5 CDB continuation length */
171/*48*/ __be32 cdb_continuation_length;
172 };
173 } __packed v2;
174 };
175/*52*/ union { /* selected attributes mode Page/List/Single */
176 struct osd_attributes_page_mode {
177/*52*/ __be32 get_attr_page;
178/*56*/ __be32 get_attr_alloc_length;
179/*60*/ osd_cdb_offset get_attr_offset;
180
181/*64*/ __be32 set_attr_page;
182/*68*/ __be32 set_attr_id;
183/*72*/ __be32 set_attr_length;
184/*76*/ osd_cdb_offset set_attr_offset;
185/*80*/ } __packed attrs_page;
186
187 struct osd_attributes_list_mode {
188/*52*/ __be32 get_attr_desc_bytes;
189/*56*/ osd_cdb_offset get_attr_desc_offset;
190
191/*60*/ __be32 get_attr_alloc_length;
192/*64*/ osd_cdb_offset get_attr_offset;
193
194/*68*/ __be32 set_attr_bytes;
195/*72*/ osd_cdb_offset set_attr_offset;
196 __be32 not_used;
197/*80*/ } __packed attrs_list;
198
199 /* osd2r03:5.2.4.2 Set one attribute value using CDB fields */
200 struct osd_attributes_cdb_mode {
201/*52*/ __be32 set_attr_page;
202/*56*/ __be32 set_attr_id;
203/*60*/ __be16 set_attr_len;
204/*62*/ u8 set_attr_val[18];
205/*80*/ } __packed attrs_cdb;
206/*52*/ u8 get_set_attributes_parameters[28];
207 };
208} __packed;
209/*80*/
210
211/*160 v1*/
212struct osdv1_security_parameters {
213/*160*/u8 integrity_check_value[OSDv1_CRYPTO_KEYID_SIZE];
214/*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
215/*192*/osd_cdb_offset data_in_integrity_check_offset;
216/*196*/osd_cdb_offset data_out_integrity_check_offset;
217} __packed;
218/*200 v1*/
219
220/*184 v2*/
221struct osdv2_security_parameters {
222/*184*/u8 integrity_check_value[OSDv2_CRYPTO_KEYID_SIZE];
223/*216*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
224/*228*/osd_cdb_offset data_in_integrity_check_offset;
225/*232*/osd_cdb_offset data_out_integrity_check_offset;
226} __packed;
227/*236 v2*/
228
229struct osd_security_parameters {
230 union {
231 struct osdv1_security_parameters v1;
232 struct osdv2_security_parameters v2;
233 };
234};
235
236struct osdv1_cdb {
237 struct osd_cdb_head h;
238 u8 caps[OSDv1_CAP_LEN];
239 struct osdv1_security_parameters sec_params;
240} __packed;
241
242struct osdv2_cdb {
243 struct osd_cdb_head h;
244 u8 caps[OSD_CAP_LEN];
245 struct osdv2_security_parameters sec_params;
246} __packed;
247
248struct osd_cdb {
249 union {
250 struct osdv1_cdb v1;
251 struct osdv2_cdb v2;
252 u8 buff[OSD_TOTAL_CDB_LEN];
253 };
254} __packed;
255
256static inline struct osd_cdb_head *osd_cdb_head(struct osd_cdb *ocdb)
257{
258 return (struct osd_cdb_head *)ocdb->buff;
259}
260
261/* define both version actions
262 * Ex name = FORMAT_OSD we have OSD_ACT_FORMAT_OSD && OSDv1_ACT_FORMAT_OSD
263 */
264#define OSD_ACT___(Name, Num) \
265 OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num), \
266 OSDv1_ACT_##Name = __constant_cpu_to_be16(0x8800 + Num),
267
268/* V2 only actions */
269#define OSD_ACT_V2(Name, Num) \
270 OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num),
271
272#define OSD_ACT_V1_V2(Name, Num1, Num2) \
273 OSD_ACT_##Name = __constant_cpu_to_be16(Num2), \
274 OSDv1_ACT_##Name = __constant_cpu_to_be16(Num1),
275
276enum osd_service_actions {
277 OSD_ACT_V2(OBJECT_STRUCTURE_CHECK, 0x00)
278 OSD_ACT___(FORMAT_OSD, 0x01)
279 OSD_ACT___(CREATE, 0x02)
280 OSD_ACT___(LIST, 0x03)
281 OSD_ACT_V2(PUNCH, 0x04)
282 OSD_ACT___(READ, 0x05)
283 OSD_ACT___(WRITE, 0x06)
284 OSD_ACT___(APPEND, 0x07)
285 OSD_ACT___(FLUSH, 0x08)
286 OSD_ACT_V2(CLEAR, 0x09)
287 OSD_ACT___(REMOVE, 0x0A)
288 OSD_ACT___(CREATE_PARTITION, 0x0B)
289 OSD_ACT___(REMOVE_PARTITION, 0x0C)
290 OSD_ACT___(GET_ATTRIBUTES, 0x0E)
291 OSD_ACT___(SET_ATTRIBUTES, 0x0F)
292 OSD_ACT___(CREATE_AND_WRITE, 0x12)
293 OSD_ACT___(CREATE_COLLECTION, 0x15)
294 OSD_ACT___(REMOVE_COLLECTION, 0x16)
295 OSD_ACT___(LIST_COLLECTION, 0x17)
296 OSD_ACT___(SET_KEY, 0x18)
297 OSD_ACT___(SET_MASTER_KEY, 0x19)
298 OSD_ACT___(FLUSH_COLLECTION, 0x1A)
299 OSD_ACT___(FLUSH_PARTITION, 0x1B)
300 OSD_ACT___(FLUSH_OSD, 0x1C)
301
302 OSD_ACT_V2(QUERY, 0x20)
303 OSD_ACT_V2(REMOVE_MEMBER_OBJECTS, 0x21)
304 OSD_ACT_V2(GET_MEMBER_ATTRIBUTES, 0x22)
305 OSD_ACT_V2(SET_MEMBER_ATTRIBUTES, 0x23)
306 OSD_ACT_V2(READ_MAP, 0x31)
307
308 OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND, 0x8F7E, 0x8F7C)
309 OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT, 0x8F7F, 0x8F7D)
310 /* 0x8F80 to 0x8FFF are Vendor specific */
311};
312
313/* osd2r03: 7.1.3.2 List entry format for retrieving attributes */
314struct osd_attributes_list_attrid {
315 __be32 attr_page;
316 __be32 attr_id;
317} __packed;
318
319/*
320 * NOTE: v1: is not aligned.
321 */
322struct osdv1_attributes_list_element {
323 __be32 attr_page;
324 __be32 attr_id;
325 __be16 attr_bytes; /* valid bytes at attr_val without padding */
326 u8 attr_val[0];
327} __packed;
328
329/*
330 * osd2r03: 7.1.3.3 List entry format for retrieved attributes and
331 * for setting attributes
332 * NOTE: v2 is 8-bytes aligned
333 */
334struct osdv2_attributes_list_element {
335 __be32 attr_page;
336 __be32 attr_id;
337 u8 reserved[6];
338 __be16 attr_bytes; /* valid bytes at attr_val without padding */
339 u8 attr_val[0];
340} __packed;
341
342enum {
343 OSDv1_ATTRIBUTES_ELEM_ALIGN = 1,
344 OSD_ATTRIBUTES_ELEM_ALIGN = 8,
345};
346
347enum {
348 OSD_ATTR_LIST_ALL_PAGES = 0xFFFFFFFF,
349 OSD_ATTR_LIST_ALL_IN_PAGE = 0xFFFFFFFF,
350};
351
352static inline unsigned osdv1_attr_list_elem_size(unsigned len)
353{
354 return ALIGN(len + sizeof(struct osdv1_attributes_list_element),
355 OSDv1_ATTRIBUTES_ELEM_ALIGN);
356}
357
358static inline unsigned osdv2_attr_list_elem_size(unsigned len)
359{
360 return ALIGN(len + sizeof(struct osdv2_attributes_list_element),
361 OSD_ATTRIBUTES_ELEM_ALIGN);
362}
363
364/*
365 * osd2r03: 7.1.3 OSD attributes lists (Table 184) — List type values
366 */
367enum osd_attr_list_types {
368 OSD_ATTR_LIST_GET = 0x1, /* descriptors only */
369 OSD_ATTR_LIST_SET_RETRIEVE = 0x9, /*descriptors/values variable-length*/
370 OSD_V2_ATTR_LIST_MULTIPLE = 0xE, /* ver2, Multiple Objects lists*/
371 OSD_V1_ATTR_LIST_CREATE_MULTIPLE = 0xF,/*ver1, used by create_multple*/
372};
373
374/* osd2r03: 7.1.3.4 Multi-object retrieved attributes format */
375struct osd_attributes_list_multi_header {
376 __be64 object_id;
377 u8 object_type; /* object_type enum below */
378 u8 reserved[5];
379 __be16 list_bytes;
380 /* followed by struct osd_attributes_list_element's */
381};
382
383struct osdv1_attributes_list_header {
384 u8 type; /* low 4-bit only */
385 u8 pad;
386 __be16 list_bytes; /* Initiator shall set to Zero. Only set by target */
387 /*
388 * type=9 followed by struct osd_attributes_list_element's
389 * type=E followed by struct osd_attributes_list_multi_header's
390 */
391} __packed;
392
393static inline unsigned osdv1_list_size(struct osdv1_attributes_list_header *h)
394{
395 return be16_to_cpu(h->list_bytes);
396}
397
398struct osdv2_attributes_list_header {
399 u8 type; /* lower 4-bits only */
400 u8 pad[3];
401/*4*/ __be32 list_bytes; /* Initiator shall set to zero. Only set by target */
402 /*
403 * type=9 followed by struct osd_attributes_list_element's
404 * type=E followed by struct osd_attributes_list_multi_header's
405 */
406} __packed;
407
408static inline unsigned osdv2_list_size(struct osdv2_attributes_list_header *h)
409{
410 return be32_to_cpu(h->list_bytes);
411}
412
413/* (osd-r10 6.13)
414 * osd2r03: 6.15 LIST (Table 79) LIST command parameter data.
415 * for root_lstchg below
416 */
417enum {
418 OSD_OBJ_ID_LIST_PAR = 0x1, /* V1-only. Not used in V2 */
419 OSD_OBJ_ID_LIST_LSTCHG = 0x2,
420};
421
422/*
423 * osd2r03: 6.15.2 LIST command parameter data
424 * (Also for LIST COLLECTION)
425 */
426struct osd_obj_id_list {
427 __be64 list_bytes; /* bytes in list excluding list_bytes (-8) */
428 __be64 continuation_id;
429 __be32 list_identifier;
430 u8 pad[3];
431 u8 root_lstchg;
432 __be64 object_ids[0];
433} __packed;
434
435static inline bool osd_is_obj_list_done(struct osd_obj_id_list *list,
436 bool *is_changed)
437{
438 *is_changed = (0 != (list->root_lstchg & OSD_OBJ_ID_LIST_LSTCHG));
439 return 0 != list->continuation_id;
440}
441
442/*
443 * osd2r03: 4.12.4.5 The ALLDATA security method
444 */
445struct osd_data_out_integrity_info {
446 __be64 data_bytes;
447 __be64 set_attributes_bytes;
448 __be64 get_attributes_bytes;
449 __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
450} __packed;
451
452/* Same osd_data_out_integrity_info is used for OSD2/OSD1. The only difference
453 * Is the sizeof the structure since in OSD1 the last array is smaller. Use
454 * below for version independent handling of this structure
455 */
456static inline int osd_data_out_integrity_info_sizeof(bool is_ver1)
457{
458 return sizeof(struct osd_data_out_integrity_info) -
459 (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
460}
461
462struct osd_data_in_integrity_info {
463 __be64 data_bytes;
464 __be64 retrieved_attributes_bytes;
465 __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
466} __packed;
467
468/* Same osd_data_in_integrity_info is used for OSD2/OSD1. The only difference
469 * Is the sizeof the structure since in OSD1 the last array is smaller. Use
470 * below for version independent handling of this structure
471 */
472static inline int osd_data_in_integrity_info_sizeof(bool is_ver1)
473{
474 return sizeof(struct osd_data_in_integrity_info) -
475 (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
476}
477
478struct osd_timestamp {
479 u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */
480} __packed;
481/* FIXME: define helper functions to convert to/from osd time format */
482
483/*
484 * Capability & Security definitions
485 * osd2r03: 4.11.2.2 Capability format
486 * osd2r03: 5.2.8 Security parameters
487 */
488
489struct osd_key_identifier {
490 u8 id[7]; /* if you know why 7 please email bharrosh@panasas.com */
491} __packed;
492
493/* for osd_capability.format */
494enum {
495 OSD_SEC_CAP_FORMAT_NO_CAPS = 0,
496 OSD_SEC_CAP_FORMAT_VER1 = 1,
497 OSD_SEC_CAP_FORMAT_VER2 = 2,
498};
499
500/* security_method */
501enum {
502 OSD_SEC_NOSEC = 0,
503 OSD_SEC_CAPKEY = 1,
504 OSD_SEC_CMDRSP = 2,
505 OSD_SEC_ALLDATA = 3,
506};
507
508enum object_type {
509 OSD_SEC_OBJ_ROOT = 0x1,
510 OSD_SEC_OBJ_PARTITION = 0x2,
511 OSD_SEC_OBJ_COLLECTION = 0x40,
512 OSD_SEC_OBJ_USER = 0x80,
513};
514
515enum osd_capability_bit_masks {
516 OSD_SEC_CAP_APPEND = BIT(0),
517 OSD_SEC_CAP_OBJ_MGMT = BIT(1),
518 OSD_SEC_CAP_REMOVE = BIT(2),
519 OSD_SEC_CAP_CREATE = BIT(3),
520 OSD_SEC_CAP_SET_ATTR = BIT(4),
521 OSD_SEC_CAP_GET_ATTR = BIT(5),
522 OSD_SEC_CAP_WRITE = BIT(6),
523 OSD_SEC_CAP_READ = BIT(7),
524
525 OSD_SEC_CAP_NONE1 = BIT(8),
526 OSD_SEC_CAP_NONE2 = BIT(9),
527 OSD_SEC_GBL_REM = BIT(10), /*v2 only*/
528 OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/
529 OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/
530 OSD_SEC_CAP_POL_SEC = BIT(13),
531 OSD_SEC_CAP_GLOBAL = BIT(14),
532 OSD_SEC_CAP_DEV_MGMT = BIT(15),
533};
534
535/* for object_descriptor_type (hi nibble used) */
536enum {
537 OSD_SEC_OBJ_DESC_NONE = 0, /* Not allowed */
538 OSD_SEC_OBJ_DESC_OBJ = 1 << 4, /* v1: also collection */
539 OSD_SEC_OBJ_DESC_PAR = 2 << 4, /* also root */
540 OSD_SEC_OBJ_DESC_COL = 3 << 4, /* v2 only */
541};
542
543/* (osd-r10:4.9.2.2)
544 * osd2r03:4.11.2.2 Capability format
545 */
546struct osd_capability_head {
547 u8 format; /* low nibble */
548 u8 integrity_algorithm__key_version; /* MAKE_BYTE(integ_alg, key_ver) */
549 u8 security_method;
550 u8 reserved1;
551/*04*/ struct osd_timestamp expiration_time;
552/*10*/ u8 audit[20];
553/*30*/ u8 discriminator[12];
554/*42*/ struct osd_timestamp object_created_time;
555/*48*/ u8 object_type;
556/*49*/ u8 permissions_bit_mask[5];
557/*54*/ u8 reserved2;
558/*55*/ u8 object_descriptor_type; /* high nibble */
559} __packed;
560
561/*56 v1*/
562struct osdv1_cap_object_descriptor {
563 union {
564 struct {
565/*56*/ __be32 policy_access_tag;
566/*60*/ __be64 allowed_partition_id;
567/*68*/ __be64 allowed_object_id;
568/*76*/ __be32 reserved;
569 } __packed obj_desc;
570
571/*56*/ u8 object_descriptor[24];
572 };
573} __packed;
574/*80 v1*/
575
576/*56 v2*/
577struct osd_cap_object_descriptor {
578 union {
579 struct {
580/*56*/ __be32 allowed_attributes_access;
581/*60*/ __be32 policy_access_tag;
582/*64*/ __be16 boot_epoch;
583/*66*/ u8 reserved[6];
584/*72*/ __be64 allowed_partition_id;
585/*80*/ __be64 allowed_object_id;
586/*88*/ __be64 allowed_range_length;
587/*96*/ __be64 allowed_range_start;
588 } __packed obj_desc;
589
590/*56*/ u8 object_descriptor[48];
591 };
592} __packed;
593/*104 v2*/
594
595struct osdv1_capability {
596 struct osd_capability_head h;
597 struct osdv1_cap_object_descriptor od;
598} __packed;
599
600struct osd_capability {
601 struct osd_capability_head h;
602 struct osd_cap_object_descriptor od;
603} __packed;
604
605/**
606 * osd_sec_set_caps - set cap-bits into the capabilities header
607 *
608 * @cap: The osd_capability_head to set cap bits to.
609 * @bit_mask: Use an ORed list of enum osd_capability_bit_masks values
610 *
611 * permissions_bit_mask is unaligned use below to set into caps
612 * in a version independent way
613 */
614static inline void osd_sec_set_caps(struct osd_capability_head *cap,
615 u16 bit_mask)
616{
617 /*
618 *Note: The bits above are defined LE order this is because this way
619 * they can grow in the future to more then 16, and still retain
620 * there constant values.
621 */
622 put_unaligned_le16(bit_mask, &cap->permissions_bit_mask);
623}
624
625#endif /* ndef __OSD_PROTOCOL_H__ */
diff --git a/include/scsi/osd_sec.h b/include/scsi/osd_sec.h
new file mode 100644
index 000000000000..4c09fee8ae1e
--- /dev/null
+++ b/include/scsi/osd_sec.h
@@ -0,0 +1,45 @@
1/*
2 * osd_sec.h - OSD security manager API
3 *
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 *
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.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
12 *
13 */
14#ifndef __OSD_SEC_H__
15#define __OSD_SEC_H__
16
17#include "osd_protocol.h"
18#include "osd_types.h"
19
20/*
21 * Contains types and constants of osd capabilities and security
22 * encoding/decoding.
23 * API is trying to keep security abstract so initiator of an object
24 * based pNFS client knows as little as possible about security and
25 * capabilities. It is the Server's osd-initiator place to know more.
26 * Also can be used by osd-target.
27 */
28void osd_sec_encode_caps(void *caps, ...);/* NI */
29void osd_sec_init_nosec_doall_caps(void *caps,
30 const struct osd_obj_id *obj, bool is_collection, const bool is_v1);
31
32bool osd_is_sec_alldata(struct osd_security_parameters *sec_params);
33
34/* Conditionally sign the CDB according to security setting in ocdb
35 * with cap_key */
36void osd_sec_sign_cdb(struct osd_cdb *ocdb, const u8 *cap_key);
37
38/* Unconditionally sign the BIO data with cap_key.
39 * Check for osd_is_sec_alldata() was done prior to calling this. */
40void osd_sec_sign_data(void *data_integ, struct bio *bio, const u8 *cap_key);
41
42/* Version independent copy of caps into the cdb */
43void osd_set_caps(struct osd_cdb *cdb, const void *caps);
44
45#endif /* ndef __OSD_SEC_H__ */
diff --git a/include/scsi/osd_sense.h b/include/scsi/osd_sense.h
new file mode 100644
index 000000000000..ff9b33c773c7
--- /dev/null
+++ b/include/scsi/osd_sense.h
@@ -0,0 +1,260 @@
1/*
2 * osd_sense.h - OSD Related sense handling definitions.
3 *
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 *
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.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
12 *
13 * This file contains types and constants that are defined by the protocol
14 * Note: All names and symbols are taken from the OSD standard's text.
15 */
16#ifndef __OSD_SENSE_H__
17#define __OSD_SENSE_H__
18
19#include <scsi/osd_protocol.h>
20
21/* SPC3r23 4.5.6 Sense key and sense code definitions table 27 */
22enum scsi_sense_keys {
23 scsi_sk_no_sense = 0x0,
24 scsi_sk_recovered_error = 0x1,
25 scsi_sk_not_ready = 0x2,
26 scsi_sk_medium_error = 0x3,
27 scsi_sk_hardware_error = 0x4,
28 scsi_sk_illegal_request = 0x5,
29 scsi_sk_unit_attention = 0x6,
30 scsi_sk_data_protect = 0x7,
31 scsi_sk_blank_check = 0x8,
32 scsi_sk_vendor_specific = 0x9,
33 scsi_sk_copy_aborted = 0xa,
34 scsi_sk_aborted_command = 0xb,
35 scsi_sk_volume_overflow = 0xd,
36 scsi_sk_miscompare = 0xe,
37 scsi_sk_reserved = 0xf,
38};
39
40/* SPC3r23 4.5.6 Sense key and sense code definitions table 28 */
41/* Note: only those which can be returned by an OSD target. Most of
42 * these errors are taken care of by the generic scsi layer.
43 */
44enum osd_additional_sense_codes {
45 scsi_no_additional_sense_information = 0x0000,
46 scsi_operation_in_progress = 0x0016,
47 scsi_cleaning_requested = 0x0017,
48 scsi_lunr_cause_not_reportable = 0x0400,
49 scsi_logical_unit_is_in_process_of_becoming_ready = 0x0401,
50 scsi_lunr_initializing_command_required = 0x0402,
51 scsi_lunr_manual_intervention_required = 0x0403,
52 scsi_lunr_operation_in_progress = 0x0407,
53 scsi_lunr_selftest_in_progress = 0x0409,
54 scsi_luna_asymmetric_access_state_transition = 0x040a,
55 scsi_luna_target_port_in_standby_state = 0x040b,
56 scsi_luna_target_port_in_unavailable_state = 0x040c,
57 scsi_lunr_notify_enable_spinup_required = 0x0411,
58 scsi_logical_unit_does_not_respond_to_selection = 0x0500,
59 scsi_logical_unit_communication_failure = 0x0800,
60 scsi_logical_unit_communication_timeout = 0x0801,
61 scsi_logical_unit_communication_parity_error = 0x0802,
62 scsi_error_log_overflow = 0x0a00,
63 scsi_warning = 0x0b00,
64 scsi_warning_specified_temperature_exceeded = 0x0b01,
65 scsi_warning_enclosure_degraded = 0x0b02,
66 scsi_write_error_unexpected_unsolicited_data = 0x0c0c,
67 scsi_write_error_not_enough_unsolicited_data = 0x0c0d,
68 scsi_invalid_information_unit = 0x0e00,
69 scsi_invalid_field_in_command_information_unit = 0x0e03,
70 scsi_read_error_failed_retransmission_request = 0x1113,
71 scsi_parameter_list_length_error = 0x1a00,
72 scsi_invalid_command_operation_code = 0x2000,
73 scsi_invalid_field_in_cdb = 0x2400,
74 osd_security_audit_value_frozen = 0x2404,
75 osd_security_working_key_frozen = 0x2405,
76 osd_nonce_not_unique = 0x2406,
77 osd_nonce_timestamp_out_of_range = 0x2407,
78 scsi_logical_unit_not_supported = 0x2500,
79 scsi_invalid_field_in_parameter_list = 0x2600,
80 scsi_parameter_not_supported = 0x2601,
81 scsi_parameter_value_invalid = 0x2602,
82 scsi_invalid_release_of_persistent_reservation = 0x2604,
83 osd_invalid_dataout_buffer_integrity_check_value = 0x260f,
84 scsi_not_ready_to_ready_change_medium_may_have_changed = 0x2800,
85 scsi_power_on_reset_or_bus_device_reset_occurred = 0x2900,
86 scsi_power_on_occurred = 0x2901,
87 scsi_scsi_bus_reset_occurred = 0x2902,
88 scsi_bus_device_reset_function_occurred = 0x2903,
89 scsi_device_internal_reset = 0x2904,
90 scsi_transceiver_mode_changed_to_single_ended = 0x2905,
91 scsi_transceiver_mode_changed_to_lvd = 0x2906,
92 scsi_i_t_nexus_loss_occurred = 0x2907,
93 scsi_parameters_changed = 0x2a00,
94 scsi_mode_parameters_changed = 0x2a01,
95 scsi_asymmetric_access_state_changed = 0x2a06,
96 scsi_priority_changed = 0x2a08,
97 scsi_command_sequence_error = 0x2c00,
98 scsi_previous_busy_status = 0x2c07,
99 scsi_previous_task_set_full_status = 0x2c08,
100 scsi_previous_reservation_conflict_status = 0x2c09,
101 osd_partition_or_collection_contains_user_objects = 0x2c0a,
102 scsi_commands_cleared_by_another_initiator = 0x2f00,
103 scsi_cleaning_failure = 0x3007,
104 scsi_enclosure_failure = 0x3400,
105 scsi_enclosure_services_failure = 0x3500,
106 scsi_unsupported_enclosure_function = 0x3501,
107 scsi_enclosure_services_unavailable = 0x3502,
108 scsi_enclosure_services_transfer_failure = 0x3503,
109 scsi_enclosure_services_transfer_refused = 0x3504,
110 scsi_enclosure_services_checksum_error = 0x3505,
111 scsi_rounded_parameter = 0x3700,
112 osd_read_past_end_of_user_object = 0x3b17,
113 scsi_logical_unit_has_not_self_configured_yet = 0x3e00,
114 scsi_logical_unit_failure = 0x3e01,
115 scsi_timeout_on_logical_unit = 0x3e02,
116 scsi_logical_unit_failed_selftest = 0x3e03,
117 scsi_logical_unit_unable_to_update_selftest_log = 0x3e04,
118 scsi_target_operating_conditions_have_changed = 0x3f00,
119 scsi_microcode_has_been_changed = 0x3f01,
120 scsi_inquiry_data_has_changed = 0x3f03,
121 scsi_echo_buffer_overwritten = 0x3f0f,
122 scsi_diagnostic_failure_on_component_nn_first = 0x4080,
123 scsi_diagnostic_failure_on_component_nn_last = 0x40ff,
124 scsi_message_error = 0x4300,
125 scsi_internal_target_failure = 0x4400,
126 scsi_select_or_reselect_failure = 0x4500,
127 scsi_scsi_parity_error = 0x4700,
128 scsi_data_phase_crc_error_detected = 0x4701,
129 scsi_scsi_parity_error_detected_during_st_data_phase = 0x4702,
130 scsi_asynchronous_information_protection_error_detected = 0x4704,
131 scsi_protocol_service_crc_error = 0x4705,
132 scsi_phy_test_function_in_progress = 0x4706,
133 scsi_invalid_message_error = 0x4900,
134 scsi_command_phase_error = 0x4a00,
135 scsi_data_phase_error = 0x4b00,
136 scsi_logical_unit_failed_self_configuration = 0x4c00,
137 scsi_overlapped_commands_attempted = 0x4e00,
138 osd_quota_error = 0x5507,
139 scsi_failure_prediction_threshold_exceeded = 0x5d00,
140 scsi_failure_prediction_threshold_exceeded_false = 0x5dff,
141 scsi_voltage_fault = 0x6500,
142};
143
144enum scsi_descriptor_types {
145 scsi_sense_information = 0x0,
146 scsi_sense_command_specific_information = 0x1,
147 scsi_sense_key_specific = 0x2,
148 scsi_sense_field_replaceable_unit = 0x3,
149 scsi_sense_stream_commands = 0x4,
150 scsi_sense_block_commands = 0x5,
151 osd_sense_object_identification = 0x6,
152 osd_sense_response_integrity_check = 0x7,
153 osd_sense_attribute_identification = 0x8,
154 scsi_sense_ata_return = 0x9,
155
156 scsi_sense_Reserved_first = 0x0A,
157 scsi_sense_Reserved_last = 0x7F,
158 scsi_sense_Vendor_specific_first = 0x80,
159 scsi_sense_Vendor_specific_last = 0xFF,
160};
161
162struct scsi_sense_descriptor { /* for picking into desc type */
163 u8 descriptor_type; /* one of enum scsi_descriptor_types */
164 u8 additional_length; /* n - 1 */
165 u8 data[];
166} __packed;
167
168/* OSD deploys only scsi descriptor_based sense buffers */
169struct scsi_sense_descriptor_based {
170/*0*/ u8 response_code; /* 0x72 or 0x73 */
171/*1*/ u8 sense_key; /* one of enum scsi_sense_keys (4 lower bits) */
172/*2*/ __be16 additional_sense_code; /* enum osd_additional_sense_codes */
173/*4*/ u8 Reserved[3];
174/*7*/ u8 additional_sense_length; /* n - 7 */
175/*8*/ struct scsi_sense_descriptor ssd[0]; /* variable length, 1 or more */
176} __packed;
177
178/* some descriptors deployed by OSD */
179
180/* SPC3r23 4.5.2.3 Command-specific information sense data descriptor */
181/* Note: this is the same for descriptor_type=00 but with type=00 the
182 * Reserved[0] == 0x80 (ie. bit-7 set)
183 */
184struct scsi_sense_command_specific_data_descriptor {
185/*0*/ u8 descriptor_type; /* (00h/01h) */
186/*1*/ u8 additional_length; /* (0Ah) */
187/*2*/ u8 Reserved[2];
188/*4*/ __be64 information;
189} __packed;
190/*12*/
191
192struct scsi_sense_key_specific_data_descriptor {
193/*0*/ u8 descriptor_type; /* (02h) */
194/*1*/ u8 additional_length; /* (06h) */
195/*2*/ u8 Reserved[2];
196/* SKSV, C/D, Reserved (2), BPV, BIT POINTER (3) */
197/*4*/ u8 sksv_cd_bpv_bp;
198/*5*/ __be16 value; /* field-pointer/progress-value/retry-count/... */
199/*7*/ u8 Reserved2;
200} __packed;
201/*8*/
202
203/* 4.16.2.1 OSD error identification sense data descriptor - table 52 */
204/* Note: these bits are defined LE order for easy definition, this way the BIT()
205 * number is the same as in the documentation. Below members at
206 * osd_sense_identification_data_descriptor are therefore defined __le32.
207 */
208enum osd_command_functions_bits {
209 OSD_CFB_COMMAND = BIT(4),
210 OSD_CFB_CMD_CAP_VERIFIED = BIT(5),
211 OSD_CFB_VALIDATION = BIT(7),
212 OSD_CFB_IMP_ST_ATT = BIT(12),
213 OSD_CFB_SET_ATT = BIT(20),
214 OSD_CFB_SA_CAP_VERIFIED = BIT(21),
215 OSD_CFB_GET_ATT = BIT(28),
216 OSD_CFB_GA_CAP_VERIFIED = BIT(29),
217};
218
219struct osd_sense_identification_data_descriptor {
220/*0*/ u8 descriptor_type; /* (06h) */
221/*1*/ u8 additional_length; /* (1Eh) */
222/*2*/ u8 Reserved[6];
223/*8*/ __le32 not_initiated_functions; /*osd_command_functions_bits*/
224/*12*/ __le32 completed_functions; /*osd_command_functions_bits*/
225/*16*/ __be64 partition_id;
226/*24*/ __be64 object_id;
227} __packed;
228/*32*/
229
230struct osd_sense_response_integrity_check_descriptor {
231/*0*/ u8 descriptor_type; /* (07h) */
232/*1*/ u8 additional_length; /* (20h) */
233/*2*/ u8 integrity_check_value[32]; /*FIXME: OSDv2_CRYPTO_KEYID_SIZE*/
234} __packed;
235/*34*/
236
237struct osd_sense_attributes_data_descriptor {
238/*0*/ u8 descriptor_type; /* (08h) */
239/*1*/ u8 additional_length; /* (n-2) */
240/*2*/ u8 Reserved[6];
241 struct osd_sense_attr {
242/*8*/ __be32 attr_page;
243/*12*/ __be32 attr_id;
244/*16*/ } sense_attrs[0]; /* 1 or more */
245} __packed;
246/*variable*/
247
248/* Dig into scsi_sk_illegal_request/scsi_invalid_field_in_cdb errors */
249
250/*FIXME: Support also field in CAPS*/
251#define OSD_CDB_OFFSET(F) offsetof(struct osd_cdb_head, F)
252
253enum osdv2_cdb_field_offset {
254 OSDv1_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v1.start_address),
255 OSD_CFO_STARTING_BYTE = OSD_CDB_OFFSET(v2.start_address),
256 OSD_CFO_PARTITION_ID = OSD_CDB_OFFSET(partition),
257 OSD_CFO_OBJECT_ID = OSD_CDB_OFFSET(object),
258};
259
260#endif /* ndef __OSD_SENSE_H__ */
diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h
new file mode 100644
index 000000000000..3f5e88cc75c0
--- /dev/null
+++ b/include/scsi/osd_types.h
@@ -0,0 +1,40 @@
1/*
2 * osd_types.h - Types and constants which are not part of the protocol.
3 *
4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 *
6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com>
8 * Benny Halevy <bhalevy@panasas.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
12 *
13 * Contains types and constants that are implementation specific and are
14 * used by more than one part of the osd library.
15 * (Eg initiator/target/security_manager/...)
16 */
17#ifndef __OSD_TYPES_H__
18#define __OSD_TYPES_H__
19
20struct osd_systemid {
21 u8 data[OSD_SYSTEMID_LEN];
22};
23
24typedef u64 __bitwise osd_id;
25
26struct osd_obj_id {
27 osd_id partition;
28 osd_id id;
29};
30
31static const struct __weak osd_obj_id osd_root_object = {0, 0};
32
33struct osd_attr {
34 u32 attr_page;
35 u32 attr_id;
36 u16 len; /* byte count of operand */
37 void *val_ptr; /* in network order */
38};
39
40#endif /* ndef __OSD_TYPES_H__ */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index a109165714d6..084478e14d24 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -9,7 +9,8 @@
9#define _SCSI_SCSI_H 9#define _SCSI_SCSI_H
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <scsi/scsi_cmnd.h> 12
13struct scsi_cmnd;
13 14
14/* 15/*
15 * The maximum number of SG segments that we will put inside a 16 * The maximum number of SG segments that we will put inside a
@@ -263,6 +264,7 @@ static inline int scsi_status_is_good(int status)
263#define TYPE_RAID 0x0c 264#define TYPE_RAID 0x0c
264#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ 265#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
265#define TYPE_RBC 0x0e 266#define TYPE_RBC 0x0e
267#define TYPE_OSD 0x11
266#define TYPE_NO_LUN 0x7f 268#define TYPE_NO_LUN 0x7f
267 269
268/* SCSI protocols; these are taken from SPC-3 section 7.5 */ 270/* SCSI protocols; these are taken from SPC-3 section 7.5 */
@@ -402,16 +404,6 @@ static inline int scsi_is_wlun(unsigned int lun)
402#define DRIVER_HARD 0x07 404#define DRIVER_HARD 0x07
403#define DRIVER_SENSE 0x08 405#define DRIVER_SENSE 0x08
404 406
405#define SUGGEST_RETRY 0x10
406#define SUGGEST_ABORT 0x20
407#define SUGGEST_REMAP 0x30
408#define SUGGEST_DIE 0x40
409#define SUGGEST_SENSE 0x80
410#define SUGGEST_IS_OK 0xff
411
412#define DRIVER_MASK 0x0f
413#define SUGGEST_MASK 0xf0
414
415/* 407/*
416 * Internal return values. 408 * Internal return values.
417 */ 409 */
@@ -447,23 +439,6 @@ static inline int scsi_is_wlun(unsigned int lun)
447#define msg_byte(result) (((result) >> 8) & 0xff) 439#define msg_byte(result) (((result) >> 8) & 0xff)
448#define host_byte(result) (((result) >> 16) & 0xff) 440#define host_byte(result) (((result) >> 16) & 0xff)
449#define driver_byte(result) (((result) >> 24) & 0xff) 441#define driver_byte(result) (((result) >> 24) & 0xff)
450#define suggestion(result) (driver_byte(result) & SUGGEST_MASK)
451
452static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
453{
454 cmd->result |= status << 8;
455}
456
457static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
458{
459 cmd->result |= status << 16;
460}
461
462static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
463{
464 cmd->result |= status << 24;
465}
466
467 442
468#define sense_class(sense) (((sense) >> 4) & 0x7) 443#define sense_class(sense) (((sense) >> 4) & 0x7)
469#define sense_error(sense) ((sense) & 0xf) 444#define sense_error(sense) ((sense) & 0xf)
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 855bf95963e7..43b50d36925c 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -291,4 +291,19 @@ static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd)
291#define scsi_for_each_prot_sg(cmd, sg, nseg, __i) \ 291#define scsi_for_each_prot_sg(cmd, sg, nseg, __i) \
292 for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i) 292 for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i)
293 293
294static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
295{
296 cmd->result |= status << 8;
297}
298
299static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
300{
301 cmd->result |= status << 16;
302}
303
304static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
305{
306 cmd->result |= status << 24;
307}
308
294#endif /* _SCSI_SCSI_CMND_H */ 309#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 01a4c58f8bad..3f566af3f101 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -340,6 +340,7 @@ extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp,
340 struct scsi_sense_hdr *); 340 struct scsi_sense_hdr *);
341extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, 341extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout,
342 int retries, struct scsi_sense_hdr *sshdr); 342 int retries, struct scsi_sense_hdr *sshdr);
343extern unsigned char *scsi_get_vpd_page(struct scsi_device *, u8 page);
343extern int scsi_device_set_state(struct scsi_device *sdev, 344extern int scsi_device_set_state(struct scsi_device *sdev,
344 enum scsi_device_state state); 345 enum scsi_device_state state);
345extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, 346extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
@@ -370,12 +371,6 @@ extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
370 int data_direction, void *buffer, unsigned bufflen, 371 int data_direction, void *buffer, unsigned bufflen,
371 struct scsi_sense_hdr *, int timeout, int retries, 372 struct scsi_sense_hdr *, int timeout, int retries,
372 int *resid); 373 int *resid);
373extern int scsi_execute_async(struct scsi_device *sdev,
374 const unsigned char *cmd, int cmd_len, int data_direction,
375 void *buffer, unsigned bufflen, int use_sg,
376 int timeout, int retries, void *privdata,
377 void (*done)(void *, char *, int, int),
378 gfp_t gfp);
379 374
380static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev) 375static inline int __must_check scsi_device_reprobe(struct scsi_device *sdev)
381{ 376{
@@ -400,7 +395,8 @@ static inline unsigned int sdev_id(struct scsi_device *sdev)
400 */ 395 */
401static inline int scsi_device_online(struct scsi_device *sdev) 396static inline int scsi_device_online(struct scsi_device *sdev)
402{ 397{
403 return sdev->sdev_state != SDEV_OFFLINE; 398 return (sdev->sdev_state != SDEV_OFFLINE &&
399 sdev->sdev_state != SDEV_DEL);
404} 400}
405static inline int scsi_device_blocked(struct scsi_device *sdev) 401static inline int scsi_device_blocked(struct scsi_device *sdev)
406{ 402{
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/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index b50aabe2861e..457588e1119b 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -88,7 +88,7 @@ struct iscsi_transport {
88 uint64_t host_param_mask; 88 uint64_t host_param_mask;
89 struct iscsi_cls_session *(*create_session) (struct iscsi_endpoint *ep, 89 struct iscsi_cls_session *(*create_session) (struct iscsi_endpoint *ep,
90 uint16_t cmds_max, uint16_t qdepth, 90 uint16_t cmds_max, uint16_t qdepth,
91 uint32_t sn, uint32_t *hn); 91 uint32_t sn);
92 void (*destroy_session) (struct iscsi_cls_session *session); 92 void (*destroy_session) (struct iscsi_cls_session *session);
93 struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess, 93 struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess,
94 uint32_t cid); 94 uint32_t cid);
@@ -206,8 +206,6 @@ struct iscsi_cls_session {
206struct iscsi_cls_host { 206struct iscsi_cls_host {
207 atomic_t nr_scans; 207 atomic_t nr_scans;
208 struct mutex mutex; 208 struct mutex mutex;
209 struct workqueue_struct *scan_workq;
210 char scan_workq_name[20];
211}; 209};
212 210
213extern void iscsi_host_for_each_session(struct Scsi_Host *shost, 211extern void iscsi_host_for_each_session(struct Scsi_Host *shost,
diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h
index b3aa62ee3c8d..d010858c33c2 100644
--- a/include/sound/ad1816a.h
+++ b/include/sound/ad1816a.h
@@ -169,5 +169,7 @@ extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,
169 169
170extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm); 170extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm);
171extern int snd_ad1816a_mixer(struct snd_ad1816a *chip); 171extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
172extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device,
173 struct snd_timer **rtimer);
172 174
173#endif /* __SOUND_AD1816A_H */ 175#endif /* __SOUND_AD1816A_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 1c02ed1d7c4a..6add80fc2512 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -23,9 +23,10 @@
23#ifndef __SOUND_ASOUND_H 23#ifndef __SOUND_ASOUND_H
24#define __SOUND_ASOUND_H 24#define __SOUND_ASOUND_H
25 25
26#include <linux/types.h>
27
26#ifdef __KERNEL__ 28#ifdef __KERNEL__
27#include <linux/ioctl.h> 29#include <linux/ioctl.h>
28#include <linux/types.h>
29#include <linux/time.h> 30#include <linux/time.h>
30#include <asm/byteorder.h> 31#include <asm/byteorder.h>
31 32
@@ -126,12 +127,10 @@ struct snd_hwdep_dsp_image {
126 unsigned long driver_data; /* W: driver-specific data */ 127 unsigned long driver_data; /* W: driver-specific data */
127}; 128};
128 129
129enum { 130#define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int)
130 SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int), 131#define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info)
131 SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct snd_hwdep_info), 132#define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status)
132 SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct snd_hwdep_dsp_status), 133#define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image)
133 SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct snd_hwdep_dsp_image)
134};
135 134
136/***************************************************************************** 135/*****************************************************************************
137 * * 136 * *
@@ -342,7 +341,7 @@ struct snd_interval {
342#define SNDRV_MASK_MAX 256 341#define SNDRV_MASK_MAX 256
343 342
344struct snd_mask { 343struct snd_mask {
345 u_int32_t bits[(SNDRV_MASK_MAX+31)/32]; 344 __u32 bits[(SNDRV_MASK_MAX+31)/32];
346}; 345};
347 346
348struct snd_pcm_hw_params { 347struct snd_pcm_hw_params {
@@ -385,7 +384,7 @@ struct snd_pcm_sw_params {
385 384
386struct snd_pcm_channel_info { 385struct snd_pcm_channel_info {
387 unsigned int channel; 386 unsigned int channel;
388 off_t offset; /* mmap offset */ 387 __kernel_off_t offset; /* mmap offset */
389 unsigned int first; /* offset to first sample in bits */ 388 unsigned int first; /* offset to first sample in bits */
390 unsigned int step; /* samples distance in bits */ 389 unsigned int step; /* samples distance in bits */
391}; 390};
@@ -451,40 +450,35 @@ enum {
451 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, 450 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
452}; 451};
453 452
454enum { 453#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int)
455 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), 454#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
456 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info), 455#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int)
457 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), 456#define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int)
458 SNDRV_PCM_IOCTL_TTSTAMP = _IOW('A', 0x03, int), 457#define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params)
459 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params), 458#define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params)
460 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params), 459#define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12)
461 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12), 460#define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params)
462 SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct snd_pcm_sw_params), 461#define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
463 SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct snd_pcm_status), 462#define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
464 SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, snd_pcm_sframes_t), 463#define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
465 SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22), 464#define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
466 SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct snd_pcm_sync_ptr), 465#define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
467 SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct snd_pcm_channel_info), 466#define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40)
468 SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40), 467#define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41)
469 SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41), 468#define SNDRV_PCM_IOCTL_START _IO('A', 0x42)
470 SNDRV_PCM_IOCTL_START = _IO('A', 0x42), 469#define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43)
471 SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43), 470#define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44)
472 SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44), 471#define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int)
473 SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int), 472#define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t)
474 SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, snd_pcm_uframes_t), 473#define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47)
475 SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47), 474#define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48)
476 SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48), 475#define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t)
477 SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, snd_pcm_uframes_t), 476#define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi)
478 SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct snd_xferi), 477#define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi)
479 SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct snd_xferi), 478#define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern)
480 SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct snd_xfern), 479#define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern)
481 SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct snd_xfern), 480#define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int)
482 SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int), 481#define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61)
483 SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61),
484};
485
486/* Trick to make alsa-lib/acinclude.m4 happy */
487#define SNDRV_PCM_IOCTL_REWIND SNDRV_PCM_IOCTL_REWIND
488 482
489/***************************************************************************** 483/*****************************************************************************
490 * * 484 * *
@@ -538,14 +532,12 @@ struct snd_rawmidi_status {
538 unsigned char reserved[16]; /* reserved for future use */ 532 unsigned char reserved[16]; /* reserved for future use */
539}; 533};
540 534
541enum { 535#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
542 SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int), 536#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
543 SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct snd_rawmidi_info), 537#define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params)
544 SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct snd_rawmidi_params), 538#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
545 SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct snd_rawmidi_status), 539#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
546 SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int), 540#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
547 SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int),
548};
549 541
550/* 542/*
551 * Timer section - /dev/snd/timer 543 * Timer section - /dev/snd/timer
@@ -654,23 +646,21 @@ struct snd_timer_status {
654 unsigned char reserved[64]; /* reserved */ 646 unsigned char reserved[64]; /* reserved */
655}; 647};
656 648
657enum { 649#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
658 SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int), 650#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
659 SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct snd_timer_id), 651#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
660 SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int), 652#define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
661 SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct snd_timer_ginfo), 653#define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
662 SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct snd_timer_gparams), 654#define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
663 SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct snd_timer_gstatus), 655#define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select)
664 SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct snd_timer_select), 656#define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info)
665 SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct snd_timer_info), 657#define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params)
666 SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct snd_timer_params), 658#define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status)
667 SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct snd_timer_status), 659/* The following four ioctls are changed since 1.0.9 due to confliction */
668 /* The following four ioctls are changed since 1.0.9 due to confliction */ 660#define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0)
669 SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0), 661#define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
670 SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1), 662#define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
671 SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0xa2), 663#define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
672 SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3),
673};
674 664
675struct snd_timer_read { 665struct snd_timer_read {
676 unsigned int resolution; 666 unsigned int resolution;
@@ -789,7 +779,7 @@ struct snd_ctl_elem_info {
789 snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ 779 snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
790 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ 780 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
791 unsigned int count; /* count of values */ 781 unsigned int count; /* count of values */
792 pid_t owner; /* owner's PID of this control */ 782 __kernel_pid_t owner; /* owner's PID of this control */
793 union { 783 union {
794 struct { 784 struct {
795 long min; /* R: minimum value */ 785 long min; /* R: minimum value */
@@ -847,33 +837,31 @@ struct snd_ctl_tlv {
847 unsigned int tlv[0]; /* first TLV */ 837 unsigned int tlv[0]; /* first TLV */
848}; 838};
849 839
850enum { 840#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
851 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), 841#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info)
852 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info), 842#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list)
853 SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct snd_ctl_elem_list), 843#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info)
854 SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct snd_ctl_elem_info), 844#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value)
855 SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct snd_ctl_elem_value), 845#define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value)
856 SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct snd_ctl_elem_value), 846#define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id)
857 SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct snd_ctl_elem_id), 847#define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id)
858 SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct snd_ctl_elem_id), 848#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
859 SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int), 849#define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info)
860 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info), 850#define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info)
861 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info), 851#define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id)
862 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id), 852#define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv)
863 SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct snd_ctl_tlv), 853#define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv)
864 SNDRV_CTL_IOCTL_TLV_WRITE = _IOWR('U', 0x1b, struct snd_ctl_tlv), 854#define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv)
865 SNDRV_CTL_IOCTL_TLV_COMMAND = _IOWR('U', 0x1c, struct snd_ctl_tlv), 855#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
866 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), 856#define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info)
867 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info), 857#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int)
868 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), 858#define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info)
869 SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct snd_pcm_info), 859#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
870 SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int), 860#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
871 SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int), 861#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
872 SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct snd_rawmidi_info), 862#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
873 SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int), 863#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
874 SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int), 864#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)
875 SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
876};
877 865
878/* 866/*
879 * Read interface. 867 * Read interface.
@@ -919,18 +907,4 @@ struct snd_ctl_event {
919#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" 907#define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
920#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what 908#define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
921 909
922/*
923 *
924 */
925
926struct snd_xferv {
927 const struct iovec *vector;
928 unsigned long count;
929};
930
931enum {
932 SNDRV_IOCTL_READV = _IOW('K', 0x00, struct snd_xferv),
933 SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct snd_xferv),
934};
935
936#endif /* __SOUND_ASOUND_H */ 910#endif /* __SOUND_ASOUND_H */
diff --git a/include/sound/atmel-abdac.h b/include/sound/atmel-abdac.h
new file mode 100644
index 000000000000..edff6a8ba1b5
--- /dev/null
+++ b/include/sound/atmel-abdac.h
@@ -0,0 +1,23 @@
1/*
2 * Driver for the Atmel Audio Bitstream DAC (ABDAC)
3 *
4 * Copyright (C) 2009 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10#ifndef __INCLUDE_SOUND_ATMEL_ABDAC_H
11#define __INCLUDE_SOUND_ATMEL_ABDAC_H
12
13#include <linux/dw_dmac.h>
14
15/**
16 * struct atmel_abdac_pdata - board specific ABDAC configuration
17 * @dws: DMA slave interface to use for sound playback.
18 */
19struct atmel_abdac_pdata {
20 struct dw_dma_slave dws;
21};
22
23#endif /* __INCLUDE_SOUND_ATMEL_ABDAC_H */
diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
new file mode 100644
index 000000000000..e6aabdb45865
--- /dev/null
+++ b/include/sound/atmel-ac97c.h
@@ -0,0 +1,40 @@
1/*
2 * Driver for the Atmel AC97C controller
3 *
4 * Copyright (C) 2005-2009 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10#ifndef __INCLUDE_SOUND_ATMEL_AC97C_H
11#define __INCLUDE_SOUND_ATMEL_AC97C_H
12
13#include <linux/dw_dmac.h>
14
15#define AC97C_CAPTURE 0x01
16#define AC97C_PLAYBACK 0x02
17#define AC97C_BOTH (AC97C_CAPTURE | AC97C_PLAYBACK)
18
19/**
20 * struct atmel_ac97c_pdata - board specific AC97C configuration
21 * @rx_dws: DMA slave interface to use for sound capture.
22 * @tx_dws: DMA slave interface to use for sound playback.
23 * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
24 * optional to use, set to -ENODEV if not in use. AC97 layer will
25 * try to do a software reset of the external codec anyway.
26 * @flags: Flags for which directions should be enabled.
27 *
28 * If the user do not want to use a DMA channel for playback or capture, i.e.
29 * only one feature is required on the board. The slave for playback or capture
30 * can be set to NULL. The AC97C driver will take use of this when setting up
31 * the sound streams.
32 */
33struct ac97c_platform_data {
34 struct dw_dma_slave rx_dws;
35 struct dw_dma_slave tx_dws;
36 unsigned int flags;
37 int reset_pin;
38};
39
40#endif /* __INCLUDE_SOUND_ATMEL_AC97C_H */
diff --git a/include/sound/control.h b/include/sound/control.h
index 4721b4bba053..ef96f07aa03b 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -171,6 +171,54 @@ int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol,
171 */ 171 */
172struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, 172struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
173 const unsigned int *tlv); 173 const unsigned int *tlv);
174int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave); 174int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
175 175 unsigned int flags);
176/* optional flags for slave */
177#define SND_CTL_SLAVE_NEED_UPDATE (1 << 0)
178
179/**
180 * snd_ctl_add_slave - Add a virtual slave control
181 * @master: vmaster element
182 * @slave: slave element to add
183 *
184 * Add a virtual slave control to the given master element created via
185 * snd_ctl_create_virtual_master() beforehand.
186 * Returns zero if successful or a negative error code.
187 *
188 * All slaves must be the same type (returning the same information
189 * via info callback). The fucntion doesn't check it, so it's your
190 * responsibility.
191 *
192 * Also, some additional limitations:
193 * at most two channels,
194 * logarithmic volume control (dB level) thus no linear volume,
195 * master can only attenuate the volume without gain
196 */
197static inline int
198snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
199{
200 return _snd_ctl_add_slave(master, slave, 0);
201}
202
203/**
204 * snd_ctl_add_slave_uncached - Add a virtual slave control
205 * @master: vmaster element
206 * @slave: slave element to add
207 *
208 * Add a virtual slave control to the given master.
209 * Unlike snd_ctl_add_slave(), the element added via this function
210 * is supposed to have volatile values, and get callback is called
211 * at each time quried from the master.
212 *
213 * When the control peeks the hardware values directly and the value
214 * can be changed by other means than the put callback of the element,
215 * this function should be used to keep the value always up-to-date.
216 */
217static inline int
218snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
219 struct snd_kcontrol *slave)
220{
221 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE);
222}
223
176#endif /* __SOUND_CONTROL_H */ 224#endif /* __SOUND_CONTROL_H */
diff --git a/include/sound/core.h b/include/sound/core.h
index f632484bc743..3dea79829acc 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -97,9 +97,9 @@ struct snd_device {
97 97
98struct snd_monitor_file { 98struct snd_monitor_file {
99 struct file *file; 99 struct file *file;
100 struct snd_monitor_file *next;
101 const struct file_operations *disconnected_f_op; 100 const struct file_operations *disconnected_f_op;
102 struct list_head shutdown_list; 101 struct list_head shutdown_list; /* still need to shutdown */
102 struct list_head list; /* link of monitor files */
103}; 103};
104 104
105/* main structure for soundcard */ 105/* main structure for soundcard */
@@ -134,7 +134,7 @@ struct snd_card {
134 struct snd_info_entry *proc_id; /* the card id */ 134 struct snd_info_entry *proc_id; /* the card id */
135 struct proc_dir_entry *proc_root_link; /* number link to real id */ 135 struct proc_dir_entry *proc_root_link; /* number link to real id */
136 136
137 struct snd_monitor_file *files; /* all files associated to this card */ 137 struct list_head files_list; /* all files associated to this card */
138 struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown 138 struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown
139 state */ 139 state */
140 spinlock_t files_lock; /* lock the files for this card */ 140 spinlock_t files_lock; /* lock the files for this card */
@@ -296,8 +296,20 @@ int snd_card_locked(int card);
296extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd); 296extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
297#endif 297#endif
298 298
299int snd_card_create(int idx, const char *id,
300 struct module *module, int extra_size,
301 struct snd_card **card_ret);
302
303static inline __deprecated
299struct snd_card *snd_card_new(int idx, const char *id, 304struct snd_card *snd_card_new(int idx, const char *id,
300 struct module *module, int extra_size); 305 struct module *module, int extra_size)
306{
307 struct snd_card *card;
308 if (snd_card_create(idx, id, module, extra_size, &card) < 0)
309 return NULL;
310 return card;
311}
312
301int snd_card_disconnect(struct snd_card *card); 313int snd_card_disconnect(struct snd_card *card);
302int snd_card_free(struct snd_card *card); 314int snd_card_free(struct snd_card *card);
303int snd_card_free_when_closed(struct snd_card *card); 315int snd_card_free_when_closed(struct snd_card *card);
@@ -446,21 +458,33 @@ static inline int __snd_bug_on(int cond)
446struct snd_pci_quirk { 458struct snd_pci_quirk {
447 unsigned short subvendor; /* PCI subvendor ID */ 459 unsigned short subvendor; /* PCI subvendor ID */
448 unsigned short subdevice; /* PCI subdevice ID */ 460 unsigned short subdevice; /* PCI subdevice ID */
461 unsigned short subdevice_mask; /* bitmask to match */
449 int value; /* value */ 462 int value; /* value */
450#ifdef CONFIG_SND_DEBUG_VERBOSE 463#ifdef CONFIG_SND_DEBUG_VERBOSE
451 const char *name; /* name of the device (optional) */ 464 const char *name; /* name of the device (optional) */
452#endif 465#endif
453}; 466};
454 467
455#define _SND_PCI_QUIRK_ID(vend,dev) \ 468#define _SND_PCI_QUIRK_ID_MASK(vend, mask, dev) \
456 .subvendor = (vend), .subdevice = (dev) 469 .subvendor = (vend), .subdevice = (dev), .subdevice_mask = (mask)
470#define _SND_PCI_QUIRK_ID(vend, dev) \
471 _SND_PCI_QUIRK_ID_MASK(vend, 0xffff, dev)
457#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)} 472#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)}
458#ifdef CONFIG_SND_DEBUG_VERBOSE 473#ifdef CONFIG_SND_DEBUG_VERBOSE
459#define SND_PCI_QUIRK(vend,dev,xname,val) \ 474#define SND_PCI_QUIRK(vend,dev,xname,val) \
460 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)} 475 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)}
476#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
477 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val), .name = (xname)}
478#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
479 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), \
480 .value = (val), .name = (xname)}
461#else 481#else
462#define SND_PCI_QUIRK(vend,dev,xname,val) \ 482#define SND_PCI_QUIRK(vend,dev,xname,val) \
463 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)} 483 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
484#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val) \
485 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)}
486#define SND_PCI_QUIRK_VENDOR(vend, xname, val) \
487 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)}
464#endif 488#endif
465 489
466const struct snd_pci_quirk * 490const struct snd_pci_quirk *
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 10ee28eac018..6a664c3f7c1e 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1,6 +1,8 @@
1#ifndef __SOUND_EMU10K1_H 1#ifndef __SOUND_EMU10K1_H
2#define __SOUND_EMU10K1_H 2#define __SOUND_EMU10K1_H
3 3
4#include <linux/types.h>
5
4/* 6/*
5 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
6 * Creative Labs, Inc. 8 * Creative Labs, Inc.
@@ -34,6 +36,7 @@
34#include <sound/timer.h> 36#include <sound/timer.h>
35#include <linux/interrupt.h> 37#include <linux/interrupt.h>
36#include <linux/mutex.h> 38#include <linux/mutex.h>
39
37#include <asm/io.h> 40#include <asm/io.h>
38 41
39/* ------------------- DEFINES -------------------- */ 42/* ------------------- DEFINES -------------------- */
@@ -2171,7 +2174,7 @@ struct snd_emu10k1_fx8010_code {
2171 char name[128]; 2174 char name[128];
2172 2175
2173 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ 2176 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
2174 u_int32_t __user *gpr_map; /* initializers */ 2177 __u32 __user *gpr_map; /* initializers */
2175 2178
2176 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ 2179 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
2177 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */ 2180 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
@@ -2184,11 +2187,11 @@ struct snd_emu10k1_fx8010_code {
2184 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */ 2187 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
2185 2188
2186 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ 2189 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
2187 u_int32_t __user *tram_data_map; /* data initializers */ 2190 __u32 __user *tram_data_map; /* data initializers */
2188 u_int32_t __user *tram_addr_map; /* map initializers */ 2191 __u32 __user *tram_addr_map; /* map initializers */
2189 2192
2190 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ 2193 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
2191 u_int32_t __user *code; /* one instruction - 64 bits */ 2194 __u32 __user *code; /* one instruction - 64 bits */
2192}; 2195};
2193 2196
2194struct snd_emu10k1_fx8010_tram { 2197struct snd_emu10k1_fx8010_tram {
diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h
index d9eea013c753..8c05e47a4090 100644
--- a/include/sound/hwdep.h
+++ b/include/sound/hwdep.h
@@ -27,18 +27,28 @@
27 27
28struct snd_hwdep; 28struct snd_hwdep;
29 29
30/* hwdep file ops; all ops can be NULL */
30struct snd_hwdep_ops { 31struct snd_hwdep_ops {
31 long long (*llseek) (struct snd_hwdep *hw, struct file * file, long long offset, int orig); 32 long long (*llseek)(struct snd_hwdep *hw, struct file *file,
32 long (*read) (struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset); 33 long long offset, int orig);
33 long (*write) (struct snd_hwdep *hw, const char __user *buf, long count, loff_t *offset); 34 long (*read)(struct snd_hwdep *hw, char __user *buf,
34 int (*open) (struct snd_hwdep * hw, struct file * file); 35 long count, loff_t *offset);
35 int (*release) (struct snd_hwdep *hw, struct file * file); 36 long (*write)(struct snd_hwdep *hw, const char __user *buf,
36 unsigned int (*poll) (struct snd_hwdep *hw, struct file * file, poll_table * wait); 37 long count, loff_t *offset);
37 int (*ioctl) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg); 38 int (*open)(struct snd_hwdep *hw, struct file * file);
38 int (*ioctl_compat) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg); 39 int (*release)(struct snd_hwdep *hw, struct file * file);
39 int (*mmap) (struct snd_hwdep *hw, struct file * file, struct vm_area_struct * vma); 40 unsigned int (*poll)(struct snd_hwdep *hw, struct file *file,
40 int (*dsp_status) (struct snd_hwdep *hw, struct snd_hwdep_dsp_status *status); 41 poll_table *wait);
41 int (*dsp_load) (struct snd_hwdep *hw, struct snd_hwdep_dsp_image *image); 42 int (*ioctl)(struct snd_hwdep *hw, struct file *file,
43 unsigned int cmd, unsigned long arg);
44 int (*ioctl_compat)(struct snd_hwdep *hw, struct file *file,
45 unsigned int cmd, unsigned long arg);
46 int (*mmap)(struct snd_hwdep *hw, struct file *file,
47 struct vm_area_struct *vma);
48 int (*dsp_status)(struct snd_hwdep *hw,
49 struct snd_hwdep_dsp_status *status);
50 int (*dsp_load)(struct snd_hwdep *hw,
51 struct snd_hwdep_dsp_image *image);
42}; 52};
43 53
44struct snd_hwdep { 54struct snd_hwdep {
@@ -61,9 +71,9 @@ struct snd_hwdep {
61 void (*private_free) (struct snd_hwdep *hwdep); 71 void (*private_free) (struct snd_hwdep *hwdep);
62 72
63 struct mutex open_mutex; 73 struct mutex open_mutex;
64 int used; 74 int used; /* reference counter */
65 unsigned int dsp_loaded; 75 unsigned int dsp_loaded; /* bit fields of loaded dsp indices */
66 unsigned int exclusive: 1; 76 unsigned int exclusive:1; /* exclusive access mode */
67}; 77};
68 78
69extern int snd_hwdep_new(struct snd_card *card, char *id, int device, 79extern int snd_hwdep_new(struct snd_card *card, char *id, int device,
diff --git a/include/sound/jack.h b/include/sound/jack.h
index 2e0315cdd0d6..f236e426a706 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -30,6 +30,9 @@ struct input_dev;
30/** 30/**
31 * Jack types which can be reported. These values are used as a 31 * Jack types which can be reported. These values are used as a
32 * bitmask. 32 * bitmask.
33 *
34 * Note that this must be kept in sync with the lookup table in
35 * sound/core/jack.c.
33 */ 36 */
34enum snd_jack_types { 37enum snd_jack_types {
35 SND_JACK_HEADPHONE = 0x0001, 38 SND_JACK_HEADPHONE = 0x0001,
@@ -37,6 +40,8 @@ enum snd_jack_types {
37 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE, 40 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
38 SND_JACK_LINEOUT = 0x0004, 41 SND_JACK_LINEOUT = 0x0004,
39 SND_JACK_MECHANICAL = 0x0008, /* If detected separately */ 42 SND_JACK_MECHANICAL = 0x0008, /* If detected separately */
43 SND_JACK_VIDEOOUT = 0x0010,
44 SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
40}; 45};
41 46
42struct snd_jack { 47struct snd_jack {
@@ -45,6 +50,8 @@ struct snd_jack {
45 int type; 50 int type;
46 const char *id; 51 const char *id;
47 char name[100]; 52 char name[100];
53 void *private_data;
54 void (*private_free)(struct snd_jack *);
48}; 55};
49 56
50#ifdef CONFIG_SND_JACK 57#ifdef CONFIG_SND_JACK
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 40c5a6fa6bcd..c17296891617 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -268,7 +268,8 @@ struct snd_pcm_runtime {
268 int overrange; 268 int overrange;
269 snd_pcm_uframes_t avail_max; 269 snd_pcm_uframes_t avail_max;
270 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ 270 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */
271 snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time*/ 271 snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */
272 unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */
272 273
273 /* -- HW params -- */ 274 /* -- HW params -- */
274 snd_pcm_access_t access; /* access mode */ 275 snd_pcm_access_t access; /* access mode */
@@ -364,7 +365,6 @@ struct snd_pcm_substream {
364 /* -- timer section -- */ 365 /* -- timer section -- */
365 struct snd_timer *timer; /* timer */ 366 struct snd_timer *timer; /* timer */
366 unsigned timer_running: 1; /* time is running */ 367 unsigned timer_running: 1; /* time is running */
367 spinlock_t timer_lock;
368 /* -- next substream -- */ 368 /* -- next substream -- */
369 struct snd_pcm_substream *next; 369 struct snd_pcm_substream *next;
370 /* -- linked substreams -- */ 370 /* -- linked substreams -- */
@@ -451,7 +451,7 @@ struct snd_pcm_notify {
451 451
452extern const struct file_operations snd_pcm_f_ops[2]; 452extern const struct file_operations snd_pcm_f_ops[2];
453 453
454int snd_pcm_new(struct snd_card *card, char *id, int device, 454int snd_pcm_new(struct snd_card *card, const char *id, int device,
455 int playback_count, int capture_count, 455 int playback_count, int capture_count,
456 struct snd_pcm **rpcm); 456 struct snd_pcm **rpcm);
457int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); 457int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index b550a416d075..c23c26585700 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -42,7 +42,6 @@
42#define SNDRV_RAWMIDI_LFLG_INPUT (1<<1) 42#define SNDRV_RAWMIDI_LFLG_INPUT (1<<1)
43#define SNDRV_RAWMIDI_LFLG_OPEN (3<<0) 43#define SNDRV_RAWMIDI_LFLG_OPEN (3<<0)
44#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) 44#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2)
45#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3)
46 45
47struct snd_rawmidi; 46struct snd_rawmidi;
48struct snd_rawmidi_substream; 47struct snd_rawmidi_substream;
diff --git a/include/sound/sb.h b/include/sound/sb.h
index 85f93c5fe1e4..4e62ee1e4115 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -249,6 +249,7 @@ struct snd_sb {
249#define SB_ALS4000_3D_AUTO_MUTE 0x52 249#define SB_ALS4000_3D_AUTO_MUTE 0x52
250#define SB_ALS4000_ANALOG_BLOCK_CTRL 0x53 250#define SB_ALS4000_ANALOG_BLOCK_CTRL 0x53
251#define SB_ALS4000_3D_DELAYLINE_PATTERN 0x54 251#define SB_ALS4000_3D_DELAYLINE_PATTERN 0x54
252#define SB_ALS4000_CR3_CONFIGURATION 0xc3 /* bit 7 is Digital Loop Enable */
252#define SB_ALS4000_QSOUND 0xdb 253#define SB_ALS4000_QSOUND 0xdb
253 254
254/* IRQ setting bitmap */ 255/* IRQ setting bitmap */
@@ -330,7 +331,8 @@ enum {
330 SB_MIX_DOUBLE, 331 SB_MIX_DOUBLE,
331 SB_MIX_INPUT_SW, 332 SB_MIX_INPUT_SW,
332 SB_MIX_CAPTURE_PRO, 333 SB_MIX_CAPTURE_PRO,
333 SB_MIX_CAPTURE_DT019X 334 SB_MIX_CAPTURE_DT019X,
335 SB_MIX_MONO_CAPTURE_ALS4K
334}; 336};
335 337
336#define SB_MIXVAL_DOUBLE(left_reg, right_reg, left_shift, right_shift, mask) \ 338#define SB_MIXVAL_DOUBLE(left_reg, right_reg, left_shift, right_shift, mask) \
diff --git a/include/sound/sfnt_info.h b/include/sound/sfnt_info.h
index 5d1ab9c4950f..1bce7fd1725f 100644
--- a/include/sound/sfnt_info.h
+++ b/include/sound/sfnt_info.h
@@ -202,13 +202,11 @@ struct snd_emux_misc_mode {
202 int value2; /* reserved */ 202 int value2; /* reserved */
203}; 203};
204 204
205enum { 205#define SNDRV_EMUX_IOCTL_VERSION _IOR('H', 0x80, unsigned int)
206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int), 206#define SNDRV_EMUX_IOCTL_LOAD_PATCH _IOWR('H', 0x81, struct soundfont_patch_info)
207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info), 207#define SNDRV_EMUX_IOCTL_RESET_SAMPLES _IO('H', 0x82)
208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82), 208#define SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES _IO('H', 0x83)
209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83), 209#define SNDRV_EMUX_IOCTL_MEM_AVAIL _IOW('H', 0x84, int)
210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int), 210#define SNDRV_EMUX_IOCTL_MISC_MODE _IOWR('H', 0x84, struct snd_emux_misc_mode)
211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode),
212};
213 211
214#endif /* __SOUND_SFNT_INFO_H */ 212#endif /* __SOUND_SFNT_INFO_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 24247f763608..13676472ddfc 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -203,7 +203,7 @@ struct snd_soc_dai {
203 int (*resume)(struct snd_soc_dai *dai); 203 int (*resume)(struct snd_soc_dai *dai);
204 204
205 /* ops */ 205 /* ops */
206 struct snd_soc_dai_ops ops; 206 struct snd_soc_dai_ops *ops;
207 207
208 /* DAI capabilities */ 208 /* DAI capabilities */
209 struct snd_soc_pcm_stream capture; 209 struct snd_soc_pcm_stream capture;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index dfa804958820..a7def6a9a030 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -76,6 +76,11 @@
76 wcontrols, wncontrols)\ 76 wcontrols, wncontrols)\
77{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 77{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
78 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} 78 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
79#define SND_SOC_DAPM_MIXER_NAMED_CTL(wname, wreg, wshift, winvert, \
80 wcontrols, wncontrols)\
81{ .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \
82 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \
83 .num_kcontrols = wncontrols}
79#define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \ 84#define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \
80{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ 85{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
81 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0} 86 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0}
@@ -101,6 +106,11 @@
101{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 106{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
102 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \ 107 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
103 .event = wevent, .event_flags = wflags} 108 .event = wevent, .event_flags = wflags}
109#define SND_SOC_DAPM_MIXER_NAMED_CTL_E(wname, wreg, wshift, winvert, \
110 wcontrols, wncontrols, wevent, wflags) \
111{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
112 .invert = winvert, .kcontrols = wcontrols, \
113 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags}
104#define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \ 114#define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \
105{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ 115{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
106 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \ 116 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \
@@ -182,6 +192,12 @@
182 .get = snd_soc_dapm_get_value_enum_double, \ 192 .get = snd_soc_dapm_get_value_enum_double, \
183 .put = snd_soc_dapm_put_value_enum_double, \ 193 .put = snd_soc_dapm_put_value_enum_double, \
184 .private_value = (unsigned long)&xenum } 194 .private_value = (unsigned long)&xenum }
195#define SOC_DAPM_PIN_SWITCH(xname) \
196{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
197 .info = snd_soc_dapm_info_pin_switch, \
198 .get = snd_soc_dapm_get_pin_switch, \
199 .put = snd_soc_dapm_put_pin_switch, \
200 .private_value = (unsigned long)xname }
185 201
186/* dapm stream operations */ 202/* dapm stream operations */
187#define SND_SOC_DAPM_STREAM_NOP 0x0 203#define SND_SOC_DAPM_STREAM_NOP 0x0
@@ -228,6 +244,12 @@ int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
228 struct snd_ctl_elem_value *ucontrol); 244 struct snd_ctl_elem_value *ucontrol);
229int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, 245int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
230 struct snd_ctl_elem_value *ucontrol); 246 struct snd_ctl_elem_value *ucontrol);
247int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol,
248 struct snd_ctl_elem_info *uinfo);
249int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
250 struct snd_ctl_elem_value *uncontrol);
251int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
252 struct snd_ctl_elem_value *uncontrol);
231int snd_soc_dapm_new_control(struct snd_soc_codec *codec, 253int snd_soc_dapm_new_control(struct snd_soc_codec *codec,
232 const struct snd_soc_dapm_widget *widget); 254 const struct snd_soc_dapm_widget *widget);
233int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, 255int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
@@ -250,10 +272,10 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev,
250int snd_soc_dapm_sys_add(struct device *dev); 272int snd_soc_dapm_sys_add(struct device *dev);
251 273
252/* dapm audio pin control and status */ 274/* dapm audio pin control and status */
253int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin); 275int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin);
254int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin); 276int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin);
255int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, char *pin); 277int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin);
256int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin); 278int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin);
257int snd_soc_dapm_sync(struct snd_soc_codec *codec); 279int snd_soc_dapm_sync(struct snd_soc_codec *codec);
258 280
259/* dapm widget types */ 281/* dapm widget types */
@@ -263,6 +285,7 @@ enum snd_soc_dapm_type {
263 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ 285 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
264 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ 286 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */
265 snd_soc_dapm_mixer, /* mixes several analog signals together */ 287 snd_soc_dapm_mixer, /* mixes several analog signals together */
288 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
266 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ 289 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
267 snd_soc_dapm_adc, /* analog to digital converter */ 290 snd_soc_dapm_adc, /* analog to digital converter */
268 snd_soc_dapm_dac, /* digital to analog converter */ 291 snd_soc_dapm_dac, /* digital to analog converter */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 24593ac3ea19..a40bc6f316fc 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -16,6 +16,8 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/workqueue.h> 18#include <linux/workqueue.h>
19#include <linux/interrupt.h>
20#include <linux/kernel.h>
19#include <sound/core.h> 21#include <sound/core.h>
20#include <sound/pcm.h> 22#include <sound/pcm.h>
21#include <sound/control.h> 23#include <sound/control.h>
@@ -154,6 +156,8 @@ enum snd_soc_bias_level {
154 SND_SOC_BIAS_OFF, 156 SND_SOC_BIAS_OFF,
155}; 157};
156 158
159struct snd_jack;
160struct snd_soc_card;
157struct snd_soc_device; 161struct snd_soc_device;
158struct snd_soc_pcm_stream; 162struct snd_soc_pcm_stream;
159struct snd_soc_ops; 163struct snd_soc_ops;
@@ -164,6 +168,11 @@ struct snd_soc_platform;
164struct snd_soc_codec; 168struct snd_soc_codec;
165struct soc_enum; 169struct soc_enum;
166struct snd_soc_ac97_ops; 170struct snd_soc_ac97_ops;
171struct snd_soc_jack;
172struct snd_soc_jack_pin;
173#ifdef CONFIG_GPIOLIB
174struct snd_soc_jack_gpio;
175#endif
167 176
168typedef int (*hw_write_t)(void *,const char* ,int); 177typedef int (*hw_write_t)(void *,const char* ,int);
169typedef int (*hw_read_t)(void *,char* ,int); 178typedef int (*hw_read_t)(void *,char* ,int);
@@ -184,6 +193,19 @@ int snd_soc_init_card(struct snd_soc_device *socdev);
184int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, 193int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
185 const struct snd_pcm_hardware *hw); 194 const struct snd_pcm_hardware *hw);
186 195
196/* Jack reporting */
197int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
198 struct snd_soc_jack *jack);
199void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
200int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
201 struct snd_soc_jack_pin *pins);
202#ifdef CONFIG_GPIOLIB
203int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
204 struct snd_soc_jack_gpio *gpios);
205void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
206 struct snd_soc_jack_gpio *gpios);
207#endif
208
187/* codec IO */ 209/* codec IO */
188#define snd_soc_read(codec, reg) codec->read(codec, reg) 210#define snd_soc_read(codec, reg) codec->read(codec, reg)
189#define snd_soc_write(codec, reg, value) codec->write(codec, reg, value) 211#define snd_soc_write(codec, reg, value) codec->write(codec, reg, value)
@@ -203,6 +225,8 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
203 */ 225 */
204struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, 226struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
205 void *data, char *long_name); 227 void *data, char *long_name);
228int snd_soc_add_controls(struct snd_soc_codec *codec,
229 const struct snd_kcontrol_new *controls, int num_controls);
206int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, 230int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
207 struct snd_ctl_elem_info *uinfo); 231 struct snd_ctl_elem_info *uinfo);
208int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, 232int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
@@ -237,6 +261,48 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
237int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, 261int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
238 struct snd_ctl_elem_value *ucontrol); 262 struct snd_ctl_elem_value *ucontrol);
239 263
264/**
265 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
266 *
267 * @pin: name of the pin to update
268 * @mask: bits to check for in reported jack status
269 * @invert: if non-zero then pin is enabled when status is not reported
270 */
271struct snd_soc_jack_pin {
272 struct list_head list;
273 const char *pin;
274 int mask;
275 bool invert;
276};
277
278/**
279 * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
280 *
281 * @gpio: gpio number
282 * @name: gpio name
283 * @report: value to report when jack detected
284 * @invert: report presence in low state
285 * @debouce_time: debouce time in ms
286 */
287#ifdef CONFIG_GPIOLIB
288struct snd_soc_jack_gpio {
289 unsigned int gpio;
290 const char *name;
291 int report;
292 int invert;
293 int debounce_time;
294 struct snd_soc_jack *jack;
295 struct work_struct work;
296};
297#endif
298
299struct snd_soc_jack {
300 struct snd_jack *jack;
301 struct snd_soc_card *card;
302 struct list_head pins;
303 int status;
304};
305
240/* SoC PCM stream information */ 306/* SoC PCM stream information */
241struct snd_soc_pcm_stream { 307struct snd_soc_pcm_stream {
242 char *stream_name; 308 char *stream_name;
@@ -384,6 +450,8 @@ struct snd_soc_card {
384 450
385 struct snd_soc_device *socdev; 451 struct snd_soc_device *socdev;
386 452
453 struct snd_soc_codec *codec;
454
387 struct snd_soc_platform *platform; 455 struct snd_soc_platform *platform;
388 struct delayed_work delayed_work; 456 struct delayed_work delayed_work;
389 struct work_struct deferred_resume_work; 457 struct work_struct deferred_resume_work;
@@ -393,7 +461,6 @@ struct snd_soc_card {
393struct snd_soc_device { 461struct snd_soc_device {
394 struct device *dev; 462 struct device *dev;
395 struct snd_soc_card *card; 463 struct snd_soc_card *card;
396 struct snd_soc_codec *codec;
397 struct snd_soc_codec_device *codec_dev; 464 struct snd_soc_codec_device *codec_dev;
398 void *codec_data; 465 void *codec_data;
399}; 466};
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index 426899e529c5..5718a02d3afb 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -22,8 +22,9 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/videodev.h> 25#include <linux/videodev2.h>
26#include <media/v4l2-dev.h> 26#include <media/v4l2-dev.h>
27#include <media/v4l2-ioctl.h>
27 28
28struct snd_tea575x; 29struct snd_tea575x;
29 30
@@ -35,11 +36,10 @@ struct snd_tea575x_ops {
35 36
36struct snd_tea575x { 37struct snd_tea575x {
37 struct snd_card *card; 38 struct snd_card *card;
38 struct video_device vd; /* video device */ 39 struct video_device *vd; /* video device */
39 struct v4l2_file_operations fops;
40 int dev_nr; /* requested device number + 1 */ 40 int dev_nr; /* requested device number + 1 */
41 int vd_registered; /* video device is registered */
42 int tea5759; /* 5759 chip is present */ 41 int tea5759; /* 5759 chip is present */
42 int mute; /* Device is muted? */
43 unsigned int freq_fixup; /* crystal onboard */ 43 unsigned int freq_fixup; /* crystal onboard */
44 unsigned int val; /* hw value */ 44 unsigned int val; /* hw value */
45 unsigned long freq; /* frequency */ 45 unsigned long freq; /* frequency */
diff --git a/include/sound/uda1341.h b/include/sound/uda1341.h
deleted file mode 100644
index 110d5dc3a2be..000000000000
--- a/include/sound/uda1341.h
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * linux/include/linux/l3/uda1341.h
3 *
4 * Philips UDA1341 mixer device driver for ALSA
5 *
6 * Copyright (c) 2002 Tomas Kasparek <tomas.kasparek@seznam.cz>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License.
10 *
11 * History:
12 *
13 * 2002-03-13 Tomas Kasparek Initial release - based on uda1341.h from OSS
14 * 2002-03-30 Tomas Kasparek Proc filesystem support, complete mixer and DSP
15 * features support
16 */
17
18#define UDA1341_ALSA_NAME "snd-uda1341"
19
20/*
21 * Default rate set after inicialization
22 */
23#define AUDIO_RATE_DEFAULT 44100
24
25/*
26 * UDA1341 L3 address and command types
27 */
28#define UDA1341_L3ADDR 5
29#define UDA1341_DATA0 (UDA1341_L3ADDR << 2 | 0)
30#define UDA1341_DATA1 (UDA1341_L3ADDR << 2 | 1)
31#define UDA1341_STATUS (UDA1341_L3ADDR << 2 | 2)
32
33enum uda1341_onoff {
34 OFF=0,
35 ON,
36};
37
38enum uda1341_format {
39 I2S=0,
40 LSB16,
41 LSB18,
42 LSB20,
43 MSB,
44 LSB16MSB,
45 LSB18MSB,
46 LSB20MSB,
47};
48
49enum uda1341_fs {
50 F512=0,
51 F384,
52 F256,
53 Funused,
54};
55
56enum uda1341_peak {
57 BEFORE=0,
58 AFTER,
59};
60
61enum uda1341_filter {
62 FLAT=0,
63 MIN,
64 MIN2,
65 MAX,
66};
67
68enum uda1341_mixer {
69 DOUBLE,
70 LINE,
71 MIC,
72 MIXER,
73};
74
75enum uda1341_deemp {
76 NONE,
77 D32,
78 D44,
79 D48,
80};
81
82enum uda1341_config {
83 CMD_READ_REG = 0,
84 CMD_RESET,
85 CMD_FS,
86 CMD_FORMAT,
87 CMD_OGAIN,
88 CMD_IGAIN,
89 CMD_DAC,
90 CMD_ADC,
91 CMD_VOLUME,
92 CMD_BASS,
93 CMD_TREBBLE,
94 CMD_PEAK,
95 CMD_DEEMP,
96 CMD_MUTE,
97 CMD_FILTER,
98 CMD_CH1,
99 CMD_CH2,
100 CMD_MIC,
101 CMD_MIXER,
102 CMD_AGC,
103 CMD_IG,
104 CMD_AGC_TIME,
105 CMD_AGC_LEVEL,
106#ifdef CONFIG_PM
107 CMD_SUSPEND,
108 CMD_RESUME,
109#endif
110 CMD_LAST,
111};
112
113enum write_through {
114 //used in update_bits (write_cfg) to avoid l3_write - just update local copy of regs.
115 REGS_ONLY=0,
116 //update local regs and write value to uda1341 - do l3_write
117 FLUSH,
118};
119
120int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clnt);
121
122/*
123 * Local variables:
124 * indent-tabs-mode: t
125 * End:
126 */
diff --git a/include/sound/version.h b/include/sound/version.h
index 2b48237e23bf..a7e74e23ad2e 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h */ 1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.18a" 2#define CONFIG_SND_VERSION "1.0.19"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/sound/wss.h b/include/sound/wss.h
index fd01f22825cd..6d65f322f1d5 100644
--- a/include/sound/wss.h
+++ b/include/sound/wss.h
@@ -154,6 +154,7 @@ int snd_wss_create(struct snd_card *card,
154 unsigned short hardware, 154 unsigned short hardware,
155 unsigned short hwshare, 155 unsigned short hwshare,
156 struct snd_wss **rchip); 156 struct snd_wss **rchip);
157int snd_wss_free(struct snd_wss *chip);
157int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm); 158int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
158int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer); 159int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer);
159int snd_wss_mixer(struct snd_wss *chip); 160int snd_wss_mixer(struct snd_wss *chip);
diff --git a/include/trace/block.h b/include/trace/block.h
index 25c6a1fd5b77..25b7068b819e 100644
--- a/include/trace/block.h
+++ b/include/trace/block.h
@@ -5,72 +5,72 @@
5#include <linux/tracepoint.h> 5#include <linux/tracepoint.h>
6 6
7DECLARE_TRACE(block_rq_abort, 7DECLARE_TRACE(block_rq_abort,
8 TPPROTO(struct request_queue *q, struct request *rq), 8 TP_PROTO(struct request_queue *q, struct request *rq),
9 TPARGS(q, rq)); 9 TP_ARGS(q, rq));
10 10
11DECLARE_TRACE(block_rq_insert, 11DECLARE_TRACE(block_rq_insert,
12 TPPROTO(struct request_queue *q, struct request *rq), 12 TP_PROTO(struct request_queue *q, struct request *rq),
13 TPARGS(q, rq)); 13 TP_ARGS(q, rq));
14 14
15DECLARE_TRACE(block_rq_issue, 15DECLARE_TRACE(block_rq_issue,
16 TPPROTO(struct request_queue *q, struct request *rq), 16 TP_PROTO(struct request_queue *q, struct request *rq),
17 TPARGS(q, rq)); 17 TP_ARGS(q, rq));
18 18
19DECLARE_TRACE(block_rq_requeue, 19DECLARE_TRACE(block_rq_requeue,
20 TPPROTO(struct request_queue *q, struct request *rq), 20 TP_PROTO(struct request_queue *q, struct request *rq),
21 TPARGS(q, rq)); 21 TP_ARGS(q, rq));
22 22
23DECLARE_TRACE(block_rq_complete, 23DECLARE_TRACE(block_rq_complete,
24 TPPROTO(struct request_queue *q, struct request *rq), 24 TP_PROTO(struct request_queue *q, struct request *rq),
25 TPARGS(q, rq)); 25 TP_ARGS(q, rq));
26 26
27DECLARE_TRACE(block_bio_bounce, 27DECLARE_TRACE(block_bio_bounce,
28 TPPROTO(struct request_queue *q, struct bio *bio), 28 TP_PROTO(struct request_queue *q, struct bio *bio),
29 TPARGS(q, bio)); 29 TP_ARGS(q, bio));
30 30
31DECLARE_TRACE(block_bio_complete, 31DECLARE_TRACE(block_bio_complete,
32 TPPROTO(struct request_queue *q, struct bio *bio), 32 TP_PROTO(struct request_queue *q, struct bio *bio),
33 TPARGS(q, bio)); 33 TP_ARGS(q, bio));
34 34
35DECLARE_TRACE(block_bio_backmerge, 35DECLARE_TRACE(block_bio_backmerge,
36 TPPROTO(struct request_queue *q, struct bio *bio), 36 TP_PROTO(struct request_queue *q, struct bio *bio),
37 TPARGS(q, bio)); 37 TP_ARGS(q, bio));
38 38
39DECLARE_TRACE(block_bio_frontmerge, 39DECLARE_TRACE(block_bio_frontmerge,
40 TPPROTO(struct request_queue *q, struct bio *bio), 40 TP_PROTO(struct request_queue *q, struct bio *bio),
41 TPARGS(q, bio)); 41 TP_ARGS(q, bio));
42 42
43DECLARE_TRACE(block_bio_queue, 43DECLARE_TRACE(block_bio_queue,
44 TPPROTO(struct request_queue *q, struct bio *bio), 44 TP_PROTO(struct request_queue *q, struct bio *bio),
45 TPARGS(q, bio)); 45 TP_ARGS(q, bio));
46 46
47DECLARE_TRACE(block_getrq, 47DECLARE_TRACE(block_getrq,
48 TPPROTO(struct request_queue *q, struct bio *bio, int rw), 48 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
49 TPARGS(q, bio, rw)); 49 TP_ARGS(q, bio, rw));
50 50
51DECLARE_TRACE(block_sleeprq, 51DECLARE_TRACE(block_sleeprq,
52 TPPROTO(struct request_queue *q, struct bio *bio, int rw), 52 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
53 TPARGS(q, bio, rw)); 53 TP_ARGS(q, bio, rw));
54 54
55DECLARE_TRACE(block_plug, 55DECLARE_TRACE(block_plug,
56 TPPROTO(struct request_queue *q), 56 TP_PROTO(struct request_queue *q),
57 TPARGS(q)); 57 TP_ARGS(q));
58 58
59DECLARE_TRACE(block_unplug_timer, 59DECLARE_TRACE(block_unplug_timer,
60 TPPROTO(struct request_queue *q), 60 TP_PROTO(struct request_queue *q),
61 TPARGS(q)); 61 TP_ARGS(q));
62 62
63DECLARE_TRACE(block_unplug_io, 63DECLARE_TRACE(block_unplug_io,
64 TPPROTO(struct request_queue *q), 64 TP_PROTO(struct request_queue *q),
65 TPARGS(q)); 65 TP_ARGS(q));
66 66
67DECLARE_TRACE(block_split, 67DECLARE_TRACE(block_split,
68 TPPROTO(struct request_queue *q, struct bio *bio, unsigned int pdu), 68 TP_PROTO(struct request_queue *q, struct bio *bio, unsigned int pdu),
69 TPARGS(q, bio, pdu)); 69 TP_ARGS(q, bio, pdu));
70 70
71DECLARE_TRACE(block_remap, 71DECLARE_TRACE(block_remap,
72 TPPROTO(struct request_queue *q, struct bio *bio, dev_t dev, 72 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
73 sector_t from, sector_t to), 73 sector_t from, sector_t to),
74 TPARGS(q, bio, dev, from, to)); 74 TP_ARGS(q, bio, dev, from, to));
75 75
76#endif 76#endif
diff --git a/include/trace/irq.h b/include/trace/irq.h
new file mode 100644
index 000000000000..ff5d4495dc37
--- /dev/null
+++ b/include/trace/irq.h
@@ -0,0 +1,9 @@
1#ifndef _TRACE_IRQ_H
2#define _TRACE_IRQ_H
3
4#include <linux/interrupt.h>
5#include <linux/tracepoint.h>
6
7#include <trace/irq_event_types.h>
8
9#endif
diff --git a/include/trace/irq_event_types.h b/include/trace/irq_event_types.h
new file mode 100644
index 000000000000..85964ebd47ec
--- /dev/null
+++ b/include/trace/irq_event_types.h
@@ -0,0 +1,55 @@
1
2/* use <trace/irq.h> instead */
3#ifndef TRACE_FORMAT
4# error Do not include this file directly.
5# error Unless you know what you are doing.
6#endif
7
8#undef TRACE_SYSTEM
9#define TRACE_SYSTEM irq
10
11/*
12 * Tracepoint for entry of interrupt handler:
13 */
14TRACE_FORMAT(irq_handler_entry,
15 TP_PROTO(int irq, struct irqaction *action),
16 TP_ARGS(irq, action),
17 TP_FMT("irq=%d handler=%s", irq, action->name)
18 );
19
20/*
21 * Tracepoint for return of an interrupt handler:
22 */
23TRACE_EVENT(irq_handler_exit,
24
25 TP_PROTO(int irq, struct irqaction *action, int ret),
26
27 TP_ARGS(irq, action, ret),
28
29 TP_STRUCT__entry(
30 __field( int, irq )
31 __field( int, ret )
32 ),
33
34 TP_fast_assign(
35 __entry->irq = irq;
36 __entry->ret = ret;
37 ),
38
39 TP_printk("irq=%d return=%s",
40 __entry->irq, __entry->ret ? "handled" : "unhandled")
41);
42
43TRACE_FORMAT(softirq_entry,
44 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
45 TP_ARGS(h, vec),
46 TP_FMT("softirq=%d action=%s", (int)(h - vec), softirq_to_name[h-vec])
47 );
48
49TRACE_FORMAT(softirq_exit,
50 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
51 TP_ARGS(h, vec),
52 TP_FMT("softirq=%d action=%s", (int)(h - vec), softirq_to_name[h-vec])
53 );
54
55#undef TRACE_SYSTEM
diff --git a/include/trace/kmemtrace.h b/include/trace/kmemtrace.h
new file mode 100644
index 000000000000..28ee69f9cd46
--- /dev/null
+++ b/include/trace/kmemtrace.h
@@ -0,0 +1,63 @@
1/*
2 * Copyright (C) 2008 Eduard - Gabriel Munteanu
3 *
4 * This file is released under GPL version 2.
5 */
6
7#ifndef _LINUX_KMEMTRACE_H
8#define _LINUX_KMEMTRACE_H
9
10#ifdef __KERNEL__
11
12#include <linux/tracepoint.h>
13#include <linux/types.h>
14
15#ifdef CONFIG_KMEMTRACE
16extern void kmemtrace_init(void);
17#else
18static inline void kmemtrace_init(void)
19{
20}
21#endif
22
23DECLARE_TRACE(kmalloc,
24 TP_PROTO(unsigned long call_site,
25 const void *ptr,
26 size_t bytes_req,
27 size_t bytes_alloc,
28 gfp_t gfp_flags),
29 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags));
30DECLARE_TRACE(kmem_cache_alloc,
31 TP_PROTO(unsigned long call_site,
32 const void *ptr,
33 size_t bytes_req,
34 size_t bytes_alloc,
35 gfp_t gfp_flags),
36 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags));
37DECLARE_TRACE(kmalloc_node,
38 TP_PROTO(unsigned long call_site,
39 const void *ptr,
40 size_t bytes_req,
41 size_t bytes_alloc,
42 gfp_t gfp_flags,
43 int node),
44 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node));
45DECLARE_TRACE(kmem_cache_alloc_node,
46 TP_PROTO(unsigned long call_site,
47 const void *ptr,
48 size_t bytes_req,
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));
59
60#endif /* __KERNEL__ */
61
62#endif /* _LINUX_KMEMTRACE_H */
63
diff --git a/include/trace/lockdep.h b/include/trace/lockdep.h
new file mode 100644
index 000000000000..5ca67df87f2a
--- /dev/null
+++ b/include/trace/lockdep.h
@@ -0,0 +1,9 @@
1#ifndef _TRACE_LOCKDEP_H
2#define _TRACE_LOCKDEP_H
3
4#include <linux/lockdep.h>
5#include <linux/tracepoint.h>
6
7#include <trace/lockdep_event_types.h>
8
9#endif
diff --git a/include/trace/lockdep_event_types.h b/include/trace/lockdep_event_types.h
new file mode 100644
index 000000000000..adccfcd2ec8f
--- /dev/null
+++ b/include/trace/lockdep_event_types.h
@@ -0,0 +1,44 @@
1
2#ifndef TRACE_FORMAT
3# error Do not include this file directly.
4# error Unless you know what you are doing.
5#endif
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM lock
9
10#ifdef CONFIG_LOCKDEP
11
12TRACE_FORMAT(lock_acquire,
13 TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
14 int trylock, int read, int check,
15 struct lockdep_map *next_lock, unsigned long ip),
16 TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
17 TP_FMT("%s%s%s", trylock ? "try " : "",
18 read ? "read " : "", lock->name)
19 );
20
21TRACE_FORMAT(lock_release,
22 TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip),
23 TP_ARGS(lock, nested, ip),
24 TP_FMT("%s", lock->name)
25 );
26
27#ifdef CONFIG_LOCK_STAT
28
29TRACE_FORMAT(lock_contended,
30 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
31 TP_ARGS(lock, ip),
32 TP_FMT("%s", lock->name)
33 );
34
35TRACE_FORMAT(lock_acquired,
36 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
37 TP_ARGS(lock, ip),
38 TP_FMT("%s", lock->name)
39 );
40
41#endif
42#endif
43
44#undef TRACE_SYSTEM
diff --git a/include/trace/power.h b/include/trace/power.h
new file mode 100644
index 000000000000..ef204666e983
--- /dev/null
+++ b/include/trace/power.h
@@ -0,0 +1,32 @@
1#ifndef _TRACE_POWER_H
2#define _TRACE_POWER_H
3
4#include <linux/ktime.h>
5#include <linux/tracepoint.h>
6
7enum {
8 POWER_NONE = 0,
9 POWER_CSTATE = 1,
10 POWER_PSTATE = 2,
11};
12
13struct power_trace {
14 ktime_t stamp;
15 ktime_t end;
16 int type;
17 int state;
18};
19
20DECLARE_TRACE(power_start,
21 TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state),
22 TP_ARGS(it, type, state));
23
24DECLARE_TRACE(power_mark,
25 TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state),
26 TP_ARGS(it, type, state));
27
28DECLARE_TRACE(power_end,
29 TP_PROTO(struct power_trace *it),
30 TP_ARGS(it));
31
32#endif /* _TRACE_POWER_H */
diff --git a/include/trace/sched.h b/include/trace/sched.h
index 0d81098ee9fc..4e372a1a29bf 100644
--- a/include/trace/sched.h
+++ b/include/trace/sched.h
@@ -4,53 +4,6 @@
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/tracepoint.h> 5#include <linux/tracepoint.h>
6 6
7DECLARE_TRACE(sched_kthread_stop, 7#include <trace/sched_event_types.h>
8 TPPROTO(struct task_struct *t),
9 TPARGS(t));
10
11DECLARE_TRACE(sched_kthread_stop_ret,
12 TPPROTO(int ret),
13 TPARGS(ret));
14
15DECLARE_TRACE(sched_wait_task,
16 TPPROTO(struct rq *rq, struct task_struct *p),
17 TPARGS(rq, p));
18
19DECLARE_TRACE(sched_wakeup,
20 TPPROTO(struct rq *rq, struct task_struct *p, int success),
21 TPARGS(rq, p, success));
22
23DECLARE_TRACE(sched_wakeup_new,
24 TPPROTO(struct rq *rq, struct task_struct *p, int success),
25 TPARGS(rq, p, success));
26
27DECLARE_TRACE(sched_switch,
28 TPPROTO(struct rq *rq, struct task_struct *prev,
29 struct task_struct *next),
30 TPARGS(rq, prev, next));
31
32DECLARE_TRACE(sched_migrate_task,
33 TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
34 TPARGS(p, orig_cpu, dest_cpu));
35
36DECLARE_TRACE(sched_process_free,
37 TPPROTO(struct task_struct *p),
38 TPARGS(p));
39
40DECLARE_TRACE(sched_process_exit,
41 TPPROTO(struct task_struct *p),
42 TPARGS(p));
43
44DECLARE_TRACE(sched_process_wait,
45 TPPROTO(struct pid *pid),
46 TPARGS(pid));
47
48DECLARE_TRACE(sched_process_fork,
49 TPPROTO(struct task_struct *parent, struct task_struct *child),
50 TPARGS(parent, child));
51
52DECLARE_TRACE(sched_signal_send,
53 TPPROTO(int sig, struct task_struct *p),
54 TPARGS(sig, p));
55 8
56#endif 9#endif
diff --git a/include/trace/sched_event_types.h b/include/trace/sched_event_types.h
new file mode 100644
index 000000000000..63547dc1125f
--- /dev/null
+++ b/include/trace/sched_event_types.h
@@ -0,0 +1,337 @@
1
2/* use <trace/sched.h> instead */
3#ifndef TRACE_EVENT
4# error Do not include this file directly.
5# error Unless you know what you are doing.
6#endif
7
8#undef TRACE_SYSTEM
9#define TRACE_SYSTEM sched
10
11/*
12 * Tracepoint for calling kthread_stop, performed to end a kthread:
13 */
14TRACE_EVENT(sched_kthread_stop,
15
16 TP_PROTO(struct task_struct *t),
17
18 TP_ARGS(t),
19
20 TP_STRUCT__entry(
21 __array( char, comm, TASK_COMM_LEN )
22 __field( pid_t, pid )
23 ),
24
25 TP_fast_assign(
26 memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
27 __entry->pid = t->pid;
28 ),
29
30 TP_printk("task %s:%d", __entry->comm, __entry->pid)
31);
32
33/*
34 * Tracepoint for the return value of the kthread stopping:
35 */
36TRACE_EVENT(sched_kthread_stop_ret,
37
38 TP_PROTO(int ret),
39
40 TP_ARGS(ret),
41
42 TP_STRUCT__entry(
43 __field( int, ret )
44 ),
45
46 TP_fast_assign(
47 __entry->ret = ret;
48 ),
49
50 TP_printk("ret %d", __entry->ret)
51);
52
53/*
54 * Tracepoint for waiting on task to unschedule:
55 *
56 * (NOTE: the 'rq' argument is not used by generic trace events,
57 * but used by the latency tracer plugin. )
58 */
59TRACE_EVENT(sched_wait_task,
60
61 TP_PROTO(struct rq *rq, struct task_struct *p),
62
63 TP_ARGS(rq, p),
64
65 TP_STRUCT__entry(
66 __array( char, comm, TASK_COMM_LEN )
67 __field( pid_t, pid )
68 __field( int, prio )
69 ),
70
71 TP_fast_assign(
72 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
73 __entry->pid = p->pid;
74 __entry->prio = p->prio;
75 ),
76
77 TP_printk("task %s:%d [%d]",
78 __entry->comm, __entry->pid, __entry->prio)
79);
80
81/*
82 * Tracepoint for waking up a task:
83 *
84 * (NOTE: the 'rq' argument is not used by generic trace events,
85 * but used by the latency tracer plugin. )
86 */
87TRACE_EVENT(sched_wakeup,
88
89 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
90
91 TP_ARGS(rq, p, success),
92
93 TP_STRUCT__entry(
94 __array( char, comm, TASK_COMM_LEN )
95 __field( pid_t, pid )
96 __field( int, prio )
97 __field( int, success )
98 ),
99
100 TP_fast_assign(
101 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
102 __entry->pid = p->pid;
103 __entry->prio = p->prio;
104 __entry->success = success;
105 ),
106
107 TP_printk("task %s:%d [%d] success=%d",
108 __entry->comm, __entry->pid, __entry->prio,
109 __entry->success)
110);
111
112/*
113 * Tracepoint for waking up a new task:
114 *
115 * (NOTE: the 'rq' argument is not used by generic trace events,
116 * but used by the latency tracer plugin. )
117 */
118TRACE_EVENT(sched_wakeup_new,
119
120 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
121
122 TP_ARGS(rq, p, success),
123
124 TP_STRUCT__entry(
125 __array( char, comm, TASK_COMM_LEN )
126 __field( pid_t, pid )
127 __field( int, prio )
128 __field( int, success )
129 ),
130
131 TP_fast_assign(
132 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
133 __entry->pid = p->pid;
134 __entry->prio = p->prio;
135 __entry->success = success;
136 ),
137
138 TP_printk("task %s:%d [%d] success=%d",
139 __entry->comm, __entry->pid, __entry->prio,
140 __entry->success)
141);
142
143/*
144 * Tracepoint for task switches, performed by the scheduler:
145 *
146 * (NOTE: the 'rq' argument is not used by generic trace events,
147 * but used by the latency tracer plugin. )
148 */
149TRACE_EVENT(sched_switch,
150
151 TP_PROTO(struct rq *rq, struct task_struct *prev,
152 struct task_struct *next),
153
154 TP_ARGS(rq, prev, next),
155
156 TP_STRUCT__entry(
157 __array( char, prev_comm, TASK_COMM_LEN )
158 __field( pid_t, prev_pid )
159 __field( int, prev_prio )
160 __array( char, next_comm, TASK_COMM_LEN )
161 __field( pid_t, next_pid )
162 __field( int, next_prio )
163 ),
164
165 TP_fast_assign(
166 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
167 __entry->prev_pid = prev->pid;
168 __entry->prev_prio = prev->prio;
169 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
170 __entry->next_pid = next->pid;
171 __entry->next_prio = next->prio;
172 ),
173
174 TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
175 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
176 __entry->next_comm, __entry->next_pid, __entry->next_prio)
177);
178
179/*
180 * Tracepoint for a task being migrated:
181 */
182TRACE_EVENT(sched_migrate_task,
183
184 TP_PROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
185
186 TP_ARGS(p, orig_cpu, dest_cpu),
187
188 TP_STRUCT__entry(
189 __array( char, comm, TASK_COMM_LEN )
190 __field( pid_t, pid )
191 __field( int, prio )
192 __field( int, orig_cpu )
193 __field( int, dest_cpu )
194 ),
195
196 TP_fast_assign(
197 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
198 __entry->pid = p->pid;
199 __entry->prio = p->prio;
200 __entry->orig_cpu = orig_cpu;
201 __entry->dest_cpu = dest_cpu;
202 ),
203
204 TP_printk("task %s:%d [%d] from: %d to: %d",
205 __entry->comm, __entry->pid, __entry->prio,
206 __entry->orig_cpu, __entry->dest_cpu)
207);
208
209/*
210 * Tracepoint for freeing a task:
211 */
212TRACE_EVENT(sched_process_free,
213
214 TP_PROTO(struct task_struct *p),
215
216 TP_ARGS(p),
217
218 TP_STRUCT__entry(
219 __array( char, comm, TASK_COMM_LEN )
220 __field( pid_t, pid )
221 __field( int, prio )
222 ),
223
224 TP_fast_assign(
225 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
226 __entry->pid = p->pid;
227 __entry->prio = p->prio;
228 ),
229
230 TP_printk("task %s:%d [%d]",
231 __entry->comm, __entry->pid, __entry->prio)
232);
233
234/*
235 * Tracepoint for a task exiting:
236 */
237TRACE_EVENT(sched_process_exit,
238
239 TP_PROTO(struct task_struct *p),
240
241 TP_ARGS(p),
242
243 TP_STRUCT__entry(
244 __array( char, comm, TASK_COMM_LEN )
245 __field( pid_t, pid )
246 __field( int, prio )
247 ),
248
249 TP_fast_assign(
250 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
251 __entry->pid = p->pid;
252 __entry->prio = p->prio;
253 ),
254
255 TP_printk("task %s:%d [%d]",
256 __entry->comm, __entry->pid, __entry->prio)
257);
258
259/*
260 * Tracepoint for a waiting task:
261 */
262TRACE_EVENT(sched_process_wait,
263
264 TP_PROTO(struct pid *pid),
265
266 TP_ARGS(pid),
267
268 TP_STRUCT__entry(
269 __array( char, comm, TASK_COMM_LEN )
270 __field( pid_t, pid )
271 __field( int, prio )
272 ),
273
274 TP_fast_assign(
275 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
276 __entry->pid = pid_nr(pid);
277 __entry->prio = current->prio;
278 ),
279
280 TP_printk("task %s:%d [%d]",
281 __entry->comm, __entry->pid, __entry->prio)
282);
283
284/*
285 * Tracepoint for do_fork:
286 */
287TRACE_EVENT(sched_process_fork,
288
289 TP_PROTO(struct task_struct *parent, struct task_struct *child),
290
291 TP_ARGS(parent, child),
292
293 TP_STRUCT__entry(
294 __array( char, parent_comm, TASK_COMM_LEN )
295 __field( pid_t, parent_pid )
296 __array( char, child_comm, TASK_COMM_LEN )
297 __field( pid_t, child_pid )
298 ),
299
300 TP_fast_assign(
301 memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);
302 __entry->parent_pid = parent->pid;
303 memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);
304 __entry->child_pid = child->pid;
305 ),
306
307 TP_printk("parent %s:%d child %s:%d",
308 __entry->parent_comm, __entry->parent_pid,
309 __entry->child_comm, __entry->child_pid)
310);
311
312/*
313 * Tracepoint for sending a signal:
314 */
315TRACE_EVENT(sched_signal_send,
316
317 TP_PROTO(int sig, struct task_struct *p),
318
319 TP_ARGS(sig, p),
320
321 TP_STRUCT__entry(
322 __field( int, sig )
323 __array( char, comm, TASK_COMM_LEN )
324 __field( pid_t, pid )
325 ),
326
327 TP_fast_assign(
328 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
329 __entry->pid = p->pid;
330 __entry->sig = sig;
331 ),
332
333 TP_printk("sig: %d task %s:%d",
334 __entry->sig, __entry->comm, __entry->pid)
335);
336
337#undef TRACE_SYSTEM
diff --git a/include/trace/skb.h b/include/trace/skb.h
new file mode 100644
index 000000000000..b66206d9be72
--- /dev/null
+++ b/include/trace/skb.h
@@ -0,0 +1,11 @@
1#ifndef _TRACE_SKB_H_
2#define _TRACE_SKB_H_
3
4#include <linux/skbuff.h>
5#include <linux/tracepoint.h>
6
7DECLARE_TRACE(kfree_skb,
8 TP_PROTO(struct sk_buff *skb, void *location),
9 TP_ARGS(skb, location));
10
11#endif
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/trace/trace_event_types.h b/include/trace/trace_event_types.h
new file mode 100644
index 000000000000..df56f5694be6
--- /dev/null
+++ b/include/trace/trace_event_types.h
@@ -0,0 +1,5 @@
1/* trace/<type>_event_types.h here */
2
3#include <trace/sched_event_types.h>
4#include <trace/irq_event_types.h>
5#include <trace/lockdep_event_types.h>
diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
new file mode 100644
index 000000000000..fd13750ca4ba
--- /dev/null
+++ b/include/trace/trace_events.h
@@ -0,0 +1,5 @@
1/* trace/<type>.h here */
2
3#include <trace/sched.h>
4#include <trace/irq.h>
5#include <trace/lockdep.h>
diff --git a/include/trace/workqueue.h b/include/trace/workqueue.h
new file mode 100644
index 000000000000..7626523deeba
--- /dev/null
+++ b/include/trace/workqueue.h
@@ -0,0 +1,25 @@
1#ifndef __TRACE_WORKQUEUE_H
2#define __TRACE_WORKQUEUE_H
3
4#include <linux/tracepoint.h>
5#include <linux/workqueue.h>
6#include <linux/sched.h>
7
8DECLARE_TRACE(workqueue_insertion,
9 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
10 TP_ARGS(wq_thread, work));
11
12DECLARE_TRACE(workqueue_execution,
13 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
14 TP_ARGS(wq_thread, work));
15
16/* Trace the creation of one workqueue thread on a cpu */
17DECLARE_TRACE(workqueue_creation,
18 TP_PROTO(struct task_struct *wq_thread, int cpu),
19 TP_ARGS(wq_thread, cpu));
20
21DECLARE_TRACE(workqueue_destruction,
22 TP_PROTO(struct task_struct *wq_thread),
23 TP_ARGS(wq_thread));
24
25#endif /* __TRACE_WORKQUEUE_H */
diff --git a/include/video/aty128.h b/include/video/aty128.h
index 51ac69f05bdc..f0851e3bb7cc 100644
--- a/include/video/aty128.h
+++ b/include/video/aty128.h
@@ -415,7 +415,7 @@
415#define PWR_MGT_SLOWDOWN_MCLK 0x00002000 415#define PWR_MGT_SLOWDOWN_MCLK 0x00002000
416 416
417#define PMI_PMSCR_REG 0x60 417#define PMI_PMSCR_REG 0x60
418 418
419/* used by ATI bug fix for hardware ROM */ 419/* used by ATI bug fix for hardware ROM */
420#define RAGE128_MPP_TB_CONFIG 0x01c0 420#define RAGE128_MPP_TB_CONFIG 0x01c0
421 421
diff --git a/include/video/broadsheetfb.h b/include/video/broadsheetfb.h
new file mode 100644
index 000000000000..a758534c0272
--- /dev/null
+++ b/include/video/broadsheetfb.h
@@ -0,0 +1,59 @@
1/*
2 * broadsheetfb.h - definitions for the broadsheet framebuffer driver
3 *
4 * Copyright (C) 2008 by Jaya Kumar
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
8 * more details.
9 *
10 */
11
12#ifndef _LINUX_BROADSHEETFB_H_
13#define _LINUX_BROADSHEETFB_H_
14
15/* Broadsheet command defines */
16#define BS_CMD_INIT_SYS_RUN 0x06
17#define BS_CMD_INIT_DSPE_CFG 0x09
18#define BS_CMD_INIT_DSPE_TMG 0x0A
19#define BS_CMD_INIT_ROTMODE 0x0B
20#define BS_CMD_RD_REG 0x10
21#define BS_CMD_WR_REG 0x11
22#define BS_CMD_LD_IMG 0x20
23#define BS_CMD_LD_IMG_AREA 0x22
24#define BS_CMD_LD_IMG_END 0x23
25#define BS_CMD_WAIT_DSPE_TRG 0x28
26#define BS_CMD_WAIT_DSPE_FREND 0x29
27#define BS_CMD_RD_WFM_INFO 0x30
28#define BS_CMD_UPD_INIT 0x32
29#define BS_CMD_UPD_FULL 0x33
30#define BS_CMD_UPD_GDRV_CLR 0x37
31
32/* Broadsheet pin interface specific defines */
33#define BS_CS 0x01
34#define BS_DC 0x02
35#define BS_WR 0x03
36
37/* struct used by broadsheet. board specific stuff comes from *board */
38struct broadsheetfb_par {
39 struct fb_info *info;
40 struct broadsheet_board *board;
41 void (*write_reg)(struct broadsheetfb_par *, u16 reg, u16 val);
42 u16 (*read_reg)(struct broadsheetfb_par *, u16 reg);
43 wait_queue_head_t waitq;
44};
45
46/* board specific routines */
47struct broadsheet_board {
48 struct module *owner;
49 int (*init)(struct broadsheetfb_par *);
50 int (*wait_for_rdy)(struct broadsheetfb_par *);
51 void (*set_ctl)(struct broadsheetfb_par *, unsigned char, u8);
52 void (*set_hdb)(struct broadsheetfb_par *, u16);
53 u16 (*get_hdb)(struct broadsheetfb_par *);
54 void (*cleanup)(struct broadsheetfb_par *);
55 int (*get_panel_type)(void);
56 int (*setup_irq)(struct fb_info *);
57};
58
59#endif
diff --git a/include/video/cirrus.h b/include/video/cirrus.h
index b2776b6c8679..9a5e9ee30782 100644
--- a/include/video/cirrus.h
+++ b/include/video/cirrus.h
@@ -32,7 +32,6 @@
32#define CL_VSSM2 0x3c3 /* Motherboard Sleep */ 32#define CL_VSSM2 0x3c3 /* Motherboard Sleep */
33 33
34/*** VGA Sequencer Registers ***/ 34/*** VGA Sequencer Registers ***/
35#define CL_SEQR0 0x0 /* Reset */
36/* the following are from the "extension registers" group */ 35/* the following are from the "extension registers" group */
37#define CL_SEQR6 0x6 /* Unlock ALL Extensions */ 36#define CL_SEQR6 0x6 /* Unlock ALL Extensions */
38#define CL_SEQR7 0x7 /* Extended Sequencer Mode */ 37#define CL_SEQR7 0x7 /* Extended Sequencer Mode */
@@ -71,6 +70,7 @@
71#define CL_CRT1B 0x1b /* Extended Display Controls */ 70#define CL_CRT1B 0x1b /* Extended Display Controls */
72#define CL_CRT1C 0x1c /* Sync adjust and genlock register */ 71#define CL_CRT1C 0x1c /* Sync adjust and genlock register */
73#define CL_CRT1D 0x1d /* Overlay Extended Control register */ 72#define CL_CRT1D 0x1d /* Overlay Extended Control register */
73#define CL_CRT1E 0x1e /* Another overflow register */
74#define CL_CRT25 0x25 /* Part Status Register */ 74#define CL_CRT25 0x25 /* Part Status Register */
75#define CL_CRT27 0x27 /* ID Register */ 75#define CL_CRT27 0x27 /* ID Register */
76#define CL_CRT51 0x51 /* P4 disable "flicker fixer" */ 76#define CL_CRT51 0x51 /* P4 disable "flicker fixer" */
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/newport.h b/include/video/newport.h
index 1f5ebeaa818f..001b935e71c4 100644
--- a/include/video/newport.h
+++ b/include/video/newport.h
@@ -453,7 +453,7 @@ static __inline__ int newport_wait(struct newport_regs *regs)
453{ 453{
454 int t = BUSY_TIMEOUT; 454 int t = BUSY_TIMEOUT;
455 455
456 while (t--) 456 while (--t)
457 if (!(regs->cset.status & NPORT_STAT_GBUSY)) 457 if (!(regs->cset.status & NPORT_STAT_GBUSY))
458 break; 458 break;
459 return !t; 459 return !t;
@@ -463,7 +463,7 @@ static __inline__ int newport_bfwait(struct newport_regs *regs)
463{ 463{
464 int t = BUSY_TIMEOUT; 464 int t = BUSY_TIMEOUT;
465 465
466 while (t--) 466 while (--t)
467 if(!(regs->cset.status & NPORT_STAT_BBUSY)) 467 if(!(regs->cset.status & NPORT_STAT_BBUSY))
468 break; 468 break;
469 return !t; 469 return !t;
diff --git a/include/video/radeon.h b/include/video/radeon.h
index e072b16b39ab..56b188abfb54 100644
--- a/include/video/radeon.h
+++ b/include/video/radeon.h
@@ -5,12 +5,12 @@
5#define RADEON_REGSIZE 0x4000 5#define RADEON_REGSIZE 0x4000
6 6
7 7
8#define MM_INDEX 0x0000 8#define MM_INDEX 0x0000
9#define MM_DATA 0x0004 9#define MM_DATA 0x0004
10#define BUS_CNTL 0x0030 10#define BUS_CNTL 0x0030
11#define HI_STAT 0x004C 11#define HI_STAT 0x004C
12#define BUS_CNTL1 0x0034 12#define BUS_CNTL1 0x0034
13#define I2C_CNTL_1 0x0094 13#define I2C_CNTL_1 0x0094
14#define CNFG_CNTL 0x00E0 14#define CNFG_CNTL 0x00E0
15#define CNFG_MEMSIZE 0x00F8 15#define CNFG_MEMSIZE 0x00F8
16#define CNFG_APER_0_BASE 0x0100 16#define CNFG_APER_0_BASE 0x0100
@@ -18,8 +18,8 @@
18#define CNFG_APER_SIZE 0x0108 18#define CNFG_APER_SIZE 0x0108
19#define CNFG_REG_1_BASE 0x010C 19#define CNFG_REG_1_BASE 0x010C
20#define CNFG_REG_APER_SIZE 0x0110 20#define CNFG_REG_APER_SIZE 0x0110
21#define PAD_AGPINPUT_DELAY 0x0164 21#define PAD_AGPINPUT_DELAY 0x0164
22#define PAD_CTLR_STRENGTH 0x0168 22#define PAD_CTLR_STRENGTH 0x0168
23#define PAD_CTLR_UPDATE 0x016C 23#define PAD_CTLR_UPDATE 0x016C
24#define PAD_CTLR_MISC 0x0aa0 24#define PAD_CTLR_MISC 0x0aa0
25#define AGP_CNTL 0x0174 25#define AGP_CNTL 0x0174
@@ -27,171 +27,171 @@
27#define CAP0_TRIG_CNTL 0x0950 27#define CAP0_TRIG_CNTL 0x0950
28#define CAP1_TRIG_CNTL 0x09c0 28#define CAP1_TRIG_CNTL 0x09c0
29#define VIPH_CONTROL 0x0C40 29#define VIPH_CONTROL 0x0C40
30#define VENDOR_ID 0x0F00 30#define VENDOR_ID 0x0F00
31#define DEVICE_ID 0x0F02 31#define DEVICE_ID 0x0F02
32#define COMMAND 0x0F04 32#define COMMAND 0x0F04
33#define STATUS 0x0F06 33#define STATUS 0x0F06
34#define REVISION_ID 0x0F08 34#define REVISION_ID 0x0F08
35#define REGPROG_INF 0x0F09 35#define REGPROG_INF 0x0F09
36#define SUB_CLASS 0x0F0A 36#define SUB_CLASS 0x0F0A
37#define BASE_CODE 0x0F0B 37#define BASE_CODE 0x0F0B
38#define CACHE_LINE 0x0F0C 38#define CACHE_LINE 0x0F0C
39#define LATENCY 0x0F0D 39#define LATENCY 0x0F0D
40#define HEADER 0x0F0E 40#define HEADER 0x0F0E
41#define BIST 0x0F0F 41#define BIST 0x0F0F
42#define REG_MEM_BASE 0x0F10 42#define REG_MEM_BASE 0x0F10
43#define REG_IO_BASE 0x0F14 43#define REG_IO_BASE 0x0F14
44#define REG_REG_BASE 0x0F18 44#define REG_REG_BASE 0x0F18
45#define ADAPTER_ID 0x0F2C 45#define ADAPTER_ID 0x0F2C
46#define BIOS_ROM 0x0F30 46#define BIOS_ROM 0x0F30
47#define CAPABILITIES_PTR 0x0F34 47#define CAPABILITIES_PTR 0x0F34
48#define INTERRUPT_LINE 0x0F3C 48#define INTERRUPT_LINE 0x0F3C
49#define INTERRUPT_PIN 0x0F3D 49#define INTERRUPT_PIN 0x0F3D
50#define MIN_GRANT 0x0F3E 50#define MIN_GRANT 0x0F3E
51#define MAX_LATENCY 0x0F3F 51#define MAX_LATENCY 0x0F3F
52#define ADAPTER_ID_W 0x0F4C 52#define ADAPTER_ID_W 0x0F4C
53#define PMI_CAP_ID 0x0F50 53#define PMI_CAP_ID 0x0F50
54#define PMI_NXT_CAP_PTR 0x0F51 54#define PMI_NXT_CAP_PTR 0x0F51
55#define PMI_PMC_REG 0x0F52 55#define PMI_PMC_REG 0x0F52
56#define PM_STATUS 0x0F54 56#define PM_STATUS 0x0F54
57#define PMI_DATA 0x0F57 57#define PMI_DATA 0x0F57
58#define AGP_CAP_ID 0x0F58 58#define AGP_CAP_ID 0x0F58
59#define AGP_STATUS 0x0F5C 59#define AGP_STATUS 0x0F5C
60#define AGP_COMMAND 0x0F60 60#define AGP_COMMAND 0x0F60
61#define AIC_CTRL 0x01D0 61#define AIC_CTRL 0x01D0
62#define AIC_STAT 0x01D4 62#define AIC_STAT 0x01D4
63#define AIC_PT_BASE 0x01D8 63#define AIC_PT_BASE 0x01D8
64#define AIC_LO_ADDR 0x01DC 64#define AIC_LO_ADDR 0x01DC
65#define AIC_HI_ADDR 0x01E0 65#define AIC_HI_ADDR 0x01E0
66#define AIC_TLB_ADDR 0x01E4 66#define AIC_TLB_ADDR 0x01E4
67#define AIC_TLB_DATA 0x01E8 67#define AIC_TLB_DATA 0x01E8
68#define DAC_CNTL 0x0058 68#define DAC_CNTL 0x0058
69#define DAC_CNTL2 0x007c 69#define DAC_CNTL2 0x007c
70#define CRTC_GEN_CNTL 0x0050 70#define CRTC_GEN_CNTL 0x0050
71#define MEM_CNTL 0x0140 71#define MEM_CNTL 0x0140
72#define MC_CNTL 0x0140 72#define MC_CNTL 0x0140
73#define EXT_MEM_CNTL 0x0144 73#define EXT_MEM_CNTL 0x0144
74#define MC_TIMING_CNTL 0x0144 74#define MC_TIMING_CNTL 0x0144
75#define MC_AGP_LOCATION 0x014C 75#define MC_AGP_LOCATION 0x014C
76#define MEM_IO_CNTL_A0 0x0178 76#define MEM_IO_CNTL_A0 0x0178
77#define MEM_REFRESH_CNTL 0x0178 77#define MEM_REFRESH_CNTL 0x0178
78#define MEM_INIT_LATENCY_TIMER 0x0154 78#define MEM_INIT_LATENCY_TIMER 0x0154
79#define MC_INIT_GFX_LAT_TIMER 0x0154 79#define MC_INIT_GFX_LAT_TIMER 0x0154
80#define MEM_SDRAM_MODE_REG 0x0158 80#define MEM_SDRAM_MODE_REG 0x0158
81#define AGP_BASE 0x0170 81#define AGP_BASE 0x0170
82#define MEM_IO_CNTL_A1 0x017C 82#define MEM_IO_CNTL_A1 0x017C
83#define MC_READ_CNTL_AB 0x017C 83#define MC_READ_CNTL_AB 0x017C
84#define MEM_IO_CNTL_B0 0x0180 84#define MEM_IO_CNTL_B0 0x0180
85#define MC_INIT_MISC_LAT_TIMER 0x0180 85#define MC_INIT_MISC_LAT_TIMER 0x0180
86#define MEM_IO_CNTL_B1 0x0184 86#define MEM_IO_CNTL_B1 0x0184
87#define MC_IOPAD_CNTL 0x0184 87#define MC_IOPAD_CNTL 0x0184
88#define MC_DEBUG 0x0188 88#define MC_DEBUG 0x0188
89#define MC_STATUS 0x0150 89#define MC_STATUS 0x0150
90#define MEM_IO_OE_CNTL 0x018C 90#define MEM_IO_OE_CNTL 0x018C
91#define MC_CHIP_IO_OE_CNTL_AB 0x018C 91#define MC_CHIP_IO_OE_CNTL_AB 0x018C
92#define MC_FB_LOCATION 0x0148 92#define MC_FB_LOCATION 0x0148
93#define HOST_PATH_CNTL 0x0130 93#define HOST_PATH_CNTL 0x0130
94#define MEM_VGA_WP_SEL 0x0038 94#define MEM_VGA_WP_SEL 0x0038
95#define MEM_VGA_RP_SEL 0x003C 95#define MEM_VGA_RP_SEL 0x003C
96#define HDP_DEBUG 0x0138 96#define HDP_DEBUG 0x0138
97#define SW_SEMAPHORE 0x013C 97#define SW_SEMAPHORE 0x013C
98#define CRTC2_GEN_CNTL 0x03f8 98#define CRTC2_GEN_CNTL 0x03f8
99#define CRTC2_DISPLAY_BASE_ADDR 0x033c 99#define CRTC2_DISPLAY_BASE_ADDR 0x033c
100#define SURFACE_CNTL 0x0B00 100#define SURFACE_CNTL 0x0B00
101#define SURFACE0_LOWER_BOUND 0x0B04 101#define SURFACE0_LOWER_BOUND 0x0B04
102#define SURFACE1_LOWER_BOUND 0x0B14 102#define SURFACE1_LOWER_BOUND 0x0B14
103#define SURFACE2_LOWER_BOUND 0x0B24 103#define SURFACE2_LOWER_BOUND 0x0B24
104#define SURFACE3_LOWER_BOUND 0x0B34 104#define SURFACE3_LOWER_BOUND 0x0B34
105#define SURFACE4_LOWER_BOUND 0x0B44 105#define SURFACE4_LOWER_BOUND 0x0B44
106#define SURFACE5_LOWER_BOUND 0x0B54 106#define SURFACE5_LOWER_BOUND 0x0B54
107#define SURFACE6_LOWER_BOUND 0x0B64 107#define SURFACE6_LOWER_BOUND 0x0B64
108#define SURFACE7_LOWER_BOUND 0x0B74 108#define SURFACE7_LOWER_BOUND 0x0B74
109#define SURFACE0_UPPER_BOUND 0x0B08 109#define SURFACE0_UPPER_BOUND 0x0B08
110#define SURFACE1_UPPER_BOUND 0x0B18 110#define SURFACE1_UPPER_BOUND 0x0B18
111#define SURFACE2_UPPER_BOUND 0x0B28 111#define SURFACE2_UPPER_BOUND 0x0B28
112#define SURFACE3_UPPER_BOUND 0x0B38 112#define SURFACE3_UPPER_BOUND 0x0B38
113#define SURFACE4_UPPER_BOUND 0x0B48 113#define SURFACE4_UPPER_BOUND 0x0B48
114#define SURFACE5_UPPER_BOUND 0x0B58 114#define SURFACE5_UPPER_BOUND 0x0B58
115#define SURFACE6_UPPER_BOUND 0x0B68 115#define SURFACE6_UPPER_BOUND 0x0B68
116#define SURFACE7_UPPER_BOUND 0x0B78 116#define SURFACE7_UPPER_BOUND 0x0B78
117#define SURFACE0_INFO 0x0B0C 117#define SURFACE0_INFO 0x0B0C
118#define SURFACE1_INFO 0x0B1C 118#define SURFACE1_INFO 0x0B1C
119#define SURFACE2_INFO 0x0B2C 119#define SURFACE2_INFO 0x0B2C
120#define SURFACE3_INFO 0x0B3C 120#define SURFACE3_INFO 0x0B3C
121#define SURFACE4_INFO 0x0B4C 121#define SURFACE4_INFO 0x0B4C
122#define SURFACE5_INFO 0x0B5C 122#define SURFACE5_INFO 0x0B5C
123#define SURFACE6_INFO 0x0B6C 123#define SURFACE6_INFO 0x0B6C
124#define SURFACE7_INFO 0x0B7C 124#define SURFACE7_INFO 0x0B7C
125#define SURFACE_ACCESS_FLAGS 0x0BF8 125#define SURFACE_ACCESS_FLAGS 0x0BF8
126#define SURFACE_ACCESS_CLR 0x0BFC 126#define SURFACE_ACCESS_CLR 0x0BFC
127#define GEN_INT_CNTL 0x0040 127#define GEN_INT_CNTL 0x0040
128#define GEN_INT_STATUS 0x0044 128#define GEN_INT_STATUS 0x0044
129#define CRTC_EXT_CNTL 0x0054 129#define CRTC_EXT_CNTL 0x0054
130#define RB3D_CNTL 0x1C3C 130#define RB3D_CNTL 0x1C3C
131#define WAIT_UNTIL 0x1720 131#define WAIT_UNTIL 0x1720
132#define ISYNC_CNTL 0x1724 132#define ISYNC_CNTL 0x1724
133#define RBBM_GUICNTL 0x172C 133#define RBBM_GUICNTL 0x172C
134#define RBBM_STATUS 0x0E40 134#define RBBM_STATUS 0x0E40
135#define RBBM_STATUS_alt_1 0x1740 135#define RBBM_STATUS_alt_1 0x1740
136#define RBBM_CNTL 0x00EC 136#define RBBM_CNTL 0x00EC
137#define RBBM_CNTL_alt_1 0x0E44 137#define RBBM_CNTL_alt_1 0x0E44
138#define RBBM_SOFT_RESET 0x00F0 138#define RBBM_SOFT_RESET 0x00F0
139#define RBBM_SOFT_RESET_alt_1 0x0E48 139#define RBBM_SOFT_RESET_alt_1 0x0E48
140#define NQWAIT_UNTIL 0x0E50 140#define NQWAIT_UNTIL 0x0E50
141#define RBBM_DEBUG 0x0E6C 141#define RBBM_DEBUG 0x0E6C
142#define RBBM_CMDFIFO_ADDR 0x0E70 142#define RBBM_CMDFIFO_ADDR 0x0E70
143#define RBBM_CMDFIFO_DATAL 0x0E74 143#define RBBM_CMDFIFO_DATAL 0x0E74
144#define RBBM_CMDFIFO_DATAH 0x0E78 144#define RBBM_CMDFIFO_DATAH 0x0E78
145#define RBBM_CMDFIFO_STAT 0x0E7C 145#define RBBM_CMDFIFO_STAT 0x0E7C
146#define CRTC_STATUS 0x005C 146#define CRTC_STATUS 0x005C
147#define GPIO_VGA_DDC 0x0060 147#define GPIO_VGA_DDC 0x0060
148#define GPIO_DVI_DDC 0x0064 148#define GPIO_DVI_DDC 0x0064
149#define GPIO_MONID 0x0068 149#define GPIO_MONID 0x0068
150#define GPIO_CRT2_DDC 0x006c 150#define GPIO_CRT2_DDC 0x006c
151#define PALETTE_INDEX 0x00B0 151#define PALETTE_INDEX 0x00B0
152#define PALETTE_DATA 0x00B4 152#define PALETTE_DATA 0x00B4
153#define PALETTE_30_DATA 0x00B8 153#define PALETTE_30_DATA 0x00B8
154#define CRTC_H_TOTAL_DISP 0x0200 154#define CRTC_H_TOTAL_DISP 0x0200
155#define CRTC_H_SYNC_STRT_WID 0x0204 155#define CRTC_H_SYNC_STRT_WID 0x0204
156#define CRTC_V_TOTAL_DISP 0x0208 156#define CRTC_V_TOTAL_DISP 0x0208
157#define CRTC_V_SYNC_STRT_WID 0x020C 157#define CRTC_V_SYNC_STRT_WID 0x020C
158#define CRTC_VLINE_CRNT_VLINE 0x0210 158#define CRTC_VLINE_CRNT_VLINE 0x0210
159#define CRTC_CRNT_FRAME 0x0214 159#define CRTC_CRNT_FRAME 0x0214
160#define CRTC_GUI_TRIG_VLINE 0x0218 160#define CRTC_GUI_TRIG_VLINE 0x0218
161#define CRTC_DEBUG 0x021C 161#define CRTC_DEBUG 0x021C
162#define CRTC_OFFSET_RIGHT 0x0220 162#define CRTC_OFFSET_RIGHT 0x0220
163#define CRTC_OFFSET 0x0224 163#define CRTC_OFFSET 0x0224
164#define CRTC_OFFSET_CNTL 0x0228 164#define CRTC_OFFSET_CNTL 0x0228
165#define CRTC_PITCH 0x022C 165#define CRTC_PITCH 0x022C
166#define OVR_CLR 0x0230 166#define OVR_CLR 0x0230
167#define OVR_WID_LEFT_RIGHT 0x0234 167#define OVR_WID_LEFT_RIGHT 0x0234
168#define OVR_WID_TOP_BOTTOM 0x0238 168#define OVR_WID_TOP_BOTTOM 0x0238
169#define DISPLAY_BASE_ADDR 0x023C 169#define DISPLAY_BASE_ADDR 0x023C
170#define SNAPSHOT_VH_COUNTS 0x0240 170#define SNAPSHOT_VH_COUNTS 0x0240
171#define SNAPSHOT_F_COUNT 0x0244 171#define SNAPSHOT_F_COUNT 0x0244
172#define N_VIF_COUNT 0x0248 172#define N_VIF_COUNT 0x0248
173#define SNAPSHOT_VIF_COUNT 0x024C 173#define SNAPSHOT_VIF_COUNT 0x024C
174#define FP_CRTC_H_TOTAL_DISP 0x0250 174#define FP_CRTC_H_TOTAL_DISP 0x0250
175#define FP_CRTC_V_TOTAL_DISP 0x0254 175#define FP_CRTC_V_TOTAL_DISP 0x0254
176#define CRT_CRTC_H_SYNC_STRT_WID 0x0258 176#define CRT_CRTC_H_SYNC_STRT_WID 0x0258
177#define CRT_CRTC_V_SYNC_STRT_WID 0x025C 177#define CRT_CRTC_V_SYNC_STRT_WID 0x025C
178#define CUR_OFFSET 0x0260 178#define CUR_OFFSET 0x0260
179#define CUR_HORZ_VERT_POSN 0x0264 179#define CUR_HORZ_VERT_POSN 0x0264
180#define CUR_HORZ_VERT_OFF 0x0268 180#define CUR_HORZ_VERT_OFF 0x0268
181#define CUR_CLR0 0x026C 181#define CUR_CLR0 0x026C
182#define CUR_CLR1 0x0270 182#define CUR_CLR1 0x0270
183#define FP_HORZ_VERT_ACTIVE 0x0278 183#define FP_HORZ_VERT_ACTIVE 0x0278
184#define CRTC_MORE_CNTL 0x027C 184#define CRTC_MORE_CNTL 0x027C
185#define CRTC_H_CUTOFF_ACTIVE_EN (1<<4) 185#define CRTC_H_CUTOFF_ACTIVE_EN (1<<4)
186#define CRTC_V_CUTOFF_ACTIVE_EN (1<<5) 186#define CRTC_V_CUTOFF_ACTIVE_EN (1<<5)
187#define DAC_EXT_CNTL 0x0280 187#define DAC_EXT_CNTL 0x0280
188#define FP_GEN_CNTL 0x0284 188#define FP_GEN_CNTL 0x0284
189#define FP_HORZ_STRETCH 0x028C 189#define FP_HORZ_STRETCH 0x028C
190#define FP_VERT_STRETCH 0x0290 190#define FP_VERT_STRETCH 0x0290
191#define FP_H_SYNC_STRT_WID 0x02C4 191#define FP_H_SYNC_STRT_WID 0x02C4
192#define FP_V_SYNC_STRT_WID 0x02C8 192#define FP_V_SYNC_STRT_WID 0x02C8
193#define AUX_WINDOW_HORZ_CNTL 0x02D8 193#define AUX_WINDOW_HORZ_CNTL 0x02D8
194#define AUX_WINDOW_VERT_CNTL 0x02DC 194#define AUX_WINDOW_VERT_CNTL 0x02DC
195//#define DDA_CONFIG 0x02e0 195//#define DDA_CONFIG 0x02e0
196//#define DDA_ON_OFF 0x02e4 196//#define DDA_ON_OFF 0x02e4
197#define DVI_I2C_CNTL_1 0x02e4 197#define DVI_I2C_CNTL_1 0x02e4
@@ -199,192 +199,192 @@
199#define GRPH2_BUFFER_CNTL 0x03F0 199#define GRPH2_BUFFER_CNTL 0x03F0
200#define VGA_BUFFER_CNTL 0x02F4 200#define VGA_BUFFER_CNTL 0x02F4
201#define OV0_Y_X_START 0x0400 201#define OV0_Y_X_START 0x0400
202#define OV0_Y_X_END 0x0404 202#define OV0_Y_X_END 0x0404
203#define OV0_PIPELINE_CNTL 0x0408 203#define OV0_PIPELINE_CNTL 0x0408
204#define OV0_REG_LOAD_CNTL 0x0410 204#define OV0_REG_LOAD_CNTL 0x0410
205#define OV0_SCALE_CNTL 0x0420 205#define OV0_SCALE_CNTL 0x0420
206#define OV0_V_INC 0x0424 206#define OV0_V_INC 0x0424
207#define OV0_P1_V_ACCUM_INIT 0x0428 207#define OV0_P1_V_ACCUM_INIT 0x0428
208#define OV0_P23_V_ACCUM_INIT 0x042C 208#define OV0_P23_V_ACCUM_INIT 0x042C
209#define OV0_P1_BLANK_LINES_AT_TOP 0x0430 209#define OV0_P1_BLANK_LINES_AT_TOP 0x0430
210#define OV0_P23_BLANK_LINES_AT_TOP 0x0434 210#define OV0_P23_BLANK_LINES_AT_TOP 0x0434
211#define OV0_BASE_ADDR 0x043C 211#define OV0_BASE_ADDR 0x043C
212#define OV0_VID_BUF0_BASE_ADRS 0x0440 212#define OV0_VID_BUF0_BASE_ADRS 0x0440
213#define OV0_VID_BUF1_BASE_ADRS 0x0444 213#define OV0_VID_BUF1_BASE_ADRS 0x0444
214#define OV0_VID_BUF2_BASE_ADRS 0x0448 214#define OV0_VID_BUF2_BASE_ADRS 0x0448
215#define OV0_VID_BUF3_BASE_ADRS 0x044C 215#define OV0_VID_BUF3_BASE_ADRS 0x044C
216#define OV0_VID_BUF4_BASE_ADRS 0x0450 216#define OV0_VID_BUF4_BASE_ADRS 0x0450
217#define OV0_VID_BUF5_BASE_ADRS 0x0454 217#define OV0_VID_BUF5_BASE_ADRS 0x0454
218#define OV0_VID_BUF_PITCH0_VALUE 0x0460 218#define OV0_VID_BUF_PITCH0_VALUE 0x0460
219#define OV0_VID_BUF_PITCH1_VALUE 0x0464 219#define OV0_VID_BUF_PITCH1_VALUE 0x0464
220#define OV0_AUTO_FLIP_CNTRL 0x0470 220#define OV0_AUTO_FLIP_CNTRL 0x0470
221#define OV0_DEINTERLACE_PATTERN 0x0474 221#define OV0_DEINTERLACE_PATTERN 0x0474
222#define OV0_SUBMIT_HISTORY 0x0478 222#define OV0_SUBMIT_HISTORY 0x0478
223#define OV0_H_INC 0x0480 223#define OV0_H_INC 0x0480
224#define OV0_STEP_BY 0x0484 224#define OV0_STEP_BY 0x0484
225#define OV0_P1_H_ACCUM_INIT 0x0488 225#define OV0_P1_H_ACCUM_INIT 0x0488
226#define OV0_P23_H_ACCUM_INIT 0x048C 226#define OV0_P23_H_ACCUM_INIT 0x048C
227#define OV0_P1_X_START_END 0x0494 227#define OV0_P1_X_START_END 0x0494
228#define OV0_P2_X_START_END 0x0498 228#define OV0_P2_X_START_END 0x0498
229#define OV0_P3_X_START_END 0x049C 229#define OV0_P3_X_START_END 0x049C
230#define OV0_FILTER_CNTL 0x04A0 230#define OV0_FILTER_CNTL 0x04A0
231#define OV0_FOUR_TAP_COEF_0 0x04B0 231#define OV0_FOUR_TAP_COEF_0 0x04B0
232#define OV0_FOUR_TAP_COEF_1 0x04B4 232#define OV0_FOUR_TAP_COEF_1 0x04B4
233#define OV0_FOUR_TAP_COEF_2 0x04B8 233#define OV0_FOUR_TAP_COEF_2 0x04B8
234#define OV0_FOUR_TAP_COEF_3 0x04BC 234#define OV0_FOUR_TAP_COEF_3 0x04BC
235#define OV0_FOUR_TAP_COEF_4 0x04C0 235#define OV0_FOUR_TAP_COEF_4 0x04C0
236#define OV0_FLAG_CNTRL 0x04DC 236#define OV0_FLAG_CNTRL 0x04DC
237#define OV0_SLICE_CNTL 0x04E0 237#define OV0_SLICE_CNTL 0x04E0
238#define OV0_VID_KEY_CLR_LOW 0x04E4 238#define OV0_VID_KEY_CLR_LOW 0x04E4
239#define OV0_VID_KEY_CLR_HIGH 0x04E8 239#define OV0_VID_KEY_CLR_HIGH 0x04E8
240#define OV0_GRPH_KEY_CLR_LOW 0x04EC 240#define OV0_GRPH_KEY_CLR_LOW 0x04EC
241#define OV0_GRPH_KEY_CLR_HIGH 0x04F0 241#define OV0_GRPH_KEY_CLR_HIGH 0x04F0
242#define OV0_KEY_CNTL 0x04F4 242#define OV0_KEY_CNTL 0x04F4
243#define OV0_TEST 0x04F8 243#define OV0_TEST 0x04F8
244#define SUBPIC_CNTL 0x0540 244#define SUBPIC_CNTL 0x0540
245#define SUBPIC_DEFCOLCON 0x0544 245#define SUBPIC_DEFCOLCON 0x0544
246#define SUBPIC_Y_X_START 0x054C 246#define SUBPIC_Y_X_START 0x054C
247#define SUBPIC_Y_X_END 0x0550 247#define SUBPIC_Y_X_END 0x0550
248#define SUBPIC_V_INC 0x0554 248#define SUBPIC_V_INC 0x0554
249#define SUBPIC_H_INC 0x0558 249#define SUBPIC_H_INC 0x0558
250#define SUBPIC_BUF0_OFFSET 0x055C 250#define SUBPIC_BUF0_OFFSET 0x055C
251#define SUBPIC_BUF1_OFFSET 0x0560 251#define SUBPIC_BUF1_OFFSET 0x0560
252#define SUBPIC_LC0_OFFSET 0x0564 252#define SUBPIC_LC0_OFFSET 0x0564
253#define SUBPIC_LC1_OFFSET 0x0568 253#define SUBPIC_LC1_OFFSET 0x0568
254#define SUBPIC_PITCH 0x056C 254#define SUBPIC_PITCH 0x056C
255#define SUBPIC_BTN_HLI_COLCON 0x0570 255#define SUBPIC_BTN_HLI_COLCON 0x0570
256#define SUBPIC_BTN_HLI_Y_X_START 0x0574 256#define SUBPIC_BTN_HLI_Y_X_START 0x0574
257#define SUBPIC_BTN_HLI_Y_X_END 0x0578 257#define SUBPIC_BTN_HLI_Y_X_END 0x0578
258#define SUBPIC_PALETTE_INDEX 0x057C 258#define SUBPIC_PALETTE_INDEX 0x057C
259#define SUBPIC_PALETTE_DATA 0x0580 259#define SUBPIC_PALETTE_DATA 0x0580
260#define SUBPIC_H_ACCUM_INIT 0x0584 260#define SUBPIC_H_ACCUM_INIT 0x0584
261#define SUBPIC_V_ACCUM_INIT 0x0588 261#define SUBPIC_V_ACCUM_INIT 0x0588
262#define DISP_MISC_CNTL 0x0D00 262#define DISP_MISC_CNTL 0x0D00
263#define DAC_MACRO_CNTL 0x0D04 263#define DAC_MACRO_CNTL 0x0D04
264#define DISP_PWR_MAN 0x0D08 264#define DISP_PWR_MAN 0x0D08
265#define DISP_TEST_DEBUG_CNTL 0x0D10 265#define DISP_TEST_DEBUG_CNTL 0x0D10
266#define DISP_HW_DEBUG 0x0D14 266#define DISP_HW_DEBUG 0x0D14
267#define DAC_CRC_SIG1 0x0D18 267#define DAC_CRC_SIG1 0x0D18
268#define DAC_CRC_SIG2 0x0D1C 268#define DAC_CRC_SIG2 0x0D1C
269#define OV0_LIN_TRANS_A 0x0D20 269#define OV0_LIN_TRANS_A 0x0D20
270#define OV0_LIN_TRANS_B 0x0D24 270#define OV0_LIN_TRANS_B 0x0D24
271#define OV0_LIN_TRANS_C 0x0D28 271#define OV0_LIN_TRANS_C 0x0D28
272#define OV0_LIN_TRANS_D 0x0D2C 272#define OV0_LIN_TRANS_D 0x0D2C
273#define OV0_LIN_TRANS_E 0x0D30 273#define OV0_LIN_TRANS_E 0x0D30
274#define OV0_LIN_TRANS_F 0x0D34 274#define OV0_LIN_TRANS_F 0x0D34
275#define OV0_GAMMA_0_F 0x0D40 275#define OV0_GAMMA_0_F 0x0D40
276#define OV0_GAMMA_10_1F 0x0D44 276#define OV0_GAMMA_10_1F 0x0D44
277#define OV0_GAMMA_20_3F 0x0D48 277#define OV0_GAMMA_20_3F 0x0D48
278#define OV0_GAMMA_40_7F 0x0D4C 278#define OV0_GAMMA_40_7F 0x0D4C
279#define OV0_GAMMA_380_3BF 0x0D50 279#define OV0_GAMMA_380_3BF 0x0D50
280#define OV0_GAMMA_3C0_3FF 0x0D54 280#define OV0_GAMMA_3C0_3FF 0x0D54
281#define DISP_MERGE_CNTL 0x0D60 281#define DISP_MERGE_CNTL 0x0D60
282#define DISP_OUTPUT_CNTL 0x0D64 282#define DISP_OUTPUT_CNTL 0x0D64
283#define DISP_LIN_TRANS_GRPH_A 0x0D80 283#define DISP_LIN_TRANS_GRPH_A 0x0D80
284#define DISP_LIN_TRANS_GRPH_B 0x0D84 284#define DISP_LIN_TRANS_GRPH_B 0x0D84
285#define DISP_LIN_TRANS_GRPH_C 0x0D88 285#define DISP_LIN_TRANS_GRPH_C 0x0D88
286#define DISP_LIN_TRANS_GRPH_D 0x0D8C 286#define DISP_LIN_TRANS_GRPH_D 0x0D8C
287#define DISP_LIN_TRANS_GRPH_E 0x0D90 287#define DISP_LIN_TRANS_GRPH_E 0x0D90
288#define DISP_LIN_TRANS_GRPH_F 0x0D94 288#define DISP_LIN_TRANS_GRPH_F 0x0D94
289#define DISP_LIN_TRANS_VID_A 0x0D98 289#define DISP_LIN_TRANS_VID_A 0x0D98
290#define DISP_LIN_TRANS_VID_B 0x0D9C 290#define DISP_LIN_TRANS_VID_B 0x0D9C
291#define DISP_LIN_TRANS_VID_C 0x0DA0 291#define DISP_LIN_TRANS_VID_C 0x0DA0
292#define DISP_LIN_TRANS_VID_D 0x0DA4 292#define DISP_LIN_TRANS_VID_D 0x0DA4
293#define DISP_LIN_TRANS_VID_E 0x0DA8 293#define DISP_LIN_TRANS_VID_E 0x0DA8
294#define DISP_LIN_TRANS_VID_F 0x0DAC 294#define DISP_LIN_TRANS_VID_F 0x0DAC
295#define RMX_HORZ_FILTER_0TAP_COEF 0x0DB0 295#define RMX_HORZ_FILTER_0TAP_COEF 0x0DB0
296#define RMX_HORZ_FILTER_1TAP_COEF 0x0DB4 296#define RMX_HORZ_FILTER_1TAP_COEF 0x0DB4
297#define RMX_HORZ_FILTER_2TAP_COEF 0x0DB8 297#define RMX_HORZ_FILTER_2TAP_COEF 0x0DB8
298#define RMX_HORZ_PHASE 0x0DBC 298#define RMX_HORZ_PHASE 0x0DBC
299#define DAC_EMBEDDED_SYNC_CNTL 0x0DC0 299#define DAC_EMBEDDED_SYNC_CNTL 0x0DC0
300#define DAC_BROAD_PULSE 0x0DC4 300#define DAC_BROAD_PULSE 0x0DC4
301#define DAC_SKEW_CLKS 0x0DC8 301#define DAC_SKEW_CLKS 0x0DC8
302#define DAC_INCR 0x0DCC 302#define DAC_INCR 0x0DCC
303#define DAC_NEG_SYNC_LEVEL 0x0DD0 303#define DAC_NEG_SYNC_LEVEL 0x0DD0
304#define DAC_POS_SYNC_LEVEL 0x0DD4 304#define DAC_POS_SYNC_LEVEL 0x0DD4
305#define DAC_BLANK_LEVEL 0x0DD8 305#define DAC_BLANK_LEVEL 0x0DD8
306#define CLOCK_CNTL_INDEX 0x0008 306#define CLOCK_CNTL_INDEX 0x0008
307#define CLOCK_CNTL_DATA 0x000C 307#define CLOCK_CNTL_DATA 0x000C
308#define CP_RB_CNTL 0x0704 308#define CP_RB_CNTL 0x0704
309#define CP_RB_BASE 0x0700 309#define CP_RB_BASE 0x0700
310#define CP_RB_RPTR_ADDR 0x070C 310#define CP_RB_RPTR_ADDR 0x070C
311#define CP_RB_RPTR 0x0710 311#define CP_RB_RPTR 0x0710
312#define CP_RB_WPTR 0x0714 312#define CP_RB_WPTR 0x0714
313#define CP_RB_WPTR_DELAY 0x0718 313#define CP_RB_WPTR_DELAY 0x0718
314#define CP_IB_BASE 0x0738 314#define CP_IB_BASE 0x0738
315#define CP_IB_BUFSZ 0x073C 315#define CP_IB_BUFSZ 0x073C
316#define SCRATCH_REG0 0x15E0 316#define SCRATCH_REG0 0x15E0
317#define GUI_SCRATCH_REG0 0x15E0 317#define GUI_SCRATCH_REG0 0x15E0
318#define SCRATCH_REG1 0x15E4 318#define SCRATCH_REG1 0x15E4
319#define GUI_SCRATCH_REG1 0x15E4 319#define GUI_SCRATCH_REG1 0x15E4
320#define SCRATCH_REG2 0x15E8 320#define SCRATCH_REG2 0x15E8
321#define GUI_SCRATCH_REG2 0x15E8 321#define GUI_SCRATCH_REG2 0x15E8
322#define SCRATCH_REG3 0x15EC 322#define SCRATCH_REG3 0x15EC
323#define GUI_SCRATCH_REG3 0x15EC 323#define GUI_SCRATCH_REG3 0x15EC
324#define SCRATCH_REG4 0x15F0 324#define SCRATCH_REG4 0x15F0
325#define GUI_SCRATCH_REG4 0x15F0 325#define GUI_SCRATCH_REG4 0x15F0
326#define SCRATCH_REG5 0x15F4 326#define SCRATCH_REG5 0x15F4
327#define GUI_SCRATCH_REG5 0x15F4 327#define GUI_SCRATCH_REG5 0x15F4
328#define SCRATCH_UMSK 0x0770 328#define SCRATCH_UMSK 0x0770
329#define SCRATCH_ADDR 0x0774 329#define SCRATCH_ADDR 0x0774
330#define DP_BRUSH_FRGD_CLR 0x147C 330#define DP_BRUSH_FRGD_CLR 0x147C
331#define DP_BRUSH_BKGD_CLR 0x1478 331#define DP_BRUSH_BKGD_CLR 0x1478
332#define DST_LINE_START 0x1600 332#define DST_LINE_START 0x1600
333#define DST_LINE_END 0x1604 333#define DST_LINE_END 0x1604
334#define SRC_OFFSET 0x15AC 334#define SRC_OFFSET 0x15AC
335#define SRC_PITCH 0x15B0 335#define SRC_PITCH 0x15B0
336#define SRC_TILE 0x1704 336#define SRC_TILE 0x1704
337#define SRC_PITCH_OFFSET 0x1428 337#define SRC_PITCH_OFFSET 0x1428
338#define SRC_X 0x1414 338#define SRC_X 0x1414
339#define SRC_Y 0x1418 339#define SRC_Y 0x1418
340#define SRC_X_Y 0x1590 340#define SRC_X_Y 0x1590
341#define SRC_Y_X 0x1434 341#define SRC_Y_X 0x1434
342#define DST_Y_X 0x1438 342#define DST_Y_X 0x1438
343#define DST_WIDTH_HEIGHT 0x1598 343#define DST_WIDTH_HEIGHT 0x1598
344#define DST_HEIGHT_WIDTH 0x143c 344#define DST_HEIGHT_WIDTH 0x143c
345#define DST_OFFSET 0x1404 345#define DST_OFFSET 0x1404
346#define SRC_CLUT_ADDRESS 0x1780 346#define SRC_CLUT_ADDRESS 0x1780
347#define SRC_CLUT_DATA 0x1784 347#define SRC_CLUT_DATA 0x1784
348#define SRC_CLUT_DATA_RD 0x1788 348#define SRC_CLUT_DATA_RD 0x1788
349#define HOST_DATA0 0x17C0 349#define HOST_DATA0 0x17C0
350#define HOST_DATA1 0x17C4 350#define HOST_DATA1 0x17C4
351#define HOST_DATA2 0x17C8 351#define HOST_DATA2 0x17C8
352#define HOST_DATA3 0x17CC 352#define HOST_DATA3 0x17CC
353#define HOST_DATA4 0x17D0 353#define HOST_DATA4 0x17D0
354#define HOST_DATA5 0x17D4 354#define HOST_DATA5 0x17D4
355#define HOST_DATA6 0x17D8 355#define HOST_DATA6 0x17D8
356#define HOST_DATA7 0x17DC 356#define HOST_DATA7 0x17DC
357#define HOST_DATA_LAST 0x17E0 357#define HOST_DATA_LAST 0x17E0
358#define DP_SRC_ENDIAN 0x15D4 358#define DP_SRC_ENDIAN 0x15D4
359#define DP_SRC_FRGD_CLR 0x15D8 359#define DP_SRC_FRGD_CLR 0x15D8
360#define DP_SRC_BKGD_CLR 0x15DC 360#define DP_SRC_BKGD_CLR 0x15DC
361#define SC_LEFT 0x1640 361#define SC_LEFT 0x1640
362#define SC_RIGHT 0x1644 362#define SC_RIGHT 0x1644
363#define SC_TOP 0x1648 363#define SC_TOP 0x1648
364#define SC_BOTTOM 0x164C 364#define SC_BOTTOM 0x164C
365#define SRC_SC_RIGHT 0x1654 365#define SRC_SC_RIGHT 0x1654
366#define SRC_SC_BOTTOM 0x165C 366#define SRC_SC_BOTTOM 0x165C
367#define DP_CNTL 0x16C0 367#define DP_CNTL 0x16C0
368#define DP_CNTL_XDIR_YDIR_YMAJOR 0x16D0 368#define DP_CNTL_XDIR_YDIR_YMAJOR 0x16D0
369#define DP_DATATYPE 0x16C4 369#define DP_DATATYPE 0x16C4
370#define DP_MIX 0x16C8 370#define DP_MIX 0x16C8
371#define DP_WRITE_MSK 0x16CC 371#define DP_WRITE_MSK 0x16CC
372#define DP_XOP 0x17F8 372#define DP_XOP 0x17F8
373#define CLR_CMP_CLR_SRC 0x15C4 373#define CLR_CMP_CLR_SRC 0x15C4
374#define CLR_CMP_CLR_DST 0x15C8 374#define CLR_CMP_CLR_DST 0x15C8
375#define CLR_CMP_CNTL 0x15C0 375#define CLR_CMP_CNTL 0x15C0
376#define CLR_CMP_MSK 0x15CC 376#define CLR_CMP_MSK 0x15CC
377#define DSTCACHE_MODE 0x1710 377#define DSTCACHE_MODE 0x1710
378#define DSTCACHE_CTLSTAT 0x1714 378#define DSTCACHE_CTLSTAT 0x1714
379#define DEFAULT_PITCH_OFFSET 0x16E0 379#define DEFAULT_PITCH_OFFSET 0x16E0
380#define DEFAULT_SC_BOTTOM_RIGHT 0x16E8 380#define DEFAULT_SC_BOTTOM_RIGHT 0x16E8
381#define DEFAULT_SC_TOP_LEFT 0x16EC 381#define DEFAULT_SC_TOP_LEFT 0x16EC
382#define SRC_PITCH_OFFSET 0x1428 382#define SRC_PITCH_OFFSET 0x1428
383#define DST_PITCH_OFFSET 0x142C 383#define DST_PITCH_OFFSET 0x142C
384#define DP_GUI_MASTER_CNTL 0x146C 384#define DP_GUI_MASTER_CNTL 0x146C
385#define SC_TOP_LEFT 0x16EC 385#define SC_TOP_LEFT 0x16EC
386#define SC_BOTTOM_RIGHT 0x16F0 386#define SC_BOTTOM_RIGHT 0x16F0
387#define SRC_SC_BOTTOM_RIGHT 0x16F4 387#define SRC_SC_BOTTOM_RIGHT 0x16F4
388#define RB2D_DSTCACHE_MODE 0x3428 388#define RB2D_DSTCACHE_MODE 0x3428
389#define RB2D_DSTCACHE_CTLSTAT_broken 0x342C /* do not use */ 389#define RB2D_DSTCACHE_CTLSTAT_broken 0x342C /* do not use */
390#define LVDS_GEN_CNTL 0x02d0 390#define LVDS_GEN_CNTL 0x02d0
@@ -686,7 +686,7 @@
686#define VERT_FP_LOOP_STRETCH (0x7 << 28) 686#define VERT_FP_LOOP_STRETCH (0x7 << 28)
687#define VERT_STRETCH_RESERVED 0xf1000000 687#define VERT_STRETCH_RESERVED 0xf1000000
688 688
689/* DAC_CNTL bit constants */ 689/* DAC_CNTL bit constants */
690#define DAC_8BIT_EN 0x00000100 690#define DAC_8BIT_EN 0x00000100
691#define DAC_4BPP_PIX_ORDER 0x00000200 691#define DAC_4BPP_PIX_ORDER 0x00000200
692#define DAC_CRC_EN 0x00080000 692#define DAC_CRC_EN 0x00080000
@@ -700,7 +700,7 @@
700#define DAC_CMP_EN (1 << 3) 700#define DAC_CMP_EN (1 << 3)
701#define DAC_CMP_OUTPUT (1 << 7) 701#define DAC_CMP_OUTPUT (1 << 7)
702 702
703/* DAC_CNTL2 bit constants */ 703/* DAC_CNTL2 bit constants */
704#define DAC2_EXPAND_MODE (1 << 14) 704#define DAC2_EXPAND_MODE (1 << 14)
705#define DAC2_CMP_EN (1 << 7) 705#define DAC2_CMP_EN (1 << 7)
706#define DAC2_PALETTE_ACCESS_CNTL (1 << 5) 706#define DAC2_PALETTE_ACCESS_CNTL (1 << 5)
diff --git a/include/video/s1d13xxxfb.h b/include/video/s1d13xxxfb.h
index fe41b8407946..c3b2a2aa7140 100644
--- a/include/video/s1d13xxxfb.h
+++ b/include/video/s1d13xxxfb.h
@@ -14,13 +14,16 @@
14#define S1D13XXXFB_H 14#define S1D13XXXFB_H
15 15
16#define S1D_PALETTE_SIZE 256 16#define S1D_PALETTE_SIZE 256
17#define S1D13506_CHIP_REV 4 /* expected chip revision number for s1d13506 */ 17#define S1D_FBID "S1D13xxx"
18#define S1D13806_CHIP_REV 7 /* expected chip revision number for s1d13806 */ 18#define S1D_DEVICENAME "s1d13xxxfb"
19#define S1D_FBID "S1D13806" 19
20#define S1D_DEVICENAME "s1d13806fb" 20/* S1DREG_REV_CODE register = prod_id (6 bits) + revision (2 bits) */
21#define S1D13505_PROD_ID 0x3 /* 000011 */
22#define S1D13506_PROD_ID 0x4 /* 000100 */
23#define S1D13806_PROD_ID 0x7 /* 000111 */
21 24
22/* register definitions (tested on s1d13896) */ 25/* register definitions (tested on s1d13896) */
23#define S1DREG_REV_CODE 0x0000 /* Revision Code Register */ 26#define S1DREG_REV_CODE 0x0000 /* Prod + Rev Code Register */
24#define S1DREG_MISC 0x0001 /* Miscellaneous Register */ 27#define S1DREG_MISC 0x0001 /* Miscellaneous Register */
25#define S1DREG_GPIO_CNF0 0x0004 /* General IO Pins Configuration Register 0 */ 28#define S1DREG_GPIO_CNF0 0x0004 /* General IO Pins Configuration Register 0 */
26#define S1DREG_GPIO_CNF1 0x0005 /* General IO Pins Configuration Register 1 */ 29#define S1DREG_GPIO_CNF1 0x0005 /* General IO Pins Configuration Register 1 */
@@ -141,10 +144,11 @@ struct s1d13xxxfb_regval {
141 u8 value; 144 u8 value;
142}; 145};
143 146
144
145struct s1d13xxxfb_par { 147struct s1d13xxxfb_par {
146 void __iomem *regs; 148 void __iomem *regs;
147 unsigned char display; 149 unsigned char display;
150 unsigned char prod_id;
151 unsigned char revision;
148 152
149 unsigned int pseudo_palette[16]; 153 unsigned int pseudo_palette[16];
150#ifdef CONFIG_PM 154#ifdef CONFIG_PM
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__ */