aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/pdc_intel.h4
-rw-r--r--include/acpi/processor.h28
-rw-r--r--include/asm-alpha/atomic.h1
-rw-r--r--include/asm-alpha/cache.h1
-rw-r--r--include/asm-alpha/compiler.h2
-rw-r--r--include/asm-alpha/futex.h49
-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.h18
-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/clock.h2
-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/pxa-regs.h26
-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.S5
-rw-r--r--include/asm-arm/arch-versatile/platform.h23
-rw-r--r--include/asm-arm/atomic.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/hardware/vic.h45
-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/arch.h4
-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/mutex.h128
-rw-r--r--include/asm-arm/page.h7
-rw-r--r--include/asm-arm/processor.h15
-rw-r--r--include/asm-arm/ptrace.h11
-rw-r--r--include/asm-arm/scatterlist.h1
-rw-r--r--include/asm-arm/stat.h11
-rw-r--r--include/asm-arm/statfs.h38
-rw-r--r--include/asm-arm/system.h12
-rw-r--r--include/asm-arm/thread_info.h7
-rw-r--r--include/asm-arm/unistd.h65
-rw-r--r--include/asm-arm26/atomic.h2
-rw-r--r--include/asm-arm26/cache.h3
-rw-r--r--include/asm-arm26/futex.h49
-rw-r--r--include/asm-arm26/ioctl.h75
-rw-r--r--include/asm-arm26/system.h12
-rw-r--r--include/asm-arm26/thread_info.h12
-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.h2
-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/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.h97
-rw-r--r--include/asm-frv/bug.h1
-rw-r--r--include/asm-frv/dma-mapping.h2
-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/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/thread_info.h4
-rw-r--r--include/asm-frv/types.h1
-rw-r--r--include/asm-frv/uaccess.h8
-rw-r--r--include/asm-frv/unistd.h3
-rw-r--r--include/asm-frv/vga.h17
-rw-r--r--include/asm-frv/xor.h1
-rw-r--r--include/asm-generic/atomic.h3
-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-h8300/atomic.h2
-rw-r--r--include/asm-h8300/futex.h49
-rw-r--r--include/asm-h8300/ioctl.h81
-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/acpi.h2
-rw-r--r--include/asm-i386/apic.h5
-rw-r--r--include/asm-i386/atomic.h1
-rw-r--r--include/asm-i386/bitops.h26
-rw-r--r--include/asm-i386/cache.h2
-rw-r--r--include/asm-i386/cpufeature.h1
-rw-r--r--include/asm-i386/current.h2
-rw-r--r--include/asm-i386/dma-mapping.h14
-rw-r--r--include/asm-i386/edac.h18
-rw-r--r--include/asm-i386/futex.h2
-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-default/mach_ipi.h4
-rw-r--r--include/asm-i386/mutex.h136
-rw-r--r--include/asm-i386/processor.h26
-rw-r--r--include/asm-i386/ptrace.h3
-rw-r--r--include/asm-i386/signal.h1
-rw-r--r--include/asm-i386/string.h8
-rw-r--r--include/asm-i386/system.h9
-rw-r--r--include/asm-i386/thread_info.h4
-rw-r--r--include/asm-i386/topology.h1
-rw-r--r--include/asm-i386/uaccess.h8
-rw-r--r--include/asm-i386/unistd.h19
-rw-r--r--include/asm-i386/vm86.h20
-rw-r--r--include/asm-ia64/atomic.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.h20
-rw-r--r--include/asm-ia64/mutex.h9
-rw-r--r--include/asm-ia64/pal.h2
-rw-r--r--include/asm-ia64/processor.h6
-rw-r--r--include/asm-ia64/ptrace.h4
-rw-r--r--include/asm-ia64/semaphore.h8
-rw-r--r--include/asm-ia64/sn/intr.h2
-rw-r--r--include/asm-ia64/sn/ioc3.h241
-rw-r--r--include/asm-ia64/sn/pcibr_provider.h48
-rw-r--r--include/asm-ia64/sn/pcibus_provider_defs.h14
-rw-r--r--include/asm-ia64/sn/pcidev.h4
-rw-r--r--include/asm-ia64/sn/pic.h204
-rw-r--r--include/asm-ia64/sn/shubio.h1620
-rw-r--r--include/asm-ia64/sn/sn_sal.h17
-rw-r--r--include/asm-ia64/sn/tioca.h82
-rw-r--r--include/asm-ia64/sn/tioca_provider.h56
-rw-r--r--include/asm-ia64/sn/tioce.h662
-rw-r--r--include/asm-ia64/sn/tioce_provider.h30
-rw-r--r--include/asm-ia64/sn/tiocp.h254
-rw-r--r--include/asm-ia64/sn/tiocx.h14
-rw-r--r--include/asm-ia64/sn/xp.h7
-rw-r--r--include/asm-ia64/sn/xpc.h1275
-rw-r--r--include/asm-ia64/spinlock.h2
-rw-r--r--include/asm-ia64/system.h9
-rw-r--r--include/asm-ia64/thread_info.h13
-rw-r--r--include/asm-ia64/topology.h6
-rw-r--r--include/asm-ia64/unistd.h3
-rw-r--r--include/asm-m32r/atomic.h1
-rw-r--r--include/asm-m32r/cache.h2
-rw-r--r--include/asm-m32r/futex.h49
-rw-r--r--include/asm-m32r/ioctl.h79
-rw-r--r--include/asm-m32r/mutex.h9
-rw-r--r--include/asm-m32r/ptrace.h3
-rw-r--r--include/asm-m32r/system.h10
-rw-r--r--include/asm-m32r/thread_info.h2
-rw-r--r--include/asm-m68k/amigahw.h12
-rw-r--r--include/asm-m68k/amigaints.h2
-rw-r--r--include/asm-m68k/atomic.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.h9
-rw-r--r--include/asm-m68k/machdep.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.h1
-rw-r--r--include/asm-m68knommu/bitops.h2
-rw-r--r--include/asm-m68knommu/futex.h49
-rw-r--r--include/asm-m68knommu/ioctl.h2
-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/atomic.h44
-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/mutex.h9
-rw-r--r--include/asm-mips/processor.h11
-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.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/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.h47
-rw-r--r--include/asm-powerpc/bitops.h6
-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.h40
-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.h20
-rw-r--r--include/asm-powerpc/firmware.h6
-rw-r--r--include/asm-powerpc/floppy.h2
-rw-r--r--include/asm-powerpc/futex.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.h7
-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.h91
-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.h8
-rw-r--r--include/asm-powerpc/machdep.h12
-rw-r--r--include/asm-powerpc/macio.h2
-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.h36
-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.h79
-rw-r--r--include/asm-powerpc/processor.h5
-rw-r--r--include/asm-powerpc/prom.h79
-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.h23
-rw-r--r--include/asm-powerpc/spu.h600
-rw-r--r--include/asm-powerpc/spu_csa.h255
-rw-r--r--include/asm-powerpc/synch.h25
-rw-r--r--include/asm-powerpc/system.h29
-rw-r--r--include/asm-powerpc/tce.h2
-rw-r--r--include/asm-powerpc/thread_info.h18
-rw-r--r--include/asm-powerpc/time.h5
-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.h8
-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/machdep.h4
-rw-r--r--include/asm-ppc/mpc85xx.h4
-rw-r--r--include/asm-ppc/pci-bridge.h9
-rw-r--r--include/asm-ppc/prom.h40
-rw-r--r--include/asm-ppc/system.h22
-rw-r--r--include/asm-s390/atomic.h2
-rw-r--r--include/asm-s390/cache.h1
-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/mutex.h9
-rw-r--r--include/asm-s390/processor.h8
-rw-r--r--include/asm-s390/s390_rdev.h2
-rw-r--r--include/asm-s390/sigcontext.h2
-rw-r--r--include/asm-s390/system.h15
-rw-r--r--include/asm-s390/thread_info.h2
-rw-r--r--include/asm-sh/atomic.h2
-rw-r--r--include/asm-sh/bus-sh.h1
-rw-r--r--include/asm-sh/cache.h2
-rw-r--r--include/asm-sh/clock.h61
-rw-r--r--include/asm-sh/cpu-sh3/dma.h31
-rw-r--r--include/asm-sh/cpu-sh4/dma.h52
-rw-r--r--include/asm-sh/cpu-sh4/freq.h2
-rw-r--r--include/asm-sh/dma-mapping.h25
-rw-r--r--include/asm-sh/dma.h14
-rw-r--r--include/asm-sh/freq.h11
-rw-r--r--include/asm-sh/futex.h49
-rw-r--r--include/asm-sh/io.h283
-rw-r--r--include/asm-sh/io_generic.h96
-rw-r--r--include/asm-sh/ioctl.h76
-rw-r--r--include/asm-sh/irq-sh7780.h349
-rw-r--r--include/asm-sh/irq.h143
-rw-r--r--include/asm-sh/kexec.h33
-rw-r--r--include/asm-sh/machvec.h66
-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-sh/timer.h42
-rw-r--r--include/asm-sh64/atomic.h2
-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.h1
-rw-r--r--include/asm-sparc/cache.h1
-rw-r--r--include/asm-sparc/futex.h49
-rw-r--r--include/asm-sparc/mutex.h9
-rw-r--r--include/asm-sparc/oplib.h2
-rw-r--r--include/asm-sparc/system.h12
-rw-r--r--include/asm-sparc/thread_info.h8
-rw-r--r--include/asm-sparc/unistd.h22
-rw-r--r--include/asm-sparc64/atomic.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/mmu_context.h2
-rw-r--r--include/asm-sparc64/mutex.h9
-rw-r--r--include/asm-sparc64/oplib.h2
-rw-r--r--include/asm-sparc64/processor.h5
-rw-r--r--include/asm-sparc64/system.h18
-rw-r--r--include/asm-sparc64/thread_info.h6
-rw-r--r--include/asm-sparc64/unistd.h23
-rw-r--r--include/asm-um/cache.h3
-rw-r--r--include/asm-um/futex.h12
-rw-r--r--include/asm-um/io.h16
-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.h16
-rw-r--r--include/asm-um/unistd.h1
-rw-r--r--include/asm-v850/atomic.h2
-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/mutex.h9
-rw-r--r--include/asm-v850/processor.h8
-rw-r--r--include/asm-v850/ptrace.h2
-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.h2
-rw-r--r--include/asm-x86_64/bitops.h43
-rw-r--r--include/asm-x86_64/cache.h13
-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/edac.h18
-rw-r--r--include/asm-x86_64/fixmap.h2
-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.h2
-rw-r--r--include/asm-x86_64/ia32_unistd.h16
-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/irq.h2
-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/mmu_context.h9
-rw-r--r--include/asm-x86_64/mmzone.h16
-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.h22
-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.h32
-rw-r--r--include/asm-x86_64/processor.h21
-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.h61
-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.h7
-rw-r--r--include/asm-x86_64/unistd.h31
-rw-r--r--include/asm-x86_64/vsyscall.h4
-rw-r--r--include/asm-xtensa/atomic.h1
-rw-r--r--include/asm-xtensa/ioctl.h84
-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/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/atalk.h18
-rw-r--r--include/linux/auxvec.h2
-rw-r--r--include/linux/blkdev.h22
-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.h18
-rw-r--r--include/linux/compiler-gcc4.h18
-rw-r--r--include/linux/compiler.h2
-rw-r--r--include/linux/cpuset.h46
-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/device.h3
-rw-r--r--include/linux/dmi.h5
-rw-r--r--include/linux/dvb/frontend.h10
-rw-r--r--include/linux/elevator.h4
-rw-r--r--include/linux/elf.h2
-rw-r--r--include/linux/ext3_fs_i.h2
-rw-r--r--include/linux/fb.h10
-rw-r--r--include/linux/fcntl.h7
-rw-r--r--include/linux/fs.h62
-rw-r--r--include/linux/fsl_devices.h6
-rw-r--r--include/linux/gfp.h5
-rw-r--r--include/linux/hardirq.h4
-rw-r--r--include/linux/hrtimer.h139
-rw-r--r--include/linux/i2c-id.h5
-rw-r--r--include/linux/ide.h12
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/if_frad.h12
-rw-r--r--include/linux/init.h12
-rw-r--r--include/linux/interrupt.h4
-rw-r--r--include/linux/ioc3.h93
-rw-r--r--include/linux/ipv6.h4
-rw-r--r--include/linux/isdnif.h70
-rw-r--r--include/linux/isicom.h59
-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.h19
-rw-r--r--include/linux/kexec.h5
-rw-r--r--include/linux/key.h12
-rw-r--r--include/linux/keyctl.h3
-rw-r--r--include/linux/kprobes.h6
-rw-r--r--include/linux/ktime.h284
-rw-r--r--include/linux/libata.h11
-rw-r--r--include/linux/list.h14
-rw-r--r--include/linux/loop.h4
-rw-r--r--include/linux/memory.h8
-rw-r--r--include/linux/mempolicy.h58
-rw-r--r--include/linux/mm.h57
-rw-r--r--include/linux/mm_inline.h1
-rw-r--r--include/linux/mmc/card.h5
-rw-r--r--include/linux/mmc/mmc.h6
-rw-r--r--include/linux/mmzone.h20
-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.h9
-rw-r--r--include/linux/ncp.h126
-rw-r--r--include/linux/ncp_fs.h28
-rw-r--r--include/linux/netfilter.h92
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h3
-rw-r--r--include/linux/netfilter/x_tables.h224
-rw-r--r--include/linux/netfilter/xt_CLASSIFY.h8
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h25
-rw-r--r--include/linux/netfilter/xt_MARK.h21
-rw-r--r--include/linux/netfilter/xt_NFQUEUE.h16
-rw-r--r--include/linux/netfilter/xt_comment.h10
-rw-r--r--include/linux/netfilter/xt_connbytes.h25
-rw-r--r--include/linux/netfilter/xt_connmark.h18
-rw-r--r--include/linux/netfilter/xt_conntrack.h63
-rw-r--r--include/linux/netfilter/xt_dccp.h23
-rw-r--r--include/linux/netfilter/xt_helper.h8
-rw-r--r--include/linux/netfilter/xt_length.h9
-rw-r--r--include/linux/netfilter/xt_limit.h21
-rw-r--r--include/linux/netfilter/xt_mac.h8
-rw-r--r--include/linux/netfilter/xt_mark.h9
-rw-r--r--include/linux/netfilter/xt_physdev.h24
-rw-r--r--include/linux/netfilter/xt_pkttype.h8
-rw-r--r--include/linux/netfilter/xt_realm.h10
-rw-r--r--include/linux/netfilter/xt_sctp.h107
-rw-r--r--include/linux/netfilter/xt_state.h13
-rw-r--r--include/linux/netfilter/xt_string.h18
-rw-r--r--include/linux/netfilter/xt_tcpmss.h9
-rw-r--r--include/linux/netfilter/xt_tcpudp.h36
-rw-r--r--include/linux/netfilter_arp/arp_tables.h123
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_protocol.h7
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h217
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLASSIFY.h5
-rw-r--r--include/linux/netfilter_ipv4/ipt_CONNMARK.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_MARK.h22
-rw-r--r--include/linux/netfilter_ipv4/ipt_NFQUEUE.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_comment.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_connbytes.h31
-rw-r--r--include/linux/netfilter_ipv4/ipt_connmark.h15
-rw-r--r--include/linux/netfilter_ipv4/ipt_conntrack.h66
-rw-r--r--include/linux/netfilter_ipv4/ipt_dccp.h22
-rw-r--r--include/linux/netfilter_ipv4/ipt_helper.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_length.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_limit.h19
-rw-r--r--include/linux/netfilter_ipv4/ipt_mac.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_mark.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_physdev.h27
-rw-r--r--include/linux/netfilter_ipv4/ipt_pkttype.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h52
-rw-r--r--include/linux/netfilter_ipv4/ipt_realm.h7
-rw-r--r--include/linux/netfilter_ipv4/ipt_state.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_string.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_tcpmss.h6
-rw-r--r--include/linux/netfilter_ipv6.h5
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h208
-rw-r--r--include/linux/netfilter_ipv6/ip6t_MARK.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_ah.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_esp.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_frag.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_length.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_limit.h21
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mac.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mark.h8
-rw-r--r--include/linux/netfilter_ipv6/ip6t_opts.h9
-rw-r--r--include/linux/netfilter_ipv6/ip6t_physdev.h27
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h52
-rw-r--r--include/linux/netfilter_ipv6/ip6t_rt.h9
-rw-r--r--include/linux/nfsd/nfsd.h2
-rw-r--r--include/linux/nfsd/nfsfh.h6
-rw-r--r--include/linux/nfsd/xdr4.h5
-rw-r--r--include/linux/pagevec.h5
-rw-r--r--include/linux/parport.h4
-rw-r--r--include/linux/pci.h69
-rw-r--r--include/linux/pci_ids.h36
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/percpu.h8
-rw-r--r--include/linux/pfkeyv2.h2
-rw-r--r--include/linux/phy.h3
-rw-r--r--include/linux/pipe_fs_i.h2
-rw-r--r--include/linux/pmu.h8
-rw-r--r--include/linux/poll.h6
-rw-r--r--include/linux/posix-timers.h90
-rw-r--r--include/linux/proc_fs.h5
-rw-r--r--include/linux/ptrace.h4
-rw-r--r--include/linux/radix-tree.h1
-rw-r--r--include/linux/raid_class.h2
-rw-r--r--include/linux/rcupdate.h37
-rw-r--r--include/linux/rcuref.h220
-rw-r--r--include/linux/reboot.h3
-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/rtc.h3
-rw-r--r--include/linux/sched.h74
-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/serial_core.h6
-rw-r--r--include/linux/shmem_fs.h2
-rw-r--r--include/linux/signal.h30
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/linux/slab.h35
-rw-r--r--include/linux/smb_fs.h47
-rw-r--r--include/linux/socket.h3
-rw-r--r--include/linux/spi/ads7846.h18
-rw-r--r--include/linux/spi/flash.h31
-rw-r--r--include/linux/spi/spi.h668
-rw-r--r--include/linux/spi/spi_bitbang.h135
-rw-r--r--include/linux/spinlock_types_up.h14
-rw-r--r--include/linux/sunrpc/svc.h1
-rw-r--r--include/linux/swap.h26
-rw-r--r--include/linux/synclink.h9
-rw-r--r--include/linux/syscalls.h24
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/time.h186
-rw-r--r--include/linux/timer.h2
-rw-r--r--include/linux/tipc.h212
-rw-r--r--include/linux/tipc_config.h410
-rw-r--r--include/linux/topology.h10
-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/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.h4
-rw-r--r--include/linux/xattr.h19
-rw-r--r--include/linux/zlib.h11
-rw-r--r--include/media/audiochip.h16
-rw-r--r--include/media/saa7146_vv.h2
-rw-r--r--include/media/tuner-types.h55
-rw-r--r--include/media/tuner.h106
-rw-r--r--include/media/v4l2-common.h91
-rw-r--r--include/net/act_api.h2
-rw-r--r--include/net/dn_dev.h84
-rw-r--r--include/net/dn_nsp.h74
-rw-r--r--include/net/dst.h11
-rw-r--r--include/net/genetlink.h1
-rw-r--r--include/net/ieee80211.h6
-rw-r--r--include/net/ieee80211_crypt.h1
-rw-r--r--include/net/inet_connection_sock.h4
-rw-r--r--include/net/ip.h10
-rw-r--r--include/net/ipv6.h2
-rw-r--r--include/net/iw_handler.h2
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_ipv4.h3
-rw-r--r--include/net/netfilter/nf_conntrack.h3
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h2
-rw-r--r--include/net/pkt_sched.h23
-rw-r--r--include/net/protocol.h2
-rw-r--r--include/net/sctp/sctp.h6
-rw-r--r--include/net/sctp/structs.h89
-rw-r--r--include/net/tipc/tipc.h257
-rw-r--r--include/net/tipc/tipc_bearer.h121
-rw-r--r--include/net/tipc/tipc_msg.h223
-rw-r--r--include/net/tipc/tipc_port.h108
-rw-r--r--include/net/xfrm.h9
-rw-r--r--include/rdma/ib_verbs.h2
-rw-r--r--include/scsi/iscsi_if.h6
-rw-r--r--include/scsi/scsi.h6
-rw-r--r--include/scsi/scsi_cmnd.h1
-rw-r--r--include/scsi/scsi_host.h3
-rw-r--r--include/scsi/scsi_transport.h7
-rw-r--r--include/scsi/scsi_transport_fc.h4
-rw-r--r--include/scsi/scsi_transport_iscsi.h75
-rw-r--r--include/scsi/scsi_transport_spi.h3
-rw-r--r--include/sound/core.h3
-rw-r--r--include/sound/wavefront.h36
-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
821 files changed, 16834 insertions, 9677 deletions
diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h
index 91f4a12a99a1..3fa81d55cd0c 100644
--- a/include/acpi/pdc_intel.h
+++ b/include/acpi/pdc_intel.h
@@ -15,9 +15,7 @@
15#define ACPI_PDC_C_C1_FFH (0x0100) 15#define ACPI_PDC_C_C1_FFH (0x0100)
16 16
17#define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ 17#define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \
18 ACPI_PDC_C_C1_HALT) 18 ACPI_PDC_C_C1_HALT | \
19
20#define ACPI_PDC_EST_CAPABILITY_SMP_MSR (ACPI_PDC_EST_CAPABILITY_SMP | \
21 ACPI_PDC_P_FFH) 19 ACPI_PDC_P_FFH)
22 20
23#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ 21#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 7a00d5089de9..badf0277b1be 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -62,9 +62,6 @@ struct acpi_processor_power {
62 u32 bm_activity; 62 u32 bm_activity;
63 int count; 63 int count;
64 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; 64 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
65
66 /* the _PDC objects passed by the driver, if any */
67 struct acpi_object_list *pdc;
68}; 65};
69 66
70/* Performance Management */ 67/* Performance Management */
@@ -96,8 +93,6 @@ struct acpi_processor_performance {
96 unsigned int state_count; 93 unsigned int state_count;
97 struct acpi_processor_px *states; 94 struct acpi_processor_px *states;
98 95
99 /* the _PDC objects passed by the driver, if any */
100 struct acpi_object_list *pdc;
101}; 96};
102 97
103/* Throttling Control */ 98/* Throttling Control */
@@ -151,6 +146,9 @@ struct acpi_processor {
151 struct acpi_processor_performance *performance; 146 struct acpi_processor_performance *performance;
152 struct acpi_processor_throttling throttling; 147 struct acpi_processor_throttling throttling;
153 struct acpi_processor_limit limit; 148 struct acpi_processor_limit limit;
149
150 /* the _PDC objects for this processor, if any */
151 struct acpi_object_list *pdc;
154}; 152};
155 153
156struct acpi_processor_errata { 154struct acpi_processor_errata {
@@ -178,22 +176,12 @@ int acpi_processor_notify_smm(struct module *calling_module);
178extern struct acpi_processor *processors[NR_CPUS]; 176extern struct acpi_processor *processors[NR_CPUS];
179extern struct acpi_processor_errata errata; 177extern struct acpi_processor_errata errata;
180 178
181int acpi_processor_set_pdc(struct acpi_processor *pr, 179void arch_acpi_processor_init_pdc(struct acpi_processor *pr);
182 struct acpi_object_list *pdc_in);
183 180
184#ifdef ARCH_HAS_POWER_PDC_INIT 181#ifdef ARCH_HAS_POWER_INIT
185void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
186 unsigned int cpu);
187void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, 182void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
188 unsigned int cpu); 183 unsigned int cpu);
189#else 184#else
190static inline void acpi_processor_power_init_pdc(struct acpi_processor_power
191 *pow, unsigned int cpu)
192{
193 pow->pdc = NULL;
194 return;
195}
196
197static inline void acpi_processor_power_init_bm_check(struct 185static inline void acpi_processor_power_init_bm_check(struct
198 acpi_processor_flags 186 acpi_processor_flags
199 *flags, unsigned int cpu) 187 *flags, unsigned int cpu)
@@ -235,9 +223,6 @@ static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
235/* in processor_throttling.c */ 223/* in processor_throttling.c */
236int acpi_processor_get_throttling_info(struct acpi_processor *pr); 224int acpi_processor_get_throttling_info(struct acpi_processor *pr);
237int acpi_processor_set_throttling(struct acpi_processor *pr, int state); 225int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
238ssize_t acpi_processor_write_throttling(struct file *file,
239 const char __user * buffer,
240 size_t count, loff_t * data);
241extern struct file_operations acpi_processor_throttling_fops; 226extern struct file_operations acpi_processor_throttling_fops;
242 227
243/* in processor_idle.c */ 228/* in processor_idle.c */
@@ -249,9 +234,6 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
249 234
250/* in processor_thermal.c */ 235/* in processor_thermal.c */
251int acpi_processor_get_limit_info(struct acpi_processor *pr); 236int acpi_processor_get_limit_info(struct acpi_processor *pr);
252ssize_t acpi_processor_write_limit(struct file *file,
253 const char __user * buffer,
254 size_t count, loff_t * data);
255extern struct file_operations acpi_processor_limit_fops; 237extern struct file_operations acpi_processor_limit_fops;
256 238
257#ifdef CONFIG_CPU_FREQ 239#ifdef CONFIG_CPU_FREQ
diff --git a/include/asm-alpha/atomic.h b/include/asm-alpha/atomic.h
index cb03bbe92cdf..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({ \
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/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/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..2b57f91b4ebd 100644
--- a/include/asm-arm/arch-ixp2000/ixp2000-regs.h
+++ b/include/asm-arm/arch-ixp2000/ixp2000-regs.h
@@ -26,6 +26,8 @@
26 * fc000000 da000000 16M PCI CFG0 26 * fc000000 da000000 16M PCI CFG0
27 * fd000000 d8000000 16M PCI I/O 27 * fd000000 d8000000 16M PCI I/O
28 * fe[0-7]00000 8M per-platform mappings 28 * fe[0-7]00000 8M per-platform mappings
29 * fe900000 80000000 1M SRAM #0 (first MB)
30 * fea00000 cb400000 1M SCRATCH ring get/put
29 * feb00000 c8000000 1M MSF 31 * feb00000 c8000000 1M MSF
30 * fec00000 df000000 1M PCI CSRs 32 * fec00000 df000000 1M PCI CSRs
31 * fed00000 de000000 1M PCI CREG 33 * fed00000 de000000 1M PCI CREG
@@ -91,6 +93,14 @@
91#define IXP2000_MSF_VIRT_BASE 0xfeb00000 93#define IXP2000_MSF_VIRT_BASE 0xfeb00000
92#define IXP2000_MSF_SIZE 0x00100000 94#define IXP2000_MSF_SIZE 0x00100000
93 95
96#define IXP2000_SCRATCH_RING_PHYS_BASE 0xcb400000
97#define IXP2000_SCRATCH_RING_VIRT_BASE 0xfea00000
98#define IXP2000_SCRATCH_RING_SIZE 0x00100000
99
100#define IXP2000_SRAM0_PHYS_BASE 0x80000000
101#define IXP2000_SRAM0_VIRT_BASE 0xfe900000
102#define IXP2000_SRAM0_SIZE 0x00100000
103
94#define IXP2000_PCI_IO_PHYS_BASE 0xd8000000 104#define IXP2000_PCI_IO_PHYS_BASE 0xd8000000
95#define IXP2000_PCI_IO_VIRT_BASE 0xfd000000 105#define IXP2000_PCI_IO_VIRT_BASE 0xfd000000
96#define IXP2000_PCI_IO_SIZE 0x01000000 106#define IXP2000_PCI_IO_SIZE 0x01000000
@@ -156,6 +166,14 @@
156#define IXP2000_IRQ_THD_RAW_STATUS_B_1 IXP2000_INTCTL_REG(0x84) 166#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) 167#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) 168#define IXP2000_IRQ_THD_RAW_STATUS_B_3 IXP2000_INTCTL_REG(0x8c)
169#define IXP2000_IRQ_THD_STATUS_A_0 IXP2000_INTCTL_REG(0xe0)
170#define IXP2000_IRQ_THD_STATUS_A_1 IXP2000_INTCTL_REG(0xe4)
171#define IXP2000_IRQ_THD_STATUS_A_2 IXP2000_INTCTL_REG(0xe8)
172#define IXP2000_IRQ_THD_STATUS_A_3 IXP2000_INTCTL_REG(0xec)
173#define IXP2000_IRQ_THD_STATUS_B_0 IXP2000_INTCTL_REG(0x100)
174#define IXP2000_IRQ_THD_STATUS_B_1 IXP2000_INTCTL_REG(0x104)
175#define IXP2000_IRQ_THD_STATUS_B_2 IXP2000_INTCTL_REG(0x108)
176#define IXP2000_IRQ_THD_STATUS_B_3 IXP2000_INTCTL_REG(0x10c)
159#define IXP2000_IRQ_THD_ENABLE_SET_A_0 IXP2000_INTCTL_REG(0x160) 177#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) 178#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) 179#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/clock.h b/include/asm-arm/arch-omap/clock.h
index 740c297eb11c..46a0402696de 100644
--- a/include/asm-arm/arch-omap/clock.h
+++ b/include/asm-arm/arch-omap/clock.h
@@ -38,8 +38,6 @@ struct clk {
38struct clk_functions { 38struct clk_functions {
39 int (*clk_enable)(struct clk *clk); 39 int (*clk_enable)(struct clk *clk);
40 void (*clk_disable)(struct clk *clk); 40 void (*clk_disable)(struct clk *clk);
41 int (*clk_use)(struct clk *clk);
42 void (*clk_unuse)(struct clk *clk);
43 long (*clk_round_rate)(struct clk *clk, unsigned long rate); 41 long (*clk_round_rate)(struct clk *clk, unsigned long rate);
44 int (*clk_set_rate)(struct clk *clk, unsigned long rate); 42 int (*clk_set_rate)(struct clk *clk, unsigned long rate);
45 int (*clk_set_parent)(struct clk *clk, struct clk *parent); 43 int (*clk_set_parent)(struct clk *clk, struct clk *parent);
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/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index a75a2470f4f5..1409c5bd703f 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -108,6 +108,7 @@
108#define DCSR_STARTINTR (1 << 1) /* Start Interrupt (read / write) */ 108#define DCSR_STARTINTR (1 << 1) /* Start Interrupt (read / write) */
109#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt (read / write) */ 109#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt (read / write) */
110 110
111#define DALGN __REG(0x400000a0) /* DMA Alignment Register */
111#define DINT __REG(0x400000f0) /* DMA Interrupt Register */ 112#define DINT __REG(0x400000f0) /* DMA Interrupt Register */
112 113
113#define DRCMR(n) __REG2(0x40000100, (n)<<2) 114#define DRCMR(n) __REG2(0x40000100, (n)<<2)
@@ -1614,8 +1615,21 @@
1614#define SSCR0_National (0x2 << 4) /* National Microwire */ 1615#define SSCR0_National (0x2 << 4) /* National Microwire */
1615#define SSCR0_ECS (1 << 6) /* External clock select */ 1616#define SSCR0_ECS (1 << 6) /* External clock select */
1616#define SSCR0_SSE (1 << 7) /* Synchronous Serial Port Enable */ 1617#define SSCR0_SSE (1 << 7) /* Synchronous Serial Port Enable */
1618#if defined(CONFIG_PXA25x)
1617#define SSCR0_SCR (0x0000ff00) /* Serial Clock Rate (mask) */ 1619#define SSCR0_SCR (0x0000ff00) /* Serial Clock Rate (mask) */
1618#define SSCR0_SerClkDiv(x) ((((x) - 2)/2) << 8) /* Divisor [2..512] */ 1620#define SSCR0_SerClkDiv(x) ((((x) - 2)/2) << 8) /* Divisor [2..512] */
1621#elif defined(CONFIG_PXA27x)
1622#define SSCR0_SCR (0x000fff00) /* Serial Clock Rate (mask) */
1623#define SSCR0_SerClkDiv(x) (((x) - 1) << 8) /* Divisor [1..4096] */
1624#define SSCR0_EDSS (1 << 20) /* Extended data size select */
1625#define SSCR0_NCS (1 << 21) /* Network clock select */
1626#define SSCR0_RIM (1 << 22) /* Receive FIFO overrrun interrupt mask */
1627#define SSCR0_TUM (1 << 23) /* Transmit FIFO underrun interrupt mask */
1628#define SSCR0_FRDC (0x07000000) /* Frame rate divider control (mask) */
1629#define SSCR0_SlotsPerFrm(c) ((x) - 1) /* Time slots per frame [1..8] */
1630#define SSCR0_ADC (1 << 30) /* Audio clock select */
1631#define SSCR0_MOD (1 << 31) /* Mode (normal or network) */
1632#endif
1619 1633
1620#define SSCR1_RIE (1 << 0) /* Receive FIFO Interrupt Enable */ 1634#define SSCR1_RIE (1 << 0) /* Receive FIFO Interrupt Enable */
1621#define SSCR1_TIE (1 << 1) /* Transmit FIFO Interrupt Enable */ 1635#define SSCR1_TIE (1 << 1) /* Transmit FIFO Interrupt Enable */
@@ -2042,6 +2056,18 @@
2042 2056
2043#ifdef CONFIG_PXA27x 2057#ifdef CONFIG_PXA27x
2044 2058
2059#define ARB_CNTRL __REG(0x48000048) /* Arbiter Control Register */
2060
2061#define ARB_DMA_SLV_PARK (1<<31) /* Be parked with DMA slave when idle */
2062#define ARB_CI_PARK (1<<30) /* Be parked with Camera Interface when idle */
2063#define ARB_EX_MEM_PARK (1<<29) /* Be parked with external MEMC when idle */
2064#define ARB_INT_MEM_PARK (1<<28) /* Be parked with internal MEMC when idle */
2065#define ARB_USB_PARK (1<<27) /* Be parked with USB when idle */
2066#define ARB_LCD_PARK (1<<26) /* Be parked with LCD when idle */
2067#define ARB_DMA_PARK (1<<25) /* Be parked with DMA when idle */
2068#define ARB_CORE_PARK (1<<24) /* Be parked with core when idle */
2069#define ARB_LOCK_FLAG (1<<23) /* Only Locking masters gain access to the bus */
2070
2045/* 2071/*
2046 * Keypad 2072 * Keypad
2047 */ 2073 */
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..feff771c0a0a 100644
--- a/include/asm-arm/arch-versatile/entry-macro.S
+++ b/include/asm-arm/arch-versatile/entry-macro.S
@@ -7,7 +7,10 @@
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#include <asm/hardware/vic.h>
12
13 .macro disable_fiq
11 .endm 14 .endm
12 15
13 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 16 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
diff --git a/include/asm-arm/arch-versatile/platform.h b/include/asm-arm/arch-versatile/platform.h
index cbdd9fb96332..72ef874567d5 100644
--- a/include/asm-arm/arch-versatile/platform.h
+++ b/include/asm-arm/arch-versatile/platform.h
@@ -293,26 +293,7 @@
293 * VERSATILE_SYS_IC 293 * VERSATILE_SYS_IC
294 * 294 *
295 */ 295 */
296#define VIC_IRQ_STATUS 0 296/* VIC definitions in include/asm-arm/hardware/vic.h */
297#define VIC_FIQ_STATUS 0x04
298#define VIC_IRQ_RAW_STATUS 0x08
299#define VIC_INT_SELECT 0x0C /* 1 = FIQ, 0 = IRQ */
300#define VIC_IRQ_ENABLE 0x10 /* 1 = enable, 0 = disable */
301#define VIC_IRQ_ENABLE_CLEAR 0x14
302#define VIC_IRQ_SOFT 0x18
303#define VIC_IRQ_SOFT_CLEAR 0x1C
304#define VIC_PROTECT 0x20
305#define VIC_VECT_ADDR 0x30
306#define VIC_DEF_VECT_ADDR 0x34
307#define VIC_VECT_ADDR0 0x100 /* 0 to 15 */
308#define VIC_VECT_CNTL0 0x200 /* 0 to 15 */
309#define VIC_ITCR 0x300 /* VIC test control register */
310
311#define VIC_FIQ_RAW_STATUS 0x08
312#define VIC_FIQ_ENABLE 0x10 /* 1 = enable, 0 = disable */
313#define VIC_FIQ_ENABLE_CLEAR 0x14
314#define VIC_FIQ_SOFT 0x18
315#define VIC_FIQ_SOFT_CLEAR 0x1C
316 297
317#define SIC_IRQ_STATUS 0 298#define SIC_IRQ_STATUS 0
318#define SIC_IRQ_RAW_STATUS 0x04 299#define SIC_IRQ_RAW_STATUS 0x04
@@ -325,8 +306,6 @@
325#define SIC_INT_PIC_ENABLES 0x20 /* set interrupt pass through bits */ 306#define SIC_INT_PIC_ENABLES 0x20 /* set interrupt pass through bits */
326#define SIC_INT_PIC_ENABLEC 0x24 /* Clear interrupt pass through bits */ 307#define SIC_INT_PIC_ENABLEC 0x24 /* Clear interrupt pass through bits */
327 308
328#define VICVectCntl_Enable (1 << 5)
329
330/* ------------------------------------------------------------------------ 309/* ------------------------------------------------------------------------
331 * Interrupts - bit assignment (primary) 310 * Interrupts - bit assignment (primary)
332 * ------------------------------------------------------------------------ 311 * ------------------------------------------------------------------------
diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h
index f72b63309bc5..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;
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/hardware/vic.h b/include/asm-arm/hardware/vic.h
new file mode 100644
index 000000000000..81825eb54c9e
--- /dev/null
+++ b/include/asm-arm/hardware/vic.h
@@ -0,0 +1,45 @@
1/*
2 * linux/include/asm-arm/hardware/vic.h
3 *
4 * Copyright (c) ARM Limited 2003. All rights reserved.
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_HARDWARE_VIC_H
21#define __ASM_ARM_HARDWARE_VIC_H
22
23#define VIC_IRQ_STATUS 0x00
24#define VIC_FIQ_STATUS 0x04
25#define VIC_RAW_STATUS 0x08
26#define VIC_INT_SELECT 0x0c /* 1 = FIQ, 0 = IRQ */
27#define VIC_INT_ENABLE 0x10 /* 1 = enable, 0 = disable */
28#define VIC_INT_ENABLE_CLEAR 0x14
29#define VIC_INT_SOFT 0x18
30#define VIC_INT_SOFT_CLEAR 0x1c
31#define VIC_PROTECT 0x20
32#define VIC_VECT_ADDR 0x30
33#define VIC_DEF_VECT_ADDR 0x34
34
35#define VIC_VECT_ADDR0 0x100 /* 0 to 15 */
36#define VIC_VECT_CNTL0 0x200 /* 0 to 15 */
37#define VIC_ITCR 0x300 /* VIC test control register */
38
39#define VIC_VECT_CNTL_ENABLE (1 << 5)
40
41#ifndef __ASSEMBLY__
42void vic_init(void __iomem *base, u32 vic_sources);
43#endif
44
45#endif
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/arch.h b/include/asm-arm/mach/arch.h
index eb262e078c46..2cd57b4d64d9 100644
--- a/include/asm-arm/mach/arch.h
+++ b/include/asm-arm/mach/arch.h
@@ -10,6 +10,8 @@
10 10
11#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
12 12
13#include <linux/compiler.h>
14
13struct tag; 15struct tag;
14struct meminfo; 16struct meminfo;
15struct sys_timer; 17struct sys_timer;
@@ -20,7 +22,7 @@ struct machine_desc {
20 * by assembler code in head-armv.S 22 * by assembler code in head-armv.S
21 */ 23 */
22 unsigned int nr; /* architecture number */ 24 unsigned int nr; /* architecture number */
23 unsigned int phys_ram; /* start of physical ram */ 25 unsigned int __deprecated phys_ram; /* start of physical ram */
24 unsigned int phys_io; /* start of physical io */ 26 unsigned int phys_io; /* start of physical io */
25 unsigned int io_pg_offst; /* byte offset for io 27 unsigned int io_pg_offst; /* byte offset for io
26 * page tabe entry */ 28 * page tabe entry */
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/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/page.h b/include/asm-arm/page.h
index 4da1d532cbeb..416320d95419 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -170,6 +170,13 @@ extern pmd_t *top_pmd;
170#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 170#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
171 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 171 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
172 172
173/*
174 * With EABI on ARMv5 and above we must have 64-bit aligned slab pointers.
175 */
176#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)
177#define ARCH_SLAB_MINALIGN 8
178#endif
179
173#endif /* __KERNEL__ */ 180#endif /* __KERNEL__ */
174 181
175#include <asm-generic/page.h> 182#include <asm-generic/page.h>
diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h
index 7d4118e09054..04f4d34c6317 100644
--- a/include/asm-arm/processor.h
+++ b/include/asm-arm/processor.h
@@ -49,6 +49,12 @@ struct thread_struct {
49 49
50#define INIT_THREAD { } 50#define INIT_THREAD { }
51 51
52#ifdef CONFIG_MMU
53#define nommu_start_thread(regs) do { } while (0)
54#else
55#define nommu_start_thread(regs) regs->ARM_r10 = current->mm->start_data
56#endif
57
52#define start_thread(regs,pc,sp) \ 58#define start_thread(regs,pc,sp) \
53({ \ 59({ \
54 unsigned long *stack = (unsigned long *)sp; \ 60 unsigned long *stack = (unsigned long *)sp; \
@@ -65,6 +71,7 @@ struct thread_struct {
65 regs->ARM_r2 = stack[2]; /* r2 (envp) */ \ 71 regs->ARM_r2 = stack[2]; /* r2 (envp) */ \
66 regs->ARM_r1 = stack[1]; /* r1 (argv) */ \ 72 regs->ARM_r1 = stack[1]; /* r1 (argv) */ \
67 regs->ARM_r0 = stack[0]; /* r0 (argc) */ \ 73 regs->ARM_r0 = stack[0]; /* r0 (argc) */ \
74 nommu_start_thread(regs); \
68}) 75})
69 76
70/* Forward declaration, a strange C thing */ 77/* Forward declaration, a strange C thing */
@@ -85,9 +92,11 @@ unsigned long get_wchan(struct task_struct *p);
85 */ 92 */
86extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 93extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
87 94
88#define KSTK_REGS(tsk) (((struct pt_regs *)(THREAD_START_SP + (unsigned long)(tsk)->thread_info)) - 1) 95#define task_pt_regs(p) \
89#define KSTK_EIP(tsk) KSTK_REGS(tsk)->ARM_pc 96 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
90#define KSTK_ESP(tsk) KSTK_REGS(tsk)->ARM_sp 97
98#define KSTK_EIP(tsk) task_pt_regs(tsk)->ARM_pc
99#define KSTK_ESP(tsk) task_pt_regs(tsk)->ARM_sp
91 100
92/* 101/*
93 * Prefetching support - only ARMv5. 102 * Prefetching support - only ARMv5.
diff --git a/include/asm-arm/ptrace.h b/include/asm-arm/ptrace.h
index 4377e22b7e1a..77adb7fa169b 100644
--- a/include/asm-arm/ptrace.h
+++ b/include/asm-arm/ptrace.h
@@ -23,6 +23,9 @@
23#define PTRACE_OLDSETOPTIONS 21 23#define PTRACE_OLDSETOPTIONS 21
24 24
25#define PTRACE_GET_THREAD_AREA 22 25#define PTRACE_GET_THREAD_AREA 22
26
27#define PTRACE_SET_SYSCALL 23
28
26/* 29/*
27 * PSR bits 30 * PSR bits
28 */ 31 */
@@ -60,9 +63,11 @@
60 63
61#ifndef __ASSEMBLY__ 64#ifndef __ASSEMBLY__
62 65
63/* this struct defines the way the registers are stored on the 66/*
64 stack during a system call. */ 67 * This struct defines the way the registers are stored on the
65 68 * stack during a system call. Note that sizeof(struct pt_regs)
69 * has to be a multiple of 8.
70 */
66struct pt_regs { 71struct pt_regs {
67 long uregs[18]; 72 long uregs[18];
68}; 73};
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/stat.h b/include/asm-arm/stat.h
index ec4e2c2e3b47..42c0c13999d5 100644
--- a/include/asm-arm/stat.h
+++ b/include/asm-arm/stat.h
@@ -70,14 +70,7 @@ struct stat64 {
70 70
71 long long st_size; 71 long long st_size;
72 unsigned long st_blksize; 72 unsigned long st_blksize;
73 73 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
74#if defined(__ARMEB__)
75 unsigned long __pad4; /* Future possible st_blocks hi bits */
76 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
77#else /* Must be little */
78 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
79 unsigned long __pad4; /* Future possible st_blocks hi bits */
80#endif
81 74
82 unsigned long st_atime; 75 unsigned long st_atime;
83 unsigned long st_atime_nsec; 76 unsigned long st_atime_nsec;
@@ -89,6 +82,6 @@ struct stat64 {
89 unsigned long st_ctime_nsec; 82 unsigned long st_ctime_nsec;
90 83
91 unsigned long long st_ino; 84 unsigned long long st_ino;
92} __attribute__((packed)); 85};
93 86
94#endif 87#endif
diff --git a/include/asm-arm/statfs.h b/include/asm-arm/statfs.h
index e81f82783b87..a02e6a8c3d70 100644
--- a/include/asm-arm/statfs.h
+++ b/include/asm-arm/statfs.h
@@ -1,6 +1,42 @@
1#ifndef _ASMARM_STATFS_H 1#ifndef _ASMARM_STATFS_H
2#define _ASMARM_STATFS_H 2#define _ASMARM_STATFS_H
3 3
4#include <asm-generic/statfs.h> 4#ifndef __KERNEL_STRICT_NAMES
5# include <linux/types.h>
6typedef __kernel_fsid_t fsid_t;
7#endif
8
9struct statfs {
10 __u32 f_type;
11 __u32 f_bsize;
12 __u32 f_blocks;
13 __u32 f_bfree;
14 __u32 f_bavail;
15 __u32 f_files;
16 __u32 f_ffree;
17 __kernel_fsid_t f_fsid;
18 __u32 f_namelen;
19 __u32 f_frsize;
20 __u32 f_spare[5];
21};
22
23/*
24 * With EABI there is 4 bytes of padding added to this structure.
25 * Let's pack it so the padding goes away to simplify dual ABI support.
26 * Note that user space does NOT have to pack this structure.
27 */
28struct statfs64 {
29 __u32 f_type;
30 __u32 f_bsize;
31 __u64 f_blocks;
32 __u64 f_bfree;
33 __u64 f_bavail;
34 __u64 f_files;
35 __u64 f_ffree;
36 __kernel_fsid_t f_fsid;
37 __u32 f_namelen;
38 __u32 f_frsize;
39 __u32 f_spare[5];
40} __attribute__ ((packed,aligned(4)));
5 41
6#endif 42#endif
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-arm/unistd.h b/include/asm-arm/unistd.h
index d626e70faded..77430d6178ae 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -15,10 +15,12 @@
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17 17
18#if defined(__thumb__) 18#define __NR_OABI_SYSCALL_BASE 0x900000
19
20#if defined(__thumb__) || defined(__ARM_EABI__)
19#define __NR_SYSCALL_BASE 0 21#define __NR_SYSCALL_BASE 0
20#else 22#else
21#define __NR_SYSCALL_BASE 0x900000 23#define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE
22#endif 24#endif
23 25
24/* 26/*
@@ -373,13 +375,13 @@
373#define __sys1(x) __sys2(x) 375#define __sys1(x) __sys2(x)
374 376
375#ifndef __syscall 377#ifndef __syscall
376#if defined(__thumb__) 378#if defined(__thumb__) || defined(__ARM_EABI__)
377#define __syscall(name) \ 379#define __SYS_REG(name) register long __sysreg __asm__("r7") = __NR_##name;
378 "push {r7}\n\t" \ 380#define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs
379 "mov r7, #" __sys1(__NR_##name) "\n\t" \ 381#define __syscall(name) "swi\t0"
380 "swi 0\n\t" \
381 "pop {r7}"
382#else 382#else
383#define __SYS_REG(name)
384#define __SYS_REG_LIST(regs...) regs
383#define __syscall(name) "swi\t" __sys1(__NR_##name) "" 385#define __syscall(name) "swi\t" __sys1(__NR_##name) ""
384#endif 386#endif
385#endif 387#endif
@@ -395,33 +397,34 @@ do { \
395 397
396#define _syscall0(type,name) \ 398#define _syscall0(type,name) \
397type name(void) { \ 399type name(void) { \
400 __SYS_REG(name) \
398 register long __res_r0 __asm__("r0"); \ 401 register long __res_r0 __asm__("r0"); \
399 long __res; \ 402 long __res; \
400 __asm__ __volatile__ ( \ 403 __asm__ __volatile__ ( \
401 __syscall(name) \ 404 __syscall(name) \
402 : "=r" (__res_r0) \ 405 : "=r" (__res_r0) \
403 : \ 406 : __SYS_REG_LIST() ); \
404 : "lr"); \
405 __res = __res_r0; \ 407 __res = __res_r0; \
406 __syscall_return(type,__res); \ 408 __syscall_return(type,__res); \
407} 409}
408 410
409#define _syscall1(type,name,type1,arg1) \ 411#define _syscall1(type,name,type1,arg1) \
410type name(type1 arg1) { \ 412type name(type1 arg1) { \
413 __SYS_REG(name) \
411 register long __r0 __asm__("r0") = (long)arg1; \ 414 register long __r0 __asm__("r0") = (long)arg1; \
412 register long __res_r0 __asm__("r0"); \ 415 register long __res_r0 __asm__("r0"); \
413 long __res; \ 416 long __res; \
414 __asm__ __volatile__ ( \ 417 __asm__ __volatile__ ( \
415 __syscall(name) \ 418 __syscall(name) \
416 : "=r" (__res_r0) \ 419 : "=r" (__res_r0) \
417 : "r" (__r0) \ 420 : __SYS_REG_LIST( "0" (__r0) ) ); \
418 : "lr"); \
419 __res = __res_r0; \ 421 __res = __res_r0; \
420 __syscall_return(type,__res); \ 422 __syscall_return(type,__res); \
421} 423}
422 424
423#define _syscall2(type,name,type1,arg1,type2,arg2) \ 425#define _syscall2(type,name,type1,arg1,type2,arg2) \
424type name(type1 arg1,type2 arg2) { \ 426type name(type1 arg1,type2 arg2) { \
427 __SYS_REG(name) \
425 register long __r0 __asm__("r0") = (long)arg1; \ 428 register long __r0 __asm__("r0") = (long)arg1; \
426 register long __r1 __asm__("r1") = (long)arg2; \ 429 register long __r1 __asm__("r1") = (long)arg2; \
427 register long __res_r0 __asm__("r0"); \ 430 register long __res_r0 __asm__("r0"); \
@@ -429,8 +432,7 @@ type name(type1 arg1,type2 arg2) { \
429 __asm__ __volatile__ ( \ 432 __asm__ __volatile__ ( \
430 __syscall(name) \ 433 __syscall(name) \
431 : "=r" (__res_r0) \ 434 : "=r" (__res_r0) \
432 : "r" (__r0),"r" (__r1) \ 435 : __SYS_REG_LIST( "0" (__r0), "r" (__r1) ) ); \
433 : "lr"); \
434 __res = __res_r0; \ 436 __res = __res_r0; \
435 __syscall_return(type,__res); \ 437 __syscall_return(type,__res); \
436} 438}
@@ -438,6 +440,7 @@ type name(type1 arg1,type2 arg2) { \
438 440
439#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ 441#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
440type name(type1 arg1,type2 arg2,type3 arg3) { \ 442type name(type1 arg1,type2 arg2,type3 arg3) { \
443 __SYS_REG(name) \
441 register long __r0 __asm__("r0") = (long)arg1; \ 444 register long __r0 __asm__("r0") = (long)arg1; \
442 register long __r1 __asm__("r1") = (long)arg2; \ 445 register long __r1 __asm__("r1") = (long)arg2; \
443 register long __r2 __asm__("r2") = (long)arg3; \ 446 register long __r2 __asm__("r2") = (long)arg3; \
@@ -446,8 +449,7 @@ type name(type1 arg1,type2 arg2,type3 arg3) { \
446 __asm__ __volatile__ ( \ 449 __asm__ __volatile__ ( \
447 __syscall(name) \ 450 __syscall(name) \
448 : "=r" (__res_r0) \ 451 : "=r" (__res_r0) \
449 : "r" (__r0),"r" (__r1),"r" (__r2) \ 452 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2) ) ); \
450 : "lr"); \
451 __res = __res_r0; \ 453 __res = __res_r0; \
452 __syscall_return(type,__res); \ 454 __syscall_return(type,__res); \
453} 455}
@@ -455,6 +457,7 @@ type name(type1 arg1,type2 arg2,type3 arg3) { \
455 457
456#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ 458#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\
457type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ 459type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
460 __SYS_REG(name) \
458 register long __r0 __asm__("r0") = (long)arg1; \ 461 register long __r0 __asm__("r0") = (long)arg1; \
459 register long __r1 __asm__("r1") = (long)arg2; \ 462 register long __r1 __asm__("r1") = (long)arg2; \
460 register long __r2 __asm__("r2") = (long)arg3; \ 463 register long __r2 __asm__("r2") = (long)arg3; \
@@ -464,8 +467,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
464 __asm__ __volatile__ ( \ 467 __asm__ __volatile__ ( \
465 __syscall(name) \ 468 __syscall(name) \
466 : "=r" (__res_r0) \ 469 : "=r" (__res_r0) \
467 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3) \ 470 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), "r" (__r3) ) ); \
468 : "lr"); \
469 __res = __res_r0; \ 471 __res = __res_r0; \
470 __syscall_return(type,__res); \ 472 __syscall_return(type,__res); \
471} 473}
@@ -473,6 +475,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
473 475
474#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ 476#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
475type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ 477type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \
478 __SYS_REG(name) \
476 register long __r0 __asm__("r0") = (long)arg1; \ 479 register long __r0 __asm__("r0") = (long)arg1; \
477 register long __r1 __asm__("r1") = (long)arg2; \ 480 register long __r1 __asm__("r1") = (long)arg2; \
478 register long __r2 __asm__("r2") = (long)arg3; \ 481 register long __r2 __asm__("r2") = (long)arg3; \
@@ -483,14 +486,15 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \
483 __asm__ __volatile__ ( \ 486 __asm__ __volatile__ ( \
484 __syscall(name) \ 487 __syscall(name) \
485 : "=r" (__res_r0) \ 488 : "=r" (__res_r0) \
486 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3),"r" (__r4) \ 489 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \
487 : "lr"); \ 490 "r" (__r3), "r" (__r4) ) ); \
488 __res = __res_r0; \ 491 __res = __res_r0; \
489 __syscall_return(type,__res); \ 492 __syscall_return(type,__res); \
490} 493}
491 494
492#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ 495#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
493type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \ 496type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \
497 __SYS_REG(name) \
494 register long __r0 __asm__("r0") = (long)arg1; \ 498 register long __r0 __asm__("r0") = (long)arg1; \
495 register long __r1 __asm__("r1") = (long)arg2; \ 499 register long __r1 __asm__("r1") = (long)arg2; \
496 register long __r2 __asm__("r2") = (long)arg3; \ 500 register long __r2 __asm__("r2") = (long)arg3; \
@@ -502,30 +506,33 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
502 __asm__ __volatile__ ( \ 506 __asm__ __volatile__ ( \
503 __syscall(name) \ 507 __syscall(name) \
504 : "=r" (__res_r0) \ 508 : "=r" (__res_r0) \
505 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3), "r" (__r4),"r" (__r5) \ 509 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \
506 : "lr"); \ 510 "r" (__r3), "r" (__r4), "r" (__r5) ) ); \
507 __res = __res_r0; \ 511 __res = __res_r0; \
508 __syscall_return(type,__res); \ 512 __syscall_return(type,__res); \
509} 513}
510 514
511#ifdef __KERNEL__ 515#ifdef __KERNEL__
512#define __ARCH_WANT_IPC_PARSE_VERSION 516#define __ARCH_WANT_IPC_PARSE_VERSION
513#define __ARCH_WANT_OLD_READDIR
514#define __ARCH_WANT_STAT64 517#define __ARCH_WANT_STAT64
515#define __ARCH_WANT_SYS_ALARM
516#define __ARCH_WANT_SYS_GETHOSTNAME 518#define __ARCH_WANT_SYS_GETHOSTNAME
517#define __ARCH_WANT_SYS_PAUSE 519#define __ARCH_WANT_SYS_PAUSE
518#define __ARCH_WANT_SYS_TIME
519#define __ARCH_WANT_SYS_UTIME
520#define __ARCH_WANT_SYS_SOCKETCALL
521#define __ARCH_WANT_SYS_GETPGRP 520#define __ARCH_WANT_SYS_GETPGRP
522#define __ARCH_WANT_SYS_LLSEEK 521#define __ARCH_WANT_SYS_LLSEEK
523#define __ARCH_WANT_SYS_NICE 522#define __ARCH_WANT_SYS_NICE
524#define __ARCH_WANT_SYS_OLD_GETRLIMIT
525#define __ARCH_WANT_SYS_OLDUMOUNT
526#define __ARCH_WANT_SYS_SIGPENDING 523#define __ARCH_WANT_SYS_SIGPENDING
527#define __ARCH_WANT_SYS_SIGPROCMASK 524#define __ARCH_WANT_SYS_SIGPROCMASK
528#define __ARCH_WANT_SYS_RT_SIGACTION 525#define __ARCH_WANT_SYS_RT_SIGACTION
526
527#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
528#define __ARCH_WANT_SYS_TIME
529#define __ARCH_WANT_SYS_OLDUMOUNT
530#define __ARCH_WANT_SYS_ALARM
531#define __ARCH_WANT_SYS_UTIME
532#define __ARCH_WANT_SYS_OLD_GETRLIMIT
533#define __ARCH_WANT_OLD_READDIR
534#define __ARCH_WANT_SYS_SOCKETCALL
535#endif
529#endif 536#endif
530 537
531#ifdef __KERNEL_SYSCALLS__ 538#ifdef __KERNEL_SYSCALLS__
diff --git a/include/asm-arm26/atomic.h b/include/asm-arm26/atomic.h
index 3074b0e76343..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;
diff --git a/include/asm-arm26/cache.h b/include/asm-arm26/cache.h
index f52ca1b808cd..8c3abcf728fe 100644
--- a/include/asm-arm26/cache.h
+++ b/include/asm-arm26/cache.h
@@ -4,7 +4,8 @@
4#ifndef __ASMARM_CACHE_H 4#ifndef __ASMARM_CACHE_H
5#define __ASMARM_CACHE_H 5#define __ASMARM_CACHE_H
6 6
7#define L1_CACHE_BYTES 32 7#define L1_CACHE_SHIFT 5
8#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
8#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) 9#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
9#define SMP_CACHE_BYTES L1_CACHE_BYTES 10#define SMP_CACHE_BYTES L1_CACHE_BYTES
10 11
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/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..9b367ebe515d 100644
--- a/include/asm-arm26/thread_info.h
+++ b/include/asm-arm26/thread_info.h
@@ -80,20 +80,16 @@ static inline struct thread_info *current_thread_info(void)
80 return (struct thread_info *)(sp & ~0x1fff); 80 return (struct thread_info *)(sp & ~0x1fff);
81} 81}
82 82
83/* FIXME - PAGE_SIZE < 32K */ 83#define THREAD_SIZE PAGE_SIZE
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 task_pt_regs(task) ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE - 8) - 1)
85#define __get_user_regs(x) (((struct pt_regs *)((unsigned long)(x) + THREAD_SIZE - 8)) - 1)
86 85
87extern struct thread_info *alloc_thread_info(struct task_struct *task); 86extern struct thread_info *alloc_thread_info(struct task_struct *task);
88extern void free_thread_info(struct thread_info *); 87extern void free_thread_info(struct thread_info *);
89 88
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) \ 89#define thread_saved_pc(tsk) \
94 ((unsigned long)(pc_pointer((tsk)->thread_info->cpu_context.pc))) 90 ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
95#define thread_saved_fp(tsk) \ 91#define thread_saved_fp(tsk) \
96 ((unsigned long)((tsk)->thread_info->cpu_context.fp)) 92 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
97 93
98#else /* !__ASSEMBLY__ */ 94#else /* !__ASSEMBLY__ */
99 95
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 2df2c7aa19b7..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;
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/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 3f54fea2b051..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,7 @@ 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
429#include <asm-generic/atomic.h> 344#include <asm-generic/atomic.h>
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/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/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/thread_info.h b/include/asm-frv/thread_info.h
index 60f6b2aee76d..ea426abf01d3 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
@@ -131,6 +129,7 @@ register struct thread_info *__current_thread_info asm("gr15");
131#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 129#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
132#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ 130#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
133#define TIF_IRET 5 /* return with iret */ 131#define TIF_IRET 5 /* return with iret */
132#define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */
134#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 133#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
135#define TIF_MEMDIE 17 /* OOM killer killed process */ 134#define TIF_MEMDIE 17 /* OOM killer killed process */
136 135
@@ -140,6 +139,7 @@ register struct thread_info *__current_thread_info asm("gr15");
140#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 139#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
141#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 140#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
142#define _TIF_IRET (1 << TIF_IRET) 141#define _TIF_IRET (1 << TIF_IRET)
142#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
143#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 143#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
144 144
145#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 145#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
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..4d994d2e99e3 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)
@@ -486,6 +486,7 @@ static inline pid_t wait(int * wait_stat)
486/* #define __ARCH_WANT_SYS_SIGPENDING */ 486/* #define __ARCH_WANT_SYS_SIGPENDING */
487#define __ARCH_WANT_SYS_SIGPROCMASK 487#define __ARCH_WANT_SYS_SIGPROCMASK
488#define __ARCH_WANT_SYS_RT_SIGACTION 488#define __ARCH_WANT_SYS_RT_SIGACTION
489#define __ARCH_WANT_SYS_RT_SIGSUSPEND
489#endif 490#endif
490 491
491/* 492/*
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
index e0a28b925ef0..42a95d9a0641 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -8,6 +8,7 @@
8 * edit all arch specific atomic.h files. 8 * edit all arch specific atomic.h files.
9 */ 9 */
10 10
11#include <asm/types.h>
11 12
12/* 13/*
13 * Suppport for atomic_long_t 14 * Suppport for atomic_long_t
@@ -34,7 +35,7 @@ static inline void atomic_long_set(atomic_long_t *l, long i)
34{ 35{
35 atomic64_t *v = (atomic64_t *)l; 36 atomic64_t *v = (atomic64_t *)l;
36 37
37 atomic_set(v, i); 38 atomic64_set(v, i);
38} 39}
39 40
40static inline void atomic_long_inc(atomic_long_t *l) 41static inline void atomic_long_inc(atomic_long_t *l)
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-h8300/atomic.h b/include/asm-h8300/atomic.h
index d891541e89c3..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;
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/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/acpi.h b/include/asm-i386/acpi.h
index df4ed323aa4d..55059abf9c95 100644
--- a/include/asm-i386/acpi.h
+++ b/include/asm-i386/acpi.h
@@ -179,7 +179,7 @@ extern void acpi_reserve_bootmem(void);
179 179
180extern u8 x86_acpiid_to_apicid[]; 180extern u8 x86_acpiid_to_apicid[];
181 181
182#define ARCH_HAS_POWER_PDC_INIT 1 182#define ARCH_HAS_POWER_INIT 1
183 183
184#endif /*__KERNEL__*/ 184#endif /*__KERNEL__*/
185 185
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 7a5472d77091..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
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index 65679aca4b22..88e6ca248cd7 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}
@@ -247,7 +247,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long* addr)
247static int test_bit(int nr, const volatile void * addr); 247static int test_bit(int nr, const volatile void * addr);
248#endif 248#endif
249 249
250static inline int constant_test_bit(int nr, const volatile unsigned long *addr) 250static __always_inline int constant_test_bit(int nr, const volatile unsigned long *addr)
251{ 251{
252 return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0; 252 return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0;
253} 253}
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/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/current.h b/include/asm-i386/current.h
index d97328951f5f..3cbbecd79016 100644
--- a/include/asm-i386/current.h
+++ b/include/asm-i386/current.h
@@ -5,7 +5,7 @@
5 5
6struct task_struct; 6struct task_struct;
7 7
8static inline struct task_struct * get_current(void) 8static __always_inline struct task_struct * get_current(void)
9{ 9{
10 return current_thread_info()->task; 10 return current_thread_info()->task;
11} 11}
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/edac.h b/include/asm-i386/edac.h
new file mode 100644
index 000000000000..3e7dd0ab68ce
--- /dev/null
+++ b/include/asm-i386/edac.h
@@ -0,0 +1,18 @@
1#ifndef ASM_EDAC_H
2#define ASM_EDAC_H
3
4/* ECC atomic, DMA, SMP and interrupt safe scrub function */
5
6static __inline__ void atomic_scrub(void *va, u32 size)
7{
8 unsigned long *virt_addr = va;
9 u32 i;
10
11 for (i = 0; i < size / 4; i++, virt_addr++)
12 /* Very carefully read and write to memory atomically
13 * so we are interrupt, DMA and SMP safe.
14 */
15 __asm__ __volatile__("lock; addl $0, %0"::"m"(*virt_addr));
16}
17
18#endif
diff --git a/include/asm-i386/futex.h b/include/asm-i386/futex.h
index e7a271d39309..44b9db806474 100644
--- a/include/asm-i386/futex.h
+++ b/include/asm-i386/futex.h
@@ -61,7 +61,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
61 if (op == FUTEX_OP_SET) 61 if (op == FUTEX_OP_SET)
62 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg); 62 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
63 else { 63 else {
64#if !defined(CONFIG_X86_BSWAP) && !defined(CONFIG_UML) 64#ifndef CONFIG_X86_BSWAP
65 if (boot_cpu_data.x86 == 3) 65 if (boot_cpu_data.x86 == 3)
66 ret = -ENOSYS; 66 ret = -ENOSYS;
67 else 67 else
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-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/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/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/signal.h b/include/asm-i386/signal.h
index 76524b4052ac..026fd231488d 100644
--- a/include/asm-i386/signal.h
+++ b/include/asm-i386/signal.h
@@ -218,7 +218,6 @@ static __inline__ int sigfindinword(unsigned long word)
218} 218}
219 219
220struct pt_regs; 220struct pt_regs;
221extern int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
222 221
223#define ptrace_signal_deliver(regs, cookie) \ 222#define ptrace_signal_deliver(regs, cookie) \
224 do { \ 223 do { \
diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h
index 02c8f5d22065..bb5f88a27f7a 100644
--- a/include/asm-i386/string.h
+++ b/include/asm-i386/string.h
@@ -201,7 +201,7 @@ __asm__ __volatile__(
201return __res; 201return __res;
202} 202}
203 203
204static inline void * __memcpy(void * to, const void * from, size_t n) 204static __always_inline void * __memcpy(void * to, const void * from, size_t n)
205{ 205{
206int d0, d1, d2; 206int d0, d1, d2;
207__asm__ __volatile__( 207__asm__ __volatile__(
@@ -223,7 +223,7 @@ return (to);
223 * This looks ugly, but the compiler can optimize it totally, 223 * This looks ugly, but the compiler can optimize it totally,
224 * as the count is constant. 224 * as the count is constant.
225 */ 225 */
226static inline void * __constant_memcpy(void * to, const void * from, size_t n) 226static __always_inline void * __constant_memcpy(void * to, const void * from, size_t n)
227{ 227{
228 long esi, edi; 228 long esi, edi;
229 if (!n) return to; 229 if (!n) return to;
@@ -367,7 +367,7 @@ return s;
367 * things 32 bits at a time even when we don't know the size of the 367 * things 32 bits at a time even when we don't know the size of the
368 * area at compile-time.. 368 * area at compile-time..
369 */ 369 */
370static inline void * __constant_c_memset(void * s, unsigned long c, size_t count) 370static __always_inline void * __constant_c_memset(void * s, unsigned long c, size_t count)
371{ 371{
372int d0, d1; 372int d0, d1;
373__asm__ __volatile__( 373__asm__ __volatile__(
@@ -416,7 +416,7 @@ extern char *strstr(const char *cs, const char *ct);
416 * This looks horribly ugly, but the compiler can optimize it totally, 416 * This looks horribly ugly, but the compiler can optimize it totally,
417 * as we by now know that both pattern and count is constant.. 417 * as we by now know that both pattern and count is constant..
418 */ 418 */
419static inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count) 419static __always_inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
420{ 420{
421 switch (count) { 421 switch (count) {
422 case 0: 422 case 0:
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 9c0593b7a94e..36a92ed6a9d0 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -548,6 +548,15 @@ void enable_hlt(void);
548extern int es7000_plat; 548extern int es7000_plat;
549void cpu_idle_wait(void); 549void cpu_idle_wait(void);
550 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
551extern unsigned long arch_align_stack(unsigned long sp); 560extern unsigned long arch_align_stack(unsigned long sp);
552 561
553#endif 562#endif
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index 8fbf791651bf..e20e99551d71 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
@@ -142,6 +140,7 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
142#define TIF_SYSCALL_EMU 6 /* syscall emulation active */ 140#define TIF_SYSCALL_EMU 6 /* syscall emulation active */
143#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ 141#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
144#define TIF_SECCOMP 8 /* secure computing */ 142#define TIF_SECCOMP 8 /* secure computing */
143#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
145#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 144#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
146#define TIF_MEMDIE 17 145#define TIF_MEMDIE 17
147 146
@@ -154,6 +153,7 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
154#define _TIF_SYSCALL_EMU (1<<TIF_SYSCALL_EMU) 153#define _TIF_SYSCALL_EMU (1<<TIF_SYSCALL_EMU)
155#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 154#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
156#define _TIF_SECCOMP (1<<TIF_SECCOMP) 155#define _TIF_SECCOMP (1<<TIF_SECCOMP)
156#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
157#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 157#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
158 158
159/* work to do on interrupt/exception return */ 159/* work to do on interrupt/exception return */
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/uaccess.h b/include/asm-i386/uaccess.h
index 89ab7e2bc5aa..3f1337c34208 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -411,7 +411,7 @@ unsigned long __must_check __copy_from_user_ll(void *to,
411 * Returns number of bytes that could not be copied. 411 * Returns number of bytes that could not be copied.
412 * On success, this will be zero. 412 * On success, this will be zero.
413 */ 413 */
414static inline unsigned long __must_check 414static __always_inline unsigned long __must_check
415__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n) 415__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
416{ 416{
417 if (__builtin_constant_p(n)) { 417 if (__builtin_constant_p(n)) {
@@ -432,7 +432,7 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
432 return __copy_to_user_ll(to, from, n); 432 return __copy_to_user_ll(to, from, n);
433} 433}
434 434
435static inline unsigned long __must_check 435static __always_inline unsigned long __must_check
436__copy_to_user(void __user *to, const void *from, unsigned long n) 436__copy_to_user(void __user *to, const void *from, unsigned long n)
437{ 437{
438 might_sleep(); 438 might_sleep();
@@ -456,7 +456,7 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
456 * If some data could not be copied, this function will pad the copied 456 * If some data could not be copied, this function will pad the copied
457 * data to the requested size using zero bytes. 457 * data to the requested size using zero bytes.
458 */ 458 */
459static inline unsigned long 459static __always_inline unsigned long
460__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) 460__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
461{ 461{
462 if (__builtin_constant_p(n)) { 462 if (__builtin_constant_p(n)) {
@@ -477,7 +477,7 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
477 return __copy_from_user_ll(to, from, n); 477 return __copy_from_user_ll(to, from, n);
478} 478}
479 479
480static inline unsigned long 480static __always_inline unsigned long
481__copy_from_user(void *to, const void __user *from, unsigned long n) 481__copy_from_user(void *to, const void __user *from, unsigned long n)
482{ 482{
483 might_sleep(); 483 might_sleep();
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index fe38b9a96233..597496ed2aee 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -299,8 +299,24 @@
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
303#define __NR_openat 295
304#define __NR_mkdirat 296
305#define __NR_mknodat 297
306#define __NR_fchownat 298
307#define __NR_futimesat 299
308#define __NR_newfstatat 300
309#define __NR_unlinkat 301
310#define __NR_renameat 302
311#define __NR_linkat 303
312#define __NR_symlinkat 304
313#define __NR_readlinkat 305
314#define __NR_fchmodat 306
315#define __NR_faccessat 307
316#define __NR_pselect6 308
317#define __NR_ppoll 309
302 318
303#define NR_syscalls 294 319#define NR_syscalls 310
304 320
305/* 321/*
306 * user-visible error numbers are in the range -1 - -128: see 322 * user-visible error numbers are in the range -1 - -128: see
@@ -416,6 +432,7 @@ __syscall_return(type,__res); \
416#define __ARCH_WANT_SYS_SIGPENDING 432#define __ARCH_WANT_SYS_SIGPENDING
417#define __ARCH_WANT_SYS_SIGPROCMASK 433#define __ARCH_WANT_SYS_SIGPROCMASK
418#define __ARCH_WANT_SYS_RT_SIGACTION 434#define __ARCH_WANT_SYS_RT_SIGACTION
435#define __ARCH_WANT_SYS_RT_SIGSUSPEND
419#endif 436#endif
420 437
421#ifdef __KERNEL_SYSCALLS__ 438#ifdef __KERNEL_SYSCALLS__
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 15cf7984c48e..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({ \
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..8c0fc227f0fb 100644
--- a/include/asm-ia64/kprobes.h
+++ b/include/asm-ia64/kprobes.h
@@ -68,10 +68,14 @@ struct prev_kprobe {
68 unsigned long status; 68 unsigned long status;
69}; 69};
70 70
71#define MAX_PARAM_RSE_SIZE (0x60+0x60/0x3f)
71/* per-cpu kprobe control block */ 72/* per-cpu kprobe control block */
72struct kprobe_ctlblk { 73struct kprobe_ctlblk {
73 unsigned long kprobe_status; 74 unsigned long kprobe_status;
74 struct pt_regs jprobe_saved_regs; 75 struct pt_regs jprobe_saved_regs;
76 unsigned long jprobes_saved_stacked_regs[MAX_PARAM_RSE_SIZE];
77 unsigned long *bsp;
78 unsigned long cfm;
75 struct prev_kprobe prev_kprobe; 79 struct prev_kprobe prev_kprobe;
76}; 80};
77 81
@@ -89,6 +93,7 @@ struct kprobe_ctlblk {
89#define IP_RELATIVE_PREDICT_OPCODE (7) 93#define IP_RELATIVE_PREDICT_OPCODE (7)
90#define LONG_BRANCH_OPCODE (0xC) 94#define LONG_BRANCH_OPCODE (0xC)
91#define LONG_CALL_OPCODE (0xD) 95#define LONG_CALL_OPCODE (0xD)
96#define arch_remove_kprobe(p) do {} while (0)
92 97
93typedef struct kprobe_opcode { 98typedef struct kprobe_opcode {
94 bundle_t bundle; 99 bundle_t bundle;
@@ -110,12 +115,6 @@ struct arch_specific_insn {
110 unsigned short target_br_reg; 115 unsigned short target_br_reg;
111}; 116};
112 117
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, 118extern int kprobe_exceptions_notify(struct notifier_block *self,
120 unsigned long val, void *data); 119 unsigned long val, void *data);
121 120
@@ -123,12 +122,7 @@ extern int kprobe_exceptions_notify(struct notifier_block *self,
123static inline void jprobe_return(void) 122static inline void jprobe_return(void)
124{ 123{
125} 124}
125extern void invalidate_stacked_regs(void);
126extern void flush_register_stack(void);
126 127
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 */ 128#endif /* _ASM_KPROBES_H */
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/pal.h b/include/asm-ia64/pal.h
index e828377ad295..7708ec669a33 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -927,7 +927,7 @@ static inline s64
927ia64_pal_cache_flush (u64 cache_type, u64 invalidate, u64 *progress, u64 *vector) 927ia64_pal_cache_flush (u64 cache_type, u64 invalidate, u64 *progress, u64 *vector)
928{ 928{
929 struct ia64_pal_retval iprv; 929 struct ia64_pal_retval iprv;
930 PAL_CALL_IC_OFF(iprv, PAL_CACHE_FLUSH, cache_type, invalidate, *progress); 930 PAL_CALL(iprv, PAL_CACHE_FLUSH, cache_type, invalidate, *progress);
931 if (vector) 931 if (vector)
932 *vector = iprv.v0; 932 *vector = iprv.v0;
933 *progress = iprv.v1; 933 *progress = iprv.v1;
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index 94e07e727395..09b99029ac1a 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -25,8 +25,8 @@
25 * Limits for PMC and PMD are set to less than maximum architected values 25 * Limits for PMC and PMD are set to less than maximum architected values
26 * but should be sufficient for a while 26 * but should be sufficient for a while
27 */ 27 */
28#define IA64_NUM_PMC_REGS 32 28#define IA64_NUM_PMC_REGS 64
29#define IA64_NUM_PMD_REGS 32 29#define IA64_NUM_PMD_REGS 64
30 30
31#define DEFAULT_MAP_BASE __IA64_UL_CONST(0x2000000000000000) 31#define DEFAULT_MAP_BASE __IA64_UL_CONST(0x2000000000000000)
32#define DEFAULT_TASK_SIZE __IA64_UL_CONST(0xa000000000000000) 32#define DEFAULT_TASK_SIZE __IA64_UL_CONST(0xa000000000000000)
@@ -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/semaphore.h b/include/asm-ia64/semaphore.h
index bb8906285fab..f483eeb95dd1 100644
--- a/include/asm-ia64/semaphore.h
+++ b/include/asm-ia64/semaphore.h
@@ -61,7 +61,7 @@ static inline void
61down (struct semaphore *sem) 61down (struct semaphore *sem)
62{ 62{
63 might_sleep(); 63 might_sleep();
64 if (atomic_dec_return(&sem->count) < 0) 64 if (ia64_fetchadd(-1, &sem->count.counter, acq) < 1)
65 __down(sem); 65 __down(sem);
66} 66}
67 67
@@ -75,7 +75,7 @@ down_interruptible (struct semaphore * sem)
75 int ret = 0; 75 int ret = 0;
76 76
77 might_sleep(); 77 might_sleep();
78 if (atomic_dec_return(&sem->count) < 0) 78 if (ia64_fetchadd(-1, &sem->count.counter, acq) < 1)
79 ret = __down_interruptible(sem); 79 ret = __down_interruptible(sem);
80 return ret; 80 return ret;
81} 81}
@@ -85,7 +85,7 @@ down_trylock (struct semaphore *sem)
85{ 85{
86 int ret = 0; 86 int ret = 0;
87 87
88 if (atomic_dec_return(&sem->count) < 0) 88 if (ia64_fetchadd(-1, &sem->count.counter, acq) < 1)
89 ret = __down_trylock(sem); 89 ret = __down_trylock(sem);
90 return ret; 90 return ret;
91} 91}
@@ -93,7 +93,7 @@ down_trylock (struct semaphore *sem)
93static inline void 93static inline void
94up (struct semaphore * sem) 94up (struct semaphore * sem)
95{ 95{
96 if (atomic_inc_return(&sem->count) <= 0) 96 if (ia64_fetchadd(1, &sem->count.counter, rel) <= -1)
97 __up(sem); 97 __up(sem);
98} 98}
99 99
diff --git a/include/asm-ia64/sn/intr.h b/include/asm-ia64/sn/intr.h
index e35074f526d9..a3431372c6e7 100644
--- a/include/asm-ia64/sn/intr.h
+++ b/include/asm-ia64/sn/intr.h
@@ -40,7 +40,7 @@ struct sn_irq_info {
40 int irq_cpuid; /* kernel logical cpuid */ 40 int irq_cpuid; /* kernel logical cpuid */
41 int irq_irq; /* the IRQ number */ 41 int irq_irq; /* the IRQ number */
42 int irq_int_bit; /* Bridge interrupt pin */ 42 int irq_int_bit; /* Bridge interrupt pin */
43 uint64_t irq_xtalkaddr; /* xtalkaddr IRQ is sent to */ 43 u64 irq_xtalkaddr; /* xtalkaddr IRQ is sent to */
44 int irq_bridge_type;/* pciio asic type (pciio.h) */ 44 int irq_bridge_type;/* pciio asic type (pciio.h) */
45 void *irq_bridge; /* bridge generating irq */ 45 void *irq_bridge; /* bridge generating irq */
46 void *irq_pciioinfo; /* associated pciio_info_t */ 46 void *irq_pciioinfo; /* associated pciio_info_t */
diff --git a/include/asm-ia64/sn/ioc3.h b/include/asm-ia64/sn/ioc3.h
new file mode 100644
index 000000000000..95ed6cc83cf1
--- /dev/null
+++ b/include/asm-ia64/sn/ioc3.h
@@ -0,0 +1,241 @@
1/*
2 * Copyright (C) 2005 Silicon Graphics, Inc.
3 */
4#ifndef IA64_SN_IOC3_H
5#define IA64_SN_IOC3_H
6
7/* serial port register map */
8struct ioc3_serialregs {
9 uint32_t sscr;
10 uint32_t stpir;
11 uint32_t stcir;
12 uint32_t srpir;
13 uint32_t srcir;
14 uint32_t srtr;
15 uint32_t shadow;
16};
17
18/* SUPERIO uart register map */
19struct ioc3_uartregs {
20 char iu_lcr;
21 union {
22 char iir; /* read only */
23 char fcr; /* write only */
24 } u3;
25 union {
26 char ier; /* DLAB == 0 */
27 char dlm; /* DLAB == 1 */
28 } u2;
29 union {
30 char rbr; /* read only, DLAB == 0 */
31 char thr; /* write only, DLAB == 0 */
32 char dll; /* DLAB == 1 */
33 } u1;
34 char iu_scr;
35 char iu_msr;
36 char iu_lsr;
37 char iu_mcr;
38};
39
40#define iu_rbr u1.rbr
41#define iu_thr u1.thr
42#define iu_dll u1.dll
43#define iu_ier u2.ier
44#define iu_dlm u2.dlm
45#define iu_iir u3.iir
46#define iu_fcr u3.fcr
47
48struct ioc3_sioregs {
49 char fill[0x170];
50 struct ioc3_uartregs uartb;
51 struct ioc3_uartregs uarta;
52};
53
54/* PCI IO/mem space register map */
55struct ioc3 {
56 uint32_t pci_id;
57 uint32_t pci_scr;
58 uint32_t pci_rev;
59 uint32_t pci_lat;
60 uint32_t pci_addr;
61 uint32_t pci_err_addr_l;
62 uint32_t pci_err_addr_h;
63
64 uint32_t sio_ir;
65 /* these registers are read-only for general kernel code. To
66 * modify them use the functions in ioc3.c
67 */
68 uint32_t sio_ies;
69 uint32_t sio_iec;
70 uint32_t sio_cr;
71 uint32_t int_out;
72 uint32_t mcr;
73 uint32_t gpcr_s;
74 uint32_t gpcr_c;
75 uint32_t gpdr;
76 uint32_t gppr[9];
77 char fill[0x4c];
78
79 /* serial port registers */
80 uint32_t sbbr_h;
81 uint32_t sbbr_l;
82
83 struct ioc3_serialregs port_a;
84 struct ioc3_serialregs port_b;
85 char fill1[0x1ff10];
86 /* superio registers */
87 struct ioc3_sioregs sregs;
88};
89
90/* These don't exist on the ioc3 serial card... */
91#define eier fill1[8]
92#define eisr fill1[4]
93
94#define PCI_LAT 0xc /* Latency Timer */
95#define PCI_SCR_DROP_MODE_EN 0x00008000 /* drop pios on parity err */
96#define UARTA_BASE 0x178
97#define UARTB_BASE 0x170
98
99
100/* bitmasks for serial RX status byte */
101#define RXSB_OVERRUN 0x01 /* char(s) lost */
102#define RXSB_PAR_ERR 0x02 /* parity error */
103#define RXSB_FRAME_ERR 0x04 /* framing error */
104#define RXSB_BREAK 0x08 /* break character */
105#define RXSB_CTS 0x10 /* state of CTS */
106#define RXSB_DCD 0x20 /* state of DCD */
107#define RXSB_MODEM_VALID 0x40 /* DCD, CTS and OVERRUN are valid */
108#define RXSB_DATA_VALID 0x80 /* FRAME_ERR PAR_ERR & BREAK valid */
109
110/* bitmasks for serial TX control byte */
111#define TXCB_INT_WHEN_DONE 0x20 /* interrupt after this byte is sent */
112#define TXCB_INVALID 0x00 /* byte is invalid */
113#define TXCB_VALID 0x40 /* byte is valid */
114#define TXCB_MCR 0x80 /* data<7:0> to modem cntrl register */
115#define TXCB_DELAY 0xc0 /* delay data<7:0> mSec */
116
117/* bitmasks for SBBR_L */
118#define SBBR_L_SIZE 0x00000001 /* 0 1KB rings, 1 4KB rings */
119
120/* bitmasks for SSCR_<A:B> */
121#define SSCR_RX_THRESHOLD 0x000001ff /* hiwater mark */
122#define SSCR_TX_TIMER_BUSY 0x00010000 /* TX timer in progress */
123#define SSCR_HFC_EN 0x00020000 /* h/w flow cntrl enabled */
124#define SSCR_RX_RING_DCD 0x00040000 /* postRX record on delta-DCD */
125#define SSCR_RX_RING_CTS 0x00080000 /* postRX record on delta-CTS */
126#define SSCR_HIGH_SPD 0x00100000 /* 4X speed */
127#define SSCR_DIAG 0x00200000 /* bypass clock divider */
128#define SSCR_RX_DRAIN 0x08000000 /* drain RX buffer to memory */
129#define SSCR_DMA_EN 0x10000000 /* enable ring buffer DMA */
130#define SSCR_DMA_PAUSE 0x20000000 /* pause DMA */
131#define SSCR_PAUSE_STATE 0x40000000 /* set when PAUSE takes effect*/
132#define SSCR_RESET 0x80000000 /* reset DMA channels */
133
134/* all producer/comsumer pointers are the same bitfield */
135#define PROD_CONS_PTR_4K 0x00000ff8 /* for 4K buffers */
136#define PROD_CONS_PTR_1K 0x000003f8 /* for 1K buffers */
137#define PROD_CONS_PTR_OFF 3
138
139/* bitmasks for SRCIR_<A:B> */
140#define SRCIR_ARM 0x80000000 /* arm RX timer */
141
142/* bitmasks for SHADOW_<A:B> */
143#define SHADOW_DR 0x00000001 /* data ready */
144#define SHADOW_OE 0x00000002 /* overrun error */
145#define SHADOW_PE 0x00000004 /* parity error */
146#define SHADOW_FE 0x00000008 /* framing error */
147#define SHADOW_BI 0x00000010 /* break interrupt */
148#define SHADOW_THRE 0x00000020 /* transmit holding reg empty */
149#define SHADOW_TEMT 0x00000040 /* transmit shift reg empty */
150#define SHADOW_RFCE 0x00000080 /* char in RX fifo has error */
151#define SHADOW_DCTS 0x00010000 /* delta clear to send */
152#define SHADOW_DDCD 0x00080000 /* delta data carrier detect */
153#define SHADOW_CTS 0x00100000 /* clear to send */
154#define SHADOW_DCD 0x00800000 /* data carrier detect */
155#define SHADOW_DTR 0x01000000 /* data terminal ready */
156#define SHADOW_RTS 0x02000000 /* request to send */
157#define SHADOW_OUT1 0x04000000 /* 16550 OUT1 bit */
158#define SHADOW_OUT2 0x08000000 /* 16550 OUT2 bit */
159#define SHADOW_LOOP 0x10000000 /* loopback enabled */
160
161/* bitmasks for SRTR_<A:B> */
162#define SRTR_CNT 0x00000fff /* reload value for RX timer */
163#define SRTR_CNT_VAL 0x0fff0000 /* current value of RX timer */
164#define SRTR_CNT_VAL_SHIFT 16
165#define SRTR_HZ 16000 /* SRTR clock frequency */
166
167/* bitmasks for SIO_IR, SIO_IEC and SIO_IES */
168#define SIO_IR_SA_TX_MT 0x00000001 /* Serial port A TX empty */
169#define SIO_IR_SA_RX_FULL 0x00000002 /* port A RX buf full */
170#define SIO_IR_SA_RX_HIGH 0x00000004 /* port A RX hiwat */
171#define SIO_IR_SA_RX_TIMER 0x00000008 /* port A RX timeout */
172#define SIO_IR_SA_DELTA_DCD 0x00000010 /* port A delta DCD */
173#define SIO_IR_SA_DELTA_CTS 0x00000020 /* port A delta CTS */
174#define SIO_IR_SA_INT 0x00000040 /* port A pass-thru intr */
175#define SIO_IR_SA_TX_EXPLICIT 0x00000080 /* port A explicit TX thru */
176#define SIO_IR_SA_MEMERR 0x00000100 /* port A PCI error */
177#define SIO_IR_SB_TX_MT 0x00000200
178#define SIO_IR_SB_RX_FULL 0x00000400
179#define SIO_IR_SB_RX_HIGH 0x00000800
180#define SIO_IR_SB_RX_TIMER 0x00001000
181#define SIO_IR_SB_DELTA_DCD 0x00002000
182#define SIO_IR_SB_DELTA_CTS 0x00004000
183#define SIO_IR_SB_INT 0x00008000
184#define SIO_IR_SB_TX_EXPLICIT 0x00010000
185#define SIO_IR_SB_MEMERR 0x00020000
186#define SIO_IR_PP_INT 0x00040000 /* P port pass-thru intr */
187#define SIO_IR_PP_INTA 0x00080000 /* PP context A thru */
188#define SIO_IR_PP_INTB 0x00100000 /* PP context B thru */
189#define SIO_IR_PP_MEMERR 0x00200000 /* PP PCI error */
190#define SIO_IR_KBD_INT 0x00400000 /* kbd/mouse intr */
191#define SIO_IR_RT_INT 0x08000000 /* RT output pulse */
192#define SIO_IR_GEN_INT1 0x10000000 /* RT input pulse */
193#define SIO_IR_GEN_INT_SHIFT 28
194
195/* per device interrupt masks */
196#define SIO_IR_SA (SIO_IR_SA_TX_MT | \
197 SIO_IR_SA_RX_FULL | \
198 SIO_IR_SA_RX_HIGH | \
199 SIO_IR_SA_RX_TIMER | \
200 SIO_IR_SA_DELTA_DCD | \
201 SIO_IR_SA_DELTA_CTS | \
202 SIO_IR_SA_INT | \
203 SIO_IR_SA_TX_EXPLICIT | \
204 SIO_IR_SA_MEMERR)
205
206#define SIO_IR_SB (SIO_IR_SB_TX_MT | \
207 SIO_IR_SB_RX_FULL | \
208 SIO_IR_SB_RX_HIGH | \
209 SIO_IR_SB_RX_TIMER | \
210 SIO_IR_SB_DELTA_DCD | \
211 SIO_IR_SB_DELTA_CTS | \
212 SIO_IR_SB_INT | \
213 SIO_IR_SB_TX_EXPLICIT | \
214 SIO_IR_SB_MEMERR)
215
216#define SIO_IR_PP (SIO_IR_PP_INT | SIO_IR_PP_INTA | \
217 SIO_IR_PP_INTB | SIO_IR_PP_MEMERR)
218#define SIO_IR_RT (SIO_IR_RT_INT | SIO_IR_GEN_INT1)
219
220/* bitmasks for SIO_CR */
221#define SIO_CR_CMD_PULSE_SHIFT 15
222#define SIO_CR_SER_A_BASE_SHIFT 1
223#define SIO_CR_SER_B_BASE_SHIFT 8
224#define SIO_CR_ARB_DIAG 0x00380000 /* cur !enet PCI requet (ro) */
225#define SIO_CR_ARB_DIAG_TXA 0x00000000
226#define SIO_CR_ARB_DIAG_RXA 0x00080000
227#define SIO_CR_ARB_DIAG_TXB 0x00100000
228#define SIO_CR_ARB_DIAG_RXB 0x00180000
229#define SIO_CR_ARB_DIAG_PP 0x00200000
230#define SIO_CR_ARB_DIAG_IDLE 0x00400000 /* 0 -> active request (ro) */
231
232/* defs for some of the generic I/O pins */
233#define GPCR_PHY_RESET 0x20 /* pin is output to PHY reset */
234#define GPCR_UARTB_MODESEL 0x40 /* pin is output to port B mode sel */
235#define GPCR_UARTA_MODESEL 0x80 /* pin is output to port A mode sel */
236
237#define GPPR_PHY_RESET_PIN 5 /* GIO pin controlling phy reset */
238#define GPPR_UARTB_MODESEL_PIN 6 /* GIO pin cntrling uartb modeselect */
239#define GPPR_UARTA_MODESEL_PIN 7 /* GIO pin cntrling uarta modeselect */
240
241#endif /* IA64_SN_IOC3_H */
diff --git a/include/asm-ia64/sn/pcibr_provider.h b/include/asm-ia64/sn/pcibr_provider.h
index 2b42d9ece26b..9334078b089a 100644
--- a/include/asm-ia64/sn/pcibr_provider.h
+++ b/include/asm-ia64/sn/pcibr_provider.h
@@ -44,9 +44,9 @@
44#define PCI32_MAPPED_BASE 0x40000000 44#define PCI32_MAPPED_BASE 0x40000000
45#define PCI32_DIRECT_BASE 0x80000000 45#define PCI32_DIRECT_BASE 0x80000000
46 46
47#define IS_PCI32_MAPPED(x) ((uint64_t)(x) < PCI32_DIRECT_BASE && \ 47#define IS_PCI32_MAPPED(x) ((u64)(x) < PCI32_DIRECT_BASE && \
48 (uint64_t)(x) >= PCI32_MAPPED_BASE) 48 (u64)(x) >= PCI32_MAPPED_BASE)
49#define IS_PCI32_DIRECT(x) ((uint64_t)(x) >= PCI32_MAPPED_BASE) 49#define IS_PCI32_DIRECT(x) ((u64)(x) >= PCI32_MAPPED_BASE)
50 50
51 51
52/* 52/*
@@ -63,7 +63,7 @@
63 (IOPG(IOPGOFF(addr) + (size) - 1) == IOPG((size) - 1)) 63 (IOPG(IOPGOFF(addr) + (size) - 1) == IOPG((size) - 1))
64 64
65#define MINIMAL_ATE_FLAG(addr, size) \ 65#define MINIMAL_ATE_FLAG(addr, size) \
66 (MINIMAL_ATES_REQUIRED((uint64_t)addr, size) ? 1 : 0) 66 (MINIMAL_ATES_REQUIRED((u64)addr, size) ? 1 : 0)
67 67
68/* bit 29 of the pci address is the SWAP bit */ 68/* bit 29 of the pci address is the SWAP bit */
69#define ATE_SWAPSHIFT 29 69#define ATE_SWAPSHIFT 29
@@ -90,27 +90,27 @@
90 * PMU resources. 90 * PMU resources.
91 */ 91 */
92struct ate_resource{ 92struct ate_resource{
93 uint64_t *ate; 93 u64 *ate;
94 uint64_t num_ate; 94 u64 num_ate;
95 uint64_t lowest_free_index; 95 u64 lowest_free_index;
96}; 96};
97 97
98struct pcibus_info { 98struct pcibus_info {
99 struct pcibus_bussoft pbi_buscommon; /* common header */ 99 struct pcibus_bussoft pbi_buscommon; /* common header */
100 uint32_t pbi_moduleid; 100 u32 pbi_moduleid;
101 short pbi_bridge_type; 101 short pbi_bridge_type;
102 short pbi_bridge_mode; 102 short pbi_bridge_mode;
103 103
104 struct ate_resource pbi_int_ate_resource; 104 struct ate_resource pbi_int_ate_resource;
105 uint64_t pbi_int_ate_size; 105 u64 pbi_int_ate_size;
106 106
107 uint64_t pbi_dir_xbase; 107 u64 pbi_dir_xbase;
108 char pbi_hub_xid; 108 char pbi_hub_xid;
109 109
110 uint64_t pbi_devreg[8]; 110 u64 pbi_devreg[8];
111 111
112 uint32_t pbi_valid_devices; 112 u32 pbi_valid_devices;
113 uint32_t pbi_enabled_devices; 113 u32 pbi_enabled_devices;
114 114
115 spinlock_t pbi_lock; 115 spinlock_t pbi_lock;
116}; 116};
@@ -136,22 +136,22 @@ extern void pcibr_dma_unmap(struct pci_dev *, dma_addr_t, int);
136/* 136/*
137 * prototypes for the bridge asic register access routines in pcibr_reg.c 137 * prototypes for the bridge asic register access routines in pcibr_reg.c
138 */ 138 */
139extern void pcireg_control_bit_clr(struct pcibus_info *, uint64_t); 139extern void pcireg_control_bit_clr(struct pcibus_info *, u64);
140extern void pcireg_control_bit_set(struct pcibus_info *, uint64_t); 140extern void pcireg_control_bit_set(struct pcibus_info *, u64);
141extern uint64_t pcireg_tflush_get(struct pcibus_info *); 141extern u64 pcireg_tflush_get(struct pcibus_info *);
142extern uint64_t pcireg_intr_status_get(struct pcibus_info *); 142extern u64 pcireg_intr_status_get(struct pcibus_info *);
143extern void pcireg_intr_enable_bit_clr(struct pcibus_info *, uint64_t); 143extern void pcireg_intr_enable_bit_clr(struct pcibus_info *, u64);
144extern void pcireg_intr_enable_bit_set(struct pcibus_info *, uint64_t); 144extern void pcireg_intr_enable_bit_set(struct pcibus_info *, u64);
145extern void pcireg_intr_addr_addr_set(struct pcibus_info *, int, uint64_t); 145extern void pcireg_intr_addr_addr_set(struct pcibus_info *, int, u64);
146extern void pcireg_force_intr_set(struct pcibus_info *, int); 146extern void pcireg_force_intr_set(struct pcibus_info *, int);
147extern uint64_t pcireg_wrb_flush_get(struct pcibus_info *, int); 147extern u64 pcireg_wrb_flush_get(struct pcibus_info *, int);
148extern void pcireg_int_ate_set(struct pcibus_info *, int, uint64_t); 148extern void pcireg_int_ate_set(struct pcibus_info *, int, u64);
149extern uint64_t * pcireg_int_ate_addr(struct pcibus_info *, int); 149extern u64 * pcireg_int_ate_addr(struct pcibus_info *, int);
150extern void pcibr_force_interrupt(struct sn_irq_info *sn_irq_info); 150extern void pcibr_force_interrupt(struct sn_irq_info *sn_irq_info);
151extern void pcibr_change_devices_irq(struct sn_irq_info *sn_irq_info); 151extern void pcibr_change_devices_irq(struct sn_irq_info *sn_irq_info);
152extern int pcibr_ate_alloc(struct pcibus_info *, int); 152extern int pcibr_ate_alloc(struct pcibus_info *, int);
153extern void pcibr_ate_free(struct pcibus_info *, int); 153extern void pcibr_ate_free(struct pcibus_info *, int);
154extern void ate_write(struct pcibus_info *, int, int, uint64_t); 154extern void ate_write(struct pcibus_info *, int, int, u64);
155extern int sal_pcibr_slot_enable(struct pcibus_info *soft, int device, 155extern int sal_pcibr_slot_enable(struct pcibus_info *soft, int device,
156 void *resp); 156 void *resp);
157extern int sal_pcibr_slot_disable(struct pcibus_info *soft, int device, 157extern int sal_pcibr_slot_disable(struct pcibus_info *soft, int device,
diff --git a/include/asm-ia64/sn/pcibus_provider_defs.h b/include/asm-ia64/sn/pcibus_provider_defs.h
index ad0e8e8ae53f..ce3f6c328241 100644
--- a/include/asm-ia64/sn/pcibus_provider_defs.h
+++ b/include/asm-ia64/sn/pcibus_provider_defs.h
@@ -29,13 +29,13 @@
29 */ 29 */
30 30
31struct pcibus_bussoft { 31struct pcibus_bussoft {
32 uint32_t bs_asic_type; /* chipset type */ 32 u32 bs_asic_type; /* chipset type */
33 uint32_t bs_xid; /* xwidget id */ 33 u32 bs_xid; /* xwidget id */
34 uint32_t bs_persist_busnum; /* Persistent Bus Number */ 34 u32 bs_persist_busnum; /* Persistent Bus Number */
35 uint32_t bs_persist_segment; /* Segment Number */ 35 u32 bs_persist_segment; /* Segment Number */
36 uint64_t bs_legacy_io; /* legacy io pio addr */ 36 u64 bs_legacy_io; /* legacy io pio addr */
37 uint64_t bs_legacy_mem; /* legacy mem pio addr */ 37 u64 bs_legacy_mem; /* legacy mem pio addr */
38 uint64_t bs_base; /* widget base */ 38 u64 bs_base; /* widget base */
39 struct xwidget_info *bs_xwidget_info; 39 struct xwidget_info *bs_xwidget_info;
40}; 40};
41 41
diff --git a/include/asm-ia64/sn/pcidev.h b/include/asm-ia64/sn/pcidev.h
index f65d222ca5e8..38cdffbc4c7b 100644
--- a/include/asm-ia64/sn/pcidev.h
+++ b/include/asm-ia64/sn/pcidev.h
@@ -55,8 +55,8 @@ struct sn_pci_controller {
55#define PCIIO_VENDOR_ID_NONE (-1) 55#define PCIIO_VENDOR_ID_NONE (-1)
56 56
57struct pcidev_info { 57struct pcidev_info {
58 uint64_t pdi_pio_mapped_addr[7]; /* 6 BARs PLUS 1 ROM */ 58 u64 pdi_pio_mapped_addr[7]; /* 6 BARs PLUS 1 ROM */
59 uint64_t pdi_slot_host_handle; /* Bus and devfn Host pci_dev */ 59 u64 pdi_slot_host_handle; /* Bus and devfn Host pci_dev */
60 60
61 struct pcibus_bussoft *pdi_pcibus_info; /* Kernel common bus soft */ 61 struct pcibus_bussoft *pdi_pcibus_info; /* Kernel common bus soft */
62 struct pcidev_info *pdi_host_pcidev_info; /* Kernel Host pci_dev */ 62 struct pcidev_info *pdi_host_pcidev_info; /* Kernel Host pci_dev */
diff --git a/include/asm-ia64/sn/pic.h b/include/asm-ia64/sn/pic.h
index 0de82e6b0893..5f9da5fd6e56 100644
--- a/include/asm-ia64/sn/pic.h
+++ b/include/asm-ia64/sn/pic.h
@@ -74,120 +74,120 @@ struct pic {
74 /* 0x000000-0x00FFFF -- Local Registers */ 74 /* 0x000000-0x00FFFF -- Local Registers */
75 75
76 /* 0x000000-0x000057 -- Standard Widget Configuration */ 76 /* 0x000000-0x000057 -- Standard Widget Configuration */
77 uint64_t p_wid_id; /* 0x000000 */ 77 u64 p_wid_id; /* 0x000000 */
78 uint64_t p_wid_stat; /* 0x000008 */ 78 u64 p_wid_stat; /* 0x000008 */
79 uint64_t p_wid_err_upper; /* 0x000010 */ 79 u64 p_wid_err_upper; /* 0x000010 */
80 uint64_t p_wid_err_lower; /* 0x000018 */ 80 u64 p_wid_err_lower; /* 0x000018 */
81 #define p_wid_err p_wid_err_lower 81 #define p_wid_err p_wid_err_lower
82 uint64_t p_wid_control; /* 0x000020 */ 82 u64 p_wid_control; /* 0x000020 */
83 uint64_t p_wid_req_timeout; /* 0x000028 */ 83 u64 p_wid_req_timeout; /* 0x000028 */
84 uint64_t p_wid_int_upper; /* 0x000030 */ 84 u64 p_wid_int_upper; /* 0x000030 */
85 uint64_t p_wid_int_lower; /* 0x000038 */ 85 u64 p_wid_int_lower; /* 0x000038 */
86 #define p_wid_int p_wid_int_lower 86 #define p_wid_int p_wid_int_lower
87 uint64_t p_wid_err_cmdword; /* 0x000040 */ 87 u64 p_wid_err_cmdword; /* 0x000040 */
88 uint64_t p_wid_llp; /* 0x000048 */ 88 u64 p_wid_llp; /* 0x000048 */
89 uint64_t p_wid_tflush; /* 0x000050 */ 89 u64 p_wid_tflush; /* 0x000050 */
90 90
91 /* 0x000058-0x00007F -- Bridge-specific Widget Configuration */ 91 /* 0x000058-0x00007F -- Bridge-specific Widget Configuration */
92 uint64_t p_wid_aux_err; /* 0x000058 */ 92 u64 p_wid_aux_err; /* 0x000058 */
93 uint64_t p_wid_resp_upper; /* 0x000060 */ 93 u64 p_wid_resp_upper; /* 0x000060 */
94 uint64_t p_wid_resp_lower; /* 0x000068 */ 94 u64 p_wid_resp_lower; /* 0x000068 */
95 #define p_wid_resp p_wid_resp_lower 95 #define p_wid_resp p_wid_resp_lower
96 uint64_t p_wid_tst_pin_ctrl; /* 0x000070 */ 96 u64 p_wid_tst_pin_ctrl; /* 0x000070 */
97 uint64_t p_wid_addr_lkerr; /* 0x000078 */ 97 u64 p_wid_addr_lkerr; /* 0x000078 */
98 98
99 /* 0x000080-0x00008F -- PMU & MAP */ 99 /* 0x000080-0x00008F -- PMU & MAP */
100 uint64_t p_dir_map; /* 0x000080 */ 100 u64 p_dir_map; /* 0x000080 */
101 uint64_t _pad_000088; /* 0x000088 */ 101 u64 _pad_000088; /* 0x000088 */
102 102
103 /* 0x000090-0x00009F -- SSRAM */ 103 /* 0x000090-0x00009F -- SSRAM */
104 uint64_t p_map_fault; /* 0x000090 */ 104 u64 p_map_fault; /* 0x000090 */
105 uint64_t _pad_000098; /* 0x000098 */ 105 u64 _pad_000098; /* 0x000098 */
106 106
107 /* 0x0000A0-0x0000AF -- Arbitration */ 107 /* 0x0000A0-0x0000AF -- Arbitration */
108 uint64_t p_arb; /* 0x0000A0 */ 108 u64 p_arb; /* 0x0000A0 */
109 uint64_t _pad_0000A8; /* 0x0000A8 */ 109 u64 _pad_0000A8; /* 0x0000A8 */
110 110
111 /* 0x0000B0-0x0000BF -- Number In A Can or ATE Parity Error */ 111 /* 0x0000B0-0x0000BF -- Number In A Can or ATE Parity Error */
112 uint64_t p_ate_parity_err; /* 0x0000B0 */ 112 u64 p_ate_parity_err; /* 0x0000B0 */
113 uint64_t _pad_0000B8; /* 0x0000B8 */ 113 u64 _pad_0000B8; /* 0x0000B8 */
114 114
115 /* 0x0000C0-0x0000FF -- PCI/GIO */ 115 /* 0x0000C0-0x0000FF -- PCI/GIO */
116 uint64_t p_bus_timeout; /* 0x0000C0 */ 116 u64 p_bus_timeout; /* 0x0000C0 */
117 uint64_t p_pci_cfg; /* 0x0000C8 */ 117 u64 p_pci_cfg; /* 0x0000C8 */
118 uint64_t p_pci_err_upper; /* 0x0000D0 */ 118 u64 p_pci_err_upper; /* 0x0000D0 */
119 uint64_t p_pci_err_lower; /* 0x0000D8 */ 119 u64 p_pci_err_lower; /* 0x0000D8 */
120 #define p_pci_err p_pci_err_lower 120 #define p_pci_err p_pci_err_lower
121 uint64_t _pad_0000E0[4]; /* 0x0000{E0..F8} */ 121 u64 _pad_0000E0[4]; /* 0x0000{E0..F8} */
122 122
123 /* 0x000100-0x0001FF -- Interrupt */ 123 /* 0x000100-0x0001FF -- Interrupt */
124 uint64_t p_int_status; /* 0x000100 */ 124 u64 p_int_status; /* 0x000100 */
125 uint64_t p_int_enable; /* 0x000108 */ 125 u64 p_int_enable; /* 0x000108 */
126 uint64_t p_int_rst_stat; /* 0x000110 */ 126 u64 p_int_rst_stat; /* 0x000110 */
127 uint64_t p_int_mode; /* 0x000118 */ 127 u64 p_int_mode; /* 0x000118 */
128 uint64_t p_int_device; /* 0x000120 */ 128 u64 p_int_device; /* 0x000120 */
129 uint64_t p_int_host_err; /* 0x000128 */ 129 u64 p_int_host_err; /* 0x000128 */
130 uint64_t p_int_addr[8]; /* 0x0001{30,,,68} */ 130 u64 p_int_addr[8]; /* 0x0001{30,,,68} */
131 uint64_t p_err_int_view; /* 0x000170 */ 131 u64 p_err_int_view; /* 0x000170 */
132 uint64_t p_mult_int; /* 0x000178 */ 132 u64 p_mult_int; /* 0x000178 */
133 uint64_t p_force_always[8]; /* 0x0001{80,,,B8} */ 133 u64 p_force_always[8]; /* 0x0001{80,,,B8} */
134 uint64_t p_force_pin[8]; /* 0x0001{C0,,,F8} */ 134 u64 p_force_pin[8]; /* 0x0001{C0,,,F8} */
135 135
136 /* 0x000200-0x000298 -- Device */ 136 /* 0x000200-0x000298 -- Device */
137 uint64_t p_device[4]; /* 0x0002{00,,,18} */ 137 u64 p_device[4]; /* 0x0002{00,,,18} */
138 uint64_t _pad_000220[4]; /* 0x0002{20,,,38} */ 138 u64 _pad_000220[4]; /* 0x0002{20,,,38} */
139 uint64_t p_wr_req_buf[4]; /* 0x0002{40,,,58} */ 139 u64 p_wr_req_buf[4]; /* 0x0002{40,,,58} */
140 uint64_t _pad_000260[4]; /* 0x0002{60,,,78} */ 140 u64 _pad_000260[4]; /* 0x0002{60,,,78} */
141 uint64_t p_rrb_map[2]; /* 0x0002{80,,,88} */ 141 u64 p_rrb_map[2]; /* 0x0002{80,,,88} */
142 #define p_even_resp p_rrb_map[0] /* 0x000280 */ 142 #define p_even_resp p_rrb_map[0] /* 0x000280 */
143 #define p_odd_resp p_rrb_map[1] /* 0x000288 */ 143 #define p_odd_resp p_rrb_map[1] /* 0x000288 */
144 uint64_t p_resp_status; /* 0x000290 */ 144 u64 p_resp_status; /* 0x000290 */
145 uint64_t p_resp_clear; /* 0x000298 */ 145 u64 p_resp_clear; /* 0x000298 */
146 146
147 uint64_t _pad_0002A0[12]; /* 0x0002{A0..F8} */ 147 u64 _pad_0002A0[12]; /* 0x0002{A0..F8} */
148 148
149 /* 0x000300-0x0003F8 -- Buffer Address Match Registers */ 149 /* 0x000300-0x0003F8 -- Buffer Address Match Registers */
150 struct { 150 struct {
151 uint64_t upper; /* 0x0003{00,,,F0} */ 151 u64 upper; /* 0x0003{00,,,F0} */
152 uint64_t lower; /* 0x0003{08,,,F8} */ 152 u64 lower; /* 0x0003{08,,,F8} */
153 } p_buf_addr_match[16]; 153 } p_buf_addr_match[16];
154 154
155 /* 0x000400-0x0005FF -- Performance Monitor Registers (even only) */ 155 /* 0x000400-0x0005FF -- Performance Monitor Registers (even only) */
156 struct { 156 struct {
157 uint64_t flush_w_touch; /* 0x000{400,,,5C0} */ 157 u64 flush_w_touch; /* 0x000{400,,,5C0} */
158 uint64_t flush_wo_touch; /* 0x000{408,,,5C8} */ 158 u64 flush_wo_touch; /* 0x000{408,,,5C8} */
159 uint64_t inflight; /* 0x000{410,,,5D0} */ 159 u64 inflight; /* 0x000{410,,,5D0} */
160 uint64_t prefetch; /* 0x000{418,,,5D8} */ 160 u64 prefetch; /* 0x000{418,,,5D8} */
161 uint64_t total_pci_retry; /* 0x000{420,,,5E0} */ 161 u64 total_pci_retry; /* 0x000{420,,,5E0} */
162 uint64_t max_pci_retry; /* 0x000{428,,,5E8} */ 162 u64 max_pci_retry; /* 0x000{428,,,5E8} */
163 uint64_t max_latency; /* 0x000{430,,,5F0} */ 163 u64 max_latency; /* 0x000{430,,,5F0} */
164 uint64_t clear_all; /* 0x000{438,,,5F8} */ 164 u64 clear_all; /* 0x000{438,,,5F8} */
165 } p_buf_count[8]; 165 } p_buf_count[8];
166 166
167 167
168 /* 0x000600-0x0009FF -- PCI/X registers */ 168 /* 0x000600-0x0009FF -- PCI/X registers */
169 uint64_t p_pcix_bus_err_addr; /* 0x000600 */ 169 u64 p_pcix_bus_err_addr; /* 0x000600 */
170 uint64_t p_pcix_bus_err_attr; /* 0x000608 */ 170 u64 p_pcix_bus_err_attr; /* 0x000608 */
171 uint64_t p_pcix_bus_err_data; /* 0x000610 */ 171 u64 p_pcix_bus_err_data; /* 0x000610 */
172 uint64_t p_pcix_pio_split_addr; /* 0x000618 */ 172 u64 p_pcix_pio_split_addr; /* 0x000618 */
173 uint64_t p_pcix_pio_split_attr; /* 0x000620 */ 173 u64 p_pcix_pio_split_attr; /* 0x000620 */
174 uint64_t p_pcix_dma_req_err_attr; /* 0x000628 */ 174 u64 p_pcix_dma_req_err_attr; /* 0x000628 */
175 uint64_t p_pcix_dma_req_err_addr; /* 0x000630 */ 175 u64 p_pcix_dma_req_err_addr; /* 0x000630 */
176 uint64_t p_pcix_timeout; /* 0x000638 */ 176 u64 p_pcix_timeout; /* 0x000638 */
177 177
178 uint64_t _pad_000640[120]; /* 0x000{640,,,9F8} */ 178 u64 _pad_000640[120]; /* 0x000{640,,,9F8} */
179 179
180 /* 0x000A00-0x000BFF -- PCI/X Read&Write Buffer */ 180 /* 0x000A00-0x000BFF -- PCI/X Read&Write Buffer */
181 struct { 181 struct {
182 uint64_t p_buf_addr; /* 0x000{A00,,,AF0} */ 182 u64 p_buf_addr; /* 0x000{A00,,,AF0} */
183 uint64_t p_buf_attr; /* 0X000{A08,,,AF8} */ 183 u64 p_buf_attr; /* 0X000{A08,,,AF8} */
184 } p_pcix_read_buf_64[16]; 184 } p_pcix_read_buf_64[16];
185 185
186 struct { 186 struct {
187 uint64_t p_buf_addr; /* 0x000{B00,,,BE0} */ 187 u64 p_buf_addr; /* 0x000{B00,,,BE0} */
188 uint64_t p_buf_attr; /* 0x000{B08,,,BE8} */ 188 u64 p_buf_attr; /* 0x000{B08,,,BE8} */
189 uint64_t p_buf_valid; /* 0x000{B10,,,BF0} */ 189 u64 p_buf_valid; /* 0x000{B10,,,BF0} */
190 uint64_t __pad1; /* 0x000{B18,,,BF8} */ 190 u64 __pad1; /* 0x000{B18,,,BF8} */
191 } p_pcix_write_buf_64[8]; 191 } p_pcix_write_buf_64[8];
192 192
193 /* End of Local Registers -- Start of Address Map space */ 193 /* End of Local Registers -- Start of Address Map space */
@@ -195,45 +195,45 @@ struct pic {
195 char _pad_000c00[0x010000 - 0x000c00]; 195 char _pad_000c00[0x010000 - 0x000c00];
196 196
197 /* 0x010000-0x011fff -- Internal ATE RAM (Auto Parity Generation) */ 197 /* 0x010000-0x011fff -- Internal ATE RAM (Auto Parity Generation) */
198 uint64_t p_int_ate_ram[1024]; /* 0x010000-0x011fff */ 198 u64 p_int_ate_ram[1024]; /* 0x010000-0x011fff */
199 199
200 /* 0x012000-0x013fff -- Internal ATE RAM (Manual Parity Generation) */ 200 /* 0x012000-0x013fff -- Internal ATE RAM (Manual Parity Generation) */
201 uint64_t p_int_ate_ram_mp[1024]; /* 0x012000-0x013fff */ 201 u64 p_int_ate_ram_mp[1024]; /* 0x012000-0x013fff */
202 202
203 char _pad_014000[0x18000 - 0x014000]; 203 char _pad_014000[0x18000 - 0x014000];
204 204
205 /* 0x18000-0x197F8 -- PIC Write Request Ram */ 205 /* 0x18000-0x197F8 -- PIC Write Request Ram */
206 uint64_t p_wr_req_lower[256]; /* 0x18000 - 0x187F8 */ 206 u64 p_wr_req_lower[256]; /* 0x18000 - 0x187F8 */
207 uint64_t p_wr_req_upper[256]; /* 0x18800 - 0x18FF8 */ 207 u64 p_wr_req_upper[256]; /* 0x18800 - 0x18FF8 */
208 uint64_t p_wr_req_parity[256]; /* 0x19000 - 0x197F8 */ 208 u64 p_wr_req_parity[256]; /* 0x19000 - 0x197F8 */
209 209
210 char _pad_019800[0x20000 - 0x019800]; 210 char _pad_019800[0x20000 - 0x019800];
211 211
212 /* 0x020000-0x027FFF -- PCI Device Configuration Spaces */ 212 /* 0x020000-0x027FFF -- PCI Device Configuration Spaces */
213 union { 213 union {
214 uint8_t c[0x1000 / 1]; /* 0x02{0000,,,7FFF} */ 214 u8 c[0x1000 / 1]; /* 0x02{0000,,,7FFF} */
215 uint16_t s[0x1000 / 2]; /* 0x02{0000,,,7FFF} */ 215 u16 s[0x1000 / 2]; /* 0x02{0000,,,7FFF} */
216 uint32_t l[0x1000 / 4]; /* 0x02{0000,,,7FFF} */ 216 u32 l[0x1000 / 4]; /* 0x02{0000,,,7FFF} */
217 uint64_t d[0x1000 / 8]; /* 0x02{0000,,,7FFF} */ 217 u64 d[0x1000 / 8]; /* 0x02{0000,,,7FFF} */
218 union { 218 union {
219 uint8_t c[0x100 / 1]; 219 u8 c[0x100 / 1];
220 uint16_t s[0x100 / 2]; 220 u16 s[0x100 / 2];
221 uint32_t l[0x100 / 4]; 221 u32 l[0x100 / 4];
222 uint64_t d[0x100 / 8]; 222 u64 d[0x100 / 8];
223 } f[8]; 223 } f[8];
224 } p_type0_cfg_dev[8]; /* 0x02{0000,,,7FFF} */ 224 } p_type0_cfg_dev[8]; /* 0x02{0000,,,7FFF} */
225 225
226 /* 0x028000-0x028FFF -- PCI Type 1 Configuration Space */ 226 /* 0x028000-0x028FFF -- PCI Type 1 Configuration Space */
227 union { 227 union {
228 uint8_t c[0x1000 / 1]; /* 0x028000-0x029000 */ 228 u8 c[0x1000 / 1]; /* 0x028000-0x029000 */
229 uint16_t s[0x1000 / 2]; /* 0x028000-0x029000 */ 229 u16 s[0x1000 / 2]; /* 0x028000-0x029000 */
230 uint32_t l[0x1000 / 4]; /* 0x028000-0x029000 */ 230 u32 l[0x1000 / 4]; /* 0x028000-0x029000 */
231 uint64_t d[0x1000 / 8]; /* 0x028000-0x029000 */ 231 u64 d[0x1000 / 8]; /* 0x028000-0x029000 */
232 union { 232 union {
233 uint8_t c[0x100 / 1]; 233 u8 c[0x100 / 1];
234 uint16_t s[0x100 / 2]; 234 u16 s[0x100 / 2];
235 uint32_t l[0x100 / 4]; 235 u32 l[0x100 / 4];
236 uint64_t d[0x100 / 8]; 236 u64 d[0x100 / 8];
237 } f[8]; 237 } f[8];
238 } p_type1_cfg; /* 0x028000-0x029000 */ 238 } p_type1_cfg; /* 0x028000-0x029000 */
239 239
@@ -241,20 +241,20 @@ struct pic {
241 241
242 /* 0x030000-0x030007 -- PCI Interrupt Acknowledge Cycle */ 242 /* 0x030000-0x030007 -- PCI Interrupt Acknowledge Cycle */
243 union { 243 union {
244 uint8_t c[8 / 1]; 244 u8 c[8 / 1];
245 uint16_t s[8 / 2]; 245 u16 s[8 / 2];
246 uint32_t l[8 / 4]; 246 u32 l[8 / 4];
247 uint64_t d[8 / 8]; 247 u64 d[8 / 8];
248 } p_pci_iack; /* 0x030000-0x030007 */ 248 } p_pci_iack; /* 0x030000-0x030007 */
249 249
250 char _pad_030007[0x040000-0x030008]; 250 char _pad_030007[0x040000-0x030008];
251 251
252 /* 0x040000-0x030007 -- PCIX Special Cycle */ 252 /* 0x040000-0x030007 -- PCIX Special Cycle */
253 union { 253 union {
254 uint8_t c[8 / 1]; 254 u8 c[8 / 1];
255 uint16_t s[8 / 2]; 255 u16 s[8 / 2];
256 uint32_t l[8 / 4]; 256 u32 l[8 / 4];
257 uint64_t d[8 / 8]; 257 u64 d[8 / 8];
258 } p_pcix_cycle; /* 0x040000-0x040007 */ 258 } p_pcix_cycle; /* 0x040000-0x040007 */
259}; 259};
260 260
diff --git a/include/asm-ia64/sn/shubio.h b/include/asm-ia64/sn/shubio.h
index 831b72111fdc..22a6f18a5313 100644
--- a/include/asm-ia64/sn/shubio.h
+++ b/include/asm-ia64/sn/shubio.h
@@ -227,13 +227,13 @@
227 ************************************************************************/ 227 ************************************************************************/
228 228
229typedef union ii_wid_u { 229typedef union ii_wid_u {
230 uint64_t ii_wid_regval; 230 u64 ii_wid_regval;
231 struct { 231 struct {
232 uint64_t w_rsvd_1:1; 232 u64 w_rsvd_1:1;
233 uint64_t w_mfg_num:11; 233 u64 w_mfg_num:11;
234 uint64_t w_part_num:16; 234 u64 w_part_num:16;
235 uint64_t w_rev_num:4; 235 u64 w_rev_num:4;
236 uint64_t w_rsvd:32; 236 u64 w_rsvd:32;
237 } ii_wid_fld_s; 237 } ii_wid_fld_s;
238} ii_wid_u_t; 238} ii_wid_u_t;
239 239
@@ -246,18 +246,18 @@ typedef union ii_wid_u {
246 ************************************************************************/ 246 ************************************************************************/
247 247
248typedef union ii_wstat_u { 248typedef union ii_wstat_u {
249 uint64_t ii_wstat_regval; 249 u64 ii_wstat_regval;
250 struct { 250 struct {
251 uint64_t w_pending:4; 251 u64 w_pending:4;
252 uint64_t w_xt_crd_to:1; 252 u64 w_xt_crd_to:1;
253 uint64_t w_xt_tail_to:1; 253 u64 w_xt_tail_to:1;
254 uint64_t w_rsvd_3:3; 254 u64 w_rsvd_3:3;
255 uint64_t w_tx_mx_rty:1; 255 u64 w_tx_mx_rty:1;
256 uint64_t w_rsvd_2:6; 256 u64 w_rsvd_2:6;
257 uint64_t w_llp_tx_cnt:8; 257 u64 w_llp_tx_cnt:8;
258 uint64_t w_rsvd_1:8; 258 u64 w_rsvd_1:8;
259 uint64_t w_crazy:1; 259 u64 w_crazy:1;
260 uint64_t w_rsvd:31; 260 u64 w_rsvd:31;
261 } ii_wstat_fld_s; 261 } ii_wstat_fld_s;
262} ii_wstat_u_t; 262} ii_wstat_u_t;
263 263
@@ -269,16 +269,16 @@ typedef union ii_wstat_u {
269 ************************************************************************/ 269 ************************************************************************/
270 270
271typedef union ii_wcr_u { 271typedef union ii_wcr_u {
272 uint64_t ii_wcr_regval; 272 u64 ii_wcr_regval;
273 struct { 273 struct {
274 uint64_t w_wid:4; 274 u64 w_wid:4;
275 uint64_t w_tag:1; 275 u64 w_tag:1;
276 uint64_t w_rsvd_1:8; 276 u64 w_rsvd_1:8;
277 uint64_t w_dst_crd:3; 277 u64 w_dst_crd:3;
278 uint64_t w_f_bad_pkt:1; 278 u64 w_f_bad_pkt:1;
279 uint64_t w_dir_con:1; 279 u64 w_dir_con:1;
280 uint64_t w_e_thresh:5; 280 u64 w_e_thresh:5;
281 uint64_t w_rsvd:41; 281 u64 w_rsvd:41;
282 } ii_wcr_fld_s; 282 } ii_wcr_fld_s;
283} ii_wcr_u_t; 283} ii_wcr_u_t;
284 284
@@ -310,9 +310,9 @@ typedef union ii_wcr_u {
310 ************************************************************************/ 310 ************************************************************************/
311 311
312typedef union ii_ilapr_u { 312typedef union ii_ilapr_u {
313 uint64_t ii_ilapr_regval; 313 u64 ii_ilapr_regval;
314 struct { 314 struct {
315 uint64_t i_region:64; 315 u64 i_region:64;
316 } ii_ilapr_fld_s; 316 } ii_ilapr_fld_s;
317} ii_ilapr_u_t; 317} ii_ilapr_u_t;
318 318
@@ -330,9 +330,9 @@ typedef union ii_ilapr_u {
330 ************************************************************************/ 330 ************************************************************************/
331 331
332typedef union ii_ilapo_u { 332typedef union ii_ilapo_u {
333 uint64_t ii_ilapo_regval; 333 u64 ii_ilapo_regval;
334 struct { 334 struct {
335 uint64_t i_io_ovrride:64; 335 u64 i_io_ovrride:64;
336 } ii_ilapo_fld_s; 336 } ii_ilapo_fld_s;
337} ii_ilapo_u_t; 337} ii_ilapo_u_t;
338 338
@@ -344,12 +344,12 @@ typedef union ii_ilapo_u {
344 ************************************************************************/ 344 ************************************************************************/
345 345
346typedef union ii_iowa_u { 346typedef union ii_iowa_u {
347 uint64_t ii_iowa_regval; 347 u64 ii_iowa_regval;
348 struct { 348 struct {
349 uint64_t i_w0_oac:1; 349 u64 i_w0_oac:1;
350 uint64_t i_rsvd_1:7; 350 u64 i_rsvd_1:7;
351 uint64_t i_wx_oac:8; 351 u64 i_wx_oac:8;
352 uint64_t i_rsvd:48; 352 u64 i_rsvd:48;
353 } ii_iowa_fld_s; 353 } ii_iowa_fld_s;
354} ii_iowa_u_t; 354} ii_iowa_u_t;
355 355
@@ -363,12 +363,12 @@ typedef union ii_iowa_u {
363 ************************************************************************/ 363 ************************************************************************/
364 364
365typedef union ii_iiwa_u { 365typedef union ii_iiwa_u {
366 uint64_t ii_iiwa_regval; 366 u64 ii_iiwa_regval;
367 struct { 367 struct {
368 uint64_t i_w0_iac:1; 368 u64 i_w0_iac:1;
369 uint64_t i_rsvd_1:7; 369 u64 i_rsvd_1:7;
370 uint64_t i_wx_iac:8; 370 u64 i_wx_iac:8;
371 uint64_t i_rsvd:48; 371 u64 i_rsvd:48;
372 } ii_iiwa_fld_s; 372 } ii_iiwa_fld_s;
373} ii_iiwa_u_t; 373} ii_iiwa_u_t;
374 374
@@ -392,16 +392,16 @@ typedef union ii_iiwa_u {
392 ************************************************************************/ 392 ************************************************************************/
393 393
394typedef union ii_iidem_u { 394typedef union ii_iidem_u {
395 uint64_t ii_iidem_regval; 395 u64 ii_iidem_regval;
396 struct { 396 struct {
397 uint64_t i_w8_dxs:8; 397 u64 i_w8_dxs:8;
398 uint64_t i_w9_dxs:8; 398 u64 i_w9_dxs:8;
399 uint64_t i_wa_dxs:8; 399 u64 i_wa_dxs:8;
400 uint64_t i_wb_dxs:8; 400 u64 i_wb_dxs:8;
401 uint64_t i_wc_dxs:8; 401 u64 i_wc_dxs:8;
402 uint64_t i_wd_dxs:8; 402 u64 i_wd_dxs:8;
403 uint64_t i_we_dxs:8; 403 u64 i_we_dxs:8;
404 uint64_t i_wf_dxs:8; 404 u64 i_wf_dxs:8;
405 } ii_iidem_fld_s; 405 } ii_iidem_fld_s;
406} ii_iidem_u_t; 406} ii_iidem_u_t;
407 407
@@ -413,22 +413,22 @@ typedef union ii_iidem_u {
413 ************************************************************************/ 413 ************************************************************************/
414 414
415typedef union ii_ilcsr_u { 415typedef union ii_ilcsr_u {
416 uint64_t ii_ilcsr_regval; 416 u64 ii_ilcsr_regval;
417 struct { 417 struct {
418 uint64_t i_nullto:6; 418 u64 i_nullto:6;
419 uint64_t i_rsvd_4:2; 419 u64 i_rsvd_4:2;
420 uint64_t i_wrmrst:1; 420 u64 i_wrmrst:1;
421 uint64_t i_rsvd_3:1; 421 u64 i_rsvd_3:1;
422 uint64_t i_llp_en:1; 422 u64 i_llp_en:1;
423 uint64_t i_bm8:1; 423 u64 i_bm8:1;
424 uint64_t i_llp_stat:2; 424 u64 i_llp_stat:2;
425 uint64_t i_remote_power:1; 425 u64 i_remote_power:1;
426 uint64_t i_rsvd_2:1; 426 u64 i_rsvd_2:1;
427 uint64_t i_maxrtry:10; 427 u64 i_maxrtry:10;
428 uint64_t i_d_avail_sel:2; 428 u64 i_d_avail_sel:2;
429 uint64_t i_rsvd_1:4; 429 u64 i_rsvd_1:4;
430 uint64_t i_maxbrst:10; 430 u64 i_maxbrst:10;
431 uint64_t i_rsvd:22; 431 u64 i_rsvd:22;
432 432
433 } ii_ilcsr_fld_s; 433 } ii_ilcsr_fld_s;
434} ii_ilcsr_u_t; 434} ii_ilcsr_u_t;
@@ -441,11 +441,11 @@ typedef union ii_ilcsr_u {
441 ************************************************************************/ 441 ************************************************************************/
442 442
443typedef union ii_illr_u { 443typedef union ii_illr_u {
444 uint64_t ii_illr_regval; 444 u64 ii_illr_regval;
445 struct { 445 struct {
446 uint64_t i_sn_cnt:16; 446 u64 i_sn_cnt:16;
447 uint64_t i_cb_cnt:16; 447 u64 i_cb_cnt:16;
448 uint64_t i_rsvd:32; 448 u64 i_rsvd:32;
449 } ii_illr_fld_s; 449 } ii_illr_fld_s;
450} ii_illr_u_t; 450} ii_illr_u_t;
451 451
@@ -464,19 +464,19 @@ typedef union ii_illr_u {
464 ************************************************************************/ 464 ************************************************************************/
465 465
466typedef union ii_iidsr_u { 466typedef union ii_iidsr_u {
467 uint64_t ii_iidsr_regval; 467 u64 ii_iidsr_regval;
468 struct { 468 struct {
469 uint64_t i_level:8; 469 u64 i_level:8;
470 uint64_t i_pi_id:1; 470 u64 i_pi_id:1;
471 uint64_t i_node:11; 471 u64 i_node:11;
472 uint64_t i_rsvd_3:4; 472 u64 i_rsvd_3:4;
473 uint64_t i_enable:1; 473 u64 i_enable:1;
474 uint64_t i_rsvd_2:3; 474 u64 i_rsvd_2:3;
475 uint64_t i_int_sent:2; 475 u64 i_int_sent:2;
476 uint64_t i_rsvd_1:2; 476 u64 i_rsvd_1:2;
477 uint64_t i_pi0_forward_int:1; 477 u64 i_pi0_forward_int:1;
478 uint64_t i_pi1_forward_int:1; 478 u64 i_pi1_forward_int:1;
479 uint64_t i_rsvd:30; 479 u64 i_rsvd:30;
480 } ii_iidsr_fld_s; 480 } ii_iidsr_fld_s;
481} ii_iidsr_u_t; 481} ii_iidsr_u_t;
482 482
@@ -492,13 +492,13 @@ typedef union ii_iidsr_u {
492 ************************************************************************/ 492 ************************************************************************/
493 493
494typedef union ii_igfx0_u { 494typedef union ii_igfx0_u {
495 uint64_t ii_igfx0_regval; 495 u64 ii_igfx0_regval;
496 struct { 496 struct {
497 uint64_t i_w_num:4; 497 u64 i_w_num:4;
498 uint64_t i_pi_id:1; 498 u64 i_pi_id:1;
499 uint64_t i_n_num:12; 499 u64 i_n_num:12;
500 uint64_t i_p_num:1; 500 u64 i_p_num:1;
501 uint64_t i_rsvd:46; 501 u64 i_rsvd:46;
502 } ii_igfx0_fld_s; 502 } ii_igfx0_fld_s;
503} ii_igfx0_u_t; 503} ii_igfx0_u_t;
504 504
@@ -514,13 +514,13 @@ typedef union ii_igfx0_u {
514 ************************************************************************/ 514 ************************************************************************/
515 515
516typedef union ii_igfx1_u { 516typedef union ii_igfx1_u {
517 uint64_t ii_igfx1_regval; 517 u64 ii_igfx1_regval;
518 struct { 518 struct {
519 uint64_t i_w_num:4; 519 u64 i_w_num:4;
520 uint64_t i_pi_id:1; 520 u64 i_pi_id:1;
521 uint64_t i_n_num:12; 521 u64 i_n_num:12;
522 uint64_t i_p_num:1; 522 u64 i_p_num:1;
523 uint64_t i_rsvd:46; 523 u64 i_rsvd:46;
524 } ii_igfx1_fld_s; 524 } ii_igfx1_fld_s;
525} ii_igfx1_u_t; 525} ii_igfx1_u_t;
526 526
@@ -532,9 +532,9 @@ typedef union ii_igfx1_u {
532 ************************************************************************/ 532 ************************************************************************/
533 533
534typedef union ii_iscr0_u { 534typedef union ii_iscr0_u {
535 uint64_t ii_iscr0_regval; 535 u64 ii_iscr0_regval;
536 struct { 536 struct {
537 uint64_t i_scratch:64; 537 u64 i_scratch:64;
538 } ii_iscr0_fld_s; 538 } ii_iscr0_fld_s;
539} ii_iscr0_u_t; 539} ii_iscr0_u_t;
540 540
@@ -546,9 +546,9 @@ typedef union ii_iscr0_u {
546 ************************************************************************/ 546 ************************************************************************/
547 547
548typedef union ii_iscr1_u { 548typedef union ii_iscr1_u {
549 uint64_t ii_iscr1_regval; 549 u64 ii_iscr1_regval;
550 struct { 550 struct {
551 uint64_t i_scratch:64; 551 u64 i_scratch:64;
552 } ii_iscr1_fld_s; 552 } ii_iscr1_fld_s;
553} ii_iscr1_u_t; 553} ii_iscr1_u_t;
554 554
@@ -580,13 +580,13 @@ typedef union ii_iscr1_u {
580 ************************************************************************/ 580 ************************************************************************/
581 581
582typedef union ii_itte1_u { 582typedef union ii_itte1_u {
583 uint64_t ii_itte1_regval; 583 u64 ii_itte1_regval;
584 struct { 584 struct {
585 uint64_t i_offset:5; 585 u64 i_offset:5;
586 uint64_t i_rsvd_1:3; 586 u64 i_rsvd_1:3;
587 uint64_t i_w_num:4; 587 u64 i_w_num:4;
588 uint64_t i_iosp:1; 588 u64 i_iosp:1;
589 uint64_t i_rsvd:51; 589 u64 i_rsvd:51;
590 } ii_itte1_fld_s; 590 } ii_itte1_fld_s;
591} ii_itte1_u_t; 591} ii_itte1_u_t;
592 592
@@ -618,13 +618,13 @@ typedef union ii_itte1_u {
618 ************************************************************************/ 618 ************************************************************************/
619 619
620typedef union ii_itte2_u { 620typedef union ii_itte2_u {
621 uint64_t ii_itte2_regval; 621 u64 ii_itte2_regval;
622 struct { 622 struct {
623 uint64_t i_offset:5; 623 u64 i_offset:5;
624 uint64_t i_rsvd_1:3; 624 u64 i_rsvd_1:3;
625 uint64_t i_w_num:4; 625 u64 i_w_num:4;
626 uint64_t i_iosp:1; 626 u64 i_iosp:1;
627 uint64_t i_rsvd:51; 627 u64 i_rsvd:51;
628 } ii_itte2_fld_s; 628 } ii_itte2_fld_s;
629} ii_itte2_u_t; 629} ii_itte2_u_t;
630 630
@@ -656,13 +656,13 @@ typedef union ii_itte2_u {
656 ************************************************************************/ 656 ************************************************************************/
657 657
658typedef union ii_itte3_u { 658typedef union ii_itte3_u {
659 uint64_t ii_itte3_regval; 659 u64 ii_itte3_regval;
660 struct { 660 struct {
661 uint64_t i_offset:5; 661 u64 i_offset:5;
662 uint64_t i_rsvd_1:3; 662 u64 i_rsvd_1:3;
663 uint64_t i_w_num:4; 663 u64 i_w_num:4;
664 uint64_t i_iosp:1; 664 u64 i_iosp:1;
665 uint64_t i_rsvd:51; 665 u64 i_rsvd:51;
666 } ii_itte3_fld_s; 666 } ii_itte3_fld_s;
667} ii_itte3_u_t; 667} ii_itte3_u_t;
668 668
@@ -694,13 +694,13 @@ typedef union ii_itte3_u {
694 ************************************************************************/ 694 ************************************************************************/
695 695
696typedef union ii_itte4_u { 696typedef union ii_itte4_u {
697 uint64_t ii_itte4_regval; 697 u64 ii_itte4_regval;
698 struct { 698 struct {
699 uint64_t i_offset:5; 699 u64 i_offset:5;
700 uint64_t i_rsvd_1:3; 700 u64 i_rsvd_1:3;
701 uint64_t i_w_num:4; 701 u64 i_w_num:4;
702 uint64_t i_iosp:1; 702 u64 i_iosp:1;
703 uint64_t i_rsvd:51; 703 u64 i_rsvd:51;
704 } ii_itte4_fld_s; 704 } ii_itte4_fld_s;
705} ii_itte4_u_t; 705} ii_itte4_u_t;
706 706
@@ -732,13 +732,13 @@ typedef union ii_itte4_u {
732 ************************************************************************/ 732 ************************************************************************/
733 733
734typedef union ii_itte5_u { 734typedef union ii_itte5_u {
735 uint64_t ii_itte5_regval; 735 u64 ii_itte5_regval;
736 struct { 736 struct {
737 uint64_t i_offset:5; 737 u64 i_offset:5;
738 uint64_t i_rsvd_1:3; 738 u64 i_rsvd_1:3;
739 uint64_t i_w_num:4; 739 u64 i_w_num:4;
740 uint64_t i_iosp:1; 740 u64 i_iosp:1;
741 uint64_t i_rsvd:51; 741 u64 i_rsvd:51;
742 } ii_itte5_fld_s; 742 } ii_itte5_fld_s;
743} ii_itte5_u_t; 743} ii_itte5_u_t;
744 744
@@ -770,13 +770,13 @@ typedef union ii_itte5_u {
770 ************************************************************************/ 770 ************************************************************************/
771 771
772typedef union ii_itte6_u { 772typedef union ii_itte6_u {
773 uint64_t ii_itte6_regval; 773 u64 ii_itte6_regval;
774 struct { 774 struct {
775 uint64_t i_offset:5; 775 u64 i_offset:5;
776 uint64_t i_rsvd_1:3; 776 u64 i_rsvd_1:3;
777 uint64_t i_w_num:4; 777 u64 i_w_num:4;
778 uint64_t i_iosp:1; 778 u64 i_iosp:1;
779 uint64_t i_rsvd:51; 779 u64 i_rsvd:51;
780 } ii_itte6_fld_s; 780 } ii_itte6_fld_s;
781} ii_itte6_u_t; 781} ii_itte6_u_t;
782 782
@@ -808,13 +808,13 @@ typedef union ii_itte6_u {
808 ************************************************************************/ 808 ************************************************************************/
809 809
810typedef union ii_itte7_u { 810typedef union ii_itte7_u {
811 uint64_t ii_itte7_regval; 811 u64 ii_itte7_regval;
812 struct { 812 struct {
813 uint64_t i_offset:5; 813 u64 i_offset:5;
814 uint64_t i_rsvd_1:3; 814 u64 i_rsvd_1:3;
815 uint64_t i_w_num:4; 815 u64 i_w_num:4;
816 uint64_t i_iosp:1; 816 u64 i_iosp:1;
817 uint64_t i_rsvd:51; 817 u64 i_rsvd:51;
818 } ii_itte7_fld_s; 818 } ii_itte7_fld_s;
819} ii_itte7_u_t; 819} ii_itte7_u_t;
820 820
@@ -843,22 +843,22 @@ typedef union ii_itte7_u {
843 ************************************************************************/ 843 ************************************************************************/
844 844
845typedef union ii_iprb0_u { 845typedef union ii_iprb0_u {
846 uint64_t ii_iprb0_regval; 846 u64 ii_iprb0_regval;
847 struct { 847 struct {
848 uint64_t i_c:8; 848 u64 i_c:8;
849 uint64_t i_na:14; 849 u64 i_na:14;
850 uint64_t i_rsvd_2:2; 850 u64 i_rsvd_2:2;
851 uint64_t i_nb:14; 851 u64 i_nb:14;
852 uint64_t i_rsvd_1:2; 852 u64 i_rsvd_1:2;
853 uint64_t i_m:2; 853 u64 i_m:2;
854 uint64_t i_f:1; 854 u64 i_f:1;
855 uint64_t i_of_cnt:5; 855 u64 i_of_cnt:5;
856 uint64_t i_error:1; 856 u64 i_error:1;
857 uint64_t i_rd_to:1; 857 u64 i_rd_to:1;
858 uint64_t i_spur_wr:1; 858 u64 i_spur_wr:1;
859 uint64_t i_spur_rd:1; 859 u64 i_spur_rd:1;
860 uint64_t i_rsvd:11; 860 u64 i_rsvd:11;
861 uint64_t i_mult_err:1; 861 u64 i_mult_err:1;
862 } ii_iprb0_fld_s; 862 } ii_iprb0_fld_s;
863} ii_iprb0_u_t; 863} ii_iprb0_u_t;
864 864
@@ -887,22 +887,22 @@ typedef union ii_iprb0_u {
887 ************************************************************************/ 887 ************************************************************************/
888 888
889typedef union ii_iprb8_u { 889typedef union ii_iprb8_u {
890 uint64_t ii_iprb8_regval; 890 u64 ii_iprb8_regval;
891 struct { 891 struct {
892 uint64_t i_c:8; 892 u64 i_c:8;
893 uint64_t i_na:14; 893 u64 i_na:14;
894 uint64_t i_rsvd_2:2; 894 u64 i_rsvd_2:2;
895 uint64_t i_nb:14; 895 u64 i_nb:14;
896 uint64_t i_rsvd_1:2; 896 u64 i_rsvd_1:2;
897 uint64_t i_m:2; 897 u64 i_m:2;
898 uint64_t i_f:1; 898 u64 i_f:1;
899 uint64_t i_of_cnt:5; 899 u64 i_of_cnt:5;
900 uint64_t i_error:1; 900 u64 i_error:1;
901 uint64_t i_rd_to:1; 901 u64 i_rd_to:1;
902 uint64_t i_spur_wr:1; 902 u64 i_spur_wr:1;
903 uint64_t i_spur_rd:1; 903 u64 i_spur_rd:1;
904 uint64_t i_rsvd:11; 904 u64 i_rsvd:11;
905 uint64_t i_mult_err:1; 905 u64 i_mult_err:1;
906 } ii_iprb8_fld_s; 906 } ii_iprb8_fld_s;
907} ii_iprb8_u_t; 907} ii_iprb8_u_t;
908 908
@@ -931,22 +931,22 @@ typedef union ii_iprb8_u {
931 ************************************************************************/ 931 ************************************************************************/
932 932
933typedef union ii_iprb9_u { 933typedef union ii_iprb9_u {
934 uint64_t ii_iprb9_regval; 934 u64 ii_iprb9_regval;
935 struct { 935 struct {
936 uint64_t i_c:8; 936 u64 i_c:8;
937 uint64_t i_na:14; 937 u64 i_na:14;
938 uint64_t i_rsvd_2:2; 938 u64 i_rsvd_2:2;
939 uint64_t i_nb:14; 939 u64 i_nb:14;
940 uint64_t i_rsvd_1:2; 940 u64 i_rsvd_1:2;
941 uint64_t i_m:2; 941 u64 i_m:2;
942 uint64_t i_f:1; 942 u64 i_f:1;
943 uint64_t i_of_cnt:5; 943 u64 i_of_cnt:5;
944 uint64_t i_error:1; 944 u64 i_error:1;
945 uint64_t i_rd_to:1; 945 u64 i_rd_to:1;
946 uint64_t i_spur_wr:1; 946 u64 i_spur_wr:1;
947 uint64_t i_spur_rd:1; 947 u64 i_spur_rd:1;
948 uint64_t i_rsvd:11; 948 u64 i_rsvd:11;
949 uint64_t i_mult_err:1; 949 u64 i_mult_err:1;
950 } ii_iprb9_fld_s; 950 } ii_iprb9_fld_s;
951} ii_iprb9_u_t; 951} ii_iprb9_u_t;
952 952
@@ -975,22 +975,22 @@ typedef union ii_iprb9_u {
975 ************************************************************************/ 975 ************************************************************************/
976 976
977typedef union ii_iprba_u { 977typedef union ii_iprba_u {
978 uint64_t ii_iprba_regval; 978 u64 ii_iprba_regval;
979 struct { 979 struct {
980 uint64_t i_c:8; 980 u64 i_c:8;
981 uint64_t i_na:14; 981 u64 i_na:14;
982 uint64_t i_rsvd_2:2; 982 u64 i_rsvd_2:2;
983 uint64_t i_nb:14; 983 u64 i_nb:14;
984 uint64_t i_rsvd_1:2; 984 u64 i_rsvd_1:2;
985 uint64_t i_m:2; 985 u64 i_m:2;
986 uint64_t i_f:1; 986 u64 i_f:1;
987 uint64_t i_of_cnt:5; 987 u64 i_of_cnt:5;
988 uint64_t i_error:1; 988 u64 i_error:1;
989 uint64_t i_rd_to:1; 989 u64 i_rd_to:1;
990 uint64_t i_spur_wr:1; 990 u64 i_spur_wr:1;
991 uint64_t i_spur_rd:1; 991 u64 i_spur_rd:1;
992 uint64_t i_rsvd:11; 992 u64 i_rsvd:11;
993 uint64_t i_mult_err:1; 993 u64 i_mult_err:1;
994 } ii_iprba_fld_s; 994 } ii_iprba_fld_s;
995} ii_iprba_u_t; 995} ii_iprba_u_t;
996 996
@@ -1019,22 +1019,22 @@ typedef union ii_iprba_u {
1019 ************************************************************************/ 1019 ************************************************************************/
1020 1020
1021typedef union ii_iprbb_u { 1021typedef union ii_iprbb_u {
1022 uint64_t ii_iprbb_regval; 1022 u64 ii_iprbb_regval;
1023 struct { 1023 struct {
1024 uint64_t i_c:8; 1024 u64 i_c:8;
1025 uint64_t i_na:14; 1025 u64 i_na:14;
1026 uint64_t i_rsvd_2:2; 1026 u64 i_rsvd_2:2;
1027 uint64_t i_nb:14; 1027 u64 i_nb:14;
1028 uint64_t i_rsvd_1:2; 1028 u64 i_rsvd_1:2;
1029 uint64_t i_m:2; 1029 u64 i_m:2;
1030 uint64_t i_f:1; 1030 u64 i_f:1;
1031 uint64_t i_of_cnt:5; 1031 u64 i_of_cnt:5;
1032 uint64_t i_error:1; 1032 u64 i_error:1;
1033 uint64_t i_rd_to:1; 1033 u64 i_rd_to:1;
1034 uint64_t i_spur_wr:1; 1034 u64 i_spur_wr:1;
1035 uint64_t i_spur_rd:1; 1035 u64 i_spur_rd:1;
1036 uint64_t i_rsvd:11; 1036 u64 i_rsvd:11;
1037 uint64_t i_mult_err:1; 1037 u64 i_mult_err:1;
1038 } ii_iprbb_fld_s; 1038 } ii_iprbb_fld_s;
1039} ii_iprbb_u_t; 1039} ii_iprbb_u_t;
1040 1040
@@ -1063,22 +1063,22 @@ typedef union ii_iprbb_u {
1063 ************************************************************************/ 1063 ************************************************************************/
1064 1064
1065typedef union ii_iprbc_u { 1065typedef union ii_iprbc_u {
1066 uint64_t ii_iprbc_regval; 1066 u64 ii_iprbc_regval;
1067 struct { 1067 struct {
1068 uint64_t i_c:8; 1068 u64 i_c:8;
1069 uint64_t i_na:14; 1069 u64 i_na:14;
1070 uint64_t i_rsvd_2:2; 1070 u64 i_rsvd_2:2;
1071 uint64_t i_nb:14; 1071 u64 i_nb:14;
1072 uint64_t i_rsvd_1:2; 1072 u64 i_rsvd_1:2;
1073 uint64_t i_m:2; 1073 u64 i_m:2;
1074 uint64_t i_f:1; 1074 u64 i_f:1;
1075 uint64_t i_of_cnt:5; 1075 u64 i_of_cnt:5;
1076 uint64_t i_error:1; 1076 u64 i_error:1;
1077 uint64_t i_rd_to:1; 1077 u64 i_rd_to:1;
1078 uint64_t i_spur_wr:1; 1078 u64 i_spur_wr:1;
1079 uint64_t i_spur_rd:1; 1079 u64 i_spur_rd:1;
1080 uint64_t i_rsvd:11; 1080 u64 i_rsvd:11;
1081 uint64_t i_mult_err:1; 1081 u64 i_mult_err:1;
1082 } ii_iprbc_fld_s; 1082 } ii_iprbc_fld_s;
1083} ii_iprbc_u_t; 1083} ii_iprbc_u_t;
1084 1084
@@ -1107,22 +1107,22 @@ typedef union ii_iprbc_u {
1107 ************************************************************************/ 1107 ************************************************************************/
1108 1108
1109typedef union ii_iprbd_u { 1109typedef union ii_iprbd_u {
1110 uint64_t ii_iprbd_regval; 1110 u64 ii_iprbd_regval;
1111 struct { 1111 struct {
1112 uint64_t i_c:8; 1112 u64 i_c:8;
1113 uint64_t i_na:14; 1113 u64 i_na:14;
1114 uint64_t i_rsvd_2:2; 1114 u64 i_rsvd_2:2;
1115 uint64_t i_nb:14; 1115 u64 i_nb:14;
1116 uint64_t i_rsvd_1:2; 1116 u64 i_rsvd_1:2;
1117 uint64_t i_m:2; 1117 u64 i_m:2;
1118 uint64_t i_f:1; 1118 u64 i_f:1;
1119 uint64_t i_of_cnt:5; 1119 u64 i_of_cnt:5;
1120 uint64_t i_error:1; 1120 u64 i_error:1;
1121 uint64_t i_rd_to:1; 1121 u64 i_rd_to:1;
1122 uint64_t i_spur_wr:1; 1122 u64 i_spur_wr:1;
1123 uint64_t i_spur_rd:1; 1123 u64 i_spur_rd:1;
1124 uint64_t i_rsvd:11; 1124 u64 i_rsvd:11;
1125 uint64_t i_mult_err:1; 1125 u64 i_mult_err:1;
1126 } ii_iprbd_fld_s; 1126 } ii_iprbd_fld_s;
1127} ii_iprbd_u_t; 1127} ii_iprbd_u_t;
1128 1128
@@ -1151,22 +1151,22 @@ typedef union ii_iprbd_u {
1151 ************************************************************************/ 1151 ************************************************************************/
1152 1152
1153typedef union ii_iprbe_u { 1153typedef union ii_iprbe_u {
1154 uint64_t ii_iprbe_regval; 1154 u64 ii_iprbe_regval;
1155 struct { 1155 struct {
1156 uint64_t i_c:8; 1156 u64 i_c:8;
1157 uint64_t i_na:14; 1157 u64 i_na:14;
1158 uint64_t i_rsvd_2:2; 1158 u64 i_rsvd_2:2;
1159 uint64_t i_nb:14; 1159 u64 i_nb:14;
1160 uint64_t i_rsvd_1:2; 1160 u64 i_rsvd_1:2;
1161 uint64_t i_m:2; 1161 u64 i_m:2;
1162 uint64_t i_f:1; 1162 u64 i_f:1;
1163 uint64_t i_of_cnt:5; 1163 u64 i_of_cnt:5;
1164 uint64_t i_error:1; 1164 u64 i_error:1;
1165 uint64_t i_rd_to:1; 1165 u64 i_rd_to:1;
1166 uint64_t i_spur_wr:1; 1166 u64 i_spur_wr:1;
1167 uint64_t i_spur_rd:1; 1167 u64 i_spur_rd:1;
1168 uint64_t i_rsvd:11; 1168 u64 i_rsvd:11;
1169 uint64_t i_mult_err:1; 1169 u64 i_mult_err:1;
1170 } ii_iprbe_fld_s; 1170 } ii_iprbe_fld_s;
1171} ii_iprbe_u_t; 1171} ii_iprbe_u_t;
1172 1172
@@ -1195,22 +1195,22 @@ typedef union ii_iprbe_u {
1195 ************************************************************************/ 1195 ************************************************************************/
1196 1196
1197typedef union ii_iprbf_u { 1197typedef union ii_iprbf_u {
1198 uint64_t ii_iprbf_regval; 1198 u64 ii_iprbf_regval;
1199 struct { 1199 struct {
1200 uint64_t i_c:8; 1200 u64 i_c:8;
1201 uint64_t i_na:14; 1201 u64 i_na:14;
1202 uint64_t i_rsvd_2:2; 1202 u64 i_rsvd_2:2;
1203 uint64_t i_nb:14; 1203 u64 i_nb:14;
1204 uint64_t i_rsvd_1:2; 1204 u64 i_rsvd_1:2;
1205 uint64_t i_m:2; 1205 u64 i_m:2;
1206 uint64_t i_f:1; 1206 u64 i_f:1;
1207 uint64_t i_of_cnt:5; 1207 u64 i_of_cnt:5;
1208 uint64_t i_error:1; 1208 u64 i_error:1;
1209 uint64_t i_rd_to:1; 1209 u64 i_rd_to:1;
1210 uint64_t i_spur_wr:1; 1210 u64 i_spur_wr:1;
1211 uint64_t i_spur_rd:1; 1211 u64 i_spur_rd:1;
1212 uint64_t i_rsvd:11; 1212 u64 i_rsvd:11;
1213 uint64_t i_mult_err:1; 1213 u64 i_mult_err:1;
1214 } ii_iprbe_fld_s; 1214 } ii_iprbe_fld_s;
1215} ii_iprbf_u_t; 1215} ii_iprbf_u_t;
1216 1216
@@ -1232,10 +1232,10 @@ typedef union ii_iprbf_u {
1232 ************************************************************************/ 1232 ************************************************************************/
1233 1233
1234typedef union ii_ixcc_u { 1234typedef union ii_ixcc_u {
1235 uint64_t ii_ixcc_regval; 1235 u64 ii_ixcc_regval;
1236 struct { 1236 struct {
1237 uint64_t i_time_out:26; 1237 u64 i_time_out:26;
1238 uint64_t i_rsvd:38; 1238 u64 i_rsvd:38;
1239 } ii_ixcc_fld_s; 1239 } ii_ixcc_fld_s;
1240} ii_ixcc_u_t; 1240} ii_ixcc_u_t;
1241 1241
@@ -1256,16 +1256,16 @@ typedef union ii_ixcc_u {
1256 ************************************************************************/ 1256 ************************************************************************/
1257 1257
1258typedef union ii_imem_u { 1258typedef union ii_imem_u {
1259 uint64_t ii_imem_regval; 1259 u64 ii_imem_regval;
1260 struct { 1260 struct {
1261 uint64_t i_w0_esd:1; 1261 u64 i_w0_esd:1;
1262 uint64_t i_rsvd_3:3; 1262 u64 i_rsvd_3:3;
1263 uint64_t i_b0_esd:1; 1263 u64 i_b0_esd:1;
1264 uint64_t i_rsvd_2:3; 1264 u64 i_rsvd_2:3;
1265 uint64_t i_b1_esd:1; 1265 u64 i_b1_esd:1;
1266 uint64_t i_rsvd_1:3; 1266 u64 i_rsvd_1:3;
1267 uint64_t i_clr_precise:1; 1267 u64 i_clr_precise:1;
1268 uint64_t i_rsvd:51; 1268 u64 i_rsvd:51;
1269 } ii_imem_fld_s; 1269 } ii_imem_fld_s;
1270} ii_imem_u_t; 1270} ii_imem_u_t;
1271 1271
@@ -1294,13 +1294,13 @@ typedef union ii_imem_u {
1294 ************************************************************************/ 1294 ************************************************************************/
1295 1295
1296typedef union ii_ixtt_u { 1296typedef union ii_ixtt_u {
1297 uint64_t ii_ixtt_regval; 1297 u64 ii_ixtt_regval;
1298 struct { 1298 struct {
1299 uint64_t i_tail_to:26; 1299 u64 i_tail_to:26;
1300 uint64_t i_rsvd_1:6; 1300 u64 i_rsvd_1:6;
1301 uint64_t i_rrsp_ps:23; 1301 u64 i_rrsp_ps:23;
1302 uint64_t i_rrsp_to:5; 1302 u64 i_rrsp_to:5;
1303 uint64_t i_rsvd:4; 1303 u64 i_rsvd:4;
1304 } ii_ixtt_fld_s; 1304 } ii_ixtt_fld_s;
1305} ii_ixtt_u_t; 1305} ii_ixtt_u_t;
1306 1306
@@ -1316,37 +1316,37 @@ typedef union ii_ixtt_u {
1316 ************************************************************************/ 1316 ************************************************************************/
1317 1317
1318typedef union ii_ieclr_u { 1318typedef union ii_ieclr_u {
1319 uint64_t ii_ieclr_regval; 1319 u64 ii_ieclr_regval;
1320 struct { 1320 struct {
1321 uint64_t i_e_prb_0:1; 1321 u64 i_e_prb_0:1;
1322 uint64_t i_rsvd:7; 1322 u64 i_rsvd:7;
1323 uint64_t i_e_prb_8:1; 1323 u64 i_e_prb_8:1;
1324 uint64_t i_e_prb_9:1; 1324 u64 i_e_prb_9:1;
1325 uint64_t i_e_prb_a:1; 1325 u64 i_e_prb_a:1;
1326 uint64_t i_e_prb_b:1; 1326 u64 i_e_prb_b:1;
1327 uint64_t i_e_prb_c:1; 1327 u64 i_e_prb_c:1;
1328 uint64_t i_e_prb_d:1; 1328 u64 i_e_prb_d:1;
1329 uint64_t i_e_prb_e:1; 1329 u64 i_e_prb_e:1;
1330 uint64_t i_e_prb_f:1; 1330 u64 i_e_prb_f:1;
1331 uint64_t i_e_crazy:1; 1331 u64 i_e_crazy:1;
1332 uint64_t i_e_bte_0:1; 1332 u64 i_e_bte_0:1;
1333 uint64_t i_e_bte_1:1; 1333 u64 i_e_bte_1:1;
1334 uint64_t i_reserved_1:10; 1334 u64 i_reserved_1:10;
1335 uint64_t i_spur_rd_hdr:1; 1335 u64 i_spur_rd_hdr:1;
1336 uint64_t i_cam_intr_to:1; 1336 u64 i_cam_intr_to:1;
1337 uint64_t i_cam_overflow:1; 1337 u64 i_cam_overflow:1;
1338 uint64_t i_cam_read_miss:1; 1338 u64 i_cam_read_miss:1;
1339 uint64_t i_ioq_rep_underflow:1; 1339 u64 i_ioq_rep_underflow:1;
1340 uint64_t i_ioq_req_underflow:1; 1340 u64 i_ioq_req_underflow:1;
1341 uint64_t i_ioq_rep_overflow:1; 1341 u64 i_ioq_rep_overflow:1;
1342 uint64_t i_ioq_req_overflow:1; 1342 u64 i_ioq_req_overflow:1;
1343 uint64_t i_iiq_rep_overflow:1; 1343 u64 i_iiq_rep_overflow:1;
1344 uint64_t i_iiq_req_overflow:1; 1344 u64 i_iiq_req_overflow:1;
1345 uint64_t i_ii_xn_rep_cred_overflow:1; 1345 u64 i_ii_xn_rep_cred_overflow:1;
1346 uint64_t i_ii_xn_req_cred_overflow:1; 1346 u64 i_ii_xn_req_cred_overflow:1;
1347 uint64_t i_ii_xn_invalid_cmd:1; 1347 u64 i_ii_xn_invalid_cmd:1;
1348 uint64_t i_xn_ii_invalid_cmd:1; 1348 u64 i_xn_ii_invalid_cmd:1;
1349 uint64_t i_reserved_2:21; 1349 u64 i_reserved_2:21;
1350 } ii_ieclr_fld_s; 1350 } ii_ieclr_fld_s;
1351} ii_ieclr_u_t; 1351} ii_ieclr_u_t;
1352 1352
@@ -1360,12 +1360,12 @@ typedef union ii_ieclr_u {
1360 ************************************************************************/ 1360 ************************************************************************/
1361 1361
1362typedef union ii_ibcr_u { 1362typedef union ii_ibcr_u {
1363 uint64_t ii_ibcr_regval; 1363 u64 ii_ibcr_regval;
1364 struct { 1364 struct {
1365 uint64_t i_count:4; 1365 u64 i_count:4;
1366 uint64_t i_rsvd_1:4; 1366 u64 i_rsvd_1:4;
1367 uint64_t i_soft_reset:1; 1367 u64 i_soft_reset:1;
1368 uint64_t i_rsvd:55; 1368 u64 i_rsvd:55;
1369 } ii_ibcr_fld_s; 1369 } ii_ibcr_fld_s;
1370} ii_ibcr_u_t; 1370} ii_ibcr_u_t;
1371 1371
@@ -1399,22 +1399,22 @@ typedef union ii_ibcr_u {
1399 ************************************************************************/ 1399 ************************************************************************/
1400 1400
1401typedef union ii_ixsm_u { 1401typedef union ii_ixsm_u {
1402 uint64_t ii_ixsm_regval; 1402 u64 ii_ixsm_regval;
1403 struct { 1403 struct {
1404 uint64_t i_byte_en:32; 1404 u64 i_byte_en:32;
1405 uint64_t i_reserved:1; 1405 u64 i_reserved:1;
1406 uint64_t i_tag:3; 1406 u64 i_tag:3;
1407 uint64_t i_alt_pactyp:4; 1407 u64 i_alt_pactyp:4;
1408 uint64_t i_bo:1; 1408 u64 i_bo:1;
1409 uint64_t i_error:1; 1409 u64 i_error:1;
1410 uint64_t i_vbpm:1; 1410 u64 i_vbpm:1;
1411 uint64_t i_gbr:1; 1411 u64 i_gbr:1;
1412 uint64_t i_ds:2; 1412 u64 i_ds:2;
1413 uint64_t i_ct:1; 1413 u64 i_ct:1;
1414 uint64_t i_tnum:5; 1414 u64 i_tnum:5;
1415 uint64_t i_pactyp:4; 1415 u64 i_pactyp:4;
1416 uint64_t i_sidn:4; 1416 u64 i_sidn:4;
1417 uint64_t i_didn:4; 1417 u64 i_didn:4;
1418 } ii_ixsm_fld_s; 1418 } ii_ixsm_fld_s;
1419} ii_ixsm_u_t; 1419} ii_ixsm_u_t;
1420 1420
@@ -1426,11 +1426,11 @@ typedef union ii_ixsm_u {
1426 ************************************************************************/ 1426 ************************************************************************/
1427 1427
1428typedef union ii_ixss_u { 1428typedef union ii_ixss_u {
1429 uint64_t ii_ixss_regval; 1429 u64 ii_ixss_regval;
1430 struct { 1430 struct {
1431 uint64_t i_sideband:8; 1431 u64 i_sideband:8;
1432 uint64_t i_rsvd:55; 1432 u64 i_rsvd:55;
1433 uint64_t i_valid:1; 1433 u64 i_valid:1;
1434 } ii_ixss_fld_s; 1434 } ii_ixss_fld_s;
1435} ii_ixss_u_t; 1435} ii_ixss_u_t;
1436 1436
@@ -1447,17 +1447,17 @@ typedef union ii_ixss_u {
1447 ************************************************************************/ 1447 ************************************************************************/
1448 1448
1449typedef union ii_ilct_u { 1449typedef union ii_ilct_u {
1450 uint64_t ii_ilct_regval; 1450 u64 ii_ilct_regval;
1451 struct { 1451 struct {
1452 uint64_t i_test_seed:20; 1452 u64 i_test_seed:20;
1453 uint64_t i_test_mask:8; 1453 u64 i_test_mask:8;
1454 uint64_t i_test_data:20; 1454 u64 i_test_data:20;
1455 uint64_t i_test_valid:1; 1455 u64 i_test_valid:1;
1456 uint64_t i_test_cberr:1; 1456 u64 i_test_cberr:1;
1457 uint64_t i_test_flit:3; 1457 u64 i_test_flit:3;
1458 uint64_t i_test_clear:1; 1458 u64 i_test_clear:1;
1459 uint64_t i_test_err_capture:1; 1459 u64 i_test_err_capture:1;
1460 uint64_t i_rsvd:9; 1460 u64 i_rsvd:9;
1461 } ii_ilct_fld_s; 1461 } ii_ilct_fld_s;
1462} ii_ilct_u_t; 1462} ii_ilct_u_t;
1463 1463
@@ -1482,20 +1482,20 @@ typedef union ii_ilct_u {
1482 ************************************************************************/ 1482 ************************************************************************/
1483 1483
1484typedef union ii_iieph1_u { 1484typedef union ii_iieph1_u {
1485 uint64_t ii_iieph1_regval; 1485 u64 ii_iieph1_regval;
1486 struct { 1486 struct {
1487 uint64_t i_command:7; 1487 u64 i_command:7;
1488 uint64_t i_rsvd_5:1; 1488 u64 i_rsvd_5:1;
1489 uint64_t i_suppl:14; 1489 u64 i_suppl:14;
1490 uint64_t i_rsvd_4:1; 1490 u64 i_rsvd_4:1;
1491 uint64_t i_source:14; 1491 u64 i_source:14;
1492 uint64_t i_rsvd_3:1; 1492 u64 i_rsvd_3:1;
1493 uint64_t i_err_type:4; 1493 u64 i_err_type:4;
1494 uint64_t i_rsvd_2:4; 1494 u64 i_rsvd_2:4;
1495 uint64_t i_overrun:1; 1495 u64 i_overrun:1;
1496 uint64_t i_rsvd_1:3; 1496 u64 i_rsvd_1:3;
1497 uint64_t i_valid:1; 1497 u64 i_valid:1;
1498 uint64_t i_rsvd:13; 1498 u64 i_rsvd:13;
1499 } ii_iieph1_fld_s; 1499 } ii_iieph1_fld_s;
1500} ii_iieph1_u_t; 1500} ii_iieph1_u_t;
1501 1501
@@ -1511,13 +1511,13 @@ typedef union ii_iieph1_u {
1511 ************************************************************************/ 1511 ************************************************************************/
1512 1512
1513typedef union ii_iieph2_u { 1513typedef union ii_iieph2_u {
1514 uint64_t ii_iieph2_regval; 1514 u64 ii_iieph2_regval;
1515 struct { 1515 struct {
1516 uint64_t i_rsvd_0:3; 1516 u64 i_rsvd_0:3;
1517 uint64_t i_address:47; 1517 u64 i_address:47;
1518 uint64_t i_rsvd_1:10; 1518 u64 i_rsvd_1:10;
1519 uint64_t i_tail:1; 1519 u64 i_tail:1;
1520 uint64_t i_rsvd:3; 1520 u64 i_rsvd:3;
1521 } ii_iieph2_fld_s; 1521 } ii_iieph2_fld_s;
1522} ii_iieph2_u_t; 1522} ii_iieph2_u_t;
1523 1523
@@ -1532,9 +1532,9 @@ typedef union ii_iieph2_u {
1532 ************************************************************************/ 1532 ************************************************************************/
1533 1533
1534typedef union ii_islapr_u { 1534typedef union ii_islapr_u {
1535 uint64_t ii_islapr_regval; 1535 u64 ii_islapr_regval;
1536 struct { 1536 struct {
1537 uint64_t i_region:64; 1537 u64 i_region:64;
1538 } ii_islapr_fld_s; 1538 } ii_islapr_fld_s;
1539} ii_islapr_u_t; 1539} ii_islapr_u_t;
1540 1540
@@ -1547,10 +1547,10 @@ typedef union ii_islapr_u {
1547 ************************************************************************/ 1547 ************************************************************************/
1548 1548
1549typedef union ii_islapo_u { 1549typedef union ii_islapo_u {
1550 uint64_t ii_islapo_regval; 1550 u64 ii_islapo_regval;
1551 struct { 1551 struct {
1552 uint64_t i_io_sbx_ovrride:56; 1552 u64 i_io_sbx_ovrride:56;
1553 uint64_t i_rsvd:8; 1553 u64 i_rsvd:8;
1554 } ii_islapo_fld_s; 1554 } ii_islapo_fld_s;
1555} ii_islapo_u_t; 1555} ii_islapo_u_t;
1556 1556
@@ -1563,14 +1563,14 @@ typedef union ii_islapo_u {
1563 ************************************************************************/ 1563 ************************************************************************/
1564 1564
1565typedef union ii_iwi_u { 1565typedef union ii_iwi_u {
1566 uint64_t ii_iwi_regval; 1566 u64 ii_iwi_regval;
1567 struct { 1567 struct {
1568 uint64_t i_prescale:24; 1568 u64 i_prescale:24;
1569 uint64_t i_rsvd:8; 1569 u64 i_rsvd:8;
1570 uint64_t i_timeout:8; 1570 u64 i_timeout:8;
1571 uint64_t i_rsvd1:8; 1571 u64 i_rsvd1:8;
1572 uint64_t i_intrpt_retry_period:8; 1572 u64 i_intrpt_retry_period:8;
1573 uint64_t i_rsvd2:8; 1573 u64 i_rsvd2:8;
1574 } ii_iwi_fld_s; 1574 } ii_iwi_fld_s;
1575} ii_iwi_u_t; 1575} ii_iwi_u_t;
1576 1576
@@ -1582,26 +1582,26 @@ typedef union ii_iwi_u {
1582 ************************************************************************/ 1582 ************************************************************************/
1583 1583
1584typedef union ii_iwel_u { 1584typedef union ii_iwel_u {
1585 uint64_t ii_iwel_regval; 1585 u64 ii_iwel_regval;
1586 struct { 1586 struct {
1587 uint64_t i_intr_timed_out:1; 1587 u64 i_intr_timed_out:1;
1588 uint64_t i_rsvd:7; 1588 u64 i_rsvd:7;
1589 uint64_t i_cam_overflow:1; 1589 u64 i_cam_overflow:1;
1590 uint64_t i_cam_read_miss:1; 1590 u64 i_cam_read_miss:1;
1591 uint64_t i_rsvd1:2; 1591 u64 i_rsvd1:2;
1592 uint64_t i_ioq_rep_underflow:1; 1592 u64 i_ioq_rep_underflow:1;
1593 uint64_t i_ioq_req_underflow:1; 1593 u64 i_ioq_req_underflow:1;
1594 uint64_t i_ioq_rep_overflow:1; 1594 u64 i_ioq_rep_overflow:1;
1595 uint64_t i_ioq_req_overflow:1; 1595 u64 i_ioq_req_overflow:1;
1596 uint64_t i_iiq_rep_overflow:1; 1596 u64 i_iiq_rep_overflow:1;
1597 uint64_t i_iiq_req_overflow:1; 1597 u64 i_iiq_req_overflow:1;
1598 uint64_t i_rsvd2:6; 1598 u64 i_rsvd2:6;
1599 uint64_t i_ii_xn_rep_cred_over_under:1; 1599 u64 i_ii_xn_rep_cred_over_under:1;
1600 uint64_t i_ii_xn_req_cred_over_under:1; 1600 u64 i_ii_xn_req_cred_over_under:1;
1601 uint64_t i_rsvd3:6; 1601 u64 i_rsvd3:6;
1602 uint64_t i_ii_xn_invalid_cmd:1; 1602 u64 i_ii_xn_invalid_cmd:1;
1603 uint64_t i_xn_ii_invalid_cmd:1; 1603 u64 i_xn_ii_invalid_cmd:1;
1604 uint64_t i_rsvd4:30; 1604 u64 i_rsvd4:30;
1605 } ii_iwel_fld_s; 1605 } ii_iwel_fld_s;
1606} ii_iwel_u_t; 1606} ii_iwel_u_t;
1607 1607
@@ -1612,22 +1612,22 @@ typedef union ii_iwel_u {
1612 ************************************************************************/ 1612 ************************************************************************/
1613 1613
1614typedef union ii_iwc_u { 1614typedef union ii_iwc_u {
1615 uint64_t ii_iwc_regval; 1615 u64 ii_iwc_regval;
1616 struct { 1616 struct {
1617 uint64_t i_dma_byte_swap:1; 1617 u64 i_dma_byte_swap:1;
1618 uint64_t i_rsvd:3; 1618 u64 i_rsvd:3;
1619 uint64_t i_cam_read_lines_reset:1; 1619 u64 i_cam_read_lines_reset:1;
1620 uint64_t i_rsvd1:3; 1620 u64 i_rsvd1:3;
1621 uint64_t i_ii_xn_cred_over_under_log:1; 1621 u64 i_ii_xn_cred_over_under_log:1;
1622 uint64_t i_rsvd2:19; 1622 u64 i_rsvd2:19;
1623 uint64_t i_xn_rep_iq_depth:5; 1623 u64 i_xn_rep_iq_depth:5;
1624 uint64_t i_rsvd3:3; 1624 u64 i_rsvd3:3;
1625 uint64_t i_xn_req_iq_depth:5; 1625 u64 i_xn_req_iq_depth:5;
1626 uint64_t i_rsvd4:3; 1626 u64 i_rsvd4:3;
1627 uint64_t i_iiq_depth:6; 1627 u64 i_iiq_depth:6;
1628 uint64_t i_rsvd5:12; 1628 u64 i_rsvd5:12;
1629 uint64_t i_force_rep_cred:1; 1629 u64 i_force_rep_cred:1;
1630 uint64_t i_force_req_cred:1; 1630 u64 i_force_req_cred:1;
1631 } ii_iwc_fld_s; 1631 } ii_iwc_fld_s;
1632} ii_iwc_u_t; 1632} ii_iwc_u_t;
1633 1633
@@ -1638,12 +1638,12 @@ typedef union ii_iwc_u {
1638 ************************************************************************/ 1638 ************************************************************************/
1639 1639
1640typedef union ii_iws_u { 1640typedef union ii_iws_u {
1641 uint64_t ii_iws_regval; 1641 u64 ii_iws_regval;
1642 struct { 1642 struct {
1643 uint64_t i_xn_rep_iq_credits:5; 1643 u64 i_xn_rep_iq_credits:5;
1644 uint64_t i_rsvd:3; 1644 u64 i_rsvd:3;
1645 uint64_t i_xn_req_iq_credits:5; 1645 u64 i_xn_req_iq_credits:5;
1646 uint64_t i_rsvd1:51; 1646 u64 i_rsvd1:51;
1647 } ii_iws_fld_s; 1647 } ii_iws_fld_s;
1648} ii_iws_u_t; 1648} ii_iws_u_t;
1649 1649
@@ -1654,26 +1654,26 @@ typedef union ii_iws_u {
1654 ************************************************************************/ 1654 ************************************************************************/
1655 1655
1656typedef union ii_iweim_u { 1656typedef union ii_iweim_u {
1657 uint64_t ii_iweim_regval; 1657 u64 ii_iweim_regval;
1658 struct { 1658 struct {
1659 uint64_t i_intr_timed_out:1; 1659 u64 i_intr_timed_out:1;
1660 uint64_t i_rsvd:7; 1660 u64 i_rsvd:7;
1661 uint64_t i_cam_overflow:1; 1661 u64 i_cam_overflow:1;
1662 uint64_t i_cam_read_miss:1; 1662 u64 i_cam_read_miss:1;
1663 uint64_t i_rsvd1:2; 1663 u64 i_rsvd1:2;
1664 uint64_t i_ioq_rep_underflow:1; 1664 u64 i_ioq_rep_underflow:1;
1665 uint64_t i_ioq_req_underflow:1; 1665 u64 i_ioq_req_underflow:1;
1666 uint64_t i_ioq_rep_overflow:1; 1666 u64 i_ioq_rep_overflow:1;
1667 uint64_t i_ioq_req_overflow:1; 1667 u64 i_ioq_req_overflow:1;
1668 uint64_t i_iiq_rep_overflow:1; 1668 u64 i_iiq_rep_overflow:1;
1669 uint64_t i_iiq_req_overflow:1; 1669 u64 i_iiq_req_overflow:1;
1670 uint64_t i_rsvd2:6; 1670 u64 i_rsvd2:6;
1671 uint64_t i_ii_xn_rep_cred_overflow:1; 1671 u64 i_ii_xn_rep_cred_overflow:1;
1672 uint64_t i_ii_xn_req_cred_overflow:1; 1672 u64 i_ii_xn_req_cred_overflow:1;
1673 uint64_t i_rsvd3:6; 1673 u64 i_rsvd3:6;
1674 uint64_t i_ii_xn_invalid_cmd:1; 1674 u64 i_ii_xn_invalid_cmd:1;
1675 uint64_t i_xn_ii_invalid_cmd:1; 1675 u64 i_xn_ii_invalid_cmd:1;
1676 uint64_t i_rsvd4:30; 1676 u64 i_rsvd4:30;
1677 } ii_iweim_fld_s; 1677 } ii_iweim_fld_s;
1678} ii_iweim_u_t; 1678} ii_iweim_u_t;
1679 1679
@@ -1688,13 +1688,13 @@ typedef union ii_iweim_u {
1688 ************************************************************************/ 1688 ************************************************************************/
1689 1689
1690typedef union ii_ipca_u { 1690typedef union ii_ipca_u {
1691 uint64_t ii_ipca_regval; 1691 u64 ii_ipca_regval;
1692 struct { 1692 struct {
1693 uint64_t i_wid:4; 1693 u64 i_wid:4;
1694 uint64_t i_adjust:1; 1694 u64 i_adjust:1;
1695 uint64_t i_rsvd_1:3; 1695 u64 i_rsvd_1:3;
1696 uint64_t i_field:2; 1696 u64 i_field:2;
1697 uint64_t i_rsvd:54; 1697 u64 i_rsvd:54;
1698 } ii_ipca_fld_s; 1698 } ii_ipca_fld_s;
1699} ii_ipca_u_t; 1699} ii_ipca_u_t;
1700 1700
@@ -1709,12 +1709,12 @@ typedef union ii_ipca_u {
1709 ************************************************************************/ 1709 ************************************************************************/
1710 1710
1711typedef union ii_iprte0a_u { 1711typedef union ii_iprte0a_u {
1712 uint64_t ii_iprte0a_regval; 1712 u64 ii_iprte0a_regval;
1713 struct { 1713 struct {
1714 uint64_t i_rsvd_1:54; 1714 u64 i_rsvd_1:54;
1715 uint64_t i_widget:4; 1715 u64 i_widget:4;
1716 uint64_t i_to_cnt:5; 1716 u64 i_to_cnt:5;
1717 uint64_t i_vld:1; 1717 u64 i_vld:1;
1718 } ii_iprte0a_fld_s; 1718 } ii_iprte0a_fld_s;
1719} ii_iprte0a_u_t; 1719} ii_iprte0a_u_t;
1720 1720
@@ -1729,12 +1729,12 @@ typedef union ii_iprte0a_u {
1729 ************************************************************************/ 1729 ************************************************************************/
1730 1730
1731typedef union ii_iprte1a_u { 1731typedef union ii_iprte1a_u {
1732 uint64_t ii_iprte1a_regval; 1732 u64 ii_iprte1a_regval;
1733 struct { 1733 struct {
1734 uint64_t i_rsvd_1:54; 1734 u64 i_rsvd_1:54;
1735 uint64_t i_widget:4; 1735 u64 i_widget:4;
1736 uint64_t i_to_cnt:5; 1736 u64 i_to_cnt:5;
1737 uint64_t i_vld:1; 1737 u64 i_vld:1;
1738 } ii_iprte1a_fld_s; 1738 } ii_iprte1a_fld_s;
1739} ii_iprte1a_u_t; 1739} ii_iprte1a_u_t;
1740 1740
@@ -1749,12 +1749,12 @@ typedef union ii_iprte1a_u {
1749 ************************************************************************/ 1749 ************************************************************************/
1750 1750
1751typedef union ii_iprte2a_u { 1751typedef union ii_iprte2a_u {
1752 uint64_t ii_iprte2a_regval; 1752 u64 ii_iprte2a_regval;
1753 struct { 1753 struct {
1754 uint64_t i_rsvd_1:54; 1754 u64 i_rsvd_1:54;
1755 uint64_t i_widget:4; 1755 u64 i_widget:4;
1756 uint64_t i_to_cnt:5; 1756 u64 i_to_cnt:5;
1757 uint64_t i_vld:1; 1757 u64 i_vld:1;
1758 } ii_iprte2a_fld_s; 1758 } ii_iprte2a_fld_s;
1759} ii_iprte2a_u_t; 1759} ii_iprte2a_u_t;
1760 1760
@@ -1769,12 +1769,12 @@ typedef union ii_iprte2a_u {
1769 ************************************************************************/ 1769 ************************************************************************/
1770 1770
1771typedef union ii_iprte3a_u { 1771typedef union ii_iprte3a_u {
1772 uint64_t ii_iprte3a_regval; 1772 u64 ii_iprte3a_regval;
1773 struct { 1773 struct {
1774 uint64_t i_rsvd_1:54; 1774 u64 i_rsvd_1:54;
1775 uint64_t i_widget:4; 1775 u64 i_widget:4;
1776 uint64_t i_to_cnt:5; 1776 u64 i_to_cnt:5;
1777 uint64_t i_vld:1; 1777 u64 i_vld:1;
1778 } ii_iprte3a_fld_s; 1778 } ii_iprte3a_fld_s;
1779} ii_iprte3a_u_t; 1779} ii_iprte3a_u_t;
1780 1780
@@ -1789,12 +1789,12 @@ typedef union ii_iprte3a_u {
1789 ************************************************************************/ 1789 ************************************************************************/
1790 1790
1791typedef union ii_iprte4a_u { 1791typedef union ii_iprte4a_u {
1792 uint64_t ii_iprte4a_regval; 1792 u64 ii_iprte4a_regval;
1793 struct { 1793 struct {
1794 uint64_t i_rsvd_1:54; 1794 u64 i_rsvd_1:54;
1795 uint64_t i_widget:4; 1795 u64 i_widget:4;
1796 uint64_t i_to_cnt:5; 1796 u64 i_to_cnt:5;
1797 uint64_t i_vld:1; 1797 u64 i_vld:1;
1798 } ii_iprte4a_fld_s; 1798 } ii_iprte4a_fld_s;
1799} ii_iprte4a_u_t; 1799} ii_iprte4a_u_t;
1800 1800
@@ -1809,12 +1809,12 @@ typedef union ii_iprte4a_u {
1809 ************************************************************************/ 1809 ************************************************************************/
1810 1810
1811typedef union ii_iprte5a_u { 1811typedef union ii_iprte5a_u {
1812 uint64_t ii_iprte5a_regval; 1812 u64 ii_iprte5a_regval;
1813 struct { 1813 struct {
1814 uint64_t i_rsvd_1:54; 1814 u64 i_rsvd_1:54;
1815 uint64_t i_widget:4; 1815 u64 i_widget:4;
1816 uint64_t i_to_cnt:5; 1816 u64 i_to_cnt:5;
1817 uint64_t i_vld:1; 1817 u64 i_vld:1;
1818 } ii_iprte5a_fld_s; 1818 } ii_iprte5a_fld_s;
1819} ii_iprte5a_u_t; 1819} ii_iprte5a_u_t;
1820 1820
@@ -1829,12 +1829,12 @@ typedef union ii_iprte5a_u {
1829 ************************************************************************/ 1829 ************************************************************************/
1830 1830
1831typedef union ii_iprte6a_u { 1831typedef union ii_iprte6a_u {
1832 uint64_t ii_iprte6a_regval; 1832 u64 ii_iprte6a_regval;
1833 struct { 1833 struct {
1834 uint64_t i_rsvd_1:54; 1834 u64 i_rsvd_1:54;
1835 uint64_t i_widget:4; 1835 u64 i_widget:4;
1836 uint64_t i_to_cnt:5; 1836 u64 i_to_cnt:5;
1837 uint64_t i_vld:1; 1837 u64 i_vld:1;
1838 } ii_iprte6a_fld_s; 1838 } ii_iprte6a_fld_s;
1839} ii_iprte6a_u_t; 1839} ii_iprte6a_u_t;
1840 1840
@@ -1849,12 +1849,12 @@ typedef union ii_iprte6a_u {
1849 ************************************************************************/ 1849 ************************************************************************/
1850 1850
1851typedef union ii_iprte7a_u { 1851typedef union ii_iprte7a_u {
1852 uint64_t ii_iprte7a_regval; 1852 u64 ii_iprte7a_regval;
1853 struct { 1853 struct {
1854 uint64_t i_rsvd_1:54; 1854 u64 i_rsvd_1:54;
1855 uint64_t i_widget:4; 1855 u64 i_widget:4;
1856 uint64_t i_to_cnt:5; 1856 u64 i_to_cnt:5;
1857 uint64_t i_vld:1; 1857 u64 i_vld:1;
1858 } ii_iprtea7_fld_s; 1858 } ii_iprtea7_fld_s;
1859} ii_iprte7a_u_t; 1859} ii_iprte7a_u_t;
1860 1860
@@ -1869,12 +1869,12 @@ typedef union ii_iprte7a_u {
1869 ************************************************************************/ 1869 ************************************************************************/
1870 1870
1871typedef union ii_iprte0b_u { 1871typedef union ii_iprte0b_u {
1872 uint64_t ii_iprte0b_regval; 1872 u64 ii_iprte0b_regval;
1873 struct { 1873 struct {
1874 uint64_t i_rsvd_1:3; 1874 u64 i_rsvd_1:3;
1875 uint64_t i_address:47; 1875 u64 i_address:47;
1876 uint64_t i_init:3; 1876 u64 i_init:3;
1877 uint64_t i_source:11; 1877 u64 i_source:11;
1878 } ii_iprte0b_fld_s; 1878 } ii_iprte0b_fld_s;
1879} ii_iprte0b_u_t; 1879} ii_iprte0b_u_t;
1880 1880
@@ -1889,12 +1889,12 @@ typedef union ii_iprte0b_u {
1889 ************************************************************************/ 1889 ************************************************************************/
1890 1890
1891typedef union ii_iprte1b_u { 1891typedef union ii_iprte1b_u {
1892 uint64_t ii_iprte1b_regval; 1892 u64 ii_iprte1b_regval;
1893 struct { 1893 struct {
1894 uint64_t i_rsvd_1:3; 1894 u64 i_rsvd_1:3;
1895 uint64_t i_address:47; 1895 u64 i_address:47;
1896 uint64_t i_init:3; 1896 u64 i_init:3;
1897 uint64_t i_source:11; 1897 u64 i_source:11;
1898 } ii_iprte1b_fld_s; 1898 } ii_iprte1b_fld_s;
1899} ii_iprte1b_u_t; 1899} ii_iprte1b_u_t;
1900 1900
@@ -1909,12 +1909,12 @@ typedef union ii_iprte1b_u {
1909 ************************************************************************/ 1909 ************************************************************************/
1910 1910
1911typedef union ii_iprte2b_u { 1911typedef union ii_iprte2b_u {
1912 uint64_t ii_iprte2b_regval; 1912 u64 ii_iprte2b_regval;
1913 struct { 1913 struct {
1914 uint64_t i_rsvd_1:3; 1914 u64 i_rsvd_1:3;
1915 uint64_t i_address:47; 1915 u64 i_address:47;
1916 uint64_t i_init:3; 1916 u64 i_init:3;
1917 uint64_t i_source:11; 1917 u64 i_source:11;
1918 } ii_iprte2b_fld_s; 1918 } ii_iprte2b_fld_s;
1919} ii_iprte2b_u_t; 1919} ii_iprte2b_u_t;
1920 1920
@@ -1929,12 +1929,12 @@ typedef union ii_iprte2b_u {
1929 ************************************************************************/ 1929 ************************************************************************/
1930 1930
1931typedef union ii_iprte3b_u { 1931typedef union ii_iprte3b_u {
1932 uint64_t ii_iprte3b_regval; 1932 u64 ii_iprte3b_regval;
1933 struct { 1933 struct {
1934 uint64_t i_rsvd_1:3; 1934 u64 i_rsvd_1:3;
1935 uint64_t i_address:47; 1935 u64 i_address:47;
1936 uint64_t i_init:3; 1936 u64 i_init:3;
1937 uint64_t i_source:11; 1937 u64 i_source:11;
1938 } ii_iprte3b_fld_s; 1938 } ii_iprte3b_fld_s;
1939} ii_iprte3b_u_t; 1939} ii_iprte3b_u_t;
1940 1940
@@ -1949,12 +1949,12 @@ typedef union ii_iprte3b_u {
1949 ************************************************************************/ 1949 ************************************************************************/
1950 1950
1951typedef union ii_iprte4b_u { 1951typedef union ii_iprte4b_u {
1952 uint64_t ii_iprte4b_regval; 1952 u64 ii_iprte4b_regval;
1953 struct { 1953 struct {
1954 uint64_t i_rsvd_1:3; 1954 u64 i_rsvd_1:3;
1955 uint64_t i_address:47; 1955 u64 i_address:47;
1956 uint64_t i_init:3; 1956 u64 i_init:3;
1957 uint64_t i_source:11; 1957 u64 i_source:11;
1958 } ii_iprte4b_fld_s; 1958 } ii_iprte4b_fld_s;
1959} ii_iprte4b_u_t; 1959} ii_iprte4b_u_t;
1960 1960
@@ -1969,12 +1969,12 @@ typedef union ii_iprte4b_u {
1969 ************************************************************************/ 1969 ************************************************************************/
1970 1970
1971typedef union ii_iprte5b_u { 1971typedef union ii_iprte5b_u {
1972 uint64_t ii_iprte5b_regval; 1972 u64 ii_iprte5b_regval;
1973 struct { 1973 struct {
1974 uint64_t i_rsvd_1:3; 1974 u64 i_rsvd_1:3;
1975 uint64_t i_address:47; 1975 u64 i_address:47;
1976 uint64_t i_init:3; 1976 u64 i_init:3;
1977 uint64_t i_source:11; 1977 u64 i_source:11;
1978 } ii_iprte5b_fld_s; 1978 } ii_iprte5b_fld_s;
1979} ii_iprte5b_u_t; 1979} ii_iprte5b_u_t;
1980 1980
@@ -1989,12 +1989,12 @@ typedef union ii_iprte5b_u {
1989 ************************************************************************/ 1989 ************************************************************************/
1990 1990
1991typedef union ii_iprte6b_u { 1991typedef union ii_iprte6b_u {
1992 uint64_t ii_iprte6b_regval; 1992 u64 ii_iprte6b_regval;
1993 struct { 1993 struct {
1994 uint64_t i_rsvd_1:3; 1994 u64 i_rsvd_1:3;
1995 uint64_t i_address:47; 1995 u64 i_address:47;
1996 uint64_t i_init:3; 1996 u64 i_init:3;
1997 uint64_t i_source:11; 1997 u64 i_source:11;
1998 1998
1999 } ii_iprte6b_fld_s; 1999 } ii_iprte6b_fld_s;
2000} ii_iprte6b_u_t; 2000} ii_iprte6b_u_t;
@@ -2010,12 +2010,12 @@ typedef union ii_iprte6b_u {
2010 ************************************************************************/ 2010 ************************************************************************/
2011 2011
2012typedef union ii_iprte7b_u { 2012typedef union ii_iprte7b_u {
2013 uint64_t ii_iprte7b_regval; 2013 u64 ii_iprte7b_regval;
2014 struct { 2014 struct {
2015 uint64_t i_rsvd_1:3; 2015 u64 i_rsvd_1:3;
2016 uint64_t i_address:47; 2016 u64 i_address:47;
2017 uint64_t i_init:3; 2017 u64 i_init:3;
2018 uint64_t i_source:11; 2018 u64 i_source:11;
2019 } ii_iprte7b_fld_s; 2019 } ii_iprte7b_fld_s;
2020} ii_iprte7b_u_t; 2020} ii_iprte7b_u_t;
2021 2021
@@ -2038,13 +2038,13 @@ typedef union ii_iprte7b_u {
2038 ************************************************************************/ 2038 ************************************************************************/
2039 2039
2040typedef union ii_ipdr_u { 2040typedef union ii_ipdr_u {
2041 uint64_t ii_ipdr_regval; 2041 u64 ii_ipdr_regval;
2042 struct { 2042 struct {
2043 uint64_t i_te:3; 2043 u64 i_te:3;
2044 uint64_t i_rsvd_1:1; 2044 u64 i_rsvd_1:1;
2045 uint64_t i_pnd:1; 2045 u64 i_pnd:1;
2046 uint64_t i_init_rpcnt:1; 2046 u64 i_init_rpcnt:1;
2047 uint64_t i_rsvd:58; 2047 u64 i_rsvd:58;
2048 } ii_ipdr_fld_s; 2048 } ii_ipdr_fld_s;
2049} ii_ipdr_u_t; 2049} ii_ipdr_u_t;
2050 2050
@@ -2066,11 +2066,11 @@ typedef union ii_ipdr_u {
2066 ************************************************************************/ 2066 ************************************************************************/
2067 2067
2068typedef union ii_icdr_u { 2068typedef union ii_icdr_u {
2069 uint64_t ii_icdr_regval; 2069 u64 ii_icdr_regval;
2070 struct { 2070 struct {
2071 uint64_t i_crb_num:4; 2071 u64 i_crb_num:4;
2072 uint64_t i_pnd:1; 2072 u64 i_pnd:1;
2073 uint64_t i_rsvd:59; 2073 u64 i_rsvd:59;
2074 } ii_icdr_fld_s; 2074 } ii_icdr_fld_s;
2075} ii_icdr_u_t; 2075} ii_icdr_u_t;
2076 2076
@@ -2092,13 +2092,13 @@ typedef union ii_icdr_u {
2092 ************************************************************************/ 2092 ************************************************************************/
2093 2093
2094typedef union ii_ifdr_u { 2094typedef union ii_ifdr_u {
2095 uint64_t ii_ifdr_regval; 2095 u64 ii_ifdr_regval;
2096 struct { 2096 struct {
2097 uint64_t i_ioq_max_rq:7; 2097 u64 i_ioq_max_rq:7;
2098 uint64_t i_set_ioq_rq:1; 2098 u64 i_set_ioq_rq:1;
2099 uint64_t i_ioq_max_rp:7; 2099 u64 i_ioq_max_rp:7;
2100 uint64_t i_set_ioq_rp:1; 2100 u64 i_set_ioq_rp:1;
2101 uint64_t i_rsvd:48; 2101 u64 i_rsvd:48;
2102 } ii_ifdr_fld_s; 2102 } ii_ifdr_fld_s;
2103} ii_ifdr_u_t; 2103} ii_ifdr_u_t;
2104 2104
@@ -2114,12 +2114,12 @@ typedef union ii_ifdr_u {
2114 ************************************************************************/ 2114 ************************************************************************/
2115 2115
2116typedef union ii_iiap_u { 2116typedef union ii_iiap_u {
2117 uint64_t ii_iiap_regval; 2117 u64 ii_iiap_regval;
2118 struct { 2118 struct {
2119 uint64_t i_rq_mls:6; 2119 u64 i_rq_mls:6;
2120 uint64_t i_rsvd_1:2; 2120 u64 i_rsvd_1:2;
2121 uint64_t i_rp_mls:6; 2121 u64 i_rp_mls:6;
2122 uint64_t i_rsvd:50; 2122 u64 i_rsvd:50;
2123 } ii_iiap_fld_s; 2123 } ii_iiap_fld_s;
2124} ii_iiap_u_t; 2124} ii_iiap_u_t;
2125 2125
@@ -2133,22 +2133,22 @@ typedef union ii_iiap_u {
2133 ************************************************************************/ 2133 ************************************************************************/
2134 2134
2135typedef union ii_icmr_u { 2135typedef union ii_icmr_u {
2136 uint64_t ii_icmr_regval; 2136 u64 ii_icmr_regval;
2137 struct { 2137 struct {
2138 uint64_t i_sp_msg:1; 2138 u64 i_sp_msg:1;
2139 uint64_t i_rd_hdr:1; 2139 u64 i_rd_hdr:1;
2140 uint64_t i_rsvd_4:2; 2140 u64 i_rsvd_4:2;
2141 uint64_t i_c_cnt:4; 2141 u64 i_c_cnt:4;
2142 uint64_t i_rsvd_3:4; 2142 u64 i_rsvd_3:4;
2143 uint64_t i_clr_rqpd:1; 2143 u64 i_clr_rqpd:1;
2144 uint64_t i_clr_rppd:1; 2144 u64 i_clr_rppd:1;
2145 uint64_t i_rsvd_2:2; 2145 u64 i_rsvd_2:2;
2146 uint64_t i_fc_cnt:4; 2146 u64 i_fc_cnt:4;
2147 uint64_t i_crb_vld:15; 2147 u64 i_crb_vld:15;
2148 uint64_t i_crb_mark:15; 2148 u64 i_crb_mark:15;
2149 uint64_t i_rsvd_1:2; 2149 u64 i_rsvd_1:2;
2150 uint64_t i_precise:1; 2150 u64 i_precise:1;
2151 uint64_t i_rsvd:11; 2151 u64 i_rsvd:11;
2152 } ii_icmr_fld_s; 2152 } ii_icmr_fld_s;
2153} ii_icmr_u_t; 2153} ii_icmr_u_t;
2154 2154
@@ -2161,13 +2161,13 @@ typedef union ii_icmr_u {
2161 ************************************************************************/ 2161 ************************************************************************/
2162 2162
2163typedef union ii_iccr_u { 2163typedef union ii_iccr_u {
2164 uint64_t ii_iccr_regval; 2164 u64 ii_iccr_regval;
2165 struct { 2165 struct {
2166 uint64_t i_crb_num:4; 2166 u64 i_crb_num:4;
2167 uint64_t i_rsvd_1:4; 2167 u64 i_rsvd_1:4;
2168 uint64_t i_cmd:8; 2168 u64 i_cmd:8;
2169 uint64_t i_pending:1; 2169 u64 i_pending:1;
2170 uint64_t i_rsvd:47; 2170 u64 i_rsvd:47;
2171 } ii_iccr_fld_s; 2171 } ii_iccr_fld_s;
2172} ii_iccr_u_t; 2172} ii_iccr_u_t;
2173 2173
@@ -2178,10 +2178,10 @@ typedef union ii_iccr_u {
2178 ************************************************************************/ 2178 ************************************************************************/
2179 2179
2180typedef union ii_icto_u { 2180typedef union ii_icto_u {
2181 uint64_t ii_icto_regval; 2181 u64 ii_icto_regval;
2182 struct { 2182 struct {
2183 uint64_t i_timeout:8; 2183 u64 i_timeout:8;
2184 uint64_t i_rsvd:56; 2184 u64 i_rsvd:56;
2185 } ii_icto_fld_s; 2185 } ii_icto_fld_s;
2186} ii_icto_u_t; 2186} ii_icto_u_t;
2187 2187
@@ -2197,10 +2197,10 @@ typedef union ii_icto_u {
2197 ************************************************************************/ 2197 ************************************************************************/
2198 2198
2199typedef union ii_ictp_u { 2199typedef union ii_ictp_u {
2200 uint64_t ii_ictp_regval; 2200 u64 ii_ictp_regval;
2201 struct { 2201 struct {
2202 uint64_t i_prescale:24; 2202 u64 i_prescale:24;
2203 uint64_t i_rsvd:40; 2203 u64 i_rsvd:40;
2204 } ii_ictp_fld_s; 2204 } ii_ictp_fld_s;
2205} ii_ictp_u_t; 2205} ii_ictp_u_t;
2206 2206
@@ -2228,14 +2228,14 @@ typedef union ii_ictp_u {
2228 ************************************************************************/ 2228 ************************************************************************/
2229 2229
2230typedef union ii_icrb0_a_u { 2230typedef union ii_icrb0_a_u {
2231 uint64_t ii_icrb0_a_regval; 2231 u64 ii_icrb0_a_regval;
2232 struct { 2232 struct {
2233 uint64_t ia_iow:1; 2233 u64 ia_iow:1;
2234 uint64_t ia_vld:1; 2234 u64 ia_vld:1;
2235 uint64_t ia_addr:47; 2235 u64 ia_addr:47;
2236 uint64_t ia_tnum:5; 2236 u64 ia_tnum:5;
2237 uint64_t ia_sidn:4; 2237 u64 ia_sidn:4;
2238 uint64_t ia_rsvd:6; 2238 u64 ia_rsvd:6;
2239 } ii_icrb0_a_fld_s; 2239 } ii_icrb0_a_fld_s;
2240} ii_icrb0_a_u_t; 2240} ii_icrb0_a_u_t;
2241 2241
@@ -2249,30 +2249,30 @@ typedef union ii_icrb0_a_u {
2249 ************************************************************************/ 2249 ************************************************************************/
2250 2250
2251typedef union ii_icrb0_b_u { 2251typedef union ii_icrb0_b_u {
2252 uint64_t ii_icrb0_b_regval; 2252 u64 ii_icrb0_b_regval;
2253 struct { 2253 struct {
2254 uint64_t ib_xt_err:1; 2254 u64 ib_xt_err:1;
2255 uint64_t ib_mark:1; 2255 u64 ib_mark:1;
2256 uint64_t ib_ln_uce:1; 2256 u64 ib_ln_uce:1;
2257 uint64_t ib_errcode:3; 2257 u64 ib_errcode:3;
2258 uint64_t ib_error:1; 2258 u64 ib_error:1;
2259 uint64_t ib_stall__bte_1:1; 2259 u64 ib_stall__bte_1:1;
2260 uint64_t ib_stall__bte_0:1; 2260 u64 ib_stall__bte_0:1;
2261 uint64_t ib_stall__intr:1; 2261 u64 ib_stall__intr:1;
2262 uint64_t ib_stall_ib:1; 2262 u64 ib_stall_ib:1;
2263 uint64_t ib_intvn:1; 2263 u64 ib_intvn:1;
2264 uint64_t ib_wb:1; 2264 u64 ib_wb:1;
2265 uint64_t ib_hold:1; 2265 u64 ib_hold:1;
2266 uint64_t ib_ack:1; 2266 u64 ib_ack:1;
2267 uint64_t ib_resp:1; 2267 u64 ib_resp:1;
2268 uint64_t ib_ack_cnt:11; 2268 u64 ib_ack_cnt:11;
2269 uint64_t ib_rsvd:7; 2269 u64 ib_rsvd:7;
2270 uint64_t ib_exc:5; 2270 u64 ib_exc:5;
2271 uint64_t ib_init:3; 2271 u64 ib_init:3;
2272 uint64_t ib_imsg:8; 2272 u64 ib_imsg:8;
2273 uint64_t ib_imsgtype:2; 2273 u64 ib_imsgtype:2;
2274 uint64_t ib_use_old:1; 2274 u64 ib_use_old:1;
2275 uint64_t ib_rsvd_1:11; 2275 u64 ib_rsvd_1:11;
2276 } ii_icrb0_b_fld_s; 2276 } ii_icrb0_b_fld_s;
2277} ii_icrb0_b_u_t; 2277} ii_icrb0_b_u_t;
2278 2278
@@ -2286,17 +2286,17 @@ typedef union ii_icrb0_b_u {
2286 ************************************************************************/ 2286 ************************************************************************/
2287 2287
2288typedef union ii_icrb0_c_u { 2288typedef union ii_icrb0_c_u {
2289 uint64_t ii_icrb0_c_regval; 2289 u64 ii_icrb0_c_regval;
2290 struct { 2290 struct {
2291 uint64_t ic_source:15; 2291 u64 ic_source:15;
2292 uint64_t ic_size:2; 2292 u64 ic_size:2;
2293 uint64_t ic_ct:1; 2293 u64 ic_ct:1;
2294 uint64_t ic_bte_num:1; 2294 u64 ic_bte_num:1;
2295 uint64_t ic_gbr:1; 2295 u64 ic_gbr:1;
2296 uint64_t ic_resprqd:1; 2296 u64 ic_resprqd:1;
2297 uint64_t ic_bo:1; 2297 u64 ic_bo:1;
2298 uint64_t ic_suppl:15; 2298 u64 ic_suppl:15;
2299 uint64_t ic_rsvd:27; 2299 u64 ic_rsvd:27;
2300 } ii_icrb0_c_fld_s; 2300 } ii_icrb0_c_fld_s;
2301} ii_icrb0_c_u_t; 2301} ii_icrb0_c_u_t;
2302 2302
@@ -2310,14 +2310,14 @@ typedef union ii_icrb0_c_u {
2310 ************************************************************************/ 2310 ************************************************************************/
2311 2311
2312typedef union ii_icrb0_d_u { 2312typedef union ii_icrb0_d_u {
2313 uint64_t ii_icrb0_d_regval; 2313 u64 ii_icrb0_d_regval;
2314 struct { 2314 struct {
2315 uint64_t id_pa_be:43; 2315 u64 id_pa_be:43;
2316 uint64_t id_bte_op:1; 2316 u64 id_bte_op:1;
2317 uint64_t id_pr_psc:4; 2317 u64 id_pr_psc:4;
2318 uint64_t id_pr_cnt:4; 2318 u64 id_pr_cnt:4;
2319 uint64_t id_sleep:1; 2319 u64 id_sleep:1;
2320 uint64_t id_rsvd:11; 2320 u64 id_rsvd:11;
2321 } ii_icrb0_d_fld_s; 2321 } ii_icrb0_d_fld_s;
2322} ii_icrb0_d_u_t; 2322} ii_icrb0_d_u_t;
2323 2323
@@ -2331,14 +2331,14 @@ typedef union ii_icrb0_d_u {
2331 ************************************************************************/ 2331 ************************************************************************/
2332 2332
2333typedef union ii_icrb0_e_u { 2333typedef union ii_icrb0_e_u {
2334 uint64_t ii_icrb0_e_regval; 2334 u64 ii_icrb0_e_regval;
2335 struct { 2335 struct {
2336 uint64_t ie_timeout:8; 2336 u64 ie_timeout:8;
2337 uint64_t ie_context:15; 2337 u64 ie_context:15;
2338 uint64_t ie_rsvd:1; 2338 u64 ie_rsvd:1;
2339 uint64_t ie_tvld:1; 2339 u64 ie_tvld:1;
2340 uint64_t ie_cvld:1; 2340 u64 ie_cvld:1;
2341 uint64_t ie_rsvd_0:38; 2341 u64 ie_rsvd_0:38;
2342 } ii_icrb0_e_fld_s; 2342 } ii_icrb0_e_fld_s;
2343} ii_icrb0_e_u_t; 2343} ii_icrb0_e_u_t;
2344 2344
@@ -2351,12 +2351,12 @@ typedef union ii_icrb0_e_u {
2351 ************************************************************************/ 2351 ************************************************************************/
2352 2352
2353typedef union ii_icsml_u { 2353typedef union ii_icsml_u {
2354 uint64_t ii_icsml_regval; 2354 u64 ii_icsml_regval;
2355 struct { 2355 struct {
2356 uint64_t i_tt_addr:47; 2356 u64 i_tt_addr:47;
2357 uint64_t i_newsuppl_ex:14; 2357 u64 i_newsuppl_ex:14;
2358 uint64_t i_reserved:2; 2358 u64 i_reserved:2;
2359 uint64_t i_overflow:1; 2359 u64 i_overflow:1;
2360 } ii_icsml_fld_s; 2360 } ii_icsml_fld_s;
2361} ii_icsml_u_t; 2361} ii_icsml_u_t;
2362 2362
@@ -2369,10 +2369,10 @@ typedef union ii_icsml_u {
2369 ************************************************************************/ 2369 ************************************************************************/
2370 2370
2371typedef union ii_icsmm_u { 2371typedef union ii_icsmm_u {
2372 uint64_t ii_icsmm_regval; 2372 u64 ii_icsmm_regval;
2373 struct { 2373 struct {
2374 uint64_t i_tt_ack_cnt:11; 2374 u64 i_tt_ack_cnt:11;
2375 uint64_t i_reserved:53; 2375 u64 i_reserved:53;
2376 } ii_icsmm_fld_s; 2376 } ii_icsmm_fld_s;
2377} ii_icsmm_u_t; 2377} ii_icsmm_u_t;
2378 2378
@@ -2385,48 +2385,48 @@ typedef union ii_icsmm_u {
2385 ************************************************************************/ 2385 ************************************************************************/
2386 2386
2387typedef union ii_icsmh_u { 2387typedef union ii_icsmh_u {
2388 uint64_t ii_icsmh_regval; 2388 u64 ii_icsmh_regval;
2389 struct { 2389 struct {
2390 uint64_t i_tt_vld:1; 2390 u64 i_tt_vld:1;
2391 uint64_t i_xerr:1; 2391 u64 i_xerr:1;
2392 uint64_t i_ft_cwact_o:1; 2392 u64 i_ft_cwact_o:1;
2393 uint64_t i_ft_wact_o:1; 2393 u64 i_ft_wact_o:1;
2394 uint64_t i_ft_active_o:1; 2394 u64 i_ft_active_o:1;
2395 uint64_t i_sync:1; 2395 u64 i_sync:1;
2396 uint64_t i_mnusg:1; 2396 u64 i_mnusg:1;
2397 uint64_t i_mnusz:1; 2397 u64 i_mnusz:1;
2398 uint64_t i_plusz:1; 2398 u64 i_plusz:1;
2399 uint64_t i_plusg:1; 2399 u64 i_plusg:1;
2400 uint64_t i_tt_exc:5; 2400 u64 i_tt_exc:5;
2401 uint64_t i_tt_wb:1; 2401 u64 i_tt_wb:1;
2402 uint64_t i_tt_hold:1; 2402 u64 i_tt_hold:1;
2403 uint64_t i_tt_ack:1; 2403 u64 i_tt_ack:1;
2404 uint64_t i_tt_resp:1; 2404 u64 i_tt_resp:1;
2405 uint64_t i_tt_intvn:1; 2405 u64 i_tt_intvn:1;
2406 uint64_t i_g_stall_bte1:1; 2406 u64 i_g_stall_bte1:1;
2407 uint64_t i_g_stall_bte0:1; 2407 u64 i_g_stall_bte0:1;
2408 uint64_t i_g_stall_il:1; 2408 u64 i_g_stall_il:1;
2409 uint64_t i_g_stall_ib:1; 2409 u64 i_g_stall_ib:1;
2410 uint64_t i_tt_imsg:8; 2410 u64 i_tt_imsg:8;
2411 uint64_t i_tt_imsgtype:2; 2411 u64 i_tt_imsgtype:2;
2412 uint64_t i_tt_use_old:1; 2412 u64 i_tt_use_old:1;
2413 uint64_t i_tt_respreqd:1; 2413 u64 i_tt_respreqd:1;
2414 uint64_t i_tt_bte_num:1; 2414 u64 i_tt_bte_num:1;
2415 uint64_t i_cbn:1; 2415 u64 i_cbn:1;
2416 uint64_t i_match:1; 2416 u64 i_match:1;
2417 uint64_t i_rpcnt_lt_34:1; 2417 u64 i_rpcnt_lt_34:1;
2418 uint64_t i_rpcnt_ge_34:1; 2418 u64 i_rpcnt_ge_34:1;
2419 uint64_t i_rpcnt_lt_18:1; 2419 u64 i_rpcnt_lt_18:1;
2420 uint64_t i_rpcnt_ge_18:1; 2420 u64 i_rpcnt_ge_18:1;
2421 uint64_t i_rpcnt_lt_2:1; 2421 u64 i_rpcnt_lt_2:1;
2422 uint64_t i_rpcnt_ge_2:1; 2422 u64 i_rpcnt_ge_2:1;
2423 uint64_t i_rqcnt_lt_18:1; 2423 u64 i_rqcnt_lt_18:1;
2424 uint64_t i_rqcnt_ge_18:1; 2424 u64 i_rqcnt_ge_18:1;
2425 uint64_t i_rqcnt_lt_2:1; 2425 u64 i_rqcnt_lt_2:1;
2426 uint64_t i_rqcnt_ge_2:1; 2426 u64 i_rqcnt_ge_2:1;
2427 uint64_t i_tt_device:7; 2427 u64 i_tt_device:7;
2428 uint64_t i_tt_init:3; 2428 u64 i_tt_init:3;
2429 uint64_t i_reserved:5; 2429 u64 i_reserved:5;
2430 } ii_icsmh_fld_s; 2430 } ii_icsmh_fld_s;
2431} ii_icsmh_u_t; 2431} ii_icsmh_u_t;
2432 2432
@@ -2439,14 +2439,14 @@ typedef union ii_icsmh_u {
2439 ************************************************************************/ 2439 ************************************************************************/
2440 2440
2441typedef union ii_idbss_u { 2441typedef union ii_idbss_u {
2442 uint64_t ii_idbss_regval; 2442 u64 ii_idbss_regval;
2443 struct { 2443 struct {
2444 uint64_t i_iioclk_core_submenu:3; 2444 u64 i_iioclk_core_submenu:3;
2445 uint64_t i_rsvd:5; 2445 u64 i_rsvd:5;
2446 uint64_t i_fsbclk_wrapper_submenu:3; 2446 u64 i_fsbclk_wrapper_submenu:3;
2447 uint64_t i_rsvd_1:5; 2447 u64 i_rsvd_1:5;
2448 uint64_t i_iioclk_menu:5; 2448 u64 i_iioclk_menu:5;
2449 uint64_t i_rsvd_2:43; 2449 u64 i_rsvd_2:43;
2450 } ii_idbss_fld_s; 2450 } ii_idbss_fld_s;
2451} ii_idbss_u_t; 2451} ii_idbss_u_t;
2452 2452
@@ -2466,13 +2466,13 @@ typedef union ii_idbss_u {
2466 ************************************************************************/ 2466 ************************************************************************/
2467 2467
2468typedef union ii_ibls0_u { 2468typedef union ii_ibls0_u {
2469 uint64_t ii_ibls0_regval; 2469 u64 ii_ibls0_regval;
2470 struct { 2470 struct {
2471 uint64_t i_length:16; 2471 u64 i_length:16;
2472 uint64_t i_error:1; 2472 u64 i_error:1;
2473 uint64_t i_rsvd_1:3; 2473 u64 i_rsvd_1:3;
2474 uint64_t i_busy:1; 2474 u64 i_busy:1;
2475 uint64_t i_rsvd:43; 2475 u64 i_rsvd:43;
2476 } ii_ibls0_fld_s; 2476 } ii_ibls0_fld_s;
2477} ii_ibls0_u_t; 2477} ii_ibls0_u_t;
2478 2478
@@ -2487,11 +2487,11 @@ typedef union ii_ibls0_u {
2487 ************************************************************************/ 2487 ************************************************************************/
2488 2488
2489typedef union ii_ibsa0_u { 2489typedef union ii_ibsa0_u {
2490 uint64_t ii_ibsa0_regval; 2490 u64 ii_ibsa0_regval;
2491 struct { 2491 struct {
2492 uint64_t i_rsvd_1:7; 2492 u64 i_rsvd_1:7;
2493 uint64_t i_addr:42; 2493 u64 i_addr:42;
2494 uint64_t i_rsvd:15; 2494 u64 i_rsvd:15;
2495 } ii_ibsa0_fld_s; 2495 } ii_ibsa0_fld_s;
2496} ii_ibsa0_u_t; 2496} ii_ibsa0_u_t;
2497 2497
@@ -2506,11 +2506,11 @@ typedef union ii_ibsa0_u {
2506 ************************************************************************/ 2506 ************************************************************************/
2507 2507
2508typedef union ii_ibda0_u { 2508typedef union ii_ibda0_u {
2509 uint64_t ii_ibda0_regval; 2509 u64 ii_ibda0_regval;
2510 struct { 2510 struct {
2511 uint64_t i_rsvd_1:7; 2511 u64 i_rsvd_1:7;
2512 uint64_t i_addr:42; 2512 u64 i_addr:42;
2513 uint64_t i_rsvd:15; 2513 u64 i_rsvd:15;
2514 } ii_ibda0_fld_s; 2514 } ii_ibda0_fld_s;
2515} ii_ibda0_u_t; 2515} ii_ibda0_u_t;
2516 2516
@@ -2527,14 +2527,14 @@ typedef union ii_ibda0_u {
2527 ************************************************************************/ 2527 ************************************************************************/
2528 2528
2529typedef union ii_ibct0_u { 2529typedef union ii_ibct0_u {
2530 uint64_t ii_ibct0_regval; 2530 u64 ii_ibct0_regval;
2531 struct { 2531 struct {
2532 uint64_t i_zerofill:1; 2532 u64 i_zerofill:1;
2533 uint64_t i_rsvd_2:3; 2533 u64 i_rsvd_2:3;
2534 uint64_t i_notify:1; 2534 u64 i_notify:1;
2535 uint64_t i_rsvd_1:3; 2535 u64 i_rsvd_1:3;
2536 uint64_t i_poison:1; 2536 u64 i_poison:1;
2537 uint64_t i_rsvd:55; 2537 u64 i_rsvd:55;
2538 } ii_ibct0_fld_s; 2538 } ii_ibct0_fld_s;
2539} ii_ibct0_u_t; 2539} ii_ibct0_u_t;
2540 2540
@@ -2546,11 +2546,11 @@ typedef union ii_ibct0_u {
2546 ************************************************************************/ 2546 ************************************************************************/
2547 2547
2548typedef union ii_ibna0_u { 2548typedef union ii_ibna0_u {
2549 uint64_t ii_ibna0_regval; 2549 u64 ii_ibna0_regval;
2550 struct { 2550 struct {
2551 uint64_t i_rsvd_1:7; 2551 u64 i_rsvd_1:7;
2552 uint64_t i_addr:42; 2552 u64 i_addr:42;
2553 uint64_t i_rsvd:15; 2553 u64 i_rsvd:15;
2554 } ii_ibna0_fld_s; 2554 } ii_ibna0_fld_s;
2555} ii_ibna0_u_t; 2555} ii_ibna0_u_t;
2556 2556
@@ -2563,13 +2563,13 @@ typedef union ii_ibna0_u {
2563 ************************************************************************/ 2563 ************************************************************************/
2564 2564
2565typedef union ii_ibia0_u { 2565typedef union ii_ibia0_u {
2566 uint64_t ii_ibia0_regval; 2566 u64 ii_ibia0_regval;
2567 struct { 2567 struct {
2568 uint64_t i_rsvd_2:1; 2568 u64 i_rsvd_2:1;
2569 uint64_t i_node_id:11; 2569 u64 i_node_id:11;
2570 uint64_t i_rsvd_1:4; 2570 u64 i_rsvd_1:4;
2571 uint64_t i_level:7; 2571 u64 i_level:7;
2572 uint64_t i_rsvd:41; 2572 u64 i_rsvd:41;
2573 } ii_ibia0_fld_s; 2573 } ii_ibia0_fld_s;
2574} ii_ibia0_u_t; 2574} ii_ibia0_u_t;
2575 2575
@@ -2589,13 +2589,13 @@ typedef union ii_ibia0_u {
2589 ************************************************************************/ 2589 ************************************************************************/
2590 2590
2591typedef union ii_ibls1_u { 2591typedef union ii_ibls1_u {
2592 uint64_t ii_ibls1_regval; 2592 u64 ii_ibls1_regval;
2593 struct { 2593 struct {
2594 uint64_t i_length:16; 2594 u64 i_length:16;
2595 uint64_t i_error:1; 2595 u64 i_error:1;
2596 uint64_t i_rsvd_1:3; 2596 u64 i_rsvd_1:3;
2597 uint64_t i_busy:1; 2597 u64 i_busy:1;
2598 uint64_t i_rsvd:43; 2598 u64 i_rsvd:43;
2599 } ii_ibls1_fld_s; 2599 } ii_ibls1_fld_s;
2600} ii_ibls1_u_t; 2600} ii_ibls1_u_t;
2601 2601
@@ -2610,11 +2610,11 @@ typedef union ii_ibls1_u {
2610 ************************************************************************/ 2610 ************************************************************************/
2611 2611
2612typedef union ii_ibsa1_u { 2612typedef union ii_ibsa1_u {
2613 uint64_t ii_ibsa1_regval; 2613 u64 ii_ibsa1_regval;
2614 struct { 2614 struct {
2615 uint64_t i_rsvd_1:7; 2615 u64 i_rsvd_1:7;
2616 uint64_t i_addr:33; 2616 u64 i_addr:33;
2617 uint64_t i_rsvd:24; 2617 u64 i_rsvd:24;
2618 } ii_ibsa1_fld_s; 2618 } ii_ibsa1_fld_s;
2619} ii_ibsa1_u_t; 2619} ii_ibsa1_u_t;
2620 2620
@@ -2629,11 +2629,11 @@ typedef union ii_ibsa1_u {
2629 ************************************************************************/ 2629 ************************************************************************/
2630 2630
2631typedef union ii_ibda1_u { 2631typedef union ii_ibda1_u {
2632 uint64_t ii_ibda1_regval; 2632 u64 ii_ibda1_regval;
2633 struct { 2633 struct {
2634 uint64_t i_rsvd_1:7; 2634 u64 i_rsvd_1:7;
2635 uint64_t i_addr:33; 2635 u64 i_addr:33;
2636 uint64_t i_rsvd:24; 2636 u64 i_rsvd:24;
2637 } ii_ibda1_fld_s; 2637 } ii_ibda1_fld_s;
2638} ii_ibda1_u_t; 2638} ii_ibda1_u_t;
2639 2639
@@ -2650,14 +2650,14 @@ typedef union ii_ibda1_u {
2650 ************************************************************************/ 2650 ************************************************************************/
2651 2651
2652typedef union ii_ibct1_u { 2652typedef union ii_ibct1_u {
2653 uint64_t ii_ibct1_regval; 2653 u64 ii_ibct1_regval;
2654 struct { 2654 struct {
2655 uint64_t i_zerofill:1; 2655 u64 i_zerofill:1;
2656 uint64_t i_rsvd_2:3; 2656 u64 i_rsvd_2:3;
2657 uint64_t i_notify:1; 2657 u64 i_notify:1;
2658 uint64_t i_rsvd_1:3; 2658 u64 i_rsvd_1:3;
2659 uint64_t i_poison:1; 2659 u64 i_poison:1;
2660 uint64_t i_rsvd:55; 2660 u64 i_rsvd:55;
2661 } ii_ibct1_fld_s; 2661 } ii_ibct1_fld_s;
2662} ii_ibct1_u_t; 2662} ii_ibct1_u_t;
2663 2663
@@ -2669,11 +2669,11 @@ typedef union ii_ibct1_u {
2669 ************************************************************************/ 2669 ************************************************************************/
2670 2670
2671typedef union ii_ibna1_u { 2671typedef union ii_ibna1_u {
2672 uint64_t ii_ibna1_regval; 2672 u64 ii_ibna1_regval;
2673 struct { 2673 struct {
2674 uint64_t i_rsvd_1:7; 2674 u64 i_rsvd_1:7;
2675 uint64_t i_addr:33; 2675 u64 i_addr:33;
2676 uint64_t i_rsvd:24; 2676 u64 i_rsvd:24;
2677 } ii_ibna1_fld_s; 2677 } ii_ibna1_fld_s;
2678} ii_ibna1_u_t; 2678} ii_ibna1_u_t;
2679 2679
@@ -2686,13 +2686,13 @@ typedef union ii_ibna1_u {
2686 ************************************************************************/ 2686 ************************************************************************/
2687 2687
2688typedef union ii_ibia1_u { 2688typedef union ii_ibia1_u {
2689 uint64_t ii_ibia1_regval; 2689 u64 ii_ibia1_regval;
2690 struct { 2690 struct {
2691 uint64_t i_pi_id:1; 2691 u64 i_pi_id:1;
2692 uint64_t i_node_id:8; 2692 u64 i_node_id:8;
2693 uint64_t i_rsvd_1:7; 2693 u64 i_rsvd_1:7;
2694 uint64_t i_level:7; 2694 u64 i_level:7;
2695 uint64_t i_rsvd:41; 2695 u64 i_rsvd:41;
2696 } ii_ibia1_fld_s; 2696 } ii_ibia1_fld_s;
2697} ii_ibia1_u_t; 2697} ii_ibia1_u_t;
2698 2698
@@ -2712,12 +2712,12 @@ typedef union ii_ibia1_u {
2712 ************************************************************************/ 2712 ************************************************************************/
2713 2713
2714typedef union ii_ipcr_u { 2714typedef union ii_ipcr_u {
2715 uint64_t ii_ipcr_regval; 2715 u64 ii_ipcr_regval;
2716 struct { 2716 struct {
2717 uint64_t i_ippr0_c:4; 2717 u64 i_ippr0_c:4;
2718 uint64_t i_ippr1_c:4; 2718 u64 i_ippr1_c:4;
2719 uint64_t i_icct:8; 2719 u64 i_icct:8;
2720 uint64_t i_rsvd:48; 2720 u64 i_rsvd:48;
2721 } ii_ipcr_fld_s; 2721 } ii_ipcr_fld_s;
2722} ii_ipcr_u_t; 2722} ii_ipcr_u_t;
2723 2723
@@ -2728,10 +2728,10 @@ typedef union ii_ipcr_u {
2728 ************************************************************************/ 2728 ************************************************************************/
2729 2729
2730typedef union ii_ippr_u { 2730typedef union ii_ippr_u {
2731 uint64_t ii_ippr_regval; 2731 u64 ii_ippr_regval;
2732 struct { 2732 struct {
2733 uint64_t i_ippr0:32; 2733 u64 i_ippr0:32;
2734 uint64_t i_ippr1:32; 2734 u64 i_ippr1:32;
2735 } ii_ippr_fld_s; 2735 } ii_ippr_fld_s;
2736} ii_ippr_u_t; 2736} ii_ippr_u_t;
2737 2737
@@ -3267,15 +3267,15 @@ typedef ii_icrb0_e_u_t icrbe_t;
3267#define IO_PERF_SETS 32 3267#define IO_PERF_SETS 32
3268 3268
3269/* Bit for the widget in inbound access register */ 3269/* Bit for the widget in inbound access register */
3270#define IIO_IIWA_WIDGET(_w) ((uint64_t)(1ULL << _w)) 3270#define IIO_IIWA_WIDGET(_w) ((u64)(1ULL << _w))
3271/* Bit for the widget in outbound access register */ 3271/* Bit for the widget in outbound access register */
3272#define IIO_IOWA_WIDGET(_w) ((uint64_t)(1ULL << _w)) 3272#define IIO_IOWA_WIDGET(_w) ((u64)(1ULL << _w))
3273 3273
3274/* NOTE: The following define assumes that we are going to get 3274/* NOTE: The following define assumes that we are going to get
3275 * widget numbers from 8 thru F and the device numbers within 3275 * widget numbers from 8 thru F and the device numbers within
3276 * widget from 0 thru 7. 3276 * widget from 0 thru 7.
3277 */ 3277 */
3278#define IIO_IIDEM_WIDGETDEV_MASK(w, d) ((uint64_t)(1ULL << (8 * ((w) - 8) + (d)))) 3278#define IIO_IIDEM_WIDGETDEV_MASK(w, d) ((u64)(1ULL << (8 * ((w) - 8) + (d))))
3279 3279
3280/* IO Interrupt Destination Register */ 3280/* IO Interrupt Destination Register */
3281#define IIO_IIDSR_SENT_SHIFT 28 3281#define IIO_IIDSR_SENT_SHIFT 28
@@ -3302,9 +3302,9 @@ typedef ii_icrb0_e_u_t icrbe_t;
3302 */ 3302 */
3303 3303
3304typedef union hubii_wcr_u { 3304typedef union hubii_wcr_u {
3305 uint64_t wcr_reg_value; 3305 u64 wcr_reg_value;
3306 struct { 3306 struct {
3307 uint64_t wcr_widget_id:4, /* LLP crossbar credit */ 3307 u64 wcr_widget_id:4, /* LLP crossbar credit */
3308 wcr_tag_mode:1, /* Tag mode */ 3308 wcr_tag_mode:1, /* Tag mode */
3309 wcr_rsvd1:8, /* Reserved */ 3309 wcr_rsvd1:8, /* Reserved */
3310 wcr_xbar_crd:3, /* LLP crossbar credit */ 3310 wcr_xbar_crd:3, /* LLP crossbar credit */
@@ -3324,9 +3324,9 @@ performance registers */
3324 performed */ 3324 performed */
3325 3325
3326typedef union io_perf_sel { 3326typedef union io_perf_sel {
3327 uint64_t perf_sel_reg; 3327 u64 perf_sel_reg;
3328 struct { 3328 struct {
3329 uint64_t perf_ippr0:4, perf_ippr1:4, perf_icct:8, perf_rsvd:48; 3329 u64 perf_ippr0:4, perf_ippr1:4, perf_icct:8, perf_rsvd:48;
3330 } perf_sel_bits; 3330 } perf_sel_bits;
3331} io_perf_sel_t; 3331} io_perf_sel_t;
3332 3332
@@ -3334,24 +3334,24 @@ typedef union io_perf_sel {
3334 hardware problems there is only one counter, not two. */ 3334 hardware problems there is only one counter, not two. */
3335 3335
3336typedef union io_perf_cnt { 3336typedef union io_perf_cnt {
3337 uint64_t perf_cnt; 3337 u64 perf_cnt;
3338 struct { 3338 struct {
3339 uint64_t perf_cnt:20, perf_rsvd2:12, perf_rsvd1:32; 3339 u64 perf_cnt:20, perf_rsvd2:12, perf_rsvd1:32;
3340 } perf_cnt_bits; 3340 } perf_cnt_bits;
3341 3341
3342} io_perf_cnt_t; 3342} io_perf_cnt_t;
3343 3343
3344typedef union iprte_a { 3344typedef union iprte_a {
3345 uint64_t entry; 3345 u64 entry;
3346 struct { 3346 struct {
3347 uint64_t i_rsvd_1:3; 3347 u64 i_rsvd_1:3;
3348 uint64_t i_addr:38; 3348 u64 i_addr:38;
3349 uint64_t i_init:3; 3349 u64 i_init:3;
3350 uint64_t i_source:8; 3350 u64 i_source:8;
3351 uint64_t i_rsvd:2; 3351 u64 i_rsvd:2;
3352 uint64_t i_widget:4; 3352 u64 i_widget:4;
3353 uint64_t i_to_cnt:5; 3353 u64 i_to_cnt:5;
3354 uint64_t i_vld:1; 3354 u64 i_vld:1;
3355 } iprte_fields; 3355 } iprte_fields;
3356} iprte_a_t; 3356} iprte_a_t;
3357 3357
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index 2a8b0d92a5d6..e77f0c9b7d3d 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -75,7 +75,8 @@
75#define SN_SAL_IOIF_GET_HUBDEV_INFO 0x02000055 75#define SN_SAL_IOIF_GET_HUBDEV_INFO 0x02000055
76#define SN_SAL_IOIF_GET_PCIBUS_INFO 0x02000056 76#define SN_SAL_IOIF_GET_PCIBUS_INFO 0x02000056
77#define SN_SAL_IOIF_GET_PCIDEV_INFO 0x02000057 77#define SN_SAL_IOIF_GET_PCIDEV_INFO 0x02000057
78#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058 78#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058 // deprecated
79#define SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST 0x0200005a
79 80
80#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060 81#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060
81#define SN_SAL_BTE_RECOVER 0x02000061 82#define SN_SAL_BTE_RECOVER 0x02000061
@@ -272,7 +273,7 @@ ia64_sn_console_putc(char ch)
272 ret_stuff.v0 = 0; 273 ret_stuff.v0 = 0;
273 ret_stuff.v1 = 0; 274 ret_stuff.v1 = 0;
274 ret_stuff.v2 = 0; 275 ret_stuff.v2 = 0;
275 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTC, (uint64_t)ch, 0, 0, 0, 0, 0, 0); 276 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTC, (u64)ch, 0, 0, 0, 0, 0, 0);
276 277
277 return ret_stuff.status; 278 return ret_stuff.status;
278} 279}
@@ -289,7 +290,7 @@ ia64_sn_console_putb(const char *buf, int len)
289 ret_stuff.v0 = 0; 290 ret_stuff.v0 = 0;
290 ret_stuff.v1 = 0; 291 ret_stuff.v1 = 0;
291 ret_stuff.v2 = 0; 292 ret_stuff.v2 = 0;
292 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTB, (uint64_t)buf, (uint64_t)len, 0, 0, 0, 0, 0); 293 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_PUTB, (u64)buf, (u64)len, 0, 0, 0, 0, 0);
293 294
294 if ( ret_stuff.status == 0 ) { 295 if ( ret_stuff.status == 0 ) {
295 return ret_stuff.v0; 296 return ret_stuff.v0;
@@ -309,7 +310,7 @@ ia64_sn_plat_specific_err_print(int (*hook)(const char*, ...), char *rec)
309 ret_stuff.v0 = 0; 310 ret_stuff.v0 = 0;
310 ret_stuff.v1 = 0; 311 ret_stuff.v1 = 0;
311 ret_stuff.v2 = 0; 312 ret_stuff.v2 = 0;
312 SAL_CALL_REENTRANT(ret_stuff, SN_SAL_PRINT_ERROR, (uint64_t)hook, (uint64_t)rec, 0, 0, 0, 0, 0); 313 SAL_CALL_REENTRANT(ret_stuff, SN_SAL_PRINT_ERROR, (u64)hook, (u64)rec, 0, 0, 0, 0, 0);
313 314
314 return ret_stuff.status; 315 return ret_stuff.status;
315} 316}
@@ -397,7 +398,7 @@ ia64_sn_console_intr_status(void)
397 * Enable an interrupt on the SAL console device. 398 * Enable an interrupt on the SAL console device.
398 */ 399 */
399static inline void 400static inline void
400ia64_sn_console_intr_enable(uint64_t intr) 401ia64_sn_console_intr_enable(u64 intr)
401{ 402{
402 struct ia64_sal_retval ret_stuff; 403 struct ia64_sal_retval ret_stuff;
403 404
@@ -414,7 +415,7 @@ ia64_sn_console_intr_enable(uint64_t intr)
414 * Disable an interrupt on the SAL console device. 415 * Disable an interrupt on the SAL console device.
415 */ 416 */
416static inline void 417static inline void
417ia64_sn_console_intr_disable(uint64_t intr) 418ia64_sn_console_intr_disable(u64 intr)
418{ 419{
419 struct ia64_sal_retval ret_stuff; 420 struct ia64_sal_retval ret_stuff;
420 421
@@ -440,7 +441,7 @@ ia64_sn_console_xmit_chars(char *buf, int len)
440 ret_stuff.v1 = 0; 441 ret_stuff.v1 = 0;
441 ret_stuff.v2 = 0; 442 ret_stuff.v2 = 0;
442 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_XMIT_CHARS, 443 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_CONSOLE_XMIT_CHARS,
443 (uint64_t)buf, (uint64_t)len, 444 (u64)buf, (u64)len,
444 0, 0, 0, 0, 0); 445 0, 0, 0, 0, 0);
445 446
446 if (ret_stuff.status == 0) { 447 if (ret_stuff.status == 0) {
@@ -1100,7 +1101,7 @@ ia64_sn_bte_recovery(nasid_t nasid)
1100 struct ia64_sal_retval rv; 1101 struct ia64_sal_retval rv;
1101 1102
1102 rv.status = 0; 1103 rv.status = 0;
1103 SAL_CALL_NOLOCK(rv, SN_SAL_BTE_RECOVER, 0, 0, 0, 0, 0, 0, 0); 1104 SAL_CALL_NOLOCK(rv, SN_SAL_BTE_RECOVER, (u64)nasid, 0, 0, 0, 0, 0, 0);
1104 if (rv.status == SALRET_NOT_IMPLEMENTED) 1105 if (rv.status == SALRET_NOT_IMPLEMENTED)
1105 return 0; 1106 return 0;
1106 return (int) rv.status; 1107 return (int) rv.status;
diff --git a/include/asm-ia64/sn/tioca.h b/include/asm-ia64/sn/tioca.h
index bc1aacfb9483..666222d7f0f6 100644
--- a/include/asm-ia64/sn/tioca.h
+++ b/include/asm-ia64/sn/tioca.h
@@ -19,47 +19,47 @@
19 */ 19 */
20 20
21struct tioca { 21struct tioca {
22 uint64_t ca_id; /* 0x000000 */ 22 u64 ca_id; /* 0x000000 */
23 uint64_t ca_control1; /* 0x000008 */ 23 u64 ca_control1; /* 0x000008 */
24 uint64_t ca_control2; /* 0x000010 */ 24 u64 ca_control2; /* 0x000010 */
25 uint64_t ca_status1; /* 0x000018 */ 25 u64 ca_status1; /* 0x000018 */
26 uint64_t ca_status2; /* 0x000020 */ 26 u64 ca_status2; /* 0x000020 */
27 uint64_t ca_gart_aperature; /* 0x000028 */ 27 u64 ca_gart_aperature; /* 0x000028 */
28 uint64_t ca_gfx_detach; /* 0x000030 */ 28 u64 ca_gfx_detach; /* 0x000030 */
29 uint64_t ca_inta_dest_addr; /* 0x000038 */ 29 u64 ca_inta_dest_addr; /* 0x000038 */
30 uint64_t ca_intb_dest_addr; /* 0x000040 */ 30 u64 ca_intb_dest_addr; /* 0x000040 */
31 uint64_t ca_err_int_dest_addr; /* 0x000048 */ 31 u64 ca_err_int_dest_addr; /* 0x000048 */
32 uint64_t ca_int_status; /* 0x000050 */ 32 u64 ca_int_status; /* 0x000050 */
33 uint64_t ca_int_status_alias; /* 0x000058 */ 33 u64 ca_int_status_alias; /* 0x000058 */
34 uint64_t ca_mult_error; /* 0x000060 */ 34 u64 ca_mult_error; /* 0x000060 */
35 uint64_t ca_mult_error_alias; /* 0x000068 */ 35 u64 ca_mult_error_alias; /* 0x000068 */
36 uint64_t ca_first_error; /* 0x000070 */ 36 u64 ca_first_error; /* 0x000070 */
37 uint64_t ca_int_mask; /* 0x000078 */ 37 u64 ca_int_mask; /* 0x000078 */
38 uint64_t ca_crm_pkterr_type; /* 0x000080 */ 38 u64 ca_crm_pkterr_type; /* 0x000080 */
39 uint64_t ca_crm_pkterr_type_alias; /* 0x000088 */ 39 u64 ca_crm_pkterr_type_alias; /* 0x000088 */
40 uint64_t ca_crm_ct_error_detail_1; /* 0x000090 */ 40 u64 ca_crm_ct_error_detail_1; /* 0x000090 */
41 uint64_t ca_crm_ct_error_detail_2; /* 0x000098 */ 41 u64 ca_crm_ct_error_detail_2; /* 0x000098 */
42 uint64_t ca_crm_tnumto; /* 0x0000A0 */ 42 u64 ca_crm_tnumto; /* 0x0000A0 */
43 uint64_t ca_gart_err; /* 0x0000A8 */ 43 u64 ca_gart_err; /* 0x0000A8 */
44 uint64_t ca_pcierr_type; /* 0x0000B0 */ 44 u64 ca_pcierr_type; /* 0x0000B0 */
45 uint64_t ca_pcierr_addr; /* 0x0000B8 */ 45 u64 ca_pcierr_addr; /* 0x0000B8 */
46 46
47 uint64_t ca_pad_0000C0[3]; /* 0x0000{C0..D0} */ 47 u64 ca_pad_0000C0[3]; /* 0x0000{C0..D0} */
48 48
49 uint64_t ca_pci_rd_buf_flush; /* 0x0000D8 */ 49 u64 ca_pci_rd_buf_flush; /* 0x0000D8 */
50 uint64_t ca_pci_dma_addr_extn; /* 0x0000E0 */ 50 u64 ca_pci_dma_addr_extn; /* 0x0000E0 */
51 uint64_t ca_agp_dma_addr_extn; /* 0x0000E8 */ 51 u64 ca_agp_dma_addr_extn; /* 0x0000E8 */
52 uint64_t ca_force_inta; /* 0x0000F0 */ 52 u64 ca_force_inta; /* 0x0000F0 */
53 uint64_t ca_force_intb; /* 0x0000F8 */ 53 u64 ca_force_intb; /* 0x0000F8 */
54 uint64_t ca_debug_vector_sel; /* 0x000100 */ 54 u64 ca_debug_vector_sel; /* 0x000100 */
55 uint64_t ca_debug_mux_core_sel; /* 0x000108 */ 55 u64 ca_debug_mux_core_sel; /* 0x000108 */
56 uint64_t ca_debug_mux_pci_sel; /* 0x000110 */ 56 u64 ca_debug_mux_pci_sel; /* 0x000110 */
57 uint64_t ca_debug_domain_sel; /* 0x000118 */ 57 u64 ca_debug_domain_sel; /* 0x000118 */
58 58
59 uint64_t ca_pad_000120[28]; /* 0x0001{20..F8} */ 59 u64 ca_pad_000120[28]; /* 0x0001{20..F8} */
60 60
61 uint64_t ca_gart_ptr_table; /* 0x200 */ 61 u64 ca_gart_ptr_table; /* 0x200 */
62 uint64_t ca_gart_tlb_addr[8]; /* 0x2{08..40} */ 62 u64 ca_gart_tlb_addr[8]; /* 0x2{08..40} */
63}; 63};
64 64
65/* 65/*
diff --git a/include/asm-ia64/sn/tioca_provider.h b/include/asm-ia64/sn/tioca_provider.h
index b532ef6148ed..ab7fe2463468 100644
--- a/include/asm-ia64/sn/tioca_provider.h
+++ b/include/asm-ia64/sn/tioca_provider.h
@@ -56,31 +56,31 @@ struct tioca_kernel {
56 /* 56 /*
57 * General GART stuff 57 * General GART stuff
58 */ 58 */
59 uint64_t ca_ap_size; /* size of aperature in bytes */ 59 u64 ca_ap_size; /* size of aperature in bytes */
60 uint32_t ca_gart_entries; /* # uint64_t entries in gart */ 60 u32 ca_gart_entries; /* # u64 entries in gart */
61 uint32_t ca_ap_pagesize; /* aperature page size in bytes */ 61 u32 ca_ap_pagesize; /* aperature page size in bytes */
62 uint64_t ca_ap_bus_base; /* bus address of CA aperature */ 62 u64 ca_ap_bus_base; /* bus address of CA aperature */
63 uint64_t ca_gart_size; /* gart size in bytes */ 63 u64 ca_gart_size; /* gart size in bytes */
64 uint64_t *ca_gart; /* gart table vaddr */ 64 u64 *ca_gart; /* gart table vaddr */
65 uint64_t ca_gart_coretalk_addr; /* gart coretalk addr */ 65 u64 ca_gart_coretalk_addr; /* gart coretalk addr */
66 uint8_t ca_gart_iscoherent; /* used in tioca_tlbflush */ 66 u8 ca_gart_iscoherent; /* used in tioca_tlbflush */
67 67
68 /* PCI GART convenience values */ 68 /* PCI GART convenience values */
69 uint64_t ca_pciap_base; /* pci aperature bus base address */ 69 u64 ca_pciap_base; /* pci aperature bus base address */
70 uint64_t ca_pciap_size; /* pci aperature size (bytes) */ 70 u64 ca_pciap_size; /* pci aperature size (bytes) */
71 uint64_t ca_pcigart_base; /* gfx GART bus base address */ 71 u64 ca_pcigart_base; /* gfx GART bus base address */
72 uint64_t *ca_pcigart; /* gfx GART vm address */ 72 u64 *ca_pcigart; /* gfx GART vm address */
73 uint32_t ca_pcigart_entries; 73 u32 ca_pcigart_entries;
74 uint32_t ca_pcigart_start; /* PCI start index in ca_gart */ 74 u32 ca_pcigart_start; /* PCI start index in ca_gart */
75 void *ca_pcigart_pagemap; 75 void *ca_pcigart_pagemap;
76 76
77 /* AGP GART convenience values */ 77 /* AGP GART convenience values */
78 uint64_t ca_gfxap_base; /* gfx aperature bus base address */ 78 u64 ca_gfxap_base; /* gfx aperature bus base address */
79 uint64_t ca_gfxap_size; /* gfx aperature size (bytes) */ 79 u64 ca_gfxap_size; /* gfx aperature size (bytes) */
80 uint64_t ca_gfxgart_base; /* gfx GART bus base address */ 80 u64 ca_gfxgart_base; /* gfx GART bus base address */
81 uint64_t *ca_gfxgart; /* gfx GART vm address */ 81 u64 *ca_gfxgart; /* gfx GART vm address */
82 uint32_t ca_gfxgart_entries; 82 u32 ca_gfxgart_entries;
83 uint32_t ca_gfxgart_start; /* agpgart start index in ca_gart */ 83 u32 ca_gfxgart_start; /* agpgart start index in ca_gart */
84}; 84};
85 85
86/* 86/*
@@ -93,11 +93,11 @@ struct tioca_kernel {
93struct tioca_common { 93struct tioca_common {
94 struct pcibus_bussoft ca_common; /* common pciio header */ 94 struct pcibus_bussoft ca_common; /* common pciio header */
95 95
96 uint32_t ca_rev; 96 u32 ca_rev;
97 uint32_t ca_closest_nasid; 97 u32 ca_closest_nasid;
98 98
99 uint64_t ca_prom_private; 99 u64 ca_prom_private;
100 uint64_t ca_kernel_private; 100 u64 ca_kernel_private;
101}; 101};
102 102
103/** 103/**
@@ -139,9 +139,9 @@ tioca_paddr_to_gart(unsigned long paddr)
139 */ 139 */
140 140
141static inline unsigned long 141static inline unsigned long
142tioca_physpage_to_gart(uint64_t page_addr) 142tioca_physpage_to_gart(u64 page_addr)
143{ 143{
144 uint64_t coretalk_addr; 144 u64 coretalk_addr;
145 145
146 coretalk_addr = PHYS_TO_TIODMA(page_addr); 146 coretalk_addr = PHYS_TO_TIODMA(page_addr);
147 if (!coretalk_addr) { 147 if (!coretalk_addr) {
@@ -161,7 +161,7 @@ tioca_physpage_to_gart(uint64_t page_addr)
161static inline void 161static inline void
162tioca_tlbflush(struct tioca_kernel *tioca_kernel) 162tioca_tlbflush(struct tioca_kernel *tioca_kernel)
163{ 163{
164 volatile uint64_t tmp; 164 volatile u64 tmp;
165 volatile struct tioca *ca_base; 165 volatile struct tioca *ca_base;
166 struct tioca_common *tioca_common; 166 struct tioca_common *tioca_common;
167 167
@@ -200,7 +200,7 @@ tioca_tlbflush(struct tioca_kernel *tioca_kernel)
200 tmp = __sn_readq_relaxed(&ca_base->ca_control2); 200 tmp = __sn_readq_relaxed(&ca_base->ca_control2);
201} 201}
202 202
203extern uint32_t tioca_gart_found; 203extern u32 tioca_gart_found;
204extern struct list_head tioca_list; 204extern struct list_head tioca_list;
205extern int tioca_init_provider(void); 205extern int tioca_init_provider(void);
206extern void tioca_fastwrite_enable(struct tioca_kernel *tioca_kern); 206extern void tioca_fastwrite_enable(struct tioca_kernel *tioca_kern);
diff --git a/include/asm-ia64/sn/tioce.h b/include/asm-ia64/sn/tioce.h
index ecaddf960086..d4c990712eac 100644
--- a/include/asm-ia64/sn/tioce.h
+++ b/include/asm-ia64/sn/tioce.h
@@ -35,72 +35,72 @@ typedef volatile struct tioce {
35 /* 35 /*
36 * ADMIN : Administration Registers 36 * ADMIN : Administration Registers
37 */ 37 */
38 uint64_t ce_adm_id; /* 0x000000 */ 38 u64 ce_adm_id; /* 0x000000 */
39 uint64_t ce_pad_000008; /* 0x000008 */ 39 u64 ce_pad_000008; /* 0x000008 */
40 uint64_t ce_adm_dyn_credit_status; /* 0x000010 */ 40 u64 ce_adm_dyn_credit_status; /* 0x000010 */
41 uint64_t ce_adm_last_credit_status; /* 0x000018 */ 41 u64 ce_adm_last_credit_status; /* 0x000018 */
42 uint64_t ce_adm_credit_limit; /* 0x000020 */ 42 u64 ce_adm_credit_limit; /* 0x000020 */
43 uint64_t ce_adm_force_credit; /* 0x000028 */ 43 u64 ce_adm_force_credit; /* 0x000028 */
44 uint64_t ce_adm_control; /* 0x000030 */ 44 u64 ce_adm_control; /* 0x000030 */
45 uint64_t ce_adm_mmr_chn_timeout; /* 0x000038 */ 45 u64 ce_adm_mmr_chn_timeout; /* 0x000038 */
46 uint64_t ce_adm_ssp_ure_timeout; /* 0x000040 */ 46 u64 ce_adm_ssp_ure_timeout; /* 0x000040 */
47 uint64_t ce_adm_ssp_dre_timeout; /* 0x000048 */ 47 u64 ce_adm_ssp_dre_timeout; /* 0x000048 */
48 uint64_t ce_adm_ssp_debug_sel; /* 0x000050 */ 48 u64 ce_adm_ssp_debug_sel; /* 0x000050 */
49 uint64_t ce_adm_int_status; /* 0x000058 */ 49 u64 ce_adm_int_status; /* 0x000058 */
50 uint64_t ce_adm_int_status_alias; /* 0x000060 */ 50 u64 ce_adm_int_status_alias; /* 0x000060 */
51 uint64_t ce_adm_int_mask; /* 0x000068 */ 51 u64 ce_adm_int_mask; /* 0x000068 */
52 uint64_t ce_adm_int_pending; /* 0x000070 */ 52 u64 ce_adm_int_pending; /* 0x000070 */
53 uint64_t ce_adm_force_int; /* 0x000078 */ 53 u64 ce_adm_force_int; /* 0x000078 */
54 uint64_t ce_adm_ure_ups_buf_barrier_flush; /* 0x000080 */ 54 u64 ce_adm_ure_ups_buf_barrier_flush; /* 0x000080 */
55 uint64_t ce_adm_int_dest[15]; /* 0x000088 -- 0x0000F8 */ 55 u64 ce_adm_int_dest[15]; /* 0x000088 -- 0x0000F8 */
56 uint64_t ce_adm_error_summary; /* 0x000100 */ 56 u64 ce_adm_error_summary; /* 0x000100 */
57 uint64_t ce_adm_error_summary_alias; /* 0x000108 */ 57 u64 ce_adm_error_summary_alias; /* 0x000108 */
58 uint64_t ce_adm_error_mask; /* 0x000110 */ 58 u64 ce_adm_error_mask; /* 0x000110 */
59 uint64_t ce_adm_first_error; /* 0x000118 */ 59 u64 ce_adm_first_error; /* 0x000118 */
60 uint64_t ce_adm_error_overflow; /* 0x000120 */ 60 u64 ce_adm_error_overflow; /* 0x000120 */
61 uint64_t ce_adm_error_overflow_alias; /* 0x000128 */ 61 u64 ce_adm_error_overflow_alias; /* 0x000128 */
62 uint64_t ce_pad_000130[2]; /* 0x000130 -- 0x000138 */ 62 u64 ce_pad_000130[2]; /* 0x000130 -- 0x000138 */
63 uint64_t ce_adm_tnum_error; /* 0x000140 */ 63 u64 ce_adm_tnum_error; /* 0x000140 */
64 uint64_t ce_adm_mmr_err_detail; /* 0x000148 */ 64 u64 ce_adm_mmr_err_detail; /* 0x000148 */
65 uint64_t ce_adm_msg_sram_perr_detail; /* 0x000150 */ 65 u64 ce_adm_msg_sram_perr_detail; /* 0x000150 */
66 uint64_t ce_adm_bap_sram_perr_detail; /* 0x000158 */ 66 u64 ce_adm_bap_sram_perr_detail; /* 0x000158 */
67 uint64_t ce_adm_ce_sram_perr_detail; /* 0x000160 */ 67 u64 ce_adm_ce_sram_perr_detail; /* 0x000160 */
68 uint64_t ce_adm_ce_credit_oflow_detail; /* 0x000168 */ 68 u64 ce_adm_ce_credit_oflow_detail; /* 0x000168 */
69 uint64_t ce_adm_tx_link_idle_max_timer; /* 0x000170 */ 69 u64 ce_adm_tx_link_idle_max_timer; /* 0x000170 */
70 uint64_t ce_adm_pcie_debug_sel; /* 0x000178 */ 70 u64 ce_adm_pcie_debug_sel; /* 0x000178 */
71 uint64_t ce_pad_000180[16]; /* 0x000180 -- 0x0001F8 */ 71 u64 ce_pad_000180[16]; /* 0x000180 -- 0x0001F8 */
72 72
73 uint64_t ce_adm_pcie_debug_sel_top; /* 0x000200 */ 73 u64 ce_adm_pcie_debug_sel_top; /* 0x000200 */
74 uint64_t ce_adm_pcie_debug_lat_sel_lo_top; /* 0x000208 */ 74 u64 ce_adm_pcie_debug_lat_sel_lo_top; /* 0x000208 */
75 uint64_t ce_adm_pcie_debug_lat_sel_hi_top; /* 0x000210 */ 75 u64 ce_adm_pcie_debug_lat_sel_hi_top; /* 0x000210 */
76 uint64_t ce_adm_pcie_debug_trig_sel_top; /* 0x000218 */ 76 u64 ce_adm_pcie_debug_trig_sel_top; /* 0x000218 */
77 uint64_t ce_adm_pcie_debug_trig_lat_sel_lo_top; /* 0x000220 */ 77 u64 ce_adm_pcie_debug_trig_lat_sel_lo_top; /* 0x000220 */
78 uint64_t ce_adm_pcie_debug_trig_lat_sel_hi_top; /* 0x000228 */ 78 u64 ce_adm_pcie_debug_trig_lat_sel_hi_top; /* 0x000228 */
79 uint64_t ce_adm_pcie_trig_compare_top; /* 0x000230 */ 79 u64 ce_adm_pcie_trig_compare_top; /* 0x000230 */
80 uint64_t ce_adm_pcie_trig_compare_en_top; /* 0x000238 */ 80 u64 ce_adm_pcie_trig_compare_en_top; /* 0x000238 */
81 uint64_t ce_adm_ssp_debug_sel_top; /* 0x000240 */ 81 u64 ce_adm_ssp_debug_sel_top; /* 0x000240 */
82 uint64_t ce_adm_ssp_debug_lat_sel_lo_top; /* 0x000248 */ 82 u64 ce_adm_ssp_debug_lat_sel_lo_top; /* 0x000248 */
83 uint64_t ce_adm_ssp_debug_lat_sel_hi_top; /* 0x000250 */ 83 u64 ce_adm_ssp_debug_lat_sel_hi_top; /* 0x000250 */
84 uint64_t ce_adm_ssp_debug_trig_sel_top; /* 0x000258 */ 84 u64 ce_adm_ssp_debug_trig_sel_top; /* 0x000258 */
85 uint64_t ce_adm_ssp_debug_trig_lat_sel_lo_top; /* 0x000260 */ 85 u64 ce_adm_ssp_debug_trig_lat_sel_lo_top; /* 0x000260 */
86 uint64_t ce_adm_ssp_debug_trig_lat_sel_hi_top; /* 0x000268 */ 86 u64 ce_adm_ssp_debug_trig_lat_sel_hi_top; /* 0x000268 */
87 uint64_t ce_adm_ssp_trig_compare_top; /* 0x000270 */ 87 u64 ce_adm_ssp_trig_compare_top; /* 0x000270 */
88 uint64_t ce_adm_ssp_trig_compare_en_top; /* 0x000278 */ 88 u64 ce_adm_ssp_trig_compare_en_top; /* 0x000278 */
89 uint64_t ce_pad_000280[48]; /* 0x000280 -- 0x0003F8 */ 89 u64 ce_pad_000280[48]; /* 0x000280 -- 0x0003F8 */
90 90
91 uint64_t ce_adm_bap_ctrl; /* 0x000400 */ 91 u64 ce_adm_bap_ctrl; /* 0x000400 */
92 uint64_t ce_pad_000408[127]; /* 0x000408 -- 0x0007F8 */ 92 u64 ce_pad_000408[127]; /* 0x000408 -- 0x0007F8 */
93 93
94 uint64_t ce_msg_buf_data63_0[35]; /* 0x000800 -- 0x000918 */ 94 u64 ce_msg_buf_data63_0[35]; /* 0x000800 -- 0x000918 */
95 uint64_t ce_pad_000920[29]; /* 0x000920 -- 0x0009F8 */ 95 u64 ce_pad_000920[29]; /* 0x000920 -- 0x0009F8 */
96 96
97 uint64_t ce_msg_buf_data127_64[35]; /* 0x000A00 -- 0x000B18 */ 97 u64 ce_msg_buf_data127_64[35]; /* 0x000A00 -- 0x000B18 */
98 uint64_t ce_pad_000B20[29]; /* 0x000B20 -- 0x000BF8 */ 98 u64 ce_pad_000B20[29]; /* 0x000B20 -- 0x000BF8 */
99 99
100 uint64_t ce_msg_buf_parity[35]; /* 0x000C00 -- 0x000D18 */ 100 u64 ce_msg_buf_parity[35]; /* 0x000C00 -- 0x000D18 */
101 uint64_t ce_pad_000D20[29]; /* 0x000D20 -- 0x000DF8 */ 101 u64 ce_pad_000D20[29]; /* 0x000D20 -- 0x000DF8 */
102 102
103 uint64_t ce_pad_000E00[576]; /* 0x000E00 -- 0x001FF8 */ 103 u64 ce_pad_000E00[576]; /* 0x000E00 -- 0x001FF8 */
104 104
105 /* 105 /*
106 * LSI : LSI's PCI Express Link Registers (Link#1 and Link#2) 106 * LSI : LSI's PCI Express Link Registers (Link#1 and Link#2)
@@ -109,141 +109,141 @@ typedef volatile struct tioce {
109 */ 109 */
110 #define ce_lsi(link_num) ce_lsi[link_num-1] 110 #define ce_lsi(link_num) ce_lsi[link_num-1]
111 struct ce_lsi_reg { 111 struct ce_lsi_reg {
112 uint64_t ce_lsi_lpu_id; /* 0x00z000 */ 112 u64 ce_lsi_lpu_id; /* 0x00z000 */
113 uint64_t ce_lsi_rst; /* 0x00z008 */ 113 u64 ce_lsi_rst; /* 0x00z008 */
114 uint64_t ce_lsi_dbg_stat; /* 0x00z010 */ 114 u64 ce_lsi_dbg_stat; /* 0x00z010 */
115 uint64_t ce_lsi_dbg_cfg; /* 0x00z018 */ 115 u64 ce_lsi_dbg_cfg; /* 0x00z018 */
116 uint64_t ce_lsi_ltssm_ctrl; /* 0x00z020 */ 116 u64 ce_lsi_ltssm_ctrl; /* 0x00z020 */
117 uint64_t ce_lsi_lk_stat; /* 0x00z028 */ 117 u64 ce_lsi_lk_stat; /* 0x00z028 */
118 uint64_t ce_pad_00z030[2]; /* 0x00z030 -- 0x00z038 */ 118 u64 ce_pad_00z030[2]; /* 0x00z030 -- 0x00z038 */
119 uint64_t ce_lsi_int_and_stat; /* 0x00z040 */ 119 u64 ce_lsi_int_and_stat; /* 0x00z040 */
120 uint64_t ce_lsi_int_mask; /* 0x00z048 */ 120 u64 ce_lsi_int_mask; /* 0x00z048 */
121 uint64_t ce_pad_00z050[22]; /* 0x00z050 -- 0x00z0F8 */ 121 u64 ce_pad_00z050[22]; /* 0x00z050 -- 0x00z0F8 */
122 uint64_t ce_lsi_lk_perf_cnt_sel; /* 0x00z100 */ 122 u64 ce_lsi_lk_perf_cnt_sel; /* 0x00z100 */
123 uint64_t ce_pad_00z108; /* 0x00z108 */ 123 u64 ce_pad_00z108; /* 0x00z108 */
124 uint64_t ce_lsi_lk_perf_cnt_ctrl; /* 0x00z110 */ 124 u64 ce_lsi_lk_perf_cnt_ctrl; /* 0x00z110 */
125 uint64_t ce_pad_00z118; /* 0x00z118 */ 125 u64 ce_pad_00z118; /* 0x00z118 */
126 uint64_t ce_lsi_lk_perf_cnt1; /* 0x00z120 */ 126 u64 ce_lsi_lk_perf_cnt1; /* 0x00z120 */
127 uint64_t ce_lsi_lk_perf_cnt1_test; /* 0x00z128 */ 127 u64 ce_lsi_lk_perf_cnt1_test; /* 0x00z128 */
128 uint64_t ce_lsi_lk_perf_cnt2; /* 0x00z130 */ 128 u64 ce_lsi_lk_perf_cnt2; /* 0x00z130 */
129 uint64_t ce_lsi_lk_perf_cnt2_test; /* 0x00z138 */ 129 u64 ce_lsi_lk_perf_cnt2_test; /* 0x00z138 */
130 uint64_t ce_pad_00z140[24]; /* 0x00z140 -- 0x00z1F8 */ 130 u64 ce_pad_00z140[24]; /* 0x00z140 -- 0x00z1F8 */
131 uint64_t ce_lsi_lk_lyr_cfg; /* 0x00z200 */ 131 u64 ce_lsi_lk_lyr_cfg; /* 0x00z200 */
132 uint64_t ce_lsi_lk_lyr_status; /* 0x00z208 */ 132 u64 ce_lsi_lk_lyr_status; /* 0x00z208 */
133 uint64_t ce_lsi_lk_lyr_int_stat; /* 0x00z210 */ 133 u64 ce_lsi_lk_lyr_int_stat; /* 0x00z210 */
134 uint64_t ce_lsi_lk_ly_int_stat_test; /* 0x00z218 */ 134 u64 ce_lsi_lk_ly_int_stat_test; /* 0x00z218 */
135 uint64_t ce_lsi_lk_ly_int_stat_mask; /* 0x00z220 */ 135 u64 ce_lsi_lk_ly_int_stat_mask; /* 0x00z220 */
136 uint64_t ce_pad_00z228[3]; /* 0x00z228 -- 0x00z238 */ 136 u64 ce_pad_00z228[3]; /* 0x00z228 -- 0x00z238 */
137 uint64_t ce_lsi_fc_upd_ctl; /* 0x00z240 */ 137 u64 ce_lsi_fc_upd_ctl; /* 0x00z240 */
138 uint64_t ce_pad_00z248[3]; /* 0x00z248 -- 0x00z258 */ 138 u64 ce_pad_00z248[3]; /* 0x00z248 -- 0x00z258 */
139 uint64_t ce_lsi_flw_ctl_upd_to_timer; /* 0x00z260 */ 139 u64 ce_lsi_flw_ctl_upd_to_timer; /* 0x00z260 */
140 uint64_t ce_lsi_flw_ctl_upd_timer0; /* 0x00z268 */ 140 u64 ce_lsi_flw_ctl_upd_timer0; /* 0x00z268 */
141 uint64_t ce_lsi_flw_ctl_upd_timer1; /* 0x00z270 */ 141 u64 ce_lsi_flw_ctl_upd_timer1; /* 0x00z270 */
142 uint64_t ce_pad_00z278[49]; /* 0x00z278 -- 0x00z3F8 */ 142 u64 ce_pad_00z278[49]; /* 0x00z278 -- 0x00z3F8 */
143 uint64_t ce_lsi_freq_nak_lat_thrsh; /* 0x00z400 */ 143 u64 ce_lsi_freq_nak_lat_thrsh; /* 0x00z400 */
144 uint64_t ce_lsi_ack_nak_lat_tmr; /* 0x00z408 */ 144 u64 ce_lsi_ack_nak_lat_tmr; /* 0x00z408 */
145 uint64_t ce_lsi_rply_tmr_thr; /* 0x00z410 */ 145 u64 ce_lsi_rply_tmr_thr; /* 0x00z410 */
146 uint64_t ce_lsi_rply_tmr; /* 0x00z418 */ 146 u64 ce_lsi_rply_tmr; /* 0x00z418 */
147 uint64_t ce_lsi_rply_num_stat; /* 0x00z420 */ 147 u64 ce_lsi_rply_num_stat; /* 0x00z420 */
148 uint64_t ce_lsi_rty_buf_max_addr; /* 0x00z428 */ 148 u64 ce_lsi_rty_buf_max_addr; /* 0x00z428 */
149 uint64_t ce_lsi_rty_fifo_ptr; /* 0x00z430 */ 149 u64 ce_lsi_rty_fifo_ptr; /* 0x00z430 */
150 uint64_t ce_lsi_rty_fifo_rd_wr_ptr; /* 0x00z438 */ 150 u64 ce_lsi_rty_fifo_rd_wr_ptr; /* 0x00z438 */
151 uint64_t ce_lsi_rty_fifo_cred; /* 0x00z440 */ 151 u64 ce_lsi_rty_fifo_cred; /* 0x00z440 */
152 uint64_t ce_lsi_seq_cnt; /* 0x00z448 */ 152 u64 ce_lsi_seq_cnt; /* 0x00z448 */
153 uint64_t ce_lsi_ack_sent_seq_num; /* 0x00z450 */ 153 u64 ce_lsi_ack_sent_seq_num; /* 0x00z450 */
154 uint64_t ce_lsi_seq_cnt_fifo_max_addr; /* 0x00z458 */ 154 u64 ce_lsi_seq_cnt_fifo_max_addr; /* 0x00z458 */
155 uint64_t ce_lsi_seq_cnt_fifo_ptr; /* 0x00z460 */ 155 u64 ce_lsi_seq_cnt_fifo_ptr; /* 0x00z460 */
156 uint64_t ce_lsi_seq_cnt_rd_wr_ptr; /* 0x00z468 */ 156 u64 ce_lsi_seq_cnt_rd_wr_ptr; /* 0x00z468 */
157 uint64_t ce_lsi_tx_lk_ts_ctl; /* 0x00z470 */ 157 u64 ce_lsi_tx_lk_ts_ctl; /* 0x00z470 */
158 uint64_t ce_pad_00z478; /* 0x00z478 */ 158 u64 ce_pad_00z478; /* 0x00z478 */
159 uint64_t ce_lsi_mem_addr_ctl; /* 0x00z480 */ 159 u64 ce_lsi_mem_addr_ctl; /* 0x00z480 */
160 uint64_t ce_lsi_mem_d_ld0; /* 0x00z488 */ 160 u64 ce_lsi_mem_d_ld0; /* 0x00z488 */
161 uint64_t ce_lsi_mem_d_ld1; /* 0x00z490 */ 161 u64 ce_lsi_mem_d_ld1; /* 0x00z490 */
162 uint64_t ce_lsi_mem_d_ld2; /* 0x00z498 */ 162 u64 ce_lsi_mem_d_ld2; /* 0x00z498 */
163 uint64_t ce_lsi_mem_d_ld3; /* 0x00z4A0 */ 163 u64 ce_lsi_mem_d_ld3; /* 0x00z4A0 */
164 uint64_t ce_lsi_mem_d_ld4; /* 0x00z4A8 */ 164 u64 ce_lsi_mem_d_ld4; /* 0x00z4A8 */
165 uint64_t ce_pad_00z4B0[2]; /* 0x00z4B0 -- 0x00z4B8 */ 165 u64 ce_pad_00z4B0[2]; /* 0x00z4B0 -- 0x00z4B8 */
166 uint64_t ce_lsi_rty_d_cnt; /* 0x00z4C0 */ 166 u64 ce_lsi_rty_d_cnt; /* 0x00z4C0 */
167 uint64_t ce_lsi_seq_buf_cnt; /* 0x00z4C8 */ 167 u64 ce_lsi_seq_buf_cnt; /* 0x00z4C8 */
168 uint64_t ce_lsi_seq_buf_bt_d; /* 0x00z4D0 */ 168 u64 ce_lsi_seq_buf_bt_d; /* 0x00z4D0 */
169 uint64_t ce_pad_00z4D8; /* 0x00z4D8 */ 169 u64 ce_pad_00z4D8; /* 0x00z4D8 */
170 uint64_t ce_lsi_ack_lat_thr; /* 0x00z4E0 */ 170 u64 ce_lsi_ack_lat_thr; /* 0x00z4E0 */
171 uint64_t ce_pad_00z4E8[3]; /* 0x00z4E8 -- 0x00z4F8 */ 171 u64 ce_pad_00z4E8[3]; /* 0x00z4E8 -- 0x00z4F8 */
172 uint64_t ce_lsi_nxt_rcv_seq_1_cntr; /* 0x00z500 */ 172 u64 ce_lsi_nxt_rcv_seq_1_cntr; /* 0x00z500 */
173 uint64_t ce_lsi_unsp_dllp_rcvd; /* 0x00z508 */ 173 u64 ce_lsi_unsp_dllp_rcvd; /* 0x00z508 */
174 uint64_t ce_lsi_rcv_lk_ts_ctl; /* 0x00z510 */ 174 u64 ce_lsi_rcv_lk_ts_ctl; /* 0x00z510 */
175 uint64_t ce_pad_00z518[29]; /* 0x00z518 -- 0x00z5F8 */ 175 u64 ce_pad_00z518[29]; /* 0x00z518 -- 0x00z5F8 */
176 uint64_t ce_lsi_phy_lyr_cfg; /* 0x00z600 */ 176 u64 ce_lsi_phy_lyr_cfg; /* 0x00z600 */
177 uint64_t ce_pad_00z608; /* 0x00z608 */ 177 u64 ce_pad_00z608; /* 0x00z608 */
178 uint64_t ce_lsi_phy_lyr_int_stat; /* 0x00z610 */ 178 u64 ce_lsi_phy_lyr_int_stat; /* 0x00z610 */
179 uint64_t ce_lsi_phy_lyr_int_stat_test; /* 0x00z618 */ 179 u64 ce_lsi_phy_lyr_int_stat_test; /* 0x00z618 */
180 uint64_t ce_lsi_phy_lyr_int_mask; /* 0x00z620 */ 180 u64 ce_lsi_phy_lyr_int_mask; /* 0x00z620 */
181 uint64_t ce_pad_00z628[11]; /* 0x00z628 -- 0x00z678 */ 181 u64 ce_pad_00z628[11]; /* 0x00z628 -- 0x00z678 */
182 uint64_t ce_lsi_rcv_phy_cfg; /* 0x00z680 */ 182 u64 ce_lsi_rcv_phy_cfg; /* 0x00z680 */
183 uint64_t ce_lsi_rcv_phy_stat1; /* 0x00z688 */ 183 u64 ce_lsi_rcv_phy_stat1; /* 0x00z688 */
184 uint64_t ce_lsi_rcv_phy_stat2; /* 0x00z690 */ 184 u64 ce_lsi_rcv_phy_stat2; /* 0x00z690 */
185 uint64_t ce_lsi_rcv_phy_stat3; /* 0x00z698 */ 185 u64 ce_lsi_rcv_phy_stat3; /* 0x00z698 */
186 uint64_t ce_lsi_rcv_phy_int_stat; /* 0x00z6A0 */ 186 u64 ce_lsi_rcv_phy_int_stat; /* 0x00z6A0 */
187 uint64_t ce_lsi_rcv_phy_int_stat_test; /* 0x00z6A8 */ 187 u64 ce_lsi_rcv_phy_int_stat_test; /* 0x00z6A8 */
188 uint64_t ce_lsi_rcv_phy_int_mask; /* 0x00z6B0 */ 188 u64 ce_lsi_rcv_phy_int_mask; /* 0x00z6B0 */
189 uint64_t ce_pad_00z6B8[9]; /* 0x00z6B8 -- 0x00z6F8 */ 189 u64 ce_pad_00z6B8[9]; /* 0x00z6B8 -- 0x00z6F8 */
190 uint64_t ce_lsi_tx_phy_cfg; /* 0x00z700 */ 190 u64 ce_lsi_tx_phy_cfg; /* 0x00z700 */
191 uint64_t ce_lsi_tx_phy_stat; /* 0x00z708 */ 191 u64 ce_lsi_tx_phy_stat; /* 0x00z708 */
192 uint64_t ce_lsi_tx_phy_int_stat; /* 0x00z710 */ 192 u64 ce_lsi_tx_phy_int_stat; /* 0x00z710 */
193 uint64_t ce_lsi_tx_phy_int_stat_test; /* 0x00z718 */ 193 u64 ce_lsi_tx_phy_int_stat_test; /* 0x00z718 */
194 uint64_t ce_lsi_tx_phy_int_mask; /* 0x00z720 */ 194 u64 ce_lsi_tx_phy_int_mask; /* 0x00z720 */
195 uint64_t ce_lsi_tx_phy_stat2; /* 0x00z728 */ 195 u64 ce_lsi_tx_phy_stat2; /* 0x00z728 */
196 uint64_t ce_pad_00z730[10]; /* 0x00z730 -- 0x00z77F */ 196 u64 ce_pad_00z730[10]; /* 0x00z730 -- 0x00z77F */
197 uint64_t ce_lsi_ltssm_cfg1; /* 0x00z780 */ 197 u64 ce_lsi_ltssm_cfg1; /* 0x00z780 */
198 uint64_t ce_lsi_ltssm_cfg2; /* 0x00z788 */ 198 u64 ce_lsi_ltssm_cfg2; /* 0x00z788 */
199 uint64_t ce_lsi_ltssm_cfg3; /* 0x00z790 */ 199 u64 ce_lsi_ltssm_cfg3; /* 0x00z790 */
200 uint64_t ce_lsi_ltssm_cfg4; /* 0x00z798 */ 200 u64 ce_lsi_ltssm_cfg4; /* 0x00z798 */
201 uint64_t ce_lsi_ltssm_cfg5; /* 0x00z7A0 */ 201 u64 ce_lsi_ltssm_cfg5; /* 0x00z7A0 */
202 uint64_t ce_lsi_ltssm_stat1; /* 0x00z7A8 */ 202 u64 ce_lsi_ltssm_stat1; /* 0x00z7A8 */
203 uint64_t ce_lsi_ltssm_stat2; /* 0x00z7B0 */ 203 u64 ce_lsi_ltssm_stat2; /* 0x00z7B0 */
204 uint64_t ce_lsi_ltssm_int_stat; /* 0x00z7B8 */ 204 u64 ce_lsi_ltssm_int_stat; /* 0x00z7B8 */
205 uint64_t ce_lsi_ltssm_int_stat_test; /* 0x00z7C0 */ 205 u64 ce_lsi_ltssm_int_stat_test; /* 0x00z7C0 */
206 uint64_t ce_lsi_ltssm_int_mask; /* 0x00z7C8 */ 206 u64 ce_lsi_ltssm_int_mask; /* 0x00z7C8 */
207 uint64_t ce_lsi_ltssm_stat_wr_en; /* 0x00z7D0 */ 207 u64 ce_lsi_ltssm_stat_wr_en; /* 0x00z7D0 */
208 uint64_t ce_pad_00z7D8[5]; /* 0x00z7D8 -- 0x00z7F8 */ 208 u64 ce_pad_00z7D8[5]; /* 0x00z7D8 -- 0x00z7F8 */
209 uint64_t ce_lsi_gb_cfg1; /* 0x00z800 */ 209 u64 ce_lsi_gb_cfg1; /* 0x00z800 */
210 uint64_t ce_lsi_gb_cfg2; /* 0x00z808 */ 210 u64 ce_lsi_gb_cfg2; /* 0x00z808 */
211 uint64_t ce_lsi_gb_cfg3; /* 0x00z810 */ 211 u64 ce_lsi_gb_cfg3; /* 0x00z810 */
212 uint64_t ce_lsi_gb_cfg4; /* 0x00z818 */ 212 u64 ce_lsi_gb_cfg4; /* 0x00z818 */
213 uint64_t ce_lsi_gb_stat; /* 0x00z820 */ 213 u64 ce_lsi_gb_stat; /* 0x00z820 */
214 uint64_t ce_lsi_gb_int_stat; /* 0x00z828 */ 214 u64 ce_lsi_gb_int_stat; /* 0x00z828 */
215 uint64_t ce_lsi_gb_int_stat_test; /* 0x00z830 */ 215 u64 ce_lsi_gb_int_stat_test; /* 0x00z830 */
216 uint64_t ce_lsi_gb_int_mask; /* 0x00z838 */ 216 u64 ce_lsi_gb_int_mask; /* 0x00z838 */
217 uint64_t ce_lsi_gb_pwr_dn1; /* 0x00z840 */ 217 u64 ce_lsi_gb_pwr_dn1; /* 0x00z840 */
218 uint64_t ce_lsi_gb_pwr_dn2; /* 0x00z848 */ 218 u64 ce_lsi_gb_pwr_dn2; /* 0x00z848 */
219 uint64_t ce_pad_00z850[246]; /* 0x00z850 -- 0x00zFF8 */ 219 u64 ce_pad_00z850[246]; /* 0x00z850 -- 0x00zFF8 */
220 } ce_lsi[2]; 220 } ce_lsi[2];
221 221
222 uint64_t ce_pad_004000[10]; /* 0x004000 -- 0x004048 */ 222 u64 ce_pad_004000[10]; /* 0x004000 -- 0x004048 */
223 223
224 /* 224 /*
225 * CRM: Coretalk Receive Module Registers 225 * CRM: Coretalk Receive Module Registers
226 */ 226 */
227 uint64_t ce_crm_debug_mux; /* 0x004050 */ 227 u64 ce_crm_debug_mux; /* 0x004050 */
228 uint64_t ce_pad_004058; /* 0x004058 */ 228 u64 ce_pad_004058; /* 0x004058 */
229 uint64_t ce_crm_ssp_err_cmd_wrd; /* 0x004060 */ 229 u64 ce_crm_ssp_err_cmd_wrd; /* 0x004060 */
230 uint64_t ce_crm_ssp_err_addr; /* 0x004068 */ 230 u64 ce_crm_ssp_err_addr; /* 0x004068 */
231 uint64_t ce_crm_ssp_err_syn; /* 0x004070 */ 231 u64 ce_crm_ssp_err_syn; /* 0x004070 */
232 232
233 uint64_t ce_pad_004078[499]; /* 0x004078 -- 0x005008 */ 233 u64 ce_pad_004078[499]; /* 0x004078 -- 0x005008 */
234 234
235 /* 235 /*
236 * CXM: Coretalk Xmit Module Registers 236 * CXM: Coretalk Xmit Module Registers
237 */ 237 */
238 uint64_t ce_cxm_dyn_credit_status; /* 0x005010 */ 238 u64 ce_cxm_dyn_credit_status; /* 0x005010 */
239 uint64_t ce_cxm_last_credit_status; /* 0x005018 */ 239 u64 ce_cxm_last_credit_status; /* 0x005018 */
240 uint64_t ce_cxm_credit_limit; /* 0x005020 */ 240 u64 ce_cxm_credit_limit; /* 0x005020 */
241 uint64_t ce_cxm_force_credit; /* 0x005028 */ 241 u64 ce_cxm_force_credit; /* 0x005028 */
242 uint64_t ce_cxm_disable_bypass; /* 0x005030 */ 242 u64 ce_cxm_disable_bypass; /* 0x005030 */
243 uint64_t ce_pad_005038[3]; /* 0x005038 -- 0x005048 */ 243 u64 ce_pad_005038[3]; /* 0x005038 -- 0x005048 */
244 uint64_t ce_cxm_debug_mux; /* 0x005050 */ 244 u64 ce_cxm_debug_mux; /* 0x005050 */
245 245
246 uint64_t ce_pad_005058[501]; /* 0x005058 -- 0x005FF8 */ 246 u64 ce_pad_005058[501]; /* 0x005058 -- 0x005FF8 */
247 247
248 /* 248 /*
249 * DTL: Downstream Transaction Layer Regs (Link#1 and Link#2) 249 * DTL: Downstream Transaction Layer Regs (Link#1 and Link#2)
@@ -258,209 +258,209 @@ typedef volatile struct tioce {
258 #define ce_utl(link_num) ce_dtl_utl[link_num-1] 258 #define ce_utl(link_num) ce_dtl_utl[link_num-1]
259 struct ce_dtl_utl_reg { 259 struct ce_dtl_utl_reg {
260 /* DTL */ 260 /* DTL */
261 uint64_t ce_dtl_dtdr_credit_limit; /* 0x00y000 */ 261 u64 ce_dtl_dtdr_credit_limit; /* 0x00y000 */
262 uint64_t ce_dtl_dtdr_credit_force; /* 0x00y008 */ 262 u64 ce_dtl_dtdr_credit_force; /* 0x00y008 */
263 uint64_t ce_dtl_dyn_credit_status; /* 0x00y010 */ 263 u64 ce_dtl_dyn_credit_status; /* 0x00y010 */
264 uint64_t ce_dtl_dtl_last_credit_stat; /* 0x00y018 */ 264 u64 ce_dtl_dtl_last_credit_stat; /* 0x00y018 */
265 uint64_t ce_dtl_dtl_ctrl; /* 0x00y020 */ 265 u64 ce_dtl_dtl_ctrl; /* 0x00y020 */
266 uint64_t ce_pad_00y028[5]; /* 0x00y028 -- 0x00y048 */ 266 u64 ce_pad_00y028[5]; /* 0x00y028 -- 0x00y048 */
267 uint64_t ce_dtl_debug_sel; /* 0x00y050 */ 267 u64 ce_dtl_debug_sel; /* 0x00y050 */
268 uint64_t ce_pad_00y058[501]; /* 0x00y058 -- 0x00yFF8 */ 268 u64 ce_pad_00y058[501]; /* 0x00y058 -- 0x00yFF8 */
269 269
270 /* UTL */ 270 /* UTL */
271 uint64_t ce_utl_utl_ctrl; /* 0x00z000 */ 271 u64 ce_utl_utl_ctrl; /* 0x00z000 */
272 uint64_t ce_utl_debug_sel; /* 0x00z008 */ 272 u64 ce_utl_debug_sel; /* 0x00z008 */
273 uint64_t ce_pad_00z010[510]; /* 0x00z010 -- 0x00zFF8 */ 273 u64 ce_pad_00z010[510]; /* 0x00z010 -- 0x00zFF8 */
274 } ce_dtl_utl[2]; 274 } ce_dtl_utl[2];
275 275
276 uint64_t ce_pad_00A000[514]; /* 0x00A000 -- 0x00B008 */ 276 u64 ce_pad_00A000[514]; /* 0x00A000 -- 0x00B008 */
277 277
278 /* 278 /*
279 * URE: Upstream Request Engine 279 * URE: Upstream Request Engine
280 */ 280 */
281 uint64_t ce_ure_dyn_credit_status; /* 0x00B010 */ 281 u64 ce_ure_dyn_credit_status; /* 0x00B010 */
282 uint64_t ce_ure_last_credit_status; /* 0x00B018 */ 282 u64 ce_ure_last_credit_status; /* 0x00B018 */
283 uint64_t ce_ure_credit_limit; /* 0x00B020 */ 283 u64 ce_ure_credit_limit; /* 0x00B020 */
284 uint64_t ce_pad_00B028; /* 0x00B028 */ 284 u64 ce_pad_00B028; /* 0x00B028 */
285 uint64_t ce_ure_control; /* 0x00B030 */ 285 u64 ce_ure_control; /* 0x00B030 */
286 uint64_t ce_ure_status; /* 0x00B038 */ 286 u64 ce_ure_status; /* 0x00B038 */
287 uint64_t ce_pad_00B040[2]; /* 0x00B040 -- 0x00B048 */ 287 u64 ce_pad_00B040[2]; /* 0x00B040 -- 0x00B048 */
288 uint64_t ce_ure_debug_sel; /* 0x00B050 */ 288 u64 ce_ure_debug_sel; /* 0x00B050 */
289 uint64_t ce_ure_pcie_debug_sel; /* 0x00B058 */ 289 u64 ce_ure_pcie_debug_sel; /* 0x00B058 */
290 uint64_t ce_ure_ssp_err_cmd_wrd; /* 0x00B060 */ 290 u64 ce_ure_ssp_err_cmd_wrd; /* 0x00B060 */
291 uint64_t ce_ure_ssp_err_addr; /* 0x00B068 */ 291 u64 ce_ure_ssp_err_addr; /* 0x00B068 */
292 uint64_t ce_ure_page_map; /* 0x00B070 */ 292 u64 ce_ure_page_map; /* 0x00B070 */
293 uint64_t ce_ure_dir_map[TIOCE_NUM_PORTS]; /* 0x00B078 */ 293 u64 ce_ure_dir_map[TIOCE_NUM_PORTS]; /* 0x00B078 */
294 uint64_t ce_ure_pipe_sel1; /* 0x00B088 */ 294 u64 ce_ure_pipe_sel1; /* 0x00B088 */
295 uint64_t ce_ure_pipe_mask1; /* 0x00B090 */ 295 u64 ce_ure_pipe_mask1; /* 0x00B090 */
296 uint64_t ce_ure_pipe_sel2; /* 0x00B098 */ 296 u64 ce_ure_pipe_sel2; /* 0x00B098 */
297 uint64_t ce_ure_pipe_mask2; /* 0x00B0A0 */ 297 u64 ce_ure_pipe_mask2; /* 0x00B0A0 */
298 uint64_t ce_ure_pcie1_credits_sent; /* 0x00B0A8 */ 298 u64 ce_ure_pcie1_credits_sent; /* 0x00B0A8 */
299 uint64_t ce_ure_pcie1_credits_used; /* 0x00B0B0 */ 299 u64 ce_ure_pcie1_credits_used; /* 0x00B0B0 */
300 uint64_t ce_ure_pcie1_credit_limit; /* 0x00B0B8 */ 300 u64 ce_ure_pcie1_credit_limit; /* 0x00B0B8 */
301 uint64_t ce_ure_pcie2_credits_sent; /* 0x00B0C0 */ 301 u64 ce_ure_pcie2_credits_sent; /* 0x00B0C0 */
302 uint64_t ce_ure_pcie2_credits_used; /* 0x00B0C8 */ 302 u64 ce_ure_pcie2_credits_used; /* 0x00B0C8 */
303 uint64_t ce_ure_pcie2_credit_limit; /* 0x00B0D0 */ 303 u64 ce_ure_pcie2_credit_limit; /* 0x00B0D0 */
304 uint64_t ce_ure_pcie_force_credit; /* 0x00B0D8 */ 304 u64 ce_ure_pcie_force_credit; /* 0x00B0D8 */
305 uint64_t ce_ure_rd_tnum_val; /* 0x00B0E0 */ 305 u64 ce_ure_rd_tnum_val; /* 0x00B0E0 */
306 uint64_t ce_ure_rd_tnum_rsp_rcvd; /* 0x00B0E8 */ 306 u64 ce_ure_rd_tnum_rsp_rcvd; /* 0x00B0E8 */
307 uint64_t ce_ure_rd_tnum_esent_timer; /* 0x00B0F0 */ 307 u64 ce_ure_rd_tnum_esent_timer; /* 0x00B0F0 */
308 uint64_t ce_ure_rd_tnum_error; /* 0x00B0F8 */ 308 u64 ce_ure_rd_tnum_error; /* 0x00B0F8 */
309 uint64_t ce_ure_rd_tnum_first_cl; /* 0x00B100 */ 309 u64 ce_ure_rd_tnum_first_cl; /* 0x00B100 */
310 uint64_t ce_ure_rd_tnum_link_buf; /* 0x00B108 */ 310 u64 ce_ure_rd_tnum_link_buf; /* 0x00B108 */
311 uint64_t ce_ure_wr_tnum_val; /* 0x00B110 */ 311 u64 ce_ure_wr_tnum_val; /* 0x00B110 */
312 uint64_t ce_ure_sram_err_addr0; /* 0x00B118 */ 312 u64 ce_ure_sram_err_addr0; /* 0x00B118 */
313 uint64_t ce_ure_sram_err_addr1; /* 0x00B120 */ 313 u64 ce_ure_sram_err_addr1; /* 0x00B120 */
314 uint64_t ce_ure_sram_err_addr2; /* 0x00B128 */ 314 u64 ce_ure_sram_err_addr2; /* 0x00B128 */
315 uint64_t ce_ure_sram_rd_addr0; /* 0x00B130 */ 315 u64 ce_ure_sram_rd_addr0; /* 0x00B130 */
316 uint64_t ce_ure_sram_rd_addr1; /* 0x00B138 */ 316 u64 ce_ure_sram_rd_addr1; /* 0x00B138 */
317 uint64_t ce_ure_sram_rd_addr2; /* 0x00B140 */ 317 u64 ce_ure_sram_rd_addr2; /* 0x00B140 */
318 uint64_t ce_ure_sram_wr_addr0; /* 0x00B148 */ 318 u64 ce_ure_sram_wr_addr0; /* 0x00B148 */
319 uint64_t ce_ure_sram_wr_addr1; /* 0x00B150 */ 319 u64 ce_ure_sram_wr_addr1; /* 0x00B150 */
320 uint64_t ce_ure_sram_wr_addr2; /* 0x00B158 */ 320 u64 ce_ure_sram_wr_addr2; /* 0x00B158 */
321 uint64_t ce_ure_buf_flush10; /* 0x00B160 */ 321 u64 ce_ure_buf_flush10; /* 0x00B160 */
322 uint64_t ce_ure_buf_flush11; /* 0x00B168 */ 322 u64 ce_ure_buf_flush11; /* 0x00B168 */
323 uint64_t ce_ure_buf_flush12; /* 0x00B170 */ 323 u64 ce_ure_buf_flush12; /* 0x00B170 */
324 uint64_t ce_ure_buf_flush13; /* 0x00B178 */ 324 u64 ce_ure_buf_flush13; /* 0x00B178 */
325 uint64_t ce_ure_buf_flush20; /* 0x00B180 */ 325 u64 ce_ure_buf_flush20; /* 0x00B180 */
326 uint64_t ce_ure_buf_flush21; /* 0x00B188 */ 326 u64 ce_ure_buf_flush21; /* 0x00B188 */
327 uint64_t ce_ure_buf_flush22; /* 0x00B190 */ 327 u64 ce_ure_buf_flush22; /* 0x00B190 */
328 uint64_t ce_ure_buf_flush23; /* 0x00B198 */ 328 u64 ce_ure_buf_flush23; /* 0x00B198 */
329 uint64_t ce_ure_pcie_control1; /* 0x00B1A0 */ 329 u64 ce_ure_pcie_control1; /* 0x00B1A0 */
330 uint64_t ce_ure_pcie_control2; /* 0x00B1A8 */ 330 u64 ce_ure_pcie_control2; /* 0x00B1A8 */
331 331
332 uint64_t ce_pad_00B1B0[458]; /* 0x00B1B0 -- 0x00BFF8 */ 332 u64 ce_pad_00B1B0[458]; /* 0x00B1B0 -- 0x00BFF8 */
333 333
334 /* Upstream Data Buffer, Port1 */ 334 /* Upstream Data Buffer, Port1 */
335 struct ce_ure_maint_ups_dat1_data { 335 struct ce_ure_maint_ups_dat1_data {
336 uint64_t data63_0[512]; /* 0x00C000 -- 0x00CFF8 */ 336 u64 data63_0[512]; /* 0x00C000 -- 0x00CFF8 */
337 uint64_t data127_64[512]; /* 0x00D000 -- 0x00DFF8 */ 337 u64 data127_64[512]; /* 0x00D000 -- 0x00DFF8 */
338 uint64_t parity[512]; /* 0x00E000 -- 0x00EFF8 */ 338 u64 parity[512]; /* 0x00E000 -- 0x00EFF8 */
339 } ce_ure_maint_ups_dat1; 339 } ce_ure_maint_ups_dat1;
340 340
341 /* Upstream Header Buffer, Port1 */ 341 /* Upstream Header Buffer, Port1 */
342 struct ce_ure_maint_ups_hdr1_data { 342 struct ce_ure_maint_ups_hdr1_data {
343 uint64_t data63_0[512]; /* 0x00F000 -- 0x00FFF8 */ 343 u64 data63_0[512]; /* 0x00F000 -- 0x00FFF8 */
344 uint64_t data127_64[512]; /* 0x010000 -- 0x010FF8 */ 344 u64 data127_64[512]; /* 0x010000 -- 0x010FF8 */
345 uint64_t parity[512]; /* 0x011000 -- 0x011FF8 */ 345 u64 parity[512]; /* 0x011000 -- 0x011FF8 */
346 } ce_ure_maint_ups_hdr1; 346 } ce_ure_maint_ups_hdr1;
347 347
348 /* Upstream Data Buffer, Port2 */ 348 /* Upstream Data Buffer, Port2 */
349 struct ce_ure_maint_ups_dat2_data { 349 struct ce_ure_maint_ups_dat2_data {
350 uint64_t data63_0[512]; /* 0x012000 -- 0x012FF8 */ 350 u64 data63_0[512]; /* 0x012000 -- 0x012FF8 */
351 uint64_t data127_64[512]; /* 0x013000 -- 0x013FF8 */ 351 u64 data127_64[512]; /* 0x013000 -- 0x013FF8 */
352 uint64_t parity[512]; /* 0x014000 -- 0x014FF8 */ 352 u64 parity[512]; /* 0x014000 -- 0x014FF8 */
353 } ce_ure_maint_ups_dat2; 353 } ce_ure_maint_ups_dat2;
354 354
355 /* Upstream Header Buffer, Port2 */ 355 /* Upstream Header Buffer, Port2 */
356 struct ce_ure_maint_ups_hdr2_data { 356 struct ce_ure_maint_ups_hdr2_data {
357 uint64_t data63_0[512]; /* 0x015000 -- 0x015FF8 */ 357 u64 data63_0[512]; /* 0x015000 -- 0x015FF8 */
358 uint64_t data127_64[512]; /* 0x016000 -- 0x016FF8 */ 358 u64 data127_64[512]; /* 0x016000 -- 0x016FF8 */
359 uint64_t parity[512]; /* 0x017000 -- 0x017FF8 */ 359 u64 parity[512]; /* 0x017000 -- 0x017FF8 */
360 } ce_ure_maint_ups_hdr2; 360 } ce_ure_maint_ups_hdr2;
361 361
362 /* Downstream Data Buffer */ 362 /* Downstream Data Buffer */
363 struct ce_ure_maint_dns_dat_data { 363 struct ce_ure_maint_dns_dat_data {
364 uint64_t data63_0[512]; /* 0x018000 -- 0x018FF8 */ 364 u64 data63_0[512]; /* 0x018000 -- 0x018FF8 */
365 uint64_t data127_64[512]; /* 0x019000 -- 0x019FF8 */ 365 u64 data127_64[512]; /* 0x019000 -- 0x019FF8 */
366 uint64_t parity[512]; /* 0x01A000 -- 0x01AFF8 */ 366 u64 parity[512]; /* 0x01A000 -- 0x01AFF8 */
367 } ce_ure_maint_dns_dat; 367 } ce_ure_maint_dns_dat;
368 368
369 /* Downstream Header Buffer */ 369 /* Downstream Header Buffer */
370 struct ce_ure_maint_dns_hdr_data { 370 struct ce_ure_maint_dns_hdr_data {
371 uint64_t data31_0[64]; /* 0x01B000 -- 0x01B1F8 */ 371 u64 data31_0[64]; /* 0x01B000 -- 0x01B1F8 */
372 uint64_t data95_32[64]; /* 0x01B200 -- 0x01B3F8 */ 372 u64 data95_32[64]; /* 0x01B200 -- 0x01B3F8 */
373 uint64_t parity[64]; /* 0x01B400 -- 0x01B5F8 */ 373 u64 parity[64]; /* 0x01B400 -- 0x01B5F8 */
374 } ce_ure_maint_dns_hdr; 374 } ce_ure_maint_dns_hdr;
375 375
376 /* RCI Buffer Data */ 376 /* RCI Buffer Data */
377 struct ce_ure_maint_rci_data { 377 struct ce_ure_maint_rci_data {
378 uint64_t data41_0[64]; /* 0x01B600 -- 0x01B7F8 */ 378 u64 data41_0[64]; /* 0x01B600 -- 0x01B7F8 */
379 uint64_t data69_42[64]; /* 0x01B800 -- 0x01B9F8 */ 379 u64 data69_42[64]; /* 0x01B800 -- 0x01B9F8 */
380 } ce_ure_maint_rci; 380 } ce_ure_maint_rci;
381 381
382 /* Response Queue */ 382 /* Response Queue */
383 uint64_t ce_ure_maint_rspq[64]; /* 0x01BA00 -- 0x01BBF8 */ 383 u64 ce_ure_maint_rspq[64]; /* 0x01BA00 -- 0x01BBF8 */
384 384
385 uint64_t ce_pad_01C000[4224]; /* 0x01BC00 -- 0x023FF8 */ 385 u64 ce_pad_01C000[4224]; /* 0x01BC00 -- 0x023FF8 */
386 386
387 /* Admin Build-a-Packet Buffer */ 387 /* Admin Build-a-Packet Buffer */
388 struct ce_adm_maint_bap_buf_data { 388 struct ce_adm_maint_bap_buf_data {
389 uint64_t data63_0[258]; /* 0x024000 -- 0x024808 */ 389 u64 data63_0[258]; /* 0x024000 -- 0x024808 */
390 uint64_t data127_64[258]; /* 0x024810 -- 0x025018 */ 390 u64 data127_64[258]; /* 0x024810 -- 0x025018 */
391 uint64_t parity[258]; /* 0x025020 -- 0x025828 */ 391 u64 parity[258]; /* 0x025020 -- 0x025828 */
392 } ce_adm_maint_bap_buf; 392 } ce_adm_maint_bap_buf;
393 393
394 uint64_t ce_pad_025830[5370]; /* 0x025830 -- 0x02FFF8 */ 394 u64 ce_pad_025830[5370]; /* 0x025830 -- 0x02FFF8 */
395 395
396 /* URE: 40bit PMU ATE Buffer */ /* 0x030000 -- 0x037FF8 */ 396 /* URE: 40bit PMU ATE Buffer */ /* 0x030000 -- 0x037FF8 */
397 uint64_t ce_ure_ate40[TIOCE_NUM_M40_ATES]; 397 u64 ce_ure_ate40[TIOCE_NUM_M40_ATES];
398 398
399 /* URE: 32/40bit PMU ATE Buffer */ /* 0x038000 -- 0x03BFF8 */ 399 /* URE: 32/40bit PMU ATE Buffer */ /* 0x038000 -- 0x03BFF8 */
400 uint64_t ce_ure_ate3240[TIOCE_NUM_M3240_ATES]; 400 u64 ce_ure_ate3240[TIOCE_NUM_M3240_ATES];
401 401
402 uint64_t ce_pad_03C000[2050]; /* 0x03C000 -- 0x040008 */ 402 u64 ce_pad_03C000[2050]; /* 0x03C000 -- 0x040008 */
403 403
404 /* 404 /*
405 * DRE: Down Stream Request Engine 405 * DRE: Down Stream Request Engine
406 */ 406 */
407 uint64_t ce_dre_dyn_credit_status1; /* 0x040010 */ 407 u64 ce_dre_dyn_credit_status1; /* 0x040010 */
408 uint64_t ce_dre_dyn_credit_status2; /* 0x040018 */ 408 u64 ce_dre_dyn_credit_status2; /* 0x040018 */
409 uint64_t ce_dre_last_credit_status1; /* 0x040020 */ 409 u64 ce_dre_last_credit_status1; /* 0x040020 */
410 uint64_t ce_dre_last_credit_status2; /* 0x040028 */ 410 u64 ce_dre_last_credit_status2; /* 0x040028 */
411 uint64_t ce_dre_credit_limit1; /* 0x040030 */ 411 u64 ce_dre_credit_limit1; /* 0x040030 */
412 uint64_t ce_dre_credit_limit2; /* 0x040038 */ 412 u64 ce_dre_credit_limit2; /* 0x040038 */
413 uint64_t ce_dre_force_credit1; /* 0x040040 */ 413 u64 ce_dre_force_credit1; /* 0x040040 */
414 uint64_t ce_dre_force_credit2; /* 0x040048 */ 414 u64 ce_dre_force_credit2; /* 0x040048 */
415 uint64_t ce_dre_debug_mux1; /* 0x040050 */ 415 u64 ce_dre_debug_mux1; /* 0x040050 */
416 uint64_t ce_dre_debug_mux2; /* 0x040058 */ 416 u64 ce_dre_debug_mux2; /* 0x040058 */
417 uint64_t ce_dre_ssp_err_cmd_wrd; /* 0x040060 */ 417 u64 ce_dre_ssp_err_cmd_wrd; /* 0x040060 */
418 uint64_t ce_dre_ssp_err_addr; /* 0x040068 */ 418 u64 ce_dre_ssp_err_addr; /* 0x040068 */
419 uint64_t ce_dre_comp_err_cmd_wrd; /* 0x040070 */ 419 u64 ce_dre_comp_err_cmd_wrd; /* 0x040070 */
420 uint64_t ce_dre_comp_err_addr; /* 0x040078 */ 420 u64 ce_dre_comp_err_addr; /* 0x040078 */
421 uint64_t ce_dre_req_status; /* 0x040080 */ 421 u64 ce_dre_req_status; /* 0x040080 */
422 uint64_t ce_dre_config1; /* 0x040088 */ 422 u64 ce_dre_config1; /* 0x040088 */
423 uint64_t ce_dre_config2; /* 0x040090 */ 423 u64 ce_dre_config2; /* 0x040090 */
424 uint64_t ce_dre_config_req_status; /* 0x040098 */ 424 u64 ce_dre_config_req_status; /* 0x040098 */
425 uint64_t ce_pad_0400A0[12]; /* 0x0400A0 -- 0x0400F8 */ 425 u64 ce_pad_0400A0[12]; /* 0x0400A0 -- 0x0400F8 */
426 uint64_t ce_dre_dyn_fifo; /* 0x040100 */ 426 u64 ce_dre_dyn_fifo; /* 0x040100 */
427 uint64_t ce_pad_040108[3]; /* 0x040108 -- 0x040118 */ 427 u64 ce_pad_040108[3]; /* 0x040108 -- 0x040118 */
428 uint64_t ce_dre_last_fifo; /* 0x040120 */ 428 u64 ce_dre_last_fifo; /* 0x040120 */
429 429
430 uint64_t ce_pad_040128[27]; /* 0x040128 -- 0x0401F8 */ 430 u64 ce_pad_040128[27]; /* 0x040128 -- 0x0401F8 */
431 431
432 /* DRE Downstream Head Queue */ 432 /* DRE Downstream Head Queue */
433 struct ce_dre_maint_ds_head_queue { 433 struct ce_dre_maint_ds_head_queue {
434 uint64_t data63_0[32]; /* 0x040200 -- 0x0402F8 */ 434 u64 data63_0[32]; /* 0x040200 -- 0x0402F8 */
435 uint64_t data127_64[32]; /* 0x040300 -- 0x0403F8 */ 435 u64 data127_64[32]; /* 0x040300 -- 0x0403F8 */
436 uint64_t parity[32]; /* 0x040400 -- 0x0404F8 */ 436 u64 parity[32]; /* 0x040400 -- 0x0404F8 */
437 } ce_dre_maint_ds_head_q; 437 } ce_dre_maint_ds_head_q;
438 438
439 uint64_t ce_pad_040500[352]; /* 0x040500 -- 0x040FF8 */ 439 u64 ce_pad_040500[352]; /* 0x040500 -- 0x040FF8 */
440 440
441 /* DRE Downstream Data Queue */ 441 /* DRE Downstream Data Queue */
442 struct ce_dre_maint_ds_data_queue { 442 struct ce_dre_maint_ds_data_queue {
443 uint64_t data63_0[256]; /* 0x041000 -- 0x0417F8 */ 443 u64 data63_0[256]; /* 0x041000 -- 0x0417F8 */
444 uint64_t ce_pad_041800[256]; /* 0x041800 -- 0x041FF8 */ 444 u64 ce_pad_041800[256]; /* 0x041800 -- 0x041FF8 */
445 uint64_t data127_64[256]; /* 0x042000 -- 0x0427F8 */ 445 u64 data127_64[256]; /* 0x042000 -- 0x0427F8 */
446 uint64_t ce_pad_042800[256]; /* 0x042800 -- 0x042FF8 */ 446 u64 ce_pad_042800[256]; /* 0x042800 -- 0x042FF8 */
447 uint64_t parity[256]; /* 0x043000 -- 0x0437F8 */ 447 u64 parity[256]; /* 0x043000 -- 0x0437F8 */
448 uint64_t ce_pad_043800[256]; /* 0x043800 -- 0x043FF8 */ 448 u64 ce_pad_043800[256]; /* 0x043800 -- 0x043FF8 */
449 } ce_dre_maint_ds_data_q; 449 } ce_dre_maint_ds_data_q;
450 450
451 /* DRE URE Upstream Response Queue */ 451 /* DRE URE Upstream Response Queue */
452 struct ce_dre_maint_ure_us_rsp_queue { 452 struct ce_dre_maint_ure_us_rsp_queue {
453 uint64_t data63_0[8]; /* 0x044000 -- 0x044038 */ 453 u64 data63_0[8]; /* 0x044000 -- 0x044038 */
454 uint64_t ce_pad_044040[24]; /* 0x044040 -- 0x0440F8 */ 454 u64 ce_pad_044040[24]; /* 0x044040 -- 0x0440F8 */
455 uint64_t data127_64[8]; /* 0x044100 -- 0x044138 */ 455 u64 data127_64[8]; /* 0x044100 -- 0x044138 */
456 uint64_t ce_pad_044140[24]; /* 0x044140 -- 0x0441F8 */ 456 u64 ce_pad_044140[24]; /* 0x044140 -- 0x0441F8 */
457 uint64_t parity[8]; /* 0x044200 -- 0x044238 */ 457 u64 parity[8]; /* 0x044200 -- 0x044238 */
458 uint64_t ce_pad_044240[24]; /* 0x044240 -- 0x0442F8 */ 458 u64 ce_pad_044240[24]; /* 0x044240 -- 0x0442F8 */
459 } ce_dre_maint_ure_us_rsp_q; 459 } ce_dre_maint_ure_us_rsp_q;
460 460
461 uint64_t ce_dre_maint_us_wrt_rsp[32];/* 0x044300 -- 0x0443F8 */ 461 u64 ce_dre_maint_us_wrt_rsp[32];/* 0x044300 -- 0x0443F8 */
462 462
463 uint64_t ce_end_of_struct; /* 0x044400 */ 463 u64 ce_end_of_struct; /* 0x044400 */
464} tioce_t; 464} tioce_t;
465 465
466 466
@@ -625,11 +625,11 @@ typedef volatile struct tioce {
625#define CE_URE_BUS_MASK (0xFFULL << BUS_SRC_ID_SHFT) 625#define CE_URE_BUS_MASK (0xFFULL << BUS_SRC_ID_SHFT)
626#define CE_URE_DEV_MASK (0x1FULL << DEV_SRC_ID_SHFT) 626#define CE_URE_DEV_MASK (0x1FULL << DEV_SRC_ID_SHFT)
627#define CE_URE_FNC_MASK (0x07ULL << FNC_SRC_ID_SHFT) 627#define CE_URE_FNC_MASK (0x07ULL << FNC_SRC_ID_SHFT)
628#define CE_URE_PIPE_BUS(b) (((uint64_t)(b) << BUS_SRC_ID_SHFT) & \ 628#define CE_URE_PIPE_BUS(b) (((u64)(b) << BUS_SRC_ID_SHFT) & \
629 CE_URE_BUS_MASK) 629 CE_URE_BUS_MASK)
630#define CE_URE_PIPE_DEV(d) (((uint64_t)(d) << DEV_SRC_ID_SHFT) & \ 630#define CE_URE_PIPE_DEV(d) (((u64)(d) << DEV_SRC_ID_SHFT) & \
631 CE_URE_DEV_MASK) 631 CE_URE_DEV_MASK)
632#define CE_URE_PIPE_FNC(f) (((uint64_t)(f) << FNC_SRC_ID_SHFT) & \ 632#define CE_URE_PIPE_FNC(f) (((u64)(f) << FNC_SRC_ID_SHFT) & \
633 CE_URE_FNC_MASK) 633 CE_URE_FNC_MASK)
634 634
635#define CE_URE_SEL1_SHFT 0 635#define CE_URE_SEL1_SHFT 0
@@ -660,9 +660,9 @@ typedef volatile struct tioce {
660#define CE_URE_PN1_MASK (0xFFULL << CE_URE_PN1_SHFT) 660#define CE_URE_PN1_MASK (0xFFULL << CE_URE_PN1_SHFT)
661#define CE_URE_PN2_SHFT 24 661#define CE_URE_PN2_SHFT 24
662#define CE_URE_PN2_MASK (0xFFULL << CE_URE_PN2_SHFT) 662#define CE_URE_PN2_MASK (0xFFULL << CE_URE_PN2_SHFT)
663#define CE_URE_PN1_SET(n) (((uint64_t)(n) << CE_URE_PN1_SHFT) & \ 663#define CE_URE_PN1_SET(n) (((u64)(n) << CE_URE_PN1_SHFT) & \
664 CE_URE_PN1_MASK) 664 CE_URE_PN1_MASK)
665#define CE_URE_PN2_SET(n) (((uint64_t)(n) << CE_URE_PN2_SHFT) & \ 665#define CE_URE_PN2_SET(n) (((u64)(n) << CE_URE_PN2_SHFT) & \
666 CE_URE_PN2_MASK) 666 CE_URE_PN2_MASK)
667 667
668/* ce_ure_pcie_control2 register bit masks & shifts */ 668/* ce_ure_pcie_control2 register bit masks & shifts */
@@ -681,9 +681,9 @@ typedef volatile struct tioce {
681#define CE_URE_PSN1_MASK (0x1FFFULL << CE_URE_PSN1_SHFT) 681#define CE_URE_PSN1_MASK (0x1FFFULL << CE_URE_PSN1_SHFT)
682#define CE_URE_PSN2_SHFT 32 682#define CE_URE_PSN2_SHFT 32
683#define CE_URE_PSN2_MASK (0x1FFFULL << CE_URE_PSN2_SHFT) 683#define CE_URE_PSN2_MASK (0x1FFFULL << CE_URE_PSN2_SHFT)
684#define CE_URE_PSN1_SET(n) (((uint64_t)(n) << CE_URE_PSN1_SHFT) & \ 684#define CE_URE_PSN1_SET(n) (((u64)(n) << CE_URE_PSN1_SHFT) & \
685 CE_URE_PSN1_MASK) 685 CE_URE_PSN1_MASK)
686#define CE_URE_PSN2_SET(n) (((uint64_t)(n) << CE_URE_PSN2_SHFT) & \ 686#define CE_URE_PSN2_SET(n) (((u64)(n) << CE_URE_PSN2_SHFT) & \
687 CE_URE_PSN2_MASK) 687 CE_URE_PSN2_MASK)
688 688
689/* 689/*
diff --git a/include/asm-ia64/sn/tioce_provider.h b/include/asm-ia64/sn/tioce_provider.h
index cb414908671d..6d62b13f7ae7 100644
--- a/include/asm-ia64/sn/tioce_provider.h
+++ b/include/asm-ia64/sn/tioce_provider.h
@@ -21,9 +21,9 @@
21struct tioce_common { 21struct tioce_common {
22 struct pcibus_bussoft ce_pcibus; /* common pciio header */ 22 struct pcibus_bussoft ce_pcibus; /* common pciio header */
23 23
24 uint32_t ce_rev; 24 u32 ce_rev;
25 uint64_t ce_kernel_private; 25 u64 ce_kernel_private;
26 uint64_t ce_prom_private; 26 u64 ce_prom_private;
27}; 27};
28 28
29struct tioce_kernel { 29struct tioce_kernel {
@@ -31,31 +31,31 @@ struct tioce_kernel {
31 spinlock_t ce_lock; 31 spinlock_t ce_lock;
32 struct list_head ce_dmamap_list; 32 struct list_head ce_dmamap_list;
33 33
34 uint64_t ce_ate40_shadow[TIOCE_NUM_M40_ATES]; 34 u64 ce_ate40_shadow[TIOCE_NUM_M40_ATES];
35 uint64_t ce_ate3240_shadow[TIOCE_NUM_M3240_ATES]; 35 u64 ce_ate3240_shadow[TIOCE_NUM_M3240_ATES];
36 uint32_t ce_ate3240_pagesize; 36 u32 ce_ate3240_pagesize;
37 37
38 uint8_t ce_port1_secondary; 38 u8 ce_port1_secondary;
39 39
40 /* per-port resources */ 40 /* per-port resources */
41 struct { 41 struct {
42 int dirmap_refcnt; 42 int dirmap_refcnt;
43 uint64_t dirmap_shadow; 43 u64 dirmap_shadow;
44 } ce_port[TIOCE_NUM_PORTS]; 44 } ce_port[TIOCE_NUM_PORTS];
45}; 45};
46 46
47struct tioce_dmamap { 47struct tioce_dmamap {
48 struct list_head ce_dmamap_list; /* headed by tioce_kernel */ 48 struct list_head ce_dmamap_list; /* headed by tioce_kernel */
49 uint32_t refcnt; 49 u32 refcnt;
50 50
51 uint64_t nbytes; /* # bytes mapped */ 51 u64 nbytes; /* # bytes mapped */
52 52
53 uint64_t ct_start; /* coretalk start address */ 53 u64 ct_start; /* coretalk start address */
54 uint64_t pci_start; /* bus start address */ 54 u64 pci_start; /* bus start address */
55 55
56 uint64_t *ate_hw; /* hw ptr of first ate in map */ 56 u64 *ate_hw; /* hw ptr of first ate in map */
57 uint64_t *ate_shadow; /* shadow ptr of firat ate */ 57 u64 *ate_shadow; /* shadow ptr of firat ate */
58 uint16_t ate_count; /* # ate's in the map */ 58 u16 ate_count; /* # ate's in the map */
59}; 59};
60 60
61extern int tioce_init_provider(void); 61extern int tioce_init_provider(void);
diff --git a/include/asm-ia64/sn/tiocp.h b/include/asm-ia64/sn/tiocp.h
index 5f2489c9d2dd..f47c08ab483c 100644
--- a/include/asm-ia64/sn/tiocp.h
+++ b/include/asm-ia64/sn/tiocp.h
@@ -21,189 +21,189 @@ struct tiocp{
21 /* 0x000000-0x00FFFF -- Local Registers */ 21 /* 0x000000-0x00FFFF -- Local Registers */
22 22
23 /* 0x000000-0x000057 -- (Legacy Widget Space) Configuration */ 23 /* 0x000000-0x000057 -- (Legacy Widget Space) Configuration */
24 uint64_t cp_id; /* 0x000000 */ 24 u64 cp_id; /* 0x000000 */
25 uint64_t cp_stat; /* 0x000008 */ 25 u64 cp_stat; /* 0x000008 */
26 uint64_t cp_err_upper; /* 0x000010 */ 26 u64 cp_err_upper; /* 0x000010 */
27 uint64_t cp_err_lower; /* 0x000018 */ 27 u64 cp_err_lower; /* 0x000018 */
28 #define cp_err cp_err_lower 28 #define cp_err cp_err_lower
29 uint64_t cp_control; /* 0x000020 */ 29 u64 cp_control; /* 0x000020 */
30 uint64_t cp_req_timeout; /* 0x000028 */ 30 u64 cp_req_timeout; /* 0x000028 */
31 uint64_t cp_intr_upper; /* 0x000030 */ 31 u64 cp_intr_upper; /* 0x000030 */
32 uint64_t cp_intr_lower; /* 0x000038 */ 32 u64 cp_intr_lower; /* 0x000038 */
33 #define cp_intr cp_intr_lower 33 #define cp_intr cp_intr_lower
34 uint64_t cp_err_cmdword; /* 0x000040 */ 34 u64 cp_err_cmdword; /* 0x000040 */
35 uint64_t _pad_000048; /* 0x000048 */ 35 u64 _pad_000048; /* 0x000048 */
36 uint64_t cp_tflush; /* 0x000050 */ 36 u64 cp_tflush; /* 0x000050 */
37 37
38 /* 0x000058-0x00007F -- Bridge-specific Configuration */ 38 /* 0x000058-0x00007F -- Bridge-specific Configuration */
39 uint64_t cp_aux_err; /* 0x000058 */ 39 u64 cp_aux_err; /* 0x000058 */
40 uint64_t cp_resp_upper; /* 0x000060 */ 40 u64 cp_resp_upper; /* 0x000060 */
41 uint64_t cp_resp_lower; /* 0x000068 */ 41 u64 cp_resp_lower; /* 0x000068 */
42 #define cp_resp cp_resp_lower 42 #define cp_resp cp_resp_lower
43 uint64_t cp_tst_pin_ctrl; /* 0x000070 */ 43 u64 cp_tst_pin_ctrl; /* 0x000070 */
44 uint64_t cp_addr_lkerr; /* 0x000078 */ 44 u64 cp_addr_lkerr; /* 0x000078 */
45 45
46 /* 0x000080-0x00008F -- PMU & MAP */ 46 /* 0x000080-0x00008F -- PMU & MAP */
47 uint64_t cp_dir_map; /* 0x000080 */ 47 u64 cp_dir_map; /* 0x000080 */
48 uint64_t _pad_000088; /* 0x000088 */ 48 u64 _pad_000088; /* 0x000088 */
49 49
50 /* 0x000090-0x00009F -- SSRAM */ 50 /* 0x000090-0x00009F -- SSRAM */
51 uint64_t cp_map_fault; /* 0x000090 */ 51 u64 cp_map_fault; /* 0x000090 */
52 uint64_t _pad_000098; /* 0x000098 */ 52 u64 _pad_000098; /* 0x000098 */
53 53
54 /* 0x0000A0-0x0000AF -- Arbitration */ 54 /* 0x0000A0-0x0000AF -- Arbitration */
55 uint64_t cp_arb; /* 0x0000A0 */ 55 u64 cp_arb; /* 0x0000A0 */
56 uint64_t _pad_0000A8; /* 0x0000A8 */ 56 u64 _pad_0000A8; /* 0x0000A8 */
57 57
58 /* 0x0000B0-0x0000BF -- Number In A Can or ATE Parity Error */ 58 /* 0x0000B0-0x0000BF -- Number In A Can or ATE Parity Error */
59 uint64_t cp_ate_parity_err; /* 0x0000B0 */ 59 u64 cp_ate_parity_err; /* 0x0000B0 */
60 uint64_t _pad_0000B8; /* 0x0000B8 */ 60 u64 _pad_0000B8; /* 0x0000B8 */
61 61
62 /* 0x0000C0-0x0000FF -- PCI/GIO */ 62 /* 0x0000C0-0x0000FF -- PCI/GIO */
63 uint64_t cp_bus_timeout; /* 0x0000C0 */ 63 u64 cp_bus_timeout; /* 0x0000C0 */
64 uint64_t cp_pci_cfg; /* 0x0000C8 */ 64 u64 cp_pci_cfg; /* 0x0000C8 */
65 uint64_t cp_pci_err_upper; /* 0x0000D0 */ 65 u64 cp_pci_err_upper; /* 0x0000D0 */
66 uint64_t cp_pci_err_lower; /* 0x0000D8 */ 66 u64 cp_pci_err_lower; /* 0x0000D8 */
67 #define cp_pci_err cp_pci_err_lower 67 #define cp_pci_err cp_pci_err_lower
68 uint64_t _pad_0000E0[4]; /* 0x0000{E0..F8} */ 68 u64 _pad_0000E0[4]; /* 0x0000{E0..F8} */
69 69
70 /* 0x000100-0x0001FF -- Interrupt */ 70 /* 0x000100-0x0001FF -- Interrupt */
71 uint64_t cp_int_status; /* 0x000100 */ 71 u64 cp_int_status; /* 0x000100 */
72 uint64_t cp_int_enable; /* 0x000108 */ 72 u64 cp_int_enable; /* 0x000108 */
73 uint64_t cp_int_rst_stat; /* 0x000110 */ 73 u64 cp_int_rst_stat; /* 0x000110 */
74 uint64_t cp_int_mode; /* 0x000118 */ 74 u64 cp_int_mode; /* 0x000118 */
75 uint64_t cp_int_device; /* 0x000120 */ 75 u64 cp_int_device; /* 0x000120 */
76 uint64_t cp_int_host_err; /* 0x000128 */ 76 u64 cp_int_host_err; /* 0x000128 */
77 uint64_t cp_int_addr[8]; /* 0x0001{30,,,68} */ 77 u64 cp_int_addr[8]; /* 0x0001{30,,,68} */
78 uint64_t cp_err_int_view; /* 0x000170 */ 78 u64 cp_err_int_view; /* 0x000170 */
79 uint64_t cp_mult_int; /* 0x000178 */ 79 u64 cp_mult_int; /* 0x000178 */
80 uint64_t cp_force_always[8]; /* 0x0001{80,,,B8} */ 80 u64 cp_force_always[8]; /* 0x0001{80,,,B8} */
81 uint64_t cp_force_pin[8]; /* 0x0001{C0,,,F8} */ 81 u64 cp_force_pin[8]; /* 0x0001{C0,,,F8} */
82 82
83 /* 0x000200-0x000298 -- Device */ 83 /* 0x000200-0x000298 -- Device */
84 uint64_t cp_device[4]; /* 0x0002{00,,,18} */ 84 u64 cp_device[4]; /* 0x0002{00,,,18} */
85 uint64_t _pad_000220[4]; /* 0x0002{20,,,38} */ 85 u64 _pad_000220[4]; /* 0x0002{20,,,38} */
86 uint64_t cp_wr_req_buf[4]; /* 0x0002{40,,,58} */ 86 u64 cp_wr_req_buf[4]; /* 0x0002{40,,,58} */
87 uint64_t _pad_000260[4]; /* 0x0002{60,,,78} */ 87 u64 _pad_000260[4]; /* 0x0002{60,,,78} */
88 uint64_t cp_rrb_map[2]; /* 0x0002{80,,,88} */ 88 u64 cp_rrb_map[2]; /* 0x0002{80,,,88} */
89 #define cp_even_resp cp_rrb_map[0] /* 0x000280 */ 89 #define cp_even_resp cp_rrb_map[0] /* 0x000280 */
90 #define cp_odd_resp cp_rrb_map[1] /* 0x000288 */ 90 #define cp_odd_resp cp_rrb_map[1] /* 0x000288 */
91 uint64_t cp_resp_status; /* 0x000290 */ 91 u64 cp_resp_status; /* 0x000290 */
92 uint64_t cp_resp_clear; /* 0x000298 */ 92 u64 cp_resp_clear; /* 0x000298 */
93 93
94 uint64_t _pad_0002A0[12]; /* 0x0002{A0..F8} */ 94 u64 _pad_0002A0[12]; /* 0x0002{A0..F8} */
95 95
96 /* 0x000300-0x0003F8 -- Buffer Address Match Registers */ 96 /* 0x000300-0x0003F8 -- Buffer Address Match Registers */
97 struct { 97 struct {
98 uint64_t upper; /* 0x0003{00,,,F0} */ 98 u64 upper; /* 0x0003{00,,,F0} */
99 uint64_t lower; /* 0x0003{08,,,F8} */ 99 u64 lower; /* 0x0003{08,,,F8} */
100 } cp_buf_addr_match[16]; 100 } cp_buf_addr_match[16];
101 101
102 /* 0x000400-0x0005FF -- Performance Monitor Registers (even only) */ 102 /* 0x000400-0x0005FF -- Performance Monitor Registers (even only) */
103 struct { 103 struct {
104 uint64_t flush_w_touch; /* 0x000{400,,,5C0} */ 104 u64 flush_w_touch; /* 0x000{400,,,5C0} */
105 uint64_t flush_wo_touch; /* 0x000{408,,,5C8} */ 105 u64 flush_wo_touch; /* 0x000{408,,,5C8} */
106 uint64_t inflight; /* 0x000{410,,,5D0} */ 106 u64 inflight; /* 0x000{410,,,5D0} */
107 uint64_t prefetch; /* 0x000{418,,,5D8} */ 107 u64 prefetch; /* 0x000{418,,,5D8} */
108 uint64_t total_pci_retry; /* 0x000{420,,,5E0} */ 108 u64 total_pci_retry; /* 0x000{420,,,5E0} */
109 uint64_t max_pci_retry; /* 0x000{428,,,5E8} */ 109 u64 max_pci_retry; /* 0x000{428,,,5E8} */
110 uint64_t max_latency; /* 0x000{430,,,5F0} */ 110 u64 max_latency; /* 0x000{430,,,5F0} */
111 uint64_t clear_all; /* 0x000{438,,,5F8} */ 111 u64 clear_all; /* 0x000{438,,,5F8} */
112 } cp_buf_count[8]; 112 } cp_buf_count[8];
113 113
114 114
115 /* 0x000600-0x0009FF -- PCI/X registers */ 115 /* 0x000600-0x0009FF -- PCI/X registers */
116 uint64_t cp_pcix_bus_err_addr; /* 0x000600 */ 116 u64 cp_pcix_bus_err_addr; /* 0x000600 */
117 uint64_t cp_pcix_bus_err_attr; /* 0x000608 */ 117 u64 cp_pcix_bus_err_attr; /* 0x000608 */
118 uint64_t cp_pcix_bus_err_data; /* 0x000610 */ 118 u64 cp_pcix_bus_err_data; /* 0x000610 */
119 uint64_t cp_pcix_pio_split_addr; /* 0x000618 */ 119 u64 cp_pcix_pio_split_addr; /* 0x000618 */
120 uint64_t cp_pcix_pio_split_attr; /* 0x000620 */ 120 u64 cp_pcix_pio_split_attr; /* 0x000620 */
121 uint64_t cp_pcix_dma_req_err_attr; /* 0x000628 */ 121 u64 cp_pcix_dma_req_err_attr; /* 0x000628 */
122 uint64_t cp_pcix_dma_req_err_addr; /* 0x000630 */ 122 u64 cp_pcix_dma_req_err_addr; /* 0x000630 */
123 uint64_t cp_pcix_timeout; /* 0x000638 */ 123 u64 cp_pcix_timeout; /* 0x000638 */
124 124
125 uint64_t _pad_000640[24]; /* 0x000{640,,,6F8} */ 125 u64 _pad_000640[24]; /* 0x000{640,,,6F8} */
126 126
127 /* 0x000700-0x000737 -- Debug Registers */ 127 /* 0x000700-0x000737 -- Debug Registers */
128 uint64_t cp_ct_debug_ctl; /* 0x000700 */ 128 u64 cp_ct_debug_ctl; /* 0x000700 */
129 uint64_t cp_br_debug_ctl; /* 0x000708 */ 129 u64 cp_br_debug_ctl; /* 0x000708 */
130 uint64_t cp_mux3_debug_ctl; /* 0x000710 */ 130 u64 cp_mux3_debug_ctl; /* 0x000710 */
131 uint64_t cp_mux4_debug_ctl; /* 0x000718 */ 131 u64 cp_mux4_debug_ctl; /* 0x000718 */
132 uint64_t cp_mux5_debug_ctl; /* 0x000720 */ 132 u64 cp_mux5_debug_ctl; /* 0x000720 */
133 uint64_t cp_mux6_debug_ctl; /* 0x000728 */ 133 u64 cp_mux6_debug_ctl; /* 0x000728 */
134 uint64_t cp_mux7_debug_ctl; /* 0x000730 */ 134 u64 cp_mux7_debug_ctl; /* 0x000730 */
135 135
136 uint64_t _pad_000738[89]; /* 0x000{738,,,9F8} */ 136 u64 _pad_000738[89]; /* 0x000{738,,,9F8} */
137 137
138 /* 0x000A00-0x000BFF -- PCI/X Read&Write Buffer */ 138 /* 0x000A00-0x000BFF -- PCI/X Read&Write Buffer */
139 struct { 139 struct {
140 uint64_t cp_buf_addr; /* 0x000{A00,,,AF0} */ 140 u64 cp_buf_addr; /* 0x000{A00,,,AF0} */
141 uint64_t cp_buf_attr; /* 0X000{A08,,,AF8} */ 141 u64 cp_buf_attr; /* 0X000{A08,,,AF8} */
142 } cp_pcix_read_buf_64[16]; 142 } cp_pcix_read_buf_64[16];
143 143
144 struct { 144 struct {
145 uint64_t cp_buf_addr; /* 0x000{B00,,,BE0} */ 145 u64 cp_buf_addr; /* 0x000{B00,,,BE0} */
146 uint64_t cp_buf_attr; /* 0x000{B08,,,BE8} */ 146 u64 cp_buf_attr; /* 0x000{B08,,,BE8} */
147 uint64_t cp_buf_valid; /* 0x000{B10,,,BF0} */ 147 u64 cp_buf_valid; /* 0x000{B10,,,BF0} */
148 uint64_t __pad1; /* 0x000{B18,,,BF8} */ 148 u64 __pad1; /* 0x000{B18,,,BF8} */
149 } cp_pcix_write_buf_64[8]; 149 } cp_pcix_write_buf_64[8];
150 150
151 /* End of Local Registers -- Start of Address Map space */ 151 /* End of Local Registers -- Start of Address Map space */
152 152
153 char _pad_000c00[0x010000 - 0x000c00]; 153 char _pad_000c00[0x010000 - 0x000c00];
154 154
155 /* 0x010000-0x011FF8 -- Internal ATE RAM (Auto Parity Generation) */ 155 /* 0x010000-0x011FF8 -- Internal ATE RAM (Auto Parity Generation) */
156 uint64_t cp_int_ate_ram[1024]; /* 0x010000-0x011FF8 */ 156 u64 cp_int_ate_ram[1024]; /* 0x010000-0x011FF8 */
157 157
158 char _pad_012000[0x14000 - 0x012000]; 158 char _pad_012000[0x14000 - 0x012000];
159 159
160 /* 0x014000-0x015FF8 -- Internal ATE RAM (Manual Parity Generation) */ 160 /* 0x014000-0x015FF8 -- Internal ATE RAM (Manual Parity Generation) */
161 uint64_t cp_int_ate_ram_mp[1024]; /* 0x014000-0x015FF8 */ 161 u64 cp_int_ate_ram_mp[1024]; /* 0x014000-0x015FF8 */
162 162
163 char _pad_016000[0x18000 - 0x016000]; 163 char _pad_016000[0x18000 - 0x016000];
164 164
165 /* 0x18000-0x197F8 -- TIOCP Write Request Ram */ 165 /* 0x18000-0x197F8 -- TIOCP Write Request Ram */
166 uint64_t cp_wr_req_lower[256]; /* 0x18000 - 0x187F8 */ 166 u64 cp_wr_req_lower[256]; /* 0x18000 - 0x187F8 */
167 uint64_t cp_wr_req_upper[256]; /* 0x18800 - 0x18FF8 */ 167 u64 cp_wr_req_upper[256]; /* 0x18800 - 0x18FF8 */
168 uint64_t cp_wr_req_parity[256]; /* 0x19000 - 0x197F8 */ 168 u64 cp_wr_req_parity[256]; /* 0x19000 - 0x197F8 */
169 169
170 char _pad_019800[0x1C000 - 0x019800]; 170 char _pad_019800[0x1C000 - 0x019800];
171 171
172 /* 0x1C000-0x1EFF8 -- TIOCP Read Response Ram */ 172 /* 0x1C000-0x1EFF8 -- TIOCP Read Response Ram */
173 uint64_t cp_rd_resp_lower[512]; /* 0x1C000 - 0x1CFF8 */ 173 u64 cp_rd_resp_lower[512]; /* 0x1C000 - 0x1CFF8 */
174 uint64_t cp_rd_resp_upper[512]; /* 0x1D000 - 0x1DFF8 */ 174 u64 cp_rd_resp_upper[512]; /* 0x1D000 - 0x1DFF8 */
175 uint64_t cp_rd_resp_parity[512]; /* 0x1E000 - 0x1EFF8 */ 175 u64 cp_rd_resp_parity[512]; /* 0x1E000 - 0x1EFF8 */
176 176
177 char _pad_01F000[0x20000 - 0x01F000]; 177 char _pad_01F000[0x20000 - 0x01F000];
178 178
179 /* 0x020000-0x021FFF -- Host Device (CP) Configuration Space (not used) */ 179 /* 0x020000-0x021FFF -- Host Device (CP) Configuration Space (not used) */
180 char _pad_020000[0x021000 - 0x20000]; 180 char _pad_020000[0x021000 - 0x20000];
181 181
182 /* 0x021000-0x027FFF -- PCI Device Configuration Spaces */ 182 /* 0x021000-0x027FFF -- PCI Device Configuration Spaces */
183 union { 183 union {
184 uint8_t c[0x1000 / 1]; /* 0x02{0000,,,7FFF} */ 184 u8 c[0x1000 / 1]; /* 0x02{0000,,,7FFF} */
185 uint16_t s[0x1000 / 2]; /* 0x02{0000,,,7FFF} */ 185 u16 s[0x1000 / 2]; /* 0x02{0000,,,7FFF} */
186 uint32_t l[0x1000 / 4]; /* 0x02{0000,,,7FFF} */ 186 u32 l[0x1000 / 4]; /* 0x02{0000,,,7FFF} */
187 uint64_t d[0x1000 / 8]; /* 0x02{0000,,,7FFF} */ 187 u64 d[0x1000 / 8]; /* 0x02{0000,,,7FFF} */
188 union { 188 union {
189 uint8_t c[0x100 / 1]; 189 u8 c[0x100 / 1];
190 uint16_t s[0x100 / 2]; 190 u16 s[0x100 / 2];
191 uint32_t l[0x100 / 4]; 191 u32 l[0x100 / 4];
192 uint64_t d[0x100 / 8]; 192 u64 d[0x100 / 8];
193 } f[8]; 193 } f[8];
194 } cp_type0_cfg_dev[7]; /* 0x02{1000,,,7FFF} */ 194 } cp_type0_cfg_dev[7]; /* 0x02{1000,,,7FFF} */
195 195
196 /* 0x028000-0x028FFF -- PCI Type 1 Configuration Space */ 196 /* 0x028000-0x028FFF -- PCI Type 1 Configuration Space */
197 union { 197 union {
198 uint8_t c[0x1000 / 1]; /* 0x028000-0x029000 */ 198 u8 c[0x1000 / 1]; /* 0x028000-0x029000 */
199 uint16_t s[0x1000 / 2]; /* 0x028000-0x029000 */ 199 u16 s[0x1000 / 2]; /* 0x028000-0x029000 */
200 uint32_t l[0x1000 / 4]; /* 0x028000-0x029000 */ 200 u32 l[0x1000 / 4]; /* 0x028000-0x029000 */
201 uint64_t d[0x1000 / 8]; /* 0x028000-0x029000 */ 201 u64 d[0x1000 / 8]; /* 0x028000-0x029000 */
202 union { 202 union {
203 uint8_t c[0x100 / 1]; 203 u8 c[0x100 / 1];
204 uint16_t s[0x100 / 2]; 204 u16 s[0x100 / 2];
205 uint32_t l[0x100 / 4]; 205 u32 l[0x100 / 4];
206 uint64_t d[0x100 / 8]; 206 u64 d[0x100 / 8];
207 } f[8]; 207 } f[8];
208 } cp_type1_cfg; /* 0x028000-0x029000 */ 208 } cp_type1_cfg; /* 0x028000-0x029000 */
209 209
@@ -211,30 +211,30 @@ struct tiocp{
211 211
212 /* 0x030000-0x030007 -- PCI Interrupt Acknowledge Cycle */ 212 /* 0x030000-0x030007 -- PCI Interrupt Acknowledge Cycle */
213 union { 213 union {
214 uint8_t c[8 / 1]; 214 u8 c[8 / 1];
215 uint16_t s[8 / 2]; 215 u16 s[8 / 2];
216 uint32_t l[8 / 4]; 216 u32 l[8 / 4];
217 uint64_t d[8 / 8]; 217 u64 d[8 / 8];
218 } cp_pci_iack; /* 0x030000-0x030007 */ 218 } cp_pci_iack; /* 0x030000-0x030007 */
219 219
220 char _pad_030007[0x040000-0x030008]; 220 char _pad_030007[0x040000-0x030008];
221 221
222 /* 0x040000-0x040007 -- PCIX Special Cycle */ 222 /* 0x040000-0x040007 -- PCIX Special Cycle */
223 union { 223 union {
224 uint8_t c[8 / 1]; 224 u8 c[8 / 1];
225 uint16_t s[8 / 2]; 225 u16 s[8 / 2];
226 uint32_t l[8 / 4]; 226 u32 l[8 / 4];
227 uint64_t d[8 / 8]; 227 u64 d[8 / 8];
228 } cp_pcix_cycle; /* 0x040000-0x040007 */ 228 } cp_pcix_cycle; /* 0x040000-0x040007 */
229 229
230 char _pad_040007[0x200000-0x040008]; 230 char _pad_040007[0x200000-0x040008];
231 231
232 /* 0x200000-0x7FFFFF -- PCI/GIO Device Spaces */ 232 /* 0x200000-0x7FFFFF -- PCI/GIO Device Spaces */
233 union { 233 union {
234 uint8_t c[0x100000 / 1]; 234 u8 c[0x100000 / 1];
235 uint16_t s[0x100000 / 2]; 235 u16 s[0x100000 / 2];
236 uint32_t l[0x100000 / 4]; 236 u32 l[0x100000 / 4];
237 uint64_t d[0x100000 / 8]; 237 u64 d[0x100000 / 8];
238 } cp_devio_raw[6]; /* 0x200000-0x7FFFFF */ 238 } cp_devio_raw[6]; /* 0x200000-0x7FFFFF */
239 239
240 #define cp_devio(n) cp_devio_raw[((n)<2)?(n*2):(n+2)] 240 #define cp_devio(n) cp_devio_raw[((n)<2)?(n*2):(n+2)]
@@ -243,10 +243,10 @@ struct tiocp{
243 243
244 /* 0xA00000-0xBFFFFF -- PCI/GIO Device Spaces w/flush */ 244 /* 0xA00000-0xBFFFFF -- PCI/GIO Device Spaces w/flush */
245 union { 245 union {
246 uint8_t c[0x100000 / 1]; 246 u8 c[0x100000 / 1];
247 uint16_t s[0x100000 / 2]; 247 u16 s[0x100000 / 2];
248 uint32_t l[0x100000 / 4]; 248 u32 l[0x100000 / 4];
249 uint64_t d[0x100000 / 8]; 249 u64 d[0x100000 / 8];
250 } cp_devio_raw_flush[6]; /* 0xA00000-0xBFFFFF */ 250 } cp_devio_raw_flush[6]; /* 0xA00000-0xBFFFFF */
251 251
252 #define cp_devio_flush(n) cp_devio_raw_flush[((n)<2)?(n*2):(n+2)] 252 #define cp_devio_flush(n) cp_devio_raw_flush[((n)<2)?(n*2):(n+2)]
diff --git a/include/asm-ia64/sn/tiocx.h b/include/asm-ia64/sn/tiocx.h
index 5699e75e5024..d29728492f36 100644
--- a/include/asm-ia64/sn/tiocx.h
+++ b/include/asm-ia64/sn/tiocx.h
@@ -40,10 +40,10 @@ struct cx_drv {
40}; 40};
41 41
42/* create DMA address by stripping AS bits */ 42/* create DMA address by stripping AS bits */
43#define TIOCX_DMA_ADDR(a) (uint64_t)((uint64_t)(a) & 0xffffcfffffffffUL) 43#define TIOCX_DMA_ADDR(a) (u64)((u64)(a) & 0xffffcfffffffffUL)
44 44
45#define TIOCX_TO_TIOCX_DMA_ADDR(a) (uint64_t)(((uint64_t)(a) & 0xfffffffff) | \ 45#define TIOCX_TO_TIOCX_DMA_ADDR(a) (u64)(((u64)(a) & 0xfffffffff) | \
46 ((((uint64_t)(a)) & 0xffffc000000000UL) <<2)) 46 ((((u64)(a)) & 0xffffc000000000UL) <<2))
47 47
48#define TIO_CE_ASIC_PARTNUM 0xce00 48#define TIO_CE_ASIC_PARTNUM 0xce00
49#define TIOCX_CORELET 3 49#define TIOCX_CORELET 3
@@ -63,10 +63,10 @@ extern int cx_device_unregister(struct cx_dev *);
63extern int cx_device_register(nasid_t, int, int, struct hubdev_info *, int); 63extern int cx_device_register(nasid_t, int, int, struct hubdev_info *, int);
64extern int cx_driver_unregister(struct cx_drv *); 64extern int cx_driver_unregister(struct cx_drv *);
65extern int cx_driver_register(struct cx_drv *); 65extern int cx_driver_register(struct cx_drv *);
66extern uint64_t tiocx_dma_addr(uint64_t addr); 66extern u64 tiocx_dma_addr(u64 addr);
67extern uint64_t tiocx_swin_base(int nasid); 67extern u64 tiocx_swin_base(int nasid);
68extern void tiocx_mmr_store(int nasid, uint64_t offset, uint64_t value); 68extern void tiocx_mmr_store(int nasid, u64 offset, u64 value);
69extern uint64_t tiocx_mmr_load(int nasid, uint64_t offset); 69extern u64 tiocx_mmr_load(int nasid, u64 offset);
70 70
71#endif // __KERNEL__ 71#endif // __KERNEL__
72#endif // _ASM_IA64_SN_TIO_TIOCX__ 72#endif // _ASM_IA64_SN_TIO_TIOCX__
diff --git a/include/asm-ia64/sn/xp.h b/include/asm-ia64/sn/xp.h
index 49faf8f26430..9bd2f9bf329b 100644
--- a/include/asm-ia64/sn/xp.h
+++ b/include/asm-ia64/sn/xp.h
@@ -18,6 +18,7 @@
18 18
19#include <linux/cache.h> 19#include <linux/cache.h>
20#include <linux/hardirq.h> 20#include <linux/hardirq.h>
21#include <linux/mutex.h>
21#include <asm/sn/types.h> 22#include <asm/sn/types.h>
22#include <asm/sn/bte.h> 23#include <asm/sn/bte.h>
23 24
@@ -227,7 +228,9 @@ enum xpc_retval {
227 228
228 xpcOpenCloseError, /* 50: channel open/close protocol error */ 229 xpcOpenCloseError, /* 50: channel open/close protocol error */
229 230
230 xpcUnknownReason /* 51: unknown reason -- must be last in list */ 231 xpcDisconnected, /* 51: channel disconnected (closed) */
232
233 xpcUnknownReason /* 52: unknown reason -- must be last in list */
231}; 234};
232 235
233 236
@@ -357,7 +360,7 @@ typedef void (*xpc_notify_func)(enum xpc_retval reason, partid_t partid,
357 * the channel. 360 * the channel.
358 */ 361 */
359struct xpc_registration { 362struct xpc_registration {
360 struct semaphore sema; 363 struct mutex mutex;
361 xpc_channel_func func; /* function to call */ 364 xpc_channel_func func; /* function to call */
362 void *key; /* pointer to user's key */ 365 void *key; /* pointer to user's key */
363 u16 nentries; /* #of msg entries in local msg queue */ 366 u16 nentries; /* #of msg entries in local msg queue */
diff --git a/include/asm-ia64/sn/xpc.h b/include/asm-ia64/sn/xpc.h
new file mode 100644
index 000000000000..0c36928ffd8b
--- /dev/null
+++ b/include/asm-ia64/sn/xpc.h
@@ -0,0 +1,1275 @@
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) 2004-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9
10/*
11 * Cross Partition Communication (XPC) structures and macros.
12 */
13
14#ifndef _ASM_IA64_SN_XPC_H
15#define _ASM_IA64_SN_XPC_H
16
17
18#include <linux/config.h>
19#include <linux/interrupt.h>
20#include <linux/sysctl.h>
21#include <linux/device.h>
22#include <linux/mutex.h>
23#include <linux/completion.h>
24#include <asm/pgtable.h>
25#include <asm/processor.h>
26#include <asm/sn/bte.h>
27#include <asm/sn/clksupport.h>
28#include <asm/sn/addrs.h>
29#include <asm/sn/mspec.h>
30#include <asm/sn/shub_mmr.h>
31#include <asm/sn/xp.h>
32
33
34/*
35 * XPC Version numbers consist of a major and minor number. XPC can always
36 * talk to versions with same major #, and never talk to versions with a
37 * different major #.
38 */
39#define _XPC_VERSION(_maj, _min) (((_maj) << 4) | ((_min) & 0xf))
40#define XPC_VERSION_MAJOR(_v) ((_v) >> 4)
41#define XPC_VERSION_MINOR(_v) ((_v) & 0xf)
42
43
44/*
45 * The next macros define word or bit representations for given
46 * C-brick nasid in either the SAL provided bit array representing
47 * nasids in the partition/machine or the AMO_t array used for
48 * inter-partition initiation communications.
49 *
50 * For SN2 machines, C-Bricks are alway even numbered NASIDs. As
51 * such, some space will be saved by insisting that nasid information
52 * passed from SAL always be packed for C-Bricks and the
53 * cross-partition interrupts use the same packing scheme.
54 */
55#define XPC_NASID_W_INDEX(_n) (((_n) / 64) / 2)
56#define XPC_NASID_B_INDEX(_n) (((_n) / 2) & (64 - 1))
57#define XPC_NASID_IN_ARRAY(_n, _p) ((_p)[XPC_NASID_W_INDEX(_n)] & \
58 (1UL << XPC_NASID_B_INDEX(_n)))
59#define XPC_NASID_FROM_W_B(_w, _b) (((_w) * 64 + (_b)) * 2)
60
61#define XPC_HB_DEFAULT_INTERVAL 5 /* incr HB every x secs */
62#define XPC_HB_CHECK_DEFAULT_INTERVAL 20 /* check HB every x secs */
63
64/* define the process name of HB checker and the CPU it is pinned to */
65#define XPC_HB_CHECK_THREAD_NAME "xpc_hb"
66#define XPC_HB_CHECK_CPU 0
67
68/* define the process name of the discovery thread */
69#define XPC_DISCOVERY_THREAD_NAME "xpc_discovery"
70
71
72/*
73 * the reserved page
74 *
75 * SAL reserves one page of memory per partition for XPC. Though a full page
76 * in length (16384 bytes), its starting address is not page aligned, but it
77 * is cacheline aligned. The reserved page consists of the following:
78 *
79 * reserved page header
80 *
81 * The first cacheline of the reserved page contains the header
82 * (struct xpc_rsvd_page). Before SAL initialization has completed,
83 * SAL has set up the following fields of the reserved page header:
84 * SAL_signature, SAL_version, partid, and nasids_size. The other
85 * fields are set up by XPC. (xpc_rsvd_page points to the local
86 * partition's reserved page.)
87 *
88 * part_nasids mask
89 * mach_nasids mask
90 *
91 * SAL also sets up two bitmaps (or masks), one that reflects the actual
92 * nasids in this partition (part_nasids), and the other that reflects
93 * the actual nasids in the entire machine (mach_nasids). We're only
94 * interested in the even numbered nasids (which contain the processors
95 * and/or memory), so we only need half as many bits to represent the
96 * nasids. The part_nasids mask is located starting at the first cacheline
97 * following the reserved page header. The mach_nasids mask follows right
98 * after the part_nasids mask. The size in bytes of each mask is reflected
99 * by the reserved page header field 'nasids_size'. (Local partition's
100 * mask pointers are xpc_part_nasids and xpc_mach_nasids.)
101 *
102 * vars
103 * vars part
104 *
105 * Immediately following the mach_nasids mask are the XPC variables
106 * required by other partitions. First are those that are generic to all
107 * partitions (vars), followed on the next available cacheline by those
108 * which are partition specific (vars part). These are setup by XPC.
109 * (Local partition's vars pointers are xpc_vars and xpc_vars_part.)
110 *
111 * Note: Until vars_pa is set, the partition XPC code has not been initialized.
112 */
113struct xpc_rsvd_page {
114 u64 SAL_signature; /* SAL: unique signature */
115 u64 SAL_version; /* SAL: version */
116 u8 partid; /* SAL: partition ID */
117 u8 version;
118 u8 pad1[6]; /* align to next u64 in cacheline */
119 volatile u64 vars_pa;
120 struct timespec stamp; /* time when reserved page was setup by XPC */
121 u64 pad2[9]; /* align to last u64 in cacheline */
122 u64 nasids_size; /* SAL: size of each nasid mask in bytes */
123};
124
125#define XPC_RP_VERSION _XPC_VERSION(1,1) /* version 1.1 of the reserved page */
126
127#define XPC_SUPPORTS_RP_STAMP(_version) \
128 (_version >= _XPC_VERSION(1,1))
129
130/*
131 * compare stamps - the return value is:
132 *
133 * < 0, if stamp1 < stamp2
134 * = 0, if stamp1 == stamp2
135 * > 0, if stamp1 > stamp2
136 */
137static inline int
138xpc_compare_stamps(struct timespec *stamp1, struct timespec *stamp2)
139{
140 int ret;
141
142
143 if ((ret = stamp1->tv_sec - stamp2->tv_sec) == 0) {
144 ret = stamp1->tv_nsec - stamp2->tv_nsec;
145 }
146 return ret;
147}
148
149
150/*
151 * Define the structures by which XPC variables can be exported to other
152 * partitions. (There are two: struct xpc_vars and struct xpc_vars_part)
153 */
154
155/*
156 * The following structure describes the partition generic variables
157 * needed by other partitions in order to properly initialize.
158 *
159 * struct xpc_vars version number also applies to struct xpc_vars_part.
160 * Changes to either structure and/or related functionality should be
161 * reflected by incrementing either the major or minor version numbers
162 * of struct xpc_vars.
163 */
164struct xpc_vars {
165 u8 version;
166 u64 heartbeat;
167 u64 heartbeating_to_mask;
168 u64 heartbeat_offline; /* if 0, heartbeat should be changing */
169 int act_nasid;
170 int act_phys_cpuid;
171 u64 vars_part_pa;
172 u64 amos_page_pa; /* paddr of page of AMOs from MSPEC driver */
173 AMO_t *amos_page; /* vaddr of page of AMOs from MSPEC driver */
174};
175
176#define XPC_V_VERSION _XPC_VERSION(3,1) /* version 3.1 of the cross vars */
177
178#define XPC_SUPPORTS_DISENGAGE_REQUEST(_version) \
179 (_version >= _XPC_VERSION(3,1))
180
181
182static inline int
183xpc_hb_allowed(partid_t partid, struct xpc_vars *vars)
184{
185 return ((vars->heartbeating_to_mask & (1UL << partid)) != 0);
186}
187
188static inline void
189xpc_allow_hb(partid_t partid, struct xpc_vars *vars)
190{
191 u64 old_mask, new_mask;
192
193 do {
194 old_mask = vars->heartbeating_to_mask;
195 new_mask = (old_mask | (1UL << partid));
196 } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
197 old_mask);
198}
199
200static inline void
201xpc_disallow_hb(partid_t partid, struct xpc_vars *vars)
202{
203 u64 old_mask, new_mask;
204
205 do {
206 old_mask = vars->heartbeating_to_mask;
207 new_mask = (old_mask & ~(1UL << partid));
208 } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
209 old_mask);
210}
211
212
213/*
214 * The AMOs page consists of a number of AMO variables which are divided into
215 * four groups, The first two groups are used to identify an IRQ's sender.
216 * These two groups consist of 64 and 128 AMO variables respectively. The last
217 * two groups, consisting of just one AMO variable each, are used to identify
218 * the remote partitions that are currently engaged (from the viewpoint of
219 * the XPC running on the remote partition).
220 */
221#define XPC_NOTIFY_IRQ_AMOS 0
222#define XPC_ACTIVATE_IRQ_AMOS (XPC_NOTIFY_IRQ_AMOS + XP_MAX_PARTITIONS)
223#define XPC_ENGAGED_PARTITIONS_AMO (XPC_ACTIVATE_IRQ_AMOS + XP_NASID_MASK_WORDS)
224#define XPC_DISENGAGE_REQUEST_AMO (XPC_ENGAGED_PARTITIONS_AMO + 1)
225
226
227/*
228 * The following structure describes the per partition specific variables.
229 *
230 * An array of these structures, one per partition, will be defined. As a
231 * partition becomes active XPC will copy the array entry corresponding to
232 * itself from that partition. It is desirable that the size of this
233 * structure evenly divide into a cacheline, such that none of the entries
234 * in this array crosses a cacheline boundary. As it is now, each entry
235 * occupies half a cacheline.
236 */
237struct xpc_vars_part {
238 volatile u64 magic;
239
240 u64 openclose_args_pa; /* physical address of open and close args */
241 u64 GPs_pa; /* physical address of Get/Put values */
242
243 u64 IPI_amo_pa; /* physical address of IPI AMO_t structure */
244 int IPI_nasid; /* nasid of where to send IPIs */
245 int IPI_phys_cpuid; /* physical CPU ID of where to send IPIs */
246
247 u8 nchannels; /* #of defined channels supported */
248
249 u8 reserved[23]; /* pad to a full 64 bytes */
250};
251
252/*
253 * The vars_part MAGIC numbers play a part in the first contact protocol.
254 *
255 * MAGIC1 indicates that the per partition specific variables for a remote
256 * partition have been initialized by this partition.
257 *
258 * MAGIC2 indicates that this partition has pulled the remote partititions
259 * per partition variables that pertain to this partition.
260 */
261#define XPC_VP_MAGIC1 0x0053524156435058L /* 'XPCVARS\0'L (little endian) */
262#define XPC_VP_MAGIC2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */
263
264
265/* the reserved page sizes and offsets */
266
267#define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page))
268#define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars))
269
270#define XPC_RP_PART_NASIDS(_rp) (u64 *) ((u8 *) _rp + XPC_RP_HEADER_SIZE)
271#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + xp_nasid_mask_words)
272#define XPC_RP_VARS(_rp) ((struct xpc_vars *) XPC_RP_MACH_NASIDS(_rp) + xp_nasid_mask_words)
273#define XPC_RP_VARS_PART(_rp) (struct xpc_vars_part *) ((u8 *) XPC_RP_VARS(rp) + XPC_RP_VARS_SIZE)
274
275
276/*
277 * Functions registered by add_timer() or called by kernel_thread() only
278 * allow for a single 64-bit argument. The following macros can be used to
279 * pack and unpack two (32-bit, 16-bit or 8-bit) arguments into or out from
280 * the passed argument.
281 */
282#define XPC_PACK_ARGS(_arg1, _arg2) \
283 ((((u64) _arg1) & 0xffffffff) | \
284 ((((u64) _arg2) & 0xffffffff) << 32))
285
286#define XPC_UNPACK_ARG1(_args) (((u64) _args) & 0xffffffff)
287#define XPC_UNPACK_ARG2(_args) ((((u64) _args) >> 32) & 0xffffffff)
288
289
290
291/*
292 * Define a Get/Put value pair (pointers) used with a message queue.
293 */
294struct xpc_gp {
295 volatile s64 get; /* Get value */
296 volatile s64 put; /* Put value */
297};
298
299#define XPC_GP_SIZE \
300 L1_CACHE_ALIGN(sizeof(struct xpc_gp) * XPC_NCHANNELS)
301
302
303
304/*
305 * Define a structure that contains arguments associated with opening and
306 * closing a channel.
307 */
308struct xpc_openclose_args {
309 u16 reason; /* reason why channel is closing */
310 u16 msg_size; /* sizeof each message entry */
311 u16 remote_nentries; /* #of message entries in remote msg queue */
312 u16 local_nentries; /* #of message entries in local msg queue */
313 u64 local_msgqueue_pa; /* physical address of local message queue */
314};
315
316#define XPC_OPENCLOSE_ARGS_SIZE \
317 L1_CACHE_ALIGN(sizeof(struct xpc_openclose_args) * XPC_NCHANNELS)
318
319
320
321/* struct xpc_msg flags */
322
323#define XPC_M_DONE 0x01 /* msg has been received/consumed */
324#define XPC_M_READY 0x02 /* msg is ready to be sent */
325#define XPC_M_INTERRUPT 0x04 /* send interrupt when msg consumed */
326
327
328#define XPC_MSG_ADDRESS(_payload) \
329 ((struct xpc_msg *)((u8 *)(_payload) - XPC_MSG_PAYLOAD_OFFSET))
330
331
332
333/*
334 * Defines notify entry.
335 *
336 * This is used to notify a message's sender that their message was received
337 * and consumed by the intended recipient.
338 */
339struct xpc_notify {
340 volatile u8 type; /* type of notification */
341
342 /* the following two fields are only used if type == XPC_N_CALL */
343 xpc_notify_func func; /* user's notify function */
344 void *key; /* pointer to user's key */
345};
346
347/* struct xpc_notify type of notification */
348
349#define XPC_N_CALL 0x01 /* notify function provided by user */
350
351
352
353/*
354 * Define the structure that manages all the stuff required by a channel. In
355 * particular, they are used to manage the messages sent across the channel.
356 *
357 * This structure is private to a partition, and is NOT shared across the
358 * partition boundary.
359 *
360 * There is an array of these structures for each remote partition. It is
361 * allocated at the time a partition becomes active. The array contains one
362 * of these structures for each potential channel connection to that partition.
363 *
364 * Each of these structures manages two message queues (circular buffers).
365 * They are allocated at the time a channel connection is made. One of
366 * these message queues (local_msgqueue) holds the locally created messages
367 * that are destined for the remote partition. The other of these message
368 * queues (remote_msgqueue) is a locally cached copy of the remote partition's
369 * own local_msgqueue.
370 *
371 * The following is a description of the Get/Put pointers used to manage these
372 * two message queues. Consider the local_msgqueue to be on one partition
373 * and the remote_msgqueue to be its cached copy on another partition. A
374 * description of what each of the lettered areas contains is included.
375 *
376 *
377 * local_msgqueue remote_msgqueue
378 *
379 * |/////////| |/////////|
380 * w_remote_GP.get --> +---------+ |/////////|
381 * | F | |/////////|
382 * remote_GP.get --> +---------+ +---------+ <-- local_GP->get
383 * | | | |
384 * | | | E |
385 * | | | |
386 * | | +---------+ <-- w_local_GP.get
387 * | B | |/////////|
388 * | | |////D////|
389 * | | |/////////|
390 * | | +---------+ <-- w_remote_GP.put
391 * | | |////C////|
392 * local_GP->put --> +---------+ +---------+ <-- remote_GP.put
393 * | | |/////////|
394 * | A | |/////////|
395 * | | |/////////|
396 * w_local_GP.put --> +---------+ |/////////|
397 * |/////////| |/////////|
398 *
399 *
400 * ( remote_GP.[get|put] are cached copies of the remote
401 * partition's local_GP->[get|put], and thus their values can
402 * lag behind their counterparts on the remote partition. )
403 *
404 *
405 * A - Messages that have been allocated, but have not yet been sent to the
406 * remote partition.
407 *
408 * B - Messages that have been sent, but have not yet been acknowledged by the
409 * remote partition as having been received.
410 *
411 * C - Area that needs to be prepared for the copying of sent messages, by
412 * the clearing of the message flags of any previously received messages.
413 *
414 * D - Area into which sent messages are to be copied from the remote
415 * partition's local_msgqueue and then delivered to their intended
416 * recipients. [ To allow for a multi-message copy, another pointer
417 * (next_msg_to_pull) has been added to keep track of the next message
418 * number needing to be copied (pulled). It chases after w_remote_GP.put.
419 * Any messages lying between w_local_GP.get and next_msg_to_pull have
420 * been copied and are ready to be delivered. ]
421 *
422 * E - Messages that have been copied and delivered, but have not yet been
423 * acknowledged by the recipient as having been received.
424 *
425 * F - Messages that have been acknowledged, but XPC has not yet notified the
426 * sender that the message was received by its intended recipient.
427 * This is also an area that needs to be prepared for the allocating of
428 * new messages, by the clearing of the message flags of the acknowledged
429 * messages.
430 */
431struct xpc_channel {
432 partid_t partid; /* ID of remote partition connected */
433 spinlock_t lock; /* lock for updating this structure */
434 u32 flags; /* general flags */
435
436 enum xpc_retval reason; /* reason why channel is disconnect'g */
437 int reason_line; /* line# disconnect initiated from */
438
439 u16 number; /* channel # */
440
441 u16 msg_size; /* sizeof each msg entry */
442 u16 local_nentries; /* #of msg entries in local msg queue */
443 u16 remote_nentries; /* #of msg entries in remote msg queue*/
444
445 void *local_msgqueue_base; /* base address of kmalloc'd space */
446 struct xpc_msg *local_msgqueue; /* local message queue */
447 void *remote_msgqueue_base; /* base address of kmalloc'd space */
448 struct xpc_msg *remote_msgqueue;/* cached copy of remote partition's */
449 /* local message queue */
450 u64 remote_msgqueue_pa; /* phys addr of remote partition's */
451 /* local message queue */
452
453 atomic_t references; /* #of external references to queues */
454
455 atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */
456 wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */
457
458 u8 delayed_IPI_flags; /* IPI flags received, but delayed */
459 /* action until channel disconnected */
460
461 /* queue of msg senders who want to be notified when msg received */
462
463 atomic_t n_to_notify; /* #of msg senders to notify */
464 struct xpc_notify *notify_queue;/* notify queue for messages sent */
465
466 xpc_channel_func func; /* user's channel function */
467 void *key; /* pointer to user's key */
468
469 struct mutex msg_to_pull_mutex; /* next msg to pull serialization */
470 struct completion wdisconnect_wait; /* wait for channel disconnect */
471
472 struct xpc_openclose_args *local_openclose_args; /* args passed on */
473 /* opening or closing of channel */
474
475 /* various flavors of local and remote Get/Put values */
476
477 struct xpc_gp *local_GP; /* local Get/Put values */
478 struct xpc_gp remote_GP; /* remote Get/Put values */
479 struct xpc_gp w_local_GP; /* working local Get/Put values */
480 struct xpc_gp w_remote_GP; /* working remote Get/Put values */
481 s64 next_msg_to_pull; /* Put value of next msg to pull */
482
483 /* kthread management related fields */
484
485// >>> rethink having kthreads_assigned_limit and kthreads_idle_limit; perhaps
486// >>> allow the assigned limit be unbounded and let the idle limit be dynamic
487// >>> dependent on activity over the last interval of time
488 atomic_t kthreads_assigned; /* #of kthreads assigned to channel */
489 u32 kthreads_assigned_limit; /* limit on #of kthreads assigned */
490 atomic_t kthreads_idle; /* #of kthreads idle waiting for work */
491 u32 kthreads_idle_limit; /* limit on #of kthreads idle */
492 atomic_t kthreads_active; /* #of kthreads actively working */
493 // >>> following field is temporary
494 u32 kthreads_created; /* total #of kthreads created */
495
496 wait_queue_head_t idle_wq; /* idle kthread wait queue */
497
498} ____cacheline_aligned;
499
500
501/* struct xpc_channel flags */
502
503#define XPC_C_WASCONNECTED 0x00000001 /* channel was connected */
504
505#define XPC_C_ROPENREPLY 0x00000002 /* remote open channel reply */
506#define XPC_C_OPENREPLY 0x00000004 /* local open channel reply */
507#define XPC_C_ROPENREQUEST 0x00000008 /* remote open channel request */
508#define XPC_C_OPENREQUEST 0x00000010 /* local open channel request */
509
510#define XPC_C_SETUP 0x00000020 /* channel's msgqueues are alloc'd */
511#define XPC_C_CONNECTCALLOUT 0x00000040 /* channel connected callout made */
512#define XPC_C_CONNECTED 0x00000080 /* local channel is connected */
513#define XPC_C_CONNECTING 0x00000100 /* channel is being connected */
514
515#define XPC_C_RCLOSEREPLY 0x00000200 /* remote close channel reply */
516#define XPC_C_CLOSEREPLY 0x00000400 /* local close channel reply */
517#define XPC_C_RCLOSEREQUEST 0x00000800 /* remote close channel request */
518#define XPC_C_CLOSEREQUEST 0x00001000 /* local close channel request */
519
520#define XPC_C_DISCONNECTED 0x00002000 /* channel is disconnected */
521#define XPC_C_DISCONNECTING 0x00004000 /* channel is being disconnected */
522#define XPC_C_DISCONNECTCALLOUT 0x00008000 /* chan disconnected callout made */
523#define XPC_C_WDISCONNECT 0x00010000 /* waiting for channel disconnect */
524
525
526
527/*
528 * Manages channels on a partition basis. There is one of these structures
529 * for each partition (a partition will never utilize the structure that
530 * represents itself).
531 */
532struct xpc_partition {
533
534 /* XPC HB infrastructure */
535
536 u8 remote_rp_version; /* version# of partition's rsvd pg */
537 struct timespec remote_rp_stamp;/* time when rsvd pg was initialized */
538 u64 remote_rp_pa; /* phys addr of partition's rsvd pg */
539 u64 remote_vars_pa; /* phys addr of partition's vars */
540 u64 remote_vars_part_pa; /* phys addr of partition's vars part */
541 u64 last_heartbeat; /* HB at last read */
542 u64 remote_amos_page_pa; /* phys addr of partition's amos page */
543 int remote_act_nasid; /* active part's act/deact nasid */
544 int remote_act_phys_cpuid; /* active part's act/deact phys cpuid */
545 u32 act_IRQ_rcvd; /* IRQs since activation */
546 spinlock_t act_lock; /* protect updating of act_state */
547 u8 act_state; /* from XPC HB viewpoint */
548 u8 remote_vars_version; /* version# of partition's vars */
549 enum xpc_retval reason; /* reason partition is deactivating */
550 int reason_line; /* line# deactivation initiated from */
551 int reactivate_nasid; /* nasid in partition to reactivate */
552
553 unsigned long disengage_request_timeout; /* timeout in jiffies */
554 struct timer_list disengage_request_timer;
555
556
557 /* XPC infrastructure referencing and teardown control */
558
559 volatile u8 setup_state; /* infrastructure setup state */
560 wait_queue_head_t teardown_wq; /* kthread waiting to teardown infra */
561 atomic_t references; /* #of references to infrastructure */
562
563
564 /*
565 * NONE OF THE PRECEDING FIELDS OF THIS STRUCTURE WILL BE CLEARED WHEN
566 * XPC SETS UP THE NECESSARY INFRASTRUCTURE TO SUPPORT CROSS PARTITION
567 * COMMUNICATION. ALL OF THE FOLLOWING FIELDS WILL BE CLEARED. (THE
568 * 'nchannels' FIELD MUST BE THE FIRST OF THE FIELDS TO BE CLEARED.)
569 */
570
571
572 u8 nchannels; /* #of defined channels supported */
573 atomic_t nchannels_active; /* #of channels that are not DISCONNECTED */
574 atomic_t nchannels_engaged;/* #of channels engaged with remote part */
575 struct xpc_channel *channels;/* array of channel structures */
576
577 void *local_GPs_base; /* base address of kmalloc'd space */
578 struct xpc_gp *local_GPs; /* local Get/Put values */
579 void *remote_GPs_base; /* base address of kmalloc'd space */
580 struct xpc_gp *remote_GPs;/* copy of remote partition's local Get/Put */
581 /* values */
582 u64 remote_GPs_pa; /* phys address of remote partition's local */
583 /* Get/Put values */
584
585
586 /* fields used to pass args when opening or closing a channel */
587
588 void *local_openclose_args_base; /* base address of kmalloc'd space */
589 struct xpc_openclose_args *local_openclose_args; /* local's args */
590 void *remote_openclose_args_base; /* base address of kmalloc'd space */
591 struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */
592 /* args */
593 u64 remote_openclose_args_pa; /* phys addr of remote's args */
594
595
596 /* IPI sending, receiving and handling related fields */
597
598 int remote_IPI_nasid; /* nasid of where to send IPIs */
599 int remote_IPI_phys_cpuid; /* phys CPU ID of where to send IPIs */
600 AMO_t *remote_IPI_amo_va; /* address of remote IPI AMO_t structure */
601
602 AMO_t *local_IPI_amo_va; /* address of IPI AMO_t structure */
603 u64 local_IPI_amo; /* IPI amo flags yet to be handled */
604 char IPI_owner[8]; /* IPI owner's name */
605 struct timer_list dropped_IPI_timer; /* dropped IPI timer */
606
607 spinlock_t IPI_lock; /* IPI handler lock */
608
609
610 /* channel manager related fields */
611
612 atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */
613 wait_queue_head_t channel_mgr_wq; /* channel mgr's wait queue */
614
615} ____cacheline_aligned;
616
617
618/* struct xpc_partition act_state values (for XPC HB) */
619
620#define XPC_P_INACTIVE 0x00 /* partition is not active */
621#define XPC_P_ACTIVATION_REQ 0x01 /* created thread to activate */
622#define XPC_P_ACTIVATING 0x02 /* activation thread started */
623#define XPC_P_ACTIVE 0x03 /* xpc_partition_up() was called */
624#define XPC_P_DEACTIVATING 0x04 /* partition deactivation initiated */
625
626
627#define XPC_DEACTIVATE_PARTITION(_p, _reason) \
628 xpc_deactivate_partition(__LINE__, (_p), (_reason))
629
630
631/* struct xpc_partition setup_state values */
632
633#define XPC_P_UNSET 0x00 /* infrastructure was never setup */
634#define XPC_P_SETUP 0x01 /* infrastructure is setup */
635#define XPC_P_WTEARDOWN 0x02 /* waiting to teardown infrastructure */
636#define XPC_P_TORNDOWN 0x03 /* infrastructure is torndown */
637
638
639
640/*
641 * struct xpc_partition IPI_timer #of seconds to wait before checking for
642 * dropped IPIs. These occur whenever an IPI amo write doesn't complete until
643 * after the IPI was received.
644 */
645#define XPC_P_DROPPED_IPI_WAIT (0.25 * HZ)
646
647
648/* number of seconds to wait for other partitions to disengage */
649#define XPC_DISENGAGE_REQUEST_DEFAULT_TIMELIMIT 90
650
651/* interval in seconds to print 'waiting disengagement' messages */
652#define XPC_DISENGAGE_PRINTMSG_INTERVAL 10
653
654
655#define XPC_PARTID(_p) ((partid_t) ((_p) - &xpc_partitions[0]))
656
657
658
659/* found in xp_main.c */
660extern struct xpc_registration xpc_registrations[];
661
662
663/* found in xpc_main.c */
664extern struct device *xpc_part;
665extern struct device *xpc_chan;
666extern int xpc_disengage_request_timelimit;
667extern int xpc_disengage_request_timedout;
668extern irqreturn_t xpc_notify_IRQ_handler(int, void *, struct pt_regs *);
669extern void xpc_dropped_IPI_check(struct xpc_partition *);
670extern void xpc_activate_partition(struct xpc_partition *);
671extern void xpc_activate_kthreads(struct xpc_channel *, int);
672extern void xpc_create_kthreads(struct xpc_channel *, int);
673extern void xpc_disconnect_wait(int);
674
675
676/* found in xpc_partition.c */
677extern int xpc_exiting;
678extern struct xpc_vars *xpc_vars;
679extern struct xpc_rsvd_page *xpc_rsvd_page;
680extern struct xpc_vars_part *xpc_vars_part;
681extern struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1];
682extern char xpc_remote_copy_buffer[];
683extern struct xpc_rsvd_page *xpc_rsvd_page_init(void);
684extern void xpc_allow_IPI_ops(void);
685extern void xpc_restrict_IPI_ops(void);
686extern int xpc_identify_act_IRQ_sender(void);
687extern int xpc_partition_disengaged(struct xpc_partition *);
688extern enum xpc_retval xpc_mark_partition_active(struct xpc_partition *);
689extern void xpc_mark_partition_inactive(struct xpc_partition *);
690extern void xpc_discovery(void);
691extern void xpc_check_remote_hb(void);
692extern void xpc_deactivate_partition(const int, struct xpc_partition *,
693 enum xpc_retval);
694extern enum xpc_retval xpc_initiate_partid_to_nasids(partid_t, void *);
695
696
697/* found in xpc_channel.c */
698extern void xpc_initiate_connect(int);
699extern void xpc_initiate_disconnect(int);
700extern enum xpc_retval xpc_initiate_allocate(partid_t, int, u32, void **);
701extern enum xpc_retval xpc_initiate_send(partid_t, int, void *);
702extern enum xpc_retval xpc_initiate_send_notify(partid_t, int, void *,
703 xpc_notify_func, void *);
704extern void xpc_initiate_received(partid_t, int, void *);
705extern enum xpc_retval xpc_setup_infrastructure(struct xpc_partition *);
706extern enum xpc_retval xpc_pull_remote_vars_part(struct xpc_partition *);
707extern void xpc_process_channel_activity(struct xpc_partition *);
708extern void xpc_connected_callout(struct xpc_channel *);
709extern void xpc_deliver_msg(struct xpc_channel *);
710extern void xpc_disconnect_channel(const int, struct xpc_channel *,
711 enum xpc_retval, unsigned long *);
712extern void xpc_disconnect_callout(struct xpc_channel *, enum xpc_retval);
713extern void xpc_partition_going_down(struct xpc_partition *, enum xpc_retval);
714extern void xpc_teardown_infrastructure(struct xpc_partition *);
715
716
717
718static inline void
719xpc_wakeup_channel_mgr(struct xpc_partition *part)
720{
721 if (atomic_inc_return(&part->channel_mgr_requests) == 1) {
722 wake_up(&part->channel_mgr_wq);
723 }
724}
725
726
727
728/*
729 * These next two inlines are used to keep us from tearing down a channel's
730 * msg queues while a thread may be referencing them.
731 */
732static inline void
733xpc_msgqueue_ref(struct xpc_channel *ch)
734{
735 atomic_inc(&ch->references);
736}
737
738static inline void
739xpc_msgqueue_deref(struct xpc_channel *ch)
740{
741 s32 refs = atomic_dec_return(&ch->references);
742
743 DBUG_ON(refs < 0);
744 if (refs == 0) {
745 xpc_wakeup_channel_mgr(&xpc_partitions[ch->partid]);
746 }
747}
748
749
750
751#define XPC_DISCONNECT_CHANNEL(_ch, _reason, _irqflgs) \
752 xpc_disconnect_channel(__LINE__, _ch, _reason, _irqflgs)
753
754
755/*
756 * These two inlines are used to keep us from tearing down a partition's
757 * setup infrastructure while a thread may be referencing it.
758 */
759static inline void
760xpc_part_deref(struct xpc_partition *part)
761{
762 s32 refs = atomic_dec_return(&part->references);
763
764
765 DBUG_ON(refs < 0);
766 if (refs == 0 && part->setup_state == XPC_P_WTEARDOWN) {
767 wake_up(&part->teardown_wq);
768 }
769}
770
771static inline int
772xpc_part_ref(struct xpc_partition *part)
773{
774 int setup;
775
776
777 atomic_inc(&part->references);
778 setup = (part->setup_state == XPC_P_SETUP);
779 if (!setup) {
780 xpc_part_deref(part);
781 }
782 return setup;
783}
784
785
786
787/*
788 * The following macro is to be used for the setting of the reason and
789 * reason_line fields in both the struct xpc_channel and struct xpc_partition
790 * structures.
791 */
792#define XPC_SET_REASON(_p, _reason, _line) \
793 { \
794 (_p)->reason = _reason; \
795 (_p)->reason_line = _line; \
796 }
797
798
799
800/*
801 * This next set of inlines are used to keep track of when a partition is
802 * potentially engaged in accessing memory belonging to another partition.
803 */
804
805static inline void
806xpc_mark_partition_engaged(struct xpc_partition *part)
807{
808 unsigned long irq_flags;
809 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
810 (XPC_ENGAGED_PARTITIONS_AMO * sizeof(AMO_t)));
811
812
813 local_irq_save(irq_flags);
814
815 /* set bit corresponding to our partid in remote partition's AMO */
816 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR,
817 (1UL << sn_partition_id));
818 /*
819 * We must always use the nofault function regardless of whether we
820 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
821 * didn't, we'd never know that the other partition is down and would
822 * keep sending IPIs and AMOs to it until the heartbeat times out.
823 */
824 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
825 variable), xp_nofault_PIOR_target));
826
827 local_irq_restore(irq_flags);
828}
829
830static inline void
831xpc_mark_partition_disengaged(struct xpc_partition *part)
832{
833 unsigned long irq_flags;
834 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
835 (XPC_ENGAGED_PARTITIONS_AMO * sizeof(AMO_t)));
836
837
838 local_irq_save(irq_flags);
839
840 /* clear bit corresponding to our partid in remote partition's AMO */
841 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
842 ~(1UL << sn_partition_id));
843 /*
844 * We must always use the nofault function regardless of whether we
845 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
846 * didn't, we'd never know that the other partition is down and would
847 * keep sending IPIs and AMOs to it until the heartbeat times out.
848 */
849 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
850 variable), xp_nofault_PIOR_target));
851
852 local_irq_restore(irq_flags);
853}
854
855static inline void
856xpc_request_partition_disengage(struct xpc_partition *part)
857{
858 unsigned long irq_flags;
859 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
860 (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
861
862
863 local_irq_save(irq_flags);
864
865 /* set bit corresponding to our partid in remote partition's AMO */
866 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR,
867 (1UL << sn_partition_id));
868 /*
869 * We must always use the nofault function regardless of whether we
870 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
871 * didn't, we'd never know that the other partition is down and would
872 * keep sending IPIs and AMOs to it until the heartbeat times out.
873 */
874 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
875 variable), xp_nofault_PIOR_target));
876
877 local_irq_restore(irq_flags);
878}
879
880static inline void
881xpc_cancel_partition_disengage_request(struct xpc_partition *part)
882{
883 unsigned long irq_flags;
884 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
885 (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
886
887
888 local_irq_save(irq_flags);
889
890 /* clear bit corresponding to our partid in remote partition's AMO */
891 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
892 ~(1UL << sn_partition_id));
893 /*
894 * We must always use the nofault function regardless of whether we
895 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
896 * didn't, we'd never know that the other partition is down and would
897 * keep sending IPIs and AMOs to it until the heartbeat times out.
898 */
899 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
900 variable), xp_nofault_PIOR_target));
901
902 local_irq_restore(irq_flags);
903}
904
905static inline u64
906xpc_partition_engaged(u64 partid_mask)
907{
908 AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
909
910
911 /* return our partition's AMO variable ANDed with partid_mask */
912 return (FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_LOAD) &
913 partid_mask);
914}
915
916static inline u64
917xpc_partition_disengage_requested(u64 partid_mask)
918{
919 AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
920
921
922 /* return our partition's AMO variable ANDed with partid_mask */
923 return (FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_LOAD) &
924 partid_mask);
925}
926
927static inline void
928xpc_clear_partition_engaged(u64 partid_mask)
929{
930 AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
931
932
933 /* clear bit(s) based on partid_mask in our partition's AMO */
934 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
935 ~partid_mask);
936}
937
938static inline void
939xpc_clear_partition_disengage_request(u64 partid_mask)
940{
941 AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
942
943
944 /* clear bit(s) based on partid_mask in our partition's AMO */
945 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
946 ~partid_mask);
947}
948
949
950
951/*
952 * The following set of macros and inlines are used for the sending and
953 * receiving of IPIs (also known as IRQs). There are two flavors of IPIs,
954 * one that is associated with partition activity (SGI_XPC_ACTIVATE) and
955 * the other that is associated with channel activity (SGI_XPC_NOTIFY).
956 */
957
958static inline u64
959xpc_IPI_receive(AMO_t *amo)
960{
961 return FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_CLEAR);
962}
963
964
965static inline enum xpc_retval
966xpc_IPI_send(AMO_t *amo, u64 flag, int nasid, int phys_cpuid, int vector)
967{
968 int ret = 0;
969 unsigned long irq_flags;
970
971
972 local_irq_save(irq_flags);
973
974 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR, flag);
975 sn_send_IPI_phys(nasid, phys_cpuid, vector, 0);
976
977 /*
978 * We must always use the nofault function regardless of whether we
979 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
980 * didn't, we'd never know that the other partition is down and would
981 * keep sending IPIs and AMOs to it until the heartbeat times out.
982 */
983 ret = xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->variable),
984 xp_nofault_PIOR_target));
985
986 local_irq_restore(irq_flags);
987
988 return ((ret == 0) ? xpcSuccess : xpcPioReadError);
989}
990
991
992/*
993 * IPIs associated with SGI_XPC_ACTIVATE IRQ.
994 */
995
996/*
997 * Flag the appropriate AMO variable and send an IPI to the specified node.
998 */
999static inline void
1000xpc_activate_IRQ_send(u64 amos_page_pa, int from_nasid, int to_nasid,
1001 int to_phys_cpuid)
1002{
1003 int w_index = XPC_NASID_W_INDEX(from_nasid);
1004 int b_index = XPC_NASID_B_INDEX(from_nasid);
1005 AMO_t *amos = (AMO_t *) __va(amos_page_pa +
1006 (XPC_ACTIVATE_IRQ_AMOS * sizeof(AMO_t)));
1007
1008
1009 (void) xpc_IPI_send(&amos[w_index], (1UL << b_index), to_nasid,
1010 to_phys_cpuid, SGI_XPC_ACTIVATE);
1011}
1012
1013static inline void
1014xpc_IPI_send_activate(struct xpc_vars *vars)
1015{
1016 xpc_activate_IRQ_send(vars->amos_page_pa, cnodeid_to_nasid(0),
1017 vars->act_nasid, vars->act_phys_cpuid);
1018}
1019
1020static inline void
1021xpc_IPI_send_activated(struct xpc_partition *part)
1022{
1023 xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
1024 part->remote_act_nasid, part->remote_act_phys_cpuid);
1025}
1026
1027static inline void
1028xpc_IPI_send_reactivate(struct xpc_partition *part)
1029{
1030 xpc_activate_IRQ_send(xpc_vars->amos_page_pa, part->reactivate_nasid,
1031 xpc_vars->act_nasid, xpc_vars->act_phys_cpuid);
1032}
1033
1034static inline void
1035xpc_IPI_send_disengage(struct xpc_partition *part)
1036{
1037 xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
1038 part->remote_act_nasid, part->remote_act_phys_cpuid);
1039}
1040
1041
1042/*
1043 * IPIs associated with SGI_XPC_NOTIFY IRQ.
1044 */
1045
1046/*
1047 * Send an IPI to the remote partition that is associated with the
1048 * specified channel.
1049 */
1050#define XPC_NOTIFY_IRQ_SEND(_ch, _ipi_f, _irq_f) \
1051 xpc_notify_IRQ_send(_ch, _ipi_f, #_ipi_f, _irq_f)
1052
1053static inline void
1054xpc_notify_IRQ_send(struct xpc_channel *ch, u8 ipi_flag, char *ipi_flag_string,
1055 unsigned long *irq_flags)
1056{
1057 struct xpc_partition *part = &xpc_partitions[ch->partid];
1058 enum xpc_retval ret;
1059
1060
1061 if (likely(part->act_state != XPC_P_DEACTIVATING)) {
1062 ret = xpc_IPI_send(part->remote_IPI_amo_va,
1063 (u64) ipi_flag << (ch->number * 8),
1064 part->remote_IPI_nasid,
1065 part->remote_IPI_phys_cpuid,
1066 SGI_XPC_NOTIFY);
1067 dev_dbg(xpc_chan, "%s sent to partid=%d, channel=%d, ret=%d\n",
1068 ipi_flag_string, ch->partid, ch->number, ret);
1069 if (unlikely(ret != xpcSuccess)) {
1070 if (irq_flags != NULL) {
1071 spin_unlock_irqrestore(&ch->lock, *irq_flags);
1072 }
1073 XPC_DEACTIVATE_PARTITION(part, ret);
1074 if (irq_flags != NULL) {
1075 spin_lock_irqsave(&ch->lock, *irq_flags);
1076 }
1077 }
1078 }
1079}
1080
1081
1082/*
1083 * Make it look like the remote partition, which is associated with the
1084 * specified channel, sent us an IPI. This faked IPI will be handled
1085 * by xpc_dropped_IPI_check().
1086 */
1087#define XPC_NOTIFY_IRQ_SEND_LOCAL(_ch, _ipi_f) \
1088 xpc_notify_IRQ_send_local(_ch, _ipi_f, #_ipi_f)
1089
1090static inline void
1091xpc_notify_IRQ_send_local(struct xpc_channel *ch, u8 ipi_flag,
1092 char *ipi_flag_string)
1093{
1094 struct xpc_partition *part = &xpc_partitions[ch->partid];
1095
1096
1097 FETCHOP_STORE_OP(TO_AMO((u64) &part->local_IPI_amo_va->variable),
1098 FETCHOP_OR, ((u64) ipi_flag << (ch->number * 8)));
1099 dev_dbg(xpc_chan, "%s sent local from partid=%d, channel=%d\n",
1100 ipi_flag_string, ch->partid, ch->number);
1101}
1102
1103
1104/*
1105 * The sending and receiving of IPIs includes the setting of an AMO variable
1106 * to indicate the reason the IPI was sent. The 64-bit variable is divided
1107 * up into eight bytes, ordered from right to left. Byte zero pertains to
1108 * channel 0, byte one to channel 1, and so on. Each byte is described by
1109 * the following IPI flags.
1110 */
1111
1112#define XPC_IPI_CLOSEREQUEST 0x01
1113#define XPC_IPI_CLOSEREPLY 0x02
1114#define XPC_IPI_OPENREQUEST 0x04
1115#define XPC_IPI_OPENREPLY 0x08
1116#define XPC_IPI_MSGREQUEST 0x10
1117
1118
1119/* given an AMO variable and a channel#, get its associated IPI flags */
1120#define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff))
1121#define XPC_SET_IPI_FLAGS(_amo, _c, _f) (_amo) |= ((u64) (_f) << ((_c) * 8))
1122
1123#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0f)
1124#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & 0x1010101010101010)
1125
1126
1127static inline void
1128xpc_IPI_send_closerequest(struct xpc_channel *ch, unsigned long *irq_flags)
1129{
1130 struct xpc_openclose_args *args = ch->local_openclose_args;
1131
1132
1133 args->reason = ch->reason;
1134
1135 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_CLOSEREQUEST, irq_flags);
1136}
1137
1138static inline void
1139xpc_IPI_send_closereply(struct xpc_channel *ch, unsigned long *irq_flags)
1140{
1141 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_CLOSEREPLY, irq_flags);
1142}
1143
1144static inline void
1145xpc_IPI_send_openrequest(struct xpc_channel *ch, unsigned long *irq_flags)
1146{
1147 struct xpc_openclose_args *args = ch->local_openclose_args;
1148
1149
1150 args->msg_size = ch->msg_size;
1151 args->local_nentries = ch->local_nentries;
1152
1153 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_OPENREQUEST, irq_flags);
1154}
1155
1156static inline void
1157xpc_IPI_send_openreply(struct xpc_channel *ch, unsigned long *irq_flags)
1158{
1159 struct xpc_openclose_args *args = ch->local_openclose_args;
1160
1161
1162 args->remote_nentries = ch->remote_nentries;
1163 args->local_nentries = ch->local_nentries;
1164 args->local_msgqueue_pa = __pa(ch->local_msgqueue);
1165
1166 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_OPENREPLY, irq_flags);
1167}
1168
1169static inline void
1170xpc_IPI_send_msgrequest(struct xpc_channel *ch)
1171{
1172 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_MSGREQUEST, NULL);
1173}
1174
1175static inline void
1176xpc_IPI_send_local_msgrequest(struct xpc_channel *ch)
1177{
1178 XPC_NOTIFY_IRQ_SEND_LOCAL(ch, XPC_IPI_MSGREQUEST);
1179}
1180
1181
1182/*
1183 * Memory for XPC's AMO variables is allocated by the MSPEC driver. These
1184 * pages are located in the lowest granule. The lowest granule uses 4k pages
1185 * for cached references and an alternate TLB handler to never provide a
1186 * cacheable mapping for the entire region. This will prevent speculative
1187 * reading of cached copies of our lines from being issued which will cause
1188 * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64
1189 * AMO variables (based on XP_MAX_PARTITIONS) for message notification and an
1190 * additional 128 AMO variables (based on XP_NASID_MASK_WORDS) for partition
1191 * activation and 2 AMO variables for partition deactivation.
1192 */
1193static inline AMO_t *
1194xpc_IPI_init(int index)
1195{
1196 AMO_t *amo = xpc_vars->amos_page + index;
1197
1198
1199 (void) xpc_IPI_receive(amo); /* clear AMO variable */
1200 return amo;
1201}
1202
1203
1204
1205static inline enum xpc_retval
1206xpc_map_bte_errors(bte_result_t error)
1207{
1208 switch (error) {
1209 case BTE_SUCCESS: return xpcSuccess;
1210 case BTEFAIL_DIR: return xpcBteDirectoryError;
1211 case BTEFAIL_POISON: return xpcBtePoisonError;
1212 case BTEFAIL_WERR: return xpcBteWriteError;
1213 case BTEFAIL_ACCESS: return xpcBteAccessError;
1214 case BTEFAIL_PWERR: return xpcBtePWriteError;
1215 case BTEFAIL_PRERR: return xpcBtePReadError;
1216 case BTEFAIL_TOUT: return xpcBteTimeOutError;
1217 case BTEFAIL_XTERR: return xpcBteXtalkError;
1218 case BTEFAIL_NOTAVAIL: return xpcBteNotAvailable;
1219 default: return xpcBteUnmappedError;
1220 }
1221}
1222
1223
1224
1225static inline void *
1226xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
1227{
1228 /* see if kmalloc will give us cachline aligned memory by default */
1229 *base = kmalloc(size, flags);
1230 if (*base == NULL) {
1231 return NULL;
1232 }
1233 if ((u64) *base == L1_CACHE_ALIGN((u64) *base)) {
1234 return *base;
1235 }
1236 kfree(*base);
1237
1238 /* nope, we'll have to do it ourselves */
1239 *base = kmalloc(size + L1_CACHE_BYTES, flags);
1240 if (*base == NULL) {
1241 return NULL;
1242 }
1243 return (void *) L1_CACHE_ALIGN((u64) *base);
1244}
1245
1246
1247/*
1248 * Check to see if there is any channel activity to/from the specified
1249 * partition.
1250 */
1251static inline void
1252xpc_check_for_channel_activity(struct xpc_partition *part)
1253{
1254 u64 IPI_amo;
1255 unsigned long irq_flags;
1256
1257
1258 IPI_amo = xpc_IPI_receive(part->local_IPI_amo_va);
1259 if (IPI_amo == 0) {
1260 return;
1261 }
1262
1263 spin_lock_irqsave(&part->IPI_lock, irq_flags);
1264 part->local_IPI_amo |= IPI_amo;
1265 spin_unlock_irqrestore(&part->IPI_lock, irq_flags);
1266
1267 dev_dbg(xpc_chan, "received IPI from partid=%d, IPI_amo=0x%lx\n",
1268 XPC_PARTID(part), IPI_amo);
1269
1270 xpc_wakeup_channel_mgr(part);
1271}
1272
1273
1274#endif /* _ASM_IA64_SN_XPC_H */
1275
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..1d6518fe1f02 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))
@@ -84,6 +93,7 @@ struct thread_info {
84#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 93#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
85#define TIF_MEMDIE 17 94#define TIF_MEMDIE 17
86#define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ 95#define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */
96#define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */
87 97
88#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 98#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
89#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 99#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
@@ -91,9 +101,10 @@ struct thread_info {
91#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 101#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
92#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 102#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
93#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 103#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
94#define _TIF_SIGDELAYED (1 << TIF_SIGDELAYED) 104#define _TIF_SIGDELAYED (1 << TIF_SIGDELAYED)
95#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 105#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
96#define _TIF_MCA_INIT (1 << TIF_MCA_INIT) 106#define _TIF_MCA_INIT (1 << TIF_MCA_INIT)
107#define _TIF_DB_DISABLED (1 << TIF_DB_DISABLED)
97 108
98/* "work to do on user-return" bits */ 109/* "work to do on user-return" bits */
99#define TIF_ALLWORK_MASK (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SIGDELAYED) 110#define TIF_ALLWORK_MASK (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SIGDELAYED)
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
index f7c330467e7e..412ef8e493a8 100644
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -18,6 +18,10 @@
18#include <asm/smp.h> 18#include <asm/smp.h>
19 19
20#ifdef CONFIG_NUMA 20#ifdef CONFIG_NUMA
21
22/* Nodes w/o CPUs are preferred for memory allocations, see build_zonelists */
23#define PENALTY_FOR_NODE_WITH_CPUS 255
24
21/* 25/*
22 * Returns the number of the node containing CPU 'cpu' 26 * Returns the number of the node containing CPU 'cpu'
23 */ 27 */
@@ -55,7 +59,6 @@ void build_cpu_to_node_map(void);
55 .max_interval = 4, \ 59 .max_interval = 4, \
56 .busy_factor = 64, \ 60 .busy_factor = 64, \
57 .imbalance_pct = 125, \ 61 .imbalance_pct = 125, \
58 .cache_hot_time = (10*1000000), \
59 .per_cpu_gain = 100, \ 62 .per_cpu_gain = 100, \
60 .cache_nice_tries = 2, \ 63 .cache_nice_tries = 2, \
61 .busy_idx = 2, \ 64 .busy_idx = 2, \
@@ -81,7 +84,6 @@ void build_cpu_to_node_map(void);
81 .max_interval = 8*(min(num_online_cpus(), 32)), \ 84 .max_interval = 8*(min(num_online_cpus(), 32)), \
82 .busy_factor = 64, \ 85 .busy_factor = 64, \
83 .imbalance_pct = 125, \ 86 .imbalance_pct = 125, \
84 .cache_hot_time = (10*1000000), \
85 .cache_nice_tries = 2, \ 87 .cache_nice_tries = 2, \
86 .busy_idx = 3, \ 88 .busy_idx = 3, \
87 .idle_idx = 2, \ 89 .idle_idx = 2, \
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 2bf543493cb8..962f9bd1bdff 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -269,12 +269,13 @@
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/atomic.h b/include/asm-m32r/atomic.h
index 70761278b6cb..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
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/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/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 dcf619a0a0b0..06c12a037cba 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -68,6 +68,16 @@
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) && !defined(CONFIG_CHIP_M32104) 82#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104)
73#define local_irq_enable() \ 83#define local_irq_enable() \
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-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 b8a4e75d679d..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({ \
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 127ad190cf2d..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
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/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 1702dbe9318c..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({ \
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index 4058dd086a02..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}
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/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/atomic.h b/include/asm-mips/atomic.h
index 92256e43a938..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;
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/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/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 64ebd086c40d..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
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/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 ae395a0632a6..147a38dcc766 100644
--- a/include/asm-powerpc/atomic.h
+++ b/include/asm-powerpc/atomic.h
@@ -36,7 +36,7 @@ static __inline__ int atomic_add_return(int a, atomic_t *v)
36 int t; 36 int t;
37 37
38 __asm__ __volatile__( 38 __asm__ __volatile__(
39 EIEIO_ON_SMP 39 LWSYNC_ON_SMP
40"1: lwarx %0,0,%2 # atomic_add_return\n\ 40"1: lwarx %0,0,%2 # atomic_add_return\n\
41 add %0,%1,%0\n" 41 add %0,%1,%0\n"
42 PPC405_ERR77(0,%2) 42 PPC405_ERR77(0,%2)
@@ -72,7 +72,7 @@ static __inline__ int atomic_sub_return(int a, atomic_t *v)
72 int t; 72 int t;
73 73
74 __asm__ __volatile__( 74 __asm__ __volatile__(
75 EIEIO_ON_SMP 75 LWSYNC_ON_SMP
76"1: lwarx %0,0,%2 # atomic_sub_return\n\ 76"1: lwarx %0,0,%2 # atomic_sub_return\n\
77 subf %0,%1,%0\n" 77 subf %0,%1,%0\n"
78 PPC405_ERR77(0,%2) 78 PPC405_ERR77(0,%2)
@@ -106,7 +106,7 @@ static __inline__ int atomic_inc_return(atomic_t *v)
106 int t; 106 int t;
107 107
108 __asm__ __volatile__( 108 __asm__ __volatile__(
109 EIEIO_ON_SMP 109 LWSYNC_ON_SMP
110"1: lwarx %0,0,%1 # atomic_inc_return\n\ 110"1: lwarx %0,0,%1 # atomic_inc_return\n\
111 addic %0,%0,1\n" 111 addic %0,%0,1\n"
112 PPC405_ERR77(0,%1) 112 PPC405_ERR77(0,%1)
@@ -150,7 +150,7 @@ static __inline__ int atomic_dec_return(atomic_t *v)
150 int t; 150 int t;
151 151
152 __asm__ __volatile__( 152 __asm__ __volatile__(
153 EIEIO_ON_SMP 153 LWSYNC_ON_SMP
154"1: lwarx %0,0,%1 # atomic_dec_return\n\ 154"1: lwarx %0,0,%1 # atomic_dec_return\n\
155 addic %0,%0,-1\n" 155 addic %0,%0,-1\n"
156 PPC405_ERR77(0,%1) 156 PPC405_ERR77(0,%1)
@@ -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
@@ -175,19 +176,19 @@ static __inline__ int atomic_dec_return(atomic_t *v)
175 * Atomically adds @a to @v, so long as it was not @u. 176 * Atomically adds @a to @v, so long as it was not @u.
176 * Returns non-zero if @v was not @u, and zero otherwise. 177 * Returns non-zero if @v was not @u, and zero otherwise.
177 */ 178 */
178#define atomic_add_unless(v, a, u) \ 179#define atomic_add_unless(v, a, u) \
179({ \ 180({ \
180 int c, old; \ 181 int c, old; \
181 c = atomic_read(v); \ 182 c = atomic_read(v); \
182 for (;;) { \ 183 for (;;) { \
183 if (unlikely(c == (u))) \ 184 if (unlikely(c == (u))) \
184 break; \ 185 break; \
185 old = atomic_cmpxchg((v), c, c + (a)); \ 186 old = atomic_cmpxchg((v), c, c + (a)); \
186 if (likely(old == c)) \ 187 if (likely(old == c)) \
187 break; \ 188 break; \
188 c = old; \ 189 c = old; \
189 } \ 190 } \
190 c != (u); \ 191 c != (u); \
191}) 192})
192#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 193#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
193 194
@@ -203,7 +204,7 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v)
203 int t; 204 int t;
204 205
205 __asm__ __volatile__( 206 __asm__ __volatile__(
206 EIEIO_ON_SMP 207 LWSYNC_ON_SMP
207"1: lwarx %0,0,%1 # atomic_dec_if_positive\n\ 208"1: lwarx %0,0,%1 # atomic_dec_if_positive\n\
208 addic. %0,%0,-1\n\ 209 addic. %0,%0,-1\n\
209 blt- 2f\n" 210 blt- 2f\n"
@@ -252,7 +253,7 @@ static __inline__ long atomic64_add_return(long a, atomic64_t *v)
252 long t; 253 long t;
253 254
254 __asm__ __volatile__( 255 __asm__ __volatile__(
255 EIEIO_ON_SMP 256 LWSYNC_ON_SMP
256"1: ldarx %0,0,%2 # atomic64_add_return\n\ 257"1: ldarx %0,0,%2 # atomic64_add_return\n\
257 add %0,%1,%0\n\ 258 add %0,%1,%0\n\
258 stdcx. %0,0,%2 \n\ 259 stdcx. %0,0,%2 \n\
@@ -286,7 +287,7 @@ static __inline__ long atomic64_sub_return(long a, atomic64_t *v)
286 long t; 287 long t;
287 288
288 __asm__ __volatile__( 289 __asm__ __volatile__(
289 EIEIO_ON_SMP 290 LWSYNC_ON_SMP
290"1: ldarx %0,0,%2 # atomic64_sub_return\n\ 291"1: ldarx %0,0,%2 # atomic64_sub_return\n\
291 subf %0,%1,%0\n\ 292 subf %0,%1,%0\n\
292 stdcx. %0,0,%2 \n\ 293 stdcx. %0,0,%2 \n\
@@ -318,7 +319,7 @@ static __inline__ long atomic64_inc_return(atomic64_t *v)
318 long t; 319 long t;
319 320
320 __asm__ __volatile__( 321 __asm__ __volatile__(
321 EIEIO_ON_SMP 322 LWSYNC_ON_SMP
322"1: ldarx %0,0,%1 # atomic64_inc_return\n\ 323"1: ldarx %0,0,%1 # atomic64_inc_return\n\
323 addic %0,%0,1\n\ 324 addic %0,%0,1\n\
324 stdcx. %0,0,%1 \n\ 325 stdcx. %0,0,%1 \n\
@@ -360,7 +361,7 @@ static __inline__ long atomic64_dec_return(atomic64_t *v)
360 long t; 361 long t;
361 362
362 __asm__ __volatile__( 363 __asm__ __volatile__(
363 EIEIO_ON_SMP 364 LWSYNC_ON_SMP
364"1: ldarx %0,0,%1 # atomic64_dec_return\n\ 365"1: ldarx %0,0,%1 # atomic64_dec_return\n\
365 addic %0,%0,-1\n\ 366 addic %0,%0,-1\n\
366 stdcx. %0,0,%1\n\ 367 stdcx. %0,0,%1\n\
@@ -385,7 +386,7 @@ static __inline__ long atomic64_dec_if_positive(atomic64_t *v)
385 long t; 386 long t;
386 387
387 __asm__ __volatile__( 388 __asm__ __volatile__(
388 EIEIO_ON_SMP 389 LWSYNC_ON_SMP
389"1: ldarx %0,0,%1 # atomic64_dec_if_positive\n\ 390"1: ldarx %0,0,%1 # atomic64_dec_if_positive\n\
390 addic. %0,%0,-1\n\ 391 addic. %0,%0,-1\n\
391 blt- 2f\n\ 392 blt- 2f\n\
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index 1996eaa8aeae..bf6941a810b8 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -112,7 +112,7 @@ static __inline__ int test_and_set_bit(unsigned long nr,
112 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 112 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
113 113
114 __asm__ __volatile__( 114 __asm__ __volatile__(
115 EIEIO_ON_SMP 115 LWSYNC_ON_SMP
116"1:" PPC_LLARX "%0,0,%3 # test_and_set_bit\n" 116"1:" PPC_LLARX "%0,0,%3 # test_and_set_bit\n"
117 "or %1,%0,%2 \n" 117 "or %1,%0,%2 \n"
118 PPC405_ERR77(0,%3) 118 PPC405_ERR77(0,%3)
@@ -134,7 +134,7 @@ static __inline__ int test_and_clear_bit(unsigned long nr,
134 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 134 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
135 135
136 __asm__ __volatile__( 136 __asm__ __volatile__(
137 EIEIO_ON_SMP 137 LWSYNC_ON_SMP
138"1:" PPC_LLARX "%0,0,%3 # test_and_clear_bit\n" 138"1:" PPC_LLARX "%0,0,%3 # test_and_clear_bit\n"
139 "andc %1,%0,%2 \n" 139 "andc %1,%0,%2 \n"
140 PPC405_ERR77(0,%3) 140 PPC405_ERR77(0,%3)
@@ -156,7 +156,7 @@ static __inline__ int test_and_change_bit(unsigned long nr,
156 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 156 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
157 157
158 __asm__ __volatile__( 158 __asm__ __volatile__(
159 EIEIO_ON_SMP 159 LWSYNC_ON_SMP
160"1:" PPC_LLARX "%0,0,%3 # test_and_change_bit\n" 160"1:" PPC_LLARX "%0,0,%3 # test_and_change_bit\n"
161 "xor %1,%0,%2 \n" 161 "xor %1,%0,%2 \n"
162 PPC405_ERR77(0,%3) 162 PPC405_ERR77(0,%3)
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..64210549f56b 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
@@ -20,6 +19,7 @@
20#define PPC_FEATURE_POWER5 0x00040000 19#define PPC_FEATURE_POWER5 0x00040000
21#define PPC_FEATURE_POWER5_PLUS 0x00020000 20#define PPC_FEATURE_POWER5_PLUS 0x00020000
22#define PPC_FEATURE_CELL 0x00010000 21#define PPC_FEATURE_CELL 0x00010000
22#define PPC_FEATURE_BOOKE 0x00008000
23 23
24#ifdef __KERNEL__ 24#ifdef __KERNEL__
25#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
@@ -28,10 +28,17 @@
28 * via the mkdefs mechanism. 28 * via the mkdefs mechanism.
29 */ 29 */
30struct cpu_spec; 30struct cpu_spec;
31struct op_powerpc_model;
32 31
33typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); 32typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
34 33
34enum powerpc_oprofile_type {
35 PPC_OPROFILE_INVALID = 0,
36 PPC_OPROFILE_RS64 = 1,
37 PPC_OPROFILE_POWER4 = 2,
38 PPC_OPROFILE_G4 = 3,
39 PPC_OPROFILE_BOOKE = 4,
40};
41
35struct cpu_spec { 42struct cpu_spec {
36 /* CPU is matched via (PVR & pvr_mask) == pvr_value */ 43 /* CPU is matched via (PVR & pvr_mask) == pvr_value */
37 unsigned int pvr_mask; 44 unsigned int pvr_mask;
@@ -57,7 +64,10 @@ struct cpu_spec {
57 char *oprofile_cpu_type; 64 char *oprofile_cpu_type;
58 65
59 /* Processor specific oprofile operations */ 66 /* Processor specific oprofile operations */
60 struct op_powerpc_model *oprofile_model; 67 enum powerpc_oprofile_type oprofile_type;
68
69 /* Name of processor class, for the ELF AT_PLATFORM entry */
70 char *platform;
61}; 71};
62 72
63extern struct cpu_spec *cur_cpu_spec; 73extern struct cpu_spec *cur_cpu_spec;
@@ -106,6 +116,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
106#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) 116#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000)
107#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) 117#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000)
108#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000) 118#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000)
119#define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000)
109#else 120#else
110/* ensure on 32b processors the flags are available for compiling but 121/* ensure on 32b processors the flags are available for compiling but
111 * don't do anything */ 122 * don't do anything */
@@ -305,12 +316,18 @@ enum {
305 CPU_FTR_MMCRA_SIHV, 316 CPU_FTR_MMCRA_SIHV,
306 CPU_FTRS_CELL = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 317 CPU_FTRS_CELL = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
307 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | 318 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 |
308 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT, 319 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT |
320 CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO,
309 CPU_FTRS_COMPATIBLE = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 321 CPU_FTRS_COMPATIBLE = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
310 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2, 322 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2,
311#endif 323#endif
312 324
313 CPU_FTRS_POSSIBLE = 325 CPU_FTRS_POSSIBLE =
326#ifdef __powerpc64__
327 CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 |
328 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL |
329 CPU_FTR_CI_LARGE_PAGE |
330#else
314#if CLASSIC_PPC 331#if CLASSIC_PPC
315 CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | 332 CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU |
316 CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 | 333 CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 |
@@ -344,14 +361,14 @@ enum {
344#ifdef CONFIG_E500 361#ifdef CONFIG_E500
345 CPU_FTRS_E500 | CPU_FTRS_E500_2 | 362 CPU_FTRS_E500 | CPU_FTRS_E500_2 |
346#endif 363#endif
347#ifdef __powerpc64__ 364#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, 365 0,
353 366
354 CPU_FTRS_ALWAYS = 367 CPU_FTRS_ALWAYS =
368#ifdef __powerpc64__
369 CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 &
370 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_CELL &
371#else
355#if CLASSIC_PPC 372#if CLASSIC_PPC
356 CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU & 373 CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU &
357 CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 & 374 CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 &
@@ -385,10 +402,7 @@ enum {
385#ifdef CONFIG_E500 402#ifdef CONFIG_E500
386 CPU_FTRS_E500 & CPU_FTRS_E500_2 & 403 CPU_FTRS_E500 & CPU_FTRS_E500_2 &
387#endif 404#endif
388#ifdef __powerpc64__ 405#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, 406 CPU_FTRS_POSSIBLE,
393}; 407};
394 408
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..94d228f9c6ac 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 */
@@ -219,20 +221,18 @@ extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
219 instruction set this cpu supports. This could be done in userspace, 221 instruction set this cpu supports. This could be done in userspace,
220 but it's not easy, and we've already done it here. */ 222 but it's not easy, and we've already done it here. */
221# define ELF_HWCAP (cur_cpu_spec->cpu_user_features) 223# define ELF_HWCAP (cur_cpu_spec->cpu_user_features)
222#ifdef __powerpc64__
223# define ELF_PLAT_INIT(_r, load_addr) do { \
224 _r->gpr[2] = load_addr; \
225} while (0)
226#endif /* __powerpc64__ */
227 224
228/* This yields a string that ld.so will use to load implementation 225/* This yields a string that ld.so will use to load implementation
229 specific libraries for optimization. This is more specific in 226 specific libraries for optimization. This is more specific in
230 intent than poking at uname or /proc/cpuinfo. 227 intent than poking at uname or /proc/cpuinfo. */
231 228
232 For the moment, we have only optimizations for the Intel generations, 229#define ELF_PLATFORM (cur_cpu_spec->platform)
233 but that could change... */
234 230
235#define ELF_PLATFORM (NULL) 231#ifdef __powerpc64__
232# define ELF_PLAT_INIT(_r, load_addr) do { \
233 _r->gpr[2] = load_addr; \
234} while (0)
235#endif /* __powerpc64__ */
236 236
237#ifdef __KERNEL__ 237#ifdef __KERNEL__
238 238
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/futex.h b/include/asm-powerpc/futex.h
index f0319d50b129..39e85f320a76 100644
--- a/include/asm-powerpc/futex.h
+++ b/include/asm-powerpc/futex.h
@@ -11,7 +11,7 @@
11 11
12#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ 12#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
13 __asm__ __volatile ( \ 13 __asm__ __volatile ( \
14 SYNC_ON_SMP \ 14 LWSYNC_ON_SMP \
15"1: lwarx %0,0,%2\n" \ 15"1: lwarx %0,0,%2\n" \
16 insn \ 16 insn \
17 PPC405_ERR77(0, %2) \ 17 PPC405_ERR77(0, %2) \
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..38ca9ad6110d 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -1,11 +1,15 @@
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
6#define H_Success 0 7#define H_Success 0
7#define H_Busy 1 /* Hardware busy -- retry later */ 8#define H_Busy 1 /* Hardware busy -- retry later */
9#define H_Closed 2 /* Resource closed */
8#define H_Constrained 4 /* Resource request constrained to max allowed */ 10#define H_Constrained 4 /* Resource request constrained to max allowed */
11#define H_InProgress 14 /* Kind of like busy */
12#define H_Continue 18 /* Returned from H_Join on success */
9#define H_LongBusyStartRange 9900 /* Start of long busy range */ 13#define H_LongBusyStartRange 9900 /* Start of long busy range */
10#define H_LongBusyOrder1msec 9900 /* Long busy, hint that 1msec is a good time to retry */ 14#define H_LongBusyOrder1msec 9900 /* Long busy, hint that 1msec is a good time to retry */
11#define H_LongBusyOrder10msec 9901 /* Long busy, hint that 10msec is a good time to retry */ 15#define H_LongBusyOrder10msec 9901 /* Long busy, hint that 10msec is a good time to retry */
@@ -113,6 +117,8 @@
113#define H_REGISTER_VTERM 0x154 117#define H_REGISTER_VTERM 0x154
114#define H_FREE_VTERM 0x158 118#define H_FREE_VTERM 0x158
115#define H_POLL_PENDING 0x1D8 119#define H_POLL_PENDING 0x1D8
120#define H_JOIN 0x298
121#define H_ENABLE_CRQ 0x2B0
116 122
117#ifndef __ASSEMBLY__ 123#ifndef __ASSEMBLY__
118 124
@@ -170,4 +176,5 @@ long plpar_hcall_4out(unsigned long opcode,
170 unsigned long *out4); 176 unsigned long *out4);
171 177
172#endif /* __ASSEMBLY__ */ 178#endif /* __ASSEMBLY__ */
179#endif /* __KERNEL__ */
173#endif /* _ASM_POWERPC_HVCALL_H */ 180#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..640a6459f2f4 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,97 @@
30#define KEXEC_ARCH KEXEC_ARCH_PPC 31#define KEXEC_ARCH KEXEC_ARCH_PPC
31#endif 32#endif
32 33
33#ifndef __ASSEMBLY__ 34#ifdef CONFIG_KEXEC
34 35
35#define MAX_NOTE_BYTES 1024 36#ifdef __powerpc64__
36typedef u32 note_buf_t[MAX_NOTE_BYTES / sizeof(u32)]; 37/*
38 * This function is responsible for capturing register states if coming
39 * via panic or invoking dump using sysrq-trigger.
40 */
41static inline void crash_setup_regs(struct pt_regs *newregs,
42 struct pt_regs *oldregs)
43{
44 if (oldregs)
45 memcpy(newregs, oldregs, sizeof(*newregs));
46 else {
47 /* FIXME Merge this with xmon_save_regs ?? */
48 unsigned long tmp1, tmp2;
49 __asm__ __volatile__ (
50 "std 0,0(%2)\n"
51 "std 1,8(%2)\n"
52 "std 2,16(%2)\n"
53 "std 3,24(%2)\n"
54 "std 4,32(%2)\n"
55 "std 5,40(%2)\n"
56 "std 6,48(%2)\n"
57 "std 7,56(%2)\n"
58 "std 8,64(%2)\n"
59 "std 9,72(%2)\n"
60 "std 10,80(%2)\n"
61 "std 11,88(%2)\n"
62 "std 12,96(%2)\n"
63 "std 13,104(%2)\n"
64 "std 14,112(%2)\n"
65 "std 15,120(%2)\n"
66 "std 16,128(%2)\n"
67 "std 17,136(%2)\n"
68 "std 18,144(%2)\n"
69 "std 19,152(%2)\n"
70 "std 20,160(%2)\n"
71 "std 21,168(%2)\n"
72 "std 22,176(%2)\n"
73 "std 23,184(%2)\n"
74 "std 24,192(%2)\n"
75 "std 25,200(%2)\n"
76 "std 26,208(%2)\n"
77 "std 27,216(%2)\n"
78 "std 28,224(%2)\n"
79 "std 29,232(%2)\n"
80 "std 30,240(%2)\n"
81 "std 31,248(%2)\n"
82 "mfmsr %0\n"
83 "std %0, 264(%2)\n"
84 "mfctr %0\n"
85 "std %0, 280(%2)\n"
86 "mflr %0\n"
87 "std %0, 288(%2)\n"
88 "bl 1f\n"
89 "1: mflr %1\n"
90 "std %1, 256(%2)\n"
91 "mtlr %0\n"
92 "mfxer %0\n"
93 "std %0, 296(%2)\n"
94 : "=&r" (tmp1), "=&r" (tmp2)
95 : "b" (newregs));
96 }
97}
98#else
99/*
100 * Provide a dummy definition to avoid build failures. Will remain
101 * empty till crash dump support is enabled.
102 */
103static inline void crash_setup_regs(struct pt_regs *newregs,
104 struct pt_regs *oldregs) { }
105#endif /* !__powerpc64 __ */
37 106
38extern note_buf_t crash_notes[]; 107#ifndef __ASSEMBLY__
108#define MAX_NOTE_BYTES 1024
39 109
40#ifdef __powerpc64__ 110#ifdef __powerpc64__
41extern void kexec_smp_wait(void); /* get and clear naca physid, wait for 111extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
42 master to copy new code to 0 */ 112 master to copy new code to 0 */
43extern void __init kexec_setup(void); 113extern void __init kexec_setup(void);
44#else 114extern int crashing_cpu;
115extern void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *));
116#endif /* __powerpc64 __ */
117
45struct kimage; 118struct kimage;
46extern void machine_kexec_simple(struct kimage *image); 119struct pt_regs;
47#endif 120extern void default_machine_kexec(struct kimage *image);
121extern int default_machine_kexec_prepare(struct kimage *image);
122extern void default_machine_crash_shutdown(struct pt_regs *regs);
48 123
49#endif /* ! __ASSEMBLY__ */ 124#endif /* ! __ASSEMBLY__ */
125#endif /* CONFIG_KEXEC */
126#endif /* __KERNEL__ */
50#endif /* _ASM_POWERPC_KEXEC_H */ 127#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..4dc514aabfe7 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//
@@ -28,6 +29,8 @@
28//---------------------------------------------------------------------------- 29//----------------------------------------------------------------------------
29#include <asm/types.h> 30#include <asm/types.h>
30 31
32/* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k
33 * alignment is sufficient to prevent this */
31struct lppaca { 34struct lppaca {
32//============================================================================= 35//=============================================================================
33// CACHE_LINE_1 0x0000 - 0x007F Contains read-only data 36// CACHE_LINE_1 0x0000 - 0x007F Contains read-only data
@@ -126,6 +129,9 @@ struct lppaca {
126// CACHE_LINE_4-5 0x0100 - 0x01FF Contains PMC interrupt data 129// CACHE_LINE_4-5 0x0100 - 0x01FF Contains PMC interrupt data
127//============================================================================= 130//=============================================================================
128 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF 131 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF
129}; 132} __attribute__((__aligned__(0x400)));
130 133
134extern struct lppaca lppaca[];
135
136#endif /* __KERNEL__ */
131#endif /* _ASM_POWERPC_LPPACA_H */ 137#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/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..c9add8f1ad94 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -14,15 +14,16 @@
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");
25#define get_paca() local_paca 25#define get_paca() local_paca
26#define get_lppaca() (get_paca()->lppaca_ptr)
26 27
27struct task_struct; 28struct task_struct;
28 29
@@ -31,9 +32,9 @@ struct task_struct;
31 * 32 *
32 * This structure is not directly accessed by firmware or the service 33 * This structure is not directly accessed by firmware or the service
33 * processor except for the first two pointers that point to the 34 * processor except for the first two pointers that point to the
34 * lppaca area and the ItLpRegSave area for this CPU. Both the 35 * lppaca area and the ItLpRegSave area for this CPU. The lppaca
35 * lppaca and ItLpRegSave objects are currently contained within the 36 * object is currently contained within the PACA but it doesn't need
36 * PACA but they do not need to be. 37 * to be.
37 */ 38 */
38struct paca_struct { 39struct paca_struct {
39 /* 40 /*
@@ -48,7 +49,9 @@ struct paca_struct {
48 * accessed by the firmware 49 * accessed by the firmware
49 */ 50 */
50 struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */ 51 struct lppaca *lppaca_ptr; /* Pointer to LpPaca for PLIC */
51 struct ItLpRegSave *reg_save_ptr; /* Pointer to LpRegSave for PLIC */ 52#ifdef CONFIG_PPC_ISERIES
53 void *reg_save_ptr; /* Pointer to LpRegSave for PLIC */
54#endif /* CONFIG_PPC_ISERIES */
52 55
53 /* 56 /*
54 * MAGIC: the spinlock functions in arch/ppc64/lib/locks.c 57 * MAGIC: the spinlock functions in arch/ppc64/lib/locks.c
@@ -59,11 +62,11 @@ struct paca_struct {
59 u16 lock_token; /* Constant 0x8000, used in locks */ 62 u16 lock_token; /* Constant 0x8000, used in locks */
60 u16 paca_index; /* Logical processor number */ 63 u16 paca_index; /* Logical processor number */
61 64
62 u32 default_decr; /* Default decrementer value */
63 u64 kernel_toc; /* Kernel TOC address */ 65 u64 kernel_toc; /* Kernel TOC address */
64 u64 stab_real; /* Absolute address of segment table */ 66 u64 stab_real; /* Absolute address of segment table */
65 u64 stab_addr; /* Virtual address of segment table */ 67 u64 stab_addr; /* Virtual address of segment table */
66 void *emergency_sp; /* pointer to emergency stack */ 68 void *emergency_sp; /* pointer to emergency stack */
69 u64 data_offset; /* per cpu data offset */
67 s16 hw_cpu_id; /* Physical processor number */ 70 s16 hw_cpu_id; /* Physical processor number */
68 u8 cpu_start; /* At startup, processor spins until */ 71 u8 cpu_start; /* At startup, processor spins until */
69 /* this becomes non-zero. */ 72 /* this becomes non-zero. */
@@ -90,31 +93,12 @@ struct paca_struct {
90 struct task_struct *__current; /* Pointer to current */ 93 struct task_struct *__current; /* Pointer to current */
91 u64 kstack; /* Saved Kernel stack addr */ 94 u64 kstack; /* Saved Kernel stack addr */
92 u64 stab_rr; /* stab/slb round-robin counter */ 95 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 */ 96 u64 saved_r1; /* r1 save for RTAS calls */
95 u64 saved_msr; /* MSR saved here by enter_rtas */ 97 u64 saved_msr; /* MSR saved here by enter_rtas */
96 u8 proc_enabled; /* irq soft-enable flag */ 98 u8 proc_enabled; /* irq soft-enable flag */
97
98 /* not yet used */
99 u64 exdsi[8]; /* used for linear mapping hash table misses */
100
101 /*
102 * iSeries structure which the hypervisor knows about -
103 * this structure should not cross a page boundary.
104 * The vpa_init/register_vpa call is now known to fail if the
105 * lppaca structure crosses a page boundary.
106 * The lppaca is also used on POWER5 pSeries boxes.
107 * The lppaca is 640 bytes long, and cannot readily change
108 * since the hypervisor knows its layout, so a 1kB
109 * alignment will suffice to ensure that it doesn't
110 * cross a page boundary.
111 */
112 struct lppaca lppaca __attribute__((__aligned__(0x400)));
113#ifdef CONFIG_PPC_ISERIES
114 struct ItLpRegSave reg_save;
115#endif
116}; 99};
117 100
118extern struct paca_struct paca[]; 101extern struct paca_struct paca[];
119 102
103#endif /* __KERNEL__ */
120#endif /* _ASM_POWERPC_PACA_H */ 104#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..ab8688d39024 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
@@ -155,52 +156,56 @@ n:
155#endif 156#endif
156 157
157/* 158/*
158 * LOADADDR( rn, name ) 159 * LOAD_REG_IMMEDIATE(rn, expr)
159 * loads the address of 'name' into 'rn' 160 * Loads the value of the constant expression 'expr' into register 'rn'
161 * using immediate instructions only. Use this when it's important not
162 * to reference other data (i.e. on ppc64 when the TOC pointer is not
163 * valid).
160 * 164 *
161 * LOADBASE( rn, name ) 165 * LOAD_REG_ADDR(rn, name)
162 * loads the address (possibly without the low 16 bits) of 'name' into 'rn' 166 * Loads the address of label 'name' into register 'rn'. Use this when
163 * suitable for base+disp addressing 167 * you don't particularly need immediate instructions only, but you need
168 * the whole address in one register (e.g. it's a structure address and
169 * you want to access various offsets within it). On ppc32 this is
170 * identical to LOAD_REG_IMMEDIATE.
171 *
172 * LOAD_REG_ADDRBASE(rn, name)
173 * ADDROFF(name)
174 * LOAD_REG_ADDRBASE loads part of the address of label 'name' into
175 * register 'rn'. ADDROFF(name) returns the remainder of the address as
176 * a constant expression. ADDROFF(name) is a signed expression < 16 bits
177 * in size, so is suitable for use directly as an offset in load and store
178 * instructions. Use this when loading/storing a single word or less as:
179 * LOAD_REG_ADDRBASE(rX, name)
180 * ld rY,ADDROFF(name)(rX)
164 */ 181 */
165#ifdef __powerpc64__ 182#ifdef __powerpc64__
166#define LOADADDR(rn,name) \ 183#define LOAD_REG_IMMEDIATE(reg,expr) \
167 lis rn,name##@highest; \ 184 lis (reg),(expr)@highest; \
168 ori rn,rn,name##@higher; \ 185 ori (reg),(reg),(expr)@higher; \
169 rldicr rn,rn,32,31; \ 186 rldicr (reg),(reg),32,31; \
170 oris rn,rn,name##@h; \ 187 oris (reg),(reg),(expr)@h; \
171 ori rn,rn,name##@l 188 ori (reg),(reg),(expr)@l;
172 189
173#define LOADBASE(rn,name) \ 190#define LOAD_REG_ADDR(reg,name) \
174 ld rn,name@got(r2) 191 ld (reg),name@got(r2)
175 192
176#define OFF(name) 0 193#define LOAD_REG_ADDRBASE(reg,name) LOAD_REG_ADDR(reg,name)
177 194#define ADDROFF(name) 0
178#define SET_REG_TO_CONST(reg, value) \
179 lis reg,(((value)>>48)&0xFFFF); \
180 ori reg,reg,(((value)>>32)&0xFFFF); \
181 rldicr reg,reg,32,31; \
182 oris reg,reg,(((value)>>16)&0xFFFF); \
183 ori reg,reg,((value)&0xFFFF);
184
185#define SET_REG_TO_LABEL(reg, label) \
186 lis reg,(label)@highest; \
187 ori reg,reg,(label)@higher; \
188 rldicr reg,reg,32,31; \
189 oris reg,reg,(label)@h; \
190 ori reg,reg,(label)@l;
191 195
192/* offsets for stack frame layout */ 196/* offsets for stack frame layout */
193#define LRSAVE 16 197#define LRSAVE 16
194 198
195#else /* 32-bit */ 199#else /* 32-bit */
196#define LOADADDR(rn,name) \
197 lis rn,name@ha; \
198 addi rn,rn,name@l
199 200
200#define LOADBASE(rn,name) \ 201#define LOAD_REG_IMMEDIATE(reg,expr) \
201 lis rn,name@ha 202 lis (reg),(expr)@ha; \
203 addi (reg),(reg),(expr)@l;
202 204
203#define OFF(name) name@l 205#define LOAD_REG_ADDR(reg,name) LOAD_REG_IMMEDIATE(reg, name)
206
207#define LOAD_REG_ADDRBASE(reg, name) lis (reg),name@ha
208#define ADDROFF(name) name@l
204 209
205/* offsets for stack frame layout */ 210/* offsets for stack frame layout */
206#define LRSAVE 4 211#define LRSAVE 4
@@ -325,6 +330,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
325#define CLR_TOP32(r) 330#define CLR_TOP32(r)
326#endif 331#endif
327 332
333#endif /* __KERNEL__ */
334
328/* The boring bits... */ 335/* The boring bits... */
329 336
330/* Condition Register Bit Fields */ 337/* 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..5b2bd4eefb01 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,13 +82,12 @@ 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;
128 88
129 struct property *properties; 89 struct property *properties;
90 struct property *deadprops; /* removed properties */
130 struct device_node *parent; 91 struct device_node *parent;
131 struct device_node *child; 92 struct device_node *child;
132 struct device_node *sibling; 93 struct device_node *sibling;
@@ -175,6 +136,9 @@ extern struct device_node *of_find_all_nodes(struct device_node *prev);
175extern struct device_node *of_get_parent(const struct device_node *node); 136extern struct device_node *of_get_parent(const struct device_node *node);
176extern struct device_node *of_get_next_child(const struct device_node *node, 137extern struct device_node *of_get_next_child(const struct device_node *node,
177 struct device_node *prev); 138 struct device_node *prev);
139extern struct property *of_find_property(struct device_node *np,
140 const char *name,
141 int *lenp);
178extern struct device_node *of_node_get(struct device_node *node); 142extern struct device_node *of_node_get(struct device_node *node);
179extern void of_node_put(struct device_node *node); 143extern void of_node_put(struct device_node *node);
180 144
@@ -204,6 +168,10 @@ extern int prom_n_size_cells(struct device_node* np);
204extern int prom_n_intr_cells(struct device_node* np); 168extern int prom_n_intr_cells(struct device_node* np);
205extern void prom_get_irq_senses(unsigned char *senses, int off, int max); 169extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
206extern int prom_add_property(struct device_node* np, struct property* prop); 170extern int prom_add_property(struct device_node* np, struct property* prop);
171extern int prom_remove_property(struct device_node *np, struct property *prop);
172extern int prom_update_property(struct device_node *np,
173 struct property *newprop,
174 struct property *oldprop);
207 175
208#ifdef CONFIG_PPC32 176#ifdef CONFIG_PPC32
209/* 177/*
@@ -223,5 +191,36 @@ extern struct resource *request_OF_resource(struct device_node* node,
223 int index, const char* name_postfix); 191 int index, const char* name_postfix);
224extern int release_OF_resource(struct device_node* node, int index); 192extern int release_OF_resource(struct device_node* node, int index);
225 193
194
195/*
196 * OF address retreival & translation
197 */
198
199
200/* Translate an OF address block into a CPU physical address
201 */
202#define OF_BAD_ADDR ((u64)-1)
203extern u64 of_translate_address(struct device_node *np, u32 *addr);
204
205/* Extract an address from a device, returns the region size and
206 * the address space flags too. The PCI version uses a BAR number
207 * instead of an absolute index
208 */
209extern u32 *of_get_address(struct device_node *dev, int index,
210 u64 *size, unsigned int *flags);
211extern u32 *of_get_pci_address(struct device_node *dev, int bar_no,
212 u64 *size, unsigned int *flags);
213
214/* Get an address as a resource. Note that if your address is
215 * a PIO address, the conversion will fail if the physical address
216 * can't be internally converted to an IO token with
217 * pci_address_to_pio(), that is because it's either called to early
218 * or it can't be matched to any host bridge IO space
219 */
220extern int of_address_to_resource(struct device_node *dev, int index,
221 struct resource *r);
222extern int of_pci_address_to_resource(struct device_node *dev, int bar,
223 struct resource *r);
224
226#endif /* __KERNEL__ */ 225#endif /* __KERNEL__ */
227#endif /* _POWERPC_PROM_H */ 226#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..895cb6d3a42a 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.
@@ -45,7 +46,7 @@ static __inline__ unsigned long __spin_trylock(raw_spinlock_t *lock)
45 46
46 token = LOCK_TOKEN; 47 token = LOCK_TOKEN;
47 __asm__ __volatile__( 48 __asm__ __volatile__(
48"1: lwarx %0,0,%2 # __spin_trylock\n\ 49"1: lwarx %0,0,%2\n\
49 cmpwi 0,%0,0\n\ 50 cmpwi 0,%0,0\n\
50 bne- 2f\n\ 51 bne- 2f\n\
51 stwcx. %1,0,%2\n\ 52 stwcx. %1,0,%2\n\
@@ -79,7 +80,7 @@ static int __inline__ __raw_spin_trylock(raw_spinlock_t *lock)
79 80
80#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) 81#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES)
81/* We only yield to the hypervisor if we are in shared processor mode */ 82/* We only yield to the hypervisor if we are in shared processor mode */
82#define SHARED_PROCESSOR (get_paca()->lppaca.shared_proc) 83#define SHARED_PROCESSOR (get_lppaca()->shared_proc)
83extern void __spin_yield(raw_spinlock_t *lock); 84extern void __spin_yield(raw_spinlock_t *lock);
84extern void __rw_yield(raw_rwlock_t *lock); 85extern void __rw_yield(raw_rwlock_t *lock);
85#else /* SPLPAR || ISERIES */ 86#else /* SPLPAR || ISERIES */
@@ -123,8 +124,8 @@ static void __inline__ __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long
123 124
124static __inline__ void __raw_spin_unlock(raw_spinlock_t *lock) 125static __inline__ void __raw_spin_unlock(raw_spinlock_t *lock)
125{ 126{
126 __asm__ __volatile__(SYNC_ON_SMP" # __raw_spin_unlock" 127 __asm__ __volatile__("# __raw_spin_unlock\n\t"
127 : : :"memory"); 128 LWSYNC_ON_SMP: : :"memory");
128 lock->slock = 0; 129 lock->slock = 0;
129} 130}
130 131
@@ -166,7 +167,7 @@ static long __inline__ __read_trylock(raw_rwlock_t *rw)
166 long tmp; 167 long tmp;
167 168
168 __asm__ __volatile__( 169 __asm__ __volatile__(
169"1: lwarx %0,0,%1 # read_trylock\n" 170"1: lwarx %0,0,%1\n"
170 __DO_SIGN_EXTEND 171 __DO_SIGN_EXTEND
171" addic. %0,%0,1\n\ 172" addic. %0,%0,1\n\
172 ble- 2f\n" 173 ble- 2f\n"
@@ -191,7 +192,7 @@ static __inline__ long __write_trylock(raw_rwlock_t *rw)
191 192
192 token = WRLOCK_TOKEN; 193 token = WRLOCK_TOKEN;
193 __asm__ __volatile__( 194 __asm__ __volatile__(
194"1: lwarx %0,0,%2 # write_trylock\n\ 195"1: lwarx %0,0,%2\n\
195 cmpwi 0,%0,0\n\ 196 cmpwi 0,%0,0\n\
196 bne- 2f\n" 197 bne- 2f\n"
197 PPC405_ERR77(0,%1) 198 PPC405_ERR77(0,%1)
@@ -248,8 +249,9 @@ static void __inline__ __raw_read_unlock(raw_rwlock_t *rw)
248 long tmp; 249 long tmp;
249 250
250 __asm__ __volatile__( 251 __asm__ __volatile__(
251 "eieio # read_unlock\n\ 252 "# read_unlock\n\t"
2521: lwarx %0,0,%1\n\ 253 LWSYNC_ON_SMP
254"1: lwarx %0,0,%1\n\
253 addic %0,%0,-1\n" 255 addic %0,%0,-1\n"
254 PPC405_ERR77(0,%1) 256 PPC405_ERR77(0,%1)
255" stwcx. %0,0,%1\n\ 257" stwcx. %0,0,%1\n\
@@ -261,9 +263,10 @@ static void __inline__ __raw_read_unlock(raw_rwlock_t *rw)
261 263
262static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) 264static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
263{ 265{
264 __asm__ __volatile__(SYNC_ON_SMP" # write_unlock" 266 __asm__ __volatile__("# write_unlock\n\t"
265 : : :"memory"); 267 LWSYNC_ON_SMP: : :"memory");
266 rw->lock = 0; 268 rw->lock = 0;
267} 269}
268 270
271#endif /* __KERNEL__ */
269#endif /* __ASM_SPINLOCK_H */ 272#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..c90d9d9aae72 100644
--- a/include/asm-powerpc/synch.h
+++ b/include/asm-powerpc/synch.h
@@ -1,7 +1,8 @@
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#ifdef __KERNEL__
3 4
4#include <linux/config.h> 5#include <linux/stringify.h>
5 6
6#ifdef __powerpc64__ 7#ifdef __powerpc64__
7#define __SUBARCH_HAS_LWSYNC 8#define __SUBARCH_HAS_LWSYNC
@@ -13,20 +14,12 @@
13# define LWSYNC sync 14# define LWSYNC sync
14#endif 15#endif
15 16
16
17/*
18 * Arguably the bitops and *xchg operations don't imply any memory barrier
19 * or SMP ordering, but in fact a lot of drivers expect them to imply
20 * both, since they do on x86 cpus.
21 */
22#ifdef CONFIG_SMP 17#ifdef CONFIG_SMP
23#define EIEIO_ON_SMP "eieio\n"
24#define ISYNC_ON_SMP "\n\tisync" 18#define ISYNC_ON_SMP "\n\tisync"
25#define SYNC_ON_SMP __stringify(LWSYNC) "\n" 19#define LWSYNC_ON_SMP __stringify(LWSYNC) "\n"
26#else 20#else
27#define EIEIO_ON_SMP
28#define ISYNC_ON_SMP 21#define ISYNC_ON_SMP
29#define SYNC_ON_SMP 22#define LWSYNC_ON_SMP
30#endif 23#endif
31 24
32static inline void eieio(void) 25static inline void eieio(void)
@@ -39,13 +32,5 @@ static inline void isync(void)
39 __asm__ __volatile__ ("isync" : : : "memory"); 32 __asm__ __volatile__ ("isync" : : : "memory");
40} 33}
41 34
42#ifdef CONFIG_SMP 35#endif /* __KERNEL__ */
43#define eieio_on_smp() eieio()
44#define isync_on_smp() isync()
45#else
46#define eieio_on_smp() __asm__ __volatile__("": : :"memory")
47#define isync_on_smp() __asm__ __volatile__("": : :"memory")
48#endif
49
50#endif /* _ASM_POWERPC_SYNCH_H */ 36#endif /* _ASM_POWERPC_SYNCH_H */
51
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 5341b75c75cb..d9bf53653b10 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;
@@ -195,7 +212,7 @@ __xchg_u32(volatile void *p, unsigned long val)
195 unsigned long prev; 212 unsigned long prev;
196 213
197 __asm__ __volatile__( 214 __asm__ __volatile__(
198 EIEIO_ON_SMP 215 LWSYNC_ON_SMP
199"1: lwarx %0,0,%2 \n" 216"1: lwarx %0,0,%2 \n"
200 PPC405_ERR77(0,%2) 217 PPC405_ERR77(0,%2)
201" stwcx. %3,0,%2 \n\ 218" stwcx. %3,0,%2 \n\
@@ -215,7 +232,7 @@ __xchg_u64(volatile void *p, unsigned long val)
215 unsigned long prev; 232 unsigned long prev;
216 233
217 __asm__ __volatile__( 234 __asm__ __volatile__(
218 EIEIO_ON_SMP 235 LWSYNC_ON_SMP
219"1: ldarx %0,0,%2 \n" 236"1: ldarx %0,0,%2 \n"
220 PPC405_ERR77(0,%2) 237 PPC405_ERR77(0,%2)
221" stdcx. %3,0,%2 \n\ 238" stdcx. %3,0,%2 \n\
@@ -270,7 +287,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
270 unsigned int prev; 287 unsigned int prev;
271 288
272 __asm__ __volatile__ ( 289 __asm__ __volatile__ (
273 EIEIO_ON_SMP 290 LWSYNC_ON_SMP
274"1: lwarx %0,0,%2 # __cmpxchg_u32\n\ 291"1: lwarx %0,0,%2 # __cmpxchg_u32\n\
275 cmpw 0,%0,%3\n\ 292 cmpw 0,%0,%3\n\
276 bne- 2f\n" 293 bne- 2f\n"
@@ -294,7 +311,7 @@ __cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new)
294 unsigned long prev; 311 unsigned long prev;
295 312
296 __asm__ __volatile__ ( 313 __asm__ __volatile__ (
297 EIEIO_ON_SMP 314 LWSYNC_ON_SMP
298"1: ldarx %0,0,%2 # __cmpxchg_u64\n\ 315"1: ldarx %0,0,%2 # __cmpxchg_u64\n\
299 cmpd 0,%0,%3\n\ 316 cmpd 0,%0,%3\n\
300 bne- 2f\n\ 317 bne- 2f\n\
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..67cdaf3ae9fc 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,10 @@ 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 */
125#define TIF_RESTORE_SIGMASK 15 /* Restore signal mask in do_signal */
126 126
127/* as above, but as bit values */ 127/* as above, but as bit values */
128#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 128#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -136,10 +136,16 @@ static inline struct thread_info *current_thread_info(void)
136#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 136#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
137#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 137#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
138#define _TIF_SECCOMP (1<<TIF_SECCOMP) 138#define _TIF_SECCOMP (1<<TIF_SECCOMP)
139#define _TIF_RESTOREALL (1<<TIF_RESTOREALL)
140#define _TIF_SAVE_NVGPRS (1<<TIF_SAVE_NVGPRS)
141#define _TIF_NOERROR (1<<TIF_NOERROR)
142#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
139#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) 143#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
140 144
141#define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ 145#define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
142 _TIF_NEED_RESCHED) 146 _TIF_NEED_RESCHED | _TIF_RESTOREALL | \
147 _TIF_RESTORE_SIGMASK)
148#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR|_TIF_SAVE_NVGPRS)
143 149
144#endif /* __KERNEL__ */ 150#endif /* __KERNEL__ */
145 151
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index d9b86a17271b..baddc9ab57ad 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -175,11 +175,10 @@ static inline void set_dec(int val)
175 set_dec_cpu6(val); 175 set_dec_cpu6(val);
176#else 176#else
177#ifdef CONFIG_PPC_ISERIES 177#ifdef CONFIG_PPC_ISERIES
178 struct paca_struct *lpaca = get_paca();
179 int cur_dec; 178 int cur_dec;
180 179
181 if (lpaca->lppaca.shared_proc) { 180 if (get_lppaca()->shared_proc) {
182 lpaca->lppaca.virtual_decr = val; 181 get_lppaca()->virtual_decr = val;
183 cur_dec = get_dec(); 182 cur_dec = get_dec();
184 if (cur_dec > val) 183 if (cur_dec > val)
185 HvCall_setVirtualDecr(); 184 HvCall_setVirtualDecr();
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..a40cdff21a88 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -296,8 +296,12 @@
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
301#define __NR_pselect6 280
302#define __NR_ppoll 281
299 303
300#define __NR_syscalls 278 304#define __NR_syscalls 282
301 305
302#ifdef __KERNEL__ 306#ifdef __KERNEL__
303#define __NR__exit __NR_exit 307#define __NR__exit __NR_exit
@@ -442,11 +446,13 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
442#define __ARCH_WANT_SYS_SIGPENDING 446#define __ARCH_WANT_SYS_SIGPENDING
443#define __ARCH_WANT_SYS_SIGPROCMASK 447#define __ARCH_WANT_SYS_SIGPROCMASK
444#define __ARCH_WANT_SYS_RT_SIGACTION 448#define __ARCH_WANT_SYS_RT_SIGACTION
449#define __ARCH_WANT_SYS_RT_SIGSUSPEND
445#ifdef CONFIG_PPC32 450#ifdef CONFIG_PPC32
446#define __ARCH_WANT_OLD_STAT 451#define __ARCH_WANT_OLD_STAT
447#endif 452#endif
448#ifdef CONFIG_PPC64 453#ifdef CONFIG_PPC64
449#define __ARCH_WANT_COMPAT_SYS_TIME 454#define __ARCH_WANT_COMPAT_SYS_TIME
455#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
450#endif 456#endif
451 457
452/* 458/*
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/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/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..6d431d6fb022 100644
--- a/include/asm-ppc/prom.h
+++ b/include/asm-ppc/prom.h
@@ -136,5 +136,45 @@ 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#ifndef CONFIG_PPC_OF
171/*
172 * Fallback definitions for builds where we don't have prom.c included.
173 */
174#define machine_is_compatible(x) 0
175#define of_find_compatible_node(f, t, c) NULL
176#define get_property(p, n, l) NULL
177#endif
178
139#endif /* _PPC_PROM_H */ 179#endif /* _PPC_PROM_H */
140#endif /* __KERNEL__ */ 180#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 d82aedf616fe..be6fefe223d6 100644
--- a/include/asm-s390/atomic.h
+++ b/include/asm-s390/atomic.h
@@ -75,6 +75,8 @@ static __inline__ void atomic_set_mask(unsigned long mask, atomic_t * v)
75 __CS_LOOP(v, mask, "or"); 75 __CS_LOOP(v, mask, "or");
76} 76}
77 77
78#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
79
78static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new) 80static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new)
79{ 81{
80 __asm__ __volatile__(" cs %0,%3,0(%2)\n" 82 __asm__ __volatile__(" cs %0,%3,0(%2)\n"
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/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/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/s390_rdev.h b/include/asm-s390/s390_rdev.h
index 3ad78f2b9c48..6fa20442a48c 100644
--- a/include/asm-s390/s390_rdev.h
+++ b/include/asm-s390/s390_rdev.h
@@ -2,7 +2,7 @@
2 * include/asm-s390/ccwdev.h 2 * include/asm-s390/ccwdev.h
3 * 3 *
4 * Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation 4 * Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
5 * Author(s): Cornelia Huck <cohuck@de.ibm.com> 5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6 * Carsten Otte <cotte@de.ibm.com> 6 * Carsten Otte <cotte@de.ibm.com>
7 * 7 *
8 * Interface for s390 root device 8 * Interface for s390 root device
diff --git a/include/asm-s390/sigcontext.h b/include/asm-s390/sigcontext.h
index 803545351dd8..aeb6e0b13329 100644
--- a/include/asm-s390/sigcontext.h
+++ b/include/asm-s390/sigcontext.h
@@ -8,6 +8,8 @@
8#ifndef _ASM_S390_SIGCONTEXT_H 8#ifndef _ASM_S390_SIGCONTEXT_H
9#define _ASM_S390_SIGCONTEXT_H 9#define _ASM_S390_SIGCONTEXT_H
10 10
11#include <linux/compiler.h>
12
11#define __NUM_GPRS 16 13#define __NUM_GPRS 16
12#define __NUM_FPRS 16 14#define __NUM_FPRS 16
13#define __NUM_ACRS 16 15#define __NUM_ACRS 16
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index 864cae7e1fd6..b2e65e8bf812 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -104,14 +104,25 @@ 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_vtime(struct task_struct *);
119extern void account_tick_vtime(struct task_struct *);
109extern void account_system_vtime(struct task_struct *); 120extern void account_system_vtime(struct task_struct *);
110#endif 121#endif
111 122
112#define finish_arch_switch(prev) do { \ 123#define finish_arch_switch(prev) do { \
113 set_fs(current->thread.mm_segment); \ 124 set_fs(current->thread.mm_segment); \
114 account_system_vtime(prev); \ 125 account_vtime(prev); \
115} while (0) 126} while (0)
116 127
117#define nop() __asm__ __volatile__ ("nop") 128#define nop() __asm__ __volatile__ ("nop")
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-sh/atomic.h b/include/asm-sh/atomic.h
index 618d8e0de348..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;
diff --git a/include/asm-sh/bus-sh.h b/include/asm-sh/bus-sh.h
index 83c5d2fd057f..e42d63b65cb5 100644
--- a/include/asm-sh/bus-sh.h
+++ b/include/asm-sh/bus-sh.h
@@ -21,6 +21,7 @@ struct sh_dev {
21 void *mapbase; 21 void *mapbase;
22 unsigned int irq[6]; 22 unsigned int irq[6];
23 u64 *dma_mask; 23 u64 *dma_mask;
24 u64 coherent_dma_mask;
24}; 25};
25 26
26#define to_sh_dev(d) container_of((d), struct sh_dev, dev) 27#define to_sh_dev(d) container_of((d), struct sh_dev, dev)
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/clock.h b/include/asm-sh/clock.h
new file mode 100644
index 000000000000..fdfb75b30f0d
--- /dev/null
+++ b/include/asm-sh/clock.h
@@ -0,0 +1,61 @@
1#ifndef __ASM_SH_CLOCK_H
2#define __ASM_SH_CLOCK_H
3
4#include <linux/kref.h>
5#include <linux/list.h>
6#include <linux/seq_file.h>
7
8struct clk;
9
10struct clk_ops {
11 void (*init)(struct clk *clk);
12 void (*enable)(struct clk *clk);
13 void (*disable)(struct clk *clk);
14 void (*recalc)(struct clk *clk);
15 int (*set_rate)(struct clk *clk, unsigned long rate);
16};
17
18struct clk {
19 struct list_head node;
20 const char *name;
21
22 struct module *owner;
23
24 struct clk *parent;
25 struct clk_ops *ops;
26
27 struct kref kref;
28
29 unsigned long rate;
30 unsigned long flags;
31};
32
33#define CLK_ALWAYS_ENABLED (1 << 0)
34#define CLK_RATE_PROPAGATES (1 << 1)
35
36/* Should be defined by processor-specific code */
37void arch_init_clk_ops(struct clk_ops **, int type);
38
39/* arch/sh/kernel/cpu/clock.c */
40int clk_init(void);
41
42int __clk_enable(struct clk *);
43int clk_enable(struct clk *);
44
45void __clk_disable(struct clk *);
46void clk_disable(struct clk *);
47
48int clk_set_rate(struct clk *, unsigned long rate);
49unsigned long clk_get_rate(struct clk *);
50void clk_recalc_rate(struct clk *);
51
52struct clk *clk_get(const char *id);
53void clk_put(struct clk *);
54
55int clk_register(struct clk *);
56void clk_unregister(struct clk *);
57
58int show_clocks(struct seq_file *m);
59
60#endif /* __ASM_SH_CLOCK_H */
61
diff --git a/include/asm-sh/cpu-sh3/dma.h b/include/asm-sh/cpu-sh3/dma.h
index b972e715f9ee..954801b46022 100644
--- a/include/asm-sh/cpu-sh3/dma.h
+++ b/include/asm-sh/cpu-sh3/dma.h
@@ -3,5 +3,34 @@
3 3
4#define SH_DMAC_BASE 0xa4000020 4#define SH_DMAC_BASE 0xa4000020
5 5
6#endif /* __ASM_CPU_SH3_DMA_H */ 6/* Definitions for the SuperH DMAC */
7#define TM_BURST 0x00000020
8#define TS_8 0x00000000
9#define TS_16 0x00000008
10#define TS_32 0x00000010
11#define TS_128 0x00000018
12
13#define CHCR_TS_MASK 0x18
14#define CHCR_TS_SHIFT 3
15
16#define DMAOR_INIT DMAOR_DME
7 17
18/*
19 * The SuperH DMAC supports a number of transmit sizes, we list them here,
20 * with their respective values as they appear in the CHCR registers.
21 */
22enum {
23 XMIT_SZ_8BIT,
24 XMIT_SZ_16BIT,
25 XMIT_SZ_32BIT,
26 XMIT_SZ_128BIT,
27};
28
29static unsigned int ts_shift[] __attribute__ ((used)) = {
30 [XMIT_SZ_8BIT] = 0,
31 [XMIT_SZ_16BIT] = 1,
32 [XMIT_SZ_32BIT] = 2,
33 [XMIT_SZ_128BIT] = 4,
34};
35
36#endif /* __ASM_CPU_SH3_DMA_H */
diff --git a/include/asm-sh/cpu-sh4/dma.h b/include/asm-sh/cpu-sh4/dma.h
index e2b91adf821a..0dfe61f14802 100644
--- a/include/asm-sh/cpu-sh4/dma.h
+++ b/include/asm-sh/cpu-sh4/dma.h
@@ -1,17 +1,49 @@
1#ifndef __ASM_CPU_SH4_DMA_H 1#ifndef __ASM_CPU_SH4_DMA_H
2#define __ASM_CPU_SH4_DMA_H 2#define __ASM_CPU_SH4_DMA_H
3 3
4#ifdef CONFIG_CPU_SH4A
5#define SH_DMAC_BASE 0xfc808020
6#else
4#define SH_DMAC_BASE 0xffa00000 7#define SH_DMAC_BASE 0xffa00000
8#endif
5 9
6#define SAR ((unsigned long[]){SH_DMAC_BASE + 0x00, SH_DMAC_BASE + 0x10, \ 10/* Definitions for the SuperH DMAC */
7 SH_DMAC_BASE + 0x20, SH_DMAC_BASE + 0x30}) 11#define TM_BURST 0x0000080
8#define DAR ((unsigned long[]){SH_DMAC_BASE + 0x04, SH_DMAC_BASE + 0x14, \ 12#define TS_8 0x00000010
9 SH_DMAC_BASE + 0x24, SH_DMAC_BASE + 0x34}) 13#define TS_16 0x00000020
10#define DMATCR ((unsigned long[]){SH_DMAC_BASE + 0x08, SH_DMAC_BASE + 0x18, \ 14#define TS_32 0x00000030
11 SH_DMAC_BASE + 0x28, SH_DMAC_BASE + 0x38}) 15#define TS_64 0x00000000
12#define CHCR ((unsigned long[]){SH_DMAC_BASE + 0x0c, SH_DMAC_BASE + 0x1c, \
13 SH_DMAC_BASE + 0x2c, SH_DMAC_BASE + 0x3c})
14#define DMAOR (SH_DMAC_BASE + 0x40)
15 16
16#endif /* __ASM_CPU_SH4_DMA_H */ 17#define CHCR_TS_MASK 0x30
18#define CHCR_TS_SHIFT 4
19
20#define DMAOR_COD 0x00000008
21
22#define DMAOR_INIT ( 0x8000 | DMAOR_DME )
17 23
24/*
25 * The SuperH DMAC supports a number of transmit sizes, we list them here,
26 * with their respective values as they appear in the CHCR registers.
27 *
28 * Defaults to a 64-bit transfer size.
29 */
30enum {
31 XMIT_SZ_64BIT,
32 XMIT_SZ_8BIT,
33 XMIT_SZ_16BIT,
34 XMIT_SZ_32BIT,
35 XMIT_SZ_256BIT,
36};
37
38/*
39 * The DMA count is defined as the number of bytes to transfer.
40 */
41static unsigned int ts_shift[] __attribute__ ((used)) = {
42 [XMIT_SZ_64BIT] = 3,
43 [XMIT_SZ_8BIT] = 0,
44 [XMIT_SZ_16BIT] = 1,
45 [XMIT_SZ_32BIT] = 2,
46 [XMIT_SZ_256BIT] = 5,
47};
48
49#endif /* __ASM_CPU_SH4_DMA_H */
diff --git a/include/asm-sh/cpu-sh4/freq.h b/include/asm-sh/cpu-sh4/freq.h
index 201d94fd214f..ef2b9b1ae41f 100644
--- a/include/asm-sh/cpu-sh4/freq.h
+++ b/include/asm-sh/cpu-sh4/freq.h
@@ -12,6 +12,8 @@
12 12
13#if defined(CONFIG_CPU_SUBTYPE_SH73180) 13#if defined(CONFIG_CPU_SUBTYPE_SH73180)
14#define FRQCR 0xa4150000 14#define FRQCR 0xa4150000
15#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
16#define FRQCR 0xffc80000
15#else 17#else
16#define FRQCR 0xffc00000 18#define FRQCR 0xffc00000
17#endif 19#endif
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h
index d3fa5c2b889d..48f1f42c5d14 100644
--- a/include/asm-sh/dma-mapping.h
+++ b/include/asm-sh/dma-mapping.h
@@ -4,6 +4,7 @@
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <asm/scatterlist.h> 6#include <asm/scatterlist.h>
7#include <asm/cacheflush.h>
7#include <asm/io.h> 8#include <asm/io.h>
8 9
9extern struct bus_type pci_bus_type; 10extern struct bus_type pci_bus_type;
@@ -141,24 +142,24 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
141 } 142 }
142} 143}
143 144
144static inline void dma_sync_single_for_cpu(struct device *dev, 145static void dma_sync_single_for_cpu(struct device *dev,
145 dma_addr_t dma_handle, size_t size, 146 dma_addr_t dma_handle, size_t size,
146 enum dma_data_direction dir) 147 enum dma_data_direction dir)
147 __attribute__ ((alias("dma_sync_single"))); 148 __attribute__ ((alias("dma_sync_single")));
148 149
149static inline void dma_sync_single_for_device(struct device *dev, 150static void dma_sync_single_for_device(struct device *dev,
150 dma_addr_t dma_handle, size_t size, 151 dma_addr_t dma_handle, size_t size,
151 enum dma_data_direction dir) 152 enum dma_data_direction dir)
152 __attribute__ ((alias("dma_sync_single"))); 153 __attribute__ ((alias("dma_sync_single")));
153 154
154static inline void dma_sync_sg_for_cpu(struct device *dev, 155static void dma_sync_sg_for_cpu(struct device *dev,
155 struct scatterlist *sg, int nelems, 156 struct scatterlist *sg, int nelems,
156 enum dma_data_direction dir) 157 enum dma_data_direction dir)
157 __attribute__ ((alias("dma_sync_sg"))); 158 __attribute__ ((alias("dma_sync_sg")));
158 159
159static inline void dma_sync_sg_for_device(struct device *dev, 160static void dma_sync_sg_for_device(struct device *dev,
160 struct scatterlist *sg, int nelems, 161 struct scatterlist *sg, int nelems,
161 enum dma_data_direction dir) 162 enum dma_data_direction dir)
162 __attribute__ ((alias("dma_sync_sg"))); 163 __attribute__ ((alias("dma_sync_sg")));
163 164
164static inline int dma_get_cache_alignment(void) 165static inline int dma_get_cache_alignment(void)
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h
index 8e9436093ca8..a118a0d43053 100644
--- a/include/asm-sh/dma.h
+++ b/include/asm-sh/dma.h
@@ -15,6 +15,7 @@
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/wait.h> 16#include <linux/wait.h>
17#include <linux/sysdev.h> 17#include <linux/sysdev.h>
18#include <linux/device.h>
18#include <asm/cpu/dma.h> 19#include <asm/cpu/dma.h>
19#include <asm/semaphore.h> 20#include <asm/semaphore.h>
20 21
@@ -54,8 +55,8 @@ enum {
54 * DMA channel capabilities / flags 55 * DMA channel capabilities / flags
55 */ 56 */
56enum { 57enum {
57 DMA_CONFIGURED = 0x00,
58 DMA_TEI_CAPABLE = 0x01, 58 DMA_TEI_CAPABLE = 0x01,
59 DMA_CONFIGURED = 0x02,
59}; 60};
60 61
61extern spinlock_t dma_spin_lock; 62extern spinlock_t dma_spin_lock;
@@ -74,7 +75,8 @@ struct dma_ops {
74struct dma_channel { 75struct dma_channel {
75 char dev_id[16]; 76 char dev_id[16];
76 77
77 unsigned int chan; 78 unsigned int chan; /* Physical channel number */
79 unsigned int vchan; /* Virtual channel number */
78 unsigned int mode; 80 unsigned int mode;
79 unsigned int count; 81 unsigned int count;
80 82
@@ -91,6 +93,8 @@ struct dma_channel {
91}; 93};
92 94
93struct dma_info { 95struct dma_info {
96 struct platform_device *pdev;
97
94 const char *name; 98 const char *name;
95 unsigned int nr_channels; 99 unsigned int nr_channels;
96 unsigned long flags; 100 unsigned long flags;
@@ -130,7 +134,11 @@ extern void unregister_dmac(struct dma_info *info);
130 134
131#ifdef CONFIG_SYSFS 135#ifdef CONFIG_SYSFS
132/* arch/sh/drivers/dma/dma-sysfs.c */ 136/* arch/sh/drivers/dma/dma-sysfs.c */
133extern int dma_create_sysfs_files(struct dma_channel *); 137extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *);
138extern void dma_remove_sysfs_files(struct dma_channel *, struct dma_info *);
139#else
140#define dma_create_sysfs_file(channel, info) do { } while (0)
141#define dma_remove_sysfs_file(channel, info) do { } while (0)
134#endif 142#endif
135 143
136#ifdef CONFIG_PCI 144#ifdef CONFIG_PCI
diff --git a/include/asm-sh/freq.h b/include/asm-sh/freq.h
index 2c0fde46a0ed..39c0e091cf58 100644
--- a/include/asm-sh/freq.h
+++ b/include/asm-sh/freq.h
@@ -14,16 +14,5 @@
14 14
15#include <asm/cpu/freq.h> 15#include <asm/cpu/freq.h>
16 16
17/* arch/sh/kernel/time.c */
18extern void get_current_frequency_divisors(unsigned int *ifc, unsigned int *pfc, unsigned int *bfc);
19
20extern unsigned int get_ifc_divisor(unsigned int value);
21extern unsigned int get_ifc_divisor(unsigned int value);
22extern unsigned int get_ifc_divisor(unsigned int value);
23
24extern unsigned int get_ifc_value(unsigned int divisor);
25extern unsigned int get_pfc_value(unsigned int divisor);
26extern unsigned int get_bfc_value(unsigned int divisor);
27
28#endif /* __KERNEL__ */ 17#endif /* __KERNEL__ */
29#endif /* __ASM_SH_FREQ_H */ 18#endif /* __ASM_SH_FREQ_H */
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/io.h b/include/asm-sh/io.h
index 6bc343fee7a0..b0b2937b6f83 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -11,7 +11,7 @@
11 * For read{b,w,l} and write{b,w,l} there are also __raw versions, which 11 * For read{b,w,l} and write{b,w,l} there are also __raw versions, which
12 * do not have a memory barrier after them. 12 * do not have a memory barrier after them.
13 * 13 *
14 * In addition, we have 14 * In addition, we have
15 * ctrl_in{b,w,l}/ctrl_out{b,w,l} for SuperH specific I/O. 15 * ctrl_in{b,w,l}/ctrl_out{b,w,l} for SuperH specific I/O.
16 * which are processor specific. 16 * which are processor specific.
17 */ 17 */
@@ -23,19 +23,27 @@
23 * inb by default expands to _inb, but the machine specific code may 23 * inb by default expands to _inb, but the machine specific code may
24 * define it to __inb if it chooses. 24 * define it to __inb if it chooses.
25 */ 25 */
26 26#include <linux/config.h>
27#include <asm/cache.h> 27#include <asm/cache.h>
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/addrspace.h> 29#include <asm/addrspace.h>
30#include <asm/machvec.h> 30#include <asm/machvec.h>
31#include <linux/config.h> 31#include <asm/pgtable.h>
32#include <asm-generic/iomap.h>
33
34#ifdef __KERNEL__
32 35
33/* 36/*
34 * Depending on which platform we are running on, we need different 37 * Depending on which platform we are running on, we need different
35 * I/O functions. 38 * I/O functions.
36 */ 39 */
40#define __IO_PREFIX generic
41#include <asm/io_generic.h>
42
43#define maybebadio(port) \
44 printk(KERN_ERR "bad PC-like io %s:%u for port 0x%lx at 0x%08x\n", \
45 __FUNCTION__, __LINE__, (port), (u32)__builtin_return_address(0))
37 46
38#ifdef __KERNEL__
39/* 47/*
40 * Since boards are able to define their own set of I/O routines through 48 * Since boards are able to define their own set of I/O routines through
41 * their respective machine vector, we always wrap through the mv. 49 * their respective machine vector, we always wrap through the mv.
@@ -44,113 +52,120 @@
44 * a given routine, it will be wrapped to generic code at run-time. 52 * a given routine, it will be wrapped to generic code at run-time.
45 */ 53 */
46 54
47# define __inb(p) sh_mv.mv_inb((p)) 55#define __inb(p) sh_mv.mv_inb((p))
48# define __inw(p) sh_mv.mv_inw((p)) 56#define __inw(p) sh_mv.mv_inw((p))
49# define __inl(p) sh_mv.mv_inl((p)) 57#define __inl(p) sh_mv.mv_inl((p))
50# define __outb(x,p) sh_mv.mv_outb((x),(p)) 58#define __outb(x,p) sh_mv.mv_outb((x),(p))
51# define __outw(x,p) sh_mv.mv_outw((x),(p)) 59#define __outw(x,p) sh_mv.mv_outw((x),(p))
52# define __outl(x,p) sh_mv.mv_outl((x),(p)) 60#define __outl(x,p) sh_mv.mv_outl((x),(p))
53 61
54# define __inb_p(p) sh_mv.mv_inb_p((p)) 62#define __inb_p(p) sh_mv.mv_inb_p((p))
55# define __inw_p(p) sh_mv.mv_inw_p((p)) 63#define __inw_p(p) sh_mv.mv_inw_p((p))
56# define __inl_p(p) sh_mv.mv_inl_p((p)) 64#define __inl_p(p) sh_mv.mv_inl_p((p))
57# define __outb_p(x,p) sh_mv.mv_outb_p((x),(p)) 65#define __outb_p(x,p) sh_mv.mv_outb_p((x),(p))
58# define __outw_p(x,p) sh_mv.mv_outw_p((x),(p)) 66#define __outw_p(x,p) sh_mv.mv_outw_p((x),(p))
59# define __outl_p(x,p) sh_mv.mv_outl_p((x),(p)) 67#define __outl_p(x,p) sh_mv.mv_outl_p((x),(p))
60 68
61# define __insb(p,b,c) sh_mv.mv_insb((p), (b), (c)) 69#define __insb(p,b,c) sh_mv.mv_insb((p), (b), (c))
62# define __insw(p,b,c) sh_mv.mv_insw((p), (b), (c)) 70#define __insw(p,b,c) sh_mv.mv_insw((p), (b), (c))
63# define __insl(p,b,c) sh_mv.mv_insl((p), (b), (c)) 71#define __insl(p,b,c) sh_mv.mv_insl((p), (b), (c))
64# define __outsb(p,b,c) sh_mv.mv_outsb((p), (b), (c)) 72#define __outsb(p,b,c) sh_mv.mv_outsb((p), (b), (c))
65# define __outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c)) 73#define __outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c))
66# define __outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c)) 74#define __outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c))
67 75
68# define __readb(a) sh_mv.mv_readb((a)) 76#define __readb(a) sh_mv.mv_readb((a))
69# define __readw(a) sh_mv.mv_readw((a)) 77#define __readw(a) sh_mv.mv_readw((a))
70# define __readl(a) sh_mv.mv_readl((a)) 78#define __readl(a) sh_mv.mv_readl((a))
71# define __writeb(v,a) sh_mv.mv_writeb((v),(a)) 79#define __writeb(v,a) sh_mv.mv_writeb((v),(a))
72# define __writew(v,a) sh_mv.mv_writew((v),(a)) 80#define __writew(v,a) sh_mv.mv_writew((v),(a))
73# define __writel(v,a) sh_mv.mv_writel((v),(a)) 81#define __writel(v,a) sh_mv.mv_writel((v),(a))
74 82
75# define __ioremap(a,s) sh_mv.mv_ioremap((a), (s)) 83#define inb __inb
76# define __iounmap(a) sh_mv.mv_iounmap((a)) 84#define inw __inw
77 85#define inl __inl
78# define __isa_port2addr(a) sh_mv.mv_isa_port2addr(a) 86#define outb __outb
79 87#define outw __outw
80# define inb __inb 88#define outl __outl
81# define inw __inw 89
82# define inl __inl 90#define inb_p __inb_p
83# define outb __outb 91#define inw_p __inw_p
84# define outw __outw 92#define inl_p __inl_p
85# define outl __outl 93#define outb_p __outb_p
86 94#define outw_p __outw_p
87# define inb_p __inb_p 95#define outl_p __outl_p
88# define inw_p __inw_p 96
89# define inl_p __inl_p 97#define insb __insb
90# define outb_p __outb_p 98#define insw __insw
91# define outw_p __outw_p 99#define insl __insl
92# define outl_p __outl_p 100#define outsb __outsb
93 101#define outsw __outsw
94# define insb __insb 102#define outsl __outsl
95# define insw __insw 103
96# define insl __insl 104#define __raw_readb(a) __readb((void __iomem *)(a))
97# define outsb __outsb 105#define __raw_readw(a) __readw((void __iomem *)(a))
98# define outsw __outsw 106#define __raw_readl(a) __readl((void __iomem *)(a))
99# define outsl __outsl 107#define __raw_writeb(v, a) __writeb(v, (void __iomem *)(a))
100 108#define __raw_writew(v, a) __writew(v, (void __iomem *)(a))
101# define __raw_readb __readb 109#define __raw_writel(v, a) __writel(v, (void __iomem *)(a))
102# define __raw_readw __readw
103# define __raw_readl __readl
104# define __raw_writeb __writeb
105# define __raw_writew __writew
106# define __raw_writel __writel
107 110
108/* 111/*
109 * The platform header files may define some of these macros to use 112 * The platform header files may define some of these macros to use
110 * the inlined versions where appropriate. These macros may also be 113 * the inlined versions where appropriate. These macros may also be
111 * redefined by userlevel programs. 114 * redefined by userlevel programs.
112 */ 115 */
113#ifdef __raw_readb 116#ifdef __readb
114# define readb(a) ({ unsigned long r_ = __raw_readb((unsigned long)a); mb(); r_; }) 117# define readb(a) ({ unsigned long r_ = __raw_readb(a); mb(); r_; })
115#endif 118#endif
116#ifdef __raw_readw 119#ifdef __raw_readw
117# define readw(a) ({ unsigned long r_ = __raw_readw((unsigned long)a); mb(); r_; }) 120# define readw(a) ({ unsigned long r_ = __raw_readw(a); mb(); r_; })
118#endif 121#endif
119#ifdef __raw_readl 122#ifdef __raw_readl
120# define readl(a) ({ unsigned long r_ = __raw_readl((unsigned long)a); mb(); r_; }) 123# define readl(a) ({ unsigned long r_ = __raw_readl(a); mb(); r_; })
121#endif 124#endif
122 125
123#ifdef __raw_writeb 126#ifdef __raw_writeb
124# define writeb(v,a) ({ __raw_writeb((v),(unsigned long)(a)); mb(); }) 127# define writeb(v,a) ({ __raw_writeb((v),(a)); mb(); })
125#endif 128#endif
126#ifdef __raw_writew 129#ifdef __raw_writew
127# define writew(v,a) ({ __raw_writew((v),(unsigned long)(a)); mb(); }) 130# define writew(v,a) ({ __raw_writew((v),(a)); mb(); })
128#endif 131#endif
129#ifdef __raw_writel 132#ifdef __raw_writel
130# define writel(v,a) ({ __raw_writel((v),(unsigned long)(a)); mb(); }) 133# define writel(v,a) ({ __raw_writel((v),(a)); mb(); })
131#endif 134#endif
132 135
133#define readb_relaxed(a) readb(a) 136#define readb_relaxed(a) readb(a)
134#define readw_relaxed(a) readw(a) 137#define readw_relaxed(a) readw(a)
135#define readl_relaxed(a) readl(a) 138#define readl_relaxed(a) readl(a)
136 139
137#define mmiowb() 140/* Simple MMIO */
141#define ioread8(a) readb(a)
142#define ioread16(a) readw(a)
143#define ioread16be(a) be16_to_cpu(__raw_readw((a)))
144#define ioread32(a) readl(a)
145#define ioread32be(a) be32_to_cpu(__raw_readl((a)))
138 146
139/* 147#define iowrite8(v,a) writeb((v),(a))
140 * If the platform has PC-like I/O, this function converts the offset into 148#define iowrite16(v,a) writew((v),(a))
141 * an address. 149#define iowrite16be(v,a) __raw_writew(cpu_to_be16((v)),(a))
142 */ 150#define iowrite32(v,a) writel((v),(a))
143static __inline__ unsigned long isa_port2addr(unsigned long offset) 151#define iowrite32be(v,a) __raw_writel(cpu_to_be32((v)),(a))
144{ 152
145 return __isa_port2addr(offset); 153#define ioread8_rep(a,d,c) insb((a),(d),(c))
146} 154#define ioread16_rep(a,d,c) insw((a),(d),(c))
155#define ioread32_rep(a,d,c) insl((a),(d),(c))
156
157#define iowrite8_rep(a,s,c) outsb((a),(s),(c))
158#define iowrite16_rep(a,s,c) outsw((a),(s),(c))
159#define iowrite32_rep(a,s,c) outsl((a),(s),(c))
160
161#define mmiowb() wmb() /* synco on SH-4A, otherwise a nop */
147 162
148/* 163/*
149 * This function provides a method for the generic case where a board-specific 164 * This function provides a method for the generic case where a board-specific
150 * isa_port2addr simply needs to return the port + some arbitrary port base. 165 * ioport_map simply needs to return the port + some arbitrary port base.
151 * 166 *
152 * We use this at board setup time to implicitly set the port base, and 167 * We use this at board setup time to implicitly set the port base, and
153 * as a result, we can use the generic isa_port2addr. 168 * as a result, we can use the generic ioport_map.
154 */ 169 */
155static inline void __set_io_port_base(unsigned long pbase) 170static inline void __set_io_port_base(unsigned long pbase)
156{ 171{
@@ -159,51 +174,52 @@ static inline void __set_io_port_base(unsigned long pbase)
159 generic_io_base = pbase; 174 generic_io_base = pbase;
160} 175}
161 176
162#define isa_readb(a) readb(isa_port2addr(a)) 177#define isa_readb(a) readb(ioport_map(a, 1))
163#define isa_readw(a) readw(isa_port2addr(a)) 178#define isa_readw(a) readw(ioport_map(a, 2))
164#define isa_readl(a) readl(isa_port2addr(a)) 179#define isa_readl(a) readl(ioport_map(a, 4))
165#define isa_writeb(b,a) writeb(b,isa_port2addr(a)) 180#define isa_writeb(b,a) writeb(b,ioport_map(a, 1))
166#define isa_writew(w,a) writew(w,isa_port2addr(a)) 181#define isa_writew(w,a) writew(w,ioport_map(a, 2))
167#define isa_writel(l,a) writel(l,isa_port2addr(a)) 182#define isa_writel(l,a) writel(l,ioport_map(a, 4))
183
168#define isa_memset_io(a,b,c) \ 184#define isa_memset_io(a,b,c) \
169 memset((void *)(isa_port2addr((unsigned long)a)),(b),(c)) 185 memset((void *)(ioport_map((unsigned long)(a), 1)),(b),(c))
170#define isa_memcpy_fromio(a,b,c) \ 186#define isa_memcpy_fromio(a,b,c) \
171 memcpy((a),(void *)(isa_port2addr((unsigned long)(b))),(c)) 187 memcpy((a),(void *)(ioport_map((unsigned long)(b), 1)),(c))
172#define isa_memcpy_toio(a,b,c) \ 188#define isa_memcpy_toio(a,b,c) \
173 memcpy((void *)(isa_port2addr((unsigned long)(a))),(b),(c)) 189 memcpy((void *)(ioport_map((unsigned long)(a), 1)),(b),(c))
174 190
175/* We really want to try and get these to memcpy etc */ 191/* We really want to try and get these to memcpy etc */
176extern void memcpy_fromio(void *, unsigned long, unsigned long); 192extern void memcpy_fromio(void *, volatile void __iomem *, unsigned long);
177extern void memcpy_toio(unsigned long, const void *, unsigned long); 193extern void memcpy_toio(volatile void __iomem *, const void *, unsigned long);
178extern void memset_io(unsigned long, int, unsigned long); 194extern void memset_io(volatile void __iomem *, int, unsigned long);
179 195
180/* SuperH on-chip I/O functions */ 196/* SuperH on-chip I/O functions */
181static __inline__ unsigned char ctrl_inb(unsigned long addr) 197static inline unsigned char ctrl_inb(unsigned long addr)
182{ 198{
183 return *(volatile unsigned char*)addr; 199 return *(volatile unsigned char*)addr;
184} 200}
185 201
186static __inline__ unsigned short ctrl_inw(unsigned long addr) 202static inline unsigned short ctrl_inw(unsigned long addr)
187{ 203{
188 return *(volatile unsigned short*)addr; 204 return *(volatile unsigned short*)addr;
189} 205}
190 206
191static __inline__ unsigned int ctrl_inl(unsigned long addr) 207static inline unsigned int ctrl_inl(unsigned long addr)
192{ 208{
193 return *(volatile unsigned long*)addr; 209 return *(volatile unsigned long*)addr;
194} 210}
195 211
196static __inline__ void ctrl_outb(unsigned char b, unsigned long addr) 212static inline void ctrl_outb(unsigned char b, unsigned long addr)
197{ 213{
198 *(volatile unsigned char*)addr = b; 214 *(volatile unsigned char*)addr = b;
199} 215}
200 216
201static __inline__ void ctrl_outw(unsigned short b, unsigned long addr) 217static inline void ctrl_outw(unsigned short b, unsigned long addr)
202{ 218{
203 *(volatile unsigned short*)addr = b; 219 *(volatile unsigned short*)addr = b;
204} 220}
205 221
206static __inline__ void ctrl_outl(unsigned int b, unsigned long addr) 222static inline void ctrl_outl(unsigned int b, unsigned long addr)
207{ 223{
208 *(volatile unsigned long*)addr = b; 224 *(volatile unsigned long*)addr = b;
209} 225}
@@ -214,12 +230,12 @@ static __inline__ void ctrl_outl(unsigned int b, unsigned long addr)
214 * Change virtual addresses to physical addresses and vv. 230 * Change virtual addresses to physical addresses and vv.
215 * These are trivial on the 1:1 Linux/SuperH mapping 231 * These are trivial on the 1:1 Linux/SuperH mapping
216 */ 232 */
217static __inline__ unsigned long virt_to_phys(volatile void * address) 233static inline unsigned long virt_to_phys(volatile void *address)
218{ 234{
219 return PHYSADDR(address); 235 return PHYSADDR(address);
220} 236}
221 237
222static __inline__ void * phys_to_virt(unsigned long address) 238static inline void *phys_to_virt(unsigned long address)
223{ 239{
224 return (void *)P1SEGADDR(address); 240 return (void *)P1SEGADDR(address);
225} 241}
@@ -234,27 +250,60 @@ static __inline__ void * phys_to_virt(unsigned long address)
234 * differently. On the x86 architecture, we just read/write the 250 * differently. On the x86 architecture, we just read/write the
235 * memory location directly. 251 * memory location directly.
236 * 252 *
237 * On SH, we have the whole physical address space mapped at all times 253 * On SH, we traditionally have the whole physical address space mapped
238 * (as MIPS does), so "ioremap()" and "iounmap()" do not need to do 254 * at all times (as MIPS does), so "ioremap()" and "iounmap()" do not
239 * anything. (This isn't true for all machines but we still handle 255 * need to do anything but place the address in the proper segment. This
240 * these cases with wired TLB entries anyway ...) 256 * is true for P1 and P2 addresses, as well as some P3 ones. However,
257 * most of the P3 addresses and newer cores using extended addressing
258 * need to map through page tables, so the ioremap() implementation
259 * becomes a bit more complicated. See arch/sh/mm/ioremap.c for
260 * additional notes on this.
241 * 261 *
242 * We cheat a bit and always return uncachable areas until we've fixed 262 * We cheat a bit and always return uncachable areas until we've fixed
243 * the drivers to handle caching properly. 263 * the drivers to handle caching properly.
244 */ 264 */
245static __inline__ void * ioremap(unsigned long offset, unsigned long size) 265#ifdef CONFIG_MMU
266void __iomem *__ioremap(unsigned long offset, unsigned long size,
267 unsigned long flags);
268void __iounmap(void __iomem *addr);
269#else
270#define __ioremap(offset, size, flags) ((void __iomem *)(offset))
271#define __iounmap(addr) do { } while (0)
272#endif /* CONFIG_MMU */
273
274static inline void __iomem *
275__ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
246{ 276{
247 return __ioremap(offset, size); 277 unsigned long last_addr = offset + size - 1;
278
279 /*
280 * For P1 and P2 space this is trivial, as everything is already
281 * mapped. Uncached access for P1 addresses are done through P2.
282 * In the P3 case or for addresses outside of the 29-bit space,
283 * mapping must be done by the PMB or by using page tables.
284 */
285 if (likely(PXSEG(offset) < P3SEG && PXSEG(last_addr) < P3SEG)) {
286 if (unlikely(flags & _PAGE_CACHABLE))
287 return (void __iomem *)P1SEGADDR(offset);
288
289 return (void __iomem *)P2SEGADDR(offset);
290 }
291
292 return __ioremap(offset, size, flags);
248} 293}
249 294
250static __inline__ void iounmap(void *addr) 295#define ioremap(offset, size) \
251{ 296 __ioremap_mode((offset), (size), 0)
252 return __iounmap(addr); 297#define ioremap_nocache(offset, size) \
253} 298 __ioremap_mode((offset), (size), 0)
254 299#define ioremap_cache(offset, size) \
255#define ioremap_nocache(off,size) ioremap(off,size) 300 __ioremap_mode((offset), (size), _PAGE_CACHABLE)
256 301#define p3_ioremap(offset, size, flags) \
257static __inline__ int check_signature(unsigned long io_addr, 302 __ioremap((offset), (size), (flags))
303#define iounmap(addr) \
304 __iounmap((addr))
305
306static inline int check_signature(char __iomem *io_addr,
258 const unsigned char *signature, int length) 307 const unsigned char *signature, int length)
259{ 308{
260 int retval = 0; 309 int retval = 0;
diff --git a/include/asm-sh/io_generic.h b/include/asm-sh/io_generic.h
index be14587342f7..92fc6070d7b3 100644
--- a/include/asm-sh/io_generic.h
+++ b/include/asm-sh/io_generic.h
@@ -1,51 +1,49 @@
1/* 1/*
2 * include/asm-sh/io_generic.h 2 * Trivial I/O routine definitions, intentionally meant to be included
3 * 3 * multiple times. Ugly I/O routine concatenation helpers taken from
4 * Copyright 2000 Stuart Menefy (stuart.menefy@st.com) 4 * alpha. Must be included _before_ io.h to avoid preprocessor-induced
5 * 5 * routine mismatch.
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 * Generic IO functions
10 */ 6 */
11 7#define IO_CONCAT(a,b) _IO_CONCAT(a,b)
12#ifndef _ASM_SH_IO_GENERIC_H 8#define _IO_CONCAT(a,b) a ## _ ## b
13#define _ASM_SH_IO_GENERIC_H 9
14 10#ifndef __IO_PREFIX
15extern unsigned long generic_io_base; 11#error "Don't include this header without a valid system prefix"
16 12#endif
17extern unsigned char generic_inb(unsigned long port); 13
18extern unsigned short generic_inw(unsigned long port); 14u8 IO_CONCAT(__IO_PREFIX,inb)(unsigned long);
19extern unsigned int generic_inl(unsigned long port); 15u16 IO_CONCAT(__IO_PREFIX,inw)(unsigned long);
20 16u32 IO_CONCAT(__IO_PREFIX,inl)(unsigned long);
21extern void generic_outb(unsigned char value, unsigned long port); 17
22extern void generic_outw(unsigned short value, unsigned long port); 18void IO_CONCAT(__IO_PREFIX,outb)(u8, unsigned long);
23extern void generic_outl(unsigned int value, unsigned long port); 19void IO_CONCAT(__IO_PREFIX,outw)(u16, unsigned long);
24 20void IO_CONCAT(__IO_PREFIX,outl)(u32, unsigned long);
25extern unsigned char generic_inb_p(unsigned long port); 21
26extern unsigned short generic_inw_p(unsigned long port); 22u8 IO_CONCAT(__IO_PREFIX,inb_p)(unsigned long);
27extern unsigned int generic_inl_p(unsigned long port); 23u16 IO_CONCAT(__IO_PREFIX,inw_p)(unsigned long);
28extern void generic_outb_p(unsigned char value, unsigned long port); 24u32 IO_CONCAT(__IO_PREFIX,inl_p)(unsigned long);
29extern void generic_outw_p(unsigned short value, unsigned long port); 25void IO_CONCAT(__IO_PREFIX,outb_p)(u8, unsigned long);
30extern void generic_outl_p(unsigned int value, unsigned long port); 26void IO_CONCAT(__IO_PREFIX,outw_p)(u16, unsigned long);
31 27void IO_CONCAT(__IO_PREFIX,outl_p)(u32, unsigned long);
32extern void generic_insb(unsigned long port, void *addr, unsigned long count); 28
33extern void generic_insw(unsigned long port, void *addr, unsigned long count); 29void IO_CONCAT(__IO_PREFIX,insb)(unsigned long, void *dst, unsigned long count);
34extern void generic_insl(unsigned long port, void *addr, unsigned long count); 30void IO_CONCAT(__IO_PREFIX,insw)(unsigned long, void *dst, unsigned long count);
35extern void generic_outsb(unsigned long port, const void *addr, unsigned long count); 31void IO_CONCAT(__IO_PREFIX,insl)(unsigned long, void *dst, unsigned long count);
36extern void generic_outsw(unsigned long port, const void *addr, unsigned long count); 32void IO_CONCAT(__IO_PREFIX,outsb)(unsigned long, const void *src, unsigned long count);
37extern void generic_outsl(unsigned long port, const void *addr, unsigned long count); 33void IO_CONCAT(__IO_PREFIX,outsw)(unsigned long, const void *src, unsigned long count);
38 34void IO_CONCAT(__IO_PREFIX,outsl)(unsigned long, const void *src, unsigned long count);
39extern unsigned char generic_readb(unsigned long addr); 35
40extern unsigned short generic_readw(unsigned long addr); 36u8 IO_CONCAT(__IO_PREFIX,readb)(void __iomem *);
41extern unsigned int generic_readl(unsigned long addr); 37u16 IO_CONCAT(__IO_PREFIX,readw)(void __iomem *);
42extern void generic_writeb(unsigned char b, unsigned long addr); 38u32 IO_CONCAT(__IO_PREFIX,readl)(void __iomem *);
43extern void generic_writew(unsigned short b, unsigned long addr); 39void IO_CONCAT(__IO_PREFIX,writeb)(u8, void __iomem *);
44extern void generic_writel(unsigned int b, unsigned long addr); 40void IO_CONCAT(__IO_PREFIX,writew)(u16, void __iomem *);
45 41void IO_CONCAT(__IO_PREFIX,writel)(u32, void __iomem *);
46extern void *generic_ioremap(unsigned long offset, unsigned long size); 42
47extern void generic_iounmap(void *addr); 43void *IO_CONCAT(__IO_PREFIX,ioremap)(unsigned long offset, unsigned long size);
48 44void IO_CONCAT(__IO_PREFIX,iounmap)(void *addr);
49extern unsigned long generic_isa_port2addr(unsigned long offset); 45
50 46void __iomem *IO_CONCAT(__IO_PREFIX,ioport_map)(unsigned long addr, unsigned int size);
51#endif /* _ASM_SH_IO_GENERIC_H */ 47void IO_CONCAT(__IO_PREFIX,ioport_unmap)(void __iomem *addr);
48
49#undef __IO_PREFIX
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/irq-sh7780.h b/include/asm-sh/irq-sh7780.h
new file mode 100644
index 000000000000..8c8ca1281084
--- /dev/null
+++ b/include/asm-sh/irq-sh7780.h
@@ -0,0 +1,349 @@
1#ifndef __ASM_SH_IRQ_SH7780_H
2#define __ASM_SH_IRQ_SH7780_H
3
4/*
5 * linux/include/asm-sh/irq-sh7780.h
6 *
7 * Copyright (C) 2004 Takashi SHUDO <shudo@hitachi-ul.co.jp>
8 */
9
10#ifdef CONFIG_IDE
11# ifndef IRQ_CFCARD
12# define IRQ_CFCARD 14
13# endif
14# ifndef IRQ_PCMCIA
15# define IRQ_PCMCIA 15
16# endif
17#endif
18
19#define INTC_BASE 0xffd00000
20#define INTC_ICR0 (INTC_BASE+0x0)
21#define INTC_ICR1 (INTC_BASE+0x1c)
22#define INTC_INTPRI (INTC_BASE+0x10)
23#define INTC_INTREQ (INTC_BASE+0x24)
24#define INTC_INTMSK0 (INTC_BASE+0x44)
25#define INTC_INTMSK1 (INTC_BASE+0x48)
26#define INTC_INTMSK2 (INTC_BASE+0x40080)
27#define INTC_INTMSKCLR0 (INTC_BASE+0x64)
28#define INTC_INTMSKCLR1 (INTC_BASE+0x68)
29#define INTC_INTMSKCLR2 (INTC_BASE+0x40084)
30#define INTC_NMIFCR (INTC_BASE+0xc0)
31#define INTC_USERIMASK (INTC_BASE+0x30000)
32
33#define INTC_INT2PRI0 (INTC_BASE+0x40000)
34#define INTC_INT2PRI1 (INTC_BASE+0x40004)
35#define INTC_INT2PRI2 (INTC_BASE+0x40008)
36#define INTC_INT2PRI3 (INTC_BASE+0x4000c)
37#define INTC_INT2PRI4 (INTC_BASE+0x40010)
38#define INTC_INT2PRI5 (INTC_BASE+0x40014)
39#define INTC_INT2PRI6 (INTC_BASE+0x40018)
40#define INTC_INT2PRI7 (INTC_BASE+0x4001c)
41#define INTC_INT2A0 (INTC_BASE+0x40030)
42#define INTC_INT2A1 (INTC_BASE+0x40034)
43#define INTC_INT2MSKR (INTC_BASE+0x40038)
44#define INTC_INT2MSKCR (INTC_BASE+0x4003c)
45#define INTC_INT2B0 (INTC_BASE+0x40040)
46#define INTC_INT2B1 (INTC_BASE+0x40044)
47#define INTC_INT2B2 (INTC_BASE+0x40048)
48#define INTC_INT2B3 (INTC_BASE+0x4004c)
49#define INTC_INT2B4 (INTC_BASE+0x40050)
50#define INTC_INT2B5 (INTC_BASE+0x40054)
51#define INTC_INT2B6 (INTC_BASE+0x40058)
52#define INTC_INT2B7 (INTC_BASE+0x4005c)
53#define INTC_INT2GPIC (INTC_BASE+0x40090)
54/*
55 NOTE:
56 *_IRQ = (INTEVT2 - 0x200)/0x20
57*/
58/* IRQ 0-7 line external int*/
59#define IRQ0_IRQ 2
60#define IRQ0_IPR_ADDR INTC_INTPRI
61#define IRQ0_IPR_POS 7
62#define IRQ0_PRIORITY 2
63
64#define IRQ1_IRQ 4
65#define IRQ1_IPR_ADDR INTC_INTPRI
66#define IRQ1_IPR_POS 6
67#define IRQ1_PRIORITY 2
68
69#define IRQ2_IRQ 6
70#define IRQ2_IPR_ADDR INTC_INTPRI
71#define IRQ2_IPR_POS 5
72#define IRQ2_PRIORITY 2
73
74#define IRQ3_IRQ 8
75#define IRQ3_IPR_ADDR INTC_INTPRI
76#define IRQ3_IPR_POS 4
77#define IRQ3_PRIORITY 2
78
79#define IRQ4_IRQ 10
80#define IRQ4_IPR_ADDR INTC_INTPRI
81#define IRQ4_IPR_POS 3
82#define IRQ4_PRIORITY 2
83
84#define IRQ5_IRQ 12
85#define IRQ5_IPR_ADDR INTC_INTPRI
86#define IRQ5_IPR_POS 2
87#define IRQ5_PRIORITY 2
88
89#define IRQ6_IRQ 14
90#define IRQ6_IPR_ADDR INTC_INTPRI
91#define IRQ6_IPR_POS 1
92#define IRQ6_PRIORITY 2
93
94#define IRQ7_IRQ 0
95#define IRQ7_IPR_ADDR INTC_INTPRI
96#define IRQ7_IPR_POS 0
97#define IRQ7_PRIORITY 2
98
99/* TMU */
100/* ch0 */
101#define TMU_IRQ 28
102#define TMU_IPR_ADDR INTC_INT2PRI0
103#define TMU_IPR_POS 3
104#define TMU_PRIORITY 2
105
106#define TIMER_IRQ 28
107#define TIMER_IPR_ADDR INTC_INT2PRI0
108#define TIMER_IPR_POS 3
109#define TIMER_PRIORITY 2
110
111/* ch 1*/
112#define TMU_CH1_IRQ 29
113#define TMU_CH1_IPR_ADDR INTC_INT2PRI0
114#define TMU_CH1_IPR_POS 2
115#define TMU_CH1_PRIORITY 2
116
117#define TIMER1_IRQ 29
118#define TIMER1_IPR_ADDR INTC_INT2PRI0
119#define TIMER1_IPR_POS 2
120#define TIMER1_PRIORITY 2
121
122/* ch 2*/
123#define TMU_CH2_IRQ 30
124#define TMU_CH2_IPR_ADDR INTC_INT2PRI0
125#define TMU_CH2_IPR_POS 1
126#define TMU_CH2_PRIORITY 2
127/* ch 2 Input capture */
128#define TMU_CH2IC_IRQ 31
129#define TMU_CH2IC_IPR_ADDR INTC_INT2PRI0
130#define TMU_CH2IC_IPR_POS 0
131#define TMU_CH2IC_PRIORITY 2
132/* ch 3 */
133#define TMU_CH3_IRQ 96
134#define TMU_CH3_IPR_ADDR INTC_INT2PRI1
135#define TMU_CH3_IPR_POS 3
136#define TMU_CH3_PRIORITY 2
137/* ch 4 */
138#define TMU_CH4_IRQ 97
139#define TMU_CH4_IPR_ADDR INTC_INT2PRI1
140#define TMU_CH4_IPR_POS 2
141#define TMU_CH4_PRIORITY 2
142/* ch 5*/
143#define TMU_CH5_IRQ 98
144#define TMU_CH5_IPR_ADDR INTC_INT2PRI1
145#define TMU_CH5_IPR_POS 1
146#define TMU_CH5_PRIORITY 2
147
148#define RTC_IRQ 22
149#define RTC_IPR_ADDR INTC_INT2PRI1
150#define RTC_IPR_POS 0
151#define RTC_PRIORITY TIMER_PRIORITY
152
153/* SCIF0 */
154#define SCIF0_ERI_IRQ 40
155#define SCIF0_RXI_IRQ 41
156#define SCIF0_BRI_IRQ 42
157#define SCIF0_TXI_IRQ 43
158#define SCIF0_IPR_ADDR INTC_INT2PRI2
159#define SCIF0_IPR_POS 3
160#define SCIF0_PRIORITY 3
161
162/* SCIF1 */
163#define SCIF1_ERI_IRQ 76
164#define SCIF1_RXI_IRQ 77
165#define SCIF1_BRI_IRQ 78
166#define SCIF1_TXI_IRQ 79
167#define SCIF1_IPR_ADDR INTC_INT2PRI2
168#define SCIF1_IPR_POS 2
169#define SCIF1_PRIORITY 3
170
171#define WDT_IRQ 27
172#define WDT_IPR_ADDR INTC_INT2PRI2
173#define WDT_IPR_POS 1
174#define WDT_PRIORITY 2
175
176/* DMAC(0) */
177#define DMINT0_IRQ 34
178#define DMINT1_IRQ 35
179#define DMINT2_IRQ 36
180#define DMINT3_IRQ 37
181#define DMINT4_IRQ 44
182#define DMINT5_IRQ 45
183#define DMINT6_IRQ 46
184#define DMINT7_IRQ 47
185#define DMAE_IRQ 38
186#define DMA0_IPR_ADDR INTC_INT2PRI3
187#define DMA0_IPR_POS 2
188#define DMA0_PRIORITY 7
189
190/* DMAC(1) */
191#define DMINT8_IRQ 92
192#define DMINT9_IRQ 93
193#define DMINT10_IRQ 94
194#define DMINT11_IRQ 95
195#define DMA1_IPR_ADDR INTC_INT2PRI3
196#define DMA1_IPR_POS 1
197#define DMA1_PRIORITY 7
198
199#define DMTE0_IRQ DMINT0_IRQ
200#define DMTE4_IRQ DMINT4_IRQ
201#define DMA_IPR_ADDR DMA0_IPR_ADDR
202#define DMA_IPR_POS DMA0_IPR_POS
203#define DMA_PRIORITY DMA0_PRIORITY
204
205/* CMT */
206#define CMT_IRQ 56
207#define CMT_IPR_ADDR INTC_INT2PRI4
208#define CMT_IPR_POS 3
209#define CMT_PRIORITY 0
210
211/* HAC */
212#define HAC_IRQ 60
213#define HAC_IPR_ADDR INTC_INT2PRI4
214#define HAC_IPR_POS 2
215#define CMT_PRIORITY 0
216
217/* PCIC(0) */
218#define PCIC0_IRQ 64
219#define PCIC0_IPR_ADDR INTC_INT2PRI4
220#define PCIC0_IPR_POS 1
221#define PCIC0_PRIORITY 2
222
223/* PCIC(1) */
224#define PCIC1_IRQ 65
225#define PCIC1_IPR_ADDR INTC_INT2PRI4
226#define PCIC1_IPR_POS 0
227#define PCIC1_PRIORITY 2
228
229/* PCIC(2) */
230#define PCIC2_IRQ 66
231#define PCIC2_IPR_ADDR INTC_INT2PRI5
232#define PCIC2_IPR_POS 3
233#define PCIC2_PRIORITY 2
234
235/* PCIC(3) */
236#define PCIC3_IRQ 67
237#define PCIC3_IPR_ADDR INTC_INT2PRI5
238#define PCIC3_IPR_POS 2
239#define PCIC3_PRIORITY 2
240
241/* PCIC(4) */
242#define PCIC4_IRQ 68
243#define PCIC4_IPR_ADDR INTC_INT2PRI5
244#define PCIC4_IPR_POS 1
245#define PCIC4_PRIORITY 2
246
247/* PCIC(5) */
248#define PCICERR_IRQ 69
249#define PCICPWD3_IRQ 70
250#define PCICPWD2_IRQ 71
251#define PCICPWD1_IRQ 72
252#define PCICPWD0_IRQ 73
253#define PCIC5_IPR_ADDR INTC_INT2PRI5
254#define PCIC5_IPR_POS 0
255#define PCIC5_PRIORITY 2
256
257/* SIOF */
258#define SIOF_IRQ 80
259#define SIOF_IPR_ADDR INTC_INT2PRI6
260#define SIOF_IPR_POS 3
261#define SIOF_PRIORITY 3
262
263/* HSPI */
264#define HSPI_IRQ 84
265#define HSPI_IPR_ADDR INTC_INT2PRI6
266#define HSPI_IPR_POS 2
267#define HSPI_PRIORITY 3
268
269/* MMCIF */
270#define MMCIF_FSTAT_IRQ 88
271#define MMCIF_TRAN_IRQ 89
272#define MMCIF_ERR_IRQ 90
273#define MMCIF_FRDY_IRQ 91
274#define MMCIF_IPR_ADDR INTC_INT2PRI6
275#define MMCIF_IPR_POS 1
276#define HSPI_PRIORITY 3
277
278/* SSI */
279#define SSI_IRQ 100
280#define SSI_IPR_ADDR INTC_INT2PRI6
281#define SSI_IPR_POS 0
282#define SSI_PRIORITY 3
283
284/* FLCTL */
285#define FLCTL_FLSTE_IRQ 104
286#define FLCTL_FLTEND_IRQ 105
287#define FLCTL_FLTRQ0_IRQ 106
288#define FLCTL_FLTRQ1_IRQ 107
289#define FLCTL_IPR_ADDR INTC_INT2PRI7
290#define FLCTL_IPR_POS 3
291#define FLCTL_PRIORITY 3
292
293/* GPIO */
294#define GPIO0_IRQ 108
295#define GPIO1_IRQ 109
296#define GPIO2_IRQ 110
297#define GPIO3_IRQ 111
298#define GPIO_IPR_ADDR INTC_INT2PRI7
299#define GPIO_IPR_POS 2
300#define GPIO_PRIORITY 3
301
302/* ONCHIP_NR_IRQS */
303#define NR_IRQS 150 /* 111 + 16 */
304
305/* In a generic kernel, NR_IRQS is an upper bound, and we should use
306 * ACTUAL_NR_IRQS (which uses the machine vector) to get the correct value.
307 */
308#define ACTUAL_NR_IRQS NR_IRQS
309
310extern void disable_irq(unsigned int);
311extern void disable_irq_nosync(unsigned int);
312extern void enable_irq(unsigned int);
313
314/*
315 * Simple Mask Register Support
316 */
317extern void make_maskreg_irq(unsigned int irq);
318extern unsigned short *irq_mask_register;
319
320/*
321 * Function for "on chip support modules".
322 */
323extern void make_imask_irq(unsigned int irq);
324
325#define INTC_TMU0_MSK 0
326#define INTC_TMU3_MSK 1
327#define INTC_RTC_MSK 2
328#define INTC_SCIF0_MSK 3
329#define INTC_SCIF1_MSK 4
330#define INTC_WDT_MSK 5
331#define INTC_HUID_MSK 7
332#define INTC_DMAC0_MSK 8
333#define INTC_DMAC1_MSK 9
334#define INTC_CMT_MSK 12
335#define INTC_HAC_MSK 13
336#define INTC_PCIC0_MSK 14
337#define INTC_PCIC1_MSK 15
338#define INTC_PCIC2_MSK 16
339#define INTC_PCIC3_MSK 17
340#define INTC_PCIC4_MSK 18
341#define INTC_PCIC5_MSK 19
342#define INTC_SIOF_MSK 20
343#define INTC_HSPI_MSK 21
344#define INTC_MMCIF_MSK 22
345#define INTC_SSI_MSK 23
346#define INTC_FLCTL_MSK 24
347#define INTC_GPIO_MSK 25
348
349#endif /* __ASM_SH_IRQ_SH7780_H */
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index 614a8c13b721..060ec3c27207 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -15,13 +15,20 @@
15#include <asm/machvec.h> 15#include <asm/machvec.h>
16#include <asm/ptrace.h> /* for pt_regs */ 16#include <asm/ptrace.h> /* for pt_regs */
17 17
18#if defined(CONFIG_SH_HP600) || \ 18#if defined(CONFIG_SH_HP6XX) || \
19 defined(CONFIG_SH_RTS7751R2D) || \ 19 defined(CONFIG_SH_RTS7751R2D) || \
20 defined(CONFIG_SH_HS7751RVOIP) || \ 20 defined(CONFIG_SH_HS7751RVOIP) || \
21 defined(CONFIG_SH_SH03) 21 defined(CONFIG_SH_HS7751RVOIP) || \
22 defined(CONFIG_SH_SH03) || \
23 defined(CONFIG_SH_R7780RP) || \
24 defined(CONFIG_SH_LANDISK)
22#include <asm/mach/ide.h> 25#include <asm/mach/ide.h>
23#endif 26#endif
24 27
28#ifndef CONFIG_CPU_SUBTYPE_SH7780
29
30#define INTC_DMAC0_MSK 0
31
25#if defined(CONFIG_CPU_SH3) 32#if defined(CONFIG_CPU_SH3)
26#define INTC_IPRA 0xfffffee2UL 33#define INTC_IPRA 0xfffffee2UL
27#define INTC_IPRB 0xfffffee4UL 34#define INTC_IPRB 0xfffffee4UL
@@ -235,8 +242,9 @@
235#define SCIF1_IPR_ADDR INTC_IPRB 242#define SCIF1_IPR_ADDR INTC_IPRB
236#define SCIF1_IPR_POS 1 243#define SCIF1_IPR_POS 1
237#define SCIF1_PRIORITY 3 244#define SCIF1_PRIORITY 3
238#endif 245#endif /* ST40STB1 */
239#endif 246
247#endif /* 775x / SH4-202 / ST40STB1 */
240 248
241/* NR_IRQS is made from three components: 249/* NR_IRQS is made from three components:
242 * 1. ONCHIP_NR_IRQS - number of IRLS + on-chip peripherial modules 250 * 1. ONCHIP_NR_IRQS - number of IRLS + on-chip peripherial modules
@@ -245,37 +253,35 @@
245 */ 253 */
246 254
247/* 1. ONCHIP_NR_IRQS */ 255/* 1. ONCHIP_NR_IRQS */
248#ifdef CONFIG_SH_GENERIC 256#if defined(CONFIG_CPU_SUBTYPE_SH7604)
257# define ONCHIP_NR_IRQS 24 // Actually 21
258#elif defined(CONFIG_CPU_SUBTYPE_SH7707)
259# define ONCHIP_NR_IRQS 64
260# define PINT_NR_IRQS 16
261#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
262# define ONCHIP_NR_IRQS 32
263#elif defined(CONFIG_CPU_SUBTYPE_SH7709) || \
264 defined(CONFIG_CPU_SUBTYPE_SH7705)
265# define ONCHIP_NR_IRQS 64 // Actually 61
266# define PINT_NR_IRQS 16
267#elif defined(CONFIG_CPU_SUBTYPE_SH7750)
268# define ONCHIP_NR_IRQS 48 // Actually 44
269#elif defined(CONFIG_CPU_SUBTYPE_SH7751)
270# define ONCHIP_NR_IRQS 72
271#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
272# define ONCHIP_NR_IRQS 112 /* XXX */
273#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
274# define ONCHIP_NR_IRQS 72
275#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
276# define ONCHIP_NR_IRQS 144
277#elif defined(CONFIG_CPU_SUBTYPE_SH7300)
278# define ONCHIP_NR_IRQS 109
279#elif defined(CONFIG_SH_UNKNOWN) /* Most be last */
249# define ONCHIP_NR_IRQS 144 280# define ONCHIP_NR_IRQS 144
250#else
251# if defined(CONFIG_CPU_SUBTYPE_SH7604)
252# define ONCHIP_NR_IRQS 24 // Actually 21
253# elif defined(CONFIG_CPU_SUBTYPE_SH7707)
254# define ONCHIP_NR_IRQS 64
255# define PINT_NR_IRQS 16
256# elif defined(CONFIG_CPU_SUBTYPE_SH7708)
257# define ONCHIP_NR_IRQS 32
258# elif defined(CONFIG_CPU_SUBTYPE_SH7709) || \
259 defined(CONFIG_CPU_SUBTYPE_SH7705)
260# define ONCHIP_NR_IRQS 64 // Actually 61
261# define PINT_NR_IRQS 16
262# elif defined(CONFIG_CPU_SUBTYPE_SH7750)
263# define ONCHIP_NR_IRQS 48 // Actually 44
264# elif defined(CONFIG_CPU_SUBTYPE_SH7751)
265# define ONCHIP_NR_IRQS 72
266# elif defined(CONFIG_CPU_SUBTYPE_SH7760)
267# define ONCHIP_NR_IRQS 110
268# elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
269# define ONCHIP_NR_IRQS 72
270# elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
271# define ONCHIP_NR_IRQS 144
272# elif defined(CONFIG_CPU_SUBTYPE_SH7300)
273# define ONCHIP_NR_IRQS 109
274# endif
275#endif 281#endif
276 282
277/* 2. PINT_NR_IRQS */ 283/* 2. PINT_NR_IRQS */
278#ifdef CONFIG_SH_GENERIC 284#ifdef CONFIG_SH_UNKNOWN
279# define PINT_NR_IRQS 16 285# define PINT_NR_IRQS 16
280#else 286#else
281# ifndef PINT_NR_IRQS 287# ifndef PINT_NR_IRQS
@@ -288,22 +294,22 @@
288#endif 294#endif
289 295
290/* 3. OFFCHIP_NR_IRQS */ 296/* 3. OFFCHIP_NR_IRQS */
291#ifdef CONFIG_SH_GENERIC 297#if defined(CONFIG_HD64461)
298# define OFFCHIP_NR_IRQS 18
299#elif defined (CONFIG_SH_BIGSUR) /* must be before CONFIG_HD64465 */
300# define OFFCHIP_NR_IRQS 48
301#elif defined(CONFIG_HD64465)
292# define OFFCHIP_NR_IRQS 16 302# define OFFCHIP_NR_IRQS 16
303#elif defined (CONFIG_SH_EC3104)
304# define OFFCHIP_NR_IRQS 16
305#elif defined (CONFIG_SH_DREAMCAST)
306# define OFFCHIP_NR_IRQS 96
307#elif defined (CONFIG_SH_TITAN)
308# define OFFCHIP_NR_IRQS 4
309#elif defined(CONFIG_SH_UNKNOWN)
310# define OFFCHIP_NR_IRQS 16 /* Must also be last */
293#else 311#else
294# if defined(CONFIG_HD64461) 312# define OFFCHIP_NR_IRQS 0
295# define OFFCHIP_NR_IRQS 18
296# elif defined (CONFIG_SH_BIGSUR) /* must be before CONFIG_HD64465 */
297# define OFFCHIP_NR_IRQS 48
298# elif defined(CONFIG_HD64465)
299# define OFFCHIP_NR_IRQS 16
300# elif defined (CONFIG_SH_EC3104)
301# define OFFCHIP_NR_IRQS 16
302# elif defined (CONFIG_SH_DREAMCAST)
303# define OFFCHIP_NR_IRQS 96
304# else
305# define OFFCHIP_NR_IRQS 0
306# endif
307#endif 313#endif
308 314
309#if OFFCHIP_NR_IRQS > 0 315#if OFFCHIP_NR_IRQS > 0
@@ -313,16 +319,6 @@
313/* NR_IRQS. 1+2+3 */ 319/* NR_IRQS. 1+2+3 */
314#define NR_IRQS (ONCHIP_NR_IRQS + PINT_NR_IRQS + OFFCHIP_NR_IRQS) 320#define NR_IRQS (ONCHIP_NR_IRQS + PINT_NR_IRQS + OFFCHIP_NR_IRQS)
315 321
316/* In a generic kernel, NR_IRQS is an upper bound, and we should use
317 * ACTUAL_NR_IRQS (which uses the machine vector) to get the correct value.
318 */
319#ifdef CONFIG_SH_GENERIC
320# define ACTUAL_NR_IRQS (sh_mv.mv_nr_irqs)
321#else
322# define ACTUAL_NR_IRQS NR_IRQS
323#endif
324
325
326extern void disable_irq(unsigned int); 322extern void disable_irq(unsigned int);
327extern void disable_irq_nosync(unsigned int); 323extern void disable_irq_nosync(unsigned int);
328extern void enable_irq(unsigned int); 324extern void enable_irq(unsigned int);
@@ -542,9 +538,6 @@ extern int ipr_irq_demux(int irq);
542 538
543extern int ipr_irq_demux(int irq); 539extern int ipr_irq_demux(int irq);
544#define __irq_demux(irq) ipr_irq_demux(irq) 540#define __irq_demux(irq) ipr_irq_demux(irq)
545
546#else
547#define __irq_demux(irq) irq
548#endif /* CONFIG_CPU_SUBTYPE_SH7707 || CONFIG_CPU_SUBTYPE_SH7709 */ 541#endif /* CONFIG_CPU_SUBTYPE_SH7707 || CONFIG_CPU_SUBTYPE_SH7709 */
549 542
550#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \ 543#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \
@@ -557,18 +550,35 @@ extern int ipr_irq_demux(int irq);
557#define INTC_ICR_IRLM (1<<7) 550#define INTC_ICR_IRLM (1<<7)
558#endif 551#endif
559 552
560#ifdef CONFIG_CPU_SUBTYPE_ST40STB1 553#else
554#include <asm/irq-sh7780.h>
555#endif
561 556
557/* SH with INTC2-style interrupts */
558#ifdef CONFIG_CPU_HAS_INTC2_IRQ
559#if defined(CONFIG_CPU_SUBTYPE_ST40STB1)
560#define INTC2_BASE 0xfe080000
562#define INTC2_FIRST_IRQ 64 561#define INTC2_FIRST_IRQ 64
563#define NR_INTC2_IRQS 25 562#define INTC2_INTREQ_OFFSET 0x20
564 563#define INTC2_INTMSK_OFFSET 0x40
564#define INTC2_INTMSKCLR_OFFSET 0x60
565#define NR_INTC2_IRQS 25
566#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
565#define INTC2_BASE 0xfe080000 567#define INTC2_BASE 0xfe080000
566#define INTC2_INTC2MODE (INTC2_BASE+0x80) 568#define INTC2_FIRST_IRQ 48 /* INTEVT 0x800 */
567
568#define INTC2_INTPRI_OFFSET 0x00
569#define INTC2_INTREQ_OFFSET 0x20 569#define INTC2_INTREQ_OFFSET 0x20
570#define INTC2_INTMSK_OFFSET 0x40 570#define INTC2_INTMSK_OFFSET 0x40
571#define INTC2_INTMSKCLR_OFFSET 0x60 571#define INTC2_INTMSKCLR_OFFSET 0x60
572#define NR_INTC2_IRQS 64
573#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
574#define INTC2_BASE 0xffd40000
575#define INTC2_FIRST_IRQ 22
576#define INTC2_INTMSK_OFFSET (0x38)
577#define INTC2_INTMSKCLR_OFFSET (0x3c)
578#define NR_INTC2_IRQS 60
579#endif
580
581#define INTC2_INTPRI_OFFSET 0x00
572 582
573void make_intc2_irq(unsigned int irq, 583void make_intc2_irq(unsigned int irq,
574 unsigned int ipr_offset, unsigned int ipr_shift, 584 unsigned int ipr_offset, unsigned int ipr_shift,
@@ -577,13 +587,16 @@ void make_intc2_irq(unsigned int irq,
577void init_IRQ_intc2(void); 587void init_IRQ_intc2(void);
578void intc2_add_clear_irq(int irq, int (*fn)(int)); 588void intc2_add_clear_irq(int irq, int (*fn)(int));
579 589
580#endif /* CONFIG_CPU_SUBTYPE_ST40STB1 */ 590#endif
581 591
582static inline int generic_irq_demux(int irq) 592static inline int generic_irq_demux(int irq)
583{ 593{
584 return irq; 594 return irq;
585} 595}
586 596
597#ifndef __irq_demux
598#define __irq_demux(irq) (irq)
599#endif
587#define irq_canonicalize(irq) (irq) 600#define irq_canonicalize(irq) (irq)
588#define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq)) 601#define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq))
589 602
diff --git a/include/asm-sh/kexec.h b/include/asm-sh/kexec.h
new file mode 100644
index 000000000000..9dfe59f6fcb5
--- /dev/null
+++ b/include/asm-sh/kexec.h
@@ -0,0 +1,33 @@
1#ifndef _SH_KEXEC_H
2#define _SH_KEXEC_H
3
4/*
5 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
6 * I.e. Maximum page that is mapped directly into kernel memory,
7 * and kmap is not required.
8 *
9 * Someone correct me if FIXADDR_START - PAGEOFFSET is not the correct
10 * calculation for the amount of memory directly mappable into the
11 * kernel memory space.
12 */
13
14/* Maximum physical address we can use pages from */
15#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
16/* Maximum address we can reach in physical address mode */
17#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
18/* Maximum address we can use for the control code buffer */
19#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
20
21#define KEXEC_CONTROL_CODE_SIZE 4096
22
23/* The native architecture */
24#define KEXEC_ARCH KEXEC_ARCH_SH
25
26#ifndef __ASSEMBLY__
27
28extern void machine_shutdown(void);
29extern void *crash_notes;
30
31#endif /* __ASSEMBLY__ */
32
33#endif /* _SH_KEXEC_H */
diff --git a/include/asm-sh/machvec.h b/include/asm-sh/machvec.h
index 3f18aa180516..550c50a7359e 100644
--- a/include/asm-sh/machvec.h
+++ b/include/asm-sh/machvec.h
@@ -18,44 +18,37 @@
18#include <asm/machvec_init.h> 18#include <asm/machvec_init.h>
19 19
20struct device; 20struct device;
21struct timeval;
22 21
23struct sh_machine_vector 22struct sh_machine_vector {
24{
25 int mv_nr_irqs; 23 int mv_nr_irqs;
26 24
27 unsigned char (*mv_inb)(unsigned long); 25 u8 (*mv_inb)(unsigned long);
28 unsigned short (*mv_inw)(unsigned long); 26 u16 (*mv_inw)(unsigned long);
29 unsigned int (*mv_inl)(unsigned long); 27 u32 (*mv_inl)(unsigned long);
30 void (*mv_outb)(unsigned char, unsigned long); 28 void (*mv_outb)(u8, unsigned long);
31 void (*mv_outw)(unsigned short, unsigned long); 29 void (*mv_outw)(u16, unsigned long);
32 void (*mv_outl)(unsigned int, unsigned long); 30 void (*mv_outl)(u32, unsigned long);
33 31
34 unsigned char (*mv_inb_p)(unsigned long); 32 u8 (*mv_inb_p)(unsigned long);
35 unsigned short (*mv_inw_p)(unsigned long); 33 u16 (*mv_inw_p)(unsigned long);
36 unsigned int (*mv_inl_p)(unsigned long); 34 u32 (*mv_inl_p)(unsigned long);
37 void (*mv_outb_p)(unsigned char, unsigned long); 35 void (*mv_outb_p)(u8, unsigned long);
38 void (*mv_outw_p)(unsigned short, unsigned long); 36 void (*mv_outw_p)(u16, unsigned long);
39 void (*mv_outl_p)(unsigned int, unsigned long); 37 void (*mv_outl_p)(u32, unsigned long);
40 38
41 void (*mv_insb)(unsigned long port, void *addr, unsigned long count); 39 void (*mv_insb)(unsigned long, void *dst, unsigned long count);
42 void (*mv_insw)(unsigned long port, void *addr, unsigned long count); 40 void (*mv_insw)(unsigned long, void *dst, unsigned long count);
43 void (*mv_insl)(unsigned long port, void *addr, unsigned long count); 41 void (*mv_insl)(unsigned long, void *dst, unsigned long count);
44 void (*mv_outsb)(unsigned long port, const void *addr, unsigned long count); 42 void (*mv_outsb)(unsigned long, const void *src, unsigned long count);
45 void (*mv_outsw)(unsigned long port, const void *addr, unsigned long count); 43 void (*mv_outsw)(unsigned long, const void *src, unsigned long count);
46 void (*mv_outsl)(unsigned long port, const void *addr, unsigned long count); 44 void (*mv_outsl)(unsigned long, const void *src, unsigned long count);
47 45
48 unsigned char (*mv_readb)(unsigned long); 46 u8 (*mv_readb)(void __iomem *);
49 unsigned short (*mv_readw)(unsigned long); 47 u16 (*mv_readw)(void __iomem *);
50 unsigned int (*mv_readl)(unsigned long); 48 u32 (*mv_readl)(void __iomem *);
51 void (*mv_writeb)(unsigned char, unsigned long); 49 void (*mv_writeb)(u8, void __iomem *);
52 void (*mv_writew)(unsigned short, unsigned long); 50 void (*mv_writew)(u16, void __iomem *);
53 void (*mv_writel)(unsigned int, unsigned long); 51 void (*mv_writel)(u32, void __iomem *);
54
55 void* (*mv_ioremap)(unsigned long offset, unsigned long size);
56 void (*mv_iounmap)(void *addr);
57
58 unsigned long (*mv_isa_port2addr)(unsigned long offset);
59 52
60 int (*mv_irq_demux)(int irq); 53 int (*mv_irq_demux)(int irq);
61 54
@@ -66,6 +59,9 @@ struct sh_machine_vector
66 59
67 void *(*mv_consistent_alloc)(struct device *, size_t, dma_addr_t *, gfp_t); 60 void *(*mv_consistent_alloc)(struct device *, size_t, dma_addr_t *, gfp_t);
68 int (*mv_consistent_free)(struct device *, size_t, void *, dma_addr_t); 61 int (*mv_consistent_free)(struct device *, size_t, void *, dma_addr_t);
62
63 void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size);
64 void (*mv_ioport_unmap)(void __iomem *);
69}; 65};
70 66
71extern struct sh_machine_vector sh_mv; 67extern struct sh_machine_vector sh_mv;
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-sh/timer.h b/include/asm-sh/timer.h
new file mode 100644
index 000000000000..dd6579c0b04c
--- /dev/null
+++ b/include/asm-sh/timer.h
@@ -0,0 +1,42 @@
1#ifndef __ASM_SH_TIMER_H
2#define __ASM_SH_TIMER_H
3
4#include <linux/sysdev.h>
5#include <asm/cpu/timer.h>
6
7struct sys_timer_ops {
8 int (*init)(void);
9 unsigned long (*get_offset)(void);
10 unsigned long (*get_frequency)(void);
11};
12
13struct sys_timer {
14 const char *name;
15
16 struct sys_device dev;
17 struct sys_timer_ops *ops;
18};
19
20#define TICK_SIZE (tick_nsec / 1000)
21
22extern struct sys_timer tmu_timer;
23extern struct sys_timer *sys_timer;
24
25static inline unsigned long get_timer_offset(void)
26{
27 return sys_timer->ops->get_offset();
28}
29
30static inline unsigned long get_timer_frequency(void)
31{
32 return sys_timer->ops->get_frequency();
33}
34
35/* arch/sh/kernel/timers/timer.c */
36struct sys_timer *get_sys_timer(void);
37
38/* arch/sh/kernel/time.c */
39void handle_timer_tick(struct pt_regs *);
40
41#endif /* __ASM_SH_TIMER_H */
42
diff --git a/include/asm-sh64/atomic.h b/include/asm-sh64/atomic.h
index f3ce5c0df13a..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;
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 accb4967e9d2..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
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/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/oplib.h b/include/asm-sparc/oplib.h
index 95944556d8b6..d0d76b30eb4c 100644
--- a/include/asm-sparc/oplib.h
+++ b/include/asm-sparc/oplib.h
@@ -164,6 +164,7 @@ enum prom_input_device {
164 PROMDEV_IKBD, /* input from keyboard */ 164 PROMDEV_IKBD, /* input from keyboard */
165 PROMDEV_ITTYA, /* input from ttya */ 165 PROMDEV_ITTYA, /* input from ttya */
166 PROMDEV_ITTYB, /* input from ttyb */ 166 PROMDEV_ITTYB, /* input from ttyb */
167 PROMDEV_IRSC, /* input from rsc */
167 PROMDEV_I_UNK, 168 PROMDEV_I_UNK,
168}; 169};
169 170
@@ -175,6 +176,7 @@ enum prom_output_device {
175 PROMDEV_OSCREEN, /* to screen */ 176 PROMDEV_OSCREEN, /* to screen */
176 PROMDEV_OTTYA, /* to ttya */ 177 PROMDEV_OTTYA, /* to ttya */
177 PROMDEV_OTTYB, /* to ttyb */ 178 PROMDEV_OTTYB, /* to ttyb */
179 PROMDEV_ORSC, /* to rsc */
178 PROMDEV_O_UNK, 180 PROMDEV_O_UNK,
179}; 181};
180 182
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..91b9f5888c85 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/*
@@ -131,9 +128,10 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
131 * thread information flag bit numbers 128 * thread information flag bit numbers
132 */ 129 */
133#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 130#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
134#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ 131/* flag bit 1 is available */
135#define TIF_SIGPENDING 2 /* signal pending */ 132#define TIF_SIGPENDING 2 /* signal pending */
136#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 133#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
134#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
137#define TIF_USEDFPU 8 /* FPU was used by this task 135#define TIF_USEDFPU 8 /* FPU was used by this task
138 * this quantum (SMP) */ 136 * this quantum (SMP) */
139#define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling 137#define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling
@@ -142,9 +140,9 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
142 140
143/* as above, but as bit values */ 141/* as above, but as bit values */
144#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 142#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
145#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
146#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 143#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
147#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 144#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
145#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
148#define _TIF_USEDFPU (1<<TIF_USEDFPU) 146#define _TIF_USEDFPU (1<<TIF_USEDFPU)
149#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 147#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
150 148
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 58dba518239e..2ac64e65e336 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -300,11 +300,26 @@
300#define __NR_add_key 281 300#define __NR_add_key 281
301#define __NR_request_key 282 301#define __NR_request_key 282
302#define __NR_keyctl 283 302#define __NR_keyctl 283
303#define __NR_openat 284
304#define __NR_mkdirat 285
305#define __NR_mknodat 286
306#define __NR_fchownat 287
307#define __NR_futimesat 288
308#define __NR_newfstatat 289
309#define __NR_unlinkat 290
310#define __NR_renameat 291
311#define __NR_linkat 292
312#define __NR_symlinkat 293
313#define __NR_readlinkat 294
314#define __NR_fchmodat 295
315#define __NR_faccessat 296
316#define __NR_pselect6 297
317#define __NR_ppoll 298
303 318
304/* WARNING: You MAY NOT add syscall numbers larger than 283, since 319/* WARNING: You MAY NOT add syscall numbers larger than 298, since
305 * all of the syscall tables in the Sparc kernel are 320 * all of the syscall tables in the Sparc kernel are
306 * sized to have 283 entries (starting at zero). Therefore 321 * sized to have 298 entries (starting at zero). Therefore
307 * find a free slot in the 0-282 range. 322 * find a free slot in the 0-298 range.
308 */ 323 */
309 324
310#define _syscall0(type,name) \ 325#define _syscall0(type,name) \
@@ -458,6 +473,7 @@ return -1; \
458#define __ARCH_WANT_SYS_OLDUMOUNT 473#define __ARCH_WANT_SYS_OLDUMOUNT
459#define __ARCH_WANT_SYS_SIGPENDING 474#define __ARCH_WANT_SYS_SIGPENDING
460#define __ARCH_WANT_SYS_SIGPROCMASK 475#define __ARCH_WANT_SYS_SIGPROCMASK
476#define __ARCH_WANT_SYS_RT_SIGSUSPEND
461#endif 477#endif
462 478
463#ifdef __KERNEL_SYSCALLS__ 479#ifdef __KERNEL_SYSCALLS__
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
index 11f5aa5d108c..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({ \
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/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/oplib.h b/include/asm-sparc64/oplib.h
index d02f1e8ae1a6..3c59b2693fb9 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -163,6 +163,7 @@ enum prom_input_device {
163 PROMDEV_IKBD, /* input from keyboard */ 163 PROMDEV_IKBD, /* input from keyboard */
164 PROMDEV_ITTYA, /* input from ttya */ 164 PROMDEV_ITTYA, /* input from ttya */
165 PROMDEV_ITTYB, /* input from ttyb */ 165 PROMDEV_ITTYB, /* input from ttyb */
166 PROMDEV_IRSC, /* input from rsc */
166 PROMDEV_I_UNK, 167 PROMDEV_I_UNK,
167}; 168};
168 169
@@ -174,6 +175,7 @@ enum prom_output_device {
174 PROMDEV_OSCREEN, /* to screen */ 175 PROMDEV_OSCREEN, /* to screen */
175 PROMDEV_OTTYA, /* to ttya */ 176 PROMDEV_OTTYA, /* to ttya */
176 PROMDEV_OTTYB, /* to ttyb */ 177 PROMDEV_OTTYB, /* to ttyb */
178 PROMDEV_ORSC, /* to rsc */
177 PROMDEV_O_UNK, 179 PROMDEV_O_UNK,
178}; 180};
179 181
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-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h
index c94d8b3991bd..ac9d068aab4f 100644
--- a/include/asm-sparc64/thread_info.h
+++ b/include/asm-sparc64/thread_info.h
@@ -221,7 +221,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
221 * nop 221 * nop
222 */ 222 */
223#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 223#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
224#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ 224#define TIF_RESTORE_SIGMASK 1 /* restore signal mask in do_signal() */
225#define TIF_SIGPENDING 2 /* signal pending */ 225#define TIF_SIGPENDING 2 /* signal pending */
226#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 226#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
227#define TIF_PERFCTR 4 /* performance counters active */ 227#define TIF_PERFCTR 4 /* performance counters active */
@@ -241,7 +241,6 @@ register struct thread_info *current_thread_info_reg asm("g6");
241#define TIF_POLLING_NRFLAG 14 241#define TIF_POLLING_NRFLAG 14
242 242
243#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 243#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
244#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
245#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 244#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
246#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 245#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
247#define _TIF_PERFCTR (1<<TIF_PERFCTR) 246#define _TIF_PERFCTR (1<<TIF_PERFCTR)
@@ -250,11 +249,12 @@ register struct thread_info *current_thread_info_reg asm("g6");
250#define _TIF_32BIT (1<<TIF_32BIT) 249#define _TIF_32BIT (1<<TIF_32BIT)
251#define _TIF_SECCOMP (1<<TIF_SECCOMP) 250#define _TIF_SECCOMP (1<<TIF_SECCOMP)
252#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 251#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
252#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
253#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 253#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
254#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 254#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
255 255
256#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \ 256#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
257 (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ 257 (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK | \
258 _TIF_NEED_RESCHED | _TIF_PERFCTR)) 258 _TIF_NEED_RESCHED | _TIF_PERFCTR))
259 259
260#endif /* __KERNEL__ */ 260#endif /* __KERNEL__ */
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 51ec2879b881..84ac2bdb0902 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -302,11 +302,26 @@
302#define __NR_add_key 281 302#define __NR_add_key 281
303#define __NR_request_key 282 303#define __NR_request_key 282
304#define __NR_keyctl 283 304#define __NR_keyctl 283
305#define __NR_openat 284
306#define __NR_mkdirat 285
307#define __NR_mknodat 286
308#define __NR_fchownat 287
309#define __NR_futimesat 288
310#define __NR_newfstatat 289
311#define __NR_unlinkat 290
312#define __NR_renameat 291
313#define __NR_linkat 292
314#define __NR_symlinkat 293
315#define __NR_readlinkat 294
316#define __NR_fchmodat 295
317#define __NR_faccessat 296
318#define __NR_pselect6 297
319#define __NR_ppoll 298
305 320
306/* WARNING: You MAY NOT add syscall numbers larger than 283, since 321/* WARNING: You MAY NOT add syscall numbers larger than 298, since
307 * all of the syscall tables in the Sparc kernel are 322 * all of the syscall tables in the Sparc kernel are
308 * sized to have 283 entries (starting at zero). Therefore 323 * sized to have 298 entries (starting at zero). Therefore
309 * find a free slot in the 0-282 range. 324 * find a free slot in the 0-298 range.
310 */ 325 */
311 326
312#define _syscall0(type,name) \ 327#define _syscall0(type,name) \
@@ -501,6 +516,8 @@ asmlinkage long sys_rt_sigaction(int sig,
501#define __ARCH_WANT_SYS_OLDUMOUNT 516#define __ARCH_WANT_SYS_OLDUMOUNT
502#define __ARCH_WANT_SYS_SIGPENDING 517#define __ARCH_WANT_SYS_SIGPENDING
503#define __ARCH_WANT_SYS_SIGPROCMASK 518#define __ARCH_WANT_SYS_SIGPROCMASK
519#define __ARCH_WANT_SYS_RT_SIGSUSPEND
520#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
504#endif 521#endif
505 522
506/* 523/*
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/io.h b/include/asm-um/io.h
index 90674056dcef..1934d9340e2c 100644
--- a/include/asm-um/io.h
+++ b/include/asm-um/io.h
@@ -33,4 +33,20 @@ static inline void * phys_to_virt(unsigned long address)
33 */ 33 */
34#define xlate_dev_kmem_ptr(p) p 34#define xlate_dev_kmem_ptr(p) p
35 35
36static inline void writeb(unsigned char b, volatile void __iomem *addr)
37{
38 *(volatile unsigned char __force *) addr = b;
39}
40static inline void writew(unsigned short b, volatile void __iomem *addr)
41{
42 *(volatile unsigned short __force *) addr = b;
43}
44static inline void writel(unsigned int b, volatile void __iomem *addr)
45{
46 *(volatile unsigned int __force *) addr = b;
47}
48#define __raw_writeb writeb
49#define __raw_writew writew
50#define __raw_writel writel
51
36#endif 52#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..17b6b07c4332 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
@@ -72,6 +69,7 @@ static inline struct thread_info *current_thread_info(void)
72#define TIF_RESTART_BLOCK 4 69#define TIF_RESTART_BLOCK 4
73#define TIF_MEMDIE 5 70#define TIF_MEMDIE 5
74#define TIF_SYSCALL_AUDIT 6 71#define TIF_SYSCALL_AUDIT 6
72#define TIF_RESTORE_SIGMASK 7
75 73
76#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 74#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
77#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 75#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
@@ -79,16 +77,6 @@ static inline struct thread_info *current_thread_info(void)
79#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 77#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
80#define _TIF_MEMDIE (1 << TIF_MEMDIE) 78#define _TIF_MEMDIE (1 << TIF_MEMDIE)
81#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 79#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
80#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
82 81
83#endif 82#endif
84
85/*
86 * Overrides for Emacs so that we follow Linus's tabbing style.
87 * Emacs will notice this stuff at the end of the file and automatically
88 * adjust the settings for this buffer only. This must remain at the end
89 * of the file.
90 * ---------------------------------------------------------------------------
91 * Local variables:
92 * c-file-style: "linux"
93 * End:
94 */
diff --git a/include/asm-um/unistd.h b/include/asm-um/unistd.h
index 6fdde45cc053..afccfcaa9ea9 100644
--- a/include/asm-um/unistd.h
+++ b/include/asm-um/unistd.h
@@ -34,6 +34,7 @@ extern int um_execve(const char *file, char *const argv[], char *const env[]);
34#define __ARCH_WANT_SYS_SIGPENDING 34#define __ARCH_WANT_SYS_SIGPENDING
35#define __ARCH_WANT_SYS_SIGPROCMASK 35#define __ARCH_WANT_SYS_SIGPROCMASK
36#define __ARCH_WANT_SYS_RT_SIGACTION 36#define __ARCH_WANT_SYS_RT_SIGACTION
37#define __ARCH_WANT_SYS_RT_SIGSUSPEND
37#endif 38#endif
38 39
39#ifdef __KERNEL_SYSCALLS__ 40#ifdef __KERNEL_SYSCALLS__
diff --git a/include/asm-v850/atomic.h b/include/asm-v850/atomic.h
index f5b9ab6f4e70..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;
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/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/ptrace.h b/include/asm-v850/ptrace.h
index 7bf72bb5078c..4f35cf2cd641 100644
--- a/include/asm-v850/ptrace.h
+++ b/include/asm-v850/ptrace.h
@@ -92,7 +92,7 @@ struct pt_regs
92/* The number of bytes used to store each register. */ 92/* The number of bytes used to store each register. */
93#define _PT_REG_SIZE 4 93#define _PT_REG_SIZE 4
94 94
95/* Offset of a general purpose register in a stuct pt_regs. */ 95/* Offset of a general purpose register in a struct pt_regs. */
96#define PT_GPR(num) ((num) * _PT_REG_SIZE) 96#define PT_GPR(num) ((num) * _PT_REG_SIZE)
97 97
98/* Offsets of various special registers & fields in a struct pt_regs. */ 98/* Offsets of various special registers & fields in a struct pt_regs. */
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 72eb071488c7..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
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index a4d5d0909453..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}
@@ -397,6 +397,22 @@ static __inline__ int fls64(__u64 x)
397} 397}
398 398
399/** 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/**
400 * hweightN - returns the hamming weight of a N-bit word 416 * hweightN - returns the hamming weight of a N-bit word
401 * @x: the word to weigh 417 * @x: the word to weigh
402 * 418 *
@@ -434,9 +450,6 @@ static __inline__ int fls64(__u64 x)
434#define minix_find_first_zero_bit(addr,size) \ 450#define minix_find_first_zero_bit(addr,size) \
435 find_first_zero_bit((void*)addr,size) 451 find_first_zero_bit((void*)addr,size)
436 452
437/* find last set bit */
438#define fls(x) generic_fls(x)
439
440#endif /* __KERNEL__ */ 453#endif /* __KERNEL__ */
441 454
442#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/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/edac.h b/include/asm-x86_64/edac.h
new file mode 100644
index 000000000000..cad1cd42b4ee
--- /dev/null
+++ b/include/asm-x86_64/edac.h
@@ -0,0 +1,18 @@
1#ifndef ASM_EDAC_H
2#define ASM_EDAC_H
3
4/* ECC atomic, DMA, SMP and interrupt safe scrub function */
5
6static __inline__ void atomic_scrub(void *va, u32 size)
7{
8 unsigned int *virt_addr = va;
9 u32 i;
10
11 for (i = 0; i < size / 4; i++, virt_addr++)
12 /* Very carefully read and write to memory atomically
13 * so we are interrupt, DMA and SMP safe.
14 */
15 __asm__ __volatile__("lock; addl $0, %0"::"m"(*virt_addr));
16}
17
18#endif
diff --git a/include/asm-x86_64/fixmap.h b/include/asm-x86_64/fixmap.h
index a582cfcf2231..7b286bd21d1d 100644
--- a/include/asm-x86_64/fixmap.h
+++ b/include/asm-x86_64/fixmap.h
@@ -76,7 +76,7 @@ extern void __this_fixmap_does_not_exist(void);
76 * directly without translation, we catch the bug with a NULL-deference 76 * directly without translation, we catch the bug with a NULL-deference
77 * kernel oops. Illegal ranges of incoming indices are caught too. 77 * kernel oops. Illegal ranges of incoming indices are caught too.
78 */ 78 */
79static inline unsigned long fix_to_virt(const unsigned int idx) 79static __always_inline unsigned long fix_to_virt(const unsigned int idx)
80{ 80{
81 /* 81 /*
82 * this branch gets completely eliminated after inlining, 82 * this branch gets completely eliminated after inlining,
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.h b/include/asm-x86_64/ia32.h
index c7bc9c0525ba..e6b7f2234e43 100644
--- a/include/asm-x86_64/ia32.h
+++ b/include/asm-x86_64/ia32.h
@@ -169,6 +169,8 @@ int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs);
169struct linux_binprm; 169struct linux_binprm;
170extern int ia32_setup_arg_pages(struct linux_binprm *bprm, 170extern int ia32_setup_arg_pages(struct linux_binprm *bprm,
171 unsigned long stack_top, int exec_stack); 171 unsigned long stack_top, int exec_stack);
172struct mm_struct;
173extern void ia32_pick_mmap_layout(struct mm_struct *mm);
172 174
173#endif 175#endif
174 176
diff --git a/include/asm-x86_64/ia32_unistd.h b/include/asm-x86_64/ia32_unistd.h
index d5166ec3868d..e87cd83a0e86 100644
--- a/include/asm-x86_64/ia32_unistd.h
+++ b/include/asm-x86_64/ia32_unistd.h
@@ -299,7 +299,21 @@
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
303#define __NR_ia32_opanat 295
304#define __NR_ia32_mkdirat 296
305#define __NR_ia32_mknodat 297
306#define __NR_ia32_fchownat 298
307#define __NR_ia32_futimesat 299
308#define __NR_ia32_newfstatat 300
309#define __NR_ia32_unlinkat 301
310#define __NR_ia32_renameat 302
311#define __NR_ia32_linkat 303
312#define __NR_ia32_symlinkat 304
313#define __NR_ia32_readlinkat 305
314#define __NR_ia32_fchmodat 306
315#define __NR_ia32_faccessat 307
302 316
303#define IA32_NR_syscalls 294 /* must be > than biggest syscall! */ 317#define IA32_NR_syscalls 308 /* must be > than biggest syscall! */
304 318
305#endif /* _ASM_X86_64_IA32_UNISTD_H_ */ 319#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/irq.h b/include/asm-x86_64/irq.h
index fb724ba37ae6..9db5a1b4f7b1 100644
--- a/include/asm-x86_64/irq.h
+++ b/include/asm-x86_64/irq.h
@@ -36,7 +36,7 @@
36#define NR_IRQ_VECTORS NR_IRQS 36#define NR_IRQ_VECTORS NR_IRQS
37#else 37#else
38#define NR_IRQS 224 38#define NR_IRQS 224
39#define NR_IRQ_VECTORS 1024 39#define NR_IRQ_VECTORS (32 * NR_CPUS)
40#endif 40#endif
41 41
42static __inline__ int irq_canonicalize(int irq) 42static __inline__ int irq_canonicalize(int irq)
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/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/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..615e3e494929 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -14,13 +14,25 @@
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
29#define STACKFAULT_STACK 1
30#define DOUBLEFAULT_STACK 2
31#define NMI_STACK 3
32#define DEBUG_STACK 4
33#define MCE_STACK 5
34#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
35
24#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) 36#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
25#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT) 37#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
26 38
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 02888d7a496f..8fbf4dd72115 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -267,25 +267,25 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
267 */ 267 */
268#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) 268#define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
269static 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; }
270extern 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; }
271extern 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; }
272extern 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; }
273extern 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; }
274extern 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; }
275static 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; }
276static 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; }
277 277
278extern 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; }
279extern 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; }
280extern 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; }
281extern 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; }
282extern 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; }
283extern 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; }
284extern 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; }
285extern 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; }
286extern 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; }
287extern 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; }
288extern 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; }
289 289
290struct vm_area_struct; 290struct vm_area_struct;
291 291
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 4861246548f7..8c8d88c036ed 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;
@@ -267,15 +273,6 @@ struct thread_struct {
267#define INIT_MMAP \ 273#define INIT_MMAP \
268{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL } 274{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
269 275
270#define STACKFAULT_STACK 1
271#define DOUBLEFAULT_STACK 2
272#define NMI_STACK 3
273#define DEBUG_STACK 4
274#define MCE_STACK 5
275#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
276#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
277#define EXCEPTION_STACK_ORDER 0
278
279#define start_thread(regs,new_rip,new_rsp) do { \ 276#define start_thread(regs,new_rip,new_rsp) do { \
280 asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \ 277 asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0)); \
281 load_gs_index(0); \ 278 load_gs_index(0); \
@@ -317,8 +314,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)) 314#define thread_saved_pc(t) (*(unsigned long *)((t)->thread.rsp - 8))
318 315
319extern unsigned long get_wchan(struct task_struct *p); 316extern unsigned long get_wchan(struct task_struct *p);
320#define KSTK_EIP(tsk) \ 317#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.rsp0 - 1)
321 (((struct pt_regs *)(tsk->thread.rsp0 - sizeof(struct pt_regs)))->rip) 318#define KSTK_EIP(tsk) (task_pt_regs(tsk)->rip)
322#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */ 319#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */
323 320
324 321
@@ -480,4 +477,6 @@ extern unsigned long boot_option_idle_override;
480/* Boot loader type from the setup header */ 477/* Boot loader type from the setup header */
481extern int bootloader_type; 478extern int bootloader_type;
482 479
480#define HAVE_ARCH_PICK_MMAP_LAYOUT 1
481
483#endif /* __ASM_X86_64_PROCESSOR_H */ 482#endif /* __ASM_X86_64_PROCESSOR_H */
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 b34cc2ee222b..a73f0c789d8b 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,12 +335,24 @@ 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")
316/* used in the idle loop; sti takes one instruction cycle to complete */
317#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")
318/* used when interrupts are already enabled or to shutdown the processor */
319#define halt() __asm__ __volatile__("hlt": : :"memory")
320 356
321#define irqs_disabled() \ 357#define irqs_disabled() \
322({ \ 358({ \
@@ -327,15 +363,14 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
327 363
328/* For spinlocks etc */ 364/* For spinlocks etc */
329#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) 365#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)
366#endif
330 367
331void cpu_idle_wait(void); 368/* used in the idle loop; sti takes one instruction cycle to complete */
369#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")
370/* used when interrupts are already enabled or to shutdown the processor */
371#define halt() __asm__ __volatile__("hlt": : :"memory")
332 372
333/* 373void cpu_idle_wait(void);
334 * disable hlt during certain critical i/o operations
335 */
336#define HAVE_DISABLE_HLT
337void disable_hlt(void);
338void enable_hlt(void);
339 374
340extern unsigned long arch_align_stack(unsigned long sp); 375extern unsigned long arch_align_stack(unsigned long sp);
341 376
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..bddffcb591b8 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -244,7 +244,7 @@ extern unsigned long copy_to_user(void __user *to, const void *from, unsigned le
244extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); 244extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len);
245extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); 245extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len);
246 246
247static inline int __copy_from_user(void *dst, const void __user *src, unsigned size) 247static __always_inline int __copy_from_user(void *dst, const void __user *src, unsigned size)
248{ 248{
249 int ret = 0; 249 int ret = 0;
250 if (!__builtin_constant_p(size)) 250 if (!__builtin_constant_p(size))
@@ -273,7 +273,7 @@ static inline int __copy_from_user(void *dst, const void __user *src, unsigned s
273 } 273 }
274} 274}
275 275
276static inline int __copy_to_user(void __user *dst, const void *src, unsigned size) 276static __always_inline int __copy_to_user(void __user *dst, const void *src, unsigned size)
277{ 277{
278 int ret = 0; 278 int ret = 0;
279 if (!__builtin_constant_p(size)) 279 if (!__builtin_constant_p(size))
@@ -305,7 +305,7 @@ static inline int __copy_to_user(void __user *dst, const void *src, unsigned siz
305} 305}
306 306
307 307
308static inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) 308static __always_inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
309{ 309{
310 int ret = 0; 310 int ret = 0;
311 if (!__builtin_constant_p(size)) 311 if (!__builtin_constant_p(size))
@@ -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..436d099b5b6b 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -571,8 +571,37 @@ __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)
576#define __NR_openat 257
577__SYSCALL(__NR_openat, sys_openat)
578#define __NR_mkdirat 258
579__SYSCALL(__NR_mkdirat, sys_mkdirat)
580#define __NR_mknodat 259
581__SYSCALL(__NR_mknodat, sys_mknodat)
582#define __NR_fchownat 260
583__SYSCALL(__NR_fchownat, sys_fchownat)
584#define __NR_futimesat 261
585__SYSCALL(__NR_futimesat, sys_futimesat)
586#define __NR_newfstatat 262
587__SYSCALL(__NR_newfstatat, sys_newfstatat)
588#define __NR_unlinkat 263
589__SYSCALL(__NR_unlinkat, sys_unlinkat)
590#define __NR_renameat 264
591__SYSCALL(__NR_renameat, sys_renameat)
592#define __NR_linkat 265
593__SYSCALL(__NR_linkat, sys_linkat)
594#define __NR_symlinkat 266
595__SYSCALL(__NR_symlinkat, sys_symlinkat)
596#define __NR_readlinkat 267
597__SYSCALL(__NR_readlinkat, sys_readlinkat)
598#define __NR_fchmodat 268
599__SYSCALL(__NR_fchmodat, sys_fchmodat)
600#define __NR_faccessat 269
601__SYSCALL(__NR_faccessat, sys_faccessat)
602
603#define __NR_syscall_max __NR_faccessat
574 604
575#define __NR_syscall_max __NR_inotify_rm_watch
576#ifndef __NO_STUBS 605#ifndef __NO_STUBS
577 606
578/* user-visible error numbers are in the range -1 - -4095 */ 607/* 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 e2ce06b101ad..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
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/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/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/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/auxvec.h b/include/linux/auxvec.h
index 9a7b374c9fb4..d2bc0d66e65d 100644
--- a/include/linux/auxvec.h
+++ b/include/linux/auxvec.h
@@ -26,6 +26,6 @@
26 26
27#define AT_SECURE 23 /* secure mode boolean */ 27#define AT_SECURE 23 /* secure mode boolean */
28 28
29#define AT_VECTOR_SIZE 42 /* Size of auxiliary table. */ 29#define AT_VECTOR_SIZE 44 /* Size of auxiliary table. */
30 30
31#endif /* _LINUX_AUXVEC_H */ 31#endif /* _LINUX_AUXVEC_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index fb0985377421..02a585faa62c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -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
@@ -291,6 +292,7 @@ typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *);
291typedef void (activity_fn) (void *data, int rw); 292typedef void (activity_fn) (void *data, int rw);
292typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *); 293typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *);
293typedef void (prepare_flush_fn) (request_queue_t *, struct request *); 294typedef void (prepare_flush_fn) (request_queue_t *, struct request *);
295typedef void (softirq_done_fn)(struct request *);
294 296
295enum blk_queue_state { 297enum blk_queue_state {
296 Queue_down, 298 Queue_down,
@@ -332,6 +334,7 @@ struct request_queue
332 activity_fn *activity_fn; 334 activity_fn *activity_fn;
333 issue_flush_fn *issue_flush_fn; 335 issue_flush_fn *issue_flush_fn;
334 prepare_flush_fn *prepare_flush_fn; 336 prepare_flush_fn *prepare_flush_fn;
337 softirq_done_fn *softirq_done_fn;
335 338
336 /* 339 /*
337 * Dispatch queue sorting 340 * Dispatch queue sorting
@@ -592,7 +595,6 @@ extern void generic_make_request(struct bio *bio);
592extern void blk_put_request(struct request *); 595extern void blk_put_request(struct request *);
593extern void __blk_put_request(request_queue_t *, struct request *); 596extern void __blk_put_request(request_queue_t *, struct request *);
594extern void blk_end_sync_rq(struct request *rq, int error); 597extern void blk_end_sync_rq(struct request *rq, int error);
595extern void blk_attempt_remerge(request_queue_t *, struct request *);
596extern struct request *blk_get_request(request_queue_t *, int, gfp_t); 598extern struct request *blk_get_request(request_queue_t *, int, gfp_t);
597extern void blk_insert_request(request_queue_t *, struct request *, int, void *); 599extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
598extern void blk_requeue_request(request_queue_t *, struct request *); 600extern void blk_requeue_request(request_queue_t *, struct request *);
@@ -646,6 +648,17 @@ extern int end_that_request_first(struct request *, int, int);
646extern int end_that_request_chunk(struct request *, int, int); 648extern int end_that_request_chunk(struct request *, int, int);
647extern void end_that_request_last(struct request *, int); 649extern void end_that_request_last(struct request *, int);
648extern 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}
649 662
650/* 663/*
651 * end_that_request_first/chunk() takes an uptodate argument. we account 664 * end_that_request_first/chunk() takes an uptodate argument. we account
@@ -694,6 +707,7 @@ extern void blk_queue_segment_boundary(request_queue_t *, unsigned long);
694extern 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);
695extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *); 708extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *);
696extern 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 *);
697extern 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);
698extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *); 712extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *);
699extern 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 *);
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..1698b845761f 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -3,30 +3,14 @@
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
32 15
16#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 53686c037a06..6f5cc6f0e7a6 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -3,14 +3,16 @@
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)) 6#ifdef CONFIG_FORCED_INLINING
7#define __inline__ __inline__ __attribute__((always_inline)) 7# undef inline
8#define __inline __inline __attribute__((always_inline)) 8# undef __inline__
9#define __deprecated __attribute__((deprecated)) 9# undef __inline
10# define inline inline __attribute__((always_inline))
11# define __inline__ __inline__ __attribute__((always_inline))
12# define __inline __inline __attribute__((always_inline))
13#endif
14
10#define __attribute_used__ __attribute__((__used__)) 15#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)) 16#define __must_check __attribute__((warn_unused_result))
15#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 17#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
16 18#define __always_inline inline __attribute__((always_inline))
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/cpuset.h b/include/linux/cpuset.h
index 6e2deef96b34..3bc606927116 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -14,22 +14,46 @@
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
51extern void cpuset_lock(void);
52extern void cpuset_unlock(void);
53
31#else /* !CONFIG_CPUSETS */ 54#else /* !CONFIG_CPUSETS */
32 55
56static inline int cpuset_init_early(void) { return 0; }
33static inline int cpuset_init(void) { return 0; } 57static inline int cpuset_init(void) { return 0; }
34static inline void cpuset_init_smp(void) {} 58static inline void cpuset_init_smp(void) {}
35static inline void cpuset_fork(struct task_struct *p) {} 59static inline void cpuset_fork(struct task_struct *p) {}
@@ -40,9 +64,14 @@ static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p)
40 return cpu_possible_map; 64 return cpu_possible_map;
41} 65}
42 66
67static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
68{
69 return node_possible_map;
70}
71
43static inline void cpuset_init_current_mems_allowed(void) {} 72static inline void cpuset_init_current_mems_allowed(void) {}
44static inline void cpuset_update_current_mems_allowed(void) {} 73static inline void cpuset_update_task_memory_state(void) {}
45static inline void cpuset_restrict_to_mems_allowed(unsigned long *nodes) {} 74#define cpuset_nodes_subset_current_mems_allowed(nodes) (1)
46 75
47static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) 76static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
48{ 77{
@@ -59,12 +88,17 @@ static inline int cpuset_excl_nodes_overlap(const struct task_struct *p)
59 return 1; 88 return 1;
60} 89}
61 90
91static inline void cpuset_memory_pressure_bump(void) {}
92
62static inline char *cpuset_task_status_allowed(struct task_struct *task, 93static inline char *cpuset_task_status_allowed(struct task_struct *task,
63 char *buffer) 94 char *buffer)
64{ 95{
65 return buffer; 96 return buffer;
66} 97}
67 98
99static inline void cpuset_lock(void) {}
100static inline void cpuset_unlock(void) {}
101
68#endif /* !CONFIG_CPUSETS */ 102#endif /* !CONFIG_CPUSETS */
69 103
70#endif /* _LINUX_CPUSET_H */ 104#endif /* _LINUX_CPUSET_H */
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/device.h b/include/linux/device.h
index 0cdee78e5ce1..58df18d9cd3e 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -49,6 +49,9 @@ struct bus_type {
49 int (*match)(struct device * dev, struct device_driver * drv); 49 int (*match)(struct device * dev, struct device_driver * drv);
50 int (*uevent)(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 (*probe)(struct device * dev);
53 int (*remove)(struct device * dev);
54 void (*shutdown)(struct device * dev);
52 int (*suspend)(struct device * dev, pm_message_t state); 55 int (*suspend)(struct device * dev, pm_message_t state);
53 int (*resume)(struct device * dev); 56 int (*resume)(struct device * dev);
54}; 57};
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 fb80fa44c4dd..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
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/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/fb.h b/include/linux/fb.h
index a973be2cfe61..2cb19e6503aa 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -608,15 +608,15 @@ struct fb_ops {
608 int (*fb_sync)(struct fb_info *info); 608 int (*fb_sync)(struct fb_info *info);
609 609
610 /* perform fb specific ioctl (optional) */ 610 /* perform fb specific ioctl (optional) */
611 int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd, 611 int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,
612 unsigned long arg, struct fb_info *info); 612 unsigned long arg);
613 613
614 /* Handle 32bit compat ioctl (optional) */ 614 /* Handle 32bit compat ioctl (optional) */
615 long (*fb_compat_ioctl)(struct file *f, unsigned cmd, unsigned long arg, 615 int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd,
616 struct fb_info *info); 616 unsigned long arg);
617 617
618 /* perform fb specific mmap */ 618 /* perform fb specific mmap */
619 int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma); 619 int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);
620 620
621 /* save current hardware state */ 621 /* save current hardware state */
622 void (*fb_save_state)(struct fb_info *info); 622 void (*fb_save_state)(struct fb_info *info);
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 8a7c82151de9..c52a63755fdd 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -23,6 +23,13 @@
23#define DN_ATTRIB 0x00000020 /* File changed attibutes */ 23#define DN_ATTRIB 0x00000020 /* File changed attibutes */
24#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */ 24#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
25 25
26#define AT_FDCWD -100 /* Special value used to indicate
27 openat should use the current
28 working directory. */
29#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
30#define AT_REMOVEDIR 0x200 /* Remove directory instead of
31 unlinking file. */
32
26#ifdef __KERNEL__ 33#ifdef __KERNEL__
27 34
28#ifndef force_o_largefile 35#ifndef force_o_largefile
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2c9c48d65630..84bb449b9b01 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);
@@ -484,7 +479,7 @@ struct inode {
484 unsigned long i_blocks; 479 unsigned long i_blocks;
485 unsigned short i_bytes; 480 unsigned short i_bytes;
486 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 481 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
487 struct semaphore i_sem; 482 struct mutex i_mutex;
488 struct rw_semaphore i_alloc_sem; 483 struct rw_semaphore i_alloc_sem;
489 struct inode_operations *i_op; 484 struct inode_operations *i_op;
490 struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 485 struct file_operations *i_fop; /* former ->i_op->default_file_ops */
@@ -653,7 +648,7 @@ extern spinlock_t files_lock;
653#define file_list_lock() spin_lock(&files_lock); 648#define file_list_lock() spin_lock(&files_lock);
654#define file_list_unlock() spin_unlock(&files_lock); 649#define file_list_unlock() spin_unlock(&files_lock);
655 650
656#define get_file(x) rcuref_inc(&(x)->f_count) 651#define get_file(x) atomic_inc(&(x)->f_count)
657#define file_count(x) atomic_read(&(x)->f_count) 652#define file_count(x) atomic_read(&(x)->f_count)
658 653
659#define MAX_NON_LFS ((1UL<<31) - 1) 654#define MAX_NON_LFS ((1UL<<31) - 1)
@@ -808,7 +803,6 @@ struct super_block {
808 struct list_head s_list; /* Keep this first */ 803 struct list_head s_list; /* Keep this first */
809 dev_t s_dev; /* search index; _not_ kdev_t */ 804 dev_t s_dev; /* search index; _not_ kdev_t */
810 unsigned long s_blocksize; 805 unsigned long s_blocksize;
811 unsigned long s_old_blocksize;
812 unsigned char s_blocksize_bits; 806 unsigned char s_blocksize_bits;
813 unsigned char s_dirt; 807 unsigned char s_dirt;
814 unsigned long long s_maxbytes; /* Max file size */ 808 unsigned long long s_maxbytes; /* Max file size */
@@ -821,7 +815,7 @@ struct super_block {
821 unsigned long s_magic; 815 unsigned long s_magic;
822 struct dentry *s_root; 816 struct dentry *s_root;
823 struct rw_semaphore s_umount; 817 struct rw_semaphore s_umount;
824 struct semaphore s_lock; 818 struct mutex s_lock;
825 int s_count; 819 int s_count;
826 int s_syncing; 820 int s_syncing;
827 int s_need_sync_fs; 821 int s_need_sync_fs;
@@ -893,13 +887,13 @@ static inline int has_fs_excl(void)
893static inline void lock_super(struct super_block * sb) 887static inline void lock_super(struct super_block * sb)
894{ 888{
895 get_fs_excl(); 889 get_fs_excl();
896 down(&sb->s_lock); 890 mutex_lock(&sb->s_lock);
897} 891}
898 892
899static inline void unlock_super(struct super_block * sb) 893static inline void unlock_super(struct super_block * sb)
900{ 894{
901 put_fs_excl(); 895 put_fs_excl();
902 up(&sb->s_lock); 896 mutex_unlock(&sb->s_lock);
903} 897}
904 898
905/* 899/*
@@ -963,6 +957,7 @@ struct block_device_operations {
963 int (*direct_access) (struct block_device *, sector_t, unsigned long *); 957 int (*direct_access) (struct block_device *, sector_t, unsigned long *);
964 int (*media_changed) (struct gendisk *); 958 int (*media_changed) (struct gendisk *);
965 int (*revalidate_disk) (struct gendisk *); 959 int (*revalidate_disk) (struct gendisk *);
960 int (*getgeo)(struct block_device *, struct hd_geometry *);
966 struct module *owner; 961 struct module *owner;
967}; 962};
968 963
@@ -1117,12 +1112,7 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1117 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1112 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1118} 1113}
1119 1114
1120static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry) 1115extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1121{
1122 /* per-mountpoint checks will go here */
1123 update_atime(dentry->d_inode);
1124}
1125
1126static inline void file_accessed(struct file *file) 1116static inline void file_accessed(struct file *file)
1127{ 1117{
1128 if (!(file->f_flags & O_NOATIME)) 1118 if (!(file->f_flags & O_NOATIME))
@@ -1191,7 +1181,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc);
1191 * directory. The name should be stored in the @name (with the 1181 * directory. The name should be stored in the @name (with the
1192 * 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
1193 * 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
1194 * 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.
1195 * 1185 *
1196 * get_parent: 1186 * get_parent:
1197 * @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
@@ -1213,7 +1203,7 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc);
1213 * nfsd_find_fh_dentry() in either the @obj or @parent parameters. 1203 * nfsd_find_fh_dentry() in either the @obj or @parent parameters.
1214 * 1204 *
1215 * Locking rules: 1205 * Locking rules:
1216 * get_parent is called with child->d_inode->i_sem down 1206 * get_parent is called with child->d_inode->i_mutex down
1217 * get_name is not (which is possibly inconsistent) 1207 * get_name is not (which is possibly inconsistent)
1218 */ 1208 */
1219 1209
@@ -1300,6 +1290,9 @@ extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
1300 1290
1301extern int vfs_statfs(struct super_block *, struct kstatfs *); 1291extern int vfs_statfs(struct super_block *, struct kstatfs *);
1302 1292
1293/* /sys/fs */
1294extern struct subsystem fs_subsys;
1295
1303#define FLOCK_VERIFY_READ 1 1296#define FLOCK_VERIFY_READ 1
1304#define FLOCK_VERIFY_WRITE 2 1297#define FLOCK_VERIFY_WRITE 2
1305 1298
@@ -1345,8 +1338,10 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1345 1338
1346/* fs/open.c */ 1339/* fs/open.c */
1347 1340
1348extern int do_truncate(struct dentry *, loff_t start, struct file *filp); 1341extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
1349extern long do_sys_open(const char __user *filename, int flags, int mode); 1342 struct file *filp);
1343extern long do_sys_open(int fdf, const char __user *filename, int flags,
1344 int mode);
1350extern struct file *filp_open(const char *, int, int); 1345extern struct file *filp_open(const char *, int, int);
1351extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); 1346extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
1352extern int filp_close(struct file *, fl_owner_t id); 1347extern int filp_close(struct file *, fl_owner_t id);
@@ -1392,6 +1387,12 @@ extern int register_chrdev(unsigned int, const char *,
1392extern int unregister_chrdev(unsigned int, const char *); 1387extern int unregister_chrdev(unsigned int, const char *);
1393extern void unregister_chrdev_region(dev_t, unsigned); 1388extern void unregister_chrdev_region(dev_t, unsigned);
1394extern int chrdev_open(struct inode *, struct file *); 1389extern int chrdev_open(struct inode *, struct file *);
1390extern int get_chrdev_list(char *);
1391extern void *acquire_chrdev_list(void);
1392extern int count_chrdev_list(void);
1393extern void *get_next_chrdev(void *);
1394extern int get_chrdev_info(void *, int *, char **);
1395extern void release_chrdev_list(void *);
1395 1396
1396/* fs/block_dev.c */ 1397/* fs/block_dev.c */
1397#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 1398#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
@@ -1400,6 +1401,11 @@ extern const char *bdevname(struct block_device *bdev, char *buffer);
1400extern struct block_device *lookup_bdev(const char *); 1401extern struct block_device *lookup_bdev(const char *);
1401extern struct block_device *open_bdev_excl(const char *, int, void *); 1402extern struct block_device *open_bdev_excl(const char *, int, void *);
1402extern void close_bdev_excl(struct block_device *); 1403extern void close_bdev_excl(struct block_device *);
1404extern void *acquire_blkdev_list(void);
1405extern int count_blkdev_list(void);
1406extern void *get_next_blkdev(void *);
1407extern int get_blkdev_info(void *, int *, char **);
1408extern void release_blkdev_list(void *);
1403 1409
1404extern void init_special_inode(struct inode *, umode_t, dev_t); 1410extern void init_special_inode(struct inode *, umode_t, dev_t);
1405 1411
@@ -1474,7 +1480,7 @@ static inline void allow_write_access(struct file *file)
1474} 1480}
1475extern int do_pipe(int *); 1481extern int do_pipe(int *);
1476 1482
1477extern int open_namei(const char *, int, int, struct nameidata *); 1483extern int open_namei(int dfd, const char *, int, int, struct nameidata *);
1478extern int may_open(struct nameidata *, int, int); 1484extern int may_open(struct nameidata *, int, int);
1479 1485
1480extern int kernel_read(struct file *, unsigned long, char *, unsigned long); 1486extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
@@ -1672,6 +1678,8 @@ extern int vfs_readdir(struct file *, filldir_t, void *);
1672 1678
1673extern int vfs_stat(char __user *, struct kstat *); 1679extern int vfs_stat(char __user *, struct kstat *);
1674extern int vfs_lstat(char __user *, struct kstat *); 1680extern int vfs_lstat(char __user *, struct kstat *);
1681extern int vfs_stat_fd(int dfd, char __user *, struct kstat *);
1682extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *);
1675extern int vfs_fstat(unsigned int, struct kstat *); 1683extern int vfs_fstat(unsigned int, struct kstat *);
1676 1684
1677extern int vfs_ioctl(struct file *, unsigned int, unsigned int, unsigned long); 1685extern int vfs_ioctl(struct file *, unsigned int, unsigned int, unsigned long);
@@ -1714,7 +1722,7 @@ extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const vo
1714extern int inode_change_ok(struct inode *, struct iattr *); 1722extern int inode_change_ok(struct inode *, struct iattr *);
1715extern int __must_check inode_setattr(struct inode *, struct iattr *); 1723extern int __must_check inode_setattr(struct inode *, struct iattr *);
1716 1724
1717extern void inode_update_time(struct inode *inode, int ctime_too); 1725extern void file_update_time(struct file *file);
1718 1726
1719static inline ino_t parent_ino(struct dentry *dentry) 1727static inline ino_t parent_ino(struct dentry *dentry)
1720{ 1728{
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 934aa9bda481..a9f1cfd096ff 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -50,14 +50,12 @@ struct gianfar_platform_data {
50 50
51 /* board specific information */ 51 /* board specific information */
52 u32 board_flags; 52 u32 board_flags;
53 const char *bus_id; 53 u32 bus_id;
54 u32 phy_id;
54 u8 mac_addr[6]; 55 u8 mac_addr[6];
55}; 56};
56 57
57struct gianfar_mdio_data { 58struct gianfar_mdio_data {
58 /* device specific information */
59 u32 paddr;
60
61 /* board specific information */ 59 /* board specific information */
62 int irq[32]; 60 int irq[32];
63}; 61};
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/hardirq.h b/include/linux/hardirq.h
index 71d2b8a723b9..eab537091f2a 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -93,10 +93,6 @@ extern void synchronize_irq(unsigned int irq);
93struct task_struct; 93struct task_struct;
94 94
95#ifndef CONFIG_VIRT_CPU_ACCOUNTING 95#ifndef CONFIG_VIRT_CPU_ACCOUNTING
96static inline void account_user_vtime(struct task_struct *tsk)
97{
98}
99
100static inline void account_system_vtime(struct task_struct *tsk) 96static inline void account_system_vtime(struct task_struct *tsk)
101{ 97{
102} 98}
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/i2c-id.h b/include/linux/i2c-id.h
index fb46f8d56999..474c8f4f5d4f 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -103,6 +103,11 @@
103#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ 103#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
104#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ 104#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */
105#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ 105#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
106#define I2C_DRIVERID_TVP5150 76 /* TVP5150 video decoder */
107#define I2C_DRIVERID_WM8739 77 /* wm8739 audio processor */
108#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */
109#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */
110#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */
106 111
107#define I2C_DRIVERID_I2CDEV 900 112#define I2C_DRIVERID_I2CDEV 900
108#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 113#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 7b6a6a58e465..110b3cfac021 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
@@ -982,8 +983,13 @@ typedef struct ide_driver_s {
982 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); 983 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
983 ide_proc_entry_t *proc; 984 ide_proc_entry_t *proc;
984 struct device_driver gen_driver; 985 struct device_driver gen_driver;
986 int (*probe)(ide_drive_t *);
987 void (*remove)(ide_drive_t *);
988 void (*shutdown)(ide_drive_t *);
985} ide_driver_t; 989} ide_driver_t;
986 990
991#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
992
987int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 993int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long);
988 994
989/* 995/*
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index fe26d431de87..7a92c1ce1457 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -72,6 +72,7 @@
72 * over Ethernet 72 * over Ethernet
73 */ 73 */
74#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 74#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
75#define ETH_P_TIPC 0x88CA /* TIPC */
75 76
76/* 77/*
77 * Non DIX types. Won't clash for 1500 types. 78 * Non DIX types. Won't clash for 1500 types.
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/init.h b/include/linux/init.h
index 59008c3826cf..ff8d8b8632f4 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -241,6 +241,18 @@ void __init parse_early_param(void);
241#define __cpuexitdata __exitdata 241#define __cpuexitdata __exitdata
242#endif 242#endif
243 243
244#ifdef CONFIG_MEMORY_HOTPLUG
245#define __meminit
246#define __meminitdata
247#define __memexit
248#define __memexitdata
249#else
250#define __meminit __init
251#define __meminitdata __initdata
252#define __memexit __exit
253#define __memexitdata __exitdata
254#endif
255
244/* Functions marked as __devexit may be discarded at kernel link time, depending 256/* Functions marked as __devexit may be discarded at kernel link time, depending
245 on config options. Newer versions of binutils detect references from 257 on config options. Newer versions of binutils detect references from
246 retained sections to discarded sections and flag an error. Pointers to 258 retained sections to discarded sections and flag an error. Pointers to
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/ioc3.h b/include/linux/ioc3.h
new file mode 100644
index 000000000000..e7906a72a4f1
--- /dev/null
+++ b/include/linux/ioc3.h
@@ -0,0 +1,93 @@
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) 2005 Stanislaw Skowronek <skylark@linux-mips.org>
7 */
8
9#ifndef _LINUX_IOC3_H
10#define _LINUX_IOC3_H
11
12#include <asm/sn/ioc3.h>
13
14#define IOC3_MAX_SUBMODULES 32
15
16#define IOC3_CLASS_NONE 0
17#define IOC3_CLASS_BASE_IP27 1
18#define IOC3_CLASS_BASE_IP30 2
19#define IOC3_CLASS_MENET_123 3
20#define IOC3_CLASS_MENET_4 4
21#define IOC3_CLASS_CADDUO 5
22#define IOC3_CLASS_SERIAL 6
23
24/* One of these per IOC3 */
25struct ioc3_driver_data {
26 struct list_head list;
27 int id; /* IOC3 sequence number */
28 /* PCI mapping */
29 unsigned long pma; /* physical address */
30 struct __iomem ioc3 *vma; /* pointer to registers */
31 struct pci_dev *pdev; /* PCI device */
32 /* IRQ stuff */
33 int dual_irq; /* set if separate IRQs are used */
34 int irq_io, irq_eth; /* IRQ numbers */
35 /* GPIO magic */
36 spinlock_t gpio_lock;
37 unsigned int gpdr_shadow;
38 /* NIC identifiers */
39 char nic_part[32];
40 char nic_serial[16];
41 char nic_mac[6];
42 /* submodule set */
43 int class;
44 void *data[IOC3_MAX_SUBMODULES]; /* for submodule use */
45 int active[IOC3_MAX_SUBMODULES]; /* set if probe succeeds */
46 /* is_ir_lock must be held while
47 * modifying sio_ie values, so
48 * we can be sure that sio_ie is
49 * not changing when we read it
50 * along with sio_ir.
51 */
52 spinlock_t ir_lock; /* SIO_IE[SC] mod lock */
53};
54
55/* One per submodule */
56struct ioc3_submodule {
57 char *name; /* descriptive submodule name */
58 struct module *owner; /* owning kernel module */
59 int ethernet; /* set for ethernet drivers */
60 int (*probe) (struct ioc3_submodule *, struct ioc3_driver_data *);
61 int (*remove) (struct ioc3_submodule *, struct ioc3_driver_data *);
62 int id; /* assigned by IOC3, index for the "data" array */
63 /* IRQ stuff */
64 unsigned int irq_mask; /* IOC3 IRQ mask, leave clear for Ethernet */
65 int reset_mask; /* non-zero if you want the ioc3.c module to reset interrupts */
66 int (*intr) (struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int, struct pt_regs *);
67 /* private submodule data */
68 void *data; /* assigned by submodule */
69};
70
71/**********************************
72 * Functions needed by submodules *
73 **********************************/
74
75#define IOC3_W_IES 0
76#define IOC3_W_IEC 1
77
78/* registers a submodule for all existing and future IOC3 chips */
79extern int ioc3_register_submodule(struct ioc3_submodule *);
80/* unregisters a submodule */
81extern void ioc3_unregister_submodule(struct ioc3_submodule *);
82/* enables IRQs indicated by irq_mask for a specified IOC3 chip */
83extern void ioc3_enable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
84/* ackowledges specified IRQs */
85extern void ioc3_ack(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
86/* disables IRQs indicated by irq_mask for a specified IOC3 chip */
87extern void ioc3_disable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
88/* atomically sets GPCR bits */
89extern void ioc3_gpcr_set(struct ioc3_driver_data *, unsigned int);
90/* general ireg writer */
91extern void ioc3_write_ireg(struct ioc3_driver_data *idd, uint32_t value, int reg);
92
93#endif
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 93bbed5c6cf4..9c8f4c9ed429 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -191,6 +191,10 @@ struct inet6_skb_parm {
191 __u16 srcrt; 191 __u16 srcrt;
192 __u16 dst1; 192 __u16 dst1;
193 __u16 lastopt; 193 __u16 lastopt;
194 __u32 nhoff;
195 __u16 flags;
196
197#define IP6SKB_XFRM_TRANSFORMED 1
194}; 198};
195 199
196#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 200#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
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/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..b49affa0ac5a 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)));
@@ -181,6 +185,7 @@ extern enum system_states {
181 SYSTEM_HALT, 185 SYSTEM_HALT,
182 SYSTEM_POWER_OFF, 186 SYSTEM_POWER_OFF,
183 SYSTEM_RESTART, 187 SYSTEM_RESTART,
188 SYSTEM_SUSPEND_DISK,
184} system_state; 189} system_state;
185 190
186#define TAINT_PROPRIETARY_MODULE (1<<0) 191#define TAINT_PROPRIETARY_MODULE (1<<0)
@@ -212,6 +217,7 @@ extern void dump_stack(void);
212 ((unsigned char *)&addr)[1], \ 217 ((unsigned char *)&addr)[1], \
213 ((unsigned char *)&addr)[2], \ 218 ((unsigned char *)&addr)[2], \
214 ((unsigned char *)&addr)[3] 219 ((unsigned char *)&addr)[3]
220#define NIPQUAD_FMT "%u.%u.%u.%u"
215 221
216#define NIP6(addr) \ 222#define NIP6(addr) \
217 ntohs((addr).s6_addr16[0]), \ 223 ntohs((addr).s6_addr16[0]), \
@@ -222,6 +228,8 @@ extern void dump_stack(void);
222 ntohs((addr).s6_addr16[5]), \ 228 ntohs((addr).s6_addr16[5]), \
223 ntohs((addr).s6_addr16[6]), \ 229 ntohs((addr).s6_addr16[6]), \
224 ntohs((addr).s6_addr16[7]) 230 ntohs((addr).s6_addr16[7])
231#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
232#define NIP6_SEQFMT "%04x%04x%04x%04x%04x%04x%04x%04x"
225 233
226#if defined(__LITTLE_ENDIAN) 234#if defined(__LITTLE_ENDIAN)
227#define HIPQUAD(addr) \ 235#define HIPQUAD(addr) \
@@ -286,6 +294,15 @@ extern void dump_stack(void);
286 1; \ 294 1; \
287}) 295})
288 296
297/*
298 * Check at compile time that 'function' is a certain type, or is a pointer
299 * to that type (needs to use typedef for the function type.)
300 */
301#define typecheck_fn(type,function) \
302({ typeof(type) __tmp = function; \
303 (void)__tmp; \
304})
305
289#endif /* __KERNEL__ */ 306#endif /* __KERNEL__ */
290 307
291#define SI_LOAD_SHIFT 16 308#define SI_LOAD_SHIFT 16
@@ -316,8 +333,6 @@ extern int randomize_va_space;
316#endif 333#endif
317 334
318/* Trap pasters of __FUNCTION__ at compile-time */ 335/* Trap pasters of __FUNCTION__ at compile-time */
319#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
320#define __FUNCTION__ (__func__) 336#define __FUNCTION__ (__func__)
321#endif
322 337
323#endif 338#endif
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index c8468472aec0..a311f58c8a7c 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;
@@ -119,12 +119,15 @@ extern struct kimage *kexec_image;
119#define KEXEC_ARCH_PPC64 (21 << 16) 119#define KEXEC_ARCH_PPC64 (21 << 16)
120#define KEXEC_ARCH_IA_64 (50 << 16) 120#define KEXEC_ARCH_IA_64 (50 << 16)
121#define KEXEC_ARCH_S390 (22 << 16) 121#define KEXEC_ARCH_S390 (22 << 16)
122#define KEXEC_ARCH_SH (42 << 16)
122 123
123#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ 124#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */
124 125
125/* Location of a reserved region to hold the crash kernel. 126/* Location of a reserved region to hold the crash kernel.
126 */ 127 */
127extern struct resource crashk_res; 128extern struct resource crashk_res;
129typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
130extern note_buf_t *crash_notes;
128 131
129#else /* !CONFIG_KEXEC */ 132#else /* !CONFIG_KEXEC */
130struct pt_regs; 133struct pt_regs;
diff --git a/include/linux/key.h b/include/linux/key.h
index 4d189e51bc6c..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;
@@ -218,6 +220,16 @@ struct key_type {
218 */ 220 */
219 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);
220 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
221 /* internal fields */ 233 /* internal fields */
222 struct list_head link; /* link in types list */ 234 struct list_head link; /* link in types list */
223}; 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/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 a43c95f8f968..9e5db2949c58 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -126,16 +126,19 @@ enum {
126 126
127 ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */ 127 ATA_FLAG_SUSPENDED = (1 << 12), /* port is suspended */
128 128
129 ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */
130 ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */
131
129 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 132 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
130 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 133 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
131 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ 134 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */
132 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, 135 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
133 136
134 /* various lengths of time */ 137 /* various lengths of time */
135 ATA_TMOUT_EDD = 5 * HZ, /* hueristic */ 138 ATA_TMOUT_EDD = 5 * HZ, /* heuristic */
136 ATA_TMOUT_PIO = 30 * HZ, 139 ATA_TMOUT_PIO = 30 * HZ,
137 ATA_TMOUT_BOOT = 30 * HZ, /* hueristic */ 140 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
138 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* hueristic */ 141 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
139 ATA_TMOUT_CDB = 30 * HZ, 142 ATA_TMOUT_CDB = 30 * HZ,
140 ATA_TMOUT_CDB_QUICK = 5 * HZ, 143 ATA_TMOUT_CDB_QUICK = 5 * HZ,
141 ATA_TMOUT_INTERNAL = 30 * HZ, 144 ATA_TMOUT_INTERNAL = 30 * HZ,
@@ -499,6 +502,8 @@ extern int ata_scsi_slave_config(struct scsi_device *sdev);
499/* 502/*
500 * Timing helpers 503 * Timing helpers
501 */ 504 */
505
506extern unsigned int ata_pio_need_iordy(const struct ata_device *);
502extern int ata_timing_compute(struct ata_device *, unsigned short, 507extern int ata_timing_compute(struct ata_device *, unsigned short,
503 struct ata_timing *, int, int); 508 struct ata_timing *, int, int);
504extern void ata_timing_merge(const struct ata_timing *, 509extern void ata_timing_merge(const struct ata_timing *,
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/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 ed00b278cb93..bbd2221923c3 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/*
@@ -128,12 +132,8 @@ struct shared_policy {
128 spinlock_t lock; 132 spinlock_t lock;
129}; 133};
130 134
131static inline void mpol_shared_policy_init(struct shared_policy *info) 135void mpol_shared_policy_init(struct shared_policy *info, int policy,
132{ 136 nodemask_t *nodes);
133 info->root = RB_ROOT;
134 spin_lock_init(&info->lock);
135}
136
137int mpol_set_shared_policy(struct shared_policy *info, 137int mpol_set_shared_policy(struct shared_policy *info,
138 struct vm_area_struct *vma, 138 struct vm_area_struct *vma,
139 struct mempolicy *new); 139 struct mempolicy *new);
@@ -141,15 +141,25 @@ void mpol_free_shared_policy(struct shared_policy *p);
141struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, 141struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
142 unsigned long idx); 142 unsigned long idx);
143 143
144struct mempolicy *get_vma_policy(struct task_struct *task,
145 struct vm_area_struct *vma, unsigned long addr);
146
147extern void numa_default_policy(void); 144extern void numa_default_policy(void);
148extern void numa_policy_init(void); 145extern void numa_policy_init(void);
149extern void numa_policy_rebind(const nodemask_t *old, const nodemask_t *new); 146extern void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *new);
147extern void mpol_rebind_task(struct task_struct *tsk,
148 const nodemask_t *new);
149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
150#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x))
151
152#ifdef CONFIG_CPUSET
153#define current_cpuset_is_being_rebound() \
154 (cpuset_being_rebound == current->cpuset)
155#else
156#define current_cpuset_is_being_rebound() 0
157#endif
158
150extern struct mempolicy default_policy; 159extern struct mempolicy default_policy;
151extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 160extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
152 unsigned long addr); 161 unsigned long addr);
162extern unsigned slab_node(struct mempolicy *policy);
153 163
154extern int policy_zone; 164extern int policy_zone;
155 165
@@ -159,6 +169,11 @@ static inline void check_highest_zone(int k)
159 policy_zone = k; 169 policy_zone = k;
160} 170}
161 171
172int do_migrate_pages(struct mm_struct *mm,
173 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags);
174
175extern void *cpuset_being_rebound; /* Trigger mpol_copy vma rebind */
176
162#else 177#else
163 178
164struct mempolicy {}; 179struct mempolicy {};
@@ -193,7 +208,8 @@ static inline int mpol_set_shared_policy(struct shared_policy *info,
193 return -EINVAL; 208 return -EINVAL;
194} 209}
195 210
196static inline void mpol_shared_policy_init(struct shared_policy *info) 211static inline void mpol_shared_policy_init(struct shared_policy *info,
212 int policy, nodemask_t *nodes)
197{ 213{
198} 214}
199 215
@@ -218,17 +234,35 @@ static inline void numa_default_policy(void)
218{ 234{
219} 235}
220 236
221static inline void numa_policy_rebind(const nodemask_t *old, 237static inline void mpol_rebind_policy(struct mempolicy *pol,
238 const nodemask_t *new)
239{
240}
241
242static inline void mpol_rebind_task(struct task_struct *tsk,
222 const nodemask_t *new) 243 const nodemask_t *new)
223{ 244{
224} 245}
225 246
247static inline void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new)
248{
249}
250
251#define set_cpuset_being_rebound(x) do {} while (0)
252
226static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, 253static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
227 unsigned long addr) 254 unsigned long addr)
228{ 255{
229 return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER); 256 return NODE_DATA(0)->node_zonelists + gfp_zone(GFP_HIGHUSER);
230} 257}
231 258
259static inline int do_migrate_pages(struct mm_struct *mm,
260 const nodemask_t *from_nodes,
261 const nodemask_t *to_nodes, int flags)
262{
263 return 0;
264}
265
232static inline void check_highest_zone(int k) 266static inline void check_highest_zone(int k)
233{ 267{
234} 268}
diff --git a/include/linux/mm.h b/include/linux/mm.h
index bc01fff3aa01..85854b867463 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 *));
@@ -507,7 +512,7 @@ static inline void set_page_links(struct page *page, unsigned long zone,
507extern struct page *mem_map; 512extern struct page *mem_map;
508#endif 513#endif
509 514
510static inline void *lowmem_page_address(struct page *page) 515static __always_inline void *lowmem_page_address(struct page *page)
511{ 516{
512 return __va(page_to_pfn(page) << PAGE_SHIFT); 517 return __va(page_to_pfn(page) << PAGE_SHIFT);
513} 518}
@@ -815,7 +820,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
815 * 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).
816 * 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.
817 */ 822 */
818#define __pte_lockptr(page) &((page)->u.ptl) 823#define __pte_lockptr(page) &((page)->ptl)
819#define pte_lock_init(_page) do { \ 824#define pte_lock_init(_page) do { \
820 spin_lock_init(__pte_lockptr(_page)); \ 825 spin_lock_init(__pte_lockptr(_page)); \
821} while (0) 826} while (0)
@@ -1021,6 +1026,9 @@ static inline void vm_stat_account(struct mm_struct *mm,
1021static inline void 1026static inline void
1022kernel_map_pages(struct page *page, int numpages, int enable) 1027kernel_map_pages(struct page *page, int numpages, int enable)
1023{ 1028{
1029 if (!PageHighMem(page) && !enable)
1030 mutex_debug_check_no_locks_freed(page_address(page),
1031 numpages * PAGE_SIZE);
1024} 1032}
1025#endif 1033#endif
1026 1034
@@ -1036,5 +1044,12 @@ int in_gate_area_no_task(unsigned long addr);
1036/* /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 */
1037#define OOM_DISABLE -17 1045#define OOM_DISABLE -17
1038 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
1039#endif /* __KERNEL__ */ 1054#endif /* __KERNEL__ */
1040#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..8ac854f7f190 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -38,3 +38,4 @@ del_page_from_lru(struct zone *zone, struct page *page)
38 zone->nr_inactive--; 38 zone->nr_inactive--;
39 } 39 }
40} 40}
41
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 c34f4a2c62f8..93a849f742db 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)
@@ -98,7 +98,7 @@ struct per_cpu_pageset {
98 98
99/* 99/*
100 * 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
101 * into multiple physical zones. On a PC we have 4 zones: 101 * into multiple physical zones. On a 32bit PC we have 4 zones:
102 * 102 *
103 * ZONE_DMA < 16 MB ISA DMA capable memory 103 * ZONE_DMA < 16 MB ISA DMA capable memory
104 * ZONE_DMA32 0 MB Empty 104 * ZONE_DMA32 0 MB Empty
@@ -149,15 +149,17 @@ struct zone {
149 unsigned long pages_scanned; /* since last reclaim */ 149 unsigned long pages_scanned; /* since last reclaim */
150 int all_unreclaimable; /* All pages pinned */ 150 int all_unreclaimable; /* All pages pinned */
151 151
152 /*
153 * Does the allocator try to reclaim pages from the zone as soon
154 * as it fails a watermark_ok() in __alloc_pages?
155 */
156 int reclaim_pages;
157 /* A count of how many reclaimers are scanning this zone */ 152 /* A count of how many reclaimers are scanning this zone */
158 atomic_t reclaim_in_progress; 153 atomic_t reclaim_in_progress;
159 154
160 /* 155 /*
156 * timestamp (in jiffies) of the last zone reclaim that did not
157 * result in freeing of pages. This is used to avoid repeated scans
158 * if all memory in the zone is in use.
159 */
160 unsigned long last_unsuccessful_zone_reclaim;
161
162 /*
161 * prev_priority holds the scanning priority for this zone. It is 163 * prev_priority holds the scanning priority for this zone. It is
162 * defined as the scanning priority at which we achieved our reclaim 164 * defined as the scanning priority at which we achieved our reclaim
163 * target at the previous try_to_free_pages() or balance_pgdat() 165 * target at the previous try_to_free_pages() or balance_pgdat()
@@ -233,7 +235,7 @@ struct zone {
233 * rarely used fields: 235 * rarely used fields:
234 */ 236 */
235 char *name; 237 char *name;
236} ____cacheline_maxaligned_in_smp; 238} ____cacheline_internodealigned_in_smp;
237 239
238 240
239/* 241/*
@@ -437,6 +439,8 @@ int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *,
437extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1]; 439extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
438int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *, 440int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
439 void __user *, size_t *, loff_t *); 441 void __user *, size_t *, loff_t *);
442int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *,
443 void __user *, size_t *, loff_t *);
440 444
441#include <linux/topology.h> 445#include <linux/topology.h>
442/* Returns the number of the current Node. */ 446/* Returns the number of the current Node. */
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..e6698013e4d0 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -56,10 +56,11 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
56#define LOOKUP_ACCESS (0x0400) 56#define LOOKUP_ACCESS (0x0400)
57 57
58extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *)); 58extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
59extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *));
59#define user_path_walk(name,nd) \ 60#define user_path_walk(name,nd) \
60 __user_walk(name, LOOKUP_FOLLOW, nd) 61 __user_walk_fd(AT_FDCWD, name, LOOKUP_FOLLOW, nd)
61#define user_path_walk_link(name,nd) \ 62#define user_path_walk_link(name,nd) \
62 __user_walk(name, 0, nd) 63 __user_walk_fd(AT_FDCWD, name, 0, nd)
63extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *)); 64extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
64extern int FASTCALL(path_walk(const char *, struct nameidata *)); 65extern int FASTCALL(path_walk(const char *, struct nameidata *));
65extern int FASTCALL(link_path_walk(const char *, struct nameidata *)); 66extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
@@ -67,14 +68,14 @@ extern void path_release(struct nameidata *);
67extern void path_release_on_umount(struct nameidata *); 68extern void path_release_on_umount(struct nameidata *);
68 69
69extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags); 70extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags);
70extern int path_lookup_open(const char *, unsigned lookup_flags, struct nameidata *, int open_flags); 71extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags);
71extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, 72extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
72 int (*open)(struct inode *, struct file *)); 73 int (*open)(struct inode *, struct file *));
73extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); 74extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
74extern void release_open_intent(struct nameidata *); 75extern void release_open_intent(struct nameidata *);
75 76
76extern struct dentry * lookup_one_len(const char *, struct dentry *, int); 77extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
77extern struct dentry * lookup_hash(struct nameidata *); 78extern __deprecated_for_modules struct dentry * lookup_hash(struct nameidata *);
78 79
79extern int follow_down(struct vfsmount **, struct dentry **); 80extern int follow_down(struct vfsmount **, struct dentry **);
80extern int follow_up(struct vfsmount **, struct dentry **); 81extern int follow_up(struct vfsmount **, struct dentry **);
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/ncp_fs.h b/include/linux/ncp_fs.h
index 7297e4372c0f..e01342568530 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -201,34 +201,6 @@ static inline struct ncp_inode_info *NCP_FINFO(struct inode *inode)
201 return container_of(inode, struct ncp_inode_info, vfs_inode); 201 return container_of(inode, struct ncp_inode_info, vfs_inode);
202} 202}
203 203
204#ifdef DEBUG_NCP_MALLOC
205
206#include <linux/slab.h>
207
208extern int ncp_malloced;
209extern int ncp_current_malloced;
210
211static inline void *
212 ncp_kmalloc(unsigned int size, int priority)
213{
214 ncp_malloced += 1;
215 ncp_current_malloced += 1;
216 return kmalloc(size, priority);
217}
218
219static inline void ncp_kfree_s(void *obj, int size)
220{
221 ncp_current_malloced -= 1;
222 kfree(obj);
223}
224
225#else /* DEBUG_NCP_MALLOC */
226
227#define ncp_kmalloc(s,p) kmalloc(s,p)
228#define ncp_kfree_s(o,s) kfree(o)
229
230#endif /* DEBUG_NCP_MALLOC */
231
232/* linux/fs/ncpfs/inode.c */ 204/* linux/fs/ncpfs/inode.c */
233int ncp_notify_change(struct dentry *, struct iattr *); 205int ncp_notify_change(struct dentry *, struct iattr *);
234struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *); 206struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *);
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/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 6d39b518486b..3ff88c878308 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -154,6 +154,9 @@ struct ip_conntrack_stat
154 unsigned int expect_delete; 154 unsigned int expect_delete;
155}; 155};
156 156
157/* call to create an explicit dependency on nf_conntrack. */
158extern void need_conntrack(void);
159
157#endif /* __KERNEL__ */ 160#endif /* __KERNEL__ */
158 161
159#endif /* _NF_CONNTRACK_COMMON_H */ 162#endif /* _NF_CONNTRACK_COMMON_H */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
new file mode 100644
index 000000000000..59ff6c430cf6
--- /dev/null
+++ b/include/linux/netfilter/x_tables.h
@@ -0,0 +1,224 @@
1#ifndef _X_TABLES_H
2#define _X_TABLES_H
3
4#define XT_FUNCTION_MAXNAMELEN 30
5#define XT_TABLE_MAXNAMELEN 32
6
7/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
8 * kernel supports, if >= revision. */
9struct xt_get_revision
10{
11 char name[XT_FUNCTION_MAXNAMELEN-1];
12
13 u_int8_t revision;
14};
15
16/* CONTINUE verdict for targets */
17#define XT_CONTINUE 0xFFFFFFFF
18
19/* For standard target */
20#define XT_RETURN (-NF_REPEAT - 1)
21
22#define XT_ALIGN(s) (((s) + (__alignof__(u_int64_t)-1)) & ~(__alignof__(u_int64_t)-1))
23
24/* Standard return verdict, or do jump. */
25#define XT_STANDARD_TARGET ""
26/* Error verdict. */
27#define XT_ERROR_TARGET "ERROR"
28
29/*
30 * New IP firewall options for [gs]etsockopt at the RAW IP level.
31 * Unlike BSD Linux inherits IP options so you don't have to use a raw
32 * socket for this. Instead we check rights in the calls. */
33#define XT_BASE_CTL 64 /* base for firewall socket options */
34
35#define XT_SO_SET_REPLACE (XT_BASE_CTL)
36#define XT_SO_SET_ADD_COUNTERS (XT_BASE_CTL + 1)
37#define XT_SO_SET_MAX XT_SO_SET_ADD_COUNTERS
38
39#define XT_SO_GET_INFO (XT_BASE_CTL)
40#define XT_SO_GET_ENTRIES (XT_BASE_CTL + 1)
41#define XT_SO_GET_REVISION_MATCH (XT_BASE_CTL + 2)
42#define XT_SO_GET_REVISION_TARGET (XT_BASE_CTL + 3)
43#define XT_SO_GET_MAX XT_SO_GET_REVISION_TARGET
44
45#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
46#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
47
48struct xt_counters
49{
50 u_int64_t pcnt, bcnt; /* Packet and byte counters */
51};
52
53/* The argument to IPT_SO_ADD_COUNTERS. */
54struct xt_counters_info
55{
56 /* Which table. */
57 char name[XT_TABLE_MAXNAMELEN];
58
59 unsigned int num_counters;
60
61 /* The counters (actually `number' of these). */
62 struct xt_counters counters[0];
63};
64
65#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
66
67#ifdef __KERNEL__
68
69#include <linux/netdevice.h>
70
71#define ASSERT_READ_LOCK(x)
72#define ASSERT_WRITE_LOCK(x)
73#include <linux/netfilter_ipv4/listhelp.h>
74
75struct xt_match
76{
77 struct list_head list;
78
79 const char name[XT_FUNCTION_MAXNAMELEN-1];
80
81 u_int8_t revision;
82
83 /* Return true or false: return FALSE and set *hotdrop = 1 to
84 force immediate packet drop. */
85 /* Arguments changed since 2.6.9, as this must now handle
86 non-linear skb, using skb_header_pointer and
87 skb_ip_make_writable. */
88 int (*match)(const struct sk_buff *skb,
89 const struct net_device *in,
90 const struct net_device *out,
91 const void *matchinfo,
92 int offset,
93 unsigned int protoff,
94 int *hotdrop);
95
96 /* Called when user tries to insert an entry of this type. */
97 /* Should return true or false. */
98 int (*checkentry)(const char *tablename,
99 const void *ip,
100 void *matchinfo,
101 unsigned int matchinfosize,
102 unsigned int hook_mask);
103
104 /* Called when entry of this type deleted. */
105 void (*destroy)(void *matchinfo, unsigned int matchinfosize);
106
107 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
108 struct module *me;
109};
110
111/* Registration hooks for targets. */
112struct xt_target
113{
114 struct list_head list;
115
116 const char name[XT_FUNCTION_MAXNAMELEN-1];
117
118 u_int8_t revision;
119
120 /* Returns verdict. Argument order changed since 2.6.9, as this
121 must now handle non-linear skbs, using skb_copy_bits and
122 skb_ip_make_writable. */
123 unsigned int (*target)(struct sk_buff **pskb,
124 const struct net_device *in,
125 const struct net_device *out,
126 unsigned int hooknum,
127 const void *targinfo,
128 void *userdata);
129
130 /* Called when user tries to insert an entry of this type:
131 hook_mask is a bitmask of hooks from which it can be
132 called. */
133 /* Should return true or false. */
134 int (*checkentry)(const char *tablename,
135 const void *entry,
136 void *targinfo,
137 unsigned int targinfosize,
138 unsigned int hook_mask);
139
140 /* Called when entry of this type deleted. */
141 void (*destroy)(void *targinfo, unsigned int targinfosize);
142
143 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
144 struct module *me;
145};
146
147/* Furniture shopping... */
148struct xt_table
149{
150 struct list_head list;
151
152 /* A unique name... */
153 char name[XT_TABLE_MAXNAMELEN];
154
155 /* What hooks you will enter on */
156 unsigned int valid_hooks;
157
158 /* Lock for the curtain */
159 rwlock_t lock;
160
161 /* Man behind the curtain... */
162 //struct ip6t_table_info *private;
163 void *private;
164
165 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
166 struct module *me;
167
168 int af; /* address/protocol family */
169};
170
171#include <linux/netfilter_ipv4.h>
172
173/* The table itself */
174struct xt_table_info
175{
176 /* Size per table */
177 unsigned int size;
178 /* Number of entries: FIXME. --RR */
179 unsigned int number;
180 /* Initial number of entries. Needed for module usage count */
181 unsigned int initial_entries;
182
183 /* Entry points and underflows */
184 unsigned int hook_entry[NF_IP_NUMHOOKS];
185 unsigned int underflow[NF_IP_NUMHOOKS];
186
187 /* ipt_entry tables: one per CPU */
188 char *entries[NR_CPUS];
189};
190
191extern int xt_register_target(int af, struct xt_target *target);
192extern void xt_unregister_target(int af, struct xt_target *target);
193extern int xt_register_match(int af, struct xt_match *target);
194extern void xt_unregister_match(int af, struct xt_match *target);
195
196extern int xt_register_table(struct xt_table *table,
197 struct xt_table_info *bootstrap,
198 struct xt_table_info *newinfo);
199extern void *xt_unregister_table(struct xt_table *table);
200
201extern struct xt_table_info *xt_replace_table(struct xt_table *table,
202 unsigned int num_counters,
203 struct xt_table_info *newinfo,
204 int *error);
205
206extern struct xt_match *xt_find_match(int af, const char *name, u8 revision);
207extern struct xt_target *xt_find_target(int af, const char *name, u8 revision);
208extern struct xt_target *xt_request_find_target(int af, const char *name,
209 u8 revision);
210extern int xt_find_revision(int af, const char *name, u8 revision, int target,
211 int *err);
212
213extern struct xt_table *xt_find_table_lock(int af, const char *name);
214extern void xt_table_unlock(struct xt_table *t);
215
216extern int xt_proto_init(int af);
217extern void xt_proto_fini(int af);
218
219extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
220extern void xt_free_table_info(struct xt_table_info *info);
221
222#endif /* __KERNEL__ */
223
224#endif /* _X_TABLES_H */
diff --git a/include/linux/netfilter/xt_CLASSIFY.h b/include/linux/netfilter/xt_CLASSIFY.h
new file mode 100644
index 000000000000..58111355255d
--- /dev/null
+++ b/include/linux/netfilter/xt_CLASSIFY.h
@@ -0,0 +1,8 @@
1#ifndef _XT_CLASSIFY_H
2#define _XT_CLASSIFY_H
3
4struct xt_classify_target_info {
5 u_int32_t priority;
6};
7
8#endif /*_XT_CLASSIFY_H */
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
new file mode 100644
index 000000000000..9f744689fffc
--- /dev/null
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -0,0 +1,25 @@
1#ifndef _XT_CONNMARK_H_target
2#define _XT_CONNMARK_H_target
3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13enum {
14 XT_CONNMARK_SET = 0,
15 XT_CONNMARK_SAVE,
16 XT_CONNMARK_RESTORE
17};
18
19struct xt_connmark_target_info {
20 unsigned long mark;
21 unsigned long mask;
22 u_int8_t mode;
23};
24
25#endif /*_XT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
new file mode 100644
index 000000000000..b021e93ee5d6
--- /dev/null
+++ b/include/linux/netfilter/xt_MARK.h
@@ -0,0 +1,21 @@
1#ifndef _XT_MARK_H_target
2#define _XT_MARK_H_target
3
4/* Version 0 */
5struct xt_mark_target_info {
6 unsigned long mark;
7};
8
9/* Version 1 */
10enum {
11 XT_MARK_SET=0,
12 XT_MARK_AND,
13 XT_MARK_OR,
14};
15
16struct xt_mark_target_info_v1 {
17 unsigned long mark;
18 u_int8_t mode;
19};
20
21#endif /*_XT_MARK_H_target */
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h
new file mode 100644
index 000000000000..9a9af79f74d2
--- /dev/null
+++ b/include/linux/netfilter/xt_NFQUEUE.h
@@ -0,0 +1,16 @@
1/* iptables module for using NFQUEUE mechanism
2 *
3 * (C) 2005 Harald Welte <laforge@netfilter.org>
4 *
5 * This software is distributed under GNU GPL v2, 1991
6 *
7*/
8#ifndef _XT_NFQ_TARGET_H
9#define _XT_NFQ_TARGET_H
10
11/* target info */
12struct xt_NFQ_info {
13 u_int16_t queuenum;
14};
15
16#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/linux/netfilter/xt_comment.h b/include/linux/netfilter/xt_comment.h
new file mode 100644
index 000000000000..eacfedc6b5d0
--- /dev/null
+++ b/include/linux/netfilter/xt_comment.h
@@ -0,0 +1,10 @@
1#ifndef _XT_COMMENT_H
2#define _XT_COMMENT_H
3
4#define XT_MAX_COMMENT_LEN 256
5
6struct xt_comment_info {
7 unsigned char comment[XT_MAX_COMMENT_LEN];
8};
9
10#endif /* XT_COMMENT_H */
diff --git a/include/linux/netfilter/xt_connbytes.h b/include/linux/netfilter/xt_connbytes.h
new file mode 100644
index 000000000000..c022c989754d
--- /dev/null
+++ b/include/linux/netfilter/xt_connbytes.h
@@ -0,0 +1,25 @@
1#ifndef _XT_CONNBYTES_H
2#define _XT_CONNBYTES_H
3
4enum xt_connbytes_what {
5 XT_CONNBYTES_PKTS,
6 XT_CONNBYTES_BYTES,
7 XT_CONNBYTES_AVGPKT,
8};
9
10enum xt_connbytes_direction {
11 XT_CONNBYTES_DIR_ORIGINAL,
12 XT_CONNBYTES_DIR_REPLY,
13 XT_CONNBYTES_DIR_BOTH,
14};
15
16struct xt_connbytes_info
17{
18 struct {
19 aligned_u64 from; /* count to be matched */
20 aligned_u64 to; /* count to be matched */
21 } count;
22 u_int8_t what; /* ipt_connbytes_what */
23 u_int8_t direction; /* ipt_connbytes_direction */
24};
25#endif
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
new file mode 100644
index 000000000000..c592f6ae0883
--- /dev/null
+++ b/include/linux/netfilter/xt_connmark.h
@@ -0,0 +1,18 @@
1#ifndef _XT_CONNMARK_H
2#define _XT_CONNMARK_H
3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
5 * by Henrik Nordstrom <hno@marasystems.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13struct xt_connmark_info {
14 unsigned long mark, mask;
15 u_int8_t invert;
16};
17
18#endif /*_XT_CONNMARK_H*/
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
new file mode 100644
index 000000000000..34f63cf2e293
--- /dev/null
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -0,0 +1,63 @@
1/* Header file for kernel module to match connection tracking information.
2 * GPL (C) 2001 Marc Boucher (marc@mbsi.ca).
3 */
4
5#ifndef _XT_CONNTRACK_H
6#define _XT_CONNTRACK_H
7
8#include <linux/netfilter/nf_conntrack_tuple_common.h>
9#include <linux/in.h>
10
11#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
12#define XT_CONNTRACK_STATE_INVALID (1 << 0)
13
14#define XT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1))
15#define XT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2))
16#define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3))
17
18/* flags, invflags: */
19#define XT_CONNTRACK_STATE 0x01
20#define XT_CONNTRACK_PROTO 0x02
21#define XT_CONNTRACK_ORIGSRC 0x04
22#define XT_CONNTRACK_ORIGDST 0x08
23#define XT_CONNTRACK_REPLSRC 0x10
24#define XT_CONNTRACK_REPLDST 0x20
25#define XT_CONNTRACK_STATUS 0x40
26#define XT_CONNTRACK_EXPIRES 0x80
27
28/* This is exposed to userspace, so remains frozen in time. */
29struct ip_conntrack_old_tuple
30{
31 struct {
32 __u32 ip;
33 union {
34 __u16 all;
35 } u;
36 } src;
37
38 struct {
39 __u32 ip;
40 union {
41 __u16 all;
42 } u;
43
44 /* The protocol. */
45 u16 protonum;
46 } dst;
47};
48
49struct xt_conntrack_info
50{
51 unsigned int statemask, statusmask;
52
53 struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX];
54 struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX];
55
56 unsigned long expires_min, expires_max;
57
58 /* Flags word */
59 u_int8_t flags;
60 /* Inverse flags */
61 u_int8_t invflags;
62};
63#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_dccp.h b/include/linux/netfilter/xt_dccp.h
new file mode 100644
index 000000000000..e0221b9d32cb
--- /dev/null
+++ b/include/linux/netfilter/xt_dccp.h
@@ -0,0 +1,23 @@
1#ifndef _XT_DCCP_H_
2#define _XT_DCCP_H_
3
4#define XT_DCCP_SRC_PORTS 0x01
5#define XT_DCCP_DEST_PORTS 0x02
6#define XT_DCCP_TYPE 0x04
7#define XT_DCCP_OPTION 0x08
8
9#define XT_DCCP_VALID_FLAGS 0x0f
10
11struct xt_dccp_info {
12 u_int16_t dpts[2]; /* Min, Max */
13 u_int16_t spts[2]; /* Min, Max */
14
15 u_int16_t flags;
16 u_int16_t invflags;
17
18 u_int16_t typemask;
19 u_int8_t option;
20};
21
22#endif /* _XT_DCCP_H_ */
23
diff --git a/include/linux/netfilter/xt_helper.h b/include/linux/netfilter/xt_helper.h
new file mode 100644
index 000000000000..6b42763f999d
--- /dev/null
+++ b/include/linux/netfilter/xt_helper.h
@@ -0,0 +1,8 @@
1#ifndef _XT_HELPER_H
2#define _XT_HELPER_H
3
4struct xt_helper_info {
5 int invert;
6 char name[30];
7};
8#endif /* _XT_HELPER_H */
diff --git a/include/linux/netfilter/xt_length.h b/include/linux/netfilter/xt_length.h
new file mode 100644
index 000000000000..7c2b439f73fe
--- /dev/null
+++ b/include/linux/netfilter/xt_length.h
@@ -0,0 +1,9 @@
1#ifndef _XT_LENGTH_H
2#define _XT_LENGTH_H
3
4struct xt_length_info {
5 u_int16_t min, max;
6 u_int8_t invert;
7};
8
9#endif /*_XT_LENGTH_H*/
diff --git a/include/linux/netfilter/xt_limit.h b/include/linux/netfilter/xt_limit.h
new file mode 100644
index 000000000000..b3ce65375ecb
--- /dev/null
+++ b/include/linux/netfilter/xt_limit.h
@@ -0,0 +1,21 @@
1#ifndef _XT_RATE_H
2#define _XT_RATE_H
3
4/* timings are in milliseconds. */
5#define XT_LIMIT_SCALE 10000
6
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
8 seconds, or one every 59 hours. */
9struct xt_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */
12
13 /* Used internally by the kernel */
14 unsigned long prev;
15 u_int32_t credit;
16 u_int32_t credit_cap, cost;
17
18 /* Ugly, ugly fucker. */
19 struct xt_rateinfo *master;
20};
21#endif /*_XT_RATE_H*/
diff --git a/include/linux/netfilter/xt_mac.h b/include/linux/netfilter/xt_mac.h
new file mode 100644
index 000000000000..b892cdc67e06
--- /dev/null
+++ b/include/linux/netfilter/xt_mac.h
@@ -0,0 +1,8 @@
1#ifndef _XT_MAC_H
2#define _XT_MAC_H
3
4struct xt_mac_info {
5 unsigned char srcaddr[ETH_ALEN];
6 int invert;
7};
8#endif /*_XT_MAC_H*/
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
new file mode 100644
index 000000000000..802dd4842caf
--- /dev/null
+++ b/include/linux/netfilter/xt_mark.h
@@ -0,0 +1,9 @@
1#ifndef _XT_MARK_H
2#define _XT_MARK_H
3
4struct xt_mark_info {
5 unsigned long mark, mask;
6 u_int8_t invert;
7};
8
9#endif /*_XT_MARK_H*/
diff --git a/include/linux/netfilter/xt_physdev.h b/include/linux/netfilter/xt_physdev.h
new file mode 100644
index 000000000000..25a7a1815b5b
--- /dev/null
+++ b/include/linux/netfilter/xt_physdev.h
@@ -0,0 +1,24 @@
1#ifndef _XT_PHYSDEV_H
2#define _XT_PHYSDEV_H
3
4#ifdef __KERNEL__
5#include <linux/if.h>
6#endif
7
8#define XT_PHYSDEV_OP_IN 0x01
9#define XT_PHYSDEV_OP_OUT 0x02
10#define XT_PHYSDEV_OP_BRIDGED 0x04
11#define XT_PHYSDEV_OP_ISIN 0x08
12#define XT_PHYSDEV_OP_ISOUT 0x10
13#define XT_PHYSDEV_OP_MASK (0x20 - 1)
14
15struct xt_physdev_info {
16 char physindev[IFNAMSIZ];
17 char in_mask[IFNAMSIZ];
18 char physoutdev[IFNAMSIZ];
19 char out_mask[IFNAMSIZ];
20 u_int8_t invert;
21 u_int8_t bitmask;
22};
23
24#endif /*_XT_PHYSDEV_H*/
diff --git a/include/linux/netfilter/xt_pkttype.h b/include/linux/netfilter/xt_pkttype.h
new file mode 100644
index 000000000000..f265cf52faea
--- /dev/null
+++ b/include/linux/netfilter/xt_pkttype.h
@@ -0,0 +1,8 @@
1#ifndef _XT_PKTTYPE_H
2#define _XT_PKTTYPE_H
3
4struct xt_pkttype_info {
5 int pkttype;
6 int invert;
7};
8#endif /*_XT_PKTTYPE_H*/
diff --git a/include/linux/netfilter/xt_realm.h b/include/linux/netfilter/xt_realm.h
new file mode 100644
index 000000000000..220e87245716
--- /dev/null
+++ b/include/linux/netfilter/xt_realm.h
@@ -0,0 +1,10 @@
1#ifndef _XT_REALM_H
2#define _XT_REALM_H
3
4struct xt_realm_info {
5 u_int32_t id;
6 u_int32_t mask;
7 u_int8_t invert;
8};
9
10#endif /* _XT_REALM_H */
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
new file mode 100644
index 000000000000..b157897e7792
--- /dev/null
+++ b/include/linux/netfilter/xt_sctp.h
@@ -0,0 +1,107 @@
1#ifndef _XT_SCTP_H_
2#define _XT_SCTP_H_
3
4#define XT_SCTP_SRC_PORTS 0x01
5#define XT_SCTP_DEST_PORTS 0x02
6#define XT_SCTP_CHUNK_TYPES 0x04
7
8#define XT_SCTP_VALID_FLAGS 0x07
9
10#define ELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
11
12
13struct xt_sctp_flag_info {
14 u_int8_t chunktype;
15 u_int8_t flag;
16 u_int8_t flag_mask;
17};
18
19#define XT_NUM_SCTP_FLAGS 4
20
21struct xt_sctp_info {
22 u_int16_t dpts[2]; /* Min, Max */
23 u_int16_t spts[2]; /* Min, Max */
24
25 u_int32_t chunkmap[256 / sizeof (u_int32_t)]; /* Bit mask of chunks to be matched according to RFC 2960 */
26
27#define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */
28#define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */
29#define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */
30
31 u_int32_t chunk_match_type;
32 struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS];
33 int flag_count;
34
35 u_int32_t flags;
36 u_int32_t invflags;
37};
38
39#define bytes(type) (sizeof(type) * 8)
40
41#define SCTP_CHUNKMAP_SET(chunkmap, type) \
42 do { \
43 chunkmap[type / bytes(u_int32_t)] |= \
44 1 << (type % bytes(u_int32_t)); \
45 } while (0)
46
47#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
48 do { \
49 chunkmap[type / bytes(u_int32_t)] &= \
50 ~(1 << (type % bytes(u_int32_t))); \
51 } while (0)
52
53#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
54({ \
55 (chunkmap[type / bytes (u_int32_t)] & \
56 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
57})
58
59#define SCTP_CHUNKMAP_RESET(chunkmap) \
60 do { \
61 int i; \
62 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
63 chunkmap[i] = 0; \
64 } while (0)
65
66#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
67 do { \
68 int i; \
69 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
70 chunkmap[i] = ~0; \
71 } while (0)
72
73#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
74 do { \
75 int i; \
76 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
77 destmap[i] = srcmap[i]; \
78 } while (0)
79
80#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
81({ \
82 int i; \
83 int flag = 1; \
84 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \
85 if (chunkmap[i]) { \
86 flag = 0; \
87 break; \
88 } \
89 } \
90 flag; \
91})
92
93#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
94({ \
95 int i; \
96 int flag = 1; \
97 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \
98 if (chunkmap[i] != ~0) { \
99 flag = 0; \
100 break; \
101 } \
102 } \
103 flag; \
104})
105
106#endif /* _XT_SCTP_H_ */
107
diff --git a/include/linux/netfilter/xt_state.h b/include/linux/netfilter/xt_state.h
new file mode 100644
index 000000000000..c06f32edee07
--- /dev/null
+++ b/include/linux/netfilter/xt_state.h
@@ -0,0 +1,13 @@
1#ifndef _XT_STATE_H
2#define _XT_STATE_H
3
4#define XT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
5#define XT_STATE_INVALID (1 << 0)
6
7#define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1))
8
9struct xt_state_info
10{
11 unsigned int statemask;
12};
13#endif /*_XT_STATE_H*/
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
new file mode 100644
index 000000000000..3b3419f2637d
--- /dev/null
+++ b/include/linux/netfilter/xt_string.h
@@ -0,0 +1,18 @@
1#ifndef _XT_STRING_H
2#define _XT_STRING_H
3
4#define XT_STRING_MAX_PATTERN_SIZE 128
5#define XT_STRING_MAX_ALGO_NAME_SIZE 16
6
7struct xt_string_info
8{
9 u_int16_t from_offset;
10 u_int16_t to_offset;
11 char algo[XT_STRING_MAX_ALGO_NAME_SIZE];
12 char pattern[XT_STRING_MAX_PATTERN_SIZE];
13 u_int8_t patlen;
14 u_int8_t invert;
15 struct ts_config __attribute__((aligned(8))) *config;
16};
17
18#endif /*_XT_STRING_H*/
diff --git a/include/linux/netfilter/xt_tcpmss.h b/include/linux/netfilter/xt_tcpmss.h
new file mode 100644
index 000000000000..e03274c4c790
--- /dev/null
+++ b/include/linux/netfilter/xt_tcpmss.h
@@ -0,0 +1,9 @@
1#ifndef _XT_TCPMSS_MATCH_H
2#define _XT_TCPMSS_MATCH_H
3
4struct xt_tcpmss_match_info {
5 u_int16_t mss_min, mss_max;
6 u_int8_t invert;
7};
8
9#endif /*_XT_TCPMSS_MATCH_H*/
diff --git a/include/linux/netfilter/xt_tcpudp.h b/include/linux/netfilter/xt_tcpudp.h
new file mode 100644
index 000000000000..78bc65f11adf
--- /dev/null
+++ b/include/linux/netfilter/xt_tcpudp.h
@@ -0,0 +1,36 @@
1#ifndef _XT_TCPUDP_H
2#define _XT_TCPUDP_H
3
4/* TCP matching stuff */
5struct xt_tcp
6{
7 u_int16_t spts[2]; /* Source port range. */
8 u_int16_t dpts[2]; /* Destination port range. */
9 u_int8_t option; /* TCP Option iff non-zero*/
10 u_int8_t flg_mask; /* TCP flags mask byte */
11 u_int8_t flg_cmp; /* TCP flags compare byte */
12 u_int8_t invflags; /* Inverse flags */
13};
14
15/* Values for "inv" field in struct ipt_tcp. */
16#define XT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
17#define XT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
18#define XT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */
19#define XT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */
20#define XT_TCP_INV_MASK 0x0F /* All possible flags. */
21
22/* UDP matching stuff */
23struct xt_udp
24{
25 u_int16_t spts[2]; /* Source port range. */
26 u_int16_t dpts[2]; /* Destination port range. */
27 u_int8_t invflags; /* Inverse flags */
28};
29
30/* Values for "invflags" field in struct ipt_udp. */
31#define XT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
32#define XT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
33#define XT_UDP_INV_MASK 0x03 /* All possible flags. */
34
35
36#endif
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index e98a870a20be..fd21796e5131 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -19,8 +19,12 @@
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/netfilter_arp.h> 20#include <linux/netfilter_arp.h>
21 21
22#define ARPT_FUNCTION_MAXNAMELEN 30 22#include <linux/netfilter/x_tables.h>
23#define ARPT_TABLE_MAXNAMELEN 32 23
24#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
25#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
26#define arpt_target xt_target
27#define arpt_table xt_table
24 28
25#define ARPT_DEV_ADDR_LEN_MAX 16 29#define ARPT_DEV_ADDR_LEN_MAX 16
26 30
@@ -91,11 +95,6 @@ struct arpt_standard_target
91 int verdict; 95 int verdict;
92}; 96};
93 97
94struct arpt_counters
95{
96 u_int64_t pcnt, bcnt; /* Packet and byte counters */
97};
98
99/* Values for "flag" field in struct arpt_ip (general arp structure). 98/* Values for "flag" field in struct arpt_ip (general arp structure).
100 * No flags defined yet. 99 * No flags defined yet.
101 */ 100 */
@@ -130,7 +129,7 @@ struct arpt_entry
130 unsigned int comefrom; 129 unsigned int comefrom;
131 130
132 /* Packet and byte counters. */ 131 /* Packet and byte counters. */
133 struct arpt_counters counters; 132 struct xt_counters counters;
134 133
135 /* The matches (if any), then the target. */ 134 /* The matches (if any), then the target. */
136 unsigned char elems[0]; 135 unsigned char elems[0];
@@ -141,23 +140,24 @@ struct arpt_entry
141 * Unlike BSD Linux inherits IP options so you don't have to use a raw 140 * Unlike BSD Linux inherits IP options so you don't have to use a raw
142 * socket for this. Instead we check rights in the calls. 141 * socket for this. Instead we check rights in the calls.
143 */ 142 */
144#define ARPT_BASE_CTL 96 /* base for firewall socket options */ 143#define ARPT_CTL_OFFSET 32
144#define ARPT_BASE_CTL (XT_BASE_CTL+ARPT_CTL_OFFSET)
145 145
146#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL) 146#define ARPT_SO_SET_REPLACE (XT_SO_SET_REPLACE+ARPT_CTL_OFFSET)
147#define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1) 147#define ARPT_SO_SET_ADD_COUNTERS (XT_SO_SET_ADD_COUNTERS+ARPT_CTL_OFFSET)
148#define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS 148#define ARPT_SO_SET_MAX (XT_SO_SET_MAX+ARPT_CTL_OFFSET)
149 149
150#define ARPT_SO_GET_INFO (ARPT_BASE_CTL) 150#define ARPT_SO_GET_INFO (XT_SO_GET_INFO+ARPT_CTL_OFFSET)
151#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1) 151#define ARPT_SO_GET_ENTRIES (XT_SO_GET_ENTRIES+ARPT_CTL_OFFSET)
152/* #define ARPT_SO_GET_REVISION_MATCH (ARPT_BASE_CTL + 2)*/ 152/* #define ARPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH */
153#define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3) 153#define ARPT_SO_GET_REVISION_TARGET (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET)
154#define ARPT_SO_GET_MAX ARPT_SO_GET_REVISION_TARGET 154#define ARPT_SO_GET_MAX (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET)
155 155
156/* CONTINUE verdict for targets */ 156/* CONTINUE verdict for targets */
157#define ARPT_CONTINUE 0xFFFFFFFF 157#define ARPT_CONTINUE XT_CONTINUE
158 158
159/* For standard target */ 159/* For standard target */
160#define ARPT_RETURN (-NF_REPEAT - 1) 160#define ARPT_RETURN XT_RETURN
161 161
162/* The argument to ARPT_SO_GET_INFO */ 162/* The argument to ARPT_SO_GET_INFO */
163struct arpt_getinfo 163struct arpt_getinfo
@@ -208,23 +208,14 @@ struct arpt_replace
208 /* Number of counters (must be equal to current number of entries). */ 208 /* Number of counters (must be equal to current number of entries). */
209 unsigned int num_counters; 209 unsigned int num_counters;
210 /* The old entries' counters. */ 210 /* The old entries' counters. */
211 struct arpt_counters __user *counters; 211 struct xt_counters __user *counters;
212 212
213 /* The entries (hang off end: not really an array). */ 213 /* The entries (hang off end: not really an array). */
214 struct arpt_entry entries[0]; 214 struct arpt_entry entries[0];
215}; 215};
216 216
217/* The argument to ARPT_SO_ADD_COUNTERS. */ 217/* The argument to ARPT_SO_ADD_COUNTERS. */
218struct arpt_counters_info 218#define arpt_counters_info xt_counters_info
219{
220 /* Which table. */
221 char name[ARPT_TABLE_MAXNAMELEN];
222
223 unsigned int num_counters;
224
225 /* The counters (actually `number' of these). */
226 struct arpt_counters counters[0];
227};
228 219
229/* The argument to ARPT_SO_GET_ENTRIES. */ 220/* The argument to ARPT_SO_GET_ENTRIES. */
230struct arpt_get_entries 221struct arpt_get_entries
@@ -239,19 +230,10 @@ struct arpt_get_entries
239 struct arpt_entry entrytable[0]; 230 struct arpt_entry entrytable[0];
240}; 231};
241 232
242/* The argument to ARPT_SO_GET_REVISION_*. Returns highest revision
243 * kernel supports, if >= revision. */
244struct arpt_get_revision
245{
246 char name[ARPT_FUNCTION_MAXNAMELEN-1];
247
248 u_int8_t revision;
249};
250
251/* Standard return verdict, or do jump. */ 233/* Standard return verdict, or do jump. */
252#define ARPT_STANDARD_TARGET "" 234#define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
253/* Error verdict. */ 235/* Error verdict. */
254#define ARPT_ERROR_TARGET "ERROR" 236#define ARPT_ERROR_TARGET XT_ERROR_TARGET
255 237
256/* Helper functions */ 238/* Helper functions */
257static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e) 239static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e)
@@ -281,63 +263,8 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e
281 */ 263 */
282#ifdef __KERNEL__ 264#ifdef __KERNEL__
283 265
284/* Registration hooks for targets. */ 266#define arpt_register_target(tgt) xt_register_target(NF_ARP, tgt)
285struct arpt_target 267#define arpt_unregister_target(tgt) xt_unregister_target(NF_ARP, tgt)
286{
287 struct list_head list;
288
289 const char name[ARPT_FUNCTION_MAXNAMELEN-1];
290
291 u_int8_t revision;
292
293 /* Returns verdict. */
294 unsigned int (*target)(struct sk_buff **pskb,
295 unsigned int hooknum,
296 const struct net_device *in,
297 const struct net_device *out,
298 const void *targinfo,
299 void *userdata);
300
301 /* Called when user tries to insert an entry of this type:
302 hook_mask is a bitmask of hooks from which it can be
303 called. */
304 /* Should return true or false. */
305 int (*checkentry)(const char *tablename,
306 const struct arpt_entry *e,
307 void *targinfo,
308 unsigned int targinfosize,
309 unsigned int hook_mask);
310
311 /* Called when entry of this type deleted. */
312 void (*destroy)(void *targinfo, unsigned int targinfosize);
313
314 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
315 struct module *me;
316};
317
318extern int arpt_register_target(struct arpt_target *target);
319extern void arpt_unregister_target(struct arpt_target *target);
320
321/* Furniture shopping... */
322struct arpt_table
323{
324 struct list_head list;
325
326 /* A unique name... */
327 char name[ARPT_TABLE_MAXNAMELEN];
328
329 /* What hooks you will enter on */
330 unsigned int valid_hooks;
331
332 /* Lock for the curtain */
333 rwlock_t lock;
334
335 /* Man behind the curtain... */
336 struct arpt_table_info *private;
337
338 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
339 struct module *me;
340};
341 268
342extern int arpt_register_table(struct arpt_table *table, 269extern int arpt_register_table(struct arpt_table *table,
343 const struct arpt_replace *repl); 270 const struct arpt_replace *repl);
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index b3432ab59a17..215765f043e6 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -199,9 +199,6 @@ ip_conntrack_put(struct ip_conntrack *ct)
199 nf_conntrack_put(&ct->ct_general); 199 nf_conntrack_put(&ct->ct_general);
200} 200}
201 201
202/* call to create an explicit dependency on ip_conntrack. */
203extern void need_ip_conntrack(void);
204
205extern int invert_tuplepr(struct ip_conntrack_tuple *inverse, 202extern int invert_tuplepr(struct ip_conntrack_tuple *inverse,
206 const struct ip_conntrack_tuple *orig); 203 const struct ip_conntrack_tuple *orig);
207 204
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/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index d19d65cf4530..76ba24b68515 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -25,8 +25,14 @@
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/netfilter_ipv4.h> 26#include <linux/netfilter_ipv4.h>
27 27
28#define IPT_FUNCTION_MAXNAMELEN 30 28#include <linux/netfilter/x_tables.h>
29#define IPT_TABLE_MAXNAMELEN 32 29
30#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
31#define IPT_TABLE_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
32#define ipt_match xt_match
33#define ipt_target xt_target
34#define ipt_table xt_table
35#define ipt_get_revision xt_get_revision
30 36
31/* Yes, Virginia, you have to zero the padding. */ 37/* Yes, Virginia, you have to zero the padding. */
32struct ipt_ip { 38struct ipt_ip {
@@ -102,10 +108,7 @@ struct ipt_standard_target
102 int verdict; 108 int verdict;
103}; 109};
104 110
105struct ipt_counters 111#define ipt_counters xt_counters
106{
107 u_int64_t pcnt, bcnt; /* Packet and byte counters */
108};
109 112
110/* Values for "flag" field in struct ipt_ip (general ip structure). */ 113/* Values for "flag" field in struct ipt_ip (general ip structure). */
111#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */ 114#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */
@@ -119,7 +122,7 @@ struct ipt_counters
119#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ 122#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
120#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ 123#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
121#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */ 124#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */
122#define IPT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ 125#define IPT_INV_PROTO XT_INV_PROTO
123#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */ 126#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */
124 127
125/* This structure defines each of the firewall rules. Consists of 3 128/* This structure defines each of the firewall rules. Consists of 3
@@ -141,7 +144,7 @@ struct ipt_entry
141 unsigned int comefrom; 144 unsigned int comefrom;
142 145
143 /* Packet and byte counters. */ 146 /* Packet and byte counters. */
144 struct ipt_counters counters; 147 struct xt_counters counters;
145 148
146 /* The matches (if any), then the target. */ 149 /* The matches (if any), then the target. */
147 unsigned char elems[0]; 150 unsigned char elems[0];
@@ -151,54 +154,34 @@ struct ipt_entry
151 * New IP firewall options for [gs]etsockopt at the RAW IP level. 154 * New IP firewall options for [gs]etsockopt at the RAW IP level.
152 * Unlike BSD Linux inherits IP options so you don't have to use a raw 155 * Unlike BSD Linux inherits IP options so you don't have to use a raw
153 * socket for this. Instead we check rights in the calls. */ 156 * socket for this. Instead we check rights in the calls. */
154#define IPT_BASE_CTL 64 /* base for firewall socket options */ 157#define IPT_BASE_CTL XT_BASE_CTL
155 158
156#define IPT_SO_SET_REPLACE (IPT_BASE_CTL) 159#define IPT_SO_SET_REPLACE XT_SO_SET_REPLACE
157#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1) 160#define IPT_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS
158#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS 161#define IPT_SO_SET_MAX XT_SO_SET_MAX
159 162
160#define IPT_SO_GET_INFO (IPT_BASE_CTL) 163#define IPT_SO_GET_INFO XT_SO_GET_INFO
161#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1) 164#define IPT_SO_GET_ENTRIES XT_SO_GET_ENTRIES
162#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2) 165#define IPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH
163#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3) 166#define IPT_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET
164#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET 167#define IPT_SO_GET_MAX XT_SO_GET_REVISION_TARGET
165 168
166/* CONTINUE verdict for targets */ 169#define IPT_CONTINUE XT_CONTINUE
167#define IPT_CONTINUE 0xFFFFFFFF 170#define IPT_RETURN XT_RETURN
168 171
169/* For standard target */ 172#include <linux/netfilter/xt_tcpudp.h>
170#define IPT_RETURN (-NF_REPEAT - 1) 173#define ipt_udp xt_udp
174#define ipt_tcp xt_tcp
171 175
172/* TCP matching stuff */ 176#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT
173struct ipt_tcp 177#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT
174{ 178#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS
175 u_int16_t spts[2]; /* Source port range. */ 179#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION
176 u_int16_t dpts[2]; /* Destination port range. */ 180#define IPT_TCP_INV_MASK XT_TCP_INV_MASK
177 u_int8_t option; /* TCP Option iff non-zero*/
178 u_int8_t flg_mask; /* TCP flags mask byte */
179 u_int8_t flg_cmp; /* TCP flags compare byte */
180 u_int8_t invflags; /* Inverse flags */
181};
182
183/* Values for "inv" field in struct ipt_tcp. */
184#define IPT_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */
185#define IPT_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */
186#define IPT_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */
187#define IPT_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */
188#define IPT_TCP_INV_MASK 0x0F /* All possible flags. */
189
190/* UDP matching stuff */
191struct ipt_udp
192{
193 u_int16_t spts[2]; /* Source port range. */
194 u_int16_t dpts[2]; /* Destination port range. */
195 u_int8_t invflags; /* Inverse flags */
196};
197 181
198/* Values for "invflags" field in struct ipt_udp. */ 182#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT
199#define IPT_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 183#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT
200#define IPT_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 184#define IPT_UDP_INV_MASK XT_UDP_INV_MASK
201#define IPT_UDP_INV_MASK 0x03 /* All possible flags. */
202 185
203/* ICMP matching stuff */ 186/* ICMP matching stuff */
204struct ipt_icmp 187struct ipt_icmp
@@ -260,23 +243,14 @@ struct ipt_replace
260 /* Number of counters (must be equal to current number of entries). */ 243 /* Number of counters (must be equal to current number of entries). */
261 unsigned int num_counters; 244 unsigned int num_counters;
262 /* The old entries' counters. */ 245 /* The old entries' counters. */
263 struct ipt_counters __user *counters; 246 struct xt_counters __user *counters;
264 247
265 /* The entries (hang off end: not really an array). */ 248 /* The entries (hang off end: not really an array). */
266 struct ipt_entry entries[0]; 249 struct ipt_entry entries[0];
267}; 250};
268 251
269/* The argument to IPT_SO_ADD_COUNTERS. */ 252/* The argument to IPT_SO_ADD_COUNTERS. */
270struct ipt_counters_info 253#define ipt_counters_info xt_counters_info
271{
272 /* Which table. */
273 char name[IPT_TABLE_MAXNAMELEN];
274
275 unsigned int num_counters;
276
277 /* The counters (actually `number' of these). */
278 struct ipt_counters counters[0];
279};
280 254
281/* The argument to IPT_SO_GET_ENTRIES. */ 255/* The argument to IPT_SO_GET_ENTRIES. */
282struct ipt_get_entries 256struct ipt_get_entries
@@ -291,19 +265,10 @@ struct ipt_get_entries
291 struct ipt_entry entrytable[0]; 265 struct ipt_entry entrytable[0];
292}; 266};
293 267
294/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
295 * kernel supports, if >= revision. */
296struct ipt_get_revision
297{
298 char name[IPT_FUNCTION_MAXNAMELEN-1];
299
300 u_int8_t revision;
301};
302
303/* Standard return verdict, or do jump. */ 268/* Standard return verdict, or do jump. */
304#define IPT_STANDARD_TARGET "" 269#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
305/* Error verdict. */ 270/* Error verdict. */
306#define IPT_ERROR_TARGET "ERROR" 271#define IPT_ERROR_TARGET XT_ERROR_TARGET
307 272
308/* Helper functions */ 273/* Helper functions */
309static __inline__ struct ipt_entry_target * 274static __inline__ struct ipt_entry_target *
@@ -356,103 +321,18 @@ ipt_get_target(struct ipt_entry *e)
356#include <linux/init.h> 321#include <linux/init.h>
357extern void ipt_init(void) __init; 322extern void ipt_init(void) __init;
358 323
359struct ipt_match 324#define ipt_register_target(tgt) xt_register_target(AF_INET, tgt)
360{ 325#define ipt_unregister_target(tgt) xt_unregister_target(AF_INET, tgt)
361 struct list_head list;
362
363 const char name[IPT_FUNCTION_MAXNAMELEN-1];
364
365 u_int8_t revision;
366
367 /* Return true or false: return FALSE and set *hotdrop = 1 to
368 force immediate packet drop. */
369 /* Arguments changed since 2.4, as this must now handle
370 non-linear skbs, using skb_copy_bits and
371 skb_ip_make_writable. */
372 int (*match)(const struct sk_buff *skb,
373 const struct net_device *in,
374 const struct net_device *out,
375 const void *matchinfo,
376 int offset,
377 int *hotdrop);
378
379 /* Called when user tries to insert an entry of this type. */
380 /* Should return true or false. */
381 int (*checkentry)(const char *tablename,
382 const struct ipt_ip *ip,
383 void *matchinfo,
384 unsigned int matchinfosize,
385 unsigned int hook_mask);
386
387 /* Called when entry of this type deleted. */
388 void (*destroy)(void *matchinfo, unsigned int matchinfosize);
389
390 /* Set this to THIS_MODULE. */
391 struct module *me;
392};
393
394/* Registration hooks for targets. */
395struct ipt_target
396{
397 struct list_head list;
398
399 const char name[IPT_FUNCTION_MAXNAMELEN-1];
400
401 u_int8_t revision;
402
403 /* Called when user tries to insert an entry of this type:
404 hook_mask is a bitmask of hooks from which it can be
405 called. */
406 /* Should return true or false. */
407 int (*checkentry)(const char *tablename,
408 const struct ipt_entry *e,
409 void *targinfo,
410 unsigned int targinfosize,
411 unsigned int hook_mask);
412
413 /* Called when entry of this type deleted. */
414 void (*destroy)(void *targinfo, unsigned int targinfosize);
415
416 /* Returns verdict. Argument order changed since 2.4, as this
417 must now handle non-linear skbs, using skb_copy_bits and
418 skb_ip_make_writable. */
419 unsigned int (*target)(struct sk_buff **pskb,
420 const struct net_device *in,
421 const struct net_device *out,
422 unsigned int hooknum,
423 const void *targinfo,
424 void *userdata);
425
426 /* Set this to THIS_MODULE. */
427 struct module *me;
428};
429 326
430extern int ipt_register_target(struct ipt_target *target); 327#define ipt_register_match(mtch) xt_register_match(AF_INET, mtch)
431extern void ipt_unregister_target(struct ipt_target *target); 328#define ipt_unregister_match(mtch) xt_unregister_match(AF_INET, mtch)
432 329
433extern int ipt_register_match(struct ipt_match *match); 330//#define ipt_register_table(tbl, repl) xt_register_table(AF_INET, tbl, repl)
434extern void ipt_unregister_match(struct ipt_match *match); 331//#define ipt_unregister_table(tbl) xt_unregister_table(AF_INET, tbl)
435 332
436/* Furniture shopping... */ 333extern int ipt_register_table(struct ipt_table *table,
437struct ipt_table 334 const struct ipt_replace *repl);
438{ 335extern void ipt_unregister_table(struct ipt_table *table);
439 struct list_head list;
440
441 /* A unique name... */
442 char name[IPT_TABLE_MAXNAMELEN];
443
444 /* What hooks you will enter on */
445 unsigned int valid_hooks;
446
447 /* Lock for the curtain */
448 rwlock_t lock;
449
450 /* Man behind the curtain... */
451 struct ipt_table_info *private;
452
453 /* Set to THIS_MODULE. */
454 struct module *me;
455};
456 336
457/* net/sched/ipt.c: Gimme access to your targets! Gets target->me. */ 337/* net/sched/ipt.c: Gimme access to your targets! Gets target->me. */
458extern struct ipt_target *ipt_find_target(const char *name, u8 revision); 338extern struct ipt_target *ipt_find_target(const char *name, u8 revision);
@@ -476,9 +356,6 @@ struct ipt_error
476 struct ipt_error_target target; 356 struct ipt_error_target target;
477}; 357};
478 358
479extern int ipt_register_table(struct ipt_table *table,
480 const struct ipt_replace *repl);
481extern void ipt_unregister_table(struct ipt_table *table);
482extern unsigned int ipt_do_table(struct sk_buff **pskb, 359extern unsigned int ipt_do_table(struct sk_buff **pskb,
483 unsigned int hook, 360 unsigned int hook,
484 const struct net_device *in, 361 const struct net_device *in,
@@ -486,6 +363,6 @@ extern unsigned int ipt_do_table(struct sk_buff **pskb,
486 struct ipt_table *table, 363 struct ipt_table *table,
487 void *userdata); 364 void *userdata);
488 365
489#define IPT_ALIGN(s) (((s) + (__alignof__(struct ipt_entry)-1)) & ~(__alignof__(struct ipt_entry)-1)) 366#define IPT_ALIGN(s) XT_ALIGN(s)
490#endif /*__KERNEL__*/ 367#endif /*__KERNEL__*/
491#endif /* _IPTABLES_H */ 368#endif /* _IPTABLES_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
index 7596e3dd00ca..a46d511b5c36 100644
--- a/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
+++ b/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_CLASSIFY_H 1#ifndef _IPT_CLASSIFY_H
2#define _IPT_CLASSIFY_H 2#define _IPT_CLASSIFY_H
3 3
4struct ipt_classify_target_info { 4#include <linux/netfilter/xt_CLASSIFY.h>
5 u_int32_t priority; 5#define ipt_classify_target_info xt_classify_target_info
6};
7 6
8#endif /*_IPT_CLASSIFY_H */ 7#endif /*_IPT_CLASSIFY_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CONNMARK.h b/include/linux/netfilter_ipv4/ipt_CONNMARK.h
index d3c02536fc4c..9ecfee0a9e33 100644
--- a/include/linux/netfilter_ipv4/ipt_CONNMARK.h
+++ b/include/linux/netfilter_ipv4/ipt_CONNMARK.h
@@ -9,17 +9,11 @@
9 * the Free Software Foundation; either version 2 of the License, or 9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version. 10 * (at your option) any later version.
11 */ 11 */
12#include <linux/netfilter/xt_CONNMARK.h>
13#define IPT_CONNMARK_SET XT_CONNMARK_SET
14#define IPT_CONNMARK_SAVE XT_CONNMARK_SAVE
15#define IPT_CONNMARK_RESTORE XT_CONNMARK_RESTORE
12 16
13enum { 17#define ipt_connmark_target_info xt_connmark_target_info
14 IPT_CONNMARK_SET = 0,
15 IPT_CONNMARK_SAVE,
16 IPT_CONNMARK_RESTORE
17};
18
19struct ipt_connmark_target_info {
20 unsigned long mark;
21 unsigned long mask;
22 u_int8_t mode;
23};
24 18
25#endif /*_IPT_CONNMARK_H_target*/ 19#endif /*_IPT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_MARK.h b/include/linux/netfilter_ipv4/ipt_MARK.h
index f47485790ed4..697a486a96d3 100644
--- a/include/linux/netfilter_ipv4/ipt_MARK.h
+++ b/include/linux/netfilter_ipv4/ipt_MARK.h
@@ -1,20 +1,18 @@
1#ifndef _IPT_MARK_H_target 1#ifndef _IPT_MARK_H_target
2#define _IPT_MARK_H_target 2#define _IPT_MARK_H_target
3 3
4/* Backwards compatibility for old userspace */
5
6#include <linux/netfilter/xt_MARK.h>
7
4/* Version 0 */ 8/* Version 0 */
5struct ipt_mark_target_info { 9#define ipt_mark_target_info xt_mark_target_info
6 unsigned long mark;
7};
8 10
9/* Version 1 */ 11/* Version 1 */
10enum { 12#define IPT_MARK_SET XT_MARK_SET
11 IPT_MARK_SET=0, 13#define IPT_MARK_AND XT_MARK_AND
12 IPT_MARK_AND, 14#define IPT_MARK_OR XT_MARK_OR
13 IPT_MARK_OR 15
14}; 16#define ipt_mark_target_info_v1 xt_mark_target_info_v1
15 17
16struct ipt_mark_target_info_v1 {
17 unsigned long mark;
18 u_int8_t mode;
19};
20#endif /*_IPT_MARK_H_target*/ 18#endif /*_IPT_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
index b5b2943b0c66..97a2a7557cb9 100644
--- a/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
+++ b/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
@@ -8,9 +8,9 @@
8#ifndef _IPT_NFQ_TARGET_H 8#ifndef _IPT_NFQ_TARGET_H
9#define _IPT_NFQ_TARGET_H 9#define _IPT_NFQ_TARGET_H
10 10
11/* target info */ 11/* Backwards compatibility for old userspace */
12struct ipt_NFQ_info { 12#include <linux/netfilter/xt_NFQUEUE.h>
13 u_int16_t queuenum; 13
14}; 14#define ipt_NFQ_info xt_NFQ_info
15 15
16#endif /* _IPT_DSCP_TARGET_H */ 16#endif /* _IPT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter_ipv4/ipt_comment.h b/include/linux/netfilter_ipv4/ipt_comment.h
index 85c1123c29ce..ae2afc2f7481 100644
--- a/include/linux/netfilter_ipv4/ipt_comment.h
+++ b/include/linux/netfilter_ipv4/ipt_comment.h
@@ -1,10 +1,10 @@
1#ifndef _IPT_COMMENT_H 1#ifndef _IPT_COMMENT_H
2#define _IPT_COMMENT_H 2#define _IPT_COMMENT_H
3 3
4#define IPT_MAX_COMMENT_LEN 256 4#include <linux/netfilter/xt_comment.h>
5 5
6struct ipt_comment_info { 6#define IPT_MAX_COMMENT_LEN XT_MAX_COMMENT_LEN
7 unsigned char comment[IPT_MAX_COMMENT_LEN]; 7
8}; 8#define ipt_comment_info xt_comment_info
9 9
10#endif /* _IPT_COMMENT_H */ 10#endif /* _IPT_COMMENT_H */
diff --git a/include/linux/netfilter_ipv4/ipt_connbytes.h b/include/linux/netfilter_ipv4/ipt_connbytes.h
index 9e5532f8d8ac..b04dfa3083c9 100644
--- a/include/linux/netfilter_ipv4/ipt_connbytes.h
+++ b/include/linux/netfilter_ipv4/ipt_connbytes.h
@@ -1,25 +1,18 @@
1#ifndef _IPT_CONNBYTES_H 1#ifndef _IPT_CONNBYTES_H
2#define _IPT_CONNBYTES_H 2#define _IPT_CONNBYTES_H
3 3
4enum ipt_connbytes_what { 4#include <net/netfilter/xt_connbytes.h>
5 IPT_CONNBYTES_PKTS, 5#define ipt_connbytes_what xt_connbytes_what
6 IPT_CONNBYTES_BYTES,
7 IPT_CONNBYTES_AVGPKT,
8};
9 6
10enum ipt_connbytes_direction { 7#define IPT_CONNBYTES_PKTS XT_CONNBYTES_PACKETS
11 IPT_CONNBYTES_DIR_ORIGINAL, 8#define IPT_CONNBYTES_BYTES XT_CONNBYTES_BYTES
12 IPT_CONNBYTES_DIR_REPLY, 9#define IPT_CONNBYTES_AVGPKT XT_CONNBYTES_AVGPKT
13 IPT_CONNBYTES_DIR_BOTH, 10
14}; 11#define ipt_connbytes_direction xt_connbytes_direction
12#define IPT_CONNBYTES_DIR_ORIGINAL XT_CONNBYTES_DIR_ORIGINAL
13#define IPT_CONNBYTES_DIR_REPLY XT_CONNBYTES_DIR_REPLY
14#define IPT_CONNBYTES_DIR_BOTH XT_CONNBYTES_DIR_BOTH
15
16#define ipt_connbytes_info xt_connbytes_info
15 17
16struct ipt_connbytes_info
17{
18 struct {
19 aligned_u64 from; /* count to be matched */
20 aligned_u64 to; /* count to be matched */
21 } count;
22 u_int8_t what; /* ipt_connbytes_what */
23 u_int8_t direction; /* ipt_connbytes_direction */
24};
25#endif 18#endif
diff --git a/include/linux/netfilter_ipv4/ipt_connmark.h b/include/linux/netfilter_ipv4/ipt_connmark.h
index 46573270d9aa..c7ba6560d44c 100644
--- a/include/linux/netfilter_ipv4/ipt_connmark.h
+++ b/include/linux/netfilter_ipv4/ipt_connmark.h
@@ -1,18 +1,7 @@
1#ifndef _IPT_CONNMARK_H 1#ifndef _IPT_CONNMARK_H
2#define _IPT_CONNMARK_H 2#define _IPT_CONNMARK_H
3 3
4/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com> 4#include <linux/netfilter/xt_connmark.h>
5 * by Henrik Nordstrom <hno@marasystems.com> 5#define ipt_connmark_info xt_connmark_info
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
13struct ipt_connmark_info {
14 unsigned long mark, mask;
15 u_int8_t invert;
16};
17 6
18#endif /*_IPT_CONNMARK_H*/ 7#endif /*_IPT_CONNMARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_conntrack.h b/include/linux/netfilter_ipv4/ipt_conntrack.h
index 413c5658bd3a..cde6762949c5 100644
--- a/include/linux/netfilter_ipv4/ipt_conntrack.h
+++ b/include/linux/netfilter_ipv4/ipt_conntrack.h
@@ -5,56 +5,24 @@
5#ifndef _IPT_CONNTRACK_H 5#ifndef _IPT_CONNTRACK_H
6#define _IPT_CONNTRACK_H 6#define _IPT_CONNTRACK_H
7 7
8#define IPT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 8#include <linux/netfilter/xt_conntrack.h>
9#define IPT_CONNTRACK_STATE_INVALID (1 << 0)
10 9
11#define IPT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1)) 10#define IPT_CONNTRACK_STATE_BIT(ctinfo) XT_CONNTRACK_STATE_BIT(ctinfo)
12#define IPT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2)) 11#define IPT_CONNTRACK_STATE_INVALID XT_CONNTRACK_STATE_INVALID
13#define IPT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3))
14 12
15/* flags, invflags: */ 13#define IPT_CONNTRACK_STATE_SNAT XT_CONNTRACK_STATE_SNAT
16#define IPT_CONNTRACK_STATE 0x01 14#define IPT_CONNTRACK_STATE_DNAT XT_CONNTRACK_STATE_DNAT
17#define IPT_CONNTRACK_PROTO 0x02 15#define IPT_CONNTRACK_STATE_UNTRACKED XT_CONNTRACK_STATE_UNTRACKED
18#define IPT_CONNTRACK_ORIGSRC 0x04
19#define IPT_CONNTRACK_ORIGDST 0x08
20#define IPT_CONNTRACK_REPLSRC 0x10
21#define IPT_CONNTRACK_REPLDST 0x20
22#define IPT_CONNTRACK_STATUS 0x40
23#define IPT_CONNTRACK_EXPIRES 0x80
24
25/* This is exposed to userspace, so remains frozen in time. */
26struct ip_conntrack_old_tuple
27{
28 struct {
29 __u32 ip;
30 union {
31 __u16 all;
32 } u;
33 } src;
34
35 struct {
36 __u32 ip;
37 union {
38 __u16 all;
39 } u;
40
41 /* The protocol. */
42 u16 protonum;
43 } dst;
44};
45 16
46struct ipt_conntrack_info 17/* flags, invflags: */
47{ 18#define IPT_CONNTRACK_STATE XT_CONNTRACK_STATE
48 unsigned int statemask, statusmask; 19#define IPT_CONNTRACK_PROTO XT_CONNTRACK_PROTO
49 20#define IPT_CONNTRACK_ORIGSRC XT_CONNTRACK_ORIGSRC
50 struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX]; 21#define IPT_CONNTRACK_ORIGDST XT_CONNTRACK_ORIGDST
51 struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX]; 22#define IPT_CONNTRACK_REPLSRC XT_CONNTRACK_REPLSRC
52 23#define IPT_CONNTRACK_REPLDST XT_CONNTRACK_REPLDST
53 unsigned long expires_min, expires_max; 24#define IPT_CONNTRACK_STATUS XT_CONNTRACK_STATUS
54 25#define IPT_CONNTRACK_EXPIRES XT_CONNTRACK_EXPIRES
55 /* Flags word */ 26
56 u_int8_t flags; 27#define ipt_conntrack_info xt_conntrack_info
57 /* Inverse flags */
58 u_int8_t invflags;
59};
60#endif /*_IPT_CONNTRACK_H*/ 28#endif /*_IPT_CONNTRACK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_dccp.h b/include/linux/netfilter_ipv4/ipt_dccp.h
index 3cb3a522e62b..e70d11e1f53c 100644
--- a/include/linux/netfilter_ipv4/ipt_dccp.h
+++ b/include/linux/netfilter_ipv4/ipt_dccp.h
@@ -1,23 +1,15 @@
1#ifndef _IPT_DCCP_H_ 1#ifndef _IPT_DCCP_H_
2#define _IPT_DCCP_H_ 2#define _IPT_DCCP_H_
3 3
4#define IPT_DCCP_SRC_PORTS 0x01 4#include <linux/netfilter/xt_dccp.h>
5#define IPT_DCCP_DEST_PORTS 0x02 5#define IPT_DCCP_SRC_PORTS XT_DCCP_SRC_PORTS
6#define IPT_DCCP_TYPE 0x04 6#define IPT_DCCP_DEST_PORTS XT_DCCP_DEST_PORTS
7#define IPT_DCCP_OPTION 0x08 7#define IPT_DCCP_TYPE XT_DCCP_TYPE
8#define IPT_DCCP_OPTION XT_DCCP_OPTION
8 9
9#define IPT_DCCP_VALID_FLAGS 0x0f 10#define IPT_DCCP_VALID_FLAGS XT_DCCP_VALID_FLAGS
10 11
11struct ipt_dccp_info { 12#define ipt_dccp_info xt_dccp_info
12 u_int16_t dpts[2]; /* Min, Max */
13 u_int16_t spts[2]; /* Min, Max */
14
15 u_int16_t flags;
16 u_int16_t invflags;
17
18 u_int16_t typemask;
19 u_int8_t option;
20};
21 13
22#endif /* _IPT_DCCP_H_ */ 14#endif /* _IPT_DCCP_H_ */
23 15
diff --git a/include/linux/netfilter_ipv4/ipt_helper.h b/include/linux/netfilter_ipv4/ipt_helper.h
index 6f12ecb8c93d..80452c218551 100644
--- a/include/linux/netfilter_ipv4/ipt_helper.h
+++ b/include/linux/netfilter_ipv4/ipt_helper.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_HELPER_H 1#ifndef _IPT_HELPER_H
2#define _IPT_HELPER_H 2#define _IPT_HELPER_H
3 3
4struct ipt_helper_info { 4#include <linux/netfilter/xt_helper.h>
5 int invert; 5#define ipt_helper_info xt_helper_info
6 char name[30]; 6
7};
8#endif /* _IPT_HELPER_H */ 7#endif /* _IPT_HELPER_H */
diff --git a/include/linux/netfilter_ipv4/ipt_length.h b/include/linux/netfilter_ipv4/ipt_length.h
index 6e0885229615..9b45206ffcef 100644
--- a/include/linux/netfilter_ipv4/ipt_length.h
+++ b/include/linux/netfilter_ipv4/ipt_length.h
@@ -1,9 +1,7 @@
1#ifndef _IPT_LENGTH_H 1#ifndef _IPT_LENGTH_H
2#define _IPT_LENGTH_H 2#define _IPT_LENGTH_H
3 3
4struct ipt_length_info { 4#include <linux/netfilter/xt_length.h>
5 u_int16_t min, max; 5#define ipt_length_info xt_length_info
6 u_int8_t invert;
7};
8 6
9#endif /*_IPT_LENGTH_H*/ 7#endif /*_IPT_LENGTH_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_limit.h b/include/linux/netfilter_ipv4/ipt_limit.h
index 256453409e21..92f5cd07bbc4 100644
--- a/include/linux/netfilter_ipv4/ipt_limit.h
+++ b/include/linux/netfilter_ipv4/ipt_limit.h
@@ -1,21 +1,8 @@
1#ifndef _IPT_RATE_H 1#ifndef _IPT_RATE_H
2#define _IPT_RATE_H 2#define _IPT_RATE_H
3 3
4/* timings are in milliseconds. */ 4#include <linux/netfilter/xt_limit.h>
5#define IPT_LIMIT_SCALE 10000 5#define IPT_LIMIT_SCALE XT_LIMIT_SCALE
6#define ipt_rateinfo xt_rateinfo
6 7
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
8 seconds, or one every 59 hours. */
9struct ipt_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */
12
13 /* Used internally by the kernel */
14 unsigned long prev;
15 u_int32_t credit;
16 u_int32_t credit_cap, cost;
17
18 /* Ugly, ugly fucker. */
19 struct ipt_rateinfo *master;
20};
21#endif /*_IPT_RATE_H*/ 8#endif /*_IPT_RATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mac.h b/include/linux/netfilter_ipv4/ipt_mac.h
index f8d5b8e7ccdb..b186008a3c47 100644
--- a/include/linux/netfilter_ipv4/ipt_mac.h
+++ b/include/linux/netfilter_ipv4/ipt_mac.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_MAC_H 1#ifndef _IPT_MAC_H
2#define _IPT_MAC_H 2#define _IPT_MAC_H
3 3
4struct ipt_mac_info { 4#include <linux/netfilter/xt_mac.h>
5 unsigned char srcaddr[ETH_ALEN]; 5#define ipt_mac_info xt_mac_info
6 int invert; 6
7};
8#endif /*_IPT_MAC_H*/ 7#endif /*_IPT_MAC_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_mark.h b/include/linux/netfilter_ipv4/ipt_mark.h
index f3952b563d4c..bfde67c61224 100644
--- a/include/linux/netfilter_ipv4/ipt_mark.h
+++ b/include/linux/netfilter_ipv4/ipt_mark.h
@@ -1,9 +1,9 @@
1#ifndef _IPT_MARK_H 1#ifndef _IPT_MARK_H
2#define _IPT_MARK_H 2#define _IPT_MARK_H
3 3
4struct ipt_mark_info { 4/* Backwards compatibility for old userspace */
5 unsigned long mark, mask; 5#include <linux/netfilter/xt_mark.h>
6 u_int8_t invert; 6
7}; 7#define ipt_mark_info xt_mark_info
8 8
9#endif /*_IPT_MARK_H*/ 9#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_physdev.h b/include/linux/netfilter_ipv4/ipt_physdev.h
index 7538c8655ec0..2400e7140f26 100644
--- a/include/linux/netfilter_ipv4/ipt_physdev.h
+++ b/include/linux/netfilter_ipv4/ipt_physdev.h
@@ -1,24 +1,17 @@
1#ifndef _IPT_PHYSDEV_H 1#ifndef _IPT_PHYSDEV_H
2#define _IPT_PHYSDEV_H 2#define _IPT_PHYSDEV_H
3 3
4#ifdef __KERNEL__ 4/* Backwards compatibility for old userspace */
5#include <linux/if.h>
6#endif
7 5
8#define IPT_PHYSDEV_OP_IN 0x01 6#include <linux/netfilter/xt_physdev.h>
9#define IPT_PHYSDEV_OP_OUT 0x02
10#define IPT_PHYSDEV_OP_BRIDGED 0x04
11#define IPT_PHYSDEV_OP_ISIN 0x08
12#define IPT_PHYSDEV_OP_ISOUT 0x10
13#define IPT_PHYSDEV_OP_MASK (0x20 - 1)
14 7
15struct ipt_physdev_info { 8#define IPT_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN
16 char physindev[IFNAMSIZ]; 9#define IPT_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT
17 char in_mask[IFNAMSIZ]; 10#define IPT_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED
18 char physoutdev[IFNAMSIZ]; 11#define IPT_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN
19 char out_mask[IFNAMSIZ]; 12#define IPT_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT
20 u_int8_t invert; 13#define IPT_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK
21 u_int8_t bitmask; 14
22}; 15#define ipt_physdev_info xt_physdev_info
23 16
24#endif /*_IPT_PHYSDEV_H*/ 17#endif /*_IPT_PHYSDEV_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_pkttype.h b/include/linux/netfilter_ipv4/ipt_pkttype.h
index d53a65848683..ff1fbc949a0c 100644
--- a/include/linux/netfilter_ipv4/ipt_pkttype.h
+++ b/include/linux/netfilter_ipv4/ipt_pkttype.h
@@ -1,8 +1,7 @@
1#ifndef _IPT_PKTTYPE_H 1#ifndef _IPT_PKTTYPE_H
2#define _IPT_PKTTYPE_H 2#define _IPT_PKTTYPE_H
3 3
4struct ipt_pkttype_info { 4#include <linux/netfilter/xt_pkttype.h>
5 int pkttype; 5#define ipt_pkttype_info xt_pkttype_info
6 int invert; 6
7};
8#endif /*_IPT_PKTTYPE_H*/ 7#endif /*_IPT_PKTTYPE_H*/
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_ipv4/ipt_realm.h b/include/linux/netfilter_ipv4/ipt_realm.h
index a4d6698723ac..b3996eaa0188 100644
--- a/include/linux/netfilter_ipv4/ipt_realm.h
+++ b/include/linux/netfilter_ipv4/ipt_realm.h
@@ -1,10 +1,7 @@
1#ifndef _IPT_REALM_H 1#ifndef _IPT_REALM_H
2#define _IPT_REALM_H 2#define _IPT_REALM_H
3 3
4struct ipt_realm_info { 4#include <linux/netfilter/xt_realm.h>
5 u_int32_t id; 5#define ipt_realm_info xt_realm_info
6 u_int32_t mask;
7 u_int8_t invert;
8};
9 6
10#endif /* _IPT_REALM_H */ 7#endif /* _IPT_REALM_H */
diff --git a/include/linux/netfilter_ipv4/ipt_state.h b/include/linux/netfilter_ipv4/ipt_state.h
index 5df37868933d..a44a99cc28cc 100644
--- a/include/linux/netfilter_ipv4/ipt_state.h
+++ b/include/linux/netfilter_ipv4/ipt_state.h
@@ -1,13 +1,15 @@
1#ifndef _IPT_STATE_H 1#ifndef _IPT_STATE_H
2#define _IPT_STATE_H 2#define _IPT_STATE_H
3 3
4#define IPT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 4/* Backwards compatibility for old userspace */
5#define IPT_STATE_INVALID (1 << 0)
6 5
7#define IPT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) 6#include <linux/netfilter/xt_state.h>
7
8#define IPT_STATE_BIT XT_STATE_BIT
9#define IPT_STATE_INVALID XT_STATE_INVALID
10
11#define IPT_STATE_UNTRACKED XT_STATE_UNTRACKED
12
13#define ipt_state_info xt_state_info
8 14
9struct ipt_state_info
10{
11 unsigned int statemask;
12};
13#endif /*_IPT_STATE_H*/ 15#endif /*_IPT_STATE_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_string.h b/include/linux/netfilter_ipv4/ipt_string.h
index a265f6e44eab..c26de3059903 100644
--- a/include/linux/netfilter_ipv4/ipt_string.h
+++ b/include/linux/netfilter_ipv4/ipt_string.h
@@ -1,18 +1,10 @@
1#ifndef _IPT_STRING_H 1#ifndef _IPT_STRING_H
2#define _IPT_STRING_H 2#define _IPT_STRING_H
3 3
4#define IPT_STRING_MAX_PATTERN_SIZE 128 4#include <linux/netfilter/xt_string.h>
5#define IPT_STRING_MAX_ALGO_NAME_SIZE 16
6 5
7struct ipt_string_info 6#define IPT_STRING_MAX_PATTERN_SIZE XT_STRING_MAX_PATTERN_SIZE
8{ 7#define IPT_STRING_MAX_ALGO_NAME_SIZE XT_STRING_MAX_ALGO_NAME_SIZE
9 u_int16_t from_offset; 8#define ipt_string_info xt_string_info
10 u_int16_t to_offset;
11 char algo[IPT_STRING_MAX_ALGO_NAME_SIZE];
12 char pattern[IPT_STRING_MAX_PATTERN_SIZE];
13 u_int8_t patlen;
14 u_int8_t invert;
15 struct ts_config __attribute__((aligned(8))) *config;
16};
17 9
18#endif /*_IPT_STRING_H*/ 10#endif /*_IPT_STRING_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_tcpmss.h b/include/linux/netfilter_ipv4/ipt_tcpmss.h
index e2b14397f701..18bbc8e8e009 100644
--- a/include/linux/netfilter_ipv4/ipt_tcpmss.h
+++ b/include/linux/netfilter_ipv4/ipt_tcpmss.h
@@ -1,9 +1,7 @@
1#ifndef _IPT_TCPMSS_MATCH_H 1#ifndef _IPT_TCPMSS_MATCH_H
2#define _IPT_TCPMSS_MATCH_H 2#define _IPT_TCPMSS_MATCH_H
3 3
4struct ipt_tcpmss_match_info { 4#include <linux/netfilter/xt_tcpmss.h>
5 u_int16_t mss_min, mss_max; 5#define ipt_tcpmss_match_info xt_tcpmss_match_info
6 u_int8_t invert;
7};
8 6
9#endif /*_IPT_TCPMSS_MATCH_H*/ 7#endif /*_IPT_TCPMSS_MATCH_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 c163ba31aab7..f249b574f0fa 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -25,8 +25,15 @@
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/netfilter_ipv6.h> 26#include <linux/netfilter_ipv6.h>
27 27
28#define IP6T_FUNCTION_MAXNAMELEN 30 28#include <linux/netfilter/x_tables.h>
29#define IP6T_TABLE_MAXNAMELEN 32 29
30#define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
31#define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
32
33#define ip6t_match xt_match
34#define ip6t_target xt_target
35#define ip6t_table xt_table
36#define ip6t_get_revision xt_get_revision
30 37
31/* Yes, Virginia, you have to zero the padding. */ 38/* Yes, Virginia, you have to zero the padding. */
32struct ip6t_ip6 { 39struct ip6t_ip6 {
@@ -104,10 +111,7 @@ struct ip6t_standard_target
104 int verdict; 111 int verdict;
105}; 112};
106 113
107struct ip6t_counters 114#define ip6t_counters xt_counters
108{
109 u_int64_t pcnt, bcnt; /* Packet and byte counters */
110};
111 115
112/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */ 116/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */
113#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper 117#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper
@@ -123,7 +127,7 @@ struct ip6t_counters
123#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */ 127#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
124#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */ 128#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
125#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */ 129#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */
126#define IP6T_INV_PROTO 0x40 /* Invert the sense of PROTO. */ 130#define IP6T_INV_PROTO XT_INV_PROTO
127#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */ 131#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */
128 132
129/* This structure defines each of the firewall rules. Consists of 3 133/* This structure defines each of the firewall rules. Consists of 3
@@ -145,7 +149,7 @@ struct ip6t_entry
145 unsigned int comefrom; 149 unsigned int comefrom;
146 150
147 /* Packet and byte counters. */ 151 /* Packet and byte counters. */
148 struct ip6t_counters counters; 152 struct xt_counters counters;
149 153
150 /* The matches (if any), then the target. */ 154 /* The matches (if any), then the target. */
151 unsigned char elems[0]; 155 unsigned char elems[0];
@@ -155,54 +159,41 @@ struct ip6t_entry
155 * New IP firewall options for [gs]etsockopt at the RAW IP level. 159 * New IP firewall options for [gs]etsockopt at the RAW IP level.
156 * Unlike BSD Linux inherits IP options so you don't have to use 160 * Unlike BSD Linux inherits IP options so you don't have to use
157 * a raw socket for this. Instead we check rights in the calls. */ 161 * a raw socket for this. Instead we check rights in the calls. */
158#define IP6T_BASE_CTL 64 /* base for firewall socket options */ 162#define IP6T_BASE_CTL XT_BASE_CTL
159 163
160#define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL) 164#define IP6T_SO_SET_REPLACE XT_SO_SET_REPLACE
161#define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1) 165#define IP6T_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS
162#define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS 166#define IP6T_SO_SET_MAX XT_SO_SET_MAX
163 167
164#define IP6T_SO_GET_INFO (IP6T_BASE_CTL) 168#define IP6T_SO_GET_INFO XT_SO_GET_INFO
165#define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1) 169#define IP6T_SO_GET_ENTRIES XT_SO_GET_ENTRIES
166#define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 2) 170#define IP6T_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH
167#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 3) 171#define IP6T_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET
168#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET 172#define IP6T_SO_GET_MAX XT_SO_GET_REVISION_TARGET
169 173
170/* CONTINUE verdict for targets */ 174/* CONTINUE verdict for targets */
171#define IP6T_CONTINUE 0xFFFFFFFF 175#define IP6T_CONTINUE XT_CONTINUE
172 176
173/* For standard target */ 177/* For standard target */
174#define IP6T_RETURN (-NF_REPEAT - 1) 178#define IP6T_RETURN XT_RETURN
175 179
176/* TCP matching stuff */ 180/* TCP/UDP matching stuff */
177struct ip6t_tcp 181#include <linux/netfilter/xt_tcpudp.h>
178{ 182
179 u_int16_t spts[2]; /* Source port range. */ 183#define ip6t_tcp xt_tcp
180 u_int16_t dpts[2]; /* Destination port range. */ 184#define ip6t_udp xt_udp
181 u_int8_t option; /* TCP Option iff non-zero*/
182 u_int8_t flg_mask; /* TCP flags mask byte */
183 u_int8_t flg_cmp; /* TCP flags compare byte */
184 u_int8_t invflags; /* Inverse flags */
185};
186 185
187/* Values for "inv" field in struct ipt_tcp. */ 186/* Values for "inv" field in struct ipt_tcp. */
188#define IP6T_TCP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 187#define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT
189#define IP6T_TCP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 188#define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT
190#define IP6T_TCP_INV_FLAGS 0x04 /* Invert the sense of TCP flags. */ 189#define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS
191#define IP6T_TCP_INV_OPTION 0x08 /* Invert the sense of option test. */ 190#define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION
192#define IP6T_TCP_INV_MASK 0x0F /* All possible flags. */ 191#define IP6T_TCP_INV_MASK XT_TCP_INV_MASK
193
194/* UDP matching stuff */
195struct ip6t_udp
196{
197 u_int16_t spts[2]; /* Source port range. */
198 u_int16_t dpts[2]; /* Destination port range. */
199 u_int8_t invflags; /* Inverse flags */
200};
201 192
202/* Values for "invflags" field in struct ipt_udp. */ 193/* Values for "invflags" field in struct ipt_udp. */
203#define IP6T_UDP_INV_SRCPT 0x01 /* Invert the sense of source ports. */ 194#define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT
204#define IP6T_UDP_INV_DSTPT 0x02 /* Invert the sense of dest ports. */ 195#define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT
205#define IP6T_UDP_INV_MASK 0x03 /* All possible flags. */ 196#define IP6T_UDP_INV_MASK XT_UDP_INV_MASK
206 197
207/* ICMP matching stuff */ 198/* ICMP matching stuff */
208struct ip6t_icmp 199struct ip6t_icmp
@@ -264,23 +255,14 @@ struct ip6t_replace
264 /* Number of counters (must be equal to current number of entries). */ 255 /* Number of counters (must be equal to current number of entries). */
265 unsigned int num_counters; 256 unsigned int num_counters;
266 /* The old entries' counters. */ 257 /* The old entries' counters. */
267 struct ip6t_counters __user *counters; 258 struct xt_counters __user *counters;
268 259
269 /* The entries (hang off end: not really an array). */ 260 /* The entries (hang off end: not really an array). */
270 struct ip6t_entry entries[0]; 261 struct ip6t_entry entries[0];
271}; 262};
272 263
273/* The argument to IP6T_SO_ADD_COUNTERS. */ 264/* The argument to IP6T_SO_ADD_COUNTERS. */
274struct ip6t_counters_info 265#define ip6t_counters_info xt_counters_info
275{
276 /* Which table. */
277 char name[IP6T_TABLE_MAXNAMELEN];
278
279 unsigned int num_counters;
280
281 /* The counters (actually `number' of these). */
282 struct ip6t_counters counters[0];
283};
284 266
285/* The argument to IP6T_SO_GET_ENTRIES. */ 267/* The argument to IP6T_SO_GET_ENTRIES. */
286struct ip6t_get_entries 268struct ip6t_get_entries
@@ -295,19 +277,10 @@ struct ip6t_get_entries
295 struct ip6t_entry entrytable[0]; 277 struct ip6t_entry entrytable[0];
296}; 278};
297 279
298/* The argument to IP6T_SO_GET_REVISION_*. Returns highest revision
299 * kernel supports, if >= revision. */
300struct ip6t_get_revision
301{
302 char name[IP6T_FUNCTION_MAXNAMELEN-1];
303
304 u_int8_t revision;
305};
306
307/* Standard return verdict, or do jump. */ 280/* Standard return verdict, or do jump. */
308#define IP6T_STANDARD_TARGET "" 281#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
309/* Error verdict. */ 282/* Error verdict. */
310#define IP6T_ERROR_TARGET "ERROR" 283#define IP6T_ERROR_TARGET XT_ERROR_TARGET
311 284
312/* Helper functions */ 285/* Helper functions */
313static __inline__ struct ip6t_entry_target * 286static __inline__ struct ip6t_entry_target *
@@ -361,104 +334,11 @@ ip6t_get_target(struct ip6t_entry *e)
361#include <linux/init.h> 334#include <linux/init.h>
362extern void ip6t_init(void) __init; 335extern void ip6t_init(void) __init;
363 336
364struct ip6t_match 337#define ip6t_register_target(tgt) xt_register_target(AF_INET6, tgt)
365{ 338#define ip6t_unregister_target(tgt) xt_unregister_target(AF_INET6, tgt)
366 struct list_head list;
367
368 const char name[IP6T_FUNCTION_MAXNAMELEN-1];
369
370 u_int8_t revision;
371
372 /* Return true or false: return FALSE and set *hotdrop = 1 to
373 force immediate packet drop. */
374 /* Arguments changed since 2.6.9, as this must now handle
375 non-linear skb, using skb_header_pointer and
376 skb_ip_make_writable. */
377 int (*match)(const struct sk_buff *skb,
378 const struct net_device *in,
379 const struct net_device *out,
380 const void *matchinfo,
381 int offset,
382 unsigned int protoff,
383 int *hotdrop);
384
385 /* Called when user tries to insert an entry of this type. */
386 /* Should return true or false. */
387 int (*checkentry)(const char *tablename,
388 const struct ip6t_ip6 *ip,
389 void *matchinfo,
390 unsigned int matchinfosize,
391 unsigned int hook_mask);
392
393 /* Called when entry of this type deleted. */
394 void (*destroy)(void *matchinfo, unsigned int matchinfosize);
395
396 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
397 struct module *me;
398};
399
400/* Registration hooks for targets. */
401struct ip6t_target
402{
403 struct list_head list;
404
405 const char name[IP6T_FUNCTION_MAXNAMELEN-1];
406
407 u_int8_t revision;
408
409 /* Returns verdict. Argument order changed since 2.6.9, as this
410 must now handle non-linear skbs, using skb_copy_bits and
411 skb_ip_make_writable. */
412 unsigned int (*target)(struct sk_buff **pskb,
413 const struct net_device *in,
414 const struct net_device *out,
415 unsigned int hooknum,
416 const void *targinfo,
417 void *userdata);
418
419 /* Called when user tries to insert an entry of this type:
420 hook_mask is a bitmask of hooks from which it can be
421 called. */
422 /* Should return true or false. */
423 int (*checkentry)(const char *tablename,
424 const struct ip6t_entry *e,
425 void *targinfo,
426 unsigned int targinfosize,
427 unsigned int hook_mask);
428
429 /* Called when entry of this type deleted. */
430 void (*destroy)(void *targinfo, unsigned int targinfosize);
431
432 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
433 struct module *me;
434};
435
436extern int ip6t_register_target(struct ip6t_target *target);
437extern void ip6t_unregister_target(struct ip6t_target *target);
438
439extern int ip6t_register_match(struct ip6t_match *match);
440extern void ip6t_unregister_match(struct ip6t_match *match);
441 339
442/* Furniture shopping... */ 340#define ip6t_register_match(match) xt_register_match(AF_INET6, match)
443struct ip6t_table 341#define ip6t_unregister_match(match) xt_unregister_match(AF_INET6, match)
444{
445 struct list_head list;
446
447 /* A unique name... */
448 char name[IP6T_TABLE_MAXNAMELEN];
449
450 /* What hooks you will enter on */
451 unsigned int valid_hooks;
452
453 /* Lock for the curtain */
454 rwlock_t lock;
455
456 /* Man behind the curtain... */
457 struct ip6t_table_info *private;
458
459 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
460 struct module *me;
461};
462 342
463extern int ip6t_register_table(struct ip6t_table *table, 343extern int ip6t_register_table(struct ip6t_table *table,
464 const struct ip6t_replace *repl); 344 const struct ip6t_replace *repl);
diff --git a/include/linux/netfilter_ipv6/ip6t_MARK.h b/include/linux/netfilter_ipv6/ip6t_MARK.h
index 7ade8d8f5246..7cf629a8ab92 100644
--- a/include/linux/netfilter_ipv6/ip6t_MARK.h
+++ b/include/linux/netfilter_ipv6/ip6t_MARK.h
@@ -1,8 +1,9 @@
1#ifndef _IP6T_MARK_H_target 1#ifndef _IP6T_MARK_H_target
2#define _IP6T_MARK_H_target 2#define _IP6T_MARK_H_target
3 3
4struct ip6t_mark_target_info { 4/* Backwards compatibility for old userspace */
5 unsigned long mark; 5#include <linux/netfilter/xt_MARK.h>
6};
7 6
8#endif /*_IPT_MARK_H_target*/ 7#define ip6t_mark_target_info xt_mark_target_info
8
9#endif /*_IP6T_MARK_H_target*/
diff --git a/include/linux/netfilter_ipv6/ip6t_ah.h b/include/linux/netfilter_ipv6/ip6t_ah.h
index c4f0793a0a98..8531879eb464 100644
--- a/include/linux/netfilter_ipv6/ip6t_ah.h
+++ b/include/linux/netfilter_ipv6/ip6t_ah.h
@@ -18,13 +18,4 @@ struct ip6t_ah
18#define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */ 18#define IP6T_AH_INV_LEN 0x02 /* Invert the sense of length. */
19#define IP6T_AH_INV_MASK 0x03 /* All possible flags. */ 19#define IP6T_AH_INV_MASK 0x03 /* All possible flags. */
20 20
21#define MASK_HOPOPTS 128
22#define MASK_DSTOPTS 64
23#define MASK_ROUTING 32
24#define MASK_FRAGMENT 16
25#define MASK_AH 8
26#define MASK_ESP 4
27#define MASK_NONE 2
28#define MASK_PROTO 1
29
30#endif /*_IP6T_AH_H*/ 21#endif /*_IP6T_AH_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_esp.h b/include/linux/netfilter_ipv6/ip6t_esp.h
index 01142b98a231..a91b6abc8079 100644
--- a/include/linux/netfilter_ipv6/ip6t_esp.h
+++ b/include/linux/netfilter_ipv6/ip6t_esp.h
@@ -7,15 +7,6 @@ struct ip6t_esp
7 u_int8_t invflags; /* Inverse flags */ 7 u_int8_t invflags; /* Inverse flags */
8}; 8};
9 9
10#define MASK_HOPOPTS 128
11#define MASK_DSTOPTS 64
12#define MASK_ROUTING 32
13#define MASK_FRAGMENT 16
14#define MASK_AH 8
15#define MASK_ESP 4
16#define MASK_NONE 2
17#define MASK_PROTO 1
18
19/* Values for "invflags" field in struct ip6t_esp. */ 10/* Values for "invflags" field in struct ip6t_esp. */
20#define IP6T_ESP_INV_SPI 0x01 /* Invert the sense of spi. */ 11#define IP6T_ESP_INV_SPI 0x01 /* Invert the sense of spi. */
21#define IP6T_ESP_INV_MASK 0x01 /* All possible flags. */ 12#define IP6T_ESP_INV_MASK 0x01 /* All possible flags. */
diff --git a/include/linux/netfilter_ipv6/ip6t_frag.h b/include/linux/netfilter_ipv6/ip6t_frag.h
index 449a57eca7dd..66070a0d6dfc 100644
--- a/include/linux/netfilter_ipv6/ip6t_frag.h
+++ b/include/linux/netfilter_ipv6/ip6t_frag.h
@@ -21,13 +21,4 @@ struct ip6t_frag
21#define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */ 21#define IP6T_FRAG_INV_LEN 0x02 /* Invert the sense of length. */
22#define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */ 22#define IP6T_FRAG_INV_MASK 0x03 /* All possible flags. */
23 23
24#define MASK_HOPOPTS 128
25#define MASK_DSTOPTS 64
26#define MASK_ROUTING 32
27#define MASK_FRAGMENT 16
28#define MASK_AH 8
29#define MASK_ESP 4
30#define MASK_NONE 2
31#define MASK_PROTO 1
32
33#endif /*_IP6T_FRAG_H*/ 24#endif /*_IP6T_FRAG_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_length.h b/include/linux/netfilter_ipv6/ip6t_length.h
index 7fc09f9f9d63..9e9689d03ed7 100644
--- a/include/linux/netfilter_ipv6/ip6t_length.h
+++ b/include/linux/netfilter_ipv6/ip6t_length.h
@@ -1,10 +1,8 @@
1#ifndef _IP6T_LENGTH_H 1#ifndef _IP6T_LENGTH_H
2#define _IP6T_LENGTH_H 2#define _IP6T_LENGTH_H
3 3
4struct ip6t_length_info { 4#include <linux/netfilter/xt_length.h>
5 u_int16_t min, max; 5#define ip6t_length_info xt_length_info
6 u_int8_t invert;
7};
8 6
9#endif /*_IP6T_LENGTH_H*/ 7#endif /*_IP6T_LENGTH_H*/
10 8
diff --git a/include/linux/netfilter_ipv6/ip6t_limit.h b/include/linux/netfilter_ipv6/ip6t_limit.h
index f2866e50f3b4..487e5ea342c6 100644
--- a/include/linux/netfilter_ipv6/ip6t_limit.h
+++ b/include/linux/netfilter_ipv6/ip6t_limit.h
@@ -1,21 +1,8 @@
1#ifndef _IP6T_RATE_H 1#ifndef _IP6T_RATE_H
2#define _IP6T_RATE_H 2#define _IP6T_RATE_H
3 3
4/* timings are in milliseconds. */ 4#include <linux/netfilter/xt_limit.h>
5#define IP6T_LIMIT_SCALE 10000 5#define IP6T_LIMIT_SCALE XT_LIMIT_SCALE
6#define ip6t_rateinfo xt_rateinfo
6 7
7/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 8#endif /*_IP6T_RATE_H*/
8 seconds, or one every 59 hours. */
9struct ip6t_rateinfo {
10 u_int32_t avg; /* Average secs between packets * scale */
11 u_int32_t burst; /* Period multiplier for upper limit. */
12
13 /* Used internally by the kernel */
14 unsigned long prev;
15 u_int32_t credit;
16 u_int32_t credit_cap, cost;
17
18 /* Ugly, ugly fucker. */
19 struct ip6t_rateinfo *master;
20};
21#endif /*_IPT_RATE_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_mac.h b/include/linux/netfilter_ipv6/ip6t_mac.h
index 87c088c21848..ac58e83e9423 100644
--- a/include/linux/netfilter_ipv6/ip6t_mac.h
+++ b/include/linux/netfilter_ipv6/ip6t_mac.h
@@ -1,8 +1,7 @@
1#ifndef _IP6T_MAC_H 1#ifndef _IP6T_MAC_H
2#define _IP6T_MAC_H 2#define _IP6T_MAC_H
3 3
4struct ip6t_mac_info { 4#include <linux/netfilter/xt_mac.h>
5 unsigned char srcaddr[ETH_ALEN]; 5#define ip6t_mac_info xt_mac_info
6 int invert; 6
7}; 7#endif /*_IP6T_MAC_H*/
8#endif /*_IPT_MAC_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_mark.h b/include/linux/netfilter_ipv6/ip6t_mark.h
index a734441e1c19..ff204951ddc3 100644
--- a/include/linux/netfilter_ipv6/ip6t_mark.h
+++ b/include/linux/netfilter_ipv6/ip6t_mark.h
@@ -1,9 +1,9 @@
1#ifndef _IP6T_MARK_H 1#ifndef _IP6T_MARK_H
2#define _IP6T_MARK_H 2#define _IP6T_MARK_H
3 3
4struct ip6t_mark_info { 4/* Backwards compatibility for old userspace */
5 unsigned long mark, mask; 5#include <linux/netfilter/xt_mark.h>
6 u_int8_t invert; 6
7}; 7#define ip6t_mark_info xt_mark_info
8 8
9#endif /*_IPT_MARK_H*/ 9#endif /*_IPT_MARK_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_opts.h b/include/linux/netfilter_ipv6/ip6t_opts.h
index e259b6275bd2..a07e36380ae8 100644
--- a/include/linux/netfilter_ipv6/ip6t_opts.h
+++ b/include/linux/netfilter_ipv6/ip6t_opts.h
@@ -20,13 +20,4 @@ struct ip6t_opts
20#define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */ 20#define IP6T_OPTS_INV_LEN 0x01 /* Invert the sense of length. */
21#define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */ 21#define IP6T_OPTS_INV_MASK 0x01 /* All possible flags. */
22 22
23#define MASK_HOPOPTS 128
24#define MASK_DSTOPTS 64
25#define MASK_ROUTING 32
26#define MASK_FRAGMENT 16
27#define MASK_AH 8
28#define MASK_ESP 4
29#define MASK_NONE 2
30#define MASK_PROTO 1
31
32#endif /*_IP6T_OPTS_H*/ 23#endif /*_IP6T_OPTS_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_physdev.h b/include/linux/netfilter_ipv6/ip6t_physdev.h
index c234731cd66b..c161c0a81b55 100644
--- a/include/linux/netfilter_ipv6/ip6t_physdev.h
+++ b/include/linux/netfilter_ipv6/ip6t_physdev.h
@@ -1,24 +1,17 @@
1#ifndef _IP6T_PHYSDEV_H 1#ifndef _IP6T_PHYSDEV_H
2#define _IP6T_PHYSDEV_H 2#define _IP6T_PHYSDEV_H
3 3
4#ifdef __KERNEL__ 4/* Backwards compatibility for old userspace */
5#include <linux/if.h>
6#endif
7 5
8#define IP6T_PHYSDEV_OP_IN 0x01 6#include <linux/netfilter/xt_physdev.h>
9#define IP6T_PHYSDEV_OP_OUT 0x02
10#define IP6T_PHYSDEV_OP_BRIDGED 0x04
11#define IP6T_PHYSDEV_OP_ISIN 0x08
12#define IP6T_PHYSDEV_OP_ISOUT 0x10
13#define IP6T_PHYSDEV_OP_MASK (0x20 - 1)
14 7
15struct ip6t_physdev_info { 8#define IP6T_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN
16 char physindev[IFNAMSIZ]; 9#define IP6T_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT
17 char in_mask[IFNAMSIZ]; 10#define IP6T_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED
18 char physoutdev[IFNAMSIZ]; 11#define IP6T_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN
19 char out_mask[IFNAMSIZ]; 12#define IP6T_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT
20 u_int8_t invert; 13#define IP6T_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK
21 u_int8_t bitmask; 14
22}; 15#define ip6t_physdev_info xt_physdev_info
23 16
24#endif /*_IP6T_PHYSDEV_H*/ 17#endif /*_IP6T_PHYSDEV_H*/
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/netfilter_ipv6/ip6t_rt.h b/include/linux/netfilter_ipv6/ip6t_rt.h
index f1070fbf2757..52156023e8db 100644
--- a/include/linux/netfilter_ipv6/ip6t_rt.h
+++ b/include/linux/netfilter_ipv6/ip6t_rt.h
@@ -30,13 +30,4 @@ struct ip6t_rt
30#define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */ 30#define IP6T_RT_INV_LEN 0x04 /* Invert the sense of length. */
31#define IP6T_RT_INV_MASK 0x07 /* All possible flags. */ 31#define IP6T_RT_INV_MASK 0x07 /* All possible flags. */
32 32
33#define MASK_HOPOPTS 128
34#define MASK_DSTOPTS 64
35#define MASK_ROUTING 32
36#define MASK_FRAGMENT 16
37#define MASK_AH 8
38#define MASK_ESP 4
39#define MASK_NONE 2
40#define MASK_PROTO 1
41
42#endif /*_IP6T_RT_H*/ 33#endif /*_IP6T_RT_H*/
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 51c231a1e5a6..ec7c2e872d72 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -124,7 +124,7 @@ int nfsd_statfs(struct svc_rqst *, struct svc_fh *,
124 124
125int nfsd_notify_change(struct inode *, struct iattr *); 125int nfsd_notify_change(struct inode *, struct iattr *);
126int nfsd_permission(struct svc_export *, struct dentry *, int); 126int nfsd_permission(struct svc_export *, struct dentry *, int);
127void nfsd_sync_dir(struct dentry *dp); 127int nfsd_sync_dir(struct dentry *dp);
128 128
129#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 129#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
130#ifdef CONFIG_NFSD_V2_ACL 130#ifdef CONFIG_NFSD_V2_ACL
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/xdr4.h b/include/linux/nfsd/xdr4.h
index 8903688890ce..77adba7d2281 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -145,8 +145,9 @@ struct nfsd4_lock {
145 } ok; 145 } ok;
146 struct nfsd4_lock_denied denied; 146 struct nfsd4_lock_denied denied;
147 } u; 147 } u;
148 148 /* The lk_replay_owner is the open owner in the open_to_lock_owner
149 struct nfs4_stateowner *lk_stateowner; 149 * case and the lock owner otherwise: */
150 struct nfs4_stateowner *lk_replay_owner;
150}; 151};
151#define lk_new_open_seqid v.new.open_seqid 152#define lk_new_open_seqid v.new.open_seqid
152#define lk_new_open_stateid v.new.open_stateid 153#define lk_new_open_stateid v.new.open_stateid
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 f7ff0b0c4031..f67f838a3a1f 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -236,12 +236,14 @@ 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,
243 IEEE1284_PH_TERMINATE, 244 IEEE1284_PH_TERMINATE,
244 IEEE1284_PH_NEGOTIATION, 245 IEEE1284_PH_NEGOTIATION,
246 IEEE1284_PH_HBUSY_DNA,
245 IEEE1284_PH_REV_IDLE, 247 IEEE1284_PH_REV_IDLE,
246 IEEE1284_PH_HBUSY_DAVAIL, 248 IEEE1284_PH_HBUSY_DAVAIL,
247 IEEE1284_PH_REV_DATA, 249 IEEE1284_PH_REV_DATA,
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 a213e999de31..ecc1fc1f0f04 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -181,6 +181,7 @@
181#define PCI_DEVICE_ID_LSI_FC929X 0x0626 181#define PCI_DEVICE_ID_LSI_FC929X 0x0626
182#define PCI_DEVICE_ID_LSI_FC939X 0x0642 182#define PCI_DEVICE_ID_LSI_FC939X 0x0642
183#define PCI_DEVICE_ID_LSI_FC949X 0x0640 183#define PCI_DEVICE_ID_LSI_FC949X 0x0640
184#define PCI_DEVICE_ID_LSI_FC949ES 0x0646
184#define PCI_DEVICE_ID_LSI_FC919X 0x0628 185#define PCI_DEVICE_ID_LSI_FC919X 0x0628
185#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701 186#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701
186#define PCI_DEVICE_ID_LSI_61C102 0x0901 187#define PCI_DEVICE_ID_LSI_61C102 0x0901
@@ -377,6 +378,7 @@
377#define PCI_DEVICE_ID_NS_87560_USB 0x0012 378#define PCI_DEVICE_ID_NS_87560_USB 0x0012
378#define PCI_DEVICE_ID_NS_83815 0x0020 379#define PCI_DEVICE_ID_NS_83815 0x0020
379#define PCI_DEVICE_ID_NS_83820 0x0022 380#define PCI_DEVICE_ID_NS_83820 0x0022
381#define PCI_DEVICE_ID_NS_CS5535_ISA 0x002b
380#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d 382#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
381#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e 383#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e
382#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f 384#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f
@@ -500,6 +502,14 @@
500#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d 502#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d
501#define PCI_DEVICE_ID_AMD_8151_0 0x7454 503#define PCI_DEVICE_ID_AMD_8151_0 0x7454
502#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450 504#define PCI_DEVICE_ID_AMD_8131_APIC 0x7450
505#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090
506#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091
507#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093
508#define PCI_DEVICE_ID_AMD_CS5536_OHC 0x2094
509#define PCI_DEVICE_ID_AMD_CS5536_EHC 0x2095
510#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096
511#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097
512#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
503 513
504#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A 514#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A
505 515
@@ -1041,6 +1051,11 @@
1041#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6 1051#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6
1042#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea 1052#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea
1043#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee 1053#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee
1054#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0
1055#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1 0x00f1
1056#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2
1057#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3
1058#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9
1044#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 1059#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100
1045#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 1060#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101
1046#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 1061#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103
@@ -1583,6 +1598,23 @@
1583#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009 1598#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009
1584#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A 1599#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A
1585#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B 1600#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B
1601#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ 0x000C
1602#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_PTM 0x000D
1603#define PCI_SUBDEVICE_ID_CONNECT_TECH_NT960PCI 0x0100
1604#define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2 0x0201
1605#define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4 0x0202
1606#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232 0x0300
1607#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232 0x0301
1608#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232 0x0302
1609#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1 0x0310
1610#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2 0x0311
1611#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4 0x0312
1612#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2 0x0320
1613#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4 0x0321
1614#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8 0x0322
1615#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485 0x0330
1616#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485 0x0331
1617#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485 0x0332
1586 1618
1587 1619
1588#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 1620#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2
@@ -1960,6 +1992,7 @@
1960#define PCI_VENDOR_ID_DCI 0x6666 1992#define PCI_VENDOR_ID_DCI 0x6666
1961#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001 1993#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001
1962#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002 1994#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002
1995#define PCI_DEVICE_ID_DCI_PCCOM2 0x0004
1963 1996
1964#define PCI_VENDOR_ID_INTEL 0x8086 1997#define PCI_VENDOR_ID_INTEL 0x8086
1965#define PCI_DEVICE_ID_INTEL_EESSC 0x0008 1998#define PCI_DEVICE_ID_INTEL_EESSC 0x0008
@@ -2121,6 +2154,9 @@
2121#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 2154#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004
2122#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 2155#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
2123 2156
2157#define PCI_VENDOR_ID_SCALEMP 0x8686
2158#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
2159
2124#define PCI_VENDOR_ID_COMPUTONE 0x8e0e 2160#define PCI_VENDOR_ID_COMPUTONE 0x8e0e
2125#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 2161#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291
2126#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 2162#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 6351c4055ace..bac0fb389cf1 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -104,7 +104,7 @@ struct sadb_prop {
104/* followed by: 104/* followed by:
105 struct sadb_comb sadb_combs[(sadb_prop_len + 105 struct sadb_comb sadb_combs[(sadb_prop_len +
106 sizeof(uint64_t) - sizeof(struct sadb_prop)) / 106 sizeof(uint64_t) - sizeof(struct sadb_prop)) /
107 sizeof(strut sadb_comb)]; */ 107 sizeof(struct sadb_comb)]; */
108 108
109struct sadb_comb { 109struct sadb_comb {
110 uint8_t sadb_comb_auth; 110 uint8_t sadb_comb_auth;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 92a9696fdebe..331521a10a2d 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -53,6 +53,9 @@
53 53
54#define PHY_MAX_ADDR 32 54#define PHY_MAX_ADDR 32
55 55
56/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
57#define PHY_ID_FMT "%x:%02x"
58
56/* The Bus class for PHYs. Devices which provide access to 59/* The Bus class for PHYs. Devices which provide access to
57 * PHYs should register using this structure */ 60 * PHYs should register using this structure */
58struct mii_bus { 61struct mii_bus {
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/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/poll.h b/include/linux/poll.h
index f6da702088f4..8e8f6098508a 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -92,7 +92,11 @@ void zero_fd_set(unsigned long nr, unsigned long *fdset)
92 memset(fdset, 0, FDS_BYTES(nr)); 92 memset(fdset, 0, FDS_BYTES(nr));
93} 93}
94 94
95extern int do_select(int n, fd_set_bits *fds, long *timeout); 95#define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1)
96
97extern int do_select(int n, fd_set_bits *fds, s64 *timeout);
98extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds,
99 s64 *timeout);
96 100
97#endif /* KERNEL */ 101#endif /* KERNEL */
98 102
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/proc_fs.h b/include/linux/proc_fs.h
index 74488e49166d..aa6322d45198 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -146,6 +146,11 @@ struct property;
146extern void proc_device_tree_init(void); 146extern void proc_device_tree_init(void);
147extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); 147extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
148extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); 148extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
149extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde,
150 struct property *prop);
151extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
152 struct property *newprop,
153 struct property *oldprop);
149#endif /* CONFIG_PROC_DEVICETREE */ 154#endif /* CONFIG_PROC_DEVICETREE */
150 155
151extern struct proc_dir_entry *proc_symlink(const char *, 156extern struct proc_dir_entry *proc_symlink(const char *,
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_class.h b/include/linux/raid_class.h
index 48831eac2910..d0dd38b3a2fd 100644
--- a/include/linux/raid_class.h
+++ b/include/linux/raid_class.h
@@ -31,9 +31,11 @@ enum raid_level {
31 RAID_LEVEL_LINEAR, 31 RAID_LEVEL_LINEAR,
32 RAID_LEVEL_0, 32 RAID_LEVEL_0,
33 RAID_LEVEL_1, 33 RAID_LEVEL_1,
34 RAID_LEVEL_10,
34 RAID_LEVEL_3, 35 RAID_LEVEL_3,
35 RAID_LEVEL_4, 36 RAID_LEVEL_4,
36 RAID_LEVEL_5, 37 RAID_LEVEL_5,
38 RAID_LEVEL_50,
37 RAID_LEVEL_6, 39 RAID_LEVEL_6,
38}; 40};
39 41
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/reboot.h b/include/linux/reboot.h
index 7ab2cdb83ef0..015297ff73fa 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -60,8 +60,7 @@ extern void machine_crash_shutdown(struct pt_regs *);
60 */ 60 */
61 61
62extern void kernel_restart_prepare(char *cmd); 62extern void kernel_restart_prepare(char *cmd);
63extern void kernel_halt_prepare(void); 63extern void kernel_shutdown_prepare(enum system_states state);
64extern void kernel_power_off_prepare(void);
65 64
66extern void kernel_restart(char *cmd); 65extern void kernel_restart(char *cmd);
67extern void kernel_halt(void); 66extern void kernel_halt(void);
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/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 7da33619d5d0..0cfcd1c7865e 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
@@ -158,6 +160,7 @@ extern unsigned long nr_iowait(void);
158#define SCHED_NORMAL 0 160#define SCHED_NORMAL 0
159#define SCHED_FIFO 1 161#define SCHED_FIFO 1
160#define SCHED_RR 2 162#define SCHED_RR 2
163#define SCHED_BATCH 3
161 164
162struct sched_param { 165struct sched_param {
163 int sched_priority; 166 int sched_priority;
@@ -350,8 +353,16 @@ struct sighand_struct {
350 atomic_t count; 353 atomic_t count;
351 struct k_sigaction action[_NSIG]; 354 struct k_sigaction action[_NSIG];
352 spinlock_t siglock; 355 spinlock_t siglock;
356 struct rcu_head rcu;
353}; 357};
354 358
359extern void sighand_free_cb(struct rcu_head *rhp);
360
361static inline void sighand_free(struct sighand_struct *sp)
362{
363 call_rcu(&sp->rcu, sighand_free_cb);
364}
365
355/* 366/*
356 * NOTE! "signal_struct" does not have it's own 367 * NOTE! "signal_struct" does not have it's own
357 * locking, because a shared signal_struct always 368 * locking, because a shared signal_struct always
@@ -389,8 +400,8 @@ struct signal_struct {
389 struct list_head posix_timers; 400 struct list_head posix_timers;
390 401
391 /* ITIMER_REAL timer for the process */ 402 /* ITIMER_REAL timer for the process */
392 struct timer_list real_timer; 403 struct hrtimer real_timer;
393 unsigned long it_real_value, it_real_incr; 404 ktime_t it_real_incr;
394 405
395 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 406 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
396 cputime_t it_prof_expires, it_virt_expires; 407 cputime_t it_prof_expires, it_virt_expires;
@@ -460,9 +471,9 @@ struct signal_struct {
460 471
461/* 472/*
462 * Priority of a process goes from 0..MAX_PRIO-1, valid RT 473 * Priority of a process goes from 0..MAX_PRIO-1, valid RT
463 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL tasks are 474 * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
464 * in the range MAX_RT_PRIO..MAX_PRIO-1. Priority values 475 * tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
465 * are inverted: lower p->prio value means higher priority. 476 * values are inverted: lower p->prio value means higher priority.
466 * 477 *
467 * The MAX_USER_RT_PRIO value allows the actual maximum 478 * The MAX_USER_RT_PRIO value allows the actual maximum
468 * RT priority to be separate from the value exported to 479 * RT priority to be separate from the value exported to
@@ -621,7 +632,14 @@ struct sched_domain {
621 632
622extern void partition_sched_domains(cpumask_t *partition1, 633extern void partition_sched_domains(cpumask_t *partition1,
623 cpumask_t *partition2); 634 cpumask_t *partition2);
624#endif /* CONFIG_SMP */ 635
636/*
637 * Maximum cache size the migration-costs auto-tuning code will
638 * search from:
639 */
640extern unsigned int max_cache_size;
641
642#endif /* CONFIG_SMP */
625 643
626 644
627struct io_context; /* See blkdev.h */ 645struct io_context; /* See blkdev.h */
@@ -679,9 +697,12 @@ struct task_struct {
679 697
680 int lock_depth; /* BKL lock depth */ 698 int lock_depth; /* BKL lock depth */
681 699
682#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) 700#if defined(CONFIG_SMP)
701 int last_waker_cpu; /* CPU that last woke this task up */
702#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
683 int oncpu; 703 int oncpu;
684#endif 704#endif
705#endif
685 int prio, static_prio; 706 int prio, static_prio;
686 struct list_head run_list; 707 struct list_head run_list;
687 prio_array_t *array; 708 prio_array_t *array;
@@ -762,6 +783,7 @@ struct task_struct {
762 unsigned keep_capabilities:1; 783 unsigned keep_capabilities:1;
763 struct user_struct *user; 784 struct user_struct *user;
764#ifdef CONFIG_KEYS 785#ifdef CONFIG_KEYS
786 struct key *request_key_auth; /* assumed request_key authority */
765 struct key *thread_keyring; /* keyring private to this thread */ 787 struct key *thread_keyring; /* keyring private to this thread */
766 unsigned char jit_keyring; /* default keyring to attach requested keys to */ 788 unsigned char jit_keyring; /* default keyring to attach requested keys to */
767#endif 789#endif
@@ -787,6 +809,7 @@ struct task_struct {
787 struct sighand_struct *sighand; 809 struct sighand_struct *sighand;
788 810
789 sigset_t blocked, real_blocked; 811 sigset_t blocked, real_blocked;
812 sigset_t saved_sigmask; /* To be restored with TIF_RESTORE_SIGMASK */
790 struct sigpending pending; 813 struct sigpending pending;
791 814
792 unsigned long sas_ss_sp; 815 unsigned long sas_ss_sp;
@@ -807,6 +830,11 @@ struct task_struct {
807/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ 830/* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */
808 spinlock_t proc_lock; 831 spinlock_t proc_lock;
809 832
833#ifdef CONFIG_DEBUG_MUTEXES
834 /* mutex deadlock detection */
835 struct mutex_waiter *blocked_on;
836#endif
837
810/* journalling filesystem info */ 838/* journalling filesystem info */
811 void *journal_info; 839 void *journal_info;
812 840
@@ -844,6 +872,7 @@ struct task_struct {
844 int cpuset_mems_generation; 872 int cpuset_mems_generation;
845#endif 873#endif
846 atomic_t fs_excl; /* holding fs exclusive resources */ 874 atomic_t fs_excl; /* holding fs exclusive resources */
875 struct rcu_head rcu;
847}; 876};
848 877
849static inline pid_t process_group(struct task_struct *tsk) 878static inline pid_t process_group(struct task_struct *tsk)
@@ -867,8 +896,14 @@ static inline int pid_alive(struct task_struct *p)
867extern void free_task(struct task_struct *tsk); 896extern void free_task(struct task_struct *tsk);
868extern void __put_task_struct(struct task_struct *tsk); 897extern void __put_task_struct(struct task_struct *tsk);
869#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 898#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
870#define put_task_struct(tsk) \ 899
871do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) 900extern void __put_task_struct_cb(struct rcu_head *rhp);
901
902static inline void put_task_struct(struct task_struct *t)
903{
904 if (atomic_dec_and_test(&t->usage))
905 call_rcu(&t->rcu, __put_task_struct_cb);
906}
872 907
873/* 908/*
874 * Per process flags 909 * Per process flags
@@ -895,6 +930,7 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0)
895#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ 930#define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */
896#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ 931#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */
897#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ 932#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */
933#define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */
898 934
899/* 935/*
900 * Only the _current_ task can read/write to tsk->flags, but other 936 * Only the _current_ task can read/write to tsk->flags, but other
@@ -1088,21 +1124,6 @@ static inline int sas_ss_flags(unsigned long sp)
1088 : on_sig_stack(sp) ? SS_ONSTACK : 0); 1124 : on_sig_stack(sp) ? SS_ONSTACK : 0);
1089} 1125}
1090 1126
1091
1092#ifdef CONFIG_SECURITY
1093/* code is in security.c */
1094extern int capable(int cap);
1095#else
1096static inline int capable(int cap)
1097{
1098 if (cap_raised(current->cap_effective, cap)) {
1099 current->flags |= PF_SUPERPRIV;
1100 return 1;
1101 }
1102 return 0;
1103}
1104#endif
1105
1106/* 1127/*
1107 * Routines for handling mm_structs 1128 * Routines for handling mm_structs
1108 */ 1129 */
@@ -1221,6 +1242,7 @@ static inline void task_unlock(struct task_struct *p)
1221#ifndef __HAVE_THREAD_FUNCTIONS 1242#ifndef __HAVE_THREAD_FUNCTIONS
1222 1243
1223#define task_thread_info(task) (task)->thread_info 1244#define task_thread_info(task) (task)->thread_info
1245#define task_stack_page(task) ((void*)((task)->thread_info))
1224 1246
1225static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org) 1247static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org)
1226{ 1248{
@@ -1366,12 +1388,8 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm)
1366extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); 1388extern long sched_setaffinity(pid_t pid, cpumask_t new_mask);
1367extern long sched_getaffinity(pid_t pid, cpumask_t *mask); 1389extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
1368 1390
1369#ifdef CONFIG_MAGIC_SYSRQ
1370
1371extern void normalize_rt_tasks(void); 1391extern void normalize_rt_tasks(void);
1372 1392
1373#endif
1374
1375#ifdef CONFIG_PM 1393#ifdef CONFIG_PM
1376/* 1394/*
1377 * Check if a process has been frozen 1395 * 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/serial_core.h b/include/linux/serial_core.h
index e3710d7e260a..ec351005bf9d 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
@@ -133,6 +136,7 @@
133#include <linux/spinlock.h> 136#include <linux/spinlock.h>
134#include <linux/sched.h> 137#include <linux/sched.h>
135#include <linux/tty.h> 138#include <linux/tty.h>
139#include <linux/mutex.h>
136 140
137struct uart_port; 141struct uart_port;
138struct uart_info; 142struct uart_info;
@@ -281,7 +285,7 @@ struct uart_state {
281 struct uart_info *info; 285 struct uart_info *info;
282 struct uart_port *port; 286 struct uart_port *port;
283 287
284 struct semaphore sem; 288 struct mutex mutex;
285}; 289};
286 290
287#define UART_XMIT_SIZE PAGE_SIZE 291#define UART_XMIT_SIZE PAGE_SIZE
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index c3e598276e78..c057f0b32318 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -26,6 +26,8 @@ struct shmem_sb_info {
26 unsigned long free_blocks; /* How many are left for allocation */ 26 unsigned long free_blocks; /* How many are left for allocation */
27 unsigned long max_inodes; /* How many inodes are allowed */ 27 unsigned long max_inodes; /* How many inodes are allowed */
28 unsigned long free_inodes; /* How many are left for allocation */ 28 unsigned long free_inodes; /* How many are left for allocation */
29 int policy; /* Default NUMA memory alloc policy */
30 nodemask_t policy_nodes; /* nodemask for preferred and bind */
29 spinlock_t stat_lock; 31 spinlock_t stat_lock;
30}; 32};
31 33
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 483cfc47ec34..ad7cc22bd424 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -251,7 +251,7 @@ struct sk_buff {
251 * 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()
252 * first. This is owned by whoever has the skb queued ATM. 252 * first. This is owned by whoever has the skb queued ATM.
253 */ 253 */
254 char cb[40]; 254 char cb[48];
255 255
256 unsigned int len, 256 unsigned int len,
257 data_len, 257 data_len,
@@ -926,7 +926,7 @@ static inline int skb_tailroom(const struct sk_buff *skb)
926 * Increase the headroom of an empty &sk_buff by reducing the tail 926 * Increase the headroom of an empty &sk_buff by reducing the tail
927 * room. This is only allowed for an empty buffer. 927 * room. This is only allowed for an empty buffer.
928 */ 928 */
929static inline void skb_reserve(struct sk_buff *skb, unsigned int len) 929static inline void skb_reserve(struct sk_buff *skb, int len)
930{ 930{
931 skb->data += len; 931 skb->data += len;
932 skb->tail += len; 932 skb->tail += len;
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/smb_fs.h b/include/linux/smb_fs.h
index c4153120ade6..621a3d3662f3 100644
--- a/include/linux/smb_fs.h
+++ b/include/linux/smb_fs.h
@@ -58,53 +58,6 @@ static inline struct smb_inode_info *SMB_I(struct inode *inode)
58/* where to find the base of the SMB packet proper */ 58/* where to find the base of the SMB packet proper */
59#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) 59#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4))
60 60
61#ifdef DEBUG_SMB_MALLOC
62
63#include <linux/slab.h>
64
65extern int smb_malloced;
66extern int smb_current_vmalloced;
67extern int smb_current_kmalloced;
68
69static inline void *
70smb_vmalloc(unsigned int size)
71{
72 smb_malloced += 1;
73 smb_current_vmalloced += 1;
74 return vmalloc(size);
75}
76
77static inline void
78smb_vfree(void *obj)
79{
80 smb_current_vmalloced -= 1;
81 vfree(obj);
82}
83
84static inline void *
85smb_kmalloc(size_t size, int flags)
86{
87 smb_malloced += 1;
88 smb_current_kmalloced += 1;
89 return kmalloc(size, flags);
90}
91
92static inline void
93smb_kfree(void *obj)
94{
95 smb_current_kmalloced -= 1;
96 kfree(obj);
97}
98
99#else /* DEBUG_SMB_MALLOC */
100
101#define smb_kmalloc(s,p) kmalloc(s,p)
102#define smb_kfree(o) kfree(o)
103#define smb_vmalloc(s) vmalloc(s)
104#define smb_vfree(o) vfree(o)
105
106#endif /* DEBUG_SMB_MALLOC */
107
108/* 61/*
109 * Flags for the in-memory inode 62 * Flags for the in-memory inode
110 */ 63 */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 9f4019156fd8..b02dda4ee83d 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -186,6 +186,7 @@ struct ucred {
186#define AF_PPPOX 24 /* PPPoX sockets */ 186#define AF_PPPOX 24 /* PPPoX sockets */
187#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 187#define AF_WANPIPE 25 /* Wanpipe API Sockets */
188#define AF_LLC 26 /* Linux LLC */ 188#define AF_LLC 26 /* Linux LLC */
189#define AF_TIPC 30 /* TIPC sockets */
189#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 190#define AF_BLUETOOTH 31 /* Bluetooth sockets */
190#define AF_MAX 32 /* For now.. */ 191#define AF_MAX 32 /* For now.. */
191 192
@@ -218,6 +219,7 @@ struct ucred {
218#define PF_PPPOX AF_PPPOX 219#define PF_PPPOX AF_PPPOX
219#define PF_WANPIPE AF_WANPIPE 220#define PF_WANPIPE AF_WANPIPE
220#define PF_LLC AF_LLC 221#define PF_LLC AF_LLC
222#define PF_TIPC AF_TIPC
221#define PF_BLUETOOTH AF_BLUETOOTH 223#define PF_BLUETOOTH AF_BLUETOOTH
222#define PF_MAX AF_MAX 224#define PF_MAX AF_MAX
223 225
@@ -279,6 +281,7 @@ struct ucred {
279#define SOL_LLC 268 281#define SOL_LLC 268
280#define SOL_DCCP 269 282#define SOL_DCCP 269
281#define SOL_NETLINK 270 283#define SOL_NETLINK 270
284#define SOL_TIPC 271
282 285
283/* IPX options */ 286/* IPX options */
284#define IPX_TYPE 1 287#define IPX_TYPE 1
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
new file mode 100644
index 000000000000..72261e0f2ac1
--- /dev/null
+++ b/include/linux/spi/ads7846.h
@@ -0,0 +1,18 @@
1/* linux/spi/ads7846.h */
2
3/* Touchscreen characteristics vary between boards and models. The
4 * platform_data for the device's "struct device" holds this information.
5 *
6 * It's OK if the min/max values are zero.
7 */
8struct ads7846_platform_data {
9 u16 model; /* 7843, 7845, 7846. */
10 u16 vref_delay_usecs; /* 0 for external vref; etc */
11 u16 x_plate_ohms;
12 u16 y_plate_ohms;
13
14 u16 x_min, x_max;
15 u16 y_min, y_max;
16 u16 pressure_min, pressure_max;
17};
18
diff --git a/include/linux/spi/flash.h b/include/linux/spi/flash.h
new file mode 100644
index 000000000000..3f22932e67a4
--- /dev/null
+++ b/include/linux/spi/flash.h
@@ -0,0 +1,31 @@
1#ifndef LINUX_SPI_FLASH_H
2#define LINUX_SPI_FLASH_H
3
4struct mtd_partition;
5
6/**
7 * struct flash_platform_data: board-specific flash data
8 * @name: optional flash device name (eg, as used with mtdparts=)
9 * @parts: optional array of mtd_partitions for static partitioning
10 * @nr_parts: number of mtd_partitions for static partitoning
11 * @type: optional flash device type (e.g. m25p80 vs m25p64), for use
12 * with chips that can't be queried for JEDEC or other IDs
13 *
14 * Board init code (in arch/.../mach-xxx/board-yyy.c files) can
15 * provide information about SPI flash parts (such as DataFlash) to
16 * help set up the device and its appropriate default partitioning.
17 *
18 * Note that for DataFlash, sizes for pages, blocks, and sectors are
19 * rarely powers of two; and partitions should be sector-aligned.
20 */
21struct flash_platform_data {
22 char *name;
23 struct mtd_partition *parts;
24 unsigned int nr_parts;
25
26 char *type;
27
28 /* we'll likely add more ... use JEDEC IDs, etc */
29};
30
31#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
new file mode 100644
index 000000000000..b05f1463a267
--- /dev/null
+++ b/include/linux/spi/spi.h
@@ -0,0 +1,668 @@
1/*
2 * Copyright (C) 2005 David Brownell
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., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __LINUX_SPI_H
20#define __LINUX_SPI_H
21
22/*
23 * INTERFACES between SPI master-side drivers and SPI infrastructure.
24 * (There's no SPI slave support for Linux yet...)
25 */
26extern struct bus_type spi_bus_type;
27
28/**
29 * struct spi_device - Master side proxy for an SPI slave device
30 * @dev: Driver model representation of the device.
31 * @master: SPI controller used with the device.
32 * @max_speed_hz: Maximum clock rate to be used with this chip
33 * (on this board); may be changed by the device's driver.
34 * @chip-select: Chipselect, distinguishing chips handled by "master".
35 * @mode: The spi mode defines how data is clocked out and in.
36 * This may be changed by the device's driver.
37 * @bits_per_word: Data transfers involve one or more words; word sizes
38 * like eight or 12 bits are common. In-memory wordsizes are
39 * powers of two bytes (e.g. 20 bit samples use 32 bits).
40 * This may be changed by the device's driver.
41 * @irq: Negative, or the number passed to request_irq() to receive
42 * interrupts from this device.
43 * @controller_state: Controller's runtime state
44 * @controller_data: Board-specific definitions for controller, such as
45 * FIFO initialization parameters; from board_info.controller_data
46 *
47 * An spi_device is used to interchange data between an SPI slave
48 * (usually a discrete chip) and CPU memory.
49 *
50 * In "dev", the platform_data is used to hold information about this
51 * device that's meaningful to the device's protocol driver, but not
52 * to its controller. One example might be an identifier for a chip
53 * variant with slightly different functionality.
54 */
55struct spi_device {
56 struct device dev;
57 struct spi_master *master;
58 u32 max_speed_hz;
59 u8 chip_select;
60 u8 mode;
61#define SPI_CPHA 0x01 /* clock phase */
62#define SPI_CPOL 0x02 /* clock polarity */
63#define SPI_MODE_0 (0|0) /* (original MicroWire) */
64#define SPI_MODE_1 (0|SPI_CPHA)
65#define SPI_MODE_2 (SPI_CPOL|0)
66#define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
67#define SPI_CS_HIGH 0x04 /* chipselect active high? */
68 u8 bits_per_word;
69 int irq;
70 void *controller_state;
71 void *controller_data;
72 const char *modalias;
73
74 // likely need more hooks for more protocol options affecting how
75 // the controller talks to each chip, like:
76 // - bit order (default is wordwise msb-first)
77 // - memory packing (12 bit samples into low bits, others zeroed)
78 // - priority
79 // - drop chipselect after each word
80 // - chipselect delays
81 // - ...
82};
83
84static inline struct spi_device *to_spi_device(struct device *dev)
85{
86 return dev ? container_of(dev, struct spi_device, dev) : NULL;
87}
88
89/* most drivers won't need to care about device refcounting */
90static inline struct spi_device *spi_dev_get(struct spi_device *spi)
91{
92 return (spi && get_device(&spi->dev)) ? spi : NULL;
93}
94
95static inline void spi_dev_put(struct spi_device *spi)
96{
97 if (spi)
98 put_device(&spi->dev);
99}
100
101/* ctldata is for the bus_master driver's runtime state */
102static inline void *spi_get_ctldata(struct spi_device *spi)
103{
104 return spi->controller_state;
105}
106
107static inline void spi_set_ctldata(struct spi_device *spi, void *state)
108{
109 spi->controller_state = state;
110}
111
112
113struct spi_message;
114
115
116
117struct spi_driver {
118 int (*probe)(struct spi_device *spi);
119 int (*remove)(struct spi_device *spi);
120 void (*shutdown)(struct spi_device *spi);
121 int (*suspend)(struct spi_device *spi, pm_message_t mesg);
122 int (*resume)(struct spi_device *spi);
123 struct device_driver driver;
124};
125
126static inline struct spi_driver *to_spi_driver(struct device_driver *drv)
127{
128 return drv ? container_of(drv, struct spi_driver, driver) : NULL;
129}
130
131extern int spi_register_driver(struct spi_driver *sdrv);
132
133static inline void spi_unregister_driver(struct spi_driver *sdrv)
134{
135 if (!sdrv)
136 return;
137 driver_unregister(&sdrv->driver);
138}
139
140
141
142/**
143 * struct spi_master - interface to SPI master controller
144 * @cdev: class interface to this driver
145 * @bus_num: board-specific (and often SOC-specific) identifier for a
146 * given SPI controller.
147 * @num_chipselect: chipselects are used to distinguish individual
148 * SPI slaves, and are numbered from zero to num_chipselects.
149 * each slave has a chipselect signal, but it's common that not
150 * every chipselect is connected to a slave.
151 * @setup: updates the device mode and clocking records used by a
152 * device's SPI controller; protocol code may call this.
153 * @transfer: adds a message to the controller's transfer queue.
154 * @cleanup: frees controller-specific state
155 *
156 * Each SPI master controller can communicate with one or more spi_device
157 * children. These make a small bus, sharing MOSI, MISO and SCK signals
158 * but not chip select signals. Each device may be configured to use a
159 * different clock rate, since those shared signals are ignored unless
160 * the chip is selected.
161 *
162 * The driver for an SPI controller manages access to those devices through
163 * a queue of spi_message transactions, copyin data between CPU memory and
164 * an SPI slave device). For each such message it queues, it calls the
165 * message's completion function when the transaction completes.
166 */
167struct spi_master {
168 struct class_device cdev;
169
170 /* other than zero (== assign one dynamically), bus_num is fully
171 * board-specific. usually that simplifies to being SOC-specific.
172 * example: one SOC has three SPI controllers, numbered 1..3,
173 * and one board's schematics might show it using SPI-2. software
174 * would normally use bus_num=2 for that controller.
175 */
176 u16 bus_num;
177
178 /* chipselects will be integral to many controllers; some others
179 * might use board-specific GPIOs.
180 */
181 u16 num_chipselect;
182
183 /* setup mode and clock, etc (spi driver may call many times) */
184 int (*setup)(struct spi_device *spi);
185
186 /* bidirectional bulk transfers
187 *
188 * + The transfer() method may not sleep; its main role is
189 * just to add the message to the queue.
190 * + For now there's no remove-from-queue operation, or
191 * any other request management
192 * + To a given spi_device, message queueing is pure fifo
193 *
194 * + The master's main job is to process its message queue,
195 * selecting a chip then transferring data
196 * + If there are multiple spi_device children, the i/o queue
197 * arbitration algorithm is unspecified (round robin, fifo,
198 * priority, reservations, preemption, etc)
199 *
200 * + Chipselect stays active during the entire message
201 * (unless modified by spi_transfer.cs_change != 0).
202 * + The message transfers use clock and SPI mode parameters
203 * previously established by setup() for this device
204 */
205 int (*transfer)(struct spi_device *spi,
206 struct spi_message *mesg);
207
208 /* called on release() to free memory provided by spi_master */
209 void (*cleanup)(const struct spi_device *spi);
210};
211
212static inline void *spi_master_get_devdata(struct spi_master *master)
213{
214 return class_get_devdata(&master->cdev);
215}
216
217static inline void spi_master_set_devdata(struct spi_master *master, void *data)
218{
219 class_set_devdata(&master->cdev, data);
220}
221
222static inline struct spi_master *spi_master_get(struct spi_master *master)
223{
224 if (!master || !class_device_get(&master->cdev))
225 return NULL;
226 return master;
227}
228
229static inline void spi_master_put(struct spi_master *master)
230{
231 if (master)
232 class_device_put(&master->cdev);
233}
234
235
236/* the spi driver core manages memory for the spi_master classdev */
237extern struct spi_master *
238spi_alloc_master(struct device *host, unsigned size);
239
240extern int spi_register_master(struct spi_master *master);
241extern void spi_unregister_master(struct spi_master *master);
242
243extern struct spi_master *spi_busnum_to_master(u16 busnum);
244
245/*---------------------------------------------------------------------------*/
246
247/*
248 * I/O INTERFACE between SPI controller and protocol drivers
249 *
250 * Protocol drivers use a queue of spi_messages, each transferring data
251 * between the controller and memory buffers.
252 *
253 * The spi_messages themselves consist of a series of read+write transfer
254 * segments. Those segments always read the same number of bits as they
255 * write; but one or the other is easily ignored by passing a null buffer
256 * pointer. (This is unlike most types of I/O API, because SPI hardware
257 * is full duplex.)
258 *
259 * NOTE: Allocation of spi_transfer and spi_message memory is entirely
260 * up to the protocol driver, which guarantees the integrity of both (as
261 * well as the data buffers) for as long as the message is queued.
262 */
263
264/**
265 * struct spi_transfer - a read/write buffer pair
266 * @tx_buf: data to be written (dma-safe memory), or NULL
267 * @rx_buf: data to be read (dma-safe memory), or NULL
268 * @tx_dma: DMA address of tx_buf, if spi_message.is_dma_mapped
269 * @rx_dma: DMA address of rx_buf, if spi_message.is_dma_mapped
270 * @len: size of rx and tx buffers (in bytes)
271 * @cs_change: affects chipselect after this transfer completes
272 * @delay_usecs: microseconds to delay after this transfer before
273 * (optionally) changing the chipselect status, then starting
274 * the next transfer or completing this spi_message.
275 * @transfer_list: transfers are sequenced through spi_message.transfers
276 *
277 * SPI transfers always write the same number of bytes as they read.
278 * Protocol drivers should always provide rx_buf and/or tx_buf.
279 * In some cases, they may also want to provide DMA addresses for
280 * the data being transferred; that may reduce overhead, when the
281 * underlying driver uses dma.
282 *
283 * If the transmit buffer is null, undefined data will be shifted out
284 * while filling rx_buf. If the receive buffer is null, the data
285 * shifted in will be discarded. Only "len" bytes shift out (or in).
286 * It's an error to try to shift out a partial word. (For example, by
287 * shifting out three bytes with word size of sixteen or twenty bits;
288 * the former uses two bytes per word, the latter uses four bytes.)
289 *
290 * All SPI transfers start with the relevant chipselect active. Normally
291 * it stays selected until after the last transfer in a message. Drivers
292 * can affect the chipselect signal using cs_change:
293 *
294 * (i) If the transfer isn't the last one in the message, this flag is
295 * used to make the chipselect briefly go inactive in the middle of the
296 * message. Toggling chipselect in this way may be needed to terminate
297 * a chip command, letting a single spi_message perform all of group of
298 * chip transactions together.
299 *
300 * (ii) When the transfer is the last one in the message, the chip may
301 * stay selected until the next transfer. This is purely a performance
302 * hint; the controller driver may need to select a different device
303 * for the next message.
304 *
305 * The code that submits an spi_message (and its spi_transfers)
306 * to the lower layers is responsible for managing its memory.
307 * Zero-initialize every field you don't set up explicitly, to
308 * insulate against future API updates. After you submit a message
309 * and its transfers, ignore them until its completion callback.
310 */
311struct spi_transfer {
312 /* it's ok if tx_buf == rx_buf (right?)
313 * for MicroWire, one buffer must be null
314 * buffers must work with dma_*map_single() calls, unless
315 * spi_message.is_dma_mapped reports a pre-existing mapping
316 */
317 const void *tx_buf;
318 void *rx_buf;
319 unsigned len;
320
321 dma_addr_t tx_dma;
322 dma_addr_t rx_dma;
323
324 unsigned cs_change:1;
325 u16 delay_usecs;
326
327 struct list_head transfer_list;
328};
329
330/**
331 * struct spi_message - one multi-segment SPI transaction
332 * @transfers: list of transfer segments in this transaction
333 * @spi: SPI device to which the transaction is queued
334 * @is_dma_mapped: if true, the caller provided both dma and cpu virtual
335 * addresses for each transfer buffer
336 * @complete: called to report transaction completions
337 * @context: the argument to complete() when it's called
338 * @actual_length: the total number of bytes that were transferred in all
339 * successful segments
340 * @status: zero for success, else negative errno
341 * @queue: for use by whichever driver currently owns the message
342 * @state: for use by whichever driver currently owns the message
343 *
344 * An spi_message is used to execute an atomic sequence of data transfers,
345 * each represented by a struct spi_transfer. The sequence is "atomic"
346 * in the sense that no other spi_message may use that SPI bus until that
347 * sequence completes. On some systems, many such sequences can execute as
348 * as single programmed DMA transfer. On all systems, these messages are
349 * queued, and might complete after transactions to other devices. Messages
350 * sent to a given spi_device are alway executed in FIFO order.
351 *
352 * The code that submits an spi_message (and its spi_transfers)
353 * to the lower layers is responsible for managing its memory.
354 * Zero-initialize every field you don't set up explicitly, to
355 * insulate against future API updates. After you submit a message
356 * and its transfers, ignore them until its completion callback.
357 */
358struct spi_message {
359 struct list_head transfers;
360
361 struct spi_device *spi;
362
363 unsigned is_dma_mapped:1;
364
365 /* REVISIT: we might want a flag affecting the behavior of the
366 * last transfer ... allowing things like "read 16 bit length L"
367 * immediately followed by "read L bytes". Basically imposing
368 * a specific message scheduling algorithm.
369 *
370 * Some controller drivers (message-at-a-time queue processing)
371 * could provide that as their default scheduling algorithm. But
372 * others (with multi-message pipelines) could need a flag to
373 * tell them about such special cases.
374 */
375
376 /* completion is reported through a callback */
377 void (*complete)(void *context);
378 void *context;
379 unsigned actual_length;
380 int status;
381
382 /* for optional use by whatever driver currently owns the
383 * spi_message ... between calls to spi_async and then later
384 * complete(), that's the spi_master controller driver.
385 */
386 struct list_head queue;
387 void *state;
388};
389
390static inline void spi_message_init(struct spi_message *m)
391{
392 memset(m, 0, sizeof *m);
393 INIT_LIST_HEAD(&m->transfers);
394}
395
396static inline void
397spi_message_add_tail(struct spi_transfer *t, struct spi_message *m)
398{
399 list_add_tail(&t->transfer_list, &m->transfers);
400}
401
402static inline void
403spi_transfer_del(struct spi_transfer *t)
404{
405 list_del(&t->transfer_list);
406}
407
408/* It's fine to embed message and transaction structures in other data
409 * structures so long as you don't free them while they're in use.
410 */
411
412static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags)
413{
414 struct spi_message *m;
415
416 m = kzalloc(sizeof(struct spi_message)
417 + ntrans * sizeof(struct spi_transfer),
418 flags);
419 if (m) {
420 int i;
421 struct spi_transfer *t = (struct spi_transfer *)(m + 1);
422
423 INIT_LIST_HEAD(&m->transfers);
424 for (i = 0; i < ntrans; i++, t++)
425 spi_message_add_tail(t, m);
426 }
427 return m;
428}
429
430static inline void spi_message_free(struct spi_message *m)
431{
432 kfree(m);
433}
434
435/**
436 * spi_setup -- setup SPI mode and clock rate
437 * @spi: the device whose settings are being modified
438 *
439 * SPI protocol drivers may need to update the transfer mode if the
440 * device doesn't work with the mode 0 default. They may likewise need
441 * to update clock rates or word sizes from initial values. This function
442 * changes those settings, and must be called from a context that can sleep.
443 * The changes take effect the next time the device is selected and data
444 * is transferred to or from it.
445 */
446static inline int
447spi_setup(struct spi_device *spi)
448{
449 return spi->master->setup(spi);
450}
451
452
453/**
454 * spi_async -- asynchronous SPI transfer
455 * @spi: device with which data will be exchanged
456 * @message: describes the data transfers, including completion callback
457 *
458 * This call may be used in_irq and other contexts which can't sleep,
459 * as well as from task contexts which can sleep.
460 *
461 * The completion callback is invoked in a context which can't sleep.
462 * Before that invocation, the value of message->status is undefined.
463 * When the callback is issued, message->status holds either zero (to
464 * indicate complete success) or a negative error code. After that
465 * callback returns, the driver which issued the transfer request may
466 * deallocate the associated memory; it's no longer in use by any SPI
467 * core or controller driver code.
468 *
469 * Note that although all messages to a spi_device are handled in
470 * FIFO order, messages may go to different devices in other orders.
471 * Some device might be higher priority, or have various "hard" access
472 * time requirements, for example.
473 *
474 * On detection of any fault during the transfer, processing of
475 * the entire message is aborted, and the device is deselected.
476 * Until returning from the associated message completion callback,
477 * no other spi_message queued to that device will be processed.
478 * (This rule applies equally to all the synchronous transfer calls,
479 * which are wrappers around this core asynchronous primitive.)
480 */
481static inline int
482spi_async(struct spi_device *spi, struct spi_message *message)
483{
484 message->spi = spi;
485 return spi->master->transfer(spi, message);
486}
487
488/*---------------------------------------------------------------------------*/
489
490/* All these synchronous SPI transfer routines are utilities layered
491 * over the core async transfer primitive. Here, "synchronous" means
492 * they will sleep uninterruptibly until the async transfer completes.
493 */
494
495extern int spi_sync(struct spi_device *spi, struct spi_message *message);
496
497/**
498 * spi_write - SPI synchronous write
499 * @spi: device to which data will be written
500 * @buf: data buffer
501 * @len: data buffer size
502 *
503 * This writes the buffer and returns zero or a negative error code.
504 * Callable only from contexts that can sleep.
505 */
506static inline int
507spi_write(struct spi_device *spi, const u8 *buf, size_t len)
508{
509 struct spi_transfer t = {
510 .tx_buf = buf,
511 .len = len,
512 };
513 struct spi_message m;
514
515 spi_message_init(&m);
516 spi_message_add_tail(&t, &m);
517 return spi_sync(spi, &m);
518}
519
520/**
521 * spi_read - SPI synchronous read
522 * @spi: device from which data will be read
523 * @buf: data buffer
524 * @len: data buffer size
525 *
526 * This writes the buffer and returns zero or a negative error code.
527 * Callable only from contexts that can sleep.
528 */
529static inline int
530spi_read(struct spi_device *spi, u8 *buf, size_t len)
531{
532 struct spi_transfer t = {
533 .rx_buf = buf,
534 .len = len,
535 };
536 struct spi_message m;
537
538 spi_message_init(&m);
539 spi_message_add_tail(&t, &m);
540 return spi_sync(spi, &m);
541}
542
543/* this copies txbuf and rxbuf data; for small transfers only! */
544extern int spi_write_then_read(struct spi_device *spi,
545 const u8 *txbuf, unsigned n_tx,
546 u8 *rxbuf, unsigned n_rx);
547
548/**
549 * spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read
550 * @spi: device with which data will be exchanged
551 * @cmd: command to be written before data is read back
552 *
553 * This returns the (unsigned) eight bit number returned by the
554 * device, or else a negative error code. Callable only from
555 * contexts that can sleep.
556 */
557static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd)
558{
559 ssize_t status;
560 u8 result;
561
562 status = spi_write_then_read(spi, &cmd, 1, &result, 1);
563
564 /* return negative errno or unsigned value */
565 return (status < 0) ? status : result;
566}
567
568/**
569 * spi_w8r16 - SPI synchronous 8 bit write followed by 16 bit read
570 * @spi: device with which data will be exchanged
571 * @cmd: command to be written before data is read back
572 *
573 * This returns the (unsigned) sixteen bit number returned by the
574 * device, or else a negative error code. Callable only from
575 * contexts that can sleep.
576 *
577 * The number is returned in wire-order, which is at least sometimes
578 * big-endian.
579 */
580static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
581{
582 ssize_t status;
583 u16 result;
584
585 status = spi_write_then_read(spi, &cmd, 1, (u8 *) &result, 2);
586
587 /* return negative errno or unsigned value */
588 return (status < 0) ? status : result;
589}
590
591/*---------------------------------------------------------------------------*/
592
593/*
594 * INTERFACE between board init code and SPI infrastructure.
595 *
596 * No SPI driver ever sees these SPI device table segments, but
597 * it's how the SPI core (or adapters that get hotplugged) grows
598 * the driver model tree.
599 *
600 * As a rule, SPI devices can't be probed. Instead, board init code
601 * provides a table listing the devices which are present, with enough
602 * information to bind and set up the device's driver. There's basic
603 * support for nonstatic configurations too; enough to handle adding
604 * parport adapters, or microcontrollers acting as USB-to-SPI bridges.
605 */
606
607/* board-specific information about each SPI device */
608struct spi_board_info {
609 /* the device name and module name are coupled, like platform_bus;
610 * "modalias" is normally the driver name.
611 *
612 * platform_data goes to spi_device.dev.platform_data,
613 * controller_data goes to spi_device.controller_data,
614 * irq is copied too
615 */
616 char modalias[KOBJ_NAME_LEN];
617 const void *platform_data;
618 void *controller_data;
619 int irq;
620
621 /* slower signaling on noisy or low voltage boards */
622 u32 max_speed_hz;
623
624
625 /* bus_num is board specific and matches the bus_num of some
626 * spi_master that will probably be registered later.
627 *
628 * chip_select reflects how this chip is wired to that master;
629 * it's less than num_chipselect.
630 */
631 u16 bus_num;
632 u16 chip_select;
633
634 /* ... may need additional spi_device chip config data here.
635 * avoid stuff protocol drivers can set; but include stuff
636 * needed to behave without being bound to a driver:
637 * - chipselect polarity
638 * - quirks like clock rate mattering when not selected
639 */
640};
641
642#ifdef CONFIG_SPI
643extern int
644spi_register_board_info(struct spi_board_info const *info, unsigned n);
645#else
646/* board init code may ignore whether SPI is configured or not */
647static inline int
648spi_register_board_info(struct spi_board_info const *info, unsigned n)
649 { return 0; }
650#endif
651
652
653/* If you're hotplugging an adapter with devices (parport, usb, etc)
654 * use spi_new_device() to describe each device. You can also call
655 * spi_unregister_device() to start making that device vanish, but
656 * normally that would be handled by spi_unregister_master().
657 */
658extern struct spi_device *
659spi_new_device(struct spi_master *, struct spi_board_info *);
660
661static inline void
662spi_unregister_device(struct spi_device *spi)
663{
664 if (spi)
665 device_unregister(&spi->dev);
666}
667
668#endif /* __LINUX_SPI_H */
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
new file mode 100644
index 000000000000..c961fe9bf3eb
--- /dev/null
+++ b/include/linux/spi/spi_bitbang.h
@@ -0,0 +1,135 @@
1#ifndef __SPI_BITBANG_H
2#define __SPI_BITBANG_H
3
4/*
5 * Mix this utility code with some glue code to get one of several types of
6 * simple SPI master driver. Two do polled word-at-a-time I/O:
7 *
8 * - GPIO/parport bitbangers. Provide chipselect() and txrx_word[](),
9 * expanding the per-word routines from the inline templates below.
10 *
11 * - Drivers for controllers resembling bare shift registers. Provide
12 * chipselect() and txrx_word[](), with custom setup()/cleanup() methods
13 * that use your controller's clock and chipselect registers.
14 *
15 * Some hardware works well with requests at spi_transfer scope:
16 *
17 * - Drivers leveraging smarter hardware, with fifos or DMA; or for half
18 * duplex (MicroWire) controllers. Provide chipslect() and txrx_bufs(),
19 * and custom setup()/cleanup() methods.
20 */
21struct spi_bitbang {
22 struct workqueue_struct *workqueue;
23 struct work_struct work;
24
25 spinlock_t lock;
26 struct list_head queue;
27 u8 busy;
28 u8 shutdown;
29 u8 use_dma;
30
31 struct spi_master *master;
32
33 void (*chipselect)(struct spi_device *spi, int is_on);
34#define BITBANG_CS_ACTIVE 1 /* normally nCS, active low */
35#define BITBANG_CS_INACTIVE 0
36
37 /* txrx_bufs() may handle dma mapping for transfers that don't
38 * already have one (transfer.{tx,rx}_dma is zero), or use PIO
39 */
40 int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t);
41
42 /* txrx_word[SPI_MODE_*]() just looks like a shift register */
43 u32 (*txrx_word[4])(struct spi_device *spi,
44 unsigned nsecs,
45 u32 word, u8 bits);
46};
47
48/* you can call these default bitbang->master methods from your custom
49 * methods, if you like.
50 */
51extern int spi_bitbang_setup(struct spi_device *spi);
52extern void spi_bitbang_cleanup(const struct spi_device *spi);
53extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m);
54
55/* start or stop queue processing */
56extern int spi_bitbang_start(struct spi_bitbang *spi);
57extern int spi_bitbang_stop(struct spi_bitbang *spi);
58
59#endif /* __SPI_BITBANG_H */
60
61/*-------------------------------------------------------------------------*/
62
63#ifdef EXPAND_BITBANG_TXRX
64
65/*
66 * The code that knows what GPIO pins do what should have declared four
67 * functions, ideally as inlines, before #defining EXPAND_BITBANG_TXRX
68 * and including this header:
69 *
70 * void setsck(struct spi_device *, int is_on);
71 * void setmosi(struct spi_device *, int is_on);
72 * int getmiso(struct spi_device *);
73 * void spidelay(unsigned);
74 *
75 * A non-inlined routine would call bitbang_txrx_*() routines. The
76 * main loop could easily compile down to a handful of instructions,
77 * especially if the delay is a NOP (to run at peak speed).
78 *
79 * Since this is software, the timings may not be exactly what your board's
80 * chips need ... there may be several reasons you'd need to tweak timings
81 * in these routines, not just make to make it faster or slower to match a
82 * particular CPU clock rate.
83 */
84
85static inline u32
86bitbang_txrx_be_cpha0(struct spi_device *spi,
87 unsigned nsecs, unsigned cpol,
88 u32 word, u8 bits)
89{
90 /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
91
92 /* clock starts at inactive polarity */
93 for (word <<= (32 - bits); likely(bits); bits--) {
94
95 /* setup MSB (to slave) on trailing edge */
96 setmosi(spi, word & (1 << 31));
97 spidelay(nsecs); /* T(setup) */
98
99 setsck(spi, !cpol);
100 spidelay(nsecs);
101
102 /* sample MSB (from slave) on leading edge */
103 word <<= 1;
104 word |= getmiso(spi);
105 setsck(spi, cpol);
106 }
107 return word;
108}
109
110static inline u32
111bitbang_txrx_be_cpha1(struct spi_device *spi,
112 unsigned nsecs, unsigned cpol,
113 u32 word, u8 bits)
114{
115 /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */
116
117 /* clock starts at inactive polarity */
118 for (word <<= (32 - bits); likely(bits); bits--) {
119
120 /* setup MSB (to slave) on leading edge */
121 setsck(spi, !cpol);
122 setmosi(spi, word & (1 << 31));
123 spidelay(nsecs); /* T(setup) */
124
125 setsck(spi, cpol);
126 spidelay(nsecs);
127
128 /* sample MSB (from slave) on trailing edge */
129 word <<= 1;
130 word |= getmiso(spi);
131 }
132 return word;
133}
134
135#endif /* EXPAND_BITBANG_TXRX */
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/svc.h b/include/linux/sunrpc/svc.h
index e4086ec8b952..50cab2a09f28 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -246,6 +246,7 @@ struct svc_deferred_req {
246 u32 prot; /* protocol (UDP or TCP) */ 246 u32 prot; /* protocol (UDP or TCP) */
247 struct sockaddr_in addr; 247 struct sockaddr_in addr;
248 struct svc_sock *svsk; /* where reply must go */ 248 struct svc_sock *svsk; /* where reply must go */
249 u32 daddr; /* where reply must come from */
249 struct cache_deferred_req handle; 250 struct cache_deferred_req handle;
250 int argslen; 251 int argslen;
251 u32 args[0]; 252 u32 args[0];
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 556617bcf7ac..4a99e4a7fbf3 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -167,6 +167,7 @@ extern void FASTCALL(lru_cache_add_active(struct page *));
167extern void FASTCALL(activate_page(struct page *)); 167extern void FASTCALL(activate_page(struct page *));
168extern void FASTCALL(mark_page_accessed(struct page *)); 168extern void FASTCALL(mark_page_accessed(struct page *));
169extern void lru_add_drain(void); 169extern void lru_add_drain(void);
170extern int lru_add_drain_all(void);
170extern int rotate_reclaimable_page(struct page *page); 171extern int rotate_reclaimable_page(struct page *page);
171extern void swap_setup(void); 172extern void swap_setup(void);
172 173
@@ -175,6 +176,29 @@ extern int try_to_free_pages(struct zone **, gfp_t);
175extern int shrink_all_memory(int); 176extern int shrink_all_memory(int);
176extern int vm_swappiness; 177extern int vm_swappiness;
177 178
179#ifdef CONFIG_NUMA
180extern int zone_reclaim_mode;
181extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
182#else
183#define zone_reclaim_mode 0
184static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
185{
186 return 0;
187}
188#endif
189
190#ifdef CONFIG_MIGRATION
191extern int isolate_lru_page(struct page *p);
192extern int putback_lru_pages(struct list_head *l);
193extern int migrate_pages(struct list_head *l, struct list_head *t,
194 struct list_head *moved, struct list_head *failed);
195#else
196static inline int isolate_lru_page(struct page *p) { return -ENOSYS; }
197static inline int putback_lru_pages(struct list_head *l) { return 0; }
198static inline int migrate_pages(struct list_head *l, struct list_head *t,
199 struct list_head *moved, struct list_head *failed) { return -ENOSYS; }
200#endif
201
178#ifdef CONFIG_MMU 202#ifdef CONFIG_MMU
179/* linux/mm/shmem.c */ 203/* linux/mm/shmem.c */
180extern int shmem_unuse(swp_entry_t entry, struct page *page); 204extern int shmem_unuse(swp_entry_t entry, struct page *page);
@@ -192,7 +216,7 @@ extern int rw_swap_page_sync(int, swp_entry_t, struct page *);
192extern struct address_space swapper_space; 216extern struct address_space swapper_space;
193#define total_swapcache_pages swapper_space.nrpages 217#define total_swapcache_pages swapper_space.nrpages
194extern void show_swap_cache_info(void); 218extern void show_swap_cache_info(void);
195extern int add_to_swap(struct page *); 219extern int add_to_swap(struct page *, gfp_t);
196extern void __delete_from_swap_cache(struct page *); 220extern void __delete_from_swap_cache(struct page *);
197extern void delete_from_swap_cache(struct page *); 221extern void delete_from_swap_cache(struct page *);
198extern int move_to_swap_cache(struct page *, swp_entry_t); 222extern int move_to_swap_cache(struct page *, 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..e666d6070569 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -510,6 +510,28 @@ asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3,
510asmlinkage long sys_ioprio_set(int which, int who, int ioprio); 510asmlinkage 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,
516 const unsigned long __user *to);
517asmlinkage long sys_mbind(unsigned long start, unsigned long len,
518 unsigned long mode,
519 unsigned long __user *nmask,
520 unsigned long maxnode,
521 unsigned flags);
522asmlinkage long sys_get_mempolicy(int __user *policy,
523 unsigned long __user *nmask,
524 unsigned long maxnode,
525 unsigned long addr, unsigned long flags);
526
527asmlinkage long sys_inotify_init(void);
528asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
529 u32 mask);
530asmlinkage long sys_inotify_rm_watch(int fd, u32 wd);
531
532asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
533 __u32 __user *ustatus);
534asmlinkage long sys_spu_create(const char __user *name,
535 unsigned int flags, mode_t mode);
514 536
515#endif 537#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index a9b80fc7f0f3..8352a7ce5895 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -180,6 +180,9 @@ 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 */
185 VM_ZONE_RECLAIM_MODE=31,/* reclaim local zone memory before going off node */
183}; 186};
184 187
185 188
diff --git a/include/linux/time.h b/include/linux/time.h
index 797ccd813bb0..614dd8465839 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(int dfd, 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/tipc.h b/include/linux/tipc.h
new file mode 100644
index 000000000000..243a15f54002
--- /dev/null
+++ b/include/linux/tipc.h
@@ -0,0 +1,212 @@
1/*
2 * include/linux/tipc.h: Include file for TIPC socket interface
3 *
4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _LINUX_TIPC_H_
38#define _LINUX_TIPC_H_
39
40#include <linux/types.h>
41
42/*
43 * TIPC addressing primitives
44 */
45
46struct tipc_portid {
47 __u32 ref;
48 __u32 node;
49};
50
51struct tipc_name {
52 __u32 type;
53 __u32 instance;
54};
55
56struct tipc_name_seq {
57 __u32 type;
58 __u32 lower;
59 __u32 upper;
60};
61
62static inline __u32 tipc_addr(unsigned int zone,
63 unsigned int cluster,
64 unsigned int node)
65{
66 return (zone << 24) | (cluster << 12) | node;
67}
68
69static inline unsigned int tipc_zone(__u32 addr)
70{
71 return addr >> 24;
72}
73
74static inline unsigned int tipc_cluster(__u32 addr)
75{
76 return (addr >> 12) & 0xfff;
77}
78
79static inline unsigned int tipc_node(__u32 addr)
80{
81 return addr & 0xfff;
82}
83
84/*
85 * Application-accessible port name types
86 */
87
88#define TIPC_CFG_SRV 0 /* configuration service name type */
89#define TIPC_TOP_SRV 1 /* topology service name type */
90#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */
91
92/*
93 * Publication scopes when binding port names and port name sequences
94 */
95
96#define TIPC_ZONE_SCOPE 1
97#define TIPC_CLUSTER_SCOPE 2
98#define TIPC_NODE_SCOPE 3
99
100/*
101 * Limiting values for messages
102 */
103
104#define TIPC_MAX_USER_MSG_SIZE 66000
105
106/*
107 * Message importance levels
108 */
109
110#define TIPC_LOW_IMPORTANCE 0 /* default */
111#define TIPC_MEDIUM_IMPORTANCE 1
112#define TIPC_HIGH_IMPORTANCE 2
113#define TIPC_CRITICAL_IMPORTANCE 3
114
115/*
116 * Msg rejection/connection shutdown reasons
117 */
118
119#define TIPC_OK 0
120#define TIPC_ERR_NO_NAME 1
121#define TIPC_ERR_NO_PORT 2
122#define TIPC_ERR_NO_NODE 3
123#define TIPC_ERR_OVERLOAD 4
124#define TIPC_CONN_SHUTDOWN 5
125
126/*
127 * TIPC topology subscription service definitions
128 */
129
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */
132#if 0
133/* The following filter options are not currently implemented */
134#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
135#define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */
136#define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */
137#endif
138
139#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */
140
141struct tipc_subscr {
142 struct tipc_name_seq seq; /* name sequence of interest */
143 __u32 timeout; /* subscription duration (in ms) */
144 __u32 filter; /* bitmask of filter options */
145 char usr_handle[8]; /* available for subscriber use */
146};
147
148#define TIPC_PUBLISHED 1 /* publication event */
149#define TIPC_WITHDRAWN 2 /* withdraw event */
150#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */
151
152struct tipc_event {
153 __u32 event; /* event type */
154 __u32 found_lower; /* matching name seq instances */
155 __u32 found_upper; /* " " " " */
156 struct tipc_portid port; /* associated port */
157 struct tipc_subscr s; /* associated subscription */
158};
159
160/*
161 * Socket API
162 */
163
164#ifndef AF_TIPC
165#define AF_TIPC 30
166#endif
167
168#ifndef PF_TIPC
169#define PF_TIPC AF_TIPC
170#endif
171
172#ifndef SOL_TIPC
173#define SOL_TIPC 271
174#endif
175
176#define TIPC_ADDR_NAMESEQ 1
177#define TIPC_ADDR_MCAST 1
178#define TIPC_ADDR_NAME 2
179#define TIPC_ADDR_ID 3
180
181struct sockaddr_tipc {
182 unsigned short family;
183 unsigned char addrtype;
184 signed char scope;
185 union {
186 struct tipc_portid id;
187 struct tipc_name_seq nameseq;
188 struct {
189 struct tipc_name name;
190 __u32 domain; /* 0: own zone */
191 } name;
192 } addr;
193};
194
195/*
196 * Ancillary data objects supported by recvmsg()
197 */
198
199#define TIPC_ERRINFO 1 /* error info */
200#define TIPC_RETDATA 2 /* returned data */
201#define TIPC_DESTNAME 3 /* destination name */
202
203/*
204 * TIPC-specific socket option values
205 */
206
207#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */
208#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */
209#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */
210#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */
211
212#endif
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
new file mode 100644
index 000000000000..33a653913d94
--- /dev/null
+++ b/include/linux/tipc_config.h
@@ -0,0 +1,410 @@
1/*
2 * include/linux/tipc_config.h: Include file for TIPC configuration interface
3 *
4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _LINUX_TIPC_CONFIG_H_
38#define _LINUX_TIPC_CONFIG_H_
39
40#include <linux/types.h>
41#include <linux/string.h>
42#include <asm/byteorder.h>
43
44/*
45 * Configuration
46 *
47 * All configuration management messaging involves sending a request message
48 * to the TIPC configuration service on a node, which sends a reply message
49 * back. (In the future multi-message replies may be supported.)
50 *
51 * Both request and reply messages consist of a transport header and payload.
52 * The transport header contains info about the desired operation;
53 * the payload consists of zero or more type/length/value (TLV) items
54 * which specify parameters or results for the operation.
55 *
56 * For many operations, the request and reply messages have a fixed number
57 * of TLVs (usually zero or one); however, some reply messages may return
58 * a variable number of TLVs. A failed request is denoted by the presence
59 * of an "error string" TLV in the reply message instead of the TLV(s) the
60 * reply should contain if the request succeeds.
61 */
62
63/*
64 * Public commands:
65 * May be issued by any process.
66 * Accepted by own node, or by remote node only if remote management enabled.
67 */
68
69#define TIPC_CMD_NOOP 0x0000 /* tx none, rx none */
70#define TIPC_CMD_GET_NODES 0x0001 /* tx net_addr, rx node_info(s) */
71#define TIPC_CMD_GET_MEDIA_NAMES 0x0002 /* tx none, rx media_name(s) */
72#define TIPC_CMD_GET_BEARER_NAMES 0x0003 /* tx none, rx bearer_name(s) */
73#define TIPC_CMD_GET_LINKS 0x0004 /* tx net_addr, rx link_info(s) */
74#define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */
75#define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */
76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */
77
78#if 0
79#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */
80#define TIPC_CMD_RESET_PORT_STATS 0x0009 /* tx port_ref, rx none */
81#define TIPC_CMD_GET_ROUTES 0x000A /* tx ?, rx ? */
82#define TIPC_CMD_GET_LINK_PEER 0x000D /* tx link_name, rx ? */
83#endif
84
85/*
86 * Protected commands:
87 * May only be issued by "network administration capable" process.
88 * Accepted by own node, or by remote node only if remote management enabled
89 * and this node is zone manager.
90 */
91
92#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */
93#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */
94#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */
95#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */
96#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* tx none, rx unsigned */
97#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* tx none, rx unsigned */
98#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */
99#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* tx none, rx unsigned */
100#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */
101
102#define TIPC_CMD_ENABLE_BEARER 0x4101 /* tx bearer_config, rx none */
103#define TIPC_CMD_DISABLE_BEARER 0x4102 /* tx bearer_name, rx none */
104#define TIPC_CMD_SET_LINK_TOL 0x4107 /* tx link_config, rx none */
105#define TIPC_CMD_SET_LINK_PRI 0x4108 /* tx link_config, rx none */
106#define TIPC_CMD_SET_LINK_WINDOW 0x4109 /* tx link_config, rx none */
107#define TIPC_CMD_SET_LOG_SIZE 0x410A /* tx unsigned, rx none */
108#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */
109#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */
110
111#if 0
112#define TIPC_CMD_CREATE_LINK 0x4103 /* tx link_create, rx none */
113#define TIPC_CMD_REMOVE_LINK 0x4104 /* tx link_name, rx none */
114#define TIPC_CMD_BLOCK_LINK 0x4105 /* tx link_name, rx none */
115#define TIPC_CMD_UNBLOCK_LINK 0x4106 /* tx link_name, rx none */
116#endif
117
118/*
119 * Private commands:
120 * May only be issued by "network administration capable" process.
121 * Accepted by own node only; cannot be used on a remote node.
122 */
123
124#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */
125#if 0
126#define TIPC_CMD_SET_ZONE_MASTER 0x8002 /* tx none, rx none */
127#endif
128#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
129#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
130#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */
131#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */
132#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* tx unsigned, rx none */
133#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* tx unsigned, rx none */
134#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */
135#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* tx unsigned, rx none */
136#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */
137
138/*
139 * TLV types defined for TIPC
140 */
141
142#define TIPC_TLV_NONE 0 /* no TLV present */
143#define TIPC_TLV_VOID 1 /* empty TLV (0 data bytes)*/
144#define TIPC_TLV_UNSIGNED 2 /* 32-bit integer */
145#define TIPC_TLV_STRING 3 /* char[128] (max) */
146#define TIPC_TLV_LARGE_STRING 4 /* char[2048] (max) */
147#define TIPC_TLV_ULTRA_STRING 5 /* char[32768] (max) */
148
149#define TIPC_TLV_ERROR_STRING 16 /* char[128] containing "error code" */
150#define TIPC_TLV_NET_ADDR 17 /* 32-bit integer denoting <Z.C.N> */
151#define TIPC_TLV_MEDIA_NAME 18 /* char[TIPC_MAX_MEDIA_NAME] */
152#define TIPC_TLV_BEARER_NAME 19 /* char[TIPC_MAX_BEARER_NAME] */
153#define TIPC_TLV_LINK_NAME 20 /* char[TIPC_MAX_LINK_NAME] */
154#define TIPC_TLV_NODE_INFO 21 /* struct tipc_node_info */
155#define TIPC_TLV_LINK_INFO 22 /* struct tipc_link_info */
156#define TIPC_TLV_BEARER_CONFIG 23 /* struct tipc_bearer_config */
157#define TIPC_TLV_LINK_CONFIG 24 /* struct tipc_link_config */
158#define TIPC_TLV_NAME_TBL_QUERY 25 /* struct tipc_name_table_query */
159#define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */
160
161/*
162 * Maximum sizes of TIPC bearer-related names (including terminating NUL)
163 */
164
165#define TIPC_MAX_MEDIA_NAME 16 /* format = media */
166#define TIPC_MAX_IF_NAME 16 /* format = interface */
167#define TIPC_MAX_BEARER_NAME 32 /* format = media:interface */
168#define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */
169
170/*
171 * Link priority limits (min, default, max, media default)
172 */
173
174#define TIPC_MIN_LINK_PRI 0
175#define TIPC_DEF_LINK_PRI 10
176#define TIPC_MAX_LINK_PRI 31
177#define TIPC_MEDIA_LINK_PRI (TIPC_MAX_LINK_PRI + 1)
178
179/*
180 * Link tolerance limits (min, default, max), in ms
181 */
182
183#define TIPC_MIN_LINK_TOL 50
184#define TIPC_DEF_LINK_TOL 1500
185#define TIPC_MAX_LINK_TOL 30000
186
187/*
188 * Link window limits (min, default, max), in packets
189 */
190
191#define TIPC_MIN_LINK_WIN 16
192#define TIPC_DEF_LINK_WIN 50
193#define TIPC_MAX_LINK_WIN 150
194
195
196struct tipc_node_info {
197 __u32 addr; /* network address of node */
198 __u32 up; /* 0=down, 1= up */
199};
200
201struct tipc_link_info {
202 __u32 dest; /* network address of peer node */
203 __u32 up; /* 0=down, 1=up */
204 char str[TIPC_MAX_LINK_NAME]; /* link name */
205};
206
207struct tipc_bearer_config {
208 __u32 priority; /* Range [1,31]. Override per link */
209 __u32 detect_scope;
210 char name[TIPC_MAX_BEARER_NAME];
211};
212
213struct tipc_link_config {
214 __u32 value;
215 char name[TIPC_MAX_LINK_NAME];
216};
217
218#define TIPC_NTQ_ALLTYPES 0x80000000
219
220struct tipc_name_table_query {
221 __u32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */
222 __u32 type; /* {t,l,u} info ignored if high bit of "depth" is set */
223 __u32 lowbound; /* (i.e. displays all entries of name table) */
224 __u32 upbound;
225};
226
227/*
228 * The error string TLV is a null-terminated string describing the cause
229 * of the request failure. To simplify error processing (and to save space)
230 * the first character of the string can be a special error code character
231 * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason.
232 */
233
234#define TIPC_CFG_TLV_ERROR "\x80" /* request contains incorrect TLV(s) */
235#define TIPC_CFG_NOT_NET_ADMIN "\x81" /* must be network administrator */
236#define TIPC_CFG_NOT_ZONE_MSTR "\x82" /* must be zone master */
237#define TIPC_CFG_NO_REMOTE "\x83" /* remote management not enabled */
238#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */
239#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */
240
241#if 0
242/* prototypes TLV structures for proposed commands */
243struct tipc_link_create {
244 __u32 domain;
245 struct tipc_media_addr peer_addr;
246 char bearer_name[TIPC_MAX_BEARER_NAME];
247};
248
249struct tipc_route_info {
250 __u32 dest;
251 __u32 router;
252};
253#endif
254
255/*
256 * A TLV consists of a descriptor, followed by the TLV value.
257 * TLV descriptor fields are stored in network byte order;
258 * TLV values must also be stored in network byte order (where applicable).
259 * TLV descriptors must be aligned to addresses which are multiple of 4,
260 * so up to 3 bytes of padding may exist at the end of the TLV value area.
261 * There must not be any padding between the TLV descriptor and its value.
262 */
263
264struct tlv_desc {
265 __u16 tlv_len; /* TLV length (descriptor + value) */
266 __u16 tlv_type; /* TLV identifier */
267};
268
269#define TLV_ALIGNTO 4
270
271#define TLV_ALIGN(datalen) (((datalen)+(TLV_ALIGNTO-1)) & ~(TLV_ALIGNTO-1))
272#define TLV_LENGTH(datalen) (sizeof(struct tlv_desc) + (datalen))
273#define TLV_SPACE(datalen) (TLV_ALIGN(TLV_LENGTH(datalen)))
274#define TLV_DATA(tlv) ((void *)((char *)(tlv) + TLV_LENGTH(0)))
275
276static inline int TLV_OK(const void *tlv, __u16 space)
277{
278 /*
279 * Would also like to check that "tlv" is a multiple of 4,
280 * but don't know how to do this in a portable way.
281 * - Tried doing (!(tlv & (TLV_ALIGNTO-1))), but GCC compiler
282 * won't allow binary "&" with a pointer.
283 * - Tried casting "tlv" to integer type, but causes warning about size
284 * mismatch when pointer is bigger than chosen type (int, long, ...).
285 */
286
287 return (space >= TLV_SPACE(0)) &&
288 (ntohs(((struct tlv_desc *)tlv)->tlv_len) <= space);
289}
290
291static inline int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type)
292{
293 return TLV_OK(tlv, space) &&
294 (ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type);
295}
296
297static inline int TLV_SET(void *tlv, __u16 type, void *data, __u16 len)
298{
299 struct tlv_desc *tlv_ptr;
300 int tlv_len;
301
302 tlv_len = TLV_LENGTH(len);
303 tlv_ptr = (struct tlv_desc *)tlv;
304 tlv_ptr->tlv_type = htons(type);
305 tlv_ptr->tlv_len = htons(tlv_len);
306 if (len && data)
307 memcpy(TLV_DATA(tlv_ptr), data, tlv_len);
308 return TLV_SPACE(len);
309}
310
311/*
312 * A TLV list descriptor simplifies processing of messages
313 * containing multiple TLVs.
314 */
315
316struct tlv_list_desc {
317 struct tlv_desc *tlv_ptr; /* ptr to current TLV */
318 __u32 tlv_space; /* # bytes from curr TLV to list end */
319};
320
321static inline void TLV_LIST_INIT(struct tlv_list_desc *list,
322 void *data, __u32 space)
323{
324 list->tlv_ptr = (struct tlv_desc *)data;
325 list->tlv_space = space;
326}
327
328static inline int TLV_LIST_EMPTY(struct tlv_list_desc *list)
329{
330 return (list->tlv_space == 0);
331}
332
333static inline int TLV_LIST_CHECK(struct tlv_list_desc *list, __u16 exp_type)
334{
335 return TLV_CHECK(list->tlv_ptr, list->tlv_space, exp_type);
336}
337
338static inline void *TLV_LIST_DATA(struct tlv_list_desc *list)
339{
340 return TLV_DATA(list->tlv_ptr);
341}
342
343static inline void TLV_LIST_STEP(struct tlv_list_desc *list)
344{
345 __u16 tlv_space = TLV_ALIGN(ntohs(list->tlv_ptr->tlv_len));
346
347 list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space);
348 list->tlv_space -= tlv_space;
349}
350
351/*
352 * Configuration messages exchanged via NETLINK_GENERIC use the following
353 * family id, name, version and command.
354 */
355#define TIPC_GENL_NAME "TIPC"
356#define TIPC_GENL_VERSION 0x1
357#define TIPC_GENL_CMD 0x1
358
359/*
360 * TIPC specific header used in NETLINK_GENERIC requests.
361 */
362struct tipc_genlmsghdr {
363 __u32 dest; /* Destination address */
364 __u16 cmd; /* Command */
365 __u16 reserved; /* Unused */
366};
367
368#define TIPC_GENL_HDRLEN NLMSG_ALIGN(sizeof(struct tipc_genlmsghdr))
369
370/*
371 * Configuration messages exchanged via TIPC sockets use the TIPC configuration
372 * message header, which is defined below. This structure is analogous
373 * to the Netlink message header, but fields are stored in network byte order
374 * and no padding is permitted between the header and the message data
375 * that follows.
376 */
377
378struct tipc_cfg_msg_hdr
379{
380 __u32 tcm_len; /* Message length (including header) */
381 __u16 tcm_type; /* Command type */
382 __u16 tcm_flags; /* Additional flags */
383 char tcm_reserved[8]; /* Unused */
384};
385
386#define TCM_F_REQUEST 0x1 /* Flag: Request message */
387#define TCM_F_MORE 0x2 /* Flag: Message to be continued */
388
389#define TCM_ALIGN(datalen) (((datalen)+3) & ~3)
390#define TCM_LENGTH(datalen) (sizeof(struct tipc_cfg_msg_hdr) + datalen)
391#define TCM_SPACE(datalen) (TCM_ALIGN(TCM_LENGTH(datalen)))
392#define TCM_DATA(tcm_hdr) ((void *)((char *)(tcm_hdr) + TCM_LENGTH(0)))
393
394static inline int TCM_SET(void *msg, __u16 cmd, __u16 flags,
395 void *data, __u16 data_len)
396{
397 struct tipc_cfg_msg_hdr *tcm_hdr;
398 int msg_len;
399
400 msg_len = TCM_LENGTH(data_len);
401 tcm_hdr = (struct tipc_cfg_msg_hdr *)msg;
402 tcm_hdr->tcm_len = htonl(msg_len);
403 tcm_hdr->tcm_type = htons(cmd);
404 tcm_hdr->tcm_flags = htons(flags);
405 if (data_len && data)
406 memcpy(TCM_DATA(msg), data, data_len);
407 return TCM_SPACE(data_len);
408}
409
410#endif
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 3df1d474e5c5..e8eb0040ce3a 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -56,6 +56,14 @@
56#define REMOTE_DISTANCE 20 56#define REMOTE_DISTANCE 20
57#define node_distance(from,to) ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE) 57#define node_distance(from,to) ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)
58#endif 58#endif
59#ifndef RECLAIM_DISTANCE
60/*
61 * If the distance between nodes in a system is larger than RECLAIM_DISTANCE
62 * (in whatever arch specific measurement units returned by node_distance())
63 * then switch on zone reclaim on boot.
64 */
65#define RECLAIM_DISTANCE 20
66#endif
59#ifndef PENALTY_FOR_NODE_WITH_CPUS 67#ifndef PENALTY_FOR_NODE_WITH_CPUS
60#define PENALTY_FOR_NODE_WITH_CPUS (1) 68#define PENALTY_FOR_NODE_WITH_CPUS (1)
61#endif 69#endif
@@ -86,7 +94,6 @@
86 .max_interval = 2, \ 94 .max_interval = 2, \
87 .busy_factor = 8, \ 95 .busy_factor = 8, \
88 .imbalance_pct = 110, \ 96 .imbalance_pct = 110, \
89 .cache_hot_time = 0, \
90 .cache_nice_tries = 0, \ 97 .cache_nice_tries = 0, \
91 .per_cpu_gain = 25, \ 98 .per_cpu_gain = 25, \
92 .busy_idx = 0, \ 99 .busy_idx = 0, \
@@ -117,7 +124,6 @@
117 .max_interval = 4, \ 124 .max_interval = 4, \
118 .busy_factor = 64, \ 125 .busy_factor = 64, \
119 .imbalance_pct = 125, \ 126 .imbalance_pct = 125, \
120 .cache_hot_time = (5*1000000/2), \
121 .cache_nice_tries = 1, \ 127 .cache_nice_tries = 1, \
122 .per_cpu_gain = 100, \ 128 .per_cpu_gain = 100, \
123 .busy_idx = 2, \ 129 .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/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 b096159086e8..beaef5c7a0ea 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -103,7 +103,9 @@ void balance_dirty_pages_ratelimited(struct address_space *mapping);
103int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); 103int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
104int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 104int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
105int sync_page_range(struct inode *inode, struct address_space *mapping, 105int sync_page_range(struct inode *inode, struct address_space *mapping,
106 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);
107 109
108/* pdflush.c */ 110/* pdflush.c */
109extern 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/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_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-types.h b/include/media/tuner-types.h
new file mode 100644
index 000000000000..15821ab14a9e
--- /dev/null
+++ b/include/media/tuner-types.h
@@ -0,0 +1,55 @@
1/*
2 * descriptions for simple tuners.
3 */
4
5#ifndef __TUNER_TYPES_H__
6#define __TUNER_TYPES_H__
7
8enum param_type {
9 TUNER_PARAM_TYPE_RADIO, \
10 TUNER_PARAM_TYPE_PAL, \
11 TUNER_PARAM_TYPE_SECAM, \
12 TUNER_PARAM_TYPE_NTSC
13};
14
15struct tuner_range {
16 unsigned short limit;
17 unsigned char cb;
18};
19
20struct tuner_params {
21 enum param_type type;
22 /* Many Philips based tuners have a comment like this in their
23 * datasheet:
24 *
25 * For channel selection involving band switching, and to ensure
26 * smooth tuning to the desired channel without causing
27 * unnecessary charge pump action, it is recommended to consider
28 * the difference between wanted channel frequency and the
29 * current channel frequency. Unnecessary charge pump action
30 * will result in very low tuning voltage which may drive the
31 * oscillator to extreme conditions.
32 *
33 * Set cb_first_if_lower_freq to 1, if this check is
34 * required for this tuner.
35 *
36 * I tested this for PAL by first setting the TV frequency to
37 * 203 MHz and then switching to 96.6 MHz FM radio. The result was
38 * static unless the control byte was sent first.
39 */
40 unsigned int cb_first_if_lower_freq:1;
41 unsigned char config; /* to be moved into struct tuner_range for dvb-pll merge */
42
43 unsigned int count;
44 struct tuner_range *ranges;
45};
46
47struct tunertype {
48 char *name;
49 struct tuner_params *params;
50};
51
52extern struct tunertype tuners[];
53extern unsigned const int tuner_count;
54
55#endif
diff --git a/include/media/tuner.h b/include/media/tuner.h
index b37cde606692..a5beeac495c7 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -23,6 +23,7 @@
23#define _TUNER_H 23#define _TUNER_H
24 24
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26#include <media/tuner-types.h>
26 27
27#define ADDR_UNSET (255) 28#define ADDR_UNSET (255)
28 29
@@ -82,9 +83,9 @@
82#define TUNER_PHILIPS_FM1236_MK3 43 83#define TUNER_PHILIPS_FM1236_MK3 43
83 84
84#define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */ 85#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 */ 86/* Microtune merged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */
86#define TUNER_MICROTUNE_4049FM5 45 87#define TUNER_MICROTUNE_4049FM5 45
87#define TUNER_MICROTUNE_4042_FI5 46 88#define TUNER_PANASONIC_VP27 46
88#define TUNER_LG_NTSC_TAPE 47 89#define TUNER_LG_NTSC_TAPE 47
89 90
90#define TUNER_TNF_8831BGFF 48 91#define TUNER_TNF_8831BGFF 48
@@ -102,7 +103,7 @@
102#define TUNER_YMEC_TVF_8531MF 58 103#define TUNER_YMEC_TVF_8531MF 58
103#define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */ 104#define TUNER_YMEC_TVF_5533MF 59 /* Pixelview Pro Ultra NTSC */
104 105
105#define TUNER_THOMSON_DTT7611 60 /* DViCO FusionHDTV 3 Gold-T */ 106#define TUNER_THOMSON_DTT761X 60 /* DTT 7611 7611A 7612 7613 7613A 7614 7615 7615A */
106#define TUNER_TENA_9533_DI 61 107#define TUNER_TENA_9533_DI 61
107#define TUNER_TEA5767 62 /* Only FM Radio Tuner */ 108#define TUNER_TEA5767 62 /* Only FM Radio Tuner */
108#define TUNER_PHILIPS_FMD1216ME_MK3 63 109#define TUNER_PHILIPS_FMD1216ME_MK3 63
@@ -114,48 +115,28 @@
114 115
115#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */ 116#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */
116#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */ 117#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */
117 118#define TUNER_SAMSUNG_TCPN_2121P30A 70 /* Hauppauge PVR-500MCE NTSC */
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 119
144/* tv card specific */ 120/* tv card specific */
145# define TDA9887_PRESENT (1<<0) 121#define TDA9887_PRESENT (1<<0)
146# define TDA9887_PORT1_INACTIVE (1<<1) 122#define TDA9887_PORT1_INACTIVE (1<<1)
147# define TDA9887_PORT2_INACTIVE (1<<2) 123#define TDA9887_PORT2_INACTIVE (1<<2)
148# define TDA9887_QSS (1<<3) 124#define TDA9887_QSS (1<<3)
149# define TDA9887_INTERCARRIER (1<<4) 125#define TDA9887_INTERCARRIER (1<<4)
150# define TDA9887_PORT1_ACTIVE (1<<5) 126#define TDA9887_PORT1_ACTIVE (1<<5)
151# define TDA9887_PORT2_ACTIVE (1<<6) 127#define TDA9887_PORT2_ACTIVE (1<<6)
152# define TDA9887_INTERCARRIER_NTSC (1<<7) 128#define TDA9887_INTERCARRIER_NTSC (1<<7)
129/* Tuner takeover point adjustment, in dB, -16 <= top <= 15 */
130#define TDA9887_TOP_MASK (0x3f << 8)
131#define TDA9887_TOP_SET (1 << 13)
132#define TDA9887_TOP(top) (TDA9887_TOP_SET | (((16 + (top)) & 0x1f) << 8))
133
153/* config options */ 134/* config options */
154# define TDA9887_DEEMPHASIS_MASK (3<<16) 135#define TDA9887_DEEMPHASIS_MASK (3<<16)
155# define TDA9887_DEEMPHASIS_NONE (1<<16) 136#define TDA9887_DEEMPHASIS_NONE (1<<16)
156# define TDA9887_DEEMPHASIS_50 (2<<16) 137#define TDA9887_DEEMPHASIS_50 (2<<16)
157# define TDA9887_DEEMPHASIS_75 (3<<16) 138#define TDA9887_DEEMPHASIS_75 (3<<16)
158# define TDA9887_AUTOMUTE (1<<18) 139#define TDA9887_AUTOMUTE (1<<18)
159 140
160#ifdef __KERNEL__ 141#ifdef __KERNEL__
161 142
@@ -167,10 +148,26 @@ enum tuner_mode {
167 T_STANDBY = 1 << 31 148 T_STANDBY = 1 << 31
168}; 149};
169 150
151/* Older boards only had a single tuner device. Nowadays multiple tuner
152 devices may be present on a single board. Using TUNER_SET_TYPE_ADDR
153 to pass the tuner_setup structure it is possible to setup each tuner
154 device in turn.
155
156 Since multiple devices may be present it is no longer sufficient to
157 send a command to a single i2c device. Instead you should broadcast
158 the command to all i2c devices.
159
160 By setting the mode_mask correctly you can select which commands are
161 accepted by a specific tuner device. For example, set mode_mask to
162 T_RADIO if the device is a radio-only tuner. That specific tuner will
163 only accept commands when the tuner is in radio mode and ignore them
164 when the tuner is set to TV mode.
165 */
166
170struct tuner_setup { 167struct tuner_setup {
171 unsigned short addr; 168 unsigned short addr; /* I2C address */
172 unsigned int type; 169 unsigned int type; /* Tuner type */
173 unsigned int mode_mask; 170 unsigned int mode_mask; /* Allowed tuner modes */
174}; 171};
175 172
176struct tuner { 173struct tuner {
@@ -182,7 +179,9 @@ struct tuner {
182 unsigned int mode; 179 unsigned int mode;
183 unsigned int mode_mask; /* Combination of allowable modes */ 180 unsigned int mode_mask; /* Combination of allowable modes */
184 181
185 unsigned int freq; /* keep track of the current settings */ 182 unsigned int tv_freq; /* keep track of the current settings */
183 unsigned int radio_freq;
184 u16 last_div;
186 unsigned int audmode; 185 unsigned int audmode;
187 v4l2_std_id std; 186 v4l2_std_id std;
188 187
@@ -200,14 +199,13 @@ struct tuner {
200 unsigned int sgIF; 199 unsigned int sgIF;
201 200
202 /* function ptrs */ 201 /* function ptrs */
203 void (*tv_freq)(struct i2c_client *c, unsigned int freq); 202 void (*set_tv_freq)(struct i2c_client *c, unsigned int freq);
204 void (*radio_freq)(struct i2c_client *c, unsigned int freq); 203 void (*set_radio_freq)(struct i2c_client *c, unsigned int freq);
205 int (*has_signal)(struct i2c_client *c); 204 int (*has_signal)(struct i2c_client *c);
206 int (*is_stereo)(struct i2c_client *c); 205 int (*is_stereo)(struct i2c_client *c);
207 void (*standby)(struct i2c_client *c); 206 void (*standby)(struct i2c_client *c);
208}; 207};
209 208
210extern unsigned int tuner_debug;
211extern unsigned const int tuner_count; 209extern unsigned const int tuner_count;
212 210
213extern int microtune_init(struct i2c_client *c); 211extern int microtune_init(struct i2c_client *c);
@@ -219,15 +217,15 @@ extern int tea5767_autodetection(struct i2c_client *c);
219 217
220#define tuner_warn(fmt, arg...) do {\ 218#define tuner_warn(fmt, arg...) do {\
221 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ 219 printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
222 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 220 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
223#define tuner_info(fmt, arg...) do {\ 221#define tuner_info(fmt, arg...) do {\
224 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ 222 printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
225 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) 223 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
226#define tuner_dbg(fmt, arg...) do {\ 224#define tuner_dbg(fmt, arg...) do {\
225 extern int tuner_debug; \
227 if (tuner_debug) \ 226 if (tuner_debug) \
228 printk(KERN_DEBUG "%s %d-%04x: " fmt, \ 227 printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
229 t->i2c.driver->driver.name, \ 228 i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
230 t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0)
231 229
232#endif /* __KERNEL__ */ 230#endif /* __KERNEL__ */
233 231
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index d3fd48157eb8..d4030a7e16e0 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,27 @@ 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/* msp3400 ioctl: will be removed in the near future */
124struct msp_matrix {
125 int input;
126 int output;
127};
128#define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix)
129
130/* tuner ioctls */
131/* Sets tuner type and its I2C addr */
132#define TUNER_SET_TYPE_ADDR _IOW('d',90,int)
133/* Puts tuner on powersaving state, disabling it, except for i2c */
134#define TUNER_SET_STANDBY _IOW('d',91,int)
135/* Sets tda9887 specific stuff, like port1, port2 and qss */
136#define TDA9887_SET_CONFIG _IOW('d',92,int)
137
73/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 138/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
74#define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register) 139#define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register)
75#define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register) 140#define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register)
@@ -77,10 +142,12 @@ enum v4l2_chip_ident {
77/* Reset the I2C chip */ 142/* Reset the I2C chip */
78#define VIDIOC_INT_RESET _IO ('d', 102) 143#define VIDIOC_INT_RESET _IO ('d', 102)
79 144
80/* Set the frequency of the audio clock output. 145/* Set the frequency (in Hz) of the audio clock output.
81 Used to slave an audio processor to the video decoder, ensuring that audio 146 Used to slave an audio processor to the video decoder, ensuring that audio
82 and video remain synchronized. */ 147 and video remain synchronized.
83#define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOR ('d', 103, enum v4l2_audio_clock_freq) 148 Usual values for the frequency are 48000, 44100 or 32000 Hz.
149 If the frequency is not supported, then -EINVAL is returned. */
150#define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOW ('d', 103, u32)
84 151
85/* Video decoders that support sliced VBI need to implement this ioctl. 152/* 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 153 Field p of the v4l2_sliced_vbi_line struct is set to the start of the VBI
@@ -107,4 +174,10 @@ enum v4l2_chip_ident {
107 be made. */ 174 be made. */
108#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *) 175#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *)
109 176
177/* Sets I2S speed in bps. This is used to provide a standard way to select I2S
178 clock used by driving digital audio streams at some board designs.
179 Usual values for the frequency are 1024000 and 2048000.
180 If the frequency is not supported, then -EINVAL is returned. */
181#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
182
110#endif /* V4L2_COMMON_H_ */ 183#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/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 bee8b84d329d..5161e89017f9 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -225,16 +225,7 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout)
225/* Output packet to network from transport. */ 225/* Output packet to network from transport. */
226static inline int dst_output(struct sk_buff *skb) 226static inline int dst_output(struct sk_buff *skb)
227{ 227{
228 int err; 228 return skb->dst->output(skb);
229
230 for (;;) {
231 err = skb->dst->output(skb);
232
233 if (likely(err == 0))
234 return err;
235 if (unlikely(err != NET_XMIT_BYPASS))
236 return err;
237 }
238} 229}
239 230
240/* Input packet from network to transport. */ 231/* Input packet from network to transport. */
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index c5b96b2b8155..805de50df00d 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -22,7 +22,6 @@ struct genl_family
22 char name[GENL_NAMSIZ]; 22 char name[GENL_NAMSIZ];
23 unsigned int version; 23 unsigned int version;
24 unsigned int maxattr; 24 unsigned int maxattr;
25 struct module * owner;
26 struct nlattr ** attrbuf; /* private */ 25 struct nlattr ** attrbuf; /* private */
27 struct list_head ops_list; /* private */ 26 struct list_head ops_list; /* private */
28 struct list_head family_list; /* private */ 27 struct list_head family_list; /* private */
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index cde2f4f4f501..df05f468fa5c 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -363,8 +363,9 @@ enum ieee80211_reasoncode {
363#define IEEE80211_OFDM_SHIFT_MASK_A 4 363#define IEEE80211_OFDM_SHIFT_MASK_A 4
364 364
365/* NOTE: This data is for statistical purposes; not all hardware provides this 365/* NOTE: This data is for statistical purposes; not all hardware provides this
366 * information for frames received. Not setting these will not cause 366 * information for frames received.
367 * any adverse affects. */ 367 * For ieee80211_rx_mgt, you need to set at least the 'len' parameter.
368 */
368struct ieee80211_rx_stats { 369struct ieee80211_rx_stats {
369 u32 mac_time; 370 u32 mac_time;
370 s8 rssi; 371 s8 rssi;
@@ -1088,6 +1089,7 @@ extern int ieee80211_tx_frame(struct ieee80211_device *ieee,
1088/* ieee80211_rx.c */ 1089/* ieee80211_rx.c */
1089extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, 1090extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1090 struct ieee80211_rx_stats *rx_stats); 1091 struct ieee80211_rx_stats *rx_stats);
1092/* make sure to set stats->len */
1091extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, 1093extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
1092 struct ieee80211_hdr_4addr *header, 1094 struct ieee80211_hdr_4addr *header,
1093 struct ieee80211_rx_stats *stats); 1095 struct ieee80211_rx_stats *stats);
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
index 03b766afdc39..cd82c3e998e4 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/ieee80211_crypt.h
@@ -25,6 +25,7 @@
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <net/ieee80211.h>
28#include <asm/atomic.h> 29#include <asm/atomic.h>
29 30
30enum { 31enum {
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 50234fa56a68..fa587c94e9d0 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -83,8 +83,8 @@ struct inet_connection_sock {
83 struct timer_list icsk_delack_timer; 83 struct timer_list icsk_delack_timer;
84 __u32 icsk_rto; 84 __u32 icsk_rto;
85 __u32 icsk_pmtu_cookie; 85 __u32 icsk_pmtu_cookie;
86 struct tcp_congestion_ops *icsk_ca_ops; 86 const struct tcp_congestion_ops *icsk_ca_ops;
87 struct inet_connection_sock_af_ops *icsk_af_ops; 87 const struct inet_connection_sock_af_ops *icsk_af_ops;
88 unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu); 88 unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu);
89 __u8 icsk_ca_state; 89 __u8 icsk_ca_state;
90 __u8 icsk_retransmits; 90 __u8 icsk_retransmits;
diff --git a/include/net/ip.h b/include/net/ip.h
index 7bb5804847f2..8de0697b364c 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -37,11 +37,10 @@ struct inet_skb_parm
37 struct ip_options opt; /* Compiled IP options */ 37 struct ip_options opt; /* Compiled IP options */
38 unsigned char flags; 38 unsigned char flags;
39 39
40#define IPSKB_MASQUERADED 1 40#define IPSKB_FORWARDED 1
41#define IPSKB_TRANSLATED 2 41#define IPSKB_XFRM_TUNNEL_SIZE 2
42#define IPSKB_FORWARDED 4 42#define IPSKB_XFRM_TRANSFORMED 4
43#define IPSKB_XFRM_TUNNEL_SIZE 8 43#define IPSKB_FRAG_COMPLETE 8
44#define IPSKB_FRAG_COMPLETE 16
45}; 44};
46 45
47struct ipcm_cookie 46struct ipcm_cookie
@@ -95,7 +94,6 @@ extern int ip_local_deliver(struct sk_buff *skb);
95extern int ip_mr_input(struct sk_buff *skb); 94extern int ip_mr_input(struct sk_buff *skb);
96extern int ip_output(struct sk_buff *skb); 95extern int ip_output(struct sk_buff *skb);
97extern int ip_mc_output(struct sk_buff *skb); 96extern int ip_mc_output(struct sk_buff *skb);
98extern int ip_fragment(struct sk_buff *skb, int (*out)(struct sk_buff*));
99extern int ip_do_nat(struct sk_buff *skb); 97extern int ip_do_nat(struct sk_buff *skb);
100extern void ip_send_check(struct iphdr *ip); 98extern void ip_send_check(struct iphdr *ip);
101extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); 99extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok);
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 860bbac4c4ee..3b1d963d396c 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -418,6 +418,8 @@ extern int ipv6_rcv(struct sk_buff *skb,
418 struct packet_type *pt, 418 struct packet_type *pt,
419 struct net_device *orig_dev); 419 struct net_device *orig_dev);
420 420
421extern int ip6_rcv_finish(struct sk_buff *skb);
422
421/* 423/*
422 * upper-layer output functions 424 * upper-layer output functions
423 */ 425 */
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index d67c8393a343..a2c5e0b88422 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -327,7 +327,7 @@ struct iw_handler_def
327 __u16 num_private_args; 327 __u16 num_private_args;
328 328
329 /* Array of handlers for standard ioctls 329 /* Array of handlers for standard ioctls
330 * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWNAME] 330 * We will call dev->wireless_handlers->standard[ioctl - SIOCSIWCOMMIT]
331 */ 331 */
332 const iw_handler * standard; 332 const iw_handler * standard;
333 333
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
index 25b081a730e6..91684436af8e 100644
--- a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
@@ -37,7 +37,4 @@ struct nf_conntrack_ipv4 {
37struct sk_buff * 37struct sk_buff *
38nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb); 38nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb);
39 39
40/* call to create an explicit dependency on nf_conntrack_l3proto_ipv4. */
41extern void need_ip_conntrack(void);
42
43#endif /*_NF_CONNTRACK_IPV4_H*/ 40#endif /*_NF_CONNTRACK_IPV4_H*/
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 64b82b74a650..6d075ca16e6e 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -221,9 +221,6 @@ extern void nf_ct_helper_put(struct nf_conntrack_helper *helper);
221extern struct nf_conntrack_helper * 221extern struct nf_conntrack_helper *
222__nf_conntrack_helper_find_byname(const char *name); 222__nf_conntrack_helper_find_byname(const char *name);
223 223
224/* call to create an explicit dependency on nf_conntrack. */
225extern void need_nf_conntrack(void);
226
227extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, 224extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
228 const struct nf_conntrack_tuple *orig); 225 const struct nf_conntrack_tuple *orig);
229 226
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index 14ce790e5c65..530ef1f75283 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -111,7 +111,7 @@ struct nf_conntrack_tuple
111#ifdef __KERNEL__ 111#ifdef __KERNEL__
112 112
113#define NF_CT_DUMP_TUPLE(tp) \ 113#define NF_CT_DUMP_TUPLE(tp) \
114DEBUGP("tuple %p: %u %u %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x %hu -> %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x %hu\n", \ 114DEBUGP("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \
115 (tp), (tp)->src.l3num, (tp)->dst.protonum, \ 115 (tp), (tp)->src.l3num, (tp)->dst.protonum, \
116 NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \ 116 NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \
117 NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all)) 117 NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all))
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 63f7db99c2a6..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,
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 8f241216f46b..e673b2c984e9 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -175,6 +175,8 @@ void sctp_icmp_frag_needed(struct sock *, struct sctp_association *,
175void sctp_icmp_proto_unreachable(struct sock *sk, 175void sctp_icmp_proto_unreachable(struct sock *sk,
176 struct sctp_association *asoc, 176 struct sctp_association *asoc,
177 struct sctp_transport *t); 177 struct sctp_transport *t);
178void sctp_backlog_migrate(struct sctp_association *assoc,
179 struct sock *oldsk, struct sock *newsk);
178 180
179/* 181/*
180 * Section: Macros, externs, and inlines 182 * Section: Macros, externs, and inlines
@@ -225,13 +227,13 @@ extern int sctp_debug_flag;
225 if (sctp_debug_flag) { \ 227 if (sctp_debug_flag) { \
226 if (saddr->sa.sa_family == AF_INET6) { \ 228 if (saddr->sa.sa_family == AF_INET6) { \
227 printk(KERN_DEBUG \ 229 printk(KERN_DEBUG \
228 lead "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" trail, \ 230 lead NIP6_FMT trail, \
229 leadparm, \ 231 leadparm, \
230 NIP6(saddr->v6.sin6_addr), \ 232 NIP6(saddr->v6.sin6_addr), \
231 otherparms); \ 233 otherparms); \
232 } else { \ 234 } else { \
233 printk(KERN_DEBUG \ 235 printk(KERN_DEBUG \
234 lead "%u.%u.%u.%u" trail, \ 236 lead NIPQUAD_FMT trail, \
235 leadparm, \ 237 leadparm, \
236 NIPQUAD(saddr->v4.sin_addr.s_addr), \ 238 NIPQUAD(saddr->v4.sin_addr.s_addr), \
237 otherparms); \ 239 otherparms); \
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index f5c22d77feab..8c522ae031bb 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -127,9 +127,9 @@ extern struct sctp_globals {
127 * RTO.Alpha - 1/8 (3 when converted to right shifts.) 127 * RTO.Alpha - 1/8 (3 when converted to right shifts.)
128 * RTO.Beta - 1/4 (2 when converted to right shifts.) 128 * RTO.Beta - 1/4 (2 when converted to right shifts.)
129 */ 129 */
130 __u32 rto_initial; 130 unsigned long rto_initial;
131 __u32 rto_min; 131 unsigned long rto_min;
132 __u32 rto_max; 132 unsigned long rto_max;
133 133
134 /* Note: rto_alpha and rto_beta are really defined as inverse 134 /* Note: rto_alpha and rto_beta are really defined as inverse
135 * powers of two to facilitate integer operations. 135 * powers of two to facilitate integer operations.
@@ -140,12 +140,18 @@ extern struct sctp_globals {
140 /* Max.Burst - 4 */ 140 /* Max.Burst - 4 */
141 int max_burst; 141 int max_burst;
142 142
143 /* Valid.Cookie.Life - 60 seconds */
144 int valid_cookie_life;
145
146 /* Whether Cookie Preservative is enabled(1) or not(0) */ 143 /* Whether Cookie Preservative is enabled(1) or not(0) */
147 int cookie_preserve_enable; 144 int cookie_preserve_enable;
148 145
146 /* Valid.Cookie.Life - 60 seconds */
147 unsigned long valid_cookie_life;
148
149 /* Delayed SACK timeout 200ms default*/
150 unsigned long sack_timeout;
151
152 /* HB.interval - 30 seconds */
153 unsigned long hb_interval;
154
149 /* Association.Max.Retrans - 10 attempts 155 /* Association.Max.Retrans - 10 attempts
150 * Path.Max.Retrans - 5 attempts (per destination address) 156 * Path.Max.Retrans - 5 attempts (per destination address)
151 * Max.Init.Retransmits - 8 attempts 157 * Max.Init.Retransmits - 8 attempts
@@ -168,12 +174,6 @@ extern struct sctp_globals {
168 */ 174 */
169 int rcvbuf_policy; 175 int rcvbuf_policy;
170 176
171 /* Delayed SACK timeout 200ms default*/
172 int sack_timeout;
173
174 /* HB.interval - 30 seconds */
175 int hb_interval;
176
177 /* The following variables are implementation specific. */ 177 /* The following variables are implementation specific. */
178 178
179 /* Default initialization values to be applied to new associations. */ 179 /* Default initialization values to be applied to new associations. */
@@ -405,8 +405,9 @@ struct sctp_cookie {
405/* The format of our cookie that we send to our peer. */ 405/* The format of our cookie that we send to our peer. */
406struct sctp_signed_cookie { 406struct sctp_signed_cookie {
407 __u8 signature[SCTP_SECRET_SIZE]; 407 __u8 signature[SCTP_SECRET_SIZE];
408 __u32 __pad; /* force sctp_cookie alignment to 64 bits */
408 struct sctp_cookie c; 409 struct sctp_cookie c;
409}; 410} __attribute__((packed));
410 411
411/* This is another convenience type to allocate memory for address 412/* This is another convenience type to allocate memory for address
412 * params for the maximum size and pass such structures around 413 * params for the maximum size and pass such structures around
@@ -827,7 +828,7 @@ struct sctp_transport {
827 __u32 rtt; /* This is the most recent RTT. */ 828 __u32 rtt; /* This is the most recent RTT. */
828 829
829 /* RTO : The current retransmission timeout value. */ 830 /* RTO : The current retransmission timeout value. */
830 __u32 rto; 831 unsigned long rto;
831 832
832 /* RTTVAR : The current RTT variation. */ 833 /* RTTVAR : The current RTT variation. */
833 __u32 rttvar; 834 __u32 rttvar;
@@ -877,22 +878,10 @@ struct sctp_transport {
877 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to 878 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
878 * the destination address every heartbeat interval. 879 * the destination address every heartbeat interval.
879 */ 880 */
880 __u32 hbinterval; 881 unsigned long 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 882
891 /* SACK delay timeout */ 883 /* SACK delay timeout */
892 __u32 sackdelay; 884 unsigned long sackdelay;
893
894 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
895 __u32 param_flags;
896 885
897 /* When was the last time (in jiffies) that we heard from this 886 /* When was the last time (in jiffies) that we heard from this
898 * transport? We use this to pick new active and retran paths. 887 * transport? We use this to pick new active and retran paths.
@@ -904,6 +893,18 @@ struct sctp_transport {
904 */ 893 */
905 unsigned long last_time_ecne_reduced; 894 unsigned long last_time_ecne_reduced;
906 895
896 /* This is the max_retrans value for the transport and will
897 * be initialized from the assocs value. This can be changed
898 * using SCTP_SET_PEER_ADDR_PARAMS socket option.
899 */
900 __u16 pathmaxrxt;
901
902 /* PMTU : The current known path MTU. */
903 __u32 pathmtu;
904
905 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
906 __u32 param_flags;
907
907 /* The number of times INIT has been sent on this transport. */ 908 /* The number of times INIT has been sent on this transport. */
908 int init_sent_count; 909 int init_sent_count;
909 910
@@ -1249,6 +1250,14 @@ struct sctp_endpoint {
1249 int last_key; 1250 int last_key;
1250 int key_changed_at; 1251 int key_changed_at;
1251 1252
1253 /* digest: This is a digest of the sctp cookie. This field is
1254 * only used on the receive path when we try to validate
1255 * that the cookie has not been tampered with. We put
1256 * this here so we pre-allocate this once and can re-use
1257 * on every receive.
1258 */
1259 __u8 digest[SCTP_SIGNATURE_SIZE];
1260
1252 /* sendbuf acct. policy. */ 1261 /* sendbuf acct. policy. */
1253 __u32 sndbuf_policy; 1262 __u32 sndbuf_policy;
1254 1263
@@ -1499,9 +1508,9 @@ struct sctp_association {
1499 * These values will be initialized by system defaults, but can 1508 * These values will be initialized by system defaults, but can
1500 * be modified via the SCTP_RTOINFO socket option. 1509 * be modified via the SCTP_RTOINFO socket option.
1501 */ 1510 */
1502 __u32 rto_initial; 1511 unsigned long rto_initial;
1503 __u32 rto_max; 1512 unsigned long rto_max;
1504 __u32 rto_min; 1513 unsigned long rto_min;
1505 1514
1506 /* Maximum number of new data packets that can be sent in a burst. */ 1515 /* Maximum number of new data packets that can be sent in a burst. */
1507 int max_burst; 1516 int max_burst;
@@ -1519,13 +1528,13 @@ struct sctp_association {
1519 __u16 init_retries; 1528 __u16 init_retries;
1520 1529
1521 /* The largest timeout or RTO value to use in attempting an INIT */ 1530 /* The largest timeout or RTO value to use in attempting an INIT */
1522 __u16 max_init_timeo; 1531 unsigned long max_init_timeo;
1523 1532
1524 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to 1533 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
1525 * the destination address every heartbeat interval. This value 1534 * the destination address every heartbeat interval. This value
1526 * will be inherited by all new transports. 1535 * will be inherited by all new transports.
1527 */ 1536 */
1528 __u32 hbinterval; 1537 unsigned long hbinterval;
1529 1538
1530 /* This is the max_retrans value for new transports in the 1539 /* This is the max_retrans value for new transports in the
1531 * association. 1540 * association.
@@ -1537,13 +1546,14 @@ struct sctp_association {
1537 */ 1546 */
1538 __u32 pathmtu; 1547 __u32 pathmtu;
1539 1548
1540 /* SACK delay timeout */
1541 __u32 sackdelay;
1542
1543 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */ 1549 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */
1544 __u32 param_flags; 1550 __u32 param_flags;
1545 1551
1546 int timeouts[SCTP_NUM_TIMEOUT_TYPES]; 1552 /* SACK delay timeout */
1553 unsigned long sackdelay;
1554
1555
1556 unsigned long timeouts[SCTP_NUM_TIMEOUT_TYPES];
1547 struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES]; 1557 struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES];
1548 1558
1549 /* Transport to which SHUTDOWN chunk was last sent. */ 1559 /* Transport to which SHUTDOWN chunk was last sent. */
@@ -1648,7 +1658,10 @@ struct sctp_association {
1648 /* How many duplicated TSNs have we seen? */ 1658 /* How many duplicated TSNs have we seen? */
1649 int numduptsns; 1659 int numduptsns;
1650 1660
1651 /* Number of seconds of idle time before an association is closed. */ 1661 /* Number of seconds of idle time before an association is closed.
1662 * In the association context, this is really used as a boolean
1663 * since the real timeout is stored in the timeouts array
1664 */
1652 __u32 autoclose; 1665 __u32 autoclose;
1653 1666
1654 /* These are to support 1667 /* These are to support
diff --git a/include/net/tipc/tipc.h b/include/net/tipc/tipc.h
new file mode 100644
index 000000000000..9566608c88cf
--- /dev/null
+++ b/include/net/tipc/tipc.h
@@ -0,0 +1,257 @@
1/*
2 * include/net/tipc/tipc.h: Main include file for TIPC users
3 *
4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _NET_TIPC_H_
38#define _NET_TIPC_H_
39
40#ifdef __KERNEL__
41
42#include <linux/tipc.h>
43#include <linux/skbuff.h>
44
45/*
46 * Native API
47 */
48
49/*
50 * TIPC operating mode routines
51 */
52
53u32 tipc_get_addr(void);
54
55#define TIPC_NOT_RUNNING 0
56#define TIPC_NODE_MODE 1
57#define TIPC_NET_MODE 2
58
59typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr);
60
61int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
62
63void tipc_detach(unsigned int userref);
64
65int tipc_get_mode(void);
66
67/*
68 * TIPC port manipulation routines
69 */
70
71typedef void (*tipc_msg_err_event) (void *usr_handle,
72 u32 portref,
73 struct sk_buff **buf,
74 unsigned char const *data,
75 unsigned int size,
76 int reason,
77 struct tipc_portid const *attmpt_destid);
78
79typedef void (*tipc_named_msg_err_event) (void *usr_handle,
80 u32 portref,
81 struct sk_buff **buf,
82 unsigned char const *data,
83 unsigned int size,
84 int reason,
85 struct tipc_name_seq const *attmpt_dest);
86
87typedef void (*tipc_conn_shutdown_event) (void *usr_handle,
88 u32 portref,
89 struct sk_buff **buf,
90 unsigned char const *data,
91 unsigned int size,
92 int reason);
93
94typedef void (*tipc_msg_event) (void *usr_handle,
95 u32 portref,
96 struct sk_buff **buf,
97 unsigned char const *data,
98 unsigned int size,
99 unsigned int importance,
100 struct tipc_portid const *origin);
101
102typedef void (*tipc_named_msg_event) (void *usr_handle,
103 u32 portref,
104 struct sk_buff **buf,
105 unsigned char const *data,
106 unsigned int size,
107 unsigned int importance,
108 struct tipc_portid const *orig,
109 struct tipc_name_seq const *dest);
110
111typedef void (*tipc_conn_msg_event) (void *usr_handle,
112 u32 portref,
113 struct sk_buff **buf,
114 unsigned char const *data,
115 unsigned int size);
116
117typedef void (*tipc_continue_event) (void *usr_handle,
118 u32 portref);
119
120int tipc_createport(unsigned int tipc_user,
121 void *usr_handle,
122 unsigned int importance,
123 tipc_msg_err_event error_cb,
124 tipc_named_msg_err_event named_error_cb,
125 tipc_conn_shutdown_event conn_error_cb,
126 tipc_msg_event message_cb,
127 tipc_named_msg_event named_message_cb,
128 tipc_conn_msg_event conn_message_cb,
129 tipc_continue_event continue_event_cb,/* May be zero */
130 u32 *portref);
131
132int tipc_deleteport(u32 portref);
133
134int tipc_ownidentity(u32 portref, struct tipc_portid *port);
135
136int tipc_portimportance(u32 portref, unsigned int *importance);
137int tipc_set_portimportance(u32 portref, unsigned int importance);
138
139int tipc_portunreliable(u32 portref, unsigned int *isunreliable);
140int tipc_set_portunreliable(u32 portref, unsigned int isunreliable);
141
142int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable);
143int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
144
145int tipc_publish(u32 portref, unsigned int scope,
146 struct tipc_name_seq const *name_seq);
147int tipc_withdraw(u32 portref, unsigned int scope,
148 struct tipc_name_seq const *name_seq); /* 0: all */
149
150int tipc_connect2port(u32 portref, struct tipc_portid const *port);
151
152int tipc_disconnect(u32 portref);
153
154int tipc_shutdown(u32 ref); /* Sends SHUTDOWN msg */
155
156int tipc_isconnected(u32 portref, int *isconnected);
157
158int tipc_peer(u32 portref, struct tipc_portid *peer);
159
160int tipc_ref_valid(u32 portref);
161
162/*
163 * TIPC messaging routines
164 */
165
166#define TIPC_PORT_IMPORTANCE 100 /* send using current port setting */
167
168
169int tipc_send(u32 portref,
170 unsigned int num_sect,
171 struct iovec const *msg_sect);
172
173int tipc_send_buf(u32 portref,
174 struct sk_buff *buf,
175 unsigned int dsz);
176
177int tipc_send2name(u32 portref,
178 struct tipc_name const *name,
179 u32 domain, /* 0:own zone */
180 unsigned int num_sect,
181 struct iovec const *msg_sect);
182
183int tipc_send_buf2name(u32 portref,
184 struct tipc_name const *name,
185 u32 domain,
186 struct sk_buff *buf,
187 unsigned int dsz);
188
189int tipc_forward2name(u32 portref,
190 struct tipc_name const *name,
191 u32 domain, /*0: own zone */
192 unsigned int section_count,
193 struct iovec const *msg_sect,
194 struct tipc_portid const *origin,
195 unsigned int importance);
196
197int tipc_forward_buf2name(u32 portref,
198 struct tipc_name const *name,
199 u32 domain,
200 struct sk_buff *buf,
201 unsigned int dsz,
202 struct tipc_portid const *orig,
203 unsigned int importance);
204
205int tipc_send2port(u32 portref,
206 struct tipc_portid const *dest,
207 unsigned int num_sect,
208 struct iovec const *msg_sect);
209
210int tipc_send_buf2port(u32 portref,
211 struct tipc_portid const *dest,
212 struct sk_buff *buf,
213 unsigned int dsz);
214
215int tipc_forward2port(u32 portref,
216 struct tipc_portid const *dest,
217 unsigned int num_sect,
218 struct iovec const *msg_sect,
219 struct tipc_portid const *origin,
220 unsigned int importance);
221
222int tipc_forward_buf2port(u32 portref,
223 struct tipc_portid const *dest,
224 struct sk_buff *buf,
225 unsigned int dsz,
226 struct tipc_portid const *orig,
227 unsigned int importance);
228
229int tipc_multicast(u32 portref,
230 struct tipc_name_seq const *seq,
231 u32 domain, /* 0:own zone */
232 unsigned int section_count,
233 struct iovec const *msg);
234
235#if 0
236int tipc_multicast_buf(u32 portref,
237 struct tipc_name_seq const *seq,
238 u32 domain, /* 0:own zone */
239 void *buf,
240 unsigned int size);
241#endif
242
243/*
244 * TIPC subscription routines
245 */
246
247int tipc_ispublished(struct tipc_name const *name);
248
249/*
250 * Get number of available nodes within specified domain (excluding own node)
251 */
252
253unsigned int tipc_available_nodes(const u32 domain);
254
255#endif
256
257#endif
diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h
new file mode 100644
index 000000000000..098607cd4b78
--- /dev/null
+++ b/include/net/tipc/tipc_bearer.h
@@ -0,0 +1,121 @@
1/*
2 * include/net/tipc/tipc_bearer.h: Include file for privileged access to TIPC bearers
3 *
4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _NET_TIPC_BEARER_H_
38#define _NET_TIPC_BEARER_H_
39
40#ifdef __KERNEL__
41
42#include <linux/tipc_config.h>
43#include <linux/skbuff.h>
44#include <linux/spinlock.h>
45
46/*
47 * Identifiers of supported TIPC media types
48 */
49
50#define TIPC_MEDIA_TYPE_ETH 1
51
52struct tipc_media_addr {
53 __u32 type;
54 union {
55 __u8 eth_addr[6]; /* Ethernet bearer */
56#if 0
57 /* Prototypes for other possible bearer types */
58
59 struct {
60 __u16 sin_family;
61 __u16 sin_port;
62 struct {
63 __u32 s_addr;
64 } sin_addr;
65 char pad[4];
66 } addr_in; /* IP-based bearer */
67 __u16 sock_descr; /* generic socket bearer */
68#endif
69 } dev_addr;
70};
71
72/**
73 * struct tipc_bearer - TIPC bearer info available to privileged users
74 * @usr_handle: pointer to additional user-defined information about bearer
75 * @mtu: max packet size bearer can support
76 * @blocked: non-zero if bearer is blocked
77 * @lock: spinlock for controlling access to bearer
78 * @addr: media-specific address associated with bearer
79 * @name: bearer name (format = media:interface)
80 *
81 * Note: TIPC initializes "name" and "lock" fields; user is responsible for
82 * initialization all other fields when a bearer is enabled.
83 */
84
85struct tipc_bearer {
86 void *usr_handle;
87 u32 mtu;
88 int blocked;
89 spinlock_t lock;
90 struct tipc_media_addr addr;
91 char name[TIPC_MAX_BEARER_NAME];
92};
93
94
95int tipc_register_media(u32 media_type,
96 char *media_name,
97 int (*enable)(struct tipc_bearer *),
98 void (*disable)(struct tipc_bearer *),
99 int (*send_msg)(struct sk_buff *,
100 struct tipc_bearer *,
101 struct tipc_media_addr *),
102 char *(*addr2str)(struct tipc_media_addr *a,
103 char *str_buf,
104 int str_size),
105 struct tipc_media_addr *bcast_addr,
106 const u32 bearer_priority,
107 const u32 link_tolerance, /* [ms] */
108 const u32 send_window_limit);
109
110void tipc_recv_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr);
111
112int tipc_block_bearer(const char *name);
113void tipc_continue(struct tipc_bearer *tb_ptr);
114
115int tipc_enable_bearer(const char *bearer_name, u32 bcast_scope, u32 priority);
116int tipc_disable_bearer(const char *name);
117
118
119#endif
120
121#endif
diff --git a/include/net/tipc/tipc_msg.h b/include/net/tipc/tipc_msg.h
new file mode 100644
index 000000000000..4d096eebc93f
--- /dev/null
+++ b/include/net/tipc/tipc_msg.h
@@ -0,0 +1,223 @@
1/*
2 * include/net/tipc/tipc_msg.h: Include file for privileged access to TIPC message headers
3 *
4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _NET_TIPC_MSG_H_
38#define _NET_TIPC_MSG_H_
39
40#ifdef __KERNEL__
41
42struct tipc_msg {
43 u32 hdr[15];
44};
45
46
47/*
48 TIPC user data message header format, version 2:
49
50
51 1 0 9 8 7 6 5 4|3 2 1 0 9 8 7 6|5 4 3 2 1 0 9 8|7 6 5 4 3 2 1 0
52 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53 w0:|vers | user |hdr sz |n|d|s|-| message size |
54 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
55 w1:|mstyp| error |rer cnt|lsc|opt p| broadcast ack no |
56 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57 w2:| link level ack no | broadcast/link level seq no |
58 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
59 w3:| previous node |
60 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
61 w4:| originating port |
62 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
63 w5:| destination port |
64 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
65 w6:| originating node |
66 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
67 w7:| destination node |
68 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
69 w8:| name type / transport sequence number |
70 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
71 w9:| name instance/multicast lower bound |
72 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
73 wA:| multicast upper bound |
74 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
75 / /
76 \ options \
77 / /
78 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
79
80*/
81
82#define TIPC_CONN_MSG 0
83#define TIPC_MCAST_MSG 1
84#define TIPC_NAMED_MSG 2
85#define TIPC_DIRECT_MSG 3
86
87
88static inline u32 msg_word(struct tipc_msg *m, u32 pos)
89{
90 return ntohl(m->hdr[pos]);
91}
92
93static inline u32 msg_bits(struct tipc_msg *m, u32 w, u32 pos, u32 mask)
94{
95 return (msg_word(m, w) >> pos) & mask;
96}
97
98static inline u32 msg_importance(struct tipc_msg *m)
99{
100 return msg_bits(m, 0, 25, 0xf);
101}
102
103static inline u32 msg_hdr_sz(struct tipc_msg *m)
104{
105 return msg_bits(m, 0, 21, 0xf) << 2;
106}
107
108static inline int msg_short(struct tipc_msg *m)
109{
110 return (msg_hdr_sz(m) == 24);
111}
112
113static inline u32 msg_size(struct tipc_msg *m)
114{
115 return msg_bits(m, 0, 0, 0x1ffff);
116}
117
118static inline u32 msg_data_sz(struct tipc_msg *m)
119{
120 return (msg_size(m) - msg_hdr_sz(m));
121}
122
123static inline unchar *msg_data(struct tipc_msg *m)
124{
125 return ((unchar *)m) + msg_hdr_sz(m);
126}
127
128static inline u32 msg_type(struct tipc_msg *m)
129{
130 return msg_bits(m, 1, 29, 0x7);
131}
132
133static inline u32 msg_direct(struct tipc_msg *m)
134{
135 return (msg_type(m) == TIPC_DIRECT_MSG);
136}
137
138static inline u32 msg_named(struct tipc_msg *m)
139{
140 return (msg_type(m) == TIPC_NAMED_MSG);
141}
142
143static inline u32 msg_mcast(struct tipc_msg *m)
144{
145 return (msg_type(m) == TIPC_MCAST_MSG);
146}
147
148static inline u32 msg_connected(struct tipc_msg *m)
149{
150 return (msg_type(m) == TIPC_CONN_MSG);
151}
152
153static inline u32 msg_errcode(struct tipc_msg *m)
154{
155 return msg_bits(m, 1, 25, 0xf);
156}
157
158static inline u32 msg_prevnode(struct tipc_msg *m)
159{
160 return msg_word(m, 3);
161}
162
163static inline u32 msg_origport(struct tipc_msg *m)
164{
165 return msg_word(m, 4);
166}
167
168static inline u32 msg_destport(struct tipc_msg *m)
169{
170 return msg_word(m, 5);
171}
172
173static inline u32 msg_mc_netid(struct tipc_msg *m)
174{
175 return msg_word(m, 5);
176}
177
178static inline u32 msg_orignode(struct tipc_msg *m)
179{
180 if (likely(msg_short(m)))
181 return msg_prevnode(m);
182 return msg_word(m, 6);
183}
184
185static inline u32 msg_destnode(struct tipc_msg *m)
186{
187 return msg_word(m, 7);
188}
189
190static inline u32 msg_nametype(struct tipc_msg *m)
191{
192 return msg_word(m, 8);
193}
194
195static inline u32 msg_nameinst(struct tipc_msg *m)
196{
197 return msg_word(m, 9);
198}
199
200static inline u32 msg_namelower(struct tipc_msg *m)
201{
202 return msg_nameinst(m);
203}
204
205static inline u32 msg_nameupper(struct tipc_msg *m)
206{
207 return msg_word(m, 10);
208}
209
210static inline char *msg_options(struct tipc_msg *m, u32 *len)
211{
212 u32 pos = msg_bits(m, 1, 16, 0x7);
213
214 if (!pos)
215 return 0;
216 pos = (pos * 4) + 28;
217 *len = msg_hdr_sz(m) - pos;
218 return (char *)&m->hdr[pos/4];
219}
220
221#endif
222
223#endif
diff --git a/include/net/tipc/tipc_port.h b/include/net/tipc/tipc_port.h
new file mode 100644
index 000000000000..333bba6dc522
--- /dev/null
+++ b/include/net/tipc/tipc_port.h
@@ -0,0 +1,108 @@
1/*
2 * include/net/tipc/tipc_port.h: Include file for privileged access to TIPC ports
3 *
4 * Copyright (c) 1994-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the names of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * Alternatively, this software may be distributed under the terms of the
21 * GNU General Public License ("GPL") version 2 as published by the Free
22 * Software Foundation.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _NET_TIPC_PORT_H_
38#define _NET_TIPC_PORT_H_
39
40#ifdef __KERNEL__
41
42#include <linux/tipc.h>
43#include <linux/skbuff.h>
44#include <net/tipc/tipc_msg.h>
45
46#define TIPC_FLOW_CONTROL_WIN 512
47
48/**
49 * struct tipc_port - native TIPC port info available to privileged users
50 * @usr_handle: pointer to additional user-defined information about port
51 * @lock: pointer to spinlock for controlling access to port
52 * @connected: non-zero if port is currently connected to a peer port
53 * @conn_type: TIPC type used when connection was established
54 * @conn_instance: TIPC instance used when connection was established
55 * @conn_unacked: number of unacknowledged messages received from peer port
56 * @published: non-zero if port has one or more associated names
57 * @congested: non-zero if cannot send because of link or port congestion
58 * @ref: unique reference to port in TIPC object registry
59 * @phdr: preformatted message header used when sending messages
60 */
61
62struct tipc_port {
63 void *usr_handle;
64 spinlock_t *lock;
65 int connected;
66 u32 conn_type;
67 u32 conn_instance;
68 u32 conn_unacked;
69 int published;
70 u32 congested;
71 u32 ref;
72 struct tipc_msg phdr;
73};
74
75
76/**
77 * tipc_createport_raw - create a native TIPC port and return it's reference
78 *
79 * Note: 'dispatcher' and 'wakeup' deliver a locked port.
80 */
81
82u32 tipc_createport_raw(void *usr_handle,
83 u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
84 void (*wakeup)(struct tipc_port *),
85 const u32 importance);
86
87/*
88 * tipc_set_msg_option(): port must be locked.
89 */
90int tipc_set_msg_option(struct tipc_port *tp_ptr,
91 const char *opt,
92 const u32 len);
93
94int tipc_reject_msg(struct sk_buff *buf, u32 err);
95
96int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode);
97
98void tipc_acknowledge(u32 port_ref,u32 ack);
99
100struct tipc_port *tipc_get_port(const u32 ref);
101
102void *tipc_get_handle(const u32 ref);
103
104
105#endif
106
107#endif
108
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 07d7b50cdd76..d09ca0e7d139 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -668,7 +668,7 @@ static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *s
668 return xfrm_policy_check(sk, dir, skb, AF_INET6); 668 return xfrm_policy_check(sk, dir, skb, AF_INET6);
669} 669}
670 670
671 671extern int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, unsigned short family);
672extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); 672extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
673 673
674static 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)
@@ -831,7 +831,7 @@ struct xfrm_tunnel {
831}; 831};
832 832
833struct xfrm6_tunnel { 833struct xfrm6_tunnel {
834 int (*handler)(struct sk_buff **pskb, unsigned int *nhoffp); 834 int (*handler)(struct sk_buff **pskb);
835 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,
836 int type, int code, int offset, __u32 info); 836 int type, int code, int offset, __u32 info);
837}; 837};
@@ -866,10 +866,11 @@ extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
866extern int xfrm_init_state(struct xfrm_state *x); 866extern int xfrm_init_state(struct xfrm_state *x);
867extern int xfrm4_rcv(struct sk_buff *skb); 867extern int xfrm4_rcv(struct sk_buff *skb);
868extern int xfrm4_output(struct sk_buff *skb); 868extern int xfrm4_output(struct sk_buff *skb);
869extern int xfrm4_output_finish(struct sk_buff *skb);
869extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); 870extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
870extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); 871extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
871extern int xfrm6_rcv_spi(struct sk_buff **pskb, unsigned int *nhoffp, u32 spi); 872extern int xfrm6_rcv_spi(struct sk_buff **pskb, u32 spi);
872extern int xfrm6_rcv(struct sk_buff **pskb, unsigned int *nhoffp); 873extern int xfrm6_rcv(struct sk_buff **pskb);
873extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); 874extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler);
874extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); 875extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler);
875extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); 876extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index a7f4c355a91f..22fc886b9695 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -88,7 +88,6 @@ enum ib_atomic_cap {
88 88
89struct ib_device_attr { 89struct ib_device_attr {
90 u64 fw_ver; 90 u64 fw_ver;
91 __be64 node_guid;
92 __be64 sys_image_guid; 91 __be64 sys_image_guid;
93 u64 max_mr_size; 92 u64 max_mr_size;
94 u64 page_size_cap; 93 u64 page_size_cap;
@@ -951,6 +950,7 @@ struct ib_device {
951 u64 uverbs_cmd_mask; 950 u64 uverbs_cmd_mask;
952 int uverbs_abi_ver; 951 int uverbs_abi_ver;
953 952
953 __be64 node_guid;
954 u8 node_type; 954 u8 node_type;
955 u8 phys_port_cnt; 955 u8 phys_port_cnt;
956}; 956};
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index be1bc792ab18..3e5cb5ab2d34 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -168,6 +168,12 @@ typedef uint64_t iscsi_connh_t; /* iSCSI Data-Path connection handle */
168 168
169#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle) 169#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
170#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr) 170#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
171#define hostdata_session(_hostdata) (iscsi_ptr(*(unsigned long *)_hostdata))
172
173/**
174 * iscsi_hostdata - get LLD hostdata from scsi_host
175 * @_hostdata: pointer to scsi host's hostdata
176 **/
171#define iscsi_hostdata(_hostdata) ((void*)_hostdata + sizeof(unsigned long)) 177#define iscsi_hostdata(_hostdata) ((void*)_hostdata + sizeof(unsigned long))
172 178
173/* 179/*
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 6cb1e2788d8b..c60b8ff2f5e4 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -32,6 +32,12 @@ extern const unsigned char scsi_command_size[8];
32extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE]; 32extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
33 33
34/* 34/*
35 * Special value for scanning to specify scanning or rescanning of all
36 * possible channels, (target) ids, or luns on a given shost.
37 */
38#define SCAN_WILD_CARD ~0
39
40/*
35 * SCSI opcodes 41 * SCSI opcodes
36 */ 42 */
37 43
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 41cfc29be899..7529f4388bb4 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -151,6 +151,5 @@ 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);
155 154
156#endif /* _SCSI_SCSI_CMND_H */ 155#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 230bc55c0bfa..467274a764d1 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -5,6 +5,7 @@
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/workqueue.h> 7#include <linux/workqueue.h>
8#include <linux/mutex.h>
8 9
9struct block_device; 10struct block_device;
10struct completion; 11struct completion;
@@ -469,7 +470,7 @@ struct Scsi_Host {
469 spinlock_t default_lock; 470 spinlock_t default_lock;
470 spinlock_t *host_lock; 471 spinlock_t *host_lock;
471 472
472 struct semaphore scan_mutex;/* serialize scanning activity */ 473 struct mutex scan_mutex;/* serialize scanning activity */
473 474
474 struct list_head eh_cmd_q; 475 struct list_head eh_cmd_q;
475 struct task_struct * ehandler; /* Error recovery thread. */ 476 struct task_struct * ehandler; /* Error recovery thread. */
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index f6e0bb484c63..e7b1054adf86 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -30,12 +30,9 @@ struct scsi_transport_template {
30 struct transport_container device_attrs; 30 struct transport_container device_attrs;
31 31
32 /* 32 /*
33 * If set, call target_parent prior to allocating a scsi_target, 33 * If set, called from sysfs and legacy procfs rescanning code.
34 * so we get the appropriate parent for the target. This function
35 * is required for transports like FC and iSCSI that do not put the
36 * scsi_target under scsi_host.
37 */ 34 */
38 struct device *(*target_parent)(struct Scsi_Host *, int, uint); 35 int (*user_scan)(struct Scsi_Host *, uint, uint, uint);
39 36
40 /* The size of the specific transport attribute structure (a 37 /* The size of the specific transport attribute structure (a
41 * space of this size will be left at the end of the 38 * space of this size will be left at the end of the
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 394f14a5b7cb..cf3fec8be1e3 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -303,6 +303,7 @@ struct fc_host_attrs {
303 /* Fixed Attributes */ 303 /* Fixed Attributes */
304 u64 node_name; 304 u64 node_name;
305 u64 port_name; 305 u64 port_name;
306 u64 permanent_port_name;
306 u32 supported_classes; 307 u32 supported_classes;
307 u8 supported_fc4s[FC_FC4_LIST_SIZE]; 308 u8 supported_fc4s[FC_FC4_LIST_SIZE];
308 char symbolic_name[FC_SYMBOLIC_NAME_SIZE]; 309 char symbolic_name[FC_SYMBOLIC_NAME_SIZE];
@@ -338,6 +339,8 @@ struct fc_host_attrs {
338 (((struct fc_host_attrs *)(x)->shost_data)->node_name) 339 (((struct fc_host_attrs *)(x)->shost_data)->node_name)
339#define fc_host_port_name(x) \ 340#define fc_host_port_name(x) \
340 (((struct fc_host_attrs *)(x)->shost_data)->port_name) 341 (((struct fc_host_attrs *)(x)->shost_data)->port_name)
342#define fc_host_permanent_port_name(x) \
343 (((struct fc_host_attrs *)(x)->shost_data)->permanent_port_name)
341#define fc_host_supported_classes(x) \ 344#define fc_host_supported_classes(x) \
342 (((struct fc_host_attrs *)(x)->shost_data)->supported_classes) 345 (((struct fc_host_attrs *)(x)->shost_data)->supported_classes)
343#define fc_host_supported_fc4s(x) \ 346#define fc_host_supported_fc4s(x) \
@@ -426,6 +429,7 @@ struct fc_function_template {
426 /* host fixed attributes */ 429 /* host fixed attributes */
427 unsigned long show_host_node_name:1; 430 unsigned long show_host_node_name:1;
428 unsigned long show_host_port_name:1; 431 unsigned long show_host_port_name:1;
432 unsigned long show_host_permanent_port_name:1;
429 unsigned long show_host_supported_classes:1; 433 unsigned long show_host_supported_classes:1;
430 unsigned long show_host_supported_fc4s:1; 434 unsigned long show_host_supported_fc4s:1;
431 unsigned long show_host_symbolic_name:1; 435 unsigned long show_host_symbolic_name:1;
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index f25041c386ec..16602a547a63 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -23,8 +23,14 @@
23#ifndef SCSI_TRANSPORT_ISCSI_H 23#ifndef SCSI_TRANSPORT_ISCSI_H
24#define SCSI_TRANSPORT_ISCSI_H 24#define SCSI_TRANSPORT_ISCSI_H
25 25
26#include <linux/device.h>
26#include <scsi/iscsi_if.h> 27#include <scsi/iscsi_if.h>
27 28
29struct scsi_transport_template;
30struct Scsi_Host;
31struct mempool_zone;
32struct iscsi_cls_conn;
33
28/** 34/**
29 * struct iscsi_transport - iSCSI Transport template 35 * struct iscsi_transport - iSCSI Transport template
30 * 36 *
@@ -48,23 +54,31 @@ struct iscsi_transport {
48 char *name; 54 char *name;
49 unsigned int caps; 55 unsigned int caps;
50 struct scsi_host_template *host_template; 56 struct scsi_host_template *host_template;
57 /* LLD session/scsi_host data size */
51 int hostdata_size; 58 int hostdata_size;
59 /* LLD iscsi_host data size */
60 int ihostdata_size;
61 /* LLD connection data size */
62 int conndata_size;
52 int max_lun; 63 int max_lun;
53 unsigned int max_conn; 64 unsigned int max_conn;
54 unsigned int max_cmd_len; 65 unsigned int max_cmd_len;
55 iscsi_sessionh_t (*create_session) (uint32_t initial_cmdsn, 66 struct Scsi_Host *(*create_session) (struct scsi_transport_template *t,
56 struct Scsi_Host *shost); 67 uint32_t initial_cmdsn);
57 void (*destroy_session) (iscsi_sessionh_t session); 68 void (*destroy_session) (struct Scsi_Host *shost);
58 iscsi_connh_t (*create_conn) (iscsi_sessionh_t session, uint32_t cid); 69 struct iscsi_cls_conn *(*create_conn) (struct Scsi_Host *shost,
70 uint32_t cid);
59 int (*bind_conn) (iscsi_sessionh_t session, iscsi_connh_t conn, 71 int (*bind_conn) (iscsi_sessionh_t session, iscsi_connh_t conn,
60 uint32_t transport_fd, int is_leading); 72 uint32_t transport_fd, int is_leading);
61 int (*start_conn) (iscsi_connh_t conn); 73 int (*start_conn) (iscsi_connh_t conn);
62 void (*stop_conn) (iscsi_connh_t conn, int flag); 74 void (*stop_conn) (iscsi_connh_t conn, int flag);
63 void (*destroy_conn) (iscsi_connh_t conn); 75 void (*destroy_conn) (struct iscsi_cls_conn *conn);
64 int (*set_param) (iscsi_connh_t conn, enum iscsi_param param, 76 int (*set_param) (iscsi_connh_t conn, enum iscsi_param param,
65 uint32_t value); 77 uint32_t value);
66 int (*get_param) (iscsi_connh_t conn, enum iscsi_param param, 78 int (*get_conn_param) (void *conndata, enum iscsi_param param,
67 uint32_t *value); 79 uint32_t *value);
80 int (*get_session_param) (struct Scsi_Host *shost,
81 enum iscsi_param param, uint32_t *value);
68 int (*send_pdu) (iscsi_connh_t conn, struct iscsi_hdr *hdr, 82 int (*send_pdu) (iscsi_connh_t conn, struct iscsi_hdr *hdr,
69 char *data, uint32_t data_size); 83 char *data, uint32_t data_size);
70 void (*get_stats) (iscsi_connh_t conn, struct iscsi_stats *stats); 84 void (*get_stats) (iscsi_connh_t conn, struct iscsi_stats *stats);
@@ -73,7 +87,7 @@ struct iscsi_transport {
73/* 87/*
74 * transport registration upcalls 88 * transport registration upcalls
75 */ 89 */
76extern int iscsi_register_transport(struct iscsi_transport *tt); 90extern struct scsi_transport_template *iscsi_register_transport(struct iscsi_transport *tt);
77extern int iscsi_unregister_transport(struct iscsi_transport *tt); 91extern int iscsi_unregister_transport(struct iscsi_transport *tt);
78 92
79/* 93/*
@@ -83,4 +97,49 @@ extern void iscsi_conn_error(iscsi_connh_t conn, enum iscsi_err error);
83extern int iscsi_recv_pdu(iscsi_connh_t conn, struct iscsi_hdr *hdr, 97extern int iscsi_recv_pdu(iscsi_connh_t conn, struct iscsi_hdr *hdr,
84 char *data, uint32_t data_size); 98 char *data, uint32_t data_size);
85 99
100struct iscsi_cls_conn {
101 struct list_head conn_list; /* item in connlist */
102 void *dd_data; /* LLD private data */
103 struct iscsi_transport *transport;
104 iscsi_connh_t connh;
105 int active; /* must be accessed with the connlock */
106 struct device dev; /* sysfs transport/container device */
107 struct mempool_zone *z_error;
108 struct mempool_zone *z_pdu;
109 struct list_head freequeue;
110};
111
112#define iscsi_dev_to_conn(_dev) \
113 container_of(_dev, struct iscsi_cls_conn, dev)
114
115struct iscsi_cls_session {
116 struct list_head list; /* item in session_list */
117 struct iscsi_transport *transport;
118 struct device dev; /* sysfs transport/container device */
119};
120
121#define iscsi_dev_to_session(_dev) \
122 container_of(_dev, struct iscsi_cls_session, dev)
123
124#define iscsi_session_to_shost(_session) \
125 dev_to_shost(_session->dev.parent)
126
127/*
128 * session and connection functions that can be used by HW iSCSI LLDs
129 */
130extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost,
131 struct iscsi_transport *t);
132extern int iscsi_destroy_session(struct iscsi_cls_session *session);
133extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
134 uint32_t cid);
135extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn);
136
137/*
138 * session functions used by software iscsi
139 */
140extern struct Scsi_Host *
141iscsi_transport_create_session(struct scsi_transport_template *scsit,
142 struct iscsi_transport *transport);
143extern int iscsi_transport_destroy_session(struct Scsi_Host *shost);
144
86#endif 145#endif
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index 54a89611e9c5..fb5a2ffae939 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/config.h> 23#include <linux/config.h>
24#include <linux/transport_class.h> 24#include <linux/transport_class.h>
25#include <linux/mutex.h>
25 26
26struct scsi_transport_template; 27struct scsi_transport_template;
27struct scsi_target; 28struct scsi_target;
@@ -54,7 +55,7 @@ struct spi_transport_attrs {
54 unsigned int support_qas; /* supports quick arbitration and selection */ 55 unsigned int support_qas; /* supports quick arbitration and selection */
55 /* Private Fields */ 56 /* Private Fields */
56 unsigned int dv_pending:1; /* Internal flag */ 57 unsigned int dv_pending:1; /* Internal flag */
57 struct semaphore dv_sem; /* semaphore to serialise dv */ 58 struct mutex dv_mutex; /* semaphore to serialise dv */
58}; 59};
59 60
60enum spi_signal_type { 61enum spi_signal_type {
diff --git a/include/sound/core.h b/include/sound/core.h
index 90ac6132ea3b..3093e3ddcf36 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -317,7 +317,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
317#ifdef CONFIG_SND_VERBOSE_PRINTK 317#ifdef CONFIG_SND_VERBOSE_PRINTK
318/** 318/**
319 * snd_printd - debug printk 319 * snd_printd - debug printk
320 * @format: format string 320 * @fmt: format string
321 * 321 *
322 * Compiled only when Works like snd_printk() for debugging purpose. 322 * Compiled only when Works like snd_printk() for debugging purpose.
323 * Ignored when CONFIG_SND_DEBUG is not set. 323 * Ignored when CONFIG_SND_DEBUG is not set.
@@ -331,7 +331,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
331/** 331/**
332 * snd_assert - run-time assertion macro 332 * snd_assert - run-time assertion macro
333 * @expr: expression 333 * @expr: expression
334 * @args...: the action
335 * 334 *
336 * 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
337 * given in the rest arguments if the assertion is failed. 336 * given in the rest arguments if the assertion is failed.
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/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__ */