aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/atomic.h2
-rw-r--r--include/asm-alpha/bitops.h1
-rw-r--r--include/asm-alpha/cache.h1
-rw-r--r--include/asm-alpha/compiler.h2
-rw-r--r--include/asm-alpha/dma-mapping.h2
-rw-r--r--include/asm-alpha/futex.h49
-rw-r--r--include/asm-alpha/hardirq.h2
-rw-r--r--include/asm-alpha/mman.h1
-rw-r--r--include/asm-alpha/mmu_context.h6
-rw-r--r--include/asm-alpha/mutex.h9
-rw-r--r--include/asm-alpha/processor.h34
-rw-r--r--include/asm-alpha/ptrace.h6
-rw-r--r--include/asm-alpha/system.h18
-rw-r--r--include/asm-alpha/thread_info.h2
-rw-r--r--include/asm-arm/arch-aaec2000/dma.h8
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200.h261
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h36
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_sys.h328
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_usart.h123
-rw-r--r--include/asm-arm/arch-at91rm9200/board.h80
-rw-r--r--include/asm-arm/arch-at91rm9200/debug-macro.S38
-rw-r--r--include/asm-arm/arch-at91rm9200/dma.h (renamed from include/asm-arm/arch-epxa10db/param.h)4
-rw-r--r--include/asm-arm/arch-at91rm9200/entry-macro.S25
-rw-r--r--include/asm-arm/arch-at91rm9200/gpio.h193
-rw-r--r--include/asm-arm/arch-at91rm9200/hardware.h92
-rw-r--r--include/asm-arm/arch-at91rm9200/io.h33
-rw-r--r--include/asm-arm/arch-at91rm9200/irqs.h52
-rw-r--r--include/asm-arm/arch-at91rm9200/memory.h (renamed from include/asm-arm/arch-epxa10db/memory.h)19
-rw-r--r--include/asm-arm/arch-at91rm9200/param.h (renamed from include/asm-arm/arch-epxa10db/vmalloc.h)14
-rw-r--r--include/asm-arm/arch-at91rm9200/pio.h115
-rw-r--r--include/asm-arm/arch-at91rm9200/system.h (renamed from include/asm-arm/arch-epxa10db/system.h)28
-rw-r--r--include/asm-arm/arch-at91rm9200/timex.h (renamed from include/asm-arm/arch-epxa10db/dma.h)14
-rw-r--r--include/asm-arm/arch-at91rm9200/uncompress.h55
-rw-r--r--include/asm-arm/arch-at91rm9200/vmalloc.h (renamed from include/asm-arm/arch-epxa10db/timex.h)16
-rw-r--r--include/asm-arm/arch-cl7500/dma.h1
-rw-r--r--include/asm-arm/arch-cl7500/entry-macro.S2
-rw-r--r--include/asm-arm/arch-clps711x/dma.h9
-rw-r--r--include/asm-arm/arch-clps711x/entry-macro.S1
-rw-r--r--include/asm-arm/arch-clps711x/system.h2
-rw-r--r--include/asm-arm/arch-ebsa110/dma.h8
-rw-r--r--include/asm-arm/arch-ebsa285/dma.h5
-rw-r--r--include/asm-arm/arch-ebsa285/entry-macro.S2
-rw-r--r--include/asm-arm/arch-epxa10db/debug-macro.S41
-rw-r--r--include/asm-arm/arch-epxa10db/entry-macro.S25
-rw-r--r--include/asm-arm/arch-epxa10db/ether00.h482
-rw-r--r--include/asm-arm/arch-epxa10db/excalibur.h91
-rw-r--r--include/asm-arm/arch-epxa10db/hardware.h64
-rw-r--r--include/asm-arm/arch-epxa10db/int_ctrl00.h288
-rw-r--r--include/asm-arm/arch-epxa10db/io.h41
-rw-r--r--include/asm-arm/arch-epxa10db/irqs.h45
-rw-r--r--include/asm-arm/arch-epxa10db/mode_ctrl00.h80
-rw-r--r--include/asm-arm/arch-epxa10db/platform.h7
-rw-r--r--include/asm-arm/arch-epxa10db/pld_conf00.h73
-rw-r--r--include/asm-arm/arch-epxa10db/tdkphy.h209
-rw-r--r--include/asm-arm/arch-epxa10db/timer00.h98
-rw-r--r--include/asm-arm/arch-epxa10db/uart00.h181
-rw-r--r--include/asm-arm/arch-epxa10db/uncompress.h54
-rw-r--r--include/asm-arm/arch-imx/dma.h4
-rw-r--r--include/asm-arm/arch-imx/entry-macro.S2
-rw-r--r--include/asm-arm/arch-integrator/debug-macro.S2
-rw-r--r--include/asm-arm/arch-integrator/dma.h9
-rw-r--r--include/asm-arm/arch-integrator/entry-macro.S2
-rw-r--r--include/asm-arm/arch-iop3xx/dma.h7
-rw-r--r--include/asm-arm/arch-iop3xx/entry-macro.S1
-rw-r--r--include/asm-arm/arch-ixp2000/dma.h9
-rw-r--r--include/asm-arm/arch-ixp2000/enp2611.h6
-rw-r--r--include/asm-arm/arch-ixp2000/entry-macro.S1
-rw-r--r--include/asm-arm/arch-ixp2000/io.h98
-rw-r--r--include/asm-arm/arch-ixp2000/ixp2000-regs.h8
-rw-r--r--include/asm-arm/arch-ixp4xx/coyote.h5
-rw-r--r--include/asm-arm/arch-ixp4xx/dma.h3
-rw-r--r--include/asm-arm/arch-ixp4xx/entry-macro.S1
-rw-r--r--include/asm-arm/arch-ixp4xx/gtwx5715.h4
-rw-r--r--include/asm-arm/arch-ixp4xx/hardware.h1
-rw-r--r--include/asm-arm/arch-ixp4xx/irqs.h9
-rw-r--r--include/asm-arm/arch-ixp4xx/ixdp425.h3
-rw-r--r--include/asm-arm/arch-ixp4xx/memory.h25
-rw-r--r--include/asm-arm/arch-ixp4xx/nas100d.h72
-rw-r--r--include/asm-arm/arch-ixp4xx/nslu2.h3
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h24
-rw-r--r--include/asm-arm/arch-l7200/dma.h1
-rw-r--r--include/asm-arm/arch-l7200/system.h2
-rw-r--r--include/asm-arm/arch-lh7a40x/dma.h8
-rw-r--r--include/asm-arm/arch-lh7a40x/entry-macro.S2
-rw-r--r--include/asm-arm/arch-omap/dma.h3
-rw-r--r--include/asm-arm/arch-omap/entry-macro.S2
-rw-r--r--include/asm-arm/arch-omap/system.h3
-rw-r--r--include/asm-arm/arch-pxa/dma.h5
-rw-r--r--include/asm-arm/arch-pxa/entry-macro.S2
-rw-r--r--include/asm-arm/arch-pxa/ohci.h18
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h12
-rw-r--r--include/asm-arm/arch-realview/debug-macro.S2
-rw-r--r--include/asm-arm/arch-realview/dma.h7
-rw-r--r--include/asm-arm/arch-realview/entry-macro.S2
-rw-r--r--include/asm-arm/arch-rpc/entry-macro.S2
-rw-r--r--include/asm-arm/arch-s3c2410/dma.h8
-rw-r--r--include/asm-arm/arch-s3c2410/entry-macro.S2
-rw-r--r--include/asm-arm/arch-sa1100/dma.h14
-rw-r--r--include/asm-arm/arch-versatile/debug-macro.S2
-rw-r--r--include/asm-arm/arch-versatile/dma.h7
-rw-r--r--include/asm-arm/arch-versatile/entry-macro.S4
-rw-r--r--include/asm-arm/atomic.h3
-rw-r--r--include/asm-arm/bitops.h2
-rw-r--r--include/asm-arm/byteorder.h25
-rw-r--r--include/asm-arm/cache.h5
-rw-r--r--include/asm-arm/cacheflush.h1
-rw-r--r--include/asm-arm/dma.h11
-rw-r--r--include/asm-arm/futex.h49
-rw-r--r--include/asm-arm/hardware/sharpsl_pm.h94
-rw-r--r--include/asm-arm/io.h6
-rw-r--r--include/asm-arm/ioctl.h75
-rw-r--r--include/asm-arm/irq.h12
-rw-r--r--include/asm-arm/mach/dma.h4
-rw-r--r--include/asm-arm/mach/map.h3
-rw-r--r--include/asm-arm/mach/serial_at91rm9200.h36
-rw-r--r--include/asm-arm/memory.h15
-rw-r--r--include/asm-arm/mman.h1
-rw-r--r--include/asm-arm/mutex.h128
-rw-r--r--include/asm-arm/processor.h8
-rw-r--r--include/asm-arm/scatterlist.h1
-rw-r--r--include/asm-arm/system.h12
-rw-r--r--include/asm-arm/thread_info.h7
-rw-r--r--include/asm-arm26/atomic.h3
-rw-r--r--include/asm-arm26/bitops.h1
-rw-r--r--include/asm-arm26/futex.h49
-rw-r--r--include/asm-arm26/ioctl.h75
-rw-r--r--include/asm-arm26/mman.h1
-rw-r--r--include/asm-arm26/system.h12
-rw-r--r--include/asm-arm26/thread_info.h9
-rw-r--r--include/asm-cris/arch-v10/cache.h1
-rw-r--r--include/asm-cris/arch-v10/processor.h2
-rw-r--r--include/asm-cris/arch-v32/cache.h1
-rw-r--r--include/asm-cris/arch-v32/processor.h2
-rw-r--r--include/asm-cris/atomic.h3
-rw-r--r--include/asm-cris/bitops.h1
-rw-r--r--include/asm-cris/dma-mapping.h2
-rw-r--r--include/asm-cris/futex.h49
-rw-r--r--include/asm-cris/ioctl.h84
-rw-r--r--include/asm-cris/mman.h1
-rw-r--r--include/asm-cris/mutex.h9
-rw-r--r--include/asm-cris/processor.h3
-rw-r--r--include/asm-cris/thread_info.h2
-rw-r--r--include/asm-frv/atomic.h98
-rw-r--r--include/asm-frv/bitops.h1
-rw-r--r--include/asm-frv/bug.h1
-rw-r--r--include/asm-frv/dma-mapping.h2
-rw-r--r--include/asm-frv/futex.h42
-rw-r--r--include/asm-frv/io.h123
-rw-r--r--include/asm-frv/ioctl.h81
-rw-r--r--include/asm-frv/mb-regs.h4
-rw-r--r--include/asm-frv/mc146818rtc.h16
-rw-r--r--include/asm-frv/mman.h1
-rw-r--r--include/asm-frv/module.h16
-rw-r--r--include/asm-frv/mutex.h9
-rw-r--r--include/asm-frv/pci.h8
-rw-r--r--include/asm-frv/pgtable.h5
-rw-r--r--include/asm-frv/signal.h1
-rw-r--r--include/asm-frv/thread_info.h2
-rw-r--r--include/asm-frv/types.h1
-rw-r--r--include/asm-frv/uaccess.h8
-rw-r--r--include/asm-frv/unistd.h2
-rw-r--r--include/asm-frv/vga.h17
-rw-r--r--include/asm-frv/xor.h1
-rw-r--r--include/asm-generic/atomic.h117
-rw-r--r--include/asm-generic/bitops.h1
-rw-r--r--include/asm-generic/dma-mapping.h2
-rw-r--r--include/asm-generic/futex.h53
-rw-r--r--include/asm-generic/ioctl.h80
-rw-r--r--include/asm-generic/mutex-dec.h110
-rw-r--r--include/asm-generic/mutex-null.h24
-rw-r--r--include/asm-generic/mutex-xchg.h117
-rw-r--r--include/asm-generic/vmlinux.lds.h4
-rw-r--r--include/asm-h8300/atomic.h3
-rw-r--r--include/asm-h8300/bitops.h1
-rw-r--r--include/asm-h8300/futex.h49
-rw-r--r--include/asm-h8300/ioctl.h81
-rw-r--r--include/asm-h8300/irq.h5
-rw-r--r--include/asm-h8300/mman.h1
-rw-r--r--include/asm-h8300/mutex.h9
-rw-r--r--include/asm-h8300/page.h6
-rw-r--r--include/asm-h8300/thread_info.h2
-rw-r--r--include/asm-i386/apic.h5
-rw-r--r--include/asm-i386/atomic.h2
-rw-r--r--include/asm-i386/bitops.h51
-rw-r--r--include/asm-i386/bugs.h23
-rw-r--r--include/asm-i386/cache.h2
-rw-r--r--include/asm-i386/cacheflush.h4
-rw-r--r--include/asm-i386/cpufeature.h1
-rw-r--r--include/asm-i386/desc.h8
-rw-r--r--include/asm-i386/dma-mapping.h14
-rw-r--r--include/asm-i386/i387.h8
-rw-r--r--include/asm-i386/io.h5
-rw-r--r--include/asm-i386/ioctl.h86
-rw-r--r--include/asm-i386/irq.h2
-rw-r--r--include/asm-i386/kexec.h47
-rw-r--r--include/asm-i386/kprobes.h9
-rw-r--r--include/asm-i386/mach-bigsmp/mach_apic.h79
-rw-r--r--include/asm-i386/mach-bigsmp/mach_apicdef.h4
-rw-r--r--include/asm-i386/mach-default/mach_ipi.h4
-rw-r--r--include/asm-i386/mman.h1
-rw-r--r--include/asm-i386/mmzone.h5
-rw-r--r--include/asm-i386/module.h4
-rw-r--r--include/asm-i386/mpspec_def.h2
-rw-r--r--include/asm-i386/mutex.h136
-rw-r--r--include/asm-i386/param.h3
-rw-r--r--include/asm-i386/processor.h26
-rw-r--r--include/asm-i386/ptrace.h3
-rw-r--r--include/asm-i386/segment.h14
-rw-r--r--include/asm-i386/system.h40
-rw-r--r--include/asm-i386/thread_info.h2
-rw-r--r--include/asm-i386/topology.h1
-rw-r--r--include/asm-i386/unistd.h5
-rw-r--r--include/asm-i386/vm86.h20
-rw-r--r--include/asm-ia64/atomic.h2
-rw-r--r--include/asm-ia64/bitops.h1
-rw-r--r--include/asm-ia64/bug.h6
-rw-r--r--include/asm-ia64/cache.h2
-rw-r--r--include/asm-ia64/compat.h2
-rw-r--r--include/asm-ia64/futex.h49
-rw-r--r--include/asm-ia64/io.h1
-rw-r--r--include/asm-ia64/ioctl.h78
-rw-r--r--include/asm-ia64/kprobes.h14
-rw-r--r--include/asm-ia64/mman.h1
-rw-r--r--include/asm-ia64/mutex.h9
-rw-r--r--include/asm-ia64/processor.h2
-rw-r--r--include/asm-ia64/ptrace.h4
-rw-r--r--include/asm-ia64/spinlock.h2
-rw-r--r--include/asm-ia64/system.h9
-rw-r--r--include/asm-ia64/thread_info.h9
-rw-r--r--include/asm-ia64/topology.h2
-rw-r--r--include/asm-ia64/unistd.h5
-rw-r--r--include/asm-m32r/assembler.h10
-rw-r--r--include/asm-m32r/atomic.h2
-rw-r--r--include/asm-m32r/bitops.h1
-rw-r--r--include/asm-m32r/cache.h2
-rw-r--r--include/asm-m32r/cacheflush.h2
-rw-r--r--include/asm-m32r/futex.h49
-rw-r--r--include/asm-m32r/ioctl.h79
-rw-r--r--include/asm-m32r/irq.h16
-rw-r--r--include/asm-m32r/m32102.h38
-rw-r--r--include/asm-m32r/m32104ut/m32104ut_pld.h163
-rw-r--r--include/asm-m32r/m32r.h8
-rw-r--r--include/asm-m32r/mman.h1
-rw-r--r--include/asm-m32r/mutex.h9
-rw-r--r--include/asm-m32r/ptrace.h3
-rw-r--r--include/asm-m32r/system.h22
-rw-r--r--include/asm-m32r/thread_info.h2
-rw-r--r--include/asm-m32r/unistd.h12
-rw-r--r--include/asm-m68k/amigahw.h12
-rw-r--r--include/asm-m68k/amigaints.h2
-rw-r--r--include/asm-m68k/atomic.h2
-rw-r--r--include/asm-m68k/bitops.h1
-rw-r--r--include/asm-m68k/cache.h2
-rw-r--r--include/asm-m68k/checksum.h2
-rw-r--r--include/asm-m68k/dsp56k.h2
-rw-r--r--include/asm-m68k/floppy.h2
-rw-r--r--include/asm-m68k/futex.h49
-rw-r--r--include/asm-m68k/hardirq.h9
-rw-r--r--include/asm-m68k/io.h49
-rw-r--r--include/asm-m68k/ioctl.h81
-rw-r--r--include/asm-m68k/irq.h11
-rw-r--r--include/asm-m68k/machdep.h1
-rw-r--r--include/asm-m68k/mman.h1
-rw-r--r--include/asm-m68k/mutex.h9
-rw-r--r--include/asm-m68k/raw_io.h40
-rw-r--r--include/asm-m68k/signal.h2
-rw-r--r--include/asm-m68k/sun3_pgtable.h2
-rw-r--r--include/asm-m68k/sun3ints.h1
-rw-r--r--include/asm-m68k/sun3xflop.h4
-rw-r--r--include/asm-m68k/thread_info.h1
-rw-r--r--include/asm-m68k/uaccess.h20
-rw-r--r--include/asm-m68k/zorro.h8
-rw-r--r--include/asm-m68knommu/atomic.h2
-rw-r--r--include/asm-m68knommu/bitops.h3
-rw-r--r--include/asm-m68knommu/futex.h49
-rw-r--r--include/asm-m68knommu/ioctl.h2
-rw-r--r--include/asm-m68knommu/irq.h6
-rw-r--r--include/asm-m68knommu/machdep.h1
-rw-r--r--include/asm-m68knommu/mutex.h9
-rw-r--r--include/asm-m68knommu/sigcontext.h1
-rw-r--r--include/asm-m68knommu/thread_info.h2
-rw-r--r--include/asm-mips/.gitignore1
-rw-r--r--include/asm-mips/atomic.h45
-rw-r--r--include/asm-mips/bitops.h2
-rw-r--r--include/asm-mips/cache.h1
-rw-r--r--include/asm-mips/cpu-features.h21
-rw-r--r--include/asm-mips/cpu.h20
-rw-r--r--include/asm-mips/delay.h6
-rw-r--r--include/asm-mips/dsp.h4
-rw-r--r--include/asm-mips/elf.h4
-rw-r--r--include/asm-mips/hazards.h20
-rw-r--r--include/asm-mips/interrupt.h1
-rw-r--r--include/asm-mips/mach-au1x00/au1000.h7
-rw-r--r--include/asm-mips/mach-ip22/cpu-feature-overrides.h5
-rw-r--r--include/asm-mips/mach-ip27/cpu-feature-overrides.h5
-rw-r--r--include/asm-mips/mach-ip27/topology.h1
-rw-r--r--include/asm-mips/mach-ip32/cpu-feature-overrides.h5
-rw-r--r--include/asm-mips/mach-ja/cpu-feature-overrides.h5
-rw-r--r--include/asm-mips/mach-ocelot3/cpu-feature-overrides.h5
-rw-r--r--include/asm-mips/mach-rm200/cpu-feature-overrides.h5
-rw-r--r--include/asm-mips/mach-yosemite/cpu-feature-overrides.h5
-rw-r--r--include/asm-mips/mipsregs.h2
-rw-r--r--include/asm-mips/mman.h1
-rw-r--r--include/asm-mips/mutex.h9
-rw-r--r--include/asm-mips/processor.h11
-rw-r--r--include/asm-mips/riscos-syscall.h979
-rw-r--r--include/asm-mips/system.h12
-rw-r--r--include/asm-mips/thread_info.h2
-rw-r--r--include/asm-mips/vr41xx/capcella.h2
-rw-r--r--include/asm-mips/vr41xx/e55.h2
-rw-r--r--include/asm-mips/vr41xx/giu.h2
-rw-r--r--include/asm-mips/vr41xx/mpc30x.h2
-rw-r--r--include/asm-mips/vr41xx/pci.h2
-rw-r--r--include/asm-mips/vr41xx/siu.h2
-rw-r--r--include/asm-mips/vr41xx/tb0219.h2
-rw-r--r--include/asm-mips/vr41xx/tb0226.h2
-rw-r--r--include/asm-mips/vr41xx/vr41xx.h2
-rw-r--r--include/asm-mips/vr41xx/vrc4173.h2
-rw-r--r--include/asm-mips/vr41xx/workpad.h2
-rw-r--r--include/asm-parisc/atomic.h2
-rw-r--r--include/asm-parisc/bitops.h1
-rw-r--r--include/asm-parisc/cache.h9
-rw-r--r--include/asm-parisc/futex.h49
-rw-r--r--include/asm-parisc/io.h2
-rw-r--r--include/asm-parisc/mman.h1
-rw-r--r--include/asm-parisc/mutex.h9
-rw-r--r--include/asm-parisc/page.h7
-rw-r--r--include/asm-parisc/pci.h8
-rw-r--r--include/asm-parisc/processor.h18
-rw-r--r--include/asm-parisc/system.h9
-rw-r--r--include/asm-parisc/thread_info.h3
-rw-r--r--include/asm-parisc/tlbflush.h1
-rw-r--r--include/asm-powerpc/abs_addr.h2
-rw-r--r--include/asm-powerpc/agp.h2
-rw-r--r--include/asm-powerpc/asm-compat.h3
-rw-r--r--include/asm-powerpc/atomic.h2
-rw-r--r--include/asm-powerpc/bitops.h1
-rw-r--r--include/asm-powerpc/bootx.h171
-rw-r--r--include/asm-powerpc/btext.h19
-rw-r--r--include/asm-powerpc/bug.h2
-rw-r--r--include/asm-powerpc/cache.h1
-rw-r--r--include/asm-powerpc/checksum.h2
-rw-r--r--include/asm-powerpc/compat.h2
-rw-r--r--include/asm-powerpc/cputable.h36
-rw-r--r--include/asm-powerpc/current.h2
-rw-r--r--include/asm-powerpc/delay.h2
-rw-r--r--include/asm-powerpc/dma-mapping.h4
-rw-r--r--include/asm-powerpc/dma.h2
-rw-r--r--include/asm-powerpc/eeh.h23
-rw-r--r--include/asm-powerpc/eeh_event.h9
-rw-r--r--include/asm-powerpc/elf.h4
-rw-r--r--include/asm-powerpc/firmware.h6
-rw-r--r--include/asm-powerpc/floppy.h2
-rw-r--r--include/asm-powerpc/grackle.h5
-rw-r--r--include/asm-powerpc/hardirq.h2
-rw-r--r--include/asm-powerpc/heathrow.h5
-rw-r--r--include/asm-powerpc/hvcall.h2
-rw-r--r--include/asm-powerpc/hvconsole.h2
-rw-r--r--include/asm-powerpc/hvcserver.h2
-rw-r--r--include/asm-powerpc/i8259.h2
-rw-r--r--include/asm-powerpc/ibmebus.h85
-rw-r--r--include/asm-powerpc/io.h6
-rw-r--r--include/asm-powerpc/iommu.h27
-rw-r--r--include/asm-powerpc/ipic.h (renamed from include/asm-ppc/ipic.h)0
-rw-r--r--include/asm-powerpc/iseries/hv_call.h4
-rw-r--r--include/asm-powerpc/iseries/hv_call_event.h134
-rw-r--r--include/asm-powerpc/iseries/hv_call_sc.h1
-rw-r--r--include/asm-powerpc/iseries/hv_lp_config.h1
-rw-r--r--include/asm-powerpc/iseries/hv_lp_event.h42
-rw-r--r--include/asm-powerpc/iseries/hv_types.h1
-rw-r--r--include/asm-powerpc/iseries/iseries_io.h14
-rw-r--r--include/asm-powerpc/iseries/it_exp_vpd_panel.h1
-rw-r--r--include/asm-powerpc/iseries/it_lp_naca.h22
-rw-r--r--include/asm-powerpc/iseries/it_lp_queue.h1
-rw-r--r--include/asm-powerpc/iseries/it_lp_reg_save.h5
-rw-r--r--include/asm-powerpc/iseries/lpar_map.h1
-rw-r--r--include/asm-powerpc/iseries/mf.h1
-rw-r--r--include/asm-powerpc/iseries/vio.h1
-rw-r--r--include/asm-powerpc/kdebug.h2
-rw-r--r--include/asm-powerpc/kdump.h13
-rw-r--r--include/asm-powerpc/kexec.h28
-rw-r--r--include/asm-powerpc/keylargo.h15
-rw-r--r--include/asm-powerpc/kprobes.h16
-rw-r--r--include/asm-powerpc/lmb.h2
-rw-r--r--include/asm-powerpc/lppaca.h2
-rw-r--r--include/asm-powerpc/machdep.h12
-rw-r--r--include/asm-powerpc/macio.h2
-rw-r--r--include/asm-powerpc/mman.h1
-rw-r--r--include/asm-powerpc/mmu.h9
-rw-r--r--include/asm-powerpc/mmu_context.h2
-rw-r--r--include/asm-powerpc/mmzone.h2
-rw-r--r--include/asm-powerpc/module.h2
-rw-r--r--include/asm-powerpc/mpic.h6
-rw-r--r--include/asm-powerpc/mutex.h9
-rw-r--r--include/asm-powerpc/numnodes.h2
-rw-r--r--include/asm-powerpc/nvram.h4
-rw-r--r--include/asm-powerpc/of_device.h2
-rw-r--r--include/asm-powerpc/ohare.h6
-rw-r--r--include/asm-powerpc/oprofile_impl.h33
-rw-r--r--include/asm-powerpc/pSeries_reconfig.h2
-rw-r--r--include/asm-powerpc/paca.h22
-rw-r--r--include/asm-powerpc/page.h34
-rw-r--r--include/asm-powerpc/page_32.h2
-rw-r--r--include/asm-powerpc/page_64.h12
-rw-r--r--include/asm-powerpc/param.h2
-rw-r--r--include/asm-powerpc/parport.h30
-rw-r--r--include/asm-powerpc/pci-bridge.h35
-rw-r--r--include/asm-powerpc/pci.h2
-rw-r--r--include/asm-powerpc/percpu.h56
-rw-r--r--include/asm-powerpc/pgalloc.h2
-rw-r--r--include/asm-powerpc/pgtable-64k.h6
-rw-r--r--include/asm-powerpc/pgtable.h13
-rw-r--r--include/asm-powerpc/pmac_feature.h25
-rw-r--r--include/asm-powerpc/pmac_low_i2c.h92
-rw-r--r--include/asm-powerpc/pmac_pfunc.h253
-rw-r--r--include/asm-powerpc/pmc.h2
-rw-r--r--include/asm-powerpc/ppc-pci.h25
-rw-r--r--include/asm-powerpc/ppc_asm.h3
-rw-r--r--include/asm-powerpc/processor.h5
-rw-r--r--include/asm-powerpc/prom.h71
-rw-r--r--include/asm-powerpc/ptrace.h2
-rw-r--r--include/asm-powerpc/reg.h58
-rw-r--r--include/asm-powerpc/rtas.h3
-rw-r--r--include/asm-powerpc/seccomp.h4
-rw-r--r--include/asm-powerpc/sections.h2
-rw-r--r--include/asm-powerpc/serial.h6
-rw-r--r--include/asm-powerpc/signal.h7
-rw-r--r--include/asm-powerpc/smu.h40
-rw-r--r--include/asm-powerpc/sparsemem.h10
-rw-r--r--include/asm-powerpc/spinlock.h2
-rw-r--r--include/asm-powerpc/spu.h600
-rw-r--r--include/asm-powerpc/spu_csa.h255
-rw-r--r--include/asm-powerpc/synch.h4
-rw-r--r--include/asm-powerpc/system.h21
-rw-r--r--include/asm-powerpc/tce.h2
-rw-r--r--include/asm-powerpc/thread_info.h15
-rw-r--r--include/asm-powerpc/tlb.h2
-rw-r--r--include/asm-powerpc/topology.h7
-rw-r--r--include/asm-powerpc/udbg.h26
-rw-r--r--include/asm-powerpc/unistd.h4
-rw-r--r--include/asm-powerpc/vdso_datapage.h2
-rw-r--r--include/asm-powerpc/vio.h2
-rw-r--r--include/asm-ppc/bseip.h38
-rw-r--r--include/asm-ppc/btext.h2
-rw-r--r--include/asm-ppc/ibm_ocp.h1
-rw-r--r--include/asm-ppc/io.h2
-rw-r--r--include/asm-ppc/machdep.h4
-rw-r--r--include/asm-ppc/mpc52xx.h13
-rw-r--r--include/asm-ppc/mpc85xx.h4
-rw-r--r--include/asm-ppc/pci-bridge.h9
-rw-r--r--include/asm-ppc/prom.h32
-rw-r--r--include/asm-ppc/system.h22
-rw-r--r--include/asm-s390/atomic.h176
-rw-r--r--include/asm-s390/bitops.h1
-rw-r--r--include/asm-s390/cache.h1
-rw-r--r--include/asm-s390/ccwdev.h3
-rw-r--r--include/asm-s390/elf.h2
-rw-r--r--include/asm-s390/futex.h49
-rw-r--r--include/asm-s390/ioctl.h89
-rw-r--r--include/asm-s390/kexec.h5
-rw-r--r--include/asm-s390/mman.h1
-rw-r--r--include/asm-s390/mutex.h9
-rw-r--r--include/asm-s390/processor.h8
-rw-r--r--include/asm-s390/qdio.h8
-rw-r--r--include/asm-s390/s390_rdev.h15
-rw-r--r--include/asm-s390/system.h10
-rw-r--r--include/asm-s390/thread_info.h2
-rw-r--r--include/asm-s390/uaccess.h14
-rw-r--r--include/asm-s390/unistd.h2
-rw-r--r--include/asm-s390/vtoc.h24
-rw-r--r--include/asm-sh/atomic.h3
-rw-r--r--include/asm-sh/bitops.h1
-rw-r--r--include/asm-sh/cache.h2
-rw-r--r--include/asm-sh/futex.h49
-rw-r--r--include/asm-sh/ioctl.h76
-rw-r--r--include/asm-sh/mman.h1
-rw-r--r--include/asm-sh/mutex.h9
-rw-r--r--include/asm-sh/ptrace.h10
-rw-r--r--include/asm-sh/system.h10
-rw-r--r--include/asm-sh/thread_info.h2
-rw-r--r--include/asm-sh64/atomic.h3
-rw-r--r--include/asm-sh64/bitops.h1
-rw-r--r--include/asm-sh64/cache.h2
-rw-r--r--include/asm-sh64/futex.h49
-rw-r--r--include/asm-sh64/io.h8
-rw-r--r--include/asm-sh64/ioctl.h84
-rw-r--r--include/asm-sh64/mmu_context.h2
-rw-r--r--include/asm-sh64/mutex.h9
-rw-r--r--include/asm-sh64/pgalloc.h14
-rw-r--r--include/asm-sh64/pgtable.h24
-rw-r--r--include/asm-sh64/processor.h4
-rw-r--r--include/asm-sh64/system.h4
-rw-r--r--include/asm-sh64/thread_info.h2
-rw-r--r--include/asm-sh64/tlbflush.h2
-rw-r--r--include/asm-sh64/uaccess.h2
-rw-r--r--include/asm-sparc/atomic.h2
-rw-r--r--include/asm-sparc/bitops.h1
-rw-r--r--include/asm-sparc/cache.h1
-rw-r--r--include/asm-sparc/futex.h49
-rw-r--r--include/asm-sparc/mman.h1
-rw-r--r--include/asm-sparc/mutex.h9
-rw-r--r--include/asm-sparc/system.h12
-rw-r--r--include/asm-sparc/thread_info.h3
-rw-r--r--include/asm-sparc64/atomic.h2
-rw-r--r--include/asm-sparc64/bitops.h1
-rw-r--r--include/asm-sparc64/cache.h1
-rw-r--r--include/asm-sparc64/elf.h2
-rw-r--r--include/asm-sparc64/futex.h49
-rw-r--r--include/asm-sparc64/kprobes.h10
-rw-r--r--include/asm-sparc64/mman.h1
-rw-r--r--include/asm-sparc64/mmu_context.h2
-rw-r--r--include/asm-sparc64/mutex.h9
-rw-r--r--include/asm-sparc64/processor.h5
-rw-r--r--include/asm-sparc64/system.h18
-rw-r--r--include/asm-um/cache.h3
-rw-r--r--include/asm-um/futex.h12
-rw-r--r--include/asm-um/mutex.h9
-rw-r--r--include/asm-um/processor-generic.h1
-rw-r--r--include/asm-um/rwsem.h4
-rw-r--r--include/asm-um/thread_info.h3
-rw-r--r--include/asm-v850/atomic.h3
-rw-r--r--include/asm-v850/bitops.h1
-rw-r--r--include/asm-v850/cache.h2
-rw-r--r--include/asm-v850/futex.h49
-rw-r--r--include/asm-v850/ioctl.h81
-rw-r--r--include/asm-v850/mman.h1
-rw-r--r--include/asm-v850/mutex.h9
-rw-r--r--include/asm-v850/processor.h8
-rw-r--r--include/asm-v850/thread_info.h2
-rw-r--r--include/asm-v850/unistd.h18
-rw-r--r--include/asm-x86_64/apic.h17
-rw-r--r--include/asm-x86_64/apicdef.h1
-rw-r--r--include/asm-x86_64/atomic.h3
-rw-r--r--include/asm-x86_64/bitops.h70
-rw-r--r--include/asm-x86_64/cache.h13
-rw-r--r--include/asm-x86_64/cacheflush.h4
-rw-r--r--include/asm-x86_64/compat.h7
-rw-r--r--include/asm-x86_64/cpufeature.h3
-rw-r--r--include/asm-x86_64/desc.h18
-rw-r--r--include/asm-x86_64/dma-mapping.h221
-rw-r--r--include/asm-x86_64/dwarf2.h4
-rw-r--r--include/asm-x86_64/e820.h1
-rw-r--r--include/asm-x86_64/gart-mapping.h16
-rw-r--r--include/asm-x86_64/hw_irq.h10
-rw-r--r--include/asm-x86_64/i387.h68
-rw-r--r--include/asm-x86_64/ia32_unistd.h3
-rw-r--r--include/asm-x86_64/idle.h14
-rw-r--r--include/asm-x86_64/io.h5
-rw-r--r--include/asm-x86_64/ioctl.h76
-rw-r--r--include/asm-x86_64/ipi.h4
-rw-r--r--include/asm-x86_64/kdebug.h13
-rw-r--r--include/asm-x86_64/kexec.h37
-rw-r--r--include/asm-x86_64/kprobes.h4
-rw-r--r--include/asm-x86_64/mman.h1
-rw-r--r--include/asm-x86_64/mmu_context.h9
-rw-r--r--include/asm-x86_64/mmzone.h16
-rw-r--r--include/asm-x86_64/mpspec.h2
-rw-r--r--include/asm-x86_64/mutex.h113
-rw-r--r--include/asm-x86_64/numa.h5
-rw-r--r--include/asm-x86_64/page.h15
-rw-r--r--include/asm-x86_64/param.h3
-rw-r--r--include/asm-x86_64/pci.h11
-rw-r--r--include/asm-x86_64/pda.h11
-rw-r--r--include/asm-x86_64/percpu.h2
-rw-r--r--include/asm-x86_64/pgtable.h34
-rw-r--r--include/asm-x86_64/processor.h12
-rw-r--r--include/asm-x86_64/proto.h15
-rw-r--r--include/asm-x86_64/segment.h4
-rw-r--r--include/asm-x86_64/smp.h1
-rw-r--r--include/asm-x86_64/swiotlb.h16
-rw-r--r--include/asm-x86_64/system.h55
-rw-r--r--include/asm-x86_64/thread_info.h3
-rw-r--r--include/asm-x86_64/timex.h16
-rw-r--r--include/asm-x86_64/topology.h1
-rw-r--r--include/asm-x86_64/uaccess.h1
-rw-r--r--include/asm-x86_64/unistd.h4
-rw-r--r--include/asm-x86_64/vsyscall.h4
-rw-r--r--include/asm-xtensa/atomic.h2
-rw-r--r--include/asm-xtensa/bitops.h1
-rw-r--r--include/asm-xtensa/ioctl.h84
-rw-r--r--include/asm-xtensa/mman.h1
-rw-r--r--include/asm-xtensa/mutex.h9
-rw-r--r--include/asm-xtensa/processor.h6
-rw-r--r--include/asm-xtensa/ptrace.h4
-rw-r--r--include/asm-xtensa/thread_info.h2
-rw-r--r--include/keys/user-type.h1
-rw-r--r--include/linux/aio.h12
-rw-r--r--include/linux/amba/bus.h (renamed from include/asm-arm/hardware/amba.h)0
-rw-r--r--include/linux/amba/clcd.h (renamed from include/asm-arm/hardware/amba_clcd.h)0
-rw-r--r--include/linux/amba/kmi.h (renamed from include/asm-arm/hardware/amba_kmi.h)0
-rw-r--r--include/linux/amba/serial.h (renamed from include/asm-arm/hardware/amba_serial.h)0
-rw-r--r--include/linux/ata.h8
-rw-r--r--include/linux/atalk.h18
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/bitops.h9
-rw-r--r--include/linux/blkdev.h118
-rw-r--r--include/linux/bootmem.h46
-rw-r--r--include/linux/buffer_head.h3
-rw-r--r--include/linux/byteorder/generic.h2
-rw-r--r--include/linux/byteorder/swab.h2
-rw-r--r--include/linux/byteorder/swabb.h2
-rw-r--r--include/linux/cache.h19
-rw-r--r--include/linux/calc64.h49
-rw-r--r--include/linux/capability.h3
-rw-r--r--include/linux/clk.h (renamed from include/asm-arm/hardware/clock.h)30
-rw-r--r--include/linux/compat_ioctl.h34
-rw-r--r--include/linux/compiler-gcc.h17
-rw-r--r--include/linux/compiler-gcc2.h29
-rw-r--r--include/linux/compiler-gcc3.h17
-rw-r--r--include/linux/compiler-gcc4.h7
-rw-r--r--include/linux/compiler.h2
-rw-r--r--include/linux/configfs.h205
-rw-r--r--include/linux/cpufreq.h10
-rw-r--r--include/linux/cpuset.h40
-rw-r--r--include/linux/crypto.h5
-rw-r--r--include/linux/cycx_x25.h66
-rw-r--r--include/linux/dcache.h9
-rw-r--r--include/linux/dccp.h7
-rw-r--r--include/linux/device.h14
-rw-r--r--include/linux/dm-ioctl.h11
-rw-r--r--include/linux/dmi.h5
-rw-r--r--include/linux/dvb/frontend.h10
-rw-r--r--include/linux/elevator.h5
-rw-r--r--include/linux/elf.h2
-rw-r--r--include/linux/etherdevice.h3
-rw-r--r--include/linux/ext3_fs_i.h2
-rw-r--r--include/linux/filter.h2
-rw-r--r--include/linux/firmware.h2
-rw-r--r--include/linux/fs.h75
-rw-r--r--include/linux/fuse.h24
-rw-r--r--include/linux/gfp.h5
-rw-r--r--include/linux/hrtimer.h139
-rw-r--r--include/linux/hugetlb.h4
-rw-r--r--include/linux/hwmon-vid.h6
-rw-r--r--include/linux/i2c-id.h21
-rw-r--r--include/linux/i2c.h41
-rw-r--r--include/linux/i2o.h976
-rw-r--r--include/linux/ide.h7
-rw-r--r--include/linux/if_frad.h12
-rw-r--r--include/linux/if_pppox.h3
-rw-r--r--include/linux/inet.h2
-rw-r--r--include/linux/input.h79
-rw-r--r--include/linux/interrupt.h4
-rw-r--r--include/linux/ip.h131
-rw-r--r--include/linux/ipv6.h83
-rw-r--r--include/linux/irq.h13
-rw-r--r--include/linux/isdnif.h70
-rw-r--r--include/linux/isicom.h59
-rw-r--r--include/linux/jbd.h8
-rw-r--r--include/linux/jffs2_fs_i.h4
-rw-r--r--include/linux/jiffies.h18
-rw-r--r--include/linux/kbd_kern.h2
-rw-r--r--include/linux/kernel.h15
-rw-r--r--include/linux/kexec.h4
-rw-r--r--include/linux/key.h20
-rw-r--r--include/linux/keyctl.h3
-rw-r--r--include/linux/kobject.h54
-rw-r--r--include/linux/kobject_uevent.h57
-rw-r--r--include/linux/kprobes.h6
-rw-r--r--include/linux/ktime.h284
-rw-r--r--include/linux/libata.h24
-rw-r--r--include/linux/list.h14
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/loop.h4
-rw-r--r--include/linux/memory.h8
-rw-r--r--include/linux/mempolicy.h84
-rw-r--r--include/linux/mm.h110
-rw-r--r--include/linux/mm_inline.h22
-rw-r--r--include/linux/mmc/card.h5
-rw-r--r--include/linux/mmc/mmc.h6
-rw-r--r--include/linux/mmzone.h52
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--include/linux/mount.h9
-rw-r--r--include/linux/msdos_fs.h3
-rw-r--r--include/linux/mutex-debug.h23
-rw-r--r--include/linux/mutex.h120
-rw-r--r--include/linux/namei.h2
-rw-r--r--include/linux/nbd.h8
-rw-r--r--include/linux/ncp.h126
-rw-r--r--include/linux/net.h4
-rw-r--r--include/linux/netdevice.h11
-rw-r--r--include/linux/netfilter.h92
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h5
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_protocol.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h52
-rw-r--r--include/linux/netfilter_ipv6.h5
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h52
-rw-r--r--include/linux/nfs_fs.h65
-rw-r--r--include/linux/nfs_idmap.h2
-rw-r--r--include/linux/nfs_page.h12
-rw-r--r--include/linux/nfs_xdr.h89
-rw-r--r--include/linux/nfsd/nfsfh.h6
-rw-r--r--include/linux/nfsd/xdr.h3
-rw-r--r--include/linux/nfsd/xdr3.h1
-rw-r--r--include/linux/page-flags.h91
-rw-r--r--include/linux/pagevec.h5
-rw-r--r--include/linux/parport.h3
-rw-r--r--include/linux/parport_pc.h4
-rw-r--r--include/linux/pci.h69
-rw-r--r--include/linux/pci_ids.h50
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/percpu.h8
-rw-r--r--include/linux/pfkeyv2.h13
-rw-r--r--include/linux/pipe_fs_i.h2
-rw-r--r--include/linux/pkt_sched.h7
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pmu.h8
-rw-r--r--include/linux/pnp.h9
-rw-r--r--include/linux/posix-timers.h90
-rw-r--r--include/linux/ptrace.h4
-rw-r--r--include/linux/radix-tree.h1
-rw-r--r--include/linux/raid/md.h4
-rw-r--r--include/linux/raid/md_k.h80
-rw-r--r--include/linux/raid/raid1.h14
-rw-r--r--include/linux/raid/raid10.h22
-rw-r--r--include/linux/raid/raid5.h7
-rw-r--r--include/linux/ramfs.h10
-rw-r--r--include/linux/random.h6
-rw-r--r--include/linux/rcupdate.h37
-rw-r--r--include/linux/rcuref.h220
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/relayfs_fs.h65
-rw-r--r--include/linux/rio_drv.h5
-rw-r--r--include/linux/rmap.h1
-rw-r--r--include/linux/rtc.h3
-rw-r--r--include/linux/sched.h91
-rw-r--r--include/linux/screen_info.h76
-rw-r--r--include/linux/sdla.h64
-rw-r--r--include/linux/seccomp.h6
-rw-r--r--include/linux/security.h132
-rw-r--r--include/linux/serial_core.h3
-rw-r--r--include/linux/signal.h30
-rw-r--r--include/linux/skbuff.h7
-rw-r--r--include/linux/slab.h35
-rw-r--r--include/linux/socket.h1
-rw-r--r--include/linux/spinlock.h3
-rw-r--r--include/linux/spinlock_types_up.h14
-rw-r--r--include/linux/sunrpc/clnt.h5
-rw-r--r--include/linux/sunrpc/gss_spkm3.h2
-rw-r--r--include/linux/sunrpc/sched.h48
-rw-r--r--include/linux/sunrpc/xdr.h6
-rw-r--r--include/linux/sunrpc/xprt.h12
-rw-r--r--include/linux/suspend.h8
-rw-r--r--include/linux/swap.h11
-rw-r--r--include/linux/synclink.h9
-rw-r--r--include/linux/syscalls.h7
-rw-r--r--include/linux/sysctl.h5
-rw-r--r--include/linux/tcp.h21
-rw-r--r--include/linux/time.h186
-rw-r--r--include/linux/timer.h2
-rw-r--r--include/linux/topology.h2
-rw-r--r--include/linux/tty.h97
-rw-r--r--include/linux/tty_flip.h20
-rw-r--r--include/linux/tty_ldisc.h9
-rw-r--r--include/linux/udf_fs.h5
-rw-r--r--include/linux/udf_fs_i.h5
-rw-r--r--include/linux/udf_fs_sb.h5
-rw-r--r--include/linux/udp.h6
-rw-r--r--include/linux/usb.h35
-rw-r--r--include/linux/usb_usual.h126
-rw-r--r--include/linux/video_decoder.h2
-rw-r--r--include/linux/videodev2.h16
-rw-r--r--include/linux/wavefront.h36
-rw-r--r--include/linux/workqueue.h1
-rw-r--r--include/linux/writeback.h19
-rw-r--r--include/linux/xattr.h19
-rw-r--r--include/linux/xfrm.h29
-rw-r--r--include/linux/zlib.h11
-rw-r--r--include/media/audiochip.h16
-rw-r--r--include/media/saa7146.h6
-rw-r--r--include/media/saa7146_vv.h2
-rw-r--r--include/media/tuner.h99
-rw-r--r--include/media/v4l2-common.h84
-rw-r--r--include/net/act_api.h2
-rw-r--r--include/net/af_unix.h12
-rw-r--r--include/net/atmclip.h2
-rw-r--r--include/net/dn_dev.h84
-rw-r--r--include/net/dn_nsp.h74
-rw-r--r--include/net/dst.h12
-rw-r--r--include/net/flow.h7
-rw-r--r--include/net/genetlink.h2
-rw-r--r--include/net/icmp.h9
-rw-r--r--include/net/ieee80211_crypt.h9
-rw-r--r--include/net/inet6_connection_sock.h42
-rw-r--r--include/net/inet6_hashtables.h32
-rw-r--r--include/net/inet_common.h4
-rw-r--r--include/net/inet_connection_sock.h47
-rw-r--r--include/net/inet_ecn.h2
-rw-r--r--include/net/inet_hashtables.h24
-rw-r--r--include/net/inet_sock.h193
-rw-r--r--include/net/inet_timewait_sock.h8
-rw-r--r--include/net/inetpeer.h1
-rw-r--r--include/net/ip.h28
-rw-r--r--include/net/ip_fib.h2
-rw-r--r--include/net/ip_vs.h12
-rw-r--r--include/net/ipv6.h14
-rw-r--r--include/net/ndisc.h17
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h31
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h2
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h15
-rw-r--r--include/net/netfilter/nf_conntrack_protocol.h26
-rw-r--r--include/net/pkt_act.h1
-rw-r--r--include/net/pkt_sched.h23
-rw-r--r--include/net/protocol.h5
-rw-r--r--include/net/raw.h2
-rw-r--r--include/net/request_sock.h2
-rw-r--r--include/net/sctp/structs.h76
-rw-r--r--include/net/sctp/user.h30
-rw-r--r--include/net/sock.h36
-rw-r--r--include/net/tcp.h246
-rw-r--r--include/net/tcp_states.h16
-rw-r--r--include/net/timewait_sock.h31
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/net/udp.h4
-rw-r--r--include/net/xfrm.h39
-rw-r--r--include/pcmcia/cs.h2
-rw-r--r--include/pcmcia/ds.h13
-rw-r--r--include/pcmcia/ss.h4
-rw-r--r--include/scsi/scsi_cmnd.h2
-rw-r--r--include/scsi/scsi_dbg.h1
-rw-r--r--include/scsi/scsi_device.h12
-rw-r--r--include/scsi/scsi_driver.h1
-rw-r--r--include/scsi/scsi_host.h7
-rw-r--r--include/scsi/scsi_transport_spi.h4
-rw-r--r--include/sound/ac97_codec.h169
-rw-r--r--include/sound/ad1816a.h22
-rw-r--r--include/sound/ad1848.h33
-rw-r--r--include/sound/ainstr_fm.h28
-rw-r--r--include/sound/ainstr_gf1.h46
-rw-r--r--include/sound/ainstr_iw.h115
-rw-r--r--include/sound/ainstr_simple.h35
-rw-r--r--include/sound/ak4114.h30
-rw-r--r--include/sound/ak4117.h24
-rw-r--r--include/sound/ak4531_codec.h17
-rw-r--r--include/sound/ak4xxx-adda.h22
-rw-r--r--include/sound/asequencer.h378
-rw-r--r--include/sound/asound.h566
-rw-r--r--include/sound/asound_fm.h24
-rw-r--r--include/sound/control.h94
-rw-r--r--include/sound/core.h226
-rw-r--r--include/sound/cs4231.h113
-rw-r--r--include/sound/cs46xx.h89
-rw-r--r--include/sound/cs46xx_dsp_scb_types.h145
-rw-r--r--include/sound/cs46xx_dsp_spos.h119
-rw-r--r--include/sound/cs46xx_dsp_task_types.h35
-rw-r--r--include/sound/cs8403.h8
-rw-r--r--include/sound/cs8427.h17
-rw-r--r--include/sound/driver.h7
-rw-r--r--include/sound/emu10k1.h371
-rw-r--r--include/sound/emu10k1_synth.h6
-rw-r--r--include/sound/emu8000.h39
-rw-r--r--include/sound/emux_synth.h105
-rw-r--r--include/sound/es1688.h22
-rw-r--r--include/sound/gus.h379
-rw-r--r--include/sound/hdsp.h51
-rw-r--r--include/sound/hdspm.h45
-rw-r--r--include/sound/hwdep.h43
-rw-r--r--include/sound/i2c.h78
-rw-r--r--include/sound/info.h107
-rw-r--r--include/sound/initval.h14
-rw-r--r--include/sound/minors.h29
-rw-r--r--include/sound/mixer_oss.h54
-rw-r--r--include/sound/mpu401.h26
-rw-r--r--include/sound/opl3.h57
-rw-r--r--include/sound/opl4.h6
-rw-r--r--include/sound/pcm-indirect.h28
-rw-r--r--include/sound/pcm.h476
-rw-r--r--include/sound/pcm_oss.h41
-rw-r--r--include/sound/pcm_params.h86
-rw-r--r--include/sound/rawmidi.h125
-rw-r--r--include/sound/sb.h74
-rw-r--r--include/sound/sb16_csp.h52
-rw-r--r--include/sound/seq_device.h18
-rw-r--r--include/sound/seq_instr.h64
-rw-r--r--include/sound/seq_kernel.h125
-rw-r--r--include/sound/seq_midi_emul.h44
-rw-r--r--include/sound/seq_midi_event.h22
-rw-r--r--include/sound/seq_oss.h30
-rw-r--r--include/sound/seq_virmidi.h22
-rw-r--r--include/sound/sfnt_info.h36
-rw-r--r--include/sound/snd_wavefront.h20
-rw-r--r--include/sound/soundfont.h75
-rw-r--r--include/sound/tea575x-tuner.h12
-rw-r--r--include/sound/tea6330t.h17
-rw-r--r--include/sound/timer.h94
-rw-r--r--include/sound/trident.h153
-rw-r--r--include/sound/typedefs.h173
-rw-r--r--include/sound/uda1341.h109
-rw-r--r--include/sound/util_mem.h32
-rw-r--r--include/sound/version.h4
-rw-r--r--include/sound/vx_core.h131
-rw-r--r--include/sound/wavefront.h36
-rw-r--r--include/sound/ymfpci.h112
-rw-r--r--include/video/cyblafb.h4
-rw-r--r--include/video/kyro.h1
-rw-r--r--include/video/neomagic.h1
-rw-r--r--include/video/newport.h5
-rw-r--r--include/video/sstfb.h1
-rw-r--r--include/video/tdfx.h86
901 files changed, 14970 insertions, 12499 deletions
diff --git a/include/asm-alpha/atomic.h b/include/asm-alpha/atomic.h
index 6183eab006d4..fc77f7413083 100644
--- a/include/asm-alpha/atomic.h
+++ b/include/asm-alpha/atomic.h
@@ -176,6 +176,7 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
176} 176}
177 177
178#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 178#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
179#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
179 180
180#define atomic_add_unless(v, a, u) \ 181#define atomic_add_unless(v, a, u) \
181({ \ 182({ \
@@ -216,4 +217,5 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
216#define smp_mb__before_atomic_inc() smp_mb() 217#define smp_mb__before_atomic_inc() smp_mb()
217#define smp_mb__after_atomic_inc() smp_mb() 218#define smp_mb__after_atomic_inc() smp_mb()
218 219
220#include <asm-generic/atomic.h>
219#endif /* _ALPHA_ATOMIC_H */ 221#endif /* _ALPHA_ATOMIC_H */
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h
index 578ed3f1a607..302201f1a097 100644
--- a/include/asm-alpha/bitops.h
+++ b/include/asm-alpha/bitops.h
@@ -321,6 +321,7 @@ static inline int fls(int word)
321#else 321#else
322#define fls generic_fls 322#define fls generic_fls
323#endif 323#endif
324#define fls64 generic_fls64
324 325
325/* Compute powers of two for the given integer. */ 326/* Compute powers of two for the given integer. */
326static inline long floor_log2(unsigned long word) 327static inline long floor_log2(unsigned long word)
diff --git a/include/asm-alpha/cache.h b/include/asm-alpha/cache.h
index e69b29501a5f..e6d4d1695e25 100644
--- a/include/asm-alpha/cache.h
+++ b/include/asm-alpha/cache.h
@@ -20,6 +20,5 @@
20 20
21#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) 21#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
22#define SMP_CACHE_BYTES L1_CACHE_BYTES 22#define SMP_CACHE_BYTES L1_CACHE_BYTES
23#define L1_CACHE_SHIFT_MAX L1_CACHE_SHIFT
24 23
25#endif 24#endif
diff --git a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h
index 0a4a8b40dfcd..00c6f57ad9a7 100644
--- a/include/asm-alpha/compiler.h
+++ b/include/asm-alpha/compiler.h
@@ -98,9 +98,7 @@
98#undef inline 98#undef inline
99#undef __inline__ 99#undef __inline__
100#undef __inline 100#undef __inline
101#if __GNUC__ == 3 && __GNUC_MINOR__ >= 1 || __GNUC__ > 3
102#undef __always_inline 101#undef __always_inline
103#define __always_inline inline __attribute__((always_inline)) 102#define __always_inline inline __attribute__((always_inline))
104#endif
105 103
106#endif /* __ALPHA_COMPILER_H */ 104#endif /* __ALPHA_COMPILER_H */
diff --git a/include/asm-alpha/dma-mapping.h b/include/asm-alpha/dma-mapping.h
index 680f7ecbb28f..9dc7256cf979 100644
--- a/include/asm-alpha/dma-mapping.h
+++ b/include/asm-alpha/dma-mapping.h
@@ -16,7 +16,7 @@
16#define dma_free_coherent(dev, size, va, addr) \ 16#define dma_free_coherent(dev, size, va, addr) \
17 pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr) 17 pci_free_consistent(alpha_gendev_to_pci(dev), size, va, addr)
18#define dma_map_page(dev, page, off, size, dir) \ 18#define dma_map_page(dev, page, off, size, dir) \
19 pci_map_single(alpha_gendev_to_pci(dev), page, off, size, dir) 19 pci_map_page(alpha_gendev_to_pci(dev), page, off, size, dir)
20#define dma_unmap_page(dev, addr, size, dir) \ 20#define dma_unmap_page(dev, addr, size, dir) \
21 pci_unmap_page(alpha_gendev_to_pci(dev), addr, size, dir) 21 pci_unmap_page(alpha_gendev_to_pci(dev), addr, size, dir)
22#define dma_map_sg(dev, sg, nents, dir) \ 22#define dma_map_sg(dev, sg, nents, dir) \
diff --git a/include/asm-alpha/futex.h b/include/asm-alpha/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-alpha/futex.h
+++ b/include/asm-alpha/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-alpha/hardirq.h b/include/asm-alpha/hardirq.h
index c0593f9b21e1..7bb6a36c96a1 100644
--- a/include/asm-alpha/hardirq.h
+++ b/include/asm-alpha/hardirq.h
@@ -13,6 +13,8 @@ typedef struct {
13 13
14#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ 14#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
15 15
16void ack_bad_irq(unsigned int irq);
17
16#define HARDIRQ_BITS 12 18#define HARDIRQ_BITS 12
17 19
18/* 20/*
diff --git a/include/asm-alpha/mman.h b/include/asm-alpha/mman.h
index eb9c279045ef..f6439532a262 100644
--- a/include/asm-alpha/mman.h
+++ b/include/asm-alpha/mman.h
@@ -42,6 +42,7 @@
42#define MADV_WILLNEED 3 /* will need these pages */ 42#define MADV_WILLNEED 3 /* will need these pages */
43#define MADV_SPACEAVAIL 5 /* ensure resources are available */ 43#define MADV_SPACEAVAIL 5 /* ensure resources are available */
44#define MADV_DONTNEED 6 /* don't need these pages */ 44#define MADV_DONTNEED 6 /* don't need these pages */
45#define MADV_REMOVE 7 /* remove these pages & resources */
45 46
46/* compatibility flags */ 47/* compatibility flags */
47#define MAP_ANON MAP_ANONYMOUS 48#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h
index a714d0cdc204..6f92482cc96c 100644
--- a/include/asm-alpha/mmu_context.h
+++ b/include/asm-alpha/mmu_context.h
@@ -156,7 +156,7 @@ ev5_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
156 /* Always update the PCB ASN. Another thread may have allocated 156 /* Always update the PCB ASN. Another thread may have allocated
157 a new mm->context (via flush_tlb_mm) without the ASN serial 157 a new mm->context (via flush_tlb_mm) without the ASN serial
158 number wrapping. We have no way to detect when this is needed. */ 158 number wrapping. We have no way to detect when this is needed. */
159 next->thread_info->pcb.asn = mmc & HARDWARE_ASN_MASK; 159 task_thread_info(next)->pcb.asn = mmc & HARDWARE_ASN_MASK;
160} 160}
161 161
162__EXTERN_INLINE void 162__EXTERN_INLINE void
@@ -235,7 +235,7 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
235 if (cpu_online(i)) 235 if (cpu_online(i))
236 mm->context[i] = 0; 236 mm->context[i] = 0;
237 if (tsk != current) 237 if (tsk != current)
238 tsk->thread_info->pcb.ptbr 238 task_thread_info(tsk)->pcb.ptbr
239 = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT; 239 = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
240 return 0; 240 return 0;
241} 241}
@@ -249,7 +249,7 @@ destroy_context(struct mm_struct *mm)
249static inline void 249static inline void
250enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 250enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
251{ 251{
252 tsk->thread_info->pcb.ptbr 252 task_thread_info(tsk)->pcb.ptbr
253 = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT; 253 = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
254} 254}
255 255
diff --git a/include/asm-alpha/mutex.h b/include/asm-alpha/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-alpha/mutex.h
@@ -0,0 +1,9 @@
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-alpha/processor.h b/include/asm-alpha/processor.h
index 059780a7d3d7..425b7b6d28cb 100644
--- a/include/asm-alpha/processor.h
+++ b/include/asm-alpha/processor.h
@@ -52,19 +52,10 @@ extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
52 52
53unsigned long get_wchan(struct task_struct *p); 53unsigned long get_wchan(struct task_struct *p);
54 54
55/* See arch/alpha/kernel/ptrace.c for details. */ 55#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
56#define PT_REG(reg) \
57 (PAGE_SIZE*2 - sizeof(struct pt_regs) + offsetof(struct pt_regs, reg))
58
59#define SW_REG(reg) \
60 (PAGE_SIZE*2 - sizeof(struct pt_regs) - sizeof(struct switch_stack) \
61 + offsetof(struct switch_stack, reg))
62
63#define KSTK_EIP(tsk) \
64 (*(unsigned long *)(PT_REG(pc) + (unsigned long) ((tsk)->thread_info)))
65 56
66#define KSTK_ESP(tsk) \ 57#define KSTK_ESP(tsk) \
67 ((tsk) == current ? rdusp() : (tsk)->thread_info->pcb.usp) 58 ((tsk) == current ? rdusp() : task_thread_info(tsk)->pcb.usp)
68 59
69#define cpu_relax() barrier() 60#define cpu_relax() barrier()
70 61
@@ -77,7 +68,6 @@ unsigned long get_wchan(struct task_struct *p);
77#define spin_lock_prefetch(lock) do { } while (0) 68#define spin_lock_prefetch(lock) do { } while (0)
78#endif 69#endif
79 70
80#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
81extern inline void prefetch(const void *ptr) 71extern inline void prefetch(const void *ptr)
82{ 72{
83 __builtin_prefetch(ptr, 0, 3); 73 __builtin_prefetch(ptr, 0, 3);
@@ -95,24 +85,4 @@ extern inline void spin_lock_prefetch(const void *ptr)
95} 85}
96#endif 86#endif
97 87
98#else
99extern inline void prefetch(const void *ptr)
100{
101 __asm__ ("ldl $31,%0" : : "m"(*(char *)ptr));
102}
103
104extern inline void prefetchw(const void *ptr)
105{
106 __asm__ ("ldq $31,%0" : : "m"(*(char *)ptr));
107}
108
109#ifdef CONFIG_SMP
110extern inline void spin_lock_prefetch(const void *ptr)
111{
112 __asm__ ("ldq $31,%0" : : "m"(*(char *)ptr));
113}
114#endif
115
116#endif /* GCC 3.1 */
117
118#endif /* __ASM_ALPHA_PROCESSOR_H */ 88#endif /* __ASM_ALPHA_PROCESSOR_H */
diff --git a/include/asm-alpha/ptrace.h b/include/asm-alpha/ptrace.h
index 072375c135b4..9933b8b3612e 100644
--- a/include/asm-alpha/ptrace.h
+++ b/include/asm-alpha/ptrace.h
@@ -75,10 +75,10 @@ struct switch_stack {
75#define profile_pc(regs) instruction_pointer(regs) 75#define profile_pc(regs) instruction_pointer(regs)
76extern void show_regs(struct pt_regs *); 76extern void show_regs(struct pt_regs *);
77 77
78#define alpha_task_regs(task) \ 78#define task_pt_regs(task) \
79 ((struct pt_regs *) ((long) (task)->thread_info + 2*PAGE_SIZE) - 1) 79 ((struct pt_regs *) (task_stack_page(task) + 2*PAGE_SIZE) - 1)
80 80
81#define force_successful_syscall_return() (alpha_task_regs(current)->r0 = 0) 81#define force_successful_syscall_return() (task_pt_regs(current)->r0 = 0)
82 82
83#endif 83#endif
84 84
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h
index 050e86d12891..cc9c7e8cced5 100644
--- a/include/asm-alpha/system.h
+++ b/include/asm-alpha/system.h
@@ -131,15 +131,25 @@ struct el_common_EV6_mcheck {
131extern void halt(void) __attribute__((noreturn)); 131extern void halt(void) __attribute__((noreturn));
132#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt)) 132#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
133 133
134#define switch_to(P,N,L) \ 134#define switch_to(P,N,L) \
135 do { \ 135 do { \
136 (L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P)); \ 136 (L) = alpha_switch_to(virt_to_phys(&task_thread_info(N)->pcb), (P)); \
137 check_mmu_context(); \ 137 check_mmu_context(); \
138 } while (0) 138 } while (0)
139 139
140struct task_struct; 140struct task_struct;
141extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*); 141extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*);
142 142
143/*
144 * On SMP systems, when the scheduler does migration-cost autodetection,
145 * it needs a way to flush as much of the CPU's caches as possible.
146 *
147 * TODO: fill this in!
148 */
149static inline void sched_cacheflush(void)
150{
151}
152
143#define imb() \ 153#define imb() \
144__asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory") 154__asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
145 155
diff --git a/include/asm-alpha/thread_info.h b/include/asm-alpha/thread_info.h
index d51491ed00b8..69ffd93f8e22 100644
--- a/include/asm-alpha/thread_info.h
+++ b/include/asm-alpha/thread_info.h
@@ -54,8 +54,6 @@ register struct thread_info *__current_thread_info __asm__("$8");
54#define alloc_thread_info(tsk) \ 54#define alloc_thread_info(tsk) \
55 ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) 55 ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
56#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 56#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
57#define get_thread_info(ti) get_task_struct((ti)->task)
58#define put_thread_info(ti) put_task_struct((ti)->task)
59 57
60#endif /* __ASSEMBLY__ */ 58#endif /* __ASSEMBLY__ */
61 59
diff --git a/include/asm-arm/arch-aaec2000/dma.h b/include/asm-arm/arch-aaec2000/dma.h
index 28c890b4a1d3..e100b1e526fe 100644
--- a/include/asm-arm/arch-aaec2000/dma.h
+++ b/include/asm-arm/arch-aaec2000/dma.h
@@ -7,11 +7,3 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#define MAX_DMA_ADDRESS 0xffffffff
15#define MAX_DMA_CHANNELS 0
16
17#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200.h b/include/asm-arm/arch-at91rm9200/at91rm9200.h
new file mode 100644
index 000000000000..58f40931a5c1
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200.h
@@ -0,0 +1,261 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Common definitions.
8 * Based on AT91RM9200 datasheet revision E.
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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_H
17#define AT91RM9200_H
18
19/*
20 * Peripheral identifiers/interrupts.
21 */
22#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
23#define AT91_ID_SYS 1 /* System Peripheral */
24#define AT91_ID_PIOA 2 /* Parallel IO Controller A */
25#define AT91_ID_PIOB 3 /* Parallel IO Controller B */
26#define AT91_ID_PIOC 4 /* Parallel IO Controller C */
27#define AT91_ID_PIOD 5 /* Parallel IO Controller D */
28#define AT91_ID_US0 6 /* USART 0 */
29#define AT91_ID_US1 7 /* USART 1 */
30#define AT91_ID_US2 8 /* USART 2 */
31#define AT91_ID_US3 9 /* USART 3 */
32#define AT91_ID_MCI 10 /* Multimedia Card Interface */
33#define AT91_ID_UDP 11 /* USB Device Port */
34#define AT91_ID_TWI 12 /* Two-Wire Interface */
35#define AT91_ID_SPI 13 /* Serial Peripheral Interface */
36#define AT91_ID_SSC0 14 /* Serial Synchronous Controller 0 */
37#define AT91_ID_SSC1 15 /* Serial Synchronous Controller 1 */
38#define AT91_ID_SSC2 16 /* Serial Synchronous Controller 2 */
39#define AT91_ID_TC0 17 /* Timer Counter 0 */
40#define AT91_ID_TC1 18 /* Timer Counter 1 */
41#define AT91_ID_TC2 19 /* Timer Counter 2 */
42#define AT91_ID_TC3 20 /* Timer Counter 3 */
43#define AT91_ID_TC4 21 /* Timer Counter 4 */
44#define AT91_ID_TC5 22 /* Timer Counter 5 */
45#define AT91_ID_UHP 23 /* USB Host port */
46#define AT91_ID_EMAC 24 /* Ethernet MAC */
47#define AT91_ID_IRQ0 25 /* Advanced Interrupt Controller (IRQ0) */
48#define AT91_ID_IRQ1 26 /* Advanced Interrupt Controller (IRQ1) */
49#define AT91_ID_IRQ2 27 /* Advanced Interrupt Controller (IRQ2) */
50#define AT91_ID_IRQ3 28 /* Advanced Interrupt Controller (IRQ3) */
51#define AT91_ID_IRQ4 29 /* Advanced Interrupt Controller (IRQ4) */
52#define AT91_ID_IRQ5 30 /* Advanced Interrupt Controller (IRQ5) */
53#define AT91_ID_IRQ6 31 /* Advanced Interrupt Controller (IRQ6) */
54
55
56/*
57 * Peripheral physical base addresses.
58 */
59#define AT91_BASE_TCB0 0xfffa0000
60#define AT91_BASE_TC0 0xfffa0000
61#define AT91_BASE_TC1 0xfffa0040
62#define AT91_BASE_TC2 0xfffa0080
63#define AT91_BASE_TCB1 0xfffa4000
64#define AT91_BASE_TC3 0xfffa4000
65#define AT91_BASE_TC4 0xfffa4040
66#define AT91_BASE_TC5 0xfffa4080
67#define AT91_BASE_UDP 0xfffb0000
68#define AT91_BASE_MCI 0xfffb4000
69#define AT91_BASE_TWI 0xfffb8000
70#define AT91_BASE_EMAC 0xfffbc000
71#define AT91_BASE_US0 0xfffc0000
72#define AT91_BASE_US1 0xfffc4000
73#define AT91_BASE_US2 0xfffc8000
74#define AT91_BASE_US3 0xfffcc000
75#define AT91_BASE_SSC0 0xfffd0000
76#define AT91_BASE_SSC1 0xfffd4000
77#define AT91_BASE_SSC2 0xfffd8000
78#define AT91_BASE_SPI 0xfffe0000
79#define AT91_BASE_SYS 0xfffff000
80
81
82/*
83 * PIO pin definitions (peripheral A/B multiplexing).
84 */
85#define AT91_PA0_MISO (1 << 0) /* A: SPI Master-In Slave-Out */
86#define AT91_PA0_PCK3 (1 << 0) /* B: PMC Programmable Clock Output 3 */
87#define AT91_PA1_MOSI (1 << 1) /* A: SPI Master-Out Slave-In */
88#define AT91_PA1_PCK0 (1 << 1) /* B: PMC Programmable Clock Output 0 */
89#define AT91_PA2_SPCK (1 << 2) /* A: SPI Serial Clock */
90#define AT91_PA2_IRQ4 (1 << 2) /* B: External Interrupt 4 */
91#define AT91_PA3_NPCS0 (1 << 3) /* A: SPI Peripheral Chip Select 0 */
92#define AT91_PA3_IRQ5 (1 << 3) /* B: External Interrupt 5 */
93#define AT91_PA4_NPCS1 (1 << 4) /* A: SPI Peripheral Chip Select 1 */
94#define AT91_PA4_PCK1 (1 << 4) /* B: PMC Programmable Clock Output 1 */
95#define AT91_PA5_NPCS2 (1 << 5) /* A: SPI Peripheral Chip Select 2 */
96#define AT91_PA5_TXD3 (1 << 5) /* B: USART Transmit Data 3 */
97#define AT91_PA6_NPCS3 (1 << 6) /* A: SPI Peripheral Chip Select 3 */
98#define AT91_PA6_RXD3 (1 << 6) /* B: USART Receive Data 3 */
99#define AT91_PA7_ETXCK_EREFCK (1 << 7) /* A: Ethernet Reference Clock / Transmit Clock */
100#define AT91_PA7_PCK2 (1 << 7) /* B: PMC Programmable Clock Output 2 */
101#define AT91_PA8_ETXEN (1 << 8) /* A: Ethernet Transmit Enable */
102#define AT91_PA8_MCCDB (1 << 8) /* B: MMC Multimedia Card B Command */
103#define AT91_PA9_ETX0 (1 << 9) /* A: Ethernet Transmit Data 0 */
104#define AT91_PA9_MCDB0 (1 << 9) /* B: MMC Multimedia Card B Data 0 */
105#define AT91_PA10_ETX1 (1 << 10) /* A: Ethernet Transmit Data 1 */
106#define AT91_PA10_MCDB1 (1 << 10) /* B: MMC Multimedia Card B Data 1 */
107#define AT91_PA11_ECRS_ECRSDV (1 << 11) /* A: Ethernet Carrier Sense / Data Valid */
108#define AT91_PA11_MCDB2 (1 << 11) /* B: MMC Multimedia Card B Data 2 */
109#define AT91_PA12_ERX0 (1 << 12) /* A: Ethernet Receive Data 0 */
110#define AT91_PA12_MCDB3 (1 << 12) /* B: MMC Multimedia Card B Data 3 */
111#define AT91_PA13_ERX1 (1 << 13) /* A: Ethernet Receive Data 1 */
112#define AT91_PA13_TCLK0 (1 << 13) /* B: TC External Clock Input 0 */
113#define AT91_PA14_ERXER (1 << 14) /* A: Ethernet Receive Error */
114#define AT91_PA14_TCLK1 (1 << 14) /* B: TC External Clock Input 1 */
115#define AT91_PA15_EMDC (1 << 15) /* A: Ethernet Management Data Clock */
116#define AT91_PA15_TCLK2 (1 << 15) /* B: TC External Clock Input 2 */
117#define AT91_PA16_EMDIO (1 << 16) /* A: Ethernet Management Data I/O */
118#define AT91_PA16_IRQ6 (1 << 16) /* B: External Interrupt 6 */
119#define AT91_PA17_TXD0 (1 << 17) /* A: USART Transmit Data 0 */
120#define AT91_PA17_TIOA0 (1 << 17) /* B: TC I/O Line A 0 */
121#define AT91_PA18_RXD0 (1 << 18) /* A: USART Receive Data 0 */
122#define AT91_PA18_TIOB0 (1 << 18) /* B: TC I/O Line B 0 */
123#define AT91_PA19_SCK0 (1 << 19) /* A: USART Serial Clock 0 */
124#define AT91_PA19_TIOA1 (1 << 19) /* B: TC I/O Line A 1 */
125#define AT91_PA20_CTS0 (1 << 20) /* A: USART Clear To Send 0 */
126#define AT91_PA20_TIOB1 (1 << 20) /* B: TC I/O Line B 1 */
127#define AT91_PA21_RTS0 (1 << 21) /* A: USART Ready To Send 0 */
128#define AT91_PA21_TIOA2 (1 << 21) /* B: TC I/O Line A 2 */
129#define AT91_PA22_RXD2 (1 << 22) /* A: USART Receive Data 2 */
130#define AT91_PA22_TIOB2 (1 << 22) /* B: TC I/O Line B 2 */
131#define AT91_PA23_TXD2 (1 << 23) /* A: USART Transmit Data 2 */
132#define AT91_PA23_IRQ3 (1 << 23) /* B: External Interrupt 3 */
133#define AT91_PA24_SCK2 (1 << 24) /* A: USART Serial Clock 2 */
134#define AT91_PA24_PCK1 (1 << 24) /* B: PMC Programmable Clock Output 1 */
135#define AT91_PA25_TWD (1 << 25) /* A: TWI Two-wire Serial Data */
136#define AT91_PA25_IRQ2 (1 << 25) /* B: External Interrupt 2 */
137#define AT91_PA26_TWCK (1 << 26) /* A: TWI Two-wire Serial Clock */
138#define AT91_PA26_IRQ1 (1 << 26) /* B: External Interrupt 1 */
139#define AT91_PA27_MCCK (1 << 27) /* A: MMC Multimedia Card Clock */
140#define AT91_PA27_TCLK3 (1 << 27) /* B: TC External Clock Input 3 */
141#define AT91_PA28_MCCDA (1 << 28) /* A: MMC Multimedia Card A Command */
142#define AT91_PA28_TCLK4 (1 << 28) /* B: TC External Clock Input 4 */
143#define AT91_PA29_MCDA0 (1 << 29) /* A: MMC Multimedia Card A Data 0 */
144#define AT91_PA29_TCLK5 (1 << 29) /* B: TC External Clock Input 5 */
145#define AT91_PA30_DRXD (1 << 30) /* A: DBGU Receive Data */
146#define AT91_PA30_CTS2 (1 << 30) /* B: USART Clear To Send 2 */
147#define AT91_PA31_DTXD (1 << 31) /* A: DBGU Transmit Data */
148#define AT91_PA31_RTS2 (1 << 31) /* B: USART Ready To Send 2 */
149
150#define AT91_PB0_TF0 (1 << 0) /* A: SSC Transmit Frame Sync 0 */
151#define AT91_PB0_RTS3 (1 << 0) /* B: USART Ready To Send 3 */
152#define AT91_PB1_TK0 (1 << 1) /* A: SSC Transmit Clock 0 */
153#define AT91_PB1_CTS3 (1 << 1) /* B: USART Clear To Send 3 */
154#define AT91_PB2_TD0 (1 << 2) /* A: SSC Transmit Data 0 */
155#define AT91_PB2_SCK3 (1 << 2) /* B: USART Serial Clock 3 */
156#define AT91_PB3_RD0 (1 << 3) /* A: SSC Receive Data 0 */
157#define AT91_PB3_MCDA1 (1 << 3) /* B: MMC Multimedia Card A Data 1 */
158#define AT91_PB4_RK0 (1 << 4) /* A: SSC Receive Clock 0 */
159#define AT91_PB4_MCDA2 (1 << 4) /* B: MMC Multimedia Card A Data 2 */
160#define AT91_PB5_RF0 (1 << 5) /* A: SSC Receive Frame Sync 0 */
161#define AT91_PB5_MCDA3 (1 << 5) /* B: MMC Multimedia Card A Data 3 */
162#define AT91_PB6_TF1 (1 << 6) /* A: SSC Transmit Frame Sync 1 */
163#define AT91_PB6_TIOA3 (1 << 6) /* B: TC I/O Line A 3 */
164#define AT91_PB7_TK1 (1 << 7) /* A: SSC Transmit Clock 1 */
165#define AT91_PB7_TIOB3 (1 << 7) /* B: TC I/O Line B 3 */
166#define AT91_PB8_TD1 (1 << 8) /* A: SSC Transmit Data 1 */
167#define AT91_PB8_TIOA4 (1 << 8) /* B: TC I/O Line A 4 */
168#define AT91_PB9_RD1 (1 << 9) /* A: SSC Receive Data 1 */
169#define AT91_PB9_TIOB4 (1 << 9) /* B: TC I/O Line B 4 */
170#define AT91_PB10_RK1 (1 << 10) /* A: SSC Receive Clock 1 */
171#define AT91_PB10_TIOA5 (1 << 10) /* B: TC I/O Line A 5 */
172#define AT91_PB11_RF1 (1 << 11) /* A: SSC Receive Frame Sync 1 */
173#define AT91_PB11_TIOB5 (1 << 11) /* B: TC I/O Line B 5 */
174#define AT91_PB12_TF2 (1 << 12) /* A: SSC Transmit Frame Sync 2 */
175#define AT91_PB12_ETX2 (1 << 12) /* B: Ethernet Transmit Data 2 */
176#define AT91_PB13_TK2 (1 << 13) /* A: SSC Transmit Clock 3 */
177#define AT91_PB13_ETX3 (1 << 13) /* B: Ethernet Transmit Data 3 */
178#define AT91_PB14_TD2 (1 << 14) /* A: SSC Transmit Data 2 */
179#define AT91_PB14_ETXER (1 << 14) /* B: Ethernet Transmit Coding Error */
180#define AT91_PB15_RD2 (1 << 15) /* A: SSC Receive Data 2 */
181#define AT91_PB15_ERX2 (1 << 15) /* B: Ethernet Receive Data 2 */
182#define AT91_PB16_RK2 (1 << 16) /* A: SSC Receive Clock 2 */
183#define AT91_PB16_ERX3 (1 << 16) /* B: Ethernet Receive Data 3 */
184#define AT91_PB17_RF2 (1 << 17) /* A: SSC Receive Frame Sync 2 */
185#define AT91_PB17_ERXDV (1 << 17) /* B: Ethernet Receive Data Valid */
186#define AT91_PB18_RI1 (1 << 18) /* A: USART Ring Indicator 1 */
187#define AT91_PB18_ECOL (1 << 18) /* B: Ethernet Collision Detected */
188#define AT91_PB19_DTR1 (1 << 19) /* A: USART Data Terminal Ready 1 */
189#define AT91_PB19_ERXCK (1 << 19) /* B: Ethernet Receive Clock */
190#define AT91_PB20_TXD1 (1 << 20) /* A: USART Transmit Data 1 */
191#define AT91_PB21_RXD1 (1 << 21) /* A: USART Receive Data 1 */
192#define AT91_PB22_SCK1 (1 << 22) /* A: USART Serial Clock 1 */
193#define AT91_PB23_DCD1 (1 << 23) /* A: USART Data Carrier Detect 1 */
194#define AT91_PB24_CTS1 (1 << 24) /* A: USART Clear To Send 1 */
195#define AT91_PB25_DSR1 (1 << 25) /* A: USART Data Set Ready 1 */
196#define AT91_PB25_EF100 (1 << 25) /* B: Ethernet Force 100 Mbit */
197#define AT91_PB26_RTS1 (1 << 26) /* A: USART Ready To Send 1 */
198#define AT91_PB27_PCK0 (1 << 27) /* B: PMC Programmable Clock Output 0 */
199#define AT91_PB28_FIQ (1 << 28) /* A: Fast Interrupt */
200#define AT91_PB29_IRQ0 (1 << 29) /* A: External Interrupt 0 */
201
202#define AT91_PC0_BFCK (1 << 0) /* A: Burst Flash Clock */
203#define AT91_PC1_BFRDY_SMOE (1 << 1) /* A: Burst Flash Ready / SmartMedia Output Enable */
204#define AT91_PC2_BFAVD (1 << 2) /* A: Burst Flash Address Valid */
205#define AT91_PC3_BFBAA_SMWE (1 << 3) /* A: Burst Flash Address Advance / SmartMedia Write Enable */
206#define AT91_PC4_BFOE (1 << 4) /* A: Burst Flash Output Enable */
207#define AT91_PC5_BFWE (1 << 5) /* A: Burst Flash Write Enable */
208#define AT91_PC6_NWAIT (1 << 6) /* A: SMC Wait Signal */
209#define AT91_PC7_A23 (1 << 7) /* A: Address Bus 23 */
210#define AT91_PC8_A24 (1 << 8) /* A: Address Bus 24 */
211#define AT91_PC9_A25_CFRNW (1 << 9) /* A: Address Bus 25 / Compact Flash Read Not Write */
212#define AT91_PC10_NCS4_CFCS (1 << 10) /* A: SMC Chip Select 4 / Compact Flash Chip Select */
213#define AT91_PC11_NCS5_CFCE1 (1 << 11) /* A: SMC Chip Select 5 / Compact Flash Chip Enable 1 */
214#define AT91_PC12_NCS6_CFCE2 (1 << 12) /* A: SMC Chip Select 6 / Compact Flash Chip Enable 2 */
215#define AT91_PC13_NCS7 (1 << 13) /* A: Chip Select 7 */
216
217#define AT91_PD0_ETX0 (1 << 0) /* A: Ethernet Transmit Data 0 */
218#define AT91_PD1_ETX1 (1 << 1) /* A: Ethernet Transmit Data 1 */
219#define AT91_PD2_ETX2 (1 << 2) /* A: Ethernet Transmit Data 2 */
220#define AT91_PD3_ETX3 (1 << 3) /* A: Ethernet Transmit Data 3 */
221#define AT91_PD4_ETXEN (1 << 4) /* A: Ethernet Transmit Enable */
222#define AT91_PD5_ETXER (1 << 5) /* A: Ethernet Transmit Coding Error */
223#define AT91_PD6_DTXD (1 << 6) /* A: DBGU Transmit Data */
224#define AT91_PD7_PCK0 (1 << 7) /* A: PMC Programmable Clock Output 0 */
225#define AT91_PD7_TSYNC (1 << 7) /* B: ETM Trace Synchronization Signal */
226#define AT91_PD8_PCK1 (1 << 8) /* A: PMC Programmable Clock Output 1 */
227#define AT91_PD8_TCLK (1 << 8) /* B: ETM Trace Clock */
228#define AT91_PD9_PCK2 (1 << 9) /* A: PMC Programmable Clock Output 2 */
229#define AT91_PD9_TPS0 (1 << 9) /* B: ETM Trace ARM Pipeline Status 0 */
230#define AT91_PD10_PCK3 (1 << 10) /* A: PMC Programmable Clock Output 3 */
231#define AT91_PD10_TPS1 (1 << 10) /* B: ETM Trace ARM Pipeline Status 1 */
232#define AT91_PD11_TPS2 (1 << 11) /* B: ETM Trace ARM Pipeline Status 2 */
233#define AT91_PD12_TPK0 (1 << 12) /* B: ETM Trace Packet Port 0 */
234#define AT91_PD13_TPK1 (1 << 13) /* B: ETM Trace Packet Port 1 */
235#define AT91_PD14_TPK2 (1 << 14) /* B: ETM Trace Packet Port 2 */
236#define AT91_PD15_TD0 (1 << 15) /* A: SSC Transmit Data 0 */
237#define AT91_PD15_TPK3 (1 << 15) /* B: ETM Trace Packet Port 3 */
238#define AT91_PD16_TD1 (1 << 16) /* A: SSC Transmit Data 1 */
239#define AT91_PD16_TPK4 (1 << 16) /* B: ETM Trace Packet Port 4 */
240#define AT91_PD17_TD2 (1 << 17) /* A: SSC Transmit Data 2 */
241#define AT91_PD17_TPK5 (1 << 17) /* B: ETM Trace Packet Port 5 */
242#define AT91_PD18_NPCS1 (1 << 18) /* A: SPI Peripheral Chip Select 1 */
243#define AT91_PD18_TPK6 (1 << 18) /* B: ETM Trace Packet Port 6 */
244#define AT91_PD19_NPCS2 (1 << 19) /* A: SPI Peripheral Chip Select 2 */
245#define AT91_PD19_TPK7 (1 << 19) /* B: ETM Trace Packet Port 7 */
246#define AT91_PD20_NPCS3 (1 << 20) /* A: SPI Peripheral Chip Select 3 */
247#define AT91_PD20_TPK8 (1 << 20) /* B: ETM Trace Packet Port 8 */
248#define AT91_PD21_RTS0 (1 << 21) /* A: USART Ready To Send 0 */
249#define AT91_PD21_TPK9 (1 << 21) /* B: ETM Trace Packet Port 9 */
250#define AT91_PD22_RTS1 (1 << 22) /* A: USART Ready To Send 1 */
251#define AT91_PD22_TPK10 (1 << 22) /* B: ETM Trace Packet Port 10 */
252#define AT91_PD23_RTS2 (1 << 23) /* A: USART Ready To Send 2 */
253#define AT91_PD23_TPK11 (1 << 23) /* B: ETM Trace Packet Port 11 */
254#define AT91_PD24_RTS3 (1 << 24) /* A: USART Ready To Send 3 */
255#define AT91_PD24_TPK12 (1 << 24) /* B: ETM Trace Packet Port 12 */
256#define AT91_PD25_DTR1 (1 << 25) /* A: USART Data Terminal Ready 1 */
257#define AT91_PD25_TPK13 (1 << 25) /* B: ETM Trace Packet Port 13 */
258#define AT91_PD26_TPK14 (1 << 26) /* B: ETM Trace Packet Port 14 */
259#define AT91_PD27_TPK15 (1 << 27) /* B: ETM Trace Packet Port 15 */
260
261#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h b/include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h
new file mode 100644
index 000000000000..ce1150d4438d
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h
@@ -0,0 +1,36 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Peripheral Data Controller (PDC) registers.
8 * Based on AT91RM9200 datasheet revision E.
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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_PDC_H
17#define AT91RM9200_PDC_H
18
19#define AT91_PDC_RPR 0x100 /* Receive Pointer Register */
20#define AT91_PDC_RCR 0x104 /* Receive Counter Register */
21#define AT91_PDC_TPR 0x108 /* Transmit Pointer Register */
22#define AT91_PDC_TCR 0x10c /* Transmit Counter Register */
23#define AT91_PDC_RNPR 0x110 /* Receive Next Pointer Register */
24#define AT91_PDC_RNCR 0x114 /* Receive Next Counter Register */
25#define AT91_PDC_TNPR 0x118 /* Transmit Next Pointer Register */
26#define AT91_PDC_TNCR 0x11c /* Transmit Next Counter Register */
27
28#define AT91_PDC_PTCR 0x120 /* Transfer Control Register */
29#define AT91_PDC_RXTEN (1 << 0) /* Receiver Transfer Enable */
30#define AT91_PDC_RXTDIS (1 << 1) /* Receiver Transfer Disable */
31#define AT91_PDC_TXTEN (1 << 8) /* Transmitter Transfer Enable */
32#define AT91_PDC_TXTDIS (1 << 9) /* Transmitter Transfer Disable */
33
34#define AT91_PDC_PTSR 0x124 /* Transfer Status Register */
35
36#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h b/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
new file mode 100644
index 000000000000..9bfffdbf1e0b
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
@@ -0,0 +1,328 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_SYS_H
17#define AT91RM9200_SYS_H
18
19/*
20 * Advanced Interrupt Controller.
21 */
22#define AT91_AIC 0x000
23
24#define AT91_AIC_SMR(n) (AT91_AIC + ((n) * 4)) /* Source Mode Registers 0-31 */
25#define AT91_AIC_PRIOR (7 << 0) /* Priority Level */
26#define AT91_AIC_SRCTYPE (3 << 5) /* Interrupt Source Type */
27#define AT91_AIC_SRCTYPE_LOW (0 << 5)
28#define AT91_AIC_SRCTYPE_FALLING (1 << 5)
29#define AT91_AIC_SRCTYPE_HIGH (2 << 5)
30#define AT91_AIC_SRCTYPE_RISING (3 << 5)
31
32#define AT91_AIC_SVR(n) (AT91_AIC + 0x80 + ((n) * 4)) /* Source Vector Registers 0-31 */
33#define AT91_AIC_IVR (AT91_AIC + 0x100) /* Interrupt Vector Register */
34#define AT91_AIC_FVR (AT91_AIC + 0x104) /* Fast Interrupt Vector Register */
35#define AT91_AIC_ISR (AT91_AIC + 0x108) /* Interrupt Status Register */
36#define AT91_AIC_IRQID (0x1f << 0) /* Current Interrupt Identifier */
37
38#define AT91_AIC_IPR (AT91_AIC + 0x10c) /* Interrupt Pending Register */
39#define AT91_AIC_IMR (AT91_AIC + 0x110) /* Interrupt Mask Register */
40#define AT91_AIC_CISR (AT91_AIC + 0x114) /* Core Interrupt Status Register */
41#define AT91_AIC_NFIQ (1 << 0) /* nFIQ Status */
42#define AT91_AIC_NIRQ (1 << 1) /* nIRQ Status */
43
44#define AT91_AIC_IECR (AT91_AIC + 0x120) /* Interrupt Enable Command Register */
45#define AT91_AIC_IDCR (AT91_AIC + 0x124) /* Interrupt Disable Command Register */
46#define AT91_AIC_ICCR (AT91_AIC + 0x128) /* Interrupt Clear Command Register */
47#define AT91_AIC_ISCR (AT91_AIC + 0x12c) /* Interrupt Set Command Register */
48#define AT91_AIC_EOICR (AT91_AIC + 0x130) /* End of Interrupt Command Register */
49#define AT91_AIC_SPU (AT91_AIC + 0x134) /* Spurious Interrupt Vector Register */
50#define AT91_AIC_DCR (AT91_AIC + 0x138) /* Debug Control Register */
51#define AT91_AIC_DCR_PROT (1 << 0) /* Protection Mode */
52#define AT91_AIC_DCR_GMSK (1 << 1) /* General Mask */
53
54
55/*
56 * Debug Unit.
57 */
58#define AT91_DBGU 0x200
59
60#define AT91_DBGU_CR (AT91_DBGU + 0x00) /* Control Register */
61#define AT91_DBGU_MR (AT91_DBGU + 0x04) /* Mode Register */
62#define AT91_DBGU_IER (AT91_DBGU + 0x08) /* Interrupt Enable Register */
63#define AT91_DBGU_TXRDY (1 << 1) /* Transmitter Ready */
64#define AT91_DBGU_TXEMPTY (1 << 9) /* Transmitter Empty */
65#define AT91_DBGU_IDR (AT91_DBGU + 0x0c) /* Interrupt Disable Register */
66#define AT91_DBGU_IMR (AT91_DBGU + 0x10) /* Interrupt Mask Register */
67#define AT91_DBGU_SR (AT91_DBGU + 0x14) /* Status Register */
68#define AT91_DBGU_RHR (AT91_DBGU + 0x18) /* Receiver Holding Register */
69#define AT91_DBGU_THR (AT91_DBGU + 0x1c) /* Transmitter Holding Register */
70#define AT91_DBGU_BRGR (AT91_DBGU + 0x20) /* Baud Rate Generator Register */
71#define AT91_DBGU_CIDR (AT91_DBGU + 0x40) /* Chip ID Register */
72#define AT91_DBGU_EXID (AT91_DBGU + 0x44) /* Chip ID Extension Register */
73
74
75/*
76 * PIO Controllers.
77 */
78#define AT91_PIOA 0x400
79#define AT91_PIOB 0x600
80#define AT91_PIOC 0x800
81#define AT91_PIOD 0xa00
82
83#define PIO_PER 0x00 /* Enable Register */
84#define PIO_PDR 0x04 /* Disable Register */
85#define PIO_PSR 0x08 /* Status Register */
86#define PIO_OER 0x10 /* Output Enable Register */
87#define PIO_ODR 0x14 /* Output Disable Register */
88#define PIO_OSR 0x18 /* Output Status Register */
89#define PIO_IFER 0x20 /* Glitch Input Filter Enable */
90#define PIO_IFDR 0x24 /* Glitch Input Filter Disable */
91#define PIO_IFSR 0x28 /* Glitch Input Filter Status */
92#define PIO_SODR 0x30 /* Set Output Data Register */
93#define PIO_CODR 0x34 /* Clear Output Data Register */
94#define PIO_ODSR 0x38 /* Output Data Status Register */
95#define PIO_PDSR 0x3c /* Pin Data Status Register */
96#define PIO_IER 0x40 /* Interrupt Enable Register */
97#define PIO_IDR 0x44 /* Interrupt Disable Register */
98#define PIO_IMR 0x48 /* Interrupt Mask Register */
99#define PIO_ISR 0x4c /* Interrupt Status Register */
100#define PIO_MDER 0x50 /* Multi-driver Enable Register */
101#define PIO_MDDR 0x54 /* Multi-driver Disable Register */
102#define PIO_MDSR 0x58 /* Multi-driver Status Register */
103#define PIO_PUDR 0x60 /* Pull-up Disable Register */
104#define PIO_PUER 0x64 /* Pull-up Enable Register */
105#define PIO_PUSR 0x68 /* Pull-up Status Register */
106#define PIO_ASR 0x70 /* Peripheral A Select Register */
107#define PIO_BSR 0x74 /* Peripheral B Select Register */
108#define PIO_ABSR 0x78 /* AB Status Register */
109#define PIO_OWER 0xa0 /* Output Write Enable Register */
110#define PIO_OWDR 0xa4 /* Output Write Disable Register */
111#define PIO_OWSR 0xa8 /* Output Write Status Register */
112
113#define AT91_PIO_P(n) (1 << (n))
114
115
116/*
117 * Power Management Controller.
118 */
119#define AT91_PMC 0xc00
120
121#define AT91_PMC_SCER (AT91_PMC + 0x00) /* System Clock Enable Register */
122#define AT91_PMC_SCDR (AT91_PMC + 0x04) /* System Clock Disable Register */
123
124#define AT91_PMC_SCSR (AT91_PMC + 0x08) /* System Clock Status Register */
125#define AT91_PMC_PCK (1 << 0) /* Processor Clock */
126#define AT91_PMC_UDP (1 << 1) /* USB Devcice Port Clock */
127#define AT91_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend */
128#define AT91_PMC_UHP (1 << 4) /* USB Host Port Clock */
129#define AT91_PMC_PCK0 (1 << 8) /* Programmable Clock 0 */
130#define AT91_PMC_PCK1 (1 << 9) /* Programmable Clock 1 */
131#define AT91_PMC_PCK2 (1 << 10) /* Programmable Clock 2 */
132#define AT91_PMC_PCK3 (1 << 11) /* Programmable Clock 3 */
133
134#define AT91_PMC_PCER (AT91_PMC + 0x10) /* Peripheral Clock Enable Register */
135#define AT91_PMC_PCDR (AT91_PMC + 0x14) /* Peripheral Clock Disable Register */
136#define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */
137
138#define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register */
139#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
140#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */
141
142#define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */
143#define AT91_PMC_MAINF (0xffff << 0) /* Main Clock Frequency */
144#define AT91_PMC_MAINRDY (1 << 16) /* Main Clock Ready */
145
146#define AT91_CKGR_PLLAR (AT91_PMC + 0x28) /* PLL A Register */
147#define AT91_CKGR_PLLBR (AT91_PMC + 0x2c) /* PLL B Register */
148#define AT91_PMC_DIV (0xff << 0) /* Divider */
149#define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */
150#define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */
151#define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */
152#define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */
153
154#define AT91_PMC_MCKR (AT91_PMC + 0x30) /* Master Clock Register */
155#define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */
156#define AT91_PMC_CSS_SLOW (0 << 0)
157#define AT91_PMC_CSS_MAIN (1 << 0)
158#define AT91_PMC_CSS_PLLA (2 << 0)
159#define AT91_PMC_CSS_PLLB (3 << 0)
160#define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */
161#define AT91_PMC_PRES_1 (0 << 2)
162#define AT91_PMC_PRES_2 (1 << 2)
163#define AT91_PMC_PRES_4 (2 << 2)
164#define AT91_PMC_PRES_8 (3 << 2)
165#define AT91_PMC_PRES_16 (4 << 2)
166#define AT91_PMC_PRES_32 (5 << 2)
167#define AT91_PMC_PRES_64 (6 << 2)
168#define AT91_PMC_MDIV (3 << 8) /* Master Clock Division */
169#define AT91_PMC_MDIV_1 (0 << 8)
170#define AT91_PMC_MDIV_2 (1 << 8)
171#define AT91_PMC_MDIV_3 (2 << 8)
172#define AT91_PMC_MDIV_4 (3 << 8)
173
174#define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-3 Registers */
175#define AT91_PMC_IER (AT91_PMC + 0x60) /* Interrupt Enable Register */
176#define AT91_PMC_IDR (AT91_PMC + 0x64) /* Interrupt Disable Register */
177#define AT91_PMC_SR (AT91_PMC + 0x68) /* Status Register */
178#define AT91_PMC_MOSCS (1 << 0) /* MOSCS Flag */
179#define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */
180#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
181#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
182#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
183#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
184#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
185#define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */
186#define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */
187
188
189/*
190 * System Timer.
191 */
192#define AT91_ST 0xd00
193
194#define AT91_ST_CR (AT91_ST + 0x00) /* Control Register */
195#define AT91_ST_WDRST (1 << 0) /* Watchdog Timer Restart */
196#define AT91_ST_PIMR (AT91_ST + 0x04) /* Period Interval Mode Register */
197#define AT91_ST_PIV (0xffff << 0) /* Period Interval Value */
198#define AT91_ST_WDMR (AT91_ST + 0x08) /* Watchdog Mode Register */
199#define AT91_ST_WDV (0xffff << 0) /* Watchdog Counter Value */
200#define AT91_ST_RSTEN (1 << 16) /* Reset Enable */
201#define AT91_ST_EXTEN (1 << 17) /* External Signal Assertion Enable */
202#define AT91_ST_RTMR (AT91_ST + 0x0c) /* Real-time Mode Register */
203#define AT91_ST_RTPRES (0xffff << 0) /* Real-time Prescalar Value */
204#define AT91_ST_SR (AT91_ST + 0x10) /* Status Register */
205#define AT91_ST_PITS (1 << 0) /* Period Interval Timer Status */
206#define AT91_ST_WDOVF (1 << 1) /* Watchdog Overflow */
207#define AT91_ST_RTTINC (1 << 2) /* Real-time Timer Increment */
208#define AT91_ST_ALMS (1 << 3) /* Alarm Status */
209#define AT91_ST_IER (AT91_ST + 0x14) /* Interrupt Enable Register */
210#define AT91_ST_IDR (AT91_ST + 0x18) /* Interrupt Disable Register */
211#define AT91_ST_IMR (AT91_ST + 0x1c) /* Interrupt Mask Register */
212#define AT91_ST_RTAR (AT91_ST + 0x20) /* Real-time Alarm Register */
213#define AT91_ST_ALMV (0xfffff << 0) /* Alarm Value */
214#define AT91_ST_CRTR (AT91_ST + 0x24) /* Current Real-time Register */
215#define AT91_ST_CRTV (0xfffff << 0) /* Current Real-Time Value */
216
217
218/*
219 * Real-time Clock.
220 */
221#define AT91_RTC 0xe00
222
223#define AT91_RTC_CR (AT91_RTC + 0x00) /* Control Register */
224#define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */
225#define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */
226#define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */
227#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8)
228#define AT91_RTC_TIMEVSEL_HOUR (1 << 8)
229#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8)
230#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8)
231#define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */
232#define AT91_RTC_CALEVSEL_WEEK (0 << 16)
233#define AT91_RTC_CALEVSEL_MONTH (1 << 16)
234#define AT91_RTC_CALEVSEL_YEAR (2 << 16)
235
236#define AT91_RTC_MR (AT91_RTC + 0x04) /* Mode Register */
237#define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */
238
239#define AT91_RTC_TIMR (AT91_RTC + 0x08) /* Time Register */
240#define AT91_RTC_SEC (0x7f << 0) /* Current Second */
241#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */
242#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */
243#define At91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */
244
245#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */
246#define AT91_RTC_CENT (0x7f << 0) /* Current Century */
247#define AT91_RTC_YEAR (0xff << 8) /* Current Year */
248#define AT91_RTC_MONTH (0x1f << 16) /* Current Month */
249#define AT91_RTC_DAY (7 << 21) /* Current Day */
250#define AT91_RTC_DATE (0x3f << 24) /* Current Date */
251
252#define AT91_RTC_TIMALR (AT91_RTC + 0x10) /* Time Alarm Register */
253#define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */
254#define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */
255#define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */
256
257#define AT91_RTC_CALALR (AT91_RTC + 0x14) /* Calendar Alarm Register */
258#define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */
259#define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */
260
261#define AT91_RTC_SR (AT91_RTC + 0x18) /* Status Register */
262#define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */
263#define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */
264#define AT91_RTC_SECEV (1 << 2) /* Second Event */
265#define AT91_RTC_TIMEV (1 << 3) /* Time Event */
266#define AT91_RTC_CALEV (1 << 4) /* Calendar Event */
267
268#define AT91_RTC_SCCR (AT91_RTC + 0x1c) /* Status Clear Command Register */
269#define AT91_RTC_IER (AT91_RTC + 0x20) /* Interrupt Enable Register */
270#define AT91_RTC_IDR (AT91_RTC + 0x24) /* Interrupt Disable Register */
271#define AT91_RTC_IMR (AT91_RTC + 0x28) /* Interrupt Mask Register */
272
273#define AT91_RTC_VER (AT91_RTC + 0x2c) /* Valid Entry Register */
274#define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
275#define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */
276#define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */
277#define AT91_RTC_NVCALALR (1 << 3) /* Non valid Calendar Alarm */
278
279
280/*
281 * Memory Controller.
282 */
283#define AT91_MC 0xf00
284
285#define AT91_MC_RCR (AT91_MC + 0x00) /* MC Remap Control Register */
286#define AT91_MC_RCB (1 << 0) /* Remap Command Bit */
287
288#define AT91_MC_ASR (AT91_MC + 0x04) /* MC Abort Status Register */
289#define AT91_MC_AASR (AT91_MC + 0x08) /* MC Abort Address Status Register */
290#define AT91_MC_MPR (AT91_MC + 0x0c) /* MC Master Priority Register */
291
292/* External Bus Interface (EBI) registers */
293#define AT91_EBI_CSA (AT91_MC + 0x60) /* Chip Select Assignment Register */
294#define AT91_EBI_CS0A (1 << 0) /* Chip Select 0 Assignment */
295#define AT91_EBI_CS0A_SMC (0 << 0)
296#define AT91_EBI_CS0A_BFC (1 << 0)
297#define AT91_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
298#define AT91_EBI_CS1A_SMC (0 << 1)
299#define AT91_EBI_CS1A_SDRAMC (1 << 1)
300#define AT91_EBI_CS3A (1 << 3) /* Chip Select 2 Assignment */
301#define AT91_EBI_CS3A_SMC (0 << 3)
302#define AT91_EBI_CS3A_SMC_SMARTMEDIA (1 << 3)
303#define AT91_EBI_CS4A (1 << 4) /* Chip Select 3 Assignment */
304#define AT91_EBI_CS4A_SMC (0 << 4)
305#define AT91_EBI_CS4A_SMC_COMPACTFLASH (1 << 4)
306#define AT91_EBI_CFGR (AT91_MC + 0x64) /* Configuration Register */
307#define AT91_EBI_DBPUC (1 << 0) /* Data Bus Pull-Up Configuration */
308
309/* Static Memory Controller (SMC) registers */
310#define AT91_SMC_CSR(n) (AT91_MC + 0x70 + ((n) * 4))/* SMC Chip Select Register */
311#define AT91_SMC_NWS (0x7f << 0) /* Number of Wait States */
312#define AT91_SMC_WSEN (1 << 7) /* Wait State Enable */
313#define AT91_SMC_TDF (0xf << 8) /* Data Float Time */
314#define AT91_SMC_BAT (1 << 12) /* Byte Access Type */
315#define AT91_SMC_DBW (3 << 13) /* Data Bus Width */
316#define AT91_SMC_DBW_16 (1 << 13)
317#define AT91_SMC_DBW_8 (2 << 13)
318#define AT91_SMC_DPR (1 << 15) /* Data Read Protocol */
319#define AT91_SMC_ACSS (3 << 16) /* Address to Chip Select Setup */
320#define AT91_SMC_ACSS_STD (0 << 16)
321#define AT91_SMC_ACSS_1 (1 << 16)
322#define AT91_SMC_ACSS_2 (2 << 16)
323#define AT91_SMC_ACSS_3 (3 << 16)
324#define AT91_SMC_RWSETUP (7 << 24) /* Read & Write Signal Time Setup */
325#define AT91_SMC_RWHOLD (7 << 28) /* Read & Write Signal Hold Time */
326
327
328#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_usart.h b/include/asm-arm/arch-at91rm9200/at91rm9200_usart.h
new file mode 100644
index 000000000000..79f851e31b9c
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_usart.h
@@ -0,0 +1,123 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_usart.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * USART registers.
8 * Based on AT91RM9200 datasheet revision E.
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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_USART_H
17#define AT91RM9200_USART_H
18
19#define AT91_US_CR 0x00 /* Control Register */
20#define AT91_US_RSTRX (1 << 2) /* Reset Receiver */
21#define AT91_US_RSTTX (1 << 3) /* Reset Transmitter */
22#define AT91_US_RXEN (1 << 4) /* Receiver Enable */
23#define AT91_US_RXDIS (1 << 5) /* Receiver Disable */
24#define AT91_US_TXEN (1 << 6) /* Transmitter Enable */
25#define AT91_US_TXDIS (1 << 7) /* Transmitter Disable */
26#define AT91_US_RSTSTA (1 << 8) /* Reset Status Bits */
27#define AT91_US_STTBRK (1 << 9) /* Start Break */
28#define AT91_US_STPBRK (1 << 10) /* Stop Break */
29#define AT91_US_STTTO (1 << 11) /* Start Time-out */
30#define AT91_US_SENDA (1 << 12) /* Send Address */
31#define AT91_US_RSTIT (1 << 13) /* Reset Iterations */
32#define AT91_US_RSTNACK (1 << 14) /* Reset Non Acknowledge */
33#define AT91_US_RETTO (1 << 15) /* Rearm Time-out */
34#define AT91_US_DTREN (1 << 16) /* Data Terminal Ready Enable */
35#define AT91_US_DTRDIS (1 << 17) /* Data Terminal Ready Disable */
36#define AT91_US_RTSEN (1 << 18) /* Request To Send Enable */
37#define AT91_US_RTSDIS (1 << 19) /* Request To Send Disable */
38
39#define AT91_US_MR 0x04 /* Mode Register */
40#define AT91_US_USMODE (0xf << 0) /* Mode of the USART */
41#define AT91_US_USMODE_NORMAL 0
42#define AT91_US_USMODE_RS485 1
43#define AT91_US_USMODE_HWHS 2
44#define AT91_US_USMODE_MODEM 3
45#define AT91_US_USMODE_ISO7816_T0 4
46#define AT91_US_USMODE_ISO7816_T1 6
47#define AT91_US_USMODE_IRDA 8
48#define AT91_US_USCLKS (3 << 4) /* Clock Selection */
49#define AT91_US_CHRL (3 << 6) /* Character Length */
50#define AT91_US_CHRL_5 (0 << 6)
51#define AT91_US_CHRL_6 (1 << 6)
52#define AT91_US_CHRL_7 (2 << 6)
53#define AT91_US_CHRL_8 (3 << 6)
54#define AT91_US_SYNC (1 << 8) /* Synchronous Mode Select */
55#define AT91_US_PAR (7 << 9) /* Parity Type */
56#define AT91_US_PAR_EVEN (0 << 9)
57#define AT91_US_PAR_ODD (1 << 9)
58#define AT91_US_PAR_SPACE (2 << 9)
59#define AT91_US_PAR_MARK (3 << 9)
60#define AT91_US_PAR_NONE (4 << 9)
61#define AT91_US_PAR_MULTI_DROP (6 << 9)
62#define AT91_US_NBSTOP (3 << 12) /* Number of Stop Bits */
63#define AT91_US_NBSTOP_1 (0 << 12)
64#define AT91_US_NBSTOP_1_5 (1 << 12)
65#define AT91_US_NBSTOP_2 (2 << 12)
66#define AT91_US_CHMODE (3 << 14) /* Channel Mode */
67#define AT91_US_CHMODE_NORMAL (0 << 14)
68#define AT91_US_CHMODE_ECHO (1 << 14)
69#define AT91_US_CHMODE_LOC_LOOP (2 << 14)
70#define AT91_US_CHMODE_REM_LOOP (3 << 14)
71#define AT91_US_MSBF (1 << 16) /* Bit Order */
72#define AT91_US_MODE9 (1 << 17) /* 9-bit Character Length */
73#define AT91_US_CLKO (1 << 18) /* Clock Output Select */
74#define AT91_US_OVER (1 << 19) /* Oversampling Mode */
75#define AT91_US_INACK (1 << 20) /* Inhibit Non Acknowledge */
76#define AT91_US_DSNACK (1 << 21) /* Disable Successive NACK */
77#define AT91_US_MAX_ITER (7 << 24) /* Max Iterations */
78#define AT91_US_FILTER (1 << 28) /* Infrared Receive Line Filter */
79
80#define AT91_US_IER 0x08 /* Interrupt Enable Register */
81#define AT91_US_RXRDY (1 << 0) /* Receiver Ready */
82#define AT91_US_TXRDY (1 << 1) /* Transmitter Ready */
83#define AT91_US_RXBRK (1 << 2) /* Break Received / End of Break */
84#define AT91_US_ENDRX (1 << 3) /* End of Receiver Transfer */
85#define AT91_US_ENDTX (1 << 4) /* End of Transmitter Transfer */
86#define AT91_US_OVRE (1 << 5) /* Overrun Error */
87#define AT91_US_FRAME (1 << 6) /* Framing Error */
88#define AT91_US_PARE (1 << 7) /* Parity Error */
89#define AT91_US_TIMEOUT (1 << 8) /* Receiver Time-out */
90#define AT91_US_TXEMPTY (1 << 9) /* Transmitter Empty */
91#define AT91_US_ITERATION (1 << 10) /* Max number of Repetitions Reached */
92#define AT91_US_TXBUFE (1 << 11) /* Transmission Buffer Empty */
93#define AT91_US_RXBUFF (1 << 12) /* Reception Buffer Full */
94#define AT91_US_NACK (1 << 13) /* Non Acknowledge */
95#define AT91_US_RIIC (1 << 16) /* Ring Indicator Input Change */
96#define AT91_US_DSRIC (1 << 17) /* Data Set Ready Input Change */
97#define AT91_US_DCDIC (1 << 18) /* Data Carrier Detect Input Change */
98#define AT91_US_CTSIC (1 << 19) /* Clear to Send Input Change */
99#define AT91_US_RI (1 << 20) /* RI */
100#define AT91_US_DSR (1 << 21) /* DSR */
101#define AT91_US_DCD (1 << 22) /* DCD */
102#define AT91_US_CTS (1 << 23) /* CTS */
103
104#define AT91_US_IDR 0x0c /* Interrupt Disable Register */
105#define AT91_US_IMR 0x10 /* Interrupt Mask Register */
106#define AT91_US_CSR 0x14 /* Channel Status Register */
107#define AT91_US_RHR 0x18 /* Receiver Holding Register */
108#define AT91_US_THR 0x1c /* Transmitter Holding Register */
109
110#define AT91_US_BRGR 0x20 /* Baud Rate Generator Register */
111#define AT91_US_CD (0xffff << 0) /* Clock Divider */
112
113#define AT91_US_RTOR 0x24 /* Receiver Time-out Register */
114#define AT91_US_TO (0xffff << 0) /* Time-out Value */
115
116#define AT91_US_TTGR 0x28 /* Transmitter Timeguard Register */
117#define AT91_US_TG (0xff << 0) /* Timeguard Value */
118
119#define AT91_US_FIDI 0x40 /* FI DI Ratio Register */
120#define AT91_US_NER 0x44 /* Number of Errors Register */
121#define AT91_US_IF 0x4c /* IrDA Filter Register */
122
123#endif
diff --git a/include/asm-arm/arch-at91rm9200/board.h b/include/asm-arm/arch-at91rm9200/board.h
new file mode 100644
index 000000000000..2e7d1139a799
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/board.h
@@ -0,0 +1,80 @@
1/*
2 * include/asm-arm/arch-at91rm9200/board.h
3 *
4 * Copyright (C) 2005 HP Labs
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/*
22 * These are data structures found in platform_device.dev.platform_data,
23 * and describing board-specfic data needed by drivers. For example,
24 * which pin is used for a given GPIO role.
25 *
26 * In 2.6, drivers should strongly avoid board-specific knowledge so
27 * that supporting new boards normally won't require driver patches.
28 * Most board-specific knowledge should be in arch/.../board-*.c files.
29 */
30
31#ifndef __ASM_ARCH_BOARD_H
32#define __ASM_ARCH_BOARD_H
33
34 /* Clocks */
35extern unsigned long at91_master_clock;
36
37 /* Serial Port */
38extern int at91_serial_map[AT91_NR_UART];
39extern int at91_console_port;
40
41 /* USB Device */
42struct at91_udc_data {
43 u8 vbus_pin; /* high == host powering us */
44 u8 pullup_pin; /* high == D+ pulled up */
45};
46extern void __init at91_add_device_udc(struct at91_udc_data *data);
47
48 /* Compact Flash */
49struct at91_cf_data {
50 u8 irq_pin; /* I/O IRQ */
51 u8 det_pin; /* Card detect */
52 u8 vcc_pin; /* power switching */
53 u8 rst_pin; /* card reset */
54};
55extern void __init at91_add_device_cf(struct at91_cf_data *data);
56
57 /* MMC / SD */
58struct at91_mmc_data {
59 u8 det_pin; /* card detect IRQ */
60 unsigned is_b:1; /* uses B side (vs A) */
61 unsigned wire4:1; /* (SD) supports DAT0..DAT3 */
62 u8 wp_pin; /* (SD) writeprotect detect */
63 u8 vcc_pin; /* power switching (high == on) */
64};
65extern void __init at91_add_device_mmc(struct at91_mmc_data *data);
66
67 /* Ethernet */
68struct at91_eth_data {
69 u8 phy_irq_pin; /* PHY IRQ */
70 u8 is_rmii; /* using RMII interface? */
71};
72extern void __init at91_add_device_eth(struct at91_eth_data *data);
73
74 /* USB Host */
75struct at91_usbh_data {
76 u8 ports; /* number of ports on root hub */
77};
78extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
79
80#endif
diff --git a/include/asm-arm/arch-at91rm9200/debug-macro.S b/include/asm-arm/arch-at91rm9200/debug-macro.S
new file mode 100644
index 000000000000..f496b54c4c3e
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/debug-macro.S
@@ -0,0 +1,38 @@
1/*
2 * include/asm-arm/arch-at91rm9200/debug-macro.S
3 *
4 * Copyright (C) 2003-2005 SAN People
5 *
6 * Debugging macro include header
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#include <asm/hardware.h>
15
16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0
18 tst \rx, #1 @ MMU enabled?
19 ldreq \rx, =AT91_BASE_SYS @ System peripherals (phys address)
20 ldrne \rx, =AT91_VA_BASE_SYS @ System peripherals (virt address)
21 .endm
22
23 .macro senduart,rd,rx
24 strb \rd, [\rx, #AT91_DBGU_THR] @ Write to Transmitter Holding Register
25 .endm
26
27 .macro waituart,rd,rx
281001: ldr \rd, [\rx, #AT91_DBGU_SR] @ Read Status Register
29 tst \rd, #AT91_DBGU_TXRDY @ DBGU_TXRDY = 1 when ready to transmit
30 beq 1001b
31 .endm
32
33 .macro busyuart,rd,rx
341001: ldr \rd, [\rx, #AT91_DBGU_SR] @ Read Status Register
35 tst \rd, #AT91_DBGU_TXEMPTY @ DBGU_TXEMPTY = 1 when transmission complete
36 beq 1001b
37 .endm
38
diff --git a/include/asm-arm/arch-epxa10db/param.h b/include/asm-arm/arch-at91rm9200/dma.h
index 783dedd71c8f..22c1dfdd8da3 100644
--- a/include/asm-arm/arch-epxa10db/param.h
+++ b/include/asm-arm/arch-at91rm9200/dma.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/include/asm-arm/arch-epxa10db/param.h 2 * include/asm-arm/arch-at91rm9200/dma.h
3 * 3 *
4 * Copyright (C) 1999 ARM Limited 4 * Copyright (C) 2003 SAN People
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-arm/arch-at91rm9200/entry-macro.S b/include/asm-arm/arch-at91rm9200/entry-macro.S
new file mode 100644
index 000000000000..61a326e94909
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/entry-macro.S
@@ -0,0 +1,25 @@
1/*
2 * include/asm-arm/arch-at91rm9200/entry-macro.S
3 *
4 * Copyright (C) 2003-2005 SAN People
5 *
6 * Low-level IRQ helper macros for AT91RM9200 platforms
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <asm/hardware.h>
14
15 .macro disable_fiq
16 .endm
17
18 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
19 ldr \base, =(AT91_VA_BASE_SYS) @ base virtual address of SYS peripherals
20 ldr \irqnr, [\base, #AT91_AIC_IVR] @ read IRQ vector register: de-asserts nIRQ to processor (and clears interrupt)
21 ldr \irqstat, [\base, #AT91_AIC_ISR] @ read interrupt source number
22 teq \irqstat, #0 @ ISR is 0 when no current interrupt, or spurious interrupt
23 streq \tmp, [\base, #AT91_AIC_EOICR] @ not going to be handled further, then ACK it now.
24 .endm
25
diff --git a/include/asm-arm/arch-at91rm9200/gpio.h b/include/asm-arm/arch-at91rm9200/gpio.h
new file mode 100644
index 000000000000..0f0a61e2f129
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/gpio.h
@@ -0,0 +1,193 @@
1/*
2 * include/asm-arm/arch-at91rm9200/gpio.h
3 *
4 * Copyright (C) 2005 HP Labs
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 */
12
13#ifndef __ASM_ARCH_AT91RM9200_GPIO_H
14#define __ASM_ARCH_AT91RM9200_GPIO_H
15
16#define PIN_BASE NR_AIC_IRQS
17
18#define PQFP_GPIO_BANKS 3 /* PQFP package has 3 banks */
19#define BGA_GPIO_BANKS 4 /* BGA package has 4 banks */
20
21/* these pin numbers double as IRQ numbers, like AT91_ID_* values */
22
23#define AT91_PIN_PA0 (PIN_BASE + 0x00 + 0)
24#define AT91_PIN_PA1 (PIN_BASE + 0x00 + 1)
25#define AT91_PIN_PA2 (PIN_BASE + 0x00 + 2)
26#define AT91_PIN_PA3 (PIN_BASE + 0x00 + 3)
27#define AT91_PIN_PA4 (PIN_BASE + 0x00 + 4)
28
29#define AT91_PIN_PA5 (PIN_BASE + 0x00 + 5)
30#define AT91_PIN_PA6 (PIN_BASE + 0x00 + 6)
31#define AT91_PIN_PA7 (PIN_BASE + 0x00 + 7)
32#define AT91_PIN_PA8 (PIN_BASE + 0x00 + 8)
33#define AT91_PIN_PA9 (PIN_BASE + 0x00 + 9)
34
35#define AT91_PIN_PA10 (PIN_BASE + 0x00 + 10)
36#define AT91_PIN_PA11 (PIN_BASE + 0x00 + 11)
37#define AT91_PIN_PA12 (PIN_BASE + 0x00 + 12)
38#define AT91_PIN_PA13 (PIN_BASE + 0x00 + 13)
39#define AT91_PIN_PA14 (PIN_BASE + 0x00 + 14)
40
41#define AT91_PIN_PA15 (PIN_BASE + 0x00 + 15)
42#define AT91_PIN_PA16 (PIN_BASE + 0x00 + 16)
43#define AT91_PIN_PA17 (PIN_BASE + 0x00 + 17)
44#define AT91_PIN_PA18 (PIN_BASE + 0x00 + 18)
45#define AT91_PIN_PA19 (PIN_BASE + 0x00 + 19)
46
47#define AT91_PIN_PA20 (PIN_BASE + 0x00 + 20)
48#define AT91_PIN_PA21 (PIN_BASE + 0x00 + 21)
49#define AT91_PIN_PA22 (PIN_BASE + 0x00 + 22)
50#define AT91_PIN_PA23 (PIN_BASE + 0x00 + 23)
51#define AT91_PIN_PA24 (PIN_BASE + 0x00 + 24)
52
53#define AT91_PIN_PA25 (PIN_BASE + 0x00 + 25)
54#define AT91_PIN_PA26 (PIN_BASE + 0x00 + 26)
55#define AT91_PIN_PA27 (PIN_BASE + 0x00 + 27)
56#define AT91_PIN_PA28 (PIN_BASE + 0x00 + 28)
57#define AT91_PIN_PA29 (PIN_BASE + 0x00 + 29)
58
59#define AT91_PIN_PA30 (PIN_BASE + 0x00 + 30)
60#define AT91_PIN_PA31 (PIN_BASE + 0x00 + 31)
61
62#define AT91_PIN_PB0 (PIN_BASE + 0x20 + 0)
63#define AT91_PIN_PB1 (PIN_BASE + 0x20 + 1)
64#define AT91_PIN_PB2 (PIN_BASE + 0x20 + 2)
65#define AT91_PIN_PB3 (PIN_BASE + 0x20 + 3)
66#define AT91_PIN_PB4 (PIN_BASE + 0x20 + 4)
67
68#define AT91_PIN_PB5 (PIN_BASE + 0x20 + 5)
69#define AT91_PIN_PB6 (PIN_BASE + 0x20 + 6)
70#define AT91_PIN_PB7 (PIN_BASE + 0x20 + 7)
71#define AT91_PIN_PB8 (PIN_BASE + 0x20 + 8)
72#define AT91_PIN_PB9 (PIN_BASE + 0x20 + 9)
73
74#define AT91_PIN_PB10 (PIN_BASE + 0x20 + 10)
75#define AT91_PIN_PB11 (PIN_BASE + 0x20 + 11)
76#define AT91_PIN_PB12 (PIN_BASE + 0x20 + 12)
77#define AT91_PIN_PB13 (PIN_BASE + 0x20 + 13)
78#define AT91_PIN_PB14 (PIN_BASE + 0x20 + 14)
79
80#define AT91_PIN_PB15 (PIN_BASE + 0x20 + 15)
81#define AT91_PIN_PB16 (PIN_BASE + 0x20 + 16)
82#define AT91_PIN_PB17 (PIN_BASE + 0x20 + 17)
83#define AT91_PIN_PB18 (PIN_BASE + 0x20 + 18)
84#define AT91_PIN_PB19 (PIN_BASE + 0x20 + 19)
85
86#define AT91_PIN_PB20 (PIN_BASE + 0x20 + 20)
87#define AT91_PIN_PB21 (PIN_BASE + 0x20 + 21)
88#define AT91_PIN_PB22 (PIN_BASE + 0x20 + 22)
89#define AT91_PIN_PB23 (PIN_BASE + 0x20 + 23)
90#define AT91_PIN_PB24 (PIN_BASE + 0x20 + 24)
91
92#define AT91_PIN_PB25 (PIN_BASE + 0x20 + 25)
93#define AT91_PIN_PB26 (PIN_BASE + 0x20 + 26)
94#define AT91_PIN_PB27 (PIN_BASE + 0x20 + 27)
95#define AT91_PIN_PB28 (PIN_BASE + 0x20 + 28)
96#define AT91_PIN_PB29 (PIN_BASE + 0x20 + 29)
97
98#define AT91_PIN_PB30 (PIN_BASE + 0x20 + 30)
99#define AT91_PIN_PB31 (PIN_BASE + 0x20 + 31)
100
101#define AT91_PIN_PC0 (PIN_BASE + 0x40 + 0)
102#define AT91_PIN_PC1 (PIN_BASE + 0x40 + 1)
103#define AT91_PIN_PC2 (PIN_BASE + 0x40 + 2)
104#define AT91_PIN_PC3 (PIN_BASE + 0x40 + 3)
105#define AT91_PIN_PC4 (PIN_BASE + 0x40 + 4)
106
107#define AT91_PIN_PC5 (PIN_BASE + 0x40 + 5)
108#define AT91_PIN_PC6 (PIN_BASE + 0x40 + 6)
109#define AT91_PIN_PC7 (PIN_BASE + 0x40 + 7)
110#define AT91_PIN_PC8 (PIN_BASE + 0x40 + 8)
111#define AT91_PIN_PC9 (PIN_BASE + 0x40 + 9)
112
113#define AT91_PIN_PC10 (PIN_BASE + 0x40 + 10)
114#define AT91_PIN_PC11 (PIN_BASE + 0x40 + 11)
115#define AT91_PIN_PC12 (PIN_BASE + 0x40 + 12)
116#define AT91_PIN_PC13 (PIN_BASE + 0x40 + 13)
117#define AT91_PIN_PC14 (PIN_BASE + 0x40 + 14)
118
119#define AT91_PIN_PC15 (PIN_BASE + 0x40 + 15)
120#define AT91_PIN_PC16 (PIN_BASE + 0x40 + 16)
121#define AT91_PIN_PC17 (PIN_BASE + 0x40 + 17)
122#define AT91_PIN_PC18 (PIN_BASE + 0x40 + 18)
123#define AT91_PIN_PC19 (PIN_BASE + 0x40 + 19)
124
125#define AT91_PIN_PC20 (PIN_BASE + 0x40 + 20)
126#define AT91_PIN_PC21 (PIN_BASE + 0x40 + 21)
127#define AT91_PIN_PC22 (PIN_BASE + 0x40 + 22)
128#define AT91_PIN_PC23 (PIN_BASE + 0x40 + 23)
129#define AT91_PIN_PC24 (PIN_BASE + 0x40 + 24)
130
131#define AT91_PIN_PC25 (PIN_BASE + 0x40 + 25)
132#define AT91_PIN_PC26 (PIN_BASE + 0x40 + 26)
133#define AT91_PIN_PC27 (PIN_BASE + 0x40 + 27)
134#define AT91_PIN_PC28 (PIN_BASE + 0x40 + 28)
135#define AT91_PIN_PC29 (PIN_BASE + 0x40 + 29)
136
137#define AT91_PIN_PC30 (PIN_BASE + 0x40 + 30)
138#define AT91_PIN_PC31 (PIN_BASE + 0x40 + 31)
139
140#define AT91_PIN_PD0 (PIN_BASE + 0x60 + 0)
141#define AT91_PIN_PD1 (PIN_BASE + 0x60 + 1)
142#define AT91_PIN_PD2 (PIN_BASE + 0x60 + 2)
143#define AT91_PIN_PD3 (PIN_BASE + 0x60 + 3)
144#define AT91_PIN_PD4 (PIN_BASE + 0x60 + 4)
145
146#define AT91_PIN_PD5 (PIN_BASE + 0x60 + 5)
147#define AT91_PIN_PD6 (PIN_BASE + 0x60 + 6)
148#define AT91_PIN_PD7 (PIN_BASE + 0x60 + 7)
149#define AT91_PIN_PD8 (PIN_BASE + 0x60 + 8)
150#define AT91_PIN_PD9 (PIN_BASE + 0x60 + 9)
151
152#define AT91_PIN_PD10 (PIN_BASE + 0x60 + 10)
153#define AT91_PIN_PD11 (PIN_BASE + 0x60 + 11)
154#define AT91_PIN_PD12 (PIN_BASE + 0x60 + 12)
155#define AT91_PIN_PD13 (PIN_BASE + 0x60 + 13)
156#define AT91_PIN_PD14 (PIN_BASE + 0x60 + 14)
157
158#define AT91_PIN_PD15 (PIN_BASE + 0x60 + 15)
159#define AT91_PIN_PD16 (PIN_BASE + 0x60 + 16)
160#define AT91_PIN_PD17 (PIN_BASE + 0x60 + 17)
161#define AT91_PIN_PD18 (PIN_BASE + 0x60 + 18)
162#define AT91_PIN_PD19 (PIN_BASE + 0x60 + 19)
163
164#define AT91_PIN_PD20 (PIN_BASE + 0x60 + 20)
165#define AT91_PIN_PD21 (PIN_BASE + 0x60 + 21)
166#define AT91_PIN_PD22 (PIN_BASE + 0x60 + 22)
167#define AT91_PIN_PD23 (PIN_BASE + 0x60 + 23)
168#define AT91_PIN_PD24 (PIN_BASE + 0x60 + 24)
169
170#define AT91_PIN_PD25 (PIN_BASE + 0x60 + 25)
171#define AT91_PIN_PD26 (PIN_BASE + 0x60 + 26)
172#define AT91_PIN_PD27 (PIN_BASE + 0x60 + 27)
173#define AT91_PIN_PD28 (PIN_BASE + 0x60 + 28)
174#define AT91_PIN_PD29 (PIN_BASE + 0x60 + 29)
175
176#define AT91_PIN_PD30 (PIN_BASE + 0x60 + 30)
177#define AT91_PIN_PD31 (PIN_BASE + 0x60 + 31)
178
179#ifndef __ASSEMBLY__
180/* setup setup routines, called from board init or driver probe() */
181extern int at91_set_A_periph(unsigned pin, int use_pullup);
182extern int at91_set_B_periph(unsigned pin, int use_pullup);
183extern int at91_set_gpio_input(unsigned pin, int use_pullup);
184extern int at91_set_gpio_output(unsigned pin, int value);
185extern int at91_set_deglitch(unsigned pin, int is_on);
186
187/* callable at any time */
188extern int at91_set_gpio_value(unsigned pin, int value);
189extern int at91_get_gpio_value(unsigned pin);
190#endif
191
192#endif
193
diff --git a/include/asm-arm/arch-at91rm9200/hardware.h b/include/asm-arm/arch-at91rm9200/hardware.h
new file mode 100644
index 000000000000..2646c01f8e97
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/hardware.h
@@ -0,0 +1,92 @@
1/*
2 * include/asm-arm/arch-at91rm9200/hardware.h
3 *
4 * Copyright (C) 2003 SAN People
5 * Copyright (C) 2003 ATMEL
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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 */
13
14#ifndef __ASM_ARCH_HARDWARE_H
15#define __ASM_ARCH_HARDWARE_H
16
17#include <asm/sizes.h>
18
19#include <asm/arch/at91rm9200.h>
20#include <asm/arch/at91rm9200_sys.h>
21
22/*
23 * Remap the peripherals from address 0xFFFA0000 .. 0xFFFFFFFF
24 * to 0xFEFA0000 .. 0xFF000000. (384Kb)
25 */
26#define AT91_IO_PHYS_BASE 0xFFFA0000
27#define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1)
28#define AT91_IO_VIRT_BASE (0xFF000000 - AT91_IO_SIZE)
29
30 /* Convert a physical IO address to virtual IO address */
31#define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE)
32
33/*
34 * Virtual to Physical Address mapping for IO devices.
35 */
36#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS)
37#define AT91_VA_BASE_SPI AT91_IO_P2V(AT91_BASE_SPI)
38#define AT91_VA_BASE_SSC2 AT91_IO_P2V(AT91_BASE_SSC2)
39#define AT91_VA_BASE_SSC1 AT91_IO_P2V(AT91_BASE_SSC1)
40#define AT91_VA_BASE_SSC0 AT91_IO_P2V(AT91_BASE_SSC0)
41#define AT91_VA_BASE_US3 AT91_IO_P2V(AT91_BASE_US3)
42#define AT91_VA_BASE_US2 AT91_IO_P2V(AT91_BASE_US2)
43#define AT91_VA_BASE_US1 AT91_IO_P2V(AT91_BASE_US1)
44#define AT91_VA_BASE_US0 AT91_IO_P2V(AT91_BASE_US0)
45#define AT91_VA_BASE_EMAC AT91_IO_P2V(AT91_BASE_EMAC)
46#define AT91_VA_BASE_TWI AT91_IO_P2V(AT91_BASE_TWI)
47#define AT91_VA_BASE_MCI AT91_IO_P2V(AT91_BASE_MCI)
48#define AT91_VA_BASE_UDP AT91_IO_P2V(AT91_BASE_UDP)
49#define AT91_VA_BASE_TCB1 AT91_IO_P2V(AT91_BASE_TCB1)
50#define AT91_VA_BASE_TCB0 AT91_IO_P2V(AT91_BASE_TCB0)
51
52/* Internal SRAM */
53#define AT91_BASE_SRAM 0x00200000 /* Internal SRAM base address */
54#define AT91_SRAM_SIZE 0x00004000 /* Internal SRAM SIZE (16Kb) */
55
56/* Serial ports */
57#define AT91_NR_UART 5 /* 4 USART3's and one DBGU port */
58
59/* FLASH */
60#define AT91_FLASH_BASE 0x10000000 /* NCS0: Flash physical base address */
61
62/* SDRAM */
63#define AT91_SDRAM_BASE 0x20000000 /* NCS1: SDRAM physical base address */
64
65/* SmartMedia */
66#define AT91_SMARTMEDIA_BASE 0x40000000 /* NCS3: Smartmedia physical base address */
67
68/* Multi-Master Memory controller */
69#define AT91_UHP_BASE 0x00300000 /* USB Host controller */
70
71/* Clocks */
72#define AT91_SLOW_CLOCK 32768 /* slow clock */
73
74#ifndef __ASSEMBLY__
75#include <asm/io.h>
76
77static inline unsigned int at91_sys_read(unsigned int reg_offset)
78{
79 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
80
81 return readl(addr + reg_offset);
82}
83
84static inline void at91_sys_write(unsigned int reg_offset, unsigned long value)
85{
86 void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
87
88 writel(value, addr + reg_offset);
89}
90#endif
91
92#endif
diff --git a/include/asm-arm/arch-at91rm9200/io.h b/include/asm-arm/arch-at91rm9200/io.h
new file mode 100644
index 000000000000..23e670d85c9d
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/io.h
@@ -0,0 +1,33 @@
1/*
2 * include/asm-arm/arch-at91rm9200/io.h
3 *
4 * Copyright (C) 2003 SAN People
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __ASM_ARCH_IO_H
22#define __ASM_ARCH_IO_H
23
24#include <asm/arch/at91rm9200.h>
25#include <asm/io.h>
26
27#define IO_SPACE_LIMIT 0xFFFFFFFF
28
29#define __io(a) ((void __iomem *)(a))
30#define __mem_pci(a) (a)
31
32
33#endif
diff --git a/include/asm-arm/arch-at91rm9200/irqs.h b/include/asm-arm/arch-at91rm9200/irqs.h
new file mode 100644
index 000000000000..27b0497f1b36
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/irqs.h
@@ -0,0 +1,52 @@
1/*
2 * include/asm-arm/arch-at91rm9200/irqs.h
3 *
4 * Copyright (C) 2004 SAN People
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __ASM_ARCH_IRQS_H
22#define __ASM_ARCH_IRQS_H
23
24#define NR_AIC_IRQS 32
25
26
27/*
28 * Acknowledge interrupt with AIC after interrupt has been handled.
29 * (by kernel/irq.c)
30 */
31#define irq_finish(irq) do { at91_sys_write(AT91_AIC_EOICR, 0); } while (0)
32
33
34/*
35 * IRQ interrupt symbols are the AT91_ID_* symbols in at91rm9200.h
36 * for IRQs handled directly through the AIC, or else the AT91_PIN_*
37 * symbols in gpio.h for ones handled indirectly as GPIOs.
38 * We make provision for 4 banks of GPIO.
39 */
40#include <asm/arch/gpio.h>
41
42#define NR_IRQS (NR_AIC_IRQS + (4 * 32))
43
44
45#ifndef __ASSEMBLY__
46/*
47 * Initialize the IRQ controller.
48 */
49extern void at91rm9200_init_irq(unsigned int priority[]);
50#endif
51
52#endif
diff --git a/include/asm-arm/arch-epxa10db/memory.h b/include/asm-arm/arch-at91rm9200/memory.h
index 999541b6a9f5..462f1f0ad67c 100644
--- a/include/asm-arm/arch-epxa10db/memory.h
+++ b/include/asm-arm/arch-at91rm9200/memory.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/include/asm-arm/arch-epxa10/memory.h 2 * include/asm-arm/arch-at91rm9200/memory.h
3 * 3 *
4 * Copyright (C) 2001 Altera Corporation 4 * Copyright (C) 2004 SAN People
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
@@ -17,13 +17,14 @@
17 * along with this program; if not, write to the Free Software 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 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20
20#ifndef __ASM_ARCH_MEMORY_H 21#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H 22#define __ASM_ARCH_MEMORY_H
22 23
23/* 24#include <asm/arch/hardware.h>
24 * Physical DRAM offset. 25
25 */ 26#define PHYS_OFFSET (AT91_SDRAM_BASE)
26#define PHYS_OFFSET UL(0x00000000) 27
27 28
28/* 29/*
29 * Virtual view <-> DMA view memory address translations 30 * Virtual view <-> DMA view memory address translations
@@ -32,7 +33,9 @@
32 * bus_to_virt: Used to convert an address for DMA operations 33 * bus_to_virt: Used to convert an address for DMA operations
33 * to an address that the kernel can use. 34 * to an address that the kernel can use.
34 */ 35 */
35#define __virt_to_bus(x) (x - PAGE_OFFSET + /*SDRAM_BASE*/0) 36#define __virt_to_bus__is_a_macro
36#define __bus_to_virt(x) (x - /*SDRAM_BASE*/0 + PAGE_OFFSET) 37#define __virt_to_bus(x) __virt_to_phys(x)
38#define __bus_to_virt__is_a_macro
39#define __bus_to_virt(x) __phys_to_virt(x)
37 40
38#endif 41#endif
diff --git a/include/asm-arm/arch-epxa10db/vmalloc.h b/include/asm-arm/arch-at91rm9200/param.h
index 546fb7d2b6ad..9480f8446852 100644
--- a/include/asm-arm/arch-epxa10db/vmalloc.h
+++ b/include/asm-arm/arch-at91rm9200/param.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/include/asm-arm/arch-epxa10db/vmalloc.h 2 * include/asm-arm/arch-at91rm9200/param.h
3 * 3 *
4 * Copyright (C) 2000 Russell King. 4 * Copyright (C) 2003 SAN People
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
@@ -17,4 +17,12 @@
17 * along with this program; if not, write to the Free Software 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 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#define VMALLOC_END (PAGE_OFFSET + 0x10000000) 20
21#ifndef __ASM_ARCH_PARAM_H
22#define __ASM_ARCH_PARAM_H
23
24/*
25 * We use default params
26 */
27
28#endif
diff --git a/include/asm-arm/arch-at91rm9200/pio.h b/include/asm-arm/arch-at91rm9200/pio.h
new file mode 100644
index 000000000000..a89501b4a703
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/pio.h
@@ -0,0 +1,115 @@
1/*
2 * include/asm-arm/arch-at91rm9200/pio.h
3 *
4 * Copyright (C) 2003 SAN People
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 */
12
13#ifndef __ASM_ARCH_PIO_H
14#define __ASM_ARCH_PIO_H
15
16#include <asm/arch/hardware.h>
17
18static inline void AT91_CfgPIO_USART0(void) {
19 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA17_TXD0 | AT91_PA18_RXD0 | AT91_PA20_CTS0);
20
21 /*
22 * Errata #39 - RTS0 is not internally connected to PA21. We need to drive
23 * the pin manually. Default is off (RTS is active low).
24 */
25 at91_sys_write(AT91_PIOA + PIO_PER, AT91_PA21_RTS0);
26 at91_sys_write(AT91_PIOA + PIO_OER, AT91_PA21_RTS0);
27 at91_sys_write(AT91_PIOA + PIO_SODR, AT91_PA21_RTS0);
28}
29
30static inline void AT91_CfgPIO_USART1(void) {
31 at91_sys_write(AT91_PIOB + PIO_PDR, AT91_PB18_RI1 | AT91_PB19_DTR1
32 | AT91_PB20_TXD1 | AT91_PB21_RXD1 | AT91_PB23_DCD1
33 | AT91_PB24_CTS1 | AT91_PB25_DSR1 | AT91_PB26_RTS1);
34}
35
36static inline void AT91_CfgPIO_USART2(void) {
37 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA22_RXD2 | AT91_PA23_TXD2);
38}
39
40static inline void AT91_CfgPIO_USART3(void) {
41 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA5_TXD3 | AT91_PA6_RXD3);
42 at91_sys_write(AT91_PIOA + PIO_BSR, AT91_PA5_TXD3 | AT91_PA6_RXD3);
43}
44
45static inline void AT91_CfgPIO_DBGU(void) {
46 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA31_DTXD | AT91_PA30_DRXD);
47}
48
49/*
50 * Enable the Two-Wire interface.
51 */
52static inline void AT91_CfgPIO_TWI(void) {
53 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA25_TWD | AT91_PA26_TWCK);
54 at91_sys_write(AT91_PIOA + PIO_ASR, AT91_PA25_TWD | AT91_PA26_TWCK);
55 at91_sys_write(AT91_PIOA + PIO_MDER, AT91_PA25_TWD | AT91_PA26_TWCK); /* open drain */
56}
57
58/*
59 * Enable the Serial Peripheral Interface.
60 */
61static inline void AT91_CfgPIO_SPI(void) {
62 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA0_MISO | AT91_PA1_MOSI | AT91_PA2_SPCK);
63}
64
65static inline void AT91_CfgPIO_SPI_CS0(void) {
66 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA3_NPCS0);
67}
68
69static inline void AT91_CfgPIO_SPI_CS1(void) {
70 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA4_NPCS1);
71}
72
73static inline void AT91_CfgPIO_SPI_CS2(void) {
74 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA5_NPCS2);
75}
76
77static inline void AT91_CfgPIO_SPI_CS3(void) {
78 at91_sys_write(AT91_PIOA + PIO_PDR, AT91_PA6_NPCS3);
79}
80
81/*
82 * Select the DataFlash card.
83 */
84static inline void AT91_CfgPIO_DataFlashCard(void) {
85 at91_sys_write(AT91_PIOB + PIO_PER, AT91_PIO_P(7));
86 at91_sys_write(AT91_PIOB + PIO_OER, AT91_PIO_P(7));
87 at91_sys_write(AT91_PIOB + PIO_CODR, AT91_PIO_P(7));
88}
89
90/*
91 * Enable NAND Flash (SmartMedia) interface.
92 */
93static inline void AT91_CfgPIO_SmartMedia(void) {
94 /* enable PC0=SMCE, PC1=SMOE, PC3=SMWE, A21=CLE, A22=ALE */
95 at91_sys_write(AT91_PIOC + PIO_ASR, AT91_PC0_BFCK | AT91_PC1_BFRDY_SMOE | AT91_PC3_BFBAA_SMWE);
96 at91_sys_write(AT91_PIOC + PIO_PDR, AT91_PC0_BFCK | AT91_PC1_BFRDY_SMOE | AT91_PC3_BFBAA_SMWE);
97
98 /* Configure PC2 as input (signal READY of the SmartMedia) */
99 at91_sys_write(AT91_PIOC + PIO_PER, AT91_PC2_BFAVD); /* enable direct output enable */
100 at91_sys_write(AT91_PIOC + PIO_ODR, AT91_PC2_BFAVD); /* disable output */
101
102 /* Configure PB1 as input (signal Card Detect of the SmartMedia) */
103 at91_sys_write(AT91_PIOB + PIO_PER, AT91_PIO_P(1)); /* enable direct output enable */
104 at91_sys_write(AT91_PIOB + PIO_ODR, AT91_PIO_P(1)); /* disable output */
105}
106
107static inline int AT91_PIO_SmartMedia_RDY(void) {
108 return (at91_sys_read(AT91_PIOC + PIO_PDSR) & AT91_PIO_P(2)) ? 1 : 0;
109}
110
111static inline int AT91_PIO_SmartMedia_CardDetect(void) {
112 return (at91_sys_read(AT91_PIOB + PIO_PDSR) & AT91_PIO_P(1)) ? 1 : 0;
113}
114
115#endif
diff --git a/include/asm-arm/arch-epxa10db/system.h b/include/asm-arm/arch-at91rm9200/system.h
index 345b092a1ed5..29c42655f05c 100644
--- a/include/asm-arm/arch-epxa10db/system.h
+++ b/include/asm-arm/arch-at91rm9200/system.h
@@ -1,9 +1,7 @@
1/* 1/*
2 * linux/include/asm-arm/arch-epxa10db/system.h 2 * include/asm-arm/arch-at91rm9200/system.h
3 * 3 *
4 * Copyright (C) 1999 ARM Limited 4 * Copyright (C) 2003 SAN People
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 * Copyright (C) 2001 Altera Corporation
7 * 5 *
8 * This program is free software; you can redistribute it and/or modify 6 * 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 7 * it under the terms of the GNU General Public License as published by
@@ -19,23 +17,35 @@
19 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 19 */
20
22#ifndef __ASM_ARCH_SYSTEM_H 21#ifndef __ASM_ARCH_SYSTEM_H
23#define __ASM_ARCH_SYSTEM_H 22#define __ASM_ARCH_SYSTEM_H
24 23
25#include <asm/arch/platform.h> 24#include <asm/arch/hardware.h>
26 25
27static inline void arch_idle(void) 26static inline void arch_idle(void)
28{ 27{
29 /* 28 /*
30 * This should do all the clock switching 29 * Disable the processor clock. The processor will be automatically
31 * and wait for interrupt tricks 30 * re-enabled by an interrupt or by a reset.
31 */
32// at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK);
33
34 /*
35 * Set the processor (CP15) into 'Wait for Interrupt' mode.
36 * Unlike disabling the processor clock via the PMC (above)
37 * this allows the processor to be woken via JTAG.
32 */ 38 */
33 cpu_do_idle(); 39 cpu_do_idle();
34} 40}
35 41
36extern __inline__ void arch_reset(char mode) 42static inline void arch_reset(char mode)
37{ 43{
38 /* Hmm... We can probably do something with the watchdog... */ 44 /*
45 * Perform a hardware reset with the use of the Watchdog timer.
46 */
47 at91_sys_write(AT91_ST_WDMR, AT91_ST_RSTEN | AT91_ST_EXTEN | 1);
48 at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
39} 49}
40 50
41#endif 51#endif
diff --git a/include/asm-arm/arch-epxa10db/dma.h b/include/asm-arm/arch-at91rm9200/timex.h
index 5d97734d1077..3f112dd12587 100644
--- a/include/asm-arm/arch-epxa10db/dma.h
+++ b/include/asm-arm/arch-at91rm9200/timex.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/include/asm-arm/arch-camelot/dma.h 2 * include/asm-arm/arch-at91rm9200/timex.h
3 * 3 *
4 * Copyright (C) 1997,1998 Russell King 4 * Copyright (C) 2003 SAN People
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
@@ -17,12 +17,12 @@
17 * along with this program; if not, write to the Free Software 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 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#ifndef __ASM_ARCH_DMA_H
21#define __ASM_ARCH_DMA_H
22 20
23#define MAX_DMA_ADDRESS 0xffffffff 21#ifndef __ASM_ARCH_TIMEX_H
22#define __ASM_ARCH_TIMEX_H
24 23
25#define MAX_DMA_CHANNELS 0 24#include <asm/arch/hardware.h>
26 25
27#endif /* _ASM_ARCH_DMA_H */ 26#define CLOCK_TICK_RATE (AT91_SLOW_CLOCK)
28 27
28#endif
diff --git a/include/asm-arm/arch-at91rm9200/uncompress.h b/include/asm-arm/arch-at91rm9200/uncompress.h
new file mode 100644
index 000000000000..b30dd5520713
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/uncompress.h
@@ -0,0 +1,55 @@
1/*
2 * include/asm-arm/arch-at91rm9200/uncompress.h
3 *
4 * Copyright (C) 2003 SAN People
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __ASM_ARCH_UNCOMPRESS_H
22#define __ASM_ARCH_UNCOMPRESS_H
23
24#include <asm/arch/hardware.h>
25
26/*
27 * The following code assumes the serial port has already been
28 * initialized by the bootloader. We search for the first enabled
29 * port in the most probable order. If you didn't setup a port in
30 * your bootloader then nothing will appear (which might be desired).
31 *
32 * This does not append a newline
33 */
34static void putstr(const char *s)
35{
36 void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */
37
38 while (*s) {
39 while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY)) { barrier(); }
40 __raw_writel(*s, sys + AT91_DBGU_THR);
41 if (*s == '\n') {
42 while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY)) { barrier(); }
43 __raw_writel('\r', sys + AT91_DBGU_THR);
44 }
45 s++;
46 }
47 /* wait for transmission to complete */
48 while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXEMPTY)) { barrier(); }
49}
50
51#define arch_decomp_setup()
52
53#define arch_decomp_wdog()
54
55#endif
diff --git a/include/asm-arm/arch-epxa10db/timex.h b/include/asm-arm/arch-at91rm9200/vmalloc.h
index b87a75fc9589..34d9718feb90 100644
--- a/include/asm-arm/arch-epxa10db/timex.h
+++ b/include/asm-arm/arch-at91rm9200/vmalloc.h
@@ -1,9 +1,7 @@
1/* 1/*
2 * linux/include/asm-arm/arch-epxa10db/timex.h 2 * include/asm-arm/arch-at91rm9200/vmalloc.h
3 * 3 *
4 * Excalibur timex specifications 4 * Copyright (C) 2003 SAN People
5 *
6 * Copyright (C) 2001 Altera Corporation
7 * 5 *
8 * This program is free software; you can redistribute it and/or modify 6 * 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 7 * it under the terms of the GNU General Public License as published by
@@ -20,7 +18,9 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 19 */
22 20
23/* 21#ifndef __ASM_ARCH_VMALLOC_H
24 * ?? 22#define __ASM_ARCH_VMALLOC_H
25 */ 23
26#define CLOCK_TICK_RATE (50000000 / 16) 24#define VMALLOC_END (AT91_IO_VIRT_BASE & PGDIR_MASK)
25
26#endif
diff --git a/include/asm-arm/arch-cl7500/dma.h b/include/asm-arm/arch-cl7500/dma.h
index 1d6a8829d327..591ed2551892 100644
--- a/include/asm-arm/arch-cl7500/dma.h
+++ b/include/asm-arm/arch-cl7500/dma.h
@@ -15,7 +15,6 @@
15 * bytes of RAM. 15 * bytes of RAM.
16 */ 16 */
17#define MAX_DMA_ADDRESS 0xd0000000 17#define MAX_DMA_ADDRESS 0xd0000000
18#define MAX_DMA_CHANNELS 0
19 18
20#define DMA_S0 0 19#define DMA_S0 0
21 20
diff --git a/include/asm-arm/arch-cl7500/entry-macro.S b/include/asm-arm/arch-cl7500/entry-macro.S
index 686f413f82d6..c9e5395e5106 100644
--- a/include/asm-arm/arch-cl7500/entry-macro.S
+++ b/include/asm-arm/arch-cl7500/entry-macro.S
@@ -1,3 +1,3 @@
1 1#include <asm/hardware.h>
2#include <asm/hardware/entry-macro-iomd.S> 2#include <asm/hardware/entry-macro-iomd.S>
3 3
diff --git a/include/asm-arm/arch-clps711x/dma.h b/include/asm-arm/arch-clps711x/dma.h
index 3c4c5c843252..610997938423 100644
--- a/include/asm-arm/arch-clps711x/dma.h
+++ b/include/asm-arm/arch-clps711x/dma.h
@@ -17,12 +17,3 @@
17 * along with this program; if not, write to the Free Software 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 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#ifndef __ASM_ARCH_DMA_H
21#define __ASM_ARCH_DMA_H
22
23#define MAX_DMA_ADDRESS 0xffffffff
24
25#define MAX_DMA_CHANNELS 0
26
27#endif /* _ASM_ARCH_DMA_H */
28
diff --git a/include/asm-arm/arch-clps711x/entry-macro.S b/include/asm-arm/arch-clps711x/entry-macro.S
index b31079a1d4a9..21f6ee485819 100644
--- a/include/asm-arm/arch-clps711x/entry-macro.S
+++ b/include/asm-arm/arch-clps711x/entry-macro.S
@@ -7,6 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
10#include <asm/hardware/clps7111.h> 11#include <asm/hardware/clps7111.h>
11 12
12 .macro disable_fiq 13 .macro disable_fiq
diff --git a/include/asm-arm/arch-clps711x/system.h b/include/asm-arm/arch-clps711x/system.h
index 2ab981fee37f..11e1491535a8 100644
--- a/include/asm-arm/arch-clps711x/system.h
+++ b/include/asm-arm/arch-clps711x/system.h
@@ -20,7 +20,9 @@
20#ifndef __ASM_ARCH_SYSTEM_H 20#ifndef __ASM_ARCH_SYSTEM_H
21#define __ASM_ARCH_SYSTEM_H 21#define __ASM_ARCH_SYSTEM_H
22 22
23#include <asm/hardware.h>
23#include <asm/hardware/clps7111.h> 24#include <asm/hardware/clps7111.h>
25#include <asm/io.h>
24 26
25static inline void arch_idle(void) 27static inline void arch_idle(void)
26{ 28{
diff --git a/include/asm-arm/arch-ebsa110/dma.h b/include/asm-arm/arch-ebsa110/dma.h
index d491776ac1cc..c52f9e2ab0bb 100644
--- a/include/asm-arm/arch-ebsa110/dma.h
+++ b/include/asm-arm/arch-ebsa110/dma.h
@@ -9,11 +9,3 @@
9 * 9 *
10 * EBSA110 DMA definitions 10 * EBSA110 DMA definitions
11 */ 11 */
12#ifndef __ASM_ARCH_DMA_H
13#define __ASM_ARCH_DMA_H
14
15#define MAX_DMA_ADDRESS 0xffffffff
16#define MAX_DMA_CHANNELS 0
17
18#endif /* _ASM_ARCH_DMA_H */
19
diff --git a/include/asm-arm/arch-ebsa285/dma.h b/include/asm-arm/arch-ebsa285/dma.h
index c43046eb8bc7..0259ad45d33c 100644
--- a/include/asm-arm/arch-ebsa285/dma.h
+++ b/include/asm-arm/arch-ebsa285/dma.h
@@ -10,11 +10,6 @@
10#define __ASM_ARCH_DMA_H 10#define __ASM_ARCH_DMA_H
11 11
12/* 12/*
13 * This is the maximum DMA address that can be DMAd to.
14 */
15#define MAX_DMA_ADDRESS 0xffffffff
16
17/*
18 * The 21285 has two internal DMA channels; we call these 8 and 9. 13 * The 21285 has two internal DMA channels; we call these 8 and 9.
19 * On CATS hardware we have an additional eight ISA dma channels 14 * On CATS hardware we have an additional eight ISA dma channels
20 * numbered 0..7. 15 * numbered 0..7.
diff --git a/include/asm-arm/arch-ebsa285/entry-macro.S b/include/asm-arm/arch-ebsa285/entry-macro.S
index db5729ff6349..cf10ac96fdde 100644
--- a/include/asm-arm/arch-ebsa285/entry-macro.S
+++ b/include/asm-arm/arch-ebsa285/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11#include <asm/arch/irqs.h>
10#include <asm/hardware/dec21285.h> 12#include <asm/hardware/dec21285.h>
11 13
12 .macro disable_fiq 14 .macro disable_fiq
diff --git a/include/asm-arm/arch-epxa10db/debug-macro.S b/include/asm-arm/arch-epxa10db/debug-macro.S
deleted file mode 100644
index 1d11c51f498f..000000000000
--- a/include/asm-arm/arch-epxa10db/debug-macro.S
+++ /dev/null
@@ -1,41 +0,0 @@
1/* linux/include/asm-arm/arch-epxa10db/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
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#include <asm/arch/excalibur.h>
15#define UART00_TYPE
16#include <asm/arch/uart00.h>
17
18 .macro addruart,rx
19 mrc p15, 0, \rx, c1, c0
20 tst \rx, #1 @ MMU enabled?
21 ldr \rx, =EXC_UART00_BASE @ physical base address
22 orrne \rx, \rx, #0xff000000 @ virtual base
23 orrne \rx, \rx, #0x00f00000
24 .endm
25
26 .macro senduart,rd,rx
27 str \rd, [\rx, #UART_TD(0)]
28 .endm
29
30 .macro waituart,rd,rx
311001: ldr \rd, [\rx, #UART_TSR(0)]
32 and \rd, \rd, #UART_TSR_TX_LEVEL_MSK
33 cmp \rd, #15
34 beq 1001b
35 .endm
36
37 .macro busyuart,rd,rx
381001: ldr \rd, [\rx, #UART_TSR(0)]
39 ands \rd, \rd, #UART_TSR_TX_LEVEL_MSK
40 bne 1001b
41 .endm
diff --git a/include/asm-arm/arch-epxa10db/entry-macro.S b/include/asm-arm/arch-epxa10db/entry-macro.S
deleted file mode 100644
index de6ae08334e2..000000000000
--- a/include/asm-arm/arch-epxa10db/entry-macro.S
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * include/asm-arm/arch-epxa10db/entry-macro.S
3 *
4 * Low-level IRQ helper macros for epxa10db platform
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <asm/arch/platform.h>
11#undef IRQ_MODE /* same name defined in asm/proc/ptrace.h */
12#include <asm/arch/int_ctrl00.h>
13
14 .macro disable_fiq
15 .endm
16
17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
18
19 ldr \irqstat, =INT_ID(IO_ADDRESS(EXC_INT_CTRL00_BASE))
20 ldr \irqnr,[\irqstat]
21 cmp \irqnr,#0
22 subne \irqnr,\irqnr,#1
23
24 .endm
25
diff --git a/include/asm-arm/arch-epxa10db/ether00.h b/include/asm-arm/arch-epxa10db/ether00.h
deleted file mode 100644
index b737b8aabe2f..000000000000
--- a/include/asm-arm/arch-epxa10db/ether00.h
+++ /dev/null
@@ -1,482 +0,0 @@
1#ifndef __ETHER00_H
2#define __ETHER00_H
3
4
5
6/*
7 * Register definitions for the Ethernet MAC
8 */
9
10/*
11 * Copyright (c) Altera Corporation 2000.
12 * All rights reserved.
13 */
14
15/*
16* Structures for the DMA controller
17*/
18typedef struct fda_desc
19 {
20 struct fda_desc * FDNext;
21 long FDSystem;
22 long FDStat;
23 short FDLength;
24 short FDCtl;
25 }FDA_DESC;
26
27typedef struct buf_desc
28 {
29 char * BuffData;
30 short BuffLength;
31 char BDStat;
32 char BDCtl;
33 }BUF_DESC;
34
35/*
36* Control masks for the DMA controller
37*/
38#define FDCTL_BDCOUNT_MSK (0x1F)
39#define FDCTL_BDCOUNT_OFST (0)
40#define FDCTL_FRMOPT_MSK (0x7C00)
41#define FDCTL_FRMOPT_OFST (10)
42#define FDCTL_COWNSFD_MSK (0x8000)
43#define FDCTL_COWNSFD_OFST (15)
44
45#define BDCTL_RXBDSEQN_MSK (0x7F)
46#define BDCTL_RXBDSEQN_OFST (0)
47#define BDCTL_COWNSBD_MSK (0x80)
48#define BDCTL_COWNSBD_OFST (7)
49
50#define FDNEXT_EOL_MSK (0x1)
51#define FDNEXT_EOL_OFST (0)
52#define FDNEXT_EOL_POINTER_MSK (0xFFFFFFF0)
53#define FDNEXT_EOL_POINTER_OFST (4)
54
55#define ETHER_ARC_SIZE (21)
56
57/*
58* Register definitions and masks
59*/
60#define ETHER_DMA_CTL(base) (ETHER00_TYPE (base + 0x100))
61#define ETHER_DMA_CTL_DMBURST_OFST (2)
62#define ETHER_DMA_CTL_DMBURST_MSK (0x1FC)
63#define ETHER_DMA_CTL_POWRMGMNT_OFST (11)
64#define ETHER_DMA_CTL_POWRMGMNT_MSK (0x1000)
65#define ETHER_DMA_CTL_TXBIGE_OFST (14)
66#define ETHER_DMA_CTL_TXBIGE_MSK (0x4000)
67#define ETHER_DMA_CTL_RXBIGE_OFST (15)
68#define ETHER_DMA_CTL_RXBIGE_MSK (0x8000)
69#define ETHER_DMA_CTL_TXWAKEUP_OFST (16)
70#define ETHER_DMA_CTL_TXWAKEUP_MSK (0x10000)
71#define ETHER_DMA_CTL_SWINTREQ_OFST (17)
72#define ETHER_DMA_CTL_SWINTREQ_MSK (0x20000)
73#define ETHER_DMA_CTL_INTMASK_OFST (18)
74#define ETHER_DMA_CTL_INTMASK_MSK (0x40000)
75#define ETHER_DMA_CTL_M66ENSTAT_OFST (19)
76#define ETHER_DMA_CTL_M66ENSTAT_MSK (0x80000)
77#define ETHER_DMA_CTL_RMTXINIT_OFST (20)
78#define ETHER_DMA_CTL_RMTXINIT_MSK (0x100000)
79#define ETHER_DMA_CTL_RMRXINIT_OFST (21)
80#define ETHER_DMA_CTL_RMRXINIT_MSK (0x200000)
81#define ETHER_DMA_CTL_RXALIGN_OFST (22)
82#define ETHER_DMA_CTL_RXALIGN_MSK (0xC00000)
83#define ETHER_DMA_CTL_RMSWRQ_OFST (24)
84#define ETHER_DMA_CTL_RMSWRQ_MSK (0x1000000)
85#define ETHER_DMA_CTL_RMEMBANK_OFST (25)
86#define ETHER_DMA_CTL_RMEMBANK_MSK (0x2000000)
87
88#define ETHER_TXFRMPTR(base) (ETHER00_TYPE (base + 0x104))
89
90#define ETHER_TXTHRSH(base) (ETHER00_TYPE (base + 0x308))
91
92#define ETHER_TXPOLLCTR(base) (ETHER00_TYPE (base + 0x30c))
93
94#define ETHER_BLFRMPTR(base) (ETHER00_TYPE (base + 0x110))
95#define ETHER_BLFFRMPTR_EOL_OFST (0)
96#define ETHER_BLFFRMPTR_EOL_MSK (0x1)
97#define ETHER_BLFFRMPTR_ADDRESS_OFST (4)
98#define ETHER_BLFFRMPTR_ADDRESS_MSK (0xFFFFFFF0)
99
100#define ETHER_RXFRAGSIZE(base) (ETHER00_TYPE (base + 0x114))
101#define ETHER_RXFRAGSIZE_MINFRAG_OFST (2)
102#define ETHER_RXFRAGSIZE_MINFRAG_MSK (0xFFC)
103#define ETHER_RXFRAGSIZE_ENPACK_OFST (15)
104#define ETHER_RXFRAGSIZE_ENPACK_MSK (0x8000)
105
106#define ETHER_INT_EN(base) (ETHER00_TYPE (base + 0x118))
107#define ETHER_INT_EN_FDAEXEN_OFST (0)
108#define ETHER_INT_EN_FDAEXEN_MSK (0x1)
109#define ETHER_INT_EN_BLEXEN_OFST (1)
110#define ETHER_INT_EN_BLEXN_MSK (0x2)
111#define ETHER_INT_EN_STARGABTEN_OFST (2)
112#define ETHER_INT_EN_STARGABTEN_MSK (0x4)
113#define ETHER_INT_EN_RTARGABTEN_OFST (3)
114#define ETHER_INT_EN_RTARGABTEN_MSK (0x8)
115#define ETHER_INT_EN_RMASABTEN_OFST (4)
116#define ETHER_INT_EN_RMASABTEN_MSK (0x10)
117#define ETHER_INT_EN_SSYSERREN_OFST (5)
118#define ETHER_INT_EN_SSYSERREN_MSK (0x20)
119#define ETHER_INT_EN_DPARERREN_OFST (6)
120#define ETHER_INT_EN_DPARERREN_MSK (0x40)
121#define ETHER_INT_EN_EARNOTEN_OFST (7)
122#define ETHER_INT_EN_EARNOTEN_MSK (0x80)
123#define ETHER_INT_EN_DPARDEN_OFST (8)
124#define ETHER_INT_EN_DPARDEN_MSK (0x100)
125#define ETHER_INT_EN_DMPARERREN_OFST (9)
126#define ETHER_INT_EN_DMPARERREN_MSK (0x200)
127#define ETHER_INT_EN_TXCTLCMPEN_OFST (10)
128#define ETHER_INT_EN_TXCTLCMPEN_MSK (0x400)
129#define ETHER_INT_EN_NRABTEN_OFST (11)
130#define ETHER_INT_EN_NRABTEN_MSK (0x800)
131
132#define ETHER_FDA_BAS(base) (ETHER00_TYPE (base + 0x11C))
133#define ETHER_FDA_BAS_ADDRESS_OFST (4)
134#define ETHER_FDA_BAS_ADDRESS_MSK (0xFFFFFFF0)
135
136#define ETHER_FDA_LIM(base) (ETHER00_TYPE (base + 0x120))
137#define ETHER_FDA_LIM_COUNT_OFST (4)
138#define ETHER_FDA_LIM_COUNT_MSK (0xFFF0)
139
140#define ETHER_INT_SRC(base) (ETHER00_TYPE (base + 0x124))
141#define ETHER_INT_SRC_INTMACTX_OFST (0)
142#define ETHER_INT_SRC_INTMACTX_MSK (0x1)
143#define ETHER_INT_SRC_INTMACRX_OFST (1)
144#define ETHER_INT_SRC_INTMACRX_MSK (0x2)
145#define ETHER_INT_SRC_INTSBUS_OFST (2)
146#define ETHER_INT_SRC_INTSBUS_MSK (0x4)
147#define ETHER_INT_SRC_INTFDAEX_OFST (3)
148#define ETHER_INT_SRC_INTFDAEX_MSK (0x8)
149#define ETHER_INT_SRC_INTBLEX_OFST (4)
150#define ETHER_INT_SRC_INTBLEX_MSK (0x10)
151#define ETHER_INT_SRC_SWINT_OFST (5)
152#define ETHER_INT_SRC_SWINT_MSK (0x20)
153#define ETHER_INT_SRC_INTEARNOT_OFST (6)
154#define ETHER_INT_SRC_INTEARNOT_MSK (0x40)
155#define ETHER_INT_SRC_DMPARERR_OFST (7)
156#define ETHER_INT_SRC_DMPARERR_MSK (0x80)
157#define ETHER_INT_SRC_INTEXBD_OFST (8)
158#define ETHER_INT_SRC_INTEXBD_MSK (0x100)
159#define ETHER_INT_SRC_INTTXCTLCMP_OFST (9)
160#define ETHER_INT_SRC_INTTXCTLCMP_MSK (0x200)
161#define ETHER_INT_SRC_INTNRABT_OFST (10)
162#define ETHER_INT_SRC_INTNRABT_MSK (0x400)
163#define ETHER_INT_SRC_FDAEX_OFST (11)
164#define ETHER_INT_SRC_FDAEX_MSK (0x800)
165#define ETHER_INT_SRC_BLEX_OFST (12)
166#define ETHER_INT_SRC_BLEX_MSK (0x1000)
167#define ETHER_INT_SRC_DMPARERRSTAT_OFST (13)
168#define ETHER_INT_SRC_DMPARERRSTAT_MSK (0x2000)
169#define ETHER_INT_SRC_NRABT_OFST (14)
170#define ETHER_INT_SRC_NRABT_MSK (0x4000)
171#define ETHER_INT_SRC_INTLINK_OFST (15)
172#define ETHER_INT_SRC_INTLINK_MSK (0x8000)
173#define ETHER_INT_SRC_INTEXDEFER_OFST (16)
174#define ETHER_INT_SRC_INTEXDEFER_MSK (0x10000)
175#define ETHER_INT_SRC_INTRMON_OFST (17)
176#define ETHER_INT_SRC_INTRMON_MSK (0x20000)
177#define ETHER_INT_SRC_IRQ_MSK (0x83FF)
178
179#define ETHER_PAUSECNT(base) (ETHER00_TYPE (base + 0x40))
180#define ETHER_PAUSECNT_COUNT_OFST (0)
181#define ETHER_PAUSECNT_COUNT_MSK (0xFFFF)
182
183#define ETHER_REMPAUCNT(base) (ETHER00_TYPE (base + 0x44))
184#define ETHER_REMPAUCNT_COUNT_OFST (0)
185#define ETHER_REMPAUCNT_COUNT_MSK (0xFFFF)
186
187#define ETHER_TXCONFRMSTAT(base) (ETHER00_TYPE (base + 0x348))
188#define ETHER_TXCONFRMSTAT_TS_STAT_VALUE_OFST (0)
189#define ETHER_TXCONFRMSTAT_TS_STAT_VALUE_MSK (0x3FFFFF)
190
191#define ETHER_MAC_CTL(base) (ETHER00_TYPE (base + 0))
192#define ETHER_MAC_CTL_HALTREQ_OFST (0)
193#define ETHER_MAC_CTL_HALTREQ_MSK (0x1)
194#define ETHER_MAC_CTL_HALTIMM_OFST (1)
195#define ETHER_MAC_CTL_HALTIMM_MSK (0x2)
196#define ETHER_MAC_CTL_RESET_OFST (2)
197#define ETHER_MAC_CTL_RESET_MSK (0x4)
198#define ETHER_MAC_CTL_FULLDUP_OFST (3)
199#define ETHER_MAC_CTL_FULLDUP_MSK (0x8)
200#define ETHER_MAC_CTL_MACLOOP_OFST (4)
201#define ETHER_MAC_CTL_MACLOOP_MSK (0x10)
202#define ETHER_MAC_CTL_CONN_OFST (5)
203#define ETHER_MAC_CTL_CONN_MSK (0x60)
204#define ETHER_MAC_CTL_LOOP10_OFST (7)
205#define ETHER_MAC_CTL_LOOP10_MSK (0x80)
206#define ETHER_MAC_CTL_LNKCHG_OFST (8)
207#define ETHER_MAC_CTL_LNKCHG_MSK (0x100)
208#define ETHER_MAC_CTL_MISSROLL_OFST (10)
209#define ETHER_MAC_CTL_MISSROLL_MSK (0x400)
210#define ETHER_MAC_CTL_ENMISSROLL_OFST (13)
211#define ETHER_MAC_CTL_ENMISSROLL_MSK (0x2000)
212#define ETHER_MAC_CTL_LINK10_OFST (15)
213#define ETHER_MAC_CTL_LINK10_MSK (0x8000)
214
215#define ETHER_ARC_CTL(base) (ETHER00_TYPE (base + 0x4))
216#define ETHER_ARC_CTL_STATIONACC_OFST (0)
217#define ETHER_ARC_CTL_STATIONACC_MSK (0x1)
218#define ETHER_ARC_CTL_GROUPACC_OFST (1)
219#define ETHER_ARC_CTL_GROUPACC_MSK (0x2)
220#define ETHER_ARC_CTL_BROADACC_OFST (2)
221#define ETHER_ARC_CTL_BROADACC_MSK (0x4)
222#define ETHER_ARC_CTL_NEGARC_OFST (3)
223#define ETHER_ARC_CTL_NEGARC_MSK (0x8)
224#define ETHER_ARC_CTL_COMPEN_OFST (4)
225#define ETHER_ARC_CTL_COMPEN_MSK (0x10)
226
227#define ETHER_TX_CTL(base) (ETHER00_TYPE (base + 0x8))
228#define ETHER_TX_CTL_TXEN_OFST (0)
229#define ETHER_TX_CTL_TXEN_MSK (0x1)
230#define ETHER_TX_CTL_TXHALT_OFST (1)
231#define ETHER_TX_CTL_TXHALT_MSK (0x2)
232#define ETHER_TX_CTL_NOPAD_OFST (2)
233#define ETHER_TX_CTL_NOPAD_MSK (0x4)
234#define ETHER_TX_CTL_NOCRC_OFST (3)
235#define ETHER_TX_CTL_NOCRC_MSK (0x8)
236#define ETHER_TX_CTL_FBACK_OFST (4)
237#define ETHER_TX_CTL_FBACK_MSK (0x10)
238#define ETHER_TX_CTL_NOEXDEF_OFST (5)
239#define ETHER_TX_CTL_NOEXDEF_MSK (0x20)
240#define ETHER_TX_CTL_SDPAUSE_OFST (6)
241#define ETHER_TX_CTL_SDPAUSE_MSK (0x40)
242#define ETHER_TX_CTL_MII10_OFST (7)
243#define ETHER_TX_CTL_MII10_MSK (0x80)
244#define ETHER_TX_CTL_ENUNDER_OFST (8)
245#define ETHER_TX_CTL_ENUNDER_MSK (0x100)
246#define ETHER_TX_CTL_ENEXDEFER_OFST (9)
247#define ETHER_TX_CTL_ENEXDEFER_MSK (0x200)
248#define ETHER_TX_CTL_ENLCARR_OFST (10)
249#define ETHER_TX_CTL_ENLCARR_MSK (0x400)
250#define ETHER_TX_CTL_ENEXCOLL_OFST (11)
251#define ETHER_TX_CTL_ENEXCOLL_MSK (0x800)
252#define ETHER_TX_CTL_ENLATECOLL_OFST (12)
253#define ETHER_TX_CTL_ENLATECOLL_MSK (0x1000)
254#define ETHER_TX_CTL_ENTXPAR_OFST (13)
255#define ETHER_TX_CTL_ENTXPAR_MSK (0x2000)
256#define ETHER_TX_CTL_ENCOMP_OFST (14)
257#define ETHER_TX_CTL_ENCOMP_MSK (0x4000)
258
259#define ETHER_TX_STAT(base) (ETHER00_TYPE (base + 0xc))
260#define ETHER_TX_STAT_TXCOLL_OFST (0)
261#define ETHER_TX_STAT_TXCOLL_MSK (0xF)
262#define ETHER_TX_STAT_EXCOLL_OFST (4)
263#define ETHER_TX_STAT_EXCOLL_MSK (0x10)
264#define ETHER_TX_STAT_TXDEFER_OFST (5)
265#define ETHER_TX_STAT_TXDEFER_MSK (0x20)
266#define ETHER_TX_STAT_PAUSED_OFST (6)
267#define ETHER_TX_STAT_PAUSED_MSK (0x40)
268#define ETHER_TX_STAT_INTTX_OFST (7)
269#define ETHER_TX_STAT_INTTX_MSK (0x80)
270#define ETHER_TX_STAT_UNDER_OFST (8)
271#define ETHER_TX_STAT_UNDER_MSK (0x100)
272#define ETHER_TX_STAT_EXDEFER_OFST (9)
273#define ETHER_TX_STAT_EXDEFER_MSK (0x200)
274#define ETHER_TX_STAT_LCARR_OFST (10)
275#define ETHER_TX_STAT_LCARR_MSK (0x400)
276#define ETHER_TX_STAT_TX10STAT_OFST (11)
277#define ETHER_TX_STAT_TX10STAT_MSK (0x800)
278#define ETHER_TX_STAT_LATECOLL_OFST (12)
279#define ETHER_TX_STAT_LATECOLL_MSK (0x1000)
280#define ETHER_TX_STAT_TXPAR_OFST (13)
281#define ETHER_TX_STAT_TXPAR_MSK (0x2000)
282#define ETHER_TX_STAT_COMP_OFST (14)
283#define ETHER_TX_STAT_COMP_MSK (0x4000)
284#define ETHER_TX_STAT_TXHALTED_OFST (15)
285#define ETHER_TX_STAT_TXHALTED_MSK (0x8000)
286#define ETHER_TX_STAT_SQERR_OFST (16)
287#define ETHER_TX_STAT_SQERR_MSK (0x10000)
288#define ETHER_TX_STAT_TXMCAST_OFST (17)
289#define ETHER_TX_STAT_TXMCAST_MSK (0x20000)
290#define ETHER_TX_STAT_TXBCAST_OFST (18)
291#define ETHER_TX_STAT_TXBCAST_MSK (0x40000)
292#define ETHER_TX_STAT_VLAN_OFST (19)
293#define ETHER_TX_STAT_VLAN_MSK (0x80000)
294#define ETHER_TX_STAT_MACC_OFST (20)
295#define ETHER_TX_STAT_MACC_MSK (0x100000)
296#define ETHER_TX_STAT_TXPAUSE_OFST (21)
297#define ETHER_TX_STAT_TXPAUSE_MSK (0x200000)
298
299#define ETHER_RX_CTL(base) (ETHER00_TYPE (base + 0x10))
300#define ETHER_RX_CTL_RXEN_OFST (0)
301#define ETHER_RX_CTL_RXEN_MSK (0x1)
302#define ETHER_RX_CTL_RXHALT_OFST (1)
303#define ETHER_RX_CTL_RXHALT_MSK (0x2)
304#define ETHER_RX_CTL_LONGEN_OFST (2)
305#define ETHER_RX_CTL_LONGEN_MSK (0x4)
306#define ETHER_RX_CTL_SHORTEN_OFST (3)
307#define ETHER_RX_CTL_SHORTEN_MSK (0x8)
308#define ETHER_RX_CTL_STRIPCRC_OFST (4)
309#define ETHER_RX_CTL_STRIPCRC_MSK (0x10)
310#define ETHER_RX_CTL_PASSCTL_OFST (5)
311#define ETHER_RX_CTL_PASSCTL_MSK (0x20)
312#define ETHER_RX_CTL_IGNORECRC_OFST (6)
313#define ETHER_RX_CTL_IGNORECRC_MSK (0x40)
314#define ETHER_RX_CTL_ENALIGN_OFST (8)
315#define ETHER_RX_CTL_ENALIGN_MSK (0x100)
316#define ETHER_RX_CTL_ENCRCERR_OFST (9)
317#define ETHER_RX_CTL_ENCRCERR_MSK (0x200)
318#define ETHER_RX_CTL_ENOVER_OFST (10)
319#define ETHER_RX_CTL_ENOVER_MSK (0x400)
320#define ETHER_RX_CTL_ENLONGERR_OFST (11)
321#define ETHER_RX_CTL_ENLONGERR_MSK (0x800)
322#define ETHER_RX_CTL_ENRXPAR_OFST (13)
323#define ETHER_RX_CTL_ENRXPAR_MSK (0x2000)
324#define ETHER_RX_CTL_ENGOOD_OFST (14)
325#define ETHER_RX_CTL_ENGOOD_MSK (0x4000)
326
327#define ETHER_RX_STAT(base) (ETHER00_TYPE (base + 0x14))
328#define ETHER_RX_STAT_LENERR_OFST (4)
329#define ETHER_RX_STAT_LENERR_MSK (0x10)
330#define ETHER_RX_STAT_CTLRECD_OFST (5)
331#define ETHER_RX_STAT_CTLRECD_MSK (0x20)
332#define ETHER_RX_STAT_INTRX_OFST (6)
333#define ETHER_RX_STAT_INTRX_MSK (0x40)
334#define ETHER_RX_STAT_RX10STAT_OFST (7)
335#define ETHER_RX_STAT_RX10STAT_MSK (0x80)
336#define ETHER_RX_STAT_ALIGNERR_OFST (8)
337#define ETHER_RX_STAT_ALIGNERR_MSK (0x100)
338#define ETHER_RX_STAT_CRCERR_OFST (9)
339#define ETHER_RX_STAT_CRCERR_MSK (0x200)
340#define ETHER_RX_STAT_OVERFLOW_OFST (10)
341#define ETHER_RX_STAT_OVERFLOW_MSK (0x400)
342#define ETHER_RX_STAT_LONGERR_OFST (11)
343#define ETHER_RX_STAT_LONGERR_MSK (0x800)
344#define ETHER_RX_STAT_RXPAR_OFST (13)
345#define ETHER_RX_STAT_RXPAR_MSK (0x2000)
346#define ETHER_RX_STAT_GOOD_OFST (14)
347#define ETHER_RX_STAT_GOOD_MSK (0x4000)
348#define ETHER_RX_STAT_RXHALTED_OFST (15)
349#define ETHER_RX_STAT_RXHALTED_MSK (0x8000)
350#define ETHER_RX_STAT_RXMCAST_OFST (17)
351#define ETHER_RX_STAT_RXMCAST_MSK (0x10000)
352#define ETHER_RX_STAT_RXBCAST_OFST (18)
353#define ETHER_RX_STAT_RXBCAST_MSK (0x20000)
354#define ETHER_RX_STAT_RXVLAN_OFST (19)
355#define ETHER_RX_STAT_RXVLAN_MSK (0x40000)
356#define ETHER_RX_STAT_RXPAUSE_OFST (20)
357#define ETHER_RX_STAT_RXPAUSE_MSK (0x80000)
358#define ETHER_RX_STAT_ARCSTATUS_OFST (21)
359#define ETHER_RX_STAT_ARCSTATUS_MSK (0xF00000)
360#define ETHER_RX_STAT_ARCENT_OFST (25)
361#define ETHER_RX_STAT_ARCENT_MSK (0x1F000000)
362
363#define ETHER_MD_DATA(base) (ETHER00_TYPE (base + 0x18))
364
365#define ETHER_MD_CA(base) (ETHER00_TYPE (base + 0x1c))
366#define ETHER_MD_CA_ADDR_OFST (0)
367#define ETHER_MD_CA_ADDR_MSK (0x1F)
368#define ETHER_MD_CA_PHY_OFST (5)
369#define ETHER_MD_CA_PHY_MSK (0x3E0)
370#define ETHER_MD_CA_WR_OFST (10)
371#define ETHER_MD_CA_WR_MSK (0x400)
372#define ETHER_MD_CA_BUSY_OFST (11)
373#define ETHER_MD_CA_BUSY_MSK (0x800)
374#define ETHER_MD_CA_PRESUPP_OFST (12)
375#define ETHER_MD_CA_PRESUPP_MSK (0x1000)
376
377#define ETHER_ARC_ADR(base) (ETHER00_TYPE (base + 0x160))
378#define ETHER_ARC_ADR_ARC_LOC_OFST (2)
379#define ETHER_ARC_ADR_ARC_LOC_MSK (0xFFC)
380
381#define ETHER_ARC_DATA(base) (ETHER00_TYPE (base + 0x364))
382
383#define ETHER_ARC_ENA(base) (ETHER00_TYPE (base + 0x28))
384#define ETHER_ARC_ENA_MSK (0x1FFFFF)
385
386#define ETHER_PROM_CTL(base) (ETHER00_TYPE (base + 0x2c))
387#define ETHER_PROM_CTL_PROM_ADDR_OFST (0)
388#define ETHER_PROM_CTL_PROM_ADDR_MSK (0x3F)
389#define ETHER_PROM_CTL_OPCODE_OFST (13)
390#define ETHER_PROM_CTL_OPCODE_MSK (0x6000)
391#define ETHER_PROM_CTL_OPCODE_READ_MSK (0x4000)
392#define ETHER_PROM_CTL_OPCODE_WRITE_MSK (0x2000)
393#define ETHER_PROM_CTL_OPCODE_ERASE_MSK (0x6000)
394#define ETHER_PROM_CTL_ENABLE_MSK (0x0030)
395#define ETHER_PROM_CTL_DISABLE_MSK (0x0000)
396#define ETHER_PROM_CTL_BUSY_OFST (15)
397#define ETHER_PROM_CTL_BUSY_MSK (0x8000)
398
399#define ETHER_PROM_DATA(base) (ETHER00_TYPE (base + 0x30))
400
401#define ETHER_MISS_CNT(base) (ETHER00_TYPE (base + 0x3c))
402#define ETHER_MISS_CNT_COUNT_OFST (0)
403#define ETHER_MISS_CNT_COUNT_MSK (0xFFFF)
404
405#define ETHER_CNTDATA(base) (ETHER00_TYPE (base + 0x80))
406
407#define ETHER_CNTACC(base) (ETHER00_TYPE (base + 0x84))
408#define ETHER_CNTACC_ADDR_OFST (0)
409#define ETHER_CNTACC_ADDR_MSK (0xFF)
410#define ETHER_CNTACC_WRRDN_OFST (8)
411#define ETHER_CNTACC_WRRDN_MSK (0x100)
412#define ETHER_CNTACC_CLEAR_OFST (9)
413#define ETHER_CNTACC_CLEAR_MSK (0x200)
414
415#define ETHER_TXRMINTEN(base) (ETHER00_TYPE (base + 0x88))
416#define ETHER_TXRMINTEN_MSK (0x3FFFFFFF)
417
418#define ETHER_RXRMINTEN(base) (ETHER00_TYPE (base + 0x8C))
419#define ETHER_RXRMINTEN_MSK (0xFFFFFF)
420
421/*
422* RMON Registers
423*/
424#define RMON_COLLISION0 0x0
425#define RMON_COLLISION1 0x1
426#define RMON_COLLISION2 0x2
427#define RMON_COLLISION3 0x3
428#define RMON_COLLISION4 0x4
429#define RMON_COLLISION5 0x5
430#define RMON_COLLISION6 0x6
431#define RMON_COLLISION7 0x7
432#define RMON_COLLISION8 0x8
433#define RMON_COLLISION9 0x9
434#define RMON_COLLISION10 0xa
435#define RMON_COLLISION11 0xb
436#define RMON_COLLISION12 0xc
437#define RMON_COLLISION13 0xd
438#define RMON_COLLISION14 0xe
439#define RMON_COLLISION15 0xf
440#define RMON_COLLISION16 0x10
441#define RMON_FRAMES_WITH_DEFERRED_XMISSIONS 0x11
442#define RMON_LATE_COLLISIONS 0x12
443#define RMON_FRAMES_LOST_DUE_TO_MAC_XMIT 0x13
444#define RMON_CARRIER_SENSE_ERRORS 0x14
445#define RMON_FRAMES_WITH_EXCESSIVE_DEFERAL 0x15
446#define RMON_UNICAST_FRAMES_TRANSMITTED_OK 0x16
447#define RMON_MULTICAST_FRAMES_XMITTED_OK 0x17
448#define RMON_BROADCAST_FRAMES_XMITTED_OK 0x18
449#define RMON_SQE_TEST_ERRORS 0x19
450#define RMON_PAUSE_MACCTRL_FRAMES_XMITTED 0x1A
451#define RMON_MACCTRL_FRAMES_XMITTED 0x1B
452#define RMON_VLAN_FRAMES_XMITTED 0x1C
453#define RMON_OCTETS_XMITTED_OK 0x1D
454#define RMON_OCTETS_XMITTED_OK_HI 0x1E
455
456#define RMON_RX_PACKET_SIZES0 0x40
457#define RMON_RX_PACKET_SIZES1 0x41
458#define RMON_RX_PACKET_SIZES2 0x42
459#define RMON_RX_PACKET_SIZES3 0x43
460#define RMON_RX_PACKET_SIZES4 0x44
461#define RMON_RX_PACKET_SIZES5 0x45
462#define RMON_RX_PACKET_SIZES6 0x46
463#define RMON_RX_PACKET_SIZES7 0x47
464#define RMON_FRAME_CHECK_SEQUENCE_ERRORS 0x48
465#define RMON_ALIGNMENT_ERRORS 0x49
466#define RMON_FRAGMENTS 0x4A
467#define RMON_JABBERS 0x4B
468#define RMON_FRAMES_LOST_TO_INTMACRCVERR 0x4C
469#define RMON_UNICAST_FRAMES_RCVD_OK 0x4D
470#define RMON_MULTICAST_FRAMES_RCVD_OK 0x4E
471#define RMON_BROADCAST_FRAMES_RCVD_OK 0x4F
472#define RMON_IN_RANGE_LENGTH_ERRORS 0x50
473#define RMON_OUT_OF_RANGE_LENGTH_ERRORS 0x51
474#define RMON_VLAN_FRAMES_RCVD 0x52
475#define RMON_PAUSE_MAC_CTRL_FRAMES_RCVD 0x53
476#define RMON_MAC_CTRL_FRAMES_RCVD 0x54
477#define RMON_OCTETS_RCVD_OK 0x55
478#define RMON_OCTETS_RCVD_OK_HI 0x56
479#define RMON_OCTETS_RCVD_OTHER 0x57
480#define RMON_OCTETS_RCVD_OTHER_HI 0x58
481
482#endif /* __ETHER00_H */
diff --git a/include/asm-arm/arch-epxa10db/excalibur.h b/include/asm-arm/arch-epxa10db/excalibur.h
deleted file mode 100644
index 5c91dd6d7822..000000000000
--- a/include/asm-arm/arch-epxa10db/excalibur.h
+++ /dev/null
@@ -1,91 +0,0 @@
1/* megafunction wizard: %ARM-Based Excalibur%
2 GENERATION: STANDARD
3 VERSION: WM1.0
4 MODULE: ARM-Based Excalibur
5 PROJECT: excalibur
6 ============================================================
7 File Name: v:\embedded\linux\bootldr\excalibur.h
8 Megafunction Name(s): ARM-Based Excalibur
9 ============================================================
10
11 ************************************************************
12 THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
13 ************************************************************/
14
15#ifndef EXCALIBUR_H_INCLUDED
16#define EXCALIBUR_H_INCLUDED
17
18#define EXC_DEFINE_PROCESSOR_LITTLE_ENDIAN
19#define EXC_DEFINE_BOOT_FROM_FLASH
20
21#define EXC_INPUT_CLK_FREQUENCY (50000000)
22#define EXC_AHB1_CLK_FREQUENCY (150000000)
23#define EXC_AHB2_CLK_FREQUENCY (75000000)
24#define EXC_SDRAM_CLK_FREQUENCY (75000000)
25
26/* Registers Block */
27#define EXC_REGISTERS_BASE (0x7fffc000)
28#define EXC_MODE_CTRL00_BASE (EXC_REGISTERS_BASE + 0x000)
29#define EXC_IO_CTRL00_BASE (EXC_REGISTERS_BASE + 0x040)
30#define EXC_MMAP00_BASE (EXC_REGISTERS_BASE + 0x080)
31#define EXC_PLD_CONFIG00_BASE (EXC_REGISTERS_BASE + 0x140)
32#define EXC_TIMER00_BASE (EXC_REGISTERS_BASE + 0x200)
33#define EXC_INT_CTRL00_BASE (EXC_REGISTERS_BASE + 0xc00)
34#define EXC_CLOCK_CTRL00_BASE (EXC_REGISTERS_BASE + 0x300)
35#define EXC_WATCHDOG00_BASE (EXC_REGISTERS_BASE + 0xa00)
36#define EXC_UART00_BASE (EXC_REGISTERS_BASE + 0x280)
37#define EXC_EBI00_BASE (EXC_REGISTERS_BASE + 0x380)
38#define EXC_SDRAM00_BASE (EXC_REGISTERS_BASE + 0x400)
39#define EXC_AHB12_BRIDGE_CTRL00_BASE (EXC_REGISTERS_BASE + 0x800)
40#define EXC_PLD_STRIPE_BRIDGE_CTRL00_BASE (EXC_REGISTERS_BASE + 0x100)
41#define EXC_STRIPE_PLD_BRIDGE_CTRL00_BASE (EXC_REGISTERS_BASE + 0x100)
42
43#define EXC_REGISTERS_SIZE (0x00004000)
44
45/* EBI Block(s) */
46#define EXC_EBI_BLOCK0_BASE (0x40000000)
47#define EXC_EBI_BLOCK0_SIZE (0x00400000)
48#define EXC_EBI_BLOCK0_WIDTH (8)
49#define EXC_EBI_BLOCK0_NON_CACHEABLE
50#define EXC_EBI_BLOCK1_BASE (0x40400000)
51#define EXC_EBI_BLOCK1_SIZE (0x00400000)
52#define EXC_EBI_BLOCK1_WIDTH (16)
53#define EXC_EBI_BLOCK1_NON_CACHEABLE
54#define EXC_EBI_BLOCK2_BASE (0x40800000)
55#define EXC_EBI_BLOCK2_SIZE (0x00400000)
56#define EXC_EBI_BLOCK2_WIDTH (16)
57#define EXC_EBI_BLOCK2_NON_CACHEABLE
58#define EXC_EBI_BLOCK3_BASE (0x40c00000)
59#define EXC_EBI_BLOCK3_SIZE (0x00400000)
60#define EXC_EBI_BLOCK3_WIDTH (16)
61#define EXC_EBI_BLOCK3_NON_CACHEABLE
62
63/* SDRAM Block(s) */
64#define EXC_SDRAM_BLOCK0_BASE (0x00000000)
65#define EXC_SDRAM_BLOCK0_SIZE (0x04000000)
66#define EXC_SDRAM_BLOCK0_WIDTH (32)
67#define EXC_SDRAM_BLOCK1_BASE (0x04000000)
68#define EXC_SDRAM_BLOCK1_SIZE (0x04000000)
69#define EXC_SDRAM_BLOCK1_WIDTH (32)
70
71/* Single Port SRAM Block(s) */
72#define EXC_SPSRAM_BLOCK0_BASE (0x08000000)
73#define EXC_SPSRAM_BLOCK0_SIZE (0x00020000)
74#define EXC_SPSRAM_BLOCK1_BASE (0x08020000)
75#define EXC_SPSRAM_BLOCK1_SIZE (0x00020000)
76
77/* PLD Block(s) */
78#define EXC_PLD_BLOCK0_BASE (0x80000000)
79#define EXC_PLD_BLOCK0_SIZE (0x00004000)
80#define EXC_PLD_BLOCK0_NON_CACHEABLE
81#define EXC_PLD_BLOCK1_BASE (0xf000000)
82#define EXC_PLD_BLOCK1_SIZE (0x00004000)
83#define EXC_PLD_BLOCK1_NON_CACHEABLE
84#define EXC_PLD_BLOCK2_BASE (0x80008000)
85#define EXC_PLD_BLOCK2_SIZE (0x00004000)
86#define EXC_PLD_BLOCK2_NON_CACHEABLE
87#define EXC_PLD_BLOCK3_BASE (0x8000c000)
88#define EXC_PLD_BLOCK3_SIZE (0x00004000)
89#define EXC_PLD_BLOCK3_NON_CACHEABLE
90
91#endif
diff --git a/include/asm-arm/arch-epxa10db/hardware.h b/include/asm-arm/arch-epxa10db/hardware.h
deleted file mode 100644
index b992c2924a77..000000000000
--- a/include/asm-arm/arch-epxa10db/hardware.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-epxa10/hardware.h
3 *
4 * This file contains the hardware definitions of the Integrator.
5 *
6 * Copyright (C) 1999 ARM Limited.
7 * Copyright (C) 2001 Altera Corporation
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#ifndef __ASM_ARCH_HARDWARE_H
24#define __ASM_ARCH_HARDWARE_H
25
26#include <asm/arch/platform.h>
27
28/*
29 * Where in virtual memory the IO devices (timers, system controllers
30 * and so on)
31 */
32#define IO_BASE 0xf0000000 // VA of IO
33#define IO_SIZE 0x10000000 // How much?
34#define IO_START EXC_REGISTERS_BASE // PA of IO
35/* macro to get at IO space when running virtually */
36#define IO_ADDRESS(x) ((x) | 0xf0000000)
37
38#define FLASH_VBASE 0xFE000000
39#define FLASH_SIZE 0x01000000
40#define FLASH_START EXC_EBI_BLOCK0_BASE
41#define FLASH_VADDR(x) ((x)|0xFE000000)
42/*
43 * Similar to above, but for PCI addresses (memory, IO, Config and the
44 * V3 chip itself). WARNING: this has to mirror definitions in platform.h
45 */
46#if 0
47#define PCI_MEMORY_VADDR 0xe8000000
48#define PCI_CONFIG_VADDR 0xec000000
49#define PCI_V3_VADDR 0xed000000
50#define PCI_IO_VADDR 0xee000000
51
52#define PCIO_BASE PCI_IO_VADDR
53#define PCIMEM_BASE PCI_MEMORY_VADDR
54
55
56#define pcibios_assign_all_busses() 1
57
58#define PCIBIOS_MIN_IO 0x6000
59#define PCIBIOS_MIN_MEM 0x00100000
60#endif
61
62
63#endif
64
diff --git a/include/asm-arm/arch-epxa10db/int_ctrl00.h b/include/asm-arm/arch-epxa10db/int_ctrl00.h
deleted file mode 100644
index 23ec864c40bb..000000000000
--- a/include/asm-arm/arch-epxa10db/int_ctrl00.h
+++ /dev/null
@@ -1,288 +0,0 @@
1/*
2 *
3 * This file contains the register definitions for the Excalibur
4 * Timer TIMER00.
5 *
6 * Copyright (C) 2001 Altera Corporation
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 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __INT_CTRL00_H
24#define __INT_CTRL00_H
25
26#define INT_MS(base_addr) (INT_CTRL00_TYPE (base_addr + 0x00 ))
27#define INT_MS_FC_MSK (0x10000)
28#define INT_MS_FC_OFST (16)
29#define INT_MS_M1_MSK (0x8000)
30#define INT_MS_M1_OFST (15)
31#define INT_MS_M0_MSK (0x4000)
32#define INT_MS_M0_OFST (14)
33#define INT_MS_AE_MSK (0x2000)
34#define INT_MS_AE_OFST (13)
35#define INT_MS_PE_MSK (0x1000)
36#define INT_MS_PE_OFST (12)
37#define INT_MS_EE_MSK (0x0800)
38#define INT_MS_EE_OFST (11)
39#define INT_MS_PS_MSK (0x0400)
40#define INT_MS_PS_OFST (10)
41#define INT_MS_T1_MSK (0x0200)
42#define INT_MS_T1_OFST (9)
43#define INT_MS_T0_MSK (0x0100)
44#define INT_MS_T0_OFST (8)
45#define INT_MS_UA_MSK (0x0080)
46#define INT_MS_UA_OFST (7)
47#define INT_MS_IP_MSK (0x0040)
48#define INT_MS_IP_OFST (6)
49#define INT_MS_P5_MSK (0x0020)
50#define INT_MS_P5_OFST (5)
51#define INT_MS_P4_MSK (0x0010)
52#define INT_MS_P4_OFST (4)
53#define INT_MS_P3_MSK (0x0008)
54#define INT_MS_P3_OFST (3)
55#define INT_MS_P2_MSK (0x0004)
56#define INT_MS_P2_OFST (2)
57#define INT_MS_P1_MSK (0x0002)
58#define INT_MS_P1_OFST (1)
59#define INT_MS_P0_MSK (0x0001)
60#define INT_MS_P0_OFST (0)
61
62#define INT_MC(base_addr) (INT_CTRL00_TYPE (base_addr + 0x04 ))
63#define INT_MC_FC_MSK (0x10000)
64#define INT_MC_FC_OFST (16)
65#define INT_MC_M1_MSK (0x8000)
66#define INT_MC_M1_OFST (15)
67#define INT_MC_M0_MSK (0x4000)
68#define INT_MC_M0_OFST (14)
69#define INT_MC_AE_MSK (0x2000)
70#define INT_MC_AE_OFST (13)
71#define INT_MC_PE_MSK (0x1000)
72#define INT_MC_PE_OFST (12)
73#define INT_MC_EE_MSK (0x0800)
74#define INT_MC_EE_OFST (11)
75#define INT_MC_PS_MSK (0x0400)
76#define INT_MC_PS_OFST (10)
77#define INT_MC_T1_MSK (0x0200)
78#define INT_MC_T1_OFST (9)
79#define INT_MC_T0_MSK (0x0100)
80#define INT_MC_T0_OFST (8)
81#define INT_MC_UA_MSK (0x0080)
82#define INT_MC_UA_OFST (7)
83#define INT_MC_IP_MSK (0x0040)
84#define INT_MC_IP_OFST (6)
85#define INT_MC_P5_MSK (0x0020)
86#define INT_MC_P5_OFST (5)
87#define INT_MC_P4_MSK (0x0010)
88#define INT_MC_P4_OFST (4)
89#define INT_MC_P3_MSK (0x0008)
90#define INT_MC_P3_OFST (3)
91#define INT_MC_P2_MSK (0x0004)
92#define INT_MC_P2_OFST (2)
93#define INT_MC_P1_MSK (0x0002)
94#define INT_MC_P1_OFST (1)
95#define INT_MC_P0_MSK (0x0001)
96#define INT_MC_P0_OFST (0)
97
98#define INT_SS(base_addr) (INT_CTRL00_TYPE (base_addr + 0x08 ))
99#define INT_SS_FC_SSK (0x8000)
100#define INT_SS_FC_OFST (15)
101#define INT_SS_M1_SSK (0x8000)
102#define INT_SS_M1_OFST (15)
103#define INT_SS_M0_SSK (0x4000)
104#define INT_SS_M0_OFST (14)
105#define INT_SS_AE_SSK (0x2000)
106#define INT_SS_AE_OFST (13)
107#define INT_SS_PE_SSK (0x1000)
108#define INT_SS_PE_OFST (12)
109#define INT_SS_EE_SSK (0x0800)
110#define INT_SS_EE_OFST (11)
111#define INT_SS_PS_SSK (0x0400)
112#define INT_SS_PS_OFST (10)
113#define INT_SS_T1_SSK (0x0200)
114#define INT_SS_T1_OFST (9)
115#define INT_SS_T0_SSK (0x0100)
116#define INT_SS_T0_OFST (8)
117#define INT_SS_UA_SSK (0x0080)
118#define INT_SS_UA_OFST (7)
119#define INT_SS_IP_SSK (0x0040)
120#define INT_SS_IP_OFST (6)
121#define INT_SS_P5_SSK (0x0020)
122#define INT_SS_P5_OFST (5)
123#define INT_SS_P4_SSK (0x0010)
124#define INT_SS_P4_OFST (4)
125#define INT_SS_P3_SSK (0x0008)
126#define INT_SS_P3_OFST (3)
127#define INT_SS_P2_SSK (0x0004)
128#define INT_SS_P2_OFST (2)
129#define INT_SS_P1_SSK (0x0002)
130#define INT_SS_P1_OFST (1)
131#define INT_SS_P0_SSK (0x0001)
132#define INT_SS_P0_OFST (0)
133
134#define INT_RS(base_addr) (INT_CTRL00_TYPE (base_addr + 0x0C ))
135#define INT_RS_FC_RSK (0x10000)
136#define INT_RS_FC_OFST (16)
137#define INT_RS_M1_RSK (0x8000)
138#define INT_RS_M1_OFST (15)
139#define INT_RS_M0_RSK (0x4000)
140#define INT_RS_M0_OFST (14)
141#define INT_RS_AE_RSK (0x2000)
142#define INT_RS_AE_OFST (13)
143#define INT_RS_PE_RSK (0x1000)
144#define INT_RS_PE_OFST (12)
145#define INT_RS_EE_RSK (0x0800)
146#define INT_RS_EE_OFST (11)
147#define INT_RS_PS_RSK (0x0400)
148#define INT_RS_PS_OFST (10)
149#define INT_RS_T1_RSK (0x0200)
150#define INT_RS_T1_OFST (9)
151#define INT_RS_T0_RSK (0x0100)
152#define INT_RS_T0_OFST (8)
153#define INT_RS_UA_RSK (0x0080)
154#define INT_RS_UA_OFST (7)
155#define INT_RS_IP_RSK (0x0040)
156#define INT_RS_IP_OFST (6)
157#define INT_RS_P5_RSK (0x0020)
158#define INT_RS_P5_OFST (5)
159#define INT_RS_P4_RSK (0x0010)
160#define INT_RS_P4_OFST (4)
161#define INT_RS_P3_RSK (0x0008)
162#define INT_RS_P3_OFST (3)
163#define INT_RS_P2_RSK (0x0004)
164#define INT_RS_P2_OFST (2)
165#define INT_RS_P1_RSK (0x0002)
166#define INT_RS_P1_OFST (1)
167#define INT_RS_P0_RSK (0x0001)
168#define INT_RS_P0_OFST (0)
169
170#define INT_ID(base_addr) (INT_CTRL00_TYPE (base_addr + 0x10 ))
171#define INT_ID_ID_MSK (0x3F)
172#define INT_ID_ID_OFST (0)
173
174#define INT_PLD_PRIORITY(base_addr) (INT_CTRL00_TYPE (base_addr + 0x14 ))
175#define INT_PLD_PRIORITY_PRI_MSK (0x3F)
176#define INT_PLD_PRIORITY_PRI_OFST (0)
177#define INT_PLD_PRIORITY_GA_MSK (0x40)
178#define INT_PLD_PRIORITY_GA_OFST (6)
179
180#define INT_MODE(base_addr) (INT_CTRL00_TYPE (base_addr + 0x18 ))
181#define INT_MODE_MODE_MSK (0x3)
182#define INT_MODE_MODE_OFST (0)
183
184#define INT_PRIORITY_P0(base_addr) (INT_CTRL00_TYPE (base_addr + 0x80 ))
185#define INT_PRIORITY_P0_PRI_MSK (0x3F)
186#define INT_PRIORITY_P0_PRI_OFST (0)
187#define INT_PRIORITY_P0_FQ_MSK (0x40)
188#define INT_PRIORITY_P0_FQ_OFST (6)
189
190#define INT_PRIORITY_P1(base_addr) (INT_CTRL00_TYPE (base_addr + 0x84 ))
191#define INT_PRIORITY_P1_PRI_MSK (0x3F)
192#define INT_PRIORITY_P1_PRI_OFST (0)
193#define INT_PRIORITY_P1_FQ_MSK (0x40)
194#define INT_PRIORITY_P1_FQ_OFST (6)
195
196#define INT_PRIORITY_P2(base_addr) (INT_CTRL00_TYPE (base_addr + 0x88 ))
197#define INT_PRIORITY_P2_PRI_MSK (0x3F)
198#define INT_PRIORITY_P2_PRI_OFST (0)
199#define INT_PRIORITY_P2_FQ_MSK (0x40)
200#define INT_PRIORITY_P2_FQ_OFST (6)
201
202#define INT_PRIORITY_P3(base_addr) (INT_CTRL00_TYPE (base_addr + 0x8C ))
203#define INT_PRIORITY_P3_PRI_MSK (0x3F)
204#define INT_PRIORITY_P3_PRI_OFST (0)
205#define INT_PRIORITY_P3_FQ_MSK (0x40)
206#define INT_PRIORITY_P3_FQ_OFST (6)
207
208#define INT_PRIORITY_P4(base_addr) (INT_CTRL00_TYPE (base_addr + 0x90 ))
209#define INT_PRIORITY_P4_PRI_MSK (0x3F)
210#define INT_PRIORITY_P4_PRI_OFST (0)
211#define INT_PRIORITY_P4_FQ_MSK (0x40)
212#define INT_PRIORITY_P4_FQ_OFST (6)
213
214#define INT_PRIORITY_P5(base_addr) (INT_CTRL00_TYPE (base_addr + 0x94 ))
215#define INT_PRIORITY_P5_PRI_MSK (0x3F)
216#define INT_PRIORITY_P5_PRI_OFST (0)
217#define INT_PRIORITY_P5_FQ_MSK (0x40)
218#define INT_PRIORITY_P5_FQ_OFST (6)
219
220#define INT_PRIORITY_IP(base_addr) (INT_CTRL00_TYPE (base_addr + 0x94 ))
221#define INT_PRIORITY_IP_PRI_MSK (0x3F)
222#define INT_PRIORITY_IP_PRI_OFST (0)
223#define INT_PRIORITY_IP_FQ_MSK (0x40)
224#define INT_PRIORITY_IP_FQ_OFST (6)
225
226#define INT_PRIORITY_UA(base_addr) (INT_CTRL00_TYPE (base_addr + 0x9C ))
227#define INT_PRIORITY_UA_PRI_MSK (0x3F)
228#define INT_PRIORITY_UA_PRI_OFST (0)
229#define INT_PRIORITY_UA_FQ_MSK (0x40)
230#define INT_PRIORITY_UA_FQ_OFST (6)
231
232#define INT_PRIORITY_T0(base_addr) (INT_CTRL00_TYPE (base_addr + 0xA0 ))
233#define INT_PRIORITY_T0_PRI_MSK (0x3F)
234#define INT_PRIORITY_T0_PRI_OFST (0)
235#define INT_PRIORITY_T0_FQ_MSK (0x40)
236#define INT_PRIORITY_T0_FQ_OFST (6)
237
238#define INT_PRIORITY_T1(base_addr) (INT_CTRL00_TYPE (base_addr + 0xA4 ))
239#define INT_PRIORITY_T1_PRI_MSK (0x3F)
240#define INT_PRIORITY_T1_PRI_OFST (0)
241#define INT_PRIORITY_T1_FQ_MSK (0x40)
242#define INT_PRIORITY_T1_FQ_OFST (6)
243
244#define INT_PRIORITY_PS(base_addr) (INT_CTRL00_TYPE (base_addr + 0xA8 ))
245#define INT_PRIORITY_PS_PRI_MSK (0x3F)
246#define INT_PRIORITY_PS_PRI_OFST (0)
247#define INT_PRIORITY_PS_FQ_MSK (0x40)
248#define INT_PRIORITY_PS_FQ_OFST (6)
249
250#define INT_PRIORITY_EE(base_addr) (INT_CTRL00_TYPE (base_addr + 0xAC ))
251#define INT_PRIORITY_EE_PRI_MSK (0x3F)
252#define INT_PRIORITY_EE_PRI_OFST (0)
253#define INT_PRIORITY_EE_FQ_MSK (0x40)
254#define INT_PRIORITY_EE_FQ_OFST (6)
255
256#define INT_PRIORITY_PE(base_addr) (INT_CTRL00_TYPE (base_addr + 0xB0 ))
257#define INT_PRIORITY_PE_PRI_MSK (0x3F)
258#define INT_PRIORITY_PE_PRI_OFST (0)
259#define INT_PRIORITY_PE_FQ_MSK (0x40)
260#define INT_PRIORITY_PE_FQ_OFST (6)
261
262#define INT_PRIORITY_AE(base_addr) (INT_CTRL00_TYPE (base_addr + 0xB4 ))
263#define INT_PRIORITY_AE_PRI_MSK (0x3F)
264#define INT_PRIORITY_AE_PRI_OFST (0)
265#define INT_PRIORITY_AE_FQ_MSK (0x40)
266#define INT_PRIORITY_AE_FQ_OFST (6)
267
268#define INT_PRIORITY_M0(base_addr) (INT_CTRL00_TYPE (base_addr + 0xB8 ))
269#define INT_PRIORITY_M0_PRI_MSK (0x3F)
270#define INT_PRIORITY_M0_PRI_OFST (0)
271#define INT_PRIORITY_M0_FQ_MSK (0x40)
272#define INT_PRIORITY_M0_FQ_OFST (6)
273
274#define INT_PRIORITY_M1(base_addr) (INT_CTRL00_TYPE (base_addr + 0xBC ))
275#define INT_PRIORITY_M1_PRI_MSK (0x3F)
276#define INT_PRIORITY_M1_PRI_OFST (0)
277#define INT_PRIORITY_M1_FQ_MSK (0x40)
278#define INT_PRIORITY_M1_FQ_OFST (6)
279
280#define INT_PRIORITY_FC(base_addr) (INT_CTRL00_TYPE (base_addr + 0xC0 ))
281#define INT_PRIORITY_FC_PRI_MSK (0x3F)
282#define INT_PRIORITY_FC_PRI_OFST (0)
283#define INT_PRIORITY_FC_FQ_MSK (0x40)
284#define INT_PRIORITY_FC_FQ_OFST (6)
285
286#endif /* __INT_CTRL00_H */
287
288
diff --git a/include/asm-arm/arch-epxa10db/io.h b/include/asm-arm/arch-epxa10db/io.h
deleted file mode 100644
index 9fe100c9d6be..000000000000
--- a/include/asm-arm/arch-epxa10db/io.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-epxa10db/io.h
3 *
4 * Copyright (C) 1999 ARM Limited
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#include <asm/hardware.h>
24
25#define IO_SPACE_LIMIT 0xffff
26
27
28/*
29 * Generic virtual read/write
30 */
31/*#define outsw __arch_writesw
32#define outsl __arch_writesl
33#define outsb __arch_writesb
34#define insb __arch_readsb
35#define insw __arch_readsw
36#define insl __arch_readsl*/
37
38#define __io(a) ((void __iomem *)(a))
39#define __mem_pci(a) (a)
40
41#endif
diff --git a/include/asm-arm/arch-epxa10db/irqs.h b/include/asm-arm/arch-epxa10db/irqs.h
deleted file mode 100644
index c3758a3b5d9d..000000000000
--- a/include/asm-arm/arch-epxa10db/irqs.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-camelot/irqs.h
3 *
4 * Copyright (C) 2001 Altera 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/* Use the Excalibur chip definitions */
22#define INT_CTRL00_TYPE
23#include "asm/arch/int_ctrl00.h"
24
25
26#define IRQ_PLD0 INT_MS_P0_OFST
27#define IRQ_PLD1 INT_MS_P1_OFST
28#define IRQ_PLD2 INT_MS_P2_OFST
29#define IRQ_PLD3 INT_MS_P3_OFST
30#define IRQ_PLD4 INT_MS_P4_OFST
31#define IRQ_PLD5 INT_MS_P5_OFST
32#define IRQ_EXT INT_MS_IP_OFST
33#define IRQ_UART INT_MS_UA_OFST
34#define IRQ_TIMER0 INT_MS_T0_OFST
35#define IRQ_TIMER1 INT_MS_T1_OFST
36#define IRQ_PLL INT_MS_PLL_OFST
37#define IRQ_EBI INT_MS_EBI_OFST
38#define IRQ_STRIPE_BRIDGE INT_MS_PLL_OFST
39#define IRQ_AHB_BRIDGE INT_MS_PLL_OFST
40#define IRQ_COMMRX INT_MS_CR_OFST
41#define IRQ_COMMTX INT_MS_CT_OFST
42#define IRQ_FAST_COMM INT_MS_FC_OFST
43
44#define NR_IRQS (INT_MS_FC_OFST + 1)
45
diff --git a/include/asm-arm/arch-epxa10db/mode_ctrl00.h b/include/asm-arm/arch-epxa10db/mode_ctrl00.h
deleted file mode 100644
index d8a7efa12e19..000000000000
--- a/include/asm-arm/arch-epxa10db/mode_ctrl00.h
+++ /dev/null
@@ -1,80 +0,0 @@
1#ifndef __MODE_CTRL00_H
2#define __MODE_CTRL00_H
3
4/*
5 * Register definitions for the reset and mode control
6 */
7
8/*
9 * Copyright (C) 2001 Altera Corporation
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26
27
28#define BOOT_CR(BASE_ADDR) (MODE_CTRL00_TYPE (BASE_ADDR ))
29#define BOOT_CR_BF_MSK (0x1)
30#define BOOT_CR_BF_OFST (0)
31#define BOOT_CR_HM_MSK (0x2)
32#define BOOT_CR_HM_OFST (1)
33#define BOOT_CR_RE_MSK (0x4)
34#define BOOT_CR_RE_OFST (2)
35
36#define RESET_SR(BASE_ADDR) (MODE_CTRL00_TYPE (BASE_ADDR + 0x4 ))
37#define RESET_SR_WR_MSK (0x1)
38#define RESET_SR_WR_OFST (0)
39#define RESET_SR_CR_MSK (0x2)
40#define RESET_SR_CR_OFST (1)
41#define RESET_SR_JT_MSK (0x4)
42#define RESET_SR_JT_OFST (2)
43#define RESET_SR_ER_MSK (0x8)
44#define RESET_SR_ER_OFST (3)
45
46#define ID_CODE(BASE_ADDR) (MODE_CTRL00_TYPE (BASE_ADDR + 0x08 ))
47
48#define SRAM0_SR(BASE_ADDR) (MODE_CTRL00_TYPE (BASE_ADDR + 0x20 ))
49#define SRAM0_SR_SIZE_MSK (0xFFFFF000)
50#define SRAM0_SR_SIZE_OFST (12)
51
52#define SRAM1_SR(BASE_ADDR) (MODE_CTRL00_TYPE (BASE_ADDR + 0x24 ))
53#define SRAM1_SR_SIZE_MSK (0xFFFFF000)
54#define SRAM1_SR_SIZE_OFST (12)
55
56#define DPSRAM0_SR(BASE_ADDR) (MODE_CTRL00_TYPE (BASE_ADDR + 0x30 ))
57
58#define DPSRAM0_SR_MODE_MSK (0xF)
59#define DPSRAM0_SR_MODE_OFST (0)
60#define DPSRAM0_SR_GLBL_MSK (0x30)
61#define DPSRAM0_SR_SIZE_MSK (0xFFFFF000)
62#define DPSRAM0_SR_SIZE_OFST (12)
63
64#define DPSRAM0_LCR(BASE_ADDR) (MODE_CTRL00_TYPE (BASE_ADDR + 0x34 ))
65#define DPSRAM0_LCR_LCKADDR_MSK (0x1FFE0)
66#define DPSRAM0_LCR_LCKADDR_OFST (4)
67
68#define DPSRAM1_SR(BASE_ADDR) (MODE_CTRL00_TYPE (BASE_ADDR + 0x38 ))
69#define DPSRAM1_SR_MODE_MSK (0xF)
70#define DPSRAM1_SR_MODE_OFST (0)
71#define DPSRAM1_SR_GLBL_MSK (0x30)
72#define DPSRAM1_SR_GLBL_OFST (4)
73#define DPSRAM1_SR_SIZE_MSK (0xFFFFF000)
74#define DPSRAM1_SR_SIZE_OFST (12)
75
76#define DPSRAM1_LCR(BASE_ADDR) (MODE_CTRL00_TYPE (BASE_ADDR + 0x3C ))
77#define DPSRAM1_LCR_LCKADDR_MSK (0x1FFE0)
78#define DPSRAM1_LCR_LCKADDR_OFST (4)
79
80#endif /* __MODE_CTRL00_H */
diff --git a/include/asm-arm/arch-epxa10db/platform.h b/include/asm-arm/arch-epxa10db/platform.h
deleted file mode 100644
index 129bb0f212a0..000000000000
--- a/include/asm-arm/arch-epxa10db/platform.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef PLATFORM_H
2#define PLATFORM_H
3#include "excalibur.h"
4
5#define MAXIRQNUM 15
6#endif
7
diff --git a/include/asm-arm/arch-epxa10db/pld_conf00.h b/include/asm-arm/arch-epxa10db/pld_conf00.h
deleted file mode 100644
index 7af2c38dacc6..000000000000
--- a/include/asm-arm/arch-epxa10db/pld_conf00.h
+++ /dev/null
@@ -1,73 +0,0 @@
1#ifndef __PLD_CONF00_H
2#define __PLD_CONF00_H
3
4/*
5 * Register definitions for the PLD Configuration Logic
6 */
7
8/*
9 *
10 * This file contains the register definitions for the Excalibur
11 * Interrupt controller INT_CTRL00.
12 *
13 * Copyright (C) 2001 Altera Corporation
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 */
29
30#define CONFIG_CONTROL(BASE_ADDR) (PLD_CONF00_TYPE (BASE_ADDR))
31#define CONFIG_CONTROL_LK_MSK (0x1)
32#define CONFIG_CONTROL_LK_OFST (0)
33#define CONFIG_CONTROL_CO_MSK (0x2)
34#define CONFIG_CONTROL_CO_OFST (1)
35#define CONFIG_CONTROL_B_MSK (0x4)
36#define CONFIG_CONTROL_B_OFST (2)
37#define CONFIG_CONTROL_PC_MSK (0x8)
38#define CONFIG_CONTROL_PC_OFST (3)
39#define CONFIG_CONTROL_E_MSK (0x10)
40#define CONFIG_CONTROL_E_OFST (4)
41#define CONFIG_CONTROL_ES_MSK (0xE0)
42#define CONFIG_CONTROL_ES_OFST (5)
43#define CONFIG_CONTROL_ES_0_MSK (0x20)
44#define CONFIG_CONTROL_ES_1_MSK (0x40)
45#define CONFIG_CONTROL_ES_2_MSK (0x80)
46
47#define CONFIG_CONTROL_CLOCK(BASE_ADDR) (PLD_CONF00_TYPE (BASE_ADDR + 0x4 ))
48#define CONFIG_CONTROL_CLOCK_RATIO_MSK (0xFFFF)
49#define CONFIG_CONTROL_CLOCK_RATIO_OFST (0)
50
51#define CONFIG_CONTROL_DATA(BASE_ADDR) (PLD_CONF00_TYPE (BASE_ADDR + 0x8 ))
52#define CONFIG_CONTROL_DATA_MSK (0xFFFFFFFF)
53#define CONFIG_CONTROL_DATA_OFST (0)
54
55#define CONFIG_UNLOCK(BASE_ADDR) (PLD_CONF00_TYPE (BASE_ADDR + 0xC ))
56#define CONFIG_UNLOCK_MSK (0xFFFFFFFF)
57#define CONFIG_UNLOCK_OFST (0)
58
59#define CONFIG_UNLOCK_MAGIC (0x554E4C4B)
60
61#endif /* __PLD_CONF00_H */
62
63
64
65
66
67
68
69
70
71
72
73
diff --git a/include/asm-arm/arch-epxa10db/tdkphy.h b/include/asm-arm/arch-epxa10db/tdkphy.h
deleted file mode 100644
index 5e107bd4e109..000000000000
--- a/include/asm-arm/arch-epxa10db/tdkphy.h
+++ /dev/null
@@ -1,209 +0,0 @@
1/*
2 * linux/drivers/tdkphy.h
3 *
4 * Copyright (C) 2001 Altera 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __TDKPHY_H
22#define __TDKPHY_H
23
24/*
25 * Register definitions for the TDK 78Q2120 PHY
26 * which is on the Camelot board
27 */
28
29/*
30 * Copyright (c) Altera Corporation 2000.
31 * All rights reserved.
32 */
33#define PHY_CONTROL (0)
34#define PHY_CONTROL_COLT_MSK (0x80)
35#define PHY_CONTROL_COLT_OFST (7)
36#define PHY_CONTROL_DUPLEX_MSK (0x100)
37#define PHY_CONTROL_DUPLEX_OFST (8)
38#define PHY_CONTROL_RANEG_MSK (0x200)
39#define PHY_CONTROL_RANEG_OFST (9)
40#define PHY_CONTROL_ISO_MSK (0x400)
41#define PHY_CONTROL_ISO_OFST (10)
42#define PHY_CONTROL_PWRDN_MSK (0x800)
43#define PHY_CONTROL_PWRDN_OFST (11)
44#define PHY_CONTROL_ANEGEN_MSK (0x1000)
45#define PHY_CONTROL_ANEGEN_OFST (12)
46#define PHY_CONTROL_SPEEDSL_MSK (0x2000)
47#define PHY_CONTROL_SPEEDSL_OFST (13)
48#define PHY_CONTROL_LOOPBK_MSK (0x4000)
49#define PHY_CONTROL_LOOPBK_OFST (14)
50#define PHY_CONTROL_RESET_MSK (0x8000)
51#define PHY_CONTROL_RESET_OFST (15)
52
53#define PHY_STATUS (1)
54#define PHY_STATUS_ETXD_MSK (0x1)
55#define PHY_STATUS_EXTD_OFST (0)
56#define PHY_STATUS_JAB_MSK (0x2)
57#define PHY_STATUS_JAB_OFST (1)
58#define PHY_STATUS_LINK_MSK (0x4)
59#define PHY_STATUS_LINK_OFST (2)
60#define PHY_STATUS_ANEGA_MSK (0x8)
61#define PHY_STATUS_ANEGA_OFST (3)
62#define PHY_STATUS_RFAULT_MSK (0x10)
63#define PHY_STATUS_RFAULT_OFST (4)
64#define PHY_STATUS_ANEGC_MSK (0x20)
65#define PHY_STATUS_ANEGC_OFST (5)
66#define PHY_STATUS_10T_H_MSK (0x800)
67#define PHY_STATUS_10T_H_OFST (11)
68#define PHY_STATUS_10T_F_MSK (0x1000)
69#define PHY_STATUS_10T_F_OFST (12)
70#define PHY_STATUS_100_X_H_MSK (0x2000)
71#define PHY_STATUS_100_X_H_OFST (13)
72#define PHY_STATUS_100_X_F_MSK (0x4000)
73#define PHY_STATUS_100_X_F_OFST (14)
74#define PHY_STATUS_100T4_MSK (0x8000)
75#define PHY_STATUS_100T4_OFST (15)
76
77#define PHY_ID1 (2)
78#define PHY_ID1_OUI_MSK (0xFFFF)
79#define PHY_ID1_OUI_OFST (0)
80
81#define PHY_ID2 (3)
82#define PHY_ID2_RN_MSK (0xF)
83#define PHY_ID2_RN_OFST (0)
84#define PHY_ID2_MN_MSK (0x3F0)
85#define PHY_ID2_MN_OFST (4)
86#define PHY_ID2_OUI_MSK (0xFC00)
87#define PHY_ID2_OUI_OFST (10)
88
89#define PHY_AUTO_NEG_ADVERTISEMENT (4)
90#define PHY_AUTO_NEG_ADVERTISEMENT_SELECTOR_MSK (0x1F)
91#define PHY_AUTO_NEG_ADVERTISEMENT_SELECTOR_OFST (0)
92#define PHY_AUTO_NEG_ADVERTISEMENT_A0_MSK (0x20)
93#define PHY_AUTO_NEG_ADVERTISEMENT_A0_OFST (5)
94#define PHY_AUTO_NEG_ADVERTISEMENT_A1_MSK (0x40)
95#define PHY_AUTO_NEG_ADVERTISEMENT_A1_OFST (6)
96#define PHY_AUTO_NEG_ADVERTISEMENT_A2_MSK (0x80)
97#define PHY_AUTO_NEG_ADVERTISEMENT_A2_OFST (7)
98#define PHY_AUTO_NEG_ADVERTISEMENT_A3_MSK (0x100)
99#define PHY_AUTO_NEG_ADVERTISEMENT_A3_OFST (8)
100#define PHY_AUTO_NEG_ADVERTISEMENT_A4_MSK (0x200)
101#define PHY_AUTO_NEG_ADVERTISEMENT_A4_OFST (9)
102#define PHY_AUTO_NEG_ADVERTISEMENT_TAF_MSK (0x1FE0)
103#define PHY_AUTO_NEG_ADVERTISEMENT_TAF_OFST (5)
104#define PHY_AUTO_NEG_ADVERTISEMENT_RF_MSK (0x2000)
105#define PHY_AUTO_NEG_ADVERTISEMENT_RF_OFST (13)
106#define PHY_AUTO_NEG_ADVERTISEMENT_RSVD_MSK (0x4000)
107#define PHY_AUTO_NEG_ADVERTISEMENT_RVSD_OFST (14)
108#define PHY_AUTO_NEG_ADVERTISEMENT_NP_MSK (0x8000)
109#define PHY_AUTO_NEG_ADVERTISEMENT_NP_OFST (15)
110
111#define PHY_AUTO_NEG_LINK_PARTNER (5)
112#define PHY_AUTO_NEG_LINK_PARTNER_S4_MSK (0x1F)
113#define PHY_AUTO_NEG_LINK_PARTNER_S4_OFST (0)
114#define PHY_AUTO_NEG_LINK_PARTNER_A7_MSK (0x1FE0)
115#define PHY_AUTO_NEG_LINK_PARTNER_A7_OFST (5)
116#define PHY_AUTO_NEG_LINK_PARTNER_RF_MSK (0x2000)
117#define PHY_AUTO_NEG_LINK_PARTNER_RF_OFST (13)
118#define PHY_AUTO_NEG_LINK_PARTNER_ACK_MSK (0x4000)
119#define PHY_AUTO_NEG_LINK_PARTNER_ACK_OFST (14)
120#define PHY_AUTO_NEG_LINK_PARTNER_NP_MSK (0x8000)
121#define PHY_AUTO_NEG_LINK_PARTNER_NP_OFST (15)
122
123#define PHY_AUTO_NEG_EXPANSION (6)
124#define PHY_AUTO_NEG_EXPANSION_LPANEGA_MSK (0x1)
125#define PHY_AUTO_NEG_EXPANSION_LPANEGA_OFST (0)
126#define PHY_AUTO_NEG_EXPANSION_PRX_MSK (0x2)
127#define PHY_AUTO_NEG_EXPANSION_PRX_OFST (1)
128#define PHY_AUTO_NEG_EXPANSION_NPA_MSK (0x4)
129#define PHY_AUTO_NEG_EXPANSION_NPA_OFST (2)
130#define PHY_AUTO_NEG_EXPANSION_LPNPA_MSK (0x8)
131#define PHY_AUTO_NEG_EXPANSION_LPNPA_OFST (3)
132#define PHY_AUTO_NEG_EXPANSION_PDF_MSK (0x10)
133#define PHY_AUTO_NEG_EXPANSION_PDF_OFST (4)
134
135#define PHY_VENDOR_SPECIFIC (16)
136#define PHY_VENDOR_SPECIFIC_RXCC_MSK (0x1)
137#define PHY_VENDOR_SPECIFIC_RXCC_OFST (0)
138#define PHY_VENDOR_SPECIFIC_PCSBP_MSK (0x2)
139#define PHY_VENDOR_SPECIFIC_PCSBP_OFST (1)
140#define PHY_VENDOR_SPECIFIC_RVSPOL_MSK (0x10)
141#define PHY_VENDOR_SPECIFIC_RVSPOL_OFST (4)
142#define PHY_VENDOR_SPECIFIC_APOL_MSK (0x20)
143#define PHY_VENDOR_SPECIFIC_APOL_OFST (5)
144#define PHY_VENDOR_SPECIFIC_GPIO0_DIR_MSK (0x40)
145#define PHY_VENDOR_SPECIFIC_GPIO0_DIR_OFST (6)
146#define PHY_VENDOR_SPECIFIC_GPIO0_DAT_MSK (0x80)
147#define PHY_VENDOR_SPECIFIC_GPIO0_DAT_OFST (7)
148#define PHY_VENDOR_SPECIFIC_GPIO1_DIR_MSK (0x100)
149#define PHY_VENDOR_SPECIFIC_GPIO1_DIR_OFST (8)
150#define PHY_VENDOR_SPECIFIC_GPIO1_DAT_MSK (0x200)
151#define PHY_VENDOR_SPECIFIC_GPIO1_DAT_OFST (9)
152#define PHY_VENDOR_SPECIFIC_10BT_NATURAL_LOOPBACK_DAT_MSK (0x400)
153#define PHY_VENDOR_SPECIFIC_10BT_NATURAL_LOOPBACK_DAT_OFST (10)
154#define PHY_VENDOR_SPECIFIC_10BT_SQE_TEST_INHIBIT_MSK (0x800)
155#define PHY_VENDOR_SPECIFIC_10BT_SQE_TEST_INHIBIT_OFST (11)
156#define PHY_VENDOR_SPECIFIC_TXHIM_MSK (0x1000)
157#define PHY_VENDOR_SPECIFIC_TXHIM_OFST (12)
158#define PHY_VENDOR_SPECIFIC_INT_LEVEL_MSK (0x4000)
159#define PHY_VENDOR_SPECIFIC_INT_LEVEL_OFST (14)
160#define PHY_VENDOR_SPECIFIC_RPTR_MSK (0x8000)
161#define PHY_VENDOR_SPECIFIC_RPTR_OFST (15)
162
163#define PHY_IRQ_CONTROL (17)
164#define PHY_IRQ_CONTROL_ANEG_COMP_INT_MSK (0x1)
165#define PHY_IRQ_CONTROL_ANEG_COMP_INT_OFST (0)
166#define PHY_IRQ_CONTROL_RFAULT_INT_MSK (0x2)
167#define PHY_IRQ_CONTROL_RFAULT_INT_OFST (1)
168#define PHY_IRQ_CONTROL_LS_CHG_INT_MSK (0x4)
169#define PHY_IRQ_CONTROL_LS_CHG_INT_OFST (2)
170#define PHY_IRQ_CONTROL_LP_ACK_INT_MSK (0x8)
171#define PHY_IRQ_CONTROL_LP_ACK_INT_OFST (3)
172#define PHY_IRQ_CONTROL_PDF_INT_MSK (0x10)
173#define PHY_IRQ_CONTROL_PDF_INT_OFST (4)
174#define PHY_IRQ_CONTROL_PRX_INT_MSK (0x20)
175#define PHY_IRQ_CONTROL_PRX_INT_OFST (5)
176#define PHY_IRQ_CONTROL_RXER_INT_MSK (0x40)
177#define PHY_IRQ_CONTROL_RXER_INT_OFST (6)
178#define PHY_IRQ_CONTROL_JABBER_INT_MSK (0x80)
179#define PHY_IRQ_CONTROL_JABBER_INT_OFST (7)
180#define PHY_IRQ_CONTROL_ANEG_COMP_IE_MSK (0x100)
181#define PHY_IRQ_CONTROL_ANEG_COMP_IE_OFST (8)
182#define PHY_IRQ_CONTROL_RFAULT_IE_MSK (0x200)
183#define PHY_IRQ_CONTROL_RFAULT_IE_OFST (9)
184#define PHY_IRQ_CONTROL_LS_CHG_IE_MSK (0x400)
185#define PHY_IRQ_CONTROL_LS_CHG_IE_OFST (10)
186#define PHY_IRQ_CONTROL_LP_ACK_IE_MSK (0x800)
187#define PHY_IRQ_CONTROL_LP_ACK_IE_OFST (11)
188#define PHY_IRQ_CONTROL_PDF_IE_MSK (0x1000)
189#define PHY_IRQ_CONTROL_PDF_IE_OFST (12)
190#define PHY_IRQ_CONTROL_PRX_IE_MSK (0x2000)
191#define PHY_IRQ_CONTROL_PRX_IE_OFST (13)
192#define PHY_IRQ_CONTROL_RXER_IE_MSK (0x4000)
193#define PHY_IRQ_CONTROL_RXER_IE_OFST (14)
194#define PHY_IRQ_CONTROL_JABBER_IE_MSK (0x8000)
195#define PHY_IRQ_CONTROL_JABBER_IE_OFST (15)
196
197#define PHY_DIAGNOSTIC (18)
198#define PHY_DIAGNOSTIC_RX_LOCK_MSK (0x100)
199#define PHY_DIAGNOSTIC_RX_LOCK_OFST (8)
200#define PHY_DIAGNOSTIC_RX_PASS_MSK (0x200)
201#define PHY_DIAGNOSTIC_RX_PASS_OFST (9)
202#define PHY_DIAGNOSTIC_RATE_MSK (0x400)
203#define PHY_DIAGNOSTIC_RATE_OFST (10)
204#define PHY_DIAGNOSTIC_DPLX_MSK (0x800)
205#define PHY_DIAGNOSTIC_DPLX_OFST (11)
206#define PHY_DIAGNOSTIC_ANEGF_MSK (0x1000)
207#define PHY_DIAGNOSTIC_ANEGF_OFST (12)
208
209#endif /* __TDKPHY_H */
diff --git a/include/asm-arm/arch-epxa10db/timer00.h b/include/asm-arm/arch-epxa10db/timer00.h
deleted file mode 100644
index 52a3fb58b59d..000000000000
--- a/include/asm-arm/arch-epxa10db/timer00.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/*
2 *
3 * This file contains the register definitions for the Excalibur
4 * Timer TIMER00.
5 *
6 * Copyright (C) 2001 Altera Corporation
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 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef __TIMER00_H
23#define __TIMER00_H
24
25/*
26 * Register definitions for the timers
27 */
28
29
30#define TIMER0_CR(BASE_ADDR) (TIMER00_TYPE (BASE_ADDR + 0x00 ))
31#define TIMER0_CR_B_MSK (0x20)
32#define TIMER0_CR_B_OFST (0x5)
33#define TIMER0_CR_S_MSK (0x10)
34#define TIMER0_CR_S_OFST (0x4)
35#define TIMER0_CR_CI_MSK (0x08)
36#define TIMER0_CR_CI_OFST (0x3)
37#define TIMER0_CR_IE_MSK (0x04)
38#define TIMER0_CR_IE_OFST (0x2)
39#define TIMER0_CR_MODE_MSK (0x3)
40#define TIMER0_CR_MODE_OFST (0)
41#define TIMER0_CR_MODE_FREE (0)
42#define TIMER0_CR_MODE_ONE (1)
43#define TIMER0_CR_MODE_INTVL (2)
44
45#define TIMER0_SR(BASE_ADDR) (TIMER00_TYPE (BASE_ADDR + 0x00 ))
46#define TIMER0_SR_B_MSK (0x20)
47#define TIMER0_SR_B_OFST (0x5)
48#define TIMER0_SR_S_MSK (0x10)
49#define TIMER0_SR_S_OFST (0x4)
50#define TIMER0_SR_CI_MSK (0x08)
51#define TIMER0_SR_CI_OFST (0x3)
52#define TIMER0_SR_IE_MSK (0x04)
53#define TIMER0_SR_IE_OFST (0x2)
54#define TIMER0_SR_MODE_MSK (0x3)
55#define TIMER0_SR_MODE_OFST (0)
56#define TIMER0_SR_MODE_FREE (0)
57#define TIMER0_SR_MODE_ONE (1)
58#define TIMER0_SR_MODE_INTVL (2)
59
60#define TIMER0_PRESCALE(BASE_ADDR) (TIMER00_TYPE (BASE_ADDR + 0x010 ))
61#define TIMER0_LIMIT(BASE_ADDR) (TIMER00_TYPE (BASE_ADDR + 0x020 ))
62#define TIMER0_READ(BASE_ADDR) (TIMER00_TYPE (BASE_ADDR + 0x030 ))
63
64#define TIMER1_CR(BASE_ADDR) (TIMER00_TYPE (BASE_ADDR + 0x40 ))
65#define TIMER1_CR_B_MSK (0x20)
66#define TIMER1_CR_B_OFST (0x5)
67#define TIMER1_CR_S_MSK (0x10)
68#define TIMER1_CR_S_OFST (0x4)
69#define TIMER1_CR_CI_MSK (0x08)
70#define TIMER1_CR_CI_OFST (0x3)
71#define TIMER1_CR_IE_MSK (0x04)
72#define TIMER1_CR_IE_OFST (0x2)
73#define TIMER1_CR_MODE_MSK (0x3)
74#define TIMER1_CR_MODE_OFST (0)
75#define TIMER1_CR_MODE_FREE (0)
76#define TIMER1_CR_MODE_ONE (1)
77#define TIMER1_CR_MODE_INTVL (2)
78
79#define TIMER1_SR(BASE_ADDR) (TIMER00_TYPE (BASE_ADDR + 0x40 ))
80#define TIMER1_SR_B_MSK (0x20)
81#define TIMER1_SR_B_OFST (0x5)
82#define TIMER1_SR_S_MSK (0x10)
83#define TIMER1_SR_S_OFST (0x4)
84#define TIMER1_SR_CI_MSK (0x08)
85#define TIMER1_SR_CI_OFST (0x3)
86#define TIMER1_SR_IE_MSK (0x04)
87#define TIMER1_SR_IE_OFST (0x2)
88#define TIMER1_SR_MODE_MSK (0x3)
89#define TIMER1_SR_MODE_OFST (0)
90#define TIMER1_SR_MODE_FREE (0)
91#define TIMER1_SR_MODE_ONE (1)
92#define TIMER1_SR_MODE_INTVL (2)
93
94#define TIMER1_PRESCALE(BASE_ADDR) (TIMER00_TYPE (BASE_ADDR + 0x050 ))
95#define TIMER1_LIMIT(BASE_ADDR) (TIMER00_TYPE (BASE_ADDR + 0x060 ))
96#define TIMER1_READ(BASE_ADDR) (TIMER00_TYPE (BASE_ADDR + 0x070 ))
97
98#endif /* __TIMER00_H */
diff --git a/include/asm-arm/arch-epxa10db/uart00.h b/include/asm-arm/arch-epxa10db/uart00.h
deleted file mode 100644
index 5abd8914d68b..000000000000
--- a/include/asm-arm/arch-epxa10db/uart00.h
+++ /dev/null
@@ -1,181 +0,0 @@
1/* *
2 * Copyright (C) 2001 Altera Corporation
3 *
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
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef __UART00_H
19#define __UART00_H
20
21/*
22 * Register definitions for the UART
23 */
24
25#define UART_TX_FIFO_SIZE (15)
26
27#define UART_RSR(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x00 ))
28#define UART_RSR_RX_LEVEL_MSK (0x1f)
29#define UART_RSR_RX_LEVEL_OFST (0)
30#define UART_RSR_RE_MSK (0x80)
31#define UART_RSR_RE_OFST (7)
32
33#define UART_RDS(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x04 ))
34#define UART_RDS_BI_MSK (0x8)
35#define UART_RDS_BI_OFST (4)
36#define UART_RDS_FE_MSK (0x4)
37#define UART_RDS_FE_OFST (2)
38#define UART_RDS_PE_MSK (0x2)
39#define UART_RDS_PE_OFST (1)
40#define UART_RDS_OE_MSK (0x1)
41#define UART_RDS_OE_OFST (0)
42
43#define UART_RD(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x08 ))
44#define UART_RD_RX_DATA_MSK (0xff)
45#define UART_RD_RX_DATA_OFST (0)
46
47#define UART_TSR(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x0c ))
48#define UART_TSR_TX_LEVEL_MSK (0x1f)
49#define UART_TSR_TX_LEVEL_OFST (0)
50#define UART_TSR_TXI_MSK (0x80)
51#define UART_TSR_TXI_OFST (7)
52
53#define UART_TD(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x10 ))
54#define UART_TD_TX_DATA_MSK (0xff)
55#define UART_TD_TX_DATA_OFST (0)
56
57#define UART_FCR(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x14 ))
58#define UART_FCR_RX_THR_MSK (0xd0)
59#define UART_FCR_RX_THR_OFST (5)
60#define UART_FCR_RX_THR_1 (0x00)
61#define UART_FCR_RX_THR_2 (0x20)
62#define UART_FCR_RX_THR_4 (0x40)
63#define UART_FCR_RX_THR_6 (0x60)
64#define UART_FCR_RX_THR_8 (0x80)
65#define UART_FCR_RX_THR_10 (0xa0)
66#define UART_FCR_RX_THR_12 (0xc0)
67#define UART_FCR_RX_THR_14 (0xd0)
68#define UART_FCR_TX_THR_MSK (0x1c)
69#define UART_FCR_TX_THR_OFST (2)
70#define UART_FCR_TX_THR_0 (0x00)
71#define UART_FCR_TX_THR_2 (0x04)
72#define UART_FCR_TX_THR_4 (0x08)
73#define UART_FCR_TX_THR_8 (0x0c)
74#define UART_FCR_TX_THR_10 (0x10)
75#define UART_FCR_TX_THR_12 (0x14)
76#define UART_FCR_TX_THR_14 (0x18)
77#define UART_FCR_TX_THR_15 (0x1c)
78#define UART_FCR_RC_MSK (0x02)
79#define UART_FCR_RC_OFST (1)
80#define UART_FCR_TC_MSK (0x01)
81#define UART_FCR_TC_OFST (0)
82
83#define UART_IES(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x18 ))
84#define UART_IES_ME_MSK (0x8)
85#define UART_IES_ME_OFST (3)
86#define UART_IES_TIE_MSK (0x4)
87#define UART_IES_TIE_OFST (2)
88#define UART_IES_TE_MSK (0x2)
89#define UART_IES_TE_OFST (1)
90#define UART_IES_RE_MSK (0x1)
91#define UART_IES_RE_OFST (0)
92
93#define UART_IEC(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x1c ))
94#define UART_IEC_ME_MSK (0x8)
95#define UART_IEC_ME_OFST (3)
96#define UART_IEC_TIE_MSK (0x4)
97#define UART_IEC_TIE_OFST (2)
98#define UART_IEC_TE_MSK (0x2)
99#define UART_IEC_TE_OFST (1)
100#define UART_IEC_RE_MSK (0x1)
101#define UART_IEC_RE_OFST (0)
102
103#define UART_ISR(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x20 ))
104#define UART_ISR_MI_MSK (0x8)
105#define UART_ISR_MI_OFST (3)
106#define UART_ISR_TII_MSK (0x4)
107#define UART_ISR_TII_OFST (2)
108#define UART_ISR_TI_MSK (0x2)
109#define UART_ISR_TI_OFST (1)
110#define UART_ISR_RI_MSK (0x1)
111#define UART_ISR_RI_OFST (0)
112
113#define UART_IID(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x24 ))
114#define UART_IID_IID_MSK (0x7)
115#define UART_IID_IID_OFST (0)
116
117#define UART_MC(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x28 ))
118#define UART_MC_OE_MSK (0x40)
119#define UART_MC_OE_OFST (6)
120#define UART_MC_SP_MSK (0x20)
121#define UART_MC_SP_OFST (5)
122#define UART_MC_EP_MSK (0x10)
123#define UART_MC_EP_OFST (4)
124#define UART_MC_PE_MSK (0x08)
125#define UART_MC_PE_OFST (3)
126#define UART_MC_ST_MSK (0x04)
127#define UART_MC_ST_ONE (0x0)
128#define UART_MC_ST_TWO (0x04)
129#define UART_MC_ST_OFST (2)
130#define UART_MC_CLS_MSK (0x03)
131#define UART_MC_CLS_OFST (0)
132#define UART_MC_CLS_CHARLEN_5 (0)
133#define UART_MC_CLS_CHARLEN_6 (1)
134#define UART_MC_CLS_CHARLEN_7 (2)
135#define UART_MC_CLS_CHARLEN_8 (3)
136
137#define UART_MCR(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x2c ))
138#define UART_MCR_AC_MSK (0x80)
139#define UART_MCR_AC_OFST (7)
140#define UART_MCR_AR_MSK (0x40)
141#define UART_MCR_AR_OFST (6)
142#define UART_MCR_BR_MSK (0x20)
143#define UART_MCR_BR_OFST (5)
144#define UART_MCR_LB_MSK (0x10)
145#define UART_MCR_LB_OFST (4)
146#define UART_MCR_DCD_MSK (0x08)
147#define UART_MCR_DCD_OFST (3)
148#define UART_MCR_RI_MSK (0x04)
149#define UART_MCR_RI_OFST (2)
150#define UART_MCR_DTR_MSK (0x02)
151#define UART_MCR_DTR_OFST (1)
152#define UART_MCR_RTS_MSK (0x01)
153#define UART_MCR_RTS_OFST (0)
154
155#define UART_MSR(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x30 ))
156#define UART_MSR_DCD_MSK (0x80)
157#define UART_MSR_DCD_OFST (7)
158#define UART_MSR_RI_MSK (0x40)
159#define UART_MSR_RI_OFST (6)
160#define UART_MSR_DSR_MSK (0x20)
161#define UART_MSR_DSR_OFST (5)
162#define UART_MSR_CTS_MSK (0x10)
163#define UART_MSR_CTS_OFST (4)
164#define UART_MSR_DDCD_MSK (0x08)
165#define UART_MSR_DDCD_OFST (3)
166#define UART_MSR_TERI_MSK (0x04)
167#define UART_MSR_TERI_OFST (2)
168#define UART_MSR_DDSR_MSK (0x02)
169#define UART_MSR_DDSR_OFST (1)
170#define UART_MSR_DCTS_MSK (0x01)
171#define UART_MSR_DCTS_OFST (0)
172
173#define UART_DIV_LO(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x34 ))
174#define UART_DIV_LO_DIV_MSK (0xff)
175#define UART_DIV_LO_DIV_OFST (0)
176
177#define UART_DIV_HI(BASE_ADDR) (UART00_TYPE (BASE_ADDR + 0x38 ))
178#define UART_DIV_HI_DIV_MSK (0xff)
179#define UART_DIV_HI_DIV_OFST (0)
180
181#endif /* __UART00_H */
diff --git a/include/asm-arm/arch-epxa10db/uncompress.h b/include/asm-arm/arch-epxa10db/uncompress.h
deleted file mode 100644
index fdfe0e6848f8..000000000000
--- a/include/asm-arm/arch-epxa10db/uncompress.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-epxa10db/uncompress.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2001 Altera Corporation
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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include "asm/arch/platform.h"
22#include "asm/hardware.h"
23#define UART00_TYPE (volatile unsigned int*)
24#include "asm/arch/uart00.h"
25
26/*
27 * This does not append a newline
28 */
29static void putstr(const char *s)
30{
31 while (*s) {
32 while ((*UART_TSR(EXC_UART00_BASE) &
33 UART_TSR_TX_LEVEL_MSK)==15)
34 barrier();
35
36 *UART_TD(EXC_UART00_BASE) = *s;
37
38 if (*s == '\n') {
39 while ((*UART_TSR(EXC_UART00_BASE) &
40 UART_TSR_TX_LEVEL_MSK)==15)
41 barrier();
42
43 *UART_TD(EXC_UART00_BASE) = '\r';
44 }
45 s++;
46 }
47}
48
49/*
50 * nothing to do
51 */
52#define arch_decomp_setup()
53
54#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-imx/dma.h b/include/asm-arm/arch-imx/dma.h
index dbdc01780413..b45fa367d71e 100644
--- a/include/asm-arm/arch-imx/dma.h
+++ b/include/asm-arm/arch-imx/dma.h
@@ -20,10 +20,6 @@
20#ifndef __ASM_ARCH_DMA_H 20#ifndef __ASM_ARCH_DMA_H
21#define __ASM_ARCH_DMA_H 21#define __ASM_ARCH_DMA_H
22 22
23#define MAX_DMA_ADDRESS 0xffffffff
24
25#define MAX_DMA_CHANNELS 0
26
27/* 23/*
28 * DMA registration 24 * DMA registration
29 */ 25 */
diff --git a/include/asm-arm/arch-imx/entry-macro.S b/include/asm-arm/arch-imx/entry-macro.S
index b40ea7cf88ec..3b9ef6914627 100644
--- a/include/asm-arm/arch-imx/entry-macro.S
+++ b/include/asm-arm/arch-imx/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11
10 .macro disable_fiq 12 .macro disable_fiq
11 .endm 13 .endm
12#define AITC_NIVECSR 0x40 14#define AITC_NIVECSR 0x40
diff --git a/include/asm-arm/arch-integrator/debug-macro.S b/include/asm-arm/arch-integrator/debug-macro.S
index 484a1aa47098..031d30941791 100644
--- a/include/asm-arm/arch-integrator/debug-macro.S
+++ b/include/asm-arm/arch-integrator/debug-macro.S
@@ -11,7 +11,7 @@
11 * 11 *
12*/ 12*/
13 13
14#include <asm/hardware/amba_serial.h> 14#include <linux/amba/serial.h>
15 15
16 .macro addruart,rx 16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0 17 mrc p15, 0, \rx, c1, c0
diff --git a/include/asm-arm/arch-integrator/dma.h b/include/asm-arm/arch-integrator/dma.h
index 7171792290bd..83fd6bbaf9d3 100644
--- a/include/asm-arm/arch-integrator/dma.h
+++ b/include/asm-arm/arch-integrator/dma.h
@@ -17,12 +17,3 @@
17 * along with this program; if not, write to the Free Software 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 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#ifndef __ASM_ARCH_DMA_H
21#define __ASM_ARCH_DMA_H
22
23#define MAX_DMA_ADDRESS 0xffffffff
24
25#define MAX_DMA_CHANNELS 0
26
27#endif /* _ASM_ARCH_DMA_H */
28
diff --git a/include/asm-arm/arch-integrator/entry-macro.S b/include/asm-arm/arch-integrator/entry-macro.S
index 44f7ee613194..69838d04f90b 100644
--- a/include/asm-arm/arch-integrator/entry-macro.S
+++ b/include/asm-arm/arch-integrator/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11#include <asm/arch/irqs.h>
10 12
11 .macro disable_fiq 13 .macro disable_fiq
12 .endm 14 .endm
diff --git a/include/asm-arm/arch-iop3xx/dma.h b/include/asm-arm/arch-iop3xx/dma.h
index 797f9e6fc745..1e808db8af2a 100644
--- a/include/asm-arm/arch-iop3xx/dma.h
+++ b/include/asm-arm/arch-iop3xx/dma.h
@@ -7,10 +7,3 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10
11#ifndef _IOP3XX_DMA_H_P
12#define _IOP3XX_DMA_H_P
13
14#define MAX_DMA_ADDRESS 0xffffffff
15
16#endif /* _ASM_ARCH_DMA_H_P */
diff --git a/include/asm-arm/arch-iop3xx/entry-macro.S b/include/asm-arm/arch-iop3xx/entry-macro.S
index e2ce7f5467c8..926668c098a5 100644
--- a/include/asm-arm/arch-iop3xx/entry-macro.S
+++ b/include/asm-arm/arch-iop3xx/entry-macro.S
@@ -7,6 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/arch/irqs.h>
10 11
11#if defined(CONFIG_ARCH_IOP321) 12#if defined(CONFIG_ARCH_IOP321)
12 .macro disable_fiq 13 .macro disable_fiq
diff --git a/include/asm-arm/arch-ixp2000/dma.h b/include/asm-arm/arch-ixp2000/dma.h
index 0fb3568a98dd..548d8dc507eb 100644
--- a/include/asm-arm/arch-ixp2000/dma.h
+++ b/include/asm-arm/arch-ixp2000/dma.h
@@ -7,12 +7,3 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#ifndef __ASM_ARCH_DMA_H
11#define __ASM_ARCH_DMA_H
12
13#define MAX_DMA_ADDRESS 0xffffffff
14
15/* No DMA */
16#define MAX_DMA_CHANNELS 0
17
18#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-ixp2000/enp2611.h b/include/asm-arm/arch-ixp2000/enp2611.h
index 95128d9f5026..42f3c28dc5c4 100644
--- a/include/asm-arm/arch-ixp2000/enp2611.h
+++ b/include/asm-arm/arch-ixp2000/enp2611.h
@@ -36,5 +36,11 @@
36#define ENP2611_GPIO_SCL 7 36#define ENP2611_GPIO_SCL 7
37#define ENP2611_GPIO_SDA 6 37#define ENP2611_GPIO_SDA 6
38 38
39#define IRQ_ENP2611_THERMAL IRQ_IXP2000_GPIO4
40#define IRQ_ENP2611_OPTION_BOARD IRQ_IXP2000_GPIO3
41#define IRQ_ENP2611_CALEB IRQ_IXP2000_GPIO2
42#define IRQ_ENP2611_PM3386_1 IRQ_IXP2000_GPIO1
43#define IRQ_ENP2611_PM3386_0 IRQ_IXP2000_GPIO0
44
39 45
40#endif 46#endif
diff --git a/include/asm-arm/arch-ixp2000/entry-macro.S b/include/asm-arm/arch-ixp2000/entry-macro.S
index e3a4e4121298..16e1e6124b31 100644
--- a/include/asm-arm/arch-ixp2000/entry-macro.S
+++ b/include/asm-arm/arch-ixp2000/entry-macro.S
@@ -7,6 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/arch/irqs.h>
10 11
11 .macro disable_fiq 12 .macro disable_fiq
12 .endm 13 .endm
diff --git a/include/asm-arm/arch-ixp2000/io.h b/include/asm-arm/arch-ixp2000/io.h
index 7fbcdf9931ee..c0ff2c6c66e7 100644
--- a/include/asm-arm/arch-ixp2000/io.h
+++ b/include/asm-arm/arch-ixp2000/io.h
@@ -131,102 +131,4 @@
131#endif 131#endif
132 132
133 133
134#ifdef CONFIG_ARCH_IXDP2X01
135/*
136 * This is an ugly hack but the CS8900 on the 2x01's does not sit in any sort
137 * of "I/O space" and is just direct mapped into a 32-bit-only addressable
138 * bus. The address space for this bus is such that we can't really easily
139 * make it contiguous to the PCI I/O address range, and it also does not
140 * need swapping like PCI addresses do (IXDP2x01 is a BE platform).
141 * B/C of this we can't use the standard in/out functions and need to
142 * runtime check if the incoming address is a PCI address or for
143 * the CS89x0.
144 */
145#undef inw
146#undef outw
147#undef insw
148#undef outsw
149
150#include <asm/mach-types.h>
151
152static inline void insw(u32 ptr, void *buf, int length)
153{
154 register volatile u32 *port = (volatile u32 *)ptr;
155
156 /*
157 * Is this cycle meant for the CS8900?
158 */
159 if ((machine_is_ixdp2401() || machine_is_ixdp2801()) &&
160 (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) &&
161 ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) {
162 u8 *buf8 = (u8*)buf;
163 register u32 tmp32;
164
165 do {
166 tmp32 = *port;
167 *buf8++ = (u8)tmp32;
168 *buf8++ = (u8)(tmp32 >> 8);
169 } while(--length);
170
171 return;
172 }
173
174 __raw_readsw(alignw(___io(ptr)),buf,length);
175}
176
177static inline void outsw(u32 ptr, void *buf, int length)
178{
179 register volatile u32 *port = (volatile u32 *)ptr;
180
181 /*
182 * Is this cycle meant for the CS8900?
183 */
184 if ((machine_is_ixdp2401() || machine_is_ixdp2801()) &&
185 (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) &&
186 ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) {
187 register u32 tmp32;
188 u8 *buf8 = (u8*)buf;
189 do {
190 tmp32 = *buf8++;
191 tmp32 |= (*buf8++) << 8;
192 *port = tmp32;
193 } while(--length);
194 return;
195 }
196
197 __raw_writesw(alignw(___io(ptr)),buf,length);
198}
199
200
201static inline u16 inw(u32 ptr)
202{
203 register volatile u32 *port = (volatile u32 *)ptr;
204
205 /*
206 * Is this cycle meant for the CS8900?
207 */
208 if ((machine_is_ixdp2401() || machine_is_ixdp2801()) &&
209 (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) &&
210 ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) {
211 return (u16)(*port);
212 }
213
214 return __raw_readw(alignw(___io(ptr)));
215}
216
217static inline void outw(u16 value, u32 ptr)
218{
219 register volatile u32 *port = (volatile u32 *)ptr;
220
221 if ((machine_is_ixdp2401() || machine_is_ixdp2801()) &&
222 (((u32)port >= (u32)IXDP2X01_CS8900_VIRT_BASE) &&
223 ((u32)port <= (u32)IXDP2X01_CS8900_VIRT_END))) {
224 *port = value;
225 return;
226 }
227
228 __raw_writew((value),alignw(___io(ptr)));
229}
230#endif /* IXDP2x01 */
231
232#endif 134#endif
diff --git a/include/asm-arm/arch-ixp2000/ixp2000-regs.h b/include/asm-arm/arch-ixp2000/ixp2000-regs.h
index fc5ac6aec4f2..8cf70ff160af 100644
--- a/include/asm-arm/arch-ixp2000/ixp2000-regs.h
+++ b/include/asm-arm/arch-ixp2000/ixp2000-regs.h
@@ -156,6 +156,14 @@
156#define IXP2000_IRQ_THD_RAW_STATUS_B_1 IXP2000_INTCTL_REG(0x84) 156#define IXP2000_IRQ_THD_RAW_STATUS_B_1 IXP2000_INTCTL_REG(0x84)
157#define IXP2000_IRQ_THD_RAW_STATUS_B_2 IXP2000_INTCTL_REG(0x88) 157#define IXP2000_IRQ_THD_RAW_STATUS_B_2 IXP2000_INTCTL_REG(0x88)
158#define IXP2000_IRQ_THD_RAW_STATUS_B_3 IXP2000_INTCTL_REG(0x8c) 158#define IXP2000_IRQ_THD_RAW_STATUS_B_3 IXP2000_INTCTL_REG(0x8c)
159#define IXP2000_IRQ_THD_STATUS_A_0 IXP2000_INTCTL_REG(0xe0)
160#define IXP2000_IRQ_THD_STATUS_A_1 IXP2000_INTCTL_REG(0xe4)
161#define IXP2000_IRQ_THD_STATUS_A_2 IXP2000_INTCTL_REG(0xe8)
162#define IXP2000_IRQ_THD_STATUS_A_3 IXP2000_INTCTL_REG(0xec)
163#define IXP2000_IRQ_THD_STATUS_B_0 IXP2000_INTCTL_REG(0x100)
164#define IXP2000_IRQ_THD_STATUS_B_1 IXP2000_INTCTL_REG(0x104)
165#define IXP2000_IRQ_THD_STATUS_B_2 IXP2000_INTCTL_REG(0x108)
166#define IXP2000_IRQ_THD_STATUS_B_3 IXP2000_INTCTL_REG(0x10c)
159#define IXP2000_IRQ_THD_ENABLE_SET_A_0 IXP2000_INTCTL_REG(0x160) 167#define IXP2000_IRQ_THD_ENABLE_SET_A_0 IXP2000_INTCTL_REG(0x160)
160#define IXP2000_IRQ_THD_ENABLE_SET_A_1 IXP2000_INTCTL_REG(0x164) 168#define IXP2000_IRQ_THD_ENABLE_SET_A_1 IXP2000_INTCTL_REG(0x164)
161#define IXP2000_IRQ_THD_ENABLE_SET_A_2 IXP2000_INTCTL_REG(0x168) 169#define IXP2000_IRQ_THD_ENABLE_SET_A_2 IXP2000_INTCTL_REG(0x168)
diff --git a/include/asm-arm/arch-ixp4xx/coyote.h b/include/asm-arm/arch-ixp4xx/coyote.h
index dd0c2d2d8503..7ac9ba2c035c 100644
--- a/include/asm-arm/arch-ixp4xx/coyote.h
+++ b/include/asm-arm/arch-ixp4xx/coyote.h
@@ -16,9 +16,6 @@
16#error "Do not include this directly, instead #include <asm/hardware.h>" 16#error "Do not include this directly, instead #include <asm/hardware.h>"
17#endif 17#endif
18 18
19#define COYOTE_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
20#define COYOTE_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE * 2
21
22/* PCI controller GPIO to IRQ pin mappings */ 19/* PCI controller GPIO to IRQ pin mappings */
23#define COYOTE_PCI_SLOT0_PIN 6 20#define COYOTE_PCI_SLOT0_PIN 6
24#define COYOTE_PCI_SLOT1_PIN 11 21#define COYOTE_PCI_SLOT1_PIN 11
@@ -26,7 +23,7 @@
26#define COYOTE_PCI_SLOT0_DEVID 14 23#define COYOTE_PCI_SLOT0_DEVID 14
27#define COYOTE_PCI_SLOT1_DEVID 15 24#define COYOTE_PCI_SLOT1_DEVID 15
28 25
29#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_CS3_BASE_PHYS 26#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_BASE(3)
30#define COYOTE_IDE_BASE_VIRT 0xFFFE1000 27#define COYOTE_IDE_BASE_VIRT 0xFFFE1000
31#define COYOTE_IDE_REGION_SIZE 0x1000 28#define COYOTE_IDE_REGION_SIZE 0x1000
32 29
diff --git a/include/asm-arm/arch-ixp4xx/dma.h b/include/asm-arm/arch-ixp4xx/dma.h
index 312065dc0e7a..b1a071ecebc8 100644
--- a/include/asm-arm/arch-ixp4xx/dma.h
+++ b/include/asm-arm/arch-ixp4xx/dma.h
@@ -20,7 +20,4 @@
20 20
21#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M) 21#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M)
22 22
23/* No DMA */
24#define MAX_DMA_CHANNELS 0
25
26#endif /* _ASM_ARCH_DMA_H */ 23#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-ixp4xx/entry-macro.S b/include/asm-arm/arch-ixp4xx/entry-macro.S
index 323b0bc4a39c..27e124132e4c 100644
--- a/include/asm-arm/arch-ixp4xx/entry-macro.S
+++ b/include/asm-arm/arch-ixp4xx/entry-macro.S
@@ -7,6 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
10 11
11 .macro disable_fiq 12 .macro disable_fiq
12 .endm 13 .endm
diff --git a/include/asm-arm/arch-ixp4xx/gtwx5715.h b/include/asm-arm/arch-ixp4xx/gtwx5715.h
index fc460af70627..c3069d67c00e 100644
--- a/include/asm-arm/arch-ixp4xx/gtwx5715.h
+++ b/include/asm-arm/arch-ixp4xx/gtwx5715.h
@@ -57,10 +57,6 @@
57#define GTWX5715_GPIO13_IRQ IRQ_IXP4XX_SW_INT1 57#define GTWX5715_GPIO13_IRQ IRQ_IXP4XX_SW_INT1
58#define GTWX5715_GPIO14_IRQ IRQ_IXP4XX_SW_INT2 58#define GTWX5715_GPIO14_IRQ IRQ_IXP4XX_SW_INT2
59 59
60
61#define GTWX5715_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
62#define GTWX5715_FLASH_SIZE (0x00800000)
63
64/* PCI controller GPIO to IRQ pin mappings 60/* PCI controller GPIO to IRQ pin mappings
65 61
66 INTA INTB 62 INTA INTB
diff --git a/include/asm-arm/arch-ixp4xx/hardware.h b/include/asm-arm/arch-ixp4xx/hardware.h
index cfb413c845f7..6acb69c95ef9 100644
--- a/include/asm-arm/arch-ixp4xx/hardware.h
+++ b/include/asm-arm/arch-ixp4xx/hardware.h
@@ -45,5 +45,6 @@ extern unsigned int processor_id;
45#include "coyote.h" 45#include "coyote.h"
46#include "prpmc1100.h" 46#include "prpmc1100.h"
47#include "nslu2.h" 47#include "nslu2.h"
48#include "nas100d.h"
48 49
49#endif /* _ASM_ARCH_HARDWARE_H */ 50#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/include/asm-arm/arch-ixp4xx/irqs.h b/include/asm-arm/arch-ixp4xx/irqs.h
index 2cf4930372bc..f24b763ca18e 100644
--- a/include/asm-arm/arch-ixp4xx/irqs.h
+++ b/include/asm-arm/arch-ixp4xx/irqs.h
@@ -100,4 +100,13 @@
100#define IRQ_NSLU2_PCI_INTB IRQ_IXP4XX_GPIO10 100#define IRQ_NSLU2_PCI_INTB IRQ_IXP4XX_GPIO10
101#define IRQ_NSLU2_PCI_INTC IRQ_IXP4XX_GPIO9 101#define IRQ_NSLU2_PCI_INTC IRQ_IXP4XX_GPIO9
102 102
103/*
104 * NAS100D board IRQs
105 */
106#define IRQ_NAS100D_PCI_INTA IRQ_IXP4XX_GPIO11
107#define IRQ_NAS100D_PCI_INTB IRQ_IXP4XX_GPIO10
108#define IRQ_NAS100D_PCI_INTC IRQ_IXP4XX_GPIO9
109#define IRQ_NAS100D_PCI_INTD IRQ_IXP4XX_GPIO8
110#define IRQ_NAS100D_PCI_INTE IRQ_IXP4XX_GPIO7
111
103#endif 112#endif
diff --git a/include/asm-arm/arch-ixp4xx/ixdp425.h b/include/asm-arm/arch-ixp4xx/ixdp425.h
index 7d21bf941379..3d3820d7ba09 100644
--- a/include/asm-arm/arch-ixp4xx/ixdp425.h
+++ b/include/asm-arm/arch-ixp4xx/ixdp425.h
@@ -16,9 +16,6 @@
16#error "Do not include this directly, instead #include <asm/hardware.h>" 16#error "Do not include this directly, instead #include <asm/hardware.h>"
17#endif 17#endif
18 18
19#define IXDP425_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
20#define IXDP425_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE
21
22#define IXDP425_SDA_PIN 7 19#define IXDP425_SDA_PIN 7
23#define IXDP425_SCL_PIN 6 20#define IXDP425_SCL_PIN 6
24 21
diff --git a/include/asm-arm/arch-ixp4xx/memory.h b/include/asm-arm/arch-ixp4xx/memory.h
index e024d0a1a669..ee211d28a3ef 100644
--- a/include/asm-arm/arch-ixp4xx/memory.h
+++ b/include/asm-arm/arch-ixp4xx/memory.h
@@ -16,31 +16,10 @@
16 16
17#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
18 18
19/* 19void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes);
20 * Only first 64MB of memory can be accessed via PCI.
21 * We use GFP_DMA to allocate safe buffers to do map/unmap.
22 * This is really ugly and we need a better way of specifying
23 * DMA-capable regions of memory.
24 */
25static inline void __arch_adjust_zones(int node, unsigned long *zone_size,
26 unsigned long *zhole_size)
27{
28 unsigned int sz = SZ_64M >> PAGE_SHIFT;
29
30 /*
31 * Only adjust if > 64M on current system
32 */
33 if (node || (zone_size[0] <= sz))
34 return;
35
36 zone_size[1] = zone_size[0] - sz;
37 zone_size[0] = sz;
38 zhole_size[1] = zhole_size[0];
39 zhole_size[0] = 0;
40}
41 20
42#define arch_adjust_zones(node, size, holes) \ 21#define arch_adjust_zones(node, size, holes) \
43 __arch_adjust_zones(node, size, holes) 22 ixp4xx_adjust_zones(node, size, holes)
44 23
45#define ISA_DMA_THRESHOLD (SZ_64M - 1) 24#define ISA_DMA_THRESHOLD (SZ_64M - 1)
46 25
diff --git a/include/asm-arm/arch-ixp4xx/nas100d.h b/include/asm-arm/arch-ixp4xx/nas100d.h
new file mode 100644
index 000000000000..51ac0180427c
--- /dev/null
+++ b/include/asm-arm/arch-ixp4xx/nas100d.h
@@ -0,0 +1,72 @@
1/*
2 * include/asm-arm/arch-ixp4xx/nas100d.h
3 *
4 * NAS100D platform specific definitions
5 *
6 * Copyright (c) 2005 Tower Technologies
7 *
8 * Author: Alessandro Zummo <a.zummo@towertech.it>
9 *
10 * based on ixdp425.h:
11 * Copyright 2004 (c) MontaVista, Software, Inc.
12 *
13 * This file is licensed under the terms of the GNU General Public
14 * License version 2. This program is licensed "as is" without any
15 * warranty of any kind, whether express or implied.
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <asm/hardware.h>"
20#endif
21
22#define NAS100D_SDA_PIN 6
23#define NAS100D_SCL_PIN 5
24
25/*
26 * NAS100D PCI IRQs
27 */
28#define NAS100D_PCI_MAX_DEV 3
29#define NAS100D_PCI_IRQ_LINES 3
30
31
32/* PCI controller GPIO to IRQ pin mappings */
33#define NAS100D_PCI_INTA_PIN 11
34#define NAS100D_PCI_INTB_PIN 10
35#define NAS100D_PCI_INTC_PIN 9
36#define NAS100D_PCI_INTD_PIN 8
37#define NAS100D_PCI_INTE_PIN 7
38
39/* GPIO */
40
41#define NAS100D_GPIO0 0
42#define NAS100D_GPIO1 1
43#define NAS100D_GPIO2 2
44#define NAS100D_GPIO3 3
45#define NAS100D_GPIO4 4
46#define NAS100D_GPIO5 5
47#define NAS100D_GPIO6 6
48#define NAS100D_GPIO7 7
49#define NAS100D_GPIO8 8
50#define NAS100D_GPIO9 9
51#define NAS100D_GPIO10 10
52#define NAS100D_GPIO11 11
53#define NAS100D_GPIO12 12
54#define NAS100D_GPIO13 13
55#define NAS100D_GPIO14 14
56#define NAS100D_GPIO15 15
57
58
59/* Buttons */
60
61#define NAS100D_PB_GPIO NAS100D_GPIO14
62#define NAS100D_RB_GPIO NAS100D_GPIO4
63#define NAS100D_PO_GPIO NAS100D_GPIO12 /* power off */
64
65#define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO14
66#define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO4
67
68/*
69#define NAS100D_PB_BM (1L << NAS100D_PB_GPIO)
70#define NAS100D_PO_BM (1L << NAS100D_PO_GPIO)
71#define NAS100D_RB_BM (1L << NAS100D_RB_GPIO)
72*/
diff --git a/include/asm-arm/arch-ixp4xx/nslu2.h b/include/asm-arm/arch-ixp4xx/nslu2.h
index b8b347a559c7..4281838873ef 100644
--- a/include/asm-arm/arch-ixp4xx/nslu2.h
+++ b/include/asm-arm/arch-ixp4xx/nslu2.h
@@ -18,9 +18,6 @@
18#error "Do not include this directly, instead #include <asm/hardware.h>" 18#error "Do not include this directly, instead #include <asm/hardware.h>"
19#endif 19#endif
20 20
21#define NSLU2_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
22#define NSLU2_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE
23
24#define NSLU2_SDA_PIN 7 21#define NSLU2_SDA_PIN 7
25#define NSLU2_SCL_PIN 6 22#define NSLU2_SCL_PIN 6
26 23
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index f14ed63590c3..daf9790645ca 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -26,16 +26,17 @@
26 */ 26 */
27#define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000) 27#define IXP4XX_EXP_BUS_BASE_PHYS (0x50000000)
28 28
29#define IXP4XX_EXP_BUS_CSX_REGION_SIZE (0x01000000) 29/*
30 * The expansion bus on the IXP4xx can be configured for either 16 or
31 * 32MB windows and the CS offset for each region changes based on the
32 * current configuration. This means that we cannot simply hardcode
33 * each offset. ixp4xx_sys_init() looks at the expansion bus configuration
34 * as setup by the bootloader to determine our window size.
35 */
36extern unsigned long ixp4xx_exp_bus_size;
30 37
31#define IXP4XX_EXP_BUS_CS0_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x00000000) 38#define IXP4XX_EXP_BUS_BASE(region)\
32#define IXP4XX_EXP_BUS_CS1_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x01000000) 39 (IXP4XX_EXP_BUS_BASE_PHYS + ((region) * ixp4xx_exp_bus_size))
33#define IXP4XX_EXP_BUS_CS2_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x02000000)
34#define IXP4XX_EXP_BUS_CS3_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x03000000)
35#define IXP4XX_EXP_BUS_CS4_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x04000000)
36#define IXP4XX_EXP_BUS_CS5_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x05000000)
37#define IXP4XX_EXP_BUS_CS6_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x06000000)
38#define IXP4XX_EXP_BUS_CS7_BASE_PHYS (IXP4XX_EXP_BUS_BASE_PHYS + 0x07000000)
39 40
40#define IXP4XX_FLASH_WRITABLE (0x2) 41#define IXP4XX_FLASH_WRITABLE (0x2)
41#define IXP4XX_FLASH_DEFAULT (0xbcd23c40) 42#define IXP4XX_FLASH_DEFAULT (0xbcd23c40)
@@ -112,10 +113,5 @@ static inline void gpio_line_set(u8 line, int value)
112 *IXP4XX_GPIO_GPOUTR &= ~(1 << line); 113 *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
113} 114}
114 115
115static inline void gpio_line_isr_clear(u8 line)
116{
117 *IXP4XX_GPIO_GPISR = (1 << line);
118}
119
120#endif // __ASSEMBLY__ 116#endif // __ASSEMBLY__
121 117
diff --git a/include/asm-arm/arch-l7200/dma.h b/include/asm-arm/arch-l7200/dma.h
index 6595b386cfc9..4c7eca63f035 100644
--- a/include/asm-arm/arch-l7200/dma.h
+++ b/include/asm-arm/arch-l7200/dma.h
@@ -17,7 +17,6 @@
17 * bytes of RAM. 17 * bytes of RAM.
18 */ 18 */
19#define MAX_DMA_ADDRESS 0xd0000000 19#define MAX_DMA_ADDRESS 0xd0000000
20#define MAX_DMA_CHANNELS 0
21 20
22#define DMA_S0 0 21#define DMA_S0 0
23 22
diff --git a/include/asm-arm/arch-l7200/system.h b/include/asm-arm/arch-l7200/system.h
index cb4ff29059b8..18825cf071ba 100644
--- a/include/asm-arm/arch-l7200/system.h
+++ b/include/asm-arm/arch-l7200/system.h
@@ -12,6 +12,8 @@
12#ifndef __ASM_ARCH_SYSTEM_H 12#ifndef __ASM_ARCH_SYSTEM_H
13#define __ASM_ARCH_SYSTEM_H 13#define __ASM_ARCH_SYSTEM_H
14 14
15#include <asm/hardware.h>
16
15static inline void arch_idle(void) 17static inline void arch_idle(void)
16{ 18{
17 *(unsigned long *)(IO_BASE + 0x50004) = 1; /* idle mode */ 19 *(unsigned long *)(IO_BASE + 0x50004) = 1; /* idle mode */
diff --git a/include/asm-arm/arch-lh7a40x/dma.h b/include/asm-arm/arch-lh7a40x/dma.h
index 5797f01e1844..15492e3253f6 100644
--- a/include/asm-arm/arch-lh7a40x/dma.h
+++ b/include/asm-arm/arch-lh7a40x/dma.h
@@ -7,11 +7,3 @@
7 * version 2 as published by the Free Software Foundation. 7 * version 2 as published by the Free Software Foundation.
8 * 8 *
9 */ 9 */
10
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#define MAX_DMA_ADDRESS 0xffffffff
15#define MAX_DMA_CHANNELS 0 /* All DMA is internal to CPU */
16
17#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-lh7a40x/entry-macro.S b/include/asm-arm/arch-lh7a40x/entry-macro.S
index 865f396aa63c..a2f67c06d9c9 100644
--- a/include/asm-arm/arch-lh7a40x/entry-macro.S
+++ b/include/asm-arm/arch-lh7a40x/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11#include <asm/arch/irqs.h>
10 12
11# if defined (CONFIG_ARCH_LH7A400) && defined (CONFIG_ARCH_LH7A404) 13# if defined (CONFIG_ARCH_LH7A400) && defined (CONFIG_ARCH_LH7A404)
12# error "LH7A400 and LH7A404 are mutually exclusive" 14# error "LH7A400 and LH7A404 are mutually exclusive"
diff --git a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h
index ccbcb580a5c1..d4e73efcb816 100644
--- a/include/asm-arm/arch-omap/dma.h
+++ b/include/asm-arm/arch-omap/dma.h
@@ -21,9 +21,6 @@
21#ifndef __ASM_ARCH_DMA_H 21#ifndef __ASM_ARCH_DMA_H
22#define __ASM_ARCH_DMA_H 22#define __ASM_ARCH_DMA_H
23 23
24#define MAX_DMA_ADDRESS 0xffffffff
25#define MAX_DMA_CHANNELS 0
26
27/* Hardware registers for omap1 */ 24/* Hardware registers for omap1 */
28#define OMAP_DMA_BASE (0xfffed800) 25#define OMAP_DMA_BASE (0xfffed800)
29#define OMAP_DMA_GCR (OMAP_DMA_BASE + 0x400) 26#define OMAP_DMA_GCR (OMAP_DMA_BASE + 0x400)
diff --git a/include/asm-arm/arch-omap/entry-macro.S b/include/asm-arm/arch-omap/entry-macro.S
index f8814a84910e..0ffb1185f1ac 100644
--- a/include/asm-arm/arch-omap/entry-macro.S
+++ b/include/asm-arm/arch-omap/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11#include <asm/arch/irqs.h>
10 12
11#if defined(CONFIG_ARCH_OMAP1) 13#if defined(CONFIG_ARCH_OMAP1)
12 14
diff --git a/include/asm-arm/arch-omap/system.h b/include/asm-arm/arch-omap/system.h
index 9af415d2944a..6724a81bd10b 100644
--- a/include/asm-arm/arch-omap/system.h
+++ b/include/asm-arm/arch-omap/system.h
@@ -5,8 +5,9 @@
5#ifndef __ASM_ARCH_SYSTEM_H 5#ifndef __ASM_ARCH_SYSTEM_H
6#define __ASM_ARCH_SYSTEM_H 6#define __ASM_ARCH_SYSTEM_H
7#include <linux/config.h> 7#include <linux/config.h>
8#include <linux/clk.h>
9
8#include <asm/mach-types.h> 10#include <asm/mach-types.h>
9#include <asm/hardware/clock.h>
10#include <asm/hardware.h> 11#include <asm/hardware.h>
11#include <asm/arch/prcm.h> 12#include <asm/arch/prcm.h>
12 13
diff --git a/include/asm-arm/arch-pxa/dma.h b/include/asm-arm/arch-pxa/dma.h
index 56db3d49bfc8..3e88a2a02a0f 100644
--- a/include/asm-arm/arch-pxa/dma.h
+++ b/include/asm-arm/arch-pxa/dma.h
@@ -12,11 +12,6 @@
12#ifndef __ASM_ARCH_DMA_H 12#ifndef __ASM_ARCH_DMA_H
13#define __ASM_ARCH_DMA_H 13#define __ASM_ARCH_DMA_H
14 14
15#define MAX_DMA_ADDRESS 0xffffffff
16
17/* No DMA as the rest of the world see it */
18#define MAX_DMA_CHANNELS 0
19
20/* 15/*
21 * Descriptor structure for PXA's DMA engine 16 * Descriptor structure for PXA's DMA engine
22 * Note: this structure must always be aligned to a 16-byte boundary. 17 * Note: this structure must always be aligned to a 16-byte boundary.
diff --git a/include/asm-arm/arch-pxa/entry-macro.S b/include/asm-arm/arch-pxa/entry-macro.S
index 2abfc8bb3ee5..4985e33afc12 100644
--- a/include/asm-arm/arch-pxa/entry-macro.S
+++ b/include/asm-arm/arch-pxa/entry-macro.S
@@ -7,6 +7,8 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <asm/hardware.h>
11#include <asm/arch/irqs.h>
10 12
11 .macro disable_fiq 13 .macro disable_fiq
12 .endm 14 .endm
diff --git a/include/asm-arm/arch-pxa/ohci.h b/include/asm-arm/arch-pxa/ohci.h
new file mode 100644
index 000000000000..7da89569061e
--- /dev/null
+++ b/include/asm-arm/arch-pxa/ohci.h
@@ -0,0 +1,18 @@
1#ifndef ASMARM_ARCH_OHCI_H
2#define ASMARM_ARCH_OHCI_H
3
4struct device;
5
6struct pxaohci_platform_data {
7 int (*init)(struct device *);
8 void (*exit)(struct device *);
9
10 int port_mode;
11#define PMM_NPS_MODE 1
12#define PMM_GLOBAL_MODE 2
13#define PMM_PERPORT_MODE 3
14};
15
16extern void pxa_set_ohci_info(struct pxaohci_platform_data *info);
17
18#endif
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index a75a2470f4f5..dae138b9cac5 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -2042,6 +2042,18 @@
2042 2042
2043#ifdef CONFIG_PXA27x 2043#ifdef CONFIG_PXA27x
2044 2044
2045#define ARB_CNTRL __REG(0x48000048) /* Arbiter Control Register */
2046
2047#define ARB_DMA_SLV_PARK (1<<31) /* Be parked with DMA slave when idle */
2048#define ARB_CI_PARK (1<<30) /* Be parked with Camera Interface when idle */
2049#define ARB_EX_MEM_PARK (1<<29) /* Be parked with external MEMC when idle */
2050#define ARB_INT_MEM_PARK (1<<28) /* Be parked with internal MEMC when idle */
2051#define ARB_USB_PARK (1<<27) /* Be parked with USB when idle */
2052#define ARB_LCD_PARK (1<<26) /* Be parked with LCD when idle */
2053#define ARB_DMA_PARK (1<<25) /* Be parked with DMA when idle */
2054#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */
2055#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */
2056
2045/* 2057/*
2046 * Keypad 2058 * Keypad
2047 */ 2059 */
diff --git a/include/asm-arm/arch-realview/debug-macro.S b/include/asm-arm/arch-realview/debug-macro.S
index ed28bd012236..017ad996848d 100644
--- a/include/asm-arm/arch-realview/debug-macro.S
+++ b/include/asm-arm/arch-realview/debug-macro.S
@@ -11,7 +11,7 @@
11 * 11 *
12*/ 12*/
13 13
14#include <asm/hardware/amba_serial.h> 14#include <linux/amba/serial.h>
15 15
16 .macro addruart,rx 16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0 17 mrc p15, 0, \rx, c1, c0
diff --git a/include/asm-arm/arch-realview/dma.h b/include/asm-arm/arch-realview/dma.h
index 744491a74bd9..8342e3f9d6ec 100644
--- a/include/asm-arm/arch-realview/dma.h
+++ b/include/asm-arm/arch-realview/dma.h
@@ -18,10 +18,3 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21#ifndef __ASM_ARCH_DMA_H
22#define __ASM_ARCH_DMA_H
23
24#define MAX_DMA_ADDRESS 0xffffffff
25#define MAX_DMA_CHANNELS 0
26
27#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-realview/entry-macro.S b/include/asm-arm/arch-realview/entry-macro.S
index 6288fad0dc41..1a6eec86bd47 100644
--- a/include/asm-arm/arch-realview/entry-macro.S
+++ b/include/asm-arm/arch-realview/entry-macro.S
@@ -7,7 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <asm/hardware.h>
11#include <asm/hardware/gic.h> 11#include <asm/hardware/gic.h>
12 12
13 .macro disable_fiq 13 .macro disable_fiq
diff --git a/include/asm-arm/arch-rpc/entry-macro.S b/include/asm-arm/arch-rpc/entry-macro.S
index 686f413f82d6..c9e5395e5106 100644
--- a/include/asm-arm/arch-rpc/entry-macro.S
+++ b/include/asm-arm/arch-rpc/entry-macro.S
@@ -1,3 +1,3 @@
1 1#include <asm/hardware.h>
2#include <asm/hardware/entry-macro-iomd.S> 2#include <asm/hardware/entry-macro-iomd.S>
3 3
diff --git a/include/asm-arm/arch-s3c2410/dma.h b/include/asm-arm/arch-s3c2410/dma.h
index e830a40e573a..b011e14f3bc6 100644
--- a/include/asm-arm/arch-s3c2410/dma.h
+++ b/include/asm-arm/arch-s3c2410/dma.h
@@ -31,14 +31,6 @@
31#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */ 31#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */
32 32
33 33
34/* according to the samsung port, we cannot use the regular
35 * dma channels... we must therefore provide our own interface
36 * for DMA, and allow our drivers to use that.
37 */
38
39#define MAX_DMA_CHANNELS 0
40
41
42/* we have 4 dma channels */ 34/* we have 4 dma channels */
43#define S3C2410_DMA_CHANNELS (4) 35#define S3C2410_DMA_CHANNELS (4)
44 36
diff --git a/include/asm-arm/arch-s3c2410/entry-macro.S b/include/asm-arm/arch-s3c2410/entry-macro.S
index b7d4d7f4422d..cc06b1bd37b2 100644
--- a/include/asm-arm/arch-s3c2410/entry-macro.S
+++ b/include/asm-arm/arch-s3c2410/entry-macro.S
@@ -10,6 +10,8 @@
10 * Modifications: 10 * Modifications:
11 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA 11 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
12 */ 12 */
13#include <asm/hardware.h>
14#include <asm/arch/irqs.h>
13 15
14 16
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
diff --git a/include/asm-arm/arch-sa1100/dma.h b/include/asm-arm/arch-sa1100/dma.h
index 3d60ed9f8c34..02575d72ac6b 100644
--- a/include/asm-arm/arch-sa1100/dma.h
+++ b/include/asm-arm/arch-sa1100/dma.h
@@ -15,20 +15,6 @@
15 15
16 16
17/* 17/*
18 * This is the maximum DMA address that can be DMAd to.
19 */
20#define MAX_DMA_ADDRESS 0xffffffff
21
22
23/*
24 * The regular generic DMA interface is inappropriate for the
25 * SA1100 DMA model. None of the SA1100 specific drivers using
26 * DMA are portable anyway so it's pointless to try to twist the
27 * regular DMA API to accommodate them.
28 */
29#define MAX_DMA_CHANNELS 0
30
31/*
32 * The SA1100 has six internal DMA channels. 18 * The SA1100 has six internal DMA channels.
33 */ 19 */
34#define SA1100_DMA_CHANNELS 6 20#define SA1100_DMA_CHANNELS 6
diff --git a/include/asm-arm/arch-versatile/debug-macro.S b/include/asm-arm/arch-versatile/debug-macro.S
index 89e38ac1444e..ef6167116dbb 100644
--- a/include/asm-arm/arch-versatile/debug-macro.S
+++ b/include/asm-arm/arch-versatile/debug-macro.S
@@ -11,7 +11,7 @@
11 * 11 *
12*/ 12*/
13 13
14#include <asm/hardware/amba_serial.h> 14#include <linux/amba/serial.h>
15 15
16 .macro addruart,rx 16 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0 17 mrc p15, 0, \rx, c1, c0
diff --git a/include/asm-arm/arch-versatile/dma.h b/include/asm-arm/arch-versatile/dma.h
index dcc8ac26eac0..642577348623 100644
--- a/include/asm-arm/arch-versatile/dma.h
+++ b/include/asm-arm/arch-versatile/dma.h
@@ -18,10 +18,3 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21#ifndef __ASM_ARCH_DMA_H
22#define __ASM_ARCH_DMA_H
23
24#define MAX_DMA_ADDRESS 0xffffffff
25#define MAX_DMA_CHANNELS 0
26
27#endif /* _ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-versatile/entry-macro.S b/include/asm-arm/arch-versatile/entry-macro.S
index 90e4e970d253..58f0d71759f6 100644
--- a/include/asm-arm/arch-versatile/entry-macro.S
+++ b/include/asm-arm/arch-versatile/entry-macro.S
@@ -7,7 +7,9 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 .macro disable_fiq 10#include <asm/hardware.h>
11
12 .macro disable_fiq
11 .endm 13 .endm
12 14
13 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h
index d586f65c8228..3d7283d84405 100644
--- a/include/asm-arm/atomic.h
+++ b/include/asm-arm/atomic.h
@@ -175,6 +175,8 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
175 175
176#endif /* __LINUX_ARM_ARCH__ */ 176#endif /* __LINUX_ARM_ARCH__ */
177 177
178#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
179
178static inline int atomic_add_unless(atomic_t *v, int a, int u) 180static inline int atomic_add_unless(atomic_t *v, int a, int u)
179{ 181{
180 int c, old; 182 int c, old;
@@ -205,5 +207,6 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
205#define smp_mb__before_atomic_inc() barrier() 207#define smp_mb__before_atomic_inc() barrier()
206#define smp_mb__after_atomic_inc() barrier() 208#define smp_mb__after_atomic_inc() barrier()
207 209
210#include <asm-generic/atomic.h>
208#endif 211#endif
209#endif 212#endif
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h
index 7399d431edfe..d02de721ecc1 100644
--- a/include/asm-arm/bitops.h
+++ b/include/asm-arm/bitops.h
@@ -332,6 +332,7 @@ static inline unsigned long __ffs(unsigned long word)
332 */ 332 */
333 333
334#define fls(x) generic_fls(x) 334#define fls(x) generic_fls(x)
335#define fls64(x) generic_fls64(x)
335 336
336/* 337/*
337 * ffs: find first bit set. This is defined the same way as 338 * ffs: find first bit set. This is defined the same way as
@@ -351,6 +352,7 @@ static inline unsigned long __ffs(unsigned long word)
351#define fls(x) \ 352#define fls(x) \
352 ( __builtin_constant_p(x) ? generic_fls(x) : \ 353 ( __builtin_constant_p(x) ? generic_fls(x) : \
353 ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) ) 354 ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) )
355#define fls64(x) generic_fls64(x)
354#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); }) 356#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
355#define __ffs(x) (ffs(x) - 1) 357#define __ffs(x) (ffs(x) - 1)
356#define ffz(x) __ffs( ~(x) ) 358#define ffz(x) __ffs( ~(x) )
diff --git a/include/asm-arm/byteorder.h b/include/asm-arm/byteorder.h
index d648a1915c33..17eaf8bdf092 100644
--- a/include/asm-arm/byteorder.h
+++ b/include/asm-arm/byteorder.h
@@ -15,9 +15,32 @@
15#ifndef __ASM_ARM_BYTEORDER_H 15#ifndef __ASM_ARM_BYTEORDER_H
16#define __ASM_ARM_BYTEORDER_H 16#define __ASM_ARM_BYTEORDER_H
17 17
18 18#include <linux/compiler.h>
19#include <asm/types.h> 19#include <asm/types.h>
20 20
21static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
22{
23 __u32 t;
24
25 if (__builtin_constant_p(x)) {
26 t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */
27 } else {
28 /*
29 * The compiler needs a bit of a hint here to always do the
30 * right thing and not screw it up to different degrees
31 * depending on the gcc version.
32 */
33 asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x));
34 }
35 x = (x << 24) | (x >> 8); /* mov r0,r0,ror #8 */
36 t &= ~0x00FF0000; /* bic r1,r1,#0x00FF0000 */
37 x ^= (t >> 8); /* eor r0,r0,r1,lsr #8 */
38
39 return x;
40}
41
42#define __arch__swab32(x) ___arch__swab32(x)
43
21#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) 44#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
22# define __BYTEORDER_HAS_U64__ 45# define __BYTEORDER_HAS_U64__
23# define __SWAB_64_THRU_32__ 46# define __SWAB_64_THRU_32__
diff --git a/include/asm-arm/cache.h b/include/asm-arm/cache.h
index 8d161f7c87ff..31332c8ac04e 100644
--- a/include/asm-arm/cache.h
+++ b/include/asm-arm/cache.h
@@ -7,9 +7,4 @@
7#define L1_CACHE_SHIFT 5 7#define L1_CACHE_SHIFT 5
8#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 8#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
9 9
10/*
11 * largest L1 which this arch supports
12 */
13#define L1_CACHE_SHIFT_MAX 5
14
15#endif 10#endif
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
index e81baff4f54b..09e19a783a51 100644
--- a/include/asm-arm/cacheflush.h
+++ b/include/asm-arm/cacheflush.h
@@ -14,7 +14,6 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16 16
17#include <asm/mman.h>
18#include <asm/glue.h> 17#include <asm/glue.h>
19#include <asm/shmparam.h> 18#include <asm/shmparam.h>
20 19
diff --git a/include/asm-arm/dma.h b/include/asm-arm/dma.h
index ef41df43a584..49c01e2bf7c8 100644
--- a/include/asm-arm/dma.h
+++ b/include/asm-arm/dma.h
@@ -10,6 +10,13 @@ typedef unsigned int dmach_t;
10#include <asm/arch/dma.h> 10#include <asm/arch/dma.h>
11 11
12/* 12/*
13 * This is the maximum virtual address which can be DMA'd from.
14 */
15#ifndef MAX_DMA_ADDRESS
16#define MAX_DMA_ADDRESS 0xffffffff
17#endif
18
19/*
13 * DMA modes 20 * DMA modes
14 */ 21 */
15typedef unsigned int dmamode_t; 22typedef unsigned int dmamode_t;
@@ -91,7 +98,9 @@ extern void set_dma_sg(dmach_t channel, struct scatterlist *sg, int nr_sg);
91 * especially since some DMA architectures don't update the 98 * especially since some DMA architectures don't update the
92 * DMA address immediately, but defer it to the enable_dma(). 99 * DMA address immediately, but defer it to the enable_dma().
93 */ 100 */
94extern void set_dma_addr(dmach_t channel, unsigned long physaddr); 101extern void __set_dma_addr(dmach_t channel, void *addr);
102#define set_dma_addr(channel, addr) \
103 __set_dma_addr(channel, bus_to_virt(addr))
95 104
96/* Set the DMA byte count for this channel 105/* Set the DMA byte count for this channel
97 * 106 *
diff --git a/include/asm-arm/futex.h b/include/asm-arm/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-arm/futex.h
+++ b/include/asm-arm/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-arm/hardware/sharpsl_pm.h b/include/asm-arm/hardware/sharpsl_pm.h
new file mode 100644
index 000000000000..36983e5f3665
--- /dev/null
+++ b/include/asm-arm/hardware/sharpsl_pm.h
@@ -0,0 +1,94 @@
1/*
2 * SharpSL Battery/PM Driver
3 *
4 * Copyright (c) 2004-2005 Richard Purdie
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
12#include <linux/interrupt.h>
13
14struct sharpsl_charger_machinfo {
15 void (*init)(void);
16 void (*exit)(void);
17 int gpio_acin;
18 int gpio_batfull;
19 int gpio_batlock;
20 int gpio_fatal;
21 void (*discharge)(int);
22 void (*discharge1)(int);
23 void (*charge)(int);
24 void (*measure_temp)(int);
25 void (*presuspend)(void);
26 void (*postsuspend)(void);
27 unsigned long (*read_devdata)(int);
28#define SHARPSL_BATT_VOLT 1
29#define SHARPSL_BATT_TEMP 2
30#define SHARPSL_ACIN_VOLT 3
31#define SHARPSL_STATUS_ACIN 4
32#define SHARPSL_STATUS_LOCK 5
33#define SHARPSL_STATUS_CHRGFULL 6
34#define SHARPSL_STATUS_FATAL 7
35 unsigned long (*charger_wakeup)(void);
36 int (*should_wakeup)(unsigned int resume_on_alarm);
37 int bat_levels;
38 struct battery_thresh *bat_levels_noac;
39 struct battery_thresh *bat_levels_acin;
40 int status_high_acin;
41 int status_low_acin;
42 int status_high_noac;
43 int status_low_noac;
44};
45
46struct battery_thresh {
47 int voltage;
48 int percentage;
49};
50
51struct battery_stat {
52 int ac_status; /* APM AC Present/Not Present */
53 int mainbat_status; /* APM Main Battery Status */
54 int mainbat_percent; /* Main Battery Percentage Charge */
55 int mainbat_voltage; /* Main Battery Voltage */
56};
57
58struct sharpsl_pm_status {
59 struct device *dev;
60 struct timer_list ac_timer;
61 struct timer_list chrg_full_timer;
62
63 int charge_mode;
64#define CHRG_ERROR (-1)
65#define CHRG_OFF (0)
66#define CHRG_ON (1)
67#define CHRG_DONE (2)
68
69 unsigned int flags;
70#define SHARPSL_SUSPENDED (1 << 0) /* Device is Suspended */
71#define SHARPSL_ALARM_ACTIVE (1 << 1) /* Alarm is for charging event (not user) */
72#define SHARPSL_BL_LIMIT (1 << 2) /* Backlight Intensity Limited */
73#define SHARPSL_APM_QUEUED (1 << 3) /* APM Event Queued */
74#define SHARPSL_DO_OFFLINE_CHRG (1 << 4) /* Trigger the offline charger */
75
76 int full_count;
77 unsigned long charge_start_time;
78 struct sharpsl_charger_machinfo *machinfo;
79 struct battery_stat battstat;
80};
81
82extern struct sharpsl_pm_status sharpsl_pm;
83
84
85#define SHARPSL_LED_ERROR 2
86#define SHARPSL_LED_ON 1
87#define SHARPSL_LED_OFF 0
88
89void sharpsl_battery_kick(void);
90void sharpsl_pm_led(int val);
91irqreturn_t sharpsl_ac_isr(int irq, void *dev_id, struct pt_regs *fp);
92irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id, struct pt_regs *fp);
93irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id, struct pt_regs *fp);
94
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index 0cf4d4f99600..fd0147e52dbb 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -56,7 +56,12 @@ extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
56 56
57/* 57/*
58 * Architecture ioremap implementation. 58 * Architecture ioremap implementation.
59 *
60 * __ioremap takes CPU physical address.
61 *
62 * __ioremap_pfn takes a Page Frame Number and an offset into that page
59 */ 63 */
64extern void __iomem * __ioremap_pfn(unsigned long, unsigned long, size_t, unsigned long);
60extern void __iomem * __ioremap(unsigned long, size_t, unsigned long); 65extern void __iomem * __ioremap(unsigned long, size_t, unsigned long);
61extern void __iounmap(void __iomem *addr); 66extern void __iounmap(void __iomem *addr);
62 67
@@ -261,6 +266,7 @@ out:
261 * 266 *
262 * ioremap takes a PCI memory address, as specified in 267 * ioremap takes a PCI memory address, as specified in
263 * Documentation/IO-mapping.txt. 268 * Documentation/IO-mapping.txt.
269 *
264 */ 270 */
265#ifndef __arch_ioremap 271#ifndef __arch_ioremap
266#define ioremap(cookie,size) __ioremap(cookie,size,0) 272#define ioremap(cookie,size) __ioremap(cookie,size,0)
diff --git a/include/asm-arm/ioctl.h b/include/asm-arm/ioctl.h
index 2cbb7d0e9dc6..b279fe06dfe5 100644
--- a/include/asm-arm/ioctl.h
+++ b/include/asm-arm/ioctl.h
@@ -1,74 +1 @@
1/* #include <asm-generic/ioctl.h>
2 * linux/ioctl.h for Linux by H.H. Bergman.
3 */
4
5#ifndef _ASMARM_IOCTL_H
6#define _ASMARM_IOCTL_H
7
8/* ioctl command encoding: 32 bits total, command in lower 16 bits,
9 * size of the parameter structure in the lower 14 bits of the
10 * upper 16 bits.
11 * Encoding the size of the parameter structure in the ioctl request
12 * is useful for catching programs compiled with old versions
13 * and to avoid overwriting user space outside the user buffer area.
14 * The highest 2 bits are reserved for indicating the ``access mode''.
15 * NOTE: This limits the max parameter size to 16kB -1 !
16 */
17
18/*
19 * The following is for compatibility across the various Linux
20 * platforms. The i386 ioctl numbering scheme doesn't really enforce
21 * a type field. De facto, however, the top 8 bits of the lower 16
22 * bits are indeed used as a type field, so we might just as well make
23 * this explicit here. Please be sure to use the decoding macros
24 * below from now on.
25 */
26#define _IOC_NRBITS 8
27#define _IOC_TYPEBITS 8
28#define _IOC_SIZEBITS 14
29#define _IOC_DIRBITS 2
30
31#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
32#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
33#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
34#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
35
36#define _IOC_NRSHIFT 0
37#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
38#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
39#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
40
41/*
42 * Direction bits.
43 */
44#define _IOC_NONE 0U
45#define _IOC_WRITE 1U
46#define _IOC_READ 2U
47
48#define _IOC(dir,type,nr,size) \
49 (((dir) << _IOC_DIRSHIFT) | \
50 ((type) << _IOC_TYPESHIFT) | \
51 ((nr) << _IOC_NRSHIFT) | \
52 ((size) << _IOC_SIZESHIFT))
53
54/* used to create numbers */
55#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
56#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
57#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
58#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
59
60/* used to decode ioctl numbers.. */
61#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
62#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
63#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
64#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
65
66/* ...and for the drivers/sound files... */
67
68#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
69#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
70#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
71#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
72#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
73
74#endif /* _ASMARM_IOCTL_H */
diff --git a/include/asm-arm/irq.h b/include/asm-arm/irq.h
index 59975ee43cf1..7772432d3fd7 100644
--- a/include/asm-arm/irq.h
+++ b/include/asm-arm/irq.h
@@ -25,10 +25,14 @@ extern void disable_irq_nosync(unsigned int);
25extern void disable_irq(unsigned int); 25extern void disable_irq(unsigned int);
26extern void enable_irq(unsigned int); 26extern void enable_irq(unsigned int);
27 27
28#define __IRQT_FALEDGE (1 << 0) 28/*
29#define __IRQT_RISEDGE (1 << 1) 29 * These correspond with the SA_TRIGGER_* defines, and therefore the
30#define __IRQT_LOWLVL (1 << 2) 30 * IRQRESOURCE_IRQ_* defines.
31#define __IRQT_HIGHLVL (1 << 3) 31 */
32#define __IRQT_RISEDGE (1 << 0)
33#define __IRQT_FALEDGE (1 << 1)
34#define __IRQT_HIGHLVL (1 << 2)
35#define __IRQT_LOWLVL (1 << 3)
32 36
33#define IRQT_NOEDGE (0) 37#define IRQT_NOEDGE (0)
34#define IRQT_RISING (__IRQT_RISEDGE) 38#define IRQT_RISING (__IRQT_RISEDGE)
diff --git a/include/asm-arm/mach/dma.h b/include/asm-arm/mach/dma.h
index 31bf716106ee..e7c4a20aad53 100644
--- a/include/asm-arm/mach/dma.h
+++ b/include/asm-arm/mach/dma.h
@@ -25,13 +25,15 @@ struct dma_ops {
25}; 25};
26 26
27struct dma_struct { 27struct dma_struct {
28 void *addr; /* single DMA address */
29 unsigned long count; /* single DMA size */
28 struct scatterlist buf; /* single DMA */ 30 struct scatterlist buf; /* single DMA */
29 int sgcount; /* number of DMA SG */ 31 int sgcount; /* number of DMA SG */
30 struct scatterlist *sg; /* DMA Scatter-Gather List */ 32 struct scatterlist *sg; /* DMA Scatter-Gather List */
31 33
32 unsigned int active:1; /* Transfer active */ 34 unsigned int active:1; /* Transfer active */
33 unsigned int invalid:1; /* Address/Count changed */ 35 unsigned int invalid:1; /* Address/Count changed */
34 unsigned int using_sg:1; /* using scatter list? */ 36
35 dmamode_t dma_mode; /* DMA mode */ 37 dmamode_t dma_mode; /* DMA mode */
36 int speed; /* DMA speed */ 38 int speed; /* DMA speed */
37 39
diff --git a/include/asm-arm/mach/map.h b/include/asm-arm/mach/map.h
index b338936bde4f..3351b77fab36 100644
--- a/include/asm-arm/mach/map.h
+++ b/include/asm-arm/mach/map.h
@@ -27,9 +27,6 @@ struct meminfo;
27#define MT_ROM 6 27#define MT_ROM 6
28#define MT_IXP2000_DEVICE 7 28#define MT_IXP2000_DEVICE 7
29 29
30#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
31#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
32
33extern void create_memmap_holes(struct meminfo *); 30extern void create_memmap_holes(struct meminfo *);
34extern void memtable_init(struct meminfo *); 31extern void memtable_init(struct meminfo *);
35extern void iotable_init(struct map_desc *, int); 32extern void iotable_init(struct map_desc *, int);
diff --git a/include/asm-arm/mach/serial_at91rm9200.h b/include/asm-arm/mach/serial_at91rm9200.h
new file mode 100644
index 000000000000..98f4b0cb883c
--- /dev/null
+++ b/include/asm-arm/mach/serial_at91rm9200.h
@@ -0,0 +1,36 @@
1/*
2 * linux/include/asm-arm/mach/serial_at91rm9200.h
3 *
4 * Based on serial_sa1100.h by Nicolas Pitre
5 *
6 * Copyright (C) 2002 ATMEL Rousset
7 *
8 * Low level machine dependent UART functions.
9 */
10#include <linux/config.h>
11
12struct uart_port;
13
14/*
15 * This is a temporary structure for registering these
16 * functions; it is intended to be discarded after boot.
17 */
18struct at91rm9200_port_fns {
19 void (*set_mctrl)(struct uart_port *, u_int);
20 u_int (*get_mctrl)(struct uart_port *);
21 void (*enable_ms)(struct uart_port *);
22 void (*pm)(struct uart_port *, u_int, u_int);
23 int (*set_wake)(struct uart_port *, u_int);
24 int (*open)(struct uart_port *);
25 void (*close)(struct uart_port *);
26};
27
28#if defined(CONFIG_SERIAL_AT91)
29void at91_register_uart_fns(struct at91rm9200_port_fns *fns);
30void at91_register_uart(int idx, int port);
31#else
32#define at91_register_uart_fns(fns) do { } while (0)
33#define at91_register_uart(idx,port) do { } while (0)
34#endif
35
36
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h
index 3e572364ee73..b4e1146ab682 100644
--- a/include/asm-arm/memory.h
+++ b/include/asm-arm/memory.h
@@ -25,6 +25,7 @@
25#include <linux/config.h> 25#include <linux/config.h>
26#include <linux/compiler.h> 26#include <linux/compiler.h>
27#include <asm/arch/memory.h> 27#include <asm/arch/memory.h>
28#include <asm/sizes.h>
28 29
29#ifndef TASK_SIZE 30#ifndef TASK_SIZE
30/* 31/*
@@ -48,6 +49,14 @@
48#endif 49#endif
49 50
50/* 51/*
52 * Size of DMA-consistent memory region. Must be multiple of 2M,
53 * between 2MB and 14MB inclusive.
54 */
55#ifndef CONSISTENT_DMA_SIZE
56#define CONSISTENT_DMA_SIZE SZ_2M
57#endif
58
59/*
51 * Physical vs virtual RAM address space conversion. These are 60 * Physical vs virtual RAM address space conversion. These are
52 * private definitions which should NOT be used outside memory.h 61 * private definitions which should NOT be used outside memory.h
53 * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. 62 * files. Use virt_to_phys/phys_to_virt/__pa/__va instead.
@@ -58,6 +67,12 @@
58#endif 67#endif
59 68
60/* 69/*
70 * Convert a physical address to a Page Frame Number and back
71 */
72#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
73#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
74
75/*
61 * The module space lives between the addresses given by TASK_SIZE 76 * The module space lives between the addresses given by TASK_SIZE
62 * and PAGE_OFFSET - it must be within 32MB of the kernel text. 77 * and PAGE_OFFSET - it must be within 32MB of the kernel text.
63 */ 78 */
diff --git a/include/asm-arm/mman.h b/include/asm-arm/mman.h
index 8e4f69c4fa5f..f0bebca2ac21 100644
--- a/include/asm-arm/mman.h
+++ b/include/asm-arm/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-arm/mutex.h b/include/asm-arm/mutex.h
new file mode 100644
index 000000000000..6caa59f1f595
--- /dev/null
+++ b/include/asm-arm/mutex.h
@@ -0,0 +1,128 @@
1/*
2 * include/asm-arm/mutex.h
3 *
4 * ARM optimized mutex locking primitives
5 *
6 * Please look into asm-generic/mutex-xchg.h for a formal definition.
7 */
8#ifndef _ASM_MUTEX_H
9#define _ASM_MUTEX_H
10
11#if __LINUX_ARM_ARCH__ < 6
12/* On pre-ARMv6 hardware the swp based implementation is the most efficient. */
13# include <asm-generic/mutex-xchg.h>
14#else
15
16/*
17 * Attempting to lock a mutex on ARMv6+ can be done with a bastardized
18 * atomic decrement (it is not a reliable atomic decrement but it satisfies
19 * the defined semantics for our purpose, while being smaller and faster
20 * than a real atomic decrement or atomic swap. The idea is to attempt
21 * decrementing the lock value only once. If once decremented it isn't zero,
22 * or if its store-back fails due to a dispute on the exclusive store, we
23 * simply bail out immediately through the slow path where the lock will be
24 * reattempted until it succeeds.
25 */
26#define __mutex_fastpath_lock(count, fail_fn) \
27do { \
28 int __ex_flag, __res; \
29 \
30 typecheck(atomic_t *, count); \
31 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
32 \
33 __asm__ ( \
34 "ldrex %0, [%2] \n" \
35 "sub %0, %0, #1 \n" \
36 "strex %1, %0, [%2] \n" \
37 \
38 : "=&r" (__res), "=&r" (__ex_flag) \
39 : "r" (&(count)->counter) \
40 : "cc","memory" ); \
41 \
42 if (unlikely(__res || __ex_flag)) \
43 fail_fn(count); \
44} while (0)
45
46#define __mutex_fastpath_lock_retval(count, fail_fn) \
47({ \
48 int __ex_flag, __res; \
49 \
50 typecheck(atomic_t *, count); \
51 typecheck_fn(fastcall int (*)(atomic_t *), fail_fn); \
52 \
53 __asm__ ( \
54 "ldrex %0, [%2] \n" \
55 "sub %0, %0, #1 \n" \
56 "strex %1, %0, [%2] \n" \
57 \
58 : "=&r" (__res), "=&r" (__ex_flag) \
59 : "r" (&(count)->counter) \
60 : "cc","memory" ); \
61 \
62 __res |= __ex_flag; \
63 if (unlikely(__res != 0)) \
64 __res = fail_fn(count); \
65 __res; \
66})
67
68/*
69 * Same trick is used for the unlock fast path. However the original value,
70 * rather than the result, is used to test for success in order to have
71 * better generated assembly.
72 */
73#define __mutex_fastpath_unlock(count, fail_fn) \
74do { \
75 int __ex_flag, __res, __orig; \
76 \
77 typecheck(atomic_t *, count); \
78 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
79 \
80 __asm__ ( \
81 "ldrex %0, [%3] \n" \
82 "add %1, %0, #1 \n" \
83 "strex %2, %1, [%3] \n" \
84 \
85 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag) \
86 : "r" (&(count)->counter) \
87 : "cc","memory" ); \
88 \
89 if (unlikely(__orig || __ex_flag)) \
90 fail_fn(count); \
91} while (0)
92
93/*
94 * If the unlock was done on a contended lock, or if the unlock simply fails
95 * then the mutex remains locked.
96 */
97#define __mutex_slowpath_needs_to_unlock() 1
98
99/*
100 * For __mutex_fastpath_trylock we use another construct which could be
101 * described as a "single value cmpxchg".
102 *
103 * This provides the needed trylock semantics like cmpxchg would, but it is
104 * lighter and less generic than a true cmpxchg implementation.
105 */
106static inline int
107__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
108{
109 int __ex_flag, __res, __orig;
110
111 __asm__ (
112
113 "1: ldrex %0, [%3] \n"
114 "subs %1, %0, #1 \n"
115 "strexeq %2, %1, [%3] \n"
116 "movlt %0, #0 \n"
117 "cmpeq %2, #0 \n"
118 "bgt 1b \n"
119
120 : "=&r" (__orig), "=&r" (__res), "=&r" (__ex_flag)
121 : "r" (&count->counter)
122 : "cc", "memory" );
123
124 return __orig;
125}
126
127#endif
128#endif
diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h
index 7d4118e09054..31290694648b 100644
--- a/include/asm-arm/processor.h
+++ b/include/asm-arm/processor.h
@@ -85,9 +85,11 @@ unsigned long get_wchan(struct task_struct *p);
85 */ 85 */
86extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 86extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
87 87
88#define KSTK_REGS(tsk) (((struct pt_regs *)(THREAD_START_SP + (unsigned long)(tsk)->thread_info)) - 1) 88#define task_pt_regs(p) \
89#define KSTK_EIP(tsk) KSTK_REGS(tsk)->ARM_pc 89 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
90#define KSTK_ESP(tsk) KSTK_REGS(tsk)->ARM_sp 90
91#define KSTK_EIP(tsk) task_pt_regs(tsk)->ARM_pc
92#define KSTK_ESP(tsk) task_pt_regs(tsk)->ARM_sp
91 93
92/* 94/*
93 * Prefetching support - only ARMv5. 95 * Prefetching support - only ARMv5.
diff --git a/include/asm-arm/scatterlist.h b/include/asm-arm/scatterlist.h
index 83b876fb04cc..de2f65eb42ed 100644
--- a/include/asm-arm/scatterlist.h
+++ b/include/asm-arm/scatterlist.h
@@ -9,7 +9,6 @@ struct scatterlist {
9 unsigned int offset; /* buffer offset */ 9 unsigned int offset; /* buffer offset */
10 dma_addr_t dma_address; /* dma address */ 10 dma_addr_t dma_address; /* dma address */
11 unsigned int length; /* length */ 11 unsigned int length; /* length */
12 char *__address; /* for set_dma_addr */
13}; 12};
14 13
15/* 14/*
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 5621d61ebc07..eb2de8c10515 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -168,10 +168,20 @@ extern struct task_struct *__switch_to(struct task_struct *, struct thread_info
168 168
169#define switch_to(prev,next,last) \ 169#define switch_to(prev,next,last) \
170do { \ 170do { \
171 last = __switch_to(prev,prev->thread_info,next->thread_info); \ 171 last = __switch_to(prev,task_thread_info(prev), task_thread_info(next)); \
172} while (0) 172} while (0)
173 173
174/* 174/*
175 * On SMP systems, when the scheduler does migration-cost autodetection,
176 * it needs a way to flush as much of the CPU's caches as possible.
177 *
178 * TODO: fill this in!
179 */
180static inline void sched_cacheflush(void)
181{
182}
183
184/*
175 * CPU interrupt mask handling. 185 * CPU interrupt mask handling.
176 */ 186 */
177#if __LINUX_ARM_ARCH__ >= 6 187#if __LINUX_ARM_ARCH__ >= 6
diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h
index 7c98557b717f..33a33cbb6329 100644
--- a/include/asm-arm/thread_info.h
+++ b/include/asm-arm/thread_info.h
@@ -96,13 +96,10 @@ static inline struct thread_info *current_thread_info(void)
96extern struct thread_info *alloc_thread_info(struct task_struct *task); 96extern struct thread_info *alloc_thread_info(struct task_struct *task);
97extern void free_thread_info(struct thread_info *); 97extern void free_thread_info(struct thread_info *);
98 98
99#define get_thread_info(ti) get_task_struct((ti)->task)
100#define put_thread_info(ti) put_task_struct((ti)->task)
101
102#define thread_saved_pc(tsk) \ 99#define thread_saved_pc(tsk) \
103 ((unsigned long)(pc_pointer((tsk)->thread_info->cpu_context.pc))) 100 ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
104#define thread_saved_fp(tsk) \ 101#define thread_saved_fp(tsk) \
105 ((unsigned long)((tsk)->thread_info->cpu_context.fp)) 102 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
106 103
107extern void iwmmxt_task_disable(struct thread_info *); 104extern void iwmmxt_task_disable(struct thread_info *);
108extern void iwmmxt_task_copy(struct thread_info *, void *); 105extern void iwmmxt_task_copy(struct thread_info *, void *);
diff --git a/include/asm-arm26/atomic.h b/include/asm-arm26/atomic.h
index a47cadc59686..1552c8653990 100644
--- a/include/asm-arm26/atomic.h
+++ b/include/asm-arm26/atomic.h
@@ -76,6 +76,8 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
76 return ret; 76 return ret;
77} 77}
78 78
79#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
80
79static inline int atomic_add_unless(atomic_t *v, int a, int u) 81static inline int atomic_add_unless(atomic_t *v, int a, int u)
80{ 82{
81 int ret; 83 int ret;
@@ -118,5 +120,6 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
118#define smp_mb__before_atomic_inc() barrier() 120#define smp_mb__before_atomic_inc() barrier()
119#define smp_mb__after_atomic_inc() barrier() 121#define smp_mb__after_atomic_inc() barrier()
120 122
123#include <asm-generic/atomic.h>
121#endif 124#endif
122#endif 125#endif
diff --git a/include/asm-arm26/bitops.h b/include/asm-arm26/bitops.h
index 7d062fb2e343..15cc6f2da792 100644
--- a/include/asm-arm26/bitops.h
+++ b/include/asm-arm26/bitops.h
@@ -259,6 +259,7 @@ static inline unsigned long __ffs(unsigned long word)
259 */ 259 */
260 260
261#define fls(x) generic_fls(x) 261#define fls(x) generic_fls(x)
262#define fls64(x) generic_fls64(x)
262 263
263/* 264/*
264 * ffs: find first bit set. This is defined the same way as 265 * ffs: find first bit set. This is defined the same way as
diff --git a/include/asm-arm26/futex.h b/include/asm-arm26/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-arm26/futex.h
+++ b/include/asm-arm26/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-arm26/ioctl.h b/include/asm-arm26/ioctl.h
index 2cbb7d0e9dc6..b279fe06dfe5 100644
--- a/include/asm-arm26/ioctl.h
+++ b/include/asm-arm26/ioctl.h
@@ -1,74 +1 @@
1/* #include <asm-generic/ioctl.h>
2 * linux/ioctl.h for Linux by H.H. Bergman.
3 */
4
5#ifndef _ASMARM_IOCTL_H
6#define _ASMARM_IOCTL_H
7
8/* ioctl command encoding: 32 bits total, command in lower 16 bits,
9 * size of the parameter structure in the lower 14 bits of the
10 * upper 16 bits.
11 * Encoding the size of the parameter structure in the ioctl request
12 * is useful for catching programs compiled with old versions
13 * and to avoid overwriting user space outside the user buffer area.
14 * The highest 2 bits are reserved for indicating the ``access mode''.
15 * NOTE: This limits the max parameter size to 16kB -1 !
16 */
17
18/*
19 * The following is for compatibility across the various Linux
20 * platforms. The i386 ioctl numbering scheme doesn't really enforce
21 * a type field. De facto, however, the top 8 bits of the lower 16
22 * bits are indeed used as a type field, so we might just as well make
23 * this explicit here. Please be sure to use the decoding macros
24 * below from now on.
25 */
26#define _IOC_NRBITS 8
27#define _IOC_TYPEBITS 8
28#define _IOC_SIZEBITS 14
29#define _IOC_DIRBITS 2
30
31#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
32#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
33#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
34#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
35
36#define _IOC_NRSHIFT 0
37#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
38#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
39#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
40
41/*
42 * Direction bits.
43 */
44#define _IOC_NONE 0U
45#define _IOC_WRITE 1U
46#define _IOC_READ 2U
47
48#define _IOC(dir,type,nr,size) \
49 (((dir) << _IOC_DIRSHIFT) | \
50 ((type) << _IOC_TYPESHIFT) | \
51 ((nr) << _IOC_NRSHIFT) | \
52 ((size) << _IOC_SIZESHIFT))
53
54/* used to create numbers */
55#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
56#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
57#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
58#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
59
60/* used to decode ioctl numbers.. */
61#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
62#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
63#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
64#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
65
66/* ...and for the drivers/sound files... */
67
68#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
69#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
70#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
71#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
72#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
73
74#endif /* _ASMARM_IOCTL_H */
diff --git a/include/asm-arm26/mman.h b/include/asm-arm26/mman.h
index cc27b8240265..0ed7780541fa 100644
--- a/include/asm-arm26/mman.h
+++ b/include/asm-arm26/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-arm26/system.h b/include/asm-arm26/system.h
index f23fac1938f3..ca4ccfc4b578 100644
--- a/include/asm-arm26/system.h
+++ b/include/asm-arm26/system.h
@@ -111,10 +111,20 @@ extern struct task_struct *__switch_to(struct task_struct *, struct thread_info
111 111
112#define switch_to(prev,next,last) \ 112#define switch_to(prev,next,last) \
113do { \ 113do { \
114 last = __switch_to(prev,prev->thread_info,next->thread_info); \ 114 last = __switch_to(prev,task_thread_info(prev),task_thread_info(next)); \
115} while (0) 115} while (0)
116 116
117/* 117/*
118 * On SMP systems, when the scheduler does migration-cost autodetection,
119 * it needs a way to flush as much of the CPU's caches as possible.
120 *
121 * TODO: fill this in!
122 */
123static inline void sched_cacheflush(void)
124{
125}
126
127/*
118 * Save the current interrupt enable state & disable IRQs 128 * Save the current interrupt enable state & disable IRQs
119 */ 129 */
120#define local_irq_save(x) \ 130#define local_irq_save(x) \
diff --git a/include/asm-arm26/thread_info.h b/include/asm-arm26/thread_info.h
index aff3e5699c64..a65e58a0a767 100644
--- a/include/asm-arm26/thread_info.h
+++ b/include/asm-arm26/thread_info.h
@@ -82,18 +82,15 @@ static inline struct thread_info *current_thread_info(void)
82 82
83/* FIXME - PAGE_SIZE < 32K */ 83/* FIXME - PAGE_SIZE < 32K */
84#define THREAD_SIZE (8*32768) // FIXME - this needs attention (see kernel/fork.c which gets a nice div by zero if this is lower than 8*32768 84#define THREAD_SIZE (8*32768) // FIXME - this needs attention (see kernel/fork.c which gets a nice div by zero if this is lower than 8*32768
85#define __get_user_regs(x) (((struct pt_regs *)((unsigned long)(x) + THREAD_SIZE - 8)) - 1) 85#define task_pt_regs(task) ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE - 8) - 1)
86 86
87extern struct thread_info *alloc_thread_info(struct task_struct *task); 87extern struct thread_info *alloc_thread_info(struct task_struct *task);
88extern void free_thread_info(struct thread_info *); 88extern void free_thread_info(struct thread_info *);
89 89
90#define get_thread_info(ti) get_task_struct((ti)->task)
91#define put_thread_info(ti) put_task_struct((ti)->task)
92
93#define thread_saved_pc(tsk) \ 90#define thread_saved_pc(tsk) \
94 ((unsigned long)(pc_pointer((tsk)->thread_info->cpu_context.pc))) 91 ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
95#define thread_saved_fp(tsk) \ 92#define thread_saved_fp(tsk) \
96 ((unsigned long)((tsk)->thread_info->cpu_context.fp)) 93 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
97 94
98#else /* !__ASSEMBLY__ */ 95#else /* !__ASSEMBLY__ */
99 96
diff --git a/include/asm-cris/arch-v10/cache.h b/include/asm-cris/arch-v10/cache.h
index 1d1d1ba65b1a..aea27184d2d2 100644
--- a/include/asm-cris/arch-v10/cache.h
+++ b/include/asm-cris/arch-v10/cache.h
@@ -4,6 +4,5 @@
4/* Etrax 100LX have 32-byte cache-lines. */ 4/* Etrax 100LX have 32-byte cache-lines. */
5#define L1_CACHE_BYTES 32 5#define L1_CACHE_BYTES 32
6#define L1_CACHE_SHIFT 5 6#define L1_CACHE_SHIFT 5
7#define L1_CACHE_SHIFT_MAX 5
8 7
9#endif /* _ASM_ARCH_CACHE_H */ 8#endif /* _ASM_ARCH_CACHE_H */
diff --git a/include/asm-cris/arch-v10/processor.h b/include/asm-cris/arch-v10/processor.h
index e23df8dc96e8..cc692c7a0660 100644
--- a/include/asm-cris/arch-v10/processor.h
+++ b/include/asm-cris/arch-v10/processor.h
@@ -40,7 +40,7 @@ struct thread_struct {
40#define KSTK_EIP(tsk) \ 40#define KSTK_EIP(tsk) \
41({ \ 41({ \
42 unsigned long eip = 0; \ 42 unsigned long eip = 0; \
43 unsigned long regs = (unsigned long)user_regs(tsk); \ 43 unsigned long regs = (unsigned long)task_pt_regs(tsk); \
44 if (regs > PAGE_SIZE && \ 44 if (regs > PAGE_SIZE && \
45 virt_addr_valid(regs)) \ 45 virt_addr_valid(regs)) \
46 eip = ((struct pt_regs *)regs)->irp; \ 46 eip = ((struct pt_regs *)regs)->irp; \
diff --git a/include/asm-cris/arch-v32/cache.h b/include/asm-cris/arch-v32/cache.h
index 4fed8d62ccc8..80b236b15319 100644
--- a/include/asm-cris/arch-v32/cache.h
+++ b/include/asm-cris/arch-v32/cache.h
@@ -4,6 +4,5 @@
4/* A cache-line is 32 bytes. */ 4/* A cache-line is 32 bytes. */
5#define L1_CACHE_BYTES 32 5#define L1_CACHE_BYTES 32
6#define L1_CACHE_SHIFT 5 6#define L1_CACHE_SHIFT 5
7#define L1_CACHE_SHIFT_MAX 5
8 7
9#endif /* _ASM_CRIS_ARCH_CACHE_H */ 8#endif /* _ASM_CRIS_ARCH_CACHE_H */
diff --git a/include/asm-cris/arch-v32/processor.h b/include/asm-cris/arch-v32/processor.h
index 8c939bf27987..32bf2e538ced 100644
--- a/include/asm-cris/arch-v32/processor.h
+++ b/include/asm-cris/arch-v32/processor.h
@@ -36,7 +36,7 @@ struct thread_struct {
36#define KSTK_EIP(tsk) \ 36#define KSTK_EIP(tsk) \
37({ \ 37({ \
38 unsigned long eip = 0; \ 38 unsigned long eip = 0; \
39 unsigned long regs = (unsigned long)user_regs(tsk); \ 39 unsigned long regs = (unsigned long)task_pt_regs(tsk); \
40 if (regs > PAGE_SIZE && virt_addr_valid(regs)) \ 40 if (regs > PAGE_SIZE && virt_addr_valid(regs)) \
41 eip = ((struct pt_regs *)regs)->erp; \ 41 eip = ((struct pt_regs *)regs)->erp; \
42 eip; \ 42 eip; \
diff --git a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h
index 683b05a57d88..0b51a87e5532 100644
--- a/include/asm-cris/atomic.h
+++ b/include/asm-cris/atomic.h
@@ -136,6 +136,8 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
136 return ret; 136 return ret;
137} 137}
138 138
139#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
140
139static inline int atomic_add_unless(atomic_t *v, int a, int u) 141static inline int atomic_add_unless(atomic_t *v, int a, int u)
140{ 142{
141 int ret; 143 int ret;
@@ -156,4 +158,5 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
156#define smp_mb__before_atomic_inc() barrier() 158#define smp_mb__before_atomic_inc() barrier()
157#define smp_mb__after_atomic_inc() barrier() 159#define smp_mb__after_atomic_inc() barrier()
158 160
161#include <asm-generic/atomic.h>
159#endif 162#endif
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index 1bddb3f3a289..d3eb0f1e4208 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -240,6 +240,7 @@ static inline int test_bit(int nr, const volatile unsigned long *addr)
240 */ 240 */
241 241
242#define fls(x) generic_fls(x) 242#define fls(x) generic_fls(x)
243#define fls64(x) generic_fls64(x)
243 244
244/* 245/*
245 * hweightN - returns the hamming weight of a N-bit word 246 * hweightN - returns the hamming weight of a N-bit word
diff --git a/include/asm-cris/dma-mapping.h b/include/asm-cris/dma-mapping.h
index 8eff51349ae7..cbf1a98f0129 100644
--- a/include/asm-cris/dma-mapping.h
+++ b/include/asm-cris/dma-mapping.h
@@ -153,7 +153,7 @@ dma_set_mask(struct device *dev, u64 mask)
153static inline int 153static inline int
154dma_get_cache_alignment(void) 154dma_get_cache_alignment(void)
155{ 155{
156 return (1 << L1_CACHE_SHIFT_MAX); 156 return (1 << INTERNODE_CACHE_SHIFT);
157} 157}
158 158
159#define dma_is_consistent(d) (1) 159#define dma_is_consistent(d) (1)
diff --git a/include/asm-cris/futex.h b/include/asm-cris/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-cris/futex.h
+++ b/include/asm-cris/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-cris/ioctl.h b/include/asm-cris/ioctl.h
index be2d8f667a38..b279fe06dfe5 100644
--- a/include/asm-cris/ioctl.h
+++ b/include/asm-cris/ioctl.h
@@ -1,83 +1 @@
1/* #include <asm-generic/ioctl.h>
2 * linux/ioctl.h for Linux by H.H. Bergman.
3 *
4 * This is the same as the i386 version.
5 */
6
7#ifndef _ASMCRIS_IOCTL_H
8#define _ASMCRIS_IOCTL_H
9
10/* ioctl command encoding: 32 bits total, command in lower 16 bits,
11 * size of the parameter structure in the lower 14 bits of the
12 * upper 16 bits.
13 * Encoding the size of the parameter structure in the ioctl request
14 * is useful for catching programs compiled with old versions
15 * and to avoid overwriting user space outside the user buffer area.
16 * The highest 2 bits are reserved for indicating the ``access mode''.
17 * NOTE: This limits the max parameter size to 16kB -1 !
18 */
19
20/*
21 * The following is for compatibility across the various Linux
22 * platforms. The i386 ioctl numbering scheme doesn't really enforce
23 * a type field. De facto, however, the top 8 bits of the lower 16
24 * bits are indeed used as a type field, so we might just as well make
25 * this explicit here. Please be sure to use the decoding macros
26 * below from now on.
27 */
28#define _IOC_NRBITS 8
29#define _IOC_TYPEBITS 8
30#define _IOC_SIZEBITS 14
31#define _IOC_DIRBITS 2
32
33#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
34#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
35#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
36#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
37
38#define _IOC_NRSHIFT 0
39#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
40#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
41#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
42
43/*
44 * Direction bits.
45 */
46#define _IOC_NONE 0U
47#define _IOC_WRITE 1U
48#define _IOC_READ 2U
49
50#define _IOC(dir,type,nr,size) \
51 (((dir) << _IOC_DIRSHIFT) | \
52 ((type) << _IOC_TYPESHIFT) | \
53 ((nr) << _IOC_NRSHIFT) | \
54 ((size) << _IOC_SIZESHIFT))
55
56/* provoke compile error for invalid uses of size argument */
57extern int __invalid_size_argument_for_IOC;
58#define _IOC_TYPECHECK(t) \
59 ((sizeof(t) == sizeof(t[1]) && \
60 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
61 sizeof(t) : __invalid_size_argument_for_IOC)
62
63/* used to create numbers */
64#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
65#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
66#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
67#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
68
69/* used to decode ioctl numbers.. */
70#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
71#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
72#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
73#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
74
75/* ...and for the drivers/sound files... */
76
77#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
78#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
79#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
80#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
81#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
82
83#endif /* _ASMCRIS_IOCTL_H */
diff --git a/include/asm-cris/mman.h b/include/asm-cris/mman.h
index 8570e72b9502..5a382b8bf3f7 100644
--- a/include/asm-cris/mman.h
+++ b/include/asm-cris/mman.h
@@ -37,6 +37,7 @@
37#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 37#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
38#define MADV_WILLNEED 0x3 /* pre-fault pages */ 38#define MADV_WILLNEED 0x3 /* pre-fault pages */
39#define MADV_DONTNEED 0x4 /* discard these pages */ 39#define MADV_DONTNEED 0x4 /* discard these pages */
40#define MADV_REMOVE 0x5 /* remove these pages & resources */
40 41
41/* compatibility flags */ 42/* compatibility flags */
42#define MAP_ANON MAP_ANONYMOUS 43#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-cris/mutex.h b/include/asm-cris/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-cris/mutex.h
@@ -0,0 +1,9 @@
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-cris/processor.h b/include/asm-cris/processor.h
index dce41009eeb0..961e2bceadbc 100644
--- a/include/asm-cris/processor.h
+++ b/include/asm-cris/processor.h
@@ -45,7 +45,8 @@ struct task_struct;
45 * Dito but for the currently running task 45 * Dito but for the currently running task
46 */ 46 */
47 47
48#define current_regs() user_regs(current->thread_info) 48#define task_pt_regs(task) user_regs(task_thread_info(task))
49#define current_regs() task_pt_regs(current)
49 50
50static inline void prepare_to_copy(struct task_struct *tsk) 51static inline void prepare_to_copy(struct task_struct *tsk)
51{ 52{
diff --git a/include/asm-cris/thread_info.h b/include/asm-cris/thread_info.h
index cef0140fc104..7ad853c3f74e 100644
--- a/include/asm-cris/thread_info.h
+++ b/include/asm-cris/thread_info.h
@@ -69,8 +69,6 @@ struct thread_info {
69/* thread information allocation */ 69/* thread information allocation */
70#define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) 70#define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
71#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 71#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
72#define get_thread_info(ti) get_task_struct((ti)->task)
73#define put_thread_info(ti) put_task_struct((ti)->task)
74 72
75#endif /* !__ASSEMBLY__ */ 73#endif /* !__ASSEMBLY__ */
76 74
diff --git a/include/asm-frv/atomic.h b/include/asm-frv/atomic.h
index f6539ff569c5..a59f684b4f33 100644
--- a/include/asm-frv/atomic.h
+++ b/include/asm-frv/atomic.h
@@ -218,51 +218,12 @@ extern unsigned long atomic_test_and_XOR_mask(unsigned long mask, volatile unsig
218 __typeof__(*(ptr)) __xg_orig; \ 218 __typeof__(*(ptr)) __xg_orig; \
219 \ 219 \
220 switch (sizeof(__xg_orig)) { \ 220 switch (sizeof(__xg_orig)) { \
221 case 1: \
222 asm volatile( \
223 "0: \n" \
224 " orcc gr0,gr0,gr0,icc3 \n" \
225 " ckeq icc3,cc7 \n" \
226 " ldub.p %M0,%1 \n" \
227 " orcr cc7,cc7,cc3 \n" \
228 " cstb.p %2,%M0 ,cc3,#1 \n" \
229 " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
230 " beq icc3,#0,0b \n" \
231 : "+U"(*__xg_ptr), "=&r"(__xg_orig) \
232 : "r"(x) \
233 : "memory", "cc7", "cc3", "icc3" \
234 ); \
235 break; \
236 \
237 case 2: \
238 asm volatile( \
239 "0: \n" \
240 " orcc gr0,gr0,gr0,icc3 \n" \
241 " ckeq icc3,cc7 \n" \
242 " lduh.p %M0,%1 \n" \
243 " orcr cc7,cc7,cc3 \n" \
244 " csth.p %2,%M0 ,cc3,#1 \n" \
245 " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
246 " beq icc3,#0,0b \n" \
247 : "+U"(*__xg_ptr), "=&r"(__xg_orig) \
248 : "r"(x) \
249 : "memory", "cc7", "cc3", "icc3" \
250 ); \
251 break; \
252 \
253 case 4: \ 221 case 4: \
254 asm volatile( \ 222 asm volatile( \
255 "0: \n" \ 223 "swap%I0 %2,%M0" \
256 " orcc gr0,gr0,gr0,icc3 \n" \ 224 : "+m"(*__xg_ptr), "=&r"(__xg_orig) \
257 " ckeq icc3,cc7 \n" \
258 " ld.p %M0,%1 \n" \
259 " orcr cc7,cc7,cc3 \n" \
260 " cst.p %2,%M0 ,cc3,#1 \n" \
261 " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
262 " beq icc3,#0,0b \n" \
263 : "+U"(*__xg_ptr), "=&r"(__xg_orig) \
264 : "r"(x) \ 225 : "r"(x) \
265 : "memory", "cc7", "cc3", "icc3" \ 226 : "memory" \
266 ); \ 227 ); \
267 break; \ 228 break; \
268 \ 229 \
@@ -277,8 +238,6 @@ extern unsigned long atomic_test_and_XOR_mask(unsigned long mask, volatile unsig
277 238
278#else 239#else
279 240
280extern uint8_t __xchg_8 (uint8_t i, volatile void *v);
281extern uint16_t __xchg_16(uint16_t i, volatile void *v);
282extern uint32_t __xchg_32(uint32_t i, volatile void *v); 241extern uint32_t __xchg_32(uint32_t i, volatile void *v);
283 242
284#define xchg(ptr, x) \ 243#define xchg(ptr, x) \
@@ -287,8 +246,6 @@ extern uint32_t __xchg_32(uint32_t i, volatile void *v);
287 __typeof__(*(ptr)) __xg_orig; \ 246 __typeof__(*(ptr)) __xg_orig; \
288 \ 247 \
289 switch (sizeof(__xg_orig)) { \ 248 switch (sizeof(__xg_orig)) { \
290 case 1: __xg_orig = (__typeof__(*(ptr))) __xchg_8 ((uint8_t) x, __xg_ptr); break; \
291 case 2: __xg_orig = (__typeof__(*(ptr))) __xchg_16((uint16_t) x, __xg_ptr); break; \
292 case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \ 249 case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \
293 default: \ 250 default: \
294 __xg_orig = 0; \ 251 __xg_orig = 0; \
@@ -318,46 +275,6 @@ extern uint32_t __xchg_32(uint32_t i, volatile void *v);
318 __typeof__(*(ptr)) __xg_new = (new); \ 275 __typeof__(*(ptr)) __xg_new = (new); \
319 \ 276 \
320 switch (sizeof(__xg_orig)) { \ 277 switch (sizeof(__xg_orig)) { \
321 case 1: \
322 asm volatile( \
323 "0: \n" \
324 " orcc gr0,gr0,gr0,icc3 \n" \
325 " ckeq icc3,cc7 \n" \
326 " ldub.p %M0,%1 \n" \
327 " orcr cc7,cc7,cc3 \n" \
328 " sub%I4 %1,%4,%2 \n" \
329 " sllcc %2,#24,gr0,icc0 \n" \
330 " bne icc0,#0,1f \n" \
331 " cstb.p %3,%M0 ,cc3,#1 \n" \
332 " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
333 " beq icc3,#0,0b \n" \
334 "1: \n" \
335 : "+U"(*__xg_ptr), "=&r"(__xg_orig), "=&r"(__xg_tmp) \
336 : "r"(__xg_new), "NPr"(__xg_test) \
337 : "memory", "cc7", "cc3", "icc3", "icc0" \
338 ); \
339 break; \
340 \
341 case 2: \
342 asm volatile( \
343 "0: \n" \
344 " orcc gr0,gr0,gr0,icc3 \n" \
345 " ckeq icc3,cc7 \n" \
346 " lduh.p %M0,%1 \n" \
347 " orcr cc7,cc7,cc3 \n" \
348 " sub%I4 %1,%4,%2 \n" \
349 " sllcc %2,#16,gr0,icc0 \n" \
350 " bne icc0,#0,1f \n" \
351 " csth.p %3,%M0 ,cc3,#1 \n" \
352 " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
353 " beq icc3,#0,0b \n" \
354 "1: \n" \
355 : "+U"(*__xg_ptr), "=&r"(__xg_orig), "=&r"(__xg_tmp) \
356 : "r"(__xg_new), "NPr"(__xg_test) \
357 : "memory", "cc7", "cc3", "icc3", "icc0" \
358 ); \
359 break; \
360 \
361 case 4: \ 278 case 4: \
362 asm volatile( \ 279 asm volatile( \
363 "0: \n" \ 280 "0: \n" \
@@ -388,8 +305,6 @@ extern uint32_t __xchg_32(uint32_t i, volatile void *v);
388 305
389#else 306#else
390 307
391extern uint8_t __cmpxchg_8 (uint8_t *v, uint8_t test, uint8_t new);
392extern uint16_t __cmpxchg_16(uint16_t *v, uint16_t test, uint16_t new);
393extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new); 308extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new);
394 309
395#define cmpxchg(ptr, test, new) \ 310#define cmpxchg(ptr, test, new) \
@@ -400,8 +315,6 @@ extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new);
400 __typeof__(*(ptr)) __xg_new = (new); \ 315 __typeof__(*(ptr)) __xg_new = (new); \
401 \ 316 \
402 switch (sizeof(__xg_orig)) { \ 317 switch (sizeof(__xg_orig)) { \
403 case 1: __xg_orig = __cmpxchg_8 (__xg_ptr, __xg_test, __xg_new); break; \
404 case 2: __xg_orig = __cmpxchg_16(__xg_ptr, __xg_test, __xg_new); break; \
405 case 4: __xg_orig = __cmpxchg_32(__xg_ptr, __xg_test, __xg_new); break; \ 318 case 4: __xg_orig = __cmpxchg_32(__xg_ptr, __xg_test, __xg_new); break; \
406 default: \ 319 default: \
407 __xg_orig = 0; \ 320 __xg_orig = 0; \
@@ -414,7 +327,8 @@ extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new);
414 327
415#endif 328#endif
416 329
417#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new)) 330#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new))
331#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
418 332
419#define atomic_add_unless(v, a, u) \ 333#define atomic_add_unless(v, a, u) \
420({ \ 334({ \
@@ -424,6 +338,8 @@ extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new);
424 c = old; \ 338 c = old; \
425 c != (u); \ 339 c != (u); \
426}) 340})
341
427#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 342#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
428 343
344#include <asm-generic/atomic.h>
429#endif /* _ASM_ATOMIC_H */ 345#endif /* _ASM_ATOMIC_H */
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index b664bd5b6663..02be7b3a8a83 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -228,6 +228,7 @@ found_middle:
228 \ 228 \
229 bit ? 33 - bit : bit; \ 229 bit ? 33 - bit : bit; \
230}) 230})
231#define fls64(x) generic_fls64(x)
231 232
232/* 233/*
233 * Every architecture must define this function. It's the fastest 234 * Every architecture must define this function. It's the fastest
diff --git a/include/asm-frv/bug.h b/include/asm-frv/bug.h
index 074c0d5770eb..451712cc3060 100644
--- a/include/asm-frv/bug.h
+++ b/include/asm-frv/bug.h
@@ -12,6 +12,7 @@
12#define _ASM_BUG_H 12#define _ASM_BUG_H
13 13
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/linkage.h>
15 16
16#ifdef CONFIG_BUG 17#ifdef CONFIG_BUG
17/* 18/*
diff --git a/include/asm-frv/dma-mapping.h b/include/asm-frv/dma-mapping.h
index 5003e017fd1e..e9fc1d47797e 100644
--- a/include/asm-frv/dma-mapping.h
+++ b/include/asm-frv/dma-mapping.h
@@ -23,7 +23,7 @@ void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t
23 * returns, or alternatively stop on the first sg_dma_len(sg) which 23 * returns, or alternatively stop on the first sg_dma_len(sg) which
24 * is 0. 24 * is 0.
25 */ 25 */
26#define sg_dma_address(sg) ((unsigned long) (page_to_phys((sg)->page) + (sg)->offset)) 26#define sg_dma_address(sg) ((sg)->dma_address)
27#define sg_dma_len(sg) ((sg)->length) 27#define sg_dma_len(sg) ((sg)->length)
28 28
29/* 29/*
diff --git a/include/asm-frv/futex.h b/include/asm-frv/futex.h
index 9feff4ce1424..fca9d90e32c9 100644
--- a/include/asm-frv/futex.h
+++ b/include/asm-frv/futex.h
@@ -7,47 +7,7 @@
7#include <asm/errno.h> 7#include <asm/errno.h>
8#include <asm/uaccess.h> 8#include <asm/uaccess.h>
9 9
10static inline int 10extern int futex_atomic_op_inuser(int encoded_op, int __user *uaddr);
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51 11
52#endif 12#endif
53#endif 13#endif
diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h
index 48829f727242..075369b1a34b 100644
--- a/include/asm-frv/io.h
+++ b/include/asm-frv/io.h
@@ -18,6 +18,7 @@
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19 19
20#include <linux/config.h> 20#include <linux/config.h>
21#include <linux/types.h>
21#include <asm/virtconvert.h> 22#include <asm/virtconvert.h>
22#include <asm/string.h> 23#include <asm/string.h>
23#include <asm/mb-regs.h> 24#include <asm/mb-regs.h>
@@ -104,6 +105,8 @@ static inline void __insl(unsigned long addr, void *buf, int len, int swap)
104 __insl_sw(addr, buf, len); 105 __insl_sw(addr, buf, len);
105} 106}
106 107
108#define mmiowb() mb()
109
107/* 110/*
108 * make the short names macros so specific devices 111 * make the short names macros so specific devices
109 * can override them as required 112 * can override them as required
@@ -209,6 +212,10 @@ static inline uint32_t readl(const volatile void __iomem *addr)
209 return ret; 212 return ret;
210} 213}
211 214
215#define readb_relaxed readb
216#define readw_relaxed readw
217#define readl_relaxed readl
218
212static inline void writeb(uint8_t datum, volatile void __iomem *addr) 219static inline void writeb(uint8_t datum, volatile void __iomem *addr)
213{ 220{
214 __builtin_write8((volatile uint8_t __force *) addr, datum); 221 __builtin_write8((volatile uint8_t __force *) addr, datum);
@@ -268,11 +275,106 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned l
268 275
269extern void iounmap(void __iomem *addr); 276extern void iounmap(void __iomem *addr);
270 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
271static inline void flush_write_buffers(void) 287static inline void flush_write_buffers(void)
272{ 288{
273 __asm__ __volatile__ ("membar" : : :"memory"); 289 __asm__ __volatile__ ("membar" : : :"memory");
274} 290}
275 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
276 378
277/* 379/*
278 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 380 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
@@ -285,6 +387,27 @@ static inline void flush_write_buffers(void)
285 */ 387 */
286#define xlate_dev_kmem_ptr(p) p 388#define xlate_dev_kmem_ptr(p) p
287 389
390/*
391 * Check BIOS signature
392 */
393static inline int check_signature(volatile void __iomem *io_addr,
394 const unsigned char *signature, int length)
395{
396 int retval = 0;
397
398 do {
399 if (readb(io_addr) != *signature)
400 goto out;
401 io_addr++;
402 signature++;
403 length--;
404 } while (length);
405
406 retval = 1;
407out:
408 return retval;
409}
410
288#endif /* __KERNEL__ */ 411#endif /* __KERNEL__ */
289 412
290#endif /* _ASM_IO_H */ 413#endif /* _ASM_IO_H */
diff --git a/include/asm-frv/ioctl.h b/include/asm-frv/ioctl.h
index 8aee76905545..b279fe06dfe5 100644
--- a/include/asm-frv/ioctl.h
+++ b/include/asm-frv/ioctl.h
@@ -1,80 +1 @@
1/* #include <asm-generic/ioctl.h>
2 * linux/ioctl.h for Linux by H.H. Bergman.
3 */
4
5#ifndef _ASM_IOCTL_H
6#define _ASM_IOCTL_H
7
8/* ioctl command encoding: 32 bits total, command in lower 16 bits,
9 * size of the parameter structure in the lower 14 bits of the
10 * upper 16 bits.
11 * Encoding the size of the parameter structure in the ioctl request
12 * is useful for catching programs compiled with old versions
13 * and to avoid overwriting user space outside the user buffer area.
14 * The highest 2 bits are reserved for indicating the ``access mode''.
15 * NOTE: This limits the max parameter size to 16kB -1 !
16 */
17
18/*
19 * I don't really have any idea about what this should look like, so
20 * for the time being, this is heavily based on the PC definitions.
21 */
22
23/*
24 * The following is for compatibility across the various Linux
25 * platforms. The i386 ioctl numbering scheme doesn't really enforce
26 * a type field. De facto, however, the top 8 bits of the lower 16
27 * bits are indeed used as a type field, so we might just as well make
28 * this explicit here. Please be sure to use the decoding macros
29 * below from now on.
30 */
31#define _IOC_NRBITS 8
32#define _IOC_TYPEBITS 8
33#define _IOC_SIZEBITS 14
34#define _IOC_DIRBITS 2
35
36#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
37#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
38#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
39#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
40
41#define _IOC_NRSHIFT 0
42#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
43#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
44#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
45
46/*
47 * Direction bits.
48 */
49#define _IOC_NONE 0U
50#define _IOC_WRITE 1U
51#define _IOC_READ 2U
52
53#define _IOC(dir,type,nr,size) \
54 (((dir) << _IOC_DIRSHIFT) | \
55 ((type) << _IOC_TYPESHIFT) | \
56 ((nr) << _IOC_NRSHIFT) | \
57 ((size) << _IOC_SIZESHIFT))
58
59/* used to create numbers */
60#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
61#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
62#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
63#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
64
65/* used to decode ioctl numbers.. */
66#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
67#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
68#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
69#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
70
71/* ...and for the drivers/sound files... */
72
73#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
74#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
75#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
76#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
77#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
78
79#endif /* _ASM_IOCTL_H */
80
diff --git a/include/asm-frv/mb-regs.h b/include/asm-frv/mb-regs.h
index c8f575fc42fa..93fa732fb0cd 100644
--- a/include/asm-frv/mb-regs.h
+++ b/include/asm-frv/mb-regs.h
@@ -68,6 +68,9 @@ do { \
68#define __is_PCI_MEM(addr) \ 68#define __is_PCI_MEM(addr) \
69 ((unsigned long)(addr) - __region_PCI_MEM < 0x08000000UL) 69 ((unsigned long)(addr) - __region_PCI_MEM < 0x08000000UL)
70 70
71#define __is_PCI_addr(addr) \
72 ((unsigned long)(addr) - __region_PCI_IO < 0x0c000000UL)
73
71#define __get_CLKSW() ({ *(volatile unsigned long *)(__region_CS2 + 0x0130000cUL) & 0xffUL; }) 74#define __get_CLKSW() ({ *(volatile unsigned long *)(__region_CS2 + 0x0130000cUL) & 0xffUL; })
72#define __get_CLKIN() (__get_CLKSW() * 125U * 100000U / 24U) 75#define __get_CLKIN() (__get_CLKSW() * 125U * 100000U / 24U)
73 76
@@ -149,6 +152,7 @@ do { \
149 152
150#define __is_PCI_IO(addr) 0 /* no PCI */ 153#define __is_PCI_IO(addr) 0 /* no PCI */
151#define __is_PCI_MEM(addr) 0 154#define __is_PCI_MEM(addr) 0
155#define __is_PCI_addr(addr) 0
152#define __region_PCI_IO 0 156#define __region_PCI_IO 0
153#define __region_PCI_MEM 0 157#define __region_PCI_MEM 0
154#define __flush_PCI_writes() do { } while(0) 158#define __flush_PCI_writes() do { } while(0)
diff --git a/include/asm-frv/mc146818rtc.h b/include/asm-frv/mc146818rtc.h
new file mode 100644
index 000000000000..90dfb7a633d1
--- /dev/null
+++ b/include/asm-frv/mc146818rtc.h
@@ -0,0 +1,16 @@
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/mman.h b/include/asm-frv/mman.h
index c684720dfbdd..8af4a41c255e 100644
--- a/include/asm-frv/mman.h
+++ b/include/asm-frv/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-frv/module.h b/include/asm-frv/module.h
index 3223cfaef743..3d5c6360289a 100644
--- a/include/asm-frv/module.h
+++ b/include/asm-frv/module.h
@@ -11,10 +11,18 @@
11#ifndef _ASM_MODULE_H 11#ifndef _ASM_MODULE_H
12#define _ASM_MODULE_H 12#define _ASM_MODULE_H
13 13
14#define module_map(x) vmalloc(x) 14struct mod_arch_specific
15#define module_unmap(x) vfree(x) 15{
16#define module_arch_init(x) (0) 16};
17#define arch_init_modules(x) do { } while (0) 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) " "
18 26
19#endif /* _ASM_MODULE_H */ 27#endif /* _ASM_MODULE_H */
20 28
diff --git a/include/asm-frv/mutex.h b/include/asm-frv/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-frv/mutex.h
@@ -0,0 +1,9 @@
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/pci.h b/include/asm-frv/pci.h
index 1168451c275f..598b0c6b695d 100644
--- a/include/asm-frv/pci.h
+++ b/include/asm-frv/pci.h
@@ -57,6 +57,14 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
57 */ 57 */
58#define PCI_DMA_BUS_IS_PHYS (1) 58#define PCI_DMA_BUS_IS_PHYS (1)
59 59
60/* pci_unmap_{page,single} is a nop so... */
61#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
62#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
63#define pci_unmap_addr(PTR, ADDR_NAME) (0)
64#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
65#define pci_unmap_len(PTR, LEN_NAME) (0)
66#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
67
60#ifdef CONFIG_PCI 68#ifdef CONFIG_PCI
61static inline void pci_dma_burst_advice(struct pci_dev *pdev, 69static inline void pci_dma_burst_advice(struct pci_dev *pdev,
62 enum pci_dma_burst_strategy *strat, 70 enum pci_dma_burst_strategy *strat,
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 844666377dcb..d1c3b182c691 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -421,6 +421,11 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
421} 421}
422 422
423/* 423/*
424 * Macro to mark a page protection value as "uncacheable"
425 */
426#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE))
427
428/*
424 * Conversion functions: convert a page and protection to a page entry, 429 * Conversion functions: convert a page and protection to a page entry,
425 * and a page entry and page directory to the page they refer to. 430 * and a page entry and page directory to the page they refer to.
426 */ 431 */
diff --git a/include/asm-frv/signal.h b/include/asm-frv/signal.h
index d407bde57eca..67366894780f 100644
--- a/include/asm-frv/signal.h
+++ b/include/asm-frv/signal.h
@@ -151,7 +151,6 @@ typedef struct sigaltstack {
151 size_t ss_size; 151 size_t ss_size;
152} stack_t; 152} stack_t;
153 153
154extern int do_signal(struct pt_regs *regs, sigset_t *oldset);
155#define ptrace_signal_deliver(regs, cookie) do { } while (0) 154#define ptrace_signal_deliver(regs, cookie) do { } while (0)
156 155
157#ifdef __KERNEL__ 156#ifdef __KERNEL__
diff --git a/include/asm-frv/thread_info.h b/include/asm-frv/thread_info.h
index 60f6b2aee76d..a5576e02dd1d 100644
--- a/include/asm-frv/thread_info.h
+++ b/include/asm-frv/thread_info.h
@@ -110,8 +110,6 @@ register struct thread_info *__current_thread_info asm("gr15");
110#endif 110#endif
111 111
112#define free_thread_info(info) kfree(info) 112#define free_thread_info(info) kfree(info)
113#define get_thread_info(ti) get_task_struct((ti)->task)
114#define put_thread_info(ti) put_task_struct((ti)->task)
115 113
116#else /* !__ASSEMBLY__ */ 114#else /* !__ASSEMBLY__ */
117 115
diff --git a/include/asm-frv/types.h b/include/asm-frv/types.h
index 50605df6d8ac..2560f596a75d 100644
--- a/include/asm-frv/types.h
+++ b/include/asm-frv/types.h
@@ -59,7 +59,6 @@ typedef unsigned int u32;
59 59
60typedef signed long long s64; 60typedef signed long long s64;
61typedef unsigned long long u64; 61typedef unsigned long long u64;
62typedef u64 u_quad_t;
63 62
64/* Dma addresses are 32-bits wide. */ 63/* Dma addresses are 32-bits wide. */
65 64
diff --git a/include/asm-frv/uaccess.h b/include/asm-frv/uaccess.h
index 991b50fbba24..b6bcbe01f6ee 100644
--- a/include/asm-frv/uaccess.h
+++ b/include/asm-frv/uaccess.h
@@ -180,16 +180,16 @@ do { \
180 \ 180 \
181 switch (sizeof(*(ptr))) { \ 181 switch (sizeof(*(ptr))) { \
182 case 1: \ 182 case 1: \
183 __get_user_asm(__gu_err, __gu_val, ptr, "ub", "=r"); \ 183 __get_user_asm(__gu_err, *(u8*)&__gu_val, ptr, "ub", "=r"); \
184 break; \ 184 break; \
185 case 2: \ 185 case 2: \
186 __get_user_asm(__gu_err, __gu_val, ptr, "uh", "=r"); \ 186 __get_user_asm(__gu_err, *(u16*)&__gu_val, ptr, "uh", "=r"); \
187 break; \ 187 break; \
188 case 4: \ 188 case 4: \
189 __get_user_asm(__gu_err, __gu_val, ptr, "", "=r"); \ 189 __get_user_asm(__gu_err, *(u32*)&__gu_val, ptr, "", "=r"); \
190 break; \ 190 break; \
191 case 8: \ 191 case 8: \
192 __get_user_asm(__gu_err, __gu_val, ptr, "d", "=e"); \ 192 __get_user_asm(__gu_err, *(u64*)&__gu_val, ptr, "d", "=e"); \
193 break; \ 193 break; \
194 default: \ 194 default: \
195 __gu_err = __get_user_bad(); \ 195 __gu_err = __get_user_bad(); \
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index 5cf989b448d5..cde376a7a857 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -313,7 +313,7 @@ do { \
313 unsigned long __sr2 = (res); \ 313 unsigned long __sr2 = (res); \
314 if (__builtin_expect(__sr2 >= (unsigned long)(-4095), 0)) { \ 314 if (__builtin_expect(__sr2 >= (unsigned long)(-4095), 0)) { \
315 errno = (-__sr2); \ 315 errno = (-__sr2); \
316 __sr2 = ULONG_MAX; \ 316 __sr2 = ~0UL; \
317 } \ 317 } \
318 return (type) __sr2; \ 318 return (type) __sr2; \
319} while (0) 319} while (0)
diff --git a/include/asm-frv/vga.h b/include/asm-frv/vga.h
new file mode 100644
index 000000000000..a702c800a229
--- /dev/null
+++ b/include/asm-frv/vga.h
@@ -0,0 +1,17 @@
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/xor.h b/include/asm-frv/xor.h
new file mode 100644
index 000000000000..c82eb12a5b18
--- /dev/null
+++ b/include/asm-frv/xor.h
@@ -0,0 +1 @@
#include <asm-generic/xor.h>
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
new file mode 100644
index 000000000000..0fada8f16dc6
--- /dev/null
+++ b/include/asm-generic/atomic.h
@@ -0,0 +1,117 @@
1#ifndef _ASM_GENERIC_ATOMIC_H
2#define _ASM_GENERIC_ATOMIC_H
3/*
4 * Copyright (C) 2005 Silicon Graphics, Inc.
5 * Christoph Lameter <clameter@sgi.com>
6 *
7 * Allows to provide arch independent atomic definitions without the need to
8 * edit all arch specific atomic.h files.
9 */
10
11#include <asm/types.h>
12
13/*
14 * Suppport for atomic_long_t
15 *
16 * Casts for parameters are avoided for existing atomic functions in order to
17 * avoid issues with cast-as-lval under gcc 4.x and other limitations that the
18 * macros of a platform may have.
19 */
20
21#if BITS_PER_LONG == 64
22
23typedef atomic64_t atomic_long_t;
24
25#define ATOMIC_LONG_INIT(i) ATOMIC64_INIT(i)
26
27static inline long atomic_long_read(atomic_long_t *l)
28{
29 atomic64_t *v = (atomic64_t *)l;
30
31 return (long)atomic64_read(v);
32}
33
34static inline void atomic_long_set(atomic_long_t *l, long i)
35{
36 atomic64_t *v = (atomic64_t *)l;
37
38 atomic_set(v, i);
39}
40
41static inline void atomic_long_inc(atomic_long_t *l)
42{
43 atomic64_t *v = (atomic64_t *)l;
44
45 atomic64_inc(v);
46}
47
48static inline void atomic_long_dec(atomic_long_t *l)
49{
50 atomic64_t *v = (atomic64_t *)l;
51
52 atomic64_dec(v);
53}
54
55static inline void atomic_long_add(long i, atomic_long_t *l)
56{
57 atomic64_t *v = (atomic64_t *)l;
58
59 atomic64_add(i, v);
60}
61
62static inline void atomic_long_sub(long i, atomic_long_t *l)
63{
64 atomic64_t *v = (atomic64_t *)l;
65
66 atomic64_sub(i, v);
67}
68
69#else
70
71typedef atomic_t atomic_long_t;
72
73#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
74static inline long atomic_long_read(atomic_long_t *l)
75{
76 atomic_t *v = (atomic_t *)l;
77
78 return (long)atomic_read(v);
79}
80
81static inline void atomic_long_set(atomic_long_t *l, long i)
82{
83 atomic_t *v = (atomic_t *)l;
84
85 atomic_set(v, i);
86}
87
88static inline void atomic_long_inc(atomic_long_t *l)
89{
90 atomic_t *v = (atomic_t *)l;
91
92 atomic_inc(v);
93}
94
95static inline void atomic_long_dec(atomic_long_t *l)
96{
97 atomic_t *v = (atomic_t *)l;
98
99 atomic_dec(v);
100}
101
102static inline void atomic_long_add(long i, atomic_long_t *l)
103{
104 atomic_t *v = (atomic_t *)l;
105
106 atomic_add(i, v);
107}
108
109static inline void atomic_long_sub(long i, atomic_long_t *l)
110{
111 atomic_t *v = (atomic_t *)l;
112
113 atomic_sub(i, v);
114}
115
116#endif
117#endif
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index ce31b739fd80..0e6d9852008c 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -56,6 +56,7 @@ extern __inline__ int test_bit(int nr, const unsigned long * addr)
56 */ 56 */
57 57
58#define fls(x) generic_fls(x) 58#define fls(x) generic_fls(x)
59#define fls64(x) generic_fls64(x)
59 60
60#ifdef __KERNEL__ 61#ifdef __KERNEL__
61 62
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 747d790295f3..1b356207712c 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -274,7 +274,7 @@ dma_get_cache_alignment(void)
274{ 274{
275 /* no easy way to get cache size on all processors, so return 275 /* no easy way to get cache size on all processors, so return
276 * the maximum possible, to be safe */ 276 * the maximum possible, to be safe */
277 return (1 << L1_CACHE_SHIFT_MAX); 277 return (1 << INTERNODE_CACHE_SHIFT);
278} 278}
279 279
280static inline void 280static inline void
diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h
new file mode 100644
index 000000000000..3ae2c7347549
--- /dev/null
+++ b/include/asm-generic/futex.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_GENERIC_FUTEX_H
2#define _ASM_GENERIC_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h
new file mode 100644
index 000000000000..cd027298beb1
--- /dev/null
+++ b/include/asm-generic/ioctl.h
@@ -0,0 +1,80 @@
1#ifndef _ASM_GENERIC_IOCTL_H
2#define _ASM_GENERIC_IOCTL_H
3
4/* ioctl command encoding: 32 bits total, command in lower 16 bits,
5 * size of the parameter structure in the lower 14 bits of the
6 * upper 16 bits.
7 * Encoding the size of the parameter structure in the ioctl request
8 * is useful for catching programs compiled with old versions
9 * and to avoid overwriting user space outside the user buffer area.
10 * The highest 2 bits are reserved for indicating the ``access mode''.
11 * NOTE: This limits the max parameter size to 16kB -1 !
12 */
13
14/*
15 * The following is for compatibility across the various Linux
16 * platforms. The generic ioctl numbering scheme doesn't really enforce
17 * a type field. De facto, however, the top 8 bits of the lower 16
18 * bits are indeed used as a type field, so we might just as well make
19 * this explicit here. Please be sure to use the decoding macros
20 * below from now on.
21 */
22#define _IOC_NRBITS 8
23#define _IOC_TYPEBITS 8
24#define _IOC_SIZEBITS 14
25#define _IOC_DIRBITS 2
26
27#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
28#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
29#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
30#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
31
32#define _IOC_NRSHIFT 0
33#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
34#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
35#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
36
37/*
38 * Direction bits.
39 */
40#define _IOC_NONE 0U
41#define _IOC_WRITE 1U
42#define _IOC_READ 2U
43
44#define _IOC(dir,type,nr,size) \
45 (((dir) << _IOC_DIRSHIFT) | \
46 ((type) << _IOC_TYPESHIFT) | \
47 ((nr) << _IOC_NRSHIFT) | \
48 ((size) << _IOC_SIZESHIFT))
49
50/* provoke compile error for invalid uses of size argument */
51extern unsigned int __invalid_size_argument_for_IOC;
52#define _IOC_TYPECHECK(t) \
53 ((sizeof(t) == sizeof(t[1]) && \
54 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
55 sizeof(t) : __invalid_size_argument_for_IOC)
56
57/* used to create numbers */
58#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
59#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
60#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
61#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
62#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
63#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
64#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
65
66/* used to decode ioctl numbers.. */
67#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
68#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
69#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
70#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
71
72/* ...and for the drivers/sound files... */
73
74#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
75#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
76#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
77#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
78#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
79
80#endif /* _ASM_GENERIC_IOCTL_H */
diff --git a/include/asm-generic/mutex-dec.h b/include/asm-generic/mutex-dec.h
new file mode 100644
index 000000000000..40c6d1f86598
--- /dev/null
+++ b/include/asm-generic/mutex-dec.h
@@ -0,0 +1,110 @@
1/*
2 * asm-generic/mutex-dec.h
3 *
4 * Generic implementation of the mutex fastpath, based on atomic
5 * decrement/increment.
6 */
7#ifndef _ASM_GENERIC_MUTEX_DEC_H
8#define _ASM_GENERIC_MUTEX_DEC_H
9
10/**
11 * __mutex_fastpath_lock - try to take the lock by moving the count
12 * from 1 to a 0 value
13 * @count: pointer of type atomic_t
14 * @fail_fn: function to call if the original value was not 1
15 *
16 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
17 * it wasn't 1 originally. This function MUST leave the value lower than
18 * 1 even when the "1" assertion wasn't true.
19 */
20#define __mutex_fastpath_lock(count, fail_fn) \
21do { \
22 if (unlikely(atomic_dec_return(count) < 0)) \
23 fail_fn(count); \
24 else \
25 smp_mb(); \
26} while (0)
27
28/**
29 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
30 * from 1 to a 0 value
31 * @count: pointer of type atomic_t
32 * @fail_fn: function to call if the original value was not 1
33 *
34 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
35 * it wasn't 1 originally. This function returns 0 if the fastpath succeeds,
36 * or anything the slow path function returns.
37 */
38static inline int
39__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
40{
41 if (unlikely(atomic_dec_return(count) < 0))
42 return fail_fn(count);
43 else {
44 smp_mb();
45 return 0;
46 }
47}
48
49/**
50 * __mutex_fastpath_unlock - try to promote the count from 0 to 1
51 * @count: pointer of type atomic_t
52 * @fail_fn: function to call if the original value was not 0
53 *
54 * Try to promote the count from 0 to 1. If it wasn't 0, call <fail_fn>.
55 * In the failure case, this function is allowed to either set the value to
56 * 1, or to set it to a value lower than 1.
57 *
58 * If the implementation sets it to a value of lower than 1, then the
59 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
60 * to return 0 otherwise.
61 */
62#define __mutex_fastpath_unlock(count, fail_fn) \
63do { \
64 smp_mb(); \
65 if (unlikely(atomic_inc_return(count) <= 0)) \
66 fail_fn(count); \
67} while (0)
68
69#define __mutex_slowpath_needs_to_unlock() 1
70
71/**
72 * __mutex_fastpath_trylock - try to acquire the mutex, without waiting
73 *
74 * @count: pointer of type atomic_t
75 * @fail_fn: fallback function
76 *
77 * Change the count from 1 to a value lower than 1, and return 0 (failure)
78 * if it wasn't 1 originally, or return 1 (success) otherwise. This function
79 * MUST leave the value lower than 1 even when the "1" assertion wasn't true.
80 * Additionally, if the value was < 0 originally, this function must not leave
81 * it to 0 on failure.
82 *
83 * If the architecture has no effective trylock variant, it should call the
84 * <fail_fn> spinlock-based trylock variant unconditionally.
85 */
86static inline int
87__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
88{
89 /*
90 * We have two variants here. The cmpxchg based one is the best one
91 * because it never induce a false contention state. It is included
92 * here because architectures using the inc/dec algorithms over the
93 * xchg ones are much more likely to support cmpxchg natively.
94 *
95 * If not we fall back to the spinlock based variant - that is
96 * just as efficient (and simpler) as a 'destructive' probing of
97 * the mutex state would be.
98 */
99#ifdef __HAVE_ARCH_CMPXCHG
100 if (likely(atomic_cmpxchg(count, 1, 0) == 1)) {
101 smp_mb();
102 return 1;
103 }
104 return 0;
105#else
106 return fail_fn(count);
107#endif
108}
109
110#endif
diff --git a/include/asm-generic/mutex-null.h b/include/asm-generic/mutex-null.h
new file mode 100644
index 000000000000..5cf8b7ce0c45
--- /dev/null
+++ b/include/asm-generic/mutex-null.h
@@ -0,0 +1,24 @@
1/*
2 * asm-generic/mutex-null.h
3 *
4 * Generic implementation of the mutex fastpath, based on NOP :-)
5 *
6 * This is used by the mutex-debugging infrastructure, but it can also
7 * be used by architectures that (for whatever reason) want to use the
8 * spinlock based slowpath.
9 */
10#ifndef _ASM_GENERIC_MUTEX_NULL_H
11#define _ASM_GENERIC_MUTEX_NULL_H
12
13/* extra parameter only needed for mutex debugging: */
14#ifndef __IP__
15# define __IP__
16#endif
17
18#define __mutex_fastpath_lock(count, fail_fn) fail_fn(count __RET_IP__)
19#define __mutex_fastpath_lock_retval(count, fail_fn) fail_fn(count __RET_IP__)
20#define __mutex_fastpath_unlock(count, fail_fn) fail_fn(count __RET_IP__)
21#define __mutex_fastpath_trylock(count, fail_fn) fail_fn(count)
22#define __mutex_slowpath_needs_to_unlock() 1
23
24#endif
diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
new file mode 100644
index 000000000000..1d24f47e6c48
--- /dev/null
+++ b/include/asm-generic/mutex-xchg.h
@@ -0,0 +1,117 @@
1/*
2 * asm-generic/mutex-xchg.h
3 *
4 * Generic implementation of the mutex fastpath, based on xchg().
5 *
6 * NOTE: An xchg based implementation is less optimal than an atomic
7 * decrement/increment based implementation. If your architecture
8 * has a reasonable atomic dec/inc then you should probably use
9 * asm-generic/mutex-dec.h instead, or you could open-code an
10 * optimized version in asm/mutex.h.
11 */
12#ifndef _ASM_GENERIC_MUTEX_XCHG_H
13#define _ASM_GENERIC_MUTEX_XCHG_H
14
15/**
16 * __mutex_fastpath_lock - try to take the lock by moving the count
17 * from 1 to a 0 value
18 * @count: pointer of type atomic_t
19 * @fail_fn: function to call if the original value was not 1
20 *
21 * Change the count from 1 to a value lower than 1, and call <fail_fn> if it
22 * wasn't 1 originally. This function MUST leave the value lower than 1
23 * even when the "1" assertion wasn't true.
24 */
25#define __mutex_fastpath_lock(count, fail_fn) \
26do { \
27 if (unlikely(atomic_xchg(count, 0) != 1)) \
28 fail_fn(count); \
29 else \
30 smp_mb(); \
31} while (0)
32
33
34/**
35 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
36 * from 1 to a 0 value
37 * @count: pointer of type atomic_t
38 * @fail_fn: function to call if the original value was not 1
39 *
40 * Change the count from 1 to a value lower than 1, and call <fail_fn> if it
41 * wasn't 1 originally. This function returns 0 if the fastpath succeeds,
42 * or anything the slow path function returns
43 */
44static inline int
45__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
46{
47 if (unlikely(atomic_xchg(count, 0) != 1))
48 return fail_fn(count);
49 else {
50 smp_mb();
51 return 0;
52 }
53}
54
55/**
56 * __mutex_fastpath_unlock - try to promote the mutex from 0 to 1
57 * @count: pointer of type atomic_t
58 * @fail_fn: function to call if the original value was not 0
59 *
60 * try to promote the mutex from 0 to 1. if it wasn't 0, call <function>
61 * In the failure case, this function is allowed to either set the value to
62 * 1, or to set it to a value lower than one.
63 * If the implementation sets it to a value of lower than one, the
64 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
65 * to return 0 otherwise.
66 */
67#define __mutex_fastpath_unlock(count, fail_fn) \
68do { \
69 smp_mb(); \
70 if (unlikely(atomic_xchg(count, 1) != 0)) \
71 fail_fn(count); \
72} while (0)
73
74#define __mutex_slowpath_needs_to_unlock() 0
75
76/**
77 * __mutex_fastpath_trylock - try to acquire the mutex, without waiting
78 *
79 * @count: pointer of type atomic_t
80 * @fail_fn: spinlock based trylock implementation
81 *
82 * Change the count from 1 to a value lower than 1, and return 0 (failure)
83 * if it wasn't 1 originally, or return 1 (success) otherwise. This function
84 * MUST leave the value lower than 1 even when the "1" assertion wasn't true.
85 * Additionally, if the value was < 0 originally, this function must not leave
86 * it to 0 on failure.
87 *
88 * If the architecture has no effective trylock variant, it should call the
89 * <fail_fn> spinlock-based trylock variant unconditionally.
90 */
91static inline int
92__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
93{
94 int prev = atomic_xchg(count, 0);
95
96 if (unlikely(prev < 0)) {
97 /*
98 * The lock was marked contended so we must restore that
99 * state. If while doing so we get back a prev value of 1
100 * then we just own it.
101 *
102 * [ In the rare case of the mutex going to 1, to 0, to -1
103 * and then back to 0 in this few-instructions window,
104 * this has the potential to trigger the slowpath for the
105 * owner's unlock path needlessly, but that's not a problem
106 * in practice. ]
107 */
108 prev = atomic_xchg(count, prev);
109 if (prev < 0)
110 prev = 0;
111 }
112 smp_mb();
113
114 return prev;
115}
116
117#endif
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 094d4917c1a9..35de20cf8fac 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -10,6 +10,8 @@
10#define ALIGN_FUNCTION() . = ALIGN(8) 10#define ALIGN_FUNCTION() . = ALIGN(8)
11 11
12#define RODATA \ 12#define RODATA \
13 . = ALIGN(4096); \
14 __start_rodata = .; \
13 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ 15 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
14 *(.rodata) *(.rodata.*) \ 16 *(.rodata) *(.rodata.*) \
15 *(__vermagic) /* Kernel version magic */ \ 17 *(__vermagic) /* Kernel version magic */ \
@@ -74,6 +76,8 @@
74 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ 76 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
75 *(__ksymtab_strings) \ 77 *(__ksymtab_strings) \
76 } \ 78 } \
79 __end_rodata = .; \
80 . = ALIGN(4096); \
77 \ 81 \
78 /* Built-in module parameters. */ \ 82 /* Built-in module parameters. */ \
79 __param : AT(ADDR(__param) - LOAD_OFFSET) { \ 83 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
diff --git a/include/asm-h8300/atomic.h b/include/asm-h8300/atomic.h
index f23d86819ea8..21f54428c86b 100644
--- a/include/asm-h8300/atomic.h
+++ b/include/asm-h8300/atomic.h
@@ -95,6 +95,8 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
95 return ret; 95 return ret;
96} 96}
97 97
98#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
99
98static inline int atomic_add_unless(atomic_t *v, int a, int u) 100static inline int atomic_add_unless(atomic_t *v, int a, int u)
99{ 101{
100 int ret; 102 int ret;
@@ -137,4 +139,5 @@ static __inline__ void atomic_set_mask(unsigned long mask, unsigned long *v)
137#define smp_mb__before_atomic_inc() barrier() 139#define smp_mb__before_atomic_inc() barrier()
138#define smp_mb__after_atomic_inc() barrier() 140#define smp_mb__after_atomic_inc() barrier()
139 141
142#include <asm-generic/atomic.h>
140#endif /* __ARCH_H8300_ATOMIC __ */ 143#endif /* __ARCH_H8300_ATOMIC __ */
diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h
index 5036f595f8c9..c0411ec9d651 100644
--- a/include/asm-h8300/bitops.h
+++ b/include/asm-h8300/bitops.h
@@ -406,5 +406,6 @@ found_middle:
406#endif /* __KERNEL__ */ 406#endif /* __KERNEL__ */
407 407
408#define fls(x) generic_fls(x) 408#define fls(x) generic_fls(x)
409#define fls64(x) generic_fls64(x)
409 410
410#endif /* _H8300_BITOPS_H */ 411#endif /* _H8300_BITOPS_H */
diff --git a/include/asm-h8300/futex.h b/include/asm-h8300/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-h8300/futex.h
+++ b/include/asm-h8300/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-h8300/ioctl.h b/include/asm-h8300/ioctl.h
index 031c623478b3..b279fe06dfe5 100644
--- a/include/asm-h8300/ioctl.h
+++ b/include/asm-h8300/ioctl.h
@@ -1,80 +1 @@
1/* $Id: ioctl.h,v 1.1 2002/11/19 02:09:26 gerg Exp $ #include <asm-generic/ioctl.h>
2 *
3 * linux/ioctl.h for Linux by H.H. Bergman.
4 */
5
6#ifndef _H8300_IOCTL_H
7#define _H8300_IOCTL_H
8
9/* ioctl command encoding: 32 bits total, command in lower 16 bits,
10 * size of the parameter structure in the lower 14 bits of the
11 * upper 16 bits.
12 * Encoding the size of the parameter structure in the ioctl request
13 * is useful for catching programs compiled with old versions
14 * and to avoid overwriting user space outside the user buffer area.
15 * The highest 2 bits are reserved for indicating the ``access mode''.
16 * NOTE: This limits the max parameter size to 16kB -1 !
17 */
18
19/*
20 * I don't really have any idea about what this should look like, so
21 * for the time being, this is heavily based on the PC definitions.
22 */
23
24/*
25 * The following is for compatibility across the various Linux
26 * platforms. The i386 ioctl numbering scheme doesn't really enforce
27 * a type field. De facto, however, the top 8 bits of the lower 16
28 * bits are indeed used as a type field, so we might just as well make
29 * this explicit here. Please be sure to use the decoding macros
30 * below from now on.
31 */
32#define _IOC_NRBITS 8
33#define _IOC_TYPEBITS 8
34#define _IOC_SIZEBITS 14
35#define _IOC_DIRBITS 2
36
37#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
38#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
39#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
40#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
41
42#define _IOC_NRSHIFT 0
43#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
44#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
45#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
46
47/*
48 * Direction bits.
49 */
50#define _IOC_NONE 0U
51#define _IOC_WRITE 1U
52#define _IOC_READ 2U
53
54#define _IOC(dir,type,nr,size) \
55 (((dir) << _IOC_DIRSHIFT) | \
56 ((type) << _IOC_TYPESHIFT) | \
57 ((nr) << _IOC_NRSHIFT) | \
58 ((size) << _IOC_SIZESHIFT))
59
60/* used to create numbers */
61#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
62#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
63#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
64#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
65
66/* used to decode ioctl numbers.. */
67#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
68#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
69#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
70#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
71
72/* ...and for the drivers/sound files... */
73
74#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
75#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
76#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
77#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
78#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
79
80#endif /* _H8300_IOCTL_H */
diff --git a/include/asm-h8300/irq.h b/include/asm-h8300/irq.h
index 5027181ed067..73065f5bda0e 100644
--- a/include/asm-h8300/irq.h
+++ b/include/asm-h8300/irq.h
@@ -61,11 +61,6 @@ static __inline__ int irq_canonicalize(int irq)
61 61
62extern void enable_irq(unsigned int); 62extern void enable_irq(unsigned int);
63extern void disable_irq(unsigned int); 63extern void disable_irq(unsigned int);
64
65/*
66 * Some drivers want these entry points
67 */
68#define enable_irq_nosync(x) enable_irq(x)
69#define disable_irq_nosync(x) disable_irq(x) 64#define disable_irq_nosync(x) disable_irq(x)
70 65
71struct irqaction; 66struct irqaction;
diff --git a/include/asm-h8300/mman.h b/include/asm-h8300/mman.h
index 63f727a59850..744a8fb485c2 100644
--- a/include/asm-h8300/mman.h
+++ b/include/asm-h8300/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-h8300/mutex.h b/include/asm-h8300/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-h8300/mutex.h
@@ -0,0 +1,9 @@
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-h8300/page.h b/include/asm-h8300/page.h
index e8c02b8c2d99..cd35b1cc6cde 100644
--- a/include/asm-h8300/page.h
+++ b/include/asm-h8300/page.h
@@ -13,12 +13,6 @@
13 13
14#include <asm/setup.h> 14#include <asm/setup.h>
15 15
16#if !defined(CONFIG_SMALL_TASKS) && PAGE_SHIFT < 13
17#define KTHREAD_SIZE (8192)
18#else
19#define KTHREAD_SIZE PAGE_SIZE
20#endif
21
22#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
23 17
24#define get_user_page(vaddr) __get_free_page(GFP_KERNEL) 18#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
diff --git a/include/asm-h8300/thread_info.h b/include/asm-h8300/thread_info.h
index bfcc755c3bb1..45f09dc9caff 100644
--- a/include/asm-h8300/thread_info.h
+++ b/include/asm-h8300/thread_info.h
@@ -69,8 +69,6 @@ static inline struct thread_info *current_thread_info(void)
69#define alloc_thread_info(tsk) ((struct thread_info *) \ 69#define alloc_thread_info(tsk) ((struct thread_info *) \
70 __get_free_pages(GFP_KERNEL, 1)) 70 __get_free_pages(GFP_KERNEL, 1))
71#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 71#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
72#define get_thread_info(ti) get_task_struct((ti)->task)
73#define put_thread_info(ti) put_task_struct((ti)->task)
74#endif /* __ASSEMBLY__ */ 72#endif /* __ASSEMBLY__ */
75 73
76/* 74/*
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index 8c454aa58ac6..d30b8571573f 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -132,6 +132,11 @@ extern unsigned int nmi_watchdog;
132 132
133extern int disable_timer_pin_1; 133extern int disable_timer_pin_1;
134 134
135void smp_send_timer_broadcast_ipi(struct pt_regs *regs);
136void switch_APIC_timer_to_ipi(void *cpumask);
137void switch_ipi_to_APIC_timer(void *cpumask);
138#define ARCH_APICTIMER_STOPS_ON_C3 1
139
135#else /* !CONFIG_X86_LOCAL_APIC */ 140#else /* !CONFIG_X86_LOCAL_APIC */
136static inline void lapic_shutdown(void) { } 141static inline void lapic_shutdown(void) { }
137 142
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index c68557aa04b2..de649d3aa2d4 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -216,6 +216,7 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
216} 216}
217 217
218#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new)) 218#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new))
219#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
219 220
220/** 221/**
221 * atomic_add_unless - add unless the number is a given value 222 * atomic_add_unless - add unless the number is a given value
@@ -254,4 +255,5 @@ __asm__ __volatile__(LOCK "orl %0,%1" \
254#define smp_mb__before_atomic_inc() barrier() 255#define smp_mb__before_atomic_inc() barrier()
255#define smp_mb__after_atomic_inc() barrier() 256#define smp_mb__after_atomic_inc() barrier()
256 257
258#include <asm-generic/atomic.h>
257#endif 259#endif
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index ddf1739dc7fd..fe0819fe9c64 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -43,7 +43,7 @@ static inline void set_bit(int nr, volatile unsigned long * addr)
43{ 43{
44 __asm__ __volatile__( LOCK_PREFIX 44 __asm__ __volatile__( LOCK_PREFIX
45 "btsl %1,%0" 45 "btsl %1,%0"
46 :"=m" (ADDR) 46 :"+m" (ADDR)
47 :"Ir" (nr)); 47 :"Ir" (nr));
48} 48}
49 49
@@ -60,7 +60,7 @@ static inline void __set_bit(int nr, volatile unsigned long * addr)
60{ 60{
61 __asm__( 61 __asm__(
62 "btsl %1,%0" 62 "btsl %1,%0"
63 :"=m" (ADDR) 63 :"+m" (ADDR)
64 :"Ir" (nr)); 64 :"Ir" (nr));
65} 65}
66 66
@@ -78,7 +78,7 @@ static inline void clear_bit(int nr, volatile unsigned long * addr)
78{ 78{
79 __asm__ __volatile__( LOCK_PREFIX 79 __asm__ __volatile__( LOCK_PREFIX
80 "btrl %1,%0" 80 "btrl %1,%0"
81 :"=m" (ADDR) 81 :"+m" (ADDR)
82 :"Ir" (nr)); 82 :"Ir" (nr));
83} 83}
84 84
@@ -86,7 +86,7 @@ static inline void __clear_bit(int nr, volatile unsigned long * addr)
86{ 86{
87 __asm__ __volatile__( 87 __asm__ __volatile__(
88 "btrl %1,%0" 88 "btrl %1,%0"
89 :"=m" (ADDR) 89 :"+m" (ADDR)
90 :"Ir" (nr)); 90 :"Ir" (nr));
91} 91}
92#define smp_mb__before_clear_bit() barrier() 92#define smp_mb__before_clear_bit() barrier()
@@ -105,7 +105,7 @@ static inline void __change_bit(int nr, volatile unsigned long * addr)
105{ 105{
106 __asm__ __volatile__( 106 __asm__ __volatile__(
107 "btcl %1,%0" 107 "btcl %1,%0"
108 :"=m" (ADDR) 108 :"+m" (ADDR)
109 :"Ir" (nr)); 109 :"Ir" (nr));
110} 110}
111 111
@@ -123,7 +123,7 @@ static inline void change_bit(int nr, volatile unsigned long * addr)
123{ 123{
124 __asm__ __volatile__( LOCK_PREFIX 124 __asm__ __volatile__( LOCK_PREFIX
125 "btcl %1,%0" 125 "btcl %1,%0"
126 :"=m" (ADDR) 126 :"+m" (ADDR)
127 :"Ir" (nr)); 127 :"Ir" (nr));
128} 128}
129 129
@@ -142,7 +142,7 @@ static inline int test_and_set_bit(int nr, volatile unsigned long * addr)
142 142
143 __asm__ __volatile__( LOCK_PREFIX 143 __asm__ __volatile__( LOCK_PREFIX
144 "btsl %2,%1\n\tsbbl %0,%0" 144 "btsl %2,%1\n\tsbbl %0,%0"
145 :"=r" (oldbit),"=m" (ADDR) 145 :"=r" (oldbit),"+m" (ADDR)
146 :"Ir" (nr) : "memory"); 146 :"Ir" (nr) : "memory");
147 return oldbit; 147 return oldbit;
148} 148}
@@ -162,7 +162,7 @@ static inline int __test_and_set_bit(int nr, volatile unsigned long * addr)
162 162
163 __asm__( 163 __asm__(
164 "btsl %2,%1\n\tsbbl %0,%0" 164 "btsl %2,%1\n\tsbbl %0,%0"
165 :"=r" (oldbit),"=m" (ADDR) 165 :"=r" (oldbit),"+m" (ADDR)
166 :"Ir" (nr)); 166 :"Ir" (nr));
167 return oldbit; 167 return oldbit;
168} 168}
@@ -182,7 +182,7 @@ static inline int test_and_clear_bit(int nr, volatile unsigned long * addr)
182 182
183 __asm__ __volatile__( LOCK_PREFIX 183 __asm__ __volatile__( LOCK_PREFIX
184 "btrl %2,%1\n\tsbbl %0,%0" 184 "btrl %2,%1\n\tsbbl %0,%0"
185 :"=r" (oldbit),"=m" (ADDR) 185 :"=r" (oldbit),"+m" (ADDR)
186 :"Ir" (nr) : "memory"); 186 :"Ir" (nr) : "memory");
187 return oldbit; 187 return oldbit;
188} 188}
@@ -202,7 +202,7 @@ static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
202 202
203 __asm__( 203 __asm__(
204 "btrl %2,%1\n\tsbbl %0,%0" 204 "btrl %2,%1\n\tsbbl %0,%0"
205 :"=r" (oldbit),"=m" (ADDR) 205 :"=r" (oldbit),"+m" (ADDR)
206 :"Ir" (nr)); 206 :"Ir" (nr));
207 return oldbit; 207 return oldbit;
208} 208}
@@ -214,7 +214,7 @@ static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
214 214
215 __asm__ __volatile__( 215 __asm__ __volatile__(
216 "btcl %2,%1\n\tsbbl %0,%0" 216 "btcl %2,%1\n\tsbbl %0,%0"
217 :"=r" (oldbit),"=m" (ADDR) 217 :"=r" (oldbit),"+m" (ADDR)
218 :"Ir" (nr) : "memory"); 218 :"Ir" (nr) : "memory");
219 return oldbit; 219 return oldbit;
220} 220}
@@ -233,7 +233,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long* addr)
233 233
234 __asm__ __volatile__( LOCK_PREFIX 234 __asm__ __volatile__( LOCK_PREFIX
235 "btcl %2,%1\n\tsbbl %0,%0" 235 "btcl %2,%1\n\tsbbl %0,%0"
236 :"=r" (oldbit),"=m" (ADDR) 236 :"=r" (oldbit),"+m" (ADDR)
237 :"Ir" (nr) : "memory"); 237 :"Ir" (nr) : "memory");
238 return oldbit; 238 return oldbit;
239} 239}
@@ -332,9 +332,9 @@ static inline unsigned long __ffs(unsigned long word)
332 * Returns the bit-number of the first set bit, not the number of the byte 332 * Returns the bit-number of the first set bit, not the number of the byte
333 * containing a bit. 333 * containing a bit.
334 */ 334 */
335static inline int find_first_bit(const unsigned long *addr, unsigned size) 335static inline unsigned find_first_bit(const unsigned long *addr, unsigned size)
336{ 336{
337 int x = 0; 337 unsigned x = 0;
338 338
339 while (x < size) { 339 while (x < size) {
340 unsigned long val = *addr++; 340 unsigned long val = *addr++;
@@ -367,11 +367,7 @@ static inline unsigned long ffz(unsigned long word)
367 return word; 367 return word;
368} 368}
369 369
370/* 370#define fls64(x) generic_fls64(x)
371 * fls: find last bit set.
372 */
373
374#define fls(x) generic_fls(x)
375 371
376#ifdef __KERNEL__ 372#ifdef __KERNEL__
377 373
@@ -414,6 +410,23 @@ static inline int ffs(int x)
414} 410}
415 411
416/** 412/**
413 * fls - find last bit set
414 * @x: the word to search
415 *
416 * This is defined the same way as ffs.
417 */
418static inline int fls(int x)
419{
420 int r;
421
422 __asm__("bsrl %1,%0\n\t"
423 "jnz 1f\n\t"
424 "movl $-1,%0\n"
425 "1:" : "=r" (r) : "rm" (x));
426 return r+1;
427}
428
429/**
417 * hweightN - returns the hamming weight of a N-bit word 430 * hweightN - returns the hamming weight of a N-bit word
418 * @x: the word to weigh 431 * @x: the word to weigh
419 * 432 *
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
index ea54540638d2..50233e0345fb 100644
--- a/include/asm-i386/bugs.h
+++ b/include/asm-i386/bugs.h
@@ -8,9 +8,6 @@
8 * <rreilova@ececs.uc.edu> 8 * <rreilova@ececs.uc.edu>
9 * - Channing Corn (tests & fixes), 9 * - Channing Corn (tests & fixes),
10 * - Andrew D. Balsa (code cleanup). 10 * - Andrew D. Balsa (code cleanup).
11 *
12 * Pentium III FXSR, SSE support
13 * Gareth Hughes <gareth@valinux.com>, May 2000
14 */ 11 */
15 12
16/* 13/*
@@ -76,25 +73,7 @@ static void __init check_fpu(void)
76 return; 73 return;
77 } 74 }
78 75
79/* Enable FXSR and company _before_ testing for FP problems. */ 76/* trap_init() enabled FXSR and company _before_ testing for FP problems here. */
80 /*
81 * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned.
82 */
83 if (offsetof(struct task_struct, thread.i387.fxsave) & 15) {
84 extern void __buggy_fxsr_alignment(void);
85 __buggy_fxsr_alignment();
86 }
87 if (cpu_has_fxsr) {
88 printk(KERN_INFO "Enabling fast FPU save and restore... ");
89 set_in_cr4(X86_CR4_OSFXSR);
90 printk("done.\n");
91 }
92 if (cpu_has_xmm) {
93 printk(KERN_INFO "Enabling unmasked SIMD FPU exception support... ");
94 set_in_cr4(X86_CR4_OSXMMEXCPT);
95 printk("done.\n");
96 }
97
98 /* Test for the divl bug.. */ 77 /* Test for the divl bug.. */
99 __asm__("fninit\n\t" 78 __asm__("fninit\n\t"
100 "fldl %1\n\t" 79 "fldl %1\n\t"
diff --git a/include/asm-i386/cache.h b/include/asm-i386/cache.h
index 849788710feb..615911e5bd24 100644
--- a/include/asm-i386/cache.h
+++ b/include/asm-i386/cache.h
@@ -10,6 +10,4 @@
10#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) 10#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
11#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 11#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
12 12
13#define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */
14
15#endif 13#endif
diff --git a/include/asm-i386/cacheflush.h b/include/asm-i386/cacheflush.h
index 2ea36dea37d9..7199f7b326f1 100644
--- a/include/asm-i386/cacheflush.h
+++ b/include/asm-i386/cacheflush.h
@@ -31,4 +31,8 @@ int change_page_attr(struct page *page, int numpages, pgprot_t prot);
31void kernel_map_pages(struct page *page, int numpages, int enable); 31void kernel_map_pages(struct page *page, int numpages, int enable);
32#endif 32#endif
33 33
34#ifdef CONFIG_DEBUG_RODATA
35void mark_rodata_ro(void);
36#endif
37
34#endif /* _I386_CACHEFLUSH_H */ 38#endif /* _I386_CACHEFLUSH_H */
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index ff1187e80c32..c4ec2a4d8fdf 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -69,6 +69,7 @@
69#define X86_FEATURE_K7 (3*32+ 5) /* Athlon */ 69#define X86_FEATURE_K7 (3*32+ 5) /* Athlon */
70#define X86_FEATURE_P3 (3*32+ 6) /* P3 */ 70#define X86_FEATURE_P3 (3*32+ 6) /* P3 */
71#define X86_FEATURE_P4 (3*32+ 7) /* P4 */ 71#define X86_FEATURE_P4 (3*32+ 7) /* P4 */
72#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */
72 73
73/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 74/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
74#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 75#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index 29b851a18c6e..494e73bca095 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -15,9 +15,6 @@
15#include <asm/mmu.h> 15#include <asm/mmu.h>
16 16
17extern struct desc_struct cpu_gdt_table[GDT_ENTRIES]; 17extern struct desc_struct cpu_gdt_table[GDT_ENTRIES];
18DECLARE_PER_CPU(struct desc_struct, cpu_gdt_table[GDT_ENTRIES]);
19
20#define get_cpu_gdt_table(_cpu) (per_cpu(cpu_gdt_table,_cpu))
21 18
22DECLARE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); 19DECLARE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]);
23 20
@@ -29,6 +26,11 @@ struct Xgt_desc_struct {
29 26
30extern struct Xgt_desc_struct idt_descr, cpu_gdt_descr[NR_CPUS]; 27extern struct Xgt_desc_struct idt_descr, cpu_gdt_descr[NR_CPUS];
31 28
29static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
30{
31 return ((struct desc_struct *)cpu_gdt_descr[cpu].address);
32}
33
32#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) 34#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
33#define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8)) 35#define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8))
34 36
diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h
index e56c335f8ef9..9cf20cacf76e 100644
--- a/include/asm-i386/dma-mapping.h
+++ b/include/asm-i386/dma-mapping.h
@@ -6,6 +6,7 @@
6#include <asm/cache.h> 6#include <asm/cache.h>
7#include <asm/io.h> 7#include <asm/io.h>
8#include <asm/scatterlist.h> 8#include <asm/scatterlist.h>
9#include <asm/bug.h>
9 10
10#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 11#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#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
@@ -20,7 +21,9 @@ static inline dma_addr_t
20dma_map_single(struct device *dev, void *ptr, size_t size, 21dma_map_single(struct device *dev, void *ptr, size_t size,
21 enum dma_data_direction direction) 22 enum dma_data_direction direction)
22{ 23{
23 BUG_ON(direction == DMA_NONE); 24 if (direction == DMA_NONE)
25 BUG();
26 WARN_ON(size == 0);
24 flush_write_buffers(); 27 flush_write_buffers();
25 return virt_to_phys(ptr); 28 return virt_to_phys(ptr);
26} 29}
@@ -29,7 +32,8 @@ static inline void
29dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, 32dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
30 enum dma_data_direction direction) 33 enum dma_data_direction direction)
31{ 34{
32 BUG_ON(direction == DMA_NONE); 35 if (direction == DMA_NONE)
36 BUG();
33} 37}
34 38
35static inline int 39static inline int
@@ -38,7 +42,9 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
38{ 42{
39 int i; 43 int i;
40 44
41 BUG_ON(direction == DMA_NONE); 45 if (direction == DMA_NONE)
46 BUG();
47 WARN_ON(nents == 0 || sg[0].length == 0);
42 48
43 for (i = 0; i < nents; i++ ) { 49 for (i = 0; i < nents; i++ ) {
44 BUG_ON(!sg[i].page); 50 BUG_ON(!sg[i].page);
@@ -150,7 +156,7 @@ dma_get_cache_alignment(void)
150{ 156{
151 /* no easy way to get cache size on all x86, so return the 157 /* no easy way to get cache size on all x86, so return the
152 * maximum possible, to be safe */ 158 * maximum possible, to be safe */
153 return (1 << L1_CACHE_SHIFT_MAX); 159 return (1 << INTERNODE_CACHE_SHIFT);
154} 160}
155 161
156#define dma_is_consistent(d) (1) 162#define dma_is_consistent(d) (1)
diff --git a/include/asm-i386/i387.h b/include/asm-i386/i387.h
index 6747006743f9..152d0baa576a 100644
--- a/include/asm-i386/i387.h
+++ b/include/asm-i386/i387.h
@@ -49,19 +49,19 @@ static inline void __save_init_fpu( struct task_struct *tsk )
49 X86_FEATURE_FXSR, 49 X86_FEATURE_FXSR,
50 "m" (tsk->thread.i387.fxsave) 50 "m" (tsk->thread.i387.fxsave)
51 :"memory"); 51 :"memory");
52 tsk->thread_info->status &= ~TS_USEDFPU; 52 task_thread_info(tsk)->status &= ~TS_USEDFPU;
53} 53}
54 54
55#define __unlazy_fpu( tsk ) do { \ 55#define __unlazy_fpu( tsk ) do { \
56 if ((tsk)->thread_info->status & TS_USEDFPU) \ 56 if (task_thread_info(tsk)->status & TS_USEDFPU) \
57 save_init_fpu( tsk ); \ 57 save_init_fpu( tsk ); \
58} while (0) 58} while (0)
59 59
60#define __clear_fpu( tsk ) \ 60#define __clear_fpu( tsk ) \
61do { \ 61do { \
62 if ((tsk)->thread_info->status & TS_USEDFPU) { \ 62 if (task_thread_info(tsk)->status & TS_USEDFPU) { \
63 asm volatile("fnclex ; fwait"); \ 63 asm volatile("fnclex ; fwait"); \
64 (tsk)->thread_info->status &= ~TS_USEDFPU; \ 64 task_thread_info(tsk)->status &= ~TS_USEDFPU; \
65 stts(); \ 65 stts(); \
66 } \ 66 } \
67} while (0) 67} while (0)
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index 7babb97a02eb..03233c2ab820 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -131,6 +131,11 @@ extern void iounmap(volatile void __iomem *addr);
131extern void *bt_ioremap(unsigned long offset, unsigned long size); 131extern void *bt_ioremap(unsigned long offset, unsigned long size);
132extern void bt_iounmap(void *addr, unsigned long size); 132extern void bt_iounmap(void *addr, unsigned long size);
133 133
134/* Use early IO mappings for DMI because it's initialized early */
135#define dmi_ioremap bt_ioremap
136#define dmi_iounmap bt_iounmap
137#define dmi_alloc alloc_bootmem
138
134/* 139/*
135 * ISA I/O bus memory addresses are 1:1 with the physical address. 140 * ISA I/O bus memory addresses are 1:1 with the physical address.
136 */ 141 */
diff --git a/include/asm-i386/ioctl.h b/include/asm-i386/ioctl.h
index 543f7843d553..b279fe06dfe5 100644
--- a/include/asm-i386/ioctl.h
+++ b/include/asm-i386/ioctl.h
@@ -1,85 +1 @@
1/* $Id: ioctl.h,v 1.5 1993/07/19 21:53:50 root Exp root $ #include <asm-generic/ioctl.h>
2 *
3 * linux/ioctl.h for Linux by H.H. Bergman.
4 */
5
6#ifndef _ASMI386_IOCTL_H
7#define _ASMI386_IOCTL_H
8
9/* ioctl command encoding: 32 bits total, command in lower 16 bits,
10 * size of the parameter structure in the lower 14 bits of the
11 * upper 16 bits.
12 * Encoding the size of the parameter structure in the ioctl request
13 * is useful for catching programs compiled with old versions
14 * and to avoid overwriting user space outside the user buffer area.
15 * The highest 2 bits are reserved for indicating the ``access mode''.
16 * NOTE: This limits the max parameter size to 16kB -1 !
17 */
18
19/*
20 * The following is for compatibility across the various Linux
21 * platforms. The i386 ioctl numbering scheme doesn't really enforce
22 * a type field. De facto, however, the top 8 bits of the lower 16
23 * bits are indeed used as a type field, so we might just as well make
24 * this explicit here. Please be sure to use the decoding macros
25 * below from now on.
26 */
27#define _IOC_NRBITS 8
28#define _IOC_TYPEBITS 8
29#define _IOC_SIZEBITS 14
30#define _IOC_DIRBITS 2
31
32#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
33#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
34#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
35#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
36
37#define _IOC_NRSHIFT 0
38#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
39#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
40#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
41
42/*
43 * Direction bits.
44 */
45#define _IOC_NONE 0U
46#define _IOC_WRITE 1U
47#define _IOC_READ 2U
48
49#define _IOC(dir,type,nr,size) \
50 (((dir) << _IOC_DIRSHIFT) | \
51 ((type) << _IOC_TYPESHIFT) | \
52 ((nr) << _IOC_NRSHIFT) | \
53 ((size) << _IOC_SIZESHIFT))
54
55/* provoke compile error for invalid uses of size argument */
56extern unsigned int __invalid_size_argument_for_IOC;
57#define _IOC_TYPECHECK(t) \
58 ((sizeof(t) == sizeof(t[1]) && \
59 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
60 sizeof(t) : __invalid_size_argument_for_IOC)
61
62/* used to create numbers */
63#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
64#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
65#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
66#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
67#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
68#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
69#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
70
71/* used to decode ioctl numbers.. */
72#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
73#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
74#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
75#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
76
77/* ...and for the drivers/sound files... */
78
79#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
80#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
81#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
82#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
83#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
84
85#endif /* _ASMI386_IOCTL_H */
diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h
index 270f1986b19f..5169d7af456f 100644
--- a/include/asm-i386/irq.h
+++ b/include/asm-i386/irq.h
@@ -21,8 +21,6 @@ static __inline__ int irq_canonicalize(int irq)
21 return ((irq == 2) ? 9 : irq); 21 return ((irq == 2) ? 9 : irq);
22} 22}
23 23
24extern void release_vm86_irqs(struct task_struct *);
25
26#ifdef CONFIG_X86_LOCAL_APIC 24#ifdef CONFIG_X86_LOCAL_APIC
27# define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ 25# define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */
28#endif 26#endif
diff --git a/include/asm-i386/kexec.h b/include/asm-i386/kexec.h
index 6ed2a03e37b3..53f0e06672dc 100644
--- a/include/asm-i386/kexec.h
+++ b/include/asm-i386/kexec.h
@@ -2,6 +2,8 @@
2#define _I386_KEXEC_H 2#define _I386_KEXEC_H
3 3
4#include <asm/fixmap.h> 4#include <asm/fixmap.h>
5#include <asm/ptrace.h>
6#include <asm/string.h>
5 7
6/* 8/*
7 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. 9 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
@@ -26,8 +28,49 @@
26#define KEXEC_ARCH KEXEC_ARCH_386 28#define KEXEC_ARCH KEXEC_ARCH_386
27 29
28#define MAX_NOTE_BYTES 1024 30#define MAX_NOTE_BYTES 1024
29typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
30 31
31extern note_buf_t crash_notes[]; 32/* CPU does not save ss and esp on stack if execution is already
33 * running in kernel mode at the time of NMI occurrence. This code
34 * fixes it.
35 */
36static inline void crash_fixup_ss_esp(struct pt_regs *newregs,
37 struct pt_regs *oldregs)
38{
39 memcpy(newregs, oldregs, sizeof(*newregs));
40 newregs->esp = (unsigned long)&(oldregs->esp);
41 __asm__ __volatile__(
42 "xorl %%eax, %%eax\n\t"
43 "movw %%ss, %%ax\n\t"
44 :"=a"(newregs->xss));
45}
46
47/*
48 * This function is responsible for capturing register states if coming
49 * via panic otherwise just fix up the ss and esp if coming via kernel
50 * mode exception.
51 */
52static inline void crash_setup_regs(struct pt_regs *newregs,
53 struct pt_regs *oldregs)
54{
55 if (oldregs)
56 crash_fixup_ss_esp(newregs, oldregs);
57 else {
58 __asm__ __volatile__("movl %%ebx,%0" : "=m"(newregs->ebx));
59 __asm__ __volatile__("movl %%ecx,%0" : "=m"(newregs->ecx));
60 __asm__ __volatile__("movl %%edx,%0" : "=m"(newregs->edx));
61 __asm__ __volatile__("movl %%esi,%0" : "=m"(newregs->esi));
62 __asm__ __volatile__("movl %%edi,%0" : "=m"(newregs->edi));
63 __asm__ __volatile__("movl %%ebp,%0" : "=m"(newregs->ebp));
64 __asm__ __volatile__("movl %%eax,%0" : "=m"(newregs->eax));
65 __asm__ __volatile__("movl %%esp,%0" : "=m"(newregs->esp));
66 __asm__ __volatile__("movw %%ss, %%ax;" :"=a"(newregs->xss));
67 __asm__ __volatile__("movw %%cs, %%ax;" :"=a"(newregs->xcs));
68 __asm__ __volatile__("movw %%ds, %%ax;" :"=a"(newregs->xds));
69 __asm__ __volatile__("movw %%es, %%ax;" :"=a"(newregs->xes));
70 __asm__ __volatile__("pushfl; popl %0" :"=m"(newregs->eflags));
71
72 newregs->eip = (unsigned long)current_text_addr();
73 }
74}
32 75
33#endif /* _I386_KEXEC_H */ 76#endif /* _I386_KEXEC_H */
diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h
index ca916a892877..27cac050a60e 100644
--- a/include/asm-i386/kprobes.h
+++ b/include/asm-i386/kprobes.h
@@ -40,6 +40,7 @@ typedef u8 kprobe_opcode_t;
40 40
41#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 41#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
42#define ARCH_SUPPORTS_KRETPROBES 42#define ARCH_SUPPORTS_KRETPROBES
43#define arch_remove_kprobe(p) do {} while (0)
43 44
44void kretprobe_trampoline(void); 45void kretprobe_trampoline(void);
45 46
@@ -76,14 +77,6 @@ static inline void restore_interrupts(struct pt_regs *regs)
76 local_irq_enable(); 77 local_irq_enable();
77} 78}
78 79
79#ifdef CONFIG_KPROBES
80extern int kprobe_exceptions_notify(struct notifier_block *self, 80extern int kprobe_exceptions_notify(struct notifier_block *self,
81 unsigned long val, void *data); 81 unsigned long val, void *data);
82#else /* !CONFIG_KPROBES */
83static inline int kprobe_exceptions_notify(struct notifier_block *self,
84 unsigned long val, void *data)
85{
86 return 0;
87}
88#endif
89#endif /* _ASM_KPROBES_H */ 82#endif /* _ASM_KPROBES_H */
diff --git a/include/asm-i386/mach-bigsmp/mach_apic.h b/include/asm-i386/mach-bigsmp/mach_apic.h
index ba936d4daedb..18b19a773440 100644
--- a/include/asm-i386/mach-bigsmp/mach_apic.h
+++ b/include/asm-i386/mach-bigsmp/mach_apic.h
@@ -1,17 +1,10 @@
1#ifndef __ASM_MACH_APIC_H 1#ifndef __ASM_MACH_APIC_H
2#define __ASM_MACH_APIC_H 2#define __ASM_MACH_APIC_H
3#include <asm/smp.h> 3
4 4
5#define SEQUENTIAL_APICID 5extern u8 bios_cpu_apicid[];
6#ifdef SEQUENTIAL_APICID 6
7#define xapic_phys_to_log_apicid(phys_apic) ( (1ul << ((phys_apic) & 0x3)) |\ 7#define xapic_phys_to_log_apicid(cpu) (bios_cpu_apicid[cpu])
8 ((phys_apic<<2) & (~0xf)) )
9#elif CLUSTERED_APICID
10#define xapic_phys_to_log_apicid(phys_apic) ( (1ul << ((phys_apic) & 0x3)) |\
11 ((phys_apic) & (~0xf)) )
12#endif
13
14#define NO_BALANCE_IRQ (1)
15#define esr_disable (1) 8#define esr_disable (1)
16 9
17static inline int apic_id_registered(void) 10static inline int apic_id_registered(void)
@@ -19,7 +12,6 @@ static inline int apic_id_registered(void)
19 return (1); 12 return (1);
20} 13}
21 14
22#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
23/* Round robin the irqs amoung the online cpus */ 15/* Round robin the irqs amoung the online cpus */
24static inline cpumask_t target_cpus(void) 16static inline cpumask_t target_cpus(void)
25{ 17{
@@ -32,29 +24,34 @@ static inline cpumask_t target_cpus(void)
32 } while (cpu >= NR_CPUS); 24 } while (cpu >= NR_CPUS);
33 return cpumask_of_cpu(cpu); 25 return cpumask_of_cpu(cpu);
34} 26}
35#define TARGET_CPUS (target_cpus())
36 27
37#define INT_DELIVERY_MODE dest_Fixed 28#undef APIC_DEST_LOGICAL
38#define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ 29#define APIC_DEST_LOGICAL 0
30#define TARGET_CPUS (target_cpus())
31#define APIC_DFR_VALUE (APIC_DFR_FLAT)
32#define INT_DELIVERY_MODE (dest_Fixed)
33#define INT_DEST_MODE (0) /* phys delivery to target proc */
34#define NO_BALANCE_IRQ (0)
35#define WAKE_SECONDARY_VIA_INIT
36
39 37
40static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid) 38static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
41{ 39{
42 return 0; 40 return (0);
43} 41}
44 42
45/* we don't use the phys_cpu_present_map to indicate apicid presence */ 43static inline unsigned long check_apicid_present(int bit)
46static inline unsigned long check_apicid_present(int bit)
47{ 44{
48 return 1; 45 return (1);
49} 46}
50 47
51#define apicid_cluster(apicid) (apicid & 0xF0) 48static inline unsigned long calculate_ldr(int cpu)
52
53static inline unsigned long calculate_ldr(unsigned long old)
54{ 49{
55 unsigned long id; 50 unsigned long val, id;
56 id = xapic_phys_to_log_apicid(hard_smp_processor_id()); 51 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
57 return ((old & ~APIC_LDR_MASK) | SET_APIC_LOGICAL_ID(id)); 52 id = xapic_phys_to_log_apicid(cpu);
53 val |= SET_APIC_LOGICAL_ID(id);
54 return val;
58} 55}
59 56
60/* 57/*
@@ -67,37 +64,35 @@ static inline unsigned long calculate_ldr(unsigned long old)
67static inline void init_apic_ldr(void) 64static inline void init_apic_ldr(void)
68{ 65{
69 unsigned long val; 66 unsigned long val;
67 int cpu = smp_processor_id();
70 68
71 apic_write_around(APIC_DFR, APIC_DFR_VALUE); 69 apic_write_around(APIC_DFR, APIC_DFR_VALUE);
72 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; 70 val = calculate_ldr(cpu);
73 val = calculate_ldr(val);
74 apic_write_around(APIC_LDR, val); 71 apic_write_around(APIC_LDR, val);
75} 72}
76 73
77static inline void clustered_apic_check(void) 74static inline void clustered_apic_check(void)
78{ 75{
79 printk("Enabling APIC mode: %s. Using %d I/O APICs\n", 76 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
80 "Cluster", nr_ioapics); 77 "Physflat", nr_ioapics);
81} 78}
82 79
83static inline int multi_timer_check(int apic, int irq) 80static inline int multi_timer_check(int apic, int irq)
84{ 81{
85 return 0; 82 return (0);
86} 83}
87 84
88static inline int apicid_to_node(int logical_apicid) 85static inline int apicid_to_node(int logical_apicid)
89{ 86{
90 return 0; 87 return (0);
91} 88}
92 89
93extern u8 bios_cpu_apicid[];
94
95static inline int cpu_present_to_apicid(int mps_cpu) 90static inline int cpu_present_to_apicid(int mps_cpu)
96{ 91{
97 if (mps_cpu < NR_CPUS) 92 if (mps_cpu < NR_CPUS)
98 return (int)bios_cpu_apicid[mps_cpu]; 93 return (int) bios_cpu_apicid[mps_cpu];
99 else 94
100 return BAD_APICID; 95 return BAD_APICID;
101} 96}
102 97
103static inline physid_mask_t apicid_to_cpu_present(int phys_apicid) 98static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
@@ -109,10 +104,10 @@ extern u8 cpu_2_logical_apicid[];
109/* Mapping from cpu number to logical apicid */ 104/* Mapping from cpu number to logical apicid */
110static inline int cpu_to_logical_apicid(int cpu) 105static inline int cpu_to_logical_apicid(int cpu)
111{ 106{
112 if (cpu >= NR_CPUS) 107 if (cpu >= NR_CPUS)
113 return BAD_APICID; 108 return BAD_APICID;
114 return (int)cpu_2_logical_apicid[cpu]; 109 return cpu_physical_id(cpu);
115 } 110}
116 111
117static inline int mpc_apic_id(struct mpc_config_processor *m, 112static inline int mpc_apic_id(struct mpc_config_processor *m,
118 struct mpc_config_translation *translation_record) 113 struct mpc_config_translation *translation_record)
@@ -128,11 +123,9 @@ static inline int mpc_apic_id(struct mpc_config_processor *m,
128static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map) 123static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
129{ 124{
130 /* For clustered we don't have a good way to do this yet - hack */ 125 /* For clustered we don't have a good way to do this yet - hack */
131 return physids_promote(0xFUL); 126 return physids_promote(0xFFL);
132} 127}
133 128
134#define WAKE_SECONDARY_VIA_INIT
135
136static inline void setup_portio_remap(void) 129static inline void setup_portio_remap(void)
137{ 130{
138} 131}
diff --git a/include/asm-i386/mach-bigsmp/mach_apicdef.h b/include/asm-i386/mach-bigsmp/mach_apicdef.h
index 23e58b317c79..a58ab5a75c8c 100644
--- a/include/asm-i386/mach-bigsmp/mach_apicdef.h
+++ b/include/asm-i386/mach-bigsmp/mach_apicdef.h
@@ -1,11 +1,11 @@
1#ifndef __ASM_MACH_APICDEF_H 1#ifndef __ASM_MACH_APICDEF_H
2#define __ASM_MACH_APICDEF_H 2#define __ASM_MACH_APICDEF_H
3 3
4#define APIC_ID_MASK (0x0F<<24) 4#define APIC_ID_MASK (0xFF<<24)
5 5
6static inline unsigned get_apic_id(unsigned long x) 6static inline unsigned get_apic_id(unsigned long x)
7{ 7{
8 return (((x)>>24)&0x0F); 8 return (((x)>>24)&0xFF);
9} 9}
10 10
11#define GET_APIC_ID(x) get_apic_id(x) 11#define GET_APIC_ID(x) get_apic_id(x)
diff --git a/include/asm-i386/mach-default/mach_ipi.h b/include/asm-i386/mach-default/mach_ipi.h
index cc756a67cd63..a1d0072e36bc 100644
--- a/include/asm-i386/mach-default/mach_ipi.h
+++ b/include/asm-i386/mach-default/mach_ipi.h
@@ -15,11 +15,9 @@ static inline void __local_send_IPI_allbutself(int vector)
15{ 15{
16 if (no_broadcast) { 16 if (no_broadcast) {
17 cpumask_t mask = cpu_online_map; 17 cpumask_t mask = cpu_online_map;
18 int this_cpu = get_cpu();
19 18
20 cpu_clear(this_cpu, mask); 19 cpu_clear(smp_processor_id(), mask);
21 send_IPI_mask(mask, vector); 20 send_IPI_mask(mask, vector);
22 put_cpu();
23 } else 21 } else
24 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector); 22 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
25} 23}
diff --git a/include/asm-i386/mman.h b/include/asm-i386/mman.h
index 196619a83854..ba4941e6f643 100644
--- a/include/asm-i386/mman.h
+++ b/include/asm-i386/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h
index 620a90641ea8..74f595d80579 100644
--- a/include/asm-i386/mmzone.h
+++ b/include/asm-i386/mmzone.h
@@ -76,11 +76,6 @@ static inline int pfn_to_nid(unsigned long pfn)
76 * Following are macros that each numa implmentation must define. 76 * Following are macros that each numa implmentation must define.
77 */ 77 */
78 78
79/*
80 * Given a kernel address, find the home node of the underlying memory.
81 */
82#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
83
84#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 79#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
85#define node_end_pfn(nid) \ 80#define node_end_pfn(nid) \
86({ \ 81({ \
diff --git a/include/asm-i386/module.h b/include/asm-i386/module.h
index eb7f2b4234aa..424661d25bd3 100644
--- a/include/asm-i386/module.h
+++ b/include/asm-i386/module.h
@@ -52,8 +52,10 @@ struct mod_arch_specific
52#define MODULE_PROC_FAMILY "CYRIXIII " 52#define MODULE_PROC_FAMILY "CYRIXIII "
53#elif defined CONFIG_MVIAC3_2 53#elif defined CONFIG_MVIAC3_2
54#define MODULE_PROC_FAMILY "VIAC3-2 " 54#define MODULE_PROC_FAMILY "VIAC3-2 "
55#elif CONFIG_MGEODEGX1 55#elif defined CONFIG_MGEODEGX1
56#define MODULE_PROC_FAMILY "GEODEGX1 " 56#define MODULE_PROC_FAMILY "GEODEGX1 "
57#elif defined CONFIG_MGEODE_LX
58#define MODULE_PROC_FAMILY "GEODE "
57#else 59#else
58#error unknown processor family 60#error unknown processor family
59#endif 61#endif
diff --git a/include/asm-i386/mpspec_def.h b/include/asm-i386/mpspec_def.h
index a961093dbf88..76feedf85a8a 100644
--- a/include/asm-i386/mpspec_def.h
+++ b/include/asm-i386/mpspec_def.h
@@ -75,7 +75,7 @@ struct mpc_config_bus
75{ 75{
76 unsigned char mpc_type; 76 unsigned char mpc_type;
77 unsigned char mpc_busid; 77 unsigned char mpc_busid;
78 unsigned char mpc_bustype[6] __attribute((packed)); 78 unsigned char mpc_bustype[6];
79}; 79};
80 80
81/* List of Bus Type string values, Intel MP Spec. */ 81/* List of Bus Type string values, Intel MP Spec. */
diff --git a/include/asm-i386/mutex.h b/include/asm-i386/mutex.h
new file mode 100644
index 000000000000..9b2199e829f3
--- /dev/null
+++ b/include/asm-i386/mutex.h
@@ -0,0 +1,136 @@
1/*
2 * Assembly implementation of the mutex fastpath, based on atomic
3 * decrement/increment.
4 *
5 * started by Ingo Molnar:
6 *
7 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
8 */
9#ifndef _ASM_MUTEX_H
10#define _ASM_MUTEX_H
11
12/**
13 * __mutex_fastpath_lock - try to take the lock by moving the count
14 * from 1 to a 0 value
15 * @count: pointer of type atomic_t
16 * @fn: function to call if the original value was not 1
17 *
18 * Change the count from 1 to a value lower than 1, and call <fn> if it
19 * wasn't 1 originally. This function MUST leave the value lower than 1
20 * even when the "1" assertion wasn't true.
21 */
22#define __mutex_fastpath_lock(count, fail_fn) \
23do { \
24 unsigned int dummy; \
25 \
26 typecheck(atomic_t *, count); \
27 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
28 \
29 __asm__ __volatile__( \
30 LOCK " decl (%%eax) \n" \
31 " js 2f \n" \
32 "1: \n" \
33 \
34 LOCK_SECTION_START("") \
35 "2: call "#fail_fn" \n" \
36 " jmp 1b \n" \
37 LOCK_SECTION_END \
38 \
39 :"=a" (dummy) \
40 : "a" (count) \
41 : "memory", "ecx", "edx"); \
42} while (0)
43
44
45/**
46 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
47 * from 1 to a 0 value
48 * @count: pointer of type atomic_t
49 * @fail_fn: function to call if the original value was not 1
50 *
51 * Change the count from 1 to a value lower than 1, and call <fail_fn> if it
52 * wasn't 1 originally. This function returns 0 if the fastpath succeeds,
53 * or anything the slow path function returns
54 */
55static inline int
56__mutex_fastpath_lock_retval(atomic_t *count,
57 int fastcall (*fail_fn)(atomic_t *))
58{
59 if (unlikely(atomic_dec_return(count) < 0))
60 return fail_fn(count);
61 else
62 return 0;
63}
64
65/**
66 * __mutex_fastpath_unlock - try to promote the mutex from 0 to 1
67 * @count: pointer of type atomic_t
68 * @fail_fn: function to call if the original value was not 0
69 *
70 * try to promote the mutex from 0 to 1. if it wasn't 0, call <fail_fn>.
71 * In the failure case, this function is allowed to either set the value
72 * to 1, or to set it to a value lower than 1.
73 *
74 * If the implementation sets it to a value of lower than 1, the
75 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
76 * to return 0 otherwise.
77 */
78#define __mutex_fastpath_unlock(count, fail_fn) \
79do { \
80 unsigned int dummy; \
81 \
82 typecheck(atomic_t *, count); \
83 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
84 \
85 __asm__ __volatile__( \
86 LOCK " incl (%%eax) \n" \
87 " jle 2f \n" \
88 "1: \n" \
89 \
90 LOCK_SECTION_START("") \
91 "2: call "#fail_fn" \n" \
92 " jmp 1b \n" \
93 LOCK_SECTION_END \
94 \
95 :"=a" (dummy) \
96 : "a" (count) \
97 : "memory", "ecx", "edx"); \
98} while (0)
99
100#define __mutex_slowpath_needs_to_unlock() 1
101
102/**
103 * __mutex_fastpath_trylock - try to acquire the mutex, without waiting
104 *
105 * @count: pointer of type atomic_t
106 * @fail_fn: fallback function
107 *
108 * Change the count from 1 to a value lower than 1, and return 0 (failure)
109 * if it wasn't 1 originally, or return 1 (success) otherwise. This function
110 * MUST leave the value lower than 1 even when the "1" assertion wasn't true.
111 * Additionally, if the value was < 0 originally, this function must not leave
112 * it to 0 on failure.
113 */
114static inline int
115__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
116{
117 /*
118 * We have two variants here. The cmpxchg based one is the best one
119 * because it never induce a false contention state. It is included
120 * here because architectures using the inc/dec algorithms over the
121 * xchg ones are much more likely to support cmpxchg natively.
122 *
123 * If not we fall back to the spinlock based variant - that is
124 * just as efficient (and simpler) as a 'destructive' probing of
125 * the mutex state would be.
126 */
127#ifdef __HAVE_ARCH_CMPXCHG
128 if (likely(atomic_cmpxchg(count, 1, 0) == 1))
129 return 1;
130 return 0;
131#else
132 return fail_fn(count);
133#endif
134}
135
136#endif
diff --git a/include/asm-i386/param.h b/include/asm-i386/param.h
index fa02e67ea86b..095580f3a45c 100644
--- a/include/asm-i386/param.h
+++ b/include/asm-i386/param.h
@@ -1,9 +1,8 @@
1#include <linux/config.h>
2
3#ifndef _ASMi386_PARAM_H 1#ifndef _ASMi386_PARAM_H
4#define _ASMi386_PARAM_H 2#define _ASMi386_PARAM_H
5 3
6#ifdef __KERNEL__ 4#ifdef __KERNEL__
5# include <linux/config.h>
7# define HZ CONFIG_HZ /* Internal kernel timer frequency */ 6# define HZ CONFIG_HZ /* Internal kernel timer frequency */
8# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ 7# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
9# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ 8# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 5c96cf6dcb39..feca5d961e2b 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -61,9 +61,11 @@ struct cpuinfo_x86 {
61 int x86_cache_size; /* in KB - valid for CPUS which support this 61 int x86_cache_size; /* in KB - valid for CPUS which support this
62 call */ 62 call */
63 int x86_cache_alignment; /* In bytes */ 63 int x86_cache_alignment; /* In bytes */
64 int fdiv_bug; 64 char fdiv_bug;
65 int f00f_bug; 65 char f00f_bug;
66 int coma_bug; 66 char coma_bug;
67 char pad0;
68 int x86_power;
67 unsigned long loops_per_jiffy; 69 unsigned long loops_per_jiffy;
68 unsigned char x86_max_cores; /* cpuid returned max cores value */ 70 unsigned char x86_max_cores; /* cpuid returned max cores value */
69 unsigned char booted_cores; /* number of cores as seen by OS */ 71 unsigned char booted_cores; /* number of cores as seen by OS */
@@ -279,9 +281,11 @@ static inline void clear_in_cr4 (unsigned long mask)
279 outb((data), 0x23); \ 281 outb((data), 0x23); \
280} while (0) 282} while (0)
281 283
282static inline void serialize_cpu(void) 284/* Stop speculative execution */
285static inline void sync_core(void)
283{ 286{
284 __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx"); 287 int tmp;
288 asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory");
285} 289}
286 290
287static inline void __monitor(const void *eax, unsigned long ecx, 291static inline void __monitor(const void *eax, unsigned long ecx,
@@ -557,10 +561,20 @@ unsigned long get_wchan(struct task_struct *p);
557 (unsigned long)(&__ptr[THREAD_SIZE_LONGS]); \ 561 (unsigned long)(&__ptr[THREAD_SIZE_LONGS]); \
558}) 562})
559 563
564/*
565 * The below -8 is to reserve 8 bytes on top of the ring0 stack.
566 * This is necessary to guarantee that the entire "struct pt_regs"
567 * is accessable even if the CPU haven't stored the SS/ESP registers
568 * on the stack (interrupt gate does not save these registers
569 * when switching to the same priv ring).
570 * Therefore beware: accessing the xss/esp fields of the
571 * "struct pt_regs" is possible, but they may contain the
572 * completely wrong values.
573 */
560#define task_pt_regs(task) \ 574#define task_pt_regs(task) \
561({ \ 575({ \
562 struct pt_regs *__regs__; \ 576 struct pt_regs *__regs__; \
563 __regs__ = (struct pt_regs *)KSTK_TOP((task)->thread_info); \ 577 __regs__ = (struct pt_regs *)(KSTK_TOP(task_stack_page(task))-8); \
564 __regs__ - 1; \ 578 __regs__ - 1; \
565}) 579})
566 580
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
index 7e0f2945d17d..f324c53b6f9a 100644
--- a/include/asm-i386/ptrace.h
+++ b/include/asm-i386/ptrace.h
@@ -54,6 +54,9 @@ struct pt_regs {
54#define PTRACE_GET_THREAD_AREA 25 54#define PTRACE_GET_THREAD_AREA 25
55#define PTRACE_SET_THREAD_AREA 26 55#define PTRACE_SET_THREAD_AREA 26
56 56
57#define PTRACE_SYSEMU 31
58#define PTRACE_SYSEMU_SINGLESTEP 32
59
57#ifdef __KERNEL__ 60#ifdef __KERNEL__
58 61
59#include <asm/vm86.h> 62#include <asm/vm86.h>
diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h
index bb5ff5b2c02e..faf995307b9e 100644
--- a/include/asm-i386/segment.h
+++ b/include/asm-i386/segment.h
@@ -91,6 +91,20 @@
91#define GDT_ENTRY_BOOT_DS (GDT_ENTRY_BOOT_CS + 1) 91#define GDT_ENTRY_BOOT_DS (GDT_ENTRY_BOOT_CS + 1)
92#define __BOOT_DS (GDT_ENTRY_BOOT_DS * 8) 92#define __BOOT_DS (GDT_ENTRY_BOOT_DS * 8)
93 93
94/* The PnP BIOS entries in the GDT */
95#define GDT_ENTRY_PNPBIOS_CS32 (GDT_ENTRY_PNPBIOS_BASE + 0)
96#define GDT_ENTRY_PNPBIOS_CS16 (GDT_ENTRY_PNPBIOS_BASE + 1)
97#define GDT_ENTRY_PNPBIOS_DS (GDT_ENTRY_PNPBIOS_BASE + 2)
98#define GDT_ENTRY_PNPBIOS_TS1 (GDT_ENTRY_PNPBIOS_BASE + 3)
99#define GDT_ENTRY_PNPBIOS_TS2 (GDT_ENTRY_PNPBIOS_BASE + 4)
100
101/* The PnP BIOS selectors */
102#define PNP_CS32 (GDT_ENTRY_PNPBIOS_CS32 * 8) /* segment for calling fn */
103#define PNP_CS16 (GDT_ENTRY_PNPBIOS_CS16 * 8) /* code segment for BIOS */
104#define PNP_DS (GDT_ENTRY_PNPBIOS_DS * 8) /* data segment for BIOS */
105#define PNP_TS1 (GDT_ENTRY_PNPBIOS_TS1 * 8) /* transfer data segment */
106#define PNP_TS2 (GDT_ENTRY_PNPBIOS_TS2 * 8) /* another data segment */
107
94/* 108/*
95 * The interrupt descriptor table has room for 256 idt's, 109 * The interrupt descriptor table has room for 256 idt's,
96 * the global descriptor table is dependent on the number 110 * the global descriptor table is dependent on the number
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 772f85da1206..36a92ed6a9d0 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -54,23 +54,7 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
54 ); } while(0) 54 ); } while(0)
55 55
56#define set_base(ldt,base) _set_base( ((char *)&(ldt)) , (base) ) 56#define set_base(ldt,base) _set_base( ((char *)&(ldt)) , (base) )
57#define set_limit(ldt,limit) _set_limit( ((char *)&(ldt)) , ((limit)-1)>>12 ) 57#define set_limit(ldt,limit) _set_limit( ((char *)&(ldt)) , ((limit)-1) )
58
59static inline unsigned long _get_base(char * addr)
60{
61 unsigned long __base;
62 __asm__("movb %3,%%dh\n\t"
63 "movb %2,%%dl\n\t"
64 "shll $16,%%edx\n\t"
65 "movw %1,%%dx"
66 :"=&d" (__base)
67 :"m" (*((addr)+2)),
68 "m" (*((addr)+4)),
69 "m" (*((addr)+7)));
70 return __base;
71}
72
73#define get_base(ldt) _get_base( ((char *)&(ldt)) )
74 58
75/* 59/*
76 * Load a segment. Fall back on loading the zero 60 * Load a segment. Fall back on loading the zero
@@ -140,6 +124,19 @@ static inline unsigned long _get_base(char * addr)
140 :"=r" (__dummy)); \ 124 :"=r" (__dummy)); \
141 __dummy; \ 125 __dummy; \
142}) 126})
127
128#define read_cr4_safe() ({ \
129 unsigned int __dummy; \
130 /* This could fault if %cr4 does not exist */ \
131 __asm__("1: movl %%cr4, %0 \n" \
132 "2: \n" \
133 ".section __ex_table,\"a\" \n" \
134 ".long 1b,2b \n" \
135 ".previous \n" \
136 : "=r" (__dummy): "0" (0)); \
137 __dummy; \
138})
139
143#define write_cr4(x) \ 140#define write_cr4(x) \
144 __asm__ __volatile__("movl %0,%%cr4": :"r" (x)); 141 __asm__ __volatile__("movl %0,%%cr4": :"r" (x));
145#define stts() write_cr0(8 | read_cr0()) 142#define stts() write_cr0(8 | read_cr0())
@@ -551,6 +548,15 @@ void enable_hlt(void);
551extern int es7000_plat; 548extern int es7000_plat;
552void cpu_idle_wait(void); 549void cpu_idle_wait(void);
553 550
551/*
552 * On SMP systems, when the scheduler does migration-cost autodetection,
553 * it needs a way to flush as much of the CPU's caches as possible:
554 */
555static inline void sched_cacheflush(void)
556{
557 wbinvd();
558}
559
554extern unsigned long arch_align_stack(unsigned long sp); 560extern unsigned long arch_align_stack(unsigned long sp);
555 561
556#endif 562#endif
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index 8fbf791651bf..2493e77e8c30 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -111,8 +111,6 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
111#endif 111#endif
112 112
113#define free_thread_info(info) kfree(info) 113#define free_thread_info(info) kfree(info)
114#define get_thread_info(ti) get_task_struct((ti)->task)
115#define put_thread_info(ti) put_task_struct((ti)->task)
116 114
117#else /* !__ASSEMBLY__ */ 115#else /* !__ASSEMBLY__ */
118 116
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h
index 0ec27c9e8e45..d7e19eb344b7 100644
--- a/include/asm-i386/topology.h
+++ b/include/asm-i386/topology.h
@@ -72,7 +72,6 @@ static inline int node_to_first_cpu(int node)
72 .max_interval = 32, \ 72 .max_interval = 32, \
73 .busy_factor = 32, \ 73 .busy_factor = 32, \
74 .imbalance_pct = 125, \ 74 .imbalance_pct = 125, \
75 .cache_hot_time = (10*1000000), \
76 .cache_nice_tries = 1, \ 75 .cache_nice_tries = 1, \
77 .busy_idx = 3, \ 76 .busy_idx = 3, \
78 .idle_idx = 1, \ 77 .idle_idx = 1, \
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index 0f92e78dfea1..481c3c0ea720 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -256,7 +256,7 @@
256#define __NR_io_submit 248 256#define __NR_io_submit 248
257#define __NR_io_cancel 249 257#define __NR_io_cancel 249
258#define __NR_fadvise64 250 258#define __NR_fadvise64 250
259#define __NR_set_zone_reclaim 251 259/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
260#define __NR_exit_group 252 260#define __NR_exit_group 252
261#define __NR_lookup_dcookie 253 261#define __NR_lookup_dcookie 253
262#define __NR_epoll_create 254 262#define __NR_epoll_create 254
@@ -299,8 +299,9 @@
299#define __NR_inotify_init 291 299#define __NR_inotify_init 291
300#define __NR_inotify_add_watch 292 300#define __NR_inotify_add_watch 292
301#define __NR_inotify_rm_watch 293 301#define __NR_inotify_rm_watch 293
302#define __NR_migrate_pages 294
302 303
303#define NR_syscalls 294 304#define NR_syscalls 295
304 305
305/* 306/*
306 * user-visible error numbers are in the range -1 - -128: see 307 * user-visible error numbers are in the range -1 - -128: see
diff --git a/include/asm-i386/vm86.h b/include/asm-i386/vm86.h
index 40ec82c6914d..952fd6957380 100644
--- a/include/asm-i386/vm86.h
+++ b/include/asm-i386/vm86.h
@@ -16,7 +16,11 @@
16#define IF_MASK 0x00000200 16#define IF_MASK 0x00000200
17#define IOPL_MASK 0x00003000 17#define IOPL_MASK 0x00003000
18#define NT_MASK 0x00004000 18#define NT_MASK 0x00004000
19#ifdef CONFIG_VM86
19#define VM_MASK 0x00020000 20#define VM_MASK 0x00020000
21#else
22#define VM_MASK 0 /* ignored */
23#endif
20#define AC_MASK 0x00040000 24#define AC_MASK 0x00040000
21#define VIF_MASK 0x00080000 /* virtual interrupt flag */ 25#define VIF_MASK 0x00080000 /* virtual interrupt flag */
22#define VIP_MASK 0x00100000 /* virtual interrupt pending */ 26#define VIP_MASK 0x00100000 /* virtual interrupt pending */
@@ -200,9 +204,25 @@ struct kernel_vm86_struct {
200 */ 204 */
201}; 205};
202 206
207#ifdef CONFIG_VM86
208
203void handle_vm86_fault(struct kernel_vm86_regs *, long); 209void handle_vm86_fault(struct kernel_vm86_regs *, long);
204int handle_vm86_trap(struct kernel_vm86_regs *, long, int); 210int handle_vm86_trap(struct kernel_vm86_regs *, long, int);
205 211
212struct task_struct;
213void release_vm86_irqs(struct task_struct *);
214
215#else
216
217#define handle_vm86_fault(a, b)
218#define release_vm86_irqs(a)
219
220static inline int handle_vm86_trap(struct kernel_vm86_regs *a, long b, int c) {
221 return 0;
222}
223
224#endif /* CONFIG_VM86 */
225
206#endif /* __KERNEL__ */ 226#endif /* __KERNEL__ */
207 227
208#endif 228#endif
diff --git a/include/asm-ia64/atomic.h b/include/asm-ia64/atomic.h
index 2fbebf85c31d..d3e0dfa99e1f 100644
--- a/include/asm-ia64/atomic.h
+++ b/include/asm-ia64/atomic.h
@@ -89,6 +89,7 @@ ia64_atomic64_sub (__s64 i, atomic64_t *v)
89} 89}
90 90
91#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new)) 91#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new))
92#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
92 93
93#define atomic_add_unless(v, a, u) \ 94#define atomic_add_unless(v, a, u) \
94({ \ 95({ \
@@ -192,4 +193,5 @@ atomic64_add_negative (__s64 i, atomic64_t *v)
192#define smp_mb__before_atomic_inc() barrier() 193#define smp_mb__before_atomic_inc() barrier()
193#define smp_mb__after_atomic_inc() barrier() 194#define smp_mb__after_atomic_inc() barrier()
194 195
196#include <asm-generic/atomic.h>
195#endif /* _ASM_IA64_ATOMIC_H */ 197#endif /* _ASM_IA64_ATOMIC_H */
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
index 7232528e2d0c..36d0fb95ea89 100644
--- a/include/asm-ia64/bitops.h
+++ b/include/asm-ia64/bitops.h
@@ -345,6 +345,7 @@ fls (int t)
345 x |= x >> 16; 345 x |= x >> 16;
346 return ia64_popcnt(x); 346 return ia64_popcnt(x);
347} 347}
348#define fls64(x) generic_fls64(x)
348 349
349/* 350/*
350 * ffs: find first bit set. This is defined the same way as the libc and compiler builtin 351 * ffs: find first bit set. This is defined the same way as the libc and compiler builtin
diff --git a/include/asm-ia64/bug.h b/include/asm-ia64/bug.h
index 3aa0a0a5474b..823616b5020b 100644
--- a/include/asm-ia64/bug.h
+++ b/include/asm-ia64/bug.h
@@ -2,11 +2,7 @@
2#define _ASM_IA64_BUG_H 2#define _ASM_IA64_BUG_H
3 3
4#ifdef CONFIG_BUG 4#ifdef CONFIG_BUG
5#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) 5#define ia64_abort() __builtin_trap()
6# define ia64_abort() __builtin_trap()
7#else
8# define ia64_abort() (*(volatile int *) 0 = 0)
9#endif
10#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); ia64_abort(); } while (0) 6#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); ia64_abort(); } while (0)
11 7
12/* should this BUG be made generic? */ 8/* should this BUG be made generic? */
diff --git a/include/asm-ia64/cache.h b/include/asm-ia64/cache.h
index 666d8f175cb3..40dd25195d65 100644
--- a/include/asm-ia64/cache.h
+++ b/include/asm-ia64/cache.h
@@ -12,8 +12,6 @@
12#define L1_CACHE_SHIFT CONFIG_IA64_L1_CACHE_SHIFT 12#define L1_CACHE_SHIFT CONFIG_IA64_L1_CACHE_SHIFT
13#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 13#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
14 14
15#define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */
16
17#ifdef CONFIG_SMP 15#ifdef CONFIG_SMP
18# define SMP_CACHE_SHIFT L1_CACHE_SHIFT 16# define SMP_CACHE_SHIFT L1_CACHE_SHIFT
19# define SMP_CACHE_BYTES L1_CACHE_BYTES 17# define SMP_CACHE_BYTES L1_CACHE_BYTES
diff --git a/include/asm-ia64/compat.h b/include/asm-ia64/compat.h
index aaf11f4e9169..c0b19106665c 100644
--- a/include/asm-ia64/compat.h
+++ b/include/asm-ia64/compat.h
@@ -192,7 +192,7 @@ compat_ptr (compat_uptr_t uptr)
192static __inline__ void __user * 192static __inline__ void __user *
193compat_alloc_user_space (long len) 193compat_alloc_user_space (long len)
194{ 194{
195 struct pt_regs *regs = ia64_task_regs(current); 195 struct pt_regs *regs = task_pt_regs(current);
196 return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len); 196 return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
197} 197}
198 198
diff --git a/include/asm-ia64/futex.h b/include/asm-ia64/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-ia64/futex.h
+++ b/include/asm-ia64/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index cf772a67f858..b64fdb985494 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -89,6 +89,7 @@ phys_to_virt (unsigned long address)
89 89
90#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 90#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
91extern int valid_phys_addr_range (unsigned long addr, size_t *count); /* efi.c */ 91extern int valid_phys_addr_range (unsigned long addr, size_t *count); /* efi.c */
92extern int valid_mmap_phys_addr_range (unsigned long addr, size_t *count);
92 93
93/* 94/*
94 * The following two macros are deprecated and scheduled for removal. 95 * The following two macros are deprecated and scheduled for removal.
diff --git a/include/asm-ia64/ioctl.h b/include/asm-ia64/ioctl.h
index be9cc2403d2a..b279fe06dfe5 100644
--- a/include/asm-ia64/ioctl.h
+++ b/include/asm-ia64/ioctl.h
@@ -1,77 +1 @@
1#ifndef _ASM_IA64_IOCTL_H #include <asm-generic/ioctl.h>
2#define _ASM_IA64_IOCTL_H
3
4/*
5 * Based on <asm-i386/ioctl.h>.
6 *
7 * Modified 1998, 1999
8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
9 */
10
11/* ioctl command encoding: 32 bits total, command in lower 16 bits,
12 * size of the parameter structure in the lower 14 bits of the
13 * upper 16 bits.
14 * Encoding the size of the parameter structure in the ioctl request
15 * is useful for catching programs compiled with old versions
16 * and to avoid overwriting user space outside the user buffer area.
17 * The highest 2 bits are reserved for indicating the ``access mode''.
18 * NOTE: This limits the max parameter size to 16kB -1 !
19 */
20
21/*
22 * The following is for compatibility across the various Linux
23 * platforms. The ia64 ioctl numbering scheme doesn't really enforce
24 * a type field. De facto, however, the top 8 bits of the lower 16
25 * bits are indeed used as a type field, so we might just as well make
26 * this explicit here. Please be sure to use the decoding macros
27 * below from now on.
28 */
29#define _IOC_NRBITS 8
30#define _IOC_TYPEBITS 8
31#define _IOC_SIZEBITS 14
32#define _IOC_DIRBITS 2
33
34#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
35#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
36#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
37#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
38
39#define _IOC_NRSHIFT 0
40#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
41#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
42#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
43
44/*
45 * Direction bits.
46 */
47#define _IOC_NONE 0U
48#define _IOC_WRITE 1U
49#define _IOC_READ 2U
50
51#define _IOC(dir,type,nr,size) \
52 (((dir) << _IOC_DIRSHIFT) | \
53 ((type) << _IOC_TYPESHIFT) | \
54 ((nr) << _IOC_NRSHIFT) | \
55 ((size) << _IOC_SIZESHIFT))
56
57/* used to create numbers */
58#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
59#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
60#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
61#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
62
63/* used to decode ioctl numbers.. */
64#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
65#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
66#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
67#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
68
69/* ...and for the drivers/sound files... */
70
71#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
72#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
73#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
74#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
75#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
76
77#endif /* _ASM_IA64_IOCTL_H */
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h
index 592abb000e29..a74b68104559 100644
--- a/include/asm-ia64/kprobes.h
+++ b/include/asm-ia64/kprobes.h
@@ -89,6 +89,7 @@ struct kprobe_ctlblk {
89#define IP_RELATIVE_PREDICT_OPCODE (7) 89#define IP_RELATIVE_PREDICT_OPCODE (7)
90#define LONG_BRANCH_OPCODE (0xC) 90#define LONG_BRANCH_OPCODE (0xC)
91#define LONG_CALL_OPCODE (0xD) 91#define LONG_CALL_OPCODE (0xD)
92#define arch_remove_kprobe(p) do {} while (0)
92 93
93typedef struct kprobe_opcode { 94typedef struct kprobe_opcode {
94 bundle_t bundle; 95 bundle_t bundle;
@@ -110,12 +111,6 @@ struct arch_specific_insn {
110 unsigned short target_br_reg; 111 unsigned short target_br_reg;
111}; 112};
112 113
113/* ia64 does not need this */
114static inline void arch_copy_kprobe(struct kprobe *p)
115{
116}
117
118#ifdef CONFIG_KPROBES
119extern int kprobe_exceptions_notify(struct notifier_block *self, 114extern int kprobe_exceptions_notify(struct notifier_block *self,
120 unsigned long val, void *data); 115 unsigned long val, void *data);
121 116
@@ -124,11 +119,4 @@ static inline void jprobe_return(void)
124{ 119{
125} 120}
126 121
127#else /* !CONFIG_KPROBES */
128static inline int kprobe_exceptions_notify(struct notifier_block *self,
129 unsigned long val, void *data)
130{
131 return 0;
132}
133#endif
134#endif /* _ASM_KPROBES_H */ 122#endif /* _ASM_KPROBES_H */
diff --git a/include/asm-ia64/mman.h b/include/asm-ia64/mman.h
index 1c0a73af1461..828beb24a20e 100644
--- a/include/asm-ia64/mman.h
+++ b/include/asm-ia64/mman.h
@@ -43,6 +43,7 @@
43#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 43#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
44#define MADV_WILLNEED 0x3 /* pre-fault pages */ 44#define MADV_WILLNEED 0x3 /* pre-fault pages */
45#define MADV_DONTNEED 0x4 /* discard these pages */ 45#define MADV_DONTNEED 0x4 /* discard these pages */
46#define MADV_REMOVE 0x5 /* remove these pages & resources */
46 47
47/* compatibility flags */ 48/* compatibility flags */
48#define MAP_ANON MAP_ANONYMOUS 49#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-ia64/mutex.h b/include/asm-ia64/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-ia64/mutex.h
@@ -0,0 +1,9 @@
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-ia64/processor.h b/include/asm-ia64/processor.h
index 94e07e727395..8c648bf72bbd 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -352,7 +352,7 @@ extern unsigned long get_wchan (struct task_struct *p);
352/* Return instruction pointer of blocked task TSK. */ 352/* Return instruction pointer of blocked task TSK. */
353#define KSTK_EIP(tsk) \ 353#define KSTK_EIP(tsk) \
354 ({ \ 354 ({ \
355 struct pt_regs *_regs = ia64_task_regs(tsk); \ 355 struct pt_regs *_regs = task_pt_regs(tsk); \
356 _regs->cr_iip + ia64_psr(_regs)->ri; \ 356 _regs->cr_iip + ia64_psr(_regs)->ri; \
357 }) 357 })
358 358
diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h
index 2c703d6e0c86..9471cdc3f4c0 100644
--- a/include/asm-ia64/ptrace.h
+++ b/include/asm-ia64/ptrace.h
@@ -248,7 +248,7 @@ struct switch_stack {
248}) 248})
249 249
250 /* given a pointer to a task_struct, return the user's pt_regs */ 250 /* given a pointer to a task_struct, return the user's pt_regs */
251# define ia64_task_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1) 251# define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
252# define ia64_psr(regs) ((struct ia64_psr *) &(regs)->cr_ipsr) 252# define ia64_psr(regs) ((struct ia64_psr *) &(regs)->cr_ipsr)
253# define user_mode(regs) (((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0) 253# define user_mode(regs) (((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0)
254# define user_stack(task,regs) ((long) regs - (long) task == IA64_STK_OFFSET - sizeof(*regs)) 254# define user_stack(task,regs) ((long) regs - (long) task == IA64_STK_OFFSET - sizeof(*regs))
@@ -271,7 +271,7 @@ struct switch_stack {
271 * 271 *
272 * On ia64, we can clear the user's pt_regs->r8 to force a successful syscall. 272 * On ia64, we can clear the user's pt_regs->r8 to force a successful syscall.
273 */ 273 */
274# define force_successful_syscall_return() (ia64_task_regs(current)->r8 = 0) 274# define force_successful_syscall_return() (task_pt_regs(current)->r8 = 0)
275 275
276 struct task_struct; /* forward decl */ 276 struct task_struct; /* forward decl */
277 struct unw_frame_info; /* forward decl */ 277 struct unw_frame_info; /* forward decl */
diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
index 0c91a76c5ea3..9e83210dc312 100644
--- a/include/asm-ia64/spinlock.h
+++ b/include/asm-ia64/spinlock.h
@@ -34,7 +34,7 @@ __raw_spin_lock_flags (raw_spinlock_t *lock, unsigned long flags)
34{ 34{
35 register volatile unsigned int *ptr asm ("r31") = &lock->lock; 35 register volatile unsigned int *ptr asm ("r31") = &lock->lock;
36 36
37#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3) 37#if (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
38# ifdef CONFIG_ITANIUM 38# ifdef CONFIG_ITANIUM
39 /* don't use brl on Itanium... */ 39 /* don't use brl on Itanium... */
40 asm volatile ("{\n\t" 40 asm volatile ("{\n\t"
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index 635235fa1e32..80c5a234e259 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -219,14 +219,14 @@ extern void ia64_load_extra (struct task_struct *task);
219 219
220#define IA64_HAS_EXTRA_STATE(t) \ 220#define IA64_HAS_EXTRA_STATE(t) \
221 ((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID) \ 221 ((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID) \
222 || IS_IA32_PROCESS(ia64_task_regs(t)) || PERFMON_IS_SYSWIDE()) 222 || IS_IA32_PROCESS(task_pt_regs(t)) || PERFMON_IS_SYSWIDE())
223 223
224#define __switch_to(prev,next,last) do { \ 224#define __switch_to(prev,next,last) do { \
225 if (IA64_HAS_EXTRA_STATE(prev)) \ 225 if (IA64_HAS_EXTRA_STATE(prev)) \
226 ia64_save_extra(prev); \ 226 ia64_save_extra(prev); \
227 if (IA64_HAS_EXTRA_STATE(next)) \ 227 if (IA64_HAS_EXTRA_STATE(next)) \
228 ia64_load_extra(next); \ 228 ia64_load_extra(next); \
229 ia64_psr(ia64_task_regs(next))->dfh = !ia64_is_local_fpu_owner(next); \ 229 ia64_psr(task_pt_regs(next))->dfh = !ia64_is_local_fpu_owner(next); \
230 (last) = ia64_switch_to((next)); \ 230 (last) = ia64_switch_to((next)); \
231} while (0) 231} while (0)
232 232
@@ -238,8 +238,8 @@ extern void ia64_load_extra (struct task_struct *task);
238 * the latest fph state from another CPU. In other words: eager save, lazy restore. 238 * the latest fph state from another CPU. In other words: eager save, lazy restore.
239 */ 239 */
240# define switch_to(prev,next,last) do { \ 240# define switch_to(prev,next,last) do { \
241 if (ia64_psr(ia64_task_regs(prev))->mfh && ia64_is_local_fpu_owner(prev)) { \ 241 if (ia64_psr(task_pt_regs(prev))->mfh && ia64_is_local_fpu_owner(prev)) { \
242 ia64_psr(ia64_task_regs(prev))->mfh = 0; \ 242 ia64_psr(task_pt_regs(prev))->mfh = 0; \
243 (prev)->thread.flags |= IA64_THREAD_FPH_VALID; \ 243 (prev)->thread.flags |= IA64_THREAD_FPH_VALID; \
244 __ia64_save_fpu((prev)->thread.fph); \ 244 __ia64_save_fpu((prev)->thread.fph); \
245 } \ 245 } \
@@ -279,6 +279,7 @@ extern void ia64_load_extra (struct task_struct *task);
279#define ia64_platform_is(x) (strcmp(x, platform_name) == 0) 279#define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
280 280
281void cpu_idle_wait(void); 281void cpu_idle_wait(void);
282void sched_cacheflush(void);
282 283
283#define arch_align_stack(x) (x) 284#define arch_align_stack(x) (x)
284 285
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h
index 171b2207bde4..653bb7f9a753 100644
--- a/include/asm-ia64/thread_info.h
+++ b/include/asm-ia64/thread_info.h
@@ -57,11 +57,20 @@ struct thread_info {
57/* how to get the thread information struct from C */ 57/* how to get the thread information struct from C */
58#define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE)) 58#define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE))
59#define alloc_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE)) 59#define alloc_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
60#define task_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
60#else 61#else
61#define current_thread_info() ((struct thread_info *) 0) 62#define current_thread_info() ((struct thread_info *) 0)
62#define alloc_thread_info(tsk) ((struct thread_info *) 0) 63#define alloc_thread_info(tsk) ((struct thread_info *) 0)
64#define task_thread_info(tsk) ((struct thread_info *) 0)
63#endif 65#endif
64#define free_thread_info(ti) /* nothing */ 66#define free_thread_info(ti) /* nothing */
67#define task_stack_page(tsk) ((void *)(tsk))
68
69#define __HAVE_THREAD_FUNCTIONS
70#define setup_thread_stack(p, org) \
71 *task_thread_info(p) = *task_thread_info(org); \
72 task_thread_info(p)->task = (p);
73#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
65 74
66#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR 75#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
67#define alloc_task_struct() ((task_t *)__get_free_pages(GFP_KERNEL, KERNEL_STACK_SIZE_ORDER)) 76#define alloc_task_struct() ((task_t *)__get_free_pages(GFP_KERNEL, KERNEL_STACK_SIZE_ORDER))
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
index f7c330467e7e..d8aae4da3978 100644
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -55,7 +55,6 @@ void build_cpu_to_node_map(void);
55 .max_interval = 4, \ 55 .max_interval = 4, \
56 .busy_factor = 64, \ 56 .busy_factor = 64, \
57 .imbalance_pct = 125, \ 57 .imbalance_pct = 125, \
58 .cache_hot_time = (10*1000000), \
59 .per_cpu_gain = 100, \ 58 .per_cpu_gain = 100, \
60 .cache_nice_tries = 2, \ 59 .cache_nice_tries = 2, \
61 .busy_idx = 2, \ 60 .busy_idx = 2, \
@@ -81,7 +80,6 @@ void build_cpu_to_node_map(void);
81 .max_interval = 8*(min(num_online_cpus(), 32)), \ 80 .max_interval = 8*(min(num_online_cpus(), 32)), \
82 .busy_factor = 64, \ 81 .busy_factor = 64, \
83 .imbalance_pct = 125, \ 82 .imbalance_pct = 125, \
84 .cache_hot_time = (10*1000000), \
85 .cache_nice_tries = 2, \ 83 .cache_nice_tries = 2, \
86 .busy_idx = 3, \ 84 .busy_idx = 3, \
87 .idle_idx = 2, \ 85 .idle_idx = 2, \
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 6d96a67439be..962f9bd1bdff 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -265,16 +265,17 @@
265#define __NR_keyctl 1273 265#define __NR_keyctl 1273
266#define __NR_ioprio_set 1274 266#define __NR_ioprio_set 1274
267#define __NR_ioprio_get 1275 267#define __NR_ioprio_get 1275
268#define __NR_set_zone_reclaim 1276 268/* 1276 is available for reuse (was briefly sys_set_zone_reclaim) */
269#define __NR_inotify_init 1277 269#define __NR_inotify_init 1277
270#define __NR_inotify_add_watch 1278 270#define __NR_inotify_add_watch 1278
271#define __NR_inotify_rm_watch 1279 271#define __NR_inotify_rm_watch 1279
272#define __NR_migrate_pages 1280
272 273
273#ifdef __KERNEL__ 274#ifdef __KERNEL__
274 275
275#include <linux/config.h> 276#include <linux/config.h>
276 277
277#define NR_syscalls 256 /* length of syscall table */ 278#define NR_syscalls 270 /* length of syscall table */
278 279
279#define __ARCH_WANT_SYS_RT_SIGACTION 280#define __ARCH_WANT_SYS_RT_SIGACTION
280 281
diff --git a/include/asm-m32r/assembler.h b/include/asm-m32r/assembler.h
index e1dff9d6baad..b7f4d8aaeb46 100644
--- a/include/asm-m32r/assembler.h
+++ b/include/asm-m32r/assembler.h
@@ -52,7 +52,7 @@
52 or3 \reg, \reg, #low(\x) 52 or3 \reg, \reg, #low(\x)
53 .endm 53 .endm
54 54
55#if !defined(CONFIG_CHIP_M32102) 55#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
56#define STI(reg) STI_M reg 56#define STI(reg) STI_M reg
57 .macro STI_M reg 57 .macro STI_M reg
58 setpsw #0x40 -> nop 58 setpsw #0x40 -> nop
@@ -64,7 +64,7 @@
64 clrpsw #0x40 -> nop 64 clrpsw #0x40 -> nop
65 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1). 65 ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1).
66 .endm 66 .endm
67#else /* CONFIG_CHIP_M32102 */ 67#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
68#define STI(reg) STI_M reg 68#define STI(reg) STI_M reg
69 .macro STI_M reg 69 .macro STI_M reg
70 mvfc \reg, psw 70 mvfc \reg, psw
@@ -191,12 +191,12 @@
191 and \reg, sp 191 and \reg, sp
192 .endm 192 .endm
193 193
194#if !defined(CONFIG_CHIP_M32102) 194#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
195 .macro SWITCH_TO_KERNEL_STACK 195 .macro SWITCH_TO_KERNEL_STACK
196 ; switch to kernel stack (spi) 196 ; switch to kernel stack (spi)
197 clrpsw #0x80 -> nop 197 clrpsw #0x80 -> nop
198 .endm 198 .endm
199#else /* CONFIG_CHIP_M32102 */ 199#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
200 .macro SWITCH_TO_KERNEL_STACK 200 .macro SWITCH_TO_KERNEL_STACK
201 push r0 ; save r0 for working 201 push r0 ; save r0 for working
202 mvfc r0, psw 202 mvfc r0, psw
@@ -218,7 +218,7 @@
218 .fillinsn 218 .fillinsn
2192: 2192:
220 .endm 220 .endm
221#endif /* CONFIG_CHIP_M32102 */ 221#endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
222 222
223#endif /* __ASSEMBLY__ */ 223#endif /* __ASSEMBLY__ */
224 224
diff --git a/include/asm-m32r/atomic.h b/include/asm-m32r/atomic.h
index ef1fb8ea4726..3122fe106f05 100644
--- a/include/asm-m32r/atomic.h
+++ b/include/asm-m32r/atomic.h
@@ -243,6 +243,7 @@ static __inline__ int atomic_dec_return(atomic_t *v)
243#define atomic_add_negative(i,v) (atomic_add_return((i), (v)) < 0) 243#define atomic_add_negative(i,v) (atomic_add_return((i), (v)) < 0)
244 244
245#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 245#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
246#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
246 247
247/** 248/**
248 * atomic_add_unless - add unless the number is a given value 249 * atomic_add_unless - add unless the number is a given value
@@ -313,4 +314,5 @@ static __inline__ void atomic_set_mask(unsigned long mask, atomic_t *addr)
313#define smp_mb__before_atomic_inc() barrier() 314#define smp_mb__before_atomic_inc() barrier()
314#define smp_mb__after_atomic_inc() barrier() 315#define smp_mb__after_atomic_inc() barrier()
315 316
317#include <asm-generic/atomic.h>
316#endif /* _ASM_M32R_ATOMIC_H */ 318#endif /* _ASM_M32R_ATOMIC_H */
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h
index e78443981349..abea2fdd8689 100644
--- a/include/asm-m32r/bitops.h
+++ b/include/asm-m32r/bitops.h
@@ -465,6 +465,7 @@ static __inline__ unsigned long __ffs(unsigned long word)
465 * fls: find last bit set. 465 * fls: find last bit set.
466 */ 466 */
467#define fls(x) generic_fls(x) 467#define fls(x) generic_fls(x)
468#define fls64(x) generic_fls64(x)
468 469
469#ifdef __KERNEL__ 470#ifdef __KERNEL__
470 471
diff --git a/include/asm-m32r/cache.h b/include/asm-m32r/cache.h
index 724820596980..9c2b2d9998bc 100644
--- a/include/asm-m32r/cache.h
+++ b/include/asm-m32r/cache.h
@@ -7,6 +7,4 @@
7#define L1_CACHE_SHIFT 4 7#define L1_CACHE_SHIFT 4
8#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 8#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
9 9
10#define L1_CACHE_SHIFT_MAX 4
11
12#endif /* _ASM_M32R_CACHE_H */ 10#endif /* _ASM_M32R_CACHE_H */
diff --git a/include/asm-m32r/cacheflush.h b/include/asm-m32r/cacheflush.h
index 46fc4c325108..e57427b6e249 100644
--- a/include/asm-m32r/cacheflush.h
+++ b/include/asm-m32r/cacheflush.h
@@ -7,7 +7,7 @@
7extern void _flush_cache_all(void); 7extern void _flush_cache_all(void);
8extern void _flush_cache_copyback_all(void); 8extern void _flush_cache_copyback_all(void);
9 9
10#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) 10#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
11#define flush_cache_all() do { } while (0) 11#define flush_cache_all() do { } while (0)
12#define flush_cache_mm(mm) do { } while (0) 12#define flush_cache_mm(mm) do { } while (0)
13#define flush_cache_range(vma, start, end) do { } while (0) 13#define flush_cache_range(vma, start, end) do { } while (0)
diff --git a/include/asm-m32r/futex.h b/include/asm-m32r/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-m32r/futex.h
+++ b/include/asm-m32r/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-m32r/ioctl.h b/include/asm-m32r/ioctl.h
index 87d8f7db6af1..b279fe06dfe5 100644
--- a/include/asm-m32r/ioctl.h
+++ b/include/asm-m32r/ioctl.h
@@ -1,78 +1 @@
1#ifndef _ASM_M32R_IOCTL_H #include <asm-generic/ioctl.h>
2#define _ASM_M32R_IOCTL_H
3
4/* $Id$ */
5
6/* orig : i386 2.4.18 */
7
8/*
9 * linux/ioctl.h for Linux by H.H. Bergman.
10 */
11
12/* ioctl command encoding: 32 bits total, command in lower 16 bits,
13 * size of the parameter structure in the lower 14 bits of the
14 * upper 16 bits.
15 * Encoding the size of the parameter structure in the ioctl request
16 * is useful for catching programs compiled with old versions
17 * and to avoid overwriting user space outside the user buffer area.
18 * The highest 2 bits are reserved for indicating the ``access mode''.
19 * NOTE: This limits the max parameter size to 16kB -1 !
20 */
21
22/*
23 * The following is for compatibility across the various Linux
24 * platforms. The i386 ioctl numbering scheme doesn't really enforce
25 * a type field. De facto, however, the top 8 bits of the lower 16
26 * bits are indeed used as a type field, so we might just as well make
27 * this explicit here. Please be sure to use the decoding macros
28 * below from now on.
29 */
30#define _IOC_NRBITS 8
31#define _IOC_TYPEBITS 8
32#define _IOC_SIZEBITS 14
33#define _IOC_DIRBITS 2
34
35#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
36#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
37#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
38#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
39
40#define _IOC_NRSHIFT 0
41#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
42#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
43#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
44
45/*
46 * Direction bits.
47 */
48#define _IOC_NONE 0U
49#define _IOC_WRITE 1U
50#define _IOC_READ 2U
51
52#define _IOC(dir,type,nr,size) \
53 (((dir) << _IOC_DIRSHIFT) | \
54 ((type) << _IOC_TYPESHIFT) | \
55 ((nr) << _IOC_NRSHIFT) | \
56 ((size) << _IOC_SIZESHIFT))
57
58/* used to create numbers */
59#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
60#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
61#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
62#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
63
64/* used to decode ioctl numbers.. */
65#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
66#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
67#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
68#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
69
70/* ...and for the drivers/sound files... */
71
72#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
73#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
74#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
75#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
76#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
77
78#endif /* _ASM_M32R_IOCTL_H */
diff --git a/include/asm-m32r/irq.h b/include/asm-m32r/irq.h
index 8ed77968ecb4..ca943954572a 100644
--- a/include/asm-m32r/irq.h
+++ b/include/asm-m32r/irq.h
@@ -65,6 +65,22 @@
65#define NR_IRQS \ 65#define NR_IRQS \
66 (OPSPUT_NUM_CPU_IRQ + OPSPUT_NUM_PLD_IRQ \ 66 (OPSPUT_NUM_CPU_IRQ + OPSPUT_NUM_PLD_IRQ \
67 + OPSPUT_NUM_LCD_PLD_IRQ + OPSPUT_NUM_LAN_PLD_IRQ) 67 + OPSPUT_NUM_LCD_PLD_IRQ + OPSPUT_NUM_LAN_PLD_IRQ)
68
69#elif defined(CONFIG_PLAT_M32104UT)
70/*
71 * IRQ definitions for M32104UT
72 * M32104 Chip: 64 interrupts
73 * ICU of M32104UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin
74 */
75#define M32104UT_NUM_CPU_IRQ (64)
76#define M32104UT_NUM_PLD_IRQ (32)
77#define M32104UT_IRQ_BASE 0
78#define M32104UT_CPU_IRQ_BASE M32104UT_IRQ_BASE
79#define M32104UT_PLD_IRQ_BASE (M32104UT_CPU_IRQ_BASE + M32104UT_NUM_CPU_IRQ)
80
81#define NR_IRQS \
82 (M32104UT_NUM_CPU_IRQ + M32104UT_NUM_PLD_IRQ)
83
68#else 84#else
69#define NR_IRQS 64 85#define NR_IRQS 64
70#endif 86#endif
diff --git a/include/asm-m32r/m32102.h b/include/asm-m32r/m32102.h
index cb98101f4f6e..a1f0d1fe9eb8 100644
--- a/include/asm-m32r/m32102.h
+++ b/include/asm-m32r/m32102.h
@@ -11,7 +11,11 @@
11/*======================================================================* 11/*======================================================================*
12 * Special Function Register 12 * Special Function Register
13 *======================================================================*/ 13 *======================================================================*/
14#if !defined(CONFIG_CHIP_M32104)
14#define M32R_SFR_OFFSET (0x00E00000) /* 0x00E00000-0x00EFFFFF 1[MB] */ 15#define M32R_SFR_OFFSET (0x00E00000) /* 0x00E00000-0x00EFFFFF 1[MB] */
16#else
17#define M32R_SFR_OFFSET (0x00700000) /* 0x00700000-0x007FFFFF 1[MB] */
18#endif
15 19
16/* 20/*
17 * Clock and Power Management registers. 21 * Clock and Power Management registers.
@@ -100,7 +104,7 @@
100#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */ 104#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */
101#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */ 105#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */
102 106
103#ifdef CONFIG_CHIP_M32700 107#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32104)
104#define M32R_MFTCR_MFT0MSK (1UL<<31) /* b0 */ 108#define M32R_MFTCR_MFT0MSK (1UL<<31) /* b0 */
105#define M32R_MFTCR_MFT1MSK (1UL<<30) /* b1 */ 109#define M32R_MFTCR_MFT1MSK (1UL<<30) /* b1 */
106#define M32R_MFTCR_MFT2MSK (1UL<<29) /* b2 */ 110#define M32R_MFTCR_MFT2MSK (1UL<<29) /* b2 */
@@ -113,7 +117,7 @@
113#define M32R_MFTCR_MFT3EN (1UL<<20) /* b11 */ 117#define M32R_MFTCR_MFT3EN (1UL<<20) /* b11 */
114#define M32R_MFTCR_MFT4EN (1UL<<19) /* b12 */ 118#define M32R_MFTCR_MFT4EN (1UL<<19) /* b12 */
115#define M32R_MFTCR_MFT5EN (1UL<<18) /* b13 */ 119#define M32R_MFTCR_MFT5EN (1UL<<18) /* b13 */
116#else /* not CONFIG_CHIP_M32700 */ 120#else /* not CONFIG_CHIP_M32700 && not CONFIG_CHIP_M32104 */
117#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */ 121#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */
118#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */ 122#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */
119#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */ 123#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */
@@ -126,7 +130,7 @@
126#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */ 130#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */
127#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */ 131#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */
128#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */ 132#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */
129#endif /* not CONFIG_CHIP_M32700 */ 133#endif /* not CONFIG_CHIP_M32700 && not CONFIG_CHIP_M32104 */
130 134
131#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */ 135#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */
132#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */ 136#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */
@@ -241,8 +245,24 @@
241#define M32R_IRQ_MFT1 (17) /* MFT1 */ 245#define M32R_IRQ_MFT1 (17) /* MFT1 */
242#define M32R_IRQ_MFT2 (18) /* MFT2 */ 246#define M32R_IRQ_MFT2 (18) /* MFT2 */
243#define M32R_IRQ_MFT3 (19) /* MFT3 */ 247#define M32R_IRQ_MFT3 (19) /* MFT3 */
244#define M32R_IRQ_MFT4 (20) /* MFT4 */ 248#ifdef CONFIG_CHIP_M32104
245#define M32R_IRQ_MFT5 (21) /* MFT5 */ 249#define M32R_IRQ_MFTX0 (24) /* MFTX0 */
250#define M32R_IRQ_MFTX1 (25) /* MFTX1 */
251#define M32R_IRQ_DMA0 (32) /* DMA0 */
252#define M32R_IRQ_DMA1 (33) /* DMA1 */
253#define M32R_IRQ_DMA2 (34) /* DMA2 */
254#define M32R_IRQ_DMA3 (35) /* DMA3 */
255#define M32R_IRQ_SIO0_R (40) /* SIO0 send */
256#define M32R_IRQ_SIO0_S (41) /* SIO0 receive */
257#define M32R_IRQ_SIO1_R (42) /* SIO1 send */
258#define M32R_IRQ_SIO1_S (43) /* SIO1 receive */
259#define M32R_IRQ_SIO2_R (44) /* SIO2 send */
260#define M32R_IRQ_SIO2_S (45) /* SIO2 receive */
261#define M32R_IRQ_SIO3_R (46) /* SIO3 send */
262#define M32R_IRQ_SIO3_S (47) /* SIO3 receive */
263#define M32R_IRQ_ADC (56) /* ADC */
264#define M32R_IRQ_PC (57) /* PC */
265#else /* ! M32104 */
246#define M32R_IRQ_DMA0 (32) /* DMA0 */ 266#define M32R_IRQ_DMA0 (32) /* DMA0 */
247#define M32R_IRQ_DMA1 (33) /* DMA1 */ 267#define M32R_IRQ_DMA1 (33) /* DMA1 */
248#define M32R_IRQ_SIO0_R (48) /* SIO0 send */ 268#define M32R_IRQ_SIO0_R (48) /* SIO0 send */
@@ -255,6 +275,7 @@
255#define M32R_IRQ_SIO3_S (55) /* SIO3 receive */ 275#define M32R_IRQ_SIO3_S (55) /* SIO3 receive */
256#define M32R_IRQ_SIO4_R (56) /* SIO4 send */ 276#define M32R_IRQ_SIO4_R (56) /* SIO4 send */
257#define M32R_IRQ_SIO4_S (57) /* SIO4 receive */ 277#define M32R_IRQ_SIO4_S (57) /* SIO4 receive */
278#endif /* ! M32104 */
258 279
259#ifdef CONFIG_SMP 280#ifdef CONFIG_SMP
260#define M32R_IRQ_IPI0 (56) 281#define M32R_IRQ_IPI0 (56)
@@ -281,15 +302,12 @@
281#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP) 302#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP)
282#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP) 303#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP)
283 304
305#endif /* CONFIG_SMP */
306
284#ifndef __ASSEMBLY__ 307#ifndef __ASSEMBLY__
285/* For NETDEV WATCHDOG */
286typedef struct { 308typedef struct {
287 unsigned long icucr; /* ICU Control Register */ 309 unsigned long icucr; /* ICU Control Register */
288} icu_data_t; 310} icu_data_t;
289
290extern icu_data_t icu_data[];
291#endif 311#endif
292 312
293#endif /* CONFIG_SMP */
294
295#endif /* _M32102_H_ */ 313#endif /* _M32102_H_ */
diff --git a/include/asm-m32r/m32104ut/m32104ut_pld.h b/include/asm-m32r/m32104ut/m32104ut_pld.h
new file mode 100644
index 000000000000..a4eac20553df
--- /dev/null
+++ b/include/asm-m32r/m32104ut/m32104ut_pld.h
@@ -0,0 +1,163 @@
1/*
2 * include/asm/m32104ut/m32104ut_pld.h
3 *
4 * Definitions for Programable Logic Device(PLD) on M32104UT board.
5 * Based on m32700ut_pld.h
6 *
7 * Copyright (c) 2002 Takeo Takahashi
8 * Copyright (c) 2005 Naoto Sugai
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 _M32104UT_M32104UT_PLD_H
16#define _M32104UT_M32104UT_PLD_H
17
18#include <linux/config.h>
19
20#if defined(CONFIG_PLAT_M32104UT)
21#define PLD_PLAT_BASE 0x02c00000
22#else
23#error "no platform configuration"
24#endif
25
26#ifndef __ASSEMBLY__
27/*
28 * C functions use non-cache address.
29 */
30#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */)
31#define __reg8 (volatile unsigned char *)
32#define __reg16 (volatile unsigned short *)
33#define __reg32 (volatile unsigned int *)
34#else
35#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET)
36#define __reg8
37#define __reg16
38#define __reg32
39#endif /* __ASSEMBLY__ */
40
41/* CFC */
42#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
43#define PLD_CFSTS __reg16(PLD_BASE + 0x0002)
44#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004)
45#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006)
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 */
74
75#define PLD_IRQ_INT0 (M32104UT_PLD_IRQ_BASE + 0) /* None */
76#define PLD_IRQ_CFIREQ (M32104UT_PLD_IRQ_BASE + 3) /* CF IREQ */
77#define PLD_IRQ_CFC_INSERT (M32104UT_PLD_IRQ_BASE + 4) /* CF Insert */
78#define PLD_IRQ_CFC_EJECT (M32104UT_PLD_IRQ_BASE + 5) /* CF Eject */
79#define PLD_IRQ_EXINT (M32104UT_PLD_IRQ_BASE + 6) /* EXINT */
80#define PLD_IRQ_MMCCARD (M32104UT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */
81#define PLD_IRQ_SC_ERROR (M32104UT_PLD_IRQ_BASE + 13) /* SC error */
82#define PLD_IRQ_SC_RCV (M32104UT_PLD_IRQ_BASE + 14) /* SC receive */
83#define PLD_IRQ_SC_SND (M32104UT_PLD_IRQ_BASE + 15) /* SC send */
84
85#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002)
86#define PLD_ICUISTS_VECB_MASK (0xf000)
87#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK)
88#define PLD_ICUISTS_ISN_MASK (0x07c0)
89#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK)
90#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104)
91#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106)
92#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108)
93#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a)
94#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114)
95#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118)
96#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a)
97#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c)
98#define PLD_ICUCR_IEN (0x1000)
99#define PLD_ICUCR_IREQ (0x0100)
100#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */
101#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */
102#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */
103#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */
104#define PLD_ICUCR_ILEVEL0 (0x0000)
105#define PLD_ICUCR_ILEVEL1 (0x0001)
106#define PLD_ICUCR_ILEVEL2 (0x0002)
107#define PLD_ICUCR_ILEVEL3 (0x0003)
108#define PLD_ICUCR_ILEVEL4 (0x0004)
109#define PLD_ICUCR_ILEVEL5 (0x0005)
110#define PLD_ICUCR_ILEVEL6 (0x0006)
111#define PLD_ICUCR_ILEVEL7 (0x0007)
112
113/* Power Control of MMC and CF */
114#define PLD_CPCR __reg16(PLD_BASE + 0x14000)
115#define PLD_CPCR_CDP 0x0001
116
117/* LED Control
118 *
119 * 1: DIP swich side
120 * 2: Reset switch side
121 */
122#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002)
123#define PLD_IOLED_1_ON 0x001
124#define PLD_IOLED_1_OFF 0x000
125#define PLD_IOLED_2_ON 0x002
126#define PLD_IOLED_2_OFF 0x000
127
128/* DIP Switch
129 * 0: Write-protect of Flash Memory (0:protected, 1:non-protected)
130 * 1: -
131 * 2: -
132 * 3: -
133 */
134#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004)
135#define PLD_IOSWSTS_IOSW2 0x0200
136#define PLD_IOSWSTS_IOSW1 0x0100
137#define PLD_IOSWSTS_IOWP0 0x0001
138
139/* CRC */
140#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000)
141#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002)
142#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004)
143#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006)
144#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008)
145#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a)
146
147/* RTC */
148#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000)
149#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002)
150#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004)
151#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006)
152#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008)
153
154/* SIM Card */
155#define PLD_SCCR __reg16(PLD_BASE + 0x38000)
156#define PLD_SCMOD __reg16(PLD_BASE + 0x38004)
157#define PLD_SCSTS __reg16(PLD_BASE + 0x38006)
158#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008)
159#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a)
160#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
161#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
162
163#endif /* _M32104UT_M32104UT_PLD_H */
diff --git a/include/asm-m32r/m32r.h b/include/asm-m32r/m32r.h
index ec142be00862..b133ca61acf1 100644
--- a/include/asm-m32r/m32r.h
+++ b/include/asm-m32r/m32r.h
@@ -14,7 +14,7 @@
14#include <asm/m32r_mp_fpga.h> 14#include <asm/m32r_mp_fpga.h>
15#elif defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ 15#elif defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \
16 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ 16 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \
17 || defined(CONFIG_CHIP_OPSP) 17 || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
18#include <asm/m32102.h> 18#include <asm/m32102.h>
19#endif 19#endif
20 20
@@ -43,6 +43,10 @@
43#include <asm/m32700ut/m32700ut_pld.h> 43#include <asm/m32700ut/m32700ut_pld.h>
44#endif 44#endif
45 45
46#if defined(CONFIG_PLAT_M32104UT)
47#include <asm/m32104ut/m32104ut_pld.h>
48#endif /* CONFIG_PLAT_M32104 */
49
46/* 50/*
47 * M32R Register 51 * M32R Register
48 */ 52 */
@@ -122,7 +126,7 @@
122 126
123#include <asm/page.h> 127#include <asm/page.h>
124#ifdef CONFIG_MMU 128#ifdef CONFIG_MMU
125#define NONCACHE_OFFSET __PAGE_OFFSET+0x20000000 129#define NONCACHE_OFFSET (__PAGE_OFFSET + 0x20000000)
126#else 130#else
127#define NONCACHE_OFFSET __PAGE_OFFSET 131#define NONCACHE_OFFSET __PAGE_OFFSET
128#endif /* CONFIG_MMU */ 132#endif /* CONFIG_MMU */
diff --git a/include/asm-m32r/mman.h b/include/asm-m32r/mman.h
index 011f6d9ec5cc..12e29747bc84 100644
--- a/include/asm-m32r/mman.h
+++ b/include/asm-m32r/mman.h
@@ -37,6 +37,7 @@
37#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 37#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
38#define MADV_WILLNEED 0x3 /* pre-fault pages */ 38#define MADV_WILLNEED 0x3 /* pre-fault pages */
39#define MADV_DONTNEED 0x4 /* discard these pages */ 39#define MADV_DONTNEED 0x4 /* discard these pages */
40#define MADV_REMOVE 0x5 /* remove these pages & resources */
40 41
41/* compatibility flags */ 42/* compatibility flags */
42#define MAP_ANON MAP_ANONYMOUS 43#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-m32r/mutex.h b/include/asm-m32r/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-m32r/mutex.h
@@ -0,0 +1,9 @@
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/ptrace.h b/include/asm-m32r/ptrace.h
index 55cd7ecfde43..0d058b2d844e 100644
--- a/include/asm-m32r/ptrace.h
+++ b/include/asm-m32r/ptrace.h
@@ -163,6 +163,9 @@ extern void show_regs(struct pt_regs *);
163 163
164extern void withdraw_debug_trap(struct pt_regs *regs); 164extern void withdraw_debug_trap(struct pt_regs *regs);
165 165
166#define task_pt_regs(task) \
167 ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1)
168
166#endif /* __KERNEL */ 169#endif /* __KERNEL */
167 170
168#endif /* _ASM_M32R_PTRACE_H */ 171#endif /* _ASM_M32R_PTRACE_H */
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index 5eee832b73a0..06c12a037cba 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -68,13 +68,23 @@
68 last = __last; \ 68 last = __last; \
69} while(0) 69} while(0)
70 70
71/*
72 * On SMP systems, when the scheduler does migration-cost autodetection,
73 * it needs a way to flush as much of the CPU's caches as possible.
74 *
75 * TODO: fill this in!
76 */
77static inline void sched_cacheflush(void)
78{
79}
80
71/* Interrupt Control */ 81/* Interrupt Control */
72#if !defined(CONFIG_CHIP_M32102) 82#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104)
73#define local_irq_enable() \ 83#define local_irq_enable() \
74 __asm__ __volatile__ ("setpsw #0x40 -> nop": : :"memory") 84 __asm__ __volatile__ ("setpsw #0x40 -> nop": : :"memory")
75#define local_irq_disable() \ 85#define local_irq_disable() \
76 __asm__ __volatile__ ("clrpsw #0x40 -> nop": : :"memory") 86 __asm__ __volatile__ ("clrpsw #0x40 -> nop": : :"memory")
77#else /* CONFIG_CHIP_M32102 */ 87#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
78static inline void local_irq_enable(void) 88static inline void local_irq_enable(void)
79{ 89{
80 unsigned long tmpreg; 90 unsigned long tmpreg;
@@ -96,7 +106,7 @@ static inline void local_irq_disable(void)
96 "mvtc %0, psw \n\t" 106 "mvtc %0, psw \n\t"
97 : "=&r" (tmpreg0), "=&r" (tmpreg1) : : "cbit", "memory"); 107 : "=&r" (tmpreg0), "=&r" (tmpreg1) : : "cbit", "memory");
98} 108}
99#endif /* CONFIG_CHIP_M32102 */ 109#endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
100 110
101#define local_save_flags(x) \ 111#define local_save_flags(x) \
102 __asm__ __volatile__("mvfc %0,psw" : "=r"(x) : /* no input */) 112 __asm__ __volatile__("mvfc %0,psw" : "=r"(x) : /* no input */)
@@ -105,13 +115,13 @@ static inline void local_irq_disable(void)
105 __asm__ __volatile__("mvtc %0,psw" : /* no outputs */ \ 115 __asm__ __volatile__("mvtc %0,psw" : /* no outputs */ \
106 : "r" (x) : "cbit", "memory") 116 : "r" (x) : "cbit", "memory")
107 117
108#if !defined(CONFIG_CHIP_M32102) 118#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104))
109#define local_irq_save(x) \ 119#define local_irq_save(x) \
110 __asm__ __volatile__( \ 120 __asm__ __volatile__( \
111 "mvfc %0, psw; \n\t" \ 121 "mvfc %0, psw; \n\t" \
112 "clrpsw #0x40 -> nop; \n\t" \ 122 "clrpsw #0x40 -> nop; \n\t" \
113 : "=r" (x) : /* no input */ : "memory") 123 : "=r" (x) : /* no input */ : "memory")
114#else /* CONFIG_CHIP_M32102 */ 124#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
115#define local_irq_save(x) \ 125#define local_irq_save(x) \
116 ({ \ 126 ({ \
117 unsigned long tmpreg; \ 127 unsigned long tmpreg; \
@@ -124,7 +134,7 @@ static inline void local_irq_disable(void)
124 : "=r" (x), "=&r" (tmpreg) \ 134 : "=r" (x), "=&r" (tmpreg) \
125 : : "cbit", "memory"); \ 135 : : "cbit", "memory"); \
126 }) 136 })
127#endif /* CONFIG_CHIP_M32102 */ 137#endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */
128 138
129#define irqs_disabled() \ 139#define irqs_disabled() \
130 ({ \ 140 ({ \
diff --git a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h
index 0f589363f619..22aff3222d22 100644
--- a/include/asm-m32r/thread_info.h
+++ b/include/asm-m32r/thread_info.h
@@ -110,8 +110,6 @@ static inline struct thread_info *current_thread_info(void)
110#endif 110#endif
111 111
112#define free_thread_info(info) kfree(info) 112#define free_thread_info(info) kfree(info)
113#define get_thread_info(ti) get_task_struct((ti)->task)
114#define put_thread_info(ti) put_task_struct((ti)->task)
115 113
116#define TI_FLAG_FAULT_CODE_SHIFT 28 114#define TI_FLAG_FAULT_CODE_SHIFT 28
117 115
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index ac399e1f7bc0..39be87ca2a5a 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -319,7 +319,7 @@ type name(void) \
319register long __scno __asm__ ("r7") = __NR_##name; \ 319register long __scno __asm__ ("r7") = __NR_##name; \
320register long __res __asm__("r0"); \ 320register long __res __asm__("r0"); \
321__asm__ __volatile__ (\ 321__asm__ __volatile__ (\
322 "trap #" SYSCALL_VECTOR \ 322 "trap #" SYSCALL_VECTOR "|| nop"\
323 : "=r" (__res) \ 323 : "=r" (__res) \
324 : "r" (__scno) \ 324 : "r" (__scno) \
325 : "memory"); \ 325 : "memory"); \
@@ -332,7 +332,7 @@ type name(type1 arg1) \
332register long __scno __asm__ ("r7") = __NR_##name; \ 332register long __scno __asm__ ("r7") = __NR_##name; \
333register long __res __asm__ ("r0") = (long)(arg1); \ 333register long __res __asm__ ("r0") = (long)(arg1); \
334__asm__ __volatile__ (\ 334__asm__ __volatile__ (\
335 "trap #" SYSCALL_VECTOR \ 335 "trap #" SYSCALL_VECTOR "|| nop"\
336 : "=r" (__res) \ 336 : "=r" (__res) \
337 : "r" (__scno), "0" (__res) \ 337 : "r" (__scno), "0" (__res) \
338 : "memory"); \ 338 : "memory"); \
@@ -346,7 +346,7 @@ register long __scno __asm__ ("r7") = __NR_##name; \
346register long __arg2 __asm__ ("r1") = (long)(arg2); \ 346register long __arg2 __asm__ ("r1") = (long)(arg2); \
347register long __res __asm__ ("r0") = (long)(arg1); \ 347register long __res __asm__ ("r0") = (long)(arg1); \
348__asm__ __volatile__ (\ 348__asm__ __volatile__ (\
349 "trap #" SYSCALL_VECTOR \ 349 "trap #" SYSCALL_VECTOR "|| nop"\
350 : "=r" (__res) \ 350 : "=r" (__res) \
351 : "r" (__scno), "0" (__res), "r" (__arg2) \ 351 : "r" (__scno), "0" (__res), "r" (__arg2) \
352 : "memory"); \ 352 : "memory"); \
@@ -361,7 +361,7 @@ register long __arg3 __asm__ ("r2") = (long)(arg3); \
361register long __arg2 __asm__ ("r1") = (long)(arg2); \ 361register long __arg2 __asm__ ("r1") = (long)(arg2); \
362register long __res __asm__ ("r0") = (long)(arg1); \ 362register long __res __asm__ ("r0") = (long)(arg1); \
363__asm__ __volatile__ (\ 363__asm__ __volatile__ (\
364 "trap #" SYSCALL_VECTOR \ 364 "trap #" SYSCALL_VECTOR "|| nop"\
365 : "=r" (__res) \ 365 : "=r" (__res) \
366 : "r" (__scno), "0" (__res), "r" (__arg2), \ 366 : "r" (__scno), "0" (__res), "r" (__arg2), \
367 "r" (__arg3) \ 367 "r" (__arg3) \
@@ -378,7 +378,7 @@ register long __arg3 __asm__ ("r2") = (long)(arg3); \
378register long __arg2 __asm__ ("r1") = (long)(arg2); \ 378register long __arg2 __asm__ ("r1") = (long)(arg2); \
379register long __res __asm__ ("r0") = (long)(arg1); \ 379register long __res __asm__ ("r0") = (long)(arg1); \
380__asm__ __volatile__ (\ 380__asm__ __volatile__ (\
381 "trap #" SYSCALL_VECTOR \ 381 "trap #" SYSCALL_VECTOR "|| nop"\
382 : "=r" (__res) \ 382 : "=r" (__res) \
383 : "r" (__scno), "0" (__res), "r" (__arg2), \ 383 : "r" (__scno), "0" (__res), "r" (__arg2), \
384 "r" (__arg3), "r" (__arg4) \ 384 "r" (__arg3), "r" (__arg4) \
@@ -397,7 +397,7 @@ register long __arg3 __asm__ ("r2") = (long)(arg3); \
397register long __arg2 __asm__ ("r1") = (long)(arg2); \ 397register long __arg2 __asm__ ("r1") = (long)(arg2); \
398register long __res __asm__ ("r0") = (long)(arg1); \ 398register long __res __asm__ ("r0") = (long)(arg1); \
399__asm__ __volatile__ (\ 399__asm__ __volatile__ (\
400 "trap #" SYSCALL_VECTOR \ 400 "trap #" SYSCALL_VECTOR "|| nop"\
401 : "=r" (__res) \ 401 : "=r" (__res) \
402 : "r" (__scno), "0" (__res), "r" (__arg2), \ 402 : "r" (__scno), "0" (__res), "r" (__arg2), \
403 "r" (__arg3), "r" (__arg4), "r" (__arg5) \ 403 "r" (__arg3), "r" (__arg4), "r" (__arg5) \
diff --git a/include/asm-m68k/amigahw.h b/include/asm-m68k/amigahw.h
index 3ae5d8d55ba9..a16fe4e5a28a 100644
--- a/include/asm-m68k/amigahw.h
+++ b/include/asm-m68k/amigahw.h
@@ -274,7 +274,7 @@ struct CIA {
274#define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase) 274#define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase)
275 275
276#define CUSTOM_PHYSADDR (0xdff000) 276#define CUSTOM_PHYSADDR (0xdff000)
277#define custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR))) 277#define amiga_custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR)))
278 278
279#define CIAA_PHYSADDR (0xbfe001) 279#define CIAA_PHYSADDR (0xbfe001)
280#define CIAB_PHYSADDR (0xbfd000) 280#define CIAB_PHYSADDR (0xbfd000)
@@ -294,12 +294,12 @@ static inline void amifb_video_off(void)
294{ 294{
295 if (amiga_chipset == CS_ECS || amiga_chipset == CS_AGA) { 295 if (amiga_chipset == CS_ECS || amiga_chipset == CS_AGA) {
296 /* program Denise/Lisa for a higher maximum play rate */ 296 /* program Denise/Lisa for a higher maximum play rate */
297 custom.htotal = 113; /* 31 kHz */ 297 amiga_custom.htotal = 113; /* 31 kHz */
298 custom.vtotal = 223; /* 70 Hz */ 298 amiga_custom.vtotal = 223; /* 70 Hz */
299 custom.beamcon0 = 0x4390; /* HARDDIS, VAR{BEAM,VSY,HSY,CSY}EN */ 299 amiga_custom.beamcon0 = 0x4390; /* HARDDIS, VAR{BEAM,VSY,HSY,CSY}EN */
300 /* suspend the monitor */ 300 /* suspend the monitor */
301 custom.hsstrt = custom.hsstop = 116; 301 amiga_custom.hsstrt = amiga_custom.hsstop = 116;
302 custom.vsstrt = custom.vsstop = 226; 302 amiga_custom.vsstrt = amiga_custom.vsstop = 226;
303 amiga_audio_min_period = 57; 303 amiga_audio_min_period = 57;
304 } 304 }
305} 305}
diff --git a/include/asm-m68k/amigaints.h b/include/asm-m68k/amigaints.h
index 2aff4cfbf7b3..aa968d014bb6 100644
--- a/include/asm-m68k/amigaints.h
+++ b/include/asm-m68k/amigaints.h
@@ -109,8 +109,6 @@
109extern void amiga_do_irq(int irq, struct pt_regs *fp); 109extern void amiga_do_irq(int irq, struct pt_regs *fp);
110extern void amiga_do_irq_list(int irq, struct pt_regs *fp); 110extern void amiga_do_irq_list(int irq, struct pt_regs *fp);
111 111
112extern unsigned short amiga_intena_vals[];
113
114/* CIA interrupt control register bits */ 112/* CIA interrupt control register bits */
115 113
116#define CIA_ICR_TA 0x01 114#define CIA_ICR_TA 0x01
diff --git a/include/asm-m68k/atomic.h b/include/asm-m68k/atomic.h
index e3c962eeabf3..a4a84d5c65d5 100644
--- a/include/asm-m68k/atomic.h
+++ b/include/asm-m68k/atomic.h
@@ -140,6 +140,7 @@ static inline void atomic_set_mask(unsigned long mask, unsigned long *v)
140} 140}
141 141
142#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 142#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
143#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
143 144
144#define atomic_add_unless(v, a, u) \ 145#define atomic_add_unless(v, a, u) \
145({ \ 146({ \
@@ -157,4 +158,5 @@ static inline void atomic_set_mask(unsigned long mask, unsigned long *v)
157#define smp_mb__before_atomic_inc() barrier() 158#define smp_mb__before_atomic_inc() barrier()
158#define smp_mb__after_atomic_inc() barrier() 159#define smp_mb__after_atomic_inc() barrier()
159 160
161#include <asm-generic/atomic.h>
160#endif /* __ARCH_M68K_ATOMIC __ */ 162#endif /* __ARCH_M68K_ATOMIC __ */
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index b1bcf7c66516..13f4c0048463 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -310,6 +310,7 @@ static inline int fls(int x)
310 310
311 return 32 - cnt; 311 return 32 - cnt;
312} 312}
313#define fls64(x) generic_fls64(x)
313 314
314/* 315/*
315 * Every architecture must define this function. It's the fastest 316 * Every architecture must define this function. It's the fastest
diff --git a/include/asm-m68k/cache.h b/include/asm-m68k/cache.h
index 6161fd3d8600..fed3fd30de7e 100644
--- a/include/asm-m68k/cache.h
+++ b/include/asm-m68k/cache.h
@@ -8,6 +8,4 @@
8#define L1_CACHE_SHIFT 4 8#define L1_CACHE_SHIFT 4
9#define L1_CACHE_BYTES (1<< L1_CACHE_SHIFT) 9#define L1_CACHE_BYTES (1<< L1_CACHE_SHIFT)
10 10
11#define L1_CACHE_SHIFT_MAX 4 /* largest L1 which this arch supports */
12
13#endif 11#endif
diff --git a/include/asm-m68k/checksum.h b/include/asm-m68k/checksum.h
index 78860c20db01..17280ef719f5 100644
--- a/include/asm-m68k/checksum.h
+++ b/include/asm-m68k/checksum.h
@@ -25,7 +25,7 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
25 * better 64-bit) boundary 25 * better 64-bit) boundary
26 */ 26 */
27 27
28extern unsigned int csum_partial_copy_from_user(const unsigned char *src, 28extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
29 unsigned char *dst, 29 unsigned char *dst,
30 int len, int sum, 30 int len, int sum,
31 int *csum_err); 31 int *csum_err);
diff --git a/include/asm-m68k/dsp56k.h b/include/asm-m68k/dsp56k.h
index ab3dd33e23a1..2d8c0c9f794b 100644
--- a/include/asm-m68k/dsp56k.h
+++ b/include/asm-m68k/dsp56k.h
@@ -13,7 +13,7 @@
13/* Used for uploading DSP binary code */ 13/* Used for uploading DSP binary code */
14struct dsp56k_upload { 14struct dsp56k_upload {
15 int len; 15 int len;
16 char *bin; 16 char __user *bin;
17}; 17};
18 18
19/* For the DSP host flags */ 19/* For the DSP host flags */
diff --git a/include/asm-m68k/floppy.h b/include/asm-m68k/floppy.h
index c6e708dd9f62..63a05ed95c17 100644
--- a/include/asm-m68k/floppy.h
+++ b/include/asm-m68k/floppy.h
@@ -46,7 +46,7 @@ asmlinkage irqreturn_t floppy_hardint(int irq, void *dev_id,
46 46
47static int virtual_dma_count=0; 47static int virtual_dma_count=0;
48static int virtual_dma_residue=0; 48static int virtual_dma_residue=0;
49static char *virtual_dma_addr=0; 49static char *virtual_dma_addr=NULL;
50static int virtual_dma_mode=0; 50static int virtual_dma_mode=0;
51static int doing_pdma=0; 51static int doing_pdma=0;
52 52
diff --git a/include/asm-m68k/futex.h b/include/asm-m68k/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-m68k/futex.h
+++ b/include/asm-m68k/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-m68k/hardirq.h b/include/asm-m68k/hardirq.h
index 728318bf7f0e..5e1c5826c83d 100644
--- a/include/asm-m68k/hardirq.h
+++ b/include/asm-m68k/hardirq.h
@@ -14,13 +14,4 @@ typedef struct {
14 14
15#define HARDIRQ_BITS 8 15#define HARDIRQ_BITS 8
16 16
17/*
18 * The hardirq mask has to be large enough to have
19 * space for potentially all IRQ sources in the system
20 * nesting on a single CPU:
21 */
22#if (1 << HARDIRQ_BITS) < NR_IRQS
23# error HARDIRQ_BITS is too low!
24#endif
25
26#endif 17#endif
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index 6bb8b0d8f99d..dcfaa352d34c 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -24,6 +24,7 @@
24#ifdef __KERNEL__ 24#ifdef __KERNEL__
25 25
26#include <linux/config.h> 26#include <linux/config.h>
27#include <linux/compiler.h>
27#include <asm/raw_io.h> 28#include <asm/raw_io.h>
28#include <asm/virtconvert.h> 29#include <asm/virtconvert.h>
29 30
@@ -120,68 +121,68 @@ extern int isa_sex;
120 * be compiled in so the case statement will be optimised away 121 * be compiled in so the case statement will be optimised away
121 */ 122 */
122 123
123static inline u8 *isa_itb(unsigned long addr) 124static inline u8 __iomem *isa_itb(unsigned long addr)
124{ 125{
125 switch(ISA_TYPE) 126 switch(ISA_TYPE)
126 { 127 {
127#ifdef CONFIG_Q40 128#ifdef CONFIG_Q40
128 case Q40_ISA: return (u8 *)Q40_ISA_IO_B(addr); 129 case Q40_ISA: return (u8 __iomem *)Q40_ISA_IO_B(addr);
129#endif 130#endif
130#ifdef CONFIG_GG2 131#ifdef CONFIG_GG2
131 case GG2_ISA: return (u8 *)GG2_ISA_IO_B(addr); 132 case GG2_ISA: return (u8 __iomem *)GG2_ISA_IO_B(addr);
132#endif 133#endif
133#ifdef CONFIG_AMIGA_PCMCIA 134#ifdef CONFIG_AMIGA_PCMCIA
134 case AG_ISA: return (u8 *)AG_ISA_IO_B(addr); 135 case AG_ISA: return (u8 __iomem *)AG_ISA_IO_B(addr);
135#endif 136#endif
136 default: return 0; /* avoid warnings, just in case */ 137 default: return NULL; /* avoid warnings, just in case */
137 } 138 }
138} 139}
139static inline u16 *isa_itw(unsigned long addr) 140static inline u16 __iomem *isa_itw(unsigned long addr)
140{ 141{
141 switch(ISA_TYPE) 142 switch(ISA_TYPE)
142 { 143 {
143#ifdef CONFIG_Q40 144#ifdef CONFIG_Q40
144 case Q40_ISA: return (u16 *)Q40_ISA_IO_W(addr); 145 case Q40_ISA: return (u16 __iomem *)Q40_ISA_IO_W(addr);
145#endif 146#endif
146#ifdef CONFIG_GG2 147#ifdef CONFIG_GG2
147 case GG2_ISA: return (u16 *)GG2_ISA_IO_W(addr); 148 case GG2_ISA: return (u16 __iomem *)GG2_ISA_IO_W(addr);
148#endif 149#endif
149#ifdef CONFIG_AMIGA_PCMCIA 150#ifdef CONFIG_AMIGA_PCMCIA
150 case AG_ISA: return (u16 *)AG_ISA_IO_W(addr); 151 case AG_ISA: return (u16 __iomem *)AG_ISA_IO_W(addr);
151#endif 152#endif
152 default: return 0; /* avoid warnings, just in case */ 153 default: return NULL; /* avoid warnings, just in case */
153 } 154 }
154} 155}
155static inline u8 *isa_mtb(unsigned long addr) 156static inline u8 __iomem *isa_mtb(unsigned long addr)
156{ 157{
157 switch(ISA_TYPE) 158 switch(ISA_TYPE)
158 { 159 {
159#ifdef CONFIG_Q40 160#ifdef CONFIG_Q40
160 case Q40_ISA: return (u8 *)Q40_ISA_MEM_B(addr); 161 case Q40_ISA: return (u8 __iomem *)Q40_ISA_MEM_B(addr);
161#endif 162#endif
162#ifdef CONFIG_GG2 163#ifdef CONFIG_GG2
163 case GG2_ISA: return (u8 *)GG2_ISA_MEM_B(addr); 164 case GG2_ISA: return (u8 __iomem *)GG2_ISA_MEM_B(addr);
164#endif 165#endif
165#ifdef CONFIG_AMIGA_PCMCIA 166#ifdef CONFIG_AMIGA_PCMCIA
166 case AG_ISA: return (u8 *)addr; 167 case AG_ISA: return (u8 __iomem *)addr;
167#endif 168#endif
168 default: return 0; /* avoid warnings, just in case */ 169 default: return NULL; /* avoid warnings, just in case */
169 } 170 }
170} 171}
171static inline u16 *isa_mtw(unsigned long addr) 172static inline u16 __iomem *isa_mtw(unsigned long addr)
172{ 173{
173 switch(ISA_TYPE) 174 switch(ISA_TYPE)
174 { 175 {
175#ifdef CONFIG_Q40 176#ifdef CONFIG_Q40
176 case Q40_ISA: return (u16 *)Q40_ISA_MEM_W(addr); 177 case Q40_ISA: return (u16 __iomem *)Q40_ISA_MEM_W(addr);
177#endif 178#endif
178#ifdef CONFIG_GG2 179#ifdef CONFIG_GG2
179 case GG2_ISA: return (u16 *)GG2_ISA_MEM_W(addr); 180 case GG2_ISA: return (u16 __iomem *)GG2_ISA_MEM_W(addr);
180#endif 181#endif
181#ifdef CONFIG_AMIGA_PCMCIA 182#ifdef CONFIG_AMIGA_PCMCIA
182 case AG_ISA: return (u16 *)addr; 183 case AG_ISA: return (u16 __iomem *)addr;
183#endif 184#endif
184 default: return 0; /* avoid warnings, just in case */ 185 default: return NULL; /* avoid warnings, just in case */
185 } 186 }
186} 187}
187 188
@@ -326,20 +327,20 @@ static inline void isa_delay(void)
326 327
327#define mmiowb() 328#define mmiowb()
328 329
329static inline void *ioremap(unsigned long physaddr, unsigned long size) 330static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
330{ 331{
331 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); 332 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
332} 333}
333static inline void *ioremap_nocache(unsigned long physaddr, unsigned long size) 334static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned long size)
334{ 335{
335 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); 336 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
336} 337}
337static inline void *ioremap_writethrough(unsigned long physaddr, 338static inline void __iomem *ioremap_writethrough(unsigned long physaddr,
338 unsigned long size) 339 unsigned long size)
339{ 340{
340 return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); 341 return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
341} 342}
342static inline void *ioremap_fullcache(unsigned long physaddr, 343static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
343 unsigned long size) 344 unsigned long size)
344{ 345{
345 return __ioremap(physaddr, size, IOMAP_FULL_CACHING); 346 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
diff --git a/include/asm-m68k/ioctl.h b/include/asm-m68k/ioctl.h
index fd68914ab292..b279fe06dfe5 100644
--- a/include/asm-m68k/ioctl.h
+++ b/include/asm-m68k/ioctl.h
@@ -1,80 +1 @@
1/* $Id: ioctl.h,v 1.3 1997/04/16 15:10:07 jes Exp $ #include <asm-generic/ioctl.h>
2 *
3 * linux/ioctl.h for Linux by H.H. Bergman.
4 */
5
6#ifndef _M68K_IOCTL_H
7#define _M68K_IOCTL_H
8
9/* ioctl command encoding: 32 bits total, command in lower 16 bits,
10 * size of the parameter structure in the lower 14 bits of the
11 * upper 16 bits.
12 * Encoding the size of the parameter structure in the ioctl request
13 * is useful for catching programs compiled with old versions
14 * and to avoid overwriting user space outside the user buffer area.
15 * The highest 2 bits are reserved for indicating the ``access mode''.
16 * NOTE: This limits the max parameter size to 16kB -1 !
17 */
18
19/*
20 * I don't really have any idea about what this should look like, so
21 * for the time being, this is heavily based on the PC definitions.
22 */
23
24/*
25 * The following is for compatibility across the various Linux
26 * platforms. The i386 ioctl numbering scheme doesn't really enforce
27 * a type field. De facto, however, the top 8 bits of the lower 16
28 * bits are indeed used as a type field, so we might just as well make
29 * this explicit here. Please be sure to use the decoding macros
30 * below from now on.
31 */
32#define _IOC_NRBITS 8
33#define _IOC_TYPEBITS 8
34#define _IOC_SIZEBITS 14
35#define _IOC_DIRBITS 2
36
37#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
38#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
39#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
40#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
41
42#define _IOC_NRSHIFT 0
43#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
44#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
45#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
46
47/*
48 * Direction bits.
49 */
50#define _IOC_NONE 0U
51#define _IOC_WRITE 1U
52#define _IOC_READ 2U
53
54#define _IOC(dir,type,nr,size) \
55 (((dir) << _IOC_DIRSHIFT) | \
56 ((type) << _IOC_TYPESHIFT) | \
57 ((nr) << _IOC_NRSHIFT) | \
58 ((size) << _IOC_SIZESHIFT))
59
60/* used to create numbers */
61#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
62#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
63#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
64#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
65
66/* used to decode ioctl numbers.. */
67#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
68#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
69#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
70#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
71
72/* ...and for the drivers/sound files... */
73
74#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
75#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
76#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
77#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
78#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
79
80#endif /* _M68K_IOCTL_H */
diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h
index 1f569905cb74..325c86f8512d 100644
--- a/include/asm-m68k/irq.h
+++ b/include/asm-m68k/irq.h
@@ -23,6 +23,15 @@
23#endif 23#endif
24 24
25/* 25/*
26 * The hardirq mask has to be large enough to have
27 * space for potentially all IRQ sources in the system
28 * nesting on a single CPU:
29 */
30#if (1 << HARDIRQ_BITS) < NR_IRQS
31# error HARDIRQ_BITS is too low!
32#endif
33
34/*
26 * Interrupt source definitions 35 * Interrupt source definitions
27 * General interrupt sources are the level 1-7. 36 * General interrupt sources are the level 1-7.
28 * Adding an interrupt service routine for one of these sources 37 * Adding an interrupt service routine for one of these sources
@@ -70,8 +79,6 @@ static __inline__ int irq_canonicalize(int irq)
70 79
71extern void (*enable_irq)(unsigned int); 80extern void (*enable_irq)(unsigned int);
72extern void (*disable_irq)(unsigned int); 81extern void (*disable_irq)(unsigned int);
73
74#define disable_irq_nosync disable_irq
75#define enable_irq_nosync enable_irq 82#define enable_irq_nosync enable_irq
76 83
77struct pt_regs; 84struct pt_regs;
diff --git a/include/asm-m68k/machdep.h b/include/asm-m68k/machdep.h
index a0dd5c47002c..7d3fee342369 100644
--- a/include/asm-m68k/machdep.h
+++ b/include/asm-m68k/machdep.h
@@ -34,7 +34,6 @@ extern void (*mach_power_off)( void );
34extern unsigned long (*mach_hd_init) (unsigned long, unsigned long); 34extern unsigned long (*mach_hd_init) (unsigned long, unsigned long);
35extern void (*mach_hd_setup)(char *, int *); 35extern void (*mach_hd_setup)(char *, int *);
36extern long mach_max_dma_address; 36extern long mach_max_dma_address;
37extern void (*mach_floppy_setup)(char *, int *);
38extern void (*mach_heartbeat) (int); 37extern void (*mach_heartbeat) (int);
39extern void (*mach_l2_flush) (int); 38extern void (*mach_l2_flush) (int);
40extern void (*mach_beep) (unsigned int, unsigned int); 39extern void (*mach_beep) (unsigned int, unsigned int);
diff --git a/include/asm-m68k/mman.h b/include/asm-m68k/mman.h
index f831c4eeae6e..ea262ab88b3b 100644
--- a/include/asm-m68k/mman.h
+++ b/include/asm-m68k/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-m68k/mutex.h b/include/asm-m68k/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-m68k/mutex.h
@@ -0,0 +1,9 @@
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-m68k/raw_io.h b/include/asm-m68k/raw_io.h
index 041f0a87b25d..5439bcaa57c6 100644
--- a/include/asm-m68k/raw_io.h
+++ b/include/asm-m68k/raw_io.h
@@ -19,9 +19,9 @@
19#define IOMAP_NOCACHE_NONSER 2 19#define IOMAP_NOCACHE_NONSER 2
20#define IOMAP_WRITETHROUGH 3 20#define IOMAP_WRITETHROUGH 3
21 21
22extern void iounmap(void *addr); 22extern void iounmap(void __iomem *addr);
23 23
24extern void *__ioremap(unsigned long physaddr, unsigned long size, 24extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
25 int cacheflag); 25 int cacheflag);
26extern void __iounmap(void *addr, unsigned long size); 26extern void __iounmap(void *addr, unsigned long size);
27 27
@@ -30,21 +30,21 @@ extern void __iounmap(void *addr, unsigned long size);
30 * two accesses to memory, which may be undesirable for some devices. 30 * two accesses to memory, which may be undesirable for some devices.
31 */ 31 */
32#define in_8(addr) \ 32#define in_8(addr) \
33 ({ u8 __v = (*(volatile u8 *) (addr)); __v; }) 33 ({ u8 __v = (*(__force volatile u8 *) (addr)); __v; })
34#define in_be16(addr) \ 34#define in_be16(addr) \
35 ({ u16 __v = (*(volatile u16 *) (addr)); __v; }) 35 ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; })
36#define in_be32(addr) \ 36#define in_be32(addr) \
37 ({ u32 __v = (*(volatile u32 *) (addr)); __v; }) 37 ({ u32 __v = (*(__force volatile u32 *) (addr)); __v; })
38#define in_le16(addr) \ 38#define in_le16(addr) \
39 ({ u16 __v = le16_to_cpu(*(volatile u16 *) (addr)); __v; }) 39 ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; })
40#define in_le32(addr) \ 40#define in_le32(addr) \
41 ({ u32 __v = le32_to_cpu(*(volatile u32 *) (addr)); __v; }) 41 ({ u32 __v = le32_to_cpu(*(__force volatile u32 *) (addr)); __v; })
42 42
43#define out_8(addr,b) (void)((*(volatile u8 *) (addr)) = (b)) 43#define out_8(addr,b) (void)((*(__force volatile u8 *) (addr)) = (b))
44#define out_be16(addr,w) (void)((*(volatile u16 *) (addr)) = (w)) 44#define out_be16(addr,w) (void)((*(__force volatile u16 *) (addr)) = (w))
45#define out_be32(addr,l) (void)((*(volatile u32 *) (addr)) = (l)) 45#define out_be32(addr,l) (void)((*(__force volatile u32 *) (addr)) = (l))
46#define out_le16(addr,w) (void)((*(volatile u16 *) (addr)) = cpu_to_le16(w)) 46#define out_le16(addr,w) (void)((*(__force volatile u16 *) (addr)) = cpu_to_le16(w))
47#define out_le32(addr,l) (void)((*(volatile u32 *) (addr)) = cpu_to_le32(l)) 47#define out_le32(addr,l) (void)((*(__force volatile u32 *) (addr)) = cpu_to_le32(l))
48 48
49#define raw_inb in_8 49#define raw_inb in_8
50#define raw_inw in_be16 50#define raw_inw in_be16
@@ -54,7 +54,7 @@ extern void __iounmap(void *addr, unsigned long size);
54#define raw_outw(val,port) out_be16((port),(val)) 54#define raw_outw(val,port) out_be16((port),(val))
55#define raw_outl(val,port) out_be32((port),(val)) 55#define raw_outl(val,port) out_be32((port),(val))
56 56
57static inline void raw_insb(volatile u8 *port, u8 *buf, unsigned int len) 57static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
58{ 58{
59 unsigned int i; 59 unsigned int i;
60 60
@@ -62,7 +62,7 @@ static inline void raw_insb(volatile u8 *port, u8 *buf, unsigned int len)
62 *buf++ = in_8(port); 62 *buf++ = in_8(port);
63} 63}
64 64
65static inline void raw_outsb(volatile u8 *port, const u8 *buf, 65static inline void raw_outsb(volatile u8 __iomem *port, const u8 *buf,
66 unsigned int len) 66 unsigned int len)
67{ 67{
68 unsigned int i; 68 unsigned int i;
@@ -71,7 +71,7 @@ static inline void raw_outsb(volatile u8 *port, const u8 *buf,
71 out_8(port, *buf++); 71 out_8(port, *buf++);
72} 72}
73 73
74static inline void raw_insw(volatile u16 *port, u16 *buf, unsigned int nr) 74static inline void raw_insw(volatile u16 __iomem *port, u16 *buf, unsigned int nr)
75{ 75{
76 unsigned int tmp; 76 unsigned int tmp;
77 77
@@ -110,7 +110,7 @@ static inline void raw_insw(volatile u16 *port, u16 *buf, unsigned int nr)
110 } 110 }
111} 111}
112 112
113static inline void raw_outsw(volatile u16 *port, const u16 *buf, 113static inline void raw_outsw(volatile u16 __iomem *port, const u16 *buf,
114 unsigned int nr) 114 unsigned int nr)
115{ 115{
116 unsigned int tmp; 116 unsigned int tmp;
@@ -150,7 +150,7 @@ static inline void raw_outsw(volatile u16 *port, const u16 *buf,
150 } 150 }
151} 151}
152 152
153static inline void raw_insl(volatile u32 *port, u32 *buf, unsigned int nr) 153static inline void raw_insl(volatile u32 __iomem *port, u32 *buf, unsigned int nr)
154{ 154{
155 unsigned int tmp; 155 unsigned int tmp;
156 156
@@ -189,7 +189,7 @@ static inline void raw_insl(volatile u32 *port, u32 *buf, unsigned int nr)
189 } 189 }
190} 190}
191 191
192static inline void raw_outsl(volatile u32 *port, const u32 *buf, 192static inline void raw_outsl(volatile u32 __iomem *port, const u32 *buf,
193 unsigned int nr) 193 unsigned int nr)
194{ 194{
195 unsigned int tmp; 195 unsigned int tmp;
@@ -230,7 +230,7 @@ static inline void raw_outsl(volatile u32 *port, const u32 *buf,
230} 230}
231 231
232 232
233static inline void raw_insw_swapw(volatile u16 *port, u16 *buf, 233static inline void raw_insw_swapw(volatile u16 __iomem *port, u16 *buf,
234 unsigned int nr) 234 unsigned int nr)
235{ 235{
236 if ((nr) % 8) 236 if ((nr) % 8)
@@ -283,7 +283,7 @@ static inline void raw_insw_swapw(volatile u16 *port, u16 *buf,
283 : "d0", "a0", "a1", "d6"); 283 : "d0", "a0", "a1", "d6");
284} 284}
285 285
286static inline void raw_outsw_swapw(volatile u16 *port, const u16 *buf, 286static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
287 unsigned int nr) 287 unsigned int nr)
288{ 288{
289 if ((nr) % 8) 289 if ((nr) % 8)
diff --git a/include/asm-m68k/signal.h b/include/asm-m68k/signal.h
index a0cdf9082372..b7b7ea20caab 100644
--- a/include/asm-m68k/signal.h
+++ b/include/asm-m68k/signal.h
@@ -144,7 +144,7 @@ struct sigaction {
144#endif /* __KERNEL__ */ 144#endif /* __KERNEL__ */
145 145
146typedef struct sigaltstack { 146typedef struct sigaltstack {
147 void *ss_sp; 147 void __user *ss_sp;
148 int ss_flags; 148 int ss_flags;
149 size_t ss_size; 149 size_t ss_size;
150} stack_t; 150} stack_t;
diff --git a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h
index e974bb072047..5156a28a18d8 100644
--- a/include/asm-m68k/sun3_pgtable.h
+++ b/include/asm-m68k/sun3_pgtable.h
@@ -211,7 +211,7 @@ static inline unsigned long pte_to_pgoff(pte_t pte)
211 return pte.pte & SUN3_PAGE_PGNUM_MASK; 211 return pte.pte & SUN3_PAGE_PGNUM_MASK;
212} 212}
213 213
214static inline pte_t pgoff_to_pte(inline unsigned off) 214static inline pte_t pgoff_to_pte(unsigned off)
215{ 215{
216 pte_t pte = { off + SUN3_PAGE_ACCESSED }; 216 pte_t pte = { off + SUN3_PAGE_ACCESSED };
217 return pte; 217 return pte;
diff --git a/include/asm-m68k/sun3ints.h b/include/asm-m68k/sun3ints.h
index fd838eb14213..bd038fccb64b 100644
--- a/include/asm-m68k/sun3ints.h
+++ b/include/asm-m68k/sun3ints.h
@@ -31,7 +31,6 @@ int sun3_request_irq(unsigned int irq,
31 ); 31 );
32extern void sun3_init_IRQ (void); 32extern void sun3_init_IRQ (void);
33extern irqreturn_t (*sun3_default_handler[]) (int, void *, struct pt_regs *); 33extern irqreturn_t (*sun3_default_handler[]) (int, void *, struct pt_regs *);
34extern irqreturn_t (*sun3_inthandler[]) (int, void *, struct pt_regs *);
35extern void sun3_free_irq (unsigned int irq, void *dev_id); 34extern void sun3_free_irq (unsigned int irq, void *dev_id);
36extern void sun3_enable_interrupts (void); 35extern void sun3_enable_interrupts (void);
37extern void sun3_disable_interrupts (void); 36extern void sun3_disable_interrupts (void);
diff --git a/include/asm-m68k/sun3xflop.h b/include/asm-m68k/sun3xflop.h
index fda1eccf10aa..98a9f79dab29 100644
--- a/include/asm-m68k/sun3xflop.h
+++ b/include/asm-m68k/sun3xflop.h
@@ -208,7 +208,7 @@ static int sun3xflop_request_irq(void)
208 208
209 if(!once) { 209 if(!once) {
210 once = 1; 210 once = 1;
211 error = request_irq(FLOPPY_IRQ, sun3xflop_hardint, SA_INTERRUPT, "floppy", 0); 211 error = request_irq(FLOPPY_IRQ, sun3xflop_hardint, SA_INTERRUPT, "floppy", NULL);
212 return ((error == 0) ? 0 : -1); 212 return ((error == 0) ? 0 : -1);
213 } else return 0; 213 } else return 0;
214} 214}
@@ -238,7 +238,7 @@ static int sun3xflop_init(void)
238 *sun3x_fdc.fcr_r = 0; 238 *sun3x_fdc.fcr_r = 0;
239 239
240 /* Success... */ 240 /* Success... */
241 floppy_set_flags(0, 1, FD_BROKEN_DCL); // I don't know how to detect this. 241 floppy_set_flags(NULL, 1, FD_BROKEN_DCL); // I don't know how to detect this.
242 allowed_drive_mask = 0x01; 242 allowed_drive_mask = 0x01;
243 return (int) SUN3X_FDC; 243 return (int) SUN3X_FDC;
244} 244}
diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h
index 9532ca3c45cb..c4d622a57dfb 100644
--- a/include/asm-m68k/thread_info.h
+++ b/include/asm-m68k/thread_info.h
@@ -37,6 +37,7 @@ struct thread_info {
37#define init_stack (init_thread_union.stack) 37#define init_stack (init_thread_union.stack)
38 38
39#define task_thread_info(tsk) (&(tsk)->thread.info) 39#define task_thread_info(tsk) (&(tsk)->thread.info)
40#define task_stack_page(tsk) ((void *)(tsk)->thread_info)
40#define current_thread_info() task_thread_info(current) 41#define current_thread_info() task_thread_info(current)
41 42
42#define __HAVE_THREAD_FUNCTIONS 43#define __HAVE_THREAD_FUNCTIONS
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h
index f5cedf19cf68..2ffd87b0a769 100644
--- a/include/asm-m68k/uaccess.h
+++ b/include/asm-m68k/uaccess.h
@@ -42,6 +42,7 @@ struct exception_table_entry
42({ \ 42({ \
43 int __pu_err; \ 43 int __pu_err; \
44 typeof(*(ptr)) __pu_val = (x); \ 44 typeof(*(ptr)) __pu_val = (x); \
45 __chk_user_ptr(ptr); \
45 switch (sizeof (*(ptr))) { \ 46 switch (sizeof (*(ptr))) { \
46 case 1: \ 47 case 1: \
47 __put_user_asm(__pu_err, __pu_val, ptr, b); \ 48 __put_user_asm(__pu_err, __pu_val, ptr, b); \
@@ -91,6 +92,7 @@ __asm__ __volatile__ \
91({ \ 92({ \
92 int __gu_err; \ 93 int __gu_err; \
93 typeof(*(ptr)) __gu_val; \ 94 typeof(*(ptr)) __gu_val; \
95 __chk_user_ptr(ptr); \
94 switch (sizeof(*(ptr))) { \ 96 switch (sizeof(*(ptr))) { \
95 case 1: \ 97 case 1: \
96 __get_user_asm(__gu_err, __gu_val, ptr, b, "=d"); \ 98 __get_user_asm(__gu_err, __gu_val, ptr, b, "=d"); \
@@ -105,7 +107,7 @@ __asm__ __volatile__ \
105 __gu_err = __constant_copy_from_user(&__gu_val, ptr, 8); \ 107 __gu_err = __constant_copy_from_user(&__gu_val, ptr, 8); \
106 break; \ 108 break; \
107 default: \ 109 default: \
108 __gu_val = 0; \ 110 __gu_val = (typeof(*(ptr)))0; \
109 __gu_err = __get_user_bad(); \ 111 __gu_err = __get_user_bad(); \
110 break; \ 112 break; \
111 } \ 113 } \
@@ -134,7 +136,7 @@ __asm__ __volatile__ \
134 : "m"(*(ptr)), "i" (-EFAULT), "0"(0)) 136 : "m"(*(ptr)), "i" (-EFAULT), "0"(0))
135 137
136static inline unsigned long 138static inline unsigned long
137__generic_copy_from_user(void *to, const void *from, unsigned long n) 139__generic_copy_from_user(void *to, const void __user *from, unsigned long n)
138{ 140{
139 unsigned long tmp; 141 unsigned long tmp;
140 __asm__ __volatile__ 142 __asm__ __volatile__
@@ -189,7 +191,7 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n)
189} 191}
190 192
191static inline unsigned long 193static inline unsigned long
192__generic_copy_to_user(void *to, const void *from, unsigned long n) 194__generic_copy_to_user(void __user *to, const void *from, unsigned long n)
193{ 195{
194 unsigned long tmp; 196 unsigned long tmp;
195 __asm__ __volatile__ 197 __asm__ __volatile__
@@ -264,7 +266,7 @@ __generic_copy_to_user(void *to, const void *from, unsigned long n)
264 : "d0", "memory") 266 : "d0", "memory")
265 267
266static inline unsigned long 268static inline unsigned long
267__constant_copy_from_user(void *to, const void *from, unsigned long n) 269__constant_copy_from_user(void *to, const void __user *from, unsigned long n)
268{ 270{
269 switch (n) { 271 switch (n) {
270 case 0: 272 case 0:
@@ -520,7 +522,7 @@ __constant_copy_from_user(void *to, const void *from, unsigned long n)
520#define __copy_from_user_inatomic __copy_from_user 522#define __copy_from_user_inatomic __copy_from_user
521 523
522static inline unsigned long 524static inline unsigned long
523__constant_copy_to_user(void *to, const void *from, unsigned long n) 525__constant_copy_to_user(void __user *to, const void *from, unsigned long n)
524{ 526{
525 switch (n) { 527 switch (n) {
526 case 0: 528 case 0:
@@ -766,7 +768,7 @@ __constant_copy_to_user(void *to, const void *from, unsigned long n)
766 */ 768 */
767 769
768static inline long 770static inline long
769strncpy_from_user(char *dst, const char *src, long count) 771strncpy_from_user(char *dst, const char __user *src, long count)
770{ 772{
771 long res; 773 long res;
772 if (count == 0) return count; 774 if (count == 0) return count;
@@ -799,11 +801,11 @@ strncpy_from_user(char *dst, const char *src, long count)
799 * 801 *
800 * Return 0 on exception, a value greater than N if too long 802 * Return 0 on exception, a value greater than N if too long
801 */ 803 */
802static inline long strnlen_user(const char *src, long n) 804static inline long strnlen_user(const char __user *src, long n)
803{ 805{
804 long res; 806 long res;
805 807
806 res = -(long)src; 808 res = -(unsigned long)src;
807 __asm__ __volatile__ 809 __asm__ __volatile__
808 ("1:\n" 810 ("1:\n"
809 " tstl %2\n" 811 " tstl %2\n"
@@ -842,7 +844,7 @@ static inline long strnlen_user(const char *src, long n)
842 */ 844 */
843 845
844static inline unsigned long 846static inline unsigned long
845clear_user(void *to, unsigned long n) 847clear_user(void __user *to, unsigned long n)
846{ 848{
847 __asm__ __volatile__ 849 __asm__ __volatile__
848 (" tstl %1\n" 850 (" tstl %1\n"
diff --git a/include/asm-m68k/zorro.h b/include/asm-m68k/zorro.h
index cf816588bedb..5ce97c22b582 100644
--- a/include/asm-m68k/zorro.h
+++ b/include/asm-m68k/zorro.h
@@ -15,24 +15,24 @@
15#define z_memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) 15#define z_memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
16#define z_memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) 16#define z_memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
17 17
18static inline void *z_remap_nocache_ser(unsigned long physaddr, 18static inline void __iomem *z_remap_nocache_ser(unsigned long physaddr,
19 unsigned long size) 19 unsigned long size)
20{ 20{
21 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); 21 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
22} 22}
23 23
24static inline void *z_remap_nocache_nonser(unsigned long physaddr, 24static inline void __iomem *z_remap_nocache_nonser(unsigned long physaddr,
25 unsigned long size) 25 unsigned long size)
26{ 26{
27 return __ioremap(physaddr, size, IOMAP_NOCACHE_NONSER); 27 return __ioremap(physaddr, size, IOMAP_NOCACHE_NONSER);
28} 28}
29 29
30static inline void *z_remap_writethrough(unsigned long physaddr, 30static inline void __iomem *z_remap_writethrough(unsigned long physaddr,
31 unsigned long size) 31 unsigned long size)
32{ 32{
33 return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); 33 return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
34} 34}
35static inline void *z_remap_fullcache(unsigned long physaddr, 35static inline void __iomem *z_remap_fullcache(unsigned long physaddr,
36 unsigned long size) 36 unsigned long size)
37{ 37{
38 return __ioremap(physaddr, size, IOMAP_FULL_CACHING); 38 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
diff --git a/include/asm-m68knommu/atomic.h b/include/asm-m68knommu/atomic.h
index 3c1cc153c415..6c4e4b63e454 100644
--- a/include/asm-m68knommu/atomic.h
+++ b/include/asm-m68knommu/atomic.h
@@ -129,6 +129,7 @@ static inline int atomic_sub_return(int i, atomic_t * v)
129} 129}
130 130
131#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 131#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
132#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
132 133
133#define atomic_add_unless(v, a, u) \ 134#define atomic_add_unless(v, a, u) \
134({ \ 135({ \
@@ -143,4 +144,5 @@ static inline int atomic_sub_return(int i, atomic_t * v)
143#define atomic_dec_return(v) atomic_sub_return(1,(v)) 144#define atomic_dec_return(v) atomic_sub_return(1,(v))
144#define atomic_inc_return(v) atomic_add_return(1,(v)) 145#define atomic_inc_return(v) atomic_add_return(1,(v))
145 146
147#include <asm-generic/atomic.h>
146#endif /* __ARCH_M68KNOMMU_ATOMIC __ */ 148#endif /* __ARCH_M68KNOMMU_ATOMIC __ */
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index c42f88a9b9f9..25d8a3cfef90 100644
--- a/include/asm-m68knommu/bitops.h
+++ b/include/asm-m68knommu/bitops.h
@@ -290,7 +290,7 @@ static __inline__ int find_next_zero_bit (const void * addr, int size, int offse
290 tmp = *p; 290 tmp = *p;
291 291
292found_first: 292found_first:
293 tmp |= ~0UL >> size; 293 tmp |= ~0UL << size;
294found_middle: 294found_middle:
295 return result + ffz(tmp); 295 return result + ffz(tmp);
296} 296}
@@ -499,5 +499,6 @@ found_middle:
499 * fls: find last bit set. 499 * fls: find last bit set.
500 */ 500 */
501#define fls(x) generic_fls(x) 501#define fls(x) generic_fls(x)
502#define fls64(x) generic_fls64(x)
502 503
503#endif /* _M68KNOMMU_BITOPS_H */ 504#endif /* _M68KNOMMU_BITOPS_H */
diff --git a/include/asm-m68knommu/futex.h b/include/asm-m68knommu/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-m68knommu/futex.h
+++ b/include/asm-m68knommu/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-m68knommu/ioctl.h b/include/asm-m68knommu/ioctl.h
index cff72f33350f..b279fe06dfe5 100644
--- a/include/asm-m68knommu/ioctl.h
+++ b/include/asm-m68knommu/ioctl.h
@@ -1 +1 @@
#include <asm-m68k/ioctl.h> #include <asm-generic/ioctl.h>
diff --git a/include/asm-m68knommu/irq.h b/include/asm-m68knommu/irq.h
index a08fa9b958da..20c48ec858a4 100644
--- a/include/asm-m68knommu/irq.h
+++ b/include/asm-m68knommu/irq.h
@@ -84,10 +84,8 @@ extern void (*mach_disable_irq)(unsigned int);
84/* 84/*
85 * Some drivers want these entry points 85 * Some drivers want these entry points
86 */ 86 */
87#define enable_irq(x) (mach_enable_irq ? (*mach_enable_irq)(x) : 0) 87#define enable_irq(x) 0
88#define disable_irq(x) (mach_disable_irq ? (*mach_disable_irq)(x) : 0) 88#define disable_irq(x) do { } while (0)
89
90#define enable_irq_nosync(x) enable_irq(x)
91#define disable_irq_nosync(x) disable_irq(x) 89#define disable_irq_nosync(x) disable_irq(x)
92 90
93struct irqaction; 91struct irqaction;
diff --git a/include/asm-m68knommu/machdep.h b/include/asm-m68knommu/machdep.h
index 5a9f9c297f79..27c90afd3339 100644
--- a/include/asm-m68knommu/machdep.h
+++ b/include/asm-m68knommu/machdep.h
@@ -38,7 +38,6 @@ extern void (*mach_power_off)( void );
38extern unsigned long (*mach_hd_init) (unsigned long, unsigned long); 38extern unsigned long (*mach_hd_init) (unsigned long, unsigned long);
39extern void (*mach_hd_setup)(char *, int *); 39extern void (*mach_hd_setup)(char *, int *);
40extern long mach_max_dma_address; 40extern long mach_max_dma_address;
41extern void (*mach_floppy_setup)(char *, int *);
42extern void (*mach_floppy_eject)(void); 41extern void (*mach_floppy_eject)(void);
43extern void (*mach_heartbeat) (int); 42extern void (*mach_heartbeat) (int);
44extern void (*mach_l2_flush) (int); 43extern void (*mach_l2_flush) (int);
diff --git a/include/asm-m68knommu/mutex.h b/include/asm-m68knommu/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-m68knommu/mutex.h
@@ -0,0 +1,9 @@
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-m68knommu/sigcontext.h b/include/asm-m68knommu/sigcontext.h
index 84bf36dc7a83..36c293fc133d 100644
--- a/include/asm-m68knommu/sigcontext.h
+++ b/include/asm-m68knommu/sigcontext.h
@@ -8,6 +8,7 @@ struct sigcontext {
8 unsigned long sc_d1; 8 unsigned long sc_d1;
9 unsigned long sc_a0; 9 unsigned long sc_a0;
10 unsigned long sc_a1; 10 unsigned long sc_a1;
11 unsigned long sc_a5;
11 unsigned short sc_sr; 12 unsigned short sc_sr;
12 unsigned long sc_pc; 13 unsigned long sc_pc;
13 unsigned short sc_formatvec; 14 unsigned short sc_formatvec;
diff --git a/include/asm-m68knommu/thread_info.h b/include/asm-m68knommu/thread_info.h
index 7b9a3fa3af5d..b8f009edf2b2 100644
--- a/include/asm-m68knommu/thread_info.h
+++ b/include/asm-m68knommu/thread_info.h
@@ -75,8 +75,6 @@ static inline struct thread_info *current_thread_info(void)
75#define alloc_thread_info(tsk) ((struct thread_info *) \ 75#define alloc_thread_info(tsk) ((struct thread_info *) \
76 __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER)) 76 __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
77#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_SIZE_ORDER) 77#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_SIZE_ORDER)
78#define get_thread_info(ti) get_task_struct((ti)->task)
79#define put_thread_info(ti) put_task_struct((ti)->task)
80#endif /* __ASSEMBLY__ */ 78#endif /* __ASSEMBLY__ */
81 79
82#define PREEMPT_ACTIVE 0x4000000 80#define PREEMPT_ACTIVE 0x4000000
diff --git a/include/asm-mips/.gitignore b/include/asm-mips/.gitignore
deleted file mode 100644
index 4ec57ad5bc3c..000000000000
--- a/include/asm-mips/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1asm_offsets.h
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index 55c37c106ef0..654b97d3e13a 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -24,10 +24,9 @@
24#define _ASM_ATOMIC_H 24#define _ASM_ATOMIC_H
25 25
26#include <asm/cpu-features.h> 26#include <asm/cpu-features.h>
27#include <asm/interrupt.h>
27#include <asm/war.h> 28#include <asm/war.h>
28 29
29extern spinlock_t atomic_lock;
30
31typedef struct { volatile int counter; } atomic_t; 30typedef struct { volatile int counter; } atomic_t;
32 31
33#define ATOMIC_INIT(i) { (i) } 32#define ATOMIC_INIT(i) { (i) }
@@ -85,9 +84,9 @@ static __inline__ void atomic_add(int i, atomic_t * v)
85 } else { 84 } else {
86 unsigned long flags; 85 unsigned long flags;
87 86
88 spin_lock_irqsave(&atomic_lock, flags); 87 local_irq_save(flags);
89 v->counter += i; 88 v->counter += i;
90 spin_unlock_irqrestore(&atomic_lock, flags); 89 local_irq_restore(flags);
91 } 90 }
92} 91}
93 92
@@ -127,9 +126,9 @@ static __inline__ void atomic_sub(int i, atomic_t * v)
127 } else { 126 } else {
128 unsigned long flags; 127 unsigned long flags;
129 128
130 spin_lock_irqsave(&atomic_lock, flags); 129 local_irq_save(flags);
131 v->counter -= i; 130 v->counter -= i;
132 spin_unlock_irqrestore(&atomic_lock, flags); 131 local_irq_restore(flags);
133 } 132 }
134} 133}
135 134
@@ -173,11 +172,11 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
173 } else { 172 } else {
174 unsigned long flags; 173 unsigned long flags;
175 174
176 spin_lock_irqsave(&atomic_lock, flags); 175 local_irq_save(flags);
177 result = v->counter; 176 result = v->counter;
178 result += i; 177 result += i;
179 v->counter = result; 178 v->counter = result;
180 spin_unlock_irqrestore(&atomic_lock, flags); 179 local_irq_restore(flags);
181 } 180 }
182 181
183 return result; 182 return result;
@@ -220,11 +219,11 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
220 } else { 219 } else {
221 unsigned long flags; 220 unsigned long flags;
222 221
223 spin_lock_irqsave(&atomic_lock, flags); 222 local_irq_save(flags);
224 result = v->counter; 223 result = v->counter;
225 result -= i; 224 result -= i;
226 v->counter = result; 225 v->counter = result;
227 spin_unlock_irqrestore(&atomic_lock, flags); 226 local_irq_restore(flags);
228 } 227 }
229 228
230 return result; 229 return result;
@@ -277,18 +276,19 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
277 } else { 276 } else {
278 unsigned long flags; 277 unsigned long flags;
279 278
280 spin_lock_irqsave(&atomic_lock, flags); 279 local_irq_save(flags);
281 result = v->counter; 280 result = v->counter;
282 result -= i; 281 result -= i;
283 if (result >= 0) 282 if (result >= 0)
284 v->counter = result; 283 v->counter = result;
285 spin_unlock_irqrestore(&atomic_lock, flags); 284 local_irq_restore(flags);
286 } 285 }
287 286
288 return result; 287 return result;
289} 288}
290 289
291#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 290#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
291#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
292 292
293/** 293/**
294 * atomic_add_unless - add unless the number is a given value 294 * atomic_add_unless - add unless the number is a given value
@@ -432,9 +432,9 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
432 } else { 432 } else {
433 unsigned long flags; 433 unsigned long flags;
434 434
435 spin_lock_irqsave(&atomic_lock, flags); 435 local_irq_save(flags);
436 v->counter += i; 436 v->counter += i;
437 spin_unlock_irqrestore(&atomic_lock, flags); 437 local_irq_restore(flags);
438 } 438 }
439} 439}
440 440
@@ -474,9 +474,9 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
474 } else { 474 } else {
475 unsigned long flags; 475 unsigned long flags;
476 476
477 spin_lock_irqsave(&atomic_lock, flags); 477 local_irq_save(flags);
478 v->counter -= i; 478 v->counter -= i;
479 spin_unlock_irqrestore(&atomic_lock, flags); 479 local_irq_restore(flags);
480 } 480 }
481} 481}
482 482
@@ -520,11 +520,11 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
520 } else { 520 } else {
521 unsigned long flags; 521 unsigned long flags;
522 522
523 spin_lock_irqsave(&atomic_lock, flags); 523 local_irq_save(flags);
524 result = v->counter; 524 result = v->counter;
525 result += i; 525 result += i;
526 v->counter = result; 526 v->counter = result;
527 spin_unlock_irqrestore(&atomic_lock, flags); 527 local_irq_restore(flags);
528 } 528 }
529 529
530 return result; 530 return result;
@@ -567,11 +567,11 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
567 } else { 567 } else {
568 unsigned long flags; 568 unsigned long flags;
569 569
570 spin_lock_irqsave(&atomic_lock, flags); 570 local_irq_save(flags);
571 result = v->counter; 571 result = v->counter;
572 result -= i; 572 result -= i;
573 v->counter = result; 573 v->counter = result;
574 spin_unlock_irqrestore(&atomic_lock, flags); 574 local_irq_restore(flags);
575 } 575 }
576 576
577 return result; 577 return result;
@@ -624,12 +624,12 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
624 } else { 624 } else {
625 unsigned long flags; 625 unsigned long flags;
626 626
627 spin_lock_irqsave(&atomic_lock, flags); 627 local_irq_save(flags);
628 result = v->counter; 628 result = v->counter;
629 result -= i; 629 result -= i;
630 if (result >= 0) 630 if (result >= 0)
631 v->counter = result; 631 v->counter = result;
632 spin_unlock_irqrestore(&atomic_lock, flags); 632 local_irq_restore(flags);
633 } 633 }
634 634
635 return result; 635 return result;
@@ -713,4 +713,5 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
713#define smp_mb__before_atomic_inc() smp_mb() 713#define smp_mb__before_atomic_inc() smp_mb()
714#define smp_mb__after_atomic_inc() smp_mb() 714#define smp_mb__after_atomic_inc() smp_mb()
715 715
716#include <asm-generic/atomic.h>
716#endif /* _ASM_ATOMIC_H */ 717#endif /* _ASM_ATOMIC_H */
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 5496f9064a6a..3b0c8aaf6e8b 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -695,7 +695,7 @@ static inline unsigned long fls(unsigned long word)
695 695
696 return flz(~word) + 1; 696 return flz(~word) + 1;
697} 697}
698 698#define fls64(x) generic_fls64(x)
699 699
700/* 700/*
701 * find_next_zero_bit - find the first zero bit in a memory region 701 * find_next_zero_bit - find the first zero bit in a memory region
diff --git a/include/asm-mips/cache.h b/include/asm-mips/cache.h
index 1a5d1a669db3..55e19f2ff0e0 100644
--- a/include/asm-mips/cache.h
+++ b/include/asm-mips/cache.h
@@ -15,7 +15,6 @@
15#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT 15#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT
16#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 16#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
17 17
18#define L1_CACHE_SHIFT_MAX 6
19#define SMP_CACHE_SHIFT L1_CACHE_SHIFT 18#define SMP_CACHE_SHIFT L1_CACHE_SHIFT
20#define SMP_CACHE_BYTES L1_CACHE_BYTES 19#define SMP_CACHE_BYTES L1_CACHE_BYTES
21 20
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index 03627cfb3e45..78c9cc2735d5 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -116,6 +116,27 @@
116#endif 116#endif
117#endif 117#endif
118 118
119# ifndef cpu_has_mips32r1
120# define cpu_has_mips32r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R1)
121# endif
122# ifndef cpu_has_mips32r2
123# define cpu_has_mips32r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R2)
124# endif
125# ifndef cpu_has_mips64r1
126# define cpu_has_mips64r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R1)
127# endif
128# ifndef cpu_has_mips64r2
129# define cpu_has_mips64r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R2)
130# endif
131
132/*
133 * Shortcuts ...
134 */
135#define cpu_has_mips32 (cpu_has_mips32r1 | cpu_has_mips32r2)
136#define cpu_has_mips64 (cpu_has_mips64r1 | cpu_has_mips64r2)
137#define cpu_has_mips_r1 (cpu_has_mips32r1 | cpu_has_mips64r1)
138#define cpu_has_mips_r2 (cpu_has_mips32r2 | cpu_has_mips64r2)
139
119#ifndef cpu_has_dsp 140#ifndef cpu_has_dsp
120#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP) 141#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP)
121#endif 142#endif
diff --git a/include/asm-mips/cpu.h b/include/asm-mips/cpu.h
index 48eac296060f..934e063e79f1 100644
--- a/include/asm-mips/cpu.h
+++ b/include/asm-mips/cpu.h
@@ -204,16 +204,18 @@
204 */ 204 */
205#define MIPS_CPU_ISA_I 0x00000001 205#define MIPS_CPU_ISA_I 0x00000001
206#define MIPS_CPU_ISA_II 0x00000002 206#define MIPS_CPU_ISA_II 0x00000002
207#define MIPS_CPU_ISA_III 0x00008003 207#define MIPS_CPU_ISA_III 0x00000003
208#define MIPS_CPU_ISA_IV 0x00008004 208#define MIPS_CPU_ISA_IV 0x00000004
209#define MIPS_CPU_ISA_V 0x00008005 209#define MIPS_CPU_ISA_V 0x00000005
210#define MIPS_CPU_ISA_M32 0x00000020 210#define MIPS_CPU_ISA_M32R1 0x00000020
211#define MIPS_CPU_ISA_M64 0x00008040 211#define MIPS_CPU_ISA_M32R2 0x00000040
212#define MIPS_CPU_ISA_M64R1 0x00000080
213#define MIPS_CPU_ISA_M64R2 0x00000100
212 214
213/* 215#define MIPS_CPU_ISA_32BIT (MIPS_CPU_ISA_I | MIPS_CPU_ISA_II | \
214 * Bit 15 encodes if an ISA level supports 64-bit operations. 216 MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 )
215 */ 217#define MIPS_CPU_ISA_64BIT (MIPS_CPU_ISA_III | MIPS_CPU_ISA_IV | \
216#define MIPS_CPU_ISA_64BIT 0x00008000 218 MIPS_CPU_ISA_V | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)
217 219
218/* 220/*
219 * CPU Option encodings 221 * CPU Option encodings
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index 48d00cccdafa..64dd45150f64 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -52,13 +52,11 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
52 unsigned long lo; 52 unsigned long lo;
53 53
54 /* 54 /*
55 * The common rates of 1000 and 128 are rounded wrongly by the 55 * The rates of 128 is rounded wrongly by the catchall case
56 * catchall case for 64-bit. Excessive precission? Probably ... 56 * for 64-bit. Excessive precission? Probably ...
57 */ 57 */
58#if defined(CONFIG_64BIT) && (HZ == 128) 58#if defined(CONFIG_64BIT) && (HZ == 128)
59 usecs *= 0x0008637bd05af6c7UL; /* 2**64 / (1000000 / HZ) */ 59 usecs *= 0x0008637bd05af6c7UL; /* 2**64 / (1000000 / HZ) */
60#elif defined(CONFIG_64BIT) && (HZ == 1000)
61 usecs *= 0x004189374BC6A7f0UL; /* 2**64 / (1000000 / HZ) */
62#elif defined(CONFIG_64BIT) 60#elif defined(CONFIG_64BIT)
63 usecs *= (0x8000000000000000UL / (500000 / HZ)); 61 usecs *= (0x8000000000000000UL / (500000 / HZ));
64#else /* 32-bit junk follows here */ 62#else /* 32-bit junk follows here */
diff --git a/include/asm-mips/dsp.h b/include/asm-mips/dsp.h
index 50f556bb4978..e9bfc0813c72 100644
--- a/include/asm-mips/dsp.h
+++ b/include/asm-mips/dsp.h
@@ -16,7 +16,7 @@
16#include <asm/mipsregs.h> 16#include <asm/mipsregs.h>
17 17
18#define DSP_DEFAULT 0x00000000 18#define DSP_DEFAULT 0x00000000
19#define DSP_MASK 0x1f 19#define DSP_MASK 0x3ff
20 20
21#define __enable_dsp_hazard() \ 21#define __enable_dsp_hazard() \
22do { \ 22do { \
@@ -48,6 +48,7 @@ do { \
48 tsk->thread.dsp.dspr[3] = mflo2(); \ 48 tsk->thread.dsp.dspr[3] = mflo2(); \
49 tsk->thread.dsp.dspr[4] = mfhi3(); \ 49 tsk->thread.dsp.dspr[4] = mfhi3(); \
50 tsk->thread.dsp.dspr[5] = mflo3(); \ 50 tsk->thread.dsp.dspr[5] = mflo3(); \
51 tsk->thread.dsp.dspcontrol = rddsp(DSP_MASK); \
51} while (0) 52} while (0)
52 53
53#define save_dsp(tsk) \ 54#define save_dsp(tsk) \
@@ -64,6 +65,7 @@ do { \
64 mtlo2(tsk->thread.dsp.dspr[3]); \ 65 mtlo2(tsk->thread.dsp.dspr[3]); \
65 mthi3(tsk->thread.dsp.dspr[4]); \ 66 mthi3(tsk->thread.dsp.dspr[4]); \
66 mtlo3(tsk->thread.dsp.dspr[5]); \ 67 mtlo3(tsk->thread.dsp.dspr[5]); \
68 wrdsp(tsk->thread.dsp.dspcontrol, DSP_MASK); \
67} while (0) 69} while (0)
68 70
69#define restore_dsp(tsk) \ 71#define restore_dsp(tsk) \
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
index d2c9a25f8459..851f013adad3 100644
--- a/include/asm-mips/elf.h
+++ b/include/asm-mips/elf.h
@@ -277,12 +277,12 @@ do { \
277 277
278struct task_struct; 278struct task_struct;
279 279
280extern void dump_regs(elf_greg_t *, struct pt_regs *regs); 280extern void elf_dump_regs(elf_greg_t *, struct pt_regs *regs);
281extern int dump_task_regs (struct task_struct *, elf_gregset_t *); 281extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
282extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); 282extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
283 283
284#define ELF_CORE_COPY_REGS(elf_regs, regs) \ 284#define ELF_CORE_COPY_REGS(elf_regs, regs) \
285 dump_regs((elf_greg_t *)&(elf_regs), regs); 285 elf_dump_regs((elf_greg_t *)&(elf_regs), regs);
286#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs) 286#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
287#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \ 287#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \
288 dump_task_fpu(tsk, elf_fpregs) 288 dump_task_fpu(tsk, elf_fpregs)
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index 7517189e469f..2fc90632f88c 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -233,15 +233,25 @@ __asm__(
233#endif 233#endif
234 234
235#ifdef CONFIG_CPU_MIPSR2 235#ifdef CONFIG_CPU_MIPSR2
236/*
237 * gcc has a tradition of misscompiling the previous construct using the
238 * address of a label as argument to inline assembler. Gas otoh has the
239 * annoying difference between la and dla which are only usable for 32-bit
240 * rsp. 64-bit code, so can't be used without conditional compilation.
241 * The alterantive is switching the assembler to 64-bit code which happens
242 * to work right even for 32-bit code ...
243 */
236#define instruction_hazard() \ 244#define instruction_hazard() \
237do { \ 245do { \
238__label__ __next; \ 246 unsigned long tmp; \
247 \
239 __asm__ __volatile__( \ 248 __asm__ __volatile__( \
249 " .set mips64r2 \n" \
250 " dla %0, 1f \n" \
240 " jr.hb %0 \n" \ 251 " jr.hb %0 \n" \
241 : \ 252 " .set mips0 \n" \
242 : "r" (&&__next)); \ 253 "1: \n" \
243__next: \ 254 : "=r" (tmp)); \
244 ; \
245} while (0) 255} while (0)
246 256
247#else 257#else
diff --git a/include/asm-mips/interrupt.h b/include/asm-mips/interrupt.h
index a5735761f5e5..abdf54ee64cf 100644
--- a/include/asm-mips/interrupt.h
+++ b/include/asm-mips/interrupt.h
@@ -93,6 +93,7 @@ __asm__ (
93 " .set noat \n" 93 " .set noat \n"
94#ifdef CONFIG_CPU_MIPSR2 94#ifdef CONFIG_CPU_MIPSR2
95 " di \\result \n" 95 " di \\result \n"
96 " andi \\result, 1 \n"
96#else 97#else
97 " mfc0 \\result, $12 \n" 98 " mfc0 \\result, $12 \n"
98 " ori $1, \\result, 1 \n" 99 " ori $1, \\result, 1 \n"
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
index 8327ec341c18..8e1d7ed7d8e3 100644
--- a/include/asm-mips/mach-au1x00/au1000.h
+++ b/include/asm-mips/mach-au1x00/au1000.h
@@ -838,6 +838,7 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
838#define UART3_ADDR 0xB1400000 838#define UART3_ADDR 0xB1400000
839 839
840#define USB_OHCI_BASE 0x14020000 // phys addr for ioremap 840#define USB_OHCI_BASE 0x14020000 // phys addr for ioremap
841#define USB_OHCI_LEN 0x00060000
841#define USB_HOST_CONFIG 0xB4027ffc 842#define USB_HOST_CONFIG 0xB4027ffc
842 843
843#define AU1550_ETH0_BASE 0xB0500000 844#define AU1550_ETH0_BASE 0xB0500000
@@ -1017,10 +1018,12 @@ extern au1xxx_irq_map_t au1xxx_irq_map[];
1017 #define I2S_CONTROL_D (1<<1) 1018 #define I2S_CONTROL_D (1<<1)
1018 #define I2S_CONTROL_CE (1<<0) 1019 #define I2S_CONTROL_CE (1<<0)
1019 1020
1020#ifndef CONFIG_SOC_AU1200
1021
1022/* USB Host Controller */ 1021/* USB Host Controller */
1022#ifndef USB_OHCI_LEN
1023#define USB_OHCI_LEN 0x00100000 1023#define USB_OHCI_LEN 0x00100000
1024#endif
1025
1026#ifndef CONFIG_SOC_AU1200
1024 1027
1025/* USB Device Controller */ 1028/* USB Device Controller */
1026#define USBD_EP0RD 0xB0200000 1029#define USBD_EP0RD 0xB0200000
diff --git a/include/asm-mips/mach-ip22/cpu-feature-overrides.h b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
index ab9714668177..2a37bedb4053 100644
--- a/include/asm-mips/mach-ip22/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
@@ -34,4 +34,9 @@
34#define cpu_has_nofpuex 0 34#define cpu_has_nofpuex 0
35#define cpu_has_64bits 1 35#define cpu_has_64bits 1
36 36
37#define cpu_has_mips32r1 0
38#define cpu_has_mips32r2 0
39#define cpu_has_mips64r1 0
40#define cpu_has_mips64r2 0
41
37#endif /* __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H */ 42#endif /* __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip27/cpu-feature-overrides.h b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
index 4c8a90051fd0..2d2f5b91e47f 100644
--- a/include/asm-mips/mach-ip27/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
@@ -37,4 +37,9 @@
37#define cpu_icache_line_size() 64 37#define cpu_icache_line_size() 64
38#define cpu_scache_line_size() 128 38#define cpu_scache_line_size() 128
39 39
40#define cpu_has_mips32r1 0
41#define cpu_has_mips32r2 0
42#define cpu_has_mips64r1 0
43#define cpu_has_mips64r2 0
44
40#endif /* __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H */ 45#endif /* __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip27/topology.h b/include/asm-mips/mach-ip27/topology.h
index 82141c711c33..59d26b52ba32 100644
--- a/include/asm-mips/mach-ip27/topology.h
+++ b/include/asm-mips/mach-ip27/topology.h
@@ -27,7 +27,6 @@ extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
27 .max_interval = 32, \ 27 .max_interval = 32, \
28 .busy_factor = 32, \ 28 .busy_factor = 32, \
29 .imbalance_pct = 125, \ 29 .imbalance_pct = 125, \
30 .cache_hot_time = (10*1000), \
31 .cache_nice_tries = 1, \ 30 .cache_nice_tries = 1, \
32 .per_cpu_gain = 100, \ 31 .per_cpu_gain = 100, \
33 .flags = SD_LOAD_BALANCE \ 32 .flags = SD_LOAD_BALANCE \
diff --git a/include/asm-mips/mach-ip32/cpu-feature-overrides.h b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
index ab37fc1842ba..b80c30725cf6 100644
--- a/include/asm-mips/mach-ip32/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
@@ -39,4 +39,9 @@
39#define cpu_has_ic_fills_f_dc 0 39#define cpu_has_ic_fills_f_dc 0
40#define cpu_has_dsp 0 40#define cpu_has_dsp 0
41 41
42#define cpu_has_mips32r1 0
43#define cpu_has_mips32r2 0
44#define cpu_has_mips64r1 0
45#define cpu_has_mips64r2 0
46
42#endif /* __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H */ 47#endif /* __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ja/cpu-feature-overrides.h b/include/asm-mips/mach-ja/cpu-feature-overrides.h
index a0fde405d4c4..90ff087083b9 100644
--- a/include/asm-mips/mach-ja/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ja/cpu-feature-overrides.h
@@ -37,4 +37,9 @@
37#define cpu_icache_line_size() 32 37#define cpu_icache_line_size() 32
38#define cpu_scache_line_size() 32 38#define cpu_scache_line_size() 32
39 39
40#define cpu_has_mips32r1 0
41#define cpu_has_mips32r2 0
42#define cpu_has_mips64r1 0
43#define cpu_has_mips64r2 0
44
40#endif /* __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H */ 45#endif /* __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h b/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
index 825c5f674dfc..782b986241dd 100644
--- a/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-ocelot3/cpu-feature-overrides.h
@@ -40,4 +40,9 @@
40#define cpu_icache_line_size() 32 40#define cpu_icache_line_size() 32
41#define cpu_scache_line_size() 32 41#define cpu_scache_line_size() 32
42 42
43#define cpu_has_mips32r1 0
44#define cpu_has_mips32r2 0
45#define cpu_has_mips64r1 0
46#define cpu_has_mips64r2 0
47
43#endif /* __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H */ 48#endif /* __ASM_MACH_JA_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-rm200/cpu-feature-overrides.h b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
index 79f9b064c864..91e7cf5f2bfe 100644
--- a/include/asm-mips/mach-rm200/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-rm200/cpu-feature-overrides.h
@@ -40,4 +40,9 @@
40#define cpu_icache_line_size() 32 40#define cpu_icache_line_size() 32
41#define cpu_scache_line_size() 0 /* No S-cache on R5000 I think ... */ 41#define cpu_scache_line_size() 0 /* No S-cache on R5000 I think ... */
42 42
43#define cpu_has_mips32r1 0
44#define cpu_has_mips32r2 0
45#define cpu_has_mips64r1 0
46#define cpu_has_mips64r2 0
47
43#endif /* __ASM_MACH_RM200_CPU_FEATURE_OVERRIDES_H */ 48#endif /* __ASM_MACH_RM200_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
index 463d051f4683..3073542c93c7 100644
--- a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
@@ -37,4 +37,9 @@
37#define cpu_icache_line_size() 32 37#define cpu_icache_line_size() 32
38#define cpu_scache_line_size() 32 38#define cpu_scache_line_size() 32
39 39
40#define cpu_has_mips32r1 0
41#define cpu_has_mips32r2 0
42#define cpu_has_mips64r1 0
43#define cpu_has_mips64r2 0
44
40#endif /* __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H */ 45#endif /* __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
index 80370e0a5589..035ba0a9b0df 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -1059,7 +1059,7 @@ do { \
1059 " .set noat \n" \ 1059 " .set noat \n" \
1060 " move $1, %0 \n" \ 1060 " move $1, %0 \n" \
1061 " # wrdsp $1, %x1 \n" \ 1061 " # wrdsp $1, %x1 \n" \
1062 " .word 0x7c2004f8 | (%x1 << 15) \n" \ 1062 " .word 0x7c2004f8 | (%x1 << 11) \n" \
1063 " .set pop \n" \ 1063 " .set pop \n" \
1064 : \ 1064 : \
1065 : "r" (val), "i" (mask)); \ 1065 : "r" (val), "i" (mask)); \
diff --git a/include/asm-mips/mman.h b/include/asm-mips/mman.h
index 62060957ba93..dd17c8bd62a1 100644
--- a/include/asm-mips/mman.h
+++ b/include/asm-mips/mman.h
@@ -65,6 +65,7 @@
65#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 65#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
66#define MADV_WILLNEED 0x3 /* pre-fault pages */ 66#define MADV_WILLNEED 0x3 /* pre-fault pages */
67#define MADV_DONTNEED 0x4 /* discard these pages */ 67#define MADV_DONTNEED 0x4 /* discard these pages */
68#define MADV_REMOVE 0x5 /* remove these pages & resources */
68 69
69/* compatibility flags */ 70/* compatibility flags */
70#define MAP_ANON MAP_ANONYMOUS 71#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-mips/mutex.h b/include/asm-mips/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-mips/mutex.h
@@ -0,0 +1,9 @@
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-mips/processor.h b/include/asm-mips/processor.h
index f1980c6c3bcc..39d2bd50fece 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -103,7 +103,6 @@ typedef __u32 dspreg_t;
103struct mips_dsp_state { 103struct mips_dsp_state {
104 dspreg_t dspr[NUM_DSP_REGS]; 104 dspreg_t dspr[NUM_DSP_REGS];
105 unsigned int dspcontrol; 105 unsigned int dspcontrol;
106 unsigned short used_dsp;
107}; 106};
108 107
109#define INIT_DSP {{0,},} 108#define INIT_DSP {{0,},}
@@ -201,11 +200,11 @@ extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long
201 200
202unsigned long get_wchan(struct task_struct *p); 201unsigned long get_wchan(struct task_struct *p);
203 202
204#define __PT_REG(reg) ((long)&((struct pt_regs *)0)->reg - sizeof(struct pt_regs)) 203#define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32)
205#define __KSTK_TOS(tsk) ((unsigned long)(tsk->thread_info) + THREAD_SIZE - 32) 204#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1)
206#define KSTK_EIP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_epc))) 205#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
207#define KSTK_ESP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(regs[29]))) 206#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
208#define KSTK_STATUS(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_status))) 207#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
209 208
210#define cpu_relax() barrier() 209#define cpu_relax() barrier()
211 210
diff --git a/include/asm-mips/riscos-syscall.h b/include/asm-mips/riscos-syscall.h
deleted file mode 100644
index 4d8eb15461eb..000000000000
--- a/include/asm-mips/riscos-syscall.h
+++ /dev/null
@@ -1,979 +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) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle
7 */
8#ifndef _ASM_RISCOS_SYSCALL_H
9#define _ASM_RISCOS_SYSCALL_H
10
11/*
12 * The syscalls 0 - 3999 are reserved for a down to the root syscall
13 * compatibility with RISC/os and IRIX. We'll see how to deal with the
14 * various "real" BSD variants like Ultrix, NetBSD ...
15 */
16
17/*
18 * SVR4 syscalls are in the range from 1 to 999
19 */
20#define __NR_SVR4 0
21#define __NR_SVR4_syscall (__NR_SVR4 + 0)
22#define __NR_SVR4_exit (__NR_SVR4 + 1)
23#define __NR_SVR4_fork (__NR_SVR4 + 2)
24#define __NR_SVR4_read (__NR_SVR4 + 3)
25#define __NR_SVR4_write (__NR_SVR4 + 4)
26#define __NR_SVR4_open (__NR_SVR4 + 5)
27#define __NR_SVR4_close (__NR_SVR4 + 6)
28#define __NR_SVR4_wait (__NR_SVR4 + 7)
29#define __NR_SVR4_creat (__NR_SVR4 + 8)
30#define __NR_SVR4_link (__NR_SVR4 + 9)
31#define __NR_SVR4_unlink (__NR_SVR4 + 10)
32#define __NR_SVR4_exec (__NR_SVR4 + 11)
33#define __NR_SVR4_chdir (__NR_SVR4 + 12)
34#define __NR_SVR4_gtime (__NR_SVR4 + 13)
35#define __NR_SVR4_mknod (__NR_SVR4 + 14)
36#define __NR_SVR4_chmod (__NR_SVR4 + 15)
37#define __NR_SVR4_chown (__NR_SVR4 + 16)
38#define __NR_SVR4_sbreak (__NR_SVR4 + 17)
39#define __NR_SVR4_stat (__NR_SVR4 + 18)
40#define __NR_SVR4_lseek (__NR_SVR4 + 19)
41#define __NR_SVR4_getpid (__NR_SVR4 + 20)
42#define __NR_SVR4_mount (__NR_SVR4 + 21)
43#define __NR_SVR4_umount (__NR_SVR4 + 22)
44#define __NR_SVR4_setuid (__NR_SVR4 + 23)
45#define __NR_SVR4_getuid (__NR_SVR4 + 24)
46#define __NR_SVR4_stime (__NR_SVR4 + 25)
47#define __NR_SVR4_ptrace (__NR_SVR4 + 26)
48#define __NR_SVR4_alarm (__NR_SVR4 + 27)
49#define __NR_SVR4_fstat (__NR_SVR4 + 28)
50#define __NR_SVR4_pause (__NR_SVR4 + 29)
51#define __NR_SVR4_utime (__NR_SVR4 + 30)
52#define __NR_SVR4_stty (__NR_SVR4 + 31)
53#define __NR_SVR4_gtty (__NR_SVR4 + 32)
54#define __NR_SVR4_access (__NR_SVR4 + 33)
55#define __NR_SVR4_nice (__NR_SVR4 + 34)
56#define __NR_SVR4_statfs (__NR_SVR4 + 35)
57#define __NR_SVR4_sync (__NR_SVR4 + 36)
58#define __NR_SVR4_kill (__NR_SVR4 + 37)
59#define __NR_SVR4_fstatfs (__NR_SVR4 + 38)
60#define __NR_SVR4_setpgrp (__NR_SVR4 + 39)
61#define __NR_SVR4_cxenix (__NR_SVR4 + 40)
62#define __NR_SVR4_dup (__NR_SVR4 + 41)
63#define __NR_SVR4_pipe (__NR_SVR4 + 42)
64#define __NR_SVR4_times (__NR_SVR4 + 43)
65#define __NR_SVR4_profil (__NR_SVR4 + 44)
66#define __NR_SVR4_plock (__NR_SVR4 + 45)
67#define __NR_SVR4_setgid (__NR_SVR4 + 46)
68#define __NR_SVR4_getgid (__NR_SVR4 + 47)
69#define __NR_SVR4_sig (__NR_SVR4 + 48)
70#define __NR_SVR4_msgsys (__NR_SVR4 + 49)
71#define __NR_SVR4_sysmips (__NR_SVR4 + 50)
72#define __NR_SVR4_sysacct (__NR_SVR4 + 51)
73#define __NR_SVR4_shmsys (__NR_SVR4 + 52)
74#define __NR_SVR4_semsys (__NR_SVR4 + 53)
75#define __NR_SVR4_ioctl (__NR_SVR4 + 54)
76#define __NR_SVR4_uadmin (__NR_SVR4 + 55)
77#define __NR_SVR4_exch (__NR_SVR4 + 56)
78#define __NR_SVR4_utssys (__NR_SVR4 + 57)
79#define __NR_SVR4_fsync (__NR_SVR4 + 58)
80#define __NR_SVR4_exece (__NR_SVR4 + 59)
81#define __NR_SVR4_umask (__NR_SVR4 + 60)
82#define __NR_SVR4_chroot (__NR_SVR4 + 61)
83#define __NR_SVR4_fcntl (__NR_SVR4 + 62)
84#define __NR_SVR4_ulimit (__NR_SVR4 + 63)
85#define __NR_SVR4_reserved1 (__NR_SVR4 + 64)
86#define __NR_SVR4_reserved2 (__NR_SVR4 + 65)
87#define __NR_SVR4_reserved3 (__NR_SVR4 + 66)
88#define __NR_SVR4_reserved4 (__NR_SVR4 + 67)
89#define __NR_SVR4_reserved5 (__NR_SVR4 + 68)
90#define __NR_SVR4_reserved6 (__NR_SVR4 + 69)
91#define __NR_SVR4_advfs (__NR_SVR4 + 70)
92#define __NR_SVR4_unadvfs (__NR_SVR4 + 71)
93#define __NR_SVR4_unused1 (__NR_SVR4 + 72)
94#define __NR_SVR4_unused2 (__NR_SVR4 + 73)
95#define __NR_SVR4_rfstart (__NR_SVR4 + 74)
96#define __NR_SVR4_unused3 (__NR_SVR4 + 75)
97#define __NR_SVR4_rdebug (__NR_SVR4 + 76)
98#define __NR_SVR4_rfstop (__NR_SVR4 + 77)
99#define __NR_SVR4_rfsys (__NR_SVR4 + 78)
100#define __NR_SVR4_rmdir (__NR_SVR4 + 79)
101#define __NR_SVR4_mkdir (__NR_SVR4 + 80)
102#define __NR_SVR4_getdents (__NR_SVR4 + 81)
103#define __NR_SVR4_libattach (__NR_SVR4 + 82)
104#define __NR_SVR4_libdetach (__NR_SVR4 + 83)
105#define __NR_SVR4_sysfs (__NR_SVR4 + 84)
106#define __NR_SVR4_getmsg (__NR_SVR4 + 85)
107#define __NR_SVR4_putmsg (__NR_SVR4 + 86)
108#define __NR_SVR4_poll (__NR_SVR4 + 87)
109#define __NR_SVR4_lstat (__NR_SVR4 + 88)
110#define __NR_SVR4_symlink (__NR_SVR4 + 89)
111#define __NR_SVR4_readlink (__NR_SVR4 + 90)
112#define __NR_SVR4_setgroups (__NR_SVR4 + 91)
113#define __NR_SVR4_getgroups (__NR_SVR4 + 92)
114#define __NR_SVR4_fchmod (__NR_SVR4 + 93)
115#define __NR_SVR4_fchown (__NR_SVR4 + 94)
116#define __NR_SVR4_sigprocmask (__NR_SVR4 + 95)
117#define __NR_SVR4_sigsuspend (__NR_SVR4 + 96)
118#define __NR_SVR4_sigaltstack (__NR_SVR4 + 97)
119#define __NR_SVR4_sigaction (__NR_SVR4 + 98)
120#define __NR_SVR4_sigpending (__NR_SVR4 + 99)
121#define __NR_SVR4_setcontext (__NR_SVR4 + 100)
122#define __NR_SVR4_evsys (__NR_SVR4 + 101)
123#define __NR_SVR4_evtrapret (__NR_SVR4 + 102)
124#define __NR_SVR4_statvfs (__NR_SVR4 + 103)
125#define __NR_SVR4_fstatvfs (__NR_SVR4 + 104)
126#define __NR_SVR4_reserved7 (__NR_SVR4 + 105)
127#define __NR_SVR4_nfssys (__NR_SVR4 + 106)
128#define __NR_SVR4_waitid (__NR_SVR4 + 107)
129#define __NR_SVR4_sigsendset (__NR_SVR4 + 108)
130#define __NR_SVR4_hrtsys (__NR_SVR4 + 109)
131#define __NR_SVR4_acancel (__NR_SVR4 + 110)
132#define __NR_SVR4_async (__NR_SVR4 + 111)
133#define __NR_SVR4_priocntlset (__NR_SVR4 + 112)
134#define __NR_SVR4_pathconf (__NR_SVR4 + 113)
135#define __NR_SVR4_mincore (__NR_SVR4 + 114)
136#define __NR_SVR4_mmap (__NR_SVR4 + 115)
137#define __NR_SVR4_mprotect (__NR_SVR4 + 116)
138#define __NR_SVR4_munmap (__NR_SVR4 + 117)
139#define __NR_SVR4_fpathconf (__NR_SVR4 + 118)
140#define __NR_SVR4_vfork (__NR_SVR4 + 119)
141#define __NR_SVR4_fchdir (__NR_SVR4 + 120)
142#define __NR_SVR4_readv (__NR_SVR4 + 121)
143#define __NR_SVR4_writev (__NR_SVR4 + 122)
144#define __NR_SVR4_xstat (__NR_SVR4 + 123)
145#define __NR_SVR4_lxstat (__NR_SVR4 + 124)
146#define __NR_SVR4_fxstat (__NR_SVR4 + 125)
147#define __NR_SVR4_xmknod (__NR_SVR4 + 126)
148#define __NR_SVR4_clocal (__NR_SVR4 + 127)
149#define __NR_SVR4_setrlimit (__NR_SVR4 + 128)
150#define __NR_SVR4_getrlimit (__NR_SVR4 + 129)
151#define __NR_SVR4_lchown (__NR_SVR4 + 130)
152#define __NR_SVR4_memcntl (__NR_SVR4 + 131)
153#define __NR_SVR4_getpmsg (__NR_SVR4 + 132)
154#define __NR_SVR4_putpmsg (__NR_SVR4 + 133)
155#define __NR_SVR4_rename (__NR_SVR4 + 134)
156#define __NR_SVR4_nuname (__NR_SVR4 + 135)
157#define __NR_SVR4_setegid (__NR_SVR4 + 136)
158#define __NR_SVR4_sysconf (__NR_SVR4 + 137)
159#define __NR_SVR4_adjtime (__NR_SVR4 + 138)
160#define __NR_SVR4_sysinfo (__NR_SVR4 + 139)
161#define __NR_SVR4_reserved8 (__NR_SVR4 + 140)
162#define __NR_SVR4_seteuid (__NR_SVR4 + 141)
163#define __NR_SVR4_PYRAMID_statis (__NR_SVR4 + 142)
164#define __NR_SVR4_PYRAMID_tuning (__NR_SVR4 + 143)
165#define __NR_SVR4_PYRAMID_forcerr (__NR_SVR4 + 144)
166#define __NR_SVR4_PYRAMID_mpcntl (__NR_SVR4 + 145)
167#define __NR_SVR4_reserved9 (__NR_SVR4 + 146)
168#define __NR_SVR4_reserved10 (__NR_SVR4 + 147)
169#define __NR_SVR4_reserved11 (__NR_SVR4 + 148)
170#define __NR_SVR4_reserved12 (__NR_SVR4 + 149)
171#define __NR_SVR4_reserved13 (__NR_SVR4 + 150)
172#define __NR_SVR4_reserved14 (__NR_SVR4 + 151)
173#define __NR_SVR4_reserved15 (__NR_SVR4 + 152)
174#define __NR_SVR4_reserved16 (__NR_SVR4 + 153)
175#define __NR_SVR4_reserved17 (__NR_SVR4 + 154)
176#define __NR_SVR4_reserved18 (__NR_SVR4 + 155)
177#define __NR_SVR4_reserved19 (__NR_SVR4 + 156)
178#define __NR_SVR4_reserved20 (__NR_SVR4 + 157)
179#define __NR_SVR4_reserved21 (__NR_SVR4 + 158)
180#define __NR_SVR4_reserved22 (__NR_SVR4 + 159)
181#define __NR_SVR4_reserved23 (__NR_SVR4 + 160)
182#define __NR_SVR4_reserved24 (__NR_SVR4 + 161)
183#define __NR_SVR4_reserved25 (__NR_SVR4 + 162)
184#define __NR_SVR4_reserved26 (__NR_SVR4 + 163)
185#define __NR_SVR4_reserved27 (__NR_SVR4 + 164)
186#define __NR_SVR4_reserved28 (__NR_SVR4 + 165)
187#define __NR_SVR4_reserved29 (__NR_SVR4 + 166)
188#define __NR_SVR4_reserved30 (__NR_SVR4 + 167)
189#define __NR_SVR4_reserved31 (__NR_SVR4 + 168)
190#define __NR_SVR4_reserved32 (__NR_SVR4 + 169)
191#define __NR_SVR4_reserved33 (__NR_SVR4 + 170)
192#define __NR_SVR4_reserved34 (__NR_SVR4 + 171)
193#define __NR_SVR4_reserved35 (__NR_SVR4 + 172)
194#define __NR_SVR4_reserved36 (__NR_SVR4 + 173)
195#define __NR_SVR4_reserved37 (__NR_SVR4 + 174)
196#define __NR_SVR4_reserved38 (__NR_SVR4 + 175)
197#define __NR_SVR4_reserved39 (__NR_SVR4 + 176)
198#define __NR_SVR4_reserved40 (__NR_SVR4 + 177)
199#define __NR_SVR4_reserved41 (__NR_SVR4 + 178)
200#define __NR_SVR4_reserved42 (__NR_SVR4 + 179)
201#define __NR_SVR4_reserved43 (__NR_SVR4 + 180)
202#define __NR_SVR4_reserved44 (__NR_SVR4 + 181)
203#define __NR_SVR4_reserved45 (__NR_SVR4 + 182)
204#define __NR_SVR4_reserved46 (__NR_SVR4 + 183)
205#define __NR_SVR4_reserved47 (__NR_SVR4 + 184)
206#define __NR_SVR4_reserved48 (__NR_SVR4 + 185)
207#define __NR_SVR4_reserved49 (__NR_SVR4 + 186)
208#define __NR_SVR4_reserved50 (__NR_SVR4 + 187)
209#define __NR_SVR4_reserved51 (__NR_SVR4 + 188)
210#define __NR_SVR4_reserved52 (__NR_SVR4 + 189)
211#define __NR_SVR4_reserved53 (__NR_SVR4 + 190)
212#define __NR_SVR4_reserved54 (__NR_SVR4 + 191)
213#define __NR_SVR4_reserved55 (__NR_SVR4 + 192)
214#define __NR_SVR4_reserved56 (__NR_SVR4 + 193)
215#define __NR_SVR4_reserved57 (__NR_SVR4 + 194)
216#define __NR_SVR4_reserved58 (__NR_SVR4 + 195)
217#define __NR_SVR4_reserved59 (__NR_SVR4 + 196)
218#define __NR_SVR4_reserved60 (__NR_SVR4 + 197)
219#define __NR_SVR4_reserved61 (__NR_SVR4 + 198)
220#define __NR_SVR4_reserved62 (__NR_SVR4 + 199)
221#define __NR_SVR4_reserved63 (__NR_SVR4 + 200)
222#define __NR_SVR4_aread (__NR_SVR4 + 201)
223#define __NR_SVR4_awrite (__NR_SVR4 + 202)
224#define __NR_SVR4_listio (__NR_SVR4 + 203)
225#define __NR_SVR4_mips_acancel (__NR_SVR4 + 204)
226#define __NR_SVR4_astatus (__NR_SVR4 + 205)
227#define __NR_SVR4_await (__NR_SVR4 + 206)
228#define __NR_SVR4_areadv (__NR_SVR4 + 207)
229#define __NR_SVR4_awritev (__NR_SVR4 + 208)
230#define __NR_SVR4_MIPS_reserved1 (__NR_SVR4 + 209)
231#define __NR_SVR4_MIPS_reserved2 (__NR_SVR4 + 210)
232#define __NR_SVR4_MIPS_reserved3 (__NR_SVR4 + 211)
233#define __NR_SVR4_MIPS_reserved4 (__NR_SVR4 + 212)
234#define __NR_SVR4_MIPS_reserved5 (__NR_SVR4 + 213)
235#define __NR_SVR4_MIPS_reserved6 (__NR_SVR4 + 214)
236#define __NR_SVR4_MIPS_reserved7 (__NR_SVR4 + 215)
237#define __NR_SVR4_MIPS_reserved8 (__NR_SVR4 + 216)
238#define __NR_SVR4_MIPS_reserved9 (__NR_SVR4 + 217)
239#define __NR_SVR4_MIPS_reserved10 (__NR_SVR4 + 218)
240#define __NR_SVR4_MIPS_reserved11 (__NR_SVR4 + 219)
241#define __NR_SVR4_MIPS_reserved12 (__NR_SVR4 + 220)
242#define __NR_SVR4_CDC_reserved1 (__NR_SVR4 + 221)
243#define __NR_SVR4_CDC_reserved2 (__NR_SVR4 + 222)
244#define __NR_SVR4_CDC_reserved3 (__NR_SVR4 + 223)
245#define __NR_SVR4_CDC_reserved4 (__NR_SVR4 + 224)
246#define __NR_SVR4_CDC_reserved5 (__NR_SVR4 + 225)
247#define __NR_SVR4_CDC_reserved6 (__NR_SVR4 + 226)
248#define __NR_SVR4_CDC_reserved7 (__NR_SVR4 + 227)
249#define __NR_SVR4_CDC_reserved8 (__NR_SVR4 + 228)
250#define __NR_SVR4_CDC_reserved9 (__NR_SVR4 + 229)
251#define __NR_SVR4_CDC_reserved10 (__NR_SVR4 + 230)
252#define __NR_SVR4_CDC_reserved11 (__NR_SVR4 + 231)
253#define __NR_SVR4_CDC_reserved12 (__NR_SVR4 + 232)
254#define __NR_SVR4_CDC_reserved13 (__NR_SVR4 + 233)
255#define __NR_SVR4_CDC_reserved14 (__NR_SVR4 + 234)
256#define __NR_SVR4_CDC_reserved15 (__NR_SVR4 + 235)
257#define __NR_SVR4_CDC_reserved16 (__NR_SVR4 + 236)
258#define __NR_SVR4_CDC_reserved17 (__NR_SVR4 + 237)
259#define __NR_SVR4_CDC_reserved18 (__NR_SVR4 + 238)
260#define __NR_SVR4_CDC_reserved19 (__NR_SVR4 + 239)
261#define __NR_SVR4_CDC_reserved20 (__NR_SVR4 + 240)
262
263/*
264 * SYS V syscalls are in the range from 1000 to 1999
265 */
266#define __NR_SYSV 1000
267#define __NR_SYSV_syscall (__NR_SYSV + 0)
268#define __NR_SYSV_exit (__NR_SYSV + 1)
269#define __NR_SYSV_fork (__NR_SYSV + 2)
270#define __NR_SYSV_read (__NR_SYSV + 3)
271#define __NR_SYSV_write (__NR_SYSV + 4)
272#define __NR_SYSV_open (__NR_SYSV + 5)
273#define __NR_SYSV_close (__NR_SYSV + 6)
274#define __NR_SYSV_wait (__NR_SYSV + 7)
275#define __NR_SYSV_creat (__NR_SYSV + 8)
276#define __NR_SYSV_link (__NR_SYSV + 9)
277#define __NR_SYSV_unlink (__NR_SYSV + 10)
278#define __NR_SYSV_execv (__NR_SYSV + 11)
279#define __NR_SYSV_chdir (__NR_SYSV + 12)
280#define __NR_SYSV_time (__NR_SYSV + 13)
281#define __NR_SYSV_mknod (__NR_SYSV + 14)
282#define __NR_SYSV_chmod (__NR_SYSV + 15)
283#define __NR_SYSV_chown (__NR_SYSV + 16)
284#define __NR_SYSV_brk (__NR_SYSV + 17)
285#define __NR_SYSV_stat (__NR_SYSV + 18)
286#define __NR_SYSV_lseek (__NR_SYSV + 19)
287#define __NR_SYSV_getpid (__NR_SYSV + 20)
288#define __NR_SYSV_mount (__NR_SYSV + 21)
289#define __NR_SYSV_umount (__NR_SYSV + 22)
290#define __NR_SYSV_setuid (__NR_SYSV + 23)
291#define __NR_SYSV_getuid (__NR_SYSV + 24)
292#define __NR_SYSV_stime (__NR_SYSV + 25)
293#define __NR_SYSV_ptrace (__NR_SYSV + 26)
294#define __NR_SYSV_alarm (__NR_SYSV + 27)
295#define __NR_SYSV_fstat (__NR_SYSV + 28)
296#define __NR_SYSV_pause (__NR_SYSV + 29)
297#define __NR_SYSV_utime (__NR_SYSV + 30)
298#define __NR_SYSV_stty (__NR_SYSV + 31)
299#define __NR_SYSV_gtty (__NR_SYSV + 32)
300#define __NR_SYSV_access (__NR_SYSV + 33)
301#define __NR_SYSV_nice (__NR_SYSV + 34)
302#define __NR_SYSV_statfs (__NR_SYSV + 35)
303#define __NR_SYSV_sync (__NR_SYSV + 36)
304#define __NR_SYSV_kill (__NR_SYSV + 37)
305#define __NR_SYSV_fstatfs (__NR_SYSV + 38)
306#define __NR_SYSV_setpgrp (__NR_SYSV + 39)
307#define __NR_SYSV_syssgi (__NR_SYSV + 40)
308#define __NR_SYSV_dup (__NR_SYSV + 41)
309#define __NR_SYSV_pipe (__NR_SYSV + 42)
310#define __NR_SYSV_times (__NR_SYSV + 43)
311#define __NR_SYSV_profil (__NR_SYSV + 44)
312#define __NR_SYSV_plock (__NR_SYSV + 45)
313#define __NR_SYSV_setgid (__NR_SYSV + 46)
314#define __NR_SYSV_getgid (__NR_SYSV + 47)
315#define __NR_SYSV_sig (__NR_SYSV + 48)
316#define __NR_SYSV_msgsys (__NR_SYSV + 49)
317#define __NR_SYSV_sysmips (__NR_SYSV + 50)
318#define __NR_SYSV_acct (__NR_SYSV + 51)
319#define __NR_SYSV_shmsys (__NR_SYSV + 52)
320#define __NR_SYSV_semsys (__NR_SYSV + 53)
321#define __NR_SYSV_ioctl (__NR_SYSV + 54)
322#define __NR_SYSV_uadmin (__NR_SYSV + 55)
323#define __NR_SYSV_sysmp (__NR_SYSV + 56)
324#define __NR_SYSV_utssys (__NR_SYSV + 57)
325#define __NR_SYSV_USG_reserved1 (__NR_SYSV + 58)
326#define __NR_SYSV_execve (__NR_SYSV + 59)
327#define __NR_SYSV_umask (__NR_SYSV + 60)
328#define __NR_SYSV_chroot (__NR_SYSV + 61)
329#define __NR_SYSV_fcntl (__NR_SYSV + 62)
330#define __NR_SYSV_ulimit (__NR_SYSV + 63)
331#define __NR_SYSV_SAFARI4_reserved1 (__NR_SYSV + 64)
332#define __NR_SYSV_SAFARI4_reserved2 (__NR_SYSV + 65)
333#define __NR_SYSV_SAFARI4_reserved3 (__NR_SYSV + 66)
334#define __NR_SYSV_SAFARI4_reserved4 (__NR_SYSV + 67)
335#define __NR_SYSV_SAFARI4_reserved5 (__NR_SYSV + 68)
336#define __NR_SYSV_SAFARI4_reserved6 (__NR_SYSV + 69)
337#define __NR_SYSV_advfs (__NR_SYSV + 70)
338#define __NR_SYSV_unadvfs (__NR_SYSV + 71)
339#define __NR_SYSV_rmount (__NR_SYSV + 72)
340#define __NR_SYSV_rumount (__NR_SYSV + 73)
341#define __NR_SYSV_rfstart (__NR_SYSV + 74)
342#define __NR_SYSV_getrlimit64 (__NR_SYSV + 75)
343#define __NR_SYSV_setrlimit64 (__NR_SYSV + 76)
344#define __NR_SYSV_nanosleep (__NR_SYSV + 77)
345#define __NR_SYSV_lseek64 (__NR_SYSV + 78)
346#define __NR_SYSV_rmdir (__NR_SYSV + 79)
347#define __NR_SYSV_mkdir (__NR_SYSV + 80)
348#define __NR_SYSV_getdents (__NR_SYSV + 81)
349#define __NR_SYSV_sginap (__NR_SYSV + 82)
350#define __NR_SYSV_sgikopt (__NR_SYSV + 83)
351#define __NR_SYSV_sysfs (__NR_SYSV + 84)
352#define __NR_SYSV_getmsg (__NR_SYSV + 85)
353#define __NR_SYSV_putmsg (__NR_SYSV + 86)
354#define __NR_SYSV_poll (__NR_SYSV + 87)
355#define __NR_SYSV_sigreturn (__NR_SYSV + 88)
356#define __NR_SYSV_accept (__NR_SYSV + 89)
357#define __NR_SYSV_bind (__NR_SYSV + 90)
358#define __NR_SYSV_connect (__NR_SYSV + 91)
359#define __NR_SYSV_gethostid (__NR_SYSV + 92)
360#define __NR_SYSV_getpeername (__NR_SYSV + 93)
361#define __NR_SYSV_getsockname (__NR_SYSV + 94)
362#define __NR_SYSV_getsockopt (__NR_SYSV + 95)
363#define __NR_SYSV_listen (__NR_SYSV + 96)
364#define __NR_SYSV_recv (__NR_SYSV + 97)
365#define __NR_SYSV_recvfrom (__NR_SYSV + 98)
366#define __NR_SYSV_recvmsg (__NR_SYSV + 99)
367#define __NR_SYSV_select (__NR_SYSV + 100)
368#define __NR_SYSV_send (__NR_SYSV + 101)
369#define __NR_SYSV_sendmsg (__NR_SYSV + 102)
370#define __NR_SYSV_sendto (__NR_SYSV + 103)
371#define __NR_SYSV_sethostid (__NR_SYSV + 104)
372#define __NR_SYSV_setsockopt (__NR_SYSV + 105)
373#define __NR_SYSV_shutdown (__NR_SYSV + 106)
374#define __NR_SYSV_socket (__NR_SYSV + 107)
375#define __NR_SYSV_gethostname (__NR_SYSV + 108)
376#define __NR_SYSV_sethostname (__NR_SYSV + 109)
377#define __NR_SYSV_getdomainname (__NR_SYSV + 110)
378#define __NR_SYSV_setdomainname (__NR_SYSV + 111)
379#define __NR_SYSV_truncate (__NR_SYSV + 112)
380#define __NR_SYSV_ftruncate (__NR_SYSV + 113)
381#define __NR_SYSV_rename (__NR_SYSV + 114)
382#define __NR_SYSV_symlink (__NR_SYSV + 115)
383#define __NR_SYSV_readlink (__NR_SYSV + 116)
384#define __NR_SYSV_lstat (__NR_SYSV + 117)
385#define __NR_SYSV_nfsmount (__NR_SYSV + 118)
386#define __NR_SYSV_nfssvc (__NR_SYSV + 119)
387#define __NR_SYSV_getfh (__NR_SYSV + 120)
388#define __NR_SYSV_async_daemon (__NR_SYSV + 121)
389#define __NR_SYSV_exportfs (__NR_SYSV + 122)
390#define __NR_SYSV_setregid (__NR_SYSV + 123)
391#define __NR_SYSV_setreuid (__NR_SYSV + 124)
392#define __NR_SYSV_getitimer (__NR_SYSV + 125)
393#define __NR_SYSV_setitimer (__NR_SYSV + 126)
394#define __NR_SYSV_adjtime (__NR_SYSV + 127)
395#define __NR_SYSV_BSD_getime (__NR_SYSV + 128)
396#define __NR_SYSV_sproc (__NR_SYSV + 129)
397#define __NR_SYSV_prctl (__NR_SYSV + 130)
398#define __NR_SYSV_procblk (__NR_SYSV + 131)
399#define __NR_SYSV_sprocsp (__NR_SYSV + 132)
400#define __NR_SYSV_sgigsc (__NR_SYSV + 133)
401#define __NR_SYSV_mmap (__NR_SYSV + 134)
402#define __NR_SYSV_munmap (__NR_SYSV + 135)
403#define __NR_SYSV_mprotect (__NR_SYSV + 136)
404#define __NR_SYSV_msync (__NR_SYSV + 137)
405#define __NR_SYSV_madvise (__NR_SYSV + 138)
406#define __NR_SYSV_pagelock (__NR_SYSV + 139)
407#define __NR_SYSV_getpagesize (__NR_SYSV + 140)
408#define __NR_SYSV_quotactl (__NR_SYSV + 141)
409#define __NR_SYSV_libdetach (__NR_SYSV + 142)
410#define __NR_SYSV_BSDgetpgrp (__NR_SYSV + 143)
411#define __NR_SYSV_BSDsetpgrp (__NR_SYSV + 144)
412#define __NR_SYSV_vhangup (__NR_SYSV + 145)
413#define __NR_SYSV_fsync (__NR_SYSV + 146)
414#define __NR_SYSV_fchdir (__NR_SYSV + 147)
415#define __NR_SYSV_getrlimit (__NR_SYSV + 148)
416#define __NR_SYSV_setrlimit (__NR_SYSV + 149)
417#define __NR_SYSV_cacheflush (__NR_SYSV + 150)
418#define __NR_SYSV_cachectl (__NR_SYSV + 151)
419#define __NR_SYSV_fchown (__NR_SYSV + 152)
420#define __NR_SYSV_fchmod (__NR_SYSV + 153)
421#define __NR_SYSV_wait3 (__NR_SYSV + 154)
422#define __NR_SYSV_socketpair (__NR_SYSV + 155)
423#define __NR_SYSV_sysinfo (__NR_SYSV + 156)
424#define __NR_SYSV_nuname (__NR_SYSV + 157)
425#define __NR_SYSV_xstat (__NR_SYSV + 158)
426#define __NR_SYSV_lxstat (__NR_SYSV + 159)
427#define __NR_SYSV_fxstat (__NR_SYSV + 160)
428#define __NR_SYSV_xmknod (__NR_SYSV + 161)
429#define __NR_SYSV_ksigaction (__NR_SYSV + 162)
430#define __NR_SYSV_sigpending (__NR_SYSV + 163)
431#define __NR_SYSV_sigprocmask (__NR_SYSV + 164)
432#define __NR_SYSV_sigsuspend (__NR_SYSV + 165)
433#define __NR_SYSV_sigpoll (__NR_SYSV + 166)
434#define __NR_SYSV_swapctl (__NR_SYSV + 167)
435#define __NR_SYSV_getcontext (__NR_SYSV + 168)
436#define __NR_SYSV_setcontext (__NR_SYSV + 169)
437#define __NR_SYSV_waitsys (__NR_SYSV + 170)
438#define __NR_SYSV_sigstack (__NR_SYSV + 171)
439#define __NR_SYSV_sigaltstack (__NR_SYSV + 172)
440#define __NR_SYSV_sigsendset (__NR_SYSV + 173)
441#define __NR_SYSV_statvfs (__NR_SYSV + 174)
442#define __NR_SYSV_fstatvfs (__NR_SYSV + 175)
443#define __NR_SYSV_getpmsg (__NR_SYSV + 176)
444#define __NR_SYSV_putpmsg (__NR_SYSV + 177)
445#define __NR_SYSV_lchown (__NR_SYSV + 178)
446#define __NR_SYSV_priocntl (__NR_SYSV + 179)
447#define __NR_SYSV_ksigqueue (__NR_SYSV + 180)
448#define __NR_SYSV_readv (__NR_SYSV + 181)
449#define __NR_SYSV_writev (__NR_SYSV + 182)
450#define __NR_SYSV_truncate64 (__NR_SYSV + 183)
451#define __NR_SYSV_ftruncate64 (__NR_SYSV + 184)
452#define __NR_SYSV_mmap64 (__NR_SYSV + 185)
453#define __NR_SYSV_dmi (__NR_SYSV + 186)
454#define __NR_SYSV_pread (__NR_SYSV + 187)
455#define __NR_SYSV_pwrite (__NR_SYSV + 188)
456
457/*
458 * BSD 4.3 syscalls are in the range from 2000 to 2999
459 */
460#define __NR_BSD43 2000
461#define __NR_BSD43_syscall (__NR_BSD43 + 0)
462#define __NR_BSD43_exit (__NR_BSD43 + 1)
463#define __NR_BSD43_fork (__NR_BSD43 + 2)
464#define __NR_BSD43_read (__NR_BSD43 + 3)
465#define __NR_BSD43_write (__NR_BSD43 + 4)
466#define __NR_BSD43_open (__NR_BSD43 + 5)
467#define __NR_BSD43_close (__NR_BSD43 + 6)
468#define __NR_BSD43_wait (__NR_BSD43 + 7)
469#define __NR_BSD43_creat (__NR_BSD43 + 8)
470#define __NR_BSD43_link (__NR_BSD43 + 9)
471#define __NR_BSD43_unlink (__NR_BSD43 + 10)
472#define __NR_BSD43_exec (__NR_BSD43 + 11)
473#define __NR_BSD43_chdir (__NR_BSD43 + 12)
474#define __NR_BSD43_time (__NR_BSD43 + 13)
475#define __NR_BSD43_mknod (__NR_BSD43 + 14)
476#define __NR_BSD43_chmod (__NR_BSD43 + 15)
477#define __NR_BSD43_chown (__NR_BSD43 + 16)
478#define __NR_BSD43_sbreak (__NR_BSD43 + 17)
479#define __NR_BSD43_oldstat (__NR_BSD43 + 18)
480#define __NR_BSD43_lseek (__NR_BSD43 + 19)
481#define __NR_BSD43_getpid (__NR_BSD43 + 20)
482#define __NR_BSD43_oldmount (__NR_BSD43 + 21)
483#define __NR_BSD43_umount (__NR_BSD43 + 22)
484#define __NR_BSD43_setuid (__NR_BSD43 + 23)
485#define __NR_BSD43_getuid (__NR_BSD43 + 24)
486#define __NR_BSD43_stime (__NR_BSD43 + 25)
487#define __NR_BSD43_ptrace (__NR_BSD43 + 26)
488#define __NR_BSD43_alarm (__NR_BSD43 + 27)
489#define __NR_BSD43_oldfstat (__NR_BSD43 + 28)
490#define __NR_BSD43_pause (__NR_BSD43 + 29)
491#define __NR_BSD43_utime (__NR_BSD43 + 30)
492#define __NR_BSD43_stty (__NR_BSD43 + 31)
493#define __NR_BSD43_gtty (__NR_BSD43 + 32)
494#define __NR_BSD43_access (__NR_BSD43 + 33)
495#define __NR_BSD43_nice (__NR_BSD43 + 34)
496#define __NR_BSD43_ftime (__NR_BSD43 + 35)
497#define __NR_BSD43_sync (__NR_BSD43 + 36)
498#define __NR_BSD43_kill (__NR_BSD43 + 37)
499#define __NR_BSD43_stat (__NR_BSD43 + 38)
500#define __NR_BSD43_oldsetpgrp (__NR_BSD43 + 39)
501#define __NR_BSD43_lstat (__NR_BSD43 + 40)
502#define __NR_BSD43_dup (__NR_BSD43 + 41)
503#define __NR_BSD43_pipe (__NR_BSD43 + 42)
504#define __NR_BSD43_times (__NR_BSD43 + 43)
505#define __NR_BSD43_profil (__NR_BSD43 + 44)
506#define __NR_BSD43_msgsys (__NR_BSD43 + 45)
507#define __NR_BSD43_setgid (__NR_BSD43 + 46)
508#define __NR_BSD43_getgid (__NR_BSD43 + 47)
509#define __NR_BSD43_ssig (__NR_BSD43 + 48)
510#define __NR_BSD43_reserved1 (__NR_BSD43 + 49)
511#define __NR_BSD43_reserved2 (__NR_BSD43 + 50)
512#define __NR_BSD43_sysacct (__NR_BSD43 + 51)
513#define __NR_BSD43_phys (__NR_BSD43 + 52)
514#define __NR_BSD43_lock (__NR_BSD43 + 53)
515#define __NR_BSD43_ioctl (__NR_BSD43 + 54)
516#define __NR_BSD43_reboot (__NR_BSD43 + 55)
517#define __NR_BSD43_mpxchan (__NR_BSD43 + 56)
518#define __NR_BSD43_symlink (__NR_BSD43 + 57)
519#define __NR_BSD43_readlink (__NR_BSD43 + 58)
520#define __NR_BSD43_execve (__NR_BSD43 + 59)
521#define __NR_BSD43_umask (__NR_BSD43 + 60)
522#define __NR_BSD43_chroot (__NR_BSD43 + 61)
523#define __NR_BSD43_fstat (__NR_BSD43 + 62)
524#define __NR_BSD43_reserved3 (__NR_BSD43 + 63)
525#define __NR_BSD43_getpagesize (__NR_BSD43 + 64)
526#define __NR_BSD43_mremap (__NR_BSD43 + 65)
527#define __NR_BSD43_vfork (__NR_BSD43 + 66)
528#define __NR_BSD43_vread (__NR_BSD43 + 67)
529#define __NR_BSD43_vwrite (__NR_BSD43 + 68)
530#define __NR_BSD43_sbrk (__NR_BSD43 + 69)
531#define __NR_BSD43_sstk (__NR_BSD43 + 70)
532#define __NR_BSD43_mmap (__NR_BSD43 + 71)
533#define __NR_BSD43_vadvise (__NR_BSD43 + 72)
534#define __NR_BSD43_munmap (__NR_BSD43 + 73)
535#define __NR_BSD43_mprotect (__NR_BSD43 + 74)
536#define __NR_BSD43_madvise (__NR_BSD43 + 75)
537#define __NR_BSD43_vhangup (__NR_BSD43 + 76)
538#define __NR_BSD43_vlimit (__NR_BSD43 + 77)
539#define __NR_BSD43_mincore (__NR_BSD43 + 78)
540#define __NR_BSD43_getgroups (__NR_BSD43 + 79)
541#define __NR_BSD43_setgroups (__NR_BSD43 + 80)
542#define __NR_BSD43_getpgrp (__NR_BSD43 + 81)
543#define __NR_BSD43_setpgrp (__NR_BSD43 + 82)
544#define __NR_BSD43_setitimer (__NR_BSD43 + 83)
545#define __NR_BSD43_wait3 (__NR_BSD43 + 84)
546#define __NR_BSD43_swapon (__NR_BSD43 + 85)
547#define __NR_BSD43_getitimer (__NR_BSD43 + 86)
548#define __NR_BSD43_gethostname (__NR_BSD43 + 87)
549#define __NR_BSD43_sethostname (__NR_BSD43 + 88)
550#define __NR_BSD43_getdtablesize (__NR_BSD43 + 89)
551#define __NR_BSD43_dup2 (__NR_BSD43 + 90)
552#define __NR_BSD43_getdopt (__NR_BSD43 + 91)
553#define __NR_BSD43_fcntl (__NR_BSD43 + 92)
554#define __NR_BSD43_select (__NR_BSD43 + 93)
555#define __NR_BSD43_setdopt (__NR_BSD43 + 94)
556#define __NR_BSD43_fsync (__NR_BSD43 + 95)
557#define __NR_BSD43_setpriority (__NR_BSD43 + 96)
558#define __NR_BSD43_socket (__NR_BSD43 + 97)
559#define __NR_BSD43_connect (__NR_BSD43 + 98)
560#define __NR_BSD43_oldaccept (__NR_BSD43 + 99)
561#define __NR_BSD43_getpriority (__NR_BSD43 + 100)
562#define __NR_BSD43_send (__NR_BSD43 + 101)
563#define __NR_BSD43_recv (__NR_BSD43 + 102)
564#define __NR_BSD43_sigreturn (__NR_BSD43 + 103)
565#define __NR_BSD43_bind (__NR_BSD43 + 104)
566#define __NR_BSD43_setsockopt (__NR_BSD43 + 105)
567#define __NR_BSD43_listen (__NR_BSD43 + 106)
568#define __NR_BSD43_vtimes (__NR_BSD43 + 107)
569#define __NR_BSD43_sigvec (__NR_BSD43 + 108)
570#define __NR_BSD43_sigblock (__NR_BSD43 + 109)
571#define __NR_BSD43_sigsetmask (__NR_BSD43 + 110)
572#define __NR_BSD43_sigpause (__NR_BSD43 + 111)
573#define __NR_BSD43_sigstack (__NR_BSD43 + 112)
574#define __NR_BSD43_oldrecvmsg (__NR_BSD43 + 113)
575#define __NR_BSD43_oldsendmsg (__NR_BSD43 + 114)
576#define __NR_BSD43_vtrace (__NR_BSD43 + 115)
577#define __NR_BSD43_gettimeofday (__NR_BSD43 + 116)
578#define __NR_BSD43_getrusage (__NR_BSD43 + 117)
579#define __NR_BSD43_getsockopt (__NR_BSD43 + 118)
580#define __NR_BSD43_reserved4 (__NR_BSD43 + 119)
581#define __NR_BSD43_readv (__NR_BSD43 + 120)
582#define __NR_BSD43_writev (__NR_BSD43 + 121)
583#define __NR_BSD43_settimeofday (__NR_BSD43 + 122)
584#define __NR_BSD43_fchown (__NR_BSD43 + 123)
585#define __NR_BSD43_fchmod (__NR_BSD43 + 124)
586#define __NR_BSD43_oldrecvfrom (__NR_BSD43 + 125)
587#define __NR_BSD43_setreuid (__NR_BSD43 + 126)
588#define __NR_BSD43_setregid (__NR_BSD43 + 127)
589#define __NR_BSD43_rename (__NR_BSD43 + 128)
590#define __NR_BSD43_truncate (__NR_BSD43 + 129)
591#define __NR_BSD43_ftruncate (__NR_BSD43 + 130)
592#define __NR_BSD43_flock (__NR_BSD43 + 131)
593#define __NR_BSD43_semsys (__NR_BSD43 + 132)
594#define __NR_BSD43_sendto (__NR_BSD43 + 133)
595#define __NR_BSD43_shutdown (__NR_BSD43 + 134)
596#define __NR_BSD43_socketpair (__NR_BSD43 + 135)
597#define __NR_BSD43_mkdir (__NR_BSD43 + 136)
598#define __NR_BSD43_rmdir (__NR_BSD43 + 137)
599#define __NR_BSD43_utimes (__NR_BSD43 + 138)
600#define __NR_BSD43_sigcleanup (__NR_BSD43 + 139)
601#define __NR_BSD43_adjtime (__NR_BSD43 + 140)
602#define __NR_BSD43_oldgetpeername (__NR_BSD43 + 141)
603#define __NR_BSD43_gethostid (__NR_BSD43 + 142)
604#define __NR_BSD43_sethostid (__NR_BSD43 + 143)
605#define __NR_BSD43_getrlimit (__NR_BSD43 + 144)
606#define __NR_BSD43_setrlimit (__NR_BSD43 + 145)
607#define __NR_BSD43_killpg (__NR_BSD43 + 146)
608#define __NR_BSD43_shmsys (__NR_BSD43 + 147)
609#define __NR_BSD43_quota (__NR_BSD43 + 148)
610#define __NR_BSD43_qquota (__NR_BSD43 + 149)
611#define __NR_BSD43_oldgetsockname (__NR_BSD43 + 150)
612#define __NR_BSD43_sysmips (__NR_BSD43 + 151)
613#define __NR_BSD43_cacheflush (__NR_BSD43 + 152)
614#define __NR_BSD43_cachectl (__NR_BSD43 + 153)
615#define __NR_BSD43_debug (__NR_BSD43 + 154)
616#define __NR_BSD43_reserved5 (__NR_BSD43 + 155)
617#define __NR_BSD43_reserved6 (__NR_BSD43 + 156)
618#define __NR_BSD43_nfs_mount (__NR_BSD43 + 157)
619#define __NR_BSD43_nfs_svc (__NR_BSD43 + 158)
620#define __NR_BSD43_getdirentries (__NR_BSD43 + 159)
621#define __NR_BSD43_statfs (__NR_BSD43 + 160)
622#define __NR_BSD43_fstatfs (__NR_BSD43 + 161)
623#define __NR_BSD43_unmount (__NR_BSD43 + 162)
624#define __NR_BSD43_async_daemon (__NR_BSD43 + 163)
625#define __NR_BSD43_nfs_getfh (__NR_BSD43 + 164)
626#define __NR_BSD43_getdomainname (__NR_BSD43 + 165)
627#define __NR_BSD43_setdomainname (__NR_BSD43 + 166)
628#define __NR_BSD43_pcfs_mount (__NR_BSD43 + 167)
629#define __NR_BSD43_quotactl (__NR_BSD43 + 168)
630#define __NR_BSD43_oldexportfs (__NR_BSD43 + 169)
631#define __NR_BSD43_smount (__NR_BSD43 + 170)
632#define __NR_BSD43_mipshwconf (__NR_BSD43 + 171)
633#define __NR_BSD43_exportfs (__NR_BSD43 + 172)
634#define __NR_BSD43_nfsfh_open (__NR_BSD43 + 173)
635#define __NR_BSD43_libattach (__NR_BSD43 + 174)
636#define __NR_BSD43_libdetach (__NR_BSD43 + 175)
637#define __NR_BSD43_accept (__NR_BSD43 + 176)
638#define __NR_BSD43_reserved7 (__NR_BSD43 + 177)
639#define __NR_BSD43_reserved8 (__NR_BSD43 + 178)
640#define __NR_BSD43_recvmsg (__NR_BSD43 + 179)
641#define __NR_BSD43_recvfrom (__NR_BSD43 + 180)
642#define __NR_BSD43_sendmsg (__NR_BSD43 + 181)
643#define __NR_BSD43_getpeername (__NR_BSD43 + 182)
644#define __NR_BSD43_getsockname (__NR_BSD43 + 183)
645#define __NR_BSD43_aread (__NR_BSD43 + 184)
646#define __NR_BSD43_awrite (__NR_BSD43 + 185)
647#define __NR_BSD43_listio (__NR_BSD43 + 186)
648#define __NR_BSD43_acancel (__NR_BSD43 + 187)
649#define __NR_BSD43_astatus (__NR_BSD43 + 188)
650#define __NR_BSD43_await (__NR_BSD43 + 189)
651#define __NR_BSD43_areadv (__NR_BSD43 + 190)
652#define __NR_BSD43_awritev (__NR_BSD43 + 191)
653
654/*
655 * POSIX syscalls are in the range from 3000 to 3999
656 */
657#define __NR_POSIX 3000
658#define __NR_POSIX_syscall (__NR_POSIX + 0)
659#define __NR_POSIX_exit (__NR_POSIX + 1)
660#define __NR_POSIX_fork (__NR_POSIX + 2)
661#define __NR_POSIX_read (__NR_POSIX + 3)
662#define __NR_POSIX_write (__NR_POSIX + 4)
663#define __NR_POSIX_open (__NR_POSIX + 5)
664#define __NR_POSIX_close (__NR_POSIX + 6)
665#define __NR_POSIX_wait (__NR_POSIX + 7)
666#define __NR_POSIX_creat (__NR_POSIX + 8)
667#define __NR_POSIX_link (__NR_POSIX + 9)
668#define __NR_POSIX_unlink (__NR_POSIX + 10)
669#define __NR_POSIX_exec (__NR_POSIX + 11)
670#define __NR_POSIX_chdir (__NR_POSIX + 12)
671#define __NR_POSIX_gtime (__NR_POSIX + 13)
672#define __NR_POSIX_mknod (__NR_POSIX + 14)
673#define __NR_POSIX_chmod (__NR_POSIX + 15)
674#define __NR_POSIX_chown (__NR_POSIX + 16)
675#define __NR_POSIX_sbreak (__NR_POSIX + 17)
676#define __NR_POSIX_stat (__NR_POSIX + 18)
677#define __NR_POSIX_lseek (__NR_POSIX + 19)
678#define __NR_POSIX_getpid (__NR_POSIX + 20)
679#define __NR_POSIX_mount (__NR_POSIX + 21)
680#define __NR_POSIX_umount (__NR_POSIX + 22)
681#define __NR_POSIX_setuid (__NR_POSIX + 23)
682#define __NR_POSIX_getuid (__NR_POSIX + 24)
683#define __NR_POSIX_stime (__NR_POSIX + 25)
684#define __NR_POSIX_ptrace (__NR_POSIX + 26)
685#define __NR_POSIX_alarm (__NR_POSIX + 27)
686#define __NR_POSIX_fstat (__NR_POSIX + 28)
687#define __NR_POSIX_pause (__NR_POSIX + 29)
688#define __NR_POSIX_utime (__NR_POSIX + 30)
689#define __NR_POSIX_stty (__NR_POSIX + 31)
690#define __NR_POSIX_gtty (__NR_POSIX + 32)
691#define __NR_POSIX_access (__NR_POSIX + 33)
692#define __NR_POSIX_nice (__NR_POSIX + 34)
693#define __NR_POSIX_statfs (__NR_POSIX + 35)
694#define __NR_POSIX_sync (__NR_POSIX + 36)
695#define __NR_POSIX_kill (__NR_POSIX + 37)
696#define __NR_POSIX_fstatfs (__NR_POSIX + 38)
697#define __NR_POSIX_getpgrp (__NR_POSIX + 39)
698#define __NR_POSIX_syssgi (__NR_POSIX + 40)
699#define __NR_POSIX_dup (__NR_POSIX + 41)
700#define __NR_POSIX_pipe (__NR_POSIX + 42)
701#define __NR_POSIX_times (__NR_POSIX + 43)
702#define __NR_POSIX_profil (__NR_POSIX + 44)
703#define __NR_POSIX_lock (__NR_POSIX + 45)
704#define __NR_POSIX_setgid (__NR_POSIX + 46)
705#define __NR_POSIX_getgid (__NR_POSIX + 47)
706#define __NR_POSIX_sig (__NR_POSIX + 48)
707#define __NR_POSIX_msgsys (__NR_POSIX + 49)
708#define __NR_POSIX_sysmips (__NR_POSIX + 50)
709#define __NR_POSIX_sysacct (__NR_POSIX + 51)
710#define __NR_POSIX_shmsys (__NR_POSIX + 52)
711#define __NR_POSIX_semsys (__NR_POSIX + 53)
712#define __NR_POSIX_ioctl (__NR_POSIX + 54)
713#define __NR_POSIX_uadmin (__NR_POSIX + 55)
714#define __NR_POSIX_exch (__NR_POSIX + 56)
715#define __NR_POSIX_utssys (__NR_POSIX + 57)
716#define __NR_POSIX_USG_reserved1 (__NR_POSIX + 58)
717#define __NR_POSIX_exece (__NR_POSIX + 59)
718#define __NR_POSIX_umask (__NR_POSIX + 60)
719#define __NR_POSIX_chroot (__NR_POSIX + 61)
720#define __NR_POSIX_fcntl (__NR_POSIX + 62)
721#define __NR_POSIX_ulimit (__NR_POSIX + 63)
722#define __NR_POSIX_SAFARI4_reserved1 (__NR_POSIX + 64)
723#define __NR_POSIX_SAFARI4_reserved2 (__NR_POSIX + 65)
724#define __NR_POSIX_SAFARI4_reserved3 (__NR_POSIX + 66)
725#define __NR_POSIX_SAFARI4_reserved4 (__NR_POSIX + 67)
726#define __NR_POSIX_SAFARI4_reserved5 (__NR_POSIX + 68)
727#define __NR_POSIX_SAFARI4_reserved6 (__NR_POSIX + 69)
728#define __NR_POSIX_advfs (__NR_POSIX + 70)
729#define __NR_POSIX_unadvfs (__NR_POSIX + 71)
730#define __NR_POSIX_rmount (__NR_POSIX + 72)
731#define __NR_POSIX_rumount (__NR_POSIX + 73)
732#define __NR_POSIX_rfstart (__NR_POSIX + 74)
733#define __NR_POSIX_reserved1 (__NR_POSIX + 75)
734#define __NR_POSIX_rdebug (__NR_POSIX + 76)
735#define __NR_POSIX_rfstop (__NR_POSIX + 77)
736#define __NR_POSIX_rfsys (__NR_POSIX + 78)
737#define __NR_POSIX_rmdir (__NR_POSIX + 79)
738#define __NR_POSIX_mkdir (__NR_POSIX + 80)
739#define __NR_POSIX_getdents (__NR_POSIX + 81)
740#define __NR_POSIX_sginap (__NR_POSIX + 82)
741#define __NR_POSIX_sgikopt (__NR_POSIX + 83)
742#define __NR_POSIX_sysfs (__NR_POSIX + 84)
743#define __NR_POSIX_getmsg (__NR_POSIX + 85)
744#define __NR_POSIX_putmsg (__NR_POSIX + 86)
745#define __NR_POSIX_poll (__NR_POSIX + 87)
746#define __NR_POSIX_sigreturn (__NR_POSIX + 88)
747#define __NR_POSIX_accept (__NR_POSIX + 89)
748#define __NR_POSIX_bind (__NR_POSIX + 90)
749#define __NR_POSIX_connect (__NR_POSIX + 91)
750#define __NR_POSIX_gethostid (__NR_POSIX + 92)
751#define __NR_POSIX_getpeername (__NR_POSIX + 93)
752#define __NR_POSIX_getsockname (__NR_POSIX + 94)
753#define __NR_POSIX_getsockopt (__NR_POSIX + 95)
754#define __NR_POSIX_listen (__NR_POSIX + 96)
755#define __NR_POSIX_recv (__NR_POSIX + 97)
756#define __NR_POSIX_recvfrom (__NR_POSIX + 98)
757#define __NR_POSIX_recvmsg (__NR_POSIX + 99)
758#define __NR_POSIX_select (__NR_POSIX + 100)
759#define __NR_POSIX_send (__NR_POSIX + 101)
760#define __NR_POSIX_sendmsg (__NR_POSIX + 102)
761#define __NR_POSIX_sendto (__NR_POSIX + 103)
762#define __NR_POSIX_sethostid (__NR_POSIX + 104)
763#define __NR_POSIX_setsockopt (__NR_POSIX + 105)
764#define __NR_POSIX_shutdown (__NR_POSIX + 106)
765#define __NR_POSIX_socket (__NR_POSIX + 107)
766#define __NR_POSIX_gethostname (__NR_POSIX + 108)
767#define __NR_POSIX_sethostname (__NR_POSIX + 109)
768#define __NR_POSIX_getdomainname (__NR_POSIX + 110)
769#define __NR_POSIX_setdomainname (__NR_POSIX + 111)
770#define __NR_POSIX_truncate (__NR_POSIX + 112)
771#define __NR_POSIX_ftruncate (__NR_POSIX + 113)
772#define __NR_POSIX_rename (__NR_POSIX + 114)
773#define __NR_POSIX_symlink (__NR_POSIX + 115)
774#define __NR_POSIX_readlink (__NR_POSIX + 116)
775#define __NR_POSIX_lstat (__NR_POSIX + 117)
776#define __NR_POSIX_nfs_mount (__NR_POSIX + 118)
777#define __NR_POSIX_nfs_svc (__NR_POSIX + 119)
778#define __NR_POSIX_nfs_getfh (__NR_POSIX + 120)
779#define __NR_POSIX_async_daemon (__NR_POSIX + 121)
780#define __NR_POSIX_exportfs (__NR_POSIX + 122)
781#define __NR_POSIX_SGI_setregid (__NR_POSIX + 123)
782#define __NR_POSIX_SGI_setreuid (__NR_POSIX + 124)
783#define __NR_POSIX_getitimer (__NR_POSIX + 125)
784#define __NR_POSIX_setitimer (__NR_POSIX + 126)
785#define __NR_POSIX_adjtime (__NR_POSIX + 127)
786#define __NR_POSIX_SGI_bsdgettime (__NR_POSIX + 128)
787#define __NR_POSIX_SGI_sproc (__NR_POSIX + 129)
788#define __NR_POSIX_SGI_prctl (__NR_POSIX + 130)
789#define __NR_POSIX_SGI_blkproc (__NR_POSIX + 131)
790#define __NR_POSIX_SGI_reserved1 (__NR_POSIX + 132)
791#define __NR_POSIX_SGI_sgigsc (__NR_POSIX + 133)
792#define __NR_POSIX_SGI_mmap (__NR_POSIX + 134)
793#define __NR_POSIX_SGI_munmap (__NR_POSIX + 135)
794#define __NR_POSIX_SGI_mprotect (__NR_POSIX + 136)
795#define __NR_POSIX_SGI_msync (__NR_POSIX + 137)
796#define __NR_POSIX_SGI_madvise (__NR_POSIX + 138)
797#define __NR_POSIX_SGI_mpin (__NR_POSIX + 139)
798#define __NR_POSIX_SGI_getpagesize (__NR_POSIX + 140)
799#define __NR_POSIX_SGI_libattach (__NR_POSIX + 141)
800#define __NR_POSIX_SGI_libdetach (__NR_POSIX + 142)
801#define __NR_POSIX_SGI_getpgrp (__NR_POSIX + 143)
802#define __NR_POSIX_SGI_setpgrp (__NR_POSIX + 144)
803#define __NR_POSIX_SGI_reserved2 (__NR_POSIX + 145)
804#define __NR_POSIX_SGI_reserved3 (__NR_POSIX + 146)
805#define __NR_POSIX_SGI_reserved4 (__NR_POSIX + 147)
806#define __NR_POSIX_SGI_reserved5 (__NR_POSIX + 148)
807#define __NR_POSIX_SGI_reserved6 (__NR_POSIX + 149)
808#define __NR_POSIX_cacheflush (__NR_POSIX + 150)
809#define __NR_POSIX_cachectl (__NR_POSIX + 151)
810#define __NR_POSIX_fchown (__NR_POSIX + 152)
811#define __NR_POSIX_fchmod (__NR_POSIX + 153)
812#define __NR_POSIX_wait3 (__NR_POSIX + 154)
813#define __NR_POSIX_mmap (__NR_POSIX + 155)
814#define __NR_POSIX_munmap (__NR_POSIX + 156)
815#define __NR_POSIX_madvise (__NR_POSIX + 157)
816#define __NR_POSIX_BSD_getpagesize (__NR_POSIX + 158)
817#define __NR_POSIX_setreuid (__NR_POSIX + 159)
818#define __NR_POSIX_setregid (__NR_POSIX + 160)
819#define __NR_POSIX_setpgid (__NR_POSIX + 161)
820#define __NR_POSIX_getgroups (__NR_POSIX + 162)
821#define __NR_POSIX_setgroups (__NR_POSIX + 163)
822#define __NR_POSIX_gettimeofday (__NR_POSIX + 164)
823#define __NR_POSIX_getrusage (__NR_POSIX + 165)
824#define __NR_POSIX_getrlimit (__NR_POSIX + 166)
825#define __NR_POSIX_setrlimit (__NR_POSIX + 167)
826#define __NR_POSIX_waitpid (__NR_POSIX + 168)
827#define __NR_POSIX_dup2 (__NR_POSIX + 169)
828#define __NR_POSIX_reserved2 (__NR_POSIX + 170)
829#define __NR_POSIX_reserved3 (__NR_POSIX + 171)
830#define __NR_POSIX_reserved4 (__NR_POSIX + 172)
831#define __NR_POSIX_reserved5 (__NR_POSIX + 173)
832#define __NR_POSIX_reserved6 (__NR_POSIX + 174)
833#define __NR_POSIX_reserved7 (__NR_POSIX + 175)
834#define __NR_POSIX_reserved8 (__NR_POSIX + 176)
835#define __NR_POSIX_reserved9 (__NR_POSIX + 177)
836#define __NR_POSIX_reserved10 (__NR_POSIX + 178)
837#define __NR_POSIX_reserved11 (__NR_POSIX + 179)
838#define __NR_POSIX_reserved12 (__NR_POSIX + 180)
839#define __NR_POSIX_reserved13 (__NR_POSIX + 181)
840#define __NR_POSIX_reserved14 (__NR_POSIX + 182)
841#define __NR_POSIX_reserved15 (__NR_POSIX + 183)
842#define __NR_POSIX_reserved16 (__NR_POSIX + 184)
843#define __NR_POSIX_reserved17 (__NR_POSIX + 185)
844#define __NR_POSIX_reserved18 (__NR_POSIX + 186)
845#define __NR_POSIX_reserved19 (__NR_POSIX + 187)
846#define __NR_POSIX_reserved20 (__NR_POSIX + 188)
847#define __NR_POSIX_reserved21 (__NR_POSIX + 189)
848#define __NR_POSIX_reserved22 (__NR_POSIX + 190)
849#define __NR_POSIX_reserved23 (__NR_POSIX + 191)
850#define __NR_POSIX_reserved24 (__NR_POSIX + 192)
851#define __NR_POSIX_reserved25 (__NR_POSIX + 193)
852#define __NR_POSIX_reserved26 (__NR_POSIX + 194)
853#define __NR_POSIX_reserved27 (__NR_POSIX + 195)
854#define __NR_POSIX_reserved28 (__NR_POSIX + 196)
855#define __NR_POSIX_reserved29 (__NR_POSIX + 197)
856#define __NR_POSIX_reserved30 (__NR_POSIX + 198)
857#define __NR_POSIX_reserved31 (__NR_POSIX + 199)
858#define __NR_POSIX_reserved32 (__NR_POSIX + 200)
859#define __NR_POSIX_reserved33 (__NR_POSIX + 201)
860#define __NR_POSIX_reserved34 (__NR_POSIX + 202)
861#define __NR_POSIX_reserved35 (__NR_POSIX + 203)
862#define __NR_POSIX_reserved36 (__NR_POSIX + 204)
863#define __NR_POSIX_reserved37 (__NR_POSIX + 205)
864#define __NR_POSIX_reserved38 (__NR_POSIX + 206)
865#define __NR_POSIX_reserved39 (__NR_POSIX + 207)
866#define __NR_POSIX_reserved40 (__NR_POSIX + 208)
867#define __NR_POSIX_reserved41 (__NR_POSIX + 209)
868#define __NR_POSIX_reserved42 (__NR_POSIX + 210)
869#define __NR_POSIX_reserved43 (__NR_POSIX + 211)
870#define __NR_POSIX_reserved44 (__NR_POSIX + 212)
871#define __NR_POSIX_reserved45 (__NR_POSIX + 213)
872#define __NR_POSIX_reserved46 (__NR_POSIX + 214)
873#define __NR_POSIX_reserved47 (__NR_POSIX + 215)
874#define __NR_POSIX_reserved48 (__NR_POSIX + 216)
875#define __NR_POSIX_reserved49 (__NR_POSIX + 217)
876#define __NR_POSIX_reserved50 (__NR_POSIX + 218)
877#define __NR_POSIX_reserved51 (__NR_POSIX + 219)
878#define __NR_POSIX_reserved52 (__NR_POSIX + 220)
879#define __NR_POSIX_reserved53 (__NR_POSIX + 221)
880#define __NR_POSIX_reserved54 (__NR_POSIX + 222)
881#define __NR_POSIX_reserved55 (__NR_POSIX + 223)
882#define __NR_POSIX_reserved56 (__NR_POSIX + 224)
883#define __NR_POSIX_reserved57 (__NR_POSIX + 225)
884#define __NR_POSIX_reserved58 (__NR_POSIX + 226)
885#define __NR_POSIX_reserved59 (__NR_POSIX + 227)
886#define __NR_POSIX_reserved60 (__NR_POSIX + 228)
887#define __NR_POSIX_reserved61 (__NR_POSIX + 229)
888#define __NR_POSIX_reserved62 (__NR_POSIX + 230)
889#define __NR_POSIX_reserved63 (__NR_POSIX + 231)
890#define __NR_POSIX_reserved64 (__NR_POSIX + 232)
891#define __NR_POSIX_reserved65 (__NR_POSIX + 233)
892#define __NR_POSIX_reserved66 (__NR_POSIX + 234)
893#define __NR_POSIX_reserved67 (__NR_POSIX + 235)
894#define __NR_POSIX_reserved68 (__NR_POSIX + 236)
895#define __NR_POSIX_reserved69 (__NR_POSIX + 237)
896#define __NR_POSIX_reserved70 (__NR_POSIX + 238)
897#define __NR_POSIX_reserved71 (__NR_POSIX + 239)
898#define __NR_POSIX_reserved72 (__NR_POSIX + 240)
899#define __NR_POSIX_reserved73 (__NR_POSIX + 241)
900#define __NR_POSIX_reserved74 (__NR_POSIX + 242)
901#define __NR_POSIX_reserved75 (__NR_POSIX + 243)
902#define __NR_POSIX_reserved76 (__NR_POSIX + 244)
903#define __NR_POSIX_reserved77 (__NR_POSIX + 245)
904#define __NR_POSIX_reserved78 (__NR_POSIX + 246)
905#define __NR_POSIX_reserved79 (__NR_POSIX + 247)
906#define __NR_POSIX_reserved80 (__NR_POSIX + 248)
907#define __NR_POSIX_reserved81 (__NR_POSIX + 249)
908#define __NR_POSIX_reserved82 (__NR_POSIX + 250)
909#define __NR_POSIX_reserved83 (__NR_POSIX + 251)
910#define __NR_POSIX_reserved84 (__NR_POSIX + 252)
911#define __NR_POSIX_reserved85 (__NR_POSIX + 253)
912#define __NR_POSIX_reserved86 (__NR_POSIX + 254)
913#define __NR_POSIX_reserved87 (__NR_POSIX + 255)
914#define __NR_POSIX_reserved88 (__NR_POSIX + 256)
915#define __NR_POSIX_reserved89 (__NR_POSIX + 257)
916#define __NR_POSIX_reserved90 (__NR_POSIX + 258)
917#define __NR_POSIX_reserved91 (__NR_POSIX + 259)
918#define __NR_POSIX_netboot (__NR_POSIX + 260)
919#define __NR_POSIX_netunboot (__NR_POSIX + 261)
920#define __NR_POSIX_rdump (__NR_POSIX + 262)
921#define __NR_POSIX_setsid (__NR_POSIX + 263)
922#define __NR_POSIX_getmaxsig (__NR_POSIX + 264)
923#define __NR_POSIX_sigpending (__NR_POSIX + 265)
924#define __NR_POSIX_sigprocmask (__NR_POSIX + 266)
925#define __NR_POSIX_sigsuspend (__NR_POSIX + 267)
926#define __NR_POSIX_sigaction (__NR_POSIX + 268)
927#define __NR_POSIX_MIPS_reserved1 (__NR_POSIX + 269)
928#define __NR_POSIX_MIPS_reserved2 (__NR_POSIX + 270)
929#define __NR_POSIX_MIPS_reserved3 (__NR_POSIX + 271)
930#define __NR_POSIX_MIPS_reserved4 (__NR_POSIX + 272)
931#define __NR_POSIX_MIPS_reserved5 (__NR_POSIX + 273)
932#define __NR_POSIX_MIPS_reserved6 (__NR_POSIX + 274)
933#define __NR_POSIX_MIPS_reserved7 (__NR_POSIX + 275)
934#define __NR_POSIX_MIPS_reserved8 (__NR_POSIX + 276)
935#define __NR_POSIX_MIPS_reserved9 (__NR_POSIX + 277)
936#define __NR_POSIX_MIPS_reserved10 (__NR_POSIX + 278)
937#define __NR_POSIX_MIPS_reserved11 (__NR_POSIX + 279)
938#define __NR_POSIX_TANDEM_reserved1 (__NR_POSIX + 280)
939#define __NR_POSIX_TANDEM_reserved2 (__NR_POSIX + 281)
940#define __NR_POSIX_TANDEM_reserved3 (__NR_POSIX + 282)
941#define __NR_POSIX_TANDEM_reserved4 (__NR_POSIX + 283)
942#define __NR_POSIX_TANDEM_reserved5 (__NR_POSIX + 284)
943#define __NR_POSIX_TANDEM_reserved6 (__NR_POSIX + 285)
944#define __NR_POSIX_TANDEM_reserved7 (__NR_POSIX + 286)
945#define __NR_POSIX_TANDEM_reserved8 (__NR_POSIX + 287)
946#define __NR_POSIX_TANDEM_reserved9 (__NR_POSIX + 288)
947#define __NR_POSIX_TANDEM_reserved10 (__NR_POSIX + 289)
948#define __NR_POSIX_TANDEM_reserved11 (__NR_POSIX + 290)
949#define __NR_POSIX_TANDEM_reserved12 (__NR_POSIX + 291)
950#define __NR_POSIX_TANDEM_reserved13 (__NR_POSIX + 292)
951#define __NR_POSIX_TANDEM_reserved14 (__NR_POSIX + 293)
952#define __NR_POSIX_TANDEM_reserved15 (__NR_POSIX + 294)
953#define __NR_POSIX_TANDEM_reserved16 (__NR_POSIX + 295)
954#define __NR_POSIX_TANDEM_reserved17 (__NR_POSIX + 296)
955#define __NR_POSIX_TANDEM_reserved18 (__NR_POSIX + 297)
956#define __NR_POSIX_TANDEM_reserved19 (__NR_POSIX + 298)
957#define __NR_POSIX_TANDEM_reserved20 (__NR_POSIX + 299)
958#define __NR_POSIX_SGI_reserved7 (__NR_POSIX + 300)
959#define __NR_POSIX_SGI_reserved8 (__NR_POSIX + 301)
960#define __NR_POSIX_SGI_reserved9 (__NR_POSIX + 302)
961#define __NR_POSIX_SGI_reserved10 (__NR_POSIX + 303)
962#define __NR_POSIX_SGI_reserved11 (__NR_POSIX + 304)
963#define __NR_POSIX_SGI_reserved12 (__NR_POSIX + 305)
964#define __NR_POSIX_SGI_reserved13 (__NR_POSIX + 306)
965#define __NR_POSIX_SGI_reserved14 (__NR_POSIX + 307)
966#define __NR_POSIX_SGI_reserved15 (__NR_POSIX + 308)
967#define __NR_POSIX_SGI_reserved16 (__NR_POSIX + 309)
968#define __NR_POSIX_SGI_reserved17 (__NR_POSIX + 310)
969#define __NR_POSIX_SGI_reserved18 (__NR_POSIX + 311)
970#define __NR_POSIX_SGI_reserved19 (__NR_POSIX + 312)
971#define __NR_POSIX_SGI_reserved20 (__NR_POSIX + 313)
972#define __NR_POSIX_SGI_reserved21 (__NR_POSIX + 314)
973#define __NR_POSIX_SGI_reserved22 (__NR_POSIX + 315)
974#define __NR_POSIX_SGI_reserved23 (__NR_POSIX + 316)
975#define __NR_POSIX_SGI_reserved24 (__NR_POSIX + 317)
976#define __NR_POSIX_SGI_reserved25 (__NR_POSIX + 318)
977#define __NR_POSIX_SGI_reserved26 (__NR_POSIX + 319)
978
979#endif /* _ASM_RISCOS_SYSCALL_H */
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 330c4e497af3..e8e5d4143377 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -159,11 +159,21 @@ struct task_struct;
159do { \ 159do { \
160 if (cpu_has_dsp) \ 160 if (cpu_has_dsp) \
161 __save_dsp(prev); \ 161 __save_dsp(prev); \
162 (last) = resume(prev, next, next->thread_info); \ 162 (last) = resume(prev, next, task_thread_info(next)); \
163 if (cpu_has_dsp) \ 163 if (cpu_has_dsp) \
164 __restore_dsp(current); \ 164 __restore_dsp(current); \
165} while(0) 165} while(0)
166 166
167/*
168 * On SMP systems, when the scheduler does migration-cost autodetection,
169 * it needs a way to flush as much of the CPU's caches as possible.
170 *
171 * TODO: fill this in!
172 */
173static inline void sched_cacheflush(void)
174{
175}
176
167static inline unsigned long __xchg_u32(volatile int * m, unsigned int val) 177static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
168{ 178{
169 __u32 retval; 179 __u32 retval;
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index e6c24472e03f..1612b3fe1080 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -97,8 +97,6 @@ register struct thread_info *__current_thread_info __asm__("$28");
97#endif 97#endif
98 98
99#define free_thread_info(info) kfree(info) 99#define free_thread_info(info) kfree(info)
100#define get_thread_info(ti) get_task_struct((ti)->task)
101#define put_thread_info(ti) put_task_struct((ti)->task)
102 100
103#endif /* !__ASSEMBLY__ */ 101#endif /* !__ASSEMBLY__ */
104 102
diff --git a/include/asm-mips/vr41xx/capcella.h b/include/asm-mips/vr41xx/capcella.h
index 5b55083c5281..d10ffda50de7 100644
--- a/include/asm-mips/vr41xx/capcella.h
+++ b/include/asm-mips/vr41xx/capcella.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * capcella.h, Include file for ZAO Networks Capcella. 2 * capcella.h, Include file for ZAO Networks Capcella.
3 * 3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-mips/vr41xx/e55.h b/include/asm-mips/vr41xx/e55.h
index ea37b56fc66d..558f2269bf37 100644
--- a/include/asm-mips/vr41xx/e55.h
+++ b/include/asm-mips/vr41xx/e55.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * e55.h, Include file for CASIO CASSIOPEIA E-10/15/55/65. 2 * e55.h, Include file for CASIO CASSIOPEIA E-10/15/55/65.
3 * 3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-mips/vr41xx/giu.h b/include/asm-mips/vr41xx/giu.h
index 8590885a7638..8109cda557dc 100644
--- a/include/asm-mips/vr41xx/giu.h
+++ b/include/asm-mips/vr41xx/giu.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Include file for NEC VR4100 series General-purpose I/O Unit. 2 * Include file for NEC VR4100 series General-purpose I/O Unit.
3 * 3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-mips/vr41xx/mpc30x.h b/include/asm-mips/vr41xx/mpc30x.h
index e6ac3c8e8bae..a6cbe4da6667 100644
--- a/include/asm-mips/vr41xx/mpc30x.h
+++ b/include/asm-mips/vr41xx/mpc30x.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * mpc30x.h, Include file for Victor MP-C303/304. 2 * mpc30x.h, Include file for Victor MP-C303/304.
3 * 3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-mips/vr41xx/pci.h b/include/asm-mips/vr41xx/pci.h
index c473aa78d1d4..6fc01ce19777 100644
--- a/include/asm-mips/vr41xx/pci.h
+++ b/include/asm-mips/vr41xx/pci.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Include file for NEC VR4100 series PCI Control Unit. 2 * Include file for NEC VR4100 series PCI Control Unit.
3 * 3 *
4 * Copyright (C) 2004-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2004-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-mips/vr41xx/siu.h b/include/asm-mips/vr41xx/siu.h
index 865cc07ddd7f..1fcf6e8082b4 100644
--- a/include/asm-mips/vr41xx/siu.h
+++ b/include/asm-mips/vr41xx/siu.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Include file for NEC VR4100 series Serial Interface Unit. 2 * Include file for NEC VR4100 series Serial Interface Unit.
3 * 3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-mips/vr41xx/tb0219.h b/include/asm-mips/vr41xx/tb0219.h
index 273c6392688f..b318b9612a83 100644
--- a/include/asm-mips/vr41xx/tb0219.h
+++ b/include/asm-mips/vr41xx/tb0219.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * tb0219.h, Include file for TANBAC TB0219. 2 * tb0219.h, Include file for TANBAC TB0219.
3 * 3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * Modified for TANBAC TB0219: 6 * Modified for TANBAC TB0219:
7 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp> 7 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp>
diff --git a/include/asm-mips/vr41xx/tb0226.h b/include/asm-mips/vr41xx/tb0226.h
index 0ff9a60ecacc..2513f450e2d6 100644
--- a/include/asm-mips/vr41xx/tb0226.h
+++ b/include/asm-mips/vr41xx/tb0226.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * tb0226.h, Include file for TANBAC TB0226. 2 * tb0226.h, Include file for TANBAC TB0226.
3 * 3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
index bd2723c30901..70828d5fae9c 100644
--- a/include/asm-mips/vr41xx/vr41xx.h
+++ b/include/asm-mips/vr41xx/vr41xx.h
@@ -7,7 +7,7 @@
7 * Copyright (C) 2001, 2002 Paul Mundt 7 * Copyright (C) 2001, 2002 Paul Mundt
8 * Copyright (C) 2002 MontaVista Software, Inc. 8 * Copyright (C) 2002 MontaVista Software, Inc.
9 * Copyright (C) 2002 TimeSys Corp. 9 * Copyright (C) 2002 TimeSys Corp.
10 * Copyright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 10 * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 13 * under the terms of the GNU General Public License as published by the
diff --git a/include/asm-mips/vr41xx/vrc4173.h b/include/asm-mips/vr41xx/vrc4173.h
index bb7a85c186e4..4d41a9c091d4 100644
--- a/include/asm-mips/vr41xx/vrc4173.h
+++ b/include/asm-mips/vr41xx/vrc4173.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2000 Michael R. McDonald 4 * Copyright (C) 2000 Michael R. McDonald
5 * Copyright (C) 2001-2003 Montavista Software Inc. 5 * Copyright (C) 2001-2003 Montavista Software Inc.
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> 6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>
7 * Copyright (C) 2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 7 * Copyright (C) 2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
8 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/asm-mips/vr41xx/workpad.h b/include/asm-mips/vr41xx/workpad.h
index dfe01b43fb79..6bfa9c009a9b 100644
--- a/include/asm-mips/vr41xx/workpad.h
+++ b/include/asm-mips/vr41xx/workpad.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * workpad.h, Include file for IBM WorkPad z50. 2 * workpad.h, Include file for IBM WorkPad z50.
3 * 3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License as published by
diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h
index 983e9a2b6042..2ca56d34aaad 100644
--- a/include/asm-parisc/atomic.h
+++ b/include/asm-parisc/atomic.h
@@ -165,6 +165,7 @@ static __inline__ int atomic_read(const atomic_t *v)
165 165
166/* exported interface */ 166/* exported interface */
167#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 167#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
168#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
168 169
169/** 170/**
170 * atomic_add_unless - add unless the number is a given value 171 * atomic_add_unless - add unless the number is a given value
@@ -216,4 +217,5 @@ static __inline__ int atomic_read(const atomic_t *v)
216#define smp_mb__before_atomic_inc() smp_mb() 217#define smp_mb__before_atomic_inc() smp_mb()
217#define smp_mb__after_atomic_inc() smp_mb() 218#define smp_mb__after_atomic_inc() smp_mb()
218 219
220#include <asm-generic/atomic.h>
219#endif 221#endif
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h
index 55b98c67fd82..15d8c2b51584 100644
--- a/include/asm-parisc/bitops.h
+++ b/include/asm-parisc/bitops.h
@@ -263,6 +263,7 @@ static __inline__ int fls(int x)
263 263
264 return ret; 264 return ret;
265} 265}
266#define fls64(x) generic_fls64(x)
266 267
267/* 268/*
268 * hweightN: returns the hamming weight (i.e. the number 269 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-parisc/cache.h b/include/asm-parisc/cache.h
index 5da72e38bdde..93f179f13ce8 100644
--- a/include/asm-parisc/cache.h
+++ b/include/asm-parisc/cache.h
@@ -28,16 +28,15 @@
28#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) 28#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
29 29
30#define SMP_CACHE_BYTES L1_CACHE_BYTES 30#define SMP_CACHE_BYTES L1_CACHE_BYTES
31#define L1_CACHE_SHIFT_MAX 5 /* largest L1 which this arch supports */
32 31
33extern void flush_data_cache_local(void); /* flushes local data-cache only */ 32extern void flush_data_cache_local(void *); /* flushes local data-cache only */
34extern void flush_instruction_cache_local(void); /* flushes local code-cache only */ 33extern void flush_instruction_cache_local(void *); /* flushes local code-cache only */
35#ifdef CONFIG_SMP 34#ifdef CONFIG_SMP
36extern void flush_data_cache(void); /* flushes data-cache only (all processors) */ 35extern void flush_data_cache(void); /* flushes data-cache only (all processors) */
37extern void flush_instruction_cache(void); /* flushes i-cache only (all processors) */ 36extern void flush_instruction_cache(void); /* flushes i-cache only (all processors) */
38#else 37#else
39#define flush_data_cache flush_data_cache_local 38#define flush_data_cache() flush_data_cache_local(NULL)
40#define flush_instruction_cache flush_instruction_cache_local 39#define flush_instruction_cache() flush_instruction_cache_local(NULL)
41#endif 40#endif
42 41
43extern void parisc_cache_init(void); /* initializes cache-flushing */ 42extern void parisc_cache_init(void); /* initializes cache-flushing */
diff --git a/include/asm-parisc/futex.h b/include/asm-parisc/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-parisc/futex.h
+++ b/include/asm-parisc/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-parisc/io.h b/include/asm-parisc/io.h
index b9bb5946ecc9..0db00adc942a 100644
--- a/include/asm-parisc/io.h
+++ b/include/asm-parisc/io.h
@@ -41,7 +41,7 @@ extern void __raw_bad_addr(const volatile void __iomem *addr);
41#define __raw_check_addr(addr) \ 41#define __raw_check_addr(addr) \
42 if (((unsigned long)addr >> NYBBLE_SHIFT) != 0xe) \ 42 if (((unsigned long)addr >> NYBBLE_SHIFT) != 0xe) \
43 __raw_bad_addr(addr); \ 43 __raw_bad_addr(addr); \
44 addr = (void *)((unsigned long)addr | (0xfUL << NYBBLE_SHIFT)); 44 addr = (void __iomem *)((unsigned long)addr | (0xfUL << NYBBLE_SHIFT));
45#else 45#else
46#define gsc_check_addr(addr) 46#define gsc_check_addr(addr)
47#define __raw_check_addr(addr) 47#define __raw_check_addr(addr)
diff --git a/include/asm-parisc/mman.h b/include/asm-parisc/mman.h
index e829607eb8bc..736b0abcac05 100644
--- a/include/asm-parisc/mman.h
+++ b/include/asm-parisc/mman.h
@@ -38,6 +38,7 @@
38#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */ 38#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */
39#define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */ 39#define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */
40#define MADV_VPS_INHERIT 7 /* Inherit parents page size */ 40#define MADV_VPS_INHERIT 7 /* Inherit parents page size */
41#define MADV_REMOVE 8 /* remove these pages & resources */
41 42
42/* The range 12-64 is reserved for page size specification. */ 43/* The range 12-64 is reserved for page size specification. */
43#define MADV_4K_PAGES 12 /* Use 4K pages */ 44#define MADV_4K_PAGES 12 /* Use 4K pages */
diff --git a/include/asm-parisc/mutex.h b/include/asm-parisc/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-parisc/mutex.h
@@ -0,0 +1,9 @@
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-parisc/page.h b/include/asm-parisc/page.h
index 44eae9f8274d..4a6752b0afed 100644
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -135,6 +135,13 @@ extern int npmem_ranges;
135#define pfn_valid(pfn) ((pfn) < max_mapnr) 135#define pfn_valid(pfn) ((pfn) < max_mapnr)
136#endif /* CONFIG_DISCONTIGMEM */ 136#endif /* CONFIG_DISCONTIGMEM */
137 137
138#ifdef CONFIG_HUGETLB_PAGE
139#define HPAGE_SHIFT 22 /* 4MB (is this fixed?) */
140#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
141#define HPAGE_MASK (~(HPAGE_SIZE - 1))
142#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
143#endif
144
138#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 145#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
139 146
140#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 147#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
index fa39d07d49e9..f277254159b7 100644
--- a/include/asm-parisc/pci.h
+++ b/include/asm-parisc/pci.h
@@ -84,11 +84,17 @@ static __inline__ int pci_is_lmmio(struct pci_hba_data *hba, unsigned long a)
84/* 84/*
85** Convert between PCI (IO_VIEW) addresses and processor (PA_VIEW) addresses. 85** Convert between PCI (IO_VIEW) addresses and processor (PA_VIEW) addresses.
86** See pcibios.c for more conversions used by Generic PCI code. 86** See pcibios.c for more conversions used by Generic PCI code.
87**
88** Platform characteristics/firmware guarantee that
89** (1) PA_VIEW - IO_VIEW = lmmio_offset for both LMMIO and ELMMIO
90** (2) PA_VIEW == IO_VIEW for GMMIO
87*/ 91*/
88#define PCI_BUS_ADDR(hba,a) (PCI_IS_LMMIO(hba,a) \ 92#define PCI_BUS_ADDR(hba,a) (PCI_IS_LMMIO(hba,a) \
89 ? ((a) - hba->lmmio_space_offset) /* mangle LMMIO */ \ 93 ? ((a) - hba->lmmio_space_offset) /* mangle LMMIO */ \
90 : (a)) /* GMMIO */ 94 : (a)) /* GMMIO */
91#define PCI_HOST_ADDR(hba,a) ((a) + hba->lmmio_space_offset) 95#define PCI_HOST_ADDR(hba,a) (((a) & PCI_F_EXTEND) == 0 \
96 ? (a) + hba->lmmio_space_offset \
97 : (a))
92 98
93#else /* !CONFIG_64BIT */ 99#else /* !CONFIG_64BIT */
94 100
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h
index aae40e8c3aa8..89f2f1c16c12 100644
--- a/include/asm-parisc/processor.h
+++ b/include/asm-parisc/processor.h
@@ -144,16 +144,16 @@ struct thread_struct {
144 }) 144 })
145 145
146#define INIT_THREAD { \ 146#define INIT_THREAD { \
147 regs: { gr: { 0, }, \ 147 .regs = { .gr = { 0, }, \
148 fr: { 0, }, \ 148 .fr = { 0, }, \
149 sr: { 0, }, \ 149 .sr = { 0, }, \
150 iasq: { 0, }, \ 150 .iasq = { 0, }, \
151 iaoq: { 0, }, \ 151 .iaoq = { 0, }, \
152 cr27: 0, \ 152 .cr27 = 0, \
153 }, \ 153 }, \
154 task_size: DEFAULT_TASK_SIZE, \ 154 .task_size = DEFAULT_TASK_SIZE, \
155 map_base: DEFAULT_MAP_BASE, \ 155 .map_base = DEFAULT_MAP_BASE, \
156 flags: 0 \ 156 .flags = 0 \
157 } 157 }
158 158
159/* 159/*
diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h
index f3928d3a80cb..a5a973c0c07f 100644
--- a/include/asm-parisc/system.h
+++ b/include/asm-parisc/system.h
@@ -49,6 +49,15 @@ extern struct task_struct *_switch_to(struct task_struct *, struct task_struct *
49 (last) = _switch_to(prev, next); \ 49 (last) = _switch_to(prev, next); \
50} while(0) 50} while(0)
51 51
52/*
53 * On SMP systems, when the scheduler does migration-cost autodetection,
54 * it needs a way to flush as much of the CPU's caches as possible.
55 *
56 * TODO: fill this in!
57 */
58static inline void sched_cacheflush(void)
59{
60}
52 61
53 62
54/* interrupt control */ 63/* interrupt control */
diff --git a/include/asm-parisc/thread_info.h b/include/asm-parisc/thread_info.h
index 57bbb76cb6c1..ac32f140b83a 100644
--- a/include/asm-parisc/thread_info.h
+++ b/include/asm-parisc/thread_info.h
@@ -43,9 +43,6 @@ struct thread_info {
43#define alloc_thread_info(tsk) ((struct thread_info *) \ 43#define alloc_thread_info(tsk) ((struct thread_info *) \
44 __get_free_pages(GFP_KERNEL, THREAD_ORDER)) 44 __get_free_pages(GFP_KERNEL, THREAD_ORDER))
45#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) 45#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER)
46#define get_thread_info(ti) get_task_struct((ti)->task)
47#define put_thread_info(ti) put_task_struct((ti)->task)
48
49 46
50/* how to get the thread information struct from C */ 47/* how to get the thread information struct from C */
51#define current_thread_info() ((struct thread_info *)mfctl(30)) 48#define current_thread_info() ((struct thread_info *)mfctl(30))
diff --git a/include/asm-parisc/tlbflush.h b/include/asm-parisc/tlbflush.h
index c9ec39c6fc6c..825994a90e2d 100644
--- a/include/asm-parisc/tlbflush.h
+++ b/include/asm-parisc/tlbflush.h
@@ -22,6 +22,7 @@ extern spinlock_t pa_tlb_lock;
22#define purge_tlb_end(x) spin_unlock(&pa_tlb_lock) 22#define purge_tlb_end(x) spin_unlock(&pa_tlb_lock)
23 23
24extern void flush_tlb_all(void); 24extern void flush_tlb_all(void);
25extern void flush_tlb_all_local(void *);
25 26
26/* 27/*
27 * flush_tlb_mm() 28 * flush_tlb_mm()
diff --git a/include/asm-powerpc/abs_addr.h b/include/asm-powerpc/abs_addr.h
index 18415108fc56..c5c3259e0f86 100644
--- a/include/asm-powerpc/abs_addr.h
+++ b/include/asm-powerpc/abs_addr.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_ABS_ADDR_H 1#ifndef _ASM_POWERPC_ABS_ADDR_H
2#define _ASM_POWERPC_ABS_ADDR_H 2#define _ASM_POWERPC_ABS_ADDR_H
3#ifdef __KERNEL__
3 4
4#include <linux/config.h> 5#include <linux/config.h>
5 6
@@ -70,4 +71,5 @@ static inline unsigned long phys_to_abs(unsigned long pa)
70#define iseries_hv_addr(virtaddr) \ 71#define iseries_hv_addr(virtaddr) \
71 (0x8000000000000000 | virt_to_abs(virtaddr)) 72 (0x8000000000000000 | virt_to_abs(virtaddr))
72 73
74#endif /* __KERNEL__ */
73#endif /* _ASM_POWERPC_ABS_ADDR_H */ 75#endif /* _ASM_POWERPC_ABS_ADDR_H */
diff --git a/include/asm-powerpc/agp.h b/include/asm-powerpc/agp.h
index 885b4631a6cf..e5ccaca2f5a4 100644
--- a/include/asm-powerpc/agp.h
+++ b/include/asm-powerpc/agp.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_AGP_H 1#ifndef _ASM_POWERPC_AGP_H
2#define _ASM_POWERPC_AGP_H 2#define _ASM_POWERPC_AGP_H
3#ifdef __KERNEL__
3 4
4#include <asm/io.h> 5#include <asm/io.h>
5 6
@@ -18,4 +19,5 @@
18#define free_gatt_pages(table, order) \ 19#define free_gatt_pages(table, order) \
19 free_pages((unsigned long)(table), (order)) 20 free_pages((unsigned long)(table), (order))
20 21
22#endif /* __KERNEL__ */
21#endif /* _ASM_POWERPC_AGP_H */ 23#endif /* _ASM_POWERPC_AGP_H */
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h
index 8b133efc9f79..8e64be0cc47d 100644
--- a/include/asm-powerpc/asm-compat.h
+++ b/include/asm-powerpc/asm-compat.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_POWERPC_ASM_COMPAT_H 1#ifndef _ASM_POWERPC_ASM_COMPAT_H
2#define _ASM_POWERPC_ASM_COMPAT_H 2#define _ASM_POWERPC_ASM_COMPAT_H
3 3
4#include <linux/config.h>
5#include <asm/types.h> 4#include <asm/types.h>
6 5
7#ifdef __ASSEMBLY__ 6#ifdef __ASSEMBLY__
@@ -41,6 +40,7 @@
41 40
42#endif 41#endif
43 42
43#ifdef __KERNEL__
44#ifdef CONFIG_IBM405_ERR77 44#ifdef CONFIG_IBM405_ERR77
45/* Erratum #77 on the 405 means we need a sync or dcbt before every 45/* Erratum #77 on the 405 means we need a sync or dcbt before every
46 * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this. 46 * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
@@ -51,5 +51,6 @@
51#define PPC405_ERR77(ra,rb) 51#define PPC405_ERR77(ra,rb)
52#define PPC405_ERR77_SYNC 52#define PPC405_ERR77_SYNC
53#endif 53#endif
54#endif
54 55
55#endif /* _ASM_POWERPC_ASM_COMPAT_H */ 56#endif /* _ASM_POWERPC_ASM_COMPAT_H */
diff --git a/include/asm-powerpc/atomic.h b/include/asm-powerpc/atomic.h
index ec4b14468959..248f9aec959c 100644
--- a/include/asm-powerpc/atomic.h
+++ b/include/asm-powerpc/atomic.h
@@ -165,6 +165,7 @@ static __inline__ int atomic_dec_return(atomic_t *v)
165} 165}
166 166
167#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 167#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
168#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
168 169
169/** 170/**
170 * atomic_add_unless - add unless the number is a given value 171 * atomic_add_unless - add unless the number is a given value
@@ -402,5 +403,6 @@ static __inline__ long atomic64_dec_if_positive(atomic64_t *v)
402 403
403#endif /* __powerpc64__ */ 404#endif /* __powerpc64__ */
404 405
406#include <asm-generic/atomic.h>
405#endif /* __KERNEL__ */ 407#endif /* __KERNEL__ */
406#endif /* _ASM_POWERPC_ATOMIC_H_ */ 408#endif /* _ASM_POWERPC_ATOMIC_H_ */
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index 5727229b0444..1996eaa8aeae 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -310,6 +310,7 @@ static __inline__ int fls(unsigned int x)
310 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x)); 310 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
311 return 32 - lz; 311 return 32 - lz;
312} 312}
313#define fls64(x) generic_fls64(x)
313 314
314/* 315/*
315 * hweightN: returns the hamming weight (i.e. the number 316 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-powerpc/bootx.h b/include/asm-powerpc/bootx.h
new file mode 100644
index 000000000000..57b82e3f89ce
--- /dev/null
+++ b/include/asm-powerpc/bootx.h
@@ -0,0 +1,171 @@
1/*
2 * This file describes the structure passed from the BootX application
3 * (for MacOS) when it is used to boot Linux.
4 *
5 * Written by Benjamin Herrenschmidt.
6 */
7
8
9#ifndef __ASM_BOOTX_H__
10#define __ASM_BOOTX_H__
11
12#include <asm/types.h>
13
14#ifdef macintosh
15#include <Types.h>
16#include "linux_type_defs.h"
17#endif
18
19#ifdef macintosh
20/* All this requires PowerPC alignment */
21#pragma options align=power
22#endif
23
24/* On kernel entry:
25 *
26 * r3 = 0x426f6f58 ('BooX')
27 * r4 = pointer to boot_infos
28 * r5 = NULL
29 *
30 * Data and instruction translation disabled, interrupts
31 * disabled, kernel loaded at physical 0x00000000 on PCI
32 * machines (will be different on NuBus).
33 */
34
35#define BOOT_INFO_VERSION 5
36#define BOOT_INFO_COMPATIBLE_VERSION 1
37
38/* Bit in the architecture flag mask. More to be defined in
39 future versions. Note that either BOOT_ARCH_PCI or
40 BOOT_ARCH_NUBUS is set. The other BOOT_ARCH_NUBUS_xxx are
41 set additionally when BOOT_ARCH_NUBUS is set.
42 */
43#define BOOT_ARCH_PCI 0x00000001UL
44#define BOOT_ARCH_NUBUS 0x00000002UL
45#define BOOT_ARCH_NUBUS_PDM 0x00000010UL
46#define BOOT_ARCH_NUBUS_PERFORMA 0x00000020UL
47#define BOOT_ARCH_NUBUS_POWERBOOK 0x00000040UL
48
49/* Maximum number of ranges in phys memory map */
50#define MAX_MEM_MAP_SIZE 26
51
52/* This is the format of an element in the physical memory map. Note that
53 the map is optional and current BootX will only build it for pre-PCI
54 machines */
55typedef struct boot_info_map_entry
56{
57 __u32 physAddr; /* Physical starting address */
58 __u32 size; /* Size in bytes */
59} boot_info_map_entry_t;
60
61
62/* Here are the boot informations that are passed to the bootstrap
63 * Note that the kernel arguments and the device tree are appended
64 * at the end of this structure. */
65typedef struct boot_infos
66{
67 /* Version of this structure */
68 __u32 version;
69 /* backward compatible down to version: */
70 __u32 compatible_version;
71
72 /* NEW (vers. 2) this holds the current _logical_ base addr of
73 the frame buffer (for use by early boot message) */
74 __u8* logicalDisplayBase;
75
76 /* NEW (vers. 4) Apple's machine identification */
77 __u32 machineID;
78
79 /* NEW (vers. 4) Detected hw architecture */
80 __u32 architecture;
81
82 /* The device tree (internal addresses relative to the beginning of the tree,
83 * device tree offset relative to the beginning of this structure).
84 * On pre-PCI macintosh (BOOT_ARCH_PCI bit set to 0 in architecture), this
85 * field is 0.
86 */
87 __u32 deviceTreeOffset; /* Device tree offset */
88 __u32 deviceTreeSize; /* Size of the device tree */
89
90 /* Some infos about the current MacOS display */
91 __u32 dispDeviceRect[4]; /* left,top,right,bottom */
92 __u32 dispDeviceDepth; /* (8, 16 or 32) */
93 __u8* dispDeviceBase; /* base address (physical) */
94 __u32 dispDeviceRowBytes; /* rowbytes (in bytes) */
95 __u32 dispDeviceColorsOffset; /* Colormap (8 bits only) or 0 (*) */
96 /* Optional offset in the registry to the current
97 * MacOS display. (Can be 0 when not detected) */
98 __u32 dispDeviceRegEntryOffset;
99
100 /* Optional pointer to boot ramdisk (offset from this structure) */
101 __u32 ramDisk;
102 __u32 ramDiskSize; /* size of ramdisk image */
103
104 /* Kernel command line arguments (offset from this structure) */
105 __u32 kernelParamsOffset;
106
107 /* ALL BELOW NEW (vers. 4) */
108
109 /* This defines the physical memory. Valid with BOOT_ARCH_NUBUS flag
110 (non-PCI) only. On PCI, memory is contiguous and it's size is in the
111 device-tree. */
112 boot_info_map_entry_t
113 physMemoryMap[MAX_MEM_MAP_SIZE]; /* Where the phys memory is */
114 __u32 physMemoryMapSize; /* How many entries in map */
115
116
117 /* The framebuffer size (optional, currently 0) */
118 __u32 frameBufferSize; /* Represents a max size, can be 0. */
119
120 /* NEW (vers. 5) */
121
122 /* Total params size (args + colormap + device tree + ramdisk) */
123 __u32 totalParamsSize;
124
125} boot_infos_t;
126
127#ifdef __KERNEL__
128/* (*) The format of the colormap is 256 * 3 * 2 bytes. Each color index
129 * is represented by 3 short words containing a 16 bits (unsigned) color
130 * component. Later versions may contain the gamma table for direct-color
131 * devices here.
132 */
133#define BOOTX_COLORTABLE_SIZE (256UL*3UL*2UL)
134
135/* BootX passes the device-tree using a format that comes from earlier
136 * ppc32 kernels. This used to match what is in prom.h, but not anymore
137 * so we now define it here
138 */
139struct bootx_dt_prop {
140 u32 name;
141 int length;
142 u32 value;
143 u32 next;
144};
145
146struct bootx_dt_node {
147 u32 unused0;
148 u32 unused1;
149 u32 phandle; /* not really available */
150 u32 unused2;
151 u32 unused3;
152 u32 unused4;
153 u32 unused5;
154 u32 full_name;
155 u32 properties;
156 u32 parent;
157 u32 child;
158 u32 sibling;
159 u32 next;
160 u32 allnext;
161};
162
163extern void bootx_init(unsigned long r4, unsigned long phys);
164
165#endif /* __KERNEL__ */
166
167#ifdef macintosh
168#pragma options align=reset
169#endif
170
171#endif
diff --git a/include/asm-powerpc/btext.h b/include/asm-powerpc/btext.h
index 71cce36bc630..906f46e31006 100644
--- a/include/asm-powerpc/btext.h
+++ b/include/asm-powerpc/btext.h
@@ -7,21 +7,22 @@
7#define __PPC_BTEXT_H 7#define __PPC_BTEXT_H
8#ifdef __KERNEL__ 8#ifdef __KERNEL__
9 9
10extern void btext_clearscreen(void); 10extern int btext_find_display(int allow_nonstdout);
11extern void btext_flushscreen(void);
12
13extern int boot_text_mapped;
14
15extern int btext_initialize(struct device_node *np);
16
17extern void map_boot_text(void);
18extern void init_boot_display(void);
19extern void btext_update_display(unsigned long phys, int width, int height, 11extern void btext_update_display(unsigned long phys, int width, int height,
20 int depth, int pitch); 12 int depth, int pitch);
13extern void btext_setup_display(int width, int height, int depth, int pitch,
14 unsigned long address);
15extern void btext_prepare_BAT(void);
16extern void btext_unmap(void);
21 17
22extern void btext_drawchar(char c); 18extern void btext_drawchar(char c);
23extern void btext_drawstring(const char *str); 19extern void btext_drawstring(const char *str);
24extern void btext_drawhex(unsigned long v); 20extern void btext_drawhex(unsigned long v);
21extern void btext_drawtext(const char *c, unsigned int len);
22
23extern void btext_clearscreen(void);
24extern void btext_flushscreen(void);
25extern void btext_flushline(void);
25 26
26#endif /* __KERNEL__ */ 27#endif /* __KERNEL__ */
27#endif /* __PPC_BTEXT_H */ 28#endif /* __PPC_BTEXT_H */
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h
index b001ecb3cd99..99817a802ca4 100644
--- a/include/asm-powerpc/bug.h
+++ b/include/asm-powerpc/bug.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_BUG_H 1#ifndef _ASM_POWERPC_BUG_H
2#define _ASM_POWERPC_BUG_H 2#define _ASM_POWERPC_BUG_H
3#ifdef __KERNEL__
3 4
4#include <asm/asm-compat.h> 5#include <asm/asm-compat.h>
5/* 6/*
@@ -67,4 +68,5 @@ struct bug_entry *find_bug(unsigned long bugaddr);
67 68
68#include <asm-generic/bug.h> 69#include <asm-generic/bug.h>
69 70
71#endif /* __KERNEL__ */
70#endif /* _ASM_POWERPC_BUG_H */ 72#endif /* _ASM_POWERPC_BUG_H */
diff --git a/include/asm-powerpc/cache.h b/include/asm-powerpc/cache.h
index 26ce502e76e8..6379c2df5c40 100644
--- a/include/asm-powerpc/cache.h
+++ b/include/asm-powerpc/cache.h
@@ -19,7 +19,6 @@
19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
20 20
21#define SMP_CACHE_BYTES L1_CACHE_BYTES 21#define SMP_CACHE_BYTES L1_CACHE_BYTES
22#define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */
23 22
24#if defined(__powerpc64__) && !defined(__ASSEMBLY__) 23#if defined(__powerpc64__) && !defined(__ASSEMBLY__)
25struct ppc64_caches { 24struct ppc64_caches {
diff --git a/include/asm-powerpc/checksum.h b/include/asm-powerpc/checksum.h
index d8354d8a49ce..609ecbbd7210 100644
--- a/include/asm-powerpc/checksum.h
+++ b/include/asm-powerpc/checksum.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_CHECKSUM_H 1#ifndef _ASM_POWERPC_CHECKSUM_H
2#define _ASM_POWERPC_CHECKSUM_H 2#define _ASM_POWERPC_CHECKSUM_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -129,4 +130,5 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
129} 130}
130 131
131#endif 132#endif
133#endif /* __KERNEL__ */
132#endif 134#endif
diff --git a/include/asm-powerpc/compat.h b/include/asm-powerpc/compat.h
index 4db4360c4d4a..accb80c9a339 100644
--- a/include/asm-powerpc/compat.h
+++ b/include/asm-powerpc/compat.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_COMPAT_H 1#ifndef _ASM_POWERPC_COMPAT_H
2#define _ASM_POWERPC_COMPAT_H 2#define _ASM_POWERPC_COMPAT_H
3#ifdef __KERNEL__
3/* 4/*
4 * Architecture specific compatibility types 5 * Architecture specific compatibility types
5 */ 6 */
@@ -202,4 +203,5 @@ struct compat_shmid64_ds {
202 compat_ulong_t __unused6; 203 compat_ulong_t __unused6;
203}; 204};
204 205
206#endif /* __KERNEL__ */
205#endif /* _ASM_POWERPC_COMPAT_H */ 207#endif /* _ASM_POWERPC_COMPAT_H */
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index d1cfa3f515ea..ef6ead34a773 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -1,7 +1,6 @@
1#ifndef __ASM_POWERPC_CPUTABLE_H 1#ifndef __ASM_POWERPC_CPUTABLE_H
2#define __ASM_POWERPC_CPUTABLE_H 2#define __ASM_POWERPC_CPUTABLE_H
3 3
4#include <linux/config.h>
5#include <asm/asm-compat.h> 4#include <asm/asm-compat.h>
6 5
7#define PPC_FEATURE_32 0x80000000 6#define PPC_FEATURE_32 0x80000000
@@ -28,10 +27,17 @@
28 * via the mkdefs mechanism. 27 * via the mkdefs mechanism.
29 */ 28 */
30struct cpu_spec; 29struct cpu_spec;
31struct op_powerpc_model;
32 30
33typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); 31typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
34 32
33enum powerpc_oprofile_type {
34 INVALID = 0,
35 RS64 = 1,
36 POWER4 = 2,
37 G4 = 3,
38 BOOKE = 4,
39};
40
35struct cpu_spec { 41struct cpu_spec {
36 /* CPU is matched via (PVR & pvr_mask) == pvr_value */ 42 /* CPU is matched via (PVR & pvr_mask) == pvr_value */
37 unsigned int pvr_mask; 43 unsigned int pvr_mask;
@@ -57,7 +63,7 @@ struct cpu_spec {
57 char *oprofile_cpu_type; 63 char *oprofile_cpu_type;
58 64
59 /* Processor specific oprofile operations */ 65 /* Processor specific oprofile operations */
60 struct op_powerpc_model *oprofile_model; 66 enum powerpc_oprofile_type oprofile_type;
61}; 67};
62 68
63extern struct cpu_spec *cur_cpu_spec; 69extern struct cpu_spec *cur_cpu_spec;
@@ -106,6 +112,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
106#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) 112#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000)
107#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) 113#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000)
108#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000) 114#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000)
115#define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000)
109#else 116#else
110/* ensure on 32b processors the flags are available for compiling but 117/* ensure on 32b processors the flags are available for compiling but
111 * don't do anything */ 118 * don't do anything */
@@ -305,12 +312,18 @@ enum {
305 CPU_FTR_MMCRA_SIHV, 312 CPU_FTR_MMCRA_SIHV,
306 CPU_FTRS_CELL = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 313 CPU_FTRS_CELL = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
307 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | 314 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 |
308 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT, 315 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT |
316 CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO,
309 CPU_FTRS_COMPATIBLE = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 317 CPU_FTRS_COMPATIBLE = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
310 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2, 318 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2,
311#endif 319#endif
312 320
313 CPU_FTRS_POSSIBLE = 321 CPU_FTRS_POSSIBLE =
322#ifdef __powerpc64__
323 CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 |
324 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL |
325 CPU_FTR_CI_LARGE_PAGE |
326#else
314#if CLASSIC_PPC 327#if CLASSIC_PPC
315 CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | 328 CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU |
316 CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 | 329 CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 |
@@ -344,14 +357,14 @@ enum {
344#ifdef CONFIG_E500 357#ifdef CONFIG_E500
345 CPU_FTRS_E500 | CPU_FTRS_E500_2 | 358 CPU_FTRS_E500 | CPU_FTRS_E500_2 |
346#endif 359#endif
347#ifdef __powerpc64__ 360#endif /* __powerpc64__ */
348 CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 |
349 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL |
350 CPU_FTR_CI_LARGE_PAGE |
351#endif
352 0, 361 0,
353 362
354 CPU_FTRS_ALWAYS = 363 CPU_FTRS_ALWAYS =
364#ifdef __powerpc64__
365 CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 &
366 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_CELL &
367#else
355#if CLASSIC_PPC 368#if CLASSIC_PPC
356 CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU & 369 CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU &
357 CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 & 370 CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 &
@@ -385,10 +398,7 @@ enum {
385#ifdef CONFIG_E500 398#ifdef CONFIG_E500
386 CPU_FTRS_E500 & CPU_FTRS_E500_2 & 399 CPU_FTRS_E500 & CPU_FTRS_E500_2 &
387#endif 400#endif
388#ifdef __powerpc64__ 401#endif /* __powerpc64__ */
389 CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 &
390 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_CELL &
391#endif
392 CPU_FTRS_POSSIBLE, 402 CPU_FTRS_POSSIBLE,
393}; 403};
394 404
diff --git a/include/asm-powerpc/current.h b/include/asm-powerpc/current.h
index 82cd4a9ca99a..1938d6abd255 100644
--- a/include/asm-powerpc/current.h
+++ b/include/asm-powerpc/current.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_CURRENT_H 1#ifndef _ASM_POWERPC_CURRENT_H
2#define _ASM_POWERPC_CURRENT_H 2#define _ASM_POWERPC_CURRENT_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -24,4 +25,5 @@ register struct task_struct *current asm ("r2");
24 25
25#endif 26#endif
26 27
28#endif /* __KERNEL__ */
27#endif /* _ASM_POWERPC_CURRENT_H */ 29#endif /* _ASM_POWERPC_CURRENT_H */
diff --git a/include/asm-powerpc/delay.h b/include/asm-powerpc/delay.h
index 54fe1f4f8fd0..057a60955474 100644
--- a/include/asm-powerpc/delay.h
+++ b/include/asm-powerpc/delay.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_DELAY_H 1#ifndef _ASM_POWERPC_DELAY_H
2#define _ASM_POWERPC_DELAY_H 2#define _ASM_POWERPC_DELAY_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Copyright 1996, Paul Mackerras. 6 * Copyright 1996, Paul Mackerras.
@@ -16,4 +17,5 @@
16extern void __delay(unsigned long loops); 17extern void __delay(unsigned long loops);
17extern void udelay(unsigned long usecs); 18extern void udelay(unsigned long usecs);
18 19
20#endif /* __KERNEL__ */
19#endif /* _ASM_POWERPC_DELAY_H */ 21#endif /* _ASM_POWERPC_DELAY_H */
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 59a80163f75f..837756ab7dc7 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -6,6 +6,7 @@
6 */ 6 */
7#ifndef _ASM_DMA_MAPPING_H 7#ifndef _ASM_DMA_MAPPING_H
8#define _ASM_DMA_MAPPING_H 8#define _ASM_DMA_MAPPING_H
9#ifdef __KERNEL__
9 10
10#include <linux/config.h> 11#include <linux/config.h>
11#include <linux/types.h> 12#include <linux/types.h>
@@ -229,7 +230,7 @@ static inline int dma_get_cache_alignment(void)
229#ifdef CONFIG_PPC64 230#ifdef CONFIG_PPC64
230 /* no easy way to get cache size on all processors, so return 231 /* no easy way to get cache size on all processors, so return
231 * the maximum possible, to be safe */ 232 * the maximum possible, to be safe */
232 return (1 << L1_CACHE_SHIFT_MAX); 233 return (1 << INTERNODE_CACHE_SHIFT);
233#else 234#else
234 /* 235 /*
235 * Each processor family will define its own L1_CACHE_SHIFT, 236 * Each processor family will define its own L1_CACHE_SHIFT,
@@ -282,4 +283,5 @@ struct dma_mapping_ops {
282 int (*dac_dma_supported)(struct device *dev, u64 mask); 283 int (*dac_dma_supported)(struct device *dev, u64 mask);
283}; 284};
284 285
286#endif /* __KERNEL__ */
285#endif /* _ASM_DMA_MAPPING_H */ 287#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-powerpc/dma.h b/include/asm-powerpc/dma.h
index 926378d2cd94..4bb57fe37097 100644
--- a/include/asm-powerpc/dma.h
+++ b/include/asm-powerpc/dma.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_DMA_H 1#ifndef _ASM_POWERPC_DMA_H
2#define _ASM_POWERPC_DMA_H 2#define _ASM_POWERPC_DMA_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Defines for using and allocating dma channels. 6 * Defines for using and allocating dma channels.
@@ -387,4 +388,5 @@ extern int isa_dma_bridge_buggy;
387 388
388#endif /* !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) */ 389#endif /* !defined(CONFIG_PPC_ISERIES) || defined(CONFIG_PCI) */
389 390
391#endif /* __KERNEL__ */
390#endif /* _ASM_POWERPC_DMA_H */ 392#endif /* _ASM_POWERPC_DMA_H */
diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h
index f8633aafe4ba..b263fb2fa6e4 100644
--- a/include/asm-powerpc/eeh.h
+++ b/include/asm-powerpc/eeh.h
@@ -19,6 +19,7 @@
19 19
20#ifndef _PPC64_EEH_H 20#ifndef _PPC64_EEH_H
21#define _PPC64_EEH_H 21#define _PPC64_EEH_H
22#ifdef __KERNEL__
22 23
23#include <linux/config.h> 24#include <linux/config.h>
24#include <linux/init.h> 25#include <linux/init.h>
@@ -33,9 +34,11 @@ struct device_node;
33extern int eeh_subsystem_enabled; 34extern int eeh_subsystem_enabled;
34 35
35/* Values for eeh_mode bits in device_node */ 36/* Values for eeh_mode bits in device_node */
36#define EEH_MODE_SUPPORTED (1<<0) 37#define EEH_MODE_SUPPORTED (1<<0)
37#define EEH_MODE_NOCHECK (1<<1) 38#define EEH_MODE_NOCHECK (1<<1)
38#define EEH_MODE_ISOLATED (1<<2) 39#define EEH_MODE_ISOLATED (1<<2)
40#define EEH_MODE_RECOVERING (1<<3)
41#define EEH_MODE_IRQ_DISABLED (1<<4)
39 42
40/* Max number of EEH freezes allowed before we consider the device 43/* Max number of EEH freezes allowed before we consider the device
41 * to be permanently disabled. */ 44 * to be permanently disabled. */
@@ -57,6 +60,7 @@ void __init pci_addr_cache_build(void);
57 * to finish the eeh setup for this device. 60 * to finish the eeh setup for this device.
58 */ 61 */
59void eeh_add_device_early(struct device_node *); 62void eeh_add_device_early(struct device_node *);
63void eeh_add_device_tree_early(struct device_node *);
60void eeh_add_device_late(struct pci_dev *); 64void eeh_add_device_late(struct pci_dev *);
61 65
62/** 66/**
@@ -72,6 +76,15 @@ void eeh_add_device_late(struct pci_dev *);
72void eeh_remove_device(struct pci_dev *); 76void eeh_remove_device(struct pci_dev *);
73 77
74/** 78/**
79 * eeh_remove_device_recursive - undo EEH for device & children.
80 * @dev: pci device to be removed
81 *
82 * As above, this removes the device; it also removes child
83 * pci devices as well.
84 */
85void eeh_remove_bus_device(struct pci_dev *);
86
87/**
75 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. 88 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure.
76 * 89 *
77 * If this macro yields TRUE, the caller relays to eeh_check_failure() 90 * If this macro yields TRUE, the caller relays to eeh_check_failure()
@@ -107,6 +120,9 @@ static inline void eeh_add_device_late(struct pci_dev *dev) { }
107 120
108static inline void eeh_remove_device(struct pci_dev *dev) { } 121static inline void eeh_remove_device(struct pci_dev *dev) { }
109 122
123static inline void eeh_add_device_tree_early(struct device_node *dn) { }
124
125static inline void eeh_remove_bus_device(struct pci_dev *dev) { }
110#define EEH_POSSIBLE_ERROR(val, type) (0) 126#define EEH_POSSIBLE_ERROR(val, type) (0)
111#define EEH_IO_ERROR_VALUE(size) (-1UL) 127#define EEH_IO_ERROR_VALUE(size) (-1UL)
112#endif /* CONFIG_EEH */ 128#endif /* CONFIG_EEH */
@@ -363,4 +379,5 @@ static inline void eeh_insl_ns(unsigned long port, void * buf, int nl)
363 eeh_check_failure((void __iomem *)(port), *(u32*)buf); 379 eeh_check_failure((void __iomem *)(port), *(u32*)buf);
364} 380}
365 381
382#endif /* __KERNEL__ */
366#endif /* _PPC64_EEH_H */ 383#endif /* _PPC64_EEH_H */
diff --git a/include/asm-powerpc/eeh_event.h b/include/asm-powerpc/eeh_event.h
index d168a30b3866..93d55a2bebfd 100644
--- a/include/asm-powerpc/eeh_event.h
+++ b/include/asm-powerpc/eeh_event.h
@@ -20,6 +20,7 @@
20 20
21#ifndef ASM_PPC64_EEH_EVENT_H 21#ifndef ASM_PPC64_EEH_EVENT_H
22#define ASM_PPC64_EEH_EVENT_H 22#define ASM_PPC64_EEH_EVENT_H
23#ifdef __KERNEL__
23 24
24/** EEH event -- structure holding pci controller data that describes 25/** EEH event -- structure holding pci controller data that describes
25 * a change in the isolation status of a PCI slot. A pointer 26 * a change in the isolation status of a PCI slot. A pointer
@@ -29,7 +30,7 @@ struct eeh_event {
29 struct list_head list; 30 struct list_head list;
30 struct device_node *dn; /* struct device node */ 31 struct device_node *dn; /* struct device node */
31 struct pci_dev *dev; /* affected device */ 32 struct pci_dev *dev; /* affected device */
32 int state; 33 enum pci_channel_state state; /* PCI bus state for the affected device */
33 int time_unavail; /* milliseconds until device might be available */ 34 int time_unavail; /* milliseconds until device might be available */
34}; 35};
35 36
@@ -46,7 +47,11 @@ struct eeh_event {
46 */ 47 */
47int eeh_send_failure_event (struct device_node *dn, 48int eeh_send_failure_event (struct device_node *dn,
48 struct pci_dev *dev, 49 struct pci_dev *dev,
49 int reset_state, 50 enum pci_channel_state state,
50 int time_unavail); 51 int time_unavail);
51 52
53/* Main recovery function */
54void handle_eeh_events (struct eeh_event *);
55
56#endif /* __KERNEL__ */
52#endif /* ASM_PPC64_EEH_EVENT_H */ 57#endif /* ASM_PPC64_EEH_EVENT_H */
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index 3dcd65edf978..45f2af6f89c4 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -1,7 +1,10 @@
1#ifndef _ASM_POWERPC_ELF_H 1#ifndef _ASM_POWERPC_ELF_H
2#define _ASM_POWERPC_ELF_H 2#define _ASM_POWERPC_ELF_H
3 3
4#ifdef __KERNEL__
4#include <linux/sched.h> /* for task_struct */ 5#include <linux/sched.h> /* for task_struct */
6#endif
7
5#include <asm/types.h> 8#include <asm/types.h>
6#include <asm/ptrace.h> 9#include <asm/ptrace.h>
7#include <asm/cputable.h> 10#include <asm/cputable.h>
@@ -89,7 +92,6 @@
89 * as published by the Free Software Foundation; either version 92 * as published by the Free Software Foundation; either version
90 * 2 of the License, or (at your option) any later version. 93 * 2 of the License, or (at your option) any later version.
91 */ 94 */
92#include <asm/ptrace.h>
93 95
94#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ 96#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
95#define ELF_NFPREG 33 /* includes fpscr */ 97#define ELF_NFPREG 33 /* includes fpscr */
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h
index 12fabbcb04f0..f804b34cf06a 100644
--- a/include/asm-powerpc/firmware.h
+++ b/include/asm-powerpc/firmware.h
@@ -98,6 +98,12 @@ typedef struct {
98extern firmware_feature_t firmware_features_table[]; 98extern firmware_feature_t firmware_features_table[];
99#endif 99#endif
100 100
101extern void system_reset_fwnmi(void);
102extern void machine_check_fwnmi(void);
103
104/* This is true if we are using the firmware NMI handler (typically LPAR) */
105extern int fwnmi_active;
106
101#endif /* __ASSEMBLY__ */ 107#endif /* __ASSEMBLY__ */
102#endif /* __KERNEL__ */ 108#endif /* __KERNEL__ */
103#endif /* __ASM_POWERPC_FIRMWARE_H */ 109#endif /* __ASM_POWERPC_FIRMWARE_H */
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h
index 64276a3f6153..e258778ca429 100644
--- a/include/asm-powerpc/floppy.h
+++ b/include/asm-powerpc/floppy.h
@@ -9,6 +9,7 @@
9 */ 9 */
10#ifndef __ASM_POWERPC_FLOPPY_H 10#ifndef __ASM_POWERPC_FLOPPY_H
11#define __ASM_POWERPC_FLOPPY_H 11#define __ASM_POWERPC_FLOPPY_H
12#ifdef __KERNEL__
12 13
13#include <linux/config.h> 14#include <linux/config.h>
14#include <asm/machdep.h> 15#include <asm/machdep.h>
@@ -102,4 +103,5 @@ static int FDC2 = -1;
102 103
103#define EXTRA_FLOPPY_PARAMS 104#define EXTRA_FLOPPY_PARAMS
104 105
106#endif /* __KERNEL__ */
105#endif /* __ASM_POWERPC_FLOPPY_H */ 107#endif /* __ASM_POWERPC_FLOPPY_H */
diff --git a/include/asm-powerpc/grackle.h b/include/asm-powerpc/grackle.h
index 563c7a5e64c9..bd7812a519d4 100644
--- a/include/asm-powerpc/grackle.h
+++ b/include/asm-powerpc/grackle.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_POWERPC_GRACKLE_H
2#define _ASM_POWERPC_GRACKLE_H
3#ifdef __KERNEL__
1/* 4/*
2 * Functions for setting up and using a MPC106 northbridge 5 * Functions for setting up and using a MPC106 northbridge
3 */ 6 */
@@ -5,3 +8,5 @@
5#include <asm/pci-bridge.h> 8#include <asm/pci-bridge.h>
6 9
7extern void setup_grackle(struct pci_controller *hose); 10extern void setup_grackle(struct pci_controller *hose);
11#endif /* __KERNEL__ */
12#endif /* _ASM_POWERPC_GRACKLE_H */
diff --git a/include/asm-powerpc/hardirq.h b/include/asm-powerpc/hardirq.h
index 3b3e3b49ec12..288e14d53b7f 100644
--- a/include/asm-powerpc/hardirq.h
+++ b/include/asm-powerpc/hardirq.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_HARDIRQ_H 1#ifndef _ASM_POWERPC_HARDIRQ_H
2#define _ASM_POWERPC_HARDIRQ_H 2#define _ASM_POWERPC_HARDIRQ_H
3#ifdef __KERNEL__
3 4
4#include <asm/irq.h> 5#include <asm/irq.h>
5#include <asm/bug.h> 6#include <asm/bug.h>
@@ -24,4 +25,5 @@ static inline void ack_bad_irq(int irq)
24 BUG(); 25 BUG();
25} 26}
26 27
28#endif /* __KERNEL__ */
27#endif /* _ASM_POWERPC_HARDIRQ_H */ 29#endif /* _ASM_POWERPC_HARDIRQ_H */
diff --git a/include/asm-powerpc/heathrow.h b/include/asm-powerpc/heathrow.h
index 22ac179856b9..93f54958a9d1 100644
--- a/include/asm-powerpc/heathrow.h
+++ b/include/asm-powerpc/heathrow.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_POWERPC_HEATHROW_H
2#define _ASM_POWERPC_HEATHROW_H
3#ifdef __KERNEL__
1/* 4/*
2 * heathrow.h: definitions for using the "Heathrow" I/O controller chip. 5 * heathrow.h: definitions for using the "Heathrow" I/O controller chip.
3 * 6 *
@@ -60,3 +63,5 @@
60/* Looks like Heathrow has some sort of GPIOs as well... */ 63/* Looks like Heathrow has some sort of GPIOs as well... */
61#define HRW_GPIO_MODEM_RESET 0x6d 64#define HRW_GPIO_MODEM_RESET 0x6d
62 65
66#endif /* __KERNEL__ */
67#endif /* _ASM_POWERPC_HEATHROW_H */
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h
index d36da61dbc53..da7af5a720e0 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_HVCALL_H 1#ifndef _ASM_POWERPC_HVCALL_H
2#define _ASM_POWERPC_HVCALL_H 2#define _ASM_POWERPC_HVCALL_H
3#ifdef __KERNEL__
3 4
4#define HVSC .long 0x44000022 5#define HVSC .long 0x44000022
5 6
@@ -170,4 +171,5 @@ long plpar_hcall_4out(unsigned long opcode,
170 unsigned long *out4); 171 unsigned long *out4);
171 172
172#endif /* __ASSEMBLY__ */ 173#endif /* __ASSEMBLY__ */
174#endif /* __KERNEL__ */
173#endif /* _ASM_POWERPC_HVCALL_H */ 175#endif /* _ASM_POWERPC_HVCALL_H */
diff --git a/include/asm-powerpc/hvconsole.h b/include/asm-powerpc/hvconsole.h
index 6da93ce74dc0..34daf7b9b62f 100644
--- a/include/asm-powerpc/hvconsole.h
+++ b/include/asm-powerpc/hvconsole.h
@@ -21,6 +21,7 @@
21 21
22#ifndef _PPC64_HVCONSOLE_H 22#ifndef _PPC64_HVCONSOLE_H
23#define _PPC64_HVCONSOLE_H 23#define _PPC64_HVCONSOLE_H
24#ifdef __KERNEL__
24 25
25/* 26/*
26 * This is the max number of console adapters that can/will be found as 27 * This is the max number of console adapters that can/will be found as
@@ -46,4 +47,5 @@ extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq,
46 struct hv_ops *ops); 47 struct hv_ops *ops);
47/* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ 48/* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */
48extern int __devexit hvc_remove(struct hvc_struct *hp); 49extern int __devexit hvc_remove(struct hvc_struct *hp);
50#endif /* __KERNEL__ */
49#endif /* _PPC64_HVCONSOLE_H */ 51#endif /* _PPC64_HVCONSOLE_H */
diff --git a/include/asm-powerpc/hvcserver.h b/include/asm-powerpc/hvcserver.h
index aecba9665796..67d7da3a4da4 100644
--- a/include/asm-powerpc/hvcserver.h
+++ b/include/asm-powerpc/hvcserver.h
@@ -21,6 +21,7 @@
21 21
22#ifndef _PPC64_HVCSERVER_H 22#ifndef _PPC64_HVCSERVER_H
23#define _PPC64_HVCSERVER_H 23#define _PPC64_HVCSERVER_H
24#ifdef __KERNEL__
24 25
25#include <linux/list.h> 26#include <linux/list.h>
26 27
@@ -54,4 +55,5 @@ extern int hvcs_register_connection(uint32_t unit_address,
54 uint32_t p_partition_ID, uint32_t p_unit_address); 55 uint32_t p_partition_ID, uint32_t p_unit_address);
55extern int hvcs_free_connection(uint32_t unit_address); 56extern int hvcs_free_connection(uint32_t unit_address);
56 57
58#endif /* __KERNEL__ */
57#endif /* _PPC64_HVCSERVER_H */ 59#endif /* _PPC64_HVCSERVER_H */
diff --git a/include/asm-powerpc/i8259.h b/include/asm-powerpc/i8259.h
index fc4bfee124d7..0392159e16e4 100644
--- a/include/asm-powerpc/i8259.h
+++ b/include/asm-powerpc/i8259.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_I8259_H 1#ifndef _ASM_POWERPC_I8259_H
2#define _ASM_POWERPC_I8259_H 2#define _ASM_POWERPC_I8259_H
3#ifdef __KERNEL__
3 4
4#include <linux/irq.h> 5#include <linux/irq.h>
5 6
@@ -9,4 +10,5 @@ extern void i8259_init(unsigned long intack_addr, int offset);
9extern int i8259_irq(struct pt_regs *regs); 10extern int i8259_irq(struct pt_regs *regs);
10extern int i8259_irq_cascade(struct pt_regs *regs, void *unused); 11extern int i8259_irq_cascade(struct pt_regs *regs, void *unused);
11 12
13#endif /* __KERNEL__ */
12#endif /* _ASM_POWERPC_I8259_H */ 14#endif /* _ASM_POWERPC_I8259_H */
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h
new file mode 100644
index 000000000000..7a42723d107c
--- /dev/null
+++ b/include/asm-powerpc/ibmebus.h
@@ -0,0 +1,85 @@
1/*
2 * IBM PowerPC eBus Infrastructure Support.
3 *
4 * Copyright (c) 2005 IBM Corporation
5 * Heiko J Schick <schickhj@de.ibm.com>
6 *
7 * All rights reserved.
8 *
9 * This source code is distributed under a dual license of GPL v2.0 and OpenIB
10 * BSD.
11 *
12 * OpenIB BSD License
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are met:
16 *
17 * Redistributions of source code must retain the above copyright notice, this
18 * list of conditions and the following disclaimer.
19 *
20 * Redistributions in binary form must reproduce the above copyright notice,
21 * this list of conditions and the following disclaimer in the documentation
22 * and/or other materials
23 * provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
33 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _ASM_EBUS_H
39#define _ASM_EBUS_H
40#ifdef __KERNEL__
41
42#include <linux/device.h>
43#include <linux/interrupt.h>
44#include <linux/mod_devicetable.h>
45#include <asm/of_device.h>
46
47extern struct dma_mapping_ops ibmebus_dma_ops;
48extern struct bus_type ibmebus_bus_type;
49
50struct ibmebus_dev {
51 char *name;
52 struct of_device ofdev;
53};
54
55struct ibmebus_driver {
56 char *name;
57 struct of_device_id *id_table;
58 int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id);
59 int (*remove) (struct ibmebus_dev *dev);
60 struct device_driver driver;
61};
62
63int ibmebus_register_driver(struct ibmebus_driver *drv);
64void ibmebus_unregister_driver(struct ibmebus_driver *drv);
65
66int ibmebus_request_irq(struct ibmebus_dev *dev,
67 u32 ist,
68 irqreturn_t (*handler)(int, void*, struct pt_regs *),
69 unsigned long irq_flags, const char * devname,
70 void *dev_id);
71void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id);
72
73static inline struct ibmebus_driver *to_ibmebus_driver(struct device_driver *drv)
74{
75 return container_of(drv, struct ibmebus_driver, driver);
76}
77
78static inline struct ibmebus_dev *to_ibmebus_dev(struct device *dev)
79{
80 return container_of(dev, struct ibmebus_dev, ofdev.dev);
81}
82
83
84#endif /* __KERNEL__ */
85#endif /* _ASM_IBMEBUS_H */
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 48938d84d055..68efbea379c9 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_IO_H 1#ifndef _ASM_POWERPC_IO_H
2#define _ASM_POWERPC_IO_H 2#define _ASM_POWERPC_IO_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -186,7 +187,6 @@ extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl);
186#define IO_SPACE_LIMIT ~(0UL) 187#define IO_SPACE_LIMIT ~(0UL)
187 188
188 189
189#ifdef __KERNEL__
190extern int __ioremap_explicit(unsigned long p_addr, unsigned long v_addr, 190extern int __ioremap_explicit(unsigned long p_addr, unsigned long v_addr,
191 unsigned long size, unsigned long flags); 191 unsigned long size, unsigned long flags);
192extern void __iomem *__ioremap(unsigned long address, unsigned long size, 192extern void __iomem *__ioremap(unsigned long address, unsigned long size,
@@ -256,8 +256,6 @@ static inline void * phys_to_virt(unsigned long address)
256 */ 256 */
257#define BIO_VMERGE_BOUNDARY 0 257#define BIO_VMERGE_BOUNDARY 0
258 258
259#endif /* __KERNEL__ */
260
261static inline void iosync(void) 259static inline void iosync(void)
262{ 260{
263 __asm__ __volatile__ ("sync" : : : "memory"); 261 __asm__ __volatile__ ("sync" : : : "memory");
@@ -405,8 +403,6 @@ static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long
405#include <asm/eeh.h> 403#include <asm/eeh.h>
406#endif 404#endif
407 405
408#ifdef __KERNEL__
409
410/** 406/**
411 * check_signature - find BIOS signatures 407 * check_signature - find BIOS signatures
412 * @io_addr: mmio address to check 408 * @io_addr: mmio address to check
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index f89f06050893..d5677cbec200 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -20,6 +20,7 @@
20 20
21#ifndef _ASM_IOMMU_H 21#ifndef _ASM_IOMMU_H
22#define _ASM_IOMMU_H 22#define _ASM_IOMMU_H
23#ifdef __KERNEL__
23 24
24#include <linux/config.h> 25#include <linux/config.h>
25#include <asm/types.h> 26#include <asm/types.h>
@@ -56,32 +57,13 @@ struct device_node;
56 57
57/* Walks all buses and creates iommu tables */ 58/* Walks all buses and creates iommu tables */
58extern void iommu_setup_pSeries(void); 59extern void iommu_setup_pSeries(void);
59extern void iommu_setup_u3(void); 60extern void iommu_setup_dart(void);
60 61
61/* Frees table for an individual device node */ 62/* Frees table for an individual device node */
62extern void iommu_free_table(struct device_node *dn); 63extern void iommu_free_table(struct device_node *dn);
63 64
64#endif /* CONFIG_PPC_MULTIPLATFORM */ 65#endif /* CONFIG_PPC_MULTIPLATFORM */
65 66
66#ifdef CONFIG_PPC_PSERIES
67
68/* Creates table for an individual device node */
69extern void iommu_devnode_init_pSeries(struct device_node *dn);
70
71#endif /* CONFIG_PPC_PSERIES */
72
73#ifdef CONFIG_PPC_ISERIES
74
75/* Creates table for an individual device node */
76extern void iommu_devnode_init_iSeries(struct device_node *dn);
77/* Get table parameters from HV */
78extern void iommu_table_getparms_iSeries(unsigned long busno,
79 unsigned char slotno,
80 unsigned char virtbus,
81 struct iommu_table* tbl);
82
83#endif /* CONFIG_PPC_ISERIES */
84
85/* Initializes an iommu_table based in values set in the passed-in 67/* Initializes an iommu_table based in values set in the passed-in
86 * structure 68 * structure
87 */ 69 */
@@ -104,7 +86,7 @@ extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
104 86
105extern void iommu_init_early_pSeries(void); 87extern void iommu_init_early_pSeries(void);
106extern void iommu_init_early_iSeries(void); 88extern void iommu_init_early_iSeries(void);
107extern void iommu_init_early_u3(void); 89extern void iommu_init_early_dart(void);
108 90
109#ifdef CONFIG_PCI 91#ifdef CONFIG_PCI
110extern void pci_iommu_init(void); 92extern void pci_iommu_init(void);
@@ -113,6 +95,7 @@ extern void pci_direct_iommu_init(void);
113static inline void pci_iommu_init(void) { } 95static inline void pci_iommu_init(void) { }
114#endif 96#endif
115 97
116extern void alloc_u3_dart_table(void); 98extern void alloc_dart_table(void);
117 99
100#endif /* __KERNEL__ */
118#endif /* _ASM_IOMMU_H */ 101#endif /* _ASM_IOMMU_H */
diff --git a/include/asm-ppc/ipic.h b/include/asm-powerpc/ipic.h
index 0fe396a2b666..0fe396a2b666 100644
--- a/include/asm-ppc/ipic.h
+++ b/include/asm-powerpc/ipic.h
diff --git a/include/asm-powerpc/iseries/hv_call.h b/include/asm-powerpc/iseries/hv_call.h
index e9f831c9a5e5..162d653ad51f 100644
--- a/include/asm-powerpc/iseries/hv_call.h
+++ b/include/asm-powerpc/iseries/hv_call.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvCall.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * 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
@@ -15,8 +14,7 @@
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 17 *
19/*
20 * This file contains the "hypervisor call" interface which is used to 18 * This file contains the "hypervisor call" interface which is used to
21 * drive the hypervisor from the OS. 19 * drive the hypervisor from the OS.
22 */ 20 */
diff --git a/include/asm-powerpc/iseries/hv_call_event.h b/include/asm-powerpc/iseries/hv_call_event.h
index 46763a30590a..4cec4762076d 100644
--- a/include/asm-powerpc/iseries/hv_call_event.h
+++ b/include/asm-powerpc/iseries/hv_call_event.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvCallEvent.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * 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
@@ -15,8 +14,7 @@
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 17 *
19/*
20 * This file contains the "hypervisor call" interface which is used to 18 * This file contains the "hypervisor call" interface which is used to
21 * drive the hypervisor from the OS. 19 * drive the hypervisor from the OS.
22 */ 20 */
@@ -33,32 +31,9 @@ typedef u8 HvLpEvent_Type;
33typedef u8 HvLpEvent_AckInd; 31typedef u8 HvLpEvent_AckInd;
34typedef u8 HvLpEvent_AckType; 32typedef u8 HvLpEvent_AckType;
35 33
36struct HvCallEvent_PackedParms {
37 u8 xAckType:1;
38 u8 xAckInd:1;
39 u8 xRsvd:1;
40 u8 xTargetLp:5;
41 u8 xType;
42 u16 xSubtype;
43 HvLpInstanceId xSourceInstId;
44 HvLpInstanceId xTargetInstId;
45};
46
47typedef u8 HvLpDma_Direction; 34typedef u8 HvLpDma_Direction;
48typedef u8 HvLpDma_AddressType; 35typedef u8 HvLpDma_AddressType;
49 36
50struct HvCallEvent_PackedDmaParms {
51 u8 xDirection:1;
52 u8 xLocalAddrType:1;
53 u8 xRemoteAddrType:1;
54 u8 xRsvd1:5;
55 HvLpIndex xRemoteLp;
56 u8 xType;
57 u8 xRsvd2;
58 HvLpInstanceId xLocalInstId;
59 HvLpInstanceId xRemoteInstId;
60};
61
62typedef u64 HvLpEvent_Rc; 37typedef u64 HvLpEvent_Rc;
63typedef u64 HvLpDma_Rc; 38typedef u64 HvLpDma_Rc;
64 39
@@ -92,11 +67,8 @@ static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex)
92static inline void HvCallEvent_setLpEventStack(u8 queueIndex, 67static inline void HvCallEvent_setLpEventStack(u8 queueIndex,
93 char *eventStackAddr, u32 eventStackSize) 68 char *eventStackAddr, u32 eventStackSize)
94{ 69{
95 u64 abs_addr; 70 HvCall3(HvCallEventSetLpEventStack, queueIndex,
96 71 virt_to_abs(eventStackAddr), eventStackSize);
97 abs_addr = virt_to_abs(eventStackAddr);
98 HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr,
99 eventStackSize);
100} 72}
101 73
102static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, 74static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
@@ -108,14 +80,7 @@ static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
108 80
109static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event) 81static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event)
110{ 82{
111 u64 abs_addr; 83 return HvCall1(HvCallEventSignalLpEvent, virt_to_abs(event));
112
113#ifdef DEBUG_SENDEVENT
114 printk("HvCallEvent_signalLpEvent: *event = %016lx\n ",
115 (unsigned long)event);
116#endif
117 abs_addr = virt_to_abs(event);
118 return HvCall1(HvCallEventSignalLpEvent, abs_addr);
119} 84}
120 85
121static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, 86static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
@@ -127,17 +92,21 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
127{ 92{
128 /* Pack the misc bits into a single Dword to pass to PLIC */ 93 /* Pack the misc bits into a single Dword to pass to PLIC */
129 union { 94 union {
130 struct HvCallEvent_PackedParms parms; 95 struct {
96 u8 ack_and_target;
97 u8 type;
98 u16 subtype;
99 HvLpInstanceId src_inst;
100 HvLpInstanceId target_inst;
101 } parms;
131 u64 dword; 102 u64 dword;
132 } packed; 103 } packed;
133 packed.parms.xAckType = ackType; 104
134 packed.parms.xAckInd = ackInd; 105 packed.parms.ack_and_target = (ackType << 7) | (ackInd << 6) | targetLp;
135 packed.parms.xRsvd = 0; 106 packed.parms.type = type;
136 packed.parms.xTargetLp = targetLp; 107 packed.parms.subtype = subtype;
137 packed.parms.xType = type; 108 packed.parms.src_inst = sourceInstanceId;
138 packed.parms.xSubtype = subtype; 109 packed.parms.target_inst = targetInstanceId;
139 packed.parms.xSourceInstId = sourceInstanceId;
140 packed.parms.xTargetInstId = targetInstanceId;
141 110
142 return HvCall7(HvCallEventSignalLpEventParms, packed.dword, 111 return HvCall7(HvCallEventSignalLpEventParms, packed.dword,
143 correlationToken, eventData1, eventData2, 112 correlationToken, eventData1, eventData2,
@@ -146,18 +115,12 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
146 115
147static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) 116static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event)
148{ 117{
149 u64 abs_addr; 118 return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event));
150
151 abs_addr = virt_to_abs(event);
152 return HvCall1(HvCallEventAckLpEvent, abs_addr);
153} 119}
154 120
155static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event) 121static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event)
156{ 122{
157 u64 abs_addr; 123 return HvCall1(HvCallEventCancelLpEvent, virt_to_abs(event));
158
159 abs_addr = virt_to_abs(event);
160 return HvCall1(HvCallEventCancelLpEvent, abs_addr);
161} 124}
162 125
163static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId( 126static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId(
@@ -195,59 +158,34 @@ static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
195{ 158{
196 /* Pack the misc bits into a single Dword to pass to PLIC */ 159 /* Pack the misc bits into a single Dword to pass to PLIC */
197 union { 160 union {
198 struct HvCallEvent_PackedDmaParms parms; 161 struct {
162 u8 flags;
163 HvLpIndex remote;
164 u8 type;
165 u8 reserved;
166 HvLpInstanceId local_inst;
167 HvLpInstanceId remote_inst;
168 } parms;
199 u64 dword; 169 u64 dword;
200 } packed; 170 } packed;
201 171
202 packed.parms.xDirection = direction; 172 packed.parms.flags = (direction << 7) |
203 packed.parms.xLocalAddrType = localAddressType; 173 (localAddressType << 6) | (remoteAddressType << 5);
204 packed.parms.xRemoteAddrType = remoteAddressType; 174 packed.parms.remote = remoteLp;
205 packed.parms.xRsvd1 = 0; 175 packed.parms.type = type;
206 packed.parms.xRemoteLp = remoteLp; 176 packed.parms.reserved = 0;
207 packed.parms.xType = type; 177 packed.parms.local_inst = localInstanceId;
208 packed.parms.xRsvd2 = 0; 178 packed.parms.remote_inst = remoteInstanceId;
209 packed.parms.xLocalInstId = localInstanceId;
210 packed.parms.xRemoteInstId = remoteInstanceId;
211 179
212 return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList, 180 return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList,
213 remoteBufList, transferLength); 181 remoteBufList, transferLength);
214} 182}
215 183
216static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type,
217 HvLpIndex remoteLp, HvLpDma_Direction direction,
218 HvLpInstanceId localInstanceId,
219 HvLpInstanceId remoteInstanceId,
220 HvLpDma_AddressType localAddressType,
221 HvLpDma_AddressType remoteAddressType,
222 u64 localAddrOrTce, u64 remoteAddrOrTce, u32 transferLength)
223{
224 /* Pack the misc bits into a single Dword to pass to PLIC */
225 union {
226 struct HvCallEvent_PackedDmaParms parms;
227 u64 dword;
228 } packed;
229
230 packed.parms.xDirection = direction;
231 packed.parms.xLocalAddrType = localAddressType;
232 packed.parms.xRemoteAddrType = remoteAddressType;
233 packed.parms.xRsvd1 = 0;
234 packed.parms.xRemoteLp = remoteLp;
235 packed.parms.xType = type;
236 packed.parms.xRsvd2 = 0;
237 packed.parms.xLocalInstId = localInstanceId;
238 packed.parms.xRemoteInstId = remoteInstanceId;
239
240 return (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle, packed.dword,
241 localAddrOrTce, remoteAddrOrTce, transferLength);
242}
243
244static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote, 184static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote,
245 u32 length, HvLpDma_Direction dir) 185 u32 length, HvLpDma_Direction dir)
246{ 186{
247 u64 abs_addr; 187 return HvCall4(HvCallEventDmaToSp, virt_to_abs(local), remote,
248 188 length, dir);
249 abs_addr = virt_to_abs(local);
250 return HvCall4(HvCallEventDmaToSp, abs_addr, remote, length, dir);
251} 189}
252 190
253#endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */ 191#endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */
diff --git a/include/asm-powerpc/iseries/hv_call_sc.h b/include/asm-powerpc/iseries/hv_call_sc.h
index dec7e9d9ab78..f5d210959250 100644
--- a/include/asm-powerpc/iseries/hv_call_sc.h
+++ b/include/asm-powerpc/iseries/hv_call_sc.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvCallSc.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * 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
diff --git a/include/asm-powerpc/iseries/hv_lp_config.h b/include/asm-powerpc/iseries/hv_lp_config.h
index bc00f036bca0..df8b20739719 100644
--- a/include/asm-powerpc/iseries/hv_lp_config.h
+++ b/include/asm-powerpc/iseries/hv_lp_config.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvLpConfig.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * 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
diff --git a/include/asm-powerpc/iseries/hv_lp_event.h b/include/asm-powerpc/iseries/hv_lp_event.h
index 499ab1ad0185..4065a4de4935 100644
--- a/include/asm-powerpc/iseries/hv_lp_event.h
+++ b/include/asm-powerpc/iseries/hv_lp_event.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvLpEvent.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * 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
@@ -32,17 +31,8 @@
32 * partitions through PLIC. 31 * partitions through PLIC.
33 */ 32 */
34 33
35struct HvEventFlags {
36 u8 xValid:1; /* Indicates a valid request x00-x00 */
37 u8 xRsvd1:4; /* Reserved ... */
38 u8 xAckType:1; /* Immediate or deferred ... */
39 u8 xAckInd:1; /* Indicates if ACK required ... */
40 u8 xFunction:1; /* Interrupt or Acknowledge ... */
41};
42
43
44struct HvLpEvent { 34struct HvLpEvent {
45 struct HvEventFlags xFlags; /* Event flags x00-x00 */ 35 u8 flags; /* Event flags x00-x00 */
46 u8 xType; /* Type of message x01-x01 */ 36 u8 xType; /* Type of message x01-x01 */
47 u16 xSubtype; /* Subtype for event x02-x03 */ 37 u16 xSubtype; /* Subtype for event x02-x03 */
48 u8 xSourceLp; /* Source LP x04-x04 */ 38 u8 xSourceLp; /* Source LP x04-x04 */
@@ -126,6 +116,11 @@ extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
126#define HvLpEvent_AckType_ImmediateAck 0 116#define HvLpEvent_AckType_ImmediateAck 0
127#define HvLpEvent_AckType_DeferredAck 1 117#define HvLpEvent_AckType_DeferredAck 1
128 118
119#define HV_LP_EVENT_INT 0x01
120#define HV_LP_EVENT_DO_ACK 0x02
121#define HV_LP_EVENT_DEFERRED_ACK 0x04
122#define HV_LP_EVENT_VALID 0x80
123
129#define HvLpDma_Direction_LocalToRemote 0 124#define HvLpDma_Direction_LocalToRemote 0
130#define HvLpDma_Direction_RemoteToLocal 1 125#define HvLpDma_Direction_RemoteToLocal 1
131 126
@@ -139,4 +134,29 @@ extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
139#define HvLpDma_Rc_InvalidAddress 4 134#define HvLpDma_Rc_InvalidAddress 4
140#define HvLpDma_Rc_InvalidLength 5 135#define HvLpDma_Rc_InvalidLength 5
141 136
137static inline int hvlpevent_is_valid(struct HvLpEvent *h)
138{
139 return h->flags & HV_LP_EVENT_VALID;
140}
141
142static inline void hvlpevent_invalidate(struct HvLpEvent *h)
143{
144 h->flags &= ~ HV_LP_EVENT_VALID;
145}
146
147static inline int hvlpevent_is_int(struct HvLpEvent *h)
148{
149 return h->flags & HV_LP_EVENT_INT;
150}
151
152static inline int hvlpevent_is_ack(struct HvLpEvent *h)
153{
154 return !hvlpevent_is_int(h);
155}
156
157static inline int hvlpevent_need_ack(struct HvLpEvent *h)
158{
159 return h->flags & HV_LP_EVENT_DO_ACK;
160}
161
142#endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */ 162#endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */
diff --git a/include/asm-powerpc/iseries/hv_types.h b/include/asm-powerpc/iseries/hv_types.h
index c38f7e3d01dc..c3e6d2a1d1c3 100644
--- a/include/asm-powerpc/iseries/hv_types.h
+++ b/include/asm-powerpc/iseries/hv_types.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * HvTypes.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * 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
diff --git a/include/asm-powerpc/iseries/iseries_io.h b/include/asm-powerpc/iseries/iseries_io.h
index 56b2113ff0f5..496aa852b617 100644
--- a/include/asm-powerpc/iseries/iseries_io.h
+++ b/include/asm-powerpc/iseries/iseries_io.h
@@ -6,7 +6,7 @@
6#ifdef CONFIG_PPC_ISERIES 6#ifdef CONFIG_PPC_ISERIES
7#include <linux/types.h> 7#include <linux/types.h>
8/* 8/*
9 * File iSeries_io.h created by Allan Trautman on Thu Dec 28 2000. 9 * Created by Allan Trautman on Thu Dec 28 2000.
10 * 10 *
11 * Remaps the io.h for the iSeries Io 11 * Remaps the io.h for the iSeries Io
12 * Copyright (C) 2000 Allan H Trautman, IBM Corporation 12 * Copyright (C) 2000 Allan H Trautman, IBM Corporation
@@ -32,6 +32,7 @@
32 * End Change Activity 32 * End Change Activity
33 */ 33 */
34 34
35#ifdef CONFIG_PCI
35extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); 36extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress);
36extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); 37extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress);
37extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); 38extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress);
@@ -44,6 +45,17 @@ extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source,
44 size_t n); 45 size_t n);
45extern void iSeries_memcpy_fromio(void *dest, 46extern void iSeries_memcpy_fromio(void *dest,
46 const volatile void __iomem *source, size_t n); 47 const volatile void __iomem *source, size_t n);
48#else
49static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
50{
51 return 0xff;
52}
53
54static inline void iSeries_Write_Byte(u8 IoData,
55 volatile void __iomem *IoAddress)
56{
57}
58#endif /* CONFIG_PCI */
47 59
48#endif /* CONFIG_PPC_ISERIES */ 60#endif /* CONFIG_PPC_ISERIES */
49#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */ 61#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */
diff --git a/include/asm-powerpc/iseries/it_exp_vpd_panel.h b/include/asm-powerpc/iseries/it_exp_vpd_panel.h
index 66a17a230c52..304a609ae21a 100644
--- a/include/asm-powerpc/iseries/it_exp_vpd_panel.h
+++ b/include/asm-powerpc/iseries/it_exp_vpd_panel.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * ItExtVpdPanel.h
3 * Copyright (C) 2002 Dave Boutcher IBM Corporation 2 * Copyright (C) 2002 Dave Boutcher IBM Corporation
4 * 3 *
5 * 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
diff --git a/include/asm-powerpc/iseries/it_lp_naca.h b/include/asm-powerpc/iseries/it_lp_naca.h
index c3ef1de45d82..4fdcf052927f 100644
--- a/include/asm-powerpc/iseries/it_lp_naca.h
+++ b/include/asm-powerpc/iseries/it_lp_naca.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * ItLpNaca.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * 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
@@ -37,17 +36,13 @@ struct ItLpNaca {
37 u8 xLpIndex; // LP Index x0B-x0B 36 u8 xLpIndex; // LP Index x0B-x0B
38 u16 xMaxLpQueues; // Number of allocated queues x0C-x0D 37 u16 xMaxLpQueues; // Number of allocated queues x0C-x0D
39 u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F 38 u16 xLpQueueOffset; // Offset to start of LP queues x0E-x0F
40 u8 xPirEnvironMode:8; // Piranha or hardware x10-x10 39 u8 xPirEnvironMode; // Piranha or hardware x10-x10
41 u8 xPirConsoleMode:8; // Piranha console indicator x11-x11 40 u8 xPirConsoleMode; // Piranha console indicator x11-x11
42 u8 xPirDasdMode:8; // Piranha dasd indicator x12-x12 41 u8 xPirDasdMode; // Piranha dasd indicator x12-x12
43 u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17 42 u8 xRsvd1_0[5]; // Reserved for Piranha related x13-x17
44 u8 xLparInstalled:1; // Is LPAR installed on system x18-x1F 43 u8 flags; // flags, see below x18-x1F
45 u8 xSysPartitioned:1; // Is the system partitioned ... 44 u8 xSpVpdFormat; // VPD areas are in CSP format ...
46 u8 xHwSyncedTBs:1; // Hardware synced TBs ... 45 u8 xIntProcRatio; // Ratio of int procs to procs ...
47 u8 xIntProcUtilHmt:1; // Utilize HMT for interrupts ...
48 u8 xRsvd1_1:4; // Reserved ...
49 u8 xSpVpdFormat:8; // VPD areas are in CSP format ...
50 u8 xIntProcRatio:8; // Ratio of int procs to procs ...
51 u8 xRsvd1_2[5]; // Reserved ... 46 u8 xRsvd1_2[5]; // Reserved ...
52 u16 xRsvd1_3; // Reserved x20-x21 47 u16 xRsvd1_3; // Reserved x20-x21
53 u16 xPlicVrmIndex; // VRM index of PLIC x22-x23 48 u16 xPlicVrmIndex; // VRM index of PLIC x22-x23
@@ -77,4 +72,9 @@ struct ItLpNaca {
77 72
78extern struct ItLpNaca itLpNaca; 73extern struct ItLpNaca itLpNaca;
79 74
75#define ITLPNACA_LPAR 0x80 /* Is LPAR installed on the system */
76#define ITLPNACA_PARTITIONED 0x40 /* Is the system partitioned */
77#define ITLPNACA_HWSYNCEDTBS 0x20 /* Hardware synced TBs */
78#define ITLPNACA_HMTINT 0x10 /* Utilize MHT for interrupts */
79
80#endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */ 80#endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */
diff --git a/include/asm-powerpc/iseries/it_lp_queue.h b/include/asm-powerpc/iseries/it_lp_queue.h
index a60d03afbf95..b7c6fc12cce2 100644
--- a/include/asm-powerpc/iseries/it_lp_queue.h
+++ b/include/asm-powerpc/iseries/it_lp_queue.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * ItLpQueue.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * 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
diff --git a/include/asm-powerpc/iseries/it_lp_reg_save.h b/include/asm-powerpc/iseries/it_lp_reg_save.h
index 288044b702de..5403b756f654 100644
--- a/include/asm-powerpc/iseries/it_lp_reg_save.h
+++ b/include/asm-powerpc/iseries/it_lp_reg_save.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * ItLpRegSave.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * 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
@@ -81,4 +80,6 @@ struct ItLpRegSave {
81 u8 xRsvd3[176]; // Reserved 350-3FF 80 u8 xRsvd3[176]; // Reserved 350-3FF
82}; 81};
83 82
84#endif /* _ITLPREGSAVE_H */ 83extern struct ItLpRegSave iseries_reg_save[];
84
85#endif /* _ASM_POWERPC_ISERIES_IT_LP_REG_SAVE_H */
diff --git a/include/asm-powerpc/iseries/lpar_map.h b/include/asm-powerpc/iseries/lpar_map.h
index 84fc321615bf..2ec384d66abb 100644
--- a/include/asm-powerpc/iseries/lpar_map.h
+++ b/include/asm-powerpc/iseries/lpar_map.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * LparMap.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * 3 *
5 * 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
diff --git a/include/asm-powerpc/iseries/mf.h b/include/asm-powerpc/iseries/mf.h
index e7bd57a03fb1..857e5202fc78 100644
--- a/include/asm-powerpc/iseries/mf.h
+++ b/include/asm-powerpc/iseries/mf.h
@@ -1,5 +1,4 @@
1/* 1/*
2 * mf.h
3 * Copyright (C) 2001 Troy D. Armstrong IBM Corporation 2 * Copyright (C) 2001 Troy D. Armstrong IBM Corporation
4 * Copyright (C) 2004 Stephen Rothwell IBM Corporation 3 * Copyright (C) 2004 Stephen Rothwell IBM Corporation
5 * 4 *
diff --git a/include/asm-powerpc/iseries/vio.h b/include/asm-powerpc/iseries/vio.h
index 7e3a469420dd..72a97d37aac3 100644
--- a/include/asm-powerpc/iseries/vio.h
+++ b/include/asm-powerpc/iseries/vio.h
@@ -1,5 +1,4 @@
1/* -*- linux-c -*- 1/* -*- linux-c -*-
2 * drivers/char/vio.h
3 * 2 *
4 * iSeries Virtual I/O Message Path header 3 * iSeries Virtual I/O Message Path header
5 * 4 *
diff --git a/include/asm-powerpc/kdebug.h b/include/asm-powerpc/kdebug.h
index 9dcbac674811..7c16265568e0 100644
--- a/include/asm-powerpc/kdebug.h
+++ b/include/asm-powerpc/kdebug.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_KDEBUG_H 1#ifndef _ASM_POWERPC_KDEBUG_H
2#define _ASM_POWERPC_KDEBUG_H 2#define _ASM_POWERPC_KDEBUG_H
3#ifdef __KERNEL__
3 4
4/* nearly identical to x86_64/i386 code */ 5/* nearly identical to x86_64/i386 code */
5 6
@@ -39,4 +40,5 @@ static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,lon
39 return notifier_call_chain(&powerpc_die_chain, val, &args); 40 return notifier_call_chain(&powerpc_die_chain, val, &args);
40} 41}
41 42
43#endif /* __KERNEL__ */
42#endif /* _ASM_POWERPC_KDEBUG_H */ 44#endif /* _ASM_POWERPC_KDEBUG_H */
diff --git a/include/asm-powerpc/kdump.h b/include/asm-powerpc/kdump.h
new file mode 100644
index 000000000000..a87aed00d61f
--- /dev/null
+++ b/include/asm-powerpc/kdump.h
@@ -0,0 +1,13 @@
1#ifndef _PPC64_KDUMP_H
2#define _PPC64_KDUMP_H
3
4/* How many bytes to reserve at zero for kdump. The reserve limit should
5 * be greater or equal to the trampoline's end address. */
6#define KDUMP_RESERVE_LIMIT 0x8000
7
8#define KDUMP_TRAMPOLINE_START 0x0100
9#define KDUMP_TRAMPOLINE_END 0x3000
10
11extern void kdump_setup(void);
12
13#endif /* __PPC64_KDUMP_H */
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h
index c72ffc709ea8..fffdf690b840 100644
--- a/include/asm-powerpc/kexec.h
+++ b/include/asm-powerpc/kexec.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_KEXEC_H 1#ifndef _ASM_POWERPC_KEXEC_H
2#define _ASM_POWERPC_KEXEC_H 2#define _ASM_POWERPC_KEXEC_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Maximum page that is mapped directly into kernel memory. 6 * Maximum page that is mapped directly into kernel memory.
@@ -30,21 +31,36 @@
30#define KEXEC_ARCH KEXEC_ARCH_PPC 31#define KEXEC_ARCH KEXEC_ARCH_PPC
31#endif 32#endif
32 33
34#define HAVE_ARCH_COPY_OLDMEM_PAGE
35
33#ifndef __ASSEMBLY__ 36#ifndef __ASSEMBLY__
34 37
35#define MAX_NOTE_BYTES 1024 38#ifdef CONFIG_KEXEC
36typedef u32 note_buf_t[MAX_NOTE_BYTES / sizeof(u32)];
37 39
38extern note_buf_t crash_notes[]; 40#define MAX_NOTE_BYTES 1024
39 41
40#ifdef __powerpc64__ 42#ifdef __powerpc64__
41extern void kexec_smp_wait(void); /* get and clear naca physid, wait for 43extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
42 master to copy new code to 0 */ 44 master to copy new code to 0 */
43extern void __init kexec_setup(void); 45extern void __init kexec_setup(void);
44#else 46extern int crashing_cpu;
47extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
48#endif /* __powerpc64 __ */
49
45struct kimage; 50struct kimage;
46extern void machine_kexec_simple(struct kimage *image); 51struct pt_regs;
47#endif 52extern void default_machine_kexec(struct kimage *image);
53extern int default_machine_kexec_prepare(struct kimage *image);
54extern void default_machine_crash_shutdown(struct pt_regs *regs);
55
56#endif /* !CONFIG_KEXEC */
48 57
58/*
59 * Provide a dummy definition to avoid build failures. Will remain
60 * empty till crash dump support is enabled.
61 */
62static inline void crash_setup_regs(struct pt_regs *newregs,
63 struct pt_regs *oldregs) { }
49#endif /* ! __ASSEMBLY__ */ 64#endif /* ! __ASSEMBLY__ */
65#endif /* __KERNEL__ */
50#endif /* _ASM_POWERPC_KEXEC_H */ 66#endif /* _ASM_POWERPC_KEXEC_H */
diff --git a/include/asm-powerpc/keylargo.h b/include/asm-powerpc/keylargo.h
index a669a3f0f5a2..d8520ef121f9 100644
--- a/include/asm-powerpc/keylargo.h
+++ b/include/asm-powerpc/keylargo.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_POWERPC_KEYLARGO_H
2#define _ASM_POWERPC_KEYLARGO_H
3#ifdef __KERNEL__
1/* 4/*
2 * keylargo.h: definitions for using the "KeyLargo" I/O controller chip. 5 * keylargo.h: definitions for using the "KeyLargo" I/O controller chip.
3 * 6 *
@@ -232,10 +235,12 @@
232#define K2_FCR1_I2S0_RESET 0x00000800 235#define K2_FCR1_I2S0_RESET 0x00000800
233#define K2_FCR1_I2S0_CLK_ENABLE_BIT 0x00001000 236#define K2_FCR1_I2S0_CLK_ENABLE_BIT 0x00001000
234#define K2_FCR1_I2S0_ENABLE 0x00002000 237#define K2_FCR1_I2S0_ENABLE 0x00002000
235
236#define K2_FCR1_PCI1_CLK_ENABLE 0x00004000 238#define K2_FCR1_PCI1_CLK_ENABLE 0x00004000
237#define K2_FCR1_FW_CLK_ENABLE 0x00008000 239#define K2_FCR1_FW_CLK_ENABLE 0x00008000
238#define K2_FCR1_FW_RESET_N 0x00010000 240#define K2_FCR1_FW_RESET_N 0x00010000
241#define K2_FCR1_I2S1_CELL_ENABLE 0x00020000
242#define K2_FCR1_I2S1_CLK_ENABLE_BIT 0x00080000
243#define K2_FCR1_I2S1_ENABLE 0x00100000
239#define K2_FCR1_GMAC_CLK_ENABLE 0x00400000 244#define K2_FCR1_GMAC_CLK_ENABLE 0x00400000
240#define K2_FCR1_GMAC_POWER_DOWN 0x00800000 245#define K2_FCR1_GMAC_POWER_DOWN 0x00800000
241#define K2_FCR1_GMAC_RESET_N 0x01000000 246#define K2_FCR1_GMAC_RESET_N 0x01000000
@@ -246,3 +251,11 @@
246#define K2_FCR1_UATA_RESET_N 0x40000000 251#define K2_FCR1_UATA_RESET_N 0x40000000
247#define K2_FCR1_UATA_CHOOSE_CLK66 0x80000000 252#define K2_FCR1_UATA_CHOOSE_CLK66 0x80000000
248 253
254/* Shasta definitions */
255#define SH_FCR1_I2S2_CELL_ENABLE 0x00000010
256#define SH_FCR1_I2S2_CLK_ENABLE_BIT 0x00000040
257#define SH_FCR1_I2S2_ENABLE 0x00000080
258#define SH_FCR3_I2S2_CLK18_ENABLE 0x00008000
259
260#endif /* __KERNEL__ */
261#endif /* _ASM_POWERPC_KEYLARGO_H */
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h
index 6cd0a3bfa280..f466bc804f41 100644
--- a/include/asm-powerpc/kprobes.h
+++ b/include/asm-powerpc/kprobes.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_KPROBES_H 1#ifndef _ASM_POWERPC_KPROBES_H
2#define _ASM_POWERPC_KPROBES_H 2#define _ASM_POWERPC_KPROBES_H
3#ifdef __KERNEL__
3/* 4/*
4 * Kernel Probes (KProbes) 5 * Kernel Probes (KProbes)
5 * 6 *
@@ -29,7 +30,10 @@
29#include <linux/ptrace.h> 30#include <linux/ptrace.h>
30#include <linux/percpu.h> 31#include <linux/percpu.h>
31 32
33#define __ARCH_WANT_KPROBES_INSN_SLOT
34
32struct pt_regs; 35struct pt_regs;
36struct kprobe;
33 37
34typedef unsigned int kprobe_opcode_t; 38typedef unsigned int kprobe_opcode_t;
35#define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ 39#define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */
@@ -47,6 +51,7 @@ typedef unsigned int kprobe_opcode_t;
47 51
48#define ARCH_SUPPORTS_KRETPROBES 52#define ARCH_SUPPORTS_KRETPROBES
49void kretprobe_trampoline(void); 53void kretprobe_trampoline(void);
54extern void arch_remove_kprobe(struct kprobe *p);
50 55
51/* Architecture specific copy of original instruction */ 56/* Architecture specific copy of original instruction */
52struct arch_specific_insn { 57struct arch_specific_insn {
@@ -68,14 +73,7 @@ struct kprobe_ctlblk {
68 struct prev_kprobe prev_kprobe; 73 struct prev_kprobe prev_kprobe;
69}; 74};
70 75
71#ifdef CONFIG_KPROBES
72extern int kprobe_exceptions_notify(struct notifier_block *self, 76extern int kprobe_exceptions_notify(struct notifier_block *self,
73 unsigned long val, void *data); 77 unsigned long val, void *data);
74#else /* !CONFIG_KPROBES */ 78#endif /* __KERNEL__ */
75static inline int kprobe_exceptions_notify(struct notifier_block *self,
76 unsigned long val, void *data)
77{
78 return 0;
79}
80#endif
81#endif /* _ASM_POWERPC_KPROBES_H */ 79#endif /* _ASM_POWERPC_KPROBES_H */
diff --git a/include/asm-powerpc/lmb.h b/include/asm-powerpc/lmb.h
index ea0afe343545..d3546c4c9f46 100644
--- a/include/asm-powerpc/lmb.h
+++ b/include/asm-powerpc/lmb.h
@@ -1,5 +1,6 @@
1#ifndef _PPC64_LMB_H 1#ifndef _PPC64_LMB_H
2#define _PPC64_LMB_H 2#define _PPC64_LMB_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Definitions for talking to the Open Firmware PROM on 6 * Definitions for talking to the Open Firmware PROM on
@@ -78,4 +79,5 @@ lmb_end_pfn(struct lmb_region *type, unsigned long region_nr)
78 lmb_size_pages(type, region_nr); 79 lmb_size_pages(type, region_nr);
79} 80}
80 81
82#endif /* __KERNEL__ */
81#endif /* _PPC64_LMB_H */ 83#endif /* _PPC64_LMB_H */
diff --git a/include/asm-powerpc/lppaca.h b/include/asm-powerpc/lppaca.h
index c1bedab1515b..ff82ea7c4829 100644
--- a/include/asm-powerpc/lppaca.h
+++ b/include/asm-powerpc/lppaca.h
@@ -18,6 +18,7 @@
18 */ 18 */
19#ifndef _ASM_POWERPC_LPPACA_H 19#ifndef _ASM_POWERPC_LPPACA_H
20#define _ASM_POWERPC_LPPACA_H 20#define _ASM_POWERPC_LPPACA_H
21#ifdef __KERNEL__
21 22
22//============================================================================= 23//=============================================================================
23// 24//
@@ -128,4 +129,5 @@ struct lppaca {
128 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF 129 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF
129}; 130};
130 131
132#endif /* __KERNEL__ */
131#endif /* _ASM_POWERPC_LPPACA_H */ 133#endif /* _ASM_POWERPC_LPPACA_H */
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index c011abb8b600..5348b820788c 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -27,6 +27,9 @@ struct device_node;
27struct iommu_table; 27struct iommu_table;
28struct rtc_time; 28struct rtc_time;
29struct file; 29struct file;
30#ifdef CONFIG_KEXEC
31struct kimage;
32#endif
30 33
31#ifdef CONFIG_SMP 34#ifdef CONFIG_SMP
32struct smp_ops_t { 35struct smp_ops_t {
@@ -131,7 +134,7 @@ struct machdep_calls {
131 void (*nvram_sync)(void); 134 void (*nvram_sync)(void);
132 135
133 /* Exception handlers */ 136 /* Exception handlers */
134 void (*system_reset_exception)(struct pt_regs *regs); 137 int (*system_reset_exception)(struct pt_regs *regs);
135 int (*machine_check_exception)(struct pt_regs *regs); 138 int (*machine_check_exception)(struct pt_regs *regs);
136 139
137 /* Motherboard/chipset features. This is a kind of general purpose 140 /* Motherboard/chipset features. This is a kind of general purpose
@@ -207,19 +210,19 @@ struct machdep_calls {
207 210
208 /* this is for modules, since _machine can be a define -- Cort */ 211 /* this is for modules, since _machine can be a define -- Cort */
209 int ppc_machine; 212 int ppc_machine;
213#endif /* CONFIG_PPC32 */
210 214
211#ifdef CONFIG_KEXEC
212 /* Called to shutdown machine specific hardware not already controlled 215 /* Called to shutdown machine specific hardware not already controlled
213 * by other drivers. 216 * by other drivers.
214 * XXX Should we move this one out of kexec scope?
215 */ 217 */
216 void (*machine_shutdown)(void); 218 void (*machine_shutdown)(void);
217 219
220#ifdef CONFIG_KEXEC
218 /* Called to do the minimal shutdown needed to run a kexec'd kernel 221 /* Called to do the minimal shutdown needed to run a kexec'd kernel
219 * to run successfully. 222 * to run successfully.
220 * XXX Should we move this one out of kexec scope? 223 * XXX Should we move this one out of kexec scope?
221 */ 224 */
222 void (*machine_crash_shutdown)(void); 225 void (*machine_crash_shutdown)(struct pt_regs *regs);
223 226
224 /* Called to do what every setup is needed on image and the 227 /* Called to do what every setup is needed on image and the
225 * reboot code buffer. Returns 0 on success. 228 * reboot code buffer. Returns 0 on success.
@@ -237,7 +240,6 @@ struct machdep_calls {
237 */ 240 */
238 void (*machine_kexec)(struct kimage *image); 241 void (*machine_kexec)(struct kimage *image);
239#endif /* CONFIG_KEXEC */ 242#endif /* CONFIG_KEXEC */
240#endif /* CONFIG_PPC32 */
241}; 243};
242 244
243extern void default_idle(void); 245extern void default_idle(void);
diff --git a/include/asm-powerpc/macio.h b/include/asm-powerpc/macio.h
index b553dd4b139e..3a6cb1a513b7 100644
--- a/include/asm-powerpc/macio.h
+++ b/include/asm-powerpc/macio.h
@@ -1,5 +1,6 @@
1#ifndef __MACIO_ASIC_H__ 1#ifndef __MACIO_ASIC_H__
2#define __MACIO_ASIC_H__ 2#define __MACIO_ASIC_H__
3#ifdef __KERNEL__
3 4
4#include <asm/of_device.h> 5#include <asm/of_device.h>
5 6
@@ -137,4 +138,5 @@ struct macio_driver
137extern int macio_register_driver(struct macio_driver *); 138extern int macio_register_driver(struct macio_driver *);
138extern void macio_unregister_driver(struct macio_driver *); 139extern void macio_unregister_driver(struct macio_driver *);
139 140
141#endif /* __KERNEL__ */
140#endif /* __MACIO_ASIC_H__ */ 142#endif /* __MACIO_ASIC_H__ */
diff --git a/include/asm-powerpc/mman.h b/include/asm-powerpc/mman.h
index f5e5342fcac5..a2e34c21b44f 100644
--- a/include/asm-powerpc/mman.h
+++ b/include/asm-powerpc/mman.h
@@ -44,6 +44,7 @@
44#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 44#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
45#define MADV_WILLNEED 0x3 /* pre-fault pages */ 45#define MADV_WILLNEED 0x3 /* pre-fault pages */
46#define MADV_DONTNEED 0x4 /* discard these pages */ 46#define MADV_DONTNEED 0x4 /* discard these pages */
47#define MADV_REMOVE 0x5 /* remove these pages & resources */
47 48
48/* compatibility flags */ 49/* compatibility flags */
49#define MAP_ANON MAP_ANONYMOUS 50#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index 29b0bb0086d3..d096d9e76ad7 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_MMU_H_ 1#ifndef _ASM_POWERPC_MMU_H_
2#define _ASM_POWERPC_MMU_H_ 2#define _ASM_POWERPC_MMU_H_
3#ifdef __KERNEL__
3 4
4#ifndef CONFIG_PPC64 5#ifndef CONFIG_PPC64
5#include <asm-ppc/mmu.h> 6#include <asm-ppc/mmu.h>
@@ -33,7 +34,8 @@
33 34
34/* Location of cpu0's segment table */ 35/* Location of cpu0's segment table */
35#define STAB0_PAGE 0x6 36#define STAB0_PAGE 0x6
36#define STAB0_PHYS_ADDR (STAB0_PAGE<<12) 37#define STAB0_OFFSET (STAB0_PAGE << 12)
38#define STAB0_PHYS_ADDR (STAB0_OFFSET + PHYSICAL_START)
37 39
38#ifndef __ASSEMBLY__ 40#ifndef __ASSEMBLY__
39extern char initial_stab[]; 41extern char initial_stab[];
@@ -394,7 +396,12 @@ static inline unsigned long get_vsid(unsigned long context, unsigned long ea)
394#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS) 396#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS)
395#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea)) 397#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
396 398
399/* Physical address used by some IO functions */
400typedef unsigned long phys_addr_t;
401
402
397#endif /* __ASSEMBLY */ 403#endif /* __ASSEMBLY */
398 404
399#endif /* CONFIG_PPC64 */ 405#endif /* CONFIG_PPC64 */
406#endif /* __KERNEL__ */
400#endif /* _ASM_POWERPC_MMU_H_ */ 407#endif /* _ASM_POWERPC_MMU_H_ */
diff --git a/include/asm-powerpc/mmu_context.h b/include/asm-powerpc/mmu_context.h
index ea6798c7d5fc..1b8a25fd48f3 100644
--- a/include/asm-powerpc/mmu_context.h
+++ b/include/asm-powerpc/mmu_context.h
@@ -1,5 +1,6 @@
1#ifndef __ASM_POWERPC_MMU_CONTEXT_H 1#ifndef __ASM_POWERPC_MMU_CONTEXT_H
2#define __ASM_POWERPC_MMU_CONTEXT_H 2#define __ASM_POWERPC_MMU_CONTEXT_H
3#ifdef __KERNEL__
3 4
4#ifndef CONFIG_PPC64 5#ifndef CONFIG_PPC64
5#include <asm-ppc/mmu_context.h> 6#include <asm-ppc/mmu_context.h>
@@ -86,4 +87,5 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
86} 87}
87 88
88#endif /* CONFIG_PPC64 */ 89#endif /* CONFIG_PPC64 */
90#endif /* __KERNEL__ */
89#endif /* __ASM_POWERPC_MMU_CONTEXT_H */ 91#endif /* __ASM_POWERPC_MMU_CONTEXT_H */
diff --git a/include/asm-powerpc/mmzone.h b/include/asm-powerpc/mmzone.h
index 54958d6cae04..88d70bae7769 100644
--- a/include/asm-powerpc/mmzone.h
+++ b/include/asm-powerpc/mmzone.h
@@ -6,6 +6,7 @@
6 */ 6 */
7#ifndef _ASM_MMZONE_H_ 7#ifndef _ASM_MMZONE_H_
8#define _ASM_MMZONE_H_ 8#define _ASM_MMZONE_H_
9#ifdef __KERNEL__
9 10
10#include <linux/config.h> 11#include <linux/config.h>
11 12
@@ -47,4 +48,5 @@ extern unsigned long max_pfn;
47extern int __init early_pfn_to_nid(unsigned long pfn); 48extern int __init early_pfn_to_nid(unsigned long pfn);
48#endif 49#endif
49 50
51#endif /* __KERNEL__ */
50#endif /* _ASM_MMZONE_H_ */ 52#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h
index 7ecd05e03051..584fabfb4f08 100644
--- a/include/asm-powerpc/module.h
+++ b/include/asm-powerpc/module.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_MODULE_H 1#ifndef _ASM_POWERPC_MODULE_H
2#define _ASM_POWERPC_MODULE_H 2#define _ASM_POWERPC_MODULE_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -74,4 +75,5 @@ struct exception_table_entry;
74void sort_ex_table(struct exception_table_entry *start, 75void sort_ex_table(struct exception_table_entry *start,
75 struct exception_table_entry *finish); 76 struct exception_table_entry *finish);
76 77
78#endif /* __KERNEL__ */
77#endif /* _ASM_POWERPC_MODULE_H */ 79#endif /* _ASM_POWERPC_MODULE_H */
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index 7083d1f74260..6b9e78142f4f 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_MPIC_H 1#ifndef _ASM_POWERPC_MPIC_H
2#define _ASM_POWERPC_MPIC_H 2#define _ASM_POWERPC_MPIC_H
3#ifdef __KERNEL__
3 4
4#include <linux/irq.h> 5#include <linux/irq.h>
5 6
@@ -117,7 +118,9 @@ typedef int (*mpic_cascade_t)(struct pt_regs *regs, void *data);
117struct mpic_irq_fixup 118struct mpic_irq_fixup
118{ 119{
119 u8 __iomem *base; 120 u8 __iomem *base;
120 unsigned int irq; 121 u8 __iomem *applebase;
122 u32 data;
123 unsigned int index;
121}; 124};
122#endif /* CONFIG_MPIC_BROKEN_U3 */ 125#endif /* CONFIG_MPIC_BROKEN_U3 */
123 126
@@ -284,4 +287,5 @@ extern int mpic_get_irq(struct pt_regs *regs);
284/* global mpic for pSeries */ 287/* global mpic for pSeries */
285extern struct mpic *pSeries_mpic; 288extern struct mpic *pSeries_mpic;
286 289
290#endif /* __KERNEL__ */
287#endif /* _ASM_POWERPC_MPIC_H */ 291#endif /* _ASM_POWERPC_MPIC_H */
diff --git a/include/asm-powerpc/mutex.h b/include/asm-powerpc/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-powerpc/mutex.h
@@ -0,0 +1,9 @@
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-powerpc/numnodes.h b/include/asm-powerpc/numnodes.h
index 795533aca095..e138edae09dd 100644
--- a/include/asm-powerpc/numnodes.h
+++ b/include/asm-powerpc/numnodes.h
@@ -1,7 +1,9 @@
1#ifndef _ASM_POWERPC_MAX_NUMNODES_H 1#ifndef _ASM_POWERPC_MAX_NUMNODES_H
2#define _ASM_POWERPC_MAX_NUMNODES_H 2#define _ASM_POWERPC_MAX_NUMNODES_H
3#ifdef __KERNEL__
3 4
4/* Max 16 Nodes */ 5/* Max 16 Nodes */
5#define NODES_SHIFT 4 6#define NODES_SHIFT 4
6 7
8#endif /* __KERNEL__ */
7#endif /* _ASM_POWERPC_MAX_NUMNODES_H */ 9#endif /* _ASM_POWERPC_MAX_NUMNODES_H */
diff --git a/include/asm-powerpc/nvram.h b/include/asm-powerpc/nvram.h
index 24bd8c2388ea..f3563e11e260 100644
--- a/include/asm-powerpc/nvram.h
+++ b/include/asm-powerpc/nvram.h
@@ -55,6 +55,7 @@ struct nvram_header {
55 char name[12]; 55 char name[12];
56}; 56};
57 57
58#ifdef __KERNEL__
58struct nvram_partition { 59struct nvram_partition {
59 struct list_head partition; 60 struct list_head partition;
60 struct nvram_header header; 61 struct nvram_header header;
@@ -69,6 +70,7 @@ extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
69 70
70extern int pSeries_nvram_init(void); 71extern int pSeries_nvram_init(void);
71extern int mmio_nvram_init(void); 72extern int mmio_nvram_init(void);
73#endif /* __KERNEL__ */
72 74
73/* PowerMac specific nvram stuffs */ 75/* PowerMac specific nvram stuffs */
74 76
@@ -78,6 +80,7 @@ enum {
78 pmac_nvram_NR /* MacOS Name Registry partition */ 80 pmac_nvram_NR /* MacOS Name Registry partition */
79}; 81};
80 82
83#ifdef __KERNEL__
81/* Return partition offset in nvram */ 84/* Return partition offset in nvram */
82extern int pmac_get_partition(int partition); 85extern int pmac_get_partition(int partition);
83 86
@@ -91,6 +94,7 @@ extern void nvram_sync(void);
91/* Normal access to NVRAM */ 94/* Normal access to NVRAM */
92extern unsigned char nvram_read_byte(int i); 95extern unsigned char nvram_read_byte(int i);
93extern void nvram_write_byte(unsigned char c, int i); 96extern void nvram_write_byte(unsigned char c, int i);
97#endif
94 98
95/* Some offsets in XPRAM */ 99/* Some offsets in XPRAM */
96#define PMAC_XPRAM_MACHINE_LOC 0xe4 100#define PMAC_XPRAM_MACHINE_LOC 0xe4
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index ddb16aae0bd6..6249a7c39639 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_OF_DEVICE_H 1#ifndef _ASM_POWERPC_OF_DEVICE_H
2#define _ASM_POWERPC_OF_DEVICE_H 2#define _ASM_POWERPC_OF_DEVICE_H
3#ifdef __KERNEL__
3 4
4#include <linux/device.h> 5#include <linux/device.h>
5#include <linux/mod_devicetable.h> 6#include <linux/mod_devicetable.h>
@@ -61,4 +62,5 @@ extern struct of_device *of_platform_device_create(struct device_node *np,
61 struct device *parent); 62 struct device *parent);
62extern void of_release_dev(struct device *dev); 63extern void of_release_dev(struct device *dev);
63 64
65#endif /* __KERNEL__ */
64#endif /* _ASM_POWERPC_OF_DEVICE_H */ 66#endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/include/asm-powerpc/ohare.h b/include/asm-powerpc/ohare.h
index 023b59772231..0d030f9dea24 100644
--- a/include/asm-powerpc/ohare.h
+++ b/include/asm-powerpc/ohare.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_POWERPC_OHARE_H
2#define _ASM_POWERPC_OHARE_H
3#ifdef __KERNEL__
1/* 4/*
2 * ohare.h: definitions for using the "O'Hare" I/O controller chip. 5 * ohare.h: definitions for using the "O'Hare" I/O controller chip.
3 * 6 *
@@ -46,3 +49,6 @@
46 * Contributed by Harry Eaton. 49 * Contributed by Harry Eaton.
47 */ 50 */
48#define STARMAX_FEATURES 0xbeff7a 51#define STARMAX_FEATURES 0xbeff7a
52
53#endif /* __KERNEL__ */
54#endif /* _ASM_POWERPC_OHARE_H */
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 8013cd273ced..338e6a7cff4a 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -11,6 +11,7 @@
11 11
12#ifndef _ASM_POWERPC_OPROFILE_IMPL_H 12#ifndef _ASM_POWERPC_OPROFILE_IMPL_H
13#define _ASM_POWERPC_OPROFILE_IMPL_H 13#define _ASM_POWERPC_OPROFILE_IMPL_H
14#ifdef __KERNEL__
14 15
15#define OP_MAX_COUNTER 8 16#define OP_MAX_COUNTER 8
16 17
@@ -22,24 +23,22 @@ struct op_counter_config {
22 unsigned long enabled; 23 unsigned long enabled;
23 unsigned long event; 24 unsigned long event;
24 unsigned long count; 25 unsigned long count;
26 /* Classic doesn't support per-counter user/kernel selection */
25 unsigned long kernel; 27 unsigned long kernel;
26#ifdef __powerpc64__
27 /* We dont support per counter user/kernel selection */
28#endif
29 unsigned long user; 28 unsigned long user;
30 unsigned long unit_mask; 29 unsigned long unit_mask;
31}; 30};
32 31
33/* System-wide configuration as set via oprofilefs. */ 32/* System-wide configuration as set via oprofilefs. */
34struct op_system_config { 33struct op_system_config {
35#ifdef __powerpc64__ 34#ifdef CONFIG_PPC64
36 unsigned long mmcr0; 35 unsigned long mmcr0;
37 unsigned long mmcr1; 36 unsigned long mmcr1;
38 unsigned long mmcra; 37 unsigned long mmcra;
39#endif 38#endif
40 unsigned long enable_kernel; 39 unsigned long enable_kernel;
41 unsigned long enable_user; 40 unsigned long enable_user;
42#ifdef __powerpc64__ 41#ifdef CONFIG_PPC64
43 unsigned long backtrace_spinlocks; 42 unsigned long backtrace_spinlocks;
44#endif 43#endif
45}; 44};
@@ -49,9 +48,7 @@ struct op_powerpc_model {
49 void (*reg_setup) (struct op_counter_config *, 48 void (*reg_setup) (struct op_counter_config *,
50 struct op_system_config *, 49 struct op_system_config *,
51 int num_counters); 50 int num_counters);
52#ifdef __powerpc64__
53 void (*cpu_setup) (void *); 51 void (*cpu_setup) (void *);
54#endif
55 void (*start) (struct op_counter_config *); 52 void (*start) (struct op_counter_config *);
56 void (*stop) (void); 53 void (*stop) (void);
57 void (*handle_interrupt) (struct pt_regs *, 54 void (*handle_interrupt) (struct pt_regs *,
@@ -59,10 +56,19 @@ struct op_powerpc_model {
59 int num_counters; 56 int num_counters;
60}; 57};
61 58
62#ifdef __powerpc64__ 59#ifdef CONFIG_FSL_BOOKE
60extern struct op_powerpc_model op_model_fsl_booke;
61#else /* Otherwise, it's classic */
62
63#ifdef CONFIG_PPC64
63extern struct op_powerpc_model op_model_rs64; 64extern struct op_powerpc_model op_model_rs64;
64extern struct op_powerpc_model op_model_power4; 65extern struct op_powerpc_model op_model_power4;
65 66
67#else /* Otherwise, CONFIG_PPC32 */
68extern struct op_powerpc_model op_model_7450;
69#endif
70
71/* All the classic PPC parts use these */
66static inline unsigned int ctr_read(unsigned int i) 72static inline unsigned int ctr_read(unsigned int i)
67{ 73{
68 switch(i) { 74 switch(i) {
@@ -78,10 +84,14 @@ static inline unsigned int ctr_read(unsigned int i)
78 return mfspr(SPRN_PMC5); 84 return mfspr(SPRN_PMC5);
79 case 5: 85 case 5:
80 return mfspr(SPRN_PMC6); 86 return mfspr(SPRN_PMC6);
87
88/* No PPC32 chip has more than 6 so far */
89#ifdef CONFIG_PPC64
81 case 6: 90 case 6:
82 return mfspr(SPRN_PMC7); 91 return mfspr(SPRN_PMC7);
83 case 7: 92 case 7:
84 return mfspr(SPRN_PMC8); 93 return mfspr(SPRN_PMC8);
94#endif
85 default: 95 default:
86 return 0; 96 return 0;
87 } 97 }
@@ -108,16 +118,21 @@ static inline void ctr_write(unsigned int i, unsigned int val)
108 case 5: 118 case 5:
109 mtspr(SPRN_PMC6, val); 119 mtspr(SPRN_PMC6, val);
110 break; 120 break;
121
122/* No PPC32 chip has more than 6, yet */
123#ifdef CONFIG_PPC64
111 case 6: 124 case 6:
112 mtspr(SPRN_PMC7, val); 125 mtspr(SPRN_PMC7, val);
113 break; 126 break;
114 case 7: 127 case 7:
115 mtspr(SPRN_PMC8, val); 128 mtspr(SPRN_PMC8, val);
116 break; 129 break;
130#endif
117 default: 131 default:
118 break; 132 break;
119 } 133 }
120} 134}
121#endif /* __powerpc64__ */ 135#endif /* !CONFIG_FSL_BOOKE */
122 136
137#endif /* __KERNEL__ */
123#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */ 138#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */
diff --git a/include/asm-powerpc/pSeries_reconfig.h b/include/asm-powerpc/pSeries_reconfig.h
index c0db1ea7f7d1..ea6cfb8efb84 100644
--- a/include/asm-powerpc/pSeries_reconfig.h
+++ b/include/asm-powerpc/pSeries_reconfig.h
@@ -1,5 +1,6 @@
1#ifndef _PPC64_PSERIES_RECONFIG_H 1#ifndef _PPC64_PSERIES_RECONFIG_H
2#define _PPC64_PSERIES_RECONFIG_H 2#define _PPC64_PSERIES_RECONFIG_H
3#ifdef __KERNEL__
3 4
4#include <linux/notifier.h> 5#include <linux/notifier.h>
5 6
@@ -22,4 +23,5 @@ static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb)
22static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { } 23static inline void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) { }
23#endif /* CONFIG_PPC_PSERIES */ 24#endif /* CONFIG_PPC_PSERIES */
24 25
26#endif /* __KERNEL__ */
25#endif /* _PPC64_PSERIES_RECONFIG_H */ 27#endif /* _PPC64_PSERIES_RECONFIG_H */
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index 92c765c35bd0..a64b4d425dab 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -14,11 +14,11 @@
14 */ 14 */
15#ifndef _ASM_POWERPC_PACA_H 15#ifndef _ASM_POWERPC_PACA_H
16#define _ASM_POWERPC_PACA_H 16#define _ASM_POWERPC_PACA_H
17#ifdef __KERNEL__
17 18
18#include <linux/config.h> 19#include <linux/config.h>
19#include <asm/types.h> 20#include <asm/types.h>
20#include <asm/lppaca.h> 21#include <asm/lppaca.h>
21#include <asm/iseries/it_lp_reg_save.h>
22#include <asm/mmu.h> 22#include <asm/mmu.h>
23 23
24register struct paca_struct *local_paca asm("r13"); 24register struct paca_struct *local_paca asm("r13");
@@ -31,9 +31,9 @@ struct task_struct;
31 * 31 *
32 * This structure is not directly accessed by firmware or the service 32 * This structure is not directly accessed by firmware or the service
33 * processor except for the first two pointers that point to the 33 * processor except for the first two pointers that point to the
34 * lppaca area and the ItLpRegSave area for this CPU. Both the 34 * lppaca area and the ItLpRegSave area for this CPU. The lppaca
35 * lppaca and ItLpRegSave objects are currently contained within the 35 * object is currently contained within the PACA but it doesn't need
36 * PACA but they do not need to be. 36 * to be.
37 */ 37 */
38struct paca_struct { 38struct paca_struct {
39 /* 39 /*
@@ -48,7 +48,9 @@ struct paca_struct {
48 * accessed by the firmware 48 * accessed by the firmware
49 */ 49 */
50 struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */ 50 struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */
51 struct ItLpRegSave *reg_save_ptr; /* Pointer to LpRegSave for PLIC */ 51#ifdef CONFIG_PPC_ISERIES
52 void *reg_save_ptr; /* Pointer to LpRegSave for PLIC */
53#endif /* CONFIG_PPC_ISERIES */
52 54
53 /* 55 /*
54 * MAGIC: the spinlock functions in arch/ppc64/lib/locks.c 56 * MAGIC: the spinlock functions in arch/ppc64/lib/locks.c
@@ -59,11 +61,11 @@ struct paca_struct {
59 u16 lock_token; /* Constant 0x8000, used in locks */ 61 u16 lock_token; /* Constant 0x8000, used in locks */
60 u16 paca_index; /* Logical processor number */ 62 u16 paca_index; /* Logical processor number */
61 63
62 u32 default_decr; /* Default decrementer value */
63 u64 kernel_toc; /* Kernel TOC address */ 64 u64 kernel_toc; /* Kernel TOC address */
64 u64 stab_real; /* Absolute address of segment table */ 65 u64 stab_real; /* Absolute address of segment table */
65 u64 stab_addr; /* Virtual address of segment table */ 66 u64 stab_addr; /* Virtual address of segment table */
66 void *emergency_sp; /* pointer to emergency stack */ 67 void *emergency_sp; /* pointer to emergency stack */
68 u64 data_offset; /* per cpu data offset */
67 s16 hw_cpu_id; /* Physical processor number */ 69 s16 hw_cpu_id; /* Physical processor number */
68 u8 cpu_start; /* At startup, processor spins until */ 70 u8 cpu_start; /* At startup, processor spins until */
69 /* this becomes non-zero. */ 71 /* this becomes non-zero. */
@@ -90,14 +92,10 @@ struct paca_struct {
90 struct task_struct *__current; /* Pointer to current */ 92 struct task_struct *__current; /* Pointer to current */
91 u64 kstack; /* Saved Kernel stack addr */ 93 u64 kstack; /* Saved Kernel stack addr */
92 u64 stab_rr; /* stab/slb round-robin counter */ 94 u64 stab_rr; /* stab/slb round-robin counter */
93 u64 next_jiffy_update_tb; /* TB value for next jiffy update */
94 u64 saved_r1; /* r1 save for RTAS calls */ 95 u64 saved_r1; /* r1 save for RTAS calls */
95 u64 saved_msr; /* MSR saved here by enter_rtas */ 96 u64 saved_msr; /* MSR saved here by enter_rtas */
96 u8 proc_enabled; /* irq soft-enable flag */ 97 u8 proc_enabled; /* irq soft-enable flag */
97 98
98 /* not yet used */
99 u64 exdsi[8]; /* used for linear mapping hash table misses */
100
101 /* 99 /*
102 * iSeries structure which the hypervisor knows about - 100 * iSeries structure which the hypervisor knows about -
103 * this structure should not cross a page boundary. 101 * this structure should not cross a page boundary.
@@ -110,11 +108,9 @@ struct paca_struct {
110 * cross a page boundary. 108 * cross a page boundary.
111 */ 109 */
112 struct lppaca lppaca __attribute__((__aligned__(0x400))); 110 struct lppaca lppaca __attribute__((__aligned__(0x400)));
113#ifdef CONFIG_PPC_ISERIES
114 struct ItLpRegSave reg_save;
115#endif
116}; 111};
117 112
118extern struct paca_struct paca[]; 113extern struct paca_struct paca[];
119 114
115#endif /* __KERNEL__ */
120#endif /* _ASM_POWERPC_PACA_H */ 116#endif /* _ASM_POWERPC_PACA_H */
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
index 18c1e5ee81a3..0b82df483f7f 100644
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -37,8 +37,30 @@
37 */ 37 */
38#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) 38#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
39 39
40/*
41 * KERNELBASE is the virtual address of the start of the kernel, it's often
42 * the same as PAGE_OFFSET, but _might not be_.
43 *
44 * The kdump dump kernel is one example where KERNELBASE != PAGE_OFFSET.
45 *
46 * To get a physical address from a virtual one you subtract PAGE_OFFSET,
47 * _not_ KERNELBASE.
48 *
49 * If you want to know something's offset from the start of the kernel you
50 * should subtract KERNELBASE.
51 *
52 * If you want to test if something's a kernel address, use is_kernel_addr().
53 */
54
55#ifdef CONFIG_CRASH_DUMP
56/* Kdump kernel runs at 32 MB, change at your peril. */
57#define PHYSICAL_START 0x2000000
58#else
59#define PHYSICAL_START 0x0
60#endif
61
40#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) 62#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START)
41#define KERNELBASE PAGE_OFFSET 63#define KERNELBASE (PAGE_OFFSET + PHYSICAL_START)
42 64
43#ifdef CONFIG_DISCONTIGMEM 65#ifdef CONFIG_DISCONTIGMEM
44#define page_to_pfn(page) discontigmem_page_to_pfn(page) 66#define page_to_pfn(page) discontigmem_page_to_pfn(page)
@@ -56,7 +78,7 @@
56#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 78#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
57#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 79#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
58 80
59#define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) 81#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
60#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) 82#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
61 83
62/* 84/*
@@ -86,6 +108,12 @@
86/* to align the pointer to the (next) page boundary */ 108/* to align the pointer to the (next) page boundary */
87#define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) 109#define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE)
88 110
111/*
112 * Don't compare things with KERNELBASE or PAGE_OFFSET to test for
113 * "kernelness", use is_kernel_addr() - it should do what you want.
114 */
115#define is_kernel_addr(x) ((x) >= PAGE_OFFSET)
116
89#ifndef __ASSEMBLY__ 117#ifndef __ASSEMBLY__
90 118
91#undef STRICT_MM_TYPECHECKS 119#undef STRICT_MM_TYPECHECKS
@@ -150,7 +178,7 @@ typedef unsigned long pmd_t;
150#define pmd_val(x) (x) 178#define pmd_val(x) (x)
151#define __pmd(x) (x) 179#define __pmd(x) (x)
152 180
153#ifndef CONFIG_PPC_64K_PAGES 181#if defined(CONFIG_PPC64) && !defined(CONFIG_PPC_64K_PAGES)
154typedef unsigned long pud_t; 182typedef unsigned long pud_t;
155#define pud_val(x) (x) 183#define pud_val(x) (x)
156#define __pud(x) (x) 184#define __pud(x) (x)
diff --git a/include/asm-powerpc/page_32.h b/include/asm-powerpc/page_32.h
index 7259cfd85da9..2677bad70f40 100644
--- a/include/asm-powerpc/page_32.h
+++ b/include/asm-powerpc/page_32.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_PAGE_32_H 1#ifndef _ASM_POWERPC_PAGE_32_H
2#define _ASM_POWERPC_PAGE_32_H 2#define _ASM_POWERPC_PAGE_32_H
3#ifdef __KERNEL__
3 4
4#define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32 5#define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32
5 6
@@ -37,4 +38,5 @@ extern __inline__ int get_order(unsigned long size)
37 38
38#endif /* __ASSEMBLY__ */ 39#endif /* __ASSEMBLY__ */
39 40
41#endif /* __KERNEL__ */
40#endif /* _ASM_POWERPC_PAGE_32_H */ 42#endif /* _ASM_POWERPC_PAGE_32_H */
diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h
index 6642c0125001..3fb061bab9ec 100644
--- a/include/asm-powerpc/page_64.h
+++ b/include/asm-powerpc/page_64.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_PAGE_64_H 1#ifndef _ASM_POWERPC_PAGE_64_H
2#define _ASM_POWERPC_PAGE_64_H 2#define _ASM_POWERPC_PAGE_64_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Copyright (C) 2001 PPC64 Team, IBM Corp 6 * Copyright (C) 2001 PPC64 Team, IBM Corp
@@ -25,16 +26,6 @@
25 */ 26 */
26#define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT) 27#define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT)
27 28
28#define REGION_SIZE 4UL
29#define REGION_SHIFT 60UL
30#define REGION_MASK (((1UL<<REGION_SIZE)-1UL)<<REGION_SHIFT)
31
32#define VMALLOCBASE ASM_CONST(0xD000000000000000)
33#define VMALLOC_REGION_ID (VMALLOCBASE >> REGION_SHIFT)
34#define KERNEL_REGION_ID (KERNELBASE >> REGION_SHIFT)
35#define USER_REGION_ID (0UL)
36#define REGION_ID(ea) (((unsigned long)(ea)) >> REGION_SHIFT)
37
38/* Segment size */ 29/* Segment size */
39#define SID_SHIFT 28 30#define SID_SHIFT 28
40#define SID_MASK 0xfffffffffUL 31#define SID_MASK 0xfffffffffUL
@@ -180,4 +171,5 @@ extern unsigned int HPAGE_SHIFT;
180 171
181#include <asm-generic/page.h> 172#include <asm-generic/page.h>
182 173
174#endif /* __KERNEL__ */
183#endif /* _ASM_POWERPC_PAGE_64_H */ 175#endif /* _ASM_POWERPC_PAGE_64_H */
diff --git a/include/asm-powerpc/param.h b/include/asm-powerpc/param.h
index bdc724f70884..094f63d4d5ca 100644
--- a/include/asm-powerpc/param.h
+++ b/include/asm-powerpc/param.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_POWERPC_PARAM_H 1#ifndef _ASM_POWERPC_PARAM_H
2#define _ASM_POWERPC_PARAM_H 2#define _ASM_POWERPC_PARAM_H
3 3
4#include <linux/config.h>
5
6#ifdef __KERNEL__ 4#ifdef __KERNEL__
7#define HZ CONFIG_HZ /* internal kernel timer frequency */ 5#define HZ CONFIG_HZ /* internal kernel timer frequency */
8#define USER_HZ 100 /* for user interfaces in "ticks" */ 6#define USER_HZ 100 /* for user interfaces in "ticks" */
diff --git a/include/asm-powerpc/parport.h b/include/asm-powerpc/parport.h
index d86b410a6f8b..3fca21ddf546 100644
--- a/include/asm-powerpc/parport.h
+++ b/include/asm-powerpc/parport.h
@@ -8,11 +8,37 @@
8 8
9#ifndef _ASM_POWERPC_PARPORT_H 9#ifndef _ASM_POWERPC_PARPORT_H
10#define _ASM_POWERPC_PARPORT_H 10#define _ASM_POWERPC_PARPORT_H
11#ifdef __KERNEL__
12
13#include <asm/prom.h>
14
15extern struct parport *parport_pc_probe_port (unsigned long int base,
16 unsigned long int base_hi,
17 int irq, int dma,
18 struct pci_dev *dev);
11 19
12static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma);
13static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) 20static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
14{ 21{
15 return parport_pc_find_isa_ports (autoirq, autodma); 22 struct device_node *np;
23 u32 *prop;
24 u32 io1, io2;
25 int propsize;
26 int count = 0;
27 for (np = NULL; (np = of_find_compatible_node(np,
28 "parallel",
29 "pnpPNP,400")) != NULL;) {
30 prop = (u32 *)get_property(np, "reg", &propsize);
31 if (!prop || propsize > 6*sizeof(u32))
32 continue;
33 io1 = prop[1]; io2 = prop[2];
34 prop = (u32 *)get_property(np, "interrupts", NULL);
35 if (!prop)
36 continue;
37 if (parport_pc_probe_port(io1, io2, prop[0], autodma, NULL) != NULL)
38 count++;
39 }
40 return count;
16} 41}
17 42
43#endif /* __KERNEL__ */
18#endif /* !(_ASM_POWERPC_PARPORT_H) */ 44#endif /* !(_ASM_POWERPC_PARPORT_H) */
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index 223ec7bd81da..38de92d41a14 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_PCI_BRIDGE_H 1#ifndef _ASM_POWERPC_PCI_BRIDGE_H
2#define _ASM_POWERPC_PCI_BRIDGE_H 2#define _ASM_POWERPC_PCI_BRIDGE_H
3#ifdef __KERNEL__
3 4
4#ifndef CONFIG_PPC64 5#ifndef CONFIG_PPC64
5#include <asm-ppc/pci-bridge.h> 6#include <asm-ppc/pci-bridge.h>
@@ -60,16 +61,17 @@ struct pci_controller;
60struct iommu_table; 61struct iommu_table;
61 62
62struct pci_dn { 63struct pci_dn {
63 int busno; /* for pci devices */ 64 int busno; /* pci bus number */
64 int bussubno; /* for pci devices */ 65 int bussubno; /* pci subordinate bus number */
65 int devfn; /* for pci devices */ 66 int devfn; /* pci device and function number */
67 int class_code; /* pci device class */
66 68
67#ifdef CONFIG_PPC_PSERIES 69#ifdef CONFIG_PPC_PSERIES
68 int eeh_mode; /* See eeh.h for possible EEH_MODEs */ 70 int eeh_mode; /* See eeh.h for possible EEH_MODEs */
69 int eeh_config_addr; 71 int eeh_config_addr;
72 int eeh_pe_config_addr; /* new-style partition endpoint address */
70 int eeh_check_count; /* # times driver ignored error */ 73 int eeh_check_count; /* # times driver ignored error */
71 int eeh_freeze_count; /* # times this device froze up. */ 74 int eeh_freeze_count; /* # times this device froze up. */
72 int eeh_is_bridge; /* device is pci-to-pci bridge */
73#endif 75#endif
74 int pci_ext_config_space; /* for pci devices */ 76 int pci_ext_config_space; /* for pci devices */
75 struct pci_controller *phb; /* for pci devices */ 77 struct pci_controller *phb; /* for pci devices */
@@ -125,12 +127,20 @@ static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
125 return bus->sysdata; /* Must be root bus (PHB) */ 127 return bus->sysdata; /* Must be root bus (PHB) */
126} 128}
127 129
130/** Find the bus corresponding to the indicated device node */
131struct pci_bus * pcibios_find_pci_bus(struct device_node *dn);
132
128extern void pci_process_bridge_OF_ranges(struct pci_controller *hose, 133extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
129 struct device_node *dev, int primary); 134 struct device_node *dev, int primary);
130 135
131extern int pcibios_remove_root_bus(struct pci_controller *phb); 136/** Remove all of the PCI devices under this bus */
137void pcibios_remove_pci_devices(struct pci_bus *bus);
132 138
133extern void phbs_remap_io(void); 139/** Discover new pci devices under this bus, and add them */
140void pcibios_add_pci_devices(struct pci_bus * bus);
141void pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus);
142
143extern int pcibios_remove_root_bus(struct pci_controller *phb);
134 144
135static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus) 145static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
136{ 146{
@@ -140,14 +150,27 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
140 return PCI_DN(busdn)->phb; 150 return PCI_DN(busdn)->phb;
141} 151}
142 152
153extern struct pci_controller*
154pci_find_hose_for_OF_device(struct device_node* node);
155
143extern struct pci_controller * 156extern struct pci_controller *
144pcibios_alloc_controller(struct device_node *dev); 157pcibios_alloc_controller(struct device_node *dev);
145extern void pcibios_free_controller(struct pci_controller *phb); 158extern void pcibios_free_controller(struct pci_controller *phb);
146 159
160#ifdef CONFIG_PCI
161extern unsigned long pci_address_to_pio(phys_addr_t address);
162#else
163static inline unsigned long pci_address_to_pio(phys_addr_t address)
164{
165 return (unsigned long)-1;
166}
167#endif
168
147/* Return values for ppc_md.pci_probe_mode function */ 169/* Return values for ppc_md.pci_probe_mode function */
148#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ 170#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
149#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ 171#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
150#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ 172#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
151 173
152#endif /* CONFIG_PPC64 */ 174#endif /* CONFIG_PPC64 */
175#endif /* __KERNEL__ */
153#endif 176#endif
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index d5934a076bd0..5d2c9e6c4be2 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -216,6 +216,8 @@ extern int remap_bus_range(struct pci_bus *bus);
216extern void pcibios_fixup_device_resources(struct pci_dev *dev, 216extern void pcibios_fixup_device_resources(struct pci_dev *dev,
217 struct pci_bus *bus); 217 struct pci_bus *bus);
218 218
219extern void pcibios_claim_one_bus(struct pci_bus *b);
220
219extern struct pci_controller *init_phb_dynamic(struct device_node *dn); 221extern struct pci_controller *init_phb_dynamic(struct device_node *dn);
220 222
221extern struct pci_dev *of_create_pci_dev(struct device_node *node, 223extern struct pci_dev *of_create_pci_dev(struct device_node *node,
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
index 06a959d67234..e31922c50e53 100644
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -1 +1,57 @@
1#ifndef _ASM_POWERPC_PERCPU_H_
2#define _ASM_POWERPC_PERCPU_H_
3#ifdef __powerpc64__
4#include <linux/compiler.h>
5
6/*
7 * Same as asm-generic/percpu.h, except that we store the per cpu offset
8 * in the paca. Based on the x86-64 implementation.
9 */
10
11#ifdef CONFIG_SMP
12
13#include <asm/paca.h>
14
15#define __per_cpu_offset(cpu) (paca[cpu].data_offset)
16#define __my_cpu_offset() get_paca()->data_offset
17
18/* Separate out the type, so (int[3], foo) works. */
19#define DEFINE_PER_CPU(type, name) \
20 __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
21
22/* var is in discarded region: offset to particular copy we want */
23#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
24#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
25
26/* A macro to avoid #include hell... */
27#define percpu_modcopy(pcpudst, src, size) \
28do { \
29 unsigned int __i; \
30 for (__i = 0; __i < NR_CPUS; __i++) \
31 if (cpu_possible(__i)) \
32 memcpy((pcpudst)+__per_cpu_offset(__i), \
33 (src), (size)); \
34} while (0)
35
36extern void setup_per_cpu_areas(void);
37
38#else /* ! SMP */
39
40#define DEFINE_PER_CPU(type, name) \
41 __typeof__(type) per_cpu__##name
42
43#define per_cpu(var, cpu) (*((void)(cpu), &per_cpu__##var))
44#define __get_cpu_var(var) per_cpu__##var
45
46#endif /* SMP */
47
48#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
49
50#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
51#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
52
53#else
1#include <asm-generic/percpu.h> 54#include <asm-generic/percpu.h>
55#endif
56
57#endif /* _ASM_POWERPC_PERCPU_H_ */
diff --git a/include/asm-powerpc/pgalloc.h b/include/asm-powerpc/pgalloc.h
index bfc2113b3630..9f5b052784a5 100644
--- a/include/asm-powerpc/pgalloc.h
+++ b/include/asm-powerpc/pgalloc.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_PGALLOC_H 1#ifndef _ASM_POWERPC_PGALLOC_H
2#define _ASM_POWERPC_PGALLOC_H 2#define _ASM_POWERPC_PGALLOC_H
3#ifdef __KERNEL__
3 4
4#ifndef CONFIG_PPC64 5#ifndef CONFIG_PPC64
5#include <asm-ppc/pgalloc.h> 6#include <asm-ppc/pgalloc.h>
@@ -153,4 +154,5 @@ extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf);
153#define check_pgt_cache() do { } while (0) 154#define check_pgt_cache() do { } while (0)
154 155
155#endif /* CONFIG_PPC64 */ 156#endif /* CONFIG_PPC64 */
157#endif /* __KERNEL__ */
156#endif /* _ASM_POWERPC_PGALLOC_H */ 158#endif /* _ASM_POWERPC_PGALLOC_H */
diff --git a/include/asm-powerpc/pgtable-64k.h b/include/asm-powerpc/pgtable-64k.h
index 154f1840ece4..653915014dcd 100644
--- a/include/asm-powerpc/pgtable-64k.h
+++ b/include/asm-powerpc/pgtable-64k.h
@@ -1,3 +1,7 @@
1#ifndef _ASM_POWERPC_PGTABLE_64K_H
2#define _ASM_POWERPC_PGTABLE_64K_H
3#ifdef __KERNEL__
4
1#include <asm-generic/pgtable-nopud.h> 5#include <asm-generic/pgtable-nopud.h>
2 6
3 7
@@ -88,3 +92,5 @@
88 92
89 93
90#endif /* __ASSEMBLY__ */ 94#endif /* __ASSEMBLY__ */
95#endif /* __KERNEL__ */
96#endif /* _ASM_POWERPC_PGTABLE_64K_H */
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h
index 0303f57366c1..e38931379a72 100644
--- a/include/asm-powerpc/pgtable.h
+++ b/include/asm-powerpc/pgtable.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_PGTABLE_H 1#ifndef _ASM_POWERPC_PGTABLE_H
2#define _ASM_POWERPC_PGTABLE_H 2#define _ASM_POWERPC_PGTABLE_H
3#ifdef __KERNEL__
3 4
4#ifndef CONFIG_PPC64 5#ifndef CONFIG_PPC64
5#include <asm-ppc/pgtable.h> 6#include <asm-ppc/pgtable.h>
@@ -58,6 +59,17 @@ struct mm_struct;
58#define IMALLOC_END (VMALLOC_START + PGTABLE_RANGE) 59#define IMALLOC_END (VMALLOC_START + PGTABLE_RANGE)
59 60
60/* 61/*
62 * Region IDs
63 */
64#define REGION_SHIFT 60UL
65#define REGION_MASK (0xfUL << REGION_SHIFT)
66#define REGION_ID(ea) (((unsigned long)(ea)) >> REGION_SHIFT)
67
68#define VMALLOC_REGION_ID (REGION_ID(VMALLOC_START))
69#define KERNEL_REGION_ID (REGION_ID(PAGE_OFFSET))
70#define USER_REGION_ID (0UL)
71
72/*
61 * Common bits in a linux-style PTE. These match the bits in the 73 * Common bits in a linux-style PTE. These match the bits in the
62 * (hardware-defined) PowerPC PTE as closely as possible. Additional 74 * (hardware-defined) PowerPC PTE as closely as possible. Additional
63 * bits may be defined in pgtable-*.h 75 * bits may be defined in pgtable-*.h
@@ -521,4 +533,5 @@ void pgtable_cache_init(void);
521#endif /* __ASSEMBLY__ */ 533#endif /* __ASSEMBLY__ */
522 534
523#endif /* CONFIG_PPC64 */ 535#endif /* CONFIG_PPC64 */
536#endif /* __KERNEL__ */
524#endif /* _ASM_POWERPC_PGTABLE_H */ 537#endif /* _ASM_POWERPC_PGTABLE_H */
diff --git a/include/asm-powerpc/pmac_feature.h b/include/asm-powerpc/pmac_feature.h
index e9683bcff19b..3221628130c4 100644
--- a/include/asm-powerpc/pmac_feature.h
+++ b/include/asm-powerpc/pmac_feature.h
@@ -121,6 +121,7 @@
121#define PMAC_TYPE_IMAC_G5 0x152 /* iMac G5 */ 121#define PMAC_TYPE_IMAC_G5 0x152 /* iMac G5 */
122#define PMAC_TYPE_XSERVE_G5 0x153 /* Xserve G5 */ 122#define PMAC_TYPE_XSERVE_G5 0x153 /* Xserve G5 */
123#define PMAC_TYPE_UNKNOWN_K2 0x19f /* Any other K2 based */ 123#define PMAC_TYPE_UNKNOWN_K2 0x19f /* Any other K2 based */
124#define PMAC_TYPE_UNKNOWN_SHASTA 0x19e /* Any other Shasta based */
124 125
125/* 126/*
126 * Motherboard flags 127 * Motherboard flags
@@ -317,10 +318,6 @@ extern void pmac_register_agp_pm(struct pci_dev *bridge,
317extern void pmac_suspend_agp_for_card(struct pci_dev *dev); 318extern void pmac_suspend_agp_for_card(struct pci_dev *dev);
318extern void pmac_resume_agp_for_card(struct pci_dev *dev); 319extern void pmac_resume_agp_for_card(struct pci_dev *dev);
319 320
320/* Used by the via-pmu driver for suspend/resume
321 */
322extern void pmac_tweak_clock_spreading(int enable);
323
324/* 321/*
325 * The part below is for use by macio_asic.c only, do not rely 322 * The part below is for use by macio_asic.c only, do not rely
326 * on the data structures or constants below in a normal driver 323 * on the data structures or constants below in a normal driver
@@ -341,6 +338,7 @@ enum {
341 macio_pangea, 338 macio_pangea,
342 macio_intrepid, 339 macio_intrepid,
343 macio_keylargo2, 340 macio_keylargo2,
341 macio_shasta,
344}; 342};
345 343
346struct macio_chip 344struct macio_chip
@@ -376,5 +374,24 @@ extern struct macio_chip* macio_find(struct device_node* child, int type);
376#define MACIO_IN8(r) (in_8(MACIO_FCR8(macio,r))) 374#define MACIO_IN8(r) (in_8(MACIO_FCR8(macio,r)))
377#define MACIO_OUT8(r,v) (out_8(MACIO_FCR8(macio,r), (v))) 375#define MACIO_OUT8(r,v) (out_8(MACIO_FCR8(macio,r), (v)))
378 376
377/*
378 * Those are exported by pmac feature for internal use by arch code
379 * only like the platform function callbacks, do not use directly in drivers
380 */
381extern spinlock_t feature_lock;
382extern struct device_node *uninorth_node;
383extern u32 __iomem *uninorth_base;
384
385/*
386 * Uninorth reg. access. Note that Uni-N regs are big endian
387 */
388
389#define UN_REG(r) (uninorth_base + ((r) >> 2))
390#define UN_IN(r) (in_be32(UN_REG(r)))
391#define UN_OUT(r,v) (out_be32(UN_REG(r), (v)))
392#define UN_BIS(r,v) (UN_OUT((r), UN_IN(r) | (v)))
393#define UN_BIC(r,v) (UN_OUT((r), UN_IN(r) & ~(v)))
394
395
379#endif /* __PPC_ASM_PMAC_FEATURE_H */ 396#endif /* __PPC_ASM_PMAC_FEATURE_H */
380#endif /* __KERNEL__ */ 397#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/pmac_low_i2c.h b/include/asm-powerpc/pmac_low_i2c.h
index 809a5963d5e7..131011bd7e76 100644
--- a/include/asm-powerpc/pmac_low_i2c.h
+++ b/include/asm-powerpc/pmac_low_i2c.h
@@ -11,33 +11,97 @@
11 */ 11 */
12#ifndef __PMAC_LOW_I2C_H__ 12#ifndef __PMAC_LOW_I2C_H__
13#define __PMAC_LOW_I2C_H__ 13#define __PMAC_LOW_I2C_H__
14#ifdef __KERNEL__
14 15
15/* i2c mode (based on the platform functions format) */ 16/* i2c mode (based on the platform functions format) */
16enum { 17enum {
17 pmac_low_i2c_mode_dumb = 1, 18 pmac_i2c_mode_dumb = 1,
18 pmac_low_i2c_mode_std = 2, 19 pmac_i2c_mode_std = 2,
19 pmac_low_i2c_mode_stdsub = 3, 20 pmac_i2c_mode_stdsub = 3,
20 pmac_low_i2c_mode_combined = 4, 21 pmac_i2c_mode_combined = 4,
21}; 22};
22 23
23/* RW bit in address */ 24/* RW bit in address */
24enum { 25enum {
25 pmac_low_i2c_read = 0x01, 26 pmac_i2c_read = 0x01,
26 pmac_low_i2c_write = 0x00 27 pmac_i2c_write = 0x00
27}; 28};
28 29
30/* i2c bus type */
31enum {
32 pmac_i2c_bus_keywest = 0,
33 pmac_i2c_bus_pmu = 1,
34 pmac_i2c_bus_smu = 2,
35};
36
37/* i2c bus features */
38enum {
39 /* can_largesub : supports >1 byte subaddresses (SMU only) */
40 pmac_i2c_can_largesub = 0x00000001u,
41
42 /* multibus : device node holds multiple busses, bus number is
43 * encoded in bits 0xff00 of "reg" of a given device
44 */
45 pmac_i2c_multibus = 0x00000002u,
46};
47
48/* i2c busses in the system */
49struct pmac_i2c_bus;
50struct i2c_adapter;
51
29/* Init, called early during boot */ 52/* Init, called early during boot */
30extern void pmac_init_low_i2c(void); 53extern int pmac_i2c_init(void);
54
55/* Lookup an i2c bus for a device-node. The node can be either the bus
56 * node itself or a device below it. In the case of a multibus, the bus
57 * node itself is the controller node, else, it's a child of the controller
58 * node
59 */
60extern struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node);
61
62/* Get the address for an i2c device. This strips the bus number if
63 * necessary. The 7 bits address is returned 1 bit right shifted so that the
64 * direction can be directly ored in
65 */
66extern u8 pmac_i2c_get_dev_addr(struct device_node *device);
67
68/* Get infos about a bus */
69extern struct device_node *pmac_i2c_get_controller(struct pmac_i2c_bus *bus);
70extern struct device_node *pmac_i2c_get_bus_node(struct pmac_i2c_bus *bus);
71extern int pmac_i2c_get_type(struct pmac_i2c_bus *bus);
72extern int pmac_i2c_get_flags(struct pmac_i2c_bus *bus);
73extern int pmac_i2c_get_channel(struct pmac_i2c_bus *bus);
74
75/* i2c layer adapter attach/detach */
76extern void pmac_i2c_attach_adapter(struct pmac_i2c_bus *bus,
77 struct i2c_adapter *adapter);
78extern void pmac_i2c_detach_adapter(struct pmac_i2c_bus *bus,
79 struct i2c_adapter *adapter);
80extern struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus);
81extern struct pmac_i2c_bus *pmac_i2c_adapter_to_bus(struct i2c_adapter *adapter);
82
83/* March a device or bus with an i2c adapter structure, to be used by drivers
84 * to match device-tree nodes with i2c adapters during adapter discovery
85 * callbacks
86 */
87extern int pmac_i2c_match_adapter(struct device_node *dev,
88 struct i2c_adapter *adapter);
89
31 90
32/* Locking functions exposed to i2c-keywest */ 91/* (legacy) Locking functions exposed to i2c-keywest */
33int pmac_low_i2c_lock(struct device_node *np); 92extern int pmac_low_i2c_lock(struct device_node *np);
34int pmac_low_i2c_unlock(struct device_node *np); 93extern int pmac_low_i2c_unlock(struct device_node *np);
35 94
36/* Access functions for platform code */ 95/* Access functions for platform code */
37int pmac_low_i2c_open(struct device_node *np, int channel); 96extern int pmac_i2c_open(struct pmac_i2c_bus *bus, int polled);
38int pmac_low_i2c_close(struct device_node *np); 97extern void pmac_i2c_close(struct pmac_i2c_bus *bus);
39int pmac_low_i2c_setmode(struct device_node *np, int mode); 98extern int pmac_i2c_setmode(struct pmac_i2c_bus *bus, int mode);
40int pmac_low_i2c_xfer(struct device_node *np, u8 addrdir, u8 subaddr, u8 *data, int len); 99extern int pmac_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
100 u32 subaddr, u8 *data, int len);
41 101
102/* Suspend/resume code called by via-pmu directly for now */
103extern void pmac_pfunc_i2c_suspend(void);
104extern void pmac_pfunc_i2c_resume(void);
42 105
106#endif /* __KERNEL__ */
43#endif /* __PMAC_LOW_I2C_H__ */ 107#endif /* __PMAC_LOW_I2C_H__ */
diff --git a/include/asm-powerpc/pmac_pfunc.h b/include/asm-powerpc/pmac_pfunc.h
new file mode 100644
index 000000000000..d9728c80f86d
--- /dev/null
+++ b/include/asm-powerpc/pmac_pfunc.h
@@ -0,0 +1,253 @@
1#ifndef __PMAC_PFUNC_H__
2#define __PMAC_PFUNC_H__
3
4#include <linux/types.h>
5#include <linux/list.h>
6
7/* Flags in command lists */
8#define PMF_FLAGS_ON_INIT 0x80000000u
9#define PMF_FLGAS_ON_TERM 0x40000000u
10#define PMF_FLAGS_ON_SLEEP 0x20000000u
11#define PMF_FLAGS_ON_WAKE 0x10000000u
12#define PMF_FLAGS_ON_DEMAND 0x08000000u
13#define PMF_FLAGS_INT_GEN 0x04000000u
14#define PMF_FLAGS_HIGH_SPEED 0x02000000u
15#define PMF_FLAGS_LOW_SPEED 0x01000000u
16#define PMF_FLAGS_SIDE_EFFECTS 0x00800000u
17
18/*
19 * Arguments to a platform function call.
20 *
21 * NOTE: By convention, pointer arguments point to an u32
22 */
23struct pmf_args {
24 union {
25 u32 v;
26 u32 *p;
27 } u[4];
28 unsigned int count;
29};
30
31/*
32 * A driver capable of interpreting commands provides a handlers
33 * structure filled with whatever handlers are implemented by this
34 * driver. Non implemented handlers are left NULL.
35 *
36 * PMF_STD_ARGS are the same arguments that are passed to the parser
37 * and that gets passed back to the various handlers.
38 *
39 * Interpreting a given function always start with a begin() call which
40 * returns an instance data to be passed around subsequent calls, and
41 * ends with an end() call. This allows the low level driver to implement
42 * locking policy or per-function instance data.
43 *
44 * For interrupt capable functions, irq_enable() is called when a client
45 * registers, and irq_disable() is called when the last client unregisters
46 * Note that irq_enable & irq_disable are called within a semaphore held
47 * by the core, thus you should not try to register yourself to some other
48 * pmf interrupt during those calls.
49 */
50
51#define PMF_STD_ARGS struct pmf_function *func, void *instdata, \
52 struct pmf_args *args
53
54struct pmf_function;
55
56struct pmf_handlers {
57 void * (*begin)(struct pmf_function *func, struct pmf_args *args);
58 void (*end)(struct pmf_function *func, void *instdata);
59
60 int (*irq_enable)(struct pmf_function *func);
61 int (*irq_disable)(struct pmf_function *func);
62
63 int (*write_gpio)(PMF_STD_ARGS, u8 value, u8 mask);
64 int (*read_gpio)(PMF_STD_ARGS, u8 mask, int rshift, u8 xor);
65
66 int (*write_reg32)(PMF_STD_ARGS, u32 offset, u32 value, u32 mask);
67 int (*read_reg32)(PMF_STD_ARGS, u32 offset);
68 int (*write_reg16)(PMF_STD_ARGS, u32 offset, u16 value, u16 mask);
69 int (*read_reg16)(PMF_STD_ARGS, u32 offset);
70 int (*write_reg8)(PMF_STD_ARGS, u32 offset, u8 value, u8 mask);
71 int (*read_reg8)(PMF_STD_ARGS, u32 offset);
72
73 int (*delay)(PMF_STD_ARGS, u32 duration);
74
75 int (*wait_reg32)(PMF_STD_ARGS, u32 offset, u32 value, u32 mask);
76 int (*wait_reg16)(PMF_STD_ARGS, u32 offset, u16 value, u16 mask);
77 int (*wait_reg8)(PMF_STD_ARGS, u32 offset, u8 value, u8 mask);
78
79 int (*read_i2c)(PMF_STD_ARGS, u32 len);
80 int (*write_i2c)(PMF_STD_ARGS, u32 len, const u8 *data);
81 int (*rmw_i2c)(PMF_STD_ARGS, u32 masklen, u32 valuelen, u32 totallen,
82 const u8 *maskdata, const u8 *valuedata);
83
84 int (*read_cfg)(PMF_STD_ARGS, u32 offset, u32 len);
85 int (*write_cfg)(PMF_STD_ARGS, u32 offset, u32 len, const u8 *data);
86 int (*rmw_cfg)(PMF_STD_ARGS, u32 offset, u32 masklen, u32 valuelen,
87 u32 totallen, const u8 *maskdata, const u8 *valuedata);
88
89 int (*read_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 len);
90 int (*write_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 len, const u8 *data);
91 int (*set_i2c_mode)(PMF_STD_ARGS, int mode);
92 int (*rmw_i2c_sub)(PMF_STD_ARGS, u8 subaddr, u32 masklen, u32 valuelen,
93 u32 totallen, const u8 *maskdata,
94 const u8 *valuedata);
95
96 int (*read_reg32_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift,
97 u32 xor);
98 int (*read_reg16_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift,
99 u32 xor);
100 int (*read_reg8_msrx)(PMF_STD_ARGS, u32 offset, u32 mask, u32 shift,
101 u32 xor);
102
103 int (*write_reg32_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask);
104 int (*write_reg16_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask);
105 int (*write_reg8_slm)(PMF_STD_ARGS, u32 offset, u32 shift, u32 mask);
106
107 int (*mask_and_compare)(PMF_STD_ARGS, u32 len, const u8 *maskdata,
108 const u8 *valuedata);
109
110 struct module *owner;
111};
112
113
114/*
115 * Drivers who expose platform functions register at init time, this
116 * causes the platform functions for that device node to be parsed in
117 * advance and associated with the device. The data structures are
118 * partially public so a driver can walk the list of platform functions
119 * and eventually inspect the flags
120 */
121struct pmf_device;
122
123struct pmf_function {
124 /* All functions for a given driver are linked */
125 struct list_head link;
126
127 /* Function node & driver data */
128 struct device_node *node;
129 void *driver_data;
130
131 /* For internal use by core */
132 struct pmf_device *dev;
133
134 /* The name is the "xxx" in "platform-do-xxx", this is how
135 * platform functions are identified by this code. Some functions
136 * only operate for a given target, in which case the phandle is
137 * here (or 0 if the filter doesn't apply)
138 */
139 const char *name;
140 u32 phandle;
141
142 /* The flags for that function. You can have several functions
143 * with the same name and different flag
144 */
145 u32 flags;
146
147 /* The actual tokenized function blob */
148 const void *data;
149 unsigned int length;
150
151 /* Interrupt clients */
152 struct list_head irq_clients;
153
154 /* Refcounting */
155 struct kref ref;
156};
157
158/*
159 * For platform functions that are interrupts, one can register
160 * irq_client structures. You canNOT use the same structure twice
161 * as it contains a link member. Also, the callback is called with
162 * a spinlock held, you must not call back into any of the pmf_* functions
163 * from within that callback
164 */
165struct pmf_irq_client {
166 void (*handler)(void *data);
167 void *data;
168 struct module *owner;
169 struct list_head link;
170};
171
172
173/*
174 * Register/Unregister a function-capable driver and its handlers
175 */
176extern int pmf_register_driver(struct device_node *np,
177 struct pmf_handlers *handlers,
178 void *driverdata);
179
180extern void pmf_unregister_driver(struct device_node *np);
181
182
183/*
184 * Register/Unregister interrupt clients
185 */
186extern int pmf_register_irq_client(struct device_node *np,
187 const char *name,
188 struct pmf_irq_client *client);
189
190extern void pmf_unregister_irq_client(struct device_node *np,
191 const char *name,
192 struct pmf_irq_client *client);
193
194/*
195 * Called by the handlers when an irq happens
196 */
197extern void pmf_do_irq(struct pmf_function *func);
198
199
200/*
201 * Low level call to platform functions.
202 *
203 * The phandle can filter on the target object for functions that have
204 * multiple targets, the flags allow you to restrict the call to a given
205 * combination of flags.
206 *
207 * The args array contains as many arguments as is required by the function,
208 * this is dependent on the function you are calling, unfortunately Apple
209 * mecanism provides no way to encode that so you have to get it right at
210 * the call site. Some functions require no args, in which case, you can
211 * pass NULL.
212 *
213 * You can also pass NULL to the name. This will match any function that has
214 * the appropriate combination of flags & phandle or you can pass 0 to the
215 * phandle to match any
216 */
217extern int pmf_do_functions(struct device_node *np, const char *name,
218 u32 phandle, u32 flags, struct pmf_args *args);
219
220
221
222/*
223 * High level call to a platform function.
224 *
225 * This one looks for the platform-xxx first so you should call it to the
226 * actual target if any. It will fallback to platform-do-xxx if it can't
227 * find one. It will also exclusively target functions that have
228 * the "OnDemand" flag.
229 */
230
231extern int pmf_call_function(struct device_node *target, const char *name,
232 struct pmf_args *args);
233
234
235/*
236 * For low latency interrupt usage, you can lookup for on-demand functions
237 * using the functions below
238 */
239
240extern struct pmf_function *pmf_find_function(struct device_node *target,
241 const char *name);
242
243extern struct pmf_function * pmf_get_function(struct pmf_function *func);
244extern void pmf_put_function(struct pmf_function *func);
245
246extern int pmf_call_one(struct pmf_function *func, struct pmf_args *args);
247
248
249/* Suspend/resume code called by via-pmu directly for now */
250extern void pmac_pfunc_base_suspend(void);
251extern void pmac_pfunc_base_resume(void);
252
253#endif /* __PMAC_PFUNC_H__ */
diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h
index 5f41f3a2b293..07d6a4279319 100644
--- a/include/asm-powerpc/pmc.h
+++ b/include/asm-powerpc/pmc.h
@@ -18,6 +18,7 @@
18 */ 18 */
19#ifndef _POWERPC_PMC_H 19#ifndef _POWERPC_PMC_H
20#define _POWERPC_PMC_H 20#define _POWERPC_PMC_H
21#ifdef __KERNEL__
21 22
22#include <asm/ptrace.h> 23#include <asm/ptrace.h>
23 24
@@ -44,4 +45,5 @@ void dump_pmcs(void);
44extern struct op_powerpc_model op_model_fsl_booke; 45extern struct op_powerpc_model op_model_fsl_booke;
45#endif 46#endif
46 47
48#endif /* __KERNEL__ */
47#endif /* _POWERPC_PMC_H */ 49#endif /* _POWERPC_PMC_H */
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index 36cdc869e580..f80482c7231f 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -8,6 +8,7 @@
8 */ 8 */
9#ifndef _ASM_POWERPC_PPC_PCI_H 9#ifndef _ASM_POWERPC_PPC_PCI_H
10#define _ASM_POWERPC_PPC_PCI_H 10#define _ASM_POWERPC_PPC_PCI_H
11#ifdef __KERNEL__
11 12
12#include <linux/pci.h> 13#include <linux/pci.h>
13#include <asm/pci-bridge.h> 14#include <asm/pci-bridge.h>
@@ -51,6 +52,21 @@ extern unsigned long pci_probe_only;
51 52
52/* ---- EEH internal-use-only related routines ---- */ 53/* ---- EEH internal-use-only related routines ---- */
53#ifdef CONFIG_EEH 54#ifdef CONFIG_EEH
55
56void pci_addr_cache_insert_device(struct pci_dev *dev);
57void pci_addr_cache_remove_device(struct pci_dev *dev);
58void pci_addr_cache_build(void);
59struct pci_dev *pci_get_device_by_addr(unsigned long addr);
60
61/**
62 * eeh_slot_error_detail -- record and EEH error condition to the log
63 * @severity: 1 if temporary, 2 if permanent failure.
64 *
65 * Obtains the the EEH error details from the RTAS subsystem,
66 * and then logs these details with the RTAS error log system.
67 */
68void eeh_slot_error_detail (struct pci_dn *pdn, int severity);
69
54/** 70/**
55 * rtas_set_slot_reset -- unfreeze a frozen slot 71 * rtas_set_slot_reset -- unfreeze a frozen slot
56 * 72 *
@@ -58,8 +74,10 @@ extern unsigned long pci_probe_only;
58 * does this by asserting the PCI #RST line for 1/8th of 74 * does this by asserting the PCI #RST line for 1/8th of
59 * a second; this routine will sleep while the adapter is 75 * a second; this routine will sleep while the adapter is
60 * being reset. 76 * being reset.
77 *
78 * Returns a non-zero value if the reset failed.
61 */ 79 */
62void rtas_set_slot_reset (struct pci_dn *); 80int rtas_set_slot_reset (struct pci_dn *);
63 81
64/** 82/**
65 * eeh_restore_bars - Restore device configuration info. 83 * eeh_restore_bars - Restore device configuration info.
@@ -83,6 +101,7 @@ void eeh_restore_bars(struct pci_dn *);
83void rtas_configure_bridge(struct pci_dn *); 101void rtas_configure_bridge(struct pci_dn *);
84 102
85int rtas_write_config(struct pci_dn *, int where, int size, u32 val); 103int rtas_write_config(struct pci_dn *, int where, int size, u32 val);
104int rtas_read_config(struct pci_dn *, int where, int size, u32 *val);
86 105
87/** 106/**
88 * mark and clear slots: find "partition endpoint" PE and set or 107 * mark and clear slots: find "partition endpoint" PE and set or
@@ -91,6 +110,10 @@ int rtas_write_config(struct pci_dn *, int where, int size, u32 val);
91void eeh_mark_slot (struct device_node *dn, int mode_flag); 110void eeh_mark_slot (struct device_node *dn, int mode_flag);
92void eeh_clear_slot (struct device_node *dn, int mode_flag); 111void eeh_clear_slot (struct device_node *dn, int mode_flag);
93 112
113/* Find the associated "Partiationable Endpoint" PE */
114struct device_node * find_device_pe(struct device_node *dn);
115
94#endif 116#endif
95 117
118#endif /* __KERNEL__ */
96#endif /* _ASM_POWERPC_PPC_PCI_H */ 119#endif /* _ASM_POWERPC_PPC_PCI_H */
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h
index c27baa0563fe..0dc798d46ea4 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -94,6 +94,7 @@
94#define RFDI .long 0x4c00004e /* rfdi instruction */ 94#define RFDI .long 0x4c00004e /* rfdi instruction */
95#define RFMCI .long 0x4c00004c /* rfmci instruction */ 95#define RFMCI .long 0x4c00004c /* rfmci instruction */
96 96
97#ifdef __KERNEL__
97#ifdef CONFIG_PPC64 98#ifdef CONFIG_PPC64
98 99
99#define XGLUE(a,b) a##b 100#define XGLUE(a,b) a##b
@@ -325,6 +326,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
325#define CLR_TOP32(r) 326#define CLR_TOP32(r)
326#endif 327#endif
327 328
329#endif /* __KERNEL__ */
330
328/* The boring bits... */ 331/* The boring bits... */
329 332
330/* Condition Register Bit Fields */ 333/* Condition Register Bit Fields */
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index d12382d292d4..415fa393b00c 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -10,7 +10,6 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/config.h>
14#include <asm/reg.h> 13#include <asm/reg.h>
15 14
16#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
@@ -50,6 +49,7 @@
50#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ 49#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
51#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ 50#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */
52 51
52#ifdef __KERNEL__
53#define platform_is_pseries() (_machine == PLATFORM_PSERIES || \ 53#define platform_is_pseries() (_machine == PLATFORM_PSERIES || \
54 _machine == PLATFORM_PSERIES_LPAR) 54 _machine == PLATFORM_PSERIES_LPAR)
55#define platform_is_lpar() (!!(_machine & PLATFORM_LPAR)) 55#define platform_is_lpar() (!!(_machine & PLATFORM_LPAR))
@@ -68,7 +68,6 @@ extern int _chrp_type;
68 * vendor. Board revision is also made available. This will be moved 68 * vendor. Board revision is also made available. This will be moved
69 * elsewhere soon 69 * elsewhere soon
70 */ 70 */
71extern unsigned char ucSystemType;
72extern unsigned char ucBoardRev; 71extern unsigned char ucBoardRev;
73extern unsigned char ucBoardRevMaj, ucBoardRevMin; 72extern unsigned char ucBoardRevMaj, ucBoardRevMin;
74 73
@@ -82,7 +81,7 @@ extern unsigned char ucBoardRevMaj, ucBoardRevMin;
82#else 81#else
83#define _machine 0 82#define _machine 0
84#endif /* CONFIG_PPC_MULTIPLATFORM */ 83#endif /* CONFIG_PPC_MULTIPLATFORM */
85 84#endif /* __KERNEL__ */
86/* 85/*
87 * Default implementation of macro that returns current 86 * Default implementation of macro that returns current
88 * instruction pointer ("program counter"). 87 * instruction pointer ("program counter").
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index f999df1c5c90..329e9bf62260 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -65,49 +65,11 @@ struct boot_param_header
65typedef u32 phandle; 65typedef u32 phandle;
66typedef u32 ihandle; 66typedef u32 ihandle;
67 67
68struct address_range {
69 unsigned long space;
70 unsigned long address;
71 unsigned long size;
72};
73
74struct interrupt_info { 68struct interrupt_info {
75 int line; 69 int line;
76 int sense; /* +ve/-ve logic, edge or level, etc. */ 70 int sense; /* +ve/-ve logic, edge or level, etc. */
77}; 71};
78 72
79struct pci_address {
80 u32 a_hi;
81 u32 a_mid;
82 u32 a_lo;
83};
84
85struct isa_address {
86 u32 a_hi;
87 u32 a_lo;
88};
89
90struct isa_range {
91 struct isa_address isa_addr;
92 struct pci_address pci_addr;
93 unsigned int size;
94};
95
96struct reg_property {
97 unsigned long address;
98 unsigned long size;
99};
100
101struct reg_property32 {
102 unsigned int address;
103 unsigned int size;
104};
105
106struct reg_property64 {
107 u64 address;
108 u64 size;
109};
110
111struct property { 73struct property {
112 char *name; 74 char *name;
113 int length; 75 int length;
@@ -120,8 +82,6 @@ struct device_node {
120 char *type; 82 char *type;
121 phandle node; 83 phandle node;
122 phandle linux_phandle; 84 phandle linux_phandle;
123 int n_addrs;
124 struct address_range *addrs;
125 int n_intrs; 85 int n_intrs;
126 struct interrupt_info *intrs; 86 struct interrupt_info *intrs;
127 char *full_name; 87 char *full_name;
@@ -223,5 +183,36 @@ extern struct resource *request_OF_resource(struct device_node* node,
223 int index, const char* name_postfix); 183 int index, const char* name_postfix);
224extern int release_OF_resource(struct device_node* node, int index); 184extern int release_OF_resource(struct device_node* node, int index);
225 185
186
187/*
188 * OF address retreival & translation
189 */
190
191
192/* Translate an OF address block into a CPU physical address
193 */
194#define OF_BAD_ADDR ((u64)-1)
195extern u64 of_translate_address(struct device_node *np, u32 *addr);
196
197/* Extract an address from a device, returns the region size and
198 * the address space flags too. The PCI version uses a BAR number
199 * instead of an absolute index
200 */
201extern u32 *of_get_address(struct device_node *dev, int index,
202 u64 *size, unsigned int *flags);
203extern u32 *of_get_pci_address(struct device_node *dev, int bar_no,
204 u64 *size, unsigned int *flags);
205
206/* Get an address as a resource. Note that if your address is
207 * a PIO address, the conversion will fail if the physical address
208 * can't be internally converted to an IO token with
209 * pci_address_to_pio(), that is because it's either called to early
210 * or it can't be matched to any host bridge IO space
211 */
212extern int of_address_to_resource(struct device_node *dev, int index,
213 struct resource *r);
214extern int of_pci_address_to_resource(struct device_node *dev, int bar,
215 struct resource *r);
216
226#endif /* __KERNEL__ */ 217#endif /* __KERNEL__ */
227#endif /* _POWERPC_PROM_H */ 218#endif /* _POWERPC_PROM_H */
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index 1f7ecdb0b6ce..9c550b314823 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -87,7 +87,7 @@ extern unsigned long profile_pc(struct pt_regs *regs);
87 87
88#define force_successful_syscall_return() \ 88#define force_successful_syscall_return() \
89 do { \ 89 do { \
90 current_thread_info()->syscall_noerror = 1; \ 90 set_thread_flag(TIF_NOERROR); \
91 } while(0) 91 } while(0)
92 92
93/* 93/*
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index eb392d038ed7..12ecc9b9f285 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -145,6 +145,10 @@
145#define SPRN_CTR 0x009 /* Count Register */ 145#define SPRN_CTR 0x009 /* Count Register */
146#define SPRN_CTRLF 0x088 146#define SPRN_CTRLF 0x088
147#define SPRN_CTRLT 0x098 147#define SPRN_CTRLT 0x098
148#define CTRL_CT 0xc0000000 /* current thread */
149#define CTRL_CT0 0x80000000 /* thread 0 */
150#define CTRL_CT1 0x40000000 /* thread 1 */
151#define CTRL_TE 0x00c00000 /* thread enable */
148#define CTRL_RUNLATCH 0x1 152#define CTRL_RUNLATCH 0x1
149#define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */ 153#define SPRN_DABR 0x3F5 /* Data Address Breakpoint Register */
150#define DABR_TRANSLATION (1UL << 2) 154#define DABR_TRANSLATION (1UL << 2)
@@ -257,11 +261,11 @@
257#define SPRN_HID6 0x3F9 /* BE HID 6 */ 261#define SPRN_HID6 0x3F9 /* BE HID 6 */
258#define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */ 262#define HID6_LB (0x0F<<12) /* Concurrent Large Page Modes */
259#define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */ 263#define HID6_DLP (1<<20) /* Disable all large page modes (4K only) */
260#define SPRN_TSCR 0x399 /* Thread switch control on BE */ 264#define SPRN_TSC_CELL 0x399 /* Thread switch control on Cell */
261#define SPRN_TTR 0x39A /* Thread switch timeout on BE */ 265#define TSC_CELL_DEC_ENABLE_0 0x400000 /* Decrementer Interrupt */
262#define TSCR_DEC_ENABLE 0x200000 /* Decrementer Interrupt */ 266#define TSC_CELL_DEC_ENABLE_1 0x200000 /* Decrementer Interrupt */
263#define TSCR_EE_ENABLE 0x100000 /* External Interrupt */ 267#define TSC_CELL_EE_ENABLE 0x100000 /* External Interrupt */
264#define TSCR_EE_BOOST 0x080000 /* External Interrupt Boost */ 268#define TSC_CELL_EE_BOOST 0x080000 /* External Interrupt Boost */
265#define SPRN_TSC 0x3FD /* Thread switch control on others */ 269#define SPRN_TSC 0x3FD /* Thread switch control on others */
266#define SPRN_TST 0x3FC /* Thread switch timeout on others */ 270#define SPRN_TST 0x3FC /* Thread switch timeout on others */
267#if !defined(SPRN_IAC1) && !defined(SPRN_IAC2) 271#if !defined(SPRN_IAC1) && !defined(SPRN_IAC2)
@@ -375,6 +379,14 @@
375#define SPRN_SPRG7 0x117 /* Special Purpose Register General 7 */ 379#define SPRN_SPRG7 0x117 /* Special Purpose Register General 7 */
376#define SPRN_SRR0 0x01A /* Save/Restore Register 0 */ 380#define SPRN_SRR0 0x01A /* Save/Restore Register 0 */
377#define SPRN_SRR1 0x01B /* Save/Restore Register 1 */ 381#define SPRN_SRR1 0x01B /* Save/Restore Register 1 */
382#define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */
383#define SRR1_WAKERESET 0x00380000 /* System reset */
384#define SRR1_WAKESYSERR 0x00300000 /* System error */
385#define SRR1_WAKEEE 0x00200000 /* External interrupt */
386#define SRR1_WAKEMT 0x00280000 /* mtctrl */
387#define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */
388#define SRR1_WAKETHERM 0x00100000 /* Thermal management interrupt */
389
378#ifndef SPRN_SVR 390#ifndef SPRN_SVR
379#define SPRN_SVR 0x11E /* System Version Register */ 391#define SPRN_SVR 0x11E /* System Version Register */
380#endif 392#endif
@@ -443,12 +455,35 @@
443#define SPRN_SDAR 781 455#define SPRN_SDAR 781
444 456
445#else /* 32-bit */ 457#else /* 32-bit */
446#define SPRN_MMCR0 0x3B8 /* Monitor Mode Control Register 0 */ 458#define SPRN_MMCR0 952 /* Monitor Mode Control Register 0 */
447#define SPRN_MMCR1 0x3BC /* Monitor Mode Control Register 1 */ 459#define MMCR0_FC 0x80000000UL /* freeze counters */
448#define SPRN_PMC1 0x3B9 /* Performance Counter Register 1 */ 460#define MMCR0_FCS 0x40000000UL /* freeze in supervisor state */
449#define SPRN_PMC2 0x3BA /* Performance Counter Register 2 */ 461#define MMCR0_FCP 0x20000000UL /* freeze in problem state */
450#define SPRN_PMC3 0x3BD /* Performance Counter Register 3 */ 462#define MMCR0_FCM1 0x10000000UL /* freeze counters while MSR mark = 1 */
451#define SPRN_PMC4 0x3BE /* Performance Counter Register 4 */ 463#define MMCR0_FCM0 0x08000000UL /* freeze counters while MSR mark = 0 */
464#define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */
465#define MMCR0_FCECE 0x02000000UL /* freeze ctrs on enabled cond or event */
466#define MMCR0_TBEE 0x00400000UL /* time base exception enable */
467#define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/
468#define MMCR0_PMCnCE 0x00004000UL /* count enable for all but PMC 1*/
469#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */
470#define MMCR0_PMC1SEL 0x00001fc0UL /* PMC 1 Event */
471#define MMCR0_PMC2SEL 0x0000003fUL /* PMC 2 Event */
472
473#define SPRN_MMCR1 956
474#define MMCR1_PMC3SEL 0xf8000000UL /* PMC 3 Event */
475#define MMCR1_PMC4SEL 0x07c00000UL /* PMC 4 Event */
476#define MMCR1_PMC5SEL 0x003e0000UL /* PMC 5 Event */
477#define MMCR1_PMC6SEL 0x0001f800UL /* PMC 6 Event */
478#define SPRN_MMCR2 944
479#define SPRN_PMC1 953 /* Performance Counter Register 1 */
480#define SPRN_PMC2 954 /* Performance Counter Register 2 */
481#define SPRN_PMC3 957 /* Performance Counter Register 3 */
482#define SPRN_PMC4 958 /* Performance Counter Register 4 */
483#define SPRN_PMC5 945 /* Performance Counter Register 5 */
484#define SPRN_PMC6 946 /* Performance Counter Register 6 */
485
486#define SPRN_SIAR 955 /* Sampled Instruction Address Register */
452 487
453/* Bit definitions for MMCR0 and PMC1 / PMC2. */ 488/* Bit definitions for MMCR0 and PMC1 / PMC2. */
454#define MMCR0_PMC1_CYCLES (1 << 7) 489#define MMCR0_PMC1_CYCLES (1 << 7)
@@ -458,7 +493,6 @@
458#define MMCR0_PMC2_CYCLES 0x1 493#define MMCR0_PMC2_CYCLES 0x1
459#define MMCR0_PMC2_ITLB 0x7 494#define MMCR0_PMC2_ITLB 0x7
460#define MMCR0_PMC2_LOADMISSTIME 0x5 495#define MMCR0_PMC2_LOADMISSTIME 0x5
461#define MMCR0_PMXE (1 << 26)
462#endif 496#endif
463 497
464/* Processor Version Register (PVR) field extraction */ 498/* Processor Version Register (PVR) field extraction */
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index d1bb611ea626..f43c6835e62a 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -1,5 +1,6 @@
1#ifndef _POWERPC_RTAS_H 1#ifndef _POWERPC_RTAS_H
2#define _POWERPC_RTAS_H 2#define _POWERPC_RTAS_H
3#ifdef __KERNEL__
3 4
4#include <linux/spinlock.h> 5#include <linux/spinlock.h>
5#include <asm/page.h> 6#include <asm/page.h>
@@ -160,7 +161,6 @@ extern struct rtas_t rtas;
160extern void enter_rtas(unsigned long); 161extern void enter_rtas(unsigned long);
161extern int rtas_token(const char *service); 162extern int rtas_token(const char *service);
162extern int rtas_call(int token, int, int, int *, ...); 163extern int rtas_call(int token, int, int, int *, ...);
163extern void call_rtas_display_status(unsigned char);
164extern void rtas_restart(char *cmd); 164extern void rtas_restart(char *cmd);
165extern void rtas_power_off(void); 165extern void rtas_power_off(void);
166extern void rtas_halt(void); 166extern void rtas_halt(void);
@@ -229,4 +229,5 @@ extern unsigned long rtas_rmo_buf;
229 229
230#define GLOBAL_INTERRUPT_QUEUE 9005 230#define GLOBAL_INTERRUPT_QUEUE 9005
231 231
232#endif /* __KERNEL__ */
232#endif /* _POWERPC_RTAS_H */ 233#endif /* _POWERPC_RTAS_H */
diff --git a/include/asm-powerpc/seccomp.h b/include/asm-powerpc/seccomp.h
index 1e1cfe12882b..853765eb1f65 100644
--- a/include/asm-powerpc/seccomp.h
+++ b/include/asm-powerpc/seccomp.h
@@ -1,6 +1,10 @@
1#ifndef _ASM_POWERPC_SECCOMP_H 1#ifndef _ASM_POWERPC_SECCOMP_H
2#define _ASM_POWERPC_SECCOMP_H
2 3
4#ifdef __KERNEL__
3#include <linux/thread_info.h> 5#include <linux/thread_info.h>
6#endif
7
4#include <linux/unistd.h> 8#include <linux/unistd.h>
5 9
6#define __NR_seccomp_read __NR_read 10#define __NR_seccomp_read __NR_read
diff --git a/include/asm-powerpc/sections.h b/include/asm-powerpc/sections.h
index 47be2ac2a925..916018e425c4 100644
--- a/include/asm-powerpc/sections.h
+++ b/include/asm-powerpc/sections.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_SECTIONS_H 1#ifndef _ASM_POWERPC_SECTIONS_H
2#define _ASM_POWERPC_SECTIONS_H 2#define _ASM_POWERPC_SECTIONS_H
3#ifdef __KERNEL__
3 4
4#include <asm-generic/sections.h> 5#include <asm-generic/sections.h>
5 6
@@ -17,4 +18,5 @@ static inline int in_kernel_text(unsigned long addr)
17 18
18#endif 19#endif
19 20
21#endif /* __KERNEL__ */
20#endif /* _ASM_POWERPC_SECTIONS_H */ 22#endif /* _ASM_POWERPC_SECTIONS_H */
diff --git a/include/asm-powerpc/serial.h b/include/asm-powerpc/serial.h
index b273d630b32f..3e8589b43cb2 100644
--- a/include/asm-powerpc/serial.h
+++ b/include/asm-powerpc/serial.h
@@ -15,4 +15,10 @@
15/* Default baud base if not found in device-tree */ 15/* Default baud base if not found in device-tree */
16#define BASE_BAUD ( 1843200 / 16 ) 16#define BASE_BAUD ( 1843200 / 16 )
17 17
18#ifdef CONFIG_PPC_UDBG_16550
19extern void find_legacy_serial_ports(void);
20#else
21#define find_legacy_serial_ports() do { } while (0)
22#endif
23
18#endif /* _PPC64_SERIAL_H */ 24#endif /* _PPC64_SERIAL_H */
diff --git a/include/asm-powerpc/signal.h b/include/asm-powerpc/signal.h
index 694c8d2dab87..a4d8f8648541 100644
--- a/include/asm-powerpc/signal.h
+++ b/include/asm-powerpc/signal.h
@@ -2,10 +2,13 @@
2#define _ASM_POWERPC_SIGNAL_H 2#define _ASM_POWERPC_SIGNAL_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/config.h>
6 5
7#define _NSIG 64 6#define _NSIG 64
8#define _NSIG_BPW BITS_PER_LONG 7#ifdef __powerpc64__
8#define _NSIG_BPW 64
9#else
10#define _NSIG_BPW 32
11#endif
9#define _NSIG_WORDS (_NSIG / _NSIG_BPW) 12#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
10 13
11typedef unsigned long old_sigset_t; /* at least 32 bits */ 14typedef unsigned long old_sigset_t; /* at least 32 bits */
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h
index 76c29a9784dd..82ce47607774 100644
--- a/include/asm-powerpc/smu.h
+++ b/include/asm-powerpc/smu.h
@@ -4,9 +4,11 @@
4/* 4/*
5 * Definitions for talking to the SMU chip in newer G5 PowerMacs 5 * Definitions for talking to the SMU chip in newer G5 PowerMacs
6 */ 6 */
7 7#ifdef __KERNEL__
8#include <linux/config.h> 8#include <linux/config.h>
9#include <linux/list.h> 9#include <linux/list.h>
10#endif
11#include <linux/types.h>
10 12
11/* 13/*
12 * Known SMU commands 14 * Known SMU commands
@@ -20,7 +22,7 @@
20/* 22/*
21 * Partition info commands 23 * Partition info commands
22 * 24 *
23 * These commands are used to retreive the sdb-partition-XX datas from 25 * These commands are used to retrieve the sdb-partition-XX datas from
24 * the SMU. The lenght is always 2. First byte is the subcommand code 26 * the SMU. The lenght is always 2. First byte is the subcommand code
25 * and second byte is the partition ID. 27 * and second byte is the partition ID.
26 * 28 *
@@ -223,7 +225,7 @@
223 * 225 *
224 * SMU_CMD_MISC_ee_GET_DATABLOCK_REC is used, among others, to 226 * SMU_CMD_MISC_ee_GET_DATABLOCK_REC is used, among others, to
225 * transfer blocks of data from the SMU. So far, I've decrypted it's 227 * transfer blocks of data from the SMU. So far, I've decrypted it's
226 * usage to retreive partition data. In order to do that, you have to 228 * usage to retrieve partition data. In order to do that, you have to
227 * break your transfer in "chunks" since that command cannot transfer 229 * break your transfer in "chunks" since that command cannot transfer
228 * more than a chunk at a time. The chunk size used by OF is 0xe bytes, 230 * more than a chunk at a time. The chunk size used by OF is 0xe bytes,
229 * but it seems that the darwin driver will let you do 0x1e bytes if 231 * but it seems that the darwin driver will let you do 0x1e bytes if
@@ -356,6 +358,9 @@ extern unsigned long smu_cmdbuf_abs;
356 * Kenrel asynchronous i2c interface 358 * Kenrel asynchronous i2c interface
357 */ 359 */
358 360
361#define SMU_I2C_READ_MAX 0x1d
362#define SMU_I2C_WRITE_MAX 0x15
363
359/* SMU i2c header, exactly matches i2c header on wire */ 364/* SMU i2c header, exactly matches i2c header on wire */
360struct smu_i2c_param 365struct smu_i2c_param
361{ 366{
@@ -366,12 +371,9 @@ struct smu_i2c_param
366 u8 subaddr[3]; /* subaddress */ 371 u8 subaddr[3]; /* subaddress */
367 u8 caddr; /* combined address, filled by SMU driver */ 372 u8 caddr; /* combined address, filled by SMU driver */
368 u8 datalen; /* length of transfer */ 373 u8 datalen; /* length of transfer */
369 u8 data[7]; /* data */ 374 u8 data[SMU_I2C_READ_MAX]; /* data */
370}; 375};
371 376
372#define SMU_I2C_READ_MAX 0x0d
373#define SMU_I2C_WRITE_MAX 0x05
374
375struct smu_i2c_cmd 377struct smu_i2c_cmd
376{ 378{
377 /* public */ 379 /* public */
@@ -385,7 +387,7 @@ struct smu_i2c_cmd
385 int read; 387 int read;
386 int stage; 388 int stage;
387 int retries; 389 int retries;
388 u8 pdata[0x10]; 390 u8 pdata[32];
389 struct list_head link; 391 struct list_head link;
390}; 392};
391 393
@@ -487,8 +489,8 @@ struct smu_sdbp_slotspow {
487#define SMU_SDB_SENSORTREE_ID 0x25 489#define SMU_SDB_SENSORTREE_ID 0x25
488 490
489struct smu_sdbp_sensortree { 491struct smu_sdbp_sensortree {
490 u8 model_id; 492 __u8 model_id;
491 u8 unknown[3]; 493 __u8 unknown[3];
492}; 494};
493 495
494/* This partition contains CPU thermal control PID informations. So far 496/* This partition contains CPU thermal control PID informations. So far
@@ -498,13 +500,13 @@ struct smu_sdbp_sensortree {
498#define SMU_SDB_CPUPIDDATA_ID 0x17 500#define SMU_SDB_CPUPIDDATA_ID 0x17
499 501
500struct smu_sdbp_cpupiddata { 502struct smu_sdbp_cpupiddata {
501 u8 unknown1; 503 __u8 unknown1;
502 u8 target_temp_delta; 504 __u8 target_temp_delta;
503 u8 unknown2; 505 __u8 unknown2;
504 u8 history_len; 506 __u8 history_len;
505 s16 power_adj; 507 __s16 power_adj;
506 u16 max_power; 508 __u16 max_power;
507 s32 gp,gr,gd; 509 __s32 gp,gr,gd;
508}; 510};
509 511
510 512
@@ -517,7 +519,7 @@ struct smu_sdbp_cpupiddata {
517 * if not found. The data format is described below 519 * if not found. The data format is described below
518 */ 520 */
519extern struct smu_sdbp_header *smu_get_sdb_partition(int id, 521extern struct smu_sdbp_header *smu_get_sdb_partition(int id,
520 unsigned int *size); 522 unsigned int *size);
521 523
522#endif /* __KERNEL__ */ 524#endif /* __KERNEL__ */
523 525
@@ -554,7 +556,7 @@ struct smu_user_cmd_hdr
554 __u32 cmdtype; 556 __u32 cmdtype;
555#define SMU_CMDTYPE_SMU 0 /* SMU command */ 557#define SMU_CMDTYPE_SMU 0 /* SMU command */
556#define SMU_CMDTYPE_WANTS_EVENTS 1 /* switch fd to events mode */ 558#define SMU_CMDTYPE_WANTS_EVENTS 1 /* switch fd to events mode */
557#define SMU_CMDTYPE_GET_PARTITION 2 /* retreive an sdb partition */ 559#define SMU_CMDTYPE_GET_PARTITION 2 /* retrieve an sdb partition */
558 560
559 __u8 cmd; /* SMU command byte */ 561 __u8 cmd; /* SMU command byte */
560 __u8 pad[3]; /* padding */ 562 __u8 pad[3]; /* padding */
diff --git a/include/asm-powerpc/sparsemem.h b/include/asm-powerpc/sparsemem.h
index ba1b34fdb967..38b1ea3b58fd 100644
--- a/include/asm-powerpc/sparsemem.h
+++ b/include/asm-powerpc/sparsemem.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_SPARSEMEM_H 1#ifndef _ASM_POWERPC_SPARSEMEM_H
2#define _ASM_POWERPC_SPARSEMEM_H 1 2#define _ASM_POWERPC_SPARSEMEM_H 1
3#ifdef __KERNEL__
3 4
4#ifdef CONFIG_SPARSEMEM 5#ifdef CONFIG_SPARSEMEM
5/* 6/*
@@ -13,8 +14,17 @@
13 14
14#ifdef CONFIG_MEMORY_HOTPLUG 15#ifdef CONFIG_MEMORY_HOTPLUG
15extern void create_section_mapping(unsigned long start, unsigned long end); 16extern void create_section_mapping(unsigned long start, unsigned long end);
17#ifdef CONFIG_NUMA
18extern int hot_add_scn_to_nid(unsigned long scn_addr);
19#else
20static inline int hot_add_scn_to_nid(unsigned long scn_addr)
21{
22 return 0;
23}
24#endif /* CONFIG_NUMA */
16#endif /* CONFIG_MEMORY_HOTPLUG */ 25#endif /* CONFIG_MEMORY_HOTPLUG */
17 26
18#endif /* CONFIG_SPARSEMEM */ 27#endif /* CONFIG_SPARSEMEM */
19 28
29#endif /* __KERNEL__ */
20#endif /* _ASM_POWERPC_SPARSEMEM_H */ 30#endif /* _ASM_POWERPC_SPARSEMEM_H */
diff --git a/include/asm-powerpc/spinlock.h b/include/asm-powerpc/spinlock.h
index caa4b14e0e94..754900901cd8 100644
--- a/include/asm-powerpc/spinlock.h
+++ b/include/asm-powerpc/spinlock.h
@@ -1,5 +1,6 @@
1#ifndef __ASM_SPINLOCK_H 1#ifndef __ASM_SPINLOCK_H
2#define __ASM_SPINLOCK_H 2#define __ASM_SPINLOCK_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Simple spin lock operations. 6 * Simple spin lock operations.
@@ -266,4 +267,5 @@ static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
266 rw->lock = 0; 267 rw->lock = 0;
267} 268}
268 269
270#endif /* __KERNEL__ */
269#endif /* __ASM_SPINLOCK_H */ 271#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
new file mode 100644
index 000000000000..38bacf2f6e0c
--- /dev/null
+++ b/include/asm-powerpc/spu.h
@@ -0,0 +1,600 @@
1/*
2 * SPU core / file system interface and HW structures
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _SPU_H
24#define _SPU_H
25#ifdef __KERNEL__
26
27#include <linux/config.h>
28#include <linux/kref.h>
29#include <linux/workqueue.h>
30
31#define LS_SIZE (256 * 1024)
32#define LS_ADDR_MASK (LS_SIZE - 1)
33
34#define MFC_PUT_CMD 0x20
35#define MFC_PUTS_CMD 0x28
36#define MFC_PUTR_CMD 0x30
37#define MFC_PUTF_CMD 0x22
38#define MFC_PUTB_CMD 0x21
39#define MFC_PUTFS_CMD 0x2A
40#define MFC_PUTBS_CMD 0x29
41#define MFC_PUTRF_CMD 0x32
42#define MFC_PUTRB_CMD 0x31
43#define MFC_PUTL_CMD 0x24
44#define MFC_PUTRL_CMD 0x34
45#define MFC_PUTLF_CMD 0x26
46#define MFC_PUTLB_CMD 0x25
47#define MFC_PUTRLF_CMD 0x36
48#define MFC_PUTRLB_CMD 0x35
49
50#define MFC_GET_CMD 0x40
51#define MFC_GETS_CMD 0x48
52#define MFC_GETF_CMD 0x42
53#define MFC_GETB_CMD 0x41
54#define MFC_GETFS_CMD 0x4A
55#define MFC_GETBS_CMD 0x49
56#define MFC_GETL_CMD 0x44
57#define MFC_GETLF_CMD 0x46
58#define MFC_GETLB_CMD 0x45
59
60#define MFC_SDCRT_CMD 0x80
61#define MFC_SDCRTST_CMD 0x81
62#define MFC_SDCRZ_CMD 0x89
63#define MFC_SDCRS_CMD 0x8D
64#define MFC_SDCRF_CMD 0x8F
65
66#define MFC_GETLLAR_CMD 0xD0
67#define MFC_PUTLLC_CMD 0xB4
68#define MFC_PUTLLUC_CMD 0xB0
69#define MFC_PUTQLLUC_CMD 0xB8
70#define MFC_SNDSIG_CMD 0xA0
71#define MFC_SNDSIGB_CMD 0xA1
72#define MFC_SNDSIGF_CMD 0xA2
73#define MFC_BARRIER_CMD 0xC0
74#define MFC_EIEIO_CMD 0xC8
75#define MFC_SYNC_CMD 0xCC
76
77#define MFC_MIN_DMA_SIZE_SHIFT 4 /* 16 bytes */
78#define MFC_MAX_DMA_SIZE_SHIFT 14 /* 16384 bytes */
79#define MFC_MIN_DMA_SIZE (1 << MFC_MIN_DMA_SIZE_SHIFT)
80#define MFC_MAX_DMA_SIZE (1 << MFC_MAX_DMA_SIZE_SHIFT)
81#define MFC_MIN_DMA_SIZE_MASK (MFC_MIN_DMA_SIZE - 1)
82#define MFC_MAX_DMA_SIZE_MASK (MFC_MAX_DMA_SIZE - 1)
83#define MFC_MIN_DMA_LIST_SIZE 0x0008 /* 8 bytes */
84#define MFC_MAX_DMA_LIST_SIZE 0x4000 /* 16K bytes */
85
86#define MFC_TAGID_TO_TAGMASK(tag_id) (1 << (tag_id & 0x1F))
87
88/* Events for Channels 0-2 */
89#define MFC_DMA_TAG_STATUS_UPDATE_EVENT 0x00000001
90#define MFC_DMA_TAG_CMD_STALL_NOTIFY_EVENT 0x00000002
91#define MFC_DMA_QUEUE_AVAILABLE_EVENT 0x00000008
92#define MFC_SPU_MAILBOX_WRITTEN_EVENT 0x00000010
93#define MFC_DECREMENTER_EVENT 0x00000020
94#define MFC_PU_INT_MAILBOX_AVAILABLE_EVENT 0x00000040
95#define MFC_PU_MAILBOX_AVAILABLE_EVENT 0x00000080
96#define MFC_SIGNAL_2_EVENT 0x00000100
97#define MFC_SIGNAL_1_EVENT 0x00000200
98#define MFC_LLR_LOST_EVENT 0x00000400
99#define MFC_PRIV_ATTN_EVENT 0x00000800
100#define MFC_MULTI_SRC_EVENT 0x00001000
101
102/* Flags indicating progress during context switch. */
103#define SPU_CONTEXT_SWITCH_PENDING 0UL
104#define SPU_CONTEXT_SWITCH_ACTIVE 1UL
105
106struct spu_context;
107struct spu_runqueue;
108
109struct spu {
110 char *name;
111 unsigned long local_store_phys;
112 u8 *local_store;
113 struct spu_problem __iomem *problem;
114 struct spu_priv1 __iomem *priv1;
115 struct spu_priv2 __iomem *priv2;
116 struct list_head list;
117 struct list_head sched_list;
118 int number;
119 u32 isrc;
120 u32 node;
121 u64 flags;
122 u64 dar;
123 u64 dsisr;
124 struct kref kref;
125 size_t ls_size;
126 unsigned int slb_replace;
127 struct mm_struct *mm;
128 struct spu_context *ctx;
129 struct spu_runqueue *rq;
130 unsigned long long timestamp;
131 pid_t pid;
132 int prio;
133 int class_0_pending;
134 spinlock_t register_lock;
135
136 u32 stop_code;
137 void (* wbox_callback)(struct spu *spu);
138 void (* ibox_callback)(struct spu *spu);
139 void (* stop_callback)(struct spu *spu);
140
141 char irq_c0[8];
142 char irq_c1[8];
143 char irq_c2[8];
144};
145
146struct spu *spu_alloc(void);
147void spu_free(struct spu *spu);
148int spu_irq_class_0_bottom(struct spu *spu);
149int spu_irq_class_1_bottom(struct spu *spu);
150void spu_irq_setaffinity(struct spu *spu, int cpu);
151
152extern struct spufs_calls {
153 asmlinkage long (*create_thread)(const char __user *name,
154 unsigned int flags, mode_t mode);
155 asmlinkage long (*spu_run)(struct file *filp, __u32 __user *unpc,
156 __u32 __user *ustatus);
157 struct module *owner;
158} spufs_calls;
159
160#ifdef CONFIG_SPU_FS_MODULE
161int register_spu_syscalls(struct spufs_calls *calls);
162void unregister_spu_syscalls(struct spufs_calls *calls);
163#else
164static inline int register_spu_syscalls(struct spufs_calls *calls)
165{
166 return 0;
167}
168static inline void unregister_spu_syscalls(struct spufs_calls *calls)
169{
170}
171#endif /* MODULE */
172
173
174/* access to priv1 registers */
175void spu_int_mask_and(struct spu *spu, int class, u64 mask);
176void spu_int_mask_or(struct spu *spu, int class, u64 mask);
177void spu_int_mask_set(struct spu *spu, int class, u64 mask);
178u64 spu_int_mask_get(struct spu *spu, int class);
179void spu_int_stat_clear(struct spu *spu, int class, u64 stat);
180u64 spu_int_stat_get(struct spu *spu, int class);
181void spu_int_route_set(struct spu *spu, u64 route);
182u64 spu_mfc_dar_get(struct spu *spu);
183u64 spu_mfc_dsisr_get(struct spu *spu);
184void spu_mfc_dsisr_set(struct spu *spu, u64 dsisr);
185void spu_mfc_sdr_set(struct spu *spu, u64 sdr);
186void spu_mfc_sr1_set(struct spu *spu, u64 sr1);
187u64 spu_mfc_sr1_get(struct spu *spu);
188void spu_mfc_tclass_id_set(struct spu *spu, u64 tclass_id);
189u64 spu_mfc_tclass_id_get(struct spu *spu);
190void spu_tlb_invalidate(struct spu *spu);
191void spu_resource_allocation_groupID_set(struct spu *spu, u64 id);
192u64 spu_resource_allocation_groupID_get(struct spu *spu);
193void spu_resource_allocation_enable_set(struct spu *spu, u64 enable);
194u64 spu_resource_allocation_enable_get(struct spu *spu);
195
196
197/*
198 * This defines the Local Store, Problem Area and Privlege Area of an SPU.
199 */
200
201union mfc_tag_size_class_cmd {
202 struct {
203 u16 mfc_size;
204 u16 mfc_tag;
205 u8 pad;
206 u8 mfc_rclassid;
207 u16 mfc_cmd;
208 } u;
209 struct {
210 u32 mfc_size_tag32;
211 u32 mfc_class_cmd32;
212 } by32;
213 u64 all64;
214};
215
216struct mfc_cq_sr {
217 u64 mfc_cq_data0_RW;
218 u64 mfc_cq_data1_RW;
219 u64 mfc_cq_data2_RW;
220 u64 mfc_cq_data3_RW;
221};
222
223struct spu_problem {
224#define MS_SYNC_PENDING 1L
225 u64 spc_mssync_RW; /* 0x0000 */
226 u8 pad_0x0008_0x3000[0x3000 - 0x0008];
227
228 /* DMA Area */
229 u8 pad_0x3000_0x3004[0x4]; /* 0x3000 */
230 u32 mfc_lsa_W; /* 0x3004 */
231 u64 mfc_ea_W; /* 0x3008 */
232 union mfc_tag_size_class_cmd mfc_union_W; /* 0x3010 */
233 u8 pad_0x3018_0x3104[0xec]; /* 0x3018 */
234 u32 dma_qstatus_R; /* 0x3104 */
235 u8 pad_0x3108_0x3204[0xfc]; /* 0x3108 */
236 u32 dma_querytype_RW; /* 0x3204 */
237 u8 pad_0x3208_0x321c[0x14]; /* 0x3208 */
238 u32 dma_querymask_RW; /* 0x321c */
239 u8 pad_0x3220_0x322c[0xc]; /* 0x3220 */
240 u32 dma_tagstatus_R; /* 0x322c */
241#define DMA_TAGSTATUS_INTR_ANY 1u
242#define DMA_TAGSTATUS_INTR_ALL 2u
243 u8 pad_0x3230_0x4000[0x4000 - 0x3230]; /* 0x3230 */
244
245 /* SPU Control Area */
246 u8 pad_0x4000_0x4004[0x4]; /* 0x4000 */
247 u32 pu_mb_R; /* 0x4004 */
248 u8 pad_0x4008_0x400c[0x4]; /* 0x4008 */
249 u32 spu_mb_W; /* 0x400c */
250 u8 pad_0x4010_0x4014[0x4]; /* 0x4010 */
251 u32 mb_stat_R; /* 0x4014 */
252 u8 pad_0x4018_0x401c[0x4]; /* 0x4018 */
253 u32 spu_runcntl_RW; /* 0x401c */
254#define SPU_RUNCNTL_STOP 0L
255#define SPU_RUNCNTL_RUNNABLE 1L
256 u8 pad_0x4020_0x4024[0x4]; /* 0x4020 */
257 u32 spu_status_R; /* 0x4024 */
258#define SPU_STOP_STATUS_SHIFT 16
259#define SPU_STATUS_STOPPED 0x0
260#define SPU_STATUS_RUNNING 0x1
261#define SPU_STATUS_STOPPED_BY_STOP 0x2
262#define SPU_STATUS_STOPPED_BY_HALT 0x4
263#define SPU_STATUS_WAITING_FOR_CHANNEL 0x8
264#define SPU_STATUS_SINGLE_STEP 0x10
265#define SPU_STATUS_INVALID_INSTR 0x20
266#define SPU_STATUS_INVALID_CH 0x40
267#define SPU_STATUS_ISOLATED_STATE 0x80
268#define SPU_STATUS_ISOLATED_LOAD_STAUTUS 0x200
269#define SPU_STATUS_ISOLATED_EXIT_STAUTUS 0x400
270 u8 pad_0x4028_0x402c[0x4]; /* 0x4028 */
271 u32 spu_spe_R; /* 0x402c */
272 u8 pad_0x4030_0x4034[0x4]; /* 0x4030 */
273 u32 spu_npc_RW; /* 0x4034 */
274 u8 pad_0x4038_0x14000[0x14000 - 0x4038]; /* 0x4038 */
275
276 /* Signal Notification Area */
277 u8 pad_0x14000_0x1400c[0xc]; /* 0x14000 */
278 u32 signal_notify1; /* 0x1400c */
279 u8 pad_0x14010_0x1c00c[0x7ffc]; /* 0x14010 */
280 u32 signal_notify2; /* 0x1c00c */
281} __attribute__ ((aligned(0x20000)));
282
283/* SPU Privilege 2 State Area */
284struct spu_priv2 {
285 /* MFC Registers */
286 u8 pad_0x0000_0x1100[0x1100 - 0x0000]; /* 0x0000 */
287
288 /* SLB Management Registers */
289 u8 pad_0x1100_0x1108[0x8]; /* 0x1100 */
290 u64 slb_index_W; /* 0x1108 */
291#define SLB_INDEX_MASK 0x7L
292 u64 slb_esid_RW; /* 0x1110 */
293 u64 slb_vsid_RW; /* 0x1118 */
294#define SLB_VSID_SUPERVISOR_STATE (0x1ull << 11)
295#define SLB_VSID_SUPERVISOR_STATE_MASK (0x1ull << 11)
296#define SLB_VSID_PROBLEM_STATE (0x1ull << 10)
297#define SLB_VSID_PROBLEM_STATE_MASK (0x1ull << 10)
298#define SLB_VSID_EXECUTE_SEGMENT (0x1ull << 9)
299#define SLB_VSID_NO_EXECUTE_SEGMENT (0x1ull << 9)
300#define SLB_VSID_EXECUTE_SEGMENT_MASK (0x1ull << 9)
301#define SLB_VSID_4K_PAGE (0x0 << 8)
302#define SLB_VSID_LARGE_PAGE (0x1ull << 8)
303#define SLB_VSID_PAGE_SIZE_MASK (0x1ull << 8)
304#define SLB_VSID_CLASS_MASK (0x1ull << 7)
305#define SLB_VSID_VIRTUAL_PAGE_SIZE_MASK (0x1ull << 6)
306 u64 slb_invalidate_entry_W; /* 0x1120 */
307 u64 slb_invalidate_all_W; /* 0x1128 */
308 u8 pad_0x1130_0x2000[0x2000 - 0x1130]; /* 0x1130 */
309
310 /* Context Save / Restore Area */
311 struct mfc_cq_sr spuq[16]; /* 0x2000 */
312 struct mfc_cq_sr puq[8]; /* 0x2200 */
313 u8 pad_0x2300_0x3000[0x3000 - 0x2300]; /* 0x2300 */
314
315 /* MFC Control */
316 u64 mfc_control_RW; /* 0x3000 */
317#define MFC_CNTL_RESUME_DMA_QUEUE (0ull << 0)
318#define MFC_CNTL_SUSPEND_DMA_QUEUE (1ull << 0)
319#define MFC_CNTL_SUSPEND_DMA_QUEUE_MASK (1ull << 0)
320#define MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION (0ull << 8)
321#define MFC_CNTL_SUSPEND_IN_PROGRESS (1ull << 8)
322#define MFC_CNTL_SUSPEND_COMPLETE (3ull << 8)
323#define MFC_CNTL_SUSPEND_DMA_STATUS_MASK (3ull << 8)
324#define MFC_CNTL_DMA_QUEUES_EMPTY (1ull << 14)
325#define MFC_CNTL_DMA_QUEUES_EMPTY_MASK (1ull << 14)
326#define MFC_CNTL_PURGE_DMA_REQUEST (1ull << 15)
327#define MFC_CNTL_PURGE_DMA_IN_PROGRESS (1ull << 24)
328#define MFC_CNTL_PURGE_DMA_COMPLETE (3ull << 24)
329#define MFC_CNTL_PURGE_DMA_STATUS_MASK (3ull << 24)
330#define MFC_CNTL_RESTART_DMA_COMMAND (1ull << 32)
331#define MFC_CNTL_DMA_COMMAND_REISSUE_PENDING (1ull << 32)
332#define MFC_CNTL_DMA_COMMAND_REISSUE_STATUS_MASK (1ull << 32)
333#define MFC_CNTL_MFC_PRIVILEGE_STATE (2ull << 33)
334#define MFC_CNTL_MFC_PROBLEM_STATE (3ull << 33)
335#define MFC_CNTL_MFC_KEY_PROTECTION_STATE_MASK (3ull << 33)
336#define MFC_CNTL_DECREMENTER_HALTED (1ull << 35)
337#define MFC_CNTL_DECREMENTER_RUNNING (1ull << 40)
338#define MFC_CNTL_DECREMENTER_STATUS_MASK (1ull << 40)
339 u8 pad_0x3008_0x4000[0x4000 - 0x3008]; /* 0x3008 */
340
341 /* Interrupt Mailbox */
342 u64 puint_mb_R; /* 0x4000 */
343 u8 pad_0x4008_0x4040[0x4040 - 0x4008]; /* 0x4008 */
344
345 /* SPU Control */
346 u64 spu_privcntl_RW; /* 0x4040 */
347#define SPU_PRIVCNTL_MODE_NORMAL (0x0ull << 0)
348#define SPU_PRIVCNTL_MODE_SINGLE_STEP (0x1ull << 0)
349#define SPU_PRIVCNTL_MODE_MASK (0x1ull << 0)
350#define SPU_PRIVCNTL_NO_ATTENTION_EVENT (0x0ull << 1)
351#define SPU_PRIVCNTL_ATTENTION_EVENT (0x1ull << 1)
352#define SPU_PRIVCNTL_ATTENTION_EVENT_MASK (0x1ull << 1)
353#define SPU_PRIVCNT_LOAD_REQUEST_NORMAL (0x0ull << 2)
354#define SPU_PRIVCNT_LOAD_REQUEST_ENABLE_MASK (0x1ull << 2)
355 u8 pad_0x4048_0x4058[0x10]; /* 0x4048 */
356 u64 spu_lslr_RW; /* 0x4058 */
357 u64 spu_chnlcntptr_RW; /* 0x4060 */
358 u64 spu_chnlcnt_RW; /* 0x4068 */
359 u64 spu_chnldata_RW; /* 0x4070 */
360 u64 spu_cfg_RW; /* 0x4078 */
361 u8 pad_0x4080_0x5000[0x5000 - 0x4080]; /* 0x4080 */
362
363 /* PV2_ImplRegs: Implementation-specific privileged-state 2 regs */
364 u64 spu_pm_trace_tag_status_RW; /* 0x5000 */
365 u64 spu_tag_status_query_RW; /* 0x5008 */
366#define TAG_STATUS_QUERY_CONDITION_BITS (0x3ull << 32)
367#define TAG_STATUS_QUERY_MASK_BITS (0xffffffffull)
368 u64 spu_cmd_buf1_RW; /* 0x5010 */
369#define SPU_COMMAND_BUFFER_1_LSA_BITS (0x7ffffull << 32)
370#define SPU_COMMAND_BUFFER_1_EAH_BITS (0xffffffffull)
371 u64 spu_cmd_buf2_RW; /* 0x5018 */
372#define SPU_COMMAND_BUFFER_2_EAL_BITS ((0xffffffffull) << 32)
373#define SPU_COMMAND_BUFFER_2_TS_BITS (0xffffull << 16)
374#define SPU_COMMAND_BUFFER_2_TAG_BITS (0x3full)
375 u64 spu_atomic_status_RW; /* 0x5020 */
376} __attribute__ ((aligned(0x20000)));
377
378/* SPU Privilege 1 State Area */
379struct spu_priv1 {
380 /* Control and Configuration Area */
381 u64 mfc_sr1_RW; /* 0x000 */
382#define MFC_STATE1_LOCAL_STORAGE_DECODE_MASK 0x01ull
383#define MFC_STATE1_BUS_TLBIE_MASK 0x02ull
384#define MFC_STATE1_REAL_MODE_OFFSET_ENABLE_MASK 0x04ull
385#define MFC_STATE1_PROBLEM_STATE_MASK 0x08ull
386#define MFC_STATE1_RELOCATE_MASK 0x10ull
387#define MFC_STATE1_MASTER_RUN_CONTROL_MASK 0x20ull
388 u64 mfc_lpid_RW; /* 0x008 */
389 u64 spu_idr_RW; /* 0x010 */
390 u64 mfc_vr_RO; /* 0x018 */
391#define MFC_VERSION_BITS (0xffff << 16)
392#define MFC_REVISION_BITS (0xffff)
393#define MFC_GET_VERSION_BITS(vr) (((vr) & MFC_VERSION_BITS) >> 16)
394#define MFC_GET_REVISION_BITS(vr) ((vr) & MFC_REVISION_BITS)
395 u64 spu_vr_RO; /* 0x020 */
396#define SPU_VERSION_BITS (0xffff << 16)
397#define SPU_REVISION_BITS (0xffff)
398#define SPU_GET_VERSION_BITS(vr) (vr & SPU_VERSION_BITS) >> 16
399#define SPU_GET_REVISION_BITS(vr) (vr & SPU_REVISION_BITS)
400 u8 pad_0x28_0x100[0x100 - 0x28]; /* 0x28 */
401
402
403 /* Interrupt Area */
404 u64 int_mask_RW[3]; /* 0x100 */
405#define CLASS0_ENABLE_DMA_ALIGNMENT_INTR 0x1L
406#define CLASS0_ENABLE_INVALID_DMA_COMMAND_INTR 0x2L
407#define CLASS0_ENABLE_SPU_ERROR_INTR 0x4L
408#define CLASS0_ENABLE_MFC_FIR_INTR 0x8L
409#define CLASS1_ENABLE_SEGMENT_FAULT_INTR 0x1L
410#define CLASS1_ENABLE_STORAGE_FAULT_INTR 0x2L
411#define CLASS1_ENABLE_LS_COMPARE_SUSPEND_ON_GET_INTR 0x4L
412#define CLASS1_ENABLE_LS_COMPARE_SUSPEND_ON_PUT_INTR 0x8L
413#define CLASS2_ENABLE_MAILBOX_INTR 0x1L
414#define CLASS2_ENABLE_SPU_STOP_INTR 0x2L
415#define CLASS2_ENABLE_SPU_HALT_INTR 0x4L
416#define CLASS2_ENABLE_SPU_DMA_TAG_GROUP_COMPLETE_INTR 0x8L
417 u8 pad_0x118_0x140[0x28]; /* 0x118 */
418 u64 int_stat_RW[3]; /* 0x140 */
419 u8 pad_0x158_0x180[0x28]; /* 0x158 */
420 u64 int_route_RW; /* 0x180 */
421
422 /* Interrupt Routing */
423 u8 pad_0x188_0x200[0x200 - 0x188]; /* 0x188 */
424
425 /* Atomic Unit Control Area */
426 u64 mfc_atomic_flush_RW; /* 0x200 */
427#define mfc_atomic_flush_enable 0x1L
428 u8 pad_0x208_0x280[0x78]; /* 0x208 */
429 u64 resource_allocation_groupID_RW; /* 0x280 */
430 u64 resource_allocation_enable_RW; /* 0x288 */
431 u8 pad_0x290_0x3c8[0x3c8 - 0x290]; /* 0x290 */
432
433 /* SPU_Cache_ImplRegs: Implementation-dependent cache registers */
434
435 u64 smf_sbi_signal_sel; /* 0x3c8 */
436#define smf_sbi_mask_lsb 56
437#define smf_sbi_shift (63 - smf_sbi_mask_lsb)
438#define smf_sbi_mask (0x301LL << smf_sbi_shift)
439#define smf_sbi_bus0_bits (0x001LL << smf_sbi_shift)
440#define smf_sbi_bus2_bits (0x100LL << smf_sbi_shift)
441#define smf_sbi2_bus0_bits (0x201LL << smf_sbi_shift)
442#define smf_sbi2_bus2_bits (0x300LL << smf_sbi_shift)
443 u64 smf_ato_signal_sel; /* 0x3d0 */
444#define smf_ato_mask_lsb 35
445#define smf_ato_shift (63 - smf_ato_mask_lsb)
446#define smf_ato_mask (0x3LL << smf_ato_shift)
447#define smf_ato_bus0_bits (0x2LL << smf_ato_shift)
448#define smf_ato_bus2_bits (0x1LL << smf_ato_shift)
449 u8 pad_0x3d8_0x400[0x400 - 0x3d8]; /* 0x3d8 */
450
451 /* TLB Management Registers */
452 u64 mfc_sdr_RW; /* 0x400 */
453 u8 pad_0x408_0x500[0xf8]; /* 0x408 */
454 u64 tlb_index_hint_RO; /* 0x500 */
455 u64 tlb_index_W; /* 0x508 */
456 u64 tlb_vpn_RW; /* 0x510 */
457 u64 tlb_rpn_RW; /* 0x518 */
458 u8 pad_0x520_0x540[0x20]; /* 0x520 */
459 u64 tlb_invalidate_entry_W; /* 0x540 */
460 u64 tlb_invalidate_all_W; /* 0x548 */
461 u8 pad_0x550_0x580[0x580 - 0x550]; /* 0x550 */
462
463 /* SPU_MMU_ImplRegs: Implementation-dependent MMU registers */
464 u64 smm_hid; /* 0x580 */
465#define PAGE_SIZE_MASK 0xf000000000000000ull
466#define PAGE_SIZE_16MB_64KB 0x2000000000000000ull
467 u8 pad_0x588_0x600[0x600 - 0x588]; /* 0x588 */
468
469 /* MFC Status/Control Area */
470 u64 mfc_accr_RW; /* 0x600 */
471#define MFC_ACCR_EA_ACCESS_GET (1 << 0)
472#define MFC_ACCR_EA_ACCESS_PUT (1 << 1)
473#define MFC_ACCR_LS_ACCESS_GET (1 << 3)
474#define MFC_ACCR_LS_ACCESS_PUT (1 << 4)
475 u8 pad_0x608_0x610[0x8]; /* 0x608 */
476 u64 mfc_dsisr_RW; /* 0x610 */
477#define MFC_DSISR_PTE_NOT_FOUND (1 << 30)
478#define MFC_DSISR_ACCESS_DENIED (1 << 27)
479#define MFC_DSISR_ATOMIC (1 << 26)
480#define MFC_DSISR_ACCESS_PUT (1 << 25)
481#define MFC_DSISR_ADDR_MATCH (1 << 22)
482#define MFC_DSISR_LS (1 << 17)
483#define MFC_DSISR_L (1 << 16)
484#define MFC_DSISR_ADDRESS_OVERFLOW (1 << 0)
485 u8 pad_0x618_0x620[0x8]; /* 0x618 */
486 u64 mfc_dar_RW; /* 0x620 */
487 u8 pad_0x628_0x700[0x700 - 0x628]; /* 0x628 */
488
489 /* Replacement Management Table (RMT) Area */
490 u64 rmt_index_RW; /* 0x700 */
491 u8 pad_0x708_0x710[0x8]; /* 0x708 */
492 u64 rmt_data1_RW; /* 0x710 */
493 u8 pad_0x718_0x800[0x800 - 0x718]; /* 0x718 */
494
495 /* Control/Configuration Registers */
496 u64 mfc_dsir_R; /* 0x800 */
497#define MFC_DSIR_Q (1 << 31)
498#define MFC_DSIR_SPU_QUEUE MFC_DSIR_Q
499 u64 mfc_lsacr_RW; /* 0x808 */
500#define MFC_LSACR_COMPARE_MASK ((~0ull) << 32)
501#define MFC_LSACR_COMPARE_ADDR ((~0ull) >> 32)
502 u64 mfc_lscrr_R; /* 0x810 */
503#define MFC_LSCRR_Q (1 << 31)
504#define MFC_LSCRR_SPU_QUEUE MFC_LSCRR_Q
505#define MFC_LSCRR_QI_SHIFT 32
506#define MFC_LSCRR_QI_MASK ((~0ull) << MFC_LSCRR_QI_SHIFT)
507 u8 pad_0x818_0x820[0x8]; /* 0x818 */
508 u64 mfc_tclass_id_RW; /* 0x820 */
509#define MFC_TCLASS_ID_ENABLE (1L << 0L)
510#define MFC_TCLASS_SLOT2_ENABLE (1L << 5L)
511#define MFC_TCLASS_SLOT1_ENABLE (1L << 6L)
512#define MFC_TCLASS_SLOT0_ENABLE (1L << 7L)
513#define MFC_TCLASS_QUOTA_2_SHIFT 8L
514#define MFC_TCLASS_QUOTA_1_SHIFT 16L
515#define MFC_TCLASS_QUOTA_0_SHIFT 24L
516#define MFC_TCLASS_QUOTA_2_MASK (0x1FL << MFC_TCLASS_QUOTA_2_SHIFT)
517#define MFC_TCLASS_QUOTA_1_MASK (0x1FL << MFC_TCLASS_QUOTA_1_SHIFT)
518#define MFC_TCLASS_QUOTA_0_MASK (0x1FL << MFC_TCLASS_QUOTA_0_SHIFT)
519 u8 pad_0x828_0x900[0x900 - 0x828]; /* 0x828 */
520
521 /* Real Mode Support Registers */
522 u64 mfc_rm_boundary; /* 0x900 */
523 u8 pad_0x908_0x938[0x30]; /* 0x908 */
524 u64 smf_dma_signal_sel; /* 0x938 */
525#define mfc_dma1_mask_lsb 41
526#define mfc_dma1_shift (63 - mfc_dma1_mask_lsb)
527#define mfc_dma1_mask (0x3LL << mfc_dma1_shift)
528#define mfc_dma1_bits (0x1LL << mfc_dma1_shift)
529#define mfc_dma2_mask_lsb 43
530#define mfc_dma2_shift (63 - mfc_dma2_mask_lsb)
531#define mfc_dma2_mask (0x3LL << mfc_dma2_shift)
532#define mfc_dma2_bits (0x1LL << mfc_dma2_shift)
533 u8 pad_0x940_0xa38[0xf8]; /* 0x940 */
534 u64 smm_signal_sel; /* 0xa38 */
535#define smm_sig_mask_lsb 12
536#define smm_sig_shift (63 - smm_sig_mask_lsb)
537#define smm_sig_mask (0x3LL << smm_sig_shift)
538#define smm_sig_bus0_bits (0x2LL << smm_sig_shift)
539#define smm_sig_bus2_bits (0x1LL << smm_sig_shift)
540 u8 pad_0xa40_0xc00[0xc00 - 0xa40]; /* 0xa40 */
541
542 /* DMA Command Error Area */
543 u64 mfc_cer_R; /* 0xc00 */
544#define MFC_CER_Q (1 << 31)
545#define MFC_CER_SPU_QUEUE MFC_CER_Q
546 u8 pad_0xc08_0x1000[0x1000 - 0xc08]; /* 0xc08 */
547
548 /* PV1_ImplRegs: Implementation-dependent privileged-state 1 regs */
549 /* DMA Command Error Area */
550 u64 spu_ecc_cntl_RW; /* 0x1000 */
551#define SPU_ECC_CNTL_E (1ull << 0ull)
552#define SPU_ECC_CNTL_ENABLE SPU_ECC_CNTL_E
553#define SPU_ECC_CNTL_DISABLE (~SPU_ECC_CNTL_E & 1L)
554#define SPU_ECC_CNTL_S (1ull << 1ull)
555#define SPU_ECC_STOP_AFTER_ERROR SPU_ECC_CNTL_S
556#define SPU_ECC_CONTINUE_AFTER_ERROR (~SPU_ECC_CNTL_S & 2L)
557#define SPU_ECC_CNTL_B (1ull << 2ull)
558#define SPU_ECC_BACKGROUND_ENABLE SPU_ECC_CNTL_B
559#define SPU_ECC_BACKGROUND_DISABLE (~SPU_ECC_CNTL_B & 4L)
560#define SPU_ECC_CNTL_I_SHIFT 3ull
561#define SPU_ECC_CNTL_I_MASK (3ull << SPU_ECC_CNTL_I_SHIFT)
562#define SPU_ECC_WRITE_ALWAYS (~SPU_ECC_CNTL_I & 12L)
563#define SPU_ECC_WRITE_CORRECTABLE (1ull << SPU_ECC_CNTL_I_SHIFT)
564#define SPU_ECC_WRITE_UNCORRECTABLE (3ull << SPU_ECC_CNTL_I_SHIFT)
565#define SPU_ECC_CNTL_D (1ull << 5ull)
566#define SPU_ECC_DETECTION_ENABLE SPU_ECC_CNTL_D
567#define SPU_ECC_DETECTION_DISABLE (~SPU_ECC_CNTL_D & 32L)
568 u64 spu_ecc_stat_RW; /* 0x1008 */
569#define SPU_ECC_CORRECTED_ERROR (1ull << 0ul)
570#define SPU_ECC_UNCORRECTED_ERROR (1ull << 1ul)
571#define SPU_ECC_SCRUB_COMPLETE (1ull << 2ul)
572#define SPU_ECC_SCRUB_IN_PROGRESS (1ull << 3ul)
573#define SPU_ECC_INSTRUCTION_ERROR (1ull << 4ul)
574#define SPU_ECC_DATA_ERROR (1ull << 5ul)
575#define SPU_ECC_DMA_ERROR (1ull << 6ul)
576#define SPU_ECC_STATUS_CNT_MASK (256ull << 8)
577 u64 spu_ecc_addr_RW; /* 0x1010 */
578 u64 spu_err_mask_RW; /* 0x1018 */
579#define SPU_ERR_ILLEGAL_INSTR (1ull << 0ul)
580#define SPU_ERR_ILLEGAL_CHANNEL (1ull << 1ul)
581 u8 pad_0x1020_0x1028[0x1028 - 0x1020]; /* 0x1020 */
582
583 /* SPU Debug-Trace Bus (DTB) Selection Registers */
584 u64 spu_trig0_sel; /* 0x1028 */
585 u64 spu_trig1_sel; /* 0x1030 */
586 u64 spu_trig2_sel; /* 0x1038 */
587 u64 spu_trig3_sel; /* 0x1040 */
588 u64 spu_trace_sel; /* 0x1048 */
589#define spu_trace_sel_mask 0x1f1fLL
590#define spu_trace_sel_bus0_bits 0x1000LL
591#define spu_trace_sel_bus2_bits 0x0010LL
592 u64 spu_event0_sel; /* 0x1050 */
593 u64 spu_event1_sel; /* 0x1058 */
594 u64 spu_event2_sel; /* 0x1060 */
595 u64 spu_event3_sel; /* 0x1068 */
596 u64 spu_trace_cntl; /* 0x1070 */
597} __attribute__ ((aligned(0x2000)));
598
599#endif /* __KERNEL__ */
600#endif
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h
new file mode 100644
index 000000000000..ba18d7d4dde2
--- /dev/null
+++ b/include/asm-powerpc/spu_csa.h
@@ -0,0 +1,255 @@
1/*
2 * spu_csa.h: Definitions for SPU context save area (CSA).
3 *
4 * (C) Copyright IBM 2005
5 *
6 * Author: Mark Nutter <mnutter@us.ibm.com>
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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _SPU_CSA_H_
24#define _SPU_CSA_H_
25#ifdef __KERNEL__
26
27/*
28 * Total number of 128-bit registers.
29 */
30#define NR_SPU_GPRS 128
31#define NR_SPU_SPRS 9
32#define NR_SPU_REGS_PAD 7
33#define NR_SPU_SPILL_REGS 144 /* GPRS + SPRS + PAD */
34#define SIZEOF_SPU_SPILL_REGS NR_SPU_SPILL_REGS * 16
35
36#define SPU_SAVE_COMPLETE 0x3FFB
37#define SPU_RESTORE_COMPLETE 0x3FFC
38
39/*
40 * Definitions for various 'stopped' status conditions,
41 * to be recreated during context restore.
42 */
43#define SPU_STOPPED_STATUS_P 1
44#define SPU_STOPPED_STATUS_I 2
45#define SPU_STOPPED_STATUS_H 3
46#define SPU_STOPPED_STATUS_S 4
47#define SPU_STOPPED_STATUS_S_I 5
48#define SPU_STOPPED_STATUS_S_P 6
49#define SPU_STOPPED_STATUS_P_H 7
50#define SPU_STOPPED_STATUS_P_I 8
51#define SPU_STOPPED_STATUS_R 9
52
53#ifndef __ASSEMBLY__
54/**
55 * spu_reg128 - generic 128-bit register definition.
56 */
57struct spu_reg128 {
58 u32 slot[4];
59};
60
61/**
62 * struct spu_lscsa - Local Store Context Save Area.
63 * @gprs: Array of saved registers.
64 * @fpcr: Saved floating point status control register.
65 * @decr: Saved decrementer value.
66 * @decr_status: Indicates decrementer run status.
67 * @ppu_mb: Saved PPU mailbox data.
68 * @ppuint_mb: Saved PPU interrupting mailbox data.
69 * @tag_mask: Saved tag group mask.
70 * @event_mask: Saved event mask.
71 * @srr0: Saved SRR0.
72 * @stopped_status: Conditions to be recreated by restore.
73 * @ls: Saved contents of Local Storage Area.
74 *
75 * The LSCSA represents state that is primarily saved and
76 * restored by SPU-side code.
77 */
78struct spu_lscsa {
79 struct spu_reg128 gprs[128];
80 struct spu_reg128 fpcr;
81 struct spu_reg128 decr;
82 struct spu_reg128 decr_status;
83 struct spu_reg128 ppu_mb;
84 struct spu_reg128 ppuint_mb;
85 struct spu_reg128 tag_mask;
86 struct spu_reg128 event_mask;
87 struct spu_reg128 srr0;
88 struct spu_reg128 stopped_status;
89 struct spu_reg128 pad[119]; /* 'ls' must be page-aligned. */
90 unsigned char ls[LS_SIZE];
91};
92
93/*
94 * struct spu_problem_collapsed - condensed problem state area, w/o pads.
95 */
96struct spu_problem_collapsed {
97 u64 spc_mssync_RW;
98 u32 mfc_lsa_W;
99 u32 unused_pad0;
100 u64 mfc_ea_W;
101 union mfc_tag_size_class_cmd mfc_union_W;
102 u32 dma_qstatus_R;
103 u32 dma_querytype_RW;
104 u32 dma_querymask_RW;
105 u32 dma_tagstatus_R;
106 u32 pu_mb_R;
107 u32 spu_mb_W;
108 u32 mb_stat_R;
109 u32 spu_runcntl_RW;
110 u32 spu_status_R;
111 u32 spu_spc_R;
112 u32 spu_npc_RW;
113 u32 signal_notify1;
114 u32 signal_notify2;
115 u32 unused_pad1;
116};
117
118/*
119 * struct spu_priv1_collapsed - condensed privileged 1 area, w/o pads.
120 */
121struct spu_priv1_collapsed {
122 u64 mfc_sr1_RW;
123 u64 mfc_lpid_RW;
124 u64 spu_idr_RW;
125 u64 mfc_vr_RO;
126 u64 spu_vr_RO;
127 u64 int_mask_class0_RW;
128 u64 int_mask_class1_RW;
129 u64 int_mask_class2_RW;
130 u64 int_stat_class0_RW;
131 u64 int_stat_class1_RW;
132 u64 int_stat_class2_RW;
133 u64 int_route_RW;
134 u64 mfc_atomic_flush_RW;
135 u64 resource_allocation_groupID_RW;
136 u64 resource_allocation_enable_RW;
137 u64 mfc_fir_R;
138 u64 mfc_fir_status_or_W;
139 u64 mfc_fir_status_and_W;
140 u64 mfc_fir_mask_R;
141 u64 mfc_fir_mask_or_W;
142 u64 mfc_fir_mask_and_W;
143 u64 mfc_fir_chkstp_enable_RW;
144 u64 smf_sbi_signal_sel;
145 u64 smf_ato_signal_sel;
146 u64 mfc_sdr_RW;
147 u64 tlb_index_hint_RO;
148 u64 tlb_index_W;
149 u64 tlb_vpn_RW;
150 u64 tlb_rpn_RW;
151 u64 tlb_invalidate_entry_W;
152 u64 tlb_invalidate_all_W;
153 u64 smm_hid;
154 u64 mfc_accr_RW;
155 u64 mfc_dsisr_RW;
156 u64 mfc_dar_RW;
157 u64 rmt_index_RW;
158 u64 rmt_data1_RW;
159 u64 mfc_dsir_R;
160 u64 mfc_lsacr_RW;
161 u64 mfc_lscrr_R;
162 u64 mfc_tclass_id_RW;
163 u64 mfc_rm_boundary;
164 u64 smf_dma_signal_sel;
165 u64 smm_signal_sel;
166 u64 mfc_cer_R;
167 u64 pu_ecc_cntl_RW;
168 u64 pu_ecc_stat_RW;
169 u64 spu_ecc_addr_RW;
170 u64 spu_err_mask_RW;
171 u64 spu_trig0_sel;
172 u64 spu_trig1_sel;
173 u64 spu_trig2_sel;
174 u64 spu_trig3_sel;
175 u64 spu_trace_sel;
176 u64 spu_event0_sel;
177 u64 spu_event1_sel;
178 u64 spu_event2_sel;
179 u64 spu_event3_sel;
180 u64 spu_trace_cntl;
181};
182
183/*
184 * struct spu_priv2_collapsed - condensed priviliged 2 area, w/o pads.
185 */
186struct spu_priv2_collapsed {
187 u64 slb_index_W;
188 u64 slb_esid_RW;
189 u64 slb_vsid_RW;
190 u64 slb_invalidate_entry_W;
191 u64 slb_invalidate_all_W;
192 struct mfc_cq_sr spuq[16];
193 struct mfc_cq_sr puq[8];
194 u64 mfc_control_RW;
195 u64 puint_mb_R;
196 u64 spu_privcntl_RW;
197 u64 spu_lslr_RW;
198 u64 spu_chnlcntptr_RW;
199 u64 spu_chnlcnt_RW;
200 u64 spu_chnldata_RW;
201 u64 spu_cfg_RW;
202 u64 spu_tag_status_query_RW;
203 u64 spu_cmd_buf1_RW;
204 u64 spu_cmd_buf2_RW;
205 u64 spu_atomic_status_RW;
206};
207
208/**
209 * struct spu_state
210 * @lscsa: Local Store Context Save Area.
211 * @prob: Collapsed Problem State Area, w/o pads.
212 * @priv1: Collapsed Privileged 1 Area, w/o pads.
213 * @priv2: Collapsed Privileged 2 Area, w/o pads.
214 * @spu_chnlcnt_RW: Array of saved channel counts.
215 * @spu_chnldata_RW: Array of saved channel data.
216 * @suspend_time: Time stamp when decrementer disabled.
217 * @slb_esid_RW: Array of saved SLB esid entries.
218 * @slb_vsid_RW: Array of saved SLB vsid entries.
219 *
220 * Structure representing the whole of the SPU
221 * context save area (CSA). This struct contains
222 * all of the state necessary to suspend and then
223 * later optionally resume execution of an SPU
224 * context.
225 *
226 * The @lscsa region is by far the largest, and is
227 * allocated separately so that it may either be
228 * pinned or mapped to/from application memory, as
229 * appropriate for the OS environment.
230 */
231struct spu_state {
232 struct spu_lscsa *lscsa;
233 struct spu_problem_collapsed prob;
234 struct spu_priv1_collapsed priv1;
235 struct spu_priv2_collapsed priv2;
236 u64 spu_chnlcnt_RW[32];
237 u64 spu_chnldata_RW[32];
238 u32 spu_mailbox_data[4];
239 u32 pu_mailbox_data[1];
240 unsigned long suspend_time;
241 u64 slb_esid_RW[8];
242 u64 slb_vsid_RW[8];
243 spinlock_t register_lock;
244};
245
246extern void spu_init_csa(struct spu_state *csa);
247extern void spu_fini_csa(struct spu_state *csa);
248extern int spu_save(struct spu_state *prev, struct spu *spu);
249extern int spu_restore(struct spu_state *new, struct spu *spu);
250extern int spu_switch(struct spu_state *prev, struct spu_state *new,
251 struct spu *spu);
252
253#endif /* __KERNEL__ */
254#endif /* !__ASSEMBLY__ */
255#endif /* _SPU_CSA_H_ */
diff --git a/include/asm-powerpc/synch.h b/include/asm-powerpc/synch.h
index 4660c0394a77..794870ab8fd3 100644
--- a/include/asm-powerpc/synch.h
+++ b/include/asm-powerpc/synch.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_POWERPC_SYNCH_H 1#ifndef _ASM_POWERPC_SYNCH_H
2#define _ASM_POWERPC_SYNCH_H 2#define _ASM_POWERPC_SYNCH_H
3 3#ifdef __KERNEL__
4#include <linux/config.h>
5 4
6#ifdef __powerpc64__ 5#ifdef __powerpc64__
7#define __SUBARCH_HAS_LWSYNC 6#define __SUBARCH_HAS_LWSYNC
@@ -47,5 +46,6 @@ static inline void isync(void)
47#define isync_on_smp() __asm__ __volatile__("": : :"memory") 46#define isync_on_smp() __asm__ __volatile__("": : :"memory")
48#endif 47#endif
49 48
49#endif /* __KERNEL__ */
50#endif /* _ASM_POWERPC_SYNCH_H */ 50#endif /* _ASM_POWERPC_SYNCH_H */
51 51
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 5341b75c75cb..9b822afa7d0e 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -4,7 +4,6 @@
4#ifndef _ASM_POWERPC_SYSTEM_H 4#ifndef _ASM_POWERPC_SYSTEM_H
5#define _ASM_POWERPC_SYSTEM_H 5#define _ASM_POWERPC_SYSTEM_H
6 6
7#include <linux/config.h>
8#include <linux/kernel.h> 7#include <linux/kernel.h>
9 8
10#include <asm/hw_irq.h> 9#include <asm/hw_irq.h>
@@ -42,6 +41,7 @@
42#define set_mb(var, value) do { var = value; mb(); } while (0) 41#define set_mb(var, value) do { var = value; mb(); } while (0)
43#define set_wmb(var, value) do { var = value; wmb(); } while (0) 42#define set_wmb(var, value) do { var = value; wmb(); } while (0)
44 43
44#ifdef __KERNEL__
45#ifdef CONFIG_SMP 45#ifdef CONFIG_SMP
46#define smp_mb() mb() 46#define smp_mb() mb()
47#define smp_rmb() rmb() 47#define smp_rmb() rmb()
@@ -54,7 +54,6 @@
54#define smp_read_barrier_depends() do { } while(0) 54#define smp_read_barrier_depends() do { } while(0)
55#endif /* CONFIG_SMP */ 55#endif /* CONFIG_SMP */
56 56
57#ifdef __KERNEL__
58struct task_struct; 57struct task_struct;
59struct pt_regs; 58struct pt_regs;
60 59
@@ -134,6 +133,14 @@ extern int fix_alignment(struct pt_regs *);
134extern void cvt_fd(float *from, double *to, struct thread_struct *thread); 133extern void cvt_fd(float *from, double *to, struct thread_struct *thread);
135extern void cvt_df(double *from, float *to, struct thread_struct *thread); 134extern void cvt_df(double *from, float *to, struct thread_struct *thread);
136 135
136#ifndef CONFIG_SMP
137extern void discard_lazy_cpu_state(void);
138#else
139static inline void discard_lazy_cpu_state(void)
140{
141}
142#endif
143
137#ifdef CONFIG_ALTIVEC 144#ifdef CONFIG_ALTIVEC
138extern void flush_altivec_to_thread(struct task_struct *); 145extern void flush_altivec_to_thread(struct task_struct *);
139#else 146#else
@@ -176,6 +183,16 @@ struct thread_struct;
176extern struct task_struct *_switch(struct thread_struct *prev, 183extern struct task_struct *_switch(struct thread_struct *prev,
177 struct thread_struct *next); 184 struct thread_struct *next);
178 185
186/*
187 * On SMP systems, when the scheduler does migration-cost autodetection,
188 * it needs a way to flush as much of the CPU's caches as possible.
189 *
190 * TODO: fill this in!
191 */
192static inline void sched_cacheflush(void)
193{
194}
195
179extern unsigned int rtas_data; 196extern unsigned int rtas_data;
180extern int mem_init_done; /* set on boot once kmalloc can be called */ 197extern int mem_init_done; /* set on boot once kmalloc can be called */
181extern unsigned long memory_limit; 198extern unsigned long memory_limit;
diff --git a/include/asm-powerpc/tce.h b/include/asm-powerpc/tce.h
index 980a094fd5a7..6fa200ad7a7f 100644
--- a/include/asm-powerpc/tce.h
+++ b/include/asm-powerpc/tce.h
@@ -20,6 +20,7 @@
20 20
21#ifndef _ASM_POWERPC_TCE_H 21#ifndef _ASM_POWERPC_TCE_H
22#define _ASM_POWERPC_TCE_H 22#define _ASM_POWERPC_TCE_H
23#ifdef __KERNEL__
23 24
24/* 25/*
25 * Tces come in two formats, one for the virtual bus and a different 26 * Tces come in two formats, one for the virtual bus and a different
@@ -61,4 +62,5 @@ union tce_entry {
61}; 62};
62 63
63 64
65#endif /* __KERNEL__ */
64#endif /* _ASM_POWERPC_TCE_H */ 66#endif /* _ASM_POWERPC_TCE_H */
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index e525f49bd179..7e09d7cda933 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -37,8 +37,7 @@ struct thread_info {
37 int preempt_count; /* 0 => preemptable, 37 int preempt_count; /* 0 => preemptable,
38 <0 => BUG */ 38 <0 => BUG */
39 struct restart_block restart_block; 39 struct restart_block restart_block;
40 /* set by force_successful_syscall_return */ 40 void *nvgprs_frame;
41 unsigned char syscall_noerror;
42 /* low level flags - has atomic operations done on it */ 41 /* low level flags - has atomic operations done on it */
43 unsigned long flags ____cacheline_aligned_in_smp; 42 unsigned long flags ____cacheline_aligned_in_smp;
44}; 43};
@@ -90,9 +89,6 @@ struct thread_info {
90 89
91#endif /* THREAD_SHIFT < PAGE_SHIFT */ 90#endif /* THREAD_SHIFT < PAGE_SHIFT */
92 91
93#define get_thread_info(ti) get_task_struct((ti)->task)
94#define put_thread_info(ti) put_task_struct((ti)->task)
95
96/* how to get the thread information struct from C */ 92/* how to get the thread information struct from C */
97static inline struct thread_info *current_thread_info(void) 93static inline struct thread_info *current_thread_info(void)
98{ 94{
@@ -123,6 +119,9 @@ static inline struct thread_info *current_thread_info(void)
123#define TIF_SINGLESTEP 9 /* singlestepping active */ 119#define TIF_SINGLESTEP 9 /* singlestepping active */
124#define TIF_MEMDIE 10 120#define TIF_MEMDIE 10
125#define TIF_SECCOMP 11 /* secure computing */ 121#define TIF_SECCOMP 11 /* secure computing */
122#define TIF_RESTOREALL 12 /* Restore all regs (implies NOERROR) */
123#define TIF_SAVE_NVGPRS 13 /* Save r14-r31 in signal frame */
124#define TIF_NOERROR 14 /* Force successful syscall return */
126 125
127/* as above, but as bit values */ 126/* as above, but as bit values */
128#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 127#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -136,10 +135,14 @@ static inline struct thread_info *current_thread_info(void)
136#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 135#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
137#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 136#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
138#define _TIF_SECCOMP (1<<TIF_SECCOMP) 137#define _TIF_SECCOMP (1<<TIF_SECCOMP)
138#define _TIF_RESTOREALL (1<<TIF_RESTOREALL)
139#define _TIF_SAVE_NVGPRS (1<<TIF_SAVE_NVGPRS)
140#define _TIF_NOERROR (1<<TIF_NOERROR)
139#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) 141#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
140 142
141#define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ 143#define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
142 _TIF_NEED_RESCHED) 144 _TIF_NEED_RESCHED | _TIF_RESTOREALL)
145#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR|_TIF_SAVE_NVGPRS)
143 146
144#endif /* __KERNEL__ */ 147#endif /* __KERNEL__ */
145 148
diff --git a/include/asm-powerpc/tlb.h b/include/asm-powerpc/tlb.h
index 56659f121779..601a53cf96d5 100644
--- a/include/asm-powerpc/tlb.h
+++ b/include/asm-powerpc/tlb.h
@@ -11,6 +11,7 @@
11 */ 11 */
12#ifndef _ASM_POWERPC_TLB_H 12#ifndef _ASM_POWERPC_TLB_H
13#define _ASM_POWERPC_TLB_H 13#define _ASM_POWERPC_TLB_H
14#ifdef __KERNEL__
14 15
15#include <linux/config.h> 16#include <linux/config.h>
16#ifndef __powerpc64__ 17#ifndef __powerpc64__
@@ -67,4 +68,5 @@ static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
67} 68}
68 69
69#endif 70#endif
71#endif /* __KERNEL__ */
70#endif /* __ASM_POWERPC_TLB_H */ 72#endif /* __ASM_POWERPC_TLB_H */
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index db8095cbe09b..1e19cd00af25 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -1,5 +1,6 @@
1#ifndef _ASM_POWERPC_TOPOLOGY_H 1#ifndef _ASM_POWERPC_TOPOLOGY_H
2#define _ASM_POWERPC_TOPOLOGY_H 2#define _ASM_POWERPC_TOPOLOGY_H
3#ifdef __KERNEL__
3 4
4#include <linux/config.h> 5#include <linux/config.h>
5 6
@@ -38,7 +39,6 @@ static inline int node_to_first_cpu(int node)
38 .max_interval = 32, \ 39 .max_interval = 32, \
39 .busy_factor = 32, \ 40 .busy_factor = 32, \
40 .imbalance_pct = 125, \ 41 .imbalance_pct = 125, \
41 .cache_hot_time = (10*1000000), \
42 .cache_nice_tries = 1, \ 42 .cache_nice_tries = 1, \
43 .per_cpu_gain = 100, \ 43 .per_cpu_gain = 100, \
44 .busy_idx = 3, \ 44 .busy_idx = 3, \
@@ -55,10 +55,15 @@ static inline int node_to_first_cpu(int node)
55 .nr_balance_failed = 0, \ 55 .nr_balance_failed = 0, \
56} 56}
57 57
58extern void __init dump_numa_cpu_topology(void);
59
58#else 60#else
59 61
62static inline void dump_numa_cpu_topology(void) {}
63
60#include <asm-generic/topology.h> 64#include <asm-generic/topology.h>
61 65
62#endif /* CONFIG_NUMA */ 66#endif /* CONFIG_NUMA */
63 67
68#endif /* __KERNEL__ */
64#endif /* _ASM_POWERPC_TOPOLOGY_H */ 69#endif /* _ASM_POWERPC_TOPOLOGY_H */
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h
index a383383bc4d4..5c4236c342bb 100644
--- a/include/asm-powerpc/udbg.h
+++ b/include/asm-powerpc/udbg.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * c 2001 PPC 64 Team, IBM Corp 2 * (c) 2001, 2006 IBM Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
@@ -9,12 +9,13 @@
9 9
10#ifndef _ASM_POWERPC_UDBG_H 10#ifndef _ASM_POWERPC_UDBG_H
11#define _ASM_POWERPC_UDBG_H 11#define _ASM_POWERPC_UDBG_H
12#ifdef __KERNEL__
12 13
13#include <linux/compiler.h> 14#include <linux/compiler.h>
14#include <linux/init.h> 15#include <linux/init.h>
15 16
16extern void (*udbg_putc)(unsigned char c); 17extern void (*udbg_putc)(char c);
17extern unsigned char (*udbg_getc)(void); 18extern int (*udbg_getc)(void);
18extern int (*udbg_getc_poll)(void); 19extern int (*udbg_getc_poll)(void);
19 20
20extern void udbg_puts(const char *s); 21extern void udbg_puts(const char *s);
@@ -23,9 +24,24 @@ extern int udbg_read(char *buf, int buflen);
23 24
24extern void register_early_udbg_console(void); 25extern void register_early_udbg_console(void);
25extern void udbg_printf(const char *fmt, ...); 26extern void udbg_printf(const char *fmt, ...);
27extern void udbg_progress(char *s, unsigned short hex);
26 28
27extern void udbg_init_uart(void __iomem *comport, unsigned int speed); 29extern void udbg_init_uart(void __iomem *comport, unsigned int speed,
30 unsigned int clock);
31extern unsigned int udbg_probe_uart_speed(void __iomem *comport,
32 unsigned int clock);
28 33
29struct device_node; 34struct device_node;
30extern void udbg_init_scc(struct device_node *np); 35extern void udbg_scc_init(int force_scc);
36extern int udbg_adb_init(int force_btext);
37extern void udbg_adb_init_early(void);
38
39extern void __init udbg_early_init(void);
40extern void __init udbg_init_debug_lpar(void);
41extern void __init udbg_init_pmac_realmode(void);
42extern void __init udbg_init_maple_realmode(void);
43extern void __init udbg_init_iseries(void);
44extern void __init udbg_init_rtas(void);
45
46#endif /* __KERNEL__ */
31#endif /* _ASM_POWERPC_UDBG_H */ 47#endif /* _ASM_POWERPC_UDBG_H */
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index 0991dfceef1d..19eaac3fbbf9 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -296,8 +296,10 @@
296#define __NR_inotify_init 275 296#define __NR_inotify_init 275
297#define __NR_inotify_add_watch 276 297#define __NR_inotify_add_watch 276
298#define __NR_inotify_rm_watch 277 298#define __NR_inotify_rm_watch 277
299#define __NR_spu_run 278
300#define __NR_spu_create 279
299 301
300#define __NR_syscalls 278 302#define __NR_syscalls 280
301 303
302#ifdef __KERNEL__ 304#ifdef __KERNEL__
303#define __NR__exit __NR_exit 305#define __NR__exit __NR_exit
diff --git a/include/asm-powerpc/vdso_datapage.h b/include/asm-powerpc/vdso_datapage.h
index 411832d5bbdb..7aa92086c3fb 100644
--- a/include/asm-powerpc/vdso_datapage.h
+++ b/include/asm-powerpc/vdso_datapage.h
@@ -1,5 +1,6 @@
1#ifndef _VDSO_DATAPAGE_H 1#ifndef _VDSO_DATAPAGE_H
2#define _VDSO_DATAPAGE_H 2#define _VDSO_DATAPAGE_H
3#ifdef __KERNEL__
3 4
4/* 5/*
5 * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM 6 * Copyright (C) 2002 Peter Bergner <bergner@vnet.ibm.com>, IBM
@@ -105,4 +106,5 @@ extern struct vdso_data *vdso_data;
105 106
106#endif /* __ASSEMBLY__ */ 107#endif /* __ASSEMBLY__ */
107 108
109#endif /* __KERNEL__ */
108#endif /* _SYSTEMCFG_H */ 110#endif /* _SYSTEMCFG_H */
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index e0ccf108277c..0544ece51761 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -13,6 +13,7 @@
13 13
14#ifndef _ASM_POWERPC_VIO_H 14#ifndef _ASM_POWERPC_VIO_H
15#define _ASM_POWERPC_VIO_H 15#define _ASM_POWERPC_VIO_H
16#ifdef __KERNEL__
16 17
17#include <linux/config.h> 18#include <linux/config.h>
18#include <linux/init.h> 19#include <linux/init.h>
@@ -103,4 +104,5 @@ static inline struct vio_dev *to_vio_dev(struct device *dev)
103 return container_of(dev, struct vio_dev, dev); 104 return container_of(dev, struct vio_dev, dev);
104} 105}
105 106
107#endif /* __KERNEL__ */
106#endif /* _ASM_POWERPC_VIO_H */ 108#endif /* _ASM_POWERPC_VIO_H */
diff --git a/include/asm-ppc/bseip.h b/include/asm-ppc/bseip.h
deleted file mode 100644
index 691f4a52b0a5..000000000000
--- a/include/asm-ppc/bseip.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the Bright Star Engineering ip-Engine board. Copied from the MBX stuff.
4 *
5 * Copyright (c) 1998 Dan Malek (dmalek@jlc.net)
6 */
7#ifndef __MACH_BSEIP_DEFS
8#define __MACH_BSEIP_DEFS
9
10#ifndef __ASSEMBLY__
11/* A Board Information structure that is given to a program when
12 * prom starts it up.
13 */
14typedef struct bd_info {
15 unsigned int bi_memstart; /* Memory start address */
16 unsigned int bi_memsize; /* Memory (end) size in bytes */
17 unsigned int bi_intfreq; /* Internal Freq, in Hz */
18 unsigned int bi_busfreq; /* Bus Freq, in Hz */
19 unsigned char bi_enetaddr[6];
20 unsigned int bi_baudrate;
21} bd_t;
22
23extern bd_t m8xx_board_info;
24
25/* Memory map is configured by the PROM startup.
26 * All we need to get started is the IMMR.
27 */
28#define IMAP_ADDR ((uint)0xff000000)
29#define IMAP_SIZE ((uint)(64 * 1024))
30#define PCMCIA_MEM_ADDR ((uint)0x04000000)
31#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
32#endif /* !__ASSEMBLY__ */
33
34/* We don't use the 8259.
35*/
36#define NR_8259_INTS 0
37
38#endif
diff --git a/include/asm-ppc/btext.h b/include/asm-ppc/btext.h
index ccaefabe0bf5..ed3630251b3b 100644
--- a/include/asm-ppc/btext.h
+++ b/include/asm-ppc/btext.h
@@ -17,7 +17,7 @@ extern unsigned long disp_BAT[2];
17extern boot_infos_t disp_bi; 17extern boot_infos_t disp_bi;
18extern int boot_text_mapped; 18extern int boot_text_mapped;
19 19
20extern void init_boot_display(void); 20extern void btext_init(boot_infos_t *bi);
21extern void btext_welcome(void); 21extern void btext_welcome(void);
22extern void btext_prepare_BAT(void); 22extern void btext_prepare_BAT(void);
23extern void btext_setup_display(int width, int height, int depth, int pitch, 23extern void btext_setup_display(int width, int height, int depth, int pitch,
diff --git a/include/asm-ppc/ibm_ocp.h b/include/asm-ppc/ibm_ocp.h
index 9c21de1ff4ed..ddce616f765a 100644
--- a/include/asm-ppc/ibm_ocp.h
+++ b/include/asm-ppc/ibm_ocp.h
@@ -63,7 +63,6 @@ struct ocp_func_emac_data {
63 int wol_irq; /* WOL interrupt */ 63 int wol_irq; /* WOL interrupt */
64 int mdio_idx; /* EMAC idx of MDIO master or -1 */ 64 int mdio_idx; /* EMAC idx of MDIO master or -1 */
65 int tah_idx; /* TAH device index or -1 */ 65 int tah_idx; /* TAH device index or -1 */
66 int jumbo; /* Jumbo frames capable flag */
67 int phy_mode; /* PHY type or configurable mode */ 66 int phy_mode; /* PHY type or configurable mode */
68 u8 mac_addr[6]; /* EMAC mac address */ 67 u8 mac_addr[6]; /* EMAC mac address */
69 u32 phy_map; /* EMAC phy map */ 68 u32 phy_map; /* EMAC phy map */
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 84ac6e258eef..df9cf6ed189d 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -27,6 +27,8 @@
27 27
28#if defined(CONFIG_4xx) 28#if defined(CONFIG_4xx)
29#include <asm/ibm4xx.h> 29#include <asm/ibm4xx.h>
30#elif defined(CONFIG_PPC_MPC52xx)
31#include <asm/mpc52xx.h>
30#elif defined(CONFIG_8xx) 32#elif defined(CONFIG_8xx)
31#include <asm/mpc8xx.h> 33#include <asm/mpc8xx.h>
32#elif defined(CONFIG_8260) 34#elif defined(CONFIG_8260)
diff --git a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h
index f01255bd1dc3..39200def8d11 100644
--- a/include/asm-ppc/machdep.h
+++ b/include/asm-ppc/machdep.h
@@ -35,8 +35,10 @@ struct machdep_calls {
35 int (*get_irq)(struct pt_regs *); 35 int (*get_irq)(struct pt_regs *);
36 36
37 /* A general init function, called by ppc_init in init/main.c. 37 /* A general init function, called by ppc_init in init/main.c.
38 May be NULL. */ 38 May be NULL. DEPRECATED ! */
39 void (*init)(void); 39 void (*init)(void);
40 /* For compatibility with merged platforms */
41 void (*init_early)(void);
40 42
41 void (*restart)(char *cmd); 43 void (*restart)(char *cmd);
42 void (*power_off)(void); 44 void (*power_off)(void);
diff --git a/include/asm-ppc/mpc52xx.h b/include/asm-ppc/mpc52xx.h
index e5f80c22fbfc..a055e0756b9d 100644
--- a/include/asm-ppc/mpc52xx.h
+++ b/include/asm-ppc/mpc52xx.h
@@ -29,6 +29,17 @@ struct pt_regs;
29#endif /* __ASSEMBLY__ */ 29#endif /* __ASSEMBLY__ */
30 30
31 31
32#ifdef CONFIG_PCI
33#define _IO_BASE isa_io_base
34#define _ISA_MEM_BASE isa_mem_base
35#define PCI_DRAM_OFFSET pci_dram_offset
36#else
37#define _IO_BASE 0
38#define _ISA_MEM_BASE 0
39#define PCI_DRAM_OFFSET 0
40#endif
41
42
32/* ======================================================================== */ 43/* ======================================================================== */
33/* PPC Sys devices definition */ 44/* PPC Sys devices definition */
34/* ======================================================================== */ 45/* ======================================================================== */
@@ -107,7 +118,7 @@ enum ppc_sys_devices {
107#define MPC52xx_SDMA_IRQ_NUM 17 118#define MPC52xx_SDMA_IRQ_NUM 17
108#define MPC52xx_PERP_IRQ_NUM 23 119#define MPC52xx_PERP_IRQ_NUM 23
109 120
110#define MPC52xx_CRIT_IRQ_BASE 0 121#define MPC52xx_CRIT_IRQ_BASE 1
111#define MPC52xx_MAIN_IRQ_BASE (MPC52xx_CRIT_IRQ_BASE + MPC52xx_CRIT_IRQ_NUM) 122#define MPC52xx_MAIN_IRQ_BASE (MPC52xx_CRIT_IRQ_BASE + MPC52xx_CRIT_IRQ_NUM)
112#define MPC52xx_SDMA_IRQ_BASE (MPC52xx_MAIN_IRQ_BASE + MPC52xx_MAIN_IRQ_NUM) 123#define MPC52xx_SDMA_IRQ_BASE (MPC52xx_MAIN_IRQ_BASE + MPC52xx_MAIN_IRQ_NUM)
113#define MPC52xx_PERP_IRQ_BASE (MPC52xx_SDMA_IRQ_BASE + MPC52xx_SDMA_IRQ_NUM) 124#define MPC52xx_PERP_IRQ_BASE (MPC52xx_SDMA_IRQ_BASE + MPC52xx_SDMA_IRQ_NUM)
diff --git a/include/asm-ppc/mpc85xx.h b/include/asm-ppc/mpc85xx.h
index 9d14baea3d71..c8a96aa44fb7 100644
--- a/include/asm-ppc/mpc85xx.h
+++ b/include/asm-ppc/mpc85xx.h
@@ -37,6 +37,10 @@
37#ifdef CONFIG_STX_GP3 37#ifdef CONFIG_STX_GP3
38#include <platforms/85xx/stx_gp3.h> 38#include <platforms/85xx/stx_gp3.h>
39#endif 39#endif
40#if defined(CONFIG_TQM8540) || defined(CONFIG_TQM8541) || \
41 defined(CONFIG_TQM8555) || defined(CONFIG_TQM8560)
42#include <platforms/85xx/tqm85xx.h>
43#endif
40 44
41#define _IO_BASE isa_io_base 45#define _IO_BASE isa_io_base
42#define _ISA_MEM_BASE isa_mem_base 46#define _ISA_MEM_BASE isa_mem_base
diff --git a/include/asm-ppc/pci-bridge.h b/include/asm-ppc/pci-bridge.h
index e58c78f90a5a..9d5230689b31 100644
--- a/include/asm-ppc/pci-bridge.h
+++ b/include/asm-ppc/pci-bridge.h
@@ -137,5 +137,14 @@ static inline unsigned char bridge_swizzle(unsigned char pin,
137 */ 137 */
138extern int pciauto_bus_scan(struct pci_controller *, int); 138extern int pciauto_bus_scan(struct pci_controller *, int);
139 139
140#ifdef CONFIG_PCI
141extern unsigned long pci_address_to_pio(phys_addr_t address);
142#else
143static inline unsigned long pci_address_to_pio(phys_addr_t address)
144{
145 return (unsigned long)-1;
146}
147#endif
148
140#endif 149#endif
141#endif /* __KERNEL__ */ 150#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h
index 3e39827ed566..eb317a0806e4 100644
--- a/include/asm-ppc/prom.h
+++ b/include/asm-ppc/prom.h
@@ -136,5 +136,37 @@ extern unsigned long sub_reloc_offset(unsigned long);
136#define PTRRELOC(x) ((typeof(x))add_reloc_offset((unsigned long)(x))) 136#define PTRRELOC(x) ((typeof(x))add_reloc_offset((unsigned long)(x)))
137#define PTRUNRELOC(x) ((typeof(x))sub_reloc_offset((unsigned long)(x))) 137#define PTRUNRELOC(x) ((typeof(x))sub_reloc_offset((unsigned long)(x)))
138 138
139
140/*
141 * OF address retreival & translation
142 */
143
144
145/* Translate an OF address block into a CPU physical address
146 */
147#define OF_BAD_ADDR ((u64)-1)
148extern u64 of_translate_address(struct device_node *np, u32 *addr);
149
150/* Extract an address from a device, returns the region size and
151 * the address space flags too. The PCI version uses a BAR number
152 * instead of an absolute index
153 */
154extern u32 *of_get_address(struct device_node *dev, int index,
155 u64 *size, unsigned int *flags);
156extern u32 *of_get_pci_address(struct device_node *dev, int bar_no,
157 u64 *size, unsigned int *flags);
158
159/* Get an address as a resource. Note that if your address is
160 * a PIO address, the conversion will fail if the physical address
161 * can't be internally converted to an IO token with
162 * pci_address_to_pio(), that is because it's either called to early
163 * or it can't be matched to any host bridge IO space
164 */
165extern int of_address_to_resource(struct device_node *dev, int index,
166 struct resource *r);
167extern int of_pci_address_to_resource(struct device_node *dev, int bar,
168 struct resource *r);
169
170
139#endif /* _PPC_PROM_H */ 171#endif /* _PPC_PROM_H */
140#endif /* __KERNEL__ */ 172#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h
index bd99cb53a19f..fb49c0c49ea1 100644
--- a/include/asm-ppc/system.h
+++ b/include/asm-ppc/system.h
@@ -4,7 +4,6 @@
4#ifndef __PPC_SYSTEM_H 4#ifndef __PPC_SYSTEM_H
5#define __PPC_SYSTEM_H 5#define __PPC_SYSTEM_H
6 6
7#include <linux/config.h>
8#include <linux/kernel.h> 7#include <linux/kernel.h>
9 8
10#include <asm/atomic.h> 9#include <asm/atomic.h>
@@ -39,7 +38,7 @@
39#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
40#define smp_mb() mb() 39#define smp_mb() mb()
41#define smp_rmb() rmb() 40#define smp_rmb() rmb()
42#define smp_wmb() wmb() 41#define smp_wmb() __asm__ __volatile__ ("eieio" : : : "memory")
43#define smp_read_barrier_depends() read_barrier_depends() 42#define smp_read_barrier_depends() read_barrier_depends()
44#else 43#else
45#define smp_mb() barrier() 44#define smp_mb() barrier()
@@ -74,6 +73,7 @@ extern void chrp_nvram_init(void);
74extern void read_rtc_time(void); 73extern void read_rtc_time(void);
75extern void pmac_find_display(void); 74extern void pmac_find_display(void);
76extern void giveup_fpu(struct task_struct *); 75extern void giveup_fpu(struct task_struct *);
76extern void disable_kernel_fp(void);
77extern void enable_kernel_fp(void); 77extern void enable_kernel_fp(void);
78extern void flush_fp_to_thread(struct task_struct *); 78extern void flush_fp_to_thread(struct task_struct *);
79extern void enable_kernel_altivec(void); 79extern void enable_kernel_altivec(void);
@@ -86,6 +86,14 @@ extern int fix_alignment(struct pt_regs *);
86extern void cvt_fd(float *from, double *to, struct thread_struct *thread); 86extern void cvt_fd(float *from, double *to, struct thread_struct *thread);
87extern void cvt_df(double *from, float *to, struct thread_struct *thread); 87extern void cvt_df(double *from, float *to, struct thread_struct *thread);
88 88
89#ifndef CONFIG_SMP
90extern void discard_lazy_cpu_state(void);
91#else
92static inline void discard_lazy_cpu_state(void)
93{
94}
95#endif
96
89#ifdef CONFIG_ALTIVEC 97#ifdef CONFIG_ALTIVEC
90extern void flush_altivec_to_thread(struct task_struct *); 98extern void flush_altivec_to_thread(struct task_struct *);
91#else 99#else
@@ -123,6 +131,16 @@ extern struct task_struct *__switch_to(struct task_struct *,
123 struct task_struct *); 131 struct task_struct *);
124#define switch_to(prev, next, last) ((last) = __switch_to((prev), (next))) 132#define switch_to(prev, next, last) ((last) = __switch_to((prev), (next)))
125 133
134/*
135 * On SMP systems, when the scheduler does migration-cost autodetection,
136 * it needs a way to flush as much of the CPU's caches as possible.
137 *
138 * TODO: fill this in!
139 */
140static inline void sched_cacheflush(void)
141{
142}
143
126struct thread_struct; 144struct thread_struct;
127extern struct task_struct *_switch(struct thread_struct *prev, 145extern struct task_struct *_switch(struct thread_struct *prev,
128 struct thread_struct *next); 146 struct thread_struct *next);
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
index b3bd4f679f72..be6fefe223d6 100644
--- a/include/asm-s390/atomic.h
+++ b/include/asm-s390/atomic.h
@@ -5,7 +5,7 @@
5 * include/asm-s390/atomic.h 5 * include/asm-s390/atomic.h
6 * 6 *
7 * S390 version 7 * S390 version
8 * Copyright (C) 1999-2003 IBM Deutschland Entwicklung GmbH, IBM Corporation 8 * Copyright (C) 1999-2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 9 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
10 * Denis Joseph Barrow, 10 * Denis Joseph Barrow,
11 * Arnd Bergmann (arndb@de.ibm.com) 11 * Arnd Bergmann (arndb@de.ibm.com)
@@ -45,59 +45,59 @@ typedef struct {
45#define atomic_read(v) ((v)->counter) 45#define atomic_read(v) ((v)->counter)
46#define atomic_set(v,i) (((v)->counter) = (i)) 46#define atomic_set(v,i) (((v)->counter) = (i))
47 47
48static __inline__ void atomic_add(int i, atomic_t * v)
49{
50 __CS_LOOP(v, i, "ar");
51}
52static __inline__ int atomic_add_return(int i, atomic_t * v) 48static __inline__ int atomic_add_return(int i, atomic_t * v)
53{ 49{
54 return __CS_LOOP(v, i, "ar"); 50 return __CS_LOOP(v, i, "ar");
55} 51}
56static __inline__ int atomic_add_negative(int i, atomic_t * v) 52#define atomic_add(_i, _v) atomic_add_return(_i, _v)
57{ 53#define atomic_add_negative(_i, _v) (atomic_add_return(_i, _v) < 0)
58 return __CS_LOOP(v, i, "ar") < 0; 54#define atomic_inc(_v) atomic_add_return(1, _v)
59} 55#define atomic_inc_return(_v) atomic_add_return(1, _v)
60static __inline__ void atomic_sub(int i, atomic_t * v) 56#define atomic_inc_and_test(_v) (atomic_add_return(1, _v) == 0)
61{ 57
62 __CS_LOOP(v, i, "sr");
63}
64static __inline__ int atomic_sub_return(int i, atomic_t * v) 58static __inline__ int atomic_sub_return(int i, atomic_t * v)
65{ 59{
66 return __CS_LOOP(v, i, "sr"); 60 return __CS_LOOP(v, i, "sr");
67} 61}
68static __inline__ void atomic_inc(volatile atomic_t * v) 62#define atomic_sub(_i, _v) atomic_sub_return(_i, _v)
69{ 63#define atomic_sub_and_test(_i, _v) (atomic_sub_return(_i, _v) == 0)
70 __CS_LOOP(v, 1, "ar"); 64#define atomic_dec(_v) atomic_sub_return(1, _v)
71} 65#define atomic_dec_return(_v) atomic_sub_return(1, _v)
72static __inline__ int atomic_inc_return(volatile atomic_t * v) 66#define atomic_dec_and_test(_v) (atomic_sub_return(1, _v) == 0)
73{
74 return __CS_LOOP(v, 1, "ar");
75}
76 67
77static __inline__ int atomic_inc_and_test(volatile atomic_t * v)
78{
79 return __CS_LOOP(v, 1, "ar") == 0;
80}
81static __inline__ void atomic_dec(volatile atomic_t * v)
82{
83 __CS_LOOP(v, 1, "sr");
84}
85static __inline__ int atomic_dec_return(volatile atomic_t * v)
86{
87 return __CS_LOOP(v, 1, "sr");
88}
89static __inline__ int atomic_dec_and_test(volatile atomic_t * v)
90{
91 return __CS_LOOP(v, 1, "sr") == 0;
92}
93static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t * v) 68static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t * v)
94{ 69{
95 __CS_LOOP(v, ~mask, "nr"); 70 __CS_LOOP(v, ~mask, "nr");
96} 71}
72
97static __inline__ void atomic_set_mask(unsigned long mask, atomic_t * v) 73static __inline__ void atomic_set_mask(unsigned long mask, atomic_t * v)
98{ 74{
99 __CS_LOOP(v, mask, "or"); 75 __CS_LOOP(v, mask, "or");
100} 76}
77
78#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
79
80static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new)
81{
82 __asm__ __volatile__(" cs %0,%3,0(%2)\n"
83 : "+d" (old), "=m" (v->counter)
84 : "a" (v), "d" (new), "m" (v->counter)
85 : "cc", "memory" );
86 return old;
87}
88
89static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
90{
91 int c, old;
92
93 c = atomic_read(v);
94 while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c)
95 c = old;
96 return c != u;
97}
98
99#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
100
101#undef __CS_LOOP 101#undef __CS_LOOP
102 102
103#ifdef __s390x__ 103#ifdef __s390x__
@@ -123,97 +123,67 @@ typedef struct {
123#define atomic64_read(v) ((v)->counter) 123#define atomic64_read(v) ((v)->counter)
124#define atomic64_set(v,i) (((v)->counter) = (i)) 124#define atomic64_set(v,i) (((v)->counter) = (i))
125 125
126static __inline__ void atomic64_add(long long i, atomic64_t * v)
127{
128 __CSG_LOOP(v, i, "agr");
129}
130static __inline__ long long atomic64_add_return(long long i, atomic64_t * v) 126static __inline__ long long atomic64_add_return(long long i, atomic64_t * v)
131{ 127{
132 return __CSG_LOOP(v, i, "agr"); 128 return __CSG_LOOP(v, i, "agr");
133} 129}
134static __inline__ long long atomic64_add_negative(long long i, atomic64_t * v) 130#define atomic64_add(_i, _v) atomic64_add_return(_i, _v)
135{ 131#define atomic64_add_negative(_i, _v) (atomic64_add_return(_i, _v) < 0)
136 return __CSG_LOOP(v, i, "agr") < 0; 132#define atomic64_inc(_v) atomic64_add_return(1, _v)
137} 133#define atomic64_inc_return(_v) atomic64_add_return(1, _v)
138static __inline__ void atomic64_sub(long long i, atomic64_t * v) 134#define atomic64_inc_and_test(_v) (atomic64_add_return(1, _v) == 0)
139{ 135
140 __CSG_LOOP(v, i, "sgr"); 136static __inline__ long long atomic64_sub_return(long long i, atomic64_t * v)
141}
142static __inline__ void atomic64_inc(volatile atomic64_t * v)
143{
144 __CSG_LOOP(v, 1, "agr");
145}
146static __inline__ long long atomic64_inc_return(volatile atomic64_t * v)
147{
148 return __CSG_LOOP(v, 1, "agr");
149}
150static __inline__ long long atomic64_inc_and_test(volatile atomic64_t * v)
151{
152 return __CSG_LOOP(v, 1, "agr") == 0;
153}
154static __inline__ void atomic64_dec(volatile atomic64_t * v)
155{
156 __CSG_LOOP(v, 1, "sgr");
157}
158static __inline__ long long atomic64_dec_return(volatile atomic64_t * v)
159{
160 return __CSG_LOOP(v, 1, "sgr");
161}
162static __inline__ long long atomic64_dec_and_test(volatile atomic64_t * v)
163{ 137{
164 return __CSG_LOOP(v, 1, "sgr") == 0; 138 return __CSG_LOOP(v, i, "sgr");
165} 139}
140#define atomic64_sub(_i, _v) atomic64_sub_return(_i, _v)
141#define atomic64_sub_and_test(_i, _v) (atomic64_sub_return(_i, _v) == 0)
142#define atomic64_dec(_v) atomic64_sub_return(1, _v)
143#define atomic64_dec_return(_v) atomic64_sub_return(1, _v)
144#define atomic64_dec_and_test(_v) (atomic64_sub_return(1, _v) == 0)
145
166static __inline__ void atomic64_clear_mask(unsigned long mask, atomic64_t * v) 146static __inline__ void atomic64_clear_mask(unsigned long mask, atomic64_t * v)
167{ 147{
168 __CSG_LOOP(v, ~mask, "ngr"); 148 __CSG_LOOP(v, ~mask, "ngr");
169} 149}
150
170static __inline__ void atomic64_set_mask(unsigned long mask, atomic64_t * v) 151static __inline__ void atomic64_set_mask(unsigned long mask, atomic64_t * v)
171{ 152{
172 __CSG_LOOP(v, mask, "ogr"); 153 __CSG_LOOP(v, mask, "ogr");
173} 154}
174 155
175#undef __CSG_LOOP 156static __inline__ long long atomic64_cmpxchg(atomic64_t *v,
176#endif 157 long long old, long long new)
177 158{
178/* 159 __asm__ __volatile__(" csg %0,%3,0(%2)\n"
179 returns 0 if expected_oldval==value in *v ( swap was successful ) 160 : "+d" (old), "=m" (v->counter)
180 returns 1 if unsuccessful. 161 : "a" (v), "d" (new), "m" (v->counter)
162 : "cc", "memory" );
163 return old;
164}
181 165
182 This is non-portable, use bitops or spinlocks instead! 166static __inline__ int atomic64_add_unless(atomic64_t *v,
183*/ 167 long long a, long long u)
184static __inline__ int
185atomic_compare_and_swap(int expected_oldval,int new_val,atomic_t *v)
186{ 168{
187 int retval; 169 long long c, old;
188 170
189 __asm__ __volatile__( 171 c = atomic64_read(v);
190 " lr %0,%3\n" 172 while (c != u && (old = atomic64_cmpxchg(v, c, c + a)) != c)
191 " cs %0,%4,0(%2)\n" 173 c = old;
192 " ipm %0\n" 174 return c != u;
193 " srl %0,28\n"
194 "0:"
195 : "=&d" (retval), "=m" (v->counter)
196 : "a" (v), "d" (expected_oldval) , "d" (new_val),
197 "m" (v->counter) : "cc", "memory" );
198 return retval;
199} 175}
200 176
201#define atomic_cmpxchg(v, o, n) (atomic_compare_and_swap((o), (n), &((v)->counter))) 177#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
202 178
203#define atomic_add_unless(v, a, u) \ 179#undef __CSG_LOOP
204({ \ 180#endif
205 int c, old; \
206 c = atomic_read(v); \
207 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
208 c = old; \
209 c != (u); \
210})
211#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
212 181
213#define smp_mb__before_atomic_dec() smp_mb() 182#define smp_mb__before_atomic_dec() smp_mb()
214#define smp_mb__after_atomic_dec() smp_mb() 183#define smp_mb__after_atomic_dec() smp_mb()
215#define smp_mb__before_atomic_inc() smp_mb() 184#define smp_mb__before_atomic_inc() smp_mb()
216#define smp_mb__after_atomic_inc() smp_mb() 185#define smp_mb__after_atomic_inc() smp_mb()
217 186
187#include <asm-generic/atomic.h>
218#endif /* __KERNEL__ */ 188#endif /* __KERNEL__ */
219#endif /* __ARCH_S390_ATOMIC__ */ 189#endif /* __ARCH_S390_ATOMIC__ */
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index b07c578b22ea..61232760cc3b 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -839,6 +839,7 @@ static inline int sched_find_first_bit(unsigned long *b)
839 * fls: find last bit set. 839 * fls: find last bit set.
840 */ 840 */
841#define fls(x) generic_fls(x) 841#define fls(x) generic_fls(x)
842#define fls64(x) generic_fls64(x)
842 843
843/* 844/*
844 * hweightN: returns the hamming weight (i.e. the number 845 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-s390/cache.h b/include/asm-s390/cache.h
index 29845378b206..e20cdd9074db 100644
--- a/include/asm-s390/cache.h
+++ b/include/asm-s390/cache.h
@@ -13,7 +13,6 @@
13 13
14#define L1_CACHE_BYTES 256 14#define L1_CACHE_BYTES 256
15#define L1_CACHE_SHIFT 8 15#define L1_CACHE_SHIFT 8
16#define L1_CACHE_SHIFT_MAX 8 /* largest L1 which this arch supports */
17 16
18#define ARCH_KMALLOC_MINALIGN 8 17#define ARCH_KMALLOC_MINALIGN 8
19 18
diff --git a/include/asm-s390/ccwdev.h b/include/asm-s390/ccwdev.h
index 3eb231af5d51..12456cb2f882 100644
--- a/include/asm-s390/ccwdev.h
+++ b/include/asm-s390/ccwdev.h
@@ -185,8 +185,5 @@ extern struct ccw_device *ccw_device_probe_console(void);
185extern int _ccw_device_get_device_number(struct ccw_device *); 185extern int _ccw_device_get_device_number(struct ccw_device *);
186extern int _ccw_device_get_subchannel_number(struct ccw_device *); 186extern int _ccw_device_get_subchannel_number(struct ccw_device *);
187 187
188extern struct device *s390_root_dev_register(const char *);
189extern void s390_root_dev_unregister(struct device *);
190
191extern void *ccw_device_get_chp_desc(struct ccw_device *, int); 188extern void *ccw_device_get_chp_desc(struct ccw_device *, int);
192#endif /* _S390_CCWDEV_H_ */ 189#endif /* _S390_CCWDEV_H_ */
diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h
index 372d51cccd53..710646e64f7d 100644
--- a/include/asm-s390/elf.h
+++ b/include/asm-s390/elf.h
@@ -163,7 +163,7 @@ static inline int dump_regs(struct pt_regs *ptregs, elf_gregset_t *regs)
163 163
164static inline int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) 164static inline int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
165{ 165{
166 struct pt_regs *ptregs = __KSTK_PTREGS(tsk); 166 struct pt_regs *ptregs = task_pt_regs(tsk);
167 memcpy(&regs->psw, &ptregs->psw, sizeof(regs->psw)+sizeof(regs->gprs)); 167 memcpy(&regs->psw, &ptregs->psw, sizeof(regs->psw)+sizeof(regs->gprs));
168 memcpy(regs->acrs, tsk->thread.acrs, sizeof(regs->acrs)); 168 memcpy(regs->acrs, tsk->thread.acrs, sizeof(regs->acrs));
169 regs->orig_gpr2 = ptregs->orig_gpr2; 169 regs->orig_gpr2 = ptregs->orig_gpr2;
diff --git a/include/asm-s390/futex.h b/include/asm-s390/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-s390/futex.h
+++ b/include/asm-s390/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-s390/ioctl.h b/include/asm-s390/ioctl.h
index df7394345ac4..b279fe06dfe5 100644
--- a/include/asm-s390/ioctl.h
+++ b/include/asm-s390/ioctl.h
@@ -1,88 +1 @@
1/* #include <asm-generic/ioctl.h>
2 * include/asm-s390/ioctl.h
3 *
4 * S390 version
5 *
6 * Derived from "include/asm-i386/ioctl.h"
7 */
8
9#ifndef _S390_IOCTL_H
10#define _S390_IOCTL_H
11
12/* ioctl command encoding: 32 bits total, command in lower 16 bits,
13 * size of the parameter structure in the lower 14 bits of the
14 * upper 16 bits.
15 * Encoding the size of the parameter structure in the ioctl request
16 * is useful for catching programs compiled with old versions
17 * and to avoid overwriting user space outside the user buffer area.
18 * The highest 2 bits are reserved for indicating the ``access mode''.
19 * NOTE: This limits the max parameter size to 16kB -1 !
20 */
21
22/*
23 * The following is for compatibility across the various Linux
24 * platforms. The i386 ioctl numbering scheme doesn't really enforce
25 * a type field. De facto, however, the top 8 bits of the lower 16
26 * bits are indeed used as a type field, so we might just as well make
27 * this explicit here. Please be sure to use the decoding macros
28 * below from now on.
29 */
30#define _IOC_NRBITS 8
31#define _IOC_TYPEBITS 8
32#define _IOC_SIZEBITS 14
33#define _IOC_DIRBITS 2
34
35#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
36#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
37#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
38#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
39
40#define _IOC_NRSHIFT 0
41#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
42#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
43#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
44
45/*
46 * Direction bits.
47 */
48#define _IOC_NONE 0U
49#define _IOC_WRITE 1U
50#define _IOC_READ 2U
51
52#define _IOC(dir,type,nr,size) \
53 (((dir) << _IOC_DIRSHIFT) | \
54 ((type) << _IOC_TYPESHIFT) | \
55 ((nr) << _IOC_NRSHIFT) | \
56 ((size) << _IOC_SIZESHIFT))
57
58/* provoke compile error for invalid uses of size argument */
59extern unsigned long __invalid_size_argument_for_IOC;
60#define _IOC_TYPECHECK(t) \
61 ((sizeof(t) == sizeof(t[1]) && \
62 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
63 sizeof(t) : __invalid_size_argument_for_IOC)
64
65/* used to create numbers */
66#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
67#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
68#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
69#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
70#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
71#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
72#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
73
74/* used to decode ioctl numbers.. */
75#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
76#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
77#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
78#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
79
80/* ...and for the drivers/sound files... */
81
82#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
83#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
84#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
85#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
86#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
87
88#endif /* _S390_IOCTL_H */
diff --git a/include/asm-s390/kexec.h b/include/asm-s390/kexec.h
index 54cf7d9f251c..ce28ddda0f50 100644
--- a/include/asm-s390/kexec.h
+++ b/include/asm-s390/kexec.h
@@ -35,8 +35,9 @@
35#define KEXEC_ARCH KEXEC_ARCH_S390 35#define KEXEC_ARCH KEXEC_ARCH_S390
36 36
37#define MAX_NOTE_BYTES 1024 37#define MAX_NOTE_BYTES 1024
38typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
39 38
40extern note_buf_t crash_notes[]; 39/* Provide a dummy definition to avoid build failures. */
40static inline void crash_setup_regs(struct pt_regs *newregs,
41 struct pt_regs *oldregs) { }
41 42
42#endif /*_S390_KEXEC_H */ 43#endif /*_S390_KEXEC_H */
diff --git a/include/asm-s390/mman.h b/include/asm-s390/mman.h
index ea86bd12204f..c8d5409b5d56 100644
--- a/include/asm-s390/mman.h
+++ b/include/asm-s390/mman.h
@@ -43,6 +43,7 @@
43#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 43#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
44#define MADV_WILLNEED 0x3 /* pre-fault pages */ 44#define MADV_WILLNEED 0x3 /* pre-fault pages */
45#define MADV_DONTNEED 0x4 /* discard these pages */ 45#define MADV_DONTNEED 0x4 /* discard these pages */
46#define MADV_REMOVE 0x5 /* remove these pages & resources */
46 47
47/* compatibility flags */ 48/* compatibility flags */
48#define MAP_ANON MAP_ANONYMOUS 49#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-s390/mutex.h b/include/asm-s390/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-s390/mutex.h
@@ -0,0 +1,9 @@
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-s390/processor.h b/include/asm-s390/processor.h
index 4ec652ebb3b1..c5cbc4bd8414 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -191,10 +191,10 @@ extern void show_registers(struct pt_regs *regs);
191extern void show_trace(struct task_struct *task, unsigned long *sp); 191extern void show_trace(struct task_struct *task, unsigned long *sp);
192 192
193unsigned long get_wchan(struct task_struct *p); 193unsigned long get_wchan(struct task_struct *p);
194#define __KSTK_PTREGS(tsk) ((struct pt_regs *) \ 194#define task_pt_regs(tsk) ((struct pt_regs *) \
195 ((unsigned long) tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs))) 195 (task_stack_page(tsk) + THREAD_SIZE) - 1)
196#define KSTK_EIP(tsk) (__KSTK_PTREGS(tsk)->psw.addr) 196#define KSTK_EIP(tsk) (task_pt_regs(tsk)->psw.addr)
197#define KSTK_ESP(tsk) (__KSTK_PTREGS(tsk)->gprs[15]) 197#define KSTK_ESP(tsk) (task_pt_regs(tsk)->gprs[15])
198 198
199/* 199/*
200 * Give up the time slice of the virtual PU. 200 * Give up the time slice of the virtual PU.
diff --git a/include/asm-s390/qdio.h b/include/asm-s390/qdio.h
index 0ddf0a8ef8de..7bc15f0231db 100644
--- a/include/asm-s390/qdio.h
+++ b/include/asm-s390/qdio.h
@@ -195,12 +195,14 @@ struct qdr {
195/* 195/*
196 * queue information block (QIB) 196 * queue information block (QIB)
197 */ 197 */
198#define QIB_AC_INBOUND_PCI_SUPPORTED 0x80 198#define QIB_AC_INBOUND_PCI_SUPPORTED 0x80
199#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40 199#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
200#define QIB_RFLAGS_ENABLE_QEBSM 0x80
201
200struct qib { 202struct qib {
201 unsigned int qfmt : 8; /* queue format */ 203 unsigned int qfmt : 8; /* queue format */
202 unsigned int pfmt : 8; /* impl. dep. parameter format */ 204 unsigned int pfmt : 8; /* impl. dep. parameter format */
203 unsigned int res1 : 8; /* reserved */ 205 unsigned int rflags : 8; /* QEBSM */
204 unsigned int ac : 8; /* adapter characteristics */ 206 unsigned int ac : 8; /* adapter characteristics */
205 unsigned int res2; /* reserved */ 207 unsigned int res2; /* reserved */
206#ifdef QDIO_32_BIT 208#ifdef QDIO_32_BIT
diff --git a/include/asm-s390/s390_rdev.h b/include/asm-s390/s390_rdev.h
new file mode 100644
index 000000000000..3ad78f2b9c48
--- /dev/null
+++ b/include/asm-s390/s390_rdev.h
@@ -0,0 +1,15 @@
1/*
2 * include/asm-s390/ccwdev.h
3 *
4 * Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
5 * Author(s): Cornelia Huck <cohuck@de.ibm.com>
6 * Carsten Otte <cotte@de.ibm.com>
7 *
8 * Interface for s390 root device
9 */
10
11#ifndef _S390_RDEV_H_
12#define _S390_RDEV_H_
13extern struct device *s390_root_dev_register(const char *);
14extern void s390_root_dev_unregister(struct device *);
15#endif /* _S390_RDEV_H_ */
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index 864cae7e1fd6..c7c3a9ad593f 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -104,6 +104,16 @@ static inline void restore_access_regs(unsigned int *acrs)
104 prev = __switch_to(prev,next); \ 104 prev = __switch_to(prev,next); \
105} while (0) 105} while (0)
106 106
107/*
108 * On SMP systems, when the scheduler does migration-cost autodetection,
109 * it needs a way to flush as much of the CPU's caches as possible.
110 *
111 * TODO: fill this in!
112 */
113static inline void sched_cacheflush(void)
114{
115}
116
107#ifdef CONFIG_VIRT_CPU_ACCOUNTING 117#ifdef CONFIG_VIRT_CPU_ACCOUNTING
108extern void account_user_vtime(struct task_struct *); 118extern void account_user_vtime(struct task_struct *);
109extern void account_system_vtime(struct task_struct *); 119extern void account_system_vtime(struct task_struct *);
diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h
index 6c18a3f24316..f3797a52c4ea 100644
--- a/include/asm-s390/thread_info.h
+++ b/include/asm-s390/thread_info.h
@@ -81,8 +81,6 @@ static inline struct thread_info *current_thread_info(void)
81#define alloc_thread_info(tsk) ((struct thread_info *) \ 81#define alloc_thread_info(tsk) ((struct thread_info *) \
82 __get_free_pages(GFP_KERNEL,THREAD_ORDER)) 82 __get_free_pages(GFP_KERNEL,THREAD_ORDER))
83#define free_thread_info(ti) free_pages((unsigned long) (ti),THREAD_ORDER) 83#define free_thread_info(ti) free_pages((unsigned long) (ti),THREAD_ORDER)
84#define get_thread_info(ti) get_task_struct((ti)->task)
85#define put_thread_info(ti) put_task_struct((ti)->task)
86 84
87#endif 85#endif
88 86
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index 10a619da4761..be104f21c70a 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -61,8 +61,10 @@
61#define segment_eq(a,b) ((a).ar4 == (b).ar4) 61#define segment_eq(a,b) ((a).ar4 == (b).ar4)
62 62
63 63
64#define __access_ok(addr,size) (1) 64static inline int __access_ok(const void *addr, unsigned long size)
65 65{
66 return 1;
67}
66#define access_ok(type,addr,size) __access_ok(addr,size) 68#define access_ok(type,addr,size) __access_ok(addr,size)
67 69
68/* 70/*
@@ -206,25 +208,25 @@ extern int __put_user_bad(void) __attribute__((noreturn));
206 case 1: { \ 208 case 1: { \
207 unsigned char __x; \ 209 unsigned char __x; \
208 __get_user_asm(__x, ptr, __gu_err); \ 210 __get_user_asm(__x, ptr, __gu_err); \
209 (x) = (__typeof__(*(ptr))) __x; \ 211 (x) = *(__typeof__(*(ptr)) *) &__x; \
210 break; \ 212 break; \
211 }; \ 213 }; \
212 case 2: { \ 214 case 2: { \
213 unsigned short __x; \ 215 unsigned short __x; \
214 __get_user_asm(__x, ptr, __gu_err); \ 216 __get_user_asm(__x, ptr, __gu_err); \
215 (x) = (__typeof__(*(ptr))) __x; \ 217 (x) = *(__typeof__(*(ptr)) *) &__x; \
216 break; \ 218 break; \
217 }; \ 219 }; \
218 case 4: { \ 220 case 4: { \
219 unsigned int __x; \ 221 unsigned int __x; \
220 __get_user_asm(__x, ptr, __gu_err); \ 222 __get_user_asm(__x, ptr, __gu_err); \
221 (x) = (__typeof__(*(ptr))) __x; \ 223 (x) = *(__typeof__(*(ptr)) *) &__x; \
222 break; \ 224 break; \
223 }; \ 225 }; \
224 case 8: { \ 226 case 8: { \
225 unsigned long long __x; \ 227 unsigned long long __x; \
226 __get_user_asm(__x, ptr, __gu_err); \ 228 __get_user_asm(__x, ptr, __gu_err); \
227 (x) = (__typeof__(*(ptr))) __x; \ 229 (x) = *(__typeof__(*(ptr)) *) &__x; \
228 break; \ 230 break; \
229 }; \ 231 }; \
230 default: \ 232 default: \
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index f97d92691f17..2861cdc243ad 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -539,7 +539,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
539#define __ARCH_WANT_SYS_SIGPENDING 539#define __ARCH_WANT_SYS_SIGPENDING
540#define __ARCH_WANT_SYS_SIGPROCMASK 540#define __ARCH_WANT_SYS_SIGPROCMASK
541#define __ARCH_WANT_SYS_RT_SIGACTION 541#define __ARCH_WANT_SYS_RT_SIGACTION
542# ifdef CONFIG_ARCH_S390_31 542# ifndef CONFIG_64BIT
543# define __ARCH_WANT_STAT64 543# define __ARCH_WANT_STAT64
544# define __ARCH_WANT_SYS_TIME 544# define __ARCH_WANT_SYS_TIME
545# endif 545# endif
diff --git a/include/asm-s390/vtoc.h b/include/asm-s390/vtoc.h
index 41d369f38b0e..d1de5b7ebb0b 100644
--- a/include/asm-s390/vtoc.h
+++ b/include/asm-s390/vtoc.h
@@ -176,4 +176,28 @@ struct vtoc_format7_label
176 struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */ 176 struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */
177} __attribute__ ((packed)); 177} __attribute__ ((packed));
178 178
179struct vtoc_cms_label {
180 u8 label_id[4]; /* Label identifier */
181 u8 vol_id[6]; /* Volid */
182 u16 version_id; /* Version identifier */
183 u32 block_size; /* Disk block size */
184 u32 origin_ptr; /* Disk origin pointer */
185 u32 usable_count; /* Number of usable cylinders/blocks */
186 u32 formatted_count; /* Maximum number of formatted cylinders/
187 * blocks */
188 u32 block_count; /* Disk size in CMS blocks */
189 u32 used_count; /* Number of CMS blocks in use */
190 u32 fst_size; /* File Status Table (FST) size */
191 u32 fst_count; /* Number of FSTs per CMS block */
192 u8 format_date[6]; /* Disk FORMAT date */
193 u8 reserved1[2];
194 u32 disk_offset; /* Disk offset when reserved*/
195 u32 map_block; /* Allocation Map Block with next hole */
196 u32 hblk_disp; /* Displacement into HBLK data of next hole */
197 u32 user_disp; /* Displacement into user part of Allocation
198 * map */
199 u8 reserved2[4];
200 u8 segment_name[8]; /* Name of shared segment */
201} __attribute__ ((packed));
202
179#endif /* _ASM_S390_VTOC_H */ 203#endif /* _ASM_S390_VTOC_H */
diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h
index aabfd334462c..fb627de217f2 100644
--- a/include/asm-sh/atomic.h
+++ b/include/asm-sh/atomic.h
@@ -101,6 +101,8 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
101 return ret; 101 return ret;
102} 102}
103 103
104#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
105
104static inline int atomic_add_unless(atomic_t *v, int a, int u) 106static inline int atomic_add_unless(atomic_t *v, int a, int u)
105{ 107{
106 int ret; 108 int ret;
@@ -140,4 +142,5 @@ static __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v)
140#define smp_mb__before_atomic_inc() barrier() 142#define smp_mb__before_atomic_inc() barrier()
141#define smp_mb__after_atomic_inc() barrier() 143#define smp_mb__after_atomic_inc() barrier()
142 144
145#include <asm-generic/atomic.h>
143#endif /* __ASM_SH_ATOMIC_H */ 146#endif /* __ASM_SH_ATOMIC_H */
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
index 5163d1ff2f1b..1c5260860045 100644
--- a/include/asm-sh/bitops.h
+++ b/include/asm-sh/bitops.h
@@ -470,6 +470,7 @@ found_middle:
470 */ 470 */
471 471
472#define fls(x) generic_fls(x) 472#define fls(x) generic_fls(x)
473#define fls64(x) generic_fls64(x)
473 474
474#endif /* __KERNEL__ */ 475#endif /* __KERNEL__ */
475 476
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h
index 9b4dd6d8212e..656fdfe9e8b4 100644
--- a/include/asm-sh/cache.h
+++ b/include/asm-sh/cache.h
@@ -22,8 +22,6 @@
22 22
23#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) 23#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
24 24
25#define L1_CACHE_SHIFT_MAX 5 /* largest L1 which this arch supports */
26
27struct cache_info { 25struct cache_info {
28 unsigned int ways; 26 unsigned int ways;
29 unsigned int sets; 27 unsigned int sets;
diff --git a/include/asm-sh/futex.h b/include/asm-sh/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-sh/futex.h
+++ b/include/asm-sh/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-sh/ioctl.h b/include/asm-sh/ioctl.h
index 524700e84acd..b279fe06dfe5 100644
--- a/include/asm-sh/ioctl.h
+++ b/include/asm-sh/ioctl.h
@@ -1,75 +1 @@
1/* $Id: ioctl.h,v 1.1.1.1 2001/10/15 20:45:09 mrbrown Exp $ #include <asm-generic/ioctl.h>
2 *
3 * linux/ioctl.h for Linux by H.H. Bergman.
4 */
5
6#ifndef __ASM_SH_IOCTL_H
7#define __ASM_SH_IOCTL_H
8
9/* ioctl command encoding: 32 bits total, command in lower 16 bits,
10 * size of the parameter structure in the lower 14 bits of the
11 * upper 16 bits.
12 * Encoding the size of the parameter structure in the ioctl request
13 * is useful for catching programs compiled with old versions
14 * and to avoid overwriting user space outside the user buffer area.
15 * The highest 2 bits are reserved for indicating the ``access mode''.
16 * NOTE: This limits the max parameter size to 16kB -1 !
17 */
18
19/*
20 * The following is for compatibility across the various Linux
21 * platforms. The i386 ioctl numbering scheme doesn't really enforce
22 * a type field. De facto, however, the top 8 bits of the lower 16
23 * bits are indeed used as a type field, so we might just as well make
24 * this explicit here. Please be sure to use the decoding macros
25 * below from now on.
26 */
27#define _IOC_NRBITS 8
28#define _IOC_TYPEBITS 8
29#define _IOC_SIZEBITS 14
30#define _IOC_DIRBITS 2
31
32#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
33#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
34#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
35#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
36
37#define _IOC_NRSHIFT 0
38#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
39#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
40#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
41
42/*
43 * Direction bits.
44 */
45#define _IOC_NONE 0U
46#define _IOC_WRITE 1U
47#define _IOC_READ 2U
48
49#define _IOC(dir,type,nr,size) \
50 (((dir) << _IOC_DIRSHIFT) | \
51 ((type) << _IOC_TYPESHIFT) | \
52 ((nr) << _IOC_NRSHIFT) | \
53 ((size) << _IOC_SIZESHIFT))
54
55/* used to create numbers */
56#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
57#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
58#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
59#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
60
61/* used to decode ioctl numbers.. */
62#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
63#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
64#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
65#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
66
67/* ...and for the drivers/sound files... */
68
69#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
70#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
71#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
72#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
73#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
74
75#endif /* __ASM_SH_IOCTL_H */
diff --git a/include/asm-sh/mman.h b/include/asm-sh/mman.h
index 3ebab5f79db7..693bd55a3710 100644
--- a/include/asm-sh/mman.h
+++ b/include/asm-sh/mman.h
@@ -35,6 +35,7 @@
35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 35#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
36#define MADV_WILLNEED 0x3 /* pre-fault pages */ 36#define MADV_WILLNEED 0x3 /* pre-fault pages */
37#define MADV_DONTNEED 0x4 /* discard these pages */ 37#define MADV_DONTNEED 0x4 /* discard these pages */
38#define MADV_REMOVE 0x5 /* remove these pages & resources */
38 39
39/* compatibility flags */ 40/* compatibility flags */
40#define MAP_ANON MAP_ANONYMOUS 41#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-sh/mutex.h b/include/asm-sh/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-sh/mutex.h
@@ -0,0 +1,9 @@
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-sh/ptrace.h b/include/asm-sh/ptrace.h
index 0f75e16a7415..792fc35bd624 100644
--- a/include/asm-sh/ptrace.h
+++ b/include/asm-sh/ptrace.h
@@ -91,6 +91,16 @@ struct pt_dspregs {
91#define instruction_pointer(regs) ((regs)->pc) 91#define instruction_pointer(regs) ((regs)->pc)
92extern void show_regs(struct pt_regs *); 92extern void show_regs(struct pt_regs *);
93 93
94#ifdef CONFIG_SH_DSP
95#define task_pt_regs(task) \
96 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
97 - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
98#else
99#define task_pt_regs(task) \
100 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
101 - sizeof(unsigned long)) - 1)
102#endif
103
94static inline unsigned long profile_pc(struct pt_regs *regs) 104static inline unsigned long profile_pc(struct pt_regs *regs)
95{ 105{
96 unsigned long pc = instruction_pointer(regs); 106 unsigned long pc = instruction_pointer(regs);
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index 28a3c2d8bcd7..bb0330499bdf 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -57,6 +57,16 @@
57 last = __last; \ 57 last = __last; \
58} while (0) 58} while (0)
59 59
60/*
61 * On SMP systems, when the scheduler does migration-cost autodetection,
62 * it needs a way to flush as much of the CPU's caches as possible.
63 *
64 * TODO: fill this in!
65 */
66static inline void sched_cacheflush(void)
67{
68}
69
60#define nop() __asm__ __volatile__ ("nop") 70#define nop() __asm__ __volatile__ ("nop")
61 71
62 72
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 46080cefaff8..85f0c11b4319 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -60,8 +60,6 @@ static inline struct thread_info *current_thread_info(void)
60#define THREAD_SIZE (2*PAGE_SIZE) 60#define THREAD_SIZE (2*PAGE_SIZE)
61#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) 61#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
62#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 62#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
63#define get_thread_info(ti) get_task_struct((ti)->task)
64#define put_thread_info(ti) put_task_struct((ti)->task)
65 63
66#else /* !__ASSEMBLY__ */ 64#else /* !__ASSEMBLY__ */
67 65
diff --git a/include/asm-sh64/atomic.h b/include/asm-sh64/atomic.h
index 927a2bc27b30..28f2ea9b567b 100644
--- a/include/asm-sh64/atomic.h
+++ b/include/asm-sh64/atomic.h
@@ -113,6 +113,8 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
113 return ret; 113 return ret;
114} 114}
115 115
116#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
117
116static inline int atomic_add_unless(atomic_t *v, int a, int u) 118static inline int atomic_add_unless(atomic_t *v, int a, int u)
117{ 119{
118 int ret; 120 int ret;
@@ -152,4 +154,5 @@ static __inline__ void atomic_set_mask(unsigned int mask, atomic_t *v)
152#define smp_mb__before_atomic_inc() barrier() 154#define smp_mb__before_atomic_inc() barrier()
153#define smp_mb__after_atomic_inc() barrier() 155#define smp_mb__after_atomic_inc() barrier()
154 156
157#include <asm-generic/atomic.h>
155#endif /* __ASM_SH64_ATOMIC_H */ 158#endif /* __ASM_SH64_ATOMIC_H */
diff --git a/include/asm-sh64/bitops.h b/include/asm-sh64/bitops.h
index e1ff63e09227..ce9c3ad45fe0 100644
--- a/include/asm-sh64/bitops.h
+++ b/include/asm-sh64/bitops.h
@@ -510,6 +510,7 @@ found_middle:
510 510
511#define ffs(x) generic_ffs(x) 511#define ffs(x) generic_ffs(x)
512#define fls(x) generic_fls(x) 512#define fls(x) generic_fls(x)
513#define fls64(x) generic_fls64(x)
513 514
514#endif /* __KERNEL__ */ 515#endif /* __KERNEL__ */
515 516
diff --git a/include/asm-sh64/cache.h b/include/asm-sh64/cache.h
index f54e85e8a470..a4f36f0036e1 100644
--- a/include/asm-sh64/cache.h
+++ b/include/asm-sh64/cache.h
@@ -20,8 +20,6 @@
20#define L1_CACHE_ALIGN_MASK (~(L1_CACHE_BYTES - 1)) 20#define L1_CACHE_ALIGN_MASK (~(L1_CACHE_BYTES - 1))
21#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES - 1)) & L1_CACHE_ALIGN_MASK) 21#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES - 1)) & L1_CACHE_ALIGN_MASK)
22#define L1_CACHE_SIZE_BYTES (L1_CACHE_BYTES << 10) 22#define L1_CACHE_SIZE_BYTES (L1_CACHE_BYTES << 10)
23/* Largest L1 which this arch supports */
24#define L1_CACHE_SHIFT_MAX 5
25 23
26#ifdef MODULE 24#ifdef MODULE
27#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES))) 25#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
diff --git a/include/asm-sh64/futex.h b/include/asm-sh64/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-sh64/futex.h
+++ b/include/asm-sh64/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-sh64/io.h b/include/asm-sh64/io.h
index cfafaa73b2b0..dee4f77929a4 100644
--- a/include/asm-sh64/io.h
+++ b/include/asm-sh64/io.h
@@ -143,12 +143,12 @@ extern unsigned long pciio_virt;
143 * Change virtual addresses to physical addresses and vv. 143 * Change virtual addresses to physical addresses and vv.
144 * These are trivial on the 1:1 Linux/SuperH mapping 144 * These are trivial on the 1:1 Linux/SuperH mapping
145 */ 145 */
146extern __inline__ unsigned long virt_to_phys(volatile void * address) 146static inline unsigned long virt_to_phys(volatile void * address)
147{ 147{
148 return __pa(address); 148 return __pa(address);
149} 149}
150 150
151extern __inline__ void * phys_to_virt(unsigned long address) 151static inline void * phys_to_virt(unsigned long address)
152{ 152{
153 return __va(address); 153 return __va(address);
154} 154}
@@ -156,12 +156,12 @@ extern __inline__ void * phys_to_virt(unsigned long address)
156extern void * __ioremap(unsigned long phys_addr, unsigned long size, 156extern void * __ioremap(unsigned long phys_addr, unsigned long size,
157 unsigned long flags); 157 unsigned long flags);
158 158
159extern __inline__ void * ioremap(unsigned long phys_addr, unsigned long size) 159static inline void * ioremap(unsigned long phys_addr, unsigned long size)
160{ 160{
161 return __ioremap(phys_addr, size, 1); 161 return __ioremap(phys_addr, size, 1);
162} 162}
163 163
164extern __inline__ void * ioremap_nocache (unsigned long phys_addr, unsigned long size) 164static inline void * ioremap_nocache (unsigned long phys_addr, unsigned long size)
165{ 165{
166 return __ioremap(phys_addr, size, 0); 166 return __ioremap(phys_addr, size, 0);
167} 167}
diff --git a/include/asm-sh64/ioctl.h b/include/asm-sh64/ioctl.h
index c089a6fb78e0..b279fe06dfe5 100644
--- a/include/asm-sh64/ioctl.h
+++ b/include/asm-sh64/ioctl.h
@@ -1,83 +1 @@
1#ifndef __ASM_SH64_IOCTL_H #include <asm-generic/ioctl.h>
2#define __ASM_SH64_IOCTL_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 * include/asm-sh64/ioctl.h
10 *
11 * Copyright (C) 2000, 2001 Paolo Alberelli
12 *
13 * linux/ioctl.h for Linux by H.H. Bergman.
14 *
15 */
16
17/* ioctl command encoding: 32 bits total, command in lower 16 bits,
18 * size of the parameter structure in the lower 14 bits of the
19 * upper 16 bits.
20 * Encoding the size of the parameter structure in the ioctl request
21 * is useful for catching programs compiled with old versions
22 * and to avoid overwriting user space outside the user buffer area.
23 * The highest 2 bits are reserved for indicating the ``access mode''.
24 * NOTE: This limits the max parameter size to 16kB -1 !
25 */
26
27/*
28 * The following is for compatibility across the various Linux
29 * platforms. The i386 ioctl numbering scheme doesn't really enforce
30 * a type field. De facto, however, the top 8 bits of the lower 16
31 * bits are indeed used as a type field, so we might just as well make
32 * this explicit here. Please be sure to use the decoding macros
33 * below from now on.
34 */
35#define _IOC_NRBITS 8
36#define _IOC_TYPEBITS 8
37#define _IOC_SIZEBITS 14
38#define _IOC_DIRBITS 2
39
40#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
41#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
42#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
43#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
44
45#define _IOC_NRSHIFT 0
46#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
47#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
48#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
49
50/*
51 * Direction bits.
52 */
53#define _IOC_NONE 0U
54#define _IOC_WRITE 1U
55#define _IOC_READ 2U
56
57#define _IOC(dir,type,nr,size) \
58 (((dir) << _IOC_DIRSHIFT) | \
59 ((type) << _IOC_TYPESHIFT) | \
60 ((nr) << _IOC_NRSHIFT) | \
61 ((size) << _IOC_SIZESHIFT))
62
63/* used to create numbers */
64#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
65#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
66#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
67#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
68
69/* used to decode ioctl numbers.. */
70#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
71#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
72#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
73#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
74
75/* ...and for the drivers/sound files... */
76
77#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
78#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
79#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
80#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
81#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
82
83#endif /* __ASM_SH64_IOCTL_H */
diff --git a/include/asm-sh64/mmu_context.h b/include/asm-sh64/mmu_context.h
index f062e1513272..991cfda4cdf6 100644
--- a/include/asm-sh64/mmu_context.h
+++ b/include/asm-sh64/mmu_context.h
@@ -50,7 +50,7 @@ extern pgd_t *mmu_pdtp_cache;
50 */ 50 */
51#define MMU_VPN_MASK 0xfffff000 51#define MMU_VPN_MASK 0xfffff000
52 52
53extern __inline__ void 53static inline void
54get_new_mmu_context(struct mm_struct *mm) 54get_new_mmu_context(struct mm_struct *mm)
55{ 55{
56 extern void flush_tlb_all(void); 56 extern void flush_tlb_all(void);
diff --git a/include/asm-sh64/mutex.h b/include/asm-sh64/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-sh64/mutex.h
@@ -0,0 +1,9 @@
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-sh64/pgalloc.h b/include/asm-sh64/pgalloc.h
index b25f5df5535c..678251ac1db8 100644
--- a/include/asm-sh64/pgalloc.h
+++ b/include/asm-sh64/pgalloc.h
@@ -38,14 +38,14 @@ static inline void pgd_init(unsigned long page)
38 * if any. 38 * if any.
39 */ 39 */
40 40
41extern __inline__ pgd_t *get_pgd_slow(void) 41static inline pgd_t *get_pgd_slow(void)
42{ 42{
43 unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); 43 unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t));
44 pgd_t *ret = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL); 44 pgd_t *ret = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL);
45 return ret; 45 return ret;
46} 46}
47 47
48extern __inline__ pgd_t *get_pgd_fast(void) 48static inline pgd_t *get_pgd_fast(void)
49{ 49{
50 unsigned long *ret; 50 unsigned long *ret;
51 51
@@ -62,14 +62,14 @@ extern __inline__ pgd_t *get_pgd_fast(void)
62 return (pgd_t *)ret; 62 return (pgd_t *)ret;
63} 63}
64 64
65extern __inline__ void free_pgd_fast(pgd_t *pgd) 65static inline void free_pgd_fast(pgd_t *pgd)
66{ 66{
67 *(unsigned long *)pgd = (unsigned long) pgd_quicklist; 67 *(unsigned long *)pgd = (unsigned long) pgd_quicklist;
68 pgd_quicklist = (unsigned long *) pgd; 68 pgd_quicklist = (unsigned long *) pgd;
69 pgtable_cache_size++; 69 pgtable_cache_size++;
70} 70}
71 71
72extern __inline__ void free_pgd_slow(pgd_t *pgd) 72static inline void free_pgd_slow(pgd_t *pgd)
73{ 73{
74 kfree((void *)pgd); 74 kfree((void *)pgd);
75} 75}
@@ -77,7 +77,7 @@ extern __inline__ void free_pgd_slow(pgd_t *pgd)
77extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); 77extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted);
78extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); 78extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted);
79 79
80extern __inline__ pte_t *get_pte_fast(void) 80static inline pte_t *get_pte_fast(void)
81{ 81{
82 unsigned long *ret; 82 unsigned long *ret;
83 83
@@ -89,7 +89,7 @@ extern __inline__ pte_t *get_pte_fast(void)
89 return (pte_t *)ret; 89 return (pte_t *)ret;
90} 90}
91 91
92extern __inline__ void free_pte_fast(pte_t *pte) 92static inline void free_pte_fast(pte_t *pte)
93{ 93{
94 *(unsigned long *)pte = (unsigned long) pte_quicklist; 94 *(unsigned long *)pte = (unsigned long) pte_quicklist;
95 pte_quicklist = (unsigned long *) pte; 95 pte_quicklist = (unsigned long *) pte;
@@ -167,7 +167,7 @@ static __inline__ void pmd_free(pmd_t *pmd)
167 167
168extern int do_check_pgt_cache(int, int); 168extern int do_check_pgt_cache(int, int);
169 169
170extern inline void set_pgdir(unsigned long address, pgd_t entry) 170static inline void set_pgdir(unsigned long address, pgd_t entry)
171{ 171{
172 struct task_struct * p; 172 struct task_struct * p;
173 pgd_t *pgd; 173 pgd_t *pgd;
diff --git a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h
index a1906a772df9..57af6b3eb271 100644
--- a/include/asm-sh64/pgtable.h
+++ b/include/asm-sh64/pgtable.h
@@ -421,18 +421,18 @@ static inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; }
421static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 421static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
422static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; } 422static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; }
423 423
424extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_READ)); return pte; } 424static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_READ)); return pte; }
425extern inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; } 425static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; }
426extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE)); return pte; } 426static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE)); return pte; }
427extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 427static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
428extern inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } 428static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
429 429
430extern inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_READ)); return pte; } 430static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_READ)); return pte; }
431extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_WRITE)); return pte; } 431static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_WRITE)); return pte; }
432extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; } 432static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; }
433extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 433static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
434extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 434static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
435extern inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } 435static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; }
436 436
437 437
438/* 438/*
@@ -456,7 +456,7 @@ extern inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _
456#define mk_pte_phys(physpage, pgprot) \ 456#define mk_pte_phys(physpage, pgprot) \
457({ pte_t __pte; set_pte(&__pte, __pte(physpage | pgprot_val(pgprot))); __pte; }) 457({ pte_t __pte; set_pte(&__pte, __pte(physpage | pgprot_val(pgprot))); __pte; })
458 458
459extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 459static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
460{ set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } 460{ set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; }
461 461
462typedef pte_t *pte_addr_t; 462typedef pte_t *pte_addr_t;
diff --git a/include/asm-sh64/processor.h b/include/asm-sh64/processor.h
index a51bd41e6fbc..1bf252dad824 100644
--- a/include/asm-sh64/processor.h
+++ b/include/asm-sh64/processor.h
@@ -228,7 +228,7 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
228 * FPU lazy state save handling. 228 * FPU lazy state save handling.
229 */ 229 */
230 230
231extern __inline__ void release_fpu(void) 231static inline void release_fpu(void)
232{ 232{
233 unsigned long long __dummy; 233 unsigned long long __dummy;
234 234
@@ -240,7 +240,7 @@ extern __inline__ void release_fpu(void)
240 : "r" (SR_FD)); 240 : "r" (SR_FD));
241} 241}
242 242
243extern __inline__ void grab_fpu(void) 243static inline void grab_fpu(void)
244{ 244{
245 unsigned long long __dummy; 245 unsigned long long __dummy;
246 246
diff --git a/include/asm-sh64/system.h b/include/asm-sh64/system.h
index 42510e496eb5..3002e988180c 100644
--- a/include/asm-sh64/system.h
+++ b/include/asm-sh64/system.h
@@ -132,7 +132,7 @@ static __inline__ void local_irq_disable(void)
132 (flags != 0); \ 132 (flags != 0); \
133}) 133})
134 134
135extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) 135static inline unsigned long xchg_u32(volatile int * m, unsigned long val)
136{ 136{
137 unsigned long flags, retval; 137 unsigned long flags, retval;
138 138
@@ -143,7 +143,7 @@ extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val)
143 return retval; 143 return retval;
144} 144}
145 145
146extern __inline__ unsigned long xchg_u8(volatile unsigned char * m, unsigned long val) 146static inline unsigned long xchg_u8(volatile unsigned char * m, unsigned long val)
147{ 147{
148 unsigned long flags, retval; 148 unsigned long flags, retval;
149 149
diff --git a/include/asm-sh64/thread_info.h b/include/asm-sh64/thread_info.h
index 10f024c6a2e3..1f825cb163c3 100644
--- a/include/asm-sh64/thread_info.h
+++ b/include/asm-sh64/thread_info.h
@@ -66,8 +66,6 @@ static inline struct thread_info *current_thread_info(void)
66 66
67#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) 67#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
68#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 68#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
69#define get_thread_info(ti) get_task_struct((ti)->task)
70#define put_thread_info(ti) put_task_struct((ti)->task)
71 69
72#endif /* __ASSEMBLY__ */ 70#endif /* __ASSEMBLY__ */
73 71
diff --git a/include/asm-sh64/tlbflush.h b/include/asm-sh64/tlbflush.h
index 15c0719eecc3..e45beadc29ee 100644
--- a/include/asm-sh64/tlbflush.h
+++ b/include/asm-sh64/tlbflush.h
@@ -20,7 +20,7 @@ extern void flush_tlb_mm(struct mm_struct *mm);
20extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, 20extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
21 unsigned long end); 21 unsigned long end);
22extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page); 22extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
23extern inline void flush_tlb_pgtables(struct mm_struct *mm, 23static inline void flush_tlb_pgtables(struct mm_struct *mm,
24 unsigned long start, unsigned long end) 24 unsigned long start, unsigned long end)
25{ 25{
26} 26}
diff --git a/include/asm-sh64/uaccess.h b/include/asm-sh64/uaccess.h
index 56aa3cf0f273..f4936d8fa617 100644
--- a/include/asm-sh64/uaccess.h
+++ b/include/asm-sh64/uaccess.h
@@ -287,7 +287,7 @@ __sfu_res = __strncpy_from_user((unsigned long) (dest), __sfu_src, __sfu_count);
287 */ 287 */
288extern long __strnlen_user(const char *__s, long __n); 288extern long __strnlen_user(const char *__s, long __n);
289 289
290extern __inline__ long strnlen_user(const char *s, long n) 290static inline long strnlen_user(const char *s, long n)
291{ 291{
292 if (!__addr_ok(s)) 292 if (!__addr_ok(s))
293 return 0; 293 return 0;
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h
index 62bec7ad271c..e1033170bd3a 100644
--- a/include/asm-sparc/atomic.h
+++ b/include/asm-sparc/atomic.h
@@ -20,6 +20,7 @@ typedef struct { volatile int counter; } atomic_t;
20 20
21extern int __atomic_add_return(int, atomic_t *); 21extern int __atomic_add_return(int, atomic_t *);
22extern int atomic_cmpxchg(atomic_t *, int, int); 22extern int atomic_cmpxchg(atomic_t *, int, int);
23#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
23extern int atomic_add_unless(atomic_t *, int, int); 24extern int atomic_add_unless(atomic_t *, int, int);
24extern void atomic_set(atomic_t *, int); 25extern void atomic_set(atomic_t *, int);
25 26
@@ -159,4 +160,5 @@ static inline int __atomic24_sub(int i, atomic24_t *v)
159 160
160#endif /* !(__KERNEL__) */ 161#endif /* !(__KERNEL__) */
161 162
163#include <asm-generic/atomic.h>
162#endif /* !(__ARCH_SPARC_ATOMIC__) */ 164#endif /* !(__ARCH_SPARC_ATOMIC__) */
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h
index bfbd795a0a80..41722b5e45ef 100644
--- a/include/asm-sparc/bitops.h
+++ b/include/asm-sparc/bitops.h
@@ -298,6 +298,7 @@ static inline int ffs(int x)
298 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. 298 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
299 */ 299 */
300#define fls(x) generic_fls(x) 300#define fls(x) generic_fls(x)
301#define fls64(x) generic_fls64(x)
301 302
302/* 303/*
303 * hweightN: returns the hamming weight (i.e. the number 304 * hweightN: returns the hamming weight (i.e. the number
diff --git a/include/asm-sparc/cache.h b/include/asm-sparc/cache.h
index a10522cb21b7..cb971e88aea4 100644
--- a/include/asm-sparc/cache.h
+++ b/include/asm-sparc/cache.h
@@ -13,7 +13,6 @@
13#define L1_CACHE_SHIFT 5 13#define L1_CACHE_SHIFT 5
14#define L1_CACHE_BYTES 32 14#define L1_CACHE_BYTES 32
15#define L1_CACHE_ALIGN(x) ((((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))) 15#define L1_CACHE_ALIGN(x) ((((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)))
16#define L1_CACHE_SHIFT_MAX 5 /* largest L1 which this arch supports */
17 16
18#define SMP_CACHE_BYTES 32 17#define SMP_CACHE_BYTES 32
19 18
diff --git a/include/asm-sparc/futex.h b/include/asm-sparc/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-sparc/futex.h
+++ b/include/asm-sparc/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-sparc/mman.h b/include/asm-sparc/mman.h
index 138eb81dd70d..98435ad8619e 100644
--- a/include/asm-sparc/mman.h
+++ b/include/asm-sparc/mman.h
@@ -54,6 +54,7 @@
54#define MADV_WILLNEED 0x3 /* pre-fault pages */ 54#define MADV_WILLNEED 0x3 /* pre-fault pages */
55#define MADV_DONTNEED 0x4 /* discard these pages */ 55#define MADV_DONTNEED 0x4 /* discard these pages */
56#define MADV_FREE 0x5 /* (Solaris) contents can be freed */ 56#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
57#define MADV_REMOVE 0x6 /* remove these pages & resources */
57 58
58/* compatibility flags */ 59/* compatibility flags */
59#define MAP_ANON MAP_ANONYMOUS 60#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-sparc/mutex.h b/include/asm-sparc/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-sparc/mutex.h
@@ -0,0 +1,9 @@
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-sparc/system.h b/include/asm-sparc/system.h
index 1f6b71f9e1b6..58dd162927bb 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -155,7 +155,7 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
155 "here:\n" \ 155 "here:\n" \
156 : "=&r" (last) \ 156 : "=&r" (last) \
157 : "r" (&(current_set[hard_smp_processor_id()])), \ 157 : "r" (&(current_set[hard_smp_processor_id()])), \
158 "r" ((next)->thread_info), \ 158 "r" (task_thread_info(next)), \
159 "i" (TI_KPSR), \ 159 "i" (TI_KPSR), \
160 "i" (TI_KSP), \ 160 "i" (TI_KSP), \
161 "i" (TI_TASK) \ 161 "i" (TI_TASK) \
@@ -166,6 +166,16 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
166 } while(0) 166 } while(0)
167 167
168/* 168/*
169 * On SMP systems, when the scheduler does migration-cost autodetection,
170 * it needs a way to flush as much of the CPU's caches as possible.
171 *
172 * TODO: fill this in!
173 */
174static inline void sched_cacheflush(void)
175{
176}
177
178/*
169 * Changing the IRQ level on the Sparc. 179 * Changing the IRQ level on the Sparc.
170 */ 180 */
171extern void local_irq_restore(unsigned long); 181extern void local_irq_restore(unsigned long);
diff --git a/include/asm-sparc/thread_info.h b/include/asm-sparc/thread_info.h
index ff6ccb3d24c6..65f060b040ab 100644
--- a/include/asm-sparc/thread_info.h
+++ b/include/asm-sparc/thread_info.h
@@ -92,9 +92,6 @@ BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void)
92BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *) 92BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
93#define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti) 93#define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti)
94 94
95#define get_thread_info(ti) get_task_struct((ti)->task)
96#define put_thread_info(ti) put_task_struct((ti)->task)
97
98#endif /* __ASSEMBLY__ */ 95#endif /* __ASSEMBLY__ */
99 96
100/* 97/*
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
index 3789fe315992..25256bdc8aae 100644
--- a/include/asm-sparc64/atomic.h
+++ b/include/asm-sparc64/atomic.h
@@ -72,6 +72,7 @@ extern int atomic64_sub_ret(int, atomic64_t *);
72#define atomic64_add_negative(i, v) (atomic64_add_ret(i, v) < 0) 72#define atomic64_add_negative(i, v) (atomic64_add_ret(i, v) < 0)
73 73
74#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 74#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
75#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
75 76
76#define atomic_add_unless(v, a, u) \ 77#define atomic_add_unless(v, a, u) \
77({ \ 78({ \
@@ -96,4 +97,5 @@ extern int atomic64_sub_ret(int, atomic64_t *);
96#define smp_mb__after_atomic_inc() barrier() 97#define smp_mb__after_atomic_inc() barrier()
97#endif 98#endif
98 99
100#include <asm-generic/atomic.h>
99#endif /* !(__ARCH_SPARC64_ATOMIC__) */ 101#endif /* !(__ARCH_SPARC64_ATOMIC__) */
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
index 6388b8376c50..6efc0162fb09 100644
--- a/include/asm-sparc64/bitops.h
+++ b/include/asm-sparc64/bitops.h
@@ -119,6 +119,7 @@ static inline unsigned long __ffs(unsigned long word)
119 */ 119 */
120 120
121#define fls(x) generic_fls(x) 121#define fls(x) generic_fls(x)
122#define fls64(x) generic_fls64(x)
122 123
123#ifdef __KERNEL__ 124#ifdef __KERNEL__
124 125
diff --git a/include/asm-sparc64/cache.h b/include/asm-sparc64/cache.h
index ade5ec3bfd5a..f7d35a2ae9b8 100644
--- a/include/asm-sparc64/cache.h
+++ b/include/asm-sparc64/cache.h
@@ -9,7 +9,6 @@
9#define L1_CACHE_BYTES 32 /* Two 16-byte sub-blocks per line. */ 9#define L1_CACHE_BYTES 32 /* Two 16-byte sub-blocks per line. */
10 10
11#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) 11#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
12#define L1_CACHE_SHIFT_MAX 5 /* largest L1 which this arch supports */
13 12
14#define SMP_CACHE_BYTES_SHIFT 6 13#define SMP_CACHE_BYTES_SHIFT 6
15#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) /* L2 cache line size. */ 14#define SMP_CACHE_BYTES (1 << SMP_CACHE_BYTES_SHIFT) /* L2 cache line size. */
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h
index 91458118277e..69539a8ab833 100644
--- a/include/asm-sparc64/elf.h
+++ b/include/asm-sparc64/elf.h
@@ -119,7 +119,7 @@ typedef struct {
119#endif 119#endif
120 120
121#define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \ 121#define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \
122 ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread_info->kregs); 1; }) 122 ({ ELF_CORE_COPY_REGS((*(__elf_regs)), task_pt_regs(__tsk)); 1; })
123 123
124/* 124/*
125 * This is used to ensure we don't load something for the wrong architecture. 125 * This is used to ensure we don't load something for the wrong architecture.
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-sparc64/futex.h
+++ b/include/asm-sparc64/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h
index 7ba845320f5c..e4efe652b54b 100644
--- a/include/asm-sparc64/kprobes.h
+++ b/include/asm-sparc64/kprobes.h
@@ -12,6 +12,7 @@ typedef u32 kprobe_opcode_t;
12#define MAX_INSN_SIZE 2 12#define MAX_INSN_SIZE 2
13 13
14#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 14#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
15#define arch_remove_kprobe(p) do {} while (0)
15 16
16/* Architecture specific copy of original instruction*/ 17/* Architecture specific copy of original instruction*/
17struct arch_specific_insn { 18struct arch_specific_insn {
@@ -38,15 +39,6 @@ struct kprobe_ctlblk {
38 struct prev_kprobe prev_kprobe; 39 struct prev_kprobe prev_kprobe;
39}; 40};
40 41
41#ifdef CONFIG_KPROBES
42extern int kprobe_exceptions_notify(struct notifier_block *self, 42extern int kprobe_exceptions_notify(struct notifier_block *self,
43 unsigned long val, void *data); 43 unsigned long val, void *data);
44#else /* !CONFIG_KPROBES */
45static inline int kprobe_exceptions_notify(struct notifier_block *self,
46 unsigned long val, void *data)
47{
48 return 0;
49}
50#endif
51
52#endif /* _SPARC64_KPROBES_H */ 44#endif /* _SPARC64_KPROBES_H */
diff --git a/include/asm-sparc64/mman.h b/include/asm-sparc64/mman.h
index 01cecf54357b..cb4b6156194d 100644
--- a/include/asm-sparc64/mman.h
+++ b/include/asm-sparc64/mman.h
@@ -54,6 +54,7 @@
54#define MADV_WILLNEED 0x3 /* pre-fault pages */ 54#define MADV_WILLNEED 0x3 /* pre-fault pages */
55#define MADV_DONTNEED 0x4 /* discard these pages */ 55#define MADV_DONTNEED 0x4 /* discard these pages */
56#define MADV_FREE 0x5 /* (Solaris) contents can be freed */ 56#define MADV_FREE 0x5 /* (Solaris) contents can be freed */
57#define MADV_REMOVE 0x6 /* remove these pages & resources */
57 58
58/* compatibility flags */ 59/* compatibility flags */
59#define MAP_ANON MAP_ANONYMOUS 60#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
index 08ba72d7722c..57ee7b306189 100644
--- a/include/asm-sparc64/mmu_context.h
+++ b/include/asm-sparc64/mmu_context.h
@@ -60,7 +60,7 @@ do { \
60 register unsigned long pgd_cache asm("o4"); \ 60 register unsigned long pgd_cache asm("o4"); \
61 paddr = __pa((__mm)->pgd); \ 61 paddr = __pa((__mm)->pgd); \
62 pgd_cache = 0UL; \ 62 pgd_cache = 0UL; \
63 if ((__tsk)->thread_info->flags & _TIF_32BIT) \ 63 if (task_thread_info(__tsk)->flags & _TIF_32BIT) \
64 pgd_cache = get_pgd_cache((__mm)->pgd); \ 64 pgd_cache = get_pgd_cache((__mm)->pgd); \
65 __asm__ __volatile__("wrpr %%g0, 0x494, %%pstate\n\t" \ 65 __asm__ __volatile__("wrpr %%g0, 0x494, %%pstate\n\t" \
66 "mov %3, %%g4\n\t" \ 66 "mov %3, %%g4\n\t" \
diff --git a/include/asm-sparc64/mutex.h b/include/asm-sparc64/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-sparc64/mutex.h
@@ -0,0 +1,9 @@
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-sparc64/processor.h b/include/asm-sparc64/processor.h
index 3169f3e2237e..cd8d9b4c8658 100644
--- a/include/asm-sparc64/processor.h
+++ b/include/asm-sparc64/processor.h
@@ -186,8 +186,9 @@ extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
186 186
187extern unsigned long get_wchan(struct task_struct *task); 187extern unsigned long get_wchan(struct task_struct *task);
188 188
189#define KSTK_EIP(tsk) ((tsk)->thread_info->kregs->tpc) 189#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)
190#define KSTK_ESP(tsk) ((tsk)->thread_info->kregs->u_regs[UREG_FP]) 190#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc)
191#define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP])
191 192
192#define cpu_relax() barrier() 193#define cpu_relax() barrier()
193 194
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index b5417529f6f1..af254e581834 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -193,11 +193,7 @@ do { \
193 * not preserve it's value. Hairy, but it lets us remove 2 loads 193 * not preserve it's value. Hairy, but it lets us remove 2 loads
194 * and 2 stores in this critical code path. -DaveM 194 * and 2 stores in this critical code path. -DaveM
195 */ 195 */
196#if __GNUC__ >= 3
197#define EXTRA_CLOBBER ,"%l1" 196#define EXTRA_CLOBBER ,"%l1"
198#else
199#define EXTRA_CLOBBER
200#endif
201#define switch_to(prev, next, last) \ 197#define switch_to(prev, next, last) \
202do { if (test_thread_flag(TIF_PERFCTR)) { \ 198do { if (test_thread_flag(TIF_PERFCTR)) { \
203 unsigned long __tmp; \ 199 unsigned long __tmp; \
@@ -212,7 +208,7 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
212 /* If you are tempted to conditionalize the following */ \ 208 /* If you are tempted to conditionalize the following */ \
213 /* so that ASI is only written if it changes, think again. */ \ 209 /* so that ASI is only written if it changes, think again. */ \
214 __asm__ __volatile__("wr %%g0, %0, %%asi" \ 210 __asm__ __volatile__("wr %%g0, %0, %%asi" \
215 : : "r" (__thread_flag_byte_ptr(next->thread_info)[TI_FLAG_BYTE_CURRENT_DS]));\ 211 : : "r" (__thread_flag_byte_ptr(task_thread_info(next))[TI_FLAG_BYTE_CURRENT_DS]));\
216 __asm__ __volatile__( \ 212 __asm__ __volatile__( \
217 "mov %%g4, %%g7\n\t" \ 213 "mov %%g4, %%g7\n\t" \
218 "wrpr %%g0, 0x95, %%pstate\n\t" \ 214 "wrpr %%g0, 0x95, %%pstate\n\t" \
@@ -242,7 +238,7 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
242 "b,a ret_from_syscall\n\t" \ 238 "b,a ret_from_syscall\n\t" \
243 "1:\n\t" \ 239 "1:\n\t" \
244 : "=&r" (last) \ 240 : "=&r" (last) \
245 : "0" (next->thread_info), \ 241 : "0" (task_thread_info(next)), \
246 "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD), \ 242 "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD), \
247 "i" (TI_CWP), "i" (TI_TASK) \ 243 "i" (TI_CWP), "i" (TI_TASK) \
248 : "cc", \ 244 : "cc", \
@@ -257,6 +253,16 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
257 } \ 253 } \
258} while(0) 254} while(0)
259 255
256/*
257 * On SMP systems, when the scheduler does migration-cost autodetection,
258 * it needs a way to flush as much of the CPU's caches as possible.
259 *
260 * TODO: fill this in!
261 */
262static inline void sched_cacheflush(void)
263{
264}
265
260static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val) 266static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val)
261{ 267{
262 unsigned long tmp1, tmp2; 268 unsigned long tmp1, tmp2;
diff --git a/include/asm-um/cache.h b/include/asm-um/cache.h
index a10602a5b2d6..3d0587075521 100644
--- a/include/asm-um/cache.h
+++ b/include/asm-um/cache.h
@@ -13,9 +13,6 @@
13# define L1_CACHE_SHIFT 5 13# define L1_CACHE_SHIFT 5
14#endif 14#endif
15 15
16/* XXX: this is valid for x86 and x86_64. */
17#define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */
18
19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 16#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
20 17
21#endif 18#endif
diff --git a/include/asm-um/futex.h b/include/asm-um/futex.h
index 142ee2d8e0fd..6a332a9f099c 100644
--- a/include/asm-um/futex.h
+++ b/include/asm-um/futex.h
@@ -1,12 +1,6 @@
1#ifndef __UM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define __UM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#include <linux/futex.h> 4#include <asm-generic/futex.h>
5#include <asm/errno.h>
6#include <asm/system.h>
7#include <asm/processor.h>
8#include <asm/uaccess.h>
9
10#include "asm/arch/futex.h"
11 5
12#endif 6#endif
diff --git a/include/asm-um/mutex.h b/include/asm-um/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-um/mutex.h
@@ -0,0 +1,9 @@
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-um/processor-generic.h b/include/asm-um/processor-generic.h
index 075771c371f6..da07a69ce82a 100644
--- a/include/asm-um/processor-generic.h
+++ b/include/asm-um/processor-generic.h
@@ -89,7 +89,6 @@ extern struct task_struct *alloc_task_struct(void);
89 89
90extern void release_thread(struct task_struct *); 90extern void release_thread(struct task_struct *);
91extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); 91extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
92extern void dump_thread(struct pt_regs *regs, struct user *u);
93 92
94static inline void prepare_to_copy(struct task_struct *tsk) 93static inline void prepare_to_copy(struct task_struct *tsk)
95{ 94{
diff --git a/include/asm-um/rwsem.h b/include/asm-um/rwsem.h
index 661c0e54702b..b5fc449dc86b 100644
--- a/include/asm-um/rwsem.h
+++ b/include/asm-um/rwsem.h
@@ -1,10 +1,6 @@
1#ifndef __UM_RWSEM_H__ 1#ifndef __UM_RWSEM_H__
2#define __UM_RWSEM_H__ 2#define __UM_RWSEM_H__
3 3
4#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
5#define __builtin_expect(exp,c) (exp)
6#endif
7
8#include "asm/arch/rwsem.h" 4#include "asm/arch/rwsem.h"
9 5
10#endif 6#endif
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h
index 97267f059ef5..705c71972c32 100644
--- a/include/asm-um/thread_info.h
+++ b/include/asm-um/thread_info.h
@@ -56,9 +56,6 @@ static inline struct thread_info *current_thread_info(void)
56 ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL)) 56 ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL))
57#define free_thread_info(ti) kfree(ti) 57#define free_thread_info(ti) kfree(ti)
58 58
59#define get_thread_info(ti) get_task_struct((ti)->task)
60#define put_thread_info(ti) put_task_struct((ti)->task)
61
62#endif 59#endif
63 60
64#define PREEMPT_ACTIVE 0x10000000 61#define PREEMPT_ACTIVE 0x10000000
diff --git a/include/asm-v850/atomic.h b/include/asm-v850/atomic.h
index bede3172ce7f..166df00457ea 100644
--- a/include/asm-v850/atomic.h
+++ b/include/asm-v850/atomic.h
@@ -104,6 +104,8 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
104 return ret; 104 return ret;
105} 105}
106 106
107#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
108
107static inline int atomic_add_unless(atomic_t *v, int a, int u) 109static inline int atomic_add_unless(atomic_t *v, int a, int u)
108{ 110{
109 int ret; 111 int ret;
@@ -126,4 +128,5 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
126#define smp_mb__before_atomic_inc() barrier() 128#define smp_mb__before_atomic_inc() barrier()
127#define smp_mb__after_atomic_inc() barrier() 129#define smp_mb__after_atomic_inc() barrier()
128 130
131#include <asm-generic/atomic.h>
129#endif /* __V850_ATOMIC_H__ */ 132#endif /* __V850_ATOMIC_H__ */
diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h
index b91e799763fd..8955d2376ac8 100644
--- a/include/asm-v850/bitops.h
+++ b/include/asm-v850/bitops.h
@@ -276,6 +276,7 @@ found_middle:
276 276
277#define ffs(x) generic_ffs (x) 277#define ffs(x) generic_ffs (x)
278#define fls(x) generic_fls (x) 278#define fls(x) generic_fls (x)
279#define fls64(x) generic_fls64(x)
279#define __ffs(x) ffs(x) 280#define __ffs(x) ffs(x)
280 281
281 282
diff --git a/include/asm-v850/cache.h b/include/asm-v850/cache.h
index cbf9096e8517..8832c7ea3242 100644
--- a/include/asm-v850/cache.h
+++ b/include/asm-v850/cache.h
@@ -23,6 +23,4 @@
23#define L1_CACHE_SHIFT 4 23#define L1_CACHE_SHIFT 4
24#endif 24#endif
25 25
26#define L1_CACHE_SHIFT_MAX L1_CACHE_SHIFT
27
28#endif /* __V850_CACHE_H__ */ 26#endif /* __V850_CACHE_H__ */
diff --git a/include/asm-v850/futex.h b/include/asm-v850/futex.h
index 9feff4ce1424..6a332a9f099c 100644
--- a/include/asm-v850/futex.h
+++ b/include/asm-v850/futex.h
@@ -1,53 +1,6 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#include <asm-generic/futex.h>
5 5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif 6#endif
diff --git a/include/asm-v850/ioctl.h b/include/asm-v850/ioctl.h
index 1765df6c7b87..b279fe06dfe5 100644
--- a/include/asm-v850/ioctl.h
+++ b/include/asm-v850/ioctl.h
@@ -1,80 +1 @@
1/* $Id: ioctl.h,v 1.1 2002/09/28 14:58:41 gerg Exp $ #include <asm-generic/ioctl.h>
2 *
3 * linux/ioctl.h for Linux by H.H. Bergman.
4 */
5
6#ifndef _V850_IOCTL_H
7#define _V850_IOCTL_H
8
9/* ioctl command encoding: 32 bits total, command in lower 16 bits,
10 * size of the parameter structure in the lower 14 bits of the
11 * upper 16 bits.
12 * Encoding the size of the parameter structure in the ioctl request
13 * is useful for catching programs compiled with old versions
14 * and to avoid overwriting user space outside the user buffer area.
15 * The highest 2 bits are reserved for indicating the ``access mode''.
16 * NOTE: This limits the max parameter size to 16kB -1 !
17 */
18
19/*
20 * I don't really have any idea about what this should look like, so
21 * for the time being, this is heavily based on the PC definitions.
22 */
23
24/*
25 * The following is for compatibility across the various Linux
26 * platforms. The i386 ioctl numbering scheme doesn't really enforce
27 * a type field. De facto, however, the top 8 bits of the lower 16
28 * bits are indeed used as a type field, so we might just as well make
29 * this explicit here. Please be sure to use the decoding macros
30 * below from now on.
31 */
32#define _IOC_NRBITS 8
33#define _IOC_TYPEBITS 8
34#define _IOC_SIZEBITS 14
35#define _IOC_DIRBITS 2
36
37#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
38#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
39#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
40#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
41
42#define _IOC_NRSHIFT 0
43#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
44#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
45#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
46
47/*
48 * Direction bits.
49 */
50#define _IOC_NONE 0U
51#define _IOC_WRITE 1U
52#define _IOC_READ 2U
53
54#define _IOC(dir,type,nr,size) \
55 (((dir) << _IOC_DIRSHIFT) | \
56 ((type) << _IOC_TYPESHIFT) | \
57 ((nr) << _IOC_NRSHIFT) | \
58 ((size) << _IOC_SIZESHIFT))
59
60/* used to create numbers */
61#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
62#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
63#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
64#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
65
66/* used to decode ioctl numbers.. */
67#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
68#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
69#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
70#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
71
72/* ...and for the drivers/sound files... */
73
74#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
75#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
76#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
77#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
78#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
79
80#endif /* __V850_IOCTL_H__ */
diff --git a/include/asm-v850/mman.h b/include/asm-v850/mman.h
index e2b90081b56f..edc79965193a 100644
--- a/include/asm-v850/mman.h
+++ b/include/asm-v850/mman.h
@@ -32,6 +32,7 @@
32#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 32#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
33#define MADV_WILLNEED 0x3 /* pre-fault pages */ 33#define MADV_WILLNEED 0x3 /* pre-fault pages */
34#define MADV_DONTNEED 0x4 /* discard these pages */ 34#define MADV_DONTNEED 0x4 /* discard these pages */
35#define MADV_REMOVE 0x5 /* remove these pages & resources */
35 36
36/* compatibility flags */ 37/* compatibility flags */
37#define MAP_ANON MAP_ANONYMOUS 38#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-v850/mutex.h b/include/asm-v850/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-v850/mutex.h
@@ -0,0 +1,9 @@
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-v850/processor.h b/include/asm-v850/processor.h
index 98f929427d3d..2d31308935a0 100644
--- a/include/asm-v850/processor.h
+++ b/include/asm-v850/processor.h
@@ -98,10 +98,10 @@ unsigned long get_wchan (struct task_struct *p);
98 98
99 99
100/* Return some info about the user process TASK. */ 100/* Return some info about the user process TASK. */
101#define task_tos(task) ((unsigned long)(task)->thread_info + THREAD_SIZE) 101#define task_tos(task) ((unsigned long)task_stack_page(task) + THREAD_SIZE)
102#define task_regs(task) ((struct pt_regs *)task_tos (task) - 1) 102#define task_pt_regs(task) ((struct pt_regs *)task_tos (task) - 1)
103#define task_sp(task) (task_regs (task)->gpr[GPR_SP]) 103#define task_sp(task) (task_pt_regs (task)->gpr[GPR_SP])
104#define task_pc(task) (task_regs (task)->pc) 104#define task_pc(task) (task_pt_regs (task)->pc)
105/* Grotty old names for some. */ 105/* Grotty old names for some. */
106#define KSTK_EIP(task) task_pc (task) 106#define KSTK_EIP(task) task_pc (task)
107#define KSTK_ESP(task) task_sp (task) 107#define KSTK_ESP(task) task_sp (task)
diff --git a/include/asm-v850/thread_info.h b/include/asm-v850/thread_info.h
index e4cfad94a553..82b8f2846207 100644
--- a/include/asm-v850/thread_info.h
+++ b/include/asm-v850/thread_info.h
@@ -58,8 +58,6 @@ struct thread_info {
58#define alloc_thread_info(tsk) ((struct thread_info *) \ 58#define alloc_thread_info(tsk) ((struct thread_info *) \
59 __get_free_pages(GFP_KERNEL, 1)) 59 __get_free_pages(GFP_KERNEL, 1))
60#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 60#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
61#define get_thread_info(ti) get_task_struct((ti)->task)
62#define put_thread_info(ti) put_task_struct((ti)->task)
63 61
64#endif /* __ASSEMBLY__ */ 62#endif /* __ASSEMBLY__ */
65 63
diff --git a/include/asm-v850/unistd.h b/include/asm-v850/unistd.h
index 5a86f8e976ec..82460a7bb233 100644
--- a/include/asm-v850/unistd.h
+++ b/include/asm-v850/unistd.h
@@ -241,9 +241,6 @@
241/* User programs sometimes end up including this header file 241/* User programs sometimes end up including this header file
242 (indirectly, via uClibc header files), so I'm a bit nervous just 242 (indirectly, via uClibc header files), so I'm a bit nervous just
243 including <linux/compiler.h>. */ 243 including <linux/compiler.h>. */
244#if !defined(__builtin_expect) && __GNUC__ == 2 && __GNUC_MINOR__ < 96
245#define __builtin_expect(x, expected_value) (x)
246#endif
247 244
248#define __syscall_return(type, res) \ 245#define __syscall_return(type, res) \
249 do { \ 246 do { \
@@ -346,20 +343,6 @@ type name (atype a, btype b, ctype c, dtype d, etype e) \
346 __syscall_return (type, __ret); \ 343 __syscall_return (type, __ret); \
347} 344}
348 345
349#if __GNUC__ < 3
350/* In older versions of gcc, `asm' statements with more than 10
351 input/output arguments produce a fatal error. To work around this
352 problem, we use two versions, one for gcc-3.x and one for earlier
353 versions of gcc (the `earlier gcc' version doesn't work with gcc-3.x
354 because gcc-3.x doesn't allow clobbers to also be input arguments). */
355#define __SYSCALL6_TRAP(syscall, ret, a, b, c, d, e, f) \
356 __asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP \
357 : "=r" (ret), "=r" (syscall) \
358 : "1" (syscall), \
359 "r" (a), "r" (b), "r" (c), "r" (d), \
360 "r" (e), "r" (f) \
361 : SYSCALL_CLOBBERS, SYSCALL_ARG4, SYSCALL_ARG5);
362#else /* __GNUC__ >= 3 */
363#define __SYSCALL6_TRAP(syscall, ret, a, b, c, d, e, f) \ 346#define __SYSCALL6_TRAP(syscall, ret, a, b, c, d, e, f) \
364 __asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP \ 347 __asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP \
365 : "=r" (ret), "=r" (syscall), \ 348 : "=r" (ret), "=r" (syscall), \
@@ -368,7 +351,6 @@ type name (atype a, btype b, ctype c, dtype d, etype e) \
368 "r" (a), "r" (b), "r" (c), "r" (d), \ 351 "r" (a), "r" (b), "r" (c), "r" (d), \
369 "2" (e), "3" (f) \ 352 "2" (e), "3" (f) \
370 : SYSCALL_CLOBBERS); 353 : SYSCALL_CLOBBERS);
371#endif
372 354
373#define _syscall6(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e, ftype, f) \ 355#define _syscall6(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e, ftype, f) \
374type name (atype a, btype b, ctype c, dtype d, etype e, ftype f) \ 356type name (atype a, btype b, ctype c, dtype d, etype e, ftype f) \
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h
index 5647b7de1749..4f6a4dc455bb 100644
--- a/include/asm-x86_64/apic.h
+++ b/include/asm-x86_64/apic.h
@@ -42,11 +42,6 @@ static __inline void apic_write(unsigned long reg, unsigned int v)
42 *((volatile unsigned int *)(APIC_BASE+reg)) = v; 42 *((volatile unsigned int *)(APIC_BASE+reg)) = v;
43} 43}
44 44
45static __inline void apic_write_atomic(unsigned long reg, unsigned int v)
46{
47 xchg((volatile unsigned int *)(APIC_BASE+reg), v);
48}
49
50static __inline unsigned int apic_read(unsigned long reg) 45static __inline unsigned int apic_read(unsigned long reg)
51{ 46{
52 return *((volatile unsigned int *)(APIC_BASE+reg)); 47 return *((volatile unsigned int *)(APIC_BASE+reg));
@@ -57,10 +52,6 @@ static __inline__ void apic_wait_icr_idle(void)
57 while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY ); 52 while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY );
58} 53}
59 54
60#define FORCE_READ_AROUND_WRITE 0
61#define apic_read_around(x)
62#define apic_write_around(x,y) apic_write((x),(y))
63
64static inline void ack_APIC_irq(void) 55static inline void ack_APIC_irq(void)
65{ 56{
66 /* 57 /*
@@ -71,7 +62,7 @@ static inline void ack_APIC_irq(void)
71 */ 62 */
72 63
73 /* Docs say use 0 for future compatibility */ 64 /* Docs say use 0 for future compatibility */
74 apic_write_around(APIC_EOI, 0); 65 apic_write(APIC_EOI, 0);
75} 66}
76 67
77extern int get_maxlvt (void); 68extern int get_maxlvt (void);
@@ -113,6 +104,12 @@ extern int disable_timer_pin_1;
113 104
114extern void setup_threshold_lvt(unsigned long lvt_off); 105extern void setup_threshold_lvt(unsigned long lvt_off);
115 106
107void smp_send_timer_broadcast_ipi(void);
108void switch_APIC_timer_to_ipi(void *cpumask);
109void switch_ipi_to_APIC_timer(void *cpumask);
110
111#define ARCH_APICTIMER_STOPS_ON_C3 1
112
116#endif /* CONFIG_X86_LOCAL_APIC */ 113#endif /* CONFIG_X86_LOCAL_APIC */
117 114
118extern unsigned boot_cpu_id; 115extern unsigned boot_cpu_id;
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h
index fb1c99ac669f..decaa2d540e8 100644
--- a/include/asm-x86_64/apicdef.h
+++ b/include/asm-x86_64/apicdef.h
@@ -13,6 +13,7 @@
13#define APIC_ID 0x20 13#define APIC_ID 0x20
14#define APIC_ID_MASK (0xFFu<<24) 14#define APIC_ID_MASK (0xFFu<<24)
15#define GET_APIC_ID(x) (((x)>>24)&0xFFu) 15#define GET_APIC_ID(x) (((x)>>24)&0xFFu)
16#define SET_APIC_ID(x) (((x)<<24))
16#define APIC_LVR 0x30 17#define APIC_LVR 0x30
17#define APIC_LVR_MASK 0xFF00FF 18#define APIC_LVR_MASK 0xFF00FF
18#define GET_APIC_VERSION(x) ((x)&0xFFu) 19#define GET_APIC_VERSION(x) ((x)&0xFFu)
diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h
index 50db9f39274f..4b5cd553e772 100644
--- a/include/asm-x86_64/atomic.h
+++ b/include/asm-x86_64/atomic.h
@@ -2,6 +2,7 @@
2#define __ARCH_X86_64_ATOMIC__ 2#define __ARCH_X86_64_ATOMIC__
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5#include <asm/types.h>
5 6
6/* atomic_t should be 32 bit signed type */ 7/* atomic_t should be 32 bit signed type */
7 8
@@ -389,6 +390,7 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t *v)
389#define atomic64_dec_return(v) (atomic64_sub_return(1,v)) 390#define atomic64_dec_return(v) (atomic64_sub_return(1,v))
390 391
391#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new)) 392#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new))
393#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
392 394
393/** 395/**
394 * atomic_add_unless - add unless the number is a given value 396 * atomic_add_unless - add unless the number is a given value
@@ -424,4 +426,5 @@ __asm__ __volatile__(LOCK "orl %0,%1" \
424#define smp_mb__before_atomic_inc() barrier() 426#define smp_mb__before_atomic_inc() barrier()
425#define smp_mb__after_atomic_inc() barrier() 427#define smp_mb__after_atomic_inc() barrier()
426 428
429#include <asm-generic/atomic.h>
427#endif 430#endif
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index 05a0d374404b..eb4df23e1e41 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -29,7 +29,7 @@ static __inline__ void set_bit(int nr, volatile void * addr)
29{ 29{
30 __asm__ __volatile__( LOCK_PREFIX 30 __asm__ __volatile__( LOCK_PREFIX
31 "btsl %1,%0" 31 "btsl %1,%0"
32 :"=m" (ADDR) 32 :"+m" (ADDR)
33 :"dIr" (nr) : "memory"); 33 :"dIr" (nr) : "memory");
34} 34}
35 35
@@ -46,7 +46,7 @@ static __inline__ void __set_bit(int nr, volatile void * addr)
46{ 46{
47 __asm__ volatile( 47 __asm__ volatile(
48 "btsl %1,%0" 48 "btsl %1,%0"
49 :"=m" (ADDR) 49 :"+m" (ADDR)
50 :"dIr" (nr) : "memory"); 50 :"dIr" (nr) : "memory");
51} 51}
52 52
@@ -64,7 +64,7 @@ static __inline__ void clear_bit(int nr, volatile void * addr)
64{ 64{
65 __asm__ __volatile__( LOCK_PREFIX 65 __asm__ __volatile__( LOCK_PREFIX
66 "btrl %1,%0" 66 "btrl %1,%0"
67 :"=m" (ADDR) 67 :"+m" (ADDR)
68 :"dIr" (nr)); 68 :"dIr" (nr));
69} 69}
70 70
@@ -72,7 +72,7 @@ static __inline__ void __clear_bit(int nr, volatile void * addr)
72{ 72{
73 __asm__ __volatile__( 73 __asm__ __volatile__(
74 "btrl %1,%0" 74 "btrl %1,%0"
75 :"=m" (ADDR) 75 :"+m" (ADDR)
76 :"dIr" (nr)); 76 :"dIr" (nr));
77} 77}
78 78
@@ -92,7 +92,7 @@ static __inline__ void __change_bit(int nr, volatile void * addr)
92{ 92{
93 __asm__ __volatile__( 93 __asm__ __volatile__(
94 "btcl %1,%0" 94 "btcl %1,%0"
95 :"=m" (ADDR) 95 :"+m" (ADDR)
96 :"dIr" (nr)); 96 :"dIr" (nr));
97} 97}
98 98
@@ -109,7 +109,7 @@ static __inline__ void change_bit(int nr, volatile void * addr)
109{ 109{
110 __asm__ __volatile__( LOCK_PREFIX 110 __asm__ __volatile__( LOCK_PREFIX
111 "btcl %1,%0" 111 "btcl %1,%0"
112 :"=m" (ADDR) 112 :"+m" (ADDR)
113 :"dIr" (nr)); 113 :"dIr" (nr));
114} 114}
115 115
@@ -127,7 +127,7 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr)
127 127
128 __asm__ __volatile__( LOCK_PREFIX 128 __asm__ __volatile__( LOCK_PREFIX
129 "btsl %2,%1\n\tsbbl %0,%0" 129 "btsl %2,%1\n\tsbbl %0,%0"
130 :"=r" (oldbit),"=m" (ADDR) 130 :"=r" (oldbit),"+m" (ADDR)
131 :"dIr" (nr) : "memory"); 131 :"dIr" (nr) : "memory");
132 return oldbit; 132 return oldbit;
133} 133}
@@ -147,7 +147,7 @@ static __inline__ int __test_and_set_bit(int nr, volatile void * addr)
147 147
148 __asm__( 148 __asm__(
149 "btsl %2,%1\n\tsbbl %0,%0" 149 "btsl %2,%1\n\tsbbl %0,%0"
150 :"=r" (oldbit),"=m" (ADDR) 150 :"=r" (oldbit),"+m" (ADDR)
151 :"dIr" (nr)); 151 :"dIr" (nr));
152 return oldbit; 152 return oldbit;
153} 153}
@@ -166,7 +166,7 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
166 166
167 __asm__ __volatile__( LOCK_PREFIX 167 __asm__ __volatile__( LOCK_PREFIX
168 "btrl %2,%1\n\tsbbl %0,%0" 168 "btrl %2,%1\n\tsbbl %0,%0"
169 :"=r" (oldbit),"=m" (ADDR) 169 :"=r" (oldbit),"+m" (ADDR)
170 :"dIr" (nr) : "memory"); 170 :"dIr" (nr) : "memory");
171 return oldbit; 171 return oldbit;
172} 172}
@@ -186,7 +186,7 @@ static __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
186 186
187 __asm__( 187 __asm__(
188 "btrl %2,%1\n\tsbbl %0,%0" 188 "btrl %2,%1\n\tsbbl %0,%0"
189 :"=r" (oldbit),"=m" (ADDR) 189 :"=r" (oldbit),"+m" (ADDR)
190 :"dIr" (nr)); 190 :"dIr" (nr));
191 return oldbit; 191 return oldbit;
192} 192}
@@ -198,7 +198,7 @@ static __inline__ int __test_and_change_bit(int nr, volatile void * addr)
198 198
199 __asm__ __volatile__( 199 __asm__ __volatile__(
200 "btcl %2,%1\n\tsbbl %0,%0" 200 "btcl %2,%1\n\tsbbl %0,%0"
201 :"=r" (oldbit),"=m" (ADDR) 201 :"=r" (oldbit),"+m" (ADDR)
202 :"dIr" (nr) : "memory"); 202 :"dIr" (nr) : "memory");
203 return oldbit; 203 return oldbit;
204} 204}
@@ -217,7 +217,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
217 217
218 __asm__ __volatile__( LOCK_PREFIX 218 __asm__ __volatile__( LOCK_PREFIX
219 "btcl %2,%1\n\tsbbl %0,%0" 219 "btcl %2,%1\n\tsbbl %0,%0"
220 :"=r" (oldbit),"=m" (ADDR) 220 :"=r" (oldbit),"+m" (ADDR)
221 :"dIr" (nr) : "memory"); 221 :"dIr" (nr) : "memory");
222 return oldbit; 222 return oldbit;
223} 223}
@@ -340,6 +340,20 @@ static __inline__ unsigned long __ffs(unsigned long word)
340 return word; 340 return word;
341} 341}
342 342
343/*
344 * __fls: find last bit set.
345 * @word: The word to search
346 *
347 * Undefined if no zero exists, so code should check against ~0UL first.
348 */
349static __inline__ unsigned long __fls(unsigned long word)
350{
351 __asm__("bsrq %1,%0"
352 :"=r" (word)
353 :"rm" (word));
354 return word;
355}
356
343#ifdef __KERNEL__ 357#ifdef __KERNEL__
344 358
345static inline int sched_find_first_bit(const unsigned long *b) 359static inline int sched_find_first_bit(const unsigned long *b)
@@ -370,6 +384,35 @@ static __inline__ int ffs(int x)
370} 384}
371 385
372/** 386/**
387 * fls64 - find last bit set in 64 bit word
388 * @x: the word to search
389 *
390 * This is defined the same way as fls.
391 */
392static __inline__ int fls64(__u64 x)
393{
394 if (x == 0)
395 return 0;
396 return __fls(x) + 1;
397}
398
399/**
400 * fls - find last bit set
401 * @x: the word to search
402 *
403 * This is defined the same way as ffs.
404 */
405static __inline__ int fls(int x)
406{
407 int r;
408
409 __asm__("bsrl %1,%0\n\t"
410 "cmovzl %2,%0"
411 : "=&r" (r) : "rm" (x), "rm" (-1));
412 return r+1;
413}
414
415/**
373 * hweightN - returns the hamming weight of a N-bit word 416 * hweightN - returns the hamming weight of a N-bit word
374 * @x: the word to weigh 417 * @x: the word to weigh
375 * 418 *
@@ -407,9 +450,6 @@ static __inline__ int ffs(int x)
407#define minix_find_first_zero_bit(addr,size) \ 450#define minix_find_first_zero_bit(addr,size) \
408 find_first_zero_bit((void*)addr,size) 451 find_first_zero_bit((void*)addr,size)
409 452
410/* find last set bit */
411#define fls(x) generic_fls(x)
412
413#endif /* __KERNEL__ */ 453#endif /* __KERNEL__ */
414 454
415#endif /* _X86_64_BITOPS_H */ 455#endif /* _X86_64_BITOPS_H */
diff --git a/include/asm-x86_64/cache.h b/include/asm-x86_64/cache.h
index 33e53424128b..263f0a211ed7 100644
--- a/include/asm-x86_64/cache.h
+++ b/include/asm-x86_64/cache.h
@@ -9,6 +9,17 @@
9/* L1 cache line size */ 9/* L1 cache line size */
10#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT) 10#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
11#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 11#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
12#define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */ 12
13#ifdef CONFIG_X86_VSMP
14
15/* vSMP Internode cacheline shift */
16#define INTERNODE_CACHE_SHIFT (12)
17#ifdef CONFIG_SMP
18#define __cacheline_aligned_in_smp \
19 __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT)))) \
20 __attribute__((__section__(".data.page_aligned")))
21#endif
22
23#endif
13 24
14#endif 25#endif
diff --git a/include/asm-x86_64/cacheflush.h b/include/asm-x86_64/cacheflush.h
index b3189fb229d1..d32f7f58752a 100644
--- a/include/asm-x86_64/cacheflush.h
+++ b/include/asm-x86_64/cacheflush.h
@@ -27,4 +27,8 @@ void global_flush_tlb(void);
27int change_page_attr(struct page *page, int numpages, pgprot_t prot); 27int change_page_attr(struct page *page, int numpages, pgprot_t prot);
28int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot); 28int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot);
29 29
30#ifdef CONFIG_DEBUG_RODATA
31void mark_rodata_ro(void);
32#endif
33
30#endif /* _X8664_CACHEFLUSH_H */ 34#endif /* _X8664_CACHEFLUSH_H */
diff --git a/include/asm-x86_64/compat.h b/include/asm-x86_64/compat.h
index f0155c38f639..b37ab8218ef0 100644
--- a/include/asm-x86_64/compat.h
+++ b/include/asm-x86_64/compat.h
@@ -198,8 +198,13 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
198 198
199static __inline__ void __user *compat_alloc_user_space(long len) 199static __inline__ void __user *compat_alloc_user_space(long len)
200{ 200{
201 struct pt_regs *regs = (void *)current->thread.rsp0 - sizeof(struct pt_regs); 201 struct pt_regs *regs = task_pt_regs(current);
202 return (void __user *)regs->rsp - len; 202 return (void __user *)regs->rsp - len;
203} 203}
204 204
205static inline int is_compat_task(void)
206{
207 return current_thread_info()->status & TS_COMPAT;
208}
209
205#endif /* _ASM_X86_64_COMPAT_H */ 210#endif /* _ASM_X86_64_COMPAT_H */
diff --git a/include/asm-x86_64/cpufeature.h b/include/asm-x86_64/cpufeature.h
index aea308c65709..41c0ac8559be 100644
--- a/include/asm-x86_64/cpufeature.h
+++ b/include/asm-x86_64/cpufeature.h
@@ -61,8 +61,9 @@
61#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */ 61#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */
62#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */ 62#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */
63#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */ 63#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */
64#define X86_FEATURE_K8_C (3*32+ 4) /* C stepping K8 */ 64/* 4 free */
65#define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */ 65#define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */
66#define X86_FEATURE_SYNC_RDTSC (3*32+6) /* RDTSC syncs CPU core */
66 67
67/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 68/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
68#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 69#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h
index 33764869387b..eb7723a46790 100644
--- a/include/asm-x86_64/desc.h
+++ b/include/asm-x86_64/desc.h
@@ -25,7 +25,7 @@ struct n_desc_struct {
25 unsigned int a,b; 25 unsigned int a,b;
26}; 26};
27 27
28extern struct desc_struct cpu_gdt_table[NR_CPUS][GDT_ENTRIES]; 28extern struct desc_struct cpu_gdt_table[GDT_ENTRIES];
29 29
30enum { 30enum {
31 GATE_INTERRUPT = 0xE, 31 GATE_INTERRUPT = 0xE,
@@ -79,6 +79,9 @@ extern struct desc_struct default_ldt[];
79extern struct gate_struct idt_table[]; 79extern struct gate_struct idt_table[];
80extern struct desc_ptr cpu_gdt_descr[]; 80extern struct desc_ptr cpu_gdt_descr[];
81 81
82/* the cpu gdt accessor */
83#define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address)
84
82static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) 85static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist)
83{ 86{
84 struct gate_struct s; 87 struct gate_struct s;
@@ -114,6 +117,11 @@ static inline void set_system_gate(int nr, void *func)
114 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, 0); 117 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, 0);
115} 118}
116 119
120static inline void set_system_gate_ist(int nr, void *func, unsigned ist)
121{
122 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist);
123}
124
117static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, 125static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type,
118 unsigned size) 126 unsigned size)
119{ 127{
@@ -139,20 +147,20 @@ static inline void set_tss_desc(unsigned cpu, void *addr)
139 * -1? seg base+limit should be pointing to the address of the 147 * -1? seg base+limit should be pointing to the address of the
140 * last valid byte 148 * last valid byte
141 */ 149 */
142 set_tssldt_descriptor(&cpu_gdt_table[cpu][GDT_ENTRY_TSS], 150 set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_TSS],
143 (unsigned long)addr, DESC_TSS, 151 (unsigned long)addr, DESC_TSS,
144 IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1); 152 IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1);
145} 153}
146 154
147static inline void set_ldt_desc(unsigned cpu, void *addr, int size) 155static inline void set_ldt_desc(unsigned cpu, void *addr, int size)
148{ 156{
149 set_tssldt_descriptor(&cpu_gdt_table[cpu][GDT_ENTRY_LDT], (unsigned long)addr, 157 set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_LDT], (unsigned long)addr,
150 DESC_LDT, size * 8 - 1); 158 DESC_LDT, size * 8 - 1);
151} 159}
152 160
153static inline void set_seg_base(unsigned cpu, int entry, void *base) 161static inline void set_seg_base(unsigned cpu, int entry, void *base)
154{ 162{
155 struct desc_struct *d = &cpu_gdt_table[cpu][entry]; 163 struct desc_struct *d = &cpu_gdt(cpu)[entry];
156 u32 addr = (u32)(u64)base; 164 u32 addr = (u32)(u64)base;
157 BUG_ON((u64)base >> 32); 165 BUG_ON((u64)base >> 32);
158 d->base0 = addr & 0xffff; 166 d->base0 = addr & 0xffff;
@@ -194,7 +202,7 @@ static inline void set_seg_base(unsigned cpu, int entry, void *base)
194 202
195static inline void load_TLS(struct thread_struct *t, unsigned int cpu) 203static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
196{ 204{
197 u64 *gdt = (u64 *)(cpu_gdt_table[cpu] + GDT_ENTRY_TLS_MIN); 205 u64 *gdt = (u64 *)(cpu_gdt(cpu) + GDT_ENTRY_TLS_MIN);
198 gdt[0] = t->tls_array[0]; 206 gdt[0] = t->tls_array[0];
199 gdt[1] = t->tls_array[1]; 207 gdt[1] = t->tls_array[1];
200 gdt[2] = t->tls_array[2]; 208 gdt[2] = t->tls_array[2];
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index 36d16dfbac88..49a81a66516e 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -12,155 +12,176 @@
12#include <asm/io.h> 12#include <asm/io.h>
13#include <asm/swiotlb.h> 13#include <asm/swiotlb.h>
14 14
15extern dma_addr_t bad_dma_address; 15struct dma_mapping_ops {
16#define dma_mapping_error(x) \ 16 int (*mapping_error)(dma_addr_t dma_addr);
17 (swiotlb ? swiotlb_dma_mapping_error(x) : ((x) == bad_dma_address)) 17 void* (*alloc_coherent)(struct device *dev, size_t size,
18 18 dma_addr_t *dma_handle, gfp_t gfp);
19void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 19 void (*free_coherent)(struct device *dev, size_t size,
20 gfp_t gfp); 20 void *vaddr, dma_addr_t dma_handle);
21void dma_free_coherent(struct device *dev, size_t size, void *vaddr, 21 dma_addr_t (*map_single)(struct device *hwdev, void *ptr,
22 dma_addr_t dma_handle); 22 size_t size, int direction);
23 /* like map_single, but doesn't check the device mask */
24 dma_addr_t (*map_simple)(struct device *hwdev, char *ptr,
25 size_t size, int direction);
26 void (*unmap_single)(struct device *dev, dma_addr_t addr,
27 size_t size, int direction);
28 void (*sync_single_for_cpu)(struct device *hwdev,
29 dma_addr_t dma_handle, size_t size,
30 int direction);
31 void (*sync_single_for_device)(struct device *hwdev,
32 dma_addr_t dma_handle, size_t size,
33 int direction);
34 void (*sync_single_range_for_cpu)(struct device *hwdev,
35 dma_addr_t dma_handle, unsigned long offset,
36 size_t size, int direction);
37 void (*sync_single_range_for_device)(struct device *hwdev,
38 dma_addr_t dma_handle, unsigned long offset,
39 size_t size, int direction);
40 void (*sync_sg_for_cpu)(struct device *hwdev,
41 struct scatterlist *sg, int nelems,
42 int direction);
43 void (*sync_sg_for_device)(struct device *hwdev,
44 struct scatterlist *sg, int nelems,
45 int direction);
46 int (*map_sg)(struct device *hwdev, struct scatterlist *sg,
47 int nents, int direction);
48 void (*unmap_sg)(struct device *hwdev,
49 struct scatterlist *sg, int nents,
50 int direction);
51 int (*dma_supported)(struct device *hwdev, u64 mask);
52 int is_phys;
53};
23 54
24#ifdef CONFIG_GART_IOMMU 55extern dma_addr_t bad_dma_address;
56extern struct dma_mapping_ops* dma_ops;
57extern int iommu_merge;
25 58
26extern dma_addr_t dma_map_single(struct device *hwdev, void *ptr, size_t size, 59static inline int dma_mapping_error(dma_addr_t dma_addr)
27 int direction); 60{
28extern void dma_unmap_single(struct device *dev, dma_addr_t addr,size_t size, 61 if (dma_ops->mapping_error)
29 int direction); 62 return dma_ops->mapping_error(dma_addr);
30 63
31#else 64 return (dma_addr == bad_dma_address);
65}
32 66
33/* No IOMMU */ 67extern void *dma_alloc_coherent(struct device *dev, size_t size,
68 dma_addr_t *dma_handle, gfp_t gfp);
69extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
70 dma_addr_t dma_handle);
34 71
35static inline dma_addr_t dma_map_single(struct device *hwdev, void *ptr, 72static inline dma_addr_t
36 size_t size, int direction) 73dma_map_single(struct device *hwdev, void *ptr, size_t size,
74 int direction)
37{ 75{
38 dma_addr_t addr; 76 return dma_ops->map_single(hwdev, ptr, size, direction);
39
40 if (direction == DMA_NONE)
41 out_of_line_bug();
42 addr = virt_to_bus(ptr);
43
44 if ((addr+size) & ~*hwdev->dma_mask)
45 out_of_line_bug();
46 return addr;
47} 77}
48 78
49static inline void dma_unmap_single(struct device *hwdev, dma_addr_t dma_addr, 79static inline void
50 size_t size, int direction) 80dma_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
81 int direction)
51{ 82{
52 if (direction == DMA_NONE) 83 dma_ops->unmap_single(dev, addr, size, direction);
53 out_of_line_bug();
54 /* Nothing to do */
55} 84}
56 85
57#endif
58
59#define dma_map_page(dev,page,offset,size,dir) \ 86#define dma_map_page(dev,page,offset,size,dir) \
60 dma_map_single((dev), page_address(page)+(offset), (size), (dir)) 87 dma_map_single((dev), page_address(page)+(offset), (size), (dir))
61 88
62static inline void dma_sync_single_for_cpu(struct device *hwdev, 89#define dma_unmap_page dma_unmap_single
63 dma_addr_t dma_handle,
64 size_t size, int direction)
65{
66 if (direction == DMA_NONE)
67 out_of_line_bug();
68
69 if (swiotlb)
70 return swiotlb_sync_single_for_cpu(hwdev,dma_handle,size,direction);
71 90
91static inline void
92dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
93 size_t size, int direction)
94{
95 if (dma_ops->sync_single_for_cpu)
96 dma_ops->sync_single_for_cpu(hwdev, dma_handle, size,
97 direction);
72 flush_write_buffers(); 98 flush_write_buffers();
73} 99}
74 100
75static inline void dma_sync_single_for_device(struct device *hwdev, 101static inline void
76 dma_addr_t dma_handle, 102dma_sync_single_for_device(struct device *hwdev, dma_addr_t dma_handle,
77 size_t size, int direction) 103 size_t size, int direction)
78{ 104{
79 if (direction == DMA_NONE) 105 if (dma_ops->sync_single_for_device)
80 out_of_line_bug(); 106 dma_ops->sync_single_for_device(hwdev, dma_handle, size,
81 107 direction);
82 if (swiotlb)
83 return swiotlb_sync_single_for_device(hwdev,dma_handle,size,direction);
84
85 flush_write_buffers(); 108 flush_write_buffers();
86} 109}
87 110
88static inline void dma_sync_single_range_for_cpu(struct device *hwdev, 111static inline void
89 dma_addr_t dma_handle, 112dma_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
90 unsigned long offset, 113 unsigned long offset, size_t size, int direction)
91 size_t size, int direction)
92{ 114{
93 if (direction == DMA_NONE) 115 if (dma_ops->sync_single_range_for_cpu) {
94 out_of_line_bug(); 116 dma_ops->sync_single_range_for_cpu(hwdev, dma_handle, offset, size, direction);
95 117 }
96 if (swiotlb)
97 return swiotlb_sync_single_range_for_cpu(hwdev,dma_handle,offset,size,direction);
98 118
99 flush_write_buffers(); 119 flush_write_buffers();
100} 120}
101 121
102static inline void dma_sync_single_range_for_device(struct device *hwdev, 122static inline void
103 dma_addr_t dma_handle, 123dma_sync_single_range_for_device(struct device *hwdev, dma_addr_t dma_handle,
104 unsigned long offset, 124 unsigned long offset, size_t size, int direction)
105 size_t size, int direction)
106{ 125{
107 if (direction == DMA_NONE) 126 if (dma_ops->sync_single_range_for_device)
108 out_of_line_bug(); 127 dma_ops->sync_single_range_for_device(hwdev, dma_handle,
109 128 offset, size, direction);
110 if (swiotlb)
111 return swiotlb_sync_single_range_for_device(hwdev,dma_handle,offset,size,direction);
112 129
113 flush_write_buffers(); 130 flush_write_buffers();
114} 131}
115 132
116static inline void dma_sync_sg_for_cpu(struct device *hwdev, 133static inline void
117 struct scatterlist *sg, 134dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
118 int nelems, int direction) 135 int nelems, int direction)
119{ 136{
120 if (direction == DMA_NONE) 137 if (dma_ops->sync_sg_for_cpu)
121 out_of_line_bug(); 138 dma_ops->sync_sg_for_cpu(hwdev, sg, nelems, direction);
122
123 if (swiotlb)
124 return swiotlb_sync_sg_for_cpu(hwdev,sg,nelems,direction);
125
126 flush_write_buffers(); 139 flush_write_buffers();
127} 140}
128 141
129static inline void dma_sync_sg_for_device(struct device *hwdev, 142static inline void
130 struct scatterlist *sg, 143dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
131 int nelems, int direction) 144 int nelems, int direction)
132{ 145{
133 if (direction == DMA_NONE) 146 if (dma_ops->sync_sg_for_device) {
134 out_of_line_bug(); 147 dma_ops->sync_sg_for_device(hwdev, sg, nelems, direction);
135 148 }
136 if (swiotlb)
137 return swiotlb_sync_sg_for_device(hwdev,sg,nelems,direction);
138 149
139 flush_write_buffers(); 150 flush_write_buffers();
140} 151}
141 152
142extern int dma_map_sg(struct device *hwdev, struct scatterlist *sg, 153static inline int
143 int nents, int direction); 154dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, int direction)
144extern void dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, 155{
145 int nents, int direction); 156 return dma_ops->map_sg(hwdev, sg, nents, direction);
157}
146 158
147#define dma_unmap_page dma_unmap_single 159static inline void
160dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
161 int direction)
162{
163 dma_ops->unmap_sg(hwdev, sg, nents, direction);
164}
148 165
149extern int dma_supported(struct device *hwdev, u64 mask); 166extern int dma_supported(struct device *hwdev, u64 mask);
150extern int dma_get_cache_alignment(void);
151#define dma_is_consistent(h) 1
152 167
153static inline int dma_set_mask(struct device *dev, u64 mask) 168/* same for gart, swiotlb, and nommu */
169static inline int dma_get_cache_alignment(void)
154{ 170{
155 if (!dev->dma_mask || !dma_supported(dev, mask)) 171 return boot_cpu_data.x86_clflush_size;
156 return -EIO;
157 *dev->dma_mask = mask;
158 return 0;
159} 172}
160 173
161static inline void dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction dir) 174#define dma_is_consistent(h) 1
175
176extern int dma_set_mask(struct device *dev, u64 mask);
177
178static inline void
179dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction dir)
162{ 180{
163 flush_write_buffers(); 181 flush_write_buffers();
164} 182}
165 183
166#endif 184extern struct device fallback_dev;
185extern int panic_on_overflow;
186
187#endif /* _X8664_DMA_MAPPING_H */
diff --git a/include/asm-x86_64/dwarf2.h b/include/asm-x86_64/dwarf2.h
index 582757fc0365..07654bd155bf 100644
--- a/include/asm-x86_64/dwarf2.h
+++ b/include/asm-x86_64/dwarf2.h
@@ -14,7 +14,7 @@
14 away for older version. 14 away for older version.
15 */ 15 */
16 16
17#ifdef CONFIG_DEBUG_INFO 17#ifdef CONFIG_UNWIND_INFO
18 18
19#define CFI_STARTPROC .cfi_startproc 19#define CFI_STARTPROC .cfi_startproc
20#define CFI_ENDPROC .cfi_endproc 20#define CFI_ENDPROC .cfi_endproc
@@ -28,6 +28,7 @@
28#define CFI_RESTORE .cfi_restore 28#define CFI_RESTORE .cfi_restore
29#define CFI_REMEMBER_STATE .cfi_remember_state 29#define CFI_REMEMBER_STATE .cfi_remember_state
30#define CFI_RESTORE_STATE .cfi_restore_state 30#define CFI_RESTORE_STATE .cfi_restore_state
31#define CFI_UNDEFINED .cfi_undefined
31 32
32#else 33#else
33 34
@@ -44,6 +45,7 @@
44#define CFI_RESTORE # 45#define CFI_RESTORE #
45#define CFI_REMEMBER_STATE # 46#define CFI_REMEMBER_STATE #
46#define CFI_RESTORE_STATE # 47#define CFI_RESTORE_STATE #
48#define CFI_UNDEFINED #
47 49
48#endif 50#endif
49 51
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h
index e682edc24a68..8dcc32665240 100644
--- a/include/asm-x86_64/e820.h
+++ b/include/asm-x86_64/e820.h
@@ -55,6 +55,7 @@ extern unsigned long e820_hole_size(unsigned long start_pfn,
55 unsigned long end_pfn); 55 unsigned long end_pfn);
56 56
57extern void __init parse_memopt(char *p, char **end); 57extern void __init parse_memopt(char *p, char **end);
58extern void __init parse_memmapopt(char *p, char **end);
58 59
59extern struct e820map e820; 60extern struct e820map e820;
60#endif/*!__ASSEMBLY__*/ 61#endif/*!__ASSEMBLY__*/
diff --git a/include/asm-x86_64/gart-mapping.h b/include/asm-x86_64/gart-mapping.h
new file mode 100644
index 000000000000..ada497b0b55b
--- /dev/null
+++ b/include/asm-x86_64/gart-mapping.h
@@ -0,0 +1,16 @@
1#ifndef _X8664_GART_MAPPING_H
2#define _X8664_GART_MAPPING_H 1
3
4#include <linux/types.h>
5#include <asm/types.h>
6
7struct device;
8
9extern void*
10gart_alloc_coherent(struct device *dev, size_t size,
11 dma_addr_t *dma_handle, gfp_t gfp);
12
13extern int
14gart_dma_supported(struct device *hwdev, u64 mask);
15
16#endif /* _X8664_GART_MAPPING_H */
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index c14a8c7267a6..0df1715dee71 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -46,18 +46,18 @@ struct hw_interrupt_type;
46 * some of the following vectors are 'rare', they are merged 46 * some of the following vectors are 'rare', they are merged
47 * into a single vector (CALL_FUNCTION_VECTOR) to save vector space. 47 * into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
48 * TLB, reschedule and local APIC vectors are performance-critical. 48 * TLB, reschedule and local APIC vectors are performance-critical.
49 *
50 * Vectors 0xf0-0xf9 are free (reserved for future Linux use).
51 */ 49 */
52#define SPURIOUS_APIC_VECTOR 0xff 50#define SPURIOUS_APIC_VECTOR 0xff
53#define ERROR_APIC_VECTOR 0xfe 51#define ERROR_APIC_VECTOR 0xfe
54#define RESCHEDULE_VECTOR 0xfd 52#define RESCHEDULE_VECTOR 0xfd
55#define CALL_FUNCTION_VECTOR 0xfc 53#define CALL_FUNCTION_VECTOR 0xfc
56#define KDB_VECTOR 0xfb /* reserved for KDB */ 54/* fb free - please don't readd KDB here because it's useless
55 (hint - think what a NMI bit does to a vector) */
57#define THERMAL_APIC_VECTOR 0xfa 56#define THERMAL_APIC_VECTOR 0xfa
58#define THRESHOLD_APIC_VECTOR 0xf9 57#define THRESHOLD_APIC_VECTOR 0xf9
59#define INVALIDATE_TLB_VECTOR_END 0xf8 58/* f8 free */
60#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f8 used for TLB flush */ 59#define INVALIDATE_TLB_VECTOR_END 0xf7
60#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */
61 61
62#define NUM_INVALIDATE_TLB_VECTORS 8 62#define NUM_INVALIDATE_TLB_VECTORS 8
63 63
diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h
index aa39cfd0e001..876eb9a2fe78 100644
--- a/include/asm-x86_64/i387.h
+++ b/include/asm-x86_64/i387.h
@@ -30,7 +30,7 @@ extern int save_i387(struct _fpstate __user *buf);
30 */ 30 */
31 31
32#define unlazy_fpu(tsk) do { \ 32#define unlazy_fpu(tsk) do { \
33 if ((tsk)->thread_info->status & TS_USEDFPU) \ 33 if (task_thread_info(tsk)->status & TS_USEDFPU) \
34 save_init_fpu(tsk); \ 34 save_init_fpu(tsk); \
35} while (0) 35} while (0)
36 36
@@ -46,9 +46,9 @@ static inline void tolerant_fwait(void)
46} 46}
47 47
48#define clear_fpu(tsk) do { \ 48#define clear_fpu(tsk) do { \
49 if ((tsk)->thread_info->status & TS_USEDFPU) { \ 49 if (task_thread_info(tsk)->status & TS_USEDFPU) { \
50 tolerant_fwait(); \ 50 tolerant_fwait(); \
51 (tsk)->thread_info->status &= ~TS_USEDFPU; \ 51 task_thread_info(tsk)->status &= ~TS_USEDFPU; \
52 stts(); \ 52 stts(); \
53 } \ 53 } \
54} while (0) 54} while (0)
@@ -75,7 +75,8 @@ extern int set_fpregs(struct task_struct *tsk,
75static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) 75static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
76{ 76{
77 int err; 77 int err;
78 asm volatile("1: rex64 ; fxrstor (%[fx])\n\t" 78
79 asm volatile("1: rex64/fxrstor (%[fx])\n\t"
79 "2:\n" 80 "2:\n"
80 ".section .fixup,\"ax\"\n" 81 ".section .fixup,\"ax\"\n"
81 "3: movl $-1,%[err]\n" 82 "3: movl $-1,%[err]\n"
@@ -86,7 +87,11 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
86 " .quad 1b,3b\n" 87 " .quad 1b,3b\n"
87 ".previous" 88 ".previous"
88 : [err] "=r" (err) 89 : [err] "=r" (err)
89 : [fx] "r" (fx), "0" (0)); 90#if 0 /* See comment in __fxsave_clear() below. */
91 : [fx] "r" (fx), "m" (*fx), "0" (0));
92#else
93 : [fx] "cdaSDb" (fx), "m" (*fx), "0" (0));
94#endif
90 if (unlikely(err)) 95 if (unlikely(err))
91 init_fpu(current); 96 init_fpu(current);
92 return err; 97 return err;
@@ -95,7 +100,8 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
95static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) 100static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
96{ 101{
97 int err; 102 int err;
98 asm volatile("1: rex64 ; fxsave (%[fx])\n\t" 103
104 asm volatile("1: rex64/fxsave (%[fx])\n\t"
99 "2:\n" 105 "2:\n"
100 ".section .fixup,\"ax\"\n" 106 ".section .fixup,\"ax\"\n"
101 "3: movl $-1,%[err]\n" 107 "3: movl $-1,%[err]\n"
@@ -105,20 +111,53 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
105 " .align 8\n" 111 " .align 8\n"
106 " .quad 1b,3b\n" 112 " .quad 1b,3b\n"
107 ".previous" 113 ".previous"
108 : [err] "=r" (err) 114 : [err] "=r" (err), "=m" (*fx)
109 : [fx] "r" (fx), "0" (0)); 115#if 0 /* See comment in __fxsave_clear() below. */
116 : [fx] "r" (fx), "0" (0));
117#else
118 : [fx] "cdaSDb" (fx), "0" (0));
119#endif
110 if (unlikely(err)) 120 if (unlikely(err))
111 __clear_user(fx, sizeof(struct i387_fxsave_struct)); 121 __clear_user(fx, sizeof(struct i387_fxsave_struct));
112 return err; 122 return err;
113} 123}
114 124
125static inline void __fxsave_clear(struct task_struct *tsk)
126{
127 /* Using "rex64; fxsave %0" is broken because, if the memory operand
128 uses any extended registers for addressing, a second REX prefix
129 will be generated (to the assembler, rex64 followed by semicolon
130 is a separate instruction), and hence the 64-bitness is lost. */
131#if 0
132 /* Using "fxsaveq %0" would be the ideal choice, but is only supported
133 starting with gas 2.16. */
134 __asm__ __volatile__("fxsaveq %0"
135 : "=m" (tsk->thread.i387.fxsave));
136#elif 0
137 /* Using, as a workaround, the properly prefixed form below isn't
138 accepted by any binutils version so far released, complaining that
139 the same type of prefix is used twice if an extended register is
140 needed for addressing (fix submitted to mainline 2005-11-21). */
141 __asm__ __volatile__("rex64/fxsave %0"
142 : "=m" (tsk->thread.i387.fxsave));
143#else
144 /* This, however, we can work around by forcing the compiler to select
145 an addressing mode that doesn't require extended registers. */
146 __asm__ __volatile__("rex64/fxsave %P2(%1)"
147 : "=m" (tsk->thread.i387.fxsave)
148 : "cdaSDb" (tsk),
149 "i" (offsetof(__typeof__(*tsk),
150 thread.i387.fxsave)));
151#endif
152 __asm__ __volatile__("fnclex");
153}
154
115static inline void kernel_fpu_begin(void) 155static inline void kernel_fpu_begin(void)
116{ 156{
117 struct thread_info *me = current_thread_info(); 157 struct thread_info *me = current_thread_info();
118 preempt_disable(); 158 preempt_disable();
119 if (me->status & TS_USEDFPU) { 159 if (me->status & TS_USEDFPU) {
120 asm volatile("rex64 ; fxsave %0 ; fnclex" 160 __fxsave_clear(me->task);
121 : "=m" (me->task->thread.i387.fxsave));
122 me->status &= ~TS_USEDFPU; 161 me->status &= ~TS_USEDFPU;
123 return; 162 return;
124 } 163 }
@@ -131,11 +170,10 @@ static inline void kernel_fpu_end(void)
131 preempt_enable(); 170 preempt_enable();
132} 171}
133 172
134static inline void save_init_fpu( struct task_struct *tsk ) 173static inline void save_init_fpu(struct task_struct *tsk)
135{ 174{
136 asm volatile( "rex64 ; fxsave %0 ; fnclex" 175 __fxsave_clear(tsk);
137 : "=m" (tsk->thread.i387.fxsave)); 176 task_thread_info(tsk)->status &= ~TS_USEDFPU;
138 tsk->thread_info->status &= ~TS_USEDFPU;
139 stts(); 177 stts();
140} 178}
141 179
diff --git a/include/asm-x86_64/ia32_unistd.h b/include/asm-x86_64/ia32_unistd.h
index d5166ec3868d..e8843362a6cc 100644
--- a/include/asm-x86_64/ia32_unistd.h
+++ b/include/asm-x86_64/ia32_unistd.h
@@ -299,7 +299,8 @@
299#define __NR_ia32_inotify_init 291 299#define __NR_ia32_inotify_init 291
300#define __NR_ia32_inotify_add_watch 292 300#define __NR_ia32_inotify_add_watch 292
301#define __NR_ia32_inotify_rm_watch 293 301#define __NR_ia32_inotify_rm_watch 293
302#define __NR_ia32_migrate_pages 294
302 303
303#define IA32_NR_syscalls 294 /* must be > than biggest syscall! */ 304#define IA32_NR_syscalls 295 /* must be > than biggest syscall! */
304 305
305#endif /* _ASM_X86_64_IA32_UNISTD_H_ */ 306#endif /* _ASM_X86_64_IA32_UNISTD_H_ */
diff --git a/include/asm-x86_64/idle.h b/include/asm-x86_64/idle.h
new file mode 100644
index 000000000000..6bd47dcf2067
--- /dev/null
+++ b/include/asm-x86_64/idle.h
@@ -0,0 +1,14 @@
1#ifndef _ASM_X86_64_IDLE_H
2#define _ASM_X86_64_IDLE_H 1
3
4#define IDLE_START 1
5#define IDLE_END 2
6
7struct notifier_block;
8void idle_notifier_register(struct notifier_block *n);
9void idle_notifier_unregister(struct notifier_block *n);
10
11void enter_idle(void);
12void exit_idle(void);
13
14#endif
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index 52ff269fe054..9dac18db8291 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -143,6 +143,11 @@ static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
143extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); 143extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
144extern void iounmap(volatile void __iomem *addr); 144extern void iounmap(volatile void __iomem *addr);
145 145
146/* Use normal IO mappings for DMI */
147#define dmi_ioremap ioremap
148#define dmi_iounmap(x,l) iounmap(x)
149#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
150
146/* 151/*
147 * ISA I/O bus memory addresses are 1:1 with the physical address. 152 * ISA I/O bus memory addresses are 1:1 with the physical address.
148 */ 153 */
diff --git a/include/asm-x86_64/ioctl.h b/include/asm-x86_64/ioctl.h
index 609b663b6bf4..b279fe06dfe5 100644
--- a/include/asm-x86_64/ioctl.h
+++ b/include/asm-x86_64/ioctl.h
@@ -1,75 +1 @@
1/* $Id: ioctl.h,v 1.2 2001/07/04 09:08:13 ak Exp $ #include <asm-generic/ioctl.h>
2 *
3 * linux/ioctl.h for Linux by H.H. Bergman.
4 */
5
6#ifndef _ASMX8664_IOCTL_H
7#define _ASMX8664_IOCTL_H
8
9/* ioctl command encoding: 32 bits total, command in lower 16 bits,
10 * size of the parameter structure in the lower 14 bits of the
11 * upper 16 bits.
12 * Encoding the size of the parameter structure in the ioctl request
13 * is useful for catching programs compiled with old versions
14 * and to avoid overwriting user space outside the user buffer area.
15 * The highest 2 bits are reserved for indicating the ``access mode''.
16 * NOTE: This limits the max parameter size to 16kB -1 !
17 */
18
19/*
20 * The following is for compatibility across the various Linux
21 * platforms. The i386 ioctl numbering scheme doesn't really enforce
22 * a type field. De facto, however, the top 8 bits of the lower 16
23 * bits are indeed used as a type field, so we might just as well make
24 * this explicit here. Please be sure to use the decoding macros
25 * below from now on.
26 */
27#define _IOC_NRBITS 8
28#define _IOC_TYPEBITS 8
29#define _IOC_SIZEBITS 14
30#define _IOC_DIRBITS 2
31
32#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
33#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
34#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
35#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
36
37#define _IOC_NRSHIFT 0
38#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
39#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
40#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
41
42/*
43 * Direction bits.
44 */
45#define _IOC_NONE 0U
46#define _IOC_WRITE 1U
47#define _IOC_READ 2U
48
49#define _IOC(dir,type,nr,size) \
50 (((dir) << _IOC_DIRSHIFT) | \
51 ((type) << _IOC_TYPESHIFT) | \
52 ((nr) << _IOC_NRSHIFT) | \
53 ((size) << _IOC_SIZESHIFT))
54
55/* used to create numbers */
56#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
57#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
58#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
59#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
60
61/* used to decode ioctl numbers.. */
62#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
63#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
64#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
65#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
66
67/* ...and for the drivers/sound files... */
68
69#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
70#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
71#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
72#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
73#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
74
75#endif /* _ASMX8664_IOCTL_H */
diff --git a/include/asm-x86_64/ipi.h b/include/asm-x86_64/ipi.h
index 022e9d340ad7..2a5c162b7d92 100644
--- a/include/asm-x86_64/ipi.h
+++ b/include/asm-x86_64/ipi.h
@@ -38,10 +38,6 @@ static inline unsigned int __prepare_ICR (unsigned int shortcut, int vector, uns
38 icr |= APIC_DM_FIXED | vector; 38 icr |= APIC_DM_FIXED | vector;
39 break; 39 break;
40 case NMI_VECTOR: 40 case NMI_VECTOR:
41 /*
42 * Setup KDB IPI to be delivered as an NMI
43 */
44 case KDB_VECTOR:
45 icr |= APIC_DM_NMI; 41 icr |= APIC_DM_NMI;
46 break; 42 break;
47 } 43 }
diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h
index f604e84c5303..b9ed4c0c8783 100644
--- a/include/asm-x86_64/kdebug.h
+++ b/include/asm-x86_64/kdebug.h
@@ -35,9 +35,16 @@ enum die_val {
35 DIE_PAGE_FAULT, 35 DIE_PAGE_FAULT,
36}; 36};
37 37
38static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap, int sig) 38static inline int notify_die(enum die_val val, const char *str,
39{ 39 struct pt_regs *regs, long err, int trap, int sig)
40 struct die_args args = { .regs=regs, .str=str, .err=err, .trapnr=trap,.signr=sig }; 40{
41 struct die_args args = {
42 .regs = regs,
43 .str = str,
44 .err = err,
45 .trapnr = trap,
46 .signr = sig
47 };
41 return notifier_call_chain(&die_chain, val, &args); 48 return notifier_call_chain(&die_chain, val, &args);
42} 49}
43 50
diff --git a/include/asm-x86_64/kexec.h b/include/asm-x86_64/kexec.h
index 42d2ff15c592..ae28cd44bcd3 100644
--- a/include/asm-x86_64/kexec.h
+++ b/include/asm-x86_64/kexec.h
@@ -3,6 +3,7 @@
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5#include <asm/proto.h> 5#include <asm/proto.h>
6#include <asm/ptrace.h>
6 7
7/* 8/*
8 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. 9 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
@@ -26,8 +27,40 @@
26#define KEXEC_ARCH KEXEC_ARCH_X86_64 27#define KEXEC_ARCH KEXEC_ARCH_X86_64
27 28
28#define MAX_NOTE_BYTES 1024 29#define MAX_NOTE_BYTES 1024
29typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
30 30
31extern note_buf_t crash_notes[]; 31/*
32 * Saving the registers of the cpu on which panic occured in
33 * crash_kexec to save a valid sp. The registers of other cpus
34 * will be saved in machine_crash_shutdown while shooting down them.
35 */
36
37static inline void crash_setup_regs(struct pt_regs *newregs,
38 struct pt_regs *oldregs)
39{
40 if (oldregs)
41 memcpy(newregs, oldregs, sizeof(*newregs));
42 else {
43 __asm__ __volatile__("movq %%rbx,%0" : "=m"(newregs->rbx));
44 __asm__ __volatile__("movq %%rcx,%0" : "=m"(newregs->rcx));
45 __asm__ __volatile__("movq %%rdx,%0" : "=m"(newregs->rdx));
46 __asm__ __volatile__("movq %%rsi,%0" : "=m"(newregs->rsi));
47 __asm__ __volatile__("movq %%rdi,%0" : "=m"(newregs->rdi));
48 __asm__ __volatile__("movq %%rbp,%0" : "=m"(newregs->rbp));
49 __asm__ __volatile__("movq %%rax,%0" : "=m"(newregs->rax));
50 __asm__ __volatile__("movq %%rsp,%0" : "=m"(newregs->rsp));
51 __asm__ __volatile__("movq %%r8,%0" : "=m"(newregs->r8));
52 __asm__ __volatile__("movq %%r9,%0" : "=m"(newregs->r9));
53 __asm__ __volatile__("movq %%r10,%0" : "=m"(newregs->r10));
54 __asm__ __volatile__("movq %%r11,%0" : "=m"(newregs->r11));
55 __asm__ __volatile__("movq %%r12,%0" : "=m"(newregs->r12));
56 __asm__ __volatile__("movq %%r13,%0" : "=m"(newregs->r13));
57 __asm__ __volatile__("movq %%r14,%0" : "=m"(newregs->r14));
58 __asm__ __volatile__("movq %%r15,%0" : "=m"(newregs->r15));
59 __asm__ __volatile__("movl %%ss, %%eax;" :"=a"(newregs->ss));
60 __asm__ __volatile__("movl %%cs, %%eax;" :"=a"(newregs->cs));
61 __asm__ __volatile__("pushfq; popq %0" :"=m"(newregs->eflags));
32 62
63 newregs->rip = (unsigned long)current_text_addr();
64 }
65}
33#endif /* _X86_64_KEXEC_H */ 66#endif /* _X86_64_KEXEC_H */
diff --git a/include/asm-x86_64/kprobes.h b/include/asm-x86_64/kprobes.h
index 4dd7a7e148d4..98a1e95ddb98 100644
--- a/include/asm-x86_64/kprobes.h
+++ b/include/asm-x86_64/kprobes.h
@@ -27,7 +27,10 @@
27#include <linux/ptrace.h> 27#include <linux/ptrace.h>
28#include <linux/percpu.h> 28#include <linux/percpu.h>
29 29
30#define __ARCH_WANT_KPROBES_INSN_SLOT
31
30struct pt_regs; 32struct pt_regs;
33struct kprobe;
31 34
32typedef u8 kprobe_opcode_t; 35typedef u8 kprobe_opcode_t;
33#define BREAKPOINT_INSTRUCTION 0xcc 36#define BREAKPOINT_INSTRUCTION 0xcc
@@ -42,6 +45,7 @@ typedef u8 kprobe_opcode_t;
42#define ARCH_SUPPORTS_KRETPROBES 45#define ARCH_SUPPORTS_KRETPROBES
43 46
44void kretprobe_trampoline(void); 47void kretprobe_trampoline(void);
48extern void arch_remove_kprobe(struct kprobe *p);
45 49
46/* Architecture specific copy of original instruction*/ 50/* Architecture specific copy of original instruction*/
47struct arch_specific_insn { 51struct arch_specific_insn {
diff --git a/include/asm-x86_64/mman.h b/include/asm-x86_64/mman.h
index 78e60a4fd4ee..d0e97b74f735 100644
--- a/include/asm-x86_64/mman.h
+++ b/include/asm-x86_64/mman.h
@@ -36,6 +36,7 @@
36#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 36#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
37#define MADV_WILLNEED 0x3 /* pre-fault pages */ 37#define MADV_WILLNEED 0x3 /* pre-fault pages */
38#define MADV_DONTNEED 0x4 /* discard these pages */ 38#define MADV_DONTNEED 0x4 /* discard these pages */
39#define MADV_REMOVE 0x5 /* remove these pages & resources */
39 40
40/* compatibility flags */ 41/* compatibility flags */
41#define MAP_ANON MAP_ANONYMOUS 42#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-x86_64/mmu_context.h b/include/asm-x86_64/mmu_context.h
index b630d52bdfb1..16e4be4de0c5 100644
--- a/include/asm-x86_64/mmu_context.h
+++ b/include/asm-x86_64/mmu_context.h
@@ -15,18 +15,13 @@
15int init_new_context(struct task_struct *tsk, struct mm_struct *mm); 15int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
16void destroy_context(struct mm_struct *mm); 16void destroy_context(struct mm_struct *mm);
17 17
18#ifdef CONFIG_SMP
19
20static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 18static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
21{ 19{
20#ifdef CONFIG_SMP
22 if (read_pda(mmu_state) == TLBSTATE_OK) 21 if (read_pda(mmu_state) == TLBSTATE_OK)
23 write_pda(mmu_state, TLBSTATE_LAZY); 22 write_pda(mmu_state, TLBSTATE_LAZY);
24}
25#else
26static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
27{
28}
29#endif 23#endif
24}
30 25
31static inline void load_cr3(pgd_t *pgd) 26static inline void load_cr3(pgd_t *pgd)
32{ 27{
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index 69baaa8a3ce0..972c9359f7d7 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -36,22 +36,12 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
36 NODE_DATA(nid)->node_spanned_pages) 36 NODE_DATA(nid)->node_spanned_pages)
37 37
38#ifdef CONFIG_DISCONTIGMEM 38#ifdef CONFIG_DISCONTIGMEM
39
40#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) 39#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
41#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr)) 40#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr))
42 41
43/* Requires pfn_valid(pfn) to be true */ 42extern struct page *pfn_to_page(unsigned long pfn);
44#define pfn_to_page(pfn) ({ \ 43extern unsigned long page_to_pfn(struct page *page);
45 int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT); \ 44extern int pfn_valid(unsigned long pfn);
46 ((pfn) - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map; \
47})
48
49#define page_to_pfn(page) \
50 (long)(((page) - page_zone(page)->zone_mem_map) + page_zone(page)->zone_start_pfn)
51
52#define pfn_valid(pfn) ((pfn) >= num_physpages ? 0 : \
53 ({ u8 nid__ = pfn_to_nid(pfn); \
54 nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) < node_end_pfn(nid__); }))
55#endif 45#endif
56 46
57#define local_mapnr(kvaddr) \ 47#define local_mapnr(kvaddr) \
diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h
index 6f8a17d105ab..10248a9a0582 100644
--- a/include/asm-x86_64/mpspec.h
+++ b/include/asm-x86_64/mpspec.h
@@ -76,7 +76,7 @@ struct mpc_config_bus
76{ 76{
77 unsigned char mpc_type; 77 unsigned char mpc_type;
78 unsigned char mpc_busid; 78 unsigned char mpc_busid;
79 unsigned char mpc_bustype[6] __attribute((packed)); 79 unsigned char mpc_bustype[6];
80}; 80};
81 81
82/* List of Bus Type string values, Intel MP Spec. */ 82/* List of Bus Type string values, Intel MP Spec. */
diff --git a/include/asm-x86_64/mutex.h b/include/asm-x86_64/mutex.h
new file mode 100644
index 000000000000..11fbee2bd6c0
--- /dev/null
+++ b/include/asm-x86_64/mutex.h
@@ -0,0 +1,113 @@
1/*
2 * Assembly implementation of the mutex fastpath, based on atomic
3 * decrement/increment.
4 *
5 * started by Ingo Molnar:
6 *
7 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
8 */
9#ifndef _ASM_MUTEX_H
10#define _ASM_MUTEX_H
11
12/**
13 * __mutex_fastpath_lock - decrement and call function if negative
14 * @v: pointer of type atomic_t
15 * @fail_fn: function to call if the result is negative
16 *
17 * Atomically decrements @v and calls <fail_fn> if the result is negative.
18 */
19#define __mutex_fastpath_lock(v, fail_fn) \
20do { \
21 unsigned long dummy; \
22 \
23 typecheck(atomic_t *, v); \
24 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
25 \
26 __asm__ __volatile__( \
27 LOCK " decl (%%rdi) \n" \
28 " js 2f \n" \
29 "1: \n" \
30 \
31 LOCK_SECTION_START("") \
32 "2: call "#fail_fn" \n" \
33 " jmp 1b \n" \
34 LOCK_SECTION_END \
35 \
36 :"=D" (dummy) \
37 : "D" (v) \
38 : "rax", "rsi", "rdx", "rcx", \
39 "r8", "r9", "r10", "r11", "memory"); \
40} while (0)
41
42/**
43 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
44 * from 1 to a 0 value
45 * @count: pointer of type atomic_t
46 * @fail_fn: function to call if the original value was not 1
47 *
48 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
49 * it wasn't 1 originally. This function returns 0 if the fastpath succeeds,
50 * or anything the slow path function returns
51 */
52static inline int
53__mutex_fastpath_lock_retval(atomic_t *count,
54 int fastcall (*fail_fn)(atomic_t *))
55{
56 if (unlikely(atomic_dec_return(count) < 0))
57 return fail_fn(count);
58 else
59 return 0;
60}
61
62/**
63 * __mutex_fastpath_unlock - increment and call function if nonpositive
64 * @v: pointer of type atomic_t
65 * @fail_fn: function to call if the result is nonpositive
66 *
67 * Atomically increments @v and calls <fail_fn> if the result is nonpositive.
68 */
69#define __mutex_fastpath_unlock(v, fail_fn) \
70do { \
71 unsigned long dummy; \
72 \
73 typecheck(atomic_t *, v); \
74 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
75 \
76 __asm__ __volatile__( \
77 LOCK " incl (%%rdi) \n" \
78 " jle 2f \n" \
79 "1: \n" \
80 \
81 LOCK_SECTION_START("") \
82 "2: call "#fail_fn" \n" \
83 " jmp 1b \n" \
84 LOCK_SECTION_END \
85 \
86 :"=D" (dummy) \
87 : "D" (v) \
88 : "rax", "rsi", "rdx", "rcx", \
89 "r8", "r9", "r10", "r11", "memory"); \
90} while (0)
91
92#define __mutex_slowpath_needs_to_unlock() 1
93
94/**
95 * __mutex_fastpath_trylock - try to acquire the mutex, without waiting
96 *
97 * @count: pointer of type atomic_t
98 * @fail_fn: fallback function
99 *
100 * Change the count from 1 to 0 and return 1 (success), or return 0 (failure)
101 * if it wasn't 1 originally. [the fallback function is never used on
102 * x86_64, because all x86_64 CPUs have a CMPXCHG instruction.]
103 */
104static inline int
105__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
106{
107 if (likely(atomic_cmpxchg(count, 1, 0) == 1))
108 return 1;
109 else
110 return 0;
111}
112
113#endif
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h
index d51e56fdc3da..34e434ce3268 100644
--- a/include/asm-x86_64/numa.h
+++ b/include/asm-x86_64/numa.h
@@ -20,6 +20,11 @@ extern int numa_off;
20extern void numa_set_node(int cpu, int node); 20extern void numa_set_node(int cpu, int node);
21 21
22extern unsigned char apicid_to_node[256]; 22extern unsigned char apicid_to_node[256];
23#ifdef CONFIG_NUMA
24extern void __init init_cpu_to_node(void);
25#else
26#define init_cpu_to_node() do {} while (0)
27#endif
23 28
24#define NUMA_NO_NODE 0xff 29#define NUMA_NO_NODE 0xff
25 30
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index 06e489f32472..dcbb4fcd9a18 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -14,13 +14,18 @@
14#define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK) 14#define PHYSICAL_PAGE_MASK (~(PAGE_SIZE-1) & __PHYSICAL_MASK)
15 15
16#define THREAD_ORDER 1 16#define THREAD_ORDER 1
17#ifdef __ASSEMBLY__ 17#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
18#define THREAD_SIZE (1 << (PAGE_SHIFT + THREAD_ORDER))
19#else
20#define THREAD_SIZE (1UL << (PAGE_SHIFT + THREAD_ORDER))
21#endif
22#define CURRENT_MASK (~(THREAD_SIZE-1)) 18#define CURRENT_MASK (~(THREAD_SIZE-1))
23 19
20#define EXCEPTION_STACK_ORDER 0
21#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
22
23#define DEBUG_STACK_ORDER EXCEPTION_STACK_ORDER
24#define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
25
26#define IRQSTACK_ORDER 2
27#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
28
24#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) 29#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
25#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT) 30#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
26 31
diff --git a/include/asm-x86_64/param.h b/include/asm-x86_64/param.h
index 40b11937180d..5956b23b57c2 100644
--- a/include/asm-x86_64/param.h
+++ b/include/asm-x86_64/param.h
@@ -1,9 +1,8 @@
1#include <linux/config.h>
2
3#ifndef _ASMx86_64_PARAM_H 1#ifndef _ASMx86_64_PARAM_H
4#define _ASMx86_64_PARAM_H 2#define _ASMx86_64_PARAM_H
5 3
6#ifdef __KERNEL__ 4#ifdef __KERNEL__
5# include <linux/config.h>
7# define HZ CONFIG_HZ /* Internal kernel timer frequency */ 6# define HZ CONFIG_HZ /* Internal kernel timer frequency */
8# define USER_HZ 100 /* .. some user interfaces are in "ticks */ 7# define USER_HZ 100 /* .. some user interfaces are in "ticks */
9#define CLOCKS_PER_SEC (USER_HZ) /* like times() */ 8#define CLOCKS_PER_SEC (USER_HZ) /* like times() */
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index eeb3088a1c9e..fd03e15d7ea6 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -42,18 +42,20 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
42#include <asm/scatterlist.h> 42#include <asm/scatterlist.h>
43#include <linux/string.h> 43#include <linux/string.h>
44#include <asm/page.h> 44#include <asm/page.h>
45#include <linux/dma-mapping.h> /* for have_iommu */
45 46
46extern int iommu_setup(char *opt); 47extern int iommu_setup(char *opt);
47 48
48#ifdef CONFIG_GART_IOMMU
49/* The PCI address space does equal the physical memory 49/* The PCI address space does equal the physical memory
50 * address space. The networking and block device layers use 50 * address space. The networking and block device layers use
51 * this boolean for bounce buffer decisions 51 * this boolean for bounce buffer decisions
52 * 52 *
53 * On AMD64 it mostly equals, but we set it to zero to tell some subsystems 53 * On AMD64 it mostly equals, but we set it to zero if a hardware
54 * that an IOMMU is available. 54 * IOMMU (gart) of sotware IOMMU (swiotlb) is available.
55 */ 55 */
56#define PCI_DMA_BUS_IS_PHYS (no_iommu ? 1 : 0) 56#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
57
58#ifdef CONFIG_GART_IOMMU
57 59
58/* 60/*
59 * x86-64 always supports DAC, but sometimes it is useful to force 61 * x86-64 always supports DAC, but sometimes it is useful to force
@@ -79,7 +81,6 @@ extern int iommu_sac_force;
79#else 81#else
80/* No IOMMU */ 82/* No IOMMU */
81 83
82#define PCI_DMA_BUS_IS_PHYS 1
83#define pci_dac_dma_supported(pci_dev, mask) 1 84#define pci_dac_dma_supported(pci_dev, mask) 1
84 85
85#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) 86#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
index 8733ccfa442e..c7ab38a601af 100644
--- a/include/asm-x86_64/pda.h
+++ b/include/asm-x86_64/pda.h
@@ -5,6 +5,7 @@
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/cache.h> 7#include <linux/cache.h>
8#include <asm/page.h>
8 9
9/* Per processor datastructure. %gs points to it while the kernel runs */ 10/* Per processor datastructure. %gs points to it while the kernel runs */
10struct x8664_pda { 11struct x8664_pda {
@@ -12,6 +13,9 @@ struct x8664_pda {
12 unsigned long data_offset; /* Per cpu data offset from linker address */ 13 unsigned long data_offset; /* Per cpu data offset from linker address */
13 unsigned long kernelstack; /* top of kernel stack for current */ 14 unsigned long kernelstack; /* top of kernel stack for current */
14 unsigned long oldrsp; /* user rsp for system call */ 15 unsigned long oldrsp; /* user rsp for system call */
16#if DEBUG_STKSZ > EXCEPTION_STKSZ
17 unsigned long debugstack; /* #DB/#BP stack. */
18#endif
15 int irqcount; /* Irq nesting counter. Starts with -1 */ 19 int irqcount; /* Irq nesting counter. Starts with -1 */
16 int cpunumber; /* Logical CPU number */ 20 int cpunumber; /* Logical CPU number */
17 char *irqstackptr; /* top of irqstack */ 21 char *irqstackptr; /* top of irqstack */
@@ -23,11 +27,10 @@ struct x8664_pda {
23 unsigned apic_timer_irqs; 27 unsigned apic_timer_irqs;
24} ____cacheline_aligned_in_smp; 28} ____cacheline_aligned_in_smp;
25 29
30extern struct x8664_pda *_cpu_pda[];
31extern struct x8664_pda boot_cpu_pda[];
26 32
27#define IRQSTACK_ORDER 2 33#define cpu_pda(i) (_cpu_pda[i])
28#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
29
30extern struct x8664_pda cpu_pda[];
31 34
32/* 35/*
33 * There is no fast way to get the base address of the PDA, all the accesses 36 * There is no fast way to get the base address of the PDA, all the accesses
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index 9c71855736fb..29a6b0408f75 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -11,7 +11,7 @@
11 11
12#include <asm/pda.h> 12#include <asm/pda.h>
13 13
14#define __per_cpu_offset(cpu) (cpu_pda[cpu].data_offset) 14#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
15#define __my_cpu_offset() read_pda(data_offset) 15#define __my_cpu_offset() read_pda(data_offset)
16 16
17/* Separate out the type, so (int[3], foo) works. */ 17/* Separate out the type, so (int[3], foo) works. */
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index ecf58c7c1650..8fbf4dd72115 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -122,6 +122,8 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
122 122
123#define pte_same(a, b) ((a).pte == (b).pte) 123#define pte_same(a, b) ((a).pte == (b).pte)
124 124
125#define pte_pgprot(a) (__pgprot((a).pte & ~PHYSICAL_PAGE_MASK))
126
125#define PMD_SIZE (1UL << PMD_SHIFT) 127#define PMD_SIZE (1UL << PMD_SHIFT)
126#define PMD_MASK (~(PMD_SIZE-1)) 128#define PMD_MASK (~(PMD_SIZE-1))
127#define PUD_SIZE (1UL << PUD_SHIFT) 129#define PUD_SIZE (1UL << PUD_SHIFT)
@@ -265,25 +267,25 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
265 */ 267 */
266#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) 268#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
267static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 269static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
268extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 270static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
269extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 271static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
270extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 272static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
271extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 273static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
272extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } 274static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
273static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 275static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
274static inline int pte_huge(pte_t pte) { return (pte_val(pte) & __LARGE_PTE) == __LARGE_PTE; } 276static inline int pte_huge(pte_t pte) { return (pte_val(pte) & __LARGE_PTE) == __LARGE_PTE; }
275 277
276extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } 278static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
277extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } 279static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
278extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 280static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
279extern inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } 281static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
280extern inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } 282static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; }
281extern inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } 283static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
282extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } 284static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
283extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 285static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
284extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 286static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
285extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } 287static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
286extern inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | __LARGE_PTE)); return pte; } 288static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | __LARGE_PTE)); return pte; }
287 289
288struct vm_area_struct; 290struct vm_area_struct;
289 291
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 4861246548f7..87a282b1043a 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -227,7 +227,13 @@ struct tss_struct {
227extern struct cpuinfo_x86 boot_cpu_data; 227extern struct cpuinfo_x86 boot_cpu_data;
228DECLARE_PER_CPU(struct tss_struct,init_tss); 228DECLARE_PER_CPU(struct tss_struct,init_tss);
229 229
230#ifdef CONFIG_X86_VSMP
231#define ARCH_MIN_TASKALIGN (1 << INTERNODE_CACHE_SHIFT)
232#define ARCH_MIN_MMSTRUCT_ALIGN (1 << INTERNODE_CACHE_SHIFT)
233#else
230#define ARCH_MIN_TASKALIGN 16 234#define ARCH_MIN_TASKALIGN 16
235#define ARCH_MIN_MMSTRUCT_ALIGN 0
236#endif
231 237
232struct thread_struct { 238struct thread_struct {
233 unsigned long rsp0; 239 unsigned long rsp0;
@@ -273,8 +279,6 @@ struct thread_struct {
273#define DEBUG_STACK 4 279#define DEBUG_STACK 4
274#define MCE_STACK 5 280#define MCE_STACK 5
275#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */ 281#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
276#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
277#define EXCEPTION_STACK_ORDER 0
278 282
279#define start_thread(regs,new_rip,new_rsp) do { \ 283#define start_thread(regs,new_rip,new_rsp) do { \
280 asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \ 284 asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \
@@ -317,8 +321,8 @@ extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
317#define thread_saved_pc(t) (*(unsigned long *)((t)->thread.rsp - 8)) 321#define thread_saved_pc(t) (*(unsigned long *)((t)->thread.rsp - 8))
318 322
319extern unsigned long get_wchan(struct task_struct *p); 323extern unsigned long get_wchan(struct task_struct *p);
320#define KSTK_EIP(tsk) \ 324#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.rsp0 - 1)
321 (((struct pt_regs *)(tsk->thread.rsp0 - sizeof(struct pt_regs)))->rip) 325#define KSTK_EIP(tsk) (task_pt_regs(tsk)->rip)
322#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */ 326#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */
323 327
324 328
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index 34501086afef..115e496c6139 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -67,8 +67,6 @@ extern void load_gs_index(unsigned gs);
67 67
68extern unsigned long end_pfn_map; 68extern unsigned long end_pfn_map;
69 69
70extern cpumask_t cpu_initialized;
71
72extern void show_trace(unsigned long * rsp); 70extern void show_trace(unsigned long * rsp);
73extern void show_registers(struct pt_regs *regs); 71extern void show_registers(struct pt_regs *regs);
74 72
@@ -91,8 +89,12 @@ extern void check_efer(void);
91 89
92extern int unhandled_signal(struct task_struct *tsk, int sig); 90extern int unhandled_signal(struct task_struct *tsk, int sig);
93 91
92extern int unsynchronized_tsc(void);
93
94extern void select_idle_routine(const struct cpuinfo_x86 *c); 94extern void select_idle_routine(const struct cpuinfo_x86 *c);
95extern void swiotlb_init(void); 95
96extern void gart_parse_options(char *);
97extern void __init no_iommu_init(void);
96 98
97extern unsigned long table_start, table_end; 99extern unsigned long table_start, table_end;
98 100
@@ -106,12 +108,17 @@ extern int skip_ioapic_setup;
106extern int acpi_ht; 108extern int acpi_ht;
107extern int acpi_disabled; 109extern int acpi_disabled;
108 110
111#ifdef CONFIG_GART_IOMMU
109extern int fallback_aper_order; 112extern int fallback_aper_order;
110extern int fallback_aper_force; 113extern int fallback_aper_force;
111extern int iommu_aperture; 114extern int iommu_aperture;
112extern int iommu_aperture_disabled;
113extern int iommu_aperture_allowed; 115extern int iommu_aperture_allowed;
116extern int iommu_aperture_disabled;
114extern int fix_aperture; 117extern int fix_aperture;
118#else
119#define iommu_aperture 0
120#define iommu_aperture_allowed 0
121#endif
115extern int force_iommu; 122extern int force_iommu;
116 123
117extern int reboot_force; 124extern int reboot_force;
diff --git a/include/asm-x86_64/segment.h b/include/asm-x86_64/segment.h
index 44adaf18c11e..d4bed33fb32c 100644
--- a/include/asm-x86_64/segment.h
+++ b/include/asm-x86_64/segment.h
@@ -19,15 +19,13 @@
19#define __USER_DS 0x2b /* 5*8+3 */ 19#define __USER_DS 0x2b /* 5*8+3 */
20#define __USER_CS 0x33 /* 6*8+3 */ 20#define __USER_CS 0x33 /* 6*8+3 */
21#define __USER32_DS __USER_DS 21#define __USER32_DS __USER_DS
22#define __KERNEL16_CS (GDT_ENTRY_KERNELCS16 * 8)
23#define __KERNEL_COMPAT32_CS 0x8
24 22
25#define GDT_ENTRY_TLS 1 23#define GDT_ENTRY_TLS 1
26#define GDT_ENTRY_TSS 8 /* needs two entries */ 24#define GDT_ENTRY_TSS 8 /* needs two entries */
27#define GDT_ENTRY_LDT 10 /* needs two entries */ 25#define GDT_ENTRY_LDT 10 /* needs two entries */
28#define GDT_ENTRY_TLS_MIN 12 26#define GDT_ENTRY_TLS_MIN 12
29#define GDT_ENTRY_TLS_MAX 14 27#define GDT_ENTRY_TLS_MAX 14
30#define GDT_ENTRY_KERNELCS16 15 28/* 15 free */
31 29
32#define GDT_ENTRY_TLS_ENTRIES 3 30#define GDT_ENTRY_TLS_ENTRIES 3
33 31
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index d030409a8fb5..9ccbb2cfd5c0 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -35,6 +35,7 @@ extern cpumask_t cpu_present_mask;
35extern cpumask_t cpu_possible_map; 35extern cpumask_t cpu_possible_map;
36extern cpumask_t cpu_online_map; 36extern cpumask_t cpu_online_map;
37extern cpumask_t cpu_callout_map; 37extern cpumask_t cpu_callout_map;
38extern cpumask_t cpu_initialized;
38 39
39/* 40/*
40 * Private routines/data 41 * Private routines/data
diff --git a/include/asm-x86_64/swiotlb.h b/include/asm-x86_64/swiotlb.h
index dddf1b218681..60757efd1353 100644
--- a/include/asm-x86_64/swiotlb.h
+++ b/include/asm-x86_64/swiotlb.h
@@ -3,10 +3,14 @@
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6#include <asm/dma-mapping.h>
7
6/* SWIOTLB interface */ 8/* SWIOTLB interface */
7 9
8extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, 10extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr,
9 int dir); 11 size_t size, int dir);
12extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
13 dma_addr_t *dma_handle, gfp_t flags);
10extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, 14extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
11 size_t size, int dir); 15 size_t size, int dir);
12extern void swiotlb_sync_single_for_cpu(struct device *hwdev, 16extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
@@ -34,10 +38,10 @@ extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
34extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, 38extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
35 int nents, int direction); 39 int nents, int direction);
36extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr); 40extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr);
37extern void *swiotlb_alloc_coherent (struct device *hwdev, size_t size,
38 dma_addr_t *dma_handle, gfp_t flags);
39extern void swiotlb_free_coherent (struct device *hwdev, size_t size, 41extern void swiotlb_free_coherent (struct device *hwdev, size_t size,
40 void *vaddr, dma_addr_t dma_handle); 42 void *vaddr, dma_addr_t dma_handle);
43extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
44extern void swiotlb_init(void);
41 45
42#ifdef CONFIG_SWIOTLB 46#ifdef CONFIG_SWIOTLB
43extern int swiotlb; 47extern int swiotlb;
@@ -45,4 +49,6 @@ extern int swiotlb;
45#define swiotlb 0 49#define swiotlb 0
46#endif 50#endif
47 51
48#endif 52extern void pci_swiotlb_init(void);
53
54#endif /* _ASM_SWTIOLB_H */
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index 85348e02ad2e..0eacbefb7dd0 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -20,8 +20,8 @@
20#define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" 20#define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
21 21
22/* frame pointer must be last for get_wchan */ 22/* frame pointer must be last for get_wchan */
23#define SAVE_CONTEXT "pushfq ; pushq %%rbp ; movq %%rsi,%%rbp\n\t" 23#define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t"
24#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popfq\n\t" 24#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t"
25 25
26#define __EXTRA_CLOBBER \ 26#define __EXTRA_CLOBBER \
27 ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" 27 ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15"
@@ -137,6 +137,21 @@ struct alt_instr {
137 "663:\n\t" newinstr "\n664:\n" /* replacement */ \ 137 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
138 ".previous" :: "i" (feature), ##input) 138 ".previous" :: "i" (feature), ##input)
139 139
140/* Like alternative_input, but with a single output argument */
141#define alternative_io(oldinstr, newinstr, feature, output, input...) \
142 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
143 ".section .altinstructions,\"a\"\n" \
144 " .align 8\n" \
145 " .quad 661b\n" /* label */ \
146 " .quad 663f\n" /* new instruction */ \
147 " .byte %c[feat]\n" /* feature bit */ \
148 " .byte 662b-661b\n" /* sourcelen */ \
149 " .byte 664f-663f\n" /* replacementlen */ \
150 ".previous\n" \
151 ".section .altinstr_replacement,\"ax\"\n" \
152 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
153 ".previous" : output : [feat] "i" (feature), ##input)
154
140/* 155/*
141 * Clear and set 'TS' bit respectively 156 * Clear and set 'TS' bit respectively
142 */ 157 */
@@ -178,6 +193,15 @@ static inline void write_cr4(unsigned long val)
178#define wbinvd() \ 193#define wbinvd() \
179 __asm__ __volatile__ ("wbinvd": : :"memory"); 194 __asm__ __volatile__ ("wbinvd": : :"memory");
180 195
196/*
197 * On SMP systems, when the scheduler does migration-cost autodetection,
198 * it needs a way to flush as much of the CPU's caches as possible.
199 */
200static inline void sched_cacheflush(void)
201{
202 wbinvd();
203}
204
181#endif /* __KERNEL__ */ 205#endif /* __KERNEL__ */
182 206
183#define nop() __asm__ __volatile__ ("nop") 207#define nop() __asm__ __volatile__ ("nop")
@@ -311,10 +335,29 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
311/* interrupt control.. */ 335/* interrupt control.. */
312#define local_save_flags(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0) 336#define local_save_flags(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0)
313#define local_irq_restore(x) __asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc") 337#define local_irq_restore(x) __asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc")
338
339#ifdef CONFIG_X86_VSMP
340/* Interrupt control for VSMP architecture */
341#define local_irq_disable() do { unsigned long flags; local_save_flags(flags); local_irq_restore((flags & ~(1 << 9)) | (1 << 18)); } while (0)
342#define local_irq_enable() do { unsigned long flags; local_save_flags(flags); local_irq_restore((flags | (1 << 9)) & ~(1 << 18)); } while (0)
343
344#define irqs_disabled() \
345({ \
346 unsigned long flags; \
347 local_save_flags(flags); \
348 (flags & (1<<18)) || !(flags & (1<<9)); \
349})
350
351/* For spinlocks etc */
352#define local_irq_save(x) do { local_save_flags(x); local_irq_restore((x & ~(1 << 9)) | (1 << 18)); } while (0)
353#else /* CONFIG_X86_VSMP */
314#define local_irq_disable() __asm__ __volatile__("cli": : :"memory") 354#define local_irq_disable() __asm__ __volatile__("cli": : :"memory")
315#define local_irq_enable() __asm__ __volatile__("sti": : :"memory") 355#define local_irq_enable() __asm__ __volatile__("sti": : :"memory")
356
316/* used in the idle loop; sti takes one instruction cycle to complete */ 357/* used in the idle loop; sti takes one instruction cycle to complete */
317#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory") 358#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")
359/* used when interrupts are already enabled or to shutdown the processor */
360#define halt() __asm__ __volatile__("hlt": : :"memory")
318 361
319#define irqs_disabled() \ 362#define irqs_disabled() \
320({ \ 363({ \
@@ -325,16 +368,10 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
325 368
326/* For spinlocks etc */ 369/* For spinlocks etc */
327#define local_irq_save(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# local_irq_save \n\t pushfq ; popq %0 ; cli":"=g" (x): /* no input */ :"memory"); } while (0) 370#define local_irq_save(x) do { warn_if_not_ulong(x); __asm__ __volatile__("# local_irq_save \n\t pushfq ; popq %0 ; cli":"=g" (x): /* no input */ :"memory"); } while (0)
371#endif
328 372
329void cpu_idle_wait(void); 373void cpu_idle_wait(void);
330 374
331/*
332 * disable hlt during certain critical i/o operations
333 */
334#define HAVE_DISABLE_HLT
335void disable_hlt(void);
336void enable_hlt(void);
337
338extern unsigned long arch_align_stack(unsigned long sp); 375extern unsigned long arch_align_stack(unsigned long sp);
339 376
340#endif 377#endif
diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h
index 08eb6e4f3737..4ac0e0a36934 100644
--- a/include/asm-x86_64/thread_info.h
+++ b/include/asm-x86_64/thread_info.h
@@ -76,8 +76,6 @@ static inline struct thread_info *stack_thread_info(void)
76#define alloc_thread_info(tsk) \ 76#define alloc_thread_info(tsk) \
77 ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER)) 77 ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER))
78#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) 78#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER)
79#define get_thread_info(ti) get_task_struct((ti)->task)
80#define put_thread_info(ti) put_task_struct((ti)->task)
81 79
82#else /* !__ASSEMBLY__ */ 80#else /* !__ASSEMBLY__ */
83 81
@@ -138,6 +136,7 @@ static inline struct thread_info *stack_thread_info(void)
138 * have to worry about atomic accesses. 136 * have to worry about atomic accesses.
139 */ 137 */
140#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */ 138#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
139#define TS_COMPAT 0x0002 /* 32bit syscall active */
141 140
142#endif /* __KERNEL__ */ 141#endif /* __KERNEL__ */
143 142
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h
index f971f45d6d78..f18443fcdf04 100644
--- a/include/asm-x86_64/timex.h
+++ b/include/asm-x86_64/timex.h
@@ -10,6 +10,9 @@
10#include <asm/msr.h> 10#include <asm/msr.h>
11#include <asm/vsyscall.h> 11#include <asm/vsyscall.h>
12#include <asm/hpet.h> 12#include <asm/hpet.h>
13#include <asm/system.h>
14#include <asm/processor.h>
15#include <linux/compiler.h>
13 16
14#define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */ 17#define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */
15 18
@@ -23,6 +26,19 @@ static inline cycles_t get_cycles (void)
23 return ret; 26 return ret;
24} 27}
25 28
29/* Like get_cycles, but make sure the CPU is synchronized. */
30static __always_inline cycles_t get_cycles_sync(void)
31{
32 unsigned long long ret;
33 unsigned eax;
34 /* Don't do an additional sync on CPUs where we know
35 RDTSC is already synchronous. */
36 alternative_io(ASM_NOP2, "cpuid", X86_FEATURE_SYNC_RDTSC,
37 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
38 rdtscll(ret);
39 return ret;
40}
41
26extern unsigned int cpu_khz; 42extern unsigned int cpu_khz;
27 43
28extern int read_current_timer(unsigned long *timer_value); 44extern int read_current_timer(unsigned long *timer_value);
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
index 7d82bc56b9fa..2fa7f27381b4 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -39,7 +39,6 @@ extern int __node_distance(int, int);
39 .max_interval = 32, \ 39 .max_interval = 32, \
40 .busy_factor = 32, \ 40 .busy_factor = 32, \
41 .imbalance_pct = 125, \ 41 .imbalance_pct = 125, \
42 .cache_hot_time = (10*1000000), \
43 .cache_nice_tries = 2, \ 42 .cache_nice_tries = 2, \
44 .busy_idx = 3, \ 43 .busy_idx = 3, \
45 .idle_idx = 2, \ 44 .idle_idx = 2, \
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index 1bb8b8a24436..2892c4b7a28b 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -348,6 +348,7 @@ static inline int __copy_in_user(void __user *dst, const void __user *src, unsig
348long strncpy_from_user(char *dst, const char __user *src, long count); 348long strncpy_from_user(char *dst, const char __user *src, long count);
349long __strncpy_from_user(char *dst, const char __user *src, long count); 349long __strncpy_from_user(char *dst, const char __user *src, long count);
350long strnlen_user(const char __user *str, long n); 350long strnlen_user(const char __user *str, long n);
351long __strnlen_user(const char __user *str, long n);
351long strlen_user(const char __user *str); 352long strlen_user(const char __user *str);
352unsigned long clear_user(void __user *mem, unsigned long len); 353unsigned long clear_user(void __user *mem, unsigned long len);
353unsigned long __clear_user(void __user *mem, unsigned long len); 354unsigned long __clear_user(void __user *mem, unsigned long len);
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 2c42150bce0c..e6f896161c11 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -571,8 +571,10 @@ __SYSCALL(__NR_inotify_init, sys_inotify_init)
571__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch) 571__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
572#define __NR_inotify_rm_watch 255 572#define __NR_inotify_rm_watch 255
573__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch) 573__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
574#define __NR_migrate_pages 256
575__SYSCALL(__NR_migrate_pages, sys_migrate_pages)
574 576
575#define __NR_syscall_max __NR_inotify_rm_watch 577#define __NR_syscall_max __NR_migrate_pages
576#ifndef __NO_STUBS 578#ifndef __NO_STUBS
577 579
578/* user-visible error numbers are in the range -1 - -4095 */ 580/* user-visible error numbers are in the range -1 - -4095 */
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h
index 438a3f52f839..a85e16f56d73 100644
--- a/include/asm-x86_64/vsyscall.h
+++ b/include/asm-x86_64/vsyscall.h
@@ -36,8 +36,8 @@ struct vxtime_data {
36 int mode; 36 int mode;
37}; 37};
38 38
39#define hpet_readl(a) readl((void *)fix_to_virt(FIX_HPET_BASE) + a) 39#define hpet_readl(a) readl((const void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
40#define hpet_writel(d,a) writel(d, (void *)fix_to_virt(FIX_HPET_BASE) + a) 40#define hpet_writel(d,a) writel(d, (void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
41 41
42/* vsyscall space (readonly) */ 42/* vsyscall space (readonly) */
43extern struct vxtime_data __vxtime; 43extern struct vxtime_data __vxtime;
diff --git a/include/asm-xtensa/atomic.h b/include/asm-xtensa/atomic.h
index 3670cc7695da..fe105a123924 100644
--- a/include/asm-xtensa/atomic.h
+++ b/include/asm-xtensa/atomic.h
@@ -224,6 +224,7 @@ static inline int atomic_sub_return(int i, atomic_t * v)
224#define atomic_add_negative(i,v) (atomic_add_return((i),(v)) < 0) 224#define atomic_add_negative(i,v) (atomic_add_return((i),(v)) < 0)
225 225
226#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 226#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
227#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
227 228
228/** 229/**
229 * atomic_add_unless - add unless the number is a given value 230 * atomic_add_unless - add unless the number is a given value
@@ -286,6 +287,7 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
286#define smp_mb__before_atomic_inc() barrier() 287#define smp_mb__before_atomic_inc() barrier()
287#define smp_mb__after_atomic_inc() barrier() 288#define smp_mb__after_atomic_inc() barrier()
288 289
290#include <asm-generic/atomic.h>
289#endif /* __KERNEL__ */ 291#endif /* __KERNEL__ */
290 292
291#endif /* _XTENSA_ATOMIC_H */ 293#endif /* _XTENSA_ATOMIC_H */
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h
index e76ee889e21d..0a2065f1a372 100644
--- a/include/asm-xtensa/bitops.h
+++ b/include/asm-xtensa/bitops.h
@@ -245,6 +245,7 @@ static __inline__ int fls (unsigned int x)
245{ 245{
246 return __cntlz(x); 246 return __cntlz(x);
247} 247}
248#define fls64(x) generic_fls64(x)
248 249
249static __inline__ int 250static __inline__ int
250find_next_bit(const unsigned long *addr, int size, int offset) 251find_next_bit(const unsigned long *addr, int size, int offset)
diff --git a/include/asm-xtensa/ioctl.h b/include/asm-xtensa/ioctl.h
index 856c605d62b1..b279fe06dfe5 100644
--- a/include/asm-xtensa/ioctl.h
+++ b/include/asm-xtensa/ioctl.h
@@ -1,83 +1 @@
1/* #include <asm-generic/ioctl.h>
2 * include/asm-xtensa/ioctl.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2003 - 2005 Tensilica Inc.
9 *
10 * Derived from "include/asm-i386/ioctl.h"
11 */
12
13#ifndef _XTENSA_IOCTL_H
14#define _XTENSA_IOCTL_H
15
16
17/* ioctl command encoding: 32 bits total, command in lower 16 bits,
18 * size of the parameter structure in the lower 14 bits of the
19 * upper 16 bits.
20 * Encoding the size of the parameter structure in the ioctl request
21 * is useful for catching programs compiled with old versions
22 * and to avoid overwriting user space outside the user buffer area.
23 * The highest 2 bits are reserved for indicating the ``access mode''.
24 * NOTE: This limits the max parameter size to 16kB -1 !
25 */
26
27/*
28 * The following is for compatibility across the various Linux
29 * platforms. The i386 ioctl numbering scheme doesn't really enforce
30 * a type field. De facto, however, the top 8 bits of the lower 16
31 * bits are indeed used as a type field, so we might just as well make
32 * this explicit here. Please be sure to use the decoding macros
33 * below from now on.
34 */
35#define _IOC_NRBITS 8
36#define _IOC_TYPEBITS 8
37#define _IOC_SIZEBITS 14
38#define _IOC_DIRBITS 2
39
40#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
41#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
42#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
43#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
44
45#define _IOC_NRSHIFT 0
46#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
47#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
48#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
49
50/*
51 * Direction bits.
52 */
53#define _IOC_NONE 0U
54#define _IOC_WRITE 1U
55#define _IOC_READ 2U
56
57#define _IOC(dir,type,nr,size) \
58 (((dir) << _IOC_DIRSHIFT) | \
59 ((type) << _IOC_TYPESHIFT) | \
60 ((nr) << _IOC_NRSHIFT) | \
61 ((size) << _IOC_SIZESHIFT))
62
63/* used to create numbers */
64#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
65#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
66#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
67#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
68
69/* used to decode ioctl numbers.. */
70#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
71#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
72#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
73#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
74
75/* ...and for the drivers/sound files... */
76
77#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
78#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
79#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
80#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
81#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
82
83#endif
diff --git a/include/asm-xtensa/mman.h b/include/asm-xtensa/mman.h
index 9a95a45df996..082a7504925e 100644
--- a/include/asm-xtensa/mman.h
+++ b/include/asm-xtensa/mman.h
@@ -72,6 +72,7 @@
72#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ 72#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
73#define MADV_WILLNEED 0x3 /* pre-fault pages */ 73#define MADV_WILLNEED 0x3 /* pre-fault pages */
74#define MADV_DONTNEED 0x4 /* discard these pages */ 74#define MADV_DONTNEED 0x4 /* discard these pages */
75#define MADV_REMOVE 0x5 /* remove these pages & resources */
75 76
76/* compatibility flags */ 77/* compatibility flags */
77#define MAP_ANON MAP_ANONYMOUS 78#define MAP_ANON MAP_ANONYMOUS
diff --git a/include/asm-xtensa/mutex.h b/include/asm-xtensa/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/include/asm-xtensa/mutex.h
@@ -0,0 +1,9 @@
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-xtensa/processor.h b/include/asm-xtensa/processor.h
index 9cab5e4298b9..d1d72ad36f08 100644
--- a/include/asm-xtensa/processor.h
+++ b/include/asm-xtensa/processor.h
@@ -184,12 +184,12 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
184#define release_segments(mm) do { } while(0) 184#define release_segments(mm) do { } while(0)
185#define forget_segments() do { } while (0) 185#define forget_segments() do { } while (0)
186 186
187#define thread_saved_pc(tsk) (xtensa_pt_regs(tsk)->pc) 187#define thread_saved_pc(tsk) (task_pt_regs(tsk)->pc)
188 188
189extern unsigned long get_wchan(struct task_struct *p); 189extern unsigned long get_wchan(struct task_struct *p);
190 190
191#define KSTK_EIP(tsk) (xtensa_pt_regs(tsk)->pc) 191#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
192#define KSTK_ESP(tsk) (xtensa_pt_regs(tsk)->areg[1]) 192#define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1])
193 193
194#define cpu_relax() do { } while (0) 194#define cpu_relax() do { } while (0)
195 195
diff --git a/include/asm-xtensa/ptrace.h b/include/asm-xtensa/ptrace.h
index aa4fd7fb3ce7..a5ac71a5205c 100644
--- a/include/asm-xtensa/ptrace.h
+++ b/include/asm-xtensa/ptrace.h
@@ -113,8 +113,8 @@ struct pt_regs {
113}; 113};
114 114
115#ifdef __KERNEL__ 115#ifdef __KERNEL__
116# define xtensa_pt_regs(tsk) ((struct pt_regs*) \ 116# define task_pt_regs(tsk) ((struct pt_regs*) \
117 (((long)(tsk)->thread_info + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4)) - 1) 117 (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
118# define user_mode(regs) (((regs)->ps & 0x00000020)!=0) 118# define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
119# define instruction_pointer(regs) ((regs)->pc) 119# define instruction_pointer(regs) ((regs)->pc)
120extern void show_regs(struct pt_regs *); 120extern void show_regs(struct pt_regs *);
diff --git a/include/asm-xtensa/thread_info.h b/include/asm-xtensa/thread_info.h
index af208d41fd82..5ae34ab71597 100644
--- a/include/asm-xtensa/thread_info.h
+++ b/include/asm-xtensa/thread_info.h
@@ -93,8 +93,6 @@ static inline struct thread_info *current_thread_info(void)
93/* thread information allocation */ 93/* thread information allocation */
94#define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) 94#define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
95#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 95#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
96#define get_thread_info(ti) get_task_struct((ti)->task)
97#define put_thread_info(ti) put_task_struct((ti)->task)
98 96
99#else /* !__ASSEMBLY__ */ 97#else /* !__ASSEMBLY__ */
100 98
diff --git a/include/keys/user-type.h b/include/keys/user-type.h
index 26f6ec38577a..a3dae1803f45 100644
--- a/include/keys/user-type.h
+++ b/include/keys/user-type.h
@@ -35,7 +35,6 @@ struct user_key_payload {
35extern struct key_type key_type_user; 35extern struct key_type key_type_user;
36 36
37extern int user_instantiate(struct key *key, const void *data, size_t datalen); 37extern int user_instantiate(struct key *key, const void *data, size_t datalen);
38extern int user_duplicate(struct key *key, const struct key *source);
39extern int user_update(struct key *key, const void *data, size_t datalen); 38extern int user_update(struct key *key, const void *data, size_t datalen);
40extern int user_match(const struct key *key, const void *criterion); 39extern int user_match(const struct key *key, const void *criterion);
41extern void user_destroy(struct key *key); 40extern void user_destroy(struct key *key);
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 49fd37629ee4..00c8efa95cc3 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -94,26 +94,27 @@ struct kiocb {
94 ssize_t (*ki_retry)(struct kiocb *); 94 ssize_t (*ki_retry)(struct kiocb *);
95 void (*ki_dtor)(struct kiocb *); 95 void (*ki_dtor)(struct kiocb *);
96 96
97 struct list_head ki_list; /* the aio core uses this
98 * for cancellation */
99
100 union { 97 union {
101 void __user *user; 98 void __user *user;
102 struct task_struct *tsk; 99 struct task_struct *tsk;
103 } ki_obj; 100 } ki_obj;
101
104 __u64 ki_user_data; /* user's data for completion */ 102 __u64 ki_user_data; /* user's data for completion */
103 wait_queue_t ki_wait;
105 loff_t ki_pos; 104 loff_t ki_pos;
105
106 void *private;
106 /* State that we remember to be able to restart/retry */ 107 /* State that we remember to be able to restart/retry */
107 unsigned short ki_opcode; 108 unsigned short ki_opcode;
108 size_t ki_nbytes; /* copy of iocb->aio_nbytes */ 109 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
109 char __user *ki_buf; /* remaining iocb->aio_buf */ 110 char __user *ki_buf; /* remaining iocb->aio_buf */
110 size_t ki_left; /* remaining bytes */ 111 size_t ki_left; /* remaining bytes */
111 wait_queue_t ki_wait;
112 long ki_retried; /* just for testing */ 112 long ki_retried; /* just for testing */
113 long ki_kicked; /* just for testing */ 113 long ki_kicked; /* just for testing */
114 long ki_queued; /* just for testing */ 114 long ki_queued; /* just for testing */
115 115
116 void *private; 116 struct list_head ki_list; /* the aio core uses this
117 * for cancellation */
117}; 118};
118 119
119#define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY) 120#define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY)
@@ -126,6 +127,7 @@ struct kiocb {
126 (x)->ki_filp = (filp); \ 127 (x)->ki_filp = (filp); \
127 (x)->ki_ctx = NULL; \ 128 (x)->ki_ctx = NULL; \
128 (x)->ki_cancel = NULL; \ 129 (x)->ki_cancel = NULL; \
130 (x)->ki_retry = NULL; \
129 (x)->ki_dtor = NULL; \ 131 (x)->ki_dtor = NULL; \
130 (x)->ki_obj.tsk = tsk; \ 132 (x)->ki_obj.tsk = tsk; \
131 (x)->ki_user_data = 0; \ 133 (x)->ki_user_data = 0; \
diff --git a/include/asm-arm/hardware/amba.h b/include/linux/amba/bus.h
index 51e6e54b2aa1..51e6e54b2aa1 100644
--- a/include/asm-arm/hardware/amba.h
+++ b/include/linux/amba/bus.h
diff --git a/include/asm-arm/hardware/amba_clcd.h b/include/linux/amba/clcd.h
index 6b8d73dc1ab0..6b8d73dc1ab0 100644
--- a/include/asm-arm/hardware/amba_clcd.h
+++ b/include/linux/amba/clcd.h
diff --git a/include/asm-arm/hardware/amba_kmi.h b/include/linux/amba/kmi.h
index a39e5be751b3..a39e5be751b3 100644
--- a/include/asm-arm/hardware/amba_kmi.h
+++ b/include/linux/amba/kmi.h
diff --git a/include/asm-arm/hardware/amba_serial.h b/include/linux/amba/serial.h
index dc726ffccebd..dc726ffccebd 100644
--- a/include/asm-arm/hardware/amba_serial.h
+++ b/include/linux/amba/serial.h
diff --git a/include/linux/ata.h b/include/linux/ata.h
index d2873b732bb1..94f77cce27fa 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -129,6 +129,7 @@ enum {
129 ATA_CMD_READ_EXT = 0x25, 129 ATA_CMD_READ_EXT = 0x25,
130 ATA_CMD_WRITE = 0xCA, 130 ATA_CMD_WRITE = 0xCA,
131 ATA_CMD_WRITE_EXT = 0x35, 131 ATA_CMD_WRITE_EXT = 0x35,
132 ATA_CMD_WRITE_FUA_EXT = 0x3D,
132 ATA_CMD_PIO_READ = 0x20, 133 ATA_CMD_PIO_READ = 0x20,
133 ATA_CMD_PIO_READ_EXT = 0x24, 134 ATA_CMD_PIO_READ_EXT = 0x24,
134 ATA_CMD_PIO_WRITE = 0x30, 135 ATA_CMD_PIO_WRITE = 0x30,
@@ -137,10 +138,13 @@ enum {
137 ATA_CMD_READ_MULTI_EXT = 0x29, 138 ATA_CMD_READ_MULTI_EXT = 0x29,
138 ATA_CMD_WRITE_MULTI = 0xC5, 139 ATA_CMD_WRITE_MULTI = 0xC5,
139 ATA_CMD_WRITE_MULTI_EXT = 0x39, 140 ATA_CMD_WRITE_MULTI_EXT = 0x39,
141 ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE,
140 ATA_CMD_SET_FEATURES = 0xEF, 142 ATA_CMD_SET_FEATURES = 0xEF,
141 ATA_CMD_PACKET = 0xA0, 143 ATA_CMD_PACKET = 0xA0,
142 ATA_CMD_VERIFY = 0x40, 144 ATA_CMD_VERIFY = 0x40,
143 ATA_CMD_VERIFY_EXT = 0x42, 145 ATA_CMD_VERIFY_EXT = 0x42,
146 ATA_CMD_STANDBYNOW1 = 0xE0,
147 ATA_CMD_IDLEIMMEDIATE = 0xE1,
144 ATA_CMD_INIT_DEV_PARAMS = 0x91, 148 ATA_CMD_INIT_DEV_PARAMS = 0x91,
145 149
146 /* SETFEATURES stuff */ 150 /* SETFEATURES stuff */
@@ -192,6 +196,7 @@ enum {
192 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */ 196 ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
193 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ 197 ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
194 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ 198 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
199 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
195}; 200};
196 201
197enum ata_tf_protocols { 202enum ata_tf_protocols {
@@ -245,7 +250,8 @@ struct ata_taskfile {
245#define ata_id_is_sata(id) ((id)[93] == 0) 250#define ata_id_is_sata(id) ((id)[93] == 0)
246#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) 251#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
247#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) 252#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
248#define ata_id_has_flush(id) ((id)[83] & (1 << 12)) 253#define ata_id_has_fua(id) ((id)[84] & (1 << 6))
254#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
249#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13)) 255#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
250#define ata_id_has_lba48(id) ((id)[83] & (1 << 10)) 256#define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
251#define ata_id_has_wcache(id) ((id)[82] & (1 << 5)) 257#define ata_id_has_wcache(id) ((id)[82] & (1 << 5))
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index 911c09cb9bf9..6ba3aa8a81f4 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -155,15 +155,15 @@ struct elapaarp {
155#define AARP_REQUEST 1 155#define AARP_REQUEST 1
156#define AARP_REPLY 2 156#define AARP_REPLY 2
157#define AARP_PROBE 3 157#define AARP_PROBE 3
158 __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); 158 __u8 hw_src[ETH_ALEN];
159 __u8 pa_src_zero __attribute__ ((packed)); 159 __u8 pa_src_zero;
160 __be16 pa_src_net __attribute__ ((packed)); 160 __be16 pa_src_net;
161 __u8 pa_src_node __attribute__ ((packed)); 161 __u8 pa_src_node;
162 __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); 162 __u8 hw_dst[ETH_ALEN];
163 __u8 pa_dst_zero __attribute__ ((packed)); 163 __u8 pa_dst_zero;
164 __be16 pa_dst_net __attribute__ ((packed)); 164 __be16 pa_dst_net;
165 __u8 pa_dst_node __attribute__ ((packed)); 165 __u8 pa_dst_node;
166}; 166} __attribute__ ((packed));
167 167
168static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb) 168static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
169{ 169{
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 685fd3720df5..b60ffe32cd21 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -292,6 +292,8 @@ extern struct bio *bio_clone(struct bio *, gfp_t);
292extern void bio_init(struct bio *); 292extern void bio_init(struct bio *);
293 293
294extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); 294extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
295extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
296 unsigned int, unsigned int);
295extern int bio_get_nr_vecs(struct block_device *); 297extern int bio_get_nr_vecs(struct block_device *);
296extern struct bio *bio_map_user(struct request_queue *, struct block_device *, 298extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
297 unsigned long, unsigned int, int); 299 unsigned long, unsigned int, int);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 38c2fb7ebe09..6a2a19f14bb2 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -76,6 +76,15 @@ static __inline__ int generic_fls(int x)
76 */ 76 */
77#include <asm/bitops.h> 77#include <asm/bitops.h>
78 78
79
80static inline int generic_fls64(__u64 x)
81{
82 __u32 h = x >> 32;
83 if (h)
84 return fls(x) + 32;
85 return fls(x);
86}
87
79static __inline__ int get_bitmask_order(unsigned int count) 88static __inline__ int get_bitmask_order(unsigned int count)
80{ 89{
81 int order; 90 int order;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index a33a31e71bbc..02a585faa62c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -102,7 +102,7 @@ void copy_io_context(struct io_context **pdst, struct io_context **psrc);
102void swap_io_context(struct io_context **ioc1, struct io_context **ioc2); 102void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
103 103
104struct request; 104struct request;
105typedef void (rq_end_io_fn)(struct request *); 105typedef void (rq_end_io_fn)(struct request *, int);
106 106
107struct request_list { 107struct request_list {
108 int count[2]; 108 int count[2];
@@ -118,9 +118,9 @@ struct request_list {
118 * try to put the fields that are referenced together in the same cacheline 118 * try to put the fields that are referenced together in the same cacheline
119 */ 119 */
120struct request { 120struct request {
121 struct list_head queuelist; /* looking for ->queue? you must _not_ 121 struct list_head queuelist;
122 * access it directly, use 122 struct list_head donelist;
123 * blkdev_dequeue_request! */ 123
124 unsigned long flags; /* see REQ_ bits below */ 124 unsigned long flags; /* see REQ_ bits below */
125 125
126 /* Maintain bio traversal state for part by part I/O submission. 126 /* Maintain bio traversal state for part by part I/O submission.
@@ -141,6 +141,7 @@ struct request {
141 struct bio *biotail; 141 struct bio *biotail;
142 142
143 void *elevator_private; 143 void *elevator_private;
144 void *completion_data;
144 145
145 unsigned short ioprio; 146 unsigned short ioprio;
146 147
@@ -184,6 +185,7 @@ struct request {
184 void *sense; 185 void *sense;
185 186
186 unsigned int timeout; 187 unsigned int timeout;
188 int retries;
187 189
188 /* 190 /*
189 * For Power Management requests 191 * For Power Management requests
@@ -206,6 +208,7 @@ enum rq_flag_bits {
206 __REQ_SORTED, /* elevator knows about this request */ 208 __REQ_SORTED, /* elevator knows about this request */
207 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ 209 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
208 __REQ_HARDBARRIER, /* may not be passed by drive either */ 210 __REQ_HARDBARRIER, /* may not be passed by drive either */
211 __REQ_FUA, /* forced unit access */
209 __REQ_CMD, /* is a regular fs rw request */ 212 __REQ_CMD, /* is a regular fs rw request */
210 __REQ_NOMERGE, /* don't touch this for merging */ 213 __REQ_NOMERGE, /* don't touch this for merging */
211 __REQ_STARTED, /* drive already may have started this one */ 214 __REQ_STARTED, /* drive already may have started this one */
@@ -229,9 +232,7 @@ enum rq_flag_bits {
229 __REQ_PM_SUSPEND, /* suspend request */ 232 __REQ_PM_SUSPEND, /* suspend request */
230 __REQ_PM_RESUME, /* resume request */ 233 __REQ_PM_RESUME, /* resume request */
231 __REQ_PM_SHUTDOWN, /* shutdown request */ 234 __REQ_PM_SHUTDOWN, /* shutdown request */
232 __REQ_BAR_PREFLUSH, /* barrier pre-flush done */ 235 __REQ_ORDERED_COLOR, /* is before or after barrier */
233 __REQ_BAR_POSTFLUSH, /* barrier post-flush */
234 __REQ_BAR_FLUSH, /* rq is the flush request */
235 __REQ_NR_BITS, /* stops here */ 236 __REQ_NR_BITS, /* stops here */
236}; 237};
237 238
@@ -240,6 +241,7 @@ enum rq_flag_bits {
240#define REQ_SORTED (1 << __REQ_SORTED) 241#define REQ_SORTED (1 << __REQ_SORTED)
241#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) 242#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
242#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) 243#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
244#define REQ_FUA (1 << __REQ_FUA)
243#define REQ_CMD (1 << __REQ_CMD) 245#define REQ_CMD (1 << __REQ_CMD)
244#define REQ_NOMERGE (1 << __REQ_NOMERGE) 246#define REQ_NOMERGE (1 << __REQ_NOMERGE)
245#define REQ_STARTED (1 << __REQ_STARTED) 247#define REQ_STARTED (1 << __REQ_STARTED)
@@ -259,9 +261,7 @@ enum rq_flag_bits {
259#define REQ_PM_SUSPEND (1 << __REQ_PM_SUSPEND) 261#define REQ_PM_SUSPEND (1 << __REQ_PM_SUSPEND)
260#define REQ_PM_RESUME (1 << __REQ_PM_RESUME) 262#define REQ_PM_RESUME (1 << __REQ_PM_RESUME)
261#define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN) 263#define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN)
262#define REQ_BAR_PREFLUSH (1 << __REQ_BAR_PREFLUSH) 264#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
263#define REQ_BAR_POSTFLUSH (1 << __REQ_BAR_POSTFLUSH)
264#define REQ_BAR_FLUSH (1 << __REQ_BAR_FLUSH)
265 265
266/* 266/*
267 * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME 267 * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME
@@ -291,8 +291,8 @@ struct bio_vec;
291typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *); 291typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *);
292typedef void (activity_fn) (void *data, int rw); 292typedef void (activity_fn) (void *data, int rw);
293typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *); 293typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *);
294typedef int (prepare_flush_fn) (request_queue_t *, struct request *); 294typedef void (prepare_flush_fn) (request_queue_t *, struct request *);
295typedef void (end_flush_fn) (request_queue_t *, struct request *); 295typedef void (softirq_done_fn)(struct request *);
296 296
297enum blk_queue_state { 297enum blk_queue_state {
298 Queue_down, 298 Queue_down,
@@ -334,7 +334,7 @@ struct request_queue
334 activity_fn *activity_fn; 334 activity_fn *activity_fn;
335 issue_flush_fn *issue_flush_fn; 335 issue_flush_fn *issue_flush_fn;
336 prepare_flush_fn *prepare_flush_fn; 336 prepare_flush_fn *prepare_flush_fn;
337 end_flush_fn *end_flush_fn; 337 softirq_done_fn *softirq_done_fn;
338 338
339 /* 339 /*
340 * Dispatch queue sorting 340 * Dispatch queue sorting
@@ -419,14 +419,11 @@ struct request_queue
419 /* 419 /*
420 * reserved for flush operations 420 * reserved for flush operations
421 */ 421 */
422 struct request *flush_rq; 422 unsigned int ordered, next_ordered, ordseq;
423 unsigned char ordered; 423 int orderr, ordcolor;
424}; 424 struct request pre_flush_rq, bar_rq, post_flush_rq;
425 425 struct request *orig_bar_rq;
426enum { 426 unsigned int bi_size;
427 QUEUE_ORDERED_NONE,
428 QUEUE_ORDERED_TAG,
429 QUEUE_ORDERED_FLUSH,
430}; 427};
431 428
432#define RQ_INACTIVE (-1) 429#define RQ_INACTIVE (-1)
@@ -444,12 +441,51 @@ enum {
444#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */ 441#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
445#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */ 442#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
446#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ 443#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */
447#define QUEUE_FLAG_FLUSH 9 /* doing barrier flush sequence */ 444
445enum {
446 /*
447 * Hardbarrier is supported with one of the following methods.
448 *
449 * NONE : hardbarrier unsupported
450 * DRAIN : ordering by draining is enough
451 * DRAIN_FLUSH : ordering by draining w/ pre and post flushes
452 * DRAIN_FUA : ordering by draining w/ pre flush and FUA write
453 * TAG : ordering by tag is enough
454 * TAG_FLUSH : ordering by tag w/ pre and post flushes
455 * TAG_FUA : ordering by tag w/ pre flush and FUA write
456 */
457 QUEUE_ORDERED_NONE = 0x00,
458 QUEUE_ORDERED_DRAIN = 0x01,
459 QUEUE_ORDERED_TAG = 0x02,
460
461 QUEUE_ORDERED_PREFLUSH = 0x10,
462 QUEUE_ORDERED_POSTFLUSH = 0x20,
463 QUEUE_ORDERED_FUA = 0x40,
464
465 QUEUE_ORDERED_DRAIN_FLUSH = QUEUE_ORDERED_DRAIN |
466 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH,
467 QUEUE_ORDERED_DRAIN_FUA = QUEUE_ORDERED_DRAIN |
468 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA,
469 QUEUE_ORDERED_TAG_FLUSH = QUEUE_ORDERED_TAG |
470 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH,
471 QUEUE_ORDERED_TAG_FUA = QUEUE_ORDERED_TAG |
472 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA,
473
474 /*
475 * Ordered operation sequence
476 */
477 QUEUE_ORDSEQ_STARTED = 0x01, /* flushing in progress */
478 QUEUE_ORDSEQ_DRAIN = 0x02, /* waiting for the queue to be drained */
479 QUEUE_ORDSEQ_PREFLUSH = 0x04, /* pre-flushing in progress */
480 QUEUE_ORDSEQ_BAR = 0x08, /* original barrier req in progress */
481 QUEUE_ORDSEQ_POSTFLUSH = 0x10, /* post-flushing in progress */
482 QUEUE_ORDSEQ_DONE = 0x20,
483};
448 484
449#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) 485#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
450#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 486#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
451#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 487#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
452#define blk_queue_flushing(q) test_bit(QUEUE_FLAG_FLUSH, &(q)->queue_flags) 488#define blk_queue_flushing(q) ((q)->ordseq)
453 489
454#define blk_fs_request(rq) ((rq)->flags & REQ_CMD) 490#define blk_fs_request(rq) ((rq)->flags & REQ_CMD)
455#define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC) 491#define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC)
@@ -465,8 +501,7 @@ enum {
465 501
466#define blk_sorted_rq(rq) ((rq)->flags & REQ_SORTED) 502#define blk_sorted_rq(rq) ((rq)->flags & REQ_SORTED)
467#define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER) 503#define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER)
468#define blk_barrier_preflush(rq) ((rq)->flags & REQ_BAR_PREFLUSH) 504#define blk_fua_rq(rq) ((rq)->flags & REQ_FUA)
469#define blk_barrier_postflush(rq) ((rq)->flags & REQ_BAR_POSTFLUSH)
470 505
471#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) 506#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
472 507
@@ -558,8 +593,8 @@ extern void blk_unregister_queue(struct gendisk *disk);
558extern void register_disk(struct gendisk *dev); 593extern void register_disk(struct gendisk *dev);
559extern void generic_make_request(struct bio *bio); 594extern void generic_make_request(struct bio *bio);
560extern void blk_put_request(struct request *); 595extern void blk_put_request(struct request *);
561extern void blk_end_sync_rq(struct request *rq); 596extern void __blk_put_request(request_queue_t *, struct request *);
562extern void blk_attempt_remerge(request_queue_t *, struct request *); 597extern void blk_end_sync_rq(struct request *rq, int error);
563extern struct request *blk_get_request(request_queue_t *, int, gfp_t); 598extern struct request *blk_get_request(request_queue_t *, int, gfp_t);
564extern void blk_insert_request(request_queue_t *, struct request *, int, void *); 599extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
565extern void blk_requeue_request(request_queue_t *, struct request *); 600extern void blk_requeue_request(request_queue_t *, struct request *);
@@ -579,6 +614,9 @@ extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned
579extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); 614extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int);
580extern int blk_execute_rq(request_queue_t *, struct gendisk *, 615extern int blk_execute_rq(request_queue_t *, struct gendisk *,
581 struct request *, int); 616 struct request *, int);
617extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *,
618 struct request *, int, rq_end_io_fn *);
619
582static inline request_queue_t *bdev_get_queue(struct block_device *bdev) 620static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
583{ 621{
584 return bdev->bd_disk->queue; 622 return bdev->bd_disk->queue;
@@ -608,8 +646,19 @@ static inline void blk_run_address_space(struct address_space *mapping)
608 */ 646 */
609extern int end_that_request_first(struct request *, int, int); 647extern int end_that_request_first(struct request *, int, int);
610extern int end_that_request_chunk(struct request *, int, int); 648extern int end_that_request_chunk(struct request *, int, int);
611extern void end_that_request_last(struct request *); 649extern void end_that_request_last(struct request *, int);
612extern void end_request(struct request *req, int uptodate); 650extern void end_request(struct request *req, int uptodate);
651extern void blk_complete_request(struct request *);
652
653static inline int rq_all_done(struct request *rq, unsigned int nr_bytes)
654{
655 if (blk_fs_request(rq))
656 return (nr_bytes >= (rq->hard_nr_sectors << 9));
657 else if (blk_pc_request(rq))
658 return nr_bytes >= rq->data_len;
659
660 return 0;
661}
613 662
614/* 663/*
615 * end_that_request_first/chunk() takes an uptodate argument. we account 664 * end_that_request_first/chunk() takes an uptodate argument. we account
@@ -658,12 +707,14 @@ extern void blk_queue_segment_boundary(request_queue_t *, unsigned long);
658extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn); 707extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn);
659extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *); 708extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *);
660extern void blk_queue_dma_alignment(request_queue_t *, int); 709extern void blk_queue_dma_alignment(request_queue_t *, int);
710extern void blk_queue_softirq_done(request_queue_t *, softirq_done_fn *);
661extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 711extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
662extern void blk_queue_ordered(request_queue_t *, int); 712extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *);
663extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *); 713extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *);
664extern struct request *blk_start_pre_flush(request_queue_t *,struct request *); 714extern int blk_do_ordered(request_queue_t *, struct request **);
665extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int); 715extern unsigned blk_ordered_cur_seq(request_queue_t *);
666extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int); 716extern unsigned blk_ordered_req_seq(struct request *);
717extern void blk_ordered_complete_seq(request_queue_t *, unsigned, int);
667 718
668extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *); 719extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *);
669extern void blk_dump_rq_flags(struct request *, char *); 720extern void blk_dump_rq_flags(struct request *, char *);
@@ -696,7 +747,8 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *);
696 747
697#define MAX_PHYS_SEGMENTS 128 748#define MAX_PHYS_SEGMENTS 128
698#define MAX_HW_SEGMENTS 128 749#define MAX_HW_SEGMENTS 128
699#define MAX_SECTORS 255 750#define SAFE_MAX_SECTORS 255
751#define BLK_DEF_MAX_SECTORS 1024
700 752
701#define MAX_SEGMENT_SIZE 65536 753#define MAX_SEGMENT_SIZE 65536
702 754
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 3b03b0b868dd..993da8cc9706 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -43,50 +43,38 @@ typedef struct bootmem_data {
43extern unsigned long __init bootmem_bootmap_pages (unsigned long); 43extern unsigned long __init bootmem_bootmap_pages (unsigned long);
44extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); 44extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend);
45extern void __init free_bootmem (unsigned long addr, unsigned long size); 45extern void __init free_bootmem (unsigned long addr, unsigned long size);
46extern void * __init __alloc_bootmem_limit (unsigned long size, unsigned long align, unsigned long goal, unsigned long limit); 46extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal);
47extern void * __init __alloc_bootmem_low(unsigned long size,
48 unsigned long align,
49 unsigned long goal);
50extern void * __init __alloc_bootmem_low_node(pg_data_t *pgdat,
51 unsigned long size,
52 unsigned long align,
53 unsigned long goal);
47#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 54#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
48extern void __init reserve_bootmem (unsigned long addr, unsigned long size); 55extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
49#define alloc_bootmem(x) \ 56#define alloc_bootmem(x) \
50 __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 57 __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
51#define alloc_bootmem_low(x) \ 58#define alloc_bootmem_low(x) \
52 __alloc_bootmem((x), SMP_CACHE_BYTES, 0) 59 __alloc_bootmem_low((x), SMP_CACHE_BYTES, 0)
53#define alloc_bootmem_pages(x) \ 60#define alloc_bootmem_pages(x) \
54 __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 61 __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
55#define alloc_bootmem_low_pages(x) \ 62#define alloc_bootmem_low_pages(x) \
56 __alloc_bootmem((x), PAGE_SIZE, 0) 63 __alloc_bootmem_low((x), PAGE_SIZE, 0)
57
58#define alloc_bootmem_limit(x, limit) \
59 __alloc_bootmem_limit((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS), (limit))
60#define alloc_bootmem_low_limit(x, limit) \
61 __alloc_bootmem_limit((x), SMP_CACHE_BYTES, 0, (limit))
62#define alloc_bootmem_pages_limit(x, limit) \
63 __alloc_bootmem_limit((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS), (limit))
64#define alloc_bootmem_low_pages_limit(x, limit) \
65 __alloc_bootmem_limit((x), PAGE_SIZE, 0, (limit))
66
67#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 64#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
68extern unsigned long __init free_all_bootmem (void); 65extern unsigned long __init free_all_bootmem (void);
69 66extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal);
70extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn); 67extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn);
71extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size); 68extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size);
72extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size); 69extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size);
73extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat); 70extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat);
74extern void * __init __alloc_bootmem_node_limit (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal, unsigned long limit);
75#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 71#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
76#define alloc_bootmem_node(pgdat, x) \ 72#define alloc_bootmem_node(pgdat, x) \
77 __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 73 __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
78#define alloc_bootmem_pages_node(pgdat, x) \ 74#define alloc_bootmem_pages_node(pgdat, x) \
79 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 75 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
80#define alloc_bootmem_low_pages_node(pgdat, x) \ 76#define alloc_bootmem_low_pages_node(pgdat, x) \
81 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0) 77 __alloc_bootmem_low_node((pgdat), (x), PAGE_SIZE, 0)
82
83#define alloc_bootmem_node_limit(pgdat, x, limit) \
84 __alloc_bootmem_node_limit((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS), (limit))
85#define alloc_bootmem_pages_node_limit(pgdat, x, limit) \
86 __alloc_bootmem_node_limit((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS), (limit))
87#define alloc_bootmem_low_pages_node_limit(pgdat, x, limit) \
88 __alloc_bootmem_node_limit((pgdat), (x), PAGE_SIZE, 0, (limit))
89
90#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 78#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
91 79
92#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP 80#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
@@ -123,15 +111,5 @@ extern void *__init alloc_large_system_hash(const char *tablename,
123#endif 111#endif
124extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */ 112extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */
125 113
126static inline void *__alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal)
127{
128 return __alloc_bootmem_limit(size, align, goal, 0);
129}
130
131static inline void *__alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align,
132 unsigned long goal)
133{
134 return __alloc_bootmem_node_limit(pgdat, size, align, goal, 0);
135}
136 114
137#endif /* _LINUX_BOOTMEM_H */ 115#endif /* _LINUX_BOOTMEM_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 1db061bb6b08..9f159baf153f 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -197,7 +197,8 @@ int block_read_full_page(struct page*, get_block_t*);
197int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); 197int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
198int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*, 198int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
199 loff_t *); 199 loff_t *);
200int generic_cont_expand(struct inode *inode, loff_t size) ; 200int generic_cont_expand(struct inode *inode, loff_t size);
201int generic_cont_expand_simple(struct inode *inode, loff_t size);
201int block_commit_write(struct page *page, unsigned from, unsigned to); 202int block_commit_write(struct page *page, unsigned from, unsigned to);
202int block_sync_page(struct page *); 203int block_sync_page(struct page *);
203sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 204sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 04bd756efc67..e86e4a938373 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -156,7 +156,7 @@ extern __be32 htonl(__u32);
156extern __u16 ntohs(__be16); 156extern __u16 ntohs(__be16);
157extern __be16 htons(__u16); 157extern __be16 htons(__u16);
158 158
159#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) 159#if defined(__GNUC__) && defined(__OPTIMIZE__)
160 160
161#define ___htonl(x) __cpu_to_be32(x) 161#define ___htonl(x) __cpu_to_be32(x)
162#define ___htons(x) __cpu_to_be16(x) 162#define ___htons(x) __cpu_to_be16(x)
diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h
index 2f1cb775125a..25f7f32883ec 100644
--- a/include/linux/byteorder/swab.h
+++ b/include/linux/byteorder/swab.h
@@ -110,7 +110,7 @@
110/* 110/*
111 * Allow constant folding 111 * Allow constant folding
112 */ 112 */
113#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) 113#if defined(__GNUC__) && defined(__OPTIMIZE__)
114# define __swab16(x) \ 114# define __swab16(x) \
115(__builtin_constant_p((__u16)(x)) ? \ 115(__builtin_constant_p((__u16)(x)) ? \
116 ___swab16((x)) : \ 116 ___swab16((x)) : \
diff --git a/include/linux/byteorder/swabb.h b/include/linux/byteorder/swabb.h
index d5f2a3205109..ae5e5f914bf4 100644
--- a/include/linux/byteorder/swabb.h
+++ b/include/linux/byteorder/swabb.h
@@ -77,7 +77,7 @@
77/* 77/*
78 * Allow constant folding 78 * Allow constant folding
79 */ 79 */
80#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) 80#if defined(__GNUC__) && defined(__OPTIMIZE__)
81# define __swahw32(x) \ 81# define __swahw32(x) \
82(__builtin_constant_p((__u32)(x)) ? \ 82(__builtin_constant_p((__u32)(x)) ? \
83 ___swahw32((x)) : \ 83 ___swahw32((x)) : \
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 0b7ecf3af78a..d22e632f41fb 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,7 +13,7 @@
13#define SMP_CACHE_BYTES L1_CACHE_BYTES 13#define SMP_CACHE_BYTES L1_CACHE_BYTES
14#endif 14#endif
15 15
16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) 16#if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64) || defined(CONFIG_PARISC)
17#define __read_mostly __attribute__((__section__(".data.read_mostly"))) 17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18#else 18#else
19#define __read_mostly 19#define __read_mostly
@@ -45,12 +45,21 @@
45#endif /* CONFIG_SMP */ 45#endif /* CONFIG_SMP */
46#endif 46#endif
47 47
48#if !defined(____cacheline_maxaligned_in_smp) 48/*
49 * The maximum alignment needed for some critical structures
50 * These could be inter-node cacheline sizes/L3 cacheline
51 * size etc. Define this in asm/cache.h for your arch
52 */
53#ifndef INTERNODE_CACHE_SHIFT
54#define INTERNODE_CACHE_SHIFT L1_CACHE_SHIFT
55#endif
56
57#if !defined(____cacheline_internodealigned_in_smp)
49#if defined(CONFIG_SMP) 58#if defined(CONFIG_SMP)
50#define ____cacheline_maxaligned_in_smp \ 59#define ____cacheline_internodealigned_in_smp \
51 __attribute__((__aligned__(1 << (L1_CACHE_SHIFT_MAX)))) 60 __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT))))
52#else 61#else
53#define ____cacheline_maxaligned_in_smp 62#define ____cacheline_internodealigned_in_smp
54#endif 63#endif
55#endif 64#endif
56 65
diff --git a/include/linux/calc64.h b/include/linux/calc64.h
new file mode 100644
index 000000000000..ebf4b8f38d88
--- /dev/null
+++ b/include/linux/calc64.h
@@ -0,0 +1,49 @@
1#ifndef _LINUX_CALC64_H
2#define _LINUX_CALC64_H
3
4#include <linux/types.h>
5#include <asm/div64.h>
6
7/*
8 * This is a generic macro which is used when the architecture
9 * specific div64.h does not provide a optimized one.
10 *
11 * The 64bit dividend is divided by the divisor (data type long), the
12 * result is returned and the remainder stored in the variable
13 * referenced by remainder (data type long *). In contrast to the
14 * do_div macro the dividend is kept intact.
15 */
16#ifndef div_long_long_rem
17#define div_long_long_rem(dividend, divisor, remainder) \
18 do_div_llr((dividend), divisor, remainder)
19
20static inline unsigned long do_div_llr(const long long dividend,
21 const long divisor, long *remainder)
22{
23 u64 result = dividend;
24
25 *(remainder) = do_div(result, divisor);
26 return (unsigned long) result;
27}
28#endif
29
30/*
31 * Sign aware variation of the above. On some architectures a
32 * negative dividend leads to an divide overflow exception, which
33 * is avoided by the sign check.
34 */
35static inline long div_long_long_rem_signed(const long long dividend,
36 const long divisor, long *remainder)
37{
38 long res;
39
40 if (unlikely(dividend < 0)) {
41 res = -div_long_long_rem(-dividend, divisor, remainder);
42 *remainder = -(*remainder);
43 } else
44 res = div_long_long_rem(dividend, divisor, remainder);
45
46 return res;
47}
48
49#endif
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 6b4618902d3d..5a23ce752629 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -43,6 +43,7 @@ typedef struct __user_cap_data_struct {
43#ifdef __KERNEL__ 43#ifdef __KERNEL__
44 44
45#include <linux/spinlock.h> 45#include <linux/spinlock.h>
46#include <asm/current.h>
46 47
47/* #define STRICT_CAP_T_TYPECHECKS */ 48/* #define STRICT_CAP_T_TYPECHECKS */
48 49
@@ -356,6 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c)
356 357
357#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) 358#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK)
358 359
360extern int capable(int cap);
361
359#endif /* __KERNEL__ */ 362#endif /* __KERNEL__ */
360 363
361#endif /* !_LINUX_CAPABILITY_H */ 364#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/asm-arm/hardware/clock.h b/include/linux/clk.h
index 19da861e523d..12848f81bb37 100644
--- a/include/asm-arm/hardware/clock.h
+++ b/include/linux/clk.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/hardware/clock.h 2 * linux/include/linux/clk.h
3 * 3 *
4 * Copyright (C) 2004 ARM Limited. 4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited. 5 * Written by Deep Blue Solutions Limited.
@@ -33,6 +33,8 @@ struct clk;
33 * uses @dev and @id to determine the clock consumer, and thereby 33 * uses @dev and @id to determine the clock consumer, and thereby
34 * the clock producer. (IOW, @id may be identical strings, but 34 * the clock producer. (IOW, @id may be identical strings, but
35 * clk_get may return different clock producers depending on @dev.) 35 * clk_get may return different clock producers depending on @dev.)
36 *
37 * Drivers must assume that the clock source is not enabled.
36 */ 38 */
37struct clk *clk_get(struct device *dev, const char *id); 39struct clk *clk_get(struct device *dev, const char *id);
38 40
@@ -49,22 +51,16 @@ int clk_enable(struct clk *clk);
49/** 51/**
50 * clk_disable - inform the system when the clock source is no longer required. 52 * clk_disable - inform the system when the clock source is no longer required.
51 * @clk: clock source 53 * @clk: clock source
52 */
53void clk_disable(struct clk *clk);
54
55/**
56 * clk_use - increment the use count
57 * @clk: clock source
58 * 54 *
59 * Returns success (0) or negative errno. 55 * Inform the system that a clock source is no longer required by
60 */ 56 * a driver and may be shut down.
61int clk_use(struct clk *clk); 57 *
62 58 * Implementation detail: if the clock source is shared between
63/** 59 * multiple drivers, clk_enable() calls must be balanced by the
64 * clk_unuse - decrement the use count 60 * same number of clk_disable() calls for the clock source to be
65 * @clk: clock source 61 * disabled.
66 */ 62 */
67void clk_unuse(struct clk *clk); 63void clk_disable(struct clk *clk);
68 64
69/** 65/**
70 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. 66 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
@@ -76,6 +72,10 @@ unsigned long clk_get_rate(struct clk *clk);
76/** 72/**
77 * clk_put - "free" the clock source 73 * clk_put - "free" the clock source
78 * @clk: clock source 74 * @clk: clock source
75 *
76 * Note: drivers must ensure that all clk_enable calls made on this
77 * clock source are balanced by clk_disable calls prior to calling
78 * this function.
79 */ 79 */
80void clk_put(struct clk *clk); 80void clk_put(struct clk *clk);
81 81
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index 119f9d064cc6..8fad50f8e389 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -2,14 +2,6 @@
2 * compatible types passed or none at all... Please include 2 * compatible types passed or none at all... Please include
3 * only stuff that is compatible on *all architectures*. 3 * only stuff that is compatible on *all architectures*.
4 */ 4 */
5#ifndef COMPATIBLE_IOCTL /* pointer to compatible structure or no argument */
6#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl)
7#endif
8
9#ifndef ULONG_IOCTL /* argument is an unsigned long integer, not a pointer */
10#define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl)
11#endif
12
13 5
14COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */ 6COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */
15COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */ 7COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */
@@ -218,32 +210,6 @@ COMPATIBLE_IOCTL(VT_RESIZE)
218COMPATIBLE_IOCTL(VT_RESIZEX) 210COMPATIBLE_IOCTL(VT_RESIZEX)
219COMPATIBLE_IOCTL(VT_LOCKSWITCH) 211COMPATIBLE_IOCTL(VT_LOCKSWITCH)
220COMPATIBLE_IOCTL(VT_UNLOCKSWITCH) 212COMPATIBLE_IOCTL(VT_UNLOCKSWITCH)
221/* Little v */
222/* Little v, the video4linux ioctls (conflict?) */
223COMPATIBLE_IOCTL(VIDIOCGCAP)
224COMPATIBLE_IOCTL(VIDIOCGCHAN)
225COMPATIBLE_IOCTL(VIDIOCSCHAN)
226COMPATIBLE_IOCTL(VIDIOCGPICT)
227COMPATIBLE_IOCTL(VIDIOCSPICT)
228COMPATIBLE_IOCTL(VIDIOCCAPTURE)
229COMPATIBLE_IOCTL(VIDIOCKEY)
230COMPATIBLE_IOCTL(VIDIOCGAUDIO)
231COMPATIBLE_IOCTL(VIDIOCSAUDIO)
232COMPATIBLE_IOCTL(VIDIOCSYNC)
233COMPATIBLE_IOCTL(VIDIOCMCAPTURE)
234COMPATIBLE_IOCTL(VIDIOCGMBUF)
235COMPATIBLE_IOCTL(VIDIOCGUNIT)
236COMPATIBLE_IOCTL(VIDIOCGCAPTURE)
237COMPATIBLE_IOCTL(VIDIOCSCAPTURE)
238/* BTTV specific... */
239COMPATIBLE_IOCTL(_IOW('v', BASE_VIDIOCPRIVATE+0, char [256]))
240COMPATIBLE_IOCTL(_IOR('v', BASE_VIDIOCPRIVATE+1, char [256]))
241COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int))
242COMPATIBLE_IOCTL(_IOW('v' , BASE_VIDIOCPRIVATE+3, char [16])) /* struct bttv_pll_info */
243COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+4, int))
244COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+5, int))
245COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+6, int))
246COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+7, int))
247/* Little p (/dev/rtc, /dev/envctrl, etc.) */ 213/* Little p (/dev/rtc, /dev/envctrl, etc.) */
248COMPATIBLE_IOCTL(RTC_AIE_ON) 214COMPATIBLE_IOCTL(RTC_AIE_ON)
249COMPATIBLE_IOCTL(RTC_AIE_OFF) 215COMPATIBLE_IOCTL(RTC_AIE_OFF)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 152734055403..6e1c44a935d4 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -11,7 +11,22 @@
11 11
12/* This macro obfuscates arithmetic on a variable address so that gcc 12/* This macro obfuscates arithmetic on a variable address so that gcc
13 shouldn't recognize the original var, and make assumptions about it */ 13 shouldn't recognize the original var, and make assumptions about it */
14/*
15 * Versions of the ppc64 compiler before 4.1 had a bug where use of
16 * RELOC_HIDE could trash r30. The bug can be worked around by changing
17 * the inline assembly constraint from =g to =r, in this particular
18 * case either is valid.
19 */
14#define RELOC_HIDE(ptr, off) \ 20#define RELOC_HIDE(ptr, off) \
15 ({ unsigned long __ptr; \ 21 ({ unsigned long __ptr; \
16 __asm__ ("" : "=g"(__ptr) : "0"(ptr)); \ 22 __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
17 (typeof(ptr)) (__ptr + (off)); }) 23 (typeof(ptr)) (__ptr + (off)); })
24
25
26#define inline inline __attribute__((always_inline))
27#define __inline__ __inline__ __attribute__((always_inline))
28#define __inline __inline __attribute__((always_inline))
29#define __deprecated __attribute__((deprecated))
30#define noinline __attribute__((noinline))
31#define __attribute_pure__ __attribute__((pure))
32#define __attribute_const__ __attribute__((__const__))
diff --git a/include/linux/compiler-gcc2.h b/include/linux/compiler-gcc2.h
deleted file mode 100644
index ebed17660c5f..000000000000
--- a/include/linux/compiler-gcc2.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* Never include this file directly. Include <linux/compiler.h> instead. */
2
3/* These definitions are for GCC v2.x. */
4
5/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
6 a mechanism by which the user can annotate likely branch directions and
7 expect the blocks to be reordered appropriately. Define __builtin_expect
8 to nothing for earlier compilers. */
9#include <linux/compiler-gcc.h>
10
11#if __GNUC_MINOR__ < 96
12# define __builtin_expect(x, expected_value) (x)
13#endif
14
15#define __attribute_used__ __attribute__((__unused__))
16
17/*
18 * The attribute `pure' is not implemented in GCC versions earlier
19 * than 2.96.
20 */
21#if __GNUC_MINOR__ >= 96
22# define __attribute_pure__ __attribute__((pure))
23# define __attribute_const__ __attribute__((__const__))
24#endif
25
26/* GCC 2.95.x/2.96 recognize __va_copy, but not va_copy. Actually later GCC's
27 * define both va_copy and __va_copy, but the latter may go away, so limit this
28 * to this header */
29#define va_copy __va_copy
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index a6fa615afab5..4209082ee934 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -3,29 +3,12 @@
3/* These definitions are for GCC v3.x. */ 3/* These definitions are for GCC v3.x. */
4#include <linux/compiler-gcc.h> 4#include <linux/compiler-gcc.h>
5 5
6#if __GNUC_MINOR__ >= 1
7# define inline inline __attribute__((always_inline))
8# define __inline__ __inline__ __attribute__((always_inline))
9# define __inline __inline __attribute__((always_inline))
10#endif
11
12#if __GNUC_MINOR__ > 0
13# define __deprecated __attribute__((deprecated))
14#endif
15
16#if __GNUC_MINOR__ >= 3 6#if __GNUC_MINOR__ >= 3
17# define __attribute_used__ __attribute__((__used__)) 7# define __attribute_used__ __attribute__((__used__))
18#else 8#else
19# define __attribute_used__ __attribute__((__unused__)) 9# define __attribute_used__ __attribute__((__unused__))
20#endif 10#endif
21 11
22#define __attribute_pure__ __attribute__((pure))
23#define __attribute_const__ __attribute__((__const__))
24
25#if __GNUC_MINOR__ >= 1
26#define noinline __attribute__((noinline))
27#endif
28
29#if __GNUC_MINOR__ >= 4 12#if __GNUC_MINOR__ >= 4
30#define __must_check __attribute__((warn_unused_result)) 13#define __must_check __attribute__((warn_unused_result))
31#endif 14#endif
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 53686c037a06..e913e9beaf69 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -3,14 +3,7 @@
3/* These definitions are for GCC v4.x. */ 3/* These definitions are for GCC v4.x. */
4#include <linux/compiler-gcc.h> 4#include <linux/compiler-gcc.h>
5 5
6#define inline inline __attribute__((always_inline))
7#define __inline__ __inline__ __attribute__((always_inline))
8#define __inline __inline __attribute__((always_inline))
9#define __deprecated __attribute__((deprecated))
10#define __attribute_used__ __attribute__((__used__)) 6#define __attribute_used__ __attribute__((__used__))
11#define __attribute_pure__ __attribute__((pure))
12#define __attribute_const__ __attribute__((__const__))
13#define noinline __attribute__((noinline))
14#define __must_check __attribute__((warn_unused_result)) 7#define __must_check __attribute__((warn_unused_result))
15#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 8#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
16 9
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index d7378215b851..f23d3c6fc2c0 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -42,8 +42,6 @@ extern void __chk_io_ptr(void __iomem *);
42# include <linux/compiler-gcc4.h> 42# include <linux/compiler-gcc4.h>
43#elif __GNUC__ == 3 43#elif __GNUC__ == 3
44# include <linux/compiler-gcc3.h> 44# include <linux/compiler-gcc3.h>
45#elif __GNUC__ == 2
46# include <linux/compiler-gcc2.h>
47#else 45#else
48# error Sorry, your compiler is too old/not recognized. 46# error Sorry, your compiler is too old/not recognized.
49#endif 47#endif
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
new file mode 100644
index 000000000000..acffb8c9073a
--- /dev/null
+++ b/include/linux/configfs.h
@@ -0,0 +1,205 @@
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * configfs.h - definitions for the device driver filesystem
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (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 GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 021110-1307, USA.
20 *
21 * Based on sysfs:
22 * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
23 *
24 * Based on kobject.h:
25 * Copyright (c) 2002-2003 Patrick Mochel
26 * Copyright (c) 2002-2003 Open Source Development Labs
27 *
28 * configfs Copyright (C) 2005 Oracle. All rights reserved.
29 *
30 * Please read Documentation/filesystems/configfs.txt before using the
31 * configfs interface, ESPECIALLY the parts about reference counts and
32 * item destructors.
33 */
34
35#ifndef _CONFIGFS_H_
36#define _CONFIGFS_H_
37
38#ifdef __KERNEL__
39
40#include <linux/types.h>
41#include <linux/list.h>
42#include <linux/kref.h>
43
44#include <asm/atomic.h>
45#include <asm/semaphore.h>
46
47#define CONFIGFS_ITEM_NAME_LEN 20
48
49struct module;
50
51struct configfs_item_operations;
52struct configfs_group_operations;
53struct configfs_attribute;
54struct configfs_subsystem;
55
56struct config_item {
57 char *ci_name;
58 char ci_namebuf[CONFIGFS_ITEM_NAME_LEN];
59 struct kref ci_kref;
60 struct list_head ci_entry;
61 struct config_item *ci_parent;
62 struct config_group *ci_group;
63 struct config_item_type *ci_type;
64 struct dentry *ci_dentry;
65};
66
67extern int config_item_set_name(struct config_item *, const char *, ...);
68
69static inline char *config_item_name(struct config_item * item)
70{
71 return item->ci_name;
72}
73
74extern void config_item_init(struct config_item *);
75extern void config_item_init_type_name(struct config_item *item,
76 const char *name,
77 struct config_item_type *type);
78extern void config_item_cleanup(struct config_item *);
79
80extern struct config_item * config_item_get(struct config_item *);
81extern void config_item_put(struct config_item *);
82
83struct config_item_type {
84 struct module *ct_owner;
85 struct configfs_item_operations *ct_item_ops;
86 struct configfs_group_operations *ct_group_ops;
87 struct configfs_attribute **ct_attrs;
88};
89
90
91/**
92 * group - a group of config_items of a specific type, belonging
93 * to a specific subsystem.
94 */
95
96struct config_group {
97 struct config_item cg_item;
98 struct list_head cg_children;
99 struct configfs_subsystem *cg_subsys;
100 struct config_group **default_groups;
101};
102
103
104extern void config_group_init(struct config_group *group);
105extern void config_group_init_type_name(struct config_group *group,
106 const char *name,
107 struct config_item_type *type);
108
109
110static inline struct config_group *to_config_group(struct config_item *item)
111{
112 return item ? container_of(item,struct config_group,cg_item) : NULL;
113}
114
115static inline struct config_group *config_group_get(struct config_group *group)
116{
117 return group ? to_config_group(config_item_get(&group->cg_item)) : NULL;
118}
119
120static inline void config_group_put(struct config_group *group)
121{
122 config_item_put(&group->cg_item);
123}
124
125extern struct config_item *config_group_find_obj(struct config_group *, const char *);
126
127
128struct configfs_attribute {
129 char *ca_name;
130 struct module *ca_owner;
131 mode_t ca_mode;
132};
133
134
135/*
136 * If allow_link() exists, the item can symlink(2) out to other
137 * items. If the item is a group, it may support mkdir(2).
138 * Groups supply one of make_group() and make_item(). If the
139 * group supports make_group(), one can create group children. If it
140 * supports make_item(), one can create config_item children. If it has
141 * default_groups on group->default_groups, it has automatically created
142 * group children. default_groups may coexist alongsize make_group() or
143 * make_item(), but if the group wishes to have only default_groups
144 * children (disallowing mkdir(2)), it need not provide either function.
145 * If the group has commit(), it supports pending and commited (active)
146 * items.
147 */
148struct configfs_item_operations {
149 void (*release)(struct config_item *);
150 ssize_t (*show_attribute)(struct config_item *, struct configfs_attribute *,char *);
151 ssize_t (*store_attribute)(struct config_item *,struct configfs_attribute *,const char *, size_t);
152 int (*allow_link)(struct config_item *src, struct config_item *target);
153 int (*drop_link)(struct config_item *src, struct config_item *target);
154};
155
156struct configfs_group_operations {
157 struct config_item *(*make_item)(struct config_group *group, const char *name);
158 struct config_group *(*make_group)(struct config_group *group, const char *name);
159 int (*commit_item)(struct config_item *item);
160 void (*drop_item)(struct config_group *group, struct config_item *item);
161};
162
163
164
165/**
166 * Use these macros to make defining attributes easier. See include/linux/device.h
167 * for examples..
168 */
169
170#if 0
171#define __ATTR(_name,_mode,_show,_store) { \
172 .attr = {.ca_name = __stringify(_name), .ca_mode = _mode, .ca_owner = THIS_MODULE }, \
173 .show = _show, \
174 .store = _store, \
175}
176
177#define __ATTR_RO(_name) { \
178 .attr = { .ca_name = __stringify(_name), .ca_mode = 0444, .ca_owner = THIS_MODULE }, \
179 .show = _name##_show, \
180}
181
182#define __ATTR_NULL { .attr = { .name = NULL } }
183
184#define attr_name(_attr) (_attr).attr.name
185#endif
186
187
188struct configfs_subsystem {
189 struct config_group su_group;
190 struct semaphore su_sem;
191};
192
193static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group)
194{
195 return group ?
196 container_of(group, struct configfs_subsystem, su_group) :
197 NULL;
198}
199
200int configfs_register_subsystem(struct configfs_subsystem *subsys);
201void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
202
203#endif /* __KERNEL__ */
204
205#endif /* _CONFIGFS_H_ */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index d068176b7ad7..c31650df9241 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -256,6 +256,16 @@ int cpufreq_update_policy(unsigned int cpu);
256/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ 256/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
257unsigned int cpufreq_get(unsigned int cpu); 257unsigned int cpufreq_get(unsigned int cpu);
258 258
259/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
260#ifdef CONFIG_CPU_FREQ
261unsigned int cpufreq_quick_get(unsigned int cpu);
262#else
263static inline unsigned int cpufreq_quick_get(unsigned int cpu)
264{
265 return 0;
266}
267#endif
268
259 269
260/********************************************************************* 270/*********************************************************************
261 * CPUFREQ DEFAULT GOVERNOR * 271 * CPUFREQ DEFAULT GOVERNOR *
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 6e2deef96b34..c472f972bd6d 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -14,22 +14,43 @@
14 14
15#ifdef CONFIG_CPUSETS 15#ifdef CONFIG_CPUSETS
16 16
17extern int number_of_cpusets; /* How many cpusets are defined in system? */
18
19extern int cpuset_init_early(void);
17extern int cpuset_init(void); 20extern int cpuset_init(void);
18extern void cpuset_init_smp(void); 21extern void cpuset_init_smp(void);
19extern void cpuset_fork(struct task_struct *p); 22extern void cpuset_fork(struct task_struct *p);
20extern void cpuset_exit(struct task_struct *p); 23extern void cpuset_exit(struct task_struct *p);
21extern cpumask_t cpuset_cpus_allowed(const struct task_struct *p); 24extern cpumask_t cpuset_cpus_allowed(struct task_struct *p);
25extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
22void cpuset_init_current_mems_allowed(void); 26void cpuset_init_current_mems_allowed(void);
23void cpuset_update_current_mems_allowed(void); 27void cpuset_update_task_memory_state(void);
24void cpuset_restrict_to_mems_allowed(unsigned long *nodes); 28#define cpuset_nodes_subset_current_mems_allowed(nodes) \
29 nodes_subset((nodes), current->mems_allowed)
25int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); 30int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl);
26extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask); 31
32extern int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask);
33static int inline cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
34{
35 return number_of_cpusets <= 1 || __cpuset_zone_allowed(z, gfp_mask);
36}
37
27extern int cpuset_excl_nodes_overlap(const struct task_struct *p); 38extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
39
40#define cpuset_memory_pressure_bump() \
41 do { \
42 if (cpuset_memory_pressure_enabled) \
43 __cpuset_memory_pressure_bump(); \
44 } while (0)
45extern int cpuset_memory_pressure_enabled;
46extern void __cpuset_memory_pressure_bump(void);
47
28extern struct file_operations proc_cpuset_operations; 48extern struct file_operations proc_cpuset_operations;
29extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); 49extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
30 50
31#else /* !CONFIG_CPUSETS */ 51#else /* !CONFIG_CPUSETS */
32 52
53static inline int cpuset_init_early(void) { return 0; }
33static inline int cpuset_init(void) { return 0; } 54static inline int cpuset_init(void) { return 0; }
34static inline void cpuset_init_smp(void) {} 55static inline void cpuset_init_smp(void) {}
35static inline void cpuset_fork(struct task_struct *p) {} 56static inline void cpuset_fork(struct task_struct *p) {}
@@ -40,9 +61,14 @@ static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p)
40 return cpu_possible_map; 61 return cpu_possible_map;
41} 62}
42 63
64static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
65{
66 return node_possible_map;
67}
68
43static inline void cpuset_init_current_mems_allowed(void) {} 69static inline void cpuset_init_current_mems_allowed(void) {}
44static inline void cpuset_update_current_mems_allowed(void) {} 70static inline void cpuset_update_task_memory_state(void) {}
45static inline void cpuset_restrict_to_mems_allowed(unsigned long *nodes) {} 71#define cpuset_nodes_subset_current_mems_allowed(nodes) (1)
46 72
47static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) 73static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
48{ 74{
@@ -59,6 +85,8 @@ static inline int cpuset_excl_nodes_overlap(const struct task_struct *p)
59 return 1; 85 return 1;
60} 86}
61 87
88static inline void cpuset_memory_pressure_bump(void) {}
89
62static inline char *cpuset_task_status_allowed(struct task_struct *task, 90static inline char *cpuset_task_status_allowed(struct task_struct *task,
63 char *buffer) 91 char *buffer)
64{ 92{
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 3c89df6e7768..d88bf8aa8b47 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> 4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
5 * Copyright (c) 2002 David S. Miller (davem@redhat.com) 5 * Copyright (c) 2002 David S. Miller (davem@redhat.com)
6 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>
6 * 7 *
7 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no> 8 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no>
8 * and Nettle, by Niels Möller. 9 * and Nettle, by Niels Möller.
@@ -126,7 +127,11 @@ struct crypto_alg {
126 unsigned int cra_blocksize; 127 unsigned int cra_blocksize;
127 unsigned int cra_ctxsize; 128 unsigned int cra_ctxsize;
128 unsigned int cra_alignmask; 129 unsigned int cra_alignmask;
130
131 int cra_priority;
132
129 const char cra_name[CRYPTO_MAX_ALG_NAME]; 133 const char cra_name[CRYPTO_MAX_ALG_NAME];
134 const char cra_driver_name[CRYPTO_MAX_ALG_NAME];
130 135
131 union { 136 union {
132 struct cipher_alg cipher; 137 struct cipher_alg cipher;
diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h
index b10a7f3a8cac..f7a906583463 100644
--- a/include/linux/cycx_x25.h
+++ b/include/linux/cycx_x25.h
@@ -38,11 +38,11 @@ extern unsigned int cycx_debug;
38/* Data Structures */ 38/* Data Structures */
39/* X.25 Command Block. */ 39/* X.25 Command Block. */
40struct cycx_x25_cmd { 40struct cycx_x25_cmd {
41 u16 command PACKED; 41 u16 command;
42 u16 link PACKED; /* values: 0 or 1 */ 42 u16 link; /* values: 0 or 1 */
43 u16 len PACKED; /* values: 0 thru 0x205 (517) */ 43 u16 len; /* values: 0 thru 0x205 (517) */
44 u32 buf PACKED; 44 u32 buf;
45}; 45} PACKED;
46 46
47/* Defines for the 'command' field. */ 47/* Defines for the 'command' field. */
48#define X25_CONNECT_REQUEST 0x4401 48#define X25_CONNECT_REQUEST 0x4401
@@ -92,34 +92,34 @@ struct cycx_x25_cmd {
92 * @flags - see dosx25.doc, in portuguese, for details 92 * @flags - see dosx25.doc, in portuguese, for details
93 */ 93 */
94struct cycx_x25_config { 94struct cycx_x25_config {
95 u8 link PACKED; 95 u8 link;
96 u8 speed PACKED; 96 u8 speed;
97 u8 clock PACKED; 97 u8 clock;
98 u8 n2 PACKED; 98 u8 n2;
99 u8 n2win PACKED; 99 u8 n2win;
100 u8 n3win PACKED; 100 u8 n3win;
101 u8 nvc PACKED; 101 u8 nvc;
102 u8 pktlen PACKED; 102 u8 pktlen;
103 u8 locaddr PACKED; 103 u8 locaddr;
104 u8 remaddr PACKED; 104 u8 remaddr;
105 u16 t1 PACKED; 105 u16 t1;
106 u16 t2 PACKED; 106 u16 t2;
107 u8 t21 PACKED; 107 u8 t21;
108 u8 npvc PACKED; 108 u8 npvc;
109 u8 t23 PACKED; 109 u8 t23;
110 u8 flags PACKED; 110 u8 flags;
111}; 111} PACKED;
112 112
113struct cycx_x25_stats { 113struct cycx_x25_stats {
114 u16 rx_crc_errors PACKED; 114 u16 rx_crc_errors;
115 u16 rx_over_errors PACKED; 115 u16 rx_over_errors;
116 u16 n2_tx_frames PACKED; 116 u16 n2_tx_frames;
117 u16 n2_rx_frames PACKED; 117 u16 n2_rx_frames;
118 u16 tx_timeouts PACKED; 118 u16 tx_timeouts;
119 u16 rx_timeouts PACKED; 119 u16 rx_timeouts;
120 u16 n3_tx_packets PACKED; 120 u16 n3_tx_packets;
121 u16 n3_rx_packets PACKED; 121 u16 n3_rx_packets;
122 u16 tx_aborts PACKED; 122 u16 tx_aborts;
123 u16 rx_aborts PACKED; 123 u16 rx_aborts;
124}; 124} PACKED;
125#endif /* _CYCX_X25_H */ 125#endif /* _CYCX_X25_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 46a2ba617595..a3ed5e059d47 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -95,14 +95,19 @@ struct dentry {
95 struct qstr d_name; 95 struct qstr d_name;
96 96
97 struct list_head d_lru; /* LRU list */ 97 struct list_head d_lru; /* LRU list */
98 struct list_head d_child; /* child of parent list */ 98 /*
99 * d_child and d_rcu can share memory
100 */
101 union {
102 struct list_head d_child; /* child of parent list */
103 struct rcu_head d_rcu;
104 } d_u;
99 struct list_head d_subdirs; /* our children */ 105 struct list_head d_subdirs; /* our children */
100 struct list_head d_alias; /* inode alias list */ 106 struct list_head d_alias; /* inode alias list */
101 unsigned long d_time; /* used by d_revalidate */ 107 unsigned long d_time; /* used by d_revalidate */
102 struct dentry_operations *d_op; 108 struct dentry_operations *d_op;
103 struct super_block *d_sb; /* The root of the dentry tree */ 109 struct super_block *d_sb; /* The root of the dentry tree */
104 void *d_fsdata; /* fs-specific data */ 110 void *d_fsdata; /* fs-specific data */
105 struct rcu_head d_rcu;
106 struct dcookie_struct *d_cookie; /* cookie, if any */ 111 struct dcookie_struct *d_cookie; /* cookie, if any */
107 int d_mounted; 112 int d_mounted;
108 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ 113 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 71fab4311e92..088529f54965 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -192,10 +192,9 @@ enum {
192#include <linux/workqueue.h> 192#include <linux/workqueue.h>
193 193
194#include <net/inet_connection_sock.h> 194#include <net/inet_connection_sock.h>
195#include <net/inet_sock.h>
195#include <net/inet_timewait_sock.h> 196#include <net/inet_timewait_sock.h>
196#include <net/sock.h>
197#include <net/tcp_states.h> 197#include <net/tcp_states.h>
198#include <net/tcp.h>
199 198
200enum dccp_state { 199enum dccp_state {
201 DCCP_OPEN = TCP_ESTABLISHED, 200 DCCP_OPEN = TCP_ESTABLISHED,
@@ -408,8 +407,6 @@ struct dccp_ackvec;
408 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss 407 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
409 * @dccps_timestamp_time - time of latest TIMESTAMP option 408 * @dccps_timestamp_time - time of latest TIMESTAMP option
410 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 409 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
411 * @dccps_ext_header_len - network protocol overhead (IP/IPv6 options)
412 * @dccps_pmtu_cookie - Last pmtu seen by socket
413 * @dccps_packet_size - Set thru setsockopt 410 * @dccps_packet_size - Set thru setsockopt
414 * @dccps_role - Role of this sock, one of %dccp_role 411 * @dccps_role - Role of this sock, one of %dccp_role
415 * @dccps_ndp_count - number of Non Data Packets since last data packet 412 * @dccps_ndp_count - number of Non Data Packets since last data packet
@@ -434,8 +431,6 @@ struct dccp_sock {
434 __u32 dccps_timestamp_echo; 431 __u32 dccps_timestamp_echo;
435 __u32 dccps_packet_size; 432 __u32 dccps_packet_size;
436 unsigned long dccps_ndp_count; 433 unsigned long dccps_ndp_count;
437 __u16 dccps_ext_header_len;
438 __u32 dccps_pmtu_cookie;
439 __u32 dccps_mss_cache; 434 __u32 dccps_mss_cache;
440 struct dccp_options dccps_options; 435 struct dccp_options dccps_options;
441 struct dccp_ackvec *dccps_hc_rx_ackvec; 436 struct dccp_ackvec *dccps_hc_rx_ackvec;
diff --git a/include/linux/device.h b/include/linux/device.h
index 17cbc6db67b4..0cdee78e5ce1 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -47,8 +47,8 @@ struct bus_type {
47 struct driver_attribute * drv_attrs; 47 struct driver_attribute * drv_attrs;
48 48
49 int (*match)(struct device * dev, struct device_driver * drv); 49 int (*match)(struct device * dev, struct device_driver * drv);
50 int (*hotplug) (struct device *dev, char **envp, 50 int (*uevent)(struct device *dev, char **envp,
51 int num_envp, char *buffer, int buffer_size); 51 int num_envp, char *buffer, int buffer_size);
52 int (*suspend)(struct device * dev, pm_message_t state); 52 int (*suspend)(struct device * dev, pm_message_t state);
53 int (*resume)(struct device * dev); 53 int (*resume)(struct device * dev);
54}; 54};
@@ -151,7 +151,7 @@ struct class {
151 struct class_attribute * class_attrs; 151 struct class_attribute * class_attrs;
152 struct class_device_attribute * class_dev_attrs; 152 struct class_device_attribute * class_dev_attrs;
153 153
154 int (*hotplug)(struct class_device *dev, char **envp, 154 int (*uevent)(struct class_device *dev, char **envp,
155 int num_envp, char *buffer, int buffer_size); 155 int num_envp, char *buffer, int buffer_size);
156 156
157 void (*release)(struct class_device *dev); 157 void (*release)(struct class_device *dev);
@@ -209,9 +209,9 @@ extern int class_device_create_file(struct class_device *,
209 * set, this will be called instead of the class specific release function. 209 * set, this will be called instead of the class specific release function.
210 * Only use this if you want to override the default release function, like 210 * Only use this if you want to override the default release function, like
211 * when you are nesting class_device structures. 211 * when you are nesting class_device structures.
212 * @hotplug: pointer to a hotplug function for this struct class_device. If 212 * @uevent: pointer to a uevent function for this struct class_device. If
213 * set, this will be called instead of the class specific hotplug function. 213 * set, this will be called instead of the class specific uevent function.
214 * Only use this if you want to override the default hotplug function, like 214 * Only use this if you want to override the default uevent function, like
215 * when you are nesting class_device structures. 215 * when you are nesting class_device structures.
216 */ 216 */
217struct class_device { 217struct class_device {
@@ -227,7 +227,7 @@ struct class_device {
227 struct class_device *parent; /* parent of this child device, if there is one */ 227 struct class_device *parent; /* parent of this child device, if there is one */
228 228
229 void (*release)(struct class_device *dev); 229 void (*release)(struct class_device *dev);
230 int (*hotplug)(struct class_device *dev, char **envp, 230 int (*uevent)(struct class_device *dev, char **envp,
231 int num_envp, char *buffer, int buffer_size); 231 int num_envp, char *buffer, int buffer_size);
232 char class_id[BUS_ID_SIZE]; /* unique to this class */ 232 char class_id[BUS_ID_SIZE]; /* unique to this class */
233}; 233};
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index f5eb6b6cd109..fa75ba0d635e 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -272,9 +272,9 @@ typedef char ioctl_struct[308];
272#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) 272#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
273 273
274#define DM_VERSION_MAJOR 4 274#define DM_VERSION_MAJOR 4
275#define DM_VERSION_MINOR 4 275#define DM_VERSION_MINOR 5
276#define DM_VERSION_PATCHLEVEL 0 276#define DM_VERSION_PATCHLEVEL 0
277#define DM_VERSION_EXTRA "-ioctl (2005-01-12)" 277#define DM_VERSION_EXTRA "-ioctl (2005-10-04)"
278 278
279/* Status bits */ 279/* Status bits */
280#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 280#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -301,8 +301,13 @@ typedef char ioctl_struct[308];
301#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */ 301#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */
302 302
303/* 303/*
304 * Set this to improve performance when you aren't going to use open_count 304 * Set this to improve performance when you aren't going to use open_count.
305 */ 305 */
306#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */ 306#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */
307 307
308/*
309 * Set this to avoid attempting to freeze any filesystem when suspending.
310 */
311#define DM_SKIP_LOCKFS_FLAG (1 << 10) /* In */
312
308#endif /* _LINUX_DM_IOCTL_H */ 313#endif /* _LINUX_DM_IOCTL_H */
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 05f4132622fc..2e6bbe014157 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -2,6 +2,7 @@
2#define __DMI_H__ 2#define __DMI_H__
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/config.h>
5 6
6enum dmi_field { 7enum dmi_field {
7 DMI_NONE, 8 DMI_NONE,
@@ -60,12 +61,14 @@ struct dmi_device {
60 void *device_data; /* Type specific data */ 61 void *device_data; /* Type specific data */
61}; 62};
62 63
63#if defined(CONFIG_X86_32) 64#ifdef CONFIG_DMI
64 65
65extern int dmi_check_system(struct dmi_system_id *list); 66extern int dmi_check_system(struct dmi_system_id *list);
66extern char * dmi_get_system_info(int field); 67extern char * dmi_get_system_info(int field);
67extern struct dmi_device * dmi_find_device(int type, const char *name, 68extern struct dmi_device * dmi_find_device(int type, const char *name,
68 struct dmi_device *from); 69 struct dmi_device *from);
70extern void dmi_scan_machine(void);
71
69#else 72#else
70 73
71static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } 74static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index d41df7047ed7..c8cbd90ba375 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -240,6 +240,15 @@ struct dvb_frontend_event {
240}; 240};
241 241
242 242
243/**
244 * When set, this flag will disable any zigzagging or other "normal" tuning
245 * behaviour. Additionally, there will be no automatic monitoring of the lock
246 * status, and hence no frontend events will be generated. If a frontend device
247 * is closed, this flag will be automatically turned off when the device is
248 * reopened read-write.
249 */
250#define FE_TUNE_MODE_ONESHOT 0x01
251
243 252
244#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info) 253#define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info)
245 254
@@ -260,6 +269,7 @@ struct dvb_frontend_event {
260 269
261#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) 270#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters)
262#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) 271#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters)
272#define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */
263#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event) 273#define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event)
264 274
265#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */ 275#define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index a74c27e460ba..23fe746a1d51 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -66,7 +66,7 @@ struct elevator_type
66}; 66};
67 67
68/* 68/*
69 * each queue has an elevator_queue assoicated with it 69 * each queue has an elevator_queue associated with it
70 */ 70 */
71struct elevator_queue 71struct elevator_queue
72{ 72{
@@ -114,8 +114,6 @@ extern ssize_t elv_iosched_store(request_queue_t *, const char *, size_t);
114extern int elevator_init(request_queue_t *, char *); 114extern int elevator_init(request_queue_t *, char *);
115extern void elevator_exit(elevator_t *); 115extern void elevator_exit(elevator_t *);
116extern int elv_rq_merge_ok(struct request *, struct bio *); 116extern int elv_rq_merge_ok(struct request *, struct bio *);
117extern int elv_try_merge(struct request *, struct bio *);
118extern int elv_try_last_merge(request_queue_t *, struct bio *);
119 117
120/* 118/*
121 * Return values from elevator merger 119 * Return values from elevator merger
@@ -130,6 +128,7 @@ extern int elv_try_last_merge(request_queue_t *, struct bio *);
130#define ELEVATOR_INSERT_FRONT 1 128#define ELEVATOR_INSERT_FRONT 1
131#define ELEVATOR_INSERT_BACK 2 129#define ELEVATOR_INSERT_BACK 2
132#define ELEVATOR_INSERT_SORT 3 130#define ELEVATOR_INSERT_SORT 3
131#define ELEVATOR_INSERT_REQUEUE 4
133 132
134/* 133/*
135 * return values from elevator_may_queue_fn 134 * return values from elevator_may_queue_fn
diff --git a/include/linux/elf.h b/include/linux/elf.h
index ff955dbf510d..d3bfacb24496 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -151,6 +151,8 @@ typedef __s64 Elf64_Sxword;
151#define STT_FUNC 2 151#define STT_FUNC 2
152#define STT_SECTION 3 152#define STT_SECTION 3
153#define STT_FILE 4 153#define STT_FILE 4
154#define STT_COMMON 5
155#define STT_TLS 6
154 156
155#define ELF_ST_BIND(x) ((x) >> 4) 157#define ELF_ST_BIND(x) ((x) >> 4)
156#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) 158#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 5f49a30eb6f2..745c988359c0 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -63,10 +63,11 @@ static inline int is_zero_ether_addr(const u8 *addr)
63 * @addr: Pointer to a six-byte array containing the Ethernet address 63 * @addr: Pointer to a six-byte array containing the Ethernet address
64 * 64 *
65 * Return true if the address is a multicast address. 65 * Return true if the address is a multicast address.
66 * By definition the broadcast address is also a multicast address.
66 */ 67 */
67static inline int is_multicast_ether_addr(const u8 *addr) 68static inline int is_multicast_ether_addr(const u8 *addr)
68{ 69{
69 return ((addr[0] != 0xff) && (0x01 & addr[0])); 70 return (0x01 & addr[0]);
70} 71}
71 72
72/** 73/**
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index 2914f7b07156..e71dd98dbcae 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -87,7 +87,7 @@ struct ext3_inode_info {
87#ifdef CONFIG_EXT3_FS_XATTR 87#ifdef CONFIG_EXT3_FS_XATTR
88 /* 88 /*
89 * Extended attributes can be read independently of the main file 89 * Extended attributes can be read independently of the main file
90 * data. Taking i_sem even when reading would cause contention 90 * data. Taking i_mutex even when reading would cause contention
91 * between readers of EAs and writers of regular file data, so 91 * between readers of EAs and writers of regular file data, so
92 * instead we synchronize on xattr_sem when reading or changing 92 * instead we synchronize on xattr_sem when reading or changing
93 * EAs. 93 * EAs.
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 3ba843c46382..c6cb8f095088 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -143,7 +143,7 @@ static inline unsigned int sk_filter_len(struct sk_filter *fp)
143struct sk_buff; 143struct sk_buff;
144struct sock; 144struct sock;
145 145
146extern int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen); 146extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen);
147extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 147extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
148extern int sk_chk_filter(struct sock_filter *filter, int flen); 148extern int sk_chk_filter(struct sock_filter *filter, int flen);
149#endif /* __KERNEL__ */ 149#endif /* __KERNEL__ */
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 2063c0839d4f..2d716080be4a 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -14,7 +14,7 @@ struct device;
14int request_firmware(const struct firmware **fw, const char *name, 14int request_firmware(const struct firmware **fw, const char *name,
15 struct device *device); 15 struct device *device);
16int request_firmware_nowait( 16int request_firmware_nowait(
17 struct module *module, int hotplug, 17 struct module *module, int uevent,
18 const char *name, struct device *device, void *context, 18 const char *name, struct device *device, void *context,
19 void (*cont)(const struct firmware *fw, void *context)); 19 void (*cont)(const struct firmware *fw, void *context));
20 20
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cc35b6ac778d..d1e370d25f7b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -9,7 +9,6 @@
9#include <linux/config.h> 9#include <linux/config.h>
10#include <linux/limits.h> 10#include <linux/limits.h>
11#include <linux/ioctl.h> 11#include <linux/ioctl.h>
12#include <linux/rcuref.h>
13 12
14/* 13/*
15 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -104,19 +103,18 @@ extern int dir_notify_enable;
104#define MS_MOVE 8192 103#define MS_MOVE 8192
105#define MS_REC 16384 104#define MS_REC 16384
106#define MS_VERBOSE 32768 105#define MS_VERBOSE 32768
106#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
107#define MS_UNBINDABLE (1<<17) /* change to unbindable */ 107#define MS_UNBINDABLE (1<<17) /* change to unbindable */
108#define MS_PRIVATE (1<<18) /* change to private */ 108#define MS_PRIVATE (1<<18) /* change to private */
109#define MS_SLAVE (1<<19) /* change to slave */ 109#define MS_SLAVE (1<<19) /* change to slave */
110#define MS_SHARED (1<<20) /* change to shared */ 110#define MS_SHARED (1<<20) /* change to shared */
111#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
112#define MS_ACTIVE (1<<30) 111#define MS_ACTIVE (1<<30)
113#define MS_NOUSER (1<<31) 112#define MS_NOUSER (1<<31)
114 113
115/* 114/*
116 * Superblock flags that can be altered by MS_REMOUNT 115 * Superblock flags that can be altered by MS_REMOUNT
117 */ 116 */
118#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|\ 117#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK)
119 MS_NODIRATIME)
120 118
121/* 119/*
122 * Old magic mount flag and mask 120 * Old magic mount flag and mask
@@ -162,8 +160,6 @@ extern int dir_notify_enable;
162#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) 160#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
163#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) 161#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
164#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) 162#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
165#define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME))
166#define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME)
167#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) 163#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
168 164
169#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) 165#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
@@ -220,11 +216,13 @@ extern int dir_notify_enable;
220#include <linux/prio_tree.h> 216#include <linux/prio_tree.h>
221#include <linux/init.h> 217#include <linux/init.h>
222#include <linux/sched.h> 218#include <linux/sched.h>
219#include <linux/mutex.h>
223 220
224#include <asm/atomic.h> 221#include <asm/atomic.h>
225#include <asm/semaphore.h> 222#include <asm/semaphore.h>
226#include <asm/byteorder.h> 223#include <asm/byteorder.h>
227 224
225struct hd_geometry;
228struct iovec; 226struct iovec;
229struct nameidata; 227struct nameidata;
230struct kiocb; 228struct kiocb;
@@ -234,9 +232,6 @@ struct kstatfs;
234struct vm_area_struct; 232struct vm_area_struct;
235struct vfsmount; 233struct vfsmount;
236 234
237/* Used to be a macro which just called the function, now just a function */
238extern void update_atime (struct inode *);
239
240extern void __init inode_init(unsigned long); 235extern void __init inode_init(unsigned long);
241extern void __init inode_init_early(void); 236extern void __init inode_init_early(void);
242extern void __init mnt_init(unsigned long); 237extern void __init mnt_init(unsigned long);
@@ -302,6 +297,37 @@ struct iattr {
302 */ 297 */
303#include <linux/quota.h> 298#include <linux/quota.h>
304 299
300/**
301 * enum positive_aop_returns - aop return codes with specific semantics
302 *
303 * @AOP_WRITEPAGE_ACTIVATE: Informs the caller that page writeback has
304 * completed, that the page is still locked, and
305 * should be considered active. The VM uses this hint
306 * to return the page to the active list -- it won't
307 * be a candidate for writeback again in the near
308 * future. Other callers must be careful to unlock
309 * the page if they get this return. Returned by
310 * writepage();
311 *
312 * @AOP_TRUNCATED_PAGE: The AOP method that was handed a locked page has
313 * unlocked it and the page might have been truncated.
314 * The caller should back up to acquiring a new page and
315 * trying again. The aop will be taking reasonable
316 * precautions not to livelock. If the caller held a page
317 * reference, it should drop it before retrying. Returned
318 * by readpage(), prepare_write(), and commit_write().
319 *
320 * address_space_operation functions return these large constants to indicate
321 * special semantics to the caller. These are much larger than the bytes in a
322 * page to allow for functions that return the number of bytes operated on in a
323 * given page.
324 */
325
326enum positive_aop_returns {
327 AOP_WRITEPAGE_ACTIVATE = 0x80000,
328 AOP_TRUNCATED_PAGE = 0x80001,
329};
330
305/* 331/*
306 * oh the beauties of C type declarations. 332 * oh the beauties of C type declarations.
307 */ 333 */
@@ -453,7 +479,7 @@ struct inode {
453 unsigned long i_blocks; 479 unsigned long i_blocks;
454 unsigned short i_bytes; 480 unsigned short i_bytes;
455 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 481 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
456 struct semaphore i_sem; 482 struct mutex i_mutex;
457 struct rw_semaphore i_alloc_sem; 483 struct rw_semaphore i_alloc_sem;
458 struct inode_operations *i_op; 484 struct inode_operations *i_op;
459 struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 485 struct file_operations *i_fop; /* former ->i_op->default_file_ops */
@@ -622,7 +648,7 @@ extern spinlock_t files_lock;
622#define file_list_lock() spin_lock(&files_lock); 648#define file_list_lock() spin_lock(&files_lock);
623#define file_list_unlock() spin_unlock(&files_lock); 649#define file_list_unlock() spin_unlock(&files_lock);
624 650
625#define get_file(x) rcuref_inc(&(x)->f_count) 651#define get_file(x) atomic_inc(&(x)->f_count)
626#define file_count(x) atomic_read(&(x)->f_count) 652#define file_count(x) atomic_read(&(x)->f_count)
627 653
628#define MAX_NON_LFS ((1UL<<31) - 1) 654#define MAX_NON_LFS ((1UL<<31) - 1)
@@ -729,7 +755,7 @@ extern struct file_lock *posix_test_lock(struct file *, struct file_lock *);
729extern int posix_lock_file(struct file *, struct file_lock *); 755extern int posix_lock_file(struct file *, struct file_lock *);
730extern int posix_lock_file_wait(struct file *, struct file_lock *); 756extern int posix_lock_file_wait(struct file *, struct file_lock *);
731extern void posix_block_lock(struct file_lock *, struct file_lock *); 757extern void posix_block_lock(struct file_lock *, struct file_lock *);
732extern void posix_unblock_lock(struct file *, struct file_lock *); 758extern int posix_unblock_lock(struct file *, struct file_lock *);
733extern int posix_locks_deadlock(struct file_lock *, struct file_lock *); 759extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
734extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 760extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
735extern int __break_lease(struct inode *inode, unsigned int flags); 761extern int __break_lease(struct inode *inode, unsigned int flags);
@@ -777,7 +803,6 @@ struct super_block {
777 struct list_head s_list; /* Keep this first */ 803 struct list_head s_list; /* Keep this first */
778 dev_t s_dev; /* search index; _not_ kdev_t */ 804 dev_t s_dev; /* search index; _not_ kdev_t */
779 unsigned long s_blocksize; 805 unsigned long s_blocksize;
780 unsigned long s_old_blocksize;
781 unsigned char s_blocksize_bits; 806 unsigned char s_blocksize_bits;
782 unsigned char s_dirt; 807 unsigned char s_dirt;
783 unsigned long long s_maxbytes; /* Max file size */ 808 unsigned long long s_maxbytes; /* Max file size */
@@ -790,7 +815,7 @@ struct super_block {
790 unsigned long s_magic; 815 unsigned long s_magic;
791 struct dentry *s_root; 816 struct dentry *s_root;
792 struct rw_semaphore s_umount; 817 struct rw_semaphore s_umount;
793 struct semaphore s_lock; 818 struct mutex s_lock;
794 int s_count; 819 int s_count;
795 int s_syncing; 820 int s_syncing;
796 int s_need_sync_fs; 821 int s_need_sync_fs;
@@ -862,13 +887,13 @@ static inline int has_fs_excl(void)
862static inline void lock_super(struct super_block * sb) 887static inline void lock_super(struct super_block * sb)
863{ 888{
864 get_fs_excl(); 889 get_fs_excl();
865 down(&sb->s_lock); 890 mutex_lock(&sb->s_lock);
866} 891}
867 892
868static inline void unlock_super(struct super_block * sb) 893static inline void unlock_super(struct super_block * sb)
869{ 894{
870 put_fs_excl(); 895 put_fs_excl();
871 up(&sb->s_lock); 896 mutex_unlock(&sb->s_lock);
872} 897}
873 898
874/* 899/*
@@ -932,6 +957,7 @@ struct block_device_operations {
932 int (*direct_access) (struct block_device *, sector_t, unsigned long *); 957 int (*direct_access) (struct block_device *, sector_t, unsigned long *);
933 int (*media_changed) (struct gendisk *); 958 int (*media_changed) (struct gendisk *);
934 int (*revalidate_disk) (struct gendisk *); 959 int (*revalidate_disk) (struct gendisk *);
960 int (*getgeo)(struct block_device *, struct hd_geometry *);
935 struct module *owner; 961 struct module *owner;
936}; 962};
937 963
@@ -1019,6 +1045,7 @@ struct inode_operations {
1019 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); 1045 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
1020 ssize_t (*listxattr) (struct dentry *, char *, size_t); 1046 ssize_t (*listxattr) (struct dentry *, char *, size_t);
1021 int (*removexattr) (struct dentry *, const char *); 1047 int (*removexattr) (struct dentry *, const char *);
1048 void (*truncate_range)(struct inode *, loff_t, loff_t);
1022}; 1049};
1023 1050
1024struct seq_file; 1051struct seq_file;
@@ -1085,12 +1112,7 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1085 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1112 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1086} 1113}
1087 1114
1088static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry) 1115extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1089{
1090 /* per-mountpoint checks will go here */
1091 update_atime(dentry->d_inode);
1092}
1093
1094static inline void file_accessed(struct file *file) 1116static inline void file_accessed(struct file *file)
1095{ 1117{
1096 if (!(file->f_flags & O_NOATIME)) 1118 if (!(file->f_flags & O_NOATIME))
@@ -1159,7 +1181,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc);
1159 * directory. The name should be stored in the @name (with the 1181 * directory. The name should be stored in the @name (with the
1160 * understanding that it is already pointing to a a %NAME_MAX+1 sized 1182 * understanding that it is already pointing to a a %NAME_MAX+1 sized
1161 * buffer. get_name() should return %0 on success, a negative error code 1183 * buffer. get_name() should return %0 on success, a negative error code
1162 * or error. @get_name will be called without @parent->i_sem held. 1184 * or error. @get_name will be called without @parent->i_mutex held.
1163 * 1185 *
1164 * get_parent: 1186 * get_parent:
1165 * @get_parent should find the parent directory for the given @child which 1187 * @get_parent should find the parent directory for the given @child which
@@ -1181,7 +1203,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc);
1181 * nfsd_find_fh_dentry() in either the @obj or @parent parameters. 1203 * nfsd_find_fh_dentry() in either the @obj or @parent parameters.
1182 * 1204 *
1183 * Locking rules: 1205 * Locking rules:
1184 * get_parent is called with child->d_inode->i_sem down 1206 * get_parent is called with child->d_inode->i_mutex down
1185 * get_name is not (which is possibly inconsistent) 1207 * get_name is not (which is possibly inconsistent)
1186 */ 1208 */
1187 1209
@@ -1313,7 +1335,8 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1313 1335
1314/* fs/open.c */ 1336/* fs/open.c */
1315 1337
1316extern int do_truncate(struct dentry *, loff_t start, struct file *filp); 1338extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
1339 struct file *filp);
1317extern long do_sys_open(const char __user *filename, int flags, int mode); 1340extern long do_sys_open(const char __user *filename, int flags, int mode);
1318extern struct file *filp_open(const char *, int, int); 1341extern struct file *filp_open(const char *, int, int);
1319extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); 1342extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
@@ -1682,7 +1705,7 @@ extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const vo
1682extern int inode_change_ok(struct inode *, struct iattr *); 1705extern int inode_change_ok(struct inode *, struct iattr *);
1683extern int __must_check inode_setattr(struct inode *, struct iattr *); 1706extern int __must_check inode_setattr(struct inode *, struct iattr *);
1684 1707
1685extern void inode_update_time(struct inode *inode, int ctime_too); 1708extern void file_update_time(struct file *file);
1686 1709
1687static inline ino_t parent_ino(struct dentry *dentry) 1710static inline ino_t parent_ino(struct dentry *dentry)
1688{ 1711{
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index b76b558b03d4..528959c52f1b 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -14,7 +14,7 @@
14#define FUSE_KERNEL_VERSION 7 14#define FUSE_KERNEL_VERSION 7
15 15
16/** Minor version number of this interface */ 16/** Minor version number of this interface */
17#define FUSE_KERNEL_MINOR_VERSION 3 17#define FUSE_KERNEL_MINOR_VERSION 5
18 18
19/** The node ID of the root inode */ 19/** The node ID of the root inode */
20#define FUSE_ROOT_ID 1 20#define FUSE_ROOT_ID 1
@@ -53,6 +53,9 @@ struct fuse_kstatfs {
53 __u64 ffree; 53 __u64 ffree;
54 __u32 bsize; 54 __u32 bsize;
55 __u32 namelen; 55 __u32 namelen;
56 __u32 frsize;
57 __u32 padding;
58 __u32 spare[6];
56}; 59};
57 60
58#define FATTR_MODE (1 << 0) 61#define FATTR_MODE (1 << 0)
@@ -105,12 +108,8 @@ enum fuse_opcode {
105 FUSE_CREATE = 35 108 FUSE_CREATE = 35
106}; 109};
107 110
108/* Conservative buffer size for the client */ 111/* The read buffer is required to be at least 8k, but may be much larger */
109#define FUSE_MAX_IN 8192 112#define FUSE_MIN_READ_BUFFER 8192
110
111#define FUSE_NAME_MAX 1024
112#define FUSE_SYMLINK_MAX 4096
113#define FUSE_XATTR_SIZE_MAX 4096
114 113
115struct fuse_entry_out { 114struct fuse_entry_out {
116 __u64 nodeid; /* Inode ID */ 115 __u64 nodeid; /* Inode ID */
@@ -213,6 +212,8 @@ struct fuse_write_out {
213 __u32 padding; 212 __u32 padding;
214}; 213};
215 214
215#define FUSE_COMPAT_STATFS_SIZE 48
216
216struct fuse_statfs_out { 217struct fuse_statfs_out {
217 struct fuse_kstatfs st; 218 struct fuse_kstatfs st;
218}; 219};
@@ -243,9 +244,16 @@ struct fuse_access_in {
243 __u32 padding; 244 __u32 padding;
244}; 245};
245 246
246struct fuse_init_in_out { 247struct fuse_init_in {
248 __u32 major;
249 __u32 minor;
250};
251
252struct fuse_init_out {
247 __u32 major; 253 __u32 major;
248 __u32 minor; 254 __u32 minor;
255 __u32 unused[3];
256 __u32 max_write;
249}; 257};
250 258
251struct fuse_in_header { 259struct fuse_in_header {
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 8b2eab90abb6..20f9148e38d9 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -57,6 +57,7 @@ struct vm_area_struct;
57 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \ 57 __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
58 __GFP_NOMEMALLOC|__GFP_HARDWALL) 58 __GFP_NOMEMALLOC|__GFP_HARDWALL)
59 59
60/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
60#define GFP_ATOMIC (__GFP_HIGH) 61#define GFP_ATOMIC (__GFP_HIGH)
61#define GFP_NOIO (__GFP_WAIT) 62#define GFP_NOIO (__GFP_WAIT)
62#define GFP_NOFS (__GFP_WAIT | __GFP_IO) 63#define GFP_NOFS (__GFP_WAIT | __GFP_IO)
@@ -109,6 +110,10 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
109 if (unlikely(order >= MAX_ORDER)) 110 if (unlikely(order >= MAX_ORDER))
110 return NULL; 111 return NULL;
111 112
113 /* Unknown node is current node */
114 if (nid < 0)
115 nid = numa_node_id();
116
112 return __alloc_pages(gfp_mask, order, 117 return __alloc_pages(gfp_mask, order,
113 NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask)); 118 NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask));
114} 119}
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
new file mode 100644
index 000000000000..089bfb1fa01a
--- /dev/null
+++ b/include/linux/hrtimer.h
@@ -0,0 +1,139 @@
1/*
2 * include/linux/hrtimer.h
3 *
4 * hrtimers - High-resolution kernel timers
5 *
6 * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de>
7 * Copyright(C) 2005, Red Hat, Inc., Ingo Molnar
8 *
9 * data type definitions, declarations, prototypes
10 *
11 * Started by: Thomas Gleixner and Ingo Molnar
12 *
13 * For licencing details see kernel-base/COPYING
14 */
15#ifndef _LINUX_HRTIMER_H
16#define _LINUX_HRTIMER_H
17
18#include <linux/rbtree.h>
19#include <linux/ktime.h>
20#include <linux/init.h>
21#include <linux/list.h>
22#include <linux/wait.h>
23
24/*
25 * Mode arguments of xxx_hrtimer functions:
26 */
27enum hrtimer_mode {
28 HRTIMER_ABS, /* Time value is absolute */
29 HRTIMER_REL, /* Time value is relative to now */
30};
31
32enum hrtimer_restart {
33 HRTIMER_NORESTART,
34 HRTIMER_RESTART,
35};
36
37/*
38 * Timer states:
39 */
40enum hrtimer_state {
41 HRTIMER_INACTIVE, /* Timer is inactive */
42 HRTIMER_EXPIRED, /* Timer is expired */
43 HRTIMER_PENDING, /* Timer is pending */
44};
45
46struct hrtimer_base;
47
48/**
49 * struct hrtimer - the basic hrtimer structure
50 *
51 * @node: red black tree node for time ordered insertion
52 * @expires: the absolute expiry time in the hrtimers internal
53 * representation. The time is related to the clock on
54 * which the timer is based.
55 * @state: state of the timer
56 * @function: timer expiry callback function
57 * @data: argument for the callback function
58 * @base: pointer to the timer base (per cpu and per clock)
59 *
60 * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE()
61 */
62struct hrtimer {
63 struct rb_node node;
64 ktime_t expires;
65 enum hrtimer_state state;
66 int (*function)(void *);
67 void *data;
68 struct hrtimer_base *base;
69};
70
71/**
72 * struct hrtimer_base - the timer base for a specific clock
73 *
74 * @index: clock type index for per_cpu support when moving a timer
75 * to a base on another cpu.
76 * @lock: lock protecting the base and associated timers
77 * @active: red black tree root node for the active timers
78 * @first: pointer to the timer node which expires first
79 * @resolution: the resolution of the clock, in nanoseconds
80 * @get_time: function to retrieve the current time of the clock
81 * @curr_timer: the timer which is executing a callback right now
82 */
83struct hrtimer_base {
84 clockid_t index;
85 spinlock_t lock;
86 struct rb_root active;
87 struct rb_node *first;
88 ktime_t resolution;
89 ktime_t (*get_time)(void);
90 struct hrtimer *curr_timer;
91};
92
93/*
94 * clock_was_set() is a NOP for non- high-resolution systems. The
95 * time-sorted order guarantees that a timer does not expire early and
96 * is expired in the next softirq when the clock was advanced.
97 */
98#define clock_was_set() do { } while (0)
99
100/* Exported timer functions: */
101
102/* Initialize timers: */
103extern void hrtimer_init(struct hrtimer *timer, const clockid_t which_clock);
104extern void hrtimer_rebase(struct hrtimer *timer, const clockid_t which_clock);
105
106
107/* Basic timer operations: */
108extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
109 const enum hrtimer_mode mode);
110extern int hrtimer_cancel(struct hrtimer *timer);
111extern int hrtimer_try_to_cancel(struct hrtimer *timer);
112
113#define hrtimer_restart(timer) hrtimer_start((timer), (timer)->expires, HRTIMER_ABS)
114
115/* Query timers: */
116extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer);
117extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp);
118
119static inline int hrtimer_active(const struct hrtimer *timer)
120{
121 return timer->state == HRTIMER_PENDING;
122}
123
124/* Forward a hrtimer so it expires after now: */
125extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval);
126
127/* Precise sleep: */
128extern long hrtimer_nanosleep(struct timespec *rqtp,
129 struct timespec __user *rmtp,
130 const enum hrtimer_mode mode,
131 const clockid_t clockid);
132
133/* Soft interrupt function to run the hrtimer queues: */
134extern void hrtimer_run_queues(void);
135
136/* Bootup initialization: */
137extern void __init hrtimers_init(void);
138
139#endif
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 1056717ee501..68d82ad6b17c 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -22,7 +22,7 @@ int hugetlb_report_meminfo(char *);
22int hugetlb_report_node_meminfo(int, char *); 22int hugetlb_report_node_meminfo(int, char *);
23int is_hugepage_mem_enough(size_t); 23int is_hugepage_mem_enough(size_t);
24unsigned long hugetlb_total_pages(void); 24unsigned long hugetlb_total_pages(void);
25struct page *alloc_huge_page(void); 25struct page *alloc_huge_page(struct vm_area_struct *, unsigned long);
26void free_huge_page(struct page *); 26void free_huge_page(struct page *);
27int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 27int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
28 unsigned long address, int write_access); 28 unsigned long address, int write_access);
@@ -97,7 +97,7 @@ static inline unsigned long hugetlb_total_pages(void)
97#define is_hugepage_only_range(mm, addr, len) 0 97#define is_hugepage_only_range(mm, addr, len) 0
98#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ 98#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \
99 do { } while (0) 99 do { } while (0)
100#define alloc_huge_page() ({ NULL; }) 100#define alloc_huge_page(vma, addr) ({ NULL; })
101#define free_huge_page(p) ({ (void)(p); BUG(); }) 101#define free_huge_page(p) ({ (void)(p); BUG(); })
102#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) 102#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; })
103 103
diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h
index cd4b7a042b86..f346e4d5381c 100644
--- a/include/linux/hwmon-vid.h
+++ b/include/linux/hwmon-vid.h
@@ -23,14 +23,14 @@
23#ifndef _LINUX_HWMON_VID_H 23#ifndef _LINUX_HWMON_VID_H
24#define _LINUX_HWMON_VID_H 24#define _LINUX_HWMON_VID_H
25 25
26int vid_from_reg(int val, int vrm); 26int vid_from_reg(int val, u8 vrm);
27int vid_which_vrm(void); 27u8 vid_which_vrm(void);
28 28
29/* vrm is the VRM/VRD document version multiplied by 10. 29/* vrm is the VRM/VRD document version multiplied by 10.
30 val is in mV to avoid floating point in the kernel. 30 val is in mV to avoid floating point in the kernel.
31 Returned value is the 4-, 5- or 6-bit VID code. 31 Returned value is the 4-, 5- or 6-bit VID code.
32 Note that only VRM 9.x is supported for now. */ 32 Note that only VRM 9.x is supported for now. */
33static inline int vid_to_reg(int val, int vrm) 33static inline int vid_to_reg(int val, u8 vrm)
34{ 34{
35 switch (vrm) { 35 switch (vrm) {
36 case 91: /* VRM 9.1 */ 36 case 91: /* VRM 9.1 */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 006c81ef4d50..6ff2d365895f 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -25,12 +25,6 @@
25 25
26/* 26/*
27 * ---- Driver types ----------------------------------------------------- 27 * ---- Driver types -----------------------------------------------------
28 * device id name + number function description, i2c address(es)
29 *
30 * Range 1000-1999 range is defined in sensors/sensors.h
31 * Range 0x100 - 0x1ff is for V4L2 Common Components
32 * Range 0xf000 - 0xffff is reserved for local experimentation, and should
33 * never be used in official drivers
34 */ 28 */
35 29
36#define I2C_DRIVERID_MSP3400 1 30#define I2C_DRIVERID_MSP3400 1
@@ -109,14 +103,9 @@
109#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ 103#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
110#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ 104#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */
111#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ 105#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
112 106#define I2C_DRIVERID_TVP5150 76 /* TVP5150 video decoder */
113#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */
114#define I2C_DRIVERID_EXP1 0xF1
115#define I2C_DRIVERID_EXP2 0xF2
116#define I2C_DRIVERID_EXP3 0xF3
117 107
118#define I2C_DRIVERID_I2CDEV 900 108#define I2C_DRIVERID_I2CDEV 900
119#define I2C_DRIVERID_I2CPROC 901
120#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 109#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
121#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */ 110#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */
122 111
@@ -131,15 +120,12 @@
131#define I2C_DRIVERID_ADM1021 1008 120#define I2C_DRIVERID_ADM1021 1008
132#define I2C_DRIVERID_ADM9240 1009 121#define I2C_DRIVERID_ADM9240 1009
133#define I2C_DRIVERID_LTC1710 1010 122#define I2C_DRIVERID_LTC1710 1010
134#define I2C_DRIVERID_SIS5595 1011
135#define I2C_DRIVERID_ICSPLL 1012 123#define I2C_DRIVERID_ICSPLL 1012
136#define I2C_DRIVERID_BT869 1013 124#define I2C_DRIVERID_BT869 1013
137#define I2C_DRIVERID_MAXILIFE 1014 125#define I2C_DRIVERID_MAXILIFE 1014
138#define I2C_DRIVERID_MATORB 1015 126#define I2C_DRIVERID_MATORB 1015
139#define I2C_DRIVERID_GL520 1016 127#define I2C_DRIVERID_GL520 1016
140#define I2C_DRIVERID_THMC50 1017 128#define I2C_DRIVERID_THMC50 1017
141#define I2C_DRIVERID_DDCMON 1018
142#define I2C_DRIVERID_VIA686A 1019
143#define I2C_DRIVERID_ADM1025 1020 129#define I2C_DRIVERID_ADM1025 1020
144#define I2C_DRIVERID_LM87 1021 130#define I2C_DRIVERID_LM87 1021
145#define I2C_DRIVERID_PCF8574 1022 131#define I2C_DRIVERID_PCF8574 1022
@@ -151,21 +137,16 @@
151#define I2C_DRIVERID_FSCPOS 1028 137#define I2C_DRIVERID_FSCPOS 1028
152#define I2C_DRIVERID_FSCSCY 1029 138#define I2C_DRIVERID_FSCSCY 1029
153#define I2C_DRIVERID_PCF8591 1030 139#define I2C_DRIVERID_PCF8591 1030
154#define I2C_DRIVERID_SMSC47M1 1031
155#define I2C_DRIVERID_VT1211 1032
156#define I2C_DRIVERID_LM92 1033 140#define I2C_DRIVERID_LM92 1033
157#define I2C_DRIVERID_VT8231 1034
158#define I2C_DRIVERID_SMARTBATT 1035 141#define I2C_DRIVERID_SMARTBATT 1035
159#define I2C_DRIVERID_BMCSENSORS 1036 142#define I2C_DRIVERID_BMCSENSORS 1036
160#define I2C_DRIVERID_FS451 1037 143#define I2C_DRIVERID_FS451 1037
161#define I2C_DRIVERID_W83627HF 1038
162#define I2C_DRIVERID_LM85 1039 144#define I2C_DRIVERID_LM85 1039
163#define I2C_DRIVERID_LM83 1040 145#define I2C_DRIVERID_LM83 1040
164#define I2C_DRIVERID_LM90 1042 146#define I2C_DRIVERID_LM90 1042
165#define I2C_DRIVERID_ASB100 1043 147#define I2C_DRIVERID_ASB100 1043
166#define I2C_DRIVERID_FSCHER 1046 148#define I2C_DRIVERID_FSCHER 1046
167#define I2C_DRIVERID_W83L785TS 1047 149#define I2C_DRIVERID_W83L785TS 1047
168#define I2C_DRIVERID_SMSC47B397 1050
169 150
170/* 151/*
171 * ---- Adapter types ---------------------------------------------------- 152 * ---- Adapter types ----------------------------------------------------
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 5e19a7ba69b2..7863a59bd598 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -105,14 +105,14 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
105 * A driver is capable of handling one or more physical devices present on 105 * A driver is capable of handling one or more physical devices present on
106 * I2C adapters. This information is used to inform the driver of adapter 106 * I2C adapters. This information is used to inform the driver of adapter
107 * events. 107 * events.
108 *
109 * The driver.owner field should be set to the module owner of this driver.
110 * The driver.name field should be set to the name of this driver.
108 */ 111 */
109 112
110struct i2c_driver { 113struct i2c_driver {
111 struct module *owner;
112 char name[32];
113 int id; 114 int id;
114 unsigned int class; 115 unsigned int class;
115 unsigned int flags; /* div., see below */
116 116
117 /* Notifies the driver that a new bus has appeared. This routine 117 /* Notifies the driver that a new bus has appeared. This routine
118 * can be used by the driver to test if the bus meets its conditions 118 * can be used by the driver to test if the bus meets its conditions
@@ -250,18 +250,7 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
250 dev_set_drvdata (&dev->dev, data); 250 dev_set_drvdata (&dev->dev, data);
251} 251}
252 252
253/*flags for the driver struct: */
254#define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */
255#if 0
256/* this flag is gone -- there is a (optional) driver->detach_adapter
257 * callback now which can be used instead */
258# define I2C_DF_DUMMY 0x02
259#endif
260
261/*flags for the client struct: */ 253/*flags for the client struct: */
262#define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */
263#define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */
264 /* on an i2c_client */
265#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ 254#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
266#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ 255#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
267 /* Must equal I2C_M_TEN below */ 256 /* Must equal I2C_M_TEN below */
@@ -302,26 +291,20 @@ struct i2c_client_address_data {
302extern int i2c_add_adapter(struct i2c_adapter *); 291extern int i2c_add_adapter(struct i2c_adapter *);
303extern int i2c_del_adapter(struct i2c_adapter *); 292extern int i2c_del_adapter(struct i2c_adapter *);
304 293
305extern int i2c_add_driver(struct i2c_driver *); 294extern int i2c_register_driver(struct module *, struct i2c_driver *);
306extern int i2c_del_driver(struct i2c_driver *); 295extern int i2c_del_driver(struct i2c_driver *);
307 296
297static inline int i2c_add_driver(struct i2c_driver *driver)
298{
299 return i2c_register_driver(THIS_MODULE, driver);
300}
301
308extern int i2c_attach_client(struct i2c_client *); 302extern int i2c_attach_client(struct i2c_client *);
309extern int i2c_detach_client(struct i2c_client *); 303extern int i2c_detach_client(struct i2c_client *);
310 304
311/* New function: This is to get an i2c_client-struct for controlling the 305/* Should be used to make sure that client-struct is valid and that it
312 client either by using i2c_control-function or having the 306 is okay to access the i2c-client.
313 client-module export functions that can be used with the i2c_client 307 returns -ENODEV if client has gone in the meantime */
314 -struct. */
315extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id,
316 struct i2c_client *prev);
317
318/* Should be used with new function
319 extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *);
320 to make sure that client-struct is valid and that it is okay to access
321 the i2c-client.
322 returns -EACCES if client doesn't allow use (default)
323 returns -EBUSY if client doesn't allow multiple use (default) and
324 usage_count >0 */
325extern int i2c_use_client(struct i2c_client *); 308extern int i2c_use_client(struct i2c_client *);
326extern int i2c_release_client(struct i2c_client *); 309extern int i2c_release_client(struct i2c_client *);
327 310
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index d79c8a4bc4f8..9ba806796667 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -30,6 +30,7 @@
30#include <linux/string.h> 30#include <linux/string.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/workqueue.h> /* work_struct */ 32#include <linux/workqueue.h> /* work_struct */
33#include <linux/mempool.h>
33 34
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/semaphore.h> /* Needed for MUTEX init macros */ 36#include <asm/semaphore.h> /* Needed for MUTEX init macros */
@@ -38,6 +39,355 @@
38#define I2O_QUEUE_EMPTY 0xffffffff 39#define I2O_QUEUE_EMPTY 0xffffffff
39 40
40/* 41/*
42 * Cache strategies
43 */
44
45/* The NULL strategy leaves everything up to the controller. This tends to be a
46 * pessimal but functional choice.
47 */
48#define CACHE_NULL 0
49/* Prefetch data when reading. We continually attempt to load the next 32 sectors
50 * into the controller cache.
51 */
52#define CACHE_PREFETCH 1
53/* Prefetch data when reading. We sometimes attempt to load the next 32 sectors
54 * into the controller cache. When an I/O is less <= 8K we assume its probably
55 * not sequential and don't prefetch (default)
56 */
57#define CACHE_SMARTFETCH 2
58/* Data is written to the cache and then out on to the disk. The I/O must be
59 * physically on the medium before the write is acknowledged (default without
60 * NVRAM)
61 */
62#define CACHE_WRITETHROUGH 17
63/* Data is written to the cache and then out on to the disk. The controller
64 * is permitted to write back the cache any way it wants. (default if battery
65 * backed NVRAM is present). It can be useful to set this for swap regardless of
66 * battery state.
67 */
68#define CACHE_WRITEBACK 18
69/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
70 * write large I/O's directly to disk bypassing the cache to avoid the extra
71 * memory copy hits. Small writes are writeback cached
72 */
73#define CACHE_SMARTBACK 19
74/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
75 * write large I/O's directly to disk bypassing the cache to avoid the extra
76 * memory copy hits. Small writes are writethrough cached. Suitable for devices
77 * lacking battery backup
78 */
79#define CACHE_SMARTTHROUGH 20
80
81/*
82 * Ioctl structures
83 */
84
85#define BLKI2OGRSTRAT _IOR('2', 1, int)
86#define BLKI2OGWSTRAT _IOR('2', 2, int)
87#define BLKI2OSRSTRAT _IOW('2', 3, int)
88#define BLKI2OSWSTRAT _IOW('2', 4, int)
89
90/*
91 * I2O Function codes
92 */
93
94/*
95 * Executive Class
96 */
97#define I2O_CMD_ADAPTER_ASSIGN 0xB3
98#define I2O_CMD_ADAPTER_READ 0xB2
99#define I2O_CMD_ADAPTER_RELEASE 0xB5
100#define I2O_CMD_BIOS_INFO_SET 0xA5
101#define I2O_CMD_BOOT_DEVICE_SET 0xA7
102#define I2O_CMD_CONFIG_VALIDATE 0xBB
103#define I2O_CMD_CONN_SETUP 0xCA
104#define I2O_CMD_DDM_DESTROY 0xB1
105#define I2O_CMD_DDM_ENABLE 0xD5
106#define I2O_CMD_DDM_QUIESCE 0xC7
107#define I2O_CMD_DDM_RESET 0xD9
108#define I2O_CMD_DDM_SUSPEND 0xAF
109#define I2O_CMD_DEVICE_ASSIGN 0xB7
110#define I2O_CMD_DEVICE_RELEASE 0xB9
111#define I2O_CMD_HRT_GET 0xA8
112#define I2O_CMD_ADAPTER_CLEAR 0xBE
113#define I2O_CMD_ADAPTER_CONNECT 0xC9
114#define I2O_CMD_ADAPTER_RESET 0xBD
115#define I2O_CMD_LCT_NOTIFY 0xA2
116#define I2O_CMD_OUTBOUND_INIT 0xA1
117#define I2O_CMD_PATH_ENABLE 0xD3
118#define I2O_CMD_PATH_QUIESCE 0xC5
119#define I2O_CMD_PATH_RESET 0xD7
120#define I2O_CMD_STATIC_MF_CREATE 0xDD
121#define I2O_CMD_STATIC_MF_RELEASE 0xDF
122#define I2O_CMD_STATUS_GET 0xA0
123#define I2O_CMD_SW_DOWNLOAD 0xA9
124#define I2O_CMD_SW_UPLOAD 0xAB
125#define I2O_CMD_SW_REMOVE 0xAD
126#define I2O_CMD_SYS_ENABLE 0xD1
127#define I2O_CMD_SYS_MODIFY 0xC1
128#define I2O_CMD_SYS_QUIESCE 0xC3
129#define I2O_CMD_SYS_TAB_SET 0xA3
130
131/*
132 * Utility Class
133 */
134#define I2O_CMD_UTIL_NOP 0x00
135#define I2O_CMD_UTIL_ABORT 0x01
136#define I2O_CMD_UTIL_CLAIM 0x09
137#define I2O_CMD_UTIL_RELEASE 0x0B
138#define I2O_CMD_UTIL_PARAMS_GET 0x06
139#define I2O_CMD_UTIL_PARAMS_SET 0x05
140#define I2O_CMD_UTIL_EVT_REGISTER 0x13
141#define I2O_CMD_UTIL_EVT_ACK 0x14
142#define I2O_CMD_UTIL_CONFIG_DIALOG 0x10
143#define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D
144#define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F
145#define I2O_CMD_UTIL_LOCK 0x17
146#define I2O_CMD_UTIL_LOCK_RELEASE 0x19
147#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15
148
149/*
150 * SCSI Host Bus Adapter Class
151 */
152#define I2O_CMD_SCSI_EXEC 0x81
153#define I2O_CMD_SCSI_ABORT 0x83
154#define I2O_CMD_SCSI_BUSRESET 0x27
155
156/*
157 * Bus Adapter Class
158 */
159#define I2O_CMD_BUS_ADAPTER_RESET 0x85
160#define I2O_CMD_BUS_RESET 0x87
161#define I2O_CMD_BUS_SCAN 0x89
162#define I2O_CMD_BUS_QUIESCE 0x8b
163
164/*
165 * Random Block Storage Class
166 */
167#define I2O_CMD_BLOCK_READ 0x30
168#define I2O_CMD_BLOCK_WRITE 0x31
169#define I2O_CMD_BLOCK_CFLUSH 0x37
170#define I2O_CMD_BLOCK_MLOCK 0x49
171#define I2O_CMD_BLOCK_MUNLOCK 0x4B
172#define I2O_CMD_BLOCK_MMOUNT 0x41
173#define I2O_CMD_BLOCK_MEJECT 0x43
174#define I2O_CMD_BLOCK_POWER 0x70
175
176#define I2O_CMD_PRIVATE 0xFF
177
178/* Command status values */
179
180#define I2O_CMD_IN_PROGRESS 0x01
181#define I2O_CMD_REJECTED 0x02
182#define I2O_CMD_FAILED 0x03
183#define I2O_CMD_COMPLETED 0x04
184
185/* I2O API function return values */
186
187#define I2O_RTN_NO_ERROR 0
188#define I2O_RTN_NOT_INIT 1
189#define I2O_RTN_FREE_Q_EMPTY 2
190#define I2O_RTN_TCB_ERROR 3
191#define I2O_RTN_TRANSACTION_ERROR 4
192#define I2O_RTN_ADAPTER_ALREADY_INIT 5
193#define I2O_RTN_MALLOC_ERROR 6
194#define I2O_RTN_ADPTR_NOT_REGISTERED 7
195#define I2O_RTN_MSG_REPLY_TIMEOUT 8
196#define I2O_RTN_NO_STATUS 9
197#define I2O_RTN_NO_FIRM_VER 10
198#define I2O_RTN_NO_LINK_SPEED 11
199
200/* Reply message status defines for all messages */
201
202#define I2O_REPLY_STATUS_SUCCESS 0x00
203#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
204#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
205#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
206#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
207#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
208#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06
209#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08
210#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
211#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A
212#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B
213#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80
214
215/* Status codes and Error Information for Parameter functions */
216
217#define I2O_PARAMS_STATUS_SUCCESS 0x00
218#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
219#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
220#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
221#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
222#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
223#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06
224#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07
225#define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08
226#define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09
227#define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A
228#define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B
229#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C
230#define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D
231#define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E
232#define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F
233#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10
234
235/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
236 * messages: Table 3-2 Detailed Status Codes.*/
237
238#define I2O_DSC_SUCCESS 0x0000
239#define I2O_DSC_BAD_KEY 0x0002
240#define I2O_DSC_TCL_ERROR 0x0003
241#define I2O_DSC_REPLY_BUFFER_FULL 0x0004
242#define I2O_DSC_NO_SUCH_PAGE 0x0005
243#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006
244#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007
245#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009
246#define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A
247#define I2O_DSC_DEVICE_LOCKED 0x000B
248#define I2O_DSC_DEVICE_RESET 0x000C
249#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D
250#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E
251#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F
252#define I2O_DSC_INVALID_OFFSET 0x0010
253#define I2O_DSC_INVALID_PARAMETER 0x0011
254#define I2O_DSC_INVALID_REQUEST 0x0012
255#define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013
256#define I2O_DSC_MESSAGE_TOO_LARGE 0x0014
257#define I2O_DSC_MESSAGE_TOO_SMALL 0x0015
258#define I2O_DSC_MISSING_PARAMETER 0x0016
259#define I2O_DSC_TIMEOUT 0x0017
260#define I2O_DSC_UNKNOWN_ERROR 0x0018
261#define I2O_DSC_UNKNOWN_FUNCTION 0x0019
262#define I2O_DSC_UNSUPPORTED_VERSION 0x001A
263#define I2O_DSC_DEVICE_BUSY 0x001B
264#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
265
266/* DetailedStatusCode defines for Block Storage Operation: Table 6-7 Detailed
267 Status Codes.*/
268
269#define I2O_BSA_DSC_SUCCESS 0x0000
270#define I2O_BSA_DSC_MEDIA_ERROR 0x0001
271#define I2O_BSA_DSC_ACCESS_ERROR 0x0002
272#define I2O_BSA_DSC_DEVICE_FAILURE 0x0003
273#define I2O_BSA_DSC_DEVICE_NOT_READY 0x0004
274#define I2O_BSA_DSC_MEDIA_NOT_PRESENT 0x0005
275#define I2O_BSA_DSC_MEDIA_LOCKED 0x0006
276#define I2O_BSA_DSC_MEDIA_FAILURE 0x0007
277#define I2O_BSA_DSC_PROTOCOL_FAILURE 0x0008
278#define I2O_BSA_DSC_BUS_FAILURE 0x0009
279#define I2O_BSA_DSC_ACCESS_VIOLATION 0x000A
280#define I2O_BSA_DSC_WRITE_PROTECTED 0x000B
281#define I2O_BSA_DSC_DEVICE_RESET 0x000C
282#define I2O_BSA_DSC_VOLUME_CHANGED 0x000D
283#define I2O_BSA_DSC_TIMEOUT 0x000E
284
285/* FailureStatusCodes, Table 3-3 Message Failure Codes */
286
287#define I2O_FSC_TRANSPORT_SERVICE_SUSPENDED 0x81
288#define I2O_FSC_TRANSPORT_SERVICE_TERMINATED 0x82
289#define I2O_FSC_TRANSPORT_CONGESTION 0x83
290#define I2O_FSC_TRANSPORT_FAILURE 0x84
291#define I2O_FSC_TRANSPORT_STATE_ERROR 0x85
292#define I2O_FSC_TRANSPORT_TIME_OUT 0x86
293#define I2O_FSC_TRANSPORT_ROUTING_FAILURE 0x87
294#define I2O_FSC_TRANSPORT_INVALID_VERSION 0x88
295#define I2O_FSC_TRANSPORT_INVALID_OFFSET 0x89
296#define I2O_FSC_TRANSPORT_INVALID_MSG_FLAGS 0x8A
297#define I2O_FSC_TRANSPORT_FRAME_TOO_SMALL 0x8B
298#define I2O_FSC_TRANSPORT_FRAME_TOO_LARGE 0x8C
299#define I2O_FSC_TRANSPORT_INVALID_TARGET_ID 0x8D
300#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_ID 0x8E
301#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F
302#define I2O_FSC_TRANSPORT_UNKNOWN_FAILURE 0xFF
303
304/* Device Claim Types */
305#define I2O_CLAIM_PRIMARY 0x01000000
306#define I2O_CLAIM_MANAGEMENT 0x02000000
307#define I2O_CLAIM_AUTHORIZED 0x03000000
308#define I2O_CLAIM_SECONDARY 0x04000000
309
310/* Message header defines for VersionOffset */
311#define I2OVER15 0x0001
312#define I2OVER20 0x0002
313
314/* Default is 1.5 */
315#define I2OVERSION I2OVER15
316
317#define SGL_OFFSET_0 I2OVERSION
318#define SGL_OFFSET_4 (0x0040 | I2OVERSION)
319#define SGL_OFFSET_5 (0x0050 | I2OVERSION)
320#define SGL_OFFSET_6 (0x0060 | I2OVERSION)
321#define SGL_OFFSET_7 (0x0070 | I2OVERSION)
322#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
323#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
324#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
325#define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
326#define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
327#define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
328
329/* Transaction Reply Lists (TRL) Control Word structure */
330#define TRL_SINGLE_FIXED_LENGTH 0x00
331#define TRL_SINGLE_VARIABLE_LENGTH 0x40
332#define TRL_MULTIPLE_FIXED_LENGTH 0x80
333
334 /* msg header defines for MsgFlags */
335#define MSG_STATIC 0x0100
336#define MSG_64BIT_CNTXT 0x0200
337#define MSG_MULTI_TRANS 0x1000
338#define MSG_FAIL 0x2000
339#define MSG_FINAL 0x4000
340#define MSG_REPLY 0x8000
341
342 /* minimum size msg */
343#define THREE_WORD_MSG_SIZE 0x00030000
344#define FOUR_WORD_MSG_SIZE 0x00040000
345#define FIVE_WORD_MSG_SIZE 0x00050000
346#define SIX_WORD_MSG_SIZE 0x00060000
347#define SEVEN_WORD_MSG_SIZE 0x00070000
348#define EIGHT_WORD_MSG_SIZE 0x00080000
349#define NINE_WORD_MSG_SIZE 0x00090000
350#define TEN_WORD_MSG_SIZE 0x000A0000
351#define ELEVEN_WORD_MSG_SIZE 0x000B0000
352#define I2O_MESSAGE_SIZE(x) ((x)<<16)
353
354/* special TID assignments */
355#define ADAPTER_TID 0
356#define HOST_TID 1
357
358/* outbound queue defines */
359#define I2O_MAX_OUTBOUND_MSG_FRAMES 128
360#define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
361
362/* inbound queue definitions */
363#define I2O_MSG_INPOOL_MIN 32
364#define I2O_INBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
365
366#define I2O_POST_WAIT_OK 0
367#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
368
369#define I2O_CONTEXT_LIST_MIN_LENGTH 15
370#define I2O_CONTEXT_LIST_USED 0x01
371#define I2O_CONTEXT_LIST_DELETED 0x02
372
373/* timeouts */
374#define I2O_TIMEOUT_INIT_OUTBOUND_QUEUE 15
375#define I2O_TIMEOUT_MESSAGE_GET 5
376#define I2O_TIMEOUT_RESET 30
377#define I2O_TIMEOUT_STATUS_GET 5
378#define I2O_TIMEOUT_LCT_GET 360
379#define I2O_TIMEOUT_SCSI_SCB_ABORT 240
380
381/* retries */
382#define I2O_HRT_GET_TRIES 3
383#define I2O_LCT_GET_TRIES 3
384
385/* defines for max_sectors and max_phys_segments */
386#define I2O_MAX_SECTORS 1024
387#define I2O_MAX_SECTORS_LIMITED 128
388#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
389
390/*
41 * Message structures 391 * Message structures
42 */ 392 */
43struct i2o_message { 393struct i2o_message {
@@ -58,6 +408,12 @@ struct i2o_message {
58 u32 body[0]; 408 u32 body[0];
59}; 409};
60 410
411/* MFA and I2O message used by mempool */
412struct i2o_msg_mfa {
413 u32 mfa; /* MFA returned by the controller */
414 struct i2o_message msg; /* I2O message */
415};
416
61/* 417/*
62 * Each I2O device entity has one of these. There is one per device. 418 * Each I2O device entity has one of these. There is one per device.
63 */ 419 */
@@ -130,6 +486,15 @@ struct i2o_dma {
130}; 486};
131 487
132/* 488/*
489 * Contains slab cache and mempool information
490 */
491struct i2o_pool {
492 char *name;
493 kmem_cache_t *slab;
494 mempool_t *mempool;
495};
496
497/*
133 * Contains IO mapped address information 498 * Contains IO mapped address information
134 */ 499 */
135struct i2o_io { 500struct i2o_io {
@@ -174,8 +539,6 @@ struct i2o_controller {
174 void __iomem *irq_status; /* Interrupt status register address */ 539 void __iomem *irq_status; /* Interrupt status register address */
175 void __iomem *irq_mask; /* Interrupt mask register address */ 540 void __iomem *irq_mask; /* Interrupt mask register address */
176 541
177 /* Dynamic LCT related data */
178
179 struct i2o_dma status; /* IOP status block */ 542 struct i2o_dma status; /* IOP status block */
180 543
181 struct i2o_dma hrt; /* HW Resource Table */ 544 struct i2o_dma hrt; /* HW Resource Table */
@@ -188,6 +551,8 @@ struct i2o_controller {
188 struct i2o_io in_queue; /* inbound message queue Host->IOP */ 551 struct i2o_io in_queue; /* inbound message queue Host->IOP */
189 struct i2o_dma out_queue; /* outbound message queue IOP->Host */ 552 struct i2o_dma out_queue; /* outbound message queue IOP->Host */
190 553
554 struct i2o_pool in_msg; /* mempool for inbound messages */
555
191 unsigned int battery:1; /* Has a battery backup */ 556 unsigned int battery:1; /* Has a battery backup */
192 unsigned int io_alloc:1; /* An I/O resource was allocated */ 557 unsigned int io_alloc:1; /* An I/O resource was allocated */
193 unsigned int mem_alloc:1; /* A memory resource was allocated */ 558 unsigned int mem_alloc:1; /* A memory resource was allocated */
@@ -196,7 +561,6 @@ struct i2o_controller {
196 struct resource mem_resource; /* Mem resource allocated to the IOP */ 561 struct resource mem_resource; /* Mem resource allocated to the IOP */
197 562
198 struct device device; 563 struct device device;
199 struct class_device *classdev; /* I2O controller class device */
200 struct i2o_device *exec; /* Executive */ 564 struct i2o_device *exec; /* Executive */
201#if BITS_PER_LONG == 64 565#if BITS_PER_LONG == 64
202 spinlock_t context_list_lock; /* lock for context_list */ 566 spinlock_t context_list_lock; /* lock for context_list */
@@ -247,16 +611,13 @@ struct i2o_sys_tbl {
247extern struct list_head i2o_controllers; 611extern struct list_head i2o_controllers;
248 612
249/* Message functions */ 613/* Message functions */
250static inline u32 i2o_msg_get(struct i2o_controller *, 614static inline struct i2o_message *i2o_msg_get(struct i2o_controller *);
251 struct i2o_message __iomem **); 615extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int);
252extern u32 i2o_msg_get_wait(struct i2o_controller *, 616static inline void i2o_msg_post(struct i2o_controller *, struct i2o_message *);
253 struct i2o_message __iomem **, int); 617static inline int i2o_msg_post_wait(struct i2o_controller *,
254static inline void i2o_msg_post(struct i2o_controller *, u32); 618 struct i2o_message *, unsigned long);
255static inline int i2o_msg_post_wait(struct i2o_controller *, u32, 619extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *,
256 unsigned long); 620 unsigned long, struct i2o_dma *);
257extern int i2o_msg_post_wait_mem(struct i2o_controller *, u32, unsigned long,
258 struct i2o_dma *);
259extern void i2o_msg_nop(struct i2o_controller *, u32);
260static inline void i2o_flush_reply(struct i2o_controller *, u32); 621static inline void i2o_flush_reply(struct i2o_controller *, u32);
261 622
262/* IOP functions */ 623/* IOP functions */
@@ -384,10 +745,10 @@ static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size)
384static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr, 745static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
385 size_t size, 746 size_t size,
386 enum dma_data_direction direction, 747 enum dma_data_direction direction,
387 u32 __iomem ** sg_ptr) 748 u32 ** sg_ptr)
388{ 749{
389 u32 sg_flags; 750 u32 sg_flags;
390 u32 __iomem *mptr = *sg_ptr; 751 u32 *mptr = *sg_ptr;
391 dma_addr_t dma_addr; 752 dma_addr_t dma_addr;
392 753
393 switch (direction) { 754 switch (direction) {
@@ -405,16 +766,16 @@ static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
405 if (!dma_mapping_error(dma_addr)) { 766 if (!dma_mapping_error(dma_addr)) {
406#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 767#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
407 if ((sizeof(dma_addr_t) > 4) && c->pae_support) { 768 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
408 writel(0x7C020002, mptr++); 769 *mptr++ = cpu_to_le32(0x7C020002);
409 writel(PAGE_SIZE, mptr++); 770 *mptr++ = cpu_to_le32(PAGE_SIZE);
410 } 771 }
411#endif 772#endif
412 773
413 writel(sg_flags | size, mptr++); 774 *mptr++ = cpu_to_le32(sg_flags | size);
414 writel(i2o_dma_low(dma_addr), mptr++); 775 *mptr++ = cpu_to_le32(i2o_dma_low(dma_addr));
415#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 776#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
416 if ((sizeof(dma_addr_t) > 4) && c->pae_support) 777 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
417 writel(i2o_dma_high(dma_addr), mptr++); 778 *mptr++ = cpu_to_le32(i2o_dma_high(dma_addr));
418#endif 779#endif
419 *sg_ptr = mptr; 780 *sg_ptr = mptr;
420 } 781 }
@@ -439,10 +800,10 @@ static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
439static inline int i2o_dma_map_sg(struct i2o_controller *c, 800static inline int i2o_dma_map_sg(struct i2o_controller *c,
440 struct scatterlist *sg, int sg_count, 801 struct scatterlist *sg, int sg_count,
441 enum dma_data_direction direction, 802 enum dma_data_direction direction,
442 u32 __iomem ** sg_ptr) 803 u32 ** sg_ptr)
443{ 804{
444 u32 sg_flags; 805 u32 sg_flags;
445 u32 __iomem *mptr = *sg_ptr; 806 u32 *mptr = *sg_ptr;
446 807
447 switch (direction) { 808 switch (direction) {
448 case DMA_TO_DEVICE: 809 case DMA_TO_DEVICE:
@@ -461,19 +822,19 @@ static inline int i2o_dma_map_sg(struct i2o_controller *c,
461 822
462#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 823#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
463 if ((sizeof(dma_addr_t) > 4) && c->pae_support) { 824 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
464 writel(0x7C020002, mptr++); 825 *mptr++ = cpu_to_le32(0x7C020002);
465 writel(PAGE_SIZE, mptr++); 826 *mptr++ = cpu_to_le32(PAGE_SIZE);
466 } 827 }
467#endif 828#endif
468 829
469 while (sg_count-- > 0) { 830 while (sg_count-- > 0) {
470 if (!sg_count) 831 if (!sg_count)
471 sg_flags |= 0xC0000000; 832 sg_flags |= 0xC0000000;
472 writel(sg_flags | sg_dma_len(sg), mptr++); 833 *mptr++ = cpu_to_le32(sg_flags | sg_dma_len(sg));
473 writel(i2o_dma_low(sg_dma_address(sg)), mptr++); 834 *mptr++ = cpu_to_le32(i2o_dma_low(sg_dma_address(sg)));
474#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 835#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
475 if ((sizeof(dma_addr_t) > 4) && c->pae_support) 836 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
476 writel(i2o_dma_high(sg_dma_address(sg)), mptr++); 837 *mptr++ = cpu_to_le32(i2o_dma_high(sg_dma_address(sg)));
477#endif 838#endif
478 sg++; 839 sg++;
479 } 840 }
@@ -563,6 +924,64 @@ static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr,
563 return 0; 924 return 0;
564}; 925};
565 926
927/*
928 * i2o_pool_alloc - Allocate an slab cache and mempool
929 * @mempool: pointer to struct i2o_pool to write data into.
930 * @name: name which is used to identify cache
931 * @size: size of each object
932 * @min_nr: minimum number of objects
933 *
934 * First allocates a slab cache with name and size. Then allocates a
935 * mempool which uses the slab cache for allocation and freeing.
936 *
937 * Returns 0 on success or negative error code on failure.
938 */
939static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
940 size_t size, int min_nr)
941{
942 pool->name = kmalloc(strlen(name) + 1, GFP_KERNEL);
943 if (!pool->name)
944 goto exit;
945 strcpy(pool->name, name);
946
947 pool->slab =
948 kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL,
949 NULL);
950 if (!pool->slab)
951 goto free_name;
952
953 pool->mempool =
954 mempool_create(min_nr, mempool_alloc_slab, mempool_free_slab,
955 pool->slab);
956 if (!pool->mempool)
957 goto free_slab;
958
959 return 0;
960
961 free_slab:
962 kmem_cache_destroy(pool->slab);
963
964 free_name:
965 kfree(pool->name);
966
967 exit:
968 return -ENOMEM;
969};
970
971/*
972 * i2o_pool_free - Free slab cache and mempool again
973 * @mempool: pointer to struct i2o_pool which should be freed
974 *
975 * Note that you have to return all objects to the mempool again before
976 * calling i2o_pool_free().
977 */
978static inline void i2o_pool_free(struct i2o_pool *pool)
979{
980 mempool_destroy(pool->mempool);
981 kmem_cache_destroy(pool->slab);
982 kfree(pool->name);
983};
984
566/* I2O driver (OSM) functions */ 985/* I2O driver (OSM) functions */
567extern int i2o_driver_register(struct i2o_driver *); 986extern int i2o_driver_register(struct i2o_driver *);
568extern void i2o_driver_unregister(struct i2o_driver *); 987extern void i2o_driver_unregister(struct i2o_driver *);
@@ -638,39 +1057,89 @@ extern int i2o_exec_lct_get(struct i2o_controller *);
638#define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj)) 1057#define kobj_to_i2o_device(kobj) to_i2o_device(container_of(kobj, struct device, kobj))
639 1058
640/** 1059/**
1060 * i2o_out_to_virt - Turn an I2O message to a virtual address
1061 * @c: controller
1062 * @m: message engine value
1063 *
1064 * Turn a receive message from an I2O controller bus address into
1065 * a Linux virtual address. The shared page frame is a linear block
1066 * so we simply have to shift the offset. This function does not
1067 * work for sender side messages as they are ioremap objects
1068 * provided by the I2O controller.
1069 */
1070static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c,
1071 u32 m)
1072{
1073 BUG_ON(m < c->out_queue.phys
1074 || m >= c->out_queue.phys + c->out_queue.len);
1075
1076 return c->out_queue.virt + (m - c->out_queue.phys);
1077};
1078
1079/**
1080 * i2o_msg_in_to_virt - Turn an I2O message to a virtual address
1081 * @c: controller
1082 * @m: message engine value
1083 *
1084 * Turn a send message from an I2O controller bus address into
1085 * a Linux virtual address. The shared page frame is a linear block
1086 * so we simply have to shift the offset. This function does not
1087 * work for receive side messages as they are kmalloc objects
1088 * in a different pool.
1089 */
1090static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct
1091 i2o_controller *c,
1092 u32 m)
1093{
1094 return c->in_queue.virt + m;
1095};
1096
1097/**
641 * i2o_msg_get - obtain an I2O message from the IOP 1098 * i2o_msg_get - obtain an I2O message from the IOP
642 * @c: I2O controller 1099 * @c: I2O controller
643 * @msg: pointer to a I2O message pointer
644 * 1100 *
645 * This function tries to get a message slot. If no message slot is 1101 * This function tries to get a message frame. If no message frame is
646 * available do not wait until one is availabe (see also i2o_msg_get_wait). 1102 * available do not wait until one is availabe (see also i2o_msg_get_wait).
1103 * The returned pointer to the message frame is not in I/O memory, it is
1104 * allocated from a mempool. But because a MFA is allocated from the
1105 * controller too it is guaranteed that i2o_msg_post() will never fail.
647 * 1106 *
648 * On a success the message is returned and the pointer to the message is 1107 * On a success a pointer to the message frame is returned. If the message
649 * set in msg. The returned message is the physical page frame offset 1108 * queue is empty -EBUSY is returned and if no memory is available -ENOMEM
650 * address from the read port (see the i2o spec). If no message is 1109 * is returned.
651 * available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
652 */ 1110 */
653static inline u32 i2o_msg_get(struct i2o_controller *c, 1111static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c)
654 struct i2o_message __iomem ** msg)
655{ 1112{
656 u32 m = readl(c->in_port); 1113 struct i2o_msg_mfa *mmsg = mempool_alloc(c->in_msg.mempool, GFP_ATOMIC);
657 1114 if (!mmsg)
658 if (m != I2O_QUEUE_EMPTY) 1115 return ERR_PTR(-ENOMEM);
659 *msg = c->in_queue.virt + m; 1116
1117 mmsg->mfa = readl(c->in_port);
1118 if (mmsg->mfa == I2O_QUEUE_EMPTY) {
1119 mempool_free(mmsg, c->in_msg.mempool);
1120 return ERR_PTR(-EBUSY);
1121 }
660 1122
661 return m; 1123 return &mmsg->msg;
662}; 1124};
663 1125
664/** 1126/**
665 * i2o_msg_post - Post I2O message to I2O controller 1127 * i2o_msg_post - Post I2O message to I2O controller
666 * @c: I2O controller to which the message should be send 1128 * @c: I2O controller to which the message should be send
667 * @m: the message identifier 1129 * @msg: message returned by i2o_msg_get()
668 * 1130 *
669 * Post the message to the I2O controller. 1131 * Post the message to the I2O controller and return immediately.
670 */ 1132 */
671static inline void i2o_msg_post(struct i2o_controller *c, u32 m) 1133static inline void i2o_msg_post(struct i2o_controller *c,
1134 struct i2o_message *msg)
672{ 1135{
673 writel(m, c->in_port); 1136 struct i2o_msg_mfa *mmsg;
1137
1138 mmsg = container_of(msg, struct i2o_msg_mfa, msg);
1139 memcpy_toio(i2o_msg_in_to_virt(c, mmsg->mfa), msg,
1140 (le32_to_cpu(msg->u.head[0]) >> 16) << 2);
1141 writel(mmsg->mfa, c->in_port);
1142 mempool_free(mmsg, c->in_msg.mempool);
674}; 1143};
675 1144
676/** 1145/**
@@ -685,62 +1154,66 @@ static inline void i2o_msg_post(struct i2o_controller *c, u32 m)
685 * 1154 *
686 * Returns 0 on success or negative error code on failure. 1155 * Returns 0 on success or negative error code on failure.
687 */ 1156 */
688static inline int i2o_msg_post_wait(struct i2o_controller *c, u32 m, 1157static inline int i2o_msg_post_wait(struct i2o_controller *c,
1158 struct i2o_message *msg,
689 unsigned long timeout) 1159 unsigned long timeout)
690{ 1160{
691 return i2o_msg_post_wait_mem(c, m, timeout, NULL); 1161 return i2o_msg_post_wait_mem(c, msg, timeout, NULL);
692}; 1162};
693 1163
694/** 1164/**
695 * i2o_flush_reply - Flush reply from I2O controller 1165 * i2o_msg_nop_mfa - Returns a fetched MFA back to the controller
696 * @c: I2O controller 1166 * @c: I2O controller from which the MFA was fetched
697 * @m: the message identifier 1167 * @mfa: MFA which should be returned
698 * 1168 *
699 * The I2O controller must be informed that the reply message is not needed 1169 * This function must be used for preserved messages, because i2o_msg_nop()
700 * anymore. If you forget to flush the reply, the message frame can't be 1170 * also returns the allocated memory back to the msg_pool mempool.
701 * used by the controller anymore and is therefore lost.
702 */ 1171 */
703static inline void i2o_flush_reply(struct i2o_controller *c, u32 m) 1172static inline void i2o_msg_nop_mfa(struct i2o_controller *c, u32 mfa)
704{ 1173{
705 writel(m, c->out_port); 1174 struct i2o_message __iomem *msg;
1175 u32 nop[3] = {
1176 THREE_WORD_MSG_SIZE | SGL_OFFSET_0,
1177 I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | ADAPTER_TID,
1178 0x00000000
1179 };
1180
1181 msg = i2o_msg_in_to_virt(c, mfa);
1182 memcpy_toio(msg, nop, sizeof(nop));
1183 writel(mfa, c->in_port);
706}; 1184};
707 1185
708/** 1186/**
709 * i2o_out_to_virt - Turn an I2O message to a virtual address 1187 * i2o_msg_nop - Returns a message which is not used
710 * @c: controller 1188 * @c: I2O controller from which the message was created
711 * @m: message engine value 1189 * @msg: message which should be returned
712 * 1190 *
713 * Turn a receive message from an I2O controller bus address into 1191 * If you fetch a message via i2o_msg_get, and can't use it, you must
714 * a Linux virtual address. The shared page frame is a linear block 1192 * return the message with this function. Otherwise the MFA is lost as well
715 * so we simply have to shift the offset. This function does not 1193 * as the allocated memory from the mempool.
716 * work for sender side messages as they are ioremap objects
717 * provided by the I2O controller.
718 */ 1194 */
719static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c, 1195static inline void i2o_msg_nop(struct i2o_controller *c,
720 u32 m) 1196 struct i2o_message *msg)
721{ 1197{
722 BUG_ON(m < c->out_queue.phys 1198 struct i2o_msg_mfa *mmsg;
723 || m >= c->out_queue.phys + c->out_queue.len); 1199 mmsg = container_of(msg, struct i2o_msg_mfa, msg);
724 1200
725 return c->out_queue.virt + (m - c->out_queue.phys); 1201 i2o_msg_nop_mfa(c, mmsg->mfa);
1202 mempool_free(mmsg, c->in_msg.mempool);
726}; 1203};
727 1204
728/** 1205/**
729 * i2o_msg_in_to_virt - Turn an I2O message to a virtual address 1206 * i2o_flush_reply - Flush reply from I2O controller
730 * @c: controller 1207 * @c: I2O controller
731 * @m: message engine value 1208 * @m: the message identifier
732 * 1209 *
733 * Turn a send message from an I2O controller bus address into 1210 * The I2O controller must be informed that the reply message is not needed
734 * a Linux virtual address. The shared page frame is a linear block 1211 * anymore. If you forget to flush the reply, the message frame can't be
735 * so we simply have to shift the offset. This function does not 1212 * used by the controller anymore and is therefore lost.
736 * work for receive side messages as they are kmalloc objects
737 * in a different pool.
738 */ 1213 */
739static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct 1214static inline void i2o_flush_reply(struct i2o_controller *c, u32 m)
740 i2o_controller *c,
741 u32 m)
742{ 1215{
743 return c->in_queue.virt + m; 1216 writel(m, c->out_port);
744}; 1217};
745 1218
746/* 1219/*
@@ -779,350 +1252,5 @@ extern void i2o_dump_message(struct i2o_message *);
779extern void i2o_dump_hrt(struct i2o_controller *c); 1252extern void i2o_dump_hrt(struct i2o_controller *c);
780extern void i2o_debug_state(struct i2o_controller *c); 1253extern void i2o_debug_state(struct i2o_controller *c);
781 1254
782/*
783 * Cache strategies
784 */
785
786/* The NULL strategy leaves everything up to the controller. This tends to be a
787 * pessimal but functional choice.
788 */
789#define CACHE_NULL 0
790/* Prefetch data when reading. We continually attempt to load the next 32 sectors
791 * into the controller cache.
792 */
793#define CACHE_PREFETCH 1
794/* Prefetch data when reading. We sometimes attempt to load the next 32 sectors
795 * into the controller cache. When an I/O is less <= 8K we assume its probably
796 * not sequential and don't prefetch (default)
797 */
798#define CACHE_SMARTFETCH 2
799/* Data is written to the cache and then out on to the disk. The I/O must be
800 * physically on the medium before the write is acknowledged (default without
801 * NVRAM)
802 */
803#define CACHE_WRITETHROUGH 17
804/* Data is written to the cache and then out on to the disk. The controller
805 * is permitted to write back the cache any way it wants. (default if battery
806 * backed NVRAM is present). It can be useful to set this for swap regardless of
807 * battery state.
808 */
809#define CACHE_WRITEBACK 18
810/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
811 * write large I/O's directly to disk bypassing the cache to avoid the extra
812 * memory copy hits. Small writes are writeback cached
813 */
814#define CACHE_SMARTBACK 19
815/* Optimise for under powered controllers, especially on RAID1 and RAID0. We
816 * write large I/O's directly to disk bypassing the cache to avoid the extra
817 * memory copy hits. Small writes are writethrough cached. Suitable for devices
818 * lacking battery backup
819 */
820#define CACHE_SMARTTHROUGH 20
821
822/*
823 * Ioctl structures
824 */
825
826#define BLKI2OGRSTRAT _IOR('2', 1, int)
827#define BLKI2OGWSTRAT _IOR('2', 2, int)
828#define BLKI2OSRSTRAT _IOW('2', 3, int)
829#define BLKI2OSWSTRAT _IOW('2', 4, int)
830
831/*
832 * I2O Function codes
833 */
834
835/*
836 * Executive Class
837 */
838#define I2O_CMD_ADAPTER_ASSIGN 0xB3
839#define I2O_CMD_ADAPTER_READ 0xB2
840#define I2O_CMD_ADAPTER_RELEASE 0xB5
841#define I2O_CMD_BIOS_INFO_SET 0xA5
842#define I2O_CMD_BOOT_DEVICE_SET 0xA7
843#define I2O_CMD_CONFIG_VALIDATE 0xBB
844#define I2O_CMD_CONN_SETUP 0xCA
845#define I2O_CMD_DDM_DESTROY 0xB1
846#define I2O_CMD_DDM_ENABLE 0xD5
847#define I2O_CMD_DDM_QUIESCE 0xC7
848#define I2O_CMD_DDM_RESET 0xD9
849#define I2O_CMD_DDM_SUSPEND 0xAF
850#define I2O_CMD_DEVICE_ASSIGN 0xB7
851#define I2O_CMD_DEVICE_RELEASE 0xB9
852#define I2O_CMD_HRT_GET 0xA8
853#define I2O_CMD_ADAPTER_CLEAR 0xBE
854#define I2O_CMD_ADAPTER_CONNECT 0xC9
855#define I2O_CMD_ADAPTER_RESET 0xBD
856#define I2O_CMD_LCT_NOTIFY 0xA2
857#define I2O_CMD_OUTBOUND_INIT 0xA1
858#define I2O_CMD_PATH_ENABLE 0xD3
859#define I2O_CMD_PATH_QUIESCE 0xC5
860#define I2O_CMD_PATH_RESET 0xD7
861#define I2O_CMD_STATIC_MF_CREATE 0xDD
862#define I2O_CMD_STATIC_MF_RELEASE 0xDF
863#define I2O_CMD_STATUS_GET 0xA0
864#define I2O_CMD_SW_DOWNLOAD 0xA9
865#define I2O_CMD_SW_UPLOAD 0xAB
866#define I2O_CMD_SW_REMOVE 0xAD
867#define I2O_CMD_SYS_ENABLE 0xD1
868#define I2O_CMD_SYS_MODIFY 0xC1
869#define I2O_CMD_SYS_QUIESCE 0xC3
870#define I2O_CMD_SYS_TAB_SET 0xA3
871
872/*
873 * Utility Class
874 */
875#define I2O_CMD_UTIL_NOP 0x00
876#define I2O_CMD_UTIL_ABORT 0x01
877#define I2O_CMD_UTIL_CLAIM 0x09
878#define I2O_CMD_UTIL_RELEASE 0x0B
879#define I2O_CMD_UTIL_PARAMS_GET 0x06
880#define I2O_CMD_UTIL_PARAMS_SET 0x05
881#define I2O_CMD_UTIL_EVT_REGISTER 0x13
882#define I2O_CMD_UTIL_EVT_ACK 0x14
883#define I2O_CMD_UTIL_CONFIG_DIALOG 0x10
884#define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D
885#define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F
886#define I2O_CMD_UTIL_LOCK 0x17
887#define I2O_CMD_UTIL_LOCK_RELEASE 0x19
888#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15
889
890/*
891 * SCSI Host Bus Adapter Class
892 */
893#define I2O_CMD_SCSI_EXEC 0x81
894#define I2O_CMD_SCSI_ABORT 0x83
895#define I2O_CMD_SCSI_BUSRESET 0x27
896
897/*
898 * Bus Adapter Class
899 */
900#define I2O_CMD_BUS_ADAPTER_RESET 0x85
901#define I2O_CMD_BUS_RESET 0x87
902#define I2O_CMD_BUS_SCAN 0x89
903#define I2O_CMD_BUS_QUIESCE 0x8b
904
905/*
906 * Random Block Storage Class
907 */
908#define I2O_CMD_BLOCK_READ 0x30
909#define I2O_CMD_BLOCK_WRITE 0x31
910#define I2O_CMD_BLOCK_CFLUSH 0x37
911#define I2O_CMD_BLOCK_MLOCK 0x49
912#define I2O_CMD_BLOCK_MUNLOCK 0x4B
913#define I2O_CMD_BLOCK_MMOUNT 0x41
914#define I2O_CMD_BLOCK_MEJECT 0x43
915#define I2O_CMD_BLOCK_POWER 0x70
916
917#define I2O_CMD_PRIVATE 0xFF
918
919/* Command status values */
920
921#define I2O_CMD_IN_PROGRESS 0x01
922#define I2O_CMD_REJECTED 0x02
923#define I2O_CMD_FAILED 0x03
924#define I2O_CMD_COMPLETED 0x04
925
926/* I2O API function return values */
927
928#define I2O_RTN_NO_ERROR 0
929#define I2O_RTN_NOT_INIT 1
930#define I2O_RTN_FREE_Q_EMPTY 2
931#define I2O_RTN_TCB_ERROR 3
932#define I2O_RTN_TRANSACTION_ERROR 4
933#define I2O_RTN_ADAPTER_ALREADY_INIT 5
934#define I2O_RTN_MALLOC_ERROR 6
935#define I2O_RTN_ADPTR_NOT_REGISTERED 7
936#define I2O_RTN_MSG_REPLY_TIMEOUT 8
937#define I2O_RTN_NO_STATUS 9
938#define I2O_RTN_NO_FIRM_VER 10
939#define I2O_RTN_NO_LINK_SPEED 11
940
941/* Reply message status defines for all messages */
942
943#define I2O_REPLY_STATUS_SUCCESS 0x00
944#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01
945#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02
946#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03
947#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04
948#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05
949#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06
950#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08
951#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09
952#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A
953#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B
954#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80
955
956/* Status codes and Error Information for Parameter functions */
957
958#define I2O_PARAMS_STATUS_SUCCESS 0x00
959#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01
960#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02
961#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03
962#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04
963#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05
964#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06
965#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07
966#define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08
967#define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09
968#define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A
969#define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B
970#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C
971#define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D
972#define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E
973#define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F
974#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10
975
976/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error
977 * messages: Table 3-2 Detailed Status Codes.*/
978
979#define I2O_DSC_SUCCESS 0x0000
980#define I2O_DSC_BAD_KEY 0x0002
981#define I2O_DSC_TCL_ERROR 0x0003
982#define I2O_DSC_REPLY_BUFFER_FULL 0x0004
983#define I2O_DSC_NO_SUCH_PAGE 0x0005
984#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006
985#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007
986#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009
987#define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A
988#define I2O_DSC_DEVICE_LOCKED 0x000B
989#define I2O_DSC_DEVICE_RESET 0x000C
990#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D
991#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E
992#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F
993#define I2O_DSC_INVALID_OFFSET 0x0010
994#define I2O_DSC_INVALID_PARAMETER 0x0011
995#define I2O_DSC_INVALID_REQUEST 0x0012
996#define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013
997#define I2O_DSC_MESSAGE_TOO_LARGE 0x0014
998#define I2O_DSC_MESSAGE_TOO_SMALL 0x0015
999#define I2O_DSC_MISSING_PARAMETER 0x0016
1000#define I2O_DSC_TIMEOUT 0x0017
1001#define I2O_DSC_UNKNOWN_ERROR 0x0018
1002#define I2O_DSC_UNKNOWN_FUNCTION 0x0019
1003#define I2O_DSC_UNSUPPORTED_VERSION 0x001A
1004#define I2O_DSC_DEVICE_BUSY 0x001B
1005#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
1006
1007/* DetailedStatusCode defines for Block Storage Operation: Table 6-7 Detailed
1008 Status Codes.*/
1009
1010#define I2O_BSA_DSC_SUCCESS 0x0000
1011#define I2O_BSA_DSC_MEDIA_ERROR 0x0001
1012#define I2O_BSA_DSC_ACCESS_ERROR 0x0002
1013#define I2O_BSA_DSC_DEVICE_FAILURE 0x0003
1014#define I2O_BSA_DSC_DEVICE_NOT_READY 0x0004
1015#define I2O_BSA_DSC_MEDIA_NOT_PRESENT 0x0005
1016#define I2O_BSA_DSC_MEDIA_LOCKED 0x0006
1017#define I2O_BSA_DSC_MEDIA_FAILURE 0x0007
1018#define I2O_BSA_DSC_PROTOCOL_FAILURE 0x0008
1019#define I2O_BSA_DSC_BUS_FAILURE 0x0009
1020#define I2O_BSA_DSC_ACCESS_VIOLATION 0x000A
1021#define I2O_BSA_DSC_WRITE_PROTECTED 0x000B
1022#define I2O_BSA_DSC_DEVICE_RESET 0x000C
1023#define I2O_BSA_DSC_VOLUME_CHANGED 0x000D
1024#define I2O_BSA_DSC_TIMEOUT 0x000E
1025
1026/* FailureStatusCodes, Table 3-3 Message Failure Codes */
1027
1028#define I2O_FSC_TRANSPORT_SERVICE_SUSPENDED 0x81
1029#define I2O_FSC_TRANSPORT_SERVICE_TERMINATED 0x82
1030#define I2O_FSC_TRANSPORT_CONGESTION 0x83
1031#define I2O_FSC_TRANSPORT_FAILURE 0x84
1032#define I2O_FSC_TRANSPORT_STATE_ERROR 0x85
1033#define I2O_FSC_TRANSPORT_TIME_OUT 0x86
1034#define I2O_FSC_TRANSPORT_ROUTING_FAILURE 0x87
1035#define I2O_FSC_TRANSPORT_INVALID_VERSION 0x88
1036#define I2O_FSC_TRANSPORT_INVALID_OFFSET 0x89
1037#define I2O_FSC_TRANSPORT_INVALID_MSG_FLAGS 0x8A
1038#define I2O_FSC_TRANSPORT_FRAME_TOO_SMALL 0x8B
1039#define I2O_FSC_TRANSPORT_FRAME_TOO_LARGE 0x8C
1040#define I2O_FSC_TRANSPORT_INVALID_TARGET_ID 0x8D
1041#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_ID 0x8E
1042#define I2O_FSC_TRANSPORT_INVALID_INITIATOR_CONTEXT 0x8F
1043#define I2O_FSC_TRANSPORT_UNKNOWN_FAILURE 0xFF
1044
1045/* Device Claim Types */
1046#define I2O_CLAIM_PRIMARY 0x01000000
1047#define I2O_CLAIM_MANAGEMENT 0x02000000
1048#define I2O_CLAIM_AUTHORIZED 0x03000000
1049#define I2O_CLAIM_SECONDARY 0x04000000
1050
1051/* Message header defines for VersionOffset */
1052#define I2OVER15 0x0001
1053#define I2OVER20 0x0002
1054
1055/* Default is 1.5 */
1056#define I2OVERSION I2OVER15
1057
1058#define SGL_OFFSET_0 I2OVERSION
1059#define SGL_OFFSET_4 (0x0040 | I2OVERSION)
1060#define SGL_OFFSET_5 (0x0050 | I2OVERSION)
1061#define SGL_OFFSET_6 (0x0060 | I2OVERSION)
1062#define SGL_OFFSET_7 (0x0070 | I2OVERSION)
1063#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
1064#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
1065#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
1066#define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
1067#define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
1068#define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
1069
1070/* Transaction Reply Lists (TRL) Control Word structure */
1071#define TRL_SINGLE_FIXED_LENGTH 0x00
1072#define TRL_SINGLE_VARIABLE_LENGTH 0x40
1073#define TRL_MULTIPLE_FIXED_LENGTH 0x80
1074
1075 /* msg header defines for MsgFlags */
1076#define MSG_STATIC 0x0100
1077#define MSG_64BIT_CNTXT 0x0200
1078#define MSG_MULTI_TRANS 0x1000
1079#define MSG_FAIL 0x2000
1080#define MSG_FINAL 0x4000
1081#define MSG_REPLY 0x8000
1082
1083 /* minimum size msg */
1084#define THREE_WORD_MSG_SIZE 0x00030000
1085#define FOUR_WORD_MSG_SIZE 0x00040000
1086#define FIVE_WORD_MSG_SIZE 0x00050000
1087#define SIX_WORD_MSG_SIZE 0x00060000
1088#define SEVEN_WORD_MSG_SIZE 0x00070000
1089#define EIGHT_WORD_MSG_SIZE 0x00080000
1090#define NINE_WORD_MSG_SIZE 0x00090000
1091#define TEN_WORD_MSG_SIZE 0x000A0000
1092#define ELEVEN_WORD_MSG_SIZE 0x000B0000
1093#define I2O_MESSAGE_SIZE(x) ((x)<<16)
1094
1095/* special TID assignments */
1096#define ADAPTER_TID 0
1097#define HOST_TID 1
1098
1099/* outbound queue defines */
1100#define I2O_MAX_OUTBOUND_MSG_FRAMES 128
1101#define I2O_OUTBOUND_MSG_FRAME_SIZE 128 /* in 32-bit words */
1102
1103#define I2O_POST_WAIT_OK 0
1104#define I2O_POST_WAIT_TIMEOUT -ETIMEDOUT
1105
1106#define I2O_CONTEXT_LIST_MIN_LENGTH 15
1107#define I2O_CONTEXT_LIST_USED 0x01
1108#define I2O_CONTEXT_LIST_DELETED 0x02
1109
1110/* timeouts */
1111#define I2O_TIMEOUT_INIT_OUTBOUND_QUEUE 15
1112#define I2O_TIMEOUT_MESSAGE_GET 5
1113#define I2O_TIMEOUT_RESET 30
1114#define I2O_TIMEOUT_STATUS_GET 5
1115#define I2O_TIMEOUT_LCT_GET 360
1116#define I2O_TIMEOUT_SCSI_SCB_ABORT 240
1117
1118/* retries */
1119#define I2O_HRT_GET_TRIES 3
1120#define I2O_LCT_GET_TRIES 3
1121
1122/* defines for max_sectors and max_phys_segments */
1123#define I2O_MAX_SECTORS 1024
1124#define I2O_MAX_SECTORS_LIMITED 256
1125#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
1126
1127#endif /* __KERNEL__ */ 1255#endif /* __KERNEL__ */
1128#endif /* _I2O_H */ 1256#endif /* _I2O_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 7b6a6a58e465..f2e1b5b22898 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -18,6 +18,7 @@
18#include <linux/bio.h> 18#include <linux/bio.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/pci.h> 20#include <linux/pci.h>
21#include <linux/completion.h>
21#include <asm/byteorder.h> 22#include <asm/byteorder.h>
22#include <asm/system.h> 23#include <asm/system.h>
23#include <asm/io.h> 24#include <asm/io.h>
@@ -638,7 +639,7 @@ typedef struct ide_drive_s {
638 int crc_count; /* crc counter to reduce drive speed */ 639 int crc_count; /* crc counter to reduce drive speed */
639 struct list_head list; 640 struct list_head list;
640 struct device gendev; 641 struct device gendev;
641 struct semaphore gendev_rel_sem; /* to deal with device release() */ 642 struct completion gendev_rel_comp; /* to deal with device release() */
642} ide_drive_t; 643} ide_drive_t;
643 644
644#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) 645#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev)
@@ -794,14 +795,14 @@ typedef struct hwif_s {
794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 795 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
795 796
796 struct device gendev; 797 struct device gendev;
797 struct semaphore gendev_rel_sem; /* To deal with device release() */ 798 struct completion gendev_rel_comp; /* To deal with device release() */
798 799
799 void *hwif_data; /* extra hwif data */ 800 void *hwif_data; /* extra hwif data */
800 801
801 unsigned dma; 802 unsigned dma;
802 803
803 void (*led_act)(void *data, int rw); 804 void (*led_act)(void *data, int rw);
804} ____cacheline_maxaligned_in_smp ide_hwif_t; 805} ____cacheline_internodealigned_in_smp ide_hwif_t;
805 806
806/* 807/*
807 * internal ide interrupt handler type 808 * internal ide interrupt handler type
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 511999c7eeda..395f0aad9cbf 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -131,17 +131,17 @@ struct frad_conf
131/* these are the fields of an RFC 1490 header */ 131/* these are the fields of an RFC 1490 header */
132struct frhdr 132struct frhdr
133{ 133{
134 unsigned char control __attribute__((packed)); 134 unsigned char control;
135 135
136 /* for IP packets, this can be the NLPID */ 136 /* for IP packets, this can be the NLPID */
137 unsigned char pad __attribute__((packed)); 137 unsigned char pad;
138 138
139 unsigned char NLPID __attribute__((packed)); 139 unsigned char NLPID;
140 unsigned char OUI[3] __attribute__((packed)); 140 unsigned char OUI[3];
141 unsigned short PID __attribute__((packed)); 141 unsigned short PID;
142 142
143#define IP_NLPID pad 143#define IP_NLPID pad
144}; 144} __attribute__((packed));
145 145
146/* see RFC 1490 for the definition of the following */ 146/* see RFC 1490 for the definition of the following */
147#define FRAD_I_UI 0x03 147#define FRAD_I_UI 0x03
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index e677f73f13dd..4fab3d0a4bce 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -157,8 +157,7 @@ struct pppox_proto {
157extern int register_pppox_proto(int proto_num, struct pppox_proto *pp); 157extern int register_pppox_proto(int proto_num, struct pppox_proto *pp);
158extern void unregister_pppox_proto(int proto_num); 158extern void unregister_pppox_proto(int proto_num);
159extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ 159extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
160extern int pppox_channel_ioctl(struct ppp_channel *pc, unsigned int cmd, 160extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
161 unsigned long arg);
162 161
163/* PPPoX socket states */ 162/* PPPoX socket states */
164enum { 163enum {
diff --git a/include/linux/inet.h b/include/linux/inet.h
index 3b5e9fdff872..6c5587af118d 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -45,6 +45,6 @@
45#ifdef __KERNEL__ 45#ifdef __KERNEL__
46#include <linux/types.h> 46#include <linux/types.h>
47 47
48extern __u32 in_aton(const char *str); 48extern __be32 in_aton(const char *str);
49#endif 49#endif
50#endif /* _LINUX_INET_H */ 50#endif /* _LINUX_INET_H */
diff --git a/include/linux/input.h b/include/linux/input.h
index 3c5823368ddb..6d4cc3c110d6 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -13,6 +13,7 @@
13#include <linux/time.h> 13#include <linux/time.h>
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/mod_devicetable.h>
16#else 17#else
17#include <sys/time.h> 18#include <sys/time.h>
18#include <sys/ioctl.h> 19#include <sys/ioctl.h>
@@ -511,6 +512,8 @@ struct input_absinfo {
511#define KEY_FN_S 0x1e3 512#define KEY_FN_S 0x1e3
512#define KEY_FN_B 0x1e4 513#define KEY_FN_B 0x1e4
513 514
515/* We avoid low common keys in module aliases so they don't get huge. */
516#define KEY_MIN_INTERESTING KEY_MUTE
514#define KEY_MAX 0x1ff 517#define KEY_MAX 0x1ff
515 518
516/* 519/*
@@ -793,6 +796,44 @@ struct ff_effect {
793 796
794#define FF_MAX 0x7f 797#define FF_MAX 0x7f
795 798
799struct input_device_id {
800
801 kernel_ulong_t flags;
802
803 struct input_id id;
804
805 kernel_ulong_t evbit[EV_MAX/BITS_PER_LONG+1];
806 kernel_ulong_t keybit[KEY_MAX/BITS_PER_LONG+1];
807 kernel_ulong_t relbit[REL_MAX/BITS_PER_LONG+1];
808 kernel_ulong_t absbit[ABS_MAX/BITS_PER_LONG+1];
809 kernel_ulong_t mscbit[MSC_MAX/BITS_PER_LONG+1];
810 kernel_ulong_t ledbit[LED_MAX/BITS_PER_LONG+1];
811 kernel_ulong_t sndbit[SND_MAX/BITS_PER_LONG+1];
812 kernel_ulong_t ffbit[FF_MAX/BITS_PER_LONG+1];
813 kernel_ulong_t swbit[SW_MAX/BITS_PER_LONG+1];
814
815 kernel_ulong_t driver_info;
816};
817
818/*
819 * Structure for hotplug & device<->driver matching.
820 */
821
822#define INPUT_DEVICE_ID_MATCH_BUS 1
823#define INPUT_DEVICE_ID_MATCH_VENDOR 2
824#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
825#define INPUT_DEVICE_ID_MATCH_VERSION 8
826
827#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
828#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
829#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
830#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
831#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
832#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
833#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
834#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
835#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
836
796#ifdef __KERNEL__ 837#ifdef __KERNEL__
797 838
798/* 839/*
@@ -901,49 +942,11 @@ struct input_dev {
901}; 942};
902#define to_input_dev(d) container_of(d, struct input_dev, cdev) 943#define to_input_dev(d) container_of(d, struct input_dev, cdev)
903 944
904/*
905 * Structure for hotplug & device<->driver matching.
906 */
907
908#define INPUT_DEVICE_ID_MATCH_BUS 1
909#define INPUT_DEVICE_ID_MATCH_VENDOR 2
910#define INPUT_DEVICE_ID_MATCH_PRODUCT 4
911#define INPUT_DEVICE_ID_MATCH_VERSION 8
912
913#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
914#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
915#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
916#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
917#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
918#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
919#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
920#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
921#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000
922
923#define INPUT_DEVICE_ID_MATCH_DEVICE\ 945#define INPUT_DEVICE_ID_MATCH_DEVICE\
924 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) 946 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
925#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\ 947#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\
926 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) 948 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
927 949
928struct input_device_id {
929
930 unsigned long flags;
931
932 struct input_id id;
933
934 unsigned long evbit[NBITS(EV_MAX)];
935 unsigned long keybit[NBITS(KEY_MAX)];
936 unsigned long relbit[NBITS(REL_MAX)];
937 unsigned long absbit[NBITS(ABS_MAX)];
938 unsigned long mscbit[NBITS(MSC_MAX)];
939 unsigned long ledbit[NBITS(LED_MAX)];
940 unsigned long sndbit[NBITS(SND_MAX)];
941 unsigned long ffbit[NBITS(FF_MAX)];
942 unsigned long swbit[NBITS(SW_MAX)];
943
944 unsigned long driver_info;
945};
946
947struct input_handle; 950struct input_handle;
948 951
949struct input_handler { 952struct input_handler {
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 41f150a3d2dd..2c08fdc2bdf7 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -79,7 +79,7 @@ static inline void __deprecated save_flags(unsigned long *x)
79{ 79{
80 local_save_flags(*x); 80 local_save_flags(*x);
81} 81}
82#define save_flags(x) save_flags(&x); 82#define save_flags(x) save_flags(&x)
83static inline void __deprecated restore_flags(unsigned long x) 83static inline void __deprecated restore_flags(unsigned long x)
84{ 84{
85 local_irq_restore(x); 85 local_irq_restore(x);
@@ -112,7 +112,7 @@ enum
112 TIMER_SOFTIRQ, 112 TIMER_SOFTIRQ,
113 NET_TX_SOFTIRQ, 113 NET_TX_SOFTIRQ,
114 NET_RX_SOFTIRQ, 114 NET_RX_SOFTIRQ,
115 SCSI_SOFTIRQ, 115 BLOCK_SOFTIRQ,
116 TASKLET_SOFTIRQ 116 TASKLET_SOFTIRQ
117}; 117};
118 118
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 33e8a19a1a0f..4b55cf1df732 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -16,6 +16,7 @@
16 */ 16 */
17#ifndef _LINUX_IP_H 17#ifndef _LINUX_IP_H
18#define _LINUX_IP_H 18#define _LINUX_IP_H
19#include <linux/types.h>
19#include <asm/byteorder.h> 20#include <asm/byteorder.h>
20 21
21#define IPTOS_TOS_MASK 0x1E 22#define IPTOS_TOS_MASK 0x1E
@@ -78,126 +79,6 @@
78#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ 79#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
79#define IPOPT_TS_PRESPEC 3 /* specified modules only */ 80#define IPOPT_TS_PRESPEC 3 /* specified modules only */
80 81
81#ifdef __KERNEL__
82#include <linux/config.h>
83#include <linux/types.h>
84#include <net/request_sock.h>
85#include <net/sock.h>
86#include <linux/igmp.h>
87#include <net/flow.h>
88
89struct ip_options {
90 __u32 faddr; /* Saved first hop address */
91 unsigned char optlen;
92 unsigned char srr;
93 unsigned char rr;
94 unsigned char ts;
95 unsigned char is_setbyuser:1, /* Set by setsockopt? */
96 is_data:1, /* Options in __data, rather than skb */
97 is_strictroute:1, /* Strict source route */
98 srr_is_hit:1, /* Packet destination addr was our one */
99 is_changed:1, /* IP checksum more not valid */
100 rr_needaddr:1, /* Need to record addr of outgoing dev */
101 ts_needtime:1, /* Need to record timestamp */
102 ts_needaddr:1; /* Need to record addr of outgoing dev */
103 unsigned char router_alert;
104 unsigned char __pad1;
105 unsigned char __pad2;
106 unsigned char __data[0];
107};
108
109#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
110
111struct inet_request_sock {
112 struct request_sock req;
113 u32 loc_addr;
114 u32 rmt_addr;
115 u16 rmt_port;
116 u16 snd_wscale : 4,
117 rcv_wscale : 4,
118 tstamp_ok : 1,
119 sack_ok : 1,
120 wscale_ok : 1,
121 ecn_ok : 1,
122 acked : 1;
123 struct ip_options *opt;
124};
125
126static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
127{
128 return (struct inet_request_sock *)sk;
129}
130
131struct ipv6_pinfo;
132
133struct inet_sock {
134 /* sk and pinet6 has to be the first two members of inet_sock */
135 struct sock sk;
136#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
137 struct ipv6_pinfo *pinet6;
138#endif
139 /* Socket demultiplex comparisons on incoming packets. */
140 __u32 daddr; /* Foreign IPv4 addr */
141 __u32 rcv_saddr; /* Bound local IPv4 addr */
142 __u16 dport; /* Destination port */
143 __u16 num; /* Local port */
144 __u32 saddr; /* Sending source */
145 __s16 uc_ttl; /* Unicast TTL */
146 __u16 cmsg_flags;
147 struct ip_options *opt;
148 __u16 sport; /* Source port */
149 __u16 id; /* ID counter for DF pkts */
150 __u8 tos; /* TOS */
151 __u8 mc_ttl; /* Multicasting TTL */
152 __u8 pmtudisc;
153 unsigned recverr : 1,
154 freebind : 1,
155 hdrincl : 1,
156 mc_loop : 1;
157 int mc_index; /* Multicast device index */
158 __u32 mc_addr;
159 struct ip_mc_socklist *mc_list; /* Group array */
160 /*
161 * Following members are used to retain the infomation to build
162 * an ip header on each ip fragmentation while the socket is corked.
163 */
164 struct {
165 unsigned int flags;
166 unsigned int fragsize;
167 struct ip_options *opt;
168 struct rtable *rt;
169 int length; /* Total length of all frames */
170 u32 addr;
171 struct flowi fl;
172 } cork;
173};
174
175#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
176#define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */
177
178static inline struct inet_sock *inet_sk(const struct sock *sk)
179{
180 return (struct inet_sock *)sk;
181}
182
183static inline void __inet_sk_copy_descendant(struct sock *sk_to,
184 const struct sock *sk_from,
185 const int ancestor_size)
186{
187 memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1,
188 sk_from->sk_prot->obj_size - ancestor_size);
189}
190#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE))
191static inline void inet_sk_copy_descendant(struct sock *sk_to,
192 const struct sock *sk_from)
193{
194 __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock));
195}
196#endif
197#endif
198
199extern int inet_sk_rebuild_header(struct sock *sk);
200
201struct iphdr { 82struct iphdr {
202#if defined(__LITTLE_ENDIAN_BITFIELD) 83#if defined(__LITTLE_ENDIAN_BITFIELD)
203 __u8 ihl:4, 84 __u8 ihl:4,
@@ -209,14 +90,14 @@ struct iphdr {
209#error "Please fix <asm/byteorder.h>" 90#error "Please fix <asm/byteorder.h>"
210#endif 91#endif
211 __u8 tos; 92 __u8 tos;
212 __u16 tot_len; 93 __be16 tot_len;
213 __u16 id; 94 __be16 id;
214 __u16 frag_off; 95 __be16 frag_off;
215 __u8 ttl; 96 __u8 ttl;
216 __u8 protocol; 97 __u8 protocol;
217 __u16 check; 98 __u16 check;
218 __u32 saddr; 99 __be32 saddr;
219 __u32 daddr; 100 __be32 daddr;
220 /*The options start here. */ 101 /*The options start here. */
221}; 102};
222 103
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index e0b922785d98..9c8f4c9ed429 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -171,12 +171,13 @@ enum {
171}; 171};
172 172
173#ifdef __KERNEL__ 173#ifdef __KERNEL__
174#include <linux/in6.h> /* struct sockaddr_in6 */
175#include <linux/icmpv6.h> 174#include <linux/icmpv6.h>
176#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
177#include <linux/tcp.h> 175#include <linux/tcp.h>
178#include <linux/udp.h> 176#include <linux/udp.h>
179 177
178#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
179#include <net/inet_sock.h>
180
180/* 181/*
181 This structure contains results of exthdrs parsing 182 This structure contains results of exthdrs parsing
182 as offsets from skb->nh. 183 as offsets from skb->nh.
@@ -190,6 +191,10 @@ struct inet6_skb_parm {
190 __u16 srcrt; 191 __u16 srcrt;
191 __u16 dst1; 192 __u16 dst1;
192 __u16 lastopt; 193 __u16 lastopt;
194 __u32 nhoff;
195 __u16 flags;
196
197#define IP6SKB_XFRM_TRANSFORMED 1
193}; 198};
194 199
195#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 200#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
@@ -199,18 +204,17 @@ static inline int inet6_iif(const struct sk_buff *skb)
199 return IP6CB(skb)->iif; 204 return IP6CB(skb)->iif;
200} 205}
201 206
202struct tcp6_request_sock { 207struct inet6_request_sock {
203 struct tcp_request_sock req;
204 struct in6_addr loc_addr; 208 struct in6_addr loc_addr;
205 struct in6_addr rmt_addr; 209 struct in6_addr rmt_addr;
206 struct sk_buff *pktopts; 210 struct sk_buff *pktopts;
207 int iif; 211 int iif;
208}; 212};
209 213
210static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk) 214struct tcp6_request_sock {
211{ 215 struct tcp_request_sock tcp6rsk_tcp;
212 return (struct tcp6_request_sock *)sk; 216 struct inet6_request_sock tcp6rsk_inet6;
213} 217};
214 218
215/** 219/**
216 * struct ipv6_pinfo - ipv6 private area 220 * struct ipv6_pinfo - ipv6 private area
@@ -298,12 +302,36 @@ struct tcp6_sock {
298 struct ipv6_pinfo inet6; 302 struct ipv6_pinfo inet6;
299}; 303};
300 304
305extern int inet6_sk_rebuild_header(struct sock *sk);
306
301#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 307#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
302static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) 308static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
303{ 309{
304 return inet_sk(__sk)->pinet6; 310 return inet_sk(__sk)->pinet6;
305} 311}
306 312
313static inline struct inet6_request_sock *
314 inet6_rsk(const struct request_sock *rsk)
315{
316 return (struct inet6_request_sock *)(((u8 *)rsk) +
317 inet_rsk(rsk)->inet6_rsk_offset);
318}
319
320static inline u32 inet6_rsk_offset(struct request_sock *rsk)
321{
322 return rsk->rsk_ops->obj_size - sizeof(struct inet6_request_sock);
323}
324
325static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops)
326{
327 struct request_sock *req = reqsk_alloc(ops);
328
329 if (req != NULL)
330 inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req);
331
332 return req;
333}
334
307static inline struct raw6_sock *raw6_sk(const struct sock *sk) 335static inline struct raw6_sock *raw6_sk(const struct sock *sk)
308{ 336{
309 return (struct raw6_sock *)sk; 337 return (struct raw6_sock *)sk;
@@ -323,28 +351,37 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
323#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) 351#define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only)
324#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) 352#define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk))
325 353
326#include <linux/tcp.h> 354struct inet6_timewait_sock {
355 struct in6_addr tw_v6_daddr;
356 struct in6_addr tw_v6_rcv_saddr;
357};
327 358
328struct tcp6_timewait_sock { 359struct tcp6_timewait_sock {
329 struct tcp_timewait_sock tw_v6_sk; 360 struct tcp_timewait_sock tcp6tw_tcp;
330 struct in6_addr tw_v6_daddr; 361 struct inet6_timewait_sock tcp6tw_inet6;
331 struct in6_addr tw_v6_rcv_saddr;
332}; 362};
333 363
334static inline struct tcp6_timewait_sock *tcp6_twsk(const struct sock *sk) 364static inline u16 inet6_tw_offset(const struct proto *prot)
335{ 365{
336 return (struct tcp6_timewait_sock *)sk; 366 return prot->twsk_prot->twsk_obj_size -
367 sizeof(struct inet6_timewait_sock);
337} 368}
338 369
339static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk) 370static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk)
371{
372 return (struct inet6_timewait_sock *)(((u8 *)sk) +
373 inet_twsk(sk)->tw_ipv6_offset);
374}
375
376static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk)
340{ 377{
341 return likely(sk->sk_state != TCP_TIME_WAIT) ? 378 return likely(sk->sk_state != TCP_TIME_WAIT) ?
342 &inet6_sk(sk)->rcv_saddr : &tcp6_twsk(sk)->tw_v6_rcv_saddr; 379 &inet6_sk(sk)->rcv_saddr : &inet6_twsk(sk)->tw_v6_rcv_saddr;
343} 380}
344 381
345static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk) 382static inline struct in6_addr *inet6_rcv_saddr(const struct sock *sk)
346{ 383{
347 return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL; 384 return sk->sk_family == AF_INET6 ? __inet6_rcv_saddr(sk) : NULL;
348} 385}
349 386
350static inline int inet_v6_ipv6only(const struct sock *sk) 387static inline int inet_v6_ipv6only(const struct sock *sk)
@@ -361,13 +398,19 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
361 return NULL; 398 return NULL;
362} 399}
363 400
401static inline struct inet6_request_sock *
402 inet6_rsk(const struct request_sock *rsk)
403{
404 return NULL;
405}
406
364static inline struct raw6_sock *raw6_sk(const struct sock *sk) 407static inline struct raw6_sock *raw6_sk(const struct sock *sk)
365{ 408{
366 return NULL; 409 return NULL;
367} 410}
368 411
369#define __tcp_v6_rcv_saddr(__sk) NULL 412#define __inet6_rcv_saddr(__sk) NULL
370#define tcp_v6_rcv_saddr(__sk) NULL 413#define inet6_rcv_saddr(__sk) NULL
371#define tcp_twsk_ipv6only(__sk) 0 414#define tcp_twsk_ipv6only(__sk) 0
372#define inet_v6_ipv6only(__sk) 0 415#define inet_v6_ipv6only(__sk) 0
373#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 416#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index f04ba20712a2..6c5d4c898ccb 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -12,7 +12,7 @@
12#include <linux/config.h> 12#include <linux/config.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14 14
15#if !defined(CONFIG_ARCH_S390) 15#if !defined(CONFIG_S390)
16 16
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18#include <linux/cache.h> 18#include <linux/cache.h>
@@ -221,6 +221,17 @@ extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
221extern int can_request_irq(unsigned int irq, unsigned long irqflags); 221extern int can_request_irq(unsigned int irq, unsigned long irqflags);
222 222
223extern void init_irq_proc(void); 223extern void init_irq_proc(void);
224
225#ifdef CONFIG_AUTO_IRQ_AFFINITY
226extern int select_smp_affinity(unsigned int irq);
227#else
228static inline int
229select_smp_affinity(unsigned int irq)
230{
231 return 1;
232}
233#endif
234
224#endif 235#endif
225 236
226extern hw_irq_controller no_irq_type; /* needed in every arch ? */ 237extern hw_irq_controller no_irq_type; /* needed in every arch ? */
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h
index 7a4eacd77cb2..04e10f9f14f8 100644
--- a/include/linux/isdnif.h
+++ b/include/linux/isdnif.h
@@ -282,43 +282,43 @@ typedef struct setup_parm {
282 282
283typedef struct T30_s { 283typedef struct T30_s {
284 /* session parameters */ 284 /* session parameters */
285 __u8 resolution __attribute__ ((packed)); 285 __u8 resolution;
286 __u8 rate __attribute__ ((packed)); 286 __u8 rate;
287 __u8 width __attribute__ ((packed)); 287 __u8 width;
288 __u8 length __attribute__ ((packed)); 288 __u8 length;
289 __u8 compression __attribute__ ((packed)); 289 __u8 compression;
290 __u8 ecm __attribute__ ((packed)); 290 __u8 ecm;
291 __u8 binary __attribute__ ((packed)); 291 __u8 binary;
292 __u8 scantime __attribute__ ((packed)); 292 __u8 scantime;
293 __u8 id[FAXIDLEN] __attribute__ ((packed)); 293 __u8 id[FAXIDLEN];
294 /* additional parameters */ 294 /* additional parameters */
295 __u8 phase __attribute__ ((packed)); 295 __u8 phase;
296 __u8 direction __attribute__ ((packed)); 296 __u8 direction;
297 __u8 code __attribute__ ((packed)); 297 __u8 code;
298 __u8 badlin __attribute__ ((packed)); 298 __u8 badlin;
299 __u8 badmul __attribute__ ((packed)); 299 __u8 badmul;
300 __u8 bor __attribute__ ((packed)); 300 __u8 bor;
301 __u8 fet __attribute__ ((packed)); 301 __u8 fet;
302 __u8 pollid[FAXIDLEN] __attribute__ ((packed)); 302 __u8 pollid[FAXIDLEN];
303 __u8 cq __attribute__ ((packed)); 303 __u8 cq;
304 __u8 cr __attribute__ ((packed)); 304 __u8 cr;
305 __u8 ctcrty __attribute__ ((packed)); 305 __u8 ctcrty;
306 __u8 minsp __attribute__ ((packed)); 306 __u8 minsp;
307 __u8 phcto __attribute__ ((packed)); 307 __u8 phcto;
308 __u8 rel __attribute__ ((packed)); 308 __u8 rel;
309 __u8 nbc __attribute__ ((packed)); 309 __u8 nbc;
310 /* remote station parameters */ 310 /* remote station parameters */
311 __u8 r_resolution __attribute__ ((packed)); 311 __u8 r_resolution;
312 __u8 r_rate __attribute__ ((packed)); 312 __u8 r_rate;
313 __u8 r_width __attribute__ ((packed)); 313 __u8 r_width;
314 __u8 r_length __attribute__ ((packed)); 314 __u8 r_length;
315 __u8 r_compression __attribute__ ((packed)); 315 __u8 r_compression;
316 __u8 r_ecm __attribute__ ((packed)); 316 __u8 r_ecm;
317 __u8 r_binary __attribute__ ((packed)); 317 __u8 r_binary;
318 __u8 r_scantime __attribute__ ((packed)); 318 __u8 r_scantime;
319 __u8 r_id[FAXIDLEN] __attribute__ ((packed)); 319 __u8 r_id[FAXIDLEN];
320 __u8 r_code __attribute__ ((packed)); 320 __u8 r_code;
321} T30_s; 321} __attribute__((packed)) T30_s;
322 322
323#define ISDN_TTY_FAX_CONN_IN 0 323#define ISDN_TTY_FAX_CONN_IN 0
324#define ISDN_TTY_FAX_CONN_OUT 1 324#define ISDN_TTY_FAX_CONN_OUT 1
diff --git a/include/linux/isicom.h b/include/linux/isicom.h
index 7c6eae7f6ed7..45b3d48f0978 100644
--- a/include/linux/isicom.h
+++ b/include/linux/isicom.h
@@ -4,47 +4,12 @@
4/*#define ISICOM_DEBUG*/ 4/*#define ISICOM_DEBUG*/
5/*#define ISICOM_DEBUG_DTR_RTS*/ 5/*#define ISICOM_DEBUG_DTR_RTS*/
6 6
7
8/*
9 * Firmware Loader definitions ...
10 */
11
12#define __MultiTech ('M'<<8)
13#define MIOCTL_LOAD_FIRMWARE (__MultiTech | 0x01)
14#define MIOCTL_READ_FIRMWARE (__MultiTech | 0x02)
15#define MIOCTL_XFER_CTRL (__MultiTech | 0x03)
16#define MIOCTL_RESET_CARD (__MultiTech | 0x04)
17
18#define DATA_SIZE 16
19
20typedef struct {
21 unsigned short exec_segment;
22 unsigned short exec_addr;
23} exec_record;
24
25typedef struct {
26 int board; /* Board to load */
27 unsigned short addr;
28 unsigned short count;
29} bin_header;
30
31typedef struct {
32 int board; /* Board to load */
33 unsigned short addr;
34 unsigned short count;
35 unsigned short segment;
36 unsigned char bin_data[DATA_SIZE];
37} bin_frame;
38
39#ifdef __KERNEL__ 7#ifdef __KERNEL__
40 8
41#define YES 1 9#define YES 1
42#define NO 0 10#define NO 0
43 11
44#define ISILOAD_MISC_MINOR 155 /* /dev/isctl */ 12/*
45#define ISILOAD_NAME "ISILoad"
46
47/*
48 * ISICOM Driver definitions ... 13 * ISICOM Driver definitions ...
49 * 14 *
50 */ 15 */
@@ -55,8 +20,8 @@ typedef struct {
55 * PCI definitions 20 * PCI definitions
56 */ 21 */
57 22
58 #define DEVID_COUNT 9 23#define DEVID_COUNT 9
59 #define VENDOR_ID 0x10b5 24#define VENDOR_ID 0x10b5
60 25
61/* 26/*
62 * These are now officially allocated numbers 27 * These are now officially allocated numbers
@@ -66,9 +31,9 @@ typedef struct {
66#define ISICOM_CMAJOR 113 /* callout */ 31#define ISICOM_CMAJOR 113 /* callout */
67#define ISICOM_MAGIC (('M' << 8) | 'T') 32#define ISICOM_MAGIC (('M' << 8) | 'T')
68 33
69#define WAKEUP_CHARS 256 /* hard coded for now */ 34#define WAKEUP_CHARS 256 /* hard coded for now */
70#define TX_SIZE 254 35#define TX_SIZE 254
71 36
72#define BOARD_COUNT 4 37#define BOARD_COUNT 4
73#define PORT_COUNT (BOARD_COUNT*16) 38#define PORT_COUNT (BOARD_COUNT*16)
74 39
@@ -98,18 +63,15 @@ typedef struct {
98#define ISICOM_INITIATE_XONXOFF 0x04 63#define ISICOM_INITIATE_XONXOFF 0x04
99#define ISICOM_RESPOND_XONXOFF 0x08 64#define ISICOM_RESPOND_XONXOFF 0x08
100 65
101#define InterruptTheCard(base) (outw(0,(base)+0xc))
102#define ClearInterrupt(base) (inw((base)+0x0a))
103
104#define BOARD(line) (((line) >> 4) & 0x3) 66#define BOARD(line) (((line) >> 4) & 0x3)
105 67
106 /* isi kill queue bitmap */ 68 /* isi kill queue bitmap */
107 69
108#define ISICOM_KILLTX 0x01 70#define ISICOM_KILLTX 0x01
109#define ISICOM_KILLRX 0x02 71#define ISICOM_KILLRX 0x02
110 72
111 /* isi_board status bitmap */ 73 /* isi_board status bitmap */
112 74
113#define FIRMWARE_LOADED 0x0001 75#define FIRMWARE_LOADED 0x0001
114#define BOARD_ACTIVE 0x0002 76#define BOARD_ACTIVE 0x0002
115 77
@@ -123,9 +85,8 @@ typedef struct {
123#define ISI_RTS 0x0200 85#define ISI_RTS 0x0200
124 86
125 87
126#define ISI_TXOK 0x0001 88#define ISI_TXOK 0x0001
127 89
128#endif /* __KERNEL__ */ 90#endif /* __KERNEL__ */
129 91
130#endif /* ISICOM_H */ 92#endif /* ISICOM_H */
131
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index dcde7adfdce5..558cb4c26ec9 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -498,6 +498,12 @@ struct transaction_s
498 struct journal_head *t_checkpoint_list; 498 struct journal_head *t_checkpoint_list;
499 499
500 /* 500 /*
501 * Doubly-linked circular list of all buffers submitted for IO while
502 * checkpointing. [j_list_lock]
503 */
504 struct journal_head *t_checkpoint_io_list;
505
506 /*
501 * Doubly-linked circular list of temporary buffers currently undergoing 507 * Doubly-linked circular list of temporary buffers currently undergoing
502 * IO in the log [j_list_lock] 508 * IO in the log [j_list_lock]
503 */ 509 */
@@ -843,7 +849,7 @@ extern void journal_commit_transaction(journal_t *);
843 849
844/* Checkpoint list management */ 850/* Checkpoint list management */
845int __journal_clean_checkpoint_list(journal_t *journal); 851int __journal_clean_checkpoint_list(journal_t *journal);
846void __journal_remove_checkpoint(struct journal_head *); 852int __journal_remove_checkpoint(struct journal_head *);
847void __journal_insert_checkpoint(struct journal_head *, transaction_t *); 853void __journal_insert_checkpoint(struct journal_head *, transaction_t *);
848 854
849/* Buffer IO */ 855/* Buffer IO */
diff --git a/include/linux/jffs2_fs_i.h b/include/linux/jffs2_fs_i.h
index ef85ab56302b..ad565bf9dcc1 100644
--- a/include/linux/jffs2_fs_i.h
+++ b/include/linux/jffs2_fs_i.h
@@ -8,11 +8,11 @@
8#include <asm/semaphore.h> 8#include <asm/semaphore.h>
9 9
10struct jffs2_inode_info { 10struct jffs2_inode_info {
11 /* We need an internal semaphore similar to inode->i_sem. 11 /* We need an internal mutex similar to inode->i_mutex.
12 Unfortunately, we can't used the existing one, because 12 Unfortunately, we can't used the existing one, because
13 either the GC would deadlock, or we'd have to release it 13 either the GC would deadlock, or we'd have to release it
14 before letting GC proceed. Or we'd have to put ugliness 14 before letting GC proceed. Or we'd have to put ugliness
15 into the GC code so it didn't attempt to obtain the i_sem 15 into the GC code so it didn't attempt to obtain the i_mutex
16 for the inode(s) which are already locked */ 16 for the inode(s) which are already locked */
17 struct semaphore sem; 17 struct semaphore sem;
18 18
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 6acfdbba734b..99905e180532 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -1,21 +1,12 @@
1#ifndef _LINUX_JIFFIES_H 1#ifndef _LINUX_JIFFIES_H
2#define _LINUX_JIFFIES_H 2#define _LINUX_JIFFIES_H
3 3
4#include <linux/calc64.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/types.h> 6#include <linux/types.h>
6#include <linux/time.h> 7#include <linux/time.h>
7#include <linux/timex.h> 8#include <linux/timex.h>
8#include <asm/param.h> /* for HZ */ 9#include <asm/param.h> /* for HZ */
9#include <asm/div64.h>
10
11#ifndef div_long_long_rem
12#define div_long_long_rem(dividend,divisor,remainder) \
13({ \
14 u64 result = dividend; \
15 *remainder = do_div(result,divisor); \
16 result; \
17})
18#endif
19 10
20/* 11/*
21 * The following defines establish the engineering parameters of the PLL 12 * The following defines establish the engineering parameters of the PLL
@@ -373,8 +364,11 @@ jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
373 * one divide. 364 * one divide.
374 */ 365 */
375 u64 nsec = (u64)jiffies * TICK_NSEC; 366 u64 nsec = (u64)jiffies * TICK_NSEC;
376 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_usec); 367 long tv_usec;
377 value->tv_usec /= NSEC_PER_USEC; 368
369 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tv_usec);
370 tv_usec /= NSEC_PER_USEC;
371 value->tv_usec = tv_usec;
378} 372}
379 373
380/* 374/*
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 7428198111eb..45f625d7d0b2 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -151,7 +151,7 @@ extern unsigned int keymap_count;
151 151
152static inline void con_schedule_flip(struct tty_struct *t) 152static inline void con_schedule_flip(struct tty_struct *t)
153{ 153{
154 schedule_work(&t->flip.work); 154 schedule_work(&t->buf.work);
155} 155}
156 156
157#endif 157#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index b1e407a4fbda..e6ee2d95da7a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -47,6 +47,8 @@ extern int console_printk[];
47#define default_console_loglevel (console_printk[3]) 47#define default_console_loglevel (console_printk[3])
48 48
49struct completion; 49struct completion;
50struct pt_regs;
51struct user;
50 52
51/** 53/**
52 * might_sleep - annotation for functions that can sleep 54 * might_sleep - annotation for functions that can sleep
@@ -123,6 +125,8 @@ extern int __kernel_text_address(unsigned long addr);
123extern int kernel_text_address(unsigned long addr); 125extern int kernel_text_address(unsigned long addr);
124extern int session_of_pgrp(int pgrp); 126extern int session_of_pgrp(int pgrp);
125 127
128extern void dump_thread(struct pt_regs *regs, struct user *dump);
129
126#ifdef CONFIG_PRINTK 130#ifdef CONFIG_PRINTK
127asmlinkage int vprintk(const char *fmt, va_list args) 131asmlinkage int vprintk(const char *fmt, va_list args)
128 __attribute__ ((format (printf, 1, 0))); 132 __attribute__ ((format (printf, 1, 0)));
@@ -286,6 +290,15 @@ extern void dump_stack(void);
286 1; \ 290 1; \
287}) 291})
288 292
293/*
294 * Check at compile time that 'function' is a certain type, or is a pointer
295 * to that type (needs to use typedef for the function type.)
296 */
297#define typecheck_fn(type,function) \
298({ typeof(type) __tmp = function; \
299 (void)__tmp; \
300})
301
289#endif /* __KERNEL__ */ 302#endif /* __KERNEL__ */
290 303
291#define SI_LOAD_SHIFT 16 304#define SI_LOAD_SHIFT 16
@@ -316,8 +329,6 @@ extern int randomize_va_space;
316#endif 329#endif
317 330
318/* Trap pasters of __FUNCTION__ at compile-time */ 331/* Trap pasters of __FUNCTION__ at compile-time */
319#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
320#define __FUNCTION__ (__func__) 332#define __FUNCTION__ (__func__)
321#endif
322 333
323#endif 334#endif
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index c8468472aec0..94abc07cb164 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -41,7 +41,7 @@ typedef unsigned long kimage_entry_t;
41#define IND_DONE 0x4 41#define IND_DONE 0x4
42#define IND_SOURCE 0x8 42#define IND_SOURCE 0x8
43 43
44#define KEXEC_SEGMENT_MAX 8 44#define KEXEC_SEGMENT_MAX 16
45struct kexec_segment { 45struct kexec_segment {
46 void __user *buf; 46 void __user *buf;
47 size_t bufsz; 47 size_t bufsz;
@@ -125,6 +125,8 @@ extern struct kimage *kexec_image;
125/* Location of a reserved region to hold the crash kernel. 125/* Location of a reserved region to hold the crash kernel.
126 */ 126 */
127extern struct resource crashk_res; 127extern struct resource crashk_res;
128typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
129extern note_buf_t *crash_notes;
128 130
129#else /* !CONFIG_KEXEC */ 131#else /* !CONFIG_KEXEC */
130struct pt_regs; 132struct pt_regs;
diff --git a/include/linux/key.h b/include/linux/key.h
index 53513a3be53b..cbf464ad9589 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -177,6 +177,8 @@ struct key {
177/* 177/*
178 * kernel managed key type definition 178 * kernel managed key type definition
179 */ 179 */
180typedef int (*request_key_actor_t)(struct key *key, struct key *authkey, const char *op);
181
180struct key_type { 182struct key_type {
181 /* name of the type */ 183 /* name of the type */
182 const char *name; 184 const char *name;
@@ -193,14 +195,6 @@ struct key_type {
193 */ 195 */
194 int (*instantiate)(struct key *key, const void *data, size_t datalen); 196 int (*instantiate)(struct key *key, const void *data, size_t datalen);
195 197
196 /* duplicate a key of this type (optional)
197 * - the source key will be locked against change
198 * - the new description will be attached
199 * - the quota will have been adjusted automatically from
200 * source->quotalen
201 */
202 int (*duplicate)(struct key *key, const struct key *source);
203
204 /* update a key of this type (optional) 198 /* update a key of this type (optional)
205 * - this method should call key_payload_reserve() to recalculate the 199 * - this method should call key_payload_reserve() to recalculate the
206 * quota consumption 200 * quota consumption
@@ -226,6 +220,16 @@ struct key_type {
226 */ 220 */
227 long (*read)(const struct key *key, char __user *buffer, size_t buflen); 221 long (*read)(const struct key *key, char __user *buffer, size_t buflen);
228 222
223 /* handle request_key() for this type instead of invoking
224 * /sbin/request-key (optional)
225 * - key is the key to instantiate
226 * - authkey is the authority to assume when instantiating this key
227 * - op is the operation to be done, usually "create"
228 * - the call must not return until the instantiation process has run
229 * its course
230 */
231 request_key_actor_t request_key;
232
229 /* internal fields */ 233 /* internal fields */
230 struct list_head link; /* link in types list */ 234 struct list_head link; /* link in types list */
231}; 235};
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 8d7c59a29e09..3365945640c9 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -19,6 +19,7 @@
19#define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */ 19#define KEY_SPEC_USER_KEYRING -4 /* - key ID for UID-specific keyring */
20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ 20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */
21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ 21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */
22#define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */
22 23
23/* request-key default keyrings */ 24/* request-key default keyrings */
24#define KEY_REQKEY_DEFL_NO_CHANGE -1 25#define KEY_REQKEY_DEFL_NO_CHANGE -1
@@ -46,5 +47,7 @@
46#define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ 47#define KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */
47#define KEYCTL_NEGATE 13 /* negate a partially constructed key */ 48#define KEYCTL_NEGATE 13 /* negate a partially constructed key */
48#define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ 49#define KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */
50#define KEYCTL_SET_TIMEOUT 15 /* set key timeout */
51#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */
49 52
50#endif /* _LINUX_KEYCTL_H */ 53#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 7f7403aa4a41..2a8d8da70961 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -23,14 +23,27 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/rwsem.h> 24#include <linux/rwsem.h>
25#include <linux/kref.h> 25#include <linux/kref.h>
26#include <linux/kobject_uevent.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <asm/atomic.h> 27#include <asm/atomic.h>
29 28
30#define KOBJ_NAME_LEN 20 29#define KOBJ_NAME_LEN 20
30#define UEVENT_HELPER_PATH_LEN 256
31 31
32/* counter to tag the hotplug event, read only except for the kobject core */ 32/* path to the userspace helper executed on an event */
33extern u64 hotplug_seqnum; 33extern char uevent_helper[];
34
35/* counter to tag the uevent, read only except for the kobject core */
36extern u64 uevent_seqnum;
37
38/* the actions here must match the proper string in lib/kobject_uevent.c */
39typedef int __bitwise kobject_action_t;
40enum kobject_action {
41 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */
42 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */
43 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */
44 KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */
45 KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */
46};
34 47
35struct kobject { 48struct kobject {
36 const char * k_name; 49 const char * k_name;
@@ -87,15 +100,14 @@ struct kobj_type {
87 * of object; multiple ksets can belong to one subsystem. All 100 * of object; multiple ksets can belong to one subsystem. All
88 * ksets of a subsystem share the subsystem's lock. 101 * ksets of a subsystem share the subsystem's lock.
89 * 102 *
90 * Each kset can support hotplugging; if it does, it will be given 103 * Each kset can support specific event variables; it can
91 * the opportunity to filter out specific kobjects from being 104 * supress the event generation or add subsystem specific
92 * reported, as well as to add its own "data" elements to the 105 * variables carried with the event.
93 * environment being passed to the hotplug helper.
94 */ 106 */
95struct kset_hotplug_ops { 107struct kset_uevent_ops {
96 int (*filter)(struct kset *kset, struct kobject *kobj); 108 int (*filter)(struct kset *kset, struct kobject *kobj);
97 const char *(*name)(struct kset *kset, struct kobject *kobj); 109 const char *(*name)(struct kset *kset, struct kobject *kobj);
98 int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, 110 int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp,
99 int num_envp, char *buffer, int buffer_size); 111 int num_envp, char *buffer, int buffer_size);
100}; 112};
101 113
@@ -105,7 +117,7 @@ struct kset {
105 struct list_head list; 117 struct list_head list;
106 spinlock_t list_lock; 118 spinlock_t list_lock;
107 struct kobject kobj; 119 struct kobject kobj;
108 struct kset_hotplug_ops * hotplug_ops; 120 struct kset_uevent_ops * uevent_ops;
109}; 121};
110 122
111 123
@@ -153,20 +165,20 @@ struct subsystem {
153 struct rw_semaphore rwsem; 165 struct rw_semaphore rwsem;
154}; 166};
155 167
156#define decl_subsys(_name,_type,_hotplug_ops) \ 168#define decl_subsys(_name,_type,_uevent_ops) \
157struct subsystem _name##_subsys = { \ 169struct subsystem _name##_subsys = { \
158 .kset = { \ 170 .kset = { \
159 .kobj = { .name = __stringify(_name) }, \ 171 .kobj = { .name = __stringify(_name) }, \
160 .ktype = _type, \ 172 .ktype = _type, \
161 .hotplug_ops =_hotplug_ops, \ 173 .uevent_ops =_uevent_ops, \
162 } \ 174 } \
163} 175}
164#define decl_subsys_name(_varname,_name,_type,_hotplug_ops) \ 176#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
165struct subsystem _varname##_subsys = { \ 177struct subsystem _varname##_subsys = { \
166 .kset = { \ 178 .kset = { \
167 .kobj = { .name = __stringify(_name) }, \ 179 .kobj = { .name = __stringify(_name) }, \
168 .ktype = _type, \ 180 .ktype = _type, \
169 .hotplug_ops =_hotplug_ops, \ 181 .uevent_ops =_uevent_ops, \
170 } \ 182 } \
171} 183}
172 184
@@ -241,15 +253,17 @@ struct subsys_attribute {
241extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); 253extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
242extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); 254extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
243 255
244#ifdef CONFIG_HOTPLUG 256#if defined(CONFIG_HOTPLUG) & defined(CONFIG_NET)
245void kobject_hotplug(struct kobject *kobj, enum kobject_action action); 257void kobject_uevent(struct kobject *kobj, enum kobject_action action);
246int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 258
259int add_uevent_var(char **envp, int num_envp, int *cur_index,
247 char *buffer, int buffer_size, int *cur_len, 260 char *buffer, int buffer_size, int *cur_len,
248 const char *format, ...) 261 const char *format, ...)
249 __attribute__((format (printf, 7, 8))); 262 __attribute__((format (printf, 7, 8)));
250#else 263#else
251static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { } 264static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { }
252static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 265
266static inline int add_uevent_var(char **envp, int num_envp, int *cur_index,
253 char *buffer, int buffer_size, int *cur_len, 267 char *buffer, int buffer_size, int *cur_len,
254 const char *format, ...) 268 const char *format, ...)
255{ return 0; } 269{ return 0; }
diff --git a/include/linux/kobject_uevent.h b/include/linux/kobject_uevent.h
deleted file mode 100644
index aa664fe7e561..000000000000
--- a/include/linux/kobject_uevent.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * kobject_uevent.h - list of kobject user events that can be generated
3 *
4 * Copyright (C) 2004 IBM Corp.
5 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
6 *
7 * This file is released under the GPLv2.
8 *
9 */
10
11#ifndef _KOBJECT_EVENT_H_
12#define _KOBJECT_EVENT_H_
13
14#define HOTPLUG_PATH_LEN 256
15
16/* path to the hotplug userspace helper executed on an event */
17extern char hotplug_path[];
18
19/*
20 * If you add an action here, you must also add the proper string to the
21 * lib/kobject_uevent.c file.
22 */
23typedef int __bitwise kobject_action_t;
24enum kobject_action {
25 KOBJ_ADD = (__force kobject_action_t) 0x01, /* add event, for hotplug */
26 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* remove event, for hotplug */
27 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* a sysfs attribute file has changed */
28 KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices */
29 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices */
30 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* offline event for hotplug devices */
31 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* online event for hotplug devices */
32};
33
34
35#ifdef CONFIG_KOBJECT_UEVENT
36int kobject_uevent(struct kobject *kobj,
37 enum kobject_action action,
38 struct attribute *attr);
39int kobject_uevent_atomic(struct kobject *kobj,
40 enum kobject_action action,
41 struct attribute *attr);
42#else
43static inline int kobject_uevent(struct kobject *kobj,
44 enum kobject_action action,
45 struct attribute *attr)
46{
47 return 0;
48}
49static inline int kobject_uevent_atomic(struct kobject *kobj,
50 enum kobject_action action,
51 struct attribute *attr)
52{
53 return 0;
54}
55#endif
56
57#endif
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index c03f2dc933de..669756bc20a2 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -68,6 +68,9 @@ struct kprobe {
68 /* list of kprobes for multi-handler support */ 68 /* list of kprobes for multi-handler support */
69 struct list_head list; 69 struct list_head list;
70 70
71 /* Indicates that the corresponding module has been ref counted */
72 unsigned int mod_refcounted;
73
71 /*count the number of times this probe was temporarily disarmed */ 74 /*count the number of times this probe was temporarily disarmed */
72 unsigned long nmissed; 75 unsigned long nmissed;
73 76
@@ -149,11 +152,10 @@ struct kretprobe_instance {
149}; 152};
150 153
151extern spinlock_t kretprobe_lock; 154extern spinlock_t kretprobe_lock;
155extern struct semaphore kprobe_mutex;
152extern int arch_prepare_kprobe(struct kprobe *p); 156extern int arch_prepare_kprobe(struct kprobe *p);
153extern void arch_copy_kprobe(struct kprobe *p);
154extern void arch_arm_kprobe(struct kprobe *p); 157extern void arch_arm_kprobe(struct kprobe *p);
155extern void arch_disarm_kprobe(struct kprobe *p); 158extern void arch_disarm_kprobe(struct kprobe *p);
156extern void arch_remove_kprobe(struct kprobe *p);
157extern int arch_init_kprobes(void); 159extern int arch_init_kprobes(void);
158extern void show_registers(struct pt_regs *regs); 160extern void show_registers(struct pt_regs *regs);
159extern kprobe_opcode_t *get_insn_slot(void); 161extern kprobe_opcode_t *get_insn_slot(void);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
new file mode 100644
index 000000000000..1bd6552cc341
--- /dev/null
+++ b/include/linux/ktime.h
@@ -0,0 +1,284 @@
1/*
2 * include/linux/ktime.h
3 *
4 * ktime_t - nanosecond-resolution time format.
5 *
6 * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de>
7 * Copyright(C) 2005, Red Hat, Inc., Ingo Molnar
8 *
9 * data type definitions, declarations, prototypes and macros.
10 *
11 * Started by: Thomas Gleixner and Ingo Molnar
12 *
13 * For licencing details see kernel-base/COPYING
14 */
15#ifndef _LINUX_KTIME_H
16#define _LINUX_KTIME_H
17
18#include <linux/time.h>
19#include <linux/jiffies.h>
20
21/*
22 * ktime_t:
23 *
24 * On 64-bit CPUs a single 64-bit variable is used to store the hrtimers
25 * internal representation of time values in scalar nanoseconds. The
26 * design plays out best on 64-bit CPUs, where most conversions are
27 * NOPs and most arithmetic ktime_t operations are plain arithmetic
28 * operations.
29 *
30 * On 32-bit CPUs an optimized representation of the timespec structure
31 * is used to avoid expensive conversions from and to timespecs. The
32 * endian-aware order of the tv struct members is choosen to allow
33 * mathematical operations on the tv64 member of the union too, which
34 * for certain operations produces better code.
35 *
36 * For architectures with efficient support for 64/32-bit conversions the
37 * plain scalar nanosecond based representation can be selected by the
38 * config switch CONFIG_KTIME_SCALAR.
39 */
40typedef union {
41 s64 tv64;
42#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
43 struct {
44# ifdef __BIG_ENDIAN
45 s32 sec, nsec;
46# else
47 s32 nsec, sec;
48# endif
49 } tv;
50#endif
51} ktime_t;
52
53#define KTIME_MAX (~((u64)1 << 63))
54
55/*
56 * ktime_t definitions when using the 64-bit scalar representation:
57 */
58
59#if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)
60
61/* Define a ktime_t variable and initialize it to zero: */
62#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
63
64/**
65 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
66 *
67 * @secs: seconds to set
68 * @nsecs: nanoseconds to set
69 *
70 * Return the ktime_t representation of the value
71 */
72static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
73{
74 return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs };
75}
76
77/* Subtract two ktime_t variables. rem = lhs -rhs: */
78#define ktime_sub(lhs, rhs) \
79 ({ (ktime_t){ .tv64 = (lhs).tv64 - (rhs).tv64 }; })
80
81/* Add two ktime_t variables. res = lhs + rhs: */
82#define ktime_add(lhs, rhs) \
83 ({ (ktime_t){ .tv64 = (lhs).tv64 + (rhs).tv64 }; })
84
85/*
86 * Add a ktime_t variable and a scalar nanosecond value.
87 * res = kt + nsval:
88 */
89#define ktime_add_ns(kt, nsval) \
90 ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
91
92/* convert a timespec to ktime_t format: */
93#define timespec_to_ktime(ts) ktime_set((ts).tv_sec, (ts).tv_nsec)
94
95/* convert a timeval to ktime_t format: */
96#define timeval_to_ktime(tv) ktime_set((tv).tv_sec, (tv).tv_usec * 1000)
97
98/* Map the ktime_t to timespec conversion to ns_to_timespec function */
99#define ktime_to_timespec(kt) ns_to_timespec((kt).tv64)
100
101/* Map the ktime_t to timeval conversion to ns_to_timeval function */
102#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64)
103
104/* Map the ktime_t to clock_t conversion to the inline in jiffies.h: */
105#define ktime_to_clock_t(kt) nsec_to_clock_t((kt).tv64)
106
107/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
108#define ktime_to_ns(kt) ((kt).tv64)
109
110#else
111
112/*
113 * Helper macros/inlines to get the ktime_t math right in the timespec
114 * representation. The macros are sometimes ugly - their actual use is
115 * pretty okay-ish, given the circumstances. We do all this for
116 * performance reasons. The pure scalar nsec_t based code was nice and
117 * simple, but created too many 64-bit / 32-bit conversions and divisions.
118 *
119 * Be especially aware that negative values are represented in a way
120 * that the tv.sec field is negative and the tv.nsec field is greater
121 * or equal to zero but less than nanoseconds per second. This is the
122 * same representation which is used by timespecs.
123 *
124 * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC
125 */
126
127/* Define a ktime_t variable and initialize it to zero: */
128#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
129
130/* Set a ktime_t variable to a value in sec/nsec representation: */
131static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
132{
133 return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } };
134}
135
136/**
137 * ktime_sub - subtract two ktime_t variables
138 *
139 * @lhs: minuend
140 * @rhs: subtrahend
141 *
142 * Returns the remainder of the substraction
143 */
144static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
145{
146 ktime_t res;
147
148 res.tv64 = lhs.tv64 - rhs.tv64;
149 if (res.tv.nsec < 0)
150 res.tv.nsec += NSEC_PER_SEC;
151
152 return res;
153}
154
155/**
156 * ktime_add - add two ktime_t variables
157 *
158 * @add1: addend1
159 * @add2: addend2
160 *
161 * Returns the sum of addend1 and addend2
162 */
163static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
164{
165 ktime_t res;
166
167 res.tv64 = add1.tv64 + add2.tv64;
168 /*
169 * performance trick: the (u32) -NSEC gives 0x00000000Fxxxxxxx
170 * so we subtract NSEC_PER_SEC and add 1 to the upper 32 bit.
171 *
172 * it's equivalent to:
173 * tv.nsec -= NSEC_PER_SEC
174 * tv.sec ++;
175 */
176 if (res.tv.nsec >= NSEC_PER_SEC)
177 res.tv64 += (u32)-NSEC_PER_SEC;
178
179 return res;
180}
181
182/**
183 * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable
184 *
185 * @kt: addend
186 * @nsec: the scalar nsec value to add
187 *
188 * Returns the sum of kt and nsec in ktime_t format
189 */
190extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
191
192/**
193 * timespec_to_ktime - convert a timespec to ktime_t format
194 *
195 * @ts: the timespec variable to convert
196 *
197 * Returns a ktime_t variable with the converted timespec value
198 */
199static inline ktime_t timespec_to_ktime(const struct timespec ts)
200{
201 return (ktime_t) { .tv = { .sec = (s32)ts.tv_sec,
202 .nsec = (s32)ts.tv_nsec } };
203}
204
205/**
206 * timeval_to_ktime - convert a timeval to ktime_t format
207 *
208 * @tv: the timeval variable to convert
209 *
210 * Returns a ktime_t variable with the converted timeval value
211 */
212static inline ktime_t timeval_to_ktime(const struct timeval tv)
213{
214 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
215 .nsec = (s32)tv.tv_usec * 1000 } };
216}
217
218/**
219 * ktime_to_timespec - convert a ktime_t variable to timespec format
220 *
221 * @kt: the ktime_t variable to convert
222 *
223 * Returns the timespec representation of the ktime value
224 */
225static inline struct timespec ktime_to_timespec(const ktime_t kt)
226{
227 return (struct timespec) { .tv_sec = (time_t) kt.tv.sec,
228 .tv_nsec = (long) kt.tv.nsec };
229}
230
231/**
232 * ktime_to_timeval - convert a ktime_t variable to timeval format
233 *
234 * @kt: the ktime_t variable to convert
235 *
236 * Returns the timeval representation of the ktime value
237 */
238static inline struct timeval ktime_to_timeval(const ktime_t kt)
239{
240 return (struct timeval) {
241 .tv_sec = (time_t) kt.tv.sec,
242 .tv_usec = (suseconds_t) (kt.tv.nsec / NSEC_PER_USEC) };
243}
244
245/**
246 * ktime_to_clock_t - convert a ktime_t variable to clock_t format
247 * @kt: the ktime_t variable to convert
248 *
249 * Returns a clock_t variable with the converted value
250 */
251static inline clock_t ktime_to_clock_t(const ktime_t kt)
252{
253 return nsec_to_clock_t( (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec);
254}
255
256/**
257 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds
258 * @kt: the ktime_t variable to convert
259 *
260 * Returns the scalar nanoseconds representation of kt
261 */
262static inline u64 ktime_to_ns(const ktime_t kt)
263{
264 return (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
265}
266
267#endif
268
269/*
270 * The resolution of the clocks. The resolution value is returned in
271 * the clock_getres() system call to give application programmers an
272 * idea of the (in)accuracy of timers. Timer values are rounded up to
273 * this resolution values.
274 */
275#define KTIME_REALTIME_RES (ktime_t){ .tv64 = TICK_NSEC }
276#define KTIME_MONOTONIC_RES (ktime_t){ .tv64 = TICK_NSEC }
277
278/* Get the monotonic time in timespec format: */
279extern void ktime_get_ts(struct timespec *ts);
280
281/* Get the real (wall-) time in timespec format: */
282#define ktime_get_real_ts(ts) getnstimeofday(ts)
283
284#endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 41ea7dbc1755..a43c95f8f968 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -124,6 +124,8 @@ enum {
124 ATA_FLAG_DEBUGMSG = (1 << 10), 124 ATA_FLAG_DEBUGMSG = (1 << 10),
125 ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */ 125 ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */
126 126
127 ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */
128
127 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 129 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
128 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 130 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
129 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ 131 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */
@@ -136,6 +138,8 @@ enum {
136 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* hueristic */ 138 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* hueristic */
137 ATA_TMOUT_CDB = 30 * HZ, 139 ATA_TMOUT_CDB = 30 * HZ,
138 ATA_TMOUT_CDB_QUICK = 5 * HZ, 140 ATA_TMOUT_CDB_QUICK = 5 * HZ,
141 ATA_TMOUT_INTERNAL = 30 * HZ,
142 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
139 143
140 /* ATA bus states */ 144 /* ATA bus states */
141 BUS_UNKNOWN = 0, 145 BUS_UNKNOWN = 0,
@@ -195,7 +199,7 @@ struct ata_port;
195struct ata_queued_cmd; 199struct ata_queued_cmd;
196 200
197/* typedefs */ 201/* typedefs */
198typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, unsigned int err_mask); 202typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
199 203
200struct ata_ioports { 204struct ata_ioports {
201 unsigned long cmd_addr; 205 unsigned long cmd_addr;
@@ -280,9 +284,9 @@ struct ata_queued_cmd {
280 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */ 284 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */
281 struct scatterlist *__sg; 285 struct scatterlist *__sg;
282 286
283 ata_qc_cb_t complete_fn; 287 unsigned int err_mask;
284 288
285 struct completion *waiting; 289 ata_qc_cb_t complete_fn;
286 290
287 void *private_data; 291 void *private_data;
288}; 292};
@@ -331,8 +335,6 @@ struct ata_port {
331 335
332 u8 ctl; /* cache of ATA control register */ 336 u8 ctl; /* cache of ATA control register */
333 u8 last_ctl; /* Cache last written value */ 337 u8 last_ctl; /* Cache last written value */
334 unsigned int bus_state;
335 unsigned int port_state;
336 unsigned int pio_mask; 338 unsigned int pio_mask;
337 unsigned int mwdma_mask; 339 unsigned int mwdma_mask;
338 unsigned int udma_mask; 340 unsigned int udma_mask;
@@ -436,6 +438,8 @@ extern void ata_std_ports(struct ata_ioports *ioaddr);
436extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, 438extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
437 unsigned int n_ports); 439 unsigned int n_ports);
438extern void ata_pci_remove_one (struct pci_dev *pdev); 440extern void ata_pci_remove_one (struct pci_dev *pdev);
441extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
442extern int ata_pci_device_resume(struct pci_dev *pdev);
439#endif /* CONFIG_PCI */ 443#endif /* CONFIG_PCI */
440extern int ata_device_add(const struct ata_probe_ent *ent); 444extern int ata_device_add(const struct ata_probe_ent *ent);
441extern void ata_host_set_remove(struct ata_host_set *host_set); 445extern void ata_host_set_remove(struct ata_host_set *host_set);
@@ -445,6 +449,10 @@ extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmn
445extern int ata_scsi_error(struct Scsi_Host *host); 449extern int ata_scsi_error(struct Scsi_Host *host);
446extern int ata_scsi_release(struct Scsi_Host *host); 450extern int ata_scsi_release(struct Scsi_Host *host);
447extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 451extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
452extern int ata_scsi_device_resume(struct scsi_device *);
453extern int ata_scsi_device_suspend(struct scsi_device *);
454extern int ata_device_resume(struct ata_port *, struct ata_device *);
455extern int ata_device_suspend(struct ata_port *, struct ata_device *);
448extern int ata_ratelimit(void); 456extern int ata_ratelimit(void);
449 457
450/* 458/*
@@ -478,9 +486,10 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc);
478extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 486extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
479extern u8 ata_bmdma_status(struct ata_port *ap); 487extern u8 ata_bmdma_status(struct ata_port *ap);
480extern void ata_bmdma_irq_clear(struct ata_port *ap); 488extern void ata_bmdma_irq_clear(struct ata_port *ap);
481extern void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask); 489extern void ata_qc_complete(struct ata_queued_cmd *qc);
482extern void ata_eng_timeout(struct ata_port *ap); 490extern void ata_eng_timeout(struct ata_port *ap);
483extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, 491extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev,
492 struct scsi_cmnd *cmd,
484 void (*done)(struct scsi_cmnd *)); 493 void (*done)(struct scsi_cmnd *));
485extern int ata_std_bios_param(struct scsi_device *sdev, 494extern int ata_std_bios_param(struct scsi_device *sdev,
486 struct block_device *bdev, 495 struct block_device *bdev,
@@ -670,6 +679,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
670 qc->cursect = qc->cursg = qc->cursg_ofs = 0; 679 qc->cursect = qc->cursg = qc->cursg_ofs = 0;
671 qc->nsect = 0; 680 qc->nsect = 0;
672 qc->nbytes = qc->curbytes = 0; 681 qc->nbytes = qc->curbytes = 0;
682 qc->err_mask = 0;
673 683
674 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); 684 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno);
675} 685}
diff --git a/include/linux/list.h b/include/linux/list.h
index 8e3388284530..945daa1f13dd 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -436,6 +436,20 @@ static inline void list_splice_init(struct list_head *list,
436 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 436 pos = n, n = list_entry(n->member.next, typeof(*n), member))
437 437
438/** 438/**
439 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against
440 * removal of list entry
441 * @pos: the type * to use as a loop counter.
442 * @n: another type * to use as temporary storage
443 * @head: the head for your list.
444 * @member: the name of the list_struct within the struct.
445 */
446#define list_for_each_entry_safe_reverse(pos, n, head, member) \
447 for (pos = list_entry((head)->prev, typeof(*pos), member), \
448 n = list_entry(pos->member.prev, typeof(*pos), member); \
449 &pos->member != (head); \
450 pos = n, n = list_entry(n->member.prev, typeof(*n), member))
451
452/**
439 * list_for_each_rcu - iterate over an rcu-protected list 453 * list_for_each_rcu - iterate over an rcu-protected list
440 * @pos: the &struct list_head to use as a loop counter. 454 * @pos: the &struct list_head to use as a loop counter.
441 * @head: the head for your list. 455 * @head: the head for your list.
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 16d4e5a08e1d..95c8fea293ba 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -172,7 +172,7 @@ extern struct nlm_host *nlm_find_client(void);
172/* 172/*
173 * Server-side lock handling 173 * Server-side lock handling
174 */ 174 */
175int nlmsvc_async_call(struct nlm_rqst *, u32, rpc_action); 175int nlmsvc_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
177 struct nlm_lock *, int, struct nlm_cookie *); 177 struct nlm_lock *, int, struct nlm_cookie *);
178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 40f63c9879d2..f96506782ebe 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -58,9 +58,9 @@ struct loop_device {
58 struct bio *lo_bio; 58 struct bio *lo_bio;
59 struct bio *lo_biotail; 59 struct bio *lo_biotail;
60 int lo_state; 60 int lo_state;
61 struct semaphore lo_sem; 61 struct completion lo_done;
62 struct completion lo_bh_done;
62 struct semaphore lo_ctl_mutex; 63 struct semaphore lo_ctl_mutex;
63 struct semaphore lo_bh_mutex;
64 int lo_pending; 64 int lo_pending;
65 65
66 request_queue_t *lo_queue; 66 request_queue_t *lo_queue;
diff --git a/include/linux/memory.h b/include/linux/memory.h
index dc4081b6f161..e251dc43d0f5 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -70,21 +70,15 @@ static inline void unregister_memory_notifier(struct notifier_block *nb)
70{ 70{
71} 71}
72#else 72#else
73extern int register_memory(struct memory_block *, struct mem_section *section, struct node *);
74extern int register_new_memory(struct mem_section *); 73extern int register_new_memory(struct mem_section *);
75extern int unregister_memory_section(struct mem_section *); 74extern int unregister_memory_section(struct mem_section *);
76extern int memory_dev_init(void); 75extern int memory_dev_init(void);
77extern int register_memory_notifier(struct notifier_block *nb); 76extern int remove_memory_block(unsigned long, struct mem_section *, int);
78extern void unregister_memory_notifier(struct notifier_block *nb);
79 77
80#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 78#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
81 79
82extern int invalidate_phys_mapping(unsigned long, unsigned long);
83struct notifier_block; 80struct notifier_block;
84 81
85extern int register_memory_notifier(struct notifier_block *nb);
86extern void unregister_memory_notifier(struct notifier_block *nb);
87
88#endif /* CONFIG_MEMORY_HOTPLUG */ 82#endif /* CONFIG_MEMORY_HOTPLUG */
89 83
90#define hotplug_memory_notifier(fn, pri) { \ 84#define hotplug_memory_notifier(fn, pri) { \
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 8b67cf837ca9..c7ac77e873b3 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -22,6 +22,9 @@
22 22
23/* Flags for mbind */ 23/* Flags for mbind */
24#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */ 24#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */
25#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */
26#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */
27#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */
25 28
26#ifdef __KERNEL__ 29#ifdef __KERNEL__
27 30
@@ -65,6 +68,7 @@ struct mempolicy {
65 nodemask_t nodes; /* interleave */ 68 nodemask_t nodes; /* interleave */
66 /* undefined for default */ 69 /* undefined for default */
67 } v; 70 } v;
71 nodemask_t cpuset_mems_allowed; /* mempolicy relative to these nodes */
68}; 72};
69 73
70/* 74/*
@@ -110,14 +114,6 @@ static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
110#define mpol_set_vma_default(vma) ((vma)->vm_policy = NULL) 114#define mpol_set_vma_default(vma) ((vma)->vm_policy = NULL)
111 115
112/* 116/*
113 * Hugetlb policy. i386 hugetlb so far works with node numbers
114 * instead of zone lists, so give it special interfaces for now.
115 */
116extern int mpol_first_node(struct vm_area_struct *vma, unsigned long addr);
117extern int mpol_node_valid(int nid, struct vm_area_struct *vma,
118 unsigned long addr);
119
120/*
121 * Tree of shared policies for a shared memory region. 117 * Tree of shared policies for a shared memory region.
122 * Maintain the policies in a pseudo mm that contains vmas. The vmas 118 * Maintain the policies in a pseudo mm that contains vmas. The vmas
123 * carry the policy. As a special twist the pseudo mm is indexed in pages, not 119 * carry the policy. As a special twist the pseudo mm is indexed in pages, not
@@ -149,13 +145,37 @@ void mpol_free_shared_policy(struct shared_policy *p);
149struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, 145struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
150 unsigned long idx); 146 unsigned long idx);
151 147
152struct mempolicy *get_vma_policy(struct task_struct *task,
153 struct vm_area_struct *vma, unsigned long addr);
154
155extern void numa_default_policy(void); 148extern void numa_default_policy(void);
156extern void numa_policy_init(void); 149extern void numa_policy_init(void);
157extern void numa_policy_rebind(const nodemask_t *old, const nodemask_t *new); 150extern void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *new);
151extern void mpol_rebind_task(struct task_struct *tsk,
152 const nodemask_t *new);
153extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
154#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x))
155
156#ifdef CONFIG_CPUSET
157#define current_cpuset_is_being_rebound() \
158 (cpuset_being_rebound == current->cpuset)
159#else
160#define current_cpuset_is_being_rebound() 0
161#endif
162
158extern struct mempolicy default_policy; 163extern struct mempolicy default_policy;
164extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
165 unsigned long addr);
166
167extern int policy_zone;
168
169static inline void check_highest_zone(int k)
170{
171 if (k > policy_zone)
172 policy_zone = k;
173}
174
175int do_migrate_pages(struct mm_struct *mm,
176 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags);
177
178extern void *cpuset_being_rebound; /* Trigger mpol_copy vma rebind */
159 179
160#else 180#else
161 181
@@ -182,17 +202,6 @@ static inline struct mempolicy *mpol_copy(struct mempolicy *old)
182 return NULL; 202 return NULL;
183} 203}
184 204
185static inline int mpol_first_node(struct vm_area_struct *vma, unsigned long a)
186{
187 return numa_node_id();
188}
189
190static inline int
191mpol_node_valid(int nid, struct vm_area_struct *vma, unsigned long a)
192{
193 return 1;
194}
195
196struct shared_policy {}; 205struct shared_policy {};
197 206
198static inline int mpol_set_shared_policy(struct shared_policy *info, 207static inline int mpol_set_shared_policy(struct shared_policy *info,
@@ -227,11 +236,38 @@ static inline void numa_default_policy(void)
227{ 236{
228} 237}
229 238
230static inline void numa_policy_rebind(const nodemask_t *old, 239static inline void mpol_rebind_policy(struct mempolicy *pol,
231 const nodemask_t *new) 240 const nodemask_t *new)
232{ 241{
233} 242}
234 243
244static inline void mpol_rebind_task(struct task_struct *tsk,
245 const nodemask_t *new)
246{
247}
248
249static inline void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new)
250{
251}
252
253#define set_cpuset_being_rebound(x) do {} while (0)
254
255static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
256 unsigned long addr)
257{
258 return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER);
259}
260
261static inline int do_migrate_pages(struct mm_struct *mm,
262 const nodemask_t *from_nodes,
263 const nodemask_t *to_nodes, int flags)
264{
265 return 0;
266}
267
268static inline void check_highest_zone(int k)
269{
270}
235#endif /* CONFIG_NUMA */ 271#endif /* CONFIG_NUMA */
236#endif /* __KERNEL__ */ 272#endif /* __KERNEL__ */
237 273
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a06a84d347fb..c643016499a1 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/errno.h> 5#include <linux/errno.h>
6#include <linux/capability.h>
6 7
7#ifdef __KERNEL__ 8#ifdef __KERNEL__
8 9
@@ -13,6 +14,7 @@
13#include <linux/rbtree.h> 14#include <linux/rbtree.h>
14#include <linux/prio_tree.h> 15#include <linux/prio_tree.h>
15#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/mutex.h>
16 18
17struct mempolicy; 19struct mempolicy;
18struct anon_vma; 20struct anon_vma;
@@ -223,24 +225,27 @@ struct page {
223 * & limit reverse map searches. 225 * & limit reverse map searches.
224 */ 226 */
225 union { 227 union {
226 unsigned long private; /* Mapping-private opaque data: 228 struct {
227 * usually used for buffer_heads 229 unsigned long private; /* Mapping-private opaque data:
228 * if PagePrivate set; used for 230 * usually used for buffer_heads
229 * swp_entry_t if PageSwapCache 231 * if PagePrivate set; used for
230 * When page is free, this indicates 232 * swp_entry_t if PageSwapCache.
231 * order in the buddy system. 233 * When page is free, this
232 */ 234 * indicates order in the buddy
235 * system.
236 */
237 struct address_space *mapping; /* If low bit clear, points to
238 * inode address_space, or NULL.
239 * If page mapped as anonymous
240 * memory, low bit is set, and
241 * it points to anon_vma object:
242 * see PAGE_MAPPING_ANON below.
243 */
244 };
233#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 245#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
234 spinlock_t ptl; 246 spinlock_t ptl;
235#endif 247#endif
236 } u; 248 };
237 struct address_space *mapping; /* If low bit clear, points to
238 * inode address_space, or NULL.
239 * If page mapped as anonymous
240 * memory, low bit is set, and
241 * it points to anon_vma object:
242 * see PAGE_MAPPING_ANON below.
243 */
244 pgoff_t index; /* Our offset within mapping. */ 249 pgoff_t index; /* Our offset within mapping. */
245 struct list_head lru; /* Pageout list, eg. active_list 250 struct list_head lru; /* Pageout list, eg. active_list
246 * protected by zone->lru_lock ! 251 * protected by zone->lru_lock !
@@ -261,8 +266,8 @@ struct page {
261#endif /* WANT_PAGE_VIRTUAL */ 266#endif /* WANT_PAGE_VIRTUAL */
262}; 267};
263 268
264#define page_private(page) ((page)->u.private) 269#define page_private(page) ((page)->private)
265#define set_page_private(page, v) ((page)->u.private = (v)) 270#define set_page_private(page, v) ((page)->private = (v))
266 271
267/* 272/*
268 * FIXME: take this include out, include page-flags.h in 273 * FIXME: take this include out, include page-flags.h in
@@ -308,7 +313,7 @@ struct page {
308 */ 313 */
309#define get_page_testone(p) atomic_inc_and_test(&(p)->_count) 314#define get_page_testone(p) atomic_inc_and_test(&(p)->_count)
310 315
311#define set_page_count(p,v) atomic_set(&(p)->_count, v - 1) 316#define set_page_count(p,v) atomic_set(&(p)->_count, (v) - 1)
312#define __put_page(p) atomic_dec(&(p)->_count) 317#define __put_page(p) atomic_dec(&(p)->_count)
313 318
314extern void FASTCALL(__page_cache_release(struct page *)); 319extern void FASTCALL(__page_cache_release(struct page *));
@@ -634,14 +639,38 @@ struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
634int shmem_lock(struct file *file, int lock, struct user_struct *user); 639int shmem_lock(struct file *file, int lock, struct user_struct *user);
635#else 640#else
636#define shmem_nopage filemap_nopage 641#define shmem_nopage filemap_nopage
637#define shmem_lock(a, b, c) ({0;}) /* always in memory, no need to lock */ 642
638#define shmem_set_policy(a, b) (0) 643static inline int shmem_lock(struct file *file, int lock,
639#define shmem_get_policy(a, b) (NULL) 644 struct user_struct *user)
645{
646 return 0;
647}
648
649static inline int shmem_set_policy(struct vm_area_struct *vma,
650 struct mempolicy *new)
651{
652 return 0;
653}
654
655static inline struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
656 unsigned long addr)
657{
658 return NULL;
659}
640#endif 660#endif
641struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); 661struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags);
662extern int shmem_mmap(struct file *file, struct vm_area_struct *vma);
642 663
643int shmem_zero_setup(struct vm_area_struct *); 664int shmem_zero_setup(struct vm_area_struct *);
644 665
666#ifndef CONFIG_MMU
667extern unsigned long shmem_get_unmapped_area(struct file *file,
668 unsigned long addr,
669 unsigned long len,
670 unsigned long pgoff,
671 unsigned long flags);
672#endif
673
645static inline int can_do_mlock(void) 674static inline int can_do_mlock(void)
646{ 675{
647 if (capable(CAP_IPC_LOCK)) 676 if (capable(CAP_IPC_LOCK))
@@ -690,14 +719,31 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
690} 719}
691 720
692extern int vmtruncate(struct inode * inode, loff_t offset); 721extern int vmtruncate(struct inode * inode, loff_t offset);
722extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
693extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); 723extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
694extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); 724extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
695extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
696 725
697static inline int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access) 726#ifdef CONFIG_MMU
727extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma,
728 unsigned long address, int write_access);
729
730static inline int handle_mm_fault(struct mm_struct *mm,
731 struct vm_area_struct *vma, unsigned long address,
732 int write_access)
698{ 733{
699 return __handle_mm_fault(mm, vma, address, write_access) & (~VM_FAULT_WRITE); 734 return __handle_mm_fault(mm, vma, address, write_access) &
735 (~VM_FAULT_WRITE);
700} 736}
737#else
738static inline int handle_mm_fault(struct mm_struct *mm,
739 struct vm_area_struct *vma, unsigned long address,
740 int write_access)
741{
742 /* should never happen if there's no MMU */
743 BUG();
744 return VM_FAULT_SIGBUS;
745}
746#endif
701 747
702extern int make_pages_present(unsigned long addr, unsigned long end); 748extern int make_pages_present(unsigned long addr, unsigned long end);
703extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 749extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
@@ -774,7 +820,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
774 * overflow into the next struct page (as it might with DEBUG_SPINLOCK). 820 * overflow into the next struct page (as it might with DEBUG_SPINLOCK).
775 * When freeing, reset page->mapping so free_pages_check won't complain. 821 * When freeing, reset page->mapping so free_pages_check won't complain.
776 */ 822 */
777#define __pte_lockptr(page) &((page)->u.ptl) 823#define __pte_lockptr(page) &((page)->ptl)
778#define pte_lock_init(_page) do { \ 824#define pte_lock_init(_page) do { \
779 spin_lock_init(__pte_lockptr(_page)); \ 825 spin_lock_init(__pte_lockptr(_page)); \
780} while (0) 826} while (0)
@@ -896,6 +942,8 @@ extern unsigned long do_brk(unsigned long, unsigned long);
896/* filemap.c */ 942/* filemap.c */
897extern unsigned long page_unuse(struct page *); 943extern unsigned long page_unuse(struct page *);
898extern void truncate_inode_pages(struct address_space *, loff_t); 944extern void truncate_inode_pages(struct address_space *, loff_t);
945extern void truncate_inode_pages_range(struct address_space *,
946 loff_t lstart, loff_t lend);
899 947
900/* generic vm_area_ops exported for stackable file systems */ 948/* generic vm_area_ops exported for stackable file systems */
901extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int *); 949extern struct page *filemap_nopage(struct vm_area_struct *, unsigned long, int *);
@@ -978,6 +1026,9 @@ static inline void vm_stat_account(struct mm_struct *mm,
978static inline void 1026static inline void
979kernel_map_pages(struct page *page, int numpages, int enable) 1027kernel_map_pages(struct page *page, int numpages, int enable)
980{ 1028{
1029 if (!PageHighMem(page) && !enable)
1030 mutex_debug_check_no_locks_freed(page_address(page),
1031 numpages * PAGE_SIZE);
981} 1032}
982#endif 1033#endif
983 1034
@@ -993,5 +1044,12 @@ int in_gate_area_no_task(unsigned long addr);
993/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */ 1044/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
994#define OOM_DISABLE -17 1045#define OOM_DISABLE -17
995 1046
1047int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
1048 void __user *, size_t *, loff_t *);
1049int shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1050 unsigned long lru_pages);
1051void drop_pagecache(void);
1052void drop_slab(void);
1053
996#endif /* __KERNEL__ */ 1054#endif /* __KERNEL__ */
997#endif /* _LINUX_MM_H */ 1055#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 47762ca695a5..49cc68af01f8 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -38,3 +38,25 @@ del_page_from_lru(struct zone *zone, struct page *page)
38 zone->nr_inactive--; 38 zone->nr_inactive--;
39 } 39 }
40} 40}
41
42/*
43 * Isolate one page from the LRU lists.
44 *
45 * - zone->lru_lock must be held
46 */
47static inline int __isolate_lru_page(struct page *page)
48{
49 if (unlikely(!TestClearPageLRU(page)))
50 return 0;
51
52 if (get_page_testone(page)) {
53 /*
54 * It is being freed elsewhere
55 */
56 __put_page(page);
57 SetPageLRU(page);
58 return -ENOENT;
59 }
60
61 return 1;
62}
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 18fc77f682de..30dd978c1ec8 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -30,7 +30,12 @@ struct mmc_csd {
30 unsigned int tacc_ns; 30 unsigned int tacc_ns;
31 unsigned int max_dtr; 31 unsigned int max_dtr;
32 unsigned int read_blkbits; 32 unsigned int read_blkbits;
33 unsigned int write_blkbits;
33 unsigned int capacity; 34 unsigned int capacity;
35 unsigned int read_partial:1,
36 read_misalign:1,
37 write_partial:1,
38 write_misalign:1;
34}; 39};
35 40
36struct sd_scr { 41struct sd_scr {
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index aef6042f8f0b..ccd3e13de1e8 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -27,14 +27,15 @@ struct mmc_command {
27#define MMC_RSP_MASK (3 << 0) 27#define MMC_RSP_MASK (3 << 0)
28#define MMC_RSP_CRC (1 << 3) /* expect valid crc */ 28#define MMC_RSP_CRC (1 << 3) /* expect valid crc */
29#define MMC_RSP_BUSY (1 << 4) /* card may send busy */ 29#define MMC_RSP_BUSY (1 << 4) /* card may send busy */
30#define MMC_RSP_OPCODE (1 << 5) /* response contains opcode */
30 31
31/* 32/*
32 * These are the response types, and correspond to valid bit 33 * These are the response types, and correspond to valid bit
33 * patterns of the above flags. One additional valid pattern 34 * patterns of the above flags. One additional valid pattern
34 * is all zeros, which means we don't expect a response. 35 * is all zeros, which means we don't expect a response.
35 */ 36 */
36#define MMC_RSP_R1 (MMC_RSP_SHORT|MMC_RSP_CRC) 37#define MMC_RSP_R1 (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_OPCODE)
37#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_BUSY) 38#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
38#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC) 39#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC)
39#define MMC_RSP_R3 (MMC_RSP_SHORT) 40#define MMC_RSP_R3 (MMC_RSP_SHORT)
40#define MMC_RSP_R6 (MMC_RSP_SHORT|MMC_RSP_CRC) 41#define MMC_RSP_R6 (MMC_RSP_SHORT|MMC_RSP_CRC)
@@ -64,6 +65,7 @@ struct mmc_data {
64#define MMC_DATA_WRITE (1 << 8) 65#define MMC_DATA_WRITE (1 << 8)
65#define MMC_DATA_READ (1 << 9) 66#define MMC_DATA_READ (1 << 9)
66#define MMC_DATA_STREAM (1 << 10) 67#define MMC_DATA_STREAM (1 << 10)
68#define MMC_DATA_MULTI (1 << 11)
67 69
68 unsigned int bytes_xfered; 70 unsigned int bytes_xfered;
69 71
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9f22090df7dd..34cbefd2ebde 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -38,7 +38,7 @@ struct pglist_data;
38#if defined(CONFIG_SMP) 38#if defined(CONFIG_SMP)
39struct zone_padding { 39struct zone_padding {
40 char x[0]; 40 char x[0];
41} ____cacheline_maxaligned_in_smp; 41} ____cacheline_internodealigned_in_smp;
42#define ZONE_PADDING(name) struct zone_padding name; 42#define ZONE_PADDING(name) struct zone_padding name;
43#else 43#else
44#define ZONE_PADDING(name) 44#define ZONE_PADDING(name)
@@ -46,7 +46,6 @@ struct zone_padding {
46 46
47struct per_cpu_pages { 47struct per_cpu_pages {
48 int count; /* number of pages in the list */ 48 int count; /* number of pages in the list */
49 int low; /* low watermark, refill needed */
50 int high; /* high watermark, emptying needed */ 49 int high; /* high watermark, emptying needed */
51 int batch; /* chunk size for buddy add/remove */ 50 int batch; /* chunk size for buddy add/remove */
52 struct list_head list; /* the list of pages */ 51 struct list_head list; /* the list of pages */
@@ -99,7 +98,7 @@ struct per_cpu_pageset {
99 98
100/* 99/*
101 * On machines where it is needed (eg PCs) we divide physical memory 100 * On machines where it is needed (eg PCs) we divide physical memory
102 * into multiple physical zones. On a PC we have 4 zones: 101 * into multiple physical zones. On a 32bit PC we have 4 zones:
103 * 102 *
104 * ZONE_DMA < 16 MB ISA DMA capable memory 103 * ZONE_DMA < 16 MB ISA DMA capable memory
105 * ZONE_DMA32 0 MB Empty 104 * ZONE_DMA32 0 MB Empty
@@ -234,7 +233,7 @@ struct zone {
234 * rarely used fields: 233 * rarely used fields:
235 */ 234 */
236 char *name; 235 char *name;
237} ____cacheline_maxaligned_in_smp; 236} ____cacheline_internodealigned_in_smp;
238 237
239 238
240/* 239/*
@@ -389,6 +388,11 @@ static inline struct zone *next_zone(struct zone *zone)
389#define for_each_zone(zone) \ 388#define for_each_zone(zone) \
390 for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone)) 389 for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone))
391 390
391static inline int populated_zone(struct zone *zone)
392{
393 return (!!zone->present_pages);
394}
395
392static inline int is_highmem_idx(int idx) 396static inline int is_highmem_idx(int idx)
393{ 397{
394 return (idx == ZONE_HIGHMEM); 398 return (idx == ZONE_HIGHMEM);
@@ -398,6 +402,7 @@ static inline int is_normal_idx(int idx)
398{ 402{
399 return (idx == ZONE_NORMAL); 403 return (idx == ZONE_NORMAL);
400} 404}
405
401/** 406/**
402 * is_highmem - helper function to quickly check if a struct zone is a 407 * is_highmem - helper function to quickly check if a struct zone is a
403 * highmem zone or not. This is an attempt to keep references 408 * highmem zone or not. This is an attempt to keep references
@@ -414,6 +419,16 @@ static inline int is_normal(struct zone *zone)
414 return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL; 419 return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL;
415} 420}
416 421
422static inline int is_dma32(struct zone *zone)
423{
424 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
425}
426
427static inline int is_dma(struct zone *zone)
428{
429 return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
430}
431
417/* These two functions are used to setup the per zone pages min values */ 432/* These two functions are used to setup the per zone pages min values */
418struct ctl_table; 433struct ctl_table;
419struct file; 434struct file;
@@ -422,6 +437,8 @@ int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *,
422extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1]; 437extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
423int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *, 438int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
424 void __user *, size_t *, loff_t *); 439 void __user *, size_t *, loff_t *);
440int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *,
441 void __user *, size_t *, loff_t *);
425 442
426#include <linux/topology.h> 443#include <linux/topology.h>
427/* Returns the number of the current Node. */ 444/* Returns the number of the current Node. */
@@ -435,7 +452,6 @@ extern struct pglist_data contig_page_data;
435#define NODE_DATA(nid) (&contig_page_data) 452#define NODE_DATA(nid) (&contig_page_data)
436#define NODE_MEM_MAP(nid) mem_map 453#define NODE_MEM_MAP(nid) mem_map
437#define MAX_NODES_SHIFT 1 454#define MAX_NODES_SHIFT 1
438#define pfn_to_nid(pfn) (0)
439 455
440#else /* CONFIG_NEED_MULTIPLE_NODES */ 456#else /* CONFIG_NEED_MULTIPLE_NODES */
441 457
@@ -470,6 +486,10 @@ extern struct pglist_data contig_page_data;
470#define early_pfn_to_nid(nid) (0UL) 486#define early_pfn_to_nid(nid) (0UL)
471#endif 487#endif
472 488
489#ifdef CONFIG_FLATMEM
490#define pfn_to_nid(pfn) (0)
491#endif
492
473#define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT) 493#define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT)
474#define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT) 494#define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT)
475 495
@@ -564,11 +584,6 @@ static inline int valid_section_nr(unsigned long nr)
564 return valid_section(__nr_to_section(nr)); 584 return valid_section(__nr_to_section(nr));
565} 585}
566 586
567/*
568 * Given a kernel address, find the home node of the underlying memory.
569 */
570#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
571
572static inline struct mem_section *__pfn_to_section(unsigned long pfn) 587static inline struct mem_section *__pfn_to_section(unsigned long pfn)
573{ 588{
574 return __nr_to_section(pfn_to_section_nr(pfn)); 589 return __nr_to_section(pfn_to_section_nr(pfn));
@@ -598,13 +613,14 @@ static inline int pfn_valid(unsigned long pfn)
598 * this restriction. 613 * this restriction.
599 */ 614 */
600#ifdef CONFIG_NUMA 615#ifdef CONFIG_NUMA
601#define pfn_to_nid early_pfn_to_nid 616#define pfn_to_nid(pfn) \
602#endif
603
604#define pfn_to_pgdat(pfn) \
605({ \ 617({ \
606 NODE_DATA(pfn_to_nid(pfn)); \ 618 unsigned long __pfn_to_nid_pfn = (pfn); \
619 page_to_nid(pfn_to_page(__pfn_to_nid_pfn)); \
607}) 620})
621#else
622#define pfn_to_nid(pfn) (0)
623#endif
608 624
609#define early_pfn_valid(pfn) pfn_valid(pfn) 625#define early_pfn_valid(pfn) pfn_valid(pfn)
610void sparse_init(void); 626void sparse_init(void);
@@ -613,12 +629,6 @@ void sparse_init(void);
613#define sparse_index_init(_sec, _nid) do {} while (0) 629#define sparse_index_init(_sec, _nid) do {} while (0)
614#endif /* CONFIG_SPARSEMEM */ 630#endif /* CONFIG_SPARSEMEM */
615 631
616#ifdef CONFIG_NODES_SPAN_OTHER_NODES
617#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid))
618#else
619#define early_pfn_in_nid(pfn, nid) (1)
620#endif
621
622#ifndef early_pfn_valid 632#ifndef early_pfn_valid
623#define early_pfn_valid(pfn) (1) 633#define early_pfn_valid(pfn) (1)
624#endif 634#endif
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 368ec8e45bd0..b5c98c43779e 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -10,7 +10,7 @@
10#ifdef MODULE 10#ifdef MODULE
11#define MODULE_PARAM_PREFIX /* empty */ 11#define MODULE_PARAM_PREFIX /* empty */
12#else 12#else
13#define MODULE_PARAM_PREFIX __stringify(KBUILD_MODNAME) "." 13#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
14#endif 14#endif
15 15
16#ifdef MODULE 16#ifdef MODULE
diff --git a/include/linux/mount.h b/include/linux/mount.h
index dd4e83eba933..b7472ae91fa4 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -20,9 +20,12 @@
20#define MNT_NOSUID 0x01 20#define MNT_NOSUID 0x01
21#define MNT_NODEV 0x02 21#define MNT_NODEV 0x02
22#define MNT_NOEXEC 0x04 22#define MNT_NOEXEC 0x04
23#define MNT_SHARED 0x10 /* if the vfsmount is a shared mount */ 23#define MNT_NOATIME 0x08
24#define MNT_UNBINDABLE 0x20 /* if the vfsmount is a unbindable mount */ 24#define MNT_NODIRATIME 0x10
25#define MNT_PNODE_MASK 0x30 /* propogation flag mask */ 25
26#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
27#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
28#define MNT_PNODE_MASK 0x3000 /* propogation flag mask */
26 29
27struct vfsmount { 30struct vfsmount {
28 struct list_head mnt_hash; 31 struct list_head mnt_hash;
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 941da5c016a0..e933e2a355ad 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -329,7 +329,8 @@ static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len)
329extern void fat_cache_inval_inode(struct inode *inode); 329extern void fat_cache_inval_inode(struct inode *inode);
330extern int fat_get_cluster(struct inode *inode, int cluster, 330extern int fat_get_cluster(struct inode *inode, int cluster,
331 int *fclus, int *dclus); 331 int *fclus, int *dclus);
332extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys); 332extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
333 unsigned long *mapped_blocks);
333 334
334/* fat/dir.c */ 335/* fat/dir.c */
335extern struct file_operations fat_dir_operations; 336extern struct file_operations fat_dir_operations;
diff --git a/include/linux/mutex-debug.h b/include/linux/mutex-debug.h
new file mode 100644
index 000000000000..8b5769f00467
--- /dev/null
+++ b/include/linux/mutex-debug.h
@@ -0,0 +1,23 @@
1#ifndef __LINUX_MUTEX_DEBUG_H
2#define __LINUX_MUTEX_DEBUG_H
3
4#include <linux/linkage.h>
5
6/*
7 * Mutexes - debugging helpers:
8 */
9
10#define __DEBUG_MUTEX_INITIALIZER(lockname) \
11 , .held_list = LIST_HEAD_INIT(lockname.held_list), \
12 .name = #lockname , .magic = &lockname
13
14#define mutex_init(sem) __mutex_init(sem, __FUNCTION__)
15
16extern void FASTCALL(mutex_destroy(struct mutex *lock));
17
18extern void mutex_debug_show_all_locks(void);
19extern void mutex_debug_show_held_locks(struct task_struct *filter);
20extern void mutex_debug_check_no_locks_held(struct task_struct *task);
21extern void mutex_debug_check_no_locks_freed(const void *from, unsigned long len);
22
23#endif
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
new file mode 100644
index 000000000000..f1ac507fa20d
--- /dev/null
+++ b/include/linux/mutex.h
@@ -0,0 +1,120 @@
1/*
2 * Mutexes: blocking mutual exclusion locks
3 *
4 * started by Ingo Molnar:
5 *
6 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
7 *
8 * This file contains the main data structure and API definitions.
9 */
10#ifndef __LINUX_MUTEX_H
11#define __LINUX_MUTEX_H
12
13#include <linux/list.h>
14#include <linux/spinlock_types.h>
15#include <linux/linkage.h>
16
17#include <asm/atomic.h>
18
19/*
20 * Simple, straightforward mutexes with strict semantics:
21 *
22 * - only one task can hold the mutex at a time
23 * - only the owner can unlock the mutex
24 * - multiple unlocks are not permitted
25 * - recursive locking is not permitted
26 * - a mutex object must be initialized via the API
27 * - a mutex object must not be initialized via memset or copying
28 * - task may not exit with mutex held
29 * - memory areas where held locks reside must not be freed
30 * - held mutexes must not be reinitialized
31 * - mutexes may not be used in irq contexts
32 *
33 * These semantics are fully enforced when DEBUG_MUTEXES is
34 * enabled. Furthermore, besides enforcing the above rules, the mutex
35 * debugging code also implements a number of additional features
36 * that make lock debugging easier and faster:
37 *
38 * - uses symbolic names of mutexes, whenever they are printed in debug output
39 * - point-of-acquire tracking, symbolic lookup of function names
40 * - list of all locks held in the system, printout of them
41 * - owner tracking
42 * - detects self-recursing locks and prints out all relevant info
43 * - detects multi-task circular deadlocks and prints out all affected
44 * locks and tasks (and only those tasks)
45 */
46struct mutex {
47 /* 1: unlocked, 0: locked, negative: locked, possible waiters */
48 atomic_t count;
49 spinlock_t wait_lock;
50 struct list_head wait_list;
51#ifdef CONFIG_DEBUG_MUTEXES
52 struct thread_info *owner;
53 struct list_head held_list;
54 unsigned long acquire_ip;
55 const char *name;
56 void *magic;
57#endif
58};
59
60/*
61 * This is the control structure for tasks blocked on mutex,
62 * which resides on the blocked task's kernel stack:
63 */
64struct mutex_waiter {
65 struct list_head list;
66 struct task_struct *task;
67#ifdef CONFIG_DEBUG_MUTEXES
68 struct mutex *lock;
69 void *magic;
70#endif
71};
72
73#ifdef CONFIG_DEBUG_MUTEXES
74# include <linux/mutex-debug.h>
75#else
76# define __DEBUG_MUTEX_INITIALIZER(lockname)
77# define mutex_init(mutex) __mutex_init(mutex, NULL)
78# define mutex_destroy(mutex) do { } while (0)
79# define mutex_debug_show_all_locks() do { } while (0)
80# define mutex_debug_show_held_locks(p) do { } while (0)
81# define mutex_debug_check_no_locks_held(task) do { } while (0)
82# define mutex_debug_check_no_locks_freed(from, len) do { } while (0)
83#endif
84
85#define __MUTEX_INITIALIZER(lockname) \
86 { .count = ATOMIC_INIT(1) \
87 , .wait_lock = SPIN_LOCK_UNLOCKED \
88 , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \
89 __DEBUG_MUTEX_INITIALIZER(lockname) }
90
91#define DEFINE_MUTEX(mutexname) \
92 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
93
94extern void fastcall __mutex_init(struct mutex *lock, const char *name);
95
96/***
97 * mutex_is_locked - is the mutex locked
98 * @lock: the mutex to be queried
99 *
100 * Returns 1 if the mutex is locked, 0 if unlocked.
101 */
102static inline int fastcall mutex_is_locked(struct mutex *lock)
103{
104 return atomic_read(&lock->count) != 1;
105}
106
107/*
108 * See kernel/mutex.c for detailed documentation of these APIs.
109 * Also see Documentation/mutex-design.txt.
110 */
111extern void fastcall mutex_lock(struct mutex *lock);
112extern int fastcall mutex_lock_interruptible(struct mutex *lock);
113/*
114 * NOTE: mutex_trylock() follows the spin_trylock() convention,
115 * not the down_trylock() convention!
116 */
117extern int fastcall mutex_trylock(struct mutex *lock);
118extern void fastcall mutex_unlock(struct mutex *lock);
119
120#endif
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 455660eafba9..b699e427c00c 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -74,7 +74,7 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
74extern void release_open_intent(struct nameidata *); 74extern void release_open_intent(struct nameidata *);
75 75
76extern struct dentry * lookup_one_len(const char *, struct dentry *, int); 76extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
77extern struct dentry * lookup_hash(struct nameidata *); 77extern __deprecated_for_modules struct dentry * lookup_hash(struct nameidata *);
78 78
79extern int follow_down(struct vfsmount **, struct dentry **); 79extern int follow_down(struct vfsmount **, struct dentry **);
80extern int follow_up(struct vfsmount **, struct dentry **); 80extern int follow_up(struct vfsmount **, struct dentry **);
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 090e210e98f0..f95d51fae733 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -37,18 +37,26 @@ enum {
37/* userspace doesn't need the nbd_device structure */ 37/* userspace doesn't need the nbd_device structure */
38#ifdef __KERNEL__ 38#ifdef __KERNEL__
39 39
40#include <linux/wait.h>
41
40/* values for flags field */ 42/* values for flags field */
41#define NBD_READ_ONLY 0x0001 43#define NBD_READ_ONLY 0x0001
42#define NBD_WRITE_NOCHK 0x0002 44#define NBD_WRITE_NOCHK 0x0002
43 45
46struct request;
47
44struct nbd_device { 48struct nbd_device {
45 int flags; 49 int flags;
46 int harderror; /* Code of hard error */ 50 int harderror; /* Code of hard error */
47 struct socket * sock; 51 struct socket * sock;
48 struct file * file; /* If == NULL, device is not ready, yet */ 52 struct file * file; /* If == NULL, device is not ready, yet */
49 int magic; 53 int magic;
54
50 spinlock_t queue_lock; 55 spinlock_t queue_lock;
51 struct list_head queue_head;/* Requests are added here... */ 56 struct list_head queue_head;/* Requests are added here... */
57 struct request *active_req;
58 wait_queue_head_t active_wq;
59
52 struct semaphore tx_lock; 60 struct semaphore tx_lock;
53 struct gendisk *disk; 61 struct gendisk *disk;
54 int blksize; 62 int blksize;
diff --git a/include/linux/ncp.h b/include/linux/ncp.h
index 99f77876b716..99f0adeeb3f3 100644
--- a/include/linux/ncp.h
+++ b/include/linux/ncp.h
@@ -20,29 +20,29 @@
20#define NCP_DEALLOC_SLOT_REQUEST (0x5555) 20#define NCP_DEALLOC_SLOT_REQUEST (0x5555)
21 21
22struct ncp_request_header { 22struct ncp_request_header {
23 __u16 type __attribute__((packed)); 23 __u16 type;
24 __u8 sequence __attribute__((packed)); 24 __u8 sequence;
25 __u8 conn_low __attribute__((packed)); 25 __u8 conn_low;
26 __u8 task __attribute__((packed)); 26 __u8 task;
27 __u8 conn_high __attribute__((packed)); 27 __u8 conn_high;
28 __u8 function __attribute__((packed)); 28 __u8 function;
29 __u8 data[0] __attribute__((packed)); 29 __u8 data[0];
30}; 30} __attribute__((packed));
31 31
32#define NCP_REPLY (0x3333) 32#define NCP_REPLY (0x3333)
33#define NCP_WATCHDOG (0x3E3E) 33#define NCP_WATCHDOG (0x3E3E)
34#define NCP_POSITIVE_ACK (0x9999) 34#define NCP_POSITIVE_ACK (0x9999)
35 35
36struct ncp_reply_header { 36struct ncp_reply_header {
37 __u16 type __attribute__((packed)); 37 __u16 type;
38 __u8 sequence __attribute__((packed)); 38 __u8 sequence;
39 __u8 conn_low __attribute__((packed)); 39 __u8 conn_low;
40 __u8 task __attribute__((packed)); 40 __u8 task;
41 __u8 conn_high __attribute__((packed)); 41 __u8 conn_high;
42 __u8 completion_code __attribute__((packed)); 42 __u8 completion_code;
43 __u8 connection_state __attribute__((packed)); 43 __u8 connection_state;
44 __u8 data[0] __attribute__((packed)); 44 __u8 data[0];
45}; 45} __attribute__((packed));
46 46
47#define NCP_VOLNAME_LEN (16) 47#define NCP_VOLNAME_LEN (16)
48#define NCP_NUMBER_OF_VOLUMES (256) 48#define NCP_NUMBER_OF_VOLUMES (256)
@@ -128,37 +128,37 @@ struct nw_nfs_info {
128}; 128};
129 129
130struct nw_info_struct { 130struct nw_info_struct {
131 __u32 spaceAlloc __attribute__((packed)); 131 __u32 spaceAlloc;
132 __le32 attributes __attribute__((packed)); 132 __le32 attributes;
133 __u16 flags __attribute__((packed)); 133 __u16 flags;
134 __le32 dataStreamSize __attribute__((packed)); 134 __le32 dataStreamSize;
135 __le32 totalStreamSize __attribute__((packed)); 135 __le32 totalStreamSize;
136 __u16 numberOfStreams __attribute__((packed)); 136 __u16 numberOfStreams;
137 __le16 creationTime __attribute__((packed)); 137 __le16 creationTime;
138 __le16 creationDate __attribute__((packed)); 138 __le16 creationDate;
139 __u32 creatorID __attribute__((packed)); 139 __u32 creatorID;
140 __le16 modifyTime __attribute__((packed)); 140 __le16 modifyTime;
141 __le16 modifyDate __attribute__((packed)); 141 __le16 modifyDate;
142 __u32 modifierID __attribute__((packed)); 142 __u32 modifierID;
143 __le16 lastAccessDate __attribute__((packed)); 143 __le16 lastAccessDate;
144 __u16 archiveTime __attribute__((packed)); 144 __u16 archiveTime;
145 __u16 archiveDate __attribute__((packed)); 145 __u16 archiveDate;
146 __u32 archiverID __attribute__((packed)); 146 __u32 archiverID;
147 __u16 inheritedRightsMask __attribute__((packed)); 147 __u16 inheritedRightsMask;
148 __le32 dirEntNum __attribute__((packed)); 148 __le32 dirEntNum;
149 __le32 DosDirNum __attribute__((packed)); 149 __le32 DosDirNum;
150 __u32 volNumber __attribute__((packed)); 150 __u32 volNumber;
151 __u32 EADataSize __attribute__((packed)); 151 __u32 EADataSize;
152 __u32 EAKeyCount __attribute__((packed)); 152 __u32 EAKeyCount;
153 __u32 EAKeySize __attribute__((packed)); 153 __u32 EAKeySize;
154 __u32 NSCreator __attribute__((packed)); 154 __u32 NSCreator;
155 __u8 nameLen __attribute__((packed)); 155 __u8 nameLen;
156 __u8 entryName[256] __attribute__((packed)); 156 __u8 entryName[256];
157 /* libncp may depend on there being nothing after entryName */ 157 /* libncp may depend on there being nothing after entryName */
158#ifdef __KERNEL__ 158#ifdef __KERNEL__
159 struct nw_nfs_info nfs; 159 struct nw_nfs_info nfs;
160#endif 160#endif
161}; 161} __attribute__((packed));
162 162
163/* modify mask - use with MODIFY_DOS_INFO structure */ 163/* modify mask - use with MODIFY_DOS_INFO structure */
164#define DM_ATTRIBUTES (cpu_to_le32(0x02)) 164#define DM_ATTRIBUTES (cpu_to_le32(0x02))
@@ -176,26 +176,26 @@ struct nw_info_struct {
176#define DM_MAXIMUM_SPACE (cpu_to_le32(0x2000)) 176#define DM_MAXIMUM_SPACE (cpu_to_le32(0x2000))
177 177
178struct nw_modify_dos_info { 178struct nw_modify_dos_info {
179 __le32 attributes __attribute__((packed)); 179 __le32 attributes;
180 __le16 creationDate __attribute__((packed)); 180 __le16 creationDate;
181 __le16 creationTime __attribute__((packed)); 181 __le16 creationTime;
182 __u32 creatorID __attribute__((packed)); 182 __u32 creatorID;
183 __le16 modifyDate __attribute__((packed)); 183 __le16 modifyDate;
184 __le16 modifyTime __attribute__((packed)); 184 __le16 modifyTime;
185 __u32 modifierID __attribute__((packed)); 185 __u32 modifierID;
186 __u16 archiveDate __attribute__((packed)); 186 __u16 archiveDate;
187 __u16 archiveTime __attribute__((packed)); 187 __u16 archiveTime;
188 __u32 archiverID __attribute__((packed)); 188 __u32 archiverID;
189 __le16 lastAccessDate __attribute__((packed)); 189 __le16 lastAccessDate;
190 __u16 inheritanceGrantMask __attribute__((packed)); 190 __u16 inheritanceGrantMask;
191 __u16 inheritanceRevokeMask __attribute__((packed)); 191 __u16 inheritanceRevokeMask;
192 __u32 maximumSpace __attribute__((packed)); 192 __u32 maximumSpace;
193}; 193} __attribute__((packed));
194 194
195struct nw_search_sequence { 195struct nw_search_sequence {
196 __u8 volNumber __attribute__((packed)); 196 __u8 volNumber;
197 __u32 dirBase __attribute__((packed)); 197 __u32 dirBase;
198 __u32 sequence __attribute__((packed)); 198 __u32 sequence;
199}; 199} __attribute__((packed));
200 200
201#endif /* _LINUX_NCP_H */ 201#endif /* _LINUX_NCP_H */
diff --git a/include/linux/net.h b/include/linux/net.h
index d6a41e6577f6..28195a2d8ff0 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -107,7 +107,7 @@ enum sock_type {
107struct socket { 107struct socket {
108 socket_state state; 108 socket_state state;
109 unsigned long flags; 109 unsigned long flags;
110 struct proto_ops *ops; 110 const struct proto_ops *ops;
111 struct fasync_struct *fasync_list; 111 struct fasync_struct *fasync_list;
112 struct file *file; 112 struct file *file;
113 struct sock *sk; 113 struct sock *sk;
@@ -260,7 +260,7 @@ SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct ms
260SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \ 260SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \
261 (file, sock, vma)) \ 261 (file, sock, vma)) \
262 \ 262 \
263static struct proto_ops name##_ops = { \ 263static const struct proto_ops name##_ops = { \
264 .family = fam, \ 264 .family = fam, \
265 .owner = THIS_MODULE, \ 265 .owner = THIS_MODULE, \
266 .release = __lock_##name##_release, \ 266 .release = __lock_##name##_release, \
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 936f8b76114e..7fda03d338d1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -684,6 +684,7 @@ extern int netif_rx(struct sk_buff *skb);
684extern int netif_rx_ni(struct sk_buff *skb); 684extern int netif_rx_ni(struct sk_buff *skb);
685#define HAVE_NETIF_RECEIVE_SKB 1 685#define HAVE_NETIF_RECEIVE_SKB 1
686extern int netif_receive_skb(struct sk_buff *skb); 686extern int netif_receive_skb(struct sk_buff *skb);
687extern int dev_valid_name(const char *name);
687extern int dev_ioctl(unsigned int cmd, void __user *); 688extern int dev_ioctl(unsigned int cmd, void __user *);
688extern int dev_ethtool(struct ifreq *); 689extern int dev_ethtool(struct ifreq *);
689extern unsigned dev_get_flags(const struct net_device *); 690extern unsigned dev_get_flags(const struct net_device *);
@@ -801,12 +802,16 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
801 return (1 << debug_value) - 1; 802 return (1 << debug_value) - 1;
802} 803}
803 804
804/* Schedule rx intr now? */ 805/* Test if receive needs to be scheduled */
806static inline int __netif_rx_schedule_prep(struct net_device *dev)
807{
808 return !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
809}
805 810
811/* Test if receive needs to be scheduled but only if up */
806static inline int netif_rx_schedule_prep(struct net_device *dev) 812static inline int netif_rx_schedule_prep(struct net_device *dev)
807{ 813{
808 return netif_running(dev) && 814 return netif_running(dev) && __netif_rx_schedule_prep(dev);
809 !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
810} 815}
811 816
812/* Add interface to tail of rx poll list. This assumes that _prep has 817/* Add interface to tail of rx poll list. This assumes that _prep has
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index be365e70ee99..4cf6088625c1 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -168,6 +168,37 @@ void nf_log_packet(int pf,
168 const struct net_device *out, 168 const struct net_device *out,
169 struct nf_loginfo *li, 169 struct nf_loginfo *li,
170 const char *fmt, ...); 170 const char *fmt, ...);
171
172int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb,
173 struct net_device *indev, struct net_device *outdev,
174 int (*okfn)(struct sk_buff *), int thresh);
175
176/**
177 * nf_hook_thresh - call a netfilter hook
178 *
179 * Returns 1 if the hook has allowed the packet to pass. The function
180 * okfn must be invoked by the caller in this case. Any other return
181 * value indicates the packet has been consumed by the hook.
182 */
183static inline int nf_hook_thresh(int pf, unsigned int hook,
184 struct sk_buff **pskb,
185 struct net_device *indev,
186 struct net_device *outdev,
187 int (*okfn)(struct sk_buff *), int thresh)
188{
189#ifndef CONFIG_NETFILTER_DEBUG
190 if (list_empty(&nf_hooks[pf][hook]))
191 return 1;
192#endif
193 return nf_hook_slow(pf, hook, pskb, indev, outdev, okfn, thresh);
194}
195
196static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
197 struct net_device *indev, struct net_device *outdev,
198 int (*okfn)(struct sk_buff *))
199{
200 return nf_hook_thresh(pf, hook, pskb, indev, outdev, okfn, INT_MIN);
201}
171 202
172/* Activate hook; either okfn or kfree_skb called, unless a hook 203/* Activate hook; either okfn or kfree_skb called, unless a hook
173 returns NF_STOLEN (in which case, it's up to the hook to deal with 204 returns NF_STOLEN (in which case, it's up to the hook to deal with
@@ -188,35 +219,17 @@ void nf_log_packet(int pf,
188 219
189/* This is gross, but inline doesn't cut it for avoiding the function 220/* This is gross, but inline doesn't cut it for avoiding the function
190 call in fast path: gcc doesn't inline (needs value tracking?). --RR */ 221 call in fast path: gcc doesn't inline (needs value tracking?). --RR */
191#ifdef CONFIG_NETFILTER_DEBUG 222
192#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \ 223/* HX: It's slightly less gross now. */
193({int __ret; \ 224
194if ((__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, INT_MIN)) == 1) \
195 __ret = (okfn)(skb); \
196__ret;})
197#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \
198({int __ret; \
199if ((__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1) \
200 __ret = (okfn)(skb); \
201__ret;})
202#else
203#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
204({int __ret; \
205if (list_empty(&nf_hooks[pf][hook]) || \
206 (__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, INT_MIN)) == 1) \
207 __ret = (okfn)(skb); \
208__ret;})
209#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ 225#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \
210({int __ret; \ 226({int __ret; \
211if (list_empty(&nf_hooks[pf][hook]) || \ 227if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1)\
212 (__ret=nf_hook_slow(pf, hook, &(skb), indev, outdev, okfn, thresh)) == 1) \
213 __ret = (okfn)(skb); \ 228 __ret = (okfn)(skb); \
214__ret;}) 229__ret;})
215#endif
216 230
217int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb, 231#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
218 struct net_device *indev, struct net_device *outdev, 232 NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN)
219 int (*okfn)(struct sk_buff *), int thresh);
220 233
221/* Call setsockopt() */ 234/* Call setsockopt() */
222int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, 235int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt,
@@ -261,6 +274,20 @@ struct nf_queue_rerouter {
261extern int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer); 274extern int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer);
262extern int nf_unregister_queue_rerouter(int pf); 275extern int nf_unregister_queue_rerouter(int pf);
263 276
277#include <net/flow.h>
278extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
279
280static inline void
281nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family)
282{
283#ifdef CONFIG_IP_NF_NAT_NEEDED
284 void (*decodefn)(struct sk_buff *, struct flowi *);
285
286 if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL)
287 decodefn(skb, fl);
288#endif
289}
290
264#ifdef CONFIG_PROC_FS 291#ifdef CONFIG_PROC_FS
265#include <linux/proc_fs.h> 292#include <linux/proc_fs.h>
266extern struct proc_dir_entry *proc_net_netfilter; 293extern struct proc_dir_entry *proc_net_netfilter;
@@ -268,7 +295,24 @@ extern struct proc_dir_entry *proc_net_netfilter;
268 295
269#else /* !CONFIG_NETFILTER */ 296#else /* !CONFIG_NETFILTER */
270#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 297#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
298static inline int nf_hook_thresh(int pf, unsigned int hook,
299 struct sk_buff **pskb,
300 struct net_device *indev,
301 struct net_device *outdev,
302 int (*okfn)(struct sk_buff *), int thresh)
303{
304 return okfn(*pskb);
305}
306static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
307 struct net_device *indev, struct net_device *outdev,
308 int (*okfn)(struct sk_buff *))
309{
310 return okfn(*pskb);
311}
271static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 312static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
313struct flowi;
314static inline void
315nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {}
272#endif /*CONFIG_NETFILTER*/ 316#endif /*CONFIG_NETFILTER*/
273 317
274#endif /*__KERNEL__*/ 318#endif /*__KERNEL__*/
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 116fcaced909..668ec946c8e2 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -64,6 +64,9 @@ enum ctattr_l4proto {
64 CTA_PROTO_ICMP_ID, 64 CTA_PROTO_ICMP_ID,
65 CTA_PROTO_ICMP_TYPE, 65 CTA_PROTO_ICMP_TYPE,
66 CTA_PROTO_ICMP_CODE, 66 CTA_PROTO_ICMP_CODE,
67 CTA_PROTO_ICMPV6_ID,
68 CTA_PROTO_ICMPV6_TYPE,
69 CTA_PROTO_ICMPV6_CODE,
67 __CTA_PROTO_MAX 70 __CTA_PROTO_MAX
68}; 71};
69#define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1) 72#define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1)
@@ -128,6 +131,4 @@ enum ctattr_help {
128}; 131};
129#define CTA_HELP_MAX (__CTA_HELP_MAX - 1) 132#define CTA_HELP_MAX (__CTA_HELP_MAX - 1)
130 133
131#define CTA_HELP_MAXNAMESIZE 32
132
133#endif /* _IPCONNTRACK_NETLINK_H */ 134#endif /* _IPCONNTRACK_NETLINK_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h
index ef63aa991a06..612a43614e7b 100644
--- a/include/linux/netfilter_ipv4/ip_nat_protocol.h
+++ b/include/linux/netfilter_ipv4/ip_nat_protocol.h
@@ -42,13 +42,6 @@ struct ip_nat_protocol
42 enum ip_nat_manip_type maniptype, 42 enum ip_nat_manip_type maniptype,
43 const struct ip_conntrack *conntrack); 43 const struct ip_conntrack *conntrack);
44 44
45 unsigned int (*print)(char *buffer,
46 const struct ip_conntrack_tuple *match,
47 const struct ip_conntrack_tuple *mask);
48
49 unsigned int (*print_range)(char *buffer,
50 const struct ip_nat_range *range);
51
52 int (*range_to_nfattr)(struct sk_buff *skb, 45 int (*range_to_nfattr)(struct sk_buff *skb,
53 const struct ip_nat_range *range); 46 const struct ip_nat_range *range);
54 47
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
new file mode 100644
index 000000000000..7fd1bec453f1
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ipt_policy.h
@@ -0,0 +1,52 @@
1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H
3
4#define IPT_POLICY_MAX_ELEM 4
5
6enum ipt_policy_flags
7{
8 IPT_POLICY_MATCH_IN = 0x1,
9 IPT_POLICY_MATCH_OUT = 0x2,
10 IPT_POLICY_MATCH_NONE = 0x4,
11 IPT_POLICY_MATCH_STRICT = 0x8,
12};
13
14enum ipt_policy_modes
15{
16 IPT_POLICY_MODE_TRANSPORT,
17 IPT_POLICY_MODE_TUNNEL
18};
19
20struct ipt_policy_spec
21{
22 u_int8_t saddr:1,
23 daddr:1,
24 proto:1,
25 mode:1,
26 spi:1,
27 reqid:1;
28};
29
30struct ipt_policy_elem
31{
32 u_int32_t saddr;
33 u_int32_t smask;
34 u_int32_t daddr;
35 u_int32_t dmask;
36 u_int32_t spi;
37 u_int32_t reqid;
38 u_int8_t proto;
39 u_int8_t mode;
40
41 struct ipt_policy_spec match;
42 struct ipt_policy_spec invert;
43};
44
45struct ipt_policy_info
46{
47 struct ipt_policy_elem pol[IPT_POLICY_MAX_ELEM];
48 u_int16_t flags;
49 u_int16_t len;
50};
51
52#endif /* _IPT_POLICY_H */
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 53b2983f6278..14f2bd010884 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -72,7 +72,12 @@ enum nf_ip6_hook_priorities {
72 NF_IP6_PRI_LAST = INT_MAX, 72 NF_IP6_PRI_LAST = INT_MAX,
73}; 73};
74 74
75#ifdef CONFIG_NETFILTER
75extern int ipv6_netfilter_init(void); 76extern int ipv6_netfilter_init(void);
76extern void ipv6_netfilter_fini(void); 77extern void ipv6_netfilter_fini(void);
78#else /* CONFIG_NETFILTER */
79static inline int ipv6_netfilter_init(void) { return 0; }
80static inline void ipv6_netfilter_fini(void) { return; }
81#endif /* CONFIG_NETFILTER */
77 82
78#endif /*__LINUX_IP6_NETFILTER_H*/ 83#endif /*__LINUX_IP6_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 2efc046d9e94..c163ba31aab7 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -474,7 +474,11 @@ extern unsigned int ip6t_do_table(struct sk_buff **pskb,
474extern int ip6t_ext_hdr(u8 nexthdr); 474extern int ip6t_ext_hdr(u8 nexthdr);
475/* find specified header and get offset to it */ 475/* find specified header and get offset to it */
476extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 476extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
477 u8 target); 477 int target, unsigned short *fragoff);
478
479extern int ip6_masked_addrcmp(const struct in6_addr *addr1,
480 const struct in6_addr *mask,
481 const struct in6_addr *addr2);
478 482
479#define IP6T_ALIGN(s) (((s) + (__alignof__(struct ip6t_entry)-1)) & ~(__alignof__(struct ip6t_entry)-1)) 483#define IP6T_ALIGN(s) (((s) + (__alignof__(struct ip6t_entry)-1)) & ~(__alignof__(struct ip6t_entry)-1))
480 484
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
new file mode 100644
index 000000000000..5a93afcd2ff1
--- /dev/null
+++ b/include/linux/netfilter_ipv6/ip6t_policy.h
@@ -0,0 +1,52 @@
1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H
3
4#define IP6T_POLICY_MAX_ELEM 4
5
6enum ip6t_policy_flags
7{
8 IP6T_POLICY_MATCH_IN = 0x1,
9 IP6T_POLICY_MATCH_OUT = 0x2,
10 IP6T_POLICY_MATCH_NONE = 0x4,
11 IP6T_POLICY_MATCH_STRICT = 0x8,
12};
13
14enum ip6t_policy_modes
15{
16 IP6T_POLICY_MODE_TRANSPORT,
17 IP6T_POLICY_MODE_TUNNEL
18};
19
20struct ip6t_policy_spec
21{
22 u_int8_t saddr:1,
23 daddr:1,
24 proto:1,
25 mode:1,
26 spi:1,
27 reqid:1;
28};
29
30struct ip6t_policy_elem
31{
32 struct in6_addr saddr;
33 struct in6_addr smask;
34 struct in6_addr daddr;
35 struct in6_addr dmask;
36 u_int32_t spi;
37 u_int32_t reqid;
38 u_int8_t proto;
39 u_int8_t mode;
40
41 struct ip6t_policy_spec match;
42 struct ip6t_policy_spec invert;
43};
44
45struct ip6t_policy_info
46{
47 struct ip6t_policy_elem pol[IP6T_POLICY_MAX_ELEM];
48 u_int16_t flags;
49 u_int16_t len;
50};
51
52#endif /* _IP6T_POLICY_H */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 2516adeccecf..547d649b274e 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -38,9 +38,6 @@
38# define NFS_DEBUG 38# define NFS_DEBUG
39#endif 39#endif
40 40
41#define NFS_MAX_FILE_IO_BUFFER_SIZE 32768
42#define NFS_DEF_FILE_IO_BUFFER_SIZE 4096
43
44/* Default timeout values */ 41/* Default timeout values */
45#define NFS_MAX_UDP_TIMEOUT (60*HZ) 42#define NFS_MAX_UDP_TIMEOUT (60*HZ)
46#define NFS_MAX_TCP_TIMEOUT (600*HZ) 43#define NFS_MAX_TCP_TIMEOUT (600*HZ)
@@ -65,6 +62,7 @@
65#define FLUSH_STABLE 4 /* commit to stable storage */ 62#define FLUSH_STABLE 4 /* commit to stable storage */
66#define FLUSH_LOWPRI 8 /* low priority background flush */ 63#define FLUSH_LOWPRI 8 /* low priority background flush */
67#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 64#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
65#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */
68 66
69#ifdef __KERNEL__ 67#ifdef __KERNEL__
70 68
@@ -394,6 +392,17 @@ extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_
394extern struct inode_operations nfs_symlink_inode_operations; 392extern struct inode_operations nfs_symlink_inode_operations;
395 393
396/* 394/*
395 * linux/fs/nfs/sysctl.c
396 */
397#ifdef CONFIG_SYSCTL
398extern int nfs_register_sysctl(void);
399extern void nfs_unregister_sysctl(void);
400#else
401#define nfs_register_sysctl() do { } while(0)
402#define nfs_unregister_sysctl() do { } while(0)
403#endif
404
405/*
397 * linux/fs/nfs/unlink.c 406 * linux/fs/nfs/unlink.c
398 */ 407 */
399extern int nfs_async_unlink(struct dentry *); 408extern int nfs_async_unlink(struct dentry *);
@@ -406,10 +415,12 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
406extern int nfs_writepages(struct address_space *, struct writeback_control *); 415extern int nfs_writepages(struct address_space *, struct writeback_control *);
407extern int nfs_flush_incompatible(struct file *file, struct page *page); 416extern int nfs_flush_incompatible(struct file *file, struct page *page);
408extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 417extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
409extern void nfs_writeback_done(struct rpc_task *task); 418extern void nfs_writeback_done(struct rpc_task *task, void *data);
419extern void nfs_writedata_release(void *data);
410 420
411#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
412extern void nfs_commit_done(struct rpc_task *); 422extern void nfs_commit_done(struct rpc_task *, void *data);
423extern void nfs_commit_release(void *data);
413#endif 424#endif
414 425
415/* 426/*
@@ -460,18 +471,33 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page)
460 */ 471 */
461extern mempool_t *nfs_wdata_mempool; 472extern mempool_t *nfs_wdata_mempool;
462 473
463static inline struct nfs_write_data *nfs_writedata_alloc(void) 474static inline struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount)
464{ 475{
465 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); 476 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS);
477
466 if (p) { 478 if (p) {
467 memset(p, 0, sizeof(*p)); 479 memset(p, 0, sizeof(*p));
468 INIT_LIST_HEAD(&p->pages); 480 INIT_LIST_HEAD(&p->pages);
481 if (pagecount < NFS_PAGEVEC_SIZE)
482 p->pagevec = &p->page_array[0];
483 else {
484 size_t size = ++pagecount * sizeof(struct page *);
485 p->pagevec = kmalloc(size, GFP_NOFS);
486 if (p->pagevec) {
487 memset(p->pagevec, 0, size);
488 } else {
489 mempool_free(p, nfs_wdata_mempool);
490 p = NULL;
491 }
492 }
469 } 493 }
470 return p; 494 return p;
471} 495}
472 496
473static inline void nfs_writedata_free(struct nfs_write_data *p) 497static inline void nfs_writedata_free(struct nfs_write_data *p)
474{ 498{
499 if (p && (p->pagevec != &p->page_array[0]))
500 kfree(p->pagevec);
475 mempool_free(p, nfs_wdata_mempool); 501 mempool_free(p, nfs_wdata_mempool);
476} 502}
477 503
@@ -481,28 +507,45 @@ static inline void nfs_writedata_free(struct nfs_write_data *p)
481extern int nfs_readpage(struct file *, struct page *); 507extern int nfs_readpage(struct file *, struct page *);
482extern int nfs_readpages(struct file *, struct address_space *, 508extern int nfs_readpages(struct file *, struct address_space *,
483 struct list_head *, unsigned); 509 struct list_head *, unsigned);
484extern void nfs_readpage_result(struct rpc_task *); 510extern void nfs_readpage_result(struct rpc_task *, void *);
511extern void nfs_readdata_release(void *data);
512
485 513
486/* 514/*
487 * Allocate and free nfs_read_data structures 515 * Allocate and free nfs_read_data structures
488 */ 516 */
489extern mempool_t *nfs_rdata_mempool; 517extern mempool_t *nfs_rdata_mempool;
490 518
491static inline struct nfs_read_data *nfs_readdata_alloc(void) 519static inline struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
492{ 520{
493 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); 521 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS);
494 if (p) 522
523 if (p) {
495 memset(p, 0, sizeof(*p)); 524 memset(p, 0, sizeof(*p));
525 INIT_LIST_HEAD(&p->pages);
526 if (pagecount < NFS_PAGEVEC_SIZE)
527 p->pagevec = &p->page_array[0];
528 else {
529 size_t size = ++pagecount * sizeof(struct page *);
530 p->pagevec = kmalloc(size, GFP_NOFS);
531 if (p->pagevec) {
532 memset(p->pagevec, 0, size);
533 } else {
534 mempool_free(p, nfs_rdata_mempool);
535 p = NULL;
536 }
537 }
538 }
496 return p; 539 return p;
497} 540}
498 541
499static inline void nfs_readdata_free(struct nfs_read_data *p) 542static inline void nfs_readdata_free(struct nfs_read_data *p)
500{ 543{
544 if (p && (p->pagevec != &p->page_array[0]))
545 kfree(p->pagevec);
501 mempool_free(p, nfs_rdata_mempool); 546 mempool_free(p, nfs_rdata_mempool);
502} 547}
503 548
504extern void nfs_readdata_release(struct rpc_task *task);
505
506/* 549/*
507 * linux/fs/nfs3proc.c 550 * linux/fs/nfs3proc.c
508 */ 551 */
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index a0f1f25e0ead..102e56094296 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -71,6 +71,8 @@ int nfs_map_name_to_uid(struct nfs4_client *, const char *, size_t, __u32 *);
71int nfs_map_group_to_gid(struct nfs4_client *, const char *, size_t, __u32 *); 71int nfs_map_group_to_gid(struct nfs4_client *, const char *, size_t, __u32 *);
72int nfs_map_uid_to_name(struct nfs4_client *, __u32, char *); 72int nfs_map_uid_to_name(struct nfs4_client *, __u32, char *);
73int nfs_map_gid_to_group(struct nfs4_client *, __u32, char *); 73int nfs_map_gid_to_group(struct nfs4_client *, __u32, char *);
74
75extern unsigned int nfs_idmap_cache_timeout;
74#endif /* __KERNEL__ */ 76#endif /* __KERNEL__ */
75 77
76#endif /* NFS_IDMAP_H */ 78#endif /* NFS_IDMAP_H */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index da2e077b65e2..66e2ed658527 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -79,9 +79,7 @@ extern void nfs_clear_page_writeback(struct nfs_page *req);
79static inline int 79static inline int
80nfs_lock_request_dontget(struct nfs_page *req) 80nfs_lock_request_dontget(struct nfs_page *req)
81{ 81{
82 if (test_and_set_bit(PG_BUSY, &req->wb_flags)) 82 return !test_and_set_bit(PG_BUSY, &req->wb_flags);
83 return 0;
84 return 1;
85} 83}
86 84
87/* 85/*
@@ -125,9 +123,7 @@ nfs_list_remove_request(struct nfs_page *req)
125static inline int 123static inline int
126nfs_defer_commit(struct nfs_page *req) 124nfs_defer_commit(struct nfs_page *req)
127{ 125{
128 if (test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags)) 126 return !test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags);
129 return 0;
130 return 1;
131} 127}
132 128
133static inline void 129static inline void
@@ -141,9 +137,7 @@ nfs_clear_commit(struct nfs_page *req)
141static inline int 137static inline int
142nfs_defer_reschedule(struct nfs_page *req) 138nfs_defer_reschedule(struct nfs_page *req)
143{ 139{
144 if (test_and_set_bit(PG_NEED_RESCHED, &req->wb_flags)) 140 return !test_and_set_bit(PG_NEED_RESCHED, &req->wb_flags);
145 return 0;
146 return 1;
147} 141}
148 142
149static inline void 143static inline void
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 40718669b9c8..6d6f69ec5675 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -4,6 +4,16 @@
4#include <linux/sunrpc/xprt.h> 4#include <linux/sunrpc/xprt.h>
5#include <linux/nfsacl.h> 5#include <linux/nfsacl.h>
6 6
7/*
8 * To change the maximum rsize and wsize supported by the NFS client, adjust
9 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
10 * support a megabyte or more. The default is left at 4096 bytes, which is
11 * reasonable for NFS over UDP.
12 */
13#define NFS_MAX_FILE_IO_SIZE (1048576U)
14#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U)
16
7struct nfs4_fsid { 17struct nfs4_fsid {
8 __u64 major; 18 __u64 major;
9 __u64 minor; 19 __u64 minor;
@@ -137,7 +147,7 @@ struct nfs_openres {
137 */ 147 */
138struct nfs_open_confirmargs { 148struct nfs_open_confirmargs {
139 const struct nfs_fh * fh; 149 const struct nfs_fh * fh;
140 nfs4_stateid stateid; 150 nfs4_stateid * stateid;
141 struct nfs_seqid * seqid; 151 struct nfs_seqid * seqid;
142}; 152};
143 153
@@ -165,66 +175,62 @@ struct nfs_closeres {
165 * * Arguments to the lock,lockt, and locku call. 175 * * Arguments to the lock,lockt, and locku call.
166 * */ 176 * */
167struct nfs_lowner { 177struct nfs_lowner {
168 __u64 clientid; 178 __u64 clientid;
169 u32 id; 179 u32 id;
170}; 180};
171 181
172struct nfs_lock_opargs { 182struct nfs_lock_args {
183 struct nfs_fh * fh;
184 struct file_lock * fl;
173 struct nfs_seqid * lock_seqid; 185 struct nfs_seqid * lock_seqid;
174 nfs4_stateid * lock_stateid; 186 nfs4_stateid * lock_stateid;
175 struct nfs_seqid * open_seqid; 187 struct nfs_seqid * open_seqid;
176 nfs4_stateid * open_stateid; 188 nfs4_stateid * open_stateid;
177 struct nfs_lowner lock_owner; 189 struct nfs_lowner lock_owner;
178 __u32 reclaim; 190 unsigned char block : 1;
179 __u32 new_lock_owner; 191 unsigned char reclaim : 1;
192 unsigned char new_lock_owner : 1;
180}; 193};
181 194
182struct nfs_locku_opargs { 195struct nfs_lock_res {
196 nfs4_stateid stateid;
197};
198
199struct nfs_locku_args {
200 struct nfs_fh * fh;
201 struct file_lock * fl;
183 struct nfs_seqid * seqid; 202 struct nfs_seqid * seqid;
184 nfs4_stateid * stateid; 203 nfs4_stateid * stateid;
185}; 204};
186 205
187struct nfs_lockargs { 206struct nfs_locku_res {
188 struct nfs_fh * fh; 207 nfs4_stateid stateid;
189 __u32 type;
190 __u64 offset;
191 __u64 length;
192 union {
193 struct nfs_lock_opargs *lock; /* LOCK */
194 struct nfs_lowner *lockt; /* LOCKT */
195 struct nfs_locku_opargs *locku; /* LOCKU */
196 } u;
197}; 208};
198 209
199struct nfs_lock_denied { 210struct nfs_lockt_args {
200 __u64 offset; 211 struct nfs_fh * fh;
201 __u64 length; 212 struct file_lock * fl;
202 __u32 type; 213 struct nfs_lowner lock_owner;
203 struct nfs_lowner owner;
204}; 214};
205 215
206struct nfs_lockres { 216struct nfs_lockt_res {
207 union { 217 struct file_lock * denied; /* LOCK, LOCKT failed */
208 nfs4_stateid stateid;/* LOCK success, LOCKU */
209 struct nfs_lock_denied denied; /* LOCK failed, LOCKT success */
210 } u;
211 const struct nfs_server * server;
212}; 218};
213 219
214struct nfs4_delegreturnargs { 220struct nfs4_delegreturnargs {
215 const struct nfs_fh *fhandle; 221 const struct nfs_fh *fhandle;
216 const nfs4_stateid *stateid; 222 const nfs4_stateid *stateid;
223 const u32 * bitmask;
224};
225
226struct nfs4_delegreturnres {
227 struct nfs_fattr * fattr;
228 const struct nfs_server *server;
217}; 229};
218 230
219/* 231/*
220 * Arguments to the read call. 232 * Arguments to the read call.
221 */ 233 */
222
223#define NFS_READ_MAXIOV (9U)
224#if (NFS_READ_MAXIOV > (MAX_IOVEC -2))
225#error "NFS_READ_MAXIOV is too large"
226#endif
227
228struct nfs_readargs { 234struct nfs_readargs {
229 struct nfs_fh * fh; 235 struct nfs_fh * fh;
230 struct nfs_open_context *context; 236 struct nfs_open_context *context;
@@ -243,11 +249,6 @@ struct nfs_readres {
243/* 249/*
244 * Arguments to the write call. 250 * Arguments to the write call.
245 */ 251 */
246#define NFS_WRITE_MAXIOV (9U)
247#if (NFS_WRITE_MAXIOV > (MAX_IOVEC -2))
248#error "NFS_WRITE_MAXIOV is too large"
249#endif
250
251struct nfs_writeargs { 252struct nfs_writeargs {
252 struct nfs_fh * fh; 253 struct nfs_fh * fh;
253 struct nfs_open_context *context; 254 struct nfs_open_context *context;
@@ -678,6 +679,8 @@ struct nfs4_server_caps_res {
678 679
679struct nfs_page; 680struct nfs_page;
680 681
682#define NFS_PAGEVEC_SIZE (8U)
683
681struct nfs_read_data { 684struct nfs_read_data {
682 int flags; 685 int flags;
683 struct rpc_task task; 686 struct rpc_task task;
@@ -686,13 +689,14 @@ struct nfs_read_data {
686 struct nfs_fattr fattr; /* fattr storage */ 689 struct nfs_fattr fattr; /* fattr storage */
687 struct list_head pages; /* Coalesced read requests */ 690 struct list_head pages; /* Coalesced read requests */
688 struct nfs_page *req; /* multi ops per nfs_page */ 691 struct nfs_page *req; /* multi ops per nfs_page */
689 struct page *pagevec[NFS_READ_MAXIOV]; 692 struct page **pagevec;
690 struct nfs_readargs args; 693 struct nfs_readargs args;
691 struct nfs_readres res; 694 struct nfs_readres res;
692#ifdef CONFIG_NFS_V4 695#ifdef CONFIG_NFS_V4
693 unsigned long timestamp; /* For lease renewal */ 696 unsigned long timestamp; /* For lease renewal */
694#endif 697#endif
695 void (*complete) (struct nfs_read_data *, int); 698 void (*complete) (struct nfs_read_data *, int);
699 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
696}; 700};
697 701
698struct nfs_write_data { 702struct nfs_write_data {
@@ -704,13 +708,14 @@ struct nfs_write_data {
704 struct nfs_writeverf verf; 708 struct nfs_writeverf verf;
705 struct list_head pages; /* Coalesced requests we wish to flush */ 709 struct list_head pages; /* Coalesced requests we wish to flush */
706 struct nfs_page *req; /* multi ops per nfs_page */ 710 struct nfs_page *req; /* multi ops per nfs_page */
707 struct page *pagevec[NFS_WRITE_MAXIOV]; 711 struct page **pagevec;
708 struct nfs_writeargs args; /* argument struct */ 712 struct nfs_writeargs args; /* argument struct */
709 struct nfs_writeres res; /* result struct */ 713 struct nfs_writeres res; /* result struct */
710#ifdef CONFIG_NFS_V4 714#ifdef CONFIG_NFS_V4
711 unsigned long timestamp; /* For lease renewal */ 715 unsigned long timestamp; /* For lease renewal */
712#endif 716#endif
713 void (*complete) (struct nfs_write_data *, int); 717 void (*complete) (struct nfs_write_data *, int);
718 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
714}; 719};
715 720
716struct nfs_access_entry; 721struct nfs_access_entry;
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index bb842ea41033..0798b7781a6e 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -294,7 +294,7 @@ fill_post_wcc(struct svc_fh *fhp)
294/* 294/*
295 * Lock a file handle/inode 295 * Lock a file handle/inode
296 * NOTE: both fh_lock and fh_unlock are done "by hand" in 296 * NOTE: both fh_lock and fh_unlock are done "by hand" in
297 * vfs.c:nfsd_rename as it needs to grab 2 i_sem's at once 297 * vfs.c:nfsd_rename as it needs to grab 2 i_mutex's at once
298 * so, any changes here should be reflected there. 298 * so, any changes here should be reflected there.
299 */ 299 */
300static inline void 300static inline void
@@ -317,7 +317,7 @@ fh_lock(struct svc_fh *fhp)
317 } 317 }
318 318
319 inode = dentry->d_inode; 319 inode = dentry->d_inode;
320 down(&inode->i_sem); 320 mutex_lock(&inode->i_mutex);
321 fill_pre_wcc(fhp); 321 fill_pre_wcc(fhp);
322 fhp->fh_locked = 1; 322 fhp->fh_locked = 1;
323} 323}
@@ -333,7 +333,7 @@ fh_unlock(struct svc_fh *fhp)
333 333
334 if (fhp->fh_locked) { 334 if (fhp->fh_locked) {
335 fill_post_wcc(fhp); 335 fill_post_wcc(fhp);
336 up(&fhp->fh_dentry->d_inode->i_sem); 336 mutex_unlock(&fhp->fh_dentry->d_inode->i_mutex);
337 fhp->fh_locked = 0; 337 fhp->fh_locked = 0;
338 } 338 }
339} 339}
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 130d4f588a37..3f4f7142bbe3 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -88,10 +88,12 @@ struct nfsd_readdirargs {
88 88
89struct nfsd_attrstat { 89struct nfsd_attrstat {
90 struct svc_fh fh; 90 struct svc_fh fh;
91 struct kstat stat;
91}; 92};
92 93
93struct nfsd_diropres { 94struct nfsd_diropres {
94 struct svc_fh fh; 95 struct svc_fh fh;
96 struct kstat stat;
95}; 97};
96 98
97struct nfsd_readlinkres { 99struct nfsd_readlinkres {
@@ -101,6 +103,7 @@ struct nfsd_readlinkres {
101struct nfsd_readres { 103struct nfsd_readres {
102 struct svc_fh fh; 104 struct svc_fh fh;
103 unsigned long count; 105 unsigned long count;
106 struct kstat stat;
104}; 107};
105 108
106struct nfsd_readdirres { 109struct nfsd_readdirres {
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 3c2a71b43bac..a4322741f8b9 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -126,6 +126,7 @@ struct nfsd3_setaclargs {
126struct nfsd3_attrstat { 126struct nfsd3_attrstat {
127 __u32 status; 127 __u32 status;
128 struct svc_fh fh; 128 struct svc_fh fh;
129 struct kstat stat;
129}; 130};
130 131
131/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */ 132/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 343083fec258..d52999c43336 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -79,13 +79,23 @@
79/* 79/*
80 * Global page accounting. One instance per CPU. Only unsigned longs are 80 * Global page accounting. One instance per CPU. Only unsigned longs are
81 * allowed. 81 * allowed.
82 *
83 * - Fields can be modified with xxx_page_state and xxx_page_state_zone at
84 * any time safely (which protects the instance from modification by
85 * interrupt.
86 * - The __xxx_page_state variants can be used safely when interrupts are
87 * disabled.
88 * - The __xxx_page_state variants can be used if the field is only
89 * modified from process context, or only modified from interrupt context.
90 * In this case, the field should be commented here.
82 */ 91 */
83struct page_state { 92struct page_state {
84 unsigned long nr_dirty; /* Dirty writeable pages */ 93 unsigned long nr_dirty; /* Dirty writeable pages */
85 unsigned long nr_writeback; /* Pages under writeback */ 94 unsigned long nr_writeback; /* Pages under writeback */
86 unsigned long nr_unstable; /* NFS unstable pages */ 95 unsigned long nr_unstable; /* NFS unstable pages */
87 unsigned long nr_page_table_pages;/* Pages used for pagetables */ 96 unsigned long nr_page_table_pages;/* Pages used for pagetables */
88 unsigned long nr_mapped; /* mapped into pagetables */ 97 unsigned long nr_mapped; /* mapped into pagetables.
98 * only modified from process context */
89 unsigned long nr_slab; /* In slab */ 99 unsigned long nr_slab; /* In slab */
90#define GET_PAGE_STATE_LAST nr_slab 100#define GET_PAGE_STATE_LAST nr_slab
91 101
@@ -97,32 +107,40 @@ struct page_state {
97 unsigned long pgpgout; /* Disk writes */ 107 unsigned long pgpgout; /* Disk writes */
98 unsigned long pswpin; /* swap reads */ 108 unsigned long pswpin; /* swap reads */
99 unsigned long pswpout; /* swap writes */ 109 unsigned long pswpout; /* swap writes */
100 unsigned long pgalloc_high; /* page allocations */
101 110
111 unsigned long pgalloc_high; /* page allocations */
102 unsigned long pgalloc_normal; 112 unsigned long pgalloc_normal;
113 unsigned long pgalloc_dma32;
103 unsigned long pgalloc_dma; 114 unsigned long pgalloc_dma;
115
104 unsigned long pgfree; /* page freeings */ 116 unsigned long pgfree; /* page freeings */
105 unsigned long pgactivate; /* pages moved inactive->active */ 117 unsigned long pgactivate; /* pages moved inactive->active */
106 unsigned long pgdeactivate; /* pages moved active->inactive */ 118 unsigned long pgdeactivate; /* pages moved active->inactive */
107 119
108 unsigned long pgfault; /* faults (major+minor) */ 120 unsigned long pgfault; /* faults (major+minor) */
109 unsigned long pgmajfault; /* faults (major only) */ 121 unsigned long pgmajfault; /* faults (major only) */
122
110 unsigned long pgrefill_high; /* inspected in refill_inactive_zone */ 123 unsigned long pgrefill_high; /* inspected in refill_inactive_zone */
111 unsigned long pgrefill_normal; 124 unsigned long pgrefill_normal;
125 unsigned long pgrefill_dma32;
112 unsigned long pgrefill_dma; 126 unsigned long pgrefill_dma;
113 127
114 unsigned long pgsteal_high; /* total highmem pages reclaimed */ 128 unsigned long pgsteal_high; /* total highmem pages reclaimed */
115 unsigned long pgsteal_normal; 129 unsigned long pgsteal_normal;
130 unsigned long pgsteal_dma32;
116 unsigned long pgsteal_dma; 131 unsigned long pgsteal_dma;
132
117 unsigned long pgscan_kswapd_high;/* total highmem pages scanned */ 133 unsigned long pgscan_kswapd_high;/* total highmem pages scanned */
118 unsigned long pgscan_kswapd_normal; 134 unsigned long pgscan_kswapd_normal;
119 135 unsigned long pgscan_kswapd_dma32;
120 unsigned long pgscan_kswapd_dma; 136 unsigned long pgscan_kswapd_dma;
137
121 unsigned long pgscan_direct_high;/* total highmem pages scanned */ 138 unsigned long pgscan_direct_high;/* total highmem pages scanned */
122 unsigned long pgscan_direct_normal; 139 unsigned long pgscan_direct_normal;
140 unsigned long pgscan_direct_dma32;
123 unsigned long pgscan_direct_dma; 141 unsigned long pgscan_direct_dma;
124 unsigned long pginodesteal; /* pages reclaimed via inode freeing */
125 142
143 unsigned long pginodesteal; /* pages reclaimed via inode freeing */
126 unsigned long slabs_scanned; /* slab objects scanned */ 144 unsigned long slabs_scanned; /* slab objects scanned */
127 unsigned long kswapd_steal; /* pages reclaimed by kswapd */ 145 unsigned long kswapd_steal; /* pages reclaimed by kswapd */
128 unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */ 146 unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */
@@ -136,31 +154,54 @@ struct page_state {
136extern void get_page_state(struct page_state *ret); 154extern void get_page_state(struct page_state *ret);
137extern void get_page_state_node(struct page_state *ret, int node); 155extern void get_page_state_node(struct page_state *ret, int node);
138extern void get_full_page_state(struct page_state *ret); 156extern void get_full_page_state(struct page_state *ret);
139extern unsigned long __read_page_state(unsigned long offset); 157extern unsigned long read_page_state_offset(unsigned long offset);
140extern void __mod_page_state(unsigned long offset, unsigned long delta); 158extern void mod_page_state_offset(unsigned long offset, unsigned long delta);
159extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
141 160
142#define read_page_state(member) \ 161#define read_page_state(member) \
143 __read_page_state(offsetof(struct page_state, member)) 162 read_page_state_offset(offsetof(struct page_state, member))
144 163
145#define mod_page_state(member, delta) \ 164#define mod_page_state(member, delta) \
146 __mod_page_state(offsetof(struct page_state, member), (delta)) 165 mod_page_state_offset(offsetof(struct page_state, member), (delta))
147 166
148#define inc_page_state(member) mod_page_state(member, 1UL) 167#define __mod_page_state(member, delta) \
149#define dec_page_state(member) mod_page_state(member, 0UL - 1) 168 __mod_page_state_offset(offsetof(struct page_state, member), (delta))
150#define add_page_state(member,delta) mod_page_state(member, (delta)) 169
151#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta)) 170#define inc_page_state(member) mod_page_state(member, 1UL)
152 171#define dec_page_state(member) mod_page_state(member, 0UL - 1)
153#define mod_page_state_zone(zone, member, delta) \ 172#define add_page_state(member,delta) mod_page_state(member, (delta))
154 do { \ 173#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
155 unsigned offset; \ 174
156 if (is_highmem(zone)) \ 175#define __inc_page_state(member) __mod_page_state(member, 1UL)
157 offset = offsetof(struct page_state, member##_high); \ 176#define __dec_page_state(member) __mod_page_state(member, 0UL - 1)
158 else if (is_normal(zone)) \ 177#define __add_page_state(member,delta) __mod_page_state(member, (delta))
159 offset = offsetof(struct page_state, member##_normal); \ 178#define __sub_page_state(member,delta) __mod_page_state(member, 0UL - (delta))
160 else \ 179
161 offset = offsetof(struct page_state, member##_dma); \ 180#define page_state(member) (*__page_state(offsetof(struct page_state, member)))
162 __mod_page_state(offset, (delta)); \ 181
163 } while (0) 182#define state_zone_offset(zone, member) \
183({ \
184 unsigned offset; \
185 if (is_highmem(zone)) \
186 offset = offsetof(struct page_state, member##_high); \
187 else if (is_normal(zone)) \
188 offset = offsetof(struct page_state, member##_normal); \
189 else if (is_dma32(zone)) \
190 offset = offsetof(struct page_state, member##_dma32); \
191 else \
192 offset = offsetof(struct page_state, member##_dma); \
193 offset; \
194})
195
196#define __mod_page_state_zone(zone, member, delta) \
197 do { \
198 __mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
199 } while (0)
200
201#define mod_page_state_zone(zone, member, delta) \
202 do { \
203 mod_page_state_offset(state_zone_offset(zone, member), (delta)); \
204 } while (0)
164 205
165/* 206/*
166 * Manipulation of page state flags 207 * Manipulation of page state flags
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index def32c5715be..8eb7fa76c1d0 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -5,6 +5,9 @@
5 * pages. A pagevec is a multipage container which is used for that. 5 * pages. A pagevec is a multipage container which is used for that.
6 */ 6 */
7 7
8#ifndef _LINUX_PAGEVEC_H
9#define _LINUX_PAGEVEC_H
10
8/* 14 pointers + two long's align the pagevec structure to a power of two */ 11/* 14 pointers + two long's align the pagevec structure to a power of two */
9#define PAGEVEC_SIZE 14 12#define PAGEVEC_SIZE 14
10 13
@@ -83,3 +86,5 @@ static inline void pagevec_lru_add(struct pagevec *pvec)
83 if (pagevec_count(pvec)) 86 if (pagevec_count(pvec))
84 __pagevec_lru_add(pvec); 87 __pagevec_lru_add(pvec);
85} 88}
89
90#endif /* _LINUX_PAGEVEC_H */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index d2a4d9e1e6d1..f67f838a3a1f 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -236,7 +236,8 @@ struct pardevice {
236 236
237/* IEEE1284 information */ 237/* IEEE1284 information */
238 238
239/* IEEE1284 phases */ 239/* IEEE1284 phases. These are exposed to userland through ppdev IOCTL
240 * PP[GS]ETPHASE, so do not change existing values. */
240enum ieee1284_phase { 241enum ieee1284_phase {
241 IEEE1284_PH_FWD_DATA, 242 IEEE1284_PH_FWD_DATA,
242 IEEE1284_PH_FWD_IDLE, 243 IEEE1284_PH_FWD_IDLE,
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index c6f762470879..1cc0f6b1a49a 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -79,13 +79,13 @@ static __inline__ unsigned char parport_pc_read_data(struct parport *p)
79} 79}
80 80
81#ifdef DEBUG_PARPORT 81#ifdef DEBUG_PARPORT
82extern __inline__ void dump_parport_state (char *str, struct parport *p) 82static inline void dump_parport_state (char *str, struct parport *p)
83{ 83{
84 /* here's hoping that reading these ports won't side-effect anything underneath */ 84 /* here's hoping that reading these ports won't side-effect anything underneath */
85 unsigned char ecr = inb (ECONTROL (p)); 85 unsigned char ecr = inb (ECONTROL (p));
86 unsigned char dcr = inb (CONTROL (p)); 86 unsigned char dcr = inb (CONTROL (p));
87 unsigned char dsr = inb (STATUS (p)); 87 unsigned char dsr = inb (STATUS (p));
88 static char *ecr_modes[] = {"SPP", "PS2", "PPFIFO", "ECP", "xXx", "yYy", "TST", "CFG"}; 88 static const char *const ecr_modes[] = {"SPP", "PS2", "PPFIFO", "ECP", "xXx", "yYy", "TST", "CFG"};
89 const struct parport_pc_private *priv = p->physport->private_data; 89 const struct parport_pc_private *priv = p->physport->private_data;
90 int i; 90 int i;
91 91
diff --git a/include/linux/pci.h b/include/linux/pci.h
index de690ca73d58..0a44072383ec 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -78,6 +78,23 @@ typedef int __bitwise pci_power_t;
78#define PCI_UNKNOWN ((pci_power_t __force) 5) 78#define PCI_UNKNOWN ((pci_power_t __force) 5)
79#define PCI_POWER_ERROR ((pci_power_t __force) -1) 79#define PCI_POWER_ERROR ((pci_power_t __force) -1)
80 80
81/** The pci_channel state describes connectivity between the CPU and
82 * the pci device. If some PCI bus between here and the pci device
83 * has crashed or locked up, this info is reflected here.
84 */
85typedef unsigned int __bitwise pci_channel_state_t;
86
87enum pci_channel_state {
88 /* I/O channel is in normal state */
89 pci_channel_io_normal = (__force pci_channel_state_t) 1,
90
91 /* I/O to channel is blocked */
92 pci_channel_io_frozen = (__force pci_channel_state_t) 2,
93
94 /* PCI card is dead */
95 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
96};
97
81/* 98/*
82 * The pci_dev structure is used to describe PCI devices. 99 * The pci_dev structure is used to describe PCI devices.
83 */ 100 */
@@ -98,6 +115,7 @@ struct pci_dev {
98 unsigned int class; /* 3 bytes: (base,sub,prog-if) */ 115 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
99 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 116 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
100 u8 rom_base_reg; /* which config register controls the ROM */ 117 u8 rom_base_reg; /* which config register controls the ROM */
118 u8 pin; /* which interrupt pin this device uses */
101 119
102 struct pci_driver *driver; /* which driver has allocated this device */ 120 struct pci_driver *driver; /* which driver has allocated this device */
103 u64 dma_mask; /* Mask of the bits of bus address this 121 u64 dma_mask; /* Mask of the bits of bus address this
@@ -110,6 +128,7 @@ struct pci_dev {
110 this is D0-D3, D0 being fully functional, 128 this is D0-D3, D0 being fully functional,
111 and D3 being off. */ 129 and D3 being off. */
112 130
131 pci_channel_state_t error_state; /* current connectivity state */
113 struct device dev; /* Generic device interface */ 132 struct device dev; /* Generic device interface */
114 133
115 /* device is compatible with these IDs */ 134 /* device is compatible with these IDs */
@@ -232,6 +251,54 @@ struct pci_dynids {
232 unsigned int use_driver_data:1; /* pci_driver->driver_data is used */ 251 unsigned int use_driver_data:1; /* pci_driver->driver_data is used */
233}; 252};
234 253
254/* ---------------------------------------------------------------- */
255/** PCI Error Recovery System (PCI-ERS). If a PCI device driver provides
256 * a set fof callbacks in struct pci_error_handlers, then that device driver
257 * will be notified of PCI bus errors, and will be driven to recovery
258 * when an error occurs.
259 */
260
261typedef unsigned int __bitwise pci_ers_result_t;
262
263enum pci_ers_result {
264 /* no result/none/not supported in device driver */
265 PCI_ERS_RESULT_NONE = (__force pci_ers_result_t) 1,
266
267 /* Device driver can recover without slot reset */
268 PCI_ERS_RESULT_CAN_RECOVER = (__force pci_ers_result_t) 2,
269
270 /* Device driver wants slot to be reset. */
271 PCI_ERS_RESULT_NEED_RESET = (__force pci_ers_result_t) 3,
272
273 /* Device has completely failed, is unrecoverable */
274 PCI_ERS_RESULT_DISCONNECT = (__force pci_ers_result_t) 4,
275
276 /* Device driver is fully recovered and operational */
277 PCI_ERS_RESULT_RECOVERED = (__force pci_ers_result_t) 5,
278};
279
280/* PCI bus error event callbacks */
281struct pci_error_handlers
282{
283 /* PCI bus error detected on this device */
284 pci_ers_result_t (*error_detected)(struct pci_dev *dev,
285 enum pci_channel_state error);
286
287 /* MMIO has been re-enabled, but not DMA */
288 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev);
289
290 /* PCI Express link has been reset */
291 pci_ers_result_t (*link_reset)(struct pci_dev *dev);
292
293 /* PCI slot has been reset */
294 pci_ers_result_t (*slot_reset)(struct pci_dev *dev);
295
296 /* Device driver may resume normal operations */
297 void (*resume)(struct pci_dev *dev);
298};
299
300/* ---------------------------------------------------------------- */
301
235struct module; 302struct module;
236struct pci_driver { 303struct pci_driver {
237 struct list_head node; 304 struct list_head node;
@@ -244,6 +311,7 @@ struct pci_driver {
244 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ 311 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */
245 void (*shutdown) (struct pci_dev *dev); 312 void (*shutdown) (struct pci_dev *dev);
246 313
314 struct pci_error_handlers *err_handler;
247 struct device_driver driver; 315 struct device_driver driver;
248 struct pci_dynids dynids; 316 struct pci_dynids dynids;
249}; 317};
@@ -448,6 +516,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
448 516
449void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 517void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
450 void *userdata); 518 void *userdata);
519int pci_cfg_space_size(struct pci_dev *dev);
451 520
452/* kmem_cache style wrapper around pci_alloc_consistent() */ 521/* kmem_cache style wrapper around pci_alloc_consistent() */
453 522
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 4db67b3b05cc..7fb397e3f2d3 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -15,6 +15,7 @@
15#define PCI_CLASS_STORAGE_FLOPPY 0x0102 15#define PCI_CLASS_STORAGE_FLOPPY 0x0102
16#define PCI_CLASS_STORAGE_IPI 0x0103 16#define PCI_CLASS_STORAGE_IPI 0x0103
17#define PCI_CLASS_STORAGE_RAID 0x0104 17#define PCI_CLASS_STORAGE_RAID 0x0104
18#define PCI_CLASS_STORAGE_SAS 0x0107
18#define PCI_CLASS_STORAGE_OTHER 0x0180 19#define PCI_CLASS_STORAGE_OTHER 0x0180
19 20
20#define PCI_BASE_CLASS_NETWORK 0x02 21#define PCI_BASE_CLASS_NETWORK 0x02
@@ -376,6 +377,11 @@
376#define PCI_DEVICE_ID_NS_87560_USB 0x0012 377#define PCI_DEVICE_ID_NS_87560_USB 0x0012
377#define PCI_DEVICE_ID_NS_83815 0x0020 378#define PCI_DEVICE_ID_NS_83815 0x0020
378#define PCI_DEVICE_ID_NS_83820 0x0022 379#define PCI_DEVICE_ID_NS_83820 0x0022
380#define PCI_DEVICE_ID_NS_CS5535_ISA 0x002b
381#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
382#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e
383#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f
384#define PCI_DEVICE_ID_NS_CS5535_VIDEO 0x0030
379#define PCI_DEVICE_ID_NS_SATURN 0x0035 385#define PCI_DEVICE_ID_NS_SATURN 0x0035
380#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 386#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500
381#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 387#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501
@@ -389,6 +395,13 @@
389#define PCI_DEVICE_ID_NS_87410 0xd001 395#define PCI_DEVICE_ID_NS_87410 0xd001
390#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d 396#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
391 397
398#define PCI_DEVICE_ID_NS_CS5535_HOST_BRIDGE 0x0028
399#define PCI_DEVICE_ID_NS_CS5535_ISA_BRIDGE 0x002b
400#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
401#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e
402#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f
403#define PCI_DEVICE_ID_NS_CS5535_VIDEO 0x0030
404
392#define PCI_VENDOR_ID_TSENG 0x100c 405#define PCI_VENDOR_ID_TSENG 0x100c
393#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 406#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202
394#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205 407#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205
@@ -488,9 +501,20 @@
488#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d 501#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d
489#define PCI_DEVICE_ID_AMD_8151_0 0x7454 502#define PCI_DEVICE_ID_AMD_8151_0 0x7454
490#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450 503#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450
504#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
505#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
506#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093
507#define PCI_DEVICE_ID_AMD_CS5536_OHC 0x2094
508#define PCI_DEVICE_ID_AMD_CS5536_EHC 0x2095
509#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096
510#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097
511#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
491 512
492#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 513#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
493 514
515#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081
516#define PCI_DEVICE_ID_AMD_LX_AES 0x2082
517
494#define PCI_VENDOR_ID_TRIDENT 0x1023 518#define PCI_VENDOR_ID_TRIDENT 0x1023
495#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 519#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
496#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 520#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001
@@ -971,6 +995,7 @@
971#define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a 995#define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a
972#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C 996#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C
973#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D 997#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D
998#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034
974#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 999#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035
975#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 1000#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036
976#define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037 1001#define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037
@@ -1025,6 +1050,11 @@
1025#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6 1050#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6
1026#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea 1051#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea
1027#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee 1052#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee
1053#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0
1054#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1 0x00f1
1055#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2
1056#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3
1057#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9
1028#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 1058#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100
1029#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 1059#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101
1030#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 1060#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103
@@ -1567,6 +1597,23 @@
1567#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009 1597#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009
1568#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A 1598#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A
1569#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B 1599#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B
1600#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ 0x000C
1601#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_PTM 0x000D
1602#define PCI_SUBDEVICE_ID_CONNECT_TECH_NT960PCI 0x0100
1603#define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2 0x0201
1604#define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4 0x0202
1605#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232 0x0300
1606#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232 0x0301
1607#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232 0x0302
1608#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1 0x0310
1609#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2 0x0311
1610#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4 0x0312
1611#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2 0x0320
1612#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4 0x0321
1613#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8 0x0322
1614#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485 0x0330
1615#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485 0x0331
1616#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485 0x0332
1570 1617
1571 1618
1572#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 1619#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2
@@ -2105,6 +2152,9 @@
2105#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 2152#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004
2106#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 2153#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
2107 2154
2155#define PCI_VENDOR_ID_SCALEMP 0x8686
2156#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
2157
2108#define PCI_VENDOR_ID_COMPUTONE 0x8e0e 2158#define PCI_VENDOR_ID_COMPUTONE 0x8e0e
2109#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 2159#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291
2110#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 2160#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index e2a089b051ed..d27a78b71297 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -196,6 +196,7 @@
196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ 196#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 197#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 198#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
199#define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */
199#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 200#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
200#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 201#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
201#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ 202#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index fb8d2d24e4bb..cb9039a21f2a 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -19,7 +19,6 @@
19 19
20struct percpu_data { 20struct percpu_data {
21 void *ptrs[NR_CPUS]; 21 void *ptrs[NR_CPUS];
22 void *blkp;
23}; 22};
24 23
25/* 24/*
@@ -33,14 +32,14 @@ struct percpu_data {
33 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 32 (__typeof__(ptr))__p->ptrs[(cpu)]; \
34}) 33})
35 34
36extern void *__alloc_percpu(size_t size, size_t align); 35extern void *__alloc_percpu(size_t size);
37extern void free_percpu(const void *); 36extern void free_percpu(const void *);
38 37
39#else /* CONFIG_SMP */ 38#else /* CONFIG_SMP */
40 39
41#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 40#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
42 41
43static inline void *__alloc_percpu(size_t size, size_t align) 42static inline void *__alloc_percpu(size_t size)
44{ 43{
45 void *ret = kmalloc(size, GFP_KERNEL); 44 void *ret = kmalloc(size, GFP_KERNEL);
46 if (ret) 45 if (ret)
@@ -55,7 +54,6 @@ static inline void free_percpu(const void *ptr)
55#endif /* CONFIG_SMP */ 54#endif /* CONFIG_SMP */
56 55
57/* Simple wrapper for the common case: zeros memory. */ 56/* Simple wrapper for the common case: zeros memory. */
58#define alloc_percpu(type) \ 57#define alloc_percpu(type) ((type *)(__alloc_percpu(sizeof(type))))
59 ((type *)(__alloc_percpu(sizeof(type), __alignof__(type))))
60 58
61#endif /* __LINUX_PERCPU_H */ 59#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 724066778aff..6351c4055ace 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -216,6 +216,16 @@ struct sadb_x_nat_t_port {
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 */
220struct sadb_x_sec_ctx {
221 uint16_t sadb_x_sec_len;
222 uint16_t sadb_x_sec_exttype;
223 uint8_t sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */
224 uint8_t sadb_x_ctx_doi;
225 uint16_t sadb_x_ctx_len;
226} __attribute__((packed));
227/* sizeof(struct sadb_sec_ctx) = 8 */
228
219/* Message types */ 229/* Message types */
220#define SADB_RESERVED 0 230#define SADB_RESERVED 0
221#define SADB_GETSPI 1 231#define SADB_GETSPI 1
@@ -325,7 +335,8 @@ struct sadb_x_nat_t_port {
325#define SADB_X_EXT_NAT_T_SPORT 21 335#define SADB_X_EXT_NAT_T_SPORT 21
326#define SADB_X_EXT_NAT_T_DPORT 22 336#define SADB_X_EXT_NAT_T_DPORT 22
327#define SADB_X_EXT_NAT_T_OA 23 337#define SADB_X_EXT_NAT_T_OA 23
328#define SADB_EXT_MAX 23 338#define SADB_X_EXT_SEC_CTX 24
339#define SADB_EXT_MAX 24
329 340
330/* Identity Extension values */ 341/* Identity Extension values */
331#define SADB_IDENTTYPE_RESERVED 0 342#define SADB_IDENTTYPE_RESERVED 0
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 1767073df26f..b12e59c75752 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -37,7 +37,7 @@ struct pipe_inode_info {
37 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */ 37 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
38#define PIPE_SIZE PAGE_SIZE 38#define PIPE_SIZE PAGE_SIZE
39 39
40#define PIPE_SEM(inode) (&(inode).i_sem) 40#define PIPE_MUTEX(inode) (&(inode).i_mutex)
41#define PIPE_WAIT(inode) (&(inode).i_pipe->wait) 41#define PIPE_WAIT(inode) (&(inode).i_pipe->wait)
42#define PIPE_READERS(inode) ((inode).i_pipe->readers) 42#define PIPE_READERS(inode) ((inode).i_pipe->readers)
43#define PIPE_WRITERS(inode) ((inode).i_pipe->writers) 43#define PIPE_WRITERS(inode) ((inode).i_pipe->writers)
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index e87b233615b3..d10f35338507 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -429,6 +429,7 @@ enum
429 TCA_NETEM_CORR, 429 TCA_NETEM_CORR,
430 TCA_NETEM_DELAY_DIST, 430 TCA_NETEM_DELAY_DIST,
431 TCA_NETEM_REORDER, 431 TCA_NETEM_REORDER,
432 TCA_NETEM_CORRUPT,
432 __TCA_NETEM_MAX, 433 __TCA_NETEM_MAX,
433}; 434};
434 435
@@ -457,6 +458,12 @@ struct tc_netem_reorder
457 __u32 correlation; 458 __u32 correlation;
458}; 459};
459 460
461struct tc_netem_corrupt
462{
463 __u32 probability;
464 __u32 correlation;
465};
466
460#define NETEM_DIST_SCALE 8192 467#define NETEM_DIST_SCALE 8192
461 468
462#endif 469#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 17e336f40b47..782090c68932 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -41,6 +41,7 @@ extern struct platform_device *platform_device_alloc(const char *name, unsigned
41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
42extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size); 42extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size);
43extern int platform_device_add(struct platform_device *pdev); 43extern int platform_device_add(struct platform_device *pdev);
44extern void platform_device_del(struct platform_device *pdev);
44extern void platform_device_put(struct platform_device *pdev); 45extern void platform_device_put(struct platform_device *pdev);
45 46
46struct platform_driver { 47struct platform_driver {
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index 373bd3b9b330..217d3daf7336 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -140,7 +140,7 @@ extern int find_via_pmu(void);
140 140
141extern int pmu_request(struct adb_request *req, 141extern int pmu_request(struct adb_request *req,
142 void (*done)(struct adb_request *), int nbytes, ...); 142 void (*done)(struct adb_request *), int nbytes, ...);
143 143extern int pmu_queue_request(struct adb_request *req);
144extern void pmu_poll(void); 144extern void pmu_poll(void);
145extern void pmu_poll_adb(void); /* For use by xmon */ 145extern void pmu_poll_adb(void); /* For use by xmon */
146extern void pmu_wait_complete(struct adb_request *req); 146extern void pmu_wait_complete(struct adb_request *req);
@@ -160,12 +160,6 @@ extern void pmu_unlock(void);
160extern int pmu_present(void); 160extern int pmu_present(void);
161extern int pmu_get_model(void); 161extern int pmu_get_model(void);
162 162
163extern int pmu_i2c_combined_read(int bus, int addr, int subaddr, u8* data, int len);
164extern int pmu_i2c_stdsub_write(int bus, int addr, int subaddr, u8* data, int len);
165extern int pmu_i2c_simple_read(int bus, int addr, u8* data, int len);
166extern int pmu_i2c_simple_write(int bus, int addr, u8* data, int len);
167
168
169#ifdef CONFIG_PM 163#ifdef CONFIG_PM
170/* 164/*
171 * Stuff for putting the powerbook to sleep and waking it again. 165 * Stuff for putting the powerbook to sleep and waking it again.
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 584d57cb393a..93b0959eb40f 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -162,6 +162,7 @@ struct pnp_card_link {
162 struct pnp_card * card; 162 struct pnp_card * card;
163 struct pnp_card_driver * driver; 163 struct pnp_card_driver * driver;
164 void * driver_data; 164 void * driver_data;
165 pm_message_t pm_state;
165}; 166};
166 167
167static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard) 168static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard)
@@ -294,6 +295,8 @@ struct pnp_driver {
294 unsigned int flags; 295 unsigned int flags;
295 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id); 296 int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
296 void (*remove) (struct pnp_dev *dev); 297 void (*remove) (struct pnp_dev *dev);
298 int (*suspend) (struct pnp_dev *dev, pm_message_t state);
299 int (*resume) (struct pnp_dev *dev);
297 struct device_driver driver; 300 struct device_driver driver;
298}; 301};
299 302
@@ -306,6 +309,8 @@ struct pnp_card_driver {
306 unsigned int flags; 309 unsigned int flags;
307 int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id); 310 int (*probe) (struct pnp_card_link *card, const struct pnp_card_device_id *card_id);
308 void (*remove) (struct pnp_card_link *card); 311 void (*remove) (struct pnp_card_link *card);
312 int (*suspend) (struct pnp_card_link *card, pm_message_t state);
313 int (*resume) (struct pnp_card_link *card);
309 struct pnp_driver link; 314 struct pnp_driver link;
310}; 315};
311 316
@@ -380,6 +385,8 @@ void pnp_init_resource_table(struct pnp_resource_table *table);
380int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode); 385int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode);
381int pnp_auto_config_dev(struct pnp_dev *dev); 386int pnp_auto_config_dev(struct pnp_dev *dev);
382int pnp_validate_config(struct pnp_dev *dev); 387int pnp_validate_config(struct pnp_dev *dev);
388int pnp_start_dev(struct pnp_dev *dev);
389int pnp_stop_dev(struct pnp_dev *dev);
383int pnp_activate_dev(struct pnp_dev *dev); 390int pnp_activate_dev(struct pnp_dev *dev);
384int pnp_disable_dev(struct pnp_dev *dev); 391int pnp_disable_dev(struct pnp_dev *dev);
385void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size); 392void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size);
@@ -423,6 +430,8 @@ static inline void pnp_init_resource_table(struct pnp_resource_table *table) { }
423static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; } 430static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; }
424static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } 431static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; }
425static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; } 432static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; }
433static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
434static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
426static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 435static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
427static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 436static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
428static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { } 437static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { }
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index f942e2bad8e3..54faf5236da0 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -42,7 +42,7 @@ struct k_itimer {
42 timer_t it_id; /* timer id */ 42 timer_t it_id; /* timer id */
43 int it_overrun; /* overrun on pending signal */ 43 int it_overrun; /* overrun on pending signal */
44 int it_overrun_last; /* overrun on last delivered signal */ 44 int it_overrun_last; /* overrun on last delivered signal */
45 int it_requeue_pending; /* waiting to requeue this timer */ 45 int it_requeue_pending; /* waiting to requeue this timer */
46#define REQUEUE_PENDING 1 46#define REQUEUE_PENDING 1
47 int it_sigev_notify; /* notify word of sigevent struct */ 47 int it_sigev_notify; /* notify word of sigevent struct */
48 int it_sigev_signo; /* signo word of sigevent struct */ 48 int it_sigev_signo; /* signo word of sigevent struct */
@@ -51,10 +51,8 @@ struct k_itimer {
51 struct sigqueue *sigq; /* signal queue entry. */ 51 struct sigqueue *sigq; /* signal queue entry. */
52 union { 52 union {
53 struct { 53 struct {
54 struct timer_list timer; 54 struct hrtimer timer;
55 struct list_head abs_timer_entry; /* clock abs_timer_list */ 55 ktime_t interval;
56 struct timespec wall_to_prev; /* wall_to_monotonic used when set */
57 unsigned long incr; /* interval in jiffies */
58 } real; 56 } real;
59 struct cpu_timer_list cpu; 57 struct cpu_timer_list cpu;
60 struct { 58 struct {
@@ -66,18 +64,14 @@ struct k_itimer {
66 } it; 64 } it;
67}; 65};
68 66
69struct k_clock_abs {
70 struct list_head list;
71 spinlock_t lock;
72};
73struct k_clock { 67struct k_clock {
74 int res; /* in nano seconds */ 68 int res; /* in nanoseconds */
75 int (*clock_getres) (clockid_t which_clock, struct timespec *tp); 69 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
76 struct k_clock_abs *abs_struct; 70 int (*clock_set) (const clockid_t which_clock, struct timespec * tp);
77 int (*clock_set) (clockid_t which_clock, struct timespec * tp); 71 int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
78 int (*clock_get) (clockid_t which_clock, struct timespec * tp);
79 int (*timer_create) (struct k_itimer *timer); 72 int (*timer_create) (struct k_itimer *timer);
80 int (*nsleep) (clockid_t which_clock, int flags, struct timespec *); 73 int (*nsleep) (const clockid_t which_clock, int flags,
74 struct timespec *, struct timespec __user *);
81 int (*timer_set) (struct k_itimer * timr, int flags, 75 int (*timer_set) (struct k_itimer * timr, int flags,
82 struct itimerspec * new_setting, 76 struct itimerspec * new_setting,
83 struct itimerspec * old_setting); 77 struct itimerspec * old_setting);
@@ -87,53 +81,35 @@ struct k_clock {
87 struct itimerspec * cur_setting); 81 struct itimerspec * cur_setting);
88}; 82};
89 83
90void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock); 84void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock);
91 85
92/* Error handlers for timer_create, nanosleep and settime */ 86/* error handlers for timer_create, nanosleep and settime */
93int do_posix_clock_notimer_create(struct k_itimer *timer); 87int do_posix_clock_notimer_create(struct k_itimer *timer);
94int do_posix_clock_nonanosleep(clockid_t, int flags, struct timespec *); 88int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *,
95int do_posix_clock_nosettime(clockid_t, struct timespec *tp); 89 struct timespec __user *);
90int do_posix_clock_nosettime(const clockid_t, struct timespec *tp);
96 91
97/* function to call to trigger timer event */ 92/* function to call to trigger timer event */
98int posix_timer_event(struct k_itimer *timr, int si_private); 93int posix_timer_event(struct k_itimer *timr, int si_private);
99 94
100struct now_struct { 95int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *ts);
101 unsigned long jiffies; 96int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *ts);
102}; 97int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts);
103 98int posix_cpu_timer_create(struct k_itimer *timer);
104#define posix_get_now(now) (now)->jiffies = jiffies; 99int posix_cpu_nsleep(const clockid_t which_clock, int flags,
105#define posix_time_before(timer, now) \ 100 struct timespec *rqtp, struct timespec __user *rmtp);
106 time_before((timer)->expires, (now)->jiffies) 101int posix_cpu_timer_set(struct k_itimer *timer, int flags,
107 102 struct itimerspec *new, struct itimerspec *old);
108#define posix_bump_timer(timr, now) \ 103int posix_cpu_timer_del(struct k_itimer *timer);
109 do { \ 104void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp);
110 long delta, orun; \ 105
111 delta = now.jiffies - (timr)->it.real.timer.expires; \ 106void posix_cpu_timer_schedule(struct k_itimer *timer);
112 if (delta >= 0) { \ 107
113 orun = 1 + (delta / (timr)->it.real.incr); \ 108void run_posix_cpu_timers(struct task_struct *task);
114 (timr)->it.real.timer.expires += \ 109void posix_cpu_timers_exit(struct task_struct *task);
115 orun * (timr)->it.real.incr; \ 110void posix_cpu_timers_exit_group(struct task_struct *task);
116 (timr)->it_overrun += orun; \ 111
117 } \ 112void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
118 }while (0) 113 cputime_t *newval, cputime_t *oldval);
119
120int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *);
121int posix_cpu_clock_get(clockid_t which_clock, struct timespec *);
122int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp);
123int posix_cpu_timer_create(struct k_itimer *);
124int posix_cpu_nsleep(clockid_t, int, struct timespec *);
125int posix_cpu_timer_set(struct k_itimer *, int,
126 struct itimerspec *, struct itimerspec *);
127int posix_cpu_timer_del(struct k_itimer *);
128void posix_cpu_timer_get(struct k_itimer *, struct itimerspec *);
129
130void posix_cpu_timer_schedule(struct k_itimer *);
131
132void run_posix_cpu_timers(struct task_struct *);
133void posix_cpu_timers_exit(struct task_struct *);
134void posix_cpu_timers_exit_group(struct task_struct *);
135
136void set_process_cpu_timer(struct task_struct *, unsigned int,
137 cputime_t *, cputime_t *);
138 114
139#endif 115#endif
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index b2b3dba1298d..9d5cd106b344 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -20,8 +20,6 @@
20#define PTRACE_DETACH 0x11 20#define PTRACE_DETACH 0x11
21 21
22#define PTRACE_SYSCALL 24 22#define PTRACE_SYSCALL 24
23#define PTRACE_SYSEMU 31
24#define PTRACE_SYSEMU_SINGLESTEP 32
25 23
26/* 0x4200-0x4300 are reserved for architecture-independent additions. */ 24/* 0x4200-0x4300 are reserved for architecture-independent additions. */
27#define PTRACE_SETOPTIONS 0x4200 25#define PTRACE_SETOPTIONS 0x4200
@@ -80,6 +78,8 @@
80 78
81 79
82extern long arch_ptrace(struct task_struct *child, long request, long addr, long data); 80extern long arch_ptrace(struct task_struct *child, long request, long addr, long data);
81extern struct task_struct *ptrace_get_task_struct(pid_t pid);
82extern int ptrace_traceme(void);
83extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 83extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
84extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 84extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
85extern int ptrace_attach(struct task_struct *tsk); 85extern int ptrace_attach(struct task_struct *tsk);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 36e5d269612f..c57ff2fcb30a 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -19,6 +19,7 @@
19#ifndef _LINUX_RADIX_TREE_H 19#ifndef _LINUX_RADIX_TREE_H
20#define _LINUX_RADIX_TREE_H 20#define _LINUX_RADIX_TREE_H
21 21
22#include <linux/sched.h>
22#include <linux/preempt.h> 23#include <linux/preempt.h>
23#include <linux/types.h> 24#include <linux/types.h>
24 25
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 13e7c4b62367..b6e0bcad84e1 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -71,8 +71,8 @@
71 */ 71 */
72#define MD_PATCHLEVEL_VERSION 3 72#define MD_PATCHLEVEL_VERSION 3
73 73
74extern int register_md_personality (int p_num, mdk_personality_t *p); 74extern int register_md_personality (struct mdk_personality *p);
75extern int unregister_md_personality (int p_num); 75extern int unregister_md_personality (struct mdk_personality *p);
76extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev), 76extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev),
77 mddev_t *mddev, const char *name); 77 mddev_t *mddev, const char *name);
78extern void md_unregister_thread (mdk_thread_t *thread); 78extern void md_unregister_thread (mdk_thread_t *thread);
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 46629a275ba9..617b9506c760 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -18,62 +18,19 @@
18/* and dm-bio-list.h is not under include/linux because.... ??? */ 18/* and dm-bio-list.h is not under include/linux because.... ??? */
19#include "../../../drivers/md/dm-bio-list.h" 19#include "../../../drivers/md/dm-bio-list.h"
20 20
21#define MD_RESERVED 0UL
22#define LINEAR 1UL
23#define RAID0 2UL
24#define RAID1 3UL
25#define RAID5 4UL
26#define TRANSLUCENT 5UL
27#define HSM 6UL
28#define MULTIPATH 7UL
29#define RAID6 8UL
30#define RAID10 9UL
31#define FAULTY 10UL
32#define MAX_PERSONALITY 11UL
33
34#define LEVEL_MULTIPATH (-4) 21#define LEVEL_MULTIPATH (-4)
35#define LEVEL_LINEAR (-1) 22#define LEVEL_LINEAR (-1)
36#define LEVEL_FAULTY (-5) 23#define LEVEL_FAULTY (-5)
37 24
25/* we need a value for 'no level specified' and 0
26 * means 'raid0', so we need something else. This is
27 * for internal use only
28 */
29#define LEVEL_NONE (-1000000)
30
38#define MaxSector (~(sector_t)0) 31#define MaxSector (~(sector_t)0)
39#define MD_THREAD_NAME_MAX 14 32#define MD_THREAD_NAME_MAX 14
40 33
41static inline int pers_to_level (int pers)
42{
43 switch (pers) {
44 case FAULTY: return LEVEL_FAULTY;
45 case MULTIPATH: return LEVEL_MULTIPATH;
46 case HSM: return -3;
47 case TRANSLUCENT: return -2;
48 case LINEAR: return LEVEL_LINEAR;
49 case RAID0: return 0;
50 case RAID1: return 1;
51 case RAID5: return 5;
52 case RAID6: return 6;
53 case RAID10: return 10;
54 }
55 BUG();
56 return MD_RESERVED;
57}
58
59static inline int level_to_pers (int level)
60{
61 switch (level) {
62 case LEVEL_FAULTY: return FAULTY;
63 case LEVEL_MULTIPATH: return MULTIPATH;
64 case -3: return HSM;
65 case -2: return TRANSLUCENT;
66 case LEVEL_LINEAR: return LINEAR;
67 case 0: return RAID0;
68 case 1: return RAID1;
69 case 4:
70 case 5: return RAID5;
71 case 6: return RAID6;
72 case 10: return RAID10;
73 }
74 return MD_RESERVED;
75}
76
77typedef struct mddev_s mddev_t; 34typedef struct mddev_s mddev_t;
78typedef struct mdk_rdev_s mdk_rdev_t; 35typedef struct mdk_rdev_s mdk_rdev_t;
79 36
@@ -138,14 +95,16 @@ struct mdk_rdev_s
138 atomic_t read_errors; /* number of consecutive read errors that 95 atomic_t read_errors; /* number of consecutive read errors that
139 * we have tried to ignore. 96 * we have tried to ignore.
140 */ 97 */
98 atomic_t corrected_errors; /* number of corrected read errors,
99 * for reporting to userspace and storing
100 * in superblock.
101 */
141}; 102};
142 103
143typedef struct mdk_personality_s mdk_personality_t;
144
145struct mddev_s 104struct mddev_s
146{ 105{
147 void *private; 106 void *private;
148 mdk_personality_t *pers; 107 struct mdk_personality *pers;
149 dev_t unit; 108 dev_t unit;
150 int md_minor; 109 int md_minor;
151 struct list_head disks; 110 struct list_head disks;
@@ -164,6 +123,7 @@ struct mddev_s
164 int chunk_size; 123 int chunk_size;
165 time_t ctime, utime; 124 time_t ctime, utime;
166 int level, layout; 125 int level, layout;
126 char clevel[16];
167 int raid_disks; 127 int raid_disks;
168 int max_disks; 128 int max_disks;
169 sector_t size; /* used size of component devices */ 129 sector_t size; /* used size of component devices */
@@ -183,6 +143,11 @@ struct mddev_s
183 sector_t resync_mismatches; /* count of sectors where 143 sector_t resync_mismatches; /* count of sectors where
184 * parity/replica mismatch found 144 * parity/replica mismatch found
185 */ 145 */
146 /* if zero, use the system-wide default */
147 int sync_speed_min;
148 int sync_speed_max;
149
150 int ok_start_degraded;
186 /* recovery/resync flags 151 /* recovery/resync flags
187 * NEEDED: we might need to start a resync/recover 152 * NEEDED: we might need to start a resync/recover
188 * RUNNING: a thread is running, or about to be started 153 * RUNNING: a thread is running, or about to be started
@@ -265,9 +230,11 @@ static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sect
265 atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io); 230 atomic_add(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
266} 231}
267 232
268struct mdk_personality_s 233struct mdk_personality
269{ 234{
270 char *name; 235 char *name;
236 int level;
237 struct list_head list;
271 struct module *owner; 238 struct module *owner;
272 int (*make_request)(request_queue_t *q, struct bio *bio); 239 int (*make_request)(request_queue_t *q, struct bio *bio);
273 int (*run)(mddev_t *mddev); 240 int (*run)(mddev_t *mddev);
@@ -305,8 +272,6 @@ static inline char * mdname (mddev_t * mddev)
305 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; 272 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
306} 273}
307 274
308extern mdk_rdev_t * find_rdev_nr(mddev_t *mddev, int nr);
309
310/* 275/*
311 * iterates through some rdev ringlist. It's safe to remove the 276 * iterates through some rdev ringlist. It's safe to remove the
312 * current 'rdev'. Dont touch 'tmp' though. 277 * current 'rdev'. Dont touch 'tmp' though.
@@ -366,5 +331,10 @@ do { \
366 __wait_event_lock_irq(wq, condition, lock, cmd); \ 331 __wait_event_lock_irq(wq, condition, lock, cmd); \
367} while (0) 332} while (0)
368 333
334static inline void safe_put_page(struct page *p)
335{
336 if (p) put_page(p);
337}
338
369#endif 339#endif
370 340
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 292b98f2b408..9d5494aaac0f 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -45,6 +45,8 @@ struct r1_private_data_s {
45 45
46 spinlock_t resync_lock; 46 spinlock_t resync_lock;
47 int nr_pending; 47 int nr_pending;
48 int nr_waiting;
49 int nr_queued;
48 int barrier; 50 int barrier;
49 sector_t next_resync; 51 sector_t next_resync;
50 int fullsync; /* set to 1 if a full sync is needed, 52 int fullsync; /* set to 1 if a full sync is needed,
@@ -52,11 +54,12 @@ struct r1_private_data_s {
52 * Cleared when a sync completes. 54 * Cleared when a sync completes.
53 */ 55 */
54 56
55 wait_queue_head_t wait_idle; 57 wait_queue_head_t wait_barrier;
56 wait_queue_head_t wait_resume;
57 58
58 struct pool_info *poolinfo; 59 struct pool_info *poolinfo;
59 60
61 struct page *tmppage;
62
60 mempool_t *r1bio_pool; 63 mempool_t *r1bio_pool;
61 mempool_t *r1buf_pool; 64 mempool_t *r1buf_pool;
62}; 65};
@@ -106,6 +109,13 @@ struct r1bio_s {
106 /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/ 109 /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/
107}; 110};
108 111
112/* when we get a read error on a read-only array, we redirect to another
113 * device without failing the first device, or trying to over-write to
114 * correct the read error. To keep track of bad blocks on a per-bio
115 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
116 */
117#define IO_BLOCKED ((struct bio*)1)
118
109/* bits for r1bio.state */ 119/* bits for r1bio.state */
110#define R1BIO_Uptodate 0 120#define R1BIO_Uptodate 0
111#define R1BIO_IsSync 1 121#define R1BIO_IsSync 1
diff --git a/include/linux/raid/raid10.h b/include/linux/raid/raid10.h
index 60708789c8f9..b1103298a8c2 100644
--- a/include/linux/raid/raid10.h
+++ b/include/linux/raid/raid10.h
@@ -35,18 +35,26 @@ struct r10_private_data_s {
35 sector_t chunk_mask; 35 sector_t chunk_mask;
36 36
37 struct list_head retry_list; 37 struct list_head retry_list;
38 /* for use when syncing mirrors: */ 38 /* queue pending writes and submit them on unplug */
39 struct bio_list pending_bio_list;
40
39 41
40 spinlock_t resync_lock; 42 spinlock_t resync_lock;
41 int nr_pending; 43 int nr_pending;
44 int nr_waiting;
45 int nr_queued;
42 int barrier; 46 int barrier;
43 sector_t next_resync; 47 sector_t next_resync;
48 int fullsync; /* set to 1 if a full sync is needed,
49 * (fresh device added).
50 * Cleared when a sync completes.
51 */
44 52
45 wait_queue_head_t wait_idle; 53 wait_queue_head_t wait_barrier;
46 wait_queue_head_t wait_resume;
47 54
48 mempool_t *r10bio_pool; 55 mempool_t *r10bio_pool;
49 mempool_t *r10buf_pool; 56 mempool_t *r10buf_pool;
57 struct page *tmppage;
50}; 58};
51 59
52typedef struct r10_private_data_s conf_t; 60typedef struct r10_private_data_s conf_t;
@@ -96,8 +104,16 @@ struct r10bio_s {
96 } devs[0]; 104 } devs[0];
97}; 105};
98 106
107/* when we get a read error on a read-only array, we redirect to another
108 * device without failing the first device, or trying to over-write to
109 * correct the read error. To keep track of bad blocks on a per-bio
110 * level, we store IO_BLOCKED in the appropriate 'bios' pointer
111 */
112#define IO_BLOCKED ((struct bio*)1)
113
99/* bits for r10bio.state */ 114/* bits for r10bio.state */
100#define R10BIO_Uptodate 0 115#define R10BIO_Uptodate 0
101#define R10BIO_IsSync 1 116#define R10BIO_IsSync 1
102#define R10BIO_IsRecover 2 117#define R10BIO_IsRecover 2
118#define R10BIO_Degraded 3
103#endif 119#endif
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index f025ba6fb14c..394da8207b34 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -126,7 +126,7 @@
126 */ 126 */
127 127
128struct stripe_head { 128struct stripe_head {
129 struct stripe_head *hash_next, **hash_pprev; /* hash pointers */ 129 struct hlist_node hash;
130 struct list_head lru; /* inactive_list or handle_list */ 130 struct list_head lru; /* inactive_list or handle_list */
131 struct raid5_private_data *raid_conf; 131 struct raid5_private_data *raid_conf;
132 sector_t sector; /* sector of this row */ 132 sector_t sector; /* sector of this row */
@@ -152,7 +152,6 @@ struct stripe_head {
152#define R5_Insync 3 /* rdev && rdev->in_sync at start */ 152#define R5_Insync 3 /* rdev && rdev->in_sync at start */
153#define R5_Wantread 4 /* want to schedule a read */ 153#define R5_Wantread 4 /* want to schedule a read */
154#define R5_Wantwrite 5 154#define R5_Wantwrite 5
155#define R5_Syncio 6 /* this io need to be accounted as resync io */
156#define R5_Overlap 7 /* There is a pending overlapping request on this block */ 155#define R5_Overlap 7 /* There is a pending overlapping request on this block */
157#define R5_ReadError 8 /* seen a read error here recently */ 156#define R5_ReadError 8 /* seen a read error here recently */
158#define R5_ReWrite 9 /* have tried to over-write the readerror */ 157#define R5_ReWrite 9 /* have tried to over-write the readerror */
@@ -205,7 +204,7 @@ struct disk_info {
205}; 204};
206 205
207struct raid5_private_data { 206struct raid5_private_data {
208 struct stripe_head **stripe_hashtbl; 207 struct hlist_head *stripe_hashtbl;
209 mddev_t *mddev; 208 mddev_t *mddev;
210 struct disk_info *spare; 209 struct disk_info *spare;
211 int chunk_size, level, algorithm; 210 int chunk_size, level, algorithm;
@@ -228,6 +227,8 @@ struct raid5_private_data {
228 * Cleared when a sync completes. 227 * Cleared when a sync completes.
229 */ 228 */
230 229
230 struct page *spare_page; /* Used when checking P/Q in raid6 */
231
231 /* 232 /*
232 * Free stripes pool 233 * Free stripes pool
233 */ 234 */
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index e0a4faa9610c..953b6df5d037 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -5,6 +5,16 @@ struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev);
5struct super_block *ramfs_get_sb(struct file_system_type *fs_type, 5struct super_block *ramfs_get_sb(struct file_system_type *fs_type,
6 int flags, const char *dev_name, void *data); 6 int flags, const char *dev_name, void *data);
7 7
8#ifndef CONFIG_MMU
9extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
10 unsigned long addr,
11 unsigned long len,
12 unsigned long pgoff,
13 unsigned long flags);
14
15extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
16#endif
17
8extern struct file_operations ramfs_file_operations; 18extern struct file_operations ramfs_file_operations;
9extern struct vm_operations_struct generic_file_vm_ops; 19extern struct vm_operations_struct generic_file_vm_ops;
10 20
diff --git a/include/linux/random.h b/include/linux/random.h
index 7b2adb3322d5..5d6456bcdeba 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -52,9 +52,9 @@ extern void get_random_bytes(void *buf, int nbytes);
52void generate_random_uuid(unsigned char uuid_out[16]); 52void generate_random_uuid(unsigned char uuid_out[16]);
53 53
54extern __u32 secure_ip_id(__u32 daddr); 54extern __u32 secure_ip_id(__u32 daddr);
55extern u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport); 55extern u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport);
56extern u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, 56extern u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr,
57 __u16 dport); 57 __u16 dport);
58extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, 58extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr,
59 __u16 sport, __u16 dport); 59 __u16 sport, __u16 dport);
60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, 60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr,
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index a471f3bb713e..981f9aa43353 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -65,7 +65,11 @@ struct rcu_ctrlblk {
65 long cur; /* Current batch number. */ 65 long cur; /* Current batch number. */
66 long completed; /* Number of the last completed batch */ 66 long completed; /* Number of the last completed batch */
67 int next_pending; /* Is the next batch already waiting? */ 67 int next_pending; /* Is the next batch already waiting? */
68} ____cacheline_maxaligned_in_smp; 68
69 spinlock_t lock ____cacheline_internodealigned_in_smp;
70 cpumask_t cpumask; /* CPUs that need to switch in order */
71 /* for current batch to proceed. */
72} ____cacheline_internodealigned_in_smp;
69 73
70/* Is batch a before batch b ? */ 74/* Is batch a before batch b ? */
71static inline int rcu_batch_before(long a, long b) 75static inline int rcu_batch_before(long a, long b)
@@ -125,36 +129,7 @@ static inline void rcu_bh_qsctr_inc(int cpu)
125 rdp->passed_quiesc = 1; 129 rdp->passed_quiesc = 1;
126} 130}
127 131
128static inline int __rcu_pending(struct rcu_ctrlblk *rcp, 132extern int rcu_pending(int cpu);
129 struct rcu_data *rdp)
130{
131 /* This cpu has pending rcu entries and the grace period
132 * for them has completed.
133 */
134 if (rdp->curlist && !rcu_batch_before(rcp->completed, rdp->batch))
135 return 1;
136
137 /* This cpu has no pending entries, but there are new entries */
138 if (!rdp->curlist && rdp->nxtlist)
139 return 1;
140
141 /* This cpu has finished callbacks to invoke */
142 if (rdp->donelist)
143 return 1;
144
145 /* The rcu core waits for a quiescent state from the cpu */
146 if (rdp->quiescbatch != rcp->cur || rdp->qs_pending)
147 return 1;
148
149 /* nothing to do */
150 return 0;
151}
152
153static inline int rcu_pending(int cpu)
154{
155 return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) ||
156 __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu));
157}
158 133
159/** 134/**
160 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 135 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
diff --git a/include/linux/rcuref.h b/include/linux/rcuref.h
deleted file mode 100644
index e1adbba14b67..000000000000
--- a/include/linux/rcuref.h
+++ /dev/null
@@ -1,220 +0,0 @@
1/*
2 * rcuref.h
3 *
4 * Reference counting for elements of lists/arrays protected by
5 * RCU.
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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * Copyright (C) IBM Corporation, 2005
22 *
23 * Author: Dipankar Sarma <dipankar@in.ibm.com>
24 * Ravikiran Thirumalai <kiran_th@gmail.com>
25 *
26 * See Documentation/RCU/rcuref.txt for detailed user guide.
27 *
28 */
29
30#ifndef _RCUREF_H_
31#define _RCUREF_H_
32
33#ifdef __KERNEL__
34
35#include <linux/types.h>
36#include <linux/interrupt.h>
37#include <linux/spinlock.h>
38#include <asm/atomic.h>
39
40/*
41 * These APIs work on traditional atomic_t counters used in the
42 * kernel for reference counting. Under special circumstances
43 * where a lock-free get() operation races with a put() operation
44 * these APIs can be used. See Documentation/RCU/rcuref.txt.
45 */
46
47#ifdef __HAVE_ARCH_CMPXCHG
48
49/**
50 * rcuref_inc - increment refcount for object.
51 * @rcuref: reference counter in the object in question.
52 *
53 * This should be used only for objects where we use RCU and
54 * use the rcuref_inc_lf() api to acquire a reference
55 * in a lock-free reader-side critical section.
56 */
57static inline void rcuref_inc(atomic_t *rcuref)
58{
59 atomic_inc(rcuref);
60}
61
62/**
63 * rcuref_dec - decrement refcount for object.
64 * @rcuref: reference counter in the object in question.
65 *
66 * This should be used only for objects where we use RCU and
67 * use the rcuref_inc_lf() api to acquire a reference
68 * in a lock-free reader-side critical section.
69 */
70static inline void rcuref_dec(atomic_t *rcuref)
71{
72 atomic_dec(rcuref);
73}
74
75/**
76 * rcuref_dec_and_test - decrement refcount for object and test
77 * @rcuref: reference counter in the object.
78 * @release: pointer to the function that will clean up the object
79 * when the last reference to the object is released.
80 * This pointer is required.
81 *
82 * Decrement the refcount, and if 0, return 1. Else return 0.
83 *
84 * This should be used only for objects where we use RCU and
85 * use the rcuref_inc_lf() api to acquire a reference
86 * in a lock-free reader-side critical section.
87 */
88static inline int rcuref_dec_and_test(atomic_t *rcuref)
89{
90 return atomic_dec_and_test(rcuref);
91}
92
93/*
94 * cmpxchg is needed on UP too, if deletions to the list/array can happen
95 * in interrupt context.
96 */
97
98/**
99 * rcuref_inc_lf - Take reference to an object in a read-side
100 * critical section protected by RCU.
101 * @rcuref: reference counter in the object in question.
102 *
103 * Try and increment the refcount by 1. The increment might fail if
104 * the reference counter has been through a 1 to 0 transition and
105 * is no longer part of the lock-free list.
106 * Returns non-zero on successful increment and zero otherwise.
107 */
108static inline int rcuref_inc_lf(atomic_t *rcuref)
109{
110 int c, old;
111 c = atomic_read(rcuref);
112 while (c && (old = cmpxchg(&rcuref->counter, c, c + 1)) != c)
113 c = old;
114 return c;
115}
116
117#else /* !__HAVE_ARCH_CMPXCHG */
118
119extern spinlock_t __rcuref_hash[];
120
121/*
122 * Use a hash table of locks to protect the reference count
123 * since cmpxchg is not available in this arch.
124 */
125#ifdef CONFIG_SMP
126#define RCUREF_HASH_SIZE 4
127#define RCUREF_HASH(k) \
128 (&__rcuref_hash[(((unsigned long)k)>>8) & (RCUREF_HASH_SIZE-1)])
129#else
130#define RCUREF_HASH_SIZE 1
131#define RCUREF_HASH(k) &__rcuref_hash[0]
132#endif /* CONFIG_SMP */
133
134/**
135 * rcuref_inc - increment refcount for object.
136 * @rcuref: reference counter in the object in question.
137 *
138 * This should be used only for objects where we use RCU and
139 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
140 * reader-side critical section.
141 */
142static inline void rcuref_inc(atomic_t *rcuref)
143{
144 unsigned long flags;
145 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
146 rcuref->counter += 1;
147 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
148}
149
150/**
151 * rcuref_dec - decrement refcount for object.
152 * @rcuref: reference counter in the object in question.
153 *
154 * This should be used only for objects where we use RCU and
155 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
156 * reader-side critical section.
157 */
158static inline void rcuref_dec(atomic_t *rcuref)
159{
160 unsigned long flags;
161 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
162 rcuref->counter -= 1;
163 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
164}
165
166/**
167 * rcuref_dec_and_test - decrement refcount for object and test
168 * @rcuref: reference counter in the object.
169 * @release: pointer to the function that will clean up the object
170 * when the last reference to the object is released.
171 * This pointer is required.
172 *
173 * Decrement the refcount, and if 0, return 1. Else return 0.
174 *
175 * This should be used only for objects where we use RCU and
176 * use the rcuref_inc_lf() api to acquire a reference in a lock-free
177 * reader-side critical section.
178 */
179static inline int rcuref_dec_and_test(atomic_t *rcuref)
180{
181 unsigned long flags;
182 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
183 rcuref->counter--;
184 if (!rcuref->counter) {
185 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
186 return 1;
187 } else {
188 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
189 return 0;
190 }
191}
192
193/**
194 * rcuref_inc_lf - Take reference to an object of a lock-free collection
195 * by traversing a lock-free list/array.
196 * @rcuref: reference counter in the object in question.
197 *
198 * Try and increment the refcount by 1. The increment might fail if
199 * the reference counter has been through a 1 to 0 transition and
200 * object is no longer part of the lock-free list.
201 * Returns non-zero on successful increment and zero otherwise.
202 */
203static inline int rcuref_inc_lf(atomic_t *rcuref)
204{
205 int ret;
206 unsigned long flags;
207 spin_lock_irqsave(RCUREF_HASH(rcuref), flags);
208 if (rcuref->counter)
209 ret = rcuref->counter++;
210 else
211 ret = 0;
212 spin_unlock_irqrestore(RCUREF_HASH(rcuref), flags);
213 return ret;
214}
215
216
217#endif /* !__HAVE_ARCH_CMPXCHG */
218
219#endif /* __KERNEL__ */
220#endif /* _RCUREF_H_ */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 001ab82df051..e276c5ba2bb7 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1857,7 +1857,7 @@ void padd_item(char *item, int total_length, int length);
1857#define GET_BLOCK_CREATE 1 /* add anything you need to find block */ 1857#define GET_BLOCK_CREATE 1 /* add anything you need to find block */
1858#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */ 1858#define GET_BLOCK_NO_HOLE 2 /* return -ENOENT for file holes */
1859#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ 1859#define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */
1860#define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ 1860#define GET_BLOCK_NO_IMUX 8 /* i_mutex is not held, don't preallocate */
1861#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */ 1861#define GET_BLOCK_NO_DANGLE 16 /* don't leave any transactions running */
1862 1862
1863int restart_transaction(struct reiserfs_transaction_handle *th, 1863int restart_transaction(struct reiserfs_transaction_handle *th,
diff --git a/include/linux/relayfs_fs.h b/include/linux/relayfs_fs.h
index fb7e80737325..7342e66247fb 100644
--- a/include/linux/relayfs_fs.h
+++ b/include/linux/relayfs_fs.h
@@ -65,20 +65,6 @@ struct rchan
65}; 65};
66 66
67/* 67/*
68 * Relayfs inode
69 */
70struct relayfs_inode_info
71{
72 struct inode vfs_inode;
73 struct rchan_buf *buf;
74};
75
76static inline struct relayfs_inode_info *RELAYFS_I(struct inode *inode)
77{
78 return container_of(inode, struct relayfs_inode_info, vfs_inode);
79}
80
81/*
82 * Relay channel client callbacks 68 * Relay channel client callbacks
83 */ 69 */
84struct rchan_callbacks 70struct rchan_callbacks
@@ -124,6 +110,46 @@ struct rchan_callbacks
124 */ 110 */
125 void (*buf_unmapped)(struct rchan_buf *buf, 111 void (*buf_unmapped)(struct rchan_buf *buf,
126 struct file *filp); 112 struct file *filp);
113 /*
114 * create_buf_file - create file to represent a relayfs channel buffer
115 * @filename: the name of the file to create
116 * @parent: the parent of the file to create
117 * @mode: the mode of the file to create
118 * @buf: the channel buffer
119 * @is_global: outparam - set non-zero if the buffer should be global
120 *
121 * Called during relay_open(), once for each per-cpu buffer,
122 * to allow the client to create a file to be used to
123 * represent the corresponding channel buffer. If the file is
124 * created outside of relayfs, the parent must also exist in
125 * that filesystem.
126 *
127 * The callback should return the dentry of the file created
128 * to represent the relay buffer.
129 *
130 * Setting the is_global outparam to a non-zero value will
131 * cause relay_open() to create a single global buffer rather
132 * than the default set of per-cpu buffers.
133 *
134 * See Documentation/filesystems/relayfs.txt for more info.
135 */
136 struct dentry *(*create_buf_file)(const char *filename,
137 struct dentry *parent,
138 int mode,
139 struct rchan_buf *buf,
140 int *is_global);
141
142 /*
143 * remove_buf_file - remove file representing a relayfs channel buffer
144 * @dentry: the dentry of the file to remove
145 *
146 * Called during relay_close(), once for each per-cpu buffer,
147 * to allow the client to remove a file used to represent a
148 * channel buffer.
149 *
150 * The callback should return 0 if successful, negative if not.
151 */
152 int (*remove_buf_file)(struct dentry *dentry);
127}; 153};
128 154
129/* 155/*
@@ -148,6 +174,12 @@ extern size_t relay_switch_subbuf(struct rchan_buf *buf,
148extern struct dentry *relayfs_create_dir(const char *name, 174extern struct dentry *relayfs_create_dir(const char *name,
149 struct dentry *parent); 175 struct dentry *parent);
150extern int relayfs_remove_dir(struct dentry *dentry); 176extern int relayfs_remove_dir(struct dentry *dentry);
177extern struct dentry *relayfs_create_file(const char *name,
178 struct dentry *parent,
179 int mode,
180 struct file_operations *fops,
181 void *data);
182extern int relayfs_remove_file(struct dentry *dentry);
151 183
152/** 184/**
153 * relay_write - write data into the channel 185 * relay_write - write data into the channel
@@ -247,10 +279,9 @@ static inline void subbuf_start_reserve(struct rchan_buf *buf,
247} 279}
248 280
249/* 281/*
250 * exported relayfs file operations, fs/relayfs/inode.c 282 * exported relay file operations, fs/relayfs/inode.c
251 */ 283 */
252 284extern struct file_operations relay_file_operations;
253extern struct file_operations relayfs_file_operations;
254 285
255#endif /* _LINUX_RELAYFS_FS_H */ 286#endif /* _LINUX_RELAYFS_FS_H */
256 287
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 3bd7cce19e26..f54772d0e7f8 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -21,6 +21,7 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/string.h>
24#include <linux/rio.h> 25#include <linux/rio.h>
25 26
26extern int __rio_local_read_config_32(struct rio_mport *port, u32 offset, 27extern int __rio_local_read_config_32(struct rio_mport *port, u32 offset,
@@ -336,8 +337,8 @@ static inline void rio_init_dbell_res(struct resource *res, u16 start, u16 end)
336 337
337/** 338/**
338 * RIO_DEVICE - macro used to describe a specific RIO device 339 * RIO_DEVICE - macro used to describe a specific RIO device
339 * @vid: the 16 bit RIO vendor ID 340 * @dev: the 16 bit RIO device ID
340 * @did: the 16 bit RIO device ID 341 * @ven: the 16 bit RIO vendor ID
341 * 342 *
342 * This macro is used to create a struct rio_device_id that matches a 343 * This macro is used to create a struct rio_device_id that matches a
343 * specific device. The assembly vendor and assembly device fields 344 * specific device. The assembly vendor and assembly device fields
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 33261f1d2239..9d6fbeef2104 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -71,6 +71,7 @@ void __anon_vma_link(struct vm_area_struct *);
71 * rmap interfaces called when adding or removing pte of page 71 * rmap interfaces called when adding or removing pte of page
72 */ 72 */
73void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 73void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
74void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
74void page_add_file_rmap(struct page *); 75void page_add_file_rmap(struct page *);
75void page_remove_rmap(struct page *); 76void page_remove_rmap(struct page *);
76 77
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index e1aaf1fac8e0..0b2ba67ff13c 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -11,6 +11,8 @@
11#ifndef _LINUX_RTC_H_ 11#ifndef _LINUX_RTC_H_
12#define _LINUX_RTC_H_ 12#define _LINUX_RTC_H_
13 13
14#include <linux/interrupt.h>
15
14/* 16/*
15 * The struct used to pass data via the following ioctl. Similar to the 17 * The struct used to pass data via the following ioctl. Similar to the
16 * struct tm in <time.h>, but it needs to be here so that the kernel 18 * struct tm in <time.h>, but it needs to be here so that the kernel
@@ -102,6 +104,7 @@ int rtc_register(rtc_task_t *task);
102int rtc_unregister(rtc_task_t *task); 104int rtc_unregister(rtc_task_t *task);
103int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 105int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
104void rtc_get_rtc_time(struct rtc_time *rtc_tm); 106void rtc_get_rtc_time(struct rtc_time *rtc_tm);
107irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
105 108
106#endif /* __KERNEL__ */ 109#endif /* __KERNEL__ */
107 110
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b0ad6f30679e..a72e17135421 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -34,6 +34,7 @@
34#include <linux/percpu.h> 34#include <linux/percpu.h>
35#include <linux/topology.h> 35#include <linux/topology.h>
36#include <linux/seccomp.h> 36#include <linux/seccomp.h>
37#include <linux/rcupdate.h>
37 38
38#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ 39#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */
39 40
@@ -104,6 +105,7 @@ extern unsigned long nr_iowait(void);
104#include <linux/param.h> 105#include <linux/param.h>
105#include <linux/resource.h> 106#include <linux/resource.h>
106#include <linux/timer.h> 107#include <linux/timer.h>
108#include <linux/hrtimer.h>
107 109
108#include <asm/processor.h> 110#include <asm/processor.h>
109 111
@@ -254,25 +256,12 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
254 * The mm counters are not protected by its page_table_lock, 256 * The mm counters are not protected by its page_table_lock,
255 * so must be incremented atomically. 257 * so must be incremented atomically.
256 */ 258 */
257#ifdef ATOMIC64_INIT 259#define set_mm_counter(mm, member, value) atomic_long_set(&(mm)->_##member, value)
258#define set_mm_counter(mm, member, value) atomic64_set(&(mm)->_##member, value) 260#define get_mm_counter(mm, member) ((unsigned long)atomic_long_read(&(mm)->_##member))
259#define get_mm_counter(mm, member) ((unsigned long)atomic64_read(&(mm)->_##member)) 261#define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member)
260#define add_mm_counter(mm, member, value) atomic64_add(value, &(mm)->_##member) 262#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member)
261#define inc_mm_counter(mm, member) atomic64_inc(&(mm)->_##member) 263#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member)
262#define dec_mm_counter(mm, member) atomic64_dec(&(mm)->_##member) 264typedef atomic_long_t mm_counter_t;
263typedef atomic64_t mm_counter_t;
264#else /* !ATOMIC64_INIT */
265/*
266 * The counters wrap back to 0 at 2^32 * PAGE_SIZE,
267 * that is, at 16TB if using 4kB page size.
268 */
269#define set_mm_counter(mm, member, value) atomic_set(&(mm)->_##member, value)
270#define get_mm_counter(mm, member) ((unsigned long)atomic_read(&(mm)->_##member))
271#define add_mm_counter(mm, member, value) atomic_add(value, &(mm)->_##member)
272#define inc_mm_counter(mm, member) atomic_inc(&(mm)->_##member)
273#define dec_mm_counter(mm, member) atomic_dec(&(mm)->_##member)
274typedef atomic_t mm_counter_t;
275#endif /* !ATOMIC64_INIT */
276 265
277#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 266#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
278/* 267/*
@@ -363,8 +352,16 @@ struct sighand_struct {
363 atomic_t count; 352 atomic_t count;
364 struct k_sigaction action[_NSIG]; 353 struct k_sigaction action[_NSIG];
365 spinlock_t siglock; 354 spinlock_t siglock;
355 struct rcu_head rcu;
366}; 356};
367 357
358extern void sighand_free_cb(struct rcu_head *rhp);
359
360static inline void sighand_free(struct sighand_struct *sp)
361{
362 call_rcu(&sp->rcu, sighand_free_cb);
363}
364
368/* 365/*
369 * NOTE! "signal_struct" does not have it's own 366 * NOTE! "signal_struct" does not have it's own
370 * locking, because a shared signal_struct always 367 * locking, because a shared signal_struct always
@@ -402,8 +399,8 @@ struct signal_struct {
402 struct list_head posix_timers; 399 struct list_head posix_timers;
403 400
404 /* ITIMER_REAL timer for the process */ 401 /* ITIMER_REAL timer for the process */
405 struct timer_list real_timer; 402 struct hrtimer real_timer;
406 unsigned long it_real_value, it_real_incr; 403 ktime_t it_real_incr;
407 404
408 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 405 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
409 cputime_t it_prof_expires, it_virt_expires; 406 cputime_t it_prof_expires, it_virt_expires;
@@ -634,7 +631,14 @@ struct sched_domain {
634 631
635extern void partition_sched_domains(cpumask_t *partition1, 632extern void partition_sched_domains(cpumask_t *partition1,
636 cpumask_t *partition2); 633 cpumask_t *partition2);
637#endif /* CONFIG_SMP */ 634
635/*
636 * Maximum cache size the migration-costs auto-tuning code will
637 * search from:
638 */
639extern unsigned int max_cache_size;
640
641#endif /* CONFIG_SMP */
638 642
639 643
640struct io_context; /* See blkdev.h */ 644struct io_context; /* See blkdev.h */
@@ -692,9 +696,12 @@ struct task_struct {
692 696
693 int lock_depth; /* BKL lock depth */ 697 int lock_depth; /* BKL lock depth */
694 698
695#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) 699#if defined(CONFIG_SMP)
700 int last_waker_cpu; /* CPU that last woke this task up */
701#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
696 int oncpu; 702 int oncpu;
697#endif 703#endif
704#endif
698 int prio, static_prio; 705 int prio, static_prio;
699 struct list_head run_list; 706 struct list_head run_list;
700 prio_array_t *array; 707 prio_array_t *array;
@@ -775,6 +782,7 @@ struct task_struct {
775 unsigned keep_capabilities:1; 782 unsigned keep_capabilities:1;
776 struct user_struct *user; 783 struct user_struct *user;
777#ifdef CONFIG_KEYS 784#ifdef CONFIG_KEYS
785 struct key *request_key_auth; /* assumed request_key authority */
778 struct key *thread_keyring; /* keyring private to this thread */ 786 struct key *thread_keyring; /* keyring private to this thread */
779 unsigned char jit_keyring; /* default keyring to attach requested keys to */ 787 unsigned char jit_keyring; /* default keyring to attach requested keys to */
780#endif 788#endif
@@ -820,6 +828,11 @@ struct task_struct {
820/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ 828/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */
821 spinlock_t proc_lock; 829 spinlock_t proc_lock;
822 830
831#ifdef CONFIG_DEBUG_MUTEXES
832 /* mutex deadlock detection */
833 struct mutex_waiter *blocked_on;
834#endif
835
823/* journalling filesystem info */ 836/* journalling filesystem info */
824 void *journal_info; 837 void *journal_info;
825 838
@@ -857,6 +870,7 @@ struct task_struct {
857 int cpuset_mems_generation; 870 int cpuset_mems_generation;
858#endif 871#endif
859 atomic_t fs_excl; /* holding fs exclusive resources */ 872 atomic_t fs_excl; /* holding fs exclusive resources */
873 struct rcu_head rcu;
860}; 874};
861 875
862static inline pid_t process_group(struct task_struct *tsk) 876static inline pid_t process_group(struct task_struct *tsk)
@@ -880,8 +894,14 @@ static inline int pid_alive(struct task_struct *p)
880extern void free_task(struct task_struct *tsk); 894extern void free_task(struct task_struct *tsk);
881extern void __put_task_struct(struct task_struct *tsk); 895extern void __put_task_struct(struct task_struct *tsk);
882#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 896#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
883#define put_task_struct(tsk) \ 897
884do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) 898extern void __put_task_struct_cb(struct rcu_head *rhp);
899
900static inline void put_task_struct(struct task_struct *t)
901{
902 if (atomic_dec_and_test(&t->usage))
903 call_rcu(&t->rcu, __put_task_struct_cb);
904}
885 905
886/* 906/*
887 * Per process flags 907 * Per process flags
@@ -908,6 +928,7 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
908#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ 928#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */
909#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ 929#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */
910#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ 930#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */
931#define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */
911 932
912/* 933/*
913 * Only the _current_ task can read/write to tsk->flags, but other 934 * Only the _current_ task can read/write to tsk->flags, but other
@@ -1101,21 +1122,6 @@ static inline int sas_ss_flags(unsigned long sp)
1101 : on_sig_stack(sp) ? SS_ONSTACK : 0); 1122 : on_sig_stack(sp) ? SS_ONSTACK : 0);
1102} 1123}
1103 1124
1104
1105#ifdef CONFIG_SECURITY
1106/* code is in security.c */
1107extern int capable(int cap);
1108#else
1109static inline int capable(int cap)
1110{
1111 if (cap_raised(current->cap_effective, cap)) {
1112 current->flags |= PF_SUPERPRIV;
1113 return 1;
1114 }
1115 return 0;
1116}
1117#endif
1118
1119/* 1125/*
1120 * Routines for handling mm_structs 1126 * Routines for handling mm_structs
1121 */ 1127 */
@@ -1234,6 +1240,7 @@ static inline void task_unlock(struct task_struct *p)
1234#ifndef __HAVE_THREAD_FUNCTIONS 1240#ifndef __HAVE_THREAD_FUNCTIONS
1235 1241
1236#define task_thread_info(task) (task)->thread_info 1242#define task_thread_info(task) (task)->thread_info
1243#define task_stack_page(task) ((void*)((task)->thread_info))
1237 1244
1238static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org) 1245static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org)
1239{ 1246{
@@ -1379,12 +1386,8 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm)
1379extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); 1386extern long sched_setaffinity(pid_t pid, cpumask_t new_mask);
1380extern long sched_getaffinity(pid_t pid, cpumask_t *mask); 1387extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
1381 1388
1382#ifdef CONFIG_MAGIC_SYSRQ
1383
1384extern void normalize_rt_tasks(void); 1389extern void normalize_rt_tasks(void);
1385 1390
1386#endif
1387
1388#ifdef CONFIG_PM 1391#ifdef CONFIG_PM
1389/* 1392/*
1390 * Check if a process has been frozen 1393 * Check if a process has been frozen
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
new file mode 100644
index 000000000000..6336987dae62
--- /dev/null
+++ b/include/linux/screen_info.h
@@ -0,0 +1,76 @@
1#ifndef _SCREEN_INFO_H
2#define _SCREEN_INFO_H
3
4#include <linux/types.h>
5
6/*
7 * These are set up by the setup-routine at boot-time:
8 */
9
10struct screen_info {
11 u8 orig_x; /* 0x00 */
12 u8 orig_y; /* 0x01 */
13 u16 dontuse1; /* 0x02 -- EXT_MEM_K sits here */
14 u16 orig_video_page; /* 0x04 */
15 u8 orig_video_mode; /* 0x06 */
16 u8 orig_video_cols; /* 0x07 */
17 u16 unused2; /* 0x08 */
18 u16 orig_video_ega_bx; /* 0x0a */
19 u16 unused3; /* 0x0c */
20 u8 orig_video_lines; /* 0x0e */
21 u8 orig_video_isVGA; /* 0x0f */
22 u16 orig_video_points; /* 0x10 */
23
24 /* VESA graphic mode -- linear frame buffer */
25 u16 lfb_width; /* 0x12 */
26 u16 lfb_height; /* 0x14 */
27 u16 lfb_depth; /* 0x16 */
28 u32 lfb_base; /* 0x18 */
29 u32 lfb_size; /* 0x1c */
30 u16 dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */
31 u16 lfb_linelength; /* 0x24 */
32 u8 red_size; /* 0x26 */
33 u8 red_pos; /* 0x27 */
34 u8 green_size; /* 0x28 */
35 u8 green_pos; /* 0x29 */
36 u8 blue_size; /* 0x2a */
37 u8 blue_pos; /* 0x2b */
38 u8 rsvd_size; /* 0x2c */
39 u8 rsvd_pos; /* 0x2d */
40 u16 vesapm_seg; /* 0x2e */
41 u16 vesapm_off; /* 0x30 */
42 u16 pages; /* 0x32 */
43 u16 vesa_attributes; /* 0x34 */
44 /* 0x36 -- 0x3f reserved for future expansion */
45};
46
47extern struct screen_info screen_info;
48
49#define ORIG_X (screen_info.orig_x)
50#define ORIG_Y (screen_info.orig_y)
51#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
52#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
53#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
54#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
55#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
56#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
57
58#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */
59#define VIDEO_TYPE_CGA 0x11 /* CGA Display */
60#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */
61#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */
62#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */
63#define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
64
65#define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */
66#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */
67#define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */
68
69#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */
70
71#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */
72#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */
73
74#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
75
76#endif /* _SCREEN_INFO_H */
diff --git a/include/linux/sdla.h b/include/linux/sdla.h
index 3b6afb8caa42..564acd3a71c1 100644
--- a/include/linux/sdla.h
+++ b/include/linux/sdla.h
@@ -293,46 +293,46 @@ void sdla(void *cfg_info, char *dev, struct frad_conf *conf, int quiet);
293#define SDLA_S508_INTEN 0x10 293#define SDLA_S508_INTEN 0x10
294 294
295struct sdla_cmd { 295struct sdla_cmd {
296 char opp_flag __attribute__((packed)); 296 char opp_flag;
297 char cmd __attribute__((packed)); 297 char cmd;
298 short length __attribute__((packed)); 298 short length;
299 char retval __attribute__((packed)); 299 char retval;
300 short dlci __attribute__((packed)); 300 short dlci;
301 char flags __attribute__((packed)); 301 char flags;
302 short rxlost_int __attribute__((packed)); 302 short rxlost_int;
303 long rxlost_app __attribute__((packed)); 303 long rxlost_app;
304 char reserve[2] __attribute__((packed)); 304 char reserve[2];
305 char data[SDLA_MAX_DATA] __attribute__((packed)); /* transfer data buffer */ 305 char data[SDLA_MAX_DATA]; /* transfer data buffer */
306}; 306} __attribute__((packed));
307 307
308struct intr_info { 308struct intr_info {
309 char flags __attribute__((packed)); 309 char flags;
310 short txlen __attribute__((packed)); 310 short txlen;
311 char irq __attribute__((packed)); 311 char irq;
312 char flags2 __attribute__((packed)); 312 char flags2;
313 short timeout __attribute__((packed)); 313 short timeout;
314}; 314} __attribute__((packed));
315 315
316/* found in the 508's control window at RXBUF_INFO */ 316/* found in the 508's control window at RXBUF_INFO */
317struct buf_info { 317struct buf_info {
318 unsigned short rse_num __attribute__((packed)); 318 unsigned short rse_num;
319 unsigned long rse_base __attribute__((packed)); 319 unsigned long rse_base;
320 unsigned long rse_next __attribute__((packed)); 320 unsigned long rse_next;
321 unsigned long buf_base __attribute__((packed)); 321 unsigned long buf_base;
322 unsigned short reserved __attribute__((packed)); 322 unsigned short reserved;
323 unsigned long buf_top __attribute__((packed)); 323 unsigned long buf_top;
324}; 324} __attribute__((packed));
325 325
326/* structure pointed to by rse_base in RXBUF_INFO struct */ 326/* structure pointed to by rse_base in RXBUF_INFO struct */
327struct buf_entry { 327struct buf_entry {
328 char opp_flag __attribute__((packed)); 328 char opp_flag;
329 short length __attribute__((packed)); 329 short length;
330 short dlci __attribute__((packed)); 330 short dlci;
331 char flags __attribute__((packed)); 331 char flags;
332 short timestamp __attribute__((packed)); 332 short timestamp;
333 short reserved[2] __attribute__((packed)); 333 short reserved[2];
334 long buf_addr __attribute__((packed)); 334 long buf_addr;
335}; 335} __attribute__((packed));
336 336
337#endif 337#endif
338 338
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index dc89116bb1ca..cd2773b29a64 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -26,11 +26,7 @@ static inline int has_secure_computing(struct thread_info *ti)
26 26
27#else /* CONFIG_SECCOMP */ 27#else /* CONFIG_SECCOMP */
28 28
29#if (__GNUC__ > 2) 29typedef struct { } seccomp_t;
30 typedef struct { } seccomp_t;
31#else
32 typedef struct { int gcc_is_buggy; } seccomp_t;
33#endif
34 30
35#define secure_computing(x) do { } while (0) 31#define secure_computing(x) do { } while (0)
36/* static inline to preserve typechecking */ 32/* static inline to preserve typechecking */
diff --git a/include/linux/security.h b/include/linux/security.h
index f7e0ae018712..ef753654daa5 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -59,6 +59,12 @@ struct sk_buff;
59struct sock; 59struct sock;
60struct sockaddr; 60struct sockaddr;
61struct socket; 61struct socket;
62struct flowi;
63struct dst_entry;
64struct xfrm_selector;
65struct xfrm_policy;
66struct xfrm_state;
67struct xfrm_user_sec_ctx;
62 68
63extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 69extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
64extern int cap_netlink_recv(struct sk_buff *skb); 70extern int cap_netlink_recv(struct sk_buff *skb);
@@ -788,6 +794,52 @@ struct swap_info_struct;
788 * which is used to copy security attributes between local stream sockets. 794 * which is used to copy security attributes between local stream sockets.
789 * @sk_free_security: 795 * @sk_free_security:
790 * Deallocate security structure. 796 * Deallocate security structure.
797 * @sk_getsid:
798 * Retrieve the LSM-specific sid for the sock to enable caching of network
799 * authorizations.
800 *
801 * Security hooks for XFRM operations.
802 *
803 * @xfrm_policy_alloc_security:
804 * @xp contains the xfrm_policy being added to Security Policy Database
805 * used by the XFRM system.
806 * @sec_ctx contains the security context information being provided by
807 * the user-level policy update program (e.g., setkey).
808 * Allocate a security structure to the xp->selector.security field.
809 * The security field is initialized to NULL when the xfrm_policy is
810 * allocated.
811 * Return 0 if operation was successful (memory to allocate, legal context)
812 * @xfrm_policy_clone_security:
813 * @old contains an existing xfrm_policy in the SPD.
814 * @new contains a new xfrm_policy being cloned from old.
815 * Allocate a security structure to the new->selector.security field
816 * that contains the information from the old->selector.security field.
817 * Return 0 if operation was successful (memory to allocate).
818 * @xfrm_policy_free_security:
819 * @xp contains the xfrm_policy
820 * Deallocate xp->selector.security.
821 * @xfrm_state_alloc_security:
822 * @x contains the xfrm_state being added to the Security Association
823 * Database by the XFRM system.
824 * @sec_ctx contains the security context information being provided by
825 * the user-level SA generation program (e.g., setkey or racoon).
826 * Allocate a security structure to the x->sel.security field. The
827 * security field is initialized to NULL when the xfrm_state is
828 * allocated.
829 * Return 0 if operation was successful (memory to allocate, legal context).
830 * @xfrm_state_free_security:
831 * @x contains the xfrm_state.
832 * Deallocate x>sel.security.
833 * @xfrm_policy_lookup:
834 * @xp contains the xfrm_policy for which the access control is being
835 * checked.
836 * @sk_sid contains the sock security label that is used to authorize
837 * access to the policy xp.
838 * @dir contains the direction of the flow (input or output).
839 * Check permission when a sock selects a xfrm_policy for processing
840 * XFRMs on a packet. The hook is called when selecting either a
841 * per-socket policy or a generic xfrm policy.
842 * Return 0 if permission is granted.
791 * 843 *
792 * Security hooks affecting all Key Management operations 844 * Security hooks affecting all Key Management operations
793 * 845 *
@@ -1237,8 +1289,18 @@ struct security_operations {
1237 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1289 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1238 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1290 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1239 void (*sk_free_security) (struct sock *sk); 1291 void (*sk_free_security) (struct sock *sk);
1292 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir);
1240#endif /* CONFIG_SECURITY_NETWORK */ 1293#endif /* CONFIG_SECURITY_NETWORK */
1241 1294
1295#ifdef CONFIG_SECURITY_NETWORK_XFRM
1296 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
1297 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
1298 void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
1299 int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
1300 void (*xfrm_state_free_security) (struct xfrm_state *x);
1301 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir);
1302#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1303
1242 /* key management security hooks */ 1304 /* key management security hooks */
1243#ifdef CONFIG_KEYS 1305#ifdef CONFIG_KEYS
1244 int (*key_alloc)(struct key *key); 1306 int (*key_alloc)(struct key *key);
@@ -2679,6 +2741,11 @@ static inline void security_sk_free(struct sock *sk)
2679{ 2741{
2680 return security_ops->sk_free_security(sk); 2742 return security_ops->sk_free_security(sk);
2681} 2743}
2744
2745static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir)
2746{
2747 return security_ops->sk_getsid(sk, fl, dir);
2748}
2682#else /* CONFIG_SECURITY_NETWORK */ 2749#else /* CONFIG_SECURITY_NETWORK */
2683static inline int security_unix_stream_connect(struct socket * sock, 2750static inline int security_unix_stream_connect(struct socket * sock,
2684 struct socket * other, 2751 struct socket * other,
@@ -2795,8 +2862,73 @@ static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
2795static inline void security_sk_free(struct sock *sk) 2862static inline void security_sk_free(struct sock *sk)
2796{ 2863{
2797} 2864}
2865
2866static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir)
2867{
2868 return 0;
2869}
2798#endif /* CONFIG_SECURITY_NETWORK */ 2870#endif /* CONFIG_SECURITY_NETWORK */
2799 2871
2872#ifdef CONFIG_SECURITY_NETWORK_XFRM
2873static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
2874{
2875 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx);
2876}
2877
2878static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
2879{
2880 return security_ops->xfrm_policy_clone_security(old, new);
2881}
2882
2883static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2884{
2885 security_ops->xfrm_policy_free_security(xp);
2886}
2887
2888static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2889{
2890 return security_ops->xfrm_state_alloc_security(x, sec_ctx);
2891}
2892
2893static inline void security_xfrm_state_free(struct xfrm_state *x)
2894{
2895 security_ops->xfrm_state_free_security(x);
2896}
2897
2898static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
2899{
2900 return security_ops->xfrm_policy_lookup(xp, sk_sid, dir);
2901}
2902#else /* CONFIG_SECURITY_NETWORK_XFRM */
2903static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
2904{
2905 return 0;
2906}
2907
2908static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
2909{
2910 return 0;
2911}
2912
2913static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
2914{
2915}
2916
2917static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
2918{
2919 return 0;
2920}
2921
2922static inline void security_xfrm_state_free(struct xfrm_state *x)
2923{
2924}
2925
2926static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
2927{
2928 return 0;
2929}
2930#endif /* CONFIG_SECURITY_NETWORK_XFRM */
2931
2800#ifdef CONFIG_KEYS 2932#ifdef CONFIG_KEYS
2801#ifdef CONFIG_SECURITY 2933#ifdef CONFIG_SECURITY
2802static inline int security_key_alloc(struct key *key) 2934static inline int security_key_alloc(struct key *key)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index e3710d7e260a..a8187c3c8a7b 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -67,6 +67,9 @@
67/* Parisc type numbers. */ 67/* Parisc type numbers. */
68#define PORT_MUX 48 68#define PORT_MUX 48
69 69
70/* Atmel AT91RM9200 SoC */
71#define PORT_AT91RM9200 49
72
70/* Macintosh Zilog type numbers */ 73/* Macintosh Zilog type numbers */
71#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */ 74#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */
72#define PORT_PMAC_ZILOG 51 75#define PORT_PMAC_ZILOG 51
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 5dd5f02c5c5f..b7d093520bb6 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -18,6 +18,19 @@
18#define SA_PROBE SA_ONESHOT 18#define SA_PROBE SA_ONESHOT
19#define SA_SAMPLE_RANDOM SA_RESTART 19#define SA_SAMPLE_RANDOM SA_RESTART
20#define SA_SHIRQ 0x04000000 20#define SA_SHIRQ 0x04000000
21/*
22 * As above, these correspond to the IORESOURCE_IRQ_* defines in
23 * linux/ioport.h to select the interrupt line behaviour. When
24 * requesting an interrupt without specifying a SA_TRIGGER, the
25 * setting should be assumed to be "as already configured", which
26 * may be as per machine or firmware initialisation.
27 */
28#define SA_TRIGGER_LOW 0x00000008
29#define SA_TRIGGER_HIGH 0x00000004
30#define SA_TRIGGER_FALLING 0x00000002
31#define SA_TRIGGER_RISING 0x00000001
32#define SA_TRIGGER_MASK (SA_TRIGGER_HIGH|SA_TRIGGER_LOW|\
33 SA_TRIGGER_RISING|SA_TRIGGER_FALLING)
21 34
22/* 35/*
23 * Real Time signals may be queued. 36 * Real Time signals may be queued.
@@ -81,6 +94,23 @@ static inline int sigfindinword(unsigned long word)
81 94
82#endif /* __HAVE_ARCH_SIG_BITOPS */ 95#endif /* __HAVE_ARCH_SIG_BITOPS */
83 96
97static inline int sigisemptyset(sigset_t *set)
98{
99 extern void _NSIG_WORDS_is_unsupported_size(void);
100 switch (_NSIG_WORDS) {
101 case 4:
102 return (set->sig[3] | set->sig[2] |
103 set->sig[1] | set->sig[0]) == 0;
104 case 2:
105 return (set->sig[1] | set->sig[0]) == 0;
106 case 1:
107 return set->sig[0] == 0;
108 default:
109 _NSIG_WORDS_is_unsupported_size();
110 return 0;
111 }
112}
113
84#define sigmask(sig) (1UL << ((sig) - 1)) 114#define sigmask(sig) (1UL << ((sig) - 1))
85 115
86#ifndef __HAVE_ARCH_SIG_SETOPS 116#ifndef __HAVE_ARCH_SIG_SETOPS
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 8c5d6001a923..e5fd66c5650b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -32,7 +32,6 @@
32 32
33#define HAVE_ALLOC_SKB /* For the drivers to know */ 33#define HAVE_ALLOC_SKB /* For the drivers to know */
34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 34#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
35#define SLAB_SKB /* Slabified skbuffs */
36 35
37#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
38#define CHECKSUM_HW 1 37#define CHECKSUM_HW 1
@@ -134,7 +133,7 @@ struct skb_frag_struct {
134 */ 133 */
135struct skb_shared_info { 134struct skb_shared_info {
136 atomic_t dataref; 135 atomic_t dataref;
137 unsigned int nr_frags; 136 unsigned short nr_frags;
138 unsigned short tso_size; 137 unsigned short tso_size;
139 unsigned short tso_segs; 138 unsigned short tso_segs;
140 unsigned short ufo_size; 139 unsigned short ufo_size;
@@ -252,7 +251,7 @@ struct sk_buff {
252 * want to keep them across layers you have to do a skb_clone() 251 * want to keep them across layers you have to do a skb_clone()
253 * first. This is owned by whoever has the skb queued ATM. 252 * first. This is owned by whoever has the skb queued ATM.
254 */ 253 */
255 char cb[40]; 254 char cb[48];
256 255
257 unsigned int len, 256 unsigned int len,
258 data_len, 257 data_len,
@@ -1239,6 +1238,8 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1239 int hlen, 1238 int hlen,
1240 struct iovec *iov); 1239 struct iovec *iov);
1241extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1240extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1241extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1242 unsigned int flags);
1242extern unsigned int skb_checksum(const struct sk_buff *skb, int offset, 1243extern unsigned int skb_checksum(const struct sk_buff *skb, int offset,
1243 int len, unsigned int csum); 1244 int len, unsigned int csum);
1244extern int skb_copy_bits(const struct sk_buff *skb, int offset, 1245extern int skb_copy_bits(const struct sk_buff *skb, int offset,
diff --git a/include/linux/slab.h b/include/linux/slab.h
index d1ea4051b996..1fb77a9cc148 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -53,6 +53,8 @@ typedef struct kmem_cache kmem_cache_t;
53#define SLAB_CTOR_ATOMIC 0x002UL /* tell constructor it can't sleep */ 53#define SLAB_CTOR_ATOMIC 0x002UL /* tell constructor it can't sleep */
54#define SLAB_CTOR_VERIFY 0x004UL /* tell constructor it's a verify call */ 54#define SLAB_CTOR_VERIFY 0x004UL /* tell constructor it's a verify call */
55 55
56#ifndef CONFIG_SLOB
57
56/* prototypes */ 58/* prototypes */
57extern void __init kmem_cache_init(void); 59extern void __init kmem_cache_init(void);
58 60
@@ -134,6 +136,39 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
134extern int FASTCALL(kmem_cache_reap(int)); 136extern int FASTCALL(kmem_cache_reap(int));
135extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr)); 137extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr));
136 138
139#else /* CONFIG_SLOB */
140
141/* SLOB allocator routines */
142
143void kmem_cache_init(void);
144struct kmem_cache *kmem_find_general_cachep(size_t, gfp_t gfpflags);
145struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t,
146 unsigned long,
147 void (*)(void *, struct kmem_cache *, unsigned long),
148 void (*)(void *, struct kmem_cache *, unsigned long));
149int kmem_cache_destroy(struct kmem_cache *c);
150void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags);
151void kmem_cache_free(struct kmem_cache *c, void *b);
152const char *kmem_cache_name(struct kmem_cache *);
153void *kmalloc(size_t size, gfp_t flags);
154void *kzalloc(size_t size, gfp_t flags);
155void kfree(const void *m);
156unsigned int ksize(const void *m);
157unsigned int kmem_cache_size(struct kmem_cache *c);
158
159static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
160{
161 return kzalloc(n * size, flags);
162}
163
164#define kmem_cache_shrink(d) (0)
165#define kmem_cache_reap(a)
166#define kmem_ptr_validate(a, b) (0)
167#define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f)
168#define kmalloc_node(s, f, n) kmalloc(s, f)
169
170#endif /* CONFIG_SLOB */
171
137/* System wide caches */ 172/* System wide caches */
138extern kmem_cache_t *vm_area_cachep; 173extern kmem_cache_t *vm_area_cachep;
139extern kmem_cache_t *names_cachep; 174extern kmem_cache_t *names_cachep;
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 1739c2d5b95b..9f4019156fd8 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -27,7 +27,6 @@ struct __kernel_sockaddr_storage {
27#include <linux/compiler.h> /* __user */ 27#include <linux/compiler.h> /* __user */
28 28
29extern int sysctl_somaxconn; 29extern int sysctl_somaxconn;
30extern void sock_init(void);
31#ifdef CONFIG_PROC_FS 30#ifdef CONFIG_PROC_FS
32struct seq_file; 31struct seq_file;
33extern void socket_seq_show(struct seq_file *seq); 32extern void socket_seq_show(struct seq_file *seq);
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 0e9682c9def5..799be6747944 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -59,8 +59,7 @@
59/* 59/*
60 * Must define these before including other files, inline functions need them 60 * Must define these before including other files, inline functions need them
61 */ 61 */
62#define LOCK_SECTION_NAME \ 62#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME
63 ".text.lock." __stringify(KBUILD_BASENAME)
64 63
65#define LOCK_SECTION_START(extra) \ 64#define LOCK_SECTION_START(extra) \
66 ".subsection 1\n\t" \ 65 ".subsection 1\n\t" \
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h
index def2d173a8db..04135b0e198e 100644
--- a/include/linux/spinlock_types_up.h
+++ b/include/linux/spinlock_types_up.h
@@ -22,30 +22,16 @@ typedef struct {
22 22
23#else 23#else
24 24
25/*
26 * All gcc 2.95 versions and early versions of 2.96 have a nasty bug
27 * with empty initializers.
28 */
29#if (__GNUC__ > 2)
30typedef struct { } raw_spinlock_t; 25typedef struct { } raw_spinlock_t;
31 26
32#define __RAW_SPIN_LOCK_UNLOCKED { } 27#define __RAW_SPIN_LOCK_UNLOCKED { }
33#else
34typedef struct { int gcc_is_buggy; } raw_spinlock_t;
35#define __RAW_SPIN_LOCK_UNLOCKED (raw_spinlock_t) { 0 }
36#endif
37 28
38#endif 29#endif
39 30
40#if (__GNUC__ > 2)
41typedef struct { 31typedef struct {
42 /* no debug version on UP */ 32 /* no debug version on UP */
43} raw_rwlock_t; 33} raw_rwlock_t;
44 34
45#define __RAW_RW_LOCK_UNLOCKED { } 35#define __RAW_RW_LOCK_UNLOCKED { }
46#else
47typedef struct { int gcc_is_buggy; } raw_rwlock_t;
48#define __RAW_RW_LOCK_UNLOCKED (raw_rwlock_t) { 0 }
49#endif
50 36
51#endif /* __LINUX_SPINLOCK_TYPES_UP_H */ 37#endif /* __LINUX_SPINLOCK_TYPES_UP_H */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index ab151bbb66df..f147e6b84332 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -49,7 +49,6 @@ struct rpc_clnt {
49 49
50 unsigned int cl_softrtry : 1,/* soft timeouts */ 50 unsigned int cl_softrtry : 1,/* soft timeouts */
51 cl_intr : 1,/* interruptible */ 51 cl_intr : 1,/* interruptible */
52 cl_chatty : 1,/* be verbose */
53 cl_autobind : 1,/* use getport() */ 52 cl_autobind : 1,/* use getport() */
54 cl_oneshot : 1,/* dispose after use */ 53 cl_oneshot : 1,/* dispose after use */
55 cl_dead : 1;/* abandoned */ 54 cl_dead : 1;/* abandoned */
@@ -126,7 +125,8 @@ int rpc_register(u32, u32, int, unsigned short, int *);
126void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 125void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
127 126
128int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 127int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
129 int flags, rpc_action callback, void *clntdata); 128 int flags, const struct rpc_call_ops *tk_ops,
129 void *calldata);
130int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, 130int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg,
131 int flags); 131 int flags);
132void rpc_restart_call(struct rpc_task *); 132void rpc_restart_call(struct rpc_task *);
@@ -134,6 +134,7 @@ void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset);
134void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset); 134void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset);
135void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 135void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
136size_t rpc_max_payload(struct rpc_clnt *); 136size_t rpc_max_payload(struct rpc_clnt *);
137void rpc_force_rebind(struct rpc_clnt *);
137int rpc_ping(struct rpc_clnt *clnt, int flags); 138int rpc_ping(struct rpc_clnt *clnt, int flags);
138 139
139static __inline__ 140static __inline__
diff --git a/include/linux/sunrpc/gss_spkm3.h b/include/linux/sunrpc/gss_spkm3.h
index 0beb2cf00a84..336e218c2782 100644
--- a/include/linux/sunrpc/gss_spkm3.h
+++ b/include/linux/sunrpc/gss_spkm3.h
@@ -48,7 +48,7 @@ u32 spkm3_read_token(struct spkm3_ctx *ctx, struct xdr_netobj *read_token, struc
48#define CKSUMTYPE_RSA_MD5 0x0007 48#define CKSUMTYPE_RSA_MD5 0x0007
49 49
50s32 make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, 50s32 make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body,
51 struct xdr_netobj *cksum); 51 int body_offset, struct xdr_netobj *cksum);
52void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits); 52void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits);
53int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, 53int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen,
54 int explen); 54 int explen);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 4d77e90d0b30..8b25629accd8 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -27,6 +27,7 @@ struct rpc_message {
27 struct rpc_cred * rpc_cred; /* Credentials */ 27 struct rpc_cred * rpc_cred; /* Credentials */
28}; 28};
29 29
30struct rpc_call_ops;
30struct rpc_wait_queue; 31struct rpc_wait_queue;
31struct rpc_wait { 32struct rpc_wait {
32 struct list_head list; /* wait queue links */ 33 struct list_head list; /* wait queue links */
@@ -41,6 +42,7 @@ struct rpc_task {
41#ifdef RPC_DEBUG 42#ifdef RPC_DEBUG
42 unsigned long tk_magic; /* 0xf00baa */ 43 unsigned long tk_magic; /* 0xf00baa */
43#endif 44#endif
45 atomic_t tk_count; /* Reference count */
44 struct list_head tk_task; /* global list of tasks */ 46 struct list_head tk_task; /* global list of tasks */
45 struct rpc_clnt * tk_client; /* RPC client */ 47 struct rpc_clnt * tk_client; /* RPC client */
46 struct rpc_rqst * tk_rqstp; /* RPC request */ 48 struct rpc_rqst * tk_rqstp; /* RPC request */
@@ -50,8 +52,6 @@ struct rpc_task {
50 * RPC call state 52 * RPC call state
51 */ 53 */
52 struct rpc_message tk_msg; /* RPC call info */ 54 struct rpc_message tk_msg; /* RPC call info */
53 __u32 * tk_buffer; /* XDR buffer */
54 size_t tk_bufsize;
55 __u8 tk_garb_retry; 55 __u8 tk_garb_retry;
56 __u8 tk_cred_retry; 56 __u8 tk_cred_retry;
57 57
@@ -61,13 +61,12 @@ struct rpc_task {
61 * timeout_fn to be executed by timer bottom half 61 * timeout_fn to be executed by timer bottom half
62 * callback to be executed after waking up 62 * callback to be executed after waking up
63 * action next procedure for async tasks 63 * action next procedure for async tasks
64 * exit exit async task and report to caller 64 * tk_ops caller callbacks
65 */ 65 */
66 void (*tk_timeout_fn)(struct rpc_task *); 66 void (*tk_timeout_fn)(struct rpc_task *);
67 void (*tk_callback)(struct rpc_task *); 67 void (*tk_callback)(struct rpc_task *);
68 void (*tk_action)(struct rpc_task *); 68 void (*tk_action)(struct rpc_task *);
69 void (*tk_exit)(struct rpc_task *); 69 const struct rpc_call_ops *tk_ops;
70 void (*tk_release)(struct rpc_task *);
71 void * tk_calldata; 70 void * tk_calldata;
72 71
73 /* 72 /*
@@ -78,7 +77,6 @@ struct rpc_task {
78 struct timer_list tk_timer; /* kernel timer */ 77 struct timer_list tk_timer; /* kernel timer */
79 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 78 unsigned long tk_timeout; /* timeout for rpc_sleep() */
80 unsigned short tk_flags; /* misc flags */ 79 unsigned short tk_flags; /* misc flags */
81 unsigned char tk_active : 1;/* Task has been activated */
82 unsigned char tk_priority : 2;/* Task priority */ 80 unsigned char tk_priority : 2;/* Task priority */
83 unsigned long tk_runstate; /* Task run status */ 81 unsigned long tk_runstate; /* Task run status */
84 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 82 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
@@ -111,6 +109,13 @@ struct rpc_task {
111 109
112typedef void (*rpc_action)(struct rpc_task *); 110typedef void (*rpc_action)(struct rpc_task *);
113 111
112struct rpc_call_ops {
113 void (*rpc_call_prepare)(struct rpc_task *, void *);
114 void (*rpc_call_done)(struct rpc_task *, void *);
115 void (*rpc_release)(void *);
116};
117
118
114/* 119/*
115 * RPC task flags 120 * RPC task flags
116 */ 121 */
@@ -129,7 +134,6 @@ typedef void (*rpc_action)(struct rpc_task *);
129#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 134#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
130#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) 135#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS)
131#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 136#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
132#define RPC_IS_ACTIVATED(t) ((t)->tk_active)
133#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL) 137#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL)
134#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) 138#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT)
135#define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR) 139#define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR)
@@ -138,6 +142,7 @@ typedef void (*rpc_action)(struct rpc_task *);
138#define RPC_TASK_QUEUED 1 142#define RPC_TASK_QUEUED 1
139#define RPC_TASK_WAKEUP 2 143#define RPC_TASK_WAKEUP 2
140#define RPC_TASK_HAS_TIMER 3 144#define RPC_TASK_HAS_TIMER 3
145#define RPC_TASK_ACTIVE 4
141 146
142#define RPC_IS_RUNNING(t) (test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) 147#define RPC_IS_RUNNING(t) (test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
143#define rpc_set_running(t) (set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) 148#define rpc_set_running(t) (set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
@@ -168,6 +173,15 @@ typedef void (*rpc_action)(struct rpc_task *);
168 smp_mb__after_clear_bit(); \ 173 smp_mb__after_clear_bit(); \
169 } while (0) 174 } while (0)
170 175
176#define RPC_IS_ACTIVATED(t) (test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate))
177#define rpc_set_active(t) (set_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate))
178#define rpc_clear_active(t) \
179 do { \
180 smp_mb__before_clear_bit(); \
181 clear_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate); \
182 smp_mb__after_clear_bit(); \
183 } while(0)
184
171/* 185/*
172 * Task priorities. 186 * Task priorities.
173 * Note: if you change these, you must also change 187 * Note: if you change these, you must also change
@@ -228,11 +242,16 @@ struct rpc_wait_queue {
228/* 242/*
229 * Function prototypes 243 * Function prototypes
230 */ 244 */
231struct rpc_task *rpc_new_task(struct rpc_clnt *, rpc_action, int flags); 245struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags,
246 const struct rpc_call_ops *ops, void *data);
247struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
248 const struct rpc_call_ops *ops, void *data);
232struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent); 249struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent);
233void rpc_init_task(struct rpc_task *, struct rpc_clnt *, 250void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
234 rpc_action exitfunc, int flags); 251 int flags, const struct rpc_call_ops *ops,
252 void *data);
235void rpc_release_task(struct rpc_task *); 253void rpc_release_task(struct rpc_task *);
254void rpc_exit_task(struct rpc_task *);
236void rpc_killall_tasks(struct rpc_clnt *); 255void rpc_killall_tasks(struct rpc_clnt *);
237int rpc_execute(struct rpc_task *); 256int rpc_execute(struct rpc_task *);
238void rpc_run_child(struct rpc_task *parent, struct rpc_task *child, 257void rpc_run_child(struct rpc_task *parent, struct rpc_task *child,
@@ -247,9 +266,11 @@ struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
247void rpc_wake_up_status(struct rpc_wait_queue *, int); 266void rpc_wake_up_status(struct rpc_wait_queue *, int);
248void rpc_delay(struct rpc_task *, unsigned long); 267void rpc_delay(struct rpc_task *, unsigned long);
249void * rpc_malloc(struct rpc_task *, size_t); 268void * rpc_malloc(struct rpc_task *, size_t);
269void rpc_free(struct rpc_task *);
250int rpciod_up(void); 270int rpciod_up(void);
251void rpciod_down(void); 271void rpciod_down(void);
252void rpciod_wake_up(void); 272void rpciod_wake_up(void);
273int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
253#ifdef RPC_DEBUG 274#ifdef RPC_DEBUG
254void rpc_show_tasks(void); 275void rpc_show_tasks(void);
255#endif 276#endif
@@ -259,7 +280,12 @@ void rpc_destroy_mempool(void);
259static inline void rpc_exit(struct rpc_task *task, int status) 280static inline void rpc_exit(struct rpc_task *task, int status)
260{ 281{
261 task->tk_status = status; 282 task->tk_status = status;
262 task->tk_action = NULL; 283 task->tk_action = rpc_exit_task;
284}
285
286static inline int rpc_wait_for_completion_task(struct rpc_task *task)
287{
288 return __rpc_wait_for_completion_task(task, NULL);
263} 289}
264 290
265#ifdef RPC_DEBUG 291#ifdef RPC_DEBUG
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 5da968729cf8..84c35d42d250 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -91,7 +91,6 @@ struct xdr_buf {
91u32 * xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len); 91u32 * xdr_encode_opaque_fixed(u32 *p, const void *ptr, unsigned int len);
92u32 * xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len); 92u32 * xdr_encode_opaque(u32 *p, const void *ptr, unsigned int len);
93u32 * xdr_encode_string(u32 *p, const char *s); 93u32 * xdr_encode_string(u32 *p, const char *s);
94u32 * xdr_decode_string(u32 *p, char **sp, int *lenp, int maxlen);
95u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen); 94u32 * xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen);
96u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *); 95u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *);
97u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *); 96u32 * xdr_decode_netobj(u32 *p, struct xdr_netobj *);
@@ -135,11 +134,6 @@ xdr_adjust_iovec(struct kvec *iov, u32 *p)
135} 134}
136 135
137/* 136/*
138 * Maximum number of iov's we use.
139 */
140#define MAX_IOVEC (12)
141
142/*
143 * XDR buffer helper functions 137 * XDR buffer helper functions
144 */ 138 */
145extern void xdr_shift_buf(struct xdr_buf *, size_t); 139extern void xdr_shift_buf(struct xdr_buf *, size_t);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 3b8b6e823c70..6ef99b14ff09 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -79,21 +79,19 @@ struct rpc_rqst {
79 void (*rq_release_snd_buf)(struct rpc_rqst *); /* release rq_enc_pages */ 79 void (*rq_release_snd_buf)(struct rpc_rqst *); /* release rq_enc_pages */
80 struct list_head rq_list; 80 struct list_head rq_list;
81 81
82 __u32 * rq_buffer; /* XDR encode buffer */
83 size_t rq_bufsize;
84
82 struct xdr_buf rq_private_buf; /* The receive buffer 85 struct xdr_buf rq_private_buf; /* The receive buffer
83 * used in the softirq. 86 * used in the softirq.
84 */ 87 */
85 unsigned long rq_majortimeo; /* major timeout alarm */ 88 unsigned long rq_majortimeo; /* major timeout alarm */
86 unsigned long rq_timeout; /* Current timeout value */ 89 unsigned long rq_timeout; /* Current timeout value */
87 unsigned int rq_retries; /* # of retries */ 90 unsigned int rq_retries; /* # of retries */
88 /*
89 * For authentication (e.g. auth_des)
90 */
91 u32 rq_creddata[2];
92 91
93 /* 92 /*
94 * Partial send handling 93 * Partial send handling
95 */ 94 */
96
97 u32 rq_bytes_sent; /* Bytes we have sent */ 95 u32 rq_bytes_sent; /* Bytes we have sent */
98 96
99 unsigned long rq_xtime; /* when transmitted */ 97 unsigned long rq_xtime; /* when transmitted */
@@ -106,7 +104,10 @@ struct rpc_xprt_ops {
106 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); 104 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);
107 int (*reserve_xprt)(struct rpc_task *task); 105 int (*reserve_xprt)(struct rpc_task *task);
108 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 106 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
107 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
109 void (*connect)(struct rpc_task *task); 108 void (*connect)(struct rpc_task *task);
109 void * (*buf_alloc)(struct rpc_task *task, size_t size);
110 void (*buf_free)(struct rpc_task *task);
110 int (*send_request)(struct rpc_task *task); 111 int (*send_request)(struct rpc_task *task);
111 void (*set_retrans_timeout)(struct rpc_task *task); 112 void (*set_retrans_timeout)(struct rpc_task *task);
112 void (*timer)(struct rpc_task *task); 113 void (*timer)(struct rpc_task *task);
@@ -253,6 +254,7 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to);
253#define XPRT_LOCKED (0) 254#define XPRT_LOCKED (0)
254#define XPRT_CONNECTED (1) 255#define XPRT_CONNECTED (1)
255#define XPRT_CONNECTING (2) 256#define XPRT_CONNECTING (2)
257#define XPRT_CLOSE_WAIT (3)
256 258
257static inline void xprt_set_connected(struct rpc_xprt *xprt) 259static inline void xprt_set_connected(struct rpc_xprt *xprt)
258{ 260{
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index a61c04f804b2..5dc94e777fab 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -14,11 +14,7 @@
14typedef struct pbe { 14typedef struct pbe {
15 unsigned long address; /* address of the copy */ 15 unsigned long address; /* address of the copy */
16 unsigned long orig_address; /* original address of page */ 16 unsigned long orig_address; /* original address of page */
17 swp_entry_t swap_address; 17 struct pbe *next;
18
19 struct pbe *next; /* also used as scratch space at
20 * end of page (see link, diskpage)
21 */
22} suspend_pagedir_t; 18} suspend_pagedir_t;
23 19
24#define for_each_pbe(pbe, pblist) \ 20#define for_each_pbe(pbe, pblist) \
@@ -77,6 +73,6 @@ unsigned long get_safe_page(gfp_t gfp_mask);
77 * XXX: We try to keep some more pages free so that I/O operations succeed 73 * XXX: We try to keep some more pages free so that I/O operations succeed
78 * without paging. Might this be more? 74 * without paging. Might this be more?
79 */ 75 */
80#define PAGES_FOR_IO 512 76#define PAGES_FOR_IO 1024
81 77
82#endif /* _LINUX_SWSUSP_H */ 78#endif /* _LINUX_SWSUSP_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 508668f840b6..389d1c382e20 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -172,10 +172,16 @@ extern void swap_setup(void);
172 172
173/* linux/mm/vmscan.c */ 173/* linux/mm/vmscan.c */
174extern int try_to_free_pages(struct zone **, gfp_t); 174extern int try_to_free_pages(struct zone **, gfp_t);
175extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
176extern int shrink_all_memory(int); 175extern int shrink_all_memory(int);
177extern int vm_swappiness; 176extern int vm_swappiness;
178 177
178#ifdef CONFIG_MIGRATION
179extern int isolate_lru_page(struct page *p);
180extern int putback_lru_pages(struct list_head *l);
181extern int migrate_pages(struct list_head *l, struct list_head *t,
182 struct list_head *moved, struct list_head *failed);
183#endif
184
179#ifdef CONFIG_MMU 185#ifdef CONFIG_MMU
180/* linux/mm/shmem.c */ 186/* linux/mm/shmem.c */
181extern int shmem_unuse(swp_entry_t entry, struct page *page); 187extern int shmem_unuse(swp_entry_t entry, struct page *page);
@@ -193,7 +199,7 @@ extern int rw_swap_page_sync(int, swp_entry_t, struct page *);
193extern struct address_space swapper_space; 199extern struct address_space swapper_space;
194#define total_swapcache_pages swapper_space.nrpages 200#define total_swapcache_pages swapper_space.nrpages
195extern void show_swap_cache_info(void); 201extern void show_swap_cache_info(void);
196extern int add_to_swap(struct page *); 202extern int add_to_swap(struct page *, gfp_t);
197extern void __delete_from_swap_cache(struct page *); 203extern void __delete_from_swap_cache(struct page *);
198extern void delete_from_swap_cache(struct page *); 204extern void delete_from_swap_cache(struct page *);
199extern int move_to_swap_cache(struct page *, swp_entry_t); 205extern int move_to_swap_cache(struct page *, swp_entry_t);
@@ -210,6 +216,7 @@ extern unsigned int nr_swapfiles;
210extern struct swap_info_struct swap_info[]; 216extern struct swap_info_struct swap_info[];
211extern void si_swapinfo(struct sysinfo *); 217extern void si_swapinfo(struct sysinfo *);
212extern swp_entry_t get_swap_page(void); 218extern swp_entry_t get_swap_page(void);
219extern swp_entry_t get_swap_page_of_type(int type);
213extern int swap_duplicate(swp_entry_t); 220extern int swap_duplicate(swp_entry_t);
214extern int valid_swaphandles(swp_entry_t, unsigned long *); 221extern int valid_swaphandles(swp_entry_t, unsigned long *);
215extern void swap_free(swp_entry_t); 222extern void swap_free(swp_entry_t);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 763bd290f28d..1b7cd8d1a71b 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * SyncLink Multiprotocol Serial Adapter Driver 2 * SyncLink Multiprotocol Serial Adapter Driver
3 * 3 *
4 * $Id: synclink.h,v 3.6 2002/02/20 21:58:20 paulkf Exp $ 4 * $Id: synclink.h,v 3.10 2005/11/08 19:50:54 paulkf Exp $
5 * 5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation 6 * Copyright (C) 1998-2000 by Microgate Corporation
7 * 7 *
@@ -128,10 +128,14 @@
128#define MGSL_BUS_TYPE_EISA 2 128#define MGSL_BUS_TYPE_EISA 2
129#define MGSL_BUS_TYPE_PCI 5 129#define MGSL_BUS_TYPE_PCI 5
130 130
131#define MGSL_INTERFACE_MASK 0xf
131#define MGSL_INTERFACE_DISABLE 0 132#define MGSL_INTERFACE_DISABLE 0
132#define MGSL_INTERFACE_RS232 1 133#define MGSL_INTERFACE_RS232 1
133#define MGSL_INTERFACE_V35 2 134#define MGSL_INTERFACE_V35 2
134#define MGSL_INTERFACE_RS422 3 135#define MGSL_INTERFACE_RS422 3
136#define MGSL_INTERFACE_RTS_EN 0x10
137#define MGSL_INTERFACE_LL 0x20
138#define MGSL_INTERFACE_RL 0x40
135 139
136typedef struct _MGSL_PARAMS 140typedef struct _MGSL_PARAMS
137{ 141{
@@ -163,6 +167,9 @@ typedef struct _MGSL_PARAMS
163#define SYNCLINK_DEVICE_ID 0x0010 167#define SYNCLINK_DEVICE_ID 0x0010
164#define MGSCC_DEVICE_ID 0x0020 168#define MGSCC_DEVICE_ID 0x0020
165#define SYNCLINK_SCA_DEVICE_ID 0x0030 169#define SYNCLINK_SCA_DEVICE_ID 0x0030
170#define SYNCLINK_GT_DEVICE_ID 0x0070
171#define SYNCLINK_GT4_DEVICE_ID 0x0080
172#define SYNCLINK_AC_DEVICE_ID 0x0090
166#define MGSL_MAX_SERIAL_NUMBER 30 173#define MGSL_MAX_SERIAL_NUMBER 30
167 174
168/* 175/*
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index c7007b1db91d..3eed47347013 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -511,5 +511,12 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio);
511asmlinkage long sys_ioprio_get(int which, int who); 511asmlinkage long sys_ioprio_get(int which, int who);
512asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask, 512asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
513 unsigned long maxnode); 513 unsigned long maxnode);
514asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
515 const unsigned long __user *from, const unsigned long __user *to);
516
517asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
518 __u32 __user *ustatus);
519asmlinkage long sys_spu_create(const char __user *name,
520 unsigned int flags, mode_t mode);
514 521
515#endif 522#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 4be34ef8c2f7..7f472127b7b5 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -124,7 +124,7 @@ enum
124 KERN_OVERFLOWUID=46, /* int: overflow UID */ 124 KERN_OVERFLOWUID=46, /* int: overflow UID */
125 KERN_OVERFLOWGID=47, /* int: overflow GID */ 125 KERN_OVERFLOWGID=47, /* int: overflow GID */
126 KERN_SHMPATH=48, /* string: path to shm fs */ 126 KERN_SHMPATH=48, /* string: path to shm fs */
127 KERN_HOTPLUG=49, /* string: path to hotplug policy agent */ 127 KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */
128 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */ 128 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */
129 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */ 129 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */
130 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */ 130 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
@@ -180,6 +180,8 @@ enum
180 VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */ 180 VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */
181 VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */ 181 VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */
182 VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */ 182 VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */
183 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */
184 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
183}; 185};
184 186
185 187
@@ -390,6 +392,7 @@ enum
390 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, 392 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
391 NET_TCP_CONG_CONTROL=110, 393 NET_TCP_CONG_CONTROL=110,
392 NET_TCP_ABC=111, 394 NET_TCP_ABC=111,
395 NET_IPV4_IPFRAG_MAX_DIST=112,
393}; 396};
394 397
395enum { 398enum {
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 0e1da6602e05..f2bb2396853f 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -55,22 +55,6 @@ struct tcphdr {
55 __u16 urg_ptr; 55 __u16 urg_ptr;
56}; 56};
57 57
58#define TCP_ACTION_FIN (1 << 7)
59
60enum {
61 TCPF_ESTABLISHED = (1 << 1),
62 TCPF_SYN_SENT = (1 << 2),
63 TCPF_SYN_RECV = (1 << 3),
64 TCPF_FIN_WAIT1 = (1 << 4),
65 TCPF_FIN_WAIT2 = (1 << 5),
66 TCPF_TIME_WAIT = (1 << 6),
67 TCPF_CLOSE = (1 << 7),
68 TCPF_CLOSE_WAIT = (1 << 8),
69 TCPF_LAST_ACK = (1 << 9),
70 TCPF_LISTEN = (1 << 10),
71 TCPF_CLOSING = (1 << 11)
72};
73
74/* 58/*
75 * The union cast uses a gcc extension to avoid aliasing problems 59 * The union cast uses a gcc extension to avoid aliasing problems
76 * (union is compatible to any of its members) 60 * (union is compatible to any of its members)
@@ -254,10 +238,9 @@ struct tcp_sock {
254 __u32 snd_wl1; /* Sequence for window update */ 238 __u32 snd_wl1; /* Sequence for window update */
255 __u32 snd_wnd; /* The window we expect to receive */ 239 __u32 snd_wnd; /* The window we expect to receive */
256 __u32 max_window; /* Maximal window ever seen from peer */ 240 __u32 max_window; /* Maximal window ever seen from peer */
257 __u32 pmtu_cookie; /* Last pmtu seen by socket */
258 __u32 mss_cache; /* Cached effective mss, not including SACKS */ 241 __u32 mss_cache; /* Cached effective mss, not including SACKS */
259 __u16 xmit_size_goal; /* Goal for segmenting output packets */ 242 __u16 xmit_size_goal; /* Goal for segmenting output packets */
260 __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ 243 /* XXX Two bytes hole, try to pack */
261 244
262 __u32 window_clamp; /* Maximal window to advertise */ 245 __u32 window_clamp; /* Maximal window to advertise */
263 __u32 rcv_ssthresh; /* Current window clamp */ 246 __u32 rcv_ssthresh; /* Current window clamp */
@@ -295,8 +278,6 @@ struct tcp_sock {
295 278
296 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 279 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
297 280
298 struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */
299
300 __u32 rcv_wnd; /* Current receiver window */ 281 __u32 rcv_wnd; /* Current receiver window */
301 __u32 rcv_wup; /* rcv_nxt on last window update sent */ 282 __u32 rcv_wup; /* rcv_nxt on last window update sent */
302 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 283 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
diff --git a/include/linux/time.h b/include/linux/time.h
index 797ccd813bb0..f2aca7ec6325 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -4,7 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7#include <linux/seqlock.h> 7# include <linux/seqlock.h>
8#endif 8#endif
9 9
10#ifndef _STRUCT_TIMESPEC 10#ifndef _STRUCT_TIMESPEC
@@ -13,7 +13,7 @@ struct timespec {
13 time_t tv_sec; /* seconds */ 13 time_t tv_sec; /* seconds */
14 long tv_nsec; /* nanoseconds */ 14 long tv_nsec; /* nanoseconds */
15}; 15};
16#endif /* _STRUCT_TIMESPEC */ 16#endif
17 17
18struct timeval { 18struct timeval {
19 time_t tv_sec; /* seconds */ 19 time_t tv_sec; /* seconds */
@@ -27,93 +27,103 @@ struct timezone {
27 27
28#ifdef __KERNEL__ 28#ifdef __KERNEL__
29 29
30/* Parameters used to convert the timespec values */ 30/* Parameters used to convert the timespec values: */
31#define MSEC_PER_SEC (1000L) 31#define MSEC_PER_SEC 1000L
32#define USEC_PER_SEC (1000000L) 32#define USEC_PER_SEC 1000000L
33#define NSEC_PER_SEC (1000000000L) 33#define NSEC_PER_SEC 1000000000L
34#define NSEC_PER_USEC (1000L) 34#define NSEC_PER_USEC 1000L
35 35
36static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) 36static __inline__ int timespec_equal(struct timespec *a, struct timespec *b)
37{ 37{
38 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); 38 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
39} 39}
40 40
41/* Converts Gregorian date to seconds since 1970-01-01 00:00:00. 41extern unsigned long mktime(const unsigned int year, const unsigned int mon,
42 * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 42 const unsigned int day, const unsigned int hour,
43 * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. 43 const unsigned int min, const unsigned int sec);
44 * 44
45 * [For the Julian calendar (which was used in Russia before 1917, 45extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
46 * Britain & colonies before 1752, anywhere else before 1582, 46
47 * and is still in use by some communities) leave out the 47/*
48 * -year/100+year/400 terms, and add 10.] 48 * Returns true if the timespec is norm, false if denorm:
49 *
50 * This algorithm was first published by Gauss (I think).
51 *
52 * WARNING: this function will overflow on 2106-02-07 06:28:16 on
53 * machines were long is 32-bit! (However, as time_t is signed, we
54 * will already get problems at other places on 2038-01-19 03:14:08)
55 */ 49 */
56static inline unsigned long 50#define timespec_valid(ts) \
57mktime (unsigned int year, unsigned int mon, 51 (((ts)->tv_sec >= 0) && (((unsigned) (ts)->tv_nsec) < NSEC_PER_SEC))
58 unsigned int day, unsigned int hour, 52
59 unsigned int min, unsigned int sec) 53/*
60{ 54 * 64-bit nanosec type. Large enough to span 292+ years in nanosecond
61 if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ 55 * resolution. Ought to be enough for a while.
62 mon += 12; /* Puts Feb last since it has leap day */ 56 */
63 year -= 1; 57typedef s64 nsec_t;
64 }
65
66 return (((
67 (unsigned long) (year/4 - year/100 + year/400 + 367*mon/12 + day) +
68 year*365 - 719499
69 )*24 + hour /* now have hours */
70 )*60 + min /* now have minutes */
71 )*60 + sec; /* finally seconds */
72}
73 58
74extern struct timespec xtime; 59extern struct timespec xtime;
75extern struct timespec wall_to_monotonic; 60extern struct timespec wall_to_monotonic;
76extern seqlock_t xtime_lock; 61extern seqlock_t xtime_lock;
77 62
78static inline unsigned long get_seconds(void) 63static inline unsigned long get_seconds(void)
79{ 64{
80 return xtime.tv_sec; 65 return xtime.tv_sec;
81} 66}
82 67
83struct timespec current_kernel_time(void); 68struct timespec current_kernel_time(void);
84 69
85#define CURRENT_TIME (current_kernel_time()) 70#define CURRENT_TIME (current_kernel_time())
86#define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 }) 71#define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 })
87 72
88extern void do_gettimeofday(struct timeval *tv); 73extern void do_gettimeofday(struct timeval *tv);
89extern int do_settimeofday(struct timespec *tv); 74extern int do_settimeofday(struct timespec *tv);
90extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 75extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz);
91extern void clock_was_set(void); // call when ever the clock is set 76#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
92extern int do_posix_clock_monotonic_gettime(struct timespec *tp); 77extern long do_utimes(char __user *filename, struct timeval *times);
93extern long do_utimes(char __user * filename, struct timeval * times);
94struct itimerval; 78struct itimerval;
95extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue); 79extern int do_setitimer(int which, struct itimerval *value,
80 struct itimerval *ovalue);
96extern int do_getitimer(int which, struct itimerval *value); 81extern int do_getitimer(int which, struct itimerval *value);
97extern void getnstimeofday (struct timespec *tv); 82extern void getnstimeofday(struct timespec *tv);
98extern void getnstimestamp(struct timespec *ts);
99 83
100extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 84extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
101 85
102static inline void 86/**
103set_normalized_timespec (struct timespec *ts, time_t sec, long nsec) 87 * timespec_to_ns - Convert timespec to nanoseconds
88 * @ts: pointer to the timespec variable to be converted
89 *
90 * Returns the scalar nanosecond representation of the timespec
91 * parameter.
92 */
93static inline nsec_t timespec_to_ns(const struct timespec *ts)
104{ 94{
105 while (nsec >= NSEC_PER_SEC) { 95 return ((nsec_t) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
106 nsec -= NSEC_PER_SEC;
107 ++sec;
108 }
109 while (nsec < 0) {
110 nsec += NSEC_PER_SEC;
111 --sec;
112 }
113 ts->tv_sec = sec;
114 ts->tv_nsec = nsec;
115} 96}
116 97
98/**
99 * timeval_to_ns - Convert timeval to nanoseconds
100 * @ts: pointer to the timeval variable to be converted
101 *
102 * Returns the scalar nanosecond representation of the timeval
103 * parameter.
104 */
105static inline nsec_t timeval_to_ns(const struct timeval *tv)
106{
107 return ((nsec_t) tv->tv_sec * NSEC_PER_SEC) +
108 tv->tv_usec * NSEC_PER_USEC;
109}
110
111/**
112 * ns_to_timespec - Convert nanoseconds to timespec
113 * @nsec: the nanoseconds value to be converted
114 *
115 * Returns the timespec representation of the nsec parameter.
116 */
117extern struct timespec ns_to_timespec(const nsec_t nsec);
118
119/**
120 * ns_to_timeval - Convert nanoseconds to timeval
121 * @nsec: the nanoseconds value to be converted
122 *
123 * Returns the timeval representation of the nsec parameter.
124 */
125extern struct timeval ns_to_timeval(const nsec_t nsec);
126
117#endif /* __KERNEL__ */ 127#endif /* __KERNEL__ */
118 128
119#define NFDBITS __NFDBITS 129#define NFDBITS __NFDBITS
@@ -126,49 +136,41 @@ set_normalized_timespec (struct timespec *ts, time_t sec, long nsec)
126 136
127/* 137/*
128 * Names of the interval timers, and structure 138 * Names of the interval timers, and structure
129 * defining a timer setting. 139 * defining a timer setting:
130 */ 140 */
131#define ITIMER_REAL 0 141#define ITIMER_REAL 0
132#define ITIMER_VIRTUAL 1 142#define ITIMER_VIRTUAL 1
133#define ITIMER_PROF 2 143#define ITIMER_PROF 2
134 144
135struct itimerspec { 145struct itimerspec {
136 struct timespec it_interval; /* timer period */ 146 struct timespec it_interval; /* timer period */
137 struct timespec it_value; /* timer expiration */ 147 struct timespec it_value; /* timer expiration */
138}; 148};
139 149
140struct itimerval { 150struct itimerval {
141 struct timeval it_interval; /* timer interval */ 151 struct timeval it_interval; /* timer interval */
142 struct timeval it_value; /* current value */ 152 struct timeval it_value; /* current value */
143}; 153};
144 154
145
146/* 155/*
147 * The IDs of the various system clocks (for POSIX.1b interval timers). 156 * The IDs of the various system clocks (for POSIX.1b interval timers):
148 */ 157 */
149#define CLOCK_REALTIME 0 158#define CLOCK_REALTIME 0
150#define CLOCK_MONOTONIC 1 159#define CLOCK_MONOTONIC 1
151#define CLOCK_PROCESS_CPUTIME_ID 2 160#define CLOCK_PROCESS_CPUTIME_ID 2
152#define CLOCK_THREAD_CPUTIME_ID 3 161#define CLOCK_THREAD_CPUTIME_ID 3
153#define CLOCK_REALTIME_HR 4
154#define CLOCK_MONOTONIC_HR 5
155 162
156/* 163/*
157 * The IDs of various hardware clocks 164 * The IDs of various hardware clocks:
158 */ 165 */
159 166#define CLOCK_SGI_CYCLE 10
160 167#define MAX_CLOCKS 16
161#define CLOCK_SGI_CYCLE 10 168#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
162#define MAX_CLOCKS 16 169#define CLOCKS_MONO CLOCK_MONOTONIC
163#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC | \
164 CLOCK_REALTIME_HR | CLOCK_MONOTONIC_HR)
165#define CLOCKS_MONO (CLOCK_MONOTONIC & CLOCK_MONOTONIC_HR)
166 170
167/* 171/*
168 * The various flags for setting POSIX.1b interval timers. 172 * The various flags for setting POSIX.1b interval timers:
169 */ 173 */
170 174#define TIMER_ABSTIME 0x01
171#define TIMER_ABSTIME 0x01
172
173 175
174#endif 176#endif
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 72f3a7781106..9b9877fd2505 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -96,6 +96,6 @@ static inline void add_timer(struct timer_list *timer)
96 96
97extern void init_timers(void); 97extern void init_timers(void);
98extern void run_local_timers(void); 98extern void run_local_timers(void);
99extern void it_real_fn(unsigned long); 99extern int it_real_fn(void *);
100 100
101#endif 101#endif
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 3df1d474e5c5..315a5163d6a0 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -86,7 +86,6 @@
86 .max_interval = 2, \ 86 .max_interval = 2, \
87 .busy_factor = 8, \ 87 .busy_factor = 8, \
88 .imbalance_pct = 110, \ 88 .imbalance_pct = 110, \
89 .cache_hot_time = 0, \
90 .cache_nice_tries = 0, \ 89 .cache_nice_tries = 0, \
91 .per_cpu_gain = 25, \ 90 .per_cpu_gain = 25, \
92 .busy_idx = 0, \ 91 .busy_idx = 0, \
@@ -117,7 +116,6 @@
117 .max_interval = 4, \ 116 .max_interval = 4, \
118 .busy_factor = 64, \ 117 .busy_factor = 64, \
119 .imbalance_pct = 125, \ 118 .imbalance_pct = 125, \
120 .cache_hot_time = (5*1000000/2), \
121 .cache_nice_tries = 1, \ 119 .cache_nice_tries = 1, \
122 .per_cpu_gain = 100, \ 120 .per_cpu_gain = 100, \
123 .busy_idx = 2, \ 121 .busy_idx = 2, \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1267f88ece6e..3787102e4b12 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,6 +23,7 @@
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <linux/tty_driver.h> 24#include <linux/tty_driver.h>
25#include <linux/tty_ldisc.h> 25#include <linux/tty_ldisc.h>
26#include <linux/screen_info.h>
26 27
27#include <asm/system.h> 28#include <asm/system.h>
28 29
@@ -37,77 +38,6 @@
37#define NR_LDISCS 16 38#define NR_LDISCS 16
38 39
39/* 40/*
40 * These are set up by the setup-routine at boot-time:
41 */
42
43struct screen_info {
44 u8 orig_x; /* 0x00 */
45 u8 orig_y; /* 0x01 */
46 u16 dontuse1; /* 0x02 -- EXT_MEM_K sits here */
47 u16 orig_video_page; /* 0x04 */
48 u8 orig_video_mode; /* 0x06 */
49 u8 orig_video_cols; /* 0x07 */
50 u16 unused2; /* 0x08 */
51 u16 orig_video_ega_bx; /* 0x0a */
52 u16 unused3; /* 0x0c */
53 u8 orig_video_lines; /* 0x0e */
54 u8 orig_video_isVGA; /* 0x0f */
55 u16 orig_video_points; /* 0x10 */
56
57 /* VESA graphic mode -- linear frame buffer */
58 u16 lfb_width; /* 0x12 */
59 u16 lfb_height; /* 0x14 */
60 u16 lfb_depth; /* 0x16 */
61 u32 lfb_base; /* 0x18 */
62 u32 lfb_size; /* 0x1c */
63 u16 dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */
64 u16 lfb_linelength; /* 0x24 */
65 u8 red_size; /* 0x26 */
66 u8 red_pos; /* 0x27 */
67 u8 green_size; /* 0x28 */
68 u8 green_pos; /* 0x29 */
69 u8 blue_size; /* 0x2a */
70 u8 blue_pos; /* 0x2b */
71 u8 rsvd_size; /* 0x2c */
72 u8 rsvd_pos; /* 0x2d */
73 u16 vesapm_seg; /* 0x2e */
74 u16 vesapm_off; /* 0x30 */
75 u16 pages; /* 0x32 */
76 u16 vesa_attributes; /* 0x34 */
77 u32 capabilities; /* 0x36 */
78 /* 0x3a -- 0x3f reserved for future expansion */
79};
80
81extern struct screen_info screen_info;
82
83#define ORIG_X (screen_info.orig_x)
84#define ORIG_Y (screen_info.orig_y)
85#define ORIG_VIDEO_MODE (screen_info.orig_video_mode)
86#define ORIG_VIDEO_COLS (screen_info.orig_video_cols)
87#define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx)
88#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
89#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
90#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
91
92#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */
93#define VIDEO_TYPE_CGA 0x11 /* CGA Display */
94#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */
95#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */
96#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */
97#define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
98
99#define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */
100#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */
101#define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */
102
103#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */
104
105#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */
106#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */
107
108#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
109
110/*
111 * This character is the same as _POSIX_VDISABLE: it cannot be used as 41 * This character is the same as _POSIX_VDISABLE: it cannot be used as
112 * a c_cc[] character, but indicates that a particular special character 42 * a c_cc[] character, but indicates that a particular special character
113 * isn't in use (eg VINTR has no character etc) 43 * isn't in use (eg VINTR has no character etc)
@@ -121,16 +51,22 @@ extern struct screen_info screen_info;
121 */ 51 */
122#define TTY_FLIPBUF_SIZE 512 52#define TTY_FLIPBUF_SIZE 512
123 53
124struct tty_flip_buffer { 54struct tty_buffer {
55 struct tty_buffer *next;
56 char *char_buf_ptr;
57 unsigned char *flag_buf_ptr;
58 int used;
59 int size;
60 /* Data points here */
61 unsigned long data[0];
62};
63
64struct tty_bufhead {
125 struct work_struct work; 65 struct work_struct work;
126 struct semaphore pty_sem; 66 struct semaphore pty_sem;
127 char *char_buf_ptr; 67 struct tty_buffer *head; /* Queue head */
128 unsigned char *flag_buf_ptr; 68 struct tty_buffer *tail; /* Active buffer */
129 int count; 69 struct tty_buffer *free; /* Free queue head */
130 int buf_num;
131 unsigned char char_buf[2*TTY_FLIPBUF_SIZE];
132 char flag_buf[2*TTY_FLIPBUF_SIZE];
133 unsigned char slop[4]; /* N.B. bug overwrites buffer by 1 */
134}; 70};
135/* 71/*
136 * The pty uses char_buf and flag_buf as a contiguous buffer 72 * The pty uses char_buf and flag_buf as a contiguous buffer
@@ -256,10 +192,11 @@ struct tty_struct {
256 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; 192 unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1;
257 unsigned char low_latency:1, warned:1; 193 unsigned char low_latency:1, warned:1;
258 unsigned char ctrl_status; 194 unsigned char ctrl_status;
195 unsigned int receive_room; /* Bytes free for queue */
259 196
260 struct tty_struct *link; 197 struct tty_struct *link;
261 struct fasync_struct *fasync; 198 struct fasync_struct *fasync;
262 struct tty_flip_buffer flip; 199 struct tty_bufhead buf;
263 int max_flip_cnt; 200 int max_flip_cnt;
264 int alt_speed; /* For magic substitution of 38400 bps */ 201 int alt_speed; /* For magic substitution of 38400 bps */
265 wait_queue_head_t write_wait; 202 wait_queue_head_t write_wait;
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index abe9bfcf226c..be1400e82482 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -1,25 +1,33 @@
1#ifndef _LINUX_TTY_FLIP_H 1#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_request_room(struct tty_struct *tty, size_t size);
5extern int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size);
6extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size);
7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size);
8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);
9
4#ifdef INCLUDE_INLINE_FUNCS 10#ifdef INCLUDE_INLINE_FUNCS
5#define _INLINE_ extern 11#define _INLINE_ extern
6#else 12#else
7#define _INLINE_ static __inline__ 13#define _INLINE_ static __inline__
8#endif 14#endif
9 15
10_INLINE_ void tty_insert_flip_char(struct tty_struct *tty, 16_INLINE_ int tty_insert_flip_char(struct tty_struct *tty,
11 unsigned char ch, char flag) 17 unsigned char ch, char flag)
12{ 18{
13 if (tty->flip.count < TTY_FLIPBUF_SIZE) { 19 struct tty_buffer *tb = tty->buf.tail;
14 tty->flip.count++; 20 if (tb && tb->used < tb->size) {
15 *tty->flip.flag_buf_ptr++ = flag; 21 tb->flag_buf_ptr[tb->used] = flag;
16 *tty->flip.char_buf_ptr++ = ch; 22 tb->char_buf_ptr[tb->used++] = ch;
23 return 1;
17 } 24 }
25 return tty_insert_flip_string_flags(tty, &ch, &flag, 1);
18} 26}
19 27
20_INLINE_ void tty_schedule_flip(struct tty_struct *tty) 28_INLINE_ void tty_schedule_flip(struct tty_struct *tty)
21{ 29{
22 schedule_delayed_work(&tty->flip.work, 1); 30 schedule_delayed_work(&tty->buf.work, 1);
23} 31}
24 32
25#undef _INLINE_ 33#undef _INLINE_
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 6066afde5ce4..83c6e6c10ebb 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -81,14 +81,6 @@
81 * pointer of flag bytes which indicate whether a character was 81 * pointer of flag bytes which indicate whether a character was
82 * received with a parity error, etc. 82 * received with a parity error, etc.
83 * 83 *
84 * int (*receive_room)(struct tty_struct *);
85 *
86 * This function is called by the low-level tty driver to
87 * determine how many characters the line discpline can accept.
88 * The low-level driver must not send more characters than was
89 * indicated by receive_room, or the line discpline may drop
90 * those characters.
91 *
92 * void (*write_wakeup)(struct tty_struct *); 84 * void (*write_wakeup)(struct tty_struct *);
93 * 85 *
94 * This function is called by the low-level tty driver to signal 86 * This function is called by the low-level tty driver to signal
@@ -136,7 +128,6 @@ struct tty_ldisc {
136 */ 128 */
137 void (*receive_buf)(struct tty_struct *, const unsigned char *cp, 129 void (*receive_buf)(struct tty_struct *, const unsigned char *cp,
138 char *fp, int count); 130 char *fp, int count);
139 int (*receive_room)(struct tty_struct *);
140 void (*write_wakeup)(struct tty_struct *); 131 void (*write_wakeup)(struct tty_struct *);
141 132
142 struct module *owner; 133 struct module *owner;
diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h
index 46e2bb945353..36c684e1b110 100644
--- a/include/linux/udf_fs.h
+++ b/include/linux/udf_fs.h
@@ -13,11 +13,6 @@
13 * http://www.osta.org/ * http://www.ecma.ch/ 13 * http://www.osta.org/ * http://www.ecma.ch/
14 * http://www.iso.org/ 14 * http://www.iso.org/
15 * 15 *
16 * CONTACTS
17 * E-mail regarding any portion of the Linux UDF file system should be
18 * directed to the development team mailing list (run by majordomo):
19 * linux_udf@hpesjro.fc.hp.com
20 *
21 * COPYRIGHT 16 * COPYRIGHT
22 * This file is distributed under the terms of the GNU General Public 17 * This file is distributed under the terms of the GNU General Public
23 * License (GPL). Copies of the GPL can be obtained from: 18 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index 62b15a4214e6..1e7508420fcf 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -3,11 +3,6 @@
3 * 3 *
4 * This file is intended for the Linux kernel/module. 4 * This file is intended for the Linux kernel/module.
5 * 5 *
6 * CONTACTS
7 * E-mail regarding any portion of the Linux UDF file system should be
8 * directed to the development team mailing list (run by majordomo):
9 * linux_udf@hpesjro.fc.hp.com
10 *
11 * COPYRIGHT 6 * COPYRIGHT
12 * This file is distributed under the terms of the GNU General Public 7 * This file is distributed under the terms of the GNU General Public
13 * License (GPL). Copies of the GPL can be obtained from: 8 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
index 1966a6dbb4b6..b15ff2e99c91 100644
--- a/include/linux/udf_fs_sb.h
+++ b/include/linux/udf_fs_sb.h
@@ -3,11 +3,6 @@
3 * 3 *
4 * This include file is for the Linux kernel/module. 4 * This include file is for the Linux kernel/module.
5 * 5 *
6 * CONTACTS
7 * E-mail regarding any portion of the Linux UDF file system should be
8 * directed to the development team mailing list (run by majordomo):
9 * linux_udf@hpesjro.fc.hp.com
10 *
11 * COPYRIGHT 6 * COPYRIGHT
12 * This file is distributed under the terms of the GNU General Public 7 * This file is distributed under the terms of the GNU General Public
13 * License (GPL). Copies of the GPL can be obtained from: 8 * License (GPL). Copies of the GPL can be obtained from:
diff --git a/include/linux/udp.h b/include/linux/udp.h
index b60e0b4a25c4..85a55658831c 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -35,10 +35,10 @@ struct udphdr {
35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ 35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */
36 36
37#ifdef __KERNEL__ 37#ifdef __KERNEL__
38
39#include <linux/config.h> 38#include <linux/config.h>
40#include <net/sock.h> 39#include <linux/types.h>
41#include <linux/ip.h> 40
41#include <net/inet_sock.h>
42 42
43struct udp_sock { 43struct udp_sock {
44 /* inet_sock has to be the first member */ 44 /* inet_sock has to be the first member */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index d81b050e5955..827cc6de5f5c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -225,7 +225,7 @@ struct usb_interface_cache {
225 * Device drivers should not attempt to activate configurations. The choice 225 * Device drivers should not attempt to activate configurations. The choice
226 * of which configuration to install is a policy decision based on such 226 * of which configuration to install is a policy decision based on such
227 * considerations as available power, functionality provided, and the user's 227 * considerations as available power, functionality provided, and the user's
228 * desires (expressed through hotplug scripts). However, drivers can call 228 * desires (expressed through userspace tools). However, drivers can call
229 * usb_reset_configuration() to reinitialize the current configuration and 229 * usb_reset_configuration() to reinitialize the current configuration and
230 * all its interfaces. 230 * all its interfaces.
231 */ 231 */
@@ -329,8 +329,6 @@ struct usb_device {
329 struct usb_tt *tt; /* low/full speed dev, highspeed hub */ 329 struct usb_tt *tt; /* low/full speed dev, highspeed hub */
330 int ttport; /* device port on that tt hub */ 330 int ttport; /* device port on that tt hub */
331 331
332 struct semaphore serialize;
333
334 unsigned int toggle[2]; /* one bit for each endpoint 332 unsigned int toggle[2]; /* one bit for each endpoint
335 * ([0] = IN, [1] = OUT) */ 333 * ([0] = IN, [1] = OUT) */
336 334
@@ -349,6 +347,9 @@ struct usb_device {
349 347
350 char **rawdescriptors; /* Raw descriptors for each config */ 348 char **rawdescriptors; /* Raw descriptors for each config */
351 349
350 unsigned short bus_mA; /* Current available from the bus */
351 u8 portnum; /* Parent port number (origin 1) */
352
352 int have_langid; /* whether string_langid is valid */ 353 int have_langid; /* whether string_langid is valid */
353 int string_langid; /* language ID for strings */ 354 int string_langid; /* language ID for strings */
354 355
@@ -377,11 +378,12 @@ struct usb_device {
377extern struct usb_device *usb_get_dev(struct usb_device *dev); 378extern struct usb_device *usb_get_dev(struct usb_device *dev);
378extern void usb_put_dev(struct usb_device *dev); 379extern void usb_put_dev(struct usb_device *dev);
379 380
380extern void usb_lock_device(struct usb_device *udev); 381/* USB device locking */
381extern int usb_trylock_device(struct usb_device *udev); 382#define usb_lock_device(udev) down(&(udev)->dev.sem)
383#define usb_unlock_device(udev) up(&(udev)->dev.sem)
384#define usb_trylock_device(udev) down_trylock(&(udev)->dev.sem)
382extern int usb_lock_device_for_reset(struct usb_device *udev, 385extern int usb_lock_device_for_reset(struct usb_device *udev,
383 struct usb_interface *iface); 386 struct usb_interface *iface);
384extern void usb_unlock_device(struct usb_device *udev);
385 387
386/* USB port reset for device reinitialization */ 388/* USB port reset for device reinitialization */
387extern int usb_reset_device(struct usb_device *dev); 389extern int usb_reset_device(struct usb_device *dev);
@@ -529,10 +531,13 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
529 531
530/* ----------------------------------------------------------------------- */ 532/* ----------------------------------------------------------------------- */
531 533
534struct usb_dynids {
535 spinlock_t lock;
536 struct list_head list;
537};
538
532/** 539/**
533 * struct usb_driver - identifies USB driver to usbcore 540 * struct usb_driver - identifies USB driver to usbcore
534 * @owner: Pointer to the module owner of this driver; initialize
535 * it using THIS_MODULE.
536 * @name: The driver name should be unique among USB drivers, 541 * @name: The driver name should be unique among USB drivers,
537 * and should normally be the same as the module name. 542 * and should normally be the same as the module name.
538 * @probe: Called to see if the driver is willing to manage a particular 543 * @probe: Called to see if the driver is willing to manage a particular
@@ -553,7 +558,11 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
553 * @id_table: USB drivers use ID table to support hotplugging. 558 * @id_table: USB drivers use ID table to support hotplugging.
554 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set 559 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set
555 * or your driver's probe function will never get called. 560 * or your driver's probe function will never get called.
561 * @dynids: used internally to hold the list of dynamically added device
562 * ids for this driver.
556 * @driver: the driver model core driver structure. 563 * @driver: the driver model core driver structure.
564 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be
565 * added to this driver by preventing the sysfs file from being created.
557 * 566 *
558 * USB drivers must provide a name, probe() and disconnect() methods, 567 * USB drivers must provide a name, probe() and disconnect() methods,
559 * and an id_table. Other driver fields are optional. 568 * and an id_table. Other driver fields are optional.
@@ -571,8 +580,6 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
571 * them as necessary, and blocking until the unlinks complete). 580 * them as necessary, and blocking until the unlinks complete).
572 */ 581 */
573struct usb_driver { 582struct usb_driver {
574 struct module *owner;
575
576 const char *name; 583 const char *name;
577 584
578 int (*probe) (struct usb_interface *intf, 585 int (*probe) (struct usb_interface *intf,
@@ -588,7 +595,9 @@ struct usb_driver {
588 595
589 const struct usb_device_id *id_table; 596 const struct usb_device_id *id_table;
590 597
598 struct usb_dynids dynids;
591 struct device_driver driver; 599 struct device_driver driver;
600 unsigned int no_dynamic_id:1;
592}; 601};
593#define to_usb_driver(d) container_of(d, struct usb_driver, driver) 602#define to_usb_driver(d) container_of(d, struct usb_driver, driver)
594 603
@@ -614,7 +623,11 @@ struct usb_class_driver {
614 * use these in module_init()/module_exit() 623 * use these in module_init()/module_exit()
615 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 624 * and don't forget MODULE_DEVICE_TABLE(usb, ...)
616 */ 625 */
617extern int usb_register(struct usb_driver *); 626int usb_register_driver(struct usb_driver *, struct module *);
627static inline int usb_register(struct usb_driver *driver)
628{
629 return usb_register_driver(driver, THIS_MODULE);
630}
618extern void usb_deregister(struct usb_driver *); 631extern void usb_deregister(struct usb_driver *);
619 632
620extern int usb_register_dev(struct usb_interface *intf, 633extern int usb_register_dev(struct usb_interface *intf,
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
new file mode 100644
index 000000000000..b2d08984a9f7
--- /dev/null
+++ b/include/linux/usb_usual.h
@@ -0,0 +1,126 @@
1/*
2 * Interface to the libusual.
3 *
4 * Copyright (c) 2005 Pete Zaitcev <zaitcev@redhat.com>
5 * Copyright (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
6 * Copyright (c) 1999 Michael Gee (michael@linuxspecific.com)
7 */
8
9#ifndef __LINUX_USB_USUAL_H
10#define __LINUX_USB_USUAL_H
11
12#include <linux/config.h>
13
14/* We should do this for cleanliness... But other usb_foo.h do not do this. */
15/* #include <linux/usb.h> */
16
17/*
18 * The flags field, which we store in usb_device_id.driver_info.
19 * It is compatible with the old usb-storage flags in lower 24 bits.
20 */
21
22/*
23 * Static flag definitions. We use this roundabout technique so that the
24 * proc_info() routine can automatically display a message for each flag.
25 */
26#define US_DO_ALL_FLAGS \
27 US_FLAG(SINGLE_LUN, 0x00000001) \
28 /* allow access to only LUN 0 */ \
29 US_FLAG(NEED_OVERRIDE, 0x00000002) \
30 /* unusual_devs entry is necessary */ \
31 US_FLAG(SCM_MULT_TARG, 0x00000004) \
32 /* supports multiple targets */ \
33 US_FLAG(FIX_INQUIRY, 0x00000008) \
34 /* INQUIRY response needs faking */ \
35 US_FLAG(FIX_CAPACITY, 0x00000010) \
36 /* READ CAPACITY response too big */ \
37 US_FLAG(IGNORE_RESIDUE, 0x00000020) \
38 /* reported residue is wrong */ \
39 US_FLAG(BULK32, 0x00000040) \
40 /* Uses 32-byte CBW length */ \
41 US_FLAG(NOT_LOCKABLE, 0x00000080) \
42 /* PREVENT/ALLOW not supported */ \
43 US_FLAG(GO_SLOW, 0x00000100) \
44 /* Need delay after Command phase */ \
45 US_FLAG(NO_WP_DETECT, 0x00000200) \
46 /* Don't check for write-protect */ \
47
48#define US_FLAG(name, value) US_FL_##name = value ,
49enum { US_DO_ALL_FLAGS };
50#undef US_FLAG
51
52/*
53 * The bias field for libusual and friends.
54 */
55#define USB_US_TYPE_NONE 0
56#define USB_US_TYPE_STOR 1 /* usb-storage */
57#define USB_US_TYPE_UB 2 /* ub */
58
59#define USB_US_TYPE(flags) (((flags) >> 24) & 0xFF)
60#define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF)
61
62/*
63 * This is probably not the best place to keep these constants, conceptually.
64 * But it's the only header included into all places which need them.
65 */
66
67/* Sub Classes */
68
69#define US_SC_RBC 0x01 /* Typically, flash devices */
70#define US_SC_8020 0x02 /* CD-ROM */
71#define US_SC_QIC 0x03 /* QIC-157 Tapes */
72#define US_SC_UFI 0x04 /* Floppy */
73#define US_SC_8070 0x05 /* Removable media */
74#define US_SC_SCSI 0x06 /* Transparent */
75#define US_SC_ISD200 0x07 /* ISD200 ATA */
76#define US_SC_MIN US_SC_RBC
77#define US_SC_MAX US_SC_ISD200
78
79#define US_SC_DEVICE 0xff /* Use device's value */
80
81/* Protocols */
82
83#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */
84#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */
85#define US_PR_BULK 0x50 /* bulk only */
86#ifdef CONFIG_USB_STORAGE_USBAT
87#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */
88#endif
89#ifdef CONFIG_USB_STORAGE_SDDR09
90#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
91#endif
92#ifdef CONFIG_USB_STORAGE_SDDR55
93#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */
94#endif
95#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
96#ifdef CONFIG_USB_STORAGE_FREECOM
97#define US_PR_FREECOM 0xf1 /* Freecom */
98#endif
99#ifdef CONFIG_USB_STORAGE_DATAFAB
100#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
101#endif
102#ifdef CONFIG_USB_STORAGE_JUMPSHOT
103#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
104#endif
105#ifdef CONFIG_USB_STORAGE_ALAUDA
106#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
107#endif
108
109#define US_PR_DEVICE 0xff /* Use device's value */
110
111/*
112 */
113#ifdef CONFIG_USB_LIBUSUAL
114
115extern struct usb_device_id storage_usb_ids[];
116extern void usb_usual_set_present(int type);
117extern void usb_usual_clear_present(int type);
118extern int usb_usual_check_type(const struct usb_device_id *, int type);
119#else
120
121#define usb_usual_set_present(t) do { } while(0)
122#define usb_usual_clear_present(t) do { } while(0)
123#define usb_usual_check_type(id, t) (0)
124#endif /* CONFIG_USB_LIBUSUAL */
125
126#endif /* __LINUX_USB_USUAL_H */
diff --git a/include/linux/video_decoder.h b/include/linux/video_decoder.h
index 0e9e48b83e3b..121e26da2c18 100644
--- a/include/linux/video_decoder.h
+++ b/include/linux/video_decoder.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_VIDEO_DECODER_H 1#ifndef _LINUX_VIDEO_DECODER_H
2#define _LINUX_VIDEO_DECODER_H 2#define _LINUX_VIDEO_DECODER_H
3 3
4#define HAVE_VIDEO_DECODER 1
5
4struct video_decoder_capability { /* this name is too long */ 6struct video_decoder_capability { /* this name is too long */
5 __u32 flags; 7 __u32 flags;
6#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */ 8#define VIDEO_DECODER_PAL 1 /* can decode PAL signal */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 1cded681eb6d..ce40675324bd 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -642,6 +642,12 @@ typedef __u64 v4l2_std_id;
642#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) 642#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
643#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) 643#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
644 644
645/* some merged standards */
646#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
647#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
648#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
649#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
650
645/* some common needed stuff */ 651/* some common needed stuff */
646#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ 652#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
647 V4L2_STD_PAL_B1 |\ 653 V4L2_STD_PAL_B1 |\
@@ -662,7 +668,8 @@ typedef __u64 v4l2_std_id;
662 V4L2_STD_SECAM_G |\ 668 V4L2_STD_SECAM_G |\
663 V4L2_STD_SECAM_H |\ 669 V4L2_STD_SECAM_H |\
664 V4L2_STD_SECAM_DK |\ 670 V4L2_STD_SECAM_DK |\
665 V4L2_STD_SECAM_L) 671 V4L2_STD_SECAM_L |\
672 V4L2_STD_SECAM_LC)
666 673
667#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ 674#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
668 V4L2_STD_PAL_60 |\ 675 V4L2_STD_PAL_60 |\
@@ -888,7 +895,6 @@ struct v4l2_audio
888 895
889/* Flags for the 'mode' field */ 896/* Flags for the 'mode' field */
890#define V4L2_AUDMODE_AVL 0x00001 897#define V4L2_AUDMODE_AVL 0x00001
891#define V4L2_AUDMODE_32BITS 0x00002
892 898
893struct v4l2_audioout 899struct v4l2_audioout
894{ 900{
@@ -1110,7 +1116,6 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
1110/* names for fancy debug output */ 1116/* names for fancy debug output */
1111extern char *v4l2_field_names[]; 1117extern char *v4l2_field_names[];
1112extern char *v4l2_type_names[]; 1118extern char *v4l2_type_names[];
1113extern char *v4l2_ioctl_names[];
1114 1119
1115/* Compatibility layer interface -- v4l1-compat module */ 1120/* Compatibility layer interface -- v4l1-compat module */
1116typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, 1121typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
@@ -1118,6 +1123,11 @@ typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
1118int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, 1123int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
1119 int cmd, void *arg, v4l2_kioctl driver_ioctl); 1124 int cmd, void *arg, v4l2_kioctl driver_ioctl);
1120 1125
1126/* 32 Bits compatibility layer for 64 bits processors */
1127extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
1128 unsigned long arg);
1129
1130
1121#endif /* __KERNEL__ */ 1131#endif /* __KERNEL__ */
1122#endif /* __LINUX_VIDEODEV2_H */ 1132#endif /* __LINUX_VIDEODEV2_H */
1123 1133
diff --git a/include/linux/wavefront.h b/include/linux/wavefront.h
index 61bd0fd35240..51ab3c933acd 100644
--- a/include/linux/wavefront.h
+++ b/include/linux/wavefront.h
@@ -434,22 +434,22 @@ typedef struct wf_multisample {
434} wavefront_multisample; 434} wavefront_multisample;
435 435
436typedef struct wf_alias { 436typedef struct wf_alias {
437 INT16 OriginalSample __attribute__ ((packed)); 437 INT16 OriginalSample;
438 438
439 struct wf_sample_offset sampleStartOffset __attribute__ ((packed)); 439 struct wf_sample_offset sampleStartOffset;
440 struct wf_sample_offset loopStartOffset __attribute__ ((packed)); 440 struct wf_sample_offset loopStartOffset;
441 struct wf_sample_offset sampleEndOffset __attribute__ ((packed)); 441 struct wf_sample_offset sampleEndOffset;
442 struct wf_sample_offset loopEndOffset __attribute__ ((packed)); 442 struct wf_sample_offset loopEndOffset;
443 443
444 INT16 FrequencyBias __attribute__ ((packed)); 444 INT16 FrequencyBias;
445 445
446 UCHAR8 SampleResolution:2 __attribute__ ((packed)); 446 UCHAR8 SampleResolution:2;
447 UCHAR8 Unused1:1 __attribute__ ((packed)); 447 UCHAR8 Unused1:1;
448 UCHAR8 Loop:1 __attribute__ ((packed)); 448 UCHAR8 Loop:1;
449 UCHAR8 Bidirectional:1 __attribute__ ((packed)); 449 UCHAR8 Bidirectional:1;
450 UCHAR8 Unused2:1 __attribute__ ((packed)); 450 UCHAR8 Unused2:1;
451 UCHAR8 Reverse:1 __attribute__ ((packed)); 451 UCHAR8 Reverse:1;
452 UCHAR8 Unused3:1 __attribute__ ((packed)); 452 UCHAR8 Unused3:1;
453 453
454 /* This structure is meant to be padded only to 16 bits on their 454 /* This structure is meant to be padded only to 16 bits on their
455 original. Of course, whoever wrote their documentation didn't 455 original. Of course, whoever wrote their documentation didn't
@@ -460,8 +460,8 @@ typedef struct wf_alias {
460 standard 16->32 bit issues. 460 standard 16->32 bit issues.
461 */ 461 */
462 462
463 UCHAR8 sixteen_bit_padding __attribute__ ((packed)); 463 UCHAR8 sixteen_bit_padding;
464} wavefront_alias; 464} __attribute__((packed)) wavefront_alias;
465 465
466typedef struct wf_drum { 466typedef struct wf_drum {
467 UCHAR8 PatchNumber; 467 UCHAR8 PatchNumber;
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index ac39d04d027c..86b111300231 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -65,6 +65,7 @@ extern int FASTCALL(schedule_work(struct work_struct *work));
65extern int FASTCALL(schedule_delayed_work(struct work_struct *work, unsigned long delay)); 65extern int FASTCALL(schedule_delayed_work(struct work_struct *work, unsigned long delay));
66 66
67extern int schedule_delayed_work_on(int cpu, struct work_struct *work, unsigned long delay); 67extern int schedule_delayed_work_on(int cpu, struct work_struct *work, unsigned long delay);
68extern int schedule_on_each_cpu(void (*func)(void *info), void *info);
68extern void flush_scheduled_work(void); 69extern void flush_scheduled_work(void);
69extern int current_is_keventd(void); 70extern int current_is_keventd(void);
70extern int keventd_up(void); 71extern int keventd_up(void);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 343d883d69c5..beaef5c7a0ea 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -53,19 +53,14 @@ struct writeback_control {
53 loff_t start; 53 loff_t start;
54 loff_t end; 54 loff_t end;
55 55
56 unsigned nonblocking:1; /* Don't get stuck on request queues */ 56 unsigned nonblocking:1; /* Don't get stuck on request queues */
57 unsigned encountered_congestion:1; /* An output: a queue is full */ 57 unsigned encountered_congestion:1; /* An output: a queue is full */
58 unsigned for_kupdate:1; /* A kupdate writeback */ 58 unsigned for_kupdate:1; /* A kupdate writeback */
59 unsigned for_reclaim:1; /* Invoked from the page allocator */ 59 unsigned for_reclaim:1; /* Invoked from the page allocator */
60 unsigned for_writepages:1; /* This is a writepages() call */
60}; 61};
61 62
62/* 63/*
63 * ->writepage() return values (make these much larger than a pagesize, in
64 * case some fs is returning number-of-bytes-written from writepage)
65 */
66#define WRITEPAGE_ACTIVATE 0x80000 /* IO was not started: activate page */
67
68/*
69 * fs/fs-writeback.c 64 * fs/fs-writeback.c
70 */ 65 */
71void writeback_inodes(struct writeback_control *wbc); 66void writeback_inodes(struct writeback_control *wbc);
@@ -108,7 +103,9 @@ void balance_dirty_pages_ratelimited(struct address_space *mapping);
108int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); 103int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
109int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 104int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
110int sync_page_range(struct inode *inode, struct address_space *mapping, 105int sync_page_range(struct inode *inode, struct address_space *mapping,
111 loff_t pos, size_t count); 106 loff_t pos, loff_t count);
107int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
108 loff_t pos, loff_t count);
112 109
113/* pdflush.c */ 110/* pdflush.c */
114extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 111extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index 23f9c61d9546..cda8a96e2fa0 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -13,7 +13,22 @@
13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ 13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ 14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
15 15
16/* Namespaces */
17#define XATTR_OS2_PREFIX "os2."
18#define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1)
19
16#define XATTR_SECURITY_PREFIX "security." 20#define XATTR_SECURITY_PREFIX "security."
21#define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1)
22
23#define XATTR_SYSTEM_PREFIX "system."
24#define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1)
25
26#define XATTR_TRUSTED_PREFIX "trusted."
27#define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1)
28
29#define XATTR_USER_PREFIX "user."
30#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
31
17 32
18struct xattr_handler { 33struct xattr_handler {
19 char *prefix; 34 char *prefix;
@@ -25,6 +40,10 @@ struct xattr_handler {
25 size_t size, int flags); 40 size_t size, int flags);
26}; 41};
27 42
43ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t);
44int vfs_setxattr(struct dentry *, char *, void *, size_t, int);
45int vfs_removexattr(struct dentry *, char *);
46
28ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size); 47ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);
29ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); 48ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
30int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags); 49int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags);
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 0fb077d68441..82fbb758e28f 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -27,6 +27,22 @@ struct xfrm_id
27 __u8 proto; 27 __u8 proto;
28}; 28};
29 29
30struct xfrm_sec_ctx {
31 __u8 ctx_doi;
32 __u8 ctx_alg;
33 __u16 ctx_len;
34 __u32 ctx_sid;
35 char ctx_str[0];
36};
37
38/* Security Context Domains of Interpretation */
39#define XFRM_SC_DOI_RESERVED 0
40#define XFRM_SC_DOI_LSM 1
41
42/* Security Context Algorithms */
43#define XFRM_SC_ALG_RESERVED 0
44#define XFRM_SC_ALG_SELINUX 1
45
30/* Selector, used as selector both on policy rules (SPD) and SAs. */ 46/* Selector, used as selector both on policy rules (SPD) and SAs. */
31 47
32struct xfrm_selector 48struct xfrm_selector
@@ -146,6 +162,18 @@ enum {
146 162
147#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) 163#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE)
148 164
165/*
166 * Generic LSM security context for comunicating to user space
167 * NOTE: Same format as sadb_x_sec_ctx
168 */
169struct xfrm_user_sec_ctx {
170 __u16 len;
171 __u16 exttype;
172 __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */
173 __u8 ctx_doi;
174 __u16 ctx_len;
175};
176
149struct xfrm_user_tmpl { 177struct xfrm_user_tmpl {
150 struct xfrm_id id; 178 struct xfrm_id id;
151 __u16 family; 179 __u16 family;
@@ -176,6 +204,7 @@ enum xfrm_attr_type_t {
176 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ 204 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */
177 XFRMA_SA, 205 XFRMA_SA,
178 XFRMA_POLICY, 206 XFRMA_POLICY,
207 XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */
179 __XFRMA_MAX 208 __XFRMA_MAX
180 209
181#define XFRMA_MAX (__XFRMA_MAX - 1) 210#define XFRMA_MAX (__XFRMA_MAX - 1)
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 74f7b78c22d2..4fa32f0d4df8 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -442,9 +442,11 @@ extern int deflateInit2 (z_streamp strm,
442 not perform any compression: this will be done by deflate(). 442 not perform any compression: this will be done by deflate().
443*/ 443*/
444 444
445#if 0
445extern int zlib_deflateSetDictionary (z_streamp strm, 446extern int zlib_deflateSetDictionary (z_streamp strm,
446 const Byte *dictionary, 447 const Byte *dictionary,
447 uInt dictLength); 448 uInt dictLength);
449#endif
448/* 450/*
449 Initializes the compression dictionary from the given byte sequence 451 Initializes the compression dictionary from the given byte sequence
450 without producing any compressed output. This function must be called 452 without producing any compressed output. This function must be called
@@ -478,7 +480,10 @@ extern int zlib_deflateSetDictionary (z_streamp strm,
478 perform any compression: this will be done by deflate(). 480 perform any compression: this will be done by deflate().
479*/ 481*/
480 482
483#if 0
481extern int zlib_deflateCopy (z_streamp dest, z_streamp source); 484extern int zlib_deflateCopy (z_streamp dest, z_streamp source);
485#endif
486
482/* 487/*
483 Sets the destination stream as a complete copy of the source stream. 488 Sets the destination stream as a complete copy of the source stream.
484 489
@@ -511,7 +516,9 @@ static inline unsigned long deflateBound(unsigned long s)
511 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; 516 return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11;
512} 517}
513 518
519#if 0
514extern int zlib_deflateParams (z_streamp strm, int level, int strategy); 520extern int zlib_deflateParams (z_streamp strm, int level, int strategy);
521#endif
515/* 522/*
516 Dynamically update the compression level and compression strategy. The 523 Dynamically update the compression level and compression strategy. The
517 interpretation of level and strategy is as in deflateInit2. This can be 524 interpretation of level and strategy is as in deflateInit2. This can be
@@ -571,7 +578,9 @@ extern int zlib_inflateSetDictionary (z_streamp strm,
571 inflate(). 578 inflate().
572*/ 579*/
573 580
581#if 0
574extern int zlib_inflateSync (z_streamp strm); 582extern int zlib_inflateSync (z_streamp strm);
583#endif
575/* 584/*
576 Skips invalid compressed data until a full flush point (see above the 585 Skips invalid compressed data until a full flush point (see above the
577 description of deflate with Z_FULL_FLUSH) can be found, or until all 586 description of deflate with Z_FULL_FLUSH) can be found, or until all
@@ -636,7 +645,9 @@ extern int zlib_inflateInit2_ (z_streamp strm, int windowBits,
636#endif 645#endif
637 646
638extern const char * zlib_zError (int err); 647extern const char * zlib_zError (int err);
648#if 0
639extern int zlib_inflateSyncPoint (z_streamp z); 649extern int zlib_inflateSyncPoint (z_streamp z);
650#endif
640extern const uLong * zlib_get_crc_table (void); 651extern const uLong * zlib_get_crc_table (void);
641 652
642#endif /* _ZLIB_H */ 653#endif /* _ZLIB_H */
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
index b7d4b0930408..295d256ee811 100644
--- a/include/media/audiochip.h
+++ b/include/media/audiochip.h
@@ -23,11 +23,6 @@ enum audiochip {
23 23
24/* ---------------------------------------------------------------------- */ 24/* ---------------------------------------------------------------------- */
25 25
26/* v4l device was opened in Radio mode */
27#define AUDC_SET_RADIO _IO('m',2)
28/* select from TV,radio,extern,MUTE */
29#define AUDC_SET_INPUT _IOW('m',17,int)
30
31/* audio inputs */ 26/* audio inputs */
32#define AUDIO_TUNER 0x00 27#define AUDIO_TUNER 0x00
33#define AUDIO_RADIO 0x01 28#define AUDIO_RADIO 0x01
@@ -40,15 +35,4 @@ enum audiochip {
40#define AUDIO_MUTE 0x80 35#define AUDIO_MUTE 0x80
41#define AUDIO_UNMUTE 0x81 36#define AUDIO_UNMUTE 0x81
42 37
43/* all the stuff below is obsolete and just here for reference. I'll
44 * remove it once the driver is tested and works fine.
45 *
46 * Instead creating alot of tiny API's for all kinds of different
47 * chips, we'll just pass throuth the v4l ioctl structs (v4l2 not
48 * yet...). It is a bit less flexible, but most/all used i2c chips
49 * make sense in v4l context only. So I think that's acceptable...
50 */
51
52/* misc stuff to pass around config info to i2c chips */
53#define AUDC_CONFIG_PINNACLE _IOW('m',32,int)
54#endif /* AUDIOCHIP_H */ 38#endif /* AUDIOCHIP_H */
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index e5be2b9b846b..2bc634fcb7bb 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -21,14 +21,14 @@
21 21
22extern unsigned int saa7146_debug; 22extern unsigned int saa7146_debug;
23 23
24//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),__stringify(KBUILD_MODNAME),__FUNCTION__) 24//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),KBUILD_MODNAME,__FUNCTION__)
25 25
26#ifndef DEBUG_VARIABLE 26#ifndef DEBUG_VARIABLE
27 #define DEBUG_VARIABLE saa7146_debug 27 #define DEBUG_VARIABLE saa7146_debug
28#endif 28#endif
29 29
30#define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__) 30#define DEBUG_PROLOG printk("%s: %s(): ",KBUILD_MODNAME,__FUNCTION__)
31#define INFO(x) { printk("%s: ",__stringify(KBUILD_MODNAME)); printk x; } 31#define INFO(x) { printk("%s: ",KBUILD_MODNAME); printk x; }
32 32
33#define ERR(x) { DEBUG_PROLOG; printk x; } 33#define ERR(x) { DEBUG_PROLOG; printk x; }
34 34
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 16af9299315f..e5e749e984ee 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -178,6 +178,8 @@ struct saa7146_ext_vv
178 178
179 struct saa7146_extension_ioctls *ioctls; 179 struct saa7146_extension_ioctls *ioctls;
180 int (*ioctl)(struct saa7146_fh*, unsigned int cmd, void *arg); 180 int (*ioctl)(struct saa7146_fh*, unsigned int cmd, void *arg);
181
182 struct file_operations vbi_fops;
181}; 183};
182 184
183struct saa7146_use_ops { 185struct saa7146_use_ops {
diff --git a/include/media/tuner.h b/include/media/tuner.h
index faa0f8e3091b..27cbf08c931d 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -82,9 +82,9 @@
82#define TUNER_PHILIPS_FM1236_MK3 43 82#define TUNER_PHILIPS_FM1236_MK3 43
83 83
84#define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */ 84#define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */
85/* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */ 85/* Microtune merged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */
86#define TUNER_MICROTUNE_4049FM5 45 86#define TUNER_MICROTUNE_4049FM5 45
87#define TUNER_MICROTUNE_4042_FI5 46 87#define TUNER_PANASONIC_VP27 46
88#define TUNER_LG_NTSC_TAPE 47 88#define TUNER_LG_NTSC_TAPE 47
89 89
90#define TUNER_TNF_8831BGFF 48 90#define TUNER_TNF_8831BGFF 48
@@ -102,7 +102,7 @@
102#define TUNER_YMEC_TVF_8531MF 58 102#define TUNER_YMEC_TVF_8531MF 58
103#define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ 103#define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */
104 104
105#define TUNER_THOMSON_DTT7611 60 /* DViCO FusionHDTV 3 Gold-T */ 105#define TUNER_THOMSON_DTT761X 60 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
106#define TUNER_TENA_9533_DI 61 106#define TUNER_TENA_9533_DI 61
107#define TUNER_TEA5767 62 /* Only FM Radio Tuner */ 107#define TUNER_TEA5767 62 /* Only FM Radio Tuner */
108#define TUNER_PHILIPS_FMD1216ME_MK3 63 108#define TUNER_PHILIPS_FMD1216ME_MK3 63
@@ -115,47 +115,26 @@
115#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */ 115#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */
116#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */ 116#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */
117 117
118#define NOTUNER 0
119#define PAL 1 /* PAL_BG */
120#define PAL_I 2
121#define NTSC 3
122#define SECAM 4
123#define ATSC 5
124#define RADIO 6
125
126#define NoTuner 0
127#define Philips 1
128#define TEMIC 2
129#define Sony 3
130#define Alps 4
131#define LGINNOTEK 5
132#define SHARP 6
133#define Samsung 7
134#define Microtune 8
135#define HITACHI 9
136#define Panasonic 10
137#define TCL 11
138#define THOMSON 12
139
140#define TUNER_SET_TYPE_ADDR _IOW('T',3,int)
141#define TUNER_SET_STANDBY _IOW('T',4,int)
142#define TDA9887_SET_CONFIG _IOW('t',5,int)
143
144/* tv card specific */ 118/* tv card specific */
145# define TDA9887_PRESENT (1<<0) 119#define TDA9887_PRESENT (1<<0)
146# define TDA9887_PORT1_INACTIVE (1<<1) 120#define TDA9887_PORT1_INACTIVE (1<<1)
147# define TDA9887_PORT2_INACTIVE (1<<2) 121#define TDA9887_PORT2_INACTIVE (1<<2)
148# define TDA9887_QSS (1<<3) 122#define TDA9887_QSS (1<<3)
149# define TDA9887_INTERCARRIER (1<<4) 123#define TDA9887_INTERCARRIER (1<<4)
150# define TDA9887_PORT1_ACTIVE (1<<5) 124#define TDA9887_PORT1_ACTIVE (1<<5)
151# define TDA9887_PORT2_ACTIVE (1<<6) 125#define TDA9887_PORT2_ACTIVE (1<<6)
152# define TDA9887_INTERCARRIER_NTSC (1<<7) 126#define TDA9887_INTERCARRIER_NTSC (1<<7)
127/* Tuner takeover point adjustment, in dB, -16 <= top <= 15 */
128#define TDA9887_TOP_MASK (0x3f << 8)
129#define TDA9887_TOP_SET (1 << 13)
130#define TDA9887_TOP(top) (TDA9887_TOP_SET | (((16 + (top)) & 0x1f) << 8))
131
153/* config options */ 132/* config options */
154# define TDA9887_DEEMPHASIS_MASK (3<<16) 133#define TDA9887_DEEMPHASIS_MASK (3<<16)
155# define TDA9887_DEEMPHASIS_NONE (1<<16) 134#define TDA9887_DEEMPHASIS_NONE (1<<16)
156# define TDA9887_DEEMPHASIS_50 (2<<16) 135#define TDA9887_DEEMPHASIS_50 (2<<16)
157# define TDA9887_DEEMPHASIS_75 (3<<16) 136#define TDA9887_DEEMPHASIS_75 (3<<16)
158# define TDA9887_AUTOMUTE (1<<18) 137#define TDA9887_AUTOMUTE (1<<18)
159 138
160#ifdef __KERNEL__ 139#ifdef __KERNEL__
161 140
@@ -167,10 +146,26 @@ enum tuner_mode {
167 T_STANDBY = 1 << 31 146 T_STANDBY = 1 << 31
168}; 147};
169 148
149/* Older boards only had a single tuner device. Nowadays multiple tuner
150 devices may be present on a single board. Using TUNER_SET_TYPE_ADDR
151 to pass the tuner_setup structure it is possible to setup each tuner
152 device in turn.
153
154 Since multiple devices may be present it is no longer sufficient to
155 send a command to a single i2c device. Instead you should broadcast
156 the command to all i2c devices.
157
158 By setting the mode_mask correctly you can select which commands are
159 accepted by a specific tuner device. For example, set mode_mask to
160 T_RADIO if the device is a radio-only tuner. That specific tuner will
161 only accept commands when the tuner is in radio mode and ignore them
162 when the tuner is set to TV mode.
163 */
164
170struct tuner_setup { 165struct tuner_setup {
171 unsigned short addr; 166 unsigned short addr; /* I2C address */
172 unsigned int type; 167 unsigned int type; /* Tuner type */
173 unsigned int mode_mask; 168 unsigned int mode_mask; /* Allowed tuner modes */
174}; 169};
175 170
176struct tuner { 171struct tuner {
@@ -207,7 +202,6 @@ struct tuner {
207 void (*standby)(struct i2c_client *c); 202 void (*standby)(struct i2c_client *c);
208}; 203};
209 204
210extern unsigned int tuner_debug;
211extern unsigned const int tuner_count; 205extern unsigned const int tuner_count;
212 206
213extern int microtune_init(struct i2c_client *c); 207extern int microtune_init(struct i2c_client *c);
@@ -218,15 +212,16 @@ extern int default_tuner_init(struct i2c_client *c);
218extern int tea5767_autodetection(struct i2c_client *c); 212extern int tea5767_autodetection(struct i2c_client *c);
219 213
220#define tuner_warn(fmt, arg...) do {\ 214#define tuner_warn(fmt, arg...) do {\
221 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ 215 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
222 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 216 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
223#define tuner_info(fmt, arg...) do {\ 217#define tuner_info(fmt, arg...) do {\
224 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \ 218 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
225 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 219 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
226#define tuner_dbg(fmt, arg...) do {\ 220#define tuner_dbg(fmt, arg...) do {\
221 extern int tuner_debug; \
227 if (tuner_debug) \ 222 if (tuner_debug) \
228 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ 223 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
229 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 224 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
230 225
231#endif /* __KERNEL__ */ 226#endif /* __KERNEL__ */
232 227
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index d3fd48157eb8..c74052abb189 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -26,12 +26,56 @@
26#ifndef V4L2_COMMON_H_ 26#ifndef V4L2_COMMON_H_
27#define V4L2_COMMON_H_ 27#define V4L2_COMMON_H_
28 28
29/* VIDIOC_INT_AUDIO_CLOCK_FREQ */ 29/* v4l debugging and diagnostics */
30enum v4l2_audio_clock_freq { 30
31 V4L2_AUDCLK_32_KHZ = 32000, 31/* Common printk constucts for v4l-i2c drivers. These macros create a unique
32 V4L2_AUDCLK_441_KHZ = 44100, 32 prefix consisting of the driver name, the adapter number and the i2c
33 V4L2_AUDCLK_48_KHZ = 48000, 33 address. */
34}; 34#define v4l_printk(level, name, adapter, addr, fmt, arg...) \
35 printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg)
36
37#define v4l_client_printk(level, client, fmt, arg...) \
38 v4l_printk(level, (client)->driver->driver.name, (client)->adapter, \
39 (client)->addr, fmt , ## arg)
40
41#define v4l_err(client, fmt, arg...) \
42 v4l_client_printk(KERN_ERR, client, fmt , ## arg)
43
44#define v4l_warn(client, fmt, arg...) \
45 v4l_client_printk(KERN_WARNING, client, fmt , ## arg)
46
47#define v4l_info(client, fmt, arg...) \
48 v4l_client_printk(KERN_INFO, client, fmt , ## arg)
49
50/* These three macros assume that the debug level is set with a module
51 parameter called 'debug'. */
52#define v4l_dbg(level, debug, client, fmt, arg...) \
53 do { \
54 if (debug >= (level)) \
55 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \
56 } while (0)
57
58/* Prints the ioctl in a human-readable format */
59extern void v4l_printk_ioctl(unsigned int cmd);
60
61/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
62#define v4l_print_ioctl(name, cmd) \
63 do { \
64 printk(KERN_DEBUG "%s: ", name); \
65 v4l_printk_ioctl(cmd); \
66 } while (0)
67
68/* Use this macro in I2C drivers where 'client' is the struct i2c_client
69 pointer */
70#define v4l_i2c_print_ioctl(client, cmd) \
71 do { \
72 v4l_client_printk(KERN_DEBUG, client, ""); \
73 v4l_printk_ioctl(cmd); \
74 } while (0)
75
76/* ------------------------------------------------------------------------- */
77
78/* Internal ioctls */
35 79
36/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */ 80/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */
37struct v4l2_register { 81struct v4l2_register {
@@ -70,6 +114,20 @@ enum v4l2_chip_ident {
70 V4L2_IDENT_CX25843 = 243, 114 V4L2_IDENT_CX25843 = 243,
71}; 115};
72 116
117/* audio ioctls */
118/* v4l device was opened in Radio mode */
119#define AUDC_SET_RADIO _IO('d',88)
120/* select from TV,radio,extern,MUTE */
121#define AUDC_SET_INPUT _IOW('d',89,int)
122
123/* tuner ioctls */
124/* Sets tuner type and its I2C addr */
125#define TUNER_SET_TYPE_ADDR _IOW('d',90,int)
126/* Puts tuner on powersaving state, disabling it, except for i2c */
127#define TUNER_SET_STANDBY _IOW('d',91,int)
128/* Sets tda9887 specific stuff, like port1, port2 and qss */
129#define TDA9887_SET_CONFIG _IOW('d',92,int)
130
73/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 131/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
74#define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register) 132#define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register)
75#define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register) 133#define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register)
@@ -77,10 +135,12 @@ enum v4l2_chip_ident {
77/* Reset the I2C chip */ 135/* Reset the I2C chip */
78#define VIDIOC_INT_RESET _IO ('d', 102) 136#define VIDIOC_INT_RESET _IO ('d', 102)
79 137
80/* Set the frequency of the audio clock output. 138/* Set the frequency (in Hz) of the audio clock output.
81 Used to slave an audio processor to the video decoder, ensuring that audio 139 Used to slave an audio processor to the video decoder, ensuring that audio
82 and video remain synchronized. */ 140 and video remain synchronized.
83#define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOR ('d', 103, enum v4l2_audio_clock_freq) 141 Usual values for the frequency are 48000, 44100 or 32000 Hz.
142 If the frequency is not supported, then -EINVAL is returned. */
143#define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOW ('d', 103, u32)
84 144
85/* Video decoders that support sliced VBI need to implement this ioctl. 145/* Video decoders that support sliced VBI need to implement this ioctl.
86 Field p of the v4l2_sliced_vbi_line struct is set to the start of the VBI 146 Field p of the v4l2_sliced_vbi_line struct is set to the start of the VBI
@@ -107,4 +167,10 @@ enum v4l2_chip_ident {
107 be made. */ 167 be made. */
108#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *) 168#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *)
109 169
170/* Sets I2S speed in bps. This is used to provide a standard way to select I2S
171 clock used by driving digital audio streams at some board designs.
172 Usual values for the frequency are 1024000 and 2048000.
173 If the frequency is not supported, then -EINVAL is returned. */
174#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
175
110#endif /* V4L2_COMMON_H_ */ 176#endif /* V4L2_COMMON_H_ */
diff --git a/include/net/act_api.h b/include/net/act_api.h
index b55eb7c7f033..11e9eaf79f5a 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -63,7 +63,7 @@ struct tc_action_ops
63 __u32 type; /* TBD to match kind */ 63 __u32 type; /* TBD to match kind */
64 __u32 capab; /* capabilities includes 4 bit version */ 64 __u32 capab; /* capabilities includes 4 bit version */
65 struct module *owner; 65 struct module *owner;
66 int (*act)(struct sk_buff **, struct tc_action *, struct tcf_result *); 66 int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *);
67 int (*get_stats)(struct sk_buff *, struct tc_action *); 67 int (*get_stats)(struct sk_buff *, struct tc_action *);
68 int (*dump)(struct sk_buff *, struct tc_action *,int , int); 68 int (*dump)(struct sk_buff *, struct tc_action *,int , int);
69 int (*cleanup)(struct tc_action *, int bind); 69 int (*cleanup)(struct tc_action *, int bind);
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index b5d785ab4a0e..bfc1779fc753 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -13,7 +13,7 @@ extern void unix_gc(void);
13#define UNIX_HASH_SIZE 256 13#define UNIX_HASH_SIZE 256
14 14
15extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; 15extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
16extern rwlock_t unix_table_lock; 16extern spinlock_t unix_table_lock;
17 17
18extern atomic_t unix_tot_inflight; 18extern atomic_t unix_tot_inflight;
19 19
@@ -58,10 +58,10 @@ struct unix_skb_parms {
58#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) 58#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb))
59#define UNIXCREDS(skb) (&UNIXCB((skb)).creds) 59#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
60 60
61#define unix_state_rlock(s) read_lock(&unix_sk(s)->lock) 61#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock)
62#define unix_state_runlock(s) read_unlock(&unix_sk(s)->lock) 62#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock)
63#define unix_state_wlock(s) write_lock(&unix_sk(s)->lock) 63#define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock)
64#define unix_state_wunlock(s) write_unlock(&unix_sk(s)->lock) 64#define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock)
65 65
66#ifdef __KERNEL__ 66#ifdef __KERNEL__
67/* The AF_UNIX socket */ 67/* The AF_UNIX socket */
@@ -76,7 +76,7 @@ struct unix_sock {
76 struct sock *other; 76 struct sock *other;
77 struct sock *gc_tree; 77 struct sock *gc_tree;
78 atomic_t inflight; 78 atomic_t inflight;
79 rwlock_t lock; 79 spinlock_t lock;
80 wait_queue_head_t peer_wait; 80 wait_queue_head_t peer_wait;
81}; 81};
82#define unix_sk(__sk) ((struct unix_sock *)__sk) 82#define unix_sk(__sk) ((struct unix_sock *)__sk)
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index 47048b1d179a..90fcc98e676f 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -7,7 +7,6 @@
7#define _ATMCLIP_H 7#define _ATMCLIP_H
8 8
9#include <linux/netdevice.h> 9#include <linux/netdevice.h>
10#include <linux/skbuff.h>
11#include <linux/atm.h> 10#include <linux/atm.h>
12#include <linux/atmdev.h> 11#include <linux/atmdev.h>
13#include <linux/atmarp.h> 12#include <linux/atmarp.h>
@@ -18,6 +17,7 @@
18#define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back)) 17#define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back))
19#define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key) 18#define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key)
20 19
20struct sk_buff;
21 21
22struct clip_vcc { 22struct clip_vcc {
23 struct atm_vcc *vcc; /* VCC descriptor */ 23 struct atm_vcc *vcc; /* VCC descriptor */
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h
index 86e8e86e624a..5a86e78081bf 100644
--- a/include/net/dn_dev.h
+++ b/include/net/dn_dev.h
@@ -88,8 +88,8 @@ struct dn_dev {
88 struct net_device *dev; 88 struct net_device *dev;
89 struct dn_dev_parms parms; 89 struct dn_dev_parms parms;
90 char use_long; 90 char use_long;
91 struct timer_list timer; 91 struct timer_list timer;
92 unsigned long t3; 92 unsigned long t3;
93 struct neigh_parms *neigh_parms; 93 struct neigh_parms *neigh_parms;
94 unsigned char addr[ETH_ALEN]; 94 unsigned char addr[ETH_ALEN];
95 struct neighbour *router; /* Default router on circuit */ 95 struct neighbour *router; /* Default router on circuit */
@@ -99,57 +99,57 @@ struct dn_dev {
99 99
100struct dn_short_packet 100struct dn_short_packet
101{ 101{
102 unsigned char msgflg __attribute__((packed)); 102 unsigned char msgflg;
103 unsigned short dstnode __attribute__((packed)); 103 unsigned short dstnode;
104 unsigned short srcnode __attribute__((packed)); 104 unsigned short srcnode;
105 unsigned char forward __attribute__((packed)); 105 unsigned char forward;
106}; 106} __attribute__((packed));
107 107
108struct dn_long_packet 108struct dn_long_packet
109{ 109{
110 unsigned char msgflg __attribute__((packed)); 110 unsigned char msgflg;
111 unsigned char d_area __attribute__((packed)); 111 unsigned char d_area;
112 unsigned char d_subarea __attribute__((packed)); 112 unsigned char d_subarea;
113 unsigned char d_id[6] __attribute__((packed)); 113 unsigned char d_id[6];
114 unsigned char s_area __attribute__((packed)); 114 unsigned char s_area;
115 unsigned char s_subarea __attribute__((packed)); 115 unsigned char s_subarea;
116 unsigned char s_id[6] __attribute__((packed)); 116 unsigned char s_id[6];
117 unsigned char nl2 __attribute__((packed)); 117 unsigned char nl2;
118 unsigned char visit_ct __attribute__((packed)); 118 unsigned char visit_ct;
119 unsigned char s_class __attribute__((packed)); 119 unsigned char s_class;
120 unsigned char pt __attribute__((packed)); 120 unsigned char pt;
121}; 121} __attribute__((packed));
122 122
123/*------------------------- DRP - Routing messages ---------------------*/ 123/*------------------------- DRP - Routing messages ---------------------*/
124 124
125struct endnode_hello_message 125struct endnode_hello_message
126{ 126{
127 unsigned char msgflg __attribute__((packed)); 127 unsigned char msgflg;
128 unsigned char tiver[3] __attribute__((packed)); 128 unsigned char tiver[3];
129 unsigned char id[6] __attribute__((packed)); 129 unsigned char id[6];
130 unsigned char iinfo __attribute__((packed)); 130 unsigned char iinfo;
131 unsigned short blksize __attribute__((packed)); 131 unsigned short blksize;
132 unsigned char area __attribute__((packed)); 132 unsigned char area;
133 unsigned char seed[8] __attribute__((packed)); 133 unsigned char seed[8];
134 unsigned char neighbor[6] __attribute__((packed)); 134 unsigned char neighbor[6];
135 unsigned short timer __attribute__((packed)); 135 unsigned short timer;
136 unsigned char mpd __attribute__((packed)); 136 unsigned char mpd;
137 unsigned char datalen __attribute__((packed)); 137 unsigned char datalen;
138 unsigned char data[2] __attribute__((packed)); 138 unsigned char data[2];
139}; 139} __attribute__((packed));
140 140
141struct rtnode_hello_message 141struct rtnode_hello_message
142{ 142{
143 unsigned char msgflg __attribute__((packed)); 143 unsigned char msgflg;
144 unsigned char tiver[3] __attribute__((packed)); 144 unsigned char tiver[3];
145 unsigned char id[6] __attribute__((packed)); 145 unsigned char id[6];
146 unsigned char iinfo __attribute__((packed)); 146 unsigned char iinfo;
147 unsigned short blksize __attribute__((packed)); 147 unsigned short blksize;
148 unsigned char priority __attribute__((packed)); 148 unsigned char priority;
149 unsigned char area __attribute__((packed)); 149 unsigned char area;
150 unsigned short timer __attribute__((packed)); 150 unsigned short timer;
151 unsigned char mpd __attribute__((packed)); 151 unsigned char mpd;
152}; 152} __attribute__((packed));
153 153
154 154
155extern void dn_dev_init(void); 155extern void dn_dev_init(void);
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h
index 1ba03be0af3a..e6182b86262b 100644
--- a/include/net/dn_nsp.h
+++ b/include/net/dn_nsp.h
@@ -72,78 +72,78 @@ extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int nobl
72 72
73struct nsp_data_seg_msg 73struct nsp_data_seg_msg
74{ 74{
75 unsigned char msgflg __attribute__((packed)); 75 unsigned char msgflg;
76 unsigned short dstaddr __attribute__((packed)); 76 unsigned short dstaddr;
77 unsigned short srcaddr __attribute__((packed)); 77 unsigned short srcaddr;
78}; 78} __attribute__((packed));
79 79
80struct nsp_data_opt_msg 80struct nsp_data_opt_msg
81{ 81{
82 unsigned short acknum __attribute__((packed)); 82 unsigned short acknum;
83 unsigned short segnum __attribute__((packed)); 83 unsigned short segnum;
84 unsigned short lsflgs __attribute__((packed)); 84 unsigned short lsflgs;
85}; 85} __attribute__((packed));
86 86
87struct nsp_data_opt_msg1 87struct nsp_data_opt_msg1
88{ 88{
89 unsigned short acknum __attribute__((packed)); 89 unsigned short acknum;
90 unsigned short segnum __attribute__((packed)); 90 unsigned short segnum;
91}; 91} __attribute__((packed));
92 92
93 93
94/* Acknowledgment Message (data/other data) */ 94/* Acknowledgment Message (data/other data) */
95struct nsp_data_ack_msg 95struct nsp_data_ack_msg
96{ 96{
97 unsigned char msgflg __attribute__((packed)); 97 unsigned char msgflg;
98 unsigned short dstaddr __attribute__((packed)); 98 unsigned short dstaddr;
99 unsigned short srcaddr __attribute__((packed)); 99 unsigned short srcaddr;
100 unsigned short acknum __attribute__((packed)); 100 unsigned short acknum;
101}; 101} __attribute__((packed));
102 102
103/* Connect Acknowledgment Message */ 103/* Connect Acknowledgment Message */
104struct nsp_conn_ack_msg 104struct nsp_conn_ack_msg
105{ 105{
106 unsigned char msgflg __attribute__((packed)); 106 unsigned char msgflg;
107 unsigned short dstaddr __attribute__((packed)); 107 unsigned short dstaddr;
108}; 108} __attribute__((packed));
109 109
110 110
111/* Connect Initiate/Retransmit Initiate/Connect Confirm */ 111/* Connect Initiate/Retransmit Initiate/Connect Confirm */
112struct nsp_conn_init_msg 112struct nsp_conn_init_msg
113{ 113{
114 unsigned char msgflg __attribute__((packed)); 114 unsigned char msgflg;
115#define NSP_CI 0x18 /* Connect Initiate */ 115#define NSP_CI 0x18 /* Connect Initiate */
116#define NSP_RCI 0x68 /* Retrans. Conn Init */ 116#define NSP_RCI 0x68 /* Retrans. Conn Init */
117 unsigned short dstaddr __attribute__((packed)); 117 unsigned short dstaddr;
118 unsigned short srcaddr __attribute__((packed)); 118 unsigned short srcaddr;
119 unsigned char services __attribute__((packed)); 119 unsigned char services;
120#define NSP_FC_NONE 0x00 /* Flow Control None */ 120#define NSP_FC_NONE 0x00 /* Flow Control None */
121#define NSP_FC_SRC 0x04 /* Seg Req. Count */ 121#define NSP_FC_SRC 0x04 /* Seg Req. Count */
122#define NSP_FC_SCMC 0x08 /* Sess. Control Mess */ 122#define NSP_FC_SCMC 0x08 /* Sess. Control Mess */
123#define NSP_FC_MASK 0x0c /* FC type mask */ 123#define NSP_FC_MASK 0x0c /* FC type mask */
124 unsigned char info __attribute__((packed)); 124 unsigned char info;
125 unsigned short segsize __attribute__((packed)); 125 unsigned short segsize;
126}; 126} __attribute__((packed));
127 127
128/* Disconnect Initiate/Disconnect Confirm */ 128/* Disconnect Initiate/Disconnect Confirm */
129struct nsp_disconn_init_msg 129struct nsp_disconn_init_msg
130{ 130{
131 unsigned char msgflg __attribute__((packed)); 131 unsigned char msgflg;
132 unsigned short dstaddr __attribute__((packed)); 132 unsigned short dstaddr;
133 unsigned short srcaddr __attribute__((packed)); 133 unsigned short srcaddr;
134 unsigned short reason __attribute__((packed)); 134 unsigned short reason;
135}; 135} __attribute__((packed));
136 136
137 137
138 138
139struct srcobj_fmt 139struct srcobj_fmt
140{ 140{
141 char format __attribute__((packed)); 141 char format;
142 unsigned char task __attribute__((packed)); 142 unsigned char task;
143 unsigned short grpcode __attribute__((packed)); 143 unsigned short grpcode;
144 unsigned short usrcode __attribute__((packed)); 144 unsigned short usrcode;
145 char dlen __attribute__((packed)); 145 char dlen;
146}; 146} __attribute__((packed));
147 147
148/* 148/*
149 * A collection of functions for manipulating the sequence 149 * A collection of functions for manipulating the sequence
diff --git a/include/net/dst.h b/include/net/dst.h
index 6c196a5baf24..5161e89017f9 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -9,6 +9,7 @@
9#define _NET_DST_H 9#define _NET_DST_H
10 10
11#include <linux/config.h> 11#include <linux/config.h>
12#include <linux/netdevice.h>
12#include <linux/rtnetlink.h> 13#include <linux/rtnetlink.h>
13#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
14#include <linux/jiffies.h> 15#include <linux/jiffies.h>
@@ -224,16 +225,7 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout)
224/* Output packet to network from transport. */ 225/* Output packet to network from transport. */
225static inline int dst_output(struct sk_buff *skb) 226static inline int dst_output(struct sk_buff *skb)
226{ 227{
227 int err; 228 return skb->dst->output(skb);
228
229 for (;;) {
230 err = skb->dst->output(skb);
231
232 if (likely(err == 0))
233 return err;
234 if (unlikely(err != NET_XMIT_BYPASS))
235 return err;
236 }
237} 229}
238 230
239/* Input packet from network to transport. */ 231/* Input packet from network to transport. */
diff --git a/include/net/flow.h b/include/net/flow.h
index 9a5c94b1a0ec..ec7eb86eb203 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -84,11 +84,12 @@ struct flowi {
84#define FLOW_DIR_OUT 1 84#define FLOW_DIR_OUT 1
85#define FLOW_DIR_FWD 2 85#define FLOW_DIR_FWD 2
86 86
87typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, 87struct sock;
88typedef void (*flow_resolve_t)(struct flowi *key, u32 sk_sid, u16 family, u8 dir,
88 void **objp, atomic_t **obj_refp); 89 void **objp, atomic_t **obj_refp);
89 90
90extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, 91extern void *flow_cache_lookup(struct flowi *key, u32 sk_sid, u16 family, u8 dir,
91 flow_resolve_t resolver); 92 flow_resolve_t resolver);
92extern void flow_cache_flush(void); 93extern void flow_cache_flush(void);
93extern atomic_t flow_cache_genid; 94extern atomic_t flow_cache_genid;
94 95
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 52d8b1a73d52..c5b96b2b8155 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -60,7 +60,7 @@ struct genl_info
60 */ 60 */
61struct genl_ops 61struct genl_ops
62{ 62{
63 unsigned int cmd; 63 u8 cmd;
64 unsigned int flags; 64 unsigned int flags;
65 struct nla_policy *policy; 65 struct nla_policy *policy;
66 int (*doit)(struct sk_buff *skb, 66 int (*doit)(struct sk_buff *skb,
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 6cdebeee5f96..e7c3f20fbafc 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -20,12 +20,9 @@
20 20
21#include <linux/config.h> 21#include <linux/config.h>
22#include <linux/icmp.h> 22#include <linux/icmp.h>
23#include <linux/skbuff.h>
24 23
25#include <net/sock.h> 24#include <net/inet_sock.h>
26#include <net/protocol.h>
27#include <net/snmp.h> 25#include <net/snmp.h>
28#include <linux/ip.h>
29 26
30struct icmp_err { 27struct icmp_err {
31 int errno; 28 int errno;
@@ -38,6 +35,10 @@ DECLARE_SNMP_STAT(struct icmp_mib, icmp_statistics);
38#define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field) 35#define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field)
39#define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field) 36#define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field)
40 37
38struct dst_entry;
39struct net_proto_family;
40struct sk_buff;
41
41extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info); 42extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info);
42extern int icmp_rcv(struct sk_buff *skb); 43extern int icmp_rcv(struct sk_buff *skb);
43extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); 44extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
index 225fc751d464..03b766afdc39 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/ieee80211_crypt.h
@@ -23,12 +23,17 @@
23#ifndef IEEE80211_CRYPT_H 23#ifndef IEEE80211_CRYPT_H
24#define IEEE80211_CRYPT_H 24#define IEEE80211_CRYPT_H
25 25
26#include <linux/skbuff.h> 26#include <linux/types.h>
27#include <linux/list.h>
28#include <asm/atomic.h>
27 29
28enum { 30enum {
29 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), 31 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
30}; 32};
31 33
34struct sk_buff;
35struct module;
36
32struct ieee80211_crypto_ops { 37struct ieee80211_crypto_ops {
33 const char *name; 38 const char *name;
34 struct list_head list; 39 struct list_head list;
@@ -87,6 +92,8 @@ struct ieee80211_crypt_data {
87 atomic_t refcnt; 92 atomic_t refcnt;
88}; 93};
89 94
95struct ieee80211_device;
96
90int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); 97int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
91int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); 98int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
92struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); 99struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name);
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
new file mode 100644
index 000000000000..b33b438bffcc
--- /dev/null
+++ b/include/net/inet6_connection_sock.h
@@ -0,0 +1,42 @@
1/*
2 * NET Generic infrastructure for INET6 connection oriented protocols.
3 *
4 * Authors: Many people, see the TCPv6 sources
5 *
6 * From code originally in TCPv6
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 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#ifndef _INET6_CONNECTION_SOCK_H
14#define _INET6_CONNECTION_SOCK_H
15
16#include <linux/types.h>
17
18struct in6_addr;
19struct inet_bind_bucket;
20struct request_sock;
21struct sk_buff;
22struct sock;
23struct sockaddr;
24
25extern int inet6_csk_bind_conflict(const struct sock *sk,
26 const struct inet_bind_bucket *tb);
27
28extern struct request_sock *inet6_csk_search_req(const struct sock *sk,
29 struct request_sock ***prevp,
30 const __u16 rport,
31 const struct in6_addr *raddr,
32 const struct in6_addr *laddr,
33 const int iif);
34
35extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
36 struct request_sock *req,
37 const unsigned long timeout);
38
39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
40
41extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok);
42#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 5a2beed5a770..25f708ff020e 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -48,6 +48,32 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
48 return inet6_ehashfn(laddr, lport, faddr, fport); 48 return inet6_ehashfn(laddr, lport, faddr, fport);
49} 49}
50 50
51static inline void __inet6_hash(struct inet_hashinfo *hashinfo,
52 struct sock *sk)
53{
54 struct hlist_head *list;
55 rwlock_t *lock;
56
57 BUG_TRAP(sk_unhashed(sk));
58
59 if (sk->sk_state == TCP_LISTEN) {
60 list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)];
61 lock = &hashinfo->lhash_lock;
62 inet_listen_wlock(hashinfo);
63 } else {
64 unsigned int hash;
65 sk->sk_hash = hash = inet6_sk_ehashfn(sk);
66 hash &= (hashinfo->ehash_size - 1);
67 list = &hashinfo->ehash[hash].chain;
68 lock = &hashinfo->ehash[hash].lock;
69 write_lock(lock);
70 }
71
72 __sk_add_node(sk, list);
73 sock_prot_inc_use(sk->sk_prot);
74 write_unlock(lock);
75}
76
51/* 77/*
52 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 78 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
53 * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM 79 * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM
@@ -84,10 +110,10 @@ static inline struct sock *
84 110
85 if(*((__u32 *)&(tw->tw_dport)) == ports && 111 if(*((__u32 *)&(tw->tw_dport)) == ports &&
86 sk->sk_family == PF_INET6) { 112 sk->sk_family == PF_INET6) {
87 const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk); 113 const struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
88 114
89 if (ipv6_addr_equal(&tcp6tw->tw_v6_daddr, saddr) && 115 if (ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
90 ipv6_addr_equal(&tcp6tw->tw_v6_rcv_saddr, daddr) && 116 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
91 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif)) 117 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif))
92 goto hit; 118 goto hit;
93 } 119 }
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index f943306ce5ff..227adcbdfec8 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -1,8 +1,8 @@
1#ifndef _INET_COMMON_H 1#ifndef _INET_COMMON_H
2#define _INET_COMMON_H 2#define _INET_COMMON_H
3 3
4extern struct proto_ops inet_stream_ops; 4extern const struct proto_ops inet_stream_ops;
5extern struct proto_ops inet_dgram_ops; 5extern const struct proto_ops inet_dgram_ops;
6 6
7/* 7/*
8 * INET4 prototypes used by INET6 8 * INET4 prototypes used by INET6
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index b0c99060b78d..fa587c94e9d0 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -15,9 +15,11 @@
15#ifndef _INET_CONNECTION_SOCK_H 15#ifndef _INET_CONNECTION_SOCK_H
16#define _INET_CONNECTION_SOCK_H 16#define _INET_CONNECTION_SOCK_H
17 17
18#include <linux/ip.h> 18#include <linux/compiler.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/timer.h> 20#include <linux/timer.h>
21
22#include <net/inet_sock.h>
21#include <net/request_sock.h> 23#include <net/request_sock.h>
22 24
23#define INET_CSK_DEBUG 1 25#define INET_CSK_DEBUG 1
@@ -29,6 +31,29 @@ struct inet_bind_bucket;
29struct inet_hashinfo; 31struct inet_hashinfo;
30struct tcp_congestion_ops; 32struct tcp_congestion_ops;
31 33
34/*
35 * Pointers to address related TCP functions
36 * (i.e. things that depend on the address family)
37 */
38struct inet_connection_sock_af_ops {
39 int (*queue_xmit)(struct sk_buff *skb, int ipfragok);
40 void (*send_check)(struct sock *sk, int len,
41 struct sk_buff *skb);
42 int (*rebuild_header)(struct sock *sk);
43 int (*conn_request)(struct sock *sk, struct sk_buff *skb);
44 struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb,
45 struct request_sock *req,
46 struct dst_entry *dst);
47 int (*remember_stamp)(struct sock *sk);
48 __u16 net_header_len;
49 int (*setsockopt)(struct sock *sk, int level, int optname,
50 char __user *optval, int optlen);
51 int (*getsockopt)(struct sock *sk, int level, int optname,
52 char __user *optval, int __user *optlen);
53 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
54 int sockaddr_len;
55};
56
32/** inet_connection_sock - INET connection oriented sock 57/** inet_connection_sock - INET connection oriented sock
33 * 58 *
34 * @icsk_accept_queue: FIFO of established children 59 * @icsk_accept_queue: FIFO of established children
@@ -36,13 +61,16 @@ struct tcp_congestion_ops;
36 * @icsk_timeout: Timeout 61 * @icsk_timeout: Timeout
37 * @icsk_retransmit_timer: Resend (no ack) 62 * @icsk_retransmit_timer: Resend (no ack)
38 * @icsk_rto: Retransmit timeout 63 * @icsk_rto: Retransmit timeout
64 * @icsk_pmtu_cookie Last pmtu seen by socket
39 * @icsk_ca_ops Pluggable congestion control hook 65 * @icsk_ca_ops Pluggable congestion control hook
66 * @icsk_af_ops Operations which are AF_INET{4,6} specific
40 * @icsk_ca_state: Congestion control state 67 * @icsk_ca_state: Congestion control state
41 * @icsk_retransmits: Number of unrecovered [RTO] timeouts 68 * @icsk_retransmits: Number of unrecovered [RTO] timeouts
42 * @icsk_pending: Scheduled timer event 69 * @icsk_pending: Scheduled timer event
43 * @icsk_backoff: Backoff 70 * @icsk_backoff: Backoff
44 * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries 71 * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries
45 * @icsk_probes_out: unanswered 0 window probes 72 * @icsk_probes_out: unanswered 0 window probes
73 * @icsk_ext_hdr_len: Network protocol overhead (IP/IPv6 options)
46 * @icsk_ack: Delayed ACK control data 74 * @icsk_ack: Delayed ACK control data
47 */ 75 */
48struct inet_connection_sock { 76struct inet_connection_sock {
@@ -54,14 +82,17 @@ struct inet_connection_sock {
54 struct timer_list icsk_retransmit_timer; 82 struct timer_list icsk_retransmit_timer;
55 struct timer_list icsk_delack_timer; 83 struct timer_list icsk_delack_timer;
56 __u32 icsk_rto; 84 __u32 icsk_rto;
57 struct tcp_congestion_ops *icsk_ca_ops; 85 __u32 icsk_pmtu_cookie;
86 const struct tcp_congestion_ops *icsk_ca_ops;
87 const struct inet_connection_sock_af_ops *icsk_af_ops;
88 unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu);
58 __u8 icsk_ca_state; 89 __u8 icsk_ca_state;
59 __u8 icsk_retransmits; 90 __u8 icsk_retransmits;
60 __u8 icsk_pending; 91 __u8 icsk_pending;
61 __u8 icsk_backoff; 92 __u8 icsk_backoff;
62 __u8 icsk_syn_retries; 93 __u8 icsk_syn_retries;
63 __u8 icsk_probes_out; 94 __u8 icsk_probes_out;
64 /* 2 BYTES HOLE, TRY TO PACK! */ 95 __u16 icsk_ext_hdr_len;
65 struct { 96 struct {
66 __u8 pending; /* ACK is pending */ 97 __u8 pending; /* ACK is pending */
67 __u8 quick; /* Scheduled number of quick acks */ 98 __u8 quick; /* Scheduled number of quick acks */
@@ -192,8 +223,12 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk,
192 const __u16 rport, 223 const __u16 rport,
193 const __u32 raddr, 224 const __u32 raddr,
194 const __u32 laddr); 225 const __u32 laddr);
226extern int inet_csk_bind_conflict(const struct sock *sk,
227 const struct inet_bind_bucket *tb);
195extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, 228extern int inet_csk_get_port(struct inet_hashinfo *hashinfo,
196 struct sock *sk, unsigned short snum); 229 struct sock *sk, unsigned short snum,
230 int (*bind_conflict)(const struct sock *sk,
231 const struct inet_bind_bucket *tb));
197 232
198extern struct dst_entry* inet_csk_route_req(struct sock *sk, 233extern struct dst_entry* inet_csk_route_req(struct sock *sk,
199 const struct request_sock *req); 234 const struct request_sock *req);
@@ -207,7 +242,7 @@ static inline void inet_csk_reqsk_queue_add(struct sock *sk,
207 242
208extern void inet_csk_reqsk_queue_hash_add(struct sock *sk, 243extern void inet_csk_reqsk_queue_hash_add(struct sock *sk,
209 struct request_sock *req, 244 struct request_sock *req,
210 const unsigned timeout); 245 unsigned long timeout);
211 246
212static inline void inet_csk_reqsk_queue_removed(struct sock *sk, 247static inline void inet_csk_reqsk_queue_removed(struct sock *sk,
213 struct request_sock *req) 248 struct request_sock *req)
@@ -273,4 +308,6 @@ static inline unsigned int inet_csk_listen_poll(const struct sock *sk)
273extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries); 308extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries);
274extern void inet_csk_listen_stop(struct sock *sk); 309extern void inet_csk_listen_stop(struct sock *sk);
275 310
311extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
312
276#endif /* _INET_CONNECTION_SOCK_H */ 313#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index b0c47e2eccf1..d599c6bfbb86 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/ip.h> 4#include <linux/ip.h>
5#include <linux/skbuff.h> 5#include <linux/skbuff.h>
6
7#include <net/inet_sock.h>
6#include <net/dsfield.h> 8#include <net/dsfield.h>
7 9
8enum { 10enum {
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 07840baa9341..135d80fd658e 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -26,6 +26,7 @@
26#include <linux/wait.h> 26#include <linux/wait.h>
27 27
28#include <net/inet_connection_sock.h> 28#include <net/inet_connection_sock.h>
29#include <net/inet_sock.h>
29#include <net/route.h> 30#include <net/route.h>
30#include <net/sock.h> 31#include <net/sock.h>
31#include <net/tcp_states.h> 32#include <net/tcp_states.h>
@@ -128,26 +129,6 @@ struct inet_hashinfo {
128 kmem_cache_t *bind_bucket_cachep; 129 kmem_cache_t *bind_bucket_cachep;
129}; 130};
130 131
131static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
132 const __u32 faddr, const __u16 fport)
133{
134 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport);
135 h ^= h >> 16;
136 h ^= h >> 8;
137 return h;
138}
139
140static inline int inet_sk_ehashfn(const struct sock *sk)
141{
142 const struct inet_sock *inet = inet_sk(sk);
143 const __u32 laddr = inet->rcv_saddr;
144 const __u16 lport = inet->num;
145 const __u32 faddr = inet->daddr;
146 const __u16 fport = inet->dport;
147
148 return inet_ehashfn(laddr, lport, faddr, fport);
149}
150
151static inline struct inet_ehash_bucket *inet_ehash_bucket( 132static inline struct inet_ehash_bucket *inet_ehash_bucket(
152 struct inet_hashinfo *hashinfo, 133 struct inet_hashinfo *hashinfo,
153 unsigned int hash) 134 unsigned int hash)
@@ -434,4 +415,7 @@ static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
434 415
435 return sk; 416 return sk;
436} 417}
418
419extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
420 struct sock *sk);
437#endif /* _INET_HASHTABLES_H */ 421#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
new file mode 100644
index 000000000000..883eb529ef8e
--- /dev/null
+++ b/include/net/inet_sock.h
@@ -0,0 +1,193 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for inet_sock
7 *
8 * Authors: Many, reorganised here by
9 * Arnaldo Carvalho de Melo <acme@mandriva.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16#ifndef _INET_SOCK_H
17#define _INET_SOCK_H
18
19#include <linux/config.h>
20
21#include <linux/string.h>
22#include <linux/types.h>
23
24#include <net/flow.h>
25#include <net/sock.h>
26#include <net/request_sock.h>
27
28/** struct ip_options - IP Options
29 *
30 * @faddr - Saved first hop address
31 * @is_setbyuser - Set by setsockopt?
32 * @is_data - Options in __data, rather than skb
33 * @is_strictroute - Strict source route
34 * @srr_is_hit - Packet destination addr was our one
35 * @is_changed - IP checksum more not valid
36 * @rr_needaddr - Need to record addr of outgoing dev
37 * @ts_needtime - Need to record timestamp
38 * @ts_needaddr - Need to record addr of outgoing dev
39 */
40struct ip_options {
41 __u32 faddr;
42 unsigned char optlen;
43 unsigned char srr;
44 unsigned char rr;
45 unsigned char ts;
46 unsigned char is_setbyuser:1,
47 is_data:1,
48 is_strictroute:1,
49 srr_is_hit:1,
50 is_changed:1,
51 rr_needaddr:1,
52 ts_needtime:1,
53 ts_needaddr:1;
54 unsigned char router_alert;
55 unsigned char __pad1;
56 unsigned char __pad2;
57 unsigned char __data[0];
58};
59
60#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
61
62struct inet_request_sock {
63 struct request_sock req;
64#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
65 u16 inet6_rsk_offset;
66 /* 2 bytes hole, try to pack */
67#endif
68 u32 loc_addr;
69 u32 rmt_addr;
70 u16 rmt_port;
71 u16 snd_wscale : 4,
72 rcv_wscale : 4,
73 tstamp_ok : 1,
74 sack_ok : 1,
75 wscale_ok : 1,
76 ecn_ok : 1,
77 acked : 1;
78 struct ip_options *opt;
79};
80
81static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
82{
83 return (struct inet_request_sock *)sk;
84}
85
86struct ip_mc_socklist;
87struct ipv6_pinfo;
88struct rtable;
89
90/** struct inet_sock - representation of INET sockets
91 *
92 * @sk - ancestor class
93 * @pinet6 - pointer to IPv6 control block
94 * @daddr - Foreign IPv4 addr
95 * @rcv_saddr - Bound local IPv4 addr
96 * @dport - Destination port
97 * @num - Local port
98 * @saddr - Sending source
99 * @uc_ttl - Unicast TTL
100 * @sport - Source port
101 * @id - ID counter for DF pkts
102 * @tos - TOS
103 * @mc_ttl - Multicasting TTL
104 * @is_icsk - is this an inet_connection_sock?
105 * @mc_index - Multicast device index
106 * @mc_list - Group array
107 * @cork - info to build ip hdr on each ip frag while socket is corked
108 */
109struct inet_sock {
110 /* sk and pinet6 has to be the first two members of inet_sock */
111 struct sock sk;
112#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
113 struct ipv6_pinfo *pinet6;
114#endif
115 /* Socket demultiplex comparisons on incoming packets. */
116 __u32 daddr;
117 __u32 rcv_saddr;
118 __u16 dport;
119 __u16 num;
120 __u32 saddr;
121 __s16 uc_ttl;
122 __u16 cmsg_flags;
123 struct ip_options *opt;
124 __u16 sport;
125 __u16 id;
126 __u8 tos;
127 __u8 mc_ttl;
128 __u8 pmtudisc;
129 __u8 recverr:1,
130 is_icsk:1,
131 freebind:1,
132 hdrincl:1,
133 mc_loop:1;
134 int mc_index;
135 __u32 mc_addr;
136 struct ip_mc_socklist *mc_list;
137 struct {
138 unsigned int flags;
139 unsigned int fragsize;
140 struct ip_options *opt;
141 struct rtable *rt;
142 int length; /* Total length of all frames */
143 u32 addr;
144 struct flowi fl;
145 } cork;
146};
147
148#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
149#define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */
150
151static inline struct inet_sock *inet_sk(const struct sock *sk)
152{
153 return (struct inet_sock *)sk;
154}
155
156static inline void __inet_sk_copy_descendant(struct sock *sk_to,
157 const struct sock *sk_from,
158 const int ancestor_size)
159{
160 memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1,
161 sk_from->sk_prot->obj_size - ancestor_size);
162}
163#if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE))
164static inline void inet_sk_copy_descendant(struct sock *sk_to,
165 const struct sock *sk_from)
166{
167 __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock));
168}
169#endif
170
171extern int inet_sk_rebuild_header(struct sock *sk);
172
173static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
174 const __u32 faddr, const __u16 fport)
175{
176 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport);
177 h ^= h >> 16;
178 h ^= h >> 8;
179 return h;
180}
181
182static inline int inet_sk_ehashfn(const struct sock *sk)
183{
184 const struct inet_sock *inet = inet_sk(sk);
185 const __u32 laddr = inet->rcv_saddr;
186 const __u16 lport = inet->num;
187 const __u32 faddr = inet->daddr;
188 const __u16 fport = inet->dport;
189
190 return inet_ehashfn(laddr, lport, faddr, fport);
191}
192
193#endif /* _INET_SOCK_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 28f7b2103505..1da294c47522 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -17,15 +17,16 @@
17 17
18#include <linux/config.h> 18#include <linux/config.h>
19 19
20#include <linux/ip.h>
21#include <linux/list.h> 20#include <linux/list.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/timer.h> 22#include <linux/timer.h>
24#include <linux/types.h> 23#include <linux/types.h>
25#include <linux/workqueue.h> 24#include <linux/workqueue.h>
26 25
26#include <net/inet_sock.h>
27#include <net/sock.h> 27#include <net/sock.h>
28#include <net/tcp_states.h> 28#include <net/tcp_states.h>
29#include <net/timewait_sock.h>
29 30
30#include <asm/atomic.h> 31#include <asm/atomic.h>
31 32
@@ -127,7 +128,8 @@ struct inet_timewait_sock {
127 __u16 tw_num; 128 __u16 tw_num;
128 /* And these are ours. */ 129 /* And these are ours. */
129 __u8 tw_ipv6only:1; 130 __u8 tw_ipv6only:1;
130 /* 31 bits hole, try to pack */ 131 /* 15 bits hole, try to pack */
132 __u16 tw_ipv6_offset;
131 int tw_timeout; 133 int tw_timeout;
132 unsigned long tw_ttd; 134 unsigned long tw_ttd;
133 struct inet_bind_bucket *tw_tb; 135 struct inet_bind_bucket *tw_tb;
@@ -199,7 +201,7 @@ static inline void inet_twsk_put(struct inet_timewait_sock *tw)
199 printk(KERN_DEBUG "%s timewait_sock %p released\n", 201 printk(KERN_DEBUG "%s timewait_sock %p released\n",
200 tw->tw_prot->name, tw); 202 tw->tw_prot->name, tw);
201#endif 203#endif
202 kmem_cache_free(tw->tw_prot->twsk_slab, tw); 204 kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw);
203 module_put(owner); 205 module_put(owner);
204 } 206 }
205} 207}
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 7fda471002b6..0965515f40cf 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -25,6 +25,7 @@ struct inet_peer
25 __u32 v4daddr; /* peer's address */ 25 __u32 v4daddr; /* peer's address */
26 __u16 avl_height; 26 __u16 avl_height;
27 __u16 ip_id_count; /* IP ID for the next packet */ 27 __u16 ip_id_count; /* IP ID for the next packet */
28 atomic_t rid; /* Frag reception counter */
28 __u32 tcp_ts; 29 __u32 tcp_ts;
29 unsigned long tcp_ts_stamp; 30 unsigned long tcp_ts_stamp;
30}; 31};
diff --git a/include/net/ip.h b/include/net/ip.h
index e4563bbee6ea..8de0697b364c 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -24,14 +24,10 @@
24 24
25#include <linux/config.h> 25#include <linux/config.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/socket.h>
28#include <linux/ip.h> 27#include <linux/ip.h>
29#include <linux/in.h> 28#include <linux/in.h>
30#include <linux/netdevice.h> 29
31#include <linux/inetdevice.h> 30#include <net/inet_sock.h>
32#include <linux/in_route.h>
33#include <net/route.h>
34#include <net/arp.h>
35#include <net/snmp.h> 31#include <net/snmp.h>
36 32
37struct sock; 33struct sock;
@@ -41,10 +37,10 @@ struct inet_skb_parm
41 struct ip_options opt; /* Compiled IP options */ 37 struct ip_options opt; /* Compiled IP options */
42 unsigned char flags; 38 unsigned char flags;
43 39
44#define IPSKB_MASQUERADED 1 40#define IPSKB_FORWARDED 1
45#define IPSKB_TRANSLATED 2 41#define IPSKB_XFRM_TUNNEL_SIZE 2
46#define IPSKB_FORWARDED 4 42#define IPSKB_XFRM_TRANSFORMED 4
47#define IPSKB_XFRM_TUNNEL_SIZE 8 43#define IPSKB_FRAG_COMPLETE 8
48}; 44};
49 45
50struct ipcm_cookie 46struct ipcm_cookie
@@ -74,6 +70,13 @@ extern rwlock_t ip_ra_lock;
74 70
75#define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */ 71#define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */
76 72
73struct msghdr;
74struct net_device;
75struct packet_type;
76struct rtable;
77struct sk_buff;
78struct sockaddr;
79
77extern void ip_mc_dropsocket(struct sock *); 80extern void ip_mc_dropsocket(struct sock *);
78extern void ip_mc_dropdevice(struct net_device *dev); 81extern void ip_mc_dropdevice(struct net_device *dev);
79extern int igmp_mc_proc_init(void); 82extern int igmp_mc_proc_init(void);
@@ -91,7 +94,6 @@ extern int ip_local_deliver(struct sk_buff *skb);
91extern int ip_mr_input(struct sk_buff *skb); 94extern int ip_mr_input(struct sk_buff *skb);
92extern int ip_output(struct sk_buff *skb); 95extern int ip_output(struct sk_buff *skb);
93extern int ip_mc_output(struct sk_buff *skb); 96extern int ip_mc_output(struct sk_buff *skb);
94extern int ip_fragment(struct sk_buff *skb, int (*out)(struct sk_buff*));
95extern int ip_do_nat(struct sk_buff *skb); 97extern int ip_do_nat(struct sk_buff *skb);
96extern void ip_send_check(struct iphdr *ip); 98extern void ip_send_check(struct iphdr *ip);
97extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); 99extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok);
@@ -168,6 +170,7 @@ extern int sysctl_ipfrag_high_thresh;
168extern int sysctl_ipfrag_low_thresh; 170extern int sysctl_ipfrag_low_thresh;
169extern int sysctl_ipfrag_time; 171extern int sysctl_ipfrag_time;
170extern int sysctl_ipfrag_secret_interval; 172extern int sysctl_ipfrag_secret_interval;
173extern int sysctl_ipfrag_max_dist;
171 174
172/* From inetpeer.c */ 175/* From inetpeer.c */
173extern int inet_peer_threshold; 176extern int inet_peer_threshold;
@@ -182,6 +185,8 @@ extern int sysctl_ip_dynaddr;
182extern void ipfrag_init(void); 185extern void ipfrag_init(void);
183 186
184#ifdef CONFIG_INET 187#ifdef CONFIG_INET
188#include <net/dst.h>
189
185/* The function in 2.2 was invalid, producing wrong result for 190/* The function in 2.2 was invalid, producing wrong result for
186 * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */ 191 * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */
187static inline 192static inline
@@ -310,7 +315,6 @@ enum ip_defrag_users
310 IP_DEFRAG_CALL_RA_CHAIN, 315 IP_DEFRAG_CALL_RA_CHAIN,
311 IP_DEFRAG_CONNTRACK_IN, 316 IP_DEFRAG_CONNTRACK_IN,
312 IP_DEFRAG_CONNTRACK_OUT, 317 IP_DEFRAG_CONNTRACK_OUT,
313 IP_DEFRAG_NAT_OUT,
314 IP_DEFRAG_VS_IN, 318 IP_DEFRAG_VS_IN,
315 IP_DEFRAG_VS_OUT, 319 IP_DEFRAG_VS_OUT,
316 IP_DEFRAG_VS_FWD 320 IP_DEFRAG_VS_FWD
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 14de4ebd1211..e000fa2cd5f6 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -238,6 +238,8 @@ extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif,
238 struct net_device *dev, u32 *spec_dst, u32 *itag); 238 struct net_device *dev, u32 *spec_dst, u32 *itag);
239extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); 239extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
240 240
241struct rtentry;
242
241/* Exported by fib_semantics.c */ 243/* Exported by fib_semantics.c */
242extern int ip_fib_check_default(u32 gw, struct net_device *dev); 244extern int ip_fib_check_default(u32 gw, struct net_device *dev);
243extern int fib_sync_down(u32 local, struct net_device *dev, int force); 245extern int fib_sync_down(u32 local, struct net_device *dev, int force);
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 3b5559a023a4..7d2674fde19a 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -251,16 +251,15 @@ struct ip_vs_daemon_user {
251#include <linux/config.h> 251#include <linux/config.h>
252#include <linux/list.h> /* for struct list_head */ 252#include <linux/list.h> /* for struct list_head */
253#include <linux/spinlock.h> /* for struct rwlock_t */ 253#include <linux/spinlock.h> /* for struct rwlock_t */
254#include <linux/skbuff.h> /* for struct sk_buff */
255#include <linux/ip.h> /* for struct iphdr */
256#include <asm/atomic.h> /* for struct atomic_t */ 254#include <asm/atomic.h> /* for struct atomic_t */
257#include <linux/netdevice.h> /* for struct neighbour */
258#include <net/dst.h> /* for struct dst_entry */
259#include <net/udp.h>
260#include <linux/compiler.h> 255#include <linux/compiler.h>
256#include <linux/timer.h>
261 257
258#include <net/checksum.h>
262 259
263#ifdef CONFIG_IP_VS_DEBUG 260#ifdef CONFIG_IP_VS_DEBUG
261#include <linux/net.h>
262
264extern int ip_vs_get_debug_level(void); 263extern int ip_vs_get_debug_level(void);
265#define IP_VS_DBG(level, msg...) \ 264#define IP_VS_DBG(level, msg...) \
266 do { \ 265 do { \
@@ -429,8 +428,11 @@ struct ip_vs_stats
429 spinlock_t lock; /* spin lock */ 428 spinlock_t lock; /* spin lock */
430}; 429};
431 430
431struct dst_entry;
432struct iphdr;
432struct ip_vs_conn; 433struct ip_vs_conn;
433struct ip_vs_app; 434struct ip_vs_app;
435struct sk_buff;
434 436
435struct ip_vs_protocol { 437struct ip_vs_protocol {
436 struct ip_vs_protocol *next; 438 struct ip_vs_protocol *next;
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 0a2ad51cff82..3b1d963d396c 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -240,6 +240,8 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t
240struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 240struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
241 struct ipv6_txoptions *opt); 241 struct ipv6_txoptions *opt);
242 242
243extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb);
244
243extern int ip6_frag_nqueues; 245extern int ip6_frag_nqueues;
244extern atomic_t ip6_frag_mem; 246extern atomic_t ip6_frag_mem;
245 247
@@ -416,6 +418,8 @@ extern int ipv6_rcv(struct sk_buff *skb,
416 struct packet_type *pt, 418 struct packet_type *pt,
417 struct net_device *orig_dev); 419 struct net_device *orig_dev);
418 420
421extern int ip6_rcv_finish(struct sk_buff *skb);
422
419/* 423/*
420 * upper-layer output functions 424 * upper-layer output functions
421 */ 425 */
@@ -525,6 +529,9 @@ extern int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
525extern int inet6_ioctl(struct socket *sock, unsigned int cmd, 529extern int inet6_ioctl(struct socket *sock, unsigned int cmd,
526 unsigned long arg); 530 unsigned long arg);
527 531
532extern int inet6_hash_connect(struct inet_timewait_death_row *death_row,
533 struct sock *sk);
534
528/* 535/*
529 * reassembly.c 536 * reassembly.c
530 */ 537 */
@@ -533,8 +540,11 @@ extern int sysctl_ip6frag_low_thresh;
533extern int sysctl_ip6frag_time; 540extern int sysctl_ip6frag_time;
534extern int sysctl_ip6frag_secret_interval; 541extern int sysctl_ip6frag_secret_interval;
535 542
536extern struct proto_ops inet6_stream_ops; 543extern const struct proto_ops inet6_stream_ops;
537extern struct proto_ops inet6_dgram_ops; 544extern const struct proto_ops inet6_dgram_ops;
545
546struct group_source_req;
547struct group_filter;
538 548
539extern int ip6_mc_source(int add, int omode, struct sock *sk, 549extern int ip6_mc_source(int add, int omode, struct sock *sk,
540 struct group_source_req *pgsr); 550 struct group_source_req *pgsr);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index f85d6e4b7442..bbac87eeb422 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -35,11 +35,20 @@ enum {
35 35
36#ifdef __KERNEL__ 36#ifdef __KERNEL__
37 37
38#include <linux/skbuff.h> 38#include <linux/config.h>
39#include <linux/netdevice.h> 39#include <linux/compiler.h>
40#include <linux/icmpv6.h> 40#include <linux/icmpv6.h>
41#include <linux/in6.h>
42#include <linux/types.h>
43
41#include <net/neighbour.h> 44#include <net/neighbour.h>
42#include <asm/atomic.h> 45
46struct ctl_table;
47struct file;
48struct inet6_dev;
49struct net_device;
50struct net_proto_family;
51struct sk_buff;
43 52
44extern struct neigh_table nd_tbl; 53extern struct neigh_table nd_tbl;
45 54
@@ -108,7 +117,7 @@ extern int igmp6_event_report(struct sk_buff *skb);
108extern void igmp6_cleanup(void); 117extern void igmp6_cleanup(void);
109 118
110#ifdef CONFIG_SYSCTL 119#ifdef CONFIG_SYSCTL
111extern int ndisc_ifinfo_sysctl_change(ctl_table *ctl, 120extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
112 int write, 121 int write,
113 struct file * filp, 122 struct file * filp,
114 void __user *buffer, 123 void __user *buffer,
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 34c07731933d..6fa9ae190741 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -49,8 +49,8 @@
49#ifdef __KERNEL__ 49#ifdef __KERNEL__
50 50
51#include <asm/atomic.h> 51#include <asm/atomic.h>
52#include <linux/skbuff.h>
53#include <linux/netdevice.h> 52#include <linux/netdevice.h>
53#include <linux/skbuff.h>
54#include <linux/rcupdate.h> 54#include <linux/rcupdate.h>
55#include <linux/seq_file.h> 55#include <linux/seq_file.h>
56 56
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index cc4825610795..64b82b74a650 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -94,6 +94,9 @@ struct nf_conn
94 /* Current number of expected connections */ 94 /* Current number of expected connections */
95 unsigned int expecting; 95 unsigned int expecting;
96 96
97 /* Unique ID that identifies this conntrack*/
98 unsigned int id;
99
97 /* Helper. if any */ 100 /* Helper. if any */
98 struct nf_conntrack_helper *helper; 101 struct nf_conntrack_helper *helper;
99 102
@@ -140,6 +143,9 @@ struct nf_conntrack_expect
140 /* Usage count. */ 143 /* Usage count. */
141 atomic_t use; 144 atomic_t use;
142 145
146 /* Unique ID */
147 unsigned int id;
148
143 /* Flags */ 149 /* Flags */
144 unsigned int flags; 150 unsigned int flags;
145 151
@@ -190,6 +196,31 @@ static inline void nf_ct_put(struct nf_conn *ct)
190 nf_conntrack_put(&ct->ct_general); 196 nf_conntrack_put(&ct->ct_general);
191} 197}
192 198
199extern struct nf_conntrack_tuple_hash *
200__nf_conntrack_find(const struct nf_conntrack_tuple *tuple,
201 const struct nf_conn *ignored_conntrack);
202
203extern void nf_conntrack_hash_insert(struct nf_conn *ct);
204
205extern struct nf_conntrack_expect *
206__nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
207
208extern struct nf_conntrack_expect *
209nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
210
211extern void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
212
213extern void nf_ct_remove_expectations(struct nf_conn *ct);
214
215extern void nf_conntrack_flush(void);
216
217extern struct nf_conntrack_helper *
218nf_ct_helper_find_get( const struct nf_conntrack_tuple *tuple);
219extern void nf_ct_helper_put(struct nf_conntrack_helper *helper);
220
221extern struct nf_conntrack_helper *
222__nf_conntrack_helper_find_byname(const char *name);
223
193/* call to create an explicit dependency on nf_conntrack. */ 224/* call to create an explicit dependency on nf_conntrack. */
194extern void need_nf_conntrack(void); 225extern void need_nf_conntrack(void);
195 226
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 5a66b2a3a623..86ec8174ad02 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -33,6 +33,8 @@ struct nf_conntrack_helper
33 unsigned int protoff, 33 unsigned int protoff,
34 struct nf_conn *ct, 34 struct nf_conn *ct,
35 enum ip_conntrack_info conntrackinfo); 35 enum ip_conntrack_info conntrackinfo);
36
37 int (*to_nfattr)(struct sk_buff *skb, const struct nf_conn *ct);
36}; 38};
37 39
38extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 40extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 01663e5b33df..67856eb93b43 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -14,6 +14,8 @@
14#include <linux/seq_file.h> 14#include <linux/seq_file.h>
15#include <net/netfilter/nf_conntrack.h> 15#include <net/netfilter/nf_conntrack.h>
16 16
17struct nfattr;
18
17struct nf_conntrack_l3proto 19struct nf_conntrack_l3proto
18{ 20{
19 /* Next pointer. */ 21 /* Next pointer. */
@@ -70,6 +72,12 @@ struct nf_conntrack_l3proto
70 72
71 u_int32_t (*get_features)(const struct nf_conntrack_tuple *tuple); 73 u_int32_t (*get_features)(const struct nf_conntrack_tuple *tuple);
72 74
75 int (*tuple_to_nfattr)(struct sk_buff *skb,
76 const struct nf_conntrack_tuple *t);
77
78 int (*nfattr_to_tuple)(struct nfattr *tb[],
79 struct nf_conntrack_tuple *t);
80
73 /* Module (if any) which this is connected to. */ 81 /* Module (if any) which this is connected to. */
74 struct module *me; 82 struct module *me;
75}; 83};
@@ -81,11 +89,16 @@ extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
81extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); 89extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto);
82 90
83static inline struct nf_conntrack_l3proto * 91static inline struct nf_conntrack_l3proto *
84nf_ct_find_l3proto(u_int16_t l3proto) 92__nf_ct_l3proto_find(u_int16_t l3proto)
85{ 93{
86 return nf_ct_l3protos[l3proto]; 94 return nf_ct_l3protos[l3proto];
87} 95}
88 96
97extern struct nf_conntrack_l3proto *
98nf_ct_l3proto_find_get(u_int16_t l3proto);
99
100extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
101
89/* Existing built-in protocols */ 102/* Existing built-in protocols */
90extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4; 103extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4;
91extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6; 104extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;
diff --git a/include/net/netfilter/nf_conntrack_protocol.h b/include/net/netfilter/nf_conntrack_protocol.h
index b3afda35397a..1f33737fcea5 100644
--- a/include/net/netfilter/nf_conntrack_protocol.h
+++ b/include/net/netfilter/nf_conntrack_protocol.h
@@ -12,6 +12,7 @@
12#include <net/netfilter/nf_conntrack.h> 12#include <net/netfilter/nf_conntrack.h>
13 13
14struct seq_file; 14struct seq_file;
15struct nfattr;
15 16
16struct nf_conntrack_protocol 17struct nf_conntrack_protocol
17{ 18{
@@ -66,6 +67,18 @@ struct nf_conntrack_protocol
66 enum ip_conntrack_info *ctinfo, 67 enum ip_conntrack_info *ctinfo,
67 int pf, unsigned int hooknum); 68 int pf, unsigned int hooknum);
68 69
70 /* convert protoinfo to nfnetink attributes */
71 int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
72 const struct nf_conn *ct);
73
74 /* convert nfnetlink attributes to protoinfo */
75 int (*from_nfattr)(struct nfattr *tb[], struct nf_conn *ct);
76
77 int (*tuple_to_nfattr)(struct sk_buff *skb,
78 const struct nf_conntrack_tuple *t);
79 int (*nfattr_to_tuple)(struct nfattr *tb[],
80 struct nf_conntrack_tuple *t);
81
69 /* Module (if any) which this is connected to. */ 82 /* Module (if any) which this is connected to. */
70 struct module *me; 83 struct module *me;
71}; 84};
@@ -80,12 +93,23 @@ extern struct nf_conntrack_protocol nf_conntrack_generic_protocol;
80extern struct nf_conntrack_protocol **nf_ct_protos[PF_MAX]; 93extern struct nf_conntrack_protocol **nf_ct_protos[PF_MAX];
81 94
82extern struct nf_conntrack_protocol * 95extern struct nf_conntrack_protocol *
83nf_ct_find_proto(u_int16_t l3proto, u_int8_t protocol); 96__nf_ct_proto_find(u_int16_t l3proto, u_int8_t protocol);
97
98extern struct nf_conntrack_protocol *
99nf_ct_proto_find_get(u_int16_t l3proto, u_int8_t protocol);
100
101extern void nf_ct_proto_put(struct nf_conntrack_protocol *p);
84 102
85/* Protocol registration. */ 103/* Protocol registration. */
86extern int nf_conntrack_protocol_register(struct nf_conntrack_protocol *proto); 104extern int nf_conntrack_protocol_register(struct nf_conntrack_protocol *proto);
87extern void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto); 105extern void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto);
88 106
107/* Generic netlink helpers */
108extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb,
109 const struct nf_conntrack_tuple *tuple);
110extern int nf_ct_port_nfattr_to_tuple(struct nfattr *tb[],
111 struct nf_conntrack_tuple *t);
112
89/* Log invalid packets */ 113/* Log invalid packets */
90extern unsigned int nf_ct_log_invalid; 114extern unsigned int nf_ct_log_invalid;
91 115
diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h
index bd08964b72c0..b225d8472b7e 100644
--- a/include/net/pkt_act.h
+++ b/include/net/pkt_act.h
@@ -15,7 +15,6 @@
15#include <linux/in.h> 15#include <linux/in.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/netdevice.h>
19#include <linux/skbuff.h> 18#include <linux/skbuff.h>
20#include <linux/rtnetlink.h> 19#include <linux/rtnetlink.h>
21#include <linux/module.h> 20#include <linux/module.h>
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 6492e7363d84..b94d1ad92c4d 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -1,6 +1,7 @@
1#ifndef __NET_PKT_SCHED_H 1#ifndef __NET_PKT_SCHED_H
2#define __NET_PKT_SCHED_H 2#define __NET_PKT_SCHED_H
3 3
4#include <linux/jiffies.h>
4#include <net/sch_generic.h> 5#include <net/sch_generic.h>
5 6
6struct qdisc_walker 7struct qdisc_walker
@@ -59,8 +60,8 @@ typedef struct timeval psched_time_t;
59typedef long psched_tdiff_t; 60typedef long psched_tdiff_t;
60 61
61#define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp)) 62#define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp))
62#define PSCHED_US2JIFFIE(usecs) (((usecs)+(1000000/HZ-1))/(1000000/HZ)) 63#define PSCHED_US2JIFFIE(usecs) usecs_to_jiffies(usecs)
63#define PSCHED_JIFFIE2US(delay) ((delay)*(1000000/HZ)) 64#define PSCHED_JIFFIE2US(delay) jiffies_to_usecs(delay)
64 65
65#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ 66#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
66 67
@@ -123,9 +124,9 @@ do { \
123 default: \ 124 default: \
124 __delta = 0; \ 125 __delta = 0; \
125 case 2: \ 126 case 2: \
126 __delta += 1000000; \ 127 __delta += USEC_PER_SEC; \
127 case 1: \ 128 case 1: \
128 __delta += 1000000; \ 129 __delta += USEC_PER_SEC; \
129 } \ 130 } \
130 } \ 131 } \
131 __delta; \ 132 __delta; \
@@ -136,9 +137,9 @@ psched_tod_diff(int delta_sec, int bound)
136{ 137{
137 int delta; 138 int delta;
138 139
139 if (bound <= 1000000 || delta_sec > (0x7FFFFFFF/1000000)-1) 140 if (bound <= USEC_PER_SEC || delta_sec > (0x7FFFFFFF/USEC_PER_SEC)-1)
140 return bound; 141 return bound;
141 delta = delta_sec * 1000000; 142 delta = delta_sec * USEC_PER_SEC;
142 if (delta > bound || delta < 0) 143 if (delta > bound || delta < 0)
143 delta = bound; 144 delta = bound;
144 return delta; 145 return delta;
@@ -152,9 +153,9 @@ psched_tod_diff(int delta_sec, int bound)
152 default: \ 153 default: \
153 __delta = psched_tod_diff(__delta_sec, bound); break; \ 154 __delta = psched_tod_diff(__delta_sec, bound); break; \
154 case 2: \ 155 case 2: \
155 __delta += 1000000; \ 156 __delta += USEC_PER_SEC; \
156 case 1: \ 157 case 1: \
157 __delta += 1000000; \ 158 __delta += USEC_PER_SEC; \
158 case 0: \ 159 case 0: \
159 if (__delta > bound || __delta < 0) \ 160 if (__delta > bound || __delta < 0) \
160 __delta = bound; \ 161 __delta = bound; \
@@ -170,15 +171,15 @@ psched_tod_diff(int delta_sec, int bound)
170({ \ 171({ \
171 int __delta = (tv).tv_usec + (delta); \ 172 int __delta = (tv).tv_usec + (delta); \
172 (tv_res).tv_sec = (tv).tv_sec; \ 173 (tv_res).tv_sec = (tv).tv_sec; \
173 if (__delta > 1000000) { (tv_res).tv_sec++; __delta -= 1000000; } \ 174 if (__delta > USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \
174 (tv_res).tv_usec = __delta; \ 175 (tv_res).tv_usec = __delta; \
175}) 176})
176 177
177#define PSCHED_TADD(tv, delta) \ 178#define PSCHED_TADD(tv, delta) \
178({ \ 179({ \
179 (tv).tv_usec += (delta); \ 180 (tv).tv_usec += (delta); \
180 if ((tv).tv_usec > 1000000) { (tv).tv_sec++; \ 181 if ((tv).tv_usec > USEC_PER_SEC) { (tv).tv_sec++; \
181 (tv).tv_usec -= 1000000; } \ 182 (tv).tv_usec -= USEC_PER_SEC; } \
182}) 183})
183 184
184/* Set/check that time is in the "past perfect"; 185/* Set/check that time is in the "past perfect";
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 357691f6a45f..6dc5970612d7 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -43,7 +43,7 @@ struct net_protocol {
43#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 43#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
44struct inet6_protocol 44struct inet6_protocol
45{ 45{
46 int (*handler)(struct sk_buff **skb, unsigned int *nhoffp); 46 int (*handler)(struct sk_buff **skb);
47 47
48 void (*err_handler)(struct sk_buff *skb, 48 void (*err_handler)(struct sk_buff *skb,
49 struct inet6_skb_parm *opt, 49 struct inet6_skb_parm *opt,
@@ -65,7 +65,7 @@ struct inet_protosw {
65 int protocol; /* This is the L4 protocol number. */ 65 int protocol; /* This is the L4 protocol number. */
66 66
67 struct proto *prot; 67 struct proto *prot;
68 struct proto_ops *ops; 68 const struct proto_ops *ops;
69 69
70 int capability; /* Which (if any) capability do 70 int capability; /* Which (if any) capability do
71 * we need to use this socket 71 * we need to use this socket
@@ -76,6 +76,7 @@ struct inet_protosw {
76}; 76};
77#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ 77#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */
78#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */ 78#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */
79#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */
79 80
80extern struct net_protocol *inet_protocol_base; 81extern struct net_protocol *inet_protocol_base;
81extern struct net_protocol *inet_protos[MAX_INET_PROTOS]; 82extern struct net_protocol *inet_protos[MAX_INET_PROTOS];
diff --git a/include/net/raw.h b/include/net/raw.h
index f47917469b12..e67b28a0248c 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -19,6 +19,8 @@
19 19
20#include <linux/config.h> 20#include <linux/config.h>
21 21
22#include <net/protocol.h>
23
22extern struct proto raw_prot; 24extern struct proto raw_prot;
23 25
24extern void raw_err(struct sock *, struct sk_buff *, u32 info); 26extern void raw_err(struct sock *, struct sk_buff *, u32 info);
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index b52cc52ffe39..11641c9384f7 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -244,7 +244,7 @@ static inline int reqsk_queue_is_full(const struct request_sock_queue *queue)
244 244
245static inline void reqsk_queue_hash_req(struct request_sock_queue *queue, 245static inline void reqsk_queue_hash_req(struct request_sock_queue *queue,
246 u32 hash, struct request_sock *req, 246 u32 hash, struct request_sock *req,
247 unsigned timeout) 247 unsigned long timeout)
248{ 248{
249 struct listen_sock *lopt = queue->listen_opt; 249 struct listen_sock *lopt = queue->listen_opt;
250 250
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 8e7794ee27ff..f5c22d77feab 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -277,6 +277,24 @@ struct sctp_sock {
277 __u32 default_context; 277 __u32 default_context;
278 __u32 default_timetolive; 278 __u32 default_timetolive;
279 279
280 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
281 * the destination address every heartbeat interval. This value
282 * will be inherited by all new associations.
283 */
284 __u32 hbinterval;
285
286 /* This is the max_retrans value for new associations. */
287 __u16 pathmaxrxt;
288
289 /* The initial Path MTU to use for new associations. */
290 __u32 pathmtu;
291
292 /* The default SACK delay timeout for new associations. */
293 __u32 sackdelay;
294
295 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
296 __u32 param_flags;
297
280 struct sctp_initmsg initmsg; 298 struct sctp_initmsg initmsg;
281 struct sctp_rtoinfo rtoinfo; 299 struct sctp_rtoinfo rtoinfo;
282 struct sctp_paddrparams paddrparam; 300 struct sctp_paddrparams paddrparam;
@@ -845,9 +863,6 @@ struct sctp_transport {
845 /* Data that has been sent, but not acknowledged. */ 863 /* Data that has been sent, but not acknowledged. */
846 __u32 flight_size; 864 __u32 flight_size;
847 865
848 /* PMTU : The current known path MTU. */
849 __u32 pmtu;
850
851 /* Destination */ 866 /* Destination */
852 struct dst_entry *dst; 867 struct dst_entry *dst;
853 /* Source address. */ 868 /* Source address. */
@@ -862,7 +877,22 @@ struct sctp_transport {
862 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to 877 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
863 * the destination address every heartbeat interval. 878 * the destination address every heartbeat interval.
864 */ 879 */
865 int hb_interval; 880 __u32 hbinterval;
881
882 /* This is the max_retrans value for the transport and will
883 * be initialized from the assocs value. This can be changed
884 * using SCTP_SET_PEER_ADDR_PARAMS socket option.
885 */
886 __u16 pathmaxrxt;
887
888 /* PMTU : The current known path MTU. */
889 __u32 pathmtu;
890
891 /* SACK delay timeout */
892 __u32 sackdelay;
893
894 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
895 __u32 param_flags;
866 896
867 /* When was the last time (in jiffies) that we heard from this 897 /* When was the last time (in jiffies) that we heard from this
868 * transport? We use this to pick new active and retran paths. 898 * transport? We use this to pick new active and retran paths.
@@ -882,22 +912,11 @@ struct sctp_transport {
882 */ 912 */
883 int state; 913 int state;
884 914
885 /* hb_allowed : The current heartbeat state of this destination,
886 * : i.e. ALLOW-HB, NO-HEARTBEAT, etc.
887 */
888 int hb_allowed;
889
890 /* These are the error stats for this destination. */ 915 /* These are the error stats for this destination. */
891 916
892 /* Error count : The current error count for this destination. */ 917 /* Error count : The current error count for this destination. */
893 unsigned short error_count; 918 unsigned short error_count;
894 919
895 /* This is the max_retrans value for the transport and will
896 * be initialized to proto.max_retrans.path. This can be changed
897 * using SCTP_SET_PEER_ADDR_PARAMS socket option.
898 */
899 int max_retrans;
900
901 /* Per : A timer used by each destination. 920 /* Per : A timer used by each destination.
902 * Destination : 921 * Destination :
903 * Timer : 922 * Timer :
@@ -1502,6 +1521,28 @@ struct sctp_association {
1502 /* The largest timeout or RTO value to use in attempting an INIT */ 1521 /* The largest timeout or RTO value to use in attempting an INIT */
1503 __u16 max_init_timeo; 1522 __u16 max_init_timeo;
1504 1523
1524 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
1525 * the destination address every heartbeat interval. This value
1526 * will be inherited by all new transports.
1527 */
1528 __u32 hbinterval;
1529
1530 /* This is the max_retrans value for new transports in the
1531 * association.
1532 */
1533 __u16 pathmaxrxt;
1534
1535 /* Association : The smallest PMTU discovered for all of the
1536 * PMTU : peer's transport addresses.
1537 */
1538 __u32 pathmtu;
1539
1540 /* SACK delay timeout */
1541 __u32 sackdelay;
1542
1543 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
1544 __u32 param_flags;
1545
1505 int timeouts[SCTP_NUM_TIMEOUT_TYPES]; 1546 int timeouts[SCTP_NUM_TIMEOUT_TYPES];
1506 struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES]; 1547 struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
1507 1548
@@ -1571,11 +1612,6 @@ struct sctp_association {
1571 */ 1612 */
1572 wait_queue_head_t wait; 1613 wait_queue_head_t wait;
1573 1614
1574 /* Association : The smallest PMTU discovered for all of the
1575 * PMTU : peer's transport addresses.
1576 */
1577 __u32 pmtu;
1578
1579 /* The message size at which SCTP fragmentation will occur. */ 1615 /* The message size at which SCTP fragmentation will occur. */
1580 __u32 frag_point; 1616 __u32 frag_point;
1581 1617
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index f1c3bc54526a..8a6bef6f91eb 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -93,6 +93,8 @@ enum sctp_optname {
93#define SCTP_STATUS SCTP_STATUS 93#define SCTP_STATUS SCTP_STATUS
94 SCTP_GET_PEER_ADDR_INFO, 94 SCTP_GET_PEER_ADDR_INFO,
95#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO 95#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO
96 SCTP_DELAYED_ACK_TIME,
97#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME
96 98
97 /* Internal Socket Options. Some of the sctp library functions are 99 /* Internal Socket Options. Some of the sctp library functions are
98 * implemented using these socket options. 100 * implemented using these socket options.
@@ -503,13 +505,41 @@ struct sctp_setadaption {
503 * unreachable. The following structure is used to access and modify an 505 * unreachable. The following structure is used to access and modify an
504 * address's parameters: 506 * address's parameters:
505 */ 507 */
508enum sctp_spp_flags {
509 SPP_HB_ENABLE = 1, /*Enable heartbeats*/
510 SPP_HB_DISABLE = 2, /*Disable heartbeats*/
511 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
512 SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/
513 SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/
514 SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/
515 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
516 SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/
517 SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/
518 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
519};
520
506struct sctp_paddrparams { 521struct sctp_paddrparams {
507 sctp_assoc_t spp_assoc_id; 522 sctp_assoc_t spp_assoc_id;
508 struct sockaddr_storage spp_address; 523 struct sockaddr_storage spp_address;
509 __u32 spp_hbinterval; 524 __u32 spp_hbinterval;
510 __u16 spp_pathmaxrxt; 525 __u16 spp_pathmaxrxt;
526 __u32 spp_pathmtu;
527 __u32 spp_sackdelay;
528 __u32 spp_flags;
511} __attribute__((packed, aligned(4))); 529} __attribute__((packed, aligned(4)));
512 530
531/* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME)
532 *
533 * This options will get or set the delayed ack timer. The time is set
534 * in milliseconds. If the assoc_id is 0, then this sets or gets the
535 * endpoints default delayed ack timer value. If the assoc_id field is
536 * non-zero, then the set or get effects the specified association.
537 */
538struct sctp_assoc_value {
539 sctp_assoc_t assoc_id;
540 uint32_t assoc_value;
541};
542
513/* 543/*
514 * 7.2.2 Peer Address Information 544 * 7.2.2 Peer Address Information
515 * 545 *
diff --git a/include/net/sock.h b/include/net/sock.h
index 982b4ecd187b..1806e5b61419 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -493,6 +493,7 @@ extern void sk_stream_kill_queues(struct sock *sk);
493extern int sk_wait_data(struct sock *sk, long *timeo); 493extern int sk_wait_data(struct sock *sk, long *timeo);
494 494
495struct request_sock_ops; 495struct request_sock_ops;
496struct timewait_sock_ops;
496 497
497/* Networking protocol blocks we attach to sockets. 498/* Networking protocol blocks we attach to sockets.
498 * socket layer -> transport layer interface 499 * socket layer -> transport layer interface
@@ -557,11 +558,10 @@ struct proto {
557 kmem_cache_t *slab; 558 kmem_cache_t *slab;
558 unsigned int obj_size; 559 unsigned int obj_size;
559 560
560 kmem_cache_t *twsk_slab;
561 unsigned int twsk_obj_size;
562 atomic_t *orphan_count; 561 atomic_t *orphan_count;
563 562
564 struct request_sock_ops *rsk_prot; 563 struct request_sock_ops *rsk_prot;
564 struct timewait_sock_ops *twsk_prot;
565 565
566 struct module *owner; 566 struct module *owner;
567 567
@@ -856,8 +856,8 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock)
856 856
857 filter = sk->sk_filter; 857 filter = sk->sk_filter;
858 if (filter) { 858 if (filter) {
859 int pkt_len = sk_run_filter(skb, filter->insns, 859 unsigned int pkt_len = sk_run_filter(skb, filter->insns,
860 filter->len); 860 filter->len);
861 if (!pkt_len) 861 if (!pkt_len)
862 err = -EPERM; 862 err = -EPERM;
863 else 863 else
@@ -926,6 +926,29 @@ static inline void sock_put(struct sock *sk)
926 sk_free(sk); 926 sk_free(sk);
927} 927}
928 928
929static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb)
930{
931 int rc = NET_RX_SUCCESS;
932
933 if (sk_filter(sk, skb, 0))
934 goto discard_and_relse;
935
936 skb->dev = NULL;
937
938 bh_lock_sock(sk);
939 if (!sock_owned_by_user(sk))
940 rc = sk->sk_backlog_rcv(sk, skb);
941 else
942 sk_add_backlog(sk, skb);
943 bh_unlock_sock(sk);
944out:
945 sock_put(sk);
946 return rc;
947discard_and_relse:
948 kfree_skb(skb);
949 goto out;
950}
951
929/* Detach socket from process context. 952/* Detach socket from process context.
930 * Announce socket dead, detach it from wait queue and inode. 953 * Announce socket dead, detach it from wait queue and inode.
931 * Note that parent inode held reference count on this struct sock, 954 * Note that parent inode held reference count on this struct sock,
@@ -1166,7 +1189,10 @@ static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
1166 1189
1167static inline int sock_error(struct sock *sk) 1190static inline int sock_error(struct sock *sk)
1168{ 1191{
1169 int err = xchg(&sk->sk_err, 0); 1192 int err;
1193 if (likely(!sk->sk_err))
1194 return 0;
1195 err = xchg(&sk->sk_err, 0);
1170 return -err; 1196 return -err;
1171} 1197}
1172 1198
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d78025f9fbea..77f21c65bbca 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -225,53 +225,6 @@ extern atomic_t tcp_sockets_allocated;
225extern int tcp_memory_pressure; 225extern int tcp_memory_pressure;
226 226
227/* 227/*
228 * Pointers to address related TCP functions
229 * (i.e. things that depend on the address family)
230 */
231
232struct tcp_func {
233 int (*queue_xmit) (struct sk_buff *skb,
234 int ipfragok);
235
236 void (*send_check) (struct sock *sk,
237 struct tcphdr *th,
238 int len,
239 struct sk_buff *skb);
240
241 int (*rebuild_header) (struct sock *sk);
242
243 int (*conn_request) (struct sock *sk,
244 struct sk_buff *skb);
245
246 struct sock * (*syn_recv_sock) (struct sock *sk,
247 struct sk_buff *skb,
248 struct request_sock *req,
249 struct dst_entry *dst);
250
251 int (*remember_stamp) (struct sock *sk);
252
253 __u16 net_header_len;
254
255 int (*setsockopt) (struct sock *sk,
256 int level,
257 int optname,
258 char __user *optval,
259 int optlen);
260
261 int (*getsockopt) (struct sock *sk,
262 int level,
263 int optname,
264 char __user *optval,
265 int __user *optlen);
266
267
268 void (*addr2sockaddr) (struct sock *sk,
269 struct sockaddr *);
270
271 int sockaddr_len;
272};
273
274/*
275 * The next routines deal with comparing 32 bit unsigned ints 228 * The next routines deal with comparing 32 bit unsigned ints
276 * and worry about wraparound (automatic with unsigned arithmetic). 229 * and worry about wraparound (automatic with unsigned arithmetic).
277 */ 230 */
@@ -334,6 +287,9 @@ extern int tcp_rcv_established(struct sock *sk,
334 287
335extern void tcp_rcv_space_adjust(struct sock *sk); 288extern void tcp_rcv_space_adjust(struct sock *sk);
336 289
290extern int tcp_twsk_unique(struct sock *sk,
291 struct sock *sktw, void *twp);
292
337static inline void tcp_dec_quickack_mode(struct sock *sk, 293static inline void tcp_dec_quickack_mode(struct sock *sk,
338 const unsigned int pkts) 294 const unsigned int pkts)
339{ 295{
@@ -405,8 +361,7 @@ extern void tcp_parse_options(struct sk_buff *skb,
405 * TCP v4 functions exported for the inet6 API 361 * TCP v4 functions exported for the inet6 API
406 */ 362 */
407 363
408extern void tcp_v4_send_check(struct sock *sk, 364extern void tcp_v4_send_check(struct sock *sk, int len,
409 struct tcphdr *th, int len,
410 struct sk_buff *skb); 365 struct sk_buff *skb);
411 366
412extern int tcp_v4_conn_request(struct sock *sk, 367extern int tcp_v4_conn_request(struct sock *sk,
@@ -490,34 +445,16 @@ typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,
490extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, 445extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
491 sk_read_actor_t recv_actor); 446 sk_read_actor_t recv_actor);
492 447
493/* Initialize RCV_MSS value. 448extern void tcp_initialize_rcv_mss(struct sock *sk);
494 * RCV_MSS is an our guess about MSS used by the peer.
495 * We haven't any direct information about the MSS.
496 * It's better to underestimate the RCV_MSS rather than overestimate.
497 * Overestimations make us ACKing less frequently than needed.
498 * Underestimations are more easy to detect and fix by tcp_measure_rcv_mss().
499 */
500 449
501static inline void tcp_initialize_rcv_mss(struct sock *sk) 450static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
502{
503 struct tcp_sock *tp = tcp_sk(sk);
504 unsigned int hint = min_t(unsigned int, tp->advmss, tp->mss_cache);
505
506 hint = min(hint, tp->rcv_wnd/2);
507 hint = min(hint, TCP_MIN_RCVMSS);
508 hint = max(hint, TCP_MIN_MSS);
509
510 inet_csk(sk)->icsk_ack.rcv_mss = hint;
511}
512
513static __inline__ void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
514{ 451{
515 tp->pred_flags = htonl((tp->tcp_header_len << 26) | 452 tp->pred_flags = htonl((tp->tcp_header_len << 26) |
516 ntohl(TCP_FLAG_ACK) | 453 ntohl(TCP_FLAG_ACK) |
517 snd_wnd); 454 snd_wnd);
518} 455}
519 456
520static __inline__ void tcp_fast_path_on(struct tcp_sock *tp) 457static inline void tcp_fast_path_on(struct tcp_sock *tp)
521{ 458{
522 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); 459 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale);
523} 460}
@@ -535,7 +472,7 @@ static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp)
535 * Rcv_nxt can be after the window if our peer push more data 472 * Rcv_nxt can be after the window if our peer push more data
536 * than the offered window. 473 * than the offered window.
537 */ 474 */
538static __inline__ u32 tcp_receive_window(const struct tcp_sock *tp) 475static inline u32 tcp_receive_window(const struct tcp_sock *tp)
539{ 476{
540 s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt; 477 s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt;
541 478
@@ -707,6 +644,7 @@ extern void tcp_cleanup_congestion_control(struct sock *sk);
707extern int tcp_set_default_congestion_control(const char *name); 644extern int tcp_set_default_congestion_control(const char *name);
708extern void tcp_get_default_congestion_control(char *name); 645extern void tcp_get_default_congestion_control(char *name);
709extern int tcp_set_congestion_control(struct sock *sk, const char *name); 646extern int tcp_set_congestion_control(struct sock *sk, const char *name);
647extern void tcp_slow_start(struct tcp_sock *tp);
710 648
711extern struct tcp_congestion_ops tcp_init_congestion_ops; 649extern struct tcp_congestion_ops tcp_init_congestion_ops;
712extern u32 tcp_reno_ssthresh(struct sock *sk); 650extern u32 tcp_reno_ssthresh(struct sock *sk);
@@ -746,7 +684,7 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event)
746 * "Packets left network, but not honestly ACKed yet" PLUS 684 * "Packets left network, but not honestly ACKed yet" PLUS
747 * "Packets fast retransmitted" 685 * "Packets fast retransmitted"
748 */ 686 */
749static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) 687static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
750{ 688{
751 return (tp->packets_out - tp->left_out + tp->retrans_out); 689 return (tp->packets_out - tp->left_out + tp->retrans_out);
752} 690}
@@ -766,33 +704,6 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
766 (tp->snd_cwnd >> 2))); 704 (tp->snd_cwnd >> 2)));
767} 705}
768 706
769/*
770 * Linear increase during slow start
771 */
772static inline void tcp_slow_start(struct tcp_sock *tp)
773{
774 if (sysctl_tcp_abc) {
775 /* RFC3465: Slow Start
776 * TCP sender SHOULD increase cwnd by the number of
777 * previously unacknowledged bytes ACKed by each incoming
778 * acknowledgment, provided the increase is not more than L
779 */
780 if (tp->bytes_acked < tp->mss_cache)
781 return;
782
783 /* We MAY increase by 2 if discovered delayed ack */
784 if (sysctl_tcp_abc > 1 && tp->bytes_acked > 2*tp->mss_cache) {
785 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
786 tp->snd_cwnd++;
787 }
788 }
789 tp->bytes_acked = 0;
790
791 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
792 tp->snd_cwnd++;
793}
794
795
796static inline void tcp_sync_left_out(struct tcp_sock *tp) 707static inline void tcp_sync_left_out(struct tcp_sock *tp)
797{ 708{
798 if (tp->rx_opt.sack_ok && 709 if (tp->rx_opt.sack_ok &&
@@ -801,34 +712,7 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp)
801 tp->left_out = tp->sacked_out + tp->lost_out; 712 tp->left_out = tp->sacked_out + tp->lost_out;
802} 713}
803 714
804/* Set slow start threshold and cwnd not falling to slow start */ 715extern void tcp_enter_cwr(struct sock *sk);
805static inline void __tcp_enter_cwr(struct sock *sk)
806{
807 const struct inet_connection_sock *icsk = inet_csk(sk);
808 struct tcp_sock *tp = tcp_sk(sk);
809
810 tp->undo_marker = 0;
811 tp->snd_ssthresh = icsk->icsk_ca_ops->ssthresh(sk);
812 tp->snd_cwnd = min(tp->snd_cwnd,
813 tcp_packets_in_flight(tp) + 1U);
814 tp->snd_cwnd_cnt = 0;
815 tp->high_seq = tp->snd_nxt;
816 tp->snd_cwnd_stamp = tcp_time_stamp;
817 TCP_ECN_queue_cwr(tp);
818}
819
820static inline void tcp_enter_cwr(struct sock *sk)
821{
822 struct tcp_sock *tp = tcp_sk(sk);
823
824 tp->prior_ssthresh = 0;
825 tp->bytes_acked = 0;
826 if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) {
827 __tcp_enter_cwr(sk);
828 tcp_set_ca_state(sk, TCP_CA_CWR);
829 }
830}
831
832extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); 716extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
833 717
834/* Slow start with delack produces 3 packets of burst, so that 718/* Slow start with delack produces 3 packets of burst, so that
@@ -860,14 +744,14 @@ static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight)
860 return left <= tcp_max_burst(tp); 744 return left <= tcp_max_burst(tp);
861} 745}
862 746
863static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, 747static inline void tcp_minshall_update(struct tcp_sock *tp, int mss,
864 const struct sk_buff *skb) 748 const struct sk_buff *skb)
865{ 749{
866 if (skb->len < mss) 750 if (skb->len < mss)
867 tp->snd_sml = TCP_SKB_CB(skb)->end_seq; 751 tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
868} 752}
869 753
870static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) 754static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp)
871{ 755{
872 const struct inet_connection_sock *icsk = inet_csk(sk); 756 const struct inet_connection_sock *icsk = inet_csk(sk);
873 if (!tp->packets_out && !icsk->icsk_pending) 757 if (!tp->packets_out && !icsk->icsk_pending)
@@ -875,18 +759,18 @@ static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *t
875 icsk->icsk_rto, TCP_RTO_MAX); 759 icsk->icsk_rto, TCP_RTO_MAX);
876} 760}
877 761
878static __inline__ void tcp_push_pending_frames(struct sock *sk, 762static inline void tcp_push_pending_frames(struct sock *sk,
879 struct tcp_sock *tp) 763 struct tcp_sock *tp)
880{ 764{
881 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); 765 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle);
882} 766}
883 767
884static __inline__ void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) 768static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq)
885{ 769{
886 tp->snd_wl1 = seq; 770 tp->snd_wl1 = seq;
887} 771}
888 772
889static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) 773static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
890{ 774{
891 tp->snd_wl1 = seq; 775 tp->snd_wl1 = seq;
892} 776}
@@ -894,19 +778,19 @@ static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
894/* 778/*
895 * Calculate(/check) TCP checksum 779 * Calculate(/check) TCP checksum
896 */ 780 */
897static __inline__ u16 tcp_v4_check(struct tcphdr *th, int len, 781static inline u16 tcp_v4_check(struct tcphdr *th, int len,
898 unsigned long saddr, unsigned long daddr, 782 unsigned long saddr, unsigned long daddr,
899 unsigned long base) 783 unsigned long base)
900{ 784{
901 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base); 785 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
902} 786}
903 787
904static __inline__ int __tcp_checksum_complete(struct sk_buff *skb) 788static inline int __tcp_checksum_complete(struct sk_buff *skb)
905{ 789{
906 return __skb_checksum_complete(skb); 790 return __skb_checksum_complete(skb);
907} 791}
908 792
909static __inline__ int tcp_checksum_complete(struct sk_buff *skb) 793static inline int tcp_checksum_complete(struct sk_buff *skb)
910{ 794{
911 return skb->ip_summed != CHECKSUM_UNNECESSARY && 795 return skb->ip_summed != CHECKSUM_UNNECESSARY &&
912 __tcp_checksum_complete(skb); 796 __tcp_checksum_complete(skb);
@@ -914,7 +798,7 @@ static __inline__ int tcp_checksum_complete(struct sk_buff *skb)
914 798
915/* Prequeue for VJ style copy to user, combined with checksumming. */ 799/* Prequeue for VJ style copy to user, combined with checksumming. */
916 800
917static __inline__ void tcp_prequeue_init(struct tcp_sock *tp) 801static inline void tcp_prequeue_init(struct tcp_sock *tp)
918{ 802{
919 tp->ucopy.task = NULL; 803 tp->ucopy.task = NULL;
920 tp->ucopy.len = 0; 804 tp->ucopy.len = 0;
@@ -930,7 +814,7 @@ static __inline__ void tcp_prequeue_init(struct tcp_sock *tp)
930 * 814 *
931 * NOTE: is this not too big to inline? 815 * NOTE: is this not too big to inline?
932 */ 816 */
933static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb) 817static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
934{ 818{
935 struct tcp_sock *tp = tcp_sk(sk); 819 struct tcp_sock *tp = tcp_sk(sk);
936 820
@@ -971,7 +855,7 @@ static const char *statename[]={
971}; 855};
972#endif 856#endif
973 857
974static __inline__ void tcp_set_state(struct sock *sk, int state) 858static inline void tcp_set_state(struct sock *sk, int state)
975{ 859{
976 int oldstate = sk->sk_state; 860 int oldstate = sk->sk_state;
977 861
@@ -1005,7 +889,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state)
1005#endif 889#endif
1006} 890}
1007 891
1008static __inline__ void tcp_done(struct sock *sk) 892static inline void tcp_done(struct sock *sk)
1009{ 893{
1010 tcp_set_state(sk, TCP_CLOSE); 894 tcp_set_state(sk, TCP_CLOSE);
1011 tcp_clear_xmit_timers(sk); 895 tcp_clear_xmit_timers(sk);
@@ -1018,81 +902,13 @@ static __inline__ void tcp_done(struct sock *sk)
1018 inet_csk_destroy_sock(sk); 902 inet_csk_destroy_sock(sk);
1019} 903}
1020 904
1021static __inline__ void tcp_sack_reset(struct tcp_options_received *rx_opt) 905static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1022{ 906{
1023 rx_opt->dsack = 0; 907 rx_opt->dsack = 0;
1024 rx_opt->eff_sacks = 0; 908 rx_opt->eff_sacks = 0;
1025 rx_opt->num_sacks = 0; 909 rx_opt->num_sacks = 0;
1026} 910}
1027 911
1028static __inline__ void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp, __u32 tstamp)
1029{
1030 if (tp->rx_opt.tstamp_ok) {
1031 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) |
1032 (TCPOPT_NOP << 16) |
1033 (TCPOPT_TIMESTAMP << 8) |
1034 TCPOLEN_TIMESTAMP);
1035 *ptr++ = htonl(tstamp);
1036 *ptr++ = htonl(tp->rx_opt.ts_recent);
1037 }
1038 if (tp->rx_opt.eff_sacks) {
1039 struct tcp_sack_block *sp = tp->rx_opt.dsack ? tp->duplicate_sack : tp->selective_acks;
1040 int this_sack;
1041
1042 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) |
1043 (TCPOPT_NOP << 16) |
1044 (TCPOPT_SACK << 8) |
1045 (TCPOLEN_SACK_BASE +
1046 (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK)));
1047 for(this_sack = 0; this_sack < tp->rx_opt.eff_sacks; this_sack++) {
1048 *ptr++ = htonl(sp[this_sack].start_seq);
1049 *ptr++ = htonl(sp[this_sack].end_seq);
1050 }
1051 if (tp->rx_opt.dsack) {
1052 tp->rx_opt.dsack = 0;
1053 tp->rx_opt.eff_sacks--;
1054 }
1055 }
1056}
1057
1058/* Construct a tcp options header for a SYN or SYN_ACK packet.
1059 * If this is every changed make sure to change the definition of
1060 * MAX_SYN_SIZE to match the new maximum number of options that you
1061 * can generate.
1062 */
1063static inline void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack,
1064 int offer_wscale, int wscale, __u32 tstamp, __u32 ts_recent)
1065{
1066 /* We always get an MSS option.
1067 * The option bytes which will be seen in normal data
1068 * packets should timestamps be used, must be in the MSS
1069 * advertised. But we subtract them from tp->mss_cache so
1070 * that calculations in tcp_sendmsg are simpler etc.
1071 * So account for this fact here if necessary. If we
1072 * don't do this correctly, as a receiver we won't
1073 * recognize data packets as being full sized when we
1074 * should, and thus we won't abide by the delayed ACK
1075 * rules correctly.
1076 * SACKs don't matter, we never delay an ACK when we
1077 * have any of those going out.
1078 */
1079 *ptr++ = htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | mss);
1080 if (ts) {
1081 if(sack)
1082 *ptr++ = __constant_htonl((TCPOPT_SACK_PERM << 24) | (TCPOLEN_SACK_PERM << 16) |
1083 (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
1084 else
1085 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1086 (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
1087 *ptr++ = htonl(tstamp); /* TSVAL */
1088 *ptr++ = htonl(ts_recent); /* TSECR */
1089 } else if(sack)
1090 *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1091 (TCPOPT_SACK_PERM << 8) | TCPOLEN_SACK_PERM);
1092 if (offer_wscale)
1093 *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_WINDOW << 16) | (TCPOLEN_WINDOW << 8) | (wscale));
1094}
1095
1096/* Determine a window scaling and initial window to offer. */ 912/* Determine a window scaling and initial window to offer. */
1097extern void tcp_select_initial_window(int __space, __u32 mss, 913extern void tcp_select_initial_window(int __space, __u32 mss,
1098 __u32 *rcv_wnd, __u32 *window_clamp, 914 __u32 *rcv_wnd, __u32 *window_clamp,
@@ -1117,9 +933,9 @@ static inline int tcp_full_space(const struct sock *sk)
1117 return tcp_win_from_space(sk->sk_rcvbuf); 933 return tcp_win_from_space(sk->sk_rcvbuf);
1118} 934}
1119 935
1120static __inline__ void tcp_openreq_init(struct request_sock *req, 936static inline void tcp_openreq_init(struct request_sock *req,
1121 struct tcp_options_received *rx_opt, 937 struct tcp_options_received *rx_opt,
1122 struct sk_buff *skb) 938 struct sk_buff *skb)
1123{ 939{
1124 struct inet_request_sock *ireq = inet_rsk(req); 940 struct inet_request_sock *ireq = inet_rsk(req);
1125 941
diff --git a/include/net/tcp_states.h b/include/net/tcp_states.h
index b9d4176b2d15..b0b645988bd8 100644
--- a/include/net/tcp_states.h
+++ b/include/net/tcp_states.h
@@ -31,4 +31,20 @@ enum {
31 31
32#define TCP_STATE_MASK 0xF 32#define TCP_STATE_MASK 0xF
33 33
34#define TCP_ACTION_FIN (1 << 7)
35
36enum {
37 TCPF_ESTABLISHED = (1 << 1),
38 TCPF_SYN_SENT = (1 << 2),
39 TCPF_SYN_RECV = (1 << 3),
40 TCPF_FIN_WAIT1 = (1 << 4),
41 TCPF_FIN_WAIT2 = (1 << 5),
42 TCPF_TIME_WAIT = (1 << 6),
43 TCPF_CLOSE = (1 << 7),
44 TCPF_CLOSE_WAIT = (1 << 8),
45 TCPF_LAST_ACK = (1 << 9),
46 TCPF_LISTEN = (1 << 10),
47 TCPF_CLOSING = (1 << 11)
48};
49
34#endif /* _LINUX_TCP_STATES_H */ 50#endif /* _LINUX_TCP_STATES_H */
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
new file mode 100644
index 000000000000..2544281e1d5e
--- /dev/null
+++ b/include/net/timewait_sock.h
@@ -0,0 +1,31 @@
1/*
2 * NET Generic infrastructure for Network protocols.
3 *
4 * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
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 _TIMEWAIT_SOCK_H
12#define _TIMEWAIT_SOCK_H
13
14#include <linux/slab.h>
15#include <net/sock.h>
16
17struct timewait_sock_ops {
18 kmem_cache_t *twsk_slab;
19 unsigned int twsk_obj_size;
20 int (*twsk_unique)(struct sock *sk,
21 struct sock *sktw, void *twp);
22};
23
24static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
25{
26 if (sk->sk_prot->twsk_prot->twsk_unique != NULL)
27 return sk->sk_prot->twsk_prot->twsk_unique(sk, sktw, twp);
28 return 0;
29}
30
31#endif /* _TIMEWAIT_SOCK_H */
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 4e86f2de6638..61f724c1036f 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -44,7 +44,7 @@ extern int datagram_send_ctl(struct msghdr *msg,
44/* 44/*
45 * address family specific functions 45 * address family specific functions
46 */ 46 */
47extern struct tcp_func ipv4_specific; 47extern struct inet_connection_sock_af_ops ipv4_specific;
48 48
49extern int inet6_destroy_sock(struct sock *sk); 49extern int inet6_destroy_sock(struct sock *sk);
50 50
diff --git a/include/net/udp.h b/include/net/udp.h
index 107b9d791a1f..766fba1369ce 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -22,9 +22,8 @@
22#ifndef _UDP_H 22#ifndef _UDP_H
23#define _UDP_H 23#define _UDP_H
24 24
25#include <linux/udp.h>
26#include <linux/ip.h>
27#include <linux/list.h> 25#include <linux/list.h>
26#include <net/inet_sock.h>
28#include <net/sock.h> 27#include <net/sock.h>
29#include <net/snmp.h> 28#include <net/snmp.h>
30#include <linux/seq_file.h> 29#include <linux/seq_file.h>
@@ -62,6 +61,7 @@ static inline int udp_lport_inuse(u16 num)
62 61
63extern struct proto udp_prot; 62extern struct proto udp_prot;
64 63
64struct sk_buff;
65 65
66extern void udp_err(struct sk_buff *, u32); 66extern void udp_err(struct sk_buff *, u32);
67 67
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 1cdb87912137..d09ca0e7d139 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -2,11 +2,12 @@
2#define _NET_XFRM_H 2#define _NET_XFRM_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/in.h>
5#include <linux/xfrm.h> 6#include <linux/xfrm.h>
6#include <linux/spinlock.h> 7#include <linux/spinlock.h>
7#include <linux/list.h> 8#include <linux/list.h>
8#include <linux/skbuff.h> 9#include <linux/skbuff.h>
9#include <linux/netdevice.h> 10#include <linux/socket.h>
10#include <linux/crypto.h> 11#include <linux/crypto.h>
11#include <linux/pfkeyv2.h> 12#include <linux/pfkeyv2.h>
12#include <linux/in6.h> 13#include <linux/in6.h>
@@ -144,6 +145,9 @@ struct xfrm_state
144 * transformer. */ 145 * transformer. */
145 struct xfrm_type *type; 146 struct xfrm_type *type;
146 147
148 /* Security context */
149 struct xfrm_sec_ctx *security;
150
147 /* Private data of this transformer, format is opaque, 151 /* Private data of this transformer, format is opaque,
148 * interpreted by xfrm_type methods. */ 152 * interpreted by xfrm_type methods. */
149 void *data; 153 void *data;
@@ -298,6 +302,7 @@ struct xfrm_policy
298 __u8 flags; 302 __u8 flags;
299 __u8 dead; 303 __u8 dead;
300 __u8 xfrm_nr; 304 __u8 xfrm_nr;
305 struct xfrm_sec_ctx *security;
301 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 306 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
302}; 307};
303 308
@@ -510,6 +515,25 @@ xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl,
510 return 0; 515 return 0;
511} 516}
512 517
518#ifdef CONFIG_SECURITY_NETWORK_XFRM
519/* If neither has a context --> match
520 * Otherwise, both must have a context and the sids, doi, alg must match
521 */
522static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2)
523{
524 return ((!s1 && !s2) ||
525 (s1 && s2 &&
526 (s1->ctx_sid == s2->ctx_sid) &&
527 (s1->ctx_doi == s2->ctx_doi) &&
528 (s1->ctx_alg == s2->ctx_alg)));
529}
530#else
531static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2)
532{
533 return 1;
534}
535#endif
536
513/* A struct encoding bundle of transformations to apply to some set of flow. 537/* A struct encoding bundle of transformations to apply to some set of flow.
514 * 538 *
515 * dst->child points to the next element of bundle. 539 * dst->child points to the next element of bundle.
@@ -644,7 +668,7 @@ static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *s
644 return xfrm_policy_check(sk, dir, skb, AF_INET6); 668 return xfrm_policy_check(sk, dir, skb, AF_INET6);
645} 669}
646 670
647 671extern int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, unsigned short family);
648extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); 672extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
649 673
650static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) 674static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family)
@@ -807,7 +831,7 @@ struct xfrm_tunnel {
807}; 831};
808 832
809struct xfrm6_tunnel { 833struct xfrm6_tunnel {
810 int (*handler)(struct sk_buff **pskb, unsigned int *nhoffp); 834 int (*handler)(struct sk_buff **pskb);
811 void (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, 835 void (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
812 int type, int code, int offset, __u32 info); 836 int type, int code, int offset, __u32 info);
813}; 837};
@@ -842,10 +866,11 @@ extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
842extern int xfrm_init_state(struct xfrm_state *x); 866extern int xfrm_init_state(struct xfrm_state *x);
843extern int xfrm4_rcv(struct sk_buff *skb); 867extern int xfrm4_rcv(struct sk_buff *skb);
844extern int xfrm4_output(struct sk_buff *skb); 868extern int xfrm4_output(struct sk_buff *skb);
869extern int xfrm4_output_finish(struct sk_buff *skb);
845extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); 870extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
846extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); 871extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
847extern int xfrm6_rcv_spi(struct sk_buff **pskb, unsigned int *nhoffp, u32 spi); 872extern int xfrm6_rcv_spi(struct sk_buff **pskb, u32 spi);
848extern int xfrm6_rcv(struct sk_buff **pskb, unsigned int *nhoffp); 873extern int xfrm6_rcv(struct sk_buff **pskb);
849extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); 874extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler);
850extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); 875extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler);
851extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); 876extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr);
@@ -878,8 +903,8 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig
878struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); 903struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp);
879extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); 904extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *);
880int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 905int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
881struct xfrm_policy *xfrm_policy_bysel(int dir, struct xfrm_selector *sel, 906struct xfrm_policy *xfrm_policy_bysel_ctx(int dir, struct xfrm_selector *sel,
882 int delete); 907 struct xfrm_sec_ctx *ctx, int delete);
883struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); 908struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete);
884void xfrm_policy_flush(void); 909void xfrm_policy_flush(void);
885u32 xfrm_get_acqseq(void); 910u32 xfrm_get_acqseq(void);
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 2cab39f49eb2..52660f32663d 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -382,7 +382,6 @@ enum service {
382struct pcmcia_socket; 382struct pcmcia_socket;
383 383
384int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg); 384int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg);
385int pcmcia_deregister_client(struct pcmcia_device *p_dev);
386int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config); 385int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config);
387int pcmcia_get_first_window(window_handle_t *win, win_req_t *req); 386int pcmcia_get_first_window(window_handle_t *win, win_req_t *req);
388int pcmcia_get_next_window(window_handle_t *win, win_req_t *req); 387int pcmcia_get_next_window(window_handle_t *win, win_req_t *req);
@@ -390,7 +389,6 @@ int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status);
390int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); 389int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
391int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); 390int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
392int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); 391int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
393int pcmcia_register_client(client_handle_t *handle, client_reg_t *req);
394int pcmcia_release_configuration(struct pcmcia_device *p_dev); 392int pcmcia_release_configuration(struct pcmcia_device *p_dev);
395int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req); 393int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req);
396int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req); 394int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req);
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index cb8b6e6ce66c..8e2a96396478 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -133,10 +133,12 @@ typedef struct dev_link_t {
133struct pcmcia_socket; 133struct pcmcia_socket;
134 134
135struct pcmcia_driver { 135struct pcmcia_driver {
136 dev_link_t *(*attach)(void); 136 int (*probe) (struct pcmcia_device *dev);
137 int (*event) (event_t event, int priority, 137 void (*remove) (struct pcmcia_device *dev);
138 event_callback_args_t *); 138
139 void (*detach)(dev_link_t *); 139 int (*suspend) (struct pcmcia_device *dev);
140 int (*resume) (struct pcmcia_device *dev);
141
140 struct module *owner; 142 struct module *owner;
141 struct pcmcia_device_id *id_table; 143 struct pcmcia_device_id *id_table;
142 struct device_driver drv; 144 struct device_driver drv;
@@ -164,7 +166,6 @@ struct pcmcia_device {
164 /* deprecated, a cleaned up version will be moved into this 166 /* deprecated, a cleaned up version will be moved into this
165 struct soon */ 167 struct soon */
166 dev_link_t *instance; 168 dev_link_t *instance;
167 event_callback_args_t event_callback_args;
168 u_int state; 169 u_int state;
169 170
170 /* information about this device */ 171 /* information about this device */
@@ -193,6 +194,8 @@ struct pcmcia_device {
193#define handle_to_pdev(handle) (handle) 194#define handle_to_pdev(handle) (handle)
194#define handle_to_dev(handle) (handle->dev) 195#define handle_to_dev(handle) (handle->dev)
195 196
197#define dev_to_instance(dev) (dev->instance)
198
196/* error reporting */ 199/* error reporting */
197void cs_error(client_handle_t handle, int func, int ret); 200void cs_error(client_handle_t handle, int func, int ret);
198 201
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index e788bbc5657d..2889a69a7a8f 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -118,16 +118,14 @@ struct pcmcia_socket;
118struct pccard_operations { 118struct pccard_operations {
119 int (*init)(struct pcmcia_socket *sock); 119 int (*init)(struct pcmcia_socket *sock);
120 int (*suspend)(struct pcmcia_socket *sock); 120 int (*suspend)(struct pcmcia_socket *sock);
121 int (*register_callback)(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info);
122 int (*get_status)(struct pcmcia_socket *sock, u_int *value); 121 int (*get_status)(struct pcmcia_socket *sock, u_int *value);
123 int (*get_socket)(struct pcmcia_socket *sock, socket_state_t *state);
124 int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state); 122 int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
125 int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io); 123 int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io);
126 int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem); 124 int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
127}; 125};
128 126
129struct pccard_resource_ops { 127struct pccard_resource_ops {
130 void (*validate_mem) (struct pcmcia_socket *s); 128 int (*validate_mem) (struct pcmcia_socket *s);
131 int (*adjust_io_region) (struct resource *res, 129 int (*adjust_io_region) (struct resource *res,
132 unsigned long r_start, 130 unsigned long r_start,
133 unsigned long r_end, 131 unsigned long r_end,
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 20da282d4abb..41cfc29be899 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -151,6 +151,6 @@ extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
151extern void scsi_put_command(struct scsi_cmnd *); 151extern void scsi_put_command(struct scsi_cmnd *);
152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int); 152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int);
153extern void scsi_finish_command(struct scsi_cmnd *cmd); 153extern void scsi_finish_command(struct scsi_cmnd *cmd);
154extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries); 154extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd);
155 155
156#endif /* _SCSI_SCSI_CMND_H */ 156#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index b090a11d7e1c..4d69dee66d4d 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -16,7 +16,6 @@ extern void __scsi_print_sense(const char *name,
16extern void scsi_print_driverbyte(int); 16extern void scsi_print_driverbyte(int);
17extern void scsi_print_hostbyte(int); 17extern void scsi_print_hostbyte(int);
18extern void scsi_print_status(unsigned char); 18extern void scsi_print_status(unsigned char);
19extern int scsi_print_msg(const unsigned char *);
20extern const char *scsi_sense_key_string(unsigned char); 19extern const char *scsi_sense_key_string(unsigned char);
21extern const char *scsi_extd_sense_format(unsigned char, unsigned char); 20extern const char *scsi_extd_sense_format(unsigned char, unsigned char);
22 21
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 85cfd88461c8..e94ca4d36035 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -79,9 +79,9 @@ struct scsi_device {
79 char inq_periph_qual; /* PQ from INQUIRY data */ 79 char inq_periph_qual; /* PQ from INQUIRY data */
80 unsigned char inquiry_len; /* valid bytes in 'inquiry' */ 80 unsigned char inquiry_len; /* valid bytes in 'inquiry' */
81 unsigned char * inquiry; /* INQUIRY response data */ 81 unsigned char * inquiry; /* INQUIRY response data */
82 char * vendor; /* [back_compat] point into 'inquiry' ... */ 82 const char * vendor; /* [back_compat] point into 'inquiry' ... */
83 char * model; /* ... after scan; point to static string */ 83 const char * model; /* ... after scan; point to static string */
84 char * rev; /* ... "nullnullnullnull" before scan */ 84 const char * rev; /* ... "nullnullnullnull" before scan */
85 unsigned char current_tag; /* current tag */ 85 unsigned char current_tag; /* current tag */
86 struct scsi_target *sdev_target; /* used only for single_lun */ 86 struct scsi_target *sdev_target; /* used only for single_lun */
87 87
@@ -274,6 +274,12 @@ extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
274extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, 274extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
275 int data_direction, void *buffer, unsigned bufflen, 275 int data_direction, void *buffer, unsigned bufflen,
276 struct scsi_sense_hdr *, int timeout, int retries); 276 struct scsi_sense_hdr *, int timeout, int retries);
277extern int scsi_execute_async(struct scsi_device *sdev,
278 const unsigned char *cmd, int data_direction,
279 void *buffer, unsigned bufflen, int use_sg,
280 int timeout, int retries, void *privdata,
281 void (*done)(void *, char *, int, int),
282 gfp_t gfp);
277 283
278static inline unsigned int sdev_channel(struct scsi_device *sdev) 284static inline unsigned int sdev_channel(struct scsi_device *sdev)
279{ 285{
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 850dfa877fda..02e26c1672bf 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -15,7 +15,6 @@ struct scsi_driver {
15 void (*rescan)(struct device *); 15 void (*rescan)(struct device *);
16 int (*issue_flush)(struct device *, sector_t *); 16 int (*issue_flush)(struct device *, sector_t *);
17 int (*prepare_flush)(struct request_queue *, struct request *); 17 int (*prepare_flush)(struct request_queue *, struct request *);
18 void (*end_flush)(struct request_queue *, struct request *);
19}; 18};
20#define to_scsi_driver(drv) \ 19#define to_scsi_driver(drv) \
21 container_of((drv), struct scsi_driver, gendrv) 20 container_of((drv), struct scsi_driver, gendrv)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 6cbb1982ed03..230bc55c0bfa 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -296,6 +296,12 @@ struct scsi_host_template {
296 int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int); 296 int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int);
297 297
298 /* 298 /*
299 * suspend support
300 */
301 int (*resume)(struct scsi_device *);
302 int (*suspend)(struct scsi_device *);
303
304 /*
299 * Name of proc directory 305 * Name of proc directory
300 */ 306 */
301 char *proc_name; 307 char *proc_name;
@@ -392,7 +398,6 @@ struct scsi_host_template {
392 /* 398 /*
393 * ordered write support 399 * ordered write support
394 */ 400 */
395 unsigned ordered_flush:1;
396 unsigned ordered_tag:1; 401 unsigned ordered_tag:1;
397 402
398 /* 403 /*
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index 6bdc4afb2483..54a89611e9c5 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -24,6 +24,9 @@
24#include <linux/transport_class.h> 24#include <linux/transport_class.h>
25 25
26struct scsi_transport_template; 26struct scsi_transport_template;
27struct scsi_target;
28struct scsi_device;
29struct Scsi_Host;
27 30
28struct spi_transport_attrs { 31struct spi_transport_attrs {
29 int period; /* value in the PPR/SDTR command */ 32 int period; /* value in the PPR/SDTR command */
@@ -143,5 +146,6 @@ void spi_release_transport(struct scsi_transport_template *);
143void spi_schedule_dv_device(struct scsi_device *); 146void spi_schedule_dv_device(struct scsi_device *);
144void spi_dv_device(struct scsi_device *); 147void spi_dv_device(struct scsi_device *);
145void spi_display_xfer_agreement(struct scsi_target *); 148void spi_display_xfer_agreement(struct scsi_target *);
149int spi_print_msg(const unsigned char *);
146 150
147#endif /* SCSI_TRANSPORT_SPI_H */ 151#endif /* SCSI_TRANSPORT_SPI_H */
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 7f0ca79d6c98..b0b3ea7b365e 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -391,65 +391,35 @@
391 * 391 *
392 */ 392 */
393 393
394typedef struct _snd_ac97_bus ac97_bus_t; 394struct snd_ac97;
395typedef struct _snd_ac97_bus_ops ac97_bus_ops_t;
396typedef struct _snd_ac97_template ac97_template_t;
397typedef struct _snd_ac97 ac97_t;
398
399enum ac97_pcm_cfg {
400 AC97_PCM_CFG_FRONT = 2,
401 AC97_PCM_CFG_REAR = 10, /* alias surround */
402 AC97_PCM_CFG_LFE = 11, /* center + lfe */
403 AC97_PCM_CFG_40 = 4, /* front + rear */
404 AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */
405 AC97_PCM_CFG_SPDIF = 20
406};
407
408/* PCM allocation */
409struct ac97_pcm {
410 ac97_bus_t *bus;
411 unsigned int stream: 1, /* stream type: 1 = capture */
412 exclusive: 1, /* exclusive mode, don't override with other pcms */
413 copy_flag: 1, /* lowlevel driver must fill all entries */
414 spdif: 1; /* spdif pcm */
415 unsigned short aslots; /* active slots */
416 unsigned int rates; /* available rates */
417 struct {
418 unsigned short slots; /* driver input: requested AC97 slot numbers */
419 unsigned short rslots[4]; /* allocated slots per codecs */
420 unsigned char rate_table[4];
421 ac97_t *codec[4]; /* allocated codecs */
422 } r[2]; /* 0 = standard rates, 1 = double rates */
423 unsigned long private_value; /* used by the hardware driver */
424};
425 395
426struct snd_ac97_build_ops { 396struct snd_ac97_build_ops {
427 int (*build_3d) (ac97_t *ac97); 397 int (*build_3d) (struct snd_ac97 *ac97);
428 int (*build_specific) (ac97_t *ac97); 398 int (*build_specific) (struct snd_ac97 *ac97);
429 int (*build_spdif) (ac97_t *ac97); 399 int (*build_spdif) (struct snd_ac97 *ac97);
430 int (*build_post_spdif) (ac97_t *ac97); 400 int (*build_post_spdif) (struct snd_ac97 *ac97);
431#ifdef CONFIG_PM 401#ifdef CONFIG_PM
432 void (*suspend) (ac97_t *ac97); 402 void (*suspend) (struct snd_ac97 *ac97);
433 void (*resume) (ac97_t *ac97); 403 void (*resume) (struct snd_ac97 *ac97);
434#endif 404#endif
435 void (*update_jacks) (ac97_t *ac97); /* for jack-sharing */ 405 void (*update_jacks) (struct snd_ac97 *ac97); /* for jack-sharing */
436}; 406};
437 407
438struct _snd_ac97_bus_ops { 408struct snd_ac97_bus_ops {
439 void (*reset) (ac97_t *ac97); 409 void (*reset) (struct snd_ac97 *ac97);
440 void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val); 410 void (*write) (struct snd_ac97 *ac97, unsigned short reg, unsigned short val);
441 unsigned short (*read) (ac97_t *ac97, unsigned short reg); 411 unsigned short (*read) (struct snd_ac97 *ac97, unsigned short reg);
442 void (*wait) (ac97_t *ac97); 412 void (*wait) (struct snd_ac97 *ac97);
443 void (*init) (ac97_t *ac97); 413 void (*init) (struct snd_ac97 *ac97);
444}; 414};
445 415
446struct _snd_ac97_bus { 416struct snd_ac97_bus {
447 /* -- lowlevel (hardware) driver specific -- */ 417 /* -- lowlevel (hardware) driver specific -- */
448 ac97_bus_ops_t *ops; 418 struct snd_ac97_bus_ops *ops;
449 void *private_data; 419 void *private_data;
450 void (*private_free) (ac97_bus_t *bus); 420 void (*private_free) (struct snd_ac97_bus *bus);
451 /* --- */ 421 /* --- */
452 snd_card_t *card; 422 struct snd_card *card;
453 unsigned short num; /* bus number */ 423 unsigned short num; /* bus number */
454 unsigned short no_vra: 1, /* bridge doesn't support VRA */ 424 unsigned short no_vra: 1, /* bridge doesn't support VRA */
455 dra: 1, /* bridge supports double rate */ 425 dra: 1, /* bridge supports double rate */
@@ -459,13 +429,13 @@ struct _snd_ac97_bus {
459 unsigned short used_slots[2][4]; /* actually used PCM slots */ 429 unsigned short used_slots[2][4]; /* actually used PCM slots */
460 unsigned short pcms_count; /* count of PCMs */ 430 unsigned short pcms_count; /* count of PCMs */
461 struct ac97_pcm *pcms; 431 struct ac97_pcm *pcms;
462 ac97_t *codec[4]; 432 struct snd_ac97 *codec[4];
463 snd_info_entry_t *proc; 433 struct snd_info_entry *proc;
464}; 434};
465 435
466struct _snd_ac97_template { 436struct snd_ac97_template {
467 void *private_data; 437 void *private_data;
468 void (*private_free) (ac97_t *ac97); 438 void (*private_free) (struct snd_ac97 *ac97);
469 struct pci_dev *pci; /* assigned PCI device - used for quirks */ 439 struct pci_dev *pci; /* assigned PCI device - used for quirks */
470 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ 440 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */
471 unsigned short addr; /* physical address of codec [0-3] */ 441 unsigned short addr; /* physical address of codec [0-3] */
@@ -474,16 +444,16 @@ struct _snd_ac97_template {
474 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */ 444 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */
475}; 445};
476 446
477struct _snd_ac97 { 447struct snd_ac97 {
478 /* -- lowlevel (hardware) driver specific -- */ 448 /* -- lowlevel (hardware) driver specific -- */
479 struct snd_ac97_build_ops * build_ops; 449 struct snd_ac97_build_ops * build_ops;
480 void *private_data; 450 void *private_data;
481 void (*private_free) (ac97_t *ac97); 451 void (*private_free) (struct snd_ac97 *ac97);
482 /* --- */ 452 /* --- */
483 ac97_bus_t *bus; 453 struct snd_ac97_bus *bus;
484 struct pci_dev *pci; /* assigned PCI device - used for quirks */ 454 struct pci_dev *pci; /* assigned PCI device - used for quirks */
485 snd_info_entry_t *proc; 455 struct snd_info_entry *proc;
486 snd_info_entry_t *proc_regs; 456 struct snd_info_entry *proc_regs;
487 unsigned short subsystem_vendor; 457 unsigned short subsystem_vendor;
488 unsigned short subsystem_device; 458 unsigned short subsystem_device;
489 struct semaphore reg_mutex; 459 struct semaphore reg_mutex;
@@ -517,43 +487,47 @@ struct _snd_ac97 {
517 struct device dev; 487 struct device dev;
518}; 488};
519 489
520#define to_ac97_t(d) container_of(d, struct _snd_ac97, dev) 490#define to_ac97_t(d) container_of(d, struct snd_ac97, dev)
521 491
522/* conditions */ 492/* conditions */
523static inline int ac97_is_audio(ac97_t * ac97) 493static inline int ac97_is_audio(struct snd_ac97 * ac97)
524{ 494{
525 return (ac97->scaps & AC97_SCAP_AUDIO); 495 return (ac97->scaps & AC97_SCAP_AUDIO);
526} 496}
527static inline int ac97_is_modem(ac97_t * ac97) 497static inline int ac97_is_modem(struct snd_ac97 * ac97)
528{ 498{
529 return (ac97->scaps & AC97_SCAP_MODEM); 499 return (ac97->scaps & AC97_SCAP_MODEM);
530} 500}
531static inline int ac97_is_rev22(ac97_t * ac97) 501static inline int ac97_is_rev22(struct snd_ac97 * ac97)
532{ 502{
533 return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22; 503 return (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_22;
534} 504}
535static inline int ac97_can_amap(ac97_t * ac97) 505static inline int ac97_can_amap(struct snd_ac97 * ac97)
536{ 506{
537 return (ac97->ext_id & AC97_EI_AMAP) != 0; 507 return (ac97->ext_id & AC97_EI_AMAP) != 0;
538} 508}
539static inline int ac97_can_spdif(ac97_t * ac97) 509static inline int ac97_can_spdif(struct snd_ac97 * ac97)
540{ 510{
541 return (ac97->ext_id & AC97_EI_SPDIF) != 0; 511 return (ac97->ext_id & AC97_EI_SPDIF) != 0;
542} 512}
543 513
544/* functions */ 514/* functions */
545int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops, void *private_data, ac97_bus_t **rbus); /* create new AC97 bus */ 515/* create new AC97 bus */
546int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97); /* create mixer controls */ 516int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops,
547const char *snd_ac97_get_short_name(ac97_t *ac97); 517 void *private_data, struct snd_ac97_bus **rbus);
548 518/* create mixer controls */
549void snd_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short value); 519int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
550unsigned short snd_ac97_read(ac97_t *ac97, unsigned short reg); 520 struct snd_ac97 **rac97);
551void snd_ac97_write_cache(ac97_t *ac97, unsigned short reg, unsigned short value); 521const char *snd_ac97_get_short_name(struct snd_ac97 *ac97);
552int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value); 522
553int snd_ac97_update_bits(ac97_t *ac97, unsigned short reg, unsigned short mask, unsigned short value); 523void snd_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
524unsigned short snd_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
525void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
526int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short value);
527int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, unsigned short value);
554#ifdef CONFIG_PM 528#ifdef CONFIG_PM
555void snd_ac97_suspend(ac97_t *ac97); 529void snd_ac97_suspend(struct snd_ac97 *ac97);
556void snd_ac97_resume(ac97_t *ac97); 530void snd_ac97_resume(struct snd_ac97 *ac97);
557#endif 531#endif
558 532
559/* quirk types */ 533/* quirk types */
@@ -567,6 +541,7 @@ enum {
567 AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */ 541 AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */
568 AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */ 542 AC97_TUNE_INV_EAPD, /* inverted EAPD implementation */
569 AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */ 543 AC97_TUNE_MUTE_LED, /* EAPD bit works as mute LED */
544 AC97_TUNE_HP_MUTE_LED, /* EAPD bit works as mute LED, use headphone control as master */
570}; 545};
571 546
572struct ac97_quirk { 547struct ac97_quirk {
@@ -578,24 +553,46 @@ struct ac97_quirk {
578 int type; /* quirk type above */ 553 int type; /* quirk type above */
579}; 554};
580 555
581int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *override); 556int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override);
582int snd_ac97_set_rate(ac97_t *ac97, int reg, unsigned int rate); 557int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate);
558
559/*
560 * PCM allocation
561 */
562
563enum ac97_pcm_cfg {
564 AC97_PCM_CFG_FRONT = 2,
565 AC97_PCM_CFG_REAR = 10, /* alias surround */
566 AC97_PCM_CFG_LFE = 11, /* center + lfe */
567 AC97_PCM_CFG_40 = 4, /* front + rear */
568 AC97_PCM_CFG_51 = 6, /* front + rear + center/lfe */
569 AC97_PCM_CFG_SPDIF = 20
570};
571
572struct ac97_pcm {
573 struct snd_ac97_bus *bus;
574 unsigned int stream: 1, /* stream type: 1 = capture */
575 exclusive: 1, /* exclusive mode, don't override with other pcms */
576 copy_flag: 1, /* lowlevel driver must fill all entries */
577 spdif: 1; /* spdif pcm */
578 unsigned short aslots; /* active slots */
579 unsigned int rates; /* available rates */
580 struct {
581 unsigned short slots; /* driver input: requested AC97 slot numbers */
582 unsigned short rslots[4]; /* allocated slots per codecs */
583 unsigned char rate_table[4];
584 struct snd_ac97 *codec[4]; /* allocated codecs */
585 } r[2]; /* 0 = standard rates, 1 = double rates */
586 unsigned long private_value; /* used by the hardware driver */
587};
583 588
584int snd_ac97_pcm_assign(ac97_bus_t *ac97, 589int snd_ac97_pcm_assign(struct snd_ac97_bus *ac97,
585 unsigned short pcms_count, 590 unsigned short pcms_count,
586 const struct ac97_pcm *pcms); 591 const struct ac97_pcm *pcms);
587int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate, 592int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
588 enum ac97_pcm_cfg cfg, unsigned short slots); 593 enum ac97_pcm_cfg cfg, unsigned short slots);
589int snd_ac97_pcm_close(struct ac97_pcm *pcm); 594int snd_ac97_pcm_close(struct ac97_pcm *pcm);
590int snd_ac97_pcm_double_rate_rules(snd_pcm_runtime_t *runtime); 595int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);
591
592struct ac97_enum {
593 unsigned char reg;
594 unsigned char shift_l;
595 unsigned char shift_r;
596 unsigned short mask;
597 const char **texts;
598};
599 596
600/* ad hoc AC97 device driver access */ 597/* ad hoc AC97 device driver access */
601extern struct bus_type ac97_bus_type; 598extern struct bus_type ac97_bus_type;
diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h
index ca2e0e4fa937..b3aa62ee3c8d 100644
--- a/include/sound/ad1816a.h
+++ b/include/sound/ad1816a.h
@@ -123,9 +123,7 @@
123#define AD1816A_CAPTURE_NOT_EQUAL 0x1000 123#define AD1816A_CAPTURE_NOT_EQUAL 0x1000
124#define AD1816A_WSS_ENABLE 0x8000 124#define AD1816A_WSS_ENABLE 0x8000
125 125
126typedef struct _snd_ad1816a ad1816a_t; 126struct snd_ad1816a {
127
128struct _snd_ad1816a {
129 unsigned long port; 127 unsigned long port;
130 struct resource *res_port; 128 struct resource *res_port;
131 int irq; 129 int irq;
@@ -140,15 +138,15 @@ struct _snd_ad1816a {
140 unsigned short mode; 138 unsigned short mode;
141 unsigned int clock_freq; 139 unsigned int clock_freq;
142 140
143 snd_card_t *card; 141 struct snd_card *card;
144 snd_pcm_t *pcm; 142 struct snd_pcm *pcm;
145 143
146 snd_pcm_substream_t *playback_substream; 144 struct snd_pcm_substream *playback_substream;
147 snd_pcm_substream_t *capture_substream; 145 struct snd_pcm_substream *capture_substream;
148 unsigned int p_dma_size; 146 unsigned int p_dma_size;
149 unsigned int c_dma_size; 147 unsigned int c_dma_size;
150 148
151 snd_timer_t *timer; 149 struct snd_timer *timer;
152}; 150};
153 151
154 152
@@ -165,11 +163,11 @@ struct _snd_ad1816a {
165 AD1816A_MODE_TIMER) 163 AD1816A_MODE_TIMER)
166 164
167 165
168extern int snd_ad1816a_create(snd_card_t *card, unsigned long port, 166extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,
169 int irq, int dma1, int dma2, 167 int irq, int dma1, int dma2,
170 ad1816a_t **chip); 168 struct snd_ad1816a **chip);
171 169
172extern int snd_ad1816a_pcm(ad1816a_t *chip, int device, snd_pcm_t **rpcm); 170extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm);
173extern int snd_ad1816a_mixer(ad1816a_t *chip); 171extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
174 172
175#endif /* __SOUND_AD1816A_H */ 173#endif /* __SOUND_AD1816A_H */
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index 7e33b11037f2..1a2759f3a292 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -127,7 +127,7 @@
127#define AD1848_THINKPAD_CTL_PORT2 0x15e9 127#define AD1848_THINKPAD_CTL_PORT2 0x15e9
128#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02 128#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02
129 129
130struct _snd_ad1848 { 130struct snd_ad1848 {
131 unsigned long port; /* i/o port */ 131 unsigned long port; /* i/o port */
132 struct resource *res_port; 132 struct resource *res_port;
133 int irq; /* IRQ line */ 133 int irq; /* IRQ line */
@@ -137,10 +137,10 @@ struct _snd_ad1848 {
137 unsigned short hardware; /* see to AD1848_HW_XXXX */ 137 unsigned short hardware; /* see to AD1848_HW_XXXX */
138 unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ 138 unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
139 139
140 snd_pcm_t *pcm; 140 struct snd_pcm *pcm;
141 snd_pcm_substream_t *playback_substream; 141 struct snd_pcm_substream *playback_substream;
142 snd_pcm_substream_t *capture_substream; 142 struct snd_pcm_substream *capture_substream;
143 snd_card_t *card; 143 struct snd_card *card;
144 144
145 unsigned char image[32]; /* SGalaxy needs an access to extended registers */ 145 unsigned char image[32]; /* SGalaxy needs an access to extended registers */
146 int mce_bit; 146 int mce_bit;
@@ -148,25 +148,28 @@ struct _snd_ad1848 {
148 int dma_size; 148 int dma_size;
149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */ 149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */
150 150
151#ifdef CONFIG_PM
152 void (*suspend)(struct snd_ad1848 *chip);
153 void (*resume)(struct snd_ad1848 *chip);
154#endif
155
151 spinlock_t reg_lock; 156 spinlock_t reg_lock;
152 struct semaphore open_mutex; 157 struct semaphore open_mutex;
153}; 158};
154 159
155typedef struct _snd_ad1848 ad1848_t;
156
157/* exported functions */ 160/* exported functions */
158 161
159void snd_ad1848_out(ad1848_t *chip, unsigned char reg, unsigned char value); 162void snd_ad1848_out(struct snd_ad1848 *chip, unsigned char reg, unsigned char value);
160 163
161int snd_ad1848_create(snd_card_t * card, 164int snd_ad1848_create(struct snd_card *card,
162 unsigned long port, 165 unsigned long port,
163 int irq, int dma, 166 int irq, int dma,
164 unsigned short hardware, 167 unsigned short hardware,
165 ad1848_t ** chip); 168 struct snd_ad1848 ** chip);
166 169
167int snd_ad1848_pcm(ad1848_t * chip, int device, snd_pcm_t **rpcm); 170int snd_ad1848_pcm(struct snd_ad1848 * chip, int device, struct snd_pcm **rpcm);
168const snd_pcm_ops_t *snd_ad1848_get_pcm_ops(int direction); 171const struct snd_pcm_ops *snd_ad1848_get_pcm_ops(int direction);
169int snd_ad1848_mixer(ad1848_t * chip); 172int snd_ad1848_mixer(struct snd_ad1848 * chip);
170 173
171/* exported mixer stuffs */ 174/* exported mixer stuffs */
172enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE }; 175enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
@@ -176,7 +179,7 @@ enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
176#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \ 179#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \
177 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22)) 180 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22))
178 181
179int snd_ad1848_add_ctl(ad1848_t *chip, const char *name, int index, int type, unsigned long value); 182int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int type, unsigned long value);
180 183
181/* for ease of use */ 184/* for ease of use */
182struct ad1848_mix_elem { 185struct ad1848_mix_elem {
@@ -198,7 +201,7 @@ struct ad1848_mix_elem {
198 .type = AD1848_MIX_DOUBLE, \ 201 .type = AD1848_MIX_DOUBLE, \
199 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) } 202 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) }
200 203
201static inline int snd_ad1848_add_ctl_elem(ad1848_t *chip, const struct ad1848_mix_elem *c) 204static inline int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c)
202{ 205{
203 return snd_ad1848_add_ctl(chip, c->name, c->index, c->type, c->private_value); 206 return snd_ad1848_add_ctl(chip, c->name, c->index, c->type, c->private_value);
204} 207}
diff --git a/include/sound/ainstr_fm.h b/include/sound/ainstr_fm.h
index 0ec02953815a..c4afb1f121fe 100644
--- a/include/sound/ainstr_fm.h
+++ b/include/sound/ainstr_fm.h
@@ -39,13 +39,13 @@
39 * FM operator 39 * FM operator
40 */ 40 */
41 41
42typedef struct fm_operator { 42struct fm_operator {
43 unsigned char am_vib; 43 unsigned char am_vib;
44 unsigned char ksl_level; 44 unsigned char ksl_level;
45 unsigned char attack_decay; 45 unsigned char attack_decay;
46 unsigned char sustain_release; 46 unsigned char sustain_release;
47 unsigned char wave_select; 47 unsigned char wave_select;
48} fm_operator_t; 48};
49 49
50/* 50/*
51 * Instrument 51 * Instrument
@@ -54,11 +54,11 @@ typedef struct fm_operator {
54#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */ 54#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
55#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */ 55#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
56 56
57typedef struct { 57struct fm_instrument {
58 unsigned int share_id[4]; /* share id - zero = no sharing */ 58 unsigned int share_id[4]; /* share id - zero = no sharing */
59 unsigned char type; /* instrument type */ 59 unsigned char type; /* instrument type */
60 60
61 fm_operator_t op[4]; 61 struct fm_operator op[4];
62 unsigned char feedback_connection[2]; 62 unsigned char feedback_connection[2];
63 63
64 unsigned char echo_delay; 64 unsigned char echo_delay;
@@ -68,7 +68,7 @@ typedef struct {
68 unsigned char fix_dur; 68 unsigned char fix_dur;
69 unsigned char modes; 69 unsigned char modes;
70 unsigned char fix_key; 70 unsigned char fix_key;
71} fm_instrument_t; 71};
72 72
73/* 73/*
74 * 74 *
@@ -88,25 +88,25 @@ typedef struct {
88 * FM operator 88 * FM operator
89 */ 89 */
90 90
91typedef struct fm_xoperator { 91struct fm_xoperator {
92 __u8 am_vib; 92 __u8 am_vib;
93 __u8 ksl_level; 93 __u8 ksl_level;
94 __u8 attack_decay; 94 __u8 attack_decay;
95 __u8 sustain_release; 95 __u8 sustain_release;
96 __u8 wave_select; 96 __u8 wave_select;
97} fm_xoperator_t; 97};
98 98
99/* 99/*
100 * Instrument 100 * Instrument
101 */ 101 */
102 102
103typedef struct fm_xinstrument { 103struct fm_xinstrument {
104 __u32 stype; /* structure type */ 104 __u32 stype; /* structure type */
105 105
106 __u32 share_id[4]; /* share id - zero = no sharing */ 106 __u32 share_id[4]; /* share id - zero = no sharing */
107 __u8 type; /* instrument type */ 107 __u8 type; /* instrument type */
108 108
109 fm_xoperator_t op[4]; /* fm operators */ 109 struct fm_xoperator op[4]; /* fm operators */
110 __u8 feedback_connection[2]; 110 __u8 feedback_connection[2];
111 111
112 __u8 echo_delay; 112 __u8 echo_delay;
@@ -116,15 +116,19 @@ typedef struct fm_xinstrument {
116 __u8 fix_dur; 116 __u8 fix_dur;
117 __u8 modes; 117 __u8 modes;
118 __u8 fix_key; 118 __u8 fix_key;
119} fm_xinstrument_t; 119};
120 120
121#ifdef __KERNEL__ 121#ifdef __KERNEL__
122 122
123#include "seq_instr.h" 123#include "seq_instr.h"
124 124
125int snd_seq_fm_init(snd_seq_kinstr_ops_t * ops, 125int snd_seq_fm_init(struct snd_seq_kinstr_ops * ops,
126 snd_seq_kinstr_ops_t * next); 126 struct snd_seq_kinstr_ops * next);
127 127
128#endif 128#endif
129 129
130/* typedefs for compatibility to user-space */
131typedef struct fm_xoperator fm_xoperator_t;
132typedef struct fm_xinstrument fm_xinstrument_t;
133
130#endif /* __SOUND_AINSTR_FM_H */ 134#endif /* __SOUND_AINSTR_FM_H */
diff --git a/include/sound/ainstr_gf1.h b/include/sound/ainstr_gf1.h
index ae2ddda63971..47726fe0f46d 100644
--- a/include/sound/ainstr_gf1.h
+++ b/include/sound/ainstr_gf1.h
@@ -52,7 +52,7 @@
52 * Wavetable definitions 52 * Wavetable definitions
53 */ 53 */
54 54
55typedef struct gf1_wave { 55struct gf1_wave {
56 unsigned int share_id[4]; /* share id - zero = no sharing */ 56 unsigned int share_id[4]; /* share id - zero = no sharing */
57 unsigned int format; /* wave format */ 57 unsigned int format; /* wave format */
58 58
@@ -88,7 +88,7 @@ typedef struct gf1_wave {
88 unsigned short scale_factor; /* 0-2048 or 0-2 */ 88 unsigned short scale_factor; /* 0-2048 or 0-2 */
89 89
90 struct gf1_wave *next; 90 struct gf1_wave *next;
91} gf1_wave_t; 91};
92 92
93/* 93/*
94 * Instrument 94 * Instrument
@@ -103,7 +103,7 @@ typedef struct gf1_wave {
103#define IWFFFF_EFFECT_CHORUS 2 103#define IWFFFF_EFFECT_CHORUS 2
104#define IWFFFF_EFFECT_ECHO 3 104#define IWFFFF_EFFECT_ECHO 3
105 105
106typedef struct { 106struct gf1_instrument {
107 unsigned short exclusion; 107 unsigned short exclusion;
108 unsigned short exclusion_group; /* 0 - none, 1-65535 */ 108 unsigned short exclusion_group; /* 0 - none, 1-65535 */
109 109
@@ -112,8 +112,8 @@ typedef struct {
112 unsigned char effect2; /* effect 2 */ 112 unsigned char effect2; /* effect 2 */
113 unsigned char effect2_depth; /* 0-127 */ 113 unsigned char effect2_depth; /* 0-127 */
114 114
115 gf1_wave_t *wave; /* first waveform */ 115 struct gf1_wave *wave; /* first waveform */
116} gf1_instrument_t; 116};
117 117
118/* 118/*
119 * 119 *
@@ -135,7 +135,7 @@ typedef struct {
135 * Wavetable definitions 135 * Wavetable definitions
136 */ 136 */
137 137
138typedef struct gf1_xwave { 138struct gf1_xwave {
139 __u32 stype; /* structure type */ 139 __u32 stype; /* structure type */
140 140
141 __u32 share_id[4]; /* share id - zero = no sharing */ 141 __u32 share_id[4]; /* share id - zero = no sharing */
@@ -165,13 +165,13 @@ typedef struct gf1_xwave {
165 __u8 vibrato_depth; 165 __u8 vibrato_depth;
166 __u16 scale_frequency; 166 __u16 scale_frequency;
167 __u16 scale_factor; /* 0-2048 or 0-2 */ 167 __u16 scale_factor; /* 0-2048 or 0-2 */
168} gf1_xwave_t; 168};
169 169
170/* 170/*
171 * Instrument 171 * Instrument
172 */ 172 */
173 173
174typedef struct gf1_xinstrument { 174struct gf1_xinstrument {
175 __u32 stype; 175 __u32 stype;
176 176
177 __u16 exclusion; 177 __u16 exclusion;
@@ -181,7 +181,7 @@ typedef struct gf1_xinstrument {
181 __u8 effect1_depth; /* 0-127 */ 181 __u8 effect1_depth; /* 0-127 */
182 __u8 effect2; /* effect 2 */ 182 __u8 effect2; /* effect 2 */
183 __u8 effect2_depth; /* 0-127 */ 183 __u8 effect2_depth; /* 0-127 */
184} gf1_xinstrument_t; 184};
185 185
186/* 186/*
187 * Instrument info 187 * Instrument info
@@ -191,35 +191,39 @@ typedef struct gf1_xinstrument {
191#define GF1_INFO_TREMOLO (1<<1) 191#define GF1_INFO_TREMOLO (1<<1)
192#define GF1_INFO_VIBRATO (1<<2) 192#define GF1_INFO_VIBRATO (1<<2)
193 193
194typedef struct gf1_info { 194struct gf1_info {
195 unsigned char flags; /* supported wave flags */ 195 unsigned char flags; /* supported wave flags */
196 unsigned char pad[3]; 196 unsigned char pad[3];
197 unsigned int features; /* supported features */ 197 unsigned int features; /* supported features */
198 unsigned int max8_len; /* maximum 8-bit wave length */ 198 unsigned int max8_len; /* maximum 8-bit wave length */
199 unsigned int max16_len; /* maximum 16-bit wave length */ 199 unsigned int max16_len; /* maximum 16-bit wave length */
200} gf1_info_t; 200};
201 201
202#ifdef __KERNEL__ 202#ifdef __KERNEL__
203 203
204#include "seq_instr.h" 204#include "seq_instr.h"
205 205
206typedef struct { 206struct snd_gf1_ops {
207 void *private_data; 207 void *private_data;
208 int (*info)(void *private_data, gf1_info_t *info); 208 int (*info)(void *private_data, struct gf1_info *info);
209 int (*put_sample)(void *private_data, gf1_wave_t *wave, 209 int (*put_sample)(void *private_data, struct gf1_wave *wave,
210 char __user *data, long len, int atomic); 210 char __user *data, long len, int atomic);
211 int (*get_sample)(void *private_data, gf1_wave_t *wave, 211 int (*get_sample)(void *private_data, struct gf1_wave *wave,
212 char __user *data, long len, int atomic); 212 char __user *data, long len, int atomic);
213 int (*remove_sample)(void *private_data, gf1_wave_t *wave, 213 int (*remove_sample)(void *private_data, struct gf1_wave *wave,
214 int atomic); 214 int atomic);
215 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); 215 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
216 snd_seq_kinstr_ops_t kops; 216 struct snd_seq_kinstr_ops kops;
217} snd_gf1_ops_t; 217};
218 218
219int snd_seq_gf1_init(snd_gf1_ops_t *ops, 219int snd_seq_gf1_init(struct snd_gf1_ops *ops,
220 void *private_data, 220 void *private_data,
221 snd_seq_kinstr_ops_t *next); 221 struct snd_seq_kinstr_ops *next);
222 222
223#endif 223#endif
224 224
225/* typedefs for compatibility to user-space */
226typedef struct gf1_xwave gf1_xwave_t;
227typedef struct gf1_xinstrument gf1_xinstrument_t;
228
225#endif /* __SOUND_AINSTR_GF1_H */ 229#endif /* __SOUND_AINSTR_GF1_H */
diff --git a/include/sound/ainstr_iw.h b/include/sound/ainstr_iw.h
index 8adf744926ff..251feaf1b388 100644
--- a/include/sound/ainstr_iw.h
+++ b/include/sound/ainstr_iw.h
@@ -54,7 +54,7 @@
54 * Wavetable definitions 54 * Wavetable definitions
55 */ 55 */
56 56
57typedef struct iwffff_wave { 57struct iwffff_wave {
58 unsigned int share_id[4]; /* share id - zero = no sharing */ 58 unsigned int share_id[4]; /* share id - zero = no sharing */
59 unsigned int format; /* wave format */ 59 unsigned int format; /* wave format */
60 60
@@ -76,7 +76,7 @@ typedef struct iwffff_wave {
76 unsigned char pad; 76 unsigned char pad;
77 77
78 struct iwffff_wave *next; 78 struct iwffff_wave *next;
79} iwffff_wave_t; 79};
80 80
81/* 81/*
82 * Layer 82 * Layer
@@ -85,13 +85,13 @@ typedef struct iwffff_wave {
85#define IWFFFF_LFO_SHAPE_TRIANGLE 0 85#define IWFFFF_LFO_SHAPE_TRIANGLE 0
86#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1 86#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1
87 87
88typedef struct iwffff_lfo { 88struct iwffff_lfo {
89 unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */ 89 unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */
90 signed short depth; /* volume +- (0-255) 0.48675dB/step */ 90 signed short depth; /* volume +- (0-255) 0.48675dB/step */
91 signed short sweep; /* 0 - 950 deciseconds */ 91 signed short sweep; /* 0 - 950 deciseconds */
92 unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */ 92 unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */
93 unsigned char delay; /* 0 - 255 deciseconds */ 93 unsigned char delay; /* 0 - 255 deciseconds */
94} iwffff_lfo_t; 94};
95 95
96#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */ 96#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */
97 97
@@ -102,12 +102,12 @@ typedef struct iwffff_lfo {
102#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */ 102#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */
103#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */ 103#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */
104 104
105typedef struct iwffff_env_point { 105struct iwffff_env_point {
106 unsigned short offset; 106 unsigned short offset;
107 unsigned short rate; 107 unsigned short rate;
108} iwffff_env_point_t; 108};
109 109
110typedef struct iwffff_env_record { 110struct iwffff_env_record {
111 unsigned short nattack; 111 unsigned short nattack;
112 unsigned short nrelease; 112 unsigned short nrelease;
113 unsigned short sustain_offset; 113 unsigned short sustain_offset;
@@ -118,15 +118,15 @@ typedef struct iwffff_env_record {
118 struct iwffff_env_record *next; 118 struct iwffff_env_record *next;
119 /* points are stored here */ 119 /* points are stored here */
120 /* count of points = nattack + nrelease */ 120 /* count of points = nattack + nrelease */
121} iwffff_env_record_t; 121};
122 122
123typedef struct iwffff_env { 123struct iwffff_env {
124 unsigned char flags; 124 unsigned char flags;
125 unsigned char mode; 125 unsigned char mode;
126 unsigned char index; 126 unsigned char index;
127 unsigned char pad; 127 unsigned char pad;
128 struct iwffff_env_record *record; 128 struct iwffff_env_record *record;
129} iwffff_env_t; 129};
130 130
131#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */ 131#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */
132 132
@@ -138,7 +138,7 @@ typedef struct iwffff_env {
138#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */ 138#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */
139#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */ 139#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */
140 140
141typedef struct iwffff_layer { 141struct iwffff_layer {
142 unsigned char flags; 142 unsigned char flags;
143 unsigned char velocity_mode; 143 unsigned char velocity_mode;
144 unsigned char layer_event; 144 unsigned char layer_event;
@@ -147,17 +147,17 @@ typedef struct iwffff_layer {
147 unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */ 147 unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */
148 unsigned char pan_freq_scale; /* position based on frequency (0-127) */ 148 unsigned char pan_freq_scale; /* position based on frequency (0-127) */
149 unsigned char attenuation; /* 0-127 (no corresponding midi controller) */ 149 unsigned char attenuation; /* 0-127 (no corresponding midi controller) */
150 iwffff_lfo_t tremolo; /* tremolo effect */ 150 struct iwffff_lfo tremolo; /* tremolo effect */
151 iwffff_lfo_t vibrato; /* vibrato effect */ 151 struct iwffff_lfo vibrato; /* vibrato effect */
152 unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ 152 unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
153 unsigned char freq_center; /* center for keyboard frequency scaling */ 153 unsigned char freq_center; /* center for keyboard frequency scaling */
154 unsigned char pad; 154 unsigned char pad;
155 iwffff_env_t penv; /* pitch envelope */ 155 struct iwffff_env penv; /* pitch envelope */
156 iwffff_env_t venv; /* volume envelope */ 156 struct iwffff_env venv; /* volume envelope */
157 157
158 iwffff_wave_t *wave; 158 struct iwffff_wave *wave;
159 struct iwffff_layer *next; 159 struct iwffff_layer *next;
160} iwffff_layer_t; 160};
161 161
162/* 162/*
163 * Instrument 163 * Instrument
@@ -177,7 +177,7 @@ typedef struct iwffff_layer {
177#define IWFFFF_EFFECT_CHORUS 2 177#define IWFFFF_EFFECT_CHORUS 2
178#define IWFFFF_EFFECT_ECHO 3 178#define IWFFFF_EFFECT_ECHO 3
179 179
180typedef struct { 180struct iwffff_instrument {
181 unsigned short exclusion; 181 unsigned short exclusion;
182 unsigned short layer_type; 182 unsigned short layer_type;
183 unsigned short exclusion_group; /* 0 - none, 1-65535 */ 183 unsigned short exclusion_group; /* 0 - none, 1-65535 */
@@ -187,8 +187,8 @@ typedef struct {
187 unsigned char effect2; /* effect 2 */ 187 unsigned char effect2; /* effect 2 */
188 unsigned char effect2_depth; /* 0-127 */ 188 unsigned char effect2_depth; /* 0-127 */
189 189
190 iwffff_layer_t *layer; /* first layer */ 190 struct iwffff_layer *layer; /* first layer */
191} iwffff_instrument_t; 191};
192 192
193/* 193/*
194 * 194 *
@@ -216,7 +216,7 @@ typedef struct {
216 * Wavetable definitions 216 * Wavetable definitions
217 */ 217 */
218 218
219typedef struct iwffff_xwave { 219struct iwffff_xwave {
220 __u32 stype; /* structure type */ 220 __u32 stype; /* structure type */
221 221
222 __u32 share_id[4]; /* share id - zero = no sharing */ 222 __u32 share_id[4]; /* share id - zero = no sharing */
@@ -234,26 +234,26 @@ typedef struct iwffff_xwave {
234 __u8 low_note; /* lower frequency range for this waveform */ 234 __u8 low_note; /* lower frequency range for this waveform */
235 __u8 high_note; /* higher frequency range for this waveform */ 235 __u8 high_note; /* higher frequency range for this waveform */
236 __u8 pad; 236 __u8 pad;
237} iwffff_xwave_t; 237};
238 238
239/* 239/*
240 * Layer 240 * Layer
241 */ 241 */
242 242
243typedef struct iwffff_xlfo { 243struct iwffff_xlfo {
244 __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */ 244 __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */
245 __s16 depth; /* volume +- (0-255) 0.48675dB/step */ 245 __s16 depth; /* volume +- (0-255) 0.48675dB/step */
246 __s16 sweep; /* 0 - 950 deciseconds */ 246 __s16 sweep; /* 0 - 950 deciseconds */
247 __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */ 247 __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */
248 __u8 delay; /* 0 - 255 deciseconds */ 248 __u8 delay; /* 0 - 255 deciseconds */
249} iwffff_xlfo_t; 249};
250 250
251typedef struct iwffff_xenv_point { 251struct iwffff_xenv_point {
252 __u16 offset; 252 __u16 offset;
253 __u16 rate; 253 __u16 rate;
254} iwffff_xenv_point_t; 254};
255 255
256typedef struct iwffff_xenv_record { 256struct iwffff_xenv_record {
257 __u32 stype; 257 __u32 stype;
258 __u16 nattack; 258 __u16 nattack;
259 __u16 nrelease; 259 __u16 nrelease;
@@ -264,16 +264,16 @@ typedef struct iwffff_xenv_record {
264 __u8 pad; 264 __u8 pad;
265 /* points are stored here.. */ 265 /* points are stored here.. */
266 /* count of points = nattack + nrelease */ 266 /* count of points = nattack + nrelease */
267} iwffff_xenv_record_t; 267};
268 268
269typedef struct iwffff_xenv { 269struct iwffff_xenv {
270 __u8 flags; 270 __u8 flags;
271 __u8 mode; 271 __u8 mode;
272 __u8 index; 272 __u8 index;
273 __u8 pad; 273 __u8 pad;
274} iwffff_xenv_t; 274};
275 275
276typedef struct iwffff_xlayer { 276struct iwffff_xlayer {
277 __u32 stype; 277 __u32 stype;
278 __u8 flags; 278 __u8 flags;
279 __u8 velocity_mode; 279 __u8 velocity_mode;
@@ -283,20 +283,20 @@ typedef struct iwffff_xlayer {
283 __u8 pan; /* pan offset from CC1 (0 left - 127 right) */ 283 __u8 pan; /* pan offset from CC1 (0 left - 127 right) */
284 __u8 pan_freq_scale; /* position based on frequency (0-127) */ 284 __u8 pan_freq_scale; /* position based on frequency (0-127) */
285 __u8 attenuation; /* 0-127 (no corresponding midi controller) */ 285 __u8 attenuation; /* 0-127 (no corresponding midi controller) */
286 iwffff_xlfo_t tremolo; /* tremolo effect */ 286 struct iwffff_xlfo tremolo; /* tremolo effect */
287 iwffff_xlfo_t vibrato; /* vibrato effect */ 287 struct iwffff_xlfo vibrato; /* vibrato effect */
288 __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */ 288 __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
289 __u8 freq_center; /* center for keyboard frequency scaling */ 289 __u8 freq_center; /* center for keyboard frequency scaling */
290 __u8 pad; 290 __u8 pad;
291 iwffff_xenv_t penv; /* pitch envelope */ 291 struct iwffff_xenv penv; /* pitch envelope */
292 iwffff_xenv_t venv; /* volume envelope */ 292 struct iwffff_xenv venv; /* volume envelope */
293} iwffff_xlayer_t; 293};
294 294
295/* 295/*
296 * Instrument 296 * Instrument
297 */ 297 */
298 298
299typedef struct iwffff_xinstrument { 299struct iwffff_xinstrument {
300 __u32 stype; 300 __u32 stype;
301 301
302 __u16 exclusion; 302 __u16 exclusion;
@@ -307,7 +307,7 @@ typedef struct iwffff_xinstrument {
307 __u8 effect1_depth; /* 0-127 */ 307 __u8 effect1_depth; /* 0-127 */
308 __u8 effect2; /* effect 2 */ 308 __u8 effect2; /* effect 2 */
309 __u8 effect2_depth; /* 0-127 */ 309 __u8 effect2_depth; /* 0-127 */
310} iwffff_xinstrument_t; 310};
311 311
312/* 312/*
313 * ROM support 313 * ROM support
@@ -316,7 +316,7 @@ typedef struct iwffff_xinstrument {
316 316
317#define IWFFFF_ROM_HDR_SIZE 512 317#define IWFFFF_ROM_HDR_SIZE 512
318 318
319typedef struct { 319struct iwffff_rom_header {
320 __u8 iwave[8]; 320 __u8 iwave[8];
321 __u8 revision; 321 __u8 revision;
322 __u8 series_number; 322 __u8 series_number;
@@ -328,7 +328,7 @@ typedef struct {
328 __u8 copyright[128]; 328 __u8 copyright[128];
329 __u8 vendor_name[64]; 329 __u8 vendor_name[64];
330 __u8 description[128]; 330 __u8 description[128];
331} iwffff_rom_header_t; 331};
332 332
333/* 333/*
334 * Instrument info 334 * Instrument info
@@ -339,35 +339,46 @@ typedef struct {
339#define IWFFFF_INFO_LFO_TREMOLO (1<<2) 339#define IWFFFF_INFO_LFO_TREMOLO (1<<2)
340#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3) 340#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3)
341 341
342typedef struct iwffff_info { 342struct iwffff_info {
343 unsigned int format; /* supported format bits */ 343 unsigned int format; /* supported format bits */
344 unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */ 344 unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */
345 unsigned int lfos; /* LFO effects */ 345 unsigned int lfos; /* LFO effects */
346 unsigned int max8_len; /* maximum 8-bit wave length */ 346 unsigned int max8_len; /* maximum 8-bit wave length */
347 unsigned int max16_len; /* maximum 16-bit wave length */ 347 unsigned int max16_len; /* maximum 16-bit wave length */
348} iwffff_info_t; 348};
349 349
350#ifdef __KERNEL__ 350#ifdef __KERNEL__
351 351
352#include "seq_instr.h" 352#include "seq_instr.h"
353 353
354typedef struct { 354struct snd_iwffff_ops {
355 void *private_data; 355 void *private_data;
356 int (*info)(void *private_data, iwffff_info_t *info); 356 int (*info)(void *private_data, struct iwffff_info *info);
357 int (*put_sample)(void *private_data, iwffff_wave_t *wave, 357 int (*put_sample)(void *private_data, struct iwffff_wave *wave,
358 char __user *data, long len, int atomic); 358 char __user *data, long len, int atomic);
359 int (*get_sample)(void *private_data, iwffff_wave_t *wave, 359 int (*get_sample)(void *private_data, struct iwffff_wave *wave,
360 char __user *data, long len, int atomic); 360 char __user *data, long len, int atomic);
361 int (*remove_sample)(void *private_data, iwffff_wave_t *wave, 361 int (*remove_sample)(void *private_data, struct iwffff_wave *wave,
362 int atomic); 362 int atomic);
363 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); 363 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
364 snd_seq_kinstr_ops_t kops; 364 struct snd_seq_kinstr_ops kops;
365} snd_iwffff_ops_t; 365};
366 366
367int snd_seq_iwffff_init(snd_iwffff_ops_t *ops, 367int snd_seq_iwffff_init(struct snd_iwffff_ops *ops,
368 void *private_data, 368 void *private_data,
369 snd_seq_kinstr_ops_t *next); 369 struct snd_seq_kinstr_ops *next);
370 370
371#endif 371#endif
372 372
373/* typedefs for compatibility to user-space */
374typedef struct iwffff_xwave iwffff_xwave_t;
375typedef struct iwffff_xlfo iwffff_xlfo_t;
376typedef struct iwffff_xenv_point iwffff_xenv_point_t;
377typedef struct iwffff_xenv_record iwffff_xenv_record_t;
378typedef struct iwffff_xenv iwffff_xenv_t;
379typedef struct iwffff_xlayer iwffff_xlayer_t;
380typedef struct iwffff_xinstrument iwffff_xinstrument_t;
381typedef struct iwffff_rom_header iwffff_rom_header_t;
382typedef struct iwffff_info iwffff_info_t;
383
373#endif /* __SOUND_AINSTR_IW_H */ 384#endif /* __SOUND_AINSTR_IW_H */
diff --git a/include/sound/ainstr_simple.h b/include/sound/ainstr_simple.h
index 40824b4ab23d..5eead12e58ae 100644
--- a/include/sound/ainstr_simple.h
+++ b/include/sound/ainstr_simple.h
@@ -61,18 +61,18 @@
61 * instrument info 61 * instrument info
62 */ 62 */
63 63
64typedef struct simple_instrument_info { 64struct simple_instrument_info {
65 unsigned int format; /* supported format bits */ 65 unsigned int format; /* supported format bits */
66 unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */ 66 unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
67 unsigned int max8_len; /* maximum 8-bit wave length */ 67 unsigned int max8_len; /* maximum 8-bit wave length */
68 unsigned int max16_len; /* maximum 16-bit wave length */ 68 unsigned int max16_len; /* maximum 16-bit wave length */
69} simple_instrument_info_t; 69};
70 70
71/* 71/*
72 * Instrument 72 * Instrument
73 */ 73 */
74 74
75typedef struct { 75struct simple_instrument {
76 unsigned int share_id[4]; /* share id - zero = no sharing */ 76 unsigned int share_id[4]; /* share id - zero = no sharing */
77 unsigned int format; /* wave format */ 77 unsigned int format; /* wave format */
78 78
@@ -92,7 +92,7 @@ typedef struct {
92 unsigned char effect1_depth; /* 0-127 */ 92 unsigned char effect1_depth; /* 0-127 */
93 unsigned char effect2; /* effect 2 */ 93 unsigned char effect2; /* effect 2 */
94 unsigned char effect2_depth; /* 0-127 */ 94 unsigned char effect2_depth; /* 0-127 */
95} simple_instrument_t; 95};
96 96
97/* 97/*
98 * 98 *
@@ -112,7 +112,7 @@ typedef struct {
112 * Instrument 112 * Instrument
113 */ 113 */
114 114
115typedef struct simple_xinstrument { 115struct simple_xinstrument {
116 __u32 stype; 116 __u32 stype;
117 117
118 __u32 share_id[4]; /* share id - zero = no sharing */ 118 __u32 share_id[4]; /* share id - zero = no sharing */
@@ -128,29 +128,32 @@ typedef struct simple_xinstrument {
128 __u8 effect1_depth; /* 0-127 */ 128 __u8 effect1_depth; /* 0-127 */
129 __u8 effect2; /* effect 2 */ 129 __u8 effect2; /* effect 2 */
130 __u8 effect2_depth; /* 0-127 */ 130 __u8 effect2_depth; /* 0-127 */
131} simple_xinstrument_t; 131};
132 132
133#ifdef __KERNEL__ 133#ifdef __KERNEL__
134 134
135#include "seq_instr.h" 135#include "seq_instr.h"
136 136
137typedef struct { 137struct snd_simple_ops {
138 void *private_data; 138 void *private_data;
139 int (*info)(void *private_data, simple_instrument_info_t *info); 139 int (*info)(void *private_data, struct simple_instrument_info *info);
140 int (*put_sample)(void *private_data, simple_instrument_t *instr, 140 int (*put_sample)(void *private_data, struct simple_instrument *instr,
141 char __user *data, long len, int atomic); 141 char __user *data, long len, int atomic);
142 int (*get_sample)(void *private_data, simple_instrument_t *instr, 142 int (*get_sample)(void *private_data, struct simple_instrument *instr,
143 char __user *data, long len, int atomic); 143 char __user *data, long len, int atomic);
144 int (*remove_sample)(void *private_data, simple_instrument_t *instr, 144 int (*remove_sample)(void *private_data, struct simple_instrument *instr,
145 int atomic); 145 int atomic);
146 void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what); 146 void (*notify)(void *private_data, struct snd_seq_kinstr *instr, int what);
147 snd_seq_kinstr_ops_t kops; 147 struct snd_seq_kinstr_ops kops;
148} snd_simple_ops_t; 148};
149 149
150int snd_seq_simple_init(snd_simple_ops_t *ops, 150int snd_seq_simple_init(struct snd_simple_ops *ops,
151 void *private_data, 151 void *private_data,
152 snd_seq_kinstr_ops_t *next); 152 struct snd_seq_kinstr_ops *next);
153 153
154#endif 154#endif
155 155
156/* typedefs for compatibility to user-space */
157typedef struct simple_xinstrument simple_xinstrument_t;
158
156#endif /* __SOUND_AINSTR_SIMPLE_H */ 159#endif /* __SOUND_AINSTR_SIMPLE_H */
diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h
index f3f2c3e5ae51..11702aa0bea9 100644
--- a/include/sound/ak4114.h
+++ b/include/sound/ak4114.h
@@ -163,10 +163,8 @@
163typedef void (ak4114_write_t)(void *private_data, unsigned char addr, unsigned char data); 163typedef void (ak4114_write_t)(void *private_data, unsigned char addr, unsigned char data);
164typedef unsigned char (ak4114_read_t)(void *private_data, unsigned char addr); 164typedef unsigned char (ak4114_read_t)(void *private_data, unsigned char addr);
165 165
166typedef struct ak4114 ak4114_t;
167
168struct ak4114 { 166struct ak4114 {
169 snd_card_t * card; 167 struct snd_card *card;
170 ak4114_write_t * write; 168 ak4114_write_t * write;
171 ak4114_read_t * read; 169 ak4114_read_t * read;
172 void * private_data; 170 void * private_data;
@@ -174,9 +172,9 @@ struct ak4114 {
174 spinlock_t lock; 172 spinlock_t lock;
175 unsigned char regmap[7]; 173 unsigned char regmap[7];
176 unsigned char txcsb[5]; 174 unsigned char txcsb[5];
177 snd_kcontrol_t *kctls[AK4114_CONTROLS]; 175 struct snd_kcontrol *kctls[AK4114_CONTROLS];
178 snd_pcm_substream_t *playback_substream; 176 struct snd_pcm_substream *playback_substream;
179 snd_pcm_substream_t *capture_substream; 177 struct snd_pcm_substream *capture_substream;
180 unsigned long parity_errors; 178 unsigned long parity_errors;
181 unsigned long v_bit_errors; 179 unsigned long v_bit_errors;
182 unsigned long qcrc_errors; 180 unsigned long qcrc_errors;
@@ -186,20 +184,20 @@ struct ak4114 {
186 struct workqueue_struct *workqueue; 184 struct workqueue_struct *workqueue;
187 struct work_struct work; 185 struct work_struct work;
188 void *change_callback_private; 186 void *change_callback_private;
189 void (*change_callback)(ak4114_t *ak4114, unsigned char c0, unsigned char c1); 187 void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1);
190}; 188};
191 189
192int snd_ak4114_create(snd_card_t *card, 190int snd_ak4114_create(struct snd_card *card,
193 ak4114_read_t *read, ak4114_write_t *write, 191 ak4114_read_t *read, ak4114_write_t *write,
194 unsigned char pgm[7], unsigned char txcsb[5], 192 unsigned char pgm[7], unsigned char txcsb[5],
195 void *private_data, ak4114_t **r_ak4114); 193 void *private_data, struct ak4114 **r_ak4114);
196void snd_ak4114_reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char mask, unsigned char val); 194void snd_ak4114_reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char mask, unsigned char val);
197void snd_ak4114_reinit(ak4114_t *ak4114); 195void snd_ak4114_reinit(struct ak4114 *ak4114);
198int snd_ak4114_build(ak4114_t *ak4114, 196int snd_ak4114_build(struct ak4114 *ak4114,
199 snd_pcm_substream_t *playback_substream, 197 struct snd_pcm_substream *playback_substream,
200 snd_pcm_substream_t *capture_substream); 198 struct snd_pcm_substream *capture_substream);
201int snd_ak4114_external_rate(ak4114_t *ak4114); 199int snd_ak4114_external_rate(struct ak4114 *ak4114);
202int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags); 200int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags);
203 201
204#endif /* __SOUND_AK4114_H */ 202#endif /* __SOUND_AK4114_H */
205 203
diff --git a/include/sound/ak4117.h b/include/sound/ak4117.h
index 9e1dab17c33e..2b96c32f06fd 100644
--- a/include/sound/ak4117.h
+++ b/include/sound/ak4117.h
@@ -155,18 +155,16 @@
155typedef void (ak4117_write_t)(void *private_data, unsigned char addr, unsigned char data); 155typedef void (ak4117_write_t)(void *private_data, unsigned char addr, unsigned char data);
156typedef unsigned char (ak4117_read_t)(void *private_data, unsigned char addr); 156typedef unsigned char (ak4117_read_t)(void *private_data, unsigned char addr);
157 157
158typedef struct ak4117 ak4117_t;
159
160struct ak4117 { 158struct ak4117 {
161 snd_card_t * card; 159 struct snd_card *card;
162 ak4117_write_t * write; 160 ak4117_write_t * write;
163 ak4117_read_t * read; 161 ak4117_read_t * read;
164 void * private_data; 162 void * private_data;
165 unsigned int init: 1; 163 unsigned int init: 1;
166 spinlock_t lock; 164 spinlock_t lock;
167 unsigned char regmap[5]; 165 unsigned char regmap[5];
168 snd_kcontrol_t *kctls[AK4117_CONTROLS]; 166 struct snd_kcontrol *kctls[AK4117_CONTROLS];
169 snd_pcm_substream_t *substream; 167 struct snd_pcm_substream *substream;
170 unsigned long parity_errors; 168 unsigned long parity_errors;
171 unsigned long v_bit_errors; 169 unsigned long v_bit_errors;
172 unsigned long qcrc_errors; 170 unsigned long qcrc_errors;
@@ -176,16 +174,16 @@ struct ak4117 {
176 unsigned char rcs2; 174 unsigned char rcs2;
177 struct timer_list timer; /* statistic timer */ 175 struct timer_list timer; /* statistic timer */
178 void *change_callback_private; 176 void *change_callback_private;
179 void (*change_callback)(ak4117_t *ak4117, unsigned char c0, unsigned char c1); 177 void (*change_callback)(struct ak4117 *ak4117, unsigned char c0, unsigned char c1);
180}; 178};
181 179
182int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *write, 180int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t *write,
183 unsigned char pgm[5], void *private_data, ak4117_t **r_ak4117); 181 unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117);
184void snd_ak4117_reg_write(ak4117_t *ak4117, unsigned char reg, unsigned char mask, unsigned char val); 182void snd_ak4117_reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char mask, unsigned char val);
185void snd_ak4117_reinit(ak4117_t *ak4117); 183void snd_ak4117_reinit(struct ak4117 *ak4117);
186int snd_ak4117_build(ak4117_t *ak4117, snd_pcm_substream_t *capture_substream); 184int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *capture_substream);
187int snd_ak4117_external_rate(ak4117_t *ak4117); 185int snd_ak4117_external_rate(struct ak4117 *ak4117);
188int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags); 186int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags);
189 187
190#endif /* __SOUND_AK4117_H */ 188#endif /* __SOUND_AK4117_H */
191 189
diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h
index 8b18992376d5..edf04070ce7c 100644
--- a/include/sound/ak4531_codec.h
+++ b/include/sound/ak4531_codec.h
@@ -64,17 +64,22 @@
64#define AK4531_AD_IN 0x18 /* AD input select */ 64#define AK4531_AD_IN 0x18 /* AD input select */
65#define AK4531_MIC_GAIN 0x19 /* MIC amplified gain */ 65#define AK4531_MIC_GAIN 0x19 /* MIC amplified gain */
66 66
67typedef struct _snd_ak4531 ak4531_t; 67struct snd_ak4531 {
68 68 void (*write) (struct snd_ak4531 *ak4531, unsigned short reg,
69struct _snd_ak4531 { 69 unsigned short val);
70 void (*write) (ak4531_t *ak4531, unsigned short reg, unsigned short val);
71 void *private_data; 70 void *private_data;
72 void (*private_free) (ak4531_t *ak4531); 71 void (*private_free) (struct snd_ak4531 *ak4531);
73 /* --- */ 72 /* --- */
74 unsigned char regs[0x20]; 73 unsigned char regs[0x20];
75 struct semaphore reg_mutex; 74 struct semaphore reg_mutex;
76}; 75};
77 76
78int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531); 77int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
78 struct snd_ak4531 **rak4531);
79
80#ifdef CONFIG_PM
81void snd_ak4531_suspend(struct snd_ak4531 *ak4531);
82void snd_ak4531_resume(struct snd_ak4531 *ak4531);
83#endif
79 84
80#endif /* __SOUND_AK4531_CODEC_H */ 85#endif /* __SOUND_AK4531_CODEC_H */
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h
index e94ac0282318..3bf5911fe827 100644
--- a/include/sound/ak4xxx-adda.h
+++ b/include/sound/ak4xxx-adda.h
@@ -27,20 +27,20 @@
27#define AK4XXX_MAX_CHIPS 4 27#define AK4XXX_MAX_CHIPS 4
28#endif 28#endif
29 29
30typedef struct snd_akm4xxx akm4xxx_t; 30struct snd_akm4xxx;
31 31
32struct snd_ak4xxx_ops { 32struct snd_ak4xxx_ops {
33 void (*lock)(akm4xxx_t *ak, int chip); 33 void (*lock)(struct snd_akm4xxx *ak, int chip);
34 void (*unlock)(akm4xxx_t *ak, int chip); 34 void (*unlock)(struct snd_akm4xxx *ak, int chip);
35 void (*write)(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char val); 35 void (*write)(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val);
36 // unsigned char (*read)(akm4xxx_t *ak, int chip, unsigned char reg); 36 // unsigned char (*read)(struct snd_akm4xxx *ak, int chip, unsigned char reg);
37 void (*set_rate_val)(akm4xxx_t *ak, unsigned int rate); 37 void (*set_rate_val)(struct snd_akm4xxx *ak, unsigned int rate);
38}; 38};
39 39
40#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ 40#define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */
41 41
42struct snd_akm4xxx { 42struct snd_akm4xxx {
43 snd_card_t *card; 43 struct snd_card *card;
44 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ 44 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */
45 unsigned int num_dacs; /* AK4524 or AK4528 DACs */ 45 unsigned int num_dacs; /* AK4524 or AK4528 DACs */
46 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ 46 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */
@@ -56,10 +56,10 @@ struct snd_akm4xxx {
56 struct snd_ak4xxx_ops ops; 56 struct snd_ak4xxx_ops ops;
57}; 57};
58 58
59void snd_akm4xxx_write(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char val); 59void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val);
60void snd_akm4xxx_reset(akm4xxx_t *ak, int state); 60void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state);
61void snd_akm4xxx_init(akm4xxx_t *ak); 61void snd_akm4xxx_init(struct snd_akm4xxx *ak);
62int snd_akm4xxx_build_controls(akm4xxx_t *ak); 62int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak);
63 63
64#define snd_akm4xxx_get(ak,chip,reg) (ak)->images[(chip) * 16 + (reg)] 64#define snd_akm4xxx_get(ak,chip,reg) (ak)->images[(chip) * 16 + (reg)]
65#define snd_akm4xxx_set(ak,chip,reg,val) ((ak)->images[(chip) * 16 + (reg)] = (val)) 65#define snd_akm4xxx_set(ak,chip,reg,val) ((ak)->images[(chip) * 16 + (reg)] = (val))
diff --git a/include/sound/asequencer.h b/include/sound/asequencer.h
index 728efd504262..6691e4aa4ea7 100644
--- a/include/sound/asequencer.h
+++ b/include/sound/asequencer.h
@@ -22,11 +22,10 @@
22#ifndef __SOUND_ASEQUENCER_H 22#ifndef __SOUND_ASEQUENCER_H
23#define __SOUND_ASEQUENCER_H 23#define __SOUND_ASEQUENCER_H
24 24
25#ifndef __KERNEL__ 25#ifdef __KERNEL__
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27#endif
28
29#include <sound/asound.h> 27#include <sound/asound.h>
28#endif
30 29
31/** version of the sequencer */ 30/** version of the sequencer */
32#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1) 31#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1)
@@ -36,13 +35,13 @@
36 */ 35 */
37 36
38/** system messages 37/** system messages
39 * event data type = #sndrv_seq_result_t 38 * event data type = #snd_seq_result
40 */ 39 */
41#define SNDRV_SEQ_EVENT_SYSTEM 0 40#define SNDRV_SEQ_EVENT_SYSTEM 0
42#define SNDRV_SEQ_EVENT_RESULT 1 41#define SNDRV_SEQ_EVENT_RESULT 1
43 42
44/** note messages (channel specific) 43/** note messages (channel specific)
45 * event data type = #sndrv_seq_ev_note 44 * event data type = #snd_seq_ev_note
46 */ 45 */
47#define SNDRV_SEQ_EVENT_NOTE 5 46#define SNDRV_SEQ_EVENT_NOTE 5
48#define SNDRV_SEQ_EVENT_NOTEON 6 47#define SNDRV_SEQ_EVENT_NOTEON 6
@@ -50,7 +49,7 @@
50#define SNDRV_SEQ_EVENT_KEYPRESS 8 49#define SNDRV_SEQ_EVENT_KEYPRESS 8
51 50
52/** control messages (channel specific) 51/** control messages (channel specific)
53 * event data type = #sndrv_seq_ev_ctrl 52 * event data type = #snd_seq_ev_ctrl
54 */ 53 */
55#define SNDRV_SEQ_EVENT_CONTROLLER 10 54#define SNDRV_SEQ_EVENT_CONTROLLER 10
56#define SNDRV_SEQ_EVENT_PGMCHANGE 11 55#define SNDRV_SEQ_EVENT_PGMCHANGE 11
@@ -61,7 +60,7 @@
61#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ 60#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
62 61
63/** synchronisation messages 62/** synchronisation messages
64 * event data type = #sndrv_seq_ev_ctrl 63 * event data type = #snd_seq_ev_ctrl
65 */ 64 */
66#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ 65#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
67#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ 66#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
@@ -70,7 +69,7 @@
70#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ 69#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
71 70
72/** timer messages 71/** timer messages
73 * event data type = sndrv_seq_ev_queue_control_t 72 * event data type = snd_seq_ev_queue_control
74 */ 73 */
75#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ 74#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
76#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ 75#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
@@ -96,7 +95,7 @@
96#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ 95#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
97 96
98/** system status messages (broadcast for subscribers) 97/** system status messages (broadcast for subscribers)
99 * event data type = sndrv_seq_addr_t 98 * event data type = snd_seq_addr
100 */ 99 */
101#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ 100#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
102#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ 101#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
@@ -106,13 +105,13 @@
106#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ 105#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
107 106
108/** port connection changes 107/** port connection changes
109 * event data type = sndrv_seq_connect_t 108 * event data type = snd_seq_connect
110 */ 109 */
111#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ 110#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
112#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ 111#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
113 112
114/** synthesizer events 113/** synthesizer events
115 * event data type = sndrv_seq_eve_sample_control_t 114 * event data type = snd_seq_eve_sample_control
116 */ 115 */
117#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */ 116#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
118#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */ 117#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
@@ -163,7 +162,7 @@
163/* 119-129: reserved */ 162/* 119-129: reserved */
164 163
165/* 130-139: variable length events 164/* 130-139: variable length events
166 * event data type = sndrv_seq_ev_ext 165 * event data type = snd_seq_ev_ext
167 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) 166 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
168 */ 167 */
169#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ 168#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
@@ -187,18 +186,18 @@
187#define SNDRV_SEQ_EVENT_NONE 255 186#define SNDRV_SEQ_EVENT_NONE 255
188 187
189 188
190typedef unsigned char sndrv_seq_event_type_t; 189typedef unsigned char snd_seq_event_type_t;
191 190
192/** event address */ 191/** event address */
193struct sndrv_seq_addr { 192struct snd_seq_addr {
194 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ 193 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
195 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ 194 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
196}; 195};
197 196
198/** port connection */ 197/** port connection */
199struct sndrv_seq_connect { 198struct snd_seq_connect {
200 struct sndrv_seq_addr sender; 199 struct snd_seq_addr sender;
201 struct sndrv_seq_addr dest; 200 struct snd_seq_addr dest;
202}; 201};
203 202
204 203
@@ -227,7 +226,7 @@ struct sndrv_seq_connect {
227 226
228 227
229 /* note event */ 228 /* note event */
230struct sndrv_seq_ev_note { 229struct snd_seq_ev_note {
231 unsigned char channel; 230 unsigned char channel;
232 unsigned char note; 231 unsigned char note;
233 unsigned char velocity; 232 unsigned char velocity;
@@ -236,7 +235,7 @@ struct sndrv_seq_ev_note {
236}; 235};
237 236
238 /* controller event */ 237 /* controller event */
239struct sndrv_seq_ev_ctrl { 238struct snd_seq_ev_ctrl {
240 unsigned char channel; 239 unsigned char channel;
241 unsigned char unused1, unused2, unused3; /* pad */ 240 unsigned char unused1, unused2, unused3; /* pad */
242 unsigned int param; 241 unsigned int param;
@@ -244,59 +243,59 @@ struct sndrv_seq_ev_ctrl {
244}; 243};
245 244
246 /* generic set of bytes (12x8 bit) */ 245 /* generic set of bytes (12x8 bit) */
247struct sndrv_seq_ev_raw8 { 246struct snd_seq_ev_raw8 {
248 unsigned char d[12]; /* 8 bit value */ 247 unsigned char d[12]; /* 8 bit value */
249}; 248};
250 249
251 /* generic set of integers (3x32 bit) */ 250 /* generic set of integers (3x32 bit) */
252struct sndrv_seq_ev_raw32 { 251struct snd_seq_ev_raw32 {
253 unsigned int d[3]; /* 32 bit value */ 252 unsigned int d[3]; /* 32 bit value */
254}; 253};
255 254
256 /* external stored data */ 255 /* external stored data */
257struct sndrv_seq_ev_ext { 256struct snd_seq_ev_ext {
258 unsigned int len; /* length of data */ 257 unsigned int len; /* length of data */
259 void *ptr; /* pointer to data (note: maybe 64-bit) */ 258 void *ptr; /* pointer to data (note: maybe 64-bit) */
260} __attribute__((packed)); 259} __attribute__((packed));
261 260
262/* Instrument cluster type */ 261/* Instrument cluster type */
263typedef unsigned int sndrv_seq_instr_cluster_t; 262typedef unsigned int snd_seq_instr_cluster_t;
264 263
265/* Instrument type */ 264/* Instrument type */
266struct sndrv_seq_instr { 265struct snd_seq_instr {
267 sndrv_seq_instr_cluster_t cluster; 266 snd_seq_instr_cluster_t cluster;
268 unsigned int std; /* the upper byte means a private instrument (owner - client #) */ 267 unsigned int std; /* the upper byte means a private instrument (owner - client #) */
269 unsigned short bank; 268 unsigned short bank;
270 unsigned short prg; 269 unsigned short prg;
271}; 270};
272 271
273 /* sample number */ 272 /* sample number */
274struct sndrv_seq_ev_sample { 273struct snd_seq_ev_sample {
275 unsigned int std; 274 unsigned int std;
276 unsigned short bank; 275 unsigned short bank;
277 unsigned short prg; 276 unsigned short prg;
278}; 277};
279 278
280 /* sample cluster */ 279 /* sample cluster */
281struct sndrv_seq_ev_cluster { 280struct snd_seq_ev_cluster {
282 sndrv_seq_instr_cluster_t cluster; 281 snd_seq_instr_cluster_t cluster;
283}; 282};
284 283
285 /* sample position */ 284 /* sample position */
286typedef unsigned int sndrv_seq_position_t; /* playback position (in samples) * 16 */ 285typedef unsigned int snd_seq_position_t; /* playback position (in samples) * 16 */
287 286
288 /* sample stop mode */ 287 /* sample stop mode */
289enum sndrv_seq_stop_mode { 288enum {
290 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */ 289 SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
291 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */ 290 SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
292 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */ 291 SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
293}; 292};
294 293
295 /* sample frequency */ 294 /* sample frequency */
296typedef int sndrv_seq_frequency_t; /* playback frequency in HZ * 16 */ 295typedef int snd_seq_frequency_t; /* playback frequency in HZ * 16 */
297 296
298 /* sample volume control; if any value is set to -1 == do not change */ 297 /* sample volume control; if any value is set to -1 == do not change */
299struct sndrv_seq_ev_volume { 298struct snd_seq_ev_volume {
300 signed short volume; /* range: 0-16383 */ 299 signed short volume; /* range: 0-16383 */
301 signed short lr; /* left-right balance; range: 0-16383 */ 300 signed short lr; /* left-right balance; range: 0-16383 */
302 signed short fr; /* front-rear balance; range: 0-16383 */ 301 signed short fr; /* front-rear balance; range: 0-16383 */
@@ -304,22 +303,22 @@ struct sndrv_seq_ev_volume {
304}; 303};
305 304
306 /* simple loop redefinition */ 305 /* simple loop redefinition */
307struct sndrv_seq_ev_loop { 306struct snd_seq_ev_loop {
308 unsigned int start; /* loop start (in samples) * 16 */ 307 unsigned int start; /* loop start (in samples) * 16 */
309 unsigned int end; /* loop end (in samples) * 16 */ 308 unsigned int end; /* loop end (in samples) * 16 */
310}; 309};
311 310
312struct sndrv_seq_ev_sample_control { 311struct snd_seq_ev_sample_control {
313 unsigned char channel; 312 unsigned char channel;
314 unsigned char unused1, unused2, unused3; /* pad */ 313 unsigned char unused1, unused2, unused3; /* pad */
315 union { 314 union {
316 struct sndrv_seq_ev_sample sample; 315 struct snd_seq_ev_sample sample;
317 struct sndrv_seq_ev_cluster cluster; 316 struct snd_seq_ev_cluster cluster;
318 sndrv_seq_position_t position; 317 snd_seq_position_t position;
319 enum sndrv_seq_stop_mode stop_mode; 318 int stop_mode;
320 sndrv_seq_frequency_t frequency; 319 snd_seq_frequency_t frequency;
321 struct sndrv_seq_ev_volume volume; 320 struct snd_seq_ev_volume volume;
322 struct sndrv_seq_ev_loop loop; 321 struct snd_seq_ev_loop loop;
323 unsigned char raw8[8]; 322 unsigned char raw8[8];
324 } param; 323 } param;
325}; 324};
@@ -327,82 +326,82 @@ struct sndrv_seq_ev_sample_control {
327 326
328 327
329/* INSTR_BEGIN event */ 328/* INSTR_BEGIN event */
330struct sndrv_seq_ev_instr_begin { 329struct snd_seq_ev_instr_begin {
331 int timeout; /* zero = forever, otherwise timeout in ms */ 330 int timeout; /* zero = forever, otherwise timeout in ms */
332}; 331};
333 332
334struct sndrv_seq_result { 333struct snd_seq_result {
335 int event; /* processed event type */ 334 int event; /* processed event type */
336 int result; 335 int result;
337}; 336};
338 337
339 338
340struct sndrv_seq_real_time { 339struct snd_seq_real_time {
341 unsigned int tv_sec; /* seconds */ 340 unsigned int tv_sec; /* seconds */
342 unsigned int tv_nsec; /* nanoseconds */ 341 unsigned int tv_nsec; /* nanoseconds */
343}; 342};
344 343
345typedef unsigned int sndrv_seq_tick_time_t; /* midi ticks */ 344typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
346 345
347union sndrv_seq_timestamp { 346union snd_seq_timestamp {
348 sndrv_seq_tick_time_t tick; 347 snd_seq_tick_time_t tick;
349 struct sndrv_seq_real_time time; 348 struct snd_seq_real_time time;
350}; 349};
351 350
352struct sndrv_seq_queue_skew { 351struct snd_seq_queue_skew {
353 unsigned int value; 352 unsigned int value;
354 unsigned int base; 353 unsigned int base;
355}; 354};
356 355
357 /* queue timer control */ 356 /* queue timer control */
358struct sndrv_seq_ev_queue_control { 357struct snd_seq_ev_queue_control {
359 unsigned char queue; /* affected queue */ 358 unsigned char queue; /* affected queue */
360 unsigned char pad[3]; /* reserved */ 359 unsigned char pad[3]; /* reserved */
361 union { 360 union {
362 signed int value; /* affected value (e.g. tempo) */ 361 signed int value; /* affected value (e.g. tempo) */
363 union sndrv_seq_timestamp time; /* time */ 362 union snd_seq_timestamp time; /* time */
364 unsigned int position; /* sync position */ 363 unsigned int position; /* sync position */
365 struct sndrv_seq_queue_skew skew; 364 struct snd_seq_queue_skew skew;
366 unsigned int d32[2]; 365 unsigned int d32[2];
367 unsigned char d8[8]; 366 unsigned char d8[8];
368 } param; 367 } param;
369}; 368};
370 369
371 /* quoted event - inside the kernel only */ 370 /* quoted event - inside the kernel only */
372struct sndrv_seq_ev_quote { 371struct snd_seq_ev_quote {
373 struct sndrv_seq_addr origin; /* original sender */ 372 struct snd_seq_addr origin; /* original sender */
374 unsigned short value; /* optional data */ 373 unsigned short value; /* optional data */
375 struct sndrv_seq_event *event; /* quoted event */ 374 struct snd_seq_event *event; /* quoted event */
376} __attribute__((packed)); 375} __attribute__((packed));
377 376
378 377
379 /* sequencer event */ 378 /* sequencer event */
380struct sndrv_seq_event { 379struct snd_seq_event {
381 sndrv_seq_event_type_t type; /* event type */ 380 snd_seq_event_type_t type; /* event type */
382 unsigned char flags; /* event flags */ 381 unsigned char flags; /* event flags */
383 char tag; 382 char tag;
384 383
385 unsigned char queue; /* schedule queue */ 384 unsigned char queue; /* schedule queue */
386 union sndrv_seq_timestamp time; /* schedule time */ 385 union snd_seq_timestamp time; /* schedule time */
387 386
388 387
389 struct sndrv_seq_addr source; /* source address */ 388 struct snd_seq_addr source; /* source address */
390 struct sndrv_seq_addr dest; /* destination address */ 389 struct snd_seq_addr dest; /* destination address */
391 390
392 union { /* event data... */ 391 union { /* event data... */
393 struct sndrv_seq_ev_note note; 392 struct snd_seq_ev_note note;
394 struct sndrv_seq_ev_ctrl control; 393 struct snd_seq_ev_ctrl control;
395 struct sndrv_seq_ev_raw8 raw8; 394 struct snd_seq_ev_raw8 raw8;
396 struct sndrv_seq_ev_raw32 raw32; 395 struct snd_seq_ev_raw32 raw32;
397 struct sndrv_seq_ev_ext ext; 396 struct snd_seq_ev_ext ext;
398 struct sndrv_seq_ev_queue_control queue; 397 struct snd_seq_ev_queue_control queue;
399 union sndrv_seq_timestamp time; 398 union snd_seq_timestamp time;
400 struct sndrv_seq_addr addr; 399 struct snd_seq_addr addr;
401 struct sndrv_seq_connect connect; 400 struct snd_seq_connect connect;
402 struct sndrv_seq_result result; 401 struct snd_seq_result result;
403 struct sndrv_seq_ev_instr_begin instr_begin; 402 struct snd_seq_ev_instr_begin instr_begin;
404 struct sndrv_seq_ev_sample_control sample; 403 struct snd_seq_ev_sample_control sample;
405 struct sndrv_seq_ev_quote quote; 404 struct snd_seq_ev_quote quote;
406 } data; 405 } data;
407}; 406};
408 407
@@ -410,72 +409,77 @@ struct sndrv_seq_event {
410/* 409/*
411 * bounce event - stored as variable size data 410 * bounce event - stored as variable size data
412 */ 411 */
413struct sndrv_seq_event_bounce { 412struct snd_seq_event_bounce {
414 int err; 413 int err;
415 struct sndrv_seq_event event; 414 struct snd_seq_event event;
416 /* external data follows here. */ 415 /* external data follows here. */
417}; 416};
418 417
419#define sndrv_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(sndrv_seq_event_bounce_t))) 418#ifdef __KERNEL__
419
420/* helper macro */
421#define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce)))
420 422
421/* 423/*
422 * type check macros 424 * type check macros
423 */ 425 */
424/* result events: 0-4 */ 426/* result events: 0-4 */
425#define sndrv_seq_ev_is_result_type(ev) ((ev)->type < 5) 427#define snd_seq_ev_is_result_type(ev) ((ev)->type < 5)
426/* channel specific events: 5-19 */ 428/* channel specific events: 5-19 */
427#define sndrv_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20) 429#define snd_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
428/* note events: 5-9 */ 430/* note events: 5-9 */
429#define sndrv_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10) 431#define snd_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
430/* control events: 10-19 */ 432/* control events: 10-19 */
431#define sndrv_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20) 433#define snd_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
432/* queue control events: 30-39 */ 434/* queue control events: 30-39 */
433#define sndrv_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40) 435#define snd_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
434/* system status messages */ 436/* system status messages */
435#define sndrv_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69) 437#define snd_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
436/* sample messages */ 438/* sample messages */
437#define sndrv_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79) 439#define snd_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
438/* user-defined messages */ 440/* user-defined messages */
439#define sndrv_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99) 441#define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
440/* fixed length events: 0-99 */ 442/* fixed length events: 0-99 */
441#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100) 443#define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
442/* instrument layer events: 100-129 */ 444/* instrument layer events: 100-129 */
443#define sndrv_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130) 445#define snd_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
444/* variable length events: 130-139 */ 446/* variable length events: 130-139 */
445#define sndrv_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140) 447#define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
446/* reserved for kernel */ 448/* reserved for kernel */
447#define sndrv_seq_ev_is_reserved(ev) ((ev)->type >= 150) 449#define snd_seq_ev_is_reserved(ev) ((ev)->type >= 150)
448 450
449/* direct dispatched events */ 451/* direct dispatched events */
450#define sndrv_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT) 452#define snd_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
451 453
452/* 454/*
453 * macros to check event flags 455 * macros to check event flags
454 */ 456 */
455/* prior events */ 457/* prior events */
456#define sndrv_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH) 458#define snd_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
457 459
458/* event length type */ 460/* event length type */
459#define sndrv_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) 461#define snd_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
460#define sndrv_seq_ev_is_fixed(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED) 462#define snd_seq_ev_is_fixed(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
461#define sndrv_seq_ev_is_variable(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE) 463#define snd_seq_ev_is_variable(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
462#define sndrv_seq_ev_is_varusr(ev) (sndrv_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR) 464#define snd_seq_ev_is_varusr(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
463 465
464/* time-stamp type */ 466/* time-stamp type */
465#define sndrv_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK) 467#define snd_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
466#define sndrv_seq_ev_is_tick(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK) 468#define snd_seq_ev_is_tick(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
467#define sndrv_seq_ev_is_real(ev) (sndrv_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL) 469#define snd_seq_ev_is_real(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
468 470
469/* time-mode type */ 471/* time-mode type */
470#define sndrv_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK) 472#define snd_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
471#define sndrv_seq_ev_is_abstime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS) 473#define snd_seq_ev_is_abstime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
472#define sndrv_seq_ev_is_reltime(ev) (sndrv_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL) 474#define snd_seq_ev_is_reltime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
473 475
474/* queue sync port */ 476/* queue sync port */
475#define sndrv_seq_queue_sync_port(q) ((q) + 16) 477#define snd_seq_queue_sync_port(q) ((q) + 16)
478
479#endif /* __KERNEL__ */
476 480
477 /* system information */ 481 /* system information */
478struct sndrv_seq_system_info { 482struct snd_seq_system_info {
479 int queues; /* maximum queues count */ 483 int queues; /* maximum queues count */
480 int clients; /* maximum clients count */ 484 int clients; /* maximum clients count */
481 int ports; /* maximum ports per client */ 485 int ports; /* maximum ports per client */
@@ -487,7 +491,7 @@ struct sndrv_seq_system_info {
487 491
488 492
489 /* system running information */ 493 /* system running information */
490struct sndrv_seq_running_info { 494struct snd_seq_running_info {
491 unsigned char client; /* client id */ 495 unsigned char client; /* client id */
492 unsigned char big_endian; /* 1 = big-endian */ 496 unsigned char big_endian; /* 1 = big-endian */
493 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */ 497 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
@@ -498,16 +502,16 @@ struct sndrv_seq_running_info {
498 502
499 /* known client numbers */ 503 /* known client numbers */
500#define SNDRV_SEQ_CLIENT_SYSTEM 0 504#define SNDRV_SEQ_CLIENT_SYSTEM 0
501#define SNDRV_SEQ_CLIENT_DUMMY 62 /* dummy ports */ 505 /* internal client numbers */
502#define SNDRV_SEQ_CLIENT_OSS 63 /* oss sequencer emulator */ 506#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
507#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
503 508
504 509
505 /* client types */ 510 /* client types */
506enum sndrv_seq_client_type { 511typedef int __bitwise snd_seq_client_type_t;
507 NO_CLIENT = 0, 512#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
508 USER_CLIENT = 1, 513#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
509 KERNEL_CLIENT = 2 514#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
510};
511 515
512 /* event filter flags */ 516 /* event filter flags */
513#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */ 517#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
@@ -515,9 +519,9 @@ enum sndrv_seq_client_type {
515#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */ 519#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
516#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */ 520#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
517 521
518struct sndrv_seq_client_info { 522struct snd_seq_client_info {
519 int client; /* client number to inquire */ 523 int client; /* client number to inquire */
520 enum sndrv_seq_client_type type; /* client type */ 524 snd_seq_client_type_t type; /* client type */
521 char name[64]; /* client name */ 525 char name[64]; /* client name */
522 unsigned int filter; /* filter flags */ 526 unsigned int filter; /* filter flags */
523 unsigned char multicast_filter[8]; /* multicast filter bitmap */ 527 unsigned char multicast_filter[8]; /* multicast filter bitmap */
@@ -529,7 +533,7 @@ struct sndrv_seq_client_info {
529 533
530 534
531/* client pool size */ 535/* client pool size */
532struct sndrv_seq_client_pool { 536struct snd_seq_client_pool {
533 int client; /* client number to inquire */ 537 int client; /* client number to inquire */
534 int output_pool; /* outgoing (write) pool size */ 538 int output_pool; /* outgoing (write) pool size */
535 int input_pool; /* incoming (read) pool size */ 539 int input_pool; /* incoming (read) pool size */
@@ -553,13 +557,13 @@ struct sndrv_seq_client_pool {
553#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */ 557#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
554#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */ 558#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
555 559
556struct sndrv_seq_remove_events { 560struct snd_seq_remove_events {
557 unsigned int remove_mode; /* Flags that determine what gets removed */ 561 unsigned int remove_mode; /* Flags that determine what gets removed */
558 562
559 union sndrv_seq_timestamp time; 563 union snd_seq_timestamp time;
560 564
561 unsigned char queue; /* Queue for REMOVE_DEST */ 565 unsigned char queue; /* Queue for REMOVE_DEST */
562 struct sndrv_seq_addr dest; /* Address for REMOVE_DEST */ 566 struct snd_seq_addr dest; /* Address for REMOVE_DEST */
563 unsigned char channel; /* Channel for REMOVE_DEST */ 567 unsigned char channel; /* Channel for REMOVE_DEST */
564 568
565 int type; /* For REMOVE_EVENT_TYPE */ 569 int type; /* For REMOVE_EVENT_TYPE */
@@ -608,8 +612,8 @@ struct sndrv_seq_remove_events {
608#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1) 612#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
609#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2) 613#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
610 614
611struct sndrv_seq_port_info { 615struct snd_seq_port_info {
612 struct sndrv_seq_addr addr; /* client/port numbers */ 616 struct snd_seq_addr addr; /* client/port numbers */
613 char name[64]; /* port name */ 617 char name[64]; /* port name */
614 618
615 unsigned int capability; /* port capability bits */ 619 unsigned int capability; /* port capability bits */
@@ -632,7 +636,7 @@ struct sndrv_seq_port_info {
632#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */ 636#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
633 637
634/* queue information */ 638/* queue information */
635struct sndrv_seq_queue_info { 639struct snd_seq_queue_info {
636 int queue; /* queue id */ 640 int queue; /* queue id */
637 641
638 /* 642 /*
@@ -648,11 +652,11 @@ struct sndrv_seq_queue_info {
648}; 652};
649 653
650/* queue info/status */ 654/* queue info/status */
651struct sndrv_seq_queue_status { 655struct snd_seq_queue_status {
652 int queue; /* queue id */ 656 int queue; /* queue id */
653 int events; /* read-only - queue size */ 657 int events; /* read-only - queue size */
654 sndrv_seq_tick_time_t tick; /* current tick */ 658 snd_seq_tick_time_t tick; /* current tick */
655 struct sndrv_seq_real_time time; /* current time */ 659 struct snd_seq_real_time time; /* current time */
656 int running; /* running state of queue */ 660 int running; /* running state of queue */
657 int flags; /* various flags */ 661 int flags; /* various flags */
658 char reserved[64]; /* for the future */ 662 char reserved[64]; /* for the future */
@@ -660,7 +664,7 @@ struct sndrv_seq_queue_status {
660 664
661 665
662/* queue tempo */ 666/* queue tempo */
663struct sndrv_seq_queue_tempo { 667struct snd_seq_queue_tempo {
664 int queue; /* sequencer queue */ 668 int queue; /* sequencer queue */
665 unsigned int tempo; /* current tempo, us/tick */ 669 unsigned int tempo; /* current tempo, us/tick */
666 int ppq; /* time resolution, ticks/quarter */ 670 int ppq; /* time resolution, ticks/quarter */
@@ -676,12 +680,12 @@ struct sndrv_seq_queue_tempo {
676#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */ 680#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
677 681
678/* queue timer info */ 682/* queue timer info */
679struct sndrv_seq_queue_timer { 683struct snd_seq_queue_timer {
680 int queue; /* sequencer queue */ 684 int queue; /* sequencer queue */
681 int type; /* source timer type */ 685 int type; /* source timer type */
682 union { 686 union {
683 struct { 687 struct {
684 struct sndrv_timer_id id; /* ALSA's timer ID */ 688 struct snd_timer_id id; /* ALSA's timer ID */
685 unsigned int resolution; /* resolution in Hz */ 689 unsigned int resolution; /* resolution in Hz */
686 } alsa; 690 } alsa;
687 } u; 691 } u;
@@ -689,7 +693,7 @@ struct sndrv_seq_queue_timer {
689}; 693};
690 694
691 695
692struct sndrv_seq_queue_client { 696struct snd_seq_queue_client {
693 int queue; /* sequencer queue */ 697 int queue; /* sequencer queue */
694 int client; /* sequencer client */ 698 int client; /* sequencer client */
695 int used; /* queue is used with this client 699 int used; /* queue is used with this client
@@ -703,9 +707,9 @@ struct sndrv_seq_queue_client {
703#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1) 707#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
704#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2) 708#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
705 709
706struct sndrv_seq_port_subscribe { 710struct snd_seq_port_subscribe {
707 struct sndrv_seq_addr sender; /* sender address */ 711 struct snd_seq_addr sender; /* sender address */
708 struct sndrv_seq_addr dest; /* destination address */ 712 struct snd_seq_addr dest; /* destination address */
709 unsigned int voices; /* number of voices to be allocated (0 = don't care) */ 713 unsigned int voices; /* number of voices to be allocated (0 = don't care) */
710 unsigned int flags; /* modes */ 714 unsigned int flags; /* modes */
711 unsigned char queue; /* input time-stamp queue (optional) */ 715 unsigned char queue; /* input time-stamp queue (optional) */
@@ -717,12 +721,12 @@ struct sndrv_seq_port_subscribe {
717#define SNDRV_SEQ_QUERY_SUBS_READ 0 721#define SNDRV_SEQ_QUERY_SUBS_READ 0
718#define SNDRV_SEQ_QUERY_SUBS_WRITE 1 722#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
719 723
720struct sndrv_seq_query_subs { 724struct snd_seq_query_subs {
721 struct sndrv_seq_addr root; /* client/port id to be searched */ 725 struct snd_seq_addr root; /* client/port id to be searched */
722 int type; /* READ or WRITE */ 726 int type; /* READ or WRITE */
723 int index; /* 0..N-1 */ 727 int index; /* 0..N-1 */
724 int num_subs; /* R/O: number of subscriptions on this port */ 728 int num_subs; /* R/O: number of subscriptions on this port */
725 struct sndrv_seq_addr addr; /* R/O: result */ 729 struct snd_seq_addr addr; /* R/O: result */
726 unsigned char queue; /* R/O: result */ 730 unsigned char queue; /* R/O: result */
727 unsigned int flags; /* R/O: result */ 731 unsigned int flags; /* R/O: result */
728 char reserved[64]; /* for future use */ 732 char reserved[64]; /* for future use */
@@ -779,72 +783,72 @@ struct sndrv_seq_query_subs {
779#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3 783#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
780 784
781/* size of ROM/RAM */ 785/* size of ROM/RAM */
782typedef unsigned int sndrv_seq_instr_size_t; 786typedef unsigned int snd_seq_instr_size_t;
783 787
784/* INSTR_INFO */ 788/* INSTR_INFO */
785 789
786struct sndrv_seq_instr_info { 790struct snd_seq_instr_info {
787 int result; /* operation result */ 791 int result; /* operation result */
788 unsigned int formats[8]; /* bitmap of supported formats */ 792 unsigned int formats[8]; /* bitmap of supported formats */
789 int ram_count; /* count of RAM banks */ 793 int ram_count; /* count of RAM banks */
790 sndrv_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */ 794 snd_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
791 int rom_count; /* count of ROM banks */ 795 int rom_count; /* count of ROM banks */
792 sndrv_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */ 796 snd_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
793 char reserved[128]; 797 char reserved[128];
794}; 798};
795 799
796/* INSTR_STATUS */ 800/* INSTR_STATUS */
797 801
798struct sndrv_seq_instr_status { 802struct snd_seq_instr_status {
799 int result; /* operation result */ 803 int result; /* operation result */
800 sndrv_seq_instr_size_t free_ram[16]; /* free RAM in banks */ 804 snd_seq_instr_size_t free_ram[16]; /* free RAM in banks */
801 int instrument_count; /* count of downloaded instruments */ 805 int instrument_count; /* count of downloaded instruments */
802 char reserved[128]; 806 char reserved[128];
803}; 807};
804 808
805/* INSTR_FORMAT_INFO */ 809/* INSTR_FORMAT_INFO */
806 810
807struct sndrv_seq_instr_format_info { 811struct snd_seq_instr_format_info {
808 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */ 812 char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
809 unsigned int len; /* max data length (without this structure) */ 813 unsigned int len; /* max data length (without this structure) */
810}; 814};
811 815
812struct sndrv_seq_instr_format_info_result { 816struct snd_seq_instr_format_info_result {
813 int result; /* operation result */ 817 int result; /* operation result */
814 char format[16]; /* format identifier */ 818 char format[16]; /* format identifier */
815 unsigned int len; /* filled data length (without this structure) */ 819 unsigned int len; /* filled data length (without this structure) */
816}; 820};
817 821
818/* instrument data */ 822/* instrument data */
819struct sndrv_seq_instr_data { 823struct snd_seq_instr_data {
820 char name[32]; /* instrument name */ 824 char name[32]; /* instrument name */
821 char reserved[16]; /* for the future use */ 825 char reserved[16]; /* for the future use */
822 int type; /* instrument type */ 826 int type; /* instrument type */
823 union { 827 union {
824 char format[16]; /* format identifier */ 828 char format[16]; /* format identifier */
825 struct sndrv_seq_instr alias; 829 struct snd_seq_instr alias;
826 } data; 830 } data;
827}; 831};
828 832
829/* INSTR_PUT/GET, data are stored in one block (extended), header + data */ 833/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
830 834
831struct sndrv_seq_instr_header { 835struct snd_seq_instr_header {
832 union { 836 union {
833 struct sndrv_seq_instr instr; 837 struct snd_seq_instr instr;
834 sndrv_seq_instr_cluster_t cluster; 838 snd_seq_instr_cluster_t cluster;
835 } id; /* instrument identifier */ 839 } id; /* instrument identifier */
836 unsigned int cmd; /* get/put/free command */ 840 unsigned int cmd; /* get/put/free command */
837 unsigned int flags; /* query flags (only for get) */ 841 unsigned int flags; /* query flags (only for get) */
838 unsigned int len; /* real instrument data length (without header) */ 842 unsigned int len; /* real instrument data length (without header) */
839 int result; /* operation result */ 843 int result; /* operation result */
840 char reserved[16]; /* for the future */ 844 char reserved[16]; /* for the future */
841 struct sndrv_seq_instr_data data; /* instrument data (for put/get result) */ 845 struct snd_seq_instr_data data; /* instrument data (for put/get result) */
842}; 846};
843 847
844/* INSTR_CLUSTER_SET */ 848/* INSTR_CLUSTER_SET */
845 849
846struct sndrv_seq_instr_cluster_set { 850struct snd_seq_instr_cluster_set {
847 sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ 851 snd_seq_instr_cluster_t cluster; /* cluster identifier */
848 char name[32]; /* cluster name */ 852 char name[32]; /* cluster name */
849 int priority; /* cluster priority */ 853 int priority; /* cluster priority */
850 char reserved[64]; /* for the future use */ 854 char reserved[64]; /* for the future use */
@@ -852,8 +856,8 @@ struct sndrv_seq_instr_cluster_set {
852 856
853/* INSTR_CLUSTER_GET */ 857/* INSTR_CLUSTER_GET */
854 858
855struct sndrv_seq_instr_cluster_get { 859struct snd_seq_instr_cluster_get {
856 sndrv_seq_instr_cluster_t cluster; /* cluster identifier */ 860 snd_seq_instr_cluster_t cluster; /* cluster identifier */
857 char name[32]; /* cluster name */ 861 char name[32]; /* cluster name */
858 int priority; /* cluster priority */ 862 int priority; /* cluster priority */
859 char reserved[64]; /* for the future use */ 863 char reserved[64]; /* for the future use */
@@ -865,44 +869,44 @@ struct sndrv_seq_instr_cluster_get {
865 869
866#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) 870#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
867#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) 871#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
868#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct sndrv_seq_system_info) 872#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
869#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct sndrv_seq_running_info) 873#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
870 874
871#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct sndrv_seq_client_info) 875#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
872#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct sndrv_seq_client_info) 876#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
873 877
874#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct sndrv_seq_port_info) 878#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
875#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct sndrv_seq_port_info) 879#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
876#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct sndrv_seq_port_info) 880#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
877#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct sndrv_seq_port_info) 881#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
878 882
879#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct sndrv_seq_port_subscribe) 883#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
880#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct sndrv_seq_port_subscribe) 884#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
881 885
882#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct sndrv_seq_queue_info) 886#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
883#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct sndrv_seq_queue_info) 887#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
884#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct sndrv_seq_queue_info) 888#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
885#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct sndrv_seq_queue_info) 889#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
886#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct sndrv_seq_queue_info) 890#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
887#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct sndrv_seq_queue_status) 891#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
888#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct sndrv_seq_queue_tempo) 892#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
889#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct sndrv_seq_queue_tempo) 893#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
890#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct sndrv_seq_queue_owner) 894#define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner)
891#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct sndrv_seq_queue_owner) 895#define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner)
892#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct sndrv_seq_queue_timer) 896#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
893#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct sndrv_seq_queue_timer) 897#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
894/* XXX 898/* XXX
895#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct sndrv_seq_queue_sync) 899#define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)
896#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct sndrv_seq_queue_sync) 900#define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)
897*/ 901*/
898#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct sndrv_seq_queue_client) 902#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
899#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct sndrv_seq_queue_client) 903#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
900#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct sndrv_seq_client_pool) 904#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
901#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct sndrv_seq_client_pool) 905#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
902#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct sndrv_seq_remove_events) 906#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
903#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct sndrv_seq_query_subs) 907#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
904#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct sndrv_seq_port_subscribe) 908#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
905#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct sndrv_seq_client_info) 909#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
906#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct sndrv_seq_port_info) 910#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
907 911
908#endif /* __SOUND_ASEQUENCER_H */ 912#endif /* __SOUND_ASEQUENCER_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 8e552d627fa5..9cc021c7ee11 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -23,12 +23,8 @@
23#ifndef __SOUND_ASOUND_H 23#ifndef __SOUND_ASOUND_H
24#define __SOUND_ASOUND_H 24#define __SOUND_ASOUND_H
25 25
26#if defined(LINUX) || defined(__LINUX__) || defined(__linux__)
27
28#include <linux/ioctl.h>
29
30#ifdef __KERNEL__ 26#ifdef __KERNEL__
31 27#include <linux/ioctl.h>
32#include <linux/types.h> 28#include <linux/types.h>
33#include <linux/time.h> 29#include <linux/time.h>
34#include <asm/byteorder.h> 30#include <asm/byteorder.h>
@@ -43,25 +39,7 @@
43#endif 39#endif
44#endif 40#endif
45 41
46#else /* !__KERNEL__ */ 42#endif /* __KERNEL__ **/
47
48#include <endian.h>
49#if __BYTE_ORDER == __LITTLE_ENDIAN
50#define SNDRV_LITTLE_ENDIAN
51#elif __BYTE_ORDER == __BIG_ENDIAN
52#define SNDRV_BIG_ENDIAN
53#else
54#error "Unsupported endian..."
55#endif
56
57#endif /* __KERNEL **/
58
59#endif /* LINUX */
60
61#ifndef __KERNEL__
62#include <sys/time.h>
63#include <sys/types.h>
64#endif
65 43
66/* 44/*
67 * protocol version 45 * protocol version
@@ -82,7 +60,7 @@
82 * * 60 * *
83 ****************************************************************************/ 61 ****************************************************************************/
84 62
85struct sndrv_aes_iec958 { 63struct snd_aes_iec958 {
86 unsigned char status[24]; /* AES/IEC958 channel status bits */ 64 unsigned char status[24]; /* AES/IEC958 channel status bits */
87 unsigned char subcode[147]; /* AES/IEC958 subcode bits */ 65 unsigned char subcode[147]; /* AES/IEC958 subcode bits */
88 unsigned char pad; /* nothing */ 66 unsigned char pad; /* nothing */
@@ -97,7 +75,7 @@ struct sndrv_aes_iec958 {
97 75
98#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) 76#define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
99 77
100enum sndrv_hwdep_iface { 78enum {
101 SNDRV_HWDEP_IFACE_OPL2 = 0, 79 SNDRV_HWDEP_IFACE_OPL2 = 0,
102 SNDRV_HWDEP_IFACE_OPL3, 80 SNDRV_HWDEP_IFACE_OPL3,
103 SNDRV_HWDEP_IFACE_OPL4, 81 SNDRV_HWDEP_IFACE_OPL4,
@@ -119,17 +97,17 @@ enum sndrv_hwdep_iface {
119 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC 97 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_SB_RC
120}; 98};
121 99
122struct sndrv_hwdep_info { 100struct snd_hwdep_info {
123 unsigned int device; /* WR: device number */ 101 unsigned int device; /* WR: device number */
124 int card; /* R: card number */ 102 int card; /* R: card number */
125 unsigned char id[64]; /* ID (user selectable) */ 103 unsigned char id[64]; /* ID (user selectable) */
126 unsigned char name[80]; /* hwdep name */ 104 unsigned char name[80]; /* hwdep name */
127 enum sndrv_hwdep_iface iface; /* hwdep interface */ 105 int iface; /* hwdep interface */
128 unsigned char reserved[64]; /* reserved for future */ 106 unsigned char reserved[64]; /* reserved for future */
129}; 107};
130 108
131/* generic DSP loader */ 109/* generic DSP loader */
132struct sndrv_hwdep_dsp_status { 110struct snd_hwdep_dsp_status {
133 unsigned int version; /* R: driver-specific version */ 111 unsigned int version; /* R: driver-specific version */
134 unsigned char id[32]; /* R: driver-specific ID string */ 112 unsigned char id[32]; /* R: driver-specific ID string */
135 unsigned int num_dsps; /* R: number of DSP images to transfer */ 113 unsigned int num_dsps; /* R: number of DSP images to transfer */
@@ -138,7 +116,7 @@ struct sndrv_hwdep_dsp_status {
138 unsigned char reserved[16]; /* reserved for future use */ 116 unsigned char reserved[16]; /* reserved for future use */
139}; 117};
140 118
141struct sndrv_hwdep_dsp_image { 119struct snd_hwdep_dsp_image {
142 unsigned int index; /* W: DSP index */ 120 unsigned int index; /* W: DSP index */
143 unsigned char name[64]; /* W: ID (e.g. file name) */ 121 unsigned char name[64]; /* W: ID (e.g. file name) */
144 unsigned char __user *image; /* W: binary image */ 122 unsigned char __user *image; /* W: binary image */
@@ -148,9 +126,9 @@ struct sndrv_hwdep_dsp_image {
148 126
149enum { 127enum {
150 SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int), 128 SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int),
151 SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct sndrv_hwdep_info), 129 SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct snd_hwdep_info),
152 SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct sndrv_hwdep_dsp_status), 130 SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct snd_hwdep_dsp_status),
153 SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image) 131 SNDRV_HWDEP_IOCTL_DSP_LOAD = _IOW('H', 0x03, struct snd_hwdep_dsp_image)
154}; 132};
155 133
156/***************************************************************************** 134/*****************************************************************************
@@ -161,10 +139,10 @@ enum {
161 139
162#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) 140#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
163 141
164typedef unsigned long sndrv_pcm_uframes_t; 142typedef unsigned long snd_pcm_uframes_t;
165typedef long sndrv_pcm_sframes_t; 143typedef signed long snd_pcm_sframes_t;
166 144
167enum sndrv_pcm_class { 145enum {
168 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ 146 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
169 SNDRV_PCM_CLASS_MULTI, /* multichannel device */ 147 SNDRV_PCM_CLASS_MULTI, /* multichannel device */
170 SNDRV_PCM_CLASS_MODEM, /* software modem class */ 148 SNDRV_PCM_CLASS_MODEM, /* software modem class */
@@ -173,97 +151,94 @@ enum sndrv_pcm_class {
173 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, 151 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
174}; 152};
175 153
176enum sndrv_pcm_subclass { 154enum {
177 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ 155 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
178 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ 156 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
179 /* Don't forget to change the following: */ 157 /* Don't forget to change the following: */
180 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, 158 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
181}; 159};
182 160
183enum sndrv_pcm_stream { 161enum {
184 SNDRV_PCM_STREAM_PLAYBACK = 0, 162 SNDRV_PCM_STREAM_PLAYBACK = 0,
185 SNDRV_PCM_STREAM_CAPTURE, 163 SNDRV_PCM_STREAM_CAPTURE,
186 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, 164 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
187}; 165};
188 166
189enum sndrv_pcm_access { 167typedef int __bitwise snd_pcm_access_t;
190 SNDRV_PCM_ACCESS_MMAP_INTERLEAVED = 0, /* interleaved mmap */ 168#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */
191 SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED, /* noninterleaved mmap */ 169#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
192 SNDRV_PCM_ACCESS_MMAP_COMPLEX, /* complex mmap */ 170#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */
193 SNDRV_PCM_ACCESS_RW_INTERLEAVED, /* readi/writei */ 171#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */
194 SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, /* readn/writen */ 172#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */
195 SNDRV_PCM_ACCESS_LAST = SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, 173#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
196}; 174
197 175typedef int __bitwise snd_pcm_format_t;
198enum sndrv_pcm_format { 176#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
199 SNDRV_PCM_FORMAT_S8 = 0, 177#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
200 SNDRV_PCM_FORMAT_U8, 178#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
201 SNDRV_PCM_FORMAT_S16_LE, 179#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
202 SNDRV_PCM_FORMAT_S16_BE, 180#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
203 SNDRV_PCM_FORMAT_U16_LE, 181#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
204 SNDRV_PCM_FORMAT_U16_BE, 182#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
205 SNDRV_PCM_FORMAT_S24_LE, /* low three bytes */ 183#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
206 SNDRV_PCM_FORMAT_S24_BE, /* low three bytes */ 184#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
207 SNDRV_PCM_FORMAT_U24_LE, /* low three bytes */ 185#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
208 SNDRV_PCM_FORMAT_U24_BE, /* low three bytes */ 186#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
209 SNDRV_PCM_FORMAT_S32_LE, 187#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
210 SNDRV_PCM_FORMAT_S32_BE, 188#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
211 SNDRV_PCM_FORMAT_U32_LE, 189#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
212 SNDRV_PCM_FORMAT_U32_BE, 190#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
213 SNDRV_PCM_FORMAT_FLOAT_LE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ 191#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
214 SNDRV_PCM_FORMAT_FLOAT_BE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ 192#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
215 SNDRV_PCM_FORMAT_FLOAT64_LE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ 193#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
216 SNDRV_PCM_FORMAT_FLOAT64_BE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ 194#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
217 SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, /* IEC-958 subframe, Little Endian */ 195#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
218 SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, /* IEC-958 subframe, Big Endian */ 196#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
219 SNDRV_PCM_FORMAT_MU_LAW, 197#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
220 SNDRV_PCM_FORMAT_A_LAW, 198#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
221 SNDRV_PCM_FORMAT_IMA_ADPCM, 199#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
222 SNDRV_PCM_FORMAT_MPEG, 200#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
223 SNDRV_PCM_FORMAT_GSM, 201#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
224 SNDRV_PCM_FORMAT_SPECIAL = 31, 202#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */
225 SNDRV_PCM_FORMAT_S24_3LE = 32, /* in three bytes */ 203#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */
226 SNDRV_PCM_FORMAT_S24_3BE, /* in three bytes */ 204#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */
227 SNDRV_PCM_FORMAT_U24_3LE, /* in three bytes */ 205#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */
228 SNDRV_PCM_FORMAT_U24_3BE, /* in three bytes */ 206#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */
229 SNDRV_PCM_FORMAT_S20_3LE, /* in three bytes */ 207#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */
230 SNDRV_PCM_FORMAT_S20_3BE, /* in three bytes */ 208#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */
231 SNDRV_PCM_FORMAT_U20_3LE, /* in three bytes */ 209#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */
232 SNDRV_PCM_FORMAT_U20_3BE, /* in three bytes */ 210#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */
233 SNDRV_PCM_FORMAT_S18_3LE, /* in three bytes */ 211#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
234 SNDRV_PCM_FORMAT_S18_3BE, /* in three bytes */ 212#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
235 SNDRV_PCM_FORMAT_U18_3LE, /* in three bytes */ 213#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
236 SNDRV_PCM_FORMAT_U18_3BE, /* in three bytes */ 214#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_U18_3BE
237 SNDRV_PCM_FORMAT_LAST = SNDRV_PCM_FORMAT_U18_3BE,
238 215
239#ifdef SNDRV_LITTLE_ENDIAN 216#ifdef SNDRV_LITTLE_ENDIAN
240 SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_LE, 217#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
241 SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_LE, 218#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE
242 SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_LE, 219#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE
243 SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_LE, 220#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE
244 SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_LE, 221#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE
245 SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_LE, 222#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE
246 SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_LE, 223#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE
247 SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_LE, 224#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE
248 SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, 225#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE
249#endif 226#endif
250#ifdef SNDRV_BIG_ENDIAN 227#ifdef SNDRV_BIG_ENDIAN
251 SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_BE, 228#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE
252 SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_BE, 229#define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE
253 SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_BE, 230#define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE
254 SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_BE, 231#define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE
255 SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_BE, 232#define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE
256 SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_BE, 233#define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE
257 SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_BE, 234#define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE
258 SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_BE, 235#define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE
259 SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, 236#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE
260#endif 237#endif
261};
262 238
263enum sndrv_pcm_subformat { 239typedef int __bitwise snd_pcm_subformat_t;
264 SNDRV_PCM_SUBFORMAT_STD = 0, 240#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
265 SNDRV_PCM_SUBFORMAT_LAST = SNDRV_PCM_SUBFORMAT_STD, 241#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
266};
267 242
268#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ 243#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
269#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ 244#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
@@ -280,18 +255,17 @@ enum sndrv_pcm_subformat {
280#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ 255#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
281#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ 256#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
282 257
283enum sndrv_pcm_state { 258typedef int __bitwise snd_pcm_state_t;
284 SNDRV_PCM_STATE_OPEN = 0, /* stream is open */ 259#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
285 SNDRV_PCM_STATE_SETUP, /* stream has a setup */ 260#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
286 SNDRV_PCM_STATE_PREPARED, /* stream is ready to start */ 261#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */
287 SNDRV_PCM_STATE_RUNNING, /* stream is running */ 262#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */
288 SNDRV_PCM_STATE_XRUN, /* stream reached an xrun */ 263#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
289 SNDRV_PCM_STATE_DRAINING, /* stream is draining */ 264#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */
290 SNDRV_PCM_STATE_PAUSED, /* stream is paused */ 265#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */
291 SNDRV_PCM_STATE_SUSPENDED, /* hardware is suspended */ 266#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */
292 SNDRV_PCM_STATE_DISCONNECTED, /* hardware is disconnected */ 267#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
293 SNDRV_PCM_STATE_LAST = SNDRV_PCM_STATE_DISCONNECTED, 268#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
294};
295 269
296enum { 270enum {
297 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, 271 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
@@ -299,55 +273,53 @@ enum {
299 SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, 273 SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
300}; 274};
301 275
302union sndrv_pcm_sync_id { 276union snd_pcm_sync_id {
303 unsigned char id[16]; 277 unsigned char id[16];
304 unsigned short id16[8]; 278 unsigned short id16[8];
305 unsigned int id32[4]; 279 unsigned int id32[4];
306}; 280};
307 281
308struct sndrv_pcm_info { 282struct snd_pcm_info {
309 unsigned int device; /* RO/WR (control): device number */ 283 unsigned int device; /* RO/WR (control): device number */
310 unsigned int subdevice; /* RO/WR (control): subdevice number */ 284 unsigned int subdevice; /* RO/WR (control): subdevice number */
311 enum sndrv_pcm_stream stream; /* RO/WR (control): stream number */ 285 int stream; /* RO/WR (control): stream direction */
312 int card; /* R: card number */ 286 int card; /* R: card number */
313 unsigned char id[64]; /* ID (user selectable) */ 287 unsigned char id[64]; /* ID (user selectable) */
314 unsigned char name[80]; /* name of this device */ 288 unsigned char name[80]; /* name of this device */
315 unsigned char subname[32]; /* subdevice name */ 289 unsigned char subname[32]; /* subdevice name */
316 enum sndrv_pcm_class dev_class; /* SNDRV_PCM_CLASS_* */ 290 int dev_class; /* SNDRV_PCM_CLASS_* */
317 enum sndrv_pcm_subclass dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ 291 int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
318 unsigned int subdevices_count; 292 unsigned int subdevices_count;
319 unsigned int subdevices_avail; 293 unsigned int subdevices_avail;
320 union sndrv_pcm_sync_id sync; /* hardware synchronization ID */ 294 union snd_pcm_sync_id sync; /* hardware synchronization ID */
321 unsigned char reserved[64]; /* reserved for future... */ 295 unsigned char reserved[64]; /* reserved for future... */
322}; 296};
323 297
324enum sndrv_pcm_hw_param { 298typedef int __bitwise snd_pcm_hw_param_t;
325 SNDRV_PCM_HW_PARAM_ACCESS = 0, /* Access type */ 299#define SNDRV_PCM_HW_PARAM_ACCESS ((__force snd_pcm_hw_param_t) 0) /* Access type */
326 SNDRV_PCM_HW_PARAM_FIRST_MASK = SNDRV_PCM_HW_PARAM_ACCESS, 300#define SNDRV_PCM_HW_PARAM_FORMAT ((__force snd_pcm_hw_param_t) 1) /* Format */
327 SNDRV_PCM_HW_PARAM_FORMAT, /* Format */ 301#define SNDRV_PCM_HW_PARAM_SUBFORMAT ((__force snd_pcm_hw_param_t) 2) /* Subformat */
328 SNDRV_PCM_HW_PARAM_SUBFORMAT, /* Subformat */ 302#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
329 SNDRV_PCM_HW_PARAM_LAST_MASK = SNDRV_PCM_HW_PARAM_SUBFORMAT, 303#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
330 304
331 SNDRV_PCM_HW_PARAM_SAMPLE_BITS = 8, /* Bits per sample */ 305#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS ((__force snd_pcm_hw_param_t) 8) /* Bits per sample */
332 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 306#define SNDRV_PCM_HW_PARAM_FRAME_BITS ((__force snd_pcm_hw_param_t) 9) /* Bits per frame */
333 SNDRV_PCM_HW_PARAM_FRAME_BITS, /* Bits per frame */ 307#define SNDRV_PCM_HW_PARAM_CHANNELS ((__force snd_pcm_hw_param_t) 10) /* Channels */
334 SNDRV_PCM_HW_PARAM_CHANNELS, /* Channels */ 308#define SNDRV_PCM_HW_PARAM_RATE ((__force snd_pcm_hw_param_t) 11) /* Approx rate */
335 SNDRV_PCM_HW_PARAM_RATE, /* Approx rate */ 309#define SNDRV_PCM_HW_PARAM_PERIOD_TIME ((__force snd_pcm_hw_param_t) 12) /* Approx distance between interrupts in us */
336 SNDRV_PCM_HW_PARAM_PERIOD_TIME, /* Approx distance between interrupts 310#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE ((__force snd_pcm_hw_param_t) 13) /* Approx frames between interrupts */
337 in us */ 311#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES ((__force snd_pcm_hw_param_t) 14) /* Approx bytes between interrupts */
338 SNDRV_PCM_HW_PARAM_PERIOD_SIZE, /* Approx frames between interrupts */ 312#define SNDRV_PCM_HW_PARAM_PERIODS ((__force snd_pcm_hw_param_t) 15) /* Approx interrupts per buffer */
339 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, /* Approx bytes between interrupts */ 313#define SNDRV_PCM_HW_PARAM_BUFFER_TIME ((__force snd_pcm_hw_param_t) 16) /* Approx duration of buffer in us */
340 SNDRV_PCM_HW_PARAM_PERIODS, /* Approx interrupts per buffer */ 314#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE ((__force snd_pcm_hw_param_t) 17) /* Size of buffer in frames */
341 SNDRV_PCM_HW_PARAM_BUFFER_TIME, /* Approx duration of buffer in us */ 315#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES ((__force snd_pcm_hw_param_t) 18) /* Size of buffer in bytes */
342 SNDRV_PCM_HW_PARAM_BUFFER_SIZE, /* Size of buffer in frames */ 316#define SNDRV_PCM_HW_PARAM_TICK_TIME ((__force snd_pcm_hw_param_t) 19) /* Approx tick duration in us */
343 SNDRV_PCM_HW_PARAM_BUFFER_BYTES, /* Size of buffer in bytes */ 317#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
344 SNDRV_PCM_HW_PARAM_TICK_TIME, /* Approx tick duration in us */ 318#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
345 SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME
346};
347 319
348#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ 320#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
349 321
350struct sndrv_interval { 322struct snd_interval {
351 unsigned int min, max; 323 unsigned int min, max;
352 unsigned int openmin:1, 324 unsigned int openmin:1,
353 openmax:1, 325 openmax:1,
@@ -357,137 +329,137 @@ struct sndrv_interval {
357 329
358#define SNDRV_MASK_MAX 256 330#define SNDRV_MASK_MAX 256
359 331
360struct sndrv_mask { 332struct snd_mask {
361 u_int32_t bits[(SNDRV_MASK_MAX+31)/32]; 333 u_int32_t bits[(SNDRV_MASK_MAX+31)/32];
362}; 334};
363 335
364struct sndrv_pcm_hw_params { 336struct snd_pcm_hw_params {
365 unsigned int flags; 337 unsigned int flags;
366 struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 338 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
367 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; 339 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
368 struct sndrv_mask mres[5]; /* reserved masks */ 340 struct snd_mask mres[5]; /* reserved masks */
369 struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - 341 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
370 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; 342 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
371 struct sndrv_interval ires[9]; /* reserved intervals */ 343 struct snd_interval ires[9]; /* reserved intervals */
372 unsigned int rmask; /* W: requested masks */ 344 unsigned int rmask; /* W: requested masks */
373 unsigned int cmask; /* R: changed masks */ 345 unsigned int cmask; /* R: changed masks */
374 unsigned int info; /* R: Info flags for returned setup */ 346 unsigned int info; /* R: Info flags for returned setup */
375 unsigned int msbits; /* R: used most significant bits */ 347 unsigned int msbits; /* R: used most significant bits */
376 unsigned int rate_num; /* R: rate numerator */ 348 unsigned int rate_num; /* R: rate numerator */
377 unsigned int rate_den; /* R: rate denominator */ 349 unsigned int rate_den; /* R: rate denominator */
378 sndrv_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ 350 snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
379 unsigned char reserved[64]; /* reserved for future */ 351 unsigned char reserved[64]; /* reserved for future */
380}; 352};
381 353
382enum sndrv_pcm_tstamp { 354enum {
383 SNDRV_PCM_TSTAMP_NONE = 0, 355 SNDRV_PCM_TSTAMP_NONE = 0,
384 SNDRV_PCM_TSTAMP_MMAP, 356 SNDRV_PCM_TSTAMP_MMAP,
385 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP, 357 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP,
386}; 358};
387 359
388struct sndrv_pcm_sw_params { 360struct snd_pcm_sw_params {
389 enum sndrv_pcm_tstamp tstamp_mode; /* timestamp mode */ 361 int tstamp_mode; /* timestamp mode */
390 unsigned int period_step; 362 unsigned int period_step;
391 unsigned int sleep_min; /* min ticks to sleep */ 363 unsigned int sleep_min; /* min ticks to sleep */
392 sndrv_pcm_uframes_t avail_min; /* min avail frames for wakeup */ 364 snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
393 sndrv_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ 365 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
394 sndrv_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ 366 snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
395 sndrv_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ 367 snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
396 sndrv_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ 368 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
397 sndrv_pcm_uframes_t silence_size; /* silence block size */ 369 snd_pcm_uframes_t silence_size; /* silence block size */
398 sndrv_pcm_uframes_t boundary; /* pointers wrap point */ 370 snd_pcm_uframes_t boundary; /* pointers wrap point */
399 unsigned char reserved[64]; /* reserved for future */ 371 unsigned char reserved[64]; /* reserved for future */
400}; 372};
401 373
402struct sndrv_pcm_channel_info { 374struct snd_pcm_channel_info {
403 unsigned int channel; 375 unsigned int channel;
404 off_t offset; /* mmap offset */ 376 off_t offset; /* mmap offset */
405 unsigned int first; /* offset to first sample in bits */ 377 unsigned int first; /* offset to first sample in bits */
406 unsigned int step; /* samples distance in bits */ 378 unsigned int step; /* samples distance in bits */
407}; 379};
408 380
409struct sndrv_pcm_status { 381struct snd_pcm_status {
410 enum sndrv_pcm_state state; /* stream state */ 382 snd_pcm_state_t state; /* stream state */
411 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ 383 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
412 struct timespec tstamp; /* reference timestamp */ 384 struct timespec tstamp; /* reference timestamp */
413 sndrv_pcm_uframes_t appl_ptr; /* appl ptr */ 385 snd_pcm_uframes_t appl_ptr; /* appl ptr */
414 sndrv_pcm_uframes_t hw_ptr; /* hw ptr */ 386 snd_pcm_uframes_t hw_ptr; /* hw ptr */
415 sndrv_pcm_sframes_t delay; /* current delay in frames */ 387 snd_pcm_sframes_t delay; /* current delay in frames */
416 sndrv_pcm_uframes_t avail; /* number of frames available */ 388 snd_pcm_uframes_t avail; /* number of frames available */
417 sndrv_pcm_uframes_t avail_max; /* max frames available on hw since last status */ 389 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
418 sndrv_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ 390 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
419 enum sndrv_pcm_state suspended_state; /* suspended stream state */ 391 snd_pcm_state_t suspended_state; /* suspended stream state */
420 unsigned char reserved[60]; /* must be filled with zero */ 392 unsigned char reserved[60]; /* must be filled with zero */
421}; 393};
422 394
423struct sndrv_pcm_mmap_status { 395struct snd_pcm_mmap_status {
424 enum sndrv_pcm_state state; /* RO: state - SNDRV_PCM_STATE_XXXX */ 396 snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
425 int pad1; /* Needed for 64 bit alignment */ 397 int pad1; /* Needed for 64 bit alignment */
426 sndrv_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ 398 snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
427 struct timespec tstamp; /* Timestamp */ 399 struct timespec tstamp; /* Timestamp */
428 enum sndrv_pcm_state suspended_state; /* RO: suspended stream state */ 400 snd_pcm_state_t suspended_state; /* RO: suspended stream state */
429}; 401};
430 402
431struct sndrv_pcm_mmap_control { 403struct snd_pcm_mmap_control {
432 sndrv_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ 404 snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
433 sndrv_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ 405 snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
434}; 406};
435 407
436#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ 408#define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */
437#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ 409#define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
438#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ 410#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
439 411
440struct sndrv_pcm_sync_ptr { 412struct snd_pcm_sync_ptr {
441 unsigned int flags; 413 unsigned int flags;
442 union { 414 union {
443 struct sndrv_pcm_mmap_status status; 415 struct snd_pcm_mmap_status status;
444 unsigned char reserved[64]; 416 unsigned char reserved[64];
445 } s; 417 } s;
446 union { 418 union {
447 struct sndrv_pcm_mmap_control control; 419 struct snd_pcm_mmap_control control;
448 unsigned char reserved[64]; 420 unsigned char reserved[64];
449 } c; 421 } c;
450}; 422};
451 423
452struct sndrv_xferi { 424struct snd_xferi {
453 sndrv_pcm_sframes_t result; 425 snd_pcm_sframes_t result;
454 void __user *buf; 426 void __user *buf;
455 sndrv_pcm_uframes_t frames; 427 snd_pcm_uframes_t frames;
456}; 428};
457 429
458struct sndrv_xfern { 430struct snd_xfern {
459 sndrv_pcm_sframes_t result; 431 snd_pcm_sframes_t result;
460 void __user * __user *bufs; 432 void __user * __user *bufs;
461 sndrv_pcm_uframes_t frames; 433 snd_pcm_uframes_t frames;
462}; 434};
463 435
464enum { 436enum {
465 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int), 437 SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int),
466 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct sndrv_pcm_info), 438 SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info),
467 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int), 439 SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int),
468 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct sndrv_pcm_hw_params), 440 SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params),
469 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct sndrv_pcm_hw_params), 441 SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params),
470 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12), 442 SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12),
471 SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct sndrv_pcm_sw_params), 443 SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct snd_pcm_sw_params),
472 SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct sndrv_pcm_status), 444 SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct snd_pcm_status),
473 SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, sndrv_pcm_sframes_t), 445 SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, snd_pcm_sframes_t),
474 SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22), 446 SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22),
475 SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct sndrv_pcm_sync_ptr), 447 SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct snd_pcm_sync_ptr),
476 SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct sndrv_pcm_channel_info), 448 SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct snd_pcm_channel_info),
477 SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40), 449 SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40),
478 SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41), 450 SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41),
479 SNDRV_PCM_IOCTL_START = _IO('A', 0x42), 451 SNDRV_PCM_IOCTL_START = _IO('A', 0x42),
480 SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43), 452 SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43),
481 SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44), 453 SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44),
482 SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int), 454 SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int),
483 SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, sndrv_pcm_uframes_t), 455 SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, snd_pcm_uframes_t),
484 SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47), 456 SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47),
485 SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48), 457 SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48),
486 SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, sndrv_pcm_uframes_t), 458 SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, snd_pcm_uframes_t),
487 SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct sndrv_xferi), 459 SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct snd_xferi),
488 SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct sndrv_xferi), 460 SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct snd_xferi),
489 SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct sndrv_xfern), 461 SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct snd_xfern),
490 SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct sndrv_xfern), 462 SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct snd_xfern),
491 SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int), 463 SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int),
492 SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61), 464 SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61),
493}; 465};
@@ -507,7 +479,7 @@ enum {
507 479
508#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) 480#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
509 481
510enum sndrv_rawmidi_stream { 482enum {
511 SNDRV_RAWMIDI_STREAM_OUTPUT = 0, 483 SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
512 SNDRV_RAWMIDI_STREAM_INPUT, 484 SNDRV_RAWMIDI_STREAM_INPUT,
513 SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, 485 SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT,
@@ -517,10 +489,10 @@ enum sndrv_rawmidi_stream {
517#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 489#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
518#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 490#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
519 491
520struct sndrv_rawmidi_info { 492struct snd_rawmidi_info {
521 unsigned int device; /* RO/WR (control): device number */ 493 unsigned int device; /* RO/WR (control): device number */
522 unsigned int subdevice; /* RO/WR (control): subdevice number */ 494 unsigned int subdevice; /* RO/WR (control): subdevice number */
523 enum sndrv_rawmidi_stream stream; /* WR: stream */ 495 int stream; /* WR: stream */
524 int card; /* R: card number */ 496 int card; /* R: card number */
525 unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ 497 unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */
526 unsigned char id[64]; /* ID (user selectable) */ 498 unsigned char id[64]; /* ID (user selectable) */
@@ -531,16 +503,16 @@ struct sndrv_rawmidi_info {
531 unsigned char reserved[64]; /* reserved for future use */ 503 unsigned char reserved[64]; /* reserved for future use */
532}; 504};
533 505
534struct sndrv_rawmidi_params { 506struct snd_rawmidi_params {
535 enum sndrv_rawmidi_stream stream; 507 int stream;
536 size_t buffer_size; /* queue size in bytes */ 508 size_t buffer_size; /* queue size in bytes */
537 size_t avail_min; /* minimum avail bytes for wakeup */ 509 size_t avail_min; /* minimum avail bytes for wakeup */
538 unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ 510 unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
539 unsigned char reserved[16]; /* reserved for future use */ 511 unsigned char reserved[16]; /* reserved for future use */
540}; 512};
541 513
542struct sndrv_rawmidi_status { 514struct snd_rawmidi_status {
543 enum sndrv_rawmidi_stream stream; 515 int stream;
544 struct timespec tstamp; /* Timestamp */ 516 struct timespec tstamp; /* Timestamp */
545 size_t avail; /* available bytes */ 517 size_t avail; /* available bytes */
546 size_t xruns; /* count of overruns since last status (in bytes) */ 518 size_t xruns; /* count of overruns since last status (in bytes) */
@@ -549,9 +521,9 @@ struct sndrv_rawmidi_status {
549 521
550enum { 522enum {
551 SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int), 523 SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int),
552 SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct sndrv_rawmidi_info), 524 SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct snd_rawmidi_info),
553 SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct sndrv_rawmidi_params), 525 SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct snd_rawmidi_params),
554 SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct sndrv_rawmidi_status), 526 SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct snd_rawmidi_status),
555 SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int), 527 SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int),
556 SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int), 528 SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int),
557}; 529};
@@ -562,7 +534,7 @@ enum {
562 534
563#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) 535#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5)
564 536
565enum sndrv_timer_class { 537enum {
566 SNDRV_TIMER_CLASS_NONE = -1, 538 SNDRV_TIMER_CLASS_NONE = -1,
567 SNDRV_TIMER_CLASS_SLAVE = 0, 539 SNDRV_TIMER_CLASS_SLAVE = 0,
568 SNDRV_TIMER_CLASS_GLOBAL, 540 SNDRV_TIMER_CLASS_GLOBAL,
@@ -572,7 +544,7 @@ enum sndrv_timer_class {
572}; 544};
573 545
574/* slave timer classes */ 546/* slave timer classes */
575enum sndrv_timer_slave_class { 547enum {
576 SNDRV_TIMER_SCLASS_NONE = 0, 548 SNDRV_TIMER_SCLASS_NONE = 0,
577 SNDRV_TIMER_SCLASS_APPLICATION, 549 SNDRV_TIMER_SCLASS_APPLICATION,
578 SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ 550 SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */
@@ -588,16 +560,16 @@ enum sndrv_timer_slave_class {
588/* info flags */ 560/* info flags */
589#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ 561#define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */
590 562
591struct sndrv_timer_id { 563struct snd_timer_id {
592 enum sndrv_timer_class dev_class; 564 int dev_class;
593 enum sndrv_timer_slave_class dev_sclass; 565 int dev_sclass;
594 int card; 566 int card;
595 int device; 567 int device;
596 int subdevice; 568 int subdevice;
597}; 569};
598 570
599struct sndrv_timer_ginfo { 571struct snd_timer_ginfo {
600 struct sndrv_timer_id tid; /* requested timer ID */ 572 struct snd_timer_id tid; /* requested timer ID */
601 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ 573 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
602 int card; /* card number */ 574 int card; /* card number */
603 unsigned char id[64]; /* timer identification */ 575 unsigned char id[64]; /* timer identification */
@@ -610,27 +582,27 @@ struct sndrv_timer_ginfo {
610 unsigned char reserved[32]; 582 unsigned char reserved[32];
611}; 583};
612 584
613struct sndrv_timer_gparams { 585struct snd_timer_gparams {
614 struct sndrv_timer_id tid; /* requested timer ID */ 586 struct snd_timer_id tid; /* requested timer ID */
615 unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ 587 unsigned long period_num; /* requested precise period duration (in seconds) - numerator */
616 unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ 588 unsigned long period_den; /* requested precise period duration (in seconds) - denominator */
617 unsigned char reserved[32]; 589 unsigned char reserved[32];
618}; 590};
619 591
620struct sndrv_timer_gstatus { 592struct snd_timer_gstatus {
621 struct sndrv_timer_id tid; /* requested timer ID */ 593 struct snd_timer_id tid; /* requested timer ID */
622 unsigned long resolution; /* current period resolution in ns */ 594 unsigned long resolution; /* current period resolution in ns */
623 unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ 595 unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */
624 unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ 596 unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */
625 unsigned char reserved[32]; 597 unsigned char reserved[32];
626}; 598};
627 599
628struct sndrv_timer_select { 600struct snd_timer_select {
629 struct sndrv_timer_id id; /* bind to timer ID */ 601 struct snd_timer_id id; /* bind to timer ID */
630 unsigned char reserved[32]; /* reserved */ 602 unsigned char reserved[32]; /* reserved */
631}; 603};
632 604
633struct sndrv_timer_info { 605struct snd_timer_info {
634 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ 606 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */
635 int card; /* card number */ 607 int card; /* card number */
636 unsigned char id[64]; /* timer identificator */ 608 unsigned char id[64]; /* timer identificator */
@@ -644,7 +616,7 @@ struct sndrv_timer_info {
644#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ 616#define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */
645#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ 617#define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */
646 618
647struct sndrv_timer_params { 619struct snd_timer_params {
648 unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */ 620 unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */
649 unsigned int ticks; /* requested resolution in ticks */ 621 unsigned int ticks; /* requested resolution in ticks */
650 unsigned int queue_size; /* total size of queue (32-1024) */ 622 unsigned int queue_size; /* total size of queue (32-1024) */
@@ -653,7 +625,7 @@ struct sndrv_timer_params {
653 unsigned char reserved[60]; /* reserved */ 625 unsigned char reserved[60]; /* reserved */
654}; 626};
655 627
656struct sndrv_timer_status { 628struct snd_timer_status {
657 struct timespec tstamp; /* Timestamp - last update */ 629 struct timespec tstamp; /* Timestamp - last update */
658 unsigned int resolution; /* current period resolution in ns */ 630 unsigned int resolution; /* current period resolution in ns */
659 unsigned int lost; /* counter of master tick lost */ 631 unsigned int lost; /* counter of master tick lost */
@@ -664,15 +636,15 @@ struct sndrv_timer_status {
664 636
665enum { 637enum {
666 SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int), 638 SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int),
667 SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct sndrv_timer_id), 639 SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct snd_timer_id),
668 SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int), 640 SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int),
669 SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct sndrv_timer_ginfo), 641 SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct snd_timer_ginfo),
670 SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct sndrv_timer_gparams), 642 SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct snd_timer_gparams),
671 SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct sndrv_timer_gstatus), 643 SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct snd_timer_gstatus),
672 SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct sndrv_timer_select), 644 SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct snd_timer_select),
673 SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct sndrv_timer_info), 645 SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct snd_timer_info),
674 SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct sndrv_timer_params), 646 SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct snd_timer_params),
675 SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct sndrv_timer_status), 647 SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct snd_timer_status),
676 /* The following four ioctls are changed since 1.0.9 due to confliction */ 648 /* The following four ioctls are changed since 1.0.9 due to confliction */
677 SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0), 649 SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0),
678 SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1), 650 SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1),
@@ -680,12 +652,12 @@ enum {
680 SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3), 652 SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3),
681}; 653};
682 654
683struct sndrv_timer_read { 655struct snd_timer_read {
684 unsigned int resolution; 656 unsigned int resolution;
685 unsigned int ticks; 657 unsigned int ticks;
686}; 658};
687 659
688enum sndrv_timer_event { 660enum {
689 SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ 661 SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
690 SNDRV_TIMER_EVENT_TICK, /* val = ticks */ 662 SNDRV_TIMER_EVENT_TICK, /* val = ticks */
691 SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ 663 SNDRV_TIMER_EVENT_START, /* val = resolution in ns */
@@ -704,8 +676,8 @@ enum sndrv_timer_event {
704 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, 676 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
705}; 677};
706 678
707struct sndrv_timer_tread { 679struct snd_timer_tread {
708 enum sndrv_timer_event event; 680 int event;
709 struct timespec tstamp; 681 struct timespec tstamp;
710 unsigned int val; 682 unsigned int val;
711}; 683};
@@ -718,7 +690,7 @@ struct sndrv_timer_tread {
718 690
719#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) 691#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3)
720 692
721struct sndrv_ctl_card_info { 693struct snd_ctl_card_info {
722 int card; /* card number */ 694 int card; /* card number */
723 int pad; /* reserved for future (was type) */ 695 int pad; /* reserved for future (was type) */
724 unsigned char id[16]; /* ID of card (user selectable) */ 696 unsigned char id[16]; /* ID of card (user selectable) */
@@ -731,27 +703,25 @@ struct sndrv_ctl_card_info {
731 unsigned char reserved[48]; /* reserved for future */ 703 unsigned char reserved[48]; /* reserved for future */
732}; 704};
733 705
734enum sndrv_ctl_elem_type { 706typedef int __bitwise snd_ctl_elem_type_t;
735 SNDRV_CTL_ELEM_TYPE_NONE = 0, /* invalid */ 707#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */
736 SNDRV_CTL_ELEM_TYPE_BOOLEAN, /* boolean type */ 708#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */
737 SNDRV_CTL_ELEM_TYPE_INTEGER, /* integer type */ 709#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */
738 SNDRV_CTL_ELEM_TYPE_ENUMERATED, /* enumerated type */ 710#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
739 SNDRV_CTL_ELEM_TYPE_BYTES, /* byte array */ 711#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */
740 SNDRV_CTL_ELEM_TYPE_IEC958, /* IEC958 (S/PDIF) setup */ 712#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
741 SNDRV_CTL_ELEM_TYPE_INTEGER64, /* 64-bit integer type */ 713#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
742 SNDRV_CTL_ELEM_TYPE_LAST = SNDRV_CTL_ELEM_TYPE_INTEGER64, 714#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
743}; 715
744 716typedef int __bitwise snd_ctl_elem_iface_t;
745enum sndrv_ctl_elem_iface { 717#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */
746 SNDRV_CTL_ELEM_IFACE_CARD = 0, /* global control */ 718#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
747 SNDRV_CTL_ELEM_IFACE_HWDEP, /* hardware dependent device */ 719#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
748 SNDRV_CTL_ELEM_IFACE_MIXER, /* virtual mixer device */ 720#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
749 SNDRV_CTL_ELEM_IFACE_PCM, /* PCM device */ 721#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
750 SNDRV_CTL_ELEM_IFACE_RAWMIDI, /* RawMidi device */ 722#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */
751 SNDRV_CTL_ELEM_IFACE_TIMER, /* timer device */ 723#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
752 SNDRV_CTL_ELEM_IFACE_SEQUENCER, /* sequencer client */ 724#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
753 SNDRV_CTL_ELEM_IFACE_LAST = SNDRV_CTL_ELEM_IFACE_SEQUENCER,
754};
755 725
756#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) 726#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
757#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) 727#define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1)
@@ -773,27 +743,27 @@ enum sndrv_ctl_elem_iface {
773#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ 743#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */
774#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ 744#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */
775 745
776struct sndrv_ctl_elem_id { 746struct snd_ctl_elem_id {
777 unsigned int numid; /* numeric identifier, zero = invalid */ 747 unsigned int numid; /* numeric identifier, zero = invalid */
778 enum sndrv_ctl_elem_iface iface; /* interface identifier */ 748 snd_ctl_elem_iface_t iface; /* interface identifier */
779 unsigned int device; /* device/client number */ 749 unsigned int device; /* device/client number */
780 unsigned int subdevice; /* subdevice (substream) number */ 750 unsigned int subdevice; /* subdevice (substream) number */
781 unsigned char name[44]; /* ASCII name of item */ 751 unsigned char name[44]; /* ASCII name of item */
782 unsigned int index; /* index of item */ 752 unsigned int index; /* index of item */
783}; 753};
784 754
785struct sndrv_ctl_elem_list { 755struct snd_ctl_elem_list {
786 unsigned int offset; /* W: first element ID to get */ 756 unsigned int offset; /* W: first element ID to get */
787 unsigned int space; /* W: count of element IDs to get */ 757 unsigned int space; /* W: count of element IDs to get */
788 unsigned int used; /* R: count of element IDs set */ 758 unsigned int used; /* R: count of element IDs set */
789 unsigned int count; /* R: count of all elements */ 759 unsigned int count; /* R: count of all elements */
790 struct sndrv_ctl_elem_id __user *pids; /* R: IDs */ 760 struct snd_ctl_elem_id __user *pids; /* R: IDs */
791 unsigned char reserved[50]; 761 unsigned char reserved[50];
792}; 762};
793 763
794struct sndrv_ctl_elem_info { 764struct snd_ctl_elem_info {
795 struct sndrv_ctl_elem_id id; /* W: element ID */ 765 struct snd_ctl_elem_id id; /* W: element ID */
796 enum sndrv_ctl_elem_type type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ 766 snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
797 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ 767 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
798 unsigned int count; /* count of values */ 768 unsigned int count; /* count of values */
799 pid_t owner; /* owner's PID of this control */ 769 pid_t owner; /* owner's PID of this control */
@@ -822,8 +792,8 @@ struct sndrv_ctl_elem_info {
822 unsigned char reserved[64-4*sizeof(unsigned short)]; 792 unsigned char reserved[64-4*sizeof(unsigned short)];
823}; 793};
824 794
825struct sndrv_ctl_elem_value { 795struct snd_ctl_elem_value {
826 struct sndrv_ctl_elem_id id; /* W: element ID */ 796 struct snd_ctl_elem_id id; /* W: element ID */
827 unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */ 797 unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */
828 union { 798 union {
829 union { 799 union {
@@ -842,7 +812,7 @@ struct sndrv_ctl_elem_value {
842 unsigned char data[512]; 812 unsigned char data[512];
843 unsigned char *data_ptr; 813 unsigned char *data_ptr;
844 } bytes; 814 } bytes;
845 struct sndrv_aes_iec958 iec958; 815 struct snd_aes_iec958 iec958;
846 } value; /* RO */ 816 } value; /* RO */
847 struct timespec tstamp; 817 struct timespec tstamp;
848 unsigned char reserved[128-sizeof(struct timespec)]; 818 unsigned char reserved[128-sizeof(struct timespec)];
@@ -850,24 +820,24 @@ struct sndrv_ctl_elem_value {
850 820
851enum { 821enum {
852 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), 822 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int),
853 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct sndrv_ctl_card_info), 823 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info),
854 SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct sndrv_ctl_elem_list), 824 SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct snd_ctl_elem_list),
855 SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct sndrv_ctl_elem_info), 825 SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct snd_ctl_elem_info),
856 SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct sndrv_ctl_elem_value), 826 SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct snd_ctl_elem_value),
857 SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct sndrv_ctl_elem_value), 827 SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct snd_ctl_elem_value),
858 SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct sndrv_ctl_elem_id), 828 SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct snd_ctl_elem_id),
859 SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct sndrv_ctl_elem_id), 829 SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct snd_ctl_elem_id),
860 SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int), 830 SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int),
861 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct sndrv_ctl_elem_info), 831 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info),
862 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct sndrv_ctl_elem_info), 832 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info),
863 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct sndrv_ctl_elem_id), 833 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id),
864 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), 834 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int),
865 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct sndrv_hwdep_info), 835 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info),
866 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), 836 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int),
867 SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct sndrv_pcm_info), 837 SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct snd_pcm_info),
868 SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int), 838 SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int),
869 SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int), 839 SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int),
870 SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct sndrv_rawmidi_info), 840 SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct snd_rawmidi_info),
871 SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int), 841 SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int),
872 SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int), 842 SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int),
873 SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int), 843 SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
@@ -887,12 +857,12 @@ enum sndrv_ctl_event_type {
887#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ 857#define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */
888#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ 858#define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */
889 859
890struct sndrv_ctl_event { 860struct snd_ctl_event {
891 enum sndrv_ctl_event_type type; /* event type - SNDRV_CTL_EVENT_* */ 861 int type; /* event type - SNDRV_CTL_EVENT_* */
892 union { 862 union {
893 struct { 863 struct {
894 unsigned int mask; 864 unsigned int mask;
895 struct sndrv_ctl_elem_id id; 865 struct snd_ctl_elem_id id;
896 } elem; 866 } elem;
897 unsigned char data8[60]; 867 unsigned char data8[60];
898 } data; 868 } data;
@@ -920,14 +890,14 @@ struct sndrv_ctl_event {
920 * 890 *
921 */ 891 */
922 892
923struct sndrv_xferv { 893struct snd_xferv {
924 const struct iovec *vector; 894 const struct iovec *vector;
925 unsigned long count; 895 unsigned long count;
926}; 896};
927 897
928enum { 898enum {
929 SNDRV_IOCTL_READV = _IOW('K', 0x00, struct sndrv_xferv), 899 SNDRV_IOCTL_READV = _IOW('K', 0x00, struct snd_xferv),
930 SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct sndrv_xferv), 900 SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct snd_xferv),
931}; 901};
932 902
933#endif /* __SOUND_ASOUND_H */ 903#endif /* __SOUND_ASOUND_H */
diff --git a/include/sound/asound_fm.h b/include/sound/asound_fm.h
index b0da677f8f75..956fdc23c595 100644
--- a/include/sound/asound_fm.h
+++ b/include/sound/asound_fm.h
@@ -29,16 +29,16 @@
29#define SNDRV_DM_FM_MODE_OPL2 0x00 29#define SNDRV_DM_FM_MODE_OPL2 0x00
30#define SNDRV_DM_FM_MODE_OPL3 0x01 30#define SNDRV_DM_FM_MODE_OPL3 0x01
31 31
32typedef struct snd_dm_fm_info { 32struct snd_dm_fm_info {
33 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ 33 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
34 unsigned char rhythm; /* percussion mode flag */ 34 unsigned char rhythm; /* percussion mode flag */
35} snd_dm_fm_info_t; 35};
36 36
37/* 37/*
38 * Data structure composing an FM "note" or sound event. 38 * Data structure composing an FM "note" or sound event.
39 */ 39 */
40 40
41typedef struct snd_dm_fm_voice { 41struct snd_dm_fm_voice {
42 unsigned char op; /* operator cell (0 or 1) */ 42 unsigned char op; /* operator cell (0 or 1) */
43 unsigned char voice; /* FM voice (0 to 17) */ 43 unsigned char voice; /* FM voice (0 to 17) */
44 44
@@ -60,25 +60,25 @@ typedef struct snd_dm_fm_voice {
60 unsigned char left; /* stereo left */ 60 unsigned char left; /* stereo left */
61 unsigned char right; /* stereo right */ 61 unsigned char right; /* stereo right */
62 unsigned char waveform; /* 3 bits: waveform shape */ 62 unsigned char waveform; /* 3 bits: waveform shape */
63} snd_dm_fm_voice_t; 63};
64 64
65/* 65/*
66 * This describes an FM note by its voice, octave, frequency number (10bit) 66 * This describes an FM note by its voice, octave, frequency number (10bit)
67 * and key on/off. 67 * and key on/off.
68 */ 68 */
69 69
70typedef struct snd_dm_fm_note { 70struct snd_dm_fm_note {
71 unsigned char voice; /* 0-17 voice channel */ 71 unsigned char voice; /* 0-17 voice channel */
72 unsigned char octave; /* 3 bits: what octave to play */ 72 unsigned char octave; /* 3 bits: what octave to play */
73 unsigned int fnum; /* 10 bits: frequency number */ 73 unsigned int fnum; /* 10 bits: frequency number */
74 unsigned char key_on; /* set for active, clear for silent */ 74 unsigned char key_on; /* set for active, clear for silent */
75} snd_dm_fm_note_t; 75};
76 76
77/* 77/*
78 * FM parameters that apply globally to all voices, and thus are not "notes" 78 * FM parameters that apply globally to all voices, and thus are not "notes"
79 */ 79 */
80 80
81typedef struct snd_dm_fm_params { 81struct snd_dm_fm_params {
82 unsigned char am_depth; /* amplitude modulation depth (1=hi) */ 82 unsigned char am_depth; /* amplitude modulation depth (1=hi) */
83 unsigned char vib_depth; /* vibrato depth (1=hi) */ 83 unsigned char vib_depth; /* vibrato depth (1=hi) */
84 unsigned char kbd_split; /* keyboard split */ 84 unsigned char kbd_split; /* keyboard split */
@@ -90,17 +90,17 @@ typedef struct snd_dm_fm_params {
90 unsigned char tomtom; 90 unsigned char tomtom;
91 unsigned char cymbal; 91 unsigned char cymbal;
92 unsigned char hihat; 92 unsigned char hihat;
93} snd_dm_fm_params_t; 93};
94 94
95/* 95/*
96 * FM mode ioctl settings 96 * FM mode ioctl settings
97 */ 97 */
98 98
99#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, snd_dm_fm_info_t) 99#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
100#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21) 100#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
101#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, snd_dm_fm_note_t) 101#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
102#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, snd_dm_fm_voice_t) 102#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
103#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, snd_dm_fm_params_t) 103#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
104#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int) 104#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
105/* for OPL3 only */ 105/* for OPL3 only */
106#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int) 106#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
diff --git a/include/sound/control.h b/include/sound/control.h
index ef7903c7a327..2489b1eb0110 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -24,24 +24,14 @@
24 24
25#include <sound/asound.h> 25#include <sound/asound.h>
26 26
27typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
28typedef struct sndrv_ctl_card_info snd_ctl_card_info_t;
29typedef enum sndrv_ctl_elem_type snd_ctl_elem_type_t;
30typedef enum sndrv_ctl_elem_iface snd_ctl_elem_iface_t;
31typedef struct sndrv_ctl_elem_id snd_ctl_elem_id_t;
32typedef struct sndrv_ctl_elem_list snd_ctl_elem_list_t;
33typedef struct sndrv_ctl_elem_info snd_ctl_elem_info_t;
34typedef struct sndrv_ctl_elem_value snd_ctl_elem_value_t;
35typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
36typedef struct sndrv_ctl_event snd_ctl_event_t;
37
38#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data) 27#define snd_kcontrol_chip(kcontrol) ((kcontrol)->private_data)
39 28
40typedef int (snd_kcontrol_info_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo); 29struct snd_kcontrol;
41typedef int (snd_kcontrol_get_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 30typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo);
42typedef int (snd_kcontrol_put_t) (snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 31typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
32typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol);
43 33
44typedef struct _snd_kcontrol_new { 34struct snd_kcontrol_new {
45 snd_ctl_elem_iface_t iface; /* interface identifier */ 35 snd_ctl_elem_iface_t iface; /* interface identifier */
46 unsigned int device; /* device/client number */ 36 unsigned int device; /* device/client number */
47 unsigned int subdevice; /* subdevice (substream) number */ 37 unsigned int subdevice; /* subdevice (substream) number */
@@ -53,40 +43,40 @@ typedef struct _snd_kcontrol_new {
53 snd_kcontrol_get_t *get; 43 snd_kcontrol_get_t *get;
54 snd_kcontrol_put_t *put; 44 snd_kcontrol_put_t *put;
55 unsigned long private_value; 45 unsigned long private_value;
56} snd_kcontrol_new_t; 46};
57 47
58typedef struct _snd_kcontrol_volatile { 48struct snd_kcontrol_volatile {
59 snd_ctl_file_t *owner; /* locked */ 49 struct snd_ctl_file *owner; /* locked */
60 pid_t owner_pid; 50 pid_t owner_pid;
61 unsigned int access; /* access rights */ 51 unsigned int access; /* access rights */
62} snd_kcontrol_volatile_t; 52};
63 53
64struct _snd_kcontrol { 54struct snd_kcontrol {
65 struct list_head list; /* list of controls */ 55 struct list_head list; /* list of controls */
66 snd_ctl_elem_id_t id; 56 struct snd_ctl_elem_id id;
67 unsigned int count; /* count of same elements */ 57 unsigned int count; /* count of same elements */
68 snd_kcontrol_info_t *info; 58 snd_kcontrol_info_t *info;
69 snd_kcontrol_get_t *get; 59 snd_kcontrol_get_t *get;
70 snd_kcontrol_put_t *put; 60 snd_kcontrol_put_t *put;
71 unsigned long private_value; 61 unsigned long private_value;
72 void *private_data; 62 void *private_data;
73 void (*private_free)(snd_kcontrol_t *kcontrol); 63 void (*private_free)(struct snd_kcontrol *kcontrol);
74 snd_kcontrol_volatile_t vd[0]; /* volatile data */ 64 struct snd_kcontrol_volatile vd[0]; /* volatile data */
75}; 65};
76 66
77#define snd_kcontrol(n) list_entry(n, snd_kcontrol_t, list) 67#define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)
78 68
79typedef struct _snd_kctl_event { 69struct snd_kctl_event {
80 struct list_head list; /* list of events */ 70 struct list_head list; /* list of events */
81 snd_ctl_elem_id_t id; 71 struct snd_ctl_elem_id id;
82 unsigned int mask; 72 unsigned int mask;
83} snd_kctl_event_t; 73};
84 74
85#define snd_kctl_event(n) list_entry(n, snd_kctl_event_t, list) 75#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
86 76
87struct _snd_ctl_file { 77struct snd_ctl_file {
88 struct list_head list; /* list of all control files */ 78 struct list_head list; /* list of all control files */
89 snd_card_t *card; 79 struct snd_card *card;
90 pid_t pid; 80 pid_t pid;
91 int prefer_pcm_subdevice; 81 int prefer_pcm_subdevice;
92 int prefer_rawmidi_subdevice; 82 int prefer_rawmidi_subdevice;
@@ -97,25 +87,25 @@ struct _snd_ctl_file {
97 struct list_head events; /* waiting events for read */ 87 struct list_head events; /* waiting events for read */
98}; 88};
99 89
100#define snd_ctl_file(n) list_entry(n, snd_ctl_file_t, list) 90#define snd_ctl_file(n) list_entry(n, struct snd_ctl_file, list)
101 91
102typedef int (*snd_kctl_ioctl_func_t) (snd_card_t * card, 92typedef int (*snd_kctl_ioctl_func_t) (struct snd_card * card,
103 snd_ctl_file_t * control, 93 struct snd_ctl_file * control,
104 unsigned int cmd, unsigned long arg); 94 unsigned int cmd, unsigned long arg);
105 95
106void snd_ctl_notify(snd_card_t * card, unsigned int mask, snd_ctl_elem_id_t * id); 96void snd_ctl_notify(struct snd_card * card, unsigned int mask, struct snd_ctl_elem_id * id);
107 97
108snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * kcontrol, unsigned int access); 98struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol * kcontrol, unsigned int access);
109snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * kcontrolnew, void * private_data); 99struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new * kcontrolnew, void * private_data);
110void snd_ctl_free_one(snd_kcontrol_t * kcontrol); 100void snd_ctl_free_one(struct snd_kcontrol * kcontrol);
111int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol); 101int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol);
112int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol); 102int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol);
113int snd_ctl_remove_id(snd_card_t * card, snd_ctl_elem_id_t *id); 103int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id);
114int snd_ctl_rename_id(snd_card_t * card, snd_ctl_elem_id_t *src_id, snd_ctl_elem_id_t *dst_id); 104int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id);
115snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid); 105struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid);
116snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id); 106struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id);
117 107
118int snd_ctl_create(snd_card_t *card); 108int snd_ctl_create(struct snd_card *card);
119 109
120int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn); 110int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn);
121int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn); 111int snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn);
@@ -127,20 +117,20 @@ int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn);
127#define snd_ctl_unregister_ioctl_compat(fcn) 117#define snd_ctl_unregister_ioctl_compat(fcn)
128#endif 118#endif
129 119
130int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *control); 120int snd_ctl_elem_read(struct snd_card *card, struct snd_ctl_elem_value *control);
131int snd_ctl_elem_write(snd_card_t *card, snd_ctl_file_t *file, snd_ctl_elem_value_t *control); 121int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, struct snd_ctl_elem_value *control);
132 122
133static inline unsigned int snd_ctl_get_ioffnum(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 123static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
134{ 124{
135 return id->numid - kctl->id.numid; 125 return id->numid - kctl->id.numid;
136} 126}
137 127
138static inline unsigned int snd_ctl_get_ioffidx(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 128static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
139{ 129{
140 return id->index - kctl->id.index; 130 return id->index - kctl->id.index;
141} 131}
142 132
143static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_id_t *id) 133static inline unsigned int snd_ctl_get_ioff(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id)
144{ 134{
145 if (id->numid) { 135 if (id->numid) {
146 return snd_ctl_get_ioffnum(kctl, id); 136 return snd_ctl_get_ioffnum(kctl, id);
@@ -149,8 +139,8 @@ static inline unsigned int snd_ctl_get_ioff(snd_kcontrol_t *kctl, snd_ctl_elem_i
149 } 139 }
150} 140}
151 141
152static inline snd_ctl_elem_id_t *snd_ctl_build_ioff(snd_ctl_elem_id_t *dst_id, 142static inline struct snd_ctl_elem_id *snd_ctl_build_ioff(struct snd_ctl_elem_id *dst_id,
153 snd_kcontrol_t *src_kctl, 143 struct snd_kcontrol *src_kctl,
154 unsigned int offset) 144 unsigned int offset)
155{ 145{
156 *dst_id = src_kctl->id; 146 *dst_id = src_kctl->id;
diff --git a/include/sound/core.h b/include/sound/core.h
index 2be65ad2fd83..3093e3ddcf36 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -28,13 +28,6 @@
28#include <linux/workqueue.h> /* struct workqueue_struct */ 28#include <linux/workqueue.h> /* struct workqueue_struct */
29#include <linux/pm.h> /* pm_message_t */ 29#include <linux/pm.h> /* pm_message_t */
30 30
31/* Typedef's */
32typedef struct sndrv_interval snd_interval_t;
33typedef enum sndrv_card_type snd_card_type;
34typedef struct sndrv_xferi snd_xferi_t;
35typedef struct sndrv_xfern snd_xfern_t;
36typedef struct sndrv_xferv snd_xferv_t;
37
38/* forward declarations */ 31/* forward declarations */
39#ifdef CONFIG_PCI 32#ifdef CONFIG_PCI
40struct pci_dev; 33struct pci_dev;
@@ -47,76 +40,50 @@ struct sbus_dev;
47 40
48#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000 41#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000
49 42
50typedef enum { 43typedef int __bitwise snd_device_type_t;
51 SNDRV_DEV_TOPLEVEL = (0*SNDRV_DEV_TYPE_RANGE_SIZE), 44#define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0)
52 SNDRV_DEV_CONTROL, 45#define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1)
53 SNDRV_DEV_LOWLEVEL_PRE, 46#define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2)
54 SNDRV_DEV_LOWLEVEL_NORMAL = (1*SNDRV_DEV_TYPE_RANGE_SIZE), 47#define SNDRV_DEV_LOWLEVEL_NORMAL ((__force snd_device_type_t) 0x1000)
55 SNDRV_DEV_PCM, 48#define SNDRV_DEV_PCM ((__force snd_device_type_t) 0x1001)
56 SNDRV_DEV_RAWMIDI, 49#define SNDRV_DEV_RAWMIDI ((__force snd_device_type_t) 0x1002)
57 SNDRV_DEV_TIMER, 50#define SNDRV_DEV_TIMER ((__force snd_device_type_t) 0x1003)
58 SNDRV_DEV_SEQUENCER, 51#define SNDRV_DEV_SEQUENCER ((__force snd_device_type_t) 0x1004)
59 SNDRV_DEV_HWDEP, 52#define SNDRV_DEV_HWDEP ((__force snd_device_type_t) 0x1005)
60 SNDRV_DEV_INFO, 53#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006)
61 SNDRV_DEV_BUS, 54#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007)
62 SNDRV_DEV_CODEC, 55#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008)
63 SNDRV_DEV_LOWLEVEL = (2*SNDRV_DEV_TYPE_RANGE_SIZE) 56#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000)
64} snd_device_type_t; 57
65 58typedef int __bitwise snd_device_state_t;
66typedef enum { 59#define SNDRV_DEV_BUILD ((__force snd_device_state_t) 0)
67 SNDRV_DEV_BUILD, 60#define SNDRV_DEV_REGISTERED ((__force snd_device_state_t) 1)
68 SNDRV_DEV_REGISTERED, 61#define SNDRV_DEV_DISCONNECTED ((__force snd_device_state_t) 2)
69 SNDRV_DEV_DISCONNECTED 62
70} snd_device_state_t; 63typedef int __bitwise snd_device_cmd_t;
71 64#define SNDRV_DEV_CMD_PRE ((__force snd_device_cmd_t) 0)
72typedef enum { 65#define SNDRV_DEV_CMD_NORMAL ((__force snd_device_cmd_t) 1)
73 SNDRV_DEV_CMD_PRE = 0, 66#define SNDRV_DEV_CMD_POST ((__force snd_device_cmd_t) 2)
74 SNDRV_DEV_CMD_NORMAL = 1, 67
75 SNDRV_DEV_CMD_POST = 2 68struct snd_device;
76} snd_device_cmd_t; 69
77 70struct snd_device_ops {
78typedef struct _snd_card snd_card_t; 71 int (*dev_free)(struct snd_device *dev);
79typedef struct _snd_device snd_device_t; 72 int (*dev_register)(struct snd_device *dev);
80 73 int (*dev_disconnect)(struct snd_device *dev);
81typedef int (snd_dev_free_t)(snd_device_t *device); 74 int (*dev_unregister)(struct snd_device *dev);
82typedef int (snd_dev_register_t)(snd_device_t *device); 75};
83typedef int (snd_dev_disconnect_t)(snd_device_t *device); 76
84typedef int (snd_dev_unregister_t)(snd_device_t *device); 77struct snd_device {
85
86typedef struct {
87 snd_dev_free_t *dev_free;
88 snd_dev_register_t *dev_register;
89 snd_dev_disconnect_t *dev_disconnect;
90 snd_dev_unregister_t *dev_unregister;
91} snd_device_ops_t;
92
93struct _snd_device {
94 struct list_head list; /* list of registered devices */ 78 struct list_head list; /* list of registered devices */
95 snd_card_t *card; /* card which holds this device */ 79 struct snd_card *card; /* card which holds this device */
96 snd_device_state_t state; /* state of the device */ 80 snd_device_state_t state; /* state of the device */
97 snd_device_type_t type; /* device type */ 81 snd_device_type_t type; /* device type */
98 void *device_data; /* device structure */ 82 void *device_data; /* device structure */
99 snd_device_ops_t *ops; /* operations */ 83 struct snd_device_ops *ops; /* operations */
100}; 84};
101 85
102#define snd_device(n) list_entry(n, snd_device_t, list) 86#define snd_device(n) list_entry(n, struct snd_device, list)
103
104/* various typedefs */
105
106typedef struct snd_info_entry snd_info_entry_t;
107typedef struct _snd_pcm snd_pcm_t;
108typedef struct _snd_pcm_str snd_pcm_str_t;
109typedef struct _snd_pcm_substream snd_pcm_substream_t;
110typedef struct _snd_mixer snd_kmixer_t;
111typedef struct _snd_rawmidi snd_rawmidi_t;
112typedef struct _snd_ctl_file snd_ctl_file_t;
113typedef struct _snd_kcontrol snd_kcontrol_t;
114typedef struct _snd_timer snd_timer_t;
115typedef struct _snd_timer_instance snd_timer_instance_t;
116typedef struct _snd_hwdep snd_hwdep_t;
117#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
118typedef struct _snd_oss_mixer snd_mixer_oss_t;
119#endif
120 87
121/* monitor files for graceful shutdown (hotplug) */ 88/* monitor files for graceful shutdown (hotplug) */
122 89
@@ -129,7 +96,7 @@ struct snd_shutdown_f_ops; /* define it later in init.c */
129 96
130/* main structure for soundcard */ 97/* main structure for soundcard */
131 98
132struct _snd_card { 99struct snd_card {
133 int number; /* number of soundcard (index to 100 int number; /* number of soundcard (index to
134 snd_cards) */ 101 snd_cards) */
135 102
@@ -143,7 +110,7 @@ struct _snd_card {
143 struct module *module; /* top-level module */ 110 struct module *module; /* top-level module */
144 111
145 void *private_data; /* private data for soundcard */ 112 void *private_data; /* private data for soundcard */
146 void (*private_free) (snd_card_t *card); /* callback for freeing of 113 void (*private_free) (struct snd_card *card); /* callback for freeing of
147 private data */ 114 private data */
148 struct list_head devices; /* devices */ 115 struct list_head devices; /* devices */
149 116
@@ -155,8 +122,8 @@ struct _snd_card {
155 struct list_head controls; /* all controls for this card */ 122 struct list_head controls; /* all controls for this card */
156 struct list_head ctl_files; /* active control files */ 123 struct list_head ctl_files; /* active control files */
157 124
158 snd_info_entry_t *proc_root; /* root for soundcard specific files */ 125 struct snd_info_entry *proc_root; /* root for soundcard specific files */
159 snd_info_entry_t *proc_id; /* the card id */ 126 struct snd_info_entry *proc_id; /* the card id */
160 struct proc_dir_entry *proc_root_link; /* number link to real id */ 127 struct proc_dir_entry *proc_root_link; /* number link to real id */
161 128
162 struct snd_monitor_file *files; /* all files associated to this card */ 129 struct snd_monitor_file *files; /* all files associated to this card */
@@ -167,92 +134,64 @@ struct _snd_card {
167 wait_queue_head_t shutdown_sleep; 134 wait_queue_head_t shutdown_sleep;
168 struct work_struct free_workq; /* for free in workqueue */ 135 struct work_struct free_workq; /* for free in workqueue */
169 struct device *dev; 136 struct device *dev;
170#ifdef CONFIG_SND_GENERIC_DRIVER
171 struct snd_generic_device *generic_dev;
172#endif
173 137
174#ifdef CONFIG_PM 138#ifdef CONFIG_PM
175 int (*pm_suspend)(snd_card_t *card, pm_message_t state);
176 int (*pm_resume)(snd_card_t *card);
177 void *pm_private_data;
178 unsigned int power_state; /* power state */ 139 unsigned int power_state; /* power state */
179 struct semaphore power_lock; /* power lock */ 140 struct semaphore power_lock; /* power lock */
180 wait_queue_head_t power_sleep; 141 wait_queue_head_t power_sleep;
181#endif 142#endif
182 143
183#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 144#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
184 snd_mixer_oss_t *mixer_oss; 145 struct snd_mixer_oss *mixer_oss;
185 int mixer_oss_change_count; 146 int mixer_oss_change_count;
186#endif 147#endif
187}; 148};
188 149
189#ifdef CONFIG_PM 150#ifdef CONFIG_PM
190static inline void snd_power_lock(snd_card_t *card) 151static inline void snd_power_lock(struct snd_card *card)
191{ 152{
192 down(&card->power_lock); 153 down(&card->power_lock);
193} 154}
194 155
195static inline void snd_power_unlock(snd_card_t *card) 156static inline void snd_power_unlock(struct snd_card *card)
196{ 157{
197 up(&card->power_lock); 158 up(&card->power_lock);
198} 159}
199 160
200static inline unsigned int snd_power_get_state(snd_card_t *card) 161static inline unsigned int snd_power_get_state(struct snd_card *card)
201{ 162{
202 return card->power_state; 163 return card->power_state;
203} 164}
204 165
205static inline void snd_power_change_state(snd_card_t *card, unsigned int state) 166static inline void snd_power_change_state(struct snd_card *card, unsigned int state)
206{ 167{
207 card->power_state = state; 168 card->power_state = state;
208 wake_up(&card->power_sleep); 169 wake_up(&card->power_sleep);
209} 170}
210 171
211/* init.c */ 172/* init.c */
212int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file); 173int snd_power_wait(struct snd_card *card, unsigned int power_state, struct file *file);
213
214int snd_card_set_pm_callback(snd_card_t *card,
215 int (*suspend)(snd_card_t *, pm_message_t),
216 int (*resume)(snd_card_t *),
217 void *private_data);
218int snd_card_set_generic_pm_callback(snd_card_t *card,
219 int (*suspend)(snd_card_t *, pm_message_t),
220 int (*resume)(snd_card_t *),
221 void *private_data);
222#define snd_card_set_isa_pm_callback(card,suspend,resume,data) \
223 snd_card_set_generic_pm_callback(card, suspend, resume, data)
224struct pci_dev;
225int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state);
226int snd_card_pci_resume(struct pci_dev *dev);
227#define SND_PCI_PM_CALLBACKS \
228 .suspend = snd_card_pci_suspend, .resume = snd_card_pci_resume
229 174
230#else /* ! CONFIG_PM */ 175#else /* ! CONFIG_PM */
231 176
232#define snd_power_lock(card) do { (void)(card); } while (0) 177#define snd_power_lock(card) do { (void)(card); } while (0)
233#define snd_power_unlock(card) do { (void)(card); } while (0) 178#define snd_power_unlock(card) do { (void)(card); } while (0)
234static inline int snd_power_wait(snd_card_t *card, unsigned int state, struct file *file) { return 0; } 179static inline int snd_power_wait(struct snd_card *card, unsigned int state, struct file *file) { return 0; }
235#define snd_power_get_state(card) SNDRV_CTL_POWER_D0 180#define snd_power_get_state(card) SNDRV_CTL_POWER_D0
236#define snd_power_change_state(card, state) do { (void)(card); } while (0) 181#define snd_power_change_state(card, state) do { (void)(card); } while (0)
237#define snd_card_set_pm_callback(card,suspend,resume,data)
238#define snd_card_set_generic_pm_callback(card,suspend,resume,data)
239#define snd_card_set_isa_pm_callback(card,suspend,resume,data)
240#define SND_PCI_PM_CALLBACKS
241 182
242#endif /* CONFIG_PM */ 183#endif /* CONFIG_PM */
243 184
244struct _snd_minor { 185struct snd_minor {
245 struct list_head list; /* list of all minors per card */ 186 int type; /* SNDRV_DEVICE_TYPE_XXX */
246 int number; /* minor number */ 187 int card; /* card number */
247 int device; /* device number */ 188 int device; /* device number */
248 const char *comment; /* for /proc/asound/devices */
249 struct file_operations *f_ops; /* file operations */ 189 struct file_operations *f_ops; /* file operations */
190 void *private_data; /* private data for f_ops->open */
250 char name[0]; /* device name (keep at the end of 191 char name[0]; /* device name (keep at the end of
251 structure) */ 192 structure) */
252}; 193};
253 194
254typedef struct _snd_minor snd_minor_t;
255
256/* sound.c */ 195/* sound.c */
257 196
258extern int snd_major; 197extern int snd_major;
@@ -260,12 +199,18 @@ extern int snd_ecards_limit;
260 199
261void snd_request_card(int card); 200void snd_request_card(int card);
262 201
263int snd_register_device(int type, snd_card_t *card, int dev, snd_minor_t *reg, const char *name); 202int snd_register_device(int type, struct snd_card *card, int dev,
264int snd_unregister_device(int type, snd_card_t *card, int dev); 203 struct file_operations *f_ops, void *private_data,
204 const char *name);
205int snd_unregister_device(int type, struct snd_card *card, int dev);
206void *snd_lookup_minor_data(unsigned int minor, int type);
265 207
266#ifdef CONFIG_SND_OSSEMUL 208#ifdef CONFIG_SND_OSSEMUL
267int snd_register_oss_device(int type, snd_card_t *card, int dev, snd_minor_t *reg, const char *name); 209int snd_register_oss_device(int type, struct snd_card *card, int dev,
268int snd_unregister_oss_device(int type, snd_card_t *card, int dev); 210 struct file_operations *f_ops, void *private_data,
211 const char *name);
212int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
213void *snd_lookup_oss_minor_data(unsigned int minor, int type);
269#endif 214#endif
270 215
271int snd_minor_info_init(void); 216int snd_minor_info_init(void);
@@ -276,11 +221,9 @@ int snd_minor_info_done(void);
276#ifdef CONFIG_SND_OSSEMUL 221#ifdef CONFIG_SND_OSSEMUL
277int snd_minor_info_oss_init(void); 222int snd_minor_info_oss_init(void);
278int snd_minor_info_oss_done(void); 223int snd_minor_info_oss_done(void);
279int snd_oss_init_module(void);
280#else 224#else
281#define snd_minor_info_oss_init() /*NOP*/ 225#define snd_minor_info_oss_init() /*NOP*/
282#define snd_minor_info_oss_done() /*NOP*/ 226#define snd_minor_info_oss_done() /*NOP*/
283#define snd_oss_init_module() 0
284#endif 227#endif
285 228
286/* memory.c */ 229/* memory.c */
@@ -291,43 +234,41 @@ int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size
291/* init.c */ 234/* init.c */
292 235
293extern unsigned int snd_cards_lock; 236extern unsigned int snd_cards_lock;
294extern snd_card_t *snd_cards[SNDRV_CARDS]; 237extern struct snd_card *snd_cards[SNDRV_CARDS];
295extern rwlock_t snd_card_rwlock; 238extern rwlock_t snd_card_rwlock;
296#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 239#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
297#define SND_MIXER_OSS_NOTIFY_REGISTER 0 240#define SND_MIXER_OSS_NOTIFY_REGISTER 0
298#define SND_MIXER_OSS_NOTIFY_DISCONNECT 1 241#define SND_MIXER_OSS_NOTIFY_DISCONNECT 1
299#define SND_MIXER_OSS_NOTIFY_FREE 2 242#define SND_MIXER_OSS_NOTIFY_FREE 2
300extern int (*snd_mixer_oss_notify_callback)(snd_card_t *card, int cmd); 243extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
301#endif 244#endif
302 245
303snd_card_t *snd_card_new(int idx, const char *id, 246struct snd_card *snd_card_new(int idx, const char *id,
304 struct module *module, int extra_size); 247 struct module *module, int extra_size);
305int snd_card_disconnect(snd_card_t *card); 248int snd_card_disconnect(struct snd_card *card);
306int snd_card_free(snd_card_t *card); 249int snd_card_free(struct snd_card *card);
307int snd_card_free_in_thread(snd_card_t *card); 250int snd_card_free_in_thread(struct snd_card *card);
308int snd_card_register(snd_card_t *card); 251int snd_card_register(struct snd_card *card);
309int snd_card_info_init(void); 252int snd_card_info_init(void);
310int snd_card_info_done(void); 253int snd_card_info_done(void);
311int snd_component_add(snd_card_t *card, const char *component); 254int snd_component_add(struct snd_card *card, const char *component);
312int snd_card_file_add(snd_card_t *card, struct file *file); 255int snd_card_file_add(struct snd_card *card, struct file *file);
313int snd_card_file_remove(snd_card_t *card, struct file *file); 256int snd_card_file_remove(struct snd_card *card, struct file *file);
314 257
315#ifndef snd_card_set_dev 258#ifndef snd_card_set_dev
316#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) 259#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr))
317#endif 260#endif
318/* register a generic device (for ISA, etc) */
319int snd_card_set_generic_dev(snd_card_t *card);
320 261
321/* device.c */ 262/* device.c */
322 263
323int snd_device_new(snd_card_t *card, snd_device_type_t type, 264int snd_device_new(struct snd_card *card, snd_device_type_t type,
324 void *device_data, snd_device_ops_t *ops); 265 void *device_data, struct snd_device_ops *ops);
325int snd_device_register(snd_card_t *card, void *device_data); 266int snd_device_register(struct snd_card *card, void *device_data);
326int snd_device_register_all(snd_card_t *card); 267int snd_device_register_all(struct snd_card *card);
327int snd_device_disconnect(snd_card_t *card, void *device_data); 268int snd_device_disconnect(struct snd_card *card, void *device_data);
328int snd_device_disconnect_all(snd_card_t *card); 269int snd_device_disconnect_all(struct snd_card *card);
329int snd_device_free(snd_card_t *card, void *device_data); 270int snd_device_free(struct snd_card *card, void *device_data);
330int snd_device_free_all(snd_card_t *card, snd_device_cmd_t cmd); 271int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd);
331 272
332/* isadma.c */ 273/* isadma.c */
333 274
@@ -376,7 +317,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
376#ifdef CONFIG_SND_VERBOSE_PRINTK 317#ifdef CONFIG_SND_VERBOSE_PRINTK
377/** 318/**
378 * snd_printd - debug printk 319 * snd_printd - debug printk
379 * @format: format string 320 * @fmt: format string
380 * 321 *
381 * Compiled only when Works like snd_printk() for debugging purpose. 322 * Compiled only when Works like snd_printk() for debugging purpose.
382 * Ignored when CONFIG_SND_DEBUG is not set. 323 * Ignored when CONFIG_SND_DEBUG is not set.
@@ -390,7 +331,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
390/** 331/**
391 * snd_assert - run-time assertion macro 332 * snd_assert - run-time assertion macro
392 * @expr: expression 333 * @expr: expression
393 * @args...: the action
394 * 334 *
395 * This macro checks the expression in run-time and invokes the commands 335 * This macro checks the expression in run-time and invokes the commands
396 * given in the rest arguments if the assertion is failed. 336 * given in the rest arguments if the assertion is failed.
@@ -443,4 +383,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
443#endif 383#endif
444#endif 384#endif
445 385
386#include "typedefs.h"
387
446#endif /* __SOUND_CORE_H */ 388#endif /* __SOUND_CORE_H */
diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h
index d7f90823778a..ac6a5d882088 100644
--- a/include/sound/cs4231.h
+++ b/include/sound/cs4231.h
@@ -26,21 +26,6 @@
26#include "pcm.h" 26#include "pcm.h"
27#include "timer.h" 27#include "timer.h"
28 28
29#ifdef CONFIG_SBUS
30#define SBUS_SUPPORT
31#include <asm/sbus.h>
32#endif
33
34#if defined(CONFIG_PCI) && defined(CONFIG_SPARC64)
35#define EBUS_SUPPORT
36#include <linux/pci.h>
37#include <asm/ebus.h>
38#endif
39
40#if !defined(SBUS_SUPPORT) && !defined(EBUS_SUPPORT)
41#define LEGACY_SUPPORT
42#endif
43
44/* IO ports */ 29/* IO ports */
45 30
46#define CS4231P(x) (c_d_c_CS4231##x) 31#define CS4231P(x) (c_d_c_CS4231##x)
@@ -232,18 +217,14 @@
232#define CS4231_HWSHARE_DMA1 (1<<1) 217#define CS4231_HWSHARE_DMA1 (1<<1)
233#define CS4231_HWSHARE_DMA2 (1<<2) 218#define CS4231_HWSHARE_DMA2 (1<<2)
234 219
235typedef struct _snd_cs4231 cs4231_t; 220struct snd_cs4231 {
236
237struct _snd_cs4231 {
238 unsigned long port; /* base i/o port */ 221 unsigned long port; /* base i/o port */
239#ifdef LEGACY_SUPPORT
240 struct resource *res_port; 222 struct resource *res_port;
241 unsigned long cport; /* control base i/o port (CS4236) */ 223 unsigned long cport; /* control base i/o port (CS4236) */
242 struct resource *res_cport; 224 struct resource *res_cport;
243 int irq; /* IRQ line */ 225 int irq; /* IRQ line */
244 int dma1; /* playback DMA */ 226 int dma1; /* playback DMA */
245 int dma2; /* record DMA */ 227 int dma2; /* record DMA */
246#endif
247 unsigned short version; /* version of CODEC chip */ 228 unsigned short version; /* version of CODEC chip */
248 unsigned short mode; /* see to CS4231_MODE_XXXX */ 229 unsigned short mode; /* see to CS4231_MODE_XXXX */
249 unsigned short hardware; /* see to CS4231_HW_XXXX */ 230 unsigned short hardware; /* see to CS4231_HW_XXXX */
@@ -251,29 +232,11 @@ struct _snd_cs4231 {
251 unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ 232 unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
252 ebus_flag:1; /* SPARC: EBUS present */ 233 ebus_flag:1; /* SPARC: EBUS present */
253 234
254#ifdef EBUS_SUPPORT 235 struct snd_card *card;
255 struct ebus_dma_info eb2c; 236 struct snd_pcm *pcm;
256 struct ebus_dma_info eb2p; 237 struct snd_pcm_substream *playback_substream;
257#endif 238 struct snd_pcm_substream *capture_substream;
258 239 struct snd_timer *timer;
259#if defined(SBUS_SUPPORT) || defined(EBUS_SUPPORT)
260 union {
261#ifdef SBUS_SUPPORT
262 struct sbus_dev *sdev;
263#endif
264#ifdef EBUS_SUPPORT
265 struct pci_dev *pdev;
266#endif
267 } dev_u;
268 unsigned int p_periods_sent;
269 unsigned int c_periods_sent;
270#endif
271
272 snd_card_t *card;
273 snd_pcm_t *pcm;
274 snd_pcm_substream_t *playback_substream;
275 snd_pcm_substream_t *capture_substream;
276 snd_timer_t *timer;
277 240
278 unsigned char image[32]; /* registers image */ 241 unsigned char image[32]; /* registers image */
279 unsigned char eimage[32]; /* extended registers image */ 242 unsigned char eimage[32]; /* extended registers image */
@@ -281,63 +244,59 @@ struct _snd_cs4231 {
281 int mce_bit; 244 int mce_bit;
282 int calibrate_mute; 245 int calibrate_mute;
283 int sw_3d_bit; 246 int sw_3d_bit;
284#ifdef LEGACY_SUPPORT
285 unsigned int p_dma_size; 247 unsigned int p_dma_size;
286 unsigned int c_dma_size; 248 unsigned int c_dma_size;
287#endif
288 249
289 spinlock_t reg_lock; 250 spinlock_t reg_lock;
290 struct semaphore mce_mutex; 251 struct semaphore mce_mutex;
291 struct semaphore open_mutex; 252 struct semaphore open_mutex;
292 253
293 int (*rate_constraint) (snd_pcm_runtime_t *runtime); 254 int (*rate_constraint) (struct snd_pcm_runtime *runtime);
294 void (*set_playback_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char pdfr); 255 void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);
295 void (*set_capture_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char cdfr); 256 void (*set_capture_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char cdfr);
296 void (*trigger) (cs4231_t *chip, unsigned int what, int start); 257 void (*trigger) (struct snd_cs4231 *chip, unsigned int what, int start);
297#ifdef CONFIG_PM 258#ifdef CONFIG_PM
298 void (*suspend) (cs4231_t *chip); 259 void (*suspend) (struct snd_cs4231 *chip);
299 void (*resume) (cs4231_t *chip); 260 void (*resume) (struct snd_cs4231 *chip);
300#endif 261#endif
301 void *dma_private_data; 262 void *dma_private_data;
302#ifdef LEGACY_SUPPORT 263 int (*claim_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
303 int (*claim_dma) (cs4231_t *chip, void *dma_private_data, int dma); 264 int (*release_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
304 int (*release_dma) (cs4231_t *chip, void *dma_private_data, int dma);
305#endif
306}; 265};
307 266
308/* exported functions */ 267/* exported functions */
309 268
310void snd_cs4231_out(cs4231_t *chip, unsigned char reg, unsigned char val); 269void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
311unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg); 270unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg);
312void snd_cs4236_ext_out(cs4231_t *chip, unsigned char reg, unsigned char val); 271void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
313unsigned char snd_cs4236_ext_in(cs4231_t *chip, unsigned char reg); 272unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg);
314void snd_cs4231_mce_up(cs4231_t *chip); 273void snd_cs4231_mce_up(struct snd_cs4231 *chip);
315void snd_cs4231_mce_down(cs4231_t *chip); 274void snd_cs4231_mce_down(struct snd_cs4231 *chip);
316 275
317irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs); 276irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs);
318 277
319const char *snd_cs4231_chip_id(cs4231_t *chip); 278const char *snd_cs4231_chip_id(struct snd_cs4231 *chip);
320 279
321int snd_cs4231_create(snd_card_t * card, 280int snd_cs4231_create(struct snd_card *card,
322 unsigned long port, 281 unsigned long port,
323 unsigned long cport, 282 unsigned long cport,
324 int irq, int dma1, int dma2, 283 int irq, int dma1, int dma2,
325 unsigned short hardware, 284 unsigned short hardware,
326 unsigned short hwshare, 285 unsigned short hwshare,
327 cs4231_t ** rchip); 286 struct snd_cs4231 ** rchip);
328int snd_cs4231_pcm(cs4231_t * chip, int device, snd_pcm_t **rpcm); 287int snd_cs4231_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
329int snd_cs4231_timer(cs4231_t * chip, int device, snd_timer_t **rtimer); 288int snd_cs4231_timer(struct snd_cs4231 * chip, int device, struct snd_timer **rtimer);
330int snd_cs4231_mixer(cs4231_t * chip); 289int snd_cs4231_mixer(struct snd_cs4231 * chip);
331 290
332int snd_cs4236_create(snd_card_t * card, 291int snd_cs4236_create(struct snd_card *card,
333 unsigned long port, 292 unsigned long port,
334 unsigned long cport, 293 unsigned long cport,
335 int irq, int dma1, int dma2, 294 int irq, int dma1, int dma2,
336 unsigned short hardware, 295 unsigned short hardware,
337 unsigned short hwshare, 296 unsigned short hwshare,
338 cs4231_t ** rchip); 297 struct snd_cs4231 ** rchip);
339int snd_cs4236_pcm(cs4231_t * chip, int device, snd_pcm_t **rpcm); 298int snd_cs4236_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
340int snd_cs4236_mixer(cs4231_t * chip); 299int snd_cs4236_mixer(struct snd_cs4231 * chip);
341 300
342/* 301/*
343 * mixer library 302 * mixer library
@@ -349,9 +308,9 @@ int snd_cs4236_mixer(cs4231_t * chip);
349 .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \ 308 .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \
350 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } 309 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
351 310
352int snd_cs4231_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo); 311int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
353int snd_cs4231_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 312int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
354int snd_cs4231_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 313int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
355 314
356#define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ 315#define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
357{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 316{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
@@ -359,8 +318,8 @@ int snd_cs4231_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucon
359 .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \ 318 .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \
360 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 319 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
361 320
362int snd_cs4231_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo); 321int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
363int snd_cs4231_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 322int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
364int snd_cs4231_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); 323int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
365 324
366#endif /* __SOUND_CS4231_H */ 325#endif /* __SOUND_CS4231_H */
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index b0c0e192eb56..199b5098ff7e 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -1631,42 +1631,41 @@
1631#define CS46XX_MIXER_SPDIF_INPUT_ELEMENT 1 1631#define CS46XX_MIXER_SPDIF_INPUT_ELEMENT 1
1632#define CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT 2 1632#define CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT 2
1633 1633
1634typedef struct _snd_cs46xx cs46xx_t;
1635 1634
1636typedef struct _snd_cs46xx_pcm_t { 1635struct snd_cs46xx_pcm {
1637 struct snd_dma_buffer hw_buf; 1636 struct snd_dma_buffer hw_buf;
1638 1637
1639 unsigned int ctl; 1638 unsigned int ctl;
1640 unsigned int shift; /* Shift count to trasform frames in bytes */ 1639 unsigned int shift; /* Shift count to trasform frames in bytes */
1641 snd_pcm_indirect_t pcm_rec; 1640 struct snd_pcm_indirect pcm_rec;
1642 snd_pcm_substream_t *substream; 1641 struct snd_pcm_substream *substream;
1643 1642
1644 pcm_channel_descriptor_t * pcm_channel; 1643 struct dsp_pcm_channel_descriptor * pcm_channel;
1645 1644
1646 int pcm_channel_id; /* Fron Rear, Center Lfe ... */ 1645 int pcm_channel_id; /* Fron Rear, Center Lfe ... */
1647} cs46xx_pcm_t; 1646};
1648 1647
1649typedef struct { 1648struct snd_cs46xx_region {
1650 char name[24]; 1649 char name[24];
1651 unsigned long base; 1650 unsigned long base;
1652 void __iomem *remap_addr; 1651 void __iomem *remap_addr;
1653 unsigned long size; 1652 unsigned long size;
1654 struct resource *resource; 1653 struct resource *resource;
1655} snd_cs46xx_region_t; 1654};
1656 1655
1657struct _snd_cs46xx { 1656struct snd_cs46xx {
1658 int irq; 1657 int irq;
1659 unsigned long ba0_addr; 1658 unsigned long ba0_addr;
1660 unsigned long ba1_addr; 1659 unsigned long ba1_addr;
1661 union { 1660 union {
1662 struct { 1661 struct {
1663 snd_cs46xx_region_t ba0; 1662 struct snd_cs46xx_region ba0;
1664 snd_cs46xx_region_t data0; 1663 struct snd_cs46xx_region data0;
1665 snd_cs46xx_region_t data1; 1664 struct snd_cs46xx_region data1;
1666 snd_cs46xx_region_t pmem; 1665 struct snd_cs46xx_region pmem;
1667 snd_cs46xx_region_t reg; 1666 struct snd_cs46xx_region reg;
1668 } name; 1667 } name;
1669 snd_cs46xx_region_t idx[5]; 1668 struct snd_cs46xx_region idx[5];
1670 } region; 1669 } region;
1671 1670
1672 unsigned int mode; 1671 unsigned int mode;
@@ -1676,34 +1675,34 @@ struct _snd_cs46xx {
1676 1675
1677 unsigned int ctl; 1676 unsigned int ctl;
1678 unsigned int shift; /* Shift count to trasform frames in bytes */ 1677 unsigned int shift; /* Shift count to trasform frames in bytes */
1679 snd_pcm_indirect_t pcm_rec; 1678 struct snd_pcm_indirect pcm_rec;
1680 snd_pcm_substream_t *substream; 1679 struct snd_pcm_substream *substream;
1681 } capt; 1680 } capt;
1682 1681
1683 1682
1684 int nr_ac97_codecs; 1683 int nr_ac97_codecs;
1685 ac97_bus_t *ac97_bus; 1684 struct snd_ac97_bus *ac97_bus;
1686 ac97_t *ac97[MAX_NR_AC97]; 1685 struct snd_ac97 *ac97[MAX_NR_AC97];
1687 1686
1688 struct pci_dev *pci; 1687 struct pci_dev *pci;
1689 snd_card_t *card; 1688 struct snd_card *card;
1690 snd_pcm_t *pcm; 1689 struct snd_pcm *pcm;
1691 1690
1692 snd_rawmidi_t *rmidi; 1691 struct snd_rawmidi *rmidi;
1693 snd_rawmidi_substream_t *midi_input; 1692 struct snd_rawmidi_substream *midi_input;
1694 snd_rawmidi_substream_t *midi_output; 1693 struct snd_rawmidi_substream *midi_output;
1695 1694
1696 spinlock_t reg_lock; 1695 spinlock_t reg_lock;
1697 unsigned int midcr; 1696 unsigned int midcr;
1698 unsigned int uartm; 1697 unsigned int uartm;
1699 1698
1700 int amplifier; 1699 int amplifier;
1701 void (*amplifier_ctrl)(cs46xx_t *, int); 1700 void (*amplifier_ctrl)(struct snd_cs46xx *, int);
1702 void (*active_ctrl)(cs46xx_t *, int); 1701 void (*active_ctrl)(struct snd_cs46xx *, int);
1703 void (*mixer_init)(cs46xx_t *); 1702 void (*mixer_init)(struct snd_cs46xx *);
1704 1703
1705 int acpi_port; 1704 int acpi_port;
1706 snd_kcontrol_t *eapd_switch; /* for amplifier hack */ 1705 struct snd_kcontrol *eapd_switch; /* for amplifier hack */
1707 int accept_valid; /* accept mmap valid (for OSS) */ 1706 int accept_valid; /* accept mmap valid (for OSS) */
1708 1707
1709 struct gameport *gameport; 1708 struct gameport *gameport;
@@ -1714,29 +1713,31 @@ struct _snd_cs46xx {
1714#ifdef CONFIG_SND_CS46XX_NEW_DSP 1713#ifdef CONFIG_SND_CS46XX_NEW_DSP
1715 struct semaphore spos_mutex; 1714 struct semaphore spos_mutex;
1716 1715
1717 dsp_spos_instance_t * dsp_spos_instance; 1716 struct dsp_spos_instance * dsp_spos_instance;
1718 1717
1719 snd_pcm_t *pcm_rear; 1718 struct snd_pcm *pcm_rear;
1720 snd_pcm_t *pcm_center_lfe; 1719 struct snd_pcm *pcm_center_lfe;
1721 snd_pcm_t *pcm_iec958; 1720 struct snd_pcm *pcm_iec958;
1722#else /* for compatibility */ 1721#else /* for compatibility */
1723 cs46xx_pcm_t *playback_pcm; 1722 struct snd_cs46xx_pcm *playback_pcm;
1724 unsigned int play_ctl; 1723 unsigned int play_ctl;
1725#endif 1724#endif
1726}; 1725};
1727 1726
1728int snd_cs46xx_create(snd_card_t *card, 1727int snd_cs46xx_create(struct snd_card *card,
1729 struct pci_dev *pci, 1728 struct pci_dev *pci,
1730 int external_amp, int thinkpad, 1729 int external_amp, int thinkpad,
1731 cs46xx_t **rcodec); 1730 struct snd_cs46xx **rcodec);
1732 1731int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state);
1733int snd_cs46xx_pcm(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1732int snd_cs46xx_resume(struct pci_dev *pci);
1734int snd_cs46xx_pcm_rear(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1733
1735int snd_cs46xx_pcm_iec958(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1734int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1736int snd_cs46xx_pcm_center_lfe(cs46xx_t *chip, int device, snd_pcm_t **rpcm); 1735int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1737int snd_cs46xx_mixer(cs46xx_t *chip, int spdif_device); 1736int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1738int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi); 1737int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
1739int snd_cs46xx_start_dsp(cs46xx_t *chip); 1738int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device);
1740int snd_cs46xx_gameport(cs46xx_t *chip); 1739int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rmidi);
1740int snd_cs46xx_start_dsp(struct snd_cs46xx *chip);
1741int snd_cs46xx_gameport(struct snd_cs46xx *chip);
1741 1742
1742#endif /* __SOUND_CS46XX_H */ 1743#endif /* __SOUND_CS46XX_H */
diff --git a/include/sound/cs46xx_dsp_scb_types.h b/include/sound/cs46xx_dsp_scb_types.h
index 3f990a3a6903..9cb6c7d09567 100644
--- a/include/sound/cs46xx_dsp_scb_types.h
+++ b/include/sound/cs46xx_dsp_scb_types.h
@@ -41,7 +41,7 @@
41 41
42/* This structs are used internally by the SP */ 42/* This structs are used internally by the SP */
43 43
44typedef struct _basic_dma_req_t { 44struct dsp_basic_dma_req {
45 /* DMA Requestor Word 0 (DCW) fields: 45 /* DMA Requestor Word 0 (DCW) fields:
46 46
47 31 [30-28]27 [26:24] 23 22 21 20 [19:18] [17:16] 15 14 13 12 11 10 9 8 7 6 [5:0] 47 31 [30-28]27 [26:24] 23 22 21 20 [19:18] [17:16] 15 14 13 12 11 10 9 8 7 6 [5:0]
@@ -53,9 +53,9 @@ typedef struct _basic_dma_req_t {
53 u32 dmw; /* DMA Mode Word */ 53 u32 dmw; /* DMA Mode Word */
54 u32 saw; /* Source Address Word */ 54 u32 saw; /* Source Address Word */
55 u32 daw; /* Destination Address Word */ 55 u32 daw; /* Destination Address Word */
56} basic_dma_req_t; 56};
57 57
58typedef struct _scatter_gather_ext_t { 58struct dsp_scatter_gather_ext {
59 u32 npaw; /* Next-Page Address Word */ 59 u32 npaw; /* Next-Page Address Word */
60 60
61 /* DMA Requestor Word 5 (NPCW) fields: 61 /* DMA Requestor Word 5 (NPCW) fields:
@@ -69,9 +69,9 @@ typedef struct _scatter_gather_ext_t {
69 u32 lbaw; /* Loop-Begin Address Word */ 69 u32 lbaw; /* Loop-Begin Address Word */
70 u32 nplbaw; /* Next-Page after Loop-Begin Address Word */ 70 u32 nplbaw; /* Next-Page after Loop-Begin Address Word */
71 u32 sgaw; /* Scatter/Gather Address Word */ 71 u32 sgaw; /* Scatter/Gather Address Word */
72} scatter_gather_ext_t; 72};
73 73
74typedef struct _volume_control_t { 74struct dsp_volume_control {
75 ___DSP_DUAL_16BIT_ALLOC( 75 ___DSP_DUAL_16BIT_ALLOC(
76 rightTarg, /* Target volume for left & right channels */ 76 rightTarg, /* Target volume for left & right channels */
77 leftTarg 77 leftTarg
@@ -80,10 +80,10 @@ typedef struct _volume_control_t {
80 rightVol, /* Current left & right channel volumes */ 80 rightVol, /* Current left & right channel volumes */
81 leftVol 81 leftVol
82 ) 82 )
83} volume_control_t; 83};
84 84
85/* Generic stream control block (SCB) structure definition */ 85/* Generic stream control block (SCB) structure definition */
86typedef struct _generic_scb_t { 86struct dsp_generic_scb {
87 /* For streaming I/O, the DSP should never alter any words in the DMA 87 /* For streaming I/O, the DSP should never alter any words in the DMA
88 requestor or the scatter/gather extension. Only ad hoc DMA request 88 requestor or the scatter/gather extension. Only ad hoc DMA request
89 streams are free to alter the requestor (currently only occur in the 89 streams are free to alter the requestor (currently only occur in the
@@ -99,13 +99,13 @@ typedef struct _generic_scb_t {
99 99
100 /* Initialized by the host, only modified by DMA 100 /* Initialized by the host, only modified by DMA
101 R/O for the DSP task */ 101 R/O for the DSP task */
102 basic_dma_req_t basic_req; /* Optional */ 102 struct dsp_basic_dma_req basic_req; /* Optional */
103 103
104 /* Scatter/gather DMA requestor extension (5 ints) 104 /* Scatter/gather DMA requestor extension (5 ints)
105 Initialized by the host, only modified by DMA 105 Initialized by the host, only modified by DMA
106 DSP task never needs to even read these. 106 DSP task never needs to even read these.
107 */ 107 */
108 scatter_gather_ext_t sg_ext; /* Optional */ 108 struct dsp_scatter_gather_ext sg_ext; /* Optional */
109 109
110 /* Sublist pointer & next stream control block (SCB) link. 110 /* Sublist pointer & next stream control block (SCB) link.
111 Initialized & modified by the host R/O for the DSP task 111 Initialized & modified by the host R/O for the DSP task
@@ -179,11 +179,11 @@ typedef struct _generic_scb_t {
179 179
180 These two 32-bit words are redefined for wavetable & 3-D voices. 180 These two 32-bit words are redefined for wavetable & 3-D voices.
181 */ 181 */
182 volume_control_t vol_ctrl_t; /* Optional */ 182 struct dsp_volume_control vol_ctrl_t; /* Optional */
183} generic_scb_t; 183};
184 184
185 185
186typedef struct _spos_control_block_t { 186struct dsp_spos_control_block {
187 /* WARNING: Certain items in this structure are modified by the host 187 /* WARNING: Certain items in this structure are modified by the host
188 Any dword that can be modified by the host, must not be 188 Any dword that can be modified by the host, must not be
189 modified by the SP as the host can only do atomic dword 189 modified by the SP as the host can only do atomic dword
@@ -273,10 +273,10 @@ typedef struct _spos_control_block_t {
273 u32 r32_save_for_spurious_int; 273 u32 r32_save_for_spurious_int;
274 u32 r32_save_for_trap; 274 u32 r32_save_for_trap;
275 u32 r32_save_for_HFG; 275 u32 r32_save_for_HFG;
276} spos_control_block_t; 276};
277 277
278/* SPB for MIX_TO_OSTREAM algorithm family */ 278/* SPB for MIX_TO_OSTREAM algorithm family */
279typedef struct _mix2_ostream_spb_t 279struct dsp_mix2_ostream_spb
280{ 280{
281 /* 16b.16b integer.frac approximation to the 281 /* 16b.16b integer.frac approximation to the
282 number of 3 sample triplets to output each 282 number of 3 sample triplets to output each
@@ -290,13 +290,13 @@ typedef struct _mix2_ostream_spb_t
290 output triplets since the start of group 290 output triplets since the start of group
291 */ 291 */
292 u32 accumOutTriplets; 292 u32 accumOutTriplets;
293} mix2_ostream_spb_t; 293};
294 294
295/* SCB for Timing master algorithm */ 295/* SCB for Timing master algorithm */
296typedef struct _timing_master_scb_t { 296struct dsp_timing_master_scb {
297 /* First 12 dwords from generic_scb_t */ 297 /* First 12 dwords from generic_scb_t */
298 basic_dma_req_t basic_req; /* Optional */ 298 struct dsp_basic_dma_req basic_req; /* Optional */
299 scatter_gather_ext_t sg_ext; /* Optional */ 299 struct dsp_scatter_gather_ext sg_ext; /* Optional */
300 ___DSP_DUAL_16BIT_ALLOC( 300 ___DSP_DUAL_16BIT_ALLOC(
301 next_scb, /* REQUIRED */ 301 next_scb, /* REQUIRED */
302 sub_list_ptr /* REQUIRED */ 302 sub_list_ptr /* REQUIRED */
@@ -358,13 +358,13 @@ typedef struct _timing_master_scb_t {
358 number of samples to output each frame. 358 number of samples to output each frame.
359 (approximation must be floor, to insure */ 359 (approximation must be floor, to insure */
360 u32 nsamp_per_frm_q15; 360 u32 nsamp_per_frm_q15;
361} timing_master_scb_t; 361};
362 362
363/* SCB for CODEC output algorithm */ 363/* SCB for CODEC output algorithm */
364typedef struct _codec_output_scb_t { 364struct dsp_codec_output_scb {
365 /* First 13 dwords from generic_scb_t */ 365 /* First 13 dwords from generic_scb_t */
366 basic_dma_req_t basic_req; /* Optional */ 366 struct dsp_basic_dma_req basic_req; /* Optional */
367 scatter_gather_ext_t sg_ext; /* Optional */ 367 struct dsp_scatter_gather_ext sg_ext; /* Optional */
368 ___DSP_DUAL_16BIT_ALLOC( 368 ___DSP_DUAL_16BIT_ALLOC(
369 next_scb, /* REQUIRED */ 369 next_scb, /* REQUIRED */
370 sub_list_ptr /* REQUIRED */ 370 sub_list_ptr /* REQUIRED */
@@ -422,13 +422,13 @@ typedef struct _codec_output_scb_t {
422 reserved, 422 reserved,
423 last_sub_ptr 423 last_sub_ptr
424 ) 424 )
425} codec_output_scb_t; 425};
426 426
427/* SCB for CODEC input algorithm */ 427/* SCB for CODEC input algorithm */
428typedef struct _codec_input_scb_t { 428struct dsp_codec_input_scb {
429 /* First 13 dwords from generic_scb_t */ 429 /* First 13 dwords from generic_scb_t */
430 basic_dma_req_t basic_req; /* Optional */ 430 struct dsp_basic_dma_req basic_req; /* Optional */
431 scatter_gather_ext_t sg_ext; /* Optional */ 431 struct dsp_scatter_gather_ext sg_ext; /* Optional */
432 ___DSP_DUAL_16BIT_ALLOC( 432 ___DSP_DUAL_16BIT_ALLOC(
433 next_scb, /* REQUIRED */ 433 next_scb, /* REQUIRED */
434 sub_list_ptr /* REQUIRED */ 434 sub_list_ptr /* REQUIRED */
@@ -479,13 +479,13 @@ typedef struct _codec_input_scb_t {
479 ) 479 )
480 480
481 u32 reserved2; 481 u32 reserved2;
482} codec_input_scb_t; 482};
483 483
484 484
485typedef struct _pcm_serial_input_scb_t { 485struct dsp_pcm_serial_input_scb {
486 /* First 13 dwords from generic_scb_t */ 486 /* First 13 dwords from generic_scb_t */
487 basic_dma_req_t basic_req; /* Optional */ 487 struct dsp_basic_dma_req basic_req; /* Optional */
488 scatter_gather_ext_t sg_ext; /* Optional */ 488 struct dsp_scatter_gather_ext sg_ext; /* Optional */
489 ___DSP_DUAL_16BIT_ALLOC( 489 ___DSP_DUAL_16BIT_ALLOC(
490 next_scb, /* REQUIRED */ 490 next_scb, /* REQUIRED */
491 sub_list_ptr /* REQUIRED */ 491 sub_list_ptr /* REQUIRED */
@@ -512,11 +512,11 @@ typedef struct _pcm_serial_input_scb_t {
512 ) 512 )
513 513
514 /* Initialized by the host (host updates target volumes) */ 514 /* Initialized by the host (host updates target volumes) */
515 volume_control_t psi_vol_ctrl; 515 struct dsp_volume_control psi_vol_ctrl;
516 516
517} pcm_serial_input_scb_t; 517};
518 518
519typedef struct _src_task_scb_t { 519struct dsp_src_task_scb {
520 ___DSP_DUAL_16BIT_ALLOC( 520 ___DSP_DUAL_16BIT_ALLOC(
521 frames_left_in_gof, 521 frames_left_in_gof,
522 gofs_left_in_sec 522 gofs_left_in_sec
@@ -571,10 +571,10 @@ typedef struct _src_task_scb_t {
571 571
572 u32 phiIncr6int_26frac; 572 u32 phiIncr6int_26frac;
573 573
574 volume_control_t src_vol_ctrl; 574 struct dsp_volume_control src_vol_ctrl;
575} src_task_scb_t; 575};
576 576
577typedef struct _decimate_by_pow2_scb_t { 577struct dsp_decimate_by_pow2_scb {
578 /* decimationFactor = 2, 4, or 8 (larger factors waste too much memory 578 /* decimationFactor = 2, 4, or 8 (larger factors waste too much memory
579 when compared to cascading decimators) 579 when compared to cascading decimators)
580 */ 580 */
@@ -648,10 +648,10 @@ typedef struct _decimate_by_pow2_scb_t {
648 648
649 u32 dec2_reserved4; 649 u32 dec2_reserved4;
650 650
651 volume_control_t dec2_vol_ctrl; /* Not used! */ 651 struct dsp_volume_control dec2_vol_ctrl; /* Not used! */
652} decimate_by_pow2_scb_t; 652};
653 653
654typedef struct _vari_decimate_scb_t { 654struct dsp_vari_decimate_scb {
655 ___DSP_DUAL_16BIT_ALLOC( 655 ___DSP_DUAL_16BIT_ALLOC(
656 vdec_frames_left_in_gof, 656 vdec_frames_left_in_gof,
657 vdec_gofs_left_in_sec 657 vdec_gofs_left_in_sec
@@ -711,15 +711,15 @@ typedef struct _vari_decimate_scb_t {
711 711
712 u32 vdec_phi_incr_6int_26frac; 712 u32 vdec_phi_incr_6int_26frac;
713 713
714 volume_control_t vdec_vol_ctrl; 714 struct dsp_volume_control vdec_vol_ctrl;
715} vari_decimate_scb_t; 715};
716 716
717 717
718/* SCB for MIX_TO_OSTREAM algorithm family */ 718/* SCB for MIX_TO_OSTREAM algorithm family */
719typedef struct _mix2_ostream_scb_t { 719struct dsp_mix2_ostream_scb {
720 /* First 13 dwords from generic_scb_t */ 720 /* First 13 dwords from generic_scb_t */
721 basic_dma_req_t basic_req; /* Optional */ 721 struct dsp_basic_dma_req basic_req; /* Optional */
722 scatter_gather_ext_t sg_ext; /* Optional */ 722 struct dsp_scatter_gather_ext sg_ext; /* Optional */
723 ___DSP_DUAL_16BIT_ALLOC( 723 ___DSP_DUAL_16BIT_ALLOC(
724 next_scb, /* REQUIRED */ 724 next_scb, /* REQUIRED */
725 sub_list_ptr /* REQUIRED */ 725 sub_list_ptr /* REQUIRED */
@@ -758,14 +758,14 @@ typedef struct _mix2_ostream_scb_t {
758 const_FFFF, 758 const_FFFF,
759 const_zero 759 const_zero
760 ) 760 )
761} mix2_ostream_scb_t; 761};
762 762
763 763
764/* SCB for S16_MIX algorithm */ 764/* SCB for S16_MIX algorithm */
765typedef struct _mix_only_scb_t { 765struct dsp_mix_only_scb {
766 /* First 13 dwords from generic_scb_t */ 766 /* First 13 dwords from generic_scb_t */
767 basic_dma_req_t basic_req; /* Optional */ 767 struct dsp_basic_dma_req basic_req; /* Optional */
768 scatter_gather_ext_t sg_ext; /* Optional */ 768 struct dsp_scatter_gather_ext sg_ext; /* Optional */
769 ___DSP_DUAL_16BIT_ALLOC( 769 ___DSP_DUAL_16BIT_ALLOC(
770 next_scb, /* REQUIRED */ 770 next_scb, /* REQUIRED */
771 sub_list_ptr /* REQUIRED */ 771 sub_list_ptr /* REQUIRED */
@@ -780,11 +780,11 @@ typedef struct _mix_only_scb_t {
780 u32 strm_buf_ptr; /* REQUIRED */ 780 u32 strm_buf_ptr; /* REQUIRED */
781 781
782 u32 reserved; 782 u32 reserved;
783 volume_control_t vol_ctrl; 783 struct dsp_volume_control vol_ctrl;
784} mix_only_scb_t; 784};
785 785
786/* SCB for the async. CODEC input algorithm */ 786/* SCB for the async. CODEC input algorithm */
787typedef struct _async_codec_input_scb_t { 787struct dsp_async_codec_input_scb {
788 u32 io_free2; 788 u32 io_free2;
789 789
790 u32 io_current_total; 790 u32 io_current_total;
@@ -837,11 +837,11 @@ typedef struct _async_codec_input_scb_t {
837 ) 837 )
838 838
839 u32 i_free; 839 u32 i_free;
840} async_codec_input_scb_t; 840};
841 841
842 842
843/* SCB for the SP/DIF CODEC input and output */ 843/* SCB for the SP/DIF CODEC input and output */
844typedef struct _spdifiscb_t { 844struct dsp_spdifiscb {
845 ___DSP_DUAL_16BIT_ALLOC( 845 ___DSP_DUAL_16BIT_ALLOC(
846 status_ptr, 846 status_ptr,
847 status_start_ptr 847 status_start_ptr
@@ -895,12 +895,11 @@ typedef struct _spdifiscb_t {
895 ) 895 )
896 896
897 u32 free1; 897 u32 free1;
898} spdifiscb_t; 898};
899 899
900 900
901/* SCB for the SP/DIF CODEC input and output */ 901/* SCB for the SP/DIF CODEC input and output */
902typedef struct _spdifoscb_t { 902struct dsp_spdifoscb {
903
904 903
905 u32 free2; 904 u32 free2;
906 905
@@ -941,11 +940,10 @@ typedef struct _spdifoscb_t {
941 ) 940 )
942 941
943 u32 free1; 942 u32 free1;
944} spdifoscb_t; 943};
945
946 944
947 945
948typedef struct _asynch_fg_rx_scb_t { 946struct dsp_asynch_fg_rx_scb {
949 ___DSP_DUAL_16BIT_ALLOC( 947 ___DSP_DUAL_16BIT_ALLOC(
950 bot_buf_mask, 948 bot_buf_mask,
951 buf_Mask 949 buf_Mask
@@ -993,11 +991,10 @@ typedef struct _asynch_fg_rx_scb_t {
993 right_vol, 991 right_vol,
994 left_vol 992 left_vol
995 ) 993 )
996} asynch_fg_rx_scb_t; 994};
997
998 995
999 996
1000typedef struct _asynch_fg_tx_scb_t { 997struct dsp_asynch_fg_tx_scb {
1001 ___DSP_DUAL_16BIT_ALLOC( 998 ___DSP_DUAL_16BIT_ALLOC(
1002 not_buf_mask, 999 not_buf_mask,
1003 buf_mask 1000 buf_mask
@@ -1052,13 +1049,13 @@ typedef struct _asynch_fg_tx_scb_t {
1052 unused_right_vol, 1049 unused_right_vol,
1053 unused_left_vol 1050 unused_left_vol
1054 ) 1051 )
1055} asynch_fg_tx_scb_t; 1052};
1056 1053
1057 1054
1058typedef struct _output_snoop_scb_t { 1055struct dsp_output_snoop_scb {
1059 /* First 13 dwords from generic_scb_t */ 1056 /* First 13 dwords from generic_scb_t */
1060 basic_dma_req_t basic_req; /* Optional */ 1057 struct dsp_basic_dma_req basic_req; /* Optional */
1061 scatter_gather_ext_t sg_ext; /* Optional */ 1058 struct dsp_scatter_gather_ext sg_ext; /* Optional */
1062 ___DSP_DUAL_16BIT_ALLOC( 1059 ___DSP_DUAL_16BIT_ALLOC(
1063 next_scb, /* REQUIRED */ 1060 next_scb, /* REQUIRED */
1064 sub_list_ptr /* REQUIRED */ 1061 sub_list_ptr /* REQUIRED */
@@ -1083,9 +1080,9 @@ typedef struct _output_snoop_scb_t {
1083 reserved, 1080 reserved,
1084 input_scb 1081 input_scb
1085 ) 1082 )
1086} output_snoop_scb_t; 1083};
1087 1084
1088typedef struct _spio_write_scb_t { 1085struct dsp_spio_write_scb {
1089 ___DSP_DUAL_16BIT_ALLOC( 1086 ___DSP_DUAL_16BIT_ALLOC(
1090 address1, 1087 address1,
1091 address2 1088 address2
@@ -1122,9 +1119,9 @@ typedef struct _spio_write_scb_t {
1122 ) 1119 )
1123 1120
1124 u32 unused3[5]; 1121 u32 unused3[5];
1125} spio_write_scb_t; 1122};
1126 1123
1127typedef struct _magic_snoop_task_t { 1124struct dsp_magic_snoop_task {
1128 u32 i0; 1125 u32 i0;
1129 u32 i1; 1126 u32 i1;
1130 1127
@@ -1155,11 +1152,11 @@ typedef struct _magic_snoop_task_t {
1155 1152
1156 u32 i8; 1153 u32 i8;
1157 1154
1158 volume_control_t vdec_vol_ctrl; 1155 struct dsp_volume_control vdec_vol_ctrl;
1159} magic_snoop_task_t; 1156};
1160 1157
1161 1158
1162typedef struct _filter_scb_t { 1159struct dsp_filter_scb {
1163 ___DSP_DUAL_16BIT_ALLOC( 1160 ___DSP_DUAL_16BIT_ALLOC(
1164 a0_right, /* 0x00 */ 1161 a0_right, /* 0x00 */
1165 a0_left 1162 a0_left
@@ -1212,5 +1209,5 @@ typedef struct _filter_scb_t {
1212 b2_right, /* 0x0F */ 1209 b2_right, /* 0x0F */
1213 b2_left 1210 b2_left
1214 ) 1211 )
1215} filter_scb_t; 1212};
1216#endif /* __DSP_SCB_TYPES_H__ */ 1213#endif /* __DSP_SCB_TYPES_H__ */
diff --git a/include/sound/cs46xx_dsp_spos.h b/include/sound/cs46xx_dsp_spos.h
index 10014cb62423..da934def31e9 100644
--- a/include/sound/cs46xx_dsp_spos.h
+++ b/include/sound/cs46xx_dsp_spos.h
@@ -65,133 +65,130 @@
65#define DSP_SPDIF_STATUS_HW_ENABLED 4 65#define DSP_SPDIF_STATUS_HW_ENABLED 4
66#define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED 8 66#define DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED 8
67 67
68struct _dsp_module_desc_t; 68struct dsp_symbol_entry {
69
70typedef struct _symbol_entry_t {
71 u32 address; 69 u32 address;
72 char symbol_name[DSP_MAX_SYMBOL_NAME]; 70 char symbol_name[DSP_MAX_SYMBOL_NAME];
73 int symbol_type; 71 int symbol_type;
74 72
75 /* initialized by driver */ 73 /* initialized by driver */
76 struct _dsp_module_desc_t * module; 74 struct dsp_module_desc * module;
77 int deleted; 75 int deleted;
78} symbol_entry_t; 76};
79 77
80typedef struct _symbol_desc_t { 78struct dsp_symbol_desc {
81 int nsymbols; 79 int nsymbols;
82 80
83 symbol_entry_t * symbols; 81 struct dsp_symbol_entry *symbols;
84 82
85 /* initialized by driver */ 83 /* initialized by driver */
86 int highest_frag_index; 84 int highest_frag_index;
87} symbol_desc_t; 85};
88
89 86
90typedef struct _segment_desc_t { 87struct dsp_segment_desc {
91 int segment_type; 88 int segment_type;
92 u32 offset; 89 u32 offset;
93 u32 size; 90 u32 size;
94 u32 * data; 91 u32 * data;
95} segment_desc_t; 92};
96 93
97typedef struct _dsp_module_desc_t { 94struct dsp_module_desc {
98 char * module_name; 95 char * module_name;
99 symbol_desc_t symbol_table; 96 struct dsp_symbol_desc symbol_table;
100 int nsegments; 97 int nsegments;
101 segment_desc_t * segments; 98 struct dsp_segment_desc * segments;
102 99
103 /* initialized by driver */ 100 /* initialized by driver */
104 u32 overlay_begin_address; 101 u32 overlay_begin_address;
105 u32 load_address; 102 u32 load_address;
106 int nfixups; 103 int nfixups;
107} dsp_module_desc_t; 104};
108 105
109typedef struct _dsp_scb_descriptor_t { 106struct dsp_scb_descriptor {
110 char scb_name[DSP_MAX_SCB_NAME]; 107 char scb_name[DSP_MAX_SCB_NAME];
111 u32 address; 108 u32 address;
112 int index; 109 int index;
113 110
114 struct _dsp_scb_descriptor_t * sub_list_ptr; 111 struct dsp_scb_descriptor * sub_list_ptr;
115 struct _dsp_scb_descriptor_t * next_scb_ptr; 112 struct dsp_scb_descriptor * next_scb_ptr;
116 struct _dsp_scb_descriptor_t * parent_scb_ptr; 113 struct dsp_scb_descriptor * parent_scb_ptr;
117 114
118 symbol_entry_t * task_entry; 115 struct dsp_symbol_entry * task_entry;
119 symbol_entry_t * scb_symbol; 116 struct dsp_symbol_entry * scb_symbol;
120 117
121 snd_info_entry_t *proc_info; 118 struct snd_info_entry *proc_info;
122 int ref_count; 119 int ref_count;
123 spinlock_t lock; 120 spinlock_t lock;
124 121
125 int deleted; 122 int deleted;
126} dsp_scb_descriptor_t; 123};
127 124
128typedef struct _dsp_task_descriptor_t { 125struct dsp_task_descriptor {
129 char task_name[DSP_MAX_TASK_NAME]; 126 char task_name[DSP_MAX_TASK_NAME];
130 int size; 127 int size;
131 u32 address; 128 u32 address;
132 int index; 129 int index;
133} dsp_task_descriptor_t; 130};
134 131
135typedef struct _pcm_channel_descriptor_t { 132struct dsp_pcm_channel_descriptor {
136 int active; 133 int active;
137 int src_slot; 134 int src_slot;
138 int pcm_slot; 135 int pcm_slot;
139 u32 sample_rate; 136 u32 sample_rate;
140 u32 unlinked; 137 u32 unlinked;
141 dsp_scb_descriptor_t * pcm_reader_scb; 138 struct dsp_scb_descriptor * pcm_reader_scb;
142 dsp_scb_descriptor_t * src_scb; 139 struct dsp_scb_descriptor * src_scb;
143 dsp_scb_descriptor_t * mixer_scb; 140 struct dsp_scb_descriptor * mixer_scb;
144 141
145 void * private_data; 142 void * private_data;
146} pcm_channel_descriptor_t; 143};
147 144
148typedef struct _dsp_spos_instance_t { 145struct dsp_spos_instance {
149 symbol_desc_t symbol_table; /* currently availble loaded symbols in SP */ 146 struct dsp_symbol_desc symbol_table; /* currently availble loaded symbols in SP */
150 147
151 int nmodules; 148 int nmodules;
152 dsp_module_desc_t * modules; /* modules loaded into SP */ 149 struct dsp_module_desc * modules; /* modules loaded into SP */
153 150
154 segment_desc_t code; 151 struct dsp_segment_desc code;
155 152
156 /* Main PCM playback mixer */ 153 /* Main PCM playback mixer */
157 dsp_scb_descriptor_t * master_mix_scb; 154 struct dsp_scb_descriptor * master_mix_scb;
158 u16 dac_volume_right; 155 u16 dac_volume_right;
159 u16 dac_volume_left; 156 u16 dac_volume_left;
160 157
161 /* Rear/surround PCM playback mixer */ 158 /* Rear/surround PCM playback mixer */
162 dsp_scb_descriptor_t * rear_mix_scb; 159 struct dsp_scb_descriptor * rear_mix_scb;
163 160
164 /* Center/LFE mixer */ 161 /* Center/LFE mixer */
165 dsp_scb_descriptor_t * center_lfe_mix_scb; 162 struct dsp_scb_descriptor * center_lfe_mix_scb;
166 163
167 int npcm_channels; 164 int npcm_channels;
168 int nsrc_scb; 165 int nsrc_scb;
169 pcm_channel_descriptor_t pcm_channels[DSP_MAX_PCM_CHANNELS]; 166 struct dsp_pcm_channel_descriptor pcm_channels[DSP_MAX_PCM_CHANNELS];
170 int src_scb_slots[DSP_MAX_SRC_NR]; 167 int src_scb_slots[DSP_MAX_SRC_NR];
171 168
172 /* cache this symbols */ 169 /* cache this symbols */
173 symbol_entry_t * null_algorithm; /* used by PCMreaderSCB's */ 170 struct dsp_symbol_entry * null_algorithm; /* used by PCMreaderSCB's */
174 symbol_entry_t * s16_up; /* used by SRCtaskSCB's */ 171 struct dsp_symbol_entry * s16_up; /* used by SRCtaskSCB's */
175 172
176 /* proc fs */ 173 /* proc fs */
177 snd_card_t * snd_card; 174 struct snd_card *snd_card;
178 snd_info_entry_t * proc_dsp_dir; 175 struct snd_info_entry * proc_dsp_dir;
179 snd_info_entry_t * proc_sym_info_entry; 176 struct snd_info_entry * proc_sym_info_entry;
180 snd_info_entry_t * proc_modules_info_entry; 177 struct snd_info_entry * proc_modules_info_entry;
181 snd_info_entry_t * proc_parameter_dump_info_entry; 178 struct snd_info_entry * proc_parameter_dump_info_entry;
182 snd_info_entry_t * proc_sample_dump_info_entry; 179 struct snd_info_entry * proc_sample_dump_info_entry;
183 180
184 /* SCB's descriptors */ 181 /* SCB's descriptors */
185 int nscb; 182 int nscb;
186 int scb_highest_frag_index; 183 int scb_highest_frag_index;
187 dsp_scb_descriptor_t scbs[DSP_MAX_SCB_DESC]; 184 struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC];
188 snd_info_entry_t * proc_scb_info_entry; 185 struct snd_info_entry * proc_scb_info_entry;
189 dsp_scb_descriptor_t * the_null_scb; 186 struct dsp_scb_descriptor * the_null_scb;
190 187
191 /* Task's descriptors */ 188 /* Task's descriptors */
192 int ntask; 189 int ntask;
193 dsp_task_descriptor_t tasks[DSP_MAX_TASK_DESC]; 190 struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC];
194 snd_info_entry_t * proc_task_info_entry; 191 struct snd_info_entry * proc_task_info_entry;
195 192
196 /* SPDIF status */ 193 /* SPDIF status */
197 int spdif_status_out; 194 int spdif_status_out;
@@ -204,30 +201,30 @@ typedef struct _dsp_spos_instance_t {
204 unsigned int spdif_csuv_stream; 201 unsigned int spdif_csuv_stream;
205 202
206 /* SPDIF input sample rate converter */ 203 /* SPDIF input sample rate converter */
207 dsp_scb_descriptor_t * spdif_in_src; 204 struct dsp_scb_descriptor * spdif_in_src;
208 /* SPDIF input asynch. receiver */ 205 /* SPDIF input asynch. receiver */
209 dsp_scb_descriptor_t * asynch_rx_scb; 206 struct dsp_scb_descriptor * asynch_rx_scb;
210 207
211 /* Capture record mixer SCB */ 208 /* Capture record mixer SCB */
212 dsp_scb_descriptor_t * record_mixer_scb; 209 struct dsp_scb_descriptor * record_mixer_scb;
213 210
214 /* CODEC input SCB */ 211 /* CODEC input SCB */
215 dsp_scb_descriptor_t * codec_in_scb; 212 struct dsp_scb_descriptor * codec_in_scb;
216 213
217 /* reference snooper */ 214 /* reference snooper */
218 dsp_scb_descriptor_t * ref_snoop_scb; 215 struct dsp_scb_descriptor * ref_snoop_scb;
219 216
220 /* SPDIF output PCM reference */ 217 /* SPDIF output PCM reference */
221 dsp_scb_descriptor_t * spdif_pcm_input_scb; 218 struct dsp_scb_descriptor * spdif_pcm_input_scb;
222 219
223 /* asynch TX task */ 220 /* asynch TX task */
224 dsp_scb_descriptor_t * asynch_tx_scb; 221 struct dsp_scb_descriptor * asynch_tx_scb;
225 222
226 /* record sources */ 223 /* record sources */
227 dsp_scb_descriptor_t * pcm_input; 224 struct dsp_scb_descriptor * pcm_input;
228 dsp_scb_descriptor_t * adc_input; 225 struct dsp_scb_descriptor * adc_input;
229 226
230 int spdif_in_sample_rate; 227 int spdif_in_sample_rate;
231} dsp_spos_instance_t; 228};
232 229
233#endif /* __DSP_SPOS_H__ */ 230#endif /* __DSP_SPOS_H__ */
diff --git a/include/sound/cs46xx_dsp_task_types.h b/include/sound/cs46xx_dsp_task_types.h
index 5dd3bf69cb03..b3076c487de6 100644
--- a/include/sound/cs46xx_dsp_task_types.h
+++ b/include/sound/cs46xx_dsp_task_types.h
@@ -71,7 +71,7 @@ Ptr____Call (c)
71 at the end of BG */ 71 at the end of BG */
72 72
73/* Minimal context save area for Hyper Forground */ 73/* Minimal context save area for Hyper Forground */
74typedef struct _hf_save_area_t { 74struct dsp_hf_save_area {
75 u32 r10_save; 75 u32 r10_save;
76 u32 r54_save; 76 u32 r54_save;
77 u32 r98_save; 77 u32 r98_save;
@@ -96,11 +96,11 @@ typedef struct _hf_save_area_t {
96 rsa2Save 96 rsa2Save
97 ) 97 )
98 /* saved as part of HFG context */ 98 /* saved as part of HFG context */
99} hf_save_area_t; 99};
100 100
101 101
102/* Task link data structure */ 102/* Task link data structure */
103typedef struct _tree_link_t { 103struct dsp_tree_link {
104 ___DSP_DUAL_16BIT_ALLOC( 104 ___DSP_DUAL_16BIT_ALLOC(
105 /* Pointer to sibling task control block */ 105 /* Pointer to sibling task control block */
106 next_scb, 106 next_scb,
@@ -114,10 +114,10 @@ typedef struct _tree_link_t {
114 /* Pointer to local data */ 114 /* Pointer to local data */
115 this_spb 115 this_spb
116 ) 116 )
117} tree_link_t; 117};
118 118
119 119
120typedef struct _task_tree_data_t { 120struct dsp_task_tree_data {
121 ___DSP_DUAL_16BIT_ALLOC( 121 ___DSP_DUAL_16BIT_ALLOC(
122 /* Initial tock count; controls task tree execution rate */ 122 /* Initial tock count; controls task tree execution rate */
123 tock_count_limit, 123 tock_count_limit,
@@ -155,11 +155,10 @@ typedef struct _task_tree_data_t {
155 data_stack_base_ptr 155 data_stack_base_ptr
156 ) 156 )
157 157
158} task_tree_data_t; 158};
159 159
160 160
161 161struct dsp_interval_timer_data
162typedef struct _interval_timer_data_t
163{ 162{
164 /* These data items have the same relative locations to those */ 163 /* These data items have the same relative locations to those */
165 ___DSP_DUAL_16BIT_ALLOC( 164 ___DSP_DUAL_16BIT_ALLOC(
@@ -172,12 +171,12 @@ typedef struct _interval_timer_data_t
172 num_FG_ticks_this_interval, 171 num_FG_ticks_this_interval,
173 num_intervals 172 num_intervals
174 ) 173 )
175} interval_timer_data_t; 174};
176 175
177 176
178/* This structure contains extra storage for the task tree 177/* This structure contains extra storage for the task tree
179 Currently, this additional data is related only to a full context save */ 178 Currently, this additional data is related only to a full context save */
180typedef struct _task_tree_context_block_t { 179struct dsp_task_tree_context_block {
181 /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for 180 /* Up to 10 values are saved onto the stack. 8 for the task tree, 1 for
182 The access to the context switch (call or interrupt), and 1 spare that 181 The access to the context switch (call or interrupt), and 1 spare that
183 users should never use. This last may be required by the system */ 182 users should never use. This last may be required by the system */
@@ -238,16 +237,16 @@ typedef struct _task_tree_context_block_t {
238 u32 saveaux2xaux3x; 237 u32 saveaux2xaux3x;
239 u32 savershouthl; 238 u32 savershouthl;
240 u32 savershoutxmacmode; 239 u32 savershoutxmacmode;
241} task_tree_context_block_t; 240};
242 241
243 242
244typedef struct _task_tree_control_block_t { 243struct dsp_task_tree_control_block {
245 hf_save_area_t context; 244 struct dsp_hf_save_area context;
246 tree_link_t links; 245 struct dsp_tree_link links;
247 task_tree_data_t data; 246 struct dsp_task_tree_data data;
248 task_tree_context_block_t context_blk; 247 struct dsp_task_tree_context_block context_blk;
249 interval_timer_data_t int_timer; 248 struct dsp_interval_timer_data int_timer;
250} task_tree_control_block_t; 249};
251 250
252 251
253#endif /* __DSP_TASK_TYPES_H__ */ 252#endif /* __DSP_TASK_TYPES_H__ */
diff --git a/include/sound/cs8403.h b/include/sound/cs8403.h
index 0b7d216e24f1..c6c3f9f0da78 100644
--- a/include/sound/cs8403.h
+++ b/include/sound/cs8403.h
@@ -36,7 +36,7 @@
36#endif 36#endif
37 37
38 38
39SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bits) 39SND_CS8403_DECL void SND_CS8403_DECODE(struct snd_aes_iec958 *diga, unsigned char bits)
40{ 40{
41 if (bits & 0x01) { /* consumer */ 41 if (bits & 0x01) { /* consumer */
42 if (!(bits & 0x02)) 42 if (!(bits & 0x02))
@@ -79,7 +79,7 @@ SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bit
79 } 79 }
80} 80}
81 81
82SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga) 82SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(struct snd_aes_iec958 *diga)
83{ 83{
84 unsigned char bits; 84 unsigned char bits;
85 85
@@ -166,7 +166,7 @@ SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga)
166#endif 166#endif
167 167
168 168
169SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bits) 169SND_CS8404_DECL void SND_CS8404_DECODE(struct snd_aes_iec958 *diga, unsigned char bits)
170{ 170{
171 if (bits & 0x10) { /* consumer */ 171 if (bits & 0x10) { /* consumer */
172 if (!(bits & 0x20)) 172 if (!(bits & 0x20))
@@ -205,7 +205,7 @@ SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bit
205 } 205 }
206} 206}
207 207
208SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(snd_aes_iec958_t *diga) 208SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(struct snd_aes_iec958 *diga)
209{ 209{
210 unsigned char bits; 210 unsigned char bits;
211 211
diff --git a/include/sound/cs8427.h b/include/sound/cs8427.h
index e725b7049a53..97fd9acf8028 100644
--- a/include/sound/cs8427.h
+++ b/include/sound/cs8427.h
@@ -186,11 +186,16 @@
186#define CS8427_VERSHIFT 0 186#define CS8427_VERSHIFT 0
187#define CS8427_VER8427A 0x71 187#define CS8427_VER8427A 0x71
188 188
189int snd_cs8427_create(snd_i2c_bus_t *bus, unsigned char addr, 189struct snd_pcm_substream;
190 unsigned int reset_timeout, snd_i2c_device_t **r_cs8427); 190
191int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned char val); 191int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr,
192int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, snd_pcm_substream_t *playback_substream, snd_pcm_substream_t *capture_substream); 192 unsigned int reset_timeout, struct snd_i2c_device **r_cs8427);
193int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active); 193int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
194int snd_cs8427_iec958_pcm(snd_i2c_device_t *cs8427, unsigned int rate); 194 unsigned char val);
195int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427,
196 struct snd_pcm_substream *playback_substream,
197 struct snd_pcm_substream *capture_substream);
198int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active);
199int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate);
195 200
196#endif /* __SOUND_CS8427_H */ 201#endif /* __SOUND_CS8427_H */
diff --git a/include/sound/driver.h b/include/sound/driver.h
index 3f0416ac24d9..89c6a73f3920 100644
--- a/include/sound/driver.h
+++ b/include/sound/driver.h
@@ -28,7 +28,12 @@
28 28
29#include <linux/config.h> 29#include <linux/config.h>
30 30
31#define SNDRV_CARDS 8 /* number of supported soundcards - don't change - minor numbers */ 31/* number of supported soundcards */
32#ifdef CONFIG_SND_DYNAMIC_MINORS
33#define SNDRV_CARDS 32
34#else
35#define SNDRV_CARDS 8 /* don't change - minor numbers */
36#endif
32 37
33#ifndef CONFIG_SND_MAJOR /* standard configuration */ 38#ifndef CONFIG_SND_MAJOR /* standard configuration */
34#define CONFIG_SND_MAJOR 116 39#define CONFIG_SND_MAJOR 116
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 8411c7ef6f11..951e40d720d9 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -887,47 +887,45 @@
887 887
888/* ------------------- STRUCTURES -------------------- */ 888/* ------------------- STRUCTURES -------------------- */
889 889
890typedef struct _snd_emu10k1 emu10k1_t; 890enum {
891typedef struct _snd_emu10k1_voice emu10k1_voice_t;
892typedef struct _snd_emu10k1_pcm emu10k1_pcm_t;
893
894typedef enum {
895 EMU10K1_EFX, 891 EMU10K1_EFX,
896 EMU10K1_PCM, 892 EMU10K1_PCM,
897 EMU10K1_SYNTH, 893 EMU10K1_SYNTH,
898 EMU10K1_MIDI 894 EMU10K1_MIDI
899} emu10k1_voice_type_t; 895};
896
897struct snd_emu10k1;
900 898
901struct _snd_emu10k1_voice { 899struct snd_emu10k1_voice {
902 emu10k1_t *emu; 900 struct snd_emu10k1 *emu;
903 int number; 901 int number;
904 unsigned int use: 1, 902 unsigned int use: 1,
905 pcm: 1, 903 pcm: 1,
906 efx: 1, 904 efx: 1,
907 synth: 1, 905 synth: 1,
908 midi: 1; 906 midi: 1;
909 void (*interrupt)(emu10k1_t *emu, emu10k1_voice_t *pvoice); 907 void (*interrupt)(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
910 908
911 emu10k1_pcm_t *epcm; 909 struct snd_emu10k1_pcm *epcm;
912}; 910};
913 911
914typedef enum { 912enum {
915 PLAYBACK_EMUVOICE, 913 PLAYBACK_EMUVOICE,
916 PLAYBACK_EFX, 914 PLAYBACK_EFX,
917 CAPTURE_AC97ADC, 915 CAPTURE_AC97ADC,
918 CAPTURE_AC97MIC, 916 CAPTURE_AC97MIC,
919 CAPTURE_EFX 917 CAPTURE_EFX
920} snd_emu10k1_pcm_type_t; 918};
921 919
922struct _snd_emu10k1_pcm { 920struct snd_emu10k1_pcm {
923 emu10k1_t *emu; 921 struct snd_emu10k1 *emu;
924 snd_emu10k1_pcm_type_t type; 922 int type;
925 snd_pcm_substream_t *substream; 923 struct snd_pcm_substream *substream;
926 emu10k1_voice_t *voices[NUM_EFX_PLAYBACK]; 924 struct snd_emu10k1_voice *voices[NUM_EFX_PLAYBACK];
927 emu10k1_voice_t *extra; 925 struct snd_emu10k1_voice *extra;
928 unsigned short running; 926 unsigned short running;
929 unsigned short first_ptr; 927 unsigned short first_ptr;
930 snd_util_memblk_t *memblk; 928 struct snd_util_memblk *memblk;
931 unsigned int start_addr; 929 unsigned int start_addr;
932 unsigned int ccca_start_addr; 930 unsigned int ccca_start_addr;
933 unsigned int capture_ipr; /* interrupt acknowledge mask */ 931 unsigned int capture_ipr; /* interrupt acknowledge mask */
@@ -941,13 +939,13 @@ struct _snd_emu10k1_pcm {
941 unsigned int capture_bufsize; /* buffer size in bytes */ 939 unsigned int capture_bufsize; /* buffer size in bytes */
942}; 940};
943 941
944typedef struct { 942struct snd_emu10k1_pcm_mixer {
945 /* mono, left, right x 8 sends (4 on emu10k1) */ 943 /* mono, left, right x 8 sends (4 on emu10k1) */
946 unsigned char send_routing[3][8]; 944 unsigned char send_routing[3][8];
947 unsigned char send_volume[3][8]; 945 unsigned char send_volume[3][8];
948 unsigned short attn[3]; 946 unsigned short attn[3];
949 emu10k1_pcm_t *epcm; 947 struct snd_emu10k1_pcm *epcm;
950} emu10k1_pcm_mixer_t; 948};
951 949
952#define snd_emu10k1_compose_send_routing(route) \ 950#define snd_emu10k1_compose_send_routing(route) \
953((route[0] | (route[1] << 4) | (route[2] << 8) | (route[3] << 12)) << 16) 951((route[0] | (route[1] << 4) | (route[2] << 8) | (route[3] << 12)) << 16)
@@ -958,20 +956,20 @@ typedef struct {
958#define snd_emu10k1_compose_audigy_fxrt2(route) \ 956#define snd_emu10k1_compose_audigy_fxrt2(route) \
959((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24)) 957((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24))
960 958
961typedef struct snd_emu10k1_memblk { 959struct snd_emu10k1_memblk {
962 snd_util_memblk_t mem; 960 struct snd_util_memblk mem;
963 /* private part */ 961 /* private part */
964 int first_page, last_page, pages, mapped_page; 962 int first_page, last_page, pages, mapped_page;
965 unsigned int map_locked; 963 unsigned int map_locked;
966 struct list_head mapped_link; 964 struct list_head mapped_link;
967 struct list_head mapped_order_link; 965 struct list_head mapped_order_link;
968} emu10k1_memblk_t; 966};
969 967
970#define snd_emu10k1_memblk_offset(blk) (((blk)->mapped_page << PAGE_SHIFT) | ((blk)->mem.offset & (PAGE_SIZE - 1))) 968#define snd_emu10k1_memblk_offset(blk) (((blk)->mapped_page << PAGE_SHIFT) | ((blk)->mem.offset & (PAGE_SIZE - 1)))
971 969
972#define EMU10K1_MAX_TRAM_BLOCKS_PER_CODE 16 970#define EMU10K1_MAX_TRAM_BLOCKS_PER_CODE 16
973 971
974typedef struct { 972struct snd_emu10k1_fx8010_ctl {
975 struct list_head list; /* list link container */ 973 struct list_head list; /* list link container */
976 unsigned int vcount; 974 unsigned int vcount;
977 unsigned int count; /* count of GPR (1..16) */ 975 unsigned int count; /* count of GPR (1..16) */
@@ -980,19 +978,19 @@ typedef struct {
980 unsigned int min; /* minimum range */ 978 unsigned int min; /* minimum range */
981 unsigned int max; /* maximum range */ 979 unsigned int max; /* maximum range */
982 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 980 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
983 snd_kcontrol_t *kcontrol; 981 struct snd_kcontrol *kcontrol;
984} snd_emu10k1_fx8010_ctl_t; 982};
985 983
986typedef void (snd_fx8010_irq_handler_t)(emu10k1_t *emu, void *private_data); 984typedef void (snd_fx8010_irq_handler_t)(struct snd_emu10k1 *emu, void *private_data);
987 985
988typedef struct _snd_emu10k1_fx8010_irq { 986struct snd_emu10k1_fx8010_irq {
989 struct _snd_emu10k1_fx8010_irq *next; 987 struct snd_emu10k1_fx8010_irq *next;
990 snd_fx8010_irq_handler_t *handler; 988 snd_fx8010_irq_handler_t *handler;
991 unsigned short gpr_running; 989 unsigned short gpr_running;
992 void *private_data; 990 void *private_data;
993} snd_emu10k1_fx8010_irq_t; 991};
994 992
995typedef struct { 993struct snd_emu10k1_fx8010_pcm {
996 unsigned int valid: 1, 994 unsigned int valid: 1,
997 opened: 1, 995 opened: 1,
998 active: 1; 996 active: 1;
@@ -1006,13 +1004,13 @@ typedef struct {
1006 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */ 1004 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
1007 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */ 1005 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
1008 unsigned char etram[32]; /* external TRAM address & data */ 1006 unsigned char etram[32]; /* external TRAM address & data */
1009 snd_pcm_indirect_t pcm_rec; 1007 struct snd_pcm_indirect pcm_rec;
1010 unsigned int tram_pos; 1008 unsigned int tram_pos;
1011 unsigned int tram_shift; 1009 unsigned int tram_shift;
1012 snd_emu10k1_fx8010_irq_t *irq; 1010 struct snd_emu10k1_fx8010_irq *irq;
1013} snd_emu10k1_fx8010_pcm_t; 1011};
1014 1012
1015typedef struct { 1013struct snd_emu10k1_fx8010 {
1016 unsigned short fxbus_mask; /* used FX buses (bitmask) */ 1014 unsigned short fxbus_mask; /* used FX buses (bitmask) */
1017 unsigned short extin_mask; /* used external inputs (bitmask) */ 1015 unsigned short extin_mask; /* used external inputs (bitmask) */
1018 unsigned short extout_mask; /* used external outputs (bitmask) */ 1016 unsigned short extout_mask; /* used external outputs (bitmask) */
@@ -1025,18 +1023,18 @@ typedef struct {
1025 int gpr_count; /* count of used kcontrols */ 1023 int gpr_count; /* count of used kcontrols */
1026 struct list_head gpr_ctl; /* GPR controls */ 1024 struct list_head gpr_ctl; /* GPR controls */
1027 struct semaphore lock; 1025 struct semaphore lock;
1028 snd_emu10k1_fx8010_pcm_t pcm[8]; 1026 struct snd_emu10k1_fx8010_pcm pcm[8];
1029 spinlock_t irq_lock; 1027 spinlock_t irq_lock;
1030 snd_emu10k1_fx8010_irq_t *irq_handlers; 1028 struct snd_emu10k1_fx8010_irq *irq_handlers;
1031} snd_emu10k1_fx8010_t; 1029};
1032 1030
1033#define emu10k1_gpr_ctl(n) list_entry(n, snd_emu10k1_fx8010_ctl_t, list) 1031#define emu10k1_gpr_ctl(n) list_entry(n, struct snd_emu10k1_fx8010_ctl, list)
1034 1032
1035typedef struct { 1033struct snd_emu10k1_midi {
1036 struct _snd_emu10k1 *emu; 1034 struct snd_emu10k1 *emu;
1037 snd_rawmidi_t *rmidi; 1035 struct snd_rawmidi *rmidi;
1038 snd_rawmidi_substream_t *substream_input; 1036 struct snd_rawmidi_substream *substream_input;
1039 snd_rawmidi_substream_t *substream_output; 1037 struct snd_rawmidi_substream *substream_output;
1040 unsigned int midi_mode; 1038 unsigned int midi_mode;
1041 spinlock_t input_lock; 1039 spinlock_t input_lock;
1042 spinlock_t output_lock; 1040 spinlock_t output_lock;
@@ -1044,10 +1042,10 @@ typedef struct {
1044 int tx_enable, rx_enable; 1042 int tx_enable, rx_enable;
1045 int port; 1043 int port;
1046 int ipr_tx, ipr_rx; 1044 int ipr_tx, ipr_rx;
1047 void (*interrupt)(emu10k1_t *emu, unsigned int status); 1045 void (*interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1048} emu10k1_midi_t; 1046};
1049 1047
1050typedef struct { 1048struct snd_emu_chip_details {
1051 u32 vendor; 1049 u32 vendor;
1052 u32 device; 1050 u32 device;
1053 u32 subsystem; 1051 u32 subsystem;
@@ -1063,18 +1061,23 @@ typedef struct {
1063 unsigned char spdif_bug; /* Has Spdif phasing bug */ 1061 unsigned char spdif_bug; /* Has Spdif phasing bug */
1064 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */ 1062 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */
1065 unsigned char ecard; /* APS EEPROM */ 1063 unsigned char ecard; /* APS EEPROM */
1064 unsigned char emu1212m; /* EMU 1212m card */
1065 unsigned char spi_dac; /* SPI interface for DAC */
1066 unsigned char i2c_adc; /* I2C interface for ADC */
1066 const char *driver; 1067 const char *driver;
1067 const char *name; 1068 const char *name;
1068 const char *id; /* for backward compatibility - can be NULL if not needed */ 1069 const char *id; /* for backward compatibility - can be NULL if not needed */
1069} emu_chip_details_t; 1070};
1070 1071
1071struct _snd_emu10k1 { 1072struct snd_emu10k1 {
1072 int irq; 1073 int irq;
1073 1074
1074 unsigned long port; /* I/O port number */ 1075 unsigned long port; /* I/O port number */
1075 unsigned int tos_link: 1, /* tos link detected */ 1076 unsigned int tos_link: 1, /* tos link detected */
1076 rear_ac97: 1; /* rear channels are on AC'97 */ 1077 rear_ac97: 1, /* rear channels are on AC'97 */
1077 const emu_chip_details_t *card_capabilities; /* Contains profile of card capabilities */ 1078 enable_ir: 1;
1079 /* Contains profile of card capabilities */
1080 const struct snd_emu_chip_details *card_capabilities;
1078 unsigned int audigy; /* is Audigy? */ 1081 unsigned int audigy; /* is Audigy? */
1079 unsigned int revision; /* chip revision */ 1082 unsigned int revision; /* chip revision */
1080 unsigned int serial; /* serial number */ 1083 unsigned int serial; /* serial number */
@@ -1088,8 +1091,8 @@ struct _snd_emu10k1 {
1088 struct snd_dma_device p16v_dma_dev; 1091 struct snd_dma_device p16v_dma_dev;
1089 struct snd_dma_buffer p16v_buffer; 1092 struct snd_dma_buffer p16v_buffer;
1090 1093
1091 snd_util_memhdr_t *memhdr; /* page allocation list */ 1094 struct snd_util_memhdr *memhdr; /* page allocation list */
1092 emu10k1_memblk_t *reserved_page; /* reserved page */ 1095 struct snd_emu10k1_memblk *reserved_page; /* reserved page */
1093 1096
1094 struct list_head mapped_link_head; 1097 struct list_head mapped_link_head;
1095 struct list_head mapped_order_link_head; 1098 struct list_head mapped_order_link_head;
@@ -1099,142 +1102,169 @@ struct _snd_emu10k1 {
1099 1102
1100 unsigned int spdif_bits[3]; /* s/pdif out setup */ 1103 unsigned int spdif_bits[3]; /* s/pdif out setup */
1101 1104
1102 snd_emu10k1_fx8010_t fx8010; /* FX8010 info */ 1105 struct snd_emu10k1_fx8010 fx8010; /* FX8010 info */
1103 int gpr_base; 1106 int gpr_base;
1104 1107
1105 ac97_t *ac97; 1108 struct snd_ac97 *ac97;
1106 1109
1107 struct pci_dev *pci; 1110 struct pci_dev *pci;
1108 snd_card_t *card; 1111 struct snd_card *card;
1109 snd_pcm_t *pcm; 1112 struct snd_pcm *pcm;
1110 snd_pcm_t *pcm_mic; 1113 struct snd_pcm *pcm_mic;
1111 snd_pcm_t *pcm_efx; 1114 struct snd_pcm *pcm_efx;
1112 snd_pcm_t *pcm_p16v; 1115 struct snd_pcm *pcm_multi;
1116 struct snd_pcm *pcm_p16v;
1113 1117
1114 spinlock_t synth_lock; 1118 spinlock_t synth_lock;
1115 void *synth; 1119 void *synth;
1116 int (*get_synth_voice)(emu10k1_t *emu); 1120 int (*get_synth_voice)(struct snd_emu10k1 *emu);
1117 1121
1118 spinlock_t reg_lock; 1122 spinlock_t reg_lock;
1119 spinlock_t emu_lock; 1123 spinlock_t emu_lock;
1120 spinlock_t voice_lock; 1124 spinlock_t voice_lock;
1121 struct semaphore ptb_lock; 1125 struct semaphore ptb_lock;
1122 1126
1123 emu10k1_voice_t voices[NUM_G]; 1127 struct snd_emu10k1_voice voices[NUM_G];
1124 emu10k1_voice_t p16v_voices[4]; 1128 struct snd_emu10k1_voice p16v_voices[4];
1125 emu10k1_voice_t p16v_capture_voice; 1129 struct snd_emu10k1_voice p16v_capture_voice;
1126 int p16v_device_offset; 1130 int p16v_device_offset;
1127 u32 p16v_capture_source; 1131 u32 p16v_capture_source;
1128 u32 p16v_capture_channel; 1132 u32 p16v_capture_channel;
1129 emu10k1_pcm_mixer_t pcm_mixer[32]; 1133 struct snd_emu10k1_pcm_mixer pcm_mixer[32];
1130 emu10k1_pcm_mixer_t efx_pcm_mixer[NUM_EFX_PLAYBACK]; 1134 struct snd_emu10k1_pcm_mixer efx_pcm_mixer[NUM_EFX_PLAYBACK];
1131 snd_kcontrol_t *ctl_send_routing; 1135 struct snd_kcontrol *ctl_send_routing;
1132 snd_kcontrol_t *ctl_send_volume; 1136 struct snd_kcontrol *ctl_send_volume;
1133 snd_kcontrol_t *ctl_attn; 1137 struct snd_kcontrol *ctl_attn;
1134 snd_kcontrol_t *ctl_efx_send_routing; 1138 struct snd_kcontrol *ctl_efx_send_routing;
1135 snd_kcontrol_t *ctl_efx_send_volume; 1139 struct snd_kcontrol *ctl_efx_send_volume;
1136 snd_kcontrol_t *ctl_efx_attn; 1140 struct snd_kcontrol *ctl_efx_attn;
1137 1141
1138 void (*hwvol_interrupt)(emu10k1_t *emu, unsigned int status); 1142 void (*hwvol_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1139 void (*capture_interrupt)(emu10k1_t *emu, unsigned int status); 1143 void (*capture_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1140 void (*capture_mic_interrupt)(emu10k1_t *emu, unsigned int status); 1144 void (*capture_mic_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1141 void (*capture_efx_interrupt)(emu10k1_t *emu, unsigned int status); 1145 void (*capture_efx_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1142 void (*spdif_interrupt)(emu10k1_t *emu, unsigned int status); 1146 void (*spdif_interrupt)(struct snd_emu10k1 *emu, unsigned int status);
1143 void (*dsp_interrupt)(emu10k1_t *emu); 1147 void (*dsp_interrupt)(struct snd_emu10k1 *emu);
1144 1148
1145 snd_pcm_substream_t *pcm_capture_substream; 1149 struct snd_pcm_substream *pcm_capture_substream;
1146 snd_pcm_substream_t *pcm_capture_mic_substream; 1150 struct snd_pcm_substream *pcm_capture_mic_substream;
1147 snd_pcm_substream_t *pcm_capture_efx_substream; 1151 struct snd_pcm_substream *pcm_capture_efx_substream;
1148 snd_pcm_substream_t *pcm_playback_efx_substream; 1152 struct snd_pcm_substream *pcm_playback_efx_substream;
1149 1153
1150 snd_timer_t *timer; 1154 struct snd_timer *timer;
1151 1155
1152 emu10k1_midi_t midi; 1156 struct snd_emu10k1_midi midi;
1153 emu10k1_midi_t midi2; /* for audigy */ 1157 struct snd_emu10k1_midi midi2; /* for audigy */
1154 1158
1155 unsigned int efx_voices_mask[2]; 1159 unsigned int efx_voices_mask[2];
1156 unsigned int next_free_voice; 1160 unsigned int next_free_voice;
1161
1162#ifdef CONFIG_PM
1163 unsigned int *saved_ptr;
1164 unsigned int *saved_gpr;
1165 unsigned int *tram_val_saved;
1166 unsigned int *tram_addr_saved;
1167 unsigned int *saved_icode;
1168 unsigned int *p16v_saved;
1169 unsigned int saved_a_iocfg, saved_hcfg;
1170#endif
1171
1157}; 1172};
1158 1173
1159int snd_emu10k1_create(snd_card_t * card, 1174int snd_emu10k1_create(struct snd_card *card,
1160 struct pci_dev *pci, 1175 struct pci_dev *pci,
1161 unsigned short extin_mask, 1176 unsigned short extin_mask,
1162 unsigned short extout_mask, 1177 unsigned short extout_mask,
1163 long max_cache_bytes, 1178 long max_cache_bytes,
1164 int enable_ir, 1179 int enable_ir,
1165 uint subsystem, 1180 uint subsystem,
1166 emu10k1_t ** remu); 1181 struct snd_emu10k1 ** remu);
1167 1182
1168int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1183int snd_emu10k1_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1169int snd_emu10k1_pcm_mic(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1184int snd_emu10k1_pcm_mic(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1170int snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1185int snd_emu10k1_pcm_efx(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1171int snd_p16v_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1186int snd_p16v_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1172int snd_p16v_free(emu10k1_t * emu); 1187int snd_p16v_free(struct snd_emu10k1 * emu);
1173int snd_p16v_mixer(emu10k1_t * emu); 1188int snd_p16v_mixer(struct snd_emu10k1 * emu);
1174int snd_emu10k1_pcm_multi(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1189int snd_emu10k1_pcm_multi(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1175int snd_emu10k1_fx8010_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); 1190int snd_emu10k1_fx8010_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);
1176int snd_emu10k1_mixer(emu10k1_t * emu, int pcm_device, int multi_device); 1191int snd_emu10k1_mixer(struct snd_emu10k1 * emu, int pcm_device, int multi_device);
1177int snd_emu10k1_timer(emu10k1_t * emu, int device); 1192int snd_emu10k1_timer(struct snd_emu10k1 * emu, int device);
1178int snd_emu10k1_fx8010_new(emu10k1_t *emu, int device, snd_hwdep_t ** rhwdep); 1193int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct snd_hwdep ** rhwdep);
1179 1194
1180irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs); 1195irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs);
1181 1196
1182/* initialization */ 1197void snd_emu10k1_voice_init(struct snd_emu10k1 * emu, int voice);
1183void snd_emu10k1_voice_init(emu10k1_t * emu, int voice); 1198int snd_emu10k1_init_efx(struct snd_emu10k1 *emu);
1184int snd_emu10k1_init_efx(emu10k1_t *emu); 1199void snd_emu10k1_free_efx(struct snd_emu10k1 *emu);
1185void snd_emu10k1_free_efx(emu10k1_t *emu); 1200int snd_emu10k1_fx8010_tram_setup(struct snd_emu10k1 *emu, u32 size);
1186int snd_emu10k1_fx8010_tram_setup(emu10k1_t *emu, u32 size); 1201int snd_emu10k1_done(struct snd_emu10k1 * emu);
1187 1202
1188/* I/O functions */ 1203/* I/O functions */
1189unsigned int snd_emu10k1_ptr_read(emu10k1_t * emu, unsigned int reg, unsigned int chn); 1204unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
1190void snd_emu10k1_ptr_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data); 1205void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
1191unsigned int snd_emu10k1_ptr20_read(emu10k1_t * emu, unsigned int reg, unsigned int chn); 1206unsigned int snd_emu10k1_ptr20_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
1192void snd_emu10k1_ptr20_write(emu10k1_t *emu, unsigned int reg, unsigned int chn, unsigned int data); 1207void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
1193unsigned int snd_emu10k1_efx_read(emu10k1_t *emu, unsigned int pc); 1208int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int data);
1194void snd_emu10k1_intr_enable(emu10k1_t *emu, unsigned int intrenb); 1209unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc);
1195void snd_emu10k1_intr_disable(emu10k1_t *emu, unsigned int intrenb); 1210void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb);
1196void snd_emu10k1_voice_intr_enable(emu10k1_t *emu, unsigned int voicenum); 1211void snd_emu10k1_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb);
1197void snd_emu10k1_voice_intr_disable(emu10k1_t *emu, unsigned int voicenum); 1212void snd_emu10k1_voice_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum);
1198void snd_emu10k1_voice_intr_ack(emu10k1_t *emu, unsigned int voicenum); 1213void snd_emu10k1_voice_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
1199void snd_emu10k1_voice_half_loop_intr_enable(emu10k1_t *emu, unsigned int voicenum); 1214void snd_emu10k1_voice_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
1200void snd_emu10k1_voice_half_loop_intr_disable(emu10k1_t *emu, unsigned int voicenum); 1215void snd_emu10k1_voice_half_loop_intr_enable(struct snd_emu10k1 *emu, unsigned int voicenum);
1201void snd_emu10k1_voice_half_loop_intr_ack(emu10k1_t *emu, unsigned int voicenum); 1216void snd_emu10k1_voice_half_loop_intr_disable(struct snd_emu10k1 *emu, unsigned int voicenum);
1202void snd_emu10k1_voice_set_loop_stop(emu10k1_t *emu, unsigned int voicenum); 1217void snd_emu10k1_voice_half_loop_intr_ack(struct snd_emu10k1 *emu, unsigned int voicenum);
1203void snd_emu10k1_voice_clear_loop_stop(emu10k1_t *emu, unsigned int voicenum); 1218void snd_emu10k1_voice_set_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
1204void snd_emu10k1_wait(emu10k1_t *emu, unsigned int wait); 1219void snd_emu10k1_voice_clear_loop_stop(struct snd_emu10k1 *emu, unsigned int voicenum);
1205static inline unsigned int snd_emu10k1_wc(emu10k1_t *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; } 1220void snd_emu10k1_wait(struct snd_emu10k1 *emu, unsigned int wait);
1206unsigned short snd_emu10k1_ac97_read(ac97_t *ac97, unsigned short reg); 1221static inline unsigned int snd_emu10k1_wc(struct snd_emu10k1 *emu) { return (inl(emu->port + WC) >> 6) & 0xfffff; }
1207void snd_emu10k1_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short data); 1222unsigned short snd_emu10k1_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
1223void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data);
1208unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); 1224unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate);
1209 1225
1226#ifdef CONFIG_PM
1227void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu);
1228void snd_emu10k1_resume_init(struct snd_emu10k1 *emu);
1229void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu);
1230int snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu);
1231void snd_emu10k1_efx_free_pm_buffer(struct snd_emu10k1 *emu);
1232void snd_emu10k1_efx_suspend(struct snd_emu10k1 *emu);
1233void snd_emu10k1_efx_resume(struct snd_emu10k1 *emu);
1234int snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu);
1235void snd_p16v_free_pm_buffer(struct snd_emu10k1 *emu);
1236void snd_p16v_suspend(struct snd_emu10k1 *emu);
1237void snd_p16v_resume(struct snd_emu10k1 *emu);
1238#endif
1239
1210/* memory allocation */ 1240/* memory allocation */
1211snd_util_memblk_t *snd_emu10k1_alloc_pages(emu10k1_t *emu, snd_pcm_substream_t *substream); 1241struct snd_util_memblk *snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *substream);
1212int snd_emu10k1_free_pages(emu10k1_t *emu, snd_util_memblk_t *blk); 1242int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk);
1213snd_util_memblk_t *snd_emu10k1_synth_alloc(emu10k1_t *emu, unsigned int size); 1243struct snd_util_memblk *snd_emu10k1_synth_alloc(struct snd_emu10k1 *emu, unsigned int size);
1214int snd_emu10k1_synth_free(emu10k1_t *emu, snd_util_memblk_t *blk); 1244int snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *blk);
1215int snd_emu10k1_synth_bzero(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, int size); 1245int snd_emu10k1_synth_bzero(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, int size);
1216int snd_emu10k1_synth_copy_from_user(emu10k1_t *emu, snd_util_memblk_t *blk, int offset, const char __user *data, int size); 1246int snd_emu10k1_synth_copy_from_user(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, int offset, const char __user *data, int size);
1217int snd_emu10k1_memblk_map(emu10k1_t *emu, emu10k1_memblk_t *blk); 1247int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk);
1218 1248
1219/* voice allocation */ 1249/* voice allocation */
1220int snd_emu10k1_voice_alloc(emu10k1_t *emu, emu10k1_voice_type_t type, int pair, emu10k1_voice_t **rvoice); 1250int snd_emu10k1_voice_alloc(struct snd_emu10k1 *emu, int type, int pair, struct snd_emu10k1_voice **rvoice);
1221int snd_emu10k1_voice_free(emu10k1_t *emu, emu10k1_voice_t *pvoice); 1251int snd_emu10k1_voice_free(struct snd_emu10k1 *emu, struct snd_emu10k1_voice *pvoice);
1222 1252
1223/* MIDI uart */ 1253/* MIDI uart */
1224int snd_emu10k1_midi(emu10k1_t * emu); 1254int snd_emu10k1_midi(struct snd_emu10k1 * emu);
1225int snd_emu10k1_audigy_midi(emu10k1_t * emu); 1255int snd_emu10k1_audigy_midi(struct snd_emu10k1 * emu);
1226 1256
1227/* proc interface */ 1257/* proc interface */
1228int snd_emu10k1_proc_init(emu10k1_t * emu); 1258int snd_emu10k1_proc_init(struct snd_emu10k1 * emu);
1229 1259
1230/* fx8010 irq handler */ 1260/* fx8010 irq handler */
1231int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu, 1261int snd_emu10k1_fx8010_register_irq_handler(struct snd_emu10k1 *emu,
1232 snd_fx8010_irq_handler_t *handler, 1262 snd_fx8010_irq_handler_t *handler,
1233 unsigned char gpr_running, 1263 unsigned char gpr_running,
1234 void *private_data, 1264 void *private_data,
1235 snd_emu10k1_fx8010_irq_t **r_irq); 1265 struct snd_emu10k1_fx8010_irq **r_irq);
1236int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu, 1266int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu,
1237 snd_emu10k1_fx8010_irq_t *irq); 1267 struct snd_emu10k1_fx8010_irq *irq);
1238 1268
1239#endif /* __KERNEL__ */ 1269#endif /* __KERNEL__ */
1240 1270
@@ -1469,14 +1499,14 @@ int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu,
1469#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */ 1499#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
1470#endif 1500#endif
1471 1501
1472typedef struct { 1502struct snd_emu10k1_fx8010_info {
1473 unsigned int internal_tram_size; /* in samples */ 1503 unsigned int internal_tram_size; /* in samples */
1474 unsigned int external_tram_size; /* in samples */ 1504 unsigned int external_tram_size; /* in samples */
1475 char fxbus_names[16][32]; /* names of FXBUSes */ 1505 char fxbus_names[16][32]; /* names of FXBUSes */
1476 char extin_names[16][32]; /* names of external inputs */ 1506 char extin_names[16][32]; /* names of external inputs */
1477 char extout_names[32][32]; /* names of external outputs */ 1507 char extout_names[32][32]; /* names of external outputs */
1478 unsigned int gpr_controls; /* count of GPR controls */ 1508 unsigned int gpr_controls; /* count of GPR controls */
1479} emu10k1_fx8010_info_t; 1509};
1480 1510
1481#define EMU10K1_GPR_TRANSLATION_NONE 0 1511#define EMU10K1_GPR_TRANSLATION_NONE 0
1482#define EMU10K1_GPR_TRANSLATION_TABLE100 1 1512#define EMU10K1_GPR_TRANSLATION_TABLE100 1
@@ -1484,8 +1514,8 @@ typedef struct {
1484#define EMU10K1_GPR_TRANSLATION_TREBLE 3 1514#define EMU10K1_GPR_TRANSLATION_TREBLE 3
1485#define EMU10K1_GPR_TRANSLATION_ONOFF 4 1515#define EMU10K1_GPR_TRANSLATION_ONOFF 4
1486 1516
1487typedef struct { 1517struct snd_emu10k1_fx8010_control_gpr {
1488 snd_ctl_elem_id_t id; /* full control ID definition */ 1518 struct snd_ctl_elem_id id; /* full control ID definition */
1489 unsigned int vcount; /* visible count */ 1519 unsigned int vcount; /* visible count */
1490 unsigned int count; /* count of GPR (1..16) */ 1520 unsigned int count; /* count of GPR (1..16) */
1491 unsigned short gpr[32]; /* GPR number(s) */ 1521 unsigned short gpr[32]; /* GPR number(s) */
@@ -1493,23 +1523,23 @@ typedef struct {
1493 unsigned int min; /* minimum range */ 1523 unsigned int min; /* minimum range */
1494 unsigned int max; /* maximum range */ 1524 unsigned int max; /* maximum range */
1495 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 1525 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
1496} emu10k1_fx8010_control_gpr_t; 1526};
1497 1527
1498typedef struct { 1528struct snd_emu10k1_fx8010_code {
1499 char name[128]; 1529 char name[128];
1500 1530
1501 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */ 1531 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
1502 u_int32_t __user *gpr_map; /* initializers */ 1532 u_int32_t __user *gpr_map; /* initializers */
1503 1533
1504 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */ 1534 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
1505 emu10k1_fx8010_control_gpr_t __user *gpr_add_controls; /* GPR controls to add/replace */ 1535 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */
1506 1536
1507 unsigned int gpr_del_control_count; /* count of GPR controls to remove */ 1537 unsigned int gpr_del_control_count; /* count of GPR controls to remove */
1508 snd_ctl_elem_id_t __user *gpr_del_controls; /* IDs of GPR controls to remove */ 1538 struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */
1509 1539
1510 unsigned int gpr_list_control_count; /* count of GPR controls to list */ 1540 unsigned int gpr_list_control_count; /* count of GPR controls to list */
1511 unsigned int gpr_list_control_total; /* total count of GPR controls */ 1541 unsigned int gpr_list_control_total; /* total count of GPR controls */
1512 emu10k1_fx8010_control_gpr_t __user *gpr_list_controls; /* listed GPR controls */ 1542 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */
1513 1543
1514 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */ 1544 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
1515 u_int32_t __user *tram_data_map; /* data initializers */ 1545 u_int32_t __user *tram_data_map; /* data initializers */
@@ -1517,16 +1547,16 @@ typedef struct {
1517 1547
1518 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */ 1548 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
1519 u_int32_t __user *code; /* one instruction - 64 bits */ 1549 u_int32_t __user *code; /* one instruction - 64 bits */
1520} emu10k1_fx8010_code_t; 1550};
1521 1551
1522typedef struct { 1552struct snd_emu10k1_fx8010_tram {
1523 unsigned int address; /* 31.bit == 1 -> external TRAM */ 1553 unsigned int address; /* 31.bit == 1 -> external TRAM */
1524 unsigned int size; /* size in samples (4 bytes) */ 1554 unsigned int size; /* size in samples (4 bytes) */
1525 unsigned int *samples; /* pointer to samples (20-bit) */ 1555 unsigned int *samples; /* pointer to samples (20-bit) */
1526 /* NULL->clear memory */ 1556 /* NULL->clear memory */
1527} emu10k1_fx8010_tram_t; 1557};
1528 1558
1529typedef struct { 1559struct snd_emu10k1_fx8010_pcm_rec {
1530 unsigned int substream; /* substream number */ 1560 unsigned int substream; /* substream number */
1531 unsigned int res1; /* reserved */ 1561 unsigned int res1; /* reserved */
1532 unsigned int channels; /* 16-bit channels count, zero = remove this substream */ 1562 unsigned int channels; /* 16-bit channels count, zero = remove this substream */
@@ -1541,20 +1571,27 @@ typedef struct {
1541 unsigned char pad; /* reserved */ 1571 unsigned char pad; /* reserved */
1542 unsigned char etram[32]; /* external TRAM address & data (one per channel) */ 1572 unsigned char etram[32]; /* external TRAM address & data (one per channel) */
1543 unsigned int res2; /* reserved */ 1573 unsigned int res2; /* reserved */
1544} emu10k1_fx8010_pcm_t; 1574};
1545 1575
1546#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, emu10k1_fx8010_info_t) 1576#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
1547#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, emu10k1_fx8010_code_t) 1577#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
1548#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, emu10k1_fx8010_code_t) 1578#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
1549#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int) 1579#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
1550#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, emu10k1_fx8010_tram_t) 1580#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
1551#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, emu10k1_fx8010_tram_t) 1581#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
1552#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, emu10k1_fx8010_pcm_t) 1582#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
1553#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, emu10k1_fx8010_pcm_t) 1583#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
1554#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) 1584#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
1555#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) 1585#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
1556#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) 1586#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
1557#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int) 1587#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
1558#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int) 1588#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
1559 1589
1590/* typedefs for compatibility to user-space */
1591typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
1592typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
1593typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
1594typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
1595typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
1596
1560#endif /* __SOUND_EMU10K1_H */ 1597#endif /* __SOUND_EMU10K1_H */
diff --git a/include/sound/emu10k1_synth.h b/include/sound/emu10k1_synth.h
index df0df1d09552..6ef61c420935 100644
--- a/include/sound/emu10k1_synth.h
+++ b/include/sound/emu10k1_synth.h
@@ -27,12 +27,12 @@
27#define SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH "emu10k1-synth" 27#define SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH "emu10k1-synth"
28 28
29/* argument for snd_seq_device_new */ 29/* argument for snd_seq_device_new */
30typedef struct snd_emu10k1_synth_arg { 30struct snd_emu10k1_synth_arg {
31 emu10k1_t *hwptr; /* chip */ 31 struct snd_emu10k1 *hwptr; /* chip */
32 int index; /* sequencer client index */ 32 int index; /* sequencer client index */
33 int seq_ports; /* number of sequencer ports to be created */ 33 int seq_ports; /* number of sequencer ports to be created */
34 int max_voices; /* maximum number of voices for wavetable */ 34 int max_voices; /* maximum number of voices for wavetable */
35} snd_emu10k1_synth_arg_t; 35};
36 36
37#define EMU10K1_MAX_MEMSIZE (32 * 1024 * 1024) /* 32MB */ 37#define EMU10K1_MAX_MEMSIZE (32 * 1024 * 1024) /* 32MB */
38 38
diff --git a/include/sound/emu8000.h b/include/sound/emu8000.h
index 4362c54e09d0..c8f66bde6d95 100644
--- a/include/sound/emu8000.h
+++ b/include/sound/emu8000.h
@@ -56,9 +56,9 @@ enum {
56 * some of the channels may be used for other things so max_channels is 56 * some of the channels may be used for other things so max_channels is
57 * the number in use for wave voices. 57 * the number in use for wave voices.
58 */ 58 */
59typedef struct snd_emu8000 { 59struct snd_emu8000 {
60 60
61 snd_emux_t *emu; 61 struct snd_emux *emu;
62 62
63 int index; /* sequencer client index */ 63 int index; /* sequencer client index */
64 int seq_ports; /* number of sequencer ports */ 64 int seq_ports; /* number of sequencer ports */
@@ -77,44 +77,45 @@ typedef struct snd_emu8000 {
77 77
78 int dram_checked; 78 int dram_checked;
79 79
80 snd_card_t *card; /* The card that this belongs to */ 80 struct snd_card *card; /* The card that this belongs to */
81 81
82 int chorus_mode; 82 int chorus_mode;
83 int reverb_mode; 83 int reverb_mode;
84 int bass_level; 84 int bass_level;
85 int treble_level; 85 int treble_level;
86 86
87 snd_util_memhdr_t *memhdr; 87 struct snd_util_memhdr *memhdr;
88 88
89 spinlock_t control_lock; 89 spinlock_t control_lock;
90 snd_kcontrol_t *controls[EMU8000_NUM_CONTROLS]; 90 struct snd_kcontrol *controls[EMU8000_NUM_CONTROLS];
91 91
92 snd_pcm_t *pcm; /* pcm on emu8000 wavetable */ 92 struct snd_pcm *pcm; /* pcm on emu8000 wavetable */
93 93
94} emu8000_t; 94};
95 95
96/* sequencer device id */ 96/* sequencer device id */
97#define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth" 97#define SNDRV_SEQ_DEV_ID_EMU8000 "emu8000-synth"
98 98
99 99
100/* exported functions */ 100/* exported functions */
101int snd_emu8000_new(snd_card_t *card, int device, long port, int seq_ports, snd_seq_device_t **ret); 101int snd_emu8000_new(struct snd_card *card, int device, long port, int seq_ports,
102void snd_emu8000_poke(emu8000_t *emu, unsigned int port, unsigned int reg, 102 struct snd_seq_device **ret);
103void snd_emu8000_poke(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
103 unsigned int val); 104 unsigned int val);
104unsigned short snd_emu8000_peek(emu8000_t *emu, unsigned int port, 105unsigned short snd_emu8000_peek(struct snd_emu8000 *emu, unsigned int port,
105 unsigned int reg); 106 unsigned int reg);
106void snd_emu8000_poke_dw(emu8000_t *emu, unsigned int port, unsigned int reg, 107void snd_emu8000_poke_dw(struct snd_emu8000 *emu, unsigned int port, unsigned int reg,
107 unsigned int val); 108 unsigned int val);
108unsigned int snd_emu8000_peek_dw(emu8000_t *emu, unsigned int port, 109unsigned int snd_emu8000_peek_dw(struct snd_emu8000 *emu, unsigned int port,
109 unsigned int reg); 110 unsigned int reg);
110void snd_emu8000_dma_chan(emu8000_t *emu, int ch, int mode); 111void snd_emu8000_dma_chan(struct snd_emu8000 *emu, int ch, int mode);
111 112
112void snd_emu8000_init_fm(emu8000_t *emu); 113void snd_emu8000_init_fm(struct snd_emu8000 *emu);
113 114
114void snd_emu8000_update_chorus_mode(emu8000_t *emu); 115void snd_emu8000_update_chorus_mode(struct snd_emu8000 *emu);
115void snd_emu8000_update_reverb_mode(emu8000_t *emu); 116void snd_emu8000_update_reverb_mode(struct snd_emu8000 *emu);
116void snd_emu8000_update_equalizer(emu8000_t *emu); 117void snd_emu8000_update_equalizer(struct snd_emu8000 *emu);
117int snd_emu8000_load_chorus_fx(emu8000_t *emu, int mode, const void __user *buf, long len); 118int snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
118int snd_emu8000_load_reverb_fx(emu8000_t *emu, int mode, const void __user *buf, long len); 119int snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user *buf, long len);
119 120
120#endif /* __SOUND_EMU8000_H */ 121#endif /* __SOUND_EMU8000_H */
diff --git a/include/sound/emux_synth.h b/include/sound/emux_synth.h
index c6970aac9bdc..b2d6b2acc7c7 100644
--- a/include/sound/emux_synth.h
+++ b/include/sound/emux_synth.h
@@ -36,39 +36,40 @@
36 */ 36 */
37#define SNDRV_EMUX_USE_RAW_EFFECT 37#define SNDRV_EMUX_USE_RAW_EFFECT
38 38
39 39struct snd_emux;
40/* 40struct snd_emux_port;
41 * typedefs 41struct snd_emux_voice;
42 */ 42struct snd_emux_effect_table;
43typedef struct snd_emux_effect_table snd_emux_effect_table_t;
44typedef struct snd_emux_port snd_emux_port_t;
45typedef struct snd_emux_voice snd_emux_voice_t;
46typedef struct snd_emux snd_emux_t;
47
48 43
49/* 44/*
50 * operators 45 * operators
51 */ 46 */
52typedef struct snd_emux_operators { 47struct snd_emux_operators {
53 struct module *owner; 48 struct module *owner;
54 snd_emux_voice_t *(*get_voice)(snd_emux_t *emu, snd_emux_port_t *port); 49 struct snd_emux_voice *(*get_voice)(struct snd_emux *emu,
55 int (*prepare)(snd_emux_voice_t *vp); 50 struct snd_emux_port *port);
56 void (*trigger)(snd_emux_voice_t *vp); 51 int (*prepare)(struct snd_emux_voice *vp);
57 void (*release)(snd_emux_voice_t *vp); 52 void (*trigger)(struct snd_emux_voice *vp);
58 void (*update)(snd_emux_voice_t *vp, int update); 53 void (*release)(struct snd_emux_voice *vp);
59 void (*terminate)(snd_emux_voice_t *vp); 54 void (*update)(struct snd_emux_voice *vp, int update);
60 void (*free_voice)(snd_emux_voice_t *vp); 55 void (*terminate)(struct snd_emux_voice *vp);
61 void (*reset)(snd_emux_t *emu, int ch); 56 void (*free_voice)(struct snd_emux_voice *vp);
62 /* the first parameters are snd_emux_t */ 57 void (*reset)(struct snd_emux *emu, int ch);
63 int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count); 58 /* the first parameters are struct snd_emux */
64 int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr); 59 int (*sample_new)(struct snd_emux *emu, struct snd_sf_sample *sp,
65 void (*sample_reset)(snd_emux_t *emu); 60 struct snd_util_memhdr *hdr,
66 int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count); 61 const void __user *data, long count);
67 void (*sysex)(snd_emux_t *emu, char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 62 int (*sample_free)(struct snd_emux *emu, struct snd_sf_sample *sp,
63 struct snd_util_memhdr *hdr);
64 void (*sample_reset)(struct snd_emux *emu);
65 int (*load_fx)(struct snd_emux *emu, int type, int arg,
66 const void __user *data, long count);
67 void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed,
68 struct snd_midi_channel_set *chset);
68#ifdef CONFIG_SND_SEQUENCER_OSS 69#ifdef CONFIG_SND_SEQUENCER_OSS
69 int (*oss_ioctl)(snd_emux_t *emu, int cmd, int p1, int p2); 70 int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2);
70#endif 71#endif
71} snd_emux_operators_t; 72};
72 73
73 74
74/* 75/*
@@ -90,46 +91,46 @@ typedef struct snd_emux_operators {
90 */ 91 */
91struct snd_emux { 92struct snd_emux {
92 93
93 snd_card_t *card; /* assigned card */ 94 struct snd_card *card; /* assigned card */
94 95
95 /* following should be initialized before registration */ 96 /* following should be initialized before registration */
96 int max_voices; /* Number of voices */ 97 int max_voices; /* Number of voices */
97 int mem_size; /* memory size (in byte) */ 98 int mem_size; /* memory size (in byte) */
98 int num_ports; /* number of ports to be created */ 99 int num_ports; /* number of ports to be created */
99 int pitch_shift; /* pitch shift value (for Emu10k1) */ 100 int pitch_shift; /* pitch shift value (for Emu10k1) */
100 snd_emux_operators_t ops; /* operators */ 101 struct snd_emux_operators ops; /* operators */
101 void *hw; /* hardware */ 102 void *hw; /* hardware */
102 unsigned long flags; /* other conditions */ 103 unsigned long flags; /* other conditions */
103 int midi_ports; /* number of virtual midi devices */ 104 int midi_ports; /* number of virtual midi devices */
104 int midi_devidx; /* device offset of virtual midi */ 105 int midi_devidx; /* device offset of virtual midi */
105 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */ 106 unsigned int linear_panning: 1; /* panning is linear (sbawe = 1, emu10k1 = 0) */
106 int hwdep_idx; /* hwdep device index */ 107 int hwdep_idx; /* hwdep device index */
107 snd_hwdep_t *hwdep; /* hwdep device */ 108 struct snd_hwdep *hwdep; /* hwdep device */
108 109
109 /* private */ 110 /* private */
110 int num_voices; /* current number of voices */ 111 int num_voices; /* current number of voices */
111 snd_sf_list_t *sflist; /* root of SoundFont list */ 112 struct snd_sf_list *sflist; /* root of SoundFont list */
112 snd_emux_voice_t *voices; /* Voices (EMU 'channel') */ 113 struct snd_emux_voice *voices; /* Voices (EMU 'channel') */
113 int use_time; /* allocation counter */ 114 int use_time; /* allocation counter */
114 spinlock_t voice_lock; /* Lock for voice access */ 115 spinlock_t voice_lock; /* Lock for voice access */
115 struct semaphore register_mutex; 116 struct semaphore register_mutex;
116 int client; /* For the sequencer client */ 117 int client; /* For the sequencer client */
117 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */ 118 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */
118 snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS]; 119 struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS];
119 int used; /* use counter */ 120 int used; /* use counter */
120 char *name; /* name of the device (internal) */ 121 char *name; /* name of the device (internal) */
121 snd_rawmidi_t **vmidi; 122 struct snd_rawmidi **vmidi;
122 struct timer_list tlist; /* for pending note-offs */ 123 struct timer_list tlist; /* for pending note-offs */
123 int timer_active; 124 int timer_active;
124 125
125 snd_util_memhdr_t *memhdr; /* memory chunk information */ 126 struct snd_util_memhdr *memhdr; /* memory chunk information */
126 127
127#ifdef CONFIG_PROC_FS 128#ifdef CONFIG_PROC_FS
128 snd_info_entry_t *proc; 129 struct snd_info_entry *proc;
129#endif 130#endif
130 131
131#ifdef CONFIG_SND_SEQUENCER_OSS 132#ifdef CONFIG_SND_SEQUENCER_OSS
132 snd_seq_device_t *oss_synth; 133 struct snd_seq_device *oss_synth;
133#endif 134#endif
134}; 135};
135 136
@@ -139,18 +140,18 @@ struct snd_emux {
139 */ 140 */
140struct snd_emux_port { 141struct snd_emux_port {
141 142
142 snd_midi_channel_set_t chset; 143 struct snd_midi_channel_set chset;
143 snd_emux_t *emu; 144 struct snd_emux *emu;
144 145
145 char port_mode; /* operation mode */ 146 char port_mode; /* operation mode */
146 int volume_atten; /* emuX raw attenuation */ 147 int volume_atten; /* emuX raw attenuation */
147 unsigned long drum_flags; /* drum bitmaps */ 148 unsigned long drum_flags; /* drum bitmaps */
148 int ctrls[EMUX_MD_END]; /* control parameters */ 149 int ctrls[EMUX_MD_END]; /* control parameters */
149#ifdef SNDRV_EMUX_USE_RAW_EFFECT 150#ifdef SNDRV_EMUX_USE_RAW_EFFECT
150 snd_emux_effect_table_t *effect; 151 struct snd_emux_effect_table *effect;
151#endif 152#endif
152#ifdef CONFIG_SND_SEQUENCER_OSS 153#ifdef CONFIG_SND_SEQUENCER_OSS
153 snd_seq_oss_arg_t *oss_arg; 154 struct snd_seq_oss_arg *oss_arg;
154#endif 155#endif
155}; 156};
156 157
@@ -179,16 +180,16 @@ struct snd_emux_voice {
179 unsigned char key; 180 unsigned char key;
180 unsigned char velocity; /* Velocity of current note */ 181 unsigned char velocity; /* Velocity of current note */
181 182
182 snd_sf_zone_t *zone; /* Zone assigned to this note */ 183 struct snd_sf_zone *zone; /* Zone assigned to this note */
183 void *block; /* sample block pointer (optional) */ 184 void *block; /* sample block pointer (optional) */
184 snd_midi_channel_t *chan; /* Midi channel for this note */ 185 struct snd_midi_channel *chan; /* Midi channel for this note */
185 snd_emux_port_t *port; /* associated port */ 186 struct snd_emux_port *port; /* associated port */
186 snd_emux_t *emu; /* assigned root info */ 187 struct snd_emux *emu; /* assigned root info */
187 void *hw; /* hardware pointer (emu8000_t or emu10k1_t) */ 188 void *hw; /* hardware pointer (emu8000 or emu10k1) */
188 unsigned long ontime; /* jiffies at note triggered */ 189 unsigned long ontime; /* jiffies at note triggered */
189 190
190 /* Emu8k/Emu10k1 registers */ 191 /* Emu8k/Emu10k1 registers */
191 soundfont_voice_info_t reg; 192 struct soundfont_voice_info reg;
192 193
193 /* additional registers */ 194 /* additional registers */
194 int avol; /* volume attenuation */ 195 int avol; /* volume attenuation */
@@ -229,15 +230,15 @@ struct snd_emux_effect_table {
229/* 230/*
230 * prototypes - interface to Emu10k1 and Emu8k routines 231 * prototypes - interface to Emu10k1 and Emu8k routines
231 */ 232 */
232int snd_emux_new(snd_emux_t **remu); 233int snd_emux_new(struct snd_emux **remu);
233int snd_emux_register(snd_emux_t *emu, snd_card_t *card, int index, char *name); 234int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, char *name);
234int snd_emux_free(snd_emux_t *emu); 235int snd_emux_free(struct snd_emux *emu);
235 236
236/* 237/*
237 * exported functions 238 * exported functions
238 */ 239 */
239void snd_emux_terminate_all(snd_emux_t *emu); 240void snd_emux_terminate_all(struct snd_emux *emu);
240void snd_emux_lock_voice(snd_emux_t *emu, int voice); 241void snd_emux_lock_voice(struct snd_emux *emu, int voice);
241void snd_emux_unlock_voice(snd_emux_t *emu, int voice); 242void snd_emux_unlock_voice(struct snd_emux *emu, int voice);
242 243
243#endif /* __SOUND_EMUX_SYNTH_H */ 244#endif /* __SOUND_EMUX_SYNTH_H */
diff --git a/include/sound/es1688.h b/include/sound/es1688.h
index 604f495bc8b1..fc1c47dae3da 100644
--- a/include/sound/es1688.h
+++ b/include/sound/es1688.h
@@ -30,7 +30,7 @@
30#define ES1688_HW_688 0x0001 30#define ES1688_HW_688 0x0001
31#define ES1688_HW_1688 0x0002 31#define ES1688_HW_1688 0x0002
32 32
33struct _snd_es1688 { 33struct snd_es1688 {
34 unsigned long port; /* port of ESS chip */ 34 unsigned long port; /* port of ESS chip */
35 struct resource *res_port; 35 struct resource *res_port;
36 unsigned long mpu_port; /* MPU-401 port of ESS chip */ 36 unsigned long mpu_port; /* MPU-401 port of ESS chip */
@@ -44,17 +44,15 @@ struct _snd_es1688 {
44 unsigned char pad; 44 unsigned char pad;
45 unsigned int dma_size; 45 unsigned int dma_size;
46 46
47 snd_card_t *card; 47 struct snd_card *card;
48 snd_pcm_t *pcm; 48 struct snd_pcm *pcm;
49 snd_pcm_substream_t *playback_substream; 49 struct snd_pcm_substream *playback_substream;
50 snd_pcm_substream_t *capture_substream; 50 struct snd_pcm_substream *capture_substream;
51 51
52 spinlock_t reg_lock; 52 spinlock_t reg_lock;
53 spinlock_t mixer_lock; 53 spinlock_t mixer_lock;
54}; 54};
55 55
56typedef struct _snd_es1688 es1688_t;
57
58/* I/O ports */ 56/* I/O ports */
59 57
60#define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x) 58#define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x)
@@ -107,17 +105,17 @@ typedef struct _snd_es1688 es1688_t;
107 105
108 */ 106 */
109 107
110void snd_es1688_mixer_write(es1688_t *chip, unsigned char reg, unsigned char data); 108void snd_es1688_mixer_write(struct snd_es1688 *chip, unsigned char reg, unsigned char data);
111 109
112int snd_es1688_create(snd_card_t * card, 110int snd_es1688_create(struct snd_card *card,
113 unsigned long port, 111 unsigned long port,
114 unsigned long mpu_port, 112 unsigned long mpu_port,
115 int irq, 113 int irq,
116 int mpu_irq, 114 int mpu_irq,
117 int dma8, 115 int dma8,
118 unsigned short hardware, 116 unsigned short hardware,
119 es1688_t ** rchip); 117 struct snd_es1688 ** rchip);
120int snd_es1688_pcm(es1688_t *chip, int device, snd_pcm_t ** rpcm); 118int snd_es1688_pcm(struct snd_es1688 *chip, int device, struct snd_pcm ** rpcm);
121int snd_es1688_mixer(es1688_t *chip); 119int snd_es1688_mixer(struct snd_es1688 *chip);
122 120
123#endif /* __SOUND_ES1688_H */ 121#endif /* __SOUND_ES1688_H */
diff --git a/include/sound/gus.h b/include/sound/gus.h
index 7000d9d9199d..63da50fae773 100644
--- a/include/sound/gus.h
+++ b/include/sound/gus.h
@@ -49,32 +49,32 @@
49#define SNDRV_g_u_s_IRQSTAT (0x226-0x220) 49#define SNDRV_g_u_s_IRQSTAT (0x226-0x220)
50#define SNDRV_g_u_s_TIMERCNTRL (0x228-0x220) 50#define SNDRV_g_u_s_TIMERCNTRL (0x228-0x220)
51#define SNDRV_g_u_s_TIMERDATA (0x229-0x220) 51#define SNDRV_g_u_s_TIMERDATA (0x229-0x220)
52#define SNDRV_g_u_s_DRAM (0x327-0x220) 52#define SNDRV_g_u_s_DRAM (0x327-0x220)
53#define SNDRV_g_u_s_MIXCNTRLREG (0x220-0x220) 53#define SNDRV_g_u_s_MIXCNTRLREG (0x220-0x220)
54#define SNDRV_g_u_s_IRQDMACNTRLREG (0x22b-0x220) 54#define SNDRV_g_u_s_IRQDMACNTRLREG (0x22b-0x220)
55#define SNDRV_g_u_s_REGCNTRLS (0x22f-0x220) 55#define SNDRV_g_u_s_REGCNTRLS (0x22f-0x220)
56#define SNDRV_g_u_s_BOARDVERSION (0x726-0x220) 56#define SNDRV_g_u_s_BOARDVERSION (0x726-0x220)
57#define SNDRV_g_u_s_MIXCNTRLPORT (0x726-0x220) 57#define SNDRV_g_u_s_MIXCNTRLPORT (0x726-0x220)
58#define SNDRV_g_u_s_IVER (0x325-0x220) 58#define SNDRV_g_u_s_IVER (0x325-0x220)
59#define SNDRV_g_u_s_MIXDATAPORT (0x326-0x220) 59#define SNDRV_g_u_s_MIXDATAPORT (0x326-0x220)
60#define SNDRV_g_u_s_MAXCNTRLPORT (0x326-0x220) 60#define SNDRV_g_u_s_MAXCNTRLPORT (0x326-0x220)
61 61
62/* GF1 registers */ 62/* GF1 registers */
63 63
64/* global registers */ 64/* global registers */
65#define SNDRV_GF1_GB_ACTIVE_VOICES 0x0e 65#define SNDRV_GF1_GB_ACTIVE_VOICES 0x0e
66#define SNDRV_GF1_GB_VOICES_IRQ 0x0f 66#define SNDRV_GF1_GB_VOICES_IRQ 0x0f
67#define SNDRV_GF1_GB_GLOBAL_MODE 0x19 67#define SNDRV_GF1_GB_GLOBAL_MODE 0x19
68#define SNDRV_GF1_GW_LFO_BASE 0x1a 68#define SNDRV_GF1_GW_LFO_BASE 0x1a
69#define SNDRV_GF1_GB_VOICES_IRQ_READ 0x1f 69#define SNDRV_GF1_GB_VOICES_IRQ_READ 0x1f
70#define SNDRV_GF1_GB_DRAM_DMA_CONTROL 0x41 70#define SNDRV_GF1_GB_DRAM_DMA_CONTROL 0x41
71#define SNDRV_GF1_GW_DRAM_DMA_LOW 0x42 71#define SNDRV_GF1_GW_DRAM_DMA_LOW 0x42
72#define SNDRV_GF1_GW_DRAM_IO_LOW 0x43 72#define SNDRV_GF1_GW_DRAM_IO_LOW 0x43
73#define SNDRV_GF1_GB_DRAM_IO_HIGH 0x44 73#define SNDRV_GF1_GB_DRAM_IO_HIGH 0x44
74#define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL 0x45 74#define SNDRV_GF1_GB_SOUND_BLASTER_CONTROL 0x45
75#define SNDRV_GF1_GB_ADLIB_TIMER_1 0x46 75#define SNDRV_GF1_GB_ADLIB_TIMER_1 0x46
76#define SNDRV_GF1_GB_ADLIB_TIMER_2 0x47 76#define SNDRV_GF1_GB_ADLIB_TIMER_2 0x47
77#define SNDRV_GF1_GB_RECORD_RATE 0x48 77#define SNDRV_GF1_GB_RECORD_RATE 0x48
78#define SNDRV_GF1_GB_REC_DMA_CONTROL 0x49 78#define SNDRV_GF1_GB_REC_DMA_CONTROL 0x49
79#define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL 0x4b 79#define SNDRV_GF1_GB_JOYSTICK_DAC_LEVEL 0x4b
80#define SNDRV_GF1_GB_RESET 0x4c 80#define SNDRV_GF1_GB_RESET 0x4c
@@ -83,7 +83,7 @@
83#define SNDRV_GF1_GW_MEMORY_CONFIG 0x52 83#define SNDRV_GF1_GW_MEMORY_CONFIG 0x52
84#define SNDRV_GF1_GB_MEMORY_CONTROL 0x53 84#define SNDRV_GF1_GB_MEMORY_CONTROL 0x53
85#define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR 0x54 85#define SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR 0x54
86#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR 0x55 86#define SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR 0x55
87#define SNDRV_GF1_GW_FIFO_SIZE 0x56 87#define SNDRV_GF1_GW_FIFO_SIZE 0x56
88#define SNDRV_GF1_GW_INTERLEAVE 0x57 88#define SNDRV_GF1_GW_INTERLEAVE 0x57
89#define SNDRV_GF1_GB_COMPATIBILITY 0x59 89#define SNDRV_GF1_GB_COMPATIBILITY 0x59
@@ -100,39 +100,39 @@
100#define SNDRV_GF1_VA_START SNDRV_GF1_VW_START_HIGH 100#define SNDRV_GF1_VA_START SNDRV_GF1_VW_START_HIGH
101#define SNDRV_GF1_VW_END_HIGH 0x04 101#define SNDRV_GF1_VW_END_HIGH 0x04
102#define SNDRV_GF1_VW_END_LOW 0x05 102#define SNDRV_GF1_VW_END_LOW 0x05
103#define SNDRV_GF1_VA_END SNDRV_GF1_VW_END_HIGH 103#define SNDRV_GF1_VA_END SNDRV_GF1_VW_END_HIGH
104#define SNDRV_GF1_VB_VOLUME_RATE 0x06 104#define SNDRV_GF1_VB_VOLUME_RATE 0x06
105#define SNDRV_GF1_VB_VOLUME_START 0x07 105#define SNDRV_GF1_VB_VOLUME_START 0x07
106#define SNDRV_GF1_VB_VOLUME_END 0x08 106#define SNDRV_GF1_VB_VOLUME_END 0x08
107#define SNDRV_GF1_VW_VOLUME 0x09 107#define SNDRV_GF1_VW_VOLUME 0x09
108#define SNDRV_GF1_VW_CURRENT_HIGH 0x0a 108#define SNDRV_GF1_VW_CURRENT_HIGH 0x0a
109#define SNDRV_GF1_VW_CURRENT_LOW 0x0b 109#define SNDRV_GF1_VW_CURRENT_LOW 0x0b
110#define SNDRV_GF1_VA_CURRENT SNDRV_GF1_VW_CURRENT_HIGH 110#define SNDRV_GF1_VA_CURRENT SNDRV_GF1_VW_CURRENT_HIGH
111#define SNDRV_GF1_VB_PAN 0x0c 111#define SNDRV_GF1_VB_PAN 0x0c
112#define SNDRV_GF1_VW_OFFSET_RIGHT 0x0c 112#define SNDRV_GF1_VW_OFFSET_RIGHT 0x0c
113#define SNDRV_GF1_VB_VOLUME_CONTROL 0x0d 113#define SNDRV_GF1_VB_VOLUME_CONTROL 0x0d
114#define SNDRV_GF1_VB_UPPER_ADDRESS 0x10 114#define SNDRV_GF1_VB_UPPER_ADDRESS 0x10
115#define SNDRV_GF1_VW_EFFECT_HIGH 0x11 115#define SNDRV_GF1_VW_EFFECT_HIGH 0x11
116#define SNDRV_GF1_VW_EFFECT_LOW 0x12 116#define SNDRV_GF1_VW_EFFECT_LOW 0x12
117#define SNDRV_GF1_VA_EFFECT SNDRV_GF1_VW_EFFECT_HIGH 117#define SNDRV_GF1_VA_EFFECT SNDRV_GF1_VW_EFFECT_HIGH
118#define SNDRV_GF1_VW_OFFSET_LEFT 0x13 118#define SNDRV_GF1_VW_OFFSET_LEFT 0x13
119#define SNDRV_GF1_VB_ACCUMULATOR 0x14 119#define SNDRV_GF1_VB_ACCUMULATOR 0x14
120#define SNDRV_GF1_VB_MODE 0x15 120#define SNDRV_GF1_VB_MODE 0x15
121#define SNDRV_GF1_VW_EFFECT_VOLUME 0x16 121#define SNDRV_GF1_VW_EFFECT_VOLUME 0x16
122#define SNDRV_GF1_VB_FREQUENCY_LFO 0x17 122#define SNDRV_GF1_VB_FREQUENCY_LFO 0x17
123#define SNDRV_GF1_VB_VOLUME_LFO 0x18 123#define SNDRV_GF1_VB_VOLUME_LFO 0x18
124#define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL 0x1b 124#define SNDRV_GF1_VW_OFFSET_RIGHT_FINAL 0x1b
125#define SNDRV_GF1_VW_OFFSET_LEFT_FINAL 0x1c 125#define SNDRV_GF1_VW_OFFSET_LEFT_FINAL 0x1c
126#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL 0x1d 126#define SNDRV_GF1_VW_EFFECT_VOLUME_FINAL 0x1d
127 127
128/* ICS registers */ 128/* ICS registers */
129 129
130#define SNDRV_ICS_MIC_DEV 0 130#define SNDRV_ICS_MIC_DEV 0
131#define SNDRV_ICS_LINE_DEV 1 131#define SNDRV_ICS_LINE_DEV 1
132#define SNDRV_ICS_CD_DEV 2 132#define SNDRV_ICS_CD_DEV 2
133#define SNDRV_ICS_GF1_DEV 3 133#define SNDRV_ICS_GF1_DEV 3
134#define SNDRV_ICS_NONE_DEV 4 134#define SNDRV_ICS_NONE_DEV 4
135#define SNDRV_ICS_MASTER_DEV 5 135#define SNDRV_ICS_MASTER_DEV 5
136 136
137/* LFO */ 137/* LFO */
138 138
@@ -143,7 +143,7 @@
143 143
144#define SNDRV_GF1_DMA_UNSIGNED 0x80 144#define SNDRV_GF1_DMA_UNSIGNED 0x80
145#define SNDRV_GF1_DMA_16BIT 0x40 145#define SNDRV_GF1_DMA_16BIT 0x40
146#define SNDRV_GF1_DMA_IRQ 0x20 146#define SNDRV_GF1_DMA_IRQ 0x20
147#define SNDRV_GF1_DMA_WIDTH16 0x04 147#define SNDRV_GF1_DMA_WIDTH16 0x04
148#define SNDRV_GF1_DMA_READ 0x02 /* read from GUS's DRAM */ 148#define SNDRV_GF1_DMA_READ 0x02 /* read from GUS's DRAM */
149#define SNDRV_GF1_DMA_ENABLE 0x01 149#define SNDRV_GF1_DMA_ENABLE 0x01
@@ -159,7 +159,7 @@
159 159
160/* defines for memory manager */ 160/* defines for memory manager */
161 161
162#define SNDRV_GF1_MEM_BLOCK_16BIT 0x0001 162#define SNDRV_GF1_MEM_BLOCK_16BIT 0x0001
163 163
164#define SNDRV_GF1_MEM_OWNER_DRIVER 0x0001 164#define SNDRV_GF1_MEM_OWNER_DRIVER 0x0001
165#define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE 0x0002 165#define SNDRV_GF1_MEM_OWNER_WAVE_SIMPLE 0x0002
@@ -169,9 +169,9 @@
169/* constants for interrupt handlers */ 169/* constants for interrupt handlers */
170 170
171#define SNDRV_GF1_HANDLER_MIDI_OUT 0x00010000 171#define SNDRV_GF1_HANDLER_MIDI_OUT 0x00010000
172#define SNDRV_GF1_HANDLER_MIDI_IN 0x00020000 172#define SNDRV_GF1_HANDLER_MIDI_IN 0x00020000
173#define SNDRV_GF1_HANDLER_TIMER1 0x00040000 173#define SNDRV_GF1_HANDLER_TIMER1 0x00040000
174#define SNDRV_GF1_HANDLER_TIMER2 0x00080000 174#define SNDRV_GF1_HANDLER_TIMER2 0x00080000
175#define SNDRV_GF1_HANDLER_VOICE 0x00100000 175#define SNDRV_GF1_HANDLER_VOICE 0x00100000
176#define SNDRV_GF1_HANDLER_DMA_WRITE 0x00200000 176#define SNDRV_GF1_HANDLER_DMA_WRITE 0x00200000
177#define SNDRV_GF1_HANDLER_DMA_READ 0x00400000 177#define SNDRV_GF1_HANDLER_DMA_READ 0x00400000
@@ -183,17 +183,16 @@
183 183
184/* --- */ 184/* --- */
185 185
186struct _snd_gus_card; 186struct snd_gus_card;
187typedef struct _snd_gus_card snd_gus_card_t;
188 187
189/* GF1 specific structure */ 188/* GF1 specific structure */
190 189
191typedef struct _snd_gf1_bank_info { 190struct snd_gf1_bank_info {
192 unsigned int address; 191 unsigned int address;
193 unsigned int size; 192 unsigned int size;
194} snd_gf1_bank_info_t; 193};
195 194
196typedef struct _snd_gf1_mem_block { 195struct snd_gf1_mem_block {
197 unsigned short flags; /* flags - SNDRV_GF1_MEM_BLOCK_XXXX */ 196 unsigned short flags; /* flags - SNDRV_GF1_MEM_BLOCK_XXXX */
198 unsigned short owner; /* owner - SNDRV_GF1_MEM_OWNER_XXXX */ 197 unsigned short owner; /* owner - SNDRV_GF1_MEM_OWNER_XXXX */
199 unsigned int share; /* share count */ 198 unsigned int share; /* share count */
@@ -201,68 +200,68 @@ typedef struct _snd_gf1_mem_block {
201 unsigned int ptr; 200 unsigned int ptr;
202 unsigned int size; 201 unsigned int size;
203 char *name; 202 char *name;
204 struct _snd_gf1_mem_block *next; 203 struct snd_gf1_mem_block *next;
205 struct _snd_gf1_mem_block *prev; 204 struct snd_gf1_mem_block *prev;
206} snd_gf1_mem_block_t; 205};
207 206
208typedef struct _snd_gf1_mem { 207struct snd_gf1_mem {
209 snd_gf1_bank_info_t banks_8[4]; 208 struct snd_gf1_bank_info banks_8[4];
210 snd_gf1_bank_info_t banks_16[4]; 209 struct snd_gf1_bank_info banks_16[4];
211 snd_gf1_mem_block_t *first; 210 struct snd_gf1_mem_block *first;
212 snd_gf1_mem_block_t *last; 211 struct snd_gf1_mem_block *last;
213 struct semaphore memory_mutex; 212 struct semaphore memory_mutex;
214} snd_gf1_mem_t; 213};
215 214
216typedef struct snd_gf1_dma_block { 215struct snd_gf1_dma_block {
217 void *buffer; /* buffer in computer's RAM */ 216 void *buffer; /* buffer in computer's RAM */
218 unsigned long buf_addr; /* buffer address */ 217 unsigned long buf_addr; /* buffer address */
219 unsigned int addr; /* address in onboard memory */ 218 unsigned int addr; /* address in onboard memory */
220 unsigned int count; /* count in bytes */ 219 unsigned int count; /* count in bytes */
221 unsigned int cmd; /* DMA command (format) */ 220 unsigned int cmd; /* DMA command (format) */
222 void (*ack)(snd_gus_card_t * gus, void *private_data); 221 void (*ack)(struct snd_gus_card * gus, void *private_data);
223 void *private_data; 222 void *private_data;
224 struct snd_gf1_dma_block *next; 223 struct snd_gf1_dma_block *next;
225} snd_gf1_dma_block_t; 224};
226 225
227typedef struct { 226struct snd_gus_port {
228 snd_midi_channel_set_t * chset; 227 struct snd_midi_channel_set * chset;
229 snd_gus_card_t * gus; 228 struct snd_gus_card * gus;
230 int mode; /* operation mode */ 229 int mode; /* operation mode */
231 int client; /* sequencer client number */ 230 int client; /* sequencer client number */
232 int port; /* sequencer port number */ 231 int port; /* sequencer port number */
233 unsigned int midi_has_voices: 1; 232 unsigned int midi_has_voices: 1;
234} snd_gus_port_t; 233};
235 234
236typedef struct _snd_gus_voice snd_gus_voice_t; 235struct snd_gus_voice;
237 236
238typedef struct { 237struct snd_gus_sample_ops {
239 void (*sample_start)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_position_t position); 238 void (*sample_start)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_position_t position);
240 void (*sample_stop)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_stop_mode_t mode); 239 void (*sample_stop)(struct snd_gus_card *gus, struct snd_gus_voice *voice, int mode);
241 void (*sample_freq)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_frequency_t freq); 240 void (*sample_freq)(struct snd_gus_card *gus, struct snd_gus_voice *voice, snd_seq_frequency_t freq);
242 void (*sample_volume)(snd_gus_card_t *gus, snd_gus_voice_t *voice, snd_seq_ev_volume_t *volume); 241 void (*sample_volume)(struct snd_gus_card *gus, struct snd_gus_voice *voice, struct snd_seq_ev_volume *volume);
243 void (*sample_loop)(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_ev_loop_t *loop); 242 void (*sample_loop)(struct snd_gus_card *card, struct snd_gus_voice *voice, struct snd_seq_ev_loop *loop);
244 void (*sample_pos)(snd_gus_card_t *card, snd_gus_voice_t *voice, snd_seq_position_t position); 243 void (*sample_pos)(struct snd_gus_card *card, struct snd_gus_voice *voice, snd_seq_position_t position);
245 void (*sample_private1)(snd_gus_card_t *card, snd_gus_voice_t *voice, unsigned char *data); 244 void (*sample_private1)(struct snd_gus_card *card, struct snd_gus_voice *voice, unsigned char *data);
246} snd_gus_sample_ops_t; 245};
247 246
248#define SNDRV_GF1_VOICE_TYPE_PCM 0 247#define SNDRV_GF1_VOICE_TYPE_PCM 0
249#define SNDRV_GF1_VOICE_TYPE_SYNTH 1 248#define SNDRV_GF1_VOICE_TYPE_SYNTH 1
250#define SNDRV_GF1_VOICE_TYPE_MIDI 2 249#define SNDRV_GF1_VOICE_TYPE_MIDI 2
251 250
252#define SNDRV_GF1_VFLG_RUNNING (1<<0) 251#define SNDRV_GF1_VFLG_RUNNING (1<<0)
253#define SNDRV_GF1_VFLG_EFFECT_TIMER1 (1<<1) 252#define SNDRV_GF1_VFLG_EFFECT_TIMER1 (1<<1)
254#define SNDRV_GF1_VFLG_PAN (1<<2) 253#define SNDRV_GF1_VFLG_PAN (1<<2)
255 254
256typedef enum { 255enum snd_gus_volume_state {
257 VENV_BEFORE, 256 VENV_BEFORE,
258 VENV_ATTACK, 257 VENV_ATTACK,
259 VENV_SUSTAIN, 258 VENV_SUSTAIN,
260 VENV_RELEASE, 259 VENV_RELEASE,
261 VENV_DONE, 260 VENV_DONE,
262 VENV_VOLUME 261 VENV_VOLUME
263} snd_gus_volume_state_t; 262};
264 263
265struct _snd_gus_voice { 264struct snd_gus_voice {
266 int number; 265 int number;
267 unsigned int use: 1, 266 unsigned int use: 1,
268 pcm: 1, 267 pcm: 1,
@@ -278,18 +277,18 @@ struct _snd_gus_voice {
278 unsigned int interrupt_stat_wave; 277 unsigned int interrupt_stat_wave;
279 unsigned int interrupt_stat_volume; 278 unsigned int interrupt_stat_volume;
280#endif 279#endif
281 void (*handler_wave) (snd_gus_card_t * gus, snd_gus_voice_t * voice); 280 void (*handler_wave) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
282 void (*handler_volume) (snd_gus_card_t * gus, snd_gus_voice_t * voice); 281 void (*handler_volume) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
283 void (*handler_effect) (snd_gus_card_t * gus, snd_gus_voice_t * voice); 282 void (*handler_effect) (struct snd_gus_card * gus, struct snd_gus_voice * voice);
284 void (*volume_change) (snd_gus_card_t * gus); 283 void (*volume_change) (struct snd_gus_card * gus);
285 284
286 snd_gus_sample_ops_t *sample_ops; 285 struct snd_gus_sample_ops *sample_ops;
287 286
288 snd_seq_instr_t instr; 287 struct snd_seq_instr instr;
289 288
290 /* running status / registers */ 289 /* running status / registers */
291 290
292 snd_seq_ev_volume_t sample_volume; 291 struct snd_seq_ev_volume sample_volume;
293 292
294 unsigned short fc_register; 293 unsigned short fc_register;
295 unsigned short fc_lfo; 294 unsigned short fc_lfo;
@@ -300,8 +299,8 @@ struct _snd_gus_voice {
300 unsigned char effect_accumulator; 299 unsigned char effect_accumulator;
301 unsigned char volume_control; 300 unsigned char volume_control;
302 unsigned char venv_value_next; 301 unsigned char venv_value_next;
303 snd_gus_volume_state_t venv_state; 302 enum snd_gus_volume_state venv_state;
304 snd_gus_volume_state_t venv_state_prev; 303 enum snd_gus_volume_state venv_state_prev;
305 unsigned short vlo; 304 unsigned short vlo;
306 unsigned short vro; 305 unsigned short vro;
307 unsigned short gf1_effect_volume; 306 unsigned short gf1_effect_volume;
@@ -309,10 +308,10 @@ struct _snd_gus_voice {
309 /* --- */ 308 /* --- */
310 309
311 void *private_data; 310 void *private_data;
312 void (*private_free)(snd_gus_voice_t *voice); 311 void (*private_free)(struct snd_gus_voice *voice);
313}; 312};
314 313
315struct _snd_gf1 { 314struct snd_gf1 {
316 315
317 unsigned int enh_mode:1, /* enhanced mode (GFA1) */ 316 unsigned int enh_mode:1, /* enhanced mode (GFA1) */
318 hw_lfo:1, /* use hardware LFO */ 317 hw_lfo:1, /* use hardware LFO */
@@ -330,7 +329,7 @@ struct _snd_gf1 {
330 unsigned int rom_present; /* bitmask */ 329 unsigned int rom_present; /* bitmask */
331 unsigned int rom_banks; /* GUS's ROM banks */ 330 unsigned int rom_banks; /* GUS's ROM banks */
332 331
333 snd_gf1_mem_t mem_alloc; 332 struct snd_gf1_mem mem_alloc;
334 333
335 /* registers */ 334 /* registers */
336 unsigned short reg_page; 335 unsigned short reg_page;
@@ -347,7 +346,7 @@ struct _snd_gf1 {
347 unsigned char active_voices; /* active voices */ 346 unsigned char active_voices; /* active voices */
348 unsigned char active_voice; /* selected voice (GF1PAGE register) */ 347 unsigned char active_voice; /* selected voice (GF1PAGE register) */
349 348
350 snd_gus_voice_t voices[32]; /* GF1 voices */ 349 struct snd_gus_voice voices[32]; /* GF1 voices */
351 350
352 unsigned int default_voice_address; 351 unsigned int default_voice_address;
353 352
@@ -362,12 +361,12 @@ struct _snd_gf1 {
362 361
363 /* interrupt handlers */ 362 /* interrupt handlers */
364 363
365 void (*interrupt_handler_midi_out) (snd_gus_card_t * gus); 364 void (*interrupt_handler_midi_out) (struct snd_gus_card * gus);
366 void (*interrupt_handler_midi_in) (snd_gus_card_t * gus); 365 void (*interrupt_handler_midi_in) (struct snd_gus_card * gus);
367 void (*interrupt_handler_timer1) (snd_gus_card_t * gus); 366 void (*interrupt_handler_timer1) (struct snd_gus_card * gus);
368 void (*interrupt_handler_timer2) (snd_gus_card_t * gus); 367 void (*interrupt_handler_timer2) (struct snd_gus_card * gus);
369 void (*interrupt_handler_dma_write) (snd_gus_card_t * gus); 368 void (*interrupt_handler_dma_write) (struct snd_gus_card * gus);
370 void (*interrupt_handler_dma_read) (snd_gus_card_t * gus); 369 void (*interrupt_handler_dma_read) (struct snd_gus_card * gus);
371 370
372#ifdef CONFIG_SND_DEBUG 371#ifdef CONFIG_SND_DEBUG
373 unsigned int interrupt_stat_midi_out; 372 unsigned int interrupt_stat_midi_out;
@@ -382,17 +381,17 @@ struct _snd_gf1 {
382 /* synthesizer */ 381 /* synthesizer */
383 382
384 int seq_client; 383 int seq_client;
385 snd_gus_port_t seq_ports[4]; 384 struct snd_gus_port seq_ports[4];
386 snd_seq_kinstr_list_t *ilist; 385 struct snd_seq_kinstr_list *ilist;
387 snd_iwffff_ops_t iwffff_ops; 386 struct snd_iwffff_ops iwffff_ops;
388 snd_gf1_ops_t gf1_ops; 387 struct snd_gf1_ops gf1_ops;
389 snd_simple_ops_t simple_ops; 388 struct snd_simple_ops simple_ops;
390 389
391 /* timer */ 390 /* timer */
392 391
393 unsigned short timer_enabled; 392 unsigned short timer_enabled;
394 snd_timer_t *timer1; 393 struct snd_timer *timer1;
395 snd_timer_t *timer2; 394 struct snd_timer *timer2;
396 395
397 /* midi */ 396 /* midi */
398 397
@@ -404,11 +403,11 @@ struct _snd_gf1 {
404 403
405 unsigned int dma_flags; 404 unsigned int dma_flags;
406 unsigned int dma_shared; 405 unsigned int dma_shared;
407 snd_gf1_dma_block_t *dma_data_pcm; 406 struct snd_gf1_dma_block *dma_data_pcm;
408 snd_gf1_dma_block_t *dma_data_pcm_last; 407 struct snd_gf1_dma_block *dma_data_pcm_last;
409 snd_gf1_dma_block_t *dma_data_synth; 408 struct snd_gf1_dma_block *dma_data_synth;
410 snd_gf1_dma_block_t *dma_data_synth_last; 409 struct snd_gf1_dma_block *dma_data_synth_last;
411 void (*dma_ack)(snd_gus_card_t * gus, void *private_data); 410 void (*dma_ack)(struct snd_gus_card * gus, void *private_data);
412 void *dma_private_data; 411 void *dma_private_data;
413 412
414 /* pcm */ 413 /* pcm */
@@ -425,8 +424,8 @@ struct _snd_gf1 {
425 424
426/* main structure for GUS card */ 425/* main structure for GUS card */
427 426
428struct _snd_gus_card { 427struct snd_gus_card {
429 snd_card_t *card; 428 struct snd_card *card;
430 429
431 unsigned int 430 unsigned int
432 initialized: 1, /* resources were initialized */ 431 initialized: 1, /* resources were initialized */
@@ -448,18 +447,18 @@ struct _snd_gus_card {
448 unsigned short joystick_dac; /* joystick DAC level */ 447 unsigned short joystick_dac; /* joystick DAC level */
449 int timer_dev; /* timer device */ 448 int timer_dev; /* timer device */
450 449
451 struct _snd_gf1 gf1; /* gf1 specific variables */ 450 struct snd_gf1 gf1; /* gf1 specific variables */
452 snd_pcm_t *pcm; 451 struct snd_pcm *pcm;
453 snd_pcm_substream_t *pcm_cap_substream; 452 struct snd_pcm_substream *pcm_cap_substream;
454 unsigned int c_dma_size; 453 unsigned int c_dma_size;
455 unsigned int c_period_size; 454 unsigned int c_period_size;
456 unsigned int c_pos; 455 unsigned int c_pos;
457 456
458 snd_rawmidi_t *midi_uart; 457 struct snd_rawmidi *midi_uart;
459 snd_rawmidi_substream_t *midi_substream_output; 458 struct snd_rawmidi_substream *midi_substream_output;
460 snd_rawmidi_substream_t *midi_substream_input; 459 struct snd_rawmidi_substream *midi_substream_input;
461 460
462 snd_seq_device_t *seq_dev; 461 struct snd_seq_device *seq_dev;
463 462
464 spinlock_t reg_lock; 463 spinlock_t reg_lock;
465 spinlock_t voice_alloc; 464 spinlock_t voice_alloc;
@@ -474,7 +473,7 @@ struct _snd_gus_card {
474 473
475/* I/O functions for GF1/InterWave chip - gus_io.c */ 474/* I/O functions for GF1/InterWave chip - gus_io.c */
476 475
477static inline void snd_gf1_select_voice(snd_gus_card_t * gus, int voice) 476static inline void snd_gf1_select_voice(struct snd_gus_card * gus, int voice)
478{ 477{
479 unsigned long flags; 478 unsigned long flags;
480 479
@@ -486,63 +485,63 @@ static inline void snd_gf1_select_voice(snd_gus_card_t * gus, int voice)
486 spin_unlock_irqrestore(&gus->active_voice_lock, flags); 485 spin_unlock_irqrestore(&gus->active_voice_lock, flags);
487} 486}
488 487
489static inline void snd_gf1_uart_cmd(snd_gus_card_t * gus, unsigned char b) 488static inline void snd_gf1_uart_cmd(struct snd_gus_card * gus, unsigned char b)
490{ 489{
491 outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL)); 490 outb(gus->gf1.uart_cmd = b, GUSP(gus, MIDICTRL));
492} 491}
493 492
494static inline unsigned char snd_gf1_uart_stat(snd_gus_card_t * gus) 493static inline unsigned char snd_gf1_uart_stat(struct snd_gus_card * gus)
495{ 494{
496 return inb(GUSP(gus, MIDISTAT)); 495 return inb(GUSP(gus, MIDISTAT));
497} 496}
498 497
499static inline void snd_gf1_uart_put(snd_gus_card_t * gus, unsigned char b) 498static inline void snd_gf1_uart_put(struct snd_gus_card * gus, unsigned char b)
500{ 499{
501 outb(b, GUSP(gus, MIDIDATA)); 500 outb(b, GUSP(gus, MIDIDATA));
502} 501}
503 502
504static inline unsigned char snd_gf1_uart_get(snd_gus_card_t * gus) 503static inline unsigned char snd_gf1_uart_get(struct snd_gus_card * gus)
505{ 504{
506 return inb(GUSP(gus, MIDIDATA)); 505 return inb(GUSP(gus, MIDIDATA));
507} 506}
508 507
509extern void snd_gf1_delay(snd_gus_card_t * gus); 508extern void snd_gf1_delay(struct snd_gus_card * gus);
510 509
511extern void snd_gf1_ctrl_stop(snd_gus_card_t * gus, unsigned char reg); 510extern void snd_gf1_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);
512 511
513extern void snd_gf1_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 512extern void snd_gf1_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
514extern unsigned char snd_gf1_look8(snd_gus_card_t * gus, unsigned char reg); 513extern unsigned char snd_gf1_look8(struct snd_gus_card * gus, unsigned char reg);
515static inline unsigned char snd_gf1_read8(snd_gus_card_t * gus, unsigned char reg) 514static inline unsigned char snd_gf1_read8(struct snd_gus_card * gus, unsigned char reg)
516{ 515{
517 return snd_gf1_look8(gus, reg | 0x80); 516 return snd_gf1_look8(gus, reg | 0x80);
518} 517}
519extern void snd_gf1_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data); 518extern void snd_gf1_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);
520extern unsigned short snd_gf1_look16(snd_gus_card_t * gus, unsigned char reg); 519extern unsigned short snd_gf1_look16(struct snd_gus_card * gus, unsigned char reg);
521static inline unsigned short snd_gf1_read16(snd_gus_card_t * gus, unsigned char reg) 520static inline unsigned short snd_gf1_read16(struct snd_gus_card * gus, unsigned char reg)
522{ 521{
523 return snd_gf1_look16(gus, reg | 0x80); 522 return snd_gf1_look16(gus, reg | 0x80);
524} 523}
525extern void snd_gf1_adlib_write(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 524extern void snd_gf1_adlib_write(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
526extern void snd_gf1_dram_addr(snd_gus_card_t * gus, unsigned int addr); 525extern void snd_gf1_dram_addr(struct snd_gus_card * gus, unsigned int addr);
527extern void snd_gf1_poke(snd_gus_card_t * gus, unsigned int addr, unsigned char data); 526extern void snd_gf1_poke(struct snd_gus_card * gus, unsigned int addr, unsigned char data);
528extern unsigned char snd_gf1_peek(snd_gus_card_t * gus, unsigned int addr); 527extern unsigned char snd_gf1_peek(struct snd_gus_card * gus, unsigned int addr);
529extern void snd_gf1_write_addr(snd_gus_card_t * gus, unsigned char reg, unsigned int addr, short w_16bit); 528extern void snd_gf1_write_addr(struct snd_gus_card * gus, unsigned char reg, unsigned int addr, short w_16bit);
530extern unsigned int snd_gf1_read_addr(snd_gus_card_t * gus, unsigned char reg, short w_16bit); 529extern unsigned int snd_gf1_read_addr(struct snd_gus_card * gus, unsigned char reg, short w_16bit);
531extern void snd_gf1_i_ctrl_stop(snd_gus_card_t * gus, unsigned char reg); 530extern void snd_gf1_i_ctrl_stop(struct snd_gus_card * gus, unsigned char reg);
532extern void snd_gf1_i_write8(snd_gus_card_t * gus, unsigned char reg, unsigned char data); 531extern void snd_gf1_i_write8(struct snd_gus_card * gus, unsigned char reg, unsigned char data);
533extern unsigned char snd_gf1_i_look8(snd_gus_card_t * gus, unsigned char reg); 532extern unsigned char snd_gf1_i_look8(struct snd_gus_card * gus, unsigned char reg);
534extern void snd_gf1_i_write16(snd_gus_card_t * gus, unsigned char reg, unsigned int data); 533extern void snd_gf1_i_write16(struct snd_gus_card * gus, unsigned char reg, unsigned int data);
535static inline unsigned char snd_gf1_i_read8(snd_gus_card_t * gus, unsigned char reg) 534static inline unsigned char snd_gf1_i_read8(struct snd_gus_card * gus, unsigned char reg)
536{ 535{
537 return snd_gf1_i_look8(gus, reg | 0x80); 536 return snd_gf1_i_look8(gus, reg | 0x80);
538} 537}
539extern unsigned short snd_gf1_i_look16(snd_gus_card_t * gus, unsigned char reg); 538extern unsigned short snd_gf1_i_look16(struct snd_gus_card * gus, unsigned char reg);
540static inline unsigned short snd_gf1_i_read16(snd_gus_card_t * gus, unsigned char reg) 539static inline unsigned short snd_gf1_i_read16(struct snd_gus_card * gus, unsigned char reg)
541{ 540{
542 return snd_gf1_i_look16(gus, reg | 0x80); 541 return snd_gf1_i_look16(gus, reg | 0x80);
543} 542}
544 543
545extern void snd_gf1_select_active_voices(snd_gus_card_t * gus); 544extern void snd_gf1_select_active_voices(struct snd_gus_card * gus);
546 545
547/* gus_lfo.c */ 546/* gus_lfo.c */
548 547
@@ -555,98 +554,98 @@ struct _SND_IW_LFO_PROGRAM {
555}; 554};
556 555
557#if 0 556#if 0
558extern irqreturn_t snd_gf1_lfo_effect_interrupt(snd_gus_card_t * gus, snd_gf1_voice_t * voice); 557extern irqreturn_t snd_gf1_lfo_effect_interrupt(struct snd_gus_card * gus, snd_gf1_voice_t * voice);
559#endif 558#endif
560extern void snd_gf1_lfo_init(snd_gus_card_t * gus); 559extern void snd_gf1_lfo_init(struct snd_gus_card * gus);
561extern void snd_gf1_lfo_done(snd_gus_card_t * gus); 560extern void snd_gf1_lfo_done(struct snd_gus_card * gus);
562extern void snd_gf1_lfo_program(snd_gus_card_t * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program); 561extern void snd_gf1_lfo_program(struct snd_gus_card * gus, int voice, int lfo_type, struct _SND_IW_LFO_PROGRAM *program);
563extern void snd_gf1_lfo_enable(snd_gus_card_t * gus, int voice, int lfo_type); 562extern void snd_gf1_lfo_enable(struct snd_gus_card * gus, int voice, int lfo_type);
564extern void snd_gf1_lfo_disable(snd_gus_card_t * gus, int voice, int lfo_type); 563extern void snd_gf1_lfo_disable(struct snd_gus_card * gus, int voice, int lfo_type);
565extern void snd_gf1_lfo_change_freq(snd_gus_card_t * gus, int voice, int lfo_type, int freq); 564extern void snd_gf1_lfo_change_freq(struct snd_gus_card * gus, int voice, int lfo_type, int freq);
566extern void snd_gf1_lfo_change_depth(snd_gus_card_t * gus, int voice, int lfo_type, int depth); 565extern void snd_gf1_lfo_change_depth(struct snd_gus_card * gus, int voice, int lfo_type, int depth);
567extern void snd_gf1_lfo_setup(snd_gus_card_t * gus, int voice, int lfo_type, int freq, int current_depth, int depth, int sweep, int shape); 566extern void snd_gf1_lfo_setup(struct snd_gus_card * gus, int voice, int lfo_type, int freq, int current_depth, int depth, int sweep, int shape);
568extern void snd_gf1_lfo_shutdown(snd_gus_card_t * gus, int voice, int lfo_type); 567extern void snd_gf1_lfo_shutdown(struct snd_gus_card * gus, int voice, int lfo_type);
569#if 0 568#if 0
570extern void snd_gf1_lfo_command(snd_gus_card_t * gus, int voice, unsigned char *command); 569extern void snd_gf1_lfo_command(struct snd_gus_card * gus, int voice, unsigned char *command);
571#endif 570#endif
572 571
573/* gus_mem.c */ 572/* gus_mem.c */
574 573
575void snd_gf1_mem_lock(snd_gf1_mem_t * alloc, int xup); 574void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup);
576int snd_gf1_mem_xfree(snd_gf1_mem_t * alloc, snd_gf1_mem_block_t * block); 575int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * block);
577snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner, 576struct snd_gf1_mem_block *snd_gf1_mem_alloc(struct snd_gf1_mem * alloc, int owner,
578 char *name, int size, int w_16, 577 char *name, int size, int w_16,
579 int align, unsigned int *share_id); 578 int align, unsigned int *share_id);
580int snd_gf1_mem_free(snd_gf1_mem_t * alloc, unsigned int address); 579int snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address);
581int snd_gf1_mem_free_owner(snd_gf1_mem_t * alloc, int owner); 580int snd_gf1_mem_free_owner(struct snd_gf1_mem * alloc, int owner);
582int snd_gf1_mem_init(snd_gus_card_t * gus); 581int snd_gf1_mem_init(struct snd_gus_card * gus);
583int snd_gf1_mem_done(snd_gus_card_t * gus); 582int snd_gf1_mem_done(struct snd_gus_card * gus);
584 583
585/* gus_mem_proc.c */ 584/* gus_mem_proc.c */
586 585
587int snd_gf1_mem_proc_init(snd_gus_card_t * gus); 586int snd_gf1_mem_proc_init(struct snd_gus_card * gus);
588 587
589/* gus_dma.c */ 588/* gus_dma.c */
590 589
591int snd_gf1_dma_init(snd_gus_card_t * gus); 590int snd_gf1_dma_init(struct snd_gus_card * gus);
592int snd_gf1_dma_done(snd_gus_card_t * gus); 591int snd_gf1_dma_done(struct snd_gus_card * gus);
593int snd_gf1_dma_transfer_block(snd_gus_card_t * gus, 592int snd_gf1_dma_transfer_block(struct snd_gus_card * gus,
594 snd_gf1_dma_block_t * block, 593 struct snd_gf1_dma_block * block,
595 int atomic, 594 int atomic,
596 int synth); 595 int synth);
597 596
598/* gus_volume.c */ 597/* gus_volume.c */
599 598
600unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol); 599unsigned short snd_gf1_lvol_to_gvol_raw(unsigned int vol);
601unsigned short snd_gf1_translate_freq(snd_gus_card_t * gus, unsigned int freq2); 600unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int freq2);
602 601
603/* gus_reset.c */ 602/* gus_reset.c */
604 603
605void snd_gf1_set_default_handlers(snd_gus_card_t * gus, unsigned int what); 604void snd_gf1_set_default_handlers(struct snd_gus_card * gus, unsigned int what);
606void snd_gf1_smart_stop_voice(snd_gus_card_t * gus, unsigned short voice); 605void snd_gf1_smart_stop_voice(struct snd_gus_card * gus, unsigned short voice);
607void snd_gf1_stop_voice(snd_gus_card_t * gus, unsigned short voice); 606void snd_gf1_stop_voice(struct snd_gus_card * gus, unsigned short voice);
608void snd_gf1_stop_voices(snd_gus_card_t * gus, unsigned short v_min, unsigned short v_max); 607void snd_gf1_stop_voices(struct snd_gus_card * gus, unsigned short v_min, unsigned short v_max);
609snd_gus_voice_t *snd_gf1_alloc_voice(snd_gus_card_t * gus, int type, int client, int port); 608struct snd_gus_voice *snd_gf1_alloc_voice(struct snd_gus_card * gus, int type, int client, int port);
610void snd_gf1_free_voice(snd_gus_card_t * gus, snd_gus_voice_t *voice); 609void snd_gf1_free_voice(struct snd_gus_card * gus, struct snd_gus_voice *voice);
611int snd_gf1_start(snd_gus_card_t * gus); 610int snd_gf1_start(struct snd_gus_card * gus);
612int snd_gf1_stop(snd_gus_card_t * gus); 611int snd_gf1_stop(struct snd_gus_card * gus);
613 612
614/* gus_mixer.c */ 613/* gus_mixer.c */
615 614
616int snd_gf1_new_mixer(snd_gus_card_t * gus); 615int snd_gf1_new_mixer(struct snd_gus_card * gus);
617 616
618/* gus_pcm.c */ 617/* gus_pcm.c */
619 618
620int snd_gf1_pcm_new(snd_gus_card_t * gus, int pcm_dev, int control_index, snd_pcm_t ** rpcm); 619int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm);
621 620
622#ifdef CONFIG_SND_DEBUG 621#ifdef CONFIG_SND_DEBUG
623extern void snd_gf1_print_voice_registers(snd_gus_card_t * gus); 622extern void snd_gf1_print_voice_registers(struct snd_gus_card * gus);
624#endif 623#endif
625 624
626/* gus.c */ 625/* gus.c */
627 626
628int snd_gus_use_inc(snd_gus_card_t * gus); 627int snd_gus_use_inc(struct snd_gus_card * gus);
629void snd_gus_use_dec(snd_gus_card_t * gus); 628void snd_gus_use_dec(struct snd_gus_card * gus);
630int snd_gus_create(snd_card_t * card, 629int snd_gus_create(struct snd_card *card,
631 unsigned long port, 630 unsigned long port,
632 int irq, int dma1, int dma2, 631 int irq, int dma1, int dma2,
633 int timer_dev, 632 int timer_dev,
634 int voices, 633 int voices,
635 int pcm_channels, 634 int pcm_channels,
636 int effect, 635 int effect,
637 snd_gus_card_t ** rgus); 636 struct snd_gus_card ** rgus);
638int snd_gus_initialize(snd_gus_card_t * gus); 637int snd_gus_initialize(struct snd_gus_card * gus);
639 638
640/* gus_irq.c */ 639/* gus_irq.c */
641 640
642irqreturn_t snd_gus_interrupt(int irq, void *dev_id, struct pt_regs *regs); 641irqreturn_t snd_gus_interrupt(int irq, void *dev_id, struct pt_regs *regs);
643#ifdef CONFIG_SND_DEBUG 642#ifdef CONFIG_SND_DEBUG
644void snd_gus_irq_profile_init(snd_gus_card_t *gus); 643void snd_gus_irq_profile_init(struct snd_gus_card *gus);
645#endif 644#endif
646 645
647/* gus_uart.c */ 646/* gus_uart.c */
648 647
649int snd_gf1_rawmidi_new(snd_gus_card_t * gus, int device, snd_rawmidi_t **rrawmidi); 648int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi);
650 649
651#if 0 650#if 0
652extern void snd_engine_instrument_register(unsigned short mode, 651extern void snd_engine_instrument_register(unsigned short mode,
@@ -657,37 +656,37 @@ extern int snd_engine_instrument_register_ask(unsigned short mode);
657#endif 656#endif
658 657
659/* gus_dram.c */ 658/* gus_dram.c */
660int snd_gus_dram_write(snd_gus_card_t *gus, char __user *ptr, 659int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr,
661 unsigned int addr, unsigned int size); 660 unsigned int addr, unsigned int size);
662int snd_gus_dram_read(snd_gus_card_t *gus, char __user *ptr, 661int snd_gus_dram_read(struct snd_gus_card *gus, char __user *ptr,
663 unsigned int addr, unsigned int size, int rom); 662 unsigned int addr, unsigned int size, int rom);
664 663
665#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 664#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
666 665
667/* gus_sample.c */ 666/* gus_sample.c */
668void snd_gus_sample_event(snd_seq_event_t *ev, snd_gus_port_t *p); 667void snd_gus_sample_event(struct snd_seq_event *ev, struct snd_gus_port *p);
669 668
670/* gus_simple.c */ 669/* gus_simple.c */
671void snd_gf1_simple_init(snd_gus_voice_t *voice); 670void snd_gf1_simple_init(struct snd_gus_voice *voice);
672 671
673/* gus_instr.c */ 672/* gus_instr.c */
674int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave, 673int snd_gus_iwffff_put_sample(void *private_data, struct iwffff_wave *wave,
675 char __user *data, long len, int atomic); 674 char __user *data, long len, int atomic);
676int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave, 675int snd_gus_iwffff_get_sample(void *private_data, struct iwffff_wave *wave,
677 char __user *data, long len, int atomic); 676 char __user *data, long len, int atomic);
678int snd_gus_iwffff_remove_sample(void *private_data, iwffff_wave_t *wave, 677int snd_gus_iwffff_remove_sample(void *private_data, struct iwffff_wave *wave,
679 int atomic); 678 int atomic);
680int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave, 679int snd_gus_gf1_put_sample(void *private_data, struct gf1_wave *wave,
681 char __user *data, long len, int atomic); 680 char __user *data, long len, int atomic);
682int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave, 681int snd_gus_gf1_get_sample(void *private_data, struct gf1_wave *wave,
683 char __user *data, long len, int atomic); 682 char __user *data, long len, int atomic);
684int snd_gus_gf1_remove_sample(void *private_data, gf1_wave_t *wave, 683int snd_gus_gf1_remove_sample(void *private_data, struct gf1_wave *wave,
685 int atomic); 684 int atomic);
686int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr, 685int snd_gus_simple_put_sample(void *private_data, struct simple_instrument *instr,
687 char __user *data, long len, int atomic); 686 char __user *data, long len, int atomic);
688int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr, 687int snd_gus_simple_get_sample(void *private_data, struct simple_instrument *instr,
689 char __user *data, long len, int atomic); 688 char __user *data, long len, int atomic);
690int snd_gus_simple_remove_sample(void *private_data, simple_instrument_t *instr, 689int snd_gus_simple_remove_sample(void *private_data, struct simple_instrument *instr,
691 int atomic); 690 int atomic);
692 691
693#endif /* CONFIG_SND_SEQUENCER */ 692#endif /* CONFIG_SND_SEQUENCER */
diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h
index 7ce3aa67e5d6..25e1951a9955 100644
--- a/include/sound/hdsp.h
+++ b/include/sound/hdsp.h
@@ -21,17 +21,15 @@
21 21
22#define HDSP_MATRIX_MIXER_SIZE 2048 22#define HDSP_MATRIX_MIXER_SIZE 2048
23 23
24typedef enum { 24enum HDSP_IO_Type {
25 Digiface, 25 Digiface,
26 Multiface, 26 Multiface,
27 H9652, 27 H9652,
28 H9632, 28 H9632,
29 Undefined, 29 Undefined,
30} HDSP_IO_Type; 30};
31
32typedef struct _snd_hdsp_peak_rms hdsp_peak_rms_t;
33 31
34struct _snd_hdsp_peak_rms { 32struct hdsp_peak_rms {
35 u32 input_peaks[26]; 33 u32 input_peaks[26];
36 u32 playback_peaks[26]; 34 u32 playback_peaks[26];
37 u32 output_peaks[28]; 35 u32 output_peaks[28];
@@ -41,11 +39,9 @@ struct _snd_hdsp_peak_rms {
41 u64 output_rms[26]; 39 u64 output_rms[26];
42}; 40};
43 41
44#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, hdsp_peak_rms_t) 42#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms)
45 43
46typedef struct _snd_hdsp_config_info hdsp_config_info_t; 44struct hdsp_config_info {
47
48struct _snd_hdsp_config_info {
49 unsigned char pref_sync_ref; 45 unsigned char pref_sync_ref;
50 unsigned char wordclock_sync_check; 46 unsigned char wordclock_sync_check;
51 unsigned char spdif_sync_check; 47 unsigned char spdif_sync_check;
@@ -71,40 +67,41 @@ struct _snd_hdsp_config_info {
71 unsigned char analog_extension_board; 67 unsigned char analog_extension_board;
72}; 68};
73 69
74#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdsp_config_info_t) 70#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info)
75
76typedef struct _snd_hdsp_firmware hdsp_firmware_t;
77 71
78struct _snd_hdsp_firmware { 72struct hdsp_firmware {
79 void __user *firmware_data; /* 24413 x 4 bytes */ 73 void __user *firmware_data; /* 24413 x 4 bytes */
80}; 74};
81 75
82#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t) 76#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware)
83 77
84typedef struct _snd_hdsp_version hdsp_version_t; 78struct hdsp_version {
85 79 enum HDSP_IO_Type io_type;
86struct _snd_hdsp_version {
87 HDSP_IO_Type io_type;
88 unsigned short firmware_rev; 80 unsigned short firmware_rev;
89}; 81};
90 82
91#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, hdsp_version_t) 83#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version)
92
93typedef struct _snd_hdsp_mixer hdsp_mixer_t;
94 84
95struct _snd_hdsp_mixer { 85struct hdsp_mixer {
96 unsigned short matrix[HDSP_MATRIX_MIXER_SIZE]; 86 unsigned short matrix[HDSP_MATRIX_MIXER_SIZE];
97}; 87};
98 88
99#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, hdsp_mixer_t) 89#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer)
100 90
101typedef struct _snd_hdsp_9632_aeb hdsp_9632_aeb_t; 91struct hdsp_9632_aeb {
102
103struct _snd_hdsp_9632_aeb {
104 int aebi; 92 int aebi;
105 int aebo; 93 int aebo;
106}; 94};
107 95
108#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, hdsp_9632_aeb_t) 96#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb)
97
98/* typedefs for compatibility to user-space */
99typedef enum HDSP_IO_Type HDSP_IO_Type;
100typedef struct hdsp_peak_rms hdsp_peak_rms_t;
101typedef struct hdsp_config_info hdsp_config_info_t;
102typedef struct hdsp_firmware hdsp_firmware_t;
103typedef struct hdsp_version hdsp_version_t;
104typedef struct hdsp_mixer hdsp_mixer_t;
105typedef struct hdsp_9632_aeb hdsp_9632_aeb_t;
109 106
110#endif /* __SOUND_HDSP_H */ 107#endif /* __SOUND_HDSP_H */
diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h
index c34427ccd0b3..c3c854d99c28 100644
--- a/include/sound/hdspm.h
+++ b/include/sound/hdspm.h
@@ -25,8 +25,6 @@
25 25
26/* -------------------- IOCTL Peak/RMS Meters -------------------- */ 26/* -------------------- IOCTL Peak/RMS Meters -------------------- */
27 27
28typedef struct _snd_hdspm_peak_rms hdspm_peak_rms_t;
29
30/* peam rms level structure like we get from hardware 28/* peam rms level structure like we get from hardware
31 29
32 maybe in future we can memory map it so I just copy it 30 maybe in future we can memory map it so I just copy it
@@ -36,7 +34,7 @@ typedef struct _snd_hdspm_peak_rms hdspm_peak_rms_t;
36 (i asume so from the code) 34 (i asume so from the code)
37*/ 35*/
38 36
39struct _snd_hdspm_peak_rms { 37struct hdspm_peak_rms {
40 38
41 unsigned int level_offset[1024]; 39 unsigned int level_offset[1024];
42 40
@@ -58,18 +56,16 @@ struct _snd_hdspm_peak_rms {
58 unsigned int xxx_rms_h[64]; /* not used */ 56 unsigned int xxx_rms_h[64]; /* not used */
59}; 57};
60 58
61struct sndrv_hdspm_peak_rms_ioctl { 59struct hdspm_peak_rms_ioctl {
62 hdspm_peak_rms_t *peak; 60 struct hdspm_peak_rms *peak;
63}; 61};
64 62
65/* use indirect access due to the limit of ioctl bit size */ 63/* use indirect access due to the limit of ioctl bit size */
66#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct sndrv_hdspm_peak_rms_ioctl) 64#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdspm_peak_rms_ioctl)
67 65
68/* ------------ CONFIG block IOCTL ---------------------- */ 66/* ------------ CONFIG block IOCTL ---------------------- */
69 67
70typedef struct _snd_hdspm_config_info hdspm_config_info_t; 68struct hdspm_config_info {
71
72struct _snd_hdspm_config_info {
73 unsigned char pref_sync_ref; 69 unsigned char pref_sync_ref;
74 unsigned char wordclock_sync_check; 70 unsigned char wordclock_sync_check;
75 unsigned char madi_sync_check; 71 unsigned char madi_sync_check;
@@ -83,18 +79,16 @@ struct _snd_hdspm_config_info {
83 unsigned int analog_out; 79 unsigned int analog_out;
84}; 80};
85 81
86#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, hdspm_config_info_t) 82#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdspm_config_info)
87 83
88 84
89/* get Soundcard Version */ 85/* get Soundcard Version */
90 86
91typedef struct _snd_hdspm_version hdspm_version_t; 87struct hdspm_version {
92
93struct _snd_hdspm_version {
94 unsigned short firmware_rev; 88 unsigned short firmware_rev;
95}; 89};
96 90
97#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, hdspm_version_t) 91#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version)
98 92
99 93
100/* ------------- get Matrix Mixer IOCTL --------------- */ 94/* ------------- get Matrix Mixer IOCTL --------------- */
@@ -108,24 +102,27 @@ struct _snd_hdspm_version {
108 102
109#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS 103#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
110 104
111typedef struct _snd_hdspm_channelfader snd_hdspm_channelfader_t; 105struct hdspm_channelfader {
112
113struct _snd_hdspm_channelfader {
114 unsigned int in[HDSPM_MIXER_CHANNELS]; 106 unsigned int in[HDSPM_MIXER_CHANNELS];
115 unsigned int pb[HDSPM_MIXER_CHANNELS]; 107 unsigned int pb[HDSPM_MIXER_CHANNELS];
116}; 108};
117 109
118typedef struct _snd_hdspm_mixer hdspm_mixer_t; 110struct hdspm_mixer {
119 111 struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
120struct _snd_hdspm_mixer {
121 snd_hdspm_channelfader_t ch[HDSPM_MIXER_CHANNELS];
122}; 112};
123 113
124struct sndrv_hdspm_mixer_ioctl { 114struct hdspm_mixer_ioctl {
125 hdspm_mixer_t *mixer; 115 struct hdspm_mixer *mixer;
126}; 116};
127 117
128/* use indirect access due to the limit of ioctl bit size */ 118/* use indirect access due to the limit of ioctl bit size */
129#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct sndrv_hdspm_mixer_ioctl) 119#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
120
121/* typedefs for compatibility to user-space */
122typedef struct hdspm_peak_rms hdspm_peak_rms_t;
123typedef struct hdspm_config_info hdspm_config_info_t;
124typedef struct hdspm_version hdspm_version_t;
125typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
126typedef struct hdspm_mixer hdspm_mixer_t;
130 127
131#endif /* __SOUND_HDSPM_H */ 128#endif /* __SOUND_HDSPM_H */
diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h
index 043876348fa1..c679e5b31111 100644
--- a/include/sound/hwdep.h
+++ b/include/sound/hwdep.h
@@ -25,27 +25,25 @@
25#include <sound/asound.h> 25#include <sound/asound.h>
26#include <linux/poll.h> 26#include <linux/poll.h>
27 27
28typedef enum sndrv_hwdep_iface snd_hwdep_iface_t; 28struct snd_hwdep;
29typedef struct sndrv_hwdep_info snd_hwdep_info_t;
30typedef struct sndrv_hwdep_dsp_status snd_hwdep_dsp_status_t;
31typedef struct sndrv_hwdep_dsp_image snd_hwdep_dsp_image_t;
32 29
33typedef struct _snd_hwdep_ops { 30struct snd_hwdep_ops {
34 long long (*llseek) (snd_hwdep_t *hw, struct file * file, long long offset, int orig); 31 long long (*llseek) (struct snd_hwdep *hw, struct file * file, long long offset, int orig);
35 long (*read) (snd_hwdep_t * hw, char __user *buf, long count, loff_t *offset); 32 long (*read) (struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset);
36 long (*write) (snd_hwdep_t * hw, const char __user *buf, long count, loff_t *offset); 33 long (*write) (struct snd_hwdep *hw, const char __user *buf, long count, loff_t *offset);
37 int (*open) (snd_hwdep_t * hw, struct file * file); 34 int (*open) (struct snd_hwdep * hw, struct file * file);
38 int (*release) (snd_hwdep_t * hw, struct file * file); 35 int (*release) (struct snd_hwdep *hw, struct file * file);
39 unsigned int (*poll) (snd_hwdep_t * hw, struct file * file, poll_table * wait); 36 unsigned int (*poll) (struct snd_hwdep *hw, struct file * file, poll_table * wait);
40 int (*ioctl) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg); 37 int (*ioctl) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg);
41 int (*ioctl_compat) (snd_hwdep_t * hw, struct file * file, unsigned int cmd, unsigned long arg); 38 int (*ioctl_compat) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg);
42 int (*mmap) (snd_hwdep_t * hw, struct file * file, struct vm_area_struct * vma); 39 int (*mmap) (struct snd_hwdep *hw, struct file * file, struct vm_area_struct * vma);
43 int (*dsp_status) (snd_hwdep_t * hw, snd_hwdep_dsp_status_t * status); 40 int (*dsp_status) (struct snd_hwdep *hw, struct snd_hwdep_dsp_status *status);
44 int (*dsp_load) (snd_hwdep_t * hw, snd_hwdep_dsp_image_t * image); 41 int (*dsp_load) (struct snd_hwdep *hw, struct snd_hwdep_dsp_image *image);
45} snd_hwdep_ops_t; 42};
46 43
47struct _snd_hwdep { 44struct snd_hwdep {
48 snd_card_t *card; 45 struct snd_card *card;
46 struct list_head list;
49 int device; 47 int device;
50 char id[32]; 48 char id[32];
51 char name[80]; 49 char name[80];
@@ -57,10 +55,10 @@ struct _snd_hwdep {
57 int ossreg; 55 int ossreg;
58#endif 56#endif
59 57
60 snd_hwdep_ops_t ops; 58 struct snd_hwdep_ops ops;
61 wait_queue_head_t open_wait; 59 wait_queue_head_t open_wait;
62 void *private_data; 60 void *private_data;
63 void (*private_free) (snd_hwdep_t *hwdep); 61 void (*private_free) (struct snd_hwdep *hwdep);
64 62
65 struct semaphore open_mutex; 63 struct semaphore open_mutex;
66 int used; 64 int used;
@@ -68,6 +66,7 @@ struct _snd_hwdep {
68 unsigned int exclusive: 1; 66 unsigned int exclusive: 1;
69}; 67};
70 68
71extern int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep); 69extern int snd_hwdep_new(struct snd_card *card, char *id, int device,
70 struct snd_hwdep **rhwdep);
72 71
73#endif /* __SOUND_HWDEP_H */ 72#endif /* __SOUND_HWDEP_H */
diff --git a/include/sound/i2c.h b/include/sound/i2c.h
index a665ddf9c146..81eb23ed761f 100644
--- a/include/sound/i2c.h
+++ b/include/sound/i2c.h
@@ -21,82 +21,84 @@
21 * 21 *
22 */ 22 */
23 23
24typedef struct _snd_i2c_device snd_i2c_device_t;
25typedef struct _snd_i2c_bus snd_i2c_bus_t;
26
27#define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */ 24#define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */
28 25
29struct _snd_i2c_device { 26struct snd_i2c_device {
30 struct list_head list; 27 struct list_head list;
31 snd_i2c_bus_t *bus; /* I2C bus */ 28 struct snd_i2c_bus *bus; /* I2C bus */
32 char name[32]; /* some useful device name */ 29 char name[32]; /* some useful device name */
33 unsigned short flags; /* device flags */ 30 unsigned short flags; /* device flags */
34 unsigned short addr; /* device address (might be 10-bit) */ 31 unsigned short addr; /* device address (might be 10-bit) */
35 unsigned long private_value; 32 unsigned long private_value;
36 void *private_data; 33 void *private_data;
37 void (*private_free)(snd_i2c_device_t *device); 34 void (*private_free)(struct snd_i2c_device *device);
35};
36
37#define snd_i2c_device(n) list_entry(n, struct snd_i2c_device, list)
38
39struct snd_i2c_bit_ops {
40 void (*start)(struct snd_i2c_bus *bus); /* transfer start */
41 void (*stop)(struct snd_i2c_bus *bus); /* transfer stop */
42 void (*direction)(struct snd_i2c_bus *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */
43 void (*setlines)(struct snd_i2c_bus *bus, int clock, int data);
44 int (*getclock)(struct snd_i2c_bus *bus);
45 int (*getdata)(struct snd_i2c_bus *bus, int ack);
38}; 46};
39 47
40#define snd_i2c_device(n) list_entry(n, snd_i2c_device_t, list) 48struct snd_i2c_ops {
41 49 int (*sendbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count);
42typedef struct _snd_i2c_bit_ops { 50 int (*readbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count);
43 void (*start)(snd_i2c_bus_t *bus); /* transfer start */ 51 int (*probeaddr)(struct snd_i2c_bus *bus, unsigned short addr);
44 void (*stop)(snd_i2c_bus_t *bus); /* transfer stop */ 52};
45 void (*direction)(snd_i2c_bus_t *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */ 53
46 void (*setlines)(snd_i2c_bus_t *bus, int clock, int data); 54struct snd_i2c_bus {
47 int (*getclock)(snd_i2c_bus_t *bus); 55 struct snd_card *card; /* card which I2C belongs to */
48 int (*getdata)(snd_i2c_bus_t *bus, int ack);
49} snd_i2c_bit_ops_t;
50
51typedef struct _snd_i2c_ops {
52 int (*sendbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count);
53 int (*readbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count);
54 int (*probeaddr)(snd_i2c_bus_t *bus, unsigned short addr);
55} snd_i2c_ops_t;
56
57struct _snd_i2c_bus {
58 snd_card_t *card; /* card which I2C belongs to */
59 char name[32]; /* some useful label */ 56 char name[32]; /* some useful label */
60 57
61 struct semaphore lock_mutex; 58 struct semaphore lock_mutex;
62 59
63 snd_i2c_bus_t *master; /* master bus when SCK/SCL is shared */ 60 struct snd_i2c_bus *master; /* master bus when SCK/SCL is shared */
64 struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */ 61 struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */
65 62
66 struct list_head devices; /* attached devices to this bus */ 63 struct list_head devices; /* attached devices to this bus */
67 64
68 union { 65 union {
69 snd_i2c_bit_ops_t *bit; 66 struct snd_i2c_bit_ops *bit;
70 void *ops; 67 void *ops;
71 } hw_ops; /* lowlevel operations */ 68 } hw_ops; /* lowlevel operations */
72 snd_i2c_ops_t *ops; /* midlevel operations */ 69 struct snd_i2c_ops *ops; /* midlevel operations */
73 70
74 unsigned long private_value; 71 unsigned long private_value;
75 void *private_data; 72 void *private_data;
76 void (*private_free)(snd_i2c_bus_t *bus); 73 void (*private_free)(struct snd_i2c_bus *bus);
77}; 74};
78 75
79#define snd_i2c_slave_bus(n) list_entry(n, snd_i2c_bus_t, buses) 76#define snd_i2c_slave_bus(n) list_entry(n, struct snd_i2c_bus, buses)
80 77
81int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master, snd_i2c_bus_t **ri2c); 78int snd_i2c_bus_create(struct snd_card *card, const char *name,
82int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char addr, snd_i2c_device_t **rdevice); 79 struct snd_i2c_bus *master, struct snd_i2c_bus **ri2c);
83int snd_i2c_device_free(snd_i2c_device_t *device); 80int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name,
81 unsigned char addr, struct snd_i2c_device **rdevice);
82int snd_i2c_device_free(struct snd_i2c_device *device);
84 83
85static inline void snd_i2c_lock(snd_i2c_bus_t *bus) { 84static inline void snd_i2c_lock(struct snd_i2c_bus *bus)
85{
86 if (bus->master) 86 if (bus->master)
87 down(&bus->master->lock_mutex); 87 down(&bus->master->lock_mutex);
88 else 88 else
89 down(&bus->lock_mutex); 89 down(&bus->lock_mutex);
90} 90}
91static inline void snd_i2c_unlock(snd_i2c_bus_t *bus) { 91
92static inline void snd_i2c_unlock(struct snd_i2c_bus *bus)
93{
92 if (bus->master) 94 if (bus->master)
93 up(&bus->master->lock_mutex); 95 up(&bus->master->lock_mutex);
94 else 96 else
95 up(&bus->lock_mutex); 97 up(&bus->lock_mutex);
96} 98}
97 99
98int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); 100int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
99int snd_i2c_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); 101int snd_i2c_readbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
100int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr); 102int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr);
101 103
102#endif /* __SOUND_I2C_H */ 104#endif /* __SOUND_I2C_H */
diff --git a/include/sound/info.h b/include/sound/info.h
index 1d76bf3cb05e..8ea5c7497c03 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -34,8 +34,6 @@ struct snd_info_buffer {
34 int error; /* error code */ 34 int error; /* error code */
35}; 35};
36 36
37typedef struct snd_info_buffer snd_info_buffer_t;
38
39#define SNDRV_INFO_CONTENT_TEXT 0 37#define SNDRV_INFO_CONTENT_TEXT 0
40#define SNDRV_INFO_CONTENT_DATA 1 38#define SNDRV_INFO_CONTENT_DATA 1
41 39
@@ -44,28 +42,28 @@ struct snd_info_entry;
44struct snd_info_entry_text { 42struct snd_info_entry_text {
45 unsigned long read_size; 43 unsigned long read_size;
46 unsigned long write_size; 44 unsigned long write_size;
47 void (*read) (snd_info_entry_t *entry, snd_info_buffer_t * buffer); 45 void (*read) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
48 void (*write) (snd_info_entry_t *entry, snd_info_buffer_t * buffer); 46 void (*write) (struct snd_info_entry *entry, struct snd_info_buffer *buffer);
49}; 47};
50 48
51struct snd_info_entry_ops { 49struct snd_info_entry_ops {
52 int (*open) (snd_info_entry_t *entry, 50 int (*open) (struct snd_info_entry *entry,
53 unsigned short mode, void **file_private_data); 51 unsigned short mode, void **file_private_data);
54 int (*release) (snd_info_entry_t * entry, 52 int (*release) (struct snd_info_entry * entry,
55 unsigned short mode, void *file_private_data); 53 unsigned short mode, void *file_private_data);
56 long (*read) (snd_info_entry_t *entry, void *file_private_data, 54 long (*read) (struct snd_info_entry *entry, void *file_private_data,
57 struct file * file, char __user *buf, 55 struct file * file, char __user *buf,
58 unsigned long count, unsigned long pos); 56 unsigned long count, unsigned long pos);
59 long (*write) (snd_info_entry_t *entry, void *file_private_data, 57 long (*write) (struct snd_info_entry *entry, void *file_private_data,
60 struct file * file, const char __user *buf, 58 struct file * file, const char __user *buf,
61 unsigned long count, unsigned long pos); 59 unsigned long count, unsigned long pos);
62 long long (*llseek) (snd_info_entry_t *entry, void *file_private_data, 60 long long (*llseek) (struct snd_info_entry *entry, void *file_private_data,
63 struct file * file, long long offset, int orig); 61 struct file * file, long long offset, int orig);
64 unsigned int (*poll) (snd_info_entry_t *entry, void *file_private_data, 62 unsigned int (*poll) (struct snd_info_entry *entry, void *file_private_data,
65 struct file * file, poll_table * wait); 63 struct file * file, poll_table * wait);
66 int (*ioctl) (snd_info_entry_t *entry, void *file_private_data, 64 int (*ioctl) (struct snd_info_entry *entry, void *file_private_data,
67 struct file * file, unsigned int cmd, unsigned long arg); 65 struct file * file, unsigned int cmd, unsigned long arg);
68 int (*mmap) (snd_info_entry_t *entry, void *file_private_data, 66 int (*mmap) (struct snd_info_entry *entry, void *file_private_data,
69 struct inode * inode, struct file * file, 67 struct inode * inode, struct file * file,
70 struct vm_area_struct * vma); 68 struct vm_area_struct * vma);
71}; 69};
@@ -80,20 +78,18 @@ struct snd_info_entry {
80 struct snd_info_entry_text text; 78 struct snd_info_entry_text text;
81 struct snd_info_entry_ops *ops; 79 struct snd_info_entry_ops *ops;
82 } c; 80 } c;
83 snd_info_entry_t *parent; 81 struct snd_info_entry *parent;
84 snd_card_t *card; 82 struct snd_card *card;
85 struct module *module; 83 struct module *module;
86 void *private_data; 84 void *private_data;
87 void (*private_free)(snd_info_entry_t *entry); 85 void (*private_free)(struct snd_info_entry *entry);
88 struct proc_dir_entry *p; 86 struct proc_dir_entry *p;
89 struct semaphore access; 87 struct semaphore access;
90}; 88};
91 89
92extern int snd_info_check_reserved_words(const char *str);
93
94#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) 90#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
95extern int snd_info_minor_register(void); 91int snd_info_minor_register(void);
96extern int snd_info_minor_unregister(void); 92int snd_info_minor_unregister(void);
97#else 93#else
98#define snd_info_minor_register() /* NOP */ 94#define snd_info_minor_register() /* NOP */
99#define snd_info_minor_unregister() /* NOP */ 95#define snd_info_minor_unregister() /* NOP */
@@ -102,72 +98,79 @@ extern int snd_info_minor_unregister(void);
102 98
103#ifdef CONFIG_PROC_FS 99#ifdef CONFIG_PROC_FS
104 100
105extern snd_info_entry_t *snd_seq_root; 101extern struct snd_info_entry *snd_seq_root;
106#ifdef CONFIG_SND_OSSEMUL 102#ifdef CONFIG_SND_OSSEMUL
107extern snd_info_entry_t *snd_oss_root; 103extern struct snd_info_entry *snd_oss_root;
108#else 104#else
109#define snd_oss_root NULL 105#define snd_oss_root NULL
110#endif 106#endif
111 107
112int snd_iprintf(snd_info_buffer_t * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3))); 108int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) __attribute__ ((format (printf, 2, 3)));
113int snd_info_init(void); 109int snd_info_init(void);
114int snd_info_done(void); 110int snd_info_done(void);
115 111
116int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len); 112int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len);
117char *snd_info_get_str(char *dest, char *src, int len); 113char *snd_info_get_str(char *dest, char *src, int len);
118snd_info_entry_t *snd_info_create_module_entry(struct module * module, 114struct snd_info_entry *snd_info_create_module_entry(struct module * module,
119 const char *name, 115 const char *name,
120 snd_info_entry_t * parent); 116 struct snd_info_entry * parent);
121snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, 117struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card,
122 const char *name, 118 const char *name,
123 snd_info_entry_t * parent); 119 struct snd_info_entry * parent);
124void snd_info_free_entry(snd_info_entry_t * entry); 120void snd_info_free_entry(struct snd_info_entry * entry);
125int snd_info_store_text(snd_info_entry_t * entry); 121int snd_info_store_text(struct snd_info_entry * entry);
126int snd_info_restore_text(snd_info_entry_t * entry); 122int snd_info_restore_text(struct snd_info_entry * entry);
127 123
128int snd_info_card_create(snd_card_t * card); 124int snd_info_card_create(struct snd_card * card);
129int snd_info_card_register(snd_card_t * card); 125int snd_info_card_register(struct snd_card * card);
130int snd_info_card_free(snd_card_t * card); 126int snd_info_card_free(struct snd_card * card);
131int snd_info_register(snd_info_entry_t * entry); 127int snd_info_register(struct snd_info_entry * entry);
132int snd_info_unregister(snd_info_entry_t * entry); 128int snd_info_unregister(struct snd_info_entry * entry);
133 129
134/* for card drivers */ 130/* for card drivers */
135int snd_card_proc_new(snd_card_t *card, const char *name, snd_info_entry_t **entryp); 131int snd_card_proc_new(struct snd_card *card, const char *name, struct snd_info_entry **entryp);
136 132
137static inline void snd_info_set_text_ops(snd_info_entry_t *entry, 133static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
138 void *private_data, 134 void *private_data,
139 long read_size, 135 long read_size,
140 void (*read)(snd_info_entry_t *, snd_info_buffer_t *)) 136 void (*read)(struct snd_info_entry *, struct snd_info_buffer *))
141{ 137{
142 entry->private_data = private_data; 138 entry->private_data = private_data;
143 entry->c.text.read_size = read_size; 139 entry->c.text.read_size = read_size;
144 entry->c.text.read = read; 140 entry->c.text.read = read;
145} 141}
146 142
143int snd_info_check_reserved_words(const char *str);
147 144
148#else 145#else
149 146
150#define snd_seq_root NULL 147#define snd_seq_root NULL
151#define snd_oss_root NULL 148#define snd_oss_root NULL
152 149
153static inline int snd_iprintf(snd_info_buffer_t * buffer, char *fmt,...) { return 0; } 150static inline int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...) { return 0; }
154static inline int snd_info_init(void) { return 0; } 151static inline int snd_info_init(void) { return 0; }
155static inline int snd_info_done(void) { return 0; } 152static inline int snd_info_done(void) { return 0; }
156 153
157static inline int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len) { return 0; } 154static inline int snd_info_get_line(struct snd_info_buffer * buffer, char *line, int len) { return 0; }
158static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; } 155static inline char *snd_info_get_str(char *dest, char *src, int len) { return NULL; }
159static inline snd_info_entry_t *snd_info_create_module_entry(struct module * module, const char *name, snd_info_entry_t * parent) { return NULL; } 156static inline struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, struct snd_info_entry * parent) { return NULL; }
160static inline snd_info_entry_t *snd_info_create_card_entry(snd_card_t * card, const char *name, snd_info_entry_t * parent) { return NULL; } 157static inline struct snd_info_entry *snd_info_create_card_entry(struct snd_card * card, const char *name, struct snd_info_entry * parent) { return NULL; }
161static inline void snd_info_free_entry(snd_info_entry_t * entry) { ; } 158static inline void snd_info_free_entry(struct snd_info_entry * entry) { ; }
162 159
163static inline int snd_info_card_create(snd_card_t * card) { return 0; } 160static inline int snd_info_card_create(struct snd_card * card) { return 0; }
164static inline int snd_info_card_register(snd_card_t * card) { return 0; } 161static inline int snd_info_card_register(struct snd_card * card) { return 0; }
165static inline int snd_info_card_free(snd_card_t * card) { return 0; } 162static inline int snd_info_card_free(struct snd_card * card) { return 0; }
166static inline int snd_info_register(snd_info_entry_t * entry) { return 0; } 163static inline int snd_info_register(struct snd_info_entry * entry) { return 0; }
167static inline int snd_info_unregister(snd_info_entry_t * entry) { return 0; } 164static inline int snd_info_unregister(struct snd_info_entry * entry) { return 0; }
165
166static inline int snd_card_proc_new(struct snd_card *card, const char *name,
167 struct snd_info_entry **entryp) { return -EINVAL; }
168static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),
169 void *private_data,
170 long read_size,
171 void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {}
168 172
169#define snd_card_proc_new(card,name,entryp) 0 /* always success */ 173static inline int snd_info_check_reserved_words(const char *str) { return 1; }
170#define snd_info_set_text_ops(entry,private_data,read_size,read) /*NOP*/
171 174
172#endif 175#endif
173 176
@@ -185,7 +188,7 @@ static inline int snd_info_unregister(snd_info_entry_t * entry) { return 0; }
185 188
186#define SNDRV_OSS_INFO_DEV_COUNT 6 189#define SNDRV_OSS_INFO_DEV_COUNT 6
187 190
188extern int snd_oss_info_register(int dev, int num, char *string); 191int snd_oss_info_register(int dev, int num, char *string);
189#define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL) 192#define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL)
190 193
191#endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */ 194#endif /* CONFIG_SND_OSSEMUL && CONFIG_PROC_FS */
diff --git a/include/sound/initval.h b/include/sound/initval.h
index 2bf1508825a4..d29e3d31d149 100644
--- a/include/sound/initval.h
+++ b/include/sound/initval.h
@@ -50,20 +50,6 @@
50#define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE } 50#define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
51#define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR 51#define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR
52 52
53#ifdef SNDRV_LEGACY_AUTO_PROBE
54static int snd_legacy_auto_probe(unsigned long *ports, int (*probe)(unsigned long port))
55{
56 int result = 0; /* number of detected cards */
57
58 while ((signed long)*ports != -1) {
59 if (probe(*ports) >= 0)
60 result++;
61 ports++;
62 }
63 return result;
64}
65#endif
66
67#ifdef SNDRV_LEGACY_FIND_FREE_IRQ 53#ifdef SNDRV_LEGACY_FIND_FREE_IRQ
68#include <linux/interrupt.h> 54#include <linux/interrupt.h>
69 55
diff --git a/include/sound/minors.h b/include/sound/minors.h
index a17b5c9961bb..46bcd2023ed8 100644
--- a/include/sound/minors.h
+++ b/include/sound/minors.h
@@ -26,18 +26,20 @@
26#define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f) 26#define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f)
27#define SNDRV_MINOR(card, dev) (((card) << 5) | (dev)) 27#define SNDRV_MINOR(card, dev) (((card) << 5) | (dev))
28 28
29#define SNDRV_MINOR_CONTROL 0 /* 0 - 0 */ 29/* these minors can still be used for autoloading devices (/dev/aload*) */
30#define SNDRV_MINOR_CONTROL 0 /* 0 */
30#define SNDRV_MINOR_GLOBAL 1 /* 1 */ 31#define SNDRV_MINOR_GLOBAL 1 /* 1 */
31#define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32) 32#define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32)
32#define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32) 33#define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32)
34
35#ifndef CONFIG_SND_DYNAMIC_MINORS
36 /* 2 - 3 (reserved) */
33#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ 37#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */
34#define SNDRV_MINOR_HWDEPS 4
35#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ 38#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */
36#define SNDRV_MINOR_RAWMIDIS 8
37#define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */ 39#define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */
38#define SNDRV_MINOR_PCM_CAPTURE 24 /* 24 - 31 */ 40#define SNDRV_MINOR_PCM_CAPTURE 24 /* 24 - 31 */
39#define SNDRV_MINOR_PCMS 8
40 41
42/* same as first respective minor number to make minor allocation easier */
41#define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL 43#define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL
42#define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP 44#define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP
43#define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI 45#define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI
@@ -46,6 +48,25 @@
46#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER 48#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER
47#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER 49#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER
48 50
51#else /* CONFIG_SND_DYNAMIC_MINORS */
52
53enum {
54 SNDRV_DEVICE_TYPE_CONTROL,
55 SNDRV_DEVICE_TYPE_SEQUENCER,
56 SNDRV_DEVICE_TYPE_TIMER,
57 SNDRV_DEVICE_TYPE_HWDEP,
58 SNDRV_DEVICE_TYPE_RAWMIDI,
59 SNDRV_DEVICE_TYPE_PCM_PLAYBACK,
60 SNDRV_DEVICE_TYPE_PCM_CAPTURE,
61};
62
63#endif /* CONFIG_SND_DYNAMIC_MINORS */
64
65#define SNDRV_MINOR_HWDEPS 4
66#define SNDRV_MINOR_RAWMIDIS 8
67#define SNDRV_MINOR_PCMS 8
68
69
49#ifdef CONFIG_SND_OSSEMUL 70#ifdef CONFIG_SND_OSSEMUL
50 71
51#define SNDRV_MINOR_OSS_DEVICES 16 72#define SNDRV_MINOR_OSS_DEVICES 16
diff --git a/include/sound/mixer_oss.h b/include/sound/mixer_oss.h
index ed75b2fb00ab..ca5b4822b62c 100644
--- a/include/sound/mixer_oss.h
+++ b/include/sound/mixer_oss.h
@@ -24,51 +24,53 @@
24 24
25#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 25#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
26 26
27typedef struct _snd_oss_mixer_slot snd_mixer_oss_slot_t;
28typedef struct _snd_oss_file snd_mixer_oss_file_t;
29
30typedef int (*snd_mixer_oss_get_volume_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int *left, int *right);
31typedef int (*snd_mixer_oss_put_volume_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int left, int right);
32typedef int (*snd_mixer_oss_get_recsrc_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int *active);
33typedef int (*snd_mixer_oss_put_recsrc_t)(snd_mixer_oss_file_t *fmixer, snd_mixer_oss_slot_t *chn, int active);
34typedef int (*snd_mixer_oss_get_recsrce_t)(snd_mixer_oss_file_t *fmixer, unsigned int *active_index);
35typedef int (*snd_mixer_oss_put_recsrce_t)(snd_mixer_oss_file_t *fmixer, unsigned int active_index);
36
37#define SNDRV_OSS_MAX_MIXERS 32 27#define SNDRV_OSS_MAX_MIXERS 32
38 28
39struct _snd_oss_mixer_slot { 29struct snd_mixer_oss_file;
30
31struct snd_mixer_oss_slot {
40 int number; 32 int number;
41 unsigned int stereo: 1; 33 unsigned int stereo: 1;
42 snd_mixer_oss_get_volume_t get_volume; 34 int (*get_volume)(struct snd_mixer_oss_file *fmixer,
43 snd_mixer_oss_put_volume_t put_volume; 35 struct snd_mixer_oss_slot *chn,
44 snd_mixer_oss_get_recsrc_t get_recsrc; 36 int *left, int *right);
45 snd_mixer_oss_put_recsrc_t put_recsrc; 37 int (*put_volume)(struct snd_mixer_oss_file *fmixer,
38 struct snd_mixer_oss_slot *chn,
39 int left, int right);
40 int (*get_recsrc)(struct snd_mixer_oss_file *fmixer,
41 struct snd_mixer_oss_slot *chn,
42 int *active);
43 int (*put_recsrc)(struct snd_mixer_oss_file *fmixer,
44 struct snd_mixer_oss_slot *chn,
45 int active);
46 unsigned long private_value; 46 unsigned long private_value;
47 void *private_data; 47 void *private_data;
48 void (*private_free)(snd_mixer_oss_slot_t *slot); 48 void (*private_free)(struct snd_mixer_oss_slot *slot);
49 int volume[2]; 49 int volume[2];
50}; 50};
51 51
52struct _snd_oss_mixer { 52struct snd_mixer_oss {
53 snd_card_t *card; 53 struct snd_card *card;
54 char id[16]; 54 char id[16];
55 char name[32]; 55 char name[32];
56 snd_mixer_oss_slot_t slots[SNDRV_OSS_MAX_MIXERS]; /* OSS mixer slots */ 56 struct snd_mixer_oss_slot slots[SNDRV_OSS_MAX_MIXERS]; /* OSS mixer slots */
57 unsigned int mask_recsrc; /* exclusive recsrc mask */ 57 unsigned int mask_recsrc; /* exclusive recsrc mask */
58 snd_mixer_oss_get_recsrce_t get_recsrc; 58 int (*get_recsrc)(struct snd_mixer_oss_file *fmixer,
59 snd_mixer_oss_put_recsrce_t put_recsrc; 59 unsigned int *active_index);
60 int (*put_recsrc)(struct snd_mixer_oss_file *fmixer,
61 unsigned int active_index);
60 void *private_data_recsrc; 62 void *private_data_recsrc;
61 void (*private_free_recsrc)(snd_mixer_oss_t *mixer); 63 void (*private_free_recsrc)(struct snd_mixer_oss *mixer);
62 struct semaphore reg_mutex; 64 struct semaphore reg_mutex;
63 snd_info_entry_t *proc_entry; 65 struct snd_info_entry *proc_entry;
64 int oss_dev_alloc; 66 int oss_dev_alloc;
65 /* --- */ 67 /* --- */
66 int oss_recsrc; 68 int oss_recsrc;
67}; 69};
68 70
69struct _snd_oss_file { 71struct snd_mixer_oss_file {
70 snd_card_t *card; 72 struct snd_card *card;
71 snd_mixer_oss_t *mixer; 73 struct snd_mixer_oss *mixer;
72}; 74};
73 75
74#endif /* CONFIG_SND_MIXER_OSS */ 76#endif /* CONFIG_SND_MIXER_OSS */
diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h
index ae39e38bf996..8e97ace78f16 100644
--- a/include/sound/mpu401.h
+++ b/include/sound/mpu401.h
@@ -58,10 +58,8 @@
58#define MPU401_MODE_INPUT_TIMER (1<<0) 58#define MPU401_MODE_INPUT_TIMER (1<<0)
59#define MPU401_MODE_OUTPUT_TIMER (1<<1) 59#define MPU401_MODE_OUTPUT_TIMER (1<<1)
60 60
61typedef struct _snd_mpu401 mpu401_t; 61struct snd_mpu401 {
62 62 struct snd_rawmidi *rmidi;
63struct _snd_mpu401 {
64 snd_rawmidi_t *rmidi;
65 63
66 unsigned short hardware; /* MPU401_HW_XXXX */ 64 unsigned short hardware; /* MPU401_HW_XXXX */
67 unsigned long port; /* base port of MPU-401 chip */ 65 unsigned long port; /* base port of MPU-401 chip */
@@ -73,14 +71,14 @@ struct _snd_mpu401 {
73 unsigned long mode; /* MPU401_MODE_XXXX */ 71 unsigned long mode; /* MPU401_MODE_XXXX */
74 int timer_invoked; 72 int timer_invoked;
75 73
76 int (*open_input) (mpu401_t * mpu); 74 int (*open_input) (struct snd_mpu401 * mpu);
77 void (*close_input) (mpu401_t * mpu); 75 void (*close_input) (struct snd_mpu401 * mpu);
78 int (*open_output) (mpu401_t * mpu); 76 int (*open_output) (struct snd_mpu401 * mpu);
79 void (*close_output) (mpu401_t * mpu); 77 void (*close_output) (struct snd_mpu401 * mpu);
80 void *private_data; 78 void *private_data;
81 79
82 snd_rawmidi_substream_t *substream_input; 80 struct snd_rawmidi_substream *substream_input;
83 snd_rawmidi_substream_t *substream_output; 81 struct snd_rawmidi_substream *substream_output;
84 82
85 spinlock_t input_lock; 83 spinlock_t input_lock;
86 spinlock_t output_lock; 84 spinlock_t output_lock;
@@ -88,8 +86,8 @@ struct _snd_mpu401 {
88 86
89 struct timer_list timer; 87 struct timer_list timer;
90 88
91 void (*write) (mpu401_t * mpu, unsigned char data, unsigned long addr); 89 void (*write) (struct snd_mpu401 * mpu, unsigned char data, unsigned long addr);
92 unsigned char (*read) (mpu401_t * mpu, unsigned long addr); 90 unsigned char (*read) (struct snd_mpu401 *mpu, unsigned long addr);
93}; 91};
94 92
95/* I/O ports */ 93/* I/O ports */
@@ -103,13 +101,13 @@ struct _snd_mpu401 {
103 101
104irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs); 102irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs);
105 103
106int snd_mpu401_uart_new(snd_card_t * card, 104int snd_mpu401_uart_new(struct snd_card *card,
107 int device, 105 int device,
108 unsigned short hardware, 106 unsigned short hardware,
109 unsigned long port, 107 unsigned long port,
110 int integrated, 108 int integrated,
111 int irq, 109 int irq,
112 int irq_flags, 110 int irq_flags,
113 snd_rawmidi_t ** rrawmidi); 111 struct snd_rawmidi ** rrawmidi);
114 112
115#endif /* __SOUND_MPU401_H */ 113#endif /* __SOUND_MPU401_H */
diff --git a/include/sound/opl3.h b/include/sound/opl3.h
index 19f657d4fc06..83392641cb47 100644
--- a/include/sound/opl3.h
+++ b/include/sound/opl3.h
@@ -237,12 +237,12 @@
237#define MAX_OPL2_VOICES 9 237#define MAX_OPL2_VOICES 9
238#define MAX_OPL3_VOICES 18 238#define MAX_OPL3_VOICES 18
239 239
240typedef struct snd_opl3 opl3_t; 240struct snd_opl3;
241 241
242/* 242/*
243 * A structure to keep track of each hardware voice 243 * A structure to keep track of each hardware voice
244 */ 244 */
245typedef struct snd_opl3_voice { 245struct snd_opl3_voice {
246 int state; /* status */ 246 int state; /* status */
247#define SNDRV_OPL3_ST_OFF 0 /* Not playing */ 247#define SNDRV_OPL3_ST_OFF 0 /* Not playing */
248#define SNDRV_OPL3_ST_ON_2OP 1 /* 2op voice is allocated */ 248#define SNDRV_OPL3_ST_ON_2OP 1 /* 2op voice is allocated */
@@ -257,8 +257,8 @@ typedef struct snd_opl3_voice {
257 257
258 unsigned char keyon_reg; /* KON register shadow */ 258 unsigned char keyon_reg; /* KON register shadow */
259 259
260 snd_midi_channel_t *chan; /* Midi channel for this note */ 260 struct snd_midi_channel *chan; /* Midi channel for this note */
261} snd_opl3_voice_t; 261};
262 262
263struct snd_opl3 { 263struct snd_opl3 {
264 unsigned long l_port; 264 unsigned long l_port;
@@ -267,18 +267,18 @@ struct snd_opl3 {
267 struct resource *res_r_port; 267 struct resource *res_r_port;
268 unsigned short hardware; 268 unsigned short hardware;
269 /* hardware access */ 269 /* hardware access */
270 void (*command) (opl3_t * opl3, unsigned short cmd, unsigned char val); 270 void (*command) (struct snd_opl3 * opl3, unsigned short cmd, unsigned char val);
271 unsigned short timer_enable; 271 unsigned short timer_enable;
272 int seq_dev_num; /* sequencer device number */ 272 int seq_dev_num; /* sequencer device number */
273 snd_timer_t *timer1; 273 struct snd_timer *timer1;
274 snd_timer_t *timer2; 274 struct snd_timer *timer2;
275 spinlock_t timer_lock; 275 spinlock_t timer_lock;
276 276
277 void *private_data; 277 void *private_data;
278 void (*private_free)(opl3_t *); 278 void (*private_free)(struct snd_opl3 *);
279 279
280 spinlock_t reg_lock; 280 spinlock_t reg_lock;
281 snd_card_t *card; /* The card that this belongs to */ 281 struct snd_card *card; /* The card that this belongs to */
282 int used; /* usage flag - exclusive */ 282 int used; /* usage flag - exclusive */
283 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */ 283 unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
284 unsigned char rhythm; /* percussion mode flag */ 284 unsigned char rhythm; /* percussion mode flag */
@@ -289,18 +289,18 @@ struct snd_opl3 {
289 int synth_mode; /* synth mode */ 289 int synth_mode; /* synth mode */
290 int seq_client; 290 int seq_client;
291 291
292 snd_seq_device_t *seq_dev; /* sequencer device */ 292 struct snd_seq_device *seq_dev; /* sequencer device */
293 snd_midi_channel_set_t * chset; 293 struct snd_midi_channel_set * chset;
294 294
295#ifdef CONFIG_SND_SEQUENCER_OSS 295#ifdef CONFIG_SND_SEQUENCER_OSS
296 snd_seq_device_t *oss_seq_dev; /* OSS sequencer device */ 296 struct snd_seq_device *oss_seq_dev; /* OSS sequencer device */
297 snd_midi_channel_set_t * oss_chset; 297 struct snd_midi_channel_set * oss_chset;
298#endif 298#endif
299 299
300 snd_seq_kinstr_ops_t fm_ops; 300 struct snd_seq_kinstr_ops fm_ops;
301 snd_seq_kinstr_list_t *ilist; 301 struct snd_seq_kinstr_list *ilist;
302 302
303 snd_opl3_voice_t voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */ 303 struct snd_opl3_voice voices[MAX_OPL3_VOICES]; /* Voices (OPL3 'channel') */
304 int use_time; /* allocation counter */ 304 int use_time; /* allocation counter */
305 305
306 unsigned short connection_reg; /* connection reg shadow */ 306 unsigned short connection_reg; /* connection reg shadow */
@@ -316,24 +316,25 @@ struct snd_opl3 {
316}; 316};
317 317
318/* opl3.c */ 318/* opl3.c */
319void snd_opl3_interrupt(snd_hwdep_t * hw); 319void snd_opl3_interrupt(struct snd_hwdep * hw);
320int snd_opl3_new(snd_card_t *card, unsigned short hardware, opl3_t **ropl3); 320int snd_opl3_new(struct snd_card *card, unsigned short hardware,
321int snd_opl3_init(opl3_t *opl3); 321 struct snd_opl3 **ropl3);
322int snd_opl3_create(snd_card_t * card, 322int snd_opl3_init(struct snd_opl3 *opl3);
323int snd_opl3_create(struct snd_card *card,
323 unsigned long l_port, unsigned long r_port, 324 unsigned long l_port, unsigned long r_port,
324 unsigned short hardware, 325 unsigned short hardware,
325 int integrated, 326 int integrated,
326 opl3_t ** opl3); 327 struct snd_opl3 ** opl3);
327int snd_opl3_timer_new(opl3_t * opl3, int timer1_dev, int timer2_dev); 328int snd_opl3_timer_new(struct snd_opl3 * opl3, int timer1_dev, int timer2_dev);
328int snd_opl3_hwdep_new(opl3_t * opl3, int device, int seq_device, 329int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device,
329 snd_hwdep_t ** rhwdep); 330 struct snd_hwdep ** rhwdep);
330 331
331/* opl3_synth */ 332/* opl3_synth */
332int snd_opl3_open(snd_hwdep_t * hw, struct file *file); 333int snd_opl3_open(struct snd_hwdep * hw, struct file *file);
333int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, 334int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file,
334 unsigned int cmd, unsigned long arg); 335 unsigned int cmd, unsigned long arg);
335int snd_opl3_release(snd_hwdep_t * hw, struct file *file); 336int snd_opl3_release(struct snd_hwdep * hw, struct file *file);
336 337
337void snd_opl3_reset(opl3_t * opl3); 338void snd_opl3_reset(struct snd_opl3 * opl3);
338 339
339#endif /* __SOUND_OPL3_H */ 340#endif /* __SOUND_OPL3_H */
diff --git a/include/sound/opl4.h b/include/sound/opl4.h
index 20c04428b139..60ae8454b3ce 100644
--- a/include/sound/opl4.h
+++ b/include/sound/opl4.h
@@ -22,11 +22,11 @@
22 22
23#include <sound/opl3.h> 23#include <sound/opl3.h>
24 24
25typedef struct opl4 opl4_t; 25struct snd_opl4;
26 26
27extern int snd_opl4_create(snd_card_t *card, 27extern int snd_opl4_create(struct snd_card *card,
28 unsigned long fm_port, unsigned long pcm_port, 28 unsigned long fm_port, unsigned long pcm_port,
29 int seq_device, 29 int seq_device,
30 opl3_t **opl3, opl4_t **opl4); 30 struct snd_opl3 **opl3, struct snd_opl4 **opl4);
31 31
32#endif /* __SOUND_OPL4_H */ 32#endif /* __SOUND_OPL4_H */
diff --git a/include/sound/pcm-indirect.h b/include/sound/pcm-indirect.h
index 31fa7a54508a..7003d7702e26 100644
--- a/include/sound/pcm-indirect.h
+++ b/include/sound/pcm-indirect.h
@@ -24,7 +24,7 @@
24 24
25#include <sound/pcm.h> 25#include <sound/pcm.h>
26 26
27typedef struct sndrv_pcm_indirect { 27struct snd_pcm_indirect {
28 unsigned int hw_buffer_size; /* Byte size of hardware buffer */ 28 unsigned int hw_buffer_size; /* Byte size of hardware buffer */
29 unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */ 29 unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */
30 unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */ 30 unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */
@@ -35,20 +35,20 @@ typedef struct sndrv_pcm_indirect {
35 unsigned int sw_io; /* Current software pointer in bytes */ 35 unsigned int sw_io; /* Current software pointer in bytes */
36 int sw_ready; /* Bytes ready to be transferred to/from hw */ 36 int sw_ready; /* Bytes ready to be transferred to/from hw */
37 snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */ 37 snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */
38} snd_pcm_indirect_t; 38};
39 39
40typedef void (*snd_pcm_indirect_copy_t)(snd_pcm_substream_t *substream, 40typedef void (*snd_pcm_indirect_copy_t)(struct snd_pcm_substream *substream,
41 snd_pcm_indirect_t *rec, size_t bytes); 41 struct snd_pcm_indirect *rec, size_t bytes);
42 42
43/* 43/*
44 * helper function for playback ack callback 44 * helper function for playback ack callback
45 */ 45 */
46static inline void 46static inline void
47snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream, 47snd_pcm_indirect_playback_transfer(struct snd_pcm_substream *substream,
48 snd_pcm_indirect_t *rec, 48 struct snd_pcm_indirect *rec,
49 snd_pcm_indirect_copy_t copy) 49 snd_pcm_indirect_copy_t copy)
50{ 50{
51 snd_pcm_runtime_t *runtime = substream->runtime; 51 struct snd_pcm_runtime *runtime = substream->runtime;
52 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr; 52 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
53 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr; 53 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
54 int qsize; 54 int qsize;
@@ -89,8 +89,8 @@ snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream,
89 * ptr = current byte pointer 89 * ptr = current byte pointer
90 */ 90 */
91static inline snd_pcm_uframes_t 91static inline snd_pcm_uframes_t
92snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream, 92snd_pcm_indirect_playback_pointer(struct snd_pcm_substream *substream,
93 snd_pcm_indirect_t *rec, unsigned int ptr) 93 struct snd_pcm_indirect *rec, unsigned int ptr)
94{ 94{
95 int bytes = ptr - rec->hw_io; 95 int bytes = ptr - rec->hw_io;
96 if (bytes < 0) 96 if (bytes < 0)
@@ -110,11 +110,11 @@ snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream,
110 * helper function for capture ack callback 110 * helper function for capture ack callback
111 */ 111 */
112static inline void 112static inline void
113snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream, 113snd_pcm_indirect_capture_transfer(struct snd_pcm_substream *substream,
114 snd_pcm_indirect_t *rec, 114 struct snd_pcm_indirect *rec,
115 snd_pcm_indirect_copy_t copy) 115 snd_pcm_indirect_copy_t copy)
116{ 116{
117 snd_pcm_runtime_t *runtime = substream->runtime; 117 struct snd_pcm_runtime *runtime = substream->runtime;
118 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr; 118 snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
119 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr; 119 snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
120 120
@@ -154,8 +154,8 @@ snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream,
154 * ptr = current byte pointer 154 * ptr = current byte pointer
155 */ 155 */
156static inline snd_pcm_uframes_t 156static inline snd_pcm_uframes_t
157snd_pcm_indirect_capture_pointer(snd_pcm_substream_t *substream, 157snd_pcm_indirect_capture_pointer(struct snd_pcm_substream *substream,
158 snd_pcm_indirect_t *rec, unsigned int ptr) 158 struct snd_pcm_indirect *rec, unsigned int ptr)
159{ 159{
160 int qsize; 160 int qsize;
161 int bytes = ptr - rec->hw_io; 161 int bytes = ptr - rec->hw_io;
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index acc4fa9d5abe..314268a11048 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -28,36 +28,9 @@
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <linux/bitops.h> 29#include <linux/bitops.h>
30 30
31typedef sndrv_pcm_uframes_t snd_pcm_uframes_t;
32typedef sndrv_pcm_sframes_t snd_pcm_sframes_t;
33typedef enum sndrv_pcm_class snd_pcm_class_t;
34typedef enum sndrv_pcm_subclass snd_pcm_subclass_t;
35typedef enum sndrv_pcm_stream snd_pcm_stream_t;
36typedef enum sndrv_pcm_access snd_pcm_access_t;
37typedef enum sndrv_pcm_format snd_pcm_format_t;
38typedef enum sndrv_pcm_subformat snd_pcm_subformat_t;
39typedef enum sndrv_pcm_state snd_pcm_state_t;
40typedef union sndrv_pcm_sync_id snd_pcm_sync_id_t;
41typedef struct sndrv_pcm_info snd_pcm_info_t;
42typedef enum sndrv_pcm_hw_param snd_pcm_hw_param_t;
43typedef struct sndrv_pcm_hw_params snd_pcm_hw_params_t;
44typedef enum sndrv_pcm_start snd_pcm_start_t;
45typedef enum sndrv_pcm_xrun snd_pcm_xrun_t;
46typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
47typedef struct sndrv_pcm_sw_params snd_pcm_sw_params_t;
48typedef struct sndrv_pcm_channel_info snd_pcm_channel_info_t;
49typedef struct sndrv_pcm_status snd_pcm_status_t;
50typedef struct sndrv_pcm_mmap_status snd_pcm_mmap_status_t;
51typedef struct sndrv_pcm_mmap_control snd_pcm_mmap_control_t;
52typedef struct sndrv_mask snd_mask_t;
53typedef struct snd_sg_buf snd_pcm_sgbuf_t;
54
55#define snd_pcm_substream_chip(substream) ((substream)->private_data) 31#define snd_pcm_substream_chip(substream) ((substream)->private_data)
56#define snd_pcm_chip(pcm) ((pcm)->private_data) 32#define snd_pcm_chip(pcm) ((pcm)->private_data)
57 33
58typedef struct _snd_pcm_file snd_pcm_file_t;
59typedef struct _snd_pcm_runtime snd_pcm_runtime_t;
60
61#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 34#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
62#include "pcm_oss.h" 35#include "pcm_oss.h"
63#endif 36#endif
@@ -66,7 +39,7 @@ typedef struct _snd_pcm_runtime snd_pcm_runtime_t;
66 * Hardware (lowlevel) section 39 * Hardware (lowlevel) section
67 */ 40 */
68 41
69typedef struct _snd_pcm_hardware { 42struct snd_pcm_hardware {
70 unsigned int info; /* SNDRV_PCM_INFO_* */ 43 unsigned int info; /* SNDRV_PCM_INFO_* */
71 u64 formats; /* SNDRV_PCM_FMTBIT_* */ 44 u64 formats; /* SNDRV_PCM_FMTBIT_* */
72 unsigned int rates; /* SNDRV_PCM_RATE_* */ 45 unsigned int rates; /* SNDRV_PCM_RATE_* */
@@ -80,26 +53,29 @@ typedef struct _snd_pcm_hardware {
80 unsigned int periods_min; /* min # of periods */ 53 unsigned int periods_min; /* min # of periods */
81 unsigned int periods_max; /* max # of periods */ 54 unsigned int periods_max; /* max # of periods */
82 size_t fifo_size; /* fifo size in bytes */ 55 size_t fifo_size; /* fifo size in bytes */
83} snd_pcm_hardware_t; 56};
84 57
85typedef struct _snd_pcm_ops { 58struct snd_pcm_ops {
86 int (*open)(snd_pcm_substream_t *substream); 59 int (*open)(struct snd_pcm_substream *substream);
87 int (*close)(snd_pcm_substream_t *substream); 60 int (*close)(struct snd_pcm_substream *substream);
88 int (*ioctl)(snd_pcm_substream_t * substream, 61 int (*ioctl)(struct snd_pcm_substream * substream,
89 unsigned int cmd, void *arg); 62 unsigned int cmd, void *arg);
90 int (*hw_params)(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * params); 63 int (*hw_params)(struct snd_pcm_substream *substream,
91 int (*hw_free)(snd_pcm_substream_t *substream); 64 struct snd_pcm_hw_params *params);
92 int (*prepare)(snd_pcm_substream_t * substream); 65 int (*hw_free)(struct snd_pcm_substream *substream);
93 int (*trigger)(snd_pcm_substream_t * substream, int cmd); 66 int (*prepare)(struct snd_pcm_substream *substream);
94 snd_pcm_uframes_t (*pointer)(snd_pcm_substream_t * substream); 67 int (*trigger)(struct snd_pcm_substream *substream, int cmd);
95 int (*copy)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos, 68 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
69 int (*copy)(struct snd_pcm_substream *substream, int channel,
70 snd_pcm_uframes_t pos,
96 void __user *buf, snd_pcm_uframes_t count); 71 void __user *buf, snd_pcm_uframes_t count);
97 int (*silence)(snd_pcm_substream_t *substream, int channel, 72 int (*silence)(struct snd_pcm_substream *substream, int channel,
98 snd_pcm_uframes_t pos, snd_pcm_uframes_t count); 73 snd_pcm_uframes_t pos, snd_pcm_uframes_t count);
99 struct page *(*page)(snd_pcm_substream_t *substream, unsigned long offset); 74 struct page *(*page)(struct snd_pcm_substream *substream,
100 int (*mmap)(snd_pcm_substream_t *substream, struct vm_area_struct *vma); 75 unsigned long offset);
101 int (*ack)(snd_pcm_substream_t *substream); 76 int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma);
102} snd_pcm_ops_t; 77 int (*ack)(struct snd_pcm_substream *substream);
78};
103 79
104/* 80/*
105 * 81 *
@@ -212,17 +188,16 @@ typedef struct _snd_pcm_ops {
212#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE 188#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE
213#endif 189#endif
214 190
215struct _snd_pcm_file { 191struct snd_pcm_file {
216 snd_pcm_substream_t * substream; 192 struct snd_pcm_substream *substream;
217 struct _snd_pcm_file * next; 193 struct snd_pcm_file *next;
218}; 194};
219 195
220typedef struct _snd_pcm_hw_rule snd_pcm_hw_rule_t; 196struct snd_pcm_hw_rule;
197typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *params,
198 struct snd_pcm_hw_rule *rule);
221 199
222typedef int (*snd_pcm_hw_rule_func_t)(snd_pcm_hw_params_t *params, 200struct snd_pcm_hw_rule {
223 snd_pcm_hw_rule_t *rule);
224
225struct _snd_pcm_hw_rule {
226 unsigned int cond; 201 unsigned int cond;
227 snd_pcm_hw_rule_func_t func; 202 snd_pcm_hw_rule_func_t func;
228 int var; 203 int var;
@@ -230,57 +205,57 @@ struct _snd_pcm_hw_rule {
230 void *private; 205 void *private;
231}; 206};
232 207
233typedef struct _snd_pcm_hw_constraints { 208struct snd_pcm_hw_constraints {
234 snd_mask_t masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 209 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
235 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; 210 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
236 snd_interval_t intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - 211 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
237 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; 212 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
238 unsigned int rules_num; 213 unsigned int rules_num;
239 unsigned int rules_all; 214 unsigned int rules_all;
240 snd_pcm_hw_rule_t *rules; 215 struct snd_pcm_hw_rule *rules;
241} snd_pcm_hw_constraints_t; 216};
242 217
243static inline snd_mask_t *constrs_mask(snd_pcm_hw_constraints_t *constrs, 218static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs,
244 snd_pcm_hw_param_t var) 219 snd_pcm_hw_param_t var)
245{ 220{
246 return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; 221 return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
247} 222}
248 223
249static inline snd_interval_t *constrs_interval(snd_pcm_hw_constraints_t *constrs, 224static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs,
250 snd_pcm_hw_param_t var) 225 snd_pcm_hw_param_t var)
251{ 226{
252 return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; 227 return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
253} 228}
254 229
255typedef struct { 230struct snd_ratnum {
256 unsigned int num; 231 unsigned int num;
257 unsigned int den_min, den_max, den_step; 232 unsigned int den_min, den_max, den_step;
258} ratnum_t; 233};
259 234
260typedef struct { 235struct snd_ratden {
261 unsigned int num_min, num_max, num_step; 236 unsigned int num_min, num_max, num_step;
262 unsigned int den; 237 unsigned int den;
263} ratden_t; 238};
264 239
265typedef struct { 240struct snd_pcm_hw_constraint_ratnums {
266 int nrats; 241 int nrats;
267 ratnum_t *rats; 242 struct snd_ratnum *rats;
268} snd_pcm_hw_constraint_ratnums_t; 243};
269 244
270typedef struct { 245struct snd_pcm_hw_constraint_ratdens {
271 int nrats; 246 int nrats;
272 ratden_t *rats; 247 struct snd_ratden *rats;
273} snd_pcm_hw_constraint_ratdens_t; 248};
274 249
275typedef struct { 250struct snd_pcm_hw_constraint_list {
276 unsigned int count; 251 unsigned int count;
277 unsigned int *list; 252 unsigned int *list;
278 unsigned int mask; 253 unsigned int mask;
279} snd_pcm_hw_constraint_list_t; 254};
280 255
281struct _snd_pcm_runtime { 256struct snd_pcm_runtime {
282 /* -- Status -- */ 257 /* -- Status -- */
283 snd_pcm_substream_t *trigger_master; 258 struct snd_pcm_substream *trigger_master;
284 struct timespec trigger_tstamp; /* trigger timestamp */ 259 struct timespec trigger_tstamp; /* trigger timestamp */
285 int overrange; 260 int overrange;
286 snd_pcm_uframes_t avail_max; 261 snd_pcm_uframes_t avail_max;
@@ -306,7 +281,7 @@ struct _snd_pcm_runtime {
306 unsigned int rate_den; 281 unsigned int rate_den;
307 282
308 /* -- SW params -- */ 283 /* -- SW params -- */
309 snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ 284 int tstamp_mode; /* mmap timestamp is updated */
310 unsigned int period_step; 285 unsigned int period_step;
311 unsigned int sleep_min; /* min ticks to sleep */ 286 unsigned int sleep_min; /* min ticks to sleep */
312 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */ 287 snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
@@ -320,11 +295,11 @@ struct _snd_pcm_runtime {
320 snd_pcm_uframes_t silence_start; /* starting pointer to silence area */ 295 snd_pcm_uframes_t silence_start; /* starting pointer to silence area */
321 snd_pcm_uframes_t silence_filled; /* size filled with silence */ 296 snd_pcm_uframes_t silence_filled; /* size filled with silence */
322 297
323 snd_pcm_sync_id_t sync; /* hardware synchronization ID */ 298 union snd_pcm_sync_id sync; /* hardware synchronization ID */
324 299
325 /* -- mmap -- */ 300 /* -- mmap -- */
326 volatile snd_pcm_mmap_status_t *status; 301 volatile struct snd_pcm_mmap_status *status;
327 volatile snd_pcm_mmap_control_t *control; 302 volatile struct snd_pcm_mmap_control *control;
328 atomic_t mmap_count; 303 atomic_t mmap_count;
329 304
330 /* -- locking / scheduling -- */ 305 /* -- locking / scheduling -- */
@@ -334,15 +309,15 @@ struct _snd_pcm_runtime {
334 309
335 /* -- private section -- */ 310 /* -- private section -- */
336 void *private_data; 311 void *private_data;
337 void (*private_free)(snd_pcm_runtime_t *runtime); 312 void (*private_free)(struct snd_pcm_runtime *runtime);
338 313
339 /* -- hardware description -- */ 314 /* -- hardware description -- */
340 snd_pcm_hardware_t hw; 315 struct snd_pcm_hardware hw;
341 snd_pcm_hw_constraints_t hw_constraints; 316 struct snd_pcm_hw_constraints hw_constraints;
342 317
343 /* -- interrupt callbacks -- */ 318 /* -- interrupt callbacks -- */
344 void (*transfer_ack_begin)(snd_pcm_substream_t *substream); 319 void (*transfer_ack_begin)(struct snd_pcm_substream *substream);
345 void (*transfer_ack_end)(snd_pcm_substream_t *substream); 320 void (*transfer_ack_end)(struct snd_pcm_substream *substream);
346 321
347 /* -- timer -- */ 322 /* -- timer -- */
348 unsigned int timer_resolution; /* timer resolution */ 323 unsigned int timer_resolution; /* timer resolution */
@@ -356,19 +331,19 @@ struct _snd_pcm_runtime {
356 331
357#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 332#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
358 /* -- OSS things -- */ 333 /* -- OSS things -- */
359 snd_pcm_oss_runtime_t oss; 334 struct snd_pcm_oss_runtime oss;
360#endif 335#endif
361}; 336};
362 337
363typedef struct _snd_pcm_group { /* keep linked substreams */ 338struct snd_pcm_group { /* keep linked substreams */
364 spinlock_t lock; 339 spinlock_t lock;
365 struct list_head substreams; 340 struct list_head substreams;
366 int count; 341 int count;
367} snd_pcm_group_t; 342};
368 343
369struct _snd_pcm_substream { 344struct snd_pcm_substream {
370 snd_pcm_t *pcm; 345 struct snd_pcm *pcm;
371 snd_pcm_str_t *pstr; 346 struct snd_pcm_str *pstr;
372 void *private_data; /* copied from pcm->private_data */ 347 void *private_data; /* copied from pcm->private_data */
373 int number; 348 int number;
374 char name[32]; /* substream name */ 349 char name[32]; /* substream name */
@@ -378,32 +353,32 @@ struct _snd_pcm_substream {
378 unsigned int dma_buf_id; 353 unsigned int dma_buf_id;
379 size_t dma_max; 354 size_t dma_max;
380 /* -- hardware operations -- */ 355 /* -- hardware operations -- */
381 snd_pcm_ops_t *ops; 356 struct snd_pcm_ops *ops;
382 /* -- runtime information -- */ 357 /* -- runtime information -- */
383 snd_pcm_runtime_t *runtime; 358 struct snd_pcm_runtime *runtime;
384 /* -- timer section -- */ 359 /* -- timer section -- */
385 snd_timer_t *timer; /* timer */ 360 struct snd_timer *timer; /* timer */
386 unsigned timer_running: 1; /* time is running */ 361 unsigned timer_running: 1; /* time is running */
387 spinlock_t timer_lock; 362 spinlock_t timer_lock;
388 /* -- next substream -- */ 363 /* -- next substream -- */
389 snd_pcm_substream_t *next; 364 struct snd_pcm_substream *next;
390 /* -- linked substreams -- */ 365 /* -- linked substreams -- */
391 struct list_head link_list; /* linked list member */ 366 struct list_head link_list; /* linked list member */
392 snd_pcm_group_t self_group; /* fake group for non linked substream (with substream lock inside) */ 367 struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */
393 snd_pcm_group_t *group; /* pointer to current group */ 368 struct snd_pcm_group *group; /* pointer to current group */
394 /* -- assigned files -- */ 369 /* -- assigned files -- */
395 snd_pcm_file_t *file; 370 struct snd_pcm_file *file;
396 struct file *ffile; 371 struct file *ffile;
397#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 372#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
398 /* -- OSS things -- */ 373 /* -- OSS things -- */
399 snd_pcm_oss_substream_t oss; 374 struct snd_pcm_oss_substream oss;
400#endif 375#endif
401 snd_info_entry_t *proc_root; 376 struct snd_info_entry *proc_root;
402 snd_info_entry_t *proc_info_entry; 377 struct snd_info_entry *proc_info_entry;
403 snd_info_entry_t *proc_hw_params_entry; 378 struct snd_info_entry *proc_hw_params_entry;
404 snd_info_entry_t *proc_sw_params_entry; 379 struct snd_info_entry *proc_sw_params_entry;
405 snd_info_entry_t *proc_status_entry; 380 struct snd_info_entry *proc_status_entry;
406 snd_info_entry_t *proc_prealloc_entry; 381 struct snd_info_entry *proc_prealloc_entry;
407 /* misc flags */ 382 /* misc flags */
408 unsigned int no_mmap_ctrl: 1; 383 unsigned int no_mmap_ctrl: 1;
409}; 384};
@@ -415,65 +390,64 @@ struct _snd_pcm_substream {
415#endif 390#endif
416 391
417 392
418struct _snd_pcm_str { 393struct snd_pcm_str {
419 int stream; /* stream (direction) */ 394 int stream; /* stream (direction) */
420 snd_pcm_t *pcm; 395 struct snd_pcm *pcm;
421 /* -- substreams -- */ 396 /* -- substreams -- */
422 unsigned int substream_count; 397 unsigned int substream_count;
423 unsigned int substream_opened; 398 unsigned int substream_opened;
424 snd_pcm_substream_t *substream; 399 struct snd_pcm_substream *substream;
425#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 400#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
426 /* -- OSS things -- */ 401 /* -- OSS things -- */
427 snd_pcm_oss_stream_t oss; 402 struct snd_pcm_oss_stream oss;
428#endif 403#endif
429 snd_pcm_file_t *files; 404 struct snd_pcm_file *files;
430 snd_minor_t *reg; 405 struct snd_info_entry *proc_root;
431 snd_info_entry_t *proc_root; 406 struct snd_info_entry *proc_info_entry;
432 snd_info_entry_t *proc_info_entry;
433#ifdef CONFIG_SND_DEBUG 407#ifdef CONFIG_SND_DEBUG
434 unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */ 408 unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */
435 snd_info_entry_t *proc_xrun_debug_entry; 409 struct snd_info_entry *proc_xrun_debug_entry;
436#endif 410#endif
437}; 411};
438 412
439struct _snd_pcm { 413struct snd_pcm {
440 snd_card_t *card; 414 struct snd_card *card;
415 struct list_head list;
441 unsigned int device; /* device number */ 416 unsigned int device; /* device number */
442 unsigned int info_flags; 417 unsigned int info_flags;
443 unsigned short dev_class; 418 unsigned short dev_class;
444 unsigned short dev_subclass; 419 unsigned short dev_subclass;
445 char id[64]; 420 char id[64];
446 char name[80]; 421 char name[80];
447 snd_pcm_str_t streams[2]; 422 struct snd_pcm_str streams[2];
448 struct semaphore open_mutex; 423 struct semaphore open_mutex;
449 wait_queue_head_t open_wait; 424 wait_queue_head_t open_wait;
450 void *private_data; 425 void *private_data;
451 void (*private_free) (snd_pcm_t *pcm); 426 void (*private_free) (struct snd_pcm *pcm);
452#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 427#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
453 snd_pcm_oss_t oss; 428 struct snd_pcm_oss oss;
454#endif 429#endif
455}; 430};
456 431
457typedef struct _snd_pcm_notify { 432struct snd_pcm_notify {
458 int (*n_register) (snd_pcm_t * pcm); 433 int (*n_register) (struct snd_pcm * pcm);
459 int (*n_disconnect) (snd_pcm_t * pcm); 434 int (*n_disconnect) (struct snd_pcm * pcm);
460 int (*n_unregister) (snd_pcm_t * pcm); 435 int (*n_unregister) (struct snd_pcm * pcm);
461 struct list_head list; 436 struct list_head list;
462} snd_pcm_notify_t; 437};
463 438
464/* 439/*
465 * Registering 440 * Registering
466 */ 441 */
467 442
468extern snd_pcm_t *snd_pcm_devices[]; 443extern struct file_operations snd_pcm_f_ops[2];
469extern snd_minor_t snd_pcm_reg[2];
470 444
471int snd_pcm_new(snd_card_t * card, char *id, int device, 445int snd_pcm_new(struct snd_card *card, char *id, int device,
472 int playback_count, int capture_count, 446 int playback_count, int capture_count,
473 snd_pcm_t **rpcm); 447 struct snd_pcm **rpcm);
474int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count); 448int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
475 449
476int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree); 450int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
477 451
478/* 452/*
479 * Native I/O 453 * Native I/O
@@ -481,24 +455,26 @@ int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree);
481 455
482extern rwlock_t snd_pcm_link_rwlock; 456extern rwlock_t snd_pcm_link_rwlock;
483 457
484int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info); 458int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info);
485int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user *info); 459int snd_pcm_info_user(struct snd_pcm_substream *substream,
486int snd_pcm_status(snd_pcm_substream_t * substream, snd_pcm_status_t *status); 460 struct snd_pcm_info __user *info);
487int snd_pcm_prepare(snd_pcm_substream_t *substream); 461int snd_pcm_status(struct snd_pcm_substream *substream,
488int snd_pcm_start(snd_pcm_substream_t *substream); 462 struct snd_pcm_status *status);
489int snd_pcm_stop(snd_pcm_substream_t *substream, int status); 463int snd_pcm_prepare(struct snd_pcm_substream *substream);
490int snd_pcm_drain_done(snd_pcm_substream_t *substream); 464int snd_pcm_start(struct snd_pcm_substream *substream);
465int snd_pcm_stop(struct snd_pcm_substream *substream, int status);
466int snd_pcm_drain_done(struct snd_pcm_substream *substream);
491#ifdef CONFIG_PM 467#ifdef CONFIG_PM
492int snd_pcm_suspend(snd_pcm_substream_t *substream); 468int snd_pcm_suspend(struct snd_pcm_substream *substream);
493int snd_pcm_suspend_all(snd_pcm_t *pcm); 469int snd_pcm_suspend_all(struct snd_pcm *pcm);
494#endif 470#endif
495int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); 471int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
496int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); 472int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
497int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg); 473int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
498int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, snd_pcm_substream_t **rsubstream); 474int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct snd_pcm_substream **rsubstream);
499void snd_pcm_release_substream(snd_pcm_substream_t *substream); 475void snd_pcm_release_substream(struct snd_pcm_substream *substream);
500void snd_pcm_vma_notify_data(void *client, void *data); 476void snd_pcm_vma_notify_data(void *client, void *data);
501int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file, struct vm_area_struct *area); 477int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
502 478
503#if BITS_PER_LONG >= 64 479#if BITS_PER_LONG >= 64
504 480
@@ -578,30 +554,30 @@ static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
578 * PCM library 554 * PCM library
579 */ 555 */
580 556
581static inline int snd_pcm_stream_linked(snd_pcm_substream_t *substream) 557static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
582{ 558{
583 return substream->group != &substream->self_group; 559 return substream->group != &substream->self_group;
584} 560}
585 561
586static inline void snd_pcm_stream_lock(snd_pcm_substream_t *substream) 562static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream)
587{ 563{
588 read_lock(&snd_pcm_link_rwlock); 564 read_lock(&snd_pcm_link_rwlock);
589 spin_lock(&substream->self_group.lock); 565 spin_lock(&substream->self_group.lock);
590} 566}
591 567
592static inline void snd_pcm_stream_unlock(snd_pcm_substream_t *substream) 568static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream)
593{ 569{
594 spin_unlock(&substream->self_group.lock); 570 spin_unlock(&substream->self_group.lock);
595 read_unlock(&snd_pcm_link_rwlock); 571 read_unlock(&snd_pcm_link_rwlock);
596} 572}
597 573
598static inline void snd_pcm_stream_lock_irq(snd_pcm_substream_t *substream) 574static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream)
599{ 575{
600 read_lock_irq(&snd_pcm_link_rwlock); 576 read_lock_irq(&snd_pcm_link_rwlock);
601 spin_lock(&substream->self_group.lock); 577 spin_lock(&substream->self_group.lock);
602} 578}
603 579
604static inline void snd_pcm_stream_unlock_irq(snd_pcm_substream_t *substream) 580static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream)
605{ 581{
606 spin_unlock(&substream->self_group.lock); 582 spin_unlock(&substream->self_group.lock);
607 read_unlock_irq(&snd_pcm_link_rwlock); 583 read_unlock_irq(&snd_pcm_link_rwlock);
@@ -623,56 +599,56 @@ do { \
623 list_for_each(pos, &substream->group->substreams) 599 list_for_each(pos, &substream->group->substreams)
624 600
625#define snd_pcm_group_substream_entry(pos) \ 601#define snd_pcm_group_substream_entry(pos) \
626 list_entry(pos, snd_pcm_substream_t, link_list) 602 list_entry(pos, struct snd_pcm_substream, link_list)
627 603
628static inline int snd_pcm_running(snd_pcm_substream_t *substream) 604static inline int snd_pcm_running(struct snd_pcm_substream *substream)
629{ 605{
630 return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING || 606 return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING ||
631 (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING && 607 (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING &&
632 substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); 608 substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
633} 609}
634 610
635static inline ssize_t bytes_to_samples(snd_pcm_runtime_t *runtime, ssize_t size) 611static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size)
636{ 612{
637 return size * 8 / runtime->sample_bits; 613 return size * 8 / runtime->sample_bits;
638} 614}
639 615
640static inline snd_pcm_sframes_t bytes_to_frames(snd_pcm_runtime_t *runtime, ssize_t size) 616static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size)
641{ 617{
642 return size * 8 / runtime->frame_bits; 618 return size * 8 / runtime->frame_bits;
643} 619}
644 620
645static inline ssize_t samples_to_bytes(snd_pcm_runtime_t *runtime, ssize_t size) 621static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size)
646{ 622{
647 return size * runtime->sample_bits / 8; 623 return size * runtime->sample_bits / 8;
648} 624}
649 625
650static inline ssize_t frames_to_bytes(snd_pcm_runtime_t *runtime, snd_pcm_sframes_t size) 626static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size)
651{ 627{
652 return size * runtime->frame_bits / 8; 628 return size * runtime->frame_bits / 8;
653} 629}
654 630
655static inline int frame_aligned(snd_pcm_runtime_t *runtime, ssize_t bytes) 631static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes)
656{ 632{
657 return bytes % runtime->byte_align == 0; 633 return bytes % runtime->byte_align == 0;
658} 634}
659 635
660static inline size_t snd_pcm_lib_buffer_bytes(snd_pcm_substream_t *substream) 636static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream)
661{ 637{
662 snd_pcm_runtime_t *runtime = substream->runtime; 638 struct snd_pcm_runtime *runtime = substream->runtime;
663 return frames_to_bytes(runtime, runtime->buffer_size); 639 return frames_to_bytes(runtime, runtime->buffer_size);
664} 640}
665 641
666static inline size_t snd_pcm_lib_period_bytes(snd_pcm_substream_t *substream) 642static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream)
667{ 643{
668 snd_pcm_runtime_t *runtime = substream->runtime; 644 struct snd_pcm_runtime *runtime = substream->runtime;
669 return frames_to_bytes(runtime, runtime->period_size); 645 return frames_to_bytes(runtime, runtime->period_size);
670} 646}
671 647
672/* 648/*
673 * result is: 0 ... (boundary - 1) 649 * result is: 0 ... (boundary - 1)
674 */ 650 */
675static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtime) 651static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime)
676{ 652{
677 snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr; 653 snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr;
678 if (avail < 0) 654 if (avail < 0)
@@ -685,7 +661,7 @@ static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtim
685/* 661/*
686 * result is: 0 ... (boundary - 1) 662 * result is: 0 ... (boundary - 1)
687 */ 663 */
688static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime) 664static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime)
689{ 665{
690 snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr; 666 snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr;
691 if (avail < 0) 667 if (avail < 0)
@@ -693,12 +669,12 @@ static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime
693 return avail; 669 return avail;
694} 670}
695 671
696static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(snd_pcm_runtime_t *runtime) 672static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime)
697{ 673{
698 return runtime->buffer_size - snd_pcm_playback_avail(runtime); 674 return runtime->buffer_size - snd_pcm_playback_avail(runtime);
699} 675}
700 676
701static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runtime) 677static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime)
702{ 678{
703 return runtime->buffer_size - snd_pcm_capture_avail(runtime); 679 return runtime->buffer_size - snd_pcm_capture_avail(runtime);
704} 680}
@@ -711,9 +687,9 @@ static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runt
711 * 687 *
712 * Returns non-zero if available, or zero if not. 688 * Returns non-zero if available, or zero if not.
713 */ 689 */
714static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream) 690static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream)
715{ 691{
716 snd_pcm_runtime_t *runtime = substream->runtime; 692 struct snd_pcm_runtime *runtime = substream->runtime;
717 return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min; 693 return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min;
718} 694}
719 695
@@ -725,9 +701,9 @@ static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream)
725 * 701 *
726 * Returns non-zero if available, or zero if not. 702 * Returns non-zero if available, or zero if not.
727 */ 703 */
728static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream) 704static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream)
729{ 705{
730 snd_pcm_runtime_t *runtime = substream->runtime; 706 struct snd_pcm_runtime *runtime = substream->runtime;
731 return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min; 707 return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min;
732} 708}
733 709
@@ -740,9 +716,9 @@ static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream)
740 * 716 *
741 * Returns non-zero if exists, or zero if not. 717 * Returns non-zero if exists, or zero if not.
742 */ 718 */
743static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream) 719static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream)
744{ 720{
745 snd_pcm_runtime_t *runtime = substream->runtime; 721 struct snd_pcm_runtime *runtime = substream->runtime;
746 722
747 if (runtime->stop_threshold >= runtime->boundary) 723 if (runtime->stop_threshold >= runtime->boundary)
748 return 1; 724 return 1;
@@ -757,9 +733,9 @@ static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream)
757 * 733 *
758 * Returns non-zero if empty, or zero if not. 734 * Returns non-zero if empty, or zero if not.
759 */ 735 */
760static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream) 736static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream)
761{ 737{
762 snd_pcm_runtime_t *runtime = substream->runtime; 738 struct snd_pcm_runtime *runtime = substream->runtime;
763 return snd_pcm_playback_avail(runtime) >= runtime->buffer_size; 739 return snd_pcm_playback_avail(runtime) >= runtime->buffer_size;
764} 740}
765 741
@@ -771,14 +747,14 @@ static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream)
771 * 747 *
772 * Returns non-zero if empty, or zero if not. 748 * Returns non-zero if empty, or zero if not.
773 */ 749 */
774static inline int snd_pcm_capture_empty(snd_pcm_substream_t *substream) 750static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream)
775{ 751{
776 snd_pcm_runtime_t *runtime = substream->runtime; 752 struct snd_pcm_runtime *runtime = substream->runtime;
777 return snd_pcm_capture_avail(runtime) == 0; 753 return snd_pcm_capture_avail(runtime) == 0;
778} 754}
779 755
780static inline void snd_pcm_trigger_done(snd_pcm_substream_t *substream, 756static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,
781 snd_pcm_substream_t *master) 757 struct snd_pcm_substream *master)
782{ 758{
783 substream->runtime->trigger_master = master; 759 substream->runtime->trigger_master = master;
784} 760}
@@ -795,28 +771,28 @@ static inline int hw_is_interval(int var)
795 var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; 771 var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
796} 772}
797 773
798static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params, 774static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params,
799 snd_pcm_hw_param_t var) 775 snd_pcm_hw_param_t var)
800{ 776{
801 return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; 777 return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
802} 778}
803 779
804static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params, 780static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params,
805 snd_pcm_hw_param_t var) 781 snd_pcm_hw_param_t var)
806{ 782{
807 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; 783 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
808} 784}
809 785
810static inline const snd_mask_t *hw_param_mask_c(const snd_pcm_hw_params_t *params, 786static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params,
811 snd_pcm_hw_param_t var) 787 snd_pcm_hw_param_t var)
812{ 788{
813 return (const snd_mask_t *)hw_param_mask((snd_pcm_hw_params_t*) params, var); 789 return (const struct snd_mask *)hw_param_mask((struct snd_pcm_hw_params*) params, var);
814} 790}
815 791
816static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_t *params, 792static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params,
817 snd_pcm_hw_param_t var) 793 snd_pcm_hw_param_t var)
818{ 794{
819 return (const snd_interval_t *)hw_param_interval((snd_pcm_hw_params_t*) params, var); 795 return (const struct snd_interval *)hw_param_interval((struct snd_pcm_hw_params*) params, var);
820} 796}
821 797
822#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) 798#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS))
@@ -832,66 +808,66 @@ static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_
832#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min 808#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min
833 809
834 810
835int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v); 811int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
836void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); 812void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
837void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); 813void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
838void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, 814void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b,
839 unsigned int k, snd_interval_t *c); 815 unsigned int k, struct snd_interval *c);
840void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, 816void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
841 const snd_interval_t *b, snd_interval_t *c); 817 const struct snd_interval *b, struct snd_interval *c);
842int snd_interval_list(snd_interval_t *i, unsigned int count, unsigned int *list, unsigned int mask); 818int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask);
843int snd_interval_ratnum(snd_interval_t *i, 819int snd_interval_ratnum(struct snd_interval *i,
844 unsigned int rats_count, ratnum_t *rats, 820 unsigned int rats_count, struct snd_ratnum *rats,
845 unsigned int *nump, unsigned int *denp); 821 unsigned int *nump, unsigned int *denp);
846 822
847void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params); 823void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params);
848void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var); 824void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var);
849int snd_pcm_hw_param_near(snd_pcm_substream_t *substream, 825int snd_pcm_hw_param_near(struct snd_pcm_substream *substream,
850 snd_pcm_hw_params_t *params, 826 struct snd_pcm_hw_params *params,
851 snd_pcm_hw_param_t var, 827 snd_pcm_hw_param_t var,
852 unsigned int val, int *dir); 828 unsigned int val, int *dir);
853int snd_pcm_hw_param_set(snd_pcm_substream_t *pcm, 829int snd_pcm_hw_param_set(struct snd_pcm_substream *pcm,
854 snd_pcm_hw_params_t *params, 830 struct snd_pcm_hw_params *params,
855 snd_pcm_hw_param_t var, 831 snd_pcm_hw_param_t var,
856 unsigned int val, int dir); 832 unsigned int val, int dir);
857int snd_pcm_hw_params_choose(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); 833int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
858 834
859int snd_pcm_hw_refine(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params); 835int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
860 836
861int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream); 837int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream);
862int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream); 838int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream);
863 839
864int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 840int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
865 u_int32_t mask); 841 u_int32_t mask);
866int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 842int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
867 u_int64_t mask); 843 u_int64_t mask);
868int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 844int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
869 unsigned int min, unsigned int max); 845 unsigned int min, unsigned int max);
870int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var); 846int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var);
871int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, 847int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,
872 unsigned int cond, 848 unsigned int cond,
873 snd_pcm_hw_param_t var, 849 snd_pcm_hw_param_t var,
874 snd_pcm_hw_constraint_list_t *l); 850 struct snd_pcm_hw_constraint_list *l);
875int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, 851int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime,
876 unsigned int cond, 852 unsigned int cond,
877 snd_pcm_hw_param_t var, 853 snd_pcm_hw_param_t var,
878 snd_pcm_hw_constraint_ratnums_t *r); 854 struct snd_pcm_hw_constraint_ratnums *r);
879int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, 855int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime,
880 unsigned int cond, 856 unsigned int cond,
881 snd_pcm_hw_param_t var, 857 snd_pcm_hw_param_t var,
882 snd_pcm_hw_constraint_ratdens_t *r); 858 struct snd_pcm_hw_constraint_ratdens *r);
883int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, 859int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime,
884 unsigned int cond, 860 unsigned int cond,
885 unsigned int width, 861 unsigned int width,
886 unsigned int msbits); 862 unsigned int msbits);
887int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, 863int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime,
888 unsigned int cond, 864 unsigned int cond,
889 snd_pcm_hw_param_t var, 865 snd_pcm_hw_param_t var,
890 unsigned long step); 866 unsigned long step);
891int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, 867int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime,
892 unsigned int cond, 868 unsigned int cond,
893 snd_pcm_hw_param_t var); 869 snd_pcm_hw_param_t var);
894int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, 870int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime,
895 unsigned int cond, 871 unsigned int cond,
896 int var, 872 int var,
897 snd_pcm_hw_rule_func_t func, void *private, 873 snd_pcm_hw_rule_func_t func, void *private,
@@ -925,37 +901,37 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int
925snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); 901snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian);
926const char *snd_pcm_format_name(snd_pcm_format_t format); 902const char *snd_pcm_format_name(snd_pcm_format_t format);
927 903
928void snd_pcm_set_ops(snd_pcm_t * pcm, int direction, snd_pcm_ops_t *ops); 904void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops);
929void snd_pcm_set_sync(snd_pcm_substream_t * substream); 905void snd_pcm_set_sync(struct snd_pcm_substream *substream);
930int snd_pcm_lib_interleave_len(snd_pcm_substream_t *substream); 906int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
931int snd_pcm_lib_ioctl(snd_pcm_substream_t *substream, 907int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
932 unsigned int cmd, void *arg); 908 unsigned int cmd, void *arg);
933int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream); 909int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
934int snd_pcm_playback_xrun_check(snd_pcm_substream_t *substream); 910int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);
935int snd_pcm_capture_xrun_check(snd_pcm_substream_t *substream); 911int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);
936int snd_pcm_playback_xrun_asap(snd_pcm_substream_t *substream); 912int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);
937int snd_pcm_capture_xrun_asap(snd_pcm_substream_t *substream); 913int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream);
938void snd_pcm_playback_silence(snd_pcm_substream_t *substream, snd_pcm_uframes_t new_hw_ptr); 914void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);
939void snd_pcm_tick_prepare(snd_pcm_substream_t *substream); 915void snd_pcm_tick_prepare(struct snd_pcm_substream *substream);
940void snd_pcm_tick_set(snd_pcm_substream_t *substream, unsigned long ticks); 916void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks);
941void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream); 917void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream);
942void snd_pcm_period_elapsed(snd_pcm_substream_t *substream); 918void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
943snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, 919snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream,
944 const void __user *buf, 920 const void __user *buf,
945 snd_pcm_uframes_t frames); 921 snd_pcm_uframes_t frames);
946snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, 922snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream,
947 void __user *buf, snd_pcm_uframes_t frames); 923 void __user *buf, snd_pcm_uframes_t frames);
948snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, 924snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream,
949 void __user **bufs, snd_pcm_uframes_t frames); 925 void __user **bufs, snd_pcm_uframes_t frames);
950snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, 926snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream,
951 void __user **bufs, snd_pcm_uframes_t frames); 927 void __user **bufs, snd_pcm_uframes_t frames);
952 928
953int snd_pcm_limit_hw_rates(snd_pcm_runtime_t *runtime); 929int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime);
954 930
955static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream, 931static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream,
956 struct snd_dma_buffer *bufp) 932 struct snd_dma_buffer *bufp)
957{ 933{
958 snd_pcm_runtime_t *runtime = substream->runtime; 934 struct snd_pcm_runtime *runtime = substream->runtime;
959 if (bufp) { 935 if (bufp) {
960 runtime->dma_buffer_p = bufp; 936 runtime->dma_buffer_p = bufp;
961 runtime->dma_area = bufp->area; 937 runtime->dma_area = bufp->area;
@@ -973,47 +949,47 @@ static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream,
973 * Timer interface 949 * Timer interface
974 */ 950 */
975 951
976void snd_pcm_timer_resolution_change(snd_pcm_substream_t *substream); 952void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
977void snd_pcm_timer_init(snd_pcm_substream_t * substream); 953void snd_pcm_timer_init(struct snd_pcm_substream *substream);
978void snd_pcm_timer_done(snd_pcm_substream_t * substream); 954void snd_pcm_timer_done(struct snd_pcm_substream *substream);
979 955
980/* 956/*
981 * Memory 957 * Memory
982 */ 958 */
983 959
984int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream); 960int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream);
985int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm); 961int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm);
986int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream, 962int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
987 int type, struct device *data, 963 int type, struct device *data,
988 size_t size, size_t max); 964 size_t size, size_t max);
989int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm, 965int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
990 int type, void *data, 966 int type, void *data,
991 size_t size, size_t max); 967 size_t size, size_t max);
992int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size); 968int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
993int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream); 969int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
994 970
995#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data) 971#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data)
996#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size) 972#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size)
997#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs) 973#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs)
998struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset); 974struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset);
999 975
1000/* handle mmap counter - PCM mmap callback should handle this counter properly */ 976/* handle mmap counter - PCM mmap callback should handle this counter properly */
1001static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 977static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
1002{ 978{
1003 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; 979 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
1004 atomic_inc(&substream->runtime->mmap_count); 980 atomic_inc(&substream->runtime->mmap_count);
1005} 981}
1006 982
1007static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) 983static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area)
1008{ 984{
1009 snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data; 985 struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
1010 atomic_dec(&substream->runtime->mmap_count); 986 atomic_dec(&substream->runtime->mmap_count);
1011} 987}
1012 988
1013/* mmap for io-memory area */ 989/* mmap for io-memory area */
1014#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA) 990#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA)
1015#define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP 991#define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP
1016int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct *area); 992int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area);
1017#else 993#else
1018#define SNDRV_PCM_INFO_MMAP_IOMEM 0 994#define SNDRV_PCM_INFO_MMAP_IOMEM 0
1019#define snd_pcm_lib_mmap_iomem NULL 995#define snd_pcm_lib_mmap_iomem NULL
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
index 0b67c9d105af..fddaddde47b4 100644
--- a/include/sound/pcm_oss.h
+++ b/include/sound/pcm_oss.h
@@ -22,10 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25typedef struct _snd_pcm_plugin snd_pcm_plugin_t; 25struct snd_pcm_oss_setup {
26typedef struct _snd_pcm_oss_setup snd_pcm_oss_setup_t;
27
28struct _snd_pcm_oss_setup {
29 char *task_name; 26 char *task_name;
30 unsigned int disable:1, 27 unsigned int disable:1,
31 direct:1, 28 direct:1,
@@ -36,10 +33,10 @@ struct _snd_pcm_oss_setup {
36 buggyptr:1; 33 buggyptr:1;
37 unsigned int periods; 34 unsigned int periods;
38 unsigned int period_size; 35 unsigned int period_size;
39 snd_pcm_oss_setup_t *next; 36 struct snd_pcm_oss_setup *next;
40}; 37};
41 38
42typedef struct _snd_pcm_oss_runtime { 39struct snd_pcm_oss_runtime {
43 unsigned params: 1, /* format/parameter change */ 40 unsigned params: 1, /* format/parameter change */
44 prepare: 1, /* need to prepare the operation */ 41 prepare: 1, /* need to prepare the operation */
45 trigger: 1, /* trigger flag */ 42 trigger: 1, /* trigger flag */
@@ -59,30 +56,30 @@ typedef struct _snd_pcm_oss_runtime {
59 size_t mmap_bytes; 56 size_t mmap_bytes;
60 char *buffer; /* vmallocated period */ 57 char *buffer; /* vmallocated period */
61 size_t buffer_used; /* used length from period buffer */ 58 size_t buffer_used; /* used length from period buffer */
62 snd_pcm_plugin_t *plugin_first; 59 struct snd_pcm_plugin *plugin_first;
63 snd_pcm_plugin_t *plugin_last; 60 struct snd_pcm_plugin *plugin_last;
64 unsigned int prev_hw_ptr_interrupt; 61 unsigned int prev_hw_ptr_interrupt;
65} snd_pcm_oss_runtime_t; 62};
66 63
67typedef struct _snd_pcm_oss_file { 64struct snd_pcm_oss_file {
68 snd_pcm_substream_t *streams[2]; 65 struct snd_pcm_substream *streams[2];
69} snd_pcm_oss_file_t; 66};
70 67
71typedef struct _snd_pcm_oss_substream { 68struct snd_pcm_oss_substream {
72 unsigned oss: 1; /* oss mode */ 69 unsigned oss: 1; /* oss mode */
73 snd_pcm_oss_setup_t *setup; /* active setup */ 70 struct snd_pcm_oss_setup *setup; /* active setup */
74 snd_pcm_oss_file_t *file; 71 struct snd_pcm_oss_file *file;
75} snd_pcm_oss_substream_t; 72};
76 73
77typedef struct _snd_pcm_oss_stream { 74struct snd_pcm_oss_stream {
78 snd_pcm_oss_setup_t *setup_list; /* setup list */ 75 struct snd_pcm_oss_setup *setup_list; /* setup list */
79 struct semaphore setup_mutex; 76 struct semaphore setup_mutex;
80 snd_info_entry_t *proc_entry; 77 struct snd_info_entry *proc_entry;
81} snd_pcm_oss_stream_t; 78};
82 79
83typedef struct _snd_pcm_oss { 80struct snd_pcm_oss {
84 int reg; 81 int reg;
85 unsigned int reg_mask; 82 unsigned int reg_mask;
86} snd_pcm_oss_t; 83};
87 84
88#endif /* __SOUND_PCM_OSS_H */ 85#endif /* __SOUND_PCM_OSS_H */
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index 60b0e92e26f3..fb18aef77341 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -22,17 +22,17 @@
22 * 22 *
23 */ 23 */
24 24
25extern int snd_pcm_hw_param_mask(snd_pcm_substream_t *pcm, snd_pcm_hw_params_t *params, 25extern int snd_pcm_hw_param_mask(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
26 snd_pcm_hw_param_t var, const snd_mask_t *val); 26 snd_pcm_hw_param_t var, const struct snd_mask *val);
27extern unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params, 27extern unsigned int snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params,
28 snd_pcm_hw_param_t var, int *dir); 28 snd_pcm_hw_param_t var, int *dir);
29extern unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params, 29extern unsigned int snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params,
30 snd_pcm_hw_param_t var, int *dir); 30 snd_pcm_hw_param_t var, int *dir);
31extern int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params, 31extern int _snd_pcm_hw_param_min(struct snd_pcm_hw_params *params,
32 snd_pcm_hw_param_t var, unsigned int val, int dir); 32 snd_pcm_hw_param_t var, unsigned int val, int dir);
33extern int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params, 33extern int _snd_pcm_hw_param_setinteger(struct snd_pcm_hw_params *params,
34 snd_pcm_hw_param_t var); 34 snd_pcm_hw_param_t var);
35extern int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, 35extern int _snd_pcm_hw_param_set(struct snd_pcm_hw_params *params,
36 snd_pcm_hw_param_t var, unsigned int val, int dir); 36 snd_pcm_hw_param_t var, unsigned int val, int dir);
37 37
38/* To share the same code we have alsa-lib */ 38/* To share the same code we have alsa-lib */
@@ -71,20 +71,20 @@ INLINE unsigned int ld2(u_int32_t v)
71 71
72INLINE size_t snd_mask_sizeof(void) 72INLINE size_t snd_mask_sizeof(void)
73{ 73{
74 return sizeof(snd_mask_t); 74 return sizeof(struct snd_mask);
75} 75}
76 76
77INLINE void snd_mask_none(snd_mask_t *mask) 77INLINE void snd_mask_none(struct snd_mask *mask)
78{ 78{
79 memset(mask, 0, sizeof(*mask)); 79 memset(mask, 0, sizeof(*mask));
80} 80}
81 81
82INLINE void snd_mask_any(snd_mask_t *mask) 82INLINE void snd_mask_any(struct snd_mask *mask)
83{ 83{
84 memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t)); 84 memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t));
85} 85}
86 86
87INLINE int snd_mask_empty(const snd_mask_t *mask) 87INLINE int snd_mask_empty(const struct snd_mask *mask)
88{ 88{
89 int i; 89 int i;
90 for (i = 0; i < SNDRV_MASK_SIZE; i++) 90 for (i = 0; i < SNDRV_MASK_SIZE; i++)
@@ -93,7 +93,7 @@ INLINE int snd_mask_empty(const snd_mask_t *mask)
93 return 1; 93 return 1;
94} 94}
95 95
96INLINE unsigned int snd_mask_min(const snd_mask_t *mask) 96INLINE unsigned int snd_mask_min(const struct snd_mask *mask)
97{ 97{
98 int i; 98 int i;
99 assert(!snd_mask_empty(mask)); 99 assert(!snd_mask_empty(mask));
@@ -104,7 +104,7 @@ INLINE unsigned int snd_mask_min(const snd_mask_t *mask)
104 return 0; 104 return 0;
105} 105}
106 106
107INLINE unsigned int snd_mask_max(const snd_mask_t *mask) 107INLINE unsigned int snd_mask_max(const struct snd_mask *mask)
108{ 108{
109 int i; 109 int i;
110 assert(!snd_mask_empty(mask)); 110 assert(!snd_mask_empty(mask));
@@ -115,19 +115,19 @@ INLINE unsigned int snd_mask_max(const snd_mask_t *mask)
115 return 0; 115 return 0;
116} 116}
117 117
118INLINE void snd_mask_set(snd_mask_t *mask, unsigned int val) 118INLINE void snd_mask_set(struct snd_mask *mask, unsigned int val)
119{ 119{
120 assert(val <= SNDRV_MASK_BITS); 120 assert(val <= SNDRV_MASK_BITS);
121 mask->bits[MASK_OFS(val)] |= MASK_BIT(val); 121 mask->bits[MASK_OFS(val)] |= MASK_BIT(val);
122} 122}
123 123
124INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val) 124INLINE void snd_mask_reset(struct snd_mask *mask, unsigned int val)
125{ 125{
126 assert(val <= SNDRV_MASK_BITS); 126 assert(val <= SNDRV_MASK_BITS);
127 mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val); 127 mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val);
128} 128}
129 129
130INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to) 130INLINE void snd_mask_set_range(struct snd_mask *mask, unsigned int from, unsigned int to)
131{ 131{
132 unsigned int i; 132 unsigned int i;
133 assert(to <= SNDRV_MASK_BITS && from <= to); 133 assert(to <= SNDRV_MASK_BITS && from <= to);
@@ -135,7 +135,7 @@ INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int
135 mask->bits[MASK_OFS(i)] |= MASK_BIT(i); 135 mask->bits[MASK_OFS(i)] |= MASK_BIT(i);
136} 136}
137 137
138INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to) 138INLINE void snd_mask_reset_range(struct snd_mask *mask, unsigned int from, unsigned int to)
139{ 139{
140 unsigned int i; 140 unsigned int i;
141 assert(to <= SNDRV_MASK_BITS && from <= to); 141 assert(to <= SNDRV_MASK_BITS && from <= to);
@@ -143,7 +143,7 @@ INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned i
143 mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i); 143 mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i);
144} 144}
145 145
146INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val) 146INLINE void snd_mask_leave(struct snd_mask *mask, unsigned int val)
147{ 147{
148 unsigned int v; 148 unsigned int v;
149 assert(val <= SNDRV_MASK_BITS); 149 assert(val <= SNDRV_MASK_BITS);
@@ -152,30 +152,30 @@ INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val)
152 mask->bits[MASK_OFS(val)] = v; 152 mask->bits[MASK_OFS(val)] = v;
153} 153}
154 154
155INLINE void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v) 155INLINE void snd_mask_intersect(struct snd_mask *mask, const struct snd_mask *v)
156{ 156{
157 int i; 157 int i;
158 for (i = 0; i < SNDRV_MASK_SIZE; i++) 158 for (i = 0; i < SNDRV_MASK_SIZE; i++)
159 mask->bits[i] &= v->bits[i]; 159 mask->bits[i] &= v->bits[i];
160} 160}
161 161
162INLINE int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v) 162INLINE int snd_mask_eq(const struct snd_mask *mask, const struct snd_mask *v)
163{ 163{
164 return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t)); 164 return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t));
165} 165}
166 166
167INLINE void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v) 167INLINE void snd_mask_copy(struct snd_mask *mask, const struct snd_mask *v)
168{ 168{
169 *mask = *v; 169 *mask = *v;
170} 170}
171 171
172INLINE int snd_mask_test(const snd_mask_t *mask, unsigned int val) 172INLINE int snd_mask_test(const struct snd_mask *mask, unsigned int val)
173{ 173{
174 assert(val <= SNDRV_MASK_BITS); 174 assert(val <= SNDRV_MASK_BITS);
175 return mask->bits[MASK_OFS(val)] & MASK_BIT(val); 175 return mask->bits[MASK_OFS(val)] & MASK_BIT(val);
176} 176}
177 177
178INLINE int snd_mask_single(const snd_mask_t *mask) 178INLINE int snd_mask_single(const struct snd_mask *mask)
179{ 179{
180 int i, c = 0; 180 int i, c = 0;
181 assert(!snd_mask_empty(mask)); 181 assert(!snd_mask_empty(mask));
@@ -191,9 +191,9 @@ INLINE int snd_mask_single(const snd_mask_t *mask)
191 return 1; 191 return 1;
192} 192}
193 193
194INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v) 194INLINE int snd_mask_refine(struct snd_mask *mask, const struct snd_mask *v)
195{ 195{
196 snd_mask_t old; 196 struct snd_mask old;
197 assert(!snd_mask_empty(mask)); 197 assert(!snd_mask_empty(mask));
198 snd_mask_copy(&old, mask); 198 snd_mask_copy(&old, mask);
199 snd_mask_intersect(mask, v); 199 snd_mask_intersect(mask, v);
@@ -202,7 +202,7 @@ INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v)
202 return !snd_mask_eq(mask, &old); 202 return !snd_mask_eq(mask, &old);
203} 203}
204 204
205INLINE int snd_mask_refine_first(snd_mask_t *mask) 205INLINE int snd_mask_refine_first(struct snd_mask *mask)
206{ 206{
207 assert(!snd_mask_empty(mask)); 207 assert(!snd_mask_empty(mask));
208 if (snd_mask_single(mask)) 208 if (snd_mask_single(mask))
@@ -211,7 +211,7 @@ INLINE int snd_mask_refine_first(snd_mask_t *mask)
211 return 1; 211 return 1;
212} 212}
213 213
214INLINE int snd_mask_refine_last(snd_mask_t *mask) 214INLINE int snd_mask_refine_last(struct snd_mask *mask)
215{ 215{
216 assert(!snd_mask_empty(mask)); 216 assert(!snd_mask_empty(mask));
217 if (snd_mask_single(mask)) 217 if (snd_mask_single(mask))
@@ -220,7 +220,7 @@ INLINE int snd_mask_refine_last(snd_mask_t *mask)
220 return 1; 220 return 1;
221} 221}
222 222
223INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val) 223INLINE int snd_mask_refine_min(struct snd_mask *mask, unsigned int val)
224{ 224{
225 assert(!snd_mask_empty(mask)); 225 assert(!snd_mask_empty(mask));
226 if (snd_mask_min(mask) >= val) 226 if (snd_mask_min(mask) >= val)
@@ -231,7 +231,7 @@ INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val)
231 return 1; 231 return 1;
232} 232}
233 233
234INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val) 234INLINE int snd_mask_refine_max(struct snd_mask *mask, unsigned int val)
235{ 235{
236 assert(!snd_mask_empty(mask)); 236 assert(!snd_mask_empty(mask));
237 if (snd_mask_max(mask) <= val) 237 if (snd_mask_max(mask) <= val)
@@ -242,7 +242,7 @@ INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val)
242 return 1; 242 return 1;
243} 243}
244 244
245INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val) 245INLINE int snd_mask_refine_set(struct snd_mask *mask, unsigned int val)
246{ 246{
247 int changed; 247 int changed;
248 assert(!snd_mask_empty(mask)); 248 assert(!snd_mask_empty(mask));
@@ -253,13 +253,13 @@ INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val)
253 return changed; 253 return changed;
254} 254}
255 255
256INLINE int snd_mask_value(const snd_mask_t *mask) 256INLINE int snd_mask_value(const struct snd_mask *mask)
257{ 257{
258 assert(!snd_mask_empty(mask)); 258 assert(!snd_mask_empty(mask));
259 return snd_mask_min(mask); 259 return snd_mask_min(mask);
260} 260}
261 261
262INLINE void snd_interval_any(snd_interval_t *i) 262INLINE void snd_interval_any(struct snd_interval *i)
263{ 263{
264 i->min = 0; 264 i->min = 0;
265 i->openmin = 0; 265 i->openmin = 0;
@@ -269,42 +269,42 @@ INLINE void snd_interval_any(snd_interval_t *i)
269 i->empty = 0; 269 i->empty = 0;
270} 270}
271 271
272INLINE void snd_interval_none(snd_interval_t *i) 272INLINE void snd_interval_none(struct snd_interval *i)
273{ 273{
274 i->empty = 1; 274 i->empty = 1;
275} 275}
276 276
277INLINE int snd_interval_checkempty(const snd_interval_t *i) 277INLINE int snd_interval_checkempty(const struct snd_interval *i)
278{ 278{
279 return (i->min > i->max || 279 return (i->min > i->max ||
280 (i->min == i->max && (i->openmin || i->openmax))); 280 (i->min == i->max && (i->openmin || i->openmax)));
281} 281}
282 282
283INLINE int snd_interval_empty(const snd_interval_t *i) 283INLINE int snd_interval_empty(const struct snd_interval *i)
284{ 284{
285 return i->empty; 285 return i->empty;
286} 286}
287 287
288INLINE int snd_interval_single(const snd_interval_t *i) 288INLINE int snd_interval_single(const struct snd_interval *i)
289{ 289{
290 assert(!snd_interval_empty(i)); 290 assert(!snd_interval_empty(i));
291 return (i->min == i->max || 291 return (i->min == i->max ||
292 (i->min + 1 == i->max && i->openmax)); 292 (i->min + 1 == i->max && i->openmax));
293} 293}
294 294
295INLINE int snd_interval_value(const snd_interval_t *i) 295INLINE int snd_interval_value(const struct snd_interval *i)
296{ 296{
297 assert(snd_interval_single(i)); 297 assert(snd_interval_single(i));
298 return i->min; 298 return i->min;
299} 299}
300 300
301INLINE int snd_interval_min(const snd_interval_t *i) 301INLINE int snd_interval_min(const struct snd_interval *i)
302{ 302{
303 assert(!snd_interval_empty(i)); 303 assert(!snd_interval_empty(i));
304 return i->min; 304 return i->min;
305} 305}
306 306
307INLINE int snd_interval_max(const snd_interval_t *i) 307INLINE int snd_interval_max(const struct snd_interval *i)
308{ 308{
309 unsigned int v; 309 unsigned int v;
310 assert(!snd_interval_empty(i)); 310 assert(!snd_interval_empty(i));
@@ -314,18 +314,18 @@ INLINE int snd_interval_max(const snd_interval_t *i)
314 return v; 314 return v;
315} 315}
316 316
317INLINE int snd_interval_test(const snd_interval_t *i, unsigned int val) 317INLINE int snd_interval_test(const struct snd_interval *i, unsigned int val)
318{ 318{
319 return !((i->min > val || (i->min == val && i->openmin) || 319 return !((i->min > val || (i->min == val && i->openmin) ||
320 i->max < val || (i->max == val && i->openmax))); 320 i->max < val || (i->max == val && i->openmax)));
321} 321}
322 322
323INLINE void snd_interval_copy(snd_interval_t *d, const snd_interval_t *s) 323INLINE void snd_interval_copy(struct snd_interval *d, const struct snd_interval *s)
324{ 324{
325 *d = *s; 325 *d = *s;
326} 326}
327 327
328INLINE int snd_interval_setinteger(snd_interval_t *i) 328INLINE int snd_interval_setinteger(struct snd_interval *i)
329{ 329{
330 if (i->integer) 330 if (i->integer)
331 return 0; 331 return 0;
@@ -335,7 +335,7 @@ INLINE int snd_interval_setinteger(snd_interval_t *i)
335 return 1; 335 return 1;
336} 336}
337 337
338INLINE int snd_interval_eq(const snd_interval_t *i1, const snd_interval_t *i2) 338INLINE int snd_interval_eq(const struct snd_interval *i1, const struct snd_interval *i2)
339{ 339{
340 if (i1->empty) 340 if (i1->empty)
341 return i2->empty; 341 return i2->empty;
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 3f9db510dee3..d19bddfbf995 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -36,11 +36,6 @@
36 * Raw MIDI interface 36 * Raw MIDI interface
37 */ 37 */
38 38
39typedef enum sndrv_rawmidi_stream snd_rawmidi_stream_t;
40typedef struct sndrv_rawmidi_info snd_rawmidi_info_t;
41typedef struct sndrv_rawmidi_params snd_rawmidi_params_t;
42typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
43
44#define SNDRV_RAWMIDI_DEVICES 8 39#define SNDRV_RAWMIDI_DEVICES 8
45 40
46#define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0) 41#define SNDRV_RAWMIDI_LFLG_OUTPUT (1<<0)
@@ -49,23 +44,22 @@ typedef struct sndrv_rawmidi_status snd_rawmidi_status_t;
49#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2) 44#define SNDRV_RAWMIDI_LFLG_APPEND (1<<2)
50#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3) 45#define SNDRV_RAWMIDI_LFLG_NOOPENLOCK (1<<3)
51 46
52typedef struct _snd_rawmidi_runtime snd_rawmidi_runtime_t; 47struct snd_rawmidi;
53typedef struct _snd_rawmidi_substream snd_rawmidi_substream_t; 48struct snd_rawmidi_substream;
54typedef struct _snd_rawmidi_str snd_rawmidi_str_t;
55 49
56typedef struct _snd_rawmidi_ops { 50struct snd_rawmidi_ops {
57 int (*open) (snd_rawmidi_substream_t * substream); 51 int (*open) (struct snd_rawmidi_substream * substream);
58 int (*close) (snd_rawmidi_substream_t * substream); 52 int (*close) (struct snd_rawmidi_substream * substream);
59 void (*trigger) (snd_rawmidi_substream_t * substream, int up); 53 void (*trigger) (struct snd_rawmidi_substream * substream, int up);
60 void (*drain) (snd_rawmidi_substream_t * substream); 54 void (*drain) (struct snd_rawmidi_substream * substream);
61} snd_rawmidi_ops_t; 55};
62 56
63typedef struct _snd_rawmidi_global_ops { 57struct snd_rawmidi_global_ops {
64 int (*dev_register) (snd_rawmidi_t * rmidi); 58 int (*dev_register) (struct snd_rawmidi * rmidi);
65 int (*dev_unregister) (snd_rawmidi_t * rmidi); 59 int (*dev_unregister) (struct snd_rawmidi * rmidi);
66} snd_rawmidi_global_ops_t; 60};
67 61
68struct _snd_rawmidi_runtime { 62struct snd_rawmidi_runtime {
69 unsigned int drain: 1, /* drain stage */ 63 unsigned int drain: 1, /* drain stage */
70 oss: 1; /* OSS compatible mode */ 64 oss: 1; /* OSS compatible mode */
71 /* midi stream buffer */ 65 /* midi stream buffer */
@@ -80,15 +74,15 @@ struct _snd_rawmidi_runtime {
80 spinlock_t lock; 74 spinlock_t lock;
81 wait_queue_head_t sleep; 75 wait_queue_head_t sleep;
82 /* event handler (new bytes, input only) */ 76 /* event handler (new bytes, input only) */
83 void (*event)(snd_rawmidi_substream_t *substream); 77 void (*event)(struct snd_rawmidi_substream *substream);
84 /* defers calls to event [input] or ops->trigger [output] */ 78 /* defers calls to event [input] or ops->trigger [output] */
85 struct tasklet_struct tasklet; 79 struct tasklet_struct tasklet;
86 /* private data */ 80 /* private data */
87 void *private_data; 81 void *private_data;
88 void (*private_free)(snd_rawmidi_substream_t *substream); 82 void (*private_free)(struct snd_rawmidi_substream *substream);
89}; 83};
90 84
91struct _snd_rawmidi_substream { 85struct snd_rawmidi_substream {
92 struct list_head list; /* list of all substream for given stream */ 86 struct list_head list; /* list of all substream for given stream */
93 int stream; /* direction */ 87 int stream; /* direction */
94 int number; /* substream number */ 88 int number; /* substream number */
@@ -97,29 +91,29 @@ struct _snd_rawmidi_substream {
97 active_sensing: 1; /* send active sensing when close */ 91 active_sensing: 1; /* send active sensing when close */
98 int use_count; /* use counter (for output) */ 92 int use_count; /* use counter (for output) */
99 size_t bytes; 93 size_t bytes;
100 snd_rawmidi_t *rmidi; 94 struct snd_rawmidi *rmidi;
101 snd_rawmidi_str_t *pstr; 95 struct snd_rawmidi_str *pstr;
102 char name[32]; 96 char name[32];
103 snd_rawmidi_runtime_t *runtime; 97 struct snd_rawmidi_runtime *runtime;
104 /* hardware layer */ 98 /* hardware layer */
105 snd_rawmidi_ops_t *ops; 99 struct snd_rawmidi_ops *ops;
106}; 100};
107 101
108typedef struct _snd_rawmidi_file { 102struct snd_rawmidi_file {
109 snd_rawmidi_t *rmidi; 103 struct snd_rawmidi *rmidi;
110 snd_rawmidi_substream_t *input; 104 struct snd_rawmidi_substream *input;
111 snd_rawmidi_substream_t *output; 105 struct snd_rawmidi_substream *output;
112} snd_rawmidi_file_t; 106};
113 107
114struct _snd_rawmidi_str { 108struct snd_rawmidi_str {
115 unsigned int substream_count; 109 unsigned int substream_count;
116 unsigned int substream_opened; 110 unsigned int substream_opened;
117 struct list_head substreams; 111 struct list_head substreams;
118}; 112};
119 113
120struct _snd_rawmidi { 114struct snd_rawmidi {
121 snd_card_t *card; 115 struct snd_card *card;
122 116 struct list_head list;
123 unsigned int device; /* device number */ 117 unsigned int device; /* device number */
124 unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */ 118 unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */
125 char id[64]; 119 char id[64];
@@ -129,52 +123,61 @@ struct _snd_rawmidi {
129 int ossreg; 123 int ossreg;
130#endif 124#endif
131 125
132 snd_rawmidi_global_ops_t *ops; 126 struct snd_rawmidi_global_ops *ops;
133 127
134 snd_rawmidi_str_t streams[2]; 128 struct snd_rawmidi_str streams[2];
135 129
136 void *private_data; 130 void *private_data;
137 void (*private_free) (snd_rawmidi_t *rmidi); 131 void (*private_free) (struct snd_rawmidi *rmidi);
138 132
139 struct semaphore open_mutex; 133 struct semaphore open_mutex;
140 wait_queue_head_t open_wait; 134 wait_queue_head_t open_wait;
141 135
142 snd_info_entry_t *dev; 136 struct snd_info_entry *dev;
143 snd_info_entry_t *proc_entry; 137 struct snd_info_entry *proc_entry;
144 138
145#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 139#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
146 snd_seq_device_t *seq_dev; 140 struct snd_seq_device *seq_dev;
147#endif 141#endif
148}; 142};
149 143
150/* main rawmidi functions */ 144/* main rawmidi functions */
151 145
152int snd_rawmidi_new(snd_card_t * card, char *id, int device, 146int snd_rawmidi_new(struct snd_card *card, char *id, int device,
153 int output_count, int input_count, 147 int output_count, int input_count,
154 snd_rawmidi_t ** rmidi); 148 struct snd_rawmidi **rmidi);
155void snd_rawmidi_set_ops(snd_rawmidi_t * rmidi, int stream, snd_rawmidi_ops_t * ops); 149void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
150 struct snd_rawmidi_ops *ops);
156 151
157/* callbacks */ 152/* callbacks */
158 153
159void snd_rawmidi_receive_reset(snd_rawmidi_substream_t * substream); 154void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);
160int snd_rawmidi_receive(snd_rawmidi_substream_t * substream, const unsigned char *buffer, int count); 155int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
161void snd_rawmidi_transmit_reset(snd_rawmidi_substream_t * substream); 156 const unsigned char *buffer, int count);
162int snd_rawmidi_transmit_empty(snd_rawmidi_substream_t * substream); 157void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream);
163int snd_rawmidi_transmit_peek(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); 158int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream);
164int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count); 159int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
165int snd_rawmidi_transmit(snd_rawmidi_substream_t * substream, unsigned char *buffer, int count); 160 unsigned char *buffer, int count);
161int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count);
162int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
163 unsigned char *buffer, int count);
166 164
167/* main midi functions */ 165/* main midi functions */
168 166
169int snd_rawmidi_info_select(snd_card_t *card, snd_rawmidi_info_t *info); 167int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info);
170int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice, int mode, snd_rawmidi_file_t * rfile); 168int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice,
171int snd_rawmidi_kernel_release(snd_rawmidi_file_t * rfile); 169 int mode, struct snd_rawmidi_file *rfile);
172int snd_rawmidi_output_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); 170int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile);
173int snd_rawmidi_input_params(snd_rawmidi_substream_t * substream, snd_rawmidi_params_t * params); 171int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
174int snd_rawmidi_drop_output(snd_rawmidi_substream_t * substream); 172 struct snd_rawmidi_params *params);
175int snd_rawmidi_drain_output(snd_rawmidi_substream_t * substream); 173int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
176int snd_rawmidi_drain_input(snd_rawmidi_substream_t * substream); 174 struct snd_rawmidi_params *params);
177long snd_rawmidi_kernel_read(snd_rawmidi_substream_t * substream, unsigned char *buf, long count); 175int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream);
178long snd_rawmidi_kernel_write(snd_rawmidi_substream_t * substream, const unsigned char *buf, long count); 176int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream);
177int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream);
178long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
179 unsigned char *buf, long count);
180long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream,
181 const unsigned char *buf, long count);
179 182
180#endif /* __SOUND_RAWMIDI_H */ 183#endif /* __SOUND_RAWMIDI_H */
diff --git a/include/sound/sb.h b/include/sound/sb.h
index 7960452445e6..431d06675e36 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -60,7 +60,7 @@ enum sb_hw_type {
60 60
61#define SB_MPU_INPUT 1 61#define SB_MPU_INPUT 1
62 62
63struct _snd_sb { 63struct snd_sb {
64 unsigned long port; /* base port of DSP chip */ 64 unsigned long port; /* base port of DSP chip */
65 struct resource *res_port; 65 struct resource *res_port;
66 unsigned long mpu_port; /* MPU port for SB DSP 4.0+ */ 66 unsigned long mpu_port; /* MPU port for SB DSP 4.0+ */
@@ -92,24 +92,26 @@ struct _snd_sb {
92 92
93 void *csp; /* used only when CONFIG_SND_SB16_CSP is set */ 93 void *csp; /* used only when CONFIG_SND_SB16_CSP is set */
94 94
95 snd_card_t *card; 95 struct snd_card *card;
96 snd_pcm_t *pcm; 96 struct snd_pcm *pcm;
97 snd_pcm_substream_t *playback_substream; 97 struct snd_pcm_substream *playback_substream;
98 snd_pcm_substream_t *capture_substream; 98 struct snd_pcm_substream *capture_substream;
99 99
100 snd_rawmidi_t *rmidi; 100 struct snd_rawmidi *rmidi;
101 snd_rawmidi_substream_t *midi_substream_input; 101 struct snd_rawmidi_substream *midi_substream_input;
102 snd_rawmidi_substream_t *midi_substream_output; 102 struct snd_rawmidi_substream *midi_substream_output;
103 irqreturn_t (*rmidi_callback)(int irq, void *dev_id, struct pt_regs *regs); 103 irqreturn_t (*rmidi_callback)(int irq, void *dev_id, struct pt_regs *regs);
104 104
105 spinlock_t reg_lock; 105 spinlock_t reg_lock;
106 spinlock_t open_lock; 106 spinlock_t open_lock;
107 spinlock_t midi_input_lock; 107 spinlock_t midi_input_lock;
108 108
109 snd_info_entry_t *proc_entry; 109 struct snd_info_entry *proc_entry;
110};
111 110
112typedef struct _snd_sb sb_t; 111#ifdef CONFIG_PM
112 unsigned char saved_regs[0x20];
113#endif
114};
113 115
114/* I/O ports */ 116/* I/O ports */
115 117
@@ -267,48 +269,52 @@ typedef struct _snd_sb sb_t;
267 * 269 *
268 */ 270 */
269 271
270static inline void snd_sb_ack_8bit(sb_t *chip) 272static inline void snd_sb_ack_8bit(struct snd_sb *chip)
271{ 273{
272 inb(SBP(chip, DATA_AVAIL)); 274 inb(SBP(chip, DATA_AVAIL));
273} 275}
274 276
275static inline void snd_sb_ack_16bit(sb_t *chip) 277static inline void snd_sb_ack_16bit(struct snd_sb *chip)
276{ 278{
277 inb(SBP(chip, DATA_AVAIL_16)); 279 inb(SBP(chip, DATA_AVAIL_16));
278} 280}
279 281
280/* sb_common.c */ 282/* sb_common.c */
281int snd_sbdsp_command(sb_t *chip, unsigned char val); 283int snd_sbdsp_command(struct snd_sb *chip, unsigned char val);
282int snd_sbdsp_get_byte(sb_t *chip); 284int snd_sbdsp_get_byte(struct snd_sb *chip);
283int snd_sbdsp_reset(sb_t *chip); 285int snd_sbdsp_reset(struct snd_sb *chip);
284int snd_sbdsp_create(snd_card_t *card, 286int snd_sbdsp_create(struct snd_card *card,
285 unsigned long port, 287 unsigned long port,
286 int irq, 288 int irq,
287 irqreturn_t (*irq_handler)(int, void *, struct pt_regs *), 289 irqreturn_t (*irq_handler)(int, void *, struct pt_regs *),
288 int dma8, int dma16, 290 int dma8, int dma16,
289 unsigned short hardware, 291 unsigned short hardware,
290 sb_t **r_chip); 292 struct snd_sb **r_chip);
291/* sb_mixer.c */ 293/* sb_mixer.c */
292void snd_sbmixer_write(sb_t *chip, unsigned char reg, unsigned char data); 294void snd_sbmixer_write(struct snd_sb *chip, unsigned char reg, unsigned char data);
293unsigned char snd_sbmixer_read(sb_t *chip, unsigned char reg); 295unsigned char snd_sbmixer_read(struct snd_sb *chip, unsigned char reg);
294int snd_sbmixer_new(sb_t *chip); 296int snd_sbmixer_new(struct snd_sb *chip);
297#ifdef CONFIG_PM
298void snd_sbmixer_suspend(struct snd_sb *chip);
299void snd_sbmixer_resume(struct snd_sb *chip);
300#endif
295 301
296/* sb8_init.c */ 302/* sb8_init.c */
297int snd_sb8dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm); 303int snd_sb8dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm);
298/* sb8.c */ 304/* sb8.c */
299irqreturn_t snd_sb8dsp_interrupt(sb_t *chip); 305irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip);
300int snd_sb8_playback_open(snd_pcm_substream_t *substream); 306int snd_sb8_playback_open(struct snd_pcm_substream *substream);
301int snd_sb8_capture_open(snd_pcm_substream_t *substream); 307int snd_sb8_capture_open(struct snd_pcm_substream *substream);
302int snd_sb8_playback_close(snd_pcm_substream_t *substream); 308int snd_sb8_playback_close(struct snd_pcm_substream *substream);
303int snd_sb8_capture_close(snd_pcm_substream_t *substream); 309int snd_sb8_capture_close(struct snd_pcm_substream *substream);
304/* midi8.c */ 310/* midi8.c */
305irqreturn_t snd_sb8dsp_midi_interrupt(sb_t *chip); 311irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip);
306int snd_sb8dsp_midi(sb_t *chip, int device, snd_rawmidi_t ** rrawmidi); 312int snd_sb8dsp_midi(struct snd_sb *chip, int device, struct snd_rawmidi ** rrawmidi);
307 313
308/* sb16_init.c */ 314/* sb16_init.c */
309int snd_sb16dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm); 315int snd_sb16dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm);
310const snd_pcm_ops_t *snd_sb16dsp_get_pcm_ops(int direction); 316const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction);
311int snd_sb16dsp_configure(sb_t *chip); 317int snd_sb16dsp_configure(struct snd_sb *chip);
312/* sb16.c */ 318/* sb16.c */
313irqreturn_t snd_sb16dsp_interrupt(int irq, void *dev_id, struct pt_regs *regs); 319irqreturn_t snd_sb16dsp_interrupt(int irq, void *dev_id, struct pt_regs *regs);
314 320
@@ -328,7 +334,7 @@ enum {
328#define SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) \ 334#define SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) \
329 ((reg1) | ((reg2) << 8) | ((left_shift) << 16) | ((right_shift) << 24)) 335 ((reg1) | ((reg2) << 8) | ((left_shift) << 16) | ((right_shift) << 24))
330 336
331int snd_sbmixer_add_ctl(sb_t *chip, const char *name, int index, int type, unsigned long value); 337int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int type, unsigned long value);
332 338
333/* for ease of use */ 339/* for ease of use */
334struct sbmix_elem { 340struct sbmix_elem {
@@ -352,7 +358,7 @@ struct sbmix_elem {
352 .type = SB_MIX_INPUT_SW, \ 358 .type = SB_MIX_INPUT_SW, \
353 .private_value = SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) } 359 .private_value = SB_MIXVAL_INPUT_SW(reg1, reg2, left_shift, right_shift) }
354 360
355static inline int snd_sbmixer_add_ctl_elem(sb_t *chip, const struct sbmix_elem *c) 361static inline int snd_sbmixer_add_ctl_elem(struct snd_sb *chip, const struct sbmix_elem *c)
356{ 362{
357 return snd_sbmixer_add_ctl(chip, c->name, 0, c->type, c->private_value); 363 return snd_sbmixer_add_ctl(chip, c->name, 0, c->type, c->private_value);
358} 364}
diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
index eb8368b56b16..3b44d4b370f5 100644
--- a/include/sound/sb16_csp.h
+++ b/include/sound/sb16_csp.h
@@ -63,25 +63,25 @@
63#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 63#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
64 64
65/* microcode header */ 65/* microcode header */
66typedef struct snd_sb_csp_mc_header { 66struct snd_sb_csp_mc_header {
67 char codec_name[16]; /* id name of codec */ 67 char codec_name[16]; /* id name of codec */
68 unsigned short func_req; /* requested function */ 68 unsigned short func_req; /* requested function */
69} snd_sb_csp_mc_header_t; 69};
70 70
71/* microcode to be loaded */ 71/* microcode to be loaded */
72typedef struct snd_sb_csp_microcode { 72struct snd_sb_csp_microcode {
73 snd_sb_csp_mc_header_t info; 73 struct snd_sb_csp_mc_header info;
74 unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; 74 unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
75} snd_sb_csp_microcode_t; 75};
76 76
77/* start CSP with sample_width in mono/stereo */ 77/* start CSP with sample_width in mono/stereo */
78typedef struct snd_sb_csp_start { 78struct snd_sb_csp_start {
79 int sample_width; /* sample width, look above */ 79 int sample_width; /* sample width, look above */
80 int channels; /* channels, look above */ 80 int channels; /* channels, look above */
81} snd_sb_csp_start_t; 81};
82 82
83/* CSP information */ 83/* CSP information */
84typedef struct snd_sb_csp_info { 84struct snd_sb_csp_info {
85 char codec_name[16]; /* id name of codec */ 85 char codec_name[16]; /* id name of codec */
86 unsigned short func_nr; /* function number */ 86 unsigned short func_nr; /* function number */
87 unsigned int acc_format; /* accepted PCM formats */ 87 unsigned int acc_format; /* accepted PCM formats */
@@ -93,17 +93,17 @@ typedef struct snd_sb_csp_info {
93 unsigned short run_width; /* current sample width */ 93 unsigned short run_width; /* current sample width */
94 unsigned short version; /* version id: 0x10 - 0x1f */ 94 unsigned short version; /* version id: 0x10 - 0x1f */
95 unsigned short state; /* state bits */ 95 unsigned short state; /* state bits */
96} snd_sb_csp_info_t; 96};
97 97
98/* HWDEP controls */ 98/* HWDEP controls */
99/* get CSP information */ 99/* get CSP information */
100#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, snd_sb_csp_info_t) 100#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
101/* load microcode to CSP */ 101/* load microcode to CSP */
102#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, snd_sb_csp_microcode_t) 102#define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, struct snd_sb_csp_microcode)
103/* unload microcode from CSP */ 103/* unload microcode from CSP */
104#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) 104#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
105/* start CSP */ 105/* start CSP */
106#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, snd_sb_csp_start_t) 106#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
107/* stop CSP */ 107/* stop CSP */
108#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) 108#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
109/* pause CSP and DMA transfer */ 109/* pause CSP and DMA transfer */
@@ -115,25 +115,25 @@ typedef struct snd_sb_csp_info {
115#include "sb.h" 115#include "sb.h"
116#include "hwdep.h" 116#include "hwdep.h"
117 117
118typedef struct snd_sb_csp snd_sb_csp_t; 118struct snd_sb_csp;
119 119
120/* 120/*
121 * CSP operators 121 * CSP operators
122 */ 122 */
123typedef struct { 123struct snd_sb_csp_ops {
124 int (*csp_use) (snd_sb_csp_t * p); 124 int (*csp_use) (struct snd_sb_csp * p);
125 int (*csp_unuse) (snd_sb_csp_t * p); 125 int (*csp_unuse) (struct snd_sb_csp * p);
126 int (*csp_autoload) (snd_sb_csp_t * p, int pcm_sfmt, int play_rec_mode); 126 int (*csp_autoload) (struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode);
127 int (*csp_start) (snd_sb_csp_t * p, int sample_width, int channels); 127 int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels);
128 int (*csp_stop) (snd_sb_csp_t * p); 128 int (*csp_stop) (struct snd_sb_csp * p);
129 int (*csp_qsound_transfer) (snd_sb_csp_t * p); 129 int (*csp_qsound_transfer) (struct snd_sb_csp * p);
130} snd_sb_csp_ops_t; 130};
131 131
132/* 132/*
133 * CSP private data 133 * CSP private data
134 */ 134 */
135struct snd_sb_csp { 135struct snd_sb_csp {
136 sb_t *chip; /* SB16 DSP */ 136 struct snd_sb *chip; /* SB16 DSP */
137 int used; /* usage flag - exclusive */ 137 int used; /* usage flag - exclusive */
138 char codec_name[16]; /* name of codec */ 138 char codec_name[16]; /* name of codec */
139 unsigned short func_nr; /* function number */ 139 unsigned short func_nr; /* function number */
@@ -147,7 +147,7 @@ struct snd_sb_csp {
147 int version; /* CSP version (0x10 - 0x1f) */ 147 int version; /* CSP version (0x10 - 0x1f) */
148 int running; /* running state */ 148 int running; /* running state */
149 149
150 snd_sb_csp_ops_t ops; /* operators */ 150 struct snd_sb_csp_ops ops; /* operators */
151 151
152 spinlock_t q_lock; /* locking */ 152 spinlock_t q_lock; /* locking */
153 int q_enabled; /* enabled flag */ 153 int q_enabled; /* enabled flag */
@@ -155,13 +155,13 @@ struct snd_sb_csp {
155 int qpos_right; /* right position */ 155 int qpos_right; /* right position */
156 int qpos_changed; /* position changed flag */ 156 int qpos_changed; /* position changed flag */
157 157
158 snd_kcontrol_t *qsound_switch; 158 struct snd_kcontrol *qsound_switch;
159 snd_kcontrol_t *qsound_space; 159 struct snd_kcontrol *qsound_space;
160 160
161 struct semaphore access_mutex; /* locking */ 161 struct semaphore access_mutex; /* locking */
162}; 162};
163 163
164int snd_sb_csp_new(sb_t *chip, int device, snd_hwdep_t ** rhwdep); 164int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
165#endif 165#endif
166 166
167#endif /* __SOUND_SB16_CSP */ 167#endif /* __SOUND_SB16_CSP */
diff --git a/include/sound/seq_device.h b/include/sound/seq_device.h
index 204ca540c28e..2b5f24cc7548 100644
--- a/include/sound/seq_device.h
+++ b/include/sound/seq_device.h
@@ -21,9 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24typedef struct snd_seq_device snd_seq_device_t;
25typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
26
27/* 24/*
28 * registered device information 25 * registered device information
29 */ 26 */
@@ -36,7 +33,7 @@ typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
36 33
37struct snd_seq_device { 34struct snd_seq_device {
38 /* device info */ 35 /* device info */
39 snd_card_t *card; /* sound card */ 36 struct snd_card *card; /* sound card */
40 int device; /* device number */ 37 int device; /* device number */
41 char id[ID_LEN]; /* driver id */ 38 char id[ID_LEN]; /* driver id */
42 char name[80]; /* device name */ 39 char name[80]; /* device name */
@@ -44,7 +41,7 @@ struct snd_seq_device {
44 void *driver_data; /* private data for driver */ 41 void *driver_data; /* private data for driver */
45 int status; /* flag - read only */ 42 int status; /* flag - read only */
46 void *private_data; /* private data for the caller */ 43 void *private_data; /* private data for the caller */
47 void (*private_free)(snd_seq_device_t *device); 44 void (*private_free)(struct snd_seq_device *device);
48 struct list_head list; /* link to next device */ 45 struct list_head list; /* link to next device */
49}; 46};
50 47
@@ -63,19 +60,19 @@ struct snd_seq_device {
63 * Typically, call snd_device_free(dev->card, dev->driver_data) 60 * Typically, call snd_device_free(dev->card, dev->driver_data)
64 */ 61 */
65struct snd_seq_dev_ops { 62struct snd_seq_dev_ops {
66 int (*init_device)(snd_seq_device_t *dev); 63 int (*init_device)(struct snd_seq_device *dev);
67 int (*free_device)(snd_seq_device_t *dev); 64 int (*free_device)(struct snd_seq_device *dev);
68}; 65};
69 66
70/* 67/*
71 * prototypes 68 * prototypes
72 */ 69 */
73void snd_seq_device_load_drivers(void); 70void snd_seq_device_load_drivers(void);
74int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize, snd_seq_device_t **result); 71int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result);
75int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsize); 72int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize);
76int snd_seq_device_unregister_driver(char *id); 73int snd_seq_device_unregister_driver(char *id);
77 74
78#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(snd_seq_device_t)) 75#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
79 76
80 77
81/* 78/*
@@ -84,5 +81,4 @@ int snd_seq_device_unregister_driver(char *id);
84#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi" 81#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
85#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth" 82#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
86 83
87
88#endif /* __SOUND_SEQ_DEVICE_H */ 84#endif /* __SOUND_SEQ_DEVICE_H */
diff --git a/include/sound/seq_instr.h b/include/sound/seq_instr.h
index 1a654df4aa97..db764f09efb7 100644
--- a/include/sound/seq_instr.h
+++ b/include/sound/seq_instr.h
@@ -24,29 +24,27 @@
24#include "seq_kernel.h" 24#include "seq_kernel.h"
25 25
26/* Instrument cluster */ 26/* Instrument cluster */
27typedef struct _snd_seq_kcluster { 27struct snd_seq_kcluster {
28 snd_seq_instr_cluster_t cluster; 28 snd_seq_instr_cluster_t cluster;
29 char name[32]; 29 char name[32];
30 int priority; 30 int priority;
31 struct _snd_seq_kcluster *next; 31 struct snd_seq_kcluster *next;
32} snd_seq_kcluster_t; 32};
33 33
34/* return pointer to private data */ 34/* return pointer to private data */
35#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(snd_seq_kinstr_t)) 35#define KINSTR_DATA(kinstr) (void *)(((char *)kinstr) + sizeof(struct snd_seq_kinstr))
36
37typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t;
38 36
39/* Instrument structure */ 37/* Instrument structure */
40typedef struct _snd_seq_kinstr { 38struct snd_seq_kinstr {
41 snd_seq_instr_t instr; 39 struct snd_seq_instr instr;
42 char name[32]; 40 char name[32];
43 int type; /* instrument type */ 41 int type; /* instrument type */
44 int use; /* use count */ 42 int use; /* use count */
45 int busy; /* not useable */ 43 int busy; /* not useable */
46 int add_len; /* additional length */ 44 int add_len; /* additional length */
47 snd_seq_kinstr_ops_t *ops; /* operations */ 45 struct snd_seq_kinstr_ops *ops; /* operations */
48 struct _snd_seq_kinstr *next; 46 struct snd_seq_kinstr *next;
49} snd_seq_kinstr_t; 47};
50 48
51#define SNDRV_SEQ_INSTR_HASH_SIZE 32 49#define SNDRV_SEQ_INSTR_HASH_SIZE 32
52 50
@@ -54,11 +52,11 @@ typedef struct _snd_seq_kinstr {
54#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */ 52#define SNDRV_SEQ_INSTR_FLG_DIRECT (1<<0) /* accept only direct events */
55 53
56/* List of all instruments */ 54/* List of all instruments */
57typedef struct { 55struct snd_seq_kinstr_list {
58 snd_seq_kinstr_t *hash[SNDRV_SEQ_INSTR_HASH_SIZE]; 56 struct snd_seq_kinstr *hash[SNDRV_SEQ_INSTR_HASH_SIZE];
59 int count; /* count of all instruments */ 57 int count; /* count of all instruments */
60 58
61 snd_seq_kcluster_t *chash[SNDRV_SEQ_INSTR_HASH_SIZE]; 59 struct snd_seq_kcluster *chash[SNDRV_SEQ_INSTR_HASH_SIZE];
62 int ccount; /* count of all clusters */ 60 int ccount; /* count of all clusters */
63 61
64 int owner; /* current owner of the instrument list */ 62 int owner; /* current owner of the instrument list */
@@ -68,7 +66,7 @@ typedef struct {
68 spinlock_t ops_lock; 66 spinlock_t ops_lock;
69 struct semaphore ops_mutex; 67 struct semaphore ops_mutex;
70 unsigned long ops_flags; 68 unsigned long ops_flags;
71} snd_seq_kinstr_list_t; 69};
72 70
73#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0 71#define SNDRV_SEQ_INSTR_NOTIFY_REMOVE 0
74#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1 72#define SNDRV_SEQ_INSTR_NOTIFY_CHANGE 1
@@ -78,33 +76,33 @@ struct snd_seq_kinstr_ops {
78 long add_len; /* additional length */ 76 long add_len; /* additional length */
79 char *instr_type; 77 char *instr_type;
80 int (*info)(void *private_data, char *info_data, long len); 78 int (*info)(void *private_data, char *info_data, long len);
81 int (*put)(void *private_data, snd_seq_kinstr_t *kinstr, 79 int (*put)(void *private_data, struct snd_seq_kinstr *kinstr,
82 char __user *instr_data, long len, int atomic, int cmd); 80 char __user *instr_data, long len, int atomic, int cmd);
83 int (*get)(void *private_data, snd_seq_kinstr_t *kinstr, 81 int (*get)(void *private_data, struct snd_seq_kinstr *kinstr,
84 char __user *instr_data, long len, int atomic, int cmd); 82 char __user *instr_data, long len, int atomic, int cmd);
85 int (*get_size)(void *private_data, snd_seq_kinstr_t *kinstr, long *size); 83 int (*get_size)(void *private_data, struct snd_seq_kinstr *kinstr, long *size);
86 int (*remove)(void *private_data, snd_seq_kinstr_t *kinstr, int atomic); 84 int (*remove)(void *private_data, struct snd_seq_kinstr *kinstr, int atomic);
87 void (*notify)(void *private_data, snd_seq_kinstr_t *kinstr, int what); 85 void (*notify)(void *private_data, struct snd_seq_kinstr *kinstr, int what);
88 struct snd_seq_kinstr_ops *next; 86 struct snd_seq_kinstr_ops *next;
89}; 87};
90 88
91 89
92/* instrument operations */ 90/* instrument operations */
93snd_seq_kinstr_list_t *snd_seq_instr_list_new(void); 91struct snd_seq_kinstr_list *snd_seq_instr_list_new(void);
94void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list); 92void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list);
95int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, 93int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list,
96 snd_seq_instr_header_t *ifree, 94 struct snd_seq_instr_header *ifree,
97 int client, 95 int client,
98 int atomic); 96 int atomic);
99snd_seq_kinstr_t *snd_seq_instr_find(snd_seq_kinstr_list_t *list, 97struct snd_seq_kinstr *snd_seq_instr_find(struct snd_seq_kinstr_list *list,
100 snd_seq_instr_t *instr, 98 struct snd_seq_instr *instr,
101 int exact, 99 int exact,
102 int follow_alias); 100 int follow_alias);
103void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, 101void snd_seq_instr_free_use(struct snd_seq_kinstr_list *list,
104 snd_seq_kinstr_t *instr); 102 struct snd_seq_kinstr *instr);
105int snd_seq_instr_event(snd_seq_kinstr_ops_t *ops, 103int snd_seq_instr_event(struct snd_seq_kinstr_ops *ops,
106 snd_seq_kinstr_list_t *list, 104 struct snd_seq_kinstr_list *list,
107 snd_seq_event_t *ev, 105 struct snd_seq_event *ev,
108 int client, 106 int client,
109 int atomic, 107 int atomic,
110 int hop); 108 int hop);
diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
index 4beca1952c76..f023c1b97f8c 100644
--- a/include/sound/seq_kernel.h
+++ b/include/sound/seq_kernel.h
@@ -24,62 +24,8 @@
24#include <linux/time.h> 24#include <linux/time.h>
25#include "asequencer.h" 25#include "asequencer.h"
26 26
27typedef sndrv_seq_tick_time_t snd_seq_tick_time_t; 27typedef struct snd_seq_real_time snd_seq_real_time_t;
28typedef sndrv_seq_position_t snd_seq_position_t; 28typedef union snd_seq_timestamp snd_seq_timestamp_t;
29typedef sndrv_seq_frequency_t snd_seq_frequency_t;
30typedef sndrv_seq_instr_cluster_t snd_seq_instr_cluster_t;
31typedef enum sndrv_seq_client_type snd_seq_client_type_t;
32typedef enum sndrv_seq_stop_mode snd_seq_stop_mode_t;
33typedef struct sndrv_seq_port_info snd_seq_port_info_t;
34typedef struct sndrv_seq_port_subscribe snd_seq_port_subscribe_t;
35typedef struct sndrv_seq_event snd_seq_event_t;
36typedef struct sndrv_seq_addr snd_seq_addr_t;
37typedef struct sndrv_seq_ev_volume snd_seq_ev_volume_t;
38typedef struct sndrv_seq_ev_loop snd_seq_ev_loop_t;
39typedef struct sndrv_seq_remove_events snd_seq_remove_events_t;
40typedef struct sndrv_seq_query_subs snd_seq_query_subs_t;
41typedef struct sndrv_seq_real_time snd_seq_real_time_t;
42typedef struct sndrv_seq_system_info snd_seq_system_info_t;
43typedef struct sndrv_seq_client_info snd_seq_client_info_t;
44typedef struct sndrv_seq_queue_info snd_seq_queue_info_t;
45typedef struct sndrv_seq_queue_status snd_seq_queue_status_t;
46typedef struct sndrv_seq_queue_tempo snd_seq_queue_tempo_t;
47typedef struct sndrv_seq_queue_owner snd_seq_queue_owner_t;
48typedef struct sndrv_seq_queue_timer snd_seq_queue_timer_t;
49typedef struct sndrv_seq_queue_client snd_seq_queue_client_t;
50typedef struct sndrv_seq_client_pool snd_seq_client_pool_t;
51typedef struct sndrv_seq_instr snd_seq_instr_t;
52typedef struct sndrv_seq_instr_data snd_seq_instr_data_t;
53typedef struct sndrv_seq_instr_header snd_seq_instr_header_t;
54typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
55
56#define snd_seq_event_bounce_ext_data sndrv_seq_event_bounce_ext_data
57#define snd_seq_ev_is_result_type sndrv_seq_ev_is_result_type
58#define snd_seq_ev_is_channel_type sndrv_seq_ev_is_channel_type
59#define snd_seq_ev_is_note_type sndrv_seq_ev_is_note_type
60#define snd_seq_ev_is_control_type sndrv_seq_ev_is_control_type
61#define snd_seq_ev_is_queue_type sndrv_seq_ev_is_queue_type
62#define snd_seq_ev_is_message_type sndrv_seq_ev_is_message_type
63#define snd_seq_ev_is_sample_type sndrv_seq_ev_is_sample_type
64#define snd_seq_ev_is_user_type sndrv_seq_ev_is_user_type
65#define snd_seq_ev_is_fixed_type sndrv_seq_ev_is_fixed_type
66#define snd_seq_ev_is_instr_type sndrv_seq_ev_is_instr_type
67#define snd_seq_ev_is_variable_type sndrv_seq_ev_is_variable_type
68#define snd_seq_ev_is_reserved sndrv_seq_ev_is_reserved
69#define snd_seq_ev_is_direct sndrv_seq_ev_is_direct
70#define snd_seq_ev_is_prior sndrv_seq_ev_is_prior
71#define snd_seq_ev_length_type sndrv_seq_ev_length_type
72#define snd_seq_ev_is_fixed sndrv_seq_ev_is_fixed
73#define snd_seq_ev_is_variable sndrv_seq_ev_is_variable
74#define snd_seq_ev_is_varusr sndrv_seq_ev_is_varusr
75#define snd_seq_ev_timestamp_type sndrv_seq_ev_timestamp_type
76#define snd_seq_ev_is_tick sndrv_seq_ev_is_tick
77#define snd_seq_ev_is_real sndrv_seq_ev_is_real
78#define snd_seq_ev_timemode_type sndrv_seq_ev_timemode_type
79#define snd_seq_ev_is_abstime sndrv_seq_ev_is_abstime
80#define snd_seq_ev_is_reltime sndrv_seq_ev_is_reltime
81#define snd_seq_queue_sync_port sndrv_seq_queue_sync_port
82#define snd_seq_queue_owner sndrv_seq_queue_owner
83 29
84/* maximum number of events dequeued per schedule interval */ 30/* maximum number of events dequeued per schedule interval */
85#define SNDRV_SEQ_MAX_DEQUEUE 50 31#define SNDRV_SEQ_MAX_DEQUEUE 50
@@ -114,69 +60,48 @@ typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
114/* max size of event size */ 60/* max size of event size */
115#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff 61#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
116 62
117/* typedefs */
118struct _snd_seq_user_client;
119struct _snd_seq_kernel_client;
120struct _snd_seq_client;
121struct _snd_seq_queue;
122
123typedef struct _snd_seq_user_client user_client_t;
124typedef struct _snd_seq_kernel_client kernel_client_t;
125typedef struct _snd_seq_client client_t;
126typedef struct _snd_seq_queue queue_t;
127
128/* call-backs for kernel client */
129
130typedef struct {
131 void *private_data;
132 unsigned allow_input: 1,
133 allow_output: 1;
134 /*...*/
135} snd_seq_client_callback_t;
136
137/* call-backs for kernel port */ 63/* call-backs for kernel port */
138typedef int (snd_seq_kernel_port_open_t)(void *private_data, snd_seq_port_subscribe_t *info); 64struct snd_seq_port_callback {
139typedef int (snd_seq_kernel_port_close_t)(void *private_data, snd_seq_port_subscribe_t *info);
140typedef int (snd_seq_kernel_port_input_t)(snd_seq_event_t *ev, int direct, void *private_data, int atomic, int hop);
141typedef void (snd_seq_kernel_port_private_free_t)(void *private_data);
142
143typedef struct {
144 struct module *owner; 65 struct module *owner;
145 void *private_data; 66 void *private_data;
146 snd_seq_kernel_port_open_t *subscribe; 67 int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
147 snd_seq_kernel_port_close_t *unsubscribe; 68 int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
148 snd_seq_kernel_port_open_t *use; 69 int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
149 snd_seq_kernel_port_close_t *unuse; 70 int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
150 snd_seq_kernel_port_input_t *event_input; 71 int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
151 snd_seq_kernel_port_private_free_t *private_free; 72 void (*private_free)(void *private_data);
152 unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */ 73 unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */
153 /*...*/ 74 /*...*/
154} snd_seq_port_callback_t; 75};
155 76
156/* interface for kernel client */ 77/* interface for kernel client */
157extern int snd_seq_create_kernel_client(snd_card_t *card, int client_index, snd_seq_client_callback_t *callback); 78int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
158extern int snd_seq_delete_kernel_client(int client); 79 const char *name_fmt, ...)
159extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop); 80 __attribute__ ((format (printf, 3, 4)));
160extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop); 81int snd_seq_delete_kernel_client(int client);
161extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); 82int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop);
83int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
84int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
162 85
163#define SNDRV_SEQ_EXT_MASK 0xc0000000 86#define SNDRV_SEQ_EXT_MASK 0xc0000000
164#define SNDRV_SEQ_EXT_USRPTR 0x80000000 87#define SNDRV_SEQ_EXT_USRPTR 0x80000000
165#define SNDRV_SEQ_EXT_CHAINED 0x40000000 88#define SNDRV_SEQ_EXT_CHAINED 0x40000000
166 89
167typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count); 90typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
168int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf, int in_kernel, int size_aligned); 91int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
169int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t func, void *private_data); 92 int in_kernel, int size_aligned);
93int snd_seq_dump_var_event(const struct snd_seq_event *event,
94 snd_seq_dump_func_t func, void *private_data);
170 95
171/* interface for OSS emulation */ 96/* interface for OSS emulation */
172int snd_seq_set_queue_tempo(int client, snd_seq_queue_tempo_t *tempo); 97int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
173 98
174/* port callback routines */ 99/* port callback routines */
175void snd_port_init_callback(snd_seq_port_callback_t *p); 100void snd_port_init_callback(struct snd_seq_port_callback *p);
176snd_seq_port_callback_t *snd_port_alloc_callback(void); 101struct snd_seq_port_callback *snd_port_alloc_callback(void);
177 102
178/* port attach/detach */ 103/* port attach/detach */
179int snd_seq_event_port_attach(int client, snd_seq_port_callback_t *pcbp, 104int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
180 int cap, int type, int midi_channels, int midi_voices, char *portname); 105 int cap, int type, int midi_channels, int midi_voices, char *portname);
181int snd_seq_event_port_detach(int client, int port); 106int snd_seq_event_port_detach(int client, int port);
182 107
diff --git a/include/sound/seq_midi_emul.h b/include/sound/seq_midi_emul.h
index e58ca45bc73b..d6c4615901b9 100644
--- a/include/sound/seq_midi_emul.h
+++ b/include/sound/seq_midi_emul.h
@@ -29,7 +29,7 @@
29 * channel. All drivers for hardware that does not understand midi 29 * channel. All drivers for hardware that does not understand midi
30 * directly will probably need to use this structure. 30 * directly will probably need to use this structure.
31 */ 31 */
32typedef struct snd_midi_channel { 32struct snd_midi_channel {
33 void *private; /* A back pointer to driver data */ 33 void *private; /* A back pointer to driver data */
34 int number; /* The channel number */ 34 int number; /* The channel number */
35 int client; /* The client associated with this channel */ 35 int client; /* The client associated with this channel */
@@ -53,41 +53,43 @@ typedef struct snd_midi_channel {
53 short gm_rpn_fine_tuning; /* Master fine tuning */ 53 short gm_rpn_fine_tuning; /* Master fine tuning */
54 short gm_rpn_coarse_tuning; /* Master coarse tuning */ 54 short gm_rpn_coarse_tuning; /* Master coarse tuning */
55 55
56} snd_midi_channel_t; 56};
57 57
58/* 58/*
59 * A structure that represets a set of channels bound to a port. There 59 * A structure that represets a set of channels bound to a port. There
60 * would usually be 16 channels per port. But fewer could be used for 60 * would usually be 16 channels per port. But fewer could be used for
61 * particular cases. 61 * particular cases.
62 * The channel set consists of information describing the client and 62 * The channel set consists of information describing the client and
63 * port for this midi synth and an array of snd_midi_channel_t structures. 63 * port for this midi synth and an array of snd_midi_channel structures.
64 * A driver that had no need for snd_midi_channel_t could still use the 64 * A driver that had no need for snd_midi_channel could still use the
65 * channel set type if it wished with the channel array null. 65 * channel set type if it wished with the channel array null.
66 */ 66 */
67typedef struct snd_midi_channel_set { 67struct snd_midi_channel_set {
68 void *private_data; /* Driver data */ 68 void *private_data; /* Driver data */
69 int client; /* Client for this port */ 69 int client; /* Client for this port */
70 int port; /* The port number */ 70 int port; /* The port number */
71 71
72 int max_channels; /* Size of the channels array */ 72 int max_channels; /* Size of the channels array */
73 snd_midi_channel_t *channels; 73 struct snd_midi_channel *channels;
74 74
75 unsigned char midi_mode; /* MIDI operating mode */ 75 unsigned char midi_mode; /* MIDI operating mode */
76 unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */ 76 unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */
77 unsigned char gs_chorus_mode; 77 unsigned char gs_chorus_mode;
78 unsigned char gs_reverb_mode; 78 unsigned char gs_reverb_mode;
79 79
80} snd_midi_channel_set_t; 80};
81 81
82typedef struct snd_seq_midi_op { 82struct snd_midi_op {
83 void (*note_on)(void *private_data, int note, int vel, snd_midi_channel_t *chan); 83 void (*note_on)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
84 void (*note_off)(void *private_data,int note, int vel, snd_midi_channel_t *chan); /* release note */ 84 void (*note_off)(void *private_data,int note, int vel, struct snd_midi_channel *chan); /* release note */
85 void (*key_press)(void *private_data, int note, int vel, snd_midi_channel_t *chan); 85 void (*key_press)(void *private_data, int note, int vel, struct snd_midi_channel *chan);
86 void (*note_terminate)(void *private_data, int note, snd_midi_channel_t *chan); /* terminate note immediately */ 86 void (*note_terminate)(void *private_data, int note, struct snd_midi_channel *chan); /* terminate note immediately */
87 void (*control)(void *private_data, int type, snd_midi_channel_t *chan); 87 void (*control)(void *private_data, int type, struct snd_midi_channel *chan);
88 void (*nrpn)(void *private_data, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); 88 void (*nrpn)(void *private_data, struct snd_midi_channel *chan,
89 void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); 89 struct snd_midi_channel_set *chset);
90} snd_midi_op_t; 90 void (*sysex)(void *private_data, unsigned char *buf, int len, int parsed,
91 struct snd_midi_channel_set *chset);
92};
91 93
92/* 94/*
93 * These defines are used so that pitchbend, aftertouch etc, can be 95 * These defines are used so that pitchbend, aftertouch etc, can be
@@ -186,10 +188,10 @@ enum {
186}; 188};
187 189
188/* Prototypes for midi_process.c */ 190/* Prototypes for midi_process.c */
189void snd_midi_process_event(snd_midi_op_t *ops, snd_seq_event_t *ev, 191void snd_midi_process_event(struct snd_midi_op *ops, struct snd_seq_event *ev,
190 snd_midi_channel_set_t *chanset); 192 struct snd_midi_channel_set *chanset);
191void snd_midi_channel_set_clear(snd_midi_channel_set_t *chset); 193void snd_midi_channel_set_clear(struct snd_midi_channel_set *chset);
192snd_midi_channel_set_t *snd_midi_channel_alloc_set(int n); 194struct snd_midi_channel_set *snd_midi_channel_alloc_set(int n);
193void snd_midi_channel_free_set(snd_midi_channel_set_t *chset); 195void snd_midi_channel_free_set(struct snd_midi_channel_set *chset);
194 196
195#endif /* __SOUND_SEQ_MIDI_EMUL_H */ 197#endif /* __SOUND_SEQ_MIDI_EMUL_H */
diff --git a/include/sound/seq_midi_event.h b/include/sound/seq_midi_event.h
index 8857e2bd31a5..dd789e7cdb20 100644
--- a/include/sound/seq_midi_event.h
+++ b/include/sound/seq_midi_event.h
@@ -26,10 +26,8 @@
26 26
27#define MAX_MIDI_EVENT_BUF 256 27#define MAX_MIDI_EVENT_BUF 256
28 28
29typedef struct snd_midi_event_t snd_midi_event_t;
30
31/* midi status */ 29/* midi status */
32struct snd_midi_event_t { 30struct snd_midi_event {
33 int qlen; /* queue length */ 31 int qlen; /* queue length */
34 int read; /* chars read */ 32 int read; /* chars read */
35 int type; /* current event type */ 33 int type; /* current event type */
@@ -40,15 +38,17 @@ struct snd_midi_event_t {
40 spinlock_t lock; 38 spinlock_t lock;
41}; 39};
42 40
43int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev); 41int snd_midi_event_new(int bufsize, struct snd_midi_event **rdev);
44void snd_midi_event_free(snd_midi_event_t *dev); 42void snd_midi_event_free(struct snd_midi_event *dev);
45void snd_midi_event_reset_encode(snd_midi_event_t *dev); 43void snd_midi_event_reset_encode(struct snd_midi_event *dev);
46void snd_midi_event_reset_decode(snd_midi_event_t *dev); 44void snd_midi_event_reset_decode(struct snd_midi_event *dev);
47void snd_midi_event_no_status(snd_midi_event_t *dev, int on); 45void snd_midi_event_no_status(struct snd_midi_event *dev, int on);
48/* encode from byte stream - return number of written bytes if success */ 46/* encode from byte stream - return number of written bytes if success */
49long snd_midi_event_encode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); 47long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count,
50int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev); 48 struct snd_seq_event *ev);
49int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c, struct snd_seq_event *ev);
51/* decode from event to bytes - return number of written bytes if success */ 50/* decode from event to bytes - return number of written bytes if success */
52long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, snd_seq_event_t *ev); 51long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count,
52 struct snd_seq_event *ev);
53 53
54#endif /* __SOUND_SEQ_MIDI_EVENT_H */ 54#endif /* __SOUND_SEQ_MIDI_EVENT_H */
diff --git a/include/sound/seq_oss.h b/include/sound/seq_oss.h
index bd7e57322ab6..9b060bbd6e02 100644
--- a/include/sound/seq_oss.h
+++ b/include/sound/seq_oss.h
@@ -25,22 +25,16 @@
25#include "seq_kernel.h" 25#include "seq_kernel.h"
26 26
27/* 27/*
28 * type definitions
29 */
30typedef struct snd_seq_oss_arg_t snd_seq_oss_arg_t;
31typedef struct snd_seq_oss_callback_t snd_seq_oss_callback_t;
32
33/*
34 * argument structure for synthesizer operations 28 * argument structure for synthesizer operations
35 */ 29 */
36struct snd_seq_oss_arg_t { 30struct snd_seq_oss_arg {
37 /* given by OSS sequencer */ 31 /* given by OSS sequencer */
38 int app_index; /* application unique index */ 32 int app_index; /* application unique index */
39 int file_mode; /* file mode - see below */ 33 int file_mode; /* file mode - see below */
40 int seq_mode; /* sequencer mode - see below */ 34 int seq_mode; /* sequencer mode - see below */
41 35
42 /* following must be initialized in open callback */ 36 /* following must be initialized in open callback */
43 snd_seq_addr_t addr; /* opened port address */ 37 struct snd_seq_addr addr; /* opened port address */
44 void *private_data; /* private data for lowlevel drivers */ 38 void *private_data; /* private data for lowlevel drivers */
45 39
46 /* note-on event passing mode: initially given by OSS seq, 40 /* note-on event passing mode: initially given by OSS seq,
@@ -53,14 +47,14 @@ struct snd_seq_oss_arg_t {
53/* 47/*
54 * synthesizer operation callbacks 48 * synthesizer operation callbacks
55 */ 49 */
56struct snd_seq_oss_callback_t { 50struct snd_seq_oss_callback {
57 struct module *owner; 51 struct module *owner;
58 int (*open)(snd_seq_oss_arg_t *p, void *closure); 52 int (*open)(struct snd_seq_oss_arg *p, void *closure);
59 int (*close)(snd_seq_oss_arg_t *p); 53 int (*close)(struct snd_seq_oss_arg *p);
60 int (*ioctl)(snd_seq_oss_arg_t *p, unsigned int cmd, unsigned long arg); 54 int (*ioctl)(struct snd_seq_oss_arg *p, unsigned int cmd, unsigned long arg);
61 int (*load_patch)(snd_seq_oss_arg_t *p, int format, const char __user *buf, int offs, int count); 55 int (*load_patch)(struct snd_seq_oss_arg *p, int format, const char __user *buf, int offs, int count);
62 int (*reset)(snd_seq_oss_arg_t *p); 56 int (*reset)(struct snd_seq_oss_arg *p);
63 int (*raw_event)(snd_seq_oss_arg_t *p, unsigned char *data); 57 int (*raw_event)(struct snd_seq_oss_arg *p, unsigned char *data);
64}; 58};
65 59
66/* flag: file_mode */ 60/* flag: file_mode */
@@ -88,13 +82,13 @@ struct snd_seq_oss_callback_t {
88/* 82/*
89 * data pointer to snd_seq_register_device 83 * data pointer to snd_seq_register_device
90 */ 84 */
91typedef struct snd_seq_oss_reg { 85struct snd_seq_oss_reg {
92 int type; 86 int type;
93 int subtype; 87 int subtype;
94 int nvoices; 88 int nvoices;
95 snd_seq_oss_callback_t oper; 89 struct snd_seq_oss_callback oper;
96 void *private_data; 90 void *private_data;
97} snd_seq_oss_reg_t; 91};
98 92
99/* device id */ 93/* device id */
100#define SNDRV_SEQ_DEV_ID_OSS "seq-oss" 94#define SNDRV_SEQ_DEV_ID_OSS "seq-oss"
diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h
index 1ad27e859af3..8d5aea76d7c3 100644
--- a/include/sound/seq_virmidi.h
+++ b/include/sound/seq_virmidi.h
@@ -25,25 +25,23 @@
25#include "rawmidi.h" 25#include "rawmidi.h"
26#include "seq_midi_event.h" 26#include "seq_midi_event.h"
27 27
28typedef struct _snd_virmidi_dev snd_virmidi_dev_t;
29
30/* 28/*
31 * device file instance: 29 * device file instance:
32 * This instance is created at each time the midi device file is 30 * This instance is created at each time the midi device file is
33 * opened. Each instance has its own input buffer and MIDI parser 31 * opened. Each instance has its own input buffer and MIDI parser
34 * (buffer), and is associated with the device instance. 32 * (buffer), and is associated with the device instance.
35 */ 33 */
36typedef struct _snd_virmidi { 34struct snd_virmidi {
37 struct list_head list; 35 struct list_head list;
38 int seq_mode; 36 int seq_mode;
39 int client; 37 int client;
40 int port; 38 int port;
41 unsigned int trigger: 1; 39 unsigned int trigger: 1;
42 snd_midi_event_t *parser; 40 struct snd_midi_event *parser;
43 snd_seq_event_t event; 41 struct snd_seq_event event;
44 snd_virmidi_dev_t *rdev; 42 struct snd_virmidi_dev *rdev;
45 snd_rawmidi_substream_t *substream; 43 struct snd_rawmidi_substream *substream;
46} snd_virmidi_t; 44};
47 45
48#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0) 46#define SNDRV_VIRMIDI_SUBSCRIBE (1<<0)
49#define SNDRV_VIRMIDI_USE (1<<1) 47#define SNDRV_VIRMIDI_USE (1<<1)
@@ -53,9 +51,9 @@ typedef struct _snd_virmidi {
53 * Each virtual midi device has one device instance. It contains 51 * Each virtual midi device has one device instance. It contains
54 * common information and the linked-list of opened files, 52 * common information and the linked-list of opened files,
55 */ 53 */
56struct _snd_virmidi_dev { 54struct snd_virmidi_dev {
57 snd_card_t *card; /* associated card */ 55 struct snd_card *card; /* associated card */
58 snd_rawmidi_t *rmidi; /* rawmidi device */ 56 struct snd_rawmidi *rmidi; /* rawmidi device */
59 int seq_mode; /* SNDRV_VIRMIDI_XXX */ 57 int seq_mode; /* SNDRV_VIRMIDI_XXX */
60 int device; /* sequencer device */ 58 int device; /* sequencer device */
61 int client; /* created/attached client */ 59 int client; /* created/attached client */
@@ -78,6 +76,6 @@ struct _snd_virmidi_dev {
78#define SNDRV_VIRMIDI_SEQ_ATTACH 1 76#define SNDRV_VIRMIDI_SEQ_ATTACH 1
79#define SNDRV_VIRMIDI_SEQ_DISPATCH 2 77#define SNDRV_VIRMIDI_SEQ_DISPATCH 2
80 78
81int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi); 79int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmidi);
82 80
83#endif /* __SOUND_SEQ_VIRMIDI */ 81#endif /* __SOUND_SEQ_VIRMIDI */
diff --git a/include/sound/sfnt_info.h b/include/sound/sfnt_info.h
index 674585f88a31..5d1ab9c4950f 100644
--- a/include/sound/sfnt_info.h
+++ b/include/sound/sfnt_info.h
@@ -35,7 +35,7 @@
35#endif 35#endif
36 36
37/* patch interface header: 16 bytes */ 37/* patch interface header: 16 bytes */
38typedef struct soundfont_patch_info_t { 38struct soundfont_patch_info {
39 unsigned short key; /* use the key below */ 39 unsigned short key; /* use the key below */
40#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07) 40#define SNDRV_OSS_SOUNDFONT_PATCH SNDRV_OSS_PATCHKEY(0x07)
41 41
@@ -59,7 +59,7 @@ typedef struct soundfont_patch_info_t {
59 short reserved; /* word alignment data */ 59 short reserved; /* word alignment data */
60 60
61 /* the actual patch data begins after this */ 61 /* the actual patch data begins after this */
62} soundfont_patch_info_t; 62};
63 63
64 64
65/* 65/*
@@ -68,7 +68,7 @@ typedef struct soundfont_patch_info_t {
68 68
69#define SNDRV_SFNT_PATCH_NAME_LEN 32 69#define SNDRV_SFNT_PATCH_NAME_LEN 32
70 70
71typedef struct soundfont_open_parm_t { 71struct soundfont_open_parm {
72 unsigned short type; /* sample type */ 72 unsigned short type; /* sample type */
73#define SNDRV_SFNT_PAT_TYPE_MISC 0 73#define SNDRV_SFNT_PAT_TYPE_MISC 0
74#define SNDRV_SFNT_PAT_TYPE_GUS 6 74#define SNDRV_SFNT_PAT_TYPE_GUS 6
@@ -78,7 +78,7 @@ typedef struct soundfont_open_parm_t {
78 78
79 short reserved; 79 short reserved;
80 char name[SNDRV_SFNT_PATCH_NAME_LEN]; 80 char name[SNDRV_SFNT_PATCH_NAME_LEN];
81} soundfont_open_parm_t; 81};
82 82
83 83
84/* 84/*
@@ -86,7 +86,7 @@ typedef struct soundfont_open_parm_t {
86 */ 86 */
87 87
88/* wave table envelope & effect parameters to control EMU8000 */ 88/* wave table envelope & effect parameters to control EMU8000 */
89typedef struct soundfont_voice_parm_t { 89struct soundfont_voice_parm {
90 unsigned short moddelay; /* modulation delay (0x8000) */ 90 unsigned short moddelay; /* modulation delay (0x8000) */
91 unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */ 91 unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */
92 unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */ 92 unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */
@@ -108,11 +108,11 @@ typedef struct soundfont_voice_parm_t {
108 unsigned char chorus; /* chorus send (0x00) */ 108 unsigned char chorus; /* chorus send (0x00) */
109 unsigned char reverb; /* reverb send (0x00) */ 109 unsigned char reverb; /* reverb send (0x00) */
110 unsigned short reserved[4]; /* not used */ 110 unsigned short reserved[4]; /* not used */
111} soundfont_voice_parm_t; 111};
112 112
113 113
114/* wave table parameters: 92 bytes */ 114/* wave table parameters: 92 bytes */
115typedef struct soundfont_voice_info_t { 115struct soundfont_voice_info {
116 unsigned short sf_id; /* file id (should be zero) */ 116 unsigned short sf_id; /* file id (should be zero) */
117 unsigned short sample; /* sample id */ 117 unsigned short sample; /* sample id */
118 int start, end; /* sample offset correction */ 118 int start, end; /* sample offset correction */
@@ -135,13 +135,13 @@ typedef struct soundfont_voice_info_t {
135 unsigned char amplitude; /* sample volume (127 max) */ 135 unsigned char amplitude; /* sample volume (127 max) */
136 unsigned char attenuation; /* attenuation (0.375dB) */ 136 unsigned char attenuation; /* attenuation (0.375dB) */
137 short scaleTuning; /* pitch scale tuning(%), normally 100 */ 137 short scaleTuning; /* pitch scale tuning(%), normally 100 */
138 soundfont_voice_parm_t parm; /* voice envelope parameters */ 138 struct soundfont_voice_parm parm; /* voice envelope parameters */
139 unsigned short sample_mode; /* sample mode_flag (set by driver) */ 139 unsigned short sample_mode; /* sample mode_flag (set by driver) */
140} soundfont_voice_info_t; 140};
141 141
142 142
143/* instrument info header: 4 bytes */ 143/* instrument info header: 4 bytes */
144typedef struct soundfont_voice_rec_hdr_t { 144struct soundfont_voice_rec_hdr {
145 unsigned char bank; /* midi bank number */ 145 unsigned char bank; /* midi bank number */
146 unsigned char instr; /* midi preset number */ 146 unsigned char instr; /* midi preset number */
147 char nvoices; /* number of voices */ 147 char nvoices; /* number of voices */
@@ -149,7 +149,7 @@ typedef struct soundfont_voice_rec_hdr_t {
149#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */ 149#define SNDRV_SFNT_WR_APPEND 0 /* append anyway */
150#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */ 150#define SNDRV_SFNT_WR_EXCLUSIVE 1 /* skip if already exists */
151#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */ 151#define SNDRV_SFNT_WR_REPLACE 2 /* replace if already exists */
152} soundfont_voice_rec_hdr_t; 152};
153 153
154 154
155/* 155/*
@@ -157,7 +157,7 @@ typedef struct soundfont_voice_rec_hdr_t {
157 */ 157 */
158 158
159/* wave table sample header: 32 bytes */ 159/* wave table sample header: 32 bytes */
160typedef struct soundfont_sample_info_t { 160struct soundfont_sample_info {
161 unsigned short sf_id; /* file id (should be zero) */ 161 unsigned short sf_id; /* file id (should be zero) */
162 unsigned short sample; /* sample id */ 162 unsigned short sample; /* sample id */
163 int start, end; /* start & end offset */ 163 int start, end; /* start & end offset */
@@ -174,17 +174,17 @@ typedef struct soundfont_sample_info_t {
174#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */ 174#define SNDRV_SFNT_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */
175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */ 175#define SNDRV_SFNT_SAMPLE_REVERSE_LOOP 128 /* reverse looping */
176 unsigned int truesize; /* used memory size (set by driver) */ 176 unsigned int truesize; /* used memory size (set by driver) */
177} soundfont_sample_info_t; 177};
178 178
179 179
180/* 180/*
181 * voice preset mapping (aliasing) 181 * voice preset mapping (aliasing)
182 */ 182 */
183 183
184typedef struct soundfont_voice_map_t { 184struct soundfont_voice_map {
185 int map_bank, map_instr, map_key; /* key = -1 means all keys */ 185 int map_bank, map_instr, map_key; /* key = -1 means all keys */
186 int src_bank, src_instr, src_key; 186 int src_bank, src_instr, src_key;
187} soundfont_voice_map_t; 187};
188 188
189 189
190/* 190/*
@@ -195,7 +195,7 @@ typedef struct soundfont_voice_map_t {
195 195
196#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */ 196#define SNDRV_EMUX_VERSION ((1 << 16) | (0 << 8) | 0) /* 1.0.0 */
197 197
198struct sndrv_emux_misc_mode { 198struct snd_emux_misc_mode {
199 int port; /* -1 = all */ 199 int port; /* -1 = all */
200 int mode; 200 int mode;
201 int value; 201 int value;
@@ -204,11 +204,11 @@ struct sndrv_emux_misc_mode {
204 204
205enum { 205enum {
206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int), 206 SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int),
207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, soundfont_patch_info_t), 207 SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info),
208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82), 208 SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82),
209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83), 209 SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83),
210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int), 210 SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int),
211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct sndrv_emux_misc_mode), 211 SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode),
212}; 212};
213 213
214#endif /* __SOUND_SFNT_INFO_H */ 214#endif /* __SOUND_SFNT_INFO_H */
diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h
index 4b0b2b9370b9..0b9e5de94ff1 100644
--- a/include/sound/snd_wavefront.h
+++ b/include/sound/snd_wavefront.h
@@ -26,8 +26,8 @@ struct _snd_wavefront_midi {
26 snd_wavefront_mpu_id output_mpu; /* most-recently-used */ 26 snd_wavefront_mpu_id output_mpu; /* most-recently-used */
27 snd_wavefront_mpu_id input_mpu; /* most-recently-used */ 27 snd_wavefront_mpu_id input_mpu; /* most-recently-used */
28 unsigned int mode[2]; /* MPU401_MODE_XXX */ 28 unsigned int mode[2]; /* MPU401_MODE_XXX */
29 snd_rawmidi_substream_t *substream_output[2]; 29 struct snd_rawmidi_substream *substream_output[2];
30 snd_rawmidi_substream_t *substream_input[2]; 30 struct snd_rawmidi_substream *substream_input[2];
31 struct timer_list timer; 31 struct timer_list timer;
32 spinlock_t open; 32 spinlock_t open;
33 spinlock_t virtual; /* protects isvirtual */ 33 spinlock_t virtual; /* protects isvirtual */
@@ -38,8 +38,8 @@ struct _snd_wavefront_midi {
38#define MPU_ACK 0xFE 38#define MPU_ACK 0xFE
39#define UART_MODE_ON 0x3F 39#define UART_MODE_ON 0x3F
40 40
41extern snd_rawmidi_ops_t snd_wavefront_midi_output; 41extern struct snd_rawmidi_ops snd_wavefront_midi_output;
42extern snd_rawmidi_ops_t snd_wavefront_midi_input; 42extern struct snd_rawmidi_ops snd_wavefront_midi_input;
43 43
44extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *); 44extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *);
45extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *); 45extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *);
@@ -116,23 +116,23 @@ extern int snd_wavefront_config_midi (snd_wavefront_t *dev) ;
116extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *, 116extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *,
117 unsigned char *); 117 unsigned char *);
118 118
119extern int snd_wavefront_synth_ioctl (snd_hwdep_t *, 119extern int snd_wavefront_synth_ioctl (struct snd_hwdep *,
120 struct file *, 120 struct file *,
121 unsigned int cmd, 121 unsigned int cmd,
122 unsigned long arg); 122 unsigned long arg);
123extern int snd_wavefront_synth_open (snd_hwdep_t *, struct file *); 123extern int snd_wavefront_synth_open (struct snd_hwdep *, struct file *);
124extern int snd_wavefront_synth_release (snd_hwdep_t *, struct file *); 124extern int snd_wavefront_synth_release (struct snd_hwdep *, struct file *);
125 125
126/* FX processor - see also yss225.[ch] */ 126/* FX processor - see also yss225.[ch] */
127 127
128extern int snd_wavefront_fx_start (snd_wavefront_t *); 128extern int snd_wavefront_fx_start (snd_wavefront_t *);
129extern int snd_wavefront_fx_detect (snd_wavefront_t *); 129extern int snd_wavefront_fx_detect (snd_wavefront_t *);
130extern int snd_wavefront_fx_ioctl (snd_hwdep_t *, 130extern int snd_wavefront_fx_ioctl (struct snd_hwdep *,
131 struct file *, 131 struct file *,
132 unsigned int cmd, 132 unsigned int cmd,
133 unsigned long arg); 133 unsigned long arg);
134extern int snd_wavefront_fx_open (snd_hwdep_t *, struct file *); 134extern int snd_wavefront_fx_open (struct snd_hwdep *, struct file *);
135extern int snd_wavefront_fx_release (snd_hwdep_t *, struct file *); 135extern int snd_wavefront_fx_release (struct snd_hwdep *, struct file *);
136 136
137/* prefix in all snd_printk() delivered messages */ 137/* prefix in all snd_printk() delivered messages */
138 138
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h
index c992958f5e3c..61a010c65d02 100644
--- a/include/sound/soundfont.h
+++ b/include/sound/soundfont.h
@@ -29,94 +29,93 @@
29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ 29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */
30#define SF_IS_DRUM_BANK(z) ((z) == 128) 30#define SF_IS_DRUM_BANK(z) ((z) == 128)
31 31
32typedef struct snd_sf_zone { 32struct snd_sf_zone {
33 struct snd_sf_zone *next; /* Link to next */ 33 struct snd_sf_zone *next; /* Link to next */
34 unsigned char bank; /* Midi bank for this zone */ 34 unsigned char bank; /* Midi bank for this zone */
35 unsigned char instr; /* Midi program for this zone */ 35 unsigned char instr; /* Midi program for this zone */
36 unsigned char mapped; /* True if mapped to something else */ 36 unsigned char mapped; /* True if mapped to something else */
37 37
38 soundfont_voice_info_t v; /* All the soundfont parameters */ 38 struct soundfont_voice_info v; /* All the soundfont parameters */
39 int counter; 39 int counter;
40 struct snd_sf_sample *sample; /* Link to sample */ 40 struct snd_sf_sample *sample; /* Link to sample */
41 41
42 /* The following deals with preset numbers (programs) */ 42 /* The following deals with preset numbers (programs) */
43 struct snd_sf_zone *next_instr; /* Next zone of this instrument */ 43 struct snd_sf_zone *next_instr; /* Next zone of this instrument */
44 struct snd_sf_zone *next_zone; /* Next zone in play list */ 44 struct snd_sf_zone *next_zone; /* Next zone in play list */
45} snd_sf_zone_t; 45};
46 46
47typedef struct snd_sf_sample { 47struct snd_sf_sample {
48 soundfont_sample_info_t v; 48 struct soundfont_sample_info v;
49 int counter; 49 int counter;
50 snd_util_memblk_t *block; /* allocated data block */ 50 struct snd_util_memblk *block; /* allocated data block */
51 struct snd_sf_sample *next; 51 struct snd_sf_sample *next;
52} snd_sf_sample_t; 52};
53 53
54/* 54/*
55 * This represents all the information relating to a soundfont. 55 * This represents all the information relating to a soundfont.
56 */ 56 */
57typedef struct snd_soundfont { 57struct snd_soundfont {
58 struct snd_soundfont *next; /* Link to next */ 58 struct snd_soundfont *next; /* Link to next */
59 /*struct snd_soundfont *prev;*/ /* Link to previous */ 59 /*struct snd_soundfont *prev;*/ /* Link to previous */
60 short id; /* file id */ 60 short id; /* file id */
61 short type; /* font type */ 61 short type; /* font type */
62 unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */ 62 unsigned char name[SNDRV_SFNT_PATCH_NAME_LEN]; /* identifier */
63 snd_sf_zone_t *zones; /* Font information */ 63 struct snd_sf_zone *zones; /* Font information */
64 snd_sf_sample_t *samples; /* The sample headers */ 64 struct snd_sf_sample *samples; /* The sample headers */
65} snd_soundfont_t; 65};
66 66
67/* 67/*
68 * Type of the sample access callback 68 * Type of the sample access callback
69 */ 69 */
70typedef int (*snd_sf_sample_new_t)(void *private_data, snd_sf_sample_t *sp, 70struct snd_sf_callback {
71 snd_util_memhdr_t *hdr, const void __user *buf, long count);
72typedef int (*snd_sf_sample_free_t)(void *private_data, snd_sf_sample_t *sp,
73 snd_util_memhdr_t *hdr);
74typedef void (*snd_sf_sample_reset_t)(void *private);
75
76typedef struct snd_sf_callback {
77 void *private_data; 71 void *private_data;
78 snd_sf_sample_new_t sample_new; 72 int (*sample_new)(void *private_data, struct snd_sf_sample *sp,
79 snd_sf_sample_free_t sample_free; 73 struct snd_util_memhdr *hdr,
80 snd_sf_sample_reset_t sample_reset; 74 const void __user *buf, long count);
81} snd_sf_callback_t; 75 int (*sample_free)(void *private_data, struct snd_sf_sample *sp,
76 struct snd_util_memhdr *hdr);
77 void (*sample_reset)(void *private);
78};
82 79
83/* 80/*
84 * List of soundfonts. 81 * List of soundfonts.
85 */ 82 */
86typedef struct snd_sf_list { 83struct snd_sf_list {
87 snd_soundfont_t *currsf; /* The currently open soundfont */ 84 struct snd_soundfont *currsf; /* The currently open soundfont */
88 int open_client; /* client pointer for lock */ 85 int open_client; /* client pointer for lock */
89 int mem_used; /* used memory size */ 86 int mem_used; /* used memory size */
90 snd_sf_zone_t *presets[SF_MAX_PRESETS]; 87 struct snd_sf_zone *presets[SF_MAX_PRESETS];
91 snd_soundfont_t *fonts; /* The list of soundfonts */ 88 struct snd_soundfont *fonts; /* The list of soundfonts */
92 int fonts_size; /* number of fonts allocated */ 89 int fonts_size; /* number of fonts allocated */
93 int zone_counter; /* last allocated time for zone */ 90 int zone_counter; /* last allocated time for zone */
94 int sample_counter; /* last allocated time for sample */ 91 int sample_counter; /* last allocated time for sample */
95 int zone_locked; /* locked time for zone */ 92 int zone_locked; /* locked time for zone */
96 int sample_locked; /* locked time for sample */ 93 int sample_locked; /* locked time for sample */
97 snd_sf_callback_t callback; /* callback functions */ 94 struct snd_sf_callback callback; /* callback functions */
98 int presets_locked; 95 int presets_locked;
99 struct semaphore presets_mutex; 96 struct semaphore presets_mutex;
100 spinlock_t lock; 97 spinlock_t lock;
101 snd_util_memhdr_t *memhdr; 98 struct snd_util_memhdr *memhdr;
102} snd_sf_list_t; 99};
103 100
104/* Prototypes for soundfont.c */ 101/* Prototypes for soundfont.c */
105int snd_soundfont_load(snd_sf_list_t *sflist, const void __user *data, long count, int client); 102int snd_soundfont_load(struct snd_sf_list *sflist, const void __user *data,
106int snd_soundfont_load_guspatch(snd_sf_list_t *sflist, const char __user *data, 103 long count, int client);
104int snd_soundfont_load_guspatch(struct snd_sf_list *sflist, const char __user *data,
107 long count, int client); 105 long count, int client);
108int snd_soundfont_close_check(snd_sf_list_t *sflist, int client); 106int snd_soundfont_close_check(struct snd_sf_list *sflist, int client);
109 107
110snd_sf_list_t *snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr); 108struct snd_sf_list *snd_sf_new(struct snd_sf_callback *callback,
111void snd_sf_free(snd_sf_list_t *sflist); 109 struct snd_util_memhdr *hdr);
110void snd_sf_free(struct snd_sf_list *sflist);
112 111
113int snd_soundfont_remove_samples(snd_sf_list_t *sflist); 112int snd_soundfont_remove_samples(struct snd_sf_list *sflist);
114int snd_soundfont_remove_unlocked(snd_sf_list_t *sflist); 113int snd_soundfont_remove_unlocked(struct snd_sf_list *sflist);
115 114
116int snd_soundfont_search_zone(snd_sf_list_t *sflist, int *notep, int vel, 115int snd_soundfont_search_zone(struct snd_sf_list *sflist, int *notep, int vel,
117 int preset, int bank, 116 int preset, int bank,
118 int def_preset, int def_bank, 117 int def_preset, int def_bank,
119 snd_sf_zone_t **table, int max_layers); 118 struct snd_sf_zone **table, int max_layers);
120 119
121/* Parameter conversions */ 120/* Parameter conversions */
122int snd_sf_calc_parm_hold(int msec); 121int snd_sf_calc_parm_hold(int msec);
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index b82e408e758f..a4f554520197 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -24,15 +24,15 @@
24 24
25#include <linux/videodev.h> 25#include <linux/videodev.h>
26 26
27typedef struct snd_tea575x tea575x_t; 27struct snd_tea575x;
28 28
29struct snd_tea575x_ops { 29struct snd_tea575x_ops {
30 void (*write)(tea575x_t *tea, unsigned int val); 30 void (*write)(struct snd_tea575x *tea, unsigned int val);
31 unsigned int (*read)(tea575x_t *tea); 31 unsigned int (*read)(struct snd_tea575x *tea);
32}; 32};
33 33
34struct snd_tea575x { 34struct snd_tea575x {
35 snd_card_t *card; 35 struct snd_card *card;
36 struct video_device vd; /* video device */ 36 struct video_device vd; /* video device */
37 struct file_operations fops; 37 struct file_operations fops;
38 int dev_nr; /* requested device number + 1 */ 38 int dev_nr; /* requested device number + 1 */
@@ -45,7 +45,7 @@ struct snd_tea575x {
45 void *private_data; 45 void *private_data;
46}; 46};
47 47
48void snd_tea575x_init(tea575x_t *tea); 48void snd_tea575x_init(struct snd_tea575x *tea);
49void snd_tea575x_exit(tea575x_t *tea); 49void snd_tea575x_exit(struct snd_tea575x *tea);
50 50
51#endif /* __SOUND_TEA575X_TUNER_H */ 51#endif /* __SOUND_TEA575X_TUNER_H */
diff --git a/include/sound/tea6330t.h b/include/sound/tea6330t.h
index 3896c0a50907..51b282b76896 100644
--- a/include/sound/tea6330t.h
+++ b/include/sound/tea6330t.h
@@ -22,21 +22,10 @@
22 * 22 *
23 */ 23 */
24 24
25#include "control.h"
26#include "i2c.h" /* generic i2c support */ 25#include "i2c.h" /* generic i2c support */
27 26
28typedef struct { 27int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer);
29 snd_i2c_device_t *device; 28int snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus,
30 snd_i2c_bus_t *bus; 29 int equalizer, int fader);
31 int equalizer;
32 int fader;
33 unsigned char regs[8];
34 unsigned char mleft, mright;
35 unsigned char bass, treble;
36 unsigned char max_bass, max_treble;
37} tea6330t_t;
38
39extern int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer);
40extern int snd_tea6330t_update_mixer(snd_card_t * card, snd_i2c_bus_t * bus, int equalizer, int fader);
41 30
42#endif /* __SOUND_TEA6330T_H */ 31#endif /* __SOUND_TEA6330T_H */
diff --git a/include/sound/timer.h b/include/sound/timer.h
index b55f38ae56e1..5ece2bf541dc 100644
--- a/include/sound/timer.h
+++ b/include/sound/timer.h
@@ -26,20 +26,6 @@
26#include <sound/asound.h> 26#include <sound/asound.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28 28
29typedef enum sndrv_timer_class snd_timer_class_t;
30typedef enum sndrv_timer_slave_class snd_timer_slave_class_t;
31typedef enum sndrv_timer_global snd_timer_global_t;
32typedef struct sndrv_timer_id snd_timer_id_t;
33typedef struct sndrv_timer_ginfo snd_timer_ginfo_t;
34typedef struct sndrv_timer_gparams snd_timer_gparams_t;
35typedef struct sndrv_timer_gstatus snd_timer_gstatus_t;
36typedef struct sndrv_timer_select snd_timer_select_t;
37typedef struct sndrv_timer_info snd_timer_info_t;
38typedef struct sndrv_timer_params snd_timer_params_t;
39typedef struct sndrv_timer_status snd_timer_status_t;
40typedef struct sndrv_timer_read snd_timer_read_t;
41typedef struct sndrv_timer_tread snd_timer_tread_t;
42
43#define snd_timer_chip(timer) ((timer)->private_data) 29#define snd_timer_chip(timer) ((timer)->private_data)
44 30
45#define SNDRV_TIMER_DEVICES 16 31#define SNDRV_TIMER_DEVICES 16
@@ -64,11 +50,9 @@ typedef struct sndrv_timer_tread snd_timer_tread_t;
64#define SNDRV_TIMER_FLG_CHANGE 0x00000001 50#define SNDRV_TIMER_FLG_CHANGE 0x00000001
65#define SNDRV_TIMER_FLG_RESCHED 0x00000002 /* need reschedule */ 51#define SNDRV_TIMER_FLG_RESCHED 0x00000002 /* need reschedule */
66 52
67typedef void (*snd_timer_callback_t) (snd_timer_instance_t * timeri, unsigned long ticks, unsigned long resolution); 53struct snd_timer;
68typedef void (*snd_timer_ccallback_t) (snd_timer_instance_t * timeri, enum sndrv_timer_event event,
69 struct timespec * tstamp, unsigned long resolution);
70 54
71struct _snd_timer_hardware { 55struct snd_timer_hardware {
72 /* -- must be filled with low-level driver */ 56 /* -- must be filled with low-level driver */
73 unsigned int flags; /* various flags */ 57 unsigned int flags; /* various flags */
74 unsigned long resolution; /* average timer resolution for one tick in nsec */ 58 unsigned long resolution; /* average timer resolution for one tick in nsec */
@@ -76,18 +60,18 @@ struct _snd_timer_hardware {
76 unsigned long resolution_max; /* maximal resolution */ 60 unsigned long resolution_max; /* maximal resolution */
77 unsigned long ticks; /* max timer ticks per interrupt */ 61 unsigned long ticks; /* max timer ticks per interrupt */
78 /* -- low-level functions -- */ 62 /* -- low-level functions -- */
79 int (*open) (snd_timer_t * timer); 63 int (*open) (struct snd_timer * timer);
80 int (*close) (snd_timer_t * timer); 64 int (*close) (struct snd_timer * timer);
81 unsigned long (*c_resolution) (snd_timer_t * timer); 65 unsigned long (*c_resolution) (struct snd_timer * timer);
82 int (*start) (snd_timer_t * timer); 66 int (*start) (struct snd_timer * timer);
83 int (*stop) (snd_timer_t * timer); 67 int (*stop) (struct snd_timer * timer);
84 int (*set_period) (snd_timer_t * timer, unsigned long period_num, unsigned long period_den); 68 int (*set_period) (struct snd_timer * timer, unsigned long period_num, unsigned long period_den);
85 int (*precise_resolution) (snd_timer_t * timer, unsigned long *num, unsigned long *den); 69 int (*precise_resolution) (struct snd_timer * timer, unsigned long *num, unsigned long *den);
86}; 70};
87 71
88struct _snd_timer { 72struct snd_timer {
89 snd_timer_class_t tmr_class; 73 int tmr_class;
90 snd_card_t *card; 74 struct snd_card *card;
91 struct module *module; 75 struct module *module;
92 int tmr_device; 76 int tmr_device;
93 int tmr_subdevice; 77 int tmr_subdevice;
@@ -97,8 +81,8 @@ struct _snd_timer {
97 int running; /* running instances */ 81 int running; /* running instances */
98 unsigned long sticks; /* schedule ticks */ 82 unsigned long sticks; /* schedule ticks */
99 void *private_data; 83 void *private_data;
100 void (*private_free) (snd_timer_t *timer); 84 void (*private_free) (struct snd_timer *timer);
101 struct _snd_timer_hardware hw; 85 struct snd_timer_hardware hw;
102 spinlock_t lock; 86 spinlock_t lock;
103 struct list_head device_list; 87 struct list_head device_list;
104 struct list_head open_list_head; 88 struct list_head open_list_head;
@@ -108,49 +92,53 @@ struct _snd_timer {
108 struct tasklet_struct task_queue; 92 struct tasklet_struct task_queue;
109}; 93};
110 94
111struct _snd_timer_instance { 95struct snd_timer_instance {
112 snd_timer_t * timer; 96 struct snd_timer *timer;
113 char *owner; 97 char *owner;
114 unsigned int flags; 98 unsigned int flags;
115 void *private_data; 99 void *private_data;
116 void (*private_free) (snd_timer_instance_t *ti); 100 void (*private_free) (struct snd_timer_instance *ti);
117 snd_timer_callback_t callback; 101 void (*callback) (struct snd_timer_instance *timeri,
118 snd_timer_ccallback_t ccallback; 102 unsigned long ticks, unsigned long resolution);
103 void (*ccallback) (struct snd_timer_instance * timeri,
104 int event,
105 struct timespec * tstamp,
106 unsigned long resolution);
119 void *callback_data; 107 void *callback_data;
120 unsigned long ticks; /* auto-load ticks when expired */ 108 unsigned long ticks; /* auto-load ticks when expired */
121 unsigned long cticks; /* current ticks */ 109 unsigned long cticks; /* current ticks */
122 unsigned long pticks; /* accumulated ticks for callback */ 110 unsigned long pticks; /* accumulated ticks for callback */
123 unsigned long resolution; /* current resolution for tasklet */ 111 unsigned long resolution; /* current resolution for tasklet */
124 unsigned long lost; /* lost ticks */ 112 unsigned long lost; /* lost ticks */
125 snd_timer_slave_class_t slave_class; 113 int slave_class;
126 unsigned int slave_id; 114 unsigned int slave_id;
127 struct list_head open_list; 115 struct list_head open_list;
128 struct list_head active_list; 116 struct list_head active_list;
129 struct list_head ack_list; 117 struct list_head ack_list;
130 struct list_head slave_list_head; 118 struct list_head slave_list_head;
131 struct list_head slave_active_head; 119 struct list_head slave_active_head;
132 snd_timer_instance_t *master; 120 struct snd_timer_instance *master;
133}; 121};
134 122
135/* 123/*
136 * Registering 124 * Registering
137 */ 125 */
138 126
139extern int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t ** rtimer); 127int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, struct snd_timer **rtimer);
140extern void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct timespec *tstamp); 128void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstamp);
141extern int snd_timer_global_new(char *id, int device, snd_timer_t **rtimer); 129int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer);
142extern int snd_timer_global_free(snd_timer_t *timer); 130int snd_timer_global_free(struct snd_timer *timer);
143extern int snd_timer_global_register(snd_timer_t *timer); 131int snd_timer_global_register(struct snd_timer *timer);
144extern int snd_timer_global_unregister(snd_timer_t *timer); 132int snd_timer_global_unregister(struct snd_timer *timer);
145 133
146extern int snd_timer_open(snd_timer_instance_t ** ti, char *owner, snd_timer_id_t *tid, unsigned int slave_id); 134int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id);
147extern int snd_timer_close(snd_timer_instance_t * timeri); 135int snd_timer_close(struct snd_timer_instance *timeri);
148extern unsigned long snd_timer_resolution(snd_timer_instance_t * timeri); 136unsigned long snd_timer_resolution(struct snd_timer_instance *timeri);
149extern int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks); 137int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks);
150extern int snd_timer_stop(snd_timer_instance_t * timeri); 138int snd_timer_stop(struct snd_timer_instance *timeri);
151extern int snd_timer_continue(snd_timer_instance_t * timeri); 139int snd_timer_continue(struct snd_timer_instance *timeri);
152extern int snd_timer_pause(snd_timer_instance_t * timeri); 140int snd_timer_pause(struct snd_timer_instance *timeri);
153 141
154extern void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left); 142void snd_timer_interrupt(struct snd_timer *timer, unsigned long ticks_left);
155 143
156#endif /* __SOUND_TIMER_H */ 144#endif /* __SOUND_TIMER_H */
diff --git a/include/sound/trident.h b/include/sound/trident.h
index a408d3925050..9752243241e5 100644
--- a/include/sound/trident.h
+++ b/include/sound/trident.h
@@ -253,43 +253,43 @@ enum serial_intf_ctrl_bits {
253#define T4D_DEFAULT_PCM_RVOL 127 /* 0 - 127 */ 253#define T4D_DEFAULT_PCM_RVOL 127 /* 0 - 127 */
254#define T4D_DEFAULT_PCM_CVOL 127 /* 0 - 127 */ 254#define T4D_DEFAULT_PCM_CVOL 127 /* 0 - 127 */
255 255
256typedef struct _snd_trident trident_t; 256struct snd_trident;
257typedef struct _snd_trident_voice snd_trident_voice_t; 257struct snd_trident_voice;
258typedef struct _snd_trident_pcm_mixer snd_trident_pcm_mixer_t; 258struct snd_trident_pcm_mixer;
259 259
260typedef struct { 260struct snd_trident_sample_ops {
261 void (*sample_start)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_position_t position); 261 void (*sample_start)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_position_t position);
262 void (*sample_stop)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_stop_mode_t mode); 262 void (*sample_stop)(struct snd_trident *gus, struct snd_trident_voice *voice, int mode);
263 void (*sample_freq)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_frequency_t freq); 263 void (*sample_freq)(struct snd_trident *gus, struct snd_trident_voice *voice, snd_seq_frequency_t freq);
264 void (*sample_volume)(trident_t *gus, snd_trident_voice_t *voice, snd_seq_ev_volume_t *volume); 264 void (*sample_volume)(struct snd_trident *gus, struct snd_trident_voice *voice, struct snd_seq_ev_volume *volume);
265 void (*sample_loop)(trident_t *card, snd_trident_voice_t *voice, snd_seq_ev_loop_t *loop); 265 void (*sample_loop)(struct snd_trident *card, struct snd_trident_voice *voice, struct snd_seq_ev_loop *loop);
266 void (*sample_pos)(trident_t *card, snd_trident_voice_t *voice, snd_seq_position_t position); 266 void (*sample_pos)(struct snd_trident *card, struct snd_trident_voice *voice, snd_seq_position_t position);
267 void (*sample_private1)(trident_t *card, snd_trident_voice_t *voice, unsigned char *data); 267 void (*sample_private1)(struct snd_trident *card, struct snd_trident_voice *voice, unsigned char *data);
268} snd_trident_sample_ops_t; 268};
269 269
270typedef struct { 270struct snd_trident_port {
271 snd_midi_channel_set_t * chset; 271 struct snd_midi_channel_set * chset;
272 trident_t * trident; 272 struct snd_trident * trident;
273 int mode; /* operation mode */ 273 int mode; /* operation mode */
274 int client; /* sequencer client number */ 274 int client; /* sequencer client number */
275 int port; /* sequencer port number */ 275 int port; /* sequencer port number */
276 unsigned int midi_has_voices: 1; 276 unsigned int midi_has_voices: 1;
277} snd_trident_port_t; 277};
278 278
279typedef struct snd_trident_memblk_arg { 279struct snd_trident_memblk_arg {
280 short first_page, last_page; 280 short first_page, last_page;
281} snd_trident_memblk_arg_t; 281};
282 282
283typedef struct { 283struct snd_trident_tlb {
284 unsigned int * entries; /* 16k-aligned TLB table */ 284 unsigned int * entries; /* 16k-aligned TLB table */
285 dma_addr_t entries_dmaaddr; /* 16k-aligned PCI address to TLB table */ 285 dma_addr_t entries_dmaaddr; /* 16k-aligned PCI address to TLB table */
286 unsigned long * shadow_entries; /* shadow entries with virtual addresses */ 286 unsigned long * shadow_entries; /* shadow entries with virtual addresses */
287 struct snd_dma_buffer buffer; 287 struct snd_dma_buffer buffer;
288 snd_util_memhdr_t * memhdr; /* page allocation list */ 288 struct snd_util_memhdr * memhdr; /* page allocation list */
289 struct snd_dma_buffer silent_page; 289 struct snd_dma_buffer silent_page;
290} snd_trident_tlb_t; 290};
291 291
292struct _snd_trident_voice { 292struct snd_trident_voice {
293 unsigned int number; 293 unsigned int number;
294 unsigned int use: 1, 294 unsigned int use: 1,
295 pcm: 1, 295 pcm: 1,
@@ -300,8 +300,8 @@ struct _snd_trident_voice {
300 unsigned char port; 300 unsigned char port;
301 unsigned char index; 301 unsigned char index;
302 302
303 snd_seq_instr_t instr; 303 struct snd_seq_instr instr;
304 snd_trident_sample_ops_t *sample_ops; 304 struct snd_trident_sample_ops *sample_ops;
305 305
306 /* channel parameters */ 306 /* channel parameters */
307 unsigned int CSO; /* 24 bits (16 on DX) */ 307 unsigned int CSO; /* 24 bits (16 on DX) */
@@ -323,13 +323,13 @@ struct _snd_trident_voice {
323 323
324 unsigned int negCSO; /* nonzero - use negative CSO */ 324 unsigned int negCSO; /* nonzero - use negative CSO */
325 325
326 snd_util_memblk_t *memblk; /* memory block if TLB enabled */ 326 struct snd_util_memblk *memblk; /* memory block if TLB enabled */
327 327
328 /* PCM data */ 328 /* PCM data */
329 329
330 trident_t *trident; 330 struct snd_trident *trident;
331 snd_pcm_substream_t *substream; 331 struct snd_pcm_substream *substream;
332 snd_trident_voice_t *extra; /* extra PCM voice (acts as interrupt generator) */ 332 struct snd_trident_voice *extra; /* extra PCM voice (acts as interrupt generator) */
333 unsigned int running: 1, 333 unsigned int running: 1,
334 capture: 1, 334 capture: 1,
335 spdif: 1, 335 spdif: 1,
@@ -347,25 +347,25 @@ struct _snd_trident_voice {
347 /* --- */ 347 /* --- */
348 348
349 void *private_data; 349 void *private_data;
350 void (*private_free)(snd_trident_voice_t *voice); 350 void (*private_free)(struct snd_trident_voice *voice);
351}; 351};
352 352
353struct _snd_4dwave { 353struct snd_4dwave {
354 int seq_client; 354 int seq_client;
355 355
356 snd_trident_port_t seq_ports[4]; 356 struct snd_trident_port seq_ports[4];
357 snd_simple_ops_t simple_ops; 357 struct snd_simple_ops simple_ops;
358 snd_seq_kinstr_list_t *ilist; 358 struct snd_seq_kinstr_list *ilist;
359 359
360 snd_trident_voice_t voices[64]; 360 struct snd_trident_voice voices[64];
361 361
362 int ChanSynthCount; /* number of allocated synth channels */ 362 int ChanSynthCount; /* number of allocated synth channels */
363 int max_size; /* maximum synth memory size in bytes */ 363 int max_size; /* maximum synth memory size in bytes */
364 int current_size; /* current allocated synth mem in bytes */ 364 int current_size; /* current allocated synth mem in bytes */
365}; 365};
366 366
367struct _snd_trident_pcm_mixer { 367struct snd_trident_pcm_mixer {
368 snd_trident_voice_t *voice; /* active voice */ 368 struct snd_trident_voice *voice; /* active voice */
369 unsigned short vol; /* front volume */ 369 unsigned short vol; /* front volume */
370 unsigned char pan; /* pan control */ 370 unsigned char pan; /* pan control */
371 unsigned char rvol; /* rear volume */ 371 unsigned char rvol; /* rear volume */
@@ -373,7 +373,7 @@ struct _snd_trident_pcm_mixer {
373 unsigned char pad; 373 unsigned char pad;
374}; 374};
375 375
376struct _snd_trident { 376struct snd_trident {
377 int irq; 377 int irq;
378 378
379 unsigned int device; /* device ID */ 379 unsigned int device; /* device ID */
@@ -386,13 +386,13 @@ struct _snd_trident {
386 unsigned int spurious_irq_count; 386 unsigned int spurious_irq_count;
387 unsigned int spurious_irq_max_delta; 387 unsigned int spurious_irq_max_delta;
388 388
389 snd_trident_tlb_t tlb; /* TLB entries for NX cards */ 389 struct snd_trident_tlb tlb; /* TLB entries for NX cards */
390 390
391 unsigned char spdif_ctrl; 391 unsigned char spdif_ctrl;
392 unsigned char spdif_pcm_ctrl; 392 unsigned char spdif_pcm_ctrl;
393 unsigned int spdif_bits; 393 unsigned int spdif_bits;
394 unsigned int spdif_pcm_bits; 394 unsigned int spdif_pcm_bits;
395 snd_kcontrol_t *spdif_pcm_ctl; /* S/PDIF settings */ 395 struct snd_kcontrol *spdif_pcm_ctl; /* S/PDIF settings */
396 unsigned int ac97_ctrl; 396 unsigned int ac97_ctrl;
397 397
398 unsigned int ChanMap[2]; /* allocation map for hardware channels */ 398 unsigned int ChanMap[2]; /* allocation map for hardware channels */
@@ -403,7 +403,7 @@ struct _snd_trident {
403 unsigned int ac97_detect: 1; /* 1 = AC97 in detection phase */ 403 unsigned int ac97_detect: 1; /* 1 = AC97 in detection phase */
404 unsigned int in_suspend: 1; /* 1 during suspend/resume */ 404 unsigned int in_suspend: 1; /* 1 during suspend/resume */
405 405
406 struct _snd_4dwave synth; /* synth specific variables */ 406 struct snd_4dwave synth; /* synth specific variables */
407 407
408 spinlock_t event_lock; 408 spinlock_t event_lock;
409 spinlock_t voice_alloc; 409 spinlock_t voice_alloc;
@@ -411,52 +411,57 @@ struct _snd_trident {
411 struct snd_dma_device dma_dev; 411 struct snd_dma_device dma_dev;
412 412
413 struct pci_dev *pci; 413 struct pci_dev *pci;
414 snd_card_t *card; 414 struct snd_card *card;
415 snd_pcm_t *pcm; /* ADC/DAC PCM */ 415 struct snd_pcm *pcm; /* ADC/DAC PCM */
416 snd_pcm_t *foldback; /* Foldback PCM */ 416 struct snd_pcm *foldback; /* Foldback PCM */
417 snd_pcm_t *spdif; /* SPDIF PCM */ 417 struct snd_pcm *spdif; /* SPDIF PCM */
418 snd_rawmidi_t *rmidi; 418 struct snd_rawmidi *rmidi;
419 snd_seq_device_t *seq_dev; 419 struct snd_seq_device *seq_dev;
420 420
421 ac97_bus_t *ac97_bus; 421 struct snd_ac97_bus *ac97_bus;
422 ac97_t *ac97; 422 struct snd_ac97 *ac97;
423 ac97_t *ac97_sec; 423 struct snd_ac97 *ac97_sec;
424 424
425 unsigned int musicvol_wavevol; 425 unsigned int musicvol_wavevol;
426 snd_trident_pcm_mixer_t pcm_mixer[32]; 426 struct snd_trident_pcm_mixer pcm_mixer[32];
427 snd_kcontrol_t *ctl_vol; /* front volume */ 427 struct snd_kcontrol *ctl_vol; /* front volume */
428 snd_kcontrol_t *ctl_pan; /* pan */ 428 struct snd_kcontrol *ctl_pan; /* pan */
429 snd_kcontrol_t *ctl_rvol; /* rear volume */ 429 struct snd_kcontrol *ctl_rvol; /* rear volume */
430 snd_kcontrol_t *ctl_cvol; /* center volume */ 430 struct snd_kcontrol *ctl_cvol; /* center volume */
431 431
432 spinlock_t reg_lock; 432 spinlock_t reg_lock;
433 433
434 struct gameport *gameport; 434 struct gameport *gameport;
435}; 435};
436 436
437int snd_trident_create(snd_card_t * card, 437int snd_trident_create(struct snd_card *card,
438 struct pci_dev *pci, 438 struct pci_dev *pci,
439 int pcm_streams, 439 int pcm_streams,
440 int pcm_spdif_device, 440 int pcm_spdif_device,
441 int max_wavetable_size, 441 int max_wavetable_size,
442 trident_t ** rtrident); 442 struct snd_trident ** rtrident);
443int snd_trident_create_gameport(trident_t *trident); 443int snd_trident_create_gameport(struct snd_trident *trident);
444 444
445int snd_trident_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); 445int snd_trident_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
446int snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); 446int snd_trident_foldback_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
447int snd_trident_spdif_pcm(trident_t * trident, int device, snd_pcm_t **rpcm); 447int snd_trident_spdif_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm);
448int snd_trident_attach_synthesizer(trident_t * trident); 448int snd_trident_attach_synthesizer(struct snd_trident * trident);
449snd_trident_voice_t *snd_trident_alloc_voice(trident_t * trident, int type, int client, int port); 449struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type,
450void snd_trident_free_voice(trident_t * trident, snd_trident_voice_t *voice); 450 int client, int port);
451void snd_trident_start_voice(trident_t * trident, unsigned int voice); 451void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voice *voice);
452void snd_trident_stop_voice(trident_t * trident, unsigned int voice); 452void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice);
453void snd_trident_write_voice_regs(trident_t * trident, snd_trident_voice_t *voice); 453void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice);
454void snd_trident_write_voice_regs(struct snd_trident * trident, struct snd_trident_voice *voice);
455int snd_trident_suspend(struct pci_dev *pci, pm_message_t state);
456int snd_trident_resume(struct pci_dev *pci);
454 457
455/* TLB memory allocation */ 458/* TLB memory allocation */
456snd_util_memblk_t *snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream); 459struct snd_util_memblk *snd_trident_alloc_pages(struct snd_trident *trident,
457int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk); 460 struct snd_pcm_substream *substream);
458snd_util_memblk_t *snd_trident_synth_alloc(trident_t *trident, unsigned int size); 461int snd_trident_free_pages(struct snd_trident *trident, struct snd_util_memblk *blk);
459int snd_trident_synth_free(trident_t *trident, snd_util_memblk_t *blk); 462struct snd_util_memblk *snd_trident_synth_alloc(struct snd_trident *trident, unsigned int size);
460int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size); 463int snd_trident_synth_free(struct snd_trident *trident, struct snd_util_memblk *blk);
464int snd_trident_synth_copy_from_user(struct snd_trident *trident, struct snd_util_memblk *blk,
465 int offset, const char __user *data, int size);
461 466
462#endif /* __SOUND_TRIDENT_H */ 467#endif /* __SOUND_TRIDENT_H */
diff --git a/include/sound/typedefs.h b/include/sound/typedefs.h
new file mode 100644
index 000000000000..f454b0206b93
--- /dev/null
+++ b/include/sound/typedefs.h
@@ -0,0 +1,173 @@
1/*
2 * Typedef's for backward compatibility (for out-of-kernel drivers)
3 *
4 * This file will be removed soon in future
5 */
6
7/* core stuff */
8typedef struct snd_card snd_card_t;
9typedef struct snd_device snd_device_t;
10typedef struct snd_device_ops snd_device_ops_t;
11typedef enum snd_card_type snd_card_type_t;
12typedef struct snd_minor snd_minor_t;
13
14/* info */
15typedef struct snd_info_entry snd_info_entry_t;
16typedef struct snd_info_buffer snd_info_buffer_t;
17
18/* control */
19typedef struct snd_ctl_file snd_ctl_file_t;
20typedef struct snd_kcontrol snd_kcontrol_t;
21typedef struct snd_kcontrol_new snd_kcontrol_new_t;
22typedef struct snd_kcontrol_volatile snd_kcontrol_volatile_t;
23typedef struct snd_kctl_event snd_kctl_event_t;
24typedef struct snd_aes_iec958 snd_aes_iec958_t;
25typedef struct snd_ctl_card_info snd_ctl_card_info_t;
26typedef struct snd_ctl_elem_id snd_ctl_elem_id_t;
27typedef struct snd_ctl_elem_list snd_ctl_elem_list_t;
28typedef struct snd_ctl_elem_info snd_ctl_elem_info_t;
29typedef struct snd_ctl_elem_value snd_ctl_elem_value_t;
30typedef struct snd_ctl_event snd_ctl_event_t;
31#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
32typedef struct snd_mixer_oss snd_mixer_oss_t;
33#endif
34
35/* timer */
36typedef struct snd_timer snd_timer_t;
37typedef struct snd_timer_instance snd_timer_instance_t;
38typedef struct snd_timer_id snd_timer_id_t;
39typedef struct snd_timer_ginfo snd_timer_ginfo_t;
40typedef struct snd_timer_gparams snd_timer_gparams_t;
41typedef struct snd_timer_gstatus snd_timer_gstatus_t;
42typedef struct snd_timer_select snd_timer_select_t;
43typedef struct snd_timer_info snd_timer_info_t;
44typedef struct snd_timer_params snd_timer_params_t;
45typedef struct snd_timer_status snd_timer_status_t;
46typedef struct snd_timer_read snd_timer_read_t;
47typedef struct snd_timer_tread snd_timer_tread_t;
48
49/* PCM */
50typedef struct snd_pcm snd_pcm_t;
51typedef struct snd_pcm_str snd_pcm_str_t;
52typedef struct snd_pcm_substream snd_pcm_substream_t;
53typedef struct snd_pcm_info snd_pcm_info_t;
54typedef struct snd_pcm_hw_params snd_pcm_hw_params_t;
55typedef struct snd_pcm_sw_params snd_pcm_sw_params_t;
56typedef struct snd_pcm_channel_info snd_pcm_channel_info_t;
57typedef struct snd_pcm_status snd_pcm_status_t;
58typedef struct snd_pcm_mmap_status snd_pcm_mmap_status_t;
59typedef struct snd_pcm_mmap_control snd_pcm_mmap_control_t;
60typedef struct snd_mask snd_mask_t;
61typedef struct snd_sg_buf snd_pcm_sgbuf_t;
62
63typedef struct snd_interval snd_interval_t;
64typedef struct snd_xferi snd_xferi_t;
65typedef struct snd_xfern snd_xfern_t;
66typedef struct snd_xferv snd_xferv_t;
67
68typedef struct snd_pcm_file snd_pcm_file_t;
69typedef struct snd_pcm_runtime snd_pcm_runtime_t;
70typedef struct snd_pcm_hardware snd_pcm_hardware_t;
71typedef struct snd_pcm_ops snd_pcm_ops_t;
72typedef struct snd_pcm_hw_rule snd_pcm_hw_rule_t;
73typedef struct snd_pcm_hw_constraints snd_pcm_hw_constraints_t;
74typedef struct snd_ratnum ratnum_t;
75typedef struct snd_ratden ratden_t;
76typedef struct snd_pcm_hw_constraint_ratnums snd_pcm_hw_constraint_ratnums_t;
77typedef struct snd_pcm_hw_constraint_ratdens snd_pcm_hw_constraint_ratdens_t;
78typedef struct snd_pcm_hw_constraint_list snd_pcm_hw_constraint_list_t;
79typedef struct snd_pcm_group snd_pcm_group_t;
80typedef struct snd_pcm_notify snd_pcm_notify_t;
81
82/* rawmidi */
83typedef struct snd_rawmidi snd_rawmidi_t;
84typedef struct snd_rawmidi_info snd_rawmidi_info_t;
85typedef struct snd_rawmidi_params snd_rawmidi_params_t;
86typedef struct snd_rawmidi_status snd_rawmidi_status_t;
87typedef struct snd_rawmidi_runtime snd_rawmidi_runtime_t;
88typedef struct snd_rawmidi_substream snd_rawmidi_substream_t;
89typedef struct snd_rawmidi_str snd_rawmidi_str_t;
90typedef struct snd_rawmidi_ops snd_rawmidi_ops_t;
91typedef struct snd_rawmidi_global_ops snd_rawmidi_global_ops_t;
92typedef struct snd_rawmidi_file snd_rawmidi_file_t;
93
94/* hwdep */
95typedef struct snd_hwdep snd_hwdep_t;
96typedef struct snd_hwdep_info snd_hwdep_info_t;
97typedef struct snd_hwdep_dsp_status snd_hwdep_dsp_status_t;
98typedef struct snd_hwdep_dsp_image snd_hwdep_dsp_image_t;
99typedef struct snd_hwdep_ops snd_hwdep_ops_t;
100
101/* sequencer */
102typedef struct snd_seq_port_info snd_seq_port_info_t;
103typedef struct snd_seq_port_subscribe snd_seq_port_subscribe_t;
104typedef struct snd_seq_event snd_seq_event_t;
105typedef struct snd_seq_addr snd_seq_addr_t;
106typedef struct snd_seq_ev_volume snd_seq_ev_volume_t;
107typedef struct snd_seq_ev_loop snd_seq_ev_loop_t;
108typedef struct snd_seq_remove_events snd_seq_remove_events_t;
109typedef struct snd_seq_query_subs snd_seq_query_subs_t;
110typedef struct snd_seq_system_info snd_seq_system_info_t;
111typedef struct snd_seq_client_info snd_seq_client_info_t;
112typedef struct snd_seq_queue_info snd_seq_queue_info_t;
113typedef struct snd_seq_queue_status snd_seq_queue_status_t;
114typedef struct snd_seq_queue_tempo snd_seq_queue_tempo_t;
115typedef struct snd_seq_queue_owner snd_seq_queue_owner_t;
116typedef struct snd_seq_queue_timer snd_seq_queue_timer_t;
117typedef struct snd_seq_queue_client snd_seq_queue_client_t;
118typedef struct snd_seq_client_pool snd_seq_client_pool_t;
119typedef struct snd_seq_instr snd_seq_instr_t;
120typedef struct snd_seq_instr_data snd_seq_instr_data_t;
121typedef struct snd_seq_instr_header snd_seq_instr_header_t;
122
123typedef struct snd_seq_user_client user_client_t;
124typedef struct snd_seq_kernel_client kernel_client_t;
125typedef struct snd_seq_client client_t;
126typedef struct snd_seq_queue queue_t;
127
128/* seq_device */
129typedef struct snd_seq_device snd_seq_device_t;
130typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
131
132/* seq_midi */
133typedef struct snd_midi_event snd_midi_event_t;
134
135/* seq_midi_emul */
136typedef struct snd_midi_channel snd_midi_channel_t;
137typedef struct snd_midi_channel_set snd_midi_channel_set_t;
138typedef struct snd_midi_op snd_midi_op_t;
139
140/* seq_oss */
141typedef struct snd_seq_oss_arg snd_seq_oss_arg_t;
142typedef struct snd_seq_oss_callback snd_seq_oss_callback_t;
143typedef struct snd_seq_oss_reg snd_seq_oss_reg_t;
144
145/* virmidi */
146typedef struct snd_virmidi_dev snd_virmidi_dev_t;
147typedef struct snd_virmidi snd_virmidi_t;
148
149/* seq_instr */
150typedef struct snd_seq_kcluster snd_seq_kcluster_t;
151typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t;
152typedef struct snd_seq_kinstr snd_seq_kinstr_t;
153typedef struct snd_seq_kinstr_list snd_seq_kinstr_list_t;
154
155/* ac97 */
156typedef struct snd_ac97_bus ac97_bus_t;
157typedef struct snd_ac97_bus_ops ac97_bus_ops_t;
158typedef struct snd_ac97_template ac97_template_t;
159typedef struct snd_ac97 ac97_t;
160
161/* opl3/4 */
162typedef struct snd_opl3 opl3_t;
163typedef struct snd_opl4 opl4_t;
164
165/* mpu401 */
166typedef struct snd_mpu401 mpu401_t;
167
168/* i2c */
169typedef struct snd_i2c_device snd_i2c_device_t;
170typedef struct snd_i2c_bus snd_i2c_bus_t;
171
172typedef struct snd_ak4531 ak4531_t;
173
diff --git a/include/sound/uda1341.h b/include/sound/uda1341.h
index 61ff65a628bc..2e564bfb37fe 100644
--- a/include/sound/uda1341.h
+++ b/include/sound/uda1341.h
@@ -15,7 +15,7 @@
15 * features support 15 * features support
16 */ 16 */
17 17
18/* $Id: uda1341.h,v 1.6 2004/05/03 17:36:50 tiwai Exp $ */ 18/* $Id: uda1341.h,v 1.8 2005/11/17 14:17:21 tiwai Exp $ */
19 19
20#define UDA1341_ALSA_NAME "snd-uda1341" 20#define UDA1341_ALSA_NAME "snd-uda1341"
21 21
@@ -37,11 +37,6 @@ enum uda1341_onoff {
37 ON, 37 ON,
38}; 38};
39 39
40const char *onoff_names[] = {
41 "Off",
42 "On",
43};
44
45enum uda1341_format { 40enum uda1341_format {
46 I2S=0, 41 I2S=0,
47 LSB16, 42 LSB16,
@@ -53,17 +48,6 @@ enum uda1341_format {
53 LSB20MSB, 48 LSB20MSB,
54}; 49};
55 50
56const char *format_names[] = {
57 "I2S-bus",
58 "LSB 16bits",
59 "LSB 18bits",
60 "LSB 20bits",
61 "MSB",
62 "in LSB 16bits/out MSB",
63 "in LSB 18bits/out MSB",
64 "in LSB 20bits/out MSB",
65};
66
67enum uda1341_fs { 51enum uda1341_fs {
68 F512=0, 52 F512=0,
69 F384, 53 F384,
@@ -71,23 +55,11 @@ enum uda1341_fs {
71 Funused, 55 Funused,
72}; 56};
73 57
74const char *fs_names[] = {
75 "512*fs",
76 "384*fs",
77 "256*fs",
78 "Unused - bad value!",
79};
80
81enum uda1341_peak { 58enum uda1341_peak {
82 BEFORE=0, 59 BEFORE=0,
83 AFTER, 60 AFTER,
84}; 61};
85 62
86const char *peak_names[] = {
87 "before",
88 "after",
89};
90
91enum uda1341_filter { 63enum uda1341_filter {
92 FLAT=0, 64 FLAT=0,
93 MIN, 65 MIN,
@@ -95,24 +67,6 @@ enum uda1341_filter {
95 MAX, 67 MAX,
96}; 68};
97 69
98const char *filter_names[] = {
99 "flat",
100 "min",
101 "min",
102 "max",
103};
104
105const char*bass_values[][16] = {
106 {"0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB",
107 "0 dB", "0 dB", "0 dB", "0 dB", "undefined", }, //flat
108 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
109 "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
110 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
111 "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
112 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "20 dB",
113 "22 dB", "24 dB", "24 dB", "24 dB", "undefined",}, // max
114};
115
116enum uda1341_mixer { 70enum uda1341_mixer {
117 DOUBLE, 71 DOUBLE,
118 LINE, 72 LINE,
@@ -120,13 +74,6 @@ enum uda1341_mixer {
120 MIXER, 74 MIXER,
121}; 75};
122 76
123const char *mixer_names[] = {
124 "double differential",
125 "input channel 1 (line in)",
126 "input channel 2 (microphone)",
127 "digital mixer",
128};
129
130enum uda1341_deemp { 77enum uda1341_deemp {
131 NONE, 78 NONE,
132 D32, 79 D32,
@@ -134,58 +81,6 @@ enum uda1341_deemp {
134 D48, 81 D48,
135}; 82};
136 83
137const char *deemp_names[] = {
138 "none",
139 "32 kHz",
140 "44.1 kHz",
141 "48 kHz",
142};
143
144const char *mic_sens_value[] = {
145 "-3 dB", "0 dB", "3 dB", "9 dB", "15 dB", "21 dB", "27 dB", "not used",
146};
147
148const unsigned short AGC_atime[] = {
149 11, 16, 11, 16, 21, 11, 16, 21,
150};
151
152const unsigned short AGC_dtime[] = {
153 100, 100, 200, 200, 200, 400, 400, 400,
154};
155
156const char *AGC_level[] = {
157 "-9.0", "-11.5", "-15.0", "-17.5",
158};
159
160const char *ig_small_value[] = {
161 "-3.0", "-2.5", "-2.0", "-1.5", "-1.0", "-0.5",
162};
163
164/*
165 * this was computed as peak_value[i] = pow((63-i)*1.42,1.013)
166 *
167 * UDA1341 datasheet on page 21: Peak value (dB) = (Peak level - 63.5)*5*log2
168 * There is an table with these values [level]=value: [3]=-90.31, [7]=-84.29
169 * [61]=-2.78, [62] = -1.48, [63] = 0.0
170 * I tried to compute it, but using but even using logarithm with base either 10 or 2
171 * i was'n able to get values in the table from the formula. So I constructed another
172 * formula (see above) to interpolate the values as good as possible. If there is some
173 * mistake, please contact me on tomas.kasparek@seznam.cz. Thanks.
174 * UDA1341TS datasheet is available at:
175 * http://www-us9.semiconductors.com/acrobat/datasheets/UDA1341TS_3.pdf
176 */
177const char *peak_value[] = {
178 "-INF dB", "N.A.", "N.A", "90.31 dB", "N.A.", "N.A.", "N.A.", "-84.29 dB",
179 "-82.65 dB", "-81.13 dB", "-79.61 dB", "-78.09 dB", "-76.57 dB", "-75.05 dB", "-73.53 dB",
180 "-72.01 dB", "-70.49 dB", "-68.97 dB", "-67.45 dB", "-65.93 dB", "-64.41 dB", "-62.90 dB",
181 "-61.38 dB", "-59.86 dB", "-58.35 dB", "-56.83 dB", "-55.32 dB", "-53.80 dB", "-52.29 dB",
182 "-50.78 dB", "-49.26 dB", "-47.75 dB", "-46.24 dB", "-44.73 dB", "-43.22 dB", "-41.71 dB",
183 "-40.20 dB", "-38.69 dB", "-37.19 dB", "-35.68 dB", "-34.17 dB", "-32.67 dB", "-31.17 dB",
184 "-29.66 dB", "-28.16 dB", "-26.66 dB", "-25.16 dB", "-23.66 dB", "-22.16 dB", "-20.67 dB",
185 "-19.17 dB", "-17.68 dB", "-16.19 dB", "-14.70 dB", "-13.21 dB", "-11.72 dB", "-10.24 dB",
186 "-8.76 dB", "-7.28 dB", "-5.81 dB", "-4.34 dB", "-2.88 dB", "-1.43 dB", "0.00 dB",
187};
188
189enum uda1341_config { 84enum uda1341_config {
190 CMD_READ_REG = 0, 85 CMD_READ_REG = 0,
191 CMD_RESET, 86 CMD_RESET,
@@ -224,7 +119,7 @@ enum write_through {
224 FLUSH, 119 FLUSH,
225}; 120};
226 121
227int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt); 122int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clnt);
228 123
229/* 124/*
230 * Local variables: 125 * Local variables:
diff --git a/include/sound/util_mem.h b/include/sound/util_mem.h
index 9d2cdfa0c42a..69944bbb5445 100644
--- a/include/sound/util_mem.h
+++ b/include/sound/util_mem.h
@@ -20,29 +20,25 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23typedef struct snd_util_memblk snd_util_memblk_t;
24typedef struct snd_util_memhdr snd_util_memhdr_t;
25typedef unsigned int snd_util_unit_t;
26
27/* 23/*
28 * memory block 24 * memory block
29 */ 25 */
30struct snd_util_memblk { 26struct snd_util_memblk {
31 snd_util_unit_t size; /* size of this block */ 27 unsigned int size; /* size of this block */
32 snd_util_unit_t offset; /* zero-offset of this block */ 28 unsigned int offset; /* zero-offset of this block */
33 struct list_head list; /* link */ 29 struct list_head list; /* link */
34}; 30};
35 31
36#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(snd_util_memblk_t)) 32#define snd_util_memblk_argptr(blk) (void*)((char*)(blk) + sizeof(struct snd_util_memblk))
37 33
38/* 34/*
39 * memory management information 35 * memory management information
40 */ 36 */
41struct snd_util_memhdr { 37struct snd_util_memhdr {
42 snd_util_unit_t size; /* size of whole data */ 38 unsigned int size; /* size of whole data */
43 struct list_head block; /* block linked-list header */ 39 struct list_head block; /* block linked-list header */
44 int nblocks; /* # of allocated blocks */ 40 int nblocks; /* # of allocated blocks */
45 snd_util_unit_t used; /* used memory size */ 41 unsigned int used; /* used memory size */
46 int block_extra_size; /* extra data size of chunk */ 42 int block_extra_size; /* extra data size of chunk */
47 struct semaphore block_mutex; /* lock */ 43 struct semaphore block_mutex; /* lock */
48}; 44};
@@ -50,15 +46,17 @@ struct snd_util_memhdr {
50/* 46/*
51 * prototypes 47 * prototypes
52 */ 48 */
53snd_util_memhdr_t *snd_util_memhdr_new(int memsize); 49struct snd_util_memhdr *snd_util_memhdr_new(int memsize);
54void snd_util_memhdr_free(snd_util_memhdr_t *hdr); 50void snd_util_memhdr_free(struct snd_util_memhdr *hdr);
55snd_util_memblk_t *snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); 51struct snd_util_memblk *snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size);
56int snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); 52int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk);
57int snd_util_mem_avail(snd_util_memhdr_t *hdr); 53int snd_util_mem_avail(struct snd_util_memhdr *hdr);
58 54
59/* functions without mutex */ 55/* functions without mutex */
60snd_util_memblk_t *__snd_util_mem_alloc(snd_util_memhdr_t *hdr, int size); 56struct snd_util_memblk *__snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size);
61void __snd_util_mem_free(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk); 57void __snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk);
62snd_util_memblk_t *__snd_util_memblk_new(snd_util_memhdr_t *hdr, snd_util_unit_t units, struct list_head *prev); 58struct snd_util_memblk *__snd_util_memblk_new(struct snd_util_memhdr *hdr,
59 unsigned int units,
60 struct list_head *prev);
63 61
64#endif /* __SOUND_UTIL_MEM_H */ 62#endif /* __SOUND_UTIL_MEM_H */
diff --git a/include/sound/version.h b/include/sound/version.h
index d1bd3b723967..919da0dd001c 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by configure. */ 1/* include/version.h. Generated by configure. */
2#define CONFIG_SND_VERSION "1.0.10rc3" 2#define CONFIG_SND_VERSION "1.0.11rc2"
3#define CONFIG_SND_DATE " (Mon Nov 07 13:30:21 2005 UTC)" 3#define CONFIG_SND_DATE " (Wed Jan 04 08:57:20 2006 UTC)"
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 7a60a3888667..5fd6f3305e0d 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -36,9 +36,6 @@
36struct firmware; 36struct firmware;
37struct device; 37struct device;
38 38
39typedef struct snd_vx_core vx_core_t;
40typedef struct vx_pipe vx_pipe_t;
41
42#define VX_DRIVER_VERSION 0x010000 /* 1.0.0 */ 39#define VX_DRIVER_VERSION 0x010000 /* 1.0.0 */
43 40
44/* 41/*
@@ -76,7 +73,7 @@ struct vx_pipe {
76 int channels; 73 int channels;
77 unsigned int differed_type; 74 unsigned int differed_type;
78 pcx_time_t pcx_time; 75 pcx_time_t pcx_time;
79 snd_pcm_substream_t *substream; 76 struct snd_pcm_substream *substream;
80 77
81 int hbuf_size; /* H-buffer size in bytes */ 78 int hbuf_size; /* H-buffer size in bytes */
82 int buffer_bytes; /* the ALSA pcm buffer size in bytes */ 79 int buffer_bytes; /* the ALSA pcm buffer size in bytes */
@@ -88,36 +85,38 @@ struct vx_pipe {
88 u64 cur_count; /* current sample position (for playback) */ 85 u64 cur_count; /* current sample position (for playback) */
89 86
90 unsigned int references; /* an output pipe may be used for monitoring and/or playback */ 87 unsigned int references; /* an output pipe may be used for monitoring and/or playback */
91 vx_pipe_t *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/ 88 struct vx_pipe *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/
92 89
93 struct tasklet_struct start_tq; 90 struct tasklet_struct start_tq;
94}; 91};
95 92
93struct vx_core;
94
96struct snd_vx_ops { 95struct snd_vx_ops {
97 /* low-level i/o */ 96 /* low-level i/o */
98 unsigned char (*in8)(vx_core_t *chip, int reg); 97 unsigned char (*in8)(struct vx_core *chip, int reg);
99 unsigned int (*in32)(vx_core_t *chip, int reg); 98 unsigned int (*in32)(struct vx_core *chip, int reg);
100 void (*out8)(vx_core_t *chip, int reg, unsigned char val); 99 void (*out8)(struct vx_core *chip, int reg, unsigned char val);
101 void (*out32)(vx_core_t *chip, int reg, unsigned int val); 100 void (*out32)(struct vx_core *chip, int reg, unsigned int val);
102 /* irq */ 101 /* irq */
103 int (*test_and_ack)(vx_core_t *chip); 102 int (*test_and_ack)(struct vx_core *chip);
104 void (*validate_irq)(vx_core_t *chip, int enable); 103 void (*validate_irq)(struct vx_core *chip, int enable);
105 /* codec */ 104 /* codec */
106 void (*write_codec)(vx_core_t *chip, int codec, unsigned int data); 105 void (*write_codec)(struct vx_core *chip, int codec, unsigned int data);
107 void (*akm_write)(vx_core_t *chip, int reg, unsigned int data); 106 void (*akm_write)(struct vx_core *chip, int reg, unsigned int data);
108 void (*reset_codec)(vx_core_t *chip); 107 void (*reset_codec)(struct vx_core *chip);
109 void (*change_audio_source)(vx_core_t *chip, int src); 108 void (*change_audio_source)(struct vx_core *chip, int src);
110 void (*set_clock_source)(vx_core_t *chp, int src); 109 void (*set_clock_source)(struct vx_core *chp, int src);
111 /* chip init */ 110 /* chip init */
112 int (*load_dsp)(vx_core_t *chip, int idx, const struct firmware *fw); 111 int (*load_dsp)(struct vx_core *chip, int idx, const struct firmware *fw);
113 void (*reset_dsp)(vx_core_t *chip); 112 void (*reset_dsp)(struct vx_core *chip);
114 void (*reset_board)(vx_core_t *chip, int cold_reset); 113 void (*reset_board)(struct vx_core *chip, int cold_reset);
115 int (*add_controls)(vx_core_t *chip); 114 int (*add_controls)(struct vx_core *chip);
116 /* pcm */ 115 /* pcm */
117 void (*dma_write)(vx_core_t *chip, snd_pcm_runtime_t *runtime, 116 void (*dma_write)(struct vx_core *chip, struct snd_pcm_runtime *runtime,
118 vx_pipe_t *pipe, int count); 117 struct vx_pipe *pipe, int count);
119 void (*dma_read)(vx_core_t *chip, snd_pcm_runtime_t *runtime, 118 void (*dma_read)(struct vx_core *chip, struct snd_pcm_runtime *runtime,
120 vx_pipe_t *pipe, int count); 119 struct vx_pipe *pipe, int count);
121}; 120};
122 121
123struct snd_vx_hardware { 122struct snd_vx_hardware {
@@ -158,10 +157,10 @@ enum {
158/* min/max values for analog output for old codecs */ 157/* min/max values for analog output for old codecs */
159#define VX_ANALOG_OUT_LEVEL_MAX 0xe3 158#define VX_ANALOG_OUT_LEVEL_MAX 0xe3
160 159
161struct snd_vx_core { 160struct vx_core {
162 /* ALSA stuff */ 161 /* ALSA stuff */
163 snd_card_t *card; 162 struct snd_card *card;
164 snd_pcm_t *pcm[VX_MAX_CODECS]; 163 struct snd_pcm *pcm[VX_MAX_CODECS];
165 int type; /* VX_TYPE_XXX */ 164 int type; /* VX_TYPE_XXX */
166 165
167 int irq; 166 int irq;
@@ -179,7 +178,7 @@ struct snd_vx_core {
179 unsigned int pcm_running; 178 unsigned int pcm_running;
180 179
181 struct device *dev; 180 struct device *dev;
182 snd_hwdep_t *hwdep; 181 struct snd_hwdep *hwdep;
183 182
184 struct vx_rmh irq_rmh; /* RMH used in interrupts */ 183 struct vx_rmh irq_rmh; /* RMH used in interrupts */
185 184
@@ -216,14 +215,14 @@ struct snd_vx_core {
216/* 215/*
217 * constructor 216 * constructor
218 */ 217 */
219vx_core_t *snd_vx_create(snd_card_t *card, struct snd_vx_hardware *hw, 218struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw,
220 struct snd_vx_ops *ops, int extra_size); 219 struct snd_vx_ops *ops, int extra_size);
221int snd_vx_setup_firmware(vx_core_t *chip); 220int snd_vx_setup_firmware(struct vx_core *chip);
222int snd_vx_load_boot_image(vx_core_t *chip, const struct firmware *dsp); 221int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *dsp);
223int snd_vx_dsp_boot(vx_core_t *chip, const struct firmware *dsp); 222int snd_vx_dsp_boot(struct vx_core *chip, const struct firmware *dsp);
224int snd_vx_dsp_load(vx_core_t *chip, const struct firmware *dsp); 223int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp);
225 224
226void snd_vx_free_firmware(vx_core_t *chip); 225void snd_vx_free_firmware(struct vx_core *chip);
227 226
228/* 227/*
229 * interrupt handler; exported for pcmcia 228 * interrupt handler; exported for pcmcia
@@ -233,37 +232,37 @@ irqreturn_t snd_vx_irq_handler(int irq, void *dev, struct pt_regs *regs);
233/* 232/*
234 * lowlevel functions 233 * lowlevel functions
235 */ 234 */
236static inline int vx_test_and_ack(vx_core_t *chip) 235static inline int vx_test_and_ack(struct vx_core *chip)
237{ 236{
238 snd_assert(chip->ops->test_and_ack, return -ENXIO); 237 snd_assert(chip->ops->test_and_ack, return -ENXIO);
239 return chip->ops->test_and_ack(chip); 238 return chip->ops->test_and_ack(chip);
240} 239}
241 240
242static inline void vx_validate_irq(vx_core_t *chip, int enable) 241static inline void vx_validate_irq(struct vx_core *chip, int enable)
243{ 242{
244 snd_assert(chip->ops->validate_irq, return); 243 snd_assert(chip->ops->validate_irq, return);
245 chip->ops->validate_irq(chip, enable); 244 chip->ops->validate_irq(chip, enable);
246} 245}
247 246
248static inline unsigned char snd_vx_inb(vx_core_t *chip, int reg) 247static inline unsigned char snd_vx_inb(struct vx_core *chip, int reg)
249{ 248{
250 snd_assert(chip->ops->in8, return 0); 249 snd_assert(chip->ops->in8, return 0);
251 return chip->ops->in8(chip, reg); 250 return chip->ops->in8(chip, reg);
252} 251}
253 252
254static inline unsigned int snd_vx_inl(vx_core_t *chip, int reg) 253static inline unsigned int snd_vx_inl(struct vx_core *chip, int reg)
255{ 254{
256 snd_assert(chip->ops->in32, return 0); 255 snd_assert(chip->ops->in32, return 0);
257 return chip->ops->in32(chip, reg); 256 return chip->ops->in32(chip, reg);
258} 257}
259 258
260static inline void snd_vx_outb(vx_core_t *chip, int reg, unsigned char val) 259static inline void snd_vx_outb(struct vx_core *chip, int reg, unsigned char val)
261{ 260{
262 snd_assert(chip->ops->out8, return); 261 snd_assert(chip->ops->out8, return);
263 chip->ops->out8(chip, reg, val); 262 chip->ops->out8(chip, reg, val);
264} 263}
265 264
266static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val) 265static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val)
267{ 266{
268 snd_assert(chip->ops->out32, return); 267 snd_assert(chip->ops->out32, return);
269 chip->ops->out32(chip, reg, val); 268 chip->ops->out32(chip, reg, val);
@@ -274,27 +273,25 @@ static inline void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val)
274#define vx_inl(chip,reg) snd_vx_inl(chip, VX_##reg) 273#define vx_inl(chip,reg) snd_vx_inl(chip, VX_##reg)
275#define vx_outl(chip,reg,val) snd_vx_outl(chip, VX_##reg,val) 274#define vx_outl(chip,reg,val) snd_vx_outl(chip, VX_##reg,val)
276 275
277void snd_vx_delay(vx_core_t *chip, int msec); 276static inline void vx_reset_dsp(struct vx_core *chip)
278
279static inline void vx_reset_dsp(vx_core_t *chip)
280{ 277{
281 snd_assert(chip->ops->reset_dsp, return); 278 snd_assert(chip->ops->reset_dsp, return);
282 chip->ops->reset_dsp(chip); 279 chip->ops->reset_dsp(chip);
283} 280}
284 281
285int vx_send_msg(vx_core_t *chip, struct vx_rmh *rmh); 282int vx_send_msg(struct vx_core *chip, struct vx_rmh *rmh);
286int vx_send_msg_nolock(vx_core_t *chip, struct vx_rmh *rmh); 283int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh);
287int vx_send_rih(vx_core_t *chip, int cmd); 284int vx_send_rih(struct vx_core *chip, int cmd);
288int vx_send_rih_nolock(vx_core_t *chip, int cmd); 285int vx_send_rih_nolock(struct vx_core *chip, int cmd);
289 286
290void vx_reset_codec(vx_core_t *chip, int cold_reset); 287void vx_reset_codec(struct vx_core *chip, int cold_reset);
291 288
292/* 289/*
293 * check the bit on the specified register 290 * check the bit on the specified register
294 * returns zero if a bit matches, or a negative error code. 291 * returns zero if a bit matches, or a negative error code.
295 * exported for vxpocket driver 292 * exported for vxpocket driver
296 */ 293 */
297int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time); 294int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int time);
298#define vx_check_isr(chip,mask,bit,time) snd_vx_check_reg_bit(chip, VX_ISR, mask, bit, time) 295#define vx_check_isr(chip,mask,bit,time) snd_vx_check_reg_bit(chip, VX_ISR, mask, bit, time)
299#define vx_wait_isr_bit(chip,bit) vx_check_isr(chip, bit, bit, 200) 296#define vx_wait_isr_bit(chip,bit) vx_check_isr(chip, bit, bit, 200)
300#define vx_wait_for_rx_full(chip) vx_wait_isr_bit(chip, ISR_RX_FULL) 297#define vx_wait_for_rx_full(chip) vx_wait_isr_bit(chip, ISR_RX_FULL)
@@ -303,15 +300,15 @@ int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time);
303/* 300/*
304 * pseudo-DMA transfer 301 * pseudo-DMA transfer
305 */ 302 */
306static inline void vx_pseudo_dma_write(vx_core_t *chip, snd_pcm_runtime_t *runtime, 303static inline void vx_pseudo_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
307 vx_pipe_t *pipe, int count) 304 struct vx_pipe *pipe, int count)
308{ 305{
309 snd_assert(chip->ops->dma_write, return); 306 snd_assert(chip->ops->dma_write, return);
310 chip->ops->dma_write(chip, runtime, pipe, count); 307 chip->ops->dma_write(chip, runtime, pipe, count);
311} 308}
312 309
313static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtime, 310static inline void vx_pseudo_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
314 vx_pipe_t *pipe, int count) 311 struct vx_pipe *pipe, int count)
315{ 312{
316 snd_assert(chip->ops->dma_read, return); 313 snd_assert(chip->ops->dma_read, return);
317 chip->ops->dma_read(chip, runtime, pipe, count); 314 chip->ops->dma_read(chip, runtime, pipe, count);
@@ -329,27 +326,33 @@ static inline void vx_pseudo_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtim
329/* 326/*
330 * pcm stuff 327 * pcm stuff
331 */ 328 */
332int snd_vx_pcm_new(vx_core_t *chip); 329int snd_vx_pcm_new(struct vx_core *chip);
333void vx_pcm_update_intr(vx_core_t *chip, unsigned int events); 330void vx_pcm_update_intr(struct vx_core *chip, unsigned int events);
334 331
335/* 332/*
336 * mixer stuff 333 * mixer stuff
337 */ 334 */
338int snd_vx_mixer_new(vx_core_t *chip); 335int snd_vx_mixer_new(struct vx_core *chip);
339void vx_toggle_dac_mute(vx_core_t *chip, int mute); 336void vx_toggle_dac_mute(struct vx_core *chip, int mute);
340int vx_sync_audio_source(vx_core_t *chip); 337int vx_sync_audio_source(struct vx_core *chip);
341int vx_set_monitor_level(vx_core_t *chip, int audio, int level, int active); 338int vx_set_monitor_level(struct vx_core *chip, int audio, int level, int active);
342 339
343/* 340/*
344 * IEC958 & clock stuff 341 * IEC958 & clock stuff
345 */ 342 */
346void vx_set_iec958_status(vx_core_t *chip, unsigned int bits); 343void vx_set_iec958_status(struct vx_core *chip, unsigned int bits);
347int vx_set_clock(vx_core_t *chip, unsigned int freq); 344int vx_set_clock(struct vx_core *chip, unsigned int freq);
348void vx_set_internal_clock(vx_core_t *chip, unsigned int freq); 345void vx_set_internal_clock(struct vx_core *chip, unsigned int freq);
349int vx_change_frequency(vx_core_t *chip); 346int vx_change_frequency(struct vx_core *chip);
350 347
351 348
352/* 349/*
350 * PM
351 */
352int snd_vx_suspend(struct vx_core *card, pm_message_t state);
353int snd_vx_resume(struct vx_core *card);
354
355/*
353 * hardware constants 356 * hardware constants
354 */ 357 */
355 358
diff --git a/include/sound/wavefront.h b/include/sound/wavefront.h
index 9e572aed2435..15d82e594b56 100644
--- a/include/sound/wavefront.h
+++ b/include/sound/wavefront.h
@@ -454,22 +454,22 @@ typedef struct wf_multisample {
454} wavefront_multisample; 454} wavefront_multisample;
455 455
456typedef struct wf_alias { 456typedef struct wf_alias {
457 s16 OriginalSample __attribute__ ((packed)); 457 s16 OriginalSample;
458 458
459 struct wf_sample_offset sampleStartOffset __attribute__ ((packed)); 459 struct wf_sample_offset sampleStartOffset;
460 struct wf_sample_offset loopStartOffset __attribute__ ((packed)); 460 struct wf_sample_offset loopStartOffset;
461 struct wf_sample_offset sampleEndOffset __attribute__ ((packed)); 461 struct wf_sample_offset sampleEndOffset;
462 struct wf_sample_offset loopEndOffset __attribute__ ((packed)); 462 struct wf_sample_offset loopEndOffset;
463 463
464 s16 FrequencyBias __attribute__ ((packed)); 464 s16 FrequencyBias;
465 465
466 u8 SampleResolution:2 __attribute__ ((packed)); 466 u8 SampleResolution:2;
467 u8 Unused1:1 __attribute__ ((packed)); 467 u8 Unused1:1;
468 u8 Loop:1 __attribute__ ((packed)); 468 u8 Loop:1;
469 u8 Bidirectional:1 __attribute__ ((packed)); 469 u8 Bidirectional:1;
470 u8 Unused2:1 __attribute__ ((packed)); 470 u8 Unused2:1;
471 u8 Reverse:1 __attribute__ ((packed)); 471 u8 Reverse:1;
472 u8 Unused3:1 __attribute__ ((packed)); 472 u8 Unused3:1;
473 473
474 /* This structure is meant to be padded only to 16 bits on their 474 /* This structure is meant to be padded only to 16 bits on their
475 original. Of course, whoever wrote their documentation didn't 475 original. Of course, whoever wrote their documentation didn't
@@ -480,8 +480,8 @@ typedef struct wf_alias {
480 standard 16->32 bit issues. 480 standard 16->32 bit issues.
481 */ 481 */
482 482
483 u8 sixteen_bit_padding __attribute__ ((packed)); 483 u8 sixteen_bit_padding;
484} wavefront_alias; 484} __attribute__((packed)) wavefront_alias;
485 485
486typedef struct wf_drum { 486typedef struct wf_drum {
487 u8 PatchNumber; 487 u8 PatchNumber;
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index c3bccbfd8d4c..d567bfdbf513 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -184,7 +184,7 @@
184 * 184 *
185 */ 185 */
186 186
187typedef struct _snd_ymfpci_playback_bank { 187struct snd_ymfpci_playback_bank {
188 u32 format; 188 u32 format;
189 u32 loop_default; 189 u32 loop_default;
190 u32 base; /* 32-bit address */ 190 u32 base; /* 32-bit address */
@@ -215,46 +215,45 @@ typedef struct _snd_ymfpci_playback_bank {
215 u32 eff3_gain; 215 u32 eff3_gain;
216 u32 lpfD1; 216 u32 lpfD1;
217 u32 lpfD2; 217 u32 lpfD2;
218} snd_ymfpci_playback_bank_t; 218 };
219 219
220typedef struct _snd_ymfpci_capture_bank { 220struct snd_ymfpci_capture_bank {
221 u32 base; /* 32-bit address */ 221 u32 base; /* 32-bit address */
222 u32 loop_end; /* 32-bit offset */ 222 u32 loop_end; /* 32-bit offset */
223 u32 start; /* 32-bit offset */ 223 u32 start; /* 32-bit offset */
224 u32 num_of_loops; /* counter */ 224 u32 num_of_loops; /* counter */
225} snd_ymfpci_capture_bank_t; 225};
226 226
227typedef struct _snd_ymfpci_effect_bank { 227struct snd_ymfpci_effect_bank {
228 u32 base; /* 32-bit address */ 228 u32 base; /* 32-bit address */
229 u32 loop_end; /* 32-bit offset */ 229 u32 loop_end; /* 32-bit offset */
230 u32 start; /* 32-bit offset */ 230 u32 start; /* 32-bit offset */
231 u32 temp; 231 u32 temp;
232} snd_ymfpci_effect_bank_t; 232};
233 233
234typedef struct _snd_ymfpci_voice ymfpci_voice_t; 234struct snd_ymfpci_pcm;
235typedef struct _snd_ymfpci_pcm ymfpci_pcm_t; 235struct snd_ymfpci;
236typedef struct _snd_ymfpci ymfpci_t;
237 236
238typedef enum { 237enum snd_ymfpci_voice_type {
239 YMFPCI_PCM, 238 YMFPCI_PCM,
240 YMFPCI_SYNTH, 239 YMFPCI_SYNTH,
241 YMFPCI_MIDI 240 YMFPCI_MIDI
242} ymfpci_voice_type_t; 241};
243 242
244struct _snd_ymfpci_voice { 243struct snd_ymfpci_voice {
245 ymfpci_t *chip; 244 struct snd_ymfpci *chip;
246 int number; 245 int number;
247 unsigned int use: 1, 246 unsigned int use: 1,
248 pcm: 1, 247 pcm: 1,
249 synth: 1, 248 synth: 1,
250 midi: 1; 249 midi: 1;
251 snd_ymfpci_playback_bank_t *bank; 250 struct snd_ymfpci_playback_bank *bank;
252 dma_addr_t bank_addr; 251 dma_addr_t bank_addr;
253 void (*interrupt)(ymfpci_t *chip, ymfpci_voice_t *voice); 252 void (*interrupt)(struct snd_ymfpci *chip, struct snd_ymfpci_voice *voice);
254 ymfpci_pcm_t *ypcm; 253 struct snd_ymfpci_pcm *ypcm;
255}; 254};
256 255
257typedef enum { 256enum snd_ymfpci_pcm_type {
258 PLAYBACK_VOICE, 257 PLAYBACK_VOICE,
259 CAPTURE_REC, 258 CAPTURE_REC,
260 CAPTURE_AC97, 259 CAPTURE_AC97,
@@ -263,13 +262,13 @@ typedef enum {
263 EFFECT_EFF1, 262 EFFECT_EFF1,
264 EFFECT_EFF2, 263 EFFECT_EFF2,
265 EFFECT_EFF3 264 EFFECT_EFF3
266} snd_ymfpci_pcm_type_t; 265};
267 266
268struct _snd_ymfpci_pcm { 267struct snd_ymfpci_pcm {
269 ymfpci_t *chip; 268 struct snd_ymfpci *chip;
270 snd_ymfpci_pcm_type_t type; 269 enum snd_ymfpci_pcm_type type;
271 snd_pcm_substream_t *substream; 270 struct snd_pcm_substream *substream;
272 ymfpci_voice_t *voices[2]; /* playback only */ 271 struct snd_ymfpci_voice *voices[2]; /* playback only */
273 unsigned int running: 1; 272 unsigned int running: 1;
274 unsigned int output_front: 1; 273 unsigned int output_front: 1;
275 unsigned int output_rear: 1; 274 unsigned int output_rear: 1;
@@ -282,7 +281,7 @@ struct _snd_ymfpci_pcm {
282 u32 shift; 281 u32 shift;
283}; 282};
284 283
285struct _snd_ymfpci { 284struct snd_ymfpci {
286 int irq; 285 int irq;
287 286
288 unsigned int device_id; /* PCI device ID */ 287 unsigned int device_id; /* PCI device ID */
@@ -316,47 +315,47 @@ struct _snd_ymfpci {
316 struct snd_dma_buffer ac3_tmp_base; 315 struct snd_dma_buffer ac3_tmp_base;
317 316
318 u32 *ctrl_playback; 317 u32 *ctrl_playback;
319 snd_ymfpci_playback_bank_t *bank_playback[YDSXG_PLAYBACK_VOICES][2]; 318 struct snd_ymfpci_playback_bank *bank_playback[YDSXG_PLAYBACK_VOICES][2];
320 snd_ymfpci_capture_bank_t *bank_capture[YDSXG_CAPTURE_VOICES][2]; 319 struct snd_ymfpci_capture_bank *bank_capture[YDSXG_CAPTURE_VOICES][2];
321 snd_ymfpci_effect_bank_t *bank_effect[YDSXG_EFFECT_VOICES][2]; 320 struct snd_ymfpci_effect_bank *bank_effect[YDSXG_EFFECT_VOICES][2];
322 321
323 int start_count; 322 int start_count;
324 323
325 u32 active_bank; 324 u32 active_bank;
326 ymfpci_voice_t voices[64]; 325 struct snd_ymfpci_voice voices[64];
327 326
328 ac97_bus_t *ac97_bus; 327 struct snd_ac97_bus *ac97_bus;
329 ac97_t *ac97; 328 struct snd_ac97 *ac97;
330 snd_rawmidi_t *rawmidi; 329 struct snd_rawmidi *rawmidi;
331 snd_timer_t *timer; 330 struct snd_timer *timer;
332 331
333 struct pci_dev *pci; 332 struct pci_dev *pci;
334 snd_card_t *card; 333 struct snd_card *card;
335 snd_pcm_t *pcm; 334 struct snd_pcm *pcm;
336 snd_pcm_t *pcm2; 335 struct snd_pcm *pcm2;
337 snd_pcm_t *pcm_spdif; 336 struct snd_pcm *pcm_spdif;
338 snd_pcm_t *pcm_4ch; 337 struct snd_pcm *pcm_4ch;
339 snd_pcm_substream_t *capture_substream[YDSXG_CAPTURE_VOICES]; 338 struct snd_pcm_substream *capture_substream[YDSXG_CAPTURE_VOICES];
340 snd_pcm_substream_t *effect_substream[YDSXG_EFFECT_VOICES]; 339 struct snd_pcm_substream *effect_substream[YDSXG_EFFECT_VOICES];
341 snd_kcontrol_t *ctl_vol_recsrc; 340 struct snd_kcontrol *ctl_vol_recsrc;
342 snd_kcontrol_t *ctl_vol_adcrec; 341 struct snd_kcontrol *ctl_vol_adcrec;
343 snd_kcontrol_t *ctl_vol_spdifrec; 342 struct snd_kcontrol *ctl_vol_spdifrec;
344 unsigned short spdif_bits, spdif_pcm_bits; 343 unsigned short spdif_bits, spdif_pcm_bits;
345 snd_kcontrol_t *spdif_pcm_ctl; 344 struct snd_kcontrol *spdif_pcm_ctl;
346 int mode_dup4ch; 345 int mode_dup4ch;
347 int rear_opened; 346 int rear_opened;
348 int spdif_opened; 347 int spdif_opened;
349 struct { 348 struct {
350 u16 left; 349 u16 left;
351 u16 right; 350 u16 right;
352 snd_kcontrol_t *ctl; 351 struct snd_kcontrol *ctl;
353 } pcm_mixer[32]; 352 } pcm_mixer[32];
354 353
355 spinlock_t reg_lock; 354 spinlock_t reg_lock;
356 spinlock_t voice_lock; 355 spinlock_t voice_lock;
357 wait_queue_head_t interrupt_sleep; 356 wait_queue_head_t interrupt_sleep;
358 atomic_t interrupt_sleep_count; 357 atomic_t interrupt_sleep_count;
359 snd_info_entry_t *proc_entry; 358 struct snd_info_entry *proc_entry;
360 359
361#ifdef CONFIG_PM 360#ifdef CONFIG_PM
362 u32 *saved_regs; 361 u32 *saved_regs;
@@ -364,17 +363,20 @@ struct _snd_ymfpci {
364#endif 363#endif
365}; 364};
366 365
367int snd_ymfpci_create(snd_card_t * card, 366int snd_ymfpci_create(struct snd_card *card,
368 struct pci_dev *pci, 367 struct pci_dev *pci,
369 unsigned short old_legacy_ctrl, 368 unsigned short old_legacy_ctrl,
370 ymfpci_t ** rcodec); 369 struct snd_ymfpci ** rcodec);
371void snd_ymfpci_free_gameport(ymfpci_t *chip); 370void snd_ymfpci_free_gameport(struct snd_ymfpci *chip);
372 371
373int snd_ymfpci_pcm(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 372int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state);
374int snd_ymfpci_pcm2(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 373int snd_ymfpci_resume(struct pci_dev *pci);
375int snd_ymfpci_pcm_spdif(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 374
376int snd_ymfpci_pcm_4ch(ymfpci_t *chip, int device, snd_pcm_t **rpcm); 375int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
377int snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch); 376int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
378int snd_ymfpci_timer(ymfpci_t *chip, int device); 377int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
378int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
379int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch);
380int snd_ymfpci_timer(struct snd_ymfpci *chip, int device);
379 381
380#endif /* __SOUND_YMFPCI_H */ 382#endif /* __SOUND_YMFPCI_H */
diff --git a/include/video/cyblafb.h b/include/video/cyblafb.h
index a9948232b131..717440575380 100644
--- a/include/video/cyblafb.h
+++ b/include/video/cyblafb.h
@@ -153,6 +153,10 @@
153#define GE04 (GEBase+0x04) // source 2, p 111 153#define GE04 (GEBase+0x04) // source 2, p 111
154#define GE08 (GEBase+0x08) // destination 1, p 111 154#define GE08 (GEBase+0x08) // destination 1, p 111
155#define GE0C (GEBase+0x0C) // destination 2, p 112 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
156#define GE20 (GEBase+0x20) // engine status, p 113 160#define GE20 (GEBase+0x20) // engine status, p 113
157#define GE24 (GEBase+0x24) // reset all GE pointers 161#define GE24 (GEBase+0x24) // reset all GE pointers
158#define GE44 (GEBase+0x44) // command register, p 126 162#define GE44 (GEBase+0x44) // command register, p 126
diff --git a/include/video/kyro.h b/include/video/kyro.h
index 1bed37cfa68c..dba7de2ee4a8 100644
--- a/include/video/kyro.h
+++ b/include/video/kyro.h
@@ -15,6 +15,7 @@
15struct kyrofb_info { 15struct kyrofb_info {
16 void __iomem *regbase; 16 void __iomem *regbase;
17 17
18 u32 palette[16];
18 u32 HTot; /* Hor Total Time */ 19 u32 HTot; /* Hor Total Time */
19 u32 HFP; /* Hor Front Porch */ 20 u32 HFP; /* Hor Front Porch */
20 u32 HST; /* Hor Sync Time */ 21 u32 HST; /* Hor Sync Time */
diff --git a/include/video/neomagic.h b/include/video/neomagic.h
index bdaee70868dd..1d69049bd4c1 100644
--- a/include/video/neomagic.h
+++ b/include/video/neomagic.h
@@ -196,6 +196,7 @@ struct neofb_par {
196 int internal_display; 196 int internal_display;
197 int external_display; 197 int external_display;
198 int libretto; 198 int libretto;
199 u32 palette[16];
199}; 200};
200 201
201typedef struct { 202typedef struct {
diff --git a/include/video/newport.h b/include/video/newport.h
index 812dac5b55f4..1f5ebeaa818f 100644
--- a/include/video/newport.h
+++ b/include/video/newport.h
@@ -382,7 +382,8 @@ typedef struct {
382#define VC2_IREG_CONTROL 0x10 382#define VC2_IREG_CONTROL 0x10
383#define VC2_IREG_CONFIG 0x20 383#define VC2_IREG_CONFIG 0x20
384 384
385extern __inline__ void newport_vc2_set(struct newport_regs *regs, unsigned char vc2ireg, 385static inline void newport_vc2_set(struct newport_regs *regs,
386 unsigned char vc2ireg,
386 unsigned short val) 387 unsigned short val)
387{ 388{
388 regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 | 389 regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 |
@@ -390,7 +391,7 @@ extern __inline__ void newport_vc2_set(struct newport_regs *regs, unsigned char
390 regs->set.dcbdata0.byword = (vc2ireg << 24) | (val << 8); 391 regs->set.dcbdata0.byword = (vc2ireg << 24) | (val << 8);
391} 392}
392 393
393extern __inline__ unsigned short newport_vc2_get(struct newport_regs *regs, 394static inline unsigned short newport_vc2_get(struct newport_regs *regs,
394 unsigned char vc2ireg) 395 unsigned char vc2ireg)
395{ 396{
396 regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 | 397 regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 |
diff --git a/include/video/sstfb.h b/include/video/sstfb.h
index 0d77b5205372..3570f9c9b111 100644
--- a/include/video/sstfb.h
+++ b/include/video/sstfb.h
@@ -334,6 +334,7 @@ struct sst_spec {
334}; 334};
335 335
336struct sstfb_par { 336struct sstfb_par {
337 u32 palette[16];
337 unsigned int yDim; 338 unsigned int yDim;
338 unsigned int hSyncOn; /* hsync_len */ 339 unsigned int hSyncOn; /* hsync_len */
339 unsigned int hSyncOff; /* left_margin + xres + right_margin */ 340 unsigned int hSyncOff; /* left_margin + xres + right_margin */
diff --git a/include/video/tdfx.h b/include/video/tdfx.h
index 04237676b17c..c1cc94ba3fdd 100644
--- a/include/video/tdfx.h
+++ b/include/video/tdfx.h
@@ -140,52 +140,52 @@
140#ifdef __KERNEL__ 140#ifdef __KERNEL__
141 141
142struct banshee_reg { 142struct banshee_reg {
143 /* VGA rubbish */ 143 /* VGA rubbish */
144 unsigned char att[21]; 144 unsigned char att[21];
145 unsigned char crt[25]; 145 unsigned char crt[25];
146 unsigned char gra[ 9]; 146 unsigned char gra[ 9];
147 unsigned char misc[1]; 147 unsigned char misc[1];
148 unsigned char seq[ 5]; 148 unsigned char seq[ 5];
149 149
150 /* Banshee extensions */ 150 /* Banshee extensions */
151 unsigned char ext[2]; 151 unsigned char ext[2];
152 unsigned long vidcfg; 152 unsigned long vidcfg;
153 unsigned long vidpll; 153 unsigned long vidpll;
154 unsigned long mempll; 154 unsigned long mempll;
155 unsigned long gfxpll; 155 unsigned long gfxpll;
156 unsigned long dacmode; 156 unsigned long dacmode;
157 unsigned long vgainit0; 157 unsigned long vgainit0;
158 unsigned long vgainit1; 158 unsigned long vgainit1;
159 unsigned long screensize; 159 unsigned long screensize;
160 unsigned long stride; 160 unsigned long stride;
161 unsigned long cursloc; 161 unsigned long cursloc;
162 unsigned long curspataddr; 162 unsigned long curspataddr;
163 unsigned long cursc0; 163 unsigned long cursc0;
164 unsigned long cursc1; 164 unsigned long cursc1;
165 unsigned long startaddr; 165 unsigned long startaddr;
166 unsigned long clip0min; 166 unsigned long clip0min;
167 unsigned long clip0max; 167 unsigned long clip0max;
168 unsigned long clip1min; 168 unsigned long clip1min;
169 unsigned long clip1max; 169 unsigned long clip1max;
170 unsigned long srcbase; 170 unsigned long srcbase;
171 unsigned long dstbase; 171 unsigned long dstbase;
172 unsigned long miscinit0; 172 unsigned long miscinit0;
173}; 173};
174 174
175struct tdfx_par { 175struct tdfx_par {
176 u32 max_pixclock; 176 u32 max_pixclock;
177 177 u32 palette[16];
178 void __iomem *regbase_virt; 178 void __iomem *regbase_virt;
179 unsigned long iobase; 179 unsigned long iobase;
180 u32 baseline; 180 u32 baseline;
181 181
182 struct { 182 struct {
183 int w,u,d; 183 int w,u,d;
184 unsigned long enable,disable; 184 unsigned long enable,disable;
185 struct timer_list timer; 185 struct timer_list timer;
186 } hwcursor; 186 } hwcursor;
187 187
188 spinlock_t DAClock; 188 spinlock_t DAClock;
189}; 189};
190 190
191#endif /* __KERNEL__ */ 191#endif /* __KERNEL__ */