aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2006-04-02 00:08:05 -0500
committerDmitry Torokhov <dtor_core@ameritech.net>2006-04-02 00:08:05 -0500
commit95d465fd750897ab32462a6702fbfe1b122cbbc0 (patch)
tree65c38b2f11c51bb6932e44dd6c92f15b0091abfe /include
parent642fde17dceceb56c7ba2762733ac688666ae657 (diff)
parent683aa4012f53b2ada0f430487e05d37b0d94e90a (diff)
Manual merge with Linus.
Conflicts: arch/powerpc/kernel/setup-common.c drivers/input/keyboard/hil_kbd.c drivers/input/mouse/hil_ptr.c
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h3
-rw-r--r--include/asm-alpha/bitops.h133
-rw-r--r--include/asm-alpha/fpu.h4
-rw-r--r--include/asm-alpha/io.h84
-rw-r--r--include/asm-alpha/mmu_context.h5
-rw-r--r--include/asm-alpha/mmzone.h19
-rw-r--r--include/asm-alpha/page.h4
-rw-r--r--include/asm-alpha/poll.h4
-rw-r--r--include/asm-alpha/topology.h4
-rw-r--r--include/asm-arm/arch-aaec2000/param.h15
-rw-r--r--include/asm-arm/arch-aaec2000/uncompress.h23
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_emac.h138
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_sys.h100
-rw-r--r--include/asm-arm/arch-at91rm9200/param.h28
-rw-r--r--include/asm-arm/arch-at91rm9200/uncompress.h23
-rw-r--r--include/asm-arm/arch-cl7500/debug-macro.S14
-rw-r--r--include/asm-arm/arch-cl7500/param.h5
-rw-r--r--include/asm-arm/arch-cl7500/uncompress.h18
-rw-r--r--include/asm-arm/arch-clps711x/param.h19
-rw-r--r--include/asm-arm/arch-clps711x/uncompress.h21
-rw-r--r--include/asm-arm/arch-ebsa110/debug-macro.S19
-rw-r--r--include/asm-arm/arch-ebsa110/param.h4
-rw-r--r--include/asm-arm/arch-ebsa110/uncompress.h47
-rw-r--r--include/asm-arm/arch-ebsa285/debug-macro.S18
-rw-r--r--include/asm-arm/arch-ebsa285/param.h3
-rw-r--r--include/asm-arm/arch-ebsa285/uncompress.h16
-rw-r--r--include/asm-arm/arch-ep93xx/debug-macro.S22
-rw-r--r--include/asm-arm/arch-ep93xx/dma.h3
-rw-r--r--include/asm-arm/arch-ep93xx/entry-macro.S53
-rw-r--r--include/asm-arm/arch-ep93xx/ep93xx-regs.h125
-rw-r--r--include/asm-arm/arch-ep93xx/gesbc9312.h3
-rw-r--r--include/asm-arm/arch-ep93xx/gpio.h107
-rw-r--r--include/asm-arm/arch-ep93xx/hardware.h12
-rw-r--r--include/asm-arm/arch-ep93xx/io.h8
-rw-r--r--include/asm-arm/arch-ep93xx/irqs.h80
-rw-r--r--include/asm-arm/arch-ep93xx/memory.h14
-rw-r--r--include/asm-arm/arch-ep93xx/platform.h14
-rw-r--r--include/asm-arm/arch-ep93xx/system.h26
-rw-r--r--include/asm-arm/arch-ep93xx/timex.h5
-rw-r--r--include/asm-arm/arch-ep93xx/ts72xx.h90
-rw-r--r--include/asm-arm/arch-ep93xx/uncompress.h85
-rw-r--r--include/asm-arm/arch-ep93xx/vmalloc.h5
-rw-r--r--include/asm-arm/arch-h720x/irq.h14
-rw-r--r--include/asm-arm/arch-h720x/param.h10
-rw-r--r--include/asm-arm/arch-h720x/uncompress.h24
-rw-r--r--include/asm-arm/arch-imx/irq.h20
-rw-r--r--include/asm-arm/arch-imx/param.h19
-rw-r--r--include/asm-arm/arch-imx/uncompress.h21
-rw-r--r--include/asm-arm/arch-integrator/debug-macro.S18
-rw-r--r--include/asm-arm/arch-integrator/param.h19
-rw-r--r--include/asm-arm/arch-integrator/uncompress.h21
-rw-r--r--include/asm-arm/arch-iop3xx/debug-macro.S19
-rw-r--r--include/asm-arm/arch-iop3xx/param.h3
-rw-r--r--include/asm-arm/arch-iop3xx/uncompress.h16
-rw-r--r--include/asm-arm/arch-ixp2000/debug-macro.S17
-rw-r--r--include/asm-arm/arch-ixp2000/irq.h13
-rw-r--r--include/asm-arm/arch-ixp2000/ixdp2x00.h5
-rw-r--r--include/asm-arm/arch-ixp2000/ixp2000-regs.h4
-rw-r--r--include/asm-arm/arch-ixp2000/param.h3
-rw-r--r--include/asm-arm/arch-ixp2000/system.h2
-rw-r--r--include/asm-arm/arch-ixp2000/uncompress.h15
-rw-r--r--include/asm-arm/arch-ixp23xx/debug-macro.S23
-rw-r--r--include/asm-arm/arch-ixp23xx/dma.h3
-rw-r--r--include/asm-arm/arch-ixp23xx/entry-macro.S31
-rw-r--r--include/asm-arm/arch-ixp23xx/hardware.h37
-rw-r--r--include/asm-arm/arch-ixp23xx/io.h54
-rw-r--r--include/asm-arm/arch-ixp23xx/irqs.h223
-rw-r--r--include/asm-arm/arch-ixp23xx/ixdp2351.h89
-rw-r--r--include/asm-arm/arch-ixp23xx/ixp23xx.h306
-rw-r--r--include/asm-arm/arch-ixp23xx/memory.h46
-rw-r--r--include/asm-arm/arch-ixp23xx/platform.h31
-rw-r--r--include/asm-arm/arch-ixp23xx/system.h33
-rw-r--r--include/asm-arm/arch-ixp23xx/time.h3
-rw-r--r--include/asm-arm/arch-ixp23xx/timex.h7
-rw-r--r--include/asm-arm/arch-ixp23xx/uncompress.h40
-rw-r--r--include/asm-arm/arch-ixp23xx/vmalloc.h10
-rw-r--r--include/asm-arm/arch-ixp4xx/debug-macro.S15
-rw-r--r--include/asm-arm/arch-ixp4xx/irq.h13
-rw-r--r--include/asm-arm/arch-ixp4xx/param.h3
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h27
-rw-r--r--include/asm-arm/arch-ixp4xx/uncompress.h18
-rw-r--r--include/asm-arm/arch-l7200/param.h19
-rw-r--r--include/asm-arm/arch-l7200/uncompress.h15
-rw-r--r--include/asm-arm/arch-lh7a40x/irq.h11
-rw-r--r--include/asm-arm/arch-lh7a40x/param.h9
-rw-r--r--include/asm-arm/arch-lh7a40x/uncompress.h11
-rw-r--r--include/asm-arm/arch-omap/param.h8
-rw-r--r--include/asm-arm/arch-omap/uncompress.h20
-rw-r--r--include/asm-arm/arch-pxa/audio.h4
-rw-r--r--include/asm-arm/arch-pxa/debug-macro.S17
-rw-r--r--include/asm-arm/arch-pxa/irq.h14
-rw-r--r--include/asm-arm/arch-pxa/irqs.h6
-rw-r--r--include/asm-arm/arch-pxa/lpd270.h38
-rw-r--r--include/asm-arm/arch-pxa/param.h3
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h2
-rw-r--r--include/asm-arm/arch-pxa/sharpsl.h2
-rw-r--r--include/asm-arm/arch-pxa/uncompress.h13
-rw-r--r--include/asm-arm/arch-realview/debug-macro.S18
-rw-r--r--include/asm-arm/arch-realview/param.h19
-rw-r--r--include/asm-arm/arch-realview/uncompress.h20
-rw-r--r--include/asm-arm/arch-rpc/debug-macro.S19
-rw-r--r--include/asm-arm/arch-rpc/param.h3
-rw-r--r--include/asm-arm/arch-rpc/uncompress.h27
-rw-r--r--include/asm-arm/arch-s3c2410/osiris-cpld.h25
-rw-r--r--include/asm-arm/arch-s3c2410/osiris-map.h41
-rw-r--r--include/asm-arm/arch-s3c2410/param.h27
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpio.h2
-rw-r--r--include/asm-arm/arch-s3c2410/uncompress.h15
-rw-r--r--include/asm-arm/arch-sa1100/debug-macro.S1
-rw-r--r--include/asm-arm/arch-sa1100/param.h3
-rw-r--r--include/asm-arm/arch-sa1100/uncompress.h21
-rw-r--r--include/asm-arm/arch-shark/param.h5
-rw-r--r--include/asm-arm/arch-shark/uncompress.h13
-rw-r--r--include/asm-arm/arch-versatile/debug-macro.S18
-rw-r--r--include/asm-arm/arch-versatile/param.h19
-rw-r--r--include/asm-arm/arch-versatile/uncompress.h20
-rw-r--r--include/asm-arm/assembler.h27
-rw-r--r--include/asm-arm/bitops.h175
-rw-r--r--include/asm-arm/cacheflush.h8
-rw-r--r--include/asm-arm/delay.h12
-rw-r--r--include/asm-arm/domain.h18
-rw-r--r--include/asm-arm/hardware/debug-8250.S29
-rw-r--r--include/asm-arm/hardware/debug-pl01x.S29
-rw-r--r--include/asm-arm/hardware/uengine.h (renamed from include/asm-arm/arch-ixp2000/uengine.h)0
-rw-r--r--include/asm-arm/hardware/vic.h2
-rw-r--r--include/asm-arm/io.h36
-rw-r--r--include/asm-arm/irq.h2
-rw-r--r--include/asm-arm/mach/arch.h5
-rw-r--r--include/asm-arm/mach/irq.h7
-rw-r--r--include/asm-arm/memory.h15
-rw-r--r--include/asm-arm/page.h9
-rw-r--r--include/asm-arm/param.h7
-rw-r--r--include/asm-arm/pgalloc.h5
-rw-r--r--include/asm-arm/pgtable-hwdef.h88
-rw-r--r--include/asm-arm/pgtable.h80
-rw-r--r--include/asm-arm/poll.h1
-rw-r--r--include/asm-arm/proc-fns.h8
-rw-r--r--include/asm-arm/rtc.h3
-rw-r--r--include/asm-arm/system.h22
-rw-r--r--include/asm-arm/tlb.h9
-rw-r--r--include/asm-arm/tlbflush.h9
-rw-r--r--include/asm-arm/unistd.h11
-rw-r--r--include/asm-arm26/bitops.h146
-rw-r--r--include/asm-arm26/memory.h4
-rw-r--r--include/asm-arm26/poll.h1
-rw-r--r--include/asm-cris/bitops.h235
-rw-r--r--include/asm-cris/page.h4
-rw-r--r--include/asm-cris/poll.h1
-rw-r--r--include/asm-cris/system.h2
-rw-r--r--include/asm-frv/bitops.h174
-rw-r--r--include/asm-frv/futex.h6
-rw-r--r--include/asm-frv/page.h7
-rw-r--r--include/asm-frv/poll.h1
-rw-r--r--include/asm-generic/bitops.h76
-rw-r--r--include/asm-generic/bitops/__ffs.h43
-rw-r--r--include/asm-generic/bitops/atomic.h191
-rw-r--r--include/asm-generic/bitops/ext2-atomic.h22
-rw-r--r--include/asm-generic/bitops/ext2-non-atomic.h18
-rw-r--r--include/asm-generic/bitops/ffs.h41
-rw-r--r--include/asm-generic/bitops/ffz.h12
-rw-r--r--include/asm-generic/bitops/find.h13
-rw-r--r--include/asm-generic/bitops/fls.h41
-rw-r--r--include/asm-generic/bitops/fls64.h14
-rw-r--r--include/asm-generic/bitops/hweight.h11
-rw-r--r--include/asm-generic/bitops/le.h53
-rw-r--r--include/asm-generic/bitops/minix-le.h17
-rw-r--r--include/asm-generic/bitops/minix.h15
-rw-r--r--include/asm-generic/bitops/non-atomic.h111
-rw-r--r--include/asm-generic/bitops/sched.h36
-rw-r--r--include/asm-generic/bug.h4
-rw-r--r--include/asm-generic/futex.h6
-rw-r--r--include/asm-generic/local.h91
-rw-r--r--include/asm-generic/memory_model.h77
-rw-r--r--include/asm-generic/mutex-dec.h30
-rw-r--r--include/asm-generic/mutex-xchg.h33
-rw-r--r--include/asm-generic/percpu.h7
-rw-r--r--include/asm-generic/vmlinux.lds.h14
-rw-r--r--include/asm-h8300/bitops.h222
-rw-r--r--include/asm-h8300/page.h4
-rw-r--r--include/asm-h8300/poll.h1
-rw-r--r--include/asm-h8300/types.h3
-rw-r--r--include/asm-i386/acpi.h10
-rw-r--r--include/asm-i386/alternative.h129
-rw-r--r--include/asm-i386/apicdef.h1
-rw-r--r--include/asm-i386/arch_hooks.h3
-rw-r--r--include/asm-i386/atomic.h36
-rw-r--r--include/asm-i386/bitops.h62
-rw-r--r--include/asm-i386/cache.h2
-rw-r--r--include/asm-i386/cpufeature.h1
-rw-r--r--include/asm-i386/dmi.h11
-rw-r--r--include/asm-i386/floppy.h34
-rw-r--r--include/asm-i386/futex.h27
-rw-r--r--include/asm-i386/io.h12
-rw-r--r--include/asm-i386/kdebug.h10
-rw-r--r--include/asm-i386/kprobes.h6
-rw-r--r--include/asm-i386/local.h6
-rw-r--r--include/asm-i386/mach-default/do_timer.h2
-rw-r--r--include/asm-i386/mach-default/mach_time.h37
-rw-r--r--include/asm-i386/mach-es7000/mach_mpparse.h10
-rw-r--r--include/asm-i386/mach-visws/do_timer.h2
-rw-r--r--include/asm-i386/mach-voyager/do_timer.h2
-rw-r--r--include/asm-i386/mmzone.h17
-rw-r--r--include/asm-i386/mpspec.h1
-rw-r--r--include/asm-i386/mtrr.h1
-rw-r--r--include/asm-i386/mutex.h6
-rw-r--r--include/asm-i386/page.h3
-rw-r--r--include/asm-i386/pgtable-2level.h2
-rw-r--r--include/asm-i386/pgtable-3level.h2
-rw-r--r--include/asm-i386/pgtable.h5
-rw-r--r--include/asm-i386/poll.h1
-rw-r--r--include/asm-i386/processor.h7
-rw-r--r--include/asm-i386/rwlock.h56
-rw-r--r--include/asm-i386/semaphore.h8
-rw-r--r--include/asm-i386/setup.h4
-rw-r--r--include/asm-i386/spinlock.h34
-rw-r--r--include/asm-i386/stat.h3
-rw-r--r--include/asm-i386/system.h64
-rw-r--r--include/asm-i386/topology.h2
-rw-r--r--include/asm-i386/types.h5
-rw-r--r--include/asm-i386/uaccess.h12
-rw-r--r--include/asm-i386/unistd.h42
-rw-r--r--include/asm-ia64/acpi.h4
-rw-r--r--include/asm-ia64/asmmacro.h15
-rw-r--r--include/asm-ia64/atomic.h8
-rw-r--r--include/asm-ia64/bitops.h67
-rw-r--r--include/asm-ia64/cache.h2
-rw-r--r--include/asm-ia64/compat.h6
-rw-r--r--include/asm-ia64/dmi.h6
-rw-r--r--include/asm-ia64/intel_intrin.h134
-rw-r--r--include/asm-ia64/io.h22
-rw-r--r--include/asm-ia64/kdebug.h4
-rw-r--r--include/asm-ia64/linkage.h8
-rw-r--r--include/asm-ia64/machvec.h13
-rw-r--r--include/asm-ia64/machvec_dig.h2
-rw-r--r--include/asm-ia64/machvec_sn2.h4
-rw-r--r--include/asm-ia64/mca.h2
-rw-r--r--include/asm-ia64/mutex.h93
-rw-r--r--include/asm-ia64/numa.h2
-rw-r--r--include/asm-ia64/numnodes.h13
-rw-r--r--include/asm-ia64/page.h22
-rw-r--r--include/asm-ia64/pal.h37
-rw-r--r--include/asm-ia64/pgtable.h5
-rw-r--r--include/asm-ia64/poll.h1
-rw-r--r--include/asm-ia64/processor.h4
-rw-r--r--include/asm-ia64/signal.h2
-rw-r--r--include/asm-ia64/sn/addrs.h8
-rw-r--r--include/asm-ia64/sn/l1.h3
-rw-r--r--include/asm-ia64/sn/pcibr_provider.h1
-rw-r--r--include/asm-ia64/sn/pcidev.h1
-rw-r--r--include/asm-ia64/sn/rw_mmr.h56
-rw-r--r--include/asm-ia64/sn/sn_feature_sets.h3
-rw-r--r--include/asm-ia64/sn/sn_sal.h30
-rw-r--r--include/asm-ia64/sn/tioce.h36
-rw-r--r--include/asm-ia64/sn/xpc.h22
-rw-r--r--include/asm-ia64/system.h9
-rw-r--r--include/asm-ia64/thread_info.h12
-rw-r--r--include/asm-ia64/unistd.h3
-rw-r--r--include/asm-m32r/bitops.h457
-rw-r--r--include/asm-m32r/mmzone.h14
-rw-r--r--include/asm-m32r/page.h5
-rw-r--r--include/asm-m32r/poll.h1
-rw-r--r--include/asm-m32r/setup.h4
-rw-r--r--include/asm-m68k/atomic.h8
-rw-r--r--include/asm-m68k/bitops.h42
-rw-r--r--include/asm-m68k/poll.h1
-rw-r--r--include/asm-m68k/stat.h3
-rw-r--r--include/asm-m68knommu/bitops.h221
-rw-r--r--include/asm-mips/bitops.h465
-rw-r--r--include/asm-mips/byteorder.h18
-rw-r--r--include/asm-mips/compat.h13
-rw-r--r--include/asm-mips/cpu-features.h3
-rw-r--r--include/asm-mips/cpu-info.h1
-rw-r--r--include/asm-mips/futex.h6
-rw-r--r--include/asm-mips/hazards.h180
-rw-r--r--include/asm-mips/io.h100
-rw-r--r--include/asm-mips/linkage.h4
-rw-r--r--include/asm-mips/mach-cobalt/cobalt.h2
-rw-r--r--include/asm-mips/mach-generic/mangle-port.h36
-rw-r--r--include/asm-mips/mach-ip27/mangle-port.h9
-rw-r--r--include/asm-mips/mach-ip32/mangle-port.h9
-rw-r--r--include/asm-mips/mach-mips/cpu-feature-overrides.h4
-rw-r--r--include/asm-mips/mc146818-time.h33
-rw-r--r--include/asm-mips/mmu_context.h7
-rw-r--r--include/asm-mips/mmzone.h14
-rw-r--r--include/asm-mips/page.h3
-rw-r--r--include/asm-mips/pgtable-32.h2
-rw-r--r--include/asm-mips/poll.h1
-rw-r--r--include/asm-mips/r4kcache.h4
-rw-r--r--include/asm-mips/serial.h85
-rw-r--r--include/asm-mips/sibyte/sb1250.h2
-rw-r--r--include/asm-mips/sibyte/sb1250_scd.h5
-rw-r--r--include/asm-mips/signal.h20
-rw-r--r--include/asm-mips/sn/klconfig.h2
-rw-r--r--include/asm-mips/sn/mapped_kernel.h4
-rw-r--r--include/asm-mips/sn/sn0/hubio.h12
-rw-r--r--include/asm-mips/stackframe.h20
-rw-r--r--include/asm-mips/system.h8
-rw-r--r--include/asm-mips/termbits.h2
-rw-r--r--include/asm-mips/thread_info.h2
-rw-r--r--include/asm-mips/time.h12
-rw-r--r--include/asm-mips/types.h5
-rw-r--r--include/asm-parisc/atomic.h3
-rw-r--r--include/asm-parisc/bitops.h286
-rw-r--r--include/asm-parisc/cache.h4
-rw-r--r--include/asm-parisc/cacheflush.h17
-rw-r--r--include/asm-parisc/compat.h5
-rw-r--r--include/asm-parisc/io.h113
-rw-r--r--include/asm-parisc/local.h16
-rw-r--r--include/asm-parisc/mmzone.h17
-rw-r--r--include/asm-parisc/page.h61
-rw-r--r--include/asm-parisc/pci.h5
-rw-r--r--include/asm-parisc/pdc.h2
-rw-r--r--include/asm-parisc/pdc_chassis.h5
-rw-r--r--include/asm-parisc/poll.h1
-rw-r--r--include/asm-parisc/spinlock.h16
-rw-r--r--include/asm-parisc/thread_info.h3
-rw-r--r--include/asm-powerpc/atomic.h38
-rw-r--r--include/asm-powerpc/bitops.h105
-rw-r--r--include/asm-powerpc/bug.h36
-rw-r--r--include/asm-powerpc/cputable.h335
-rw-r--r--include/asm-powerpc/cputime.h202
-rw-r--r--include/asm-powerpc/firmware.h26
-rw-r--r--include/asm-powerpc/floppy.h5
-rw-r--r--include/asm-powerpc/futex.h6
-rw-r--r--include/asm-powerpc/hvcall.h1
-rw-r--r--include/asm-powerpc/hvconsole.h26
-rw-r--r--include/asm-powerpc/irq.h6
-rw-r--r--include/asm-powerpc/iseries/mf.h7
-rw-r--r--include/asm-powerpc/kdebug.h12
-rw-r--r--include/asm-powerpc/lmb.h19
-rw-r--r--include/asm-powerpc/machdep.h43
-rw-r--r--include/asm-powerpc/mmu.h1
-rw-r--r--include/asm-powerpc/oprofile_impl.h17
-rw-r--r--include/asm-powerpc/paca.h9
-rw-r--r--include/asm-powerpc/page.h3
-rw-r--r--include/asm-powerpc/percpu.h7
-rw-r--r--include/asm-powerpc/pgtable-4k.h11
-rw-r--r--include/asm-powerpc/pgtable.h14
-rw-r--r--include/asm-powerpc/pmac_feature.h2
-rw-r--r--include/asm-powerpc/poll.h1
-rw-r--r--include/asm-powerpc/ppc-pci.h1
-rw-r--r--include/asm-powerpc/ppc_asm.h42
-rw-r--r--include/asm-powerpc/processor.h44
-rw-r--r--include/asm-powerpc/prom.h20
-rw-r--r--include/asm-powerpc/reg.h4
-rw-r--r--include/asm-powerpc/rwsem.h2
-rw-r--r--include/asm-powerpc/smp.h2
-rw-r--r--include/asm-powerpc/spu.h11
-rw-r--r--include/asm-powerpc/string.h2
-rw-r--r--include/asm-powerpc/synch.h2
-rw-r--r--include/asm-powerpc/syscalls.h58
-rw-r--r--include/asm-powerpc/system.h11
-rw-r--r--include/asm-powerpc/time.h15
-rw-r--r--include/asm-powerpc/types.h5
-rw-r--r--include/asm-powerpc/unistd.h38
-rw-r--r--include/asm-powerpc/vdso_datapage.h3
-rw-r--r--include/asm-ppc/harrier.h2
-rw-r--r--include/asm-ppc/ibm44x.h2
-rw-r--r--include/asm-ppc/ibm4xx.h4
-rw-r--r--include/asm-ppc/io.h7
-rw-r--r--include/asm-ppc/machdep.h17
-rw-r--r--include/asm-ppc/mpc10x.h3
-rw-r--r--include/asm-ppc/mpc52xx.h5
-rw-r--r--include/asm-ppc/mpc8260.h1
-rw-r--r--include/asm-ppc/mpc83xx.h1
-rw-r--r--include/asm-ppc/mpc85xx.h1
-rw-r--r--include/asm-ppc/mpc8xx.h3
-rw-r--r--include/asm-ppc/page.h4
-rw-r--r--include/asm-ppc/pgtable.h9
-rw-r--r--include/asm-ppc/ppc_sys.h34
-rw-r--r--include/asm-ppc/prom.h156
-rw-r--r--include/asm-ppc/serial.h7
-rw-r--r--include/asm-ppc/time.h5
-rw-r--r--include/asm-ppc/todc.h2
-rw-r--r--include/asm-ppc/xparameters.h18
-rw-r--r--include/asm-s390/atomic.h18
-rw-r--r--include/asm-s390/bitops.h48
-rw-r--r--include/asm-s390/bug.h5
-rw-r--r--include/asm-s390/compat.h5
-rw-r--r--include/asm-s390/page.h3
-rw-r--r--include/asm-s390/percpu.h7
-rw-r--r--include/asm-s390/pgalloc.h7
-rw-r--r--include/asm-s390/poll.h1
-rw-r--r--include/asm-s390/types.h5
-rw-r--r--include/asm-sh/addrspace.h2
-rw-r--r--include/asm-sh/bitops.h348
-rw-r--r--include/asm-sh/io.h14
-rw-r--r--include/asm-sh/page.h5
-rw-r--r--include/asm-sh/poll.h1
-rw-r--r--include/asm-sh/stat.h8
-rw-r--r--include/asm-sh/thread_info.h2
-rw-r--r--include/asm-sh/types.h5
-rw-r--r--include/asm-sh64/bitops.h390
-rw-r--r--include/asm-sh64/page.h5
-rw-r--r--include/asm-sh64/pgalloc.h16
-rw-r--r--include/asm-sh64/platform.h5
-rw-r--r--include/asm-sh64/poll.h1
-rw-r--r--include/asm-sparc/bitops.h388
-rw-r--r--include/asm-sparc/cpudata.h1
-rw-r--r--include/asm-sparc/idprom.h26
-rw-r--r--include/asm-sparc/oplib.h2
-rw-r--r--include/asm-sparc/page.h4
-rw-r--r--include/asm-sparc/pgtable.h6
-rw-r--r--include/asm-sparc/poll.h1
-rw-r--r--include/asm-sparc/smp.h9
-rw-r--r--include/asm-sparc/socket.h2
-rw-r--r--include/asm-sparc/spinlock.h25
-rw-r--r--include/asm-sparc/uaccess.h47
-rw-r--r--include/asm-sparc64/a.out.h6
-rw-r--r--include/asm-sparc64/asi.h18
-rw-r--r--include/asm-sparc64/atomic.h10
-rw-r--r--include/asm-sparc64/bitops.h219
-rw-r--r--include/asm-sparc64/cache.h2
-rw-r--r--include/asm-sparc64/cpudata.h206
-rw-r--r--include/asm-sparc64/elf.h22
-rw-r--r--include/asm-sparc64/floppy.h2
-rw-r--r--include/asm-sparc64/futex.h24
-rw-r--r--include/asm-sparc64/head.h15
-rw-r--r--include/asm-sparc64/hypervisor.h2128
-rw-r--r--include/asm-sparc64/idprom.h12
-rw-r--r--include/asm-sparc64/intr_queue.h15
-rw-r--r--include/asm-sparc64/irq.h4
-rw-r--r--include/asm-sparc64/kdebug.h11
-rw-r--r--include/asm-sparc64/mmu.h57
-rw-r--r--include/asm-sparc64/mmu_context.h167
-rw-r--r--include/asm-sparc64/numnodes.h6
-rw-r--r--include/asm-sparc64/oplib.h43
-rw-r--r--include/asm-sparc64/page.h47
-rw-r--r--include/asm-sparc64/pbm.h3
-rw-r--r--include/asm-sparc64/pci.h56
-rw-r--r--include/asm-sparc64/percpu.h7
-rw-r--r--include/asm-sparc64/pgalloc.h166
-rw-r--r--include/asm-sparc64/pgtable.h706
-rw-r--r--include/asm-sparc64/pil.h4
-rw-r--r--include/asm-sparc64/poll.h1
-rw-r--r--include/asm-sparc64/processor.h23
-rw-r--r--include/asm-sparc64/pstate.h9
-rw-r--r--include/asm-sparc64/scratchpad.h14
-rw-r--r--include/asm-sparc64/smp.h30
-rw-r--r--include/asm-sparc64/sparsemem.h12
-rw-r--r--include/asm-sparc64/spitfire.h1
-rw-r--r--include/asm-sparc64/system.h7
-rw-r--r--include/asm-sparc64/thread_info.h9
-rw-r--r--include/asm-sparc64/timex.h6
-rw-r--r--include/asm-sparc64/tlbflush.h25
-rw-r--r--include/asm-sparc64/tsb.h281
-rw-r--r--include/asm-sparc64/ttable.h272
-rw-r--r--include/asm-sparc64/uaccess.h46
-rw-r--r--include/asm-sparc64/vdev.h16
-rw-r--r--include/asm-sparc64/xor.h34
-rw-r--r--include/asm-um/alternative.h6
-rw-r--r--include/asm-um/desc.h12
-rw-r--r--include/asm-um/host_ldt-i386.h34
-rw-r--r--include/asm-um/host_ldt-x86_64.h (renamed from include/asm-um/ldt-x86_64.h)39
-rw-r--r--include/asm-um/ldt-i386.h69
-rw-r--r--include/asm-um/ldt.h41
-rw-r--r--include/asm-um/page.h4
-rw-r--r--include/asm-um/processor-i386.h35
-rw-r--r--include/asm-um/processor-x86_64.h9
-rw-r--r--include/asm-um/ptrace-generic.h16
-rw-r--r--include/asm-um/ptrace-i386.h41
-rw-r--r--include/asm-um/ptrace-x86_64.h35
-rw-r--r--include/asm-um/segment.h6
-rw-r--r--include/asm-um/thread_info.h16
-rw-r--r--include/asm-um/uaccess.h33
-rw-r--r--include/asm-v850/bitops.h220
-rw-r--r--include/asm-v850/linkage.h4
-rw-r--r--include/asm-v850/page.h4
-rw-r--r--include/asm-v850/poll.h1
-rw-r--r--include/asm-x86_64/apicdef.h1
-rw-r--r--include/asm-x86_64/atomic.h8
-rw-r--r--include/asm-x86_64/bitops.h42
-rw-r--r--include/asm-x86_64/cache.h2
-rw-r--r--include/asm-x86_64/dmi.h27
-rw-r--r--include/asm-x86_64/elf.h4
-rw-r--r--include/asm-x86_64/floppy.h2
-rw-r--r--include/asm-x86_64/futex.h27
-rw-r--r--include/asm-x86_64/io.h38
-rw-r--r--include/asm-x86_64/kdebug.h23
-rw-r--r--include/asm-x86_64/local.h18
-rw-r--r--include/asm-x86_64/mmu_context.h6
-rw-r--r--include/asm-x86_64/mmzone.h13
-rw-r--r--include/asm-x86_64/numa.h4
-rw-r--r--include/asm-x86_64/page.h3
-rw-r--r--include/asm-x86_64/pda.h2
-rw-r--r--include/asm-x86_64/percpu.h7
-rw-r--r--include/asm-x86_64/pgalloc.h28
-rw-r--r--include/asm-x86_64/pgtable.h14
-rw-r--r--include/asm-x86_64/poll.h1
-rw-r--r--include/asm-x86_64/processor.h7
-rw-r--r--include/asm-x86_64/proto.h3
-rw-r--r--include/asm-x86_64/smp.h1
-rw-r--r--include/asm-x86_64/string.h17
-rw-r--r--include/asm-x86_64/suspend.h4
-rw-r--r--include/asm-x86_64/system.h6
-rw-r--r--include/asm-x86_64/topology.h2
-rw-r--r--include/asm-x86_64/unistd.h10
-rw-r--r--include/asm-xtensa/bitops.h340
-rw-r--r--include/asm-xtensa/page.h6
-rw-r--r--include/asm-xtensa/poll.h1
-rw-r--r--include/linux/adb.h2
-rw-r--r--include/linux/amba/clcd.h12
-rw-r--r--include/linux/amba/serial.h6
-rw-r--r--include/linux/arcdevice.h9
-rw-r--r--include/linux/ata.h29
-rw-r--r--include/linux/audit.h130
-rw-r--r--include/linux/auto_fs4.h51
-rw-r--r--include/linux/backlight.h25
-rw-r--r--include/linux/bitmap.h3
-rw-r--r--include/linux/bitops.h131
-rw-r--r--include/linux/blkdev.h33
-rw-r--r--include/linux/blktrace_api.h277
-rw-r--r--include/linux/bootmem.h4
-rw-r--r--include/linux/buffer_head.h26
-rw-r--r--include/linux/cache.h4
-rw-r--r--include/linux/capability.h3
-rw-r--r--include/linux/cdev.h4
-rw-r--r--include/linux/cdrom.h5
-rw-r--r--include/linux/clk.h4
-rw-r--r--include/linux/coda_linux.h6
-rw-r--r--include/linux/compat.h46
-rw-r--r--include/linux/compat_ioctl.h6
-rw-r--r--include/linux/cpu.h3
-rw-r--r--include/linux/cpumask.h51
-rw-r--r--include/linux/cpuset.h29
-rw-r--r--include/linux/crash_dump.h2
-rw-r--r--include/linux/crypto.h10
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/dccp.h132
-rw-r--r--include/linux/debugfs.h17
-rw-r--r--include/linux/device-mapper.h1
-rw-r--r--include/linux/device.h5
-rw-r--r--include/linux/dio.h32
-rw-r--r--include/linux/dm-ioctl.h17
-rw-r--r--include/linux/dma-mapping.h2
-rw-r--r--include/linux/dmi.h2
-rw-r--r--include/linux/dn.h44
-rw-r--r--include/linux/dvb/audio.h13
-rw-r--r--include/linux/dvb/video.h13
-rw-r--r--include/linux/efi.h20
-rw-r--r--include/linux/efs_fs.h2
-rw-r--r--include/linux/elevator.h10
-rw-r--r--include/linux/eventpoll.h8
-rw-r--r--include/linux/ext3_fs.h18
-rw-r--r--include/linux/ext3_fs_i.h7
-rw-r--r--include/linux/fb.h4
-rw-r--r--include/linux/file.h28
-rw-r--r--include/linux/fs.h135
-rw-r--r--include/linux/fsl_devices.h27
-rw-r--r--include/linux/fsnotify.h33
-rw-r--r--include/linux/futex.h89
-rw-r--r--include/linux/gameport.h4
-rw-r--r--include/linux/generic_serial.h4
-rw-r--r--include/linux/genhd.h29
-rw-r--r--include/linux/gigaset_dev.h32
-rw-r--r--include/linux/highmem.h12
-rw-r--r--include/linux/hpet.h36
-rw-r--r--include/linux/hrtimer.h57
-rw-r--r--include/linux/hugetlb.h47
-rw-r--r--include/linux/hwmon-sysfs.h24
-rw-r--r--include/linux/i2c-id.h6
-rw-r--r--include/linux/i2c.h6
-rw-r--r--include/linux/i2o.h4
-rw-r--r--include/linux/icmpv6.h11
-rw-r--r--include/linux/ide.h1
-rw-r--r--include/linux/if.h29
-rw-r--r--include/linux/if_ether.h1
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init.h4
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/inotify.h11
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/ipmi.h3
-rw-r--r--include/linux/ipmi_msgdefs.h1
-rw-r--r--include/linux/ipmi_smi.h63
-rw-r--r--include/linux/ipv6.h14
-rw-r--r--include/linux/ipv6_route.h10
-rw-r--r--include/linux/irda.h1
-rw-r--r--include/linux/irq.h49
-rw-r--r--include/linux/jbd.h13
-rw-r--r--include/linux/kernel.h10
-rw-r--r--include/linux/kernel_stat.h2
-rw-r--r--include/linux/kobj_map.h4
-rw-r--r--include/linux/kobject.h4
-rw-r--r--include/linux/kprobes.h3
-rw-r--r--include/linux/ktime.h20
-rw-r--r--include/linux/leds.h111
-rw-r--r--include/linux/libata.h205
-rw-r--r--include/linux/linkage.h16
-rw-r--r--include/linux/list.h24
-rw-r--r--include/linux/lockd/lockd.h27
-rw-r--r--include/linux/lockd/share.h2
-rw-r--r--include/linux/lockd/xdr.h1
-rw-r--r--include/linux/loop.h3
-rw-r--r--include/linux/m48t86.h16
-rw-r--r--include/linux/major.h1
-rw-r--r--include/linux/memory.h1
-rw-r--r--include/linux/mempolicy.h5
-rw-r--r--include/linux/mempool.h38
-rw-r--r--include/linux/migrate.h39
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mm.h48
-rw-r--r--include/linux/mm_inline.h2
-rw-r--r--include/linux/mmzone.h91
-rw-r--r--include/linux/module.h30
-rw-r--r--include/linux/moduleparam.h7
-rw-r--r--include/linux/msdos_fs.h12
-rw-r--r--include/linux/mtd/blktrans.h4
-rw-r--r--include/linux/mtd/doc2000.h4
-rw-r--r--include/linux/mtd/inftl.h5
-rw-r--r--include/linux/mv643xx.h27
-rw-r--r--include/linux/namei.h1
-rw-r--r--include/linux/nbd.h3
-rw-r--r--include/linux/ncp_fs.h4
-rw-r--r--include/linux/ncp_fs_i.h2
-rw-r--r--include/linux/ncp_fs_sb.h5
-rw-r--r--include/linux/net.h10
-rw-r--r--include/linux/netdevice.h94
-rw-r--r--include/linux/netfilter.h9
-rw-r--r--include/linux/netfilter/nfnetlink.h1
-rw-r--r--include/linux/netfilter/nfnetlink_log.h6
-rw-r--r--include/linux/netfilter/x_tables.h101
-rw-r--r--include/linux/netfilter/xt_policy.h58
-rw-r--r--include/linux/netfilter_arp/arp_tables.h37
-rw-r--r--include/linux/netfilter_bridge.h27
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h19
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h30
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h70
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h69
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h69
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h69
-rw-r--r--include/linux/netlink.h1
-rw-r--r--include/linux/nfs_fs.h106
-rw-r--r--include/linux/nfs_fs_i.h8
-rw-r--r--include/linux/nfs_fs_sb.h6
-rw-r--r--include/linux/nfs_xdr.h5
-rw-r--r--include/linux/nfsd/export.h29
-rw-r--r--include/linux/nodemask.h4
-rw-r--r--include/linux/notifier.h96
-rw-r--r--include/linux/oprofile.h14
-rw-r--r--include/linux/page-flags.h24
-rw-r--r--include/linux/pagemap.h9
-rw-r--r--include/linux/pci.h12
-rw-r--r--include/linux/pci_ids.h16
-rw-r--r--include/linux/pfn.h9
-rw-r--r--include/linux/pid.h98
-rw-r--r--include/linux/pipe_fs_i.h8
-rw-r--r--include/linux/platform.h43
-rw-r--r--include/linux/pm.h3
-rw-r--r--include/linux/poll.h17
-rw-r--r--include/linux/ppdev.h2
-rw-r--r--include/linux/proc_fs.h15
-rw-r--r--include/linux/profile.h2
-rw-r--r--include/linux/qnx4_fs.h4
-rw-r--r--include/linux/quota.h8
-rw-r--r--include/linux/radix-tree.h13
-rw-r--r--include/linux/raid/md.h3
-rw-r--r--include/linux/raid/md_k.h21
-rw-r--r--include/linux/raid/md_p.h32
-rw-r--r--include/linux/raid/raid1.h2
-rw-r--r--include/linux/raid/raid5.h25
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/rcupdate.h2
-rw-r--r--include/linux/reiserfs_fs.h9
-rw-r--r--include/linux/reiserfs_xattr.h6
-rw-r--r--include/linux/relay.h (renamed from include/linux/relayfs_fs.h)44
-rw-r--r--include/linux/rtc.h96
-rw-r--r--include/linux/rtnetlink.h27
-rw-r--r--include/linux/sched.h85
-rw-r--r--include/linux/security.h80
-rw-r--r--include/linux/seq_file.h4
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serial_core.h6
-rw-r--r--include/linux/serio.h6
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/skbuff.h76
-rw-r--r--include/linux/slab.h43
-rw-r--r--include/linux/smp.h29
-rw-r--r--include/linux/socket.h1
-rw-r--r--include/linux/sound.h12
-rw-r--r--include/linux/stat.h2
-rw-r--r--include/linux/statfs.h10
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/sunrpc/cache.h145
-rw-r--r--include/linux/sunrpc/clnt.h20
-rw-r--r--include/linux/sunrpc/gss_krb5.h2
-rw-r--r--include/linux/sunrpc/metrics.h77
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--include/linux/sunrpc/sched.h9
-rw-r--r--include/linux/sunrpc/stats.h4
-rw-r--r--include/linux/sunrpc/svcauth.h12
-rw-r--r--include/linux/sunrpc/svcsock.h2
-rw-r--r--include/linux/sunrpc/xprt.h13
-rw-r--r--include/linux/swap.h43
-rw-r--r--include/linux/synclink.h11
-rw-r--r--include/linux/syscalls.h5
-rw-r--r--include/linux/sysctl.h27
-rw-r--r--include/linux/tcp.h6
-rw-r--r--include/linux/threads.h3
-rw-r--r--include/linux/time.h19
-rw-r--r--include/linux/timer.h17
-rw-r--r--include/linux/timex.h43
-rw-r--r--include/linux/tiocl.h1
-rw-r--r--include/linux/topology.h9
-rw-r--r--include/linux/tty.h8
-rw-r--r--include/linux/tty_flip.h16
-rw-r--r--include/linux/types.h4
-rw-r--r--include/linux/udf_fs_i.h21
-rw-r--r--include/linux/udf_fs_sb.h4
-rw-r--r--include/linux/ufs_fs.h4
-rw-r--r--include/linux/usb.h4
-rw-r--r--include/linux/usb_gadget.h7
-rw-r--r--include/linux/videodev2.h87
-rw-r--r--include/linux/vt_kern.h5
-rw-r--r--include/linux/wireless.h10
-rw-r--r--include/linux/workqueue.h6
-rw-r--r--include/linux/writeback.h14
-rw-r--r--include/linux/x1205.h31
-rw-r--r--include/linux/x25.h26
-rw-r--r--include/linux/xfrm.h30
-rw-r--r--include/linux/zorro.h33
-rw-r--r--include/media/audiochip.h14
-rw-r--r--include/media/cs53l32a.h34
-rw-r--r--include/media/i2c-addr.h44
-rw-r--r--include/media/ir-common.h40
-rw-r--r--include/media/msp3400.h226
-rw-r--r--include/media/rds.h44
-rw-r--r--include/media/saa7146.h21
-rw-r--r--include/media/saa7146_vv.h3
-rw-r--r--include/media/tuner-types.h3
-rw-r--r--include/media/tuner.h6
-rw-r--r--include/media/tvaudio.h30
-rw-r--r--include/media/v4l2-common.h65
-rw-r--r--include/media/video-buf-dvb.h2
-rw-r--r--include/media/video-buf.h58
-rw-r--r--include/media/wm8775.h35
-rw-r--r--include/net/af_unix.h3
-rw-r--r--include/net/ax25.h9
-rw-r--r--include/net/compat.h4
-rw-r--r--include/net/dn.h105
-rw-r--r--include/net/dn_dev.h88
-rw-r--r--include/net/dn_fib.h22
-rw-r--r--include/net/dn_neigh.h4
-rw-r--r--include/net/dn_nsp.h72
-rw-r--r--include/net/dn_route.h12
-rw-r--r--include/net/flow.h8
-rw-r--r--include/net/ieee80211.h177
-rw-r--r--include/net/ieee80211_crypt.h3
-rw-r--r--include/net/ieee80211softmac.h292
-rw-r--r--include/net/ieee80211softmac_wx.h94
-rw-r--r--include/net/if_inet6.h3
-rw-r--r--include/net/inet_connection_sock.h26
-rw-r--r--include/net/ip.h4
-rw-r--r--include/net/ip6_route.h24
-rw-r--r--include/net/ipv6.h22
-rw-r--r--include/net/iw_handler.h12
-rw-r--r--include/net/llc.h2
-rw-r--r--include/net/ndisc.h2
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h77
-rw-r--r--include/net/request_sock.h2
-rw-r--r--include/net/route.h2
-rw-r--r--include/net/scm.h10
-rw-r--r--include/net/sctp/structs.h10
-rw-r--r--include/net/sock.h107
-rw-r--r--include/net/tc_act/tc_ipt.h4
-rw-r--r--include/net/tcp.h19
-rw-r--r--include/net/x25.h21
-rw-r--r--include/net/xfrm.h78
-rw-r--r--include/rdma/ib_fmr_pool.h2
-rw-r--r--include/rdma/ib_mad.h75
-rw-r--r--include/rdma/ib_user_verbs.h79
-rw-r--r--include/rdma/ib_verbs.h38
-rw-r--r--include/scsi/scsi.h2
-rw-r--r--include/scsi/scsi_cmnd.h20
-rw-r--r--include/scsi/scsi_device.h26
-rw-r--r--include/scsi/scsi_eh.h3
-rw-r--r--include/scsi/scsi_host.h16
-rw-r--r--include/scsi/scsi_transport.h11
-rw-r--r--include/scsi/scsi_transport_sas.h50
-rw-r--r--include/scsi/scsi_transport_spi.h4
-rw-r--r--include/sound/ac97_codec.h15
-rw-r--r--include/sound/ad1848.h2
-rw-r--r--include/sound/ak4531_codec.h2
-rw-r--r--include/sound/core.h14
-rw-r--r--include/sound/cs4231.h4
-rw-r--r--include/sound/cs46xx.h2
-rw-r--r--include/sound/emu10k1.h4
-rw-r--r--include/sound/emux_synth.h2
-rw-r--r--include/sound/gus.h6
-rw-r--r--include/sound/hwdep.h2
-rw-r--r--include/sound/i2c.h10
-rw-r--r--include/sound/info.h2
-rw-r--r--include/sound/mixer_oss.h2
-rw-r--r--include/sound/opl3.h4
-rw-r--r--include/sound/pcm.h2
-rw-r--r--include/sound/pcm_oss.h4
-rw-r--r--include/sound/rawmidi.h4
-rw-r--r--include/sound/sb16_csp.h2
-rw-r--r--include/sound/seq_instr.h2
-rw-r--r--include/sound/soundfont.h2
-rw-r--r--include/sound/util_mem.h4
-rw-r--r--include/sound/version.h4
-rw-r--r--include/sound/vx_core.h2
-rw-r--r--include/sound/ymfpci.h10
-rw-r--r--include/video/pm3fb.h3
808 files changed, 15176 insertions, 10946 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 0b54e9a4a8a1..6dca3d542080 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -269,7 +269,7 @@ struct acpi_device_wakeup_state {
269 269
270struct acpi_device_wakeup { 270struct acpi_device_wakeup {
271 acpi_handle gpe_device; 271 acpi_handle gpe_device;
272 acpi_integer gpe_number;; 272 acpi_integer gpe_number;
273 acpi_integer sleep_state; 273 acpi_integer sleep_state;
274 struct acpi_handle_list resources; 274 struct acpi_handle_list resources;
275 struct acpi_device_wakeup_state state; 275 struct acpi_device_wakeup_state state;
@@ -330,6 +330,7 @@ int acpi_bus_register_driver(struct acpi_driver *driver);
330int acpi_bus_unregister_driver(struct acpi_driver *driver); 330int acpi_bus_unregister_driver(struct acpi_driver *driver);
331int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, 331int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
332 acpi_handle handle, int type); 332 acpi_handle handle, int type);
333int acpi_bus_trim(struct acpi_device *start, int rmdevice);
333int acpi_bus_start(struct acpi_device *device); 334int acpi_bus_start(struct acpi_device *device);
334 335
335int acpi_match_ids(struct acpi_device *device, char *ids); 336int acpi_match_ids(struct acpi_device *device, char *ids);
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h
index 302201f1a097..3f88715e811e 100644
--- a/include/asm-alpha/bitops.h
+++ b/include/asm-alpha/bitops.h
@@ -261,7 +261,7 @@ static inline unsigned long ffz_b(unsigned long x)
261 261
262static inline unsigned long ffz(unsigned long word) 262static inline unsigned long ffz(unsigned long word)
263{ 263{
264#if defined(__alpha_cix__) && defined(__alpha_fix__) 264#if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67)
265 /* Whee. EV67 can calculate it directly. */ 265 /* Whee. EV67 can calculate it directly. */
266 return __kernel_cttz(~word); 266 return __kernel_cttz(~word);
267#else 267#else
@@ -281,7 +281,7 @@ static inline unsigned long ffz(unsigned long word)
281 */ 281 */
282static inline unsigned long __ffs(unsigned long word) 282static inline unsigned long __ffs(unsigned long word)
283{ 283{
284#if defined(__alpha_cix__) && defined(__alpha_fix__) 284#if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67)
285 /* Whee. EV67 can calculate it directly. */ 285 /* Whee. EV67 can calculate it directly. */
286 return __kernel_cttz(word); 286 return __kernel_cttz(word);
287#else 287#else
@@ -313,20 +313,20 @@ static inline int ffs(int word)
313/* 313/*
314 * fls: find last bit set. 314 * fls: find last bit set.
315 */ 315 */
316#if defined(__alpha_cix__) && defined(__alpha_fix__) 316#if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67)
317static inline int fls(int word) 317static inline int fls(int word)
318{ 318{
319 return 64 - __kernel_ctlz(word & 0xffffffff); 319 return 64 - __kernel_ctlz(word & 0xffffffff);
320} 320}
321#else 321#else
322#define fls generic_fls 322#include <asm-generic/bitops/fls.h>
323#endif 323#endif
324#define fls64 generic_fls64 324#include <asm-generic/bitops/fls64.h>
325 325
326/* Compute powers of two for the given integer. */ 326/* Compute powers of two for the given integer. */
327static inline long floor_log2(unsigned long word) 327static inline long floor_log2(unsigned long word)
328{ 328{
329#if defined(__alpha_cix__) && defined(__alpha_fix__) 329#if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67)
330 return 63 - __kernel_ctlz(word); 330 return 63 - __kernel_ctlz(word);
331#else 331#else
332 long bit; 332 long bit;
@@ -347,7 +347,7 @@ static inline long ceil_log2(unsigned long word)
347 * of bits set) of a N-bit word 347 * of bits set) of a N-bit word
348 */ 348 */
349 349
350#if defined(__alpha_cix__) && defined(__alpha_fix__) 350#if defined(CONFIG_ALPHA_EV6) && defined(CONFIG_ALPHA_EV67)
351/* Whee. EV67 can calculate it directly. */ 351/* Whee. EV67 can calculate it directly. */
352static inline unsigned long hweight64(unsigned long w) 352static inline unsigned long hweight64(unsigned long w)
353{ 353{
@@ -358,112 +358,12 @@ static inline unsigned long hweight64(unsigned long w)
358#define hweight16(x) (unsigned int) hweight64((x) & 0xfffful) 358#define hweight16(x) (unsigned int) hweight64((x) & 0xfffful)
359#define hweight8(x) (unsigned int) hweight64((x) & 0xfful) 359#define hweight8(x) (unsigned int) hweight64((x) & 0xfful)
360#else 360#else
361static inline unsigned long hweight64(unsigned long w) 361#include <asm-generic/bitops/hweight.h>
362{
363 unsigned long result;
364 for (result = 0; w ; w >>= 1)
365 result += (w & 1);
366 return result;
367}
368
369#define hweight32(x) generic_hweight32(x)
370#define hweight16(x) generic_hweight16(x)
371#define hweight8(x) generic_hweight8(x)
372#endif 362#endif
373 363
374#endif /* __KERNEL__ */ 364#endif /* __KERNEL__ */
375 365
376/* 366#include <asm-generic/bitops/find.h>
377 * Find next zero bit in a bitmap reasonably efficiently..
378 */
379static inline unsigned long
380find_next_zero_bit(const void *addr, unsigned long size, unsigned long offset)
381{
382 const unsigned long *p = addr;
383 unsigned long result = offset & ~63UL;
384 unsigned long tmp;
385
386 p += offset >> 6;
387 if (offset >= size)
388 return size;
389 size -= result;
390 offset &= 63UL;
391 if (offset) {
392 tmp = *(p++);
393 tmp |= ~0UL >> (64-offset);
394 if (size < 64)
395 goto found_first;
396 if (~tmp)
397 goto found_middle;
398 size -= 64;
399 result += 64;
400 }
401 while (size & ~63UL) {
402 if (~(tmp = *(p++)))
403 goto found_middle;
404 result += 64;
405 size -= 64;
406 }
407 if (!size)
408 return result;
409 tmp = *p;
410 found_first:
411 tmp |= ~0UL << size;
412 if (tmp == ~0UL) /* Are any bits zero? */
413 return result + size; /* Nope. */
414 found_middle:
415 return result + ffz(tmp);
416}
417
418/*
419 * Find next one bit in a bitmap reasonably efficiently.
420 */
421static inline unsigned long
422find_next_bit(const void * addr, unsigned long size, unsigned long offset)
423{
424 const unsigned long *p = addr;
425 unsigned long result = offset & ~63UL;
426 unsigned long tmp;
427
428 p += offset >> 6;
429 if (offset >= size)
430 return size;
431 size -= result;
432 offset &= 63UL;
433 if (offset) {
434 tmp = *(p++);
435 tmp &= ~0UL << offset;
436 if (size < 64)
437 goto found_first;
438 if (tmp)
439 goto found_middle;
440 size -= 64;
441 result += 64;
442 }
443 while (size & ~63UL) {
444 if ((tmp = *(p++)))
445 goto found_middle;
446 result += 64;
447 size -= 64;
448 }
449 if (!size)
450 return result;
451 tmp = *p;
452 found_first:
453 tmp &= ~0UL >> (64 - size);
454 if (!tmp)
455 return result + size;
456 found_middle:
457 return result + __ffs(tmp);
458}
459
460/*
461 * The optimizer actually does good code for this case.
462 */
463#define find_first_zero_bit(addr, size) \
464 find_next_zero_bit((addr), (size), 0)
465#define find_first_bit(addr, size) \
466 find_next_bit((addr), (size), 0)
467 367
468#ifdef __KERNEL__ 368#ifdef __KERNEL__
469 369
@@ -487,21 +387,12 @@ sched_find_first_bit(unsigned long b[3])
487 return __ffs(b0) + ofs; 387 return __ffs(b0) + ofs;
488} 388}
489 389
390#include <asm-generic/bitops/ext2-non-atomic.h>
490 391
491#define ext2_set_bit __test_and_set_bit
492#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 392#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
493#define ext2_clear_bit __test_and_clear_bit
494#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) 393#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
495#define ext2_test_bit test_bit 394
496#define ext2_find_first_zero_bit find_first_zero_bit 395#include <asm-generic/bitops/minix.h>
497#define ext2_find_next_zero_bit find_next_zero_bit
498
499/* Bitmap functions for the minix filesystem. */
500#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
501#define minix_set_bit(nr,addr) __set_bit(nr,addr)
502#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
503#define minix_test_bit(nr,addr) test_bit(nr,addr)
504#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
505 396
506#endif /* __KERNEL__ */ 397#endif /* __KERNEL__ */
507 398
diff --git a/include/asm-alpha/fpu.h b/include/asm-alpha/fpu.h
index c203fc2fa5cd..ecb17a72acc3 100644
--- a/include/asm-alpha/fpu.h
+++ b/include/asm-alpha/fpu.h
@@ -130,7 +130,7 @@ rdfpcr(void)
130{ 130{
131 unsigned long tmp, ret; 131 unsigned long tmp, ret;
132 132
133#if defined(__alpha_cix__) || defined(__alpha_fix__) 133#if defined(CONFIG_ALPHA_EV6) || defined(CONFIG_ALPHA_EV67)
134 __asm__ __volatile__ ( 134 __asm__ __volatile__ (
135 "ftoit $f0,%0\n\t" 135 "ftoit $f0,%0\n\t"
136 "mf_fpcr $f0\n\t" 136 "mf_fpcr $f0\n\t"
@@ -154,7 +154,7 @@ wrfpcr(unsigned long val)
154{ 154{
155 unsigned long tmp; 155 unsigned long tmp;
156 156
157#if defined(__alpha_cix__) || defined(__alpha_fix__) 157#if defined(CONFIG_ALPHA_EV6) || defined(CONFIG_ALPHA_EV67)
158 __asm__ __volatile__ ( 158 __asm__ __volatile__ (
159 "ftoit $f0,%0\n\t" 159 "ftoit $f0,%0\n\t"
160 "itoft %1,$f0\n\t" 160 "itoft %1,$f0\n\t"
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index 871dd7ad909d..3ebbeee753e9 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -534,9 +534,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
534#define eth_io_copy_and_sum(skb,src,len,unused) \ 534#define eth_io_copy_and_sum(skb,src,len,unused) \
535 memcpy_fromio((skb)->data,src,len) 535 memcpy_fromio((skb)->data,src,len)
536 536
537#define isa_eth_io_copy_and_sum(skb,src,len,unused) \
538 isa_memcpy_fromio((skb)->data,src,len)
539
540static inline int 537static inline int
541check_signature(const volatile void __iomem *io_addr, 538check_signature(const volatile void __iomem *io_addr,
542 const unsigned char *signature, int length) 539 const unsigned char *signature, int length)
@@ -550,87 +547,6 @@ check_signature(const volatile void __iomem *io_addr,
550 return 1; 547 return 1;
551} 548}
552 549
553
554/*
555 * ISA space is mapped to some machine-specific location on Alpha.
556 * Call into the existing hooks to get the address translated.
557 */
558
559static inline u8
560isa_readb(unsigned long offset)
561{
562 void __iomem *addr = ioremap(offset, 1);
563 u8 ret = readb(addr);
564 iounmap(addr);
565 return ret;
566}
567
568static inline u16
569isa_readw(unsigned long offset)
570{
571 void __iomem *addr = ioremap(offset, 2);
572 u16 ret = readw(addr);
573 iounmap(addr);
574 return ret;
575}
576
577static inline u32
578isa_readl(unsigned long offset)
579{
580 void __iomem *addr = ioremap(offset, 2);
581 u32 ret = readl(addr);
582 iounmap(addr);
583 return ret;
584}
585
586static inline void
587isa_writeb(u8 b, unsigned long offset)
588{
589 void __iomem *addr = ioremap(offset, 2);
590 writeb(b, addr);
591 iounmap(addr);
592}
593
594static inline void
595isa_writew(u16 w, unsigned long offset)
596{
597 void __iomem *addr = ioremap(offset, 2);
598 writew(w, addr);
599 iounmap(addr);
600}
601
602static inline void
603isa_writel(u32 l, unsigned long offset)
604{
605 void __iomem *addr = ioremap(offset, 2);
606 writel(l, addr);
607 iounmap(addr);
608}
609
610static inline void
611isa_memset_io(unsigned long offset, u8 val, long n)
612{
613 void __iomem *addr = ioremap(offset, n);
614 memset_io(addr, val, n);
615 iounmap(addr);
616}
617
618static inline void
619isa_memcpy_fromio(void *dest, unsigned long offset, long n)
620{
621 void __iomem *addr = ioremap(offset, n);
622 memcpy_fromio(dest, addr, n);
623 iounmap(addr);
624}
625
626static inline void
627isa_memcpy_toio(unsigned long offset, const void *src, long n)
628{
629 void __iomem *addr = ioremap(offset, n);
630 memcpy_toio(addr, src, n);
631 iounmap(addr);
632}
633
634/* 550/*
635 * The Alpha Jensen hardware for some rather strange reason puts 551 * The Alpha Jensen hardware for some rather strange reason puts
636 * the RTC clock at 0x170 instead of 0x70. Probably due to some 552 * the RTC clock at 0x170 instead of 0x70. Probably due to some
diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h
index 6f92482cc96c..0c017fc181c1 100644
--- a/include/asm-alpha/mmu_context.h
+++ b/include/asm-alpha/mmu_context.h
@@ -231,9 +231,8 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
231{ 231{
232 int i; 232 int i;
233 233
234 for (i = 0; i < NR_CPUS; i++) 234 for_each_online_cpu(i)
235 if (cpu_online(i)) 235 mm->context[i] = 0;
236 mm->context[i] = 0;
237 if (tsk != current) 236 if (tsk != current)
238 task_thread_info(tsk)->pcb.ptbr 237 task_thread_info(tsk)->pcb.ptbr
239 = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT; 238 = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h
index a011ef4cf3d3..192d80c875b0 100644
--- a/include/asm-alpha/mmzone.h
+++ b/include/asm-alpha/mmzone.h
@@ -59,9 +59,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
59#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) 59#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr))
60#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 60#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
61 61
62#define local_mapnr(kvaddr) \
63 ((__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)))
64
65/* 62/*
66 * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory 63 * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory
67 * and returns the kaddr corresponding to first physical page in the 64 * and returns the kaddr corresponding to first physical page in the
@@ -86,8 +83,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
86 pte_t pte; \ 83 pte_t pte; \
87 unsigned long pfn; \ 84 unsigned long pfn; \
88 \ 85 \
89 pfn = ((unsigned long)((page)-page_zone(page)->zone_mem_map)) << 32; \ 86 pfn = page_to_pfn(page) << 32; \
90 pfn += page_zone(page)->zone_start_pfn << 32; \
91 pte_val(pte) = pfn | pgprot_val(pgprot); \ 87 pte_val(pte) = pfn | pgprot_val(pgprot); \
92 \ 88 \
93 pte; \ 89 pte; \
@@ -104,19 +100,8 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
104 __xx; \ 100 __xx; \
105}) 101})
106 102
107#define pfn_to_page(pfn) \
108({ \
109 unsigned long kaddr = (unsigned long)__va((pfn) << PAGE_SHIFT); \
110 (NODE_DATA(kvaddr_to_nid(kaddr))->node_mem_map + local_mapnr(kaddr)); \
111})
112
113#define page_to_pfn(page) \
114 ((page) - page_zone(page)->zone_mem_map + \
115 (page_zone(page)->zone_start_pfn))
116
117#define page_to_pa(page) \ 103#define page_to_pa(page) \
118 ((( (page) - page_zone(page)->zone_mem_map ) \ 104 (page_to_pfn(page) << PAGE_SHIFT)
119 + page_zone(page)->zone_start_pfn) << PAGE_SHIFT)
120 105
121#define pfn_to_nid(pfn) pa_to_nid(((u64)(pfn) << PAGE_SHIFT)) 106#define pfn_to_nid(pfn) pa_to_nid(((u64)(pfn) << PAGE_SHIFT))
122#define pfn_valid(pfn) \ 107#define pfn_valid(pfn) \
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h
index fa0b41b164a7..61bcf70b5eac 100644
--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -85,8 +85,6 @@ typedef unsigned long pgprot_t;
85#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 85#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
86#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 86#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
87#ifndef CONFIG_DISCONTIGMEM 87#ifndef CONFIG_DISCONTIGMEM
88#define pfn_to_page(pfn) (mem_map + (pfn))
89#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
90#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 88#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
91 89
92#define pfn_valid(pfn) ((pfn) < max_mapnr) 90#define pfn_valid(pfn) ((pfn) < max_mapnr)
@@ -95,9 +93,9 @@ typedef unsigned long pgprot_t;
95 93
96#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 94#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
97 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 95 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
98
99#endif /* __KERNEL__ */ 96#endif /* __KERNEL__ */
100 97
98#include <asm-generic/memory_model.h>
101#include <asm-generic/page.h> 99#include <asm-generic/page.h>
102 100
103#endif /* _ALPHA_PAGE_H */ 101#endif /* _ALPHA_PAGE_H */
diff --git a/include/asm-alpha/poll.h b/include/asm-alpha/poll.h
index 34f333b762a0..76f89356b6a7 100644
--- a/include/asm-alpha/poll.h
+++ b/include/asm-alpha/poll.h
@@ -12,7 +12,9 @@
12#define POLLWRNORM (1 << 8) 12#define POLLWRNORM (1 << 8)
13#define POLLWRBAND (1 << 9) 13#define POLLWRBAND (1 << 9)
14#define POLLMSG (1 << 10) 14#define POLLMSG (1 << 10)
15#define POLLREMOVE (1 << 11) 15#define POLLREMOVE (1 << 12)
16#define POLLRDHUP (1 << 13)
17
16 18
17struct pollfd { 19struct pollfd {
18 int fd; 20 int fd;
diff --git a/include/asm-alpha/topology.h b/include/asm-alpha/topology.h
index eb740e280d9c..420ccde6b916 100644
--- a/include/asm-alpha/topology.h
+++ b/include/asm-alpha/topology.h
@@ -27,8 +27,8 @@ static inline cpumask_t node_to_cpumask(int node)
27 cpumask_t node_cpu_mask = CPU_MASK_NONE; 27 cpumask_t node_cpu_mask = CPU_MASK_NONE;
28 int cpu; 28 int cpu;
29 29
30 for(cpu = 0; cpu < NR_CPUS; cpu++) { 30 for_each_online_cpu(cpu) {
31 if (cpu_online(cpu) && (cpu_to_node(cpu) == node)) 31 if (cpu_to_node(cpu) == node)
32 cpu_set(cpu, node_cpu_mask); 32 cpu_set(cpu, node_cpu_mask);
33 } 33 }
34 34
diff --git a/include/asm-arm/arch-aaec2000/param.h b/include/asm-arm/arch-aaec2000/param.h
deleted file mode 100644
index 139936c2faf2..000000000000
--- a/include/asm-arm/arch-aaec2000/param.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-aaec2000/param.h
3 *
4 * Copyright (c) 2005 Nicolas Bellido Y Ortega
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#ifndef __ASM_ARCH_PARAM_H
12#define __ASM_ARCH_PARAM_H
13
14#endif /* __ASM_ARCH_PARAM_H */
15
diff --git a/include/asm-arm/arch-aaec2000/uncompress.h b/include/asm-arm/arch-aaec2000/uncompress.h
index fff0c94b75c4..300f4bf3bc74 100644
--- a/include/asm-arm/arch-aaec2000/uncompress.h
+++ b/include/asm-arm/arch-aaec2000/uncompress.h
@@ -15,7 +15,7 @@
15 15
16#define UART(x) (*(volatile unsigned long *)(serial_port + (x))) 16#define UART(x) (*(volatile unsigned long *)(serial_port + (x)))
17 17
18static void putstr( const char *s ) 18static void putc(int c)
19{ 19{
20 unsigned long serial_port; 20 unsigned long serial_port;
21 do { 21 do {
@@ -28,17 +28,16 @@ static void putstr( const char *s )
28 return; 28 return;
29 } while (0); 29 } while (0);
30 30
31 for (; *s; s++) { 31 /* wait for space in the UART's transmitter */
32 /* wait for space in the UART's transmitter */ 32 while ((UART(UART_SR) & UART_SR_TxFF))
33 while ((UART(UART_SR) & UART_SR_TxFF)); 33 barrier();
34 /* send the character out. */ 34
35 UART(UART_DR) = *s; 35 /* send the character out. */
36 /* if a LF, also do CR... */ 36 UART(UART_DR) = c;
37 if (*s == 10) { 37}
38 while ((UART(UART_SR) & UART_SR_TxFF)); 38
39 UART(UART_DR) = 13; 39static inline void flush(void)
40 } 40{
41 }
42} 41}
43 42
44#define arch_decomp_setup() 43#define arch_decomp_setup()
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_emac.h b/include/asm-arm/arch-at91rm9200/at91rm9200_emac.h
new file mode 100644
index 000000000000..fbc091e61e2f
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_emac.h
@@ -0,0 +1,138 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_emac.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Ethernet MAC 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_EMAC_H
17#define AT91RM9200_EMAC_H
18
19#define AT91_EMAC_CTL 0x00 /* Control Register */
20#define AT91_EMAC_LB (1 << 0) /* Loopback */
21#define AT91_EMAC_LBL (1 << 1) /* Loopback Local */
22#define AT91_EMAC_RE (1 << 2) /* Receive Enable */
23#define AT91_EMAC_TE (1 << 3) /* Transmit Enable */
24#define AT91_EMAC_MPE (1 << 4) /* Management Port Enable */
25#define AT91_EMAC_CSR (1 << 5) /* Clear Statistics Registers */
26#define AT91_EMAC_INCSTAT (1 << 6) /* Increment Statistics Registers */
27#define AT91_EMAC_WES (1 << 7) /* Write Enable for Statistics Registers */
28#define AT91_EMAC_BP (1 << 8) /* Back Pressure */
29
30#define AT91_EMAC_CFG 0x04 /* Configuration Register */
31#define AT91_EMAC_SPD (1 << 0) /* Speed */
32#define AT91_EMAC_FD (1 << 1) /* Full Duplex */
33#define AT91_EMAC_BR (1 << 2) /* Bit Rate */
34#define AT91_EMAC_CAF (1 << 4) /* Copy All Frames */
35#define AT91_EMAC_NBC (1 << 5) /* No Broadcast */
36#define AT91_EMAC_MTI (1 << 6) /* Multicast Hash Enable */
37#define AT91_EMAC_UNI (1 << 7) /* Unicast Hash Enable */
38#define AT91_EMAC_BIG (1 << 8) /* Receive 1522 Bytes */
39#define AT91_EMAC_EAE (1 << 9) /* External Address Match Enable */
40#define AT91_EMAC_CLK (3 << 10) /* MDC Clock Divisor */
41#define AT91_EMAC_CLK_DIV8 (0 << 10)
42#define AT91_EMAC_CLK_DIV16 (1 << 10)
43#define AT91_EMAC_CLK_DIV32 (2 << 10)
44#define AT91_EMAC_CLK_DIV64 (3 << 10)
45#define AT91_EMAC_RTY (1 << 12) /* Retry Test */
46#define AT91_EMAC_RMII (1 << 13) /* Reduce MII (RMII) */
47
48#define AT91_EMAC_SR 0x08 /* Status Register */
49#define AT91_EMAC_SR_LINK (1 << 0) /* Link */
50#define AT91_EMAC_SR_MDIO (1 << 1) /* MDIO pin */
51#define AT91_EMAC_SR_IDLE (1 << 2) /* PHY idle */
52
53#define AT91_EMAC_TAR 0x0c /* Transmit Address Register */
54
55#define AT91_EMAC_TCR 0x10 /* Transmit Control Register */
56#define AT91_EMAC_LEN (0x7ff << 0) /* Transmit Frame Length */
57#define AT91_EMAC_NCRC (1 << 15) /* No CRC */
58
59#define AT91_EMAC_TSR 0x14 /* Transmit Status Register */
60#define AT91_EMAC_TSR_OVR (1 << 0) /* Transmit Buffer Overrun */
61#define AT91_EMAC_TSR_COL (1 << 1) /* Collision Occurred */
62#define AT91_EMAC_TSR_RLE (1 << 2) /* Retry Limit Exceeded */
63#define AT91_EMAC_TSR_IDLE (1 << 3) /* Transmitter Idle */
64#define AT91_EMAC_TSR_BNQ (1 << 4) /* Transmit Buffer not Queued */
65#define AT91_EMAC_TSR_COMP (1 << 5) /* Transmit Complete */
66#define AT91_EMAC_TSR_UND (1 << 6) /* Transmit Underrun */
67
68#define AT91_EMAC_RBQP 0x18 /* Receive Buffer Queue Pointer */
69
70#define AT91_EMAC_RSR 0x20 /* Receive Status Register */
71#define AT91_EMAC_RSR_BNA (1 << 0) /* Buffer Not Available */
72#define AT91_EMAC_RSR_REC (1 << 1) /* Frame Received */
73#define AT91_EMAC_RSR_OVR (1 << 2) /* RX Overrun */
74
75#define AT91_EMAC_ISR 0x24 /* Interrupt Status Register */
76#define AT91_EMAC_DONE (1 << 0) /* Management Done */
77#define AT91_EMAC_RCOM (1 << 1) /* Receive Complete */
78#define AT91_EMAC_RBNA (1 << 2) /* Receive Buffer Not Available */
79#define AT91_EMAC_TOVR (1 << 3) /* Transmit Buffer Overrun */
80#define AT91_EMAC_TUND (1 << 4) /* Transmit Buffer Underrun */
81#define AT91_EMAC_RTRY (1 << 5) /* Retry Limit */
82#define AT91_EMAC_TBRE (1 << 6) /* Transmit Buffer Register Empty */
83#define AT91_EMAC_TCOM (1 << 7) /* Transmit Complete */
84#define AT91_EMAC_TIDLE (1 << 8) /* Transmit Idle */
85#define AT91_EMAC_LINK (1 << 9) /* Link */
86#define AT91_EMAC_ROVR (1 << 10) /* RX Overrun */
87#define AT91_EMAC_ABT (1 << 11) /* Abort */
88
89#define AT91_EMAC_IER 0x28 /* Interrupt Enable Register */
90#define AT91_EMAC_IDR 0x2c /* Interrupt Disable Register */
91#define AT91_EMAC_IMR 0x30 /* Interrupt Mask Register */
92
93#define AT91_EMAC_MAN 0x34 /* PHY Maintenance Register */
94#define AT91_EMAC_DATA (0xffff << 0) /* MDIO Data */
95#define AT91_EMAC_REGA (0x1f << 18) /* MDIO Register */
96#define AT91_EMAC_PHYA (0x1f << 23) /* MDIO PHY Address */
97#define AT91_EMAC_RW (3 << 28) /* Read/Write operation */
98#define AT91_EMAC_RW_W (1 << 28)
99#define AT91_EMAC_RW_R (2 << 28)
100#define AT91_EMAC_MAN_802_3 0x40020000 /* IEEE 802.3 value */
101
102/*
103 * Statistics Registers.
104 */
105#define AT91_EMAC_FRA 0x40 /* Frames Transmitted OK */
106#define AT91_EMAC_SCOL 0x44 /* Single Collision Frame */
107#define AT91_EMAC_MCOL 0x48 /* Multiple Collision Frame */
108#define AT91_EMAC_OK 0x4c /* Frames Received OK */
109#define AT91_EMAC_SEQE 0x50 /* Frame Check Sequence Error */
110#define AT91_EMAC_ALE 0x54 /* Alignmemt Error */
111#define AT91_EMAC_DTE 0x58 /* Deffered Transmission Frame */
112#define AT91_EMAC_LCOL 0x5c /* Late Collision */
113#define AT91_EMAC_ECOL 0x60 /* Excessive Collision */
114#define AT91_EMAC_TUE 0x64 /* Transmit Underrun Error */
115#define AT91_EMAC_CSE 0x68 /* Carrier Sense Error */
116#define AT91_EMAC_DRFC 0x6c /* Discard RX Frame */
117#define AT91_EMAC_ROV 0x70 /* Receive Overrun */
118#define AT91_EMAC_CDE 0x74 /* Code Error */
119#define AT91_EMAC_ELR 0x78 /* Excessive Length Error */
120#define AT91_EMAC_RJB 0x7c /* Receive Jabber */
121#define AT91_EMAC_USF 0x80 /* Undersize Frame */
122#define AT91_EMAC_SQEE 0x84 /* SQE Test Error */
123
124/*
125 * Address Registers.
126 */
127#define AT91_EMAC_HSL 0x90 /* Hash Address Low [31:0] */
128#define AT91_EMAC_HSH 0x94 /* Hash Address High [63:32] */
129#define AT91_EMAC_SA1L 0x98 /* Specific Address 1 Low, bytes 0-3 */
130#define AT91_EMAC_SA1H 0x9c /* Specific Address 1 High, bytes 4-5 */
131#define AT91_EMAC_SA2L 0xa0 /* Specific Address 2 Low, bytes 0-3 */
132#define AT91_EMAC_SA2H 0xa4 /* Specific Address 2 High, bytes 4-5 */
133#define AT91_EMAC_SA3L 0xa8 /* Specific Address 3 Low, bytes 0-3 */
134#define AT91_EMAC_SA3H 0xac /* Specific Address 3 High, bytes 4-5 */
135#define AT91_EMAC_SA4L 0xb0 /* Specific Address 4 Low, bytes 0-3 */
136#define AT91_EMAC_SA4H 0xb4 /* Specific Address 4 High, bytes 4-5 */
137
138#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h b/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
index 9bfffdbf1e0b..2910d359f919 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
@@ -172,6 +172,7 @@
172#define AT91_PMC_MDIV_4 (3 << 8) 172#define AT91_PMC_MDIV_4 (3 << 8)
173 173
174#define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-3 Registers */ 174#define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-3 Registers */
175
175#define AT91_PMC_IER (AT91_PMC + 0x60) /* Interrupt Enable Register */ 176#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_IDR (AT91_PMC + 0x64) /* Interrupt Disable Register */
177#define AT91_PMC_SR (AT91_PMC + 0x68) /* Status Register */ 178#define AT91_PMC_SR (AT91_PMC + 0x68) /* Status Register */
@@ -286,8 +287,32 @@
286#define AT91_MC_RCB (1 << 0) /* Remap Command Bit */ 287#define AT91_MC_RCB (1 << 0) /* Remap Command Bit */
287 288
288#define AT91_MC_ASR (AT91_MC + 0x04) /* MC Abort Status Register */ 289#define AT91_MC_ASR (AT91_MC + 0x04) /* MC Abort Status Register */
290#define AT91_MC_UNADD (1 << 0) /* Undefined Address Abort Status */
291#define AT91_MC_MISADD (1 << 1) /* Misaligned Address Abort Status */
292#define AT91_MC_ABTSZ (3 << 8) /* Abort Size Status */
293#define AT91_MC_ABTSZ_BYTE (0 << 8)
294#define AT91_MC_ABTSZ_HALFWORD (1 << 8)
295#define AT91_MC_ABTSZ_WORD (2 << 8)
296#define AT91_MC_ABTTYP (3 << 10) /* Abort Type Status */
297#define AT91_MC_ABTTYP_DATAREAD (0 << 10)
298#define AT91_MC_ABTTYP_DATAWRITE (1 << 10)
299#define AT91_MC_ABTTYP_FETCH (2 << 10)
300#define AT91_MC_MST0 (1 << 16) /* ARM920T Abort Source */
301#define AT91_MC_MST1 (1 << 17) /* PDC Abort Source */
302#define AT91_MC_MST2 (1 << 18) /* UHP Abort Source */
303#define AT91_MC_MST3 (1 << 19) /* EMAC Abort Source */
304#define AT91_MC_SVMST0 (1 << 24) /* Saved ARM920T Abort Source */
305#define AT91_MC_SVMST1 (1 << 25) /* Saved PDC Abort Source */
306#define AT91_MC_SVMST2 (1 << 26) /* Saved UHP Abort Source */
307#define AT91_MC_SVMST3 (1 << 27) /* Saved EMAC Abort Source */
308
289#define AT91_MC_AASR (AT91_MC + 0x08) /* MC Abort Address Status Register */ 309#define AT91_MC_AASR (AT91_MC + 0x08) /* MC Abort Address Status Register */
310
290#define AT91_MC_MPR (AT91_MC + 0x0c) /* MC Master Priority Register */ 311#define AT91_MC_MPR (AT91_MC + 0x0c) /* MC Master Priority Register */
312#define AT91_MPR_MSTP0 (7 << 0) /* ARM920T Priority */
313#define AT91_MPR_MSTP1 (7 << 4) /* PDC Priority */
314#define AT91_MPR_MSTP2 (7 << 8) /* UHP Priority */
315#define AT91_MPR_MSTP3 (7 << 12) /* EMAC Priority */
291 316
292/* External Bus Interface (EBI) registers */ 317/* External Bus Interface (EBI) registers */
293#define AT91_EBI_CSA (AT91_MC + 0x60) /* Chip Select Assignment Register */ 318#define AT91_EBI_CSA (AT91_MC + 0x60) /* Chip Select Assignment Register */
@@ -309,8 +334,10 @@
309/* Static Memory Controller (SMC) registers */ 334/* Static Memory Controller (SMC) registers */
310#define AT91_SMC_CSR(n) (AT91_MC + 0x70 + ((n) * 4))/* SMC Chip Select Register */ 335#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 */ 336#define AT91_SMC_NWS (0x7f << 0) /* Number of Wait States */
337#define AT91_SMC_NWS_(x) ((x) << 0)
312#define AT91_SMC_WSEN (1 << 7) /* Wait State Enable */ 338#define AT91_SMC_WSEN (1 << 7) /* Wait State Enable */
313#define AT91_SMC_TDF (0xf << 8) /* Data Float Time */ 339#define AT91_SMC_TDF (0xf << 8) /* Data Float Time */
340#define AT91_SMC_TDF_(x) ((x) << 8)
314#define AT91_SMC_BAT (1 << 12) /* Byte Access Type */ 341#define AT91_SMC_BAT (1 << 12) /* Byte Access Type */
315#define AT91_SMC_DBW (3 << 13) /* Data Bus Width */ 342#define AT91_SMC_DBW (3 << 13) /* Data Bus Width */
316#define AT91_SMC_DBW_16 (1 << 13) 343#define AT91_SMC_DBW_16 (1 << 13)
@@ -322,7 +349,78 @@
322#define AT91_SMC_ACSS_2 (2 << 16) 349#define AT91_SMC_ACSS_2 (2 << 16)
323#define AT91_SMC_ACSS_3 (3 << 16) 350#define AT91_SMC_ACSS_3 (3 << 16)
324#define AT91_SMC_RWSETUP (7 << 24) /* Read & Write Signal Time Setup */ 351#define AT91_SMC_RWSETUP (7 << 24) /* Read & Write Signal Time Setup */
352#define AT91_SMC_RWSETUP_(x) ((x) << 24)
325#define AT91_SMC_RWHOLD (7 << 28) /* Read & Write Signal Hold Time */ 353#define AT91_SMC_RWHOLD (7 << 28) /* Read & Write Signal Hold Time */
326 354#define AT91_SMC_RWHOLD_(x) ((x) << 28)
355
356/* SDRAM Controller registers */
357#define AT91_SDRAMC_MR (AT91_MC + 0x90) /* Mode Register */
358#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
359#define AT91_SDRAMC_MODE_NORMAL (0 << 0)
360#define AT91_SDRAMC_MODE_NOP (1 << 0)
361#define AT91_SDRAMC_MODE_PRECHARGE (2 << 0)
362#define AT91_SDRAMC_MODE_LMR (3 << 0)
363#define AT91_SDRAMC_MODE_REFRESH (4 << 0)
364#define AT91_SDRAMC_DBW (1 << 4) /* Data Bus Width */
365#define AT91_SDRAMC_DBW_32 (0 << 4)
366#define AT91_SDRAMC_DBW_16 (1 << 4)
367
368#define AT91_SDRAMC_TR (AT91_MC + 0x94) /* Refresh Timer Register */
369#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Count */
370
371#define AT91_SDRAMC_CR (AT91_MC + 0x98) /* Configuration Register */
372#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
373#define AT91_SDRAMC_NC_8 (0 << 0)
374#define AT91_SDRAMC_NC_9 (1 << 0)
375#define AT91_SDRAMC_NC_10 (2 << 0)
376#define AT91_SDRAMC_NC_11 (3 << 0)
377#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
378#define AT91_SDRAMC_NR_11 (0 << 2)
379#define AT91_SDRAMC_NR_12 (1 << 2)
380#define AT91_SDRAMC_NR_13 (2 << 2)
381#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
382#define AT91_SDRAMC_NB_2 (0 << 4)
383#define AT91_SDRAMC_NB_4 (1 << 4)
384#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
385#define AT91_SDRAMC_CAS_2 (2 << 5)
386#define AT91_SDRAMC_TWR (0xf << 7) /* Write Recovery Delay */
387#define AT91_SDRAMC_TRC (0xf << 11) /* Row Cycle Delay */
388#define AT91_SDRAMC_TRP (0xf << 15) /* Row Precharge Delay */
389#define AT91_SDRAMC_TRCD (0xf << 19) /* Row to Column Delay */
390#define AT91_SDRAMC_TRAS (0xf << 23) /* Active to Precharge Delay */
391#define AT91_SDRAMC_TXSR (0xf << 27) /* Exit Self Refresh to Active Delay */
392
393#define AT91_SDRAMC_SRR (AT91_MC + 0x9c) /* Self Refresh Register */
394#define AT91_SDRAMC_LPR (AT91_MC + 0xa0) /* Low Power Register */
395#define AT91_SDRAMC_IER (AT91_MC + 0xa4) /* Interrupt Enable Register */
396#define AT91_SDRAMC_IDR (AT91_MC + 0xa8) /* Interrupt Disable Register */
397#define AT91_SDRAMC_IMR (AT91_MC + 0xac) /* Interrupt Mask Register */
398#define AT91_SDRAMC_ISR (AT91_MC + 0xb0) /* Interrupt Status Register */
399
400/* Burst Flash Controller register */
401#define AT91_BFC_MR (AT91_MC + 0xc0) /* Mode Register */
402#define AT91_BFC_BFCOM (3 << 0) /* Burst Flash Controller Operating Mode */
403#define AT91_BFC_BFCOM_DISABLED (0 << 0)
404#define AT91_BFC_BFCOM_ASYNC (1 << 0)
405#define AT91_BFC_BFCOM_BURST (2 << 0)
406#define AT91_BFC_BFCC (3 << 2) /* Burst Flash Controller Clock */
407#define AT91_BFC_BFCC_MCK (1 << 2)
408#define AT91_BFC_BFCC_DIV2 (2 << 2)
409#define AT91_BFC_BFCC_DIV4 (3 << 2)
410#define AT91_BFC_AVL (0xf << 4) /* Address Valid Latency */
411#define AT91_BFC_PAGES (7 << 8) /* Page Size */
412#define AT91_BFC_PAGES_NO_PAGE (0 << 8)
413#define AT91_BFC_PAGES_16 (1 << 8)
414#define AT91_BFC_PAGES_32 (2 << 8)
415#define AT91_BFC_PAGES_64 (3 << 8)
416#define AT91_BFC_PAGES_128 (4 << 8)
417#define AT91_BFC_PAGES_256 (5 << 8)
418#define AT91_BFC_PAGES_512 (6 << 8)
419#define AT91_BFC_PAGES_1024 (7 << 8)
420#define AT91_BFC_OEL (3 << 12) /* Output Enable Latency */
421#define AT91_BFC_BAAEN (1 << 16) /* Burst Address Advance Enable */
422#define AT91_BFC_BFOEH (1 << 17) /* Burst Flash Output Enable Handling */
423#define AT91_BFC_MUXEN (1 << 18) /* Multiplexed Bus Enable */
424#define AT91_BFC_RDYEN (1 << 19) /* Ready Enable Mode */
327 425
328#endif 426#endif
diff --git a/include/asm-arm/arch-at91rm9200/param.h b/include/asm-arm/arch-at91rm9200/param.h
deleted file mode 100644
index 9480f8446852..000000000000
--- a/include/asm-arm/arch-at91rm9200/param.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * include/asm-arm/arch-at91rm9200/param.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_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/uncompress.h b/include/asm-arm/arch-at91rm9200/uncompress.h
index b30dd5520713..7b38497c24b5 100644
--- a/include/asm-arm/arch-at91rm9200/uncompress.h
+++ b/include/asm-arm/arch-at91rm9200/uncompress.h
@@ -31,21 +31,22 @@
31 * 31 *
32 * This does not append a newline 32 * This does not append a newline
33 */ 33 */
34static void putstr(const char *s) 34static void putc(int c)
35{
36 void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */
37
38 while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY))
39 barrier();
40 __raw_writel(c, sys + AT91_DBGU_THR);
41}
42
43static inline void flush(void)
35{ 44{
36 void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */ 45 void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */
37 46
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 */ 47 /* wait for transmission to complete */
48 while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXEMPTY)) { barrier(); } 48 while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXEMPTY))
49 barrier();
49} 50}
50 51
51#define arch_decomp_setup() 52#define arch_decomp_setup()
diff --git a/include/asm-arm/arch-cl7500/debug-macro.S b/include/asm-arm/arch-cl7500/debug-macro.S
index a5d489d7955a..9a2b67d24098 100644
--- a/include/asm-arm/arch-cl7500/debug-macro.S
+++ b/include/asm-arm/arch-cl7500/debug-macro.S
@@ -17,15 +17,5 @@
17 orr \rx, \rx, #0x00000be0 17 orr \rx, \rx, #0x00000be0
18 .endm 18 .endm
19 19
20 .macro senduart,rd,rx 20#define UART_SHIFT 2
21 strb \rd, [\rx] 21#include <asm/hardware/debug-8250.S>
22 .endm
23
24 .macro busyuart,rd,rx
25 .endm
26
27 .macro waituart,rd,rx
281001: ldrb \rd, [\rx, #0x14]
29 tst \rd, #0x20
30 beq 1001b
31 .endm
diff --git a/include/asm-arm/arch-cl7500/param.h b/include/asm-arm/arch-cl7500/param.h
deleted file mode 100644
index 974bf69fbb1a..000000000000
--- a/include/asm-arm/arch-cl7500/param.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-cl7500/param.h
3 *
4 * Copyright (C) 1999 Nexus Electronics Ltd
5 */
diff --git a/include/asm-arm/arch-cl7500/uncompress.h b/include/asm-arm/arch-cl7500/uncompress.h
index 68601b3e3b95..c437e0c88c3f 100644
--- a/include/asm-arm/arch-cl7500/uncompress.h
+++ b/include/asm-arm/arch-cl7500/uncompress.h
@@ -3,27 +3,19 @@
3 * 3 *
4 * Copyright (C) 1999, 2000 Nexus Electronics Ltd. 4 * Copyright (C) 1999, 2000 Nexus Electronics Ltd.
5 */ 5 */
6
7#define BASE 0x03010000 6#define BASE 0x03010000
8#define SERBASE (BASE + (0x2f8 << 2)) 7#define SERBASE (BASE + (0x2f8 << 2))
9 8
10static __inline__ void putc(char c) 9static inline void putc(char c)
11{ 10{
12 while (!(*((volatile unsigned int *)(SERBASE + 0x14)) & 0x20)); 11 while (!(*((volatile unsigned int *)(SERBASE + 0x14)) & 0x20))
12 barrier();
13
13 *((volatile unsigned int *)(SERBASE)) = c; 14 *((volatile unsigned int *)(SERBASE)) = c;
14} 15}
15 16
16/* 17static inline void flush(void)
17 * This does not append a newline
18 */
19static void putstr(const char *s)
20{ 18{
21 while (*s) {
22 putc(*s);
23 if (*s == '\n')
24 putc('\r');
25 s++;
26 }
27} 19}
28 20
29static __inline__ void arch_decomp_setup(void) 21static __inline__ void arch_decomp_setup(void)
diff --git a/include/asm-arm/arch-clps711x/param.h b/include/asm-arm/arch-clps711x/param.h
deleted file mode 100644
index 86f6bd29623d..000000000000
--- a/include/asm-arm/arch-clps711x/param.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-clps711x/param.h
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd.
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 */
diff --git a/include/asm-arm/arch-clps711x/uncompress.h b/include/asm-arm/arch-clps711x/uncompress.h
index 9fc4bcfa1681..07157b7e4b20 100644
--- a/include/asm-arm/arch-clps711x/uncompress.h
+++ b/include/asm-arm/arch-clps711x/uncompress.h
@@ -25,7 +25,6 @@
25#undef CLPS7111_BASE 25#undef CLPS7111_BASE
26#define CLPS7111_BASE CLPS7111_PHYS_BASE 26#define CLPS7111_BASE CLPS7111_PHYS_BASE
27 27
28#define barrier() __asm__ __volatile__("": : :"memory")
29#define __raw_readl(p) (*(unsigned long *)(p)) 28#define __raw_readl(p) (*(unsigned long *)(p))
30#define __raw_writel(v,p) (*(unsigned long *)(p) = (v)) 29#define __raw_writel(v,p) (*(unsigned long *)(p) = (v))
31 30
@@ -40,21 +39,15 @@
40/* 39/*
41 * This does not append a newline 40 * This does not append a newline
42 */ 41 */
43static void putstr(const char *s) 42static inline void putc(int c)
44{ 43{
45 char c; 44 while (clps_readl(SYSFLGx) & SYSFLG_UTXFF)
46 45 barrier();
47 while ((c = *s++) != '\0') { 46 clps_writel(c, UARTDRx);
48 while (clps_readl(SYSFLGx) & SYSFLG_UTXFF) 47}
49 barrier();
50 clps_writel(c, UARTDRx);
51 48
52 if (c == '\n') { 49static inline void flush(void)
53 while (clps_readl(SYSFLGx) & SYSFLG_UTXFF) 50{
54 barrier();
55 clps_writel('\r', UARTDRx);
56 }
57 }
58 while (clps_readl(SYSFLGx) & SYSFLG_UBUSY) 51 while (clps_readl(SYSFLGx) & SYSFLG_UBUSY)
59 barrier(); 52 barrier();
60} 53}
diff --git a/include/asm-arm/arch-ebsa110/debug-macro.S b/include/asm-arm/arch-ebsa110/debug-macro.S
index dcd03a40c502..f61cadabe0ec 100644
--- a/include/asm-arm/arch-ebsa110/debug-macro.S
+++ b/include/asm-arm/arch-ebsa110/debug-macro.S
@@ -16,19 +16,6 @@
16 orr \rx, \rx, #0x00000be0 16 orr \rx, \rx, #0x00000be0
17 .endm 17 .endm
18 18
19 .macro senduart,rd,rx 19#define UART_SHIFT 2
20 strb \rd, [\rx] 20#define FLOW_CONTROL
21 .endm 21#include <asm/hardware/debug-8250.h>
22
23 .macro busyuart,rd,rx
241002: ldrb \rd, [\rx, #0x14]
25 and \rd, \rd, #0x60
26 teq \rd, #0x60
27 bne 1002b
28 .endm
29
30 .macro waituart,rd,rx
311001: ldrb \rd, [\rx, #0x18]
32 tst \rd, #0x10
33 beq 1001b
34 .endm
diff --git a/include/asm-arm/arch-ebsa110/param.h b/include/asm-arm/arch-ebsa110/param.h
deleted file mode 100644
index be19b08d1c75..000000000000
--- a/include/asm-arm/arch-ebsa110/param.h
+++ /dev/null
@@ -1,4 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-ebsa110/param.h
3 */
4#define HZ 200
diff --git a/include/asm-arm/arch-ebsa110/uncompress.h b/include/asm-arm/arch-ebsa110/uncompress.h
index eee95581a923..66b19c7fd908 100644
--- a/include/asm-arm/arch-ebsa110/uncompress.h
+++ b/include/asm-arm/arch-ebsa110/uncompress.h
@@ -8,33 +8,34 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/serial_reg.h>
12
13#define SERIAL_BASE ((unsigned char *)0xfe000be0)
14
11/* 15/*
12 * This does not append a newline 16 * This does not append a newline
13 */ 17 */
14static void putstr(const char *s) 18static inline void putc(int c)
19{
20 unsigned char v, *base = SERIAL_BASE;
21
22 do {
23 v = base[UART_LSR << 2];
24 barrier();
25 } while (!(v & UART_LSR_THRE));
26
27 base[UART_TX << 2] = c;
28}
29
30static inline void flush(void)
15{ 31{
16 unsigned long tmp1, tmp2; 32 unsigned char v, *base = SERIAL_BASE;
17 __asm__ __volatile__( 33
18 "ldrb %0, [%2], #1\n" 34 do {
19" teq %0, #0\n" 35 v = base[UART_LSR << 2];
20" beq 3f\n" 36 barrier();
21"1: strb %0, [%3]\n" 37 } while ((v & (UART_LSR_TEMT|UART_LSR_THRE)) !=
22"2: ldrb %1, [%3, #0x14]\n" 38 (UART_LSR_TEMT|UART_LSR_THRE));
23" and %1, %1, #0x60\n"
24" teq %1, #0x60\n"
25" bne 2b\n"
26" teq %0, #'\n'\n"
27" moveq %0, #'\r'\n"
28" beq 1b\n"
29" ldrb %0, [%2], #1\n"
30" teq %0, #0\n"
31" bne 1b\n"
32"3: ldrb %1, [%3, #0x14]\n"
33" and %1, %1, #0x60\n"
34" teq %1, #0x60\n"
35" bne 3b"
36 : "=&r" (tmp1), "=&r" (tmp2)
37 : "r" (s), "r" (0xf0000be0) : "cc");
38} 39}
39 40
40/* 41/*
diff --git a/include/asm-arm/arch-ebsa285/debug-macro.S b/include/asm-arm/arch-ebsa285/debug-macro.S
index 97d15fc629af..b48cec4a0c45 100644
--- a/include/asm-arm/arch-ebsa285/debug-macro.S
+++ b/include/asm-arm/arch-ebsa285/debug-macro.S
@@ -23,22 +23,10 @@
23 orr \rx, \rx, #0x000003f8 23 orr \rx, \rx, #0x000003f8
24 .endm 24 .endm
25 25
26 .macro senduart,rd,rx 26#define UART_SHIFT 0
27 strb \rd, [\rx] 27#define FLOW_CONTROL
28 .endm 28#include <asm/hardware/debug-8250.S>
29 29
30 .macro busyuart,rd,rx
311002: ldrb \rd, [\rx, #0x5]
32 and \rd, \rd, #0x60
33 teq \rd, #0x60
34 bne 1002b
35 .endm
36
37 .macro waituart,rd,rx
381001: ldrb \rd, [\rx, #0x6]
39 tst \rd, #0x10
40 beq 1001b
41 .endm
42#else 30#else
43 /* For EBSA285 debugging */ 31 /* For EBSA285 debugging */
44 .equ dc21285_high, ARMCSR_BASE & 0xff000000 32 .equ dc21285_high, ARMCSR_BASE & 0xff000000
diff --git a/include/asm-arm/arch-ebsa285/param.h b/include/asm-arm/arch-ebsa285/param.h
deleted file mode 100644
index 3827103b27a0..000000000000
--- a/include/asm-arm/arch-ebsa285/param.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-ebsa285/param.h
3 */
diff --git a/include/asm-arm/arch-ebsa285/uncompress.h b/include/asm-arm/arch-ebsa285/uncompress.h
index c2fd84e2d90e..86142c882b3a 100644
--- a/include/asm-arm/arch-ebsa285/uncompress.h
+++ b/include/asm-arm/arch-ebsa285/uncompress.h
@@ -15,10 +15,11 @@
15#define DC21285_BASE ((volatile unsigned int *)0x42000160) 15#define DC21285_BASE ((volatile unsigned int *)0x42000160)
16#define SER0_BASE ((volatile unsigned char *)0x7c0003f8) 16#define SER0_BASE ((volatile unsigned char *)0x7c0003f8)
17 17
18static __inline__ void putc(char c) 18static inline void putc(char c)
19{ 19{
20 if (machine_is_netwinder()) { 20 if (machine_is_netwinder()) {
21 while ((SER0_BASE[5] & 0x60) != 0x60); 21 while ((SER0_BASE[5] & 0x60) != 0x60)
22 barrier();
22 SER0_BASE[0] = c; 23 SER0_BASE[0] = c;
23 } else { 24 } else {
24 while (DC21285_BASE[6] & 8); 25 while (DC21285_BASE[6] & 8);
@@ -26,17 +27,8 @@ static __inline__ void putc(char c)
26 } 27 }
27} 28}
28 29
29/* 30static inline void flush(void)
30 * This does not append a newline
31 */
32static void putstr(const char *s)
33{ 31{
34 while (*s) {
35 putc(*s);
36 if (*s == '\n')
37 putc('\r');
38 s++;
39 }
40} 32}
41 33
42/* 34/*
diff --git a/include/asm-arm/arch-ep93xx/debug-macro.S b/include/asm-arm/arch-ep93xx/debug-macro.S
new file mode 100644
index 000000000000..397565a0c671
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/debug-macro.S
@@ -0,0 +1,22 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/debug-macro.S
3 * Debugging macro include header
4 *
5 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
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 (at
10 * your option) any later version.
11 */
12#include <asm/arch/ep93xx-regs.h>
13
14 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ MMU enabled?
17 ldreq \rx, =EP93XX_APB_PHYS_BASE @ Physical base
18 ldrne \rx, =EP93XX_APB_VIRT_BASE @ virtual base
19 orr \rx, \rx, #0x000c0000
20 .endm
21
22#include <asm/hardware/debug-pl01x.S>
diff --git a/include/asm-arm/arch-ep93xx/dma.h b/include/asm-arm/arch-ep93xx/dma.h
new file mode 100644
index 000000000000..898b3ab7fd46
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/dma.h
@@ -0,0 +1,3 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/dma.h
3 */
diff --git a/include/asm-arm/arch-ep93xx/entry-macro.S b/include/asm-arm/arch-ep93xx/entry-macro.S
new file mode 100644
index 000000000000..84140a28dfcf
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/entry-macro.S
@@ -0,0 +1,53 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/entry-macro.S
3 * IRQ demultiplexing for EP93xx
4 *
5 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
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 (at
10 * your option) any later version.
11 */
12#include <asm/arch/ep93xx-regs.h>
13
14 .macro disable_fiq
15 .endm
16
17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
18 ldr \base, =(EP93XX_AHB_VIRT_BASE)
19 orr \base, \base, #0x000b0000
20 mov \irqnr, #0
21 ldr \irqstat, [\base] @ lower 32 interrupts
22 cmp \irqstat, #0
23 bne 1001f
24
25 eor \base, \base, #0x00070000
26 ldr \irqstat, [\base] @ upper 32 interrupts
27 cmp \irqstat, #0
28 beq 1002f
29 mov \irqnr, #0x20
30
311001:
32 movs \tmp, \irqstat, lsl #16
33 movne \irqstat, \tmp
34 addeq \irqnr, \irqnr, #16
35
36 movs \tmp, \irqstat, lsl #8
37 movne \irqstat, \tmp
38 addeq \irqnr, \irqnr, #8
39
40 movs \tmp, \irqstat, lsl #4
41 movne \irqstat, \tmp
42 addeq \irqnr, \irqnr, #4
43
44 movs \tmp, \irqstat, lsl #2
45 movne \irqstat, \tmp
46 addeq \irqnr, \irqnr, #2
47
48 movs \tmp, \irqstat, lsl #1
49 addeq \irqnr, \irqnr, #1
50 orrs \base, \base, #1
51
521002:
53 .endm
diff --git a/include/asm-arm/arch-ep93xx/ep93xx-regs.h b/include/asm-arm/arch-ep93xx/ep93xx-regs.h
new file mode 100644
index 000000000000..71cea0b5841b
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/ep93xx-regs.h
@@ -0,0 +1,125 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/ep93xx-regs.h
3 */
4
5#ifndef __ASM_ARCH_EP93XX_REGS_H
6#define __ASM_ARCH_EP93XX_REGS_H
7
8/*
9 * EP93xx linux memory map:
10 *
11 * virt phys size
12 * fe800000 5M per-platform mappings
13 * fed00000 80800000 2M APB
14 * fef00000 80000000 1M AHB
15 */
16
17#define EP93XX_AHB_PHYS_BASE 0x80000000
18#define EP93XX_AHB_VIRT_BASE 0xfef00000
19#define EP93XX_AHB_SIZE 0x00100000
20
21#define EP93XX_APB_PHYS_BASE 0x80800000
22#define EP93XX_APB_VIRT_BASE 0xfed00000
23#define EP93XX_APB_SIZE 0x00200000
24
25
26/* AHB peripherals */
27#define EP93XX_DMA_BASE (EP93XX_AHB_VIRT_BASE + 0x00000000)
28
29#define EP93XX_ETHERNET_BASE (EP93XX_AHB_VIRT_BASE + 0x00010000)
30
31#define EP93XX_USB_BASE (EP93XX_AHB_VIRT_BASE + 0x00020000)
32#define EP93XX_USB_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x00020000)
33
34#define EP93XX_RASTER_BASE (EP93XX_AHB_VIRT_BASE + 0x00030000)
35
36#define EP93XX_GRAPHICS_ACCEL_BASE (EP93XX_AHB_VIRT_BASE + 0x00040000)
37
38#define EP93XX_SDRAM_CONTROLLER_BASE (EP93XX_AHB_VIRT_BASE + 0x00060000)
39
40#define EP93XX_PCMCIA_CONTROLLER_BASE (EP93XX_AHB_VIRT_BASE + 0x00080000)
41
42#define EP93XX_BOOT_ROM_BASE (EP93XX_AHB_VIRT_BASE + 0x00090000)
43
44#define EP93XX_IDE_BASE (EP93XX_AHB_VIRT_BASE + 0x000a0000)
45
46#define EP93XX_VIC1_BASE (EP93XX_AHB_VIRT_BASE + 0x000b0000)
47
48#define EP93XX_VIC2_BASE (EP93XX_AHB_VIRT_BASE + 0x000c0000)
49
50
51/* APB peripherals */
52#define EP93XX_TIMER_BASE (EP93XX_APB_VIRT_BASE + 0x00010000)
53#define EP93XX_TIMER_REG(x) (EP93XX_TIMER_BASE + (x))
54#define EP93XX_TIMER1_LOAD EP93XX_TIMER_REG(0x00)
55#define EP93XX_TIMER1_VALUE EP93XX_TIMER_REG(0x04)
56#define EP93XX_TIMER1_CONTROL EP93XX_TIMER_REG(0x08)
57#define EP93XX_TIMER1_CLEAR EP93XX_TIMER_REG(0x0c)
58#define EP93XX_TIMER2_LOAD EP93XX_TIMER_REG(0x20)
59#define EP93XX_TIMER2_VALUE EP93XX_TIMER_REG(0x24)
60#define EP93XX_TIMER2_CONTROL EP93XX_TIMER_REG(0x28)
61#define EP93XX_TIMER2_CLEAR EP93XX_TIMER_REG(0x2c)
62#define EP93XX_TIMER4_VALUE_LOW EP93XX_TIMER_REG(0x60)
63#define EP93XX_TIMER4_VALUE_HIGH EP93XX_TIMER_REG(0x64)
64#define EP93XX_TIMER3_LOAD EP93XX_TIMER_REG(0x80)
65#define EP93XX_TIMER3_VALUE EP93XX_TIMER_REG(0x84)
66#define EP93XX_TIMER3_CONTROL EP93XX_TIMER_REG(0x88)
67#define EP93XX_TIMER3_CLEAR EP93XX_TIMER_REG(0x8c)
68
69#define EP93XX_I2S_BASE (EP93XX_APB_VIRT_BASE + 0x00020000)
70
71#define EP93XX_SECURITY_BASE (EP93XX_APB_VIRT_BASE + 0x00030000)
72
73#define EP93XX_GPIO_BASE (EP93XX_APB_VIRT_BASE + 0x00040000)
74#define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x))
75#define EP93XX_GPIO_A_INT_TYPE1 EP93XX_GPIO_REG(0x90)
76#define EP93XX_GPIO_A_INT_TYPE2 EP93XX_GPIO_REG(0x94)
77#define EP93XX_GPIO_A_INT_ACK EP93XX_GPIO_REG(0x98)
78#define EP93XX_GPIO_A_INT_ENABLE EP93XX_GPIO_REG(0x9c)
79#define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0)
80#define EP93XX_GPIO_B_INT_TYPE1 EP93XX_GPIO_REG(0xac)
81#define EP93XX_GPIO_B_INT_TYPE2 EP93XX_GPIO_REG(0xb0)
82#define EP93XX_GPIO_B_INT_ACK EP93XX_GPIO_REG(0xb4)
83#define EP93XX_GPIO_B_INT_ENABLE EP93XX_GPIO_REG(0xb8)
84#define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc)
85
86#define EP93XX_AAC_BASE (EP93XX_APB_VIRT_BASE + 0x00080000)
87
88#define EP93XX_SPI_BASE (EP93XX_APB_VIRT_BASE + 0x000a0000)
89
90#define EP93XX_IRDA_BASE (EP93XX_APB_VIRT_BASE + 0x000b0000)
91
92#define EP93XX_UART1_BASE (EP93XX_APB_VIRT_BASE + 0x000c0000)
93#define EP93XX_UART1_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000c0000)
94
95#define EP93XX_UART2_BASE (EP93XX_APB_VIRT_BASE + 0x000d0000)
96#define EP93XX_UART2_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000d0000)
97
98#define EP93XX_UART3_BASE (EP93XX_APB_VIRT_BASE + 0x000e0000)
99#define EP93XX_UART3_PHYS_BASE (EP93XX_APB_PHYS_BASE + 0x000e0000)
100
101#define EP93XX_KEY_MATRIX_BASE (EP93XX_APB_VIRT_BASE + 0x000f0000)
102
103#define EP93XX_ADC_BASE (EP93XX_APB_VIRT_BASE + 0x00100000)
104#define EP93XX_TOUCHSCREEN_BASE (EP93XX_APB_VIRT_BASE + 0x00100000)
105
106#define EP93XX_PWM_BASE (EP93XX_APB_VIRT_BASE + 0x00110000)
107
108#define EP93XX_RTC_BASE (EP93XX_APB_VIRT_BASE + 0x00120000)
109
110#define EP93XX_SYSCON_BASE (EP93XX_APB_VIRT_BASE + 0x00130000)
111#define EP93XX_SYSCON_REG(x) (EP93XX_SYSCON_BASE + (x))
112#define EP93XX_SYSCON_POWER_STATE EP93XX_SYSCON_REG(0x00)
113#define EP93XX_SYSCON_CLOCK_CONTROL EP93XX_SYSCON_REG(0x04)
114#define EP93XX_SYSCON_CLOCK_UARTBAUD 0x20000000
115#define EP93XX_SYSCON_CLOCK_USH_EN 0x10000000
116#define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08)
117#define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c)
118#define EP93XX_SYSCON_DEVICE_CONFIG EP93XX_SYSCON_REG(0x80)
119#define EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE 0x00800000
120#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0)
121
122#define EP93XX_WATCHDOG_BASE (EP93XX_APB_VIRT_BASE + 0x00140000)
123
124
125#endif
diff --git a/include/asm-arm/arch-ep93xx/gesbc9312.h b/include/asm-arm/arch-ep93xx/gesbc9312.h
new file mode 100644
index 000000000000..4d0b3023bff7
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/gesbc9312.h
@@ -0,0 +1,3 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/gesbc9312.h
3 */
diff --git a/include/asm-arm/arch-ep93xx/gpio.h b/include/asm-arm/arch-ep93xx/gpio.h
new file mode 100644
index 000000000000..1ee14a14cba0
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/gpio.h
@@ -0,0 +1,107 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/gpio.h
3 */
4
5#ifndef __ASM_ARCH_GPIO_H
6#define __ASM_ARCH_GPIO_H
7
8#define GPIO_IN 0
9#define GPIO_OUT 1
10
11#define EP93XX_GPIO_LOW 0
12#define EP93XX_GPIO_HIGH 1
13
14extern void gpio_line_config(int line, int direction);
15extern int gpio_line_get(int line);
16extern void gpio_line_set(int line, int value);
17
18/* GPIO port A. */
19#define EP93XX_GPIO_LINE_A(x) ((x) + 0)
20#define EP93XX_GPIO_LINE_EGPIO0 EP93XX_GPIO_LINE_A(0)
21#define EP93XX_GPIO_LINE_EGPIO1 EP93XX_GPIO_LINE_A(1)
22#define EP93XX_GPIO_LINE_EGPIO2 EP93XX_GPIO_LINE_A(2)
23#define EP93XX_GPIO_LINE_EGPIO3 EP93XX_GPIO_LINE_A(3)
24#define EP93XX_GPIO_LINE_EGPIO4 EP93XX_GPIO_LINE_A(4)
25#define EP93XX_GPIO_LINE_EGPIO5 EP93XX_GPIO_LINE_A(5)
26#define EP93XX_GPIO_LINE_EGPIO6 EP93XX_GPIO_LINE_A(6)
27#define EP93XX_GPIO_LINE_EGPIO7 EP93XX_GPIO_LINE_A(7)
28
29/* GPIO port B. */
30#define EP93XX_GPIO_LINE_B(x) ((x) + 8)
31#define EP93XX_GPIO_LINE_EGPIO8 EP93XX_GPIO_LINE_B(0)
32#define EP93XX_GPIO_LINE_EGPIO9 EP93XX_GPIO_LINE_B(1)
33#define EP93XX_GPIO_LINE_EGPIO10 EP93XX_GPIO_LINE_B(2)
34#define EP93XX_GPIO_LINE_EGPIO11 EP93XX_GPIO_LINE_B(3)
35#define EP93XX_GPIO_LINE_EGPIO12 EP93XX_GPIO_LINE_B(4)
36#define EP93XX_GPIO_LINE_EGPIO13 EP93XX_GPIO_LINE_B(5)
37#define EP93XX_GPIO_LINE_EGPIO14 EP93XX_GPIO_LINE_B(6)
38#define EP93XX_GPIO_LINE_EGPIO15 EP93XX_GPIO_LINE_B(7)
39
40/* GPIO port C. */
41#define EP93XX_GPIO_LINE_C(x) ((x) + 16)
42#define EP93XX_GPIO_LINE_ROW0 EP93XX_GPIO_LINE_C(0)
43#define EP93XX_GPIO_LINE_ROW1 EP93XX_GPIO_LINE_C(1)
44#define EP93XX_GPIO_LINE_ROW2 EP93XX_GPIO_LINE_C(2)
45#define EP93XX_GPIO_LINE_ROW3 EP93XX_GPIO_LINE_C(3)
46#define EP93XX_GPIO_LINE_ROW4 EP93XX_GPIO_LINE_C(4)
47#define EP93XX_GPIO_LINE_ROW5 EP93XX_GPIO_LINE_C(5)
48#define EP93XX_GPIO_LINE_ROW6 EP93XX_GPIO_LINE_C(6)
49#define EP93XX_GPIO_LINE_ROW7 EP93XX_GPIO_LINE_C(7)
50
51/* GPIO port D. */
52#define EP93XX_GPIO_LINE_D(x) ((x) + 24)
53#define EP93XX_GPIO_LINE_COL0 EP93XX_GPIO_LINE_D(0)
54#define EP93XX_GPIO_LINE_COL1 EP93XX_GPIO_LINE_D(1)
55#define EP93XX_GPIO_LINE_COL2 EP93XX_GPIO_LINE_D(2)
56#define EP93XX_GPIO_LINE_COL3 EP93XX_GPIO_LINE_D(3)
57#define EP93XX_GPIO_LINE_COL4 EP93XX_GPIO_LINE_D(4)
58#define EP93XX_GPIO_LINE_COL5 EP93XX_GPIO_LINE_D(5)
59#define EP93XX_GPIO_LINE_COL6 EP93XX_GPIO_LINE_D(6)
60#define EP93XX_GPIO_LINE_COL7 EP93XX_GPIO_LINE_D(7)
61
62/* GPIO port E. */
63#define EP93XX_GPIO_LINE_E(x) ((x) + 32)
64#define EP93XX_GPIO_LINE_GRLED EP93XX_GPIO_LINE_E(0)
65#define EP93XX_GPIO_LINE_RDLED EP93XX_GPIO_LINE_E(1)
66#define EP93XX_GPIO_LINE_DIORn EP93XX_GPIO_LINE_E(2)
67#define EP93XX_GPIO_LINE_IDECS1n EP93XX_GPIO_LINE_E(3)
68#define EP93XX_GPIO_LINE_IDECS2n EP93XX_GPIO_LINE_E(4)
69#define EP93XX_GPIO_LINE_IDEDA0 EP93XX_GPIO_LINE_E(5)
70#define EP93XX_GPIO_LINE_IDEDA1 EP93XX_GPIO_LINE_E(6)
71#define EP93XX_GPIO_LINE_IDEDA2 EP93XX_GPIO_LINE_E(7)
72
73/* GPIO port F. */
74#define EP93XX_GPIO_LINE_F(x) ((x) + 40)
75#define EP93XX_GPIO_LINE_WP EP93XX_GPIO_LINE_F(0)
76#define EP93XX_GPIO_LINE_MCCD1 EP93XX_GPIO_LINE_F(1)
77#define EP93XX_GPIO_LINE_MCCD2 EP93XX_GPIO_LINE_F(2)
78#define EP93XX_GPIO_LINE_MCBVD1 EP93XX_GPIO_LINE_F(3)
79#define EP93XX_GPIO_LINE_MCBVD2 EP93XX_GPIO_LINE_F(4)
80#define EP93XX_GPIO_LINE_VS1 EP93XX_GPIO_LINE_F(5)
81#define EP93XX_GPIO_LINE_READY EP93XX_GPIO_LINE_F(6)
82#define EP93XX_GPIO_LINE_VS2 EP93XX_GPIO_LINE_F(7)
83
84/* GPIO port G. */
85#define EP93XX_GPIO_LINE_G(x) ((x) + 48)
86#define EP93XX_GPIO_LINE_EECLK EP93XX_GPIO_LINE_G(0)
87#define EP93XX_GPIO_LINE_EEDAT EP93XX_GPIO_LINE_G(1)
88#define EP93XX_GPIO_LINE_SLA0 EP93XX_GPIO_LINE_G(2)
89#define EP93XX_GPIO_LINE_SLA1 EP93XX_GPIO_LINE_G(3)
90#define EP93XX_GPIO_LINE_DD12 EP93XX_GPIO_LINE_G(4)
91#define EP93XX_GPIO_LINE_DD13 EP93XX_GPIO_LINE_G(5)
92#define EP93XX_GPIO_LINE_DD14 EP93XX_GPIO_LINE_G(6)
93#define EP93XX_GPIO_LINE_DD15 EP93XX_GPIO_LINE_G(7)
94
95/* GPIO port H. */
96#define EP93XX_GPIO_LINE_H(x) ((x) + 56)
97#define EP93XX_GPIO_LINE_DD0 EP93XX_GPIO_LINE_H(0)
98#define EP93XX_GPIO_LINE_DD1 EP93XX_GPIO_LINE_H(1)
99#define EP93XX_GPIO_LINE_DD2 EP93XX_GPIO_LINE_H(2)
100#define EP93XX_GPIO_LINE_DD3 EP93XX_GPIO_LINE_H(3)
101#define EP93XX_GPIO_LINE_DD4 EP93XX_GPIO_LINE_H(4)
102#define EP93XX_GPIO_LINE_DD5 EP93XX_GPIO_LINE_H(5)
103#define EP93XX_GPIO_LINE_DD6 EP93XX_GPIO_LINE_H(6)
104#define EP93XX_GPIO_LINE_DD7 EP93XX_GPIO_LINE_H(7)
105
106
107#endif
diff --git a/include/asm-arm/arch-ep93xx/hardware.h b/include/asm-arm/arch-ep93xx/hardware.h
new file mode 100644
index 000000000000..9b69f454065d
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/hardware.h
@@ -0,0 +1,12 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/hardware.h
3 */
4
5#include "ep93xx-regs.h"
6
7#define pcibios_assign_all_busses() 0
8
9#include "platform.h"
10
11#include "gesbc9312.h"
12#include "ts72xx.h"
diff --git a/include/asm-arm/arch-ep93xx/io.h b/include/asm-arm/arch-ep93xx/io.h
new file mode 100644
index 000000000000..7b4d25e29060
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/io.h
@@ -0,0 +1,8 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/io.h
3 */
4
5#define IO_SPACE_LIMIT 0xffffffff
6
7#define __io(p) ((void __iomem *)(p))
8#define __mem_pci(p) (p)
diff --git a/include/asm-arm/arch-ep93xx/irqs.h b/include/asm-arm/arch-ep93xx/irqs.h
new file mode 100644
index 000000000000..9a42f5de9e57
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/irqs.h
@@ -0,0 +1,80 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/irqs.h
3 */
4
5#ifndef __ASM_ARCH_IRQS_H
6#define __ASM_ARCH_IRQS_H
7
8#define IRQ_EP93XX_COMMRX 2
9#define IRQ_EP93XX_COMMTX 3
10#define IRQ_EP93XX_TIMER1 4
11#define IRQ_EP93XX_TIMER2 5
12#define IRQ_EP93XX_AACINTR 6
13#define IRQ_EP93XX_DMAM2P0 7
14#define IRQ_EP93XX_DMAM2P1 8
15#define IRQ_EP93XX_DMAM2P2 9
16#define IRQ_EP93XX_DMAM2P3 10
17#define IRQ_EP93XX_DMAM2P4 11
18#define IRQ_EP93XX_DMAM2P5 12
19#define IRQ_EP93XX_DMAM2P6 13
20#define IRQ_EP93XX_DMAM2P7 14
21#define IRQ_EP93XX_DMAM2P8 15
22#define IRQ_EP93XX_DMAM2P9 16
23#define IRQ_EP93XX_DMAM2M0 17
24#define IRQ_EP93XX_DMAM2M1 18
25#define IRQ_EP93XX_GPIO0MUX 20
26#define IRQ_EP93XX_GPIO1MUX 21
27#define IRQ_EP93XX_GPIO2MUX 22
28#define IRQ_EP93XX_GPIO3MUX 22
29#define IRQ_EP93XX_UART1RX 23
30#define IRQ_EP93XX_UART1TX 24
31#define IRQ_EP93XX_UART2RX 25
32#define IRQ_EP93XX_UART2TX 26
33#define IRQ_EP93XX_UART3RX 27
34#define IRQ_EP93XX_UART3TX 28
35#define IRQ_EP93XX_KEY 29
36#define IRQ_EP93XX_TOUCH 30
37#define EP93XX_VIC1_VALID_IRQ_MASK 0x7ffffffc
38
39#define IRQ_EP93XX_EXT0 32
40#define IRQ_EP93XX_EXT1 33
41#define IRQ_EP93XX_EXT2 34
42#define IRQ_EP93XX_64HZ 35
43#define IRQ_EP93XX_WATCHDOG 36
44#define IRQ_EP93XX_RTC 37
45#define IRQ_EP93XX_IRDA 38
46#define IRQ_EP93XX_ETHERNET 39
47#define IRQ_EP93XX_EXT3 40
48#define IRQ_EP93XX_PROG 41
49#define IRQ_EP93XX_1HZ 42
50#define IRQ_EP93XX_VSYNC 43
51#define IRQ_EP93XX_VIDEO_FIFO 44
52#define IRQ_EP93XX_SSP1RX 45
53#define IRQ_EP93XX_SSP1TX 46
54#define IRQ_EP93XX_GPIO4MUX 47
55#define IRQ_EP93XX_GPIO5MUX 48
56#define IRQ_EP93XX_GPIO6MUX 49
57#define IRQ_EP93XX_GPIO7MUX 50
58#define IRQ_EP93XX_TIMER3 51
59#define IRQ_EP93XX_UART1 52
60#define IRQ_EP93XX_SSP 53
61#define IRQ_EP93XX_UART2 54
62#define IRQ_EP93XX_UART3 55
63#define IRQ_EP93XX_USB 56
64#define IRQ_EP93XX_ETHERNET_PME 57
65#define IRQ_EP93XX_DSP 58
66#define IRQ_EP93XX_GPIO_AB 59
67#define IRQ_EP93XX_SAI 60
68#define EP93XX_VIC2_VALID_IRQ_MASK 0x1fffffff
69
70#define IRQ_EP93XX_GPIO(x) (64 + (x))
71
72#define NR_EP93XX_IRQS IRQ_EP93XX_GPIO(16)
73
74#define EP93XX_BOARD_IRQ(x) (NR_EP93XX_IRQS + (x))
75#define EP93XX_BOARD_IRQS 32
76
77#define NR_IRQS (NR_EP93XX_IRQS + EP93XX_BOARD_IRQS)
78
79
80#endif
diff --git a/include/asm-arm/arch-ep93xx/memory.h b/include/asm-arm/arch-ep93xx/memory.h
new file mode 100644
index 000000000000..4b1a5c7c8363
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/memory.h
@@ -0,0 +1,14 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/memory.h
3 */
4
5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H
7
8#define PHYS_OFFSET UL(0x00000000)
9
10#define __bus_to_virt(x) __phys_to_virt(x)
11#define __virt_to_bus(x) __virt_to_phys(x)
12
13
14#endif
diff --git a/include/asm-arm/arch-ep93xx/platform.h b/include/asm-arm/arch-ep93xx/platform.h
new file mode 100644
index 000000000000..df9cbb6ef660
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/platform.h
@@ -0,0 +1,14 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/platform.h
3 */
4
5#ifndef __ASSEMBLY__
6
7void ep93xx_map_io(void);
8void ep93xx_init_irq(void);
9void ep93xx_init_time(unsigned long);
10void ep93xx_init_devices(void);
11extern struct sys_timer ep93xx_timer;
12
13
14#endif
diff --git a/include/asm-arm/arch-ep93xx/system.h b/include/asm-arm/arch-ep93xx/system.h
new file mode 100644
index 000000000000..79b718586746
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/system.h
@@ -0,0 +1,26 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/system.h
3 */
4
5#include <asm/hardware.h>
6
7static inline void arch_idle(void)
8{
9 cpu_do_idle();
10}
11
12static inline void arch_reset(char mode)
13{
14 u32 devicecfg;
15
16 local_irq_disable();
17
18 devicecfg = __raw_readl(EP93XX_SYSCON_DEVICE_CONFIG);
19 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK);
20 __raw_writel(devicecfg | 0x80000000, EP93XX_SYSCON_DEVICE_CONFIG);
21 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK);
22 __raw_writel(devicecfg & ~0x80000000, EP93XX_SYSCON_DEVICE_CONFIG);
23
24 while (1)
25 ;
26}
diff --git a/include/asm-arm/arch-ep93xx/timex.h b/include/asm-arm/arch-ep93xx/timex.h
new file mode 100644
index 000000000000..4140bddc97e2
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/timex.h
@@ -0,0 +1,5 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/timex.h
3 */
4
5#define CLOCK_TICK_RATE 983040
diff --git a/include/asm-arm/arch-ep93xx/ts72xx.h b/include/asm-arm/arch-ep93xx/ts72xx.h
new file mode 100644
index 000000000000..412215e77f44
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/ts72xx.h
@@ -0,0 +1,90 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/ts72xx.h
3 */
4
5/*
6 * TS72xx memory map:
7 *
8 * virt phys size
9 * febff000 22000000 4K model number register
10 * febfe000 22400000 4K options register
11 * febfd000 22800000 4K options register #2
12 * febfc000 [67]0000000 4K NAND data register
13 * febfb000 [67]0400000 4K NAND control register
14 * febfa000 [67]0800000 4K NAND busy register
15 */
16
17#define TS72XX_MODEL_PHYS_BASE 0x22000000
18#define TS72XX_MODEL_VIRT_BASE 0xfebff000
19#define TS72XX_MODEL_SIZE 0x00001000
20
21#define TS72XX_MODEL_TS7200 0x00
22#define TS72XX_MODEL_TS7250 0x01
23#define TS72XX_MODEL_TS7260 0x02
24
25
26#define TS72XX_OPTIONS_PHYS_BASE 0x22400000
27#define TS72XX_OPTIONS_VIRT_BASE 0xfebfe000
28#define TS72XX_OPTIONS_SIZE 0x00001000
29
30#define TS72XX_OPTIONS_COM2_RS485 0x02
31#define TS72XX_OPTIONS_MAX197 0x01
32
33
34#define TS72XX_OPTIONS2_PHYS_BASE 0x22800000
35#define TS72XX_OPTIONS2_VIRT_BASE 0xfebfd000
36#define TS72XX_OPTIONS2_SIZE 0x00001000
37
38#define TS72XX_OPTIONS2_TS9420 0x04
39#define TS72XX_OPTIONS2_TS9420_BOOT 0x02
40
41
42#define TS72XX_NOR_PHYS_BASE 0x60000000
43#define TS72XX_NOR2_PHYS_BASE 0x62000000
44
45#define TS72XX_NAND1_DATA_PHYS_BASE 0x60000000
46#define TS72XX_NAND2_DATA_PHYS_BASE 0x70000000
47#define TS72XX_NAND_DATA_VIRT_BASE 0xfebfc000
48#define TS72XX_NAND_DATA_SIZE 0x00001000
49
50#define TS72XX_NAND1_CONTROL_PHYS_BASE 0x60400000
51#define TS72XX_NAND2_CONTROL_PHYS_BASE 0x70400000
52#define TS72XX_NAND_CONTROL_VIRT_BASE 0xfebfb000
53#define TS72XX_NAND_CONTROL_SIZE 0x00001000
54
55#define TS72XX_NAND1_BUSY_PHYS_BASE 0x60800000
56#define TS72XX_NAND2_BUSY_PHYS_BASE 0x70800000
57#define TS72XX_NAND_BUSY_VIRT_BASE 0xfebfa000
58#define TS72XX_NAND_BUSY_SIZE 0x00001000
59
60
61#ifndef __ASSEMBLY__
62#include <asm/io.h>
63
64static inline int board_is_ts7200(void)
65{
66 return __raw_readb(TS72XX_MODEL_VIRT_BASE) == TS72XX_MODEL_TS7200;
67}
68
69static inline int board_is_ts7250(void)
70{
71 return __raw_readb(TS72XX_MODEL_VIRT_BASE) == TS72XX_MODEL_TS7250;
72}
73
74static inline int board_is_ts7260(void)
75{
76 return __raw_readb(TS72XX_MODEL_VIRT_BASE) == TS72XX_MODEL_TS7260;
77}
78
79static inline int is_max197_installed(void)
80{
81 return !!(__raw_readb(TS72XX_OPTIONS_VIRT_BASE) &
82 TS72XX_OPTIONS_MAX197);
83}
84
85static inline int is_ts9420_installed(void)
86{
87 return !!(__raw_readb(TS72XX_OPTIONS2_VIRT_BASE) &
88 TS72XX_OPTIONS2_TS9420);
89}
90#endif
diff --git a/include/asm-arm/arch-ep93xx/uncompress.h b/include/asm-arm/arch-ep93xx/uncompress.h
new file mode 100644
index 000000000000..c15274c85d5d
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/uncompress.h
@@ -0,0 +1,85 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/uncompress.h
3 *
4 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#include <asm/arch/ep93xx-regs.h>
13
14static unsigned char __raw_readb(unsigned int ptr)
15{
16 return *((volatile unsigned char *)ptr);
17}
18
19static unsigned int __raw_readl(unsigned int ptr)
20{
21 return *((volatile unsigned int *)ptr);
22}
23
24static void __raw_writeb(unsigned char value, unsigned int ptr)
25{
26 *((volatile unsigned char *)ptr) = value;
27}
28
29static void __raw_writel(unsigned int value, unsigned int ptr)
30{
31 *((volatile unsigned int *)ptr) = value;
32}
33
34
35#define PHYS_UART1_DATA 0x808c0000
36#define PHYS_UART1_FLAG 0x808c0018
37#define UART1_FLAG_TXFF 0x20
38
39static inline void putc(int c)
40{
41 int i;
42
43 for (i = 0; i < 1000; i++) {
44 /* Transmit fifo not full? */
45 if (!(__raw_readb(PHYS_UART1_FLAG) & UART1_FLAG_TXFF))
46 break;
47 }
48
49 __raw_writeb(c, PHYS_UART1_DATA);
50}
51
52static inline void flush(void)
53{
54}
55
56
57/*
58 * Some bootloaders don't turn off DMA from the ethernet MAC before
59 * jumping to linux, which means that we might end up with bits of RX
60 * status and packet data scribbled over the uncompressed kernel image.
61 * Work around this by resetting the ethernet MAC before we uncompress.
62 */
63#define PHYS_ETH_SELF_CTL 0x80010020
64#define ETH_SELF_CTL_RESET 0x00000001
65
66static void ethernet_reset(void)
67{
68 unsigned int v;
69
70 /* Reset the ethernet MAC. */
71 v = __raw_readl(PHYS_ETH_SELF_CTL);
72 __raw_writel(v | ETH_SELF_CTL_RESET, PHYS_ETH_SELF_CTL);
73
74 /* Wait for reset to finish. */
75 while (__raw_readl(PHYS_ETH_SELF_CTL) & ETH_SELF_CTL_RESET)
76 ;
77}
78
79
80static void arch_decomp_setup(void)
81{
82 ethernet_reset();
83}
84
85#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-ep93xx/vmalloc.h b/include/asm-arm/arch-ep93xx/vmalloc.h
new file mode 100644
index 000000000000..205ea6b1cf5e
--- /dev/null
+++ b/include/asm-arm/arch-ep93xx/vmalloc.h
@@ -0,0 +1,5 @@
1/*
2 * linux/include/asm-arm/arch-ep93xx/vmalloc.h
3 */
4
5#define VMALLOC_END 0xfe800000
diff --git a/include/asm-arm/arch-h720x/irq.h b/include/asm-arm/arch-h720x/irq.h
deleted file mode 100644
index b3821e957aa4..000000000000
--- a/include/asm-arm/arch-h720x/irq.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * include/asm-arm/arch-h720x/irq.h
3 *
4 * Copyright (C) 2000-2002 Jungjun Kim
5 * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
6 * (C) 2003 Thomas Gleixner <tglx@linutronix.de>
7 */
8
9#ifndef __ASM_ARCH_IRQ_H
10#define __ASM_ARCH_IRQ_H
11
12extern void __init h720x_init_irq (void);
13
14#endif /* __ASM_ARCH_IRQ_H */
diff --git a/include/asm-arm/arch-h720x/param.h b/include/asm-arm/arch-h720x/param.h
deleted file mode 100644
index 2b80235f9847..000000000000
--- a/include/asm-arm/arch-h720x/param.h
+++ /dev/null
@@ -1,10 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-h720x/param.h
3 *
4 * Copyright (C) 2000 Jungjun Kim
5 */
6
7#ifndef __ASM_ARCH_PARAM_H
8#define __ASM_ARCH_PARAM_H
9
10#endif
diff --git a/include/asm-arm/arch-h720x/uncompress.h b/include/asm-arm/arch-h720x/uncompress.h
index 9535764bcc71..18c69e0f3585 100644
--- a/include/asm-arm/arch-h720x/uncompress.h
+++ b/include/asm-arm/arch-h720x/uncompress.h
@@ -12,22 +12,20 @@
12#define LSR 0x14 12#define LSR 0x14
13#define TEMPTY 0x40 13#define TEMPTY 0x40
14 14
15static void putstr(const char *s) 15static inline void putc(int c)
16{ 16{
17 char c;
18 volatile unsigned char *p = (volatile unsigned char *)(IO_PHYS+0x20000); 17 volatile unsigned char *p = (volatile unsigned char *)(IO_PHYS+0x20000);
19 18
20 while ( (c = *s++) != '\0') { 19 /* wait until transmit buffer is empty */
21 /* wait until transmit buffer is empty */ 20 while((p[LSR] & TEMPTY) == 0x0)
22 while((p[LSR] & TEMPTY) == 0x0); 21 barrier();
23 /* write next character */ 22
24 *p = c; 23 /* write next character */
25 24 *p = c;
26 if(c == '\n') { 25}
27 while((p[LSR] & TEMPTY) == 0x0); 26
28 *p = '\r'; 27static inline void flush(void)
29 } 28{
30 }
31} 29}
32 30
33/* 31/*
diff --git a/include/asm-arm/arch-imx/irq.h b/include/asm-arm/arch-imx/irq.h
deleted file mode 100644
index 545e065d2325..000000000000
--- a/include/asm-arm/arch-imx/irq.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-imxads/irq.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#define fixup_irq(i) (i)
diff --git a/include/asm-arm/arch-imx/param.h b/include/asm-arm/arch-imx/param.h
deleted file mode 100644
index 7c724f03333e..000000000000
--- a/include/asm-arm/arch-imx/param.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-imx/param.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 */
diff --git a/include/asm-arm/arch-imx/uncompress.h b/include/asm-arm/arch-imx/uncompress.h
index 096077f2750b..da333f69136f 100644
--- a/include/asm-arm/arch-imx/uncompress.h
+++ b/include/asm-arm/arch-imx/uncompress.h
@@ -39,8 +39,7 @@
39 * 39 *
40 * This does not append a newline 40 * This does not append a newline
41 */ 41 */
42static void 42static void putc(int c)
43putstr(const char *s)
44{ 43{
45 unsigned long serial_port; 44 unsigned long serial_port;
46 45
@@ -54,20 +53,14 @@ putstr(const char *s)
54 return; 53 return;
55 } while(0); 54 } while(0);
56 55
57 while (*s) { 56 while (!(UART(USR2) & USR2_TXFE))
58 while ( !(UART(USR2) & USR2_TXFE) ) 57 barrier();
59 barrier();
60 58
61 UART(TXR) = *s; 59 UART(TXR) = c;
62 60}
63 if (*s == '\n') {
64 while ( !(UART(USR2) & USR2_TXFE) )
65 barrier();
66 61
67 UART(TXR) = '\r'; 62static inline void flush(void)
68 } 63{
69 s++;
70 }
71} 64}
72 65
73/* 66/*
diff --git a/include/asm-arm/arch-integrator/debug-macro.S b/include/asm-arm/arch-integrator/debug-macro.S
index 031d30941791..85b327c352df 100644
--- a/include/asm-arm/arch-integrator/debug-macro.S
+++ b/include/asm-arm/arch-integrator/debug-macro.S
@@ -11,8 +11,6 @@
11 * 11 *
12*/ 12*/
13 13
14#include <linux/amba/serial.h>
15
16 .macro addruart,rx 14 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0 15 mrc p15, 0, \rx, c1, c0
18 tst \rx, #1 @ MMU enabled? 16 tst \rx, #1 @ MMU enabled?
@@ -21,18 +19,4 @@
21 addne \rx, \rx, #0x16000000 >> 4 19 addne \rx, \rx, #0x16000000 >> 4
22 .endm 20 .endm
23 21
24 .macro senduart,rd,rx 22#include <asm/hardware/debug-pl01x.S>
25 strb \rd, [\rx, #UART01x_DR]
26 .endm
27
28 .macro waituart,rd,rx
291001: ldr \rd, [\rx, #0x18] @ UARTFLG
30 tst \rd, #1 << 5 @ UARTFLGUTXFF - 1 when full
31 bne 1001b
32 .endm
33
34 .macro busyuart,rd,rx
351001: ldr \rd, [\rx, #0x18] @ UARTFLG
36 tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy
37 bne 1001b
38 .endm
diff --git a/include/asm-arm/arch-integrator/param.h b/include/asm-arm/arch-integrator/param.h
deleted file mode 100644
index afa582ff3717..000000000000
--- a/include/asm-arm/arch-integrator/param.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-integrator/param.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 */
diff --git a/include/asm-arm/arch-integrator/uncompress.h b/include/asm-arm/arch-integrator/uncompress.h
index 3957402741d3..f61825c4d901 100644
--- a/include/asm-arm/arch-integrator/uncompress.h
+++ b/include/asm-arm/arch-integrator/uncompress.h
@@ -28,21 +28,18 @@
28/* 28/*
29 * This does not append a newline 29 * This does not append a newline
30 */ 30 */
31static void putstr(const char *s) 31static void putc(int c)
32{ 32{
33 while (*s) { 33 while (AMBA_UART_FR & (1 << 5))
34 while (AMBA_UART_FR & (1 << 5)); 34 barrier();
35 35
36 AMBA_UART_DR = *s; 36 AMBA_UART_DR = c;
37 37}
38 if (*s == '\n') {
39 while (AMBA_UART_FR & (1 << 5));
40 38
41 AMBA_UART_DR = '\r'; 39static inline void flush(void)
42 } 40{
43 s++; 41 while (AMBA_UART_FR & (1 << 3))
44 } 42 barrier();
45 while (AMBA_UART_FR & (1 << 3));
46} 43}
47 44
48/* 45/*
diff --git a/include/asm-arm/arch-iop3xx/debug-macro.S b/include/asm-arm/arch-iop3xx/debug-macro.S
index cc15f80ebd9a..ce007e531994 100644
--- a/include/asm-arm/arch-iop3xx/debug-macro.S
+++ b/include/asm-arm/arch-iop3xx/debug-macro.S
@@ -28,21 +28,8 @@
28#endif 28#endif
29 .endm 29 .endm
30 30
31 .macro senduart,rd,rx
32 strb \rd, [\rx]
33 .endm
34
35 .macro busyuart,rd,rx
361002: ldrb \rd, [\rx, #0x5]
37 and \rd, \rd, #0x60
38 teq \rd, #0x60
39 bne 1002b
40 .endm
41
42 .macro waituart,rd,rx
43#if !defined(CONFIG_ARCH_IQ80321) || !defined(CONFIG_ARCH_IQ31244) || !defined(CONFIG_ARCH_IQ80331) 31#if !defined(CONFIG_ARCH_IQ80321) || !defined(CONFIG_ARCH_IQ31244) || !defined(CONFIG_ARCH_IQ80331)
441001: ldrb \rd, [\rx, #0x6] 32#define FLOW_CONTROL
45 tst \rd, #0x10
46 beq 1001b
47#endif 33#endif
48 .endm 34#define UART_SHIFT 0
35#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-iop3xx/param.h b/include/asm-arm/arch-iop3xx/param.h
deleted file mode 100644
index acf404e87358..000000000000
--- a/include/asm-arm/arch-iop3xx/param.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-iop3xx/param.h
3 */
diff --git a/include/asm-arm/arch-iop3xx/uncompress.h b/include/asm-arm/arch-iop3xx/uncompress.h
index 82b88762c3cc..c98eb6254b1f 100644
--- a/include/asm-arm/arch-iop3xx/uncompress.h
+++ b/include/asm-arm/arch-iop3xx/uncompress.h
@@ -19,23 +19,15 @@ static volatile UTYPE uart_base;
19 19
20#define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE) 20#define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE)
21 21
22static __inline__ void putc(char c) 22static inline void putc(char c)
23{ 23{
24 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE); 24 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
25 barrier();
25 *uart_base = c; 26 *uart_base = c;
26} 27}
27 28
28/* 29static inline void flush(void)
29 * This does not append a newline
30 */
31static void putstr(const char *s)
32{ 30{
33 while (*s) {
34 putc(*s);
35 if (*s == '\n')
36 putc('\r');
37 s++;
38 }
39} 31}
40 32
41static __inline__ void __arch_decomp_setup(unsigned long arch_id) 33static __inline__ void __arch_decomp_setup(unsigned long arch_id)
diff --git a/include/asm-arm/arch-ixp2000/debug-macro.S b/include/asm-arm/arch-ixp2000/debug-macro.S
index 5631e0889861..bc8b39654793 100644
--- a/include/asm-arm/arch-ixp2000/debug-macro.S
+++ b/include/asm-arm/arch-ixp2000/debug-macro.S
@@ -23,18 +23,5 @@
23#endif 23#endif
24 .endm 24 .endm
25 25
26 .macro senduart,rd,rx 26#define UART_SHIFT 2
27 strb \rd, [\rx] 27#include <asm/hardware/debug-8250.S>
28 .endm
29
30 .macro busyuart,rd,rx
311002: ldrb \rd, [\rx, #0x14]
32 tst \rd, #0x20
33 beq 1002b
34 .endm
35
36 .macro waituart,rd,rx
37 nop
38 nop
39 nop
40 .endm
diff --git a/include/asm-arm/arch-ixp2000/irq.h b/include/asm-arm/arch-ixp2000/irq.h
deleted file mode 100644
index ba00b23f9828..000000000000
--- a/include/asm-arm/arch-ixp2000/irq.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-ixp2000/irq.h
3 *
4 * Copyright (C) 2002 Intel Corp.
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#define fixup_irq(irq) (irq)
12
13
diff --git a/include/asm-arm/arch-ixp2000/ixdp2x00.h b/include/asm-arm/arch-ixp2000/ixdp2x00.h
index 229381c64283..546e2e8e27b8 100644
--- a/include/asm-arm/arch-ixp2000/ixdp2x00.h
+++ b/include/asm-arm/arch-ixp2000/ixdp2x00.h
@@ -72,12 +72,11 @@
72 72
73#ifndef __ASSEMBLY__ 73#ifndef __ASSEMBLY__
74/* 74/*
75 * Master NPU will always have flash and be PCI master. 75 * The master NPU is always PCI master.
76 * Slave NPU may or may not have flash but will never be PCI master.
77 */ 76 */
78static inline unsigned int ixdp2x00_master_npu(void) 77static inline unsigned int ixdp2x00_master_npu(void)
79{ 78{
80 return ((ixp2000_has_flash()) && (ixp2000_is_pcimaster())); 79 return !!ixp2000_is_pcimaster();
81} 80}
82 81
83/* 82/*
diff --git a/include/asm-arm/arch-ixp2000/ixp2000-regs.h b/include/asm-arm/arch-ixp2000/ixp2000-regs.h
index 2b57f91b4ebd..ccae4bec92c5 100644
--- a/include/asm-arm/arch-ixp2000/ixp2000-regs.h
+++ b/include/asm-arm/arch-ixp2000/ixp2000-regs.h
@@ -353,8 +353,8 @@
353 * Masks and shifts for various fields in the WTC and RTC registers. 353 * Masks and shifts for various fields in the WTC and RTC registers.
354 */ 354 */
355#define SLOWPORT_WRTC_MASK_HD 0x0003 355#define SLOWPORT_WRTC_MASK_HD 0x0003
356#define SLOWPORT_WRTC_MASK_SU 0x003c 356#define SLOWPORT_WRTC_MASK_PW 0x003c
357#define SLOWPORT_WRTC_MASK_PW 0x03c0 357#define SLOWPORT_WRTC_MASK_SU 0x03c0
358 358
359#define SLOWPORT_WRTC_SHIFT_HD 0x00 359#define SLOWPORT_WRTC_SHIFT_HD 0x00
360#define SLOWPORT_WRTC_SHIFT_SU 0x02 360#define SLOWPORT_WRTC_SHIFT_SU 0x02
diff --git a/include/asm-arm/arch-ixp2000/param.h b/include/asm-arm/arch-ixp2000/param.h
deleted file mode 100644
index 2646d9e5919d..000000000000
--- a/include/asm-arm/arch-ixp2000/param.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-ixp2000/param.h
3 */
diff --git a/include/asm-arm/arch-ixp2000/system.h b/include/asm-arm/arch-ixp2000/system.h
index ddbbb34b5f95..3cc9a04f68cb 100644
--- a/include/asm-arm/arch-ixp2000/system.h
+++ b/include/asm-arm/arch-ixp2000/system.h
@@ -37,7 +37,7 @@ static inline void arch_reset(char mode)
37 * to cause a complete reset of the CPU and all external devices 37 * to cause a complete reset of the CPU and all external devices
38 * and move the flash bank register back to 0. 38 * and move the flash bank register back to 0.
39 */ 39 */
40 if (machine_is_ixdp2801()) { 40 if (machine_is_ixdp2801() || machine_is_ixdp28x5()) {
41 unsigned long reset_reg = *IXDP2X01_CPLD_RESET_REG; 41 unsigned long reset_reg = *IXDP2X01_CPLD_RESET_REG;
42 42
43 reset_reg = 0x55AA0000 | (reset_reg & 0x0000FFFF); 43 reset_reg = 0x55AA0000 | (reset_reg & 0x0000FFFF);
diff --git a/include/asm-arm/arch-ixp2000/uncompress.h b/include/asm-arm/arch-ixp2000/uncompress.h
index 3d3d5b2ed6e9..f66b408f363e 100644
--- a/include/asm-arm/arch-ixp2000/uncompress.h
+++ b/include/asm-arm/arch-ixp2000/uncompress.h
@@ -29,23 +29,18 @@
29#define UARTSR PHYS(0x14) /* Status reg */ 29#define UARTSR PHYS(0x14) /* Status reg */
30 30
31 31
32static __inline__ void putc(char c) 32static inline void putc(int c)
33{ 33{
34 int j = 0x1000; 34 int j = 0x1000;
35 35
36 while (--j && !(*UARTSR & UART_LSR_THRE)); 36 while (--j && !(*UARTSR & UART_LSR_THRE))
37 barrier();
38
37 *UARTDR = c; 39 *UARTDR = c;
38} 40}
39 41
40static void putstr(const char *s) 42static inline void flush(void)
41{ 43{
42 while (*s)
43 {
44 putc(*s);
45 if (*s == '\n')
46 putc('\r');
47 s++;
48 }
49} 44}
50 45
51#define arch_decomp_setup() 46#define arch_decomp_setup()
diff --git a/include/asm-arm/arch-ixp23xx/debug-macro.S b/include/asm-arm/arch-ixp23xx/debug-macro.S
new file mode 100644
index 000000000000..eb99fd69fd24
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/debug-macro.S
@@ -0,0 +1,23 @@
1/*
2 * include/asm-arm/arch-ixp23xx/debug-macro.S
3 *
4 * Debugging macro include header
5 *
6 * Copyright (C) 1994-1999 Russell King
7 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
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 version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <asm/arch/ixp23xx.h>
14
15 .macro addruart,rx
16 mrc p15, 0, \rx, c1, c0
17 tst \rx, #1 @ mmu enabled?
18 ldreq \rx, =IXP23XX_PERIPHERAL_PHYS @ physical
19 ldrne \rx, =IXP23XX_PERIPHERAL_VIRT @ virtual
20 .endm
21
22#define UART_SHIFT 2
23#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-ixp23xx/dma.h b/include/asm-arm/arch-ixp23xx/dma.h
new file mode 100644
index 000000000000..2f4335e3b836
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/dma.h
@@ -0,0 +1,3 @@
1/*
2 * include/asm-arm/arch-ixp23xx/dma.h
3 */
diff --git a/include/asm-arm/arch-ixp23xx/entry-macro.S b/include/asm-arm/arch-ixp23xx/entry-macro.S
new file mode 100644
index 000000000000..0ef4e6016ac4
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/entry-macro.S
@@ -0,0 +1,31 @@
1/*
2 * include/asm-arm/arch-ixp23xx/entry-macro.S
3 */
4
5 .macro disable_fiq
6 .endm
7
8 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
9 ldr \irqnr, =(IXP23XX_INTC_VIRT + IXP23XX_INTR_IRQ_ENC_ST_OFFSET)
10 ldr \irqnr, [\irqnr] @ get interrupt number
11 cmp \irqnr, #0x0 @ suprious interrupt ?
12 movne \irqnr, \irqnr, lsr #2 @ skip unwanted low order bits
13 subne \irqnr, \irqnr, #1 @ convert to 0 based
14
15#if 0
16 cmp \irqnr, #IRQ_IXP23XX_PCI_INT_RPH
17 bne 1001f
18 mov \irqnr, #IRQ_IXP23XX_INTA
19
20 ldr \irqnr, =0xf5000030
21
22 mov \tmp, #(1<<26)
23 tst \irqnr, \tmp
24 movne \irqnr, #IRQ_IXP23XX_INTB
25
26 mov \tmp, #(1<<27)
27 tst \irqnr, \tmp
28 movne \irqnr, #IRQ_IXP23XX_INTA
291001:
30#endif
31 .endm
diff --git a/include/asm-arm/arch-ixp23xx/hardware.h b/include/asm-arm/arch-ixp23xx/hardware.h
new file mode 100644
index 000000000000..c0010d21a684
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/hardware.h
@@ -0,0 +1,37 @@
1/*
2 * include/asm-arm/arch-ixp23xx/hardware.h
3 *
4 * Copyright (C) 2002-2004 Intel Corporation.
5 * Copyricht (C) 2005 MontaVista Software, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Hardware definitions for IXP23XX based systems
12 */
13
14#ifndef __ASM_ARCH_HARDWARE_H
15#define __ASM_ARCH_HARDWARE_H
16
17/* PCI IO info */
18#define PCIO_BASE IXP23XX_PCI_IO_VIRT
19#define PCIBIOS_MIN_IO 0x00000000
20#define PCIBIOS_MIN_MEM 0xe0000000
21
22#include "ixp23xx.h"
23
24#define pcibios_assign_all_busses() 0
25
26/*
27 * Platform helper functions
28 */
29#include "platform.h"
30
31/*
32 * Platform-specific headers
33 */
34#include "ixdp2351.h"
35
36
37#endif
diff --git a/include/asm-arm/arch-ixp23xx/io.h b/include/asm-arm/arch-ixp23xx/io.h
new file mode 100644
index 000000000000..18415a81ac74
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/io.h
@@ -0,0 +1,54 @@
1/*
2 * include/asm-arm/arch-ixp23xx/io.h
3 *
4 * Original Author: Naeem M Afzal <naeem.m.afzal@intel.com>
5 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
6 *
7 * Copyright (C) 2003-2005 Intel Corp.
8 * Copyright (C) 2005 MontaVista Software, Inc
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_ARCH_IO_H
16#define __ASM_ARCH_IO_H
17
18#define IO_SPACE_LIMIT 0xffffffff
19
20#define __io(p) ((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT))
21#define __mem_pci(a) (a)
22
23#include <linux/kernel.h> /* For BUG */
24
25static inline void __iomem *
26ixp23xx_ioremap(unsigned long addr, unsigned long size, unsigned long flags)
27{
28 if (addr >= IXP23XX_PCI_MEM_START &&
29 addr <= IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE) {
30 if (addr + size > IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE)
31 return NULL;
32
33 return (void __iomem *)
34 ((addr - IXP23XX_PCI_MEM_START) + IXP23XX_PCI_MEM_VIRT);
35 }
36
37 return __ioremap(addr, size, flags);
38}
39
40static inline void
41ixp23xx_iounmap(void __iomem *addr)
42{
43 if ((((u32)addr) >= IXP23XX_PCI_MEM_VIRT) &&
44 (((u32)addr) < IXP23XX_PCI_MEM_VIRT + IXP23XX_PCI_MEM_SIZE))
45 return;
46
47 __iounmap(addr);
48}
49
50#define __arch_ioremap(a,s,f) ixp23xx_ioremap(a,s,f)
51#define __arch_iounmap(a) ixp23xx_iounmap(a)
52
53
54#endif
diff --git a/include/asm-arm/arch-ixp23xx/irqs.h b/include/asm-arm/arch-ixp23xx/irqs.h
new file mode 100644
index 000000000000..e69639585721
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/irqs.h
@@ -0,0 +1,223 @@
1/*
2 * include/asm-arm/arch-ixp23xx/irqs.h
3 *
4 * IRQ definitions for IXP23XX based systems
5 *
6 * Author: Naeem Afzal <naeem.m.afzal@intel.com>
7 *
8 * Copyright (C) 2003-2004 Intel Corporation.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_ARCH_IRQS_H
16#define __ASM_ARCH_IRQS_H
17
18#define NR_IXP23XX_IRQS IRQ_IXP23XX_INTB+1
19#define IRQ_IXP23XX_EXTIRQS NR_IXP23XX_IRQS
20
21
22#define IRQ_IXP23XX_DBG0 0 /* Debug/Execution/MBox */
23#define IRQ_IXP23XX_DBG1 1 /* Debug/Execution/MBox */
24#define IRQ_IXP23XX_NPE_TRG 2 /* npe_trigger */
25#define IRQ_IXP23XX_TIMER1 3 /* Timer[0] */
26#define IRQ_IXP23XX_TIMER2 4 /* Timer[1] */
27#define IRQ_IXP23XX_TIMESTAMP 5 /* Timer[2], Time-stamp */
28#define IRQ_IXP23XX_WDOG 6 /* Time[3], Watchdog Timer */
29#define IRQ_IXP23XX_PCI_DBELL 7 /* PCI Doorbell */
30#define IRQ_IXP23XX_PCI_DMA1 8 /* PCI DMA Channel 1 */
31#define IRQ_IXP23XX_PCI_DMA2 9 /* PCI DMA Channel 2 */
32#define IRQ_IXP23XX_PCI_DMA3 10 /* PCI DMA Channel 3 */
33#define IRQ_IXP23XX_PCI_INT_RPH 11 /* pcxg_pci_int_rph */
34#define IRQ_IXP23XX_CPP_PMU 12 /* xpxg_pm_int_rpl */
35#define IRQ_IXP23XX_SWINT0 13 /* S/W Interrupt0 */
36#define IRQ_IXP23XX_SWINT1 14 /* S/W Interrupt1 */
37#define IRQ_IXP23XX_UART2 15 /* UART1 Interrupt */
38#define IRQ_IXP23XX_UART1 16 /* UART0 Interrupt */
39#define IRQ_IXP23XX_XSI_PMU_ROLLOVER 17 /* AHB Performance M. Unit counter rollover */
40#define IRQ_IXP23XX_XSI_AHB_PM0 18 /* intr_pm_o */
41#define IRQ_IXP23XX_XSI_AHB_ECE0 19 /* intr_ece_o */
42#define IRQ_IXP23XX_XSI_AHB_GASKET 20 /* gas_intr_o */
43#define IRQ_IXP23XX_XSI_CPP 21 /* xsi2cpp_int */
44#define IRQ_IXP23XX_CPP_XSI 22 /* cpp2xsi_int */
45#define IRQ_IXP23XX_ME_ATTN0 23 /* ME_ATTN */
46#define IRQ_IXP23XX_ME_ATTN1 24 /* ME_ATTN */
47#define IRQ_IXP23XX_ME_ATTN2 25 /* ME_ATTN */
48#define IRQ_IXP23XX_ME_ATTN3 26 /* ME_ATTN */
49#define IRQ_IXP23XX_PCI_ERR_RPH 27 /* PCXG_PCI_ERR_RPH */
50#define IRQ_IXP23XX_D0XG_ECC_CORR 28 /* D0XG_DRAM_ECC_CORR */
51#define IRQ_IXP23XX_D0XG_ECC_UNCORR 29 /* D0XG_DRAM_ECC_UNCORR */
52#define IRQ_IXP23XX_SRAM_ERR1 30 /* SRAM1_ERR */
53#define IRQ_IXP23XX_SRAM_ERR0 31 /* SRAM0_ERR */
54#define IRQ_IXP23XX_MEDIA_ERR 32 /* MEDIA_ERR */
55#define IRQ_IXP23XX_STH_DRAM_ECC_MAJ 33 /* STH_DRAM0_ECC_MAJ */
56#define IRQ_IXP23XX_GPIO6 34 /* GPIO0 interrupts */
57#define IRQ_IXP23XX_GPIO7 35 /* GPIO1 interrupts */
58#define IRQ_IXP23XX_GPIO8 36 /* GPIO2 interrupts */
59#define IRQ_IXP23XX_GPIO9 37 /* GPIO3 interrupts */
60#define IRQ_IXP23XX_GPIO10 38 /* GPIO4 interrupts */
61#define IRQ_IXP23XX_GPIO11 39 /* GPIO5 interrupts */
62#define IRQ_IXP23XX_GPIO12 40 /* GPIO6 interrupts */
63#define IRQ_IXP23XX_GPIO13 41 /* GPIO7 interrupts */
64#define IRQ_IXP23XX_GPIO14 42 /* GPIO8 interrupts */
65#define IRQ_IXP23XX_GPIO15 43 /* GPIO9 interrupts */
66#define IRQ_IXP23XX_SHAC_RING0 44 /* SHAC Ring Full */
67#define IRQ_IXP23XX_SHAC_RING1 45 /* SHAC Ring Full */
68#define IRQ_IXP23XX_SHAC_RING2 46 /* SHAC Ring Full */
69#define IRQ_IXP23XX_SHAC_RING3 47 /* SHAC Ring Full */
70#define IRQ_IXP23XX_SHAC_RING4 48 /* SHAC Ring Full */
71#define IRQ_IXP23XX_SHAC_RING5 49 /* SHAC Ring Full */
72#define IRQ_IXP23XX_SHAC_RING6 50 /* SHAC RING Full */
73#define IRQ_IXP23XX_SHAC_RING7 51 /* SHAC Ring Full */
74#define IRQ_IXP23XX_SHAC_RING8 52 /* SHAC Ring Full */
75#define IRQ_IXP23XX_SHAC_RING9 53 /* SHAC Ring Full */
76#define IRQ_IXP23XX_SHAC_RING10 54 /* SHAC Ring Full */
77#define IRQ_IXP23XX_SHAC_RING11 55 /* SHAC Ring Full */
78#define IRQ_IXP23XX_ME_THREAD_A0_ME0 56 /* ME_THREAD_A */
79#define IRQ_IXP23XX_ME_THREAD_A1_ME0 57 /* ME_THREAD_A */
80#define IRQ_IXP23XX_ME_THREAD_A2_ME0 58 /* ME_THREAD_A */
81#define IRQ_IXP23XX_ME_THREAD_A3_ME0 59 /* ME_THREAD_A */
82#define IRQ_IXP23XX_ME_THREAD_A4_ME0 60 /* ME_THREAD_A */
83#define IRQ_IXP23XX_ME_THREAD_A5_ME0 61 /* ME_THREAD_A */
84#define IRQ_IXP23XX_ME_THREAD_A6_ME0 62 /* ME_THREAD_A */
85#define IRQ_IXP23XX_ME_THREAD_A7_ME0 63 /* ME_THREAD_A */
86#define IRQ_IXP23XX_ME_THREAD_A8_ME1 64 /* ME_THREAD_A */
87#define IRQ_IXP23XX_ME_THREAD_A9_ME1 65 /* ME_THREAD_A */
88#define IRQ_IXP23XX_ME_THREAD_A10_ME1 66 /* ME_THREAD_A */
89#define IRQ_IXP23XX_ME_THREAD_A11_ME1 67 /* ME_THREAD_A */
90#define IRQ_IXP23XX_ME_THREAD_A12_ME1 68 /* ME_THREAD_A */
91#define IRQ_IXP23XX_ME_THREAD_A13_ME1 69 /* ME_THREAD_A */
92#define IRQ_IXP23XX_ME_THREAD_A14_ME1 70 /* ME_THREAD_A */
93#define IRQ_IXP23XX_ME_THREAD_A15_ME1 71 /* ME_THREAD_A */
94#define IRQ_IXP23XX_ME_THREAD_A16_ME2 72 /* ME_THREAD_A */
95#define IRQ_IXP23XX_ME_THREAD_A17_ME2 73 /* ME_THREAD_A */
96#define IRQ_IXP23XX_ME_THREAD_A18_ME2 74 /* ME_THREAD_A */
97#define IRQ_IXP23XX_ME_THREAD_A19_ME2 75 /* ME_THREAD_A */
98#define IRQ_IXP23XX_ME_THREAD_A20_ME2 76 /* ME_THREAD_A */
99#define IRQ_IXP23XX_ME_THREAD_A21_ME2 77 /* ME_THREAD_A */
100#define IRQ_IXP23XX_ME_THREAD_A22_ME2 78 /* ME_THREAD_A */
101#define IRQ_IXP23XX_ME_THREAD_A23_ME2 79 /* ME_THREAD_A */
102#define IRQ_IXP23XX_ME_THREAD_A24_ME3 80 /* ME_THREAD_A */
103#define IRQ_IXP23XX_ME_THREAD_A25_ME3 81 /* ME_THREAD_A */
104#define IRQ_IXP23XX_ME_THREAD_A26_ME3 82 /* ME_THREAD_A */
105#define IRQ_IXP23XX_ME_THREAD_A27_ME3 83 /* ME_THREAD_A */
106#define IRQ_IXP23XX_ME_THREAD_A28_ME3 84 /* ME_THREAD_A */
107#define IRQ_IXP23XX_ME_THREAD_A29_ME3 85 /* ME_THREAD_A */
108#define IRQ_IXP23XX_ME_THREAD_A30_ME3 86 /* ME_THREAD_A */
109#define IRQ_IXP23XX_ME_THREAD_A31_ME3 87 /* ME_THREAD_A */
110#define IRQ_IXP23XX_ME_THREAD_B0_ME0 88 /* ME_THREAD_B */
111#define IRQ_IXP23XX_ME_THREAD_B1_ME0 89 /* ME_THREAD_B */
112#define IRQ_IXP23XX_ME_THREAD_B2_ME0 90 /* ME_THREAD_B */
113#define IRQ_IXP23XX_ME_THREAD_B3_ME0 91 /* ME_THREAD_B */
114#define IRQ_IXP23XX_ME_THREAD_B4_ME0 92 /* ME_THREAD_B */
115#define IRQ_IXP23XX_ME_THREAD_B5_ME0 93 /* ME_THREAD_B */
116#define IRQ_IXP23XX_ME_THREAD_B6_ME0 94 /* ME_THREAD_B */
117#define IRQ_IXP23XX_ME_THREAD_B7_ME0 95 /* ME_THREAD_B */
118#define IRQ_IXP23XX_ME_THREAD_B8_ME1 96 /* ME_THREAD_B */
119#define IRQ_IXP23XX_ME_THREAD_B9_ME1 97 /* ME_THREAD_B */
120#define IRQ_IXP23XX_ME_THREAD_B10_ME1 98 /* ME_THREAD_B */
121#define IRQ_IXP23XX_ME_THREAD_B11_ME1 99 /* ME_THREAD_B */
122#define IRQ_IXP23XX_ME_THREAD_B12_ME1 100 /* ME_THREAD_B */
123#define IRQ_IXP23XX_ME_THREAD_B13_ME1 101 /* ME_THREAD_B */
124#define IRQ_IXP23XX_ME_THREAD_B14_ME1 102 /* ME_THREAD_B */
125#define IRQ_IXP23XX_ME_THREAD_B15_ME1 103 /* ME_THREAD_B */
126#define IRQ_IXP23XX_ME_THREAD_B16_ME2 104 /* ME_THREAD_B */
127#define IRQ_IXP23XX_ME_THREAD_B17_ME2 105 /* ME_THREAD_B */
128#define IRQ_IXP23XX_ME_THREAD_B18_ME2 106 /* ME_THREAD_B */
129#define IRQ_IXP23XX_ME_THREAD_B19_ME2 107 /* ME_THREAD_B */
130#define IRQ_IXP23XX_ME_THREAD_B20_ME2 108 /* ME_THREAD_B */
131#define IRQ_IXP23XX_ME_THREAD_B21_ME2 109 /* ME_THREAD_B */
132#define IRQ_IXP23XX_ME_THREAD_B22_ME2 110 /* ME_THREAD_B */
133#define IRQ_IXP23XX_ME_THREAD_B23_ME2 111 /* ME_THREAD_B */
134#define IRQ_IXP23XX_ME_THREAD_B24_ME3 112 /* ME_THREAD_B */
135#define IRQ_IXP23XX_ME_THREAD_B25_ME3 113 /* ME_THREAD_B */
136#define IRQ_IXP23XX_ME_THREAD_B26_ME3 114 /* ME_THREAD_B */
137#define IRQ_IXP23XX_ME_THREAD_B27_ME3 115 /* ME_THREAD_B */
138#define IRQ_IXP23XX_ME_THREAD_B28_ME3 116 /* ME_THREAD_B */
139#define IRQ_IXP23XX_ME_THREAD_B29_ME3 117 /* ME_THREAD_B */
140#define IRQ_IXP23XX_ME_THREAD_B30_ME3 118 /* ME_THREAD_B */
141#define IRQ_IXP23XX_ME_THREAD_B31_ME3 119 /* ME_THREAD_B */
142
143#define NUM_IXP23XX_RAW_IRQS 120
144
145#define IRQ_IXP23XX_INTA 120 /* Indirect pcxg_pci_int_rph */
146#define IRQ_IXP23XX_INTB 121 /* Indirect pcxg_pci_int_rph */
147
148#define NR_IXP23XX_IRQ (IRQ_IXP23XX_INTB + 1)
149
150/*
151 * We default to 32 per-board IRQs. Increase this number if you need
152 * more, but keep it realistic.
153 */
154#define NR_IXP23XX_MACH_IRQS 32
155
156#define NR_IRQS NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS
157
158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq))
159
160
161/*
162 * IXDP2351-specific interrupts
163 */
164
165/*
166 * External PCI interrupts signaled through INTB
167 *
168 */
169#define IXDP2351_INTB_IRQ_BASE 0
170#define IRQ_IXDP2351_INTA_82546 IXP23XX_MACH_IRQ(0)
171#define IRQ_IXDP2351_INTB_82546 IXP23XX_MACH_IRQ(1)
172#define IRQ_IXDP2351_SPCI_DB_0 IXP23XX_MACH_IRQ(2)
173#define IRQ_IXDP2351_SPCI_DB_1 IXP23XX_MACH_IRQ(3)
174#define IRQ_IXDP2351_SPCI_PMC_INTA IXP23XX_MACH_IRQ(4)
175#define IRQ_IXDP2351_SPCI_PMC_INTB IXP23XX_MACH_IRQ(5)
176#define IRQ_IXDP2351_SPCI_PMC_INTC IXP23XX_MACH_IRQ(6)
177#define IRQ_IXDP2351_SPCI_PMC_INTD IXP23XX_MACH_IRQ(7)
178#define IRQ_IXDP2351_SPCI_FIC IXP23XX_MACH_IRQ(8)
179
180#define IXDP2351_INTB_IRQ_BIT(irq) (irq - IXP23XX_MACH_IRQ(0))
181#define IXDP2351_INTB_IRQ_MASK(irq) (1 << IXDP2351_INTB_IRQ_BIT(irq))
182#define IXDP2351_INTB_IRQ_VALID 0x01FF
183#define IXDP2351_INTB_IRQ_NUM 16
184
185/*
186 * Other external interrupts signaled through INTA
187 */
188#define IXDP2351_INTA_IRQ_BASE 16
189#define IRQ_IXDP2351_IPMI_FROM IXP23XX_MACH_IRQ(16)
190#define IRQ_IXDP2351_125US IXP23XX_MACH_IRQ(17)
191#define IRQ_IXDP2351_DB_0_ADD IXP23XX_MACH_IRQ(18)
192#define IRQ_IXDP2351_DB_1_ADD IXP23XX_MACH_IRQ(19)
193#define IRQ_IXDP2351_DEBUG1 IXP23XX_MACH_IRQ(20)
194#define IRQ_IXDP2351_ADD_UART IXP23XX_MACH_IRQ(21)
195#define IRQ_IXDP2351_FIC_ADD IXP23XX_MACH_IRQ(24)
196#define IRQ_IXDP2351_CS8900 IXP23XX_MACH_IRQ(25)
197#define IRQ_IXDP2351_BBSRAM IXP23XX_MACH_IRQ(26)
198#define IRQ_IXDP2351_CONFIG_MEDIA IXP23XX_MACH_IRQ(27)
199#define IRQ_IXDP2351_CLOCK_REF IXP23XX_MACH_IRQ(28)
200#define IRQ_IXDP2351_A10_NP IXP23XX_MACH_IRQ(29)
201#define IRQ_IXDP2351_A11_NP IXP23XX_MACH_IRQ(30)
202#define IRQ_IXDP2351_DEBUG_NP IXP23XX_MACH_IRQ(31)
203
204#define IXDP2351_INTA_IRQ_BIT(irq) (irq - IXP23XX_MACH_IRQ(16))
205#define IXDP2351_INTA_IRQ_MASK(irq) (1 << IXDP2351_INTA_IRQ_BIT(irq))
206#define IXDP2351_INTA_IRQ_VALID 0xFF3F
207#define IXDP2351_INTA_IRQ_NUM 16
208
209
210/*
211 * ADI RoadRunner IRQs
212 */
213#define IRQ_ROADRUNNER_PCI_INTA IRQ_IXP23XX_INTA
214#define IRQ_ROADRUNNER_PCI_INTB IRQ_IXP23XX_INTB
215#define IRQ_ROADRUNNER_PCI_INTC IRQ_IXP23XX_GPIO11
216#define IRQ_ROADRUNNER_PCI_INTD IRQ_IXP23XX_GPIO12
217
218/*
219 * Put new board definitions here
220 */
221
222
223#endif
diff --git a/include/asm-arm/arch-ixp23xx/ixdp2351.h b/include/asm-arm/arch-ixp23xx/ixdp2351.h
new file mode 100644
index 000000000000..4a24f8f15655
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/ixdp2351.h
@@ -0,0 +1,89 @@
1/*
2 * include/asm-arm/arch-ixp23xx/ixdp2351.h
3 *
4 * Register and other defines for IXDP2351
5 *
6 * Copyright (c) 2002-2004 Intel Corp.
7 * Copytight (c) 2005 MontaVista Software, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#ifndef __ASM_ARCH_IXDP2351_H
16#define __ASM_ARCH_IXDP2351_H
17
18/*
19 * NP module memory map
20 */
21#define IXDP2351_NP_PHYS_BASE (IXP23XX_EXP_BUS_CS4_BASE)
22#define IXDP2351_NP_PHYS_SIZE 0x00100000
23#define IXDP2351_NP_VIRT_BASE 0xeff00000
24
25#define IXDP2351_VIRT_CS8900_BASE (IXDP2351_NP_VIRT_BASE)
26#define IXDP2351_VIRT_CS8900_END (IXDP2351_VIRT_CS8900_BASE + 16)
27
28#define IXDP2351_VIRT_NP_CPLD_BASE (IXP23XX_EXP_BUS_CS4_BASE_VIRT + 0x00010000)
29
30#define IXDP2351_NP_CPLD_REG(reg) ((volatile u16 *)(IXDP2351_VIRT_NP_CPLD_BASE + reg))
31
32#define IXDP2351_NP_CPLD_RESET1_REG IXDP2351_NP_CPLD_REG(0x00)
33#define IXDP2351_NP_CPLD_LED_REG IXDP2351_NP_CPLD_REG(0x02)
34#define IXDP2351_NP_CPLD_VERSION_REG IXDP2351_NP_CPLD_REG(0x04)
35
36/*
37 * Base board module memory map
38 */
39
40#define IXDP2351_BB_BASE_PHYS (IXP23XX_EXP_BUS_CS5_BASE)
41#define IXDP2351_BB_SIZE 0x01000000
42#define IXDP2351_BB_BASE_VIRT (0xee000000)
43
44#define IXDP2351_BB_AREA_BASE(offset) (IXDP2351_BB_BASE_VIRT + offset)
45
46#define IXDP2351_VIRT_NVRAM_BASE IXDP2351_BB_AREA_BASE(0x0)
47#define IXDP2351_NVRAM_SIZE (0x20000)
48
49#define IXDP2351_VIRT_MB_IXF1104_BASE IXDP3251_BB_AREA_BASE(0x00020000)
50#define IXDP2351_VIRT_ADD_UART_BASE IXDP2351_BB_AREA_BASE(0x000240C0)
51#define IXDP2351_VIRT_FIC_BASE IXDP2351_BB_AREA_BASE(0x00200000)
52#define IXDP2351_VIRT_DB0_BASE IXDP2351_BB_AREA_BASE(0x00400000)
53#define IXDP2351_VIRT_DB1_BASE IXDP2351_BB_AREA_BASE(0x00600000)
54#define IXDP2351_VIRT_CPLD_BASE IXDP2351_BB_AREA_BASE(0x00024000)
55
56/*
57 * On board CPLD registers
58 */
59#define IXDP2351_CPLD_BB_REG(reg) ((volatile u16 *)(IXDP2351_VIRT_CPLD_BASE + reg))
60
61#define IXDP2351_CPLD_RESET0_REG IXDP2351_CPLD_BB_REG(0x00)
62#define IXDP2351_CPLD_RESET1_REG IXDP2351_CPLD_BB_REG(0x04)
63
64#define IXDP2351_CPLD_RESET1_MAGIC 0x55AA
65#define IXDP2351_CPLD_RESET1_ENABLE 0x8000
66
67#define IXDP2351_CPLD_FPGA_CONFIG_REG IXDP2351_CPLD_BB_REG(0x08)
68#define IXDP2351_CPLD_INTB_MASK_SET_REG IXDP2351_CPLD_BB_REG(0x10)
69#define IXDP2351_CPLD_INTA_MASK_SET_REG IXDP2351_CPLD_BB_REG(0x14)
70#define IXDP2351_CPLD_INTB_STAT_REG IXDP2351_CPLD_BB_REG(0x18)
71#define IXDP2351_CPLD_INTA_STAT_REG IXDP2351_CPLD_BB_REG(0x1C)
72#define IXDP2351_CPLD_INTB_RAW_REG IXDP2351_CPLD_BB_REG(0x20) /* read */
73#define IXDP2351_CPLD_INTA_RAW_REG IXDP2351_CPLD_BB_REG(0x24) /* read */
74#define IXDP2351_CPLD_INTB_MASK_CLR_REG IXDP2351_CPLD_INTB_RAW_REG /* write */
75#define IXDP2351_CPLD_INTA_MASK_CLR_REG IXDP2351_CPLD_INTA_RAW_REG /* write */
76#define IXDP2351_CPLD_INTB_SIM_REG IXDP2351_CPLD_BB_REG(0x28)
77#define IXDP2351_CPLD_INTA_SIM_REG IXDP2351_CPLD_BB_REG(0x2C)
78 /* Interrupt bits are defined in irqs.h */
79#define IXDP2351_CPLD_BB_GBE0_REG IXDP2351_CPLD_BB_REG(0x30)
80#define IXDP2351_CPLD_BB_GBE1_REG IXDP2351_CPLD_BB_REG(0x34)
81
82/* #define IXDP2351_CPLD_BB_MISC_REG IXDP2351_CPLD_REG(0x1C) */
83/* #define IXDP2351_CPLD_BB_MISC_REV_MASK 0xFF */
84/* #define IXDP2351_CPLD_BB_GDXCS0_REG IXDP2351_CPLD_REG(0x24) */
85/* #define IXDP2351_CPLD_BB_GDXCS1_REG IXDP2351_CPLD_REG(0x28) */
86/* #define IXDP2351_CPLD_BB_CLOCK_REG IXDP2351_CPLD_REG(0x04) */
87
88
89#endif
diff --git a/include/asm-arm/arch-ixp23xx/ixp23xx.h b/include/asm-arm/arch-ixp23xx/ixp23xx.h
new file mode 100644
index 000000000000..e49e1ca61b1a
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/ixp23xx.h
@@ -0,0 +1,306 @@
1/*
2 * include/asm-arm/arch-ixp23xx/ixp23xx.h
3 *
4 * Register definitions for IXP23XX
5 *
6 * Copyright (C) 2003-2005 Intel Corporation.
7 * Copyright (C) 2005 MontaVista Software, Inc.
8 *
9 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
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 version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __ASM_ARCH_IXP23XX_H
17#define __ASM_ARCH_IXP23XX_H
18
19/*
20 * IXP2300 linux memory map:
21 *
22 * virt phys size
23 * fffd0000 a0000000 64K XSI2CPP_CSR
24 * fffc0000 c4000000 4K EXP_CFG
25 * fff00000 c8000000 64K PERIPHERAL
26 * fe000000 1c0000000 16M CAP_CSR
27 * fd000000 1c8000000 16M MSF_CSR
28 * fb000000 16M ---
29 * fa000000 1d8000000 32M PCI_IO
30 * f8000000 1da000000 32M PCI_CFG
31 * f6000000 1de000000 32M PCI_CREG
32 * f4000000 32M ---
33 * f0000000 1e0000000 64M PCI_MEM
34 * e[c-f]000000 per-platform mappings
35 */
36
37
38/****************************************************************************
39 * Static mappings.
40 ****************************************************************************/
41#define IXP23XX_XSI2CPP_CSR_PHYS 0xa0000000
42#define IXP23XX_XSI2CPP_CSR_VIRT 0xfffd0000
43#define IXP23XX_XSI2CPP_CSR_SIZE 0x00010000
44
45#define IXP23XX_EXP_CFG_PHYS 0xc4000000
46#define IXP23XX_EXP_CFG_VIRT 0xfffc0000
47#define IXP23XX_EXP_CFG_SIZE 0x00001000
48
49#define IXP23XX_PERIPHERAL_PHYS 0xc8000000
50#define IXP23XX_PERIPHERAL_VIRT 0xfff00000
51#define IXP23XX_PERIPHERAL_SIZE 0x00010000
52
53#define IXP23XX_CAP_CSR_PHYS 0x1c0000000ULL
54#define IXP23XX_CAP_CSR_VIRT 0xfe000000
55#define IXP23XX_CAP_CSR_SIZE 0x01000000
56
57#define IXP23XX_MSF_CSR_PHYS 0x1c8000000ULL
58#define IXP23XX_MSF_CSR_VIRT 0xfd000000
59#define IXP23XX_MSF_CSR_SIZE 0x01000000
60
61#define IXP23XX_PCI_IO_PHYS 0x1d8000000ULL
62#define IXP23XX_PCI_IO_VIRT 0xfa000000
63#define IXP23XX_PCI_IO_SIZE 0x02000000
64
65#define IXP23XX_PCI_CFG_PHYS 0x1da000000ULL
66#define IXP23XX_PCI_CFG_VIRT 0xf8000000
67#define IXP23XX_PCI_CFG_SIZE 0x02000000
68#define IXP23XX_PCI_CFG0_VIRT IXP23XX_PCI_CFG_VIRT
69#define IXP23XX_PCI_CFG1_VIRT (IXP23XX_PCI_CFG_VIRT + 0x01000000)
70
71#define IXP23XX_PCI_CREG_PHYS 0x1de000000ULL
72#define IXP23XX_PCI_CREG_VIRT 0xf6000000
73#define IXP23XX_PCI_CREG_SIZE 0x02000000
74#define IXP23XX_PCI_CSR_VIRT (IXP23XX_PCI_CREG_VIRT + 0x01000000)
75
76#define IXP23XX_PCI_MEM_START 0xe0000000
77#define IXP23XX_PCI_MEM_PHYS 0x1e0000000ULL
78#define IXP23XX_PCI_MEM_VIRT 0xf0000000
79#define IXP23XX_PCI_MEM_SIZE 0x04000000
80
81
82/****************************************************************************
83 * XSI2CPP CSRs.
84 ****************************************************************************/
85#define IXP23XX_XSI2CPP_REG(x) ((volatile unsigned long *)(IXP23XX_XSI2CPP_CSR_VIRT + (x)))
86#define IXP23XX_CPP2XSI_CURR_XFER_REG3 IXP23XX_XSI2CPP_REG(0xf8)
87#define IXP23XX_CPP2XSI_ADDR_31 (1 << 19)
88#define IXP23XX_CPP2XSI_PSH_OFF (1 << 20)
89#define IXP23XX_CPP2XSI_COH_OFF (1 << 21)
90
91
92/****************************************************************************
93 * Expansion Bus Config.
94 ****************************************************************************/
95#define IXP23XX_EXP_CFG_REG(x) ((volatile unsigned long *)(IXP23XX_EXP_CFG_VIRT + (x)))
96#define IXP23XX_EXP_CS0 IXP23XX_EXP_CFG_REG(0x00)
97#define IXP23XX_EXP_CS1 IXP23XX_EXP_CFG_REG(0x04)
98#define IXP23XX_EXP_CS2 IXP23XX_EXP_CFG_REG(0x08)
99#define IXP23XX_EXP_CS3 IXP23XX_EXP_CFG_REG(0x0c)
100#define IXP23XX_EXP_CS4 IXP23XX_EXP_CFG_REG(0x10)
101#define IXP23XX_EXP_CS5 IXP23XX_EXP_CFG_REG(0x14)
102#define IXP23XX_EXP_CS6 IXP23XX_EXP_CFG_REG(0x18)
103#define IXP23XX_EXP_CS7 IXP23XX_EXP_CFG_REG(0x1c)
104#define IXP23XX_FLASH_WRITABLE (0x2)
105#define IXP23XX_FLASH_BUS8 (0x1)
106
107#define IXP23XX_EXP_CFG0 IXP23XX_EXP_CFG_REG(0x20)
108#define IXP23XX_EXP_CFG1 IXP23XX_EXP_CFG_REG(0x24)
109#define IXP23XX_EXP_CFG0_MEM_MAP (1 << 31)
110#define IXP23XX_EXP_CFG0_XSCALE_SPEED_SEL (3 << 22)
111#define IXP23XX_EXP_CFG0_XSCALE_SPEED_EN (1 << 21)
112#define IXP23XX_EXP_CFG0_CPP_SPEED_SEL (3 << 19)
113#define IXP23XX_EXP_CFG0_CPP_SPEED_EN (1 << 18)
114#define IXP23XX_EXP_CFG0_PCI_SWIN (3 << 16)
115#define IXP23XX_EXP_CFG0_PCI_DWIN (3 << 14)
116#define IXP23XX_EXP_CFG0_PCI33_MODE (1 << 13)
117#define IXP23XX_EXP_CFG0_QDR_SPEED_SEL (1 << 12)
118#define IXP23XX_EXP_CFG0_CPP_DIV_SEL (1 << 5)
119#define IXP23XX_EXP_CFG0_XSI_NOT_PRES (1 << 4)
120#define IXP23XX_EXP_CFG0_PROM_BOOT (1 << 3)
121#define IXP23XX_EXP_CFG0_PCI_ARB (1 << 2)
122#define IXP23XX_EXP_CFG0_PCI_HOST (1 << 1)
123#define IXP23XX_EXP_CFG0_FLASH_WIDTH (1 << 0)
124
125#define IXP23XX_EXP_UNIT_FUSE IXP23XX_EXP_CFG_REG(0x28)
126#define IXP23XX_EXP_MSF_MUX IXP23XX_EXP_CFG_REG(0x30)
127
128#define IXP23XX_EXP_BUS_PHYS 0x90000000
129#define IXP23XX_EXP_BUS_WINDOW_SIZE 0x01000000
130
131#define IXP23XX_EXP_BUS_CS0_BASE (IXP23XX_EXP_BUS_PHYS + 0x00000000)
132#define IXP23XX_EXP_BUS_CS1_BASE (IXP23XX_EXP_BUS_PHYS + 0x01000000)
133#define IXP23XX_EXP_BUS_CS2_BASE (IXP23XX_EXP_BUS_PHYS + 0x02000000)
134#define IXP23XX_EXP_BUS_CS3_BASE (IXP23XX_EXP_BUS_PHYS + 0x03000000)
135#define IXP23XX_EXP_BUS_CS4_BASE (IXP23XX_EXP_BUS_PHYS + 0x04000000)
136#define IXP23XX_EXP_BUS_CS5_BASE (IXP23XX_EXP_BUS_PHYS + 0x05000000)
137#define IXP23XX_EXP_BUS_CS6_BASE (IXP23XX_EXP_BUS_PHYS + 0x06000000)
138#define IXP23XX_EXP_BUS_CS7_BASE (IXP23XX_EXP_BUS_PHYS + 0x07000000)
139
140
141/****************************************************************************
142 * Peripherals.
143 ****************************************************************************/
144#define IXP23XX_UART1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x0000)
145#define IXP23XX_UART2_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x1000)
146#define IXP23XX_PMU_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x2000)
147#define IXP23XX_INTC_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x3000)
148#define IXP23XX_GPIO_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x4000)
149#define IXP23XX_TIMER_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x5000)
150#define IXP23XX_NPE0_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x6000)
151#define IXP23XX_DSR_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x7000)
152#define IXP23XX_NPE1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x8000)
153#define IXP23XX_ETH0_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x9000)
154#define IXP23XX_ETH1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xA000)
155#define IXP23XX_GIG0_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xB000)
156#define IXP23XX_GIG1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xC000)
157#define IXP23XX_DDRS_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xD000)
158
159#define IXP23XX_UART1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x0000)
160#define IXP23XX_UART2_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x1000)
161#define IXP23XX_PMU_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x2000)
162#define IXP23XX_INTC_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x3000)
163#define IXP23XX_GPIO_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x4000)
164#define IXP23XX_TIMER_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x5000)
165#define IXP23XX_NPE0_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x6000)
166#define IXP23XX_DSR_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x7000)
167#define IXP23XX_NPE1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x8000)
168#define IXP23XX_ETH0_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x9000)
169#define IXP23XX_ETH1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xA000)
170#define IXP23XX_GIG0_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xB000)
171#define IXP23XX_GIG1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xC000)
172#define IXP23XX_DDRS_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xD000)
173
174
175/****************************************************************************
176 * Interrupt controller.
177 ****************************************************************************/
178#define IXP23XX_INTC_REG(x) ((volatile unsigned long *)(IXP23XX_INTC_VIRT + (x)))
179#define IXP23XX_INTR_ST1 IXP23XX_INTC_REG(0x00)
180#define IXP23XX_INTR_ST2 IXP23XX_INTC_REG(0x04)
181#define IXP23XX_INTR_ST3 IXP23XX_INTC_REG(0x08)
182#define IXP23XX_INTR_ST4 IXP23XX_INTC_REG(0x0c)
183#define IXP23XX_INTR_EN1 IXP23XX_INTC_REG(0x10)
184#define IXP23XX_INTR_EN2 IXP23XX_INTC_REG(0x14)
185#define IXP23XX_INTR_EN3 IXP23XX_INTC_REG(0x18)
186#define IXP23XX_INTR_EN4 IXP23XX_INTC_REG(0x1c)
187#define IXP23XX_INTR_SEL1 IXP23XX_INTC_REG(0x20)
188#define IXP23XX_INTR_SEL2 IXP23XX_INTC_REG(0x24)
189#define IXP23XX_INTR_SEL3 IXP23XX_INTC_REG(0x28)
190#define IXP23XX_INTR_SEL4 IXP23XX_INTC_REG(0x2c)
191#define IXP23XX_INTR_IRQ_ST1 IXP23XX_INTC_REG(0x30)
192#define IXP23XX_INTR_IRQ_ST2 IXP23XX_INTC_REG(0x34)
193#define IXP23XX_INTR_IRQ_ST3 IXP23XX_INTC_REG(0x38)
194#define IXP23XX_INTR_IRQ_ST4 IXP23XX_INTC_REG(0x3c)
195#define IXP23XX_INTR_IRQ_ENC_ST_OFFSET 0x54
196
197
198/****************************************************************************
199 * GPIO.
200 ****************************************************************************/
201#define IXP23XX_GPIO_REG(x) ((volatile unsigned long *)(IXP23XX_GPIO_VIRT + (x)))
202#define IXP23XX_GPIO_GPOUTR IXP23XX_GPIO_REG(0x00)
203#define IXP23XX_GPIO_GPOER IXP23XX_GPIO_REG(0x04)
204#define IXP23XX_GPIO_GPINR IXP23XX_GPIO_REG(0x08)
205#define IXP23XX_GPIO_GPISR IXP23XX_GPIO_REG(0x0c)
206#define IXP23XX_GPIO_GPIT1R IXP23XX_GPIO_REG(0x10)
207#define IXP23XX_GPIO_GPIT2R IXP23XX_GPIO_REG(0x14)
208#define IXP23XX_GPIO_GPCLKR IXP23XX_GPIO_REG(0x18)
209#define IXP23XX_GPIO_GPDBSELR IXP23XX_GPIO_REG(0x1c)
210
211#define IXP23XX_GPIO_STYLE_MASK 0x7
212#define IXP23XX_GPIO_STYLE_ACTIVE_HIGH 0x0
213#define IXP23XX_GPIO_STYLE_ACTIVE_LOW 0x1
214#define IXP23XX_GPIO_STYLE_RISING_EDGE 0x2
215#define IXP23XX_GPIO_STYLE_FALLING_EDGE 0x3
216#define IXP23XX_GPIO_STYLE_TRANSITIONAL 0x4
217
218#define IXP23XX_GPIO_STYLE_SIZE 3
219
220
221/****************************************************************************
222 * Timer.
223 ****************************************************************************/
224#define IXP23XX_TIMER_REG(x) ((volatile unsigned long *)(IXP23XX_TIMER_VIRT + (x)))
225#define IXP23XX_TIMER_CONT IXP23XX_TIMER_REG(0x00)
226#define IXP23XX_TIMER1_TIMESTAMP IXP23XX_TIMER_REG(0x04)
227#define IXP23XX_TIMER1_RELOAD IXP23XX_TIMER_REG(0x08)
228#define IXP23XX_TIMER2_TIMESTAMP IXP23XX_TIMER_REG(0x0c)
229#define IXP23XX_TIMER2_RELOAD IXP23XX_TIMER_REG(0x10)
230#define IXP23XX_TIMER_WDOG IXP23XX_TIMER_REG(0x14)
231#define IXP23XX_TIMER_WDOG_EN IXP23XX_TIMER_REG(0x18)
232#define IXP23XX_TIMER_WDOG_KEY IXP23XX_TIMER_REG(0x1c)
233#define IXP23XX_TIMER_WDOG_KEY_MAGIC 0x482e
234#define IXP23XX_TIMER_STATUS IXP23XX_TIMER_REG(0x20)
235#define IXP23XX_TIMER_SOFT_RESET IXP23XX_TIMER_REG(0x24)
236#define IXP23XX_TIMER_SOFT_RESET_EN IXP23XX_TIMER_REG(0x28)
237
238#define IXP23XX_TIMER_ENABLE (1 << 0)
239#define IXP23XX_TIMER_ONE_SHOT (1 << 1)
240/* Low order bits of reload value ignored */
241#define IXP23XX_TIMER_RELOAD_MASK (0x3)
242#define IXP23XX_TIMER_DISABLED (0x0)
243#define IXP23XX_TIMER1_INT_PEND (1 << 0)
244#define IXP23XX_TIMER2_INT_PEND (1 << 1)
245#define IXP23XX_TIMER_STATUS_TS_PEND (1 << 2)
246#define IXP23XX_TIMER_STATUS_WDOG_PEND (1 << 3)
247#define IXP23XX_TIMER_STATUS_WARM_RESET (1 << 4)
248
249
250/****************************************************************************
251 * CAP CSRs.
252 ****************************************************************************/
253#define IXP23XX_GLOBAL_REG(x) ((volatile unsigned long *)(IXP23XX_CAP_CSR_VIRT + 0x4a00 + (x)))
254#define IXP23XX_PROD_IDG IXP23XX_GLOBAL_REG(0x00)
255#define IXP23XX_MISC_CONTROL IXP23XX_GLOBAL_REG(0x04)
256#define IXP23XX_MSF_CLK_CNTRL IXP23XX_GLOBAL_REG(0x08)
257#define IXP23XX_RESET0 IXP23XX_GLOBAL_REG(0x0c)
258#define IXP23XX_RESET1 IXP23XX_GLOBAL_REG(0x10)
259#define IXP23XX_STRAP_OPTIONS IXP23XX_GLOBAL_REG(0x18)
260
261#define IXP23XX_ENABLE_WATCHDOG (1 << 24)
262#define IXP23XX_SHPC_INIT_COMP (1 << 21)
263#define IXP23XX_RST_ALL (1 << 16)
264#define IXP23XX_RESET_PCI (1 << 2)
265#define IXP23XX_PCI_UNIT_RESET (1 << 1)
266#define IXP23XX_XSCALE_RESET (1 << 0)
267
268
269/****************************************************************************
270 * PCI CSRs.
271 ****************************************************************************/
272#define IXP23XX_PCI_CREG(x) ((volatile unsigned long *)(IXP23XX_PCI_CREG_VIRT + (x)))
273#define IXP23XX_PCI_CMDSTAT IXP23XX_PCI_CREG(0x04)
274#define IXP23XX_PCI_SRAM_BAR IXP23XX_PCI_CREG(0x14)
275#define IXP23XX_PCI_SDRAM_BAR IXP23XX_PCI_CREG(0x18)
276
277
278#define IXP23XX_PCI_CSR(x) ((volatile unsigned long *)(IXP23XX_PCI_CREG_VIRT + 0x01000000 + (x)))
279#define IXP23XX_PCI_OUT_INT_STATUS IXP23XX_PCI_CSR(0x0030)
280#define IXP23XX_PCI_OUT_INT_MASK IXP23XX_PCI_CSR(0x0034)
281#define IXP23XX_PCI_SRAM_BASE_ADDR_MASK IXP23XX_PCI_CSR(0x00fc)
282#define IXP23XX_PCI_DRAM_BASE_ADDR_MASK IXP23XX_PCI_CSR(0x0100)
283#define IXP23XX_PCI_CONTROL IXP23XX_PCI_CSR(0x013c)
284#define IXP23XX_PCI_ADDR_EXT IXP23XX_PCI_CSR(0x0140)
285#define IXP23XX_PCI_ME_PUSH_STATUS IXP23XX_PCI_CSR(0x0148)
286#define IXP23XX_PCI_ME_PUSH_EN IXP23XX_PCI_CSR(0x014c)
287#define IXP23XX_PCI_ERR_STATUS IXP23XX_PCI_CSR(0x0150)
288#define IXP23XX_PCI_ERROR_STATUS IXP23XX_PCI_CSR(0x0150)
289#define IXP23XX_PCI_ERR_ENABLE IXP23XX_PCI_CSR(0x0154)
290#define IXP23XX_PCI_XSCALE_INT_STATUS IXP23XX_PCI_CSR(0x0158)
291#define IXP23XX_PCI_XSCALE_INT_ENABLE IXP23XX_PCI_CSR(0x015c)
292#define IXP23XX_PCI_CPP_ADDR_BITS IXP23XX_PCI_CSR(0x0160)
293
294
295#ifndef __ASSEMBLY__
296/*
297 * Is system memory on the XSI or CPP bus?
298 */
299static inline unsigned ixp23xx_cpp_boot(void)
300{
301 return (*IXP23XX_EXP_CFG0 & IXP23XX_EXP_CFG0_XSI_NOT_PRES);
302}
303#endif
304
305
306#endif
diff --git a/include/asm-arm/arch-ixp23xx/memory.h b/include/asm-arm/arch-ixp23xx/memory.h
new file mode 100644
index 000000000000..bebcf0aa0d72
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/memory.h
@@ -0,0 +1,46 @@
1/*
2 * include/asm-arm/arch-ixp23xx/memory.h
3 *
4 * Copyright (c) 2003-2004 Intel Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef __ASM_ARCH_MEMORY_H
13#define __ASM_ARCH_MEMORY_H
14
15#include <asm/hardware.h>
16
17/*
18 * Physical DRAM offset.
19 */
20#define PHYS_OFFSET (0x00000000)
21
22
23/*
24 * Virtual view <-> DMA view memory address translations
25 * virt_to_bus: Used to translate the virtual address to an
26 * address suitable to be passed to set_dma_addr
27 * bus_to_virt: Used to convert an address for DMA operations
28 * to an address that the kernel can use.
29 */
30#ifndef __ASSEMBLY__
31
32#define __virt_to_bus(v) \
33 ({ unsigned int ret; \
34 ret = ((__virt_to_phys(v) - 0x00000000) + \
35 (*((volatile int *)IXP23XX_PCI_SDRAM_BAR) & 0xfffffff0)); \
36 ret; })
37
38#define __bus_to_virt(b) \
39 ({ unsigned int data; \
40 data = *((volatile int *)IXP23XX_PCI_SDRAM_BAR); \
41 __phys_to_virt((((b - (data & 0xfffffff0)) + 0x00000000))); })
42
43#endif
44
45
46#endif
diff --git a/include/asm-arm/arch-ixp23xx/platform.h b/include/asm-arm/arch-ixp23xx/platform.h
new file mode 100644
index 000000000000..f85b4685a491
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/platform.h
@@ -0,0 +1,31 @@
1/*
2 * include/asm-arm/arch-ixp23xx/platform.h
3 *
4 * Various bits of code used by platform-level code.
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#ifndef __ASSEMBLY__
16
17struct pci_sys_data;
18
19void ixp23xx_map_io(void);
20void ixp23xx_init_irq(void);
21void ixp23xx_sys_init(void);
22int ixp23xx_pci_setup(int, struct pci_sys_data *);
23void ixp23xx_pci_preinit(void);
24struct pci_bus *ixp23xx_pci_scan_bus(int, struct pci_sys_data*);
25
26extern struct sys_timer ixp23xx_timer;
27
28#define IXP23XX_UART_XTAL 14745600
29
30
31#endif
diff --git a/include/asm-arm/arch-ixp23xx/system.h b/include/asm-arm/arch-ixp23xx/system.h
new file mode 100644
index 000000000000..925e6b0c338b
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/system.h
@@ -0,0 +1,33 @@
1/*
2 * include/asm-arm/arch-ixp23xx/system.h
3 *
4 * Copyright (C) 2003 Intel 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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <asm/hardware.h>
12#include <asm/mach-types.h>
13
14static inline void arch_idle(void)
15{
16#if 0
17 if (!hlt_counter)
18 cpu_do_idle();
19#endif
20}
21
22static inline void arch_reset(char mode)
23{
24 /* First try machine specific support */
25 if (machine_is_ixdp2351()) {
26 *IXDP2351_CPLD_RESET1_REG = IXDP2351_CPLD_RESET1_MAGIC;
27 (void) *IXDP2351_CPLD_RESET1_REG;
28 *IXDP2351_CPLD_RESET1_REG = IXDP2351_CPLD_RESET1_ENABLE;
29 }
30
31 /* Use on-chip reset capability */
32 *IXP23XX_RESET0 |= IXP23XX_RST_ALL;
33}
diff --git a/include/asm-arm/arch-ixp23xx/time.h b/include/asm-arm/arch-ixp23xx/time.h
new file mode 100644
index 000000000000..f6828fdd2883
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/time.h
@@ -0,0 +1,3 @@
1/*
2 * include/asm-arm/arch-ixp23xx/time.h
3 */
diff --git a/include/asm-arm/arch-ixp23xx/timex.h b/include/asm-arm/arch-ixp23xx/timex.h
new file mode 100644
index 000000000000..516f72fe6082
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/timex.h
@@ -0,0 +1,7 @@
1/*
2 * include/asm-arm/arch-ixp23xx/timex.h
3 *
4 * XScale architecture timex specifications
5 */
6
7#define CLOCK_TICK_RATE 75000000
diff --git a/include/asm-arm/arch-ixp23xx/uncompress.h b/include/asm-arm/arch-ixp23xx/uncompress.h
new file mode 100644
index 000000000000..013575e6a9a1
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/uncompress.h
@@ -0,0 +1,40 @@
1/*
2 * include/asm-arm/arch-ixp23xx/uncompress.h
3 *
4 * Copyright (C) 2002-2004 Intel 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 version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_UNCOMPRESS_H
12#define __ASM_ARCH_UNCOMPRESS_H
13
14#include <asm/hardware.h>
15#include <linux/serial_reg.h>
16
17#define UART_BASE ((volatile u32 *)IXP23XX_UART1_PHYS)
18
19static inline void putc(char c)
20{
21 int j;
22
23 for (j = 0; j < 0x1000; j++) {
24 if (UART_BASE[UART_LSR] & UART_LSR_THRE)
25 break;
26 barrier();
27 }
28
29 UART_BASE[UART_TX] = c;
30}
31
32static inline void flush(void)
33{
34}
35
36#define arch_decomp_setup()
37#define arch_decomp_wdog()
38
39
40#endif
diff --git a/include/asm-arm/arch-ixp23xx/vmalloc.h b/include/asm-arm/arch-ixp23xx/vmalloc.h
new file mode 100644
index 000000000000..9f2566658541
--- /dev/null
+++ b/include/asm-arm/arch-ixp23xx/vmalloc.h
@@ -0,0 +1,10 @@
1/*
2 * include/asm-arm/arch-ixp23xx/vmalloc.h
3 *
4 * Copyright (c) 2005 MontaVista Software, Inc.
5 *
6 * NPU mappings end at 0xf0000000 and we allocate 64MB for board
7 * specific static I/O.
8 */
9
10#define VMALLOC_END (0xec000000)
diff --git a/include/asm-arm/arch-ixp4xx/debug-macro.S b/include/asm-arm/arch-ixp4xx/debug-macro.S
index 2e23651e217f..37bc8ef23e67 100644
--- a/include/asm-arm/arch-ixp4xx/debug-macro.S
+++ b/include/asm-arm/arch-ixp4xx/debug-macro.S
@@ -20,16 +20,5 @@
20 @ byte writes used - Big Endian. 20 @ byte writes used - Big Endian.
21 .endm 21 .endm
22 22
23 .macro senduart,rd,rx 23#define UART_SHIFT 2
24 strb \rd, [\rx] 24#include <asm/hardware/debug-8250.S>
25 .endm
26
27 .macro waituart,rd,rx
281002: ldrb \rd, [\rx, #0x14]
29 and \rd, \rd, #0x60 @ check THRE and TEMT bits
30 teq \rd, #0x60
31 bne 1002b
32 .endm
33
34 .macro busyuart,rd,rx
35 .endm
diff --git a/include/asm-arm/arch-ixp4xx/irq.h b/include/asm-arm/arch-ixp4xx/irq.h
deleted file mode 100644
index 87da70695f0a..000000000000
--- a/include/asm-arm/arch-ixp4xx/irq.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * irq.h
3 *
4 * Copyright (C) 2002 Intel 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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#define fixup_irq(irq) (irq)
13
diff --git a/include/asm-arm/arch-ixp4xx/param.h b/include/asm-arm/arch-ixp4xx/param.h
deleted file mode 100644
index 8a757125e5e7..000000000000
--- a/include/asm-arm/arch-ixp4xx/param.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-ixp4xx/param.h
3 */
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index daf9790645ca..13aee17b0475 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -38,6 +38,33 @@ extern unsigned long ixp4xx_exp_bus_size;
38#define IXP4XX_EXP_BUS_BASE(region)\ 38#define IXP4XX_EXP_BUS_BASE(region)\
39 (IXP4XX_EXP_BUS_BASE_PHYS + ((region) * ixp4xx_exp_bus_size)) 39 (IXP4XX_EXP_BUS_BASE_PHYS + ((region) * ixp4xx_exp_bus_size))
40 40
41#define IXP4XX_EXP_BUS_END(region)\
42 (IXP4XX_EXP_BUS_BASE(region) + ixp4xx_exp_bus_size - 1)
43
44/* Those macros can be used to adjust timing and configure
45 * other features for each region.
46 */
47
48#define IXP4XX_EXP_BUS_RECOVERY_T(x) (((x) & 0x0f) << 16)
49#define IXP4XX_EXP_BUS_HOLD_T(x) (((x) & 0x03) << 20)
50#define IXP4XX_EXP_BUS_STROBE_T(x) (((x) & 0x0f) << 22)
51#define IXP4XX_EXP_BUS_SETUP_T(x) (((x) & 0x03) << 26)
52#define IXP4XX_EXP_BUS_ADDR_T(x) (((x) & 0x03) << 28)
53#define IXP4XX_EXP_BUS_SIZE(x) (((x) & 0x0f) << 10)
54#define IXP4XX_EXP_BUS_CYCLES(x) (((x) & 0x03) << 14)
55
56#define IXP4XX_EXP_BUS_CS_EN (1L << 31)
57#define IXP4XX_EXP_BUS_BYTE_RD16 (1L << 6)
58#define IXP4XX_EXP_BUS_HRDY_POL (1L << 5)
59#define IXP4XX_EXP_BUS_MUX_EN (1L << 4)
60#define IXP4XX_EXP_BUS_SPLT_EN (1L << 3)
61#define IXP4XX_EXP_BUS_WR_EN (1L << 1)
62#define IXP4XX_EXP_BUS_BYTE_EN (1L << 0)
63
64#define IXP4XX_EXP_BUS_CYCLES_INTEL 0x00
65#define IXP4XX_EXP_BUS_CYCLES_MOTOROLA 0x01
66#define IXP4XX_EXP_BUS_CYCLES_HPI 0x02
67
41#define IXP4XX_FLASH_WRITABLE (0x2) 68#define IXP4XX_FLASH_WRITABLE (0x2)
42#define IXP4XX_FLASH_DEFAULT (0xbcd23c40) 69#define IXP4XX_FLASH_DEFAULT (0xbcd23c40)
43#define IXP4XX_FLASH_WRITE (0xbcd23c42) 70#define IXP4XX_FLASH_WRITE (0xbcd23c42)
diff --git a/include/asm-arm/arch-ixp4xx/uncompress.h b/include/asm-arm/arch-ixp4xx/uncompress.h
index 960c35810a22..09ae6c91be60 100644
--- a/include/asm-arm/arch-ixp4xx/uncompress.h
+++ b/include/asm-arm/arch-ixp4xx/uncompress.h
@@ -21,26 +21,18 @@
21 21
22static volatile u32* uart_base; 22static volatile u32* uart_base;
23 23
24static __inline__ void putc(char c) 24static inline void putc(int c)
25{ 25{
26 /* Check THRE and TEMT bits before we transmit the character. 26 /* Check THRE and TEMT bits before we transmit the character.
27 */ 27 */
28 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE); 28 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
29 barrier();
30
29 *uart_base = c; 31 *uart_base = c;
30} 32}
31 33
32/* 34static void flush(void)
33 * This does not append a newline
34 */
35static void putstr(const char *s)
36{ 35{
37 while (*s)
38 {
39 putc(*s);
40 if (*s == '\n')
41 putc('\r');
42 s++;
43 }
44} 36}
45 37
46static __inline__ void __arch_decomp_setup(unsigned long arch_id) 38static __inline__ void __arch_decomp_setup(unsigned long arch_id)
diff --git a/include/asm-arm/arch-l7200/param.h b/include/asm-arm/arch-l7200/param.h
deleted file mode 100644
index 9962a12ab158..000000000000
--- a/include/asm-arm/arch-l7200/param.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-l7200/param.h
3 *
4 * Copyright (C) 2000 Rob Scott (rscott@mtrob.fdns.net)
5 * Steve Hill (sjhill@cotw.com)
6 *
7 * This file contains the hardware definitions for the
8 * LinkUp Systems L7200 SOC development board.
9 *
10 * Changelog:
11 * 04-21-2000 RS Created L7200 version
12 * 04-25-2000 SJH Cleaned up file
13 * 05-03-2000 SJH Change comments and rate
14 */
15
16/*
17 * See 'time.h' for how the RTC HZ rate is set
18 */
19#define HZ 128
diff --git a/include/asm-arm/arch-l7200/uncompress.h b/include/asm-arm/arch-l7200/uncompress.h
index 1caa2b560f53..9fcd40aee3e3 100644
--- a/include/asm-arm/arch-l7200/uncompress.h
+++ b/include/asm-arm/arch-l7200/uncompress.h
@@ -16,22 +16,17 @@
16#define __raw_writeb(v,p) (*(volatile unsigned char *)(p) = (v)) 16#define __raw_writeb(v,p) (*(volatile unsigned char *)(p) = (v))
17#define __raw_readb(p) (*(volatile unsigned char *)(p)) 17#define __raw_readb(p) (*(volatile unsigned char *)(p))
18 18
19static __inline__ void putc(char c) 19static inline void putc(int c)
20{ 20{
21 while(__raw_readb(IO_UART + 0x18) & 0x20 || 21 while(__raw_readb(IO_UART + 0x18) & 0x20 ||
22 __raw_readb(IO_UART + 0x18) & 0x08); 22 __raw_readb(IO_UART + 0x18) & 0x08)
23 barrier();
24
23 __raw_writeb(c, IO_UART + 0x00); 25 __raw_writeb(c, IO_UART + 0x00);
24} 26}
25 27
26static void putstr(const char *s) 28static inline void flush(void)
27{ 29{
28 while (*s) {
29 if (*s == 10) { /* If a LF, add CR */
30 putc(10);
31 putc(13);
32 }
33 putc(*(s++));
34 }
35} 30}
36 31
37static __inline__ void arch_decomp_setup(void) 32static __inline__ void arch_decomp_setup(void)
diff --git a/include/asm-arm/arch-lh7a40x/irq.h b/include/asm-arm/arch-lh7a40x/irq.h
deleted file mode 100644
index 0f5f0b10f6ca..000000000000
--- a/include/asm-arm/arch-lh7a40x/irq.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/* include/asm-arm/arch-lh7a40x/irq.h
2 *
3 * Copyright (C) 2004 Logic Product Development
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 */
10
11void __init lh7a40x_init_board_irq (void);
diff --git a/include/asm-arm/arch-lh7a40x/param.h b/include/asm-arm/arch-lh7a40x/param.h
deleted file mode 100644
index acad0bc5deba..000000000000
--- a/include/asm-arm/arch-lh7a40x/param.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/* include/asm-arm/arch-lh7a40x/param.h
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 */
diff --git a/include/asm-arm/arch-lh7a40x/uncompress.h b/include/asm-arm/arch-lh7a40x/uncompress.h
index ec8ab67122f3..f8053346f608 100644
--- a/include/asm-arm/arch-lh7a40x/uncompress.h
+++ b/include/asm-arm/arch-lh7a40x/uncompress.h
@@ -22,20 +22,15 @@
22#define UART_STATUS (*(volatile unsigned long*) (UART2_PHYS + UART_R_STATUS)) 22#define UART_STATUS (*(volatile unsigned long*) (UART2_PHYS + UART_R_STATUS))
23#define UART_DATA (*(volatile unsigned long*) (UART2_PHYS + UART_R_DATA)) 23#define UART_DATA (*(volatile unsigned long*) (UART2_PHYS + UART_R_DATA))
24 24
25static __inline__ void putc (char ch) 25static inline void putc(int ch)
26{ 26{
27 while (UART_STATUS & nTxRdy) 27 while (UART_STATUS & nTxRdy)
28 ; 28 barrier();
29 UART_DATA = ch; 29 UART_DATA = ch;
30} 30}
31 31
32static void putstr (const char* sz) 32static inline void flush(void)
33{ 33{
34 for (; *sz; ++sz) {
35 putc (*sz);
36 if (*sz == '\n')
37 putc ('\r');
38 }
39} 34}
40 35
41 /* NULL functions; we don't presently need them */ 36 /* NULL functions; we don't presently need them */
diff --git a/include/asm-arm/arch-omap/param.h b/include/asm-arm/arch-omap/param.h
deleted file mode 100644
index face9ad41e97..000000000000
--- a/include/asm-arm/arch-omap/param.h
+++ /dev/null
@@ -1,8 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-omap/param.h
3 *
4 */
5
6#ifdef CONFIG_OMAP_32K_TIMER_HZ
7#define HZ CONFIG_OMAP_32K_TIMER_HZ
8#endif
diff --git a/include/asm-arm/arch-omap/uncompress.h b/include/asm-arm/arch-omap/uncompress.h
index c718264affbd..ca2c8bec82e7 100644
--- a/include/asm-arm/arch-omap/uncompress.h
+++ b/include/asm-arm/arch-omap/uncompress.h
@@ -30,8 +30,7 @@ unsigned int system_rev;
30#define check_port(base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0) 30#define check_port(base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0)
31#define omap_get_id() ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK 31#define omap_get_id() ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK
32 32
33static void 33static void putc(int c)
34putstr(const char *s)
35{ 34{
36 volatile u8 * uart = 0; 35 volatile u8 * uart = 0;
37 int shift = 2; 36 int shift = 2;
@@ -69,16 +68,13 @@ putstr(const char *s)
69 /* 68 /*
70 * Now, xmit each character 69 * Now, xmit each character
71 */ 70 */
72 while (*s) { 71 while (!(uart[UART_LSR << shift] & UART_LSR_THRE))
73 while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) 72 barrier();
74 barrier(); 73 uart[UART_TX << shift] = c;
75 uart[UART_TX << shift] = *s; 74}
76 if (*s++ == '\n') { 75
77 while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) 76static inline void flush(void)
78 barrier(); 77{
79 uart[UART_TX << shift] = '\r';
80 }
81 }
82} 78}
83 79
84/* 80/*
diff --git a/include/asm-arm/arch-pxa/audio.h b/include/asm-arm/arch-pxa/audio.h
index 60976f830e3f..17eccd720136 100644
--- a/include/asm-arm/arch-pxa/audio.h
+++ b/include/asm-arm/arch-pxa/audio.h
@@ -6,8 +6,8 @@
6#include <sound/pcm.h> 6#include <sound/pcm.h>
7 7
8typedef struct { 8typedef struct {
9 int (*startup)(snd_pcm_substream_t *, void *); 9 int (*startup)(struct snd_pcm_substream *, void *);
10 void (*shutdown)(snd_pcm_substream_t *, void *); 10 void (*shutdown)(struct snd_pcm_substream *, void *);
11 void (*suspend)(void *); 11 void (*suspend)(void *);
12 void (*resume)(void *); 12 void (*resume)(void *);
13 void *priv; 13 void *priv;
diff --git a/include/asm-arm/arch-pxa/debug-macro.S b/include/asm-arm/arch-pxa/debug-macro.S
index b6ec68879176..9012cbc0ad8b 100644
--- a/include/asm-arm/arch-pxa/debug-macro.S
+++ b/include/asm-arm/arch-pxa/debug-macro.S
@@ -21,18 +21,5 @@
21 orr \rx, \rx, #0x00100000 21 orr \rx, \rx, #0x00100000
22 .endm 22 .endm
23 23
24 .macro senduart,rd,rx 24#define UART_SHIFT 2
25 str \rd, [\rx, #0] 25#include <asm/hardware/debug-8250.S>
26 .endm
27
28 .macro busyuart,rd,rx
291002: ldr \rd, [\rx, #0x14]
30 tst \rd, #(1 << 6)
31 beq 1002b
32 .endm
33
34 .macro waituart,rd,rx
351001: ldr \rd, [\rx, #0x14]
36 tst \rd, #(1 << 5)
37 beq 1001b
38 .endm
diff --git a/include/asm-arm/arch-pxa/irq.h b/include/asm-arm/arch-pxa/irq.h
deleted file mode 100644
index 48c60f5eff6a..000000000000
--- a/include/asm-arm/arch-pxa/irq.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-pxa/irq.h
3 *
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software Inc.
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#define fixup_irq(x) (x)
14
diff --git a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h
index 05c4b7027592..67af238a8f8e 100644
--- a/include/asm-arm/arch-pxa/irqs.h
+++ b/include/asm-arm/arch-pxa/irqs.h
@@ -176,6 +176,7 @@
176#elif defined(CONFIG_SHARP_LOCOMO) 176#elif defined(CONFIG_SHARP_LOCOMO)
177#define NR_IRQS (IRQ_LOCOMO_SPI_TEND + 1) 177#define NR_IRQS (IRQ_LOCOMO_SPI_TEND + 1)
178#elif defined(CONFIG_ARCH_LUBBOCK) || \ 178#elif defined(CONFIG_ARCH_LUBBOCK) || \
179 defined(CONFIG_MACH_LOGICPD_PXA270) || \
179 defined(CONFIG_MACH_MAINSTONE) 180 defined(CONFIG_MACH_MAINSTONE)
180#define NR_IRQS (IRQ_BOARD_END) 181#define NR_IRQS (IRQ_BOARD_END)
181#else 182#else
@@ -196,6 +197,11 @@
196#define LUBBOCK_USB_DISC_IRQ LUBBOCK_IRQ(6) /* usb disconnect */ 197#define LUBBOCK_USB_DISC_IRQ LUBBOCK_IRQ(6) /* usb disconnect */
197#define LUBBOCK_LAST_IRQ LUBBOCK_IRQ(6) 198#define LUBBOCK_LAST_IRQ LUBBOCK_IRQ(6)
198 199
200#define LPD270_IRQ(x) (IRQ_BOARD_START + (x))
201#define LPD270_USBC_IRQ LPD270_IRQ(2)
202#define LPD270_ETHERNET_IRQ LPD270_IRQ(3)
203#define LPD270_AC97_IRQ LPD270_IRQ(4)
204
199#define MAINSTONE_IRQ(x) (IRQ_BOARD_START + (x)) 205#define MAINSTONE_IRQ(x) (IRQ_BOARD_START + (x))
200#define MAINSTONE_MMC_IRQ MAINSTONE_IRQ(0) 206#define MAINSTONE_MMC_IRQ MAINSTONE_IRQ(0)
201#define MAINSTONE_USIM_IRQ MAINSTONE_IRQ(1) 207#define MAINSTONE_USIM_IRQ MAINSTONE_IRQ(1)
diff --git a/include/asm-arm/arch-pxa/lpd270.h b/include/asm-arm/arch-pxa/lpd270.h
new file mode 100644
index 000000000000..501d240ac120
--- /dev/null
+++ b/include/asm-arm/arch-pxa/lpd270.h
@@ -0,0 +1,38 @@
1/*
2 * include/asm-arm/arch-pxa/lpd270.h
3 *
4 * Author: Lennert Buytenhek
5 * Created: Feb 10, 2006
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ASM_ARCH_LPD270_H
13#define __ASM_ARCH_LPD270_H
14
15#define LPD270_CPLD_PHYS PXA_CS2_PHYS
16#define LPD270_CPLD_VIRT 0xf0000000
17#define LPD270_CPLD_SIZE 0x00100000
18
19#define LPD270_ETH_PHYS (PXA_CS2_PHYS + 0x01000000)
20
21/* CPLD registers */
22#define LPD270_CPLD_REG(x) ((unsigned long)(LPD270_CPLD_VIRT + (x)))
23#define LPD270_CONTROL LPD270_CPLD_REG(0x00)
24#define LPD270_PERIPHERAL0 LPD270_CPLD_REG(0x04)
25#define LPD270_PERIPHERAL1 LPD270_CPLD_REG(0x08)
26#define LPD270_CPLD_REVISION LPD270_CPLD_REG(0x14)
27#define LPD270_EEPROM_SPI_ITF LPD270_CPLD_REG(0x20)
28#define LPD270_MODE_PINS LPD270_CPLD_REG(0x24)
29#define LPD270_EGPIO LPD270_CPLD_REG(0x30)
30#define LPD270_INT_MASK LPD270_CPLD_REG(0x40)
31#define LPD270_INT_STATUS LPD270_CPLD_REG(0x50)
32
33#define LPD270_INT_AC97 (1 << 4) /* AC'97 CODEC IRQ */
34#define LPD270_INT_ETHERNET (1 << 3) /* Ethernet controller IRQ */
35#define LPD270_INT_USBC (1 << 2) /* USB client cable detection IRQ */
36
37
38#endif
diff --git a/include/asm-arm/arch-pxa/param.h b/include/asm-arm/arch-pxa/param.h
deleted file mode 100644
index 3197d82d7573..000000000000
--- a/include/asm-arm/arch-pxa/param.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-pxa/param.h
3 */
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index 1409c5bd703f..c8f53a71c076 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -485,7 +485,7 @@
485#define SACR1_ENLBF (1 << 5) /* Enable Loopback */ 485#define SACR1_ENLBF (1 << 5) /* Enable Loopback */
486#define SACR1_DRPL (1 << 4) /* Disable Replaying Function */ 486#define SACR1_DRPL (1 << 4) /* Disable Replaying Function */
487#define SACR1_DREC (1 << 3) /* Disable Recording Function */ 487#define SACR1_DREC (1 << 3) /* Disable Recording Function */
488#define SACR1_AMSL (1 << 1) /* Specify Alternate Mode */ 488#define SACR1_AMSL (1 << 0) /* Specify Alternate Mode */
489 489
490#define SASR0_I2SOFF (1 << 7) /* Controller Status */ 490#define SASR0_I2SOFF (1 << 7) /* Controller Status */
491#define SASR0_ROR (1 << 6) /* Rx FIFO Overrun */ 491#define SASR0_ROR (1 << 6) /* Rx FIFO Overrun */
diff --git a/include/asm-arm/arch-pxa/sharpsl.h b/include/asm-arm/arch-pxa/sharpsl.h
index 0b43495d24b4..94cb4982af82 100644
--- a/include/asm-arm/arch-pxa/sharpsl.h
+++ b/include/asm-arm/arch-pxa/sharpsl.h
@@ -27,6 +27,8 @@ struct corgits_machinfo {
27 */ 27 */
28struct corgibl_machinfo { 28struct corgibl_machinfo {
29 int max_intensity; 29 int max_intensity;
30 int default_intensity;
31 int limit_mask;
30 void (*set_bl_intensity)(int intensity); 32 void (*set_bl_intensity)(int intensity);
31}; 33};
32extern void corgibl_limit_intensity(int limit); 34extern void corgibl_limit_intensity(int limit);
diff --git a/include/asm-arm/arch-pxa/uncompress.h b/include/asm-arm/arch-pxa/uncompress.h
index fe38090444e0..178aa2e073ac 100644
--- a/include/asm-arm/arch-pxa/uncompress.h
+++ b/include/asm-arm/arch-pxa/uncompress.h
@@ -17,23 +17,18 @@
17#define UART FFUART 17#define UART FFUART
18 18
19 19
20static __inline__ void putc(char c) 20static inline void putc(char c)
21{ 21{
22 while (!(UART[5] & 0x20)); 22 while (!(UART[5] & 0x20))
23 barrier();
23 UART[0] = c; 24 UART[0] = c;
24} 25}
25 26
26/* 27/*
27 * This does not append a newline 28 * This does not append a newline
28 */ 29 */
29static void putstr(const char *s) 30static inline void flush(void)
30{ 31{
31 while (*s) {
32 putc(*s);
33 if (*s == '\n')
34 putc('\r');
35 s++;
36 }
37} 32}
38 33
39/* 34/*
diff --git a/include/asm-arm/arch-realview/debug-macro.S b/include/asm-arm/arch-realview/debug-macro.S
index 017ad996848d..f17efc65518a 100644
--- a/include/asm-arm/arch-realview/debug-macro.S
+++ b/include/asm-arm/arch-realview/debug-macro.S
@@ -11,8 +11,6 @@
11 * 11 *
12*/ 12*/
13 13
14#include <linux/amba/serial.h>
15
16 .macro addruart,rx 14 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0 15 mrc p15, 0, \rx, c1, c0
18 tst \rx, #1 @ MMU enabled? 16 tst \rx, #1 @ MMU enabled?
@@ -21,18 +19,4 @@
21 orr \rx, \rx, #0x00009000 19 orr \rx, \rx, #0x00009000
22 .endm 20 .endm
23 21
24 .macro senduart,rd,rx 22#include <asm/hardware/debug-pl01x.S>
25 strb \rd, [\rx, #UART01x_DR]
26 .endm
27
28 .macro waituart,rd,rx
291001: ldr \rd, [\rx, #0x18] @ UARTFLG
30 tst \rd, #1 << 5 @ UARTFLGUTXFF - 1 when full
31 bne 1001b
32 .endm
33
34 .macro busyuart,rd,rx
351001: ldr \rd, [\rx, #0x18] @ UARTFLG
36 tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy
37 bne 1001b
38 .endm
diff --git a/include/asm-arm/arch-realview/param.h b/include/asm-arm/arch-realview/param.h
deleted file mode 100644
index 89b1235d32bd..000000000000
--- a/include/asm-arm/arch-realview/param.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-realview/param.h
3 *
4 * Copyright (C) 2002 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 */
diff --git a/include/asm-arm/arch-realview/uncompress.h b/include/asm-arm/arch-realview/uncompress.h
index b5e4d360665b..f05631d76743 100644
--- a/include/asm-arm/arch-realview/uncompress.h
+++ b/include/asm-arm/arch-realview/uncompress.h
@@ -27,22 +27,16 @@
27/* 27/*
28 * This does not append a newline 28 * This does not append a newline
29 */ 29 */
30static void putstr(const char *s) 30static inline void putc(int c)
31{ 31{
32 while (*s) { 32 while (AMBA_UART_FR & (1 << 5))
33 while (AMBA_UART_FR & (1 << 5)) 33 barrier();
34 barrier();
35
36 AMBA_UART_DR = *s;
37 34
38 if (*s == '\n') { 35 AMBA_UART_DR = c;
39 while (AMBA_UART_FR & (1 << 5)) 36}
40 barrier();
41 37
42 AMBA_UART_DR = '\r'; 38static inline void flush(void)
43 } 39{
44 s++;
45 }
46 while (AMBA_UART_FR & (1 << 3)) 40 while (AMBA_UART_FR & (1 << 3))
47 barrier(); 41 barrier();
48} 42}
diff --git a/include/asm-arm/arch-rpc/debug-macro.S b/include/asm-arm/arch-rpc/debug-macro.S
index 456d3d754c3d..c634c8d8f4a1 100644
--- a/include/asm-arm/arch-rpc/debug-macro.S
+++ b/include/asm-arm/arch-rpc/debug-macro.S
@@ -20,19 +20,6 @@
20 orr \rx, \rx, #0x00000fe0 20 orr \rx, \rx, #0x00000fe0
21 .endm 21 .endm
22 22
23 .macro senduart,rd,rx 23#define UART_SHIFT 2
24 strb \rd, [\rx] 24#define FLOW_CONTROL
25 .endm 25#include <asm/hardware/debug-8250.S>
26
27 .macro busyuart,rd,rx
281001: ldrb \rd, [\rx, #0x14]
29 and \rd, \rd, #0x60
30 teq \rd, #0x60
31 bne 1001b
32 .endm
33
34 .macro waituart,rd,rx
351001: ldrb \rd, [\rx, #0x18]
36 tst \rd, #0x10
37 beq 1001b
38 .endm
diff --git a/include/asm-arm/arch-rpc/param.h b/include/asm-arm/arch-rpc/param.h
deleted file mode 100644
index 721dcd658858..000000000000
--- a/include/asm-arm/arch-rpc/param.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-rpc/param.h
3 */
diff --git a/include/asm-arm/arch-rpc/uncompress.h b/include/asm-arm/arch-rpc/uncompress.h
index 43035fec64d2..06231ede54e5 100644
--- a/include/asm-arm/arch-rpc/uncompress.h
+++ b/include/asm-arm/arch-rpc/uncompress.h
@@ -67,31 +67,28 @@ extern __attribute__((pure)) struct param_struct *params(void);
67/* 67/*
68 * This does not append a newline 68 * This does not append a newline
69 */ 69 */
70static void putstr(const char *s) 70static void putc(int c)
71{ 71{
72 extern void ll_write_char(char *, char c, char white); 72 extern void ll_write_char(char *, char c, char white);
73 int x,y; 73 int x,y;
74 unsigned char c;
75 char *ptr; 74 char *ptr;
76 75
77 x = params->video_x; 76 x = params->video_x;
78 y = params->video_y; 77 y = params->video_y;
79 78
80 while ( ( c = *(unsigned char *)s++ ) != '\0' ) { 79 if (c == '\n') {
81 if ( c == '\n' ) { 80 if (++y >= video_num_lines)
81 y--;
82 } else if (c == '\r') {
83 x = 0;
84 } else {
85 ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h);
86 ll_write_char(ptr, c, white);
87 if (++x >= video_num_columns) {
82 x = 0; 88 x = 0;
83 if ( ++y >= video_num_lines ) { 89 if ( ++y >= video_num_lines ) {
84 y--; 90 y--;
85 } 91 }
86 } else {
87 ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h);
88 ll_write_char(ptr, c, white);
89 if ( ++x >= video_num_columns ) {
90 x = 0;
91 if ( ++y >= video_num_lines ) {
92 y--;
93 }
94 }
95 } 92 }
96 } 93 }
97 94
@@ -99,6 +96,10 @@ static void putstr(const char *s)
99 params->video_y = y; 96 params->video_y = y;
100} 97}
101 98
99static inline void flush(void)
100{
101}
102
102static void error(char *x); 103static void error(char *x);
103 104
104/* 105/*
diff --git a/include/asm-arm/arch-s3c2410/osiris-cpld.h b/include/asm-arm/arch-s3c2410/osiris-cpld.h
new file mode 100644
index 000000000000..e9d1ae1f354f
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/osiris-cpld.h
@@ -0,0 +1,25 @@
1/* linux/include/asm-arm/arch-s3c2410/osiris-cpld.h
2 *
3 * (c) 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * OSIRIS - CPLD control constants
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 version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_ARCH_OSIRISCPLD_H
15#define __ASM_ARCH_OSIRISCPLD_H
16
17/* CTRL1 - NAND WP control */
18
19#define OSIRIS_CTRL1_NANDSEL (0x3)
20#define OSIRIS_CTRL1_BOOT_INT (1<<3)
21#define OSIRIS_CTRL1_PCMCIA (1<<4)
22#define OSIRIS_CTRL1_PCMCIA_nWAIT (1<<6)
23#define OSIRIS_CTRL1_PCMCIA_nIOIS16 (1<<7)
24
25#endif /* __ASM_ARCH_OSIRISCPLD_H */
diff --git a/include/asm-arm/arch-s3c2410/osiris-map.h b/include/asm-arm/arch-s3c2410/osiris-map.h
new file mode 100644
index 000000000000..7c4b0cd2d14d
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/osiris-map.h
@@ -0,0 +1,41 @@
1/* linux/include/asm-arm/arch-s3c2410/osiris-map.h
2 *
3 * (c) 2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * OSIRIS - Memory map definitions
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 version 2 as
11 * published by the Free Software Foundation.
12 *
13 * Changelog:
14*/
15
16/* needs arch/map.h including with this */
17
18#ifndef __ASM_ARCH_OSIRISMAP_H
19#define __ASM_ARCH_OSIRISMAP_H
20
21/* start peripherals off after the S3C2410 */
22
23#define OSIRIS_IOADDR(x) (S3C2410_ADDR((x) + 0x05000000))
24
25#define OSIRIS_PA_CPLD (S3C2410_CS1 | (3<<25))
26
27/* we put the CPLD registers next, to get them out of the way */
28
29#define OSIRIS_VA_CTRL1 OSIRIS_IOADDR(0x00000000) /* 0x01300000 */
30#define OSIRIS_PA_CTRL1 (OSIRIS_PA_CPLD)
31
32#define OSIRIS_VA_CTRL2 OSIRIS_IOADDR(0x00100000) /* 0x01400000 */
33#define OSIRIS_PA_CTRL2 (OSIRIS_PA_CPLD + (1<<24))
34
35#define OSIRIS_VA_CTRL3 OSIRIS_IOADDR(0x00200000) /* 0x01500000 */
36#define OSIRIS_PA_CTRL3 (OSIRIS_PA_CPLD + (2<<24))
37
38#define OSIRIS_VA_CTRL4 OSIRIS_IOADDR(0x00300000) /* 0x01600000 */
39#define OSIRIS_PA_CTRL4 (OSIRIS_PA_CPLD + (3<<24))
40
41#endif /* __ASM_ARCH_OSIRISMAP_H */
diff --git a/include/asm-arm/arch-s3c2410/param.h b/include/asm-arm/arch-s3c2410/param.h
deleted file mode 100644
index 483d3f149883..000000000000
--- a/include/asm-arm/arch-s3c2410/param.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/* linux/include/asm-arm/arch-s3c2410/param.h
2 *
3 * (c) 2003 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - Machine parameters
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 * Changelog:
13 * 02-Sep-2003 BJD Created file
14 * 12-Mar-2004 BJD Added include protection
15*/
16
17#ifndef __ASM_ARCH_PARAM_H
18#define __ASM_ARCH_PARAM_H
19
20/* we cannot get our timer down to 100Hz with the setup as is, but we can
21 * manage 200 clock ticks per second... if this is a problem, we can always
22 * add a software pre-scaler to the evil timer systems.
23*/
24
25#define HZ 200
26
27#endif /* __ASM_ARCH_PARAM_H */
diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h
index 9697f93afe74..d2574084697f 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpio.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpio.h
@@ -979,6 +979,7 @@
979#define S3C2410_MISCCR_CLK0_HCLK (3<<4) 979#define S3C2410_MISCCR_CLK0_HCLK (3<<4)
980#define S3C2410_MISCCR_CLK0_PCLK (4<<4) 980#define S3C2410_MISCCR_CLK0_PCLK (4<<4)
981#define S3C2410_MISCCR_CLK0_DCLK0 (5<<4) 981#define S3C2410_MISCCR_CLK0_DCLK0 (5<<4)
982#define S3C2410_MISCCR_CLK0_MASK (7<<4)
982 983
983#define S3C2410_MISCCR_CLK1_MPLL (0<<8) 984#define S3C2410_MISCCR_CLK1_MPLL (0<<8)
984#define S3C2410_MISCCR_CLK1_UPLL (1<<8) 985#define S3C2410_MISCCR_CLK1_UPLL (1<<8)
@@ -986,6 +987,7 @@
986#define S3C2410_MISCCR_CLK1_HCLK (3<<8) 987#define S3C2410_MISCCR_CLK1_HCLK (3<<8)
987#define S3C2410_MISCCR_CLK1_PCLK (4<<8) 988#define S3C2410_MISCCR_CLK1_PCLK (4<<8)
988#define S3C2410_MISCCR_CLK1_DCLK1 (5<<8) 989#define S3C2410_MISCCR_CLK1_DCLK1 (5<<8)
990#define S3C2410_MISCCR_CLK1_MASK (7<<8)
989 991
990#define S3C2410_MISCCR_USBSUSPND0 (1<<12) 992#define S3C2410_MISCCR_USBSUSPND0 (1<<12)
991#define S3C2410_MISCCR_USBSUSPND1 (1<<13) 993#define S3C2410_MISCCR_USBSUSPND1 (1<<13)
diff --git a/include/asm-arm/arch-s3c2410/uncompress.h b/include/asm-arm/arch-s3c2410/uncompress.h
index 4367ec054b51..a6f6a0e44afa 100644
--- a/include/asm-arm/arch-s3c2410/uncompress.h
+++ b/include/asm-arm/arch-s3c2410/uncompress.h
@@ -67,8 +67,7 @@ uart_rd(unsigned int reg)
67 * waiting for tx to happen... 67 * waiting for tx to happen...
68*/ 68*/
69 69
70static void 70static void putc(int ch)
71putc(char ch)
72{ 71{
73 int cpuid = S3C2410_GSTATUS1_2410; 72 int cpuid = S3C2410_GSTATUS1_2410;
74 73
@@ -77,9 +76,6 @@ putc(char ch)
77 cpuid &= S3C2410_GSTATUS1_IDMASK; 76 cpuid &= S3C2410_GSTATUS1_IDMASK;
78#endif 77#endif
79 78
80 if (ch == '\n')
81 putc('\r'); /* expand newline to \r\n */
82
83 if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) { 79 if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) {
84 int level; 80 int level;
85 81
@@ -101,19 +97,16 @@ putc(char ch)
101 } else { 97 } else {
102 /* not using fifos */ 98 /* not using fifos */
103 99
104 while ((uart_rd(S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE) != S3C2410_UTRSTAT_TXE); 100 while ((uart_rd(S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE) != S3C2410_UTRSTAT_TXE)
101 barrier();
105 } 102 }
106 103
107 /* write byte to transmission register */ 104 /* write byte to transmission register */
108 uart_wr(S3C2410_UTXH, ch); 105 uart_wr(S3C2410_UTXH, ch);
109} 106}
110 107
111static void 108static inline void flush(void)
112putstr(const char *ptr)
113{ 109{
114 for (; *ptr != '\0'; ptr++) {
115 putc(*ptr);
116 }
117} 110}
118 111
119#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0) 112#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0)
diff --git a/include/asm-arm/arch-sa1100/debug-macro.S b/include/asm-arm/arch-sa1100/debug-macro.S
index 755fa3453862..267c317a7408 100644
--- a/include/asm-arm/arch-sa1100/debug-macro.S
+++ b/include/asm-arm/arch-sa1100/debug-macro.S
@@ -10,6 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 * 11 *
12*/ 12*/
13#include <asm/hardware.h>
13 14
14 .macro addruart,rx 15 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0 16 mrc p15, 0, \rx, c1, c0
diff --git a/include/asm-arm/arch-sa1100/param.h b/include/asm-arm/arch-sa1100/param.h
deleted file mode 100644
index 867488909ecd..000000000000
--- a/include/asm-arm/arch-sa1100/param.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-sa1100/param.h
3 */
diff --git a/include/asm-arm/arch-sa1100/uncompress.h b/include/asm-arm/arch-sa1100/uncompress.h
index 43453501ee66..2601a77a6dda 100644
--- a/include/asm-arm/arch-sa1100/uncompress.h
+++ b/include/asm-arm/arch-sa1100/uncompress.h
@@ -17,7 +17,7 @@
17 17
18#define UART(x) (*(volatile unsigned long *)(serial_port + (x))) 18#define UART(x) (*(volatile unsigned long *)(serial_port + (x)))
19 19
20static void putstr( const char *s ) 20static void putc(int c)
21{ 21{
22 unsigned long serial_port; 22 unsigned long serial_port;
23 23
@@ -31,19 +31,16 @@ static void putstr( const char *s )
31 return; 31 return;
32 } while (0); 32 } while (0);
33 33
34 for (; *s; s++) { 34 /* wait for space in the UART's transmitter */
35 /* wait for space in the UART's transmitter */ 35 while (!(UART(UTSR1) & UTSR1_TNF))
36 while (!(UART(UTSR1) & UTSR1_TNF)); 36 barrier();
37 37
38 /* send the character out. */ 38 /* send the character out. */
39 UART(UTDR) = *s; 39 UART(UTDR) = c;
40}
40 41
41 /* if a LF, also do CR... */ 42static inline void flush(void)
42 if (*s == 10) { 43{
43 while (!(UART(UTSR1) & UTSR1_TNF));
44 UART(UTDR) = 13;
45 }
46 }
47} 44}
48 45
49/* 46/*
diff --git a/include/asm-arm/arch-shark/param.h b/include/asm-arm/arch-shark/param.h
deleted file mode 100644
index 997eeb71de00..000000000000
--- a/include/asm-arm/arch-shark/param.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-shark/param.h
3 *
4 * by Alexander Schulz
5 */
diff --git a/include/asm-arm/arch-shark/uncompress.h b/include/asm-arm/arch-shark/uncompress.h
index 910a8e0a0ca5..7eca6534f1bb 100644
--- a/include/asm-arm/arch-shark/uncompress.h
+++ b/include/asm-arm/arch-shark/uncompress.h
@@ -9,7 +9,7 @@
9 9
10#define SERIAL_BASE ((volatile unsigned char *)0x400003f8) 10#define SERIAL_BASE ((volatile unsigned char *)0x400003f8)
11 11
12static __inline__ void putc(char c) 12static inline void putc(int c)
13{ 13{
14 int t; 14 int t;
15 15
@@ -18,17 +18,8 @@ static __inline__ void putc(char c)
18 while (t--); 18 while (t--);
19} 19}
20 20
21/* 21static inline void flush(void)
22 * This does not append a newline
23 */
24static void putstr(const char *s)
25{ 22{
26 while (*s) {
27 putc(*s);
28 if (*s == '\n')
29 putc('\r');
30 s++;
31 }
32} 23}
33 24
34#ifdef DEBUG 25#ifdef DEBUG
diff --git a/include/asm-arm/arch-versatile/debug-macro.S b/include/asm-arm/arch-versatile/debug-macro.S
index ef6167116dbb..fe106d184e62 100644
--- a/include/asm-arm/arch-versatile/debug-macro.S
+++ b/include/asm-arm/arch-versatile/debug-macro.S
@@ -11,8 +11,6 @@
11 * 11 *
12*/ 12*/
13 13
14#include <linux/amba/serial.h>
15
16 .macro addruart,rx 14 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0 15 mrc p15, 0, \rx, c1, c0
18 tst \rx, #1 @ MMU enabled? 16 tst \rx, #1 @ MMU enabled?
@@ -22,18 +20,4 @@
22 orr \rx, \rx, #0x00001000 20 orr \rx, \rx, #0x00001000
23 .endm 21 .endm
24 22
25 .macro senduart,rd,rx 23#include <asm/hardware/debug-pl01x.S>
26 strb \rd, [\rx, #UART01x_DR]
27 .endm
28
29 .macro waituart,rd,rx
301001: ldr \rd, [\rx, #0x18] @ UARTFLG
31 tst \rd, #1 << 5 @ UARTFLGUTXFF - 1 when full
32 bne 1001b
33 .endm
34
35 .macro busyuart,rd,rx
361001: ldr \rd, [\rx, #0x18] @ UARTFLG
37 tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy
38 bne 1001b
39 .endm
diff --git a/include/asm-arm/arch-versatile/param.h b/include/asm-arm/arch-versatile/param.h
deleted file mode 100644
index 34b897335f87..000000000000
--- a/include/asm-arm/arch-versatile/param.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-versatile/param.h
3 *
4 * Copyright (C) 2002 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 */
diff --git a/include/asm-arm/arch-versatile/uncompress.h b/include/asm-arm/arch-versatile/uncompress.h
index 2f57499c7b92..7215133d0514 100644
--- a/include/asm-arm/arch-versatile/uncompress.h
+++ b/include/asm-arm/arch-versatile/uncompress.h
@@ -25,22 +25,16 @@
25/* 25/*
26 * This does not append a newline 26 * This does not append a newline
27 */ 27 */
28static void putstr(const char *s) 28static inline void putc(int c)
29{ 29{
30 while (*s) { 30 while (AMBA_UART_FR & (1 << 5))
31 while (AMBA_UART_FR & (1 << 5)) 31 barrier();
32 barrier();
33
34 AMBA_UART_DR = *s;
35 32
36 if (*s == '\n') { 33 AMBA_UART_DR = c;
37 while (AMBA_UART_FR & (1 << 5)) 34}
38 barrier();
39 35
40 AMBA_UART_DR = '\r'; 36static inline void flush(void)
41 } 37{
42 s++;
43 }
44 while (AMBA_UART_FR & (1 << 3)) 38 while (AMBA_UART_FR & (1 << 3))
45 barrier(); 39 barrier();
46} 40}
diff --git a/include/asm-arm/assembler.h b/include/asm-arm/assembler.h
index f31ac92b6c7f..d53bafa9bf1c 100644
--- a/include/asm-arm/assembler.h
+++ b/include/asm-arm/assembler.h
@@ -80,16 +80,33 @@
80 instr regs 80 instr regs
81 81
82/* 82/*
83 * Save the current IRQ state and disable IRQs. Note that this macro 83 * Enable and disable interrupts
84 * assumes FIQs are enabled, and that the processor is in SVC mode.
85 */ 84 */
86 .macro save_and_disable_irqs, oldcpsr
87 mrs \oldcpsr, cpsr
88#if __LINUX_ARM_ARCH__ >= 6 85#if __LINUX_ARM_ARCH__ >= 6
86 .macro disable_irq
89 cpsid i 87 cpsid i
88 .endm
89
90 .macro enable_irq
91 cpsie i
92 .endm
90#else 93#else
91 msr cpsr_c, #PSR_I_BIT | MODE_SVC 94 .macro disable_irq
95 msr cpsr_c, #PSR_I_BIT | SVC_MODE
96 .endm
97
98 .macro enable_irq
99 msr cpsr_c, #SVC_MODE
100 .endm
92#endif 101#endif
102
103/*
104 * Save the current IRQ state and disable IRQs. Note that this macro
105 * assumes FIQs are enabled, and that the processor is in SVC mode.
106 */
107 .macro save_and_disable_irqs, oldcpsr
108 mrs \oldcpsr, cpsr
109 disable_irq
93 .endm 110 .endm
94 111
95/* 112/*
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h
index d02de721ecc1..0ac54b1a8bad 100644
--- a/include/asm-arm/bitops.h
+++ b/include/asm-arm/bitops.h
@@ -117,65 +117,7 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
117 return res & mask; 117 return res & mask;
118} 118}
119 119
120/* 120#include <asm-generic/bitops/non-atomic.h>
121 * Now the non-atomic variants. We let the compiler handle all
122 * optimisations for these. These are all _native_ endian.
123 */
124static inline void __set_bit(int nr, volatile unsigned long *p)
125{
126 p[nr >> 5] |= (1UL << (nr & 31));
127}
128
129static inline void __clear_bit(int nr, volatile unsigned long *p)
130{
131 p[nr >> 5] &= ~(1UL << (nr & 31));
132}
133
134static inline void __change_bit(int nr, volatile unsigned long *p)
135{
136 p[nr >> 5] ^= (1UL << (nr & 31));
137}
138
139static inline int __test_and_set_bit(int nr, volatile unsigned long *p)
140{
141 unsigned long oldval, mask = 1UL << (nr & 31);
142
143 p += nr >> 5;
144
145 oldval = *p;
146 *p = oldval | mask;
147 return oldval & mask;
148}
149
150static inline int __test_and_clear_bit(int nr, volatile unsigned long *p)
151{
152 unsigned long oldval, mask = 1UL << (nr & 31);
153
154 p += nr >> 5;
155
156 oldval = *p;
157 *p = oldval & ~mask;
158 return oldval & mask;
159}
160
161static inline int __test_and_change_bit(int nr, volatile unsigned long *p)
162{
163 unsigned long oldval, mask = 1UL << (nr & 31);
164
165 p += nr >> 5;
166
167 oldval = *p;
168 *p = oldval ^ mask;
169 return oldval & mask;
170}
171
172/*
173 * This routine doesn't need to be atomic.
174 */
175static inline int __test_bit(int nr, const volatile unsigned long * p)
176{
177 return (p[nr >> 5] >> (nr & 31)) & 1UL;
178}
179 121
180/* 122/*
181 * A note about Endian-ness. 123 * A note about Endian-ness.
@@ -261,7 +203,6 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
261#define test_and_set_bit(nr,p) ATOMIC_BITOP_LE(test_and_set_bit,nr,p) 203#define test_and_set_bit(nr,p) ATOMIC_BITOP_LE(test_and_set_bit,nr,p)
262#define test_and_clear_bit(nr,p) ATOMIC_BITOP_LE(test_and_clear_bit,nr,p) 204#define test_and_clear_bit(nr,p) ATOMIC_BITOP_LE(test_and_clear_bit,nr,p)
263#define test_and_change_bit(nr,p) ATOMIC_BITOP_LE(test_and_change_bit,nr,p) 205#define test_and_change_bit(nr,p) ATOMIC_BITOP_LE(test_and_change_bit,nr,p)
264#define test_bit(nr,p) __test_bit(nr,p)
265#define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz) 206#define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz)
266#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off) 207#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off)
267#define find_first_bit(p,sz) _find_first_bit_le(p,sz) 208#define find_first_bit(p,sz) _find_first_bit_le(p,sz)
@@ -280,7 +221,6 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
280#define test_and_set_bit(nr,p) ATOMIC_BITOP_BE(test_and_set_bit,nr,p) 221#define test_and_set_bit(nr,p) ATOMIC_BITOP_BE(test_and_set_bit,nr,p)
281#define test_and_clear_bit(nr,p) ATOMIC_BITOP_BE(test_and_clear_bit,nr,p) 222#define test_and_clear_bit(nr,p) ATOMIC_BITOP_BE(test_and_clear_bit,nr,p)
282#define test_and_change_bit(nr,p) ATOMIC_BITOP_BE(test_and_change_bit,nr,p) 223#define test_and_change_bit(nr,p) ATOMIC_BITOP_BE(test_and_change_bit,nr,p)
283#define test_bit(nr,p) __test_bit(nr,p)
284#define find_first_zero_bit(p,sz) _find_first_zero_bit_be(p,sz) 224#define find_first_zero_bit(p,sz) _find_first_zero_bit_be(p,sz)
285#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_be(p,sz,off) 225#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_be(p,sz,off)
286#define find_first_bit(p,sz) _find_first_bit_be(p,sz) 226#define find_first_bit(p,sz) _find_first_bit_be(p,sz)
@@ -292,57 +232,41 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
292 232
293#if __LINUX_ARM_ARCH__ < 5 233#if __LINUX_ARM_ARCH__ < 5
294 234
295/* 235#include <asm-generic/bitops/ffz.h>
296 * ffz = Find First Zero in word. Undefined if no zero exists, 236#include <asm-generic/bitops/__ffs.h>
297 * so code should check against ~0UL first.. 237#include <asm-generic/bitops/fls.h>
298 */ 238#include <asm-generic/bitops/ffs.h>
299static inline unsigned long ffz(unsigned long word)
300{
301 int k;
302
303 word = ~word;
304 k = 31;
305 if (word & 0x0000ffff) { k -= 16; word <<= 16; }
306 if (word & 0x00ff0000) { k -= 8; word <<= 8; }
307 if (word & 0x0f000000) { k -= 4; word <<= 4; }
308 if (word & 0x30000000) { k -= 2; word <<= 2; }
309 if (word & 0x40000000) { k -= 1; }
310 return k;
311}
312
313/*
314 * ffz = Find First Zero in word. Undefined if no zero exists,
315 * so code should check against ~0UL first..
316 */
317static inline unsigned long __ffs(unsigned long word)
318{
319 int k;
320
321 k = 31;
322 if (word & 0x0000ffff) { k -= 16; word <<= 16; }
323 if (word & 0x00ff0000) { k -= 8; word <<= 8; }
324 if (word & 0x0f000000) { k -= 4; word <<= 4; }
325 if (word & 0x30000000) { k -= 2; word <<= 2; }
326 if (word & 0x40000000) { k -= 1; }
327 return k;
328}
329
330/*
331 * fls: find last bit set.
332 */
333 239
334#define fls(x) generic_fls(x) 240#else
335#define fls64(x) generic_fls64(x)
336
337/*
338 * ffs: find first bit set. This is defined the same way as
339 * the libc and compiler builtin ffs routines, therefore
340 * differs in spirit from the above ffz (man ffs).
341 */
342 241
343#define ffs(x) generic_ffs(x) 242static inline int constant_fls(int x)
243{
244 int r = 32;
344 245
345#else 246 if (!x)
247 return 0;
248 if (!(x & 0xffff0000u)) {
249 x <<= 16;
250 r -= 16;
251 }
252 if (!(x & 0xff000000u)) {
253 x <<= 8;
254 r -= 8;
255 }
256 if (!(x & 0xf0000000u)) {
257 x <<= 4;
258 r -= 4;
259 }
260 if (!(x & 0xc0000000u)) {
261 x <<= 2;
262 r -= 2;
263 }
264 if (!(x & 0x80000000u)) {
265 x <<= 1;
266 r -= 1;
267 }
268 return r;
269}
346 270
347/* 271/*
348 * On ARMv5 and above those functions can be implemented around 272 * On ARMv5 and above those functions can be implemented around
@@ -350,39 +274,18 @@ static inline unsigned long __ffs(unsigned long word)
350 */ 274 */
351 275
352#define fls(x) \ 276#define fls(x) \
353 ( __builtin_constant_p(x) ? generic_fls(x) : \ 277 ( __builtin_constant_p(x) ? constant_fls(x) : \
354 ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) ) 278 ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) )
355#define fls64(x) generic_fls64(x)
356#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); }) 279#define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
357#define __ffs(x) (ffs(x) - 1) 280#define __ffs(x) (ffs(x) - 1)
358#define ffz(x) __ffs( ~(x) ) 281#define ffz(x) __ffs( ~(x) )
359 282
360#endif 283#endif
361 284
362/* 285#include <asm-generic/bitops/fls64.h>
363 * Find first bit set in a 168-bit bitmap, where the first
364 * 128 bits are unlikely to be set.
365 */
366static inline int sched_find_first_bit(const unsigned long *b)
367{
368 unsigned long v;
369 unsigned int off;
370
371 for (off = 0; v = b[off], off < 4; off++) {
372 if (unlikely(v))
373 break;
374 }
375 return __ffs(v) + off * 32;
376}
377
378/*
379 * hweightN: returns the hamming weight (i.e. the number
380 * of bits set) of a N-bit word
381 */
382 286
383#define hweight32(x) generic_hweight32(x) 287#include <asm-generic/bitops/sched.h>
384#define hweight16(x) generic_hweight16(x) 288#include <asm-generic/bitops/hweight.h>
385#define hweight8(x) generic_hweight8(x)
386 289
387/* 290/*
388 * Ext2 is defined to use little-endian byte ordering. 291 * Ext2 is defined to use little-endian byte ordering.
@@ -397,7 +300,7 @@ static inline int sched_find_first_bit(const unsigned long *b)
397#define ext2_clear_bit_atomic(lock,nr,p) \ 300#define ext2_clear_bit_atomic(lock,nr,p) \
398 test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) 301 test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
399#define ext2_test_bit(nr,p) \ 302#define ext2_test_bit(nr,p) \
400 __test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) 303 test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
401#define ext2_find_first_zero_bit(p,sz) \ 304#define ext2_find_first_zero_bit(p,sz) \
402 _find_first_zero_bit_le(p,sz) 305 _find_first_zero_bit_le(p,sz)
403#define ext2_find_next_zero_bit(p,sz,off) \ 306#define ext2_find_next_zero_bit(p,sz,off) \
@@ -410,7 +313,7 @@ static inline int sched_find_first_bit(const unsigned long *b)
410#define minix_set_bit(nr,p) \ 313#define minix_set_bit(nr,p) \
411 __set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) 314 __set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
412#define minix_test_bit(nr,p) \ 315#define minix_test_bit(nr,p) \
413 __test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) 316 test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
414#define minix_test_and_set_bit(nr,p) \ 317#define minix_test_and_set_bit(nr,p) \
415 __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) 318 __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
416#define minix_test_and_clear_bit(nr,p) \ 319#define minix_test_and_clear_bit(nr,p) \
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
index 09e19a783a51..746be56b1b70 100644
--- a/include/asm-arm/cacheflush.h
+++ b/include/asm-arm/cacheflush.h
@@ -71,6 +71,14 @@
71# endif 71# endif
72#endif 72#endif
73 73
74#if defined(CONFIG_CPU_XSC3)
75# ifdef _CACHE
76# define MULTI_CACHE 1
77# else
78# define _CACHE xsc3
79# endif
80#endif
81
74#if defined(CONFIG_CPU_V6) 82#if defined(CONFIG_CPU_V6)
75//# ifdef _CACHE 83//# ifdef _CACHE
76# define MULTI_CACHE 1 84# define MULTI_CACHE 1
diff --git a/include/asm-arm/delay.h b/include/asm-arm/delay.h
index 1704360e9699..b2deda181549 100644
--- a/include/asm-arm/delay.h
+++ b/include/asm-arm/delay.h
@@ -6,6 +6,8 @@
6#ifndef __ASM_ARM_DELAY_H 6#ifndef __ASM_ARM_DELAY_H
7#define __ASM_ARM_DELAY_H 7#define __ASM_ARM_DELAY_H
8 8
9#include <asm/param.h> /* HZ */
10
9extern void __delay(int loops); 11extern void __delay(int loops);
10 12
11/* 13/*
@@ -13,7 +15,7 @@ extern void __delay(int loops);
13 * it, it means that you're calling udelay() with an out of range value. 15 * it, it means that you're calling udelay() with an out of range value.
14 * 16 *
15 * With currently imposed limits, this means that we support a max delay 17 * With currently imposed limits, this means that we support a max delay
16 * of 2000us and 671 bogomips 18 * of 2000us. Further limits: HZ<=1000 and bogomips<=3355
17 */ 19 */
18extern void __bad_udelay(void); 20extern void __bad_udelay(void);
19 21
@@ -32,10 +34,10 @@ extern void __const_udelay(unsigned long);
32 34
33#define MAX_UDELAY_MS 2 35#define MAX_UDELAY_MS 2
34 36
35#define udelay(n) \ 37#define udelay(n) \
36 (__builtin_constant_p(n) ? \ 38 (__builtin_constant_p(n) ? \
37 ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \ 39 ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : \
38 __const_udelay((n) * 0x68dbul)) : \ 40 __const_udelay((n) * ((2199023U*HZ)>>11))) : \
39 __udelay(n)) 41 __udelay(n))
40 42
41#endif /* defined(_ARM_DELAY_H) */ 43#endif /* defined(_ARM_DELAY_H) */
diff --git a/include/asm-arm/domain.h b/include/asm-arm/domain.h
index da1d960387d9..f8ea2de4848e 100644
--- a/include/asm-arm/domain.h
+++ b/include/asm-arm/domain.h
@@ -16,11 +16,29 @@
16 * DOMAIN_IO - domain 2 includes all IO only 16 * DOMAIN_IO - domain 2 includes all IO only
17 * DOMAIN_USER - domain 1 includes all user memory only 17 * DOMAIN_USER - domain 1 includes all user memory only
18 * DOMAIN_KERNEL - domain 0 includes all kernel memory only 18 * DOMAIN_KERNEL - domain 0 includes all kernel memory only
19 *
20 * The domain numbering depends on whether we support 36 physical
21 * address for I/O or not. Addresses above the 32 bit boundary can
22 * only be mapped using supersections and supersections can only
23 * be set for domain 0. We could just default to DOMAIN_IO as zero,
24 * but there may be systems with supersection support and no 36-bit
25 * addressing. In such cases, we want to map system memory with
26 * supersections to reduce TLB misses and footprint.
27 *
28 * 36-bit addressing and supersections are only available on
29 * CPUs based on ARMv6+ or the Intel XSC3 core.
19 */ 30 */
31#ifndef CONFIG_IO_36
20#define DOMAIN_KERNEL 0 32#define DOMAIN_KERNEL 0
21#define DOMAIN_TABLE 0 33#define DOMAIN_TABLE 0
22#define DOMAIN_USER 1 34#define DOMAIN_USER 1
23#define DOMAIN_IO 2 35#define DOMAIN_IO 2
36#else
37#define DOMAIN_KERNEL 2
38#define DOMAIN_TABLE 2
39#define DOMAIN_USER 1
40#define DOMAIN_IO 0
41#endif
24 42
25/* 43/*
26 * Domain types 44 * Domain types
diff --git a/include/asm-arm/hardware/debug-8250.S b/include/asm-arm/hardware/debug-8250.S
new file mode 100644
index 000000000000..4594fea91ec1
--- /dev/null
+++ b/include/asm-arm/hardware/debug-8250.S
@@ -0,0 +1,29 @@
1/*
2 * linux/include/asm-arm/hardware/debug-8250.h
3 *
4 * Copyright (C) 1994-1999 Russell King
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#include <linux/serial_reg.h>
11
12 .macro senduart,rd,rx
13 strb \rd, [\rx, #UART_TX << UART_SHIFT]
14 .endm
15
16 .macro busyuart,rd,rx
171002: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT]
18 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
19 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
20 bne 1002b
21 .endm
22
23 .macro waituart,rd,rx
24#ifdef FLOW_CONTROL
251001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT]
26 tst \rd, #UART_MSR_CTS
27 beq 1001b
28#endif
29 .endm
diff --git a/include/asm-arm/hardware/debug-pl01x.S b/include/asm-arm/hardware/debug-pl01x.S
new file mode 100644
index 000000000000..db0d0f7de5e9
--- /dev/null
+++ b/include/asm-arm/hardware/debug-pl01x.S
@@ -0,0 +1,29 @@
1/* linux/include/asm-arm/arch-integrator/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#include <linux/amba/serial.h>
14
15 .macro senduart,rd,rx
16 strb \rd, [\rx, #UART01x_DR]
17 .endm
18
19 .macro waituart,rd,rx
201001: ldr \rd, [\rx, #UART01x_FR]
21 tst \rd, #UART01x_FR_TXFF
22 bne 1001b
23 .endm
24
25 .macro busyuart,rd,rx
261001: ldr \rd, [\rx, #UART01x_FR]
27 tst \rd, #UART01x_FR_BUSY
28 bne 1001b
29 .endm
diff --git a/include/asm-arm/arch-ixp2000/uengine.h b/include/asm-arm/hardware/uengine.h
index b442d65c6593..b442d65c6593 100644
--- a/include/asm-arm/arch-ixp2000/uengine.h
+++ b/include/asm-arm/hardware/uengine.h
diff --git a/include/asm-arm/hardware/vic.h b/include/asm-arm/hardware/vic.h
index 81825eb54c9e..ed9ca3736a0b 100644
--- a/include/asm-arm/hardware/vic.h
+++ b/include/asm-arm/hardware/vic.h
@@ -39,7 +39,7 @@
39#define VIC_VECT_CNTL_ENABLE (1 << 5) 39#define VIC_VECT_CNTL_ENABLE (1 << 5)
40 40
41#ifndef __ASSEMBLY__ 41#ifndef __ASSEMBLY__
42void vic_init(void __iomem *base, u32 vic_sources); 42void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources);
43#endif 43#endif
44 44
45#endif 45#endif
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index fd0147e52dbb..b3479fc1cc8f 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -226,42 +226,6 @@ out:
226#endif /* __mem_pci */ 226#endif /* __mem_pci */
227 227
228/* 228/*
229 * If this architecture has ISA IO, then define the isa_read/isa_write
230 * macros.
231 */
232#ifdef __mem_isa
233
234#define isa_readb(addr) __raw_readb(__mem_isa(addr))
235#define isa_readw(addr) __raw_readw(__mem_isa(addr))
236#define isa_readl(addr) __raw_readl(__mem_isa(addr))
237#define isa_writeb(val,addr) __raw_writeb(val,__mem_isa(addr))
238#define isa_writew(val,addr) __raw_writew(val,__mem_isa(addr))
239#define isa_writel(val,addr) __raw_writel(val,__mem_isa(addr))
240#define isa_memset_io(a,b,c) _memset_io(__mem_isa(a),(b),(c))
241#define isa_memcpy_fromio(a,b,c) _memcpy_fromio((a),__mem_isa(b),(c))
242#define isa_memcpy_toio(a,b,c) _memcpy_toio(__mem_isa((a)),(b),(c))
243
244#define isa_eth_io_copy_and_sum(a,b,c,d) \
245 eth_copy_and_sum((a),__mem_isa(b),(c),(d))
246
247#else /* __mem_isa */
248
249#define isa_readb(addr) (__readwrite_bug("isa_readb"),0)
250#define isa_readw(addr) (__readwrite_bug("isa_readw"),0)
251#define isa_readl(addr) (__readwrite_bug("isa_readl"),0)
252#define isa_writeb(val,addr) __readwrite_bug("isa_writeb")
253#define isa_writew(val,addr) __readwrite_bug("isa_writew")
254#define isa_writel(val,addr) __readwrite_bug("isa_writel")
255#define isa_memset_io(a,b,c) __readwrite_bug("isa_memset_io")
256#define isa_memcpy_fromio(a,b,c) __readwrite_bug("isa_memcpy_fromio")
257#define isa_memcpy_toio(a,b,c) __readwrite_bug("isa_memcpy_toio")
258
259#define isa_eth_io_copy_and_sum(a,b,c,d) \
260 __readwrite_bug("isa_eth_io_copy_and_sum")
261
262#endif /* __mem_isa */
263
264/*
265 * ioremap and friends. 229 * ioremap and friends.
266 * 230 *
267 * ioremap takes a PCI memory address, as specified in 231 * ioremap takes a PCI memory address, as specified in
diff --git a/include/asm-arm/irq.h b/include/asm-arm/irq.h
index 7772432d3fd7..60b5105c9c93 100644
--- a/include/asm-arm/irq.h
+++ b/include/asm-arm/irq.h
@@ -27,7 +27,7 @@ extern void enable_irq(unsigned int);
27 27
28/* 28/*
29 * These correspond with the SA_TRIGGER_* defines, and therefore the 29 * These correspond with the SA_TRIGGER_* defines, and therefore the
30 * IRQRESOURCE_IRQ_* defines. 30 * IORESOURCE_IRQ_* defines.
31 */ 31 */
32#define __IRQT_RISEDGE (1 << 0) 32#define __IRQT_RISEDGE (1 << 0)
33#define __IRQT_FALEDGE (1 << 1) 33#define __IRQT_FALEDGE (1 << 1)
diff --git a/include/asm-arm/mach/arch.h b/include/asm-arm/mach/arch.h
index 2cd57b4d64d9..fd2f9bf4dcc6 100644
--- a/include/asm-arm/mach/arch.h
+++ b/include/asm-arm/mach/arch.h
@@ -10,19 +10,16 @@
10 10
11#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
12 12
13#include <linux/compiler.h>
14
15struct tag; 13struct tag;
16struct meminfo; 14struct meminfo;
17struct sys_timer; 15struct sys_timer;
18 16
19struct machine_desc { 17struct machine_desc {
20 /* 18 /*
21 * Note! The first five elements are used 19 * Note! The first four elements are used
22 * by assembler code in head-armv.S 20 * by assembler code in head-armv.S
23 */ 21 */
24 unsigned int nr; /* architecture number */ 22 unsigned int nr; /* architecture number */
25 unsigned int __deprecated phys_ram; /* start of physical ram */
26 unsigned int phys_io; /* start of physical io */ 23 unsigned int phys_io; /* start of physical io */
27 unsigned int io_pg_offst; /* byte offset for io 24 unsigned int io_pg_offst; /* byte offset for io
28 * page tabe entry */ 25 * page tabe entry */
diff --git a/include/asm-arm/mach/irq.h b/include/asm-arm/mach/irq.h
index 0ce6ca588d8c..d4d420ecf3a8 100644
--- a/include/asm-arm/mach/irq.h
+++ b/include/asm-arm/mach/irq.h
@@ -61,7 +61,7 @@ struct irqdesc {
61 struct irqchip *chip; 61 struct irqchip *chip;
62 struct irqaction *action; 62 struct irqaction *action;
63 struct list_head pend; 63 struct list_head pend;
64 void *chipdata; 64 void __iomem *base;
65 void *data; 65 void *data;
66 unsigned int disable_depth; 66 unsigned int disable_depth;
67 67
@@ -74,6 +74,7 @@ struct irqdesc {
74 unsigned int noautoenable : 1; /* don't automatically enable IRQ */ 74 unsigned int noautoenable : 1; /* don't automatically enable IRQ */
75 unsigned int unused :25; 75 unsigned int unused :25;
76 76
77 unsigned int irqs_unhandled;
77 struct proc_dir_entry *procdir; 78 struct proc_dir_entry *procdir;
78 79
79#ifdef CONFIG_SMP 80#ifdef CONFIG_SMP
@@ -113,8 +114,8 @@ void __set_irq_handler(unsigned int irq, irq_handler_t, int);
113#define set_irq_handler(irq,handler) __set_irq_handler(irq,handler,0) 114#define set_irq_handler(irq,handler) __set_irq_handler(irq,handler,0)
114#define set_irq_chained_handler(irq,handler) __set_irq_handler(irq,handler,1) 115#define set_irq_chained_handler(irq,handler) __set_irq_handler(irq,handler,1)
115#define set_irq_data(irq,d) do { irq_desc[irq].data = d; } while (0) 116#define set_irq_data(irq,d) do { irq_desc[irq].data = d; } while (0)
116#define set_irq_chipdata(irq,d) do { irq_desc[irq].chipdata = d; } while (0) 117#define set_irq_chipdata(irq,d) do { irq_desc[irq].base = d; } while (0)
117#define get_irq_chipdata(irq) (irq_desc[irq].chipdata) 118#define get_irq_chipdata(irq) (irq_desc[irq].base)
118 119
119void set_irq_chip(unsigned int irq, struct irqchip *); 120void set_irq_chip(unsigned int irq, struct irqchip *);
120void set_irq_flags(unsigned int irq, unsigned int flags); 121void set_irq_flags(unsigned int irq, unsigned int flags);
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h
index b4e1146ab682..afa5c3ea077c 100644
--- a/include/asm-arm/memory.h
+++ b/include/asm-arm/memory.h
@@ -172,9 +172,7 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
172 * virt_addr_valid(k) indicates whether a virtual address is valid 172 * virt_addr_valid(k) indicates whether a virtual address is valid
173 */ 173 */
174#ifndef CONFIG_DISCONTIGMEM 174#ifndef CONFIG_DISCONTIGMEM
175 175#define ARCH_PFN_OFFSET (PHYS_PFN_OFFSET)
176#define page_to_pfn(page) (((page) - mem_map) + PHYS_PFN_OFFSET)
177#define pfn_to_page(pfn) ((mem_map + (pfn)) - PHYS_PFN_OFFSET)
178#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr)) 176#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
179 177
180#define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)) 178#define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
@@ -189,13 +187,8 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
189 * around in memory. 187 * around in memory.
190 */ 188 */
191#include <linux/numa.h> 189#include <linux/numa.h>
192 190#define arch_pfn_to_nid(pfn) (PFN_TO_NID(pfn))
193#define page_to_pfn(page) \ 191#define arch_local_page_offset(pfn, nid) (LOCAL_MAP_NR((pfn) << PAGE_OFFSET))
194 (( (page) - page_zone(page)->zone_mem_map) \
195 + page_zone(page)->zone_start_pfn)
196
197#define pfn_to_page(pfn) \
198 (PFN_TO_MAPBASE(pfn) + LOCAL_MAP_NR((pfn) << PAGE_SHIFT))
199 192
200#define pfn_valid(pfn) \ 193#define pfn_valid(pfn) \
201 ({ \ 194 ({ \
@@ -243,4 +236,6 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
243 236
244#endif 237#endif
245 238
239#include <asm-generic/memory_model.h>
240
246#endif 241#endif
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 416320d95419..a404d2bf0c68 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -40,6 +40,7 @@
40 * v4wb - ARMv4 with writeback cache, without minicache 40 * v4wb - ARMv4 with writeback cache, without minicache
41 * v4_mc - ARMv4 with minicache 41 * v4_mc - ARMv4 with minicache
42 * xscale - Xscale 42 * xscale - Xscale
43 * xsc3 - XScalev3
43 */ 44 */
44#undef _USER 45#undef _USER
45#undef MULTI_USER 46#undef MULTI_USER
@@ -84,6 +85,14 @@
84# endif 85# endif
85#endif 86#endif
86 87
88#ifdef CONFIG_CPU_XSC3
89# ifdef _USER
90# define MULTI_USER 1
91# else
92# define _USER xsc3_mc
93# endif
94#endif
95
87#ifdef CONFIG_CPU_COPY_V6 96#ifdef CONFIG_CPU_COPY_V6
88# define MULTI_USER 1 97# define MULTI_USER 1
89#endif 98#endif
diff --git a/include/asm-arm/param.h b/include/asm-arm/param.h
index 94223d4d7e88..15806468ba72 100644
--- a/include/asm-arm/param.h
+++ b/include/asm-arm/param.h
@@ -11,12 +11,7 @@
11#define __ASM_PARAM_H 11#define __ASM_PARAM_H
12 12
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14# include <asm/arch/param.h> /* for kernel version of HZ */ 14# define HZ CONFIG_HZ /* Internal kernel timer frequency */
15
16# ifndef HZ
17# define HZ 100 /* Internal kernel timer frequency */
18# endif
19
20# define USER_HZ 100 /* User interfaces are in "ticks" */ 15# define USER_HZ 100 /* User interfaces are in "ticks" */
21# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ 16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
22#else 17#else
diff --git a/include/asm-arm/pgalloc.h b/include/asm-arm/pgalloc.h
index bc18ff405181..c4ac2e67768d 100644
--- a/include/asm-arm/pgalloc.h
+++ b/include/asm-arm/pgalloc.h
@@ -10,10 +10,15 @@
10#ifndef _ASMARM_PGALLOC_H 10#ifndef _ASMARM_PGALLOC_H
11#define _ASMARM_PGALLOC_H 11#define _ASMARM_PGALLOC_H
12 12
13#include <asm/domain.h>
14#include <asm/pgtable-hwdef.h>
13#include <asm/processor.h> 15#include <asm/processor.h>
14#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
15#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
16 18
19#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER))
20#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_KERNEL))
21
17/* 22/*
18 * Since we have only two-level page tables, these are trivial 23 * Since we have only two-level page tables, these are trivial
19 */ 24 */
diff --git a/include/asm-arm/pgtable-hwdef.h b/include/asm-arm/pgtable-hwdef.h
new file mode 100644
index 000000000000..1d033495cc75
--- /dev/null
+++ b/include/asm-arm/pgtable-hwdef.h
@@ -0,0 +1,88 @@
1/*
2 * linux/include/asm-arm/pgtable-hwdef.h
3 *
4 * Copyright (C) 1995-2002 Russell King
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#ifndef _ASMARM_PGTABLE_HWDEF_H
11#define _ASMARM_PGTABLE_HWDEF_H
12
13/*
14 * Hardware page table definitions.
15 *
16 * + Level 1 descriptor (PMD)
17 * - common
18 */
19#define PMD_TYPE_MASK (3 << 0)
20#define PMD_TYPE_FAULT (0 << 0)
21#define PMD_TYPE_TABLE (1 << 0)
22#define PMD_TYPE_SECT (2 << 0)
23#define PMD_BIT4 (1 << 4)
24#define PMD_DOMAIN(x) ((x) << 5)
25#define PMD_PROTECTION (1 << 9) /* v5 */
26/*
27 * - section
28 */
29#define PMD_SECT_BUFFERABLE (1 << 2)
30#define PMD_SECT_CACHEABLE (1 << 3)
31#define PMD_SECT_AP_WRITE (1 << 10)
32#define PMD_SECT_AP_READ (1 << 11)
33#define PMD_SECT_TEX(x) ((x) << 12) /* v5 */
34#define PMD_SECT_APX (1 << 15) /* v6 */
35#define PMD_SECT_S (1 << 16) /* v6 */
36#define PMD_SECT_nG (1 << 17) /* v6 */
37#define PMD_SECT_SUPER (1 << 18) /* v6 */
38
39#define PMD_SECT_UNCACHED (0)
40#define PMD_SECT_BUFFERED (PMD_SECT_BUFFERABLE)
41#define PMD_SECT_WT (PMD_SECT_CACHEABLE)
42#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
43#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE)
44#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
45#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2))
46
47/*
48 * - coarse table (not used)
49 */
50
51/*
52 * + Level 2 descriptor (PTE)
53 * - common
54 */
55#define PTE_TYPE_MASK (3 << 0)
56#define PTE_TYPE_FAULT (0 << 0)
57#define PTE_TYPE_LARGE (1 << 0)
58#define PTE_TYPE_SMALL (2 << 0)
59#define PTE_TYPE_EXT (3 << 0) /* v5 */
60#define PTE_BUFFERABLE (1 << 2)
61#define PTE_CACHEABLE (1 << 3)
62
63/*
64 * - extended small page/tiny page
65 */
66#define PTE_EXT_XN (1 << 0) /* v6 */
67#define PTE_EXT_AP_MASK (3 << 4)
68#define PTE_EXT_AP0 (1 << 4)
69#define PTE_EXT_AP1 (2 << 4)
70#define PTE_EXT_AP_UNO_SRO (0 << 4)
71#define PTE_EXT_AP_UNO_SRW (PTE_EXT_AP0)
72#define PTE_EXT_AP_URO_SRW (PTE_EXT_AP1)
73#define PTE_EXT_AP_URW_SRW (PTE_EXT_AP1|PTE_EXT_AP0)
74#define PTE_EXT_TEX(x) ((x) << 6) /* v5 */
75#define PTE_EXT_APX (1 << 9) /* v6 */
76#define PTE_EXT_SHARED (1 << 10) /* v6 */
77#define PTE_EXT_NG (1 << 11) /* v6 */
78
79/*
80 * - small page
81 */
82#define PTE_SMALL_AP_MASK (0xff << 4)
83#define PTE_SMALL_AP_UNO_SRO (0x00 << 4)
84#define PTE_SMALL_AP_UNO_SRW (0x55 << 4)
85#define PTE_SMALL_AP_URO_SRW (0xaa << 4)
86#define PTE_SMALL_AP_URW_SRW (0xff << 4)
87
88#endif
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index 70e00d08345e..e595ae24efe2 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -137,81 +137,6 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
137#define SUPERSECTION_MASK (~(SUPERSECTION_SIZE-1)) 137#define SUPERSECTION_MASK (~(SUPERSECTION_SIZE-1))
138 138
139/* 139/*
140 * Hardware page table definitions.
141 *
142 * + Level 1 descriptor (PMD)
143 * - common
144 */
145#define PMD_TYPE_MASK (3 << 0)
146#define PMD_TYPE_FAULT (0 << 0)
147#define PMD_TYPE_TABLE (1 << 0)
148#define PMD_TYPE_SECT (2 << 0)
149#define PMD_BIT4 (1 << 4)
150#define PMD_DOMAIN(x) ((x) << 5)
151#define PMD_PROTECTION (1 << 9) /* v5 */
152/*
153 * - section
154 */
155#define PMD_SECT_BUFFERABLE (1 << 2)
156#define PMD_SECT_CACHEABLE (1 << 3)
157#define PMD_SECT_AP_WRITE (1 << 10)
158#define PMD_SECT_AP_READ (1 << 11)
159#define PMD_SECT_TEX(x) ((x) << 12) /* v5 */
160#define PMD_SECT_APX (1 << 15) /* v6 */
161#define PMD_SECT_S (1 << 16) /* v6 */
162#define PMD_SECT_nG (1 << 17) /* v6 */
163#define PMD_SECT_SUPER (1 << 18) /* v6 */
164
165#define PMD_SECT_UNCACHED (0)
166#define PMD_SECT_BUFFERED (PMD_SECT_BUFFERABLE)
167#define PMD_SECT_WT (PMD_SECT_CACHEABLE)
168#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
169#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE)
170#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
171#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2))
172
173/*
174 * - coarse table (not used)
175 */
176
177/*
178 * + Level 2 descriptor (PTE)
179 * - common
180 */
181#define PTE_TYPE_MASK (3 << 0)
182#define PTE_TYPE_FAULT (0 << 0)
183#define PTE_TYPE_LARGE (1 << 0)
184#define PTE_TYPE_SMALL (2 << 0)
185#define PTE_TYPE_EXT (3 << 0) /* v5 */
186#define PTE_BUFFERABLE (1 << 2)
187#define PTE_CACHEABLE (1 << 3)
188
189/*
190 * - extended small page/tiny page
191 */
192#define PTE_EXT_XN (1 << 0) /* v6 */
193#define PTE_EXT_AP_MASK (3 << 4)
194#define PTE_EXT_AP0 (1 << 4)
195#define PTE_EXT_AP1 (2 << 4)
196#define PTE_EXT_AP_UNO_SRO (0 << 4)
197#define PTE_EXT_AP_UNO_SRW (PTE_EXT_AP0)
198#define PTE_EXT_AP_URO_SRW (PTE_EXT_AP1)
199#define PTE_EXT_AP_URW_SRW (PTE_EXT_AP1|PTE_EXT_AP0)
200#define PTE_EXT_TEX(x) ((x) << 6) /* v5 */
201#define PTE_EXT_APX (1 << 9) /* v6 */
202#define PTE_EXT_SHARED (1 << 10) /* v6 */
203#define PTE_EXT_NG (1 << 11) /* v6 */
204
205/*
206 * - small page
207 */
208#define PTE_SMALL_AP_MASK (0xff << 4)
209#define PTE_SMALL_AP_UNO_SRO (0x00 << 4)
210#define PTE_SMALL_AP_UNO_SRW (0x55 << 4)
211#define PTE_SMALL_AP_URO_SRW (0xaa << 4)
212#define PTE_SMALL_AP_URW_SRW (0xff << 4)
213
214/*
215 * "Linux" PTE definitions. 140 * "Linux" PTE definitions.
216 * 141 *
217 * We keep two sets of PTEs - the hardware and the linux version. 142 * We keep two sets of PTEs - the hardware and the linux version.
@@ -236,11 +161,6 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
236 161
237#ifndef __ASSEMBLY__ 162#ifndef __ASSEMBLY__
238 163
239#include <asm/domain.h>
240
241#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER))
242#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_KERNEL))
243
244/* 164/*
245 * The following macros handle the cache and bufferable bits... 165 * The following macros handle the cache and bufferable bits...
246 */ 166 */
diff --git a/include/asm-arm/poll.h b/include/asm-arm/poll.h
index 2744ca831f5d..5030b2b232a3 100644
--- a/include/asm-arm/poll.h
+++ b/include/asm-arm/poll.h
@@ -16,6 +16,7 @@
16#define POLLWRBAND 0x0200 16#define POLLWRBAND 0x0200
17#define POLLMSG 0x0400 17#define POLLMSG 0x0400
18#define POLLREMOVE 0x1000 18#define POLLREMOVE 0x1000
19#define POLLRDHUP 0x2000
19 20
20struct pollfd { 21struct pollfd {
21 int fd; 22 int fd;
diff --git a/include/asm-arm/proc-fns.h b/include/asm-arm/proc-fns.h
index 7bef2bf6be51..106045edb862 100644
--- a/include/asm-arm/proc-fns.h
+++ b/include/asm-arm/proc-fns.h
@@ -138,6 +138,14 @@
138# define CPU_NAME cpu_xscale 138# define CPU_NAME cpu_xscale
139# endif 139# endif
140# endif 140# endif
141# ifdef CONFIG_CPU_XSC3
142# ifdef CPU_NAME
143# undef MULTI_CPU
144# define MULTI_CPU
145# else
146# define CPU_NAME cpu_xsc3
147# endif
148# endif
141# ifdef CONFIG_CPU_V6 149# ifdef CONFIG_CPU_V6
142# ifdef CPU_NAME 150# ifdef CPU_NAME
143# undef MULTI_CPU 151# undef MULTI_CPU
diff --git a/include/asm-arm/rtc.h b/include/asm-arm/rtc.h
index 370dfe77589d..1a5c9232a91e 100644
--- a/include/asm-arm/rtc.h
+++ b/include/asm-arm/rtc.h
@@ -25,9 +25,6 @@ struct rtc_ops {
25 int (*proc)(char *buf); 25 int (*proc)(char *buf);
26}; 26};
27 27
28void rtc_time_to_tm(unsigned long, struct rtc_time *);
29int rtc_tm_to_time(struct rtc_time *, unsigned long *);
30int rtc_valid_tm(struct rtc_time *);
31void rtc_next_alarm_time(struct rtc_time *, struct rtc_time *, struct rtc_time *); 28void rtc_next_alarm_time(struct rtc_time *, struct rtc_time *, struct rtc_time *);
32void rtc_update(unsigned long, unsigned long); 29void rtc_update(unsigned long, unsigned long);
33int register_rtc(struct rtc_ops *); 30int register_rtc(struct rtc_ops *);
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index eb2de8c10515..95b3abf4851b 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -108,6 +108,25 @@ extern void __show_regs(struct pt_regs *);
108extern int cpu_architecture(void); 108extern int cpu_architecture(void);
109extern void cpu_init(void); 109extern void cpu_init(void);
110 110
111/*
112 * Intel's XScale3 core supports some v6 features (supersections, L2)
113 * but advertises itself as v5 as it does not support the v6 ISA. For
114 * this reason, we need a way to explicitly test for this type of CPU.
115 */
116#ifndef CONFIG_CPU_XSC3
117#define cpu_is_xsc3() 0
118#else
119static inline int cpu_is_xsc3(void)
120{
121 extern unsigned int processor_id;
122
123 if ((processor_id & 0xffffe000) == 0x69056000)
124 return 1;
125
126 return 0;
127}
128#endif
129
111#define set_cr(x) \ 130#define set_cr(x) \
112 __asm__ __volatile__( \ 131 __asm__ __volatile__( \
113 "mcr p15, 0, %0, c1, c0, 0 @ set CR" \ 132 "mcr p15, 0, %0, c1, c0, 0 @ set CR" \
@@ -415,6 +434,9 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
415 return ret; 434 return ret;
416} 435}
417 436
437extern void disable_hlt(void);
438extern void enable_hlt(void);
439
418#endif /* __ASSEMBLY__ */ 440#endif /* __ASSEMBLY__ */
419 441
420#define arch_align_stack(x) (x) 442#define arch_align_stack(x) (x)
diff --git a/include/asm-arm/tlb.h b/include/asm-arm/tlb.h
index f49bfb78c221..cb740025d413 100644
--- a/include/asm-arm/tlb.h
+++ b/include/asm-arm/tlb.h
@@ -19,6 +19,14 @@
19 19
20#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
21#include <asm/tlbflush.h> 21#include <asm/tlbflush.h>
22
23#ifndef CONFIG_MMU
24
25#include <linux/pagemap.h>
26#include <asm-generic/tlb.h>
27
28#else /* !CONFIG_MMU */
29
22#include <asm/pgalloc.h> 30#include <asm/pgalloc.h>
23 31
24/* 32/*
@@ -82,4 +90,5 @@ tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
82 90
83#define tlb_migrate_finish(mm) do { } while (0) 91#define tlb_migrate_finish(mm) do { } while (0)
84 92
93#endif /* CONFIG_MMU */
85#endif 94#endif
diff --git a/include/asm-arm/tlbflush.h b/include/asm-arm/tlbflush.h
index 0c2acc944a0a..728992451dd1 100644
--- a/include/asm-arm/tlbflush.h
+++ b/include/asm-arm/tlbflush.h
@@ -11,6 +11,13 @@
11#define _ASMARM_TLBFLUSH_H 11#define _ASMARM_TLBFLUSH_H
12 12
13#include <linux/config.h> 13#include <linux/config.h>
14
15#ifndef CONFIG_MMU
16
17#define tlb_flush(tlb) ((void) tlb)
18
19#else /* CONFIG_MMU */
20
14#include <asm/glue.h> 21#include <asm/glue.h>
15 22
16#define TLB_V3_PAGE (1 << 0) 23#define TLB_V3_PAGE (1 << 0)
@@ -423,4 +430,6 @@ extern void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte
423 430
424#endif 431#endif
425 432
433#endif /* CONFIG_MMU */
434
426#endif 435#endif
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 8f331bbd39a8..65ac305c2d45 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -308,8 +308,6 @@
308#define __NR_mq_notify (__NR_SYSCALL_BASE+278) 308#define __NR_mq_notify (__NR_SYSCALL_BASE+278)
309#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279) 309#define __NR_mq_getsetattr (__NR_SYSCALL_BASE+279)
310#define __NR_waitid (__NR_SYSCALL_BASE+280) 310#define __NR_waitid (__NR_SYSCALL_BASE+280)
311
312#if defined(__ARM_EABI__) /* reserve these for un-muxing socketcall */
313#define __NR_socket (__NR_SYSCALL_BASE+281) 311#define __NR_socket (__NR_SYSCALL_BASE+281)
314#define __NR_bind (__NR_SYSCALL_BASE+282) 312#define __NR_bind (__NR_SYSCALL_BASE+282)
315#define __NR_connect (__NR_SYSCALL_BASE+283) 313#define __NR_connect (__NR_SYSCALL_BASE+283)
@@ -327,9 +325,6 @@
327#define __NR_getsockopt (__NR_SYSCALL_BASE+295) 325#define __NR_getsockopt (__NR_SYSCALL_BASE+295)
328#define __NR_sendmsg (__NR_SYSCALL_BASE+296) 326#define __NR_sendmsg (__NR_SYSCALL_BASE+296)
329#define __NR_recvmsg (__NR_SYSCALL_BASE+297) 327#define __NR_recvmsg (__NR_SYSCALL_BASE+297)
330#endif
331
332#if defined(__ARM_EABI__) /* reserve these for un-muxing ipc */
333#define __NR_semop (__NR_SYSCALL_BASE+298) 328#define __NR_semop (__NR_SYSCALL_BASE+298)
334#define __NR_semget (__NR_SYSCALL_BASE+299) 329#define __NR_semget (__NR_SYSCALL_BASE+299)
335#define __NR_semctl (__NR_SYSCALL_BASE+300) 330#define __NR_semctl (__NR_SYSCALL_BASE+300)
@@ -341,16 +336,10 @@
341#define __NR_shmdt (__NR_SYSCALL_BASE+306) 336#define __NR_shmdt (__NR_SYSCALL_BASE+306)
342#define __NR_shmget (__NR_SYSCALL_BASE+307) 337#define __NR_shmget (__NR_SYSCALL_BASE+307)
343#define __NR_shmctl (__NR_SYSCALL_BASE+308) 338#define __NR_shmctl (__NR_SYSCALL_BASE+308)
344#endif
345
346#define __NR_add_key (__NR_SYSCALL_BASE+309) 339#define __NR_add_key (__NR_SYSCALL_BASE+309)
347#define __NR_request_key (__NR_SYSCALL_BASE+310) 340#define __NR_request_key (__NR_SYSCALL_BASE+310)
348#define __NR_keyctl (__NR_SYSCALL_BASE+311) 341#define __NR_keyctl (__NR_SYSCALL_BASE+311)
349
350#if defined(__ARM_EABI__) /* reserved for un-muxing ipc */
351#define __NR_semtimedop (__NR_SYSCALL_BASE+312) 342#define __NR_semtimedop (__NR_SYSCALL_BASE+312)
352#endif
353
354#define __NR_vserver (__NR_SYSCALL_BASE+313) 343#define __NR_vserver (__NR_SYSCALL_BASE+313)
355#define __NR_ioprio_set (__NR_SYSCALL_BASE+314) 344#define __NR_ioprio_set (__NR_SYSCALL_BASE+314)
356#define __NR_ioprio_get (__NR_SYSCALL_BASE+315) 345#define __NR_ioprio_get (__NR_SYSCALL_BASE+315)
diff --git a/include/asm-arm26/bitops.h b/include/asm-arm26/bitops.h
index d87f8634e625..19a69573a654 100644
--- a/include/asm-arm26/bitops.h
+++ b/include/asm-arm26/bitops.h
@@ -117,65 +117,7 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
117 return res & mask; 117 return res & mask;
118} 118}
119 119
120/* 120#include <asm-generic/bitops/non-atomic.h>
121 * Now the non-atomic variants. We let the compiler handle all
122 * optimisations for these. These are all _native_ endian.
123 */
124static inline void __set_bit(int nr, volatile unsigned long *p)
125{
126 p[nr >> 5] |= (1UL << (nr & 31));
127}
128
129static inline void __clear_bit(int nr, volatile unsigned long *p)
130{
131 p[nr >> 5] &= ~(1UL << (nr & 31));
132}
133
134static inline void __change_bit(int nr, volatile unsigned long *p)
135{
136 p[nr >> 5] ^= (1UL << (nr & 31));
137}
138
139static inline int __test_and_set_bit(int nr, volatile unsigned long *p)
140{
141 unsigned long oldval, mask = 1UL << (nr & 31);
142
143 p += nr >> 5;
144
145 oldval = *p;
146 *p = oldval | mask;
147 return oldval & mask;
148}
149
150static inline int __test_and_clear_bit(int nr, volatile unsigned long *p)
151{
152 unsigned long oldval, mask = 1UL << (nr & 31);
153
154 p += nr >> 5;
155
156 oldval = *p;
157 *p = oldval & ~mask;
158 return oldval & mask;
159}
160
161static inline int __test_and_change_bit(int nr, volatile unsigned long *p)
162{
163 unsigned long oldval, mask = 1UL << (nr & 31);
164
165 p += nr >> 5;
166
167 oldval = *p;
168 *p = oldval ^ mask;
169 return oldval & mask;
170}
171
172/*
173 * This routine doesn't need to be atomic.
174 */
175static inline int __test_bit(int nr, const volatile unsigned long * p)
176{
177 return (p[nr >> 5] >> (nr & 31)) & 1UL;
178}
179 121
180/* 122/*
181 * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. 123 * Little endian assembly bitops. nr = 0 -> byte 0 bit 0.
@@ -211,7 +153,6 @@ extern int _find_next_bit_le(const unsigned long *p, int size, int offset);
211#define test_and_set_bit(nr,p) ATOMIC_BITOP_LE(test_and_set_bit,nr,p) 153#define test_and_set_bit(nr,p) ATOMIC_BITOP_LE(test_and_set_bit,nr,p)
212#define test_and_clear_bit(nr,p) ATOMIC_BITOP_LE(test_and_clear_bit,nr,p) 154#define test_and_clear_bit(nr,p) ATOMIC_BITOP_LE(test_and_clear_bit,nr,p)
213#define test_and_change_bit(nr,p) ATOMIC_BITOP_LE(test_and_change_bit,nr,p) 155#define test_and_change_bit(nr,p) ATOMIC_BITOP_LE(test_and_change_bit,nr,p)
214#define test_bit(nr,p) __test_bit(nr,p)
215#define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz) 156#define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz)
216#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off) 157#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off)
217#define find_first_bit(p,sz) _find_first_bit_le(p,sz) 158#define find_first_bit(p,sz) _find_first_bit_le(p,sz)
@@ -219,80 +160,13 @@ extern int _find_next_bit_le(const unsigned long *p, int size, int offset);
219 160
220#define WORD_BITOFF_TO_LE(x) ((x)) 161#define WORD_BITOFF_TO_LE(x) ((x))
221 162
222/* 163#include <asm-generic/bitops/ffz.h>
223 * ffz = Find First Zero in word. Undefined if no zero exists, 164#include <asm-generic/bitops/__ffs.h>
224 * so code should check against ~0UL first.. 165#include <asm-generic/bitops/fls.h>
225 */ 166#include <asm-generic/bitops/fls64.h>
226static inline unsigned long ffz(unsigned long word) 167#include <asm-generic/bitops/ffs.h>
227{ 168#include <asm-generic/bitops/sched.h>
228 int k; 169#include <asm-generic/bitops/hweight.h>
229
230 word = ~word;
231 k = 31;
232 if (word & 0x0000ffff) { k -= 16; word <<= 16; }
233 if (word & 0x00ff0000) { k -= 8; word <<= 8; }
234 if (word & 0x0f000000) { k -= 4; word <<= 4; }
235 if (word & 0x30000000) { k -= 2; word <<= 2; }
236 if (word & 0x40000000) { k -= 1; }
237 return k;
238}
239
240/*
241 * ffz = Find First Zero in word. Undefined if no zero exists,
242 * so code should check against ~0UL first..
243 */
244static inline unsigned long __ffs(unsigned long word)
245{
246 int k;
247
248 k = 31;
249 if (word & 0x0000ffff) { k -= 16; word <<= 16; }
250 if (word & 0x00ff0000) { k -= 8; word <<= 8; }
251 if (word & 0x0f000000) { k -= 4; word <<= 4; }
252 if (word & 0x30000000) { k -= 2; word <<= 2; }
253 if (word & 0x40000000) { k -= 1; }
254 return k;
255}
256
257/*
258 * fls: find last bit set.
259 */
260
261#define fls(x) generic_fls(x)
262#define fls64(x) generic_fls64(x)
263
264/*
265 * ffs: find first bit set. This is defined the same way as
266 * the libc and compiler builtin ffs routines, therefore
267 * differs in spirit from the above ffz (man ffs).
268 */
269
270#define ffs(x) generic_ffs(x)
271
272/*
273 * Find first bit set in a 168-bit bitmap, where the first
274 * 128 bits are unlikely to be set.
275 */
276static inline int sched_find_first_bit(unsigned long *b)
277{
278 unsigned long v;
279 unsigned int off;
280
281 for (off = 0; v = b[off], off < 4; off++) {
282 if (unlikely(v))
283 break;
284 }
285 return __ffs(v) + off * 32;
286}
287
288/*
289 * hweightN: returns the hamming weight (i.e. the number
290 * of bits set) of a N-bit word
291 */
292
293#define hweight32(x) generic_hweight32(x)
294#define hweight16(x) generic_hweight16(x)
295#define hweight8(x) generic_hweight8(x)
296 170
297/* 171/*
298 * Ext2 is defined to use little-endian byte ordering. 172 * Ext2 is defined to use little-endian byte ordering.
@@ -307,7 +181,7 @@ static inline int sched_find_first_bit(unsigned long *b)
307#define ext2_clear_bit_atomic(lock,nr,p) \ 181#define ext2_clear_bit_atomic(lock,nr,p) \
308 test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) 182 test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
309#define ext2_test_bit(nr,p) \ 183#define ext2_test_bit(nr,p) \
310 __test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) 184 test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
311#define ext2_find_first_zero_bit(p,sz) \ 185#define ext2_find_first_zero_bit(p,sz) \
312 _find_first_zero_bit_le(p,sz) 186 _find_first_zero_bit_le(p,sz)
313#define ext2_find_next_zero_bit(p,sz,off) \ 187#define ext2_find_next_zero_bit(p,sz,off) \
@@ -320,7 +194,7 @@ static inline int sched_find_first_bit(unsigned long *b)
320#define minix_set_bit(nr,p) \ 194#define minix_set_bit(nr,p) \
321 __set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) 195 __set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
322#define minix_test_bit(nr,p) \ 196#define minix_test_bit(nr,p) \
323 __test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) 197 test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
324#define minix_test_and_set_bit(nr,p) \ 198#define minix_test_and_set_bit(nr,p) \
325 __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p)) 199 __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
326#define minix_test_and_clear_bit(nr,p) \ 200#define minix_test_and_clear_bit(nr,p) \
diff --git a/include/asm-arm26/memory.h b/include/asm-arm26/memory.h
index 20d78616f650..a65f10b80dfb 100644
--- a/include/asm-arm26/memory.h
+++ b/include/asm-arm26/memory.h
@@ -81,8 +81,7 @@ static inline void *phys_to_virt(unsigned long x)
81 * virt_to_page(k) convert a _valid_ virtual address to struct page * 81 * virt_to_page(k) convert a _valid_ virtual address to struct page *
82 * virt_addr_valid(k) indicates whether a virtual address is valid 82 * virt_addr_valid(k) indicates whether a virtual address is valid
83 */ 83 */
84#define page_to_pfn(page) (((page) - mem_map) + PHYS_PFN_OFFSET) 84#define ARCH_PFN_OFFSET (PHYS_PFN_OFFSET)
85#define pfn_to_page(pfn) ((mem_map + (pfn)) - PHYS_PFN_OFFSET)
86#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr)) 85#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
87 86
88#define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)) 87#define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
@@ -98,4 +97,5 @@ static inline void *phys_to_virt(unsigned long x)
98 */ 97 */
99#define page_to_bus(page) (page_address(page)) 98#define page_to_bus(page) (page_address(page))
100 99
100#include <asm-generic/memory_model.h>
101#endif 101#endif
diff --git a/include/asm-arm26/poll.h b/include/asm-arm26/poll.h
index fdfdab064a65..9ccb7f4190ca 100644
--- a/include/asm-arm26/poll.h
+++ b/include/asm-arm26/poll.h
@@ -15,6 +15,7 @@
15#define POLLWRNORM 0x0100 15#define POLLWRNORM 0x0100
16#define POLLWRBAND 0x0200 16#define POLLWRBAND 0x0200
17#define POLLMSG 0x0400 17#define POLLMSG 0x0400
18#define POLLRDHUP 0x2000
18 19
19struct pollfd { 20struct pollfd {
20 int fd; 21 int fd;
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index b7fef1572dc0..a569065113d9 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -39,8 +39,6 @@ struct __dummy { unsigned long a[100]; };
39 39
40#define set_bit(nr, addr) (void)test_and_set_bit(nr, addr) 40#define set_bit(nr, addr) (void)test_and_set_bit(nr, addr)
41 41
42#define __set_bit(nr, addr) (void)__test_and_set_bit(nr, addr)
43
44/* 42/*
45 * clear_bit - Clears a bit in memory 43 * clear_bit - Clears a bit in memory
46 * @nr: Bit to clear 44 * @nr: Bit to clear
@@ -54,8 +52,6 @@ struct __dummy { unsigned long a[100]; };
54 52
55#define clear_bit(nr, addr) (void)test_and_clear_bit(nr, addr) 53#define clear_bit(nr, addr) (void)test_and_clear_bit(nr, addr)
56 54
57#define __clear_bit(nr, addr) (void)__test_and_clear_bit(nr, addr)
58
59/* 55/*
60 * change_bit - Toggle a bit in memory 56 * change_bit - Toggle a bit in memory
61 * @nr: Bit to change 57 * @nr: Bit to change
@@ -68,18 +64,6 @@ struct __dummy { unsigned long a[100]; };
68 64
69#define change_bit(nr, addr) (void)test_and_change_bit(nr, addr) 65#define change_bit(nr, addr) (void)test_and_change_bit(nr, addr)
70 66
71/*
72 * __change_bit - Toggle a bit in memory
73 * @nr: the bit to change
74 * @addr: the address to start counting from
75 *
76 * Unlike change_bit(), this function is non-atomic and may be reordered.
77 * If it's called on the same region of memory simultaneously, the effect
78 * may be that only one operation succeeds.
79 */
80
81#define __change_bit(nr, addr) (void)__test_and_change_bit(nr, addr)
82
83/** 67/**
84 * test_and_set_bit - Set a bit and return its old value 68 * test_and_set_bit - Set a bit and return its old value
85 * @nr: Bit to set 69 * @nr: Bit to set
@@ -101,19 +85,6 @@ static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
101 retval = (mask & *adr) != 0; 85 retval = (mask & *adr) != 0;
102 *adr |= mask; 86 *adr |= mask;
103 cris_atomic_restore(addr, flags); 87 cris_atomic_restore(addr, flags);
104 local_irq_restore(flags);
105 return retval;
106}
107
108static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
109{
110 unsigned int mask, retval;
111 unsigned int *adr = (unsigned int *)addr;
112
113 adr += nr >> 5;
114 mask = 1 << (nr & 0x1f);
115 retval = (mask & *adr) != 0;
116 *adr |= mask;
117 return retval; 88 return retval;
118} 89}
119 90
@@ -148,27 +119,6 @@ static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
148} 119}
149 120
150/** 121/**
151 * __test_and_clear_bit - Clear a bit and return its old value
152 * @nr: Bit to clear
153 * @addr: Address to count from
154 *
155 * This operation is non-atomic and can be reordered.
156 * If two examples of this operation race, one can appear to succeed
157 * but actually fail. You must protect multiple accesses with a lock.
158 */
159
160static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
161{
162 unsigned int mask, retval;
163 unsigned int *adr = (unsigned int *)addr;
164
165 adr += nr >> 5;
166 mask = 1 << (nr & 0x1f);
167 retval = (mask & *adr) != 0;
168 *adr &= ~mask;
169 return retval;
170}
171/**
172 * test_and_change_bit - Change a bit and return its old value 122 * test_and_change_bit - Change a bit and return its old value
173 * @nr: Bit to change 123 * @nr: Bit to change
174 * @addr: Address to count from 124 * @addr: Address to count from
@@ -191,42 +141,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
191 return retval; 141 return retval;
192} 142}
193 143
194/* WARNING: non atomic and it can be reordered! */ 144#include <asm-generic/bitops/non-atomic.h>
195
196static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
197{
198 unsigned int mask, retval;
199 unsigned int *adr = (unsigned int *)addr;
200
201 adr += nr >> 5;
202 mask = 1 << (nr & 0x1f);
203 retval = (mask & *adr) != 0;
204 *adr ^= mask;
205
206 return retval;
207}
208
209/**
210 * test_bit - Determine whether a bit is set
211 * @nr: bit number to test
212 * @addr: Address to start counting from
213 *
214 * This routine doesn't need to be atomic.
215 */
216
217static inline int test_bit(int nr, const volatile unsigned long *addr)
218{
219 unsigned int mask;
220 unsigned int *adr = (unsigned int *)addr;
221
222 adr += nr >> 5;
223 mask = 1 << (nr & 0x1f);
224 return ((mask & *adr) != 0);
225}
226
227/*
228 * Find-bit routines..
229 */
230 145
231/* 146/*
232 * Since we define it "external", it collides with the built-in 147 * Since we define it "external", it collides with the built-in
@@ -235,152 +150,18 @@ static inline int test_bit(int nr, const volatile unsigned long *addr)
235 */ 150 */
236#define ffs kernel_ffs 151#define ffs kernel_ffs
237 152
238/* 153#include <asm-generic/bitops/fls.h>
239 * fls: find last bit set. 154#include <asm-generic/bitops/fls64.h>
240 */ 155#include <asm-generic/bitops/hweight.h>
241 156#include <asm-generic/bitops/find.h>
242#define fls(x) generic_fls(x)
243#define fls64(x) generic_fls64(x)
244
245/*
246 * hweightN - returns the hamming weight of a N-bit word
247 * @x: the word to weigh
248 *
249 * The Hamming Weight of a number is the total number of bits set in it.
250 */
251 157
252#define hweight32(x) generic_hweight32(x) 158#include <asm-generic/bitops/ext2-non-atomic.h>
253#define hweight16(x) generic_hweight16(x)
254#define hweight8(x) generic_hweight8(x)
255 159
256/**
257 * find_next_zero_bit - find the first zero bit in a memory region
258 * @addr: The address to base the search on
259 * @offset: The bitnumber to start searching at
260 * @size: The maximum size to search
261 */
262static inline int find_next_zero_bit (const unsigned long * addr, int size, int offset)
263{
264 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
265 unsigned long result = offset & ~31UL;
266 unsigned long tmp;
267
268 if (offset >= size)
269 return size;
270 size -= result;
271 offset &= 31UL;
272 if (offset) {
273 tmp = *(p++);
274 tmp |= ~0UL >> (32-offset);
275 if (size < 32)
276 goto found_first;
277 if (~tmp)
278 goto found_middle;
279 size -= 32;
280 result += 32;
281 }
282 while (size & ~31UL) {
283 if (~(tmp = *(p++)))
284 goto found_middle;
285 result += 32;
286 size -= 32;
287 }
288 if (!size)
289 return result;
290 tmp = *p;
291
292 found_first:
293 tmp |= ~0UL << size;
294 found_middle:
295 return result + ffz(tmp);
296}
297
298/**
299 * find_next_bit - find the first set bit in a memory region
300 * @addr: The address to base the search on
301 * @offset: The bitnumber to start searching at
302 * @size: The maximum size to search
303 */
304static __inline__ int find_next_bit(const unsigned long *addr, int size, int offset)
305{
306 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
307 unsigned long result = offset & ~31UL;
308 unsigned long tmp;
309
310 if (offset >= size)
311 return size;
312 size -= result;
313 offset &= 31UL;
314 if (offset) {
315 tmp = *(p++);
316 tmp &= (~0UL << offset);
317 if (size < 32)
318 goto found_first;
319 if (tmp)
320 goto found_middle;
321 size -= 32;
322 result += 32;
323 }
324 while (size & ~31UL) {
325 if ((tmp = *(p++)))
326 goto found_middle;
327 result += 32;
328 size -= 32;
329 }
330 if (!size)
331 return result;
332 tmp = *p;
333
334found_first:
335 tmp &= (~0UL >> (32 - size));
336 if (tmp == 0UL) /* Are any bits set? */
337 return result + size; /* Nope. */
338found_middle:
339 return result + __ffs(tmp);
340}
341
342/**
343 * find_first_zero_bit - find the first zero bit in a memory region
344 * @addr: The address to start the search at
345 * @size: The maximum size to search
346 *
347 * Returns the bit-number of the first zero bit, not the number of the byte
348 * containing a bit.
349 */
350
351#define find_first_zero_bit(addr, size) \
352 find_next_zero_bit((addr), (size), 0)
353#define find_first_bit(addr, size) \
354 find_next_bit((addr), (size), 0)
355
356#define ext2_set_bit test_and_set_bit
357#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 160#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
358#define ext2_clear_bit test_and_clear_bit
359#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) 161#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
360#define ext2_test_bit test_bit
361#define ext2_find_first_zero_bit find_first_zero_bit
362#define ext2_find_next_zero_bit find_next_zero_bit
363
364/* Bitmap functions for the minix filesystem. */
365#define minix_set_bit(nr,addr) test_and_set_bit(nr,addr)
366#define minix_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
367#define minix_test_bit(nr,addr) test_bit(nr,addr)
368#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
369 162
370static inline int sched_find_first_bit(const unsigned long *b) 163#include <asm-generic/bitops/minix.h>
371{ 164#include <asm-generic/bitops/sched.h>
372 if (unlikely(b[0]))
373 return __ffs(b[0]);
374 if (unlikely(b[1]))
375 return __ffs(b[1]) + 32;
376 if (unlikely(b[2]))
377 return __ffs(b[2]) + 64;
378 if (unlikely(b[3]))
379 return __ffs(b[3]) + 96;
380 if (b[4])
381 return __ffs(b[4]) + 128;
382 return __ffs(b[5]) + 32 + 128;
383}
384 165
385#endif /* __KERNEL__ */ 166#endif /* __KERNEL__ */
386 167
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index c99c478c482f..3787633e6209 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -43,8 +43,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
43 43
44/* On CRIS the PFN numbers doesn't start at 0 so we have to compensate */ 44/* On CRIS the PFN numbers doesn't start at 0 so we have to compensate */
45/* for that before indexing into the page table starting at mem_map */ 45/* for that before indexing into the page table starting at mem_map */
46#define pfn_to_page(pfn) (mem_map + ((pfn) - (PAGE_OFFSET >> PAGE_SHIFT))) 46#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
47#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + (PAGE_OFFSET >> PAGE_SHIFT))
48#define pfn_valid(pfn) (((pfn) - (PAGE_OFFSET >> PAGE_SHIFT)) < max_mapnr) 47#define pfn_valid(pfn) (((pfn) - (PAGE_OFFSET >> PAGE_SHIFT)) < max_mapnr)
49 48
50/* to index into the page map. our pages all start at physical addr PAGE_OFFSET so 49/* to index into the page map. our pages all start at physical addr PAGE_OFFSET so
@@ -77,6 +76,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
77 76
78#endif /* __KERNEL__ */ 77#endif /* __KERNEL__ */
79 78
79#include <asm-generic/memory_model.h>
80#include <asm-generic/page.h> 80#include <asm-generic/page.h>
81 81
82#endif /* _CRIS_PAGE_H */ 82#endif /* _CRIS_PAGE_H */
diff --git a/include/asm-cris/poll.h b/include/asm-cris/poll.h
index 1c0efc3e4be7..1b25d4cf498c 100644
--- a/include/asm-cris/poll.h
+++ b/include/asm-cris/poll.h
@@ -15,6 +15,7 @@
15#define POLLWRBAND 512 15#define POLLWRBAND 512
16#define POLLMSG 1024 16#define POLLMSG 1024
17#define POLLREMOVE 4096 17#define POLLREMOVE 4096
18#define POLLRDHUP 8192
18 19
19struct pollfd { 20struct pollfd {
20 int fd; 21 int fd;
diff --git a/include/asm-cris/system.h b/include/asm-cris/system.h
index d48670107a85..1d63c2aa8ec2 100644
--- a/include/asm-cris/system.h
+++ b/include/asm-cris/system.h
@@ -71,4 +71,6 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
71 71
72#define arch_align_stack(x) (x) 72#define arch_align_stack(x) (x)
73 73
74void default_idle(void);
75
74#endif 76#endif
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index f686b519878e..6344d06390b9 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -22,20 +22,7 @@
22 22
23#ifdef __KERNEL__ 23#ifdef __KERNEL__
24 24
25/* 25#include <asm-generic/bitops/ffz.h>
26 * ffz = Find First Zero in word. Undefined if no zero exists,
27 * so code should check against ~0UL first..
28 */
29static inline unsigned long ffz(unsigned long word)
30{
31 unsigned long result = 0;
32
33 while (word & 1) {
34 result++;
35 word >>= 1;
36 }
37 return result;
38}
39 26
40/* 27/*
41 * clear_bit() doesn't provide any barrier for the compiler. 28 * clear_bit() doesn't provide any barrier for the compiler.
@@ -171,51 +158,9 @@ static inline int __test_bit(int nr, const volatile void * addr)
171 __constant_test_bit((nr),(addr)) : \ 158 __constant_test_bit((nr),(addr)) : \
172 __test_bit((nr),(addr))) 159 __test_bit((nr),(addr)))
173 160
174extern int find_next_bit(const unsigned long *addr, int size, int offset); 161#include <asm-generic/bitops/ffs.h>
175 162#include <asm-generic/bitops/__ffs.h>
176#define find_first_bit(addr, size) find_next_bit(addr, size, 0) 163#include <asm-generic/bitops/find.h>
177
178#define find_first_zero_bit(addr, size) \
179 find_next_zero_bit((addr), (size), 0)
180
181static inline int find_next_zero_bit(const void *addr, int size, int offset)
182{
183 const unsigned long *p = ((const unsigned long *) addr) + (offset >> 5);
184 unsigned long result = offset & ~31UL;
185 unsigned long tmp;
186
187 if (offset >= size)
188 return size;
189 size -= result;
190 offset &= 31UL;
191 if (offset) {
192 tmp = *(p++);
193 tmp |= ~0UL >> (32-offset);
194 if (size < 32)
195 goto found_first;
196 if (~tmp)
197 goto found_middle;
198 size -= 32;
199 result += 32;
200 }
201 while (size & ~31UL) {
202 if (~(tmp = *(p++)))
203 goto found_middle;
204 result += 32;
205 size -= 32;
206 }
207 if (!size)
208 return result;
209 tmp = *p;
210
211found_first:
212 tmp |= ~0UL << size;
213found_middle:
214 return result + ffz(tmp);
215}
216
217#define ffs(x) generic_ffs(x)
218#define __ffs(x) (ffs(x) - 1)
219 164
220/* 165/*
221 * fls: find last bit set. 166 * fls: find last bit set.
@@ -228,114 +173,17 @@ found_middle:
228 \ 173 \
229 bit ? 33 - bit : bit; \ 174 bit ? 33 - bit : bit; \
230}) 175})
231#define fls64(x) generic_fls64(x)
232 176
233/* 177#include <asm-generic/bitops/fls64.h>
234 * Every architecture must define this function. It's the fastest 178#include <asm-generic/bitops/sched.h>
235 * way of searching a 140-bit bitmap where the first 100 bits are 179#include <asm-generic/bitops/hweight.h>
236 * unlikely to be set. It's guaranteed that at least one of the 140
237 * bits is cleared.
238 */
239static inline int sched_find_first_bit(const unsigned long *b)
240{
241 if (unlikely(b[0]))
242 return __ffs(b[0]);
243 if (unlikely(b[1]))
244 return __ffs(b[1]) + 32;
245 if (unlikely(b[2]))
246 return __ffs(b[2]) + 64;
247 if (b[3])
248 return __ffs(b[3]) + 96;
249 return __ffs(b[4]) + 128;
250}
251 180
181#include <asm-generic/bitops/ext2-non-atomic.h>
252 182
253/* 183#define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit ((nr) ^ 0x18, (addr))
254 * hweightN: returns the hamming weight (i.e. the number 184#define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr) ^ 0x18, (addr))
255 * of bits set) of a N-bit word
256 */
257
258#define hweight32(x) generic_hweight32(x)
259#define hweight16(x) generic_hweight16(x)
260#define hweight8(x) generic_hweight8(x)
261
262#define ext2_set_bit(nr, addr) test_and_set_bit ((nr) ^ 0x18, (addr))
263#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 0x18, (addr))
264
265#define ext2_set_bit_atomic(lock,nr,addr) ext2_set_bit((nr), addr)
266#define ext2_clear_bit_atomic(lock,nr,addr) ext2_clear_bit((nr), addr)
267
268static inline int ext2_test_bit(int nr, const volatile void * addr)
269{
270 const volatile unsigned char *ADDR = (const unsigned char *) addr;
271 int mask;
272
273 ADDR += nr >> 3;
274 mask = 1 << (nr & 0x07);
275 return ((mask & *ADDR) != 0);
276}
277
278#define ext2_find_first_zero_bit(addr, size) \
279 ext2_find_next_zero_bit((addr), (size), 0)
280
281static inline unsigned long ext2_find_next_zero_bit(const void *addr,
282 unsigned long size,
283 unsigned long offset)
284{
285 const unsigned long *p = ((const unsigned long *) addr) + (offset >> 5);
286 unsigned long result = offset & ~31UL;
287 unsigned long tmp;
288
289 if (offset >= size)
290 return size;
291 size -= result;
292 offset &= 31UL;
293 if(offset) {
294 /* We hold the little endian value in tmp, but then the
295 * shift is illegal. So we could keep a big endian value
296 * in tmp, like this:
297 *
298 * tmp = __swab32(*(p++));
299 * tmp |= ~0UL >> (32-offset);
300 *
301 * but this would decrease preformance, so we change the
302 * shift:
303 */
304 tmp = *(p++);
305 tmp |= __swab32(~0UL >> (32-offset));
306 if(size < 32)
307 goto found_first;
308 if(~tmp)
309 goto found_middle;
310 size -= 32;
311 result += 32;
312 }
313 while(size & ~31UL) {
314 if(~(tmp = *(p++)))
315 goto found_middle;
316 result += 32;
317 size -= 32;
318 }
319 if(!size)
320 return result;
321 tmp = *p;
322
323found_first:
324 /* tmp is little endian, so we would have to swab the shift,
325 * see above. But then we have to swab tmp below for ffz, so
326 * we might as well do this here.
327 */
328 return result + ffz(__swab32(tmp) | (~0UL << size));
329found_middle:
330 return result + ffz(__swab32(tmp));
331}
332 185
333/* Bitmap functions for the minix filesystem. */ 186#include <asm-generic/bitops/minix-le.h>
334#define minix_test_and_set_bit(nr,addr) ext2_set_bit(nr,addr)
335#define minix_set_bit(nr,addr) ext2_set_bit(nr,addr)
336#define minix_test_and_clear_bit(nr,addr) ext2_clear_bit(nr,addr)
337#define minix_test_bit(nr,addr) ext2_test_bit(nr,addr)
338#define minix_find_first_zero_bit(addr,size) ext2_find_first_zero_bit(addr,size)
339 187
340#endif /* __KERNEL__ */ 188#endif /* __KERNEL__ */
341 189
diff --git a/include/asm-frv/futex.h b/include/asm-frv/futex.h
index fca9d90e32c9..08b3d1da3583 100644
--- a/include/asm-frv/futex.h
+++ b/include/asm-frv/futex.h
@@ -9,5 +9,11 @@
9 9
10extern int futex_atomic_op_inuser(int encoded_op, int __user *uaddr); 10extern int futex_atomic_op_inuser(int encoded_op, int __user *uaddr);
11 11
12static inline int
13futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
14{
15 return -ENOSYS;
16}
17
12#endif 18#endif
13#endif 19#endif
diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
index b8221b611b5c..dc0f7e08a4c2 100644
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -57,13 +57,9 @@ extern unsigned long min_low_pfn;
57extern unsigned long max_pfn; 57extern unsigned long max_pfn;
58 58
59#ifdef CONFIG_MMU 59#ifdef CONFIG_MMU
60#define pfn_to_page(pfn) (mem_map + (pfn))
61#define page_to_pfn(page) ((unsigned long) ((page) - mem_map))
62#define pfn_valid(pfn) ((pfn) < max_mapnr) 60#define pfn_valid(pfn) ((pfn) < max_mapnr)
63
64#else 61#else
65#define pfn_to_page(pfn) (&mem_map[(pfn) - (PAGE_OFFSET >> PAGE_SHIFT)]) 62#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
66#define page_to_pfn(page) ((PAGE_OFFSET >> PAGE_SHIFT) + (unsigned long) ((page) - mem_map))
67#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn) 63#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn)
68 64
69#endif 65#endif
@@ -87,6 +83,7 @@ extern unsigned long max_pfn;
87#define WANT_PAGE_VIRTUAL 1 83#define WANT_PAGE_VIRTUAL 1
88#endif 84#endif
89 85
86#include <asm-generic/memory_model.h>
90#include <asm-generic/page.h> 87#include <asm-generic/page.h>
91 88
92#endif /* _ASM_PAGE_H */ 89#endif /* _ASM_PAGE_H */
diff --git a/include/asm-frv/poll.h b/include/asm-frv/poll.h
index 8cbcd60e334f..c8fe8801d075 100644
--- a/include/asm-frv/poll.h
+++ b/include/asm-frv/poll.h
@@ -12,6 +12,7 @@
12#define POLLRDBAND 128 12#define POLLRDBAND 128
13#define POLLWRBAND 256 13#define POLLWRBAND 256
14#define POLLMSG 0x0400 14#define POLLMSG 0x0400
15#define POLLRDHUP 0x2000
15 16
16struct pollfd { 17struct pollfd {
17 int fd; 18 int fd;
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index 0e6d9852008c..1f9d99193df8 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -5,77 +5,27 @@
5 * For the benefit of those who are trying to port Linux to another 5 * For the benefit of those who are trying to port Linux to another
6 * architecture, here are some C-language equivalents. You should 6 * architecture, here are some C-language equivalents. You should
7 * recode these in the native assembly language, if at all possible. 7 * recode these in the native assembly language, if at all possible.
8 * To guarantee atomicity, these routines call cli() and sti() to
9 * disable interrupts while they operate. (You have to provide inline
10 * routines to cli() and sti().)
11 *
12 * Also note, these routines assume that you have 32 bit longs.
13 * You will have to change this if you are trying to port Linux to the
14 * Alpha architecture or to a Cray. :-)
15 * 8 *
16 * C language equivalents written by Theodore Ts'o, 9/26/92 9 * C language equivalents written by Theodore Ts'o, 9/26/92
17 */ 10 */
18 11
19extern __inline__ int set_bit(int nr,long * addr) 12#include <asm-generic/bitops/atomic.h>
20{ 13#include <asm-generic/bitops/non-atomic.h>
21 int mask, retval; 14#include <asm-generic/bitops/__ffs.h>
22 15#include <asm-generic/bitops/ffz.h>
23 addr += nr >> 5; 16#include <asm-generic/bitops/fls.h>
24 mask = 1 << (nr & 0x1f); 17#include <asm-generic/bitops/fls64.h>
25 cli(); 18#include <asm-generic/bitops/find.h>
26 retval = (mask & *addr) != 0;
27 *addr |= mask;
28 sti();
29 return retval;
30}
31
32extern __inline__ int clear_bit(int nr, long * addr)
33{
34 int mask, retval;
35
36 addr += nr >> 5;
37 mask = 1 << (nr & 0x1f);
38 cli();
39 retval = (mask & *addr) != 0;
40 *addr &= ~mask;
41 sti();
42 return retval;
43}
44
45extern __inline__ int test_bit(int nr, const unsigned long * addr)
46{
47 int mask;
48
49 addr += nr >> 5;
50 mask = 1 << (nr & 0x1f);
51 return ((mask & *addr) != 0);
52}
53
54/*
55 * fls: find last bit set.
56 */
57
58#define fls(x) generic_fls(x)
59#define fls64(x) generic_fls64(x)
60 19
61#ifdef __KERNEL__ 20#ifdef __KERNEL__
62 21
63/* 22#include <asm-generic/bitops/sched.h>
64 * ffs: find first bit set. This is defined the same way as 23#include <asm-generic/bitops/ffs.h>
65 * the libc and compiler builtin ffs routines, therefore 24#include <asm-generic/bitops/hweight.h>
66 * differs in spirit from the above ffz (man ffs).
67 */
68
69#define ffs(x) generic_ffs(x)
70
71/*
72 * hweightN: returns the hamming weight (i.e. the number
73 * of bits set) of a N-bit word
74 */
75 25
76#define hweight32(x) generic_hweight32(x) 26#include <asm-generic/bitops/ext2-non-atomic.h>
77#define hweight16(x) generic_hweight16(x) 27#include <asm-generic/bitops/ext2-atomic.h>
78#define hweight8(x) generic_hweight8(x) 28#include <asm-generic/bitops/minix.h>
79 29
80#endif /* __KERNEL__ */ 30#endif /* __KERNEL__ */
81 31
diff --git a/include/asm-generic/bitops/__ffs.h b/include/asm-generic/bitops/__ffs.h
new file mode 100644
index 000000000000..9a3274aecf83
--- /dev/null
+++ b/include/asm-generic/bitops/__ffs.h
@@ -0,0 +1,43 @@
1#ifndef _ASM_GENERIC_BITOPS___FFS_H_
2#define _ASM_GENERIC_BITOPS___FFS_H_
3
4#include <asm/types.h>
5
6/**
7 * __ffs - find first bit in word.
8 * @word: The word to search
9 *
10 * Undefined if no bit exists, so code should check against 0 first.
11 */
12static inline unsigned long __ffs(unsigned long word)
13{
14 int num = 0;
15
16#if BITS_PER_LONG == 64
17 if ((word & 0xffffffff) == 0) {
18 num += 32;
19 word >>= 32;
20 }
21#endif
22 if ((word & 0xffff) == 0) {
23 num += 16;
24 word >>= 16;
25 }
26 if ((word & 0xff) == 0) {
27 num += 8;
28 word >>= 8;
29 }
30 if ((word & 0xf) == 0) {
31 num += 4;
32 word >>= 4;
33 }
34 if ((word & 0x3) == 0) {
35 num += 2;
36 word >>= 2;
37 }
38 if ((word & 0x1) == 0)
39 num += 1;
40 return num;
41}
42
43#endif /* _ASM_GENERIC_BITOPS___FFS_H_ */
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
new file mode 100644
index 000000000000..78339319ba02
--- /dev/null
+++ b/include/asm-generic/bitops/atomic.h
@@ -0,0 +1,191 @@
1#ifndef _ASM_GENERIC_BITOPS_ATOMIC_H_
2#define _ASM_GENERIC_BITOPS_ATOMIC_H_
3
4#include <asm/types.h>
5
6#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
7#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
8
9#ifdef CONFIG_SMP
10#include <asm/spinlock.h>
11#include <asm/cache.h> /* we use L1_CACHE_BYTES */
12
13/* Use an array of spinlocks for our atomic_ts.
14 * Hash function to index into a different SPINLOCK.
15 * Since "a" is usually an address, use one spinlock per cacheline.
16 */
17# define ATOMIC_HASH_SIZE 4
18# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ]))
19
20extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned;
21
22/* Can't use raw_spin_lock_irq because of #include problems, so
23 * this is the substitute */
24#define _atomic_spin_lock_irqsave(l,f) do { \
25 raw_spinlock_t *s = ATOMIC_HASH(l); \
26 local_irq_save(f); \
27 __raw_spin_lock(s); \
28} while(0)
29
30#define _atomic_spin_unlock_irqrestore(l,f) do { \
31 raw_spinlock_t *s = ATOMIC_HASH(l); \
32 __raw_spin_unlock(s); \
33 local_irq_restore(f); \
34} while(0)
35
36
37#else
38# define _atomic_spin_lock_irqsave(l,f) do { local_irq_save(f); } while (0)
39# define _atomic_spin_unlock_irqrestore(l,f) do { local_irq_restore(f); } while (0)
40#endif
41
42/*
43 * NMI events can occur at any time, including when interrupts have been
44 * disabled by *_irqsave(). So you can get NMI events occurring while a
45 * *_bit function is holding a spin lock. If the NMI handler also wants
46 * to do bit manipulation (and they do) then you can get a deadlock
47 * between the original caller of *_bit() and the NMI handler.
48 *
49 * by Keith Owens
50 */
51
52/**
53 * set_bit - Atomically set a bit in memory
54 * @nr: the bit to set
55 * @addr: the address to start counting from
56 *
57 * This function is atomic and may not be reordered. See __set_bit()
58 * if you do not require the atomic guarantees.
59 *
60 * Note: there are no guarantees that this function will not be reordered
61 * on non x86 architectures, so if you are writting portable code,
62 * make sure not to rely on its reordering guarantees.
63 *
64 * Note that @nr may be almost arbitrarily large; this function is not
65 * restricted to acting on a single-word quantity.
66 */
67static inline void set_bit(int nr, volatile unsigned long *addr)
68{
69 unsigned long mask = BITOP_MASK(nr);
70 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
71 unsigned long flags;
72
73 _atomic_spin_lock_irqsave(p, flags);
74 *p |= mask;
75 _atomic_spin_unlock_irqrestore(p, flags);
76}
77
78/**
79 * clear_bit - Clears a bit in memory
80 * @nr: Bit to clear
81 * @addr: Address to start counting from
82 *
83 * clear_bit() is atomic and may not be reordered. However, it does
84 * not contain a memory barrier, so if it is used for locking purposes,
85 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
86 * in order to ensure changes are visible on other processors.
87 */
88static inline void clear_bit(int nr, volatile unsigned long *addr)
89{
90 unsigned long mask = BITOP_MASK(nr);
91 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
92 unsigned long flags;
93
94 _atomic_spin_lock_irqsave(p, flags);
95 *p &= ~mask;
96 _atomic_spin_unlock_irqrestore(p, flags);
97}
98
99/**
100 * change_bit - Toggle a bit in memory
101 * @nr: Bit to change
102 * @addr: Address to start counting from
103 *
104 * change_bit() is atomic and may not be reordered. It may be
105 * reordered on other architectures than x86.
106 * Note that @nr may be almost arbitrarily large; this function is not
107 * restricted to acting on a single-word quantity.
108 */
109static inline void change_bit(int nr, volatile unsigned long *addr)
110{
111 unsigned long mask = BITOP_MASK(nr);
112 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
113 unsigned long flags;
114
115 _atomic_spin_lock_irqsave(p, flags);
116 *p ^= mask;
117 _atomic_spin_unlock_irqrestore(p, flags);
118}
119
120/**
121 * test_and_set_bit - Set a bit and return its old value
122 * @nr: Bit to set
123 * @addr: Address to count from
124 *
125 * This operation is atomic and cannot be reordered.
126 * It may be reordered on other architectures than x86.
127 * It also implies a memory barrier.
128 */
129static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
130{
131 unsigned long mask = BITOP_MASK(nr);
132 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
133 unsigned long old;
134 unsigned long flags;
135
136 _atomic_spin_lock_irqsave(p, flags);
137 old = *p;
138 *p = old | mask;
139 _atomic_spin_unlock_irqrestore(p, flags);
140
141 return (old & mask) != 0;
142}
143
144/**
145 * test_and_clear_bit - Clear a bit and return its old value
146 * @nr: Bit to clear
147 * @addr: Address to count from
148 *
149 * This operation is atomic and cannot be reordered.
150 * It can be reorderdered on other architectures other than x86.
151 * It also implies a memory barrier.
152 */
153static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
154{
155 unsigned long mask = BITOP_MASK(nr);
156 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
157 unsigned long old;
158 unsigned long flags;
159
160 _atomic_spin_lock_irqsave(p, flags);
161 old = *p;
162 *p = old & ~mask;
163 _atomic_spin_unlock_irqrestore(p, flags);
164
165 return (old & mask) != 0;
166}
167
168/**
169 * test_and_change_bit - Change a bit and return its old value
170 * @nr: Bit to change
171 * @addr: Address to count from
172 *
173 * This operation is atomic and cannot be reordered.
174 * It also implies a memory barrier.
175 */
176static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
177{
178 unsigned long mask = BITOP_MASK(nr);
179 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
180 unsigned long old;
181 unsigned long flags;
182
183 _atomic_spin_lock_irqsave(p, flags);
184 old = *p;
185 *p = old ^ mask;
186 _atomic_spin_unlock_irqrestore(p, flags);
187
188 return (old & mask) != 0;
189}
190
191#endif /* _ASM_GENERIC_BITOPS_ATOMIC_H */
diff --git a/include/asm-generic/bitops/ext2-atomic.h b/include/asm-generic/bitops/ext2-atomic.h
new file mode 100644
index 000000000000..ab1c875efb74
--- /dev/null
+++ b/include/asm-generic/bitops/ext2-atomic.h
@@ -0,0 +1,22 @@
1#ifndef _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
2#define _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_
3
4#define ext2_set_bit_atomic(lock, nr, addr) \
5 ({ \
6 int ret; \
7 spin_lock(lock); \
8 ret = ext2_set_bit((nr), (unsigned long *)(addr)); \
9 spin_unlock(lock); \
10 ret; \
11 })
12
13#define ext2_clear_bit_atomic(lock, nr, addr) \
14 ({ \
15 int ret; \
16 spin_lock(lock); \
17 ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \
18 spin_unlock(lock); \
19 ret; \
20 })
21
22#endif /* _ASM_GENERIC_BITOPS_EXT2_ATOMIC_H_ */
diff --git a/include/asm-generic/bitops/ext2-non-atomic.h b/include/asm-generic/bitops/ext2-non-atomic.h
new file mode 100644
index 000000000000..1697404afa05
--- /dev/null
+++ b/include/asm-generic/bitops/ext2-non-atomic.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
2#define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
3
4#include <asm-generic/bitops/le.h>
5
6#define ext2_set_bit(nr,addr) \
7 generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
8#define ext2_clear_bit(nr,addr) \
9 generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
10
11#define ext2_test_bit(nr,addr) \
12 generic_test_le_bit((nr),(unsigned long *)(addr))
13#define ext2_find_first_zero_bit(addr, size) \
14 generic_find_first_zero_le_bit((unsigned long *)(addr), (size))
15#define ext2_find_next_zero_bit(addr, size, off) \
16 generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
17
18#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
diff --git a/include/asm-generic/bitops/ffs.h b/include/asm-generic/bitops/ffs.h
new file mode 100644
index 000000000000..fbbb43af7dc0
--- /dev/null
+++ b/include/asm-generic/bitops/ffs.h
@@ -0,0 +1,41 @@
1#ifndef _ASM_GENERIC_BITOPS_FFS_H_
2#define _ASM_GENERIC_BITOPS_FFS_H_
3
4/**
5 * ffs - find first bit set
6 * @x: the word to search
7 *
8 * This is defined the same way as
9 * the libc and compiler builtin ffs routines, therefore
10 * differs in spirit from the above ffz (man ffs).
11 */
12static inline int ffs(int x)
13{
14 int r = 1;
15
16 if (!x)
17 return 0;
18 if (!(x & 0xffff)) {
19 x >>= 16;
20 r += 16;
21 }
22 if (!(x & 0xff)) {
23 x >>= 8;
24 r += 8;
25 }
26 if (!(x & 0xf)) {
27 x >>= 4;
28 r += 4;
29 }
30 if (!(x & 3)) {
31 x >>= 2;
32 r += 2;
33 }
34 if (!(x & 1)) {
35 x >>= 1;
36 r += 1;
37 }
38 return r;
39}
40
41#endif /* _ASM_GENERIC_BITOPS_FFS_H_ */
diff --git a/include/asm-generic/bitops/ffz.h b/include/asm-generic/bitops/ffz.h
new file mode 100644
index 000000000000..6744bd4cdf46
--- /dev/null
+++ b/include/asm-generic/bitops/ffz.h
@@ -0,0 +1,12 @@
1#ifndef _ASM_GENERIC_BITOPS_FFZ_H_
2#define _ASM_GENERIC_BITOPS_FFZ_H_
3
4/*
5 * ffz - find first zero in word.
6 * @word: The word to search
7 *
8 * Undefined if no zero exists, so code should check against ~0UL first.
9 */
10#define ffz(x) __ffs(~(x))
11
12#endif /* _ASM_GENERIC_BITOPS_FFZ_H_ */
diff --git a/include/asm-generic/bitops/find.h b/include/asm-generic/bitops/find.h
new file mode 100644
index 000000000000..72a51e5a12ef
--- /dev/null
+++ b/include/asm-generic/bitops/find.h
@@ -0,0 +1,13 @@
1#ifndef _ASM_GENERIC_BITOPS_FIND_H_
2#define _ASM_GENERIC_BITOPS_FIND_H_
3
4extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
5 size, unsigned long offset);
6
7extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
8 long size, unsigned long offset);
9
10#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
11#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
12
13#endif /*_ASM_GENERIC_BITOPS_FIND_H_ */
diff --git a/include/asm-generic/bitops/fls.h b/include/asm-generic/bitops/fls.h
new file mode 100644
index 000000000000..850859bc5069
--- /dev/null
+++ b/include/asm-generic/bitops/fls.h
@@ -0,0 +1,41 @@
1#ifndef _ASM_GENERIC_BITOPS_FLS_H_
2#define _ASM_GENERIC_BITOPS_FLS_H_
3
4/**
5 * fls - find last (most-significant) bit set
6 * @x: the word to search
7 *
8 * This is defined the same way as ffs.
9 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
10 */
11
12static inline int fls(int x)
13{
14 int r = 32;
15
16 if (!x)
17 return 0;
18 if (!(x & 0xffff0000u)) {
19 x <<= 16;
20 r -= 16;
21 }
22 if (!(x & 0xff000000u)) {
23 x <<= 8;
24 r -= 8;
25 }
26 if (!(x & 0xf0000000u)) {
27 x <<= 4;
28 r -= 4;
29 }
30 if (!(x & 0xc0000000u)) {
31 x <<= 2;
32 r -= 2;
33 }
34 if (!(x & 0x80000000u)) {
35 x <<= 1;
36 r -= 1;
37 }
38 return r;
39}
40
41#endif /* _ASM_GENERIC_BITOPS_FLS_H_ */
diff --git a/include/asm-generic/bitops/fls64.h b/include/asm-generic/bitops/fls64.h
new file mode 100644
index 000000000000..1b6b17ce2428
--- /dev/null
+++ b/include/asm-generic/bitops/fls64.h
@@ -0,0 +1,14 @@
1#ifndef _ASM_GENERIC_BITOPS_FLS64_H_
2#define _ASM_GENERIC_BITOPS_FLS64_H_
3
4#include <asm/types.h>
5
6static inline int fls64(__u64 x)
7{
8 __u32 h = x >> 32;
9 if (h)
10 return fls(h) + 32;
11 return fls(x);
12}
13
14#endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */
diff --git a/include/asm-generic/bitops/hweight.h b/include/asm-generic/bitops/hweight.h
new file mode 100644
index 000000000000..fbbc383771da
--- /dev/null
+++ b/include/asm-generic/bitops/hweight.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_
2#define _ASM_GENERIC_BITOPS_HWEIGHT_H_
3
4#include <asm/types.h>
5
6extern unsigned int hweight32(unsigned int w);
7extern unsigned int hweight16(unsigned int w);
8extern unsigned int hweight8(unsigned int w);
9extern unsigned long hweight64(__u64 w);
10
11#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
new file mode 100644
index 000000000000..b9c7e5d2d2ad
--- /dev/null
+++ b/include/asm-generic/bitops/le.h
@@ -0,0 +1,53 @@
1#ifndef _ASM_GENERIC_BITOPS_LE_H_
2#define _ASM_GENERIC_BITOPS_LE_H_
3
4#include <asm/types.h>
5#include <asm/byteorder.h>
6
7#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
8#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
9
10#if defined(__LITTLE_ENDIAN)
11
12#define generic_test_le_bit(nr, addr) test_bit(nr, addr)
13#define generic___set_le_bit(nr, addr) __set_bit(nr, addr)
14#define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr)
15
16#define generic_test_and_set_le_bit(nr, addr) test_and_set_bit(nr, addr)
17#define generic_test_and_clear_le_bit(nr, addr) test_and_clear_bit(nr, addr)
18
19#define generic___test_and_set_le_bit(nr, addr) __test_and_set_bit(nr, addr)
20#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr)
21
22#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset)
23
24#elif defined(__BIG_ENDIAN)
25
26#define generic_test_le_bit(nr, addr) \
27 test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
28#define generic___set_le_bit(nr, addr) \
29 __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
30#define generic___clear_le_bit(nr, addr) \
31 __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
32
33#define generic_test_and_set_le_bit(nr, addr) \
34 test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
35#define generic_test_and_clear_le_bit(nr, addr) \
36 test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
37
38#define generic___test_and_set_le_bit(nr, addr) \
39 __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
40#define generic___test_and_clear_le_bit(nr, addr) \
41 __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
42
43extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
44 unsigned long size, unsigned long offset);
45
46#else
47#error "Please fix <asm/byteorder.h>"
48#endif
49
50#define generic_find_first_zero_le_bit(addr, size) \
51 generic_find_next_zero_le_bit((addr), (size), 0)
52
53#endif /* _ASM_GENERIC_BITOPS_LE_H_ */
diff --git a/include/asm-generic/bitops/minix-le.h b/include/asm-generic/bitops/minix-le.h
new file mode 100644
index 000000000000..4a981c1bb1ae
--- /dev/null
+++ b/include/asm-generic/bitops/minix-le.h
@@ -0,0 +1,17 @@
1#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
2#define _ASM_GENERIC_BITOPS_MINIX_LE_H_
3
4#include <asm-generic/bitops/le.h>
5
6#define minix_test_and_set_bit(nr,addr) \
7 generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
8#define minix_set_bit(nr,addr) \
9 generic___set_le_bit((nr),(unsigned long *)(addr))
10#define minix_test_and_clear_bit(nr,addr) \
11 generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
12#define minix_test_bit(nr,addr) \
13 generic_test_le_bit((nr),(unsigned long *)(addr))
14#define minix_find_first_zero_bit(addr,size) \
15 generic_find_first_zero_le_bit((unsigned long *)(addr),(size))
16
17#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
diff --git a/include/asm-generic/bitops/minix.h b/include/asm-generic/bitops/minix.h
new file mode 100644
index 000000000000..91f42e87aa51
--- /dev/null
+++ b/include/asm-generic/bitops/minix.h
@@ -0,0 +1,15 @@
1#ifndef _ASM_GENERIC_BITOPS_MINIX_H_
2#define _ASM_GENERIC_BITOPS_MINIX_H_
3
4#define minix_test_and_set_bit(nr,addr) \
5 __test_and_set_bit((nr),(unsigned long *)(addr))
6#define minix_set_bit(nr,addr) \
7 __set_bit((nr),(unsigned long *)(addr))
8#define minix_test_and_clear_bit(nr,addr) \
9 __test_and_clear_bit((nr),(unsigned long *)(addr))
10#define minix_test_bit(nr,addr) \
11 test_bit((nr),(unsigned long *)(addr))
12#define minix_find_first_zero_bit(addr,size) \
13 find_first_zero_bit((unsigned long *)(addr),(size))
14
15#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */
diff --git a/include/asm-generic/bitops/non-atomic.h b/include/asm-generic/bitops/non-atomic.h
new file mode 100644
index 000000000000..46a825cf2ae1
--- /dev/null
+++ b/include/asm-generic/bitops/non-atomic.h
@@ -0,0 +1,111 @@
1#ifndef _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
2#define _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
3
4#include <asm/types.h>
5
6#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
7#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
8
9/**
10 * __set_bit - Set a bit in memory
11 * @nr: the bit to set
12 * @addr: the address to start counting from
13 *
14 * Unlike set_bit(), this function is non-atomic and may be reordered.
15 * If it's called on the same region of memory simultaneously, the effect
16 * may be that only one operation succeeds.
17 */
18static inline void __set_bit(int nr, volatile unsigned long *addr)
19{
20 unsigned long mask = BITOP_MASK(nr);
21 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
22
23 *p |= mask;
24}
25
26static inline void __clear_bit(int nr, volatile unsigned long *addr)
27{
28 unsigned long mask = BITOP_MASK(nr);
29 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
30
31 *p &= ~mask;
32}
33
34/**
35 * __change_bit - Toggle a bit in memory
36 * @nr: the bit to change
37 * @addr: the address to start counting from
38 *
39 * Unlike change_bit(), this function is non-atomic and may be reordered.
40 * If it's called on the same region of memory simultaneously, the effect
41 * may be that only one operation succeeds.
42 */
43static inline void __change_bit(int nr, volatile unsigned long *addr)
44{
45 unsigned long mask = BITOP_MASK(nr);
46 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
47
48 *p ^= mask;
49}
50
51/**
52 * __test_and_set_bit - Set a bit and return its old value
53 * @nr: Bit to set
54 * @addr: Address to count from
55 *
56 * This operation is non-atomic and can be reordered.
57 * If two examples of this operation race, one can appear to succeed
58 * but actually fail. You must protect multiple accesses with a lock.
59 */
60static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
61{
62 unsigned long mask = BITOP_MASK(nr);
63 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
64 unsigned long old = *p;
65
66 *p = old | mask;
67 return (old & mask) != 0;
68}
69
70/**
71 * __test_and_clear_bit - Clear a bit and return its old value
72 * @nr: Bit to clear
73 * @addr: Address to count from
74 *
75 * This operation is non-atomic and can be reordered.
76 * If two examples of this operation race, one can appear to succeed
77 * but actually fail. You must protect multiple accesses with a lock.
78 */
79static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
80{
81 unsigned long mask = BITOP_MASK(nr);
82 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
83 unsigned long old = *p;
84
85 *p = old & ~mask;
86 return (old & mask) != 0;
87}
88
89/* WARNING: non atomic and it can be reordered! */
90static inline int __test_and_change_bit(int nr,
91 volatile unsigned long *addr)
92{
93 unsigned long mask = BITOP_MASK(nr);
94 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
95 unsigned long old = *p;
96
97 *p = old ^ mask;
98 return (old & mask) != 0;
99}
100
101/**
102 * test_bit - Determine whether a bit is set
103 * @nr: bit number to test
104 * @addr: Address to start counting from
105 */
106static inline int test_bit(int nr, const volatile unsigned long *addr)
107{
108 return 1UL & (addr[BITOP_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
109}
110
111#endif /* _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ */
diff --git a/include/asm-generic/bitops/sched.h b/include/asm-generic/bitops/sched.h
new file mode 100644
index 000000000000..5ef93a4d009f
--- /dev/null
+++ b/include/asm-generic/bitops/sched.h
@@ -0,0 +1,36 @@
1#ifndef _ASM_GENERIC_BITOPS_SCHED_H_
2#define _ASM_GENERIC_BITOPS_SCHED_H_
3
4#include <linux/compiler.h> /* unlikely() */
5#include <asm/types.h>
6
7/*
8 * Every architecture must define this function. It's the fastest
9 * way of searching a 140-bit bitmap where the first 100 bits are
10 * unlikely to be set. It's guaranteed that at least one of the 140
11 * bits is cleared.
12 */
13static inline int sched_find_first_bit(const unsigned long *b)
14{
15#if BITS_PER_LONG == 64
16 if (unlikely(b[0]))
17 return __ffs(b[0]);
18 if (unlikely(b[1]))
19 return __ffs(b[1]) + 64;
20 return __ffs(b[2]) + 128;
21#elif BITS_PER_LONG == 32
22 if (unlikely(b[0]))
23 return __ffs(b[0]);
24 if (unlikely(b[1]))
25 return __ffs(b[1]) + 32;
26 if (unlikely(b[2]))
27 return __ffs(b[2]) + 64;
28 if (b[3])
29 return __ffs(b[3]) + 96;
30 return __ffs(b[4]) + 128;
31#else
32#error BITS_PER_LONG not defined
33#endif
34}
35
36#endif /* _ASM_GENERIC_BITOPS_SCHED_H_ */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 400c2b41896e..1a565a9d2fa7 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -7,7 +7,7 @@
7#ifdef CONFIG_BUG 7#ifdef CONFIG_BUG
8#ifndef HAVE_ARCH_BUG 8#ifndef HAVE_ARCH_BUG
9#define BUG() do { \ 9#define BUG() do { \
10 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 10 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
11 panic("BUG!"); \ 11 panic("BUG!"); \
12} while (0) 12} while (0)
13#endif 13#endif
@@ -19,7 +19,7 @@
19#ifndef HAVE_ARCH_WARN_ON 19#ifndef HAVE_ARCH_WARN_ON
20#define WARN_ON(condition) do { \ 20#define WARN_ON(condition) do { \
21 if (unlikely((condition)!=0)) { \ 21 if (unlikely((condition)!=0)) { \
22 printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \ 22 printk("BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \
23 dump_stack(); \ 23 dump_stack(); \
24 } \ 24 } \
25} while (0) 25} while (0)
diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h
index 3ae2c7347549..df893c160318 100644
--- a/include/asm-generic/futex.h
+++ b/include/asm-generic/futex.h
@@ -49,5 +49,11 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
49 return ret; 49 return ret;
50} 50}
51 51
52static inline int
53futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
54{
55 return -ENOSYS;
56}
57
52#endif 58#endif
53#endif 59#endif
diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
index 16fc00360f75..9291c24f5819 100644
--- a/include/asm-generic/local.h
+++ b/include/asm-generic/local.h
@@ -4,28 +4,35 @@
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/percpu.h> 5#include <linux/percpu.h>
6#include <linux/hardirq.h> 6#include <linux/hardirq.h>
7#include <asm/atomic.h>
7#include <asm/types.h> 8#include <asm/types.h>
8 9
9/* An unsigned long type for operations which are atomic for a single 10/*
10 * CPU. Usually used in combination with per-cpu variables. */ 11 * A signed long type for operations which are atomic for a single CPU.
12 * Usually used in combination with per-cpu variables.
13 *
14 * This is the default implementation, which uses atomic_long_t. Which is
15 * rather pointless. The whole point behind local_t is that some processors
16 * can perform atomic adds and subtracts in a manner which is atomic wrt IRQs
17 * running on this CPU. local_t allows exploitation of such capabilities.
18 */
11 19
12#if BITS_PER_LONG == 32
13/* Implement in terms of atomics. */ 20/* Implement in terms of atomics. */
14 21
15/* Don't use typedef: don't want them to be mixed with atomic_t's. */ 22/* Don't use typedef: don't want them to be mixed with atomic_t's. */
16typedef struct 23typedef struct
17{ 24{
18 atomic_t a; 25 atomic_long_t a;
19} local_t; 26} local_t;
20 27
21#define LOCAL_INIT(i) { ATOMIC_INIT(i) } 28#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
22 29
23#define local_read(l) ((unsigned long)atomic_read(&(l)->a)) 30#define local_read(l) atomic_long_read(&(l)->a)
24#define local_set(l,i) atomic_set((&(l)->a),(i)) 31#define local_set(l,i) atomic_long_set((&(l)->a),(i))
25#define local_inc(l) atomic_inc(&(l)->a) 32#define local_inc(l) atomic_long_inc(&(l)->a)
26#define local_dec(l) atomic_dec(&(l)->a) 33#define local_dec(l) atomic_long_dec(&(l)->a)
27#define local_add(i,l) atomic_add((i),(&(l)->a)) 34#define local_add(i,l) atomic_long_add((i),(&(l)->a))
28#define local_sub(i,l) atomic_sub((i),(&(l)->a)) 35#define local_sub(i,l) atomic_long_sub((i),(&(l)->a))
29 36
30/* Non-atomic variants, ie. preemption disabled and won't be touched 37/* Non-atomic variants, ie. preemption disabled and won't be touched
31 * in interrupt, etc. Some archs can optimize this case well. */ 38 * in interrupt, etc. Some archs can optimize this case well. */
@@ -34,68 +41,6 @@ typedef struct
34#define __local_add(i,l) local_set((l), local_read(l) + (i)) 41#define __local_add(i,l) local_set((l), local_read(l) + (i))
35#define __local_sub(i,l) local_set((l), local_read(l) - (i)) 42#define __local_sub(i,l) local_set((l), local_read(l) - (i))
36 43
37#else /* ... can't use atomics. */
38/* Implement in terms of three variables.
39 Another option would be to use local_irq_save/restore. */
40
41typedef struct
42{
43 /* 0 = in hardirq, 1 = in softirq, 2 = usermode. */
44 unsigned long v[3];
45} local_t;
46
47#define _LOCAL_VAR(l) ((l)->v[!in_interrupt() + !in_irq()])
48
49#define LOCAL_INIT(i) { { (i), 0, 0 } }
50
51static inline unsigned long local_read(local_t *l)
52{
53 return l->v[0] + l->v[1] + l->v[2];
54}
55
56static inline void local_set(local_t *l, unsigned long v)
57{
58 l->v[0] = v;
59 l->v[1] = l->v[2] = 0;
60}
61
62static inline void local_inc(local_t *l)
63{
64 preempt_disable();
65 _LOCAL_VAR(l)++;
66 preempt_enable();
67}
68
69static inline void local_dec(local_t *l)
70{
71 preempt_disable();
72 _LOCAL_VAR(l)--;
73 preempt_enable();
74}
75
76static inline void local_add(unsigned long v, local_t *l)
77{
78 preempt_disable();
79 _LOCAL_VAR(l) += v;
80 preempt_enable();
81}
82
83static inline void local_sub(unsigned long v, local_t *l)
84{
85 preempt_disable();
86 _LOCAL_VAR(l) -= v;
87 preempt_enable();
88}
89
90/* Non-atomic variants, ie. preemption disabled and won't be touched
91 * in interrupt, etc. Some archs can optimize this case well. */
92#define __local_inc(l) ((l)->v[0]++)
93#define __local_dec(l) ((l)->v[0]--)
94#define __local_add(i,l) ((l)->v[0] += (i))
95#define __local_sub(i,l) ((l)->v[0] -= (i))
96
97#endif /* Non-atomic implementation */
98
99/* Use these for per-cpu local_t variables: on some archs they are 44/* Use these for per-cpu local_t variables: on some archs they are
100 * much more efficient than these naive implementations. Note they take 45 * much more efficient than these naive implementations. Note they take
101 * a variable (eg. mystruct.foo), not an address. 46 * a variable (eg. mystruct.foo), not an address.
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
new file mode 100644
index 000000000000..0cfb086dd373
--- /dev/null
+++ b/include/asm-generic/memory_model.h
@@ -0,0 +1,77 @@
1#ifndef __ASM_MEMORY_MODEL_H
2#define __ASM_MEMORY_MODEL_H
3
4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__
6
7#if defined(CONFIG_FLATMEM)
8
9#ifndef ARCH_PFN_OFFSET
10#define ARCH_PFN_OFFSET (0UL)
11#endif
12
13#elif defined(CONFIG_DISCONTIGMEM)
14
15#ifndef arch_pfn_to_nid
16#define arch_pfn_to_nid(pfn) pfn_to_nid(pfn)
17#endif
18
19#ifndef arch_local_page_offset
20#define arch_local_page_offset(pfn, nid) \
21 ((pfn) - NODE_DATA(nid)->node_start_pfn)
22#endif
23
24#endif /* CONFIG_DISCONTIGMEM */
25
26#ifdef CONFIG_OUT_OF_LINE_PFN_TO_PAGE
27struct page;
28/* this is useful when inlined pfn_to_page is too big */
29extern struct page *pfn_to_page(unsigned long pfn);
30extern unsigned long page_to_pfn(struct page *page);
31#else
32/*
33 * supports 3 memory models.
34 */
35#if defined(CONFIG_FLATMEM)
36
37#define pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
38#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + \
39 ARCH_PFN_OFFSET)
40#elif defined(CONFIG_DISCONTIGMEM)
41
42#define pfn_to_page(pfn) \
43({ unsigned long __pfn = (pfn); \
44 unsigned long __nid = arch_pfn_to_nid(pfn); \
45 NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
46})
47
48#define page_to_pfn(pg) \
49({ struct page *__pg = (pg); \
50 struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \
51 (unsigned long)(__pg - __pgdat->node_mem_map) + \
52 __pgdat->node_start_pfn; \
53})
54
55#elif defined(CONFIG_SPARSEMEM)
56/*
57 * Note: section's mem_map is encorded to reflect its start_pfn.
58 * section[i].section_mem_map == mem_map's address - start_pfn;
59 */
60#define page_to_pfn(pg) \
61({ struct page *__pg = (pg); \
62 int __sec = page_to_section(__pg); \
63 __pg - __section_mem_map_addr(__nr_to_section(__sec)); \
64})
65
66#define pfn_to_page(pfn) \
67({ unsigned long __pfn = (pfn); \
68 struct mem_section *__sec = __pfn_to_section(__pfn); \
69 __section_mem_map_addr(__sec) + __pfn; \
70})
71#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
72#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */
73
74#endif /* __ASSEMBLY__ */
75#endif /* __KERNEL__ */
76
77#endif
diff --git a/include/asm-generic/mutex-dec.h b/include/asm-generic/mutex-dec.h
index 40c6d1f86598..29c6ac34e236 100644
--- a/include/asm-generic/mutex-dec.h
+++ b/include/asm-generic/mutex-dec.h
@@ -17,13 +17,14 @@
17 * it wasn't 1 originally. This function MUST leave the value lower than 17 * it wasn't 1 originally. This function MUST leave the value lower than
18 * 1 even when the "1" assertion wasn't true. 18 * 1 even when the "1" assertion wasn't true.
19 */ 19 */
20#define __mutex_fastpath_lock(count, fail_fn) \ 20static inline void
21do { \ 21__mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
22 if (unlikely(atomic_dec_return(count) < 0)) \ 22{
23 fail_fn(count); \ 23 if (unlikely(atomic_dec_return(count) < 0))
24 else \ 24 fail_fn(count);
25 smp_mb(); \ 25 else
26} while (0) 26 smp_mb();
27}
27 28
28/** 29/**
29 * __mutex_fastpath_lock_retval - try to take the lock by moving the count 30 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
@@ -36,7 +37,7 @@ do { \
36 * or anything the slow path function returns. 37 * or anything the slow path function returns.
37 */ 38 */
38static inline int 39static inline int
39__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) 40__mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *))
40{ 41{
41 if (unlikely(atomic_dec_return(count) < 0)) 42 if (unlikely(atomic_dec_return(count) < 0))
42 return fail_fn(count); 43 return fail_fn(count);
@@ -59,12 +60,13 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
59 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs 60 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
60 * to return 0 otherwise. 61 * to return 0 otherwise.
61 */ 62 */
62#define __mutex_fastpath_unlock(count, fail_fn) \ 63static inline void
63do { \ 64__mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
64 smp_mb(); \ 65{
65 if (unlikely(atomic_inc_return(count) <= 0)) \ 66 smp_mb();
66 fail_fn(count); \ 67 if (unlikely(atomic_inc_return(count) <= 0))
67} while (0) 68 fail_fn(count);
69}
68 70
69#define __mutex_slowpath_needs_to_unlock() 1 71#define __mutex_slowpath_needs_to_unlock() 1
70 72
diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
index 1d24f47e6c48..32a2100c1aeb 100644
--- a/include/asm-generic/mutex-xchg.h
+++ b/include/asm-generic/mutex-xchg.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Generic implementation of the mutex fastpath, based on xchg(). 4 * Generic implementation of the mutex fastpath, based on xchg().
5 * 5 *
6 * NOTE: An xchg based implementation is less optimal than an atomic 6 * NOTE: An xchg based implementation might be less optimal than an atomic
7 * decrement/increment based implementation. If your architecture 7 * decrement/increment based implementation. If your architecture
8 * has a reasonable atomic dec/inc then you should probably use 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 9 * asm-generic/mutex-dec.h instead, or you could open-code an
@@ -22,14 +22,14 @@
22 * wasn't 1 originally. This function MUST leave the value lower than 1 22 * wasn't 1 originally. This function MUST leave the value lower than 1
23 * even when the "1" assertion wasn't true. 23 * even when the "1" assertion wasn't true.
24 */ 24 */
25#define __mutex_fastpath_lock(count, fail_fn) \ 25static inline void
26do { \ 26__mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
27 if (unlikely(atomic_xchg(count, 0) != 1)) \ 27{
28 fail_fn(count); \ 28 if (unlikely(atomic_xchg(count, 0) != 1))
29 else \ 29 fail_fn(count);
30 smp_mb(); \ 30 else
31} while (0) 31 smp_mb();
32 32}
33 33
34/** 34/**
35 * __mutex_fastpath_lock_retval - try to take the lock by moving the count 35 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
@@ -42,7 +42,7 @@ do { \
42 * or anything the slow path function returns 42 * or anything the slow path function returns
43 */ 43 */
44static inline int 44static inline int
45__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) 45__mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *))
46{ 46{
47 if (unlikely(atomic_xchg(count, 0) != 1)) 47 if (unlikely(atomic_xchg(count, 0) != 1))
48 return fail_fn(count); 48 return fail_fn(count);
@@ -64,12 +64,13 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
64 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs 64 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
65 * to return 0 otherwise. 65 * to return 0 otherwise.
66 */ 66 */
67#define __mutex_fastpath_unlock(count, fail_fn) \ 67static inline void
68do { \ 68__mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
69 smp_mb(); \ 69{
70 if (unlikely(atomic_xchg(count, 1) != 0)) \ 70 smp_mb();
71 fail_fn(count); \ 71 if (unlikely(atomic_xchg(count, 1) != 0))
72} while (0) 72 fail_fn(count);
73}
73 74
74#define __mutex_slowpath_needs_to_unlock() 0 75#define __mutex_slowpath_needs_to_unlock() 0
75 76
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 9044aeb37828..c0caf433a7d7 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -19,10 +19,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
19#define percpu_modcopy(pcpudst, src, size) \ 19#define percpu_modcopy(pcpudst, src, size) \
20do { \ 20do { \
21 unsigned int __i; \ 21 unsigned int __i; \
22 for (__i = 0; __i < NR_CPUS; __i++) \ 22 for_each_possible_cpu(__i) \
23 if (cpu_possible(__i)) \ 23 memcpy((pcpudst)+__per_cpu_offset[__i], \
24 memcpy((pcpudst)+__per_cpu_offset[__i], \ 24 (src), (size)); \
25 (src), (size)); \
26} while (0) 25} while (0)
27#else /* ! SMP */ 26#else /* ! SMP */
28 27
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 35de20cf8fac..9d11550b4818 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -58,6 +58,13 @@
58 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ 58 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
59 } \ 59 } \
60 \ 60 \
61 /* Kernel symbol table: GPL-future-only symbols */ \
62 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
63 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
64 *(__ksymtab_gpl_future) \
65 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
66 } \
67 \
61 /* Kernel symbol table: Normal symbols */ \ 68 /* Kernel symbol table: Normal symbols */ \
62 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ 69 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
63 VMLINUX_SYMBOL(__start___kcrctab) = .; \ 70 VMLINUX_SYMBOL(__start___kcrctab) = .; \
@@ -72,6 +79,13 @@
72 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ 79 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
73 } \ 80 } \
74 \ 81 \
82 /* Kernel symbol table: GPL-future-only symbols */ \
83 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
84 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
85 *(__kcrctab_gpl_future) \
86 VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
87 } \
88 \
75 /* Kernel symbol table: strings */ \ 89 /* Kernel symbol table: strings */ \
76 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ 90 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
77 *(__ksymtab_strings) \ 91 *(__ksymtab_strings) \
diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h
index ff7c2b721594..574f57b6c4d1 100644
--- a/include/asm-h8300/bitops.h
+++ b/include/asm-h8300/bitops.h
@@ -8,7 +8,6 @@
8 8
9#include <linux/config.h> 9#include <linux/config.h>
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <asm/byteorder.h> /* swab32 */
12#include <asm/system.h> 11#include <asm/system.h>
13 12
14#ifdef __KERNEL__ 13#ifdef __KERNEL__
@@ -177,10 +176,7 @@ H8300_GEN_TEST_BITOP(test_and_change_bit,"bnot")
177#undef H8300_GEN_TEST_BITOP_CONST_INT 176#undef H8300_GEN_TEST_BITOP_CONST_INT
178#undef H8300_GEN_TEST_BITOP 177#undef H8300_GEN_TEST_BITOP
179 178
180#define find_first_zero_bit(addr, size) \ 179#include <asm-generic/bitops/ffs.h>
181 find_next_zero_bit((addr), (size), 0)
182
183#define ffs(x) generic_ffs(x)
184 180
185static __inline__ unsigned long __ffs(unsigned long word) 181static __inline__ unsigned long __ffs(unsigned long word)
186{ 182{
@@ -196,216 +192,16 @@ static __inline__ unsigned long __ffs(unsigned long word)
196 return result; 192 return result;
197} 193}
198 194
199static __inline__ int find_next_zero_bit (const unsigned long * addr, int size, int offset) 195#include <asm-generic/bitops/find.h>
200{ 196#include <asm-generic/bitops/sched.h>
201 unsigned long *p = (unsigned long *)(((unsigned long)addr + (offset >> 3)) & ~3); 197#include <asm-generic/bitops/hweight.h>
202 unsigned long result = offset & ~31UL; 198#include <asm-generic/bitops/ext2-non-atomic.h>
203 unsigned long tmp; 199#include <asm-generic/bitops/ext2-atomic.h>
204 200#include <asm-generic/bitops/minix.h>
205 if (offset >= size)
206 return size;
207 size -= result;
208 offset &= 31UL;
209 if (offset) {
210 tmp = *(p++);
211 tmp |= ~0UL >> (32-offset);
212 if (size < 32)
213 goto found_first;
214 if (~tmp)
215 goto found_middle;
216 size -= 32;
217 result += 32;
218 }
219 while (size & ~31UL) {
220 if (~(tmp = *(p++)))
221 goto found_middle;
222 result += 32;
223 size -= 32;
224 }
225 if (!size)
226 return result;
227 tmp = *p;
228
229found_first:
230 tmp |= ~0UL << size;
231found_middle:
232 return result + ffz(tmp);
233}
234
235static __inline__ unsigned long find_next_bit(const unsigned long *addr,
236 unsigned long size, unsigned long offset)
237{
238 unsigned long *p = (unsigned long *)(((unsigned long)addr + (offset >> 3)) & ~3);
239 unsigned int result = offset & ~31UL;
240 unsigned int tmp;
241
242 if (offset >= size)
243 return size;
244 size -= result;
245 offset &= 31UL;
246 if (offset) {
247 tmp = *(p++);
248 tmp &= ~0UL << offset;
249 if (size < 32)
250 goto found_first;
251 if (tmp)
252 goto found_middle;
253 size -= 32;
254 result += 32;
255 }
256 while (size >= 32) {
257 if ((tmp = *p++) != 0)
258 goto found_middle;
259 result += 32;
260 size -= 32;
261 }
262 if (!size)
263 return result;
264 tmp = *p;
265
266found_first:
267 tmp &= ~0UL >> (32 - size);
268 if (tmp == 0UL)
269 return result + size;
270found_middle:
271 return result + __ffs(tmp);
272}
273
274#define find_first_bit(addr, size) find_next_bit(addr, size, 0)
275
276/*
277 * Every architecture must define this function. It's the fastest
278 * way of searching a 140-bit bitmap where the first 100 bits are
279 * unlikely to be set. It's guaranteed that at least one of the 140
280 * bits is cleared.
281 */
282static inline int sched_find_first_bit(unsigned long *b)
283{
284 if (unlikely(b[0]))
285 return __ffs(b[0]);
286 if (unlikely(b[1]))
287 return __ffs(b[1]) + 32;
288 if (unlikely(b[2]))
289 return __ffs(b[2]) + 64;
290 if (b[3])
291 return __ffs(b[3]) + 96;
292 return __ffs(b[4]) + 128;
293}
294
295/*
296 * hweightN: returns the hamming weight (i.e. the number
297 * of bits set) of a N-bit word
298 */
299
300#define hweight32(x) generic_hweight32(x)
301#define hweight16(x) generic_hweight16(x)
302#define hweight8(x) generic_hweight8(x)
303
304static __inline__ int ext2_set_bit(int nr, volatile void * addr)
305{
306 int mask, retval;
307 unsigned long flags;
308 volatile unsigned char *ADDR = (unsigned char *) addr;
309
310 ADDR += nr >> 3;
311 mask = 1 << (nr & 0x07);
312 local_irq_save(flags);
313 retval = (mask & *ADDR) != 0;
314 *ADDR |= mask;
315 local_irq_restore(flags);
316 return retval;
317}
318#define ext2_set_bit_atomic(lock, nr, addr) ext2_set_bit(nr, addr)
319
320static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
321{
322 int mask, retval;
323 unsigned long flags;
324 volatile unsigned char *ADDR = (unsigned char *) addr;
325
326 ADDR += nr >> 3;
327 mask = 1 << (nr & 0x07);
328 local_irq_save(flags);
329 retval = (mask & *ADDR) != 0;
330 *ADDR &= ~mask;
331 local_irq_restore(flags);
332 return retval;
333}
334#define ext2_clear_bit_atomic(lock, nr, addr) ext2_set_bit(nr, addr)
335
336static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
337{
338 int mask;
339 const volatile unsigned char *ADDR = (const unsigned char *) addr;
340
341 ADDR += nr >> 3;
342 mask = 1 << (nr & 0x07);
343 return ((mask & *ADDR) != 0);
344}
345
346#define ext2_find_first_zero_bit(addr, size) \
347 ext2_find_next_zero_bit((addr), (size), 0)
348
349static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
350{
351 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
352 unsigned long result = offset & ~31UL;
353 unsigned long tmp;
354
355 if (offset >= size)
356 return size;
357 size -= result;
358 offset &= 31UL;
359 if(offset) {
360 /* We hold the little endian value in tmp, but then the
361 * shift is illegal. So we could keep a big endian value
362 * in tmp, like this:
363 *
364 * tmp = __swab32(*(p++));
365 * tmp |= ~0UL >> (32-offset);
366 *
367 * but this would decrease performance, so we change the
368 * shift:
369 */
370 tmp = *(p++);
371 tmp |= __swab32(~0UL >> (32-offset));
372 if(size < 32)
373 goto found_first;
374 if(~tmp)
375 goto found_middle;
376 size -= 32;
377 result += 32;
378 }
379 while(size & ~31UL) {
380 if(~(tmp = *(p++)))
381 goto found_middle;
382 result += 32;
383 size -= 32;
384 }
385 if(!size)
386 return result;
387 tmp = *p;
388
389found_first:
390 /* tmp is little endian, so we would have to swab the shift,
391 * see above. But then we have to swab tmp below for ffz, so
392 * we might as well do this here.
393 */
394 return result + ffz(__swab32(tmp) | (~0UL << size));
395found_middle:
396 return result + ffz(__swab32(tmp));
397}
398
399/* Bitmap functions for the minix filesystem. */
400#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
401#define minix_set_bit(nr,addr) set_bit(nr,addr)
402#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
403#define minix_test_bit(nr,addr) test_bit(nr,addr)
404#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
405 201
406#endif /* __KERNEL__ */ 202#endif /* __KERNEL__ */
407 203
408#define fls(x) generic_fls(x) 204#include <asm-generic/bitops/fls.h>
409#define fls64(x) generic_fls64(x) 205#include <asm-generic/bitops/fls64.h>
410 206
411#endif /* _H8300_BITOPS_H */ 207#endif /* _H8300_BITOPS_H */
diff --git a/include/asm-h8300/page.h b/include/asm-h8300/page.h
index cd35b1cc6cde..6472c9f88227 100644
--- a/include/asm-h8300/page.h
+++ b/include/asm-h8300/page.h
@@ -71,8 +71,7 @@ extern unsigned long memory_end;
71#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) 71#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
72#define pfn_valid(page) (page < max_mapnr) 72#define pfn_valid(page) (page < max_mapnr)
73 73
74#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn)) 74#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
75#define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
76 75
77#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ 76#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
78 ((void *)(kaddr) < (void *)memory_end)) 77 ((void *)(kaddr) < (void *)memory_end))
@@ -81,6 +80,7 @@ extern unsigned long memory_end;
81 80
82#endif /* __KERNEL__ */ 81#endif /* __KERNEL__ */
83 82
83#include <asm-generic/memory_model.h>
84#include <asm-generic/page.h> 84#include <asm-generic/page.h>
85 85
86#endif /* _H8300_PAGE_H */ 86#endif /* _H8300_PAGE_H */
diff --git a/include/asm-h8300/poll.h b/include/asm-h8300/poll.h
index bf49ab8ad6da..fc52103b276a 100644
--- a/include/asm-h8300/poll.h
+++ b/include/asm-h8300/poll.h
@@ -12,6 +12,7 @@
12#define POLLRDBAND 128 12#define POLLRDBAND 128
13#define POLLWRBAND 256 13#define POLLWRBAND 256
14#define POLLMSG 0x0400 14#define POLLMSG 0x0400
15#define POLLRDHUP 0x2000
15 16
16struct pollfd { 17struct pollfd {
17 int fd; 18 int fd;
diff --git a/include/asm-h8300/types.h b/include/asm-h8300/types.h
index bf91e0d4dde7..da2402b86540 100644
--- a/include/asm-h8300/types.h
+++ b/include/asm-h8300/types.h
@@ -58,6 +58,9 @@ typedef u32 dma_addr_t;
58#define HAVE_SECTOR_T 58#define HAVE_SECTOR_T
59typedef u64 sector_t; 59typedef u64 sector_t;
60 60
61#define HAVE_BLKCNT_T
62typedef u64 blkcnt_t;
63
61#endif /* __KERNEL__ */ 64#endif /* __KERNEL__ */
62 65
63#endif /* __ASSEMBLY__ */ 66#endif /* __ASSEMBLY__ */
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h
index 55059abf9c95..20f523954218 100644
--- a/include/asm-i386/acpi.h
+++ b/include/asm-i386/acpi.h
@@ -103,6 +103,12 @@ __acpi_release_global_lock (unsigned int *lock)
103 :"=r"(n_hi), "=r"(n_lo) \ 103 :"=r"(n_hi), "=r"(n_lo) \
104 :"0"(n_hi), "1"(n_lo)) 104 :"0"(n_hi), "1"(n_lo))
105 105
106#ifdef CONFIG_X86_IO_APIC
107extern void check_acpi_pci(void);
108#else
109static inline void check_acpi_pci(void) { }
110#endif
111
106#ifdef CONFIG_ACPI 112#ifdef CONFIG_ACPI
107extern int acpi_lapic; 113extern int acpi_lapic;
108extern int acpi_ioapic; 114extern int acpi_ioapic;
@@ -128,8 +134,6 @@ extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
128extern int skip_ioapic_setup; 134extern int skip_ioapic_setup;
129extern int acpi_skip_timer_override; 135extern int acpi_skip_timer_override;
130 136
131extern void check_acpi_pci(void);
132
133static inline void disable_ioapic_setup(void) 137static inline void disable_ioapic_setup(void)
134{ 138{
135 skip_ioapic_setup = 1; 139 skip_ioapic_setup = 1;
@@ -142,8 +146,6 @@ static inline int ioapic_setup_disabled(void)
142 146
143#else 147#else
144static inline void disable_ioapic_setup(void) { } 148static inline void disable_ioapic_setup(void) { }
145static inline void check_acpi_pci(void) { }
146
147#endif 149#endif
148 150
149static inline void acpi_noirq_set(void) { acpi_noirq = 1; } 151static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h
new file mode 100644
index 000000000000..e201decea0c9
--- /dev/null
+++ b/include/asm-i386/alternative.h
@@ -0,0 +1,129 @@
1#ifndef _I386_ALTERNATIVE_H
2#define _I386_ALTERNATIVE_H
3
4#ifdef __KERNEL__
5
6struct alt_instr {
7 u8 *instr; /* original instruction */
8 u8 *replacement;
9 u8 cpuid; /* cpuid bit set for replacement */
10 u8 instrlen; /* length of original instruction */
11 u8 replacementlen; /* length of new instruction, <= instrlen */
12 u8 pad;
13};
14
15extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
16
17struct module;
18extern void alternatives_smp_module_add(struct module *mod, char *name,
19 void *locks, void *locks_end,
20 void *text, void *text_end);
21extern void alternatives_smp_module_del(struct module *mod);
22extern void alternatives_smp_switch(int smp);
23
24#endif
25
26/*
27 * Alternative instructions for different CPU types or capabilities.
28 *
29 * This allows to use optimized instructions even on generic binary
30 * kernels.
31 *
32 * length of oldinstr must be longer or equal the length of newinstr
33 * It can be padded with nops as needed.
34 *
35 * For non barrier like inlines please define new variants
36 * without volatile and memory clobber.
37 */
38#define alternative(oldinstr, newinstr, feature) \
39 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
40 ".section .altinstructions,\"a\"\n" \
41 " .align 4\n" \
42 " .long 661b\n" /* label */ \
43 " .long 663f\n" /* new instruction */ \
44 " .byte %c0\n" /* feature bit */ \
45 " .byte 662b-661b\n" /* sourcelen */ \
46 " .byte 664f-663f\n" /* replacementlen */ \
47 ".previous\n" \
48 ".section .altinstr_replacement,\"ax\"\n" \
49 "663:\n\t" newinstr "\n664:\n" /* replacement */\
50 ".previous" :: "i" (feature) : "memory")
51
52/*
53 * Alternative inline assembly with input.
54 *
55 * Pecularities:
56 * No memory clobber here.
57 * Argument numbers start with 1.
58 * Best is to use constraints that are fixed size (like (%1) ... "r")
59 * If you use variable sized constraints like "m" or "g" in the
60 * replacement maake sure to pad to the worst case length.
61 */
62#define alternative_input(oldinstr, newinstr, feature, input...) \
63 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
64 ".section .altinstructions,\"a\"\n" \
65 " .align 4\n" \
66 " .long 661b\n" /* label */ \
67 " .long 663f\n" /* new instruction */ \
68 " .byte %c0\n" /* feature bit */ \
69 " .byte 662b-661b\n" /* sourcelen */ \
70 " .byte 664f-663f\n" /* replacementlen */ \
71 ".previous\n" \
72 ".section .altinstr_replacement,\"ax\"\n" \
73 "663:\n\t" newinstr "\n664:\n" /* replacement */\
74 ".previous" :: "i" (feature), ##input)
75
76/*
77 * Alternative inline assembly for SMP.
78 *
79 * alternative_smp() takes two versions (SMP first, UP second) and is
80 * for more complex stuff such as spinlocks.
81 *
82 * The LOCK_PREFIX macro defined here replaces the LOCK and
83 * LOCK_PREFIX macros used everywhere in the source tree.
84 *
85 * SMP alternatives use the same data structures as the other
86 * alternatives and the X86_FEATURE_UP flag to indicate the case of a
87 * UP system running a SMP kernel. The existing apply_alternatives()
88 * works fine for patching a SMP kernel for UP.
89 *
90 * The SMP alternative tables can be kept after boot and contain both
91 * UP and SMP versions of the instructions to allow switching back to
92 * SMP at runtime, when hotplugging in a new CPU, which is especially
93 * useful in virtualized environments.
94 *
95 * The very common lock prefix is handled as special case in a
96 * separate table which is a pure address list without replacement ptr
97 * and size information. That keeps the table sizes small.
98 */
99
100#ifdef CONFIG_SMP
101#define alternative_smp(smpinstr, upinstr, args...) \
102 asm volatile ("661:\n\t" smpinstr "\n662:\n" \
103 ".section .smp_altinstructions,\"a\"\n" \
104 " .align 4\n" \
105 " .long 661b\n" /* label */ \
106 " .long 663f\n" /* new instruction */ \
107 " .byte 0x68\n" /* X86_FEATURE_UP */ \
108 " .byte 662b-661b\n" /* sourcelen */ \
109 " .byte 664f-663f\n" /* replacementlen */ \
110 ".previous\n" \
111 ".section .smp_altinstr_replacement,\"awx\"\n" \
112 "663:\n\t" upinstr "\n" /* replacement */ \
113 "664:\n\t.fill 662b-661b,1,0x42\n" /* space for original */ \
114 ".previous" : args)
115
116#define LOCK_PREFIX \
117 ".section .smp_locks,\"a\"\n" \
118 " .align 4\n" \
119 " .long 661f\n" /* address */ \
120 ".previous\n" \
121 "661:\n\tlock; "
122
123#else /* ! CONFIG_SMP */
124#define alternative_smp(smpinstr, upinstr, args...) \
125 asm volatile (upinstr : args)
126#define LOCK_PREFIX ""
127#endif
128
129#endif /* _I386_ALTERNATIVE_H */
diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h
index 03185cef8e0a..5e4a35af2921 100644
--- a/include/asm-i386/apicdef.h
+++ b/include/asm-i386/apicdef.h
@@ -37,6 +37,7 @@
37#define APIC_SPIV_FOCUS_DISABLED (1<<9) 37#define APIC_SPIV_FOCUS_DISABLED (1<<9)
38#define APIC_SPIV_APIC_ENABLED (1<<8) 38#define APIC_SPIV_APIC_ENABLED (1<<8)
39#define APIC_ISR 0x100 39#define APIC_ISR 0x100
40#define APIC_ISR_NR 0x8 /* Number of 32 bit ISR registers. */
40#define APIC_TMR 0x180 41#define APIC_TMR 0x180
41#define APIC_IRR 0x200 42#define APIC_IRR 0x200
42#define APIC_ESR 0x280 43#define APIC_ESR 0x280
diff --git a/include/asm-i386/arch_hooks.h b/include/asm-i386/arch_hooks.h
index 28b96a6fb9fa..238cf4275b96 100644
--- a/include/asm-i386/arch_hooks.h
+++ b/include/asm-i386/arch_hooks.h
@@ -24,4 +24,7 @@ extern void trap_init_hook(void);
24extern void time_init_hook(void); 24extern void time_init_hook(void);
25extern void mca_nmi_hook(void); 25extern void mca_nmi_hook(void);
26 26
27extern int setup_early_printk(char *);
28extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2)));
29
27#endif 30#endif
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index de649d3aa2d4..22d80ece95cb 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -10,12 +10,6 @@
10 * resource counting etc.. 10 * resource counting etc..
11 */ 11 */
12 12
13#ifdef CONFIG_SMP
14#define LOCK "lock ; "
15#else
16#define LOCK ""
17#endif
18
19/* 13/*
20 * Make sure gcc doesn't try to be clever and move things around 14 * Make sure gcc doesn't try to be clever and move things around
21 * on us. We need to use _exactly_ the address the user gave us, 15 * on us. We need to use _exactly_ the address the user gave us,
@@ -52,7 +46,7 @@ typedef struct { volatile int counter; } atomic_t;
52static __inline__ void atomic_add(int i, atomic_t *v) 46static __inline__ void atomic_add(int i, atomic_t *v)
53{ 47{
54 __asm__ __volatile__( 48 __asm__ __volatile__(
55 LOCK "addl %1,%0" 49 LOCK_PREFIX "addl %1,%0"
56 :"=m" (v->counter) 50 :"=m" (v->counter)
57 :"ir" (i), "m" (v->counter)); 51 :"ir" (i), "m" (v->counter));
58} 52}
@@ -67,7 +61,7 @@ static __inline__ void atomic_add(int i, atomic_t *v)
67static __inline__ void atomic_sub(int i, atomic_t *v) 61static __inline__ void atomic_sub(int i, atomic_t *v)
68{ 62{
69 __asm__ __volatile__( 63 __asm__ __volatile__(
70 LOCK "subl %1,%0" 64 LOCK_PREFIX "subl %1,%0"
71 :"=m" (v->counter) 65 :"=m" (v->counter)
72 :"ir" (i), "m" (v->counter)); 66 :"ir" (i), "m" (v->counter));
73} 67}
@@ -86,7 +80,7 @@ static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
86 unsigned char c; 80 unsigned char c;
87 81
88 __asm__ __volatile__( 82 __asm__ __volatile__(
89 LOCK "subl %2,%0; sete %1" 83 LOCK_PREFIX "subl %2,%0; sete %1"
90 :"=m" (v->counter), "=qm" (c) 84 :"=m" (v->counter), "=qm" (c)
91 :"ir" (i), "m" (v->counter) : "memory"); 85 :"ir" (i), "m" (v->counter) : "memory");
92 return c; 86 return c;
@@ -101,7 +95,7 @@ static __inline__ int atomic_sub_and_test(int i, atomic_t *v)
101static __inline__ void atomic_inc(atomic_t *v) 95static __inline__ void atomic_inc(atomic_t *v)
102{ 96{
103 __asm__ __volatile__( 97 __asm__ __volatile__(
104 LOCK "incl %0" 98 LOCK_PREFIX "incl %0"
105 :"=m" (v->counter) 99 :"=m" (v->counter)
106 :"m" (v->counter)); 100 :"m" (v->counter));
107} 101}
@@ -115,7 +109,7 @@ static __inline__ void atomic_inc(atomic_t *v)
115static __inline__ void atomic_dec(atomic_t *v) 109static __inline__ void atomic_dec(atomic_t *v)
116{ 110{
117 __asm__ __volatile__( 111 __asm__ __volatile__(
118 LOCK "decl %0" 112 LOCK_PREFIX "decl %0"
119 :"=m" (v->counter) 113 :"=m" (v->counter)
120 :"m" (v->counter)); 114 :"m" (v->counter));
121} 115}
@@ -133,7 +127,7 @@ static __inline__ int atomic_dec_and_test(atomic_t *v)
133 unsigned char c; 127 unsigned char c;
134 128
135 __asm__ __volatile__( 129 __asm__ __volatile__(
136 LOCK "decl %0; sete %1" 130 LOCK_PREFIX "decl %0; sete %1"
137 :"=m" (v->counter), "=qm" (c) 131 :"=m" (v->counter), "=qm" (c)
138 :"m" (v->counter) : "memory"); 132 :"m" (v->counter) : "memory");
139 return c != 0; 133 return c != 0;
@@ -152,7 +146,7 @@ static __inline__ int atomic_inc_and_test(atomic_t *v)
152 unsigned char c; 146 unsigned char c;
153 147
154 __asm__ __volatile__( 148 __asm__ __volatile__(
155 LOCK "incl %0; sete %1" 149 LOCK_PREFIX "incl %0; sete %1"
156 :"=m" (v->counter), "=qm" (c) 150 :"=m" (v->counter), "=qm" (c)
157 :"m" (v->counter) : "memory"); 151 :"m" (v->counter) : "memory");
158 return c != 0; 152 return c != 0;
@@ -172,7 +166,7 @@ static __inline__ int atomic_add_negative(int i, atomic_t *v)
172 unsigned char c; 166 unsigned char c;
173 167
174 __asm__ __volatile__( 168 __asm__ __volatile__(
175 LOCK "addl %2,%0; sets %1" 169 LOCK_PREFIX "addl %2,%0; sets %1"
176 :"=m" (v->counter), "=qm" (c) 170 :"=m" (v->counter), "=qm" (c)
177 :"ir" (i), "m" (v->counter) : "memory"); 171 :"ir" (i), "m" (v->counter) : "memory");
178 return c; 172 return c;
@@ -195,7 +189,7 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
195 /* Modern 486+ processor */ 189 /* Modern 486+ processor */
196 __i = i; 190 __i = i;
197 __asm__ __volatile__( 191 __asm__ __volatile__(
198 LOCK "xaddl %0, %1;" 192 LOCK_PREFIX "xaddl %0, %1;"
199 :"=r"(i) 193 :"=r"(i)
200 :"m"(v->counter), "0"(i)); 194 :"m"(v->counter), "0"(i));
201 return i + __i; 195 return i + __i;
@@ -231,8 +225,14 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
231({ \ 225({ \
232 int c, old; \ 226 int c, old; \
233 c = atomic_read(v); \ 227 c = atomic_read(v); \
234 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 228 for (;;) { \
229 if (unlikely(c == (u))) \
230 break; \
231 old = atomic_cmpxchg((v), c, c + (a)); \
232 if (likely(old == c)) \
233 break; \
235 c = old; \ 234 c = old; \
235 } \
236 c != (u); \ 236 c != (u); \
237}) 237})
238#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 238#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
@@ -242,11 +242,11 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
242 242
243/* These are x86-specific, used by some header files */ 243/* These are x86-specific, used by some header files */
244#define atomic_clear_mask(mask, addr) \ 244#define atomic_clear_mask(mask, addr) \
245__asm__ __volatile__(LOCK "andl %0,%1" \ 245__asm__ __volatile__(LOCK_PREFIX "andl %0,%1" \
246: : "r" (~(mask)),"m" (*addr) : "memory") 246: : "r" (~(mask)),"m" (*addr) : "memory")
247 247
248#define atomic_set_mask(mask, addr) \ 248#define atomic_set_mask(mask, addr) \
249__asm__ __volatile__(LOCK "orl %0,%1" \ 249__asm__ __volatile__(LOCK_PREFIX "orl %0,%1" \
250: : "r" (mask),"m" (*(addr)) : "memory") 250: : "r" (mask),"m" (*(addr)) : "memory")
251 251
252/* Atomic operations are already serializing on x86 */ 252/* Atomic operations are already serializing on x86 */
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index 88e6ca248cd7..08deaeee6be9 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -7,6 +7,7 @@
7 7
8#include <linux/config.h> 8#include <linux/config.h>
9#include <linux/compiler.h> 9#include <linux/compiler.h>
10#include <asm/alternative.h>
10 11
11/* 12/*
12 * These have to be done with inline assembly: that way the bit-setting 13 * These have to be done with inline assembly: that way the bit-setting
@@ -16,12 +17,6 @@
16 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). 17 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
17 */ 18 */
18 19
19#ifdef CONFIG_SMP
20#define LOCK_PREFIX "lock ; "
21#else
22#define LOCK_PREFIX ""
23#endif
24
25#define ADDR (*(volatile long *) addr) 20#define ADDR (*(volatile long *) addr)
26 21
27/** 22/**
@@ -367,28 +362,9 @@ static inline unsigned long ffz(unsigned long word)
367 return word; 362 return word;
368} 363}
369 364
370#define fls64(x) generic_fls64(x)
371
372#ifdef __KERNEL__ 365#ifdef __KERNEL__
373 366
374/* 367#include <asm-generic/bitops/sched.h>
375 * Every architecture must define this function. It's the fastest
376 * way of searching a 140-bit bitmap where the first 100 bits are
377 * unlikely to be set. It's guaranteed that at least one of the 140
378 * bits is cleared.
379 */
380static inline int sched_find_first_bit(const unsigned long *b)
381{
382 if (unlikely(b[0]))
383 return __ffs(b[0]);
384 if (unlikely(b[1]))
385 return __ffs(b[1]) + 32;
386 if (unlikely(b[2]))
387 return __ffs(b[2]) + 64;
388 if (b[3])
389 return __ffs(b[3]) + 96;
390 return __ffs(b[4]) + 128;
391}
392 368
393/** 369/**
394 * ffs - find first bit set 370 * ffs - find first bit set
@@ -426,42 +402,22 @@ static inline int fls(int x)
426 return r+1; 402 return r+1;
427} 403}
428 404
429/** 405#include <asm-generic/bitops/hweight.h>
430 * hweightN - returns the hamming weight of a N-bit word
431 * @x: the word to weigh
432 *
433 * The Hamming Weight of a number is the total number of bits set in it.
434 */
435
436#define hweight32(x) generic_hweight32(x)
437#define hweight16(x) generic_hweight16(x)
438#define hweight8(x) generic_hweight8(x)
439 406
440#endif /* __KERNEL__ */ 407#endif /* __KERNEL__ */
441 408
409#include <asm-generic/bitops/fls64.h>
410
442#ifdef __KERNEL__ 411#ifdef __KERNEL__
443 412
444#define ext2_set_bit(nr,addr) \ 413#include <asm-generic/bitops/ext2-non-atomic.h>
445 __test_and_set_bit((nr),(unsigned long*)addr) 414
446#define ext2_set_bit_atomic(lock,nr,addr) \ 415#define ext2_set_bit_atomic(lock,nr,addr) \
447 test_and_set_bit((nr),(unsigned long*)addr) 416 test_and_set_bit((nr),(unsigned long*)addr)
448#define ext2_clear_bit(nr, addr) \
449 __test_and_clear_bit((nr),(unsigned long*)addr)
450#define ext2_clear_bit_atomic(lock,nr, addr) \ 417#define ext2_clear_bit_atomic(lock,nr, addr) \
451 test_and_clear_bit((nr),(unsigned long*)addr) 418 test_and_clear_bit((nr),(unsigned long*)addr)
452#define ext2_test_bit(nr, addr) test_bit((nr),(unsigned long*)addr) 419
453#define ext2_find_first_zero_bit(addr, size) \ 420#include <asm-generic/bitops/minix.h>
454 find_first_zero_bit((unsigned long*)addr, size)
455#define ext2_find_next_zero_bit(addr, size, off) \
456 find_next_zero_bit((unsigned long*)addr, size, off)
457
458/* Bitmap functions for the minix filesystem. */
459#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,(void*)addr)
460#define minix_set_bit(nr,addr) __set_bit(nr,(void*)addr)
461#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,(void*)addr)
462#define minix_test_bit(nr,addr) test_bit(nr,(void*)addr)
463#define minix_find_first_zero_bit(addr,size) \
464 find_first_zero_bit((void*)addr,size)
465 421
466#endif /* __KERNEL__ */ 422#endif /* __KERNEL__ */
467 423
diff --git a/include/asm-i386/cache.h b/include/asm-i386/cache.h
index 615911e5bd24..ca15c9c665cf 100644
--- a/include/asm-i386/cache.h
+++ b/include/asm-i386/cache.h
@@ -10,4 +10,6 @@
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 __read_mostly __attribute__((__section__(".data.read_mostly")))
14
13#endif 15#endif
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index c4ec2a4d8fdf..5c0b5876b931 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -70,6 +70,7 @@
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#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */
73#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */
73 74
74/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 75/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
75#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 76#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
diff --git a/include/asm-i386/dmi.h b/include/asm-i386/dmi.h
new file mode 100644
index 000000000000..38d4eeb7fc7e
--- /dev/null
+++ b/include/asm-i386/dmi.h
@@ -0,0 +1,11 @@
1#ifndef _ASM_DMI_H
2#define _ASM_DMI_H 1
3
4#include <asm/io.h>
5
6/* Use early IO mappings for DMI because it's initialized early */
7#define dmi_ioremap bt_ioremap
8#define dmi_iounmap bt_iounmap
9#define dmi_alloc alloc_bootmem
10
11#endif
diff --git a/include/asm-i386/floppy.h b/include/asm-i386/floppy.h
index 79727afb94c9..03403045c182 100644
--- a/include/asm-i386/floppy.h
+++ b/include/asm-i386/floppy.h
@@ -56,7 +56,6 @@ static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
56 register unsigned char st; 56 register unsigned char st;
57 57
58#undef TRACE_FLPY_INT 58#undef TRACE_FLPY_INT
59#define NO_FLOPPY_ASSEMBLER
60 59
61#ifdef TRACE_FLPY_INT 60#ifdef TRACE_FLPY_INT
62 static int calls=0; 61 static int calls=0;
@@ -71,38 +70,6 @@ static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
71 bytes = virtual_dma_count; 70 bytes = virtual_dma_count;
72#endif 71#endif
73 72
74#ifndef NO_FLOPPY_ASSEMBLER
75 __asm__ (
76 "testl %1,%1"
77 "je 3f"
78"1: inb %w4,%b0"
79 "andb $160,%b0"
80 "cmpb $160,%b0"
81 "jne 2f"
82 "incw %w4"
83 "testl %3,%3"
84 "jne 4f"
85 "inb %w4,%b0"
86 "movb %0,(%2)"
87 "jmp 5f"
88"4: movb (%2),%0"
89 "outb %b0,%w4"
90"5: decw %w4"
91 "outb %0,$0x80"
92 "decl %1"
93 "incl %2"
94 "testl %1,%1"
95 "jne 1b"
96"3: inb %w4,%b0"
97"2: "
98 : "=a" ((char) st),
99 "=c" ((long) virtual_dma_count),
100 "=S" ((long) virtual_dma_addr)
101 : "b" ((long) virtual_dma_mode),
102 "d" ((short) virtual_dma_port+4),
103 "1" ((long) virtual_dma_count),
104 "2" ((long) virtual_dma_addr));
105#else
106 { 73 {
107 register int lcount; 74 register int lcount;
108 register char *lptr; 75 register char *lptr;
@@ -122,7 +89,6 @@ static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
122 virtual_dma_addr = lptr; 89 virtual_dma_addr = lptr;
123 st = inb(virtual_dma_port+4); 90 st = inb(virtual_dma_port+4);
124 } 91 }
125#endif
126 92
127#ifdef TRACE_FLPY_INT 93#ifdef TRACE_FLPY_INT
128 calls++; 94 calls++;
diff --git a/include/asm-i386/futex.h b/include/asm-i386/futex.h
index 44b9db806474..7b8ceefd010f 100644
--- a/include/asm-i386/futex.h
+++ b/include/asm-i386/futex.h
@@ -104,5 +104,32 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
104 return ret; 104 return ret;
105} 105}
106 106
107static inline int
108futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
109{
110 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
111 return -EFAULT;
112
113 __asm__ __volatile__(
114 "1: " LOCK_PREFIX "cmpxchgl %3, %1 \n"
115
116 "2: .section .fixup, \"ax\" \n"
117 "3: mov %2, %0 \n"
118 " jmp 2b \n"
119 " .previous \n"
120
121 " .section __ex_table, \"a\" \n"
122 " .align 8 \n"
123 " .long 1b,3b \n"
124 " .previous \n"
125
126 : "=a" (oldval), "=m" (*uaddr)
127 : "i" (-EFAULT), "r" (newval), "0" (oldval)
128 : "memory"
129 );
130
131 return oldval;
132}
133
107#endif 134#endif
108#endif 135#endif
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index 03233c2ab820..79670bb4b0c7 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -219,23 +219,11 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
219 */ 219 */
220#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET)) 220#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
221 221
222#define isa_readb(a) readb(__ISA_IO_base + (a))
223#define isa_readw(a) readw(__ISA_IO_base + (a))
224#define isa_readl(a) readl(__ISA_IO_base + (a))
225#define isa_writeb(b,a) writeb(b,__ISA_IO_base + (a))
226#define isa_writew(w,a) writew(w,__ISA_IO_base + (a))
227#define isa_writel(l,a) writel(l,__ISA_IO_base + (a))
228#define isa_memset_io(a,b,c) memset_io(__ISA_IO_base + (a),(b),(c))
229#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),__ISA_IO_base + (b),(c))
230#define isa_memcpy_toio(a,b,c) memcpy_toio(__ISA_IO_base + (a),(b),(c))
231
232
233/* 222/*
234 * Again, i386 does not require mem IO specific function. 223 * Again, i386 does not require mem IO specific function.
235 */ 224 */
236 225
237#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d)) 226#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d))
238#define isa_eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(__ISA_IO_base + (b)),(c),(d))
239 227
240/** 228/**
241 * check_signature - find BIOS signatures 229 * check_signature - find BIOS signatures
diff --git a/include/asm-i386/kdebug.h b/include/asm-i386/kdebug.h
index 316138e89910..96d0828ce096 100644
--- a/include/asm-i386/kdebug.h
+++ b/include/asm-i386/kdebug.h
@@ -17,11 +17,9 @@ struct die_args {
17 int signr; 17 int signr;
18}; 18};
19 19
20/* Note - you should never unregister because that can race with NMIs. 20extern int register_die_notifier(struct notifier_block *);
21 If you really want to do it first unregister - then synchronize_sched - then free. 21extern int unregister_die_notifier(struct notifier_block *);
22 */ 22extern struct atomic_notifier_head i386die_chain;
23int register_die_notifier(struct notifier_block *nb);
24extern struct notifier_block *i386die_chain;
25 23
26 24
27/* Grossly misnamed. */ 25/* Grossly misnamed. */
@@ -51,7 +49,7 @@ static inline int notify_die(enum die_val val, const char *str,
51 .trapnr = trap, 49 .trapnr = trap,
52 .signr = sig 50 .signr = sig
53 }; 51 };
54 return notifier_call_chain(&i386die_chain, val, &args); 52 return atomic_notifier_call_chain(&i386die_chain, val, &args);
55} 53}
56 54
57#endif 55#endif
diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h
index a0d2d74a7dda..57d157c5cf89 100644
--- a/include/asm-i386/kprobes.h
+++ b/include/asm-i386/kprobes.h
@@ -34,6 +34,7 @@ struct pt_regs;
34 34
35typedef u8 kprobe_opcode_t; 35typedef u8 kprobe_opcode_t;
36#define BREAKPOINT_INSTRUCTION 0xcc 36#define BREAKPOINT_INSTRUCTION 0xcc
37#define RELATIVEJUMP_INSTRUCTION 0xe9
37#define MAX_INSN_SIZE 16 38#define MAX_INSN_SIZE 16
38#define MAX_STACK_SIZE 64 39#define MAX_STACK_SIZE 64
39#define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \ 40#define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \
@@ -51,6 +52,11 @@ void kretprobe_trampoline(void);
51struct arch_specific_insn { 52struct arch_specific_insn {
52 /* copy of the original instruction */ 53 /* copy of the original instruction */
53 kprobe_opcode_t *insn; 54 kprobe_opcode_t *insn;
55 /*
56 * If this flag is not 0, this kprobe can be boost when its
57 * post_handler and break_handler is not set.
58 */
59 int boostable;
54}; 60};
55 61
56struct prev_kprobe { 62struct prev_kprobe {
diff --git a/include/asm-i386/local.h b/include/asm-i386/local.h
index 0177da80dde3..e67fa08260fe 100644
--- a/include/asm-i386/local.h
+++ b/include/asm-i386/local.h
@@ -5,7 +5,7 @@
5 5
6typedef struct 6typedef struct
7{ 7{
8 volatile unsigned long counter; 8 volatile long counter;
9} local_t; 9} local_t;
10 10
11#define LOCAL_INIT(i) { (i) } 11#define LOCAL_INIT(i) { (i) }
@@ -29,7 +29,7 @@ static __inline__ void local_dec(local_t *v)
29 :"m" (v->counter)); 29 :"m" (v->counter));
30} 30}
31 31
32static __inline__ void local_add(unsigned long i, local_t *v) 32static __inline__ void local_add(long i, local_t *v)
33{ 33{
34 __asm__ __volatile__( 34 __asm__ __volatile__(
35 "addl %1,%0" 35 "addl %1,%0"
@@ -37,7 +37,7 @@ static __inline__ void local_add(unsigned long i, local_t *v)
37 :"ir" (i), "m" (v->counter)); 37 :"ir" (i), "m" (v->counter));
38} 38}
39 39
40static __inline__ void local_sub(unsigned long i, local_t *v) 40static __inline__ void local_sub(long i, local_t *v)
41{ 41{
42 __asm__ __volatile__( 42 __asm__ __volatile__(
43 "subl %1,%0" 43 "subl %1,%0"
diff --git a/include/asm-i386/mach-default/do_timer.h b/include/asm-i386/mach-default/do_timer.h
index 56211414fc95..6312c3e79814 100644
--- a/include/asm-i386/mach-default/do_timer.h
+++ b/include/asm-i386/mach-default/do_timer.h
@@ -18,7 +18,7 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
18{ 18{
19 do_timer(regs); 19 do_timer(regs);
20#ifndef CONFIG_SMP 20#ifndef CONFIG_SMP
21 update_process_times(user_mode(regs)); 21 update_process_times(user_mode_vm(regs));
22#endif 22#endif
23/* 23/*
24 * In the SMP case we use the local APIC timer interrupt to do the 24 * In the SMP case we use the local APIC timer interrupt to do the
diff --git a/include/asm-i386/mach-default/mach_time.h b/include/asm-i386/mach-default/mach_time.h
index b749aa44a86f..31eb5de6f3dc 100644
--- a/include/asm-i386/mach-default/mach_time.h
+++ b/include/asm-i386/mach-default/mach_time.h
@@ -82,21 +82,8 @@ static inline int mach_set_rtc_mmss(unsigned long nowtime)
82static inline unsigned long mach_get_cmos_time(void) 82static inline unsigned long mach_get_cmos_time(void)
83{ 83{
84 unsigned int year, mon, day, hour, min, sec; 84 unsigned int year, mon, day, hour, min, sec;
85 int i;
86 85
87 /* The Linux interpretation of the CMOS clock register contents: 86 do {
88 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
89 * RTC registers show the second which has precisely just started.
90 * Let's hope other operating systems interpret the RTC the same way.
91 */
92 /* read RTC exactly on falling edge of update flag */
93 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
94 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
95 break;
96 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
97 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
98 break;
99 do { /* Isn't this overkill ? UIP above should guarantee consistency */
100 sec = CMOS_READ(RTC_SECONDS); 87 sec = CMOS_READ(RTC_SECONDS);
101 min = CMOS_READ(RTC_MINUTES); 88 min = CMOS_READ(RTC_MINUTES);
102 hour = CMOS_READ(RTC_HOURS); 89 hour = CMOS_READ(RTC_HOURS);
@@ -104,16 +91,18 @@ static inline unsigned long mach_get_cmos_time(void)
104 mon = CMOS_READ(RTC_MONTH); 91 mon = CMOS_READ(RTC_MONTH);
105 year = CMOS_READ(RTC_YEAR); 92 year = CMOS_READ(RTC_YEAR);
106 } while (sec != CMOS_READ(RTC_SECONDS)); 93 } while (sec != CMOS_READ(RTC_SECONDS));
107 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 94
108 { 95 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
109 BCD_TO_BIN(sec); 96 BCD_TO_BIN(sec);
110 BCD_TO_BIN(min); 97 BCD_TO_BIN(min);
111 BCD_TO_BIN(hour); 98 BCD_TO_BIN(hour);
112 BCD_TO_BIN(day); 99 BCD_TO_BIN(day);
113 BCD_TO_BIN(mon); 100 BCD_TO_BIN(mon);
114 BCD_TO_BIN(year); 101 BCD_TO_BIN(year);
115 } 102 }
116 if ((year += 1900) < 1970) 103
104 year += 1900;
105 if (year < 1970)
117 year += 100; 106 year += 100;
118 107
119 return mktime(year, mon, day, hour, min, sec); 108 return mktime(year, mon, day, hour, min, sec);
diff --git a/include/asm-i386/mach-es7000/mach_mpparse.h b/include/asm-i386/mach-es7000/mach_mpparse.h
index 4a0637a3e208..99f66be240be 100644
--- a/include/asm-i386/mach-es7000/mach_mpparse.h
+++ b/include/asm-i386/mach-es7000/mach_mpparse.h
@@ -30,7 +30,8 @@ static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
30 return 0; 30 return 0;
31} 31}
32 32
33static inline int es7000_check_dsdt() 33#ifdef CONFIG_ACPI
34static inline int es7000_check_dsdt(void)
34{ 35{
35 struct acpi_table_header *header = NULL; 36 struct acpi_table_header *header = NULL;
36 if(!acpi_get_table_header_early(ACPI_DSDT, &header)) 37 if(!acpi_get_table_header_early(ACPI_DSDT, &header))
@@ -54,6 +55,11 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
54 } 55 }
55 return 0; 56 return 0;
56} 57}
57 58#else
59static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
60{
61 return 0;
62}
63#endif
58 64
59#endif /* __ASM_MACH_MPPARSE_H */ 65#endif /* __ASM_MACH_MPPARSE_H */
diff --git a/include/asm-i386/mach-visws/do_timer.h b/include/asm-i386/mach-visws/do_timer.h
index 92d638fc8b11..95568e6ca91c 100644
--- a/include/asm-i386/mach-visws/do_timer.h
+++ b/include/asm-i386/mach-visws/do_timer.h
@@ -11,7 +11,7 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
11 11
12 do_timer(regs); 12 do_timer(regs);
13#ifndef CONFIG_SMP 13#ifndef CONFIG_SMP
14 update_process_times(user_mode(regs)); 14 update_process_times(user_mode_vm(regs));
15#endif 15#endif
16/* 16/*
17 * In the SMP case we use the local APIC timer interrupt to do the 17 * In the SMP case we use the local APIC timer interrupt to do the
diff --git a/include/asm-i386/mach-voyager/do_timer.h b/include/asm-i386/mach-voyager/do_timer.h
index ae510e5d0d78..eaf518098981 100644
--- a/include/asm-i386/mach-voyager/do_timer.h
+++ b/include/asm-i386/mach-voyager/do_timer.h
@@ -5,7 +5,7 @@ static inline void do_timer_interrupt_hook(struct pt_regs *regs)
5{ 5{
6 do_timer(regs); 6 do_timer(regs);
7#ifndef CONFIG_SMP 7#ifndef CONFIG_SMP
8 update_process_times(user_mode(regs)); 8 update_process_times(user_mode_vm(regs));
9#endif 9#endif
10 10
11 voyager_timer_interrupt(regs); 11 voyager_timer_interrupt(regs);
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h
index 74f595d80579..e33e9f9e4c66 100644
--- a/include/asm-i386/mmzone.h
+++ b/include/asm-i386/mmzone.h
@@ -70,8 +70,6 @@ static inline int pfn_to_nid(unsigned long pfn)
70#endif 70#endif
71} 71}
72 72
73#define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn)
74
75/* 73/*
76 * Following are macros that each numa implmentation must define. 74 * Following are macros that each numa implmentation must define.
77 */ 75 */
@@ -86,21 +84,6 @@ static inline int pfn_to_nid(unsigned long pfn)
86/* XXX: FIXME -- wli */ 84/* XXX: FIXME -- wli */
87#define kern_addr_valid(kaddr) (0) 85#define kern_addr_valid(kaddr) (0)
88 86
89#define pfn_to_page(pfn) \
90({ \
91 unsigned long __pfn = pfn; \
92 int __node = pfn_to_nid(__pfn); \
93 &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \
94})
95
96#define page_to_pfn(pg) \
97({ \
98 struct page *__page = pg; \
99 struct zone *__zone = page_zone(__page); \
100 (unsigned long)(__page - __zone->zone_mem_map) \
101 + __zone->zone_start_pfn; \
102})
103
104#ifdef CONFIG_X86_NUMAQ /* we have contiguous memory on NUMA-Q */ 87#ifdef CONFIG_X86_NUMAQ /* we have contiguous memory on NUMA-Q */
105#define pfn_valid(pfn) ((pfn) < num_physpages) 88#define pfn_valid(pfn) ((pfn) < num_physpages)
106#else 89#else
diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h
index 64a0b8e6afeb..62113d3bfdc2 100644
--- a/include/asm-i386/mpspec.h
+++ b/include/asm-i386/mpspec.h
@@ -22,7 +22,6 @@ extern int mp_bus_id_to_type [MAX_MP_BUSSES];
22extern int mp_irq_entries; 22extern int mp_irq_entries;
23extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; 23extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES];
24extern int mpc_default_type; 24extern int mpc_default_type;
25extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
26extern unsigned long mp_lapic_addr; 25extern unsigned long mp_lapic_addr;
27extern int pic_mode; 26extern int pic_mode;
28extern int using_apic_timer; 27extern int using_apic_timer;
diff --git a/include/asm-i386/mtrr.h b/include/asm-i386/mtrr.h
index 5b6ceda68c5f..64cf937c7e33 100644
--- a/include/asm-i386/mtrr.h
+++ b/include/asm-i386/mtrr.h
@@ -25,6 +25,7 @@
25 25
26#include <linux/config.h> 26#include <linux/config.h>
27#include <linux/ioctl.h> 27#include <linux/ioctl.h>
28#include <linux/errno.h>
28 29
29#define MTRR_IOCTL_BASE 'M' 30#define MTRR_IOCTL_BASE 'M'
30 31
diff --git a/include/asm-i386/mutex.h b/include/asm-i386/mutex.h
index 9b2199e829f3..05a538531229 100644
--- a/include/asm-i386/mutex.h
+++ b/include/asm-i386/mutex.h
@@ -9,6 +9,8 @@
9#ifndef _ASM_MUTEX_H 9#ifndef _ASM_MUTEX_H
10#define _ASM_MUTEX_H 10#define _ASM_MUTEX_H
11 11
12#include "asm/alternative.h"
13
12/** 14/**
13 * __mutex_fastpath_lock - try to take the lock by moving the count 15 * __mutex_fastpath_lock - try to take the lock by moving the count
14 * from 1 to a 0 value 16 * from 1 to a 0 value
@@ -27,7 +29,7 @@ do { \
27 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 29 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
28 \ 30 \
29 __asm__ __volatile__( \ 31 __asm__ __volatile__( \
30 LOCK " decl (%%eax) \n" \ 32 LOCK_PREFIX " decl (%%eax) \n" \
31 " js 2f \n" \ 33 " js 2f \n" \
32 "1: \n" \ 34 "1: \n" \
33 \ 35 \
@@ -83,7 +85,7 @@ do { \
83 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 85 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \
84 \ 86 \
85 __asm__ __volatile__( \ 87 __asm__ __volatile__( \
86 LOCK " incl (%%eax) \n" \ 88 LOCK_PREFIX " incl (%%eax) \n" \
87 " jle 2f \n" \ 89 " jle 2f \n" \
88 "1: \n" \ 90 "1: \n" \
89 \ 91 \
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index 997ca5d17876..30f52a2263ba 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -126,8 +126,6 @@ extern int page_is_ram(unsigned long pagenr);
126#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 126#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
127#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 127#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
128#ifdef CONFIG_FLATMEM 128#ifdef CONFIG_FLATMEM
129#define pfn_to_page(pfn) (mem_map + (pfn))
130#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
131#define pfn_valid(pfn) ((pfn) < max_mapnr) 129#define pfn_valid(pfn) ((pfn) < max_mapnr)
132#endif /* CONFIG_FLATMEM */ 130#endif /* CONFIG_FLATMEM */
133#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 131#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
@@ -141,6 +139,7 @@ extern int page_is_ram(unsigned long pagenr);
141 139
142#endif /* __KERNEL__ */ 140#endif /* __KERNEL__ */
143 141
142#include <asm-generic/memory_model.h>
144#include <asm-generic/page.h> 143#include <asm-generic/page.h>
145 144
146#endif /* _I386_PAGE_H */ 145#endif /* _I386_PAGE_H */
diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h
index 74ef721b534d..27bde973abc7 100644
--- a/include/asm-i386/pgtable-2level.h
+++ b/include/asm-i386/pgtable-2level.h
@@ -61,4 +61,6 @@ static inline int pte_exec_kernel(pte_t pte)
61#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low }) 61#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low })
62#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 62#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
63 63
64void vmalloc_sync_all(void);
65
64#endif /* _I386_PGTABLE_2LEVEL_H */ 66#endif /* _I386_PGTABLE_2LEVEL_H */
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h
index f1a8b454920a..36a5aa63cbbf 100644
--- a/include/asm-i386/pgtable-3level.h
+++ b/include/asm-i386/pgtable-3level.h
@@ -152,4 +152,6 @@ static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
152 152
153#define __pmd_free_tlb(tlb, x) do { } while (0) 153#define __pmd_free_tlb(tlb, x) do { } while (0)
154 154
155#define vmalloc_sync_all() ((void)0)
156
155#endif /* _I386_PGTABLE_3LEVEL_H */ 157#endif /* _I386_PGTABLE_3LEVEL_H */
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index 088a945bf26b..ee056c41a9fb 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -219,13 +219,12 @@ extern unsigned long pg0[];
219 * The following only work if pte_present() is true. 219 * The following only work if pte_present() is true.
220 * Undefined behaviour if not.. 220 * Undefined behaviour if not..
221 */ 221 */
222#define __LARGE_PTE (_PAGE_PSE | _PAGE_PRESENT)
223static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; } 222static inline int pte_user(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
224static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; } 223static inline int pte_read(pte_t pte) { return (pte).pte_low & _PAGE_USER; }
225static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; } 224static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_DIRTY; }
226static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; } 225static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; }
227static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; } 226static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_RW; }
228static inline int pte_huge(pte_t pte) { return ((pte).pte_low & __LARGE_PTE) == __LARGE_PTE; } 227static inline int pte_huge(pte_t pte) { return (pte).pte_low & _PAGE_PSE; }
229 228
230/* 229/*
231 * The following only works if pte_present() is not true. 230 * The following only works if pte_present() is not true.
@@ -242,7 +241,7 @@ static inline pte_t pte_mkexec(pte_t pte) { (pte).pte_low |= _PAGE_USER; return
242static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; } 241static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte_low |= _PAGE_DIRTY; return pte; }
243static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; } 242static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; return pte; }
244static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } 243static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; }
245static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= __LARGE_PTE; return pte; } 244static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return pte; }
246 245
247#ifdef CONFIG_X86_PAE 246#ifdef CONFIG_X86_PAE
248# include <asm/pgtable-3level.h> 247# include <asm/pgtable-3level.h>
diff --git a/include/asm-i386/poll.h b/include/asm-i386/poll.h
index aecc80a15d36..2cd4929abd40 100644
--- a/include/asm-i386/poll.h
+++ b/include/asm-i386/poll.h
@@ -16,6 +16,7 @@
16#define POLLWRBAND 0x0200 16#define POLLWRBAND 0x0200
17#define POLLMSG 0x0400 17#define POLLMSG 0x0400
18#define POLLREMOVE 0x1000 18#define POLLREMOVE 0x1000
19#define POLLRDHUP 0x2000
19 20
20struct pollfd { 21struct pollfd {
21 int fd; 22 int fd;
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index feca5d961e2b..805f0dcda468 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -20,6 +20,7 @@
20#include <linux/config.h> 20#include <linux/config.h>
21#include <linux/threads.h> 21#include <linux/threads.h>
22#include <asm/percpu.h> 22#include <asm/percpu.h>
23#include <linux/cpumask.h>
23 24
24/* flag for disabling the tsc */ 25/* flag for disabling the tsc */
25extern int tsc_disable; 26extern int tsc_disable;
@@ -67,6 +68,9 @@ struct cpuinfo_x86 {
67 char pad0; 68 char pad0;
68 int x86_power; 69 int x86_power;
69 unsigned long loops_per_jiffy; 70 unsigned long loops_per_jiffy;
71#ifdef CONFIG_SMP
72 cpumask_t llc_shared_map; /* cpus sharing the last level cache */
73#endif
70 unsigned char x86_max_cores; /* cpuid returned max cores value */ 74 unsigned char x86_max_cores; /* cpuid returned max cores value */
71 unsigned char booted_cores; /* number of cores as seen by OS */ 75 unsigned char booted_cores; /* number of cores as seen by OS */
72 unsigned char apicid; 76 unsigned char apicid;
@@ -103,6 +107,7 @@ extern struct cpuinfo_x86 cpu_data[];
103 107
104extern int phys_proc_id[NR_CPUS]; 108extern int phys_proc_id[NR_CPUS];
105extern int cpu_core_id[NR_CPUS]; 109extern int cpu_core_id[NR_CPUS];
110extern int cpu_llc_id[NR_CPUS];
106extern char ignore_fpu_irq; 111extern char ignore_fpu_irq;
107 112
108extern void identify_cpu(struct cpuinfo_x86 *); 113extern void identify_cpu(struct cpuinfo_x86 *);
@@ -616,8 +621,6 @@ struct extended_sigtable {
616 unsigned int reserved[3]; 621 unsigned int reserved[3];
617 struct extended_signature sigs[0]; 622 struct extended_signature sigs[0];
618}; 623};
619/* '6' because it used to be for P6 only (but now covers Pentium 4 as well) */
620#define MICROCODE_IOCFREE _IO('6',0)
621 624
622/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ 625/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
623static inline void rep_nop(void) 626static inline void rep_nop(void)
diff --git a/include/asm-i386/rwlock.h b/include/asm-i386/rwlock.h
index b57cc7afdf7e..94f00195d543 100644
--- a/include/asm-i386/rwlock.h
+++ b/include/asm-i386/rwlock.h
@@ -21,21 +21,23 @@
21#define RW_LOCK_BIAS_STR "0x01000000" 21#define RW_LOCK_BIAS_STR "0x01000000"
22 22
23#define __build_read_lock_ptr(rw, helper) \ 23#define __build_read_lock_ptr(rw, helper) \
24 asm volatile(LOCK "subl $1,(%0)\n\t" \ 24 alternative_smp("lock; subl $1,(%0)\n\t" \
25 "jns 1f\n" \ 25 "jns 1f\n" \
26 "call " helper "\n\t" \ 26 "call " helper "\n\t" \
27 "1:\n" \ 27 "1:\n", \
28 ::"a" (rw) : "memory") 28 "subl $1,(%0)\n\t", \
29 :"a" (rw) : "memory")
29 30
30#define __build_read_lock_const(rw, helper) \ 31#define __build_read_lock_const(rw, helper) \
31 asm volatile(LOCK "subl $1,%0\n\t" \ 32 alternative_smp("lock; subl $1,%0\n\t" \
32 "jns 1f\n" \ 33 "jns 1f\n" \
33 "pushl %%eax\n\t" \ 34 "pushl %%eax\n\t" \
34 "leal %0,%%eax\n\t" \ 35 "leal %0,%%eax\n\t" \
35 "call " helper "\n\t" \ 36 "call " helper "\n\t" \
36 "popl %%eax\n\t" \ 37 "popl %%eax\n\t" \
37 "1:\n" \ 38 "1:\n", \
38 :"=m" (*(volatile int *)rw) : : "memory") 39 "subl $1,%0\n\t", \
40 "=m" (*(volatile int *)rw) : : "memory")
39 41
40#define __build_read_lock(rw, helper) do { \ 42#define __build_read_lock(rw, helper) do { \
41 if (__builtin_constant_p(rw)) \ 43 if (__builtin_constant_p(rw)) \
@@ -45,21 +47,23 @@
45 } while (0) 47 } while (0)
46 48
47#define __build_write_lock_ptr(rw, helper) \ 49#define __build_write_lock_ptr(rw, helper) \
48 asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ 50 alternative_smp("lock; subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
49 "jz 1f\n" \ 51 "jz 1f\n" \
50 "call " helper "\n\t" \ 52 "call " helper "\n\t" \
51 "1:\n" \ 53 "1:\n", \
52 ::"a" (rw) : "memory") 54 "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t", \
55 :"a" (rw) : "memory")
53 56
54#define __build_write_lock_const(rw, helper) \ 57#define __build_write_lock_const(rw, helper) \
55 asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",%0\n\t" \ 58 alternative_smp("lock; subl $" RW_LOCK_BIAS_STR ",%0\n\t" \
56 "jz 1f\n" \ 59 "jz 1f\n" \
57 "pushl %%eax\n\t" \ 60 "pushl %%eax\n\t" \
58 "leal %0,%%eax\n\t" \ 61 "leal %0,%%eax\n\t" \
59 "call " helper "\n\t" \ 62 "call " helper "\n\t" \
60 "popl %%eax\n\t" \ 63 "popl %%eax\n\t" \
61 "1:\n" \ 64 "1:\n", \
62 :"=m" (*(volatile int *)rw) : : "memory") 65 "subl $" RW_LOCK_BIAS_STR ",%0\n\t", \
66 "=m" (*(volatile int *)rw) : : "memory")
63 67
64#define __build_write_lock(rw, helper) do { \ 68#define __build_write_lock(rw, helper) do { \
65 if (__builtin_constant_p(rw)) \ 69 if (__builtin_constant_p(rw)) \
diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h
index 6a42b2142fd6..f7a0f310c524 100644
--- a/include/asm-i386/semaphore.h
+++ b/include/asm-i386/semaphore.h
@@ -99,7 +99,7 @@ static inline void down(struct semaphore * sem)
99 might_sleep(); 99 might_sleep();
100 __asm__ __volatile__( 100 __asm__ __volatile__(
101 "# atomic down operation\n\t" 101 "# atomic down operation\n\t"
102 LOCK "decl %0\n\t" /* --sem->count */ 102 LOCK_PREFIX "decl %0\n\t" /* --sem->count */
103 "js 2f\n" 103 "js 2f\n"
104 "1:\n" 104 "1:\n"
105 LOCK_SECTION_START("") 105 LOCK_SECTION_START("")
@@ -123,7 +123,7 @@ static inline int down_interruptible(struct semaphore * sem)
123 might_sleep(); 123 might_sleep();
124 __asm__ __volatile__( 124 __asm__ __volatile__(
125 "# atomic interruptible down operation\n\t" 125 "# atomic interruptible down operation\n\t"
126 LOCK "decl %1\n\t" /* --sem->count */ 126 LOCK_PREFIX "decl %1\n\t" /* --sem->count */
127 "js 2f\n\t" 127 "js 2f\n\t"
128 "xorl %0,%0\n" 128 "xorl %0,%0\n"
129 "1:\n" 129 "1:\n"
@@ -148,7 +148,7 @@ static inline int down_trylock(struct semaphore * sem)
148 148
149 __asm__ __volatile__( 149 __asm__ __volatile__(
150 "# atomic interruptible down operation\n\t" 150 "# atomic interruptible down operation\n\t"
151 LOCK "decl %1\n\t" /* --sem->count */ 151 LOCK_PREFIX "decl %1\n\t" /* --sem->count */
152 "js 2f\n\t" 152 "js 2f\n\t"
153 "xorl %0,%0\n" 153 "xorl %0,%0\n"
154 "1:\n" 154 "1:\n"
@@ -173,7 +173,7 @@ static inline void up(struct semaphore * sem)
173{ 173{
174 __asm__ __volatile__( 174 __asm__ __volatile__(
175 "# atomic up operation\n\t" 175 "# atomic up operation\n\t"
176 LOCK "incl %0\n\t" /* ++sem->count */ 176 LOCK_PREFIX "incl %0\n\t" /* ++sem->count */
177 "jle 2f\n" 177 "jle 2f\n"
178 "1:\n" 178 "1:\n"
179 LOCK_SECTION_START("") 179 LOCK_SECTION_START("")
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h
index 826a8ca50ac8..ee941457b55d 100644
--- a/include/asm-i386/setup.h
+++ b/include/asm-i386/setup.h
@@ -6,9 +6,7 @@
6#ifndef _i386_SETUP_H 6#ifndef _i386_SETUP_H
7#define _i386_SETUP_H 7#define _i386_SETUP_H
8 8
9#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) 9#include <linux/pfn.h>
10#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
11#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
12 10
13/* 11/*
14 * Reserved space for vmalloc and iomap - defined in asm/page.h 12 * Reserved space for vmalloc and iomap - defined in asm/page.h
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
index 23604350cdf4..d76b7693cf1d 100644
--- a/include/asm-i386/spinlock.h
+++ b/include/asm-i386/spinlock.h
@@ -35,31 +35,41 @@
35#define __raw_spin_lock_string_flags \ 35#define __raw_spin_lock_string_flags \
36 "\n1:\t" \ 36 "\n1:\t" \
37 "lock ; decb %0\n\t" \ 37 "lock ; decb %0\n\t" \
38 "jns 4f\n\t" \ 38 "jns 5f\n" \
39 "2:\t" \ 39 "2:\t" \
40 "testl $0x200, %1\n\t" \ 40 "testl $0x200, %1\n\t" \
41 "jz 3f\n\t" \ 41 "jz 4f\n\t" \
42 "sti\n\t" \ 42 "sti\n" \
43 "3:\t" \ 43 "3:\t" \
44 "rep;nop\n\t" \ 44 "rep;nop\n\t" \
45 "cmpb $0, %0\n\t" \ 45 "cmpb $0, %0\n\t" \
46 "jle 3b\n\t" \ 46 "jle 3b\n\t" \
47 "cli\n\t" \ 47 "cli\n\t" \
48 "jmp 1b\n" \ 48 "jmp 1b\n" \
49 "4:\n\t" 49 "4:\t" \
50 "rep;nop\n\t" \
51 "cmpb $0, %0\n\t" \
52 "jg 1b\n\t" \
53 "jmp 4b\n" \
54 "5:\n\t"
55
56#define __raw_spin_lock_string_up \
57 "\n\tdecb %0"
50 58
51static inline void __raw_spin_lock(raw_spinlock_t *lock) 59static inline void __raw_spin_lock(raw_spinlock_t *lock)
52{ 60{
53 __asm__ __volatile__( 61 alternative_smp(
54 __raw_spin_lock_string 62 __raw_spin_lock_string,
55 :"=m" (lock->slock) : : "memory"); 63 __raw_spin_lock_string_up,
64 "=m" (lock->slock) : : "memory");
56} 65}
57 66
58static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) 67static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
59{ 68{
60 __asm__ __volatile__( 69 alternative_smp(
61 __raw_spin_lock_string_flags 70 __raw_spin_lock_string_flags,
62 :"=m" (lock->slock) : "r" (flags) : "memory"); 71 __raw_spin_lock_string_up,
72 "=m" (lock->slock) : "r" (flags) : "memory");
63} 73}
64 74
65static inline int __raw_spin_trylock(raw_spinlock_t *lock) 75static inline int __raw_spin_trylock(raw_spinlock_t *lock)
@@ -178,12 +188,12 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock)
178 188
179static inline void __raw_read_unlock(raw_rwlock_t *rw) 189static inline void __raw_read_unlock(raw_rwlock_t *rw)
180{ 190{
181 asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory"); 191 asm volatile(LOCK_PREFIX "incl %0" :"=m" (rw->lock) : : "memory");
182} 192}
183 193
184static inline void __raw_write_unlock(raw_rwlock_t *rw) 194static inline void __raw_write_unlock(raw_rwlock_t *rw)
185{ 195{
186 asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ", %0" 196 asm volatile(LOCK_PREFIX "addl $" RW_LOCK_BIAS_STR ", %0"
187 : "=m" (rw->lock) : : "memory"); 197 : "=m" (rw->lock) : : "memory");
188} 198}
189 199
diff --git a/include/asm-i386/stat.h b/include/asm-i386/stat.h
index b464f8020ec4..67eae78323ba 100644
--- a/include/asm-i386/stat.h
+++ b/include/asm-i386/stat.h
@@ -58,8 +58,7 @@ struct stat64 {
58 long long st_size; 58 long long st_size;
59 unsigned long st_blksize; 59 unsigned long st_blksize;
60 60
61 unsigned long st_blocks; /* Number 512-byte blocks allocated. */ 61 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
62 unsigned long __pad4; /* future possible st_blocks high bits */
63 62
64 unsigned long st_atime; 63 unsigned long st_atime;
65 unsigned long st_atime_nsec; 64 unsigned long st_atime_nsec;
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 399145a247f2..19cc79c9a35d 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -352,67 +352,6 @@ static inline unsigned long long __cmpxchg64(volatile void *ptr, unsigned long l
352 352
353#endif 353#endif
354 354
355#ifdef __KERNEL__
356struct alt_instr {
357 __u8 *instr; /* original instruction */
358 __u8 *replacement;
359 __u8 cpuid; /* cpuid bit set for replacement */
360 __u8 instrlen; /* length of original instruction */
361 __u8 replacementlen; /* length of new instruction, <= instrlen */
362 __u8 pad;
363};
364#endif
365
366/*
367 * Alternative instructions for different CPU types or capabilities.
368 *
369 * This allows to use optimized instructions even on generic binary
370 * kernels.
371 *
372 * length of oldinstr must be longer or equal the length of newinstr
373 * It can be padded with nops as needed.
374 *
375 * For non barrier like inlines please define new variants
376 * without volatile and memory clobber.
377 */
378#define alternative(oldinstr, newinstr, feature) \
379 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
380 ".section .altinstructions,\"a\"\n" \
381 " .align 4\n" \
382 " .long 661b\n" /* label */ \
383 " .long 663f\n" /* new instruction */ \
384 " .byte %c0\n" /* feature bit */ \
385 " .byte 662b-661b\n" /* sourcelen */ \
386 " .byte 664f-663f\n" /* replacementlen */ \
387 ".previous\n" \
388 ".section .altinstr_replacement,\"ax\"\n" \
389 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
390 ".previous" :: "i" (feature) : "memory")
391
392/*
393 * Alternative inline assembly with input.
394 *
395 * Pecularities:
396 * No memory clobber here.
397 * Argument numbers start with 1.
398 * Best is to use constraints that are fixed size (like (%1) ... "r")
399 * If you use variable sized constraints like "m" or "g" in the
400 * replacement maake sure to pad to the worst case length.
401 */
402#define alternative_input(oldinstr, newinstr, feature, input...) \
403 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
404 ".section .altinstructions,\"a\"\n" \
405 " .align 4\n" \
406 " .long 661b\n" /* label */ \
407 " .long 663f\n" /* new instruction */ \
408 " .byte %c0\n" /* feature bit */ \
409 " .byte 662b-661b\n" /* sourcelen */ \
410 " .byte 664f-663f\n" /* replacementlen */ \
411 ".previous\n" \
412 ".section .altinstr_replacement,\"ax\"\n" \
413 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
414 ".previous" :: "i" (feature), ##input)
415
416/* 355/*
417 * Force strict CPU ordering. 356 * Force strict CPU ordering.
418 * And yes, this is required on UP too when we're talking 357 * And yes, this is required on UP too when we're talking
@@ -558,5 +497,8 @@ static inline void sched_cacheflush(void)
558} 497}
559 498
560extern unsigned long arch_align_stack(unsigned long sp); 499extern unsigned long arch_align_stack(unsigned long sp);
500extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
501
502void default_idle(void);
561 503
562#endif 504#endif
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h
index aa958c6ee83e..b94e5eeef917 100644
--- a/include/asm-i386/topology.h
+++ b/include/asm-i386/topology.h
@@ -112,4 +112,6 @@ extern unsigned long node_remap_size[];
112 112
113#endif /* CONFIG_NUMA */ 113#endif /* CONFIG_NUMA */
114 114
115extern cpumask_t cpu_coregroup_map(int cpu);
116
115#endif /* _ASM_I386_TOPOLOGY_H */ 117#endif /* _ASM_I386_TOPOLOGY_H */
diff --git a/include/asm-i386/types.h b/include/asm-i386/types.h
index ced00fe8fe61..e50a08bd7ced 100644
--- a/include/asm-i386/types.h
+++ b/include/asm-i386/types.h
@@ -63,6 +63,11 @@ typedef u64 sector_t;
63#define HAVE_SECTOR_T 63#define HAVE_SECTOR_T
64#endif 64#endif
65 65
66#ifdef CONFIG_LSF
67typedef u64 blkcnt_t;
68#define HAVE_BLKCNT_T
69#endif
70
66#endif /* __ASSEMBLY__ */ 71#endif /* __ASSEMBLY__ */
67 72
68#endif /* __KERNEL__ */ 73#endif /* __KERNEL__ */
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index 3f1337c34208..371457b1ceb6 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -197,13 +197,15 @@ extern void __put_user_8(void);
197 197
198#define put_user(x,ptr) \ 198#define put_user(x,ptr) \
199({ int __ret_pu; \ 199({ int __ret_pu; \
200 __typeof__(*(ptr)) __pu_val; \
200 __chk_user_ptr(ptr); \ 201 __chk_user_ptr(ptr); \
202 __pu_val = x; \
201 switch(sizeof(*(ptr))) { \ 203 switch(sizeof(*(ptr))) { \
202 case 1: __put_user_1(x, ptr); break; \ 204 case 1: __put_user_1(__pu_val, ptr); break; \
203 case 2: __put_user_2(x, ptr); break; \ 205 case 2: __put_user_2(__pu_val, ptr); break; \
204 case 4: __put_user_4(x, ptr); break; \ 206 case 4: __put_user_4(__pu_val, ptr); break; \
205 case 8: __put_user_8(x, ptr); break; \ 207 case 8: __put_user_8(__pu_val, ptr); break; \
206 default:__put_user_X(x, ptr); break; \ 208 default:__put_user_X(__pu_val, ptr); break; \
207 } \ 209 } \
208 __ret_pu; \ 210 __ret_pu; \
209}) 211})
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index dc81a55dd94d..2e7f3e257fdd 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -316,8 +316,12 @@
316#define __NR_pselect6 308 316#define __NR_pselect6 308
317#define __NR_ppoll 309 317#define __NR_ppoll 309
318#define __NR_unshare 310 318#define __NR_unshare 310
319#define __NR_set_robust_list 311
320#define __NR_get_robust_list 312
321#define __NR_sys_splice 313
322#define __NR_sys_sync_file_range 314
319 323
320#define NR_syscalls 311 324#define NR_syscalls 315
321 325
322/* 326/*
323 * user-visible error numbers are in the range -1 - -128: see 327 * user-visible error numbers are in the range -1 - -128: see
@@ -347,9 +351,9 @@ __syscall_return(type,__res); \
347type name(type1 arg1) \ 351type name(type1 arg1) \
348{ \ 352{ \
349long __res; \ 353long __res; \
350__asm__ volatile ("int $0x80" \ 354__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
351 : "=a" (__res) \ 355 : "=a" (__res) \
352 : "0" (__NR_##name),"b" ((long)(arg1)) : "memory"); \ 356 : "0" (__NR_##name),"ri" ((long)(arg1)) : "memory"); \
353__syscall_return(type,__res); \ 357__syscall_return(type,__res); \
354} 358}
355 359
@@ -357,9 +361,10 @@ __syscall_return(type,__res); \
357type name(type1 arg1,type2 arg2) \ 361type name(type1 arg1,type2 arg2) \
358{ \ 362{ \
359long __res; \ 363long __res; \
360__asm__ volatile ("int $0x80" \ 364__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
361 : "=a" (__res) \ 365 : "=a" (__res) \
362 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)) : "memory"); \ 366 : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)) \
367 : "memory"); \
363__syscall_return(type,__res); \ 368__syscall_return(type,__res); \
364} 369}
365 370
@@ -367,9 +372,9 @@ __syscall_return(type,__res); \
367type name(type1 arg1,type2 arg2,type3 arg3) \ 372type name(type1 arg1,type2 arg2,type3 arg3) \
368{ \ 373{ \
369long __res; \ 374long __res; \
370__asm__ volatile ("int $0x80" \ 375__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
371 : "=a" (__res) \ 376 : "=a" (__res) \
372 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 377 : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \
373 "d" ((long)(arg3)) : "memory"); \ 378 "d" ((long)(arg3)) : "memory"); \
374__syscall_return(type,__res); \ 379__syscall_return(type,__res); \
375} 380}
@@ -378,9 +383,9 @@ __syscall_return(type,__res); \
378type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ 383type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
379{ \ 384{ \
380long __res; \ 385long __res; \
381__asm__ volatile ("int $0x80" \ 386__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
382 : "=a" (__res) \ 387 : "=a" (__res) \
383 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 388 : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \
384 "d" ((long)(arg3)),"S" ((long)(arg4)) : "memory"); \ 389 "d" ((long)(arg3)),"S" ((long)(arg4)) : "memory"); \
385__syscall_return(type,__res); \ 390__syscall_return(type,__res); \
386} 391}
@@ -390,10 +395,12 @@ __syscall_return(type,__res); \
390type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ 395type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
391{ \ 396{ \
392long __res; \ 397long __res; \
393__asm__ volatile ("int $0x80" \ 398__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; movl %1,%%eax ; " \
399 "int $0x80 ; pop %%ebx" \
394 : "=a" (__res) \ 400 : "=a" (__res) \
395 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 401 : "i" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \
396 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) : "memory"); \ 402 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) \
403 : "memory"); \
397__syscall_return(type,__res); \ 404__syscall_return(type,__res); \
398} 405}
399 406
@@ -402,11 +409,14 @@ __syscall_return(type,__res); \
402type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ 409type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
403{ \ 410{ \
404long __res; \ 411long __res; \
405__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \ 412 struct { long __a1; long __a6; } __s = { (long)arg1, (long)arg6 }; \
413__asm__ volatile ("push %%ebp ; push %%ebx ; movl 4(%2),%%ebp ; " \
414 "movl 0(%2),%%ebx ; movl %1,%%eax ; int $0x80 ; " \
415 "pop %%ebx ; pop %%ebp" \
406 : "=a" (__res) \ 416 : "=a" (__res) \
407 : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ 417 : "i" (__NR_##name),"0" ((long)(&__s)),"c" ((long)(arg2)), \
408 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ 418 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) \
409 "0" ((long)(arg6)) : "memory"); \ 419 : "memory"); \
410__syscall_return(type,__res); \ 420__syscall_return(type,__res); \
411} 421}
412 422
diff --git a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h
index f7a517654308..d734585a23cf 100644
--- a/include/asm-ia64/acpi.h
+++ b/include/asm-ia64/acpi.h
@@ -111,7 +111,11 @@ extern int additional_cpus;
111 111
112#ifdef CONFIG_ACPI_NUMA 112#ifdef CONFIG_ACPI_NUMA
113/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/ 113/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/
114#ifdef CONFIG_IA64_NR_NODES
115#define MAX_PXM_DOMAINS CONFIG_IA64_NR_NODES
116#else
114#define MAX_PXM_DOMAINS (256) 117#define MAX_PXM_DOMAINS (256)
118#endif
115extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS]; 119extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
116extern int __initdata nid_to_pxm_map[MAX_NUMNODES]; 120extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
117#endif 121#endif
diff --git a/include/asm-ia64/asmmacro.h b/include/asm-ia64/asmmacro.h
index 77af457f4ad7..edf2cebb2969 100644
--- a/include/asm-ia64/asmmacro.h
+++ b/include/asm-ia64/asmmacro.h
@@ -38,6 +38,10 @@ name:
38 38
39/* 39/*
40 * Helper macros for accessing user memory. 40 * Helper macros for accessing user memory.
41 *
42 * When adding any new .section/.previous entries here, make sure to
43 * also add it to the DISCARD section in arch/ia64/kernel/gate.lds.S or
44 * unpleasant things will happen.
41 */ 45 */
42 46
43 .section "__ex_table", "a" // declare section & section attributes 47 .section "__ex_table", "a" // declare section & section attributes
@@ -51,6 +55,17 @@ name:
51 [99:] x 55 [99:] x
52 56
53/* 57/*
58 * Tag MCA recoverable instruction ranges.
59 */
60
61 .section "__mca_table", "a" // declare section & section attributes
62 .previous
63
64# define MCA_RECOVER_RANGE(y) \
65 .xdata4 "__mca_table", y-., 99f-.; \
66 [99:]
67
68/*
54 * Mark instructions that need a load of a virtual address patched to be 69 * Mark instructions that need a load of a virtual address patched to be
55 * a load of a physical address. We use this either in critical performance 70 * a load of a physical address. We use this either in critical performance
56 * path (ivt.S - TLB miss processing) or in places where it might not be 71 * path (ivt.S - TLB miss processing) or in places where it might not be
diff --git a/include/asm-ia64/atomic.h b/include/asm-ia64/atomic.h
index d3e0dfa99e1f..569ec7574baf 100644
--- a/include/asm-ia64/atomic.h
+++ b/include/asm-ia64/atomic.h
@@ -95,8 +95,14 @@ ia64_atomic64_sub (__s64 i, atomic64_t *v)
95({ \ 95({ \
96 int c, old; \ 96 int c, old; \
97 c = atomic_read(v); \ 97 c = atomic_read(v); \
98 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 98 for (;;) { \
99 if (unlikely(c == (u))) \
100 break; \
101 old = atomic_cmpxchg((v), c, c + (a)); \
102 if (likely(old == c)) \
103 break; \
99 c = old; \ 104 c = old; \
105 } \
100 c != (u); \ 106 c != (u); \
101}) 107})
102#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 108#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
index 36d0fb95ea89..90921e162793 100644
--- a/include/asm-ia64/bitops.h
+++ b/include/asm-ia64/bitops.h
@@ -5,8 +5,8 @@
5 * Copyright (C) 1998-2003 Hewlett-Packard Co 5 * Copyright (C) 1998-2003 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com> 6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 * 7 *
8 * 02/06/02 find_next_bit() and find_first_bit() added from Erich Focht's ia64 O(1) 8 * 02/06/02 find_next_bit() and find_first_bit() added from Erich Focht's ia64
9 * scheduler patch 9 * O(1) scheduler patch
10 */ 10 */
11 11
12#include <linux/compiler.h> 12#include <linux/compiler.h>
@@ -25,9 +25,9 @@
25 * restricted to acting on a single-word quantity. 25 * restricted to acting on a single-word quantity.
26 * 26 *
27 * The address must be (at least) "long" aligned. 27 * The address must be (at least) "long" aligned.
28 * Note that there are driver (e.g., eepro100) which use these operations to operate on 28 * Note that there are driver (e.g., eepro100) which use these operations to
29 * hw-defined data-structures, so we can't easily change these operations to force a 29 * operate on hw-defined data-structures, so we can't easily change these
30 * bigger alignment. 30 * operations to force a bigger alignment.
31 * 31 *
32 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). 32 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
33 */ 33 */
@@ -284,8 +284,8 @@ test_bit (int nr, const volatile void *addr)
284 * ffz - find the first zero bit in a long word 284 * ffz - find the first zero bit in a long word
285 * @x: The long word to find the bit in 285 * @x: The long word to find the bit in
286 * 286 *
287 * Returns the bit-number (0..63) of the first (least significant) zero bit. Undefined if 287 * Returns the bit-number (0..63) of the first (least significant) zero bit.
288 * no zero exists, so code should check against ~0UL first... 288 * Undefined if no zero exists, so code should check against ~0UL first...
289 */ 289 */
290static inline unsigned long 290static inline unsigned long
291ffz (unsigned long x) 291ffz (unsigned long x)
@@ -345,13 +345,14 @@ fls (int t)
345 x |= x >> 16; 345 x |= x >> 16;
346 return ia64_popcnt(x); 346 return ia64_popcnt(x);
347} 347}
348#define fls64(x) generic_fls64(x) 348
349#include <asm-generic/bitops/fls64.h>
349 350
350/* 351/*
351 * ffs: find first bit set. This is defined the same way as the libc and compiler builtin 352 * ffs: find first bit set. This is defined the same way as the libc and
352 * ffs routines, therefore differs in spirit from the above ffz (man ffs): it operates on 353 * compiler builtin ffs routines, therefore differs in spirit from the above
353 * "int" values only and the result value is the bit number + 1. ffs(0) is defined to 354 * ffz (man ffs): it operates on "int" values only and the result value is the
354 * return zero. 355 * bit number + 1. ffs(0) is defined to return zero.
355 */ 356 */
356#define ffs(x) __builtin_ffs(x) 357#define ffs(x) __builtin_ffs(x)
357 358
@@ -373,51 +374,17 @@ hweight64 (unsigned long x)
373 374
374#endif /* __KERNEL__ */ 375#endif /* __KERNEL__ */
375 376
376extern int __find_next_zero_bit (const void *addr, unsigned long size, 377#include <asm-generic/bitops/find.h>
377 unsigned long offset);
378extern int __find_next_bit(const void *addr, unsigned long size,
379 unsigned long offset);
380
381#define find_next_zero_bit(addr, size, offset) \
382 __find_next_zero_bit((addr), (size), (offset))
383#define find_next_bit(addr, size, offset) \
384 __find_next_bit((addr), (size), (offset))
385
386/*
387 * The optimizer actually does good code for this case..
388 */
389#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
390
391#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
392 378
393#ifdef __KERNEL__ 379#ifdef __KERNEL__
394 380
395#define __clear_bit(nr, addr) clear_bit(nr, addr) 381#include <asm-generic/bitops/ext2-non-atomic.h>
396 382
397#define ext2_set_bit test_and_set_bit
398#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 383#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
399#define ext2_clear_bit test_and_clear_bit
400#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) 384#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
401#define ext2_test_bit test_bit
402#define ext2_find_first_zero_bit find_first_zero_bit
403#define ext2_find_next_zero_bit find_next_zero_bit
404
405/* Bitmap functions for the minix filesystem. */
406#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
407#define minix_set_bit(nr,addr) set_bit(nr,addr)
408#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
409#define minix_test_bit(nr,addr) test_bit(nr,addr)
410#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
411 385
412static inline int 386#include <asm-generic/bitops/minix.h>
413sched_find_first_bit (unsigned long *b) 387#include <asm-generic/bitops/sched.h>
414{
415 if (unlikely(b[0]))
416 return __ffs(b[0]);
417 if (unlikely(b[1]))
418 return 64 + __ffs(b[1]);
419 return __ffs(b[2]) + 128;
420}
421 388
422#endif /* __KERNEL__ */ 389#endif /* __KERNEL__ */
423 390
diff --git a/include/asm-ia64/cache.h b/include/asm-ia64/cache.h
index 40dd25195d65..f0a104db8f20 100644
--- a/include/asm-ia64/cache.h
+++ b/include/asm-ia64/cache.h
@@ -25,4 +25,6 @@
25# define SMP_CACHE_BYTES (1 << 3) 25# define SMP_CACHE_BYTES (1 << 3)
26#endif 26#endif
27 27
28#define __read_mostly __attribute__((__section__(".data.read_mostly")))
29
28#endif /* _ASM_IA64_CACHE_H */ 30#endif /* _ASM_IA64_CACHE_H */
diff --git a/include/asm-ia64/compat.h b/include/asm-ia64/compat.h
index c0b19106665c..40d01d80610d 100644
--- a/include/asm-ia64/compat.h
+++ b/include/asm-ia64/compat.h
@@ -189,6 +189,12 @@ compat_ptr (compat_uptr_t uptr)
189 return (void __user *) (unsigned long) uptr; 189 return (void __user *) (unsigned long) uptr;
190} 190}
191 191
192static inline compat_uptr_t
193ptr_to_compat(void __user *uptr)
194{
195 return (u32)(unsigned long)uptr;
196}
197
192static __inline__ void __user * 198static __inline__ void __user *
193compat_alloc_user_space (long len) 199compat_alloc_user_space (long len)
194{ 200{
diff --git a/include/asm-ia64/dmi.h b/include/asm-ia64/dmi.h
new file mode 100644
index 000000000000..f3efaa229525
--- /dev/null
+++ b/include/asm-ia64/dmi.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_DMI_H
2#define _ASM_DMI_H 1
3
4#include <asm/io.h>
5
6#endif
diff --git a/include/asm-ia64/intel_intrin.h b/include/asm-ia64/intel_intrin.h
index a7122d850177..d069b6acddce 100644
--- a/include/asm-ia64/intel_intrin.h
+++ b/include/asm-ia64/intel_intrin.h
@@ -5,113 +5,10 @@
5 * 5 *
6 * Copyright (C) 2002,2003 Jun Nakajima <jun.nakajima@intel.com> 6 * Copyright (C) 2002,2003 Jun Nakajima <jun.nakajima@intel.com>
7 * Copyright (C) 2002,2003 Suresh Siddha <suresh.b.siddha@intel.com> 7 * Copyright (C) 2002,2003 Suresh Siddha <suresh.b.siddha@intel.com>
8 * Copyright (C) 2005,2006 Hongjiu Lu <hongjiu.lu@intel.com>
8 * 9 *
9 */ 10 */
10#include <asm/types.h> 11#include <ia64intrin.h>
11
12void __lfetch(int lfhint, void *y);
13void __lfetch_excl(int lfhint, void *y);
14void __lfetch_fault(int lfhint, void *y);
15void __lfetch_fault_excl(int lfhint, void *y);
16
17/* In the following, whichFloatReg should be an integer from 0-127 */
18void __ldfs(const int whichFloatReg, void *src);
19void __ldfd(const int whichFloatReg, void *src);
20void __ldfe(const int whichFloatReg, void *src);
21void __ldf8(const int whichFloatReg, void *src);
22void __ldf_fill(const int whichFloatReg, void *src);
23void __stfs(void *dst, const int whichFloatReg);
24void __stfd(void *dst, const int whichFloatReg);
25void __stfe(void *dst, const int whichFloatReg);
26void __stf8(void *dst, const int whichFloatReg);
27void __stf_spill(void *dst, const int whichFloatReg);
28
29void __st1_rel(void *dst, const __s8 value);
30void __st2_rel(void *dst, const __s16 value);
31void __st4_rel(void *dst, const __s32 value);
32void __st8_rel(void *dst, const __s64 value);
33__u8 __ld1_acq(void *src);
34__u16 __ld2_acq(void *src);
35__u32 __ld4_acq(void *src);
36__u64 __ld8_acq(void *src);
37
38__u64 __fetchadd4_acq(__u32 *addend, const int increment);
39__u64 __fetchadd4_rel(__u32 *addend, const int increment);
40__u64 __fetchadd8_acq(__u64 *addend, const int increment);
41__u64 __fetchadd8_rel(__u64 *addend, const int increment);
42
43__u64 __getf_exp(double d);
44
45/* OS Related Itanium(R) Intrinsics */
46
47/* The names to use for whichReg and whichIndReg below come from
48 the include file asm/ia64regs.h */
49
50__u64 __getIndReg(const int whichIndReg, __s64 index);
51__u64 __getReg(const int whichReg);
52
53void __setIndReg(const int whichIndReg, __s64 index, __u64 value);
54void __setReg(const int whichReg, __u64 value);
55
56void __mf(void);
57void __mfa(void);
58void __synci(void);
59void __itcd(__s64 pa);
60void __itci(__s64 pa);
61void __itrd(__s64 whichTransReg, __s64 pa);
62void __itri(__s64 whichTransReg, __s64 pa);
63void __ptce(__s64 va);
64void __ptcl(__s64 va, __s64 pagesz);
65void __ptcg(__s64 va, __s64 pagesz);
66void __ptcga(__s64 va, __s64 pagesz);
67void __ptri(__s64 va, __s64 pagesz);
68void __ptrd(__s64 va, __s64 pagesz);
69void __invala (void);
70void __invala_gr(const int whichGeneralReg /* 0-127 */ );
71void __invala_fr(const int whichFloatReg /* 0-127 */ );
72void __nop(const int);
73void __fc(__u64 *addr);
74void __sum(int mask);
75void __rum(int mask);
76void __ssm(int mask);
77void __rsm(int mask);
78__u64 __thash(__s64);
79__u64 __ttag(__s64);
80__s64 __tpa(__s64);
81
82/* Intrinsics for implementing get/put_user macros */
83void __st_user(const char *tableName, __u64 addr, char size, char relocType, __u64 val);
84void __ld_user(const char *tableName, __u64 addr, char size, char relocType);
85
86/* This intrinsic does not generate code, it creates a barrier across which
87 * the compiler will not schedule data access instructions.
88 */
89void __memory_barrier(void);
90
91void __isrlz(void);
92void __dsrlz(void);
93
94__u64 _m64_mux1(__u64 a, const int n);
95__u64 __thash(__u64);
96
97/* Lock and Atomic Operation Related Intrinsics */
98__u64 _InterlockedExchange8(volatile __u8 *trgt, __u8 value);
99__u64 _InterlockedExchange16(volatile __u16 *trgt, __u16 value);
100__s64 _InterlockedExchange(volatile __u32 *trgt, __u32 value);
101__s64 _InterlockedExchange64(volatile __u64 *trgt, __u64 value);
102
103__u64 _InterlockedCompareExchange8_rel(volatile __u8 *dest, __u64 xchg, __u64 comp);
104__u64 _InterlockedCompareExchange8_acq(volatile __u8 *dest, __u64 xchg, __u64 comp);
105__u64 _InterlockedCompareExchange16_rel(volatile __u16 *dest, __u64 xchg, __u64 comp);
106__u64 _InterlockedCompareExchange16_acq(volatile __u16 *dest, __u64 xchg, __u64 comp);
107__u64 _InterlockedCompareExchange_rel(volatile __u32 *dest, __u64 xchg, __u64 comp);
108__u64 _InterlockedCompareExchange_acq(volatile __u32 *dest, __u64 xchg, __u64 comp);
109__u64 _InterlockedCompareExchange64_rel(volatile __u64 *dest, __u64 xchg, __u64 comp);
110__u64 _InterlockedCompareExchange64_acq(volatile __u64 *dest, __u64 xchg, __u64 comp);
111
112__s64 _m64_dep_mi(const int v, __s64 s, const int p, const int len);
113__s64 _m64_shrp(__s64 a, __s64 b, const int count);
114__s64 _m64_popcnt(__s64 a);
115 12
116#define ia64_barrier() __memory_barrier() 13#define ia64_barrier() __memory_barrier()
117 14
@@ -122,15 +19,16 @@ __s64 _m64_popcnt(__s64 a);
122#define ia64_getreg __getReg 19#define ia64_getreg __getReg
123#define ia64_setreg __setReg 20#define ia64_setreg __setReg
124 21
125#define ia64_hint(x) 22#define ia64_hint __hint
23#define ia64_hint_pause __hint_pause
126 24
127#define ia64_mux1_brcst 0 25#define ia64_mux1_brcst _m64_mux1_brcst
128#define ia64_mux1_mix 8 26#define ia64_mux1_mix _m64_mux1_mix
129#define ia64_mux1_shuf 9 27#define ia64_mux1_shuf _m64_mux1_shuf
130#define ia64_mux1_alt 10 28#define ia64_mux1_alt _m64_mux1_alt
131#define ia64_mux1_rev 11 29#define ia64_mux1_rev _m64_mux1_rev
132 30
133#define ia64_mux1 _m64_mux1 31#define ia64_mux1(x,v) _m_to_int64(_m64_mux1(_m_from_int64(x), (v)))
134#define ia64_popcnt _m64_popcnt 32#define ia64_popcnt _m64_popcnt
135#define ia64_getf_exp __getf_exp 33#define ia64_getf_exp __getf_exp
136#define ia64_shrp _m64_shrp 34#define ia64_shrp _m64_shrp
@@ -158,7 +56,7 @@ __s64 _m64_popcnt(__s64 a);
158#define ia64_stf8 __stf8 56#define ia64_stf8 __stf8
159#define ia64_stf_spill __stf_spill 57#define ia64_stf_spill __stf_spill
160 58
161#define ia64_mf __mf 59#define ia64_mf __mf
162#define ia64_mfa __mfa 60#define ia64_mfa __mfa
163 61
164#define ia64_fetchadd4_acq __fetchadd4_acq 62#define ia64_fetchadd4_acq __fetchadd4_acq
@@ -234,10 +132,10 @@ __s64 _m64_popcnt(__s64 a);
234 132
235/* Values for lfhint in __lfetch and __lfetch_fault */ 133/* Values for lfhint in __lfetch and __lfetch_fault */
236 134
237#define ia64_lfhint_none 0 135#define ia64_lfhint_none __lfhint_none
238#define ia64_lfhint_nt1 1 136#define ia64_lfhint_nt1 __lfhint_nt1
239#define ia64_lfhint_nt2 2 137#define ia64_lfhint_nt2 __lfhint_nt2
240#define ia64_lfhint_nta 3 138#define ia64_lfhint_nta __lfhint_nta
241 139
242#define ia64_lfetch __lfetch 140#define ia64_lfetch __lfetch
243#define ia64_lfetch_excl __lfetch_excl 141#define ia64_lfetch_excl __lfetch_excl
@@ -254,4 +152,6 @@ do { \
254 } \ 152 } \
255} while (0) 153} while (0)
256 154
155#define __builtin_trap() __break(0);
156
257#endif /* _ASM_IA64_INTEL_INTRIN_H */ 157#endif /* _ASM_IA64_INTEL_INTRIN_H */
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index b64fdb985494..c2e3742108bb 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -88,8 +88,8 @@ phys_to_virt (unsigned long address)
88} 88}
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); 92extern int valid_mmap_phys_addr_range (unsigned long addr, size_t count);
93 93
94/* 94/*
95 * The following two macros are deprecated and scheduled for removal. 95 * The following two macros are deprecated and scheduled for removal.
@@ -416,24 +416,18 @@ __writeq (unsigned long val, volatile void __iomem *addr)
416# define outl_p outl 416# define outl_p outl
417#endif 417#endif
418 418
419/* 419extern void __iomem * ioremap(unsigned long offset, unsigned long size);
420 * An "address" in IO memory space is not clearly either an integer or a pointer. We will 420extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
421 * accept both, thus the casts.
422 *
423 * On ia-64, we access the physical I/O memory space through the uncached kernel region.
424 */
425static inline void __iomem *
426ioremap (unsigned long offset, unsigned long size)
427{
428 return (void __iomem *) (__IA64_UNCACHED_OFFSET | (offset));
429}
430 421
431static inline void 422static inline void
432iounmap (volatile void __iomem *addr) 423iounmap (volatile void __iomem *addr)
433{ 424{
434} 425}
435 426
436#define ioremap_nocache(o,s) ioremap(o,s) 427/* Use normal IO mappings for DMI */
428#define dmi_ioremap ioremap
429#define dmi_iounmap(x,l) iounmap(x)
430#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
437 431
438# ifdef __KERNEL__ 432# ifdef __KERNEL__
439 433
diff --git a/include/asm-ia64/kdebug.h b/include/asm-ia64/kdebug.h
index 8b01a083dde6..218c458ab60c 100644
--- a/include/asm-ia64/kdebug.h
+++ b/include/asm-ia64/kdebug.h
@@ -40,7 +40,7 @@ struct die_args {
40 40
41extern int register_die_notifier(struct notifier_block *); 41extern int register_die_notifier(struct notifier_block *);
42extern int unregister_die_notifier(struct notifier_block *); 42extern int unregister_die_notifier(struct notifier_block *);
43extern struct notifier_block *ia64die_chain; 43extern struct atomic_notifier_head ia64die_chain;
44 44
45enum die_val { 45enum die_val {
46 DIE_BREAK = 1, 46 DIE_BREAK = 1,
@@ -81,7 +81,7 @@ static inline int notify_die(enum die_val val, char *str, struct pt_regs *regs,
81 .signr = sig 81 .signr = sig
82 }; 82 };
83 83
84 return notifier_call_chain(&ia64die_chain, val, &args); 84 return atomic_notifier_call_chain(&ia64die_chain, val, &args);
85} 85}
86 86
87#endif 87#endif
diff --git a/include/asm-ia64/linkage.h b/include/asm-ia64/linkage.h
index 14cd72cd8007..ef22a45c1890 100644
--- a/include/asm-ia64/linkage.h
+++ b/include/asm-ia64/linkage.h
@@ -1,6 +1,14 @@
1#ifndef __ASM_LINKAGE_H 1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H 2#define __ASM_LINKAGE_H
3 3
4#ifndef __ASSEMBLY__
5
4#define asmlinkage CPP_ASMLINKAGE __attribute__((syscall_linkage)) 6#define asmlinkage CPP_ASMLINKAGE __attribute__((syscall_linkage))
5 7
8#else
9
10#include <asm/asmmacro.h>
11
12#endif
13
6#endif 14#endif
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index ca5ea994d688..c3e4ed8a3e17 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -20,6 +20,7 @@ struct scatterlist;
20struct page; 20struct page;
21struct mm_struct; 21struct mm_struct;
22struct pci_bus; 22struct pci_bus;
23struct task_struct;
23 24
24typedef void ia64_mv_setup_t (char **); 25typedef void ia64_mv_setup_t (char **);
25typedef void ia64_mv_cpu_init_t (void); 26typedef void ia64_mv_cpu_init_t (void);
@@ -34,6 +35,7 @@ typedef int ia64_mv_pci_legacy_read_t (struct pci_bus *, u16 port, u32 *val,
34 u8 size); 35 u8 size);
35typedef int ia64_mv_pci_legacy_write_t (struct pci_bus *, u16 port, u32 val, 36typedef int ia64_mv_pci_legacy_write_t (struct pci_bus *, u16 port, u32 val,
36 u8 size); 37 u8 size);
38typedef void ia64_mv_migrate_t(struct task_struct * task);
37 39
38/* DMA-mapping interface: */ 40/* DMA-mapping interface: */
39typedef void ia64_mv_dma_init (void); 41typedef void ia64_mv_dma_init (void);
@@ -85,6 +87,11 @@ machvec_noop_mm (struct mm_struct *mm)
85{ 87{
86} 88}
87 89
90static inline void
91machvec_noop_task (struct task_struct *task)
92{
93}
94
88extern void machvec_setup (char **); 95extern void machvec_setup (char **);
89extern void machvec_timer_interrupt (int, void *, struct pt_regs *); 96extern void machvec_timer_interrupt (int, void *, struct pt_regs *);
90extern void machvec_dma_sync_single (struct device *, dma_addr_t, size_t, int); 97extern void machvec_dma_sync_single (struct device *, dma_addr_t, size_t, int);
@@ -146,6 +153,7 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
146# define platform_readw_relaxed ia64_mv.readw_relaxed 153# define platform_readw_relaxed ia64_mv.readw_relaxed
147# define platform_readl_relaxed ia64_mv.readl_relaxed 154# define platform_readl_relaxed ia64_mv.readl_relaxed
148# define platform_readq_relaxed ia64_mv.readq_relaxed 155# define platform_readq_relaxed ia64_mv.readq_relaxed
156# define platform_migrate ia64_mv.migrate
149# endif 157# endif
150 158
151/* __attribute__((__aligned__(16))) is required to make size of the 159/* __attribute__((__aligned__(16))) is required to make size of the
@@ -194,6 +202,7 @@ struct ia64_machine_vector {
194 ia64_mv_readw_relaxed_t *readw_relaxed; 202 ia64_mv_readw_relaxed_t *readw_relaxed;
195 ia64_mv_readl_relaxed_t *readl_relaxed; 203 ia64_mv_readl_relaxed_t *readl_relaxed;
196 ia64_mv_readq_relaxed_t *readq_relaxed; 204 ia64_mv_readq_relaxed_t *readq_relaxed;
205 ia64_mv_migrate_t *migrate;
197} __attribute__((__aligned__(16))); /* align attrib? see above comment */ 206} __attribute__((__aligned__(16))); /* align attrib? see above comment */
198 207
199#define MACHVEC_INIT(name) \ 208#define MACHVEC_INIT(name) \
@@ -238,6 +247,7 @@ struct ia64_machine_vector {
238 platform_readw_relaxed, \ 247 platform_readw_relaxed, \
239 platform_readl_relaxed, \ 248 platform_readl_relaxed, \
240 platform_readq_relaxed, \ 249 platform_readq_relaxed, \
250 platform_migrate, \
241} 251}
242 252
243extern struct ia64_machine_vector ia64_mv; 253extern struct ia64_machine_vector ia64_mv;
@@ -386,5 +396,8 @@ extern ia64_mv_dma_supported swiotlb_dma_supported;
386#ifndef platform_readq_relaxed 396#ifndef platform_readq_relaxed
387# define platform_readq_relaxed __ia64_readq_relaxed 397# define platform_readq_relaxed __ia64_readq_relaxed
388#endif 398#endif
399#ifndef platform_migrate
400# define platform_migrate machvec_noop_task
401#endif
389 402
390#endif /* _ASM_IA64_MACHVEC_H */ 403#endif /* _ASM_IA64_MACHVEC_H */
diff --git a/include/asm-ia64/machvec_dig.h b/include/asm-ia64/machvec_dig.h
index 4dc8522c974f..8a0752f40987 100644
--- a/include/asm-ia64/machvec_dig.h
+++ b/include/asm-ia64/machvec_dig.h
@@ -2,7 +2,6 @@
2#define _ASM_IA64_MACHVEC_DIG_h 2#define _ASM_IA64_MACHVEC_DIG_h
3 3
4extern ia64_mv_setup_t dig_setup; 4extern ia64_mv_setup_t dig_setup;
5extern ia64_mv_irq_init_t dig_irq_init;
6 5
7/* 6/*
8 * This stuff has dual use! 7 * This stuff has dual use!
@@ -13,6 +12,5 @@ extern ia64_mv_irq_init_t dig_irq_init;
13 */ 12 */
14#define platform_name "dig" 13#define platform_name "dig"
15#define platform_setup dig_setup 14#define platform_setup dig_setup
16#define platform_irq_init dig_irq_init
17 15
18#endif /* _ASM_IA64_MACHVEC_DIG_h */ 16#endif /* _ASM_IA64_MACHVEC_DIG_h */
diff --git a/include/asm-ia64/machvec_sn2.h b/include/asm-ia64/machvec_sn2.h
index 03d00faf03b5..da1d43755afe 100644
--- a/include/asm-ia64/machvec_sn2.h
+++ b/include/asm-ia64/machvec_sn2.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2002-2003, 2006 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2002-2003,2006 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License 5 * under the terms of version 2 of the GNU General Public License
@@ -66,6 +66,7 @@ extern ia64_mv_dma_sync_single_for_device sn_dma_sync_single_for_device;
66extern ia64_mv_dma_sync_sg_for_device sn_dma_sync_sg_for_device; 66extern ia64_mv_dma_sync_sg_for_device sn_dma_sync_sg_for_device;
67extern ia64_mv_dma_mapping_error sn_dma_mapping_error; 67extern ia64_mv_dma_mapping_error sn_dma_mapping_error;
68extern ia64_mv_dma_supported sn_dma_supported; 68extern ia64_mv_dma_supported sn_dma_supported;
69extern ia64_mv_migrate_t sn_migrate;
69 70
70/* 71/*
71 * This stuff has dual use! 72 * This stuff has dual use!
@@ -115,6 +116,7 @@ extern ia64_mv_dma_supported sn_dma_supported;
115#define platform_dma_sync_sg_for_device sn_dma_sync_sg_for_device 116#define platform_dma_sync_sg_for_device sn_dma_sync_sg_for_device
116#define platform_dma_mapping_error sn_dma_mapping_error 117#define platform_dma_mapping_error sn_dma_mapping_error
117#define platform_dma_supported sn_dma_supported 118#define platform_dma_supported sn_dma_supported
119#define platform_migrate sn_migrate
118 120
119#include <asm/sn/io.h> 121#include <asm/sn/io.h>
120 122
diff --git a/include/asm-ia64/mca.h b/include/asm-ia64/mca.h
index c7d9c9ed38ba..bfbbb8da79c7 100644
--- a/include/asm-ia64/mca.h
+++ b/include/asm-ia64/mca.h
@@ -131,6 +131,8 @@ struct ia64_mca_cpu {
131/* Array of physical addresses of each CPU's MCA area. */ 131/* Array of physical addresses of each CPU's MCA area. */
132extern unsigned long __per_cpu_mca[NR_CPUS]; 132extern unsigned long __per_cpu_mca[NR_CPUS];
133 133
134extern int cpe_vector;
135extern int ia64_cpe_irq;
134extern void ia64_mca_init(void); 136extern void ia64_mca_init(void);
135extern void ia64_mca_cpu_init(void *); 137extern void ia64_mca_cpu_init(void *);
136extern void ia64_os_mca_dispatch(void); 138extern void ia64_os_mca_dispatch(void);
diff --git a/include/asm-ia64/mutex.h b/include/asm-ia64/mutex.h
index 458c1f7fbc18..5a3224f6af38 100644
--- a/include/asm-ia64/mutex.h
+++ b/include/asm-ia64/mutex.h
@@ -1,9 +1,92 @@
1/* 1/*
2 * Pull in the generic implementation for the mutex fastpath. 2 * ia64 implementation of the mutex fastpath.
3 * 3 *
4 * TODO: implement optimized primitives instead, or leave the generic 4 * Copyright (C) 2006 Ken Chen <kenneth.w.chen@intel.com>
5 * implementation in place, or pick the atomic_xchg() based generic 5 *
6 * implementation. (see asm-generic/mutex-xchg.h for details) 6 */
7
8#ifndef _ASM_MUTEX_H
9#define _ASM_MUTEX_H
10
11/**
12 * __mutex_fastpath_lock - try to take the lock by moving the count
13 * from 1 to a 0 value
14 * @count: pointer of type atomic_t
15 * @fail_fn: function to call if the original value was not 1
16 *
17 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
18 * it wasn't 1 originally. This function MUST leave the value lower than
19 * 1 even when the "1" assertion wasn't true.
20 */
21static inline void
22__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
23{
24 if (unlikely(ia64_fetchadd4_acq(count, -1) != 1))
25 fail_fn(count);
26}
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(ia64_fetchadd4_acq(count, -1) != 1))
42 return fail_fn(count);
43 return 0;
44}
45
46/**
47 * __mutex_fastpath_unlock - try to promote the count from 0 to 1
48 * @count: pointer of type atomic_t
49 * @fail_fn: function to call if the original value was not 0
50 *
51 * Try to promote the count from 0 to 1. If it wasn't 0, call <fail_fn>.
52 * In the failure case, this function is allowed to either set the value to
53 * 1, or to set it to a value lower than 1.
54 *
55 * If the implementation sets it to a value of lower than 1, then the
56 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
57 * to return 0 otherwise.
58 */
59static inline void
60__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
61{
62 int ret = ia64_fetchadd4_rel(count, 1);
63 if (unlikely(ret < 0))
64 fail_fn(count);
65}
66
67#define __mutex_slowpath_needs_to_unlock() 1
68
69/**
70 * __mutex_fastpath_trylock - try to acquire the mutex, without waiting
71 *
72 * @count: pointer of type atomic_t
73 * @fail_fn: fallback function
74 *
75 * Change the count from 1 to a value lower than 1, and return 0 (failure)
76 * if it wasn't 1 originally, or return 1 (success) otherwise. This function
77 * MUST leave the value lower than 1 even when the "1" assertion wasn't true.
78 * Additionally, if the value was < 0 originally, this function must not leave
79 * it to 0 on failure.
80 *
81 * If the architecture has no effective trylock variant, it should call the
82 * <fail_fn> spinlock-based trylock variant unconditionally.
7 */ 83 */
84static inline int
85__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
86{
87 if (likely(cmpxchg_acq(count, 1, 0)) == 1)
88 return 1;
89 return 0;
90}
8 91
9#include <asm-generic/mutex-dec.h> 92#endif
diff --git a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
index 3ae128fe0823..dae6aeb7b119 100644
--- a/include/asm-ia64/numa.h
+++ b/include/asm-ia64/numa.h
@@ -23,7 +23,7 @@
23 23
24#include <asm/mmzone.h> 24#include <asm/mmzone.h>
25 25
26extern u8 cpu_to_node_map[NR_CPUS] __cacheline_aligned; 26extern u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
27extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned; 27extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
28 28
29/* Stuff below this line could be architecture independent */ 29/* Stuff below this line could be architecture independent */
diff --git a/include/asm-ia64/numnodes.h b/include/asm-ia64/numnodes.h
index 21cff4da5485..e9d356f549d9 100644
--- a/include/asm-ia64/numnodes.h
+++ b/include/asm-ia64/numnodes.h
@@ -3,13 +3,18 @@
3 3
4#ifdef CONFIG_IA64_DIG 4#ifdef CONFIG_IA64_DIG
5/* Max 8 Nodes */ 5/* Max 8 Nodes */
6#define NODES_SHIFT 3 6# define NODES_SHIFT 3
7#elif defined(CONFIG_IA64_HP_ZX1) || defined(CONFIG_IA64_HP_ZX1_SWIOTLB) 7#elif defined(CONFIG_IA64_HP_ZX1) || defined(CONFIG_IA64_HP_ZX1_SWIOTLB)
8/* Max 32 Nodes */ 8/* Max 32 Nodes */
9#define NODES_SHIFT 5 9# define NODES_SHIFT 5
10#elif defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC) 10#elif defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC)
11/* Max 256 Nodes */ 11# if CONFIG_IA64_NR_NODES == 256
12#define NODES_SHIFT 8 12# define NODES_SHIFT 8
13# elif CONFIG_IA64_NR_NODES <= 512
14# define NODES_SHIFT 9
15# elif CONFIG_IA64_NR_NODES <= 1024
16# define NODES_SHIFT 10
17# endif
13#endif 18#endif
14 19
15#endif /* _ASM_MAX_NUMNODES_H */ 20#endif /* _ASM_MAX_NUMNODES_H */
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index 5e6362a786b7..2087825eefa4 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -57,6 +57,8 @@
57 57
58# define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 58# define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
59# define ARCH_HAS_HUGEPAGE_ONLY_RANGE 59# define ARCH_HAS_HUGEPAGE_ONLY_RANGE
60# define ARCH_HAS_PREPARE_HUGEPAGE_RANGE
61# define ARCH_HAS_HUGETLB_FREE_PGD_RANGE
60#endif /* CONFIG_HUGETLB_PAGE */ 62#endif /* CONFIG_HUGETLB_PAGE */
61 63
62#ifdef __ASSEMBLY__ 64#ifdef __ASSEMBLY__
@@ -104,17 +106,25 @@ extern int ia64_pfn_valid (unsigned long pfn);
104# define ia64_pfn_valid(pfn) 1 106# define ia64_pfn_valid(pfn) 1
105#endif 107#endif
106 108
109#ifdef CONFIG_VIRTUAL_MEM_MAP
110extern struct page *vmem_map;
111#ifdef CONFIG_DISCONTIGMEM
112# define page_to_pfn(page) ((unsigned long) (page - vmem_map))
113# define pfn_to_page(pfn) (vmem_map + (pfn))
114#endif
115#endif
116
117#if defined(CONFIG_FLATMEM) || defined(CONFIG_SPARSEMEM)
118/* FLATMEM always configures mem_map (mem_map = vmem_map if necessary) */
119#include <asm-generic/memory_model.h>
120#endif
121
107#ifdef CONFIG_FLATMEM 122#ifdef CONFIG_FLATMEM
108# define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn)) 123# define pfn_valid(pfn) (((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
109# define page_to_pfn(page) ((unsigned long) (page - mem_map))
110# define pfn_to_page(pfn) (mem_map + (pfn))
111#elif defined(CONFIG_DISCONTIGMEM) 124#elif defined(CONFIG_DISCONTIGMEM)
112extern struct page *vmem_map;
113extern unsigned long min_low_pfn; 125extern unsigned long min_low_pfn;
114extern unsigned long max_low_pfn; 126extern unsigned long max_low_pfn;
115# define pfn_valid(pfn) (((pfn) >= min_low_pfn) && ((pfn) < max_low_pfn) && ia64_pfn_valid(pfn)) 127# define pfn_valid(pfn) (((pfn) >= min_low_pfn) && ((pfn) < max_low_pfn) && ia64_pfn_valid(pfn))
116# define page_to_pfn(page) ((unsigned long) (page - vmem_map))
117# define pfn_to_page(pfn) (vmem_map + (pfn))
118#endif 128#endif
119 129
120#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 130#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
@@ -147,7 +157,7 @@ typedef union ia64_va {
147 | (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT))) 157 | (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT)))
148# define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 158# define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
149# define is_hugepage_only_range(mm, addr, len) \ 159# define is_hugepage_only_range(mm, addr, len) \
150 (REGION_NUMBER(addr) == RGN_HPAGE && \ 160 (REGION_NUMBER(addr) == RGN_HPAGE || \
151 REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE) 161 REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE)
152extern unsigned int hpage_shift; 162extern unsigned int hpage_shift;
153#endif 163#endif
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index 7708ec669a33..37e52a2836b0 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -68,6 +68,7 @@
68#define PAL_SHUTDOWN 40 /* enter processor shutdown state */ 68#define PAL_SHUTDOWN 40 /* enter processor shutdown state */
69#define PAL_PREFETCH_VISIBILITY 41 /* Make Processor Prefetches Visible */ 69#define PAL_PREFETCH_VISIBILITY 41 /* Make Processor Prefetches Visible */
70#define PAL_LOGICAL_TO_PHYSICAL 42 /* returns information on logical to physical processor mapping */ 70#define PAL_LOGICAL_TO_PHYSICAL 42 /* returns information on logical to physical processor mapping */
71#define PAL_CACHE_SHARED_INFO 43 /* returns information on caches shared by logical processor */
71 72
72#define PAL_COPY_PAL 256 /* relocate PAL procedures and PAL PMI */ 73#define PAL_COPY_PAL 256 /* relocate PAL procedures and PAL PMI */
73#define PAL_HALT_INFO 257 /* return the low power capabilities of processor */ 74#define PAL_HALT_INFO 257 /* return the low power capabilities of processor */
@@ -130,7 +131,7 @@ typedef u64 pal_cache_line_state_t;
130#define PAL_CACHE_LINE_STATE_MODIFIED 3 /* Modified */ 131#define PAL_CACHE_LINE_STATE_MODIFIED 3 /* Modified */
131 132
132typedef struct pal_freq_ratio { 133typedef struct pal_freq_ratio {
133 u64 den : 32, num : 32; /* numerator & denominator */ 134 u32 den, num; /* numerator & denominator */
134} itc_ratio, proc_ratio; 135} itc_ratio, proc_ratio;
135 136
136typedef union pal_cache_config_info_1_s { 137typedef union pal_cache_config_info_1_s {
@@ -151,10 +152,10 @@ typedef union pal_cache_config_info_1_s {
151 152
152typedef union pal_cache_config_info_2_s { 153typedef union pal_cache_config_info_2_s {
153 struct { 154 struct {
154 u64 cache_size : 32, /*cache size in bytes*/ 155 u32 cache_size; /*cache size in bytes*/
155 156
156 157
157 alias_boundary : 8, /* 39-32 aliased addr 158 u32 alias_boundary : 8, /* 39-32 aliased addr
158 * separation for max 159 * separation for max
159 * performance. 160 * performance.
160 */ 161 */
@@ -1640,14 +1641,40 @@ ia64_pal_logical_to_phys(u64 proc_number, pal_logical_to_physical_t *mapping)
1640 1641
1641 if (iprv.status == PAL_STATUS_SUCCESS) 1642 if (iprv.status == PAL_STATUS_SUCCESS)
1642 { 1643 {
1643 if (proc_number == 0) 1644 mapping->overview.overview_data = iprv.v0;
1644 mapping->overview.overview_data = iprv.v0;
1645 mapping->ppli1.ppli1_data = iprv.v1; 1645 mapping->ppli1.ppli1_data = iprv.v1;
1646 mapping->ppli2.ppli2_data = iprv.v2; 1646 mapping->ppli2.ppli2_data = iprv.v2;
1647 } 1647 }
1648 1648
1649 return iprv.status; 1649 return iprv.status;
1650} 1650}
1651
1652typedef struct pal_cache_shared_info_s
1653{
1654 u64 num_shared;
1655 pal_proc_n_log_info1_t ppli1;
1656 pal_proc_n_log_info2_t ppli2;
1657} pal_cache_shared_info_t;
1658
1659/* Get information on logical to physical processor mappings. */
1660static inline s64
1661ia64_pal_cache_shared_info(u64 level,
1662 u64 type,
1663 u64 proc_number,
1664 pal_cache_shared_info_t *info)
1665{
1666 struct ia64_pal_retval iprv;
1667
1668 PAL_CALL(iprv, PAL_CACHE_SHARED_INFO, level, type, proc_number);
1669
1670 if (iprv.status == PAL_STATUS_SUCCESS) {
1671 info->num_shared = iprv.v0;
1672 info->ppli1.ppli1_data = iprv.v1;
1673 info->ppli2.ppli2_data = iprv.v2;
1674 }
1675
1676 return iprv.status;
1677}
1651#endif /* __ASSEMBLY__ */ 1678#endif /* __ASSEMBLY__ */
1652 1679
1653#endif /* _ASM_IA64_PAL_H */ 1680#endif /* _ASM_IA64_PAL_H */
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index e2560c58384b..c0f8144f2349 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -314,7 +314,7 @@ ia64_phys_addr_valid (unsigned long addr)
314#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_A)) 314#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_A))
315#define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D)) 315#define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D))
316#define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_D)) 316#define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_D))
317#define pte_mkhuge(pte) (__pte(pte_val(pte) | _PAGE_P)) 317#define pte_mkhuge(pte) (__pte(pte_val(pte)))
318 318
319/* 319/*
320 * Macro to a page protection value as "uncacheable". Note that "protection" is really a 320 * Macro to a page protection value as "uncacheable". Note that "protection" is really a
@@ -505,9 +505,6 @@ extern struct page *zero_page_memmap_ptr;
505#define HUGETLB_PGDIR_SHIFT (HPAGE_SHIFT + 2*(PAGE_SHIFT-3)) 505#define HUGETLB_PGDIR_SHIFT (HPAGE_SHIFT + 2*(PAGE_SHIFT-3))
506#define HUGETLB_PGDIR_SIZE (__IA64_UL(1) << HUGETLB_PGDIR_SHIFT) 506#define HUGETLB_PGDIR_SIZE (__IA64_UL(1) << HUGETLB_PGDIR_SHIFT)
507#define HUGETLB_PGDIR_MASK (~(HUGETLB_PGDIR_SIZE-1)) 507#define HUGETLB_PGDIR_MASK (~(HUGETLB_PGDIR_SIZE-1))
508struct mmu_gather;
509void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
510 unsigned long end, unsigned long floor, unsigned long ceiling);
511#endif 508#endif
512 509
513/* 510/*
diff --git a/include/asm-ia64/poll.h b/include/asm-ia64/poll.h
index 160258a0528d..bcaf9f140242 100644
--- a/include/asm-ia64/poll.h
+++ b/include/asm-ia64/poll.h
@@ -21,6 +21,7 @@
21#define POLLWRBAND 0x0200 21#define POLLWRBAND 0x0200
22#define POLLMSG 0x0400 22#define POLLMSG 0x0400
23#define POLLREMOVE 0x1000 23#define POLLREMOVE 0x1000
24#define POLLRDHUP 0x2000
24 25
25struct pollfd { 26struct pollfd {
26 int fd; 27 int fd;
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index 23c8e1be1911..b3bd58e80690 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -50,7 +50,8 @@
50#define IA64_THREAD_PM_VALID (__IA64_UL(1) << 2) /* performance registers valid? */ 50#define IA64_THREAD_PM_VALID (__IA64_UL(1) << 2) /* performance registers valid? */
51#define IA64_THREAD_UAC_NOPRINT (__IA64_UL(1) << 3) /* don't log unaligned accesses */ 51#define IA64_THREAD_UAC_NOPRINT (__IA64_UL(1) << 3) /* don't log unaligned accesses */
52#define IA64_THREAD_UAC_SIGBUS (__IA64_UL(1) << 4) /* generate SIGBUS on unaligned acc. */ 52#define IA64_THREAD_UAC_SIGBUS (__IA64_UL(1) << 4) /* generate SIGBUS on unaligned acc. */
53 /* bit 5 is currently unused */ 53#define IA64_THREAD_MIGRATION (__IA64_UL(1) << 5) /* require migration
54 sync at ctx sw */
54#define IA64_THREAD_FPEMU_NOPRINT (__IA64_UL(1) << 6) /* don't log any fpswa faults */ 55#define IA64_THREAD_FPEMU_NOPRINT (__IA64_UL(1) << 6) /* don't log any fpswa faults */
55#define IA64_THREAD_FPEMU_SIGFPE (__IA64_UL(1) << 7) /* send a SIGFPE for fpswa faults */ 56#define IA64_THREAD_FPEMU_SIGFPE (__IA64_UL(1) << 7) /* send a SIGFPE for fpswa faults */
56 57
@@ -180,7 +181,6 @@ DECLARE_PER_CPU(struct cpuinfo_ia64, cpu_info);
180#define local_cpu_data (&__ia64_per_cpu_var(cpu_info)) 181#define local_cpu_data (&__ia64_per_cpu_var(cpu_info))
181#define cpu_data(cpu) (&per_cpu(cpu_info, cpu)) 182#define cpu_data(cpu) (&per_cpu(cpu_info, cpu))
182 183
183extern void identify_cpu (struct cpuinfo_ia64 *);
184extern void print_cpu_info (struct cpuinfo_ia64 *); 184extern void print_cpu_info (struct cpuinfo_ia64 *);
185 185
186typedef struct { 186typedef struct {
diff --git a/include/asm-ia64/signal.h b/include/asm-ia64/signal.h
index 608168d713d3..5e328ed5d01d 100644
--- a/include/asm-ia64/signal.h
+++ b/include/asm-ia64/signal.h
@@ -158,8 +158,6 @@ struct k_sigaction {
158 158
159#define ptrace_signal_deliver(regs, cookie) do { } while (0) 159#define ptrace_signal_deliver(regs, cookie) do { } while (0)
160 160
161void set_sigdelayed(pid_t pid, int signo, int code, void __user *addr);
162
163#endif /* __KERNEL__ */ 161#endif /* __KERNEL__ */
164 162
165# endif /* !__ASSEMBLY__ */ 163# endif /* !__ASSEMBLY__ */
diff --git a/include/asm-ia64/sn/addrs.h b/include/asm-ia64/sn/addrs.h
index 2c32e4b77b54..1d9efe541662 100644
--- a/include/asm-ia64/sn/addrs.h
+++ b/include/asm-ia64/sn/addrs.h
@@ -283,5 +283,13 @@
283#define REMOTE_HUB_L(n, a) HUB_L(REMOTE_HUB_ADDR((n), (a))) 283#define REMOTE_HUB_L(n, a) HUB_L(REMOTE_HUB_ADDR((n), (a)))
284#define REMOTE_HUB_S(n, a, d) HUB_S(REMOTE_HUB_ADDR((n), (a)), (d)) 284#define REMOTE_HUB_S(n, a, d) HUB_S(REMOTE_HUB_ADDR((n), (a)), (d))
285 285
286/*
287 * Coretalk address breakdown
288 */
289#define CTALK_NASID_SHFT 40
290#define CTALK_NASID_MASK (0x3FFFULL << CTALK_NASID_SHFT)
291#define CTALK_CID_SHFT 38
292#define CTALK_CID_MASK (0x3ULL << CTALK_CID_SHFT)
293#define CTALK_NODE_OFFSET 0x3FFFFFFFFF
286 294
287#endif /* _ASM_IA64_SN_ADDRS_H */ 295#endif /* _ASM_IA64_SN_ADDRS_H */
diff --git a/include/asm-ia64/sn/l1.h b/include/asm-ia64/sn/l1.h
index e3b819110d47..344bf44bb356 100644
--- a/include/asm-ia64/sn/l1.h
+++ b/include/asm-ia64/sn/l1.h
@@ -34,6 +34,8 @@
34#define L1_BRICKTYPE_IA 0x6b /* k */ 34#define L1_BRICKTYPE_IA 0x6b /* k */
35#define L1_BRICKTYPE_ATHENA 0x2b /* + */ 35#define L1_BRICKTYPE_ATHENA 0x2b /* + */
36#define L1_BRICKTYPE_DAYTONA 0x7a /* z */ 36#define L1_BRICKTYPE_DAYTONA 0x7a /* z */
37#define L1_BRICKTYPE_1932 0x2c /* . */
38#define L1_BRICKTYPE_191010 0x2e /* , */
37 39
38/* board type response codes */ 40/* board type response codes */
39#define L1_BOARDTYPE_IP69 0x0100 /* CA */ 41#define L1_BOARDTYPE_IP69 0x0100 /* CA */
@@ -46,5 +48,4 @@
46#define L1_BOARDTYPE_DAYTONA 0x0800 /* AD */ 48#define L1_BOARDTYPE_DAYTONA 0x0800 /* AD */
47#define L1_BOARDTYPE_INVAL (-1) /* invalid brick type */ 49#define L1_BOARDTYPE_INVAL (-1) /* invalid brick type */
48 50
49
50#endif /* _ASM_IA64_SN_L1_H */ 51#endif /* _ASM_IA64_SN_L1_H */
diff --git a/include/asm-ia64/sn/pcibr_provider.h b/include/asm-ia64/sn/pcibr_provider.h
index a601d3af39b6..51260ab70d91 100644
--- a/include/asm-ia64/sn/pcibr_provider.h
+++ b/include/asm-ia64/sn/pcibr_provider.h
@@ -144,4 +144,5 @@ extern int sal_pcibr_slot_enable(struct pcibus_info *soft, int device,
144 void *resp); 144 void *resp);
145extern int sal_pcibr_slot_disable(struct pcibus_info *soft, int device, 145extern int sal_pcibr_slot_disable(struct pcibus_info *soft, int device,
146 int action, void *resp); 146 int action, void *resp);
147extern u16 sn_ioboard_to_pci_bus(struct pci_bus *pci_bus);
147#endif 148#endif
diff --git a/include/asm-ia64/sn/pcidev.h b/include/asm-ia64/sn/pcidev.h
index 38cdffbc4c7b..eac3561574be 100644
--- a/include/asm-ia64/sn/pcidev.h
+++ b/include/asm-ia64/sn/pcidev.h
@@ -76,6 +76,7 @@ extern void sn_pci_controller_fixup(int segment, int busnum,
76 struct pci_bus *bus); 76 struct pci_bus *bus);
77extern void sn_bus_store_sysdata(struct pci_dev *dev); 77extern void sn_bus_store_sysdata(struct pci_dev *dev);
78extern void sn_bus_free_sysdata(void); 78extern void sn_bus_free_sysdata(void);
79extern void sn_generate_path(struct pci_bus *pci_bus, char *address);
79extern void sn_pci_fixup_slot(struct pci_dev *dev); 80extern void sn_pci_fixup_slot(struct pci_dev *dev);
80extern void sn_pci_unfixup_slot(struct pci_dev *dev); 81extern void sn_pci_unfixup_slot(struct pci_dev *dev);
81extern void sn_irq_lh_init(void); 82extern void sn_irq_lh_init(void);
diff --git a/include/asm-ia64/sn/rw_mmr.h b/include/asm-ia64/sn/rw_mmr.h
index f40fd1a5510d..2d78f4c5a45e 100644
--- a/include/asm-ia64/sn/rw_mmr.h
+++ b/include/asm-ia64/sn/rw_mmr.h
@@ -3,15 +3,14 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2002-2004 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (C) 2002-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8#ifndef _ASM_IA64_SN_RW_MMR_H 8#ifndef _ASM_IA64_SN_RW_MMR_H
9#define _ASM_IA64_SN_RW_MMR_H 9#define _ASM_IA64_SN_RW_MMR_H
10 10
11 11
12/* 12/*
13 * This file contains macros used to access MMR registers via 13 * This file that access MMRs via uncached physical addresses.
14 * uncached physical addresses.
15 * pio_phys_read_mmr - read an MMR 14 * pio_phys_read_mmr - read an MMR
16 * pio_phys_write_mmr - write an MMR 15 * pio_phys_write_mmr - write an MMR
17 * pio_atomic_phys_write_mmrs - atomically write 1 or 2 MMRs with psr.ic=0 16 * pio_atomic_phys_write_mmrs - atomically write 1 or 2 MMRs with psr.ic=0
@@ -22,53 +21,8 @@
22 */ 21 */
23 22
24 23
25extern inline long 24extern long pio_phys_read_mmr(volatile long *mmr);
26pio_phys_read_mmr(volatile long *mmr) 25extern void pio_phys_write_mmr(volatile long *mmr, long val);
27{ 26extern void pio_atomic_phys_write_mmrs(volatile long *mmr1, long val1, volatile long *mmr2, long val2);
28 long val;
29 asm volatile
30 ("mov r2=psr;;"
31 "rsm psr.i | psr.dt;;"
32 "srlz.i;;"
33 "ld8.acq %0=[%1];;"
34 "mov psr.l=r2;;"
35 "srlz.i;;"
36 : "=r"(val)
37 : "r"(mmr)
38 : "r2");
39 return val;
40}
41
42
43
44extern inline void
45pio_phys_write_mmr(volatile long *mmr, long val)
46{
47 asm volatile
48 ("mov r2=psr;;"
49 "rsm psr.i | psr.dt;;"
50 "srlz.i;;"
51 "st8.rel [%0]=%1;;"
52 "mov psr.l=r2;;"
53 "srlz.i;;"
54 :: "r"(mmr), "r"(val)
55 : "r2", "memory");
56}
57
58extern inline void
59pio_atomic_phys_write_mmrs(volatile long *mmr1, long val1, volatile long *mmr2, long val2)
60{
61 asm volatile
62 ("mov r2=psr;;"
63 "rsm psr.i | psr.dt | psr.ic;;"
64 "cmp.ne p9,p0=%2,r0;"
65 "srlz.i;;"
66 "st8.rel [%0]=%1;"
67 "(p9) st8.rel [%2]=%3;;"
68 "mov psr.l=r2;;"
69 "srlz.i;;"
70 :: "r"(mmr1), "r"(val1), "r"(mmr2), "r"(val2)
71 : "p9", "r2", "memory");
72}
73 27
74#endif /* _ASM_IA64_SN_RW_MMR_H */ 28#endif /* _ASM_IA64_SN_RW_MMR_H */
diff --git a/include/asm-ia64/sn/sn_feature_sets.h b/include/asm-ia64/sn/sn_feature_sets.h
index ff33e3bd3f8e..30dcfa442e53 100644
--- a/include/asm-ia64/sn/sn_feature_sets.h
+++ b/include/asm-ia64/sn/sn_feature_sets.h
@@ -30,8 +30,7 @@ extern int sn_prom_feature_available(int id);
30 30
31#define PRF_PAL_CACHE_FLUSH_SAFE 0 31#define PRF_PAL_CACHE_FLUSH_SAFE 0
32#define PRF_DEVICE_FLUSH_LIST 1 32#define PRF_DEVICE_FLUSH_LIST 1
33 33#define PRF_HOTPLUG_SUPPORT 2
34
35 34
36/* --------------------- OS Features -------------------------------*/ 35/* --------------------- OS Features -------------------------------*/
37 36
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index e77f0c9b7d3d..bf4cc867a698 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -159,7 +159,7 @@
159static inline u32 159static inline u32
160sn_sal_rev(void) 160sn_sal_rev(void)
161{ 161{
162 struct ia64_sal_systab *systab = efi.sal_systab; 162 struct ia64_sal_systab *systab = __va(efi.sal_systab);
163 163
164 return (u32)(systab->sal_b_rev_major << 8 | systab->sal_b_rev_minor); 164 return (u32)(systab->sal_b_rev_major << 8 | systab->sal_b_rev_minor);
165} 165}
@@ -907,18 +907,22 @@ ia64_sn_sysctl_tio_clock_reset(nasid_t nasid)
907/* 907/*
908 * Get the associated ioboard type for a given nasid. 908 * Get the associated ioboard type for a given nasid.
909 */ 909 */
910static inline int 910static inline s64
911ia64_sn_sysctl_ioboard_get(nasid_t nasid) 911ia64_sn_sysctl_ioboard_get(nasid_t nasid, u16 *ioboard)
912{ 912{
913 struct ia64_sal_retval rv; 913 struct ia64_sal_retval isrv;
914 SAL_CALL_REENTRANT(rv, SN_SAL_SYSCTL_OP, SAL_SYSCTL_OP_IOBOARD, 914 SAL_CALL_REENTRANT(isrv, SN_SAL_SYSCTL_OP, SAL_SYSCTL_OP_IOBOARD,
915 nasid, 0, 0, 0, 0, 0); 915 nasid, 0, 0, 0, 0, 0);
916 if (rv.v0 != 0) 916 if (isrv.v0 != 0) {
917 return (int)rv.v0; 917 *ioboard = isrv.v0;
918 if (rv.v1 != 0) 918 return isrv.status;
919 return (int)rv.v1; 919 }
920 920 if (isrv.v1 != 0) {
921 return 0; 921 *ioboard = isrv.v1;
922 return isrv.status;
923 }
924
925 return isrv.status;
922} 926}
923 927
924/** 928/**
@@ -1037,7 +1041,7 @@ ia64_sn_get_sn_info(int fc, u8 *shubtype, u16 *nasid_bitmask, u8 *nasid_shift,
1037 1041
1038/***** BEGIN HACK - temp til old proms no longer supported ********/ 1042/***** BEGIN HACK - temp til old proms no longer supported ********/
1039 if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) { 1043 if (ret_stuff.status == SALRET_NOT_IMPLEMENTED) {
1040 int nasid = get_sapicid() & 0xfff;; 1044 int nasid = get_sapicid() & 0xfff;
1041#define SH_SHUB_ID_NODES_PER_BIT_MASK 0x001f000000000000UL 1045#define SH_SHUB_ID_NODES_PER_BIT_MASK 0x001f000000000000UL
1042#define SH_SHUB_ID_NODES_PER_BIT_SHFT 48 1046#define SH_SHUB_ID_NODES_PER_BIT_SHFT 48
1043 if (shubtype) *shubtype = 0; 1047 if (shubtype) *shubtype = 0;
diff --git a/include/asm-ia64/sn/tioce.h b/include/asm-ia64/sn/tioce.h
index d4c990712eac..893468e1b41b 100644
--- a/include/asm-ia64/sn/tioce.h
+++ b/include/asm-ia64/sn/tioce.h
@@ -11,7 +11,7 @@
11 11
12/* CE ASIC part & mfgr information */ 12/* CE ASIC part & mfgr information */
13#define TIOCE_PART_NUM 0xCE00 13#define TIOCE_PART_NUM 0xCE00
14#define TIOCE_MFGR_NUM 0x36 14#define TIOCE_SRC_ID 0x01
15#define TIOCE_REV_A 0x1 15#define TIOCE_REV_A 0x1
16 16
17/* CE Virtual PPB Vendor/Device IDs */ 17/* CE Virtual PPB Vendor/Device IDs */
@@ -20,7 +20,7 @@
20 20
21/* CE Host Bridge Vendor/Device IDs */ 21/* CE Host Bridge Vendor/Device IDs */
22#define CE_HOST_BRIDGE_VENDOR_ID 0x10a9 22#define CE_HOST_BRIDGE_VENDOR_ID 0x10a9
23#define CE_HOST_BRIDGE_DEVICE_ID 0x4003 23#define CE_HOST_BRIDGE_DEVICE_ID 0x4001
24 24
25 25
26#define TIOCE_NUM_M40_ATES 4096 26#define TIOCE_NUM_M40_ATES 4096
@@ -463,6 +463,25 @@ typedef volatile struct tioce {
463 u64 ce_end_of_struct; /* 0x044400 */ 463 u64 ce_end_of_struct; /* 0x044400 */
464} tioce_t; 464} tioce_t;
465 465
466/* ce_lsiX_gb_cfg1 register bit masks & shifts */
467#define CE_LSI_GB_CFG1_RXL0S_THS_SHFT 0
468#define CE_LSI_GB_CFG1_RXL0S_THS_MASK (0xffULL << 0)
469#define CE_LSI_GB_CFG1_RXL0S_SMP_SHFT 8
470#define CE_LSI_GB_CFG1_RXL0S_SMP_MASK (0xfULL << 8);
471#define CE_LSI_GB_CFG1_RXL0S_ADJ_SHFT 12
472#define CE_LSI_GB_CFG1_RXL0S_ADJ_MASK (0x7ULL << 12)
473#define CE_LSI_GB_CFG1_RXL0S_FLT_SHFT 15
474#define CE_LSI_GB_CFG1_RXL0S_FLT_MASK (0x1ULL << 15)
475#define CE_LSI_GB_CFG1_LPBK_SEL_SHFT 16
476#define CE_LSI_GB_CFG1_LPBK_SEL_MASK (0x3ULL << 16)
477#define CE_LSI_GB_CFG1_LPBK_EN_SHFT 18
478#define CE_LSI_GB_CFG1_LPBK_EN_MASK (0x1ULL << 18)
479#define CE_LSI_GB_CFG1_RVRS_LB_SHFT 19
480#define CE_LSI_GB_CFG1_RVRS_LB_MASK (0x1ULL << 19)
481#define CE_LSI_GB_CFG1_RVRS_CLK_SHFT 20
482#define CE_LSI_GB_CFG1_RVRS_CLK_MASK (0x3ULL << 20)
483#define CE_LSI_GB_CFG1_SLF_TS_SHFT 24
484#define CE_LSI_GB_CFG1_SLF_TS_MASK (0xfULL << 24)
466 485
467/* ce_adm_int_mask/ce_adm_int_status register bit defines */ 486/* ce_adm_int_mask/ce_adm_int_status register bit defines */
468#define CE_ADM_INT_CE_ERROR_SHFT 0 487#define CE_ADM_INT_CE_ERROR_SHFT 0
@@ -592,6 +611,11 @@ typedef volatile struct tioce {
592#define CE_URE_RD_MRG_ENABLE (0x1ULL << 0) 611#define CE_URE_RD_MRG_ENABLE (0x1ULL << 0)
593#define CE_URE_WRT_MRG_ENABLE1 (0x1ULL << 4) 612#define CE_URE_WRT_MRG_ENABLE1 (0x1ULL << 4)
594#define CE_URE_WRT_MRG_ENABLE2 (0x1ULL << 5) 613#define CE_URE_WRT_MRG_ENABLE2 (0x1ULL << 5)
614#define CE_URE_WRT_MRG_TIMER_SHFT 12
615#define CE_URE_WRT_MRG_TIMER_MASK (0x7FFULL << CE_URE_WRT_MRG_TIMER_SHFT)
616#define CE_URE_WRT_MRG_TIMER(x) (((u64)(x) << \
617 CE_URE_WRT_MRG_TIMER_SHFT) & \
618 CE_URE_WRT_MRG_TIMER_MASK)
595#define CE_URE_RSPQ_BYPASS_DISABLE (0x1ULL << 24) 619#define CE_URE_RSPQ_BYPASS_DISABLE (0x1ULL << 24)
596#define CE_URE_UPS_DAT1_PAR_DISABLE (0x1ULL << 32) 620#define CE_URE_UPS_DAT1_PAR_DISABLE (0x1ULL << 32)
597#define CE_URE_UPS_HDR1_PAR_DISABLE (0x1ULL << 33) 621#define CE_URE_UPS_HDR1_PAR_DISABLE (0x1ULL << 33)
@@ -653,8 +677,12 @@ typedef volatile struct tioce {
653#define CE_URE_SI (0x1ULL << 0) 677#define CE_URE_SI (0x1ULL << 0)
654#define CE_URE_ELAL_SHFT 4 678#define CE_URE_ELAL_SHFT 4
655#define CE_URE_ELAL_MASK (0x7ULL << CE_URE_ELAL_SHFT) 679#define CE_URE_ELAL_MASK (0x7ULL << CE_URE_ELAL_SHFT)
680#define CE_URE_ELAL_SET(n) (((u64)(n) << CE_URE_ELAL_SHFT) & \
681 CE_URE_ELAL_MASK)
656#define CE_URE_ELAL1_SHFT 8 682#define CE_URE_ELAL1_SHFT 8
657#define CE_URE_ELAL1_MASK (0x7ULL << CE_URE_ELAL1_SHFT) 683#define CE_URE_ELAL1_MASK (0x7ULL << CE_URE_ELAL1_SHFT)
684#define CE_URE_ELAL1_SET(n) (((u64)(n) << CE_URE_ELAL1_SHFT) & \
685 CE_URE_ELAL1_MASK)
658#define CE_URE_SCC (0x1ULL << 12) 686#define CE_URE_SCC (0x1ULL << 12)
659#define CE_URE_PN1_SHFT 16 687#define CE_URE_PN1_SHFT 16
660#define CE_URE_PN1_MASK (0xFFULL << CE_URE_PN1_SHFT) 688#define CE_URE_PN1_MASK (0xFFULL << CE_URE_PN1_SHFT)
@@ -675,8 +703,12 @@ typedef volatile struct tioce {
675#define CE_URE_HPC (0x1ULL << 6) 703#define CE_URE_HPC (0x1ULL << 6)
676#define CE_URE_SPLV_SHFT 7 704#define CE_URE_SPLV_SHFT 7
677#define CE_URE_SPLV_MASK (0xFFULL << CE_URE_SPLV_SHFT) 705#define CE_URE_SPLV_MASK (0xFFULL << CE_URE_SPLV_SHFT)
706#define CE_URE_SPLV_SET(n) (((u64)(n) << CE_URE_SPLV_SHFT) & \
707 CE_URE_SPLV_MASK)
678#define CE_URE_SPLS_SHFT 15 708#define CE_URE_SPLS_SHFT 15
679#define CE_URE_SPLS_MASK (0x3ULL << CE_URE_SPLS_SHFT) 709#define CE_URE_SPLS_MASK (0x3ULL << CE_URE_SPLS_SHFT)
710#define CE_URE_SPLS_SET(n) (((u64)(n) << CE_URE_SPLS_SHFT) & \
711 CE_URE_SPLS_MASK)
680#define CE_URE_PSN1_SHFT 19 712#define CE_URE_PSN1_SHFT 19
681#define CE_URE_PSN1_MASK (0x1FFFULL << CE_URE_PSN1_SHFT) 713#define CE_URE_PSN1_MASK (0x1FFFULL << CE_URE_PSN1_SHFT)
682#define CE_URE_PSN2_SHFT 32 714#define CE_URE_PSN2_SHFT 32
diff --git a/include/asm-ia64/sn/xpc.h b/include/asm-ia64/sn/xpc.h
index df7f5f4f3cde..aa3b8ace9030 100644
--- a/include/asm-ia64/sn/xpc.h
+++ b/include/asm-ia64/sn/xpc.h
@@ -1227,28 +1227,6 @@ xpc_map_bte_errors(bte_result_t error)
1227 1227
1228 1228
1229 1229
1230static inline void *
1231xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
1232{
1233 /* see if kmalloc will give us cachline aligned memory by default */
1234 *base = kmalloc(size, flags);
1235 if (*base == NULL) {
1236 return NULL;
1237 }
1238 if ((u64) *base == L1_CACHE_ALIGN((u64) *base)) {
1239 return *base;
1240 }
1241 kfree(*base);
1242
1243 /* nope, we'll have to do it ourselves */
1244 *base = kmalloc(size + L1_CACHE_BYTES, flags);
1245 if (*base == NULL) {
1246 return NULL;
1247 }
1248 return (void *) L1_CACHE_ALIGN((u64) *base);
1249}
1250
1251
1252/* 1230/*
1253 * Check to see if there is any channel activity to/from the specified 1231 * Check to see if there is any channel activity to/from the specified
1254 * partition. 1232 * partition.
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index 062538715623..2f3620593687 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -244,6 +244,13 @@ extern void ia64_load_extra (struct task_struct *task);
244 __ia64_save_fpu((prev)->thread.fph); \ 244 __ia64_save_fpu((prev)->thread.fph); \
245 } \ 245 } \
246 __switch_to(prev, next, last); \ 246 __switch_to(prev, next, last); \
247 /* "next" in old context is "current" in new context */ \
248 if (unlikely((current->thread.flags & IA64_THREAD_MIGRATION) && \
249 (task_cpu(current) != \
250 task_thread_info(current)->last_cpu))) { \
251 platform_migrate(current); \
252 task_thread_info(current)->last_cpu = task_cpu(current); \
253 } \
247} while (0) 254} while (0)
248#else 255#else
249# define switch_to(prev,next,last) __switch_to(prev, next, last) 256# define switch_to(prev,next,last) __switch_to(prev, next, last)
@@ -258,6 +265,8 @@ void sched_cacheflush(void);
258 265
259#define arch_align_stack(x) (x) 266#define arch_align_stack(x) (x)
260 267
268void default_idle(void);
269
261#endif /* __KERNEL__ */ 270#endif /* __KERNEL__ */
262 271
263#endif /* __ASSEMBLY__ */ 272#endif /* __ASSEMBLY__ */
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h
index 1d6518fe1f02..56394a2c7055 100644
--- a/include/asm-ia64/thread_info.h
+++ b/include/asm-ia64/thread_info.h
@@ -26,16 +26,10 @@ struct thread_info {
26 struct exec_domain *exec_domain;/* execution domain */ 26 struct exec_domain *exec_domain;/* execution domain */
27 __u32 flags; /* thread_info flags (see TIF_*) */ 27 __u32 flags; /* thread_info flags (see TIF_*) */
28 __u32 cpu; /* current CPU */ 28 __u32 cpu; /* current CPU */
29 __u32 last_cpu; /* Last CPU thread ran on */
29 mm_segment_t addr_limit; /* user-level address space limit */ 30 mm_segment_t addr_limit; /* user-level address space limit */
30 int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ 31 int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */
31 struct restart_block restart_block; 32 struct restart_block restart_block;
32 struct {
33 int signo;
34 int code;
35 void __user *addr;
36 unsigned long start_time;
37 pid_t pid;
38 } sigdelayed; /* Saved information for TIF_SIGDELAYED */
39}; 33};
40 34
41#define THREAD_SIZE KERNEL_STACK_SIZE 35#define THREAD_SIZE KERNEL_STACK_SIZE
@@ -89,7 +83,6 @@ struct thread_info {
89#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 83#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
90#define TIF_SYSCALL_TRACE 3 /* syscall trace active */ 84#define TIF_SYSCALL_TRACE 3 /* syscall trace active */
91#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */ 85#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
92#define TIF_SIGDELAYED 5 /* signal delayed from MCA/INIT/NMI/PMI context */
93#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 86#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
94#define TIF_MEMDIE 17 87#define TIF_MEMDIE 17
95#define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ 88#define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */
@@ -101,13 +94,12 @@ struct thread_info {
101#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 94#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
102#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 95#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
103#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 96#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
104#define _TIF_SIGDELAYED (1 << TIF_SIGDELAYED)
105#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 97#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
106#define _TIF_MCA_INIT (1 << TIF_MCA_INIT) 98#define _TIF_MCA_INIT (1 << TIF_MCA_INIT)
107#define _TIF_DB_DISABLED (1 << TIF_DB_DISABLED) 99#define _TIF_DB_DISABLED (1 << TIF_DB_DISABLED)
108 100
109/* "work to do on user-return" bits */ 101/* "work to do on user-return" bits */
110#define TIF_ALLWORK_MASK (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SIGDELAYED) 102#define TIF_ALLWORK_MASK (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
111/* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */ 103/* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */
112#define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)) 104#define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
113 105
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 019956c613e4..36070c1014d8 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -285,12 +285,13 @@
285#define __NR_faccessat 1293 285#define __NR_faccessat 1293
286/* 1294, 1295 reserved for pselect/ppoll */ 286/* 1294, 1295 reserved for pselect/ppoll */
287#define __NR_unshare 1296 287#define __NR_unshare 1296
288#define __NR_splice 1297
288 289
289#ifdef __KERNEL__ 290#ifdef __KERNEL__
290 291
291#include <linux/config.h> 292#include <linux/config.h>
292 293
293#define NR_syscalls 273 /* length of syscall table */ 294#define NR_syscalls 274 /* length of syscall table */
294 295
295#define __ARCH_WANT_SYS_RT_SIGACTION 296#define __ARCH_WANT_SYS_RT_SIGACTION
296 297
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h
index abea2fdd8689..902a366101a5 100644
--- a/include/asm-m32r/bitops.h
+++ b/include/asm-m32r/bitops.h
@@ -63,25 +63,6 @@ static __inline__ void set_bit(int nr, volatile void * addr)
63} 63}
64 64
65/** 65/**
66 * __set_bit - Set a bit in memory
67 * @nr: the bit to set
68 * @addr: the address to start counting from
69 *
70 * Unlike set_bit(), this function is non-atomic and may be reordered.
71 * If it's called on the same region of memory simultaneously, the effect
72 * may be that only one operation succeeds.
73 */
74static __inline__ void __set_bit(int nr, volatile void * addr)
75{
76 __u32 mask;
77 volatile __u32 *a = addr;
78
79 a += (nr >> 5);
80 mask = (1 << (nr & 0x1F));
81 *a |= mask;
82}
83
84/**
85 * clear_bit - Clears a bit in memory 66 * clear_bit - Clears a bit in memory
86 * @nr: Bit to clear 67 * @nr: Bit to clear
87 * @addr: Address to start counting from 68 * @addr: Address to start counting from
@@ -118,39 +99,10 @@ static __inline__ void clear_bit(int nr, volatile void * addr)
118 local_irq_restore(flags); 99 local_irq_restore(flags);
119} 100}
120 101
121static __inline__ void __clear_bit(int nr, volatile unsigned long * addr)
122{
123 unsigned long mask;
124 volatile unsigned long *a = addr;
125
126 a += (nr >> 5);
127 mask = (1 << (nr & 0x1F));
128 *a &= ~mask;
129}
130
131#define smp_mb__before_clear_bit() barrier() 102#define smp_mb__before_clear_bit() barrier()
132#define smp_mb__after_clear_bit() barrier() 103#define smp_mb__after_clear_bit() barrier()
133 104
134/** 105/**
135 * __change_bit - Toggle a bit in memory
136 * @nr: the bit to set
137 * @addr: the address to start counting from
138 *
139 * Unlike change_bit(), this function is non-atomic and may be reordered.
140 * If it's called on the same region of memory simultaneously, the effect
141 * may be that only one operation succeeds.
142 */
143static __inline__ void __change_bit(int nr, volatile void * addr)
144{
145 __u32 mask;
146 volatile __u32 *a = addr;
147
148 a += (nr >> 5);
149 mask = (1 << (nr & 0x1F));
150 *a ^= mask;
151}
152
153/**
154 * change_bit - Toggle a bit in memory 106 * change_bit - Toggle a bit in memory
155 * @nr: Bit to clear 107 * @nr: Bit to clear
156 * @addr: Address to start counting from 108 * @addr: Address to start counting from
@@ -221,28 +173,6 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr)
221} 173}
222 174
223/** 175/**
224 * __test_and_set_bit - Set a bit and return its old value
225 * @nr: Bit to set
226 * @addr: Address to count from
227 *
228 * This operation is non-atomic and can be reordered.
229 * If two examples of this operation race, one can appear to succeed
230 * but actually fail. You must protect multiple accesses with a lock.
231 */
232static __inline__ int __test_and_set_bit(int nr, volatile void * addr)
233{
234 __u32 mask, oldbit;
235 volatile __u32 *a = addr;
236
237 a += (nr >> 5);
238 mask = (1 << (nr & 0x1F));
239 oldbit = (*a & mask);
240 *a |= mask;
241
242 return (oldbit != 0);
243}
244
245/**
246 * test_and_clear_bit - Clear a bit and return its old value 176 * test_and_clear_bit - Clear a bit and return its old value
247 * @nr: Bit to set 177 * @nr: Bit to set
248 * @addr: Address to count from 178 * @addr: Address to count from
@@ -280,42 +210,6 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
280} 210}
281 211
282/** 212/**
283 * __test_and_clear_bit - Clear a bit and return its old value
284 * @nr: Bit to set
285 * @addr: Address to count from
286 *
287 * This operation is non-atomic and can be reordered.
288 * If two examples of this operation race, one can appear to succeed
289 * but actually fail. You must protect multiple accesses with a lock.
290 */
291static __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
292{
293 __u32 mask, oldbit;
294 volatile __u32 *a = addr;
295
296 a += (nr >> 5);
297 mask = (1 << (nr & 0x1F));
298 oldbit = (*a & mask);
299 *a &= ~mask;
300
301 return (oldbit != 0);
302}
303
304/* WARNING: non atomic and it can be reordered! */
305static __inline__ int __test_and_change_bit(int nr, volatile void * addr)
306{
307 __u32 mask, oldbit;
308 volatile __u32 *a = addr;
309
310 a += (nr >> 5);
311 mask = (1 << (nr & 0x1F));
312 oldbit = (*a & mask);
313 *a ^= mask;
314
315 return (oldbit != 0);
316}
317
318/**
319 * test_and_change_bit - Change a bit and return its old value 213 * test_and_change_bit - Change a bit and return its old value
320 * @nr: Bit to set 214 * @nr: Bit to set
321 * @addr: Address to count from 215 * @addr: Address to count from
@@ -350,353 +244,26 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
350 return (oldbit != 0); 244 return (oldbit != 0);
351} 245}
352 246
353/** 247#include <asm-generic/bitops/non-atomic.h>
354 * test_bit - Determine whether a bit is set 248#include <asm-generic/bitops/ffz.h>
355 * @nr: bit number to test 249#include <asm-generic/bitops/__ffs.h>
356 * @addr: Address to start counting from 250#include <asm-generic/bitops/fls.h>
357 */ 251#include <asm-generic/bitops/fls64.h>
358static __inline__ int test_bit(int nr, const volatile void * addr)
359{
360 __u32 mask;
361 const volatile __u32 *a = addr;
362
363 a += (nr >> 5);
364 mask = (1 << (nr & 0x1F));
365
366 return ((*a & mask) != 0);
367}
368
369/**
370 * ffz - find first zero in word.
371 * @word: The word to search
372 *
373 * Undefined if no zero exists, so code should check against ~0UL first.
374 */
375static __inline__ unsigned long ffz(unsigned long word)
376{
377 int k;
378
379 word = ~word;
380 k = 0;
381 if (!(word & 0x0000ffff)) { k += 16; word >>= 16; }
382 if (!(word & 0x000000ff)) { k += 8; word >>= 8; }
383 if (!(word & 0x0000000f)) { k += 4; word >>= 4; }
384 if (!(word & 0x00000003)) { k += 2; word >>= 2; }
385 if (!(word & 0x00000001)) { k += 1; }
386
387 return k;
388}
389
390/**
391 * find_first_zero_bit - find the first zero bit in a memory region
392 * @addr: The address to start the search at
393 * @size: The maximum size to search
394 *
395 * Returns the bit-number of the first zero bit, not the number of the byte
396 * containing a bit.
397 */
398
399#define find_first_zero_bit(addr, size) \
400 find_next_zero_bit((addr), (size), 0)
401
402/**
403 * find_next_zero_bit - find the first zero bit in a memory region
404 * @addr: The address to base the search on
405 * @offset: The bitnumber to start searching at
406 * @size: The maximum size to search
407 */
408static __inline__ int find_next_zero_bit(const unsigned long *addr,
409 int size, int offset)
410{
411 const unsigned long *p = addr + (offset >> 5);
412 unsigned long result = offset & ~31UL;
413 unsigned long tmp;
414
415 if (offset >= size)
416 return size;
417 size -= result;
418 offset &= 31UL;
419 if (offset) {
420 tmp = *(p++);
421 tmp |= ~0UL >> (32-offset);
422 if (size < 32)
423 goto found_first;
424 if (~tmp)
425 goto found_middle;
426 size -= 32;
427 result += 32;
428 }
429 while (size & ~31UL) {
430 if (~(tmp = *(p++)))
431 goto found_middle;
432 result += 32;
433 size -= 32;
434 }
435 if (!size)
436 return result;
437 tmp = *p;
438
439found_first:
440 tmp |= ~0UL << size;
441found_middle:
442 return result + ffz(tmp);
443}
444
445/**
446 * __ffs - find first bit in word.
447 * @word: The word to search
448 *
449 * Undefined if no bit exists, so code should check against 0 first.
450 */
451static __inline__ unsigned long __ffs(unsigned long word)
452{
453 int k = 0;
454
455 if (!(word & 0x0000ffff)) { k += 16; word >>= 16; }
456 if (!(word & 0x000000ff)) { k += 8; word >>= 8; }
457 if (!(word & 0x0000000f)) { k += 4; word >>= 4; }
458 if (!(word & 0x00000003)) { k += 2; word >>= 2; }
459 if (!(word & 0x00000001)) { k += 1;}
460
461 return k;
462}
463
464/*
465 * fls: find last bit set.
466 */
467#define fls(x) generic_fls(x)
468#define fls64(x) generic_fls64(x)
469 252
470#ifdef __KERNEL__ 253#ifdef __KERNEL__
471 254
472/* 255#include <asm-generic/bitops/sched.h>
473 * Every architecture must define this function. It's the fastest 256#include <asm-generic/bitops/find.h>
474 * way of searching a 140-bit bitmap where the first 100 bits are 257#include <asm-generic/bitops/ffs.h>
475 * unlikely to be set. It's guaranteed that at least one of the 140 258#include <asm-generic/bitops/hweight.h>
476 * bits is cleared.
477 */
478static inline int sched_find_first_bit(unsigned long *b)
479{
480 if (unlikely(b[0]))
481 return __ffs(b[0]);
482 if (unlikely(b[1]))
483 return __ffs(b[1]) + 32;
484 if (unlikely(b[2]))
485 return __ffs(b[2]) + 64;
486 if (b[3])
487 return __ffs(b[3]) + 96;
488 return __ffs(b[4]) + 128;
489}
490
491/**
492 * find_next_bit - find the first set bit in a memory region
493 * @addr: The address to base the search on
494 * @offset: The bitnumber to start searching at
495 * @size: The maximum size to search
496 */
497static inline unsigned long find_next_bit(const unsigned long *addr,
498 unsigned long size, unsigned long offset)
499{
500 unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
501 unsigned int result = offset & ~31UL;
502 unsigned int tmp;
503
504 if (offset >= size)
505 return size;
506 size -= result;
507 offset &= 31UL;
508 if (offset) {
509 tmp = *p++;
510 tmp &= ~0UL << offset;
511 if (size < 32)
512 goto found_first;
513 if (tmp)
514 goto found_middle;
515 size -= 32;
516 result += 32;
517 }
518 while (size >= 32) {
519 if ((tmp = *p++) != 0)
520 goto found_middle;
521 result += 32;
522 size -= 32;
523 }
524 if (!size)
525 return result;
526 tmp = *p;
527
528found_first:
529 tmp &= ~0UL >> (32 - size);
530 if (tmp == 0UL) /* Are any bits set? */
531 return result + size; /* Nope. */
532found_middle:
533 return result + __ffs(tmp);
534}
535
536/**
537 * find_first_bit - find the first set bit in a memory region
538 * @addr: The address to start the search at
539 * @size: The maximum size to search
540 *
541 * Returns the bit-number of the first set bit, not the number of the byte
542 * containing a bit.
543 */
544#define find_first_bit(addr, size) \
545 find_next_bit((addr), (size), 0)
546
547/**
548 * ffs - find first bit set
549 * @x: the word to search
550 *
551 * This is defined the same way as
552 * the libc and compiler builtin ffs routines, therefore
553 * differs in spirit from the above ffz (man ffs).
554 */
555#define ffs(x) generic_ffs(x)
556
557/**
558 * hweightN - returns the hamming weight of a N-bit word
559 * @x: the word to weigh
560 *
561 * The Hamming Weight of a number is the total number of bits set in it.
562 */
563
564#define hweight32(x) generic_hweight32(x)
565#define hweight16(x) generic_hweight16(x)
566#define hweight8(x) generic_hweight8(x)
567 259
568#endif /* __KERNEL__ */ 260#endif /* __KERNEL__ */
569 261
570#ifdef __KERNEL__ 262#ifdef __KERNEL__
571 263
572/* 264#include <asm-generic/bitops/ext2-non-atomic.h>
573 * ext2_XXXX function 265#include <asm-generic/bitops/ext2-atomic.h>
574 * orig: include/asm-sh/bitops.h 266#include <asm-generic/bitops/minix.h>
575 */
576
577#ifdef __LITTLE_ENDIAN__
578#define ext2_set_bit test_and_set_bit
579#define ext2_clear_bit __test_and_clear_bit
580#define ext2_test_bit test_bit
581#define ext2_find_first_zero_bit find_first_zero_bit
582#define ext2_find_next_zero_bit find_next_zero_bit
583#else
584static inline int ext2_set_bit(int nr, volatile void * addr)
585{
586 __u8 mask, oldbit;
587 volatile __u8 *a = addr;
588
589 a += (nr >> 3);
590 mask = (1 << (nr & 0x07));
591 oldbit = (*a & mask);
592 *a |= mask;
593
594 return (oldbit != 0);
595}
596
597static inline int ext2_clear_bit(int nr, volatile void * addr)
598{
599 __u8 mask, oldbit;
600 volatile __u8 *a = addr;
601
602 a += (nr >> 3);
603 mask = (1 << (nr & 0x07));
604 oldbit = (*a & mask);
605 *a &= ~mask;
606
607 return (oldbit != 0);
608}
609
610static inline int ext2_test_bit(int nr, const volatile void * addr)
611{
612 __u32 mask;
613 const volatile __u8 *a = addr;
614
615 a += (nr >> 3);
616 mask = (1 << (nr & 0x07));
617
618 return ((mask & *a) != 0);
619}
620
621#define ext2_find_first_zero_bit(addr, size) \
622 ext2_find_next_zero_bit((addr), (size), 0)
623
624static inline unsigned long ext2_find_next_zero_bit(void *addr,
625 unsigned long size, unsigned long offset)
626{
627 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
628 unsigned long result = offset & ~31UL;
629 unsigned long tmp;
630
631 if (offset >= size)
632 return size;
633 size -= result;
634 offset &= 31UL;
635 if(offset) {
636 /* We hold the little endian value in tmp, but then the
637 * shift is illegal. So we could keep a big endian value
638 * in tmp, like this:
639 *
640 * tmp = __swab32(*(p++));
641 * tmp |= ~0UL >> (32-offset);
642 *
643 * but this would decrease preformance, so we change the
644 * shift:
645 */
646 tmp = *(p++);
647 tmp |= __swab32(~0UL >> (32-offset));
648 if(size < 32)
649 goto found_first;
650 if(~tmp)
651 goto found_middle;
652 size -= 32;
653 result += 32;
654 }
655 while(size & ~31UL) {
656 if(~(tmp = *(p++)))
657 goto found_middle;
658 result += 32;
659 size -= 32;
660 }
661 if(!size)
662 return result;
663 tmp = *p;
664
665found_first:
666 /* tmp is little endian, so we would have to swab the shift,
667 * see above. But then we have to swab tmp below for ffz, so
668 * we might as well do this here.
669 */
670 return result + ffz(__swab32(tmp) | (~0UL << size));
671found_middle:
672 return result + ffz(__swab32(tmp));
673}
674#endif
675
676#define ext2_set_bit_atomic(lock, nr, addr) \
677 ({ \
678 int ret; \
679 spin_lock(lock); \
680 ret = ext2_set_bit((nr), (addr)); \
681 spin_unlock(lock); \
682 ret; \
683 })
684
685#define ext2_clear_bit_atomic(lock, nr, addr) \
686 ({ \
687 int ret; \
688 spin_lock(lock); \
689 ret = ext2_clear_bit((nr), (addr)); \
690 spin_unlock(lock); \
691 ret; \
692 })
693
694/* Bitmap functions for the minix filesystem. */
695#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,addr)
696#define minix_set_bit(nr,addr) __set_bit(nr,addr)
697#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,addr)
698#define minix_test_bit(nr,addr) test_bit(nr,addr)
699#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
700 267
701#endif /* __KERNEL__ */ 268#endif /* __KERNEL__ */
702 269
diff --git a/include/asm-m32r/mmzone.h b/include/asm-m32r/mmzone.h
index adc7970a77ec..9f3b5accda88 100644
--- a/include/asm-m32r/mmzone.h
+++ b/include/asm-m32r/mmzone.h
@@ -21,20 +21,6 @@ extern struct pglist_data *node_data[];
21 __pgdat->node_start_pfn + __pgdat->node_spanned_pages - 1; \ 21 __pgdat->node_start_pfn + __pgdat->node_spanned_pages - 1; \
22}) 22})
23 23
24#define pfn_to_page(pfn) \
25({ \
26 unsigned long __pfn = pfn; \
27 int __node = pfn_to_nid(__pfn); \
28 &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \
29})
30
31#define page_to_pfn(pg) \
32({ \
33 struct page *__page = pg; \
34 struct zone *__zone = page_zone(__page); \
35 (unsigned long)(__page - __zone->zone_mem_map) \
36 + __zone->zone_start_pfn; \
37})
38#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) 24#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
39/* 25/*
40 * pfn_valid should be made as fast as possible, and the current definition 26 * pfn_valid should be made as fast as possible, and the current definition
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h
index 4ab578876361..9ddbc087dbc5 100644
--- a/include/asm-m32r/page.h
+++ b/include/asm-m32r/page.h
@@ -76,9 +76,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
76 76
77#ifndef CONFIG_DISCONTIGMEM 77#ifndef CONFIG_DISCONTIGMEM
78#define PFN_BASE (CONFIG_MEMORY_START >> PAGE_SHIFT) 78#define PFN_BASE (CONFIG_MEMORY_START >> PAGE_SHIFT)
79#define pfn_to_page(pfn) (mem_map + ((pfn) - PFN_BASE)) 79#define ARCH_PFN_OFFSET PFN_BASE
80#define page_to_pfn(page) \
81 ((unsigned long)((page) - mem_map) + PFN_BASE)
82#define pfn_valid(pfn) (((pfn) - PFN_BASE) < max_mapnr) 80#define pfn_valid(pfn) (((pfn) - PFN_BASE) < max_mapnr)
83#endif /* !CONFIG_DISCONTIGMEM */ 81#endif /* !CONFIG_DISCONTIGMEM */
84 82
@@ -92,6 +90,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
92 90
93#endif /* __KERNEL__ */ 91#endif /* __KERNEL__ */
94 92
93#include <asm-generic/memory_model.h>
95#include <asm-generic/page.h> 94#include <asm-generic/page.h>
96 95
97#endif /* _ASM_M32R_PAGE_H */ 96#endif /* _ASM_M32R_PAGE_H */
diff --git a/include/asm-m32r/poll.h b/include/asm-m32r/poll.h
index 43b7acf732d5..9e0e700e727c 100644
--- a/include/asm-m32r/poll.h
+++ b/include/asm-m32r/poll.h
@@ -21,6 +21,7 @@
21#define POLLWRBAND 0x0200 21#define POLLWRBAND 0x0200
22#define POLLMSG 0x0400 22#define POLLMSG 0x0400
23#define POLLREMOVE 0x1000 23#define POLLREMOVE 0x1000
24#define POLLRDHUP 0x2000
24 25
25struct pollfd { 26struct pollfd {
26 int fd; 27 int fd;
diff --git a/include/asm-m32r/setup.h b/include/asm-m32r/setup.h
index 5f028dc26a9b..52f4fa29abfc 100644
--- a/include/asm-m32r/setup.h
+++ b/include/asm-m32r/setup.h
@@ -24,10 +24,6 @@
24#define RAMDISK_PROMPT_FLAG (0x8000) 24#define RAMDISK_PROMPT_FLAG (0x8000)
25#define RAMDISK_LOAD_FLAG (0x4000) 25#define RAMDISK_LOAD_FLAG (0x4000)
26 26
27#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
28#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
29#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
30
31extern unsigned long memory_start; 27extern unsigned long memory_start;
32extern unsigned long memory_end; 28extern unsigned long memory_end;
33 29
diff --git a/include/asm-m68k/atomic.h b/include/asm-m68k/atomic.h
index 862e497c2645..732d696d31a6 100644
--- a/include/asm-m68k/atomic.h
+++ b/include/asm-m68k/atomic.h
@@ -175,8 +175,14 @@ static inline void atomic_set_mask(unsigned long mask, unsigned long *v)
175({ \ 175({ \
176 int c, old; \ 176 int c, old; \
177 c = atomic_read(v); \ 177 c = atomic_read(v); \
178 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 178 for (;;) { \
179 if (unlikely(c == (u))) \
180 break; \
181 old = atomic_cmpxchg((v), c, c + (a)); \
182 if (likely(old == c)) \
183 break; \
179 c = old; \ 184 c = old; \
185 } \
180 c != (u); \ 186 c != (u); \
181}) 187})
182#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 188#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index 13f4c0048463..1a61fdb56aaf 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -310,36 +310,10 @@ static inline int fls(int x)
310 310
311 return 32 - cnt; 311 return 32 - cnt;
312} 312}
313#define fls64(x) generic_fls64(x)
314 313
315/* 314#include <asm-generic/bitops/fls64.h>
316 * Every architecture must define this function. It's the fastest 315#include <asm-generic/bitops/sched.h>
317 * way of searching a 140-bit bitmap where the first 100 bits are 316#include <asm-generic/bitops/hweight.h>
318 * unlikely to be set. It's guaranteed that at least one of the 140
319 * bits is cleared.
320 */
321static inline int sched_find_first_bit(const unsigned long *b)
322{
323 if (unlikely(b[0]))
324 return __ffs(b[0]);
325 if (unlikely(b[1]))
326 return __ffs(b[1]) + 32;
327 if (unlikely(b[2]))
328 return __ffs(b[2]) + 64;
329 if (b[3])
330 return __ffs(b[3]) + 96;
331 return __ffs(b[4]) + 128;
332}
333
334
335/*
336 * hweightN: returns the hamming weight (i.e. the number
337 * of bits set) of a N-bit word
338 */
339
340#define hweight32(x) generic_hweight32(x)
341#define hweight16(x) generic_hweight16(x)
342#define hweight8(x) generic_hweight8(x)
343 317
344/* Bitmap functions for the minix filesystem */ 318/* Bitmap functions for the minix filesystem */
345 319
@@ -365,9 +339,9 @@ static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
365 return ((p - addr) << 4) + (res ^ 31); 339 return ((p - addr) << 4) + (res ^ 31);
366} 340}
367 341
368#define minix_test_and_set_bit(nr, addr) test_and_set_bit((nr) ^ 16, (unsigned long *)(addr)) 342#define minix_test_and_set_bit(nr, addr) __test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
369#define minix_set_bit(nr,addr) set_bit((nr) ^ 16, (unsigned long *)(addr)) 343#define minix_set_bit(nr,addr) __set_bit((nr) ^ 16, (unsigned long *)(addr))
370#define minix_test_and_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr)) 344#define minix_test_and_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
371 345
372static inline int minix_test_bit(int nr, const void *vaddr) 346static inline int minix_test_bit(int nr, const void *vaddr)
373{ 347{
@@ -377,9 +351,9 @@ static inline int minix_test_bit(int nr, const void *vaddr)
377 351
378/* Bitmap functions for the ext2 filesystem. */ 352/* Bitmap functions for the ext2 filesystem. */
379 353
380#define ext2_set_bit(nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr)) 354#define ext2_set_bit(nr, addr) __test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
381#define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr)) 355#define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 24, (unsigned long *)(addr))
382#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) 356#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
383#define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr)) 357#define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 24, (unsigned long *)(addr))
384 358
385static inline int ext2_test_bit(int nr, const void *vaddr) 359static inline int ext2_test_bit(int nr, const void *vaddr)
diff --git a/include/asm-m68k/poll.h b/include/asm-m68k/poll.h
index c4b69c4a87e1..0fb8843647f8 100644
--- a/include/asm-m68k/poll.h
+++ b/include/asm-m68k/poll.h
@@ -13,6 +13,7 @@
13#define POLLWRBAND 256 13#define POLLWRBAND 256
14#define POLLMSG 0x0400 14#define POLLMSG 0x0400
15#define POLLREMOVE 0x1000 15#define POLLREMOVE 0x1000
16#define POLLRDHUP 0x2000
16 17
17struct pollfd { 18struct pollfd {
18 int fd; 19 int fd;
diff --git a/include/asm-m68k/stat.h b/include/asm-m68k/stat.h
index c4c402a45e21..dd38bc2e9f98 100644
--- a/include/asm-m68k/stat.h
+++ b/include/asm-m68k/stat.h
@@ -60,8 +60,7 @@ struct stat64 {
60 long long st_size; 60 long long st_size;
61 unsigned long st_blksize; 61 unsigned long st_blksize;
62 62
63 unsigned long __pad4; /* future possible st_blocks high bits */ 63 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
64 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
65 64
66 unsigned long st_atime; 65 unsigned long st_atime;
67 unsigned long st_atime_nsec; 66 unsigned long st_atime_nsec;
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index 25d8a3cfef90..0b68ccd327f7 100644
--- a/include/asm-m68knommu/bitops.h
+++ b/include/asm-m68knommu/bitops.h
@@ -12,104 +12,10 @@
12 12
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14 14
15/* 15#include <asm-generic/bitops/ffs.h>
16 * Generic ffs(). 16#include <asm-generic/bitops/__ffs.h>
17 */ 17#include <asm-generic/bitops/sched.h>
18static inline int ffs(int x) 18#include <asm-generic/bitops/ffz.h>
19{
20 int r = 1;
21
22 if (!x)
23 return 0;
24 if (!(x & 0xffff)) {
25 x >>= 16;
26 r += 16;
27 }
28 if (!(x & 0xff)) {
29 x >>= 8;
30 r += 8;
31 }
32 if (!(x & 0xf)) {
33 x >>= 4;
34 r += 4;
35 }
36 if (!(x & 3)) {
37 x >>= 2;
38 r += 2;
39 }
40 if (!(x & 1)) {
41 x >>= 1;
42 r += 1;
43 }
44 return r;
45}
46
47/*
48 * Generic __ffs().
49 */
50static inline int __ffs(int x)
51{
52 int r = 0;
53
54 if (!x)
55 return 0;
56 if (!(x & 0xffff)) {
57 x >>= 16;
58 r += 16;
59 }
60 if (!(x & 0xff)) {
61 x >>= 8;
62 r += 8;
63 }
64 if (!(x & 0xf)) {
65 x >>= 4;
66 r += 4;
67 }
68 if (!(x & 3)) {
69 x >>= 2;
70 r += 2;
71 }
72 if (!(x & 1)) {
73 x >>= 1;
74 r += 1;
75 }
76 return r;
77}
78
79/*
80 * Every architecture must define this function. It's the fastest
81 * way of searching a 140-bit bitmap where the first 100 bits are
82 * unlikely to be set. It's guaranteed that at least one of the 140
83 * bits is cleared.
84 */
85static inline int sched_find_first_bit(unsigned long *b)
86{
87 if (unlikely(b[0]))
88 return __ffs(b[0]);
89 if (unlikely(b[1]))
90 return __ffs(b[1]) + 32;
91 if (unlikely(b[2]))
92 return __ffs(b[2]) + 64;
93 if (b[3])
94 return __ffs(b[3]) + 96;
95 return __ffs(b[4]) + 128;
96}
97
98/*
99 * ffz = Find First Zero in word. Undefined if no zero exists,
100 * so code should check against ~0UL first..
101 */
102static __inline__ unsigned long ffz(unsigned long word)
103{
104 unsigned long result = 0;
105
106 while(word & 1) {
107 result++;
108 word >>= 1;
109 }
110 return result;
111}
112
113 19
114static __inline__ void set_bit(int nr, volatile unsigned long * addr) 20static __inline__ void set_bit(int nr, volatile unsigned long * addr)
115{ 21{
@@ -254,98 +160,8 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
254 __constant_test_bit((nr),(addr)) : \ 160 __constant_test_bit((nr),(addr)) : \
255 __test_bit((nr),(addr))) 161 __test_bit((nr),(addr)))
256 162
257#define find_first_zero_bit(addr, size) \ 163#include <asm-generic/bitops/find.h>
258 find_next_zero_bit((addr), (size), 0) 164#include <asm-generic/bitops/hweight.h>
259#define find_first_bit(addr, size) \
260 find_next_bit((addr), (size), 0)
261
262static __inline__ int find_next_zero_bit (const void * addr, int size, int offset)
263{
264 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
265 unsigned long result = offset & ~31UL;
266 unsigned long tmp;
267
268 if (offset >= size)
269 return size;
270 size -= result;
271 offset &= 31UL;
272 if (offset) {
273 tmp = *(p++);
274 tmp |= ~0UL >> (32-offset);
275 if (size < 32)
276 goto found_first;
277 if (~tmp)
278 goto found_middle;
279 size -= 32;
280 result += 32;
281 }
282 while (size & ~31UL) {
283 if (~(tmp = *(p++)))
284 goto found_middle;
285 result += 32;
286 size -= 32;
287 }
288 if (!size)
289 return result;
290 tmp = *p;
291
292found_first:
293 tmp |= ~0UL << size;
294found_middle:
295 return result + ffz(tmp);
296}
297
298/*
299 * Find next one bit in a bitmap reasonably efficiently.
300 */
301static __inline__ unsigned long find_next_bit(const unsigned long *addr,
302 unsigned long size, unsigned long offset)
303{
304 unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
305 unsigned int result = offset & ~31UL;
306 unsigned int tmp;
307
308 if (offset >= size)
309 return size;
310 size -= result;
311 offset &= 31UL;
312 if (offset) {
313 tmp = *p++;
314 tmp &= ~0UL << offset;
315 if (size < 32)
316 goto found_first;
317 if (tmp)
318 goto found_middle;
319 size -= 32;
320 result += 32;
321 }
322 while (size >= 32) {
323 if ((tmp = *p++) != 0)
324 goto found_middle;
325 result += 32;
326 size -= 32;
327 }
328 if (!size)
329 return result;
330 tmp = *p;
331
332found_first:
333 tmp &= ~0UL >> (32 - size);
334 if (tmp == 0UL) /* Are any bits set? */
335 return result + size; /* Nope. */
336found_middle:
337 return result + __ffs(tmp);
338}
339
340/*
341 * hweightN: returns the hamming weight (i.e. the number
342 * of bits set) of a N-bit word
343 */
344
345#define hweight32(x) generic_hweight32(x)
346#define hweight16(x) generic_hweight16(x)
347#define hweight8(x) generic_hweight8(x)
348
349 165
350static __inline__ int ext2_set_bit(int nr, volatile void * addr) 166static __inline__ int ext2_set_bit(int nr, volatile void * addr)
351{ 167{
@@ -475,30 +291,11 @@ found_middle:
475 return result + ffz(__swab32(tmp)); 291 return result + ffz(__swab32(tmp));
476} 292}
477 293
478/* Bitmap functions for the minix filesystem. */ 294#include <asm-generic/bitops/minix.h>
479#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
480#define minix_set_bit(nr,addr) set_bit(nr,addr)
481#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
482#define minix_test_bit(nr,addr) test_bit(nr,addr)
483#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
484
485/**
486 * hweightN - returns the hamming weight of a N-bit word
487 * @x: the word to weigh
488 *
489 * The Hamming Weight of a number is the total number of bits set in it.
490 */
491
492#define hweight32(x) generic_hweight32(x)
493#define hweight16(x) generic_hweight16(x)
494#define hweight8(x) generic_hweight8(x)
495 295
496#endif /* __KERNEL__ */ 296#endif /* __KERNEL__ */
497 297
498/* 298#include <asm-generic/bitops/fls.h>
499 * fls: find last bit set. 299#include <asm-generic/bitops/fls64.h>
500 */
501#define fls(x) generic_fls(x)
502#define fls64(x) generic_fls64(x)
503 300
504#endif /* _M68KNOMMU_BITOPS_H */ 301#endif /* _M68KNOMMU_BITOPS_H */
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 8e802059fe67..a1728f8c0705 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -105,22 +105,6 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
105} 105}
106 106
107/* 107/*
108 * __set_bit - Set a bit in memory
109 * @nr: the bit to set
110 * @addr: the address to start counting from
111 *
112 * Unlike set_bit(), this function is non-atomic and may be reordered.
113 * If it's called on the same region of memory simultaneously, the effect
114 * may be that only one operation succeeds.
115 */
116static inline void __set_bit(unsigned long nr, volatile unsigned long * addr)
117{
118 unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
119
120 *m |= 1UL << (nr & SZLONG_MASK);
121}
122
123/*
124 * clear_bit - Clears a bit in memory 108 * clear_bit - Clears a bit in memory
125 * @nr: Bit to clear 109 * @nr: Bit to clear
126 * @addr: Address to start counting from 110 * @addr: Address to start counting from
@@ -169,22 +153,6 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
169} 153}
170 154
171/* 155/*
172 * __clear_bit - Clears a bit in memory
173 * @nr: Bit to clear
174 * @addr: Address to start counting from
175 *
176 * Unlike clear_bit(), this function is non-atomic and may be reordered.
177 * If it's called on the same region of memory simultaneously, the effect
178 * may be that only one operation succeeds.
179 */
180static inline void __clear_bit(unsigned long nr, volatile unsigned long * addr)
181{
182 unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
183
184 *m &= ~(1UL << (nr & SZLONG_MASK));
185}
186
187/*
188 * change_bit - Toggle a bit in memory 156 * change_bit - Toggle a bit in memory
189 * @nr: Bit to change 157 * @nr: Bit to change
190 * @addr: Address to start counting from 158 * @addr: Address to start counting from
@@ -235,22 +203,6 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
235} 203}
236 204
237/* 205/*
238 * __change_bit - Toggle a bit in memory
239 * @nr: the bit to change
240 * @addr: the address to start counting from
241 *
242 * Unlike change_bit(), this function is non-atomic and may be reordered.
243 * If it's called on the same region of memory simultaneously, the effect
244 * may be that only one operation succeeds.
245 */
246static inline void __change_bit(unsigned long nr, volatile unsigned long * addr)
247{
248 unsigned long * m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
249
250 *m ^= 1UL << (nr & SZLONG_MASK);
251}
252
253/*
254 * test_and_set_bit - Set a bit and return its old value 206 * test_and_set_bit - Set a bit and return its old value
255 * @nr: Bit to set 207 * @nr: Bit to set
256 * @addr: Address to count from 208 * @addr: Address to count from
@@ -321,30 +273,6 @@ static inline int test_and_set_bit(unsigned long nr,
321} 273}
322 274
323/* 275/*
324 * __test_and_set_bit - Set a bit and return its old value
325 * @nr: Bit to set
326 * @addr: Address to count from
327 *
328 * This operation is non-atomic and can be reordered.
329 * If two examples of this operation race, one can appear to succeed
330 * but actually fail. You must protect multiple accesses with a lock.
331 */
332static inline int __test_and_set_bit(unsigned long nr,
333 volatile unsigned long *addr)
334{
335 volatile unsigned long *a = addr;
336 unsigned long mask;
337 int retval;
338
339 a += nr >> SZLONG_LOG;
340 mask = 1UL << (nr & SZLONG_MASK);
341 retval = (mask & *a) != 0;
342 *a |= mask;
343
344 return retval;
345}
346
347/*
348 * test_and_clear_bit - Clear a bit and return its old value 276 * test_and_clear_bit - Clear a bit and return its old value
349 * @nr: Bit to clear 277 * @nr: Bit to clear
350 * @addr: Address to count from 278 * @addr: Address to count from
@@ -417,30 +345,6 @@ static inline int test_and_clear_bit(unsigned long nr,
417} 345}
418 346
419/* 347/*
420 * __test_and_clear_bit - Clear a bit and return its old value
421 * @nr: Bit to clear
422 * @addr: Address to count from
423 *
424 * This operation is non-atomic and can be reordered.
425 * If two examples of this operation race, one can appear to succeed
426 * but actually fail. You must protect multiple accesses with a lock.
427 */
428static inline int __test_and_clear_bit(unsigned long nr,
429 volatile unsigned long * addr)
430{
431 volatile unsigned long *a = addr;
432 unsigned long mask;
433 int retval;
434
435 a += (nr >> SZLONG_LOG);
436 mask = 1UL << (nr & SZLONG_MASK);
437 retval = ((mask & *a) != 0);
438 *a &= ~mask;
439
440 return retval;
441}
442
443/*
444 * test_and_change_bit - Change a bit and return its old value 348 * test_and_change_bit - Change a bit and return its old value
445 * @nr: Bit to change 349 * @nr: Bit to change
446 * @addr: Address to count from 350 * @addr: Address to count from
@@ -509,43 +413,11 @@ static inline int test_and_change_bit(unsigned long nr,
509 } 413 }
510} 414}
511 415
512/*
513 * __test_and_change_bit - Change a bit and return its old value
514 * @nr: Bit to change
515 * @addr: Address to count from
516 *
517 * This operation is non-atomic and can be reordered.
518 * If two examples of this operation race, one can appear to succeed
519 * but actually fail. You must protect multiple accesses with a lock.
520 */
521static inline int __test_and_change_bit(unsigned long nr,
522 volatile unsigned long *addr)
523{
524 volatile unsigned long *a = addr;
525 unsigned long mask;
526 int retval;
527
528 a += (nr >> SZLONG_LOG);
529 mask = 1UL << (nr & SZLONG_MASK);
530 retval = ((mask & *a) != 0);
531 *a ^= mask;
532
533 return retval;
534}
535
536#undef __bi_flags 416#undef __bi_flags
537#undef __bi_local_irq_save 417#undef __bi_local_irq_save
538#undef __bi_local_irq_restore 418#undef __bi_local_irq_restore
539 419
540/* 420#include <asm-generic/bitops/non-atomic.h>
541 * test_bit - Determine whether a bit is set
542 * @nr: bit number to test
543 * @addr: Address to start counting from
544 */
545static inline int test_bit(unsigned long nr, const volatile unsigned long *addr)
546{
547 return 1UL & (addr[nr >> SZLONG_LOG] >> (nr & SZLONG_MASK));
548}
549 421
550/* 422/*
551 * Return the bit position (0..63) of the most significant 1 bit in a word 423 * Return the bit position (0..63) of the most significant 1 bit in a word
@@ -580,6 +452,8 @@ static inline int __ilog2(unsigned long x)
580 return 63 - lz; 452 return 63 - lz;
581} 453}
582 454
455#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
456
583/* 457/*
584 * __ffs - find first bit in word. 458 * __ffs - find first bit in word.
585 * @word: The word to search 459 * @word: The word to search
@@ -589,31 +463,7 @@ static inline int __ilog2(unsigned long x)
589 */ 463 */
590static inline unsigned long __ffs(unsigned long word) 464static inline unsigned long __ffs(unsigned long word)
591{ 465{
592#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
593 return __ilog2(word & -word); 466 return __ilog2(word & -word);
594#else
595 int b = 0, s;
596
597#ifdef CONFIG_32BIT
598 s = 16; if (word << 16 != 0) s = 0; b += s; word >>= s;
599 s = 8; if (word << 24 != 0) s = 0; b += s; word >>= s;
600 s = 4; if (word << 28 != 0) s = 0; b += s; word >>= s;
601 s = 2; if (word << 30 != 0) s = 0; b += s; word >>= s;
602 s = 1; if (word << 31 != 0) s = 0; b += s;
603
604 return b;
605#endif
606#ifdef CONFIG_64BIT
607 s = 32; if (word << 32 != 0) s = 0; b += s; word >>= s;
608 s = 16; if (word << 48 != 0) s = 0; b += s; word >>= s;
609 s = 8; if (word << 56 != 0) s = 0; b += s; word >>= s;
610 s = 4; if (word << 60 != 0) s = 0; b += s; word >>= s;
611 s = 2; if (word << 62 != 0) s = 0; b += s; word >>= s;
612 s = 1; if (word << 63 != 0) s = 0; b += s;
613
614 return b;
615#endif
616#endif
617} 467}
618 468
619/* 469/*
@@ -652,321 +502,38 @@ static inline unsigned long ffz(unsigned long word)
652 */ 502 */
653static inline unsigned long fls(unsigned long word) 503static inline unsigned long fls(unsigned long word)
654{ 504{
655#ifdef CONFIG_32BIT
656#ifdef CONFIG_CPU_MIPS32 505#ifdef CONFIG_CPU_MIPS32
657 __asm__ ("clz %0, %1" : "=r" (word) : "r" (word)); 506 __asm__ ("clz %0, %1" : "=r" (word) : "r" (word));
658 507
659 return 32 - word; 508 return 32 - word;
660#else
661 {
662 int r = 32, s;
663
664 if (word == 0)
665 return 0;
666
667 s = 16; if ((word & 0xffff0000)) s = 0; r -= s; word <<= s;
668 s = 8; if ((word & 0xff000000)) s = 0; r -= s; word <<= s;
669 s = 4; if ((word & 0xf0000000)) s = 0; r -= s; word <<= s;
670 s = 2; if ((word & 0xc0000000)) s = 0; r -= s; word <<= s;
671 s = 1; if ((word & 0x80000000)) s = 0; r -= s;
672
673 return r;
674 }
675#endif 509#endif
676#endif /* CONFIG_32BIT */
677 510
678#ifdef CONFIG_64BIT
679#ifdef CONFIG_CPU_MIPS64 511#ifdef CONFIG_CPU_MIPS64
680
681 __asm__ ("dclz %0, %1" : "=r" (word) : "r" (word)); 512 __asm__ ("dclz %0, %1" : "=r" (word) : "r" (word));
682 513
683 return 64 - word; 514 return 64 - word;
684#else
685 {
686 int r = 64, s;
687
688 if (word == 0)
689 return 0;
690
691 s = 32; if ((word & 0xffffffff00000000UL)) s = 0; r -= s; word <<= s;
692 s = 16; if ((word & 0xffff000000000000UL)) s = 0; r -= s; word <<= s;
693 s = 8; if ((word & 0xff00000000000000UL)) s = 0; r -= s; word <<= s;
694 s = 4; if ((word & 0xf000000000000000UL)) s = 0; r -= s; word <<= s;
695 s = 2; if ((word & 0xc000000000000000UL)) s = 0; r -= s; word <<= s;
696 s = 1; if ((word & 0x8000000000000000UL)) s = 0; r -= s;
697
698 return r;
699 }
700#endif 515#endif
701#endif /* CONFIG_64BIT */
702} 516}
703 517
704#define fls64(x) generic_fls64(x) 518#else
705
706/*
707 * find_next_zero_bit - find the first zero bit in a memory region
708 * @addr: The address to base the search on
709 * @offset: The bitnumber to start searching at
710 * @size: The maximum size to search
711 */
712static inline unsigned long find_next_zero_bit(const unsigned long *addr,
713 unsigned long size, unsigned long offset)
714{
715 const unsigned long *p = addr + (offset >> SZLONG_LOG);
716 unsigned long result = offset & ~SZLONG_MASK;
717 unsigned long tmp;
718
719 if (offset >= size)
720 return size;
721 size -= result;
722 offset &= SZLONG_MASK;
723 if (offset) {
724 tmp = *(p++);
725 tmp |= ~0UL >> (_MIPS_SZLONG-offset);
726 if (size < _MIPS_SZLONG)
727 goto found_first;
728 if (~tmp)
729 goto found_middle;
730 size -= _MIPS_SZLONG;
731 result += _MIPS_SZLONG;
732 }
733 while (size & ~SZLONG_MASK) {
734 if (~(tmp = *(p++)))
735 goto found_middle;
736 result += _MIPS_SZLONG;
737 size -= _MIPS_SZLONG;
738 }
739 if (!size)
740 return result;
741 tmp = *p;
742
743found_first:
744 tmp |= ~0UL << size;
745 if (tmp == ~0UL) /* Are any bits zero? */
746 return result + size; /* Nope. */
747found_middle:
748 return result + ffz(tmp);
749}
750 519
751#define find_first_zero_bit(addr, size) \ 520#include <asm-generic/bitops/__ffs.h>
752 find_next_zero_bit((addr), (size), 0) 521#include <asm-generic/bitops/ffs.h>
522#include <asm-generic/bitops/ffz.h>
523#include <asm-generic/bitops/fls.h>
753 524
754/* 525#endif /*defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) */
755 * find_next_bit - find the next set bit in a memory region
756 * @addr: The address to base the search on
757 * @offset: The bitnumber to start searching at
758 * @size: The maximum size to search
759 */
760static inline unsigned long find_next_bit(const unsigned long *addr,
761 unsigned long size, unsigned long offset)
762{
763 const unsigned long *p = addr + (offset >> SZLONG_LOG);
764 unsigned long result = offset & ~SZLONG_MASK;
765 unsigned long tmp;
766
767 if (offset >= size)
768 return size;
769 size -= result;
770 offset &= SZLONG_MASK;
771 if (offset) {
772 tmp = *(p++);
773 tmp &= ~0UL << offset;
774 if (size < _MIPS_SZLONG)
775 goto found_first;
776 if (tmp)
777 goto found_middle;
778 size -= _MIPS_SZLONG;
779 result += _MIPS_SZLONG;
780 }
781 while (size & ~SZLONG_MASK) {
782 if ((tmp = *(p++)))
783 goto found_middle;
784 result += _MIPS_SZLONG;
785 size -= _MIPS_SZLONG;
786 }
787 if (!size)
788 return result;
789 tmp = *p;
790
791found_first:
792 tmp &= ~0UL >> (_MIPS_SZLONG - size);
793 if (tmp == 0UL) /* Are any bits set? */
794 return result + size; /* Nope. */
795found_middle:
796 return result + __ffs(tmp);
797}
798 526
799/* 527#include <asm-generic/bitops/fls64.h>
800 * find_first_bit - find the first set bit in a memory region 528#include <asm-generic/bitops/find.h>
801 * @addr: The address to start the search at
802 * @size: The maximum size to search
803 *
804 * Returns the bit-number of the first set bit, not the number of the byte
805 * containing a bit.
806 */
807#define find_first_bit(addr, size) \
808 find_next_bit((addr), (size), 0)
809 529
810#ifdef __KERNEL__ 530#ifdef __KERNEL__
811 531
812/* 532#include <asm-generic/bitops/sched.h>
813 * Every architecture must define this function. It's the fastest 533#include <asm-generic/bitops/hweight.h>
814 * way of searching a 140-bit bitmap where the first 100 bits are 534#include <asm-generic/bitops/ext2-non-atomic.h>
815 * unlikely to be set. It's guaranteed that at least one of the 140 535#include <asm-generic/bitops/ext2-atomic.h>
816 * bits is cleared. 536#include <asm-generic/bitops/minix.h>
817 */
818static inline int sched_find_first_bit(const unsigned long *b)
819{
820#ifdef CONFIG_32BIT
821 if (unlikely(b[0]))
822 return __ffs(b[0]);
823 if (unlikely(b[1]))
824 return __ffs(b[1]) + 32;
825 if (unlikely(b[2]))
826 return __ffs(b[2]) + 64;
827 if (b[3])
828 return __ffs(b[3]) + 96;
829 return __ffs(b[4]) + 128;
830#endif
831#ifdef CONFIG_64BIT
832 if (unlikely(b[0]))
833 return __ffs(b[0]);
834 if (unlikely(b[1]))
835 return __ffs(b[1]) + 64;
836 return __ffs(b[2]) + 128;
837#endif
838}
839
840/*
841 * hweightN - returns the hamming weight of a N-bit word
842 * @x: the word to weigh
843 *
844 * The Hamming Weight of a number is the total number of bits set in it.
845 */
846
847#define hweight64(x) generic_hweight64(x)
848#define hweight32(x) generic_hweight32(x)
849#define hweight16(x) generic_hweight16(x)
850#define hweight8(x) generic_hweight8(x)
851
852static inline int __test_and_set_le_bit(unsigned long nr, unsigned long *addr)
853{
854 unsigned char *ADDR = (unsigned char *) addr;
855 int mask, retval;
856
857 ADDR += nr >> 3;
858 mask = 1 << (nr & 0x07);
859 retval = (mask & *ADDR) != 0;
860 *ADDR |= mask;
861
862 return retval;
863}
864
865static inline int __test_and_clear_le_bit(unsigned long nr, unsigned long *addr)
866{
867 unsigned char *ADDR = (unsigned char *) addr;
868 int mask, retval;
869
870 ADDR += nr >> 3;
871 mask = 1 << (nr & 0x07);
872 retval = (mask & *ADDR) != 0;
873 *ADDR &= ~mask;
874
875 return retval;
876}
877
878static inline int test_le_bit(unsigned long nr, const unsigned long * addr)
879{
880 const unsigned char *ADDR = (const unsigned char *) addr;
881 int mask;
882
883 ADDR += nr >> 3;
884 mask = 1 << (nr & 0x07);
885
886 return ((mask & *ADDR) != 0);
887}
888
889static inline unsigned long find_next_zero_le_bit(unsigned long *addr,
890 unsigned long size, unsigned long offset)
891{
892 unsigned long *p = ((unsigned long *) addr) + (offset >> SZLONG_LOG);
893 unsigned long result = offset & ~SZLONG_MASK;
894 unsigned long tmp;
895
896 if (offset >= size)
897 return size;
898 size -= result;
899 offset &= SZLONG_MASK;
900 if (offset) {
901 tmp = cpu_to_lelongp(p++);
902 tmp |= ~0UL >> (_MIPS_SZLONG-offset); /* bug or feature ? */
903 if (size < _MIPS_SZLONG)
904 goto found_first;
905 if (~tmp)
906 goto found_middle;
907 size -= _MIPS_SZLONG;
908 result += _MIPS_SZLONG;
909 }
910 while (size & ~SZLONG_MASK) {
911 if (~(tmp = cpu_to_lelongp(p++)))
912 goto found_middle;
913 result += _MIPS_SZLONG;
914 size -= _MIPS_SZLONG;
915 }
916 if (!size)
917 return result;
918 tmp = cpu_to_lelongp(p);
919
920found_first:
921 tmp |= ~0UL << size;
922 if (tmp == ~0UL) /* Are any bits zero? */
923 return result + size; /* Nope. */
924
925found_middle:
926 return result + ffz(tmp);
927}
928
929#define find_first_zero_le_bit(addr, size) \
930 find_next_zero_le_bit((addr), (size), 0)
931
932#define ext2_set_bit(nr,addr) \
933 __test_and_set_le_bit((nr),(unsigned long*)addr)
934#define ext2_clear_bit(nr, addr) \
935 __test_and_clear_le_bit((nr),(unsigned long*)addr)
936 #define ext2_set_bit_atomic(lock, nr, addr) \
937({ \
938 int ret; \
939 spin_lock(lock); \
940 ret = ext2_set_bit((nr), (addr)); \
941 spin_unlock(lock); \
942 ret; \
943})
944
945#define ext2_clear_bit_atomic(lock, nr, addr) \
946({ \
947 int ret; \
948 spin_lock(lock); \
949 ret = ext2_clear_bit((nr), (addr)); \
950 spin_unlock(lock); \
951 ret; \
952})
953#define ext2_test_bit(nr, addr) test_le_bit((nr),(unsigned long*)addr)
954#define ext2_find_first_zero_bit(addr, size) \
955 find_first_zero_le_bit((unsigned long*)addr, size)
956#define ext2_find_next_zero_bit(addr, size, off) \
957 find_next_zero_le_bit((unsigned long*)addr, size, off)
958
959/*
960 * Bitmap functions for the minix filesystem.
961 *
962 * FIXME: These assume that Minix uses the native byte/bitorder.
963 * This limits the Minix filesystem's value for data exchange very much.
964 */
965#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
966#define minix_set_bit(nr,addr) set_bit(nr,addr)
967#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
968#define minix_test_bit(nr,addr) test_bit(nr,addr)
969#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
970 537
971#endif /* __KERNEL__ */ 538#endif /* __KERNEL__ */
972 539
diff --git a/include/asm-mips/byteorder.h b/include/asm-mips/byteorder.h
index 584f8128fffd..aefc02f16fd8 100644
--- a/include/asm-mips/byteorder.h
+++ b/include/asm-mips/byteorder.h
@@ -39,6 +39,24 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
39} 39}
40#define __arch__swab32(x) ___arch__swab32(x) 40#define __arch__swab32(x) ___arch__swab32(x)
41 41
42#ifdef CONFIG_CPU_MIPS64_R2
43
44static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
45{
46 __asm__(
47 " dsbh %0, %1 \n"
48 " dshd %0, %0 \n"
49 " drotr %0, %0, 32 \n"
50 : "=r" (x)
51 : "r" (x));
52
53 return x;
54}
55
56#define __arch__swab64(x) ___arch__swab64(x)
57
58#endif /* CONFIG_CPU_MIPS64_R2 */
59
42#endif /* CONFIG_CPU_MIPSR2 */ 60#endif /* CONFIG_CPU_MIPSR2 */
43 61
44#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) 62#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
index 35d2604fe69c..986511db54a6 100644
--- a/include/asm-mips/compat.h
+++ b/include/asm-mips/compat.h
@@ -128,17 +128,22 @@ typedef u32 compat_sigset_word;
128 */ 128 */
129typedef u32 compat_uptr_t; 129typedef u32 compat_uptr_t;
130 130
131static inline void *compat_ptr(compat_uptr_t uptr) 131static inline void __user *compat_ptr(compat_uptr_t uptr)
132{ 132{
133 return (void *)(long)uptr; 133 return (void __user *)(long)uptr;
134} 134}
135 135
136static inline void *compat_alloc_user_space(long len) 136static inline compat_uptr_t ptr_to_compat(void __user *uptr)
137{
138 return (u32)(unsigned long)uptr;
139}
140
141static inline void __user *compat_alloc_user_space(long len)
137{ 142{
138 struct pt_regs *regs = (struct pt_regs *) 143 struct pt_regs *regs = (struct pt_regs *)
139 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1; 144 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
140 145
141 return (void *) (regs->regs[29] - len); 146 return (void __user *) (regs->regs[29] - len);
142} 147}
143#if defined (__MIPSEL__) 148#if defined (__MIPSEL__)
144#define __COMPAT_ENDIAN_SWAP__ 1 149#define __COMPAT_ENDIAN_SWAP__ 1
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index 78c9cc2735d5..3f2b6d9ac45e 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -96,6 +96,9 @@
96#ifndef cpu_has_ic_fills_f_dc 96#ifndef cpu_has_ic_fills_f_dc
97#define cpu_has_ic_fills_f_dc (cpu_data[0].icache.flags & MIPS_CACHE_IC_F_DC) 97#define cpu_has_ic_fills_f_dc (cpu_data[0].icache.flags & MIPS_CACHE_IC_F_DC)
98#endif 98#endif
99#ifndef cpu_has_pindexed_dcache
100#define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
101#endif
99 102
100/* 103/*
101 * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors 104 * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index d5cf519f8fcc..140be1c67da7 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -39,6 +39,7 @@ struct cache_desc {
39#define MIPS_CACHE_ALIASES 0x00000004 /* Cache could have aliases */ 39#define MIPS_CACHE_ALIASES 0x00000004 /* Cache could have aliases */
40#define MIPS_CACHE_IC_F_DC 0x00000008 /* Ic can refill from D-cache */ 40#define MIPS_CACHE_IC_F_DC 0x00000008 /* Ic can refill from D-cache */
41#define MIPS_IC_SNOOPS_REMOTE 0x00000010 /* Ic snoops remote stores */ 41#define MIPS_IC_SNOOPS_REMOTE 0x00000010 /* Ic snoops remote stores */
42#define MIPS_CACHE_PINDEX 0x00000020 /* Physically indexed cache */
42 43
43struct cpuinfo_mips { 44struct cpuinfo_mips {
44 unsigned long udelay_val; 45 unsigned long udelay_val;
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
index 2454c44a8f54..a554089991f2 100644
--- a/include/asm-mips/futex.h
+++ b/include/asm-mips/futex.h
@@ -99,5 +99,11 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
99 return ret; 99 return ret;
100} 100}
101 101
102static inline int
103futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
104{
105 return -ENOSYS;
106}
107
102#endif 108#endif
103#endif 109#endif
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index 6111a0ce58c4..feb29a793888 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -3,7 +3,9 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2003, 2004 Ralf Baechle 6 * Copyright (C) 2003, 2004 Ralf Baechle <ralf@linux-mips.org>
7 * Copyright (C) MIPS Technologies, Inc.
8 * written by Ralf Baechle <ralf@linux-mips.org>
7 */ 9 */
8#ifndef _ASM_HAZARDS_H 10#ifndef _ASM_HAZARDS_H
9#define _ASM_HAZARDS_H 11#define _ASM_HAZARDS_H
@@ -74,8 +76,7 @@
74#define irq_disable_hazard 76#define irq_disable_hazard
75 _ehb 77 _ehb
76 78
77#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) || \ 79#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000)
78 defined(CONFIG_CPU_SB1)
79 80
80/* 81/*
81 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. 82 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
@@ -99,13 +100,13 @@
99#else /* __ASSEMBLY__ */ 100#else /* __ASSEMBLY__ */
100 101
101__asm__( 102__asm__(
102 " .macro _ssnop \n\t" 103 " .macro _ssnop \n"
103 " sll $0, $0, 1 \n\t" 104 " sll $0, $0, 1 \n"
104 " .endm \n\t" 105 " .endm \n"
105 " \n\t" 106 " \n"
106 " .macro _ehb \n\t" 107 " .macro _ehb \n"
107 " sll $0, $0, 3 \n\t" 108 " sll $0, $0, 3 \n"
108 " .endm \n\t"); 109 " .endm \n");
109 110
110#ifdef CONFIG_CPU_RM9000 111#ifdef CONFIG_CPU_RM9000
111 112
@@ -117,17 +118,21 @@ __asm__(
117 118
118#define mtc0_tlbw_hazard() \ 119#define mtc0_tlbw_hazard() \
119 __asm__ __volatile__( \ 120 __asm__ __volatile__( \
120 ".set\tmips32\n\t" \ 121 " .set mips32 \n" \
121 "_ssnop; _ssnop; _ssnop; _ssnop\n\t" \ 122 " _ssnop \n" \
122 ".set\tmips0") 123 " _ssnop \n" \
124 " _ssnop \n" \
125 " _ssnop \n" \
126 " .set mips0 \n")
123 127
124#define tlbw_use_hazard() \ 128#define tlbw_use_hazard() \
125 __asm__ __volatile__( \ 129 __asm__ __volatile__( \
126 ".set\tmips32\n\t" \ 130 " .set mips32 \n" \
127 "_ssnop; _ssnop; _ssnop; _ssnop\n\t" \ 131 " _ssnop \n" \
128 ".set\tmips0") 132 " _ssnop \n" \
129 133 " _ssnop \n" \
130#define back_to_back_c0_hazard() do { } while (0) 134 " _ssnop \n" \
135 " .set mips0 \n")
131 136
132#else 137#else
133 138
@@ -136,15 +141,25 @@ __asm__(
136 */ 141 */
137#define mtc0_tlbw_hazard() \ 142#define mtc0_tlbw_hazard() \
138 __asm__ __volatile__( \ 143 __asm__ __volatile__( \
139 ".set noreorder\n\t" \ 144 " .set noreorder \n" \
140 "nop; nop; nop; nop; nop; nop;\n\t" \ 145 " nop \n" \
141 ".set reorder\n\t") 146 " nop \n" \
147 " nop \n" \
148 " nop \n" \
149 " nop \n" \
150 " nop \n" \
151 " .set reorder \n")
142 152
143#define tlbw_use_hazard() \ 153#define tlbw_use_hazard() \
144 __asm__ __volatile__( \ 154 __asm__ __volatile__( \
145 ".set noreorder\n\t" \ 155 " .set noreorder \n" \
146 "nop; nop; nop; nop; nop; nop;\n\t" \ 156 " nop \n" \
147 ".set reorder\n\t") 157 " nop \n" \
158 " nop \n" \
159 " nop \n" \
160 " nop \n" \
161 " nop \n" \
162 " .set reorder \n")
148 163
149#endif 164#endif
150 165
@@ -156,49 +171,26 @@ __asm__(
156 171
157#ifdef CONFIG_CPU_MIPSR2 172#ifdef CONFIG_CPU_MIPSR2
158 173
159__asm__( 174__asm__(" .macro irq_enable_hazard \n"
160 " .macro\tirq_enable_hazard \n\t" 175 " _ehb \n"
161 " _ehb \n\t" 176 " .endm \n"
162 " .endm \n\t" 177 " \n"
163 " \n\t" 178 " .macro irq_disable_hazard \n"
164 " .macro\tirq_disable_hazard \n\t" 179 " _ehb \n"
165 " _ehb \n\t" 180 " .endm \n");
166 " .endm \n\t"
167 " \n\t"
168 " .macro\tback_to_back_c0_hazard \n\t"
169 " _ehb \n\t"
170 " .endm");
171
172#define irq_enable_hazard() \
173 __asm__ __volatile__( \
174 "irq_enable_hazard")
175 181
176#define irq_disable_hazard() \ 182#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000)
177 __asm__ __volatile__( \
178 "irq_disable_hazard")
179
180#define back_to_back_c0_hazard() \
181 __asm__ __volatile__( \
182 "back_to_back_c0_hazard")
183
184#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) || \
185 defined(CONFIG_CPU_SB1)
186 183
187/* 184/*
188 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. 185 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
189 */ 186 */
190 187
191__asm__( 188__asm__(
192 " .macro\tirq_enable_hazard \n\t" 189 " .macro irq_enable_hazard \n"
193 " .endm \n\t" 190 " .endm \n"
194 " \n\t" 191 " \n"
195 " .macro\tirq_disable_hazard \n\t" 192 " .macro irq_disable_hazard \n"
196 " .endm"); 193 " .endm \n");
197
198#define irq_enable_hazard() do { } while (0)
199#define irq_disable_hazard() do { } while (0)
200
201#define back_to_back_c0_hazard() do { } while (0)
202 194
203#else 195#else
204 196
@@ -209,29 +201,63 @@ __asm__(
209 */ 201 */
210 202
211__asm__( 203__asm__(
212 " # \n\t" 204 " # \n"
213 " # There is a hazard but we do not care \n\t" 205 " # There is a hazard but we do not care \n"
214 " # \n\t" 206 " # \n"
215 " .macro\tirq_enable_hazard \n\t" 207 " .macro\tirq_enable_hazard \n"
216 " .endm \n\t" 208 " .endm \n"
217 " \n\t" 209 " \n"
218 " .macro\tirq_disable_hazard \n\t" 210 " .macro\tirq_disable_hazard \n"
219 " _ssnop; _ssnop; _ssnop \n\t" 211 " _ssnop \n"
220 " .endm"); 212 " _ssnop \n"
213 " _ssnop \n"
214 " .endm \n");
221 215
222#define irq_enable_hazard() do { } while (0) 216#endif
217
218#define irq_enable_hazard() \
219 __asm__ __volatile__("irq_enable_hazard")
223#define irq_disable_hazard() \ 220#define irq_disable_hazard() \
224 __asm__ __volatile__( \ 221 __asm__ __volatile__("irq_disable_hazard")
225 "irq_disable_hazard")
226 222
227#define back_to_back_c0_hazard() \ 223
228 __asm__ __volatile__( \ 224/*
229 " .set noreorder \n" \ 225 * Back-to-back hazards -
230 " nop; nop; nop \n" \ 226 *
231 " .set reorder \n") 227 * What is needed to separate a move to cp0 from a subsequent read from the
228 * same cp0 register?
229 */
230#ifdef CONFIG_CPU_MIPSR2
231
232__asm__(" .macro back_to_back_c0_hazard \n"
233 " _ehb \n"
234 " .endm \n");
235
236#elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) || \
237 defined(CONFIG_CPU_SB1)
238
239__asm__(" .macro back_to_back_c0_hazard \n"
240 " .endm \n");
241
242#else
243
244__asm__(" .macro back_to_back_c0_hazard \n"
245 " .set noreorder \n"
246 " _ssnop \n"
247 " _ssnop \n"
248 " _ssnop \n"
249 " .set reorder \n"
250 " .endm");
232 251
233#endif 252#endif
234 253
254#define back_to_back_c0_hazard() \
255 __asm__ __volatile__("back_to_back_c0_hazard")
256
257
258/*
259 * Instruction execution hazard
260 */
235#ifdef CONFIG_CPU_MIPSR2 261#ifdef CONFIG_CPU_MIPSR2
236/* 262/*
237 * gcc has a tradition of misscompiling the previous construct using the 263 * gcc has a tradition of misscompiling the previous construct using the
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 8c011aa61afa..6b17eb9d79a5 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -4,7 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1994, 1995 Waldorf GmbH 6 * Copyright (C) 1994, 1995 Waldorf GmbH
7 * Copyright (C) 1994 - 2000 Ralf Baechle 7 * Copyright (C) 1994 - 2000, 06 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. 9 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
10 * Author: Maciej W. Rozycki <macro@mips.com> 10 * Author: Maciej W. Rozycki <macro@mips.com>
@@ -40,56 +40,13 @@
40 * hardware. An example use would be for flash memory that's used for 40 * hardware. An example use would be for flash memory that's used for
41 * execute in place. 41 * execute in place.
42 */ 42 */
43# define __raw_ioswabb(x) (x) 43# define __raw_ioswabb(a,x) (x)
44# define __raw_ioswabw(x) (x) 44# define __raw_ioswabw(a,x) (x)
45# define __raw_ioswabl(x) (x) 45# define __raw_ioswabl(a,x) (x)
46# define __raw_ioswabq(x) (x) 46# define __raw_ioswabq(a,x) (x)
47# define ____raw_ioswabq(x) (x) 47# define ____raw_ioswabq(a,x) (x)
48 48
49/* 49/* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */
50 * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
51 * less sane hardware forces software to fiddle with this...
52 *
53 * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
54 * you can't have the numerical value of data and byte addresses within
55 * multibyte quantities both preserved at the same time. Hence two
56 * variations of functions: non-prefixed ones that preserve the value
57 * and prefixed ones that preserve byte addresses. The latters are
58 * typically used for moving raw data between a peripheral and memory (cf.
59 * string I/O functions), hence the "__mem_" prefix.
60 */
61#if defined(CONFIG_SWAP_IO_SPACE)
62
63# define ioswabb(x) (x)
64# define __mem_ioswabb(x) (x)
65# ifdef CONFIG_SGI_IP22
66/*
67 * IP22 seems braindead enough to swap 16bits values in hardware, but
68 * not 32bits. Go figure... Can't tell without documentation.
69 */
70# define ioswabw(x) (x)
71# define __mem_ioswabw(x) le16_to_cpu(x)
72# else
73# define ioswabw(x) le16_to_cpu(x)
74# define __mem_ioswabw(x) (x)
75# endif
76# define ioswabl(x) le32_to_cpu(x)
77# define __mem_ioswabl(x) (x)
78# define ioswabq(x) le64_to_cpu(x)
79# define __mem_ioswabq(x) (x)
80
81#else
82
83# define ioswabb(x) (x)
84# define __mem_ioswabb(x) (x)
85# define ioswabw(x) (x)
86# define __mem_ioswabw(x) cpu_to_le16(x)
87# define ioswabl(x) (x)
88# define __mem_ioswabl(x) cpu_to_le32(x)
89# define ioswabq(x) (x)
90# define __mem_ioswabq(x) cpu_to_le32(x)
91
92#endif
93 50
94#define IO_SPACE_LIMIT 0xffff 51#define IO_SPACE_LIMIT 0xffff
95 52
@@ -103,8 +60,20 @@
103 */ 60 */
104extern const unsigned long mips_io_port_base; 61extern const unsigned long mips_io_port_base;
105 62
106#define set_io_port_base(base) \ 63/*
107 do { * (unsigned long *) &mips_io_port_base = (base); } while (0) 64 * Gcc will generate code to load the value of mips_io_port_base after each
65 * function call which may be fairly wasteful in some cases. So we don't
66 * play quite by the book. We tell gcc mips_io_port_base is a long variable
67 * which solves the code generation issue. Now we need to violate the
68 * aliasing rules a little to make initialization possible and finally we
69 * will need the barrier() to fight side effects of the aliasing chat.
70 * This trickery will eventually collapse under gcc's optimizer. Oh well.
71 */
72static inline void set_io_port_base(unsigned long base)
73{
74 * (unsigned long *) &mips_io_port_base = base;
75 barrier();
76}
108 77
109/* 78/*
110 * Thanks to James van Artsdalen for a better timing-fix than 79 * Thanks to James van Artsdalen for a better timing-fix than
@@ -334,7 +303,7 @@ static inline void pfx##write##bwlq(type val, \
334 \ 303 \
335 __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \ 304 __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
336 \ 305 \
337 __val = pfx##ioswab##bwlq(val); \ 306 __val = pfx##ioswab##bwlq(__mem, val); \
338 \ 307 \
339 if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \ 308 if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
340 *__mem = __val; \ 309 *__mem = __val; \
@@ -389,7 +358,7 @@ static inline type pfx##read##bwlq(const volatile void __iomem *mem) \
389 BUG(); \ 358 BUG(); \
390 } \ 359 } \
391 \ 360 \
392 return pfx##ioswab##bwlq(__val); \ 361 return pfx##ioswab##bwlq(__mem, __val); \
393} 362}
394 363
395#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow) \ 364#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow) \
@@ -399,10 +368,9 @@ static inline void pfx##out##bwlq##p(type val, unsigned long port) \
399 volatile type *__addr; \ 368 volatile type *__addr; \
400 type __val; \ 369 type __val; \
401 \ 370 \
402 port = __swizzle_addr_##bwlq(port); \ 371 __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
403 __addr = (void *)(mips_io_port_base + port); \
404 \ 372 \
405 __val = pfx##ioswab##bwlq(val); \ 373 __val = pfx##ioswab##bwlq(__addr, val); \
406 \ 374 \
407 /* Really, we want this to be atomic */ \ 375 /* Really, we want this to be atomic */ \
408 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ 376 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
@@ -416,15 +384,14 @@ static inline type pfx##in##bwlq##p(unsigned long port) \
416 volatile type *__addr; \ 384 volatile type *__addr; \
417 type __val; \ 385 type __val; \
418 \ 386 \
419 port = __swizzle_addr_##bwlq(port); \ 387 __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
420 __addr = (void *)(mips_io_port_base + port); \
421 \ 388 \
422 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \ 389 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
423 \ 390 \
424 __val = *__addr; \ 391 __val = *__addr; \
425 slow; \ 392 slow; \
426 \ 393 \
427 return pfx##ioswab##bwlq(__val); \ 394 return pfx##ioswab##bwlq(__addr, __val); \
428} 395}
429 396
430#define __BUILD_MEMORY_PFX(bus, bwlq, type) \ 397#define __BUILD_MEMORY_PFX(bus, bwlq, type) \
@@ -589,24 +556,11 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
589 */ 556 */
590#define __ISA_IO_base ((char *)(isa_slot_offset)) 557#define __ISA_IO_base ((char *)(isa_slot_offset))
591 558
592#define isa_readb(a) readb(__ISA_IO_base + (a))
593#define isa_readw(a) readw(__ISA_IO_base + (a))
594#define isa_readl(a) readl(__ISA_IO_base + (a))
595#define isa_readq(a) readq(__ISA_IO_base + (a))
596#define isa_writeb(b,a) writeb(b,__ISA_IO_base + (a))
597#define isa_writew(w,a) writew(w,__ISA_IO_base + (a))
598#define isa_writel(l,a) writel(l,__ISA_IO_base + (a))
599#define isa_writeq(q,a) writeq(q,__ISA_IO_base + (a))
600#define isa_memset_io(a,b,c) memset_io(__ISA_IO_base + (a),(b),(c))
601#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),__ISA_IO_base + (b),(c))
602#define isa_memcpy_toio(a,b,c) memcpy_toio(__ISA_IO_base + (a),(b),(c))
603
604/* 559/*
605 * We don't have csum_partial_copy_fromio() yet, so we cheat here and 560 * We don't have csum_partial_copy_fromio() yet, so we cheat here and
606 * just copy it. The net code will then do the checksum later. 561 * just copy it. The net code will then do the checksum later.
607 */ 562 */
608#define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len)) 563#define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len))
609#define isa_eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(b),(c),(d))
610 564
611/* 565/*
612 * check_signature - find BIOS signatures 566 * check_signature - find BIOS signatures
diff --git a/include/asm-mips/linkage.h b/include/asm-mips/linkage.h
index 291c2d01c44f..b6185d3cfe68 100644
--- a/include/asm-mips/linkage.h
+++ b/include/asm-mips/linkage.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_LINKAGE_H 1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H 2#define __ASM_LINKAGE_H
3 3
4/* Nothing to see here... */ 4#ifdef __ASSEMBLY__
5#include <asm/asm.h>
6#endif
5 7
6#endif 8#endif
diff --git a/include/asm-mips/mach-cobalt/cobalt.h b/include/asm-mips/mach-cobalt/cobalt.h
index 78e1df2095fb..b3c5ecbec03c 100644
--- a/include/asm-mips/mach-cobalt/cobalt.h
+++ b/include/asm-mips/mach-cobalt/cobalt.h
@@ -113,4 +113,6 @@ do { \
113# define COBALT_KEY_SELECT (1 << 7) 113# define COBALT_KEY_SELECT (1 << 7)
114# define COBALT_KEY_MASK 0xfe 114# define COBALT_KEY_MASK 0xfe
115 115
116#define COBALT_UART ((volatile unsigned char *) CKSEG1ADDR(0x1c800000))
117
116#endif /* __ASM_COBALT_H */ 118#endif /* __ASM_COBALT_H */
diff --git a/include/asm-mips/mach-generic/mangle-port.h b/include/asm-mips/mach-generic/mangle-port.h
index 4a98d83b8ec7..6e1b0c075de7 100644
--- a/include/asm-mips/mach-generic/mangle-port.h
+++ b/include/asm-mips/mach-generic/mangle-port.h
@@ -13,4 +13,40 @@
13#define __swizzle_addr_l(port) (port) 13#define __swizzle_addr_l(port) (port)
14#define __swizzle_addr_q(port) (port) 14#define __swizzle_addr_q(port) (port)
15 15
16/*
17 * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
18 * less sane hardware forces software to fiddle with this...
19 *
20 * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
21 * you can't have the numerical value of data and byte addresses within
22 * multibyte quantities both preserved at the same time. Hence two
23 * variations of functions: non-prefixed ones that preserve the value
24 * and prefixed ones that preserve byte addresses. The latters are
25 * typically used for moving raw data between a peripheral and memory (cf.
26 * string I/O functions), hence the "__mem_" prefix.
27 */
28#if defined(CONFIG_SWAP_IO_SPACE)
29
30# define ioswabb(a,x) (x)
31# define __mem_ioswabb(a,x) (x)
32# define ioswabw(a,x) le16_to_cpu(x)
33# define __mem_ioswabw(a,x) (x)
34# define ioswabl(a,x) le32_to_cpu(x)
35# define __mem_ioswabl(a,x) (x)
36# define ioswabq(a,x) le64_to_cpu(x)
37# define __mem_ioswabq(a,x) (x)
38
39#else
40
41# define ioswabb(a,x) (x)
42# define __mem_ioswabb(a,x) (x)
43# define ioswabw(a,x) (x)
44# define __mem_ioswabw(a,x) cpu_to_le16(x)
45# define ioswabl(a,x) (x)
46# define __mem_ioswabl(a,x) cpu_to_le32(x)
47# define ioswabq(a,x) (x)
48# define __mem_ioswabq(a,x) cpu_to_le32(x)
49
50#endif
51
16#endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */ 52#endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-ip27/mangle-port.h b/include/asm-mips/mach-ip27/mangle-port.h
index f76c44880451..d615312a451a 100644
--- a/include/asm-mips/mach-ip27/mangle-port.h
+++ b/include/asm-mips/mach-ip27/mangle-port.h
@@ -13,4 +13,13 @@
13#define __swizzle_addr_l(port) (port) 13#define __swizzle_addr_l(port) (port)
14#define __swizzle_addr_q(port) (port) 14#define __swizzle_addr_q(port) (port)
15 15
16# define ioswabb(a,x) (x)
17# define __mem_ioswabb(a,x) (x)
18# define ioswabw(a,x) (x)
19# define __mem_ioswabw(a,x) cpu_to_le16(x)
20# define ioswabl(a,x) (x)
21# define __mem_ioswabl(a,x) cpu_to_le32(x)
22# define ioswabq(a,x) (x)
23# define __mem_ioswabq(a,x) cpu_to_le32(x)
24
16#endif /* __ASM_MACH_IP27_MANGLE_PORT_H */ 25#endif /* __ASM_MACH_IP27_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-ip32/mangle-port.h b/include/asm-mips/mach-ip32/mangle-port.h
index 6e25b52ed8f2..81320eb55324 100644
--- a/include/asm-mips/mach-ip32/mangle-port.h
+++ b/include/asm-mips/mach-ip32/mangle-port.h
@@ -14,4 +14,13 @@
14#define __swizzle_addr_l(port) (port) 14#define __swizzle_addr_l(port) (port)
15#define __swizzle_addr_q(port) (port) 15#define __swizzle_addr_q(port) (port)
16 16
17# define ioswabb(a,x) (x)
18# define __mem_ioswabb(a,x) (x)
19# define ioswabw(a,x) (x)
20# define __mem_ioswabw(a,x) cpu_to_le16(x)
21# define ioswabl(a,x) (x)
22# define __mem_ioswabl(a,x) cpu_to_le32(x)
23# define ioswabq(a,x) (x)
24# define __mem_ioswabq(a,x) cpu_to_le32(x)
25
17#endif /* __ASM_MACH_IP32_MANGLE_PORT_H */ 26#endif /* __ASM_MACH_IP32_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-mips/cpu-feature-overrides.h b/include/asm-mips/mach-mips/cpu-feature-overrides.h
index 9f92aed17754..e06af6c86f86 100644
--- a/include/asm-mips/mach-mips/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-mips/cpu-feature-overrides.h
@@ -29,7 +29,11 @@
29/* #define cpu_has_prefetch ? */ 29/* #define cpu_has_prefetch ? */
30#define cpu_has_mcheck 1 30#define cpu_has_mcheck 1
31/* #define cpu_has_ejtag ? */ 31/* #define cpu_has_ejtag ? */
32#ifdef CONFIG_CPU_HAS_LLSC
32#define cpu_has_llsc 1 33#define cpu_has_llsc 1
34#else
35#define cpu_has_llsc 0
36#endif
33/* #define cpu_has_vtag_icache ? */ 37/* #define cpu_has_vtag_icache ? */
34/* #define cpu_has_dc_aliases ? */ 38/* #define cpu_has_dc_aliases ? */
35/* #define cpu_has_ic_fills_f_dc ? */ 39/* #define cpu_has_ic_fills_f_dc ? */
diff --git a/include/asm-mips/mc146818-time.h b/include/asm-mips/mc146818-time.h
index 47214861093b..41ac8d363c67 100644
--- a/include/asm-mips/mc146818-time.h
+++ b/include/asm-mips/mc146818-time.h
@@ -86,43 +86,14 @@ static inline int mc146818_set_rtc_mmss(unsigned long nowtime)
86 return retval; 86 return retval;
87} 87}
88 88
89/*
90 * Returns true if a clock update is in progress
91 */
92static inline unsigned char rtc_is_updating(void)
93{
94 unsigned char uip;
95 unsigned long flags;
96
97 spin_lock_irqsave(&rtc_lock, flags);
98 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
99 spin_unlock_irqrestore(&rtc_lock, flags);
100 return uip;
101}
102
103static inline unsigned long mc146818_get_cmos_time(void) 89static inline unsigned long mc146818_get_cmos_time(void)
104{ 90{
105 unsigned int year, mon, day, hour, min, sec; 91 unsigned int year, mon, day, hour, min, sec;
106 int i;
107 unsigned long flags; 92 unsigned long flags;
108 93
109 /*
110 * The Linux interpretation of the CMOS clock register contents:
111 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
112 * RTC registers show the second which has precisely just started.
113 * Let's hope other operating systems interpret the RTC the same way.
114 */
115
116 /* read RTC exactly on falling edge of update flag */
117 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
118 if (rtc_is_updating())
119 break;
120 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
121 if (!rtc_is_updating())
122 break;
123
124 spin_lock_irqsave(&rtc_lock, flags); 94 spin_lock_irqsave(&rtc_lock, flags);
125 do { /* Isn't this overkill ? UIP above should guarantee consistency */ 95
96 do {
126 sec = CMOS_READ(RTC_SECONDS); 97 sec = CMOS_READ(RTC_SECONDS);
127 min = CMOS_READ(RTC_MINUTES); 98 min = CMOS_READ(RTC_MINUTES);
128 hour = CMOS_READ(RTC_HOURS); 99 hour = CMOS_READ(RTC_HOURS);
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index 19cdf7642e66..61cf22588137 100644
--- a/include/asm-mips/mmu_context.h
+++ b/include/asm-mips/mmu_context.h
@@ -33,12 +33,7 @@ extern unsigned long pgd_current[];
33 write_c0_context((unsigned long) smp_processor_id() << 25); \ 33 write_c0_context((unsigned long) smp_processor_id() << 25); \
34 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 34 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
35#endif 35#endif
36#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) 36#ifdef CONFIG_64BIT
37#define TLBMISS_HANDLER_SETUP() \
38 write_c0_context((unsigned long) &pgd_current[smp_processor_id()] << 23); \
39 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
40#endif
41#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
42#define TLBMISS_HANDLER_SETUP() \ 37#define TLBMISS_HANDLER_SETUP() \
43 write_c0_context((unsigned long) smp_processor_id() << 26); \ 38 write_c0_context((unsigned long) smp_processor_id() << 26); \
44 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) 39 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
diff --git a/include/asm-mips/mmzone.h b/include/asm-mips/mmzone.h
index 011caebac369..7bde4432092b 100644
--- a/include/asm-mips/mmzone.h
+++ b/include/asm-mips/mmzone.h
@@ -22,20 +22,6 @@
22 NODE_DATA(__n)->node_spanned_pages) : 0);\ 22 NODE_DATA(__n)->node_spanned_pages) : 0);\
23}) 23})
24 24
25#define pfn_to_page(pfn) \
26({ \
27 unsigned long __pfn = (pfn); \
28 pg_data_t *__pg = NODE_DATA(pfn_to_nid(__pfn)); \
29 __pg->node_mem_map + (__pfn - __pg->node_start_pfn); \
30})
31
32#define page_to_pfn(p) \
33({ \
34 struct page *__p = (p); \
35 struct zone *__z = page_zone(__p); \
36 ((__p - __z->zone_mem_map) + __z->zone_start_pfn); \
37})
38
39/* XXX: FIXME -- wli */ 25/* XXX: FIXME -- wli */
40#define kern_addr_valid(addr) (0) 26#define kern_addr_valid(addr) (0)
41 27
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index ee25a779bf49..a1eab136ff6c 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -140,8 +140,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
140#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 140#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
141 141
142#ifndef CONFIG_NEED_MULTIPLE_NODES 142#ifndef CONFIG_NEED_MULTIPLE_NODES
143#define pfn_to_page(pfn) (mem_map + (pfn))
144#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
145#define pfn_valid(pfn) ((pfn) < max_mapnr) 143#define pfn_valid(pfn) ((pfn) < max_mapnr)
146#endif 144#endif
147 145
@@ -160,6 +158,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
160#define WANT_PAGE_VIRTUAL 158#define WANT_PAGE_VIRTUAL
161#endif 159#endif
162 160
161#include <asm-generic/memory_model.h>
163#include <asm-generic/page.h> 162#include <asm-generic/page.h>
164 163
165#endif /* _ASM_PAGE_H */ 164#endif /* _ASM_PAGE_H */
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index 0cff64ce0fb8..4d6bc45df594 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -206,7 +206,7 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
206 /* fixme */ 206 /* fixme */
207#define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f)) 207#define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f))
208#define pgoff_to_pte(off) \ 208#define pgoff_to_pte(off) \
209 ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)}) 209 ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)})
210 210
211#else 211#else
212#define pte_to_pgoff(_pte) \ 212#define pte_to_pgoff(_pte) \
diff --git a/include/asm-mips/poll.h b/include/asm-mips/poll.h
index a000f1f789e3..70881f8c5c50 100644
--- a/include/asm-mips/poll.h
+++ b/include/asm-mips/poll.h
@@ -17,6 +17,7 @@
17/* These seem to be more or less nonstandard ... */ 17/* These seem to be more or less nonstandard ... */
18#define POLLMSG 0x0400 18#define POLLMSG 0x0400
19#define POLLREMOVE 0x1000 19#define POLLREMOVE 0x1000
20#define POLLRDHUP 0x2000
20 21
21struct pollfd { 22struct pollfd {
22 int fd; 23 int fd;
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
index 9632c27dad15..90c374700977 100644
--- a/include/asm-mips/r4kcache.h
+++ b/include/asm-mips/r4kcache.h
@@ -257,7 +257,8 @@ static inline void blast_##pfx##cache##lsize##_page(unsigned long page) \
257 \ 257 \
258static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \ 258static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \
259{ \ 259{ \
260 unsigned long start = page; \ 260 unsigned long indexmask = current_cpu_data.desc.waysize - 1; \
261 unsigned long start = INDEX_BASE + (page & indexmask); \
261 unsigned long end = start + PAGE_SIZE; \ 262 unsigned long end = start + PAGE_SIZE; \
262 unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \ 263 unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
263 unsigned long ws_end = current_cpu_data.desc.ways << \ 264 unsigned long ws_end = current_cpu_data.desc.ways << \
@@ -302,5 +303,6 @@ __BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, )
302__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, ) 303__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, )
303/* blast_inv_dcache_range */ 304/* blast_inv_dcache_range */
304__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, ) 305__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, )
306__BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD, )
305 307
306#endif /* _ASM_R4KCACHE_H */ 308#endif /* _ASM_R4KCACHE_H */
diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h
index e796d75f027e..7b2366412203 100644
--- a/include/asm-mips/serial.h
+++ b/include/asm-mips/serial.h
@@ -103,88 +103,6 @@
103#define IVR_SERIAL_PORT_DEFNS 103#define IVR_SERIAL_PORT_DEFNS
104#endif 104#endif
105 105
106#ifdef CONFIG_SERIAL_AU1X00
107#include <asm/mach-au1x00/au1000.h>
108#ifdef CONFIG_SOC_AU1000
109#define AU1000_SERIAL_PORT_DEFNS \
110 { .baud_base = 0, .port = UART0_ADDR, \
111 .iomem_base = (unsigned char *)UART0_ADDR, \
112 .irq = AU1000_UART0_INT, .flags = STD_COM_FLAGS, \
113 .iomem_reg_shift = 2 }, \
114 { .baud_base = 0, .port = UART1_ADDR, \
115 .iomem_base = (unsigned char *)UART1_ADDR, \
116 .irq = AU1000_UART1_INT, .flags = STD_COM_FLAGS, \
117 .iomem_reg_shift = 2 }, \
118 { .baud_base = 0, .port = UART2_ADDR, \
119 .iomem_base = (unsigned char *)UART2_ADDR, \
120 .irq = AU1000_UART2_INT, .flags = STD_COM_FLAGS, \
121 .iomem_reg_shift = 2 }, \
122 { .baud_base = 0, .port = UART3_ADDR, \
123 .iomem_base = (unsigned char *)UART3_ADDR, \
124 .irq = AU1000_UART3_INT, .flags = STD_COM_FLAGS, \
125 .iomem_reg_shift = 2 },
126#endif
127
128#ifdef CONFIG_SOC_AU1500
129#define AU1000_SERIAL_PORT_DEFNS \
130 { .baud_base = 0, .port = UART0_ADDR, \
131 .iomem_base = (unsigned char *)UART0_ADDR, \
132 .irq = AU1500_UART0_INT, .flags = STD_COM_FLAGS, \
133 .iomem_reg_shift = 2 }, \
134 { .baud_base = 0, .port = UART3_ADDR, \
135 .iomem_base = (unsigned char *)UART3_ADDR, \
136 .irq = AU1500_UART3_INT, .flags = STD_COM_FLAGS, \
137 .iomem_reg_shift = 2 },
138#endif
139
140#ifdef CONFIG_SOC_AU1100
141#define AU1000_SERIAL_PORT_DEFNS \
142 { .baud_base = 0, .port = UART0_ADDR, \
143 .iomem_base = (unsigned char *)UART0_ADDR, \
144 .irq = AU1100_UART0_INT, .flags = STD_COM_FLAGS, \
145 .iomem_reg_shift = 2 }, \
146 { .baud_base = 0, .port = UART1_ADDR, \
147 .iomem_base = (unsigned char *)UART1_ADDR, \
148 .irq = AU1100_UART1_INT, .flags = STD_COM_FLAGS, \
149 .iomem_reg_shift = 2 }, \
150 { .baud_base = 0, .port = UART3_ADDR, \
151 .iomem_base = (unsigned char *)UART3_ADDR, \
152 .irq = AU1100_UART3_INT, .flags = STD_COM_FLAGS, \
153 .iomem_reg_shift = 2 },
154#endif
155
156#ifdef CONFIG_SOC_AU1550
157#define AU1000_SERIAL_PORT_DEFNS \
158 { .baud_base = 0, .port = UART0_ADDR, \
159 .iomem_base = (unsigned char *)UART0_ADDR, \
160 .irq = AU1550_UART0_INT, .flags = STD_COM_FLAGS, \
161 .iomem_reg_shift = 2 }, \
162 { .baud_base = 0, .port = UART1_ADDR, \
163 .iomem_base = (unsigned char *)UART1_ADDR, \
164 .irq = AU1550_UART1_INT, .flags = STD_COM_FLAGS, \
165 .iomem_reg_shift = 2 }, \
166 { .baud_base = 0, .port = UART3_ADDR, \
167 .iomem_base = (unsigned char *)UART3_ADDR, \
168 .irq = AU1550_UART3_INT, .flags = STD_COM_FLAGS,\
169 .iomem_reg_shift = 2 },
170#endif
171
172#ifdef CONFIG_SOC_AU1200
173#define AU1000_SERIAL_PORT_DEFNS \
174 { .baud_base = 0, .port = UART0_ADDR, \
175 .iomem_base = (unsigned char *)UART0_ADDR, \
176 .irq = AU1200_UART0_INT, .flags = STD_COM_FLAGS, \
177 .iomem_reg_shift = 2 }, \
178 { .baud_base = 0, .port = UART1_ADDR, \
179 .iomem_base = (unsigned char *)UART1_ADDR, \
180 .irq = AU1200_UART1_INT, .flags = STD_COM_FLAGS, \
181 .iomem_reg_shift = 2 },
182#endif
183
184#else
185#define AU1000_SERIAL_PORT_DEFNS
186#endif
187
188#ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT 106#ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
189#define STD_SERIAL_PORT_DEFNS \ 107#define STD_SERIAL_PORT_DEFNS \
190 /* UART CLK PORT IRQ FLAGS */ \ 108 /* UART CLK PORT IRQ FLAGS */ \
@@ -331,7 +249,6 @@
331 MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \ 249 MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
332 MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \ 250 MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS \
333 MOMENCO_OCELOT_SERIAL_PORT_DEFNS \ 251 MOMENCO_OCELOT_SERIAL_PORT_DEFNS \
334 MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS \ 252 MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
335 AU1000_SERIAL_PORT_DEFNS
336 253
337#endif /* _ASM_SERIAL_H */ 254#endif /* _ASM_SERIAL_H */
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h
index a474c29cd701..b09e16c93ca0 100644
--- a/include/asm-mips/sibyte/sb1250.h
+++ b/include/asm-mips/sibyte/sb1250.h
@@ -45,8 +45,8 @@ extern unsigned int soc_type;
45extern unsigned int periph_rev; 45extern unsigned int periph_rev;
46extern unsigned int zbbus_mhz; 46extern unsigned int zbbus_mhz;
47 47
48extern void sb1250_hpt_setup(void);
48extern void sb1250_time_init(void); 49extern void sb1250_time_init(void);
49extern unsigned long sb1250_gettimeoffset(void);
50extern void sb1250_mask_irq(int cpu, int irq); 50extern void sb1250_mask_irq(int cpu, int irq);
51extern void sb1250_unmask_irq(int cpu, int irq); 51extern void sb1250_unmask_irq(int cpu, int irq);
52extern void sb1250_smp_finish(void); 52extern void sb1250_smp_finish(void);
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h
index a667bc14a7cd..f4178bdcfcb0 100644
--- a/include/asm-mips/sibyte/sb1250_scd.h
+++ b/include/asm-mips/sibyte/sb1250_scd.h
@@ -359,14 +359,15 @@
359 */ 359 */
360 360
361#define V_SCD_TIMER_FREQ 1000000 361#define V_SCD_TIMER_FREQ 1000000
362#define V_SCD_TIMER_WIDTH 23
362 363
363#define S_SCD_TIMER_INIT 0 364#define S_SCD_TIMER_INIT 0
364#define M_SCD_TIMER_INIT _SB_MAKEMASK(20,S_SCD_TIMER_INIT) 365#define M_SCD_TIMER_INIT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_INIT)
365#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT) 366#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT)
366#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT) 367#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT)
367 368
368#define S_SCD_TIMER_CNT 0 369#define S_SCD_TIMER_CNT 0
369#define M_SCD_TIMER_CNT _SB_MAKEMASK(20,S_SCD_TIMER_CNT) 370#define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_CNT)
370#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT) 371#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT)
371#define G_SCD_TIMER_CNT(x) _SB_GETVALUE(x,S_SCD_TIMER_CNT,M_SCD_TIMER_CNT) 372#define G_SCD_TIMER_CNT(x) _SB_GETVALUE(x,S_SCD_TIMER_CNT,M_SCD_TIMER_CNT)
372 373
diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h
index 6fe903e09c62..d8349e4b55ee 100644
--- a/include/asm-mips/signal.h
+++ b/include/asm-mips/signal.h
@@ -147,16 +147,34 @@ struct k_sigaction {
147 147
148/* IRIX compatible stack_t */ 148/* IRIX compatible stack_t */
149typedef struct sigaltstack { 149typedef struct sigaltstack {
150 void *ss_sp; 150 void __user *ss_sp;
151 size_t ss_size; 151 size_t ss_size;
152 int ss_flags; 152 int ss_flags;
153} stack_t; 153} stack_t;
154 154
155#ifdef __KERNEL__ 155#ifdef __KERNEL__
156#include <asm/sigcontext.h> 156#include <asm/sigcontext.h>
157#include <asm/siginfo.h>
157 158
158#define ptrace_signal_deliver(regs, cookie) do { } while (0) 159#define ptrace_signal_deliver(regs, cookie) do { } while (0)
159 160
161struct pt_regs;
162extern void do_signal(struct pt_regs *regs);
163extern void do_signal32(struct pt_regs *regs);
164
165extern int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
166 int signr, sigset_t *set);
167extern int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
168 int signr, sigset_t *set, siginfo_t *info);
169
170extern int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
171 int signr, sigset_t *set);
172extern int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
173 int signr, sigset_t *set, siginfo_t *info);
174
175extern int setup_rt_frame_n32(struct k_sigaction * ka, struct pt_regs *regs,
176 int signr, sigset_t *set, siginfo_t *info);
177
160#endif /* __KERNEL__ */ 178#endif /* __KERNEL__ */
161 179
162#endif /* _ASM_SIGNAL_H */ 180#endif /* _ASM_SIGNAL_H */
diff --git a/include/asm-mips/sn/klconfig.h b/include/asm-mips/sn/klconfig.h
index d028e28d6239..9709ff701d9b 100644
--- a/include/asm-mips/sn/klconfig.h
+++ b/include/asm-mips/sn/klconfig.h
@@ -99,7 +99,7 @@ typedef s32 klconf_off_t;
99#define ENABLE_BOARD 0x01 99#define ENABLE_BOARD 0x01
100#define FAILED_BOARD 0x02 100#define FAILED_BOARD 0x02
101#define DUPLICATE_BOARD 0x04 /* Boards like midplanes/routers which 101#define DUPLICATE_BOARD 0x04 /* Boards like midplanes/routers which
102 are discovered twice. Use one of them */ 102 are discovered twice. Use one of them */
103#define VISITED_BOARD 0x08 /* Used for compact hub numbering. */ 103#define VISITED_BOARD 0x08 /* Used for compact hub numbering. */
104#define LOCAL_MASTER_IO6 0x10 /* master io6 for that node */ 104#define LOCAL_MASTER_IO6 0x10 /* master io6 for that node */
105#define GLOBAL_MASTER_IO6 0x20 105#define GLOBAL_MASTER_IO6 0x20
diff --git a/include/asm-mips/sn/mapped_kernel.h b/include/asm-mips/sn/mapped_kernel.h
index 3a17846df849..59edb20f8ec5 100644
--- a/include/asm-mips/sn/mapped_kernel.h
+++ b/include/asm-mips/sn/mapped_kernel.h
@@ -23,11 +23,7 @@
23#include <linux/config.h> 23#include <linux/config.h>
24#include <asm/addrspace.h> 24#include <asm/addrspace.h>
25 25
26#ifdef CONFIG_BUILD_ELF64
27#define REP_BASE CAC_BASE 26#define REP_BASE CAC_BASE
28#else
29#define REP_BASE CKSEG0
30#endif
31 27
32#ifdef CONFIG_MAPPED_KERNEL 28#ifdef CONFIG_MAPPED_KERNEL
33 29
diff --git a/include/asm-mips/sn/sn0/hubio.h b/include/asm-mips/sn/sn0/hubio.h
index 80cf6a52ed3b..f314da21b970 100644
--- a/include/asm-mips/sn/sn0/hubio.h
+++ b/include/asm-mips/sn/sn0/hubio.h
@@ -229,7 +229,7 @@ typedef union hubii_ilcsr_u {
229 icsr_llp_en: 1, /* LLP enable bit */ 229 icsr_llp_en: 1, /* LLP enable bit */
230 icsr_rsvd2: 1, /* reserver */ 230 icsr_rsvd2: 1, /* reserver */
231 icsr_wrm_reset: 1, /* Warm reset bit */ 231 icsr_wrm_reset: 1, /* Warm reset bit */
232 icsr_rsvd1: 2, /* Data ready offset */ 232 icsr_rsvd1: 2, /* Data ready offset */
233 icsr_null_to: 6; /* Null timeout */ 233 icsr_null_to: 6; /* Null timeout */
234 234
235 } icsr_fields_s; 235 } icsr_fields_s;
@@ -274,9 +274,9 @@ typedef union io_perf_sel {
274 u64 perf_sel_reg; 274 u64 perf_sel_reg;
275 struct { 275 struct {
276 u64 perf_rsvd : 48, 276 u64 perf_rsvd : 48,
277 perf_icct : 8, 277 perf_icct : 8,
278 perf_ippr1 : 4, 278 perf_ippr1 : 4,
279 perf_ippr0 : 4; 279 perf_ippr0 : 4;
280 } perf_sel_bits; 280 } perf_sel_bits;
281} io_perf_sel_t; 281} io_perf_sel_t;
282 282
@@ -287,8 +287,8 @@ typedef union io_perf_cnt {
287 u64 perf_cnt; 287 u64 perf_cnt;
288 struct { 288 struct {
289 u64 perf_rsvd1 : 32, 289 u64 perf_rsvd1 : 32,
290 perf_rsvd2 : 12, 290 perf_rsvd2 : 12,
291 perf_cnt : 20; 291 perf_cnt : 20;
292 } perf_cnt_bits; 292 } perf_cnt_bits;
293} io_perf_cnt_t; 293} io_perf_cnt_t;
294 294
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index a8919dcc93c8..2acf3e844f00 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -63,17 +63,7 @@
63 addu k1, k0 63 addu k1, k0
64 LONG_L k1, %lo(kernelsp)(k1) 64 LONG_L k1, %lo(kernelsp)(k1)
65#endif 65#endif
66#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) 66#ifdef CONFIG_64BIT
67 MFC0 k1, CP0_CONTEXT
68 dsra k1, 23
69 lui k0, %hi(pgd_current)
70 addiu k0, %lo(pgd_current)
71 dsubu k1, k0
72 lui k0, %hi(kernelsp)
73 daddu k1, k0
74 LONG_L k1, %lo(kernelsp)(k1)
75#endif
76#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
77 MFC0 k1, CP0_CONTEXT 67 MFC0 k1, CP0_CONTEXT
78 lui k0, %highest(kernelsp) 68 lui k0, %highest(kernelsp)
79 dsrl k1, 23 69 dsrl k1, 23
@@ -91,11 +81,7 @@
91 mfc0 \temp, CP0_CONTEXT 81 mfc0 \temp, CP0_CONTEXT
92 srl \temp, 23 82 srl \temp, 23
93#endif 83#endif
94#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) 84#ifdef CONFIG_64BIT
95 lw \temp, TI_CPU(gp)
96 dsll \temp, 3
97#endif
98#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
99 MFC0 \temp, CP0_CONTEXT 85 MFC0 \temp, CP0_CONTEXT
100 dsrl \temp, 23 86 dsrl \temp, 23
101#endif 87#endif
@@ -103,7 +89,7 @@
103 .endm 89 .endm
104#else 90#else
105 .macro get_saved_sp /* Uniprocessor variation */ 91 .macro get_saved_sp /* Uniprocessor variation */
106#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64) 92#ifdef CONFIG_64BIT
107 lui k1, %highest(kernelsp) 93 lui k1, %highest(kernelsp)
108 daddiu k1, %higher(kernelsp) 94 daddiu k1, %higher(kernelsp)
109 dsll k1, k1, 16 95 dsll k1, k1, 16
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index ddae9bae31af..4097fac5ac3c 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -286,10 +286,10 @@ extern void __xchg_called_with_bad_pointer(void);
286static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) 286static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
287{ 287{
288 switch (size) { 288 switch (size) {
289 case 4: 289 case 4:
290 return __xchg_u32(ptr, x); 290 return __xchg_u32(ptr, x);
291 case 8: 291 case 8:
292 return __xchg_u64(ptr, x); 292 return __xchg_u64(ptr, x);
293 } 293 }
294 __xchg_called_with_bad_pointer(); 294 __xchg_called_with_bad_pointer();
295 return x; 295 return x;
diff --git a/include/asm-mips/termbits.h b/include/asm-mips/termbits.h
index c29c65b7818e..fa6d04dac56b 100644
--- a/include/asm-mips/termbits.h
+++ b/include/asm-mips/termbits.h
@@ -77,7 +77,7 @@ struct termios {
77#define IXANY 0004000 /* Any character will restart after stop. */ 77#define IXANY 0004000 /* Any character will restart after stop. */
78#define IXOFF 0010000 /* Enable start/stop input control. */ 78#define IXOFF 0010000 /* Enable start/stop input control. */
79#define IMAXBEL 0020000 /* Ring bell when input queue is full. */ 79#define IMAXBEL 0020000 /* Ring bell when input queue is full. */
80#define IUTF8 0040000 /* Input is UTF8 */ 80#define IUTF8 0040000 /* Input is UTF-8 */
81 81
82/* c_oflag bits */ 82/* c_oflag bits */
83#define OPOST 0000001 /* Perform output processing. */ 83#define OPOST 0000001 /* Perform output processing. */
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index fa193f861e71..f8d97dafd2f4 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -31,7 +31,7 @@ struct thread_info {
31 int preempt_count; /* 0 => preemptable, <0 => BUG */ 31 int preempt_count; /* 0 => preemptable, <0 => BUG */
32 32
33 mm_segment_t addr_limit; /* thread address space: 33 mm_segment_t addr_limit; /* thread address space:
34 0-0xBFFFFFFF for user-thead 34 0-0xBFFFFFFF for user-thead
35 0-0xFFFFFFFF for kernel-thread 35 0-0xFFFFFFFF for kernel-thread
36 */ 36 */
37 struct restart_block restart_block; 37 struct restart_block restart_block;
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index 9cc3564cc2c9..d897c8bb554d 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -26,14 +26,14 @@ extern spinlock_t rtc_lock;
26 26
27/* 27/*
28 * RTC ops. By default, they point to no-RTC functions. 28 * RTC ops. By default, they point to no-RTC functions.
29 * rtc_get_time - mktime(year, mon, day, hour, min, sec) in seconds. 29 * rtc_mips_get_time - mktime(year, mon, day, hour, min, sec) in seconds.
30 * rtc_set_time - reverse the above translation and set time to RTC. 30 * rtc_mips_set_time - reverse the above translation and set time to RTC.
31 * rtc_set_mmss - similar to rtc_set_time, but only min and sec need 31 * rtc_mips_set_mmss - similar to rtc_set_time, but only min and sec need
32 * to be set. Used by RTC sync-up. 32 * to be set. Used by RTC sync-up.
33 */ 33 */
34extern unsigned long (*rtc_get_time)(void); 34extern unsigned long (*rtc_mips_get_time)(void);
35extern int (*rtc_set_time)(unsigned long); 35extern int (*rtc_mips_set_time)(unsigned long);
36extern int (*rtc_set_mmss)(unsigned long); 36extern int (*rtc_mips_set_mmss)(unsigned long);
37 37
38/* 38/*
39 * Timer interrupt functions. 39 * Timer interrupt functions.
diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h
index 421b3aea14cc..cd2813d8e136 100644
--- a/include/asm-mips/types.h
+++ b/include/asm-mips/types.h
@@ -99,6 +99,11 @@ typedef u64 sector_t;
99#define HAVE_SECTOR_T 99#define HAVE_SECTOR_T
100#endif 100#endif
101 101
102#ifdef CONFIG_LSF
103typedef u64 blkcnt_t;
104#define HAVE_BLKCNT_T
105#endif
106
102#endif /* __ASSEMBLY__ */ 107#endif /* __ASSEMBLY__ */
103 108
104#endif /* __KERNEL__ */ 109#endif /* __KERNEL__ */
diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h
index 4dc7253ff5d0..403ea97316cf 100644
--- a/include/asm-parisc/atomic.h
+++ b/include/asm-parisc/atomic.h
@@ -210,6 +210,8 @@ static __inline__ int atomic_read(const atomic_t *v)
210 210
211#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0) 211#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)
212 212
213#define atomic_sub_and_test(i,v) (atomic_sub_return((i),(v)) == 0)
214
213#define ATOMIC_INIT(i) ((atomic_t) { (i) }) 215#define ATOMIC_INIT(i) ((atomic_t) { (i) })
214 216
215#define smp_mb__before_atomic_dec() smp_mb() 217#define smp_mb__before_atomic_dec() smp_mb()
@@ -267,6 +269,7 @@ atomic64_read(const atomic64_t *v)
267 269
268#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0) 270#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
269#define atomic64_dec_and_test(v) (atomic64_dec_return(v) == 0) 271#define atomic64_dec_and_test(v) (atomic64_dec_return(v) == 0)
272#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i),(v)) == 0)
270 273
271#endif /* __LP64__ */ 274#endif /* __LP64__ */
272 275
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h
index 15d8c2b51584..900561922c4c 100644
--- a/include/asm-parisc/bitops.h
+++ b/include/asm-parisc/bitops.h
@@ -35,13 +35,6 @@ static __inline__ void set_bit(int nr, volatile unsigned long * addr)
35 _atomic_spin_unlock_irqrestore(addr, flags); 35 _atomic_spin_unlock_irqrestore(addr, flags);
36} 36}
37 37
38static __inline__ void __set_bit(unsigned long nr, volatile unsigned long * addr)
39{
40 unsigned long *m = (unsigned long *) addr + (nr >> SHIFT_PER_LONG);
41
42 *m |= 1UL << CHOP_SHIFTCOUNT(nr);
43}
44
45static __inline__ void clear_bit(int nr, volatile unsigned long * addr) 38static __inline__ void clear_bit(int nr, volatile unsigned long * addr)
46{ 39{
47 unsigned long mask = ~(1UL << CHOP_SHIFTCOUNT(nr)); 40 unsigned long mask = ~(1UL << CHOP_SHIFTCOUNT(nr));
@@ -53,13 +46,6 @@ static __inline__ void clear_bit(int nr, volatile unsigned long * addr)
53 _atomic_spin_unlock_irqrestore(addr, flags); 46 _atomic_spin_unlock_irqrestore(addr, flags);
54} 47}
55 48
56static __inline__ void __clear_bit(unsigned long nr, volatile unsigned long * addr)
57{
58 unsigned long *m = (unsigned long *) addr + (nr >> SHIFT_PER_LONG);
59
60 *m &= ~(1UL << CHOP_SHIFTCOUNT(nr));
61}
62
63static __inline__ void change_bit(int nr, volatile unsigned long * addr) 49static __inline__ void change_bit(int nr, volatile unsigned long * addr)
64{ 50{
65 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); 51 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
@@ -71,13 +57,6 @@ static __inline__ void change_bit(int nr, volatile unsigned long * addr)
71 _atomic_spin_unlock_irqrestore(addr, flags); 57 _atomic_spin_unlock_irqrestore(addr, flags);
72} 58}
73 59
74static __inline__ void __change_bit(unsigned long nr, volatile unsigned long * addr)
75{
76 unsigned long *m = (unsigned long *) addr + (nr >> SHIFT_PER_LONG);
77
78 *m ^= 1UL << CHOP_SHIFTCOUNT(nr);
79}
80
81static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr) 60static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr)
82{ 61{
83 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); 62 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
@@ -93,18 +72,6 @@ static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr)
93 return (oldbit & mask) ? 1 : 0; 72 return (oldbit & mask) ? 1 : 0;
94} 73}
95 74
96static __inline__ int __test_and_set_bit(int nr, volatile unsigned long * address)
97{
98 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
99 unsigned long oldbit;
100 unsigned long *addr = (unsigned long *)address + (nr >> SHIFT_PER_LONG);
101
102 oldbit = *addr;
103 *addr = oldbit | mask;
104
105 return (oldbit & mask) ? 1 : 0;
106}
107
108static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr) 75static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr)
109{ 76{
110 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); 77 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
@@ -120,18 +87,6 @@ static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr)
120 return (oldbit & mask) ? 1 : 0; 87 return (oldbit & mask) ? 1 : 0;
121} 88}
122 89
123static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long * address)
124{
125 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
126 unsigned long *addr = (unsigned long *)address + (nr >> SHIFT_PER_LONG);
127 unsigned long oldbit;
128
129 oldbit = *addr;
130 *addr = oldbit & ~mask;
131
132 return (oldbit & mask) ? 1 : 0;
133}
134
135static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr) 90static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr)
136{ 91{
137 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); 92 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
@@ -147,25 +102,7 @@ static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr)
147 return (oldbit & mask) ? 1 : 0; 102 return (oldbit & mask) ? 1 : 0;
148} 103}
149 104
150static __inline__ int __test_and_change_bit(int nr, volatile unsigned long * address) 105#include <asm-generic/bitops/non-atomic.h>
151{
152 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
153 unsigned long *addr = (unsigned long *)address + (nr >> SHIFT_PER_LONG);
154 unsigned long oldbit;
155
156 oldbit = *addr;
157 *addr = oldbit ^ mask;
158
159 return (oldbit & mask) ? 1 : 0;
160}
161
162static __inline__ int test_bit(int nr, const volatile unsigned long *address)
163{
164 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
165 const unsigned long *addr = (const unsigned long *)address + (nr >> SHIFT_PER_LONG);
166
167 return !!(*addr & mask);
168}
169 106
170#ifdef __KERNEL__ 107#ifdef __KERNEL__
171 108
@@ -219,8 +156,7 @@ static __inline__ unsigned long __ffs(unsigned long x)
219 return ret; 156 return ret;
220} 157}
221 158
222/* Undefined if no bit is zero. */ 159#include <asm-generic/bitops/ffz.h>
223#define ffz(x) __ffs(~x)
224 160
225/* 161/*
226 * ffs: find first bit set. returns 1 to BITS_PER_LONG or 0 (if none set) 162 * ffs: find first bit set. returns 1 to BITS_PER_LONG or 0 (if none set)
@@ -263,155 +199,22 @@ static __inline__ int fls(int x)
263 199
264 return ret; 200 return ret;
265} 201}
266#define fls64(x) generic_fls64(x)
267 202
268/* 203#include <asm-generic/bitops/fls64.h>
269 * hweightN: returns the hamming weight (i.e. the number 204#include <asm-generic/bitops/hweight.h>
270 * of bits set) of a N-bit word 205#include <asm-generic/bitops/sched.h>
271 */
272#define hweight64(x) generic_hweight64(x)
273#define hweight32(x) generic_hweight32(x)
274#define hweight16(x) generic_hweight16(x)
275#define hweight8(x) generic_hweight8(x)
276
277/*
278 * Every architecture must define this function. It's the fastest
279 * way of searching a 140-bit bitmap where the first 100 bits are
280 * unlikely to be set. It's guaranteed that at least one of the 140
281 * bits is cleared.
282 */
283static inline int sched_find_first_bit(const unsigned long *b)
284{
285#ifdef __LP64__
286 if (unlikely(b[0]))
287 return __ffs(b[0]);
288 if (unlikely(b[1]))
289 return __ffs(b[1]) + 64;
290 return __ffs(b[2]) + 128;
291#else
292 if (unlikely(b[0]))
293 return __ffs(b[0]);
294 if (unlikely(b[1]))
295 return __ffs(b[1]) + 32;
296 if (unlikely(b[2]))
297 return __ffs(b[2]) + 64;
298 if (b[3])
299 return __ffs(b[3]) + 96;
300 return __ffs(b[4]) + 128;
301#endif
302}
303 206
304#endif /* __KERNEL__ */ 207#endif /* __KERNEL__ */
305 208
306/* 209#include <asm-generic/bitops/find.h>
307 * This implementation of find_{first,next}_zero_bit was stolen from
308 * Linus' asm-alpha/bitops.h.
309 */
310#define find_first_zero_bit(addr, size) \
311 find_next_zero_bit((addr), (size), 0)
312
313static __inline__ unsigned long find_next_zero_bit(const void * addr, unsigned long size, unsigned long offset)
314{
315 const unsigned long * p = ((unsigned long *) addr) + (offset >> SHIFT_PER_LONG);
316 unsigned long result = offset & ~(BITS_PER_LONG-1);
317 unsigned long tmp;
318
319 if (offset >= size)
320 return size;
321 size -= result;
322 offset &= (BITS_PER_LONG-1);
323 if (offset) {
324 tmp = *(p++);
325 tmp |= ~0UL >> (BITS_PER_LONG-offset);
326 if (size < BITS_PER_LONG)
327 goto found_first;
328 if (~tmp)
329 goto found_middle;
330 size -= BITS_PER_LONG;
331 result += BITS_PER_LONG;
332 }
333 while (size & ~(BITS_PER_LONG -1)) {
334 if (~(tmp = *(p++)))
335 goto found_middle;
336 result += BITS_PER_LONG;
337 size -= BITS_PER_LONG;
338 }
339 if (!size)
340 return result;
341 tmp = *p;
342found_first:
343 tmp |= ~0UL << size;
344found_middle:
345 return result + ffz(tmp);
346}
347
348static __inline__ unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset)
349{
350 const unsigned long *p = addr + (offset >> SHIFT_PER_LONG);
351 unsigned long result = offset & ~(BITS_PER_LONG-1);
352 unsigned long tmp;
353
354 if (offset >= size)
355 return size;
356 size -= result;
357 offset &= (BITS_PER_LONG-1);
358 if (offset) {
359 tmp = *(p++);
360 tmp &= (~0UL << offset);
361 if (size < BITS_PER_LONG)
362 goto found_first;
363 if (tmp)
364 goto found_middle;
365 size -= BITS_PER_LONG;
366 result += BITS_PER_LONG;
367 }
368 while (size & ~(BITS_PER_LONG-1)) {
369 if ((tmp = *(p++)))
370 goto found_middle;
371 result += BITS_PER_LONG;
372 size -= BITS_PER_LONG;
373 }
374 if (!size)
375 return result;
376 tmp = *p;
377
378found_first:
379 tmp &= (~0UL >> (BITS_PER_LONG - size));
380 if (tmp == 0UL) /* Are any bits set? */
381 return result + size; /* Nope. */
382found_middle:
383 return result + __ffs(tmp);
384}
385
386/**
387 * find_first_bit - find the first set bit in a memory region
388 * @addr: The address to start the search at
389 * @size: The maximum size to search
390 *
391 * Returns the bit-number of the first set bit, not the number of the byte
392 * containing a bit.
393 */
394#define find_first_bit(addr, size) \
395 find_next_bit((addr), (size), 0)
396
397#define _EXT2_HAVE_ASM_BITOPS_
398 210
399#ifdef __KERNEL__ 211#ifdef __KERNEL__
400/* 212
401 * test_and_{set,clear}_bit guarantee atomicity without 213#include <asm-generic/bitops/ext2-non-atomic.h>
402 * disabling interrupts.
403 */
404 214
405/* '3' is bits per byte */ 215/* '3' is bits per byte */
406#define LE_BYTE_ADDR ((sizeof(unsigned long) - 1) << 3) 216#define LE_BYTE_ADDR ((sizeof(unsigned long) - 1) << 3)
407 217
408#define ext2_test_bit(nr, addr) \
409 test_bit((nr) ^ LE_BYTE_ADDR, (unsigned long *)addr)
410#define ext2_set_bit(nr, addr) \
411 __test_and_set_bit((nr) ^ LE_BYTE_ADDR, (unsigned long *)addr)
412#define ext2_clear_bit(nr, addr) \
413 __test_and_clear_bit((nr) ^ LE_BYTE_ADDR, (unsigned long *)addr)
414
415#define ext2_set_bit_atomic(l,nr,addr) \ 218#define ext2_set_bit_atomic(l,nr,addr) \
416 test_and_set_bit((nr) ^ LE_BYTE_ADDR, (unsigned long *)addr) 219 test_and_set_bit((nr) ^ LE_BYTE_ADDR, (unsigned long *)addr)
417#define ext2_clear_bit_atomic(l,nr,addr) \ 220#define ext2_clear_bit_atomic(l,nr,addr) \
@@ -419,77 +222,6 @@ found_middle:
419 222
420#endif /* __KERNEL__ */ 223#endif /* __KERNEL__ */
421 224
422 225#include <asm-generic/bitops/minix-le.h>
423#define ext2_find_first_zero_bit(addr, size) \
424 ext2_find_next_zero_bit((addr), (size), 0)
425
426/* include/linux/byteorder does not support "unsigned long" type */
427static inline unsigned long ext2_swabp(unsigned long * x)
428{
429#ifdef __LP64__
430 return (unsigned long) __swab64p((u64 *) x);
431#else
432 return (unsigned long) __swab32p((u32 *) x);
433#endif
434}
435
436/* include/linux/byteorder doesn't support "unsigned long" type */
437static inline unsigned long ext2_swab(unsigned long y)
438{
439#ifdef __LP64__
440 return (unsigned long) __swab64((u64) y);
441#else
442 return (unsigned long) __swab32((u32) y);
443#endif
444}
445
446static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
447{
448 unsigned long *p = (unsigned long *) addr + (offset >> SHIFT_PER_LONG);
449 unsigned long result = offset & ~(BITS_PER_LONG - 1);
450 unsigned long tmp;
451
452 if (offset >= size)
453 return size;
454 size -= result;
455 offset &= (BITS_PER_LONG - 1UL);
456 if (offset) {
457 tmp = ext2_swabp(p++);
458 tmp |= (~0UL >> (BITS_PER_LONG - offset));
459 if (size < BITS_PER_LONG)
460 goto found_first;
461 if (~tmp)
462 goto found_middle;
463 size -= BITS_PER_LONG;
464 result += BITS_PER_LONG;
465 }
466
467 while (size & ~(BITS_PER_LONG - 1)) {
468 if (~(tmp = *(p++)))
469 goto found_middle_swap;
470 result += BITS_PER_LONG;
471 size -= BITS_PER_LONG;
472 }
473 if (!size)
474 return result;
475 tmp = ext2_swabp(p);
476found_first:
477 tmp |= ~0UL << size;
478 if (tmp == ~0UL) /* Are any bits zero? */
479 return result + size; /* Nope. Skip ffz */
480found_middle:
481 return result + ffz(tmp);
482
483found_middle_swap:
484 return result + ffz(ext2_swab(tmp));
485}
486
487
488/* Bitmap functions for the minix filesystem. */
489#define minix_test_and_set_bit(nr,addr) ext2_set_bit(nr,addr)
490#define minix_set_bit(nr,addr) ((void)ext2_set_bit(nr,addr))
491#define minix_test_and_clear_bit(nr,addr) ext2_clear_bit(nr,addr)
492#define minix_test_bit(nr,addr) ext2_test_bit(nr,addr)
493#define minix_find_first_zero_bit(addr,size) ext2_find_first_zero_bit(addr,size)
494 226
495#endif /* _PARISC_BITOPS_H */ 227#endif /* _PARISC_BITOPS_H */
diff --git a/include/asm-parisc/cache.h b/include/asm-parisc/cache.h
index 93f179f13ce8..c831665473cb 100644
--- a/include/asm-parisc/cache.h
+++ b/include/asm-parisc/cache.h
@@ -29,6 +29,8 @@
29 29
30#define SMP_CACHE_BYTES L1_CACHE_BYTES 30#define SMP_CACHE_BYTES L1_CACHE_BYTES
31 31
32#define __read_mostly __attribute__((__section__(".data.read_mostly")))
33
32extern void flush_data_cache_local(void *); /* flushes local data-cache only */ 34extern void flush_data_cache_local(void *); /* flushes local data-cache only */
33extern void flush_instruction_cache_local(void *); /* flushes local code-cache only */ 35extern void flush_instruction_cache_local(void *); /* flushes local code-cache only */
34#ifdef CONFIG_SMP 36#ifdef CONFIG_SMP
@@ -46,7 +48,7 @@ extern void flush_user_icache_range_asm(unsigned long, unsigned long);
46extern void flush_kernel_icache_range_asm(unsigned long, unsigned long); 48extern void flush_kernel_icache_range_asm(unsigned long, unsigned long);
47extern void flush_user_dcache_range_asm(unsigned long, unsigned long); 49extern void flush_user_dcache_range_asm(unsigned long, unsigned long);
48extern void flush_kernel_dcache_range_asm(unsigned long, unsigned long); 50extern void flush_kernel_dcache_range_asm(unsigned long, unsigned long);
49extern void flush_kernel_dcache_page(void *); 51extern void flush_kernel_dcache_page_asm(void *);
50extern void flush_kernel_icache_page(void *); 52extern void flush_kernel_icache_page(void *);
51extern void disable_sr_hashing(void); /* turns off space register hashing */ 53extern void disable_sr_hashing(void); /* turns off space register hashing */
52extern void disable_sr_hashing_asm(int); /* low level support for above */ 54extern void disable_sr_hashing_asm(int); /* low level support for above */
diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h
index c53af9ff41b5..76b6b7d6046a 100644
--- a/include/asm-parisc/cacheflush.h
+++ b/include/asm-parisc/cacheflush.h
@@ -62,7 +62,7 @@ extern void flush_dcache_page(struct page *page);
62#define flush_dcache_mmap_unlock(mapping) \ 62#define flush_dcache_mmap_unlock(mapping) \
63 write_unlock_irq(&(mapping)->tree_lock) 63 write_unlock_irq(&(mapping)->tree_lock)
64 64
65#define flush_icache_page(vma,page) do { flush_kernel_dcache_page(page_address(page)); flush_kernel_icache_page(page_address(page)); } while (0) 65#define flush_icache_page(vma,page) do { flush_kernel_dcache_page(page); flush_kernel_icache_page(page_address(page)); } while (0)
66 66
67#define flush_icache_range(s,e) do { flush_kernel_dcache_range_asm(s,e); flush_kernel_icache_range_asm(s,e); } while (0) 67#define flush_icache_range(s,e) do { flush_kernel_dcache_range_asm(s,e); flush_kernel_icache_range_asm(s,e); } while (0)
68 68
@@ -184,6 +184,21 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long
184 184
185} 185}
186 186
187static inline void
188flush_anon_page(struct page *page, unsigned long vmaddr)
189{
190 if (PageAnon(page))
191 flush_user_dcache_page(vmaddr);
192}
193#define ARCH_HAS_FLUSH_ANON_PAGE
194
195static inline void
196flush_kernel_dcache_page(struct page *page)
197{
198 flush_kernel_dcache_page_asm(page_address(page));
199}
200#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
201
187#ifdef CONFIG_DEBUG_RODATA 202#ifdef CONFIG_DEBUG_RODATA
188void mark_rodata_ro(void); 203void mark_rodata_ro(void);
189#endif 204#endif
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h
index 38b918feead9..289624d8b2d4 100644
--- a/include/asm-parisc/compat.h
+++ b/include/asm-parisc/compat.h
@@ -138,6 +138,11 @@ static inline void __user *compat_ptr(compat_uptr_t uptr)
138 return (void __user *)(unsigned long)uptr; 138 return (void __user *)(unsigned long)uptr;
139} 139}
140 140
141static inline compat_uptr_t ptr_to_compat(void __user *uptr)
142{
143 return (u32)(unsigned long)uptr;
144}
145
141static __inline__ void __user *compat_alloc_user_space(long len) 146static __inline__ void __user *compat_alloc_user_space(long len)
142{ 147{
143 struct pt_regs *regs = &current->thread.regs; 148 struct pt_regs *regs = &current->thread.regs;
diff --git a/include/asm-parisc/io.h b/include/asm-parisc/io.h
index 0db00adc942a..29da31194b91 100644
--- a/include/asm-parisc/io.h
+++ b/include/asm-parisc/io.h
@@ -25,35 +25,11 @@ extern unsigned long parisc_vmerge_max_size;
25 * eg dev->hpa or 0xfee00000. 25 * eg dev->hpa or 0xfee00000.
26 */ 26 */
27 27
28#ifdef CONFIG_DEBUG_IOREMAP
29#ifdef CONFIG_64BIT
30#define NYBBLE_SHIFT 60
31#else
32#define NYBBLE_SHIFT 28
33#endif
34extern void gsc_bad_addr(unsigned long addr);
35extern void __raw_bad_addr(const volatile void __iomem *addr);
36#define gsc_check_addr(addr) \
37 if ((addr >> NYBBLE_SHIFT) != 0xf) { \
38 gsc_bad_addr(addr); \
39 addr |= 0xfUL << NYBBLE_SHIFT; \
40 }
41#define __raw_check_addr(addr) \
42 if (((unsigned long)addr >> NYBBLE_SHIFT) != 0xe) \
43 __raw_bad_addr(addr); \
44 addr = (void __iomem *)((unsigned long)addr | (0xfUL << NYBBLE_SHIFT));
45#else
46#define gsc_check_addr(addr)
47#define __raw_check_addr(addr)
48#endif
49
50static inline unsigned char gsc_readb(unsigned long addr) 28static inline unsigned char gsc_readb(unsigned long addr)
51{ 29{
52 long flags; 30 long flags;
53 unsigned char ret; 31 unsigned char ret;
54 32
55 gsc_check_addr(addr);
56
57 __asm__ __volatile__( 33 __asm__ __volatile__(
58 " rsm 2,%0\n" 34 " rsm 2,%0\n"
59 " ldbx 0(%2),%1\n" 35 " ldbx 0(%2),%1\n"
@@ -68,8 +44,6 @@ static inline unsigned short gsc_readw(unsigned long addr)
68 long flags; 44 long flags;
69 unsigned short ret; 45 unsigned short ret;
70 46
71 gsc_check_addr(addr);
72
73 __asm__ __volatile__( 47 __asm__ __volatile__(
74 " rsm 2,%0\n" 48 " rsm 2,%0\n"
75 " ldhx 0(%2),%1\n" 49 " ldhx 0(%2),%1\n"
@@ -83,8 +57,6 @@ static inline unsigned int gsc_readl(unsigned long addr)
83{ 57{
84 u32 ret; 58 u32 ret;
85 59
86 gsc_check_addr(addr);
87
88 __asm__ __volatile__( 60 __asm__ __volatile__(
89 " ldwax 0(%1),%0\n" 61 " ldwax 0(%1),%0\n"
90 : "=r" (ret) : "r" (addr) ); 62 : "=r" (ret) : "r" (addr) );
@@ -95,7 +67,6 @@ static inline unsigned int gsc_readl(unsigned long addr)
95static inline unsigned long long gsc_readq(unsigned long addr) 67static inline unsigned long long gsc_readq(unsigned long addr)
96{ 68{
97 unsigned long long ret; 69 unsigned long long ret;
98 gsc_check_addr(addr);
99 70
100#ifdef __LP64__ 71#ifdef __LP64__
101 __asm__ __volatile__( 72 __asm__ __volatile__(
@@ -112,8 +83,6 @@ static inline unsigned long long gsc_readq(unsigned long addr)
112static inline void gsc_writeb(unsigned char val, unsigned long addr) 83static inline void gsc_writeb(unsigned char val, unsigned long addr)
113{ 84{
114 long flags; 85 long flags;
115 gsc_check_addr(addr);
116
117 __asm__ __volatile__( 86 __asm__ __volatile__(
118 " rsm 2,%0\n" 87 " rsm 2,%0\n"
119 " stbs %1,0(%2)\n" 88 " stbs %1,0(%2)\n"
@@ -124,8 +93,6 @@ static inline void gsc_writeb(unsigned char val, unsigned long addr)
124static inline void gsc_writew(unsigned short val, unsigned long addr) 93static inline void gsc_writew(unsigned short val, unsigned long addr)
125{ 94{
126 long flags; 95 long flags;
127 gsc_check_addr(addr);
128
129 __asm__ __volatile__( 96 __asm__ __volatile__(
130 " rsm 2,%0\n" 97 " rsm 2,%0\n"
131 " sths %1,0(%2)\n" 98 " sths %1,0(%2)\n"
@@ -135,8 +102,6 @@ static inline void gsc_writew(unsigned short val, unsigned long addr)
135 102
136static inline void gsc_writel(unsigned int val, unsigned long addr) 103static inline void gsc_writel(unsigned int val, unsigned long addr)
137{ 104{
138 gsc_check_addr(addr);
139
140 __asm__ __volatile__( 105 __asm__ __volatile__(
141 " stwas %0,0(%1)\n" 106 " stwas %0,0(%1)\n"
142 : : "r" (val), "r" (addr) ); 107 : : "r" (val), "r" (addr) );
@@ -144,8 +109,6 @@ static inline void gsc_writel(unsigned int val, unsigned long addr)
144 109
145static inline void gsc_writeq(unsigned long long val, unsigned long addr) 110static inline void gsc_writeq(unsigned long long val, unsigned long addr)
146{ 111{
147 gsc_check_addr(addr);
148
149#ifdef __LP64__ 112#ifdef __LP64__
150 __asm__ __volatile__( 113 __asm__ __volatile__(
151 " stda %0,0(%1)\n" 114 " stda %0,0(%1)\n"
@@ -180,14 +143,7 @@ extern inline void * ioremap_nocache(unsigned long offset, unsigned long size)
180 143
181extern void iounmap(void __iomem *addr); 144extern void iounmap(void __iomem *addr);
182 145
183/*
184 * USE_HPPA_IOREMAP is the magic flag to enable or disable real ioremap()
185 * functionality. It's currently disabled because it may not work on some
186 * machines.
187 */
188#define USE_HPPA_IOREMAP 0
189 146
190#if USE_HPPA_IOREMAP
191static inline unsigned char __raw_readb(const volatile void __iomem *addr) 147static inline unsigned char __raw_readb(const volatile void __iomem *addr)
192{ 148{
193 return (*(volatile unsigned char __force *) (addr)); 149 return (*(volatile unsigned char __force *) (addr));
@@ -221,57 +177,6 @@ static inline void __raw_writeq(unsigned long long b, volatile void __iomem *add
221{ 177{
222 *(volatile unsigned long long __force *) addr = b; 178 *(volatile unsigned long long __force *) addr = b;
223} 179}
224#else /* !USE_HPPA_IOREMAP */
225static inline unsigned char __raw_readb(const volatile void __iomem *addr)
226{
227 __raw_check_addr(addr);
228
229 return gsc_readb((unsigned long) addr);
230}
231static inline unsigned short __raw_readw(const volatile void __iomem *addr)
232{
233 __raw_check_addr(addr);
234
235 return gsc_readw((unsigned long) addr);
236}
237static inline unsigned int __raw_readl(const volatile void __iomem *addr)
238{
239 __raw_check_addr(addr);
240
241 return gsc_readl((unsigned long) addr);
242}
243static inline unsigned long long __raw_readq(const volatile void __iomem *addr)
244{
245 __raw_check_addr(addr);
246
247 return gsc_readq((unsigned long) addr);
248}
249
250static inline void __raw_writeb(unsigned char b, volatile void __iomem *addr)
251{
252 __raw_check_addr(addr);
253
254 gsc_writeb(b, (unsigned long) addr);
255}
256static inline void __raw_writew(unsigned short b, volatile void __iomem *addr)
257{
258 __raw_check_addr(addr);
259
260 gsc_writew(b, (unsigned long) addr);
261}
262static inline void __raw_writel(unsigned int b, volatile void __iomem *addr)
263{
264 __raw_check_addr(addr);
265
266 gsc_writel(b, (unsigned long) addr);
267}
268static inline void __raw_writeq(unsigned long long b, volatile void __iomem *addr)
269{
270 __raw_check_addr(addr);
271
272 gsc_writeq(b, (unsigned long) addr);
273}
274#endif /* !USE_HPPA_IOREMAP */
275 180
276/* readb can never be const, so use __fswab instead of le*_to_cpu */ 181/* readb can never be const, so use __fswab instead of le*_to_cpu */
277#define readb(addr) __raw_readb(addr) 182#define readb(addr) __raw_readb(addr)
@@ -294,22 +199,6 @@ void memset_io(volatile void __iomem *addr, unsigned char val, int count);
294void memcpy_fromio(void *dst, const volatile void __iomem *src, int count); 199void memcpy_fromio(void *dst, const volatile void __iomem *src, int count);
295void memcpy_toio(volatile void __iomem *dst, const void *src, int count); 200void memcpy_toio(volatile void __iomem *dst, const void *src, int count);
296 201
297/* Support old drivers which don't ioremap.
298 * NB this interface is scheduled to disappear in 2.5
299 */
300
301#define __isa_addr(x) (void __iomem *)(F_EXTEND(0xfc000000) | (x))
302#define isa_readb(a) readb(__isa_addr(a))
303#define isa_readw(a) readw(__isa_addr(a))
304#define isa_readl(a) readl(__isa_addr(a))
305#define isa_writeb(b,a) writeb((b), __isa_addr(a))
306#define isa_writew(b,a) writew((b), __isa_addr(a))
307#define isa_writel(b,a) writel((b), __isa_addr(a))
308#define isa_memset_io(a,b,c) memset_io(__isa_addr(a), (b), (c))
309#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a), __isa_addr(b), (c))
310#define isa_memcpy_toio(a,b,c) memcpy_toio(__isa_addr(a), (b), (c))
311
312
313/* 202/*
314 * XXX - We don't have csum_partial_copy_fromio() yet, so we cheat here and 203 * XXX - We don't have csum_partial_copy_fromio() yet, so we cheat here and
315 * just copy it. The net code will then do the checksum later. Presently 204 * just copy it. The net code will then do the checksum later. Presently
@@ -318,8 +207,6 @@ void memcpy_toio(volatile void __iomem *dst, const void *src, int count);
318 207
319#define eth_io_copy_and_sum(skb,src,len,unused) \ 208#define eth_io_copy_and_sum(skb,src,len,unused) \
320 memcpy_fromio((skb)->data,(src),(len)) 209 memcpy_fromio((skb)->data,(src),(len))
321#define isa_eth_io_copy_and_sum(skb,src,len,unused) \
322 isa_memcpy_fromio((skb)->data,(src),(len))
323 210
324/* Port-space IO */ 211/* Port-space IO */
325 212
diff --git a/include/asm-parisc/local.h b/include/asm-parisc/local.h
index 892b3b2c4962..d0f550912755 100644
--- a/include/asm-parisc/local.h
+++ b/include/asm-parisc/local.h
@@ -4,16 +4,16 @@
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <asm/atomic.h> 5#include <asm/atomic.h>
6 6
7typedef atomic_t local_t; 7typedef atomic_long_t local_t;
8 8
9#define LOCAL_INIT(i) ATOMIC_INIT(i) 9#define LOCAL_INIT(i) ATOMIC_LONG_INIT(i)
10#define local_read(v) atomic_read(v) 10#define local_read(v) atomic_long_read(v)
11#define local_set(v,i) atomic_set(v,i) 11#define local_set(v,i) atomic_long_set(v,i)
12 12
13#define local_inc(v) atomic_inc(v) 13#define local_inc(v) atomic_long_inc(v)
14#define local_dec(v) atomic_dec(v) 14#define local_dec(v) atomic_long_dec(v)
15#define local_add(i, v) atomic_add(i, v) 15#define local_add(i, v) atomic_long_add(i, v)
16#define local_sub(i, v) atomic_sub(i, v) 16#define local_sub(i, v) atomic_long_sub(i, v)
17 17
18#define __local_inc(v) ((v)->counter++) 18#define __local_inc(v) ((v)->counter++)
19#define __local_dec(v) ((v)->counter--) 19#define __local_dec(v) ((v)->counter--)
diff --git a/include/asm-parisc/mmzone.h b/include/asm-parisc/mmzone.h
index ae039f4fd711..ceb9b73199d1 100644
--- a/include/asm-parisc/mmzone.h
+++ b/include/asm-parisc/mmzone.h
@@ -25,23 +25,6 @@ extern struct node_map_data node_data[];
25 pg_data_t *__pgdat = NODE_DATA(nid); \ 25 pg_data_t *__pgdat = NODE_DATA(nid); \
26 __pgdat->node_start_pfn + __pgdat->node_spanned_pages; \ 26 __pgdat->node_start_pfn + __pgdat->node_spanned_pages; \
27}) 27})
28#define node_localnr(pfn, nid) ((pfn) - node_start_pfn(nid))
29
30#define pfn_to_page(pfn) \
31({ \
32 unsigned long __pfn = (pfn); \
33 int __node = pfn_to_nid(__pfn); \
34 &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \
35})
36
37#define page_to_pfn(pg) \
38({ \
39 struct page *__page = pg; \
40 struct zone *__zone = page_zone(__page); \
41 BUG_ON(__zone == NULL); \
42 (unsigned long)(__page - __zone->zone_mem_map) \
43 + __zone->zone_start_pfn; \
44})
45 28
46/* We have these possible memory map layouts: 29/* We have these possible memory map layouts:
47 * Astro: 0-3.75, 67.75-68, 4-64 30 * Astro: 0-3.75, 67.75-68, 4-64
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h
index 4a6752b0afed..45e02aa5bf4b 100644
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -26,7 +26,7 @@ static inline void
26copy_user_page(void *vto, void *vfrom, unsigned long vaddr, struct page *pg) 26copy_user_page(void *vto, void *vfrom, unsigned long vaddr, struct page *pg)
27{ 27{
28 copy_user_page_asm(vto, vfrom); 28 copy_user_page_asm(vto, vfrom);
29 flush_kernel_dcache_page(vto); 29 flush_kernel_dcache_page_asm(vto);
30 /* XXX: ppc flushes icache too, should we? */ 30 /* XXX: ppc flushes icache too, should we? */
31} 31}
32 32
@@ -40,14 +40,19 @@ clear_user_page(void *page, unsigned long vaddr, struct page *pg)
40/* 40/*
41 * These are used to make use of C type-checking.. 41 * These are used to make use of C type-checking..
42 */ 42 */
43#ifdef __LP64__ 43#define STRICT_MM_TYPECHECKS
44typedef struct { unsigned long pte; } pte_t; 44#ifdef STRICT_MM_TYPECHECKS
45#else 45typedef struct { unsigned long pte;
46typedef struct { 46#if !defined(CONFIG_64BIT)
47 unsigned long pte; 47 unsigned long future_flags;
48 unsigned long flags; 48 /* XXX: it's possible to remove future_flags and change BITS_PER_PTE_ENTRY
49} pte_t; 49 to 2, but then strangely the identical 32bit kernel boots on a
50 c3000(pa20), but not any longer on a 715(pa11).
51 Still investigating... HelgeD.
52 */
50#endif 53#endif
54} pte_t; /* either 32 or 64bit */
55
51/* NOTE: even on 64 bits, these entries are __u32 because we allocate 56/* NOTE: even on 64 bits, these entries are __u32 because we allocate
52 * the pmd and pgd in ZONE_DMA (i.e. under 4GB) */ 57 * the pmd and pgd in ZONE_DMA (i.e. under 4GB) */
53typedef struct { __u32 pmd; } pmd_t; 58typedef struct { __u32 pmd; } pmd_t;
@@ -55,25 +60,44 @@ typedef struct { __u32 pgd; } pgd_t;
55typedef struct { unsigned long pgprot; } pgprot_t; 60typedef struct { unsigned long pgprot; } pgprot_t;
56 61
57#define pte_val(x) ((x).pte) 62#define pte_val(x) ((x).pte)
58#ifdef __LP64__
59#define pte_flags(x) (*(__u32 *)&((x).pte))
60#else
61#define pte_flags(x) ((x).flags)
62#endif
63
64/* These do not work lvalues, so make sure we don't use them as such. */ 63/* These do not work lvalues, so make sure we don't use them as such. */
65#define pmd_val(x) ((x).pmd + 0) 64#define pmd_val(x) ((x).pmd + 0)
66#define pgd_val(x) ((x).pgd + 0) 65#define pgd_val(x) ((x).pgd + 0)
67#define pgprot_val(x) ((x).pgprot) 66#define pgprot_val(x) ((x).pgprot)
68 67
69#define __pmd_val_set(x,n) (x).pmd = (n)
70#define __pgd_val_set(x,n) (x).pgd = (n)
71
72#define __pte(x) ((pte_t) { (x) } ) 68#define __pte(x) ((pte_t) { (x) } )
73#define __pmd(x) ((pmd_t) { (x) } ) 69#define __pmd(x) ((pmd_t) { (x) } )
74#define __pgd(x) ((pgd_t) { (x) } ) 70#define __pgd(x) ((pgd_t) { (x) } )
75#define __pgprot(x) ((pgprot_t) { (x) } ) 71#define __pgprot(x) ((pgprot_t) { (x) } )
76 72
73#define __pmd_val_set(x,n) (x).pmd = (n)
74#define __pgd_val_set(x,n) (x).pgd = (n)
75
76#else
77/*
78 * .. while these make it easier on the compiler
79 */
80typedef unsigned long pte_t;
81typedef __u32 pmd_t;
82typedef __u32 pgd_t;
83typedef unsigned long pgprot_t;
84
85#define pte_val(x) (x)
86#define pmd_val(x) (x)
87#define pgd_val(x) (x)
88#define pgprot_val(x) (x)
89
90#define __pte(x) (x)
91#define __pmd(x) (x)
92#define __pgd(x) (x)
93#define __pgprot(x) (x)
94
95#define __pmd_val_set(x,n) (x) = (n)
96#define __pgd_val_set(x,n) (x) = (n)
97
98#endif /* STRICT_MM_TYPECHECKS */
99
100
77typedef struct __physmem_range { 101typedef struct __physmem_range {
78 unsigned long start_pfn; 102 unsigned long start_pfn;
79 unsigned long pages; /* PAGE_SIZE pages */ 103 unsigned long pages; /* PAGE_SIZE pages */
@@ -130,8 +154,6 @@ extern int npmem_ranges;
130#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 154#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
131 155
132#ifndef CONFIG_DISCONTIGMEM 156#ifndef CONFIG_DISCONTIGMEM
133#define pfn_to_page(pfn) (mem_map + (pfn))
134#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
135#define pfn_valid(pfn) ((pfn) < max_mapnr) 157#define pfn_valid(pfn) ((pfn) < max_mapnr)
136#endif /* CONFIG_DISCONTIGMEM */ 158#endif /* CONFIG_DISCONTIGMEM */
137 159
@@ -152,6 +174,7 @@ extern int npmem_ranges;
152 174
153#endif /* __KERNEL__ */ 175#endif /* __KERNEL__ */
154 176
177#include <asm-generic/memory_model.h>
155#include <asm-generic/page.h> 178#include <asm-generic/page.h>
156 179
157#endif /* _PARISC_PAGE_H */ 180#endif /* _PARISC_PAGE_H */
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
index fe7f6a2f5aa7..77bbafb7f73e 100644
--- a/include/asm-parisc/pci.h
+++ b/include/asm-parisc/pci.h
@@ -289,4 +289,9 @@ static inline void pcibios_add_platform_entries(struct pci_dev *dev)
289{ 289{
290} 290}
291 291
292static inline void pcibios_penalize_isa_irq(int irq, int active)
293{
294 /* We don't need to penalize isa irq's */
295}
296
292#endif /* __ASM_PARISC_PCI_H */ 297#endif /* __ASM_PARISC_PCI_H */
diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h
index 8e23e4c674f6..0a3face6c480 100644
--- a/include/asm-parisc/pdc.h
+++ b/include/asm-parisc/pdc.h
@@ -333,7 +333,7 @@ struct pdc_model { /* for PDC_MODEL */
333 unsigned long curr_key; 333 unsigned long curr_key;
334}; 334};
335 335
336/* Values for PDC_MODEL_CAPABILITES non-equivalent virtual aliasing support */ 336/* Values for PDC_MODEL_CAPABILITIES non-equivalent virtual aliasing support */
337 337
338#define PDC_MODEL_IOPDIR_FDC (1 << 2) /* see sba_iommu.c */ 338#define PDC_MODEL_IOPDIR_FDC (1 << 2) /* see sba_iommu.c */
339#define PDC_MODEL_NVA_MASK (3 << 4) 339#define PDC_MODEL_NVA_MASK (3 << 4)
diff --git a/include/asm-parisc/pdc_chassis.h b/include/asm-parisc/pdc_chassis.h
index adac9ac2743f..a609273dc6bf 100644
--- a/include/asm-parisc/pdc_chassis.h
+++ b/include/asm-parisc/pdc_chassis.h
@@ -6,9 +6,8 @@
6 * 6 *
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License, version 2, as
10 * the Free Software Foundation; either version 2, or (at your option) 10 * published by the Free Software Foundation.
11 * any later version.
12 * 11 *
13 * This program is distributed in the hope that it will be useful, 12 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/include/asm-parisc/poll.h b/include/asm-parisc/poll.h
index 1c1da86934cf..20e4d03c74cb 100644
--- a/include/asm-parisc/poll.h
+++ b/include/asm-parisc/poll.h
@@ -16,6 +16,7 @@
16#define POLLWRBAND 0x0200 16#define POLLWRBAND 0x0200
17#define POLLMSG 0x0400 17#define POLLMSG 0x0400
18#define POLLREMOVE 0x1000 18#define POLLREMOVE 0x1000
19#define POLLRDHUP 0x2000
19 20
20struct pollfd { 21struct pollfd {
21 int fd; 22 int fd;
diff --git a/include/asm-parisc/spinlock.h b/include/asm-parisc/spinlock.h
index 16c2ac075fc5..a93960e232cf 100644
--- a/include/asm-parisc/spinlock.h
+++ b/include/asm-parisc/spinlock.h
@@ -134,14 +134,22 @@ static __inline__ int __raw_write_trylock(raw_rwlock_t *rw)
134 return 1; 134 return 1;
135} 135}
136 136
137static __inline__ int __raw_is_read_locked(raw_rwlock_t *rw) 137/*
138 * read_can_lock - would read_trylock() succeed?
139 * @lock: the rwlock in question.
140 */
141static __inline__ int __raw_read_can_lock(raw_rwlock_t *rw)
138{ 142{
139 return rw->counter > 0; 143 return rw->counter >= 0;
140} 144}
141 145
142static __inline__ int __raw_is_write_locked(raw_rwlock_t *rw) 146/*
147 * write_can_lock - would write_trylock() succeed?
148 * @lock: the rwlock in question.
149 */
150static __inline__ int __raw_write_can_lock(raw_rwlock_t *rw)
143{ 151{
144 return rw->counter < 0; 152 return !rw->counter;
145} 153}
146 154
147#endif /* __ASM_SPINLOCK_H */ 155#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-parisc/thread_info.h b/include/asm-parisc/thread_info.h
index ac32f140b83a..f2f83b04cd8b 100644
--- a/include/asm-parisc/thread_info.h
+++ b/include/asm-parisc/thread_info.h
@@ -49,7 +49,8 @@ struct thread_info {
49 49
50#endif /* !__ASSEMBLY */ 50#endif /* !__ASSEMBLY */
51 51
52#define PREEMPT_ACTIVE 0x10000000 52#define PREEMPT_ACTIVE_BIT 28
53#define PREEMPT_ACTIVE (1 << PREEMPT_ACTIVE_BIT)
53 54
54/* 55/*
55 * thread information flags 56 * thread information flags
diff --git a/include/asm-powerpc/atomic.h b/include/asm-powerpc/atomic.h
index 147a38dcc766..bb3c0ab7e667 100644
--- a/include/asm-powerpc/atomic.h
+++ b/include/asm-powerpc/atomic.h
@@ -8,6 +8,7 @@
8typedef struct { volatile int counter; } atomic_t; 8typedef struct { volatile int counter; } atomic_t;
9 9
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11#include <linux/compiler.h>
11#include <asm/synch.h> 12#include <asm/synch.h>
12#include <asm/asm-compat.h> 13#include <asm/asm-compat.h>
13 14
@@ -176,20 +177,29 @@ static __inline__ int atomic_dec_return(atomic_t *v)
176 * Atomically adds @a to @v, so long as it was not @u. 177 * Atomically adds @a to @v, so long as it was not @u.
177 * Returns non-zero if @v was not @u, and zero otherwise. 178 * Returns non-zero if @v was not @u, and zero otherwise.
178 */ 179 */
179#define atomic_add_unless(v, a, u) \ 180static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
180({ \ 181{
181 int c, old; \ 182 int t;
182 c = atomic_read(v); \ 183
183 for (;;) { \ 184 __asm__ __volatile__ (
184 if (unlikely(c == (u))) \ 185 LWSYNC_ON_SMP
185 break; \ 186"1: lwarx %0,0,%1 # atomic_add_unless\n\
186 old = atomic_cmpxchg((v), c, c + (a)); \ 187 cmpw 0,%0,%3 \n\
187 if (likely(old == c)) \ 188 beq- 2f \n\
188 break; \ 189 add %0,%2,%0 \n"
189 c = old; \ 190 PPC405_ERR77(0,%2)
190 } \ 191" stwcx. %0,0,%1 \n\
191 c != (u); \ 192 bne- 1b \n"
192}) 193 ISYNC_ON_SMP
194" subf %0,%2,%0 \n\
1952:"
196 : "=&r" (t)
197 : "r" (&v->counter), "r" (a), "r" (u)
198 : "cc", "memory");
199
200 return t != u;
201}
202
193#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 203#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
194 204
195#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0) 205#define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0)
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index bf6941a810b8..d1c2a4405660 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -184,72 +184,7 @@ static __inline__ void set_bits(unsigned long mask, unsigned long *addr)
184 : "cc"); 184 : "cc");
185} 185}
186 186
187/* Non-atomic versions */ 187#include <asm-generic/bitops/non-atomic.h>
188static __inline__ int test_bit(unsigned long nr,
189 __const__ volatile unsigned long *addr)
190{
191 return 1UL & (addr[BITOP_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
192}
193
194static __inline__ void __set_bit(unsigned long nr,
195 volatile unsigned long *addr)
196{
197 unsigned long mask = BITOP_MASK(nr);
198 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
199
200 *p |= mask;
201}
202
203static __inline__ void __clear_bit(unsigned long nr,
204 volatile unsigned long *addr)
205{
206 unsigned long mask = BITOP_MASK(nr);
207 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
208
209 *p &= ~mask;
210}
211
212static __inline__ void __change_bit(unsigned long nr,
213 volatile unsigned long *addr)
214{
215 unsigned long mask = BITOP_MASK(nr);
216 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
217
218 *p ^= mask;
219}
220
221static __inline__ int __test_and_set_bit(unsigned long nr,
222 volatile unsigned long *addr)
223{
224 unsigned long mask = BITOP_MASK(nr);
225 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
226 unsigned long old = *p;
227
228 *p = old | mask;
229 return (old & mask) != 0;
230}
231
232static __inline__ int __test_and_clear_bit(unsigned long nr,
233 volatile unsigned long *addr)
234{
235 unsigned long mask = BITOP_MASK(nr);
236 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
237 unsigned long old = *p;
238
239 *p = old & ~mask;
240 return (old & mask) != 0;
241}
242
243static __inline__ int __test_and_change_bit(unsigned long nr,
244 volatile unsigned long *addr)
245{
246 unsigned long mask = BITOP_MASK(nr);
247 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
248 unsigned long old = *p;
249
250 *p = old ^ mask;
251 return (old & mask) != 0;
252}
253 188
254/* 189/*
255 * Return the zero-based bit position (LE, not IBM bit numbering) of 190 * Return the zero-based bit position (LE, not IBM bit numbering) of
@@ -310,16 +245,9 @@ static __inline__ int fls(unsigned int x)
310 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x)); 245 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
311 return 32 - lz; 246 return 32 - lz;
312} 247}
313#define fls64(x) generic_fls64(x) 248#include <asm-generic/bitops/fls64.h>
314 249
315/* 250#include <asm-generic/bitops/hweight.h>
316 * hweightN: returns the hamming weight (i.e. the number
317 * of bits set) of a N-bit word
318 */
319#define hweight64(x) generic_hweight64(x)
320#define hweight32(x) generic_hweight32(x)
321#define hweight16(x) generic_hweight16(x)
322#define hweight8(x) generic_hweight8(x)
323 251
324#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) 252#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
325unsigned long find_next_zero_bit(const unsigned long *addr, 253unsigned long find_next_zero_bit(const unsigned long *addr,
@@ -397,32 +325,7 @@ unsigned long find_next_zero_le_bit(const unsigned long *addr,
397#define minix_find_first_zero_bit(addr,size) \ 325#define minix_find_first_zero_bit(addr,size) \
398 find_first_zero_le_bit((unsigned long *)addr, size) 326 find_first_zero_le_bit((unsigned long *)addr, size)
399 327
400/* 328#include <asm-generic/bitops/sched.h>
401 * Every architecture must define this function. It's the fastest
402 * way of searching a 140-bit bitmap where the first 100 bits are
403 * unlikely to be set. It's guaranteed that at least one of the 140
404 * bits is cleared.
405 */
406static inline int sched_find_first_bit(const unsigned long *b)
407{
408#ifdef CONFIG_PPC64
409 if (unlikely(b[0]))
410 return __ffs(b[0]);
411 if (unlikely(b[1]))
412 return __ffs(b[1]) + 64;
413 return __ffs(b[2]) + 128;
414#else
415 if (unlikely(b[0]))
416 return __ffs(b[0]);
417 if (unlikely(b[1]))
418 return __ffs(b[1]) + 32;
419 if (unlikely(b[2]))
420 return __ffs(b[2]) + 64;
421 if (b[3])
422 return __ffs(b[3]) + 96;
423 return __ffs(b[4]) + 128;
424#endif
425}
426 329
427#endif /* __KERNEL__ */ 330#endif /* __KERNEL__ */
428 331
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h
index 99817a802ca4..f44b529e3298 100644
--- a/include/asm-powerpc/bug.h
+++ b/include/asm-powerpc/bug.h
@@ -30,34 +30,60 @@ struct bug_entry *find_bug(unsigned long bugaddr);
30 30
31#ifdef CONFIG_BUG 31#ifdef CONFIG_BUG
32 32
33/*
34 * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
35 * optimisations. However depending on the complexity of the condition
36 * some compiler versions may not produce optimal results.
37 */
38
33#define BUG() do { \ 39#define BUG() do { \
34 __asm__ __volatile__( \ 40 __asm__ __volatile__( \
35 "1: twi 31,0,0\n" \ 41 "1: twi 31,0,0\n" \
36 ".section __bug_table,\"a\"\n" \ 42 ".section __bug_table,\"a\"\n" \
37 "\t"PPC_LONG" 1b,%0,%1,%2\n" \ 43 "\t"PPC_LONG" 1b,%0,%1,%2\n" \
38 ".previous" \ 44 ".previous" \
39 : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ 45 : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
40} while (0) 46} while (0)
41 47
42#define BUG_ON(x) do { \ 48#define BUG_ON(x) do { \
43 __asm__ __volatile__( \ 49 if (__builtin_constant_p(x)) { \
50 if (x) \
51 BUG(); \
52 } else { \
53 __asm__ __volatile__( \
44 "1: "PPC_TLNEI" %0,0\n" \ 54 "1: "PPC_TLNEI" %0,0\n" \
45 ".section __bug_table,\"a\"\n" \ 55 ".section __bug_table,\"a\"\n" \
46 "\t"PPC_LONG" 1b,%1,%2,%3\n" \ 56 "\t"PPC_LONG" 1b,%1,%2,%3\n" \
47 ".previous" \ 57 ".previous" \
48 : : "r" ((long)(x)), "i" (__LINE__), \ 58 : : "r" ((long)(x)), "i" (__LINE__), \
49 "i" (__FILE__), "i" (__FUNCTION__)); \ 59 "i" (__FILE__), "i" (__FUNCTION__)); \
60 } \
50} while (0) 61} while (0)
51 62
52#define WARN_ON(x) do { \ 63#define __WARN() do { \
53 __asm__ __volatile__( \ 64 __asm__ __volatile__( \
65 "1: twi 31,0,0\n" \
66 ".section __bug_table,\"a\"\n" \
67 "\t"PPC_LONG" 1b,%0,%1,%2\n" \
68 ".previous" \
69 : : "i" (__LINE__ + BUG_WARNING_TRAP), \
70 "i" (__FILE__), "i" (__FUNCTION__)); \
71} while (0)
72
73#define WARN_ON(x) do { \
74 if (__builtin_constant_p(x)) { \
75 if (x) \
76 __WARN(); \
77 } else { \
78 __asm__ __volatile__( \
54 "1: "PPC_TLNEI" %0,0\n" \ 79 "1: "PPC_TLNEI" %0,0\n" \
55 ".section __bug_table,\"a\"\n" \ 80 ".section __bug_table,\"a\"\n" \
56 "\t"PPC_LONG" 1b,%1,%2,%3\n" \ 81 "\t"PPC_LONG" 1b,%1,%2,%3\n" \
57 ".previous" \ 82 ".previous" \
58 : : "r" ((long)(x)), \ 83 : : "r" ((long)(x)), \
59 "i" (__LINE__ + BUG_WARNING_TRAP), \ 84 "i" (__LINE__ + BUG_WARNING_TRAP), \
60 "i" (__FILE__), "i" (__FUNCTION__)); \ 85 "i" (__FILE__), "i" (__FUNCTION__)); \
86 } \
61} while (0) 87} while (0)
62 88
63#define HAVE_ARCH_BUG 89#define HAVE_ARCH_BUG
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 5638518968c3..4321483cce51 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -102,38 +102,40 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
102#define CPU_FTR_NEED_COHERENT ASM_CONST(0x0000000000020000) 102#define CPU_FTR_NEED_COHERENT ASM_CONST(0x0000000000020000)
103#define CPU_FTR_NO_BTIC ASM_CONST(0x0000000000040000) 103#define CPU_FTR_NO_BTIC ASM_CONST(0x0000000000040000)
104#define CPU_FTR_BIG_PHYS ASM_CONST(0x0000000000080000) 104#define CPU_FTR_BIG_PHYS ASM_CONST(0x0000000000080000)
105#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000) 105#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000)
106 106
107#ifdef __powerpc64__ 107#ifdef __powerpc64__
108/* Add the 64b processor unique features in the top half of the word */ 108/* Add the 64b processor unique features in the top half of the word */
109#define CPU_FTR_SLB ASM_CONST(0x0000000100000000) 109#define CPU_FTR_SLB ASM_CONST(0x0000000100000000)
110#define CPU_FTR_16M_PAGE ASM_CONST(0x0000000200000000) 110#define CPU_FTR_16M_PAGE ASM_CONST(0x0000000200000000)
111#define CPU_FTR_TLBIEL ASM_CONST(0x0000000400000000) 111#define CPU_FTR_TLBIEL ASM_CONST(0x0000000400000000)
112#define CPU_FTR_NOEXECUTE ASM_CONST(0x0000000800000000) 112#define CPU_FTR_NOEXECUTE ASM_CONST(0x0000000800000000)
113#define CPU_FTR_IABR ASM_CONST(0x0000002000000000) 113#define CPU_FTR_IABR ASM_CONST(0x0000002000000000)
114#define CPU_FTR_MMCRA ASM_CONST(0x0000004000000000) 114#define CPU_FTR_MMCRA ASM_CONST(0x0000004000000000)
115#define CPU_FTR_CTRL ASM_CONST(0x0000008000000000) 115#define CPU_FTR_CTRL ASM_CONST(0x0000008000000000)
116#define CPU_FTR_SMT ASM_CONST(0x0000010000000000) 116#define CPU_FTR_SMT ASM_CONST(0x0000010000000000)
117#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) 117#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000)
118#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) 118#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000)
119#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) 119#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000)
120#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000) 120#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000)
121#define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000) 121#define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000)
122#define CPU_FTR_PURR ASM_CONST(0x0000400000000000)
122#else 123#else
123/* ensure on 32b processors the flags are available for compiling but 124/* ensure on 32b processors the flags are available for compiling but
124 * don't do anything */ 125 * don't do anything */
125#define CPU_FTR_SLB ASM_CONST(0x0) 126#define CPU_FTR_SLB ASM_CONST(0x0)
126#define CPU_FTR_16M_PAGE ASM_CONST(0x0) 127#define CPU_FTR_16M_PAGE ASM_CONST(0x0)
127#define CPU_FTR_TLBIEL ASM_CONST(0x0) 128#define CPU_FTR_TLBIEL ASM_CONST(0x0)
128#define CPU_FTR_NOEXECUTE ASM_CONST(0x0) 129#define CPU_FTR_NOEXECUTE ASM_CONST(0x0)
129#define CPU_FTR_IABR ASM_CONST(0x0) 130#define CPU_FTR_IABR ASM_CONST(0x0)
130#define CPU_FTR_MMCRA ASM_CONST(0x0) 131#define CPU_FTR_MMCRA ASM_CONST(0x0)
131#define CPU_FTR_CTRL ASM_CONST(0x0) 132#define CPU_FTR_CTRL ASM_CONST(0x0)
132#define CPU_FTR_SMT ASM_CONST(0x0) 133#define CPU_FTR_SMT ASM_CONST(0x0)
133#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0) 134#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0)
134#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0) 135#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0)
135#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0) 136#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0)
136#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0) 137#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0)
138#define CPU_FTR_PURR ASM_CONST(0x0)
137#endif 139#endif
138 140
139#ifndef __ASSEMBLY__ 141#ifndef __ASSEMBLY__
@@ -186,153 +188,154 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
186 !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4) && \ 188 !defined(CONFIG_POWER3) && !defined(CONFIG_POWER4) && \
187 !defined(CONFIG_BOOKE)) 189 !defined(CONFIG_BOOKE))
188 190
189enum { 191#define CPU_FTRS_PPC601 (CPU_FTR_COMMON | CPU_FTR_601 | CPU_FTR_HPTE_TABLE)
190 CPU_FTRS_PPC601 = CPU_FTR_COMMON | CPU_FTR_601 | CPU_FTR_HPTE_TABLE, 192#define CPU_FTRS_603 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
191 CPU_FTRS_603 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 193 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | \
192 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | 194 CPU_FTR_MAYBE_CAN_NAP)
193 CPU_FTR_MAYBE_CAN_NAP, 195#define CPU_FTRS_604 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
194 CPU_FTRS_604 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 196 CPU_FTR_USE_TB | CPU_FTR_604_PERF_MON | CPU_FTR_HPTE_TABLE)
195 CPU_FTR_USE_TB | CPU_FTR_604_PERF_MON | CPU_FTR_HPTE_TABLE, 197#define CPU_FTRS_740_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
196 CPU_FTRS_740_NOTAU = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 198 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
197 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | 199 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP)
198 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP, 200#define CPU_FTRS_740 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
199 CPU_FTRS_740 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 201 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
200 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | 202 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP)
201 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP, 203#define CPU_FTRS_750 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
202 CPU_FTRS_750 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 204 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
203 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | 205 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP)
204 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP, 206#define CPU_FTRS_750FX1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
205 CPU_FTRS_750FX1 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 207 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
206 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | 208 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
207 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | 209 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM)
208 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_NO_DPM, 210#define CPU_FTRS_750FX2 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
209 CPU_FTRS_750FX2 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 211 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
210 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | 212 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
211 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | 213 CPU_FTR_NO_DPM)
212 CPU_FTR_NO_DPM, 214#define CPU_FTRS_750FX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
213 CPU_FTRS_750FX = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 215 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
214 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | 216 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
215 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | 217 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS)
216 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS, 218#define CPU_FTRS_750GX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \
217 CPU_FTRS_750GX = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | 219 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU | \
218 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU | 220 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
219 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | 221 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS)
220 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS, 222#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
221 CPU_FTRS_7400_NOTAU = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 223 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
222 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | 224 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \
223 CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | 225 CPU_FTR_MAYBE_CAN_NAP)
224 CPU_FTR_MAYBE_CAN_NAP, 226#define CPU_FTRS_7400 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
225 CPU_FTRS_7400 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 227 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
226 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | 228 CPU_FTR_TAU | CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | \
227 CPU_FTR_TAU | CPU_FTR_ALTIVEC_COMP | CPU_FTR_HPTE_TABLE | 229 CPU_FTR_MAYBE_CAN_NAP)
228 CPU_FTR_MAYBE_CAN_NAP, 230#define CPU_FTRS_7450_20 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
229 CPU_FTRS_7450_20 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 231 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
230 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | 232 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
231 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | 233 CPU_FTR_NEED_COHERENT)
232 CPU_FTR_NEED_COHERENT, 234#define CPU_FTRS_7450_21 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
233 CPU_FTRS_7450_21 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 235 CPU_FTR_USE_TB | \
234 CPU_FTR_USE_TB | 236 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
235 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | 237 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
236 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | 238 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
237 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | 239 CPU_FTR_NEED_COHERENT)
238 CPU_FTR_NEED_COHERENT, 240#define CPU_FTRS_7450_23 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
239 CPU_FTRS_7450_23 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 241 CPU_FTR_USE_TB | \
240 CPU_FTR_USE_TB | 242 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
241 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | 243 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
242 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | 244 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT)
243 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_NEED_COHERENT, 245#define CPU_FTRS_7455_1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
244 CPU_FTRS_7455_1 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 246 CPU_FTR_USE_TB | \
245 CPU_FTR_USE_TB | 247 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | \
246 CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR | 248 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | \
247 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS | 249 CPU_FTR_NEED_COHERENT)
248 CPU_FTR_NEED_COHERENT, 250#define CPU_FTRS_7455_20 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
249 CPU_FTRS_7455_20 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 251 CPU_FTR_USE_TB | \
250 CPU_FTR_USE_TB | 252 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
251 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | 253 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
252 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | 254 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | \
253 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_L3_DISABLE_NAP | 255 CPU_FTR_NEED_COHERENT | CPU_FTR_HAS_HIGH_BATS)
254 CPU_FTR_NEED_COHERENT | CPU_FTR_HAS_HIGH_BATS, 256#define CPU_FTRS_7455 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
255 CPU_FTRS_7455 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 257 CPU_FTR_USE_TB | \
256 CPU_FTR_USE_TB | 258 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
257 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | 259 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
258 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | 260 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
259 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | 261 CPU_FTR_NEED_COHERENT)
260 CPU_FTR_NEED_COHERENT, 262#define CPU_FTRS_7447_10 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
261 CPU_FTRS_7447_10 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 263 CPU_FTR_USE_TB | \
262 CPU_FTR_USE_TB | 264 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
263 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | 265 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
264 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | 266 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
265 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | 267 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC)
266 CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC, 268#define CPU_FTRS_7447 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
267 CPU_FTRS_7447 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 269 CPU_FTR_USE_TB | \
268 CPU_FTR_USE_TB | 270 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
269 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | 271 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
270 CPU_FTR_L3CR | CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | 272 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
271 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | 273 CPU_FTR_NEED_COHERENT)
272 CPU_FTR_NEED_COHERENT, 274#define CPU_FTRS_7447A (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
273 CPU_FTRS_7447A = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 275 CPU_FTR_USE_TB | \
274 CPU_FTR_USE_TB | 276 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | \
275 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | 277 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | \
276 CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | 278 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | \
277 CPU_FTR_NAP_DISABLE_L2_PR | CPU_FTR_HAS_HIGH_BATS | 279 CPU_FTR_NEED_COHERENT)
278 CPU_FTR_NEED_COHERENT, 280#define CPU_FTRS_82XX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
279 CPU_FTRS_82XX = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 281 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB)
280 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB, 282#define CPU_FTRS_G2_LE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \
281 CPU_FTRS_G2_LE = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | 283 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS)
282 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS, 284#define CPU_FTRS_E300 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \
283 CPU_FTRS_E300 = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | 285 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \
284 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | 286 CPU_FTR_COMMON)
285 CPU_FTR_COMMON, 287#define CPU_FTRS_CLASSIC32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
286 CPU_FTRS_CLASSIC32 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 288 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE)
287 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE, 289#define CPU_FTRS_POWER3_32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
288 CPU_FTRS_POWER3_32 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 290 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE)
289 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE, 291#define CPU_FTRS_POWER4_32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
290 CPU_FTRS_POWER4_32 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 292 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_NODSISRALIGN)
291 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_NODSISRALIGN, 293#define CPU_FTRS_970_32 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
292 CPU_FTRS_970_32 = CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | 294 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_ALTIVEC_COMP | \
293 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_ALTIVEC_COMP | 295 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_NODSISRALIGN)
294 CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_NODSISRALIGN, 296#define CPU_FTRS_8XX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB)
295 CPU_FTRS_8XX = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB, 297#define CPU_FTRS_40X (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
296 CPU_FTRS_40X = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 298 CPU_FTR_NODSISRALIGN)
297 CPU_FTR_NODSISRALIGN, 299#define CPU_FTRS_44X (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
298 CPU_FTRS_44X = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 300 CPU_FTR_NODSISRALIGN)
299 CPU_FTR_NODSISRALIGN, 301#define CPU_FTRS_E200 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN)
300 CPU_FTRS_E200 = CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN, 302#define CPU_FTRS_E500 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
301 CPU_FTRS_E500 = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 303 CPU_FTR_NODSISRALIGN)
302 CPU_FTR_NODSISRALIGN, 304#define CPU_FTRS_E500_2 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
303 CPU_FTRS_E500_2 = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 305 CPU_FTR_BIG_PHYS | CPU_FTR_NODSISRALIGN)
304 CPU_FTR_BIG_PHYS | CPU_FTR_NODSISRALIGN, 306#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
305 CPU_FTRS_GENERIC_32 = CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN,
306#ifdef __powerpc64__ 307#ifdef __powerpc64__
307 CPU_FTRS_POWER3 = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 308#define CPU_FTRS_POWER3 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
308 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR, 309 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR)
309 CPU_FTRS_RS64 = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 310#define CPU_FTRS_RS64 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
310 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | 311 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \
311 CPU_FTR_MMCRA | CPU_FTR_CTRL, 312 CPU_FTR_MMCRA | CPU_FTR_CTRL)
312 CPU_FTRS_POWER4 = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 313#define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
313 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA, 314 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA)
314 CPU_FTRS_PPC970 = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 315#define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
315 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | 316 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
316 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA, 317 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA)
317 CPU_FTRS_POWER5 = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 318#define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
318 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | 319 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
319 CPU_FTR_MMCRA | CPU_FTR_SMT | 320 CPU_FTR_MMCRA | CPU_FTR_SMT | \
320 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | 321 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
321 CPU_FTR_MMCRA_SIHV, 322 CPU_FTR_MMCRA_SIHV | CPU_FTR_PURR)
322 CPU_FTRS_CELL = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 323#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
323 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | 324 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
324 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | 325 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
325 CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO, 326 CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO)
326 CPU_FTRS_COMPATIBLE = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | 327#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
327 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2, 328 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
328#endif 329#endif
329 330
330 CPU_FTRS_POSSIBLE =
331#ifdef __powerpc64__ 331#ifdef __powerpc64__
332 CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | 332#define CPU_FTRS_POSSIBLE \
333 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL | 333 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \
334 CPU_FTR_CI_LARGE_PAGE | 334 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL | \
335 CPU_FTR_CI_LARGE_PAGE)
335#else 336#else
337enum {
338 CPU_FTRS_POSSIBLE =
336#if CLASSIC_PPC 339#if CLASSIC_PPC
337 CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU | 340 CPU_FTRS_PPC601 | CPU_FTRS_603 | CPU_FTRS_604 | CPU_FTRS_740_NOTAU |
338 CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 | 341 CPU_FTRS_740 | CPU_FTRS_750 | CPU_FTRS_750FX1 |
@@ -366,14 +369,18 @@ enum {
366#ifdef CONFIG_E500 369#ifdef CONFIG_E500
367 CPU_FTRS_E500 | CPU_FTRS_E500_2 | 370 CPU_FTRS_E500 | CPU_FTRS_E500_2 |
368#endif 371#endif
369#endif /* __powerpc64__ */
370 0, 372 0,
373};
374#endif /* __powerpc64__ */
371 375
372 CPU_FTRS_ALWAYS =
373#ifdef __powerpc64__ 376#ifdef __powerpc64__
374 CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & 377#define CPU_FTRS_ALWAYS \
375 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_CELL & 378 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \
379 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_CELL & \
380 CPU_FTRS_POSSIBLE)
376#else 381#else
382enum {
383 CPU_FTRS_ALWAYS =
377#if CLASSIC_PPC 384#if CLASSIC_PPC
378 CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU & 385 CPU_FTRS_PPC601 & CPU_FTRS_603 & CPU_FTRS_604 & CPU_FTRS_740_NOTAU &
379 CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 & 386 CPU_FTRS_740 & CPU_FTRS_750 & CPU_FTRS_750FX1 &
@@ -407,9 +414,9 @@ enum {
407#ifdef CONFIG_E500 414#ifdef CONFIG_E500
408 CPU_FTRS_E500 & CPU_FTRS_E500_2 & 415 CPU_FTRS_E500 & CPU_FTRS_E500_2 &
409#endif 416#endif
410#endif /* __powerpc64__ */
411 CPU_FTRS_POSSIBLE, 417 CPU_FTRS_POSSIBLE,
412}; 418};
419#endif /* __powerpc64__ */
413 420
414static inline int cpu_has_feature(unsigned long feature) 421static inline int cpu_has_feature(unsigned long feature)
415{ 422{
diff --git a/include/asm-powerpc/cputime.h b/include/asm-powerpc/cputime.h
index 6d68ad7e0ea3..a21185d47883 100644
--- a/include/asm-powerpc/cputime.h
+++ b/include/asm-powerpc/cputime.h
@@ -1 +1,203 @@
1/*
2 * Definitions for measuring cputime on powerpc machines.
3 *
4 * Copyright (C) 2006 Paul Mackerras, IBM Corp.
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 * If we have CONFIG_VIRT_CPU_ACCOUNTING, we measure cpu time in
12 * the same units as the timebase. Otherwise we measure cpu time
13 * in jiffies using the generic definitions.
14 */
15
16#ifndef __POWERPC_CPUTIME_H
17#define __POWERPC_CPUTIME_H
18
19#ifndef CONFIG_VIRT_CPU_ACCOUNTING
1#include <asm-generic/cputime.h> 20#include <asm-generic/cputime.h>
21#else
22
23#include <linux/types.h>
24#include <linux/time.h>
25#include <asm/div64.h>
26#include <asm/time.h>
27#include <asm/param.h>
28
29typedef u64 cputime_t;
30typedef u64 cputime64_t;
31
32#define cputime_zero ((cputime_t)0)
33#define cputime_max ((~((cputime_t)0) >> 1) - 1)
34#define cputime_add(__a, __b) ((__a) + (__b))
35#define cputime_sub(__a, __b) ((__a) - (__b))
36#define cputime_div(__a, __n) ((__a) / (__n))
37#define cputime_halve(__a) ((__a) >> 1)
38#define cputime_eq(__a, __b) ((__a) == (__b))
39#define cputime_gt(__a, __b) ((__a) > (__b))
40#define cputime_ge(__a, __b) ((__a) >= (__b))
41#define cputime_lt(__a, __b) ((__a) < (__b))
42#define cputime_le(__a, __b) ((__a) <= (__b))
43
44#define cputime64_zero ((cputime64_t)0)
45#define cputime64_add(__a, __b) ((__a) + (__b))
46#define cputime_to_cputime64(__ct) (__ct)
47
48#ifdef __KERNEL__
49
50/*
51 * Convert cputime <-> jiffies
52 */
53extern u64 __cputime_jiffies_factor;
54
55static inline unsigned long cputime_to_jiffies(const cputime_t ct)
56{
57 return mulhdu(ct, __cputime_jiffies_factor);
58}
59
60static inline cputime_t jiffies_to_cputime(const unsigned long jif)
61{
62 cputime_t ct;
63 unsigned long sec;
64
65 /* have to be a little careful about overflow */
66 ct = jif % HZ;
67 sec = jif / HZ;
68 if (ct) {
69 ct *= tb_ticks_per_sec;
70 do_div(ct, HZ);
71 }
72 if (sec)
73 ct += (cputime_t) sec * tb_ticks_per_sec;
74 return ct;
75}
76
77static inline u64 cputime64_to_jiffies64(const cputime_t ct)
78{
79 return mulhdu(ct, __cputime_jiffies_factor);
80}
81
82/*
83 * Convert cputime <-> milliseconds
84 */
85extern u64 __cputime_msec_factor;
86
87static inline unsigned long cputime_to_msecs(const cputime_t ct)
88{
89 return mulhdu(ct, __cputime_msec_factor);
90}
91
92static inline cputime_t msecs_to_cputime(const unsigned long ms)
93{
94 cputime_t ct;
95 unsigned long sec;
96
97 /* have to be a little careful about overflow */
98 ct = ms % 1000;
99 sec = ms / 1000;
100 if (ct) {
101 ct *= tb_ticks_per_sec;
102 do_div(ct, 1000);
103 }
104 if (sec)
105 ct += (cputime_t) sec * tb_ticks_per_sec;
106 return ct;
107}
108
109/*
110 * Convert cputime <-> seconds
111 */
112extern u64 __cputime_sec_factor;
113
114static inline unsigned long cputime_to_secs(const cputime_t ct)
115{
116 return mulhdu(ct, __cputime_sec_factor);
117}
118
119static inline cputime_t secs_to_cputime(const unsigned long sec)
120{
121 return (cputime_t) sec * tb_ticks_per_sec;
122}
123
124/*
125 * Convert cputime <-> timespec
126 */
127static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p)
128{
129 u64 x = ct;
130 unsigned int frac;
131
132 frac = do_div(x, tb_ticks_per_sec);
133 p->tv_sec = x;
134 x = (u64) frac * 1000000000;
135 do_div(x, tb_ticks_per_sec);
136 p->tv_nsec = x;
137}
138
139static inline cputime_t timespec_to_cputime(const struct timespec *p)
140{
141 cputime_t ct;
142
143 ct = (u64) p->tv_nsec * tb_ticks_per_sec;
144 do_div(ct, 1000000000);
145 return ct + (u64) p->tv_sec * tb_ticks_per_sec;
146}
147
148/*
149 * Convert cputime <-> timeval
150 */
151static inline void cputime_to_timeval(const cputime_t ct, struct timeval *p)
152{
153 u64 x = ct;
154 unsigned int frac;
155
156 frac = do_div(x, tb_ticks_per_sec);
157 p->tv_sec = x;
158 x = (u64) frac * 1000000;
159 do_div(x, tb_ticks_per_sec);
160 p->tv_usec = x;
161}
162
163static inline cputime_t timeval_to_cputime(const struct timeval *p)
164{
165 cputime_t ct;
166
167 ct = (u64) p->tv_usec * tb_ticks_per_sec;
168 do_div(ct, 1000000);
169 return ct + (u64) p->tv_sec * tb_ticks_per_sec;
170}
171
172/*
173 * Convert cputime <-> clock_t (units of 1/USER_HZ seconds)
174 */
175extern u64 __cputime_clockt_factor;
176
177static inline unsigned long cputime_to_clock_t(const cputime_t ct)
178{
179 return mulhdu(ct, __cputime_clockt_factor);
180}
181
182static inline cputime_t clock_t_to_cputime(const unsigned long clk)
183{
184 cputime_t ct;
185 unsigned long sec;
186
187 /* have to be a little careful about overflow */
188 ct = clk % USER_HZ;
189 sec = clk / USER_HZ;
190 if (ct) {
191 ct *= tb_ticks_per_sec;
192 do_div(ct, USER_HZ);
193 }
194 if (sec)
195 ct += (cputime_t) sec * tb_ticks_per_sec;
196 return ct;
197}
198
199#define cputime64_to_clock_t(ct) cputime_to_clock_t((cputime_t)(ct))
200
201#endif /* __KERNEL__ */
202#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
203#endif /* __POWERPC_CPUTIME_H */
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h
index f804b34cf06a..77069df92bf8 100644
--- a/include/asm-powerpc/firmware.h
+++ b/include/asm-powerpc/firmware.h
@@ -41,6 +41,7 @@
41#define FW_FEATURE_MULTITCE (1UL<<19) 41#define FW_FEATURE_MULTITCE (1UL<<19)
42#define FW_FEATURE_SPLPAR (1UL<<20) 42#define FW_FEATURE_SPLPAR (1UL<<20)
43#define FW_FEATURE_ISERIES (1UL<<21) 43#define FW_FEATURE_ISERIES (1UL<<21)
44#define FW_FEATURE_LPAR (1UL<<22)
44 45
45enum { 46enum {
46#ifdef CONFIG_PPC64 47#ifdef CONFIG_PPC64
@@ -51,10 +52,10 @@ enum {
51 FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ | 52 FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ |
52 FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | 53 FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
53 FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE | 54 FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE |
54 FW_FEATURE_SPLPAR, 55 FW_FEATURE_SPLPAR | FW_FEATURE_LPAR,
55 FW_FEATURE_PSERIES_ALWAYS = 0, 56 FW_FEATURE_PSERIES_ALWAYS = 0,
56 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES, 57 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
57 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES, 58 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
58 FW_FEATURE_POSSIBLE = 59 FW_FEATURE_POSSIBLE =
59#ifdef CONFIG_PPC_PSERIES 60#ifdef CONFIG_PPC_PSERIES
60 FW_FEATURE_PSERIES_POSSIBLE | 61 FW_FEATURE_PSERIES_POSSIBLE |
@@ -81,22 +82,11 @@ enum {
81/* This is used to identify firmware features which are available 82/* This is used to identify firmware features which are available
82 * to the kernel. 83 * to the kernel.
83 */ 84 */
84extern unsigned long ppc64_firmware_features; 85extern unsigned long powerpc_firmware_features;
85 86
86static inline unsigned long firmware_has_feature(unsigned long feature) 87#define firmware_has_feature(feature) \
87{ 88 ((FW_FEATURE_ALWAYS & (feature)) || \
88 return (FW_FEATURE_ALWAYS & feature) || 89 (FW_FEATURE_POSSIBLE & powerpc_firmware_features & (feature)))
89 (FW_FEATURE_POSSIBLE & ppc64_firmware_features & feature);
90}
91
92#ifdef CONFIG_PPC_PSERIES
93typedef struct {
94 unsigned long val;
95 char * name;
96} firmware_feature_t;
97
98extern firmware_feature_t firmware_features_table[];
99#endif
100 90
101extern void system_reset_fwnmi(void); 91extern void system_reset_fwnmi(void);
102extern void machine_check_fwnmi(void); 92extern void machine_check_fwnmi(void);
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h
index e258778ca429..608164c39efb 100644
--- a/include/asm-powerpc/floppy.h
+++ b/include/asm-powerpc/floppy.h
@@ -35,6 +35,7 @@
35#ifdef CONFIG_PCI 35#ifdef CONFIG_PCI
36 36
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <asm/ppc-pci.h> /* for ppc64_isabridge_dev */
38 39
39#define fd_dma_setup(addr,size,mode,io) powerpc_fd_dma_setup(addr,size,mode,io) 40#define fd_dma_setup(addr,size,mode,io) powerpc_fd_dma_setup(addr,size,mode,io)
40 41
@@ -52,12 +53,12 @@ static __inline__ int powerpc_fd_dma_setup(char *addr, unsigned long size,
52 if (bus_addr 53 if (bus_addr
53 && (addr != prev_addr || size != prev_size || dir != prev_dir)) { 54 && (addr != prev_addr || size != prev_size || dir != prev_dir)) {
54 /* different from last time -- unmap prev */ 55 /* different from last time -- unmap prev */
55 pci_unmap_single(NULL, bus_addr, prev_size, prev_dir); 56 pci_unmap_single(ppc64_isabridge_dev, bus_addr, prev_size, prev_dir);
56 bus_addr = 0; 57 bus_addr = 0;
57 } 58 }
58 59
59 if (!bus_addr) /* need to map it */ 60 if (!bus_addr) /* need to map it */
60 bus_addr = pci_map_single(NULL, addr, size, dir); 61 bus_addr = pci_map_single(ppc64_isabridge_dev, addr, size, dir);
61 62
62 /* remember this one as prev */ 63 /* remember this one as prev */
63 prev_addr = addr; 64 prev_addr = addr;
diff --git a/include/asm-powerpc/futex.h b/include/asm-powerpc/futex.h
index 39e85f320a76..f1b3c00bc1ce 100644
--- a/include/asm-powerpc/futex.h
+++ b/include/asm-powerpc/futex.h
@@ -81,5 +81,11 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
81 return ret; 81 return ret;
82} 82}
83 83
84static inline int
85futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
86{
87 return -ENOSYS;
88}
89
84#endif /* __KERNEL__ */ 90#endif /* __KERNEL__ */
85#endif /* _ASM_POWERPC_FUTEX_H */ 91#endif /* _ASM_POWERPC_FUTEX_H */
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h
index 38ca9ad6110d..b72c04f3f551 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -9,6 +9,7 @@
9#define H_Closed 2 /* Resource closed */ 9#define H_Closed 2 /* Resource closed */
10#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 */ 11#define H_InProgress 14 /* Kind of like busy */
12#define H_Pending 17 /* returned from H_POLL_PENDING */
12#define H_Continue 18 /* Returned from H_Join on success */ 13#define H_Continue 18 /* Returned from H_Join on success */
13#define H_LongBusyStartRange 9900 /* Start of long busy range */ 14#define H_LongBusyStartRange 9900 /* Start of long busy range */
14#define H_LongBusyOrder1msec 9900 /* Long busy, hint that 1msec is a good time to retry */ 15#define H_LongBusyOrder1msec 9900 /* Long busy, hint that 1msec is a good time to retry */
diff --git a/include/asm-powerpc/hvconsole.h b/include/asm-powerpc/hvconsole.h
index 34daf7b9b62f..35ea69e8121f 100644
--- a/include/asm-powerpc/hvconsole.h
+++ b/include/asm-powerpc/hvconsole.h
@@ -24,28 +24,18 @@
24#ifdef __KERNEL__ 24#ifdef __KERNEL__
25 25
26/* 26/*
27 * This is the max number of console adapters that can/will be found as 27 * PSeries firmware will only send/recv up to 16 bytes of character data per
28 * console devices on first stage console init. Any number beyond this range 28 * hcall.
29 * can't be used as a console device but is still a valid tty device.
30 */ 29 */
31#define MAX_NR_HVC_CONSOLES 16 30#define MAX_VIO_PUT_CHARS 16
31#define SIZE_VIO_GET_CHARS 16
32 32
33/* implemented by a low level driver */ 33/*
34struct hv_ops { 34 * Vio firmware always attempts to fetch MAX_VIO_GET_CHARS chars. The 'count'
35 int (*get_chars)(uint32_t vtermno, char *buf, int count); 35 * parm is included to conform to put_chars() function pointer template
36 int (*put_chars)(uint32_t vtermno, const char *buf, int count); 36 */
37};
38extern int hvc_get_chars(uint32_t vtermno, char *buf, int count); 37extern int hvc_get_chars(uint32_t vtermno, char *buf, int count);
39extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count); 38extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count);
40 39
41struct hvc_struct;
42
43/* Register a vterm and a slot index for use as a console (console_init) */
44extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops);
45/* register a vterm for hvc tty operation (module_init or hotplug add) */
46extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq,
47 struct hv_ops *ops);
48/* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */
49extern int __devexit hvc_remove(struct hvc_struct *hp);
50#endif /* __KERNEL__ */ 40#endif /* __KERNEL__ */
51#endif /* _PPC64_HVCONSOLE_H */ 41#endif /* _PPC64_HVCONSOLE_H */
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 8eb7e857ec4c..51f87d9993b6 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -479,6 +479,10 @@ extern int distribute_irqs;
479struct irqaction; 479struct irqaction;
480struct pt_regs; 480struct pt_regs;
481 481
482#define __ARCH_HAS_DO_SOFTIRQ
483
484extern void __do_softirq(void);
485
482#ifdef CONFIG_IRQSTACKS 486#ifdef CONFIG_IRQSTACKS
483/* 487/*
484 * Per-cpu stacks for handling hard and soft interrupts. 488 * Per-cpu stacks for handling hard and soft interrupts.
@@ -491,8 +495,6 @@ extern void call_do_softirq(struct thread_info *tp);
491extern int call___do_IRQ(int irq, struct pt_regs *regs, 495extern int call___do_IRQ(int irq, struct pt_regs *regs,
492 struct thread_info *tp); 496 struct thread_info *tp);
493 497
494#define __ARCH_HAS_DO_SOFTIRQ
495
496#else 498#else
497#define irq_ctx_init() 499#define irq_ctx_init()
498 500
diff --git a/include/asm-powerpc/iseries/mf.h b/include/asm-powerpc/iseries/mf.h
index 857e5202fc78..eb851a9c9e5c 100644
--- a/include/asm-powerpc/iseries/mf.h
+++ b/include/asm-powerpc/iseries/mf.h
@@ -41,16 +41,11 @@ extern void mf_deallocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type,
41 unsigned count, MFCompleteHandler hdlr, void *userToken); 41 unsigned count, MFCompleteHandler hdlr, void *userToken);
42 42
43extern void mf_power_off(void); 43extern void mf_power_off(void);
44extern void mf_reboot(void); 44extern void mf_reboot(char *cmd);
45 45
46extern void mf_display_src(u32 word); 46extern void mf_display_src(u32 word);
47extern void mf_display_progress(u16 value); 47extern void mf_display_progress(u16 value);
48extern void mf_clear_src(void);
49 48
50extern void mf_init(void); 49extern void mf_init(void);
51 50
52extern int mf_get_rtc(struct rtc_time *tm);
53extern int mf_get_boot_rtc(struct rtc_time *tm);
54extern int mf_set_rtc(struct rtc_time *tm);
55
56#endif /* _ASM_POWERPC_ISERIES_MF_H */ 51#endif /* _ASM_POWERPC_ISERIES_MF_H */
diff --git a/include/asm-powerpc/kdebug.h b/include/asm-powerpc/kdebug.h
index 7c16265568e0..c01786ab5fa6 100644
--- a/include/asm-powerpc/kdebug.h
+++ b/include/asm-powerpc/kdebug.h
@@ -16,13 +16,9 @@ struct die_args {
16 int signr; 16 int signr;
17}; 17};
18 18
19/* 19extern int register_die_notifier(struct notifier_block *);
20 Note - you should never unregister because that can race with NMIs. 20extern int unregister_die_notifier(struct notifier_block *);
21 If you really want to do it first unregister - then synchronize_sched - 21extern struct atomic_notifier_head powerpc_die_chain;
22 then free.
23 */
24int register_die_notifier(struct notifier_block *nb);
25extern struct notifier_block *powerpc_die_chain;
26 22
27/* Grossly misnamed. */ 23/* Grossly misnamed. */
28enum die_val { 24enum die_val {
@@ -37,7 +33,7 @@ enum die_val {
37static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap, int sig) 33static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap, int sig)
38{ 34{
39 struct die_args args = { .regs=regs, .str=str, .err=err, .trapnr=trap,.signr=sig }; 35 struct die_args args = { .regs=regs, .str=str, .err=err, .trapnr=trap,.signr=sig };
40 return notifier_call_chain(&powerpc_die_chain, val, &args); 36 return atomic_notifier_call_chain(&powerpc_die_chain, val, &args);
41} 37}
42 38
43#endif /* __KERNEL__ */ 39#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/lmb.h b/include/asm-powerpc/lmb.h
index d3546c4c9f46..0c5880f70225 100644
--- a/include/asm-powerpc/lmb.h
+++ b/include/asm-powerpc/lmb.h
@@ -19,8 +19,6 @@
19 19
20#define MAX_LMB_REGIONS 128 20#define MAX_LMB_REGIONS 128
21 21
22#define LMB_ALLOC_ANYWHERE 0
23
24struct lmb_property { 22struct lmb_property {
25 unsigned long base; 23 unsigned long base;
26 unsigned long size; 24 unsigned long size;
@@ -43,20 +41,19 @@ extern struct lmb lmb;
43 41
44extern void __init lmb_init(void); 42extern void __init lmb_init(void);
45extern void __init lmb_analyze(void); 43extern void __init lmb_analyze(void);
46extern long __init lmb_add(unsigned long, unsigned long); 44extern long __init lmb_add(unsigned long base, unsigned long size);
47extern long __init lmb_reserve(unsigned long, unsigned long); 45extern long __init lmb_reserve(unsigned long base, unsigned long size);
48extern unsigned long __init lmb_alloc(unsigned long, unsigned long); 46extern unsigned long __init lmb_alloc(unsigned long size, unsigned long align);
49extern unsigned long __init lmb_alloc_base(unsigned long, unsigned long, 47extern unsigned long __init lmb_alloc_base(unsigned long size,
50 unsigned long); 48 unsigned long align, unsigned long max_addr);
49extern unsigned long __init __lmb_alloc_base(unsigned long size,
50 unsigned long align, unsigned long max_addr);
51extern unsigned long __init lmb_phys_mem_size(void); 51extern unsigned long __init lmb_phys_mem_size(void);
52extern unsigned long __init lmb_end_of_DRAM(void); 52extern unsigned long __init lmb_end_of_DRAM(void);
53extern unsigned long __init lmb_abs_to_phys(unsigned long); 53extern void __init lmb_enforce_memory_limit(unsigned long memory_limit);
54extern void __init lmb_enforce_memory_limit(unsigned long);
55 54
56extern void lmb_dump_all(void); 55extern void lmb_dump_all(void);
57 56
58extern unsigned long io_hole_start;
59
60static inline unsigned long 57static inline unsigned long
61lmb_size_bytes(struct lmb_region *type, unsigned long region_nr) 58lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
62{ 59{
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 5348b820788c..5ed847680754 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -47,6 +47,7 @@ struct smp_ops_t {
47#endif 47#endif
48 48
49struct machdep_calls { 49struct machdep_calls {
50 char *name;
50#ifdef CONFIG_PPC64 51#ifdef CONFIG_PPC64
51 void (*hpte_invalidate)(unsigned long slot, 52 void (*hpte_invalidate)(unsigned long slot,
52 unsigned long va, 53 unsigned long va,
@@ -85,9 +86,9 @@ struct machdep_calls {
85 void (*iommu_dev_setup)(struct pci_dev *dev); 86 void (*iommu_dev_setup)(struct pci_dev *dev);
86 void (*iommu_bus_setup)(struct pci_bus *bus); 87 void (*iommu_bus_setup)(struct pci_bus *bus);
87 void (*irq_bus_setup)(struct pci_bus *bus); 88 void (*irq_bus_setup)(struct pci_bus *bus);
88#endif 89#endif /* CONFIG_PPC64 */
89 90
90 int (*probe)(int platform); 91 int (*probe)(void);
91 void (*setup_arch)(void); 92 void (*setup_arch)(void);
92 void (*init_early)(void); 93 void (*init_early)(void);
93 /* Optional, may be NULL. */ 94 /* Optional, may be NULL. */
@@ -158,6 +159,12 @@ struct machdep_calls {
158 /* Idle loop for this platform, leave empty for default idle loop */ 159 /* Idle loop for this platform, leave empty for default idle loop */
159 void (*idle_loop)(void); 160 void (*idle_loop)(void);
160 161
162 /*
163 * Function for waiting for work with reduced power in idle loop;
164 * called with interrupts disabled.
165 */
166 void (*power_save)(void);
167
161 /* Function to enable performance monitor counters for this 168 /* Function to enable performance monitor counters for this
162 platform, called once per cpu. */ 169 platform, called once per cpu. */
163 void (*enable_pmcs)(void); 170 void (*enable_pmcs)(void);
@@ -170,13 +177,6 @@ struct machdep_calls {
170 May be NULL. */ 177 May be NULL. */
171 void (*init)(void); 178 void (*init)(void);
172 179
173 void (*idle)(void);
174 void (*power_save)(void);
175
176 void (*heartbeat)(void);
177 unsigned long heartbeat_reset;
178 unsigned long heartbeat_count;
179
180 void (*setup_io_mappings)(void); 180 void (*setup_io_mappings)(void);
181 181
182 void (*early_serial_map)(void); 182 void (*early_serial_map)(void);
@@ -208,8 +208,6 @@ struct machdep_calls {
208 /* Called at then very end of pcibios_init() */ 208 /* Called at then very end of pcibios_init() */
209 void (*pcibios_after_init)(void); 209 void (*pcibios_after_init)(void);
210 210
211 /* this is for modules, since _machine can be a define -- Cort */
212 int ppc_machine;
213#endif /* CONFIG_PPC32 */ 211#endif /* CONFIG_PPC32 */
214 212
215 /* Called to shutdown machine specific hardware not already controlled 213 /* Called to shutdown machine specific hardware not already controlled
@@ -242,10 +240,29 @@ struct machdep_calls {
242#endif /* CONFIG_KEXEC */ 240#endif /* CONFIG_KEXEC */
243}; 241};
244 242
245extern void default_idle(void); 243extern void power4_idle(void);
246extern void native_idle(void); 244extern void ppc6xx_idle(void);
247 245
246/*
247 * ppc_md contains a copy of the machine description structure for the
248 * current platform. machine_id contains the initial address where the
249 * description was found during boot.
250 */
248extern struct machdep_calls ppc_md; 251extern struct machdep_calls ppc_md;
252extern struct machdep_calls *machine_id;
253
254#define __machine_desc __attribute__ ((__section__ (".machine.desc")))
255
256#define define_machine(name) struct machdep_calls mach_##name __machine_desc =
257#define machine_is(name) \
258 ({ \
259 extern struct machdep_calls mach_##name \
260 __attribute__((weak)); \
261 machine_id == &mach_##name; \
262 })
263
264extern void probe_machine(void);
265
249extern char cmd_line[COMMAND_LINE_SIZE]; 266extern char cmd_line[COMMAND_LINE_SIZE];
250 267
251#ifdef CONFIG_PPC_PMAC 268#ifdef CONFIG_PPC_PMAC
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index b0b9a3f8cdc2..31f721994bd8 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -236,7 +236,6 @@ extern void htab_initialize_secondary(void);
236extern void hpte_init_native(void); 236extern void hpte_init_native(void);
237extern void hpte_init_lpar(void); 237extern void hpte_init_lpar(void);
238extern void hpte_init_iSeries(void); 238extern void hpte_init_iSeries(void);
239extern void mm_init_ppc64(void);
240 239
241extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, 240extern long pSeries_lpar_hpte_insert(unsigned long hpte_group,
242 unsigned long va, unsigned long prpn, 241 unsigned long va, unsigned long prpn,
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 338e6a7cff4a..5b33994cd488 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -17,9 +17,6 @@
17 17
18/* Per-counter configuration as set via oprofilefs. */ 18/* Per-counter configuration as set via oprofilefs. */
19struct op_counter_config { 19struct op_counter_config {
20#ifdef __powerpc64__
21 unsigned long valid;
22#endif
23 unsigned long enabled; 20 unsigned long enabled;
24 unsigned long event; 21 unsigned long event;
25 unsigned long count; 22 unsigned long count;
@@ -38,9 +35,6 @@ struct op_system_config {
38#endif 35#endif
39 unsigned long enable_kernel; 36 unsigned long enable_kernel;
40 unsigned long enable_user; 37 unsigned long enable_user;
41#ifdef CONFIG_PPC64
42 unsigned long backtrace_spinlocks;
43#endif
44}; 38};
45 39
46/* Per-arch configuration */ 40/* Per-arch configuration */
@@ -56,17 +50,12 @@ struct op_powerpc_model {
56 int num_counters; 50 int num_counters;
57}; 51};
58 52
59#ifdef CONFIG_FSL_BOOKE
60extern struct op_powerpc_model op_model_fsl_booke; 53extern struct op_powerpc_model op_model_fsl_booke;
61#else /* Otherwise, it's classic */
62
63#ifdef CONFIG_PPC64
64extern struct op_powerpc_model op_model_rs64; 54extern struct op_powerpc_model op_model_rs64;
65extern struct op_powerpc_model op_model_power4; 55extern struct op_powerpc_model op_model_power4;
66
67#else /* Otherwise, CONFIG_PPC32 */
68extern struct op_powerpc_model op_model_7450; 56extern struct op_powerpc_model op_model_7450;
69#endif 57
58#ifndef CONFIG_FSL_BOOKE
70 59
71/* All the classic PPC parts use these */ 60/* All the classic PPC parts use these */
72static inline unsigned int ctr_read(unsigned int i) 61static inline unsigned int ctr_read(unsigned int i)
@@ -134,5 +123,7 @@ static inline void ctr_write(unsigned int i, unsigned int val)
134} 123}
135#endif /* !CONFIG_FSL_BOOKE */ 124#endif /* !CONFIG_FSL_BOOKE */
136 125
126extern void op_powerpc_backtrace(struct pt_regs * const regs, unsigned int depth);
127
137#endif /* __KERNEL__ */ 128#endif /* __KERNEL__ */
138#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */ 129#endif /* _ASM_POWERPC_OPROFILE_IMPL_H */
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index c9add8f1ad94..706325f99a84 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -54,7 +54,7 @@ struct paca_struct {
54#endif /* CONFIG_PPC_ISERIES */ 54#endif /* CONFIG_PPC_ISERIES */
55 55
56 /* 56 /*
57 * MAGIC: the spinlock functions in arch/ppc64/lib/locks.c 57 * MAGIC: the spinlock functions in arch/powerpc/lib/locks.c
58 * load lock_token and paca_index with a single lwz 58 * load lock_token and paca_index with a single lwz
59 * instruction. They must travel together and be properly 59 * instruction. They must travel together and be properly
60 * aligned. 60 * aligned.
@@ -96,9 +96,16 @@ struct paca_struct {
96 u64 saved_r1; /* r1 save for RTAS calls */ 96 u64 saved_r1; /* r1 save for RTAS calls */
97 u64 saved_msr; /* MSR saved here by enter_rtas */ 97 u64 saved_msr; /* MSR saved here by enter_rtas */
98 u8 proc_enabled; /* irq soft-enable flag */ 98 u8 proc_enabled; /* irq soft-enable flag */
99
100 /* Stuff for accurate time accounting */
101 u64 user_time; /* accumulated usermode TB ticks */
102 u64 system_time; /* accumulated system TB ticks */
103 u64 startpurr; /* PURR/TB value snapshot */
99}; 104};
100 105
101extern struct paca_struct paca[]; 106extern struct paca_struct paca[];
102 107
108void setup_boot_paca(void);
109
103#endif /* __KERNEL__ */ 110#endif /* __KERNEL__ */
104#endif /* _ASM_POWERPC_PACA_H */ 111#endif /* _ASM_POWERPC_PACA_H */
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
index 0b82df483f7f..2fbecebe1c92 100644
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -69,8 +69,6 @@
69#endif 69#endif
70 70
71#ifdef CONFIG_FLATMEM 71#ifdef CONFIG_FLATMEM
72#define pfn_to_page(pfn) (mem_map + (pfn))
73#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
74#define pfn_valid(pfn) ((pfn) < max_mapnr) 72#define pfn_valid(pfn) ((pfn) < max_mapnr)
75#endif 73#endif
76 74
@@ -200,6 +198,7 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr,
200 struct page *p); 198 struct page *p);
201extern int page_is_ram(unsigned long pfn); 199extern int page_is_ram(unsigned long pfn);
202 200
201#include <asm-generic/memory_model.h>
203#endif /* __ASSEMBLY__ */ 202#endif /* __ASSEMBLY__ */
204 203
205#endif /* __KERNEL__ */ 204#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
index e31922c50e53..184a7a4d2fdf 100644
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -27,10 +27,9 @@
27#define percpu_modcopy(pcpudst, src, size) \ 27#define percpu_modcopy(pcpudst, src, size) \
28do { \ 28do { \
29 unsigned int __i; \ 29 unsigned int __i; \
30 for (__i = 0; __i < NR_CPUS; __i++) \ 30 for_each_possible_cpu(__i) \
31 if (cpu_possible(__i)) \ 31 memcpy((pcpudst)+__per_cpu_offset(__i), \
32 memcpy((pcpudst)+__per_cpu_offset(__i), \ 32 (src), (size)); \
33 (src), (size)); \
34} while (0) 33} while (0)
35 34
36extern void setup_per_cpu_areas(void); 35extern void setup_per_cpu_areas(void);
diff --git a/include/asm-powerpc/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h
index 80a7832d2721..b2e18629932a 100644
--- a/include/asm-powerpc/pgtable-4k.h
+++ b/include/asm-powerpc/pgtable-4k.h
@@ -62,9 +62,14 @@
62/* shift to put page number into pte */ 62/* shift to put page number into pte */
63#define PTE_RPN_SHIFT (17) 63#define PTE_RPN_SHIFT (17)
64 64
65#define __real_pte(e,p) ((real_pte_t)(e)) 65#ifdef STRICT_MM_TYPECHECKS
66#define __rpte_to_pte(r) (r) 66#define __real_pte(e,p) ((real_pte_t){(e)})
67#define __rpte_to_hidx(r,index) (pte_val((r)) >> 12) 67#define __rpte_to_pte(r) ((r).pte)
68#else
69#define __real_pte(e,p) (e)
70#define __rpte_to_pte(r) (__pte(r))
71#endif
72#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> 12)
68 73
69#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \ 74#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
70 do { \ 75 do { \
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h
index e38931379a72..e9f1f4627e6b 100644
--- a/include/asm-powerpc/pgtable.h
+++ b/include/asm-powerpc/pgtable.h
@@ -188,9 +188,13 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
188#define pte_pfn(x) ((unsigned long)((pte_val(x)>>PTE_RPN_SHIFT))) 188#define pte_pfn(x) ((unsigned long)((pte_val(x)>>PTE_RPN_SHIFT)))
189#define pte_page(x) pfn_to_page(pte_pfn(x)) 189#define pte_page(x) pfn_to_page(pte_pfn(x))
190 190
191#define PMD_BAD_BITS (PTE_TABLE_SIZE-1)
192#define PUD_BAD_BITS (PMD_TABLE_SIZE-1)
193
191#define pmd_set(pmdp, pmdval) (pmd_val(*(pmdp)) = (pmdval)) 194#define pmd_set(pmdp, pmdval) (pmd_val(*(pmdp)) = (pmdval))
192#define pmd_none(pmd) (!pmd_val(pmd)) 195#define pmd_none(pmd) (!pmd_val(pmd))
193#define pmd_bad(pmd) (pmd_val(pmd) == 0) 196#define pmd_bad(pmd) (!is_kernel_addr(pmd_val(pmd)) \
197 || (pmd_val(pmd) & PMD_BAD_BITS))
194#define pmd_present(pmd) (pmd_val(pmd) != 0) 198#define pmd_present(pmd) (pmd_val(pmd) != 0)
195#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) 199#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0)
196#define pmd_page_kernel(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) 200#define pmd_page_kernel(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)
@@ -198,7 +202,8 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
198 202
199#define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval)) 203#define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval))
200#define pud_none(pud) (!pud_val(pud)) 204#define pud_none(pud) (!pud_val(pud))
201#define pud_bad(pud) ((pud_val(pud)) == 0) 205#define pud_bad(pud) (!is_kernel_addr(pud_val(pud)) \
206 || (pud_val(pud) & PUD_BAD_BITS))
202#define pud_present(pud) (pud_val(pud) != 0) 207#define pud_present(pud) (pud_val(pud) != 0)
203#define pud_clear(pudp) (pud_val(*(pudp)) = 0) 208#define pud_clear(pudp) (pud_val(*(pudp)) = 0)
204#define pud_page(pud) (pud_val(pud) & ~PUD_MASKED_BITS) 209#define pud_page(pud) (pud_val(pud) & ~PUD_MASKED_BITS)
@@ -468,11 +473,6 @@ extern pgd_t swapper_pg_dir[];
468 473
469extern void paging_init(void); 474extern void paging_init(void);
470 475
471#ifdef CONFIG_HUGETLB_PAGE
472#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \
473 free_pgd_range(tlb, addr, end, floor, ceiling)
474#endif
475
476/* 476/*
477 * This gets called at the end of handling a page fault, when 477 * This gets called at the end of handling a page fault, when
478 * the kernel has put a new PTE into the page table for the process. 478 * the kernel has put a new PTE into the page table for the process.
diff --git a/include/asm-powerpc/pmac_feature.h b/include/asm-powerpc/pmac_feature.h
index 3221628130c4..d3599cc9aa74 100644
--- a/include/asm-powerpc/pmac_feature.h
+++ b/include/asm-powerpc/pmac_feature.h
@@ -305,7 +305,7 @@ extern void pmac_feature_init(void);
305extern void pmac_set_early_video_resume(void (*proc)(void *data), void *data); 305extern void pmac_set_early_video_resume(void (*proc)(void *data), void *data);
306extern void pmac_call_early_video_resume(void); 306extern void pmac_call_early_video_resume(void);
307 307
308#define PMAC_FTR_DEF(x) ((_MACH_Pmac << 16) | (x)) 308#define PMAC_FTR_DEF(x) ((0x6660000) | (x))
309 309
310/* The AGP driver registers itself here */ 310/* The AGP driver registers itself here */
311extern void pmac_register_agp_pm(struct pci_dev *bridge, 311extern void pmac_register_agp_pm(struct pci_dev *bridge,
diff --git a/include/asm-powerpc/poll.h b/include/asm-powerpc/poll.h
index edd2054da86b..9c7d12631033 100644
--- a/include/asm-powerpc/poll.h
+++ b/include/asm-powerpc/poll.h
@@ -13,6 +13,7 @@
13#define POLLWRBAND 0x0200 13#define POLLWRBAND 0x0200
14#define POLLMSG 0x0400 14#define POLLMSG 0x0400
15#define POLLREMOVE 0x1000 15#define POLLREMOVE 0x1000
16#define POLLRDHUP 0x2000
16 17
17struct pollfd { 18struct pollfd {
18 int fd; 19 int fd;
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index f80482c7231f..cf79bc7ebb55 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -38,6 +38,7 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
38 38
39void pci_devs_phb_init(void); 39void pci_devs_phb_init(void);
40void pci_devs_phb_init_dynamic(struct pci_controller *phb); 40void pci_devs_phb_init_dynamic(struct pci_controller *phb);
41int setup_phb(struct device_node *dev, struct pci_controller *phb);
41void __devinit scan_phb(struct pci_controller *hose); 42void __devinit scan_phb(struct pci_controller *hose);
42 43
43/* From rtas_pci.h */ 44/* From rtas_pci.h */
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h
index ab8688d39024..dd1c0a913d5f 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -15,6 +15,48 @@
15#define SZL (BITS_PER_LONG/8) 15#define SZL (BITS_PER_LONG/8)
16 16
17/* 17/*
18 * Stuff for accurate CPU time accounting.
19 * These macros handle transitions between user and system state
20 * in exception entry and exit and accumulate time to the
21 * user_time and system_time fields in the paca.
22 */
23
24#ifndef CONFIG_VIRT_CPU_ACCOUNTING
25#define ACCOUNT_CPU_USER_ENTRY(ra, rb)
26#define ACCOUNT_CPU_USER_EXIT(ra, rb)
27#else
28#define ACCOUNT_CPU_USER_ENTRY(ra, rb) \
29 beq 2f; /* if from kernel mode */ \
30BEGIN_FTR_SECTION; \
31 mfspr ra,SPRN_PURR; /* get processor util. reg */ \
32END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
33BEGIN_FTR_SECTION; \
34 mftb ra; /* or get TB if no PURR */ \
35END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
36 ld rb,PACA_STARTPURR(r13); \
37 std ra,PACA_STARTPURR(r13); \
38 subf rb,rb,ra; /* subtract start value */ \
39 ld ra,PACA_USER_TIME(r13); \
40 add ra,ra,rb; /* add on to user time */ \
41 std ra,PACA_USER_TIME(r13); \
422:
43
44#define ACCOUNT_CPU_USER_EXIT(ra, rb) \
45BEGIN_FTR_SECTION; \
46 mfspr ra,SPRN_PURR; /* get processor util. reg */ \
47END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
48BEGIN_FTR_SECTION; \
49 mftb ra; /* or get TB if no PURR */ \
50END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
51 ld rb,PACA_STARTPURR(r13); \
52 std ra,PACA_STARTPURR(r13); \
53 subf rb,rb,ra; /* subtract start value */ \
54 ld ra,PACA_SYSTEM_TIME(r13); \
55 add ra,ra,rb; /* add on to user time */ \
56 std ra,PACA_SYSTEM_TIME(r13);
57#endif
58
59/*
18 * Macros for storing registers into and loading registers from 60 * Macros for storing registers into and loading registers from
19 * exception frames. 61 * exception frames.
20 */ 62 */
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index 415fa393b00c..93f83efeb310 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -22,22 +22,6 @@
22 * -- BenH. 22 * -- BenH.
23 */ 23 */
24 24
25/* Platforms codes (to be obsoleted) */
26#define PLATFORM_PSERIES 0x0100
27#define PLATFORM_PSERIES_LPAR 0x0101
28#define PLATFORM_ISERIES_LPAR 0x0201
29#define PLATFORM_LPAR 0x0001
30#define PLATFORM_POWERMAC 0x0400
31#define PLATFORM_MAPLE 0x0500
32#define PLATFORM_PREP 0x0600
33#define PLATFORM_CHRP 0x0700
34#define PLATFORM_CELL 0x1000
35
36/* Compat platform codes for 32 bits */
37#define _MACH_prep PLATFORM_PREP
38#define _MACH_Pmac PLATFORM_POWERMAC
39#define _MACH_chrp PLATFORM_CHRP
40
41/* PREP sub-platform types see residual.h for these */ 25/* PREP sub-platform types see residual.h for these */
42#define _PREP_Motorola 0x01 /* motorola prep */ 26#define _PREP_Motorola 0x01 /* motorola prep */
43#define _PREP_Firm 0x02 /* firmworks prep */ 27#define _PREP_Firm 0x02 /* firmworks prep */
@@ -49,19 +33,14 @@
49#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ 33#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
50#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ 34#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */
51 35
52#ifdef __KERNEL__ 36#if defined(__KERNEL__) && defined(CONFIG_PPC32)
53#define platform_is_pseries() (_machine == PLATFORM_PSERIES || \
54 _machine == PLATFORM_PSERIES_LPAR)
55#define platform_is_lpar() (!!(_machine & PLATFORM_LPAR))
56 37
57#if defined(CONFIG_PPC_MULTIPLATFORM) 38extern int _chrp_type;
58extern int _machine;
59 39
60#ifdef CONFIG_PPC32 40#ifdef CONFIG_PPC_PREP
61 41
62/* what kind of prep workstation we are */ 42/* what kind of prep workstation we are */
63extern int _prep_type; 43extern int _prep_type;
64extern int _chrp_type;
65 44
66/* 45/*
67 * This is used to identify the board type from a given PReP board 46 * This is used to identify the board type from a given PReP board
@@ -71,17 +50,14 @@ extern int _chrp_type;
71extern unsigned char ucBoardRev; 50extern unsigned char ucBoardRev;
72extern unsigned char ucBoardRevMaj, ucBoardRevMin; 51extern unsigned char ucBoardRevMaj, ucBoardRevMin;
73 52
74#endif /* CONFIG_PPC32 */ 53#endif /* CONFIG_PPC_PREP */
75 54
76#elif defined(CONFIG_PPC_ISERIES) 55#ifndef CONFIG_PPC_MULTIPLATFORM
77/*
78 * iSeries is soon to become MULTIPLATFORM hopefully ...
79 */
80#define _machine PLATFORM_ISERIES_LPAR
81#else
82#define _machine 0 56#define _machine 0
83#endif /* CONFIG_PPC_MULTIPLATFORM */ 57#endif /* CONFIG_PPC_MULTIPLATFORM */
84#endif /* __KERNEL__ */ 58
59#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */
60
85/* 61/*
86 * Default implementation of macro that returns current 62 * Default implementation of macro that returns current
87 * instruction pointer ("program counter"). 63 * instruction pointer ("program counter").
@@ -252,6 +228,10 @@ static inline unsigned long __pack_fe01(unsigned int fpmode)
252#define cpu_relax() barrier() 228#define cpu_relax() barrier()
253#endif 229#endif
254 230
231/* Check that a certain kernel stack pointer is valid in task_struct p */
232int validate_sp(unsigned long sp, struct task_struct *p,
233 unsigned long nbytes);
234
255/* 235/*
256 * Prefetch macros. 236 * Prefetch macros.
257 */ 237 */
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index cbd297f44cce..97ef1cd71a4d 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -126,8 +126,14 @@ extern struct device_node *find_all_nodes(void);
126/* New style node lookup */ 126/* New style node lookup */
127extern struct device_node *of_find_node_by_name(struct device_node *from, 127extern struct device_node *of_find_node_by_name(struct device_node *from,
128 const char *name); 128 const char *name);
129#define for_each_node_by_name(dn, name) \
130 for (dn = of_find_node_by_name(NULL, name); dn; \
131 dn = of_find_node_by_name(dn, name))
129extern struct device_node *of_find_node_by_type(struct device_node *from, 132extern struct device_node *of_find_node_by_type(struct device_node *from,
130 const char *type); 133 const char *type);
134#define for_each_node_by_type(dn, type) \
135 for (dn = of_find_node_by_type(NULL, type); dn; \
136 dn = of_find_node_by_type(dn, type))
131extern struct device_node *of_find_compatible_node(struct device_node *from, 137extern struct device_node *of_find_compatible_node(struct device_node *from,
132 const char *type, const char *compat); 138 const char *type, const char *compat);
133extern struct device_node *of_find_node_by_path(const char *path); 139extern struct device_node *of_find_node_by_path(const char *path);
@@ -143,12 +149,14 @@ extern struct device_node *of_node_get(struct device_node *node);
143extern void of_node_put(struct device_node *node); 149extern void of_node_put(struct device_node *node);
144 150
145/* For scanning the flat device-tree at boot time */ 151/* For scanning the flat device-tree at boot time */
146int __init of_scan_flat_dt(int (*it)(unsigned long node, 152extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
147 const char *uname, int depth, 153 const char *uname, int depth,
148 void *data), 154 void *data),
149 void *data); 155 void *data);
150void* __init of_get_flat_dt_prop(unsigned long node, const char *name, 156extern void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
151 unsigned long *size); 157 unsigned long *size);
158extern int __init of_flat_dt_is_compatible(unsigned long node, const char *name);
159extern unsigned long __init of_get_flat_dt_root(void);
152 160
153/* For updating the device tree at runtime */ 161/* For updating the device tree at runtime */
154extern void of_attach_node(struct device_node *); 162extern void of_attach_node(struct device_node *);
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 72bfe3af0460..bd467bf5cf5a 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -622,6 +622,10 @@ extern void ppc64_runlatch_off(void);
622extern unsigned long scom970_read(unsigned int address); 622extern unsigned long scom970_read(unsigned int address);
623extern void scom970_write(unsigned int address, unsigned long value); 623extern void scom970_write(unsigned int address, unsigned long value);
624 624
625#else
626#define ppc64_runlatch_on()
627#define ppc64_runlatch_off()
628
625#endif /* CONFIG_PPC64 */ 629#endif /* CONFIG_PPC64 */
626 630
627#define __get_SP() ({unsigned long sp; \ 631#define __get_SP() ({unsigned long sp; \
diff --git a/include/asm-powerpc/rwsem.h b/include/asm-powerpc/rwsem.h
index 79bae4933b73..2c2fe9647595 100644
--- a/include/asm-powerpc/rwsem.h
+++ b/include/asm-powerpc/rwsem.h
@@ -4,7 +4,7 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6/* 6/*
7 * include/asm-ppc64/rwsem.h: R/W semaphores for PPC using the stuff 7 * include/asm-powerpc/rwsem.h: R/W semaphores for PPC using the stuff
8 * in lib/rwsem.c. Adapted largely from include/asm-i386/rwsem.h 8 * in lib/rwsem.c. Adapted largely from include/asm-i386/rwsem.h
9 * by Paul Mackerras <paulus@samba.org>. 9 * by Paul Mackerras <paulus@samba.org>.
10 */ 10 */
diff --git a/include/asm-powerpc/smp.h b/include/asm-powerpc/smp.h
index 98581e5a8279..4a716f707cf6 100644
--- a/include/asm-powerpc/smp.h
+++ b/include/asm-powerpc/smp.h
@@ -29,7 +29,6 @@
29#endif 29#endif
30 30
31extern int boot_cpuid; 31extern int boot_cpuid;
32extern int boot_cpuid_phys;
33 32
34extern void cpu_die(void); 33extern void cpu_die(void);
35 34
@@ -99,6 +98,7 @@ extern void smp_release_cpus(void);
99#else 98#else
100/* 32-bit */ 99/* 32-bit */
101#ifndef CONFIG_SMP 100#ifndef CONFIG_SMP
101extern int boot_cpuid_phys;
102#define get_hard_smp_processor_id(cpu) boot_cpuid_phys 102#define get_hard_smp_processor_id(cpu) boot_cpuid_phys
103#define set_hard_smp_processor_id(cpu, phys) 103#define set_hard_smp_processor_id(cpu, phys)
104#endif 104#endif
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 38bacf2f6e0c..f431d8b0b651 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -110,6 +110,7 @@ struct spu {
110 char *name; 110 char *name;
111 unsigned long local_store_phys; 111 unsigned long local_store_phys;
112 u8 *local_store; 112 u8 *local_store;
113 unsigned long problem_phys;
113 struct spu_problem __iomem *problem; 114 struct spu_problem __iomem *problem;
114 struct spu_priv1 __iomem *priv1; 115 struct spu_priv1 __iomem *priv1;
115 struct spu_priv2 __iomem *priv2; 116 struct spu_priv2 __iomem *priv2;
@@ -137,6 +138,7 @@ struct spu {
137 void (* wbox_callback)(struct spu *spu); 138 void (* wbox_callback)(struct spu *spu);
138 void (* ibox_callback)(struct spu *spu); 139 void (* ibox_callback)(struct spu *spu);
139 void (* stop_callback)(struct spu *spu); 140 void (* stop_callback)(struct spu *spu);
141 void (* mfc_callback)(struct spu *spu);
140 142
141 char irq_c0[8]; 143 char irq_c0[8];
142 char irq_c1[8]; 144 char irq_c1[8];
@@ -149,6 +151,14 @@ int spu_irq_class_0_bottom(struct spu *spu);
149int spu_irq_class_1_bottom(struct spu *spu); 151int spu_irq_class_1_bottom(struct spu *spu);
150void spu_irq_setaffinity(struct spu *spu, int cpu); 152void spu_irq_setaffinity(struct spu *spu, int cpu);
151 153
154/* system callbacks from the SPU */
155struct spu_syscall_block {
156 u64 nr_ret;
157 u64 parm[6];
158};
159extern long spu_sys_callback(struct spu_syscall_block *s);
160
161/* syscalls implemented in spufs */
152extern struct spufs_calls { 162extern struct spufs_calls {
153 asmlinkage long (*create_thread)(const char __user *name, 163 asmlinkage long (*create_thread)(const char __user *name,
154 unsigned int flags, mode_t mode); 164 unsigned int flags, mode_t mode);
@@ -399,7 +409,6 @@ struct spu_priv1 {
399#define SPU_GET_REVISION_BITS(vr) (vr & SPU_REVISION_BITS) 409#define SPU_GET_REVISION_BITS(vr) (vr & SPU_REVISION_BITS)
400 u8 pad_0x28_0x100[0x100 - 0x28]; /* 0x28 */ 410 u8 pad_0x28_0x100[0x100 - 0x28]; /* 0x28 */
401 411
402
403 /* Interrupt Area */ 412 /* Interrupt Area */
404 u64 int_mask_RW[3]; /* 0x100 */ 413 u64 int_mask_RW[3]; /* 0x100 */
405#define CLASS0_ENABLE_DMA_ALIGNMENT_INTR 0x1L 414#define CLASS0_ENABLE_DMA_ALIGNMENT_INTR 0x1L
diff --git a/include/asm-powerpc/string.h b/include/asm-powerpc/string.h
index 8606a696c088..faa407f33c6b 100644
--- a/include/asm-powerpc/string.h
+++ b/include/asm-powerpc/string.h
@@ -15,7 +15,7 @@
15#define __HAVE_ARCH_MEMCHR 15#define __HAVE_ARCH_MEMCHR
16 16
17extern int strcasecmp(const char *, const char *); 17extern int strcasecmp(const char *, const char *);
18extern int strncasecmp(const char *, const char *, int); 18extern int strncasecmp(const char *, const char *, __kernel_size_t);
19extern char * strcpy(char *,const char *); 19extern char * strcpy(char *,const char *);
20extern char * strncpy(char *,const char *, __kernel_size_t); 20extern char * strncpy(char *,const char *, __kernel_size_t);
21extern __kernel_size_t strlen(const char *); 21extern __kernel_size_t strlen(const char *);
diff --git a/include/asm-powerpc/synch.h b/include/asm-powerpc/synch.h
index c90d9d9aae72..2cda3c38a9fa 100644
--- a/include/asm-powerpc/synch.h
+++ b/include/asm-powerpc/synch.h
@@ -15,7 +15,7 @@
15#endif 15#endif
16 16
17#ifdef CONFIG_SMP 17#ifdef CONFIG_SMP
18#define ISYNC_ON_SMP "\n\tisync" 18#define ISYNC_ON_SMP "\n\tisync\n"
19#define LWSYNC_ON_SMP __stringify(LWSYNC) "\n" 19#define LWSYNC_ON_SMP __stringify(LWSYNC) "\n"
20#else 20#else
21#define ISYNC_ON_SMP 21#define ISYNC_ON_SMP
diff --git a/include/asm-powerpc/syscalls.h b/include/asm-powerpc/syscalls.h
new file mode 100644
index 000000000000..c2fe79d4f90f
--- /dev/null
+++ b/include/asm-powerpc/syscalls.h
@@ -0,0 +1,58 @@
1#ifndef __ASM_POWERPC_SYSCALLS_H
2#define __ASM_POWERPC_SYSCALLS_H
3#ifdef __KERNEL__
4
5#include <linux/compiler.h>
6#include <linux/linkage.h>
7#include <linux/types.h>
8#include <asm/signal.h>
9
10struct new_utsname;
11struct pt_regs;
12struct rtas_args;
13struct sigaction;
14
15asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
16 unsigned long prot, unsigned long flags,
17 unsigned long fd, off_t offset);
18asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len,
19 unsigned long prot, unsigned long flags,
20 unsigned long fd, unsigned long pgoff);
21asmlinkage int sys_execve(unsigned long a0, unsigned long a1,
22 unsigned long a2, unsigned long a3, unsigned long a4,
23 unsigned long a5, struct pt_regs *regs);
24asmlinkage int sys_clone(unsigned long clone_flags, unsigned long usp,
25 int __user *parent_tidp, void __user *child_threadptr,
26 int __user *child_tidp, int p6, struct pt_regs *regs);
27asmlinkage int sys_fork(unsigned long p1, unsigned long p2,
28 unsigned long p3, unsigned long p4, unsigned long p5,
29 unsigned long p6, struct pt_regs *regs);
30asmlinkage int sys_vfork(unsigned long p1, unsigned long p2,
31 unsigned long p3, unsigned long p4, unsigned long p5,
32 unsigned long p6, struct pt_regs *regs);
33asmlinkage int sys_pipe(int __user *fildes);
34asmlinkage long sys_rt_sigaction(int sig,
35 const struct sigaction __user *act,
36 struct sigaction __user *oact, size_t sigsetsize);
37asmlinkage int sys_ipc(uint call, int first, unsigned long second,
38 long third, void __user *ptr, long fifth);
39asmlinkage long ppc64_personality(unsigned long personality);
40asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
41asmlinkage time_t sys64_time(time_t __user * tloc);
42asmlinkage long ppc_newuname(struct new_utsname __user * name);
43
44asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset,
45 size_t sigsetsize);
46
47#ifndef __powerpc64__
48asmlinkage long sys_sigaltstack(const stack_t __user *uss,
49 stack_t __user *uoss, int r5, int r6, int r7, int r8,
50 struct pt_regs *regs);
51#else /* __powerpc64__ */
52asmlinkage long sys_sigaltstack(const stack_t __user *uss,
53 stack_t __user *uoss, unsigned long r5, unsigned long r6,
54 unsigned long r7, unsigned long r8, struct pt_regs *regs);
55#endif /* __powerpc64__ */
56
57#endif /* __KERNEL__ */
58#endif /* __ASM_POWERPC_SYSCALLS_H */
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index d9bf53653b10..d075725bf444 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -171,6 +171,8 @@ extern u32 booke_wdt_period;
171 171
172/* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */ 172/* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */
173extern unsigned char e2a(unsigned char); 173extern unsigned char e2a(unsigned char);
174extern unsigned char* strne2a(unsigned char *dest,
175 const unsigned char *src, size_t n);
174 176
175struct device_node; 177struct device_node;
176extern void note_scsi_host(struct device_node *, void *); 178extern void note_scsi_host(struct device_node *, void *);
@@ -363,8 +365,11 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new,
363 * powers of 2 writes until it reaches sufficient alignment). 365 * powers of 2 writes until it reaches sufficient alignment).
364 * 366 *
365 * Based on this we disable the IP header alignment in network drivers. 367 * Based on this we disable the IP header alignment in network drivers.
368 * We also modify NET_SKB_PAD to be a cacheline in size, thus maintaining
369 * cacheline alignment of buffers.
366 */ 370 */
367#define NET_IP_ALIGN 0 371#define NET_IP_ALIGN 0
372#define NET_SKB_PAD L1_CACHE_BYTES
368#endif 373#endif
369 374
370#define arch_align_stack(x) (x) 375#define arch_align_stack(x) (x)
@@ -424,5 +429,9 @@ static inline void create_function_call(unsigned long addr, void * func)
424 create_branch(addr, func_addr, BRANCH_SET_LINK); 429 create_branch(addr, func_addr, BRANCH_SET_LINK);
425} 430}
426 431
432#ifdef CONFIG_VIRT_CPU_ACCOUNTING
433extern void account_system_vtime(struct task_struct *);
434#endif
435
427#endif /* __KERNEL__ */ 436#endif /* __KERNEL__ */
428#endif /* _ASM_POWERPC_SYSTEM_H */ 437#endif /* _ASM_POWERPC_SYSTEM_H */
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index baddc9ab57ad..912118db13ae 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -41,6 +41,7 @@ extern time_t last_rtc_update;
41 41
42extern void generic_calibrate_decr(void); 42extern void generic_calibrate_decr(void);
43extern void wakeup_decrementer(void); 43extern void wakeup_decrementer(void);
44extern void snapshot_timebase(void);
44 45
45/* Some sane defaults: 125 MHz timebase, 1GHz processor */ 46/* Some sane defaults: 125 MHz timebase, 1GHz processor */
46extern unsigned long ppc_proc_freq; 47extern unsigned long ppc_proc_freq;
@@ -221,5 +222,19 @@ struct cpu_usage {
221 222
222DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array); 223DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
223 224
225#ifdef CONFIG_VIRT_CPU_ACCOUNTING
226extern void account_process_vtime(struct task_struct *tsk);
227#else
228#define account_process_vtime(tsk) do { } while (0)
229#endif
230
231#if defined(CONFIG_VIRT_CPU_ACCOUNTING) && defined(CONFIG_PPC_SPLPAR)
232extern void calculate_steal_time(void);
233extern void snapshot_timebases(void);
234#else
235#define calculate_steal_time() do { } while (0)
236#define snapshot_timebases() do { } while (0)
237#endif
238
224#endif /* __KERNEL__ */ 239#endif /* __KERNEL__ */
225#endif /* __PPC64_TIME_H */ 240#endif /* __PPC64_TIME_H */
diff --git a/include/asm-powerpc/types.h b/include/asm-powerpc/types.h
index ec3c2ee8bf86..baabba96e313 100644
--- a/include/asm-powerpc/types.h
+++ b/include/asm-powerpc/types.h
@@ -103,6 +103,11 @@ typedef u64 sector_t;
103#define HAVE_SECTOR_T 103#define HAVE_SECTOR_T
104#endif 104#endif
105 105
106#ifdef CONFIG_LSF
107typedef u64 blkcnt_t;
108#define HAVE_BLKCNT_T
109#endif
110
106#endif /* __ASSEMBLY__ */ 111#endif /* __ASSEMBLY__ */
107 112
108#endif /* __KERNEL__ */ 113#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index 35556993f066..536ba0873052 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -301,8 +301,9 @@
301#define __NR_pselect6 280 301#define __NR_pselect6 280
302#define __NR_ppoll 281 302#define __NR_ppoll 281
303#define __NR_unshare 282 303#define __NR_unshare 282
304#define __NR_splice 283
304 305
305#define __NR_syscalls 283 306#define __NR_syscalls 284
306 307
307#ifdef __KERNEL__ 308#ifdef __KERNEL__
308#define __NR__exit __NR_exit 309#define __NR__exit __NR_exit
@@ -425,6 +426,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
425#include <linux/types.h> 426#include <linux/types.h>
426#include <linux/compiler.h> 427#include <linux/compiler.h>
427#include <linux/linkage.h> 428#include <linux/linkage.h>
429#include <asm/syscalls.h>
428 430
429#define __ARCH_WANT_IPC_PARSE_VERSION 431#define __ARCH_WANT_IPC_PARSE_VERSION
430#define __ARCH_WANT_OLD_READDIR 432#define __ARCH_WANT_OLD_READDIR
@@ -460,44 +462,10 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
460 * System call prototypes. 462 * System call prototypes.
461 */ 463 */
462#ifdef __KERNEL_SYSCALLS__ 464#ifdef __KERNEL_SYSCALLS__
463extern pid_t setsid(void);
464extern int write(int fd, const char *buf, off_t count);
465extern int read(int fd, char *buf, off_t count);
466extern off_t lseek(int fd, off_t offset, int count);
467extern int dup(int fd);
468extern int execve(const char *file, char **argv, char **envp); 465extern int execve(const char *file, char **argv, char **envp);
469extern int open(const char *file, int flag, int mode);
470extern int close(int fd);
471extern pid_t waitpid(pid_t pid, int *wait_stat, int options);
472#endif /* __KERNEL_SYSCALLS__ */ 466#endif /* __KERNEL_SYSCALLS__ */
473 467
474/* 468/*
475 * Functions that implement syscalls.
476 */
477unsigned long sys_mmap(unsigned long addr, size_t len, unsigned long prot,
478 unsigned long flags, unsigned long fd, off_t offset);
479unsigned long sys_mmap2(unsigned long addr, size_t len,
480 unsigned long prot, unsigned long flags,
481 unsigned long fd, unsigned long pgoff);
482struct pt_regs;
483int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
484 unsigned long a3, unsigned long a4, unsigned long a5,
485 struct pt_regs *regs);
486int sys_clone(unsigned long clone_flags, unsigned long usp,
487 int __user *parent_tidp, void __user *child_threadptr,
488 int __user *child_tidp, int p6, struct pt_regs *regs);
489int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3,
490 unsigned long p4, unsigned long p5, unsigned long p6,
491 struct pt_regs *regs);
492int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3,
493 unsigned long p4, unsigned long p5, unsigned long p6,
494 struct pt_regs *regs);
495int sys_pipe(int __user *fildes);
496struct sigaction;
497long sys_rt_sigaction(int sig, const struct sigaction __user *act,
498 struct sigaction __user *oact, size_t sigsetsize);
499
500/*
501 * "Conditional" syscalls 469 * "Conditional" syscalls
502 * 470 *
503 * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 471 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
diff --git a/include/asm-powerpc/vdso_datapage.h b/include/asm-powerpc/vdso_datapage.h
index 7aa92086c3fb..8a94f0eba5e9 100644
--- a/include/asm-powerpc/vdso_datapage.h
+++ b/include/asm-powerpc/vdso_datapage.h
@@ -55,6 +55,9 @@ struct vdso_data {
55 __u32 minor; /* Minor number 0x14 */ 55 __u32 minor; /* Minor number 0x14 */
56 } version; 56 } version;
57 57
58 /* Note about the platform flags: it now only contains the lpar
59 * bit. The actual platform number is dead and burried
60 */
58 __u32 platform; /* Platform flags 0x18 */ 61 __u32 platform; /* Platform flags 0x18 */
59 __u32 processor; /* Processor type 0x1C */ 62 __u32 processor; /* Processor type 0x1C */
60 __u64 processorCount; /* # of physical processors 0x20 */ 63 __u64 processorCount; /* # of physical processors 0x20 */
diff --git a/include/asm-ppc/harrier.h b/include/asm-ppc/harrier.h
index 36c73ab7e43e..7acd7fc126ec 100644
--- a/include/asm-ppc/harrier.h
+++ b/include/asm-ppc/harrier.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/kernel/harrier.h
3 *
4 * Definitions for Motorola MCG Harrier North Bridge & Memory controller 2 * Definitions for Motorola MCG Harrier North Bridge & Memory controller
5 * 3 *
6 * Author: Dale Farnsworth 4 * Author: Dale Farnsworth
diff --git a/include/asm-ppc/ibm44x.h b/include/asm-ppc/ibm44x.h
index f835066fb3ca..3acc382cc83f 100644
--- a/include/asm-ppc/ibm44x.h
+++ b/include/asm-ppc/ibm44x.h
@@ -29,7 +29,7 @@
29 29
30/* TLB entry offset/size used for pinning kernel lowmem */ 30/* TLB entry offset/size used for pinning kernel lowmem */
31#define PPC44x_PIN_SHIFT 28 31#define PPC44x_PIN_SHIFT 28
32#define PPC44x_PIN_SIZE (1 << PPC44x_PIN_SHIFT) 32#define PPC_PIN_SIZE (1 << PPC44x_PIN_SHIFT)
33 33
34/* Lowest TLB slot consumed by the default pinned TLBs */ 34/* Lowest TLB slot consumed by the default pinned TLBs */
35#define PPC44x_LOW_SLOT 63 35#define PPC44x_LOW_SLOT 63
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
index 6c28ae7807f4..38f99710752b 100644
--- a/include/asm-ppc/ibm4xx.h
+++ b/include/asm-ppc/ibm4xx.h
@@ -51,6 +51,10 @@
51#include <platforms/4xx/xilinx_ml300.h> 51#include <platforms/4xx/xilinx_ml300.h>
52#endif 52#endif
53 53
54#if defined(CONFIG_XILINX_ML403)
55#include <platforms/4xx/xilinx_ml403.h>
56#endif
57
54#ifndef __ASSEMBLY__ 58#ifndef __ASSEMBLY__
55 59
56#ifdef CONFIG_40x 60#ifdef CONFIG_40x
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index df9cf6ed189d..b919d8fb7d98 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -575,4 +575,11 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
575 */ 575 */
576#define xlate_dev_kmem_ptr(p) p 576#define xlate_dev_kmem_ptr(p) p
577 577
578/* access ports */
579#define setbits32(_addr, _v) out_be32((_addr), in_be32(_addr) | (_v))
580#define clrbits32(_addr, _v) out_be32((_addr), in_be32(_addr) & ~(_v))
581
582#define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) | (_v))
583#define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v))
584
578#endif /* __KERNEL__ */ 585#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h
index a3e8a45e45a9..e1a0a7b213d7 100644
--- a/include/asm-ppc/machdep.h
+++ b/include/asm-ppc/machdep.h
@@ -19,6 +19,18 @@ struct pci_dev;
19struct seq_file; 19struct seq_file;
20struct file; 20struct file;
21 21
22/*
23 * This is for compatibility with ARCH=powerpc.
24 */
25#define machine_is(x) __MACHINE_IS_##x
26#define __MACHINE_IS_powermac 0
27#define __MACHINE_IS_chrp 0
28#ifdef CONFIG_PPC_PREP
29#define __MACHINE_IS_prep 1
30#else
31#define __MACHINE_IS_prep 0
32#endif
33
22/* We export this macro for external modules like Alsa to know if 34/* We export this macro for external modules like Alsa to know if
23 * ppc_md.feature_call is implemented or not 35 * ppc_md.feature_call is implemented or not
24 */ 36 */
@@ -44,7 +56,7 @@ struct machdep_calls {
44 void (*power_off)(void); 56 void (*power_off)(void);
45 void (*halt)(void); 57 void (*halt)(void);
46 58
47 void (*idle)(void); 59 void (*idle_loop)(void);
48 void (*power_save)(void); 60 void (*power_save)(void);
49 61
50 long (*time_init)(void); /* Optional, may be NULL */ 62 long (*time_init)(void); /* Optional, may be NULL */
@@ -104,9 +116,6 @@ struct machdep_calls {
104 unsigned long size, 116 unsigned long size,
105 pgprot_t vma_prot); 117 pgprot_t vma_prot);
106 118
107 /* this is for modules, since _machine can be a define -- Cort */
108 int ppc_machine;
109
110 /* Motherboard/chipset features. This is a kind of general purpose 119 /* Motherboard/chipset features. This is a kind of general purpose
111 * hook used to control some machine specific features (like reset 120 * hook used to control some machine specific features (like reset
112 * lines, chip power control, etc...). 121 * lines, chip power control, etc...).
diff --git a/include/asm-ppc/mpc10x.h b/include/asm-ppc/mpc10x.h
index 77b1e092c206..b30a6a3b5bd2 100644
--- a/include/asm-ppc/mpc10x.h
+++ b/include/asm-ppc/mpc10x.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/kernel/mpc10x.h
3 *
4 * Common routines for the Motorola SPS MPC106/8240/107 Host bridge/Mem 2 * Common routines for the Motorola SPS MPC106/8240/107 Host bridge/Mem
5 * ctlr/EPIC/etc. 3 * ctlr/EPIC/etc.
6 * 4 *
@@ -165,6 +163,7 @@ enum ppc_sys_devices {
165 MPC10X_DMA1, 163 MPC10X_DMA1,
166 MPC10X_UART0, 164 MPC10X_UART0,
167 MPC10X_UART1, 165 MPC10X_UART1,
166 NUM_PPC_SYS_DEVS,
168}; 167};
169 168
170int mpc10x_bridge_init(struct pci_controller *hose, 169int mpc10x_bridge_init(struct pci_controller *hose,
diff --git a/include/asm-ppc/mpc52xx.h b/include/asm-ppc/mpc52xx.h
index a055e0756b9d..7e9842805a28 100644
--- a/include/asm-ppc/mpc52xx.h
+++ b/include/asm-ppc/mpc52xx.h
@@ -60,6 +60,7 @@ enum ppc_sys_devices {
60 MPC52xx_ATA, 60 MPC52xx_ATA,
61 MPC52xx_I2C1, 61 MPC52xx_I2C1,
62 MPC52xx_I2C2, 62 MPC52xx_I2C2,
63 NUM_PPC_SYS_DEVS,
63}; 64};
64 65
65 66
@@ -354,6 +355,7 @@ struct mpc52xx_xlb {
354 u32 snoop_window; /* XLB + 0x70 */ 355 u32 snoop_window; /* XLB + 0x70 */
355}; 356};
356 357
358#define MPC52xx_XLB_CFG_PLDIS (1 << 31)
357#define MPC52xx_XLB_CFG_SNOOP (1 << 15) 359#define MPC52xx_XLB_CFG_SNOOP (1 << 15)
358 360
359/* Clock Distribution control */ 361/* Clock Distribution control */
@@ -426,6 +428,9 @@ extern void mpc52xx_calibrate_decr(void);
426 428
427extern void mpc52xx_find_bridges(void); 429extern void mpc52xx_find_bridges(void);
428 430
431extern void mpc52xx_setup_cpu(void);
432
433
429 434
430 /* Matching of PSC function */ 435 /* Matching of PSC function */
431struct mpc52xx_psc_func { 436struct mpc52xx_psc_func {
diff --git a/include/asm-ppc/mpc8260.h b/include/asm-ppc/mpc8260.h
index 321452695039..6ba69a86b9dd 100644
--- a/include/asm-ppc/mpc8260.h
+++ b/include/asm-ppc/mpc8260.h
@@ -83,6 +83,7 @@ enum ppc_sys_devices {
83 MPC82xx_CPM_SMC2, 83 MPC82xx_CPM_SMC2,
84 MPC82xx_CPM_USB, 84 MPC82xx_CPM_USB,
85 MPC82xx_SEC1, 85 MPC82xx_SEC1,
86 NUM_PPC_SYS_DEVS,
86}; 87};
87 88
88#ifndef __ASSEMBLY__ 89#ifndef __ASSEMBLY__
diff --git a/include/asm-ppc/mpc83xx.h b/include/asm-ppc/mpc83xx.h
index 7cdf60fa69b6..3c23fc43bfbc 100644
--- a/include/asm-ppc/mpc83xx.h
+++ b/include/asm-ppc/mpc83xx.h
@@ -108,6 +108,7 @@ enum ppc_sys_devices {
108 MPC83xx_USB2_DR, 108 MPC83xx_USB2_DR,
109 MPC83xx_USB2_MPH, 109 MPC83xx_USB2_MPH,
110 MPC83xx_MDIO, 110 MPC83xx_MDIO,
111 NUM_PPC_SYS_DEVS,
111}; 112};
112 113
113#endif /* CONFIG_83xx */ 114#endif /* CONFIG_83xx */
diff --git a/include/asm-ppc/mpc85xx.h b/include/asm-ppc/mpc85xx.h
index c8a96aa44fb7..f47002a60edf 100644
--- a/include/asm-ppc/mpc85xx.h
+++ b/include/asm-ppc/mpc85xx.h
@@ -139,6 +139,7 @@ enum ppc_sys_devices {
139 MPC85xx_eTSEC4, 139 MPC85xx_eTSEC4,
140 MPC85xx_IIC2, 140 MPC85xx_IIC2,
141 MPC85xx_MDIO, 141 MPC85xx_MDIO,
142 NUM_PPC_SYS_DEVS,
142}; 143};
143 144
144/* Internal interrupts are all Level Sensitive, and Positive Polarity */ 145/* Internal interrupts are all Level Sensitive, and Positive Polarity */
diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h
index 46f159cf589e..3515a7fa6c89 100644
--- a/include/asm-ppc/mpc8xx.h
+++ b/include/asm-ppc/mpc8xx.h
@@ -111,8 +111,11 @@ enum ppc_sys_devices {
111 MPC8xx_CPM_SMC1, 111 MPC8xx_CPM_SMC1,
112 MPC8xx_CPM_SMC2, 112 MPC8xx_CPM_SMC2,
113 MPC8xx_CPM_USB, 113 MPC8xx_CPM_USB,
114 NUM_PPC_SYS_DEVS,
114}; 115};
115 116
117#define PPC_PIN_SIZE (24 * 1024 * 1024) /* 24Mbytes of data pinned */
118
116#ifndef BOARD_CHIP_NAME 119#ifndef BOARD_CHIP_NAME
117#define BOARD_CHIP_NAME "" 120#define BOARD_CHIP_NAME ""
118#endif 121#endif
diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h
index 538e0c8ab243..a70ba2ee552d 100644
--- a/include/asm-ppc/page.h
+++ b/include/asm-ppc/page.h
@@ -149,8 +149,7 @@ extern int page_is_ram(unsigned long pfn);
149#define __pa(x) ___pa((unsigned long)(x)) 149#define __pa(x) ___pa((unsigned long)(x))
150#define __va(x) ((void *)(___va((unsigned long)(x)))) 150#define __va(x) ((void *)(___va((unsigned long)(x))))
151 151
152#define pfn_to_page(pfn) (mem_map + ((pfn) - PPC_PGSTART)) 152#define ARCH_PFN_OFFSET (PPC_PGSTART)
153#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + PPC_PGSTART)
154#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 153#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
155#define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT) 154#define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT)
156 155
@@ -175,5 +174,6 @@ extern __inline__ int get_order(unsigned long size)
175/* We do define AT_SYSINFO_EHDR but don't use the gate mecanism */ 174/* We do define AT_SYSINFO_EHDR but don't use the gate mecanism */
176#define __HAVE_ARCH_GATE_AREA 1 175#define __HAVE_ARCH_GATE_AREA 1
177 176
177#include <asm-generic/memory_model.h>
178#endif /* __KERNEL__ */ 178#endif /* __KERNEL__ */
179#endif /* _PPC_PAGE_H */ 179#endif /* _PPC_PAGE_H */
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index 6d1c39e8a6af..570b355162fa 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -12,6 +12,7 @@
12#include <asm/processor.h> /* For TASK_SIZE */ 12#include <asm/processor.h> /* For TASK_SIZE */
13#include <asm/mmu.h> 13#include <asm/mmu.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/io.h> /* For sub-arch specific PPC_PIN_SIZE */
15struct mm_struct; 16struct mm_struct;
16 17
17extern unsigned long va_to_phys(unsigned long address); 18extern unsigned long va_to_phys(unsigned long address);
@@ -127,9 +128,8 @@ extern unsigned long ioremap_bot, ioremap_base;
127 * of RAM. -- Cort 128 * of RAM. -- Cort
128 */ 129 */
129#define VMALLOC_OFFSET (0x1000000) /* 16M */ 130#define VMALLOC_OFFSET (0x1000000) /* 16M */
130#ifdef CONFIG_44x 131#ifdef PPC_PIN_SIZE
131#include <asm/ibm44x.h> 132#define VMALLOC_START (((_ALIGN((long)high_memory, PPC_PIN_SIZE) + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)))
132#define VMALLOC_START (((_ALIGN((long)high_memory, PPC44x_PIN_SIZE) + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)))
133#else 133#else
134#define VMALLOC_START ((((long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))) 134#define VMALLOC_START ((((long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)))
135#endif 135#endif
@@ -837,7 +837,8 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
837 */ 837 */
838#define pgtable_cache_init() do { } while (0) 838#define pgtable_cache_init() do { } while (0)
839 839
840extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep); 840extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep,
841 pmd_t **pmdp);
841 842
842#include <asm-generic/pgtable.h> 843#include <asm-generic/pgtable.h>
843 844
diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
index 83d8c77c124d..4b94f7059ebe 100644
--- a/include/asm-ppc/ppc_sys.h
+++ b/include/asm-ppc/ppc_sys.h
@@ -33,6 +33,8 @@
33#include <asm/mpc52xx.h> 33#include <asm/mpc52xx.h>
34#elif defined(CONFIG_MPC10X_BRIDGE) 34#elif defined(CONFIG_MPC10X_BRIDGE)
35#include <asm/mpc10x.h> 35#include <asm/mpc10x.h>
36#elif defined(CONFIG_XILINX_VIRTEX)
37#include <platforms/4xx/virtex.h>
36#else 38#else
37#error "need definition of ppc_sys_devices" 39#error "need definition of ppc_sys_devices"
38#endif 40#endif
@@ -44,9 +46,26 @@ struct ppc_sys_spec {
44 u32 value; 46 u32 value;
45 u32 num_devices; 47 u32 num_devices;
46 char *ppc_sys_name; 48 char *ppc_sys_name;
49 u8 config[NUM_PPC_SYS_DEVS];
47 enum ppc_sys_devices *device_list; 50 enum ppc_sys_devices *device_list;
48}; 51};
49 52
53struct platform_notify_dev_map {
54 const char *bus_id;
55 void (*rtn)(struct platform_device * pdev, int idx);
56};
57
58enum platform_device_func {
59 PPC_SYS_FUNC_DUMMY = 0,
60 PPC_SYS_FUNC_ETH = 1,
61 PPC_SYS_FUNC_UART = 2,
62 PPC_SYS_FUNC_HLDC = 3,
63 PPC_SYS_FUNC_USB = 4,
64 PPC_SYS_FUNC_IRDA = 5,
65};
66
67#define PPC_SYS_CONFIG_DISABLED 1
68
50/* describes all specific chips and which devices they have on them */ 69/* describes all specific chips and which devices they have on them */
51extern struct ppc_sys_spec ppc_sys_specs[]; 70extern struct ppc_sys_spec ppc_sys_specs[];
52extern struct ppc_sys_spec *cur_ppc_sys_spec; 71extern struct ppc_sys_spec *cur_ppc_sys_spec;
@@ -72,5 +91,20 @@ extern void *ppc_sys_get_pdata(enum ppc_sys_devices dev) __init;
72/* remove a device from the system */ 91/* remove a device from the system */
73extern void ppc_sys_device_remove(enum ppc_sys_devices dev); 92extern void ppc_sys_device_remove(enum ppc_sys_devices dev);
74 93
94/* Function assignment stuff */
95void ppc_sys_device_initfunc(void);
96void ppc_sys_device_setfunc(enum ppc_sys_devices dev,
97 enum platform_device_func func);
98void ppc_sys_device_set_func_all(enum platform_device_func func);
99
100void platform_notify_map(const struct platform_notify_dev_map *map,
101 struct device *dev);
102
103/* Enable / disable stuff */
104void ppc_sys_device_disable(enum ppc_sys_devices dev);
105void ppc_sys_device_enable(enum ppc_sys_devices dev);
106void ppc_sys_device_enable_all(void);
107void ppc_sys_device_disable_all(void);
108
75#endif /* __ASM_PPC_SYS_H */ 109#endif /* __ASM_PPC_SYS_H */
76#endif /* __KERNEL__ */ 110#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h
index 6d431d6fb022..adc5ae784924 100644
--- a/include/asm-ppc/prom.h
+++ b/include/asm-ppc/prom.h
@@ -8,126 +8,19 @@
8#ifndef _PPC_PROM_H 8#ifndef _PPC_PROM_H
9#define _PPC_PROM_H 9#define _PPC_PROM_H
10 10
11#include <linux/config.h> 11/* This is used in arch/ppc/mm/mem_pieces.h */
12#include <linux/types.h>
13
14typedef u32 phandle;
15typedef u32 ihandle;
16
17struct address_range {
18 unsigned int space;
19 unsigned int address;
20 unsigned int size;
21};
22
23struct interrupt_info {
24 int line;
25 int sense; /* +ve/-ve logic, edge or level, etc. */
26};
27
28struct reg_property { 12struct reg_property {
29 unsigned int address; 13 unsigned int address;
30 unsigned int size; 14 unsigned int size;
31}; 15};
32 16
33struct property {
34 char *name;
35 int length;
36 unsigned char *value;
37 struct property *next;
38};
39
40/*
41 * Note: don't change this structure for now or you'll break BootX !
42 */
43struct device_node {
44 char *name;
45 char *type;
46 phandle node;
47 int n_addrs;
48 struct address_range *addrs;
49 int n_intrs;
50 struct interrupt_info *intrs;
51 char *full_name;
52 struct property *properties;
53 struct device_node *parent;
54 struct device_node *child;
55 struct device_node *sibling;
56 struct device_node *next; /* next device of same type */
57 struct device_node *allnext; /* next in list of all nodes */
58};
59
60struct prom_args;
61typedef void (*prom_entry)(struct prom_args *);
62
63/* OBSOLETE: Old style node lookup */
64extern struct device_node *find_devices(const char *name);
65extern struct device_node *find_type_devices(const char *type);
66extern struct device_node *find_path_device(const char *path);
67extern struct device_node *find_compatible_devices(const char *type,
68 const char *compat);
69extern struct device_node *find_all_nodes(void);
70
71/* New style node lookup */
72extern struct device_node *of_find_node_by_name(struct device_node *from,
73 const char *name);
74extern struct device_node *of_find_node_by_type(struct device_node *from,
75 const char *type);
76extern struct device_node *of_find_compatible_node(struct device_node *from,
77 const char *type, const char *compat);
78extern struct device_node *of_find_node_by_path(const char *path);
79extern struct device_node *of_find_all_nodes(struct device_node *prev);
80extern struct device_node *of_get_parent(const struct device_node *node);
81extern struct device_node *of_get_next_child(const struct device_node *node,
82 struct device_node *prev);
83extern struct device_node *of_node_get(struct device_node *node);
84extern void of_node_put(struct device_node *node);
85
86/* Other Prototypes */
87extern void abort(void);
88extern unsigned long prom_init(int, int, prom_entry);
89extern void prom_print(const char *msg);
90extern void relocate_nodes(void);
91extern void finish_device_tree(void);
92extern int device_is_compatible(struct device_node *device, const char *);
93extern int machine_is_compatible(const char *compat);
94extern unsigned char *get_property(struct device_node *node, const char *name,
95 int *lenp);
96extern int prom_add_property(struct device_node* np, struct property* prop);
97extern void prom_get_irq_senses(unsigned char *, int, int);
98extern int prom_n_addr_cells(struct device_node* np);
99extern int prom_n_size_cells(struct device_node* np);
100
101extern struct resource*
102request_OF_resource(struct device_node* node, int index, const char* name_postfix);
103extern int release_OF_resource(struct device_node* node, int index);
104
105extern void print_properties(struct device_node *node);
106extern int call_rtas(const char *service, int nargs, int nret,
107 unsigned long *outputs, ...);
108
109/* 17/*
110 * PCI <-> OF matching functions 18 * These macros assist in performing the address calculations that we
111 */ 19 * need to do to access data when the kernel is running at an address
112struct pci_bus; 20 * that is different from the address that the kernel is linked at.
113struct pci_dev; 21 * The reloc_offset() function returns the difference between these
114extern int pci_device_from_OF_node(struct device_node *node, 22 * two addresses and the macros simplify the process of adding or
115 u8* bus, u8* devfn); 23 * subtracting this offset to/from pointer values.
116extern struct device_node* pci_busdev_to_OF_node(struct pci_bus *, int);
117extern struct device_node* pci_device_to_OF_node(struct pci_dev *);
118extern void pci_create_OF_bus_map(void);
119
120/*
121 * When we call back to the Open Firmware client interface, we usually
122 * have to do that before the kernel is relocated to its final location
123 * (this is because we can't use OF after we have overwritten the
124 * exception vectors with our exception handlers). These macros assist
125 * in performing the address calculations that we need to do to access
126 * data when the kernel is running at an address that is different from
127 * the address that the kernel is linked at. The reloc_offset() function
128 * returns the difference between these two addresses and the macros
129 * simplify the process of adding or subtracting this offset to/from
130 * pointer values. See arch/ppc/kernel/prom.c for how these are used.
131 */ 24 */
132extern unsigned long reloc_offset(void); 25extern unsigned long reloc_offset(void);
133extern unsigned long add_reloc_offset(unsigned long); 26extern unsigned long add_reloc_offset(unsigned long);
@@ -136,45 +29,12 @@ extern unsigned long sub_reloc_offset(unsigned long);
136#define PTRRELOC(x) ((typeof(x))add_reloc_offset((unsigned long)(x))) 29#define PTRRELOC(x) ((typeof(x))add_reloc_offset((unsigned long)(x)))
137#define PTRUNRELOC(x) ((typeof(x))sub_reloc_offset((unsigned long)(x))) 30#define PTRUNRELOC(x) ((typeof(x))sub_reloc_offset((unsigned long)(x)))
138 31
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/* 32/*
172 * Fallback definitions for builds where we don't have prom.c included. 33 * Fallback definitions since we don't support OF in arch/ppc any more.
173 */ 34 */
174#define machine_is_compatible(x) 0 35#define machine_is_compatible(x) 0
175#define of_find_compatible_node(f, t, c) NULL 36#define of_find_compatible_node(f, t, c) NULL
176#define get_property(p, n, l) NULL 37#define get_property(p, n, l) NULL
177#endif
178 38
179#endif /* _PPC_PROM_H */ 39#endif /* _PPC_PROM_H */
180#endif /* __KERNEL__ */ 40#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/serial.h b/include/asm-ppc/serial.h
index 485a924e4d06..b74af5461564 100644
--- a/include/asm-ppc/serial.h
+++ b/include/asm-ppc/serial.h
@@ -41,15 +41,10 @@
41#else 41#else
42 42
43/* 43/*
44 * XXX Assume for now it has PC-style ISA serial ports. 44 * XXX Assume it has PC-style ISA serial ports - true for PReP at least.
45 * This is true for PReP and CHRP at least.
46 */ 45 */
47#include <asm/pc_serial.h> 46#include <asm/pc_serial.h>
48 47
49#if defined(CONFIG_MAC_SERIAL)
50#define SERIAL_DEV_OFFSET ((_machine == _MACH_prep || _machine == _MACH_chrp) ? 0 : 2)
51#endif
52
53#endif /* !CONFIG_GEMINI and others */ 48#endif /* !CONFIG_GEMINI and others */
54#endif /* __ASM_SERIAL_H__ */ 49#endif /* __ASM_SERIAL_H__ */
55#endif /* __KERNEL__ */ 50#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/time.h b/include/asm-ppc/time.h
index 321fb75b5f22..c86112323c9f 100644
--- a/include/asm-ppc/time.h
+++ b/include/asm-ppc/time.h
@@ -153,5 +153,10 @@ extern __inline__ unsigned binary_tbl(void) {
153({unsigned z; asm ("mulhwu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;}) 153({unsigned z; asm ("mulhwu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;})
154 154
155unsigned mulhwu_scale_factor(unsigned, unsigned); 155unsigned mulhwu_scale_factor(unsigned, unsigned);
156
157#define account_process_vtime(tsk) do { } while (0)
158#define calculate_steal_time() do { } while (0)
159#define snapshot_timebases() do { } while (0)
160
156#endif /* __ASM_TIME_H__ */ 161#endif /* __ASM_TIME_H__ */
157#endif /* __KERNEL__ */ 162#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/todc.h b/include/asm-ppc/todc.h
index 84bae7d76814..937c7dbe6e5c 100644
--- a/include/asm-ppc/todc.h
+++ b/include/asm-ppc/todc.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * include/asm-ppc/todc.h
3 *
4 * Definitions for the M48Txx and mc146818 series of Time of day/Real Time 2 * Definitions for the M48Txx and mc146818 series of Time of day/Real Time
5 * Clock chips. 3 * Clock chips.
6 * 4 *
diff --git a/include/asm-ppc/xparameters.h b/include/asm-ppc/xparameters.h
deleted file mode 100644
index fe4eac629139..000000000000
--- a/include/asm-ppc/xparameters.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * include/asm-ppc/xparameters.h
3 *
4 * This file includes the correct xparameters.h for the CONFIG'ed board
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * 2004 (c) MontaVista Software, Inc. This file is licensed under the terms
10 * of the GNU General Public License version 2. This program is licensed
11 * "as is" without any warranty of any kind, whether express or implied.
12 */
13
14#include <linux/config.h>
15
16#if defined(CONFIG_XILINX_ML300)
17#include <platforms/4xx/xparameters/xparameters_ml300.h>
18#endif
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
index be6fefe223d6..de1d9926aa60 100644
--- a/include/asm-s390/atomic.h
+++ b/include/asm-s390/atomic.h
@@ -89,10 +89,15 @@ static __inline__ int atomic_cmpxchg(atomic_t *v, int old, int new)
89static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) 89static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
90{ 90{
91 int c, old; 91 int c, old;
92
93 c = atomic_read(v); 92 c = atomic_read(v);
94 while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c) 93 for (;;) {
94 if (unlikely(c == u))
95 break;
96 old = atomic_cmpxchg(v, c, c + a);
97 if (likely(old == c))
98 break;
95 c = old; 99 c = old;
100 }
96 return c != u; 101 return c != u;
97} 102}
98 103
@@ -167,10 +172,15 @@ static __inline__ int atomic64_add_unless(atomic64_t *v,
167 long long a, long long u) 172 long long a, long long u)
168{ 173{
169 long long c, old; 174 long long c, old;
170
171 c = atomic64_read(v); 175 c = atomic64_read(v);
172 while (c != u && (old = atomic64_cmpxchg(v, c, c + a)) != c) 176 for (;;) {
177 if (unlikely(c == u))
178 break;
179 old = atomic64_cmpxchg(v, c, c + a);
180 if (likely(old == c))
181 break;
173 c = old; 182 c = old;
183 }
174 return c != u; 184 return c != u;
175} 185}
176 186
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index 3628899f48bb..ca092ffb7a95 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -828,35 +828,12 @@ static inline int sched_find_first_bit(unsigned long *b)
828 return find_first_bit(b, 140); 828 return find_first_bit(b, 140);
829} 829}
830 830
831/* 831#include <asm-generic/bitops/ffs.h>
832 * ffs: find first bit set. This is defined the same way as
833 * the libc and compiler builtin ffs routines, therefore
834 * differs in spirit from the above ffz (man ffs).
835 */
836#define ffs(x) generic_ffs(x)
837 832
838/* 833#include <asm-generic/bitops/fls.h>
839 * fls: find last bit set. 834#include <asm-generic/bitops/fls64.h>
840 */
841#define fls(x) generic_fls(x)
842#define fls64(x) generic_fls64(x)
843
844/*
845 * hweightN: returns the hamming weight (i.e. the number
846 * of bits set) of a N-bit word
847 */
848#define hweight64(x) \
849({ \
850 unsigned long __x = (x); \
851 unsigned int __w; \
852 __w = generic_hweight32((unsigned int) __x); \
853 __w += generic_hweight32((unsigned int) (__x>>32)); \
854 __w; \
855})
856#define hweight32(x) generic_hweight32(x)
857#define hweight16(x) generic_hweight16(x)
858#define hweight8(x) generic_hweight8(x)
859 835
836#include <asm-generic/bitops/hweight.h>
860 837
861#ifdef __KERNEL__ 838#ifdef __KERNEL__
862 839
@@ -871,11 +848,11 @@ static inline int sched_find_first_bit(unsigned long *b)
871 */ 848 */
872 849
873#define ext2_set_bit(nr, addr) \ 850#define ext2_set_bit(nr, addr) \
874 test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 851 __test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
875#define ext2_set_bit_atomic(lock, nr, addr) \ 852#define ext2_set_bit_atomic(lock, nr, addr) \
876 test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 853 test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
877#define ext2_clear_bit(nr, addr) \ 854#define ext2_clear_bit(nr, addr) \
878 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 855 __test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
879#define ext2_clear_bit_atomic(lock, nr, addr) \ 856#define ext2_clear_bit_atomic(lock, nr, addr) \
880 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 857 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
881#define ext2_test_bit(nr, addr) \ 858#define ext2_test_bit(nr, addr) \
@@ -1011,18 +988,7 @@ ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset)
1011 return offset + ext2_find_first_zero_bit(p, size); 988 return offset + ext2_find_first_zero_bit(p, size);
1012} 989}
1013 990
1014/* Bitmap functions for the minix filesystem. */ 991#include <asm-generic/bitops/minix.h>
1015/* FIXME !!! */
1016#define minix_test_and_set_bit(nr,addr) \
1017 test_and_set_bit(nr,(unsigned long *)addr)
1018#define minix_set_bit(nr,addr) \
1019 set_bit(nr,(unsigned long *)addr)
1020#define minix_test_and_clear_bit(nr,addr) \
1021 test_and_clear_bit(nr,(unsigned long *)addr)
1022#define minix_test_bit(nr,addr) \
1023 test_bit(nr,(unsigned long *)addr)
1024#define minix_find_first_zero_bit(addr,size) \
1025 find_first_zero_bit(addr,size)
1026 992
1027#endif /* __KERNEL__ */ 993#endif /* __KERNEL__ */
1028 994
diff --git a/include/asm-s390/bug.h b/include/asm-s390/bug.h
index a2e7430aafa6..7ddaa05b98d8 100644
--- a/include/asm-s390/bug.h
+++ b/include/asm-s390/bug.h
@@ -4,9 +4,10 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5 5
6#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
7
7#define BUG() do { \ 8#define BUG() do { \
8 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 9 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
9 __asm__ __volatile__(".long 0"); \ 10 __builtin_trap(); \
10} while (0) 11} while (0)
11 12
12#define HAVE_ARCH_BUG 13#define HAVE_ARCH_BUG
diff --git a/include/asm-s390/compat.h b/include/asm-s390/compat.h
index a007715f4aea..356a0b183539 100644
--- a/include/asm-s390/compat.h
+++ b/include/asm-s390/compat.h
@@ -128,6 +128,11 @@ static inline void __user *compat_ptr(compat_uptr_t uptr)
128 return (void __user *)(unsigned long)(uptr & 0x7fffffffUL); 128 return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
129} 129}
130 130
131static inline compat_uptr_t ptr_to_compat(void __user *uptr)
132{
133 return (u32)(unsigned long)uptr;
134}
135
131static inline void __user *compat_alloc_user_space(long len) 136static inline void __user *compat_alloc_user_space(long len)
132{ 137{
133 unsigned long stack; 138 unsigned long stack;
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index 2430c561e021..3b1138ac7e79 100644
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -181,8 +181,6 @@ page_get_storage_key(unsigned long addr)
181#define PAGE_OFFSET 0x0UL 181#define PAGE_OFFSET 0x0UL
182#define __pa(x) (unsigned long)(x) 182#define __pa(x) (unsigned long)(x)
183#define __va(x) (void *)(unsigned long)(x) 183#define __va(x) (void *)(unsigned long)(x)
184#define pfn_to_page(pfn) (mem_map + (pfn))
185#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
186#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 184#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
187 185
188#define pfn_valid(pfn) ((pfn) < max_mapnr) 186#define pfn_valid(pfn) ((pfn) < max_mapnr)
@@ -193,6 +191,7 @@ page_get_storage_key(unsigned long addr)
193 191
194#endif /* __KERNEL__ */ 192#endif /* __KERNEL__ */
195 193
194#include <asm-generic/memory_model.h>
196#include <asm-generic/page.h> 195#include <asm-generic/page.h>
197 196
198#endif /* _S390_PAGE_H */ 197#endif /* _S390_PAGE_H */
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h
index 123fcaca295e..436d216601e5 100644
--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -46,10 +46,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
46#define percpu_modcopy(pcpudst, src, size) \ 46#define percpu_modcopy(pcpudst, src, size) \
47do { \ 47do { \
48 unsigned int __i; \ 48 unsigned int __i; \
49 for (__i = 0; __i < NR_CPUS; __i++) \ 49 for_each_possible_cpu(__i) \
50 if (cpu_possible(__i)) \ 50 memcpy((pcpudst)+__per_cpu_offset[__i], \
51 memcpy((pcpudst)+__per_cpu_offset[__i], \ 51 (src), (size)); \
52 (src), (size)); \
53} while (0) 52} while (0)
54 53
55#else /* ! SMP */ 54#else /* ! SMP */
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
index 3417dd71ab43..e28aaf28e4a8 100644
--- a/include/asm-s390/pgalloc.h
+++ b/include/asm-s390/pgalloc.h
@@ -158,11 +158,4 @@ static inline void pte_free(struct page *pte)
158 158
159#define __pte_free_tlb(tlb,pte) tlb_remove_page(tlb,pte) 159#define __pte_free_tlb(tlb,pte) tlb_remove_page(tlb,pte)
160 160
161/*
162 * This establishes kernel virtual mappings (e.g., as a result of a
163 * vmalloc call). Since s390-esame uses a separate kernel page table,
164 * there is nothing to do here... :)
165 */
166#define set_pgdir(addr,entry) do { } while(0)
167
168#endif /* _S390_PGALLOC_H */ 161#endif /* _S390_PGALLOC_H */
diff --git a/include/asm-s390/poll.h b/include/asm-s390/poll.h
index e90a5ca42061..6f7f65ac7d27 100644
--- a/include/asm-s390/poll.h
+++ b/include/asm-s390/poll.h
@@ -24,6 +24,7 @@
24#define POLLWRBAND 0x0200 24#define POLLWRBAND 0x0200
25#define POLLMSG 0x0400 25#define POLLMSG 0x0400
26#define POLLREMOVE 0x1000 26#define POLLREMOVE 0x1000
27#define POLLRDHUP 0x2000
27 28
28struct pollfd { 29struct pollfd {
29 int fd; 30 int fd;
diff --git a/include/asm-s390/types.h b/include/asm-s390/types.h
index d0be3e477013..5738ad63537c 100644
--- a/include/asm-s390/types.h
+++ b/include/asm-s390/types.h
@@ -93,6 +93,11 @@ typedef u64 sector_t;
93#define HAVE_SECTOR_T 93#define HAVE_SECTOR_T
94#endif 94#endif
95 95
96#ifdef CONFIG_LSF
97typedef u64 blkcnt_t;
98#define HAVE_BLKCNT_T
99#endif
100
96#endif /* ! __s390x__ */ 101#endif /* ! __s390x__ */
97#endif /* __ASSEMBLY__ */ 102#endif /* __ASSEMBLY__ */
98#endif /* __KERNEL__ */ 103#endif /* __KERNEL__ */
diff --git a/include/asm-sh/addrspace.h b/include/asm-sh/addrspace.h
index dbb05d1a26d1..720afc11c2ca 100644
--- a/include/asm-sh/addrspace.h
+++ b/include/asm-sh/addrspace.h
@@ -13,7 +13,7 @@
13 13
14#include <asm/cpu/addrspace.h> 14#include <asm/cpu/addrspace.h>
15 15
16/* Memory segments (32bit Priviledged mode addresses) */ 16/* Memory segments (32bit Privileged mode addresses) */
17#define P0SEG 0x00000000 17#define P0SEG 0x00000000
18#define P1SEG 0x80000000 18#define P1SEG 0x80000000
19#define P2SEG 0xa0000000 19#define P2SEG 0xa0000000
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
index 1c5260860045..e34f82508568 100644
--- a/include/asm-sh/bitops.h
+++ b/include/asm-sh/bitops.h
@@ -19,16 +19,6 @@ static __inline__ void set_bit(int nr, volatile void * addr)
19 local_irq_restore(flags); 19 local_irq_restore(flags);
20} 20}
21 21
22static __inline__ void __set_bit(int nr, volatile void * addr)
23{
24 int mask;
25 volatile unsigned int *a = addr;
26
27 a += nr >> 5;
28 mask = 1 << (nr & 0x1f);
29 *a |= mask;
30}
31
32/* 22/*
33 * clear_bit() doesn't provide any barrier for the compiler. 23 * clear_bit() doesn't provide any barrier for the compiler.
34 */ 24 */
@@ -47,16 +37,6 @@ static __inline__ void clear_bit(int nr, volatile void * addr)
47 local_irq_restore(flags); 37 local_irq_restore(flags);
48} 38}
49 39
50static __inline__ void __clear_bit(int nr, volatile void * addr)
51{
52 int mask;
53 volatile unsigned int *a = addr;
54
55 a += nr >> 5;
56 mask = 1 << (nr & 0x1f);
57 *a &= ~mask;
58}
59
60static __inline__ void change_bit(int nr, volatile void * addr) 40static __inline__ void change_bit(int nr, volatile void * addr)
61{ 41{
62 int mask; 42 int mask;
@@ -70,16 +50,6 @@ static __inline__ void change_bit(int nr, volatile void * addr)
70 local_irq_restore(flags); 50 local_irq_restore(flags);
71} 51}
72 52
73static __inline__ void __change_bit(int nr, volatile void * addr)
74{
75 int mask;
76 volatile unsigned int *a = addr;
77
78 a += nr >> 5;
79 mask = 1 << (nr & 0x1f);
80 *a ^= mask;
81}
82
83static __inline__ int test_and_set_bit(int nr, volatile void * addr) 53static __inline__ int test_and_set_bit(int nr, volatile void * addr)
84{ 54{
85 int mask, retval; 55 int mask, retval;
@@ -96,19 +66,6 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr)
96 return retval; 66 return retval;
97} 67}
98 68
99static __inline__ int __test_and_set_bit(int nr, volatile void * addr)
100{
101 int mask, retval;
102 volatile unsigned int *a = addr;
103
104 a += nr >> 5;
105 mask = 1 << (nr & 0x1f);
106 retval = (mask & *a) != 0;
107 *a |= mask;
108
109 return retval;
110}
111
112static __inline__ int test_and_clear_bit(int nr, volatile void * addr) 69static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
113{ 70{
114 int mask, retval; 71 int mask, retval;
@@ -125,19 +82,6 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
125 return retval; 82 return retval;
126} 83}
127 84
128static __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
129{
130 int mask, retval;
131 volatile unsigned int *a = addr;
132
133 a += nr >> 5;
134 mask = 1 << (nr & 0x1f);
135 retval = (mask & *a) != 0;
136 *a &= ~mask;
137
138 return retval;
139}
140
141static __inline__ int test_and_change_bit(int nr, volatile void * addr) 85static __inline__ int test_and_change_bit(int nr, volatile void * addr)
142{ 86{
143 int mask, retval; 87 int mask, retval;
@@ -154,23 +98,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
154 return retval; 98 return retval;
155} 99}
156 100
157static __inline__ int __test_and_change_bit(int nr, volatile void * addr) 101#include <asm-generic/bitops/non-atomic.h>
158{
159 int mask, retval;
160 volatile unsigned int *a = addr;
161
162 a += nr >> 5;
163 mask = 1 << (nr & 0x1f);
164 retval = (mask & *a) != 0;
165 *a ^= mask;
166
167 return retval;
168}
169
170static __inline__ int test_bit(int nr, const volatile void *addr)
171{
172 return 1UL & (((const volatile unsigned int *) addr)[nr >> 5] >> (nr & 31));
173}
174 102
175static __inline__ unsigned long ffz(unsigned long word) 103static __inline__ unsigned long ffz(unsigned long word)
176{ 104{
@@ -206,271 +134,15 @@ static __inline__ unsigned long __ffs(unsigned long word)
206 return result; 134 return result;
207} 135}
208 136
209/** 137#include <asm-generic/bitops/find.h>
210 * find_next_bit - find the next set bit in a memory region 138#include <asm-generic/bitops/ffs.h>
211 * @addr: The address to base the search on 139#include <asm-generic/bitops/hweight.h>
212 * @offset: The bitnumber to start searching at 140#include <asm-generic/bitops/sched.h>
213 * @size: The maximum size to search 141#include <asm-generic/bitops/ext2-non-atomic.h>
214 */ 142#include <asm-generic/bitops/ext2-atomic.h>
215static __inline__ unsigned long find_next_bit(const unsigned long *addr, 143#include <asm-generic/bitops/minix.h>
216 unsigned long size, unsigned long offset) 144#include <asm-generic/bitops/fls.h>
217{ 145#include <asm-generic/bitops/fls64.h>
218 unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
219 unsigned int result = offset & ~31UL;
220 unsigned int tmp;
221
222 if (offset >= size)
223 return size;
224 size -= result;
225 offset &= 31UL;
226 if (offset) {
227 tmp = *p++;
228 tmp &= ~0UL << offset;
229 if (size < 32)
230 goto found_first;
231 if (tmp)
232 goto found_middle;
233 size -= 32;
234 result += 32;
235 }
236 while (size >= 32) {
237 if ((tmp = *p++) != 0)
238 goto found_middle;
239 result += 32;
240 size -= 32;
241 }
242 if (!size)
243 return result;
244 tmp = *p;
245
246found_first:
247 tmp &= ~0UL >> (32 - size);
248 if (tmp == 0UL) /* Are any bits set? */
249 return result + size; /* Nope. */
250found_middle:
251 return result + __ffs(tmp);
252}
253
254/**
255 * find_first_bit - find the first set bit in a memory region
256 * @addr: The address to start the search at
257 * @size: The maximum size to search
258 *
259 * Returns the bit-number of the first set bit, not the number of the byte
260 * containing a bit.
261 */
262#define find_first_bit(addr, size) \
263 find_next_bit((addr), (size), 0)
264
265static __inline__ int find_next_zero_bit(const unsigned long *addr, int size, int offset)
266{
267 const unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
268 unsigned long result = offset & ~31UL;
269 unsigned long tmp;
270
271 if (offset >= size)
272 return size;
273 size -= result;
274 offset &= 31UL;
275 if (offset) {
276 tmp = *(p++);
277 tmp |= ~0UL >> (32-offset);
278 if (size < 32)
279 goto found_first;
280 if (~tmp)
281 goto found_middle;
282 size -= 32;
283 result += 32;
284 }
285 while (size & ~31UL) {
286 if (~(tmp = *(p++)))
287 goto found_middle;
288 result += 32;
289 size -= 32;
290 }
291 if (!size)
292 return result;
293 tmp = *p;
294
295found_first:
296 tmp |= ~0UL << size;
297found_middle:
298 return result + ffz(tmp);
299}
300
301#define find_first_zero_bit(addr, size) \
302 find_next_zero_bit((addr), (size), 0)
303
304/*
305 * ffs: find first bit set. This is defined the same way as
306 * the libc and compiler builtin ffs routines, therefore
307 * differs in spirit from the above ffz (man ffs).
308 */
309
310#define ffs(x) generic_ffs(x)
311
312/*
313 * hweightN: returns the hamming weight (i.e. the number
314 * of bits set) of a N-bit word
315 */
316
317#define hweight32(x) generic_hweight32(x)
318#define hweight16(x) generic_hweight16(x)
319#define hweight8(x) generic_hweight8(x)
320
321/*
322 * Every architecture must define this function. It's the fastest
323 * way of searching a 140-bit bitmap where the first 100 bits are
324 * unlikely to be set. It's guaranteed that at least one of the 140
325 * bits is cleared.
326 */
327
328static inline int sched_find_first_bit(const unsigned long *b)
329{
330 if (unlikely(b[0]))
331 return __ffs(b[0]);
332 if (unlikely(b[1]))
333 return __ffs(b[1]) + 32;
334 if (unlikely(b[2]))
335 return __ffs(b[2]) + 64;
336 if (b[3])
337 return __ffs(b[3]) + 96;
338 return __ffs(b[4]) + 128;
339}
340
341#ifdef __LITTLE_ENDIAN__
342#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr))
343#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr))
344#define ext2_test_bit(nr, addr) test_bit((nr), (addr))
345#define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
346#define ext2_find_next_zero_bit(addr, size, offset) \
347 find_next_zero_bit((unsigned long *)(addr), (size), (offset))
348#else
349static __inline__ int ext2_set_bit(int nr, volatile void * addr)
350{
351 int mask, retval;
352 unsigned long flags;
353 volatile unsigned char *ADDR = (unsigned char *) addr;
354
355 ADDR += nr >> 3;
356 mask = 1 << (nr & 0x07);
357 local_irq_save(flags);
358 retval = (mask & *ADDR) != 0;
359 *ADDR |= mask;
360 local_irq_restore(flags);
361 return retval;
362}
363
364static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
365{
366 int mask, retval;
367 unsigned long flags;
368 volatile unsigned char *ADDR = (unsigned char *) addr;
369
370 ADDR += nr >> 3;
371 mask = 1 << (nr & 0x07);
372 local_irq_save(flags);
373 retval = (mask & *ADDR) != 0;
374 *ADDR &= ~mask;
375 local_irq_restore(flags);
376 return retval;
377}
378
379static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
380{
381 int mask;
382 const volatile unsigned char *ADDR = (const unsigned char *) addr;
383
384 ADDR += nr >> 3;
385 mask = 1 << (nr & 0x07);
386 return ((mask & *ADDR) != 0);
387}
388
389#define ext2_find_first_zero_bit(addr, size) \
390 ext2_find_next_zero_bit((addr), (size), 0)
391
392static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
393{
394 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
395 unsigned long result = offset & ~31UL;
396 unsigned long tmp;
397
398 if (offset >= size)
399 return size;
400 size -= result;
401 offset &= 31UL;
402 if(offset) {
403 /* We hold the little endian value in tmp, but then the
404 * shift is illegal. So we could keep a big endian value
405 * in tmp, like this:
406 *
407 * tmp = __swab32(*(p++));
408 * tmp |= ~0UL >> (32-offset);
409 *
410 * but this would decrease preformance, so we change the
411 * shift:
412 */
413 tmp = *(p++);
414 tmp |= __swab32(~0UL >> (32-offset));
415 if(size < 32)
416 goto found_first;
417 if(~tmp)
418 goto found_middle;
419 size -= 32;
420 result += 32;
421 }
422 while(size & ~31UL) {
423 if(~(tmp = *(p++)))
424 goto found_middle;
425 result += 32;
426 size -= 32;
427 }
428 if(!size)
429 return result;
430 tmp = *p;
431
432found_first:
433 /* tmp is little endian, so we would have to swab the shift,
434 * see above. But then we have to swab tmp below for ffz, so
435 * we might as well do this here.
436 */
437 return result + ffz(__swab32(tmp) | (~0UL << size));
438found_middle:
439 return result + ffz(__swab32(tmp));
440}
441#endif
442
443#define ext2_set_bit_atomic(lock, nr, addr) \
444 ({ \
445 int ret; \
446 spin_lock(lock); \
447 ret = ext2_set_bit((nr), (addr)); \
448 spin_unlock(lock); \
449 ret; \
450 })
451
452#define ext2_clear_bit_atomic(lock, nr, addr) \
453 ({ \
454 int ret; \
455 spin_lock(lock); \
456 ret = ext2_clear_bit((nr), (addr)); \
457 spin_unlock(lock); \
458 ret; \
459 })
460
461/* Bitmap functions for the minix filesystem. */
462#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
463#define minix_set_bit(nr,addr) set_bit(nr,addr)
464#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
465#define minix_test_bit(nr,addr) test_bit(nr,addr)
466#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
467
468/*
469 * fls: find last bit set.
470 */
471
472#define fls(x) generic_fls(x)
473#define fls64(x) generic_fls64(x)
474 146
475#endif /* __KERNEL__ */ 147#endif /* __KERNEL__ */
476 148
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index b0b2937b6f83..2c3afe71323d 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -174,20 +174,6 @@ static inline void __set_io_port_base(unsigned long pbase)
174 generic_io_base = pbase; 174 generic_io_base = pbase;
175} 175}
176 176
177#define isa_readb(a) readb(ioport_map(a, 1))
178#define isa_readw(a) readw(ioport_map(a, 2))
179#define isa_readl(a) readl(ioport_map(a, 4))
180#define isa_writeb(b,a) writeb(b,ioport_map(a, 1))
181#define isa_writew(w,a) writew(w,ioport_map(a, 2))
182#define isa_writel(l,a) writel(l,ioport_map(a, 4))
183
184#define isa_memset_io(a,b,c) \
185 memset((void *)(ioport_map((unsigned long)(a), 1)),(b),(c))
186#define isa_memcpy_fromio(a,b,c) \
187 memcpy((a),(void *)(ioport_map((unsigned long)(b), 1)),(c))
188#define isa_memcpy_toio(a,b,c) \
189 memcpy((void *)(ioport_map((unsigned long)(a), 1)),(b),(c))
190
191/* We really want to try and get these to memcpy etc */ 177/* We really want to try and get these to memcpy etc */
192extern void memcpy_fromio(void *, volatile void __iomem *, unsigned long); 178extern void memcpy_fromio(void *, volatile void __iomem *, unsigned long);
193extern void memcpy_toio(volatile void __iomem *, const void *, unsigned long); 179extern void memcpy_toio(volatile void __iomem *, const void *, unsigned long);
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 972c3f655b2a..9c89287c3e56 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -105,9 +105,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
105 105
106/* PFN start number, because of __MEMORY_START */ 106/* PFN start number, because of __MEMORY_START */
107#define PFN_START (__MEMORY_START >> PAGE_SHIFT) 107#define PFN_START (__MEMORY_START >> PAGE_SHIFT)
108 108#define ARCH_PFN_OFFSET (FPN_START)
109#define pfn_to_page(pfn) (mem_map + (pfn) - PFN_START)
110#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + PFN_START)
111#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 109#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
112#define pfn_valid(pfn) (((pfn) - PFN_START) < max_mapnr) 110#define pfn_valid(pfn) (((pfn) - PFN_START) < max_mapnr)
113#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 111#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
@@ -117,6 +115,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
117 115
118#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
119 117
118#include <asm-generic/memory_model.h>
120#include <asm-generic/page.h> 119#include <asm-generic/page.h>
121 120
122#endif /* __ASM_SH_PAGE_H */ 121#endif /* __ASM_SH_PAGE_H */
diff --git a/include/asm-sh/poll.h b/include/asm-sh/poll.h
index 52f95b9188dc..dbca9b32f4a6 100644
--- a/include/asm-sh/poll.h
+++ b/include/asm-sh/poll.h
@@ -16,6 +16,7 @@
16#define POLLWRBAND 0x0200 16#define POLLWRBAND 0x0200
17#define POLLMSG 0x0400 17#define POLLMSG 0x0400
18#define POLLREMOVE 0x1000 18#define POLLREMOVE 0x1000
19#define POLLRDHUP 0x2000
19 20
20struct pollfd { 21struct pollfd {
21 int fd; 22 int fd;
diff --git a/include/asm-sh/stat.h b/include/asm-sh/stat.h
index 914e3fcbbd37..6c41a60657f1 100644
--- a/include/asm-sh/stat.h
+++ b/include/asm-sh/stat.h
@@ -60,13 +60,7 @@ struct stat64 {
60 long long st_size; 60 long long st_size;
61 unsigned long st_blksize; 61 unsigned long st_blksize;
62 62
63#if defined(__BIG_ENDIAN__) 63 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
64 unsigned long __pad4; /* Future possible st_blocks hi bits */
65 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
66#else /* Must be little */
67 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
68 unsigned long __pad4; /* Future possible st_blocks hi bits */
69#endif
70 64
71 unsigned long st_atime; 65 unsigned long st_atime;
72 unsigned long st_atime_nsec; 66 unsigned long st_atime_nsec;
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 85f0c11b4319..7345350d98c0 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -18,7 +18,7 @@
18struct thread_info { 18struct thread_info {
19 struct task_struct *task; /* main task structure */ 19 struct task_struct *task; /* main task structure */
20 struct exec_domain *exec_domain; /* execution domain */ 20 struct exec_domain *exec_domain; /* execution domain */
21 __u32 flags; /* low level flags */ 21 unsigned long flags; /* low level flags */
22 __u32 cpu; 22 __u32 cpu;
23 int preempt_count; /* 0 => preemptable, <0 => BUG */ 23 int preempt_count; /* 0 => preemptable, <0 => BUG */
24 struct restart_block restart_block; 24 struct restart_block restart_block;
diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h
index cb7e183a0a6b..488552f43b2a 100644
--- a/include/asm-sh/types.h
+++ b/include/asm-sh/types.h
@@ -58,6 +58,11 @@ typedef u64 sector_t;
58#define HAVE_SECTOR_T 58#define HAVE_SECTOR_T
59#endif 59#endif
60 60
61#ifdef CONFIG_LSF
62typedef u64 blkcnt_t;
63#define HAVE_BLKCNT_T
64#endif
65
61#endif /* __ASSEMBLY__ */ 66#endif /* __ASSEMBLY__ */
62 67
63#endif /* __KERNEL__ */ 68#endif /* __KERNEL__ */
diff --git a/include/asm-sh64/bitops.h b/include/asm-sh64/bitops.h
index ce9c3ad45fe0..f3bdcdb5d046 100644
--- a/include/asm-sh64/bitops.h
+++ b/include/asm-sh64/bitops.h
@@ -31,16 +31,6 @@ static __inline__ void set_bit(int nr, volatile void * addr)
31 local_irq_restore(flags); 31 local_irq_restore(flags);
32} 32}
33 33
34static inline void __set_bit(int nr, void *addr)
35{
36 int mask;
37 unsigned int *a = addr;
38
39 a += nr >> 5;
40 mask = 1 << (nr & 0x1f);
41 *a |= mask;
42}
43
44/* 34/*
45 * clear_bit() doesn't provide any barrier for the compiler. 35 * clear_bit() doesn't provide any barrier for the compiler.
46 */ 36 */
@@ -58,15 +48,6 @@ static inline void clear_bit(int nr, volatile unsigned long *a)
58 local_irq_restore(flags); 48 local_irq_restore(flags);
59} 49}
60 50
61static inline void __clear_bit(int nr, volatile unsigned long *a)
62{
63 int mask;
64
65 a += nr >> 5;
66 mask = 1 << (nr & 0x1f);
67 *a &= ~mask;
68}
69
70static __inline__ void change_bit(int nr, volatile void * addr) 51static __inline__ void change_bit(int nr, volatile void * addr)
71{ 52{
72 int mask; 53 int mask;
@@ -80,16 +61,6 @@ static __inline__ void change_bit(int nr, volatile void * addr)
80 local_irq_restore(flags); 61 local_irq_restore(flags);
81} 62}
82 63
83static __inline__ void __change_bit(int nr, volatile void * addr)
84{
85 int mask;
86 volatile unsigned int *a = addr;
87
88 a += nr >> 5;
89 mask = 1 << (nr & 0x1f);
90 *a ^= mask;
91}
92
93static __inline__ int test_and_set_bit(int nr, volatile void * addr) 64static __inline__ int test_and_set_bit(int nr, volatile void * addr)
94{ 65{
95 int mask, retval; 66 int mask, retval;
@@ -106,19 +77,6 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr)
106 return retval; 77 return retval;
107} 78}
108 79
109static __inline__ int __test_and_set_bit(int nr, volatile void * addr)
110{
111 int mask, retval;
112 volatile unsigned int *a = addr;
113
114 a += nr >> 5;
115 mask = 1 << (nr & 0x1f);
116 retval = (mask & *a) != 0;
117 *a |= mask;
118
119 return retval;
120}
121
122static __inline__ int test_and_clear_bit(int nr, volatile void * addr) 80static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
123{ 81{
124 int mask, retval; 82 int mask, retval;
@@ -135,19 +93,6 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
135 return retval; 93 return retval;
136} 94}
137 95
138static __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
139{
140 int mask, retval;
141 volatile unsigned int *a = addr;
142
143 a += nr >> 5;
144 mask = 1 << (nr & 0x1f);
145 retval = (mask & *a) != 0;
146 *a &= ~mask;
147
148 return retval;
149}
150
151static __inline__ int test_and_change_bit(int nr, volatile void * addr) 96static __inline__ int test_and_change_bit(int nr, volatile void * addr)
152{ 97{
153 int mask, retval; 98 int mask, retval;
@@ -164,23 +109,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
164 return retval; 109 return retval;
165} 110}
166 111
167static __inline__ int __test_and_change_bit(int nr, volatile void * addr) 112#include <asm-generic/bitops/non-atomic.h>
168{
169 int mask, retval;
170 volatile unsigned int *a = addr;
171
172 a += nr >> 5;
173 mask = 1 << (nr & 0x1f);
174 retval = (mask & *a) != 0;
175 *a ^= mask;
176
177 return retval;
178}
179
180static __inline__ int test_bit(int nr, const volatile void *addr)
181{
182 return 1UL & (((const volatile unsigned int *) addr)[nr >> 5] >> (nr & 31));
183}
184 113
185static __inline__ unsigned long ffz(unsigned long word) 114static __inline__ unsigned long ffz(unsigned long word)
186{ 115{
@@ -204,313 +133,16 @@ static __inline__ unsigned long ffz(unsigned long word)
204 return result; 133 return result;
205} 134}
206 135
207/** 136#include <asm-generic/bitops/__ffs.h>
208 * __ffs - find first bit in word 137#include <asm-generic/bitops/find.h>
209 * @word: The word to search 138#include <asm-generic/bitops/hweight.h>
210 * 139#include <asm-generic/bitops/sched.h>
211 * Undefined if no bit exists, so code should check against 0 first. 140#include <asm-generic/bitops/ffs.h>
212 */ 141#include <asm-generic/bitops/ext2-non-atomic.h>
213static inline unsigned long __ffs(unsigned long word) 142#include <asm-generic/bitops/ext2-atomic.h>
214{ 143#include <asm-generic/bitops/minix.h>
215 int r = 0; 144#include <asm-generic/bitops/fls.h>
216 145#include <asm-generic/bitops/fls64.h>
217 if (!word)
218 return 0;
219 if (!(word & 0xffff)) {
220 word >>= 16;
221 r += 16;
222 }
223 if (!(word & 0xff)) {
224 word >>= 8;
225 r += 8;
226 }
227 if (!(word & 0xf)) {
228 word >>= 4;
229 r += 4;
230 }
231 if (!(word & 3)) {
232 word >>= 2;
233 r += 2;
234 }
235 if (!(word & 1)) {
236 word >>= 1;
237 r += 1;
238 }
239 return r;
240}
241
242/**
243 * find_next_bit - find the next set bit in a memory region
244 * @addr: The address to base the search on
245 * @offset: The bitnumber to start searching at
246 * @size: The maximum size to search
247 */
248static inline unsigned long find_next_bit(const unsigned long *addr,
249 unsigned long size, unsigned long offset)
250{
251 unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
252 unsigned int result = offset & ~31UL;
253 unsigned int tmp;
254
255 if (offset >= size)
256 return size;
257 size -= result;
258 offset &= 31UL;
259 if (offset) {
260 tmp = *p++;
261 tmp &= ~0UL << offset;
262 if (size < 32)
263 goto found_first;
264 if (tmp)
265 goto found_middle;
266 size -= 32;
267 result += 32;
268 }
269 while (size >= 32) {
270 if ((tmp = *p++) != 0)
271 goto found_middle;
272 result += 32;
273 size -= 32;
274 }
275 if (!size)
276 return result;
277 tmp = *p;
278
279found_first:
280 tmp &= ~0UL >> (32 - size);
281 if (tmp == 0UL) /* Are any bits set? */
282 return result + size; /* Nope. */
283found_middle:
284 return result + __ffs(tmp);
285}
286
287/**
288 * find_first_bit - find the first set bit in a memory region
289 * @addr: The address to start the search at
290 * @size: The maximum size to search
291 *
292 * Returns the bit-number of the first set bit, not the number of the byte
293 * containing a bit.
294 */
295#define find_first_bit(addr, size) \
296 find_next_bit((addr), (size), 0)
297
298
299static inline int find_next_zero_bit(void *addr, int size, int offset)
300{
301 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
302 unsigned long result = offset & ~31UL;
303 unsigned long tmp;
304
305 if (offset >= size)
306 return size;
307 size -= result;
308 offset &= 31UL;
309 if (offset) {
310 tmp = *(p++);
311 tmp |= ~0UL >> (32-offset);
312 if (size < 32)
313 goto found_first;
314 if (~tmp)
315 goto found_middle;
316 size -= 32;
317 result += 32;
318 }
319 while (size & ~31UL) {
320 if (~(tmp = *(p++)))
321 goto found_middle;
322 result += 32;
323 size -= 32;
324 }
325 if (!size)
326 return result;
327 tmp = *p;
328
329found_first:
330 tmp |= ~0UL << size;
331found_middle:
332 return result + ffz(tmp);
333}
334
335#define find_first_zero_bit(addr, size) \
336 find_next_zero_bit((addr), (size), 0)
337
338/*
339 * hweightN: returns the hamming weight (i.e. the number
340 * of bits set) of a N-bit word
341 */
342
343#define hweight32(x) generic_hweight32(x)
344#define hweight16(x) generic_hweight16(x)
345#define hweight8(x) generic_hweight8(x)
346
347/*
348 * Every architecture must define this function. It's the fastest
349 * way of searching a 140-bit bitmap where the first 100 bits are
350 * unlikely to be set. It's guaranteed that at least one of the 140
351 * bits is cleared.
352 */
353
354static inline int sched_find_first_bit(unsigned long *b)
355{
356 if (unlikely(b[0]))
357 return __ffs(b[0]);
358 if (unlikely(b[1]))
359 return __ffs(b[1]) + 32;
360 if (unlikely(b[2]))
361 return __ffs(b[2]) + 64;
362 if (b[3])
363 return __ffs(b[3]) + 96;
364 return __ffs(b[4]) + 128;
365}
366
367/*
368 * ffs: find first bit set. This is defined the same way as
369 * the libc and compiler builtin ffs routines, therefore
370 * differs in spirit from the above ffz (man ffs).
371 */
372
373#define ffs(x) generic_ffs(x)
374
375/*
376 * hweightN: returns the hamming weight (i.e. the number
377 * of bits set) of a N-bit word
378 */
379
380#define hweight32(x) generic_hweight32(x)
381#define hweight16(x) generic_hweight16(x)
382#define hweight8(x) generic_hweight8(x)
383
384#ifdef __LITTLE_ENDIAN__
385#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr))
386#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr))
387#define ext2_test_bit(nr, addr) test_bit((nr), (addr))
388#define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
389#define ext2_find_next_zero_bit(addr, size, offset) \
390 find_next_zero_bit((addr), (size), (offset))
391#else
392static __inline__ int ext2_set_bit(int nr, volatile void * addr)
393{
394 int mask, retval;
395 unsigned long flags;
396 volatile unsigned char *ADDR = (unsigned char *) addr;
397
398 ADDR += nr >> 3;
399 mask = 1 << (nr & 0x07);
400 local_irq_save(flags);
401 retval = (mask & *ADDR) != 0;
402 *ADDR |= mask;
403 local_irq_restore(flags);
404 return retval;
405}
406
407static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
408{
409 int mask, retval;
410 unsigned long flags;
411 volatile unsigned char *ADDR = (unsigned char *) addr;
412
413 ADDR += nr >> 3;
414 mask = 1 << (nr & 0x07);
415 local_irq_save(flags);
416 retval = (mask & *ADDR) != 0;
417 *ADDR &= ~mask;
418 local_irq_restore(flags);
419 return retval;
420}
421
422static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
423{
424 int mask;
425 const volatile unsigned char *ADDR = (const unsigned char *) addr;
426
427 ADDR += nr >> 3;
428 mask = 1 << (nr & 0x07);
429 return ((mask & *ADDR) != 0);
430}
431
432#define ext2_find_first_zero_bit(addr, size) \
433 ext2_find_next_zero_bit((addr), (size), 0)
434
435static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
436{
437 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
438 unsigned long result = offset & ~31UL;
439 unsigned long tmp;
440
441 if (offset >= size)
442 return size;
443 size -= result;
444 offset &= 31UL;
445 if(offset) {
446 /* We hold the little endian value in tmp, but then the
447 * shift is illegal. So we could keep a big endian value
448 * in tmp, like this:
449 *
450 * tmp = __swab32(*(p++));
451 * tmp |= ~0UL >> (32-offset);
452 *
453 * but this would decrease preformance, so we change the
454 * shift:
455 */
456 tmp = *(p++);
457 tmp |= __swab32(~0UL >> (32-offset));
458 if(size < 32)
459 goto found_first;
460 if(~tmp)
461 goto found_middle;
462 size -= 32;
463 result += 32;
464 }
465 while(size & ~31UL) {
466 if(~(tmp = *(p++)))
467 goto found_middle;
468 result += 32;
469 size -= 32;
470 }
471 if(!size)
472 return result;
473 tmp = *p;
474
475found_first:
476 /* tmp is little endian, so we would have to swab the shift,
477 * see above. But then we have to swab tmp below for ffz, so
478 * we might as well do this here.
479 */
480 return result + ffz(__swab32(tmp) | (~0UL << size));
481found_middle:
482 return result + ffz(__swab32(tmp));
483}
484#endif
485
486#define ext2_set_bit_atomic(lock, nr, addr) \
487 ({ \
488 int ret; \
489 spin_lock(lock); \
490 ret = ext2_set_bit((nr), (addr)); \
491 spin_unlock(lock); \
492 ret; \
493 })
494
495#define ext2_clear_bit_atomic(lock, nr, addr) \
496 ({ \
497 int ret; \
498 spin_lock(lock); \
499 ret = ext2_clear_bit((nr), (addr)); \
500 spin_unlock(lock); \
501 ret; \
502 })
503
504/* Bitmap functions for the minix filesystem. */
505#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
506#define minix_set_bit(nr,addr) set_bit(nr,addr)
507#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
508#define minix_test_bit(nr,addr) test_bit(nr,addr)
509#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
510
511#define ffs(x) generic_ffs(x)
512#define fls(x) generic_fls(x)
513#define fls64(x) generic_fls64(x)
514 146
515#endif /* __KERNEL__ */ 147#endif /* __KERNEL__ */
516 148
diff --git a/include/asm-sh64/page.h b/include/asm-sh64/page.h
index c86df90f7cbd..e4937cdabebd 100644
--- a/include/asm-sh64/page.h
+++ b/include/asm-sh64/page.h
@@ -105,9 +105,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
105 105
106/* PFN start number, because of __MEMORY_START */ 106/* PFN start number, because of __MEMORY_START */
107#define PFN_START (__MEMORY_START >> PAGE_SHIFT) 107#define PFN_START (__MEMORY_START >> PAGE_SHIFT)
108 108#define ARCH_PFN_OFFSET (PFN_START)
109#define pfn_to_page(pfn) (mem_map + (pfn) - PFN_START)
110#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + PFN_START)
111#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 109#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
112#define pfn_valid(pfn) (((pfn) - PFN_START) < max_mapnr) 110#define pfn_valid(pfn) (((pfn) - PFN_START) < max_mapnr)
113#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 111#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
@@ -117,6 +115,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
117 115
118#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
119 117
118#include <asm-generic/memory_model.h>
120#include <asm-generic/page.h> 119#include <asm-generic/page.h>
121 120
122#endif /* __ASM_SH64_PAGE_H */ 121#endif /* __ASM_SH64_PAGE_H */
diff --git a/include/asm-sh64/pgalloc.h b/include/asm-sh64/pgalloc.h
index 678251ac1db8..b29dd468817e 100644
--- a/include/asm-sh64/pgalloc.h
+++ b/include/asm-sh64/pgalloc.h
@@ -167,22 +167,6 @@ 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
170static inline void set_pgdir(unsigned long address, pgd_t entry)
171{
172 struct task_struct * p;
173 pgd_t *pgd;
174
175 read_lock(&tasklist_lock);
176 for_each_process(p) {
177 if (!p->mm)
178 continue;
179 *pgd_offset(p->mm,address) = entry;
180 }
181 read_unlock(&tasklist_lock);
182 for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd)
183 pgd[address >> PGDIR_SHIFT] = entry;
184}
185
186#define pmd_populate_kernel(mm, pmd, pte) \ 170#define pmd_populate_kernel(mm, pmd, pte) \
187 set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) (pte))) 171 set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) (pte)))
188 172
diff --git a/include/asm-sh64/platform.h b/include/asm-sh64/platform.h
index 7046a9014027..bd0d9c405a80 100644
--- a/include/asm-sh64/platform.h
+++ b/include/asm-sh64/platform.h
@@ -61,9 +61,4 @@ extern int platform_int_priority[NR_INTC_IRQS];
61#define code_resource (platform_parms.kram_res_p[STANDARD_KRAM_RESOURCES - 2]) 61#define code_resource (platform_parms.kram_res_p[STANDARD_KRAM_RESOURCES - 2])
62#define data_resource (platform_parms.kram_res_p[STANDARD_KRAM_RESOURCES - 1]) 62#define data_resource (platform_parms.kram_res_p[STANDARD_KRAM_RESOURCES - 1])
63 63
64/* Be prepared to 64-bit sign extensions */
65#define PFN_UP(x) ((((x) + PAGE_SIZE-1) >> PAGE_SHIFT) & 0x000fffff)
66#define PFN_DOWN(x) (((x) >> PAGE_SHIFT) & 0x000fffff)
67#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
68
69#endif /* __ASM_SH64_PLATFORM_H */ 64#endif /* __ASM_SH64_PLATFORM_H */
diff --git a/include/asm-sh64/poll.h b/include/asm-sh64/poll.h
index a420d14eb704..3a6cbad08d28 100644
--- a/include/asm-sh64/poll.h
+++ b/include/asm-sh64/poll.h
@@ -26,6 +26,7 @@
26#define POLLWRNORM 0x0100 26#define POLLWRNORM 0x0100
27#define POLLWRBAND 0x0200 27#define POLLWRBAND 0x0200
28#define POLLMSG 0x0400 28#define POLLMSG 0x0400
29#define POLLRDHUP 0x2000
29 30
30struct pollfd { 31struct pollfd {
31 int fd; 32 int fd;
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h
index 41722b5e45ef..04aa3318f76a 100644
--- a/include/asm-sparc/bitops.h
+++ b/include/asm-sparc/bitops.h
@@ -152,386 +152,22 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
152 : "memory", "cc"); 152 : "memory", "cc");
153} 153}
154 154
155/* 155#include <asm-generic/bitops/non-atomic.h>
156 * non-atomic versions
157 */
158static inline void __set_bit(int nr, volatile unsigned long *addr)
159{
160 unsigned long mask = 1UL << (nr & 0x1f);
161 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
162
163 *p |= mask;
164}
165
166static inline void __clear_bit(int nr, volatile unsigned long *addr)
167{
168 unsigned long mask = 1UL << (nr & 0x1f);
169 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
170
171 *p &= ~mask;
172}
173
174static inline void __change_bit(int nr, volatile unsigned long *addr)
175{
176 unsigned long mask = 1UL << (nr & 0x1f);
177 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
178
179 *p ^= mask;
180}
181
182static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
183{
184 unsigned long mask = 1UL << (nr & 0x1f);
185 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
186 unsigned long old = *p;
187
188 *p = old | mask;
189 return (old & mask) != 0;
190}
191
192static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
193{
194 unsigned long mask = 1UL << (nr & 0x1f);
195 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
196 unsigned long old = *p;
197
198 *p = old & ~mask;
199 return (old & mask) != 0;
200}
201
202static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
203{
204 unsigned long mask = 1UL << (nr & 0x1f);
205 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
206 unsigned long old = *p;
207
208 *p = old ^ mask;
209 return (old & mask) != 0;
210}
211 156
212#define smp_mb__before_clear_bit() do { } while(0) 157#define smp_mb__before_clear_bit() do { } while(0)
213#define smp_mb__after_clear_bit() do { } while(0) 158#define smp_mb__after_clear_bit() do { } while(0)
214 159
215/* The following routine need not be atomic. */ 160#include <asm-generic/bitops/ffz.h>
216static inline int test_bit(int nr, __const__ volatile unsigned long *addr) 161#include <asm-generic/bitops/__ffs.h>
217{ 162#include <asm-generic/bitops/sched.h>
218 return (1UL & (((unsigned long *)addr)[nr >> 5] >> (nr & 31))) != 0UL; 163#include <asm-generic/bitops/ffs.h>
219} 164#include <asm-generic/bitops/fls.h>
220 165#include <asm-generic/bitops/fls64.h>
221/* The easy/cheese version for now. */ 166#include <asm-generic/bitops/hweight.h>
222static inline unsigned long ffz(unsigned long word) 167#include <asm-generic/bitops/find.h>
223{ 168#include <asm-generic/bitops/ext2-non-atomic.h>
224 unsigned long result = 0; 169#include <asm-generic/bitops/ext2-atomic.h>
225 170#include <asm-generic/bitops/minix.h>
226 while(word & 1) {
227 result++;
228 word >>= 1;
229 }
230 return result;
231}
232
233/**
234 * __ffs - find first bit in word.
235 * @word: The word to search
236 *
237 * Undefined if no bit exists, so code should check against 0 first.
238 */
239static inline int __ffs(unsigned long word)
240{
241 int num = 0;
242
243 if ((word & 0xffff) == 0) {
244 num += 16;
245 word >>= 16;
246 }
247 if ((word & 0xff) == 0) {
248 num += 8;
249 word >>= 8;
250 }
251 if ((word & 0xf) == 0) {
252 num += 4;
253 word >>= 4;
254 }
255 if ((word & 0x3) == 0) {
256 num += 2;
257 word >>= 2;
258 }
259 if ((word & 0x1) == 0)
260 num += 1;
261 return num;
262}
263
264/*
265 * Every architecture must define this function. It's the fastest
266 * way of searching a 140-bit bitmap where the first 100 bits are
267 * unlikely to be set. It's guaranteed that at least one of the 140
268 * bits is cleared.
269 */
270static inline int sched_find_first_bit(unsigned long *b)
271{
272
273 if (unlikely(b[0]))
274 return __ffs(b[0]);
275 if (unlikely(b[1]))
276 return __ffs(b[1]) + 32;
277 if (unlikely(b[2]))
278 return __ffs(b[2]) + 64;
279 if (b[3])
280 return __ffs(b[3]) + 96;
281 return __ffs(b[4]) + 128;
282}
283
284/*
285 * ffs: find first bit set. This is defined the same way as
286 * the libc and compiler builtin ffs routines, therefore
287 * differs in spirit from the above ffz (man ffs).
288 */
289static inline int ffs(int x)
290{
291 if (!x)
292 return 0;
293 return __ffs((unsigned long)x) + 1;
294}
295
296/*
297 * fls: find last (most-significant) bit set.
298 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
299 */
300#define fls(x) generic_fls(x)
301#define fls64(x) generic_fls64(x)
302
303/*
304 * hweightN: returns the hamming weight (i.e. the number
305 * of bits set) of a N-bit word
306 */
307#define hweight32(x) generic_hweight32(x)
308#define hweight16(x) generic_hweight16(x)
309#define hweight8(x) generic_hweight8(x)
310
311/*
312 * find_next_zero_bit() finds the first zero bit in a bit string of length
313 * 'size' bits, starting the search at bit 'offset'. This is largely based
314 * on Linus's ALPHA routines, which are pretty portable BTW.
315 */
316static inline unsigned long find_next_zero_bit(const unsigned long *addr,
317 unsigned long size, unsigned long offset)
318{
319 const unsigned long *p = addr + (offset >> 5);
320 unsigned long result = offset & ~31UL;
321 unsigned long tmp;
322
323 if (offset >= size)
324 return size;
325 size -= result;
326 offset &= 31UL;
327 if (offset) {
328 tmp = *(p++);
329 tmp |= ~0UL >> (32-offset);
330 if (size < 32)
331 goto found_first;
332 if (~tmp)
333 goto found_middle;
334 size -= 32;
335 result += 32;
336 }
337 while (size & ~31UL) {
338 if (~(tmp = *(p++)))
339 goto found_middle;
340 result += 32;
341 size -= 32;
342 }
343 if (!size)
344 return result;
345 tmp = *p;
346
347found_first:
348 tmp |= ~0UL << size;
349 if (tmp == ~0UL) /* Are any bits zero? */
350 return result + size; /* Nope. */
351found_middle:
352 return result + ffz(tmp);
353}
354
355/*
356 * Linus sez that gcc can optimize the following correctly, we'll see if this
357 * holds on the Sparc as it does for the ALPHA.
358 */
359#define find_first_zero_bit(addr, size) \
360 find_next_zero_bit((addr), (size), 0)
361
362/**
363 * find_next_bit - find the first set bit in a memory region
364 * @addr: The address to base the search on
365 * @offset: The bitnumber to start searching at
366 * @size: The maximum size to search
367 *
368 * Scheduler induced bitop, do not use.
369 */
370static inline int find_next_bit(const unsigned long *addr, int size, int offset)
371{
372 const unsigned long *p = addr + (offset >> 5);
373 int num = offset & ~0x1f;
374 unsigned long word;
375
376 word = *p++;
377 word &= ~((1 << (offset & 0x1f)) - 1);
378 while (num < size) {
379 if (word != 0) {
380 return __ffs(word) + num;
381 }
382 word = *p++;
383 num += 0x20;
384 }
385 return num;
386}
387
388/**
389 * find_first_bit - find the first set bit in a memory region
390 * @addr: The address to start the search at
391 * @size: The maximum size to search
392 *
393 * Returns the bit-number of the first set bit, not the number of the byte
394 * containing a bit.
395 */
396#define find_first_bit(addr, size) \
397 find_next_bit((addr), (size), 0)
398
399/*
400 */
401static inline int test_le_bit(int nr, __const__ unsigned long * addr)
402{
403 __const__ unsigned char *ADDR = (__const__ unsigned char *) addr;
404 return (ADDR[nr >> 3] >> (nr & 7)) & 1;
405}
406
407/*
408 * non-atomic versions
409 */
410static inline void __set_le_bit(int nr, unsigned long *addr)
411{
412 unsigned char *ADDR = (unsigned char *)addr;
413
414 ADDR += nr >> 3;
415 *ADDR |= 1 << (nr & 0x07);
416}
417
418static inline void __clear_le_bit(int nr, unsigned long *addr)
419{
420 unsigned char *ADDR = (unsigned char *)addr;
421
422 ADDR += nr >> 3;
423 *ADDR &= ~(1 << (nr & 0x07));
424}
425
426static inline int __test_and_set_le_bit(int nr, unsigned long *addr)
427{
428 int mask, retval;
429 unsigned char *ADDR = (unsigned char *)addr;
430
431 ADDR += nr >> 3;
432 mask = 1 << (nr & 0x07);
433 retval = (mask & *ADDR) != 0;
434 *ADDR |= mask;
435 return retval;
436}
437
438static inline int __test_and_clear_le_bit(int nr, unsigned long *addr)
439{
440 int mask, retval;
441 unsigned char *ADDR = (unsigned char *)addr;
442
443 ADDR += nr >> 3;
444 mask = 1 << (nr & 0x07);
445 retval = (mask & *ADDR) != 0;
446 *ADDR &= ~mask;
447 return retval;
448}
449
450static inline unsigned long find_next_zero_le_bit(const unsigned long *addr,
451 unsigned long size, unsigned long offset)
452{
453 const unsigned long *p = addr + (offset >> 5);
454 unsigned long result = offset & ~31UL;
455 unsigned long tmp;
456
457 if (offset >= size)
458 return size;
459 size -= result;
460 offset &= 31UL;
461 if(offset) {
462 tmp = *(p++);
463 tmp |= __swab32(~0UL >> (32-offset));
464 if(size < 32)
465 goto found_first;
466 if(~tmp)
467 goto found_middle;
468 size -= 32;
469 result += 32;
470 }
471 while(size & ~31UL) {
472 if(~(tmp = *(p++)))
473 goto found_middle;
474 result += 32;
475 size -= 32;
476 }
477 if(!size)
478 return result;
479 tmp = *p;
480
481found_first:
482 tmp = __swab32(tmp) | (~0UL << size);
483 if (tmp == ~0UL) /* Are any bits zero? */
484 return result + size; /* Nope. */
485 return result + ffz(tmp);
486
487found_middle:
488 return result + ffz(__swab32(tmp));
489}
490
491#define find_first_zero_le_bit(addr, size) \
492 find_next_zero_le_bit((addr), (size), 0)
493
494#define ext2_set_bit(nr,addr) \
495 __test_and_set_le_bit((nr),(unsigned long *)(addr))
496#define ext2_clear_bit(nr,addr) \
497 __test_and_clear_le_bit((nr),(unsigned long *)(addr))
498
499#define ext2_set_bit_atomic(lock, nr, addr) \
500 ({ \
501 int ret; \
502 spin_lock(lock); \
503 ret = ext2_set_bit((nr), (unsigned long *)(addr)); \
504 spin_unlock(lock); \
505 ret; \
506 })
507
508#define ext2_clear_bit_atomic(lock, nr, addr) \
509 ({ \
510 int ret; \
511 spin_lock(lock); \
512 ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \
513 spin_unlock(lock); \
514 ret; \
515 })
516
517#define ext2_test_bit(nr,addr) \
518 test_le_bit((nr),(unsigned long *)(addr))
519#define ext2_find_first_zero_bit(addr, size) \
520 find_first_zero_le_bit((unsigned long *)(addr), (size))
521#define ext2_find_next_zero_bit(addr, size, off) \
522 find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
523
524/* Bitmap functions for the minix filesystem. */
525#define minix_test_and_set_bit(nr,addr) \
526 test_and_set_bit((nr),(unsigned long *)(addr))
527#define minix_set_bit(nr,addr) \
528 set_bit((nr),(unsigned long *)(addr))
529#define minix_test_and_clear_bit(nr,addr) \
530 test_and_clear_bit((nr),(unsigned long *)(addr))
531#define minix_test_bit(nr,addr) \
532 test_bit((nr),(unsigned long *)(addr))
533#define minix_find_first_zero_bit(addr,size) \
534 find_first_zero_bit((unsigned long *)(addr),(size))
535 171
536#endif /* __KERNEL__ */ 172#endif /* __KERNEL__ */
537 173
diff --git a/include/asm-sparc/cpudata.h b/include/asm-sparc/cpudata.h
index ec0d9ef90a3b..a2c4d51d36c4 100644
--- a/include/asm-sparc/cpudata.h
+++ b/include/asm-sparc/cpudata.h
@@ -18,6 +18,7 @@ typedef struct {
18 unsigned int counter; 18 unsigned int counter;
19 int prom_node; 19 int prom_node;
20 int mid; 20 int mid;
21 int next;
21} cpuinfo_sparc; 22} cpuinfo_sparc;
22 23
23DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); 24DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
diff --git a/include/asm-sparc/idprom.h b/include/asm-sparc/idprom.h
index d856e640acd3..59083ed85232 100644
--- a/include/asm-sparc/idprom.h
+++ b/include/asm-sparc/idprom.h
@@ -7,27 +7,19 @@
7#ifndef _SPARC_IDPROM_H 7#ifndef _SPARC_IDPROM_H
8#define _SPARC_IDPROM_H 8#define _SPARC_IDPROM_H
9 9
10/* Offset into the EEPROM where the id PROM is located on the 4c */ 10#include <linux/types.h>
11#define IDPROM_OFFSET 0x7d8
12 11
13/* On sun4m; physical. */ 12struct idprom {
14/* MicroSPARC(-II) does not decode 31rd bit, but it works. */ 13 u8 id_format; /* Format identifier (always 0x01) */
15#define IDPROM_OFFSET_M 0xfd8 14 u8 id_machtype; /* Machine type */
16 15 u8 id_ethaddr[6]; /* Hardware ethernet address */
17struct idprom 16 s32 id_date; /* Date of manufacture */
18{ 17 u32 id_sernum:24; /* Unique serial number */
19 unsigned char id_format; /* Format identifier (always 0x01) */ 18 u8 id_cksum; /* Checksum - xor of the data bytes */
20 unsigned char id_machtype; /* Machine type */ 19 u8 reserved[16];
21 unsigned char id_ethaddr[6]; /* Hardware ethernet address */
22 long id_date; /* Date of manufacture */
23 unsigned int id_sernum:24; /* Unique serial number */
24 unsigned char id_cksum; /* Checksum - xor of the data bytes */
25 unsigned char reserved[16];
26}; 20};
27 21
28extern struct idprom *idprom; 22extern struct idprom *idprom;
29extern void idprom_init(void); 23extern void idprom_init(void);
30 24
31#define IDPROM_SIZE (sizeof(struct idprom))
32
33#endif /* !(_SPARC_IDPROM_H) */ 25#endif /* !(_SPARC_IDPROM_H) */
diff --git a/include/asm-sparc/oplib.h b/include/asm-sparc/oplib.h
index d0d76b30eb4c..f283f8aaf6a9 100644
--- a/include/asm-sparc/oplib.h
+++ b/include/asm-sparc/oplib.h
@@ -165,6 +165,7 @@ enum prom_input_device {
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_IRSC, /* input from rsc */
168 PROMDEV_IVCONS, /* input from virtual-console */
168 PROMDEV_I_UNK, 169 PROMDEV_I_UNK,
169}; 170};
170 171
@@ -177,6 +178,7 @@ enum prom_output_device {
177 PROMDEV_OTTYA, /* to ttya */ 178 PROMDEV_OTTYA, /* to ttya */
178 PROMDEV_OTTYB, /* to ttyb */ 179 PROMDEV_OTTYB, /* to ttyb */
179 PROMDEV_ORSC, /* to rsc */ 180 PROMDEV_ORSC, /* to rsc */
181 PROMDEV_OVCONS, /* to virtual-console */
180 PROMDEV_O_UNK, 182 PROMDEV_O_UNK,
181}; 183};
182 184
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h
index 9122684f6c1e..ec3274b7ddf4 100644
--- a/include/asm-sparc/page.h
+++ b/include/asm-sparc/page.h
@@ -152,8 +152,7 @@ extern unsigned long pfn_base;
152#define virt_to_phys __pa 152#define virt_to_phys __pa
153#define phys_to_virt __va 153#define phys_to_virt __va
154 154
155#define pfn_to_page(pfn) (mem_map + ((pfn)-(pfn_base))) 155#define ARCH_PFN_OFFSET (pfn_base)
156#define page_to_pfn(page) ((unsigned long)(((page) - mem_map) + pfn_base))
157#define virt_to_page(kaddr) (mem_map + ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT))) 156#define virt_to_page(kaddr) (mem_map + ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT)))
158 157
159#define pfn_valid(pfn) (((pfn) >= (pfn_base)) && (((pfn)-(pfn_base)) < max_mapnr)) 158#define pfn_valid(pfn) (((pfn) >= (pfn_base)) && (((pfn)-(pfn_base)) < max_mapnr))
@@ -164,6 +163,7 @@ extern unsigned long pfn_base;
164 163
165#endif /* __KERNEL__ */ 164#endif /* __KERNEL__ */
166 165
166#include <asm-generic/memory_model.h>
167#include <asm-generic/page.h> 167#include <asm-generic/page.h>
168 168
169#endif /* _SPARC_PAGE_H */ 169#endif /* _SPARC_PAGE_H */
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
index b33c35411e82..9eea8f4d41f0 100644
--- a/include/asm-sparc/pgtable.h
+++ b/include/asm-sparc/pgtable.h
@@ -269,11 +269,14 @@ BTFIXUPDEF_CALL_CONST(pte_t, mk_pte, struct page *, pgprot_t)
269 269
270BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_phys, unsigned long, pgprot_t) 270BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_phys, unsigned long, pgprot_t)
271BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int) 271BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int)
272BTFIXUPDEF_CALL_CONST(pgprot_t, pgprot_noncached, pgprot_t)
272 273
273#define mk_pte(page,pgprot) BTFIXUP_CALL(mk_pte)(page,pgprot) 274#define mk_pte(page,pgprot) BTFIXUP_CALL(mk_pte)(page,pgprot)
274#define mk_pte_phys(page,pgprot) BTFIXUP_CALL(mk_pte_phys)(page,pgprot) 275#define mk_pte_phys(page,pgprot) BTFIXUP_CALL(mk_pte_phys)(page,pgprot)
275#define mk_pte_io(page,pgprot,space) BTFIXUP_CALL(mk_pte_io)(page,pgprot,space) 276#define mk_pte_io(page,pgprot,space) BTFIXUP_CALL(mk_pte_io)(page,pgprot,space)
276 277
278#define pgprot_noncached(pgprot) BTFIXUP_CALL(pgprot_noncached)(pgprot)
279
277BTFIXUPDEF_INT(pte_modify_mask) 280BTFIXUPDEF_INT(pte_modify_mask)
278 281
279static pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__; 282static pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__;
@@ -309,9 +312,6 @@ BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long)
309#define pte_unmap(pte) do{}while(0) 312#define pte_unmap(pte) do{}while(0)
310#define pte_unmap_nested(pte) do{}while(0) 313#define pte_unmap_nested(pte) do{}while(0)
311 314
312/* The permissions for pgprot_val to make a page mapped on the obio space */
313extern unsigned int pg_iobits;
314
315/* Certain architectures need to do special things when pte's 315/* Certain architectures need to do special things when pte's
316 * within a page table are directly modified. Thus, the following 316 * within a page table are directly modified. Thus, the following
317 * hook is made available. 317 * hook is made available.
diff --git a/include/asm-sparc/poll.h b/include/asm-sparc/poll.h
index 3ddcc6481f09..26f13fb35497 100644
--- a/include/asm-sparc/poll.h
+++ b/include/asm-sparc/poll.h
@@ -13,6 +13,7 @@
13#define POLLWRBAND 256 13#define POLLWRBAND 256
14#define POLLMSG 512 14#define POLLMSG 512
15#define POLLREMOVE 1024 15#define POLLREMOVE 1024
16#define POLLRDHUP 2048
16 17
17struct pollfd { 18struct pollfd {
18 int fd; 19 int fd;
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
index 580c51d011df..98c46e3fbe8a 100644
--- a/include/asm-sparc/smp.h
+++ b/include/asm-sparc/smp.h
@@ -81,16 +81,9 @@ static inline int smp_call_function(void (*func)(void *info), void *info, int no
81 return 0; 81 return 0;
82} 82}
83 83
84extern __volatile__ int __cpu_number_map[NR_CPUS];
85extern __volatile__ int __cpu_logical_map[NR_CPUS];
86
87static inline int cpu_logical_map(int cpu) 84static inline int cpu_logical_map(int cpu)
88{ 85{
89 return __cpu_logical_map[cpu]; 86 return cpu;
90}
91static inline int cpu_number_map(int cpu)
92{
93 return __cpu_number_map[cpu];
94} 87}
95 88
96static inline int hard_smp4m_processor_id(void) 89static inline int hard_smp4m_processor_id(void)
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h
index 09575b608adb..4e0ce3a35ea9 100644
--- a/include/asm-sparc/socket.h
+++ b/include/asm-sparc/socket.h
@@ -47,7 +47,7 @@
47#define SO_TIMESTAMP 0x001d 47#define SO_TIMESTAMP 0x001d
48#define SCM_TIMESTAMP SO_TIMESTAMP 48#define SCM_TIMESTAMP SO_TIMESTAMP
49 49
50#define SO_PEERSEC 0x100e 50#define SO_PEERSEC 0x001e
51 51
52/* Security levels - as per NRL IPv6 - don't actually do anything */ 52/* Security levels - as per NRL IPv6 - don't actually do anything */
53#define SO_SECURITY_AUTHENTICATION 0x5001 53#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
index e344c98a6f5f..3350c90c7869 100644
--- a/include/asm-sparc/spinlock.h
+++ b/include/asm-sparc/spinlock.h
@@ -94,7 +94,7 @@ static inline void __read_lock(raw_rwlock_t *rw)
94#define __raw_read_lock(lock) \ 94#define __raw_read_lock(lock) \
95do { unsigned long flags; \ 95do { unsigned long flags; \
96 local_irq_save(flags); \ 96 local_irq_save(flags); \
97 __raw_read_lock(lock); \ 97 __read_lock(lock); \
98 local_irq_restore(flags); \ 98 local_irq_restore(flags); \
99} while(0) 99} while(0)
100 100
@@ -114,11 +114,11 @@ static inline void __read_unlock(raw_rwlock_t *rw)
114#define __raw_read_unlock(lock) \ 114#define __raw_read_unlock(lock) \
115do { unsigned long flags; \ 115do { unsigned long flags; \
116 local_irq_save(flags); \ 116 local_irq_save(flags); \
117 __raw_read_unlock(lock); \ 117 __read_unlock(lock); \
118 local_irq_restore(flags); \ 118 local_irq_restore(flags); \
119} while(0) 119} while(0)
120 120
121extern __inline__ void __raw_write_lock(raw_rwlock_t *rw) 121static inline void __raw_write_lock(raw_rwlock_t *rw)
122{ 122{
123 register raw_rwlock_t *lp asm("g1"); 123 register raw_rwlock_t *lp asm("g1");
124 lp = rw; 124 lp = rw;
@@ -131,9 +131,28 @@ extern __inline__ void __raw_write_lock(raw_rwlock_t *rw)
131 : "g2", "g4", "memory", "cc"); 131 : "g2", "g4", "memory", "cc");
132} 132}
133 133
134static inline int __raw_write_trylock(raw_rwlock_t *rw)
135{
136 unsigned int val;
137
138 __asm__ __volatile__("ldstub [%1 + 3], %0"
139 : "=r" (val)
140 : "r" (&rw->lock)
141 : "memory");
142
143 if (val == 0) {
144 val = rw->lock & ~0xff;
145 if (val)
146 ((volatile u8*)&rw->lock)[3] = 0;
147 }
148
149 return (val == 0);
150}
151
134#define __raw_write_unlock(rw) do { (rw)->lock = 0; } while(0) 152#define __raw_write_unlock(rw) do { (rw)->lock = 0; } while(0)
135 153
136#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 154#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
155#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
137 156
138#endif /* !(__ASSEMBLY__) */ 157#endif /* !(__ASSEMBLY__) */
139 158
diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h
index f8f1ec1f06e6..3cf132e1aa25 100644
--- a/include/asm-sparc/uaccess.h
+++ b/include/asm-sparc/uaccess.h
@@ -120,17 +120,6 @@ case 8: __put_user_asm(x,d,addr,__pu_ret); break; \
120default: __pu_ret = __put_user_bad(); break; \ 120default: __pu_ret = __put_user_bad(); break; \
121} } else { __pu_ret = -EFAULT; } __pu_ret; }) 121} } else { __pu_ret = -EFAULT; } __pu_ret; })
122 122
123#define __put_user_check_ret(x,addr,size,retval) ({ \
124register int __foo __asm__ ("l1"); \
125if (__access_ok(addr,size)) { \
126switch (size) { \
127case 1: __put_user_asm_ret(x,b,addr,retval,__foo); break; \
128case 2: __put_user_asm_ret(x,h,addr,retval,__foo); break; \
129case 4: __put_user_asm_ret(x,,addr,retval,__foo); break; \
130case 8: __put_user_asm_ret(x,d,addr,retval,__foo); break; \
131default: if (__put_user_bad()) return retval; break; \
132} } else return retval; })
133
134#define __put_user_nocheck(x,addr,size) ({ \ 123#define __put_user_nocheck(x,addr,size) ({ \
135register int __pu_ret; \ 124register int __pu_ret; \
136switch (size) { \ 125switch (size) { \
@@ -141,16 +130,6 @@ case 8: __put_user_asm(x,d,addr,__pu_ret); break; \
141default: __pu_ret = __put_user_bad(); break; \ 130default: __pu_ret = __put_user_bad(); break; \
142} __pu_ret; }) 131} __pu_ret; })
143 132
144#define __put_user_nocheck_ret(x,addr,size,retval) ({ \
145register int __foo __asm__ ("l1"); \
146switch (size) { \
147case 1: __put_user_asm_ret(x,b,addr,retval,__foo); break; \
148case 2: __put_user_asm_ret(x,h,addr,retval,__foo); break; \
149case 4: __put_user_asm_ret(x,,addr,retval,__foo); break; \
150case 8: __put_user_asm_ret(x,d,addr,retval,__foo); break; \
151default: if (__put_user_bad()) return retval; break; \
152} })
153
154#define __put_user_asm(x,size,addr,ret) \ 133#define __put_user_asm(x,size,addr,ret) \
155__asm__ __volatile__( \ 134__asm__ __volatile__( \
156 "/* Put user asm, inline. */\n" \ 135 "/* Put user asm, inline. */\n" \
@@ -170,32 +149,6 @@ __asm__ __volatile__( \
170 : "=&r" (ret) : "r" (x), "m" (*__m(addr)), \ 149 : "=&r" (ret) : "r" (x), "m" (*__m(addr)), \
171 "i" (-EFAULT)) 150 "i" (-EFAULT))
172 151
173#define __put_user_asm_ret(x,size,addr,ret,foo) \
174if (__builtin_constant_p(ret) && ret == -EFAULT) \
175__asm__ __volatile__( \
176 "/* Put user asm ret, inline. */\n" \
177"1:\t" "st"#size " %1, %2\n\n\t" \
178 ".section __ex_table,#alloc\n\t" \
179 ".align 4\n\t" \
180 ".word 1b, __ret_efault\n\n\t" \
181 ".previous\n\n\t" \
182 : "=r" (foo) : "r" (x), "m" (*__m(addr))); \
183else \
184__asm__ __volatile( \
185 "/* Put user asm ret, inline. */\n" \
186"1:\t" "st"#size " %1, %2\n\n\t" \
187 ".section .fixup,#alloc,#execinstr\n\t" \
188 ".align 4\n" \
189"3:\n\t" \
190 "ret\n\t" \
191 " restore %%g0, %3, %%o0\n\t" \
192 ".previous\n\n\t" \
193 ".section __ex_table,#alloc\n\t" \
194 ".align 4\n\t" \
195 ".word 1b, 3b\n\n\t" \
196 ".previous\n\n\t" \
197 : "=r" (foo) : "r" (x), "m" (*__m(addr)), "i" (ret))
198
199extern int __put_user_bad(void); 152extern int __put_user_bad(void);
200 153
201#define __get_user_check(x,addr,size,type) ({ \ 154#define __get_user_check(x,addr,size,type) ({ \
diff --git a/include/asm-sparc64/a.out.h b/include/asm-sparc64/a.out.h
index 02af289e3f46..35cb5c9e0c92 100644
--- a/include/asm-sparc64/a.out.h
+++ b/include/asm-sparc64/a.out.h
@@ -95,7 +95,11 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
95 95
96#ifdef __KERNEL__ 96#ifdef __KERNEL__
97 97
98#define STACK_TOP (test_thread_flag(TIF_32BIT) ? 0xf0000000 : 0x80000000000L) 98#define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE)
99#define STACK_TOP64 (0x0000080000000000UL - (1UL << 32UL))
100
101#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
102 STACK_TOP32 : STACK_TOP64)
99 103
100#endif 104#endif
101 105
diff --git a/include/asm-sparc64/asi.h b/include/asm-sparc64/asi.h
index 534855660f2a..662a21107ae6 100644
--- a/include/asm-sparc64/asi.h
+++ b/include/asm-sparc64/asi.h
@@ -25,14 +25,27 @@
25 25
26/* SpitFire and later extended ASIs. The "(III)" marker designates 26/* SpitFire and later extended ASIs. The "(III)" marker designates
27 * UltraSparc-III and later specific ASIs. The "(CMT)" marker designates 27 * UltraSparc-III and later specific ASIs. The "(CMT)" marker designates
28 * Chip Multi Threading specific ASIs. 28 * Chip Multi Threading specific ASIs. "(NG)" designates Niagara specific
29 * ASIs, "(4V)" designates SUN4V specific ASIs.
29 */ 30 */
30#define ASI_PHYS_USE_EC 0x14 /* PADDR, E-cachable */ 31#define ASI_PHYS_USE_EC 0x14 /* PADDR, E-cachable */
31#define ASI_PHYS_BYPASS_EC_E 0x15 /* PADDR, E-bit */ 32#define ASI_PHYS_BYPASS_EC_E 0x15 /* PADDR, E-bit */
33#define ASI_BLK_AIUP_4V 0x16 /* (4V) Prim, user, block ld/st */
34#define ASI_BLK_AIUS_4V 0x17 /* (4V) Sec, user, block ld/st */
32#define ASI_PHYS_USE_EC_L 0x1c /* PADDR, E-cachable, little endian*/ 35#define ASI_PHYS_USE_EC_L 0x1c /* PADDR, E-cachable, little endian*/
33#define ASI_PHYS_BYPASS_EC_E_L 0x1d /* PADDR, E-bit, little endian */ 36#define ASI_PHYS_BYPASS_EC_E_L 0x1d /* PADDR, E-bit, little endian */
37#define ASI_BLK_AIUP_L_4V 0x1e /* (4V) Prim, user, block, l-endian*/
38#define ASI_BLK_AIUS_L_4V 0x1f /* (4V) Sec, user, block, l-endian */
39#define ASI_SCRATCHPAD 0x20 /* (4V) Scratch Pad Registers */
40#define ASI_MMU 0x21 /* (4V) MMU Context Registers */
41#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23 /* (NG) init-store, twin load,
42 * secondary, user
43 */
34#define ASI_NUCLEUS_QUAD_LDD 0x24 /* Cachable, qword load */ 44#define ASI_NUCLEUS_QUAD_LDD 0x24 /* Cachable, qword load */
45#define ASI_QUEUE 0x25 /* (4V) Interrupt Queue Registers */
46#define ASI_QUAD_LDD_PHYS_4V 0x26 /* (4V) Physical, qword load */
35#define ASI_NUCLEUS_QUAD_LDD_L 0x2c /* Cachable, qword load, l-endian */ 47#define ASI_NUCLEUS_QUAD_LDD_L 0x2c /* Cachable, qword load, l-endian */
48#define ASI_QUAD_LDD_PHYS_L_4V 0x2e /* (4V) Phys, qword load, l-endian */
36#define ASI_PCACHE_DATA_STATUS 0x30 /* (III) PCache data stat RAM diag */ 49#define ASI_PCACHE_DATA_STATUS 0x30 /* (III) PCache data stat RAM diag */
37#define ASI_PCACHE_DATA 0x31 /* (III) PCache data RAM diag */ 50#define ASI_PCACHE_DATA 0x31 /* (III) PCache data RAM diag */
38#define ASI_PCACHE_TAG 0x32 /* (III) PCache tag RAM diag */ 51#define ASI_PCACHE_TAG 0x32 /* (III) PCache tag RAM diag */
@@ -137,6 +150,9 @@
137#define ASI_FL16_SL 0xdb /* Secondary, 1 16-bit, fpu ld/st,L*/ 150#define ASI_FL16_SL 0xdb /* Secondary, 1 16-bit, fpu ld/st,L*/
138#define ASI_BLK_COMMIT_P 0xe0 /* Primary, blk store commit */ 151#define ASI_BLK_COMMIT_P 0xe0 /* Primary, blk store commit */
139#define ASI_BLK_COMMIT_S 0xe1 /* Secondary, blk store commit */ 152#define ASI_BLK_COMMIT_S 0xe1 /* Secondary, blk store commit */
153#define ASI_BLK_INIT_QUAD_LDD_P 0xe2 /* (NG) init-store, twin load,
154 * primary, implicit
155 */
140#define ASI_BLK_P 0xf0 /* Primary, blk ld/st */ 156#define ASI_BLK_P 0xf0 /* Primary, blk ld/st */
141#define ASI_BLK_S 0xf1 /* Secondary, blk ld/st */ 157#define ASI_BLK_S 0xf1 /* Secondary, blk ld/st */
142#define ASI_BLK_PL 0xf8 /* Primary, blk ld/st, little */ 158#define ASI_BLK_PL 0xf8 /* Primary, blk ld/st, little */
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
index 25256bdc8aae..468eb48d8142 100644
--- a/include/asm-sparc64/atomic.h
+++ b/include/asm-sparc64/atomic.h
@@ -78,9 +78,15 @@ extern int atomic64_sub_ret(int, atomic64_t *);
78({ \ 78({ \
79 int c, old; \ 79 int c, old; \
80 c = atomic_read(v); \ 80 c = atomic_read(v); \
81 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 81 for (;;) { \
82 if (unlikely(c == (u))) \
83 break; \
84 old = atomic_cmpxchg((v), c, c + (a)); \
85 if (likely(old == c)) \
86 break; \
82 c = old; \ 87 c = old; \
83 c != (u); \ 88 } \
89 likely(c != (u)); \
84}) 90})
85#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 91#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
86 92
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
index 6efc0162fb09..71944b0f09de 100644
--- a/include/asm-sparc64/bitops.h
+++ b/include/asm-sparc64/bitops.h
@@ -18,58 +18,7 @@ extern void set_bit(unsigned long nr, volatile unsigned long *addr);
18extern void clear_bit(unsigned long nr, volatile unsigned long *addr); 18extern void clear_bit(unsigned long nr, volatile unsigned long *addr);
19extern void change_bit(unsigned long nr, volatile unsigned long *addr); 19extern void change_bit(unsigned long nr, volatile unsigned long *addr);
20 20
21/* "non-atomic" versions... */ 21#include <asm-generic/bitops/non-atomic.h>
22
23static inline void __set_bit(int nr, volatile unsigned long *addr)
24{
25 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
26
27 *m |= (1UL << (nr & 63));
28}
29
30static inline void __clear_bit(int nr, volatile unsigned long *addr)
31{
32 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
33
34 *m &= ~(1UL << (nr & 63));
35}
36
37static inline void __change_bit(int nr, volatile unsigned long *addr)
38{
39 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
40
41 *m ^= (1UL << (nr & 63));
42}
43
44static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
45{
46 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
47 unsigned long old = *m;
48 unsigned long mask = (1UL << (nr & 63));
49
50 *m = (old | mask);
51 return ((old & mask) != 0);
52}
53
54static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
55{
56 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
57 unsigned long old = *m;
58 unsigned long mask = (1UL << (nr & 63));
59
60 *m = (old & ~mask);
61 return ((old & mask) != 0);
62}
63
64static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
65{
66 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
67 unsigned long old = *m;
68 unsigned long mask = (1UL << (nr & 63));
69
70 *m = (old ^ mask);
71 return ((old & mask) != 0);
72}
73 22
74#ifdef CONFIG_SMP 23#ifdef CONFIG_SMP
75#define smp_mb__before_clear_bit() membar_storeload_loadload() 24#define smp_mb__before_clear_bit() membar_storeload_loadload()
@@ -79,78 +28,15 @@ static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
79#define smp_mb__after_clear_bit() barrier() 28#define smp_mb__after_clear_bit() barrier()
80#endif 29#endif
81 30
82static inline int test_bit(int nr, __const__ volatile unsigned long *addr) 31#include <asm-generic/bitops/ffz.h>
83{ 32#include <asm-generic/bitops/__ffs.h>
84 return (1UL & (addr[nr >> 6] >> (nr & 63))) != 0UL; 33#include <asm-generic/bitops/fls.h>
85} 34#include <asm-generic/bitops/fls64.h>
86
87/* The easy/cheese version for now. */
88static inline unsigned long ffz(unsigned long word)
89{
90 unsigned long result;
91
92 result = 0;
93 while(word & 1) {
94 result++;
95 word >>= 1;
96 }
97 return result;
98}
99
100/**
101 * __ffs - find first bit in word.
102 * @word: The word to search
103 *
104 * Undefined if no bit exists, so code should check against 0 first.
105 */
106static inline unsigned long __ffs(unsigned long word)
107{
108 unsigned long result = 0;
109
110 while (!(word & 1UL)) {
111 result++;
112 word >>= 1;
113 }
114 return result;
115}
116
117/*
118 * fls: find last bit set.
119 */
120
121#define fls(x) generic_fls(x)
122#define fls64(x) generic_fls64(x)
123 35
124#ifdef __KERNEL__ 36#ifdef __KERNEL__
125 37
126/* 38#include <asm-generic/bitops/sched.h>
127 * Every architecture must define this function. It's the fastest 39#include <asm-generic/bitops/ffs.h>
128 * way of searching a 140-bit bitmap where the first 100 bits are
129 * unlikely to be set. It's guaranteed that at least one of the 140
130 * bits is cleared.
131 */
132static inline int sched_find_first_bit(unsigned long *b)
133{
134 if (unlikely(b[0]))
135 return __ffs(b[0]);
136 if (unlikely(((unsigned int)b[1])))
137 return __ffs(b[1]) + 64;
138 if (b[1] >> 32)
139 return __ffs(b[1] >> 32) + 96;
140 return __ffs(b[2]) + 128;
141}
142
143/*
144 * ffs: find first bit set. This is defined the same way as
145 * the libc and compiler builtin ffs routines, therefore
146 * differs in spirit from the above ffz (man ffs).
147 */
148static inline int ffs(int x)
149{
150 if (!x)
151 return 0;
152 return __ffs((unsigned long)x) + 1;
153}
154 40
155/* 41/*
156 * hweightN: returns the hamming weight (i.e. the number 42 * hweightN: returns the hamming weight (i.e. the number
@@ -193,102 +79,23 @@ static inline unsigned int hweight8(unsigned int w)
193 79
194#else 80#else
195 81
196#define hweight64(x) generic_hweight64(x) 82#include <asm-generic/bitops/hweight.h>
197#define hweight32(x) generic_hweight32(x)
198#define hweight16(x) generic_hweight16(x)
199#define hweight8(x) generic_hweight8(x)
200 83
201#endif 84#endif
202#endif /* __KERNEL__ */ 85#endif /* __KERNEL__ */
203 86
204/** 87#include <asm-generic/bitops/find.h>
205 * find_next_bit - find the next set bit in a memory region
206 * @addr: The address to base the search on
207 * @offset: The bitnumber to start searching at
208 * @size: The maximum size to search
209 */
210extern unsigned long find_next_bit(const unsigned long *, unsigned long,
211 unsigned long);
212
213/**
214 * find_first_bit - find the first set bit in a memory region
215 * @addr: The address to start the search at
216 * @size: The maximum size to search
217 *
218 * Returns the bit-number of the first set bit, not the number of the byte
219 * containing a bit.
220 */
221#define find_first_bit(addr, size) \
222 find_next_bit((addr), (size), 0)
223
224/* find_next_zero_bit() finds the first zero bit in a bit string of length
225 * 'size' bits, starting the search at bit 'offset'. This is largely based
226 * on Linus's ALPHA routines, which are pretty portable BTW.
227 */
228
229extern unsigned long find_next_zero_bit(const unsigned long *,
230 unsigned long, unsigned long);
231
232#define find_first_zero_bit(addr, size) \
233 find_next_zero_bit((addr), (size), 0)
234
235#define test_and_set_le_bit(nr,addr) \
236 test_and_set_bit((nr) ^ 0x38, (addr))
237#define test_and_clear_le_bit(nr,addr) \
238 test_and_clear_bit((nr) ^ 0x38, (addr))
239
240static inline int test_le_bit(int nr, __const__ unsigned long * addr)
241{
242 int mask;
243 __const__ unsigned char *ADDR = (__const__ unsigned char *) addr;
244
245 ADDR += nr >> 3;
246 mask = 1 << (nr & 0x07);
247 return ((mask & *ADDR) != 0);
248}
249
250#define find_first_zero_le_bit(addr, size) \
251 find_next_zero_le_bit((addr), (size), 0)
252
253extern unsigned long find_next_zero_le_bit(unsigned long *, unsigned long, unsigned long);
254 88
255#ifdef __KERNEL__ 89#ifdef __KERNEL__
256 90
257#define __set_le_bit(nr, addr) \ 91#include <asm-generic/bitops/ext2-non-atomic.h>
258 __set_bit((nr) ^ 0x38, (addr))
259#define __clear_le_bit(nr, addr) \
260 __clear_bit((nr) ^ 0x38, (addr))
261#define __test_and_clear_le_bit(nr, addr) \
262 __test_and_clear_bit((nr) ^ 0x38, (addr))
263#define __test_and_set_le_bit(nr, addr) \
264 __test_and_set_bit((nr) ^ 0x38, (addr))
265 92
266#define ext2_set_bit(nr,addr) \
267 __test_and_set_le_bit((nr),(unsigned long *)(addr))
268#define ext2_set_bit_atomic(lock,nr,addr) \ 93#define ext2_set_bit_atomic(lock,nr,addr) \
269 test_and_set_le_bit((nr),(unsigned long *)(addr)) 94 test_and_set_bit((nr) ^ 0x38,(unsigned long *)(addr))
270#define ext2_clear_bit(nr,addr) \
271 __test_and_clear_le_bit((nr),(unsigned long *)(addr))
272#define ext2_clear_bit_atomic(lock,nr,addr) \ 95#define ext2_clear_bit_atomic(lock,nr,addr) \
273 test_and_clear_le_bit((nr),(unsigned long *)(addr)) 96 test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr))
274#define ext2_test_bit(nr,addr) \
275 test_le_bit((nr),(unsigned long *)(addr))
276#define ext2_find_first_zero_bit(addr, size) \
277 find_first_zero_le_bit((unsigned long *)(addr), (size))
278#define ext2_find_next_zero_bit(addr, size, off) \
279 find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
280 97
281/* Bitmap functions for the minix filesystem. */ 98#include <asm-generic/bitops/minix.h>
282#define minix_test_and_set_bit(nr,addr) \
283 test_and_set_bit((nr),(unsigned long *)(addr))
284#define minix_set_bit(nr,addr) \
285 set_bit((nr),(unsigned long *)(addr))
286#define minix_test_and_clear_bit(nr,addr) \
287 test_and_clear_bit((nr),(unsigned long *)(addr))
288#define minix_test_bit(nr,addr) \
289 test_bit((nr),(unsigned long *)(addr))
290#define minix_find_first_zero_bit(addr,size) \
291 find_first_zero_bit((unsigned long *)(addr),(size))
292 99
293#endif /* __KERNEL__ */ 100#endif /* __KERNEL__ */
294 101
diff --git a/include/asm-sparc64/cache.h b/include/asm-sparc64/cache.h
index f7d35a2ae9b8..e9df17acedde 100644
--- a/include/asm-sparc64/cache.h
+++ b/include/asm-sparc64/cache.h
@@ -13,4 +13,6 @@
13#define SMP_CACHE_BYTES_SHIFT 6 13#define SMP_CACHE_BYTES_SHIFT 6
14#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. */
15 15
16#define __read_mostly __attribute__((__section__(".data.read_mostly")))
17
16#endif 18#endif
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index 74de79dca915..9d6a6dbaf126 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -1,41 +1,227 @@
1/* cpudata.h: Per-cpu parameters. 1/* cpudata.h: Per-cpu parameters.
2 * 2 *
3 * Copyright (C) 2003, 2005 David S. Miller (davem@redhat.com) 3 * Copyright (C) 2003, 2005, 2006 David S. Miller (davem@davemloft.net)
4 */ 4 */
5 5
6#ifndef _SPARC64_CPUDATA_H 6#ifndef _SPARC64_CPUDATA_H
7#define _SPARC64_CPUDATA_H 7#define _SPARC64_CPUDATA_H
8 8
9#include <asm/hypervisor.h>
10#include <asm/asi.h>
11
12#ifndef __ASSEMBLY__
13
9#include <linux/percpu.h> 14#include <linux/percpu.h>
15#include <linux/threads.h>
10 16
11typedef struct { 17typedef struct {
12 /* Dcache line 1 */ 18 /* Dcache line 1 */
13 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ 19 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */
14 unsigned int multiplier; 20 unsigned int multiplier;
15 unsigned int counter; 21 unsigned int counter;
16 unsigned int idle_volume; 22 unsigned int __pad1;
17 unsigned long clock_tick; /* %tick's per second */ 23 unsigned long clock_tick; /* %tick's per second */
18 unsigned long udelay_val; 24 unsigned long udelay_val;
19 25
20 /* Dcache line 2 */ 26 /* Dcache line 2, rarely used */
21 unsigned int pgcache_size;
22 unsigned int __pad1;
23 unsigned long *pte_cache[2];
24 unsigned long *pgd_cache;
25
26 /* Dcache line 3, rarely used */
27 unsigned int dcache_size; 27 unsigned int dcache_size;
28 unsigned int dcache_line_size; 28 unsigned int dcache_line_size;
29 unsigned int icache_size; 29 unsigned int icache_size;
30 unsigned int icache_line_size; 30 unsigned int icache_line_size;
31 unsigned int ecache_size; 31 unsigned int ecache_size;
32 unsigned int ecache_line_size; 32 unsigned int ecache_line_size;
33 unsigned int __pad2;
34 unsigned int __pad3; 33 unsigned int __pad3;
34 unsigned int __pad4;
35} cpuinfo_sparc; 35} cpuinfo_sparc;
36 36
37DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); 37DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
38#define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu)) 38#define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu))
39#define local_cpu_data() __get_cpu_var(__cpu_data) 39#define local_cpu_data() __get_cpu_var(__cpu_data)
40 40
41/* Trap handling code needs to get at a few critical values upon
42 * trap entry and to process TSB misses. These cannot be in the
43 * per_cpu() area as we really need to lock them into the TLB and
44 * thus make them part of the main kernel image. As a result we
45 * try to make this as small as possible.
46 *
47 * This is padded out and aligned to 64-bytes to avoid false sharing
48 * on SMP.
49 */
50
51/* If you modify the size of this structure, please update
52 * TRAP_BLOCK_SZ_SHIFT below.
53 */
54struct thread_info;
55struct trap_per_cpu {
56/* D-cache line 1: Basic thread information, cpu and device mondo queues */
57 struct thread_info *thread;
58 unsigned long pgd_paddr;
59 unsigned long cpu_mondo_pa;
60 unsigned long dev_mondo_pa;
61
62/* D-cache line 2: Error Mondo Queue and kernel buffer pointers */
63 unsigned long resum_mondo_pa;
64 unsigned long resum_kernel_buf_pa;
65 unsigned long nonresum_mondo_pa;
66 unsigned long nonresum_kernel_buf_pa;
67
68/* Dcache lines 3, 4, 5, and 6: Hypervisor Fault Status */
69 struct hv_fault_status fault_info;
70
71/* Dcache line 7: Physical addresses of CPU send mondo block and CPU list. */
72 unsigned long cpu_mondo_block_pa;
73 unsigned long cpu_list_pa;
74 unsigned long tsb_huge;
75 unsigned long tsb_huge_temp;
76
77/* Dcache line 8: Unused, needed to keep trap_block a power-of-2 in size. */
78 unsigned long __pad2[4];
79} __attribute__((aligned(64)));
80extern struct trap_per_cpu trap_block[NR_CPUS];
81extern void init_cur_cpu_trap(struct thread_info *);
82extern void setup_tba(void);
83
84struct cpuid_patch_entry {
85 unsigned int addr;
86 unsigned int cheetah_safari[4];
87 unsigned int cheetah_jbus[4];
88 unsigned int starfire[4];
89 unsigned int sun4v[4];
90};
91extern struct cpuid_patch_entry __cpuid_patch, __cpuid_patch_end;
92
93struct sun4v_1insn_patch_entry {
94 unsigned int addr;
95 unsigned int insn;
96};
97extern struct sun4v_1insn_patch_entry __sun4v_1insn_patch,
98 __sun4v_1insn_patch_end;
99
100struct sun4v_2insn_patch_entry {
101 unsigned int addr;
102 unsigned int insns[2];
103};
104extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch,
105 __sun4v_2insn_patch_end;
106
107#endif /* !(__ASSEMBLY__) */
108
109#define TRAP_PER_CPU_THREAD 0x00
110#define TRAP_PER_CPU_PGD_PADDR 0x08
111#define TRAP_PER_CPU_CPU_MONDO_PA 0x10
112#define TRAP_PER_CPU_DEV_MONDO_PA 0x18
113#define TRAP_PER_CPU_RESUM_MONDO_PA 0x20
114#define TRAP_PER_CPU_RESUM_KBUF_PA 0x28
115#define TRAP_PER_CPU_NONRESUM_MONDO_PA 0x30
116#define TRAP_PER_CPU_NONRESUM_KBUF_PA 0x38
117#define TRAP_PER_CPU_FAULT_INFO 0x40
118#define TRAP_PER_CPU_CPU_MONDO_BLOCK_PA 0xc0
119#define TRAP_PER_CPU_CPU_LIST_PA 0xc8
120#define TRAP_PER_CPU_TSB_HUGE 0xd0
121#define TRAP_PER_CPU_TSB_HUGE_TEMP 0xd8
122
123#define TRAP_BLOCK_SZ_SHIFT 8
124
125#include <asm/scratchpad.h>
126
127#define __GET_CPUID(REG) \
128 /* Spitfire implementation (default). */ \
129661: ldxa [%g0] ASI_UPA_CONFIG, REG; \
130 srlx REG, 17, REG; \
131 and REG, 0x1f, REG; \
132 nop; \
133 .section .cpuid_patch, "ax"; \
134 /* Instruction location. */ \
135 .word 661b; \
136 /* Cheetah Safari implementation. */ \
137 ldxa [%g0] ASI_SAFARI_CONFIG, REG; \
138 srlx REG, 17, REG; \
139 and REG, 0x3ff, REG; \
140 nop; \
141 /* Cheetah JBUS implementation. */ \
142 ldxa [%g0] ASI_JBUS_CONFIG, REG; \
143 srlx REG, 17, REG; \
144 and REG, 0x1f, REG; \
145 nop; \
146 /* Starfire implementation. */ \
147 sethi %hi(0x1fff40000d0 >> 9), REG; \
148 sllx REG, 9, REG; \
149 or REG, 0xd0, REG; \
150 lduwa [REG] ASI_PHYS_BYPASS_EC_E, REG;\
151 /* sun4v implementation. */ \
152 mov SCRATCHPAD_CPUID, REG; \
153 ldxa [REG] ASI_SCRATCHPAD, REG; \
154 nop; \
155 nop; \
156 .previous;
157
158#ifdef CONFIG_SMP
159
160#define TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
161 __GET_CPUID(TMP) \
162 sethi %hi(trap_block), DEST; \
163 sllx TMP, TRAP_BLOCK_SZ_SHIFT, TMP; \
164 or DEST, %lo(trap_block), DEST; \
165 add DEST, TMP, DEST; \
166
167/* Clobbers TMP, current address space PGD phys address into DEST. */
168#define TRAP_LOAD_PGD_PHYS(DEST, TMP) \
169 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
170 ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST;
171
172/* Clobbers TMP, loads local processor's IRQ work area into DEST. */
173#define TRAP_LOAD_IRQ_WORK(DEST, TMP) \
174 __GET_CPUID(TMP) \
175 sethi %hi(__irq_work), DEST; \
176 sllx TMP, 6, TMP; \
177 or DEST, %lo(__irq_work), DEST; \
178 add DEST, TMP, DEST;
179
180/* Clobbers TMP, loads DEST with current thread info pointer. */
181#define TRAP_LOAD_THREAD_REG(DEST, TMP) \
182 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
183 ldx [DEST + TRAP_PER_CPU_THREAD], DEST;
184
185/* Given the current thread info pointer in THR, load the per-cpu
186 * area base of the current processor into DEST. REG1, REG2, and REG3 are
187 * clobbered.
188 *
189 * You absolutely cannot use DEST as a temporary in this code. The
190 * reason is that traps can happen during execution, and return from
191 * trap will load the fully resolved DEST per-cpu base. This can corrupt
192 * the calculations done by the macro mid-stream.
193 */
194#define LOAD_PER_CPU_BASE(DEST, THR, REG1, REG2, REG3) \
195 ldub [THR + TI_CPU], REG1; \
196 sethi %hi(__per_cpu_shift), REG3; \
197 sethi %hi(__per_cpu_base), REG2; \
198 ldx [REG3 + %lo(__per_cpu_shift)], REG3; \
199 ldx [REG2 + %lo(__per_cpu_base)], REG2; \
200 sllx REG1, REG3, REG3; \
201 add REG3, REG2, DEST;
202
203#else
204
205#define TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
206 sethi %hi(trap_block), DEST; \
207 or DEST, %lo(trap_block), DEST; \
208
209/* Uniprocessor versions, we know the cpuid is zero. */
210#define TRAP_LOAD_PGD_PHYS(DEST, TMP) \
211 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
212 ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST;
213
214#define TRAP_LOAD_IRQ_WORK(DEST, TMP) \
215 sethi %hi(__irq_work), DEST; \
216 or DEST, %lo(__irq_work), DEST;
217
218#define TRAP_LOAD_THREAD_REG(DEST, TMP) \
219 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
220 ldx [DEST + TRAP_PER_CPU_THREAD], DEST;
221
222/* No per-cpu areas on uniprocessor, so no need to load DEST. */
223#define LOAD_PER_CPU_BASE(DEST, THR, REG1, REG2, REG3)
224
225#endif /* !(CONFIG_SMP) */
226
41#endif /* _SPARC64_CPUDATA_H */ 227#endif /* _SPARC64_CPUDATA_H */
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h
index 69539a8ab833..303d85e2f82e 100644
--- a/include/asm-sparc64/elf.h
+++ b/include/asm-sparc64/elf.h
@@ -10,6 +10,7 @@
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11#include <asm/processor.h> 11#include <asm/processor.h>
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13#include <asm/spitfire.h>
13#endif 14#endif
14 15
15/* 16/*
@@ -68,6 +69,7 @@
68#define HWCAP_SPARC_MULDIV 8 69#define HWCAP_SPARC_MULDIV 8
69#define HWCAP_SPARC_V9 16 70#define HWCAP_SPARC_V9 16
70#define HWCAP_SPARC_ULTRA3 32 71#define HWCAP_SPARC_ULTRA3 32
72#define HWCAP_SPARC_BLKINIT 64
71 73
72/* 74/*
73 * These are used to set parameters in the core dumps. 75 * These are used to set parameters in the core dumps.
@@ -145,11 +147,21 @@ typedef struct {
145 instruction set this cpu supports. */ 147 instruction set this cpu supports. */
146 148
147/* On Ultra, we support all of the v8 capabilities. */ 149/* On Ultra, we support all of the v8 capabilities. */
148#define ELF_HWCAP ((HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \ 150static inline unsigned int sparc64_elf_hwcap(void)
149 HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | \ 151{
150 HWCAP_SPARC_V9) | \ 152 unsigned int cap = (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR |
151 ((tlb_type == cheetah || tlb_type == cheetah_plus) ? \ 153 HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV |
152 HWCAP_SPARC_ULTRA3 : 0)) 154 HWCAP_SPARC_V9);
155
156 if (tlb_type == cheetah || tlb_type == cheetah_plus)
157 cap |= HWCAP_SPARC_ULTRA3;
158 else if (tlb_type == hypervisor)
159 cap |= HWCAP_SPARC_BLKINIT;
160
161 return cap;
162}
163
164#define ELF_HWCAP sparc64_elf_hwcap();
153 165
154/* This yields a string that ld.so will use to load implementation 166/* This yields a string that ld.so will use to load implementation
155 specific libraries for optimization. This is more specific in 167 specific libraries for optimization. This is more specific in
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index 49d49a285943..6a95d5d0c576 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -738,7 +738,7 @@ static unsigned long __init sun_floppy_init(void)
738 if (!sun_floppy_types[0] && sun_floppy_types[1]) { 738 if (!sun_floppy_types[0] && sun_floppy_types[1]) {
739 /* 739 /*
740 * Set the drive exchange bit in FCR on NS87303, 740 * Set the drive exchange bit in FCR on NS87303,
741 * make shure other bits are sane before doing so. 741 * make sure other bits are sane before doing so.
742 */ 742 */
743 ns87303_modify(config, FER, FER_EDM, 0); 743 ns87303_modify(config, FER, FER_EDM, 0);
744 ns87303_modify(config, ASC, ASC_DRV2_SEL, 0); 744 ns87303_modify(config, ASC, ASC_DRV2_SEL, 0);
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h
index 34c4b43d3f98..dee40206b221 100644
--- a/include/asm-sparc64/futex.h
+++ b/include/asm-sparc64/futex.h
@@ -83,4 +83,28 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
83 return ret; 83 return ret;
84} 84}
85 85
86static inline int
87futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
88{
89 __asm__ __volatile__(
90 "\n1: lduwa [%2] %%asi, %0\n"
91 "2: casa [%2] %%asi, %0, %1\n"
92 "3:\n"
93 " .section .fixup,#alloc,#execinstr\n"
94 " .align 4\n"
95 "4: ba 3b\n"
96 " mov %3, %0\n"
97 " .previous\n"
98 " .section __ex_table,\"a\"\n"
99 " .align 4\n"
100 " .word 1b, 4b\n"
101 " .word 2b, 4b\n"
102 " .previous\n"
103 : "=&r" (oldval)
104 : "r" (newval), "r" (uaddr), "i" (-EFAULT)
105 : "memory");
106
107 return oldval;
108}
109
86#endif /* !(_SPARC64_FUTEX_H) */ 110#endif /* !(_SPARC64_FUTEX_H) */
diff --git a/include/asm-sparc64/head.h b/include/asm-sparc64/head.h
index 0abd3a674e8f..67960a751f4d 100644
--- a/include/asm-sparc64/head.h
+++ b/include/asm-sparc64/head.h
@@ -4,12 +4,21 @@
4 4
5#include <asm/pstate.h> 5#include <asm/pstate.h>
6 6
7 /* wrpr %g0, val, %gl */
8#define SET_GL(val) \
9 .word 0xa1902000 | val
10
11 /* rdpr %gl, %gN */
12#define GET_GL_GLOBAL(N) \
13 .word 0x81540000 | (N << 25)
14
7#define KERNBASE 0x400000 15#define KERNBASE 0x400000
8 16
9#define PTREGS_OFF (STACK_BIAS + STACKFRAME_SZ) 17#define PTREGS_OFF (STACK_BIAS + STACKFRAME_SZ)
10 18
11#define __CHEETAH_ID 0x003e0014 19#define __CHEETAH_ID 0x003e0014
12#define __JALAPENO_ID 0x003e0016 20#define __JALAPENO_ID 0x003e0016
21#define __SERRANO_ID 0x003e0022
13 22
14#define CHEETAH_MANUF 0x003e 23#define CHEETAH_MANUF 0x003e
15#define CHEETAH_IMPL 0x0014 /* Ultra-III */ 24#define CHEETAH_IMPL 0x0014 /* Ultra-III */
@@ -19,6 +28,12 @@
19#define PANTHER_IMPL 0x0019 /* Ultra-IV+ */ 28#define PANTHER_IMPL 0x0019 /* Ultra-IV+ */
20#define SERRANO_IMPL 0x0022 /* Ultra-IIIi+ */ 29#define SERRANO_IMPL 0x0022 /* Ultra-IIIi+ */
21 30
31#define BRANCH_IF_SUN4V(tmp1,label) \
32 sethi %hi(is_sun4v), %tmp1; \
33 lduw [%tmp1 + %lo(is_sun4v)], %tmp1; \
34 brnz,pn %tmp1, label; \
35 nop
36
22#define BRANCH_IF_CHEETAH_BASE(tmp1,tmp2,label) \ 37#define BRANCH_IF_CHEETAH_BASE(tmp1,tmp2,label) \
23 rdpr %ver, %tmp1; \ 38 rdpr %ver, %tmp1; \
24 sethi %hi(__CHEETAH_ID), %tmp2; \ 39 sethi %hi(__CHEETAH_ID), %tmp2; \
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h
new file mode 100644
index 000000000000..612bf319753f
--- /dev/null
+++ b/include/asm-sparc64/hypervisor.h
@@ -0,0 +1,2128 @@
1#ifndef _SPARC64_HYPERVISOR_H
2#define _SPARC64_HYPERVISOR_H
3
4/* Sun4v hypervisor interfaces and defines.
5 *
6 * Hypervisor calls are made via traps to software traps number 0x80
7 * and above. Registers %o0 to %o5 serve as argument, status, and
8 * return value registers.
9 *
10 * There are two kinds of these traps. First there are the normal
11 * "fast traps" which use software trap 0x80 and encode the function
12 * to invoke by number in register %o5. Argument and return value
13 * handling is as follows:
14 *
15 * -----------------------------------------------
16 * | %o5 | function number | undefined |
17 * | %o0 | argument 0 | return status |
18 * | %o1 | argument 1 | return value 1 |
19 * | %o2 | argument 2 | return value 2 |
20 * | %o3 | argument 3 | return value 3 |
21 * | %o4 | argument 4 | return value 4 |
22 * -----------------------------------------------
23 *
24 * The second type are "hyper-fast traps" which encode the function
25 * number in the software trap number itself. So these use trap
26 * numbers > 0x80. The register usage for hyper-fast traps is as
27 * follows:
28 *
29 * -----------------------------------------------
30 * | %o0 | argument 0 | return status |
31 * | %o1 | argument 1 | return value 1 |
32 * | %o2 | argument 2 | return value 2 |
33 * | %o3 | argument 3 | return value 3 |
34 * | %o4 | argument 4 | return value 4 |
35 * -----------------------------------------------
36 *
37 * Registers providing explicit arguments to the hypervisor calls
38 * are volatile across the call. Upon return their values are
39 * undefined unless explicitly specified as containing a particular
40 * return value by the specific call. The return status is always
41 * returned in register %o0, zero indicates a successful execution of
42 * the hypervisor call and other values indicate an error status as
43 * defined below. So, for example, if a hyper-fast trap takes
44 * arguments 0, 1, and 2, then %o0, %o1, and %o2 are volatile across
45 * the call and %o3, %o4, and %o5 would be preserved.
46 *
47 * If the hypervisor trap is invalid, or the fast trap function number
48 * is invalid, HV_EBADTRAP will be returned in %o0. Also, all 64-bits
49 * of the argument and return values are significant.
50 */
51
52/* Trap numbers. */
53#define HV_FAST_TRAP 0x80
54#define HV_MMU_MAP_ADDR_TRAP 0x83
55#define HV_MMU_UNMAP_ADDR_TRAP 0x84
56#define HV_TTRACE_ADDENTRY_TRAP 0x85
57#define HV_CORE_TRAP 0xff
58
59/* Error codes. */
60#define HV_EOK 0 /* Successful return */
61#define HV_ENOCPU 1 /* Invalid CPU id */
62#define HV_ENORADDR 2 /* Invalid real address */
63#define HV_ENOINTR 3 /* Invalid interrupt id */
64#define HV_EBADPGSZ 4 /* Invalid pagesize encoding */
65#define HV_EBADTSB 5 /* Invalid TSB description */
66#define HV_EINVAL 6 /* Invalid argument */
67#define HV_EBADTRAP 7 /* Invalid function number */
68#define HV_EBADALIGN 8 /* Invalid address alignment */
69#define HV_EWOULDBLOCK 9 /* Cannot complete w/o blocking */
70#define HV_ENOACCESS 10 /* No access to resource */
71#define HV_EIO 11 /* I/O error */
72#define HV_ECPUERROR 12 /* CPU in error state */
73#define HV_ENOTSUPPORTED 13 /* Function not supported */
74#define HV_ENOMAP 14 /* No mapping found */
75#define HV_ETOOMANY 15 /* Too many items specified */
76
77/* mach_exit()
78 * TRAP: HV_FAST_TRAP
79 * FUNCTION: HV_FAST_MACH_EXIT
80 * ARG0: exit code
81 * ERRORS: This service does not return.
82 *
83 * Stop all CPUs in the virtual domain and place them into the stopped
84 * state. The 64-bit exit code may be passed to a service entity as
85 * the domain's exit status. On systems without a service entity, the
86 * domain will undergo a reset, and the boot firmware will be
87 * reloaded.
88 *
89 * This function will never return to the guest that invokes it.
90 *
91 * Note: By convention an exit code of zero denotes a successful exit by
92 * the guest code. A non-zero exit code denotes a guest specific
93 * error indication.
94 *
95 */
96#define HV_FAST_MACH_EXIT 0x00
97
98/* Domain services. */
99
100/* mach_desc()
101 * TRAP: HV_FAST_TRAP
102 * FUNCTION: HV_FAST_MACH_DESC
103 * ARG0: buffer
104 * ARG1: length
105 * RET0: status
106 * RET1: length
107 * ERRORS: HV_EBADALIGN Buffer is badly aligned
108 * HV_ENORADDR Buffer is to an illegal real address.
109 * HV_EINVAL Buffer length is too small for complete
110 * machine description.
111 *
112 * Copy the most current machine description into the buffer indicated
113 * by the real address in ARG0. The buffer provided must be 16 byte
114 * aligned. Upon success or HV_EINVAL, this service returns the
115 * actual size of the machine description in the RET1 return value.
116 *
117 * Note: A method of determining the appropriate buffer size for the
118 * machine description is to first call this service with a buffer
119 * length of 0 bytes.
120 */
121#define HV_FAST_MACH_DESC 0x01
122
123/* mach_exit()
124 * TRAP: HV_FAST_TRAP
125 * FUNCTION: HV_FAST_MACH_SIR
126 * ERRORS: This service does not return.
127 *
128 * Perform a software initiated reset of the virtual machine domain.
129 * All CPUs are captured as soon as possible, all hardware devices are
130 * returned to the entry default state, and the domain is restarted at
131 * the SIR (trap type 0x04) real trap table (RTBA) entry point on one
132 * of the CPUs. The single CPU restarted is selected as determined by
133 * platform specific policy. Memory is preserved across this
134 * operation.
135 */
136#define HV_FAST_MACH_SIR 0x02
137
138/* mach_set_soft_state()
139 * TRAP: HV_FAST_TRAP
140 * FUNCTION: HV_FAST_MACH_SET_SOFT_STATE
141 * ARG0: software state
142 * ARG1: software state description pointer
143 * RET0: status
144 * ERRORS: EINVAL software state not valid or software state
145 * description is not NULL terminated
146 * ENORADDR software state description pointer is not a
147 * valid real address
148 * EBADALIGNED software state description is not correctly
149 * aligned
150 *
151 * This allows the guest to report it's soft state to the hypervisor. There
152 * are two primary components to this state. The first part states whether
153 * the guest software is running or not. The second containts optional
154 * details specific to the software.
155 *
156 * The software state argument is defined below in HV_SOFT_STATE_*, and
157 * indicates whether the guest is operating normally or in a transitional
158 * state.
159 *
160 * The software state description argument is a real address of a data buffer
161 * of size 32-bytes aligned on a 32-byte boundary. It is treated as a NULL
162 * terminated 7-bit ASCII string of up to 31 characters not including the
163 * NULL termination.
164 */
165#define HV_FAST_MACH_SET_SOFT_STATE 0x03
166#define HV_SOFT_STATE_NORMAL 0x01
167#define HV_SOFT_STATE_TRANSITION 0x02
168
169/* mach_get_soft_state()
170 * TRAP: HV_FAST_TRAP
171 * FUNCTION: HV_FAST_MACH_GET_SOFT_STATE
172 * ARG0: software state description pointer
173 * RET0: status
174 * RET1: software state
175 * ERRORS: ENORADDR software state description pointer is not a
176 * valid real address
177 * EBADALIGNED software state description is not correctly
178 * aligned
179 *
180 * Retrieve the current value of the guest's software state. The rules
181 * for the software state pointer are the same as for mach_set_soft_state()
182 * above.
183 */
184#define HV_FAST_MACH_GET_SOFT_STATE 0x04
185
186/* CPU services.
187 *
188 * CPUs represent devices that can execute software threads. A single
189 * chip that contains multiple cores or strands is represented as
190 * multiple CPUs with unique CPU identifiers. CPUs are exported to
191 * OBP via the machine description (and to the OS via the OBP device
192 * tree). CPUs are always in one of three states: stopped, running,
193 * or error.
194 *
195 * A CPU ID is a pre-assigned 16-bit value that uniquely identifies a
196 * CPU within a logical domain. Operations that are to be performed
197 * on multiple CPUs specify them via a CPU list. A CPU list is an
198 * array in real memory, of which each 16-bit word is a CPU ID. CPU
199 * lists are passed through the API as two arguments. The first is
200 * the number of entries (16-bit words) in the CPU list, and the
201 * second is the (real address) pointer to the CPU ID list.
202 */
203
204/* cpu_start()
205 * TRAP: HV_FAST_TRAP
206 * FUNCTION: HV_FAST_CPU_START
207 * ARG0: CPU ID
208 * ARG1: PC
209 * ARG1: RTBA
210 * ARG1: target ARG0
211 * RET0: status
212 * ERRORS: ENOCPU Invalid CPU ID
213 * EINVAL Target CPU ID is not in the stopped state
214 * ENORADDR Invalid PC or RTBA real address
215 * EBADALIGN Unaligned PC or unaligned RTBA
216 * EWOULDBLOCK Starting resources are not available
217 *
218 * Start CPU with given CPU ID with PC in %pc and with a real trap
219 * base address value of RTBA. The indicated CPU must be in the
220 * stopped state. The supplied RTBA must be aligned on a 256 byte
221 * boundary. On successful completion, the specified CPU will be in
222 * the running state and will be supplied with "target ARG0" in %o0
223 * and RTBA in %tba.
224 */
225#define HV_FAST_CPU_START 0x10
226
227/* cpu_stop()
228 * TRAP: HV_FAST_TRAP
229 * FUNCTION: HV_FAST_CPU_STOP
230 * ARG0: CPU ID
231 * RET0: status
232 * ERRORS: ENOCPU Invalid CPU ID
233 * EINVAL Target CPU ID is the current cpu
234 * EINVAL Target CPU ID is not in the running state
235 * EWOULDBLOCK Stopping resources are not available
236 * ENOTSUPPORTED Not supported on this platform
237 *
238 * The specified CPU is stopped. The indicated CPU must be in the
239 * running state. On completion, it will be in the stopped state. It
240 * is not legal to stop the current CPU.
241 *
242 * Note: As this service cannot be used to stop the current cpu, this service
243 * may not be used to stop the last running CPU in a domain. To stop
244 * and exit a running domain, a guest must use the mach_exit() service.
245 */
246#define HV_FAST_CPU_STOP 0x11
247
248/* cpu_yield()
249 * TRAP: HV_FAST_TRAP
250 * FUNCTION: HV_FAST_CPU_YIELD
251 * RET0: status
252 * ERRORS: No possible error.
253 *
254 * Suspend execution on the current CPU. Execution will resume when
255 * an interrupt (device, %stick_compare, or cross-call) is targeted to
256 * the CPU. On some CPUs, this API may be used by the hypervisor to
257 * save power by disabling hardware strands.
258 */
259#define HV_FAST_CPU_YIELD 0x12
260
261#ifndef __ASSEMBLY__
262extern unsigned long sun4v_cpu_yield(void);
263#endif
264
265/* cpu_qconf()
266 * TRAP: HV_FAST_TRAP
267 * FUNCTION: HV_FAST_CPU_QCONF
268 * ARG0: queue
269 * ARG1: base real address
270 * ARG2: number of entries
271 * RET0: status
272 * ERRORS: ENORADDR Invalid base real address
273 * EINVAL Invalid queue or number of entries is less
274 * than 2 or too large.
275 * EBADALIGN Base real address is not correctly aligned
276 * for size.
277 *
278 * Configure the given queue to be placed at the given base real
279 * address, with the given number of entries. The number of entries
280 * must be a power of 2. The base real address must be aligned
281 * exactly to match the queue size. Each queue entry is 64 bytes
282 * long, so for example a 32 entry queue must be aligned on a 2048
283 * byte real address boundary.
284 *
285 * The specified queue is unconfigured if the number of entries is given
286 * as zero.
287 *
288 * For the current version of this API service, the argument queue is defined
289 * as follows:
290 *
291 * queue description
292 * ----- -------------------------
293 * 0x3c cpu mondo queue
294 * 0x3d device mondo queue
295 * 0x3e resumable error queue
296 * 0x3f non-resumable error queue
297 *
298 * Note: The maximum number of entries for each queue for a specific cpu may
299 * be determined from the machine description.
300 */
301#define HV_FAST_CPU_QCONF 0x14
302#define HV_CPU_QUEUE_CPU_MONDO 0x3c
303#define HV_CPU_QUEUE_DEVICE_MONDO 0x3d
304#define HV_CPU_QUEUE_RES_ERROR 0x3e
305#define HV_CPU_QUEUE_NONRES_ERROR 0x3f
306
307#ifndef __ASSEMBLY__
308extern unsigned long sun4v_cpu_qconf(unsigned long type,
309 unsigned long queue_paddr,
310 unsigned long num_queue_entries);
311#endif
312
313/* cpu_qinfo()
314 * TRAP: HV_FAST_TRAP
315 * FUNCTION: HV_FAST_CPU_QINFO
316 * ARG0: queue
317 * RET0: status
318 * RET1: base real address
319 * RET1: number of entries
320 * ERRORS: EINVAL Invalid queue
321 *
322 * Return the configuration info for the given queue. The base real
323 * address and number of entries of the defined queue are returned.
324 * The queue argument values are the same as for cpu_qconf() above.
325 *
326 * If the specified queue is a valid queue number, but no queue has
327 * been defined, the number of entries will be set to zero and the
328 * base real address returned is undefined.
329 */
330#define HV_FAST_CPU_QINFO 0x15
331
332/* cpu_mondo_send()
333 * TRAP: HV_FAST_TRAP
334 * FUNCTION: HV_FAST_CPU_MONDO_SEND
335 * ARG0-1: CPU list
336 * ARG2: data real address
337 * RET0: status
338 * ERRORS: EBADALIGN Mondo data is not 64-byte aligned or CPU list
339 * is not 2-byte aligned.
340 * ENORADDR Invalid data mondo address, or invalid cpu list
341 * address.
342 * ENOCPU Invalid cpu in CPU list
343 * EWOULDBLOCK Some or all of the listed CPUs did not receive
344 * the mondo
345 * ECPUERROR One or more of the listed CPUs are in error
346 * state, use HV_FAST_CPU_STATE to see which ones
347 * EINVAL CPU list includes caller's CPU ID
348 *
349 * Send a mondo interrupt to the CPUs in the given CPU list with the
350 * 64-bytes at the given data real address. The data must be 64-byte
351 * aligned. The mondo data will be delivered to the cpu_mondo queues
352 * of the recipient CPUs.
353 *
354 * In all cases, error or not, the CPUs in the CPU list to which the
355 * mondo has been successfully delivered will be indicated by having
356 * their entry in CPU list updated with the value 0xffff.
357 */
358#define HV_FAST_CPU_MONDO_SEND 0x42
359
360#ifndef __ASSEMBLY__
361extern unsigned long sun4v_cpu_mondo_send(unsigned long cpu_count, unsigned long cpu_list_pa, unsigned long mondo_block_pa);
362#endif
363
364/* cpu_myid()
365 * TRAP: HV_FAST_TRAP
366 * FUNCTION: HV_FAST_CPU_MYID
367 * RET0: status
368 * RET1: CPU ID
369 * ERRORS: No errors defined.
370 *
371 * Return the hypervisor ID handle for the current CPU. Use by a
372 * virtual CPU to discover it's own identity.
373 */
374#define HV_FAST_CPU_MYID 0x16
375
376/* cpu_state()
377 * TRAP: HV_FAST_TRAP
378 * FUNCTION: HV_FAST_CPU_STATE
379 * ARG0: CPU ID
380 * RET0: status
381 * RET1: state
382 * ERRORS: ENOCPU Invalid CPU ID
383 *
384 * Retrieve the current state of the CPU with the given CPU ID.
385 */
386#define HV_FAST_CPU_STATE 0x17
387#define HV_CPU_STATE_STOPPED 0x01
388#define HV_CPU_STATE_RUNNING 0x02
389#define HV_CPU_STATE_ERROR 0x03
390
391#ifndef __ASSEMBLY__
392extern long sun4v_cpu_state(unsigned long cpuid);
393#endif
394
395/* cpu_set_rtba()
396 * TRAP: HV_FAST_TRAP
397 * FUNCTION: HV_FAST_CPU_SET_RTBA
398 * ARG0: RTBA
399 * RET0: status
400 * RET1: previous RTBA
401 * ERRORS: ENORADDR Invalid RTBA real address
402 * EBADALIGN RTBA is incorrectly aligned for a trap table
403 *
404 * Set the real trap base address of the local cpu to the given RTBA.
405 * The supplied RTBA must be aligned on a 256 byte boundary. Upon
406 * success the previous value of the RTBA is returned in RET1.
407 *
408 * Note: This service does not affect %tba
409 */
410#define HV_FAST_CPU_SET_RTBA 0x18
411
412/* cpu_set_rtba()
413 * TRAP: HV_FAST_TRAP
414 * FUNCTION: HV_FAST_CPU_GET_RTBA
415 * RET0: status
416 * RET1: previous RTBA
417 * ERRORS: No possible error.
418 *
419 * Returns the current value of RTBA in RET1.
420 */
421#define HV_FAST_CPU_GET_RTBA 0x19
422
423/* MMU services.
424 *
425 * Layout of a TSB description for mmu_tsb_ctx{,non}0() calls.
426 */
427#ifndef __ASSEMBLY__
428struct hv_tsb_descr {
429 unsigned short pgsz_idx;
430 unsigned short assoc;
431 unsigned int num_ttes; /* in TTEs */
432 unsigned int ctx_idx;
433 unsigned int pgsz_mask;
434 unsigned long tsb_base;
435 unsigned long resv;
436};
437#endif
438#define HV_TSB_DESCR_PGSZ_IDX_OFFSET 0x00
439#define HV_TSB_DESCR_ASSOC_OFFSET 0x02
440#define HV_TSB_DESCR_NUM_TTES_OFFSET 0x04
441#define HV_TSB_DESCR_CTX_IDX_OFFSET 0x08
442#define HV_TSB_DESCR_PGSZ_MASK_OFFSET 0x0c
443#define HV_TSB_DESCR_TSB_BASE_OFFSET 0x10
444#define HV_TSB_DESCR_RESV_OFFSET 0x18
445
446/* Page size bitmask. */
447#define HV_PGSZ_MASK_8K (1 << 0)
448#define HV_PGSZ_MASK_64K (1 << 1)
449#define HV_PGSZ_MASK_512K (1 << 2)
450#define HV_PGSZ_MASK_4MB (1 << 3)
451#define HV_PGSZ_MASK_32MB (1 << 4)
452#define HV_PGSZ_MASK_256MB (1 << 5)
453#define HV_PGSZ_MASK_2GB (1 << 6)
454#define HV_PGSZ_MASK_16GB (1 << 7)
455
456/* Page size index. The value given in the TSB descriptor must correspond
457 * to the smallest page size specified in the pgsz_mask page size bitmask.
458 */
459#define HV_PGSZ_IDX_8K 0
460#define HV_PGSZ_IDX_64K 1
461#define HV_PGSZ_IDX_512K 2
462#define HV_PGSZ_IDX_4MB 3
463#define HV_PGSZ_IDX_32MB 4
464#define HV_PGSZ_IDX_256MB 5
465#define HV_PGSZ_IDX_2GB 6
466#define HV_PGSZ_IDX_16GB 7
467
468/* MMU fault status area.
469 *
470 * MMU related faults have their status and fault address information
471 * placed into a memory region made available by privileged code. Each
472 * virtual processor must make a mmu_fault_area_conf() call to tell the
473 * hypervisor where that processor's fault status should be stored.
474 *
475 * The fault status block is a multiple of 64-bytes and must be aligned
476 * on a 64-byte boundary.
477 */
478#ifndef __ASSEMBLY__
479struct hv_fault_status {
480 unsigned long i_fault_type;
481 unsigned long i_fault_addr;
482 unsigned long i_fault_ctx;
483 unsigned long i_reserved[5];
484 unsigned long d_fault_type;
485 unsigned long d_fault_addr;
486 unsigned long d_fault_ctx;
487 unsigned long d_reserved[5];
488};
489#endif
490#define HV_FAULT_I_TYPE_OFFSET 0x00
491#define HV_FAULT_I_ADDR_OFFSET 0x08
492#define HV_FAULT_I_CTX_OFFSET 0x10
493#define HV_FAULT_D_TYPE_OFFSET 0x40
494#define HV_FAULT_D_ADDR_OFFSET 0x48
495#define HV_FAULT_D_CTX_OFFSET 0x50
496
497#define HV_FAULT_TYPE_FAST_MISS 1
498#define HV_FAULT_TYPE_FAST_PROT 2
499#define HV_FAULT_TYPE_MMU_MISS 3
500#define HV_FAULT_TYPE_INV_RA 4
501#define HV_FAULT_TYPE_PRIV_VIOL 5
502#define HV_FAULT_TYPE_PROT_VIOL 6
503#define HV_FAULT_TYPE_NFO 7
504#define HV_FAULT_TYPE_NFO_SEFF 8
505#define HV_FAULT_TYPE_INV_VA 9
506#define HV_FAULT_TYPE_INV_ASI 10
507#define HV_FAULT_TYPE_NC_ATOMIC 11
508#define HV_FAULT_TYPE_PRIV_ACT 12
509#define HV_FAULT_TYPE_RESV1 13
510#define HV_FAULT_TYPE_UNALIGNED 14
511#define HV_FAULT_TYPE_INV_PGSZ 15
512/* Values 16 --> -2 are reserved. */
513#define HV_FAULT_TYPE_MULTIPLE -1
514
515/* Flags argument for mmu_{map,unmap}_addr(), mmu_demap_{page,context,all}(),
516 * and mmu_{map,unmap}_perm_addr().
517 */
518#define HV_MMU_DMMU 0x01
519#define HV_MMU_IMMU 0x02
520#define HV_MMU_ALL (HV_MMU_DMMU | HV_MMU_IMMU)
521
522/* mmu_map_addr()
523 * TRAP: HV_MMU_MAP_ADDR_TRAP
524 * ARG0: virtual address
525 * ARG1: mmu context
526 * ARG2: TTE
527 * ARG3: flags (HV_MMU_{IMMU,DMMU})
528 * ERRORS: EINVAL Invalid virtual address, mmu context, or flags
529 * EBADPGSZ Invalid page size value
530 * ENORADDR Invalid real address in TTE
531 *
532 * Create a non-permanent mapping using the given TTE, virtual
533 * address, and mmu context. The flags argument determines which
534 * (data, or instruction, or both) TLB the mapping gets loaded into.
535 *
536 * The behavior is undefined if the valid bit is clear in the TTE.
537 *
538 * Note: This API call is for privileged code to specify temporary translation
539 * mappings without the need to create and manage a TSB.
540 */
541
542/* mmu_unmap_addr()
543 * TRAP: HV_MMU_UNMAP_ADDR_TRAP
544 * ARG0: virtual address
545 * ARG1: mmu context
546 * ARG2: flags (HV_MMU_{IMMU,DMMU})
547 * ERRORS: EINVAL Invalid virtual address, mmu context, or flags
548 *
549 * Demaps the given virtual address in the given mmu context on this
550 * CPU. This function is intended to be used to demap pages mapped
551 * with mmu_map_addr. This service is equivalent to invoking
552 * mmu_demap_page() with only the current CPU in the CPU list. The
553 * flags argument determines which (data, or instruction, or both) TLB
554 * the mapping gets unmapped from.
555 *
556 * Attempting to perform an unmap operation for a previously defined
557 * permanent mapping will have undefined results.
558 */
559
560/* mmu_tsb_ctx0()
561 * TRAP: HV_FAST_TRAP
562 * FUNCTION: HV_FAST_MMU_TSB_CTX0
563 * ARG0: number of TSB descriptions
564 * ARG1: TSB descriptions pointer
565 * RET0: status
566 * ERRORS: ENORADDR Invalid TSB descriptions pointer or
567 * TSB base within a descriptor
568 * EBADALIGN TSB descriptions pointer is not aligned
569 * to an 8-byte boundary, or TSB base
570 * within a descriptor is not aligned for
571 * the given TSB size
572 * EBADPGSZ Invalid page size in a TSB descriptor
573 * EBADTSB Invalid associativity or size in a TSB
574 * descriptor
575 * EINVAL Invalid number of TSB descriptions, or
576 * invalid context index in a TSB
577 * descriptor, or index page size not
578 * equal to smallest page size in page
579 * size bitmask field.
580 *
581 * Configures the TSBs for the current CPU for virtual addresses with
582 * context zero. The TSB descriptions pointer is a pointer to an
583 * array of the given number of TSB descriptions.
584 *
585 * Note: The maximum number of TSBs available to a virtual CPU is given by the
586 * mmu-max-#tsbs property of the cpu's corresponding "cpu" node in the
587 * machine description.
588 */
589#define HV_FAST_MMU_TSB_CTX0 0x20
590
591/* mmu_tsb_ctxnon0()
592 * TRAP: HV_FAST_TRAP
593 * FUNCTION: HV_FAST_MMU_TSB_CTXNON0
594 * ARG0: number of TSB descriptions
595 * ARG1: TSB descriptions pointer
596 * RET0: status
597 * ERRORS: Same as for mmu_tsb_ctx0() above.
598 *
599 * Configures the TSBs for the current CPU for virtual addresses with
600 * non-zero contexts. The TSB descriptions pointer is a pointer to an
601 * array of the given number of TSB descriptions.
602 *
603 * Note: A maximum of 16 TSBs may be specified in the TSB description list.
604 */
605#define HV_FAST_MMU_TSB_CTXNON0 0x21
606
607/* mmu_demap_page()
608 * TRAP: HV_FAST_TRAP
609 * FUNCTION: HV_FAST_MMU_DEMAP_PAGE
610 * ARG0: reserved, must be zero
611 * ARG1: reserved, must be zero
612 * ARG2: virtual address
613 * ARG3: mmu context
614 * ARG4: flags (HV_MMU_{IMMU,DMMU})
615 * RET0: status
616 * ERRORS: EINVAL Invalid virutal address, context, or
617 * flags value
618 * ENOTSUPPORTED ARG0 or ARG1 is non-zero
619 *
620 * Demaps any page mapping of the given virtual address in the given
621 * mmu context for the current virtual CPU. Any virtually tagged
622 * caches are guaranteed to be kept consistent. The flags argument
623 * determines which TLB (instruction, or data, or both) participate in
624 * the operation.
625 *
626 * ARG0 and ARG1 are both reserved and must be set to zero.
627 */
628#define HV_FAST_MMU_DEMAP_PAGE 0x22
629
630/* mmu_demap_ctx()
631 * TRAP: HV_FAST_TRAP
632 * FUNCTION: HV_FAST_MMU_DEMAP_CTX
633 * ARG0: reserved, must be zero
634 * ARG1: reserved, must be zero
635 * ARG2: mmu context
636 * ARG3: flags (HV_MMU_{IMMU,DMMU})
637 * RET0: status
638 * ERRORS: EINVAL Invalid context or flags value
639 * ENOTSUPPORTED ARG0 or ARG1 is non-zero
640 *
641 * Demaps all non-permanent virtual page mappings previously specified
642 * for the given context for the current virtual CPU. Any virtual
643 * tagged caches are guaranteed to be kept consistent. The flags
644 * argument determines which TLB (instruction, or data, or both)
645 * participate in the operation.
646 *
647 * ARG0 and ARG1 are both reserved and must be set to zero.
648 */
649#define HV_FAST_MMU_DEMAP_CTX 0x23
650
651/* mmu_demap_all()
652 * TRAP: HV_FAST_TRAP
653 * FUNCTION: HV_FAST_MMU_DEMAP_ALL
654 * ARG0: reserved, must be zero
655 * ARG1: reserved, must be zero
656 * ARG2: flags (HV_MMU_{IMMU,DMMU})
657 * RET0: status
658 * ERRORS: EINVAL Invalid flags value
659 * ENOTSUPPORTED ARG0 or ARG1 is non-zero
660 *
661 * Demaps all non-permanent virtual page mappings previously specified
662 * for the current virtual CPU. Any virtual tagged caches are
663 * guaranteed to be kept consistent. The flags argument determines
664 * which TLB (instruction, or data, or both) participate in the
665 * operation.
666 *
667 * ARG0 and ARG1 are both reserved and must be set to zero.
668 */
669#define HV_FAST_MMU_DEMAP_ALL 0x24
670
671/* mmu_map_perm_addr()
672 * TRAP: HV_FAST_TRAP
673 * FUNCTION: HV_FAST_MMU_MAP_PERM_ADDR
674 * ARG0: virtual address
675 * ARG1: reserved, must be zero
676 * ARG2: TTE
677 * ARG3: flags (HV_MMU_{IMMU,DMMU})
678 * RET0: status
679 * ERRORS: EINVAL Invalid virutal address or flags value
680 * EBADPGSZ Invalid page size value
681 * ENORADDR Invalid real address in TTE
682 * ETOOMANY Too many mappings (max of 8 reached)
683 *
684 * Create a permanent mapping using the given TTE and virtual address
685 * for context 0 on the calling virtual CPU. A maximum of 8 such
686 * permanent mappings may be specified by privileged code. Mappings
687 * may be removed with mmu_unmap_perm_addr().
688 *
689 * The behavior is undefined if a TTE with the valid bit clear is given.
690 *
691 * Note: This call is used to specify address space mappings for which
692 * privileged code does not expect to receive misses. For example,
693 * this mechanism can be used to map kernel nucleus code and data.
694 */
695#define HV_FAST_MMU_MAP_PERM_ADDR 0x25
696
697/* mmu_fault_area_conf()
698 * TRAP: HV_FAST_TRAP
699 * FUNCTION: HV_FAST_MMU_FAULT_AREA_CONF
700 * ARG0: real address
701 * RET0: status
702 * RET1: previous mmu fault area real address
703 * ERRORS: ENORADDR Invalid real address
704 * EBADALIGN Invalid alignment for fault area
705 *
706 * Configure the MMU fault status area for the calling CPU. A 64-byte
707 * aligned real address specifies where MMU fault status information
708 * is placed. The return value is the previously specified area, or 0
709 * for the first invocation. Specifying a fault area at real address
710 * 0 is not allowed.
711 */
712#define HV_FAST_MMU_FAULT_AREA_CONF 0x26
713
714/* mmu_enable()
715 * TRAP: HV_FAST_TRAP
716 * FUNCTION: HV_FAST_MMU_ENABLE
717 * ARG0: enable flag
718 * ARG1: return target address
719 * RET0: status
720 * ERRORS: ENORADDR Invalid real address when disabling
721 * translation.
722 * EBADALIGN The return target address is not
723 * aligned to an instruction.
724 * EINVAL The enable flag request the current
725 * operating mode (e.g. disable if already
726 * disabled)
727 *
728 * Enable or disable virtual address translation for the calling CPU
729 * within the virtual machine domain. If the enable flag is zero,
730 * translation is disabled, any non-zero value will enable
731 * translation.
732 *
733 * When this function returns, the newly selected translation mode
734 * will be active. If the mmu is being enabled, then the return
735 * target address is a virtual address else it is a real address.
736 *
737 * Upon successful completion, control will be returned to the given
738 * return target address (ie. the cpu will jump to that address). On
739 * failure, the previous mmu mode remains and the trap simply returns
740 * as normal with the appropriate error code in RET0.
741 */
742#define HV_FAST_MMU_ENABLE 0x27
743
744/* mmu_unmap_perm_addr()
745 * TRAP: HV_FAST_TRAP
746 * FUNCTION: HV_FAST_MMU_UNMAP_PERM_ADDR
747 * ARG0: virtual address
748 * ARG1: reserved, must be zero
749 * ARG2: flags (HV_MMU_{IMMU,DMMU})
750 * RET0: status
751 * ERRORS: EINVAL Invalid virutal address or flags value
752 * ENOMAP Specified mapping was not found
753 *
754 * Demaps any permanent page mapping (established via
755 * mmu_map_perm_addr()) at the given virtual address for context 0 on
756 * the current virtual CPU. Any virtual tagged caches are guaranteed
757 * to be kept consistent.
758 */
759#define HV_FAST_MMU_UNMAP_PERM_ADDR 0x28
760
761/* mmu_tsb_ctx0_info()
762 * TRAP: HV_FAST_TRAP
763 * FUNCTION: HV_FAST_MMU_TSB_CTX0_INFO
764 * ARG0: max TSBs
765 * ARG1: buffer pointer
766 * RET0: status
767 * RET1: number of TSBs
768 * ERRORS: EINVAL Supplied buffer is too small
769 * EBADALIGN The buffer pointer is badly aligned
770 * ENORADDR Invalid real address for buffer pointer
771 *
772 * Return the TSB configuration as previous defined by mmu_tsb_ctx0()
773 * into the provided buffer. The size of the buffer is given in ARG1
774 * in terms of the number of TSB description entries.
775 *
776 * Upon return, RET1 always contains the number of TSB descriptions
777 * previously configured. If zero TSBs were configured, EOK is
778 * returned with RET1 containing 0.
779 */
780#define HV_FAST_MMU_TSB_CTX0_INFO 0x29
781
782/* mmu_tsb_ctxnon0_info()
783 * TRAP: HV_FAST_TRAP
784 * FUNCTION: HV_FAST_MMU_TSB_CTXNON0_INFO
785 * ARG0: max TSBs
786 * ARG1: buffer pointer
787 * RET0: status
788 * RET1: number of TSBs
789 * ERRORS: EINVAL Supplied buffer is too small
790 * EBADALIGN The buffer pointer is badly aligned
791 * ENORADDR Invalid real address for buffer pointer
792 *
793 * Return the TSB configuration as previous defined by
794 * mmu_tsb_ctxnon0() into the provided buffer. The size of the buffer
795 * is given in ARG1 in terms of the number of TSB description entries.
796 *
797 * Upon return, RET1 always contains the number of TSB descriptions
798 * previously configured. If zero TSBs were configured, EOK is
799 * returned with RET1 containing 0.
800 */
801#define HV_FAST_MMU_TSB_CTXNON0_INFO 0x2a
802
803/* mmu_fault_area_info()
804 * TRAP: HV_FAST_TRAP
805 * FUNCTION: HV_FAST_MMU_FAULT_AREA_INFO
806 * RET0: status
807 * RET1: fault area real address
808 * ERRORS: No errors defined.
809 *
810 * Return the currently defined MMU fault status area for the current
811 * CPU. The real address of the fault status area is returned in
812 * RET1, or 0 is returned in RET1 if no fault status area is defined.
813 *
814 * Note: mmu_fault_area_conf() may be called with the return value (RET1)
815 * from this service if there is a need to save and restore the fault
816 * area for a cpu.
817 */
818#define HV_FAST_MMU_FAULT_AREA_INFO 0x2b
819
820/* Cache and Memory services. */
821
822/* mem_scrub()
823 * TRAP: HV_FAST_TRAP
824 * FUNCTION: HV_FAST_MEM_SCRUB
825 * ARG0: real address
826 * ARG1: length
827 * RET0: status
828 * RET1: length scrubbed
829 * ERRORS: ENORADDR Invalid real address
830 * EBADALIGN Start address or length are not correctly
831 * aligned
832 * EINVAL Length is zero
833 *
834 * Zero the memory contents in the range real address to real address
835 * plus length minus 1. Also, valid ECC will be generated for that
836 * memory address range. Scrubbing is started at the given real
837 * address, but may not scrub the entire given length. The actual
838 * length scrubbed will be returned in RET1.
839 *
840 * The real address and length must be aligned on an 8K boundary, or
841 * contain the start address and length from a sun4v error report.
842 *
843 * Note: There are two uses for this function. The first use is to block clear
844 * and initialize memory and the second is to scrub an u ncorrectable
845 * error reported via a resumable or non-resumable trap. The second
846 * use requires the arguments to be equal to the real address and length
847 * provided in a sun4v memory error report.
848 */
849#define HV_FAST_MEM_SCRUB 0x31
850
851/* mem_sync()
852 * TRAP: HV_FAST_TRAP
853 * FUNCTION: HV_FAST_MEM_SYNC
854 * ARG0: real address
855 * ARG1: length
856 * RET0: status
857 * RET1: length synced
858 * ERRORS: ENORADDR Invalid real address
859 * EBADALIGN Start address or length are not correctly
860 * aligned
861 * EINVAL Length is zero
862 *
863 * Force the next access within the real address to real address plus
864 * length minus 1 to be fetches from main system memory. Less than
865 * the given length may be synced, the actual amount synced is
866 * returned in RET1. The real address and length must be aligned on
867 * an 8K boundary.
868 */
869#define HV_FAST_MEM_SYNC 0x32
870
871/* Time of day services.
872 *
873 * The hypervisor maintains the time of day on a per-domain basis.
874 * Changing the time of day in one domain does not affect the time of
875 * day on any other domain.
876 *
877 * Time is described by a single unsigned 64-bit word which is the
878 * number of seconds since the UNIX Epoch (00:00:00 UTC, January 1,
879 * 1970).
880 */
881
882/* tod_get()
883 * TRAP: HV_FAST_TRAP
884 * FUNCTION: HV_FAST_TOD_GET
885 * RET0: status
886 * RET1: TOD
887 * ERRORS: EWOULDBLOCK TOD resource is temporarily unavailable
888 * ENOTSUPPORTED If TOD not supported on this platform
889 *
890 * Return the current time of day. May block if TOD access is
891 * temporarily not possible.
892 */
893#define HV_FAST_TOD_GET 0x50
894
895/* tod_set()
896 * TRAP: HV_FAST_TRAP
897 * FUNCTION: HV_FAST_TOD_SET
898 * ARG0: TOD
899 * RET0: status
900 * ERRORS: EWOULDBLOCK TOD resource is temporarily unavailable
901 * ENOTSUPPORTED If TOD not supported on this platform
902 *
903 * The current time of day is set to the value specified in ARG0. May
904 * block if TOD access is temporarily not possible.
905 */
906#define HV_FAST_TOD_SET 0x51
907
908/* Console services */
909
910/* con_getchar()
911 * TRAP: HV_FAST_TRAP
912 * FUNCTION: HV_FAST_CONS_GETCHAR
913 * RET0: status
914 * RET1: character
915 * ERRORS: EWOULDBLOCK No character available.
916 *
917 * Returns a character from the console device. If no character is
918 * available then an EWOULDBLOCK error is returned. If a character is
919 * available, then the returned status is EOK and the character value
920 * is in RET1.
921 *
922 * A virtual BREAK is represented by the 64-bit value -1.
923 *
924 * A virtual HUP signal is represented by the 64-bit value -2.
925 */
926#define HV_FAST_CONS_GETCHAR 0x60
927
928/* con_putchar()
929 * TRAP: HV_FAST_TRAP
930 * FUNCTION: HV_FAST_CONS_PUTCHAR
931 * ARG0: character
932 * RET0: status
933 * ERRORS: EINVAL Illegal character
934 * EWOULDBLOCK Output buffer currently full, would block
935 *
936 * Send a character to the console device. Only character values
937 * between 0 and 255 may be used. Values outside this range are
938 * invalid except for the 64-bit value -1 which is used to send a
939 * virtual BREAK.
940 */
941#define HV_FAST_CONS_PUTCHAR 0x61
942
943/* Trap trace services.
944 *
945 * The hypervisor provides a trap tracing capability for privileged
946 * code running on each virtual CPU. Privileged code provides a
947 * round-robin trap trace queue within which the hypervisor writes
948 * 64-byte entries detailing hyperprivileged traps taken n behalf of
949 * privileged code. This is provided as a debugging capability for
950 * privileged code.
951 *
952 * The trap trace control structure is 64-bytes long and placed at the
953 * start (offset 0) of the trap trace buffer, and is described as
954 * follows:
955 */
956#ifndef __ASSEMBLY__
957struct hv_trap_trace_control {
958 unsigned long head_offset;
959 unsigned long tail_offset;
960 unsigned long __reserved[0x30 / sizeof(unsigned long)];
961};
962#endif
963#define HV_TRAP_TRACE_CTRL_HEAD_OFFSET 0x00
964#define HV_TRAP_TRACE_CTRL_TAIL_OFFSET 0x08
965
966/* The head offset is the offset of the most recently completed entry
967 * in the trap-trace buffer. The tail offset is the offset of the
968 * next entry to be written. The control structure is owned and
969 * modified by the hypervisor. A guest may not modify the control
970 * structure contents. Attempts to do so will result in undefined
971 * behavior for the guest.
972 *
973 * Each trap trace buffer entry is layed out as follows:
974 */
975#ifndef __ASSEMBLY__
976struct hv_trap_trace_entry {
977 unsigned char type; /* Hypervisor or guest entry? */
978 unsigned char hpstate; /* Hyper-privileged state */
979 unsigned char tl; /* Trap level */
980 unsigned char gl; /* Global register level */
981 unsigned short tt; /* Trap type */
982 unsigned short tag; /* Extended trap identifier */
983 unsigned long tstate; /* Trap state */
984 unsigned long tick; /* Tick */
985 unsigned long tpc; /* Trap PC */
986 unsigned long f1; /* Entry specific */
987 unsigned long f2; /* Entry specific */
988 unsigned long f3; /* Entry specific */
989 unsigned long f4; /* Entry specific */
990};
991#endif
992#define HV_TRAP_TRACE_ENTRY_TYPE 0x00
993#define HV_TRAP_TRACE_ENTRY_HPSTATE 0x01
994#define HV_TRAP_TRACE_ENTRY_TL 0x02
995#define HV_TRAP_TRACE_ENTRY_GL 0x03
996#define HV_TRAP_TRACE_ENTRY_TT 0x04
997#define HV_TRAP_TRACE_ENTRY_TAG 0x06
998#define HV_TRAP_TRACE_ENTRY_TSTATE 0x08
999#define HV_TRAP_TRACE_ENTRY_TICK 0x10
1000#define HV_TRAP_TRACE_ENTRY_TPC 0x18
1001#define HV_TRAP_TRACE_ENTRY_F1 0x20
1002#define HV_TRAP_TRACE_ENTRY_F2 0x28
1003#define HV_TRAP_TRACE_ENTRY_F3 0x30
1004#define HV_TRAP_TRACE_ENTRY_F4 0x38
1005
1006/* The type field is encoded as follows. */
1007#define HV_TRAP_TYPE_UNDEF 0x00 /* Entry content undefined */
1008#define HV_TRAP_TYPE_HV 0x01 /* Hypervisor trap entry */
1009#define HV_TRAP_TYPE_GUEST 0xff /* Added via ttrace_addentry() */
1010
1011/* ttrace_buf_conf()
1012 * TRAP: HV_FAST_TRAP
1013 * FUNCTION: HV_FAST_TTRACE_BUF_CONF
1014 * ARG0: real address
1015 * ARG1: number of entries
1016 * RET0: status
1017 * RET1: number of entries
1018 * ERRORS: ENORADDR Invalid real address
1019 * EINVAL Size is too small
1020 * EBADALIGN Real address not aligned on 64-byte boundary
1021 *
1022 * Requests hypervisor trap tracing and declares a virtual CPU's trap
1023 * trace buffer to the hypervisor. The real address supplies the real
1024 * base address of the trap trace queue and must be 64-byte aligned.
1025 * Specifying a value of 0 for the number of entries disables trap
1026 * tracing for the calling virtual CPU. The buffer allocated must be
1027 * sized for a power of two number of 64-byte trap trace entries plus
1028 * an initial 64-byte control structure.
1029 *
1030 * This may be invoked any number of times so that a virtual CPU may
1031 * relocate a trap trace buffer or create "snapshots" of information.
1032 *
1033 * If the real address is illegal or badly aligned, then trap tracing
1034 * is disabled and an error is returned.
1035 *
1036 * Upon failure with EINVAL, this service call returns in RET1 the
1037 * minimum number of buffer entries required. Upon other failures
1038 * RET1 is undefined.
1039 */
1040#define HV_FAST_TTRACE_BUF_CONF 0x90
1041
1042/* ttrace_buf_info()
1043 * TRAP: HV_FAST_TRAP
1044 * FUNCTION: HV_FAST_TTRACE_BUF_INFO
1045 * RET0: status
1046 * RET1: real address
1047 * RET2: size
1048 * ERRORS: None defined.
1049 *
1050 * Returns the size and location of the previously declared trap-trace
1051 * buffer. In the event that no buffer was previously defined, or the
1052 * buffer is disabled, this call will return a size of zero bytes.
1053 */
1054#define HV_FAST_TTRACE_BUF_INFO 0x91
1055
1056/* ttrace_enable()
1057 * TRAP: HV_FAST_TRAP
1058 * FUNCTION: HV_FAST_TTRACE_ENABLE
1059 * ARG0: enable
1060 * RET0: status
1061 * RET1: previous enable state
1062 * ERRORS: EINVAL No trap trace buffer currently defined
1063 *
1064 * Enable or disable trap tracing, and return the previous enabled
1065 * state in RET1. Future systems may define various flags for the
1066 * enable argument (ARG0), for the moment a guest should pass
1067 * "(uint64_t) -1" to enable, and "(uint64_t) 0" to disable all
1068 * tracing - which will ensure future compatability.
1069 */
1070#define HV_FAST_TTRACE_ENABLE 0x92
1071
1072/* ttrace_freeze()
1073 * TRAP: HV_FAST_TRAP
1074 * FUNCTION: HV_FAST_TTRACE_FREEZE
1075 * ARG0: freeze
1076 * RET0: status
1077 * RET1: previous freeze state
1078 * ERRORS: EINVAL No trap trace buffer currently defined
1079 *
1080 * Freeze or unfreeze trap tracing, returning the previous freeze
1081 * state in RET1. A guest should pass a non-zero value to freeze and
1082 * a zero value to unfreeze all tracing. The returned previous state
1083 * is 0 for not frozen and 1 for frozen.
1084 */
1085#define HV_FAST_TTRACE_FREEZE 0x93
1086
1087/* ttrace_addentry()
1088 * TRAP: HV_TTRACE_ADDENTRY_TRAP
1089 * ARG0: tag (16-bits)
1090 * ARG1: data word 0
1091 * ARG2: data word 1
1092 * ARG3: data word 2
1093 * ARG4: data word 3
1094 * RET0: status
1095 * ERRORS: EINVAL No trap trace buffer currently defined
1096 *
1097 * Add an entry to the trap trace buffer. Upon return only ARG0/RET0
1098 * is modified - none of the other registers holding arguments are
1099 * volatile across this hypervisor service.
1100 */
1101
1102/* Core dump services.
1103 *
1104 * Since the hypervisor viraulizes and thus obscures a lot of the
1105 * physical machine layout and state, traditional OS crash dumps can
1106 * be difficult to diagnose especially when the problem is a
1107 * configuration error of some sort.
1108 *
1109 * The dump services provide an opaque buffer into which the
1110 * hypervisor can place it's internal state in order to assist in
1111 * debugging such situations. The contents are opaque and extremely
1112 * platform and hypervisor implementation specific. The guest, during
1113 * a core dump, requests that the hypervisor update any information in
1114 * the dump buffer in preparation to being dumped as part of the
1115 * domain's memory image.
1116 */
1117
1118/* dump_buf_update()
1119 * TRAP: HV_FAST_TRAP
1120 * FUNCTION: HV_FAST_DUMP_BUF_UPDATE
1121 * ARG0: real address
1122 * ARG1: size
1123 * RET0: status
1124 * RET1: required size of dump buffer
1125 * ERRORS: ENORADDR Invalid real address
1126 * EBADALIGN Real address is not aligned on a 64-byte
1127 * boundary
1128 * EINVAL Size is non-zero but less than minimum size
1129 * required
1130 * ENOTSUPPORTED Operation not supported on current logical
1131 * domain
1132 *
1133 * Declare a domain dump buffer to the hypervisor. The real address
1134 * provided for the domain dump buffer must be 64-byte aligned. The
1135 * size specifies the size of the dump buffer and may be larger than
1136 * the minimum size specified in the machine description. The
1137 * hypervisor will fill the dump buffer with opaque data.
1138 *
1139 * Note: A guest may elect to include dump buffer contents as part of a crash
1140 * dump to assist with debugging. This function may be called any number
1141 * of times so that a guest may relocate a dump buffer, or create
1142 * "snapshots" of any dump-buffer information. Each call to
1143 * dump_buf_update() atomically declares the new dump buffer to the
1144 * hypervisor.
1145 *
1146 * A specified size of 0 unconfigures the dump buffer. If the real
1147 * address is illegal or badly aligned, then any currently active dump
1148 * buffer is disabled and an error is returned.
1149 *
1150 * In the event that the call fails with EINVAL, RET1 contains the
1151 * minimum size requires by the hypervisor for a valid dump buffer.
1152 */
1153#define HV_FAST_DUMP_BUF_UPDATE 0x94
1154
1155/* dump_buf_info()
1156 * TRAP: HV_FAST_TRAP
1157 * FUNCTION: HV_FAST_DUMP_BUF_INFO
1158 * RET0: status
1159 * RET1: real address of current dump buffer
1160 * RET2: size of current dump buffer
1161 * ERRORS: No errors defined.
1162 *
1163 * Return the currently configures dump buffer description. A
1164 * returned size of 0 bytes indicates an undefined dump buffer. In
1165 * this case the return address in RET1 is undefined.
1166 */
1167#define HV_FAST_DUMP_BUF_INFO 0x95
1168
1169/* Device interrupt services.
1170 *
1171 * Device interrupts are allocated to system bus bridges by the hypervisor,
1172 * and described to OBP in the machine description. OBP then describes
1173 * these interrupts to the OS via properties in the device tree.
1174 *
1175 * Terminology:
1176 *
1177 * cpuid Unique opaque value which represents a target cpu.
1178 *
1179 * devhandle Device handle. It uniquely identifies a device, and
1180 * consistes of the lower 28-bits of the hi-cell of the
1181 * first entry of the device's "reg" property in the
1182 * OBP device tree.
1183 *
1184 * devino Device interrupt number. Specifies the relative
1185 * interrupt number within the device. The unique
1186 * combination of devhandle and devino are used to
1187 * identify a specific device interrupt.
1188 *
1189 * Note: The devino value is the same as the values in the
1190 * "interrupts" property or "interrupt-map" property
1191 * in the OBP device tree for that device.
1192 *
1193 * sysino System interrupt number. A 64-bit unsigned interger
1194 * representing a unique interrupt within a virtual
1195 * machine.
1196 *
1197 * intr_state A flag representing the interrupt state for a given
1198 * sysino. The state values are defined below.
1199 *
1200 * intr_enabled A flag representing the 'enabled' state for a given
1201 * sysino. The enable values are defined below.
1202 */
1203
1204#define HV_INTR_STATE_IDLE 0 /* Nothing pending */
1205#define HV_INTR_STATE_RECEIVED 1 /* Interrupt received by hardware */
1206#define HV_INTR_STATE_DELIVERED 2 /* Interrupt delivered to queue */
1207
1208#define HV_INTR_DISABLED 0 /* sysino not enabled */
1209#define HV_INTR_ENABLED 1 /* sysino enabled */
1210
1211/* intr_devino_to_sysino()
1212 * TRAP: HV_FAST_TRAP
1213 * FUNCTION: HV_FAST_INTR_DEVINO2SYSINO
1214 * ARG0: devhandle
1215 * ARG1: devino
1216 * RET0: status
1217 * RET1: sysino
1218 * ERRORS: EINVAL Invalid devhandle/devino
1219 *
1220 * Converts a device specific interrupt number of the given
1221 * devhandle/devino into a system specific ino (sysino).
1222 */
1223#define HV_FAST_INTR_DEVINO2SYSINO 0xa0
1224
1225#ifndef __ASSEMBLY__
1226extern unsigned long sun4v_devino_to_sysino(unsigned long devhandle,
1227 unsigned long devino);
1228#endif
1229
1230/* intr_getenabled()
1231 * TRAP: HV_FAST_TRAP
1232 * FUNCTION: HV_FAST_INTR_GETENABLED
1233 * ARG0: sysino
1234 * RET0: status
1235 * RET1: intr_enabled (HV_INTR_{DISABLED,ENABLED})
1236 * ERRORS: EINVAL Invalid sysino
1237 *
1238 * Returns interrupt enabled state in RET1 for the interrupt defined
1239 * by the given sysino.
1240 */
1241#define HV_FAST_INTR_GETENABLED 0xa1
1242
1243#ifndef __ASSEMBLY__
1244extern unsigned long sun4v_intr_getenabled(unsigned long sysino);
1245#endif
1246
1247/* intr_setenabled()
1248 * TRAP: HV_FAST_TRAP
1249 * FUNCTION: HV_FAST_INTR_SETENABLED
1250 * ARG0: sysino
1251 * ARG1: intr_enabled (HV_INTR_{DISABLED,ENABLED})
1252 * RET0: status
1253 * ERRORS: EINVAL Invalid sysino or intr_enabled value
1254 *
1255 * Set the 'enabled' state of the interrupt sysino.
1256 */
1257#define HV_FAST_INTR_SETENABLED 0xa2
1258
1259#ifndef __ASSEMBLY__
1260extern unsigned long sun4v_intr_setenabled(unsigned long sysino, unsigned long intr_enabled);
1261#endif
1262
1263/* intr_getstate()
1264 * TRAP: HV_FAST_TRAP
1265 * FUNCTION: HV_FAST_INTR_GETSTATE
1266 * ARG0: sysino
1267 * RET0: status
1268 * RET1: intr_state (HV_INTR_STATE_*)
1269 * ERRORS: EINVAL Invalid sysino
1270 *
1271 * Returns current state of the interrupt defined by the given sysino.
1272 */
1273#define HV_FAST_INTR_GETSTATE 0xa3
1274
1275#ifndef __ASSEMBLY__
1276extern unsigned long sun4v_intr_getstate(unsigned long sysino);
1277#endif
1278
1279/* intr_setstate()
1280 * TRAP: HV_FAST_TRAP
1281 * FUNCTION: HV_FAST_INTR_SETSTATE
1282 * ARG0: sysino
1283 * ARG1: intr_state (HV_INTR_STATE_*)
1284 * RET0: status
1285 * ERRORS: EINVAL Invalid sysino or intr_state value
1286 *
1287 * Sets the current state of the interrupt described by the given sysino
1288 * value.
1289 *
1290 * Note: Setting the state to HV_INTR_STATE_IDLE clears any pending
1291 * interrupt for sysino.
1292 */
1293#define HV_FAST_INTR_SETSTATE 0xa4
1294
1295#ifndef __ASSEMBLY__
1296extern unsigned long sun4v_intr_setstate(unsigned long sysino, unsigned long intr_state);
1297#endif
1298
1299/* intr_gettarget()
1300 * TRAP: HV_FAST_TRAP
1301 * FUNCTION: HV_FAST_INTR_GETTARGET
1302 * ARG0: sysino
1303 * RET0: status
1304 * RET1: cpuid
1305 * ERRORS: EINVAL Invalid sysino
1306 *
1307 * Returns CPU that is the current target of the interrupt defined by
1308 * the given sysino. The CPU value returned is undefined if the target
1309 * has not been set via intr_settarget().
1310 */
1311#define HV_FAST_INTR_GETTARGET 0xa5
1312
1313#ifndef __ASSEMBLY__
1314extern unsigned long sun4v_intr_gettarget(unsigned long sysino);
1315#endif
1316
1317/* intr_settarget()
1318 * TRAP: HV_FAST_TRAP
1319 * FUNCTION: HV_FAST_INTR_SETTARGET
1320 * ARG0: sysino
1321 * ARG1: cpuid
1322 * RET0: status
1323 * ERRORS: EINVAL Invalid sysino
1324 * ENOCPU Invalid cpuid
1325 *
1326 * Set the target CPU for the interrupt defined by the given sysino.
1327 */
1328#define HV_FAST_INTR_SETTARGET 0xa6
1329
1330#ifndef __ASSEMBLY__
1331extern unsigned long sun4v_intr_settarget(unsigned long sysino, unsigned long cpuid);
1332#endif
1333
1334/* PCI IO services.
1335 *
1336 * See the terminology descriptions in the device interrupt services
1337 * section above as those apply here too. Here are terminology
1338 * definitions specific to these PCI IO services:
1339 *
1340 * tsbnum TSB number. Indentifies which io-tsb is used.
1341 * For this version of the specification, tsbnum
1342 * must be zero.
1343 *
1344 * tsbindex TSB index. Identifies which entry in the TSB
1345 * is used. The first entry is zero.
1346 *
1347 * tsbid A 64-bit aligned data structure which contains
1348 * a tsbnum and a tsbindex. Bits 63:32 contain the
1349 * tsbnum and bits 31:00 contain the tsbindex.
1350 *
1351 * Use the HV_PCI_TSBID() macro to construct such
1352 * values.
1353 *
1354 * io_attributes IO attributes for IOMMU mappings. One of more
1355 * of the attritbute bits are stores in a 64-bit
1356 * value. The values are defined below.
1357 *
1358 * r_addr 64-bit real address
1359 *
1360 * pci_device PCI device address. A PCI device address identifies
1361 * a specific device on a specific PCI bus segment.
1362 * A PCI device address ia a 32-bit unsigned integer
1363 * with the following format:
1364 *
1365 * 00000000.bbbbbbbb.dddddfff.00000000
1366 *
1367 * Use the HV_PCI_DEVICE_BUILD() macro to construct
1368 * such values.
1369 *
1370 * pci_config_offset
1371 * PCI configureation space offset. For conventional
1372 * PCI a value between 0 and 255. For extended
1373 * configuration space, a value between 0 and 4095.
1374 *
1375 * Note: For PCI configuration space accesses, the offset
1376 * must be aligned to the access size.
1377 *
1378 * error_flag A return value which specifies if the action succeeded
1379 * or failed. 0 means no error, non-0 means some error
1380 * occurred while performing the service.
1381 *
1382 * io_sync_direction
1383 * Direction definition for pci_dma_sync(), defined
1384 * below in HV_PCI_SYNC_*.
1385 *
1386 * io_page_list A list of io_page_addresses, an io_page_address is
1387 * a real address.
1388 *
1389 * io_page_list_p A pointer to an io_page_list.
1390 *
1391 * "size based byte swap" - Some functions do size based byte swapping
1392 * which allows sw to access pointers and
1393 * counters in native form when the processor
1394 * operates in a different endianness than the
1395 * IO bus. Size-based byte swapping converts a
1396 * multi-byte field between big-endian and
1397 * little-endian format.
1398 */
1399
1400#define HV_PCI_MAP_ATTR_READ 0x01
1401#define HV_PCI_MAP_ATTR_WRITE 0x02
1402
1403#define HV_PCI_DEVICE_BUILD(b,d,f) \
1404 ((((b) & 0xff) << 16) | \
1405 (((d) & 0x1f) << 11) | \
1406 (((f) & 0x07) << 8))
1407
1408#define HV_PCI_TSBID(__tsb_num, __tsb_index) \
1409 ((((u64)(__tsb_num)) << 32UL) | ((u64)(__tsb_index)))
1410
1411#define HV_PCI_SYNC_FOR_DEVICE 0x01
1412#define HV_PCI_SYNC_FOR_CPU 0x02
1413
1414/* pci_iommu_map()
1415 * TRAP: HV_FAST_TRAP
1416 * FUNCTION: HV_FAST_PCI_IOMMU_MAP
1417 * ARG0: devhandle
1418 * ARG1: tsbid
1419 * ARG2: #ttes
1420 * ARG3: io_attributes
1421 * ARG4: io_page_list_p
1422 * RET0: status
1423 * RET1: #ttes mapped
1424 * ERRORS: EINVAL Invalid devhandle/tsbnum/tsbindex/io_attributes
1425 * EBADALIGN Improperly aligned real address
1426 * ENORADDR Invalid real address
1427 *
1428 * Create IOMMU mappings in the sun4v device defined by the given
1429 * devhandle. The mappings are created in the TSB defined by the
1430 * tsbnum component of the given tsbid. The first mapping is created
1431 * in the TSB i ndex defined by the tsbindex component of the given tsbid.
1432 * The call creates up to #ttes mappings, the first one at tsbnum, tsbindex,
1433 * the second at tsbnum, tsbindex + 1, etc.
1434 *
1435 * All mappings are created with the attributes defined by the io_attributes
1436 * argument. The page mapping addresses are described in the io_page_list
1437 * defined by the given io_page_list_p, which is a pointer to the io_page_list.
1438 * The first entry in the io_page_list is the address for the first iotte, the
1439 * 2nd for the 2nd iotte, and so on.
1440 *
1441 * Each io_page_address in the io_page_list must be appropriately aligned.
1442 * #ttes must be greater than zero. For this version of the spec, the tsbnum
1443 * component of the given tsbid must be zero.
1444 *
1445 * Returns the actual number of mappings creates, which may be less than
1446 * or equal to the argument #ttes. If the function returns a value which
1447 * is less than the #ttes, the caller may continus to call the function with
1448 * an updated tsbid, #ttes, io_page_list_p arguments until all pages are
1449 * mapped.
1450 *
1451 * Note: This function does not imply an iotte cache flush. The guest must
1452 * demap an entry before re-mapping it.
1453 */
1454#define HV_FAST_PCI_IOMMU_MAP 0xb0
1455
1456/* pci_iommu_demap()
1457 * TRAP: HV_FAST_TRAP
1458 * FUNCTION: HV_FAST_PCI_IOMMU_DEMAP
1459 * ARG0: devhandle
1460 * ARG1: tsbid
1461 * ARG2: #ttes
1462 * RET0: status
1463 * RET1: #ttes demapped
1464 * ERRORS: EINVAL Invalid devhandle/tsbnum/tsbindex
1465 *
1466 * Demap and flush IOMMU mappings in the device defined by the given
1467 * devhandle. Demaps up to #ttes entries in the TSB defined by the tsbnum
1468 * component of the given tsbid, starting at the TSB index defined by the
1469 * tsbindex component of the given tsbid.
1470 *
1471 * For this version of the spec, the tsbnum of the given tsbid must be zero.
1472 * #ttes must be greater than zero.
1473 *
1474 * Returns the actual number of ttes demapped, which may be less than or equal
1475 * to the argument #ttes. If #ttes demapped is less than #ttes, the caller
1476 * may continue to call this function with updated tsbid and #ttes arguments
1477 * until all pages are demapped.
1478 *
1479 * Note: Entries do not have to be mapped to be demapped. A demap of an
1480 * unmapped page will flush the entry from the tte cache.
1481 */
1482#define HV_FAST_PCI_IOMMU_DEMAP 0xb1
1483
1484/* pci_iommu_getmap()
1485 * TRAP: HV_FAST_TRAP
1486 * FUNCTION: HV_FAST_PCI_IOMMU_GETMAP
1487 * ARG0: devhandle
1488 * ARG1: tsbid
1489 * RET0: status
1490 * RET1: io_attributes
1491 * RET2: real address
1492 * ERRORS: EINVAL Invalid devhandle/tsbnum/tsbindex
1493 * ENOMAP Mapping is not valid, no translation exists
1494 *
1495 * Read and return the mapping in the device described by the given devhandle
1496 * and tsbid. If successful, the io_attributes shall be returned in RET1
1497 * and the page address of the mapping shall be returned in RET2.
1498 *
1499 * For this version of the spec, the tsbnum component of the given tsbid
1500 * must be zero.
1501 */
1502#define HV_FAST_PCI_IOMMU_GETMAP 0xb2
1503
1504/* pci_iommu_getbypass()
1505 * TRAP: HV_FAST_TRAP
1506 * FUNCTION: HV_FAST_PCI_IOMMU_GETBYPASS
1507 * ARG0: devhandle
1508 * ARG1: real address
1509 * ARG2: io_attributes
1510 * RET0: status
1511 * RET1: io_addr
1512 * ERRORS: EINVAL Invalid devhandle/io_attributes
1513 * ENORADDR Invalid real address
1514 * ENOTSUPPORTED Function not supported in this implementation.
1515 *
1516 * Create a "special" mapping in the device described by the given devhandle,
1517 * for the given real address and attributes. Return the IO address in RET1
1518 * if successful.
1519 */
1520#define HV_FAST_PCI_IOMMU_GETBYPASS 0xb3
1521
1522/* pci_config_get()
1523 * TRAP: HV_FAST_TRAP
1524 * FUNCTION: HV_FAST_PCI_CONFIG_GET
1525 * ARG0: devhandle
1526 * ARG1: pci_device
1527 * ARG2: pci_config_offset
1528 * ARG3: size
1529 * RET0: status
1530 * RET1: error_flag
1531 * RET2: data
1532 * ERRORS: EINVAL Invalid devhandle/pci_device/offset/size
1533 * EBADALIGN pci_config_offset not size aligned
1534 * ENOACCESS Access to this offset is not permitted
1535 *
1536 * Read PCI configuration space for the adapter described by the given
1537 * devhandle. Read size (1, 2, or 4) bytes of data from the given
1538 * pci_device, at pci_config_offset from the beginning of the device's
1539 * configuration space. If there was no error, RET1 is set to zero and
1540 * RET2 is set to the data read. Insignificant bits in RET2 are not
1541 * guarenteed to have any specific value and therefore must be ignored.
1542 *
1543 * The data returned in RET2 is size based byte swapped.
1544 *
1545 * If an error occurs during the read, set RET1 to a non-zero value. The
1546 * given pci_config_offset must be 'size' aligned.
1547 */
1548#define HV_FAST_PCI_CONFIG_GET 0xb4
1549
1550/* pci_config_put()
1551 * TRAP: HV_FAST_TRAP
1552 * FUNCTION: HV_FAST_PCI_CONFIG_PUT
1553 * ARG0: devhandle
1554 * ARG1: pci_device
1555 * ARG2: pci_config_offset
1556 * ARG3: size
1557 * ARG4: data
1558 * RET0: status
1559 * RET1: error_flag
1560 * ERRORS: EINVAL Invalid devhandle/pci_device/offset/size
1561 * EBADALIGN pci_config_offset not size aligned
1562 * ENOACCESS Access to this offset is not permitted
1563 *
1564 * Write PCI configuration space for the adapter described by the given
1565 * devhandle. Write size (1, 2, or 4) bytes of data in a single operation,
1566 * at pci_config_offset from the beginning of the device's configuration
1567 * space. The data argument contains the data to be written to configuration
1568 * space. Prior to writing, the data is size based byte swapped.
1569 *
1570 * If an error occurs during the write access, do not generate an error
1571 * report, do set RET1 to a non-zero value. Otherwise RET1 is zero.
1572 * The given pci_config_offset must be 'size' aligned.
1573 *
1574 * This function is permitted to read from offset zero in the configuration
1575 * space described by the given pci_device if necessary to ensure that the
1576 * write access to config space completes.
1577 */
1578#define HV_FAST_PCI_CONFIG_PUT 0xb5
1579
1580/* pci_peek()
1581 * TRAP: HV_FAST_TRAP
1582 * FUNCTION: HV_FAST_PCI_PEEK
1583 * ARG0: devhandle
1584 * ARG1: real address
1585 * ARG2: size
1586 * RET0: status
1587 * RET1: error_flag
1588 * RET2: data
1589 * ERRORS: EINVAL Invalid devhandle or size
1590 * EBADALIGN Improperly aligned real address
1591 * ENORADDR Bad real address
1592 * ENOACCESS Guest access prohibited
1593 *
1594 * Attempt to read the IO address given by the given devhandle, real address,
1595 * and size. Size must be 1, 2, 4, or 8. The read is performed as a single
1596 * access operation using the given size. If an error occurs when reading
1597 * from the given location, do not generate an error report, but return a
1598 * non-zero value in RET1. If the read was successful, return zero in RET1
1599 * and return the actual data read in RET2. The data returned is size based
1600 * byte swapped.
1601 *
1602 * Non-significant bits in RET2 are not guarenteed to have any specific value
1603 * and therefore must be ignored. If RET1 is returned as non-zero, the data
1604 * value is not guarenteed to have any specific value and should be ignored.
1605 *
1606 * The caller must have permission to read from the given devhandle, real
1607 * address, which must be an IO address. The argument real address must be a
1608 * size aligned address.
1609 *
1610 * The hypervisor implementation of this function must block access to any
1611 * IO address that the guest does not have explicit permission to access.
1612 */
1613#define HV_FAST_PCI_PEEK 0xb6
1614
1615/* pci_poke()
1616 * TRAP: HV_FAST_TRAP
1617 * FUNCTION: HV_FAST_PCI_POKE
1618 * ARG0: devhandle
1619 * ARG1: real address
1620 * ARG2: size
1621 * ARG3: data
1622 * ARG4: pci_device
1623 * RET0: status
1624 * RET1: error_flag
1625 * ERRORS: EINVAL Invalid devhandle, size, or pci_device
1626 * EBADALIGN Improperly aligned real address
1627 * ENORADDR Bad real address
1628 * ENOACCESS Guest access prohibited
1629 * ENOTSUPPORTED Function is not supported by implementation
1630 *
1631 * Attempt to write data to the IO address given by the given devhandle,
1632 * real address, and size. Size must be 1, 2, 4, or 8. The write is
1633 * performed as a single access operation using the given size. Prior to
1634 * writing the data is size based swapped.
1635 *
1636 * If an error occurs when writing to the given location, do not generate an
1637 * error report, but return a non-zero value in RET1. If the write was
1638 * successful, return zero in RET1.
1639 *
1640 * pci_device describes the configuration address of the device being
1641 * written to. The implementation may safely read from offset 0 with
1642 * the configuration space of the device described by devhandle and
1643 * pci_device in order to guarantee that the write portion of the operation
1644 * completes
1645 *
1646 * Any error that occurs due to the read shall be reported using the normal
1647 * error reporting mechanisms .. the read error is not suppressed.
1648 *
1649 * The caller must have permission to write to the given devhandle, real
1650 * address, which must be an IO address. The argument real address must be a
1651 * size aligned address. The caller must have permission to read from
1652 * the given devhandle, pci_device cofiguration space offset 0.
1653 *
1654 * The hypervisor implementation of this function must block access to any
1655 * IO address that the guest does not have explicit permission to access.
1656 */
1657#define HV_FAST_PCI_POKE 0xb7
1658
1659/* pci_dma_sync()
1660 * TRAP: HV_FAST_TRAP
1661 * FUNCTION: HV_FAST_PCI_DMA_SYNC
1662 * ARG0: devhandle
1663 * ARG1: real address
1664 * ARG2: size
1665 * ARG3: io_sync_direction
1666 * RET0: status
1667 * RET1: #synced
1668 * ERRORS: EINVAL Invalid devhandle or io_sync_direction
1669 * ENORADDR Bad real address
1670 *
1671 * Synchronize a memory region described by the given real address and size,
1672 * for the device defined by the given devhandle using the direction(s)
1673 * defined by the given io_sync_direction. The argument size is the size of
1674 * the memory region in bytes.
1675 *
1676 * Return the actual number of bytes synchronized in the return value #synced,
1677 * which may be less than or equal to the argument size. If the return
1678 * value #synced is less than size, the caller must continue to call this
1679 * function with updated real address and size arguments until the entire
1680 * memory region is synchronized.
1681 */
1682#define HV_FAST_PCI_DMA_SYNC 0xb8
1683
1684/* PCI MSI services. */
1685
1686#define HV_MSITYPE_MSI32 0x00
1687#define HV_MSITYPE_MSI64 0x01
1688
1689#define HV_MSIQSTATE_IDLE 0x00
1690#define HV_MSIQSTATE_ERROR 0x01
1691
1692#define HV_MSIQ_INVALID 0x00
1693#define HV_MSIQ_VALID 0x01
1694
1695#define HV_MSISTATE_IDLE 0x00
1696#define HV_MSISTATE_DELIVERED 0x01
1697
1698#define HV_MSIVALID_INVALID 0x00
1699#define HV_MSIVALID_VALID 0x01
1700
1701#define HV_PCIE_MSGTYPE_PME_MSG 0x18
1702#define HV_PCIE_MSGTYPE_PME_ACK_MSG 0x1b
1703#define HV_PCIE_MSGTYPE_CORR_MSG 0x30
1704#define HV_PCIE_MSGTYPE_NONFATAL_MSG 0x31
1705#define HV_PCIE_MSGTYPE_FATAL_MSG 0x33
1706
1707#define HV_MSG_INVALID 0x00
1708#define HV_MSG_VALID 0x01
1709
1710/* pci_msiq_conf()
1711 * TRAP: HV_FAST_TRAP
1712 * FUNCTION: HV_FAST_PCI_MSIQ_CONF
1713 * ARG0: devhandle
1714 * ARG1: msiqid
1715 * ARG2: real address
1716 * ARG3: number of entries
1717 * RET0: status
1718 * ERRORS: EINVAL Invalid devhandle, msiqid or nentries
1719 * EBADALIGN Improperly aligned real address
1720 * ENORADDR Bad real address
1721 *
1722 * Configure the MSI queue given by the devhandle and msiqid arguments,
1723 * and to be placed at the given real address and be of the given
1724 * number of entries. The real address must be aligned exactly to match
1725 * the queue size. Each queue entry is 64-bytes long, so f.e. a 32 entry
1726 * queue must be aligned on a 2048 byte real address boundary. The MSI-EQ
1727 * Head and Tail are initialized so that the MSI-EQ is 'empty'.
1728 *
1729 * Implementation Note: Certain implementations have fixed sized queues. In
1730 * that case, number of entries must contain the correct
1731 * value.
1732 */
1733#define HV_FAST_PCI_MSIQ_CONF 0xc0
1734
1735/* pci_msiq_info()
1736 * TRAP: HV_FAST_TRAP
1737 * FUNCTION: HV_FAST_PCI_MSIQ_INFO
1738 * ARG0: devhandle
1739 * ARG1: msiqid
1740 * RET0: status
1741 * RET1: real address
1742 * RET2: number of entries
1743 * ERRORS: EINVAL Invalid devhandle or msiqid
1744 *
1745 * Return the configuration information for the MSI queue described
1746 * by the given devhandle and msiqid. The base address of the queue
1747 * is returned in ARG1 and the number of entries is returned in ARG2.
1748 * If the queue is unconfigured, the real address is undefined and the
1749 * number of entries will be returned as zero.
1750 */
1751#define HV_FAST_PCI_MSIQ_INFO 0xc1
1752
1753/* pci_msiq_getvalid()
1754 * TRAP: HV_FAST_TRAP
1755 * FUNCTION: HV_FAST_PCI_MSIQ_GETVALID
1756 * ARG0: devhandle
1757 * ARG1: msiqid
1758 * RET0: status
1759 * RET1: msiqvalid (HV_MSIQ_VALID or HV_MSIQ_INVALID)
1760 * ERRORS: EINVAL Invalid devhandle or msiqid
1761 *
1762 * Get the valid state of the MSI-EQ described by the given devhandle and
1763 * msiqid.
1764 */
1765#define HV_FAST_PCI_MSIQ_GETVALID 0xc2
1766
1767/* pci_msiq_setvalid()
1768 * TRAP: HV_FAST_TRAP
1769 * FUNCTION: HV_FAST_PCI_MSIQ_SETVALID
1770 * ARG0: devhandle
1771 * ARG1: msiqid
1772 * ARG2: msiqvalid (HV_MSIQ_VALID or HV_MSIQ_INVALID)
1773 * RET0: status
1774 * ERRORS: EINVAL Invalid devhandle or msiqid or msiqvalid
1775 * value or MSI EQ is uninitialized
1776 *
1777 * Set the valid state of the MSI-EQ described by the given devhandle and
1778 * msiqid to the given msiqvalid.
1779 */
1780#define HV_FAST_PCI_MSIQ_SETVALID 0xc3
1781
1782/* pci_msiq_getstate()
1783 * TRAP: HV_FAST_TRAP
1784 * FUNCTION: HV_FAST_PCI_MSIQ_GETSTATE
1785 * ARG0: devhandle
1786 * ARG1: msiqid
1787 * RET0: status
1788 * RET1: msiqstate (HV_MSIQSTATE_IDLE or HV_MSIQSTATE_ERROR)
1789 * ERRORS: EINVAL Invalid devhandle or msiqid
1790 *
1791 * Get the state of the MSI-EQ described by the given devhandle and
1792 * msiqid.
1793 */
1794#define HV_FAST_PCI_MSIQ_GETSTATE 0xc4
1795
1796/* pci_msiq_getvalid()
1797 * TRAP: HV_FAST_TRAP
1798 * FUNCTION: HV_FAST_PCI_MSIQ_GETVALID
1799 * ARG0: devhandle
1800 * ARG1: msiqid
1801 * ARG2: msiqstate (HV_MSIQSTATE_IDLE or HV_MSIQSTATE_ERROR)
1802 * RET0: status
1803 * ERRORS: EINVAL Invalid devhandle or msiqid or msiqstate
1804 * value or MSI EQ is uninitialized
1805 *
1806 * Set the state of the MSI-EQ described by the given devhandle and
1807 * msiqid to the given msiqvalid.
1808 */
1809#define HV_FAST_PCI_MSIQ_SETSTATE 0xc5
1810
1811/* pci_msiq_gethead()
1812 * TRAP: HV_FAST_TRAP
1813 * FUNCTION: HV_FAST_PCI_MSIQ_GETHEAD
1814 * ARG0: devhandle
1815 * ARG1: msiqid
1816 * RET0: status
1817 * RET1: msiqhead
1818 * ERRORS: EINVAL Invalid devhandle or msiqid
1819 *
1820 * Get the current MSI EQ queue head for the MSI-EQ described by the
1821 * given devhandle and msiqid.
1822 */
1823#define HV_FAST_PCI_MSIQ_GETHEAD 0xc6
1824
1825/* pci_msiq_sethead()
1826 * TRAP: HV_FAST_TRAP
1827 * FUNCTION: HV_FAST_PCI_MSIQ_SETHEAD
1828 * ARG0: devhandle
1829 * ARG1: msiqid
1830 * ARG2: msiqhead
1831 * RET0: status
1832 * ERRORS: EINVAL Invalid devhandle or msiqid or msiqhead,
1833 * or MSI EQ is uninitialized
1834 *
1835 * Set the current MSI EQ queue head for the MSI-EQ described by the
1836 * given devhandle and msiqid.
1837 */
1838#define HV_FAST_PCI_MSIQ_SETHEAD 0xc7
1839
1840/* pci_msiq_gettail()
1841 * TRAP: HV_FAST_TRAP
1842 * FUNCTION: HV_FAST_PCI_MSIQ_GETTAIL
1843 * ARG0: devhandle
1844 * ARG1: msiqid
1845 * RET0: status
1846 * RET1: msiqtail
1847 * ERRORS: EINVAL Invalid devhandle or msiqid
1848 *
1849 * Get the current MSI EQ queue tail for the MSI-EQ described by the
1850 * given devhandle and msiqid.
1851 */
1852#define HV_FAST_PCI_MSIQ_GETTAIL 0xc8
1853
1854/* pci_msi_getvalid()
1855 * TRAP: HV_FAST_TRAP
1856 * FUNCTION: HV_FAST_PCI_MSI_GETVALID
1857 * ARG0: devhandle
1858 * ARG1: msinum
1859 * RET0: status
1860 * RET1: msivalidstate
1861 * ERRORS: EINVAL Invalid devhandle or msinum
1862 *
1863 * Get the current valid/enabled state for the MSI defined by the
1864 * given devhandle and msinum.
1865 */
1866#define HV_FAST_PCI_MSI_GETVALID 0xc9
1867
1868/* pci_msi_setvalid()
1869 * TRAP: HV_FAST_TRAP
1870 * FUNCTION: HV_FAST_PCI_MSI_SETVALID
1871 * ARG0: devhandle
1872 * ARG1: msinum
1873 * ARG2: msivalidstate
1874 * RET0: status
1875 * ERRORS: EINVAL Invalid devhandle or msinum or msivalidstate
1876 *
1877 * Set the current valid/enabled state for the MSI defined by the
1878 * given devhandle and msinum.
1879 */
1880#define HV_FAST_PCI_MSI_SETVALID 0xca
1881
1882/* pci_msi_getmsiq()
1883 * TRAP: HV_FAST_TRAP
1884 * FUNCTION: HV_FAST_PCI_MSI_GETMSIQ
1885 * ARG0: devhandle
1886 * ARG1: msinum
1887 * RET0: status
1888 * RET1: msiqid
1889 * ERRORS: EINVAL Invalid devhandle or msinum or MSI is unbound
1890 *
1891 * Get the MSI EQ that the MSI defined by the given devhandle and
1892 * msinum is bound to.
1893 */
1894#define HV_FAST_PCI_MSI_GETMSIQ 0xcb
1895
1896/* pci_msi_setmsiq()
1897 * TRAP: HV_FAST_TRAP
1898 * FUNCTION: HV_FAST_PCI_MSI_SETMSIQ
1899 * ARG0: devhandle
1900 * ARG1: msinum
1901 * ARG2: msitype
1902 * ARG3: msiqid
1903 * RET0: status
1904 * ERRORS: EINVAL Invalid devhandle or msinum or msiqid
1905 *
1906 * Set the MSI EQ that the MSI defined by the given devhandle and
1907 * msinum is bound to.
1908 */
1909#define HV_FAST_PCI_MSI_SETMSIQ 0xcc
1910
1911/* pci_msi_getstate()
1912 * TRAP: HV_FAST_TRAP
1913 * FUNCTION: HV_FAST_PCI_MSI_GETSTATE
1914 * ARG0: devhandle
1915 * ARG1: msinum
1916 * RET0: status
1917 * RET1: msistate
1918 * ERRORS: EINVAL Invalid devhandle or msinum
1919 *
1920 * Get the state of the MSI defined by the given devhandle and msinum.
1921 * If not initialized, return HV_MSISTATE_IDLE.
1922 */
1923#define HV_FAST_PCI_MSI_GETSTATE 0xcd
1924
1925/* pci_msi_setstate()
1926 * TRAP: HV_FAST_TRAP
1927 * FUNCTION: HV_FAST_PCI_MSI_SETSTATE
1928 * ARG0: devhandle
1929 * ARG1: msinum
1930 * ARG2: msistate
1931 * RET0: status
1932 * ERRORS: EINVAL Invalid devhandle or msinum or msistate
1933 *
1934 * Set the state of the MSI defined by the given devhandle and msinum.
1935 */
1936#define HV_FAST_PCI_MSI_SETSTATE 0xce
1937
1938/* pci_msg_getmsiq()
1939 * TRAP: HV_FAST_TRAP
1940 * FUNCTION: HV_FAST_PCI_MSG_GETMSIQ
1941 * ARG0: devhandle
1942 * ARG1: msgtype
1943 * RET0: status
1944 * RET1: msiqid
1945 * ERRORS: EINVAL Invalid devhandle or msgtype
1946 *
1947 * Get the MSI EQ of the MSG defined by the given devhandle and msgtype.
1948 */
1949#define HV_FAST_PCI_MSG_GETMSIQ 0xd0
1950
1951/* pci_msg_setmsiq()
1952 * TRAP: HV_FAST_TRAP
1953 * FUNCTION: HV_FAST_PCI_MSG_SETMSIQ
1954 * ARG0: devhandle
1955 * ARG1: msgtype
1956 * ARG2: msiqid
1957 * RET0: status
1958 * ERRORS: EINVAL Invalid devhandle, msgtype, or msiqid
1959 *
1960 * Set the MSI EQ of the MSG defined by the given devhandle and msgtype.
1961 */
1962#define HV_FAST_PCI_MSG_SETMSIQ 0xd1
1963
1964/* pci_msg_getvalid()
1965 * TRAP: HV_FAST_TRAP
1966 * FUNCTION: HV_FAST_PCI_MSG_GETVALID
1967 * ARG0: devhandle
1968 * ARG1: msgtype
1969 * RET0: status
1970 * RET1: msgvalidstate
1971 * ERRORS: EINVAL Invalid devhandle or msgtype
1972 *
1973 * Get the valid/enabled state of the MSG defined by the given
1974 * devhandle and msgtype.
1975 */
1976#define HV_FAST_PCI_MSG_GETVALID 0xd2
1977
1978/* pci_msg_setvalid()
1979 * TRAP: HV_FAST_TRAP
1980 * FUNCTION: HV_FAST_PCI_MSG_SETVALID
1981 * ARG0: devhandle
1982 * ARG1: msgtype
1983 * ARG2: msgvalidstate
1984 * RET0: status
1985 * ERRORS: EINVAL Invalid devhandle or msgtype or msgvalidstate
1986 *
1987 * Set the valid/enabled state of the MSG defined by the given
1988 * devhandle and msgtype.
1989 */
1990#define HV_FAST_PCI_MSG_SETVALID 0xd3
1991
1992/* Performance counter services. */
1993
1994#define HV_PERF_JBUS_PERF_CTRL_REG 0x00
1995#define HV_PERF_JBUS_PERF_CNT_REG 0x01
1996#define HV_PERF_DRAM_PERF_CTRL_REG_0 0x02
1997#define HV_PERF_DRAM_PERF_CNT_REG_0 0x03
1998#define HV_PERF_DRAM_PERF_CTRL_REG_1 0x04
1999#define HV_PERF_DRAM_PERF_CNT_REG_1 0x05
2000#define HV_PERF_DRAM_PERF_CTRL_REG_2 0x06
2001#define HV_PERF_DRAM_PERF_CNT_REG_2 0x07
2002#define HV_PERF_DRAM_PERF_CTRL_REG_3 0x08
2003#define HV_PERF_DRAM_PERF_CNT_REG_3 0x09
2004
2005/* get_perfreg()
2006 * TRAP: HV_FAST_TRAP
2007 * FUNCTION: HV_FAST_GET_PERFREG
2008 * ARG0: performance reg number
2009 * RET0: status
2010 * RET1: performance reg value
2011 * ERRORS: EINVAL Invalid performance register number
2012 * ENOACCESS No access allowed to performance counters
2013 *
2014 * Read the value of the given DRAM/JBUS performance counter/control register.
2015 */
2016#define HV_FAST_GET_PERFREG 0x100
2017
2018/* set_perfreg()
2019 * TRAP: HV_FAST_TRAP
2020 * FUNCTION: HV_FAST_SET_PERFREG
2021 * ARG0: performance reg number
2022 * ARG1: performance reg value
2023 * RET0: status
2024 * ERRORS: EINVAL Invalid performance register number
2025 * ENOACCESS No access allowed to performance counters
2026 *
2027 * Write the given performance reg value to the given DRAM/JBUS
2028 * performance counter/control register.
2029 */
2030#define HV_FAST_SET_PERFREG 0x101
2031
2032/* MMU statistics services.
2033 *
2034 * The hypervisor maintains MMU statistics and privileged code provides
2035 * a buffer where these statistics can be collected. It is continually
2036 * updated once configured. The layout is as follows:
2037 */
2038#ifndef __ASSEMBLY__
2039struct hv_mmu_statistics {
2040 unsigned long immu_tsb_hits_ctx0_8k_tte;
2041 unsigned long immu_tsb_ticks_ctx0_8k_tte;
2042 unsigned long immu_tsb_hits_ctx0_64k_tte;
2043 unsigned long immu_tsb_ticks_ctx0_64k_tte;
2044 unsigned long __reserved1[2];
2045 unsigned long immu_tsb_hits_ctx0_4mb_tte;
2046 unsigned long immu_tsb_ticks_ctx0_4mb_tte;
2047 unsigned long __reserved2[2];
2048 unsigned long immu_tsb_hits_ctx0_256mb_tte;
2049 unsigned long immu_tsb_ticks_ctx0_256mb_tte;
2050 unsigned long __reserved3[4];
2051 unsigned long immu_tsb_hits_ctxnon0_8k_tte;
2052 unsigned long immu_tsb_ticks_ctxnon0_8k_tte;
2053 unsigned long immu_tsb_hits_ctxnon0_64k_tte;
2054 unsigned long immu_tsb_ticks_ctxnon0_64k_tte;
2055 unsigned long __reserved4[2];
2056 unsigned long immu_tsb_hits_ctxnon0_4mb_tte;
2057 unsigned long immu_tsb_ticks_ctxnon0_4mb_tte;
2058 unsigned long __reserved5[2];
2059 unsigned long immu_tsb_hits_ctxnon0_256mb_tte;
2060 unsigned long immu_tsb_ticks_ctxnon0_256mb_tte;
2061 unsigned long __reserved6[4];
2062 unsigned long dmmu_tsb_hits_ctx0_8k_tte;
2063 unsigned long dmmu_tsb_ticks_ctx0_8k_tte;
2064 unsigned long dmmu_tsb_hits_ctx0_64k_tte;
2065 unsigned long dmmu_tsb_ticks_ctx0_64k_tte;
2066 unsigned long __reserved7[2];
2067 unsigned long dmmu_tsb_hits_ctx0_4mb_tte;
2068 unsigned long dmmu_tsb_ticks_ctx0_4mb_tte;
2069 unsigned long __reserved8[2];
2070 unsigned long dmmu_tsb_hits_ctx0_256mb_tte;
2071 unsigned long dmmu_tsb_ticks_ctx0_256mb_tte;
2072 unsigned long __reserved9[4];
2073 unsigned long dmmu_tsb_hits_ctxnon0_8k_tte;
2074 unsigned long dmmu_tsb_ticks_ctxnon0_8k_tte;
2075 unsigned long dmmu_tsb_hits_ctxnon0_64k_tte;
2076 unsigned long dmmu_tsb_ticks_ctxnon0_64k_tte;
2077 unsigned long __reserved10[2];
2078 unsigned long dmmu_tsb_hits_ctxnon0_4mb_tte;
2079 unsigned long dmmu_tsb_ticks_ctxnon0_4mb_tte;
2080 unsigned long __reserved11[2];
2081 unsigned long dmmu_tsb_hits_ctxnon0_256mb_tte;
2082 unsigned long dmmu_tsb_ticks_ctxnon0_256mb_tte;
2083 unsigned long __reserved12[4];
2084};
2085#endif
2086
2087/* mmustat_conf()
2088 * TRAP: HV_FAST_TRAP
2089 * FUNCTION: HV_FAST_MMUSTAT_CONF
2090 * ARG0: real address
2091 * RET0: status
2092 * RET1: real address
2093 * ERRORS: ENORADDR Invalid real address
2094 * EBADALIGN Real address not aligned on 64-byte boundary
2095 * EBADTRAP API not supported on this processor
2096 *
2097 * Enable MMU statistic gathering using the buffer at the given real
2098 * address on the current virtual CPU. The new buffer real address
2099 * is given in ARG1, and the previously specified buffer real address
2100 * is returned in RET1, or is returned as zero for the first invocation.
2101 *
2102 * If the passed in real address argument is zero, this will disable
2103 * MMU statistic collection on the current virtual CPU. If an error is
2104 * returned then no statistics are collected.
2105 *
2106 * The buffer contents should be initialized to all zeros before being
2107 * given to the hypervisor or else the statistics will be meaningless.
2108 */
2109#define HV_FAST_MMUSTAT_CONF 0x102
2110
2111/* mmustat_info()
2112 * TRAP: HV_FAST_TRAP
2113 * FUNCTION: HV_FAST_MMUSTAT_INFO
2114 * RET0: status
2115 * RET1: real address
2116 * ERRORS: EBADTRAP API not supported on this processor
2117 *
2118 * Return the current state and real address of the currently configured
2119 * MMU statistics buffer on the current virtual CPU.
2120 */
2121#define HV_FAST_MMUSTAT_INFO 0x103
2122
2123/* Function numbers for HV_CORE_TRAP. */
2124#define HV_CORE_VER 0x00
2125#define HV_CORE_PUTCHAR 0x01
2126#define HV_CORE_EXIT 0x02
2127
2128#endif /* !(_SPARC64_HYPERVISOR_H) */
diff --git a/include/asm-sparc64/idprom.h b/include/asm-sparc64/idprom.h
index 701483c5465d..77fbf987385f 100644
--- a/include/asm-sparc64/idprom.h
+++ b/include/asm-sparc64/idprom.h
@@ -9,15 +9,7 @@
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11 11
12/* Offset into the EEPROM where the id PROM is located on the 4c */ 12struct idprom {
13#define IDPROM_OFFSET 0x7d8
14
15/* On sun4m; physical. */
16/* MicroSPARC(-II) does not decode 31rd bit, but it works. */
17#define IDPROM_OFFSET_M 0xfd8
18
19struct idprom
20{
21 u8 id_format; /* Format identifier (always 0x01) */ 13 u8 id_format; /* Format identifier (always 0x01) */
22 u8 id_machtype; /* Machine type */ 14 u8 id_machtype; /* Machine type */
23 u8 id_ethaddr[6]; /* Hardware ethernet address */ 15 u8 id_ethaddr[6]; /* Hardware ethernet address */
@@ -30,6 +22,4 @@ struct idprom
30extern struct idprom *idprom; 22extern struct idprom *idprom;
31extern void idprom_init(void); 23extern void idprom_init(void);
32 24
33#define IDPROM_SIZE (sizeof(struct idprom))
34
35#endif /* !(_SPARC_IDPROM_H) */ 25#endif /* !(_SPARC_IDPROM_H) */
diff --git a/include/asm-sparc64/intr_queue.h b/include/asm-sparc64/intr_queue.h
new file mode 100644
index 000000000000..206077dedc2a
--- /dev/null
+++ b/include/asm-sparc64/intr_queue.h
@@ -0,0 +1,15 @@
1#ifndef _SPARC64_INTR_QUEUE_H
2#define _SPARC64_INTR_QUEUE_H
3
4/* Sun4v interrupt queue registers, accessed via ASI_QUEUE. */
5
6#define INTRQ_CPU_MONDO_HEAD 0x3c0 /* CPU mondo head */
7#define INTRQ_CPU_MONDO_TAIL 0x3c8 /* CPU mondo tail */
8#define INTRQ_DEVICE_MONDO_HEAD 0x3d0 /* Device mondo head */
9#define INTRQ_DEVICE_MONDO_TAIL 0x3d8 /* Device mondo tail */
10#define INTRQ_RESUM_MONDO_HEAD 0x3e0 /* Resumable error mondo head */
11#define INTRQ_RESUM_MONDO_TAIL 0x3e8 /* Resumable error mondo tail */
12#define INTRQ_NONRESUM_MONDO_HEAD 0x3f0 /* Non-resumable error mondo head */
13#define INTRQ_NONRESUM_MONDO_TAIL 0x3f8 /* Non-resumable error mondo head */
14
15#endif /* !(_SPARC64_INTR_QUEUE_H) */
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
index 8b70edcb80dc..de33d6e1afb5 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -72,8 +72,11 @@ struct ino_bucket {
72#define IMAP_VALID 0x80000000 /* IRQ Enabled */ 72#define IMAP_VALID 0x80000000 /* IRQ Enabled */
73#define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */ 73#define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */
74#define IMAP_TID_JBUS 0x7c000000 /* JBUS TargetID */ 74#define IMAP_TID_JBUS 0x7c000000 /* JBUS TargetID */
75#define IMAP_TID_SHIFT 26
75#define IMAP_AID_SAFARI 0x7c000000 /* Safari AgentID */ 76#define IMAP_AID_SAFARI 0x7c000000 /* Safari AgentID */
77#define IMAP_AID_SHIFT 26
76#define IMAP_NID_SAFARI 0x03e00000 /* Safari NodeID */ 78#define IMAP_NID_SAFARI 0x03e00000 /* Safari NodeID */
79#define IMAP_NID_SHIFT 21
77#define IMAP_IGN 0x000007c0 /* IRQ Group Number */ 80#define IMAP_IGN 0x000007c0 /* IRQ Group Number */
78#define IMAP_INO 0x0000003f /* IRQ Number */ 81#define IMAP_INO 0x0000003f /* IRQ Number */
79#define IMAP_INR 0x000007ff /* Full interrupt number*/ 82#define IMAP_INR 0x000007ff /* Full interrupt number*/
@@ -111,6 +114,7 @@ extern void disable_irq(unsigned int);
111#define disable_irq_nosync disable_irq 114#define disable_irq_nosync disable_irq
112extern void enable_irq(unsigned int); 115extern void enable_irq(unsigned int);
113extern unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long imap); 116extern unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long imap);
117extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino, int pil, unsigned char flags);
114extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); 118extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);
115 119
116static __inline__ void set_softint(unsigned long bits) 120static __inline__ void set_softint(unsigned long bits)
diff --git a/include/asm-sparc64/kdebug.h b/include/asm-sparc64/kdebug.h
index 6321f5a0198d..4040d127ac3e 100644
--- a/include/asm-sparc64/kdebug.h
+++ b/include/asm-sparc64/kdebug.h
@@ -15,12 +15,9 @@ struct die_args {
15 int signr; 15 int signr;
16}; 16};
17 17
18/* Note - you should never unregister because that can race with NMIs. 18extern int register_die_notifier(struct notifier_block *);
19 * If you really want to do it first unregister - then synchronize_sched 19extern int unregister_die_notifier(struct notifier_block *);
20 * - then free. 20extern struct atomic_notifier_head sparc64die_chain;
21 */
22int register_die_notifier(struct notifier_block *nb);
23extern struct notifier_block *sparc64die_chain;
24 21
25extern void bad_trap(struct pt_regs *, long); 22extern void bad_trap(struct pt_regs *, long);
26 23
@@ -46,7 +43,7 @@ static inline int notify_die(enum die_val val,char *str, struct pt_regs *regs,
46 .trapnr = trap, 43 .trapnr = trap,
47 .signr = sig }; 44 .signr = sig };
48 45
49 return notifier_call_chain(&sparc64die_chain, val, &args); 46 return atomic_notifier_call_chain(&sparc64die_chain, val, &args);
50} 47}
51 48
52#endif 49#endif
diff --git a/include/asm-sparc64/mmu.h b/include/asm-sparc64/mmu.h
index 8627eed6e83d..2d4f2ea9568a 100644
--- a/include/asm-sparc64/mmu.h
+++ b/include/asm-sparc64/mmu.h
@@ -4,20 +4,9 @@
4#include <linux/config.h> 4#include <linux/config.h>
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/const.h> 6#include <asm/const.h>
7#include <asm/hypervisor.h>
7 8
8/* 9#define CTX_NR_BITS 13
9 * For the 8k pagesize kernel, use only 10 hw context bits to optimize some
10 * shifts in the fast tlbmiss handlers, instead of all 13 bits (specifically
11 * for vpte offset calculation). For other pagesizes, this optimization in
12 * the tlbhandlers can not be done; but still, all 13 bits can not be used
13 * because the tlb handlers use "andcc" instruction which sign extends 13
14 * bit arguments.
15 */
16#if PAGE_SHIFT == 13
17#define CTX_NR_BITS 10
18#else
19#define CTX_NR_BITS 12
20#endif
21 10
22#define TAG_CONTEXT_BITS ((_AC(1,UL) << CTX_NR_BITS) - _AC(1,UL)) 11#define TAG_CONTEXT_BITS ((_AC(1,UL) << CTX_NR_BITS) - _AC(1,UL))
23 12
@@ -90,10 +79,50 @@
90 79
91#ifndef __ASSEMBLY__ 80#ifndef __ASSEMBLY__
92 81
82#define TSB_ENTRY_ALIGNMENT 16
83
84struct tsb {
85 unsigned long tag;
86 unsigned long pte;
87} __attribute__((aligned(TSB_ENTRY_ALIGNMENT)));
88
89extern void __tsb_insert(unsigned long ent, unsigned long tag, unsigned long pte);
90extern void tsb_flush(unsigned long ent, unsigned long tag);
91extern void tsb_init(struct tsb *tsb, unsigned long size);
92
93struct tsb_config {
94 struct tsb *tsb;
95 unsigned long tsb_rss_limit;
96 unsigned long tsb_nentries;
97 unsigned long tsb_reg_val;
98 unsigned long tsb_map_vaddr;
99 unsigned long tsb_map_pte;
100};
101
102#define MM_TSB_BASE 0
103
104#ifdef CONFIG_HUGETLB_PAGE
105#define MM_TSB_HUGE 1
106#define MM_NUM_TSBS 2
107#else
108#define MM_NUM_TSBS 1
109#endif
110
93typedef struct { 111typedef struct {
94 unsigned long sparc64_ctx_val; 112 spinlock_t lock;
113 unsigned long sparc64_ctx_val;
114 unsigned long huge_pte_count;
115 struct tsb_config tsb_block[MM_NUM_TSBS];
116 struct hv_tsb_descr tsb_descr[MM_NUM_TSBS];
95} mm_context_t; 117} mm_context_t;
96 118
97#endif /* !__ASSEMBLY__ */ 119#endif /* !__ASSEMBLY__ */
98 120
121#define TSB_CONFIG_TSB 0x00
122#define TSB_CONFIG_RSS_LIMIT 0x08
123#define TSB_CONFIG_NENTRIES 0x10
124#define TSB_CONFIG_REG_VAL 0x18
125#define TSB_CONFIG_MAP_VADDR 0x20
126#define TSB_CONFIG_MAP_PTE 0x28
127
99#endif /* __MMU_H */ 128#endif /* __MMU_H */
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
index 57ee7b306189..2337eb487719 100644
--- a/include/asm-sparc64/mmu_context.h
+++ b/include/asm-sparc64/mmu_context.h
@@ -19,96 +19,103 @@ extern unsigned long tlb_context_cache;
19extern unsigned long mmu_context_bmap[]; 19extern unsigned long mmu_context_bmap[];
20 20
21extern void get_new_mmu_context(struct mm_struct *mm); 21extern void get_new_mmu_context(struct mm_struct *mm);
22#ifdef CONFIG_SMP
23extern void smp_new_mmu_context_version(void);
24#else
25#define smp_new_mmu_context_version() do { } while (0)
26#endif
22 27
23/* Initialize a new mmu context. This is invoked when a new 28extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
24 * address space instance (unique or shared) is instantiated. 29extern void destroy_context(struct mm_struct *mm);
25 * This just needs to set mm->context to an invalid context. 30
26 */ 31extern void __tsb_context_switch(unsigned long pgd_pa,
27#define init_new_context(__tsk, __mm) \ 32 struct tsb_config *tsb_base,
28 (((__mm)->context.sparc64_ctx_val = 0UL), 0) 33 struct tsb_config *tsb_huge,
29 34 unsigned long tsb_descr_pa);
30/* Destroy a dead context. This occurs when mmput drops the 35
31 * mm_users count to zero, the mmaps have been released, and 36static inline void tsb_context_switch(struct mm_struct *mm)
32 * all the page tables have been flushed. Our job is to destroy 37{
33 * any remaining processor-specific state, and in the sparc64 38 __tsb_context_switch(__pa(mm->pgd),
34 * case this just means freeing up the mmu context ID held by 39 &mm->context.tsb_block[0],
35 * this task if valid. 40#ifdef CONFIG_HUGETLB_PAGE
36 */ 41 (mm->context.tsb_block[1].tsb ?
37#define destroy_context(__mm) \ 42 &mm->context.tsb_block[1] :
38do { spin_lock(&ctx_alloc_lock); \ 43 NULL)
39 if (CTX_VALID((__mm)->context)) { \ 44#else
40 unsigned long nr = CTX_NRBITS((__mm)->context); \ 45 NULL
41 mmu_context_bmap[nr>>6] &= ~(1UL << (nr & 63)); \ 46#endif
42 } \ 47 , __pa(&mm->context.tsb_descr[0]));
43 spin_unlock(&ctx_alloc_lock); \ 48}
44} while(0) 49
45 50extern void tsb_grow(struct mm_struct *mm, unsigned long tsb_index, unsigned long mm_rss);
46/* Reload the two core values used by TLB miss handler 51#ifdef CONFIG_SMP
47 * processing on sparc64. They are: 52extern void smp_tsb_sync(struct mm_struct *mm);
48 * 1) The physical address of mm->pgd, when full page 53#else
49 * table walks are necessary, this is where the 54#define smp_tsb_sync(__mm) do { } while (0)
50 * search begins. 55#endif
51 * 2) A "PGD cache". For 32-bit tasks only pgd[0] is
52 * ever used since that maps the entire low 4GB
53 * completely. To speed up TLB miss processing we
54 * make this value available to the handlers. This
55 * decreases the amount of memory traffic incurred.
56 */
57#define reload_tlbmiss_state(__tsk, __mm) \
58do { \
59 register unsigned long paddr asm("o5"); \
60 register unsigned long pgd_cache asm("o4"); \
61 paddr = __pa((__mm)->pgd); \
62 pgd_cache = 0UL; \
63 if (task_thread_info(__tsk)->flags & _TIF_32BIT) \
64 pgd_cache = get_pgd_cache((__mm)->pgd); \
65 __asm__ __volatile__("wrpr %%g0, 0x494, %%pstate\n\t" \
66 "mov %3, %%g4\n\t" \
67 "mov %0, %%g7\n\t" \
68 "stxa %1, [%%g4] %2\n\t" \
69 "membar #Sync\n\t" \
70 "wrpr %%g0, 0x096, %%pstate" \
71 : /* no outputs */ \
72 : "r" (paddr), "r" (pgd_cache),\
73 "i" (ASI_DMMU), "i" (TSB_REG)); \
74} while(0)
75 56
76/* Set MMU context in the actual hardware. */ 57/* Set MMU context in the actual hardware. */
77#define load_secondary_context(__mm) \ 58#define load_secondary_context(__mm) \
78 __asm__ __volatile__("stxa %0, [%1] %2\n\t" \ 59 __asm__ __volatile__( \
79 "flush %%g6" \ 60 "\n661: stxa %0, [%1] %2\n" \
80 : /* No outputs */ \ 61 " .section .sun4v_1insn_patch, \"ax\"\n" \
81 : "r" (CTX_HWBITS((__mm)->context)), \ 62 " .word 661b\n" \
82 "r" (SECONDARY_CONTEXT), "i" (ASI_DMMU)) 63 " stxa %0, [%1] %3\n" \
64 " .previous\n" \
65 " flush %%g6\n" \
66 : /* No outputs */ \
67 : "r" (CTX_HWBITS((__mm)->context)), \
68 "r" (SECONDARY_CONTEXT), "i" (ASI_DMMU), "i" (ASI_MMU))
83 69
84extern void __flush_tlb_mm(unsigned long, unsigned long); 70extern void __flush_tlb_mm(unsigned long, unsigned long);
85 71
86/* Switch the current MM context. */ 72/* Switch the current MM context. Interrupts are disabled. */
87static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) 73static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk)
88{ 74{
89 unsigned long ctx_valid; 75 unsigned long ctx_valid, flags;
90 int cpu; 76 int cpu;
91 77
92 /* Note: page_table_lock is used here to serialize switch_mm 78 spin_lock_irqsave(&mm->context.lock, flags);
93 * and activate_mm, and their calls to get_new_mmu_context.
94 * This use of page_table_lock is unrelated to its other uses.
95 */
96 spin_lock(&mm->page_table_lock);
97 ctx_valid = CTX_VALID(mm->context); 79 ctx_valid = CTX_VALID(mm->context);
98 if (!ctx_valid) 80 if (!ctx_valid)
99 get_new_mmu_context(mm); 81 get_new_mmu_context(mm);
100 spin_unlock(&mm->page_table_lock);
101 82
102 if (!ctx_valid || (old_mm != mm)) { 83 /* We have to be extremely careful here or else we will miss
103 load_secondary_context(mm); 84 * a TSB grow if we switch back and forth between a kernel
104 reload_tlbmiss_state(tsk, mm); 85 * thread and an address space which has it's TSB size increased
105 } 86 * on another processor.
87 *
88 * It is possible to play some games in order to optimize the
89 * switch, but the safest thing to do is to unconditionally
90 * perform the secondary context load and the TSB context switch.
91 *
92 * For reference the bad case is, for address space "A":
93 *
94 * CPU 0 CPU 1
95 * run address space A
96 * set cpu0's bits in cpu_vm_mask
97 * switch to kernel thread, borrow
98 * address space A via entry_lazy_tlb
99 * run address space A
100 * set cpu1's bit in cpu_vm_mask
101 * flush_tlb_pending()
102 * reset cpu_vm_mask to just cpu1
103 * TSB grow
104 * run address space A
105 * context was valid, so skip
106 * TSB context switch
107 *
108 * At that point cpu0 continues to use a stale TSB, the one from
109 * before the TSB grow performed on cpu1. cpu1 did not cross-call
110 * cpu0 to update it's TSB because at that point the cpu_vm_mask
111 * only had cpu1 set in it.
112 */
113 load_secondary_context(mm);
114 tsb_context_switch(mm);
106 115
107 /* Even if (mm == old_mm) we _must_ check 116 /* Any time a processor runs a context on an address space
108 * the cpu_vm_mask. If we do not we could 117 * for the first time, we must flush that context out of the
109 * corrupt the TLB state because of how 118 * local TLB.
110 * smp_flush_tlb_{page,range,mm} on sparc64
111 * and lazy tlb switches work. -DaveM
112 */ 119 */
113 cpu = smp_processor_id(); 120 cpu = smp_processor_id();
114 if (!ctx_valid || !cpu_isset(cpu, mm->cpu_vm_mask)) { 121 if (!ctx_valid || !cpu_isset(cpu, mm->cpu_vm_mask)) {
@@ -116,6 +123,7 @@ static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, str
116 __flush_tlb_mm(CTX_HWBITS(mm->context), 123 __flush_tlb_mm(CTX_HWBITS(mm->context),
117 SECONDARY_CONTEXT); 124 SECONDARY_CONTEXT);
118 } 125 }
126 spin_unlock_irqrestore(&mm->context.lock, flags);
119} 127}
120 128
121#define deactivate_mm(tsk,mm) do { } while (0) 129#define deactivate_mm(tsk,mm) do { } while (0)
@@ -123,23 +131,20 @@ static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, str
123/* Activate a new MM instance for the current task. */ 131/* Activate a new MM instance for the current task. */
124static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm) 132static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm)
125{ 133{
134 unsigned long flags;
126 int cpu; 135 int cpu;
127 136
128 /* Note: page_table_lock is used here to serialize switch_mm 137 spin_lock_irqsave(&mm->context.lock, flags);
129 * and activate_mm, and their calls to get_new_mmu_context.
130 * This use of page_table_lock is unrelated to its other uses.
131 */
132 spin_lock(&mm->page_table_lock);
133 if (!CTX_VALID(mm->context)) 138 if (!CTX_VALID(mm->context))
134 get_new_mmu_context(mm); 139 get_new_mmu_context(mm);
135 cpu = smp_processor_id(); 140 cpu = smp_processor_id();
136 if (!cpu_isset(cpu, mm->cpu_vm_mask)) 141 if (!cpu_isset(cpu, mm->cpu_vm_mask))
137 cpu_set(cpu, mm->cpu_vm_mask); 142 cpu_set(cpu, mm->cpu_vm_mask);
138 spin_unlock(&mm->page_table_lock);
139 143
140 load_secondary_context(mm); 144 load_secondary_context(mm);
141 __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT); 145 __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT);
142 reload_tlbmiss_state(current, mm); 146 tsb_context_switch(mm);
147 spin_unlock_irqrestore(&mm->context.lock, flags);
143} 148}
144 149
145#endif /* !(__ASSEMBLY__) */ 150#endif /* !(__ASSEMBLY__) */
diff --git a/include/asm-sparc64/numnodes.h b/include/asm-sparc64/numnodes.h
new file mode 100644
index 000000000000..017e7e74f5e7
--- /dev/null
+++ b/include/asm-sparc64/numnodes.h
@@ -0,0 +1,6 @@
1#ifndef _SPARC64_NUMNODES_H
2#define _SPARC64_NUMNODES_H
3
4#define NODES_SHIFT 0
5
6#endif /* !(_SPARC64_NUMNODES_H) */
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
index 3c59b2693fb9..c754676e13ef 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -12,18 +12,8 @@
12#include <linux/config.h> 12#include <linux/config.h>
13#include <asm/openprom.h> 13#include <asm/openprom.h>
14 14
15/* Enumeration to describe the prom major version we have detected. */ 15/* OBP version string. */
16enum prom_major_version { 16extern char prom_version[];
17 PROM_V0, /* Original sun4c V0 prom */
18 PROM_V2, /* sun4c and early sun4m V2 prom */
19 PROM_V3, /* sun4m and later, up to sun4d/sun4e machines V3 */
20 PROM_P1275, /* IEEE compliant ISA based Sun PROM, only sun4u */
21 PROM_AP1000, /* actually no prom at all */
22};
23
24extern enum prom_major_version prom_vers;
25/* Revision, and firmware revision. */
26extern unsigned int prom_rev, prom_prev;
27 17
28/* Root node of the prom device tree, this stays constant after 18/* Root node of the prom device tree, this stays constant after
29 * initialization is complete. 19 * initialization is complete.
@@ -39,6 +29,9 @@ extern int prom_stdin, prom_stdout;
39extern int prom_chosen_node; 29extern int prom_chosen_node;
40 30
41/* Helper values and strings in arch/sparc64/kernel/head.S */ 31/* Helper values and strings in arch/sparc64/kernel/head.S */
32extern const char prom_peer_name[];
33extern const char prom_compatible_name[];
34extern const char prom_root_compatible[];
42extern const char prom_finddev_name[]; 35extern const char prom_finddev_name[];
43extern const char prom_chosen_path[]; 36extern const char prom_chosen_path[];
44extern const char prom_getprop_name[]; 37extern const char prom_getprop_name[];
@@ -130,15 +123,6 @@ extern void prom_setcallback(callback_func_t func_ptr);
130 */ 123 */
131extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); 124extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size);
132 125
133/* Get the prom major version. */
134extern int prom_version(void);
135
136/* Get the prom plugin revision. */
137extern int prom_getrev(void);
138
139/* Get the prom firmware revision. */
140extern int prom_getprev(void);
141
142/* Character operations to/from the console.... */ 126/* Character operations to/from the console.... */
143 127
144/* Non-blocking get character from console. */ 128/* Non-blocking get character from console. */
@@ -164,6 +148,7 @@ enum prom_input_device {
164 PROMDEV_ITTYA, /* input from ttya */ 148 PROMDEV_ITTYA, /* input from ttya */
165 PROMDEV_ITTYB, /* input from ttyb */ 149 PROMDEV_ITTYB, /* input from ttyb */
166 PROMDEV_IRSC, /* input from rsc */ 150 PROMDEV_IRSC, /* input from rsc */
151 PROMDEV_IVCONS, /* input from virtual-console */
167 PROMDEV_I_UNK, 152 PROMDEV_I_UNK,
168}; 153};
169 154
@@ -176,6 +161,7 @@ enum prom_output_device {
176 PROMDEV_OTTYA, /* to ttya */ 161 PROMDEV_OTTYA, /* to ttya */
177 PROMDEV_OTTYB, /* to ttyb */ 162 PROMDEV_OTTYB, /* to ttyb */
178 PROMDEV_ORSC, /* to rsc */ 163 PROMDEV_ORSC, /* to rsc */
164 PROMDEV_OVCONS, /* to virtual-console */
179 PROMDEV_O_UNK, 165 PROMDEV_O_UNK,
180}; 166};
181 167
@@ -183,10 +169,18 @@ extern enum prom_output_device prom_query_output_device(void);
183 169
184/* Multiprocessor operations... */ 170/* Multiprocessor operations... */
185#ifdef CONFIG_SMP 171#ifdef CONFIG_SMP
186/* Start the CPU with the given device tree node, context table, and context 172/* Start the CPU with the given device tree node at the passed program
187 * at the passed program counter. 173 * counter with the given arg passed in via register %o0.
174 */
175extern void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg);
176
177/* Start the CPU with the given cpu ID at the passed program
178 * counter with the given arg passed in via register %o0.
188 */ 179 */
189extern void prom_startcpu(int cpunode, unsigned long pc, unsigned long o0); 180extern void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg);
181
182/* Stop the CPU with the given cpu ID. */
183extern void prom_stopcpu_cpuid(int cpuid);
190 184
191/* Stop the current CPU. */ 185/* Stop the current CPU. */
192extern void prom_stopself(void); 186extern void prom_stopself(void);
@@ -335,6 +329,7 @@ int cpu_find_by_mid(int mid, int *prom_node);
335 329
336/* Client interface level routines. */ 330/* Client interface level routines. */
337extern void prom_set_trap_table(unsigned long tba); 331extern void prom_set_trap_table(unsigned long tba);
332extern void prom_set_trap_table_sun4v(unsigned long tba, unsigned long mmfsa);
338 333
339extern long p1275_cmd(const char *, long, ...); 334extern long p1275_cmd(const char *, long, ...);
340 335
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index 5426bb28a993..aabb21906724 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -30,6 +30,23 @@
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32 32
33#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
34#define HPAGE_SHIFT 22
35#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K)
36#define HPAGE_SHIFT 19
37#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
38#define HPAGE_SHIFT 16
39#endif
40
41#ifdef CONFIG_HUGETLB_PAGE
42#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
43#define HPAGE_MASK (~(HPAGE_SIZE - 1UL))
44#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
45#define ARCH_HAS_SETCLEAR_HUGE_PTE
46#define ARCH_HAS_HUGETLB_PREFAULT_HOOK
47#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
48#endif
49
33#ifndef __ASSEMBLY__ 50#ifndef __ASSEMBLY__
34 51
35extern void _clear_page(void *page); 52extern void _clear_page(void *page);
@@ -90,24 +107,11 @@ typedef unsigned long pgprot_t;
90 107
91#endif /* (STRICT_MM_TYPECHECKS) */ 108#endif /* (STRICT_MM_TYPECHECKS) */
92 109
93#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
94#define HPAGE_SHIFT 22
95#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K)
96#define HPAGE_SHIFT 19
97#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
98#define HPAGE_SHIFT 16
99#endif
100
101#ifdef CONFIG_HUGETLB_PAGE
102#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
103#define HPAGE_MASK (~(HPAGE_SIZE - 1UL))
104#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
105#define ARCH_HAS_SETCLEAR_HUGE_PTE
106#define ARCH_HAS_HUGETLB_PREFAULT_HOOK
107#endif
108
109#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \ 110#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \
110 (_AC(0x0000000070000000,UL)) : (PAGE_OFFSET)) 111 (_AC(0x0000000070000000,UL)) : \
112 (_AC(0xfffff80000000000,UL) + (1UL << 32UL)))
113
114#include <asm-generic/memory_model.h>
111 115
112#endif /* !(__ASSEMBLY__) */ 116#endif /* !(__ASSEMBLY__) */
113 117
@@ -124,17 +128,10 @@ typedef unsigned long pgprot_t;
124#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) 128#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
125#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 129#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
126 130
127/* PFNs are real physical page numbers. However, mem_map only begins to record 131#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
128 * per-page information starting at pfn_base. This is to handle systems where
129 * the first physical page in the machine is at some huge physical address,
130 * such as 4GB. This is common on a partitioned E10000, for example.
131 */
132extern struct page *pfn_to_page(unsigned long pfn);
133extern unsigned long page_to_pfn(struct page *);
134 132
135#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr)>>PAGE_SHIFT) 133#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr)>>PAGE_SHIFT)
136 134
137#define pfn_valid(pfn) (((pfn)-(pfn_base)) < max_mapnr)
138#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 135#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
139 136
140#define virt_to_phys __pa 137#define virt_to_phys __pa
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index dd35a2c7798a..1396f110939a 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -139,6 +139,9 @@ struct pci_pbm_info {
139 /* Opaque 32-bit system bus Port ID. */ 139 /* Opaque 32-bit system bus Port ID. */
140 u32 portid; 140 u32 portid;
141 141
142 /* Opaque 32-bit handle used for hypervisor calls. */
143 u32 devhandle;
144
142 /* Chipset version information. */ 145 /* Chipset version information. */
143 int chip_type; 146 int chip_type;
144#define PBM_CHIP_TYPE_SABRE 1 147#define PBM_CHIP_TYPE_SABRE 1
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index 89bd71b1c0d8..7c5a589ea437 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -41,10 +41,26 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
41 41
42struct pci_dev; 42struct pci_dev;
43 43
44struct pci_iommu_ops {
45 void *(*alloc_consistent)(struct pci_dev *, size_t, dma_addr_t *);
46 void (*free_consistent)(struct pci_dev *, size_t, void *, dma_addr_t);
47 dma_addr_t (*map_single)(struct pci_dev *, void *, size_t, int);
48 void (*unmap_single)(struct pci_dev *, dma_addr_t, size_t, int);
49 int (*map_sg)(struct pci_dev *, struct scatterlist *, int, int);
50 void (*unmap_sg)(struct pci_dev *, struct scatterlist *, int, int);
51 void (*dma_sync_single_for_cpu)(struct pci_dev *, dma_addr_t, size_t, int);
52 void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int);
53};
54
55extern struct pci_iommu_ops *pci_iommu_ops;
56
44/* Allocate and map kernel buffer using consistent mode DMA for a device. 57/* Allocate and map kernel buffer using consistent mode DMA for a device.
45 * hwdev should be valid struct pci_dev pointer for PCI devices. 58 * hwdev should be valid struct pci_dev pointer for PCI devices.
46 */ 59 */
47extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle); 60static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle)
61{
62 return pci_iommu_ops->alloc_consistent(hwdev, size, dma_handle);
63}
48 64
49/* Free and unmap a consistent DMA buffer. 65/* Free and unmap a consistent DMA buffer.
50 * cpu_addr is what was returned from pci_alloc_consistent, 66 * cpu_addr is what was returned from pci_alloc_consistent,
@@ -54,7 +70,10 @@ extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t
54 * References to the memory and mappings associated with cpu_addr/dma_addr 70 * References to the memory and mappings associated with cpu_addr/dma_addr
55 * past this call are illegal. 71 * past this call are illegal.
56 */ 72 */
57extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle); 73static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
74{
75 return pci_iommu_ops->free_consistent(hwdev, size, vaddr, dma_handle);
76}
58 77
59/* Map a single buffer of the indicated size for DMA in streaming mode. 78/* Map a single buffer of the indicated size for DMA in streaming mode.
60 * The 32-bit bus address to use is returned. 79 * The 32-bit bus address to use is returned.
@@ -62,7 +81,10 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr,
62 * Once the device is given the dma address, the device owns this memory 81 * Once the device is given the dma address, the device owns this memory
63 * until either pci_unmap_single or pci_dma_sync_single_for_cpu is performed. 82 * until either pci_unmap_single or pci_dma_sync_single_for_cpu is performed.
64 */ 83 */
65extern dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction); 84static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
85{
86 return pci_iommu_ops->map_single(hwdev, ptr, size, direction);
87}
66 88
67/* Unmap a single streaming mode DMA translation. The dma_addr and size 89/* Unmap a single streaming mode DMA translation. The dma_addr and size
68 * must match what was provided for in a previous pci_map_single call. All 90 * must match what was provided for in a previous pci_map_single call. All
@@ -71,7 +93,10 @@ extern dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size,
71 * After this call, reads by the cpu to the buffer are guaranteed to see 93 * After this call, reads by the cpu to the buffer are guaranteed to see
72 * whatever the device wrote there. 94 * whatever the device wrote there.
73 */ 95 */
74extern void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction); 96static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction)
97{
98 pci_iommu_ops->unmap_single(hwdev, dma_addr, size, direction);
99}
75 100
76/* No highmem on sparc64, plus we have an IOMMU, so mapping pages is easy. */ 101/* No highmem on sparc64, plus we have an IOMMU, so mapping pages is easy. */
77#define pci_map_page(dev, page, off, size, dir) \ 102#define pci_map_page(dev, page, off, size, dir) \
@@ -107,15 +132,19 @@ extern void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t
107 * Device ownership issues as mentioned above for pci_map_single are 132 * Device ownership issues as mentioned above for pci_map_single are
108 * the same here. 133 * the same here.
109 */ 134 */
110extern int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, 135static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction)
111 int nents, int direction); 136{
137 return pci_iommu_ops->map_sg(hwdev, sg, nents, direction);
138}
112 139
113/* Unmap a set of streaming mode DMA translations. 140/* Unmap a set of streaming mode DMA translations.
114 * Again, cpu read rules concerning calls here are the same as for 141 * Again, cpu read rules concerning calls here are the same as for
115 * pci_unmap_single() above. 142 * pci_unmap_single() above.
116 */ 143 */
117extern void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, 144static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nhwents, int direction)
118 int nhwents, int direction); 145{
146 pci_iommu_ops->unmap_sg(hwdev, sg, nhwents, direction);
147}
119 148
120/* Make physical memory consistent for a single 149/* Make physical memory consistent for a single
121 * streaming mode DMA translation after a transfer. 150 * streaming mode DMA translation after a transfer.
@@ -127,8 +156,10 @@ extern void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
127 * must first perform a pci_dma_sync_for_device, and then the 156 * must first perform a pci_dma_sync_for_device, and then the
128 * device again owns the buffer. 157 * device again owns the buffer.
129 */ 158 */
130extern void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, 159static inline void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction)
131 size_t size, int direction); 160{
161 pci_iommu_ops->dma_sync_single_for_cpu(hwdev, dma_handle, size, direction);
162}
132 163
133static inline void 164static inline void
134pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle, 165pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
@@ -144,7 +175,10 @@ pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
144 * The same as pci_dma_sync_single_* but for a scatter-gather list, 175 * The same as pci_dma_sync_single_* but for a scatter-gather list,
145 * same rules and usage. 176 * same rules and usage.
146 */ 177 */
147extern void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction); 178static inline void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction)
179{
180 pci_iommu_ops->dma_sync_sg_for_cpu(hwdev, sg, nelems, direction);
181}
148 182
149static inline void 183static inline void
150pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg, 184pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index aea4e51e7cd1..82032e159a76 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -26,10 +26,9 @@ register unsigned long __local_per_cpu_offset asm("g5");
26#define percpu_modcopy(pcpudst, src, size) \ 26#define percpu_modcopy(pcpudst, src, size) \
27do { \ 27do { \
28 unsigned int __i; \ 28 unsigned int __i; \
29 for (__i = 0; __i < NR_CPUS; __i++) \ 29 for_each_cpu(__i) \
30 if (cpu_possible(__i)) \ 30 memcpy((pcpudst)+__per_cpu_offset(__i), \
31 memcpy((pcpudst)+__per_cpu_offset(__i), \ 31 (src), (size)); \
32 (src), (size)); \
33} while (0) 32} while (0)
34#else /* ! SMP */ 33#else /* ! SMP */
35 34
diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h
index a96067cca963..12e4a273bd43 100644
--- a/include/asm-sparc64/pgalloc.h
+++ b/include/asm-sparc64/pgalloc.h
@@ -6,6 +6,7 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/mm.h> 8#include <linux/mm.h>
9#include <linux/slab.h>
9 10
10#include <asm/spitfire.h> 11#include <asm/spitfire.h>
11#include <asm/cpudata.h> 12#include <asm/cpudata.h>
@@ -13,172 +14,59 @@
13#include <asm/page.h> 14#include <asm/page.h>
14 15
15/* Page table allocation/freeing. */ 16/* Page table allocation/freeing. */
16#ifdef CONFIG_SMP 17extern kmem_cache_t *pgtable_cache;
17/* Sliiiicck */
18#define pgt_quicklists local_cpu_data()
19#else
20extern struct pgtable_cache_struct {
21 unsigned long *pgd_cache;
22 unsigned long *pte_cache[2];
23 unsigned int pgcache_size;
24} pgt_quicklists;
25#endif
26#define pgd_quicklist (pgt_quicklists.pgd_cache)
27#define pmd_quicklist ((unsigned long *)0)
28#define pte_quicklist (pgt_quicklists.pte_cache)
29#define pgtable_cache_size (pgt_quicklists.pgcache_size)
30 18
31static __inline__ void free_pgd_fast(pgd_t *pgd) 19static inline pgd_t *pgd_alloc(struct mm_struct *mm)
32{ 20{
33 preempt_disable(); 21 return kmem_cache_alloc(pgtable_cache, GFP_KERNEL);
34 *(unsigned long *)pgd = (unsigned long) pgd_quicklist;
35 pgd_quicklist = (unsigned long *) pgd;
36 pgtable_cache_size++;
37 preempt_enable();
38} 22}
39 23
40static __inline__ pgd_t *get_pgd_fast(void) 24static inline void pgd_free(pgd_t *pgd)
41{ 25{
42 unsigned long *ret; 26 kmem_cache_free(pgtable_cache, pgd);
43
44 preempt_disable();
45 if((ret = pgd_quicklist) != NULL) {
46 pgd_quicklist = (unsigned long *)(*ret);
47 ret[0] = 0;
48 pgtable_cache_size--;
49 preempt_enable();
50 } else {
51 preempt_enable();
52 ret = (unsigned long *) __get_free_page(GFP_KERNEL|__GFP_REPEAT);
53 if(ret)
54 memset(ret, 0, PAGE_SIZE);
55 }
56 return (pgd_t *)ret;
57} 27}
58 28
59static __inline__ void free_pgd_slow(pgd_t *pgd)
60{
61 free_page((unsigned long)pgd);
62}
63
64#ifdef DCACHE_ALIASING_POSSIBLE
65#define VPTE_COLOR(address) (((address) >> (PAGE_SHIFT + 10)) & 1UL)
66#define DCACHE_COLOR(address) (((address) >> PAGE_SHIFT) & 1UL)
67#else
68#define VPTE_COLOR(address) 0
69#define DCACHE_COLOR(address) 0
70#endif
71
72#define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD) 29#define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD)
73 30
74static __inline__ pmd_t *pmd_alloc_one_fast(struct mm_struct *mm, unsigned long address) 31static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
75{ 32{
76 unsigned long *ret; 33 return kmem_cache_alloc(pgtable_cache,
77 int color = 0; 34 GFP_KERNEL|__GFP_REPEAT);
78
79 preempt_disable();
80 if (pte_quicklist[color] == NULL)
81 color = 1;
82
83 if((ret = (unsigned long *)pte_quicklist[color]) != NULL) {
84 pte_quicklist[color] = (unsigned long *)(*ret);
85 ret[0] = 0;
86 pgtable_cache_size--;
87 }
88 preempt_enable();
89
90 return (pmd_t *)ret;
91} 35}
92 36
93static __inline__ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) 37static inline void pmd_free(pmd_t *pmd)
94{ 38{
95 pmd_t *pmd; 39 kmem_cache_free(pgtable_cache, pmd);
96
97 pmd = pmd_alloc_one_fast(mm, address);
98 if (!pmd) {
99 pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
100 if (pmd)
101 memset(pmd, 0, PAGE_SIZE);
102 }
103 return pmd;
104} 40}
105 41
106static __inline__ void free_pmd_fast(pmd_t *pmd) 42static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
43 unsigned long address)
107{ 44{
108 unsigned long color = DCACHE_COLOR((unsigned long)pmd); 45 return kmem_cache_alloc(pgtable_cache,
109 46 GFP_KERNEL|__GFP_REPEAT);
110 preempt_disable();
111 *(unsigned long *)pmd = (unsigned long) pte_quicklist[color];
112 pte_quicklist[color] = (unsigned long *) pmd;
113 pgtable_cache_size++;
114 preempt_enable();
115} 47}
116 48
117static __inline__ void free_pmd_slow(pmd_t *pmd) 49static inline struct page *pte_alloc_one(struct mm_struct *mm,
50 unsigned long address)
118{ 51{
119 free_page((unsigned long)pmd); 52 return virt_to_page(pte_alloc_one_kernel(mm, address));
120} 53}
121 54
122#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
123#define pmd_populate(MM,PMD,PTE_PAGE) \
124 pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE))
125
126extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address);
127
128static inline struct page *
129pte_alloc_one(struct mm_struct *mm, unsigned long addr)
130{
131 pte_t *pte = pte_alloc_one_kernel(mm, addr);
132
133 if (pte)
134 return virt_to_page(pte);
135
136 return NULL;
137}
138
139static __inline__ pte_t *pte_alloc_one_fast(struct mm_struct *mm, unsigned long address)
140{
141 unsigned long color = VPTE_COLOR(address);
142 unsigned long *ret;
143
144 preempt_disable();
145 if((ret = (unsigned long *)pte_quicklist[color]) != NULL) {
146 pte_quicklist[color] = (unsigned long *)(*ret);
147 ret[0] = 0;
148 pgtable_cache_size--;
149 }
150 preempt_enable();
151 return (pte_t *)ret;
152}
153
154static __inline__ void free_pte_fast(pte_t *pte)
155{
156 unsigned long color = DCACHE_COLOR((unsigned long)pte);
157
158 preempt_disable();
159 *(unsigned long *)pte = (unsigned long) pte_quicklist[color];
160 pte_quicklist[color] = (unsigned long *) pte;
161 pgtable_cache_size++;
162 preempt_enable();
163}
164
165static __inline__ void free_pte_slow(pte_t *pte)
166{
167 free_page((unsigned long)pte);
168}
169
170static inline void pte_free_kernel(pte_t *pte) 55static inline void pte_free_kernel(pte_t *pte)
171{ 56{
172 free_pte_fast(pte); 57 kmem_cache_free(pgtable_cache, pte);
173} 58}
174 59
175static inline void pte_free(struct page *ptepage) 60static inline void pte_free(struct page *ptepage)
176{ 61{
177 free_pte_fast(page_address(ptepage)); 62 pte_free_kernel(page_address(ptepage));
178} 63}
179 64
180#define pmd_free(pmd) free_pmd_fast(pmd) 65
181#define pgd_free(pgd) free_pgd_fast(pgd) 66#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
182#define pgd_alloc(mm) get_pgd_fast() 67#define pmd_populate(MM,PMD,PTE_PAGE) \
68 pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE))
69
70#define check_pgt_cache() do { } while (0)
183 71
184#endif /* _SPARC64_PGALLOC_H */ 72#endif /* _SPARC64_PGALLOC_H */
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index f0a9b44d3eb5..c44e7466534e 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -25,7 +25,8 @@
25#include <asm/const.h> 25#include <asm/const.h>
26 26
27/* The kernel image occupies 0x4000000 to 0x1000000 (4MB --> 32MB). 27/* The kernel image occupies 0x4000000 to 0x1000000 (4MB --> 32MB).
28 * The page copy blockops can use 0x2000000 to 0x10000000. 28 * The page copy blockops can use 0x2000000 to 0x4000000.
29 * The TSB is mapped in the 0x4000000 to 0x6000000 range.
29 * The PROM resides in an area spanning 0xf0000000 to 0x100000000. 30 * The PROM resides in an area spanning 0xf0000000 to 0x100000000.
30 * The vmalloc area spans 0x100000000 to 0x200000000. 31 * The vmalloc area spans 0x100000000 to 0x200000000.
31 * Since modules need to be in the lowest 32-bits of the address space, 32 * Since modules need to be in the lowest 32-bits of the address space,
@@ -34,6 +35,7 @@
34 * 0x400000000. 35 * 0x400000000.
35 */ 36 */
36#define TLBTEMP_BASE _AC(0x0000000002000000,UL) 37#define TLBTEMP_BASE _AC(0x0000000002000000,UL)
38#define TSBMAP_BASE _AC(0x0000000004000000,UL)
37#define MODULES_VADDR _AC(0x0000000010000000,UL) 39#define MODULES_VADDR _AC(0x0000000010000000,UL)
38#define MODULES_LEN _AC(0x00000000e0000000,UL) 40#define MODULES_LEN _AC(0x00000000e0000000,UL)
39#define MODULES_END _AC(0x00000000f0000000,UL) 41#define MODULES_END _AC(0x00000000f0000000,UL)
@@ -88,162 +90,540 @@
88 90
89#endif /* !(__ASSEMBLY__) */ 91#endif /* !(__ASSEMBLY__) */
90 92
91/* Spitfire/Cheetah TTE bits. */ 93/* PTE bits which are the same in SUN4U and SUN4V format. */
92#define _PAGE_VALID _AC(0x8000000000000000,UL) /* Valid TTE */ 94#define _PAGE_VALID _AC(0x8000000000000000,UL) /* Valid TTE */
93#define _PAGE_R _AC(0x8000000000000000,UL) /* Keep ref bit up to date*/ 95#define _PAGE_R _AC(0x8000000000000000,UL) /* Keep ref bit uptodate*/
94#define _PAGE_SZ4MB _AC(0x6000000000000000,UL) /* 4MB Page */ 96
95#define _PAGE_SZ512K _AC(0x4000000000000000,UL) /* 512K Page */ 97/* SUN4U pte bits... */
96#define _PAGE_SZ64K _AC(0x2000000000000000,UL) /* 64K Page */ 98#define _PAGE_SZ4MB_4U _AC(0x6000000000000000,UL) /* 4MB Page */
97#define _PAGE_SZ8K _AC(0x0000000000000000,UL) /* 8K Page */ 99#define _PAGE_SZ512K_4U _AC(0x4000000000000000,UL) /* 512K Page */
98#define _PAGE_NFO _AC(0x1000000000000000,UL) /* No Fault Only */ 100#define _PAGE_SZ64K_4U _AC(0x2000000000000000,UL) /* 64K Page */
99#define _PAGE_IE _AC(0x0800000000000000,UL) /* Invert Endianness */ 101#define _PAGE_SZ8K_4U _AC(0x0000000000000000,UL) /* 8K Page */
100#define _PAGE_SOFT2 _AC(0x07FC000000000000,UL) /* Software bits, set 2 */ 102#define _PAGE_NFO_4U _AC(0x1000000000000000,UL) /* No Fault Only */
101#define _PAGE_RES1 _AC(0x0002000000000000,UL) /* Reserved */ 103#define _PAGE_IE_4U _AC(0x0800000000000000,UL) /* Invert Endianness */
102#define _PAGE_SZ32MB _AC(0x0001000000000000,UL) /* (Panther) 32MB page */ 104#define _PAGE_SOFT2_4U _AC(0x07FC000000000000,UL) /* Software bits, set 2 */
103#define _PAGE_SZ256MB _AC(0x2001000000000000,UL) /* (Panther) 256MB page */ 105#define _PAGE_RES1_4U _AC(0x0002000000000000,UL) /* Reserved */
104#define _PAGE_SN _AC(0x0000800000000000,UL) /* (Cheetah) Snoop */ 106#define _PAGE_SZ32MB_4U _AC(0x0001000000000000,UL) /* (Panther) 32MB page */
105#define _PAGE_RES2 _AC(0x0000780000000000,UL) /* Reserved */ 107#define _PAGE_SZ256MB_4U _AC(0x2001000000000000,UL) /* (Panther) 256MB page */
106#define _PAGE_PADDR_SF _AC(0x000001FFFFFFE000,UL) /* (Spitfire) paddr[40:13]*/ 108#define _PAGE_SZALL_4U _AC(0x6001000000000000,UL) /* All pgsz bits */
107#define _PAGE_PADDR _AC(0x000007FFFFFFE000,UL) /* (Cheetah) paddr[42:13] */ 109#define _PAGE_SN_4U _AC(0x0000800000000000,UL) /* (Cheetah) Snoop */
108#define _PAGE_SOFT _AC(0x0000000000001F80,UL) /* Software bits */ 110#define _PAGE_RES2_4U _AC(0x0000780000000000,UL) /* Reserved */
109#define _PAGE_L _AC(0x0000000000000040,UL) /* Locked TTE */ 111#define _PAGE_PADDR_4U _AC(0x000007FFFFFFE000,UL) /* (Cheetah) pa[42:13] */
110#define _PAGE_CP _AC(0x0000000000000020,UL) /* Cacheable in P-Cache */ 112#define _PAGE_SOFT_4U _AC(0x0000000000001F80,UL) /* Software bits: */
111#define _PAGE_CV _AC(0x0000000000000010,UL) /* Cacheable in V-Cache */ 113#define _PAGE_EXEC_4U _AC(0x0000000000001000,UL) /* Executable SW bit */
112#define _PAGE_E _AC(0x0000000000000008,UL) /* side-Effect */ 114#define _PAGE_MODIFIED_4U _AC(0x0000000000000800,UL) /* Modified (dirty) */
113#define _PAGE_P _AC(0x0000000000000004,UL) /* Privileged Page */ 115#define _PAGE_FILE_4U _AC(0x0000000000000800,UL) /* Pagecache page */
114#define _PAGE_W _AC(0x0000000000000002,UL) /* Writable */ 116#define _PAGE_ACCESSED_4U _AC(0x0000000000000400,UL) /* Accessed (ref'd) */
115#define _PAGE_G _AC(0x0000000000000001,UL) /* Global */ 117#define _PAGE_READ_4U _AC(0x0000000000000200,UL) /* Readable SW Bit */
116 118#define _PAGE_WRITE_4U _AC(0x0000000000000100,UL) /* Writable SW Bit */
117/* Here are the SpitFire software bits we use in the TTE's. 119#define _PAGE_PRESENT_4U _AC(0x0000000000000080,UL) /* Present */
118 * 120#define _PAGE_L_4U _AC(0x0000000000000040,UL) /* Locked TTE */
119 * WARNING: If you are going to try and start using some 121#define _PAGE_CP_4U _AC(0x0000000000000020,UL) /* Cacheable in P-Cache */
120 * of the soft2 bits, you will need to make 122#define _PAGE_CV_4U _AC(0x0000000000000010,UL) /* Cacheable in V-Cache */
121 * modifications to the swap entry implementation. 123#define _PAGE_E_4U _AC(0x0000000000000008,UL) /* side-Effect */
122 * For example, one thing that could happen is that 124#define _PAGE_P_4U _AC(0x0000000000000004,UL) /* Privileged Page */
123 * swp_entry_to_pte() would BUG_ON() if you tried 125#define _PAGE_W_4U _AC(0x0000000000000002,UL) /* Writable */
124 * to use one of the soft2 bits for _PAGE_FILE. 126
125 * 127/* SUN4V pte bits... */
126 * Like other architectures, I have aliased _PAGE_FILE with 128#define _PAGE_NFO_4V _AC(0x4000000000000000,UL) /* No Fault Only */
127 * _PAGE_MODIFIED. This works because _PAGE_FILE is never 129#define _PAGE_SOFT2_4V _AC(0x3F00000000000000,UL) /* Software bits, set 2 */
128 * interpreted that way unless _PAGE_PRESENT is clear. 130#define _PAGE_MODIFIED_4V _AC(0x2000000000000000,UL) /* Modified (dirty) */
129 */ 131#define _PAGE_ACCESSED_4V _AC(0x1000000000000000,UL) /* Accessed (ref'd) */
130#define _PAGE_EXEC _AC(0x0000000000001000,UL) /* Executable SW bit */ 132#define _PAGE_READ_4V _AC(0x0800000000000000,UL) /* Readable SW Bit */
131#define _PAGE_MODIFIED _AC(0x0000000000000800,UL) /* Modified (dirty) */ 133#define _PAGE_WRITE_4V _AC(0x0400000000000000,UL) /* Writable SW Bit */
132#define _PAGE_FILE _AC(0x0000000000000800,UL) /* Pagecache page */ 134#define _PAGE_PADDR_4V _AC(0x00FFFFFFFFFFE000,UL) /* paddr[55:13] */
133#define _PAGE_ACCESSED _AC(0x0000000000000400,UL) /* Accessed (ref'd) */ 135#define _PAGE_IE_4V _AC(0x0000000000001000,UL) /* Invert Endianness */
134#define _PAGE_READ _AC(0x0000000000000200,UL) /* Readable SW Bit */ 136#define _PAGE_E_4V _AC(0x0000000000000800,UL) /* side-Effect */
135#define _PAGE_WRITE _AC(0x0000000000000100,UL) /* Writable SW Bit */ 137#define _PAGE_CP_4V _AC(0x0000000000000400,UL) /* Cacheable in P-Cache */
136#define _PAGE_PRESENT _AC(0x0000000000000080,UL) /* Present */ 138#define _PAGE_CV_4V _AC(0x0000000000000200,UL) /* Cacheable in V-Cache */
139#define _PAGE_P_4V _AC(0x0000000000000100,UL) /* Privileged Page */
140#define _PAGE_EXEC_4V _AC(0x0000000000000080,UL) /* Executable Page */
141#define _PAGE_W_4V _AC(0x0000000000000040,UL) /* Writable */
142#define _PAGE_SOFT_4V _AC(0x0000000000000030,UL) /* Software bits */
143#define _PAGE_FILE_4V _AC(0x0000000000000020,UL) /* Pagecache page */
144#define _PAGE_PRESENT_4V _AC(0x0000000000000010,UL) /* Present */
145#define _PAGE_RESV_4V _AC(0x0000000000000008,UL) /* Reserved */
146#define _PAGE_SZ16GB_4V _AC(0x0000000000000007,UL) /* 16GB Page */
147#define _PAGE_SZ2GB_4V _AC(0x0000000000000006,UL) /* 2GB Page */
148#define _PAGE_SZ256MB_4V _AC(0x0000000000000005,UL) /* 256MB Page */
149#define _PAGE_SZ32MB_4V _AC(0x0000000000000004,UL) /* 32MB Page */
150#define _PAGE_SZ4MB_4V _AC(0x0000000000000003,UL) /* 4MB Page */
151#define _PAGE_SZ512K_4V _AC(0x0000000000000002,UL) /* 512K Page */
152#define _PAGE_SZ64K_4V _AC(0x0000000000000001,UL) /* 64K Page */
153#define _PAGE_SZ8K_4V _AC(0x0000000000000000,UL) /* 8K Page */
154#define _PAGE_SZALL_4V _AC(0x0000000000000007,UL) /* All pgsz bits */
137 155
138#if PAGE_SHIFT == 13 156#if PAGE_SHIFT == 13
139#define _PAGE_SZBITS _PAGE_SZ8K 157#define _PAGE_SZBITS_4U _PAGE_SZ8K_4U
158#define _PAGE_SZBITS_4V _PAGE_SZ8K_4V
140#elif PAGE_SHIFT == 16 159#elif PAGE_SHIFT == 16
141#define _PAGE_SZBITS _PAGE_SZ64K 160#define _PAGE_SZBITS_4U _PAGE_SZ64K_4U
161#define _PAGE_SZBITS_4V _PAGE_SZ64K_4V
142#elif PAGE_SHIFT == 19 162#elif PAGE_SHIFT == 19
143#define _PAGE_SZBITS _PAGE_SZ512K 163#define _PAGE_SZBITS_4U _PAGE_SZ512K_4U
164#define _PAGE_SZBITS_4V _PAGE_SZ512K_4V
144#elif PAGE_SHIFT == 22 165#elif PAGE_SHIFT == 22
145#define _PAGE_SZBITS _PAGE_SZ4MB 166#define _PAGE_SZBITS_4U _PAGE_SZ4MB_4U
167#define _PAGE_SZBITS_4V _PAGE_SZ4MB_4V
146#else 168#else
147#error Wrong PAGE_SHIFT specified 169#error Wrong PAGE_SHIFT specified
148#endif 170#endif
149 171
150#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB) 172#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
151#define _PAGE_SZHUGE _PAGE_SZ4MB 173#define _PAGE_SZHUGE_4U _PAGE_SZ4MB_4U
174#define _PAGE_SZHUGE_4V _PAGE_SZ4MB_4V
152#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) 175#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K)
153#define _PAGE_SZHUGE _PAGE_SZ512K 176#define _PAGE_SZHUGE_4U _PAGE_SZ512K_4U
177#define _PAGE_SZHUGE_4V _PAGE_SZ512K_4V
154#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K) 178#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
155#define _PAGE_SZHUGE _PAGE_SZ64K 179#define _PAGE_SZHUGE_4U _PAGE_SZ64K_4U
180#define _PAGE_SZHUGE_4V _PAGE_SZ64K_4V
156#endif 181#endif
157 182
158#define _PAGE_CACHE (_PAGE_CP | _PAGE_CV) 183/* These are actually filled in at boot time by sun4{u,v}_pgprot_init() */
184#define __P000 __pgprot(0)
185#define __P001 __pgprot(0)
186#define __P010 __pgprot(0)
187#define __P011 __pgprot(0)
188#define __P100 __pgprot(0)
189#define __P101 __pgprot(0)
190#define __P110 __pgprot(0)
191#define __P111 __pgprot(0)
192
193#define __S000 __pgprot(0)
194#define __S001 __pgprot(0)
195#define __S010 __pgprot(0)
196#define __S011 __pgprot(0)
197#define __S100 __pgprot(0)
198#define __S101 __pgprot(0)
199#define __S110 __pgprot(0)
200#define __S111 __pgprot(0)
159 201
160#define __DIRTY_BITS (_PAGE_MODIFIED | _PAGE_WRITE | _PAGE_W) 202#ifndef __ASSEMBLY__
161#define __ACCESS_BITS (_PAGE_ACCESSED | _PAGE_READ | _PAGE_R)
162#define __PRIV_BITS _PAGE_P
163 203
164#define PAGE_NONE __pgprot (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_CACHE) 204extern pte_t mk_pte_io(unsigned long, pgprot_t, int, unsigned long);
165 205
166/* Don't set the TTE _PAGE_W bit here, else the dirty bit never gets set. */ 206extern unsigned long pte_sz_bits(unsigned long size);
167#define PAGE_SHARED __pgprot (_PAGE_PRESENT | _PAGE_VALID | _PAGE_CACHE | \
168 __ACCESS_BITS | _PAGE_WRITE | _PAGE_EXEC)
169 207
170#define PAGE_COPY __pgprot (_PAGE_PRESENT | _PAGE_VALID | _PAGE_CACHE | \ 208extern pgprot_t PAGE_KERNEL;
171 __ACCESS_BITS | _PAGE_EXEC) 209extern pgprot_t PAGE_KERNEL_LOCKED;
210extern pgprot_t PAGE_COPY;
211extern pgprot_t PAGE_SHARED;
172 212
173#define PAGE_READONLY __pgprot (_PAGE_PRESENT | _PAGE_VALID | _PAGE_CACHE | \ 213/* XXX This uglyness is for the atyfb driver's sparc mmap() support. XXX */
174 __ACCESS_BITS | _PAGE_EXEC) 214extern unsigned long _PAGE_IE;
215extern unsigned long _PAGE_E;
216extern unsigned long _PAGE_CACHE;
175 217
176#define PAGE_KERNEL __pgprot (_PAGE_PRESENT | _PAGE_VALID | _PAGE_CACHE | \ 218extern unsigned long pg_iobits;
177 __PRIV_BITS | \ 219extern unsigned long _PAGE_ALL_SZ_BITS;
178 __ACCESS_BITS | __DIRTY_BITS | _PAGE_EXEC) 220extern unsigned long _PAGE_SZBITS;
179 221
180#define PAGE_SHARED_NOEXEC __pgprot (_PAGE_PRESENT | _PAGE_VALID | \ 222extern struct page *mem_map_zero;
181 _PAGE_CACHE | \ 223#define ZERO_PAGE(vaddr) (mem_map_zero)
182 __ACCESS_BITS | _PAGE_WRITE)
183 224
184#define PAGE_COPY_NOEXEC __pgprot (_PAGE_PRESENT | _PAGE_VALID | \ 225/* PFNs are real physical page numbers. However, mem_map only begins to record
185 _PAGE_CACHE | __ACCESS_BITS) 226 * per-page information starting at pfn_base. This is to handle systems where
227 * the first physical page in the machine is at some huge physical address,
228 * such as 4GB. This is common on a partitioned E10000, for example.
229 */
230static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
231{
232 unsigned long paddr = pfn << PAGE_SHIFT;
233 unsigned long sz_bits;
234
235 sz_bits = 0UL;
236 if (_PAGE_SZBITS_4U != 0UL || _PAGE_SZBITS_4V != 0UL) {
237 __asm__ __volatile__(
238 "\n661: sethi %uhi(%1), %0\n"
239 " sllx %0, 32, %0\n"
240 " .section .sun4v_2insn_patch, \"ax\"\n"
241 " .word 661b\n"
242 " mov %2, %0\n"
243 " nop\n"
244 " .previous\n"
245 : "=r" (sz_bits)
246 : "i" (_PAGE_SZBITS_4U), "i" (_PAGE_SZBITS_4V));
247 }
248 return __pte(paddr | sz_bits | pgprot_val(prot));
249}
250#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
186 251
187#define PAGE_READONLY_NOEXEC __pgprot (_PAGE_PRESENT | _PAGE_VALID | \ 252/* This one can be done with two shifts. */
188 _PAGE_CACHE | __ACCESS_BITS) 253static inline unsigned long pte_pfn(pte_t pte)
254{
255 unsigned long ret;
256
257 __asm__ __volatile__(
258 "\n661: sllx %1, %2, %0\n"
259 " srlx %0, %3, %0\n"
260 " .section .sun4v_2insn_patch, \"ax\"\n"
261 " .word 661b\n"
262 " sllx %1, %4, %0\n"
263 " srlx %0, %5, %0\n"
264 " .previous\n"
265 : "=r" (ret)
266 : "r" (pte_val(pte)),
267 "i" (21), "i" (21 + PAGE_SHIFT),
268 "i" (8), "i" (8 + PAGE_SHIFT));
269
270 return ret;
271}
272#define pte_page(x) pfn_to_page(pte_pfn(x))
189 273
190#define _PFN_MASK _PAGE_PADDR 274static inline pte_t pte_modify(pte_t pte, pgprot_t prot)
275{
276 unsigned long mask, tmp;
277
278 /* SUN4U: 0x600307ffffffecb8 (negated == 0x9ffcf80000001347)
279 * SUN4V: 0x30ffffffffffee17 (negated == 0xcf000000000011e8)
280 *
281 * Even if we use negation tricks the result is still a 6
282 * instruction sequence, so don't try to play fancy and just
283 * do the most straightforward implementation.
284 *
285 * Note: We encode this into 3 sun4v 2-insn patch sequences.
286 */
191 287
192#define pg_iobits (_PAGE_VALID | _PAGE_PRESENT | __DIRTY_BITS | \ 288 __asm__ __volatile__(
193 __ACCESS_BITS | _PAGE_E) 289 "\n661: sethi %%uhi(%2), %1\n"
290 " sethi %%hi(%2), %0\n"
291 "\n662: or %1, %%ulo(%2), %1\n"
292 " or %0, %%lo(%2), %0\n"
293 "\n663: sllx %1, 32, %1\n"
294 " or %0, %1, %0\n"
295 " .section .sun4v_2insn_patch, \"ax\"\n"
296 " .word 661b\n"
297 " sethi %%uhi(%3), %1\n"
298 " sethi %%hi(%3), %0\n"
299 " .word 662b\n"
300 " or %1, %%ulo(%3), %1\n"
301 " or %0, %%lo(%3), %0\n"
302 " .word 663b\n"
303 " sllx %1, 32, %1\n"
304 " or %0, %1, %0\n"
305 " .previous\n"
306 : "=r" (mask), "=r" (tmp)
307 : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U |
308 _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | _PAGE_PRESENT_4U |
309 _PAGE_SZBITS_4U),
310 "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V |
311 _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | _PAGE_PRESENT_4V |
312 _PAGE_SZBITS_4V));
313
314 return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask));
315}
194 316
195#define __P000 PAGE_NONE 317static inline pte_t pgoff_to_pte(unsigned long off)
196#define __P001 PAGE_READONLY_NOEXEC 318{
197#define __P010 PAGE_COPY_NOEXEC 319 off <<= PAGE_SHIFT;
198#define __P011 PAGE_COPY_NOEXEC 320
199#define __P100 PAGE_READONLY 321 __asm__ __volatile__(
200#define __P101 PAGE_READONLY 322 "\n661: or %0, %2, %0\n"
201#define __P110 PAGE_COPY 323 " .section .sun4v_1insn_patch, \"ax\"\n"
202#define __P111 PAGE_COPY 324 " .word 661b\n"
325 " or %0, %3, %0\n"
326 " .previous\n"
327 : "=r" (off)
328 : "0" (off), "i" (_PAGE_FILE_4U), "i" (_PAGE_FILE_4V));
329
330 return __pte(off);
331}
203 332
204#define __S000 PAGE_NONE 333static inline pgprot_t pgprot_noncached(pgprot_t prot)
205#define __S001 PAGE_READONLY_NOEXEC 334{
206#define __S010 PAGE_SHARED_NOEXEC 335 unsigned long val = pgprot_val(prot);
207#define __S011 PAGE_SHARED_NOEXEC 336
208#define __S100 PAGE_READONLY 337 __asm__ __volatile__(
209#define __S101 PAGE_READONLY 338 "\n661: andn %0, %2, %0\n"
210#define __S110 PAGE_SHARED 339 " or %0, %3, %0\n"
211#define __S111 PAGE_SHARED 340 " .section .sun4v_2insn_patch, \"ax\"\n"
341 " .word 661b\n"
342 " andn %0, %4, %0\n"
343 " or %0, %3, %0\n"
344 " .previous\n"
345 : "=r" (val)
346 : "0" (val), "i" (_PAGE_CP_4U | _PAGE_CV_4U), "i" (_PAGE_E_4U),
347 "i" (_PAGE_CP_4V | _PAGE_CV_4V), "i" (_PAGE_E_4V));
348
349 return __pgprot(val);
350}
351/* Various pieces of code check for platform support by ifdef testing
352 * on "pgprot_noncached". That's broken and should be fixed, but for
353 * now...
354 */
355#define pgprot_noncached pgprot_noncached
212 356
213#ifndef __ASSEMBLY__ 357#ifdef CONFIG_HUGETLB_PAGE
358static inline pte_t pte_mkhuge(pte_t pte)
359{
360 unsigned long mask;
361
362 __asm__ __volatile__(
363 "\n661: sethi %%uhi(%1), %0\n"
364 " sllx %0, 32, %0\n"
365 " .section .sun4v_2insn_patch, \"ax\"\n"
366 " .word 661b\n"
367 " mov %2, %0\n"
368 " nop\n"
369 " .previous\n"
370 : "=r" (mask)
371 : "i" (_PAGE_SZHUGE_4U), "i" (_PAGE_SZHUGE_4V));
372
373 return __pte(pte_val(pte) | mask);
374}
375#endif
214 376
215extern unsigned long phys_base; 377static inline pte_t pte_mkdirty(pte_t pte)
216extern unsigned long pfn_base; 378{
379 unsigned long val = pte_val(pte), tmp;
380
381 __asm__ __volatile__(
382 "\n661: or %0, %3, %0\n"
383 " nop\n"
384 "\n662: nop\n"
385 " nop\n"
386 " .section .sun4v_2insn_patch, \"ax\"\n"
387 " .word 661b\n"
388 " sethi %%uhi(%4), %1\n"
389 " sllx %1, 32, %1\n"
390 " .word 662b\n"
391 " or %1, %%lo(%4), %1\n"
392 " or %0, %1, %0\n"
393 " .previous\n"
394 : "=r" (val), "=r" (tmp)
395 : "0" (val), "i" (_PAGE_MODIFIED_4U | _PAGE_W_4U),
396 "i" (_PAGE_MODIFIED_4V | _PAGE_W_4V));
397
398 return __pte(val);
399}
217 400
218extern struct page *mem_map_zero; 401static inline pte_t pte_mkclean(pte_t pte)
219#define ZERO_PAGE(vaddr) (mem_map_zero) 402{
403 unsigned long val = pte_val(pte), tmp;
404
405 __asm__ __volatile__(
406 "\n661: andn %0, %3, %0\n"
407 " nop\n"
408 "\n662: nop\n"
409 " nop\n"
410 " .section .sun4v_2insn_patch, \"ax\"\n"
411 " .word 661b\n"
412 " sethi %%uhi(%4), %1\n"
413 " sllx %1, 32, %1\n"
414 " .word 662b\n"
415 " or %1, %%lo(%4), %1\n"
416 " andn %0, %1, %0\n"
417 " .previous\n"
418 : "=r" (val), "=r" (tmp)
419 : "0" (val), "i" (_PAGE_MODIFIED_4U | _PAGE_W_4U),
420 "i" (_PAGE_MODIFIED_4V | _PAGE_W_4V));
421
422 return __pte(val);
423}
220 424
221/* PFNs are real physical page numbers. However, mem_map only begins to record 425static inline pte_t pte_mkwrite(pte_t pte)
222 * per-page information starting at pfn_base. This is to handle systems where 426{
223 * the first physical page in the machine is at some huge physical address, 427 unsigned long val = pte_val(pte), mask;
224 * such as 4GB. This is common on a partitioned E10000, for example. 428
225 */ 429 __asm__ __volatile__(
430 "\n661: mov %1, %0\n"
431 " nop\n"
432 " .section .sun4v_2insn_patch, \"ax\"\n"
433 " .word 661b\n"
434 " sethi %%uhi(%2), %0\n"
435 " sllx %0, 32, %0\n"
436 " .previous\n"
437 : "=r" (mask)
438 : "i" (_PAGE_WRITE_4U), "i" (_PAGE_WRITE_4V));
439
440 return __pte(val | mask);
441}
226 442
227#define pfn_pte(pfn, prot) \ 443static inline pte_t pte_wrprotect(pte_t pte)
228 __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot) | _PAGE_SZBITS) 444{
229#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 445 unsigned long val = pte_val(pte), tmp;
446
447 __asm__ __volatile__(
448 "\n661: andn %0, %3, %0\n"
449 " nop\n"
450 "\n662: nop\n"
451 " nop\n"
452 " .section .sun4v_2insn_patch, \"ax\"\n"
453 " .word 661b\n"
454 " sethi %%uhi(%4), %1\n"
455 " sllx %1, 32, %1\n"
456 " .word 662b\n"
457 " or %1, %%lo(%4), %1\n"
458 " andn %0, %1, %0\n"
459 " .previous\n"
460 : "=r" (val), "=r" (tmp)
461 : "0" (val), "i" (_PAGE_WRITE_4U | _PAGE_W_4U),
462 "i" (_PAGE_WRITE_4V | _PAGE_W_4V));
463
464 return __pte(val);
465}
466
467static inline pte_t pte_mkold(pte_t pte)
468{
469 unsigned long mask;
470
471 __asm__ __volatile__(
472 "\n661: mov %1, %0\n"
473 " nop\n"
474 " .section .sun4v_2insn_patch, \"ax\"\n"
475 " .word 661b\n"
476 " sethi %%uhi(%2), %0\n"
477 " sllx %0, 32, %0\n"
478 " .previous\n"
479 : "=r" (mask)
480 : "i" (_PAGE_ACCESSED_4U), "i" (_PAGE_ACCESSED_4V));
481
482 mask |= _PAGE_R;
483
484 return __pte(pte_val(pte) & ~mask);
485}
486
487static inline pte_t pte_mkyoung(pte_t pte)
488{
489 unsigned long mask;
490
491 __asm__ __volatile__(
492 "\n661: mov %1, %0\n"
493 " nop\n"
494 " .section .sun4v_2insn_patch, \"ax\"\n"
495 " .word 661b\n"
496 " sethi %%uhi(%2), %0\n"
497 " sllx %0, 32, %0\n"
498 " .previous\n"
499 : "=r" (mask)
500 : "i" (_PAGE_ACCESSED_4U), "i" (_PAGE_ACCESSED_4V));
501
502 mask |= _PAGE_R;
503
504 return __pte(pte_val(pte) | mask);
505}
230 506
231#define pte_pfn(x) ((pte_val(x) & _PAGE_PADDR)>>PAGE_SHIFT) 507static inline unsigned long pte_young(pte_t pte)
232#define pte_page(x) pfn_to_page(pte_pfn(x)) 508{
509 unsigned long mask;
510
511 __asm__ __volatile__(
512 "\n661: mov %1, %0\n"
513 " nop\n"
514 " .section .sun4v_2insn_patch, \"ax\"\n"
515 " .word 661b\n"
516 " sethi %%uhi(%2), %0\n"
517 " sllx %0, 32, %0\n"
518 " .previous\n"
519 : "=r" (mask)
520 : "i" (_PAGE_ACCESSED_4U), "i" (_PAGE_ACCESSED_4V));
521
522 return (pte_val(pte) & mask);
523}
524
525static inline unsigned long pte_dirty(pte_t pte)
526{
527 unsigned long mask;
528
529 __asm__ __volatile__(
530 "\n661: mov %1, %0\n"
531 " nop\n"
532 " .section .sun4v_2insn_patch, \"ax\"\n"
533 " .word 661b\n"
534 " sethi %%uhi(%2), %0\n"
535 " sllx %0, 32, %0\n"
536 " .previous\n"
537 : "=r" (mask)
538 : "i" (_PAGE_MODIFIED_4U), "i" (_PAGE_MODIFIED_4V));
539
540 return (pte_val(pte) & mask);
541}
233 542
234static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot) 543static inline unsigned long pte_write(pte_t pte)
235{ 544{
236 pte_t __pte; 545 unsigned long mask;
237 const unsigned long preserve_mask = (_PFN_MASK | 546
238 _PAGE_MODIFIED | _PAGE_ACCESSED | 547 __asm__ __volatile__(
239 _PAGE_CACHE | _PAGE_E | 548 "\n661: mov %1, %0\n"
240 _PAGE_PRESENT | _PAGE_SZBITS); 549 " nop\n"
550 " .section .sun4v_2insn_patch, \"ax\"\n"
551 " .word 661b\n"
552 " sethi %%uhi(%2), %0\n"
553 " sllx %0, 32, %0\n"
554 " .previous\n"
555 : "=r" (mask)
556 : "i" (_PAGE_WRITE_4U), "i" (_PAGE_WRITE_4V));
557
558 return (pte_val(pte) & mask);
559}
241 560
242 pte_val(__pte) = (pte_val(orig_pte) & preserve_mask) | 561static inline unsigned long pte_exec(pte_t pte)
243 (pgprot_val(new_prot) & ~preserve_mask); 562{
563 unsigned long mask;
564
565 __asm__ __volatile__(
566 "\n661: sethi %%hi(%1), %0\n"
567 " .section .sun4v_1insn_patch, \"ax\"\n"
568 " .word 661b\n"
569 " mov %2, %0\n"
570 " .previous\n"
571 : "=r" (mask)
572 : "i" (_PAGE_EXEC_4U), "i" (_PAGE_EXEC_4V));
573
574 return (pte_val(pte) & mask);
575}
244 576
245 return __pte; 577static inline unsigned long pte_read(pte_t pte)
578{
579 unsigned long mask;
580
581 __asm__ __volatile__(
582 "\n661: mov %1, %0\n"
583 " nop\n"
584 " .section .sun4v_2insn_patch, \"ax\"\n"
585 " .word 661b\n"
586 " sethi %%uhi(%2), %0\n"
587 " sllx %0, 32, %0\n"
588 " .previous\n"
589 : "=r" (mask)
590 : "i" (_PAGE_READ_4U), "i" (_PAGE_READ_4V));
591
592 return (pte_val(pte) & mask);
246} 593}
594
595static inline unsigned long pte_file(pte_t pte)
596{
597 unsigned long val = pte_val(pte);
598
599 __asm__ __volatile__(
600 "\n661: and %0, %2, %0\n"
601 " .section .sun4v_1insn_patch, \"ax\"\n"
602 " .word 661b\n"
603 " and %0, %3, %0\n"
604 " .previous\n"
605 : "=r" (val)
606 : "0" (val), "i" (_PAGE_FILE_4U), "i" (_PAGE_FILE_4V));
607
608 return val;
609}
610
611static inline unsigned long pte_present(pte_t pte)
612{
613 unsigned long val = pte_val(pte);
614
615 __asm__ __volatile__(
616 "\n661: and %0, %2, %0\n"
617 " .section .sun4v_1insn_patch, \"ax\"\n"
618 " .word 661b\n"
619 " and %0, %3, %0\n"
620 " .previous\n"
621 : "=r" (val)
622 : "0" (val), "i" (_PAGE_PRESENT_4U), "i" (_PAGE_PRESENT_4V));
623
624 return val;
625}
626
247#define pmd_set(pmdp, ptep) \ 627#define pmd_set(pmdp, ptep) \
248 (pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> 11UL)) 628 (pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> 11UL))
249#define pud_set(pudp, pmdp) \ 629#define pud_set(pudp, pmdp) \
@@ -253,8 +633,6 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
253#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd)) 633#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd))
254#define pud_page(pud) \ 634#define pud_page(pud) \
255 ((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL))) 635 ((unsigned long) __va((((unsigned long)pud_val(pud))<<11UL)))
256#define pte_none(pte) (!pte_val(pte))
257#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
258#define pmd_none(pmd) (!pmd_val(pmd)) 636#define pmd_none(pmd) (!pmd_val(pmd))
259#define pmd_bad(pmd) (0) 637#define pmd_bad(pmd) (0)
260#define pmd_present(pmd) (pmd_val(pmd) != 0U) 638#define pmd_present(pmd) (pmd_val(pmd) != 0U)
@@ -264,30 +642,8 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
264#define pud_present(pud) (pud_val(pud) != 0U) 642#define pud_present(pud) (pud_val(pud) != 0U)
265#define pud_clear(pudp) (pud_val(*(pudp)) = 0U) 643#define pud_clear(pudp) (pud_val(*(pudp)) = 0U)
266 644
267/* The following only work if pte_present() is true. 645/* Same in both SUN4V and SUN4U. */
268 * Undefined behaviour if not.. 646#define pte_none(pte) (!pte_val(pte))
269 */
270#define pte_read(pte) (pte_val(pte) & _PAGE_READ)
271#define pte_exec(pte) (pte_val(pte) & _PAGE_EXEC)
272#define pte_write(pte) (pte_val(pte) & _PAGE_WRITE)
273#define pte_dirty(pte) (pte_val(pte) & _PAGE_MODIFIED)
274#define pte_young(pte) (pte_val(pte) & _PAGE_ACCESSED)
275#define pte_wrprotect(pte) (__pte(pte_val(pte) & ~(_PAGE_WRITE|_PAGE_W)))
276#define pte_rdprotect(pte) \
277 (__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_READ))
278#define pte_mkclean(pte) \
279 (__pte(pte_val(pte) & ~(_PAGE_MODIFIED|_PAGE_W)))
280#define pte_mkold(pte) \
281 (__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_ACCESSED))
282
283/* Permanent address of a page. */
284#define __page_address(page) page_address(page)
285
286/* Be very careful when you change these three, they are delicate. */
287#define pte_mkyoung(pte) (__pte(pte_val(pte) | _PAGE_ACCESSED | _PAGE_R))
288#define pte_mkwrite(pte) (__pte(pte_val(pte) | _PAGE_WRITE))
289#define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_MODIFIED | _PAGE_W))
290#define pte_mkhuge(pte) (__pte(pte_val(pte) | _PAGE_SZHUGE))
291 647
292/* to find an entry in a page-table-directory. */ 648/* to find an entry in a page-table-directory. */
293#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) 649#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
@@ -296,11 +652,6 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
296/* to find an entry in a kernel page-table-directory */ 652/* to find an entry in a kernel page-table-directory */
297#define pgd_offset_k(address) pgd_offset(&init_mm, address) 653#define pgd_offset_k(address) pgd_offset(&init_mm, address)
298 654
299/* extract the pgd cache used for optimizing the tlb miss
300 * slow path when executing 32-bit compat processes
301 */
302#define get_pgd_cache(pgd) ((unsigned long) pgd_val(*pgd) << 11)
303
304/* Find an entry in the second-level page table.. */ 655/* Find an entry in the second-level page table.. */
305#define pmd_offset(pudp, address) \ 656#define pmd_offset(pudp, address) \
306 ((pmd_t *) pud_page(*(pudp)) + \ 657 ((pmd_t *) pud_page(*(pudp)) + \
@@ -327,6 +678,9 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *p
327 678
328 /* It is more efficient to let flush_tlb_kernel_range() 679 /* It is more efficient to let flush_tlb_kernel_range()
329 * handle init_mm tlb flushes. 680 * handle init_mm tlb flushes.
681 *
682 * SUN4V NOTE: _PAGE_VALID is the same value in both the SUN4U
683 * and SUN4V pte layout, so this inline test is fine.
330 */ 684 */
331 if (likely(mm != &init_mm) && (pte_val(orig) & _PAGE_VALID)) 685 if (likely(mm != &init_mm) && (pte_val(orig) & _PAGE_VALID))
332 tlb_batch_add(mm, addr, ptep, orig); 686 tlb_batch_add(mm, addr, ptep, orig);
@@ -361,42 +715,23 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
361#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 715#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
362 716
363/* File offset in PTE support. */ 717/* File offset in PTE support. */
364#define pte_file(pte) (pte_val(pte) & _PAGE_FILE) 718extern unsigned long pte_file(pte_t);
365#define pte_to_pgoff(pte) (pte_val(pte) >> PAGE_SHIFT) 719#define pte_to_pgoff(pte) (pte_val(pte) >> PAGE_SHIFT)
366#define pgoff_to_pte(off) (__pte(((off) << PAGE_SHIFT) | _PAGE_FILE)) 720extern pte_t pgoff_to_pte(unsigned long);
367#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) 721#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL)
368 722
369extern unsigned long prom_virt_to_phys(unsigned long, int *); 723extern unsigned long prom_virt_to_phys(unsigned long, int *);
370 724
371static __inline__ unsigned long 725extern unsigned long sun4u_get_pte(unsigned long);
372sun4u_get_pte (unsigned long addr)
373{
374 pgd_t *pgdp;
375 pud_t *pudp;
376 pmd_t *pmdp;
377 pte_t *ptep;
378
379 if (addr >= PAGE_OFFSET)
380 return addr & _PAGE_PADDR;
381 if ((addr >= LOW_OBP_ADDRESS) && (addr < HI_OBP_ADDRESS))
382 return prom_virt_to_phys(addr, NULL);
383 pgdp = pgd_offset_k(addr);
384 pudp = pud_offset(pgdp, addr);
385 pmdp = pmd_offset(pudp, addr);
386 ptep = pte_offset_kernel(pmdp, addr);
387 return pte_val(*ptep) & _PAGE_PADDR;
388}
389 726
390static __inline__ unsigned long 727static inline unsigned long __get_phys(unsigned long addr)
391__get_phys (unsigned long addr)
392{ 728{
393 return sun4u_get_pte (addr); 729 return sun4u_get_pte(addr);
394} 730}
395 731
396static __inline__ int 732static inline int __get_iospace(unsigned long addr)
397__get_iospace (unsigned long addr)
398{ 733{
399 return ((sun4u_get_pte (addr) & 0xf0000000) >> 28); 734 return ((sun4u_get_pte(addr) & 0xf0000000) >> 28);
400} 735}
401 736
402extern unsigned long *sparc64_valid_addr_bitmap; 737extern unsigned long *sparc64_valid_addr_bitmap;
@@ -409,11 +744,6 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
409 unsigned long pfn, 744 unsigned long pfn,
410 unsigned long size, pgprot_t prot); 745 unsigned long size, pgprot_t prot);
411 746
412/* Clear virtual and physical cachability, set side-effect bit. */
413#define pgprot_noncached(prot) \
414 (__pgprot((pgprot_val(prot) & ~(_PAGE_CP | _PAGE_CV)) | \
415 _PAGE_E))
416
417/* 747/*
418 * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in 748 * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in
419 * its high 4 bits. These macros/functions put it there or get it from there. 749 * its high 4 bits. These macros/functions put it there or get it from there.
@@ -424,8 +754,11 @@ extern int io_remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
424 754
425#include <asm-generic/pgtable.h> 755#include <asm-generic/pgtable.h>
426 756
427/* We provide our own get_unmapped_area to cope with VA holes for userland */ 757/* We provide our own get_unmapped_area to cope with VA holes and
758 * SHM area cache aliasing for userland.
759 */
428#define HAVE_ARCH_UNMAPPED_AREA 760#define HAVE_ARCH_UNMAPPED_AREA
761#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
429 762
430/* We provide a special get_unmapped_area for framebuffer mmaps to try and use 763/* We provide a special get_unmapped_area for framebuffer mmaps to try and use
431 * the largest alignment possible such that larget PTEs can be used. 764 * the largest alignment possible such that larget PTEs can be used.
@@ -435,12 +768,9 @@ extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long,
435 unsigned long); 768 unsigned long);
436#define HAVE_ARCH_FB_UNMAPPED_AREA 769#define HAVE_ARCH_FB_UNMAPPED_AREA
437 770
438/* 771extern void pgtable_cache_init(void);
439 * No page table caches to initialise 772extern void sun4v_register_fault_status(void);
440 */ 773extern void sun4v_ktsb_register(void);
441#define pgtable_cache_init() do { } while (0)
442
443extern void check_pgt_cache(void);
444 774
445#endif /* !(__ASSEMBLY__) */ 775#endif /* !(__ASSEMBLY__) */
446 776
diff --git a/include/asm-sparc64/pil.h b/include/asm-sparc64/pil.h
index 8f87750c3517..79f827eb3f5d 100644
--- a/include/asm-sparc64/pil.h
+++ b/include/asm-sparc64/pil.h
@@ -16,11 +16,13 @@
16#define PIL_SMP_CALL_FUNC 1 16#define PIL_SMP_CALL_FUNC 1
17#define PIL_SMP_RECEIVE_SIGNAL 2 17#define PIL_SMP_RECEIVE_SIGNAL 2
18#define PIL_SMP_CAPTURE 3 18#define PIL_SMP_CAPTURE 3
19#define PIL_SMP_CTX_NEW_VERSION 4
19 20
20#ifndef __ASSEMBLY__ 21#ifndef __ASSEMBLY__
21#define PIL_RESERVED(PIL) ((PIL) == PIL_SMP_CALL_FUNC || \ 22#define PIL_RESERVED(PIL) ((PIL) == PIL_SMP_CALL_FUNC || \
22 (PIL) == PIL_SMP_RECEIVE_SIGNAL || \ 23 (PIL) == PIL_SMP_RECEIVE_SIGNAL || \
23 (PIL) == PIL_SMP_CAPTURE) 24 (PIL) == PIL_SMP_CAPTURE || \
25 (PIL) == PIL_SMP_CTX_NEW_VERSION)
24#endif 26#endif
25 27
26#endif /* !(_SPARC64_PIL_H) */ 28#endif /* !(_SPARC64_PIL_H) */
diff --git a/include/asm-sparc64/poll.h b/include/asm-sparc64/poll.h
index 31b611aa7468..ab6b0d1bb4ad 100644
--- a/include/asm-sparc64/poll.h
+++ b/include/asm-sparc64/poll.h
@@ -13,6 +13,7 @@
13#define POLLWRBAND 256 13#define POLLWRBAND 256
14#define POLLMSG 512 14#define POLLMSG 512
15#define POLLREMOVE 1024 15#define POLLREMOVE 1024
16#define POLLRDHUP 2048
16 17
17struct pollfd { 18struct pollfd {
18 int fd; 19 int fd;
diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h
index cd8d9b4c8658..c6896b88283e 100644
--- a/include/asm-sparc64/processor.h
+++ b/include/asm-sparc64/processor.h
@@ -28,6 +28,8 @@
28 * User lives in his very own context, and cannot reference us. Note 28 * User lives in his very own context, and cannot reference us. Note
29 * that TASK_SIZE is a misnomer, it really gives maximum user virtual 29 * that TASK_SIZE is a misnomer, it really gives maximum user virtual
30 * address that the kernel will allocate out. 30 * address that the kernel will allocate out.
31 *
32 * XXX No longer using virtual page tables, kill this upper limit...
31 */ 33 */
32#define VA_BITS 44 34#define VA_BITS 44
33#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
@@ -37,18 +39,6 @@
37#endif 39#endif
38#define TASK_SIZE ((unsigned long)-VPTE_SIZE) 40#define TASK_SIZE ((unsigned long)-VPTE_SIZE)
39 41
40/*
41 * The vpte base must be able to hold the entire vpte, half
42 * of which lives above, and half below, the base. And it
43 * is placed as close to the highest address range as possible.
44 */
45#define VPTE_BASE_SPITFIRE (-(VPTE_SIZE/2))
46#if 1
47#define VPTE_BASE_CHEETAH VPTE_BASE_SPITFIRE
48#else
49#define VPTE_BASE_CHEETAH 0xffe0000000000000
50#endif
51
52#ifndef __ASSEMBLY__ 42#ifndef __ASSEMBLY__
53 43
54typedef struct { 44typedef struct {
@@ -101,7 +91,8 @@ extern unsigned long thread_saved_pc(struct task_struct *);
101/* Do necessary setup to start up a newly executed thread. */ 91/* Do necessary setup to start up a newly executed thread. */
102#define start_thread(regs, pc, sp) \ 92#define start_thread(regs, pc, sp) \
103do { \ 93do { \
104 regs->tstate = (regs->tstate & (TSTATE_CWP)) | (TSTATE_INITIAL_MM|TSTATE_IE) | (ASI_PNF << 24); \ 94 unsigned long __asi = ASI_PNF; \
95 regs->tstate = (regs->tstate & (TSTATE_CWP)) | (TSTATE_INITIAL_MM|TSTATE_IE) | (__asi << 24UL); \
105 regs->tpc = ((pc & (~3)) - 4); \ 96 regs->tpc = ((pc & (~3)) - 4); \
106 regs->tnpc = regs->tpc + 4; \ 97 regs->tnpc = regs->tpc + 4; \
107 regs->y = 0; \ 98 regs->y = 0; \
@@ -138,10 +129,10 @@ do { \
138 129
139#define start_thread32(regs, pc, sp) \ 130#define start_thread32(regs, pc, sp) \
140do { \ 131do { \
132 unsigned long __asi = ASI_PNF; \
141 pc &= 0x00000000ffffffffUL; \ 133 pc &= 0x00000000ffffffffUL; \
142 sp &= 0x00000000ffffffffUL; \ 134 sp &= 0x00000000ffffffffUL; \
143\ 135 regs->tstate = (regs->tstate & (TSTATE_CWP))|(TSTATE_INITIAL_MM|TSTATE_IE|TSTATE_AM) | (__asi << 24UL); \
144 regs->tstate = (regs->tstate & (TSTATE_CWP))|(TSTATE_INITIAL_MM|TSTATE_IE|TSTATE_AM); \
145 regs->tpc = ((pc & (~3)) - 4); \ 136 regs->tpc = ((pc & (~3)) - 4); \
146 regs->tnpc = regs->tpc + 4; \ 137 regs->tnpc = regs->tpc + 4; \
147 regs->y = 0; \ 138 regs->y = 0; \
@@ -226,6 +217,8 @@ static inline void prefetchw(const void *x)
226 217
227#define spin_lock_prefetch(x) prefetchw(x) 218#define spin_lock_prefetch(x) prefetchw(x)
228 219
220#define HAVE_ARCH_PICK_MMAP_LAYOUT
221
229#endif /* !(__ASSEMBLY__) */ 222#endif /* !(__ASSEMBLY__) */
230 223
231#endif /* !(__ASM_SPARC64_PROCESSOR_H) */ 224#endif /* !(__ASM_SPARC64_PROCESSOR_H) */
diff --git a/include/asm-sparc64/pstate.h b/include/asm-sparc64/pstate.h
index 29fb74aa805d..49a7924a89ab 100644
--- a/include/asm-sparc64/pstate.h
+++ b/include/asm-sparc64/pstate.h
@@ -28,11 +28,12 @@
28 28
29/* The V9 TSTATE Register (with SpitFire and Linux extensions). 29/* The V9 TSTATE Register (with SpitFire and Linux extensions).
30 * 30 *
31 * --------------------------------------------------------------- 31 * ---------------------------------------------------------------------
32 * | Resv | CCR | ASI | %pil | PSTATE | Resv | CWP | 32 * | Resv | GL | CCR | ASI | %pil | PSTATE | Resv | CWP |
33 * --------------------------------------------------------------- 33 * ---------------------------------------------------------------------
34 * 63 40 39 32 31 24 23 20 19 8 7 5 4 0 34 * 63 43 42 40 39 32 31 24 23 20 19 8 7 5 4 0
35 */ 35 */
36#define TSTATE_GL _AC(0x0000070000000000,UL) /* Global reg level */
36#define TSTATE_CCR _AC(0x000000ff00000000,UL) /* Condition Codes. */ 37#define TSTATE_CCR _AC(0x000000ff00000000,UL) /* Condition Codes. */
37#define TSTATE_XCC _AC(0x000000f000000000,UL) /* Condition Codes. */ 38#define TSTATE_XCC _AC(0x000000f000000000,UL) /* Condition Codes. */
38#define TSTATE_XNEG _AC(0x0000008000000000,UL) /* %xcc Negative. */ 39#define TSTATE_XNEG _AC(0x0000008000000000,UL) /* %xcc Negative. */
diff --git a/include/asm-sparc64/scratchpad.h b/include/asm-sparc64/scratchpad.h
new file mode 100644
index 000000000000..5e8b01fb3343
--- /dev/null
+++ b/include/asm-sparc64/scratchpad.h
@@ -0,0 +1,14 @@
1#ifndef _SPARC64_SCRATCHPAD_H
2#define _SPARC64_SCRATCHPAD_H
3
4/* Sun4v scratchpad registers, accessed via ASI_SCRATCHPAD. */
5
6#define SCRATCHPAD_MMU_MISS 0x00 /* Shared with OBP - set by OBP */
7#define SCRATCHPAD_CPUID 0x08 /* Shared with OBP - set by hypervisor */
8#define SCRATCHPAD_UTSBREG1 0x10
9#define SCRATCHPAD_UTSBREG2 0x18
10 /* 0x20 and 0x28, hypervisor only... */
11#define SCRATCHPAD_UNUSED1 0x30
12#define SCRATCHPAD_UNUSED2 0x38 /* Reserved for OBP */
13
14#endif /* !(_SPARC64_SCRATCHPAD_H) */
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index 473edb2603ec..89d86ecaab24 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -33,37 +33,13 @@
33extern cpumask_t phys_cpu_present_map; 33extern cpumask_t phys_cpu_present_map;
34#define cpu_possible_map phys_cpu_present_map 34#define cpu_possible_map phys_cpu_present_map
35 35
36extern cpumask_t cpu_sibling_map[NR_CPUS];
37
36/* 38/*
37 * General functions that each host system must provide. 39 * General functions that each host system must provide.
38 */ 40 */
39 41
40static __inline__ int hard_smp_processor_id(void) 42extern int hard_smp_processor_id(void);
41{
42 if (tlb_type == cheetah || tlb_type == cheetah_plus) {
43 unsigned long cfg, ver;
44 __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
45 if ((ver >> 32) == 0x003e0016) {
46 __asm__ __volatile__("ldxa [%%g0] %1, %0"
47 : "=r" (cfg)
48 : "i" (ASI_JBUS_CONFIG));
49 return ((cfg >> 17) & 0x1f);
50 } else {
51 __asm__ __volatile__("ldxa [%%g0] %1, %0"
52 : "=r" (cfg)
53 : "i" (ASI_SAFARI_CONFIG));
54 return ((cfg >> 17) & 0x3ff);
55 }
56 } else if (this_is_starfire != 0) {
57 return starfire_hard_smp_processor_id();
58 } else {
59 unsigned long upaconfig;
60 __asm__ __volatile__("ldxa [%%g0] %1, %0"
61 : "=r" (upaconfig)
62 : "i" (ASI_UPA_CONFIG));
63 return ((upaconfig >> 17) & 0x1f);
64 }
65}
66
67#define raw_smp_processor_id() (current_thread_info()->cpu) 43#define raw_smp_processor_id() (current_thread_info()->cpu)
68 44
69extern void smp_setup_cpu_possible_map(void); 45extern void smp_setup_cpu_possible_map(void);
diff --git a/include/asm-sparc64/sparsemem.h b/include/asm-sparc64/sparsemem.h
new file mode 100644
index 000000000000..ed5c9d8541e2
--- /dev/null
+++ b/include/asm-sparc64/sparsemem.h
@@ -0,0 +1,12 @@
1#ifndef _SPARC64_SPARSEMEM_H
2#define _SPARC64_SPARSEMEM_H
3
4#ifdef __KERNEL__
5
6#define SECTION_SIZE_BITS 26
7#define MAX_PHYSADDR_BITS 42
8#define MAX_PHYSMEM_BITS 42
9
10#endif /* !(__KERNEL__) */
11
12#endif /* !(_SPARC64_SPARSEMEM_H) */
diff --git a/include/asm-sparc64/spitfire.h b/include/asm-sparc64/spitfire.h
index 962638c9d122..23ad8a7987ad 100644
--- a/include/asm-sparc64/spitfire.h
+++ b/include/asm-sparc64/spitfire.h
@@ -44,6 +44,7 @@ enum ultra_tlb_layout {
44 spitfire = 0, 44 spitfire = 0,
45 cheetah = 1, 45 cheetah = 1,
46 cheetah_plus = 2, 46 cheetah_plus = 2,
47 hypervisor = 3,
47}; 48};
48 49
49extern enum ultra_tlb_layout tlb_type; 50extern enum ultra_tlb_layout tlb_type;
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index af254e581834..a18ec87a52c1 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -209,9 +209,10 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
209 /* so that ASI is only written if it changes, think again. */ \ 209 /* so that ASI is only written if it changes, think again. */ \
210 __asm__ __volatile__("wr %%g0, %0, %%asi" \ 210 __asm__ __volatile__("wr %%g0, %0, %%asi" \
211 : : "r" (__thread_flag_byte_ptr(task_thread_info(next))[TI_FLAG_BYTE_CURRENT_DS]));\ 211 : : "r" (__thread_flag_byte_ptr(task_thread_info(next))[TI_FLAG_BYTE_CURRENT_DS]));\
212 trap_block[current_thread_info()->cpu].thread = \
213 task_thread_info(next); \
212 __asm__ __volatile__( \ 214 __asm__ __volatile__( \
213 "mov %%g4, %%g7\n\t" \ 215 "mov %%g4, %%g7\n\t" \
214 "wrpr %%g0, 0x95, %%pstate\n\t" \
215 "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \ 216 "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \
216 "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \ 217 "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \
217 "rdpr %%wstate, %%o5\n\t" \ 218 "rdpr %%wstate, %%o5\n\t" \
@@ -225,14 +226,10 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
225 "ldx [%%g6 + %3], %%o6\n\t" \ 226 "ldx [%%g6 + %3], %%o6\n\t" \
226 "ldub [%%g6 + %2], %%o5\n\t" \ 227 "ldub [%%g6 + %2], %%o5\n\t" \
227 "ldub [%%g6 + %4], %%o7\n\t" \ 228 "ldub [%%g6 + %4], %%o7\n\t" \
228 "mov %%g6, %%l2\n\t" \
229 "wrpr %%o5, 0x0, %%wstate\n\t" \ 229 "wrpr %%o5, 0x0, %%wstate\n\t" \
230 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ 230 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \
231 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ 231 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \
232 "wrpr %%g0, 0x94, %%pstate\n\t" \
233 "mov %%l2, %%g6\n\t" \
234 "ldx [%%g6 + %6], %%g4\n\t" \ 232 "ldx [%%g6 + %6], %%g4\n\t" \
235 "wrpr %%g0, 0x96, %%pstate\n\t" \
236 "brz,pt %%o7, 1f\n\t" \ 233 "brz,pt %%o7, 1f\n\t" \
237 " mov %%g7, %0\n\t" \ 234 " mov %%g7, %0\n\t" \
238 "b,a ret_from_syscall\n\t" \ 235 "b,a ret_from_syscall\n\t" \
diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h
index ac9d068aab4f..2ebf7f27bf91 100644
--- a/include/asm-sparc64/thread_info.h
+++ b/include/asm-sparc64/thread_info.h
@@ -64,8 +64,6 @@ struct thread_info {
64 __u64 kernel_cntd0, kernel_cntd1; 64 __u64 kernel_cntd0, kernel_cntd1;
65 __u64 pcr_reg; 65 __u64 pcr_reg;
66 66
67 __u64 cee_stuff;
68
69 struct restart_block restart_block; 67 struct restart_block restart_block;
70 68
71 struct pt_regs *kern_una_regs; 69 struct pt_regs *kern_una_regs;
@@ -104,10 +102,9 @@ struct thread_info {
104#define TI_KERN_CNTD0 0x00000480 102#define TI_KERN_CNTD0 0x00000480
105#define TI_KERN_CNTD1 0x00000488 103#define TI_KERN_CNTD1 0x00000488
106#define TI_PCR 0x00000490 104#define TI_PCR 0x00000490
107#define TI_CEE_STUFF 0x00000498 105#define TI_RESTART_BLOCK 0x00000498
108#define TI_RESTART_BLOCK 0x000004a0 106#define TI_KUNA_REGS 0x000004c0
109#define TI_KUNA_REGS 0x000004c8 107#define TI_KUNA_INSN 0x000004c8
110#define TI_KUNA_INSN 0x000004d0
111#define TI_FPREGS 0x00000500 108#define TI_FPREGS 0x00000500
112 109
113/* We embed this in the uppermost byte of thread_info->flags */ 110/* We embed this in the uppermost byte of thread_info->flags */
diff --git a/include/asm-sparc64/timex.h b/include/asm-sparc64/timex.h
index 9e8d4175bcb2..2a5e4ebaad80 100644
--- a/include/asm-sparc64/timex.h
+++ b/include/asm-sparc64/timex.h
@@ -14,4 +14,10 @@
14typedef unsigned long cycles_t; 14typedef unsigned long cycles_t;
15#define get_cycles() tick_ops->get_tick() 15#define get_cycles() tick_ops->get_tick()
16 16
17#define ARCH_HAS_READ_CURRENT_TIMER 1
18#define read_current_timer(timer_val_p) \
19({ *timer_val_p = tick_ops->get_tick(); \
20 0; \
21})
22
17#endif 23#endif
diff --git a/include/asm-sparc64/tlbflush.h b/include/asm-sparc64/tlbflush.h
index 3ef9909ac3ac..9ad5d9c51d42 100644
--- a/include/asm-sparc64/tlbflush.h
+++ b/include/asm-sparc64/tlbflush.h
@@ -5,6 +5,11 @@
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <asm/mmu_context.h> 6#include <asm/mmu_context.h>
7 7
8/* TSB flush operations. */
9struct mmu_gather;
10extern void flush_tsb_kernel_range(unsigned long start, unsigned long end);
11extern void flush_tsb_user(struct mmu_gather *mp);
12
8/* TLB flush operations. */ 13/* TLB flush operations. */
9 14
10extern void flush_tlb_pending(void); 15extern void flush_tlb_pending(void);
@@ -14,28 +19,36 @@ extern void flush_tlb_pending(void);
14#define flush_tlb_page(vma,addr) flush_tlb_pending() 19#define flush_tlb_page(vma,addr) flush_tlb_pending()
15#define flush_tlb_mm(mm) flush_tlb_pending() 20#define flush_tlb_mm(mm) flush_tlb_pending()
16 21
22/* Local cpu only. */
17extern void __flush_tlb_all(void); 23extern void __flush_tlb_all(void);
24
18extern void __flush_tlb_page(unsigned long context, unsigned long page, unsigned long r); 25extern void __flush_tlb_page(unsigned long context, unsigned long page, unsigned long r);
19 26
20extern void __flush_tlb_kernel_range(unsigned long start, unsigned long end); 27extern void __flush_tlb_kernel_range(unsigned long start, unsigned long end);
21 28
22#ifndef CONFIG_SMP 29#ifndef CONFIG_SMP
23 30
24#define flush_tlb_all() __flush_tlb_all()
25#define flush_tlb_kernel_range(start,end) \ 31#define flush_tlb_kernel_range(start,end) \
26 __flush_tlb_kernel_range(start,end) 32do { flush_tsb_kernel_range(start,end); \
33 __flush_tlb_kernel_range(start,end); \
34} while (0)
27 35
28#else /* CONFIG_SMP */ 36#else /* CONFIG_SMP */
29 37
30extern void smp_flush_tlb_all(void);
31extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end); 38extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end);
32 39
33#define flush_tlb_all() smp_flush_tlb_all()
34#define flush_tlb_kernel_range(start, end) \ 40#define flush_tlb_kernel_range(start, end) \
35 smp_flush_tlb_kernel_range(start, end) 41do { flush_tsb_kernel_range(start,end); \
42 smp_flush_tlb_kernel_range(start, end); \
43} while (0)
36 44
37#endif /* ! CONFIG_SMP */ 45#endif /* ! CONFIG_SMP */
38 46
39extern void flush_tlb_pgtables(struct mm_struct *, unsigned long, unsigned long); 47static inline void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start, unsigned long end)
48{
49 /* We don't use virtual page tables for TLB miss processing
50 * any more. Nowadays we use the TSB.
51 */
52}
40 53
41#endif /* _SPARC64_TLBFLUSH_H */ 54#endif /* _SPARC64_TLBFLUSH_H */
diff --git a/include/asm-sparc64/tsb.h b/include/asm-sparc64/tsb.h
new file mode 100644
index 000000000000..e82612cd9f33
--- /dev/null
+++ b/include/asm-sparc64/tsb.h
@@ -0,0 +1,281 @@
1#ifndef _SPARC64_TSB_H
2#define _SPARC64_TSB_H
3
4/* The sparc64 TSB is similar to the powerpc hashtables. It's a
5 * power-of-2 sized table of TAG/PTE pairs. The cpu precomputes
6 * pointers into this table for 8K and 64K page sizes, and also a
7 * comparison TAG based upon the virtual address and context which
8 * faults.
9 *
10 * TLB miss trap handler software does the actual lookup via something
11 * of the form:
12 *
13 * ldxa [%g0] ASI_{D,I}MMU_TSB_8KB_PTR, %g1
14 * ldxa [%g0] ASI_{D,I}MMU, %g6
15 * sllx %g6, 22, %g6
16 * srlx %g6, 22, %g6
17 * ldda [%g1] ASI_NUCLEUS_QUAD_LDD, %g4
18 * cmp %g4, %g6
19 * bne,pn %xcc, tsb_miss_{d,i}tlb
20 * mov FAULT_CODE_{D,I}TLB, %g3
21 * stxa %g5, [%g0] ASI_{D,I}TLB_DATA_IN
22 * retry
23 *
24 *
25 * Each 16-byte slot of the TSB is the 8-byte tag and then the 8-byte
26 * PTE. The TAG is of the same layout as the TLB TAG TARGET mmu
27 * register which is:
28 *
29 * -------------------------------------------------
30 * | - | CONTEXT | - | VADDR bits 63:22 |
31 * -------------------------------------------------
32 * 63 61 60 48 47 42 41 0
33 *
34 * But actually, since we use per-mm TSB's, we zero out the CONTEXT
35 * field.
36 *
37 * Like the powerpc hashtables we need to use locking in order to
38 * synchronize while we update the entries. PTE updates need locking
39 * as well.
40 *
41 * We need to carefully choose a lock bits for the TSB entry. We
42 * choose to use bit 47 in the tag. Also, since we never map anything
43 * at page zero in context zero, we use zero as an invalid tag entry.
44 * When the lock bit is set, this forces a tag comparison failure.
45 */
46
47#define TSB_TAG_LOCK_BIT 47
48#define TSB_TAG_LOCK_HIGH (1 << (TSB_TAG_LOCK_BIT - 32))
49
50#define TSB_TAG_INVALID_BIT 46
51#define TSB_TAG_INVALID_HIGH (1 << (TSB_TAG_INVALID_BIT - 32))
52
53#define TSB_MEMBAR membar #StoreStore
54
55/* Some cpus support physical address quad loads. We want to use
56 * those if possible so we don't need to hard-lock the TSB mapping
57 * into the TLB. We encode some instruction patching in order to
58 * support this.
59 *
60 * The kernel TSB is locked into the TLB by virtue of being in the
61 * kernel image, so we don't play these games for swapper_tsb access.
62 */
63#ifndef __ASSEMBLY__
64struct tsb_ldquad_phys_patch_entry {
65 unsigned int addr;
66 unsigned int sun4u_insn;
67 unsigned int sun4v_insn;
68};
69extern struct tsb_ldquad_phys_patch_entry __tsb_ldquad_phys_patch,
70 __tsb_ldquad_phys_patch_end;
71
72struct tsb_phys_patch_entry {
73 unsigned int addr;
74 unsigned int insn;
75};
76extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
77#endif
78#define TSB_LOAD_QUAD(TSB, REG) \
79661: ldda [TSB] ASI_NUCLEUS_QUAD_LDD, REG; \
80 .section .tsb_ldquad_phys_patch, "ax"; \
81 .word 661b; \
82 ldda [TSB] ASI_QUAD_LDD_PHYS, REG; \
83 ldda [TSB] ASI_QUAD_LDD_PHYS_4V, REG; \
84 .previous
85
86#define TSB_LOAD_TAG_HIGH(TSB, REG) \
87661: lduwa [TSB] ASI_N, REG; \
88 .section .tsb_phys_patch, "ax"; \
89 .word 661b; \
90 lduwa [TSB] ASI_PHYS_USE_EC, REG; \
91 .previous
92
93#define TSB_LOAD_TAG(TSB, REG) \
94661: ldxa [TSB] ASI_N, REG; \
95 .section .tsb_phys_patch, "ax"; \
96 .word 661b; \
97 ldxa [TSB] ASI_PHYS_USE_EC, REG; \
98 .previous
99
100#define TSB_CAS_TAG_HIGH(TSB, REG1, REG2) \
101661: casa [TSB] ASI_N, REG1, REG2; \
102 .section .tsb_phys_patch, "ax"; \
103 .word 661b; \
104 casa [TSB] ASI_PHYS_USE_EC, REG1, REG2; \
105 .previous
106
107#define TSB_CAS_TAG(TSB, REG1, REG2) \
108661: casxa [TSB] ASI_N, REG1, REG2; \
109 .section .tsb_phys_patch, "ax"; \
110 .word 661b; \
111 casxa [TSB] ASI_PHYS_USE_EC, REG1, REG2; \
112 .previous
113
114#define TSB_STORE(ADDR, VAL) \
115661: stxa VAL, [ADDR] ASI_N; \
116 .section .tsb_phys_patch, "ax"; \
117 .word 661b; \
118 stxa VAL, [ADDR] ASI_PHYS_USE_EC; \
119 .previous
120
121#define TSB_LOCK_TAG(TSB, REG1, REG2) \
12299: TSB_LOAD_TAG_HIGH(TSB, REG1); \
123 sethi %hi(TSB_TAG_LOCK_HIGH), REG2;\
124 andcc REG1, REG2, %g0; \
125 bne,pn %icc, 99b; \
126 nop; \
127 TSB_CAS_TAG_HIGH(TSB, REG1, REG2); \
128 cmp REG1, REG2; \
129 bne,pn %icc, 99b; \
130 nop; \
131 TSB_MEMBAR
132
133#define TSB_WRITE(TSB, TTE, TAG) \
134 add TSB, 0x8, TSB; \
135 TSB_STORE(TSB, TTE); \
136 sub TSB, 0x8, TSB; \
137 TSB_MEMBAR; \
138 TSB_STORE(TSB, TAG);
139
140#define KTSB_LOAD_QUAD(TSB, REG) \
141 ldda [TSB] ASI_NUCLEUS_QUAD_LDD, REG;
142
143#define KTSB_STORE(ADDR, VAL) \
144 stxa VAL, [ADDR] ASI_N;
145
146#define KTSB_LOCK_TAG(TSB, REG1, REG2) \
14799: lduwa [TSB] ASI_N, REG1; \
148 sethi %hi(TSB_TAG_LOCK_HIGH), REG2;\
149 andcc REG1, REG2, %g0; \
150 bne,pn %icc, 99b; \
151 nop; \
152 casa [TSB] ASI_N, REG1, REG2;\
153 cmp REG1, REG2; \
154 bne,pn %icc, 99b; \
155 nop; \
156 TSB_MEMBAR
157
158#define KTSB_WRITE(TSB, TTE, TAG) \
159 add TSB, 0x8, TSB; \
160 stxa TTE, [TSB] ASI_N; \
161 sub TSB, 0x8, TSB; \
162 TSB_MEMBAR; \
163 stxa TAG, [TSB] ASI_N;
164
165 /* Do a kernel page table walk. Leaves physical PTE pointer in
166 * REG1. Jumps to FAIL_LABEL on early page table walk termination.
167 * VADDR will not be clobbered, but REG2 will.
168 */
169#define KERN_PGTABLE_WALK(VADDR, REG1, REG2, FAIL_LABEL) \
170 sethi %hi(swapper_pg_dir), REG1; \
171 or REG1, %lo(swapper_pg_dir), REG1; \
172 sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
173 srlx REG2, 64 - PAGE_SHIFT, REG2; \
174 andn REG2, 0x3, REG2; \
175 lduw [REG1 + REG2], REG1; \
176 brz,pn REG1, FAIL_LABEL; \
177 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
178 srlx REG2, 64 - PAGE_SHIFT, REG2; \
179 sllx REG1, 11, REG1; \
180 andn REG2, 0x3, REG2; \
181 lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
182 brz,pn REG1, FAIL_LABEL; \
183 sllx VADDR, 64 - PMD_SHIFT, REG2; \
184 srlx REG2, 64 - PAGE_SHIFT, REG2; \
185 sllx REG1, 11, REG1; \
186 andn REG2, 0x7, REG2; \
187 add REG1, REG2, REG1;
188
189 /* Do a user page table walk in MMU globals. Leaves physical PTE
190 * pointer in REG1. Jumps to FAIL_LABEL on early page table walk
191 * termination. Physical base of page tables is in PHYS_PGD which
192 * will not be modified.
193 *
194 * VADDR will not be clobbered, but REG1 and REG2 will.
195 */
196#define USER_PGTABLE_WALK_TL1(VADDR, PHYS_PGD, REG1, REG2, FAIL_LABEL) \
197 sllx VADDR, 64 - (PGDIR_SHIFT + PGDIR_BITS), REG2; \
198 srlx REG2, 64 - PAGE_SHIFT, REG2; \
199 andn REG2, 0x3, REG2; \
200 lduwa [PHYS_PGD + REG2] ASI_PHYS_USE_EC, REG1; \
201 brz,pn REG1, FAIL_LABEL; \
202 sllx VADDR, 64 - (PMD_SHIFT + PMD_BITS), REG2; \
203 srlx REG2, 64 - PAGE_SHIFT, REG2; \
204 sllx REG1, 11, REG1; \
205 andn REG2, 0x3, REG2; \
206 lduwa [REG1 + REG2] ASI_PHYS_USE_EC, REG1; \
207 brz,pn REG1, FAIL_LABEL; \
208 sllx VADDR, 64 - PMD_SHIFT, REG2; \
209 srlx REG2, 64 - PAGE_SHIFT, REG2; \
210 sllx REG1, 11, REG1; \
211 andn REG2, 0x7, REG2; \
212 add REG1, REG2, REG1;
213
214/* Lookup a OBP mapping on VADDR in the prom_trans[] table at TL>0.
215 * If no entry is found, FAIL_LABEL will be branched to. On success
216 * the resulting PTE value will be left in REG1. VADDR is preserved
217 * by this routine.
218 */
219#define OBP_TRANS_LOOKUP(VADDR, REG1, REG2, REG3, FAIL_LABEL) \
220 sethi %hi(prom_trans), REG1; \
221 or REG1, %lo(prom_trans), REG1; \
22297: ldx [REG1 + 0x00], REG2; \
223 brz,pn REG2, FAIL_LABEL; \
224 nop; \
225 ldx [REG1 + 0x08], REG3; \
226 add REG2, REG3, REG3; \
227 cmp REG2, VADDR; \
228 bgu,pt %xcc, 98f; \
229 cmp VADDR, REG3; \
230 bgeu,pt %xcc, 98f; \
231 ldx [REG1 + 0x10], REG3; \
232 sub VADDR, REG2, REG2; \
233 ba,pt %xcc, 99f; \
234 add REG3, REG2, REG1; \
23598: ba,pt %xcc, 97b; \
236 add REG1, (3 * 8), REG1; \
23799:
238
239 /* We use a 32K TSB for the whole kernel, this allows to
240 * handle about 16MB of modules and vmalloc mappings without
241 * incurring many hash conflicts.
242 */
243#define KERNEL_TSB_SIZE_BYTES (32 * 1024)
244#define KERNEL_TSB_NENTRIES \
245 (KERNEL_TSB_SIZE_BYTES / 16)
246#define KERNEL_TSB4M_NENTRIES 4096
247
248 /* Do a kernel TSB lookup at tl>0 on VADDR+TAG, branch to OK_LABEL
249 * on TSB hit. REG1, REG2, REG3, and REG4 are used as temporaries
250 * and the found TTE will be left in REG1. REG3 and REG4 must
251 * be an even/odd pair of registers.
252 *
253 * VADDR and TAG will be preserved and not clobbered by this macro.
254 */
255#define KERN_TSB_LOOKUP_TL1(VADDR, TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
256 sethi %hi(swapper_tsb), REG1; \
257 or REG1, %lo(swapper_tsb), REG1; \
258 srlx VADDR, PAGE_SHIFT, REG2; \
259 and REG2, (KERNEL_TSB_NENTRIES - 1), REG2; \
260 sllx REG2, 4, REG2; \
261 add REG1, REG2, REG2; \
262 KTSB_LOAD_QUAD(REG2, REG3); \
263 cmp REG3, TAG; \
264 be,a,pt %xcc, OK_LABEL; \
265 mov REG4, REG1;
266
267 /* This version uses a trick, the TAG is already (VADDR >> 22) so
268 * we can make use of that for the index computation.
269 */
270#define KERN_TSB4M_LOOKUP_TL1(TAG, REG1, REG2, REG3, REG4, OK_LABEL) \
271 sethi %hi(swapper_4m_tsb), REG1; \
272 or REG1, %lo(swapper_4m_tsb), REG1; \
273 and TAG, (KERNEL_TSB_NENTRIES - 1), REG2; \
274 sllx REG2, 4, REG2; \
275 add REG1, REG2, REG2; \
276 KTSB_LOAD_QUAD(REG2, REG3); \
277 cmp REG3, TAG; \
278 be,a,pt %xcc, OK_LABEL; \
279 mov REG4, REG1;
280
281#endif /* !(_SPARC64_TSB_H) */
diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h
index 2784f80094c3..2d5e3c464df5 100644
--- a/include/asm-sparc64/ttable.h
+++ b/include/asm-sparc64/ttable.h
@@ -93,7 +93,7 @@
93 93
94#define SYSCALL_TRAP(routine, systbl) \ 94#define SYSCALL_TRAP(routine, systbl) \
95 sethi %hi(109f), %g7; \ 95 sethi %hi(109f), %g7; \
96 ba,pt %xcc, scetrap; \ 96 ba,pt %xcc, etrap; \
97109: or %g7, %lo(109b), %g7; \ 97109: or %g7, %lo(109b), %g7; \
98 sethi %hi(systbl), %l7; \ 98 sethi %hi(systbl), %l7; \
99 ba,pt %xcc, routine; \ 99 ba,pt %xcc, routine; \
@@ -109,14 +109,14 @@
109 nop;nop;nop; 109 nop;nop;nop;
110 110
111#define TRAP_UTRAP(handler,lvl) \ 111#define TRAP_UTRAP(handler,lvl) \
112 ldx [%g6 + TI_UTRAPS], %g1; \ 112 mov handler, %g3; \
113 sethi %hi(109f), %g7; \ 113 ba,pt %xcc, utrap_trap; \
114 brz,pn %g1, utrap; \ 114 mov lvl, %g4; \
115 or %g7, %lo(109f), %g7; \ 115 nop; \
116 ba,pt %xcc, utrap; \ 116 nop; \
117109: ldx [%g1 + handler*8], %g1; \ 117 nop; \
118 ba,pt %xcc, utrap_ill; \ 118 nop; \
119 mov lvl, %o1; 119 nop;
120 120
121#ifdef CONFIG_SUNOS_EMUL 121#ifdef CONFIG_SUNOS_EMUL
122#define SUNOS_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sunos_sys_table) 122#define SUNOS_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall32, sunos_sys_table)
@@ -136,8 +136,6 @@
136#else 136#else
137#define SOLARIS_SYSCALL_TRAP TRAP(solaris_syscall) 137#define SOLARIS_SYSCALL_TRAP TRAP(solaris_syscall)
138#endif 138#endif
139/* FIXME: Write these actually */
140#define NETBSD_SYSCALL_TRAP TRAP(netbsd_syscall)
141#define BREAKPOINT_TRAP TRAP(breakpoint_trap) 139#define BREAKPOINT_TRAP TRAP(breakpoint_trap)
142 140
143#define TRAP_IRQ(routine, level) \ 141#define TRAP_IRQ(routine, level) \
@@ -182,6 +180,26 @@
182#define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl) 180#define KPROBES_TRAP(lvl) TRAP_ARG(bad_trap, lvl)
183#endif 181#endif
184 182
183#define SUN4V_ITSB_MISS \
184 ldxa [%g0] ASI_SCRATCHPAD, %g2; \
185 ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4; \
186 ldx [%g2 + HV_FAULT_I_CTX_OFFSET], %g5; \
187 srlx %g4, 22, %g6; \
188 ba,pt %xcc, sun4v_itsb_miss; \
189 nop; \
190 nop; \
191 nop;
192
193#define SUN4V_DTSB_MISS \
194 ldxa [%g0] ASI_SCRATCHPAD, %g2; \
195 ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4; \
196 ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5; \
197 srlx %g4, 22, %g6; \
198 ba,pt %xcc, sun4v_dtsb_miss; \
199 nop; \
200 nop; \
201 nop;
202
185/* Before touching these macros, you owe it to yourself to go and 203/* Before touching these macros, you owe it to yourself to go and
186 * see how arch/sparc64/kernel/winfixup.S works... -DaveM 204 * see how arch/sparc64/kernel/winfixup.S works... -DaveM
187 * 205 *
@@ -221,6 +239,31 @@
221 saved; retry; nop; nop; nop; nop; nop; nop; \ 239 saved; retry; nop; nop; nop; nop; nop; nop; \
222 nop; nop; nop; nop; nop; nop; nop; nop; 240 nop; nop; nop; nop; nop; nop; nop; nop;
223 241
242#define SPILL_0_NORMAL_ETRAP \
243etrap_kernel_spill: \
244 stx %l0, [%sp + STACK_BIAS + 0x00]; \
245 stx %l1, [%sp + STACK_BIAS + 0x08]; \
246 stx %l2, [%sp + STACK_BIAS + 0x10]; \
247 stx %l3, [%sp + STACK_BIAS + 0x18]; \
248 stx %l4, [%sp + STACK_BIAS + 0x20]; \
249 stx %l5, [%sp + STACK_BIAS + 0x28]; \
250 stx %l6, [%sp + STACK_BIAS + 0x30]; \
251 stx %l7, [%sp + STACK_BIAS + 0x38]; \
252 stx %i0, [%sp + STACK_BIAS + 0x40]; \
253 stx %i1, [%sp + STACK_BIAS + 0x48]; \
254 stx %i2, [%sp + STACK_BIAS + 0x50]; \
255 stx %i3, [%sp + STACK_BIAS + 0x58]; \
256 stx %i4, [%sp + STACK_BIAS + 0x60]; \
257 stx %i5, [%sp + STACK_BIAS + 0x68]; \
258 stx %i6, [%sp + STACK_BIAS + 0x70]; \
259 stx %i7, [%sp + STACK_BIAS + 0x78]; \
260 saved; \
261 sub %g1, 2, %g1; \
262 ba,pt %xcc, etrap_save; \
263 wrpr %g1, %cwp; \
264 nop; nop; nop; nop; nop; nop; nop; nop; \
265 nop; nop; nop; nop;
266
224/* Normal 64bit spill */ 267/* Normal 64bit spill */
225#define SPILL_1_GENERIC(ASI) \ 268#define SPILL_1_GENERIC(ASI) \
226 add %sp, STACK_BIAS + 0x00, %g1; \ 269 add %sp, STACK_BIAS + 0x00, %g1; \
@@ -254,6 +297,67 @@
254 b,a,pt %xcc, spill_fixup_mna; \ 297 b,a,pt %xcc, spill_fixup_mna; \
255 b,a,pt %xcc, spill_fixup; 298 b,a,pt %xcc, spill_fixup;
256 299
300#define SPILL_1_GENERIC_ETRAP \
301etrap_user_spill_64bit: \
302 stxa %l0, [%sp + STACK_BIAS + 0x00] %asi; \
303 stxa %l1, [%sp + STACK_BIAS + 0x08] %asi; \
304 stxa %l2, [%sp + STACK_BIAS + 0x10] %asi; \
305 stxa %l3, [%sp + STACK_BIAS + 0x18] %asi; \
306 stxa %l4, [%sp + STACK_BIAS + 0x20] %asi; \
307 stxa %l5, [%sp + STACK_BIAS + 0x28] %asi; \
308 stxa %l6, [%sp + STACK_BIAS + 0x30] %asi; \
309 stxa %l7, [%sp + STACK_BIAS + 0x38] %asi; \
310 stxa %i0, [%sp + STACK_BIAS + 0x40] %asi; \
311 stxa %i1, [%sp + STACK_BIAS + 0x48] %asi; \
312 stxa %i2, [%sp + STACK_BIAS + 0x50] %asi; \
313 stxa %i3, [%sp + STACK_BIAS + 0x58] %asi; \
314 stxa %i4, [%sp + STACK_BIAS + 0x60] %asi; \
315 stxa %i5, [%sp + STACK_BIAS + 0x68] %asi; \
316 stxa %i6, [%sp + STACK_BIAS + 0x70] %asi; \
317 stxa %i7, [%sp + STACK_BIAS + 0x78] %asi; \
318 saved; \
319 sub %g1, 2, %g1; \
320 ba,pt %xcc, etrap_save; \
321 wrpr %g1, %cwp; \
322 nop; nop; nop; nop; nop; \
323 nop; nop; nop; nop; \
324 ba,a,pt %xcc, etrap_spill_fixup_64bit; \
325 ba,a,pt %xcc, etrap_spill_fixup_64bit; \
326 ba,a,pt %xcc, etrap_spill_fixup_64bit;
327
328#define SPILL_1_GENERIC_ETRAP_FIXUP \
329etrap_spill_fixup_64bit: \
330 ldub [%g6 + TI_WSAVED], %g1; \
331 sll %g1, 3, %g3; \
332 add %g6, %g3, %g3; \
333 stx %sp, [%g3 + TI_RWIN_SPTRS]; \
334 sll %g1, 7, %g3; \
335 add %g6, %g3, %g3; \
336 stx %l0, [%g3 + TI_REG_WINDOW + 0x00]; \
337 stx %l1, [%g3 + TI_REG_WINDOW + 0x08]; \
338 stx %l2, [%g3 + TI_REG_WINDOW + 0x10]; \
339 stx %l3, [%g3 + TI_REG_WINDOW + 0x18]; \
340 stx %l4, [%g3 + TI_REG_WINDOW + 0x20]; \
341 stx %l5, [%g3 + TI_REG_WINDOW + 0x28]; \
342 stx %l6, [%g3 + TI_REG_WINDOW + 0x30]; \
343 stx %l7, [%g3 + TI_REG_WINDOW + 0x38]; \
344 stx %i0, [%g3 + TI_REG_WINDOW + 0x40]; \
345 stx %i1, [%g3 + TI_REG_WINDOW + 0x48]; \
346 stx %i2, [%g3 + TI_REG_WINDOW + 0x50]; \
347 stx %i3, [%g3 + TI_REG_WINDOW + 0x58]; \
348 stx %i4, [%g3 + TI_REG_WINDOW + 0x60]; \
349 stx %i5, [%g3 + TI_REG_WINDOW + 0x68]; \
350 stx %i6, [%g3 + TI_REG_WINDOW + 0x70]; \
351 stx %i7, [%g3 + TI_REG_WINDOW + 0x78]; \
352 add %g1, 1, %g1; \
353 stb %g1, [%g6 + TI_WSAVED]; \
354 saved; \
355 rdpr %cwp, %g1; \
356 sub %g1, 2, %g1; \
357 ba,pt %xcc, etrap_save; \
358 wrpr %g1, %cwp; \
359 nop; nop; nop
360
257/* Normal 32bit spill */ 361/* Normal 32bit spill */
258#define SPILL_2_GENERIC(ASI) \ 362#define SPILL_2_GENERIC(ASI) \
259 srl %sp, 0, %sp; \ 363 srl %sp, 0, %sp; \
@@ -287,6 +391,68 @@
287 b,a,pt %xcc, spill_fixup_mna; \ 391 b,a,pt %xcc, spill_fixup_mna; \
288 b,a,pt %xcc, spill_fixup; 392 b,a,pt %xcc, spill_fixup;
289 393
394#define SPILL_2_GENERIC_ETRAP \
395etrap_user_spill_32bit: \
396 srl %sp, 0, %sp; \
397 stwa %l0, [%sp + 0x00] %asi; \
398 stwa %l1, [%sp + 0x04] %asi; \
399 stwa %l2, [%sp + 0x08] %asi; \
400 stwa %l3, [%sp + 0x0c] %asi; \
401 stwa %l4, [%sp + 0x10] %asi; \
402 stwa %l5, [%sp + 0x14] %asi; \
403 stwa %l6, [%sp + 0x18] %asi; \
404 stwa %l7, [%sp + 0x1c] %asi; \
405 stwa %i0, [%sp + 0x20] %asi; \
406 stwa %i1, [%sp + 0x24] %asi; \
407 stwa %i2, [%sp + 0x28] %asi; \
408 stwa %i3, [%sp + 0x2c] %asi; \
409 stwa %i4, [%sp + 0x30] %asi; \
410 stwa %i5, [%sp + 0x34] %asi; \
411 stwa %i6, [%sp + 0x38] %asi; \
412 stwa %i7, [%sp + 0x3c] %asi; \
413 saved; \
414 sub %g1, 2, %g1; \
415 ba,pt %xcc, etrap_save; \
416 wrpr %g1, %cwp; \
417 nop; nop; nop; nop; \
418 nop; nop; nop; nop; \
419 ba,a,pt %xcc, etrap_spill_fixup_32bit; \
420 ba,a,pt %xcc, etrap_spill_fixup_32bit; \
421 ba,a,pt %xcc, etrap_spill_fixup_32bit;
422
423#define SPILL_2_GENERIC_ETRAP_FIXUP \
424etrap_spill_fixup_32bit: \
425 ldub [%g6 + TI_WSAVED], %g1; \
426 sll %g1, 3, %g3; \
427 add %g6, %g3, %g3; \
428 stx %sp, [%g3 + TI_RWIN_SPTRS]; \
429 sll %g1, 7, %g3; \
430 add %g6, %g3, %g3; \
431 stw %l0, [%g3 + TI_REG_WINDOW + 0x00]; \
432 stw %l1, [%g3 + TI_REG_WINDOW + 0x04]; \
433 stw %l2, [%g3 + TI_REG_WINDOW + 0x08]; \
434 stw %l3, [%g3 + TI_REG_WINDOW + 0x0c]; \
435 stw %l4, [%g3 + TI_REG_WINDOW + 0x10]; \
436 stw %l5, [%g3 + TI_REG_WINDOW + 0x14]; \
437 stw %l6, [%g3 + TI_REG_WINDOW + 0x18]; \
438 stw %l7, [%g3 + TI_REG_WINDOW + 0x1c]; \
439 stw %i0, [%g3 + TI_REG_WINDOW + 0x20]; \
440 stw %i1, [%g3 + TI_REG_WINDOW + 0x24]; \
441 stw %i2, [%g3 + TI_REG_WINDOW + 0x28]; \
442 stw %i3, [%g3 + TI_REG_WINDOW + 0x2c]; \
443 stw %i4, [%g3 + TI_REG_WINDOW + 0x30]; \
444 stw %i5, [%g3 + TI_REG_WINDOW + 0x34]; \
445 stw %i6, [%g3 + TI_REG_WINDOW + 0x38]; \
446 stw %i7, [%g3 + TI_REG_WINDOW + 0x3c]; \
447 add %g1, 1, %g1; \
448 stb %g1, [%g6 + TI_WSAVED]; \
449 saved; \
450 rdpr %cwp, %g1; \
451 sub %g1, 2, %g1; \
452 ba,pt %xcc, etrap_save; \
453 wrpr %g1, %cwp; \
454 nop; nop; nop
455
290#define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP) 456#define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP)
291#define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP) 457#define SPILL_2_NORMAL SPILL_2_GENERIC(ASI_AIUP)
292#define SPILL_3_NORMAL SPILL_0_NORMAL 458#define SPILL_3_NORMAL SPILL_0_NORMAL
@@ -325,6 +491,35 @@
325 restored; retry; nop; nop; nop; nop; nop; nop; \ 491 restored; retry; nop; nop; nop; nop; nop; nop; \
326 nop; nop; nop; nop; nop; nop; nop; nop; 492 nop; nop; nop; nop; nop; nop; nop; nop;
327 493
494#define FILL_0_NORMAL_RTRAP \
495kern_rtt_fill: \
496 rdpr %cwp, %g1; \
497 sub %g1, 1, %g1; \
498 wrpr %g1, %cwp; \
499 ldx [%sp + STACK_BIAS + 0x00], %l0; \
500 ldx [%sp + STACK_BIAS + 0x08], %l1; \
501 ldx [%sp + STACK_BIAS + 0x10], %l2; \
502 ldx [%sp + STACK_BIAS + 0x18], %l3; \
503 ldx [%sp + STACK_BIAS + 0x20], %l4; \
504 ldx [%sp + STACK_BIAS + 0x28], %l5; \
505 ldx [%sp + STACK_BIAS + 0x30], %l6; \
506 ldx [%sp + STACK_BIAS + 0x38], %l7; \
507 ldx [%sp + STACK_BIAS + 0x40], %i0; \
508 ldx [%sp + STACK_BIAS + 0x48], %i1; \
509 ldx [%sp + STACK_BIAS + 0x50], %i2; \
510 ldx [%sp + STACK_BIAS + 0x58], %i3; \
511 ldx [%sp + STACK_BIAS + 0x60], %i4; \
512 ldx [%sp + STACK_BIAS + 0x68], %i5; \
513 ldx [%sp + STACK_BIAS + 0x70], %i6; \
514 ldx [%sp + STACK_BIAS + 0x78], %i7; \
515 restored; \
516 add %g1, 1, %g1; \
517 ba,pt %xcc, kern_rtt_restore; \
518 wrpr %g1, %cwp; \
519 nop; nop; nop; nop; nop; \
520 nop; nop; nop; nop;
521
522
328/* Normal 64bit fill */ 523/* Normal 64bit fill */
329#define FILL_1_GENERIC(ASI) \ 524#define FILL_1_GENERIC(ASI) \
330 add %sp, STACK_BIAS + 0x00, %g1; \ 525 add %sp, STACK_BIAS + 0x00, %g1; \
@@ -356,6 +551,33 @@
356 b,a,pt %xcc, fill_fixup_mna; \ 551 b,a,pt %xcc, fill_fixup_mna; \
357 b,a,pt %xcc, fill_fixup; 552 b,a,pt %xcc, fill_fixup;
358 553
554#define FILL_1_GENERIC_RTRAP \
555user_rtt_fill_64bit: \
556 ldxa [%sp + STACK_BIAS + 0x00] %asi, %l0; \
557 ldxa [%sp + STACK_BIAS + 0x08] %asi, %l1; \
558 ldxa [%sp + STACK_BIAS + 0x10] %asi, %l2; \
559 ldxa [%sp + STACK_BIAS + 0x18] %asi, %l3; \
560 ldxa [%sp + STACK_BIAS + 0x20] %asi, %l4; \
561 ldxa [%sp + STACK_BIAS + 0x28] %asi, %l5; \
562 ldxa [%sp + STACK_BIAS + 0x30] %asi, %l6; \
563 ldxa [%sp + STACK_BIAS + 0x38] %asi, %l7; \
564 ldxa [%sp + STACK_BIAS + 0x40] %asi, %i0; \
565 ldxa [%sp + STACK_BIAS + 0x48] %asi, %i1; \
566 ldxa [%sp + STACK_BIAS + 0x50] %asi, %i2; \
567 ldxa [%sp + STACK_BIAS + 0x58] %asi, %i3; \
568 ldxa [%sp + STACK_BIAS + 0x60] %asi, %i4; \
569 ldxa [%sp + STACK_BIAS + 0x68] %asi, %i5; \
570 ldxa [%sp + STACK_BIAS + 0x70] %asi, %i6; \
571 ldxa [%sp + STACK_BIAS + 0x78] %asi, %i7; \
572 ba,pt %xcc, user_rtt_pre_restore; \
573 restored; \
574 nop; nop; nop; nop; nop; nop; \
575 nop; nop; nop; nop; nop; \
576 ba,a,pt %xcc, user_rtt_fill_fixup; \
577 ba,a,pt %xcc, user_rtt_fill_fixup; \
578 ba,a,pt %xcc, user_rtt_fill_fixup;
579
580
359/* Normal 32bit fill */ 581/* Normal 32bit fill */
360#define FILL_2_GENERIC(ASI) \ 582#define FILL_2_GENERIC(ASI) \
361 srl %sp, 0, %sp; \ 583 srl %sp, 0, %sp; \
@@ -387,6 +609,34 @@
387 b,a,pt %xcc, fill_fixup_mna; \ 609 b,a,pt %xcc, fill_fixup_mna; \
388 b,a,pt %xcc, fill_fixup; 610 b,a,pt %xcc, fill_fixup;
389 611
612#define FILL_2_GENERIC_RTRAP \
613user_rtt_fill_32bit: \
614 srl %sp, 0, %sp; \
615 lduwa [%sp + 0x00] %asi, %l0; \
616 lduwa [%sp + 0x04] %asi, %l1; \
617 lduwa [%sp + 0x08] %asi, %l2; \
618 lduwa [%sp + 0x0c] %asi, %l3; \
619 lduwa [%sp + 0x10] %asi, %l4; \
620 lduwa [%sp + 0x14] %asi, %l5; \
621 lduwa [%sp + 0x18] %asi, %l6; \
622 lduwa [%sp + 0x1c] %asi, %l7; \
623 lduwa [%sp + 0x20] %asi, %i0; \
624 lduwa [%sp + 0x24] %asi, %i1; \
625 lduwa [%sp + 0x28] %asi, %i2; \
626 lduwa [%sp + 0x2c] %asi, %i3; \
627 lduwa [%sp + 0x30] %asi, %i4; \
628 lduwa [%sp + 0x34] %asi, %i5; \
629 lduwa [%sp + 0x38] %asi, %i6; \
630 lduwa [%sp + 0x3c] %asi, %i7; \
631 ba,pt %xcc, user_rtt_pre_restore; \
632 restored; \
633 nop; nop; nop; nop; nop; \
634 nop; nop; nop; nop; nop; \
635 ba,a,pt %xcc, user_rtt_fill_fixup; \
636 ba,a,pt %xcc, user_rtt_fill_fixup; \
637 ba,a,pt %xcc, user_rtt_fill_fixup;
638
639
390#define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP) 640#define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP)
391#define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP) 641#define FILL_2_NORMAL FILL_2_GENERIC(ASI_AIUP)
392#define FILL_3_NORMAL FILL_0_NORMAL 642#define FILL_3_NORMAL FILL_0_NORMAL
diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h
index c91d1e38eac6..afe236ba555b 100644
--- a/include/asm-sparc64/uaccess.h
+++ b/include/asm-sparc64/uaccess.h
@@ -114,16 +114,6 @@ case 8: __put_user_asm(data,x,addr,__pu_ret); break; \
114default: __pu_ret = __put_user_bad(); break; \ 114default: __pu_ret = __put_user_bad(); break; \
115} __pu_ret; }) 115} __pu_ret; })
116 116
117#define __put_user_nocheck_ret(data,addr,size,retval) ({ \
118register int __foo __asm__ ("l1"); \
119switch (size) { \
120case 1: __put_user_asm_ret(data,b,addr,retval,__foo); break; \
121case 2: __put_user_asm_ret(data,h,addr,retval,__foo); break; \
122case 4: __put_user_asm_ret(data,w,addr,retval,__foo); break; \
123case 8: __put_user_asm_ret(data,x,addr,retval,__foo); break; \
124default: if (__put_user_bad()) return retval; break; \
125} })
126
127#define __put_user_asm(x,size,addr,ret) \ 117#define __put_user_asm(x,size,addr,ret) \
128__asm__ __volatile__( \ 118__asm__ __volatile__( \
129 "/* Put user asm, inline. */\n" \ 119 "/* Put user asm, inline. */\n" \
@@ -143,33 +133,6 @@ __asm__ __volatile__( \
143 : "=r" (ret) : "r" (x), "r" (__m(addr)), \ 133 : "=r" (ret) : "r" (x), "r" (__m(addr)), \
144 "i" (-EFAULT)) 134 "i" (-EFAULT))
145 135
146#define __put_user_asm_ret(x,size,addr,ret,foo) \
147if (__builtin_constant_p(ret) && ret == -EFAULT) \
148__asm__ __volatile__( \
149 "/* Put user asm ret, inline. */\n" \
150"1:\t" "st"#size "a %1, [%2] %%asi\n\n\t" \
151 ".section __ex_table,\"a\"\n\t" \
152 ".align 4\n\t" \
153 ".word 1b, __ret_efault\n\n\t" \
154 ".previous\n\n\t" \
155 : "=r" (foo) : "r" (x), "r" (__m(addr))); \
156else \
157__asm__ __volatile__( \
158 "/* Put user asm ret, inline. */\n" \
159"1:\t" "st"#size "a %1, [%2] %%asi\n\n\t" \
160 ".section .fixup,#alloc,#execinstr\n\t" \
161 ".align 4\n" \
162"3:\n\t" \
163 "ret\n\t" \
164 " restore %%g0, %3, %%o0\n\n\t" \
165 ".previous\n\t" \
166 ".section __ex_table,\"a\"\n\t" \
167 ".align 4\n\t" \
168 ".word 1b, 3b\n\n\t" \
169 ".previous\n\n\t" \
170 : "=r" (foo) : "r" (x), "r" (__m(addr)), \
171 "i" (ret))
172
173extern int __put_user_bad(void); 136extern int __put_user_bad(void);
174 137
175#define __get_user_nocheck(data,addr,size,type) ({ \ 138#define __get_user_nocheck(data,addr,size,type) ({ \
@@ -289,14 +252,7 @@ copy_in_user(void __user *to, void __user *from, unsigned long size)
289} 252}
290#define __copy_in_user copy_in_user 253#define __copy_in_user copy_in_user
291 254
292extern unsigned long __must_check __bzero_noasi(void __user *, unsigned long); 255extern unsigned long __must_check __clear_user(void __user *, unsigned long);
293
294static inline unsigned long __must_check
295__clear_user(void __user *addr, unsigned long size)
296{
297
298 return __bzero_noasi(addr, size);
299}
300 256
301#define clear_user __clear_user 257#define clear_user __clear_user
302 258
diff --git a/include/asm-sparc64/vdev.h b/include/asm-sparc64/vdev.h
new file mode 100644
index 000000000000..996e6be7b976
--- /dev/null
+++ b/include/asm-sparc64/vdev.h
@@ -0,0 +1,16 @@
1/* vdev.h: SUN4V virtual device interfaces and defines.
2 *
3 * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
4 */
5
6#ifndef _SPARC64_VDEV_H
7#define _SPARC64_VDEV_H
8
9#include <linux/types.h>
10
11extern u32 sun4v_vdev_devhandle;
12extern int sun4v_vdev_root;
13
14extern unsigned int sun4v_vdev_device_interrupt(unsigned int);
15
16#endif /* !(_SPARC64_VDEV_H) */
diff --git a/include/asm-sparc64/xor.h b/include/asm-sparc64/xor.h
index 8b3a7e4b6062..8ce3f1813e28 100644
--- a/include/asm-sparc64/xor.h
+++ b/include/asm-sparc64/xor.h
@@ -2,9 +2,11 @@
2 * include/asm-sparc64/xor.h 2 * include/asm-sparc64/xor.h
3 * 3 *
4 * High speed xor_block operation for RAID4/5 utilizing the 4 * High speed xor_block operation for RAID4/5 utilizing the
5 * UltraSparc Visual Instruction Set. 5 * UltraSparc Visual Instruction Set and Niagara block-init
6 * twin-load instructions.
6 * 7 *
7 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz) 8 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
9 * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
8 * 10 *
9 * This program is free software; you can redistribute it and/or modify 11 * 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 12 * it under the terms of the GNU General Public License as published by
@@ -16,8 +18,7 @@
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */ 19 */
18 20
19#include <asm/pstate.h> 21#include <asm/spitfire.h>
20#include <asm/asi.h>
21 22
22extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); 23extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
23extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, 24extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *,
@@ -37,4 +38,29 @@ static struct xor_block_template xor_block_VIS = {
37 .do_5 = xor_vis_5, 38 .do_5 = xor_vis_5,
38}; 39};
39 40
40#define XOR_TRY_TEMPLATES xor_speed(&xor_block_VIS) 41extern void xor_niagara_2(unsigned long, unsigned long *, unsigned long *);
42extern void xor_niagara_3(unsigned long, unsigned long *, unsigned long *,
43 unsigned long *);
44extern void xor_niagara_4(unsigned long, unsigned long *, unsigned long *,
45 unsigned long *, unsigned long *);
46extern void xor_niagara_5(unsigned long, unsigned long *, unsigned long *,
47 unsigned long *, unsigned long *, unsigned long *);
48
49static struct xor_block_template xor_block_niagara = {
50 .name = "Niagara",
51 .do_2 = xor_niagara_2,
52 .do_3 = xor_niagara_3,
53 .do_4 = xor_niagara_4,
54 .do_5 = xor_niagara_5,
55};
56
57#undef XOR_TRY_TEMPLATES
58#define XOR_TRY_TEMPLATES \
59 do { \
60 xor_speed(&xor_block_VIS); \
61 xor_speed(&xor_block_niagara); \
62 } while (0)
63
64/* For VIS for everything except Niagara. */
65#define XOR_SELECT_TEMPLATE(FASTEST) \
66 (tlb_type == hypervisor ? &xor_block_niagara : &xor_block_VIS)
diff --git a/include/asm-um/alternative.h b/include/asm-um/alternative.h
new file mode 100644
index 000000000000..b6434396bd42
--- /dev/null
+++ b/include/asm-um/alternative.h
@@ -0,0 +1,6 @@
1#ifndef __UM_ALTERNATIVE_H
2#define __UM_ALTERNATIVE_H
3
4#include "asm/arch/alternative.h"
5
6#endif
diff --git a/include/asm-um/desc.h b/include/asm-um/desc.h
index ac1d2a20d178..4ec34a51b62c 100644
--- a/include/asm-um/desc.h
+++ b/include/asm-um/desc.h
@@ -1,6 +1,16 @@
1#ifndef __UM_DESC_H 1#ifndef __UM_DESC_H
2#define __UM_DESC_H 2#define __UM_DESC_H
3 3
4#include "asm/arch/desc.h" 4/* Taken from asm-i386/desc.h, it's the only thing we need. The rest wouldn't
5 * compile, and has never been used. */
6#define LDT_empty(info) (\
7 (info)->base_addr == 0 && \
8 (info)->limit == 0 && \
9 (info)->contents == 0 && \
10 (info)->read_exec_only == 1 && \
11 (info)->seg_32bit == 0 && \
12 (info)->limit_in_pages == 0 && \
13 (info)->seg_not_present == 1 && \
14 (info)->useable == 0 )
5 15
6#endif 16#endif
diff --git a/include/asm-um/host_ldt-i386.h b/include/asm-um/host_ldt-i386.h
new file mode 100644
index 000000000000..b27cb0a9dd30
--- /dev/null
+++ b/include/asm-um/host_ldt-i386.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_HOST_LDT_I386_H
2#define __ASM_HOST_LDT_I386_H
3
4#include "asm/arch/ldt.h"
5
6/*
7 * macros stolen from include/asm-i386/desc.h
8 */
9#define LDT_entry_a(info) \
10 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
11
12#define LDT_entry_b(info) \
13 (((info)->base_addr & 0xff000000) | \
14 (((info)->base_addr & 0x00ff0000) >> 16) | \
15 ((info)->limit & 0xf0000) | \
16 (((info)->read_exec_only ^ 1) << 9) | \
17 ((info)->contents << 10) | \
18 (((info)->seg_not_present ^ 1) << 15) | \
19 ((info)->seg_32bit << 22) | \
20 ((info)->limit_in_pages << 23) | \
21 ((info)->useable << 20) | \
22 0x7000)
23
24#define LDT_empty(info) (\
25 (info)->base_addr == 0 && \
26 (info)->limit == 0 && \
27 (info)->contents == 0 && \
28 (info)->read_exec_only == 1 && \
29 (info)->seg_32bit == 0 && \
30 (info)->limit_in_pages == 0 && \
31 (info)->seg_not_present == 1 && \
32 (info)->useable == 0 )
33
34#endif
diff --git a/include/asm-um/ldt-x86_64.h b/include/asm-um/host_ldt-x86_64.h
index 96b35aada79a..74a63f7d9a90 100644
--- a/include/asm-um/ldt-x86_64.h
+++ b/include/asm-um/host_ldt-x86_64.h
@@ -1,43 +1,8 @@
1/* 1#ifndef __ASM_HOST_LDT_X86_64_H
2 * Copyright (C) 2004 Fujitsu Siemens Computers GmbH 2#define __ASM_HOST_LDT_X86_64_H
3 * Licensed under the GPL
4 *
5 * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
6 */
7 3
8#ifndef __ASM_LDT_X86_64_H
9#define __ASM_LDT_X86_64_H
10
11#include "asm/semaphore.h"
12#include "asm/arch/ldt.h" 4#include "asm/arch/ldt.h"
13 5
14struct mmu_context_skas;
15extern void ldt_host_info(void);
16extern long init_new_ldt(struct mmu_context_skas * to_mm,
17 struct mmu_context_skas * from_mm);
18extern void free_ldt(struct mmu_context_skas * mm);
19
20#define LDT_PAGES_MAX \
21 ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
22#define LDT_ENTRIES_PER_PAGE \
23 (PAGE_SIZE/LDT_ENTRY_SIZE)
24#define LDT_DIRECT_ENTRIES \
25 ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
26
27struct ldt_entry {
28 __u32 a;
29 __u32 b;
30};
31
32typedef struct uml_ldt {
33 int entry_count;
34 struct semaphore semaphore;
35 union {
36 struct ldt_entry * pages[LDT_PAGES_MAX];
37 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
38 } u;
39} uml_ldt_t;
40
41/* 6/*
42 * macros stolen from include/asm-x86_64/desc.h 7 * macros stolen from include/asm-x86_64/desc.h
43 */ 8 */
diff --git a/include/asm-um/ldt-i386.h b/include/asm-um/ldt-i386.h
deleted file mode 100644
index 175722a91164..000000000000
--- a/include/asm-um/ldt-i386.h
+++ /dev/null
@@ -1,69 +0,0 @@
1/*
2 * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
3 * Licensed under the GPL
4 *
5 * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
6 */
7
8#ifndef __ASM_LDT_I386_H
9#define __ASM_LDT_I386_H
10
11#include "asm/semaphore.h"
12#include "asm/arch/ldt.h"
13
14struct mmu_context_skas;
15extern void ldt_host_info(void);
16extern long init_new_ldt(struct mmu_context_skas * to_mm,
17 struct mmu_context_skas * from_mm);
18extern void free_ldt(struct mmu_context_skas * mm);
19
20#define LDT_PAGES_MAX \
21 ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
22#define LDT_ENTRIES_PER_PAGE \
23 (PAGE_SIZE/LDT_ENTRY_SIZE)
24#define LDT_DIRECT_ENTRIES \
25 ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
26
27struct ldt_entry {
28 __u32 a;
29 __u32 b;
30};
31
32typedef struct uml_ldt {
33 int entry_count;
34 struct semaphore semaphore;
35 union {
36 struct ldt_entry * pages[LDT_PAGES_MAX];
37 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
38 } u;
39} uml_ldt_t;
40
41/*
42 * macros stolen from include/asm-i386/desc.h
43 */
44#define LDT_entry_a(info) \
45 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
46
47#define LDT_entry_b(info) \
48 (((info)->base_addr & 0xff000000) | \
49 (((info)->base_addr & 0x00ff0000) >> 16) | \
50 ((info)->limit & 0xf0000) | \
51 (((info)->read_exec_only ^ 1) << 9) | \
52 ((info)->contents << 10) | \
53 (((info)->seg_not_present ^ 1) << 15) | \
54 ((info)->seg_32bit << 22) | \
55 ((info)->limit_in_pages << 23) | \
56 ((info)->useable << 20) | \
57 0x7000)
58
59#define LDT_empty(info) (\
60 (info)->base_addr == 0 && \
61 (info)->limit == 0 && \
62 (info)->contents == 0 && \
63 (info)->read_exec_only == 1 && \
64 (info)->seg_32bit == 0 && \
65 (info)->limit_in_pages == 0 && \
66 (info)->seg_not_present == 1 && \
67 (info)->useable == 0 )
68
69#endif
diff --git a/include/asm-um/ldt.h b/include/asm-um/ldt.h
new file mode 100644
index 000000000000..96f82a456ce6
--- /dev/null
+++ b/include/asm-um/ldt.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
3 * Licensed under the GPL
4 *
5 * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
6 */
7
8#ifndef __ASM_LDT_H
9#define __ASM_LDT_H
10
11#include "asm/semaphore.h"
12#include "asm/host_ldt.h"
13
14struct mmu_context_skas;
15extern void ldt_host_info(void);
16extern long init_new_ldt(struct mmu_context_skas * to_mm,
17 struct mmu_context_skas * from_mm);
18extern void free_ldt(struct mmu_context_skas * mm);
19
20#define LDT_PAGES_MAX \
21 ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
22#define LDT_ENTRIES_PER_PAGE \
23 (PAGE_SIZE/LDT_ENTRY_SIZE)
24#define LDT_DIRECT_ENTRIES \
25 ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
26
27struct ldt_entry {
28 __u32 a;
29 __u32 b;
30};
31
32typedef struct uml_ldt {
33 int entry_count;
34 struct semaphore semaphore;
35 union {
36 struct ldt_entry * pages[LDT_PAGES_MAX];
37 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
38 } u;
39} uml_ldt_t;
40
41#endif
diff --git a/include/asm-um/page.h b/include/asm-um/page.h
index 0229814af31e..41364330aff1 100644
--- a/include/asm-um/page.h
+++ b/include/asm-um/page.h
@@ -106,9 +106,6 @@ extern unsigned long uml_physmem;
106#define __pa(virt) to_phys((void *) (unsigned long) (virt)) 106#define __pa(virt) to_phys((void *) (unsigned long) (virt))
107#define __va(phys) to_virt((unsigned long) (phys)) 107#define __va(phys) to_virt((unsigned long) (phys))
108 108
109#define page_to_pfn(page) ((page) - mem_map)
110#define pfn_to_page(pfn) (mem_map + (pfn))
111
112#define phys_to_pfn(p) ((p) >> PAGE_SHIFT) 109#define phys_to_pfn(p) ((p) >> PAGE_SHIFT)
113#define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) 110#define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
114 111
@@ -121,6 +118,7 @@ extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
121extern void arch_free_page(struct page *page, int order); 118extern void arch_free_page(struct page *page, int order);
122#define HAVE_ARCH_FREE_PAGE 119#define HAVE_ARCH_FREE_PAGE
123 120
121#include <asm-generic/memory_model.h>
124#include <asm-generic/page.h> 122#include <asm-generic/page.h>
125 123
126#endif 124#endif
diff --git a/include/asm-um/processor-i386.h b/include/asm-um/processor-i386.h
index 4108a579eb92..595f1c3e1e40 100644
--- a/include/asm-um/processor-i386.h
+++ b/include/asm-um/processor-i386.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -6,21 +6,48 @@
6#ifndef __UM_PROCESSOR_I386_H 6#ifndef __UM_PROCESSOR_I386_H
7#define __UM_PROCESSOR_I386_H 7#define __UM_PROCESSOR_I386_H
8 8
9#include "linux/string.h"
10#include "asm/host_ldt.h"
11#include "asm/segment.h"
12
9extern int host_has_xmm; 13extern int host_has_xmm;
10extern int host_has_cmov; 14extern int host_has_cmov;
11 15
12/* include faultinfo structure */ 16/* include faultinfo structure */
13#include "sysdep/faultinfo.h" 17#include "sysdep/faultinfo.h"
14 18
19struct uml_tls_struct {
20 struct user_desc tls;
21 unsigned flushed:1;
22 unsigned present:1;
23};
24
15struct arch_thread { 25struct arch_thread {
26 struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES];
16 unsigned long debugregs[8]; 27 unsigned long debugregs[8];
17 int debugregs_seq; 28 int debugregs_seq;
18 struct faultinfo faultinfo; 29 struct faultinfo faultinfo;
19}; 30};
20 31
21#define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \ 32#define INIT_ARCH_THREAD { \
22 .debugregs_seq = 0, \ 33 .tls_array = { [ 0 ... GDT_ENTRY_TLS_ENTRIES - 1 ] = \
23 .faultinfo = { 0, 0, 0 } } 34 { .present = 0, .flushed = 0 } }, \
35 .debugregs = { [ 0 ... 7 ] = 0 }, \
36 .debugregs_seq = 0, \
37 .faultinfo = { 0, 0, 0 } \
38}
39
40static inline void arch_flush_thread(struct arch_thread *thread)
41{
42 /* Clear any TLS still hanging */
43 memset(&thread->tls_array, 0, sizeof(thread->tls_array));
44}
45
46static inline void arch_copy_thread(struct arch_thread *from,
47 struct arch_thread *to)
48{
49 memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array));
50}
24 51
25#include "asm/arch/user.h" 52#include "asm/arch/user.h"
26 53
diff --git a/include/asm-um/processor-x86_64.h b/include/asm-um/processor-x86_64.h
index e1e1255a1d36..10609af376c0 100644
--- a/include/asm-um/processor-x86_64.h
+++ b/include/asm-um/processor-x86_64.h
@@ -28,6 +28,15 @@ extern inline void rep_nop(void)
28 .debugregs_seq = 0, \ 28 .debugregs_seq = 0, \
29 .faultinfo = { 0, 0, 0 } } 29 .faultinfo = { 0, 0, 0 } }
30 30
31static inline void arch_flush_thread(struct arch_thread *thread)
32{
33}
34
35static inline void arch_copy_thread(struct arch_thread *from,
36 struct arch_thread *to)
37{
38}
39
31#include "asm/arch/user.h" 40#include "asm/arch/user.h"
32 41
33#define current_text_addr() \ 42#define current_text_addr() \
diff --git a/include/asm-um/ptrace-generic.h b/include/asm-um/ptrace-generic.h
index 46599ac44037..503484305e67 100644
--- a/include/asm-um/ptrace-generic.h
+++ b/include/asm-um/ptrace-generic.h
@@ -28,7 +28,7 @@ struct pt_regs {
28 union uml_pt_regs regs; 28 union uml_pt_regs regs;
29}; 29};
30 30
31#define EMPTY_REGS { regs : EMPTY_UML_PT_REGS } 31#define EMPTY_REGS { .regs = EMPTY_UML_PT_REGS }
32 32
33#define PT_REGS_IP(r) UPT_IP(&(r)->regs) 33#define PT_REGS_IP(r) UPT_IP(&(r)->regs)
34#define PT_REGS_SP(r) UPT_SP(&(r)->regs) 34#define PT_REGS_SP(r) UPT_SP(&(r)->regs)
@@ -60,17 +60,9 @@ extern void show_regs(struct pt_regs *regs);
60extern void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs, 60extern void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs,
61 int error_code); 61 int error_code);
62 62
63#endif 63extern int arch_copy_tls(struct task_struct *new);
64extern void clear_flushed_tls(struct task_struct *task);
64 65
65#endif 66#endif
66 67
67/* 68#endif
68 * Overrides for Emacs so that we follow Linus's tabbing style.
69 * Emacs will notice this stuff at the end of the file and automatically
70 * adjust the settings for this buffer only. This must remain at the end
71 * of the file.
72 * ---------------------------------------------------------------------------
73 * Local variables:
74 * c-file-style: "linux"
75 * End:
76 */
diff --git a/include/asm-um/ptrace-i386.h b/include/asm-um/ptrace-i386.h
index fe882b9d917e..30656c962d74 100644
--- a/include/asm-um/ptrace-i386.h
+++ b/include/asm-um/ptrace-i386.h
@@ -8,8 +8,11 @@
8 8
9#define HOST_AUDIT_ARCH AUDIT_ARCH_I386 9#define HOST_AUDIT_ARCH AUDIT_ARCH_I386
10 10
11#include "linux/compiler.h"
11#include "sysdep/ptrace.h" 12#include "sysdep/ptrace.h"
12#include "asm/ptrace-generic.h" 13#include "asm/ptrace-generic.h"
14#include "asm/host_ldt.h"
15#include "choose-mode.h"
13 16
14#define PT_REGS_EAX(r) UPT_EAX(&(r)->regs) 17#define PT_REGS_EAX(r) UPT_EAX(&(r)->regs)
15#define PT_REGS_EBX(r) UPT_EBX(&(r)->regs) 18#define PT_REGS_EBX(r) UPT_EBX(&(r)->regs)
@@ -38,15 +41,31 @@
38 41
39#define user_mode(r) UPT_IS_USER(&(r)->regs) 42#define user_mode(r) UPT_IS_USER(&(r)->regs)
40 43
41#endif 44extern int ptrace_get_thread_area(struct task_struct *child, int idx,
45 struct user_desc __user *user_desc);
42 46
43/* 47extern int ptrace_set_thread_area(struct task_struct *child, int idx,
44 * Overrides for Emacs so that we follow Linus's tabbing style. 48 struct user_desc __user *user_desc);
45 * Emacs will notice this stuff at the end of the file and automatically 49
46 * adjust the settings for this buffer only. This must remain at the end 50extern int do_set_thread_area_skas(struct user_desc *info);
47 * of the file. 51extern int do_get_thread_area_skas(struct user_desc *info);
48 * --------------------------------------------------------------------------- 52
49 * Local variables: 53extern int do_set_thread_area_tt(struct user_desc *info);
50 * c-file-style: "linux" 54extern int do_get_thread_area_tt(struct user_desc *info);
51 * End: 55
52 */ 56extern int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to);
57extern int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to);
58
59static inline int do_get_thread_area(struct user_desc *info)
60{
61 return CHOOSE_MODE_PROC(do_get_thread_area_tt, do_get_thread_area_skas, info);
62}
63
64static inline int do_set_thread_area(struct user_desc *info)
65{
66 return CHOOSE_MODE_PROC(do_set_thread_area_tt, do_set_thread_area_skas, info);
67}
68
69struct task_struct;
70
71#endif
diff --git a/include/asm-um/ptrace-x86_64.h b/include/asm-um/ptrace-x86_64.h
index be51219a8ffe..c894e68b1f96 100644
--- a/include/asm-um/ptrace-x86_64.h
+++ b/include/asm-um/ptrace-x86_64.h
@@ -8,6 +8,8 @@
8#define __UM_PTRACE_X86_64_H 8#define __UM_PTRACE_X86_64_H
9 9
10#include "linux/compiler.h" 10#include "linux/compiler.h"
11#include "asm/errno.h"
12#include "asm/host_ldt.h"
11 13
12#define signal_fault signal_fault_x86_64 14#define signal_fault signal_fault_x86_64
13#define __FRAME_OFFSETS /* Needed to get the R* macros */ 15#define __FRAME_OFFSETS /* Needed to get the R* macros */
@@ -63,15 +65,26 @@ void signal_fault(struct pt_regs_subarch *regs, void *frame, char *where);
63 65
64#define profile_pc(regs) PT_REGS_IP(regs) 66#define profile_pc(regs) PT_REGS_IP(regs)
65 67
66#endif 68static inline int ptrace_get_thread_area(struct task_struct *child, int idx,
69 struct user_desc __user *user_desc)
70{
71 return -ENOSYS;
72}
67 73
68/* 74static inline int ptrace_set_thread_area(struct task_struct *child, int idx,
69 * Overrides for Emacs so that we follow Linus's tabbing style. 75 struct user_desc __user *user_desc)
70 * Emacs will notice this stuff at the end of the file and automatically 76{
71 * adjust the settings for this buffer only. This must remain at the end 77 return -ENOSYS;
72 * of the file. 78}
73 * --------------------------------------------------------------------------- 79
74 * Local variables: 80static inline void arch_switch_to_tt(struct task_struct *from,
75 * c-file-style: "linux" 81 struct task_struct *to)
76 * End: 82{
77 */ 83}
84
85static inline void arch_switch_to_skas(struct task_struct *from,
86 struct task_struct *to)
87{
88}
89
90#endif
diff --git a/include/asm-um/segment.h b/include/asm-um/segment.h
index 55e40301f625..45183fcd10b6 100644
--- a/include/asm-um/segment.h
+++ b/include/asm-um/segment.h
@@ -1,4 +1,10 @@
1#ifndef __UM_SEGMENT_H 1#ifndef __UM_SEGMENT_H
2#define __UM_SEGMENT_H 2#define __UM_SEGMENT_H
3 3
4extern int host_gdt_entry_tls_min;
5
6#define GDT_ENTRY_TLS_ENTRIES 3
7#define GDT_ENTRY_TLS_MIN host_gdt_entry_tls_min
8#define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1)
9
4#endif 10#endif
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h
index 17b6b07c4332..f166b9837c6a 100644
--- a/include/asm-um/thread_info.h
+++ b/include/asm-um/thread_info.h
@@ -27,14 +27,14 @@ struct thread_info {
27 27
28#define INIT_THREAD_INFO(tsk) \ 28#define INIT_THREAD_INFO(tsk) \
29{ \ 29{ \
30 task: &tsk, \ 30 .task = &tsk, \
31 exec_domain: &default_exec_domain, \ 31 .exec_domain = &default_exec_domain, \
32 flags: 0, \ 32 .flags = 0, \
33 cpu: 0, \ 33 .cpu = 0, \
34 preempt_count: 1, \ 34 .preempt_count = 1, \
35 addr_limit: KERNEL_DS, \ 35 .addr_limit = KERNEL_DS, \
36 restart_block: { \ 36 .restart_block = { \
37 fn: do_no_restart_syscall, \ 37 .fn = do_no_restart_syscall, \
38 }, \ 38 }, \
39} 39}
40 40
diff --git a/include/asm-um/uaccess.h b/include/asm-um/uaccess.h
index 2ee028b8de9d..bea5a015f667 100644
--- a/include/asm-um/uaccess.h
+++ b/include/asm-um/uaccess.h
@@ -41,23 +41,23 @@
41 41
42#define __get_user(x, ptr) \ 42#define __get_user(x, ptr) \
43({ \ 43({ \
44 const __typeof__(ptr) __private_ptr = ptr; \ 44 const __typeof__(ptr) __private_ptr = ptr; \
45 __typeof__(*(__private_ptr)) __private_val; \ 45 __typeof__(x) __private_val; \
46 int __private_ret = -EFAULT; \ 46 int __private_ret = -EFAULT; \
47 (x) = (__typeof__(*(__private_ptr)))0; \ 47 (x) = (__typeof__(*(__private_ptr)))0; \
48 if (__copy_from_user(&__private_val, (__private_ptr), \ 48 if (__copy_from_user((void *) &__private_val, (__private_ptr), \
49 sizeof(*(__private_ptr))) == 0) {\ 49 sizeof(*(__private_ptr))) == 0) { \
50 (x) = (__typeof__(*(__private_ptr))) __private_val; \ 50 (x) = (__typeof__(*(__private_ptr))) __private_val; \
51 __private_ret = 0; \ 51 __private_ret = 0; \
52 } \ 52 } \
53 __private_ret; \ 53 __private_ret; \
54}) 54})
55 55
56#define get_user(x, ptr) \ 56#define get_user(x, ptr) \
57({ \ 57({ \
58 const __typeof__((*(ptr))) __user *private_ptr = (ptr); \ 58 const __typeof__((*(ptr))) __user *private_ptr = (ptr); \
59 (access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \ 59 (access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \
60 __get_user(x, private_ptr) : ((x) = 0, -EFAULT)); \ 60 __get_user(x, private_ptr) : ((x) = (__typeof__(*ptr))0, -EFAULT)); \
61}) 61})
62 62
63#define __put_user(x, ptr) \ 63#define __put_user(x, ptr) \
@@ -89,14 +89,3 @@ struct exception_table_entry
89}; 89};
90 90
91#endif 91#endif
92
93/*
94 * Overrides for Emacs so that we follow Linus's tabbing style.
95 * Emacs will notice this stuff at the end of the file and automatically
96 * adjust the settings for this buffer only. This must remain at the end
97 * of the file.
98 * ---------------------------------------------------------------------------
99 * Local variables:
100 * c-file-style: "linux"
101 * End:
102 */
diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h
index 609b9e87222a..1f6fd5ab4177 100644
--- a/include/asm-v850/bitops.h
+++ b/include/asm-v850/bitops.h
@@ -22,25 +22,11 @@
22 22
23#ifdef __KERNEL__ 23#ifdef __KERNEL__
24 24
25/* 25#include <asm-generic/bitops/ffz.h>
26 * The __ functions are not atomic
27 */
28 26
29/* 27/*
30 * ffz = Find First Zero in word. Undefined if no zero exists, 28 * The __ functions are not atomic
31 * so code should check against ~0UL first..
32 */ 29 */
33static inline unsigned long ffz (unsigned long word)
34{
35 unsigned long result = 0;
36
37 while (word & 1) {
38 result++;
39 word >>= 1;
40 }
41 return result;
42}
43
44 30
45/* In the following constant-bit-op macros, a "g" constraint is used when 31/* In the following constant-bit-op macros, a "g" constraint is used when
46 we really need an integer ("i" constraint). This is to avoid 32 we really need an integer ("i" constraint). This is to avoid
@@ -153,203 +139,19 @@ static inline int __test_bit (int nr, const void *addr)
153#define smp_mb__before_clear_bit() barrier () 139#define smp_mb__before_clear_bit() barrier ()
154#define smp_mb__after_clear_bit() barrier () 140#define smp_mb__after_clear_bit() barrier ()
155 141
142#include <asm-generic/bitops/ffs.h>
143#include <asm-generic/bitops/fls.h>
144#include <asm-generic/bitops/fls64.h>
145#include <asm-generic/bitops/__ffs.h>
146#include <asm-generic/bitops/find.h>
147#include <asm-generic/bitops/sched.h>
148#include <asm-generic/bitops/hweight.h>
156 149
157#define find_first_zero_bit(addr, size) \ 150#include <asm-generic/bitops/ext2-non-atomic.h>
158 find_next_zero_bit ((addr), (size), 0)
159
160static inline int find_next_zero_bit(const void *addr, int size, int offset)
161{
162 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
163 unsigned long result = offset & ~31UL;
164 unsigned long tmp;
165
166 if (offset >= size)
167 return size;
168 size -= result;
169 offset &= 31UL;
170 if (offset) {
171 tmp = * (p++);
172 tmp |= ~0UL >> (32-offset);
173 if (size < 32)
174 goto found_first;
175 if (~tmp)
176 goto found_middle;
177 size -= 32;
178 result += 32;
179 }
180 while (size & ~31UL) {
181 if (~ (tmp = * (p++)))
182 goto found_middle;
183 result += 32;
184 size -= 32;
185 }
186 if (!size)
187 return result;
188 tmp = *p;
189
190 found_first:
191 tmp |= ~0UL << size;
192 found_middle:
193 return result + ffz (tmp);
194}
195
196
197/* This is the same as generic_ffs, but we can't use that because it's
198 inline and the #include order mucks things up. */
199static inline int generic_ffs_for_find_next_bit(int x)
200{
201 int r = 1;
202
203 if (!x)
204 return 0;
205 if (!(x & 0xffff)) {
206 x >>= 16;
207 r += 16;
208 }
209 if (!(x & 0xff)) {
210 x >>= 8;
211 r += 8;
212 }
213 if (!(x & 0xf)) {
214 x >>= 4;
215 r += 4;
216 }
217 if (!(x & 3)) {
218 x >>= 2;
219 r += 2;
220 }
221 if (!(x & 1)) {
222 x >>= 1;
223 r += 1;
224 }
225 return r;
226}
227
228/*
229 * Find next one bit in a bitmap reasonably efficiently.
230 */
231static __inline__ unsigned long find_next_bit(const unsigned long *addr,
232 unsigned long size, unsigned long offset)
233{
234 unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
235 unsigned int result = offset & ~31UL;
236 unsigned int tmp;
237
238 if (offset >= size)
239 return size;
240 size -= result;
241 offset &= 31UL;
242 if (offset) {
243 tmp = *p++;
244 tmp &= ~0UL << offset;
245 if (size < 32)
246 goto found_first;
247 if (tmp)
248 goto found_middle;
249 size -= 32;
250 result += 32;
251 }
252 while (size >= 32) {
253 if ((tmp = *p++) != 0)
254 goto found_middle;
255 result += 32;
256 size -= 32;
257 }
258 if (!size)
259 return result;
260 tmp = *p;
261
262found_first:
263 tmp &= ~0UL >> (32 - size);
264 if (tmp == 0UL) /* Are any bits set? */
265 return result + size; /* Nope. */
266found_middle:
267 return result + generic_ffs_for_find_next_bit(tmp);
268}
269
270/*
271 * find_first_bit - find the first set bit in a memory region
272 */
273#define find_first_bit(addr, size) \
274 find_next_bit((addr), (size), 0)
275
276
277#define ffs(x) generic_ffs (x)
278#define fls(x) generic_fls (x)
279#define fls64(x) generic_fls64(x)
280#define __ffs(x) ffs(x)
281
282
283/*
284 * This is just `generic_ffs' from <linux/bitops.h>, except that it assumes
285 * that at least one bit is set, and returns the real index of the bit
286 * (rather than the bit index + 1, like ffs does).
287 */
288static inline int sched_ffs(int x)
289{
290 int r = 0;
291
292 if (!(x & 0xffff)) {
293 x >>= 16;
294 r += 16;
295 }
296 if (!(x & 0xff)) {
297 x >>= 8;
298 r += 8;
299 }
300 if (!(x & 0xf)) {
301 x >>= 4;
302 r += 4;
303 }
304 if (!(x & 3)) {
305 x >>= 2;
306 r += 2;
307 }
308 if (!(x & 1)) {
309 x >>= 1;
310 r += 1;
311 }
312 return r;
313}
314
315/*
316 * Every architecture must define this function. It's the fastest
317 * way of searching a 140-bit bitmap where the first 100 bits are
318 * unlikely to be set. It's guaranteed that at least one of the 140
319 * bits is set.
320 */
321static inline int sched_find_first_bit(unsigned long *b)
322{
323 unsigned offs = 0;
324 while (! *b) {
325 b++;
326 offs += 32;
327 }
328 return sched_ffs (*b) + offs;
329}
330
331/*
332 * hweightN: returns the hamming weight (i.e. the number
333 * of bits set) of a N-bit word
334 */
335#define hweight32(x) generic_hweight32 (x)
336#define hweight16(x) generic_hweight16 (x)
337#define hweight8(x) generic_hweight8 (x)
338
339#define ext2_set_bit test_and_set_bit
340#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 151#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
341#define ext2_clear_bit test_and_clear_bit
342#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a) 152#define ext2_clear_bit_atomic(l,n,a) test_and_clear_bit(n,a)
343#define ext2_test_bit test_bit
344#define ext2_find_first_zero_bit find_first_zero_bit
345#define ext2_find_next_zero_bit find_next_zero_bit
346 153
347/* Bitmap functions for the minix filesystem. */ 154#include <asm-generic/bitops/minix.h>
348#define minix_test_and_set_bit test_and_set_bit
349#define minix_set_bit set_bit
350#define minix_test_and_clear_bit test_and_clear_bit
351#define minix_test_bit test_bit
352#define minix_find_first_zero_bit find_first_zero_bit
353 155
354#endif /* __KERNEL__ */ 156#endif /* __KERNEL__ */
355 157
diff --git a/include/asm-v850/linkage.h b/include/asm-v850/linkage.h
index 291c2d01c44f..b6185d3cfe68 100644
--- a/include/asm-v850/linkage.h
+++ b/include/asm-v850/linkage.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_LINKAGE_H 1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H 2#define __ASM_LINKAGE_H
3 3
4/* Nothing to see here... */ 4#ifdef __ASSEMBLY__
5#include <asm/asm.h>
6#endif
5 7
6#endif 8#endif
diff --git a/include/asm-v850/page.h b/include/asm-v850/page.h
index b4bc85e7b91a..ad03c46a1f92 100644
--- a/include/asm-v850/page.h
+++ b/include/asm-v850/page.h
@@ -111,8 +111,7 @@ typedef unsigned long pgprot_t;
111#define page_to_virt(page) \ 111#define page_to_virt(page) \
112 ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) 112 ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
113 113
114#define pfn_to_page(pfn) virt_to_page (pfn_to_virt (pfn)) 114#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
115#define page_to_pfn(page) virt_to_pfn (page_to_virt (page))
116#define pfn_valid(pfn) ((pfn) < max_mapnr) 115#define pfn_valid(pfn) ((pfn) < max_mapnr)
117 116
118#define virt_addr_valid(kaddr) \ 117#define virt_addr_valid(kaddr) \
@@ -125,6 +124,7 @@ typedef unsigned long pgprot_t;
125 124
126#endif /* KERNEL */ 125#endif /* KERNEL */
127 126
127#include <asm-generic/memory_model.h>
128#include <asm-generic/page.h> 128#include <asm-generic/page.h>
129 129
130#endif /* __V850_PAGE_H__ */ 130#endif /* __V850_PAGE_H__ */
diff --git a/include/asm-v850/poll.h b/include/asm-v850/poll.h
index 0369562c7e15..c10176c2c28f 100644
--- a/include/asm-v850/poll.h
+++ b/include/asm-v850/poll.h
@@ -13,6 +13,7 @@
13#define POLLWRBAND 0x0100 13#define POLLWRBAND 0x0100
14#define POLLMSG 0x0400 14#define POLLMSG 0x0400
15#define POLLREMOVE 0x1000 15#define POLLREMOVE 0x1000
16#define POLLRDHUP 0x2000
16 17
17struct pollfd { 18struct pollfd {
18 int fd; 19 int fd;
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h
index decaa2d540e8..5a48e9bcf218 100644
--- a/include/asm-x86_64/apicdef.h
+++ b/include/asm-x86_64/apicdef.h
@@ -39,6 +39,7 @@
39#define APIC_SPIV_FOCUS_DISABLED (1<<9) 39#define APIC_SPIV_FOCUS_DISABLED (1<<9)
40#define APIC_SPIV_APIC_ENABLED (1<<8) 40#define APIC_SPIV_APIC_ENABLED (1<<8)
41#define APIC_ISR 0x100 41#define APIC_ISR 0x100
42#define APIC_ISR_NR 0x8 /* Number of 32 bit ISR registers. */
42#define APIC_TMR 0x180 43#define APIC_TMR 0x180
43#define APIC_IRR 0x200 44#define APIC_IRR 0x200
44#define APIC_ESR 0x280 45#define APIC_ESR 0x280
diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h
index 4b5cd553e772..cecbf7baa6aa 100644
--- a/include/asm-x86_64/atomic.h
+++ b/include/asm-x86_64/atomic.h
@@ -405,8 +405,14 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t *v)
405({ \ 405({ \
406 int c, old; \ 406 int c, old; \
407 c = atomic_read(v); \ 407 c = atomic_read(v); \
408 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ 408 for (;;) { \
409 if (unlikely(c == (u))) \
410 break; \
411 old = atomic_cmpxchg((v), c, c + (a)); \
412 if (likely(old == c)) \
413 break; \
409 c = old; \ 414 c = old; \
415 } \
410 c != (u); \ 416 c != (u); \
411}) 417})
412#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) 418#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index eb4df23e1e41..79212128d0f7 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -356,14 +356,7 @@ static __inline__ unsigned long __fls(unsigned long word)
356 356
357#ifdef __KERNEL__ 357#ifdef __KERNEL__
358 358
359static inline int sched_find_first_bit(const unsigned long *b) 359#include <asm-generic/bitops/sched.h>
360{
361 if (b[0])
362 return __ffs(b[0]);
363 if (b[1])
364 return __ffs(b[1]) + 64;
365 return __ffs(b[2]) + 128;
366}
367 360
368/** 361/**
369 * ffs - find first bit set 362 * ffs - find first bit set
@@ -412,43 +405,20 @@ static __inline__ int fls(int x)
412 return r+1; 405 return r+1;
413} 406}
414 407
415/** 408#include <asm-generic/bitops/hweight.h>
416 * hweightN - returns the hamming weight of a N-bit word
417 * @x: the word to weigh
418 *
419 * The Hamming Weight of a number is the total number of bits set in it.
420 */
421
422#define hweight64(x) generic_hweight64(x)
423#define hweight32(x) generic_hweight32(x)
424#define hweight16(x) generic_hweight16(x)
425#define hweight8(x) generic_hweight8(x)
426 409
427#endif /* __KERNEL__ */ 410#endif /* __KERNEL__ */
428 411
429#ifdef __KERNEL__ 412#ifdef __KERNEL__
430 413
431#define ext2_set_bit(nr,addr) \ 414#include <asm-generic/bitops/ext2-non-atomic.h>
432 __test_and_set_bit((nr),(unsigned long*)addr) 415
433#define ext2_set_bit_atomic(lock,nr,addr) \ 416#define ext2_set_bit_atomic(lock,nr,addr) \
434 test_and_set_bit((nr),(unsigned long*)addr) 417 test_and_set_bit((nr),(unsigned long*)addr)
435#define ext2_clear_bit(nr, addr) \
436 __test_and_clear_bit((nr),(unsigned long*)addr)
437#define ext2_clear_bit_atomic(lock,nr,addr) \ 418#define ext2_clear_bit_atomic(lock,nr,addr) \
438 test_and_clear_bit((nr),(unsigned long*)addr) 419 test_and_clear_bit((nr),(unsigned long*)addr)
439#define ext2_test_bit(nr, addr) test_bit((nr),(unsigned long*)addr) 420
440#define ext2_find_first_zero_bit(addr, size) \ 421#include <asm-generic/bitops/minix.h>
441 find_first_zero_bit((unsigned long*)addr, size)
442#define ext2_find_next_zero_bit(addr, size, off) \
443 find_next_zero_bit((unsigned long*)addr, size, off)
444
445/* Bitmap functions for the minix filesystem. */
446#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,(void*)addr)
447#define minix_set_bit(nr,addr) __set_bit(nr,(void*)addr)
448#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,(void*)addr)
449#define minix_test_bit(nr,addr) test_bit(nr,(void*)addr)
450#define minix_find_first_zero_bit(addr,size) \
451 find_first_zero_bit((void*)addr,size)
452 422
453#endif /* __KERNEL__ */ 423#endif /* __KERNEL__ */
454 424
diff --git a/include/asm-x86_64/cache.h b/include/asm-x86_64/cache.h
index 263f0a211ed7..c8043a16152e 100644
--- a/include/asm-x86_64/cache.h
+++ b/include/asm-x86_64/cache.h
@@ -20,6 +20,8 @@
20 __attribute__((__section__(".data.page_aligned"))) 20 __attribute__((__section__(".data.page_aligned")))
21#endif 21#endif
22 22
23#define __read_mostly __attribute__((__section__(".data.read_mostly")))
24
23#endif 25#endif
24 26
25#endif 27#endif
diff --git a/include/asm-x86_64/dmi.h b/include/asm-x86_64/dmi.h
new file mode 100644
index 000000000000..93b2b15d4325
--- /dev/null
+++ b/include/asm-x86_64/dmi.h
@@ -0,0 +1,27 @@
1#ifndef _ASM_DMI_H
2#define _ASM_DMI_H 1
3
4#include <asm/io.h>
5
6extern void *dmi_ioremap(unsigned long addr, unsigned long size);
7extern void dmi_iounmap(void *addr, unsigned long size);
8
9#define DMI_MAX_DATA 2048
10
11extern int dmi_alloc_index;
12extern char dmi_alloc_data[DMI_MAX_DATA];
13
14/* This is so early that there is no good way to allocate dynamic memory.
15 Allocate data in an BSS array. */
16static inline void *dmi_alloc(unsigned len)
17{
18 int idx = dmi_alloc_index;
19 if ((dmi_alloc_index += len) > DMI_MAX_DATA)
20 return NULL;
21 return dmi_alloc_data + idx;
22}
23
24#define dmi_ioremap early_ioremap
25#define dmi_iounmap early_iounmap
26
27#endif
diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h
index 43862cd6a569..c98633af07d2 100644
--- a/include/asm-x86_64/elf.h
+++ b/include/asm-x86_64/elf.h
@@ -8,6 +8,7 @@
8#include <asm/ptrace.h> 8#include <asm/ptrace.h>
9#include <asm/user.h> 9#include <asm/user.h>
10#include <asm/processor.h> 10#include <asm/processor.h>
11#include <asm/compat.h>
11 12
12/* x86-64 relocation types */ 13/* x86-64 relocation types */
13#define R_X86_64_NONE 0 /* No reloc */ 14#define R_X86_64_NONE 0 /* No reloc */
@@ -157,6 +158,9 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
157#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs) 158#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
158#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs) 159#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
159 160
161/* 1GB for 64bit, 8MB for 32bit */
162#define STACK_RND_MASK (is_compat_task() ? 0x7ff : 0x3fffff)
163
160#endif 164#endif
161 165
162#endif 166#endif
diff --git a/include/asm-x86_64/floppy.h b/include/asm-x86_64/floppy.h
index af7ded63b517..52825ce689f2 100644
--- a/include/asm-x86_64/floppy.h
+++ b/include/asm-x86_64/floppy.h
@@ -155,7 +155,7 @@ static int fd_request_irq(void)
155 155
156static unsigned long dma_mem_alloc(unsigned long size) 156static unsigned long dma_mem_alloc(unsigned long size)
157{ 157{
158 return __get_dma_pages(GFP_KERNEL,get_order(size)); 158 return __get_dma_pages(GFP_KERNEL|__GFP_NORETRY,get_order(size));
159} 159}
160 160
161 161
diff --git a/include/asm-x86_64/futex.h b/include/asm-x86_64/futex.h
index 8602c09bf89e..9804bf07b092 100644
--- a/include/asm-x86_64/futex.h
+++ b/include/asm-x86_64/futex.h
@@ -94,5 +94,32 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
94 return ret; 94 return ret;
95} 95}
96 96
97static inline int
98futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
99{
100 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
101 return -EFAULT;
102
103 __asm__ __volatile__(
104 "1: " LOCK_PREFIX "cmpxchgl %3, %1 \n"
105
106 "2: .section .fixup, \"ax\" \n"
107 "3: mov %2, %0 \n"
108 " jmp 2b \n"
109 " .previous \n"
110
111 " .section __ex_table, \"a\" \n"
112 " .align 8 \n"
113 " .quad 1b,3b \n"
114 " .previous \n"
115
116 : "=a" (oldval), "=m" (*uaddr)
117 : "i" (-EFAULT), "r" (newval), "0" (oldval)
118 : "memory"
119 );
120
121 return oldval;
122}
123
97#endif 124#endif
98#endif 125#endif
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index 9dac18db8291..cafdfb37f0d8 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -135,6 +135,9 @@ static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
135 return __ioremap(offset, size, 0); 135 return __ioremap(offset, size, 0);
136} 136}
137 137
138extern void *early_ioremap(unsigned long addr, unsigned long size);
139extern void early_iounmap(void *addr, unsigned long size);
140
138/* 141/*
139 * This one maps high address device memory and turns off caching for that area. 142 * This one maps high address device memory and turns off caching for that area.
140 * it's useful if some control registers are in such an area and write combining 143 * it's useful if some control registers are in such an area and write combining
@@ -143,11 +146,6 @@ static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
143extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); 146extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
144extern void iounmap(volatile void __iomem *addr); 147extern void iounmap(volatile void __iomem *addr);
145 148
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
151/* 149/*
152 * ISA I/O bus memory addresses are 1:1 with the physical address. 150 * ISA I/O bus memory addresses are 1:1 with the physical address.
153 */ 151 */
@@ -202,23 +200,6 @@ static inline __u64 __readq(const volatile void __iomem *addr)
202 200
203#define mmiowb() 201#define mmiowb()
204 202
205#ifdef CONFIG_UNORDERED_IO
206static inline void __writel(__u32 val, volatile void __iomem *addr)
207{
208 volatile __u32 __iomem *target = addr;
209 asm volatile("movnti %1,%0"
210 : "=m" (*target)
211 : "r" (val) : "memory");
212}
213
214static inline void __writeq(__u64 val, volatile void __iomem *addr)
215{
216 volatile __u64 __iomem *target = addr;
217 asm volatile("movnti %1,%0"
218 : "=m" (*target)
219 : "r" (val) : "memory");
220}
221#else
222static inline void __writel(__u32 b, volatile void __iomem *addr) 203static inline void __writel(__u32 b, volatile void __iomem *addr)
223{ 204{
224 *(__force volatile __u32 *)addr = b; 205 *(__force volatile __u32 *)addr = b;
@@ -227,7 +208,6 @@ static inline void __writeq(__u64 b, volatile void __iomem *addr)
227{ 208{
228 *(__force volatile __u64 *)addr = b; 209 *(__force volatile __u64 *)addr = b;
229} 210}
230#endif
231static inline void __writeb(__u8 b, volatile void __iomem *addr) 211static inline void __writeb(__u8 b, volatile void __iomem *addr)
232{ 212{
233 *(__force volatile __u8 *)addr = b; 213 *(__force volatile __u8 *)addr = b;
@@ -269,23 +249,11 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
269 */ 249 */
270#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET)) 250#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
271 251
272#define isa_readb(a) readb(__ISA_IO_base + (a))
273#define isa_readw(a) readw(__ISA_IO_base + (a))
274#define isa_readl(a) readl(__ISA_IO_base + (a))
275#define isa_writeb(b,a) writeb(b,__ISA_IO_base + (a))
276#define isa_writew(w,a) writew(w,__ISA_IO_base + (a))
277#define isa_writel(l,a) writel(l,__ISA_IO_base + (a))
278#define isa_memset_io(a,b,c) memset_io(__ISA_IO_base + (a),(b),(c))
279#define isa_memcpy_fromio(a,b,c) memcpy_fromio((a),__ISA_IO_base + (b),(c))
280#define isa_memcpy_toio(a,b,c) memcpy_toio(__ISA_IO_base + (a),(b),(c))
281
282
283/* 252/*
284 * Again, x86-64 does not require mem IO specific function. 253 * Again, x86-64 does not require mem IO specific function.
285 */ 254 */
286 255
287#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d)) 256#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d))
288#define isa_eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(__ISA_IO_base + (b)),(c),(d))
289 257
290/** 258/**
291 * check_signature - find BIOS signatures 259 * check_signature - find BIOS signatures
diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h
index b9ed4c0c8783..cf795631d9b4 100644
--- a/include/asm-x86_64/kdebug.h
+++ b/include/asm-x86_64/kdebug.h
@@ -5,21 +5,20 @@
5 5
6struct pt_regs; 6struct pt_regs;
7 7
8struct die_args { 8struct die_args {
9 struct pt_regs *regs; 9 struct pt_regs *regs;
10 const char *str; 10 const char *str;
11 long err; 11 long err;
12 int trapnr; 12 int trapnr;
13 int signr; 13 int signr;
14}; 14};
15
16extern int register_die_notifier(struct notifier_block *);
17extern int unregister_die_notifier(struct notifier_block *);
18extern struct atomic_notifier_head die_chain;
15 19
16/* Note - you should never unregister because that can race with NMIs.
17 If you really want to do it first unregister - then synchronize_sched - then free.
18 */
19int register_die_notifier(struct notifier_block *nb);
20extern struct notifier_block *die_chain;
21/* Grossly misnamed. */ 20/* Grossly misnamed. */
22enum die_val { 21enum die_val {
23 DIE_OOPS = 1, 22 DIE_OOPS = 1,
24 DIE_INT3, 23 DIE_INT3,
25 DIE_DEBUG, 24 DIE_DEBUG,
@@ -33,8 +32,8 @@ enum die_val {
33 DIE_CALL, 32 DIE_CALL,
34 DIE_NMI_IPI, 33 DIE_NMI_IPI,
35 DIE_PAGE_FAULT, 34 DIE_PAGE_FAULT,
36}; 35};
37 36
38static inline int notify_die(enum die_val val, const char *str, 37static inline int notify_die(enum die_val val, const char *str,
39 struct pt_regs *regs, long err, int trap, int sig) 38 struct pt_regs *regs, long err, int trap, int sig)
40{ 39{
@@ -45,7 +44,7 @@ static inline int notify_die(enum die_val val, const char *str,
45 .trapnr = trap, 44 .trapnr = trap,
46 .signr = sig 45 .signr = sig
47 }; 46 };
48 return notifier_call_chain(&die_chain, val, &args); 47 return atomic_notifier_call_chain(&die_chain, val, &args);
49} 48}
50 49
51extern int printk_address(unsigned long address); 50extern int printk_address(unsigned long address);
diff --git a/include/asm-x86_64/local.h b/include/asm-x86_64/local.h
index 3e72c41727c5..cd17945bf218 100644
--- a/include/asm-x86_64/local.h
+++ b/include/asm-x86_64/local.h
@@ -5,7 +5,7 @@
5 5
6typedef struct 6typedef struct
7{ 7{
8 volatile unsigned int counter; 8 volatile long counter;
9} local_t; 9} local_t;
10 10
11#define LOCAL_INIT(i) { (i) } 11#define LOCAL_INIT(i) { (i) }
@@ -13,34 +13,34 @@ typedef struct
13#define local_read(v) ((v)->counter) 13#define local_read(v) ((v)->counter)
14#define local_set(v,i) (((v)->counter) = (i)) 14#define local_set(v,i) (((v)->counter) = (i))
15 15
16static __inline__ void local_inc(local_t *v) 16static inline void local_inc(local_t *v)
17{ 17{
18 __asm__ __volatile__( 18 __asm__ __volatile__(
19 "incl %0" 19 "incq %0"
20 :"=m" (v->counter) 20 :"=m" (v->counter)
21 :"m" (v->counter)); 21 :"m" (v->counter));
22} 22}
23 23
24static __inline__ void local_dec(local_t *v) 24static inline void local_dec(local_t *v)
25{ 25{
26 __asm__ __volatile__( 26 __asm__ __volatile__(
27 "decl %0" 27 "decq %0"
28 :"=m" (v->counter) 28 :"=m" (v->counter)
29 :"m" (v->counter)); 29 :"m" (v->counter));
30} 30}
31 31
32static __inline__ void local_add(unsigned int i, local_t *v) 32static inline void local_add(long i, local_t *v)
33{ 33{
34 __asm__ __volatile__( 34 __asm__ __volatile__(
35 "addl %1,%0" 35 "addq %1,%0"
36 :"=m" (v->counter) 36 :"=m" (v->counter)
37 :"ir" (i), "m" (v->counter)); 37 :"ir" (i), "m" (v->counter));
38} 38}
39 39
40static __inline__ void local_sub(unsigned int i, local_t *v) 40static inline void local_sub(long i, local_t *v)
41{ 41{
42 __asm__ __volatile__( 42 __asm__ __volatile__(
43 "subl %1,%0" 43 "subq %1,%0"
44 :"=m" (v->counter) 44 :"=m" (v->counter)
45 :"ir" (i), "m" (v->counter)); 45 :"ir" (i), "m" (v->counter));
46} 46}
diff --git a/include/asm-x86_64/mmu_context.h b/include/asm-x86_64/mmu_context.h
index 16e4be4de0c5..19f0c83d0792 100644
--- a/include/asm-x86_64/mmu_context.h
+++ b/include/asm-x86_64/mmu_context.h
@@ -34,12 +34,12 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
34 unsigned cpu = smp_processor_id(); 34 unsigned cpu = smp_processor_id();
35 if (likely(prev != next)) { 35 if (likely(prev != next)) {
36 /* stop flush ipis for the previous mm */ 36 /* stop flush ipis for the previous mm */
37 clear_bit(cpu, &prev->cpu_vm_mask); 37 cpu_clear(cpu, prev->cpu_vm_mask);
38#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
39 write_pda(mmu_state, TLBSTATE_OK); 39 write_pda(mmu_state, TLBSTATE_OK);
40 write_pda(active_mm, next); 40 write_pda(active_mm, next);
41#endif 41#endif
42 set_bit(cpu, &next->cpu_vm_mask); 42 cpu_set(cpu, next->cpu_vm_mask);
43 load_cr3(next->pgd); 43 load_cr3(next->pgd);
44 44
45 if (unlikely(next->context.ldt != prev->context.ldt)) 45 if (unlikely(next->context.ldt != prev->context.ldt))
@@ -50,7 +50,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
50 write_pda(mmu_state, TLBSTATE_OK); 50 write_pda(mmu_state, TLBSTATE_OK);
51 if (read_pda(active_mm) != next) 51 if (read_pda(active_mm) != next)
52 out_of_line_bug(); 52 out_of_line_bug();
53 if(!test_and_set_bit(cpu, &next->cpu_vm_mask)) { 53 if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) {
54 /* We were in lazy tlb mode and leave_mm disabled 54 /* We were in lazy tlb mode and leave_mm disabled
55 * tlb flush IPI delivery. We must reload CR3 55 * tlb flush IPI delivery. We must reload CR3
56 * to make sure to use no freed page tables. 56 * to make sure to use no freed page tables.
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index 972c9359f7d7..6b18cd8f293d 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -15,8 +15,13 @@
15#define NODEMAPSIZE 0xfff 15#define NODEMAPSIZE 0xfff
16 16
17/* Simple perfect hash to map physical addresses to node numbers */ 17/* Simple perfect hash to map physical addresses to node numbers */
18extern int memnode_shift; 18struct memnode {
19extern u8 memnodemap[NODEMAPSIZE]; 19 int shift;
20 u8 map[NODEMAPSIZE];
21} ____cacheline_aligned;
22extern struct memnode memnode;
23#define memnode_shift memnode.shift
24#define memnodemap memnode.map
20 25
21extern struct pglist_data *node_data[]; 26extern struct pglist_data *node_data[];
22 27
@@ -39,12 +44,8 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
39#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) 44#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
40#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr)) 45#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr))
41 46
42extern struct page *pfn_to_page(unsigned long pfn);
43extern unsigned long page_to_pfn(struct page *page);
44extern int pfn_valid(unsigned long pfn); 47extern int pfn_valid(unsigned long pfn);
45#endif 48#endif
46 49
47#define local_mapnr(kvaddr) \
48 ( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) )
49#endif 50#endif
50#endif 51#endif
diff --git a/include/asm-x86_64/numa.h b/include/asm-x86_64/numa.h
index dffe276ca2df..f6cbb4cbb5a3 100644
--- a/include/asm-x86_64/numa.h
+++ b/include/asm-x86_64/numa.h
@@ -4,11 +4,11 @@
4#include <linux/nodemask.h> 4#include <linux/nodemask.h>
5#include <asm/numnodes.h> 5#include <asm/numnodes.h>
6 6
7struct node { 7struct bootnode {
8 u64 start,end; 8 u64 start,end;
9}; 9};
10 10
11extern int compute_hash_shift(struct node *nodes, int numnodes); 11extern int compute_hash_shift(struct bootnode *nodes, int numnodes);
12extern int pxm_to_node(int nid); 12extern int pxm_to_node(int nid);
13 13
14#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) 14#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index 615e3e494929..408185bac351 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -123,8 +123,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
123#define __boot_va(x) __va(x) 123#define __boot_va(x) __va(x)
124#define __boot_pa(x) __pa(x) 124#define __boot_pa(x) __pa(x)
125#ifdef CONFIG_FLATMEM 125#ifdef CONFIG_FLATMEM
126#define pfn_to_page(pfn) (mem_map + (pfn))
127#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
128#define pfn_valid(pfn) ((pfn) < end_pfn) 126#define pfn_valid(pfn) ((pfn) < end_pfn)
129#endif 127#endif
130 128
@@ -140,6 +138,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
140 138
141#endif /* __KERNEL__ */ 139#endif /* __KERNEL__ */
142 140
141#include <asm-generic/memory_model.h>
143#include <asm-generic/page.h> 142#include <asm-generic/page.h>
144 143
145#endif /* _X86_64_PAGE_H */ 144#endif /* _X86_64_PAGE_H */
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
index c7ab38a601af..b47c3df9ed1d 100644
--- a/include/asm-x86_64/pda.h
+++ b/include/asm-x86_64/pda.h
@@ -22,8 +22,8 @@ struct x8664_pda {
22 int nodenumber; /* number of current node */ 22 int nodenumber; /* number of current node */
23 unsigned int __softirq_pending; 23 unsigned int __softirq_pending;
24 unsigned int __nmi_count; /* number of NMI on this CPUs */ 24 unsigned int __nmi_count; /* number of NMI on this CPUs */
25 struct mm_struct *active_mm;
26 int mmu_state; 25 int mmu_state;
26 struct mm_struct *active_mm;
27 unsigned apic_timer_irqs; 27 unsigned apic_timer_irqs;
28} ____cacheline_aligned_in_smp; 28} ____cacheline_aligned_in_smp;
29 29
diff --git a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
index 29a6b0408f75..4405b4adeaba 100644
--- a/include/asm-x86_64/percpu.h
+++ b/include/asm-x86_64/percpu.h
@@ -26,10 +26,9 @@
26#define percpu_modcopy(pcpudst, src, size) \ 26#define percpu_modcopy(pcpudst, src, size) \
27do { \ 27do { \
28 unsigned int __i; \ 28 unsigned int __i; \
29 for (__i = 0; __i < NR_CPUS; __i++) \ 29 for_each_cpu(__i) \
30 if (cpu_possible(__i)) \ 30 memcpy((pcpudst)+__per_cpu_offset(__i), \
31 memcpy((pcpudst)+__per_cpu_offset(__i), \ 31 (src), (size)); \
32 (src), (size)); \
33} while (0) 32} while (0)
34 33
35extern void setup_per_cpu_areas(void); 34extern void setup_per_cpu_areas(void);
diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h
index 08cad2482bcb..43d4c333a8b1 100644
--- a/include/asm-x86_64/pgalloc.h
+++ b/include/asm-x86_64/pgalloc.h
@@ -45,12 +45,39 @@ static inline void pud_free (pud_t *pud)
45 free_page((unsigned long)pud); 45 free_page((unsigned long)pud);
46} 46}
47 47
48static inline void pgd_list_add(pgd_t *pgd)
49{
50 struct page *page = virt_to_page(pgd);
51
52 spin_lock(&pgd_lock);
53 page->index = (pgoff_t)pgd_list;
54 if (pgd_list)
55 pgd_list->private = (unsigned long)&page->index;
56 pgd_list = page;
57 page->private = (unsigned long)&pgd_list;
58 spin_unlock(&pgd_lock);
59}
60
61static inline void pgd_list_del(pgd_t *pgd)
62{
63 struct page *next, **pprev, *page = virt_to_page(pgd);
64
65 spin_lock(&pgd_lock);
66 next = (struct page *)page->index;
67 pprev = (struct page **)page->private;
68 *pprev = next;
69 if (next)
70 next->private = (unsigned long)pprev;
71 spin_unlock(&pgd_lock);
72}
73
48static inline pgd_t *pgd_alloc(struct mm_struct *mm) 74static inline pgd_t *pgd_alloc(struct mm_struct *mm)
49{ 75{
50 unsigned boundary; 76 unsigned boundary;
51 pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); 77 pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
52 if (!pgd) 78 if (!pgd)
53 return NULL; 79 return NULL;
80 pgd_list_add(pgd);
54 /* 81 /*
55 * Copy kernel pointers in from init. 82 * Copy kernel pointers in from init.
56 * Could keep a freelist or slab cache of those because the kernel 83 * Could keep a freelist or slab cache of those because the kernel
@@ -67,6 +94,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
67static inline void pgd_free(pgd_t *pgd) 94static inline void pgd_free(pgd_t *pgd)
68{ 95{
69 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1)); 96 BUG_ON((unsigned long)pgd & (PAGE_SIZE-1));
97 pgd_list_del(pgd);
70 free_page((unsigned long)pgd); 98 free_page((unsigned long)pgd);
71} 99}
72 100
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 715fd94cf577..31e83c3bd022 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -273,7 +273,7 @@ static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
273static 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; }
274static 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) & _PAGE_PSE; }
277 277
278static 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; }
279static 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; }
@@ -285,7 +285,7 @@ static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _
285static 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; }
286static 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; }
287static 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; }
288static 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) | _PAGE_PSE)); return pte; }
289 289
290struct vm_area_struct; 290struct vm_area_struct;
291 291
@@ -293,19 +293,19 @@ static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned
293{ 293{
294 if (!pte_dirty(*ptep)) 294 if (!pte_dirty(*ptep))
295 return 0; 295 return 0;
296 return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep); 296 return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte);
297} 297}
298 298
299static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 299static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
300{ 300{
301 if (!pte_young(*ptep)) 301 if (!pte_young(*ptep))
302 return 0; 302 return 0;
303 return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); 303 return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte);
304} 304}
305 305
306static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 306static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
307{ 307{
308 clear_bit(_PAGE_BIT_RW, ptep); 308 clear_bit(_PAGE_BIT_RW, &ptep->pte);
309} 309}
310 310
311/* 311/*
@@ -420,6 +420,10 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
420#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 420#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
421#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 421#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
422 422
423extern spinlock_t pgd_lock;
424extern struct page *pgd_list;
425void vmalloc_sync_all(void);
426
423#endif /* !__ASSEMBLY__ */ 427#endif /* !__ASSEMBLY__ */
424 428
425extern int kern_addr_valid(unsigned long addr); 429extern int kern_addr_valid(unsigned long addr);
diff --git a/include/asm-x86_64/poll.h b/include/asm-x86_64/poll.h
index c43cbba31913..c0475a9d8bb8 100644
--- a/include/asm-x86_64/poll.h
+++ b/include/asm-x86_64/poll.h
@@ -16,6 +16,7 @@
16#define POLLWRBAND 0x0200 16#define POLLWRBAND 0x0200
17#define POLLMSG 0x0400 17#define POLLMSG 0x0400
18#define POLLREMOVE 0x1000 18#define POLLREMOVE 0x1000
19#define POLLRDHUP 0x2000
19 20
20struct pollfd { 21struct pollfd {
21 int fd; 22 int fd;
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 8c8d88c036ed..37a3ec433ee5 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -20,6 +20,7 @@
20#include <asm/mmsegment.h> 20#include <asm/mmsegment.h>
21#include <asm/percpu.h> 21#include <asm/percpu.h>
22#include <linux/personality.h> 22#include <linux/personality.h>
23#include <linux/cpumask.h>
23 24
24#define TF_MASK 0x00000100 25#define TF_MASK 0x00000100
25#define IF_MASK 0x00000200 26#define IF_MASK 0x00000200
@@ -65,6 +66,9 @@ struct cpuinfo_x86 {
65 __u32 x86_power; 66 __u32 x86_power;
66 __u32 extended_cpuid_level; /* Max extended CPUID function supported */ 67 __u32 extended_cpuid_level; /* Max extended CPUID function supported */
67 unsigned long loops_per_jiffy; 68 unsigned long loops_per_jiffy;
69#ifdef CONFIG_SMP
70 cpumask_t llc_shared_map; /* cpus sharing the last level cache */
71#endif
68 __u8 apicid; 72 __u8 apicid;
69 __u8 booted_cores; /* number of cores as seen by OS */ 73 __u8 booted_cores; /* number of cores as seen by OS */
70} ____cacheline_aligned; 74} ____cacheline_aligned;
@@ -354,9 +358,6 @@ struct extended_sigtable {
354 struct extended_signature sigs[0]; 358 struct extended_signature sigs[0];
355}; 359};
356 360
357/* '6' because it used to be for P6 only (but now covers Pentium 4 as well) */
358#define MICROCODE_IOCFREE _IO('6',0)
359
360 361
361#define ASM_NOP1 K8_NOP1 362#define ASM_NOP1 K8_NOP1
362#define ASM_NOP2 K8_NOP2 363#define ASM_NOP2 K8_NOP2
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index 3ba8fd45fcb3..8abf2a43c944 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -53,8 +53,6 @@ extern int sysctl_vsyscall;
53extern int nohpet; 53extern int nohpet;
54extern unsigned long vxtime_hz; 54extern unsigned long vxtime_hz;
55 55
56extern void do_softirq_thunk(void);
57
58extern int numa_setup(char *opt); 56extern int numa_setup(char *opt);
59 57
60extern int setup_early_printk(char *); 58extern int setup_early_printk(char *);
@@ -129,7 +127,6 @@ extern int fix_aperture;
129#define iommu_aperture 0 127#define iommu_aperture 0
130#define iommu_aperture_allowed 0 128#define iommu_aperture_allowed 0
131#endif 129#endif
132extern int force_iommu;
133 130
134extern int reboot_force; 131extern int reboot_force;
135extern int notsc_setup(char *); 132extern int notsc_setup(char *);
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index 9ccbb2cfd5c0..a4fdaeb5c397 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -56,6 +56,7 @@ extern cpumask_t cpu_sibling_map[NR_CPUS];
56extern cpumask_t cpu_core_map[NR_CPUS]; 56extern cpumask_t cpu_core_map[NR_CPUS];
57extern u8 phys_proc_id[NR_CPUS]; 57extern u8 phys_proc_id[NR_CPUS];
58extern u8 cpu_core_id[NR_CPUS]; 58extern u8 cpu_core_id[NR_CPUS];
59extern u8 cpu_llc_id[NR_CPUS];
59 60
60#define SMP_TRAMPOLINE_BASE 0x6000 61#define SMP_TRAMPOLINE_BASE 0x6000
61 62
diff --git a/include/asm-x86_64/string.h b/include/asm-x86_64/string.h
index a3493ee282bb..ee6bf275349e 100644
--- a/include/asm-x86_64/string.h
+++ b/include/asm-x86_64/string.h
@@ -40,26 +40,15 @@ extern void *__memcpy(void *to, const void *from, size_t len);
40 40
41 41
42#define __HAVE_ARCH_MEMSET 42#define __HAVE_ARCH_MEMSET
43#define memset __builtin_memset 43void *memset(void *s, int c, size_t n);
44 44
45#define __HAVE_ARCH_MEMMOVE 45#define __HAVE_ARCH_MEMMOVE
46void * memmove(void * dest,const void *src,size_t count); 46void * memmove(void * dest,const void *src,size_t count);
47 47
48/* Use C out of line version for memcmp */
49#define memcmp __builtin_memcmp
50int memcmp(const void * cs,const void * ct,size_t count); 48int memcmp(const void * cs,const void * ct,size_t count);
51
52/* out of line string functions use always C versions */
53#define strlen __builtin_strlen
54size_t strlen(const char * s); 49size_t strlen(const char * s);
55 50char *strcpy(char * dest,const char *src);
56#define strcpy __builtin_strcpy 51char *strcat(char * dest, const char * src);
57char * strcpy(char * dest,const char *src);
58
59#define strcat __builtin_strcat
60char * strcat(char * dest, const char * src);
61
62#define strcmp __builtin_strcmp
63int strcmp(const char * cs,const char * ct); 52int strcmp(const char * cs,const char * ct);
64 53
65#endif /* __KERNEL__ */ 54#endif /* __KERNEL__ */
diff --git a/include/asm-x86_64/suspend.h b/include/asm-x86_64/suspend.h
index bb9f40597d09..bc7f81715e5e 100644
--- a/include/asm-x86_64/suspend.h
+++ b/include/asm-x86_64/suspend.h
@@ -39,9 +39,7 @@ extern unsigned long saved_context_r12, saved_context_r13, saved_context_r14, sa
39extern unsigned long saved_context_eflags; 39extern unsigned long saved_context_eflags;
40 40
41#define loaddebug(thread,register) \ 41#define loaddebug(thread,register) \
42 __asm__("movq %0,%%db" #register \ 42 set_debugreg((thread)->debugreg##register, register)
43 : /* no output */ \
44 :"r" ((thread)->debugreg##register))
45 43
46extern void fix_processor_context(void); 44extern void fix_processor_context(void);
47 45
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index b7f66034ae7a..397598980228 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -70,12 +70,6 @@ extern void load_gs_index(unsigned);
70 ".previous" \ 70 ".previous" \
71 : :"r" (value), "r" (0)) 71 : :"r" (value), "r" (0))
72 72
73#define set_debug(value,register) \
74 __asm__("movq %0,%%db" #register \
75 : /* no output */ \
76 :"r" ((unsigned long) value))
77
78
79#ifdef __KERNEL__ 73#ifdef __KERNEL__
80struct alt_instr { 74struct alt_instr {
81 __u8 *instr; /* original instruction */ 75 __u8 *instr; /* original instruction */
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
index c642f5d9882d..9db54e9d17bb 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -68,4 +68,6 @@ extern int __node_distance(int, int);
68 68
69#include <asm-generic/topology.h> 69#include <asm-generic/topology.h>
70 70
71extern cpumask_t cpu_coregroup_map(int cpu);
72
71#endif 73#endif
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index da0341c57949..f21ff2c1e960 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -605,8 +605,14 @@ __SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */
605__SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */ 605__SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */
606#define __NR_unshare 272 606#define __NR_unshare 272
607__SYSCALL(__NR_unshare, sys_unshare) 607__SYSCALL(__NR_unshare, sys_unshare)
608 608#define __NR_set_robust_list 273
609#define __NR_syscall_max __NR_unshare 609__SYSCALL(__NR_set_robust_list, sys_set_robust_list)
610#define __NR_get_robust_list 274
611__SYSCALL(__NR_get_robust_list, sys_get_robust_list)
612#define __NR_splice 275
613__SYSCALL(__NR_splice, sys_splice)
614
615#define __NR_syscall_max __NR_splice
610 616
611#ifndef __NO_STUBS 617#ifndef __NO_STUBS
612 618
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h
index 0a2065f1a372..d815649617aa 100644
--- a/include/asm-xtensa/bitops.h
+++ b/include/asm-xtensa/bitops.h
@@ -23,156 +23,11 @@
23# error SMP not supported on this architecture 23# error SMP not supported on this architecture
24#endif 24#endif
25 25
26static __inline__ void set_bit(int nr, volatile void * addr)
27{
28 unsigned long mask = 1 << (nr & 0x1f);
29 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
30 unsigned long flags;
31
32 local_irq_save(flags);
33 *a |= mask;
34 local_irq_restore(flags);
35}
36
37static __inline__ void __set_bit(int nr, volatile unsigned long * addr)
38{
39 unsigned long mask = 1 << (nr & 0x1f);
40 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
41
42 *a |= mask;
43}
44
45static __inline__ void clear_bit(int nr, volatile void * addr)
46{
47 unsigned long mask = 1 << (nr & 0x1f);
48 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
49 unsigned long flags;
50
51 local_irq_save(flags);
52 *a &= ~mask;
53 local_irq_restore(flags);
54}
55
56static __inline__ void __clear_bit(int nr, volatile unsigned long *addr)
57{
58 unsigned long mask = 1 << (nr & 0x1f);
59 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
60
61 *a &= ~mask;
62}
63
64/*
65 * clear_bit() doesn't provide any barrier for the compiler.
66 */
67
68#define smp_mb__before_clear_bit() barrier() 26#define smp_mb__before_clear_bit() barrier()
69#define smp_mb__after_clear_bit() barrier() 27#define smp_mb__after_clear_bit() barrier()
70 28
71static __inline__ void change_bit(int nr, volatile void * addr) 29#include <asm-generic/bitops/atomic.h>
72{ 30#include <asm-generic/bitops/non-atomic.h>
73 unsigned long mask = 1 << (nr & 0x1f);
74 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
75 unsigned long flags;
76
77 local_irq_save(flags);
78 *a ^= mask;
79 local_irq_restore(flags);
80}
81
82static __inline__ void __change_bit(int nr, volatile void * addr)
83{
84 unsigned long mask = 1 << (nr & 0x1f);
85 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
86
87 *a ^= mask;
88}
89
90static __inline__ int test_and_set_bit(int nr, volatile void * addr)
91{
92 unsigned long retval;
93 unsigned long mask = 1 << (nr & 0x1f);
94 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
95 unsigned long flags;
96
97 local_irq_save(flags);
98 retval = (mask & *a) != 0;
99 *a |= mask;
100 local_irq_restore(flags);
101
102 return retval;
103}
104
105static __inline__ int __test_and_set_bit(int nr, volatile void * addr)
106{
107 unsigned long retval;
108 unsigned long mask = 1 << (nr & 0x1f);
109 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
110
111 retval = (mask & *a) != 0;
112 *a |= mask;
113
114 return retval;
115}
116
117static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
118{
119 unsigned long retval;
120 unsigned long mask = 1 << (nr & 0x1f);
121 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
122 unsigned long flags;
123
124 local_irq_save(flags);
125 retval = (mask & *a) != 0;
126 *a &= ~mask;
127 local_irq_restore(flags);
128
129 return retval;
130}
131
132static __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
133{
134 unsigned long mask = 1 << (nr & 0x1f);
135 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
136 unsigned long old = *a;
137
138 *a = old & ~mask;
139 return (old & mask) != 0;
140}
141
142static __inline__ int test_and_change_bit(int nr, volatile void * addr)
143{
144 unsigned long retval;
145 unsigned long mask = 1 << (nr & 0x1f);
146 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
147 unsigned long flags;
148
149 local_irq_save(flags);
150
151 retval = (mask & *a) != 0;
152 *a ^= mask;
153 local_irq_restore(flags);
154
155 return retval;
156}
157
158/*
159 * non-atomic version; can be reordered
160 */
161
162static __inline__ int __test_and_change_bit(int nr, volatile void *addr)
163{
164 unsigned long mask = 1 << (nr & 0x1f);
165 unsigned long *a = ((unsigned long *)addr) + (nr >> 5);
166 unsigned long old = *a;
167
168 *a = old ^ mask;
169 return (old & mask) != 0;
170}
171
172static __inline__ int test_bit(int nr, const volatile void *addr)
173{
174 return 1UL & (((const volatile unsigned int *)addr)[nr>>5] >> (nr&31));
175}
176 31
177#if XCHAL_HAVE_NSA 32#if XCHAL_HAVE_NSA
178 33
@@ -245,202 +100,23 @@ static __inline__ int fls (unsigned int x)
245{ 100{
246 return __cntlz(x); 101 return __cntlz(x);
247} 102}
248#define fls64(x) generic_fls64(x) 103#include <asm-generic/bitops/fls64.h>
249 104#include <asm-generic/bitops/find.h>
250static __inline__ int 105#include <asm-generic/bitops/ext2-non-atomic.h>
251find_next_bit(const unsigned long *addr, int size, int offset)
252{
253 const unsigned long *p = addr + (offset >> 5);
254 unsigned long result = offset & ~31UL;
255 unsigned long tmp;
256
257 if (offset >= size)
258 return size;
259 size -= result;
260 offset &= 31UL;
261 if (offset) {
262 tmp = *p++;
263 tmp &= ~0UL << offset;
264 if (size < 32)
265 goto found_first;
266 if (tmp)
267 goto found_middle;
268 size -= 32;
269 result += 32;
270 }
271 while (size >= 32) {
272 if ((tmp = *p++) != 0)
273 goto found_middle;
274 result += 32;
275 size -= 32;
276 }
277 if (!size)
278 return result;
279 tmp = *p;
280
281found_first:
282 tmp &= ~0UL >> (32 - size);
283 if (tmp == 0UL) /* Are any bits set? */
284 return result + size; /* Nope. */
285found_middle:
286 return result + __ffs(tmp);
287}
288
289/**
290 * find_first_bit - find the first set bit in a memory region
291 * @addr: The address to start the search at
292 * @size: The maximum size to search
293 *
294 * Returns the bit-number of the first set bit, not the number of the byte
295 * containing a bit.
296 */
297
298#define find_first_bit(addr, size) \
299 find_next_bit((addr), (size), 0)
300
301static __inline__ int
302find_next_zero_bit(const unsigned long *addr, int size, int offset)
303{
304 const unsigned long *p = addr + (offset >> 5);
305 unsigned long result = offset & ~31UL;
306 unsigned long tmp;
307
308 if (offset >= size)
309 return size;
310 size -= result;
311 offset &= 31UL;
312 if (offset) {
313 tmp = *p++;
314 tmp |= ~0UL >> (32-offset);
315 if (size < 32)
316 goto found_first;
317 if (~tmp)
318 goto found_middle;
319 size -= 32;
320 result += 32;
321 }
322 while (size & ~31UL) {
323 if (~(tmp = *p++))
324 goto found_middle;
325 result += 32;
326 size -= 32;
327 }
328 if (!size)
329 return result;
330 tmp = *p;
331
332found_first:
333 tmp |= ~0UL << size;
334found_middle:
335 return result + ffz(tmp);
336}
337
338#define find_first_zero_bit(addr, size) \
339 find_next_zero_bit((addr), (size), 0)
340 106
341#ifdef __XTENSA_EL__ 107#ifdef __XTENSA_EL__
342# define ext2_set_bit(nr,addr) __test_and_set_bit((nr), (addr))
343# define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr),(addr)) 108# define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr),(addr))
344# define ext2_clear_bit(nr,addr) __test_and_clear_bit((nr), (addr))
345# define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr),(addr)) 109# define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr),(addr))
346# define ext2_test_bit(nr,addr) test_bit((nr), (addr))
347# define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr),(size))
348# define ext2_find_next_zero_bit(addr, size, offset) \
349 find_next_zero_bit((addr), (size), (offset))
350#elif defined(__XTENSA_EB__) 110#elif defined(__XTENSA_EB__)
351# define ext2_set_bit(nr,addr) __test_and_set_bit((nr) ^ 0x18, (addr))
352# define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr) ^ 0x18, (addr)) 111# define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit((nr) ^ 0x18, (addr))
353# define ext2_clear_bit(nr,addr) __test_and_clear_bit((nr) ^ 18, (addr))
354# define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr)^0x18,(addr)) 112# define ext2_clear_bit_atomic(lock,nr,addr) test_and_clear_bit((nr)^0x18,(addr))
355# define ext2_test_bit(nr,addr) test_bit((nr) ^ 0x18, (addr))
356# define ext2_find_first_zero_bit(addr, size) \
357 ext2_find_next_zero_bit((addr), (size), 0)
358
359static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
360{
361 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
362 unsigned long result = offset & ~31UL;
363 unsigned long tmp;
364
365 if (offset >= size)
366 return size;
367 size -= result;
368 offset &= 31UL;
369 if(offset) {
370 /* We hold the little endian value in tmp, but then the
371 * shift is illegal. So we could keep a big endian value
372 * in tmp, like this:
373 *
374 * tmp = __swab32(*(p++));
375 * tmp |= ~0UL >> (32-offset);
376 *
377 * but this would decrease preformance, so we change the
378 * shift:
379 */
380 tmp = *(p++);
381 tmp |= __swab32(~0UL >> (32-offset));
382 if(size < 32)
383 goto found_first;
384 if(~tmp)
385 goto found_middle;
386 size -= 32;
387 result += 32;
388 }
389 while(size & ~31UL) {
390 if(~(tmp = *(p++)))
391 goto found_middle;
392 result += 32;
393 size -= 32;
394 }
395 if(!size)
396 return result;
397 tmp = *p;
398
399found_first:
400 /* tmp is little endian, so we would have to swab the shift,
401 * see above. But then we have to swab tmp below for ffz, so
402 * we might as well do this here.
403 */
404 return result + ffz(__swab32(tmp) | (~0UL << size));
405found_middle:
406 return result + ffz(__swab32(tmp));
407}
408
409#else 113#else
410# error processor byte order undefined! 114# error processor byte order undefined!
411#endif 115#endif
412 116
413 117#include <asm-generic/bitops/hweight.h>
414#define hweight32(x) generic_hweight32(x) 118#include <asm-generic/bitops/sched.h>
415#define hweight16(x) generic_hweight16(x) 119#include <asm-generic/bitops/minix.h>
416#define hweight8(x) generic_hweight8(x)
417
418/*
419 * Find the first bit set in a 140-bit bitmap.
420 * The first 100 bits are unlikely to be set.
421 */
422
423static inline int sched_find_first_bit(const unsigned long *b)
424{
425 if (unlikely(b[0]))
426 return __ffs(b[0]);
427 if (unlikely(b[1]))
428 return __ffs(b[1]) + 32;
429 if (unlikely(b[2]))
430 return __ffs(b[2]) + 64;
431 if (b[3])
432 return __ffs(b[3]) + 96;
433 return __ffs(b[4]) + 128;
434}
435
436
437/* Bitmap functions for the minix filesystem. */
438
439#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
440#define minix_set_bit(nr,addr) set_bit(nr,addr)
441#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
442#define minix_test_bit(nr,addr) test_bit(nr,addr)
443#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
444 120
445#endif /* __KERNEL__ */ 121#endif /* __KERNEL__ */
446 122
diff --git a/include/asm-xtensa/page.h b/include/asm-xtensa/page.h
index 8ded36f255a2..992bac5c1258 100644
--- a/include/asm-xtensa/page.h
+++ b/include/asm-xtensa/page.h
@@ -109,10 +109,7 @@ void copy_user_page(void *to,void* from,unsigned long vaddr,struct page* page);
109#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 109#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
110#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 110#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
111#define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr) 111#define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr)
112#ifndef CONFIG_DISCONTIGMEM 112#ifdef CONFIG_DISCONTIGMEM
113# define pfn_to_page(pfn) (mem_map + (pfn))
114# define page_to_pfn(page) ((unsigned long)((page) - mem_map))
115#else
116# error CONFIG_DISCONTIGMEM not supported 113# error CONFIG_DISCONTIGMEM not supported
117#endif 114#endif
118 115
@@ -130,4 +127,5 @@ void copy_user_page(void *to,void* from,unsigned long vaddr,struct page* page);
130 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 127 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
131 128
132#endif /* __KERNEL__ */ 129#endif /* __KERNEL__ */
130#include <asm-generic/memory_model.h>
133#endif /* _XTENSA_PAGE_H */ 131#endif /* _XTENSA_PAGE_H */
diff --git a/include/asm-xtensa/poll.h b/include/asm-xtensa/poll.h
index dffe447534e0..6fd94773e866 100644
--- a/include/asm-xtensa/poll.h
+++ b/include/asm-xtensa/poll.h
@@ -27,6 +27,7 @@
27 27
28#define POLLMSG 0x0400 28#define POLLMSG 0x0400
29#define POLLREMOVE 0x0800 29#define POLLREMOVE 0x0800
30#define POLLRDHUP 0x2000
30 31
31struct pollfd { 32struct pollfd {
32 int fd; 33 int fd;
diff --git a/include/linux/adb.h b/include/linux/adb.h
index e9fdc63483c7..b7305b178279 100644
--- a/include/linux/adb.h
+++ b/include/linux/adb.h
@@ -85,7 +85,7 @@ enum adb_message {
85 ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */ 85 ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */
86}; 86};
87extern struct adb_driver *adb_controller; 87extern struct adb_driver *adb_controller;
88extern struct notifier_block *adb_client_list; 88extern struct blocking_notifier_head adb_client_list;
89 89
90int adb_request(struct adb_request *req, void (*done)(struct adb_request *), 90int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
91 int flags, int nbytes, ...); 91 int flags, int nbytes, ...);
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
index 6b8d73dc1ab0..9cf64b1b688b 100644
--- a/include/linux/amba/clcd.h
+++ b/include/linux/amba/clcd.h
@@ -54,6 +54,7 @@
54#define CNTL_LCDBPP4 (2 << 1) 54#define CNTL_LCDBPP4 (2 << 1)
55#define CNTL_LCDBPP8 (3 << 1) 55#define CNTL_LCDBPP8 (3 << 1)
56#define CNTL_LCDBPP16 (4 << 1) 56#define CNTL_LCDBPP16 (4 << 1)
57#define CNTL_LCDBPP16_565 (6 << 1)
57#define CNTL_LCDBPP24 (5 << 1) 58#define CNTL_LCDBPP24 (5 << 1)
58#define CNTL_LCDBW (1 << 4) 59#define CNTL_LCDBW (1 << 4)
59#define CNTL_LCDTFT (1 << 5) 60#define CNTL_LCDTFT (1 << 5)
@@ -209,7 +210,16 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
209 val |= CNTL_LCDBPP8; 210 val |= CNTL_LCDBPP8;
210 break; 211 break;
211 case 16: 212 case 16:
212 val |= CNTL_LCDBPP16; 213 /*
214 * PL110 cannot choose between 5551 and 565 modes in
215 * its control register
216 */
217 if ((fb->dev->periphid & 0x000fffff) == 0x00041110)
218 val |= CNTL_LCDBPP16;
219 else if (fb->fb.var.green.length == 5)
220 val |= CNTL_LCDBPP16;
221 else
222 val |= CNTL_LCDBPP16_565;
213 break; 223 break;
214 case 32: 224 case 32:
215 val |= CNTL_LCDBPP24; 225 val |= CNTL_LCDBPP24;
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index dc726ffccebd..48ee32a18ac5 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -158,4 +158,10 @@
158#define UART01x_RSR_ANY (UART01x_RSR_OE|UART01x_RSR_BE|UART01x_RSR_PE|UART01x_RSR_FE) 158#define UART01x_RSR_ANY (UART01x_RSR_OE|UART01x_RSR_BE|UART01x_RSR_PE|UART01x_RSR_FE)
159#define UART01x_FR_MODEM_ANY (UART01x_FR_DCD|UART01x_FR_DSR|UART01x_FR_CTS) 159#define UART01x_FR_MODEM_ANY (UART01x_FR_DCD|UART01x_FR_DSR|UART01x_FR_CTS)
160 160
161#ifndef __ASSEMBLY__
162struct amba_pl010_data {
163 void (*set_mctrl)(struct amba_device *dev, void __iomem *base, unsigned int mctrl);
164};
165#endif
166
161#endif 167#endif
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index 7198f129e135..231ba090ae34 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -206,7 +206,6 @@ struct ArcProto {
206 206
207extern struct ArcProto *arc_proto_map[256], *arc_proto_default, 207extern struct ArcProto *arc_proto_map[256], *arc_proto_default,
208 *arc_bcast_proto, *arc_raw_proto; 208 *arc_bcast_proto, *arc_raw_proto;
209extern struct ArcProto arc_proto_null;
210 209
211 210
212/* 211/*
@@ -334,17 +333,9 @@ void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
334#define arcnet_dump_skb(dev,skb,desc) ; 333#define arcnet_dump_skb(dev,skb,desc) ;
335#endif 334#endif
336 335
337#if (ARCNET_DEBUG_MAX & D_RX) || (ARCNET_DEBUG_MAX & D_TX)
338void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc,
339 int take_arcnet_lock);
340#else
341#define arcnet_dump_packet(dev, bufnum, desc,take_arcnet_lock) ;
342#endif
343
344void arcnet_unregister_proto(struct ArcProto *proto); 336void arcnet_unregister_proto(struct ArcProto *proto);
345irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs); 337irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs);
346struct net_device *alloc_arcdev(char *name); 338struct net_device *alloc_arcdev(char *name);
347void arcnet_rx(struct net_device *dev, int bufnum);
348 339
349#endif /* __KERNEL__ */ 340#endif /* __KERNEL__ */
350#endif /* _LINUX_ARCDEVICE_H */ 341#endif /* _LINUX_ARCDEVICE_H */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 94f77cce27fa..312a2c0c64e6 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -146,6 +146,8 @@ enum {
146 ATA_CMD_STANDBYNOW1 = 0xE0, 146 ATA_CMD_STANDBYNOW1 = 0xE0,
147 ATA_CMD_IDLEIMMEDIATE = 0xE1, 147 ATA_CMD_IDLEIMMEDIATE = 0xE1,
148 ATA_CMD_INIT_DEV_PARAMS = 0x91, 148 ATA_CMD_INIT_DEV_PARAMS = 0x91,
149 ATA_CMD_READ_NATIVE_MAX = 0xF8,
150 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
149 151
150 /* SETFEATURES stuff */ 152 /* SETFEATURES stuff */
151 SETFEATURES_XFER = 0x03, 153 SETFEATURES_XFER = 0x03,
@@ -204,7 +206,6 @@ enum ata_tf_protocols {
204 ATA_PROT_UNKNOWN, /* unknown/invalid */ 206 ATA_PROT_UNKNOWN, /* unknown/invalid */
205 ATA_PROT_NODATA, /* no data */ 207 ATA_PROT_NODATA, /* no data */
206 ATA_PROT_PIO, /* PIO single sector */ 208 ATA_PROT_PIO, /* PIO single sector */
207 ATA_PROT_PIO_MULT, /* PIO multiple sector */
208 ATA_PROT_DMA, /* DMA */ 209 ATA_PROT_DMA, /* DMA */
209 ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ 210 ATA_PROT_ATAPI, /* packet command, PIO data xfer*/
210 ATA_PROT_ATAPI_NODATA, /* packet command, no data */ 211 ATA_PROT_ATAPI_NODATA, /* packet command, no data */
@@ -247,18 +248,22 @@ struct ata_taskfile {
247}; 248};
248 249
249#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 250#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
251#define ata_id_is_cfa(id) ((id)[0] == 0x848A)
250#define ata_id_is_sata(id) ((id)[93] == 0) 252#define ata_id_is_sata(id) ((id)[93] == 0)
251#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) 253#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
252#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) 254#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
255#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10))
253#define ata_id_has_fua(id) ((id)[84] & (1 << 6)) 256#define ata_id_has_fua(id) ((id)[84] & (1 << 6))
254#define ata_id_has_flush(id) ((id)[83] & (1 << 12)) 257#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
255#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13)) 258#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
256#define ata_id_has_lba48(id) ((id)[83] & (1 << 10)) 259#define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
260#define ata_id_has_hpa(id) ((id)[82] & (1 << 10))
257#define ata_id_has_wcache(id) ((id)[82] & (1 << 5)) 261#define ata_id_has_wcache(id) ((id)[82] & (1 << 5))
258#define ata_id_has_pm(id) ((id)[82] & (1 << 3)) 262#define ata_id_has_pm(id) ((id)[82] & (1 << 3))
259#define ata_id_has_lba(id) ((id)[49] & (1 << 9)) 263#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
260#define ata_id_has_dma(id) ((id)[49] & (1 << 8)) 264#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
261#define ata_id_removeable(id) ((id)[0] & (1 << 7)) 265#define ata_id_removeable(id) ((id)[0] & (1 << 7))
266#define ata_id_has_dword_io(id) ((id)[50] & (1 << 0))
262#define ata_id_u32(id,n) \ 267#define ata_id_u32(id,n) \
263 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) 268 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
264#define ata_id_u64(id,n) \ 269#define ata_id_u64(id,n) \
@@ -267,6 +272,16 @@ struct ata_taskfile {
267 ((u64) (id)[(n) + 1] << 16) | \ 272 ((u64) (id)[(n) + 1] << 16) | \
268 ((u64) (id)[(n) + 0]) ) 273 ((u64) (id)[(n) + 0]) )
269 274
275static inline unsigned int ata_id_major_version(const u16 *id)
276{
277 unsigned int mver;
278
279 for (mver = 14; mver >= 1; mver--)
280 if (id[ATA_ID_MAJOR_VER] & (1 << mver))
281 break;
282 return mver;
283}
284
270static inline int ata_id_current_chs_valid(const u16 *id) 285static inline int ata_id_current_chs_valid(const u16 *id)
271{ 286{
272 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 287 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -302,4 +317,16 @@ static inline int ata_ok(u8 status)
302 == ATA_DRDY); 317 == ATA_DRDY);
303} 318}
304 319
320static inline int lba_28_ok(u64 block, u32 n_block)
321{
322 /* check the ending block number */
323 return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256);
324}
325
326static inline int lba_48_ok(u64 block, u32 n_block)
327{
328 /* check the ending block number */
329 return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536);
330}
331
305#endif /* __LINUX_ATA_H__ */ 332#endif /* __LINUX_ATA_H__ */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index da3c01955f3d..1c47c59058c1 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -33,27 +33,42 @@
33 * 1200 - 1299 messages internal to the audit daemon 33 * 1200 - 1299 messages internal to the audit daemon
34 * 1300 - 1399 audit event messages 34 * 1300 - 1399 audit event messages
35 * 1400 - 1499 SE Linux use 35 * 1400 - 1499 SE Linux use
36 * 1500 - 1999 future use 36 * 1500 - 1599 kernel LSPP events
37 * 2000 is for otherwise unclassified kernel audit messages 37 * 1600 - 1699 kernel crypto events
38 * 1700 - 1799 kernel anomaly records
39 * 1800 - 1999 future kernel use (maybe integrity labels and related events)
40 * 2000 is for otherwise unclassified kernel audit messages (legacy)
41 * 2001 - 2099 unused (kernel)
42 * 2100 - 2199 user space anomaly records
43 * 2200 - 2299 user space actions taken in response to anomalies
44 * 2300 - 2399 user space generated LSPP events
45 * 2400 - 2499 user space crypto events
46 * 2500 - 2999 future user space (maybe integrity labels and related events)
38 * 47 *
39 * Messages from 1000-1199 are bi-directional. 1200-1299 are exclusively user 48 * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are
40 * space. Anything over that is kernel --> user space communication. 49 * exclusively user space. 1300-2099 is kernel --> user space
50 * communication.
41 */ 51 */
42#define AUDIT_GET 1000 /* Get status */ 52#define AUDIT_GET 1000 /* Get status */
43#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */ 53#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */
44#define AUDIT_LIST 1002 /* List syscall filtering rules */ 54#define AUDIT_LIST 1002 /* List syscall rules -- deprecated */
45#define AUDIT_ADD 1003 /* Add syscall filtering rule */ 55#define AUDIT_ADD 1003 /* Add syscall rule -- deprecated */
46#define AUDIT_DEL 1004 /* Delete syscall filtering rule */ 56#define AUDIT_DEL 1004 /* Delete syscall rule -- deprecated */
47#define AUDIT_USER 1005 /* Message from userspace -- deprecated */ 57#define AUDIT_USER 1005 /* Message from userspace -- deprecated */
48#define AUDIT_LOGIN 1006 /* Define the login id and information */ 58#define AUDIT_LOGIN 1006 /* Define the login id and information */
49#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */ 59#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */
50#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */ 60#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */
51#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */ 61#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */
52#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */ 62#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */
63#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */
64#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */
65#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */
53 66
54#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ 67#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
55#define AUDIT_USER_AVC 1107 /* We filter this differently */ 68#define AUDIT_USER_AVC 1107 /* We filter this differently */
56#define AUDIT_LAST_USER_MSG 1199 69#define AUDIT_LAST_USER_MSG 1199
70#define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */
71#define AUDIT_LAST_USER_MSG2 2999
57 72
58#define AUDIT_DAEMON_START 1200 /* Daemon startup record */ 73#define AUDIT_DAEMON_START 1200 /* Daemon startup record */
59#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */ 74#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */
@@ -72,6 +87,13 @@
72#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 87#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
73#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 88#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
74#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */ 89#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */
90#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */
91#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */
92#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */
93
94#define AUDIT_FIRST_KERN_ANOM_MSG 1700
95#define AUDIT_LAST_KERN_ANOM_MSG 1799
96#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */
75 97
76#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ 98#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */
77 99
@@ -81,8 +103,9 @@
81#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */ 103#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */
82#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */ 104#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */
83#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */ 105#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */
106#define AUDIT_FILTER_TYPE 0x05 /* Apply rule at audit_log_start */
84 107
85#define AUDIT_NR_FILTERS 5 108#define AUDIT_NR_FILTERS 6
86 109
87#define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */ 110#define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */
88 111
@@ -98,6 +121,13 @@
98#define AUDIT_WORD(nr) ((__u32)((nr)/32)) 121#define AUDIT_WORD(nr) ((__u32)((nr)/32))
99#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32)) 122#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
100 123
124/* This bitmask is used to validate user input. It represents all bits that
125 * are currently used in an audit field constant understood by the kernel.
126 * If you are adding a new #define AUDIT_<whatever>, please ensure that
127 * AUDIT_UNUSED_BITS is updated if need be. */
128#define AUDIT_UNUSED_BITS 0x0FFFFC00
129
130
101/* Rule fields */ 131/* Rule fields */
102 /* These are useful when checking the 132 /* These are useful when checking the
103 * task structure at task creation time 133 * task structure at task creation time
@@ -114,6 +144,7 @@
114#define AUDIT_LOGINUID 9 144#define AUDIT_LOGINUID 9
115#define AUDIT_PERS 10 145#define AUDIT_PERS 10
116#define AUDIT_ARCH 11 146#define AUDIT_ARCH 11
147#define AUDIT_MSGTYPE 12
117 148
118 /* These are ONLY useful when checking 149 /* These are ONLY useful when checking
119 * at syscall exit time (AUDIT_AT_EXIT). */ 150 * at syscall exit time (AUDIT_AT_EXIT). */
@@ -128,8 +159,28 @@
128#define AUDIT_ARG2 (AUDIT_ARG0+2) 159#define AUDIT_ARG2 (AUDIT_ARG0+2)
129#define AUDIT_ARG3 (AUDIT_ARG0+3) 160#define AUDIT_ARG3 (AUDIT_ARG0+3)
130 161
131#define AUDIT_NEGATE 0x80000000 162#define AUDIT_NEGATE 0x80000000
132 163
164/* These are the supported operators.
165 * 4 2 1
166 * = > <
167 * -------
168 * 0 0 0 0 nonsense
169 * 0 0 1 1 <
170 * 0 1 0 2 >
171 * 0 1 1 3 !=
172 * 1 0 0 4 =
173 * 1 0 1 5 <=
174 * 1 1 0 6 >=
175 * 1 1 1 7 all operators
176 */
177#define AUDIT_LESS_THAN 0x10000000
178#define AUDIT_GREATER_THAN 0x20000000
179#define AUDIT_NOT_EQUAL 0x30000000
180#define AUDIT_EQUAL 0x40000000
181#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL)
182#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
183#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL)
133 184
134/* Status symbols */ 185/* Status symbols */
135 /* Mask values */ 186 /* Mask values */
@@ -186,6 +237,26 @@ struct audit_status {
186 __u32 backlog; /* messages waiting in queue */ 237 __u32 backlog; /* messages waiting in queue */
187}; 238};
188 239
240/* audit_rule_data supports filter rules with both integer and string
241 * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
242 * AUDIT_LIST_RULES requests.
243 */
244struct audit_rule_data {
245 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
246 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
247 __u32 field_count;
248 __u32 mask[AUDIT_BITMASK_SIZE]; /* syscall(s) affected */
249 __u32 fields[AUDIT_MAX_FIELDS];
250 __u32 values[AUDIT_MAX_FIELDS];
251 __u32 fieldflags[AUDIT_MAX_FIELDS];
252 __u32 buflen; /* total length of string fields */
253 char buf[0]; /* string fields buffer */
254};
255
256/* audit_rule is supported to maintain backward compatibility with
257 * userspace. It supports integer fields only and corresponds to
258 * AUDIT_ADD, AUDIT_DEL and AUDIT_LIST requests.
259 */
189struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */ 260struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
190 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */ 261 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
191 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */ 262 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
@@ -222,22 +293,33 @@ extern void audit_syscall_entry(struct task_struct *task, int arch,
222extern void audit_syscall_exit(struct task_struct *task, int failed, long return_code); 293extern void audit_syscall_exit(struct task_struct *task, int failed, long return_code);
223extern void audit_getname(const char *name); 294extern void audit_getname(const char *name);
224extern void audit_putname(const char *name); 295extern void audit_putname(const char *name);
225extern void audit_inode(const char *name, const struct inode *inode, unsigned flags); 296extern void __audit_inode(const char *name, const struct inode *inode, unsigned flags);
297extern void __audit_inode_child(const char *dname, const struct inode *inode,
298 unsigned long pino);
299static inline void audit_inode(const char *name, const struct inode *inode,
300 unsigned flags) {
301 if (unlikely(current->audit_context))
302 __audit_inode(name, inode, flags);
303}
304static inline void audit_inode_child(const char *dname,
305 const struct inode *inode,
306 unsigned long pino) {
307 if (unlikely(current->audit_context))
308 __audit_inode_child(dname, inode, pino);
309}
226 310
227 /* Private API (for audit.c only) */ 311 /* Private API (for audit.c only) */
228extern int audit_receive_filter(int type, int pid, int uid, int seq,
229 void *data, uid_t loginuid);
230extern unsigned int audit_serial(void); 312extern unsigned int audit_serial(void);
231extern void auditsc_get_stamp(struct audit_context *ctx, 313extern void auditsc_get_stamp(struct audit_context *ctx,
232 struct timespec *t, unsigned int *serial); 314 struct timespec *t, unsigned int *serial);
233extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); 315extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
234extern uid_t audit_get_loginuid(struct audit_context *ctx); 316extern uid_t audit_get_loginuid(struct audit_context *ctx);
235extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 317extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode, struct kern_ipc_perm *ipcp);
236extern int audit_socketcall(int nargs, unsigned long *args); 318extern int audit_socketcall(int nargs, unsigned long *args);
237extern int audit_sockaddr(int len, void *addr); 319extern int audit_sockaddr(int len, void *addr);
238extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt); 320extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt);
239extern void audit_signal_info(int sig, struct task_struct *t); 321extern void audit_signal_info(int sig, struct task_struct *t);
240extern int audit_filter_user(struct netlink_skb_parms *cb, int type); 322extern int audit_set_macxattr(const char *name);
241#else 323#else
242#define audit_alloc(t) ({ 0; }) 324#define audit_alloc(t) ({ 0; })
243#define audit_free(t) do { ; } while (0) 325#define audit_free(t) do { ; } while (0)
@@ -245,16 +327,18 @@ extern int audit_filter_user(struct netlink_skb_parms *cb, int type);
245#define audit_syscall_exit(t,f,r) do { ; } while (0) 327#define audit_syscall_exit(t,f,r) do { ; } while (0)
246#define audit_getname(n) do { ; } while (0) 328#define audit_getname(n) do { ; } while (0)
247#define audit_putname(n) do { ; } while (0) 329#define audit_putname(n) do { ; } while (0)
330#define __audit_inode(n,i,f) do { ; } while (0)
331#define __audit_inode_child(d,i,p) do { ; } while (0)
248#define audit_inode(n,i,f) do { ; } while (0) 332#define audit_inode(n,i,f) do { ; } while (0)
249#define audit_receive_filter(t,p,u,s,d,l) ({ -EOPNOTSUPP; }) 333#define audit_inode_child(d,i,p) do { ; } while (0)
250#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) 334#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
251#define audit_get_loginuid(c) ({ -1; }) 335#define audit_get_loginuid(c) ({ -1; })
252#define audit_ipc_perms(q,u,g,m) ({ 0; }) 336#define audit_ipc_perms(q,u,g,m,i) ({ 0; })
253#define audit_socketcall(n,a) ({ 0; }) 337#define audit_socketcall(n,a) ({ 0; })
254#define audit_sockaddr(len, addr) ({ 0; }) 338#define audit_sockaddr(len, addr) ({ 0; })
255#define audit_avc_path(dentry, mnt) ({ 0; }) 339#define audit_avc_path(dentry, mnt) ({ 0; })
256#define audit_signal_info(s,t) do { ; } while (0) 340#define audit_signal_info(s,t) do { ; } while (0)
257#define audit_filter_user(cb,t) ({ 1; }) 341#define audit_set_macxattr(n) do { ; } while (0)
258#endif 342#endif
259 343
260#ifdef CONFIG_AUDIT 344#ifdef CONFIG_AUDIT
@@ -278,12 +362,11 @@ extern void audit_log_d_path(struct audit_buffer *ab,
278 const char *prefix, 362 const char *prefix,
279 struct dentry *dentry, 363 struct dentry *dentry,
280 struct vfsmount *vfsmnt); 364 struct vfsmount *vfsmnt);
281 /* Private API (for auditsc.c only) */ 365 /* Private API (for audit.c only) */
282extern void audit_send_reply(int pid, int seq, int type, 366extern int audit_filter_user(struct netlink_skb_parms *cb, int type);
283 int done, int multi, 367extern int audit_filter_type(int type);
284 void *payload, int size); 368extern int audit_receive_filter(int type, int pid, int uid, int seq,
285extern void audit_log_lost(const char *message); 369 void *data, size_t datasz, uid_t loginuid);
286extern struct semaphore audit_netlink_sem;
287#else 370#else
288#define audit_log(c,g,t,f,...) do { ; } while (0) 371#define audit_log(c,g,t,f,...) do { ; } while (0)
289#define audit_log_start(c,g,t) ({ NULL; }) 372#define audit_log_start(c,g,t) ({ NULL; })
@@ -293,6 +376,7 @@ extern struct semaphore audit_netlink_sem;
293#define audit_log_hex(a,b,l) do { ; } while (0) 376#define audit_log_hex(a,b,l) do { ; } while (0)
294#define audit_log_untrustedstring(a,s) do { ; } while (0) 377#define audit_log_untrustedstring(a,s) do { ; } while (0)
295#define audit_log_d_path(b,p,d,v) do { ; } while (0) 378#define audit_log_d_path(b,p,d,v) do { ; } while (0)
379#define audit_panic(m) do { ; } while (0)
296#endif 380#endif
297#endif 381#endif
298#endif 382#endif
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index 9343c89d843c..0a6bc52ffe88 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -19,18 +19,37 @@
19#undef AUTOFS_MIN_PROTO_VERSION 19#undef AUTOFS_MIN_PROTO_VERSION
20#undef AUTOFS_MAX_PROTO_VERSION 20#undef AUTOFS_MAX_PROTO_VERSION
21 21
22#define AUTOFS_PROTO_VERSION 4 22#define AUTOFS_PROTO_VERSION 5
23#define AUTOFS_MIN_PROTO_VERSION 3 23#define AUTOFS_MIN_PROTO_VERSION 3
24#define AUTOFS_MAX_PROTO_VERSION 4 24#define AUTOFS_MAX_PROTO_VERSION 5
25 25
26#define AUTOFS_PROTO_SUBVERSION 7 26#define AUTOFS_PROTO_SUBVERSION 0
27 27
28/* Mask for expire behaviour */ 28/* Mask for expire behaviour */
29#define AUTOFS_EXP_IMMEDIATE 1 29#define AUTOFS_EXP_IMMEDIATE 1
30#define AUTOFS_EXP_LEAVES 2 30#define AUTOFS_EXP_LEAVES 2
31 31
32/* New message type */ 32/* Daemon notification packet types */
33#define autofs_ptype_expire_multi 2 /* Expire entry (umount request) */ 33enum autofs_notify {
34 NFY_NONE,
35 NFY_MOUNT,
36 NFY_EXPIRE
37};
38
39/* Kernel protocol version 4 packet types */
40
41/* Expire entry (umount request) */
42#define autofs_ptype_expire_multi 2
43
44/* Kernel protocol version 5 packet types */
45
46/* Indirect mount missing and expire requests. */
47#define autofs_ptype_missing_indirect 3
48#define autofs_ptype_expire_indirect 4
49
50/* Direct mount missing and expire requests */
51#define autofs_ptype_missing_direct 5
52#define autofs_ptype_expire_direct 6
34 53
35/* v4 multi expire (via pipe) */ 54/* v4 multi expire (via pipe) */
36struct autofs_packet_expire_multi { 55struct autofs_packet_expire_multi {
@@ -40,14 +59,36 @@ struct autofs_packet_expire_multi {
40 char name[NAME_MAX+1]; 59 char name[NAME_MAX+1];
41}; 60};
42 61
62/* autofs v5 common packet struct */
63struct autofs_v5_packet {
64 struct autofs_packet_hdr hdr;
65 autofs_wqt_t wait_queue_token;
66 __u32 dev;
67 __u64 ino;
68 __u32 uid;
69 __u32 gid;
70 __u32 pid;
71 __u32 tgid;
72 __u32 len;
73 char name[NAME_MAX+1];
74};
75
76typedef struct autofs_v5_packet autofs_packet_missing_indirect_t;
77typedef struct autofs_v5_packet autofs_packet_expire_indirect_t;
78typedef struct autofs_v5_packet autofs_packet_missing_direct_t;
79typedef struct autofs_v5_packet autofs_packet_expire_direct_t;
80
43union autofs_packet_union { 81union autofs_packet_union {
44 struct autofs_packet_hdr hdr; 82 struct autofs_packet_hdr hdr;
45 struct autofs_packet_missing missing; 83 struct autofs_packet_missing missing;
46 struct autofs_packet_expire expire; 84 struct autofs_packet_expire expire;
47 struct autofs_packet_expire_multi expire_multi; 85 struct autofs_packet_expire_multi expire_multi;
86 struct autofs_v5_packet v5_packet;
48}; 87};
49 88
50#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int) 89#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int)
90#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI
91#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI
51#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int) 92#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int)
52#define AUTOFS_IOC_ASKREGHOST _IOR(0x93,0x68,int) 93#define AUTOFS_IOC_ASKREGHOST _IOR(0x93,0x68,int)
53#define AUTOFS_IOC_TOGGLEREGHOST _IOR(0x93,0x69,int) 94#define AUTOFS_IOC_TOGGLEREGHOST _IOR(0x93,0x69,int)
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index bb9e54322322..75e91f5b6a04 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -19,20 +19,25 @@ struct fb_info;
19struct backlight_properties { 19struct backlight_properties {
20 /* Owner module */ 20 /* Owner module */
21 struct module *owner; 21 struct module *owner;
22 /* Get the backlight power status (0: full on, 1..3: power saving 22
23 modes; 4: full off), see FB_BLANK_XXX */ 23 /* Notify the backlight driver some property has changed */
24 int (*get_power)(struct backlight_device *); 24 int (*update_status)(struct backlight_device *);
25 /* Enable or disable power to the LCD (0: on; 4: off, see FB_BLANK_XXX) */ 25 /* Return the current backlight brightness (accounting for power,
26 int (*set_power)(struct backlight_device *, int power); 26 fb_blank etc.) */
27 /* Maximal value for brightness (read-only) */
28 int max_brightness;
29 /* Get current backlight brightness */
30 int (*get_brightness)(struct backlight_device *); 27 int (*get_brightness)(struct backlight_device *);
31 /* Set backlight brightness (0..max_brightness) */
32 int (*set_brightness)(struct backlight_device *, int brightness);
33 /* Check if given framebuffer device is the one bound to this backlight; 28 /* Check if given framebuffer device is the one bound to this backlight;
34 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ 29 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
35 int (*check_fb)(struct fb_info *); 30 int (*check_fb)(struct fb_info *);
31
32 /* Current User requested brightness (0 - max_brightness) */
33 int brightness;
34 /* Maximal value for brightness (read-only) */
35 int max_brightness;
36 /* Current FB Power mode (0: full on, 1..3: power saving
37 modes; 4: full off), see FB_BLANK_XXX */
38 int power;
39 /* FB Blanking active? (values as for power) */
40 int fb_blank;
36}; 41};
37 42
38struct backlight_device { 43struct backlight_device {
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 7d8ff97b3e92..d9ed27969855 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -46,6 +46,9 @@
46 * bitmap_parse(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf 46 * bitmap_parse(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
47 * bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf 47 * bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf
48 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from list 48 * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from list
49 * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
50 * bitmap_release_region(bitmap, pos, order) Free specified bit region
51 * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region
49 */ 52 */
50 53
51/* 54/*
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 208650b1ad3a..5d1eabcde5d5 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -3,88 +3,11 @@
3#include <asm/types.h> 3#include <asm/types.h>
4 4
5/* 5/*
6 * ffs: find first bit set. This is defined the same way as
7 * the libc and compiler builtin ffs routines, therefore
8 * differs in spirit from the above ffz (man ffs).
9 */
10
11static inline int generic_ffs(int x)
12{
13 int r = 1;
14
15 if (!x)
16 return 0;
17 if (!(x & 0xffff)) {
18 x >>= 16;
19 r += 16;
20 }
21 if (!(x & 0xff)) {
22 x >>= 8;
23 r += 8;
24 }
25 if (!(x & 0xf)) {
26 x >>= 4;
27 r += 4;
28 }
29 if (!(x & 3)) {
30 x >>= 2;
31 r += 2;
32 }
33 if (!(x & 1)) {
34 x >>= 1;
35 r += 1;
36 }
37 return r;
38}
39
40/*
41 * fls: find last bit set.
42 */
43
44static __inline__ int generic_fls(int x)
45{
46 int r = 32;
47
48 if (!x)
49 return 0;
50 if (!(x & 0xffff0000u)) {
51 x <<= 16;
52 r -= 16;
53 }
54 if (!(x & 0xff000000u)) {
55 x <<= 8;
56 r -= 8;
57 }
58 if (!(x & 0xf0000000u)) {
59 x <<= 4;
60 r -= 4;
61 }
62 if (!(x & 0xc0000000u)) {
63 x <<= 2;
64 r -= 2;
65 }
66 if (!(x & 0x80000000u)) {
67 x <<= 1;
68 r -= 1;
69 }
70 return r;
71}
72
73/*
74 * Include this here because some architectures need generic_ffs/fls in 6 * Include this here because some architectures need generic_ffs/fls in
75 * scope 7 * scope
76 */ 8 */
77#include <asm/bitops.h> 9#include <asm/bitops.h>
78 10
79
80static inline int generic_fls64(__u64 x)
81{
82 __u32 h = x >> 32;
83 if (h)
84 return fls(h) + 32;
85 return fls(x);
86}
87
88static __inline__ int get_bitmask_order(unsigned int count) 11static __inline__ int get_bitmask_order(unsigned int count)
89{ 12{
90 int order; 13 int order;
@@ -103,54 +26,9 @@ static __inline__ int get_count_order(unsigned int count)
103 return order; 26 return order;
104} 27}
105 28
106/*
107 * hweightN: returns the hamming weight (i.e. the number
108 * of bits set) of a N-bit word
109 */
110
111static inline unsigned int generic_hweight32(unsigned int w)
112{
113 unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
114 res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
115 res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
116 res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
117 return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
118}
119
120static inline unsigned int generic_hweight16(unsigned int w)
121{
122 unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
123 res = (res & 0x3333) + ((res >> 2) & 0x3333);
124 res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F);
125 return (res & 0x00FF) + ((res >> 8) & 0x00FF);
126}
127
128static inline unsigned int generic_hweight8(unsigned int w)
129{
130 unsigned int res = (w & 0x55) + ((w >> 1) & 0x55);
131 res = (res & 0x33) + ((res >> 2) & 0x33);
132 return (res & 0x0F) + ((res >> 4) & 0x0F);
133}
134
135static inline unsigned long generic_hweight64(__u64 w)
136{
137#if BITS_PER_LONG < 64
138 return generic_hweight32((unsigned int)(w >> 32)) +
139 generic_hweight32((unsigned int)w);
140#else
141 u64 res;
142 res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
143 res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
144 res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
145 res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
146 res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
147 return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
148#endif
149}
150
151static inline unsigned long hweight_long(unsigned long w) 29static inline unsigned long hweight_long(unsigned long w)
152{ 30{
153 return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w); 31 return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
154} 32}
155 33
156/* 34/*
@@ -175,4 +53,11 @@ static inline __u32 ror32(__u32 word, unsigned int shift)
175 return (word >> shift) | (word << (32 - shift)); 53 return (word >> shift) | (word << (32 - shift));
176} 54}
177 55
56static inline unsigned fls_long(unsigned long l)
57{
58 if (sizeof(l) == 4)
59 return fls(l);
60 return fls64(l);
61}
62
178#endif 63#endif
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 860e7a485a5f..d0cac8b58de7 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -22,6 +22,7 @@ typedef struct request_queue request_queue_t;
22struct elevator_queue; 22struct elevator_queue;
23typedef struct elevator_queue elevator_t; 23typedef struct elevator_queue elevator_t;
24struct request_pm_state; 24struct request_pm_state;
25struct blk_trace;
25 26
26#define BLKDEV_MIN_RQ 4 27#define BLKDEV_MIN_RQ 4
27#define BLKDEV_MAX_RQ 128 /* Default maximum */ 28#define BLKDEV_MAX_RQ 128 /* Default maximum */
@@ -54,23 +55,29 @@ struct as_io_context {
54 55
55struct cfq_queue; 56struct cfq_queue;
56struct cfq_io_context { 57struct cfq_io_context {
57 /* 58 struct rb_node rb_node;
58 * circular list of cfq_io_contexts belonging to a process io context
59 */
60 struct list_head list;
61 struct cfq_queue *cfqq;
62 void *key; 59 void *key;
63 60
61 struct cfq_queue *cfqq[2];
62
64 struct io_context *ioc; 63 struct io_context *ioc;
65 64
66 unsigned long last_end_request; 65 unsigned long last_end_request;
67 unsigned long last_queue; 66 sector_t last_request_pos;
67 unsigned long last_queue;
68
68 unsigned long ttime_total; 69 unsigned long ttime_total;
69 unsigned long ttime_samples; 70 unsigned long ttime_samples;
70 unsigned long ttime_mean; 71 unsigned long ttime_mean;
71 72
72 void (*dtor)(struct cfq_io_context *); 73 unsigned int seek_samples;
73 void (*exit)(struct cfq_io_context *); 74 u64 seek_total;
75 sector_t seek_mean;
76
77 struct list_head queue_list;
78
79 void (*dtor)(struct io_context *); /* destructor */
80 void (*exit)(struct io_context *); /* called on task exit */
74}; 81};
75 82
76/* 83/*
@@ -91,7 +98,7 @@ struct io_context {
91 int nr_batch_requests; /* Number of requests left in the batch */ 98 int nr_batch_requests; /* Number of requests left in the batch */
92 99
93 struct as_io_context *aic; 100 struct as_io_context *aic;
94 struct cfq_io_context *cic; 101 struct rb_root cic_root;
95}; 102};
96 103
97void put_io_context(struct io_context *ioc); 104void put_io_context(struct io_context *ioc);
@@ -404,8 +411,6 @@ struct request_queue
404 411
405 struct blk_queue_tag *queue_tags; 412 struct blk_queue_tag *queue_tags;
406 413
407 atomic_t refcnt;
408
409 unsigned int nr_sorted; 414 unsigned int nr_sorted;
410 unsigned int in_flight; 415 unsigned int in_flight;
411 416
@@ -416,6 +421,8 @@ struct request_queue
416 unsigned int sg_reserved_size; 421 unsigned int sg_reserved_size;
417 int node; 422 int node;
418 423
424 struct blk_trace *blk_trace;
425
419 /* 426 /*
420 * reserved for flush operations 427 * reserved for flush operations
421 */ 428 */
@@ -424,6 +431,8 @@ struct request_queue
424 struct request pre_flush_rq, bar_rq, post_flush_rq; 431 struct request pre_flush_rq, bar_rq, post_flush_rq;
425 struct request *orig_bar_rq; 432 struct request *orig_bar_rq;
426 unsigned int bi_size; 433 unsigned int bi_size;
434
435 struct mutex sysfs_lock;
427}; 436};
428 437
429#define RQ_INACTIVE (-1) 438#define RQ_INACTIVE (-1)
@@ -725,7 +734,7 @@ extern long nr_blockdev_pages(void);
725int blk_get_queue(request_queue_t *); 734int blk_get_queue(request_queue_t *);
726request_queue_t *blk_alloc_queue(gfp_t); 735request_queue_t *blk_alloc_queue(gfp_t);
727request_queue_t *blk_alloc_queue_node(gfp_t, int); 736request_queue_t *blk_alloc_queue_node(gfp_t, int);
728#define blk_put_queue(q) blk_cleanup_queue((q)) 737extern void blk_put_queue(request_queue_t *);
729 738
730/* 739/*
731 * tag stuff 740 * tag stuff
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
new file mode 100644
index 000000000000..b34d3e73d5ea
--- /dev/null
+++ b/include/linux/blktrace_api.h
@@ -0,0 +1,277 @@
1#ifndef BLKTRACE_H
2#define BLKTRACE_H
3
4#include <linux/config.h>
5#include <linux/blkdev.h>
6#include <linux/relay.h>
7
8/*
9 * Trace categories
10 */
11enum blktrace_cat {
12 BLK_TC_READ = 1 << 0, /* reads */
13 BLK_TC_WRITE = 1 << 1, /* writes */
14 BLK_TC_BARRIER = 1 << 2, /* barrier */
15 BLK_TC_SYNC = 1 << 3, /* barrier */
16 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */
17 BLK_TC_REQUEUE = 1 << 5, /* requeueing */
18 BLK_TC_ISSUE = 1 << 6, /* issue */
19 BLK_TC_COMPLETE = 1 << 7, /* completions */
20 BLK_TC_FS = 1 << 8, /* fs requests */
21 BLK_TC_PC = 1 << 9, /* pc requests */
22 BLK_TC_NOTIFY = 1 << 10, /* special message */
23
24 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */
25};
26
27#define BLK_TC_SHIFT (16)
28#define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT)
29
30/*
31 * Basic trace actions
32 */
33enum blktrace_act {
34 __BLK_TA_QUEUE = 1, /* queued */
35 __BLK_TA_BACKMERGE, /* back merged to existing rq */
36 __BLK_TA_FRONTMERGE, /* front merge to existing rq */
37 __BLK_TA_GETRQ, /* allocated new request */
38 __BLK_TA_SLEEPRQ, /* sleeping on rq allocation */
39 __BLK_TA_REQUEUE, /* request requeued */
40 __BLK_TA_ISSUE, /* sent to driver */
41 __BLK_TA_COMPLETE, /* completed by driver */
42 __BLK_TA_PLUG, /* queue was plugged */
43 __BLK_TA_UNPLUG_IO, /* queue was unplugged by io */
44 __BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */
45 __BLK_TA_INSERT, /* insert request */
46 __BLK_TA_SPLIT, /* bio was split */
47 __BLK_TA_BOUNCE, /* bio was bounced */
48 __BLK_TA_REMAP, /* bio was remapped */
49};
50
51/*
52 * Trace actions in full. Additionally, read or write is masked
53 */
54#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE))
55#define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
56#define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
57#define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE))
58#define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE))
59#define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE))
60#define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE))
61#define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE))
62#define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE))
63#define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE))
64#define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE))
65#define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE))
66#define BLK_TA_SPLIT (__BLK_TA_SPLIT)
67#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
68#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
69
70#define BLK_IO_TRACE_MAGIC 0x65617400
71#define BLK_IO_TRACE_VERSION 0x07
72
73/*
74 * The trace itself
75 */
76struct blk_io_trace {
77 u32 magic; /* MAGIC << 8 | version */
78 u32 sequence; /* event number */
79 u64 time; /* in microseconds */
80 u64 sector; /* disk offset */
81 u32 bytes; /* transfer length */
82 u32 action; /* what happened */
83 u32 pid; /* who did it */
84 u32 device; /* device number */
85 u32 cpu; /* on what cpu did it happen */
86 u16 error; /* completion error */
87 u16 pdu_len; /* length of data after this trace */
88};
89
90/*
91 * The remap event
92 */
93struct blk_io_trace_remap {
94 u32 device;
95 u32 __pad;
96 u64 sector;
97};
98
99enum {
100 Blktrace_setup = 1,
101 Blktrace_running,
102 Blktrace_stopped,
103};
104
105struct blk_trace {
106 int trace_state;
107 struct rchan *rchan;
108 unsigned long *sequence;
109 u16 act_mask;
110 u64 start_lba;
111 u64 end_lba;
112 u32 pid;
113 u32 dev;
114 struct dentry *dir;
115 struct dentry *dropped_file;
116 atomic_t dropped;
117};
118
119/*
120 * User setup structure passed with BLKTRACESTART
121 */
122struct blk_user_trace_setup {
123 char name[BDEVNAME_SIZE]; /* output */
124 u16 act_mask; /* input */
125 u32 buf_size; /* input */
126 u32 buf_nr; /* input */
127 u64 start_lba;
128 u64 end_lba;
129 u32 pid;
130};
131
132#if defined(CONFIG_BLK_DEV_IO_TRACE)
133extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
134extern void blk_trace_shutdown(request_queue_t *);
135extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
136
137/**
138 * blk_add_trace_rq - Add a trace for a request oriented action
139 * @q: queue the io is for
140 * @rq: the source request
141 * @what: the action
142 *
143 * Description:
144 * Records an action against a request. Will log the bio offset + size.
145 *
146 **/
147static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
148 u32 what)
149{
150 struct blk_trace *bt = q->blk_trace;
151 int rw = rq->flags & 0x07;
152
153 if (likely(!bt))
154 return;
155
156 if (blk_pc_request(rq)) {
157 what |= BLK_TC_ACT(BLK_TC_PC);
158 __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd);
159 } else {
160 what |= BLK_TC_ACT(BLK_TC_FS);
161 __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, rw, what, rq->errors, 0, NULL);
162 }
163}
164
165/**
166 * blk_add_trace_bio - Add a trace for a bio oriented action
167 * @q: queue the io is for
168 * @bio: the source bio
169 * @what: the action
170 *
171 * Description:
172 * Records an action against a bio. Will log the bio offset + size.
173 *
174 **/
175static inline void blk_add_trace_bio(struct request_queue *q, struct bio *bio,
176 u32 what)
177{
178 struct blk_trace *bt = q->blk_trace;
179
180 if (likely(!bt))
181 return;
182
183 __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, !bio_flagged(bio, BIO_UPTODATE), 0, NULL);
184}
185
186/**
187 * blk_add_trace_generic - Add a trace for a generic action
188 * @q: queue the io is for
189 * @bio: the source bio
190 * @rw: the data direction
191 * @what: the action
192 *
193 * Description:
194 * Records a simple trace
195 *
196 **/
197static inline void blk_add_trace_generic(struct request_queue *q,
198 struct bio *bio, int rw, u32 what)
199{
200 struct blk_trace *bt = q->blk_trace;
201
202 if (likely(!bt))
203 return;
204
205 if (bio)
206 blk_add_trace_bio(q, bio, what);
207 else
208 __blk_add_trace(bt, 0, 0, rw, what, 0, 0, NULL);
209}
210
211/**
212 * blk_add_trace_pdu_int - Add a trace for a bio with an integer payload
213 * @q: queue the io is for
214 * @what: the action
215 * @bio: the source bio
216 * @pdu: the integer payload
217 *
218 * Description:
219 * Adds a trace with some integer payload. This might be an unplug
220 * option given as the action, with the depth at unplug time given
221 * as the payload
222 *
223 **/
224static inline void blk_add_trace_pdu_int(struct request_queue *q, u32 what,
225 struct bio *bio, unsigned int pdu)
226{
227 struct blk_trace *bt = q->blk_trace;
228 u64 rpdu = cpu_to_be64(pdu);
229
230 if (likely(!bt))
231 return;
232
233 if (bio)
234 __blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, !bio_flagged(bio, BIO_UPTODATE), sizeof(rpdu), &rpdu);
235 else
236 __blk_add_trace(bt, 0, 0, 0, what, 0, sizeof(rpdu), &rpdu);
237}
238
239/**
240 * blk_add_trace_remap - Add a trace for a remap operation
241 * @q: queue the io is for
242 * @bio: the source bio
243 * @dev: target device
244 * @from: source sector
245 * @to: target sector
246 *
247 * Description:
248 * Device mapper or raid target sometimes need to split a bio because
249 * it spans a stripe (or similar). Add a trace for that action.
250 *
251 **/
252static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
253 dev_t dev, sector_t from, sector_t to)
254{
255 struct blk_trace *bt = q->blk_trace;
256 struct blk_io_trace_remap r;
257
258 if (likely(!bt))
259 return;
260
261 r.device = cpu_to_be32(dev);
262 r.sector = cpu_to_be64(to);
263
264 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
265}
266
267#else /* !CONFIG_BLK_DEV_IO_TRACE */
268#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
269#define blk_trace_shutdown(q) do { } while (0)
270#define blk_add_trace_rq(q, rq, what) do { } while (0)
271#define blk_add_trace_bio(q, rq, what) do { } while (0)
272#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
273#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
274#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
275#endif /* CONFIG_BLK_DEV_IO_TRACE */
276
277#endif
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 993da8cc9706..de3eb8d8ae26 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -38,6 +38,7 @@ typedef struct bootmem_data {
38 unsigned long last_pos; 38 unsigned long last_pos;
39 unsigned long last_success; /* Previous allocation point. To speed 39 unsigned long last_success; /* Previous allocation point. To speed
40 * up searching */ 40 * up searching */
41 struct list_head list;
41} bootmem_data_t; 42} bootmem_data_t;
42 43
43extern unsigned long __init bootmem_bootmap_pages (unsigned long); 44extern unsigned long __init bootmem_bootmap_pages (unsigned long);
@@ -51,6 +52,9 @@ extern void * __init __alloc_bootmem_low_node(pg_data_t *pgdat,
51 unsigned long size, 52 unsigned long size,
52 unsigned long align, 53 unsigned long align,
53 unsigned long goal); 54 unsigned long goal);
55extern void * __init __alloc_bootmem_core(struct bootmem_data *bdata,
56 unsigned long size, unsigned long align, unsigned long goal,
57 unsigned long limit);
54#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 58#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
55extern void __init reserve_bootmem (unsigned long addr, unsigned long size); 59extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
56#define alloc_bootmem(x) \ 60#define alloc_bootmem(x) \
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 9f159baf153f..fb7e9b7ccbe3 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -46,25 +46,28 @@ struct address_space;
46typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate); 46typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
47 47
48/* 48/*
49 * Keep related fields in common cachelines. The most commonly accessed 49 * Historically, a buffer_head was used to map a single block
50 * field (b_state) goes at the start so the compiler does not generate 50 * within a page, and of course as the unit of I/O through the
51 * indexed addressing for it. 51 * filesystem and block layers. Nowadays the basic I/O unit
52 * is the bio, and buffer_heads are used for extracting block
53 * mappings (via a get_block_t call), for tracking state within
54 * a page (via a page_mapping) and for wrapping bio submission
55 * for backward compatibility reasons (e.g. submit_bh).
52 */ 56 */
53struct buffer_head { 57struct buffer_head {
54 /* First cache line: */
55 unsigned long b_state; /* buffer state bitmap (see above) */ 58 unsigned long b_state; /* buffer state bitmap (see above) */
56 struct buffer_head *b_this_page;/* circular list of page's buffers */ 59 struct buffer_head *b_this_page;/* circular list of page's buffers */
57 struct page *b_page; /* the page this bh is mapped to */ 60 struct page *b_page; /* the page this bh is mapped to */
58 atomic_t b_count; /* users using this block */
59 u32 b_size; /* block size */
60 61
61 sector_t b_blocknr; /* block number */ 62 sector_t b_blocknr; /* start block number */
62 char *b_data; /* pointer to data block */ 63 size_t b_size; /* size of mapping */
64 char *b_data; /* pointer to data within the page */
63 65
64 struct block_device *b_bdev; 66 struct block_device *b_bdev;
65 bh_end_io_t *b_end_io; /* I/O completion */ 67 bh_end_io_t *b_end_io; /* I/O completion */
66 void *b_private; /* reserved for b_end_io */ 68 void *b_private; /* reserved for b_end_io */
67 struct list_head b_assoc_buffers; /* associated with another mapping */ 69 struct list_head b_assoc_buffers; /* associated with another mapping */
70 atomic_t b_count; /* users using this buffer_head */
68}; 71};
69 72
70/* 73/*
@@ -189,8 +192,8 @@ extern int buffer_heads_over_limit;
189 * address_spaces. 192 * address_spaces.
190 */ 193 */
191int try_to_release_page(struct page * page, gfp_t gfp_mask); 194int try_to_release_page(struct page * page, gfp_t gfp_mask);
192int block_invalidatepage(struct page *page, unsigned long offset); 195void block_invalidatepage(struct page *page, unsigned long offset);
193int do_invalidatepage(struct page *page, unsigned long offset); 196void do_invalidatepage(struct page *page, unsigned long offset);
194int block_write_full_page(struct page *page, get_block_t *get_block, 197int block_write_full_page(struct page *page, get_block_t *get_block,
195 struct writeback_control *wbc); 198 struct writeback_control *wbc);
196int block_read_full_page(struct page*, get_block_t*); 199int block_read_full_page(struct page*, get_block_t*);
@@ -200,7 +203,7 @@ int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
200int generic_cont_expand(struct inode *inode, loff_t size); 203int generic_cont_expand(struct inode *inode, loff_t size);
201int generic_cont_expand_simple(struct inode *inode, loff_t size); 204int generic_cont_expand_simple(struct inode *inode, loff_t size);
202int block_commit_write(struct page *page, unsigned from, unsigned to); 205int block_commit_write(struct page *page, unsigned from, unsigned to);
203int block_sync_page(struct page *); 206void block_sync_page(struct page *);
204sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 207sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
205int generic_commit_write(struct file *, struct page *, unsigned, unsigned); 208int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
206int block_truncate_page(struct address_space *, loff_t, get_block_t *); 209int block_truncate_page(struct address_space *, loff_t, get_block_t *);
@@ -277,6 +280,7 @@ map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block)
277 set_buffer_mapped(bh); 280 set_buffer_mapped(bh);
278 bh->b_bdev = sb->s_bdev; 281 bh->b_bdev = sb->s_bdev;
279 bh->b_blocknr = block; 282 bh->b_blocknr = block;
283 bh->b_size = sb->s_blocksize;
280} 284}
281 285
282/* 286/*
diff --git a/include/linux/cache.h b/include/linux/cache.h
index d22e632f41fb..cc4b3aafad9a 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -13,9 +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) || defined(CONFIG_PARISC) 16#ifndef __read_mostly
17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18#else
19#define __read_mostly 17#define __read_mostly
20#endif 18#endif
21 19
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 5a23ce752629..6548b35ab9f6 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -357,7 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c)
357 357
358#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)
359 359
360extern int capable(int cap); 360int capable(int cap);
361int __capable(struct task_struct *t, int cap);
361 362
362#endif /* __KERNEL__ */ 363#endif /* __KERNEL__ */
363 364
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 8da37e29cb87..2216638962d2 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -5,13 +5,13 @@
5struct cdev { 5struct cdev {
6 struct kobject kobj; 6 struct kobject kobj;
7 struct module *owner; 7 struct module *owner;
8 struct file_operations *ops; 8 const struct file_operations *ops;
9 struct list_head list; 9 struct list_head list;
10 dev_t dev; 10 dev_t dev;
11 unsigned int count; 11 unsigned int count;
12}; 12};
13 13
14void cdev_init(struct cdev *, struct file_operations *); 14void cdev_init(struct cdev *, const struct file_operations *);
15 15
16struct cdev *cdev_alloc(void); 16struct cdev *cdev_alloc(void);
17 17
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index b68fdf1f3156..3c9b0bc05123 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -378,7 +378,6 @@ struct cdrom_generic_command
378#define CDC_MEDIA_CHANGED 0x80 /* media changed */ 378#define CDC_MEDIA_CHANGED 0x80 /* media changed */
379#define CDC_PLAY_AUDIO 0x100 /* audio functions */ 379#define CDC_PLAY_AUDIO 0x100 /* audio functions */
380#define CDC_RESET 0x200 /* hard reset device */ 380#define CDC_RESET 0x200 /* hard reset device */
381#define CDC_IOCTLS 0x400 /* driver has non-standard ioctls */
382#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ 381#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */
383#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ 382#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */
384#define CDC_CD_R 0x2000 /* drive is a CD-R */ 383#define CDC_CD_R 0x2000 /* drive is a CD-R */
@@ -974,9 +973,7 @@ struct cdrom_device_ops {
974 int (*reset) (struct cdrom_device_info *); 973 int (*reset) (struct cdrom_device_info *);
975 /* play stuff */ 974 /* play stuff */
976 int (*audio_ioctl) (struct cdrom_device_info *,unsigned int, void *); 975 int (*audio_ioctl) (struct cdrom_device_info *,unsigned int, void *);
977 /* dev-specific */ 976
978 int (*dev_ioctl) (struct cdrom_device_info *,
979 unsigned int, unsigned long);
980/* driver specifications */ 977/* driver specifications */
981 const int capability; /* capability flags */ 978 const int capability; /* capability flags */
982 int n_minors; /* number of active minor devices */ 979 int n_minors; /* number of active minor devices */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 12848f81bb37..5ca8c6fddb56 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -8,8 +8,8 @@
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11#ifndef ASMARM_CLOCK_H 11#ifndef __LINUX_CLK_H
12#define ASMARM_CLOCK_H 12#define __LINUX_CLK_H
13 13
14struct device; 14struct device;
15 15
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index cc621ec409d8..b3ecf8f71d97 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -30,9 +30,9 @@ extern struct inode_operations coda_ioctl_inode_operations;
30extern struct address_space_operations coda_file_aops; 30extern struct address_space_operations coda_file_aops;
31extern struct address_space_operations coda_symlink_aops; 31extern struct address_space_operations coda_symlink_aops;
32 32
33extern struct file_operations coda_dir_operations; 33extern const struct file_operations coda_dir_operations;
34extern struct file_operations coda_file_operations; 34extern const struct file_operations coda_file_operations;
35extern struct file_operations coda_ioctl_operations; 35extern const struct file_operations coda_ioctl_operations;
36 36
37/* operations shared over more than one file */ 37/* operations shared over more than one file */
38int coda_open(struct inode *i, struct file *f); 38int coda_open(struct inode *i, struct file *f);
diff --git a/include/linux/compat.h b/include/linux/compat.h
index c9ab2a26348c..6d3a654be1ae 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -45,6 +45,32 @@ struct compat_tms {
45 compat_clock_t tms_cstime; 45 compat_clock_t tms_cstime;
46}; 46};
47 47
48struct compat_timex {
49 compat_uint_t modes;
50 compat_long_t offset;
51 compat_long_t freq;
52 compat_long_t maxerror;
53 compat_long_t esterror;
54 compat_int_t status;
55 compat_long_t constant;
56 compat_long_t precision;
57 compat_long_t tolerance;
58 struct compat_timeval time;
59 compat_long_t tick;
60 compat_long_t ppsfreq;
61 compat_long_t jitter;
62 compat_int_t shift;
63 compat_long_t stabil;
64 compat_long_t jitcnt;
65 compat_long_t calcnt;
66 compat_long_t errcnt;
67 compat_long_t stbcnt;
68
69 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
70 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
71 compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32;
72};
73
48#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) 74#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
49 75
50typedef struct { 76typedef struct {
@@ -121,6 +147,24 @@ typedef struct compat_sigevent {
121 } _sigev_un; 147 } _sigev_un;
122} compat_sigevent_t; 148} compat_sigevent_t;
123 149
150struct compat_robust_list {
151 compat_uptr_t next;
152};
153
154struct compat_robust_list_head {
155 struct compat_robust_list list;
156 compat_long_t futex_offset;
157 compat_uptr_t list_op_pending;
158};
159
160extern void compat_exit_robust_list(struct task_struct *curr);
161
162asmlinkage long
163compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
164 compat_size_t len);
165asmlinkage long
166compat_sys_get_robust_list(int pid, compat_uptr_t *head_ptr,
167 compat_size_t __user *len_ptr);
124 168
125long compat_sys_semctl(int first, int second, int third, void __user *uptr); 169long compat_sys_semctl(int first, int second, int third, void __user *uptr);
126long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); 170long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
@@ -181,5 +225,7 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs,
181 return lhs->tv_nsec - rhs->tv_nsec; 225 return lhs->tv_nsec - rhs->tv_nsec;
182} 226}
183 227
228asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
229
184#endif /* CONFIG_COMPAT */ 230#endif /* CONFIG_COMPAT */
185#endif /* _LINUX_COMPAT_H */ 231#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index ae7dfb790df3..89ab677cb993 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -97,6 +97,10 @@ COMPATIBLE_IOCTL(BLKRRPART)
97COMPATIBLE_IOCTL(BLKFLSBUF) 97COMPATIBLE_IOCTL(BLKFLSBUF)
98COMPATIBLE_IOCTL(BLKSECTSET) 98COMPATIBLE_IOCTL(BLKSECTSET)
99COMPATIBLE_IOCTL(BLKSSZGET) 99COMPATIBLE_IOCTL(BLKSSZGET)
100COMPATIBLE_IOCTL(BLKTRACESTART)
101COMPATIBLE_IOCTL(BLKTRACESTOP)
102COMPATIBLE_IOCTL(BLKTRACESETUP)
103COMPATIBLE_IOCTL(BLKTRACETEARDOWN)
100ULONG_IOCTL(BLKRASET) 104ULONG_IOCTL(BLKRASET)
101ULONG_IOCTL(BLKFRASET) 105ULONG_IOCTL(BLKFRASET)
102/* RAID */ 106/* RAID */
@@ -136,6 +140,7 @@ COMPATIBLE_IOCTL(DM_TABLE_DEPS_32)
136COMPATIBLE_IOCTL(DM_TABLE_STATUS_32) 140COMPATIBLE_IOCTL(DM_TABLE_STATUS_32)
137COMPATIBLE_IOCTL(DM_LIST_VERSIONS_32) 141COMPATIBLE_IOCTL(DM_LIST_VERSIONS_32)
138COMPATIBLE_IOCTL(DM_TARGET_MSG_32) 142COMPATIBLE_IOCTL(DM_TARGET_MSG_32)
143COMPATIBLE_IOCTL(DM_DEV_SET_GEOMETRY_32)
139COMPATIBLE_IOCTL(DM_VERSION) 144COMPATIBLE_IOCTL(DM_VERSION)
140COMPATIBLE_IOCTL(DM_REMOVE_ALL) 145COMPATIBLE_IOCTL(DM_REMOVE_ALL)
141COMPATIBLE_IOCTL(DM_LIST_DEVICES) 146COMPATIBLE_IOCTL(DM_LIST_DEVICES)
@@ -151,6 +156,7 @@ COMPATIBLE_IOCTL(DM_TABLE_DEPS)
151COMPATIBLE_IOCTL(DM_TABLE_STATUS) 156COMPATIBLE_IOCTL(DM_TABLE_STATUS)
152COMPATIBLE_IOCTL(DM_LIST_VERSIONS) 157COMPATIBLE_IOCTL(DM_LIST_VERSIONS)
153COMPATIBLE_IOCTL(DM_TARGET_MSG) 158COMPATIBLE_IOCTL(DM_TARGET_MSG)
159COMPATIBLE_IOCTL(DM_DEV_SET_GEOMETRY)
154/* Big K */ 160/* Big K */
155COMPATIBLE_IOCTL(PIO_FONT) 161COMPATIBLE_IOCTL(PIO_FONT)
156COMPATIBLE_IOCTL(GIO_FONT) 162COMPATIBLE_IOCTL(GIO_FONT)
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 0ed1d4853c69..08d50c53aab4 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -32,7 +32,7 @@ struct cpu {
32}; 32};
33 33
34extern int register_cpu(struct cpu *, int, struct node *); 34extern int register_cpu(struct cpu *, int, struct node *);
35extern struct sys_device *get_cpu_sysdev(int cpu); 35extern struct sys_device *get_cpu_sysdev(unsigned cpu);
36#ifdef CONFIG_HOTPLUG_CPU 36#ifdef CONFIG_HOTPLUG_CPU
37extern void unregister_cpu(struct cpu *, struct node *); 37extern void unregister_cpu(struct cpu *, struct node *);
38#endif 38#endif
@@ -74,7 +74,6 @@ extern int lock_cpu_hotplug_interruptible(void);
74 register_cpu_notifier(&fn##_nb); \ 74 register_cpu_notifier(&fn##_nb); \
75} 75}
76int cpu_down(unsigned int cpu); 76int cpu_down(unsigned int cpu);
77extern int __attribute__((weak)) smp_prepare_cpu(int cpu);
78#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 77#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
79#else 78#else
80#define lock_cpu_hotplug() do { } while (0) 79#define lock_cpu_hotplug() do { } while (0)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 60e56c6e03dd..9cbb781d6f80 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -67,7 +67,7 @@
67 * 67 *
68 * int any_online_cpu(mask) First online cpu in mask 68 * int any_online_cpu(mask) First online cpu in mask
69 * 69 *
70 * for_each_cpu(cpu) for-loop cpu over cpu_possible_map 70 * for_each_possible_cpu(cpu) for-loop cpu over cpu_possible_map
71 * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map 71 * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map
72 * for_each_present_cpu(cpu) for-loop cpu over cpu_present_map 72 * for_each_present_cpu(cpu) for-loop cpu over cpu_present_map
73 * 73 *
@@ -212,17 +212,15 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
212 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); 212 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
213} 213}
214 214
215#define first_cpu(src) __first_cpu(&(src), NR_CPUS) 215#ifdef CONFIG_SMP
216static inline int __first_cpu(const cpumask_t *srcp, int nbits) 216int __first_cpu(const cpumask_t *srcp);
217{ 217#define first_cpu(src) __first_cpu(&(src))
218 return min_t(int, nbits, find_first_bit(srcp->bits, nbits)); 218int __next_cpu(int n, const cpumask_t *srcp);
219} 219#define next_cpu(n, src) __next_cpu((n), &(src))
220 220#else
221#define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS) 221#define first_cpu(src) 0
222static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits) 222#define next_cpu(n, src) 1
223{ 223#endif
224 return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1));
225}
226 224
227#define cpumask_of_cpu(cpu) \ 225#define cpumask_of_cpu(cpu) \
228({ \ 226({ \
@@ -398,27 +396,18 @@ extern cpumask_t cpu_present_map;
398#define cpu_present(cpu) ((cpu) == 0) 396#define cpu_present(cpu) ((cpu) == 0)
399#endif 397#endif
400 398
401#define any_online_cpu(mask) \ 399#ifdef CONFIG_SMP
402({ \ 400int highest_possible_processor_id(void);
403 int cpu; \ 401#define any_online_cpu(mask) __any_online_cpu(&(mask))
404 for_each_cpu_mask(cpu, (mask)) \ 402int __any_online_cpu(const cpumask_t *mask);
405 if (cpu_online(cpu)) \ 403#else
406 break; \ 404#define highest_possible_processor_id() 0
407 cpu; \ 405#define any_online_cpu(mask) 0
408}) 406#endif
409 407
410#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) 408#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
409#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
411#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) 410#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map)
412#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) 411#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
413 412
414/* Find the highest possible smp_processor_id() */
415#define highest_possible_processor_id() \
416({ \
417 unsigned int cpu, highest = 0; \
418 for_each_cpu_mask(cpu, cpu_possible_map) \
419 highest = cpu; \
420 highest; \
421})
422
423
424#endif /* __LINUX_CPUMASK_H */ 413#endif /* __LINUX_CPUMASK_H */
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 3bc606927116..9354722a9217 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -4,7 +4,7 @@
4 * cpuset interface 4 * cpuset interface
5 * 5 *
6 * Copyright (C) 2003 BULL SA 6 * Copyright (C) 2003 BULL SA
7 * Copyright (C) 2004 Silicon Graphics, Inc. 7 * Copyright (C) 2004-2006 Silicon Graphics, Inc.
8 * 8 *
9 */ 9 */
10 10
@@ -51,6 +51,18 @@ extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
51extern void cpuset_lock(void); 51extern void cpuset_lock(void);
52extern void cpuset_unlock(void); 52extern void cpuset_unlock(void);
53 53
54extern int cpuset_mem_spread_node(void);
55
56static inline int cpuset_do_page_mem_spread(void)
57{
58 return current->flags & PF_SPREAD_PAGE;
59}
60
61static inline int cpuset_do_slab_mem_spread(void)
62{
63 return current->flags & PF_SPREAD_SLAB;
64}
65
54#else /* !CONFIG_CPUSETS */ 66#else /* !CONFIG_CPUSETS */
55 67
56static inline int cpuset_init_early(void) { return 0; } 68static inline int cpuset_init_early(void) { return 0; }
@@ -99,6 +111,21 @@ static inline char *cpuset_task_status_allowed(struct task_struct *task,
99static inline void cpuset_lock(void) {} 111static inline void cpuset_lock(void) {}
100static inline void cpuset_unlock(void) {} 112static inline void cpuset_unlock(void) {}
101 113
114static inline int cpuset_mem_spread_node(void)
115{
116 return 0;
117}
118
119static inline int cpuset_do_page_mem_spread(void)
120{
121 return 0;
122}
123
124static inline int cpuset_do_slab_mem_spread(void)
125{
126 return 0;
127}
128
102#endif /* !CONFIG_CPUSETS */ 129#endif /* !CONFIG_CPUSETS */
103 130
104#endif /* _LINUX_CPUSET_H */ 131#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 534d750d922d..32503657f14f 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -11,7 +11,7 @@
11extern unsigned long long elfcorehdr_addr; 11extern unsigned long long elfcorehdr_addr;
12extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 12extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
13 unsigned long, int); 13 unsigned long, int);
14extern struct file_operations proc_vmcore_operations; 14extern const struct file_operations proc_vmcore_operations;
15extern struct proc_dir_entry *proc_vmcore; 15extern struct proc_dir_entry *proc_vmcore;
16 16
17#endif /* CONFIG_CRASH_DUMP */ 17#endif /* CONFIG_CRASH_DUMP */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index d88bf8aa8b47..0ab1bc1152ca 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -229,6 +229,8 @@ struct crypto_tfm {
229 } crt_u; 229 } crt_u;
230 230
231 struct crypto_alg *__crt_alg; 231 struct crypto_alg *__crt_alg;
232
233 char __crt_ctx[] __attribute__ ((__aligned__));
232}; 234};
233 235
234/* 236/*
@@ -301,7 +303,13 @@ static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm)
301 303
302static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) 304static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm)
303{ 305{
304 return (void *)&tfm[1]; 306 return tfm->__crt_ctx;
307}
308
309static inline unsigned int crypto_tfm_ctx_alignment(void)
310{
311 struct crypto_tfm *tfm;
312 return __alignof__(tfm->__crt_ctx);
305} 313}
306 314
307/* 315/*
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 4361f3789975..836325ee0931 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -162,6 +162,8 @@ d_iput: no no no yes
162#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ 162#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
163#define DCACHE_UNHASHED 0x0010 163#define DCACHE_UNHASHED 0x0010
164 164
165#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */
166
165extern spinlock_t dcache_lock; 167extern spinlock_t dcache_lock;
166 168
167/** 169/**
@@ -273,6 +275,7 @@ extern void d_move(struct dentry *, struct dentry *);
273/* appendix may either be NULL or be used for transname suffixes */ 275/* appendix may either be NULL or be used for transname suffixes */
274extern struct dentry * d_lookup(struct dentry *, struct qstr *); 276extern struct dentry * d_lookup(struct dentry *, struct qstr *);
275extern struct dentry * __d_lookup(struct dentry *, struct qstr *); 277extern struct dentry * __d_lookup(struct dentry *, struct qstr *);
278extern struct dentry * d_hash_and_lookup(struct dentry *, struct qstr *);
276 279
277/* validate "insecure" dentry pointer */ 280/* validate "insecure" dentry pointer */
278extern int d_validate(struct dentry *, struct dentry *); 281extern int d_validate(struct dentry *, struct dentry *);
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 088529f54965..676333b9fad0 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -18,7 +18,7 @@
18 * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x 18 * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x
19 */ 19 */
20struct dccp_hdr { 20struct dccp_hdr {
21 __u16 dccph_sport, 21 __be16 dccph_sport,
22 dccph_dport; 22 dccph_dport;
23 __u8 dccph_doff; 23 __u8 dccph_doff;
24#if defined(__LITTLE_ENDIAN_BITFIELD) 24#if defined(__LITTLE_ENDIAN_BITFIELD)
@@ -32,18 +32,18 @@ struct dccp_hdr {
32#endif 32#endif
33 __u16 dccph_checksum; 33 __u16 dccph_checksum;
34#if defined(__LITTLE_ENDIAN_BITFIELD) 34#if defined(__LITTLE_ENDIAN_BITFIELD)
35 __u32 dccph_x:1, 35 __u8 dccph_x:1,
36 dccph_type:4, 36 dccph_type:4,
37 dccph_reserved:3, 37 dccph_reserved:3;
38 dccph_seq:24;
39#elif defined(__BIG_ENDIAN_BITFIELD) 38#elif defined(__BIG_ENDIAN_BITFIELD)
40 __u32 dccph_reserved:3, 39 __u8 dccph_reserved:3,
41 dccph_type:4, 40 dccph_type:4,
42 dccph_x:1, 41 dccph_x:1;
43 dccph_seq:24;
44#else 42#else
45#error "Adjust your <asm/byteorder.h> defines" 43#error "Adjust your <asm/byteorder.h> defines"
46#endif 44#endif
45 __u8 dccph_seq2;
46 __be16 dccph_seq;
47}; 47};
48 48
49/** 49/**
@@ -52,7 +52,7 @@ struct dccp_hdr {
52 * @dccph_seq_low - low 24 bits of a 48 bit seq packet 52 * @dccph_seq_low - low 24 bits of a 48 bit seq packet
53 */ 53 */
54struct dccp_hdr_ext { 54struct dccp_hdr_ext {
55 __u32 dccph_seq_low; 55 __be32 dccph_seq_low;
56}; 56};
57 57
58/** 58/**
@@ -62,7 +62,7 @@ struct dccp_hdr_ext {
62 * @dccph_req_options - list of options (must be a multiple of 32 bits 62 * @dccph_req_options - list of options (must be a multiple of 32 bits
63 */ 63 */
64struct dccp_hdr_request { 64struct dccp_hdr_request {
65 __u32 dccph_req_service; 65 __be32 dccph_req_service;
66}; 66};
67/** 67/**
68 * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets 68 * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets
@@ -71,9 +71,9 @@ struct dccp_hdr_request {
71 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR 71 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
72 */ 72 */
73struct dccp_hdr_ack_bits { 73struct dccp_hdr_ack_bits {
74 __u32 dccph_reserved1:8, 74 __be16 dccph_reserved1;
75 dccph_ack_nr_high:24; 75 __be16 dccph_ack_nr_high;
76 __u32 dccph_ack_nr_low; 76 __be32 dccph_ack_nr_low;
77}; 77};
78/** 78/**
79 * struct dccp_hdr_response - Conection initiation response header 79 * struct dccp_hdr_response - Conection initiation response header
@@ -85,7 +85,7 @@ struct dccp_hdr_ack_bits {
85 */ 85 */
86struct dccp_hdr_response { 86struct dccp_hdr_response {
87 struct dccp_hdr_ack_bits dccph_resp_ack; 87 struct dccp_hdr_ack_bits dccph_resp_ack;
88 __u32 dccph_resp_service; 88 __be32 dccph_resp_service;
89}; 89};
90 90
91/** 91/**
@@ -154,6 +154,10 @@ enum {
154 DCCPO_MANDATORY = 1, 154 DCCPO_MANDATORY = 1,
155 DCCPO_MIN_RESERVED = 3, 155 DCCPO_MIN_RESERVED = 3,
156 DCCPO_MAX_RESERVED = 31, 156 DCCPO_MAX_RESERVED = 31,
157 DCCPO_CHANGE_L = 32,
158 DCCPO_CONFIRM_L = 33,
159 DCCPO_CHANGE_R = 34,
160 DCCPO_CONFIRM_R = 35,
157 DCCPO_NDP_COUNT = 37, 161 DCCPO_NDP_COUNT = 37,
158 DCCPO_ACK_VECTOR_0 = 38, 162 DCCPO_ACK_VECTOR_0 = 38,
159 DCCPO_ACK_VECTOR_1 = 39, 163 DCCPO_ACK_VECTOR_1 = 39,
@@ -168,7 +172,9 @@ enum {
168/* DCCP features */ 172/* DCCP features */
169enum { 173enum {
170 DCCPF_RESERVED = 0, 174 DCCPF_RESERVED = 0,
175 DCCPF_CCID = 1,
171 DCCPF_SEQUENCE_WINDOW = 3, 176 DCCPF_SEQUENCE_WINDOW = 3,
177 DCCPF_ACK_RATIO = 5,
172 DCCPF_SEND_ACK_VECTOR = 6, 178 DCCPF_SEND_ACK_VECTOR = 6,
173 DCCPF_SEND_NDP_COUNT = 7, 179 DCCPF_SEND_NDP_COUNT = 7,
174 /* 10-127 reserved */ 180 /* 10-127 reserved */
@@ -176,9 +182,18 @@ enum {
176 DCCPF_MAX_CCID_SPECIFIC = 255, 182 DCCPF_MAX_CCID_SPECIFIC = 255,
177}; 183};
178 184
185/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */
186struct dccp_so_feat {
187 __u8 dccpsf_feat;
188 __u8 *dccpsf_val;
189 __u8 dccpsf_len;
190};
191
179/* DCCP socket options */ 192/* DCCP socket options */
180#define DCCP_SOCKOPT_PACKET_SIZE 1 193#define DCCP_SOCKOPT_PACKET_SIZE 1
181#define DCCP_SOCKOPT_SERVICE 2 194#define DCCP_SOCKOPT_SERVICE 2
195#define DCCP_SOCKOPT_CHANGE_L 3
196#define DCCP_SOCKOPT_CHANGE_R 4
182#define DCCP_SOCKOPT_CCID_RX_INFO 128 197#define DCCP_SOCKOPT_CCID_RX_INFO 128
183#define DCCP_SOCKOPT_CCID_TX_INFO 192 198#define DCCP_SOCKOPT_CCID_TX_INFO 192
184 199
@@ -254,16 +269,12 @@ static inline unsigned int dccp_basic_hdr_len(const struct sk_buff *skb)
254static inline __u64 dccp_hdr_seq(const struct sk_buff *skb) 269static inline __u64 dccp_hdr_seq(const struct sk_buff *skb)
255{ 270{
256 const struct dccp_hdr *dh = dccp_hdr(skb); 271 const struct dccp_hdr *dh = dccp_hdr(skb);
257#if defined(__LITTLE_ENDIAN_BITFIELD) 272 __u64 seq_nr = ntohs(dh->dccph_seq);
258 __u64 seq_nr = ntohl(dh->dccph_seq << 8);
259#elif defined(__BIG_ENDIAN_BITFIELD)
260 __u64 seq_nr = ntohl(dh->dccph_seq);
261#else
262#error "Adjust your <asm/byteorder.h> defines"
263#endif
264 273
265 if (dh->dccph_x != 0) 274 if (dh->dccph_x != 0)
266 seq_nr = (seq_nr << 32) + ntohl(dccp_hdrx(skb)->dccph_seq_low); 275 seq_nr = (seq_nr << 32) + ntohl(dccp_hdrx(skb)->dccph_seq_low);
276 else
277 seq_nr += (u32)dh->dccph_seq2 << 16;
267 278
268 return seq_nr; 279 return seq_nr;
269} 280}
@@ -281,13 +292,7 @@ static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *
281static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb) 292static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
282{ 293{
283 const struct dccp_hdr_ack_bits *dhack = dccp_hdr_ack_bits(skb); 294 const struct dccp_hdr_ack_bits *dhack = dccp_hdr_ack_bits(skb);
284#if defined(__LITTLE_ENDIAN_BITFIELD) 295 return ((u64)ntohs(dhack->dccph_ack_nr_high) << 32) + ntohl(dhack->dccph_ack_nr_low);
285 return (((u64)ntohl(dhack->dccph_ack_nr_high << 8)) << 32) + ntohl(dhack->dccph_ack_nr_low);
286#elif defined(__BIG_ENDIAN_BITFIELD)
287 return (((u64)ntohl(dhack->dccph_ack_nr_high)) << 32) + ntohl(dhack->dccph_ack_nr_low);
288#else
289#error "Adjust your <asm/byteorder.h> defines"
290#endif
291} 296}
292 297
293static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb) 298static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb)
@@ -314,38 +319,60 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
314 319
315/* initial values for each feature */ 320/* initial values for each feature */
316#define DCCPF_INITIAL_SEQUENCE_WINDOW 100 321#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
317/* FIXME: for now we're using CCID 3 (TFRC) */ 322#define DCCPF_INITIAL_ACK_RATIO 2
318#define DCCPF_INITIAL_CCID 3 323#define DCCPF_INITIAL_CCID 2
319#define DCCPF_INITIAL_SEND_ACK_VECTOR 0 324#define DCCPF_INITIAL_SEND_ACK_VECTOR 1
320/* FIXME: for now we're default to 1 but it should really be 0 */ 325/* FIXME: for now we're default to 1 but it should really be 0 */
321#define DCCPF_INITIAL_SEND_NDP_COUNT 1 326#define DCCPF_INITIAL_SEND_NDP_COUNT 1
322 327
323#define DCCP_NDP_LIMIT 0xFFFFFF 328#define DCCP_NDP_LIMIT 0xFFFFFF
324 329
325/** 330/**
326 * struct dccp_options - option values for a DCCP connection 331 * struct dccp_minisock - Minimal DCCP connection representation
327 * @dccpo_sequence_window - Sequence Window Feature (section 7.5.2) 332 *
328 * @dccpo_ccid - Congestion Control Id (CCID) (section 10) 333 * Will be used to pass the state from dccp_request_sock to dccp_sock.
329 * @dccpo_send_ack_vector - Send Ack Vector Feature (section 11.5) 334 *
330 * @dccpo_send_ndp_count - Send NDP Count Feature (7.7.2) 335 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
336 * @dccpms_ccid - Congestion Control Id (CCID) (section 10)
337 * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5)
338 * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2)
331 */ 339 */
332struct dccp_options { 340struct dccp_minisock {
333 __u64 dccpo_sequence_window; 341 __u64 dccpms_sequence_window;
334 __u8 dccpo_rx_ccid; 342 __u8 dccpms_rx_ccid;
335 __u8 dccpo_tx_ccid; 343 __u8 dccpms_tx_ccid;
336 __u8 dccpo_send_ack_vector; 344 __u8 dccpms_send_ack_vector;
337 __u8 dccpo_send_ndp_count; 345 __u8 dccpms_send_ndp_count;
346 __u8 dccpms_ack_ratio;
347 struct list_head dccpms_pending;
348 struct list_head dccpms_conf;
349};
350
351struct dccp_opt_conf {
352 __u8 *dccpoc_val;
353 __u8 dccpoc_len;
354};
355
356struct dccp_opt_pend {
357 struct list_head dccpop_node;
358 __u8 dccpop_type;
359 __u8 dccpop_feat;
360 __u8 *dccpop_val;
361 __u8 dccpop_len;
362 int dccpop_conf;
363 struct dccp_opt_conf *dccpop_sc;
338}; 364};
339 365
340extern void __dccp_options_init(struct dccp_options *dccpo); 366extern void __dccp_minisock_init(struct dccp_minisock *dmsk);
341extern void dccp_options_init(struct dccp_options *dccpo); 367extern void dccp_minisock_init(struct dccp_minisock *dmsk);
368
342extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); 369extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb);
343 370
344struct dccp_request_sock { 371struct dccp_request_sock {
345 struct inet_request_sock dreq_inet_rsk; 372 struct inet_request_sock dreq_inet_rsk;
346 __u64 dreq_iss; 373 __u64 dreq_iss;
347 __u64 dreq_isr; 374 __u64 dreq_isr;
348 __u32 dreq_service; 375 __be32 dreq_service;
349}; 376};
350 377
351static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) 378static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
@@ -373,13 +400,13 @@ enum dccp_role {
373 400
374struct dccp_service_list { 401struct dccp_service_list {
375 __u32 dccpsl_nr; 402 __u32 dccpsl_nr;
376 __u32 dccpsl_list[0]; 403 __be32 dccpsl_list[0];
377}; 404};
378 405
379#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1) 406#define DCCP_SERVICE_INVALID_VALUE htonl((__u32)-1)
380 407
381static inline int dccp_list_has_service(const struct dccp_service_list *sl, 408static inline int dccp_list_has_service(const struct dccp_service_list *sl,
382 const u32 service) 409 const __be32 service)
383{ 410{
384 if (likely(sl != NULL)) { 411 if (likely(sl != NULL)) {
385 u32 i = sl->dccpsl_nr; 412 u32 i = sl->dccpsl_nr;
@@ -425,17 +452,17 @@ struct dccp_sock {
425 __u64 dccps_gss; 452 __u64 dccps_gss;
426 __u64 dccps_gsr; 453 __u64 dccps_gsr;
427 __u64 dccps_gar; 454 __u64 dccps_gar;
428 __u32 dccps_service; 455 __be32 dccps_service;
429 struct dccp_service_list *dccps_service_list; 456 struct dccp_service_list *dccps_service_list;
430 struct timeval dccps_timestamp_time; 457 struct timeval dccps_timestamp_time;
431 __u32 dccps_timestamp_echo; 458 __u32 dccps_timestamp_echo;
432 __u32 dccps_packet_size; 459 __u32 dccps_packet_size;
460 __u16 dccps_l_ack_ratio;
461 __u16 dccps_r_ack_ratio;
433 unsigned long dccps_ndp_count; 462 unsigned long dccps_ndp_count;
434 __u32 dccps_mss_cache; 463 __u32 dccps_mss_cache;
435 struct dccp_options dccps_options; 464 struct dccp_minisock dccps_minisock;
436 struct dccp_ackvec *dccps_hc_rx_ackvec; 465 struct dccp_ackvec *dccps_hc_rx_ackvec;
437 void *dccps_hc_rx_ccid_private;
438 void *dccps_hc_tx_ccid_private;
439 struct ccid *dccps_hc_rx_ccid; 466 struct ccid *dccps_hc_rx_ccid;
440 struct ccid *dccps_hc_tx_ccid; 467 struct ccid *dccps_hc_tx_ccid;
441 struct dccp_options_received dccps_options_received; 468 struct dccp_options_received dccps_options_received;
@@ -450,6 +477,11 @@ static inline struct dccp_sock *dccp_sk(const struct sock *sk)
450 return (struct dccp_sock *)sk; 477 return (struct dccp_sock *)sk;
451} 478}
452 479
480static inline struct dccp_minisock *dccp_msk(const struct sock *sk)
481{
482 return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock;
483}
484
453static inline int dccp_service_not_initialized(const struct sock *sk) 485static inline int dccp_service_not_initialized(const struct sock *sk)
454{ 486{
455 return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE; 487 return dccp_sk(sk)->dccps_service == DCCP_SERVICE_INVALID_VALUE;
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index a5fa6a6eede8..176e2d371577 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -21,10 +21,15 @@
21 21
22struct file_operations; 22struct file_operations;
23 23
24struct debugfs_blob_wrapper {
25 void *data;
26 unsigned long size;
27};
28
24#if defined(CONFIG_DEBUG_FS) 29#if defined(CONFIG_DEBUG_FS)
25struct dentry *debugfs_create_file(const char *name, mode_t mode, 30struct dentry *debugfs_create_file(const char *name, mode_t mode,
26 struct dentry *parent, void *data, 31 struct dentry *parent, void *data,
27 struct file_operations *fops); 32 const struct file_operations *fops);
28 33
29struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); 34struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
30 35
@@ -39,6 +44,9 @@ struct dentry *debugfs_create_u32(const char *name, mode_t mode,
39struct dentry *debugfs_create_bool(const char *name, mode_t mode, 44struct dentry *debugfs_create_bool(const char *name, mode_t mode,
40 struct dentry *parent, u32 *value); 45 struct dentry *parent, u32 *value);
41 46
47struct dentry *debugfs_create_blob(const char *name, mode_t mode,
48 struct dentry *parent,
49 struct debugfs_blob_wrapper *blob);
42#else 50#else
43 51
44#include <linux/err.h> 52#include <linux/err.h>
@@ -94,6 +102,13 @@ static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode,
94 return ERR_PTR(-ENODEV); 102 return ERR_PTR(-ENODEV);
95} 103}
96 104
105static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode,
106 struct dentry *parent,
107 struct debugfs_blob_wrapper *blob)
108{
109 return ERR_PTR(-ENODEV);
110}
111
97#endif 112#endif
98 113
99#endif 114#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 51e0e95a421a..aee10b2ea4c6 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -97,6 +97,7 @@ struct io_restrictions {
97 unsigned short hardsect_size; 97 unsigned short hardsect_size;
98 unsigned int max_segment_size; 98 unsigned int max_segment_size;
99 unsigned long seg_boundary_mask; 99 unsigned long seg_boundary_mask;
100 unsigned char no_cluster; /* inverted so that 0 is default */
100}; 101};
101 102
102struct dm_target { 103struct dm_target {
diff --git a/include/linux/device.h b/include/linux/device.h
index 58df18d9cd3e..f6e72a65a3f2 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -378,6 +378,7 @@ extern void device_bind_driver(struct device * dev);
378extern void device_release_driver(struct device * dev); 378extern void device_release_driver(struct device * dev);
379extern int device_attach(struct device * dev); 379extern int device_attach(struct device * dev);
380extern void driver_attach(struct device_driver * drv); 380extern void driver_attach(struct device_driver * drv);
381extern void device_reprobe(struct device *dev);
381 382
382 383
383/* 384/*
@@ -399,7 +400,7 @@ extern struct device * get_device(struct device * dev);
399extern void put_device(struct device * dev); 400extern void put_device(struct device * dev);
400 401
401 402
402/* drivers/base/power.c */ 403/* drivers/base/power/shutdown.c */
403extern void device_shutdown(void); 404extern void device_shutdown(void);
404 405
405 406
@@ -424,6 +425,8 @@ extern void firmware_unregister(struct subsystem *);
424 dev_printk(KERN_INFO , dev , format , ## arg) 425 dev_printk(KERN_INFO , dev , format , ## arg)
425#define dev_warn(dev, format, arg...) \ 426#define dev_warn(dev, format, arg...) \
426 dev_printk(KERN_WARNING , dev , format , ## arg) 427 dev_printk(KERN_WARNING , dev , format , ## arg)
428#define dev_notice(dev, format, arg...) \
429 dev_printk(KERN_NOTICE , dev , format , ## arg)
427 430
428/* Create alias, so I can be autoloaded. */ 431/* Create alias, so I can be autoloaded. */
429#define MODULE_ALIAS_CHARDEV(major,minor) \ 432#define MODULE_ALIAS_CHARDEV(major,minor) \
diff --git a/include/linux/dio.h b/include/linux/dio.h
index fae9395fcf4f..1e65ebc2a3db 100644
--- a/include/linux/dio.h
+++ b/include/linux/dio.h
@@ -276,37 +276,5 @@ static inline void dio_set_drvdata (struct dio_dev *d, void *data)
276 dev_set_drvdata(&d->dev, data); 276 dev_set_drvdata(&d->dev, data);
277} 277}
278 278
279/*
280 * A helper function which helps ensure correct dio_driver
281 * setup and cleanup for commonly-encountered hotplug/modular cases
282 *
283 * This MUST stay in a header, as it checks for -DMODULE
284 */
285static inline int dio_module_init(struct dio_driver *drv)
286{
287 int rc = dio_register_driver(drv);
288
289 if (rc > 0)
290 return 0;
291
292 /* iff CONFIG_HOTPLUG and built into kernel, we should
293 * leave the driver around for future hotplug events.
294 * For the module case, a hotplug daemon of some sort
295 * should load a module in response to an insert event. */
296#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
297 if (rc == 0)
298 return 0;
299#else
300 if (rc == 0)
301 rc = -ENODEV;
302#endif
303
304 /* if we get here, we need to clean up DIO driver instance
305 * and return some sort of error */
306 dio_unregister_driver(drv);
307
308 return rc;
309}
310
311#endif /* __KERNEL__ */ 279#endif /* __KERNEL__ */
312#endif /* ndef _LINUX_DIO_H */ 280#endif /* ndef _LINUX_DIO_H */
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index fa75ba0d635e..c67c6786612a 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -80,6 +80,16 @@
80 * 80 *
81 * DM_TARGET_MSG: 81 * DM_TARGET_MSG:
82 * Pass a message string to the target at a specific offset of a device. 82 * Pass a message string to the target at a specific offset of a device.
83 *
84 * DM_DEV_SET_GEOMETRY:
85 * Set the geometry of a device by passing in a string in this format:
86 *
87 * "cylinders heads sectors_per_track start_sector"
88 *
89 * Beware that CHS geometry is nearly obsolete and only provided
90 * for compatibility with dm devices that can be booted by a PC
91 * BIOS. See struct hd_geometry for range limits. Also note that
92 * the geometry is erased if the device size changes.
83 */ 93 */
84 94
85/* 95/*
@@ -218,6 +228,7 @@ enum {
218 /* Added later */ 228 /* Added later */
219 DM_LIST_VERSIONS_CMD, 229 DM_LIST_VERSIONS_CMD,
220 DM_TARGET_MSG_CMD, 230 DM_TARGET_MSG_CMD,
231 DM_DEV_SET_GEOMETRY_CMD
221}; 232};
222 233
223/* 234/*
@@ -247,6 +258,7 @@ typedef char ioctl_struct[308];
247#define DM_TABLE_STATUS_32 _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, ioctl_struct) 258#define DM_TABLE_STATUS_32 _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, ioctl_struct)
248#define DM_LIST_VERSIONS_32 _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, ioctl_struct) 259#define DM_LIST_VERSIONS_32 _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, ioctl_struct)
249#define DM_TARGET_MSG_32 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, ioctl_struct) 260#define DM_TARGET_MSG_32 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, ioctl_struct)
261#define DM_DEV_SET_GEOMETRY_32 _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, ioctl_struct)
250#endif 262#endif
251 263
252#define DM_IOCTL 0xfd 264#define DM_IOCTL 0xfd
@@ -270,11 +282,12 @@ typedef char ioctl_struct[308];
270#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl) 282#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl)
271 283
272#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) 284#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
285#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
273 286
274#define DM_VERSION_MAJOR 4 287#define DM_VERSION_MAJOR 4
275#define DM_VERSION_MINOR 5 288#define DM_VERSION_MINOR 6
276#define DM_VERSION_PATCHLEVEL 0 289#define DM_VERSION_PATCHLEVEL 0
277#define DM_VERSION_EXTRA "-ioctl (2005-10-04)" 290#define DM_VERSION_EXTRA "-ioctl (2006-02-17)"
278 291
279/* Status bits */ 292/* Status bits */
280#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 293#define DM_READONLY_FLAG (1 << 0) /* In/Out */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 2d80cc761a15..9b4751aecc23 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -20,6 +20,8 @@ enum dma_data_direction {
20#define DMA_31BIT_MASK 0x000000007fffffffULL 20#define DMA_31BIT_MASK 0x000000007fffffffULL
21#define DMA_30BIT_MASK 0x000000003fffffffULL 21#define DMA_30BIT_MASK 0x000000003fffffffULL
22#define DMA_29BIT_MASK 0x000000001fffffffULL 22#define DMA_29BIT_MASK 0x000000001fffffffULL
23#define DMA_28BIT_MASK 0x000000000fffffffULL
24#define DMA_24BIT_MASK 0x0000000000ffffffULL
23 25
24#include <asm/dma-mapping.h> 26#include <asm/dma-mapping.h>
25 27
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 2e6bbe014157..64fd6c366604 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -68,6 +68,7 @@ extern char * dmi_get_system_info(int field);
68extern struct dmi_device * dmi_find_device(int type, const char *name, 68extern struct dmi_device * dmi_find_device(int type, const char *name,
69 struct dmi_device *from); 69 struct dmi_device *from);
70extern void dmi_scan_machine(void); 70extern void dmi_scan_machine(void);
71extern int dmi_get_year(int field);
71 72
72#else 73#else
73 74
@@ -75,6 +76,7 @@ static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
75static inline char * dmi_get_system_info(int field) { return NULL; } 76static inline char * dmi_get_system_info(int field) { return NULL; }
76static inline struct dmi_device * dmi_find_device(int type, const char *name, 77static inline struct dmi_device * dmi_find_device(int type, const char *name,
77 struct dmi_device *from) { return NULL; } 78 struct dmi_device *from) { return NULL; }
79static inline int dmi_get_year(int year) { return 0; }
78 80
79#endif 81#endif
80 82
diff --git a/include/linux/dn.h b/include/linux/dn.h
index 782cae49e64c..10b6a6fd5837 100644
--- a/include/linux/dn.h
+++ b/include/linux/dn.h
@@ -71,17 +71,17 @@
71 71
72struct dn_naddr 72struct dn_naddr
73{ 73{
74 unsigned short a_len; 74 __le16 a_len;
75 unsigned char a_addr[DN_MAXADDL]; 75 __u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */
76}; 76};
77 77
78struct sockaddr_dn 78struct sockaddr_dn
79{ 79{
80 unsigned short sdn_family; 80 __u16 sdn_family;
81 unsigned char sdn_flags; 81 __u8 sdn_flags;
82 unsigned char sdn_objnum; 82 __u8 sdn_objnum;
83 unsigned short sdn_objnamel; 83 __le16 sdn_objnamel;
84 unsigned char sdn_objname[DN_MAXOBJL]; 84 __u8 sdn_objname[DN_MAXOBJL];
85 struct dn_naddr sdn_add; 85 struct dn_naddr sdn_add;
86}; 86};
87#define sdn_nodeaddrl sdn_add.a_len /* Node address length */ 87#define sdn_nodeaddrl sdn_add.a_len /* Node address length */
@@ -93,38 +93,38 @@ struct sockaddr_dn
93 * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure 93 * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure
94 */ 94 */
95struct optdata_dn { 95struct optdata_dn {
96 unsigned short opt_status; /* Extended status return */ 96 __le16 opt_status; /* Extended status return */
97#define opt_sts opt_status 97#define opt_sts opt_status
98 unsigned short opt_optl; /* Length of user data */ 98 __le16 opt_optl; /* Length of user data */
99 unsigned char opt_data[16]; /* User data */ 99 __u8 opt_data[16]; /* User data */
100}; 100};
101 101
102struct accessdata_dn 102struct accessdata_dn
103{ 103{
104 unsigned char acc_accl; 104 __u8 acc_accl;
105 unsigned char acc_acc[DN_MAXACCL]; 105 __u8 acc_acc[DN_MAXACCL];
106 unsigned char acc_passl; 106 __u8 acc_passl;
107 unsigned char acc_pass[DN_MAXACCL]; 107 __u8 acc_pass[DN_MAXACCL];
108 unsigned char acc_userl; 108 __u8 acc_userl;
109 unsigned char acc_user[DN_MAXACCL]; 109 __u8 acc_user[DN_MAXACCL];
110}; 110};
111 111
112/* 112/*
113 * DECnet logical link information structure 113 * DECnet logical link information structure
114 */ 114 */
115struct linkinfo_dn { 115struct linkinfo_dn {
116 unsigned short idn_segsize; /* Segment size for link */ 116 __le16 idn_segsize; /* Segment size for link */
117 unsigned char idn_linkstate; /* Logical link state */ 117 __u8 idn_linkstate; /* Logical link state */
118}; 118};
119 119
120/* 120/*
121 * Ethernet address format (for DECnet) 121 * Ethernet address format (for DECnet)
122 */ 122 */
123union etheraddress { 123union etheraddress {
124 unsigned char dne_addr[6]; /* Full ethernet address */ 124 __u8 dne_addr[6]; /* Full ethernet address */
125 struct { 125 struct {
126 unsigned char dne_hiord[4]; /* DECnet HIORD prefix */ 126 __u8 dne_hiord[4]; /* DECnet HIORD prefix */
127 unsigned char dne_nodeaddr[2]; /* DECnet node address */ 127 __u8 dne_nodeaddr[2]; /* DECnet node address */
128 } dne_remote; 128 } dne_remote;
129}; 129};
130 130
@@ -133,7 +133,7 @@ union etheraddress {
133 * DECnet physical socket address format 133 * DECnet physical socket address format
134 */ 134 */
135struct dn_addr { 135struct dn_addr {
136 unsigned short dna_family; /* AF_DECnet */ 136 __le16 dna_family; /* AF_DECnet */
137 union etheraddress dna_netaddr; /* DECnet ethernet address */ 137 union etheraddress dna_netaddr; /* DECnet ethernet address */
138}; 138};
139 139
diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h
index 2b8797084685..0874a67c6b92 100644
--- a/include/linux/dvb/audio.h
+++ b/include/linux/dvb/audio.h
@@ -121,4 +121,17 @@ typedef uint16_t audio_attributes_t;
121#define AUDIO_SET_ATTRIBUTES _IOW('o', 17, audio_attributes_t) 121#define AUDIO_SET_ATTRIBUTES _IOW('o', 17, audio_attributes_t)
122#define AUDIO_SET_KARAOKE _IOW('o', 18, audio_karaoke_t) 122#define AUDIO_SET_KARAOKE _IOW('o', 18, audio_karaoke_t)
123 123
124/**
125 * AUDIO_GET_PTS
126 *
127 * Read the 33 bit presentation time stamp as defined
128 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
129 *
130 * The PTS should belong to the currently played
131 * frame if possible, but may also be a value close to it
132 * like the PTS of the last decoded frame or the last PTS
133 * extracted by the PES parser.
134 */
135#define AUDIO_GET_PTS _IOR('o', 19, __u64)
136
124#endif /* _DVBAUDIO_H_ */ 137#endif /* _DVBAUDIO_H_ */
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index b81e58b2ebf8..faebfda397ff 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -200,4 +200,17 @@ typedef uint16_t video_attributes_t;
200#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t) 200#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
201#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int) 201#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
202 202
203/**
204 * VIDEO_GET_PTS
205 *
206 * Read the 33 bit presentation time stamp as defined
207 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
208 *
209 * The PTS should belong to the currently played
210 * frame if possible, but may also be a value close to it
211 * like the PTS of the last decoded frame or the last PTS
212 * extracted by the PES parser.
213 */
214#define VIDEO_GET_PTS _IOR('o', 57, __u64)
215
203#endif /*_DVBVIDEO_H_*/ 216#endif /*_DVBVIDEO_H_*/
diff --git a/include/linux/efi.h b/include/linux/efi.h
index c7c5dd316182..e203613d3aec 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -240,19 +240,21 @@ struct efi_memory_map {
240 unsigned long desc_size; 240 unsigned long desc_size;
241}; 241};
242 242
243#define EFI_INVALID_TABLE_ADDR (~0UL)
244
243/* 245/*
244 * All runtime access to EFI goes through this structure: 246 * All runtime access to EFI goes through this structure:
245 */ 247 */
246extern struct efi { 248extern struct efi {
247 efi_system_table_t *systab; /* EFI system table */ 249 efi_system_table_t *systab; /* EFI system table */
248 void *mps; /* MPS table */ 250 unsigned long mps; /* MPS table */
249 void *acpi; /* ACPI table (IA64 ext 0.71) */ 251 unsigned long acpi; /* ACPI table (IA64 ext 0.71) */
250 void *acpi20; /* ACPI table (ACPI 2.0) */ 252 unsigned long acpi20; /* ACPI table (ACPI 2.0) */
251 void *smbios; /* SM BIOS table */ 253 unsigned long smbios; /* SM BIOS table */
252 void *sal_systab; /* SAL system table */ 254 unsigned long sal_systab; /* SAL system table */
253 void *boot_info; /* boot info table */ 255 unsigned long boot_info; /* boot info table */
254 void *hcdp; /* HCDP table */ 256 unsigned long hcdp; /* HCDP table */
255 void *uga; /* UGA table */ 257 unsigned long uga; /* UGA table */
256 efi_get_time_t *get_time; 258 efi_get_time_t *get_time;
257 efi_set_time_t *set_time; 259 efi_set_time_t *set_time;
258 efi_get_wakeup_time_t *get_wakeup_time; 260 efi_get_wakeup_time_t *get_wakeup_time;
@@ -292,6 +294,8 @@ extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if pos
292extern u64 efi_get_iobase (void); 294extern u64 efi_get_iobase (void);
293extern u32 efi_mem_type (unsigned long phys_addr); 295extern u32 efi_mem_type (unsigned long phys_addr);
294extern u64 efi_mem_attributes (unsigned long phys_addr); 296extern u64 efi_mem_attributes (unsigned long phys_addr);
297extern int efi_mem_attribute_range (unsigned long phys_addr, unsigned long size,
298 u64 attr);
295extern int __init efi_uart_console_only (void); 299extern int __init efi_uart_console_only (void);
296extern void efi_initialize_iomem_resources(struct resource *code_resource, 300extern void efi_initialize_iomem_resources(struct resource *code_resource,
297 struct resource *data_resource); 301 struct resource *data_resource);
diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h
index 28f368c526fb..fbfa6b52e2fb 100644
--- a/include/linux/efs_fs.h
+++ b/include/linux/efs_fs.h
@@ -37,7 +37,7 @@ static inline struct efs_sb_info *SUPER_INFO(struct super_block *sb)
37struct statfs; 37struct statfs;
38 38
39extern struct inode_operations efs_dir_inode_operations; 39extern struct inode_operations efs_dir_inode_operations;
40extern struct file_operations efs_dir_operations; 40extern const struct file_operations efs_dir_operations;
41extern struct address_space_operations efs_symlink_aops; 41extern struct address_space_operations efs_symlink_aops;
42 42
43extern void efs_read_inode(struct inode *); 43extern void efs_read_inode(struct inode *);
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 18cf1f3e1184..ad133fcfb239 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -48,10 +48,17 @@ struct elevator_ops
48 48
49 elevator_init_fn *elevator_init_fn; 49 elevator_init_fn *elevator_init_fn;
50 elevator_exit_fn *elevator_exit_fn; 50 elevator_exit_fn *elevator_exit_fn;
51 void (*trim)(struct io_context *);
51}; 52};
52 53
53#define ELV_NAME_MAX (16) 54#define ELV_NAME_MAX (16)
54 55
56struct elv_fs_entry {
57 struct attribute attr;
58 ssize_t (*show)(elevator_t *, char *);
59 ssize_t (*store)(elevator_t *, const char *, size_t);
60};
61
55/* 62/*
56 * identifies an elevator type, such as AS or deadline 63 * identifies an elevator type, such as AS or deadline
57 */ 64 */
@@ -60,7 +67,7 @@ struct elevator_type
60 struct list_head list; 67 struct list_head list;
61 struct elevator_ops ops; 68 struct elevator_ops ops;
62 struct elevator_type *elevator_type; 69 struct elevator_type *elevator_type;
63 struct kobj_type *elevator_ktype; 70 struct elv_fs_entry *elevator_attrs;
64 char elevator_name[ELV_NAME_MAX]; 71 char elevator_name[ELV_NAME_MAX];
65 struct module *elevator_owner; 72 struct module *elevator_owner;
66}; 73};
@@ -74,6 +81,7 @@ struct elevator_queue
74 void *elevator_data; 81 void *elevator_data;
75 struct kobject kobj; 82 struct kobject kobj;
76 struct elevator_type *elevator_type; 83 struct elevator_type *elevator_type;
84 struct mutex sysfs_lock;
77}; 85};
78 86
79/* 87/*
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 1289f0ec4c00..1e4bdfcf83a2 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -52,7 +52,12 @@ struct file;
52#ifdef CONFIG_EPOLL 52#ifdef CONFIG_EPOLL
53 53
54/* Used to initialize the epoll bits inside the "struct file" */ 54/* Used to initialize the epoll bits inside the "struct file" */
55void eventpoll_init_file(struct file *file); 55static inline void eventpoll_init_file(struct file *file)
56{
57 INIT_LIST_HEAD(&file->f_ep_links);
58 spin_lock_init(&file->f_ep_lock);
59}
60
56 61
57/* Used to release the epoll bits inside the "struct file" */ 62/* Used to release the epoll bits inside the "struct file" */
58void eventpoll_release_file(struct file *file); 63void eventpoll_release_file(struct file *file);
@@ -85,7 +90,6 @@ static inline void eventpoll_release(struct file *file)
85 eventpoll_release_file(file); 90 eventpoll_release_file(file);
86} 91}
87 92
88
89#else 93#else
90 94
91static inline void eventpoll_init_file(struct file *file) {} 95static inline void eventpoll_init_file(struct file *file) {}
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index c0272d73ab20..3ade6a4e3bdd 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -36,7 +36,8 @@ struct statfs;
36 * Define EXT3_RESERVATION to reserve data blocks for expanding files 36 * Define EXT3_RESERVATION to reserve data blocks for expanding files
37 */ 37 */
38#define EXT3_DEFAULT_RESERVE_BLOCKS 8 38#define EXT3_DEFAULT_RESERVE_BLOCKS 8
39#define EXT3_MAX_RESERVE_BLOCKS 1024 39/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
40#define EXT3_MAX_RESERVE_BLOCKS 1027
40#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0 41#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
41/* 42/*
42 * Always enable hashed directories 43 * Always enable hashed directories
@@ -732,6 +733,8 @@ struct dir_private_info {
732extern int ext3_bg_has_super(struct super_block *sb, int group); 733extern int ext3_bg_has_super(struct super_block *sb, int group);
733extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group); 734extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group);
734extern int ext3_new_block (handle_t *, struct inode *, unsigned long, int *); 735extern int ext3_new_block (handle_t *, struct inode *, unsigned long, int *);
736extern int ext3_new_blocks (handle_t *, struct inode *, unsigned long,
737 unsigned long *, int *);
735extern void ext3_free_blocks (handle_t *, struct inode *, unsigned long, 738extern void ext3_free_blocks (handle_t *, struct inode *, unsigned long,
736 unsigned long); 739 unsigned long);
737extern void ext3_free_blocks_sb (handle_t *, struct super_block *, 740extern void ext3_free_blocks_sb (handle_t *, struct super_block *,
@@ -772,9 +775,12 @@ extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
772 775
773 776
774/* inode.c */ 777/* inode.c */
775extern int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int); 778int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int);
776extern struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *); 779struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
777extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *); 780struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
781int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
782 sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result,
783 int create, int extend_disksize);
778 784
779extern void ext3_read_inode (struct inode *); 785extern void ext3_read_inode (struct inode *);
780extern int ext3_write_inode (struct inode *, int); 786extern int ext3_write_inode (struct inode *, int);
@@ -827,11 +833,11 @@ do { \
827 */ 833 */
828 834
829/* dir.c */ 835/* dir.c */
830extern struct file_operations ext3_dir_operations; 836extern const struct file_operations ext3_dir_operations;
831 837
832/* file.c */ 838/* file.c */
833extern struct inode_operations ext3_file_inode_operations; 839extern struct inode_operations ext3_file_inode_operations;
834extern struct file_operations ext3_file_operations; 840extern const struct file_operations ext3_file_operations;
835 841
836/* namei.c */ 842/* namei.c */
837extern struct inode_operations ext3_dir_inode_operations; 843extern struct inode_operations ext3_dir_inode_operations;
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index e71dd98dbcae..7abf90147180 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -19,6 +19,7 @@
19#include <linux/rwsem.h> 19#include <linux/rwsem.h>
20#include <linux/rbtree.h> 20#include <linux/rbtree.h>
21#include <linux/seqlock.h> 21#include <linux/seqlock.h>
22#include <linux/mutex.h>
22 23
23struct ext3_reserve_window { 24struct ext3_reserve_window {
24 __u32 _rsv_start; /* First byte reserved */ 25 __u32 _rsv_start; /* First byte reserved */
@@ -122,16 +123,16 @@ struct ext3_inode_info {
122 __u16 i_extra_isize; 123 __u16 i_extra_isize;
123 124
124 /* 125 /*
125 * truncate_sem is for serialising ext3_truncate() against 126 * truncate_mutex is for serialising ext3_truncate() against
126 * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's 127 * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's
127 * data tree are chopped off during truncate. We can't do that in 128 * data tree are chopped off during truncate. We can't do that in
128 * ext3 because whenever we perform intermediate commits during 129 * ext3 because whenever we perform intermediate commits during
129 * truncate, the inode and all the metadata blocks *must* be in a 130 * truncate, the inode and all the metadata blocks *must* be in a
130 * consistent state which allows truncation of the orphans to restart 131 * consistent state which allows truncation of the orphans to restart
131 * during recovery. Hence we must fix the get_block-vs-truncate race 132 * during recovery. Hence we must fix the get_block-vs-truncate race
132 * by other means, so we have truncate_sem. 133 * by other means, so we have truncate_mutex.
133 */ 134 */
134 struct semaphore truncate_sem; 135 struct mutex truncate_mutex;
135 struct inode vfs_inode; 136 struct inode vfs_inode;
136}; 137};
137 138
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 2cb19e6503aa..315d89740ddf 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -734,7 +734,7 @@ struct fb_tile_ops {
734 734
735/* A driver may set this flag to indicate that it does want a set_par to be 735/* A driver may set this flag to indicate that it does want a set_par to be
736 * called every time when fbcon_switch is executed. The advantage is that with 736 * called every time when fbcon_switch is executed. The advantage is that with
737 * this flag set you can really be shure that set_par is always called before 737 * this flag set you can really be sure that set_par is always called before
738 * any of the functions dependant on the correct hardware state or altering 738 * any of the functions dependant on the correct hardware state or altering
739 * that state, even if you are using some broken X releases. The disadvantage 739 * that state, even if you are using some broken X releases. The disadvantage
740 * is that it introduces unwanted delays to every console switch if set_par 740 * is that it introduces unwanted delays to every console switch if set_par
@@ -839,12 +839,10 @@ struct fb_info {
839#define FB_LEFT_POS(bpp) (32 - bpp) 839#define FB_LEFT_POS(bpp) (32 - bpp)
840#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits)) 840#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits))
841#define FB_SHIFT_LOW(val, bits) ((val) << (bits)) 841#define FB_SHIFT_LOW(val, bits) ((val) << (bits))
842#define FB_BIT_NR(b) (7 - (b))
843#else 842#else
844#define FB_LEFT_POS(bpp) (0) 843#define FB_LEFT_POS(bpp) (0)
845#define FB_SHIFT_HIGH(val, bits) ((val) << (bits)) 844#define FB_SHIFT_HIGH(val, bits) ((val) << (bits))
846#define FB_SHIFT_LOW(val, bits) ((val) >> (bits)) 845#define FB_SHIFT_LOW(val, bits) ((val) >> (bits))
847#define FB_BIT_NR(b) (b)
848#endif 846#endif
849 847
850 /* 848 /*
diff --git a/include/linux/file.h b/include/linux/file.h
index 9901b850f2e4..9f7c2513866f 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -10,6 +10,7 @@
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13#include <linux/types.h>
13 14
14/* 15/*
15 * The default fd array needs to be at least BITS_PER_LONG, 16 * The default fd array needs to be at least BITS_PER_LONG,
@@ -17,10 +18,22 @@
17 */ 18 */
18#define NR_OPEN_DEFAULT BITS_PER_LONG 19#define NR_OPEN_DEFAULT BITS_PER_LONG
19 20
21/*
22 * The embedded_fd_set is a small fd_set,
23 * suitable for most tasks (which open <= BITS_PER_LONG files)
24 */
25struct embedded_fd_set {
26 unsigned long fds_bits[1];
27};
28
29/*
30 * More than this number of fds: we use a separately allocated fd_set
31 */
32#define EMBEDDED_FD_SET_SIZE (BITS_PER_BYTE * sizeof(struct embedded_fd_set))
33
20struct fdtable { 34struct fdtable {
21 unsigned int max_fds; 35 unsigned int max_fds;
22 int max_fdset; 36 int max_fdset;
23 int next_fd;
24 struct file ** fd; /* current fd array */ 37 struct file ** fd; /* current fd array */
25 fd_set *close_on_exec; 38 fd_set *close_on_exec;
26 fd_set *open_fds; 39 fd_set *open_fds;
@@ -33,13 +46,20 @@ struct fdtable {
33 * Open file table structure 46 * Open file table structure
34 */ 47 */
35struct files_struct { 48struct files_struct {
49 /*
50 * read mostly part
51 */
36 atomic_t count; 52 atomic_t count;
37 struct fdtable *fdt; 53 struct fdtable *fdt;
38 struct fdtable fdtab; 54 struct fdtable fdtab;
39 fd_set close_on_exec_init; 55 /*
40 fd_set open_fds_init; 56 * written part on a separate cache line in SMP
57 */
58 spinlock_t file_lock ____cacheline_aligned_in_smp;
59 int next_fd;
60 struct embedded_fd_set close_on_exec_init;
61 struct embedded_fd_set open_fds_init;
41 struct file * fd_array[NR_OPEN_DEFAULT]; 62 struct file * fd_array[NR_OPEN_DEFAULT];
42 spinlock_t file_lock; /* Protects concurrent writers. Nests inside tsk->alloc_lock */
43}; 63};
44 64
45#define files_fdtable(files) (rcu_dereference((files)->fdt)) 65#define files_fdtable(files) (rcu_dereference((files)->fdt))
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 128d0082522c..4ed7e602d703 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -65,6 +65,11 @@ extern int dir_notify_enable;
65#define FMODE_PREAD 8 65#define FMODE_PREAD 8
66#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ 66#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */
67 67
68/* File is being opened for execution. Primary users of this flag are
69 distributed filesystems that can use it to achieve correct ETXTBUSY
70 behavior for cross-node execution/opening_for_writing of files */
71#define FMODE_EXEC 16
72
68#define RW_MASK 1 73#define RW_MASK 1
69#define RWA_MASK 2 74#define RWA_MASK 2
70#define READ 0 75#define READ 0
@@ -103,7 +108,9 @@ extern int dir_notify_enable;
103#define MS_BIND 4096 108#define MS_BIND 4096
104#define MS_MOVE 8192 109#define MS_MOVE 8192
105#define MS_REC 16384 110#define MS_REC 16384
106#define MS_VERBOSE 32768 111#define MS_VERBOSE 32768 /* War is peace. Verbosity is silence.
112 MS_VERBOSE is deprecated. */
113#define MS_SILENT 32768
107#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ 114#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
108#define MS_UNBINDABLE (1<<17) /* change to unbindable */ 115#define MS_UNBINDABLE (1<<17) /* change to unbindable */
109#define MS_PRIVATE (1<<18) /* change to private */ 116#define MS_PRIVATE (1<<18) /* change to private */
@@ -197,6 +204,10 @@ extern int dir_notify_enable;
197#define BLKBSZGET _IOR(0x12,112,size_t) 204#define BLKBSZGET _IOR(0x12,112,size_t)
198#define BLKBSZSET _IOW(0x12,113,size_t) 205#define BLKBSZSET _IOW(0x12,113,size_t)
199#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */ 206#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
207#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
208#define BLKTRACESTART _IO(0x12,116)
209#define BLKTRACESTOP _IO(0x12,117)
210#define BLKTRACETEARDOWN _IO(0x12,118)
200 211
201#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 212#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
202#define FIBMAP _IO(0x00,1) /* bmap access */ 213#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -241,9 +252,6 @@ extern void __init files_init(unsigned long);
241struct buffer_head; 252struct buffer_head;
242typedef int (get_block_t)(struct inode *inode, sector_t iblock, 253typedef int (get_block_t)(struct inode *inode, sector_t iblock,
243 struct buffer_head *bh_result, int create); 254 struct buffer_head *bh_result, int create);
244typedef int (get_blocks_t)(struct inode *inode, sector_t iblock,
245 unsigned long max_blocks,
246 struct buffer_head *bh_result, int create);
247typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, 255typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
248 ssize_t bytes, void *private); 256 ssize_t bytes, void *private);
249 257
@@ -339,12 +347,12 @@ struct writeback_control;
339struct address_space_operations { 347struct address_space_operations {
340 int (*writepage)(struct page *page, struct writeback_control *wbc); 348 int (*writepage)(struct page *page, struct writeback_control *wbc);
341 int (*readpage)(struct file *, struct page *); 349 int (*readpage)(struct file *, struct page *);
342 int (*sync_page)(struct page *); 350 void (*sync_page)(struct page *);
343 351
344 /* Write back some dirty pages from this mapping. */ 352 /* Write back some dirty pages from this mapping. */
345 int (*writepages)(struct address_space *, struct writeback_control *); 353 int (*writepages)(struct address_space *, struct writeback_control *);
346 354
347 /* Set a page dirty */ 355 /* Set a page dirty. Return true if this dirtied it */
348 int (*set_page_dirty)(struct page *page); 356 int (*set_page_dirty)(struct page *page);
349 357
350 int (*readpages)(struct file *filp, struct address_space *mapping, 358 int (*readpages)(struct file *filp, struct address_space *mapping,
@@ -358,7 +366,7 @@ struct address_space_operations {
358 int (*commit_write)(struct file *, struct page *, unsigned, unsigned); 366 int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
359 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ 367 /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
360 sector_t (*bmap)(struct address_space *, sector_t); 368 sector_t (*bmap)(struct address_space *, sector_t);
361 int (*invalidatepage) (struct page *, unsigned long); 369 void (*invalidatepage) (struct page *, unsigned long);
362 int (*releasepage) (struct page *, gfp_t); 370 int (*releasepage) (struct page *, gfp_t);
363 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 371 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
364 loff_t offset, unsigned long nr_segs); 372 loff_t offset, unsigned long nr_segs);
@@ -397,11 +405,14 @@ struct block_device {
397 dev_t bd_dev; /* not a kdev_t - it's a search key */ 405 dev_t bd_dev; /* not a kdev_t - it's a search key */
398 struct inode * bd_inode; /* will die */ 406 struct inode * bd_inode; /* will die */
399 int bd_openers; 407 int bd_openers;
400 struct semaphore bd_sem; /* open/close mutex */ 408 struct mutex bd_mutex; /* open/close mutex */
401 struct semaphore bd_mount_sem; /* mount mutex */ 409 struct mutex bd_mount_mutex; /* mount mutex */
402 struct list_head bd_inodes; 410 struct list_head bd_inodes;
403 void * bd_holder; 411 void * bd_holder;
404 int bd_holders; 412 int bd_holders;
413#ifdef CONFIG_SYSFS
414 struct list_head bd_holder_list;
415#endif
405 struct block_device * bd_contains; 416 struct block_device * bd_contains;
406 unsigned bd_block_size; 417 unsigned bd_block_size;
407 struct hd_struct * bd_part; 418 struct hd_struct * bd_part;
@@ -479,13 +490,13 @@ struct inode {
479 unsigned int i_blkbits; 490 unsigned int i_blkbits;
480 unsigned long i_blksize; 491 unsigned long i_blksize;
481 unsigned long i_version; 492 unsigned long i_version;
482 unsigned long i_blocks; 493 blkcnt_t i_blocks;
483 unsigned short i_bytes; 494 unsigned short i_bytes;
484 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 495 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
485 struct mutex i_mutex; 496 struct mutex i_mutex;
486 struct rw_semaphore i_alloc_sem; 497 struct rw_semaphore i_alloc_sem;
487 struct inode_operations *i_op; 498 struct inode_operations *i_op;
488 struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 499 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
489 struct super_block *i_sb; 500 struct super_block *i_sb;
490 struct file_lock *i_flock; 501 struct file_lock *i_flock;
491 struct address_space *i_mapping; 502 struct address_space *i_mapping;
@@ -509,7 +520,7 @@ struct inode {
509 520
510#ifdef CONFIG_INOTIFY 521#ifdef CONFIG_INOTIFY
511 struct list_head inotify_watches; /* watches on this inode */ 522 struct list_head inotify_watches; /* watches on this inode */
512 struct semaphore inotify_sem; /* protects the watches list */ 523 struct mutex inotify_mutex; /* protects the watches list */
513#endif 524#endif
514 525
515 unsigned long i_state; 526 unsigned long i_state;
@@ -625,7 +636,7 @@ struct file {
625 } f_u; 636 } f_u;
626 struct dentry *f_dentry; 637 struct dentry *f_dentry;
627 struct vfsmount *f_vfsmnt; 638 struct vfsmount *f_vfsmnt;
628 struct file_operations *f_op; 639 const struct file_operations *f_op;
629 atomic_t f_count; 640 atomic_t f_count;
630 unsigned int f_flags; 641 unsigned int f_flags;
631 mode_t f_mode; 642 mode_t f_mode;
@@ -667,7 +678,6 @@ extern spinlock_t files_lock;
667#define FL_POSIX 1 678#define FL_POSIX 1
668#define FL_FLOCK 2 679#define FL_FLOCK 2
669#define FL_ACCESS 8 /* not trying to lock, just looking */ 680#define FL_ACCESS 8 /* not trying to lock, just looking */
670#define FL_LOCKD 16 /* lock held by rpc.lockd */
671#define FL_LEASE 32 /* lease held on this file */ 681#define FL_LEASE 32 /* lease held on this file */
672#define FL_SLEEP 128 /* A blocking lock */ 682#define FL_SLEEP 128 /* A blocking lock */
673 683
@@ -731,8 +741,6 @@ struct file_lock {
731#define OFFT_OFFSET_MAX INT_LIMIT(off_t) 741#define OFFT_OFFSET_MAX INT_LIMIT(off_t)
732#endif 742#endif
733 743
734extern struct list_head file_lock_list;
735
736#include <linux/fcntl.h> 744#include <linux/fcntl.h>
737 745
738extern int fcntl_getlk(struct file *, struct flock __user *); 746extern int fcntl_getlk(struct file *, struct flock __user *);
@@ -749,15 +757,22 @@ extern void send_sigio(struct fown_struct *fown, int fd, int band);
749extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); 757extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
750extern int fcntl_getlease(struct file *filp); 758extern int fcntl_getlease(struct file *filp);
751 759
760/* fs/sync.c */
761#define SYNC_FILE_RANGE_WAIT_BEFORE 1
762#define SYNC_FILE_RANGE_WRITE 2
763#define SYNC_FILE_RANGE_WAIT_AFTER 4
764extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte,
765 int flags);
766
752/* fs/locks.c */ 767/* fs/locks.c */
753extern void locks_init_lock(struct file_lock *); 768extern void locks_init_lock(struct file_lock *);
754extern void locks_copy_lock(struct file_lock *, struct file_lock *); 769extern void locks_copy_lock(struct file_lock *, struct file_lock *);
755extern void locks_remove_posix(struct file *, fl_owner_t); 770extern void locks_remove_posix(struct file *, fl_owner_t);
756extern void locks_remove_flock(struct file *); 771extern void locks_remove_flock(struct file *);
757extern struct file_lock *posix_test_lock(struct file *, struct file_lock *); 772extern int posix_test_lock(struct file *, struct file_lock *, struct file_lock *);
773extern int posix_lock_file_conf(struct file *, struct file_lock *, struct file_lock *);
758extern int posix_lock_file(struct file *, struct file_lock *); 774extern int posix_lock_file(struct file *, struct file_lock *);
759extern int posix_lock_file_wait(struct file *, struct file_lock *); 775extern int posix_lock_file_wait(struct file *, struct file_lock *);
760extern void posix_block_lock(struct file_lock *, struct file_lock *);
761extern int posix_unblock_lock(struct file *, struct file_lock *); 776extern int posix_unblock_lock(struct file *, struct file_lock *);
762extern int posix_locks_deadlock(struct file_lock *, struct file_lock *); 777extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
763extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 778extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
@@ -847,7 +862,7 @@ struct super_block {
847 * The next field is for VFS *only*. No filesystems have any business 862 * The next field is for VFS *only*. No filesystems have any business
848 * even looking at it. You had been warned. 863 * even looking at it. You had been warned.
849 */ 864 */
850 struct semaphore s_vfs_rename_sem; /* Kludge */ 865 struct mutex s_vfs_rename_mutex; /* Kludge */
851 866
852 /* Granuality of c/m/atime in ns. 867 /* Granuality of c/m/atime in ns.
853 Cannot be worse than a second */ 868 Cannot be worse than a second */
@@ -1024,6 +1039,8 @@ struct file_operations {
1024 int (*check_flags)(int); 1039 int (*check_flags)(int);
1025 int (*dir_notify)(struct file *filp, unsigned long arg); 1040 int (*dir_notify)(struct file *filp, unsigned long arg);
1026 int (*flock) (struct file *, int, struct file_lock *); 1041 int (*flock) (struct file *, int, struct file_lock *);
1042 ssize_t (*splice_write)(struct inode *, struct file *, size_t, unsigned int);
1043 ssize_t (*splice_read)(struct file *, struct inode *, size_t, unsigned int);
1027}; 1044};
1028 1045
1029struct inode_operations { 1046struct inode_operations {
@@ -1086,6 +1103,7 @@ struct super_operations {
1086 void (*umount_begin) (struct super_block *); 1103 void (*umount_begin) (struct super_block *);
1087 1104
1088 int (*show_options)(struct seq_file *, struct vfsmount *); 1105 int (*show_options)(struct seq_file *, struct vfsmount *);
1106 int (*show_stats)(struct seq_file *, struct vfsmount *);
1089 1107
1090 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1108 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1091 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1109 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
@@ -1115,6 +1133,18 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1115 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1133 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1116} 1134}
1117 1135
1136static inline void inode_inc_link_count(struct inode *inode)
1137{
1138 inode->i_nlink++;
1139 mark_inode_dirty(inode);
1140}
1141
1142static inline void inode_dec_link_count(struct inode *inode)
1143{
1144 inode->i_nlink--;
1145 mark_inode_dirty(inode);
1146}
1147
1118extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); 1148extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1119static inline void file_accessed(struct file *file) 1149static inline void file_accessed(struct file *file)
1120{ 1150{
@@ -1369,11 +1399,11 @@ extern void bd_set_size(struct block_device *, loff_t size);
1369extern void bd_forget(struct inode *inode); 1399extern void bd_forget(struct inode *inode);
1370extern void bdput(struct block_device *); 1400extern void bdput(struct block_device *);
1371extern struct block_device *open_by_devnum(dev_t, unsigned); 1401extern struct block_device *open_by_devnum(dev_t, unsigned);
1372extern struct file_operations def_blk_fops; 1402extern const struct file_operations def_blk_fops;
1373extern struct address_space_operations def_blk_aops; 1403extern struct address_space_operations def_blk_aops;
1374extern struct file_operations def_chr_fops; 1404extern const struct file_operations def_chr_fops;
1375extern struct file_operations bad_sock_fops; 1405extern const struct file_operations bad_sock_fops;
1376extern struct file_operations def_fifo_fops; 1406extern const struct file_operations def_fifo_fops;
1377extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 1407extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
1378extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); 1408extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
1379extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1409extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
@@ -1381,34 +1411,34 @@ extern int blkdev_get(struct block_device *, mode_t, unsigned);
1381extern int blkdev_put(struct block_device *); 1411extern int blkdev_put(struct block_device *);
1382extern int bd_claim(struct block_device *, void *); 1412extern int bd_claim(struct block_device *, void *);
1383extern void bd_release(struct block_device *); 1413extern void bd_release(struct block_device *);
1414#ifdef CONFIG_SYSFS
1415extern int bd_claim_by_disk(struct block_device *, void *, struct gendisk *);
1416extern void bd_release_from_disk(struct block_device *, struct gendisk *);
1417#else
1418#define bd_claim_by_disk(bdev, holder, disk) bd_claim(bdev, holder)
1419#define bd_release_from_disk(bdev, disk) bd_release(bdev)
1420#endif
1384 1421
1385/* fs/char_dev.c */ 1422/* fs/char_dev.c */
1423#define CHRDEV_MAJOR_HASH_SIZE 255
1386extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); 1424extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
1387extern int register_chrdev_region(dev_t, unsigned, const char *); 1425extern int register_chrdev_region(dev_t, unsigned, const char *);
1388extern int register_chrdev(unsigned int, const char *, 1426extern int register_chrdev(unsigned int, const char *,
1389 struct file_operations *); 1427 const struct file_operations *);
1390extern int unregister_chrdev(unsigned int, const char *); 1428extern int unregister_chrdev(unsigned int, const char *);
1391extern void unregister_chrdev_region(dev_t, unsigned); 1429extern void unregister_chrdev_region(dev_t, unsigned);
1392extern int chrdev_open(struct inode *, struct file *); 1430extern int chrdev_open(struct inode *, struct file *);
1393extern int get_chrdev_list(char *); 1431extern void chrdev_show(struct seq_file *,off_t);
1394extern void *acquire_chrdev_list(void);
1395extern int count_chrdev_list(void);
1396extern void *get_next_chrdev(void *);
1397extern int get_chrdev_info(void *, int *, char **);
1398extern void release_chrdev_list(void *);
1399 1432
1400/* fs/block_dev.c */ 1433/* fs/block_dev.c */
1434#define BLKDEV_MAJOR_HASH_SIZE 255
1401#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 1435#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
1402extern const char *__bdevname(dev_t, char *buffer); 1436extern const char *__bdevname(dev_t, char *buffer);
1403extern const char *bdevname(struct block_device *bdev, char *buffer); 1437extern const char *bdevname(struct block_device *bdev, char *buffer);
1404extern struct block_device *lookup_bdev(const char *); 1438extern struct block_device *lookup_bdev(const char *);
1405extern struct block_device *open_bdev_excl(const char *, int, void *); 1439extern struct block_device *open_bdev_excl(const char *, int, void *);
1406extern void close_bdev_excl(struct block_device *); 1440extern void close_bdev_excl(struct block_device *);
1407extern void *acquire_blkdev_list(void); 1441extern void blkdev_show(struct seq_file *,off_t);
1408extern int count_blkdev_list(void);
1409extern void *get_next_blkdev(void *);
1410extern int get_blkdev_info(void *, int *, char **);
1411extern void release_blkdev_list(void *);
1412 1442
1413extern void init_special_inode(struct inode *, umode_t, dev_t); 1443extern void init_special_inode(struct inode *, umode_t, dev_t);
1414 1444
@@ -1416,9 +1446,9 @@ extern void init_special_inode(struct inode *, umode_t, dev_t);
1416extern void make_bad_inode(struct inode *); 1446extern void make_bad_inode(struct inode *);
1417extern int is_bad_inode(struct inode *); 1447extern int is_bad_inode(struct inode *);
1418 1448
1419extern struct file_operations read_fifo_fops; 1449extern const struct file_operations read_fifo_fops;
1420extern struct file_operations write_fifo_fops; 1450extern const struct file_operations write_fifo_fops;
1421extern struct file_operations rdwr_fifo_fops; 1451extern const struct file_operations rdwr_fifo_fops;
1422 1452
1423extern int fs_may_remount_ro(struct super_block *); 1453extern int fs_may_remount_ro(struct super_block *);
1424 1454
@@ -1455,6 +1485,12 @@ extern int filemap_fdatawait(struct address_space *);
1455extern int filemap_write_and_wait(struct address_space *mapping); 1485extern int filemap_write_and_wait(struct address_space *mapping);
1456extern int filemap_write_and_wait_range(struct address_space *mapping, 1486extern int filemap_write_and_wait_range(struct address_space *mapping,
1457 loff_t lstart, loff_t lend); 1487 loff_t lstart, loff_t lend);
1488extern int wait_on_page_writeback_range(struct address_space *mapping,
1489 pgoff_t start, pgoff_t end);
1490extern int __filemap_fdatawrite_range(struct address_space *mapping,
1491 loff_t start, loff_t end, int sync_mode);
1492
1493extern long do_fsync(struct file *file, int datasync);
1458extern void sync_supers(void); 1494extern void sync_supers(void);
1459extern void sync_filesystems(int wait); 1495extern void sync_filesystems(int wait);
1460extern void emergency_sync(void); 1496extern void emergency_sync(void);
@@ -1534,7 +1570,6 @@ extern void destroy_inode(struct inode *);
1534extern struct inode *new_inode(struct super_block *); 1570extern struct inode *new_inode(struct super_block *);
1535extern int remove_suid(struct dentry *); 1571extern int remove_suid(struct dentry *);
1536extern void remove_dquot_ref(struct super_block *, int, struct list_head *); 1572extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
1537extern struct semaphore iprune_sem;
1538 1573
1539extern void __insert_inode_hash(struct inode *, unsigned long hashval); 1574extern void __insert_inode_hash(struct inode *, unsigned long hashval);
1540extern void remove_inode_hash(struct inode *); 1575extern void remove_inode_hash(struct inode *);
@@ -1576,6 +1611,8 @@ extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor
1576extern void do_generic_mapping_read(struct address_space *mapping, 1611extern void do_generic_mapping_read(struct address_space *mapping,
1577 struct file_ra_state *, struct file *, 1612 struct file_ra_state *, struct file *,
1578 loff_t *, read_descriptor_t *, read_actor_t); 1613 loff_t *, read_descriptor_t *, read_actor_t);
1614extern ssize_t generic_file_splice_read(struct file *, struct inode *, size_t, unsigned int);
1615extern ssize_t generic_file_splice_write(struct inode *, struct file *, size_t, unsigned int);
1579extern void 1616extern void
1580file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 1617file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
1581extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, 1618extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov,
@@ -1619,7 +1656,7 @@ static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
1619 1656
1620ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 1657ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1621 struct block_device *bdev, const struct iovec *iov, loff_t offset, 1658 struct block_device *bdev, const struct iovec *iov, loff_t offset,
1622 unsigned long nr_segs, get_blocks_t get_blocks, dio_iodone_t end_io, 1659 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
1623 int lock_type); 1660 int lock_type);
1624 1661
1625enum { 1662enum {
@@ -1630,32 +1667,32 @@ enum {
1630 1667
1631static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 1668static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
1632 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 1669 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
1633 loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, 1670 loff_t offset, unsigned long nr_segs, get_block_t get_block,
1634 dio_iodone_t end_io) 1671 dio_iodone_t end_io)
1635{ 1672{
1636 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 1673 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
1637 nr_segs, get_blocks, end_io, DIO_LOCKING); 1674 nr_segs, get_block, end_io, DIO_LOCKING);
1638} 1675}
1639 1676
1640static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, 1677static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
1641 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 1678 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
1642 loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, 1679 loff_t offset, unsigned long nr_segs, get_block_t get_block,
1643 dio_iodone_t end_io) 1680 dio_iodone_t end_io)
1644{ 1681{
1645 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 1682 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
1646 nr_segs, get_blocks, end_io, DIO_NO_LOCKING); 1683 nr_segs, get_block, end_io, DIO_NO_LOCKING);
1647} 1684}
1648 1685
1649static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb, 1686static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb,
1650 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 1687 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
1651 loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks, 1688 loff_t offset, unsigned long nr_segs, get_block_t get_block,
1652 dio_iodone_t end_io) 1689 dio_iodone_t end_io)
1653{ 1690{
1654 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 1691 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
1655 nr_segs, get_blocks, end_io, DIO_OWN_LOCKING); 1692 nr_segs, get_block, end_io, DIO_OWN_LOCKING);
1656} 1693}
1657 1694
1658extern struct file_operations generic_ro_fops; 1695extern const struct file_operations generic_ro_fops;
1659 1696
1660#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) 1697#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
1661 1698
@@ -1711,9 +1748,9 @@ extern int simple_commit_write(struct file *file, struct page *page,
1711 1748
1712extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *); 1749extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *);
1713extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); 1750extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
1714extern struct file_operations simple_dir_operations; 1751extern const struct file_operations simple_dir_operations;
1715extern struct inode_operations simple_dir_inode_operations; 1752extern struct inode_operations simple_dir_inode_operations;
1716struct tree_descr { char *name; struct file_operations *ops; int mode; }; 1753struct tree_descr { char *name; const struct file_operations *ops; int mode; };
1717struct dentry *d_alloc_name(struct dentry *, const char *); 1754struct dentry *d_alloc_name(struct dentry *, const char *);
1718extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 1755extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
1719extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count); 1756extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index a9f1cfd096ff..a3a0e078f79d 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -83,5 +83,32 @@ struct fsl_i2c_platform_data {
83#define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001 83#define FSL_I2C_DEV_SEPARATE_DFSRR 0x00000001
84#define FSL_I2C_DEV_CLOCK_5200 0x00000002 84#define FSL_I2C_DEV_CLOCK_5200 0x00000002
85 85
86
87enum fsl_usb2_operating_modes {
88 FSL_USB2_MPH_HOST,
89 FSL_USB2_DR_HOST,
90 FSL_USB2_DR_DEVICE,
91 FSL_USB2_DR_OTG,
92};
93
94enum fsl_usb2_phy_modes {
95 FSL_USB2_PHY_NONE,
96 FSL_USB2_PHY_ULPI,
97 FSL_USB2_PHY_UTMI,
98 FSL_USB2_PHY_UTMI_WIDE,
99 FSL_USB2_PHY_SERIAL,
100};
101
102struct fsl_usb2_platform_data {
103 /* board specific information */
104 enum fsl_usb2_operating_modes operating_mode;
105 enum fsl_usb2_phy_modes phy_mode;
106 unsigned int port_enables;
107};
108
109/* Flags in fsl_usb2_mph_platform_data */
110#define FSL_USB2_PORT0_ENABLED 0x00000001
111#define FSL_USB2_PORT1_ENABLED 0x00000002
112
86#endif /* _FSL_DEVICE_H_ */ 113#endif /* _FSL_DEVICE_H_ */
87#endif /* __KERNEL__ */ 114#endif /* __KERNEL__ */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 03b8e7932b83..11438eff4d44 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -15,6 +15,26 @@
15 15
16#include <linux/dnotify.h> 16#include <linux/dnotify.h>
17#include <linux/inotify.h> 17#include <linux/inotify.h>
18#include <linux/audit.h>
19
20/*
21 * fsnotify_d_instantiate - instantiate a dentry for inode
22 * Called with dcache_lock held.
23 */
24static inline void fsnotify_d_instantiate(struct dentry *entry,
25 struct inode *inode)
26{
27 inotify_d_instantiate(entry, inode);
28}
29
30/*
31 * fsnotify_d_move - entry has been moved
32 * Called with dcache_lock and entry->d_lock held.
33 */
34static inline void fsnotify_d_move(struct dentry *entry)
35{
36 inotify_d_move(entry);
37}
18 38
19/* 39/*
20 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir 40 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
@@ -45,6 +65,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
45 if (source) { 65 if (source) {
46 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL); 66 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL);
47 } 67 }
68 audit_inode_child(old_name, source, old_dir->i_ino);
69 audit_inode_child(new_name, target, new_dir->i_ino);
48} 70}
49 71
50/* 72/*
@@ -70,19 +92,22 @@ static inline void fsnotify_inoderemove(struct inode *inode)
70/* 92/*
71 * fsnotify_create - 'name' was linked in 93 * fsnotify_create - 'name' was linked in
72 */ 94 */
73static inline void fsnotify_create(struct inode *inode, const char *name) 95static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
74{ 96{
75 inode_dir_notify(inode, DN_CREATE); 97 inode_dir_notify(inode, DN_CREATE);
76 inotify_inode_queue_event(inode, IN_CREATE, 0, name); 98 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name);
99 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino);
77} 100}
78 101
79/* 102/*
80 * fsnotify_mkdir - directory 'name' was created 103 * fsnotify_mkdir - directory 'name' was created
81 */ 104 */
82static inline void fsnotify_mkdir(struct inode *inode, const char *name) 105static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
83{ 106{
84 inode_dir_notify(inode, DN_CREATE); 107 inode_dir_notify(inode, DN_CREATE);
85 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, name); 108 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0,
109 dentry->d_name.name);
110 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino);
86} 111}
87 112
88/* 113/*
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 10f96c31971e..966a5b3da439 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_FUTEX_H 1#ifndef _LINUX_FUTEX_H
2#define _LINUX_FUTEX_H 2#define _LINUX_FUTEX_H
3 3
4#include <linux/sched.h>
5
4/* Second argument to futex syscall */ 6/* Second argument to futex syscall */
5 7
6 8
@@ -11,10 +13,97 @@
11#define FUTEX_CMP_REQUEUE 4 13#define FUTEX_CMP_REQUEUE 4
12#define FUTEX_WAKE_OP 5 14#define FUTEX_WAKE_OP 5
13 15
16/*
17 * Support for robust futexes: the kernel cleans up held futexes at
18 * thread exit time.
19 */
20
21/*
22 * Per-lock list entry - embedded in user-space locks, somewhere close
23 * to the futex field. (Note: user-space uses a double-linked list to
24 * achieve O(1) list add and remove, but the kernel only needs to know
25 * about the forward link)
26 *
27 * NOTE: this structure is part of the syscall ABI, and must not be
28 * changed.
29 */
30struct robust_list {
31 struct robust_list __user *next;
32};
33
34/*
35 * Per-thread list head:
36 *
37 * NOTE: this structure is part of the syscall ABI, and must only be
38 * changed if the change is first communicated with the glibc folks.
39 * (When an incompatible change is done, we'll increase the structure
40 * size, which glibc will detect)
41 */
42struct robust_list_head {
43 /*
44 * The head of the list. Points back to itself if empty:
45 */
46 struct robust_list list;
47
48 /*
49 * This relative offset is set by user-space, it gives the kernel
50 * the relative position of the futex field to examine. This way
51 * we keep userspace flexible, to freely shape its data-structure,
52 * without hardcoding any particular offset into the kernel:
53 */
54 long futex_offset;
55
56 /*
57 * The death of the thread may race with userspace setting
58 * up a lock's links. So to handle this race, userspace first
59 * sets this field to the address of the to-be-taken lock,
60 * then does the lock acquire, and then adds itself to the
61 * list, and then clears this field. Hence the kernel will
62 * always have full knowledge of all locks that the thread
63 * _might_ have taken. We check the owner TID in any case,
64 * so only truly owned locks will be handled.
65 */
66 struct robust_list __user *list_op_pending;
67};
68
69/*
70 * Are there any waiters for this robust futex:
71 */
72#define FUTEX_WAITERS 0x80000000
73
74/*
75 * The kernel signals via this bit that a thread holding a futex
76 * has exited without unlocking the futex. The kernel also does
77 * a FUTEX_WAKE on such futexes, after setting the bit, to wake
78 * up any possible waiters:
79 */
80#define FUTEX_OWNER_DIED 0x40000000
81
82/*
83 * The rest of the robust-futex field is for the TID:
84 */
85#define FUTEX_TID_MASK 0x3fffffff
86
87/*
88 * This limit protects against a deliberately circular list.
89 * (Not worth introducing an rlimit for it)
90 */
91#define ROBUST_LIST_LIMIT 2048
92
14long do_futex(unsigned long uaddr, int op, int val, 93long do_futex(unsigned long uaddr, int op, int val,
15 unsigned long timeout, unsigned long uaddr2, int val2, 94 unsigned long timeout, unsigned long uaddr2, int val2,
16 int val3); 95 int val3);
17 96
97extern int handle_futex_death(u32 __user *uaddr, struct task_struct *curr);
98
99#ifdef CONFIG_FUTEX
100extern void exit_robust_list(struct task_struct *curr);
101#else
102static inline void exit_robust_list(struct task_struct *curr)
103{
104}
105#endif
106
18#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */ 107#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
19#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */ 108#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */
20#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */ 109#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index 3e1b9b285258..71e7b2847cb3 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -120,7 +120,7 @@ static inline void gameport_set_name(struct gameport *gameport, const char *name
120} 120}
121 121
122/* 122/*
123 * Use the following fucntions to manipulate gameport's per-port 123 * Use the following functions to manipulate gameport's per-port
124 * driver-specific data. 124 * driver-specific data.
125 */ 125 */
126static inline void *gameport_get_drvdata(struct gameport *gameport) 126static inline void *gameport_get_drvdata(struct gameport *gameport)
@@ -134,7 +134,7 @@ static inline void gameport_set_drvdata(struct gameport *gameport, void *data)
134} 134}
135 135
136/* 136/*
137 * Use the following fucntions to pin gameport's driver in process context 137 * Use the following functions to pin gameport's driver in process context
138 */ 138 */
139static inline int gameport_pin_driver(struct gameport *gameport) 139static inline int gameport_pin_driver(struct gameport *gameport)
140{ 140{
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 0abe9d9a0069..652611a4bdcd 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -12,6 +12,8 @@
12#ifndef GENERIC_SERIAL_H 12#ifndef GENERIC_SERIAL_H
13#define GENERIC_SERIAL_H 13#define GENERIC_SERIAL_H
14 14
15#include <linux/mutex.h>
16
15struct real_driver { 17struct real_driver {
16 void (*disable_tx_interrupts) (void *); 18 void (*disable_tx_interrupts) (void *);
17 void (*enable_tx_interrupts) (void *); 19 void (*enable_tx_interrupts) (void *);
@@ -34,7 +36,7 @@ struct gs_port {
34 int xmit_head; 36 int xmit_head;
35 int xmit_tail; 37 int xmit_tail;
36 int xmit_cnt; 38 int xmit_cnt;
37 struct semaphore port_write_sem; 39 struct mutex port_write_mutex;
38 int flags; 40 int flags;
39 wait_queue_head_t open_wait; 41 wait_queue_head_t open_wait;
40 wait_queue_head_t close_wait; 42 wait_queue_head_t close_wait;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index eef5ccdcd731..10a27f29d692 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -78,6 +78,7 @@ struct hd_struct {
78 sector_t start_sect; 78 sector_t start_sect;
79 sector_t nr_sects; 79 sector_t nr_sects;
80 struct kobject kobj; 80 struct kobject kobj;
81 struct kobject *holder_dir;
81 unsigned ios[2], sectors[2]; /* READs and WRITEs */ 82 unsigned ios[2], sectors[2]; /* READs and WRITEs */
82 int policy, partno; 83 int policy, partno;
83}; 84};
@@ -89,12 +90,12 @@ struct hd_struct {
89#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 90#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
90 91
91struct disk_stats { 92struct disk_stats {
92 unsigned sectors[2]; /* READs and WRITEs */ 93 unsigned long sectors[2]; /* READs and WRITEs */
93 unsigned ios[2]; 94 unsigned long ios[2];
94 unsigned merges[2]; 95 unsigned long merges[2];
95 unsigned ticks[2]; 96 unsigned long ticks[2];
96 unsigned io_ticks; 97 unsigned long io_ticks;
97 unsigned time_in_queue; 98 unsigned long time_in_queue;
98}; 99};
99 100
100struct gendisk { 101struct gendisk {
@@ -114,6 +115,8 @@ struct gendisk {
114 int number; /* more of the same */ 115 int number; /* more of the same */
115 struct device *driverfs_dev; 116 struct device *driverfs_dev;
116 struct kobject kobj; 117 struct kobject kobj;
118 struct kobject *holder_dir;
119 struct kobject *slave_dir;
117 120
118 struct timer_rand_state *random; 121 struct timer_rand_state *random;
119 int policy; 122 int policy;
@@ -149,22 +152,16 @@ struct disk_attribute {
149({ \ 152({ \
150 typeof(gendiskp->dkstats->field) res = 0; \ 153 typeof(gendiskp->dkstats->field) res = 0; \
151 int i; \ 154 int i; \
152 for (i=0; i < NR_CPUS; i++) { \ 155 for_each_possible_cpu(i) \
153 if (!cpu_possible(i)) \
154 continue; \
155 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \ 156 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \
156 } \
157 res; \ 157 res; \
158}) 158})
159 159
160static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { 160static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) {
161 int i; 161 int i;
162 for (i=0; i < NR_CPUS; i++) { 162 for_each_possible_cpu(i)
163 if (cpu_possible(i)) { 163 memset(per_cpu_ptr(gendiskp->dkstats, i), value,
164 memset(per_cpu_ptr(gendiskp->dkstats, i), value, 164 sizeof (struct disk_stats));
165 sizeof (struct disk_stats));
166 }
167 }
168} 165}
169 166
170#else 167#else
diff --git a/include/linux/gigaset_dev.h b/include/linux/gigaset_dev.h
new file mode 100644
index 000000000000..70ad09c8ad1e
--- /dev/null
+++ b/include/linux/gigaset_dev.h
@@ -0,0 +1,32 @@
1/*
2 * interface to user space for the gigaset driver
3 *
4 * Copyright (c) 2004 by Hansjoerg Lipp <hjlipp@web.de>
5 *
6 * =====================================================================
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 * =====================================================================
12 * Version: $Id: gigaset_dev.h,v 1.4.4.4 2005/11/21 22:28:09 hjlipp Exp $
13 * =====================================================================
14 */
15
16#ifndef GIGASET_INTERFACE_H
17#define GIGASET_INTERFACE_H
18
19#include <linux/ioctl.h>
20
21#define GIGASET_IOCTL 0x47
22
23#define GIGVER_DRIVER 0
24#define GIGVER_COMPAT 1
25#define GIGVER_FWBASE 2
26
27#define GIGASET_REDIR _IOWR (GIGASET_IOCTL, 0, int)
28#define GIGASET_CONFIG _IOWR (GIGASET_IOCTL, 1, int)
29#define GIGASET_BRKCHARS _IOW (GIGASET_IOCTL, 2, unsigned char[6]) //FIXME [6] okay?
30#define GIGASET_VERSION _IOWR (GIGASET_IOCTL, 3, unsigned[4])
31
32#endif
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 6bece9280eb7..892c4ea1b425 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -7,6 +7,18 @@
7 7
8#include <asm/cacheflush.h> 8#include <asm/cacheflush.h>
9 9
10#ifndef ARCH_HAS_FLUSH_ANON_PAGE
11static inline void flush_anon_page(struct page *page, unsigned long vmaddr)
12{
13}
14#endif
15
16#ifndef ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
17static inline void flush_kernel_dcache_page(struct page *page)
18{
19}
20#endif
21
10#ifdef CONFIG_HIGHMEM 22#ifdef CONFIG_HIGHMEM
11 23
12#include <asm/highmem.h> 24#include <asm/highmem.h>
diff --git a/include/linux/hpet.h b/include/linux/hpet.h
index 27238194b212..707f7cb9e795 100644
--- a/include/linux/hpet.h
+++ b/include/linux/hpet.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5 5
6#ifdef __KERNEL__
7
6/* 8/*
7 * Offsets into HPET Registers 9 * Offsets into HPET Registers
8 */ 10 */
@@ -85,22 +87,6 @@ struct hpet {
85#define Tn_FSB_INT_ADDR_SHIFT (32UL) 87#define Tn_FSB_INT_ADDR_SHIFT (32UL)
86#define Tn_FSB_INT_VAL_MASK (0x00000000ffffffffULL) 88#define Tn_FSB_INT_VAL_MASK (0x00000000ffffffffULL)
87 89
88struct hpet_info {
89 unsigned long hi_ireqfreq; /* Hz */
90 unsigned long hi_flags; /* information */
91 unsigned short hi_hpet;
92 unsigned short hi_timer;
93};
94
95#define HPET_INFO_PERIODIC 0x0001 /* timer is periodic */
96
97#define HPET_IE_ON _IO('h', 0x01) /* interrupt on */
98#define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */
99#define HPET_INFO _IOR('h', 0x03, struct hpet_info)
100#define HPET_EPI _IO('h', 0x04) /* enable periodic */
101#define HPET_DPI _IO('h', 0x05) /* disable periodic */
102#define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */
103
104/* 90/*
105 * exported interfaces 91 * exported interfaces
106 */ 92 */
@@ -133,4 +119,22 @@ int hpet_register(struct hpet_task *, int);
133int hpet_unregister(struct hpet_task *); 119int hpet_unregister(struct hpet_task *);
134int hpet_control(struct hpet_task *, unsigned int, unsigned long); 120int hpet_control(struct hpet_task *, unsigned int, unsigned long);
135 121
122#endif /* __KERNEL__ */
123
124struct hpet_info {
125 unsigned long hi_ireqfreq; /* Hz */
126 unsigned long hi_flags; /* information */
127 unsigned short hi_hpet;
128 unsigned short hi_timer;
129};
130
131#define HPET_INFO_PERIODIC 0x0001 /* timer is periodic */
132
133#define HPET_IE_ON _IO('h', 0x01) /* interrupt on */
134#define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */
135#define HPET_INFO _IOR('h', 0x03, struct hpet_info)
136#define HPET_EPI _IO('h', 0x04) /* enable periodic */
137#define HPET_DPI _IO('h', 0x05) /* disable periodic */
138#define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */
139
136#endif /* !__HPET__ */ 140#endif /* !__HPET__ */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 6401c31d6add..b20939287613 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -34,15 +34,7 @@ enum hrtimer_restart {
34 HRTIMER_RESTART, 34 HRTIMER_RESTART,
35}; 35};
36 36
37/* 37#define HRTIMER_INACTIVE ((void *)1UL)
38 * Timer states:
39 */
40enum hrtimer_state {
41 HRTIMER_INACTIVE, /* Timer is inactive */
42 HRTIMER_EXPIRED, /* Timer is expired */
43 HRTIMER_RUNNING, /* Timer is running the callback function */
44 HRTIMER_PENDING, /* Timer is pending */
45};
46 38
47struct hrtimer_base; 39struct hrtimer_base;
48 40
@@ -53,9 +45,7 @@ struct hrtimer_base;
53 * @expires: the absolute expiry time in the hrtimers internal 45 * @expires: the absolute expiry time in the hrtimers internal
54 * representation. The time is related to the clock on 46 * representation. The time is related to the clock on
55 * which the timer is based. 47 * which the timer is based.
56 * @state: state of the timer
57 * @function: timer expiry callback function 48 * @function: timer expiry callback function
58 * @data: argument for the callback function
59 * @base: pointer to the timer base (per cpu and per clock) 49 * @base: pointer to the timer base (per cpu and per clock)
60 * 50 *
61 * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE() 51 * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE()
@@ -63,23 +53,36 @@ struct hrtimer_base;
63struct hrtimer { 53struct hrtimer {
64 struct rb_node node; 54 struct rb_node node;
65 ktime_t expires; 55 ktime_t expires;
66 enum hrtimer_state state; 56 int (*function)(struct hrtimer *);
67 int (*function)(void *);
68 void *data;
69 struct hrtimer_base *base; 57 struct hrtimer_base *base;
70}; 58};
71 59
72/** 60/**
61 * struct hrtimer_sleeper - simple sleeper structure
62 *
63 * @timer: embedded timer structure
64 * @task: task to wake up
65 *
66 * task is set to NULL, when the timer expires.
67 */
68struct hrtimer_sleeper {
69 struct hrtimer timer;
70 struct task_struct *task;
71};
72
73/**
73 * struct hrtimer_base - the timer base for a specific clock 74 * struct hrtimer_base - the timer base for a specific clock
74 * 75 *
75 * @index: clock type index for per_cpu support when moving a timer 76 * @index: clock type index for per_cpu support when moving a timer
76 * to a base on another cpu. 77 * to a base on another cpu.
77 * @lock: lock protecting the base and associated timers 78 * @lock: lock protecting the base and associated timers
78 * @active: red black tree root node for the active timers 79 * @active: red black tree root node for the active timers
79 * @first: pointer to the timer node which expires first 80 * @first: pointer to the timer node which expires first
80 * @resolution: the resolution of the clock, in nanoseconds 81 * @resolution: the resolution of the clock, in nanoseconds
81 * @get_time: function to retrieve the current time of the clock 82 * @get_time: function to retrieve the current time of the clock
82 * @curr_timer: the timer which is executing a callback right now 83 * @get_sofirq_time: function to retrieve the current time from the softirq
84 * @curr_timer: the timer which is executing a callback right now
85 * @softirq_time: the time when running the hrtimer queue in the softirq
83 */ 86 */
84struct hrtimer_base { 87struct hrtimer_base {
85 clockid_t index; 88 clockid_t index;
@@ -88,7 +91,9 @@ struct hrtimer_base {
88 struct rb_node *first; 91 struct rb_node *first;
89 ktime_t resolution; 92 ktime_t resolution;
90 ktime_t (*get_time)(void); 93 ktime_t (*get_time)(void);
94 ktime_t (*get_softirq_time)(void);
91 struct hrtimer *curr_timer; 95 struct hrtimer *curr_timer;
96 ktime_t softirq_time;
92}; 97};
93 98
94/* 99/*
@@ -122,11 +127,12 @@ extern ktime_t hrtimer_get_next_event(void);
122 127
123static inline int hrtimer_active(const struct hrtimer *timer) 128static inline int hrtimer_active(const struct hrtimer *timer)
124{ 129{
125 return timer->state == HRTIMER_PENDING; 130 return timer->node.rb_parent != HRTIMER_INACTIVE;
126} 131}
127 132
128/* Forward a hrtimer so it expires after now: */ 133/* Forward a hrtimer so it expires after now: */
129extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval); 134extern unsigned long
135hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval);
130 136
131/* Precise sleep: */ 137/* Precise sleep: */
132extern long hrtimer_nanosleep(struct timespec *rqtp, 138extern long hrtimer_nanosleep(struct timespec *rqtp,
@@ -134,6 +140,9 @@ extern long hrtimer_nanosleep(struct timespec *rqtp,
134 const enum hrtimer_mode mode, 140 const enum hrtimer_mode mode,
135 const clockid_t clockid); 141 const clockid_t clockid);
136 142
143extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
144 struct task_struct *tsk);
145
137/* Soft interrupt function to run the hrtimer queues: */ 146/* Soft interrupt function to run the hrtimer queues: */
138extern void hrtimer_run_queues(void); 147extern void hrtimer_run_queues(void);
139 148
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 68d82ad6b17c..4c5e610fe442 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -20,10 +20,7 @@ void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long)
20int hugetlb_prefault(struct address_space *, struct vm_area_struct *); 20int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
21int hugetlb_report_meminfo(char *); 21int hugetlb_report_meminfo(char *);
22int hugetlb_report_node_meminfo(int, char *); 22int hugetlb_report_node_meminfo(int, char *);
23int is_hugepage_mem_enough(size_t);
24unsigned long hugetlb_total_pages(void); 23unsigned long hugetlb_total_pages(void);
25struct page *alloc_huge_page(struct vm_area_struct *, unsigned long);
26void free_huge_page(struct page *);
27int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 24int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
28 unsigned long address, int write_access); 25 unsigned long address, int write_access);
29 26
@@ -39,18 +36,35 @@ struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
39 int write); 36 int write);
40struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, 37struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
41 pmd_t *pmd, int write); 38 pmd_t *pmd, int write);
42int is_aligned_hugepage_range(unsigned long addr, unsigned long len);
43int pmd_huge(pmd_t pmd); 39int pmd_huge(pmd_t pmd);
40void hugetlb_change_protection(struct vm_area_struct *vma,
41 unsigned long address, unsigned long end, pgprot_t newprot);
44 42
45#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE 43#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE
46#define is_hugepage_only_range(mm, addr, len) 0 44#define is_hugepage_only_range(mm, addr, len) 0
47#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ 45#endif
48 do { } while (0) 46
47#ifndef ARCH_HAS_HUGETLB_FREE_PGD_RANGE
48#define hugetlb_free_pgd_range free_pgd_range
49#else
50void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
51 unsigned long end, unsigned long floor,
52 unsigned long ceiling);
49#endif 53#endif
50 54
51#ifndef ARCH_HAS_PREPARE_HUGEPAGE_RANGE 55#ifndef ARCH_HAS_PREPARE_HUGEPAGE_RANGE
52#define prepare_hugepage_range(addr, len) \ 56/*
53 is_aligned_hugepage_range(addr, len) 57 * If the arch doesn't supply something else, assume that hugepage
58 * size aligned regions are ok without further preparation.
59 */
60static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
61{
62 if (len & ~HPAGE_MASK)
63 return -EINVAL;
64 if (addr & ~HPAGE_MASK)
65 return -EINVAL;
66 return 0;
67}
54#else 68#else
55int prepare_hugepage_range(unsigned long addr, unsigned long len); 69int prepare_hugepage_range(unsigned long addr, unsigned long len);
56#endif 70#endif
@@ -87,20 +101,17 @@ static inline unsigned long hugetlb_total_pages(void)
87#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) 101#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
88#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) 102#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })
89#define unmap_hugepage_range(vma, start, end) BUG() 103#define unmap_hugepage_range(vma, start, end) BUG()
90#define is_hugepage_mem_enough(size) 0
91#define hugetlb_report_meminfo(buf) 0 104#define hugetlb_report_meminfo(buf) 0
92#define hugetlb_report_node_meminfo(n, buf) 0 105#define hugetlb_report_node_meminfo(n, buf) 0
93#define follow_huge_pmd(mm, addr, pmd, write) NULL 106#define follow_huge_pmd(mm, addr, pmd, write) NULL
94#define is_aligned_hugepage_range(addr, len) 0
95#define prepare_hugepage_range(addr, len) (-EINVAL) 107#define prepare_hugepage_range(addr, len) (-EINVAL)
96#define pmd_huge(x) 0 108#define pmd_huge(x) 0
97#define is_hugepage_only_range(mm, addr, len) 0 109#define is_hugepage_only_range(mm, addr, len) 0
98#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ 110#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
99 do { } while (0)
100#define alloc_huge_page(vma, addr) ({ NULL; })
101#define free_huge_page(p) ({ (void)(p); BUG(); })
102#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) 111#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; })
103 112
113#define hugetlb_change_protection(vma, address, end, newprot)
114
104#ifndef HPAGE_MASK 115#ifndef HPAGE_MASK
105#define HPAGE_MASK PAGE_MASK /* Keep the compiler happy */ 116#define HPAGE_MASK PAGE_MASK /* Keep the compiler happy */
106#define HPAGE_SIZE PAGE_SIZE 117#define HPAGE_SIZE PAGE_SIZE
@@ -128,6 +139,8 @@ struct hugetlbfs_sb_info {
128 139
129struct hugetlbfs_inode_info { 140struct hugetlbfs_inode_info {
130 struct shared_policy policy; 141 struct shared_policy policy;
142 /* Protected by the (global) hugetlb_lock */
143 unsigned long prereserved_hpages;
131 struct inode vfs_inode; 144 struct inode vfs_inode;
132}; 145};
133 146
@@ -141,9 +154,13 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
141 return sb->s_fs_info; 154 return sb->s_fs_info;
142} 155}
143 156
144extern struct file_operations hugetlbfs_file_operations; 157extern const struct file_operations hugetlbfs_file_operations;
145extern struct vm_operations_struct hugetlb_vm_ops; 158extern struct vm_operations_struct hugetlb_vm_ops;
146struct file *hugetlb_zero_setup(size_t); 159struct file *hugetlb_zero_setup(size_t);
160int hugetlb_extend_reservation(struct hugetlbfs_inode_info *info,
161 unsigned long atleast_hpages);
162void hugetlb_truncate_reservation(struct hugetlbfs_inode_info *info,
163 unsigned long atmost_hpages);
147int hugetlb_get_quota(struct address_space *mapping); 164int hugetlb_get_quota(struct address_space *mapping);
148void hugetlb_put_quota(struct address_space *mapping); 165void hugetlb_put_quota(struct address_space *mapping);
149 166
diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h
index 7eb4004b3601..a90c09d331c1 100644
--- a/include/linux/hwmon-sysfs.h
+++ b/include/linux/hwmon-sysfs.h
@@ -27,11 +27,13 @@ struct sensor_device_attribute{
27#define to_sensor_dev_attr(_dev_attr) \ 27#define to_sensor_dev_attr(_dev_attr) \
28 container_of(_dev_attr, struct sensor_device_attribute, dev_attr) 28 container_of(_dev_attr, struct sensor_device_attribute, dev_attr)
29 29
30#define SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index) \ 30#define SENSOR_ATTR(_name, _mode, _show, _store, _index) \
31struct sensor_device_attribute sensor_dev_attr_##_name = { \ 31 { .dev_attr = __ATTR(_name, _mode, _show, _store), \
32 .dev_attr = __ATTR(_name,_mode,_show,_store), \ 32 .index = _index }
33 .index = _index, \ 33
34} 34#define SENSOR_DEVICE_ATTR(_name, _mode, _show, _store, _index) \
35struct sensor_device_attribute sensor_dev_attr_##_name \
36 = SENSOR_ATTR(_name, _mode, _show, _store, _index)
35 37
36struct sensor_device_attribute_2 { 38struct sensor_device_attribute_2 {
37 struct device_attribute dev_attr; 39 struct device_attribute dev_attr;
@@ -41,11 +43,13 @@ struct sensor_device_attribute_2 {
41#define to_sensor_dev_attr_2(_dev_attr) \ 43#define to_sensor_dev_attr_2(_dev_attr) \
42 container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr) 44 container_of(_dev_attr, struct sensor_device_attribute_2, dev_attr)
43 45
46#define SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index) \
47 { .dev_attr = __ATTR(_name, _mode, _show, _store), \
48 .index = _index, \
49 .nr = _nr }
50
44#define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index) \ 51#define SENSOR_DEVICE_ATTR_2(_name,_mode,_show,_store,_nr,_index) \
45struct sensor_device_attribute_2 sensor_dev_attr_##_name = { \ 52struct sensor_device_attribute_2 sensor_dev_attr_##_name \
46 .dev_attr = __ATTR(_name,_mode,_show,_store), \ 53 = SENSOR_ATTR_2(_name, _mode, _show, _store, _nr, _index)
47 .index = _index, \
48 .nr = _nr, \
49}
50 54
51#endif /* _LINUX_HWMON_SYSFS_H */ 55#endif /* _LINUX_HWMON_SYSFS_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 474c8f4f5d4f..c8b81f419fd8 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -108,6 +108,10 @@
108#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */ 108#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */
109#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */ 109#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */
110#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */ 110#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */
111#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */
112#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */
113#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */
114#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */
111 115
112#define I2C_DRIVERID_I2CDEV 900 116#define I2C_DRIVERID_I2CDEV 900
113#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 117#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
@@ -172,7 +176,6 @@
172#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */ 176#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
173#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */ 177#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */
174#define I2C_HW_B_TSUNA 0x010012 /* DEC Tsunami chipset */ 178#define I2C_HW_B_TSUNA 0x010012 /* DEC Tsunami chipset */
175#define I2C_HW_B_FRODO 0x010013 /* 2d3D SA-1110 Development Board */
176#define I2C_HW_B_OMAHA 0x010014 /* Omaha I2C interface (ARM) */ 179#define I2C_HW_B_OMAHA 0x010014 /* Omaha I2C interface (ARM) */
177#define I2C_HW_B_GUIDE 0x010015 /* Guide bit-basher */ 180#define I2C_HW_B_GUIDE 0x010015 /* Guide bit-basher */
178#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */ 181#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */
@@ -185,6 +188,7 @@
185#define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ 188#define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */
186#define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ 189#define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */
187#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ 190#define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */
191#define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */
188 192
189/* --- PCF 8584 based algorithms */ 193/* --- PCF 8584 based algorithms */
190#define I2C_HW_P_LP 0x020000 /* Parallel port interface */ 194#define I2C_HW_P_LP 0x020000 /* Parallel port interface */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 63f1d63cc1d8..1635ee25918f 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -32,7 +32,7 @@
32#include <linux/mod_devicetable.h> 32#include <linux/mod_devicetable.h>
33#include <linux/device.h> /* for struct device */ 33#include <linux/device.h> /* for struct device */
34#include <linux/sched.h> /* for completion */ 34#include <linux/sched.h> /* for completion */
35#include <asm/semaphore.h> 35#include <linux/mutex.h>
36 36
37/* --- For i2c-isa ---------------------------------------------------- */ 37/* --- For i2c-isa ---------------------------------------------------- */
38 38
@@ -225,8 +225,8 @@ struct i2c_adapter {
225 int (*client_unregister)(struct i2c_client *); 225 int (*client_unregister)(struct i2c_client *);
226 226
227 /* data fields that are valid for all devices */ 227 /* data fields that are valid for all devices */
228 struct semaphore bus_lock; 228 struct mutex bus_lock;
229 struct semaphore clist_lock; 229 struct mutex clist_lock;
230 230
231 int timeout; 231 int timeout;
232 int retries; 232 int retries;
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 5a9d8c599171..dd7d627bf66f 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -950,9 +950,7 @@ static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
950 if (!pool->slab) 950 if (!pool->slab)
951 goto free_name; 951 goto free_name;
952 952
953 pool->mempool = 953 pool->mempool = mempool_create_slab_pool(min_nr, pool->slab);
954 mempool_create(min_nr, mempool_alloc_slab, mempool_free_slab,
955 pool->slab);
956 if (!pool->mempool) 954 if (!pool->mempool)
957 goto free_slab; 955 goto free_slab;
958 956
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 0cf6c8b12caf..c771a7db9871 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -40,14 +40,16 @@ struct icmp6hdr {
40 struct icmpv6_nd_ra { 40 struct icmpv6_nd_ra {
41 __u8 hop_limit; 41 __u8 hop_limit;
42#if defined(__LITTLE_ENDIAN_BITFIELD) 42#if defined(__LITTLE_ENDIAN_BITFIELD)
43 __u8 reserved:6, 43 __u8 reserved:4,
44 router_pref:2,
44 other:1, 45 other:1,
45 managed:1; 46 managed:1;
46 47
47#elif defined(__BIG_ENDIAN_BITFIELD) 48#elif defined(__BIG_ENDIAN_BITFIELD)
48 __u8 managed:1, 49 __u8 managed:1,
49 other:1, 50 other:1,
50 reserved:6; 51 router_pref:2,
52 reserved:4;
51#else 53#else
52#error "Please fix <asm/byteorder.h>" 54#error "Please fix <asm/byteorder.h>"
53#endif 55#endif
@@ -70,8 +72,13 @@ struct icmp6hdr {
70#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed 72#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed
71#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other 73#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other
72#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime 74#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime
75#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
73}; 76};
74 77
78#define ICMPV6_ROUTER_PREF_LOW 0x3
79#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
80#define ICMPV6_ROUTER_PREF_HIGH 0x1
81#define ICMPV6_ROUTER_PREF_INVALID 0x2
75 82
76#define ICMPV6_DEST_UNREACH 1 83#define ICMPV6_DEST_UNREACH 1
77#define ICMPV6_PKT_TOOBIG 2 84#define ICMPV6_PKT_TOOBIG 2
diff --git a/include/linux/ide.h b/include/linux/ide.h
index a7fc4cc79b23..8d2db412ba9c 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -792,6 +792,7 @@ typedef struct hwif_s {
792 unsigned no_dsc : 1; /* 0 default, 1 dsc_overlap disabled */ 792 unsigned no_dsc : 1; /* 0 default, 1 dsc_overlap disabled */
793 unsigned auto_poll : 1; /* supports nop auto-poll */ 793 unsigned auto_poll : 1; /* supports nop auto-poll */
794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 794 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
795 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
795 796
796 struct device gendev; 797 struct device gendev;
797 struct completion gendev_rel_comp; /* To deal with device release() */ 798 struct completion gendev_rel_comp; /* To deal with device release() */
diff --git a/include/linux/if.h b/include/linux/if.h
index ce627d9092ef..374e20ad8b0d 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -33,7 +33,7 @@
33#define IFF_LOOPBACK 0x8 /* is a loopback net */ 33#define IFF_LOOPBACK 0x8 /* is a loopback net */
34#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ 34#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */
35#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ 35#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
36#define IFF_RUNNING 0x40 /* interface running and carrier ok */ 36#define IFF_RUNNING 0x40 /* interface RFC2863 OPER_UP */
37#define IFF_NOARP 0x80 /* no ARP protocol */ 37#define IFF_NOARP 0x80 /* no ARP protocol */
38#define IFF_PROMISC 0x100 /* receive all packets */ 38#define IFF_PROMISC 0x100 /* receive all packets */
39#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ 39#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/
@@ -43,15 +43,22 @@
43 43
44#define IFF_MULTICAST 0x1000 /* Supports multicast */ 44#define IFF_MULTICAST 0x1000 /* Supports multicast */
45 45
46#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_MASTER|IFF_SLAVE|IFF_RUNNING)
47
48#define IFF_PORTSEL 0x2000 /* can set media type */ 46#define IFF_PORTSEL 0x2000 /* can set media type */
49#define IFF_AUTOMEDIA 0x4000 /* auto media select active */ 47#define IFF_AUTOMEDIA 0x4000 /* auto media select active */
50#define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/ 48#define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/
51 49
50#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */
51#define IFF_DORMANT 0x20000 /* driver signals dormant */
52
53#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|\
54 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
55
52/* Private (from user) interface flags (netdevice->priv_flags). */ 56/* Private (from user) interface flags (netdevice->priv_flags). */
53#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */ 57#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */
54#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */ 58#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */
59#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */
60#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */
61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
55 62
56#define IF_GET_IFACE 0x0001 /* for querying only */ 63#define IF_GET_IFACE 0x0001 /* for querying only */
57#define IF_GET_PROTO 0x0002 64#define IF_GET_PROTO 0x0002
@@ -80,6 +87,22 @@
80#define IF_PROTO_FR_ETH_PVC 0x200B 87#define IF_PROTO_FR_ETH_PVC 0x200B
81#define IF_PROTO_RAW 0x200C /* RAW Socket */ 88#define IF_PROTO_RAW 0x200C /* RAW Socket */
82 89
90/* RFC 2863 operational status */
91enum {
92 IF_OPER_UNKNOWN,
93 IF_OPER_NOTPRESENT,
94 IF_OPER_DOWN,
95 IF_OPER_LOWERLAYERDOWN,
96 IF_OPER_TESTING,
97 IF_OPER_DORMANT,
98 IF_OPER_UP,
99};
100
101/* link modes */
102enum {
103 IF_LINK_MODE_DEFAULT,
104 IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */
105};
83 106
84/* 107/*
85 * Device mapping structure. I'd just gone off and designed a 108 * Device mapping structure. I'd just gone off and designed a
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 7a92c1ce1457..ab08f35cbc35 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -61,6 +61,7 @@
61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ 61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
62#define ETH_P_IPX 0x8137 /* IPX over DIX */ 62#define ETH_P_IPX 0x8137 /* IPX over DIX */
63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ 63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
64#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
64#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol 65#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
65 * defined in draft-wilson-wrec-wccp-v2-00.txt */ 66 * defined in draft-wilson-wrec-wccp-v2-00.txt */
66#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ 67#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
diff --git a/include/linux/in.h b/include/linux/in.h
index ba355384016a..94f557fa4636 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -72,6 +72,7 @@ struct in_addr {
72#define IP_FREEBIND 15 72#define IP_FREEBIND 15
73#define IP_IPSEC_POLICY 16 73#define IP_IPSEC_POLICY 16
74#define IP_XFRM_POLICY 17 74#define IP_XFRM_POLICY 17
75#define IP_PASSSEC 18
75 76
76/* BSD compatibility */ 77/* BSD compatibility */
77#define IP_RECVRETOPTS IP_RETOPTS 78#define IP_RECVRETOPTS IP_RETOPTS
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index fd7af86151b1..92297ff24e85 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -25,6 +25,7 @@ struct ipv4_devconf
25 int arp_filter; 25 int arp_filter;
26 int arp_announce; 26 int arp_announce;
27 int arp_ignore; 27 int arp_ignore;
28 int arp_accept;
28 int medium_id; 29 int medium_id;
29 int no_xfrm; 30 int no_xfrm;
30 int no_policy; 31 int no_policy;
diff --git a/include/linux/init.h b/include/linux/init.h
index ff8d8b8632f4..ed0ac7c39fdc 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -69,6 +69,10 @@ extern initcall_t __security_initcall_start[], __security_initcall_end[];
69 69
70/* Defined in init/main.c */ 70/* Defined in init/main.c */
71extern char saved_command_line[]; 71extern char saved_command_line[];
72
73/* used by init/main.c */
74extern void setup_arch(char **);
75
72#endif 76#endif
73 77
74#ifndef MODULE 78#ifndef MODULE
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index dcfd2ecccb5d..41ecbb847f32 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -7,11 +7,10 @@
7#define INIT_FDTABLE \ 7#define INIT_FDTABLE \
8{ \ 8{ \
9 .max_fds = NR_OPEN_DEFAULT, \ 9 .max_fds = NR_OPEN_DEFAULT, \
10 .max_fdset = __FD_SETSIZE, \ 10 .max_fdset = EMBEDDED_FD_SET_SIZE, \
11 .next_fd = 0, \
12 .fd = &init_files.fd_array[0], \ 11 .fd = &init_files.fd_array[0], \
13 .close_on_exec = &init_files.close_on_exec_init, \ 12 .close_on_exec = (fd_set *)&init_files.close_on_exec_init, \
14 .open_fds = &init_files.open_fds_init, \ 13 .open_fds = (fd_set *)&init_files.open_fds_init, \
15 .rcu = RCU_HEAD_INIT, \ 14 .rcu = RCU_HEAD_INIT, \
16 .free_files = NULL, \ 15 .free_files = NULL, \
17 .next = NULL, \ 16 .next = NULL, \
@@ -20,9 +19,10 @@
20#define INIT_FILES \ 19#define INIT_FILES \
21{ \ 20{ \
22 .count = ATOMIC_INIT(1), \ 21 .count = ATOMIC_INIT(1), \
23 .file_lock = SPIN_LOCK_UNLOCKED, \
24 .fdt = &init_files.fdtab, \ 22 .fdt = &init_files.fdtab, \
25 .fdtab = INIT_FDTABLE, \ 23 .fdtab = INIT_FDTABLE, \
24 .file_lock = SPIN_LOCK_UNLOCKED, \
25 .next_fd = 0, \
26 .close_on_exec_init = { { 0, } }, \ 26 .close_on_exec_init = { { 0, } }, \
27 .open_fds_init = { { 0, } }, \ 27 .open_fds_init = { { 0, } }, \
28 .fd_array = { NULL, } \ 28 .fd_array = { NULL, } \
@@ -62,6 +62,8 @@
62 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \ 62 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \
63 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \ 63 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
64 .rlim = INIT_RLIMITS, \ 64 .rlim = INIT_RLIMITS, \
65 .pgrp = 1, \
66 .session = 1, \
65} 67}
66 68
67#define INIT_SIGHAND(sighand) { \ 69#define INIT_SIGHAND(sighand) { \
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 267c88b5f742..09e00433c78e 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -71,6 +71,8 @@ struct inotify_event {
71 71
72#ifdef CONFIG_INOTIFY 72#ifdef CONFIG_INOTIFY
73 73
74extern void inotify_d_instantiate(struct dentry *, struct inode *);
75extern void inotify_d_move(struct dentry *);
74extern void inotify_inode_queue_event(struct inode *, __u32, __u32, 76extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
75 const char *); 77 const char *);
76extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, 78extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
@@ -81,6 +83,15 @@ extern u32 inotify_get_cookie(void);
81 83
82#else 84#else
83 85
86static inline void inotify_d_instantiate(struct dentry *dentry,
87 struct inode *inode)
88{
89}
90
91static inline void inotify_d_move(struct dentry *dentry)
92{
93}
94
84static inline void inotify_inode_queue_event(struct inode *inode, 95static inline void inotify_inode_queue_event(struct inode *inode,
85 __u32 mask, __u32 cookie, 96 __u32 mask, __u32 cookie,
86 const char *filename) 97 const char *filename)
diff --git a/include/linux/input.h b/include/linux/input.h
index cf30f3cb191a..393da04f4301 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -957,7 +957,7 @@ struct input_handler {
957 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); 957 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
958 void (*disconnect)(struct input_handle *handle); 958 void (*disconnect)(struct input_handle *handle);
959 959
960 struct file_operations *fops; 960 const struct file_operations *fops;
961 int minor; 961 int minor;
962 char *name; 962 char *name;
963 963
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index d6276e60b3bf..0a84b56935c2 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -36,6 +36,7 @@
36 36
37#include <linux/ipmi_msgdefs.h> 37#include <linux/ipmi_msgdefs.h>
38#include <linux/compiler.h> 38#include <linux/compiler.h>
39#include <linux/device.h>
39 40
40/* 41/*
41 * This file describes an interface to an IPMI driver. You have to 42 * This file describes an interface to an IPMI driver. You have to
@@ -397,7 +398,7 @@ struct ipmi_smi_watcher
397 the watcher list. So you can add and remove users from the 398 the watcher list. So you can add and remove users from the
398 IPMI interface, send messages, etc., but you cannot add 399 IPMI interface, send messages, etc., but you cannot add
399 or remove SMI watchers or SMI interfaces. */ 400 or remove SMI watchers or SMI interfaces. */
400 void (*new_smi)(int if_num); 401 void (*new_smi)(int if_num, struct device *dev);
401 void (*smi_gone)(int if_num); 402 void (*smi_gone)(int if_num);
402}; 403};
403 404
diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h
index 03bc64dc2ec1..22f5e2afda4f 100644
--- a/include/linux/ipmi_msgdefs.h
+++ b/include/linux/ipmi_msgdefs.h
@@ -47,6 +47,7 @@
47#define IPMI_NETFN_APP_RESPONSE 0x07 47#define IPMI_NETFN_APP_RESPONSE 0x07
48#define IPMI_GET_DEVICE_ID_CMD 0x01 48#define IPMI_GET_DEVICE_ID_CMD 0x01
49#define IPMI_CLEAR_MSG_FLAGS_CMD 0x30 49#define IPMI_CLEAR_MSG_FLAGS_CMD 0x30
50#define IPMI_GET_DEVICE_GUID_CMD 0x08
50#define IPMI_GET_MSG_FLAGS_CMD 0x31 51#define IPMI_GET_MSG_FLAGS_CMD 0x31
51#define IPMI_SEND_MSG_CMD 0x34 52#define IPMI_SEND_MSG_CMD 0x34
52#define IPMI_GET_MSG_CMD 0x33 53#define IPMI_GET_MSG_CMD 0x33
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index e36ee157ad67..6d9c7e4da472 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -37,6 +37,9 @@
37#include <linux/ipmi_msgdefs.h> 37#include <linux/ipmi_msgdefs.h>
38#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/device.h>
41#include <linux/platform_device.h>
42#include <linux/ipmi_smi.h>
40 43
41/* This files describes the interface for IPMI system management interface 44/* This files describes the interface for IPMI system management interface
42 drivers to bind into the IPMI message handler. */ 45 drivers to bind into the IPMI message handler. */
@@ -79,6 +82,13 @@ struct ipmi_smi_handlers
79{ 82{
80 struct module *owner; 83 struct module *owner;
81 84
85 /* The low-level interface cannot start sending messages to
86 the upper layer until this function is called. This may
87 not be NULL, the lower layer must take the interface from
88 this call. */
89 int (*start_processing)(void *send_info,
90 ipmi_smi_t new_intf);
91
82 /* Called to enqueue an SMI message to be sent. This 92 /* Called to enqueue an SMI message to be sent. This
83 operation is not allowed to fail. If an error occurs, it 93 operation is not allowed to fail. If an error occurs, it
84 should report back the error in a received message. It may 94 should report back the error in a received message. It may
@@ -113,14 +123,57 @@ struct ipmi_smi_handlers
113 void (*dec_usecount)(void *send_info); 123 void (*dec_usecount)(void *send_info);
114}; 124};
115 125
126struct ipmi_device_id {
127 unsigned char device_id;
128 unsigned char device_revision;
129 unsigned char firmware_revision_1;
130 unsigned char firmware_revision_2;
131 unsigned char ipmi_version;
132 unsigned char additional_device_support;
133 unsigned int manufacturer_id;
134 unsigned int product_id;
135 unsigned char aux_firmware_revision[4];
136 unsigned int aux_firmware_revision_set : 1;
137};
138
139#define ipmi_version_major(v) ((v)->ipmi_version & 0xf)
140#define ipmi_version_minor(v) ((v)->ipmi_version >> 4)
141
142/* Take a pointer to a raw data buffer and a length and extract device
143 id information from it. The first byte of data must point to the
144 byte from the get device id response after the completion code.
145 The caller is responsible for making sure the length is at least
146 11 and the command completed without error. */
147static inline void ipmi_demangle_device_id(unsigned char *data,
148 unsigned int data_len,
149 struct ipmi_device_id *id)
150{
151 id->device_id = data[0];
152 id->device_revision = data[1];
153 id->firmware_revision_1 = data[2];
154 id->firmware_revision_2 = data[3];
155 id->ipmi_version = data[4];
156 id->additional_device_support = data[5];
157 id->manufacturer_id = data[6] | (data[7] << 8) | (data[8] << 16);
158 id->product_id = data[9] | (data[10] << 8);
159 if (data_len >= 15) {
160 memcpy(id->aux_firmware_revision, data+11, 4);
161 id->aux_firmware_revision_set = 1;
162 } else
163 id->aux_firmware_revision_set = 0;
164}
165
116/* Add a low-level interface to the IPMI driver. Note that if the 166/* Add a low-level interface to the IPMI driver. Note that if the
117 interface doesn't know its slave address, it should pass in zero. */ 167 interface doesn't know its slave address, it should pass in zero.
168 The low-level interface should not deliver any messages to the
169 upper layer until the start_processing() function in the handlers
170 is called, and the lower layer must get the interface from that
171 call. */
118int ipmi_register_smi(struct ipmi_smi_handlers *handlers, 172int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
119 void *send_info, 173 void *send_info,
120 unsigned char version_major, 174 struct ipmi_device_id *device_id,
121 unsigned char version_minor, 175 struct device *dev,
122 unsigned char slave_addr, 176 unsigned char slave_addr);
123 ipmi_smi_t *intf);
124 177
125/* 178/*
126 * Remove a low-level interface from the IPMI driver. This will 179 * Remove a low-level interface from the IPMI driver. This will
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 9c8f4c9ed429..1263d8cb3c18 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -145,6 +145,15 @@ struct ipv6_devconf {
145 __s32 max_desync_factor; 145 __s32 max_desync_factor;
146#endif 146#endif
147 __s32 max_addresses; 147 __s32 max_addresses;
148 __s32 accept_ra_defrtr;
149 __s32 accept_ra_pinfo;
150#ifdef CONFIG_IPV6_ROUTER_PREF
151 __s32 accept_ra_rtr_pref;
152 __s32 rtr_probe_interval;
153#ifdef CONFIG_IPV6_ROUTE_INFO
154 __s32 accept_ra_rt_info_max_plen;
155#endif
156#endif
148 void *sysctl; 157 void *sysctl;
149}; 158};
150 159
@@ -167,6 +176,11 @@ enum {
167 DEVCONF_MAX_DESYNC_FACTOR, 176 DEVCONF_MAX_DESYNC_FACTOR,
168 DEVCONF_MAX_ADDRESSES, 177 DEVCONF_MAX_ADDRESSES,
169 DEVCONF_FORCE_MLD_VERSION, 178 DEVCONF_FORCE_MLD_VERSION,
179 DEVCONF_ACCEPT_RA_DEFRTR,
180 DEVCONF_ACCEPT_RA_PINFO,
181 DEVCONF_ACCEPT_RA_RTR_PREF,
182 DEVCONF_RTR_PROBE_INTERVAL,
183 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
170 DEVCONF_MAX 184 DEVCONF_MAX
171}; 185};
172 186
diff --git a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h
index d7c41d1d706a..b323ff577967 100644
--- a/include/linux/ipv6_route.h
+++ b/include/linux/ipv6_route.h
@@ -23,12 +23,22 @@
23#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ 23#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */
24#define RTF_EXPIRES 0x00400000 24#define RTF_EXPIRES 0x00400000
25 25
26#define RTF_ROUTEINFO 0x00800000 /* route information - RA */
27
26#define RTF_CACHE 0x01000000 /* cache entry */ 28#define RTF_CACHE 0x01000000 /* cache entry */
27#define RTF_FLOW 0x02000000 /* flow significant route */ 29#define RTF_FLOW 0x02000000 /* flow significant route */
28#define RTF_POLICY 0x04000000 /* policy route */ 30#define RTF_POLICY 0x04000000 /* policy route */
29 31
32#define RTF_PREF(pref) ((pref) << 27)
33#define RTF_PREF_MASK 0x18000000
34
30#define RTF_LOCAL 0x80000000 35#define RTF_LOCAL 0x80000000
31 36
37#ifdef __KERNEL__
38#define IPV6_EXTRACT_PREF(flag) (((flag) & RTF_PREF_MASK) >> 27)
39#define IPV6_DECODE_PREF(pref) ((pref) ^ 2) /* 1:low,2:med,3:high */
40#endif
41
32struct in6_rtmsg { 42struct in6_rtmsg {
33 struct in6_addr rtmsg_dst; 43 struct in6_addr rtmsg_dst;
34 struct in6_addr rtmsg_src; 44 struct in6_addr rtmsg_src;
diff --git a/include/linux/irda.h b/include/linux/irda.h
index 95dee174cdc5..09d8f105a5a8 100644
--- a/include/linux/irda.h
+++ b/include/linux/irda.h
@@ -76,6 +76,7 @@ typedef enum {
76 IRDA_MCP2120_DONGLE = 9, 76 IRDA_MCP2120_DONGLE = 9,
77 IRDA_ACT200L_DONGLE = 10, 77 IRDA_ACT200L_DONGLE = 10,
78 IRDA_MA600_DONGLE = 11, 78 IRDA_MA600_DONGLE = 11,
79 IRDA_TOIM3232_DONGLE = 12,
79} IRDA_DONGLE; 80} IRDA_DONGLE;
80 81
81/* Protocol types to be used for SOCK_DGRAM */ 82/* Protocol types to be used for SOCK_DGRAM */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 6c5d4c898ccb..ee2a82a572f7 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -114,53 +114,8 @@ static inline void set_native_irq_info(int irq, cpumask_t mask)
114#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) 114#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
115extern cpumask_t pending_irq_cpumask[NR_IRQS]; 115extern cpumask_t pending_irq_cpumask[NR_IRQS];
116 116
117static inline void set_pending_irq(unsigned int irq, cpumask_t mask) 117void set_pending_irq(unsigned int irq, cpumask_t mask);
118{ 118void move_native_irq(int irq);
119 irq_desc_t *desc = irq_desc + irq;
120 unsigned long flags;
121
122 spin_lock_irqsave(&desc->lock, flags);
123 desc->move_irq = 1;
124 pending_irq_cpumask[irq] = mask;
125 spin_unlock_irqrestore(&desc->lock, flags);
126}
127
128static inline void
129move_native_irq(int irq)
130{
131 cpumask_t tmp;
132 irq_desc_t *desc = irq_descp(irq);
133
134 if (likely (!desc->move_irq))
135 return;
136
137 desc->move_irq = 0;
138
139 if (likely(cpus_empty(pending_irq_cpumask[irq])))
140 return;
141
142 if (!desc->handler->set_affinity)
143 return;
144
145 /* note - we hold the desc->lock */
146 cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map);
147
148 /*
149 * If there was a valid mask to work with, please
150 * do the disable, re-program, enable sequence.
151 * This is *not* particularly important for level triggered
152 * but in a edge trigger case, we might be setting rte
153 * when an active trigger is comming in. This could
154 * cause some ioapics to mal-function.
155 * Being paranoid i guess!
156 */
157 if (unlikely(!cpus_empty(tmp))) {
158 desc->handler->disable(irq);
159 desc->handler->set_affinity(irq,tmp);
160 desc->handler->enable(irq);
161 }
162 cpus_clear(pending_irq_cpumask[irq]);
163}
164 119
165#ifdef CONFIG_PCI_MSI 120#ifdef CONFIG_PCI_MSI
166/* 121/*
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 41ee79962bb2..6a425e370cb3 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -28,6 +28,9 @@
28#include <linux/journal-head.h> 28#include <linux/journal-head.h>
29#include <linux/stddef.h> 29#include <linux/stddef.h>
30#include <linux/bit_spinlock.h> 30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h>
32#include <linux/timer.h>
33
31#include <asm/semaphore.h> 34#include <asm/semaphore.h>
32#endif 35#endif
33 36
@@ -575,7 +578,7 @@ struct transaction_s
575 * @j_wait_checkpoint: Wait queue to trigger checkpointing 578 * @j_wait_checkpoint: Wait queue to trigger checkpointing
576 * @j_wait_commit: Wait queue to trigger commit 579 * @j_wait_commit: Wait queue to trigger commit
577 * @j_wait_updates: Wait queue to wait for updates to complete 580 * @j_wait_updates: Wait queue to wait for updates to complete
578 * @j_checkpoint_sem: Semaphore for locking against concurrent checkpoints 581 * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
579 * @j_head: Journal head - identifies the first unused block in the journal 582 * @j_head: Journal head - identifies the first unused block in the journal
580 * @j_tail: Journal tail - identifies the oldest still-used block in the 583 * @j_tail: Journal tail - identifies the oldest still-used block in the
581 * journal. 584 * journal.
@@ -645,7 +648,7 @@ struct journal_s
645 int j_barrier_count; 648 int j_barrier_count;
646 649
647 /* The barrier lock itself */ 650 /* The barrier lock itself */
648 struct semaphore j_barrier; 651 struct mutex j_barrier;
649 652
650 /* 653 /*
651 * Transactions: The current running transaction... 654 * Transactions: The current running transaction...
@@ -687,7 +690,7 @@ struct journal_s
687 wait_queue_head_t j_wait_updates; 690 wait_queue_head_t j_wait_updates;
688 691
689 /* Semaphore for locking against concurrent checkpoints */ 692 /* Semaphore for locking against concurrent checkpoints */
690 struct semaphore j_checkpoint_sem; 693 struct mutex j_checkpoint_mutex;
691 694
692 /* 695 /*
693 * Journal head: identifies the first unused block in the journal. 696 * Journal head: identifies the first unused block in the journal.
@@ -786,7 +789,7 @@ struct journal_s
786 unsigned long j_commit_interval; 789 unsigned long j_commit_interval;
787 790
788 /* The timer used to wakeup the commit thread: */ 791 /* The timer used to wakeup the commit thread: */
789 struct timer_list *j_commit_timer; 792 struct timer_list j_commit_timer;
790 793
791 /* 794 /*
792 * The revoke table: maintains the list of revoked blocks in the 795 * The revoke table: maintains the list of revoked blocks in the
@@ -892,7 +895,7 @@ extern int journal_dirty_metadata (handle_t *, struct buffer_head *);
892extern void journal_release_buffer (handle_t *, struct buffer_head *); 895extern void journal_release_buffer (handle_t *, struct buffer_head *);
893extern int journal_forget (handle_t *, struct buffer_head *); 896extern int journal_forget (handle_t *, struct buffer_head *);
894extern void journal_sync_buffer (struct buffer_head *); 897extern void journal_sync_buffer (struct buffer_head *);
895extern int journal_invalidatepage(journal_t *, 898extern void journal_invalidatepage(journal_t *,
896 struct page *, unsigned long); 899 struct page *, unsigned long);
897extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 900extern int journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
898extern int journal_stop(handle_t *); 901extern int journal_stop(handle_t *);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3b507bf05d09..a3720f973ea5 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -87,10 +87,13 @@ extern int cond_resched(void);
87 (__x < 0) ? -__x : __x; \ 87 (__x < 0) ? -__x : __x; \
88 }) 88 })
89 89
90extern struct notifier_block *panic_notifier_list; 90extern struct atomic_notifier_head panic_notifier_list;
91extern long (*panic_blink)(long time); 91extern long (*panic_blink)(long time);
92NORET_TYPE void panic(const char * fmt, ...) 92NORET_TYPE void panic(const char * fmt, ...)
93 __attribute__ ((NORET_AND format (printf, 1, 2))); 93 __attribute__ ((NORET_AND format (printf, 1, 2)));
94extern void oops_enter(void);
95extern void oops_exit(void);
96extern int oops_may_print(void);
94fastcall NORET_TYPE void do_exit(long error_code) 97fastcall NORET_TYPE void do_exit(long error_code)
95 ATTRIB_NORET; 98 ATTRIB_NORET;
96NORET_TYPE void complete_and_exit(struct completion *, long) 99NORET_TYPE void complete_and_exit(struct completion *, long)
@@ -151,9 +154,10 @@ static inline int __attribute_pure__ long_log2(unsigned long x)
151 return r; 154 return r;
152} 155}
153 156
154static inline unsigned long __attribute_const__ roundup_pow_of_two(unsigned long x) 157static inline unsigned long
158__attribute_const__ roundup_pow_of_two(unsigned long x)
155{ 159{
156 return (1UL << fls(x - 1)); 160 return 1UL << fls_long(x - 1);
157} 161}
158 162
159extern int printk_ratelimit(void); 163extern int printk_ratelimit(void);
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index a484572c302e..b46249082cca 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -46,7 +46,7 @@ static inline int kstat_irqs(int irq)
46{ 46{
47 int cpu, sum = 0; 47 int cpu, sum = 0;
48 48
49 for_each_cpu(cpu) 49 for_each_possible_cpu(cpu)
50 sum += kstat_cpu(cpu).irqs[irq]; 50 sum += kstat_cpu(cpu).irqs[irq];
51 51
52 return sum; 52 return sum;
diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h
index cbe7d8008042..bafe178a381f 100644
--- a/include/linux/kobj_map.h
+++ b/include/linux/kobj_map.h
@@ -1,6 +1,6 @@
1#ifdef __KERNEL__ 1#ifdef __KERNEL__
2 2
3#include <asm/semaphore.h> 3#include <linux/mutex.h>
4 4
5typedef struct kobject *kobj_probe_t(dev_t, int *, void *); 5typedef struct kobject *kobj_probe_t(dev_t, int *, void *);
6struct kobj_map; 6struct kobj_map;
@@ -9,6 +9,6 @@ int kobj_map(struct kobj_map *, dev_t, unsigned long, struct module *,
9 kobj_probe_t *, int (*)(dev_t, void *), void *); 9 kobj_probe_t *, int (*)(dev_t, void *), void *);
10void kobj_unmap(struct kobj_map *, dev_t, unsigned long); 10void kobj_unmap(struct kobj_map *, dev_t, unsigned long);
11struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); 11struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *);
12struct kobj_map *kobj_map_init(kobj_probe_t *, struct semaphore *); 12struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *);
13 13
14#endif 14#endif
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index c374b5fa8d3b..4cb1214ec290 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -80,6 +80,8 @@ extern void kobject_unregister(struct kobject *);
80extern struct kobject * kobject_get(struct kobject *); 80extern struct kobject * kobject_get(struct kobject *);
81extern void kobject_put(struct kobject *); 81extern void kobject_put(struct kobject *);
82 82
83extern struct kobject *kobject_add_dir(struct kobject *, const char *);
84
83extern char * kobject_get_path(struct kobject *, gfp_t); 85extern char * kobject_get_path(struct kobject *, gfp_t);
84 86
85struct kobj_type { 87struct kobj_type {
@@ -255,7 +257,7 @@ struct subsys_attribute {
255extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); 257extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);
256extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); 258extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);
257 259
258#if defined(CONFIG_HOTPLUG) & defined(CONFIG_NET) 260#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
259void kobject_uevent(struct kobject *kobj, enum kobject_action action); 261void kobject_uevent(struct kobject *kobj, enum kobject_action action);
260 262
261int add_uevent_var(char **envp, int num_envp, int *cur_index, 263int add_uevent_var(char **envp, int num_envp, int *cur_index,
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 669756bc20a2..778adc0fa640 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -36,6 +36,7 @@
36#include <linux/percpu.h> 36#include <linux/percpu.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/rcupdate.h> 38#include <linux/rcupdate.h>
39#include <linux/mutex.h>
39 40
40#ifdef CONFIG_KPROBES 41#ifdef CONFIG_KPROBES
41#include <asm/kprobes.h> 42#include <asm/kprobes.h>
@@ -152,7 +153,7 @@ struct kretprobe_instance {
152}; 153};
153 154
154extern spinlock_t kretprobe_lock; 155extern spinlock_t kretprobe_lock;
155extern struct semaphore kprobe_mutex; 156extern struct mutex kprobe_mutex;
156extern int arch_prepare_kprobe(struct kprobe *p); 157extern int arch_prepare_kprobe(struct kprobe *p);
157extern void arch_arm_kprobe(struct kprobe *p); 158extern void arch_arm_kprobe(struct kprobe *p);
158extern void arch_disarm_kprobe(struct kprobe *p); 159extern void arch_disarm_kprobe(struct kprobe *p);
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index f3dec45ef874..62bc57580707 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -64,9 +64,6 @@ typedef union {
64 64
65#if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR) 65#if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)
66 66
67/* Define a ktime_t variable and initialize it to zero: */
68#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
69
70/** 67/**
71 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value 68 * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value
72 * 69 *
@@ -113,9 +110,6 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
113/* Map the ktime_t to timeval conversion to ns_to_timeval function */ 110/* Map the ktime_t to timeval conversion to ns_to_timeval function */
114#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64) 111#define ktime_to_timeval(kt) ns_to_timeval((kt).tv64)
115 112
116/* Map the ktime_t to clock_t conversion to the inline in jiffies.h: */
117#define ktime_to_clock_t(kt) nsec_to_clock_t((kt).tv64)
118
119/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ 113/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
120#define ktime_to_ns(kt) ((kt).tv64) 114#define ktime_to_ns(kt) ((kt).tv64)
121 115
@@ -136,9 +130,6 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
136 * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC 130 * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC
137 */ 131 */
138 132
139/* Define a ktime_t variable and initialize it to zero: */
140#define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 }
141
142/* Set a ktime_t variable to a value in sec/nsec representation: */ 133/* Set a ktime_t variable to a value in sec/nsec representation: */
143static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) 134static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
144{ 135{
@@ -255,17 +246,6 @@ static inline struct timeval ktime_to_timeval(const ktime_t kt)
255} 246}
256 247
257/** 248/**
258 * ktime_to_clock_t - convert a ktime_t variable to clock_t format
259 * @kt: the ktime_t variable to convert
260 *
261 * Returns a clock_t variable with the converted value
262 */
263static inline clock_t ktime_to_clock_t(const ktime_t kt)
264{
265 return nsec_to_clock_t( (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec);
266}
267
268/**
269 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds 249 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds
270 * @kt: the ktime_t variable to convert 250 * @kt: the ktime_t variable to convert
271 * 251 *
diff --git a/include/linux/leds.h b/include/linux/leds.h
new file mode 100644
index 000000000000..4617e75903b0
--- /dev/null
+++ b/include/linux/leds.h
@@ -0,0 +1,111 @@
1/*
2 * Driver model for leds and led triggers
3 *
4 * Copyright (C) 2005 John Lenz <lenz@cs.wisc.edu>
5 * Copyright (C) 2005 Richard Purdie <rpurdie@openedhand.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12#ifndef __LINUX_LEDS_H_INCLUDED
13#define __LINUX_LEDS_H_INCLUDED
14
15struct device;
16struct class_device;
17/*
18 * LED Core
19 */
20
21enum led_brightness {
22 LED_OFF = 0,
23 LED_HALF = 127,
24 LED_FULL = 255,
25};
26
27struct led_classdev {
28 const char *name;
29 int brightness;
30 int flags;
31#define LED_SUSPENDED (1 << 0)
32
33 /* A function to set the brightness of the led */
34 void (*brightness_set)(struct led_classdev *led_cdev,
35 enum led_brightness brightness);
36
37 struct class_device *class_dev;
38 /* LED Device linked list */
39 struct list_head node;
40
41 /* Trigger data */
42 char *default_trigger;
43#ifdef CONFIG_LEDS_TRIGGERS
44 rwlock_t trigger_lock;
45 /* Protects the trigger data below */
46
47 struct led_trigger *trigger;
48 struct list_head trig_list;
49 void *trigger_data;
50#endif
51};
52
53extern int led_classdev_register(struct device *parent,
54 struct led_classdev *led_cdev);
55extern void led_classdev_unregister(struct led_classdev *led_cdev);
56extern void led_classdev_suspend(struct led_classdev *led_cdev);
57extern void led_classdev_resume(struct led_classdev *led_cdev);
58
59/*
60 * LED Triggers
61 */
62#ifdef CONFIG_LEDS_TRIGGERS
63
64#define TRIG_NAME_MAX 50
65
66struct led_trigger {
67 /* Trigger Properties */
68 const char *name;
69 void (*activate)(struct led_classdev *led_cdev);
70 void (*deactivate)(struct led_classdev *led_cdev);
71
72 /* LEDs under control by this trigger (for simple triggers) */
73 rwlock_t leddev_list_lock;
74 struct list_head led_cdevs;
75
76 /* Link to next registered trigger */
77 struct list_head next_trig;
78};
79
80/* Registration functions for complex triggers */
81extern int led_trigger_register(struct led_trigger *trigger);
82extern void led_trigger_unregister(struct led_trigger *trigger);
83
84/* Registration functions for simple triggers */
85#define DEFINE_LED_TRIGGER(x) static struct led_trigger *x;
86#define DEFINE_LED_TRIGGER_GLOBAL(x) struct led_trigger *x;
87extern void led_trigger_register_simple(const char *name,
88 struct led_trigger **trigger);
89extern void led_trigger_unregister_simple(struct led_trigger *trigger);
90extern void led_trigger_event(struct led_trigger *trigger,
91 enum led_brightness event);
92
93#else
94
95/* Triggers aren't active - null macros */
96#define DEFINE_LED_TRIGGER(x)
97#define DEFINE_LED_TRIGGER_GLOBAL(x)
98#define led_trigger_register_simple(x, y) do {} while(0)
99#define led_trigger_unregister_simple(x) do {} while(0)
100#define led_trigger_event(x, y) do {} while(0)
101
102#endif
103
104/* Trigger specific functions */
105#ifdef CONFIG_LEDS_TRIGGER_IDE_DISK
106extern void ledtrig_ide_activity(void);
107#else
108#define ledtrig_ide_activity() do {} while(0)
109#endif
110
111#endif /* __LINUX_LEDS_H_INCLUDED */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index c91be5e64ede..0d61357604d5 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -35,7 +35,8 @@
35#include <linux/workqueue.h> 35#include <linux/workqueue.h>
36 36
37/* 37/*
38 * compile-time options 38 * compile-time options: to be removed as soon as all the drivers are
39 * converted to the new debugging mechanism
39 */ 40 */
40#undef ATA_DEBUG /* debugging output */ 41#undef ATA_DEBUG /* debugging output */
41#undef ATA_VERBOSE_DEBUG /* yet more debugging output */ 42#undef ATA_VERBOSE_DEBUG /* yet more debugging output */
@@ -61,15 +62,37 @@
61 62
62#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) 63#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
63 64
64#ifdef ATA_NDEBUG 65/* NEW: debug levels */
65#define assert(expr) 66#define HAVE_LIBATA_MSG 1
66#else 67
67#define assert(expr) \ 68enum {
68 if(unlikely(!(expr))) { \ 69 ATA_MSG_DRV = 0x0001,
69 printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \ 70 ATA_MSG_INFO = 0x0002,
70 #expr,__FILE__,__FUNCTION__,__LINE__); \ 71 ATA_MSG_PROBE = 0x0004,
71 } 72 ATA_MSG_WARN = 0x0008,
72#endif 73 ATA_MSG_MALLOC = 0x0010,
74 ATA_MSG_CTL = 0x0020,
75 ATA_MSG_INTR = 0x0040,
76 ATA_MSG_ERR = 0x0080,
77};
78
79#define ata_msg_drv(p) ((p)->msg_enable & ATA_MSG_DRV)
80#define ata_msg_info(p) ((p)->msg_enable & ATA_MSG_INFO)
81#define ata_msg_probe(p) ((p)->msg_enable & ATA_MSG_PROBE)
82#define ata_msg_warn(p) ((p)->msg_enable & ATA_MSG_WARN)
83#define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC)
84#define ata_msg_ctl(p) ((p)->msg_enable & ATA_MSG_CTL)
85#define ata_msg_intr(p) ((p)->msg_enable & ATA_MSG_INTR)
86#define ata_msg_err(p) ((p)->msg_enable & ATA_MSG_ERR)
87
88static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
89{
90 if (dval < 0 || dval >= (sizeof(u32) * 8))
91 return default_msg_enable_bits; /* should be 0x1 - only driver info msgs */
92 if (!dval)
93 return 0;
94 return (1 << dval) - 1;
95}
73 96
74/* defines only for the constants which don't work well as enums */ 97/* defines only for the constants which don't work well as enums */
75#define ATA_TAG_POISON 0xfafbfcfdU 98#define ATA_TAG_POISON 0xfafbfcfdU
@@ -99,8 +122,7 @@ enum {
99 /* struct ata_device stuff */ 122 /* struct ata_device stuff */
100 ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */ 123 ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */
101 ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ 124 ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */
102 ATA_DFLAG_LOCK_SECTORS = (1 << 2), /* don't adjust max_sectors */ 125 ATA_DFLAG_LBA = (1 << 2), /* device supports LBA */
103 ATA_DFLAG_LBA = (1 << 3), /* device supports LBA */
104 126
105 ATA_DEV_UNKNOWN = 0, /* unknown device */ 127 ATA_DEV_UNKNOWN = 0, /* unknown device */
106 ATA_DEV_ATA = 1, /* ATA device */ 128 ATA_DEV_ATA = 1, /* ATA device */
@@ -115,9 +137,9 @@ enum {
115 ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */ 137 ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */
116 ATA_FLAG_SATA = (1 << 3), 138 ATA_FLAG_SATA = (1 << 3),
117 ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */ 139 ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */
118 ATA_FLAG_SRST = (1 << 5), /* use ATA SRST, not E.D.D. */ 140 ATA_FLAG_SRST = (1 << 5), /* (obsolete) use ATA SRST, not E.D.D. */
119 ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ 141 ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */
120 ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */ 142 ATA_FLAG_SATA_RESET = (1 << 7), /* (obsolete) use COMRESET */
121 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ 143 ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */
122 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once 144 ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once
123 * proper HSM is in place. */ 145 * proper HSM is in place. */
@@ -129,13 +151,19 @@ enum {
129 ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */ 151 ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */
130 ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */ 152 ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */
131 153
154 ATA_FLAG_FLUSH_PORT_TASK = (1 << 15), /* Flush port task */
155 ATA_FLAG_IN_EH = (1 << 16), /* EH in progress */
156
132 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ 157 ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
133 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ 158 ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
134 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ 159 ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */
135 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, 160 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
161 ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */
136 162
163 /* host set flags */
164 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host_set only */
165
137 /* various lengths of time */ 166 /* various lengths of time */
138 ATA_TMOUT_EDD = 5 * HZ, /* heuristic */
139 ATA_TMOUT_PIO = 30 * HZ, 167 ATA_TMOUT_PIO = 30 * HZ,
140 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 168 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
141 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 169 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */
@@ -162,11 +190,19 @@ enum {
162 PORT_DISABLED = 2, 190 PORT_DISABLED = 2,
163 191
164 /* encoding various smaller bitmaps into a single 192 /* encoding various smaller bitmaps into a single
165 * unsigned long bitmap 193 * unsigned int bitmap
166 */ 194 */
167 ATA_SHIFT_UDMA = 0, 195 ATA_BITS_PIO = 5,
168 ATA_SHIFT_MWDMA = 8, 196 ATA_BITS_MWDMA = 3,
169 ATA_SHIFT_PIO = 11, 197 ATA_BITS_UDMA = 8,
198
199 ATA_SHIFT_PIO = 0,
200 ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_BITS_PIO,
201 ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_BITS_MWDMA,
202
203 ATA_MASK_PIO = ((1 << ATA_BITS_PIO) - 1) << ATA_SHIFT_PIO,
204 ATA_MASK_MWDMA = ((1 << ATA_BITS_MWDMA) - 1) << ATA_SHIFT_MWDMA,
205 ATA_MASK_UDMA = ((1 << ATA_BITS_UDMA) - 1) << ATA_SHIFT_UDMA,
170 206
171 /* size of buffer to pad xfers ending on unaligned boundaries */ 207 /* size of buffer to pad xfers ending on unaligned boundaries */
172 ATA_DMA_PAD_SZ = 4, 208 ATA_DMA_PAD_SZ = 4,
@@ -189,10 +225,15 @@ enum hsm_task_states {
189}; 225};
190 226
191enum ata_completion_errors { 227enum ata_completion_errors {
192 AC_ERR_OTHER = (1 << 0), 228 AC_ERR_DEV = (1 << 0), /* device reported error */
193 AC_ERR_DEV = (1 << 1), 229 AC_ERR_HSM = (1 << 1), /* host state machine violation */
194 AC_ERR_ATA_BUS = (1 << 2), 230 AC_ERR_TIMEOUT = (1 << 2), /* timeout */
195 AC_ERR_HOST_BUS = (1 << 3), 231 AC_ERR_MEDIA = (1 << 3), /* media error */
232 AC_ERR_ATA_BUS = (1 << 4), /* ATA bus error */
233 AC_ERR_HOST_BUS = (1 << 5), /* host bus error */
234 AC_ERR_SYSTEM = (1 << 6), /* system error */
235 AC_ERR_INVALID = (1 << 7), /* invalid argument */
236 AC_ERR_OTHER = (1 << 8), /* unknown */
196}; 237};
197 238
198/* forward declarations */ 239/* forward declarations */
@@ -202,7 +243,10 @@ struct ata_port;
202struct ata_queued_cmd; 243struct ata_queued_cmd;
203 244
204/* typedefs */ 245/* typedefs */
205typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc); 246typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
247typedef void (*ata_probeinit_fn_t)(struct ata_port *);
248typedef int (*ata_reset_fn_t)(struct ata_port *, int, unsigned int *);
249typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *);
206 250
207struct ata_ioports { 251struct ata_ioports {
208 unsigned long cmd_addr; 252 unsigned long cmd_addr;
@@ -237,6 +281,7 @@ struct ata_probe_ent {
237 unsigned long irq; 281 unsigned long irq;
238 unsigned int irq_flags; 282 unsigned int irq_flags;
239 unsigned long host_flags; 283 unsigned long host_flags;
284 unsigned long host_set_flags;
240 void __iomem *mmio_base; 285 void __iomem *mmio_base;
241 void *private_data; 286 void *private_data;
242}; 287};
@@ -249,6 +294,9 @@ struct ata_host_set {
249 unsigned int n_ports; 294 unsigned int n_ports;
250 void *private_data; 295 void *private_data;
251 const struct ata_port_operations *ops; 296 const struct ata_port_operations *ops;
297 unsigned long flags;
298 int simplex_claimed; /* Keep seperate in case we
299 ever need to do this locked */
252 struct ata_port * ports[0]; 300 struct ata_port * ports[0];
253}; 301};
254 302
@@ -305,7 +353,7 @@ struct ata_device {
305 unsigned long flags; /* ATA_DFLAG_xxx */ 353 unsigned long flags; /* ATA_DFLAG_xxx */
306 unsigned int class; /* ATA_DEV_xxx */ 354 unsigned int class; /* ATA_DEV_xxx */
307 unsigned int devno; /* 0 or 1 */ 355 unsigned int devno; /* 0 or 1 */
308 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ 356 u16 *id; /* IDENTIFY xxx DEVICE data */
309 u8 pio_mode; 357 u8 pio_mode;
310 u8 dma_mode; 358 u8 dma_mode;
311 u8 xfer_mode; 359 u8 xfer_mode;
@@ -313,6 +361,13 @@ struct ata_device {
313 361
314 unsigned int multi_count; /* sectors count for 362 unsigned int multi_count; /* sectors count for
315 READ/WRITE MULTIPLE */ 363 READ/WRITE MULTIPLE */
364 unsigned int max_sectors; /* per-device max sectors */
365 unsigned int cdb_len;
366
367 /* per-dev xfer mask */
368 unsigned int pio_mask;
369 unsigned int mwdma_mask;
370 unsigned int udma_mask;
316 371
317 /* for CHS addressing */ 372 /* for CHS addressing */
318 u16 cylinders; /* Number of cylinders */ 373 u16 cylinders; /* Number of cylinders */
@@ -342,7 +397,6 @@ struct ata_port {
342 unsigned int mwdma_mask; 397 unsigned int mwdma_mask;
343 unsigned int udma_mask; 398 unsigned int udma_mask;
344 unsigned int cbl; /* cable type; ATA_CBL_xxx */ 399 unsigned int cbl; /* cable type; ATA_CBL_xxx */
345 unsigned int cdb_len;
346 400
347 struct ata_device device[ATA_MAX_DEVICES]; 401 struct ata_device device[ATA_MAX_DEVICES];
348 402
@@ -352,13 +406,16 @@ struct ata_port {
352 406
353 struct ata_host_stats stats; 407 struct ata_host_stats stats;
354 struct ata_host_set *host_set; 408 struct ata_host_set *host_set;
409 struct device *dev;
355 410
356 struct work_struct packet_task; 411 struct work_struct port_task;
357 412
358 struct work_struct pio_task;
359 unsigned int hsm_task_state; 413 unsigned int hsm_task_state;
360 unsigned long pio_task_timeout; 414 unsigned long pio_task_timeout;
361 415
416 u32 msg_enable;
417 struct list_head eh_done_q;
418
362 void *private_data; 419 void *private_data;
363}; 420};
364 421
@@ -369,6 +426,7 @@ struct ata_port_operations {
369 426
370 void (*set_piomode) (struct ata_port *, struct ata_device *); 427 void (*set_piomode) (struct ata_port *, struct ata_device *);
371 void (*set_dmamode) (struct ata_port *, struct ata_device *); 428 void (*set_dmamode) (struct ata_port *, struct ata_device *);
429 unsigned long (*mode_filter) (const struct ata_port *, struct ata_device *, unsigned long);
372 430
373 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf); 431 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf);
374 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); 432 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
@@ -378,7 +436,10 @@ struct ata_port_operations {
378 u8 (*check_altstatus)(struct ata_port *ap); 436 u8 (*check_altstatus)(struct ata_port *ap);
379 void (*dev_select)(struct ata_port *ap, unsigned int device); 437 void (*dev_select)(struct ata_port *ap, unsigned int device);
380 438
381 void (*phy_reset) (struct ata_port *ap); 439 void (*phy_reset) (struct ata_port *ap); /* obsolete */
440 void (*set_mode) (struct ata_port *ap);
441 int (*probe_reset) (struct ata_port *ap, unsigned int *classes);
442
382 void (*post_set_mode) (struct ata_port *ap); 443 void (*post_set_mode) (struct ata_port *ap);
383 444
384 int (*check_atapi_dma) (struct ata_queued_cmd *qc); 445 int (*check_atapi_dma) (struct ata_queued_cmd *qc);
@@ -387,7 +448,7 @@ struct ata_port_operations {
387 void (*bmdma_start) (struct ata_queued_cmd *qc); 448 void (*bmdma_start) (struct ata_queued_cmd *qc);
388 449
389 void (*qc_prep) (struct ata_queued_cmd *qc); 450 void (*qc_prep) (struct ata_queued_cmd *qc);
390 int (*qc_issue) (struct ata_queued_cmd *qc); 451 unsigned int (*qc_issue) (struct ata_queued_cmd *qc);
391 452
392 void (*eng_timeout) (struct ata_port *ap); 453 void (*eng_timeout) (struct ata_port *ap);
393 454
@@ -435,6 +496,18 @@ extern void ata_port_probe(struct ata_port *);
435extern void __sata_phy_reset(struct ata_port *ap); 496extern void __sata_phy_reset(struct ata_port *ap);
436extern void sata_phy_reset(struct ata_port *ap); 497extern void sata_phy_reset(struct ata_port *ap);
437extern void ata_bus_reset(struct ata_port *ap); 498extern void ata_bus_reset(struct ata_port *ap);
499extern int ata_drive_probe_reset(struct ata_port *ap,
500 ata_probeinit_fn_t probeinit,
501 ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
502 ata_postreset_fn_t postreset, unsigned int *classes);
503extern void ata_std_probeinit(struct ata_port *ap);
504extern int ata_std_softreset(struct ata_port *ap, int verbose,
505 unsigned int *classes);
506extern int sata_std_hardreset(struct ata_port *ap, int verbose,
507 unsigned int *class);
508extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes);
509extern int ata_dev_revalidate(struct ata_port *ap, struct ata_device *dev,
510 int post_reset);
438extern void ata_port_disable(struct ata_port *); 511extern void ata_port_disable(struct ata_port *);
439extern void ata_std_ports(struct ata_ioports *ioaddr); 512extern void ata_std_ports(struct ata_ioports *ioaddr);
440#ifdef CONFIG_PCI 513#ifdef CONFIG_PCI
@@ -443,6 +516,7 @@ extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_i
443extern void ata_pci_remove_one (struct pci_dev *pdev); 516extern void ata_pci_remove_one (struct pci_dev *pdev);
444extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state); 517extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
445extern int ata_pci_device_resume(struct pci_dev *pdev); 518extern int ata_pci_device_resume(struct pci_dev *pdev);
519extern int ata_pci_clear_simplex(struct pci_dev *pdev);
446#endif /* CONFIG_PCI */ 520#endif /* CONFIG_PCI */
447extern int ata_device_add(const struct ata_probe_ent *ent); 521extern int ata_device_add(const struct ata_probe_ent *ent);
448extern void ata_host_set_remove(struct ata_host_set *host_set); 522extern void ata_host_set_remove(struct ata_host_set *host_set);
@@ -450,13 +524,20 @@ extern int ata_scsi_detect(struct scsi_host_template *sht);
450extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 524extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
451extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 525extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
452extern int ata_scsi_error(struct Scsi_Host *host); 526extern int ata_scsi_error(struct Scsi_Host *host);
527extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
528extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
453extern int ata_scsi_release(struct Scsi_Host *host); 529extern int ata_scsi_release(struct Scsi_Host *host);
454extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 530extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
455extern int ata_scsi_device_resume(struct scsi_device *); 531extern int ata_scsi_device_resume(struct scsi_device *);
456extern int ata_scsi_device_suspend(struct scsi_device *); 532extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t state);
457extern int ata_device_resume(struct ata_port *, struct ata_device *); 533extern int ata_device_resume(struct ata_port *, struct ata_device *);
458extern int ata_device_suspend(struct ata_port *, struct ata_device *); 534extern int ata_device_suspend(struct ata_port *, struct ata_device *, pm_message_t state);
459extern int ata_ratelimit(void); 535extern int ata_ratelimit(void);
536extern unsigned int ata_busy_sleep(struct ata_port *ap,
537 unsigned long timeout_pat,
538 unsigned long timeout);
539extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *),
540 void *data, unsigned long delay);
460 541
461/* 542/*
462 * Default driver ops implementations 543 * Default driver ops implementations
@@ -470,26 +551,29 @@ extern void ata_std_dev_select (struct ata_port *ap, unsigned int device);
470extern u8 ata_check_status(struct ata_port *ap); 551extern u8 ata_check_status(struct ata_port *ap);
471extern u8 ata_altstatus(struct ata_port *ap); 552extern u8 ata_altstatus(struct ata_port *ap);
472extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); 553extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
554extern int ata_std_probe_reset(struct ata_port *ap, unsigned int *classes);
473extern int ata_port_start (struct ata_port *ap); 555extern int ata_port_start (struct ata_port *ap);
474extern void ata_port_stop (struct ata_port *ap); 556extern void ata_port_stop (struct ata_port *ap);
475extern void ata_host_stop (struct ata_host_set *host_set); 557extern void ata_host_stop (struct ata_host_set *host_set);
476extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); 558extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
477extern void ata_qc_prep(struct ata_queued_cmd *qc); 559extern void ata_qc_prep(struct ata_queued_cmd *qc);
478extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); 560extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
561extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
479extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, 562extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
480 unsigned int buflen); 563 unsigned int buflen);
481extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 564extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
482 unsigned int n_elem); 565 unsigned int n_elem);
483extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); 566extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
484extern void ata_dev_id_string(const u16 *id, unsigned char *s, 567extern void ata_id_string(const u16 *id, unsigned char *s,
485 unsigned int ofs, unsigned int len); 568 unsigned int ofs, unsigned int len);
486extern void ata_dev_config(struct ata_port *ap, unsigned int i); 569extern void ata_id_c_string(const u16 *id, unsigned char *s,
570 unsigned int ofs, unsigned int len);
487extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 571extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
488extern void ata_bmdma_start (struct ata_queued_cmd *qc); 572extern void ata_bmdma_start (struct ata_queued_cmd *qc);
489extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 573extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
490extern u8 ata_bmdma_status(struct ata_port *ap); 574extern u8 ata_bmdma_status(struct ata_port *ap);
491extern void ata_bmdma_irq_clear(struct ata_port *ap); 575extern void ata_bmdma_irq_clear(struct ata_port *ap);
492extern void ata_qc_complete(struct ata_queued_cmd *qc); 576extern void __ata_qc_complete(struct ata_queued_cmd *qc);
493extern void ata_eng_timeout(struct ata_port *ap); 577extern void ata_eng_timeout(struct ata_port *ap);
494extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, 578extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev,
495 struct scsi_cmnd *cmd, 579 struct scsi_cmnd *cmd,
@@ -498,6 +582,8 @@ extern int ata_std_bios_param(struct scsi_device *sdev,
498 struct block_device *bdev, 582 struct block_device *bdev,
499 sector_t capacity, int geom[]); 583 sector_t capacity, int geom[]);
500extern int ata_scsi_slave_config(struct scsi_device *sdev); 584extern int ata_scsi_slave_config(struct scsi_device *sdev);
585extern struct ata_device *ata_dev_pair(struct ata_port *ap,
586 struct ata_device *adev);
501 587
502/* 588/*
503 * Timing helpers 589 * Timing helpers
@@ -540,7 +626,7 @@ extern void ata_pci_host_stop (struct ata_host_set *host_set);
540extern struct ata_probe_ent * 626extern struct ata_probe_ent *
541ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); 627ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask);
542extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 628extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
543 629extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long);
544#endif /* CONFIG_PCI */ 630#endif /* CONFIG_PCI */
545 631
546 632
@@ -586,10 +672,14 @@ static inline unsigned int ata_tag_valid(unsigned int tag)
586 return (tag < ATA_MAX_QUEUE) ? 1 : 0; 672 return (tag < ATA_MAX_QUEUE) ? 1 : 0;
587} 673}
588 674
675static inline unsigned int ata_class_present(unsigned int class)
676{
677 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI;
678}
679
589static inline unsigned int ata_dev_present(const struct ata_device *dev) 680static inline unsigned int ata_dev_present(const struct ata_device *dev)
590{ 681{
591 return ((dev->class == ATA_DEV_ATA) || 682 return ata_class_present(dev->class);
592 (dev->class == ATA_DEV_ATAPI));
593} 683}
594 684
595static inline u8 ata_chk_status(struct ata_port *ap) 685static inline u8 ata_chk_status(struct ata_port *ap)
@@ -657,9 +747,9 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
657 747
658 if (status & (ATA_BUSY | ATA_DRQ)) { 748 if (status & (ATA_BUSY | ATA_DRQ)) {
659 unsigned long l = ap->ioaddr.status_addr; 749 unsigned long l = ap->ioaddr.status_addr;
660 printk(KERN_WARNING 750 if (ata_msg_warn(ap))
661 "ATA: abnormal status 0x%X on port 0x%lX\n", 751 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
662 status, l); 752 status, l);
663 } 753 }
664 754
665 return status; 755 return status;
@@ -701,6 +791,24 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
701 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); 791 ata_tf_init(qc->ap, &qc->tf, qc->dev->devno);
702} 792}
703 793
794/**
795 * ata_qc_complete - Complete an active ATA command
796 * @qc: Command to complete
797 * @err_mask: ATA Status register contents
798 *
799 * Indicate to the mid and upper layers that an ATA
800 * command has completed, with either an ok or not-ok status.
801 *
802 * LOCKING:
803 * spin_lock_irqsave(host_set lock)
804 */
805static inline void ata_qc_complete(struct ata_queued_cmd *qc)
806{
807 if (unlikely(qc->flags & ATA_QCFLAG_EH_SCHEDULED))
808 return;
809
810 __ata_qc_complete(qc);
811}
704 812
705/** 813/**
706 * ata_irq_on - Enable interrupts on a port. 814 * ata_irq_on - Enable interrupts on a port.
@@ -751,7 +859,8 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
751 859
752 status = ata_busy_wait(ap, bits, 1000); 860 status = ata_busy_wait(ap, bits, 1000);
753 if (status & bits) 861 if (status & bits)
754 DPRINTK("abnormal status 0x%X\n", status); 862 if (ata_msg_err(ap))
863 printk(KERN_ERR "abnormal status 0x%X\n", status);
755 864
756 /* get controller status; clear intr, err bits */ 865 /* get controller status; clear intr, err bits */
757 if (ap->flags & ATA_FLAG_MMIO) { 866 if (ap->flags & ATA_FLAG_MMIO) {
@@ -769,8 +878,10 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
769 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 878 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
770 } 879 }
771 880
772 VPRINTK("irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", 881 if (ata_msg_intr(ap))
773 host_stat, post_stat, status); 882 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
883 __FUNCTION__,
884 host_stat, post_stat, status);
774 885
775 return status; 886 return status;
776} 887}
@@ -807,7 +918,7 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
807static inline unsigned int ac_err_mask(u8 status) 918static inline unsigned int ac_err_mask(u8 status)
808{ 919{
809 if (status & ATA_BUSY) 920 if (status & ATA_BUSY)
810 return AC_ERR_ATA_BUS; 921 return AC_ERR_HSM;
811 if (status & (ATA_ERR | ATA_DF)) 922 if (status & (ATA_ERR | ATA_DF))
812 return AC_ERR_DEV; 923 return AC_ERR_DEV;
813 return 0; 924 return 0;
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 147eb01e0d4b..c08c9983e840 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -28,17 +28,27 @@
28#define ALIGN __ALIGN 28#define ALIGN __ALIGN
29#define ALIGN_STR __ALIGN_STR 29#define ALIGN_STR __ALIGN_STR
30 30
31#ifndef ENTRY
31#define ENTRY(name) \ 32#define ENTRY(name) \
32 .globl name; \ 33 .globl name; \
33 ALIGN; \ 34 ALIGN; \
34 name: 35 name:
36#endif
35 37
36#define KPROBE_ENTRY(name) \ 38#define KPROBE_ENTRY(name) \
37 .section .kprobes.text, "ax"; \ 39 .section .kprobes.text, "ax"; \
38 .globl name; \ 40 ENTRY(name)
39 ALIGN; \
40 name:
41 41
42#ifndef END
43#define END(name) \
44 .size name, .-name
45#endif
46
47#ifndef ENDPROC
48#define ENDPROC(name) \
49 .type name, @function; \
50 END(name)
51#endif
42 52
43#endif 53#endif
44 54
diff --git a/include/linux/list.h b/include/linux/list.h
index 47208bd99f9e..67258b47e9ca 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -411,6 +411,17 @@ static inline void list_splice_init(struct list_head *list,
411 pos = list_entry(pos->member.next, typeof(*pos), member)) 411 pos = list_entry(pos->member.next, typeof(*pos), member))
412 412
413/** 413/**
414 * list_for_each_entry_from - iterate over list of given type
415 * continuing from existing point
416 * @pos: the type * to use as a loop counter.
417 * @head: the head for your list.
418 * @member: the name of the list_struct within the struct.
419 */
420#define list_for_each_entry_from(pos, head, member) \
421 for (; prefetch(pos->member.next), &pos->member != (head); \
422 pos = list_entry(pos->member.next, typeof(*pos), member))
423
424/**
414 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 425 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
415 * @pos: the type * to use as a loop counter. 426 * @pos: the type * to use as a loop counter.
416 * @n: another type * to use as temporary storage 427 * @n: another type * to use as temporary storage
@@ -438,6 +449,19 @@ static inline void list_splice_init(struct list_head *list,
438 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 449 pos = n, n = list_entry(n->member.next, typeof(*n), member))
439 450
440/** 451/**
452 * list_for_each_entry_safe_from - iterate over list of given type
453 * from existing point safe against removal of list entry
454 * @pos: the type * to use as a loop counter.
455 * @n: another type * to use as temporary storage
456 * @head: the head for your list.
457 * @member: the name of the list_struct within the struct.
458 */
459#define list_for_each_entry_safe_from(pos, n, head, member) \
460 for (n = list_entry(pos->member.next, typeof(*pos), member); \
461 &pos->member != (head); \
462 pos = n, n = list_entry(n->member.next, typeof(*n), member))
463
464/**
441 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against 465 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against
442 * removal of list entry 466 * removal of list entry
443 * @pos: the type * to use as a loop counter. 467 * @pos: the type * to use as a loop counter.
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index ef21ed296039..995f89dc8c04 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -14,6 +14,7 @@
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/in.h> 15#include <linux/in.h>
16#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/kref.h>
17#include <linux/utsname.h> 18#include <linux/utsname.h>
18#include <linux/nfsd/nfsfh.h> 19#include <linux/nfsd/nfsfh.h>
19#include <linux/lockd/bind.h> 20#include <linux/lockd/bind.h>
@@ -58,6 +59,8 @@ struct nlm_host {
58 unsigned long h_expires; /* eligible for GC */ 59 unsigned long h_expires; /* eligible for GC */
59 struct list_head h_lockowners; /* Lockowners for the client */ 60 struct list_head h_lockowners; /* Lockowners for the client */
60 spinlock_t h_lock; 61 spinlock_t h_lock;
62 struct list_head h_granted; /* Locks in GRANTED state */
63 struct list_head h_reclaim; /* Locks in RECLAIM state */
61}; 64};
62 65
63/* 66/*
@@ -83,9 +86,9 @@ struct nlm_rqst {
83 struct nlm_host * a_host; /* host handle */ 86 struct nlm_host * a_host; /* host handle */
84 struct nlm_args a_args; /* arguments */ 87 struct nlm_args a_args; /* arguments */
85 struct nlm_res a_res; /* result */ 88 struct nlm_res a_res; /* result */
86 struct nlm_wait * a_block; 89 struct nlm_block * a_block;
87 unsigned int a_retries; /* Retry count */ 90 unsigned int a_retries; /* Retry count */
88 char a_owner[NLMCLNT_OHSIZE]; 91 u8 a_owner[NLMCLNT_OHSIZE];
89}; 92};
90 93
91/* 94/*
@@ -110,16 +113,16 @@ struct nlm_file {
110 */ 113 */
111#define NLM_NEVER (~(unsigned long) 0) 114#define NLM_NEVER (~(unsigned long) 0)
112struct nlm_block { 115struct nlm_block {
116 struct kref b_count; /* Reference count */
113 struct nlm_block * b_next; /* linked list (all blocks) */ 117 struct nlm_block * b_next; /* linked list (all blocks) */
114 struct nlm_block * b_fnext; /* linked list (per file) */ 118 struct nlm_block * b_fnext; /* linked list (per file) */
115 struct nlm_rqst b_call; /* RPC args & callback info */ 119 struct nlm_rqst * b_call; /* RPC args & callback info */
116 struct svc_serv * b_daemon; /* NLM service */ 120 struct svc_serv * b_daemon; /* NLM service */
117 struct nlm_host * b_host; /* host handle for RPC clnt */ 121 struct nlm_host * b_host; /* host handle for RPC clnt */
118 unsigned long b_when; /* next re-xmit */ 122 unsigned long b_when; /* next re-xmit */
119 unsigned int b_id; /* block id */ 123 unsigned int b_id; /* block id */
120 unsigned char b_queued; /* re-queued */ 124 unsigned char b_queued; /* re-queued */
121 unsigned char b_granted; /* VFS granted lock */ 125 unsigned char b_granted; /* VFS granted lock */
122 unsigned char b_incall; /* doing callback */
123 unsigned char b_done; /* callback complete */ 126 unsigned char b_done; /* callback complete */
124 struct nlm_file * b_file; /* file in question */ 127 struct nlm_file * b_file; /* file in question */
125}; 128};
@@ -145,15 +148,16 @@ extern unsigned long nlmsvc_timeout;
145/* 148/*
146 * Lockd client functions 149 * Lockd client functions
147 */ 150 */
148struct nlm_rqst * nlmclnt_alloc_call(void); 151struct nlm_rqst * nlm_alloc_call(struct nlm_host *host);
149int nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl); 152void nlm_release_call(struct nlm_rqst *);
150void nlmclnt_finish_block(struct nlm_rqst *req); 153int nlm_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
151long nlmclnt_block(struct nlm_rqst *req, long timeout); 154int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
155struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
156void nlmclnt_finish_block(struct nlm_wait *block);
157int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
152u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); 158u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *);
153void nlmclnt_recovery(struct nlm_host *, u32); 159void nlmclnt_recovery(struct nlm_host *, u32);
154int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 160int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
155int nlmclnt_setgrantargs(struct nlm_rqst *, struct nlm_lock *);
156void nlmclnt_freegrantargs(struct nlm_rqst *);
157 161
158/* 162/*
159 * Host cache 163 * Host cache
@@ -172,7 +176,6 @@ extern struct nlm_host *nlm_find_client(void);
172/* 176/*
173 * Server-side lock handling 177 * Server-side lock handling
174 */ 178 */
175int nlmsvc_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 179u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
177 struct nlm_lock *, int, struct nlm_cookie *); 180 struct nlm_lock *, int, struct nlm_cookie *);
178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 181u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
@@ -180,7 +183,7 @@ u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *,
180 struct nlm_lock *); 183 struct nlm_lock *);
181u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); 184u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
182unsigned long nlmsvc_retry_blocked(void); 185unsigned long nlmsvc_retry_blocked(void);
183int nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 186void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
184 int action); 187 int action);
185void nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32); 188void nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32);
186 189
diff --git a/include/linux/lockd/share.h b/include/linux/lockd/share.h
index 5d8aa325f140..c75a424ebe4c 100644
--- a/include/linux/lockd/share.h
+++ b/include/linux/lockd/share.h
@@ -25,6 +25,6 @@ u32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *,
25 struct nlm_args *); 25 struct nlm_args *);
26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *, 26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *,
27 struct nlm_args *); 27 struct nlm_args *);
28int nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, int); 28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, int);
29 29
30#endif /* LINUX_LOCKD_SHARE_H */ 30#endif /* LINUX_LOCKD_SHARE_H */
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index d7a5cc4cfa97..bb0a0f1caa91 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -28,6 +28,7 @@ struct nlm_lock {
28 int len; /* length of "caller" */ 28 int len; /* length of "caller" */
29 struct nfs_fh fh; 29 struct nfs_fh fh;
30 struct xdr_netobj oh; 30 struct xdr_netobj oh;
31 u32 svid;
31 struct file_lock fl; 32 struct file_lock fl;
32}; 33};
33 34
diff --git a/include/linux/loop.h b/include/linux/loop.h
index f96506782ebe..e76c7611d6cc 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -17,6 +17,7 @@
17#include <linux/bio.h> 17#include <linux/bio.h>
18#include <linux/blkdev.h> 18#include <linux/blkdev.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/mutex.h>
20 21
21/* Possible states of device */ 22/* Possible states of device */
22enum { 23enum {
@@ -60,7 +61,7 @@ struct loop_device {
60 int lo_state; 61 int lo_state;
61 struct completion lo_done; 62 struct completion lo_done;
62 struct completion lo_bh_done; 63 struct completion lo_bh_done;
63 struct semaphore lo_ctl_mutex; 64 struct mutex lo_ctl_mutex;
64 int lo_pending; 65 int lo_pending;
65 66
66 request_queue_t *lo_queue; 67 request_queue_t *lo_queue;
diff --git a/include/linux/m48t86.h b/include/linux/m48t86.h
new file mode 100644
index 000000000000..9065199319d0
--- /dev/null
+++ b/include/linux/m48t86.h
@@ -0,0 +1,16 @@
1/*
2 * ST M48T86 / Dallas DS12887 RTC driver
3 * Copyright (c) 2006 Tower Technologies
4 *
5 * Author: Alessandro Zummo <a.zummo@towertech.it>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12struct m48t86_ops
13{
14 void (*writeb)(unsigned char value, unsigned long addr);
15 unsigned char (*readb)(unsigned long addr);
16};
diff --git a/include/linux/major.h b/include/linux/major.h
index e36a46702d94..0a74c52924c9 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -113,6 +113,7 @@
113 113
114#define UBD_MAJOR 98 114#define UBD_MAJOR 98
115 115
116#define PP_MAJOR 99
116#define JSFD_MAJOR 99 117#define JSFD_MAJOR 99
117 118
118#define PHONE_MAJOR 100 119#define PHONE_MAJOR 100
diff --git a/include/linux/memory.h b/include/linux/memory.h
index e251dc43d0f5..8f04143ca363 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -77,7 +77,6 @@ extern int remove_memory_block(unsigned long, struct mem_section *, int);
77 77
78#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 78#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
79 79
80struct notifier_block;
81 80
82#endif /* CONFIG_MEMORY_HOTPLUG */ 81#endif /* CONFIG_MEMORY_HOTPLUG */
83 82
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index bbd2221923c3..6a7621b2b12b 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -147,6 +147,7 @@ extern void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t *new);
147extern void mpol_rebind_task(struct task_struct *tsk, 147extern void mpol_rebind_task(struct task_struct *tsk,
148 const nodemask_t *new); 148 const nodemask_t *new);
149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
150extern void mpol_fix_fork_child_flag(struct task_struct *p);
150#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x)) 151#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x))
151 152
152#ifdef CONFIG_CPUSET 153#ifdef CONFIG_CPUSET
@@ -248,6 +249,10 @@ static inline void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new)
248{ 249{
249} 250}
250 251
252static inline void mpol_fix_fork_child_flag(struct task_struct *p)
253{
254}
255
251#define set_cpuset_being_rebound(x) do {} while (0) 256#define set_cpuset_being_rebound(x) do {} while (0)
252 257
253static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, 258static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index f2427d7394b0..9be484d11283 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -6,6 +6,8 @@
6 6
7#include <linux/wait.h> 7#include <linux/wait.h>
8 8
9struct kmem_cache;
10
9typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data); 11typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data);
10typedef void (mempool_free_t)(void *element, void *pool_data); 12typedef void (mempool_free_t)(void *element, void *pool_data);
11 13
@@ -37,5 +39,41 @@ extern void mempool_free(void *element, mempool_t *pool);
37 */ 39 */
38void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data); 40void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data);
39void mempool_free_slab(void *element, void *pool_data); 41void mempool_free_slab(void *element, void *pool_data);
42static inline mempool_t *
43mempool_create_slab_pool(int min_nr, struct kmem_cache *kc)
44{
45 return mempool_create(min_nr, mempool_alloc_slab, mempool_free_slab,
46 (void *) kc);
47}
48
49/*
50 * 2 mempool_alloc_t's and a mempool_free_t to kmalloc/kzalloc and kfree
51 * the amount of memory specified by pool_data
52 */
53void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data);
54void *mempool_kzalloc(gfp_t gfp_mask, void *pool_data);
55void mempool_kfree(void *element, void *pool_data);
56static inline mempool_t *mempool_create_kmalloc_pool(int min_nr, size_t size)
57{
58 return mempool_create(min_nr, mempool_kmalloc, mempool_kfree,
59 (void *) size);
60}
61static inline mempool_t *mempool_create_kzalloc_pool(int min_nr, size_t size)
62{
63 return mempool_create(min_nr, mempool_kzalloc, mempool_kfree,
64 (void *) size);
65}
66
67/*
68 * A mempool_alloc_t and mempool_free_t for a simple page allocator that
69 * allocates pages of the order specified by pool_data
70 */
71void *mempool_alloc_pages(gfp_t gfp_mask, void *pool_data);
72void mempool_free_pages(void *element, void *pool_data);
73static inline mempool_t *mempool_create_page_pool(int min_nr, int order)
74{
75 return mempool_create(min_nr, mempool_alloc_pages, mempool_free_pages,
76 (void *)(long)order);
77}
40 78
41#endif /* _LINUX_MEMPOOL_H */ 79#endif /* _LINUX_MEMPOOL_H */
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
new file mode 100644
index 000000000000..ff0a64073ebc
--- /dev/null
+++ b/include/linux/migrate.h
@@ -0,0 +1,39 @@
1#ifndef _LINUX_MIGRATE_H
2#define _LINUX_MIGRATE_H
3
4#include <linux/config.h>
5#include <linux/mm.h>
6
7#ifdef CONFIG_MIGRATION
8extern int isolate_lru_page(struct page *p, struct list_head *pagelist);
9extern int putback_lru_pages(struct list_head *l);
10extern int migrate_page(struct page *, struct page *);
11extern void migrate_page_copy(struct page *, struct page *);
12extern int migrate_page_remove_references(struct page *, struct page *, int);
13extern int migrate_pages(struct list_head *l, struct list_head *t,
14 struct list_head *moved, struct list_head *failed);
15extern int migrate_pages_to(struct list_head *pagelist,
16 struct vm_area_struct *vma, int dest);
17extern int fail_migrate_page(struct page *, struct page *);
18
19extern int migrate_prep(void);
20
21#else
22
23static inline int isolate_lru_page(struct page *p, struct list_head *list)
24 { return -ENOSYS; }
25static inline int putback_lru_pages(struct list_head *l) { return 0; }
26static inline int migrate_pages(struct list_head *l, struct list_head *t,
27 struct list_head *moved, struct list_head *failed) { return -ENOSYS; }
28
29static inline int migrate_pages_to(struct list_head *pagelist,
30 struct vm_area_struct *vma, int dest) { return 0; }
31
32static inline int migrate_prep(void) { return -ENOSYS; }
33
34/* Possible settings for the migrate_page() method in address_operations */
35#define migrate_page NULL
36#define fail_migrate_page NULL
37
38#endif /* CONFIG_MIGRATION */
39#endif /* _LINUX_MIGRATE_H */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 14ceebfc1efa..5b584dafb5a6 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -36,7 +36,7 @@ struct class_device;
36struct miscdevice { 36struct miscdevice {
37 int minor; 37 int minor;
38 const char *name; 38 const char *name;
39 struct file_operations *fops; 39 const struct file_operations *fops;
40 struct list_head list; 40 struct list_head list;
41 struct device *dev; 41 struct device *dev;
42 struct class_device *class; 42 struct class_device *class;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 498ff8778fb6..6aa016f1d3ae 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -286,43 +286,34 @@ struct page {
286 * 286 *
287 * Also, many kernel routines increase the page count before a critical 287 * Also, many kernel routines increase the page count before a critical
288 * routine so they can be sure the page doesn't go away from under them. 288 * routine so they can be sure the page doesn't go away from under them.
289 *
290 * Since 2.6.6 (approx), a free page has ->_count = -1. This is so that we
291 * can use atomic_add_negative(-1, page->_count) to detect when the page
292 * becomes free and so that we can also use atomic_inc_and_test to atomically
293 * detect when we just tried to grab a ref on a page which some other CPU has
294 * already deemed to be freeable.
295 *
296 * NO code should make assumptions about this internal detail! Use the provided
297 * macros which retain the old rules: page_count(page) == 0 is a free page.
298 */ 289 */
299 290
300/* 291/*
301 * Drop a ref, return true if the logical refcount fell to zero (the page has 292 * Drop a ref, return true if the logical refcount fell to zero (the page has
302 * no users) 293 * no users)
303 */ 294 */
304#define put_page_testzero(p) \ 295static inline int put_page_testzero(struct page *page)
305 ({ \ 296{
306 BUG_ON(atomic_read(&(p)->_count) == -1);\ 297 BUG_ON(atomic_read(&page->_count) == 0);
307 atomic_add_negative(-1, &(p)->_count); \ 298 return atomic_dec_and_test(&page->_count);
308 }) 299}
309 300
310/* 301/*
311 * Grab a ref, return true if the page previously had a logical refcount of 302 * Try to grab a ref unless the page has a refcount of zero, return false if
312 * zero. ie: returns true if we just grabbed an already-deemed-to-be-free page 303 * that is the case.
313 */ 304 */
314#define get_page_testone(p) atomic_inc_and_test(&(p)->_count) 305static inline int get_page_unless_zero(struct page *page)
315 306{
316#define set_page_count(p,v) atomic_set(&(p)->_count, (v) - 1) 307 return atomic_inc_not_zero(&page->_count);
317#define __put_page(p) atomic_dec(&(p)->_count) 308}
318 309
319extern void FASTCALL(__page_cache_release(struct page *)); 310extern void FASTCALL(__page_cache_release(struct page *));
320 311
321static inline int page_count(struct page *page) 312static inline int page_count(struct page *page)
322{ 313{
323 if (PageCompound(page)) 314 if (unlikely(PageCompound(page)))
324 page = (struct page *)page_private(page); 315 page = (struct page *)page_private(page);
325 return atomic_read(&page->_count) + 1; 316 return atomic_read(&page->_count);
326} 317}
327 318
328static inline void get_page(struct page *page) 319static inline void get_page(struct page *page)
@@ -332,8 +323,19 @@ static inline void get_page(struct page *page)
332 atomic_inc(&page->_count); 323 atomic_inc(&page->_count);
333} 324}
334 325
326/*
327 * Setup the page count before being freed into the page allocator for
328 * the first time (boot or memory hotplug)
329 */
330static inline void init_page_count(struct page *page)
331{
332 atomic_set(&page->_count, 1);
333}
334
335void put_page(struct page *page); 335void put_page(struct page *page);
336 336
337void split_page(struct page *page, unsigned int order);
338
337/* 339/*
338 * Multiple processes may "see" the same page. E.g. for untouched 340 * Multiple processes may "see" the same page. E.g. for untouched
339 * mappings of /dev/null, all processes see the same page full of 341 * mappings of /dev/null, all processes see the same page full of
@@ -1046,7 +1048,7 @@ int in_gate_area_no_task(unsigned long addr);
1046 1048
1047int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, 1049int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
1048 void __user *, size_t *, loff_t *); 1050 void __user *, size_t *, loff_t *);
1049int shrink_slab(unsigned long scanned, gfp_t gfp_mask, 1051unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
1050 unsigned long lru_pages); 1052 unsigned long lru_pages);
1051void drop_pagecache(void); 1053void drop_pagecache(void);
1052void drop_slab(void); 1054void drop_slab(void);
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 8ac854f7f190..3b6723dfaff3 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -32,7 +32,7 @@ del_page_from_lru(struct zone *zone, struct page *page)
32{ 32{
33 list_del(&page->lru); 33 list_del(&page->lru);
34 if (PageActive(page)) { 34 if (PageActive(page)) {
35 ClearPageActive(page); 35 __ClearPageActive(page);
36 zone->nr_active--; 36 zone->nr_active--;
37 } else { 37 } else {
38 zone->nr_inactive--; 38 zone->nr_inactive--;
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index ebfc238cc243..b5c21122c299 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -13,6 +13,7 @@
13#include <linux/numa.h> 13#include <linux/numa.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/seqlock.h> 15#include <linux/seqlock.h>
16#include <linux/nodemask.h>
16#include <asm/atomic.h> 17#include <asm/atomic.h>
17 18
18/* Free memory management - zoned buddy allocator. */ 19/* Free memory management - zoned buddy allocator. */
@@ -225,7 +226,6 @@ struct zone {
225 * Discontig memory support fields. 226 * Discontig memory support fields.
226 */ 227 */
227 struct pglist_data *zone_pgdat; 228 struct pglist_data *zone_pgdat;
228 struct page *zone_mem_map;
229 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ 229 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
230 unsigned long zone_start_pfn; 230 unsigned long zone_start_pfn;
231 231
@@ -307,7 +307,6 @@ typedef struct pglist_data {
307 unsigned long node_spanned_pages; /* total size of physical page 307 unsigned long node_spanned_pages; /* total size of physical page
308 range, including holes */ 308 range, including holes */
309 int node_id; 309 int node_id;
310 struct pglist_data *pgdat_next;
311 wait_queue_head_t kswapd_wait; 310 wait_queue_head_t kswapd_wait;
312 struct task_struct *kswapd; 311 struct task_struct *kswapd;
313 int kswapd_max_order; 312 int kswapd_max_order;
@@ -324,8 +323,6 @@ typedef struct pglist_data {
324 323
325#include <linux/memory_hotplug.h> 324#include <linux/memory_hotplug.h>
326 325
327extern struct pglist_data *pgdat_list;
328
329void __get_zone_counts(unsigned long *active, unsigned long *inactive, 326void __get_zone_counts(unsigned long *active, unsigned long *inactive,
330 unsigned long *free, struct pglist_data *pgdat); 327 unsigned long *free, struct pglist_data *pgdat);
331void get_zone_counts(unsigned long *active, unsigned long *inactive, 328void get_zone_counts(unsigned long *active, unsigned long *inactive,
@@ -350,57 +347,6 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
350 */ 347 */
351#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones) 348#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
352 349
353/**
354 * for_each_pgdat - helper macro to iterate over all nodes
355 * @pgdat - pointer to a pg_data_t variable
356 *
357 * Meant to help with common loops of the form
358 * pgdat = pgdat_list;
359 * while(pgdat) {
360 * ...
361 * pgdat = pgdat->pgdat_next;
362 * }
363 */
364#define for_each_pgdat(pgdat) \
365 for (pgdat = pgdat_list; pgdat; pgdat = pgdat->pgdat_next)
366
367/*
368 * next_zone - helper magic for for_each_zone()
369 * Thanks to William Lee Irwin III for this piece of ingenuity.
370 */
371static inline struct zone *next_zone(struct zone *zone)
372{
373 pg_data_t *pgdat = zone->zone_pgdat;
374
375 if (zone < pgdat->node_zones + MAX_NR_ZONES - 1)
376 zone++;
377 else if (pgdat->pgdat_next) {
378 pgdat = pgdat->pgdat_next;
379 zone = pgdat->node_zones;
380 } else
381 zone = NULL;
382
383 return zone;
384}
385
386/**
387 * for_each_zone - helper macro to iterate over all memory zones
388 * @zone - pointer to struct zone variable
389 *
390 * The user only needs to declare the zone variable, for_each_zone
391 * fills it in. This basically means for_each_zone() is an
392 * easier to read version of this piece of code:
393 *
394 * for (pgdat = pgdat_list; pgdat; pgdat = pgdat->node_next)
395 * for (i = 0; i < MAX_NR_ZONES; ++i) {
396 * struct zone * z = pgdat->node_zones + i;
397 * ...
398 * }
399 * }
400 */
401#define for_each_zone(zone) \
402 for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone))
403
404static inline int populated_zone(struct zone *zone) 350static inline int populated_zone(struct zone *zone)
405{ 351{
406 return (!!zone->present_pages); 352 return (!!zone->present_pages);
@@ -472,6 +418,30 @@ extern struct pglist_data contig_page_data;
472 418
473#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 419#endif /* !CONFIG_NEED_MULTIPLE_NODES */
474 420
421extern struct pglist_data *first_online_pgdat(void);
422extern struct pglist_data *next_online_pgdat(struct pglist_data *pgdat);
423extern struct zone *next_zone(struct zone *zone);
424
425/**
426 * for_each_pgdat - helper macro to iterate over all nodes
427 * @pgdat - pointer to a pg_data_t variable
428 */
429#define for_each_online_pgdat(pgdat) \
430 for (pgdat = first_online_pgdat(); \
431 pgdat; \
432 pgdat = next_online_pgdat(pgdat))
433/**
434 * for_each_zone - helper macro to iterate over all memory zones
435 * @zone - pointer to struct zone variable
436 *
437 * The user only needs to declare the zone variable, for_each_zone
438 * fills it in.
439 */
440#define for_each_zone(zone) \
441 for (zone = (first_online_pgdat())->node_zones; \
442 zone; \
443 zone = next_zone(zone))
444
475#ifdef CONFIG_SPARSEMEM 445#ifdef CONFIG_SPARSEMEM
476#include <asm/sparsemem.h> 446#include <asm/sparsemem.h>
477#endif 447#endif
@@ -602,17 +572,6 @@ static inline struct mem_section *__pfn_to_section(unsigned long pfn)
602 return __nr_to_section(pfn_to_section_nr(pfn)); 572 return __nr_to_section(pfn_to_section_nr(pfn));
603} 573}
604 574
605#define pfn_to_page(pfn) \
606({ \
607 unsigned long __pfn = (pfn); \
608 __section_mem_map_addr(__pfn_to_section(__pfn)) + __pfn; \
609})
610#define page_to_pfn(page) \
611({ \
612 page - __section_mem_map_addr(__nr_to_section( \
613 page_to_section(page))); \
614})
615
616static inline int pfn_valid(unsigned long pfn) 575static inline int pfn_valid(unsigned long pfn)
617{ 576{
618 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) 577 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
diff --git a/include/linux/module.h b/include/linux/module.h
index 84d75f3a8aca..eaec13ddd667 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -183,6 +183,7 @@ void *__symbol_get_gpl(const char *symbol);
183 183
184/* For every exported symbol, place a struct in the __ksymtab section */ 184/* For every exported symbol, place a struct in the __ksymtab section */
185#define __EXPORT_SYMBOL(sym, sec) \ 185#define __EXPORT_SYMBOL(sym, sec) \
186 extern typeof(sym) sym; \
186 __CRC_SYMBOL(sym, sec) \ 187 __CRC_SYMBOL(sym, sec) \
187 static const char __kstrtab_##sym[] \ 188 static const char __kstrtab_##sym[] \
188 __attribute__((section("__ksymtab_strings"))) \ 189 __attribute__((section("__ksymtab_strings"))) \
@@ -198,6 +199,9 @@ void *__symbol_get_gpl(const char *symbol);
198#define EXPORT_SYMBOL_GPL(sym) \ 199#define EXPORT_SYMBOL_GPL(sym) \
199 __EXPORT_SYMBOL(sym, "_gpl") 200 __EXPORT_SYMBOL(sym, "_gpl")
200 201
202#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
203 __EXPORT_SYMBOL(sym, "_gpl_future")
204
201#endif 205#endif
202 206
203struct module_ref 207struct module_ref
@@ -242,6 +246,7 @@ struct module
242 /* Sysfs stuff. */ 246 /* Sysfs stuff. */
243 struct module_kobject mkobj; 247 struct module_kobject mkobj;
244 struct module_param_attrs *param_attrs; 248 struct module_param_attrs *param_attrs;
249 struct module_attribute *modinfo_attrs;
245 const char *version; 250 const char *version;
246 const char *srcversion; 251 const char *srcversion;
247 252
@@ -255,6 +260,11 @@ struct module
255 unsigned int num_gpl_syms; 260 unsigned int num_gpl_syms;
256 const unsigned long *gpl_crcs; 261 const unsigned long *gpl_crcs;
257 262
263 /* symbols that will be GPL-only in the near future. */
264 const struct kernel_symbol *gpl_future_syms;
265 unsigned int num_gpl_future_syms;
266 const unsigned long *gpl_future_crcs;
267
258 /* Exception table */ 268 /* Exception table */
259 unsigned int num_exentries; 269 unsigned int num_exentries;
260 const struct exception_table_entry *extable; 270 const struct exception_table_entry *extable;
@@ -441,6 +451,7 @@ void module_remove_driver(struct device_driver *);
441#else /* !CONFIG_MODULES... */ 451#else /* !CONFIG_MODULES... */
442#define EXPORT_SYMBOL(sym) 452#define EXPORT_SYMBOL(sym)
443#define EXPORT_SYMBOL_GPL(sym) 453#define EXPORT_SYMBOL_GPL(sym)
454#define EXPORT_SYMBOL_GPL_FUTURE(sym)
444 455
445/* Given an address, look for it in the exception tables. */ 456/* Given an address, look for it in the exception tables. */
446static inline const struct exception_table_entry * 457static inline const struct exception_table_entry *
@@ -544,25 +555,6 @@ static inline void module_remove_driver(struct device_driver *driver)
544 555
545/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */ 556/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */
546 557
547struct obsolete_modparm {
548 char name[64];
549 char type[64-sizeof(void *)];
550 void *addr;
551};
552
553static inline void MODULE_PARM_(void) { }
554#ifdef MODULE
555/* DEPRECATED: Do not use. */
556#define MODULE_PARM(var,type) \
557extern struct obsolete_modparm __parm_##var \
558__attribute__((section("__obsparm"))); \
559struct obsolete_modparm __parm_##var = \
560{ __stringify(var), type, &MODULE_PARM_ }; \
561__MODULE_PARM_TYPE(var, type);
562#else
563#define MODULE_PARM(var,type) static void __attribute__((__unused__)) *__parm_##var = &MODULE_PARM_;
564#endif
565
566#define __MODULE_STRING(x) __stringify(x) 558#define __MODULE_STRING(x) __stringify(x)
567 559
568/* Use symbol_get and symbol_put instead. You'll thank me. */ 560/* Use symbol_get and symbol_put instead. You'll thank me. */
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index b5c98c43779e..7c0c2c198f1f 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -162,13 +162,6 @@ extern int param_array_get(char *buffer, struct kernel_param *kp);
162extern int param_set_copystring(const char *val, struct kernel_param *kp); 162extern int param_set_copystring(const char *val, struct kernel_param *kp);
163extern int param_get_string(char *buffer, struct kernel_param *kp); 163extern int param_get_string(char *buffer, struct kernel_param *kp);
164 164
165int param_array(const char *name,
166 const char *val,
167 unsigned int min, unsigned int max,
168 void *elem, int elemsize,
169 int (*set)(const char *, struct kernel_param *kp),
170 int *num);
171
172/* for exporting parameters in /sys/parameters */ 165/* for exporting parameters in /sys/parameters */
173 166
174struct module; 167struct module;
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index e933e2a355ad..d9035c73e5d1 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -184,6 +184,7 @@ struct fat_slot_info {
184#include <linux/string.h> 184#include <linux/string.h>
185#include <linux/nls.h> 185#include <linux/nls.h>
186#include <linux/fs.h> 186#include <linux/fs.h>
187#include <linux/mutex.h>
187 188
188struct fat_mount_options { 189struct fat_mount_options {
189 uid_t fs_uid; 190 uid_t fs_uid;
@@ -199,7 +200,7 @@ struct fat_mount_options {
199 sys_immutable:1, /* set = system files are immutable */ 200 sys_immutable:1, /* set = system files are immutable */
200 dotsOK:1, /* set = hidden and system files are named '.filename' */ 201 dotsOK:1, /* set = hidden and system files are named '.filename' */
201 isvfat:1, /* 0=no vfat long filename support, 1=vfat support */ 202 isvfat:1, /* 0=no vfat long filename support, 1=vfat support */
202 utf8:1, /* Use of UTF8 character set (Default) */ 203 utf8:1, /* Use of UTF-8 character set (Default) */
203 unicode_xlate:1, /* create escape sequences for unhandled Unicode */ 204 unicode_xlate:1, /* create escape sequences for unhandled Unicode */
204 numtail:1, /* Does first alias have a numeric '~1' type tail? */ 205 numtail:1, /* Does first alias have a numeric '~1' type tail? */
205 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */ 206 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
@@ -226,7 +227,7 @@ struct msdos_sb_info {
226 unsigned long max_cluster; /* maximum cluster number */ 227 unsigned long max_cluster; /* maximum cluster number */
227 unsigned long root_cluster; /* first cluster of the root directory */ 228 unsigned long root_cluster; /* first cluster of the root directory */
228 unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */ 229 unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */
229 struct semaphore fat_lock; 230 struct mutex fat_lock;
230 unsigned int prev_free; /* previously allocated cluster number */ 231 unsigned int prev_free; /* previously allocated cluster number */
231 unsigned int free_clusters; /* -1 if undefined */ 232 unsigned int free_clusters; /* -1 if undefined */
232 struct fat_mount_options options; 233 struct fat_mount_options options;
@@ -333,7 +334,7 @@ extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
333 unsigned long *mapped_blocks); 334 unsigned long *mapped_blocks);
334 335
335/* fat/dir.c */ 336/* fat/dir.c */
336extern struct file_operations fat_dir_operations; 337extern const struct file_operations fat_dir_operations;
337extern int fat_search_long(struct inode *inode, const unsigned char *name, 338extern int fat_search_long(struct inode *inode, const unsigned char *name,
338 int name_len, struct fat_slot_info *sinfo); 339 int name_len, struct fat_slot_info *sinfo);
339extern int fat_dir_empty(struct inode *dir); 340extern int fat_dir_empty(struct inode *dir);
@@ -396,7 +397,7 @@ extern int fat_count_free_clusters(struct super_block *sb);
396/* fat/file.c */ 397/* fat/file.c */
397extern int fat_generic_ioctl(struct inode *inode, struct file *filp, 398extern int fat_generic_ioctl(struct inode *inode, struct file *filp,
398 unsigned int cmd, unsigned long arg); 399 unsigned int cmd, unsigned long arg);
399extern struct file_operations fat_file_operations; 400extern const struct file_operations fat_file_operations;
400extern struct inode_operations fat_file_inode_operations; 401extern struct inode_operations fat_file_inode_operations;
401extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); 402extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
402extern void fat_truncate(struct inode *inode); 403extern void fat_truncate(struct inode *inode);
@@ -419,6 +420,9 @@ extern int date_dos2unix(unsigned short time, unsigned short date);
419extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date); 420extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date);
420extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); 421extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs);
421 422
423int fat_cache_init(void);
424void fat_cache_destroy(void);
425
422#endif /* __KERNEL__ */ 426#endif /* __KERNEL__ */
423 427
424#endif 428#endif
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index f46afec6fbf8..72fc68c5ee96 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -10,7 +10,7 @@
10#ifndef __MTD_TRANS_H__ 10#ifndef __MTD_TRANS_H__
11#define __MTD_TRANS_H__ 11#define __MTD_TRANS_H__
12 12
13#include <asm/semaphore.h> 13#include <linux/mutex.h>
14 14
15struct hd_geometry; 15struct hd_geometry;
16struct mtd_info; 16struct mtd_info;
@@ -22,7 +22,7 @@ struct mtd_blktrans_dev {
22 struct mtd_blktrans_ops *tr; 22 struct mtd_blktrans_ops *tr;
23 struct list_head list; 23 struct list_head list;
24 struct mtd_info *mtd; 24 struct mtd_info *mtd;
25 struct semaphore sem; 25 struct mutex lock;
26 int devnum; 26 int devnum;
27 int blksize; 27 int blksize;
28 unsigned long size; 28 unsigned long size;
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 386a52cf8b1b..9addd073bf15 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -15,7 +15,7 @@
15#define __MTD_DOC2000_H__ 15#define __MTD_DOC2000_H__
16 16
17#include <linux/mtd/mtd.h> 17#include <linux/mtd/mtd.h>
18#include <asm/semaphore.h> 18#include <linux/mutex.h>
19 19
20#define DoC_Sig1 0 20#define DoC_Sig1 0
21#define DoC_Sig2 1 21#define DoC_Sig2 1
@@ -187,7 +187,7 @@ struct DiskOnChip {
187 int numchips; 187 int numchips;
188 struct Nand *chips; 188 struct Nand *chips;
189 struct mtd_info *nextdoc; 189 struct mtd_info *nextdoc;
190 struct semaphore lock; 190 struct mutex lock;
191}; 191};
192 192
193int doc_decode_ecc(unsigned char sector[512], unsigned char ecc1[6]); 193int doc_decode_ecc(unsigned char sector[512], unsigned char ecc1[6]);
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h
index 0268125a6271..d7eaa40e5ab0 100644
--- a/include/linux/mtd/inftl.h
+++ b/include/linux/mtd/inftl.h
@@ -52,6 +52,11 @@ struct INFTLrecord {
52int INFTL_mount(struct INFTLrecord *s); 52int INFTL_mount(struct INFTLrecord *s);
53int INFTL_formatblock(struct INFTLrecord *s, int block); 53int INFTL_formatblock(struct INFTLrecord *s, int block);
54 54
55extern char inftlmountrev[];
56
57void INFTL_dumptables(struct INFTLrecord *s);
58void INFTL_dumpVUchains(struct INFTLrecord *s);
59
55#endif /* __KERNEL__ */ 60#endif /* __KERNEL__ */
56 61
57#endif /* __MTD_INFTL_H__ */ 62#endif /* __MTD_INFTL_H__ */
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index 0b08cd692201..955d3069d727 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -1214,6 +1214,7 @@ struct mv64xxx_i2c_pdata {
1214#define MV643XX_ETH_FORCE_BP_MODE_NO_JAM 0 1214#define MV643XX_ETH_FORCE_BP_MODE_NO_JAM 0
1215#define MV643XX_ETH_FORCE_BP_MODE_JAM_TX (1<<7) 1215#define MV643XX_ETH_FORCE_BP_MODE_JAM_TX (1<<7)
1216#define MV643XX_ETH_FORCE_BP_MODE_JAM_TX_ON_RX_ERR (1<<8) 1216#define MV643XX_ETH_FORCE_BP_MODE_JAM_TX_ON_RX_ERR (1<<8)
1217#define MV643XX_ETH_SERIAL_PORT_CONTROL_RESERVED (1<<9)
1217#define MV643XX_ETH_FORCE_LINK_FAIL 0 1218#define MV643XX_ETH_FORCE_LINK_FAIL 0
1218#define MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL (1<<10) 1219#define MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL (1<<10)
1219#define MV643XX_ETH_RETRANSMIT_16_ATTEMPTS 0 1220#define MV643XX_ETH_RETRANSMIT_16_ATTEMPTS 0
@@ -1243,6 +1244,8 @@ struct mv64xxx_i2c_pdata {
1243#define MV643XX_ETH_SET_MII_SPEED_TO_10 0 1244#define MV643XX_ETH_SET_MII_SPEED_TO_10 0
1244#define MV643XX_ETH_SET_MII_SPEED_TO_100 (1<<24) 1245#define MV643XX_ETH_SET_MII_SPEED_TO_100 (1<<24)
1245 1246
1247#define MV643XX_ETH_MAX_RX_PACKET_MASK (0x7<<17)
1248
1246#define MV643XX_ETH_PORT_SERIAL_CONTROL_DEFAULT_VALUE \ 1249#define MV643XX_ETH_PORT_SERIAL_CONTROL_DEFAULT_VALUE \
1247 MV643XX_ETH_DO_NOT_FORCE_LINK_PASS | \ 1250 MV643XX_ETH_DO_NOT_FORCE_LINK_PASS | \
1248 MV643XX_ETH_ENABLE_AUTO_NEG_FOR_DUPLX | \ 1251 MV643XX_ETH_ENABLE_AUTO_NEG_FOR_DUPLX | \
@@ -1285,23 +1288,15 @@ struct mv64xxx_i2c_pdata {
1285#define MV643XX_ETH_NAME "mv643xx_eth" 1288#define MV643XX_ETH_NAME "mv643xx_eth"
1286 1289
1287struct mv643xx_eth_platform_data { 1290struct mv643xx_eth_platform_data {
1288 /*
1289 * Non-values for mac_addr, phy_addr, port_config, etc.
1290 * override the default value. Setting the corresponding
1291 * force_* field, causes the default value to be overridden
1292 * even when zero.
1293 */
1294 unsigned int force_phy_addr:1;
1295 unsigned int force_port_config:1;
1296 unsigned int force_port_config_extend:1;
1297 unsigned int force_port_sdma_config:1;
1298 unsigned int force_port_serial_control:1;
1299 int phy_addr;
1300 char *mac_addr; /* pointer to mac address */ 1291 char *mac_addr; /* pointer to mac address */
1301 u32 port_config; 1292 u16 force_phy_addr; /* force override if phy_addr == 0 */
1302 u32 port_config_extend; 1293 u16 phy_addr;
1303 u32 port_sdma_config; 1294
1304 u32 port_serial_control; 1295 /* If speed is 0, then speed and duplex are autonegotiated. */
1296 int speed; /* 0, SPEED_10, SPEED_100, SPEED_1000 */
1297 int duplex; /* DUPLEX_HALF or DUPLEX_FULL */
1298
1299 /* non-zero values of the following fields override defaults */
1305 u32 tx_queue_size; 1300 u32 tx_queue_size;
1306 u32 rx_queue_size; 1301 u32 rx_queue_size;
1307 u32 tx_sram_addr; 1302 u32 tx_sram_addr;
diff --git a/include/linux/namei.h b/include/linux/namei.h
index e6698013e4d0..58cb3d3d44b4 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -75,7 +75,6 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
75extern void release_open_intent(struct nameidata *); 75extern void release_open_intent(struct nameidata *);
76 76
77extern struct dentry * lookup_one_len(const char *, struct dentry *, int); 77extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
78extern __deprecated_for_modules struct dentry * lookup_hash(struct nameidata *);
79 78
80extern int follow_down(struct vfsmount **, struct dentry **); 79extern int follow_down(struct vfsmount **, struct dentry **);
81extern int follow_up(struct vfsmount **, struct dentry **); 80extern int follow_up(struct vfsmount **, struct dentry **);
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index f95d51fae733..a6ce409ec6fc 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -38,6 +38,7 @@ enum {
38#ifdef __KERNEL__ 38#ifdef __KERNEL__
39 39
40#include <linux/wait.h> 40#include <linux/wait.h>
41#include <linux/mutex.h>
41 42
42/* values for flags field */ 43/* values for flags field */
43#define NBD_READ_ONLY 0x0001 44#define NBD_READ_ONLY 0x0001
@@ -57,7 +58,7 @@ struct nbd_device {
57 struct request *active_req; 58 struct request *active_req;
58 wait_queue_head_t active_wq; 59 wait_queue_head_t active_wq;
59 60
60 struct semaphore tx_lock; 61 struct mutex tx_lock;
61 struct gendisk *disk; 62 struct gendisk *disk;
62 int blksize; 63 int blksize;
63 u64 bytesize; 64 u64 bytesize;
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index e01342568530..96dc237b8f03 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -209,7 +209,7 @@ void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
209 209
210/* linux/fs/ncpfs/dir.c */ 210/* linux/fs/ncpfs/dir.c */
211extern struct inode_operations ncp_dir_inode_operations; 211extern struct inode_operations ncp_dir_inode_operations;
212extern struct file_operations ncp_dir_operations; 212extern const struct file_operations ncp_dir_operations;
213int ncp_conn_logged_in(struct super_block *); 213int ncp_conn_logged_in(struct super_block *);
214int ncp_date_dos2unix(__le16 time, __le16 date); 214int ncp_date_dos2unix(__le16 time, __le16 date);
215void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 215void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
@@ -230,7 +230,7 @@ void ncp_unlock_server(struct ncp_server *server);
230 230
231/* linux/fs/ncpfs/file.c */ 231/* linux/fs/ncpfs/file.c */
232extern struct inode_operations ncp_file_inode_operations; 232extern struct inode_operations ncp_file_inode_operations;
233extern struct file_operations ncp_file_operations; 233extern const struct file_operations ncp_file_operations;
234int ncp_make_open(struct inode *, int); 234int ncp_make_open(struct inode *, int);
235 235
236/* linux/fs/ncpfs/mmap.c */ 236/* linux/fs/ncpfs/mmap.c */
diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h
index 415be1ec6f98..bdb4c8ae6924 100644
--- a/include/linux/ncp_fs_i.h
+++ b/include/linux/ncp_fs_i.h
@@ -19,7 +19,7 @@ struct ncp_inode_info {
19 __le32 DosDirNum; 19 __le32 DosDirNum;
20 __u8 volNumber; 20 __u8 volNumber;
21 __le32 nwattr; 21 __le32 nwattr;
22 struct semaphore open_sem; 22 struct mutex open_mutex;
23 atomic_t opened; 23 atomic_t opened;
24 int access; 24 int access;
25 int flags; 25 int flags;
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index cf858eb80f0b..b089d9506283 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/ncp_mount.h> 12#include <linux/ncp_mount.h>
13#include <linux/net.h> 13#include <linux/net.h>
14#include <linux/mutex.h>
14 15
15#ifdef __KERNEL__ 16#ifdef __KERNEL__
16 17
@@ -51,7 +52,7 @@ struct ncp_server {
51 receive replies */ 52 receive replies */
52 53
53 int lock; /* To prevent mismatch in protocols. */ 54 int lock; /* To prevent mismatch in protocols. */
54 struct semaphore sem; 55 struct mutex mutex;
55 56
56 int current_size; /* for packet preparation */ 57 int current_size; /* for packet preparation */
57 int has_subfunction; 58 int has_subfunction;
@@ -96,7 +97,7 @@ struct ncp_server {
96 struct { 97 struct {
97 struct work_struct tq; /* STREAM/DGRAM: data/error ready */ 98 struct work_struct tq; /* STREAM/DGRAM: data/error ready */
98 struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */ 99 struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */
99 struct semaphore creq_sem; /* DGRAM only: lock accesses to rcv.creq */ 100 struct mutex creq_mutex; /* DGRAM only: lock accesses to rcv.creq */
100 101
101 unsigned int state; /* STREAM only: receiver state */ 102 unsigned int state; /* STREAM only: receiver state */
102 struct { 103 struct {
diff --git a/include/linux/net.h b/include/linux/net.h
index 28195a2d8ff0..84a490e5f0a1 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -143,12 +143,18 @@ struct proto_ops {
143 struct poll_table_struct *wait); 143 struct poll_table_struct *wait);
144 int (*ioctl) (struct socket *sock, unsigned int cmd, 144 int (*ioctl) (struct socket *sock, unsigned int cmd,
145 unsigned long arg); 145 unsigned long arg);
146 int (*compat_ioctl) (struct socket *sock, unsigned int cmd,
147 unsigned long arg);
146 int (*listen) (struct socket *sock, int len); 148 int (*listen) (struct socket *sock, int len);
147 int (*shutdown) (struct socket *sock, int flags); 149 int (*shutdown) (struct socket *sock, int flags);
148 int (*setsockopt)(struct socket *sock, int level, 150 int (*setsockopt)(struct socket *sock, int level,
149 int optname, char __user *optval, int optlen); 151 int optname, char __user *optval, int optlen);
150 int (*getsockopt)(struct socket *sock, int level, 152 int (*getsockopt)(struct socket *sock, int level,
151 int optname, char __user *optval, int __user *optlen); 153 int optname, char __user *optval, int __user *optlen);
154 int (*compat_setsockopt)(struct socket *sock, int level,
155 int optname, char __user *optval, int optlen);
156 int (*compat_getsockopt)(struct socket *sock, int level,
157 int optname, char __user *optval, int __user *optlen);
152 int (*sendmsg) (struct kiocb *iocb, struct socket *sock, 158 int (*sendmsg) (struct kiocb *iocb, struct socket *sock,
153 struct msghdr *m, size_t total_len); 159 struct msghdr *m, size_t total_len);
154 int (*recvmsg) (struct kiocb *iocb, struct socket *sock, 160 int (*recvmsg) (struct kiocb *iocb, struct socket *sock,
@@ -247,6 +253,8 @@ SOCKCALL_UWRAP(name, poll, (struct file *file, struct socket *sock, struct poll_
247 (file, sock, wait)) \ 253 (file, sock, wait)) \
248SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \ 254SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \
249 unsigned long arg), (sock, cmd, arg)) \ 255 unsigned long arg), (sock, cmd, arg)) \
256SOCKCALL_WRAP(name, compat_ioctl, (struct socket *sock, unsigned int cmd, \
257 unsigned long arg), (sock, cmd, arg)) \
250SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \ 258SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
251SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \ 259SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
252SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \ 260SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
@@ -271,6 +279,7 @@ static const struct proto_ops name##_ops = { \
271 .getname = __lock_##name##_getname, \ 279 .getname = __lock_##name##_getname, \
272 .poll = __lock_##name##_poll, \ 280 .poll = __lock_##name##_poll, \
273 .ioctl = __lock_##name##_ioctl, \ 281 .ioctl = __lock_##name##_ioctl, \
282 .compat_ioctl = __lock_##name##_compat_ioctl, \
274 .listen = __lock_##name##_listen, \ 283 .listen = __lock_##name##_listen, \
275 .shutdown = __lock_##name##_shutdown, \ 284 .shutdown = __lock_##name##_shutdown, \
276 .setsockopt = __lock_##name##_setsockopt, \ 285 .setsockopt = __lock_##name##_setsockopt, \
@@ -279,6 +288,7 @@ static const struct proto_ops name##_ops = { \
279 .recvmsg = __lock_##name##_recvmsg, \ 288 .recvmsg = __lock_##name##_recvmsg, \
280 .mmap = __lock_##name##_mmap, \ 289 .mmap = __lock_##name##_mmap, \
281}; 290};
291
282#endif 292#endif
283 293
284#define MODULE_ALIAS_NETPROTO(proto) \ 294#define MODULE_ALIAS_NETPROTO(proto) \
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7fda03d338d1..40ccf8cc4239 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -230,7 +230,8 @@ enum netdev_state_t
230 __LINK_STATE_SCHED, 230 __LINK_STATE_SCHED,
231 __LINK_STATE_NOCARRIER, 231 __LINK_STATE_NOCARRIER,
232 __LINK_STATE_RX_SCHED, 232 __LINK_STATE_RX_SCHED,
233 __LINK_STATE_LINKWATCH_PENDING 233 __LINK_STATE_LINKWATCH_PENDING,
234 __LINK_STATE_DORMANT,
234}; 235};
235 236
236 237
@@ -335,11 +336,14 @@ struct net_device
335 */ 336 */
336 337
337 338
338 unsigned short flags; /* interface flags (a la BSD) */ 339 unsigned int flags; /* interface flags (a la BSD) */
339 unsigned short gflags; 340 unsigned short gflags;
340 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */ 341 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */
341 unsigned short padded; /* How much padding added by alloc_netdev() */ 342 unsigned short padded; /* How much padding added by alloc_netdev() */
342 343
344 unsigned char operstate; /* RFC2863 operstate */
345 unsigned char link_mode; /* mapping policy to operstate */
346
343 unsigned mtu; /* interface MTU value */ 347 unsigned mtu; /* interface MTU value */
344 unsigned short type; /* interface hardware type */ 348 unsigned short type; /* interface hardware type */
345 unsigned short hard_header_len; /* hardware hdr length */ 349 unsigned short hard_header_len; /* hardware hdr length */
@@ -594,20 +598,7 @@ DECLARE_PER_CPU(struct softnet_data,softnet_data);
594 598
595#define HAVE_NETIF_QUEUE 599#define HAVE_NETIF_QUEUE
596 600
597static inline void __netif_schedule(struct net_device *dev) 601extern void __netif_schedule(struct net_device *dev);
598{
599 if (!test_and_set_bit(__LINK_STATE_SCHED, &dev->state)) {
600 unsigned long flags;
601 struct softnet_data *sd;
602
603 local_irq_save(flags);
604 sd = &__get_cpu_var(softnet_data);
605 dev->next_sched = sd->output_queue;
606 sd->output_queue = dev;
607 raise_softirq_irqoff(NET_TX_SOFTIRQ);
608 local_irq_restore(flags);
609 }
610}
611 602
612static inline void netif_schedule(struct net_device *dev) 603static inline void netif_schedule(struct net_device *dev)
613{ 604{
@@ -671,13 +662,7 @@ static inline void dev_kfree_skb_irq(struct sk_buff *skb)
671/* Use this variant in places where it could be invoked 662/* Use this variant in places where it could be invoked
672 * either from interrupt or non-interrupt context. 663 * either from interrupt or non-interrupt context.
673 */ 664 */
674static inline void dev_kfree_skb_any(struct sk_buff *skb) 665extern void dev_kfree_skb_any(struct sk_buff *skb);
675{
676 if (in_irq() || irqs_disabled())
677 dev_kfree_skb_irq(skb);
678 else
679 dev_kfree_skb(skb);
680}
681 666
682#define HAVE_NETIF_RX 1 667#define HAVE_NETIF_RX 1
683extern int netif_rx(struct sk_buff *skb); 668extern int netif_rx(struct sk_buff *skb);
@@ -708,12 +693,18 @@ static inline void dev_put(struct net_device *dev)
708 atomic_dec(&dev->refcnt); 693 atomic_dec(&dev->refcnt);
709} 694}
710 695
711#define __dev_put(dev) atomic_dec(&(dev)->refcnt) 696static inline void dev_hold(struct net_device *dev)
712#define dev_hold(dev) atomic_inc(&(dev)->refcnt) 697{
698 atomic_inc(&dev->refcnt);
699}
713 700
714/* Carrier loss detection, dial on demand. The functions netif_carrier_on 701/* Carrier loss detection, dial on demand. The functions netif_carrier_on
715 * and _off may be called from IRQ context, but it is caller 702 * and _off may be called from IRQ context, but it is caller
716 * who is responsible for serialization of these calls. 703 * who is responsible for serialization of these calls.
704 *
705 * The name carrier is inappropriate, these functions should really be
706 * called netif_lowerlayer_*() because they represent the state of any
707 * kind of lower layer not just hardware media.
717 */ 708 */
718 709
719extern void linkwatch_fire_event(struct net_device *dev); 710extern void linkwatch_fire_event(struct net_device *dev);
@@ -729,29 +720,39 @@ extern void netif_carrier_on(struct net_device *dev);
729 720
730extern void netif_carrier_off(struct net_device *dev); 721extern void netif_carrier_off(struct net_device *dev);
731 722
732/* Hot-plugging. */ 723static inline void netif_dormant_on(struct net_device *dev)
733static inline int netif_device_present(struct net_device *dev)
734{ 724{
735 return test_bit(__LINK_STATE_PRESENT, &dev->state); 725 if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state))
726 linkwatch_fire_event(dev);
736} 727}
737 728
738static inline void netif_device_detach(struct net_device *dev) 729static inline void netif_dormant_off(struct net_device *dev)
739{ 730{
740 if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) && 731 if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state))
741 netif_running(dev)) { 732 linkwatch_fire_event(dev);
742 netif_stop_queue(dev);
743 }
744} 733}
745 734
746static inline void netif_device_attach(struct net_device *dev) 735static inline int netif_dormant(const struct net_device *dev)
747{ 736{
748 if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) && 737 return test_bit(__LINK_STATE_DORMANT, &dev->state);
749 netif_running(dev)) { 738}
750 netif_wake_queue(dev); 739
751 __netdev_watchdog_up(dev); 740
752 } 741static inline int netif_oper_up(const struct net_device *dev) {
742 return (dev->operstate == IF_OPER_UP ||
743 dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
753} 744}
754 745
746/* Hot-plugging. */
747static inline int netif_device_present(struct net_device *dev)
748{
749 return test_bit(__LINK_STATE_PRESENT, &dev->state);
750}
751
752extern void netif_device_detach(struct net_device *dev);
753
754extern void netif_device_attach(struct net_device *dev);
755
755/* 756/*
756 * Network interface message level settings 757 * Network interface message level settings
757 */ 758 */
@@ -818,20 +819,7 @@ static inline int netif_rx_schedule_prep(struct net_device *dev)
818 * already been called and returned 1. 819 * already been called and returned 1.
819 */ 820 */
820 821
821static inline void __netif_rx_schedule(struct net_device *dev) 822extern void __netif_rx_schedule(struct net_device *dev);
822{
823 unsigned long flags;
824
825 local_irq_save(flags);
826 dev_hold(dev);
827 list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
828 if (dev->quota < 0)
829 dev->quota += dev->weight;
830 else
831 dev->quota = dev->weight;
832 __raise_softirq_irqoff(NET_RX_SOFTIRQ);
833 local_irq_restore(flags);
834}
835 823
836/* Try to reschedule poll. Called by irq handler. */ 824/* Try to reschedule poll. Called by irq handler. */
837 825
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 468896939843..412e52ca9720 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -80,10 +80,14 @@ struct nf_sockopt_ops
80 int set_optmin; 80 int set_optmin;
81 int set_optmax; 81 int set_optmax;
82 int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); 82 int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len);
83 int (*compat_set)(struct sock *sk, int optval,
84 void __user *user, unsigned int len);
83 85
84 int get_optmin; 86 int get_optmin;
85 int get_optmax; 87 int get_optmax;
86 int (*get)(struct sock *sk, int optval, void __user *user, int *len); 88 int (*get)(struct sock *sk, int optval, void __user *user, int *len);
89 int (*compat_get)(struct sock *sk, int optval,
90 void __user *user, int *len);
87 91
88 /* Number of users inside set() or get(). */ 92 /* Number of users inside set() or get(). */
89 unsigned int use; 93 unsigned int use;
@@ -246,6 +250,11 @@ int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt,
246int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, 250int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt,
247 int *len); 251 int *len);
248 252
253int compat_nf_setsockopt(struct sock *sk, int pf, int optval,
254 char __user *opt, int len);
255int compat_nf_getsockopt(struct sock *sk, int pf, int optval,
256 char __user *opt, int *len);
257
249/* Packet queuing */ 258/* Packet queuing */
250struct nf_queue_handler { 259struct nf_queue_handler {
251 int (*outfn)(struct sk_buff *skb, struct nf_info *info, 260 int (*outfn)(struct sk_buff *skb, struct nf_info *info,
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 934a2479f160..9f5b12cf489b 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -164,6 +164,7 @@ extern void nfattr_parse(struct nfattr *tb[], int maxattr,
164 __res; \ 164 __res; \
165}) 165})
166 166
167extern int nfnetlink_has_listeners(unsigned int group);
167extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, 168extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
168 int echo); 169 int echo);
169extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); 170extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index b04b03880595..a7497c7436df 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -47,6 +47,8 @@ enum nfulnl_attr_type {
47 NFULA_PAYLOAD, /* opaque data payload */ 47 NFULA_PAYLOAD, /* opaque data payload */
48 NFULA_PREFIX, /* string prefix */ 48 NFULA_PREFIX, /* string prefix */
49 NFULA_UID, /* user id of socket */ 49 NFULA_UID, /* user id of socket */
50 NFULA_SEQ, /* instance-local sequence number */
51 NFULA_SEQ_GLOBAL, /* global sequence number */
50 52
51 __NFULA_MAX 53 __NFULA_MAX
52}; 54};
@@ -77,6 +79,7 @@ enum nfulnl_attr_config {
77 NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */ 79 NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */
78 NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */ 80 NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */
79 NFULA_CFG_QTHRESH, /* u_int32_t */ 81 NFULA_CFG_QTHRESH, /* u_int32_t */
82 NFULA_CFG_FLAGS, /* u_int16_t */
80 __NFULA_CFG_MAX 83 __NFULA_CFG_MAX
81}; 84};
82#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1) 85#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
@@ -85,4 +88,7 @@ enum nfulnl_attr_config {
85#define NFULNL_COPY_META 0x01 88#define NFULNL_COPY_META 0x01
86#define NFULNL_COPY_PACKET 0x02 89#define NFULNL_COPY_PACKET 0x02
87 90
91#define NFULNL_CFG_F_SEQ 0x0001
92#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
93
88#endif /* _NFNETLINK_LOG_H */ 94#endif /* _NFNETLINK_LOG_H */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 6500d4e59d46..1350e47b0234 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -4,6 +4,62 @@
4#define XT_FUNCTION_MAXNAMELEN 30 4#define XT_FUNCTION_MAXNAMELEN 30
5#define XT_TABLE_MAXNAMELEN 32 5#define XT_TABLE_MAXNAMELEN 32
6 6
7struct xt_entry_match
8{
9 union {
10 struct {
11 u_int16_t match_size;
12
13 /* Used by userspace */
14 char name[XT_FUNCTION_MAXNAMELEN-1];
15
16 u_int8_t revision;
17 } user;
18 struct {
19 u_int16_t match_size;
20
21 /* Used inside the kernel */
22 struct xt_match *match;
23 } kernel;
24
25 /* Total length */
26 u_int16_t match_size;
27 } u;
28
29 unsigned char data[0];
30};
31
32struct xt_entry_target
33{
34 union {
35 struct {
36 u_int16_t target_size;
37
38 /* Used by userspace */
39 char name[XT_FUNCTION_MAXNAMELEN-1];
40
41 u_int8_t revision;
42 } user;
43 struct {
44 u_int16_t target_size;
45
46 /* Used inside the kernel */
47 struct xt_target *target;
48 } kernel;
49
50 /* Total length */
51 u_int16_t target_size;
52 } u;
53
54 unsigned char data[0];
55};
56
57struct xt_standard_target
58{
59 struct xt_entry_target target;
60 int verdict;
61};
62
7/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision 63/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
8 * kernel supports, if >= revision. */ 64 * kernel supports, if >= revision. */
9struct xt_get_revision 65struct xt_get_revision
@@ -92,8 +148,6 @@ struct xt_match
92 148
93 const char name[XT_FUNCTION_MAXNAMELEN-1]; 149 const char name[XT_FUNCTION_MAXNAMELEN-1];
94 150
95 u_int8_t revision;
96
97 /* Return true or false: return FALSE and set *hotdrop = 1 to 151 /* Return true or false: return FALSE and set *hotdrop = 1 to
98 force immediate packet drop. */ 152 force immediate packet drop. */
99 /* Arguments changed since 2.6.9, as this must now handle 153 /* Arguments changed since 2.6.9, as this must now handle
@@ -102,6 +156,7 @@ struct xt_match
102 int (*match)(const struct sk_buff *skb, 156 int (*match)(const struct sk_buff *skb,
103 const struct net_device *in, 157 const struct net_device *in,
104 const struct net_device *out, 158 const struct net_device *out,
159 const struct xt_match *match,
105 const void *matchinfo, 160 const void *matchinfo,
106 int offset, 161 int offset,
107 unsigned int protoff, 162 unsigned int protoff,
@@ -111,15 +166,25 @@ struct xt_match
111 /* Should return true or false. */ 166 /* Should return true or false. */
112 int (*checkentry)(const char *tablename, 167 int (*checkentry)(const char *tablename,
113 const void *ip, 168 const void *ip,
169 const struct xt_match *match,
114 void *matchinfo, 170 void *matchinfo,
115 unsigned int matchinfosize, 171 unsigned int matchinfosize,
116 unsigned int hook_mask); 172 unsigned int hook_mask);
117 173
118 /* Called when entry of this type deleted. */ 174 /* Called when entry of this type deleted. */
119 void (*destroy)(void *matchinfo, unsigned int matchinfosize); 175 void (*destroy)(const struct xt_match *match, void *matchinfo,
176 unsigned int matchinfosize);
120 177
121 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 178 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
122 struct module *me; 179 struct module *me;
180
181 char *table;
182 unsigned int matchsize;
183 unsigned int hooks;
184 unsigned short proto;
185
186 unsigned short family;
187 u_int8_t revision;
123}; 188};
124 189
125/* Registration hooks for targets. */ 190/* Registration hooks for targets. */
@@ -129,8 +194,6 @@ struct xt_target
129 194
130 const char name[XT_FUNCTION_MAXNAMELEN-1]; 195 const char name[XT_FUNCTION_MAXNAMELEN-1];
131 196
132 u_int8_t revision;
133
134 /* Returns verdict. Argument order changed since 2.6.9, as this 197 /* Returns verdict. Argument order changed since 2.6.9, as this
135 must now handle non-linear skbs, using skb_copy_bits and 198 must now handle non-linear skbs, using skb_copy_bits and
136 skb_ip_make_writable. */ 199 skb_ip_make_writable. */
@@ -138,6 +201,7 @@ struct xt_target
138 const struct net_device *in, 201 const struct net_device *in,
139 const struct net_device *out, 202 const struct net_device *out,
140 unsigned int hooknum, 203 unsigned int hooknum,
204 const struct xt_target *target,
141 const void *targinfo, 205 const void *targinfo,
142 void *userdata); 206 void *userdata);
143 207
@@ -147,15 +211,25 @@ struct xt_target
147 /* Should return true or false. */ 211 /* Should return true or false. */
148 int (*checkentry)(const char *tablename, 212 int (*checkentry)(const char *tablename,
149 const void *entry, 213 const void *entry,
214 const struct xt_target *target,
150 void *targinfo, 215 void *targinfo,
151 unsigned int targinfosize, 216 unsigned int targinfosize,
152 unsigned int hook_mask); 217 unsigned int hook_mask);
153 218
154 /* Called when entry of this type deleted. */ 219 /* Called when entry of this type deleted. */
155 void (*destroy)(void *targinfo, unsigned int targinfosize); 220 void (*destroy)(const struct xt_target *target, void *targinfo,
221 unsigned int targinfosize);
156 222
157 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 223 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
158 struct module *me; 224 struct module *me;
225
226 char *table;
227 unsigned int targetsize;
228 unsigned int hooks;
229 unsigned short proto;
230
231 unsigned short family;
232 u_int8_t revision;
159}; 233};
160 234
161/* Furniture shopping... */ 235/* Furniture shopping... */
@@ -202,10 +276,17 @@ struct xt_table_info
202 char *entries[NR_CPUS]; 276 char *entries[NR_CPUS];
203}; 277};
204 278
205extern int xt_register_target(int af, struct xt_target *target); 279extern int xt_register_target(struct xt_target *target);
206extern void xt_unregister_target(int af, struct xt_target *target); 280extern void xt_unregister_target(struct xt_target *target);
207extern int xt_register_match(int af, struct xt_match *target); 281extern int xt_register_match(struct xt_match *target);
208extern void xt_unregister_match(int af, struct xt_match *target); 282extern void xt_unregister_match(struct xt_match *target);
283
284extern int xt_check_match(const struct xt_match *match, unsigned short family,
285 unsigned int size, const char *table, unsigned int hook,
286 unsigned short proto, int inv_proto);
287extern int xt_check_target(const struct xt_target *target, unsigned short family,
288 unsigned int size, const char *table, unsigned int hook,
289 unsigned short proto, int inv_proto);
209 290
210extern int xt_register_table(struct xt_table *table, 291extern int xt_register_table(struct xt_table *table,
211 struct xt_table_info *bootstrap, 292 struct xt_table_info *bootstrap,
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h
new file mode 100644
index 000000000000..a8132ec076fb
--- /dev/null
+++ b/include/linux/netfilter/xt_policy.h
@@ -0,0 +1,58 @@
1#ifndef _XT_POLICY_H
2#define _XT_POLICY_H
3
4#define XT_POLICY_MAX_ELEM 4
5
6enum xt_policy_flags
7{
8 XT_POLICY_MATCH_IN = 0x1,
9 XT_POLICY_MATCH_OUT = 0x2,
10 XT_POLICY_MATCH_NONE = 0x4,
11 XT_POLICY_MATCH_STRICT = 0x8,
12};
13
14enum xt_policy_modes
15{
16 XT_POLICY_MODE_TRANSPORT,
17 XT_POLICY_MODE_TUNNEL
18};
19
20struct xt_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
30union xt_policy_addr
31{
32 struct in_addr a4;
33 struct in6_addr a6;
34};
35
36struct xt_policy_elem
37{
38 union xt_policy_addr saddr;
39 union xt_policy_addr smask;
40 union xt_policy_addr daddr;
41 union xt_policy_addr dmask;
42 u_int32_t spi;
43 u_int32_t reqid;
44 u_int8_t proto;
45 u_int8_t mode;
46
47 struct xt_policy_spec match;
48 struct xt_policy_spec invert;
49};
50
51struct xt_policy_info
52{
53 struct xt_policy_elem pol[XT_POLICY_MAX_ELEM];
54 u_int16_t flags;
55 u_int16_t len;
56};
57
58#endif /* _XT_POLICY_H */
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index fd21796e5131..62cc27daca4e 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -65,35 +65,8 @@ struct arpt_arp {
65 u_int16_t invflags; 65 u_int16_t invflags;
66}; 66};
67 67
68struct arpt_entry_target 68#define arpt_entry_target xt_entry_target
69{ 69#define arpt_standard_target xt_standard_target
70 union {
71 struct {
72 u_int16_t target_size;
73
74 /* Used by userspace */
75 char name[ARPT_FUNCTION_MAXNAMELEN-1];
76 u_int8_t revision;
77 } user;
78 struct {
79 u_int16_t target_size;
80
81 /* Used inside the kernel */
82 struct arpt_target *target;
83 } kernel;
84
85 /* Total length */
86 u_int16_t target_size;
87 } u;
88
89 unsigned char data[0];
90};
91
92struct arpt_standard_target
93{
94 struct arpt_entry_target target;
95 int verdict;
96};
97 70
98/* Values for "flag" field in struct arpt_ip (general arp structure). 71/* Values for "flag" field in struct arpt_ip (general arp structure).
99 * No flags defined yet. 72 * No flags defined yet.
@@ -263,8 +236,10 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e
263 */ 236 */
264#ifdef __KERNEL__ 237#ifdef __KERNEL__
265 238
266#define arpt_register_target(tgt) xt_register_target(NF_ARP, tgt) 239#define arpt_register_target(tgt) \
267#define arpt_unregister_target(tgt) xt_unregister_target(NF_ARP, tgt) 240({ (tgt)->family = NF_ARP; \
241 xt_register_target(tgt); })
242#define arpt_unregister_target(tgt) xt_unregister_target(tgt)
268 243
269extern int arpt_register_table(struct arpt_table *table, 244extern int arpt_register_table(struct arpt_table *table,
270 const struct arpt_replace *repl); 245 const struct arpt_replace *repl);
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index de4d397865ce..a75b84bb9a88 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -47,22 +47,6 @@ enum nf_br_hook_priorities {
47#define BRNF_BRIDGED 0x08 47#define BRNF_BRIDGED 0x08
48#define BRNF_NF_BRIDGE_PREROUTING 0x10 48#define BRNF_NF_BRIDGE_PREROUTING 0x10
49 49
50static inline
51struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb)
52{
53 struct nf_bridge_info **nf_bridge = &(skb->nf_bridge);
54
55 if ((*nf_bridge = kmalloc(sizeof(**nf_bridge), GFP_ATOMIC)) != NULL) {
56 atomic_set(&(*nf_bridge)->use, 1);
57 (*nf_bridge)->mask = 0;
58 (*nf_bridge)->physindev = (*nf_bridge)->physoutdev = NULL;
59#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
60 (*nf_bridge)->netoutdev = NULL;
61#endif
62 }
63
64 return *nf_bridge;
65}
66 50
67/* Only used in br_forward.c */ 51/* Only used in br_forward.c */
68static inline 52static inline
@@ -77,17 +61,6 @@ void nf_bridge_maybe_copy_header(struct sk_buff *skb)
77 } 61 }
78} 62}
79 63
80static inline
81void nf_bridge_save_header(struct sk_buff *skb)
82{
83 int header_size = 16;
84
85 if (skb->protocol == __constant_htons(ETH_P_8021Q))
86 header_size = 18;
87
88 memcpy(skb->nf_bridge->data, skb->data - header_size, header_size);
89}
90
91/* This is called by the IP fragmenting code and it ensures there is 64/* This is called by the IP fragmenting code and it ensures there is
92 * enough room for the encapsulating header (if there is one). */ 65 * enough room for the encapsulating header (if there is one). */
93static inline 66static inline
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 215765f043e6..d54d7b278e96 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -29,6 +29,7 @@ union ip_conntrack_expect_proto {
29}; 29};
30 30
31/* Add protocol helper include file here */ 31/* Add protocol helper include file here */
32#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
32#include <linux/netfilter_ipv4/ip_conntrack_pptp.h> 33#include <linux/netfilter_ipv4/ip_conntrack_pptp.h>
33#include <linux/netfilter_ipv4/ip_conntrack_amanda.h> 34#include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
34#include <linux/netfilter_ipv4/ip_conntrack_ftp.h> 35#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
@@ -37,6 +38,7 @@ union ip_conntrack_expect_proto {
37/* per conntrack: application helper private data */ 38/* per conntrack: application helper private data */
38union ip_conntrack_help { 39union ip_conntrack_help {
39 /* insert conntrack helper private data (master) here */ 40 /* insert conntrack helper private data (master) here */
41 struct ip_ct_h323_master ct_h323_info;
40 struct ip_ct_pptp_master ct_pptp_info; 42 struct ip_ct_pptp_master ct_pptp_info;
41 struct ip_ct_ftp_master ct_ftp_info; 43 struct ip_ct_ftp_master ct_ftp_info;
42 struct ip_ct_irc_master ct_irc_info; 44 struct ip_ct_irc_master ct_irc_info;
@@ -306,29 +308,30 @@ DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache);
306 308
307#define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x) 309#define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x)
308 310
309extern struct notifier_block *ip_conntrack_chain; 311extern struct atomic_notifier_head ip_conntrack_chain;
310extern struct notifier_block *ip_conntrack_expect_chain; 312extern struct atomic_notifier_head ip_conntrack_expect_chain;
311 313
312static inline int ip_conntrack_register_notifier(struct notifier_block *nb) 314static inline int ip_conntrack_register_notifier(struct notifier_block *nb)
313{ 315{
314 return notifier_chain_register(&ip_conntrack_chain, nb); 316 return atomic_notifier_chain_register(&ip_conntrack_chain, nb);
315} 317}
316 318
317static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb) 319static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb)
318{ 320{
319 return notifier_chain_unregister(&ip_conntrack_chain, nb); 321 return atomic_notifier_chain_unregister(&ip_conntrack_chain, nb);
320} 322}
321 323
322static inline int 324static inline int
323ip_conntrack_expect_register_notifier(struct notifier_block *nb) 325ip_conntrack_expect_register_notifier(struct notifier_block *nb)
324{ 326{
325 return notifier_chain_register(&ip_conntrack_expect_chain, nb); 327 return atomic_notifier_chain_register(&ip_conntrack_expect_chain, nb);
326} 328}
327 329
328static inline int 330static inline int
329ip_conntrack_expect_unregister_notifier(struct notifier_block *nb) 331ip_conntrack_expect_unregister_notifier(struct notifier_block *nb)
330{ 332{
331 return notifier_chain_unregister(&ip_conntrack_expect_chain, nb); 333 return atomic_notifier_chain_unregister(&ip_conntrack_expect_chain,
334 nb);
332} 335}
333 336
334extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct); 337extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct);
@@ -353,14 +356,14 @@ static inline void ip_conntrack_event(enum ip_conntrack_events event,
353 struct ip_conntrack *ct) 356 struct ip_conntrack *ct)
354{ 357{
355 if (is_confirmed(ct) && !is_dying(ct)) 358 if (is_confirmed(ct) && !is_dying(ct))
356 notifier_call_chain(&ip_conntrack_chain, event, ct); 359 atomic_notifier_call_chain(&ip_conntrack_chain, event, ct);
357} 360}
358 361
359static inline void 362static inline void
360ip_conntrack_expect_event(enum ip_conntrack_expect_events event, 363ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
361 struct ip_conntrack_expect *exp) 364 struct ip_conntrack_expect *exp)
362{ 365{
363 notifier_call_chain(&ip_conntrack_expect_chain, event, exp); 366 atomic_notifier_call_chain(&ip_conntrack_expect_chain, event, exp);
364} 367}
365#else /* CONFIG_IP_NF_CONNTRACK_EVENTS */ 368#else /* CONFIG_IP_NF_CONNTRACK_EVENTS */
366static inline void ip_conntrack_event_cache(enum ip_conntrack_events event, 369static inline void ip_conntrack_event_cache(enum ip_conntrack_events event,
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
new file mode 100644
index 000000000000..0987cea53840
--- /dev/null
+++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
@@ -0,0 +1,30 @@
1#ifndef _IP_CONNTRACK_H323_H
2#define _IP_CONNTRACK_H323_H
3
4#ifdef __KERNEL__
5
6#define RAS_PORT 1719
7#define Q931_PORT 1720
8#define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */
9
10/* This structure exists only once per master */
11struct ip_ct_h323_master {
12
13 /* Original and NATed Q.931 or H.245 signal ports */
14 u_int16_t sig_port[IP_CT_DIR_MAX];
15
16 /* Original and NATed RTP ports */
17 u_int16_t rtp_port[H323_RTP_CHANNEL_MAX][IP_CT_DIR_MAX];
18
19 union {
20 /* RAS connection timeout */
21 u_int32_t timeout;
22
23 /* Next TPKT length (for separate TPKT header and data) */
24 u_int16_t tpkt_len[IP_CT_DIR_MAX];
25 };
26};
27
28#endif
29
30#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
index 41a107de17cf..e9f5ed1d9f68 100644
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ b/include/linux/netfilter_ipv4/ip_nat.h
@@ -23,7 +23,7 @@ struct ip_nat_seq {
23 * modification (if any) */ 23 * modification (if any) */
24 u_int32_t correction_pos; 24 u_int32_t correction_pos;
25 /* sequence number offset before and after last modification */ 25 /* sequence number offset before and after last modification */
26 int32_t offset_before, offset_after; 26 int16_t offset_before, offset_after;
27}; 27};
28 28
29/* Single range specification. */ 29/* Single range specification. */
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 76ba24b68515..d5b8c0d6a12b 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -52,61 +52,9 @@ struct ipt_ip {
52 u_int8_t invflags; 52 u_int8_t invflags;
53}; 53};
54 54
55struct ipt_entry_match 55#define ipt_entry_match xt_entry_match
56{ 56#define ipt_entry_target xt_entry_target
57 union { 57#define ipt_standard_target xt_standard_target
58 struct {
59 u_int16_t match_size;
60
61 /* Used by userspace */
62 char name[IPT_FUNCTION_MAXNAMELEN-1];
63
64 u_int8_t revision;
65 } user;
66 struct {
67 u_int16_t match_size;
68
69 /* Used inside the kernel */
70 struct ipt_match *match;
71 } kernel;
72
73 /* Total length */
74 u_int16_t match_size;
75 } u;
76
77 unsigned char data[0];
78};
79
80struct ipt_entry_target
81{
82 union {
83 struct {
84 u_int16_t target_size;
85
86 /* Used by userspace */
87 char name[IPT_FUNCTION_MAXNAMELEN-1];
88
89 u_int8_t revision;
90 } user;
91 struct {
92 u_int16_t target_size;
93
94 /* Used inside the kernel */
95 struct ipt_target *target;
96 } kernel;
97
98 /* Total length */
99 u_int16_t target_size;
100 } u;
101
102 unsigned char data[0];
103};
104
105struct ipt_standard_target
106{
107 struct ipt_entry_target target;
108 int verdict;
109};
110 58
111#define ipt_counters xt_counters 59#define ipt_counters xt_counters
112 60
@@ -321,11 +269,15 @@ ipt_get_target(struct ipt_entry *e)
321#include <linux/init.h> 269#include <linux/init.h>
322extern void ipt_init(void) __init; 270extern void ipt_init(void) __init;
323 271
324#define ipt_register_target(tgt) xt_register_target(AF_INET, tgt) 272#define ipt_register_target(tgt) \
325#define ipt_unregister_target(tgt) xt_unregister_target(AF_INET, tgt) 273({ (tgt)->family = AF_INET; \
274 xt_register_target(tgt); })
275#define ipt_unregister_target(tgt) xt_unregister_target(tgt)
326 276
327#define ipt_register_match(mtch) xt_register_match(AF_INET, mtch) 277#define ipt_register_match(mtch) \
328#define ipt_unregister_match(mtch) xt_unregister_match(AF_INET, mtch) 278({ (mtch)->family = AF_INET; \
279 xt_register_match(mtch); })
280#define ipt_unregister_match(mtch) xt_unregister_match(mtch)
329 281
330//#define ipt_register_table(tbl, repl) xt_register_table(AF_INET, tbl, repl) 282//#define ipt_register_table(tbl, repl) xt_register_table(AF_INET, tbl, repl)
331//#define ipt_unregister_table(tbl) xt_unregister_table(AF_INET, tbl) 283//#define ipt_unregister_table(tbl) xt_unregister_table(AF_INET, tbl)
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
index a3f6eff39d33..b9478a255301 100644
--- a/include/linux/netfilter_ipv4/ipt_policy.h
+++ b/include/linux/netfilter_ipv4/ipt_policy.h
@@ -1,58 +1,21 @@
1#ifndef _IPT_POLICY_H 1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H 2#define _IPT_POLICY_H
3 3
4#define IPT_POLICY_MAX_ELEM 4 4#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 5
6enum ipt_policy_flags 6/* ipt_policy_flags */
7{ 7#define IPT_POLICY_MATCH_IN XT_POLICY_MATCH_IN
8 IPT_POLICY_MATCH_IN = 0x1, 8#define IPT_POLICY_MATCH_OUT XT_POLICY_MATCH_OUT
9 IPT_POLICY_MATCH_OUT = 0x2, 9#define IPT_POLICY_MATCH_NONE XT_POLICY_MATCH_NONE
10 IPT_POLICY_MATCH_NONE = 0x4, 10#define IPT_POLICY_MATCH_STRICT XT_POLICY_MATCH_STRICT
11 IPT_POLICY_MATCH_STRICT = 0x8, 11
12}; 12/* ipt_policy_modes */
13 13#define IPT_POLICY_MODE_TRANSPORT XT_POLICY_MODE_TRANSPORT
14enum ipt_policy_modes 14#define IPT_POLICY_MODE_TUNNEL XT_POLICY_MODE_TUNNEL
15{ 15
16 IPT_POLICY_MODE_TRANSPORT, 16#define ipt_policy_spec xt_policy_spec
17 IPT_POLICY_MODE_TUNNEL 17#define ipt_policy_addr xt_policy_addr
18}; 18#define ipt_policy_elem xt_policy_elem
19 19#define ipt_policy_info xt_policy_info
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
30union ipt_policy_addr
31{
32 struct in_addr a4;
33 struct in6_addr a6;
34};
35
36struct ipt_policy_elem
37{
38 union ipt_policy_addr saddr;
39 union ipt_policy_addr smask;
40 union ipt_policy_addr daddr;
41 union ipt_policy_addr dmask;
42 u_int32_t spi;
43 u_int32_t reqid;
44 u_int8_t proto;
45 u_int8_t mode;
46
47 struct ipt_policy_spec match;
48 struct ipt_policy_spec invert;
49};
50
51struct ipt_policy_info
52{
53 struct ipt_policy_elem pol[IPT_POLICY_MAX_ELEM];
54 u_int16_t flags;
55 u_int16_t len;
56};
57 20
58#endif /* _IPT_POLICY_H */ 21#endif /* _IPT_POLICY_H */
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index f249b574f0fa..d0d5d1ee4be3 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -56,60 +56,9 @@ struct ip6t_ip6 {
56 u_int8_t invflags; 56 u_int8_t invflags;
57}; 57};
58 58
59/* FIXME: If alignment in kernel different from userspace? --RR */ 59#define ip6t_entry_match xt_entry_match
60struct ip6t_entry_match 60#define ip6t_entry_target xt_entry_target
61{ 61#define ip6t_standard_target xt_standard_target
62 union {
63 struct {
64 u_int16_t match_size;
65
66 /* Used by userspace */
67 char name[IP6T_FUNCTION_MAXNAMELEN-1];
68 u_int8_t revision;
69 } user;
70 struct {
71 u_int16_t match_size;
72
73 /* Used inside the kernel */
74 struct ip6t_match *match;
75 } kernel;
76
77 /* Total length */
78 u_int16_t match_size;
79 } u;
80
81 unsigned char data[0];
82};
83
84struct ip6t_entry_target
85{
86 union {
87 struct {
88 u_int16_t target_size;
89
90 /* Used by userspace */
91 char name[IP6T_FUNCTION_MAXNAMELEN-1];
92 u_int8_t revision;
93 } user;
94 struct {
95 u_int16_t target_size;
96
97 /* Used inside the kernel */
98 struct ip6t_target *target;
99 } kernel;
100
101 /* Total length */
102 u_int16_t target_size;
103 } u;
104
105 unsigned char data[0];
106};
107
108struct ip6t_standard_target
109{
110 struct ip6t_entry_target target;
111 int verdict;
112};
113 62
114#define ip6t_counters xt_counters 63#define ip6t_counters xt_counters
115 64
@@ -334,11 +283,15 @@ ip6t_get_target(struct ip6t_entry *e)
334#include <linux/init.h> 283#include <linux/init.h>
335extern void ip6t_init(void) __init; 284extern void ip6t_init(void) __init;
336 285
337#define ip6t_register_target(tgt) xt_register_target(AF_INET6, tgt) 286#define ip6t_register_target(tgt) \
338#define ip6t_unregister_target(tgt) xt_unregister_target(AF_INET6, tgt) 287({ (tgt)->family = AF_INET6; \
288 xt_register_target(tgt); })
289#define ip6t_unregister_target(tgt) xt_unregister_target(tgt)
339 290
340#define ip6t_register_match(match) xt_register_match(AF_INET6, match) 291#define ip6t_register_match(match) \
341#define ip6t_unregister_match(match) xt_unregister_match(AF_INET6, match) 292({ (match)->family = AF_INET6; \
293 xt_register_match(match); })
294#define ip6t_unregister_match(match) xt_unregister_match(match)
342 295
343extern int ip6t_register_table(struct ip6t_table *table, 296extern int ip6t_register_table(struct ip6t_table *table,
344 const struct ip6t_replace *repl); 297 const struct ip6t_replace *repl);
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
index 671bd818300f..6bab3163d2fb 100644
--- a/include/linux/netfilter_ipv6/ip6t_policy.h
+++ b/include/linux/netfilter_ipv6/ip6t_policy.h
@@ -1,58 +1,21 @@
1#ifndef _IP6T_POLICY_H 1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H 2#define _IP6T_POLICY_H
3 3
4#define IP6T_POLICY_MAX_ELEM 4 4#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 5
6enum ip6t_policy_flags 6/* ip6t_policy_flags */
7{ 7#define IP6T_POLICY_MATCH_IN XT_POLICY_MATCH_IN
8 IP6T_POLICY_MATCH_IN = 0x1, 8#define IP6T_POLICY_MATCH_OUT XT_POLICY_MATCH_OUT
9 IP6T_POLICY_MATCH_OUT = 0x2, 9#define IP6T_POLICY_MATCH_NONE XT_POLICY_MATCH_NONE
10 IP6T_POLICY_MATCH_NONE = 0x4, 10#define IP6T_POLICY_MATCH_STRICT XT_POLICY_MATCH_STRICT
11 IP6T_POLICY_MATCH_STRICT = 0x8, 11
12}; 12/* ip6t_policy_modes */
13 13#define IP6T_POLICY_MODE_TRANSPORT XT_POLICY_MODE_TRANSPORT
14enum ip6t_policy_modes 14#define IP6T_POLICY_MODE_TUNNEL XT_POLICY_MODE_TUNNEL
15{ 15
16 IP6T_POLICY_MODE_TRANSPORT, 16#define ip6t_policy_spec xt_policy_spec
17 IP6T_POLICY_MODE_TUNNEL 17#define ip6t_policy_addr xt_policy_addr
18}; 18#define ip6t_policy_elem xt_policy_elem
19 19#define ip6t_policy_info xt_policy_info
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
30union ip6t_policy_addr
31{
32 struct in_addr a4;
33 struct in6_addr a6;
34};
35
36struct ip6t_policy_elem
37{
38 union ip6t_policy_addr saddr;
39 union ip6t_policy_addr smask;
40 union ip6t_policy_addr daddr;
41 union ip6t_policy_addr dmask;
42 u_int32_t spi;
43 u_int32_t reqid;
44 u_int8_t proto;
45 u_int8_t mode;
46
47 struct ip6t_policy_spec match;
48 struct ip6t_policy_spec invert;
49};
50
51struct ip6t_policy_info
52{
53 struct ip6t_policy_elem pol[IP6T_POLICY_MAX_ELEM];
54 u_int16_t flags;
55 u_int16_t len;
56};
57 20
58#endif /* _IP6T_POLICY_H */ 21#endif /* _IP6T_POLICY_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index c256ebe2a7b4..f8f3d1c927f8 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -151,6 +151,7 @@ struct netlink_skb_parms
151 151
152extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module); 152extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module);
153extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 153extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
154extern int netlink_has_listeners(struct sock *sk, unsigned int group);
154extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 155extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
155extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 156extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
156 __u32 group, gfp_t allocation); 157 __u32 group, gfp_t allocation);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index b4dc6e2e10c9..c71227dd4389 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -56,9 +56,7 @@
56 * When flushing a cluster of dirty pages, there can be different 56 * When flushing a cluster of dirty pages, there can be different
57 * strategies: 57 * strategies:
58 */ 58 */
59#define FLUSH_AGING 0 /* only flush old buffers */
60#define FLUSH_SYNC 1 /* file being synced, or contention */ 59#define FLUSH_SYNC 1 /* file being synced, or contention */
61#define FLUSH_WAIT 2 /* wait for completion */
62#define FLUSH_STABLE 4 /* commit to stable storage */ 60#define FLUSH_STABLE 4 /* commit to stable storage */
63#define FLUSH_LOWPRI 8 /* low priority background flush */ 61#define FLUSH_LOWPRI 8 /* low priority background flush */
64#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 62#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
@@ -78,6 +76,7 @@ struct nfs_access_entry {
78struct nfs4_state; 76struct nfs4_state;
79struct nfs_open_context { 77struct nfs_open_context {
80 atomic_t count; 78 atomic_t count;
79 struct vfsmount *vfsmnt;
81 struct dentry *dentry; 80 struct dentry *dentry;
82 struct rpc_cred *cred; 81 struct rpc_cred *cred;
83 struct nfs4_state *state; 82 struct nfs4_state *state;
@@ -118,8 +117,7 @@ struct nfs_inode {
118 unsigned long cache_validity; /* bit mask */ 117 unsigned long cache_validity; /* bit mask */
119 118
120 /* 119 /*
121 * read_cache_jiffies is when we started read-caching this inode, 120 * read_cache_jiffies is when we started read-caching this inode.
122 * and read_cache_mtime is the mtime of the inode at that time.
123 * attrtimeo is for how long the cached information is assumed 121 * attrtimeo is for how long the cached information is assumed
124 * to be valid. A successful attribute revalidation doubles 122 * to be valid. A successful attribute revalidation doubles
125 * attrtimeo (up to acregmax/acdirmax), a failure resets it to 123 * attrtimeo (up to acregmax/acdirmax), a failure resets it to
@@ -128,11 +126,6 @@ struct nfs_inode {
128 * We need to revalidate the cached attrs for this inode if 126 * We need to revalidate the cached attrs for this inode if
129 * 127 *
130 * jiffies - read_cache_jiffies > attrtimeo 128 * jiffies - read_cache_jiffies > attrtimeo
131 *
132 * and invalidate any cached data/flush out any dirty pages if
133 * we find that
134 *
135 * mtime != read_cache_mtime
136 */ 129 */
137 unsigned long read_cache_jiffies; 130 unsigned long read_cache_jiffies;
138 unsigned long attrtimeo; 131 unsigned long attrtimeo;
@@ -311,12 +304,9 @@ extern void nfs_begin_attr_update(struct inode *);
311extern void nfs_end_attr_update(struct inode *); 304extern void nfs_end_attr_update(struct inode *);
312extern void nfs_begin_data_update(struct inode *); 305extern void nfs_begin_data_update(struct inode *);
313extern void nfs_end_data_update(struct inode *); 306extern void nfs_end_data_update(struct inode *);
314extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred);
315extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 307extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
316extern void put_nfs_open_context(struct nfs_open_context *ctx); 308extern void put_nfs_open_context(struct nfs_open_context *ctx);
317extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
318extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 309extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
319extern void nfs_file_clear_open_context(struct file *filp);
320 310
321/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 311/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
322extern u32 root_nfs_parse_addr(char *name); /*__init*/ 312extern u32 root_nfs_parse_addr(char *name); /*__init*/
@@ -334,7 +324,7 @@ extern struct inode_operations nfs_file_inode_operations;
334#ifdef CONFIG_NFS_V3 324#ifdef CONFIG_NFS_V3
335extern struct inode_operations nfs3_file_inode_operations; 325extern struct inode_operations nfs3_file_inode_operations;
336#endif /* CONFIG_NFS_V3 */ 326#endif /* CONFIG_NFS_V3 */
337extern struct file_operations nfs_file_operations; 327extern const struct file_operations nfs_file_operations;
338extern struct address_space_operations nfs_file_aops; 328extern struct address_space_operations nfs_file_aops;
339 329
340static inline struct rpc_cred *nfs_file_cred(struct file *file) 330static inline struct rpc_cred *nfs_file_cred(struct file *file)
@@ -381,7 +371,7 @@ extern struct inode_operations nfs_dir_inode_operations;
381#ifdef CONFIG_NFS_V3 371#ifdef CONFIG_NFS_V3
382extern struct inode_operations nfs3_dir_inode_operations; 372extern struct inode_operations nfs3_dir_inode_operations;
383#endif /* CONFIG_NFS_V3 */ 373#endif /* CONFIG_NFS_V3 */
384extern struct file_operations nfs_dir_operations; 374extern const struct file_operations nfs_dir_operations;
385extern struct dentry_operations nfs_dentry_operations; 375extern struct dentry_operations nfs_dentry_operations;
386 376
387extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 377extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
@@ -415,21 +405,22 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
415extern int nfs_writepages(struct address_space *, struct writeback_control *); 405extern int nfs_writepages(struct address_space *, struct writeback_control *);
416extern int nfs_flush_incompatible(struct file *file, struct page *page); 406extern int nfs_flush_incompatible(struct file *file, struct page *page);
417extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 407extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
418extern void nfs_writeback_done(struct rpc_task *task, void *data); 408extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
419extern void nfs_writedata_release(void *data); 409extern void nfs_writedata_release(void *);
420 410
421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 411#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
422extern void nfs_commit_done(struct rpc_task *, void *data); 412struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount);
423extern void nfs_commit_release(void *data); 413void nfs_commit_free(struct nfs_write_data *p);
424#endif 414#endif
425 415
426/* 416/*
427 * Try to write back everything synchronously (but check the 417 * Try to write back everything synchronously (but check the
428 * return value!) 418 * return value!)
429 */ 419 */
430extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); 420extern int nfs_sync_inode_wait(struct inode *, unsigned long, unsigned int, int);
431#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
432extern int nfs_commit_inode(struct inode *, int); 422extern int nfs_commit_inode(struct inode *, int);
423extern void nfs_commit_release(void *wdata);
433#else 424#else
434static inline int 425static inline int
435nfs_commit_inode(struct inode *inode, int how) 426nfs_commit_inode(struct inode *inode, int how)
@@ -447,7 +438,7 @@ nfs_have_writebacks(struct inode *inode)
447static inline int 438static inline int
448nfs_wb_all(struct inode *inode) 439nfs_wb_all(struct inode *inode)
449{ 440{
450 int error = nfs_sync_inode(inode, 0, 0, FLUSH_WAIT); 441 int error = nfs_sync_inode_wait(inode, 0, 0, 0);
451 return (error < 0) ? error : 0; 442 return (error < 0) ? error : 0;
452} 443}
453 444
@@ -456,8 +447,8 @@ nfs_wb_all(struct inode *inode)
456 */ 447 */
457static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how) 448static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how)
458{ 449{
459 int error = nfs_sync_inode(inode, page->index, 1, 450 int error = nfs_sync_inode_wait(inode, page->index, 1,
460 how | FLUSH_WAIT | FLUSH_STABLE); 451 how | FLUSH_STABLE);
461 return (error < 0) ? error : 0; 452 return (error < 0) ? error : 0;
462} 453}
463 454
@@ -469,37 +460,8 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page)
469/* 460/*
470 * Allocate and free nfs_write_data structures 461 * Allocate and free nfs_write_data structures
471 */ 462 */
472extern mempool_t *nfs_wdata_mempool; 463extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount);
473 464extern void nfs_writedata_free(struct nfs_write_data *p);
474static inline struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount)
475{
476 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS);
477
478 if (p) {
479 memset(p, 0, sizeof(*p));
480 INIT_LIST_HEAD(&p->pages);
481 if (pagecount < NFS_PAGEVEC_SIZE)
482 p->pagevec = &p->page_array[0];
483 else {
484 size_t size = ++pagecount * sizeof(struct page *);
485 p->pagevec = kmalloc(size, GFP_NOFS);
486 if (p->pagevec) {
487 memset(p->pagevec, 0, size);
488 } else {
489 mempool_free(p, nfs_wdata_mempool);
490 p = NULL;
491 }
492 }
493 }
494 return p;
495}
496
497static inline void nfs_writedata_free(struct nfs_write_data *p)
498{
499 if (p && (p->pagevec != &p->page_array[0]))
500 kfree(p->pagevec);
501 mempool_free(p, nfs_wdata_mempool);
502}
503 465
504/* 466/*
505 * linux/fs/nfs/read.c 467 * linux/fs/nfs/read.c
@@ -507,44 +469,14 @@ static inline void nfs_writedata_free(struct nfs_write_data *p)
507extern int nfs_readpage(struct file *, struct page *); 469extern int nfs_readpage(struct file *, struct page *);
508extern int nfs_readpages(struct file *, struct address_space *, 470extern int nfs_readpages(struct file *, struct address_space *,
509 struct list_head *, unsigned); 471 struct list_head *, unsigned);
510extern void nfs_readpage_result(struct rpc_task *, void *); 472extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
511extern void nfs_readdata_release(void *data); 473extern void nfs_readdata_release(void *data);
512
513 474
514/* 475/*
515 * Allocate and free nfs_read_data structures 476 * Allocate and free nfs_read_data structures
516 */ 477 */
517extern mempool_t *nfs_rdata_mempool; 478extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount);
518 479extern void nfs_readdata_free(struct nfs_read_data *p);
519static inline struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
520{
521 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS);
522
523 if (p) {
524 memset(p, 0, sizeof(*p));
525 INIT_LIST_HEAD(&p->pages);
526 if (pagecount < NFS_PAGEVEC_SIZE)
527 p->pagevec = &p->page_array[0];
528 else {
529 size_t size = ++pagecount * sizeof(struct page *);
530 p->pagevec = kmalloc(size, GFP_NOFS);
531 if (p->pagevec) {
532 memset(p->pagevec, 0, size);
533 } else {
534 mempool_free(p, nfs_rdata_mempool);
535 p = NULL;
536 }
537 }
538 }
539 return p;
540}
541
542static inline void nfs_readdata_free(struct nfs_read_data *p)
543{
544 if (p && (p->pagevec != &p->page_array[0]))
545 kfree(p->pagevec);
546 mempool_free(p, nfs_rdata_mempool);
547}
548 480
549/* 481/*
550 * linux/fs/nfs3proc.c 482 * linux/fs/nfs3proc.c
diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h
index e2c18dabff86..861730275ba0 100644
--- a/include/linux/nfs_fs_i.h
+++ b/include/linux/nfs_fs_i.h
@@ -12,8 +12,8 @@ struct nlm_lockowner;
12 */ 12 */
13struct nfs_lock_info { 13struct nfs_lock_info {
14 u32 state; 14 u32 state;
15 u32 flags;
16 struct nlm_lockowner *owner; 15 struct nlm_lockowner *owner;
16 struct list_head list;
17}; 17};
18 18
19struct nfs4_lock_state; 19struct nfs4_lock_state;
@@ -21,10 +21,4 @@ struct nfs4_lock_info {
21 struct nfs4_lock_state *owner; 21 struct nfs4_lock_state *owner;
22}; 22};
23 23
24/*
25 * Lock flag values
26 */
27#define NFS_LCK_GRANTED 0x0001 /* lock has been granted */
28#define NFS_LCK_RECLAIM 0x0002 /* lock marked for reclaiming */
29
30#endif 24#endif
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3d3a305488cf..65dec21af774 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -4,6 +4,8 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/backing-dev.h> 5#include <linux/backing-dev.h>
6 6
7struct nfs_iostats;
8
7/* 9/*
8 * NFS client parameters stored in the superblock. 10 * NFS client parameters stored in the superblock.
9 */ 11 */
@@ -12,6 +14,7 @@ struct nfs_server {
12 struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */ 14 struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */
13 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 15 struct rpc_clnt * client_acl; /* ACL RPC client handle */
14 struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */ 16 struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */
17 struct nfs_iostats * io_stats; /* I/O statistics */
15 struct backing_dev_info backing_dev_info; 18 struct backing_dev_info backing_dev_info;
16 int flags; /* various flags */ 19 int flags; /* various flags */
17 unsigned int caps; /* server capabilities */ 20 unsigned int caps; /* server capabilities */
@@ -26,10 +29,13 @@ struct nfs_server {
26 unsigned int acregmax; 29 unsigned int acregmax;
27 unsigned int acdirmin; 30 unsigned int acdirmin;
28 unsigned int acdirmax; 31 unsigned int acdirmax;
32 unsigned long retrans_timeo; /* retransmit timeout */
33 unsigned int retrans_count; /* number of retransmit tries */
29 unsigned int namelen; 34 unsigned int namelen;
30 char * hostname; /* remote hostname */ 35 char * hostname; /* remote hostname */
31 struct nfs_fh fh; 36 struct nfs_fh fh;
32 struct sockaddr_in addr; 37 struct sockaddr_in addr;
38 unsigned long mount_time; /* when this fs was mounted */
33#ifdef CONFIG_NFS_V4 39#ifdef CONFIG_NFS_V4
34 /* Our own IP address, as a null-terminated string. 40 /* Our own IP address, as a null-terminated string.
35 * This is used to generate the clientid, and the callback address. 41 * This is used to generate the clientid, and the callback address.
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 6d6f69ec5675..7fafc4c546b7 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -695,7 +695,6 @@ struct nfs_read_data {
695#ifdef CONFIG_NFS_V4 695#ifdef CONFIG_NFS_V4
696 unsigned long timestamp; /* For lease renewal */ 696 unsigned long timestamp; /* For lease renewal */
697#endif 697#endif
698 void (*complete) (struct nfs_read_data *, int);
699 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 698 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
700}; 699};
701 700
@@ -714,7 +713,6 @@ struct nfs_write_data {
714#ifdef CONFIG_NFS_V4 713#ifdef CONFIG_NFS_V4
715 unsigned long timestamp; /* For lease renewal */ 714 unsigned long timestamp; /* For lease renewal */
716#endif 715#endif
717 void (*complete) (struct nfs_write_data *, int);
718 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 716 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
719}; 717};
720 718
@@ -769,8 +767,11 @@ struct nfs_rpc_ops {
769 struct nfs_pathconf *); 767 struct nfs_pathconf *);
770 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); 768 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
771 void (*read_setup) (struct nfs_read_data *); 769 void (*read_setup) (struct nfs_read_data *);
770 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
772 void (*write_setup) (struct nfs_write_data *, int how); 771 void (*write_setup) (struct nfs_write_data *, int how);
772 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
773 void (*commit_setup) (struct nfs_write_data *, int how); 773 void (*commit_setup) (struct nfs_write_data *, int how);
774 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
774 int (*file_open) (struct inode *, struct file *); 775 int (*file_open) (struct inode *, struct file *);
775 int (*file_release) (struct inode *, struct file *); 776 int (*file_release) (struct inode *, struct file *);
776 int (*lock)(struct file *, int, struct file_lock *); 777 int (*lock)(struct file *, int, struct file_lock *);
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 6bad4766d3d9..d2a8abb5011a 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -67,7 +67,8 @@ struct svc_expkey {
67 int ek_fsidtype; 67 int ek_fsidtype;
68 u32 ek_fsid[3]; 68 u32 ek_fsid[3];
69 69
70 struct svc_export * ek_export; 70 struct vfsmount * ek_mnt;
71 struct dentry * ek_dentry;
71}; 72};
72 73
73#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) 74#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT))
@@ -85,9 +86,6 @@ void nfsd_export_shutdown(void);
85void nfsd_export_flush(void); 86void nfsd_export_flush(void);
86void exp_readlock(void); 87void exp_readlock(void);
87void exp_readunlock(void); 88void exp_readunlock(void);
88struct svc_expkey * exp_find_key(struct auth_domain *clp,
89 int fsid_type, u32 *fsidv,
90 struct cache_req *reqp);
91struct svc_export * exp_get_by_name(struct auth_domain *clp, 89struct svc_export * exp_get_by_name(struct auth_domain *clp,
92 struct vfsmount *mnt, 90 struct vfsmount *mnt,
93 struct dentry *dentry, 91 struct dentry *dentry,
@@ -101,35 +99,20 @@ int exp_rootfh(struct auth_domain *,
101int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq); 99int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq);
102int nfserrno(int errno); 100int nfserrno(int errno);
103 101
104extern void expkey_put(struct cache_head *item, struct cache_detail *cd); 102extern struct cache_detail svc_export_cache;
105extern void svc_export_put(struct cache_head *item, struct cache_detail *cd);
106extern struct cache_detail svc_export_cache, svc_expkey_cache;
107 103
108static inline void exp_put(struct svc_export *exp) 104static inline void exp_put(struct svc_export *exp)
109{ 105{
110 svc_export_put(&exp->h, &svc_export_cache); 106 cache_put(&exp->h, &svc_export_cache);
111} 107}
112 108
113static inline void exp_get(struct svc_export *exp) 109static inline void exp_get(struct svc_export *exp)
114{ 110{
115 cache_get(&exp->h); 111 cache_get(&exp->h);
116} 112}
117static inline struct svc_export * 113extern struct svc_export *
118exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv, 114exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv,
119 struct cache_req *reqp) 115 struct cache_req *reqp);
120{
121 struct svc_expkey *ek = exp_find_key(clp, fsid_type, fsidv, reqp);
122 if (ek && !IS_ERR(ek)) {
123 struct svc_export *exp = ek->ek_export;
124 int err;
125 exp_get(exp);
126 expkey_put(&ek->h, &svc_expkey_cache);
127 if ((err = cache_check(&svc_export_cache, &exp->h, reqp)))
128 exp = ERR_PTR(err);
129 return exp;
130 } else
131 return ERR_PTR(PTR_ERR(ek));
132}
133 116
134#endif /* __KERNEL__ */ 117#endif /* __KERNEL__ */
135 118
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index b959a4525cbd..1a9ef3e627d1 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -350,11 +350,15 @@ extern nodemask_t node_possible_map;
350#define num_possible_nodes() nodes_weight(node_possible_map) 350#define num_possible_nodes() nodes_weight(node_possible_map)
351#define node_online(node) node_isset((node), node_online_map) 351#define node_online(node) node_isset((node), node_online_map)
352#define node_possible(node) node_isset((node), node_possible_map) 352#define node_possible(node) node_isset((node), node_possible_map)
353#define first_online_node first_node(node_online_map)
354#define next_online_node(nid) next_node((nid), node_online_map)
353#else 355#else
354#define num_online_nodes() 1 356#define num_online_nodes() 1
355#define num_possible_nodes() 1 357#define num_possible_nodes() 1
356#define node_online(node) ((node) == 0) 358#define node_online(node) ((node) == 0)
357#define node_possible(node) ((node) == 0) 359#define node_possible(node) ((node) == 0)
360#define first_online_node 0
361#define next_online_node(nid) (MAX_NUMNODES)
358#endif 362#endif
359 363
360#define any_online_node(mask) \ 364#define any_online_node(mask) \
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 5937dd6053c3..51dbab9710c7 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -10,25 +10,107 @@
10#ifndef _LINUX_NOTIFIER_H 10#ifndef _LINUX_NOTIFIER_H
11#define _LINUX_NOTIFIER_H 11#define _LINUX_NOTIFIER_H
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/mutex.h>
14#include <linux/rwsem.h>
13 15
14struct notifier_block 16/*
15{ 17 * Notifier chains are of three types:
16 int (*notifier_call)(struct notifier_block *self, unsigned long, void *); 18 *
19 * Atomic notifier chains: Chain callbacks run in interrupt/atomic
20 * context. Callouts are not allowed to block.
21 * Blocking notifier chains: Chain callbacks run in process context.
22 * Callouts are allowed to block.
23 * Raw notifier chains: There are no restrictions on callbacks,
24 * registration, or unregistration. All locking and protection
25 * must be provided by the caller.
26 *
27 * atomic_notifier_chain_register() may be called from an atomic context,
28 * but blocking_notifier_chain_register() must be called from a process
29 * context. Ditto for the corresponding _unregister() routines.
30 *
31 * atomic_notifier_chain_unregister() and blocking_notifier_chain_unregister()
32 * _must not_ be called from within the call chain.
33 */
34
35struct notifier_block {
36 int (*notifier_call)(struct notifier_block *, unsigned long, void *);
17 struct notifier_block *next; 37 struct notifier_block *next;
18 int priority; 38 int priority;
19}; 39};
20 40
41struct atomic_notifier_head {
42 spinlock_t lock;
43 struct notifier_block *head;
44};
45
46struct blocking_notifier_head {
47 struct rw_semaphore rwsem;
48 struct notifier_block *head;
49};
50
51struct raw_notifier_head {
52 struct notifier_block *head;
53};
54
55#define ATOMIC_INIT_NOTIFIER_HEAD(name) do { \
56 spin_lock_init(&(name)->lock); \
57 (name)->head = NULL; \
58 } while (0)
59#define BLOCKING_INIT_NOTIFIER_HEAD(name) do { \
60 init_rwsem(&(name)->rwsem); \
61 (name)->head = NULL; \
62 } while (0)
63#define RAW_INIT_NOTIFIER_HEAD(name) do { \
64 (name)->head = NULL; \
65 } while (0)
66
67#define ATOMIC_NOTIFIER_INIT(name) { \
68 .lock = SPIN_LOCK_UNLOCKED, \
69 .head = NULL }
70#define BLOCKING_NOTIFIER_INIT(name) { \
71 .rwsem = __RWSEM_INITIALIZER((name).rwsem), \
72 .head = NULL }
73#define RAW_NOTIFIER_INIT(name) { \
74 .head = NULL }
75
76#define ATOMIC_NOTIFIER_HEAD(name) \
77 struct atomic_notifier_head name = \
78 ATOMIC_NOTIFIER_INIT(name)
79#define BLOCKING_NOTIFIER_HEAD(name) \
80 struct blocking_notifier_head name = \
81 BLOCKING_NOTIFIER_INIT(name)
82#define RAW_NOTIFIER_HEAD(name) \
83 struct raw_notifier_head name = \
84 RAW_NOTIFIER_INIT(name)
21 85
22#ifdef __KERNEL__ 86#ifdef __KERNEL__
23 87
24extern int notifier_chain_register(struct notifier_block **list, struct notifier_block *n); 88extern int atomic_notifier_chain_register(struct atomic_notifier_head *,
25extern int notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n); 89 struct notifier_block *);
26extern int notifier_call_chain(struct notifier_block **n, unsigned long val, void *v); 90extern int blocking_notifier_chain_register(struct blocking_notifier_head *,
91 struct notifier_block *);
92extern int raw_notifier_chain_register(struct raw_notifier_head *,
93 struct notifier_block *);
94
95extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *,
96 struct notifier_block *);
97extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *,
98 struct notifier_block *);
99extern int raw_notifier_chain_unregister(struct raw_notifier_head *,
100 struct notifier_block *);
101
102extern int atomic_notifier_call_chain(struct atomic_notifier_head *,
103 unsigned long val, void *v);
104extern int blocking_notifier_call_chain(struct blocking_notifier_head *,
105 unsigned long val, void *v);
106extern int raw_notifier_call_chain(struct raw_notifier_head *,
107 unsigned long val, void *v);
27 108
28#define NOTIFY_DONE 0x0000 /* Don't care */ 109#define NOTIFY_DONE 0x0000 /* Don't care */
29#define NOTIFY_OK 0x0001 /* Suits me */ 110#define NOTIFY_OK 0x0001 /* Suits me */
30#define NOTIFY_STOP_MASK 0x8000 /* Don't call further */ 111#define NOTIFY_STOP_MASK 0x8000 /* Don't call further */
31#define NOTIFY_BAD (NOTIFY_STOP_MASK|0x0002) /* Bad/Veto action */ 112#define NOTIFY_BAD (NOTIFY_STOP_MASK|0x0002)
113 /* Bad/Veto action */
32/* 114/*
33 * Clean way to return from the notifier and stop further calls. 115 * Clean way to return from the notifier and stop further calls.
34 */ 116 */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 559c4c38a9c7..0d514b252454 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -61,6 +61,16 @@ void oprofile_arch_exit(void);
61 */ 61 */
62void oprofile_add_sample(struct pt_regs * const regs, unsigned long event); 62void oprofile_add_sample(struct pt_regs * const regs, unsigned long event);
63 63
64/**
65 * Add an extended sample. Use this when the PC is not from the regs, and
66 * we cannot determine if we're in kernel mode from the regs.
67 *
68 * This function does perform a backtrace.
69 *
70 */
71void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
72 unsigned long event, int is_kernel);
73
64/* Use this instead when the PC value is not from the regs. Doesn't 74/* Use this instead when the PC value is not from the regs. Doesn't
65 * backtrace. */ 75 * backtrace. */
66void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event); 76void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event);
@@ -74,10 +84,10 @@ void oprofile_add_trace(unsigned long eip);
74 * the specified file operations. 84 * the specified file operations.
75 */ 85 */
76int oprofilefs_create_file(struct super_block * sb, struct dentry * root, 86int oprofilefs_create_file(struct super_block * sb, struct dentry * root,
77 char const * name, struct file_operations * fops); 87 char const * name, const struct file_operations * fops);
78 88
79int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root, 89int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root,
80 char const * name, struct file_operations * fops, int perm); 90 char const * name, const struct file_operations * fops, int perm);
81 91
82/** Create a file for read/write access to an unsigned long. */ 92/** Create a file for read/write access to an unsigned long. */
83int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root, 93int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root,
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index d52999c43336..9ea629c02a4b 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -86,8 +86,9 @@
86 * - The __xxx_page_state variants can be used safely when interrupts are 86 * - The __xxx_page_state variants can be used safely when interrupts are
87 * disabled. 87 * disabled.
88 * - The __xxx_page_state variants can be used if the field is only 88 * - The __xxx_page_state variants can be used if the field is only
89 * modified from process context, or only modified from interrupt context. 89 * modified from process context and protected from preemption, or only
90 * In this case, the field should be commented here. 90 * modified from interrupt context. In this case, the field should be
91 * commented here.
91 */ 92 */
92struct page_state { 93struct page_state {
93 unsigned long nr_dirty; /* Dirty writeable pages */ 94 unsigned long nr_dirty; /* Dirty writeable pages */
@@ -239,22 +240,19 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
239#define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags) 240#define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags)
240#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags) 241#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags)
241 242
242#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags)
243#define PageLRU(page) test_bit(PG_lru, &(page)->flags) 243#define PageLRU(page) test_bit(PG_lru, &(page)->flags)
244#define TestSetPageLRU(page) test_and_set_bit(PG_lru, &(page)->flags) 244#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags)
245#define TestClearPageLRU(page) test_and_clear_bit(PG_lru, &(page)->flags) 245#define ClearPageLRU(page) clear_bit(PG_lru, &(page)->flags)
246#define __ClearPageLRU(page) __clear_bit(PG_lru, &(page)->flags)
246 247
247#define PageActive(page) test_bit(PG_active, &(page)->flags) 248#define PageActive(page) test_bit(PG_active, &(page)->flags)
248#define SetPageActive(page) set_bit(PG_active, &(page)->flags) 249#define SetPageActive(page) set_bit(PG_active, &(page)->flags)
249#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags) 250#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags)
250#define TestClearPageActive(page) test_and_clear_bit(PG_active, &(page)->flags) 251#define __ClearPageActive(page) __clear_bit(PG_active, &(page)->flags)
251#define TestSetPageActive(page) test_and_set_bit(PG_active, &(page)->flags)
252 252
253#define PageSlab(page) test_bit(PG_slab, &(page)->flags) 253#define PageSlab(page) test_bit(PG_slab, &(page)->flags)
254#define SetPageSlab(page) set_bit(PG_slab, &(page)->flags) 254#define __SetPageSlab(page) __set_bit(PG_slab, &(page)->flags)
255#define ClearPageSlab(page) clear_bit(PG_slab, &(page)->flags) 255#define __ClearPageSlab(page) __clear_bit(PG_slab, &(page)->flags)
256#define TestClearPageSlab(page) test_and_clear_bit(PG_slab, &(page)->flags)
257#define TestSetPageSlab(page) test_and_set_bit(PG_slab, &(page)->flags)
258 256
259#ifdef CONFIG_HIGHMEM 257#ifdef CONFIG_HIGHMEM
260#define PageHighMem(page) is_highmem(page_zone(page)) 258#define PageHighMem(page) is_highmem(page_zone(page))
@@ -329,8 +327,8 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
329#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags) 327#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags)
330 328
331#define PageCompound(page) test_bit(PG_compound, &(page)->flags) 329#define PageCompound(page) test_bit(PG_compound, &(page)->flags)
332#define SetPageCompound(page) set_bit(PG_compound, &(page)->flags) 330#define __SetPageCompound(page) __set_bit(PG_compound, &(page)->flags)
333#define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags) 331#define __ClearPageCompound(page) __clear_bit(PG_compound, &(page)->flags)
334 332
335#ifdef CONFIG_SWAP 333#ifdef CONFIG_SWAP
336#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags) 334#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index ee700c6eb442..9539efd4f7e6 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -51,6 +51,10 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
51#define page_cache_release(page) put_page(page) 51#define page_cache_release(page) put_page(page)
52void release_pages(struct page **pages, int nr, int cold); 52void release_pages(struct page **pages, int nr, int cold);
53 53
54#ifdef CONFIG_NUMA
55extern struct page *page_cache_alloc(struct address_space *x);
56extern struct page *page_cache_alloc_cold(struct address_space *x);
57#else
54static inline struct page *page_cache_alloc(struct address_space *x) 58static inline struct page *page_cache_alloc(struct address_space *x)
55{ 59{
56 return alloc_pages(mapping_gfp_mask(x), 0); 60 return alloc_pages(mapping_gfp_mask(x), 0);
@@ -60,6 +64,7 @@ static inline struct page *page_cache_alloc_cold(struct address_space *x)
60{ 64{
61 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0); 65 return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0);
62} 66}
67#endif
63 68
64typedef int filler_t(void *, struct page *); 69typedef int filler_t(void *, struct page *);
65 70
@@ -67,8 +72,8 @@ extern struct page * find_get_page(struct address_space *mapping,
67 unsigned long index); 72 unsigned long index);
68extern struct page * find_lock_page(struct address_space *mapping, 73extern struct page * find_lock_page(struct address_space *mapping,
69 unsigned long index); 74 unsigned long index);
70extern struct page * find_trylock_page(struct address_space *mapping, 75extern __deprecated_for_modules struct page * find_trylock_page(
71 unsigned long index); 76 struct address_space *mapping, unsigned long index);
72extern struct page * find_or_create_page(struct address_space *mapping, 77extern struct page * find_or_create_page(struct address_space *mapping,
73 unsigned long index, gfp_t gfp_mask); 78 unsigned long index, gfp_t gfp_mask);
74unsigned find_get_pages(struct address_space *mapping, pgoff_t start, 79unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fe1a2b02fc55..0aad5a378e95 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -95,6 +95,11 @@ enum pci_channel_state {
95 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3, 95 pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
96}; 96};
97 97
98typedef unsigned short __bitwise pci_bus_flags_t;
99enum pci_bus_flags {
100 PCI_BUS_FLAGS_NO_MSI = (pci_bus_flags_t) 1,
101};
102
98/* 103/*
99 * The pci_dev structure is used to describe PCI devices. 104 * The pci_dev structure is used to describe PCI devices.
100 */ 105 */
@@ -203,7 +208,7 @@ struct pci_bus {
203 char name[48]; 208 char name[48];
204 209
205 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ 210 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */
206 unsigned short pad2; 211 pci_bus_flags_t bus_flags; /* Inherited by child busses */
207 struct device *bridge; 212 struct device *bridge;
208 struct class_device class_dev; 213 struct class_device class_dev;
209 struct bin_attribute *legacy_io; /* legacy I/O for this bus */ 214 struct bin_attribute *legacy_io; /* legacy I/O for this bus */
@@ -485,9 +490,9 @@ void pdev_sort_resources(struct pci_dev *, struct resource_list *);
485void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 490void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
486 int (*)(struct pci_dev *, u8, u8)); 491 int (*)(struct pci_dev *, u8, u8));
487#define HAVE_PCI_REQ_REGIONS 2 492#define HAVE_PCI_REQ_REGIONS 2
488int pci_request_regions(struct pci_dev *, char *); 493int pci_request_regions(struct pci_dev *, const char *);
489void pci_release_regions(struct pci_dev *); 494void pci_release_regions(struct pci_dev *);
490int pci_request_region(struct pci_dev *, int, char *); 495int pci_request_region(struct pci_dev *, int, const char *);
491void pci_release_region(struct pci_dev *, int); 496void pci_release_region(struct pci_dev *, int);
492 497
493/* drivers/pci/bus.c */ 498/* drivers/pci/bus.c */
@@ -516,6 +521,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
516void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 521void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
517 void *userdata); 522 void *userdata);
518int pci_cfg_space_size(struct pci_dev *dev); 523int pci_cfg_space_size(struct pci_dev *dev);
524unsigned char pci_bus_max_busnr(struct pci_bus* bus);
519 525
520/* kmem_cache style wrapper around pci_alloc_consistent() */ 526/* kmem_cache style wrapper around pci_alloc_consistent() */
521 527
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 1709b5009d2e..870fe38378b1 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -69,6 +69,7 @@
69#define PCI_CLASS_SYSTEM_TIMER 0x0802 69#define PCI_CLASS_SYSTEM_TIMER 0x0802
70#define PCI_CLASS_SYSTEM_RTC 0x0803 70#define PCI_CLASS_SYSTEM_RTC 0x0803
71#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 71#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804
72#define PCI_CLASS_SYSTEM_SDHCI 0x0805
72#define PCI_CLASS_SYSTEM_OTHER 0x0880 73#define PCI_CLASS_SYSTEM_OTHER 0x0880
73 74
74#define PCI_BASE_CLASS_INPUT 0x09 75#define PCI_BASE_CLASS_INPUT 0x09
@@ -641,6 +642,7 @@
641#define PCI_DEVICE_ID_SI_965 0x0965 642#define PCI_DEVICE_ID_SI_965 0x0965
642#define PCI_DEVICE_ID_SI_5511 0x5511 643#define PCI_DEVICE_ID_SI_5511 0x5511
643#define PCI_DEVICE_ID_SI_5513 0x5513 644#define PCI_DEVICE_ID_SI_5513 0x5513
645#define PCI_DEVICE_ID_SI_5517 0x5517
644#define PCI_DEVICE_ID_SI_5518 0x5518 646#define PCI_DEVICE_ID_SI_5518 0x5518
645#define PCI_DEVICE_ID_SI_5571 0x5571 647#define PCI_DEVICE_ID_SI_5571 0x5571
646#define PCI_DEVICE_ID_SI_5581 0x5581 648#define PCI_DEVICE_ID_SI_5581 0x5581
@@ -771,6 +773,7 @@
771#define PCI_DEVICE_ID_MOTOROLA_HAWK 0x4803 773#define PCI_DEVICE_ID_MOTOROLA_HAWK 0x4803
772#define PCI_DEVICE_ID_MOTOROLA_HARRIER 0x480b 774#define PCI_DEVICE_ID_MOTOROLA_HARRIER 0x480b
773#define PCI_DEVICE_ID_MOTOROLA_MPC5200 0x5803 775#define PCI_DEVICE_ID_MOTOROLA_MPC5200 0x5803
776#define PCI_DEVICE_ID_MOTOROLA_MPC5200B 0x5809
774 777
775#define PCI_VENDOR_ID_PROMISE 0x105a 778#define PCI_VENDOR_ID_PROMISE 0x105a
776#define PCI_DEVICE_ID_PROMISE_20265 0x0d30 779#define PCI_DEVICE_ID_PROMISE_20265 0x0d30
@@ -852,6 +855,8 @@
852#define PCI_DEVICE_ID_QLOGIC_ISP2432 0x2432 855#define PCI_DEVICE_ID_QLOGIC_ISP2432 0x2432
853#define PCI_DEVICE_ID_QLOGIC_ISP2512 0x2512 856#define PCI_DEVICE_ID_QLOGIC_ISP2512 0x2512
854#define PCI_DEVICE_ID_QLOGIC_ISP2522 0x2522 857#define PCI_DEVICE_ID_QLOGIC_ISP2522 0x2522
858#define PCI_DEVICE_ID_QLOGIC_ISP5422 0x5422
859#define PCI_DEVICE_ID_QLOGIC_ISP5432 0x5432
855 860
856#define PCI_VENDOR_ID_CYRIX 0x1078 861#define PCI_VENDOR_ID_CYRIX 0x1078
857#define PCI_DEVICE_ID_CYRIX_5510 0x0000 862#define PCI_DEVICE_ID_CYRIX_5510 0x0000
@@ -1049,6 +1054,7 @@
1049#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2 1054#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2
1050#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3 1055#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3
1051#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9 1056#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9
1057#define PCIE_DEVICE_ID_NVIDIA_QUADRO_NVS280 0x00fd
1052#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 1058#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100
1053#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 1059#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101
1054#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 1060#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103
@@ -1365,9 +1371,11 @@
1365#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008 1371#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008
1366#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 1372#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
1367#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 1373#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
1374#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103
1368#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 1375#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
1369#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 1376#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
1370#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 1377#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203
1378#define PCI_DEVICE_ID_SERVERWORKS_HT1000SB 0x0205
1371#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 1379#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211
1372#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212 1380#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212
1373#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213 1381#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213
@@ -1856,16 +1864,24 @@
1856#define PCI_DEVICE_ID_TIGON3_5705M 0x165d 1864#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
1857#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 1865#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
1858#define PCI_DEVICE_ID_TIGON3_5714 0x1668 1866#define PCI_DEVICE_ID_TIGON3_5714 0x1668
1867#define PCI_DEVICE_ID_TIGON3_5714S 0x1669
1859#define PCI_DEVICE_ID_TIGON3_5780 0x166a 1868#define PCI_DEVICE_ID_TIGON3_5780 0x166a
1860#define PCI_DEVICE_ID_TIGON3_5780S 0x166b 1869#define PCI_DEVICE_ID_TIGON3_5780S 0x166b
1861#define PCI_DEVICE_ID_TIGON3_5705F 0x166e 1870#define PCI_DEVICE_ID_TIGON3_5705F 0x166e
1871#define PCI_DEVICE_ID_TIGON3_5754M 0x1672
1872#define PCI_DEVICE_ID_TIGON3_5755M 0x1673
1862#define PCI_DEVICE_ID_TIGON3_5750 0x1676 1873#define PCI_DEVICE_ID_TIGON3_5750 0x1676
1863#define PCI_DEVICE_ID_TIGON3_5751 0x1677 1874#define PCI_DEVICE_ID_TIGON3_5751 0x1677
1864#define PCI_DEVICE_ID_TIGON3_5715 0x1678 1875#define PCI_DEVICE_ID_TIGON3_5715 0x1678
1876#define PCI_DEVICE_ID_TIGON3_5715S 0x1679
1877#define PCI_DEVICE_ID_TIGON3_5754 0x167a
1878#define PCI_DEVICE_ID_TIGON3_5755 0x167b
1865#define PCI_DEVICE_ID_TIGON3_5750M 0x167c 1879#define PCI_DEVICE_ID_TIGON3_5750M 0x167c
1866#define PCI_DEVICE_ID_TIGON3_5751M 0x167d 1880#define PCI_DEVICE_ID_TIGON3_5751M 0x167d
1867#define PCI_DEVICE_ID_TIGON3_5751F 0x167e 1881#define PCI_DEVICE_ID_TIGON3_5751F 0x167e
1882#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
1868#define PCI_DEVICE_ID_TIGON3_5782 0x1696 1883#define PCI_DEVICE_ID_TIGON3_5782 0x1696
1884#define PCI_DEVICE_ID_TIGON3_5787 0x169b
1869#define PCI_DEVICE_ID_TIGON3_5788 0x169c 1885#define PCI_DEVICE_ID_TIGON3_5788 0x169c
1870#define PCI_DEVICE_ID_TIGON3_5789 0x169d 1886#define PCI_DEVICE_ID_TIGON3_5789 0x169d
1871#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 1887#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6
diff --git a/include/linux/pfn.h b/include/linux/pfn.h
new file mode 100644
index 000000000000..bb01f8b92b56
--- /dev/null
+++ b/include/linux/pfn.h
@@ -0,0 +1,9 @@
1#ifndef _LINUX_PFN_H_
2#define _LINUX_PFN_H_
3
4#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
5#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
6#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
7#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
8
9#endif
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 5b2fcb19d2da..29960b03bef7 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -1,55 +1,119 @@
1#ifndef _LINUX_PID_H 1#ifndef _LINUX_PID_H
2#define _LINUX_PID_H 2#define _LINUX_PID_H
3 3
4#include <linux/rcupdate.h>
5
4enum pid_type 6enum pid_type
5{ 7{
6 PIDTYPE_PID, 8 PIDTYPE_PID,
7 PIDTYPE_TGID,
8 PIDTYPE_PGID, 9 PIDTYPE_PGID,
9 PIDTYPE_SID, 10 PIDTYPE_SID,
10 PIDTYPE_MAX 11 PIDTYPE_MAX
11}; 12};
12 13
14/*
15 * What is struct pid?
16 *
17 * A struct pid is the kernel's internal notion of a process identifier.
18 * It refers to individual tasks, process groups, and sessions. While
19 * there are processes attached to it the struct pid lives in a hash
20 * table, so it and then the processes that it refers to can be found
21 * quickly from the numeric pid value. The attached processes may be
22 * quickly accessed by following pointers from struct pid.
23 *
24 * Storing pid_t values in the kernel and refering to them later has a
25 * problem. The process originally with that pid may have exited and the
26 * pid allocator wrapped, and another process could have come along
27 * and been assigned that pid.
28 *
29 * Referring to user space processes by holding a reference to struct
30 * task_struct has a problem. When the user space process exits
31 * the now useless task_struct is still kept. A task_struct plus a
32 * stack consumes around 10K of low kernel memory. More precisely
33 * this is THREAD_SIZE + sizeof(struct task_struct). By comparison
34 * a struct pid is about 64 bytes.
35 *
36 * Holding a reference to struct pid solves both of these problems.
37 * It is small so holding a reference does not consume a lot of
38 * resources, and since a new struct pid is allocated when the numeric
39 * pid value is reused we don't mistakenly refer to new processes.
40 */
41
13struct pid 42struct pid
14{ 43{
44 atomic_t count;
15 /* Try to keep pid_chain in the same cacheline as nr for find_pid */ 45 /* Try to keep pid_chain in the same cacheline as nr for find_pid */
16 int nr; 46 int nr;
17 struct hlist_node pid_chain; 47 struct hlist_node pid_chain;
18 /* list of pids with the same nr, only one of them is in the hash */ 48 /* lists of tasks that use this pid */
19 struct list_head pid_list; 49 struct hlist_head tasks[PIDTYPE_MAX];
50 struct rcu_head rcu;
20}; 51};
21 52
22#define pid_task(elem, type) \ 53struct pid_link
23 list_entry(elem, struct task_struct, pids[type].pid_list) 54{
55 struct hlist_node node;
56 struct pid *pid;
57};
58
59static inline struct pid *get_pid(struct pid *pid)
60{
61 if (pid)
62 atomic_inc(&pid->count);
63 return pid;
64}
65
66extern void FASTCALL(put_pid(struct pid *pid));
67extern struct task_struct *FASTCALL(pid_task(struct pid *pid, enum pid_type));
68extern struct task_struct *FASTCALL(get_pid_task(struct pid *pid,
69 enum pid_type));
24 70
25/* 71/*
26 * attach_pid() and detach_pid() must be called with the tasklist_lock 72 * attach_pid() and detach_pid() must be called with the tasklist_lock
27 * write-held. 73 * write-held.
28 */ 74 */
29extern int FASTCALL(attach_pid(struct task_struct *task, enum pid_type type, int nr)); 75extern int FASTCALL(attach_pid(struct task_struct *task,
76 enum pid_type type, int nr));
30 77
31extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type)); 78extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type));
32 79
33/* 80/*
34 * look up a PID in the hash table. Must be called with the tasklist_lock 81 * look up a PID in the hash table. Must be called with the tasklist_lock
35 * held. 82 * or rcu_read_lock() held.
83 */
84extern struct pid *FASTCALL(find_pid(int nr));
85
86/*
87 * Lookup a PID in the hash table, and return with it's count elevated.
36 */ 88 */
37extern struct pid *FASTCALL(find_pid(enum pid_type, int)); 89extern struct pid *find_get_pid(int nr);
38 90
39extern int alloc_pidmap(void); 91extern struct pid *alloc_pid(void);
40extern void FASTCALL(free_pidmap(int)); 92extern void FASTCALL(free_pid(struct pid *pid));
41extern void switch_exec_pids(struct task_struct *leader, struct task_struct *thread);
42 93
94#define pid_next(task, type) \
95 ((task)->pids[(type)].node.next)
96
97#define pid_next_task(task, type) \
98 hlist_entry(pid_next(task, type), struct task_struct, \
99 pids[(type)].node)
100
101
102/* We could use hlist_for_each_entry_rcu here but it takes more arguments
103 * than the do_each_task_pid/while_each_task_pid. So we roll our own
104 * to preserve the existing interface.
105 */
43#define do_each_task_pid(who, type, task) \ 106#define do_each_task_pid(who, type, task) \
44 if ((task = find_task_by_pid_type(type, who))) { \ 107 if ((task = find_task_by_pid_type(type, who))) { \
45 prefetch((task)->pids[type].pid_list.next); \ 108 prefetch(pid_next(task, type)); \
46 do { 109 do {
47 110
48#define while_each_task_pid(who, type, task) \ 111#define while_each_task_pid(who, type, task) \
49 } while (task = pid_task((task)->pids[type].pid_list.next,\ 112 } while (pid_next(task, type) && ({ \
50 type), \ 113 task = pid_next_task(task, type); \
51 prefetch((task)->pids[type].pid_list.next), \ 114 rcu_dereference(task); \
52 hlist_unhashed(&(task)->pids[type].pid_chain)); \ 115 prefetch(pid_next(task, type)); \
53 } \ 116 1; }) ); \
117 }
54 118
55#endif /* _LINUX_PID_H */ 119#endif /* _LINUX_PID_H */
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index b12e59c75752..75c7f55023ab 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -9,6 +9,7 @@ struct pipe_buffer {
9 struct page *page; 9 struct page *page;
10 unsigned int offset, len; 10 unsigned int offset, len;
11 struct pipe_buf_operations *ops; 11 struct pipe_buf_operations *ops;
12 unsigned int stolen;
12}; 13};
13 14
14struct pipe_buf_operations { 15struct pipe_buf_operations {
@@ -16,6 +17,7 @@ struct pipe_buf_operations {
16 void * (*map)(struct file *, struct pipe_inode_info *, struct pipe_buffer *); 17 void * (*map)(struct file *, struct pipe_inode_info *, struct pipe_buffer *);
17 void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *); 18 void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *);
18 void (*release)(struct pipe_inode_info *, struct pipe_buffer *); 19 void (*release)(struct pipe_inode_info *, struct pipe_buffer *);
20 int (*steal)(struct pipe_inode_info *, struct pipe_buffer *);
19}; 21};
20 22
21struct pipe_inode_info { 23struct pipe_inode_info {
@@ -53,4 +55,10 @@ void pipe_wait(struct inode * inode);
53struct inode* pipe_new(struct inode* inode); 55struct inode* pipe_new(struct inode* inode);
54void free_pipe_info(struct inode* inode); 56void free_pipe_info(struct inode* inode);
55 57
58/*
59 * splice is tied to pipes as a transport (at least for now), so we'll just
60 * add the splice flags here.
61 */
62#define SPLICE_F_MOVE (0x01) /* move pages instead of copying */
63
56#endif 64#endif
diff --git a/include/linux/platform.h b/include/linux/platform.h
deleted file mode 100644
index 3c33084a6ec2..000000000000
--- a/include/linux/platform.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * include/linux/platform.h - platform driver definitions
3 *
4 * Because of the prolific consumerism of the average American,
5 * and the dominant marketing budgets of PC OEMs, we have been
6 * blessed with frequent updates of the PC architecture.
7 *
8 * While most of these calls are singular per architecture, they
9 * require an extra layer of abstraction on the x86 so the right
10 * subsystem gets the right call.
11 *
12 * Basically, this consolidates the power off and reboot callbacks
13 * into one structure, as well as adding power management hooks.
14 *
15 * When adding a platform driver, please make sure all callbacks are
16 * filled. There are defaults defined below that do nothing; use those
17 * if you do not support that callback.
18 */
19
20#ifndef _PLATFORM_H_
21#define _PLATFORM_H_
22#ifdef __KERNEL__
23
24#include <linux/types.h>
25
26struct platform_t {
27 char * name;
28 u32 suspend_states;
29 void (*reboot)(char * cmd);
30 void (*halt)(void);
31 void (*power_off)(void);
32 int (*suspend)(int state, int flags);
33 void (*idle)(void);
34};
35
36extern struct platform_t * platform;
37extern void default_reboot(char * cmd);
38extern void default_halt(void);
39extern int default_suspend(int state, int flags);
40extern void default_idle(void);
41
42#endif /* __KERNEL__ */
43#endif /* _PLATFORM_H */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 5be87ba3b7ac..6df2585c0169 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -188,6 +188,8 @@ extern void device_power_up(void);
188extern void device_resume(void); 188extern void device_resume(void);
189 189
190#ifdef CONFIG_PM 190#ifdef CONFIG_PM
191extern suspend_disk_method_t pm_disk_mode;
192
191extern int device_suspend(pm_message_t state); 193extern int device_suspend(pm_message_t state);
192 194
193#define device_set_wakeup_enable(dev,val) \ 195#define device_set_wakeup_enable(dev,val) \
@@ -215,7 +217,6 @@ static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
215 217
216static inline void dpm_runtime_resume(struct device * dev) 218static inline void dpm_runtime_resume(struct device * dev)
217{ 219{
218
219} 220}
220 221
221#endif 222#endif
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 8e8f6098508a..51e1b56741fb 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -11,6 +11,15 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13 13
14/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
15 additional memory. */
16#define MAX_STACK_ALLOC 832
17#define FRONTEND_STACK_ALLOC 256
18#define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC
19#define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC
20#define WQUEUES_STACK_ALLOC (MAX_STACK_ALLOC - FRONTEND_STACK_ALLOC)
21#define N_INLINE_POLL_ENTRIES (WQUEUES_STACK_ALLOC / sizeof(struct poll_table_entry))
22
14struct poll_table_struct; 23struct poll_table_struct;
15 24
16/* 25/*
@@ -33,6 +42,12 @@ static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
33 pt->qproc = qproc; 42 pt->qproc = qproc;
34} 43}
35 44
45struct poll_table_entry {
46 struct file * filp;
47 wait_queue_t wait;
48 wait_queue_head_t * wait_address;
49};
50
36/* 51/*
37 * Structures and helpers for sys_poll/sys_poll 52 * Structures and helpers for sys_poll/sys_poll
38 */ 53 */
@@ -40,6 +55,8 @@ struct poll_wqueues {
40 poll_table pt; 55 poll_table pt;
41 struct poll_table_page * table; 56 struct poll_table_page * table;
42 int error; 57 int error;
58 int inline_index;
59 struct poll_table_entry inline_entries[N_INLINE_POLL_ENTRIES];
43}; 60};
44 61
45extern void poll_initwait(struct poll_wqueues *pwq); 62extern void poll_initwait(struct poll_wqueues *pwq);
diff --git a/include/linux/ppdev.h b/include/linux/ppdev.h
index 141c96586824..f376a7598a78 100644
--- a/include/linux/ppdev.h
+++ b/include/linux/ppdev.h
@@ -14,8 +14,6 @@
14 * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001 14 * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001
15 */ 15 */
16 16
17#define PP_MAJOR 99
18
19#define PP_IOCTL 'p' 17#define PP_IOCTL 'p'
20 18
21/* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ 19/* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index aa6322d45198..135871df9911 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -4,6 +4,7 @@
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/slab.h> 5#include <linux/slab.h>
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <linux/spinlock.h>
7#include <asm/atomic.h> 8#include <asm/atomic.h>
8 9
9/* 10/*
@@ -55,9 +56,9 @@ struct proc_dir_entry {
55 nlink_t nlink; 56 nlink_t nlink;
56 uid_t uid; 57 uid_t uid;
57 gid_t gid; 58 gid_t gid;
58 unsigned long size; 59 loff_t size;
59 struct inode_operations * proc_iops; 60 struct inode_operations * proc_iops;
60 struct file_operations * proc_fops; 61 const struct file_operations * proc_fops;
61 get_info_t *get_info; 62 get_info_t *get_info;
62 struct module *owner; 63 struct module *owner;
63 struct proc_dir_entry *next, *parent, *subdir; 64 struct proc_dir_entry *next, *parent, *subdir;
@@ -92,6 +93,8 @@ extern struct proc_dir_entry *proc_bus;
92extern struct proc_dir_entry *proc_root_driver; 93extern struct proc_dir_entry *proc_root_driver;
93extern struct proc_dir_entry *proc_root_kcore; 94extern struct proc_dir_entry *proc_root_kcore;
94 95
96extern spinlock_t proc_subdir_lock;
97
95extern void proc_root_init(void); 98extern void proc_root_init(void);
96extern void proc_misc_init(void); 99extern void proc_misc_init(void);
97 100
@@ -125,9 +128,9 @@ extern int proc_match(int, const char *,struct proc_dir_entry *);
125extern int proc_readdir(struct file *, void *, filldir_t); 128extern int proc_readdir(struct file *, void *, filldir_t);
126extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); 129extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
127 130
128extern struct file_operations proc_kcore_operations; 131extern const struct file_operations proc_kcore_operations;
129extern struct file_operations proc_kmsg_operations; 132extern const struct file_operations proc_kmsg_operations;
130extern struct file_operations ppc_htab_operations; 133extern const struct file_operations ppc_htab_operations;
131 134
132/* 135/*
133 * proc_tty.c 136 * proc_tty.c
@@ -186,7 +189,7 @@ static inline struct proc_dir_entry *proc_net_create(const char *name,
186} 189}
187 190
188static inline struct proc_dir_entry *proc_net_fops_create(const char *name, 191static inline struct proc_dir_entry *proc_net_fops_create(const char *name,
189 mode_t mode, struct file_operations *fops) 192 mode_t mode, const struct file_operations *fops)
190{ 193{
191 struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net); 194 struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net);
192 if (res) 195 if (res)
diff --git a/include/linux/profile.h b/include/linux/profile.h
index 026969a5595c..1f2fea6640a4 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -14,6 +14,7 @@
14 14
15struct proc_dir_entry; 15struct proc_dir_entry;
16struct pt_regs; 16struct pt_regs;
17struct notifier_block;
17 18
18/* init basic kernel profiler */ 19/* init basic kernel profiler */
19void __init profile_init(void); 20void __init profile_init(void);
@@ -32,7 +33,6 @@ enum profile_type {
32 33
33#ifdef CONFIG_PROFILING 34#ifdef CONFIG_PROFILING
34 35
35struct notifier_block;
36struct task_struct; 36struct task_struct;
37struct mm_struct; 37struct mm_struct;
38 38
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index fc610bb0f733..27f49c85d5d6 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -118,8 +118,8 @@ extern struct buffer_head *qnx4_bread(struct inode *, int, int);
118 118
119extern struct inode_operations qnx4_file_inode_operations; 119extern struct inode_operations qnx4_file_inode_operations;
120extern struct inode_operations qnx4_dir_inode_operations; 120extern struct inode_operations qnx4_dir_inode_operations;
121extern struct file_operations qnx4_file_operations; 121extern const struct file_operations qnx4_file_operations;
122extern struct file_operations qnx4_dir_operations; 122extern const struct file_operations qnx4_dir_operations;
123extern int qnx4_is_free(struct super_block *sb, long block); 123extern int qnx4_is_free(struct super_block *sb, long block);
124extern int qnx4_set_bitmap(struct super_block *sb, long block, int busy); 124extern int qnx4_set_bitmap(struct super_block *sb, long block, int busy);
125extern int qnx4_create(struct inode *inode, struct dentry *dentry, int mode, struct nameidata *nd); 125extern int qnx4_create(struct inode *inode, struct dentry *dentry, int mode, struct nameidata *nd);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index f33aeb22c26a..2dab71e1c3d1 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -38,6 +38,7 @@
38#include <linux/errno.h> 38#include <linux/errno.h>
39#include <linux/types.h> 39#include <linux/types.h>
40#include <linux/spinlock.h> 40#include <linux/spinlock.h>
41#include <linux/mutex.h>
41 42
42#define __DQUOT_VERSION__ "dquot_6.5.1" 43#define __DQUOT_VERSION__ "dquot_6.5.1"
43#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1 44#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
@@ -208,14 +209,13 @@ extern struct dqstats dqstats;
208#define DQ_FAKE_B 3 /* no limits only usage */ 209#define DQ_FAKE_B 3 /* no limits only usage */
209#define DQ_READ_B 4 /* dquot was read into memory */ 210#define DQ_READ_B 4 /* dquot was read into memory */
210#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ 211#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */
211#define DQ_WAITFREE_B 6 /* dquot being waited (by invalidate_dquots) */
212 212
213struct dquot { 213struct dquot {
214 struct hlist_node dq_hash; /* Hash list in memory */ 214 struct hlist_node dq_hash; /* Hash list in memory */
215 struct list_head dq_inuse; /* List of all quotas */ 215 struct list_head dq_inuse; /* List of all quotas */
216 struct list_head dq_free; /* Free list element */ 216 struct list_head dq_free; /* Free list element */
217 struct list_head dq_dirty; /* List of dirty dquots */ 217 struct list_head dq_dirty; /* List of dirty dquots */
218 struct semaphore dq_lock; /* dquot IO lock */ 218 struct mutex dq_lock; /* dquot IO lock */
219 atomic_t dq_count; /* Use count */ 219 atomic_t dq_count; /* Use count */
220 wait_queue_head_t dq_wait_unused; /* Wait queue for dquot to become unused */ 220 wait_queue_head_t dq_wait_unused; /* Wait queue for dquot to become unused */
221 struct super_block *dq_sb; /* superblock this applies to */ 221 struct super_block *dq_sb; /* superblock this applies to */
@@ -285,8 +285,8 @@ struct quota_format_type {
285 285
286struct quota_info { 286struct quota_info {
287 unsigned int flags; /* Flags for diskquotas on this device */ 287 unsigned int flags; /* Flags for diskquotas on this device */
288 struct semaphore dqio_sem; /* lock device while I/O in progress */ 288 struct mutex dqio_mutex; /* lock device while I/O in progress */
289 struct semaphore dqonoff_sem; /* Serialize quotaon & quotaoff */ 289 struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */
290 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */ 290 struct rw_semaphore dqptr_sem; /* serialize ops using quota_info struct, pointers from inode to dquots */
291 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */ 291 struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
292 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */ 292 struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index c57ff2fcb30a..dd83cca28001 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -45,6 +45,8 @@ do { \
45 (root)->rnode = NULL; \ 45 (root)->rnode = NULL; \
46} while (0) 46} while (0)
47 47
48#define RADIX_TREE_MAX_TAGS 2
49
48int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); 50int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
49void *radix_tree_lookup(struct radix_tree_root *, unsigned long); 51void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
50void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); 52void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long);
@@ -55,15 +57,16 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
55int radix_tree_preload(gfp_t gfp_mask); 57int radix_tree_preload(gfp_t gfp_mask);
56void radix_tree_init(void); 58void radix_tree_init(void);
57void *radix_tree_tag_set(struct radix_tree_root *root, 59void *radix_tree_tag_set(struct radix_tree_root *root,
58 unsigned long index, int tag); 60 unsigned long index, unsigned int tag);
59void *radix_tree_tag_clear(struct radix_tree_root *root, 61void *radix_tree_tag_clear(struct radix_tree_root *root,
60 unsigned long index, int tag); 62 unsigned long index, unsigned int tag);
61int radix_tree_tag_get(struct radix_tree_root *root, 63int radix_tree_tag_get(struct radix_tree_root *root,
62 unsigned long index, int tag); 64 unsigned long index, unsigned int tag);
63unsigned int 65unsigned int
64radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, 66radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
65 unsigned long first_index, unsigned int max_items, int tag); 67 unsigned long first_index, unsigned int max_items,
66int radix_tree_tagged(struct radix_tree_root *root, int tag); 68 unsigned int tag);
69int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
67 70
68static inline void radix_tree_preload_end(void) 71static inline void radix_tree_preload_end(void)
69{ 72{
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index b6e0bcad84e1..66b44e5e0d6e 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -92,7 +92,10 @@ extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
92extern void md_super_wait(mddev_t *mddev); 92extern void md_super_wait(mddev_t *mddev);
93extern int sync_page_io(struct block_device *bdev, sector_t sector, int size, 93extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
94 struct page *page, int rw); 94 struct page *page, int rw);
95extern void md_do_sync(mddev_t *mddev);
96extern void md_new_event(mddev_t *mddev);
95 97
98extern void md_update_sb(mddev_t * mddev);
96 99
97#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } 100#define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); }
98 101
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 617b9506c760..e2df61f5b09a 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -132,6 +132,14 @@ struct mddev_s
132 132
133 char uuid[16]; 133 char uuid[16];
134 134
135 /* If the array is being reshaped, we need to record the
136 * new shape and an indication of where we are up to.
137 * This is written to the superblock.
138 * If reshape_position is MaxSector, then no reshape is happening (yet).
139 */
140 sector_t reshape_position;
141 int delta_disks, new_level, new_layout, new_chunk;
142
135 struct mdk_thread_s *thread; /* management thread */ 143 struct mdk_thread_s *thread; /* management thread */
136 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ 144 struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */
137 sector_t curr_resync; /* blocks scheduled */ 145 sector_t curr_resync; /* blocks scheduled */
@@ -143,6 +151,10 @@ struct mddev_s
143 sector_t resync_mismatches; /* count of sectors where 151 sector_t resync_mismatches; /* count of sectors where
144 * parity/replica mismatch found 152 * parity/replica mismatch found
145 */ 153 */
154
155 /* allow user-space to request suspension of IO to regions of the array */
156 sector_t suspend_lo;
157 sector_t suspend_hi;
146 /* if zero, use the system-wide default */ 158 /* if zero, use the system-wide default */
147 int sync_speed_min; 159 int sync_speed_min;
148 int sync_speed_max; 160 int sync_speed_max;
@@ -157,6 +169,9 @@ struct mddev_s
157 * DONE: thread is done and is waiting to be reaped 169 * DONE: thread is done and is waiting to be reaped
158 * REQUEST: user-space has requested a sync (used with SYNC) 170 * REQUEST: user-space has requested a sync (used with SYNC)
159 * CHECK: user-space request for for check-only, no repair 171 * CHECK: user-space request for for check-only, no repair
172 * RESHAPE: A reshape is happening
173 *
174 * If neither SYNC or RESHAPE are set, then it is a recovery.
160 */ 175 */
161#define MD_RECOVERY_RUNNING 0 176#define MD_RECOVERY_RUNNING 0
162#define MD_RECOVERY_SYNC 1 177#define MD_RECOVERY_SYNC 1
@@ -166,10 +181,11 @@ struct mddev_s
166#define MD_RECOVERY_NEEDED 5 181#define MD_RECOVERY_NEEDED 5
167#define MD_RECOVERY_REQUESTED 6 182#define MD_RECOVERY_REQUESTED 6
168#define MD_RECOVERY_CHECK 7 183#define MD_RECOVERY_CHECK 7
184#define MD_RECOVERY_RESHAPE 8
169 unsigned long recovery; 185 unsigned long recovery;
170 186
171 int in_sync; /* know to not need resync */ 187 int in_sync; /* know to not need resync */
172 struct semaphore reconfig_sem; 188 struct mutex reconfig_mutex;
173 atomic_t active; 189 atomic_t active;
174 190
175 int changed; /* true if we might need to reread partition info */ 191 int changed; /* true if we might need to reread partition info */
@@ -249,7 +265,8 @@ struct mdk_personality
249 int (*spare_active) (mddev_t *mddev); 265 int (*spare_active) (mddev_t *mddev);
250 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster); 266 sector_t (*sync_request)(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster);
251 int (*resize) (mddev_t *mddev, sector_t sectors); 267 int (*resize) (mddev_t *mddev, sector_t sectors);
252 int (*reshape) (mddev_t *mddev, int raid_disks); 268 int (*check_reshape) (mddev_t *mddev);
269 int (*start_reshape) (mddev_t *mddev);
253 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size); 270 int (*reconfig) (mddev_t *mddev, int layout, int chunk_size);
254 /* quiesce moves between quiescence states 271 /* quiesce moves between quiescence states
255 * 0 - fully active 272 * 0 - fully active
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index c100fa5d4bfa..774e1acfb8c4 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -102,6 +102,18 @@ typedef struct mdp_device_descriptor_s {
102#define MD_SB_ERRORS 1 102#define MD_SB_ERRORS 1
103 103
104#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */ 104#define MD_SB_BITMAP_PRESENT 8 /* bitmap may be present nearby */
105
106/*
107 * Notes:
108 * - if an array is being reshaped (restriped) in order to change the
109 * the number of active devices in the array, 'raid_disks' will be
110 * the larger of the old and new numbers. 'delta_disks' will
111 * be the "new - old". So if +ve, raid_disks is the new value, and
112 * "raid_disks-delta_disks" is the old. If -ve, raid_disks is the
113 * old value and "raid_disks+delta_disks" is the new (smaller) value.
114 */
115
116
105typedef struct mdp_superblock_s { 117typedef struct mdp_superblock_s {
106 /* 118 /*
107 * Constant generic information 119 * Constant generic information
@@ -146,7 +158,13 @@ typedef struct mdp_superblock_s {
146 __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ 158 __u32 cp_events_hi; /* 10 high-order of checkpoint update count */
147#endif 159#endif
148 __u32 recovery_cp; /* 11 recovery checkpoint sector count */ 160 __u32 recovery_cp; /* 11 recovery checkpoint sector count */
149 __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 12]; 161 /* There are only valid for minor_version > 90 */
162 __u64 reshape_position; /* 12,13 next address in array-space for reshape */
163 __u32 new_level; /* 14 new level we are reshaping to */
164 __u32 delta_disks; /* 15 change in number of raid_disks */
165 __u32 new_layout; /* 16 new layout */
166 __u32 new_chunk; /* 17 new chunk size (bytes) */
167 __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18];
150 168
151 /* 169 /*
152 * Personality information 170 * Personality information
@@ -207,7 +225,14 @@ struct mdp_superblock_1 {
207 * NOTE: signed, so bitmap can be before superblock 225 * NOTE: signed, so bitmap can be before superblock
208 * only meaningful of feature_map[0] is set. 226 * only meaningful of feature_map[0] is set.
209 */ 227 */
210 __u8 pad1[128-100]; /* set to 0 when written */ 228
229 /* These are only valid with feature bit '4' */
230 __u64 reshape_position; /* next address in array-space for reshape */
231 __u32 new_level; /* new level we are reshaping to */
232 __u32 delta_disks; /* change in number of raid_disks */
233 __u32 new_layout; /* new layout */
234 __u32 new_chunk; /* new chunk size (bytes) */
235 __u8 pad1[128-124]; /* set to 0 when written */
211 236
212 /* constant this-device information - 64 bytes */ 237 /* constant this-device information - 64 bytes */
213 __u64 data_offset; /* sector start of data, often 0 */ 238 __u64 data_offset; /* sector start of data, often 0 */
@@ -240,8 +265,9 @@ struct mdp_superblock_1 {
240 265
241/* feature_map bits */ 266/* feature_map bits */
242#define MD_FEATURE_BITMAP_OFFSET 1 267#define MD_FEATURE_BITMAP_OFFSET 1
268#define MD_FEATURE_RESHAPE_ACTIVE 4
243 269
244#define MD_FEATURE_ALL 1 270#define MD_FEATURE_ALL 5
245 271
246#endif 272#endif
247 273
diff --git a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
index 9d5494aaac0f..3009c813d83d 100644
--- a/include/linux/raid/raid1.h
+++ b/include/linux/raid/raid1.h
@@ -130,6 +130,6 @@ struct r1bio_s {
130 * with failure when last write completes (and all failed). 130 * with failure when last write completes (and all failed).
131 * Record that bi_end_io was called with this flag... 131 * Record that bi_end_io was called with this flag...
132 */ 132 */
133#define R1BIO_Returned 4 133#define R1BIO_Returned 6
134 134
135#endif 135#endif
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 394da8207b34..914af667044f 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -135,6 +135,7 @@ struct stripe_head {
135 atomic_t count; /* nr of active thread/requests */ 135 atomic_t count; /* nr of active thread/requests */
136 spinlock_t lock; 136 spinlock_t lock;
137 int bm_seq; /* sequence number for bitmap flushes */ 137 int bm_seq; /* sequence number for bitmap flushes */
138 int disks; /* disks in stripe */
138 struct r5dev { 139 struct r5dev {
139 struct bio req; 140 struct bio req;
140 struct bio_vec vec; 141 struct bio_vec vec;
@@ -156,6 +157,7 @@ struct stripe_head {
156#define R5_ReadError 8 /* seen a read error here recently */ 157#define R5_ReadError 8 /* seen a read error here recently */
157#define R5_ReWrite 9 /* have tried to over-write the readerror */ 158#define R5_ReWrite 9 /* have tried to over-write the readerror */
158 159
160#define R5_Expanded 10 /* This block now has post-expand data */
159/* 161/*
160 * Write method 162 * Write method
161 */ 163 */
@@ -174,7 +176,9 @@ struct stripe_head {
174#define STRIPE_DELAYED 6 176#define STRIPE_DELAYED 6
175#define STRIPE_DEGRADED 7 177#define STRIPE_DEGRADED 7
176#define STRIPE_BIT_DELAY 8 178#define STRIPE_BIT_DELAY 8
177 179#define STRIPE_EXPANDING 9
180#define STRIPE_EXPAND_SOURCE 10
181#define STRIPE_EXPAND_READY 11
178/* 182/*
179 * Plugging: 183 * Plugging:
180 * 184 *
@@ -211,12 +215,24 @@ struct raid5_private_data {
211 int raid_disks, working_disks, failed_disks; 215 int raid_disks, working_disks, failed_disks;
212 int max_nr_stripes; 216 int max_nr_stripes;
213 217
218 /* used during an expand */
219 sector_t expand_progress; /* MaxSector when no expand happening */
220 sector_t expand_lo; /* from here up to expand_progress it out-of-bounds
221 * as we haven't flushed the metadata yet
222 */
223 int previous_raid_disks;
224
214 struct list_head handle_list; /* stripes needing handling */ 225 struct list_head handle_list; /* stripes needing handling */
215 struct list_head delayed_list; /* stripes that have plugged requests */ 226 struct list_head delayed_list; /* stripes that have plugged requests */
216 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ 227 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */
217 atomic_t preread_active_stripes; /* stripes with scheduled io */ 228 atomic_t preread_active_stripes; /* stripes with scheduled io */
218 229
219 char cache_name[20]; 230 atomic_t reshape_stripes; /* stripes with pending writes for reshape */
231 /* unfortunately we need two cache names as we temporarily have
232 * two caches.
233 */
234 int active_name;
235 char cache_name[2][20];
220 kmem_cache_t *slab_cache; /* for allocating stripes */ 236 kmem_cache_t *slab_cache; /* for allocating stripes */
221 237
222 int seq_flush, seq_write; 238 int seq_flush, seq_write;
@@ -238,9 +254,10 @@ struct raid5_private_data {
238 wait_queue_head_t wait_for_overlap; 254 wait_queue_head_t wait_for_overlap;
239 int inactive_blocked; /* release of inactive stripes blocked, 255 int inactive_blocked; /* release of inactive stripes blocked,
240 * waiting for 25% to be free 256 * waiting for 25% to be free
241 */ 257 */
258 int pool_size; /* number of disks in stripeheads in pool */
242 spinlock_t device_lock; 259 spinlock_t device_lock;
243 struct disk_info disks[0]; 260 struct disk_info *disks;
244}; 261};
245 262
246typedef struct raid5_private_data raid5_conf_t; 263typedef struct raid5_private_data raid5_conf_t;
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 953b6df5d037..78ecfa28b1c2 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -15,7 +15,7 @@ extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
15extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma); 15extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
16#endif 16#endif
17 17
18extern struct file_operations ramfs_file_operations; 18extern const struct file_operations ramfs_file_operations;
19extern struct vm_operations_struct generic_file_vm_ops; 19extern struct vm_operations_struct generic_file_vm_ops;
20 20
21#endif 21#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index c2ec6c77874e..5673008b61e1 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -113,8 +113,6 @@ struct rcu_data {
113 113
114DECLARE_PER_CPU(struct rcu_data, rcu_data); 114DECLARE_PER_CPU(struct rcu_data, rcu_data);
115DECLARE_PER_CPU(struct rcu_data, rcu_bh_data); 115DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
116extern struct rcu_ctrlblk rcu_ctrlblk;
117extern struct rcu_ctrlblk rcu_bh_ctrlblk;
118 116
119/* 117/*
120 * Increment the quiescent state counter. 118 * Increment the quiescent state counter.
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index dad78cecfd20..5676c4210e2c 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1704,6 +1704,11 @@ static inline int reiserfs_transaction_running(struct super_block *s)
1704 return 0; 1704 return 0;
1705} 1705}
1706 1706
1707static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_handle *th)
1708{
1709 return th->t_blocks_allocated - th->t_blocks_logged;
1710}
1711
1707int reiserfs_async_progress_wait(struct super_block *s); 1712int reiserfs_async_progress_wait(struct super_block *s);
1708 1713
1709struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct 1714struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
@@ -1955,7 +1960,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
1955extern struct inode_operations reiserfs_dir_inode_operations; 1960extern struct inode_operations reiserfs_dir_inode_operations;
1956extern struct inode_operations reiserfs_symlink_inode_operations; 1961extern struct inode_operations reiserfs_symlink_inode_operations;
1957extern struct inode_operations reiserfs_special_inode_operations; 1962extern struct inode_operations reiserfs_special_inode_operations;
1958extern struct file_operations reiserfs_dir_operations; 1963extern const struct file_operations reiserfs_dir_operations;
1959 1964
1960/* tail_conversion.c */ 1965/* tail_conversion.c */
1961int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, 1966int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
@@ -1967,7 +1972,7 @@ void reiserfs_unmap_buffer(struct buffer_head *);
1967 1972
1968/* file.c */ 1973/* file.c */
1969extern struct inode_operations reiserfs_file_inode_operations; 1974extern struct inode_operations reiserfs_file_inode_operations;
1970extern struct file_operations reiserfs_file_operations; 1975extern const struct file_operations reiserfs_file_operations;
1971extern struct address_space_operations reiserfs_address_space_operations; 1976extern struct address_space_operations reiserfs_address_space_operations;
1972 1977
1973/* fix_nodes.c */ 1978/* fix_nodes.c */
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 87280eb6083d..5353afb11db3 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -101,13 +101,13 @@ static inline void reiserfs_mark_inode_private(struct inode *inode)
101#else 101#else
102 102
103#define is_reiserfs_priv_object(inode) 0 103#define is_reiserfs_priv_object(inode) 0
104#define reiserfs_mark_inode_private(inode) 104#define reiserfs_mark_inode_private(inode) do {;} while(0)
105#define reiserfs_getxattr NULL 105#define reiserfs_getxattr NULL
106#define reiserfs_setxattr NULL 106#define reiserfs_setxattr NULL
107#define reiserfs_listxattr NULL 107#define reiserfs_listxattr NULL
108#define reiserfs_removexattr NULL 108#define reiserfs_removexattr NULL
109#define reiserfs_write_lock_xattrs(sb) 109#define reiserfs_write_lock_xattrs(sb) do {;} while(0)
110#define reiserfs_write_unlock_xattrs(sb) 110#define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
111#define reiserfs_read_lock_xattrs(sb) 111#define reiserfs_read_lock_xattrs(sb)
112#define reiserfs_read_unlock_xattrs(sb) 112#define reiserfs_read_unlock_xattrs(sb)
113 113
diff --git a/include/linux/relayfs_fs.h b/include/linux/relay.h
index 7342e66247fb..4bcc1531d6a9 100644
--- a/include/linux/relayfs_fs.h
+++ b/include/linux/relay.h
@@ -1,14 +1,14 @@
1/* 1/*
2 * linux/include/linux/relayfs_fs.h 2 * linux/include/linux/relay.h
3 * 3 *
4 * Copyright (C) 2002, 2003 - Tom Zanussi (zanussi@us.ibm.com), IBM Corp 4 * Copyright (C) 2002, 2003 - Tom Zanussi (zanussi@us.ibm.com), IBM Corp
5 * Copyright (C) 1999, 2000, 2001, 2002 - Karim Yaghmour (karim@opersys.com) 5 * Copyright (C) 1999, 2000, 2001, 2002 - Karim Yaghmour (karim@opersys.com)
6 * 6 *
7 * RelayFS definitions and declarations 7 * CONFIG_RELAY definitions and declarations
8 */ 8 */
9 9
10#ifndef _LINUX_RELAYFS_FS_H 10#ifndef _LINUX_RELAY_H
11#define _LINUX_RELAYFS_FS_H 11#define _LINUX_RELAY_H
12 12
13#include <linux/config.h> 13#include <linux/config.h>
14#include <linux/types.h> 14#include <linux/types.h>
@@ -19,6 +19,9 @@
19#include <linux/poll.h> 19#include <linux/poll.h>
20#include <linux/kref.h> 20#include <linux/kref.h>
21 21
22/* Needs a _much_ better name... */
23#define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE)
24
22/* 25/*
23 * Tracks changes to rchan/rchan_buf structs 26 * Tracks changes to rchan/rchan_buf structs
24 */ 27 */
@@ -92,26 +95,26 @@ struct rchan_callbacks
92 size_t prev_padding); 95 size_t prev_padding);
93 96
94 /* 97 /*
95 * buf_mapped - relayfs buffer mmap notification 98 * buf_mapped - relay buffer mmap notification
96 * @buf: the channel buffer 99 * @buf: the channel buffer
97 * @filp: relayfs file pointer 100 * @filp: relay file pointer
98 * 101 *
99 * Called when a relayfs file is successfully mmapped 102 * Called when a relay file is successfully mmapped
100 */ 103 */
101 void (*buf_mapped)(struct rchan_buf *buf, 104 void (*buf_mapped)(struct rchan_buf *buf,
102 struct file *filp); 105 struct file *filp);
103 106
104 /* 107 /*
105 * buf_unmapped - relayfs buffer unmap notification 108 * buf_unmapped - relay buffer unmap notification
106 * @buf: the channel buffer 109 * @buf: the channel buffer
107 * @filp: relayfs file pointer 110 * @filp: relay file pointer
108 * 111 *
109 * Called when a relayfs file is successfully unmapped 112 * Called when a relay file is successfully unmapped
110 */ 113 */
111 void (*buf_unmapped)(struct rchan_buf *buf, 114 void (*buf_unmapped)(struct rchan_buf *buf,
112 struct file *filp); 115 struct file *filp);
113 /* 116 /*
114 * create_buf_file - create file to represent a relayfs channel buffer 117 * create_buf_file - create file to represent a relay channel buffer
115 * @filename: the name of the file to create 118 * @filename: the name of the file to create
116 * @parent: the parent of the file to create 119 * @parent: the parent of the file to create
117 * @mode: the mode of the file to create 120 * @mode: the mode of the file to create
@@ -121,7 +124,7 @@ struct rchan_callbacks
121 * Called during relay_open(), once for each per-cpu buffer, 124 * Called during relay_open(), once for each per-cpu buffer,
122 * to allow the client to create a file to be used to 125 * to allow the client to create a file to be used to
123 * represent the corresponding channel buffer. If the file is 126 * represent the corresponding channel buffer. If the file is
124 * created outside of relayfs, the parent must also exist in 127 * created outside of relay, the parent must also exist in
125 * that filesystem. 128 * that filesystem.
126 * 129 *
127 * The callback should return the dentry of the file created 130 * The callback should return the dentry of the file created
@@ -140,7 +143,7 @@ struct rchan_callbacks
140 int *is_global); 143 int *is_global);
141 144
142 /* 145 /*
143 * remove_buf_file - remove file representing a relayfs channel buffer 146 * remove_buf_file - remove file representing a relay channel buffer
144 * @dentry: the dentry of the file to remove 147 * @dentry: the dentry of the file to remove
145 * 148 *
146 * Called during relay_close(), once for each per-cpu buffer, 149 * Called during relay_close(), once for each per-cpu buffer,
@@ -153,7 +156,7 @@ struct rchan_callbacks
153}; 156};
154 157
155/* 158/*
156 * relayfs kernel API, fs/relayfs/relay.c 159 * CONFIG_RELAY kernel API, kernel/relay.c
157 */ 160 */
158 161
159struct rchan *relay_open(const char *base_filename, 162struct rchan *relay_open(const char *base_filename,
@@ -171,15 +174,6 @@ extern int relay_buf_full(struct rchan_buf *buf);
171 174
172extern size_t relay_switch_subbuf(struct rchan_buf *buf, 175extern size_t relay_switch_subbuf(struct rchan_buf *buf,
173 size_t length); 176 size_t length);
174extern struct dentry *relayfs_create_dir(const char *name,
175 struct dentry *parent);
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);
183 177
184/** 178/**
185 * relay_write - write data into the channel 179 * relay_write - write data into the channel
@@ -279,9 +273,9 @@ static inline void subbuf_start_reserve(struct rchan_buf *buf,
279} 273}
280 274
281/* 275/*
282 * exported relay file operations, fs/relayfs/inode.c 276 * exported relay file operations, kernel/relay.c
283 */ 277 */
284extern struct file_operations relay_file_operations; 278extern struct file_operations relay_file_operations;
285 279
286#endif /* _LINUX_RELAYFS_FS_H */ 280#endif /* _LINUX_RELAY_H */
287 281
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 0b2ba67ff13c..ab61cd1199f2 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -11,8 +11,6 @@
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
16/* 14/*
17 * The struct used to pass data via the following ioctl. Similar to the 15 * The struct used to pass data via the following ioctl. Similar to the
18 * struct tm in <time.h>, but it needs to be here so that the kernel 16 * struct tm in <time.h>, but it needs to be here so that the kernel
@@ -93,8 +91,102 @@ struct rtc_pll_info {
93#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */ 91#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */
94#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */ 92#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */
95 93
94/* interrupt flags */
95#define RTC_IRQF 0x80 /* any of the following is active */
96#define RTC_PF 0x40
97#define RTC_AF 0x20
98#define RTC_UF 0x10
99
96#ifdef __KERNEL__ 100#ifdef __KERNEL__
97 101
102#include <linux/interrupt.h>
103
104extern int rtc_month_days(unsigned int month, unsigned int year);
105extern int rtc_valid_tm(struct rtc_time *tm);
106extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time);
107extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm);
108
109#include <linux/device.h>
110#include <linux/seq_file.h>
111#include <linux/cdev.h>
112#include <linux/poll.h>
113#include <linux/mutex.h>
114
115extern struct class *rtc_class;
116
117struct rtc_class_ops {
118 int (*open)(struct device *);
119 void (*release)(struct device *);
120 int (*ioctl)(struct device *, unsigned int, unsigned long);
121 int (*read_time)(struct device *, struct rtc_time *);
122 int (*set_time)(struct device *, struct rtc_time *);
123 int (*read_alarm)(struct device *, struct rtc_wkalrm *);
124 int (*set_alarm)(struct device *, struct rtc_wkalrm *);
125 int (*proc)(struct device *, struct seq_file *);
126 int (*set_mmss)(struct device *, unsigned long secs);
127 int (*irq_set_state)(struct device *, int enabled);
128 int (*irq_set_freq)(struct device *, int freq);
129 int (*read_callback)(struct device *, int data);
130};
131
132#define RTC_DEVICE_NAME_SIZE 20
133struct rtc_task;
134
135struct rtc_device
136{
137 struct class_device class_dev;
138 struct module *owner;
139
140 int id;
141 char name[RTC_DEVICE_NAME_SIZE];
142
143 struct rtc_class_ops *ops;
144 struct mutex ops_lock;
145
146 struct class_device *rtc_dev;
147 struct cdev char_dev;
148 struct mutex char_lock;
149
150 unsigned long irq_data;
151 spinlock_t irq_lock;
152 wait_queue_head_t irq_queue;
153 struct fasync_struct *async_queue;
154
155 struct rtc_task *irq_task;
156 spinlock_t irq_task_lock;
157 int irq_freq;
158};
159#define to_rtc_device(d) container_of(d, struct rtc_device, class_dev)
160
161extern struct rtc_device *rtc_device_register(const char *name,
162 struct device *dev,
163 struct rtc_class_ops *ops,
164 struct module *owner);
165extern void rtc_device_unregister(struct rtc_device *rdev);
166extern int rtc_interface_register(struct class_interface *intf);
167
168extern int rtc_read_time(struct class_device *class_dev, struct rtc_time *tm);
169extern int rtc_set_time(struct class_device *class_dev, struct rtc_time *tm);
170extern int rtc_set_mmss(struct class_device *class_dev, unsigned long secs);
171extern int rtc_read_alarm(struct class_device *class_dev,
172 struct rtc_wkalrm *alrm);
173extern int rtc_set_alarm(struct class_device *class_dev,
174 struct rtc_wkalrm *alrm);
175extern void rtc_update_irq(struct class_device *class_dev,
176 unsigned long num, unsigned long events);
177
178extern struct class_device *rtc_class_open(char *name);
179extern void rtc_class_close(struct class_device *class_dev);
180
181extern int rtc_irq_register(struct class_device *class_dev,
182 struct rtc_task *task);
183extern void rtc_irq_unregister(struct class_device *class_dev,
184 struct rtc_task *task);
185extern int rtc_irq_set_state(struct class_device *class_dev,
186 struct rtc_task *task, int enabled);
187extern int rtc_irq_set_freq(struct class_device *class_dev,
188 struct rtc_task *task, int freq);
189
98typedef struct rtc_task { 190typedef struct rtc_task {
99 void (*func)(void *private_data); 191 void (*func)(void *private_data);
100 void *private_data; 192 void *private_data;
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index d50482ba27fe..df0cdd41085c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -199,6 +199,7 @@ enum
199#define RTPROT_BIRD 12 /* BIRD */ 199#define RTPROT_BIRD 12 /* BIRD */
200#define RTPROT_DNROUTED 13 /* DECnet routing daemon */ 200#define RTPROT_DNROUTED 13 /* DECnet routing daemon */
201#define RTPROT_XORP 14 /* XORP */ 201#define RTPROT_XORP 14 /* XORP */
202#define RTPROT_NTK 15 /* Netsukuku */
202 203
203/* rtm_scope 204/* rtm_scope
204 205
@@ -733,6 +734,8 @@ enum
733#define IFLA_MAP IFLA_MAP 734#define IFLA_MAP IFLA_MAP
734 IFLA_WEIGHT, 735 IFLA_WEIGHT,
735#define IFLA_WEIGHT IFLA_WEIGHT 736#define IFLA_WEIGHT IFLA_WEIGHT
737 IFLA_OPERSTATE,
738 IFLA_LINKMODE,
736 __IFLA_MAX 739 __IFLA_MAX
737}; 740};
738 741
@@ -836,6 +839,7 @@ enum
836#define RTMGRP_IPV4_IFADDR 0x10 839#define RTMGRP_IPV4_IFADDR 0x10
837#define RTMGRP_IPV4_MROUTE 0x20 840#define RTMGRP_IPV4_MROUTE 0x20
838#define RTMGRP_IPV4_ROUTE 0x40 841#define RTMGRP_IPV4_ROUTE 0x40
842#define RTMGRP_IPV4_RULE 0x80
839 843
840#define RTMGRP_IPV6_IFADDR 0x100 844#define RTMGRP_IPV6_IFADDR 0x100
841#define RTMGRP_IPV6_MROUTE 0x200 845#define RTMGRP_IPV6_MROUTE 0x200
@@ -866,7 +870,8 @@ enum rtnetlink_groups {
866#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE 870#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE
867 RTNLGRP_IPV4_ROUTE, 871 RTNLGRP_IPV4_ROUTE,
868#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE 872#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE
869 RTNLGRP_NOP1, 873 RTNLGRP_IPV4_RULE,
874#define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE
870 RTNLGRP_IPV6_IFADDR, 875 RTNLGRP_IPV6_IFADDR,
871#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR 876#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR
872 RTNLGRP_IPV6_MROUTE, 877 RTNLGRP_IPV6_MROUTE,
@@ -905,6 +910,7 @@ struct tcamsg
905#ifdef __KERNEL__ 910#ifdef __KERNEL__
906 911
907#include <linux/config.h> 912#include <linux/config.h>
913#include <linux/mutex.h>
908 914
909extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size); 915extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size);
910static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str) 916static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
@@ -1036,24 +1042,17 @@ __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)
1036 1042
1037extern void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change); 1043extern void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change);
1038 1044
1039extern struct semaphore rtnl_sem; 1045/* RTNL is used as a global lock for all changes to network configuration */
1040
1041#define rtnl_shlock() down(&rtnl_sem)
1042#define rtnl_shlock_nowait() down_trylock(&rtnl_sem)
1043
1044#define rtnl_shunlock() do { up(&rtnl_sem); \
1045 if (rtnl && rtnl->sk_receive_queue.qlen) \
1046 rtnl->sk_data_ready(rtnl, 0); \
1047 } while(0)
1048
1049extern void rtnl_lock(void); 1046extern void rtnl_lock(void);
1050extern int rtnl_lock_interruptible(void);
1051extern void rtnl_unlock(void); 1047extern void rtnl_unlock(void);
1048extern int rtnl_trylock(void);
1049
1052extern void rtnetlink_init(void); 1050extern void rtnetlink_init(void);
1051extern void __rtnl_unlock(void);
1053 1052
1054#define ASSERT_RTNL() do { \ 1053#define ASSERT_RTNL() do { \
1055 if (unlikely(down_trylock(&rtnl_sem) == 0)) { \ 1054 if (unlikely(rtnl_trylock())) { \
1056 up(&rtnl_sem); \ 1055 rtnl_unlock(); \
1057 printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \ 1056 printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \
1058 __FILE__, __LINE__); \ 1057 __FILE__, __LINE__); \
1059 dump_stack(); \ 1058 dump_stack(); \
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 62e6314382f0..541f4828f5e7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -35,6 +35,7 @@
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#include <linux/rcupdate.h>
38#include <linux/futex.h>
38 39
39#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */ 40#include <linux/auxvec.h> /* For AT_VECTOR_SIZE */
40 41
@@ -99,6 +100,7 @@ DECLARE_PER_CPU(unsigned long, process_counts);
99extern int nr_processes(void); 100extern int nr_processes(void);
100extern unsigned long nr_running(void); 101extern unsigned long nr_running(void);
101extern unsigned long nr_uninterruptible(void); 102extern unsigned long nr_uninterruptible(void);
103extern unsigned long nr_active(void);
102extern unsigned long nr_iowait(void); 104extern unsigned long nr_iowait(void);
103 105
104#include <linux/time.h> 106#include <linux/time.h>
@@ -206,11 +208,11 @@ extern void update_process_times(int user);
206extern void scheduler_tick(void); 208extern void scheduler_tick(void);
207 209
208#ifdef CONFIG_DETECT_SOFTLOCKUP 210#ifdef CONFIG_DETECT_SOFTLOCKUP
209extern void softlockup_tick(struct pt_regs *regs); 211extern void softlockup_tick(void);
210extern void spawn_softlockup_task(void); 212extern void spawn_softlockup_task(void);
211extern void touch_softlockup_watchdog(void); 213extern void touch_softlockup_watchdog(void);
212#else 214#else
213static inline void softlockup_tick(struct pt_regs *regs) 215static inline void softlockup_tick(void)
214{ 216{
215} 217}
216static inline void spawn_softlockup_task(void) 218static inline void spawn_softlockup_task(void)
@@ -354,16 +356,8 @@ struct sighand_struct {
354 atomic_t count; 356 atomic_t count;
355 struct k_sigaction action[_NSIG]; 357 struct k_sigaction action[_NSIG];
356 spinlock_t siglock; 358 spinlock_t siglock;
357 struct rcu_head rcu;
358}; 359};
359 360
360extern void sighand_free_cb(struct rcu_head *rhp);
361
362static inline void sighand_free(struct sighand_struct *sp)
363{
364 call_rcu(&sp->rcu, sighand_free_cb);
365}
366
367/* 361/*
368 * NOTE! "signal_struct" does not have it's own 362 * NOTE! "signal_struct" does not have it's own
369 * locking, because a shared signal_struct always 363 * locking, because a shared signal_struct always
@@ -402,6 +396,7 @@ struct signal_struct {
402 396
403 /* ITIMER_REAL timer for the process */ 397 /* ITIMER_REAL timer for the process */
404 struct hrtimer real_timer; 398 struct hrtimer real_timer;
399 struct task_struct *tsk;
405 ktime_t it_real_incr; 400 ktime_t it_real_incr;
406 401
407 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ 402 /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
@@ -489,6 +484,7 @@ struct signal_struct {
489#define MAX_PRIO (MAX_RT_PRIO + 40) 484#define MAX_PRIO (MAX_RT_PRIO + 40)
490 485
491#define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO)) 486#define rt_task(p) (unlikely((p)->prio < MAX_RT_PRIO))
487#define batch_task(p) (unlikely((p)->policy == SCHED_BATCH))
492 488
493/* 489/*
494 * Some day this will be a full-fledged user tracking system.. 490 * Some day this will be a full-fledged user tracking system..
@@ -689,6 +685,13 @@ static inline void prefetch_stack(struct task_struct *t) { }
689struct audit_context; /* See audit.c */ 685struct audit_context; /* See audit.c */
690struct mempolicy; 686struct mempolicy;
691 687
688enum sleep_type {
689 SLEEP_NORMAL,
690 SLEEP_NONINTERACTIVE,
691 SLEEP_INTERACTIVE,
692 SLEEP_INTERRUPTED,
693};
694
692struct task_struct { 695struct task_struct {
693 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 696 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
694 struct thread_info *thread_info; 697 struct thread_info *thread_info;
@@ -706,11 +709,12 @@ struct task_struct {
706 prio_array_t *array; 709 prio_array_t *array;
707 710
708 unsigned short ioprio; 711 unsigned short ioprio;
712 unsigned int btrace_seq;
709 713
710 unsigned long sleep_avg; 714 unsigned long sleep_avg;
711 unsigned long long timestamp, last_ran; 715 unsigned long long timestamp, last_ran;
712 unsigned long long sched_time; /* sched_clock time spent running */ 716 unsigned long long sched_time; /* sched_clock time spent running */
713 int activated; 717 enum sleep_type sleep_type;
714 718
715 unsigned long policy; 719 unsigned long policy;
716 cpumask_t cpus_allowed; 720 cpumask_t cpus_allowed;
@@ -756,7 +760,8 @@ struct task_struct {
756 struct task_struct *group_leader; /* threadgroup leader */ 760 struct task_struct *group_leader; /* threadgroup leader */
757 761
758 /* PID/PID hash table linkage. */ 762 /* PID/PID hash table linkage. */
759 struct pid pids[PIDTYPE_MAX]; 763 struct pid_link pids[PIDTYPE_MAX];
764 struct list_head thread_group;
760 765
761 struct completion *vfork_done; /* for vfork() */ 766 struct completion *vfork_done; /* for vfork() */
762 int __user *set_child_tid; /* CLONE_CHILD_SETTID */ 767 int __user *set_child_tid; /* CLONE_CHILD_SETTID */
@@ -868,7 +873,13 @@ struct task_struct {
868 struct cpuset *cpuset; 873 struct cpuset *cpuset;
869 nodemask_t mems_allowed; 874 nodemask_t mems_allowed;
870 int cpuset_mems_generation; 875 int cpuset_mems_generation;
876 int cpuset_mem_spread_rotor;
877#endif
878 struct robust_list_head __user *robust_list;
879#ifdef CONFIG_COMPAT
880 struct compat_robust_list_head __user *compat_robust_list;
871#endif 881#endif
882
872 atomic_t fs_excl; /* holding fs exclusive resources */ 883 atomic_t fs_excl; /* holding fs exclusive resources */
873 struct rcu_head rcu; 884 struct rcu_head rcu;
874}; 885};
@@ -888,18 +899,19 @@ static inline pid_t process_group(struct task_struct *tsk)
888 */ 899 */
889static inline int pid_alive(struct task_struct *p) 900static inline int pid_alive(struct task_struct *p)
890{ 901{
891 return p->pids[PIDTYPE_PID].nr != 0; 902 return p->pids[PIDTYPE_PID].pid != NULL;
892} 903}
893 904
894extern void free_task(struct task_struct *tsk); 905extern void free_task(struct task_struct *tsk);
895#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0) 906#define get_task_struct(tsk) do { atomic_inc(&(tsk)->usage); } while(0)
896 907
897extern void __put_task_struct_cb(struct rcu_head *rhp); 908extern void __put_task_struct_cb(struct rcu_head *rhp);
909extern void __put_task_struct(struct task_struct *t);
898 910
899static inline void put_task_struct(struct task_struct *t) 911static inline void put_task_struct(struct task_struct *t)
900{ 912{
901 if (atomic_dec_and_test(&t->usage)) 913 if (atomic_dec_and_test(&t->usage))
902 call_rcu(&t->rcu, __put_task_struct_cb); 914 __put_task_struct(t);
903} 915}
904 916
905/* 917/*
@@ -928,6 +940,9 @@ static inline void put_task_struct(struct task_struct *t)
928#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ 940#define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */
929#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ 941#define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */
930#define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */ 942#define PF_SWAPWRITE 0x01000000 /* Allowed to write to swap */
943#define PF_SPREAD_PAGE 0x04000000 /* Spread page cache over cpuset */
944#define PF_SPREAD_SLAB 0x08000000 /* Spread some slab caches over cpuset */
945#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
931 946
932/* 947/*
933 * Only the _current_ task can read/write to tsk->flags, but other 948 * Only the _current_ task can read/write to tsk->flags, but other
@@ -1089,7 +1104,6 @@ extern void force_sig_specific(int, struct task_struct *);
1089extern int send_sig(int, struct task_struct *, int); 1104extern int send_sig(int, struct task_struct *, int);
1090extern void zap_other_threads(struct task_struct *p); 1105extern void zap_other_threads(struct task_struct *p);
1091extern int kill_pg(pid_t, int, int); 1106extern int kill_pg(pid_t, int, int);
1092extern int kill_sl(pid_t, int, int);
1093extern int kill_proc(pid_t, int, int); 1107extern int kill_proc(pid_t, int, int);
1094extern struct sigqueue *sigqueue_alloc(void); 1108extern struct sigqueue *sigqueue_alloc(void);
1095extern void sigqueue_free(struct sigqueue *); 1109extern void sigqueue_free(struct sigqueue *);
@@ -1146,10 +1160,8 @@ extern void flush_thread(void);
1146extern void exit_thread(void); 1160extern void exit_thread(void);
1147 1161
1148extern void exit_files(struct task_struct *); 1162extern void exit_files(struct task_struct *);
1149extern void exit_signal(struct task_struct *); 1163extern void __cleanup_signal(struct signal_struct *);
1150extern void __exit_signal(struct task_struct *); 1164extern void __cleanup_sighand(struct sighand_struct *);
1151extern void exit_sighand(struct task_struct *);
1152extern void __exit_sighand(struct task_struct *);
1153extern void exit_itimers(struct signal_struct *); 1165extern void exit_itimers(struct signal_struct *);
1154 1166
1155extern NORET_TYPE void do_group_exit(int); 1167extern NORET_TYPE void do_group_exit(int);
@@ -1173,19 +1185,7 @@ extern void wait_task_inactive(task_t * p);
1173#endif 1185#endif
1174 1186
1175#define remove_parent(p) list_del_init(&(p)->sibling) 1187#define remove_parent(p) list_del_init(&(p)->sibling)
1176#define add_parent(p, parent) list_add_tail(&(p)->sibling,&(parent)->children) 1188#define add_parent(p) list_add_tail(&(p)->sibling,&(p)->parent->children)
1177
1178#define REMOVE_LINKS(p) do { \
1179 if (thread_group_leader(p)) \
1180 list_del_init(&(p)->tasks); \
1181 remove_parent(p); \
1182 } while (0)
1183
1184#define SET_LINKS(p) do { \
1185 if (thread_group_leader(p)) \
1186 list_add_tail(&(p)->tasks,&init_task.tasks); \
1187 add_parent(p, (p)->parent); \
1188 } while (0)
1189 1189
1190#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) 1190#define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks)
1191#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) 1191#define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks)
@@ -1203,20 +1203,22 @@ extern void wait_task_inactive(task_t * p);
1203#define while_each_thread(g, t) \ 1203#define while_each_thread(g, t) \
1204 while ((t = next_thread(t)) != g) 1204 while ((t = next_thread(t)) != g)
1205 1205
1206extern task_t * FASTCALL(next_thread(const task_t *p));
1207
1208#define thread_group_leader(p) (p->pid == p->tgid) 1206#define thread_group_leader(p) (p->pid == p->tgid)
1209 1207
1208static inline task_t *next_thread(task_t *p)
1209{
1210 return list_entry(rcu_dereference(p->thread_group.next),
1211 task_t, thread_group);
1212}
1213
1210static inline int thread_group_empty(task_t *p) 1214static inline int thread_group_empty(task_t *p)
1211{ 1215{
1212 return list_empty(&p->pids[PIDTYPE_TGID].pid_list); 1216 return list_empty(&p->thread_group);
1213} 1217}
1214 1218
1215#define delay_group_leader(p) \ 1219#define delay_group_leader(p) \
1216 (thread_group_leader(p) && !thread_group_empty(p)) 1220 (thread_group_leader(p) && !thread_group_empty(p))
1217 1221
1218extern void unhash_process(struct task_struct *p);
1219
1220/* 1222/*
1221 * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring 1223 * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm, keyring
1222 * subscriptions and synchronises with wait4(). Also used in procfs. Also 1224 * subscriptions and synchronises with wait4(). Also used in procfs. Also
@@ -1236,6 +1238,15 @@ static inline void task_unlock(struct task_struct *p)
1236 spin_unlock(&p->alloc_lock); 1238 spin_unlock(&p->alloc_lock);
1237} 1239}
1238 1240
1241extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
1242 unsigned long *flags);
1243
1244static inline void unlock_task_sighand(struct task_struct *tsk,
1245 unsigned long *flags)
1246{
1247 spin_unlock_irqrestore(&tsk->sighand->siglock, *flags);
1248}
1249
1239#ifndef __HAVE_THREAD_FUNCTIONS 1250#ifndef __HAVE_THREAD_FUNCTIONS
1240 1251
1241#define task_thread_info(task) (task)->thread_info 1252#define task_thread_info(task) (task)->thread_info
diff --git a/include/linux/security.h b/include/linux/security.h
index 7cbef482e13a..aaa0a5cdbf75 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -869,6 +869,11 @@ struct swap_info_struct;
869 * @ipcp contains the kernel IPC permission structure 869 * @ipcp contains the kernel IPC permission structure
870 * @flag contains the desired (requested) permission set 870 * @flag contains the desired (requested) permission set
871 * Return 0 if permission is granted. 871 * Return 0 if permission is granted.
872 * @ipc_getsecurity:
873 * Copy the security label associated with the ipc object into
874 * @buffer. @buffer may be NULL to request the size of the buffer
875 * required. @size indicates the size of @buffer in bytes. Return
876 * number of bytes used/required on success.
872 * 877 *
873 * Security hooks for individual messages held in System V IPC message queues 878 * Security hooks for individual messages held in System V IPC message queues
874 * @msg_msg_alloc_security: 879 * @msg_msg_alloc_security:
@@ -1040,6 +1045,11 @@ struct swap_info_struct;
1040 * @effective contains the effective capability set. 1045 * @effective contains the effective capability set.
1041 * @inheritable contains the inheritable capability set. 1046 * @inheritable contains the inheritable capability set.
1042 * @permitted contains the permitted capability set. 1047 * @permitted contains the permitted capability set.
1048 * @capable:
1049 * Check whether the @tsk process has the @cap capability.
1050 * @tsk contains the task_struct for the process.
1051 * @cap contains the capability <include/linux/capability.h>.
1052 * Return 0 if the capability is granted for @tsk.
1043 * @acct: 1053 * @acct:
1044 * Check permission before enabling or disabling process accounting. If 1054 * Check permission before enabling or disabling process accounting. If
1045 * accounting is being enabled, then @file refers to the open file used to 1055 * accounting is being enabled, then @file refers to the open file used to
@@ -1053,11 +1063,6 @@ struct swap_info_struct;
1053 * @table contains the ctl_table structure for the sysctl variable. 1063 * @table contains the ctl_table structure for the sysctl variable.
1054 * @op contains the operation (001 = search, 002 = write, 004 = read). 1064 * @op contains the operation (001 = search, 002 = write, 004 = read).
1055 * Return 0 if permission is granted. 1065 * Return 0 if permission is granted.
1056 * @capable:
1057 * Check whether the @tsk process has the @cap capability.
1058 * @tsk contains the task_struct for the process.
1059 * @cap contains the capability <include/linux/capability.h>.
1060 * Return 0 if the capability is granted for @tsk.
1061 * @syslog: 1066 * @syslog:
1062 * Check permission before accessing the kernel message ring or changing 1067 * Check permission before accessing the kernel message ring or changing
1063 * logging to the console. 1068 * logging to the console.
@@ -1099,9 +1104,9 @@ struct security_operations {
1099 kernel_cap_t * effective, 1104 kernel_cap_t * effective,
1100 kernel_cap_t * inheritable, 1105 kernel_cap_t * inheritable,
1101 kernel_cap_t * permitted); 1106 kernel_cap_t * permitted);
1107 int (*capable) (struct task_struct * tsk, int cap);
1102 int (*acct) (struct file * file); 1108 int (*acct) (struct file * file);
1103 int (*sysctl) (struct ctl_table * table, int op); 1109 int (*sysctl) (struct ctl_table * table, int op);
1104 int (*capable) (struct task_struct * tsk, int cap);
1105 int (*quotactl) (int cmds, int type, int id, struct super_block * sb); 1110 int (*quotactl) (int cmds, int type, int id, struct super_block * sb);
1106 int (*quota_on) (struct dentry * dentry); 1111 int (*quota_on) (struct dentry * dentry);
1107 int (*syslog) (int type); 1112 int (*syslog) (int type);
@@ -1168,7 +1173,8 @@ struct security_operations {
1168 int (*inode_getxattr) (struct dentry *dentry, char *name); 1173 int (*inode_getxattr) (struct dentry *dentry, char *name);
1169 int (*inode_listxattr) (struct dentry *dentry); 1174 int (*inode_listxattr) (struct dentry *dentry);
1170 int (*inode_removexattr) (struct dentry *dentry, char *name); 1175 int (*inode_removexattr) (struct dentry *dentry, char *name);
1171 int (*inode_getsecurity)(struct inode *inode, const char *name, void *buffer, size_t size, int err); 1176 const char *(*inode_xattr_getsuffix) (void);
1177 int (*inode_getsecurity)(const struct inode *inode, const char *name, void *buffer, size_t size, int err);
1172 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags); 1178 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags);
1173 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size); 1179 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size);
1174 1180
@@ -1217,6 +1223,7 @@ struct security_operations {
1217 void (*task_to_inode)(struct task_struct *p, struct inode *inode); 1223 void (*task_to_inode)(struct task_struct *p, struct inode *inode);
1218 1224
1219 int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag); 1225 int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag);
1226 int (*ipc_getsecurity)(struct kern_ipc_perm *ipcp, void *buffer, size_t size);
1220 1227
1221 int (*msg_msg_alloc_security) (struct msg_msg * msg); 1228 int (*msg_msg_alloc_security) (struct msg_msg * msg);
1222 void (*msg_msg_free_security) (struct msg_msg * msg); 1229 void (*msg_msg_free_security) (struct msg_msg * msg);
@@ -1286,7 +1293,8 @@ struct security_operations {
1286 int (*socket_setsockopt) (struct socket * sock, int level, int optname); 1293 int (*socket_setsockopt) (struct socket * sock, int level, int optname);
1287 int (*socket_shutdown) (struct socket * sock, int how); 1294 int (*socket_shutdown) (struct socket * sock, int how);
1288 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb); 1295 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb);
1289 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1296 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1297 int (*socket_getpeersec_dgram) (struct sk_buff *skb, char **secdata, u32 *seclen);
1290 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1298 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1291 void (*sk_free_security) (struct sock *sk); 1299 void (*sk_free_security) (struct sock *sk);
1292 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir); 1300 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir);
@@ -1346,6 +1354,11 @@ static inline void security_capset_set (struct task_struct *target,
1346 security_ops->capset_set (target, effective, inheritable, permitted); 1354 security_ops->capset_set (target, effective, inheritable, permitted);
1347} 1355}
1348 1356
1357static inline int security_capable(struct task_struct *tsk, int cap)
1358{
1359 return security_ops->capable(tsk, cap);
1360}
1361
1349static inline int security_acct (struct file *file) 1362static inline int security_acct (struct file *file)
1350{ 1363{
1351 return security_ops->acct (file); 1364 return security_ops->acct (file);
@@ -1674,7 +1687,12 @@ static inline int security_inode_removexattr (struct dentry *dentry, char *name)
1674 return security_ops->inode_removexattr (dentry, name); 1687 return security_ops->inode_removexattr (dentry, name);
1675} 1688}
1676 1689
1677static inline int security_inode_getsecurity(struct inode *inode, const char *name, void *buffer, size_t size, int err) 1690static inline const char *security_inode_xattr_getsuffix(void)
1691{
1692 return security_ops->inode_xattr_getsuffix();
1693}
1694
1695static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
1678{ 1696{
1679 if (unlikely (IS_PRIVATE (inode))) 1697 if (unlikely (IS_PRIVATE (inode)))
1680 return 0; 1698 return 0;
@@ -1869,6 +1887,11 @@ static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
1869 return security_ops->ipc_permission (ipcp, flag); 1887 return security_ops->ipc_permission (ipcp, flag);
1870} 1888}
1871 1889
1890static inline int security_ipc_getsecurity(struct kern_ipc_perm *ipcp, void *buffer, size_t size)
1891{
1892 return security_ops->ipc_getsecurity(ipcp, buffer, size);
1893}
1894
1872static inline int security_msg_msg_alloc (struct msg_msg * msg) 1895static inline int security_msg_msg_alloc (struct msg_msg * msg)
1873{ 1896{
1874 return security_ops->msg_msg_alloc_security (msg); 1897 return security_ops->msg_msg_alloc_security (msg);
@@ -2049,6 +2072,11 @@ static inline void security_capset_set (struct task_struct *target,
2049 cap_capset_set (target, effective, inheritable, permitted); 2072 cap_capset_set (target, effective, inheritable, permitted);
2050} 2073}
2051 2074
2075static inline int security_capable(struct task_struct *tsk, int cap)
2076{
2077 return cap_capable(tsk, cap);
2078}
2079
2052static inline int security_acct (struct file *file) 2080static inline int security_acct (struct file *file)
2053{ 2081{
2054 return 0; 2082 return 0;
@@ -2316,7 +2344,12 @@ static inline int security_inode_removexattr (struct dentry *dentry, char *name)
2316 return cap_inode_removexattr(dentry, name); 2344 return cap_inode_removexattr(dentry, name);
2317} 2345}
2318 2346
2319static inline int security_inode_getsecurity(struct inode *inode, const char *name, void *buffer, size_t size, int err) 2347static inline const char *security_inode_xattr_getsuffix (void)
2348{
2349 return NULL ;
2350}
2351
2352static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void *buffer, size_t size, int err)
2320{ 2353{
2321 return -EOPNOTSUPP; 2354 return -EOPNOTSUPP;
2322} 2355}
@@ -2499,6 +2532,11 @@ static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
2499 return 0; 2532 return 0;
2500} 2533}
2501 2534
2535static inline int security_ipc_getsecurity(struct kern_ipc_perm *ipcp, void *buffer, size_t size)
2536{
2537 return -EOPNOTSUPP;
2538}
2539
2502static inline int security_msg_msg_alloc (struct msg_msg * msg) 2540static inline int security_msg_msg_alloc (struct msg_msg * msg)
2503{ 2541{
2504 return 0; 2542 return 0;
@@ -2741,10 +2779,16 @@ static inline int security_sock_rcv_skb (struct sock * sk,
2741 return security_ops->socket_sock_rcv_skb (sk, skb); 2779 return security_ops->socket_sock_rcv_skb (sk, skb);
2742} 2780}
2743 2781
2744static inline int security_socket_getpeersec(struct socket *sock, char __user *optval, 2782static inline int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
2745 int __user *optlen, unsigned len) 2783 int __user *optlen, unsigned len)
2784{
2785 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
2786}
2787
2788static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata,
2789 u32 *seclen)
2746{ 2790{
2747 return security_ops->socket_getpeersec(sock, optval, optlen, len); 2791 return security_ops->socket_getpeersec_dgram(skb, secdata, seclen);
2748} 2792}
2749 2793
2750static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) 2794static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
@@ -2863,8 +2907,14 @@ static inline int security_sock_rcv_skb (struct sock * sk,
2863 return 0; 2907 return 0;
2864} 2908}
2865 2909
2866static inline int security_socket_getpeersec(struct socket *sock, char __user *optval, 2910static inline int security_socket_getpeersec_stream(struct socket *sock, char __user *optval,
2867 int __user *optlen, unsigned len) 2911 int __user *optlen, unsigned len)
2912{
2913 return -ENOPROTOOPT;
2914}
2915
2916static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata,
2917 u32 *seclen)
2868{ 2918{
2869 return -ENOPROTOOPT; 2919 return -ENOPROTOOPT;
2870} 2920}
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 850a974ee505..b95f6eb7254c 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -4,7 +4,7 @@
4 4
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/string.h> 6#include <linux/string.h>
7#include <asm/semaphore.h> 7#include <linux/mutex.h>
8 8
9struct seq_operations; 9struct seq_operations;
10struct file; 10struct file;
@@ -19,7 +19,7 @@ struct seq_file {
19 size_t count; 19 size_t count;
20 loff_t index; 20 loff_t index;
21 loff_t version; 21 loff_t version;
22 struct semaphore sem; 22 struct mutex lock;
23 struct seq_operations *op; 23 struct seq_operations *op;
24 void *private; 24 void *private;
25}; 25};
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 73b464f0926a..8e9681413726 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -37,6 +37,7 @@ enum {
37 PLAT8250_DEV_LEGACY = -1, 37 PLAT8250_DEV_LEGACY = -1,
38 PLAT8250_DEV_PLATFORM, 38 PLAT8250_DEV_PLATFORM,
39 PLAT8250_DEV_PLATFORM1, 39 PLAT8250_DEV_PLATFORM1,
40 PLAT8250_DEV_PLATFORM2,
40 PLAT8250_DEV_FOURPORT, 41 PLAT8250_DEV_FOURPORT,
41 PLAT8250_DEV_ACCENT, 42 PLAT8250_DEV_ACCENT,
42 PLAT8250_DEV_BOCA, 43 PLAT8250_DEV_BOCA,
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 4041122dabfc..c32e60e79dea 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -127,6 +127,9 @@
127/* Hilscher netx */ 127/* Hilscher netx */
128#define PORT_NETX 71 128#define PORT_NETX 71
129 129
130/* SUN4V Hypervisor Console */
131#define PORT_SUNHV 72
132
130#ifdef __KERNEL__ 133#ifdef __KERNEL__
131 134
132#include <linux/config.h> 135#include <linux/config.h>
@@ -366,6 +369,9 @@ void uart_parse_options(char *options, int *baud, int *parity, int *bits,
366int uart_set_options(struct uart_port *port, struct console *co, int baud, 369int uart_set_options(struct uart_port *port, struct console *co, int baud,
367 int parity, int bits, int flow); 370 int parity, int bits, int flow);
368struct tty_driver *uart_console_device(struct console *co, int *index); 371struct tty_driver *uart_console_device(struct console *co, int *index);
372void uart_console_write(struct uart_port *port, const char *s,
373 unsigned int count,
374 void (*putchar)(struct uart_port *, int));
369 375
370/* 376/*
371 * Port/driver registration/removal 377 * Port/driver registration/removal
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 582db2392d94..6348e8330897 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -120,7 +120,7 @@ static inline void serio_cleanup(struct serio *serio)
120} 120}
121 121
122/* 122/*
123 * Use the following fucntions to manipulate serio's per-port 123 * Use the following functions to manipulate serio's per-port
124 * driver-specific data. 124 * driver-specific data.
125 */ 125 */
126static inline void *serio_get_drvdata(struct serio *serio) 126static inline void *serio_get_drvdata(struct serio *serio)
@@ -134,7 +134,7 @@ static inline void serio_set_drvdata(struct serio *serio, void *data)
134} 134}
135 135
136/* 136/*
137 * Use the following fucntions to protect critical sections in 137 * Use the following functions to protect critical sections in
138 * driver code from port's interrupt handler 138 * driver code from port's interrupt handler
139 */ 139 */
140static inline void serio_pause_rx(struct serio *serio) 140static inline void serio_pause_rx(struct serio *serio)
@@ -148,7 +148,7 @@ static inline void serio_continue_rx(struct serio *serio)
148} 148}
149 149
150/* 150/*
151 * Use the following fucntions to pin serio's driver in process context 151 * Use the following functions to pin serio's driver in process context
152 */ 152 */
153static inline int serio_pin_driver(struct serio *serio) 153static inline int serio_pin_driver(struct serio *serio)
154{ 154{
diff --git a/include/linux/signal.h b/include/linux/signal.h
index b7d093520bb6..162a8fd10b29 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -249,6 +249,8 @@ static inline void init_sigpending(struct sigpending *sig)
249 INIT_LIST_HEAD(&sig->list); 249 INIT_LIST_HEAD(&sig->list);
250} 250}
251 251
252extern void flush_sigqueue(struct sigpending *queue);
253
252/* Test if 'sig' is valid signal. Use this instead of testing _NSIG directly */ 254/* Test if 'sig' is valid signal. Use this instead of testing _NSIG directly */
253static inline int valid_signal(unsigned long sig) 255static inline int valid_signal(unsigned long sig)
254{ 256{
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ad7cc22bd424..c4619a428d9b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -270,7 +270,6 @@ struct sk_buff {
270 270
271 void (*destructor)(struct sk_buff *skb); 271 void (*destructor)(struct sk_buff *skb);
272#ifdef CONFIG_NETFILTER 272#ifdef CONFIG_NETFILTER
273 __u32 nfmark;
274 struct nf_conntrack *nfct; 273 struct nf_conntrack *nfct;
275#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 274#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
276 struct sk_buff *nfct_reasm; 275 struct sk_buff *nfct_reasm;
@@ -278,6 +277,7 @@ struct sk_buff {
278#ifdef CONFIG_BRIDGE_NETFILTER 277#ifdef CONFIG_BRIDGE_NETFILTER
279 struct nf_bridge_info *nf_bridge; 278 struct nf_bridge_info *nf_bridge;
280#endif 279#endif
280 __u32 nfmark;
281#endif /* CONFIG_NETFILTER */ 281#endif /* CONFIG_NETFILTER */
282#ifdef CONFIG_NET_SCHED 282#ifdef CONFIG_NET_SCHED
283 __u16 tc_index; /* traffic control index */ 283 __u16 tc_index; /* traffic control index */
@@ -304,6 +304,7 @@ struct sk_buff {
304 304
305#include <asm/system.h> 305#include <asm/system.h>
306 306
307extern void kfree_skb(struct sk_buff *skb);
307extern void __kfree_skb(struct sk_buff *skb); 308extern void __kfree_skb(struct sk_buff *skb);
308extern struct sk_buff *__alloc_skb(unsigned int size, 309extern struct sk_buff *__alloc_skb(unsigned int size,
309 gfp_t priority, int fclone); 310 gfp_t priority, int fclone);
@@ -404,22 +405,6 @@ static inline struct sk_buff *skb_get(struct sk_buff *skb)
404 */ 405 */
405 406
406/** 407/**
407 * kfree_skb - free an sk_buff
408 * @skb: buffer to free
409 *
410 * Drop a reference to the buffer and free it if the usage count has
411 * hit zero.
412 */
413static inline void kfree_skb(struct sk_buff *skb)
414{
415 if (likely(atomic_read(&skb->users) == 1))
416 smp_rmb();
417 else if (likely(!atomic_dec_and_test(&skb->users)))
418 return;
419 __kfree_skb(skb);
420}
421
422/**
423 * skb_cloned - is the buffer a clone 408 * skb_cloned - is the buffer a clone
424 * @skb: buffer to check 409 * @skb: buffer to check
425 * 410 *
@@ -956,6 +941,25 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
956#define NET_IP_ALIGN 2 941#define NET_IP_ALIGN 2
957#endif 942#endif
958 943
944/*
945 * The networking layer reserves some headroom in skb data (via
946 * dev_alloc_skb). This is used to avoid having to reallocate skb data when
947 * the header has to grow. In the default case, if the header has to grow
948 * 16 bytes or less we avoid the reallocation.
949 *
950 * Unfortunately this headroom changes the DMA alignment of the resulting
951 * network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive
952 * on some architectures. An architecture can override this value,
953 * perhaps setting it to a cacheline in size (since that will maintain
954 * cacheline alignment of the DMA). It must be a power of 2.
955 *
956 * Various parts of the networking layer expect at least 16 bytes of
957 * headroom, you should not reduce this.
958 */
959#ifndef NET_SKB_PAD
960#define NET_SKB_PAD 16
961#endif
962
959extern int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc); 963extern int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc);
960 964
961static inline void __skb_trim(struct sk_buff *skb, unsigned int len) 965static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
@@ -1045,9 +1049,9 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1045static inline struct sk_buff *__dev_alloc_skb(unsigned int length, 1049static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1046 gfp_t gfp_mask) 1050 gfp_t gfp_mask)
1047{ 1051{
1048 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); 1052 struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
1049 if (likely(skb)) 1053 if (likely(skb))
1050 skb_reserve(skb, 16); 1054 skb_reserve(skb, NET_SKB_PAD);
1051 return skb; 1055 return skb;
1052} 1056}
1053#else 1057#else
@@ -1085,13 +1089,15 @@ static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1085 */ 1089 */
1086static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) 1090static inline int skb_cow(struct sk_buff *skb, unsigned int headroom)
1087{ 1091{
1088 int delta = (headroom > 16 ? headroom : 16) - skb_headroom(skb); 1092 int delta = (headroom > NET_SKB_PAD ? headroom : NET_SKB_PAD) -
1093 skb_headroom(skb);
1089 1094
1090 if (delta < 0) 1095 if (delta < 0)
1091 delta = 0; 1096 delta = 0;
1092 1097
1093 if (delta || skb_cloned(skb)) 1098 if (delta || skb_cloned(skb))
1094 return pskb_expand_head(skb, (delta + 15) & ~15, 0, GFP_ATOMIC); 1099 return pskb_expand_head(skb, (delta + (NET_SKB_PAD-1)) &
1100 ~(NET_SKB_PAD-1), 0, GFP_ATOMIC);
1095 return 0; 1101 return 0;
1096} 1102}
1097 1103
@@ -1174,12 +1180,14 @@ static inline int skb_linearize(struct sk_buff *skb, gfp_t gfp)
1174 */ 1180 */
1175 1181
1176static inline void skb_postpull_rcsum(struct sk_buff *skb, 1182static inline void skb_postpull_rcsum(struct sk_buff *skb,
1177 const void *start, int len) 1183 const void *start, unsigned int len)
1178{ 1184{
1179 if (skb->ip_summed == CHECKSUM_HW) 1185 if (skb->ip_summed == CHECKSUM_HW)
1180 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); 1186 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
1181} 1187}
1182 1188
1189unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
1190
1183/** 1191/**
1184 * pskb_trim_rcsum - trim received skb and update checksum 1192 * pskb_trim_rcsum - trim received skb and update checksum
1185 * @skb: buffer to trim 1193 * @skb: buffer to trim
@@ -1351,16 +1359,6 @@ static inline void nf_conntrack_put_reasm(struct sk_buff *skb)
1351 kfree_skb(skb); 1359 kfree_skb(skb);
1352} 1360}
1353#endif 1361#endif
1354static inline void nf_reset(struct sk_buff *skb)
1355{
1356 nf_conntrack_put(skb->nfct);
1357 skb->nfct = NULL;
1358#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1359 nf_conntrack_put_reasm(skb->nfct_reasm);
1360 skb->nfct_reasm = NULL;
1361#endif
1362}
1363
1364#ifdef CONFIG_BRIDGE_NETFILTER 1362#ifdef CONFIG_BRIDGE_NETFILTER
1365static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge) 1363static inline void nf_bridge_put(struct nf_bridge_info *nf_bridge)
1366{ 1364{
@@ -1373,6 +1371,20 @@ static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
1373 atomic_inc(&nf_bridge->use); 1371 atomic_inc(&nf_bridge->use);
1374} 1372}
1375#endif /* CONFIG_BRIDGE_NETFILTER */ 1373#endif /* CONFIG_BRIDGE_NETFILTER */
1374static inline void nf_reset(struct sk_buff *skb)
1375{
1376 nf_conntrack_put(skb->nfct);
1377 skb->nfct = NULL;
1378#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1379 nf_conntrack_put_reasm(skb->nfct_reasm);
1380 skb->nfct_reasm = NULL;
1381#endif
1382#ifdef CONFIG_BRIDGE_NETFILTER
1383 nf_bridge_put(skb->nf_bridge);
1384 skb->nf_bridge = NULL;
1385#endif
1386}
1387
1376#else /* CONFIG_NETFILTER */ 1388#else /* CONFIG_NETFILTER */
1377static inline void nf_reset(struct sk_buff *skb) {} 1389static inline void nf_reset(struct sk_buff *skb) {}
1378#endif /* CONFIG_NETFILTER */ 1390#endif /* CONFIG_NETFILTER */
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 8cf52939d0ab..3af03b19c983 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -38,7 +38,6 @@ typedef struct kmem_cache kmem_cache_t;
38#define SLAB_DEBUG_INITIAL 0x00000200UL /* Call constructor (as verifier) */ 38#define SLAB_DEBUG_INITIAL 0x00000200UL /* Call constructor (as verifier) */
39#define SLAB_RED_ZONE 0x00000400UL /* Red zone objs in a cache */ 39#define SLAB_RED_ZONE 0x00000400UL /* Red zone objs in a cache */
40#define SLAB_POISON 0x00000800UL /* Poison objects */ 40#define SLAB_POISON 0x00000800UL /* Poison objects */
41#define SLAB_NO_REAP 0x00001000UL /* never reap from the cache */
42#define SLAB_HWCACHE_ALIGN 0x00002000UL /* align objs on a h/w cache lines */ 41#define SLAB_HWCACHE_ALIGN 0x00002000UL /* align objs on a h/w cache lines */
43#define SLAB_CACHE_DMA 0x00004000UL /* use GFP_DMA memory */ 42#define SLAB_CACHE_DMA 0x00004000UL /* use GFP_DMA memory */
44#define SLAB_MUST_HWCACHE_ALIGN 0x00008000UL /* force alignment */ 43#define SLAB_MUST_HWCACHE_ALIGN 0x00008000UL /* force alignment */
@@ -47,6 +46,7 @@ typedef struct kmem_cache kmem_cache_t;
47 what is reclaimable later*/ 46 what is reclaimable later*/
48#define SLAB_PANIC 0x00040000UL /* panic if kmem_cache_create() fails */ 47#define SLAB_PANIC 0x00040000UL /* panic if kmem_cache_create() fails */
49#define SLAB_DESTROY_BY_RCU 0x00080000UL /* defer freeing pages to RCU */ 48#define SLAB_DESTROY_BY_RCU 0x00080000UL /* defer freeing pages to RCU */
49#define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */
50 50
51/* flags passed to a constructor func */ 51/* flags passed to a constructor func */
52#define SLAB_CTOR_CONSTRUCTOR 0x001UL /* if not set, then deconstructor */ 52#define SLAB_CTOR_CONSTRUCTOR 0x001UL /* if not set, then deconstructor */
@@ -64,6 +64,7 @@ extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned lo
64extern int kmem_cache_destroy(kmem_cache_t *); 64extern int kmem_cache_destroy(kmem_cache_t *);
65extern int kmem_cache_shrink(kmem_cache_t *); 65extern int kmem_cache_shrink(kmem_cache_t *);
66extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); 66extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t);
67extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
67extern void kmem_cache_free(kmem_cache_t *, void *); 68extern void kmem_cache_free(kmem_cache_t *, void *);
68extern unsigned int kmem_cache_size(kmem_cache_t *); 69extern unsigned int kmem_cache_size(kmem_cache_t *);
69extern const char *kmem_cache_name(kmem_cache_t *); 70extern const char *kmem_cache_name(kmem_cache_t *);
@@ -77,11 +78,12 @@ struct cache_sizes {
77}; 78};
78extern struct cache_sizes malloc_sizes[]; 79extern struct cache_sizes malloc_sizes[];
79 80
80#ifndef CONFIG_DEBUG_SLAB
81extern void *__kmalloc(size_t, gfp_t); 81extern void *__kmalloc(size_t, gfp_t);
82#ifndef CONFIG_DEBUG_SLAB
83#define ____kmalloc(size, flags) __kmalloc(size, flags)
82#else 84#else
83extern void *__kmalloc_track_caller(size_t, gfp_t, void*); 85extern void *__kmalloc_track_caller(size_t, gfp_t, void*);
84#define __kmalloc(size, flags) \ 86#define ____kmalloc(size, flags) \
85 __kmalloc_track_caller(size, flags, __builtin_return_address(0)) 87 __kmalloc_track_caller(size, flags, __builtin_return_address(0))
86#endif 88#endif
87 89
@@ -108,7 +110,30 @@ found:
108 return __kmalloc(size, flags); 110 return __kmalloc(size, flags);
109} 111}
110 112
111extern void *kzalloc(size_t, gfp_t); 113extern void *__kzalloc(size_t, gfp_t);
114
115static inline void *kzalloc(size_t size, gfp_t flags)
116{
117 if (__builtin_constant_p(size)) {
118 int i = 0;
119#define CACHE(x) \
120 if (size <= x) \
121 goto found; \
122 else \
123 i++;
124#include "kmalloc_sizes.h"
125#undef CACHE
126 {
127 extern void __you_cannot_kzalloc_that_much(void);
128 __you_cannot_kzalloc_that_much();
129 }
130found:
131 return kmem_cache_zalloc((flags & GFP_DMA) ?
132 malloc_sizes[i].cs_dmacachep :
133 malloc_sizes[i].cs_cachep, flags);
134 }
135 return __kzalloc(size, flags);
136}
112 137
113/** 138/**
114 * kcalloc - allocate memory for an array. The memory is set to zero. 139 * kcalloc - allocate memory for an array. The memory is set to zero.
@@ -118,7 +143,7 @@ extern void *kzalloc(size_t, gfp_t);
118 */ 143 */
119static inline void *kcalloc(size_t n, size_t size, gfp_t flags) 144static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
120{ 145{
121 if (n != 0 && size > INT_MAX / n) 146 if (n != 0 && size > ULONG_MAX / n)
122 return NULL; 147 return NULL;
123 return kzalloc(n * size, flags); 148 return kzalloc(n * size, flags);
124} 149}
@@ -155,17 +180,18 @@ struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t,
155 void (*)(void *, struct kmem_cache *, unsigned long)); 180 void (*)(void *, struct kmem_cache *, unsigned long));
156int kmem_cache_destroy(struct kmem_cache *c); 181int kmem_cache_destroy(struct kmem_cache *c);
157void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); 182void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags);
183void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
158void kmem_cache_free(struct kmem_cache *c, void *b); 184void kmem_cache_free(struct kmem_cache *c, void *b);
159const char *kmem_cache_name(struct kmem_cache *); 185const char *kmem_cache_name(struct kmem_cache *);
160void *kmalloc(size_t size, gfp_t flags); 186void *kmalloc(size_t size, gfp_t flags);
161void *kzalloc(size_t size, gfp_t flags); 187void *__kzalloc(size_t size, gfp_t flags);
162void kfree(const void *m); 188void kfree(const void *m);
163unsigned int ksize(const void *m); 189unsigned int ksize(const void *m);
164unsigned int kmem_cache_size(struct kmem_cache *c); 190unsigned int kmem_cache_size(struct kmem_cache *c);
165 191
166static inline void *kcalloc(size_t n, size_t size, gfp_t flags) 192static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
167{ 193{
168 return kzalloc(n * size, flags); 194 return __kzalloc(n * size, flags);
169} 195}
170 196
171#define kmem_cache_shrink(d) (0) 197#define kmem_cache_shrink(d) (0)
@@ -173,6 +199,8 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
173#define kmem_ptr_validate(a, b) (0) 199#define kmem_ptr_validate(a, b) (0)
174#define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f) 200#define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f)
175#define kmalloc_node(s, f, n) kmalloc(s, f) 201#define kmalloc_node(s, f, n) kmalloc(s, f)
202#define kzalloc(s, f) __kzalloc(s, f)
203#define ____kmalloc kmalloc
176 204
177#endif /* CONFIG_SLOB */ 205#endif /* CONFIG_SLOB */
178 206
@@ -182,7 +210,6 @@ extern kmem_cache_t *names_cachep;
182extern kmem_cache_t *files_cachep; 210extern kmem_cache_t *files_cachep;
183extern kmem_cache_t *filp_cachep; 211extern kmem_cache_t *filp_cachep;
184extern kmem_cache_t *fs_cachep; 212extern kmem_cache_t *fs_cachep;
185extern kmem_cache_t *signal_cachep;
186extern kmem_cache_t *sighand_cachep; 213extern kmem_cache_t *sighand_cachep;
187extern kmem_cache_t *bio_cachep; 214extern kmem_cache_t *bio_cachep;
188 215
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 44153fdf73fc..e2fa3ab4afc5 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -52,23 +52,12 @@ extern void smp_cpus_done(unsigned int max_cpus);
52/* 52/*
53 * Call a function on all other processors 53 * Call a function on all other processors
54 */ 54 */
55extern int smp_call_function (void (*func) (void *info), void *info, 55int smp_call_function(void(*func)(void *info), void *info, int retry, int wait);
56 int retry, int wait);
57 56
58/* 57/*
59 * Call a function on all processors 58 * Call a function on all processors
60 */ 59 */
61static inline int on_each_cpu(void (*func) (void *info), void *info, 60int on_each_cpu(void (*func) (void *info), void *info, int retry, int wait);
62 int retry, int wait)
63{
64 int ret = 0;
65
66 preempt_disable();
67 ret = smp_call_function(func, info, retry, wait);
68 func(info);
69 preempt_enable();
70 return ret;
71}
72 61
73#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */ 62#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */
74#define MSG_ALL 0x8001 63#define MSG_ALL 0x8001
@@ -93,8 +82,18 @@ void smp_prepare_boot_cpu(void);
93 */ 82 */
94#define raw_smp_processor_id() 0 83#define raw_smp_processor_id() 0
95#define hard_smp_processor_id() 0 84#define hard_smp_processor_id() 0
96#define smp_call_function(func,info,retry,wait) ({ 0; }) 85static inline int up_smp_call_function(void)
97#define on_each_cpu(func,info,retry,wait) ({ func(info); 0; }) 86{
87 return 0;
88}
89#define smp_call_function(func,info,retry,wait) (up_smp_call_function())
90#define on_each_cpu(func,info,retry,wait) \
91 ({ \
92 local_irq_disable(); \
93 func(info); \
94 local_irq_enable(); \
95 0; \
96 })
98static inline void smp_send_reschedule(int cpu) { } 97static inline void smp_send_reschedule(int cpu) { }
99#define num_booting_cpus() 1 98#define num_booting_cpus() 1
100#define smp_prepare_boot_cpu() do {} while (0) 99#define smp_prepare_boot_cpu() do {} while (0)
diff --git a/include/linux/socket.h b/include/linux/socket.h
index b02dda4ee83d..9ab2ddd80221 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -150,6 +150,7 @@ __KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__
150 150
151#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */ 151#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
152#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */ 152#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */
153#define SCM_SECURITY 0x03 /* rw: security label */
153 154
154struct ucred { 155struct ucred {
155 __u32 pid; 156 __u32 pid;
diff --git a/include/linux/sound.h b/include/linux/sound.h
index 72b9af4c3fd4..f63d8342ffa3 100644
--- a/include/linux/sound.h
+++ b/include/linux/sound.h
@@ -30,12 +30,12 @@
30 */ 30 */
31 31
32struct device; 32struct device;
33extern int register_sound_special(struct file_operations *fops, int unit); 33extern int register_sound_special(const struct file_operations *fops, int unit);
34extern int register_sound_special_device(struct file_operations *fops, int unit, struct device *dev); 34extern int register_sound_special_device(const struct file_operations *fops, int unit, struct device *dev);
35extern int register_sound_mixer(struct file_operations *fops, int dev); 35extern int register_sound_mixer(const struct file_operations *fops, int dev);
36extern int register_sound_midi(struct file_operations *fops, int dev); 36extern int register_sound_midi(const struct file_operations *fops, int dev);
37extern int register_sound_dsp(struct file_operations *fops, int dev); 37extern int register_sound_dsp(const struct file_operations *fops, int dev);
38extern int register_sound_synth(struct file_operations *fops, int dev); 38extern int register_sound_synth(const struct file_operations *fops, int dev);
39 39
40extern void unregister_sound_special(int unit); 40extern void unregister_sound_special(int unit);
41extern void unregister_sound_mixer(int unit); 41extern void unregister_sound_mixer(int unit);
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 8ff2a122dfef..8669291352db 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -69,7 +69,7 @@ struct kstat {
69 struct timespec mtime; 69 struct timespec mtime;
70 struct timespec ctime; 70 struct timespec ctime;
71 unsigned long blksize; 71 unsigned long blksize;
72 unsigned long blocks; 72 unsigned long long blocks;
73}; 73};
74 74
75#endif 75#endif
diff --git a/include/linux/statfs.h b/include/linux/statfs.h
index ad83a2bdb821..b34cc829f98d 100644
--- a/include/linux/statfs.h
+++ b/include/linux/statfs.h
@@ -8,11 +8,11 @@
8struct kstatfs { 8struct kstatfs {
9 long f_type; 9 long f_type;
10 long f_bsize; 10 long f_bsize;
11 sector_t f_blocks; 11 u64 f_blocks;
12 sector_t f_bfree; 12 u64 f_bfree;
13 sector_t f_bavail; 13 u64 f_bavail;
14 sector_t f_files; 14 u64 f_files;
15 sector_t f_ffree; 15 u64 f_ffree;
16 __kernel_fsid_t f_fsid; 16 __kernel_fsid_t f_fsid;
17 long f_namelen; 17 long f_namelen;
18 long f_frsize; 18 long f_frsize;
diff --git a/include/linux/string.h b/include/linux/string.h
index 369be3264a55..dee221429ad0 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -18,6 +18,8 @@ extern char * strsep(char **,const char *);
18extern __kernel_size_t strspn(const char *,const char *); 18extern __kernel_size_t strspn(const char *,const char *);
19extern __kernel_size_t strcspn(const char *,const char *); 19extern __kernel_size_t strcspn(const char *,const char *);
20 20
21extern char *strndup_user(const char __user *, long);
22
21/* 23/*
22 * Include machine specific inline routines 24 * Include machine specific inline routines
23 */ 25 */
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index c4e3ea7cf154..b5612c958cce 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -50,7 +50,7 @@ struct cache_head {
50 time_t last_refresh; /* If CACHE_PENDING, this is when upcall 50 time_t last_refresh; /* If CACHE_PENDING, this is when upcall
51 * was sent, else this is when update was received 51 * was sent, else this is when update was received
52 */ 52 */
53 atomic_t refcnt; 53 struct kref ref;
54 unsigned long flags; 54 unsigned long flags;
55}; 55};
56#define CACHE_VALID 0 /* Entry contains valid data */ 56#define CACHE_VALID 0 /* Entry contains valid data */
@@ -68,8 +68,7 @@ struct cache_detail {
68 atomic_t inuse; /* active user-space update or lookup */ 68 atomic_t inuse; /* active user-space update or lookup */
69 69
70 char *name; 70 char *name;
71 void (*cache_put)(struct cache_head *, 71 void (*cache_put)(struct kref *);
72 struct cache_detail*);
73 72
74 void (*cache_request)(struct cache_detail *cd, 73 void (*cache_request)(struct cache_detail *cd,
75 struct cache_head *h, 74 struct cache_head *h,
@@ -81,6 +80,11 @@ struct cache_detail {
81 struct cache_detail *cd, 80 struct cache_detail *cd,
82 struct cache_head *h); 81 struct cache_head *h);
83 82
83 struct cache_head * (*alloc)(void);
84 int (*match)(struct cache_head *orig, struct cache_head *new);
85 void (*init)(struct cache_head *orig, struct cache_head *new);
86 void (*update)(struct cache_head *orig, struct cache_head *new);
87
84 /* fields below this comment are for internal use 88 /* fields below this comment are for internal use
85 * and should not be touched by cache owners 89 * and should not be touched by cache owners
86 */ 90 */
@@ -123,126 +127,14 @@ struct cache_deferred_req {
123 int too_many); 127 int too_many);
124}; 128};
125 129
126/*
127 * just like a template in C++, this macro does cache lookup
128 * for us.
129 * The function is passed some sort of HANDLE from which a cache_detail
130 * structure can be determined (via SETUP, DETAIL), a template
131 * cache entry (type RTN*), and a "set" flag. Using the HASHFN and the
132 * TEST, the function will try to find a matching cache entry in the cache.
133 * If "set" == 0 :
134 * If an entry is found, it is returned
135 * If no entry is found, a new non-VALID entry is created.
136 * If "set" == 1 and INPLACE == 0 :
137 * If no entry is found a new one is inserted with data from "template"
138 * If a non-CACHE_VALID entry is found, it is updated from template using UPDATE
139 * If a CACHE_VALID entry is found, a new entry is swapped in with data
140 * from "template"
141 * If set == 1, and INPLACE == 1 :
142 * As above, except that if a CACHE_VALID entry is found, we UPDATE in place
143 * instead of swapping in a new entry.
144 *
145 * If the passed handle has the CACHE_NEGATIVE flag set, then UPDATE is not
146 * run but insteead CACHE_NEGATIVE is set in any new item.
147 130
148 * In any case, the new entry is returned with a reference count. 131extern struct cache_head *
149 * 132sunrpc_cache_lookup(struct cache_detail *detail,
150 * 133 struct cache_head *key, int hash);
151 * RTN is a struct type for a cache entry 134extern struct cache_head *
152 * MEMBER is the member of the cache which is cache_head, which must be first 135sunrpc_cache_update(struct cache_detail *detail,
153 * FNAME is the name for the function 136 struct cache_head *new, struct cache_head *old, int hash);
154 * ARGS are arguments to function and must contain RTN *item, int set. May
155 * also contain something to be usedby SETUP or DETAIL to find cache_detail.
156 * SETUP locates the cache detail and makes it available as...
157 * DETAIL identifies the cache detail, possibly set up by SETUP
158 * HASHFN returns a hash value of the cache entry "item"
159 * TEST tests if "tmp" matches "item"
160 * INIT copies key information from "item" to "new"
161 * UPDATE copies content information from "item" to "tmp"
162 * INPLACE is true if updates can happen inplace rather than allocating a new structure
163 *
164 * WARNING: any substantial changes to this must be reflected in
165 * net/sunrpc/svcauth.c(auth_domain_lookup)
166 * which is a similar routine that is open-coded.
167 */
168#define DefineCacheLookup(RTN,MEMBER,FNAME,ARGS,SETUP,DETAIL,HASHFN,TEST,INIT,UPDATE,INPLACE) \
169RTN *FNAME ARGS \
170{ \
171 RTN *tmp, *new=NULL; \
172 struct cache_head **hp, **head; \
173 SETUP; \
174 head = &(DETAIL)->hash_table[HASHFN]; \
175 retry: \
176 if (set||new) write_lock(&(DETAIL)->hash_lock); \
177 else read_lock(&(DETAIL)->hash_lock); \
178 for(hp=head; *hp != NULL; hp = &tmp->MEMBER.next) { \
179 tmp = container_of(*hp, RTN, MEMBER); \
180 if (TEST) { /* found a match */ \
181 \
182 if (set && !INPLACE && test_bit(CACHE_VALID, &tmp->MEMBER.flags) && !new) \
183 break; \
184 \
185 if (new) \
186 {INIT;} \
187 if (set) { \
188 if (!INPLACE && test_bit(CACHE_VALID, &tmp->MEMBER.flags))\
189 { /* need to swap in new */ \
190 RTN *t2; \
191 \
192 new->MEMBER.next = tmp->MEMBER.next; \
193 *hp = &new->MEMBER; \
194 tmp->MEMBER.next = NULL; \
195 t2 = tmp; tmp = new; new = t2; \
196 } \
197 if (test_bit(CACHE_NEGATIVE, &item->MEMBER.flags)) \
198 set_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags); \
199 else { \
200 UPDATE; \
201 clear_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags); \
202 } \
203 } \
204 cache_get(&tmp->MEMBER); \
205 if (set||new) write_unlock(&(DETAIL)->hash_lock); \
206 else read_unlock(&(DETAIL)->hash_lock); \
207 if (set) \
208 cache_fresh(DETAIL, &tmp->MEMBER, item->MEMBER.expiry_time); \
209 if (set && !INPLACE && new) cache_fresh(DETAIL, &new->MEMBER, 0); \
210 if (new) (DETAIL)->cache_put(&new->MEMBER, DETAIL); \
211 return tmp; \
212 } \
213 } \
214 /* Didn't find anything */ \
215 if (new) { \
216 INIT; \
217 new->MEMBER.next = *head; \
218 *head = &new->MEMBER; \
219 (DETAIL)->entries ++; \
220 cache_get(&new->MEMBER); \
221 if (set) { \
222 tmp = new; \
223 if (test_bit(CACHE_NEGATIVE, &item->MEMBER.flags)) \
224 set_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags); \
225 else {UPDATE;} \
226 } \
227 } \
228 if (set||new) write_unlock(&(DETAIL)->hash_lock); \
229 else read_unlock(&(DETAIL)->hash_lock); \
230 if (new && set) \
231 cache_fresh(DETAIL, &new->MEMBER, item->MEMBER.expiry_time); \
232 if (new) \
233 return new; \
234 new = kmalloc(sizeof(*new), GFP_KERNEL); \
235 if (new) { \
236 cache_init(&new->MEMBER); \
237 goto retry; \
238 } \
239 return NULL; \
240}
241 137
242#define DefineSimpleCacheLookup(STRUCT,INPLACE) \
243 DefineCacheLookup(struct STRUCT, h, STRUCT##_lookup, (struct STRUCT *item, int set), /*no setup */, \
244 & STRUCT##_cache, STRUCT##_hash(item), STRUCT##_match(item, tmp),\
245 STRUCT##_init(new, item), STRUCT##_update(tmp, item),INPLACE)
246 138
247#define cache_for_each(pos, detail, index, member) \ 139#define cache_for_each(pos, detail, index, member) \
248 for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ; \ 140 for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ; \
@@ -258,22 +150,19 @@ extern void cache_clean_deferred(void *owner);
258 150
259static inline struct cache_head *cache_get(struct cache_head *h) 151static inline struct cache_head *cache_get(struct cache_head *h)
260{ 152{
261 atomic_inc(&h->refcnt); 153 kref_get(&h->ref);
262 return h; 154 return h;
263} 155}
264 156
265 157
266static inline int cache_put(struct cache_head *h, struct cache_detail *cd) 158static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
267{ 159{
268 if (atomic_read(&h->refcnt) <= 2 && 160 if (atomic_read(&h->ref.refcount) <= 2 &&
269 h->expiry_time < cd->nextcheck) 161 h->expiry_time < cd->nextcheck)
270 cd->nextcheck = h->expiry_time; 162 cd->nextcheck = h->expiry_time;
271 return atomic_dec_and_test(&h->refcnt); 163 kref_put(&h->ref, cd->cache_put);
272} 164}
273 165
274extern void cache_init(struct cache_head *h);
275extern void cache_fresh(struct cache_detail *detail,
276 struct cache_head *head, time_t expiry);
277extern int cache_check(struct cache_detail *detail, 166extern int cache_check(struct cache_detail *detail,
278 struct cache_head *h, struct cache_req *rqstp); 167 struct cache_head *h, struct cache_req *rqstp);
279extern void cache_flush(void); 168extern void cache_flush(void);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index f147e6b84332..8fe9f35eba31 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -45,7 +45,8 @@ struct rpc_clnt {
45 char * cl_server; /* server machine name */ 45 char * cl_server; /* server machine name */
46 char * cl_protname; /* protocol name */ 46 char * cl_protname; /* protocol name */
47 struct rpc_auth * cl_auth; /* authenticator */ 47 struct rpc_auth * cl_auth; /* authenticator */
48 struct rpc_stat * cl_stats; /* statistics */ 48 struct rpc_stat * cl_stats; /* per-program statistics */
49 struct rpc_iostats * cl_metrics; /* per-client statistics */
49 50
50 unsigned int cl_softrtry : 1,/* soft timeouts */ 51 unsigned int cl_softrtry : 1,/* soft timeouts */
51 cl_intr : 1,/* interruptible */ 52 cl_intr : 1,/* interruptible */
@@ -59,6 +60,7 @@ struct rpc_clnt {
59 int cl_nodelen; /* nodename length */ 60 int cl_nodelen; /* nodename length */
60 char cl_nodename[UNX_MAXNODENAME]; 61 char cl_nodename[UNX_MAXNODENAME];
61 char cl_pathname[30];/* Path in rpc_pipe_fs */ 62 char cl_pathname[30];/* Path in rpc_pipe_fs */
63 struct vfsmount * cl_vfsmnt;
62 struct dentry * cl_dentry; /* inode */ 64 struct dentry * cl_dentry; /* inode */
63 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 65 struct rpc_clnt * cl_parent; /* Points to parent of clones */
64 struct rpc_rtt cl_rtt_default; 66 struct rpc_rtt cl_rtt_default;
@@ -100,6 +102,8 @@ struct rpc_procinfo {
100 unsigned int p_bufsiz; /* req. buffer size */ 102 unsigned int p_bufsiz; /* req. buffer size */
101 unsigned int p_count; /* call count */ 103 unsigned int p_count; /* call count */
102 unsigned int p_timer; /* Which RTT timer to use */ 104 unsigned int p_timer; /* Which RTT timer to use */
105 u32 p_statidx; /* Which procedure to account */
106 char * p_name; /* name of procedure */
103}; 107};
104 108
105#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt)) 109#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt))
@@ -137,20 +141,6 @@ size_t rpc_max_payload(struct rpc_clnt *);
137void rpc_force_rebind(struct rpc_clnt *); 141void rpc_force_rebind(struct rpc_clnt *);
138int rpc_ping(struct rpc_clnt *clnt, int flags); 142int rpc_ping(struct rpc_clnt *clnt, int flags);
139 143
140static __inline__
141int rpc_call(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags)
142{
143 struct rpc_message msg = {
144 .rpc_proc = &clnt->cl_procinfo[proc],
145 .rpc_argp = argp,
146 .rpc_resp = resp,
147 .rpc_cred = NULL
148 };
149 return rpc_call_sync(clnt, &msg, flags);
150}
151
152extern void rpciod_wake_up(void);
153
154/* 144/*
155 * Helper function for NFSroot support 145 * Helper function for NFSroot support
156 */ 146 */
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index 2c3601d31045..1279280d7196 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -53,6 +53,8 @@ struct krb5_ctx {
53 struct xdr_netobj mech_used; 53 struct xdr_netobj mech_used;
54}; 54};
55 55
56extern spinlock_t krb5_seq_lock;
57
56#define KG_TOK_MIC_MSG 0x0101 58#define KG_TOK_MIC_MSG 0x0101
57#define KG_TOK_WRAP_MSG 0x0201 59#define KG_TOK_WRAP_MSG 0x0201
58 60
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
new file mode 100644
index 000000000000..8f96e9dc369a
--- /dev/null
+++ b/include/linux/sunrpc/metrics.h
@@ -0,0 +1,77 @@
1/*
2 * linux/include/linux/sunrpc/metrics.h
3 *
4 * Declarations for RPC client per-operation metrics
5 *
6 * Copyright (C) 2005 Chuck Lever <cel@netapp.com>
7 *
8 * RPC client per-operation statistics provide latency and retry
9 * information about each type of RPC procedure in a given RPC program.
10 * These statistics are not for detailed problem diagnosis, but simply
11 * to indicate whether the problem is local or remote.
12 *
13 * These counters are not meant to be human-readable, but are meant to be
14 * integrated into system monitoring tools such as "sar" and "iostat". As
15 * such, the counters are sampled by the tools over time, and are never
16 * zeroed after a file system is mounted. Moving averages can be computed
17 * by the tools by taking the difference between two instantaneous samples
18 * and dividing that by the time between the samples.
19 *
20 * The counters are maintained in a single array per RPC client, indexed
21 * by procedure number. There is no need to maintain separate counter
22 * arrays per-CPU because these counters are always modified behind locks.
23 */
24
25#ifndef _LINUX_SUNRPC_METRICS_H
26#define _LINUX_SUNRPC_METRICS_H
27
28#include <linux/seq_file.h>
29
30#define RPC_IOSTATS_VERS "1.0"
31
32struct rpc_iostats {
33 /*
34 * These counters give an idea about how many request
35 * transmissions are required, on average, to complete that
36 * particular procedure. Some procedures may require more
37 * than one transmission because the server is unresponsive,
38 * the client is retransmitting too aggressively, or the
39 * requests are large and the network is congested.
40 */
41 unsigned long om_ops, /* count of operations */
42 om_ntrans, /* count of RPC transmissions */
43 om_timeouts; /* count of major timeouts */
44
45 /*
46 * These count how many bytes are sent and received for a
47 * given RPC procedure type. This indicates how much load a
48 * particular procedure is putting on the network. These
49 * counts include the RPC and ULP headers, and the request
50 * payload.
51 */
52 unsigned long long om_bytes_sent, /* count of bytes out */
53 om_bytes_recv; /* count of bytes in */
54
55 /*
56 * The length of time an RPC request waits in queue before
57 * transmission, the network + server latency of the request,
58 * and the total time the request spent from init to release
59 * are measured.
60 */
61 unsigned long long om_queue, /* jiffies queued for xmit */
62 om_rtt, /* jiffies for RPC RTT */
63 om_execute; /* jiffies for RPC execution */
64} ____cacheline_aligned;
65
66struct rpc_task;
67struct rpc_clnt;
68
69/*
70 * EXPORTed functions for managing rpc_iostats structures
71 */
72struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *);
73void rpc_count_iostats(struct rpc_task *);
74void rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
75void rpc_free_iostats(struct rpc_iostats *);
76
77#endif /* _LINUX_SUNRPC_METRICS_H */
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 63929349571f..2c2189cb30aa 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -45,6 +45,8 @@ extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
45extern int rpc_rmdir(char *); 45extern int rpc_rmdir(char *);
46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); 46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags);
47extern int rpc_unlink(char *); 47extern int rpc_unlink(char *);
48extern struct vfsmount *rpc_get_mount(void);
49extern void rpc_put_mount(void);
48 50
49#endif 51#endif
50#endif 52#endif
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 8b25629accd8..82a91bb22362 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -86,6 +86,12 @@ struct rpc_task {
86 struct work_struct tk_work; /* Async task work queue */ 86 struct work_struct tk_work; /* Async task work queue */
87 struct rpc_wait tk_wait; /* RPC wait */ 87 struct rpc_wait tk_wait; /* RPC wait */
88 } u; 88 } u;
89
90 unsigned short tk_timeouts; /* maj timeouts */
91 size_t tk_bytes_sent; /* total bytes sent */
92 unsigned long tk_start; /* RPC task init timestamp */
93 long tk_rtt; /* round-trip time (jiffies) */
94
89#ifdef RPC_DEBUG 95#ifdef RPC_DEBUG
90 unsigned short tk_pid; /* debugging aid */ 96 unsigned short tk_pid; /* debugging aid */
91#endif 97#endif
@@ -203,6 +209,7 @@ struct rpc_wait_queue {
203 unsigned char priority; /* current priority */ 209 unsigned char priority; /* current priority */
204 unsigned char count; /* # task groups remaining serviced so far */ 210 unsigned char count; /* # task groups remaining serviced so far */
205 unsigned char nr; /* # tasks remaining for cookie */ 211 unsigned char nr; /* # tasks remaining for cookie */
212 unsigned short qlen; /* total # tasks waiting in queue */
206#ifdef RPC_DEBUG 213#ifdef RPC_DEBUG
207 const char * name; 214 const char * name;
208#endif 215#endif
@@ -269,13 +276,13 @@ void * rpc_malloc(struct rpc_task *, size_t);
269void rpc_free(struct rpc_task *); 276void rpc_free(struct rpc_task *);
270int rpciod_up(void); 277int rpciod_up(void);
271void rpciod_down(void); 278void rpciod_down(void);
272void rpciod_wake_up(void);
273int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); 279int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
274#ifdef RPC_DEBUG 280#ifdef RPC_DEBUG
275void rpc_show_tasks(void); 281void rpc_show_tasks(void);
276#endif 282#endif
277int rpc_init_mempool(void); 283int rpc_init_mempool(void);
278void rpc_destroy_mempool(void); 284void rpc_destroy_mempool(void);
285extern struct workqueue_struct *rpciod_workqueue;
279 286
280static inline void rpc_exit(struct rpc_task *task, int status) 287static inline void rpc_exit(struct rpc_task *task, int status)
281{ 288{
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h
index 0d6ed3c8bdc4..d93c24b47f3f 100644
--- a/include/linux/sunrpc/stats.h
+++ b/include/linux/sunrpc/stats.h
@@ -50,7 +50,7 @@ struct proc_dir_entry * rpc_proc_register(struct rpc_stat *);
50void rpc_proc_unregister(const char *); 50void rpc_proc_unregister(const char *);
51void rpc_proc_zero(struct rpc_program *); 51void rpc_proc_zero(struct rpc_program *);
52struct proc_dir_entry * svc_proc_register(struct svc_stat *, 52struct proc_dir_entry * svc_proc_register(struct svc_stat *,
53 struct file_operations *); 53 const struct file_operations *);
54void svc_proc_unregister(const char *); 54void svc_proc_unregister(const char *);
55 55
56void svc_seq_show(struct seq_file *, 56void svc_seq_show(struct seq_file *,
@@ -65,7 +65,7 @@ static inline void rpc_proc_unregister(const char *p) {}
65static inline void rpc_proc_zero(struct rpc_program *p) {} 65static inline void rpc_proc_zero(struct rpc_program *p) {}
66 66
67static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, 67static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s,
68 struct file_operations *f) { return NULL; } 68 const struct file_operations *f) { return NULL; }
69static inline void svc_proc_unregister(const char *p) {} 69static inline void svc_proc_unregister(const char *p) {}
70 70
71static inline void svc_seq_show(struct seq_file *seq, 71static inline void svc_seq_show(struct seq_file *seq,
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index c119ce7cbd22..2fe2087edd66 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -45,9 +45,10 @@ struct svc_rqst; /* forward decl */
45 * of ip addresses to the given client. 45 * of ip addresses to the given client.
46 */ 46 */
47struct auth_domain { 47struct auth_domain {
48 struct cache_head h; 48 struct kref ref;
49 struct hlist_node hash;
49 char *name; 50 char *name;
50 int flavour; 51 struct auth_ops *flavour;
51}; 52};
52 53
53/* 54/*
@@ -86,6 +87,9 @@ struct auth_domain {
86 * 87 *
87 * domain_release() 88 * domain_release()
88 * This call releases a domain. 89 * This call releases a domain.
90 * set_client()
91 * Givens a pending request (struct svc_rqst), finds and assigns
92 * an appropriate 'auth_domain' as the client.
89 */ 93 */
90struct auth_ops { 94struct auth_ops {
91 char * name; 95 char * name;
@@ -117,7 +121,7 @@ extern void svc_auth_unregister(rpc_authflavor_t flavor);
117extern struct auth_domain *unix_domain_find(char *name); 121extern struct auth_domain *unix_domain_find(char *name);
118extern void auth_domain_put(struct auth_domain *item); 122extern void auth_domain_put(struct auth_domain *item);
119extern int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom); 123extern int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom);
120extern struct auth_domain *auth_domain_lookup(struct auth_domain *item, int set); 124extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new);
121extern struct auth_domain *auth_domain_find(char *name); 125extern struct auth_domain *auth_domain_find(char *name);
122extern struct auth_domain *auth_unix_lookup(struct in_addr addr); 126extern struct auth_domain *auth_unix_lookup(struct in_addr addr);
123extern int auth_unix_forget_old(struct auth_domain *dom); 127extern int auth_unix_forget_old(struct auth_domain *dom);
@@ -160,8 +164,6 @@ static inline unsigned long hash_mem(char *buf, int length, int bits)
160 return hash >> (BITS_PER_LONG - bits); 164 return hash >> (BITS_PER_LONG - bits);
161} 165}
162 166
163extern struct cache_detail auth_domain_cache, ip_map_cache;
164
165#endif /* __KERNEL__ */ 167#endif /* __KERNEL__ */
166 168
167#endif /* _LINUX_SUNRPC_SVCAUTH_H_ */ 169#endif /* _LINUX_SUNRPC_SVCAUTH_H_ */
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index d33c6face032..b4acb3d37c3f 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -36,7 +36,7 @@ struct svc_sock {
36 36
37 struct list_head sk_deferred; /* deferred requests that need to 37 struct list_head sk_deferred; /* deferred requests that need to
38 * be revisted */ 38 * be revisted */
39 struct semaphore sk_sem; /* to serialize sending data */ 39 struct mutex sk_mutex; /* to serialize sending data */
40 40
41 int (*sk_recvfrom)(struct svc_rqst *rqstp); 41 int (*sk_recvfrom)(struct svc_rqst *rqstp);
42 int (*sk_sendto)(struct svc_rqst *rqstp); 42 int (*sk_sendto)(struct svc_rqst *rqstp);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 6ef99b14ff09..7eebbab7160b 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -114,6 +114,7 @@ struct rpc_xprt_ops {
114 void (*release_request)(struct rpc_task *task); 114 void (*release_request)(struct rpc_task *task);
115 void (*close)(struct rpc_xprt *xprt); 115 void (*close)(struct rpc_xprt *xprt);
116 void (*destroy)(struct rpc_xprt *xprt); 116 void (*destroy)(struct rpc_xprt *xprt);
117 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq);
117}; 118};
118 119
119struct rpc_xprt { 120struct rpc_xprt {
@@ -187,6 +188,18 @@ struct rpc_xprt {
187 188
188 struct list_head recv; 189 struct list_head recv;
189 190
191 struct {
192 unsigned long bind_count, /* total number of binds */
193 connect_count, /* total number of connects */
194 connect_start, /* connect start timestamp */
195 connect_time, /* jiffies waiting for connect */
196 sends, /* how many complete requests */
197 recvs, /* how many complete requests */
198 bad_xids; /* lookup_rqst didn't find XID */
199
200 unsigned long long req_u, /* average requests on the wire */
201 bklog_u; /* backlog queue utilization */
202 } stat;
190 203
191 void (*old_data_ready)(struct sock *, int); 204 void (*old_data_ready)(struct sock *, int);
192 void (*old_state_change)(struct sock *); 205 void (*old_state_change)(struct sock *);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index d572b19afb7d..54eac8a39a4c 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -172,9 +172,24 @@ extern int rotate_reclaimable_page(struct page *page);
172extern void swap_setup(void); 172extern void swap_setup(void);
173 173
174/* linux/mm/vmscan.c */ 174/* linux/mm/vmscan.c */
175extern int try_to_free_pages(struct zone **, gfp_t); 175extern unsigned long try_to_free_pages(struct zone **, gfp_t);
176extern int shrink_all_memory(int); 176extern unsigned long shrink_all_memory(unsigned long nr_pages);
177extern int vm_swappiness; 177extern int vm_swappiness;
178extern int remove_mapping(struct address_space *mapping, struct page *page);
179
180/* possible outcome of pageout() */
181typedef enum {
182 /* failed to write page out, page is locked */
183 PAGE_KEEP,
184 /* move page to the active list, page is locked */
185 PAGE_ACTIVATE,
186 /* page has been sent to the disk successfully, page is unlocked */
187 PAGE_SUCCESS,
188 /* page is clean and locked */
189 PAGE_CLEAN,
190} pageout_t;
191
192extern pageout_t pageout(struct page *page, struct address_space *mapping);
178 193
179#ifdef CONFIG_NUMA 194#ifdef CONFIG_NUMA
180extern int zone_reclaim_mode; 195extern int zone_reclaim_mode;
@@ -188,25 +203,6 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
188} 203}
189#endif 204#endif
190 205
191#ifdef CONFIG_MIGRATION
192extern int isolate_lru_page(struct page *p);
193extern int putback_lru_pages(struct list_head *l);
194extern int migrate_page(struct page *, struct page *);
195extern void migrate_page_copy(struct page *, struct page *);
196extern int migrate_page_remove_references(struct page *, struct page *, int);
197extern int migrate_pages(struct list_head *l, struct list_head *t,
198 struct list_head *moved, struct list_head *failed);
199extern int fail_migrate_page(struct page *, struct page *);
200#else
201static inline int isolate_lru_page(struct page *p) { return -ENOSYS; }
202static inline int putback_lru_pages(struct list_head *l) { return 0; }
203static inline int migrate_pages(struct list_head *l, struct list_head *t,
204 struct list_head *moved, struct list_head *failed) { return -ENOSYS; }
205/* Possible settings for the migrate_page() method in address_operations */
206#define migrate_page NULL
207#define fail_migrate_page NULL
208#endif
209
210#ifdef CONFIG_MMU 206#ifdef CONFIG_MMU
211/* linux/mm/shmem.c */ 207/* linux/mm/shmem.c */
212extern int shmem_unuse(swp_entry_t entry, struct page *page); 208extern int shmem_unuse(swp_entry_t entry, struct page *page);
@@ -238,14 +234,15 @@ extern struct page * read_swap_cache_async(swp_entry_t, struct vm_area_struct *v
238/* linux/mm/swapfile.c */ 234/* linux/mm/swapfile.c */
239extern long total_swap_pages; 235extern long total_swap_pages;
240extern unsigned int nr_swapfiles; 236extern unsigned int nr_swapfiles;
241extern struct swap_info_struct swap_info[];
242extern void si_swapinfo(struct sysinfo *); 237extern void si_swapinfo(struct sysinfo *);
243extern swp_entry_t get_swap_page(void); 238extern swp_entry_t get_swap_page(void);
244extern swp_entry_t get_swap_page_of_type(int type); 239extern swp_entry_t get_swap_page_of_type(int);
245extern int swap_duplicate(swp_entry_t); 240extern int swap_duplicate(swp_entry_t);
246extern int valid_swaphandles(swp_entry_t, unsigned long *); 241extern int valid_swaphandles(swp_entry_t, unsigned long *);
247extern void swap_free(swp_entry_t); 242extern void swap_free(swp_entry_t);
248extern void free_swap_and_cache(swp_entry_t); 243extern void free_swap_and_cache(swp_entry_t);
244extern int swap_type_of(dev_t);
245extern unsigned int count_swap_pages(int, int);
249extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); 246extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t);
250extern struct swap_info_struct *get_swap_info_struct(unsigned); 247extern struct swap_info_struct *get_swap_info_struct(unsigned);
251extern int can_share_swap_page(struct page *); 248extern int can_share_swap_page(struct page *);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 1b7cd8d1a71b..2993302f7923 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.10 2005/11/08 19:50:54 paulkf Exp $ 4 * $Id: synclink.h,v 3.11 2006/02/06 21:20:29 paulkf Exp $
5 * 5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation 6 * Copyright (C) 1998-2000 by Microgate Corporation
7 * 7 *
@@ -221,6 +221,12 @@ struct mgsl_icount {
221 __u32 rxidle; 221 __u32 rxidle;
222}; 222};
223 223
224struct gpio_desc {
225 __u32 state;
226 __u32 smask;
227 __u32 dir;
228 __u32 dmask;
229};
224 230
225#define DEBUG_LEVEL_DATA 1 231#define DEBUG_LEVEL_DATA 1
226#define DEBUG_LEVEL_ERROR 2 232#define DEBUG_LEVEL_ERROR 2
@@ -276,5 +282,8 @@ struct mgsl_icount {
276#define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9) 282#define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9)
277#define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10) 283#define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10)
278#define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11) 284#define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11)
285#define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc)
286#define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc)
287#define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc)
279 288
280#endif /* _SYNCLINK_H_ */ 289#endif /* _SYNCLINK_H_ */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index b9ea44ac0ddb..5717147596b6 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -568,5 +568,10 @@ asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
568 int flag); 568 int flag);
569asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 569asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
570 int flags, int mode); 570 int flags, int mode);
571asmlinkage long sys_unshare(unsigned long unshare_flags);
572asmlinkage long sys_splice(int fdin, int fdout, size_t len,
573 unsigned int flags);
574asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
575 int flags);
571 576
572#endif 577#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index bac61db26456..76eaeff76f82 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -211,6 +211,7 @@ enum
211 NET_SCTP=17, 211 NET_SCTP=17,
212 NET_LLC=18, 212 NET_LLC=18,
213 NET_NETFILTER=19, 213 NET_NETFILTER=19,
214 NET_DCCP=20,
214}; 215};
215 216
216/* /proc/sys/kernel/random */ 217/* /proc/sys/kernel/random */
@@ -261,6 +262,8 @@ enum
261 NET_CORE_DEV_WEIGHT=17, 262 NET_CORE_DEV_WEIGHT=17,
262 NET_CORE_SOMAXCONN=18, 263 NET_CORE_SOMAXCONN=18,
263 NET_CORE_BUDGET=19, 264 NET_CORE_BUDGET=19,
265 NET_CORE_AEVENT_ETIME=20,
266 NET_CORE_AEVENT_RSEQTH=21,
264}; 267};
265 268
266/* /proc/sys/net/ethernet */ 269/* /proc/sys/net/ethernet */
@@ -397,6 +400,9 @@ enum
397 NET_TCP_CONG_CONTROL=110, 400 NET_TCP_CONG_CONTROL=110,
398 NET_TCP_ABC=111, 401 NET_TCP_ABC=111,
399 NET_IPV4_IPFRAG_MAX_DIST=112, 402 NET_IPV4_IPFRAG_MAX_DIST=112,
403 NET_TCP_MTU_PROBING=113,
404 NET_TCP_BASE_MSS=114,
405 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
400}; 406};
401 407
402enum { 408enum {
@@ -451,6 +457,7 @@ enum
451 NET_IPV4_CONF_ARP_ANNOUNCE=18, 457 NET_IPV4_CONF_ARP_ANNOUNCE=18,
452 NET_IPV4_CONF_ARP_IGNORE=19, 458 NET_IPV4_CONF_ARP_IGNORE=19,
453 NET_IPV4_CONF_PROMOTE_SECONDARIES=20, 459 NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
460 NET_IPV4_CONF_ARP_ACCEPT=21,
454 __NET_IPV4_CONF_MAX 461 __NET_IPV4_CONF_MAX
455}; 462};
456 463
@@ -531,6 +538,11 @@ enum {
531 NET_IPV6_MAX_DESYNC_FACTOR=15, 538 NET_IPV6_MAX_DESYNC_FACTOR=15,
532 NET_IPV6_MAX_ADDRESSES=16, 539 NET_IPV6_MAX_ADDRESSES=16,
533 NET_IPV6_FORCE_MLD_VERSION=17, 540 NET_IPV6_FORCE_MLD_VERSION=17,
541 NET_IPV6_ACCEPT_RA_DEFRTR=18,
542 NET_IPV6_ACCEPT_RA_PINFO=19,
543 NET_IPV6_ACCEPT_RA_RTR_PREF=20,
544 NET_IPV6_RTR_PROBE_INTERVAL=21,
545 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
534 __NET_IPV6_MAX 546 __NET_IPV6_MAX
535}; 547};
536 548
@@ -562,6 +574,21 @@ enum {
562 __NET_NEIGH_MAX 574 __NET_NEIGH_MAX
563}; 575};
564 576
577/* /proc/sys/net/dccp */
578enum {
579 NET_DCCP_DEFAULT=1,
580};
581
582/* /proc/sys/net/dccp/default */
583enum {
584 NET_DCCP_DEFAULT_SEQ_WINDOW = 1,
585 NET_DCCP_DEFAULT_RX_CCID = 2,
586 NET_DCCP_DEFAULT_TX_CCID = 3,
587 NET_DCCP_DEFAULT_ACK_RATIO = 4,
588 NET_DCCP_DEFAULT_SEND_ACKVEC = 5,
589 NET_DCCP_DEFAULT_SEND_NDP = 6,
590};
591
565/* /proc/sys/net/ipx */ 592/* /proc/sys/net/ipx */
566enum { 593enum {
567 NET_IPX_PPROP_BROADCASTING=1, 594 NET_IPX_PPROP_BROADCASTING=1,
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index f2bb2396853f..542d39596bd8 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -343,6 +343,12 @@ struct tcp_sock {
343 __u32 seq; 343 __u32 seq;
344 __u32 time; 344 __u32 time;
345 } rcvq_space; 345 } rcvq_space;
346
347/* TCP-specific MTU probe information. */
348 struct {
349 __u32 probe_seq_start;
350 __u32 probe_seq_end;
351 } mtu_probe;
346}; 352};
347 353
348static inline struct tcp_sock *tcp_sk(const struct sock *sk) 354static inline struct tcp_sock *tcp_sk(const struct sock *sk)
diff --git a/include/linux/threads.h b/include/linux/threads.h
index b59738ac6197..e646bcdf2614 100644
--- a/include/linux/threads.h
+++ b/include/linux/threads.h
@@ -28,7 +28,8 @@
28#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000) 28#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)
29 29
30/* 30/*
31 * A maximum of 4 million PIDs should be enough for a while: 31 * A maximum of 4 million PIDs should be enough for a while.
32 * [NOTE: PID/TIDs are limited to 2^29 ~= 500+ million, see futex.h.]
32 */ 33 */
33#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \ 34#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
34 (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT)) 35 (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
diff --git a/include/linux/time.h b/include/linux/time.h
index d9cdba54b789..0cd696cee998 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -73,12 +73,6 @@ extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
73#define timespec_valid(ts) \ 73#define timespec_valid(ts) \
74 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) 74 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC))
75 75
76/*
77 * 64-bit nanosec type. Large enough to span 292+ years in nanosecond
78 * resolution. Ought to be enough for a while.
79 */
80typedef s64 nsec_t;
81
82extern struct timespec xtime; 76extern struct timespec xtime;
83extern struct timespec wall_to_monotonic; 77extern struct timespec wall_to_monotonic;
84extern seqlock_t xtime_lock; 78extern seqlock_t xtime_lock;
@@ -101,6 +95,7 @@ extern long do_utimes(int dfd, char __user *filename, struct timeval *times);
101struct itimerval; 95struct itimerval;
102extern int do_setitimer(int which, struct itimerval *value, 96extern int do_setitimer(int which, struct itimerval *value,
103 struct itimerval *ovalue); 97 struct itimerval *ovalue);
98extern unsigned int alarm_setitimer(unsigned int seconds);
104extern int do_getitimer(int which, struct itimerval *value); 99extern int do_getitimer(int which, struct itimerval *value);
105extern void getnstimeofday(struct timespec *tv); 100extern void getnstimeofday(struct timespec *tv);
106 101
@@ -113,9 +108,9 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
113 * Returns the scalar nanosecond representation of the timespec 108 * Returns the scalar nanosecond representation of the timespec
114 * parameter. 109 * parameter.
115 */ 110 */
116static inline nsec_t timespec_to_ns(const struct timespec *ts) 111static inline s64 timespec_to_ns(const struct timespec *ts)
117{ 112{
118 return ((nsec_t) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; 113 return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
119} 114}
120 115
121/** 116/**
@@ -125,9 +120,9 @@ static inline nsec_t timespec_to_ns(const struct timespec *ts)
125 * Returns the scalar nanosecond representation of the timeval 120 * Returns the scalar nanosecond representation of the timeval
126 * parameter. 121 * parameter.
127 */ 122 */
128static inline nsec_t timeval_to_ns(const struct timeval *tv) 123static inline s64 timeval_to_ns(const struct timeval *tv)
129{ 124{
130 return ((nsec_t) tv->tv_sec * NSEC_PER_SEC) + 125 return ((s64) tv->tv_sec * NSEC_PER_SEC) +
131 tv->tv_usec * NSEC_PER_USEC; 126 tv->tv_usec * NSEC_PER_USEC;
132} 127}
133 128
@@ -137,7 +132,7 @@ static inline nsec_t timeval_to_ns(const struct timeval *tv)
137 * 132 *
138 * Returns the timespec representation of the nsec parameter. 133 * Returns the timespec representation of the nsec parameter.
139 */ 134 */
140extern struct timespec ns_to_timespec(const nsec_t nsec); 135extern struct timespec ns_to_timespec(const s64 nsec);
141 136
142/** 137/**
143 * ns_to_timeval - Convert nanoseconds to timeval 138 * ns_to_timeval - Convert nanoseconds to timeval
@@ -145,7 +140,7 @@ extern struct timespec ns_to_timespec(const nsec_t nsec);
145 * 140 *
146 * Returns the timeval representation of the nsec parameter. 141 * Returns the timeval representation of the nsec parameter.
147 */ 142 */
148extern struct timeval ns_to_timeval(const nsec_t nsec); 143extern struct timeval ns_to_timeval(const s64 nsec);
149 144
150#endif /* __KERNEL__ */ 145#endif /* __KERNEL__ */
151 146
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 9b9877fd2505..0a485beba9f5 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -6,7 +6,7 @@
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/stddef.h> 7#include <linux/stddef.h>
8 8
9struct timer_base_s; 9struct tvec_t_base_s;
10 10
11struct timer_list { 11struct timer_list {
12 struct list_head entry; 12 struct list_head entry;
@@ -15,16 +15,16 @@ struct timer_list {
15 void (*function)(unsigned long); 15 void (*function)(unsigned long);
16 unsigned long data; 16 unsigned long data;
17 17
18 struct timer_base_s *base; 18 struct tvec_t_base_s *base;
19}; 19};
20 20
21extern struct timer_base_s __init_timer_base; 21extern struct tvec_t_base_s boot_tvec_bases;
22 22
23#define TIMER_INITIALIZER(_function, _expires, _data) { \ 23#define TIMER_INITIALIZER(_function, _expires, _data) { \
24 .function = (_function), \ 24 .function = (_function), \
25 .expires = (_expires), \ 25 .expires = (_expires), \
26 .data = (_data), \ 26 .data = (_data), \
27 .base = &__init_timer_base, \ 27 .base = &boot_tvec_bases, \
28 } 28 }
29 29
30#define DEFINE_TIMER(_name, _function, _expires, _data) \ 30#define DEFINE_TIMER(_name, _function, _expires, _data) \
@@ -69,13 +69,13 @@ extern unsigned long next_timer_interrupt(void);
69 * @timer: the timer to be added 69 * @timer: the timer to be added
70 * 70 *
71 * The kernel will do a ->function(->data) callback from the 71 * The kernel will do a ->function(->data) callback from the
72 * timer interrupt at the ->expired point in the future. The 72 * timer interrupt at the ->expires point in the future. The
73 * current time is 'jiffies'. 73 * current time is 'jiffies'.
74 * 74 *
75 * The timer's ->expired, ->function (and if the handler uses it, ->data) 75 * The timer's ->expires, ->function (and if the handler uses it, ->data)
76 * fields must be set prior calling this function. 76 * fields must be set prior calling this function.
77 * 77 *
78 * Timers with an ->expired field in the past will be executed in the next 78 * Timers with an ->expires field in the past will be executed in the next
79 * timer tick. 79 * timer tick.
80 */ 80 */
81static inline void add_timer(struct timer_list *timer) 81static inline void add_timer(struct timer_list *timer)
@@ -96,6 +96,7 @@ 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 int it_real_fn(void *); 99struct hrtimer;
100extern int it_real_fn(struct hrtimer *);
100 101
101#endif 102#endif
diff --git a/include/linux/timex.h b/include/linux/timex.h
index b7ca1204e42a..03914b7e41b1 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -97,38 +97,11 @@
97 97
98#define MAXPHASE 512000L /* max phase error (us) */ 98#define MAXPHASE 512000L /* max phase error (us) */
99#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ 99#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */
100#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */
101#define MINSEC 16L /* min interval between updates (s) */ 100#define MINSEC 16L /* min interval between updates (s) */
102#define MAXSEC 1200L /* max interval between updates (s) */ 101#define MAXSEC 1200L /* max interval between updates (s) */
103#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ 102#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */
104 103
105/* 104/*
106 * The following defines are used only if a pulse-per-second (PPS)
107 * signal is available and connected via a modem control lead, such as
108 * produced by the optional ppsclock feature incorporated in the Sun
109 * asynch driver. They establish the design parameters of the frequency-
110 * lock loop used to discipline the CPU clock oscillator to the PPS
111 * signal.
112 *
113 * PPS_AVG is the averaging factor for the frequency loop, as well as
114 * the time and frequency dispersion.
115 *
116 * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum
117 * calibration intervals, respectively, in seconds as a power of two.
118 *
119 * PPS_VALID is the maximum interval before the PPS signal is considered
120 * invalid and protocol updates used directly instead.
121 *
122 * MAXGLITCH is the maximum interval before a time offset of more than
123 * MAXTIME is believed.
124 */
125#define PPS_AVG 2 /* pps averaging constant (shift) */
126#define PPS_SHIFT 2 /* min interval duration (s) (shift) */
127#define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */
128#define PPS_VALID 120 /* pps signal watchdog max (s) */
129#define MAXGLITCH 30 /* pps signal glitch max (s) */
130
131/*
132 * syscall interface - used (mainly by NTP daemon) 105 * syscall interface - used (mainly by NTP daemon)
133 * to discipline kernel clock oscillator 106 * to discipline kernel clock oscillator
134 */ 107 */
@@ -246,20 +219,6 @@ extern long time_reftime; /* time at last adjustment (s) */
246extern long time_adjust; /* The amount of adjtime left */ 219extern long time_adjust; /* The amount of adjtime left */
247extern long time_next_adjust; /* Value for time_adjust at next tick */ 220extern long time_next_adjust; /* Value for time_adjust at next tick */
248 221
249/* interface variables pps->timer interrupt */
250extern long pps_offset; /* pps time offset (us) */
251extern long pps_jitter; /* time dispersion (jitter) (us) */
252extern long pps_freq; /* frequency offset (scaled ppm) */
253extern long pps_stabil; /* frequency dispersion (scaled ppm) */
254extern long pps_valid; /* pps signal watchdog counter */
255
256/* interface variables pps->adjtimex */
257extern int pps_shift; /* interval duration (s) (shift) */
258extern long pps_jitcnt; /* jitter limit exceeded */
259extern long pps_calcnt; /* calibration intervals */
260extern long pps_errcnt; /* calibration errors */
261extern long pps_stbcnt; /* stability limit exceeded */
262
263/** 222/**
264 * ntp_clear - Clears the NTP state variables 223 * ntp_clear - Clears the NTP state variables
265 * 224 *
@@ -348,6 +307,8 @@ time_interpolator_reset(void)
348/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 307/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
349extern u64 current_tick_length(void); 308extern u64 current_tick_length(void);
350 309
310extern int do_adjtimex(struct timex *);
311
351#endif /* KERNEL */ 312#endif /* KERNEL */
352 313
353#endif /* LINUX_TIMEX_H */ 314#endif /* LINUX_TIMEX_H */
diff --git a/include/linux/tiocl.h b/include/linux/tiocl.h
index 2c9e847f6ed1..4756862c4ed4 100644
--- a/include/linux/tiocl.h
+++ b/include/linux/tiocl.h
@@ -34,5 +34,6 @@ struct tiocl_selection {
34#define TIOCL_SCROLLCONSOLE 13 /* scroll console */ 34#define TIOCL_SCROLLCONSOLE 13 /* scroll console */
35#define TIOCL_BLANKSCREEN 14 /* keep screen blank even if a key is pressed */ 35#define TIOCL_BLANKSCREEN 14 /* keep screen blank even if a key is pressed */
36#define TIOCL_BLANKEDSCREEN 15 /* return which vt was blanked */ 36#define TIOCL_BLANKEDSCREEN 15 /* return which vt was blanked */
37#define TIOCL_GETKMSGREDIRECT 17 /* get the vt the kernel messages are restricted to */
37 38
38#endif /* _LINUX_TIOCL_H */ 39#endif /* _LINUX_TIOCL_H */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index e8eb0040ce3a..a305ae2e44b6 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -164,6 +164,15 @@
164 .nr_balance_failed = 0, \ 164 .nr_balance_failed = 0, \
165} 165}
166 166
167#ifdef CONFIG_SCHED_MC
168#ifndef SD_MC_INIT
169/* for now its same as SD_CPU_INIT.
170 * TBD: Tune Domain parameters!
171 */
172#define SD_MC_INIT SD_CPU_INIT
173#endif
174#endif
175
167#ifdef CONFIG_NUMA 176#ifdef CONFIG_NUMA
168#ifndef SD_NODE_INIT 177#ifndef SD_NODE_INIT
169#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!! 178#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!
diff --git a/include/linux/tty.h b/include/linux/tty.h
index f45cd74e6f24..f13f49afe198 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -24,6 +24,7 @@
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#include <linux/screen_info.h>
27#include <linux/mutex.h>
27 28
28#include <asm/system.h> 29#include <asm/system.h>
29 30
@@ -231,8 +232,8 @@ struct tty_struct {
231 int canon_data; 232 int canon_data;
232 unsigned long canon_head; 233 unsigned long canon_head;
233 unsigned int canon_column; 234 unsigned int canon_column;
234 struct semaphore atomic_read; 235 struct mutex atomic_read_lock;
235 struct semaphore atomic_write; 236 struct mutex atomic_write_lock;
236 unsigned char *write_buf; 237 unsigned char *write_buf;
237 int write_cnt; 238 int write_cnt;
238 spinlock_t read_lock; 239 spinlock_t read_lock;
@@ -319,8 +320,7 @@ extern void tty_ldisc_put(int);
319extern void tty_wakeup(struct tty_struct *tty); 320extern void tty_wakeup(struct tty_struct *tty);
320extern void tty_ldisc_flush(struct tty_struct *tty); 321extern void tty_ldisc_flush(struct tty_struct *tty);
321 322
322struct semaphore; 323extern struct mutex tty_mutex;
323extern struct semaphore tty_sem;
324 324
325/* n_tty.c */ 325/* n_tty.c */
326extern struct tty_ldisc tty_ldisc_N_TTY; 326extern struct tty_ldisc tty_ldisc_N_TTY;
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 222faf97d5f9..0976a163b459 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -2,19 +2,13 @@
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); 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); 5extern int tty_insert_flip_string(struct tty_struct *tty, const 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); 6extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size);
7extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, 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); 8extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size);
9 9
10#ifdef INCLUDE_INLINE_FUNCS 10static inline int tty_insert_flip_char(struct tty_struct *tty,
11#define _INLINE_ extern 11 unsigned char ch, char flag)
12#else
13#define _INLINE_ static __inline__
14#endif
15
16_INLINE_ int tty_insert_flip_char(struct tty_struct *tty,
17 unsigned char ch, char flag)
18{ 12{
19 struct tty_buffer *tb = tty->buf.tail; 13 struct tty_buffer *tb = tty->buf.tail;
20 if (tb && tb->active && tb->used < tb->size) { 14 if (tb && tb->active && tb->used < tb->size) {
@@ -25,7 +19,7 @@ _INLINE_ int tty_insert_flip_char(struct tty_struct *tty,
25 return tty_insert_flip_string_flags(tty, &ch, &flag, 1); 19 return tty_insert_flip_string_flags(tty, &ch, &flag, 1);
26} 20}
27 21
28_INLINE_ void tty_schedule_flip(struct tty_struct *tty) 22static inline void tty_schedule_flip(struct tty_struct *tty)
29{ 23{
30 unsigned long flags; 24 unsigned long flags;
31 spin_lock_irqsave(&tty->buf.lock, flags); 25 spin_lock_irqsave(&tty->buf.lock, flags);
diff --git a/include/linux/types.h b/include/linux/types.h
index 54ae2d59e71b..1046c7ad86d9 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -137,6 +137,10 @@ typedef __s64 int64_t;
137typedef unsigned long sector_t; 137typedef unsigned long sector_t;
138#endif 138#endif
139 139
140#ifndef HAVE_BLKCNT_T
141typedef unsigned long blkcnt_t;
142#endif
143
140/* 144/*
141 * The type of an index into the pagecache. Use a #define so asm/types.h 145 * The type of an index into the pagecache. Use a #define so asm/types.h
142 * can override it. 146 * can override it.
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index 1e7508420fcf..ffaf05679ffb 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -15,27 +15,6 @@
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18#ifndef _ECMA_167_H
19typedef struct
20{
21 __u32 logicalBlockNum;
22 __u16 partitionReferenceNum;
23} __attribute__ ((packed)) lb_addr;
24
25typedef struct
26{
27 __u32 extLength;
28 __u32 extPosition;
29} __attribute__ ((packed)) short_ad;
30
31typedef struct
32{
33 __u32 extLength;
34 lb_addr extLocation;
35 __u8 impUse[6];
36} __attribute__ ((packed)) long_ad;
37#endif
38
39struct udf_inode_info 18struct udf_inode_info
40{ 19{
41 struct timespec i_crtime; 20 struct timespec i_crtime;
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
index b15ff2e99c91..80ae9ef940dc 100644
--- a/include/linux/udf_fs_sb.h
+++ b/include/linux/udf_fs_sb.h
@@ -13,7 +13,7 @@
13#ifndef _UDF_FS_SB_H 13#ifndef _UDF_FS_SB_H
14#define _UDF_FS_SB_H 1 14#define _UDF_FS_SB_H 1
15 15
16#include <asm/semaphore.h> 16#include <linux/mutex.h>
17 17
18#pragma pack(1) 18#pragma pack(1)
19 19
@@ -111,7 +111,7 @@ struct udf_sb_info
111 /* VAT inode */ 111 /* VAT inode */
112 struct inode *s_vat; 112 struct inode *s_vat;
113 113
114 struct semaphore s_alloc_sem; 114 struct mutex s_alloc_mutex;
115}; 115};
116 116
117#endif /* _UDF_FS_SB_H */ 117#endif /* _UDF_FS_SB_H */
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index b0ffe4356e5a..843aeaaa79d4 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -895,7 +895,7 @@ extern void ufs_set_link(struct inode *, struct ufs_dir_entry *, struct buffer_h
895 895
896/* file.c */ 896/* file.c */
897extern struct inode_operations ufs_file_inode_operations; 897extern struct inode_operations ufs_file_inode_operations;
898extern struct file_operations ufs_file_operations; 898extern const struct file_operations ufs_file_operations;
899 899
900extern struct address_space_operations ufs_aops; 900extern struct address_space_operations ufs_aops;
901 901
@@ -915,7 +915,7 @@ extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
915extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create); 915extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
916 916
917/* namei.c */ 917/* namei.c */
918extern struct file_operations ufs_dir_operations; 918extern const struct file_operations ufs_dir_operations;
919 919
920/* super.c */ 920/* super.c */
921extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); 921extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 827cc6de5f5c..e34e5e3dce52 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -615,7 +615,7 @@ extern struct bus_type usb_bus_type;
615 */ 615 */
616struct usb_class_driver { 616struct usb_class_driver {
617 char *name; 617 char *name;
618 struct file_operations *fops; 618 const struct file_operations *fops;
619 int minor_base; 619 int minor_base;
620}; 620};
621 621
@@ -1018,8 +1018,6 @@ extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,
1018 unsigned char descindex, void *buf, int size); 1018 unsigned char descindex, void *buf, int size);
1019extern int usb_get_status(struct usb_device *dev, 1019extern int usb_get_status(struct usb_device *dev,
1020 int type, int target, void *data); 1020 int type, int target, void *data);
1021extern int usb_get_string(struct usb_device *dev,
1022 unsigned short langid, unsigned char index, void *buf, int size);
1023extern int usb_string(struct usb_device *dev, int index, 1021extern int usb_string(struct usb_device *dev, int index,
1024 char *buf, size_t size); 1022 char *buf, size_t size);
1025 1023
diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h
index ff81117eb733..1d78870ed8af 100644
--- a/include/linux/usb_gadget.h
+++ b/include/linux/usb_gadget.h
@@ -801,7 +801,9 @@ struct usb_gadget_driver {
801 * Call this in your gadget driver's module initialization function, 801 * Call this in your gadget driver's module initialization function,
802 * to tell the underlying usb controller driver about your driver. 802 * to tell the underlying usb controller driver about your driver.
803 * The driver's bind() function will be called to bind it to a 803 * The driver's bind() function will be called to bind it to a
804 * gadget. This function must be called in a context that can sleep. 804 * gadget before this registration call returns. It's expected that
805 * the bind() functions will be in init sections.
806 * This function must be called in a context that can sleep.
805 */ 807 */
806int usb_gadget_register_driver (struct usb_gadget_driver *driver); 808int usb_gadget_register_driver (struct usb_gadget_driver *driver);
807 809
@@ -814,7 +816,8 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver);
814 * going away. If the controller is connected to a USB host, 816 * going away. If the controller is connected to a USB host,
815 * it will first disconnect(). The driver is also requested 817 * it will first disconnect(). The driver is also requested
816 * to unbind() and clean up any device state, before this procedure 818 * to unbind() and clean up any device state, before this procedure
817 * finally returns. 819 * finally returns. It's expected that the unbind() functions
820 * will in in exit sections, so may not be linked in some kernels.
818 * This function must be called in a context that can sleep. 821 * This function must be called in a context that can sleep.
819 */ 822 */
820int usb_gadget_unregister_driver (struct usb_gadget_driver *driver); 823int usb_gadget_unregister_driver (struct usb_gadget_driver *driver);
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 5208b12d5550..af2d6155d3fe 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -17,11 +17,12 @@
17#include <linux/time.h> /* need struct timeval */ 17#include <linux/time.h> /* need struct timeval */
18#include <linux/poll.h> 18#include <linux/poll.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/mutex.h>
20#endif 21#endif
21#include <linux/compiler.h> /* need __user */ 22#include <linux/compiler.h> /* need __user */
22 23
23 24
24#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.15 */ 25#define OBSOLETE_OWNER 1 /* It will be removed for 2.6.17 */
25#define HAVE_V4L2 1 26#define HAVE_V4L2 1
26 27
27/* 28/*
@@ -48,6 +49,16 @@
48 49
49#ifdef __KERNEL__ 50#ifdef __KERNEL__
50 51
52/* Minor device allocation */
53#define MINOR_VFL_TYPE_GRABBER_MIN 0
54#define MINOR_VFL_TYPE_GRABBER_MAX 63
55#define MINOR_VFL_TYPE_RADIO_MIN 64
56#define MINOR_VFL_TYPE_RADIO_MAX 127
57#define MINOR_VFL_TYPE_VTX_MIN 192
58#define MINOR_VFL_TYPE_VTX_MAX 223
59#define MINOR_VFL_TYPE_VBI_MIN 224
60#define MINOR_VFL_TYPE_VBI_MAX 255
61
51#define VFL_TYPE_GRABBER 0 62#define VFL_TYPE_GRABBER 0
52#define VFL_TYPE_VBI 1 63#define VFL_TYPE_VBI 1
53#define VFL_TYPE_RADIO 2 64#define VFL_TYPE_RADIO 2
@@ -64,7 +75,7 @@ struct video_device
64 int minor; 75 int minor;
65 76
66 /* device ops + callbacks */ 77 /* device ops + callbacks */
67 struct file_operations *fops; 78 const struct file_operations *fops;
68 void (*release)(struct video_device *vfd); 79 void (*release)(struct video_device *vfd);
69 80
70 81
@@ -80,7 +91,7 @@ struct video_device
80 91
81 /* for videodev.c intenal usage -- please don't touch */ 92 /* for videodev.c intenal usage -- please don't touch */
82 int users; /* video_exclusive_{open|close} ... */ 93 int users; /* video_exclusive_{open|close} ... */
83 struct semaphore lock; /* ... helper function uses these */ 94 struct mutex lock; /* ... helper function uses these */
84 char devfs_name[64]; /* devfs */ 95 char devfs_name[64]; /* devfs */
85 struct class_device class_dev; /* sysfs */ 96 struct class_device class_dev; /* sysfs */
86}; 97};
@@ -872,6 +883,7 @@ struct v4l2_modulator
872#define V4L2_TUNER_MODE_LANG2 0x0002 883#define V4L2_TUNER_MODE_LANG2 0x0002
873#define V4L2_TUNER_MODE_SAP 0x0002 884#define V4L2_TUNER_MODE_SAP 0x0002
874#define V4L2_TUNER_MODE_LANG1 0x0003 885#define V4L2_TUNER_MODE_LANG1 0x0003
886#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
875 887
876struct v4l2_frequency 888struct v4l2_frequency
877{ 889{
@@ -952,13 +964,68 @@ struct v4l2_sliced_vbi_format
952 __u32 reserved[2]; /* must be zero */ 964 __u32 reserved[2]; /* must be zero */
953}; 965};
954 966
955#define V4L2_SLICED_TELETEXT_B (0x0001) 967/* Teletext World System Teletext
956#define V4L2_SLICED_VPS (0x0400) 968 (WST), defined on ITU-R BT.653-2 */
957#define V4L2_SLICED_CAPTION_525 (0x1000) 969#define V4L2_SLICED_TELETEXT_PAL_B (0x000001)
958#define V4L2_SLICED_WSS_625 (0x4000) 970#define V4L2_SLICED_TELETEXT_PAL_C (0x000002)
959 971#define V4L2_SLICED_TELETEXT_NTSC_B (0x000010)
960#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) 972#define V4L2_SLICED_TELETEXT_SECAM (0x000020)
961#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) 973
974/* Teletext North American Broadcast Teletext Specification
975 (NABTS), defined on ITU-R BT.653-2 */
976#define V4L2_SLICED_TELETEXT_NTSC_C (0x000040)
977#define V4L2_SLICED_TELETEXT_NTSC_D (0x000080)
978
979/* Video Program System, defined on ETS 300 231*/
980#define V4L2_SLICED_VPS (0x000400)
981
982/* Closed Caption, defined on EIA-608 */
983#define V4L2_SLICED_CAPTION_525 (0x001000)
984#define V4L2_SLICED_CAPTION_625 (0x002000)
985
986/* Wide Screen System, defined on ITU-R BT1119.1 */
987#define V4L2_SLICED_WSS_625 (0x004000)
988
989/* Wide Screen System, defined on IEC 61880 */
990#define V4L2_SLICED_WSS_525 (0x008000)
991
992/* Vertical Interval Timecode (VITC), defined on SMPTE 12M */
993#define V4l2_SLICED_VITC_625 (0x010000)
994#define V4l2_SLICED_VITC_525 (0x020000)
995
996#define V4L2_SLICED_TELETEXT_B (V4L2_SLICED_TELETEXT_PAL_B |\
997 V4L2_SLICED_TELETEXT_NTSC_B)
998
999#define V4L2_SLICED_TELETEXT (V4L2_SLICED_TELETEXT_PAL_B |\
1000 V4L2_SLICED_TELETEXT_PAL_C |\
1001 V4L2_SLICED_TELETEXT_SECAM |\
1002 V4L2_SLICED_TELETEXT_NTSC_B |\
1003 V4L2_SLICED_TELETEXT_NTSC_C |\
1004 V4L2_SLICED_TELETEXT_NTSC_D)
1005
1006#define V4L2_SLICED_CAPTION (V4L2_SLICED_CAPTION_525 |\
1007 V4L2_SLICED_CAPTION_625)
1008
1009#define V4L2_SLICED_WSS (V4L2_SLICED_WSS_525 |\
1010 V4L2_SLICED_WSS_625)
1011
1012#define V4L2_SLICED_VITC (V4L2_SLICED_VITC_525 |\
1013 V4L2_SLICED_VITC_625)
1014
1015#define V4L2_SLICED_VBI_525 (V4L2_SLICED_TELETEXT_NTSC_B |\
1016 V4L2_SLICED_TELETEXT_NTSC_C |\
1017 V4L2_SLICED_TELETEXT_NTSC_D |\
1018 V4L2_SLICED_CAPTION_525 |\
1019 V4L2_SLICED_WSS_525 |\
1020 V4l2_SLICED_VITC_525)
1021
1022#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_PAL_B |\
1023 V4L2_SLICED_TELETEXT_PAL_C |\
1024 V4L2_SLICED_TELETEXT_SECAM |\
1025 V4L2_SLICED_VPS |\
1026 V4L2_SLICED_CAPTION_625 |\
1027 V4L2_SLICED_WSS_625 |\
1028 V4l2_SLICED_VITC_625)
962 1029
963struct v4l2_sliced_vbi_cap 1030struct v4l2_sliced_vbi_cap
964{ 1031{
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index fab5aed8ca31..530ae3f4248c 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -73,6 +73,11 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
73int vt_waitactive(int vt); 73int vt_waitactive(int vt);
74void change_console(struct vc_data *new_vc); 74void change_console(struct vc_data *new_vc);
75void reset_vc(struct vc_data *vc); 75void reset_vc(struct vc_data *vc);
76#ifdef CONFIG_VT
77int is_console_suspend_safe(void);
78#else
79static inline int is_console_suspend_safe(void) { return 1; }
80#endif
76 81
77/* 82/*
78 * vc_screen.c shares this temporary buffer with the console write code so that 83 * vc_screen.c shares this temporary buffer with the console write code so that
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index a555a0f7a7b4..13588564b42b 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * This file define a set of standard wireless extensions 2 * This file define a set of standard wireless extensions
3 * 3 *
4 * Version : 19 18.3.05 4 * Version : 20 17.2.06
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2005 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _LINUX_WIRELESS_H 10#ifndef _LINUX_WIRELESS_H
@@ -80,7 +80,7 @@
80 * (there is some stuff that will be added in the future...) 80 * (there is some stuff that will be added in the future...)
81 * I just plan to increment with each new version. 81 * I just plan to increment with each new version.
82 */ 82 */
83#define WIRELESS_EXT 19 83#define WIRELESS_EXT 20
84 84
85/* 85/*
86 * Changes : 86 * Changes :
@@ -204,6 +204,10 @@
204 * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros 204 * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros
205 * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM 205 * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM
206 * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros 206 * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros
207 *
208 * V19 to V20
209 * ----------
210 * - RtNetlink requests support (SET/GET)
207 */ 211 */
208 212
209/**************************** CONSTANTS ****************************/ 213/**************************** CONSTANTS ****************************/
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 86b111300231..957c21c16d62 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -20,6 +20,10 @@ struct work_struct {
20 struct timer_list timer; 20 struct timer_list timer;
21}; 21};
22 22
23struct execute_work {
24 struct work_struct work;
25};
26
23#define __WORK_INITIALIZER(n, f, d) { \ 27#define __WORK_INITIALIZER(n, f, d) { \
24 .entry = { &(n).entry, &(n).entry }, \ 28 .entry = { &(n).entry, &(n).entry }, \
25 .func = (f), \ 29 .func = (f), \
@@ -74,6 +78,8 @@ extern void init_workqueues(void);
74void cancel_rearming_delayed_work(struct work_struct *work); 78void cancel_rearming_delayed_work(struct work_struct *work);
75void cancel_rearming_delayed_workqueue(struct workqueue_struct *, 79void cancel_rearming_delayed_workqueue(struct workqueue_struct *,
76 struct work_struct *); 80 struct work_struct *);
81int execute_in_process_context(void (*fn)(void *), void *,
82 struct execute_work *);
77 83
78/* 84/*
79 * Kill off a pending schedule_delayed_work(). Note that the work callback 85 * Kill off a pending schedule_delayed_work(). Note that the work callback
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index beaef5c7a0ea..56f92fcbe94a 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -88,8 +88,8 @@ void throttle_vm_writeout(void);
88/* These are exported to sysctl. */ 88/* These are exported to sysctl. */
89extern int dirty_background_ratio; 89extern int dirty_background_ratio;
90extern int vm_dirty_ratio; 90extern int vm_dirty_ratio;
91extern int dirty_writeback_centisecs; 91extern int dirty_writeback_interval;
92extern int dirty_expire_centisecs; 92extern int dirty_expire_interval;
93extern int block_dump; 93extern int block_dump;
94extern int laptop_mode; 94extern int laptop_mode;
95 95
@@ -99,7 +99,15 @@ int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
99 void __user *, size_t *, loff_t *); 99 void __user *, size_t *, loff_t *);
100 100
101void page_writeback_init(void); 101void page_writeback_init(void);
102void balance_dirty_pages_ratelimited(struct address_space *mapping); 102void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
103 unsigned long nr_pages_dirtied);
104
105static inline void
106balance_dirty_pages_ratelimited(struct address_space *mapping)
107{
108 balance_dirty_pages_ratelimited_nr(mapping, 1);
109}
110
103int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); 111int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
104int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 112int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
105int sync_page_range(struct inode *inode, struct address_space *mapping, 113int sync_page_range(struct inode *inode, struct address_space *mapping,
diff --git a/include/linux/x1205.h b/include/linux/x1205.h
deleted file mode 100644
index 64fd3af894a5..000000000000
--- a/include/linux/x1205.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * x1205.h - defines for drivers/i2c/chips/x1205.c
3 * Copyright 2004 Karen Spearel
4 * Copyright 2005 Alessandro Zummo
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#ifndef __LINUX_X1205_H__
13#define __LINUX_X1205_H__
14
15/* commands */
16
17#define X1205_CMD_GETDATETIME 0
18#define X1205_CMD_SETTIME 1
19#define X1205_CMD_SETDATETIME 2
20#define X1205_CMD_GETALARM 3
21#define X1205_CMD_SETALARM 4
22#define X1205_CMD_GETDTRIM 5
23#define X1205_CMD_SETDTRIM 6
24#define X1205_CMD_GETATRIM 7
25#define X1205_CMD_SETATRIM 8
26
27extern int x1205_do_command(unsigned int cmd, void *arg);
28extern int x1205_direct_attach(int adapter_id,
29 struct i2c_client_address_data *address_data);
30
31#endif /* __LINUX_X1205_H__ */
diff --git a/include/linux/x25.h b/include/linux/x25.h
index 16d44931afa0..d035e4e87d07 100644
--- a/include/linux/x25.h
+++ b/include/linux/x25.h
@@ -11,6 +11,8 @@
11#ifndef X25_KERNEL_H 11#ifndef X25_KERNEL_H
12#define X25_KERNEL_H 12#define X25_KERNEL_H
13 13
14#include <linux/types.h>
15
14#define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0) 16#define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0)
15#define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1) 17#define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1)
16#define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2) 18#define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2)
@@ -21,6 +23,8 @@
21#define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7) 23#define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7)
22#define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8) 24#define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8)
23#define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) 25#define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9)
26#define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10)
27#define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11)
24 28
25/* 29/*
26 * Values for {get,set}sockopt. 30 * Values for {get,set}sockopt.
@@ -77,6 +81,8 @@ struct x25_subscrip_struct {
77#define X25_MASK_PACKET_SIZE 0x04 81#define X25_MASK_PACKET_SIZE 0x04
78#define X25_MASK_WINDOW_SIZE 0x08 82#define X25_MASK_WINDOW_SIZE 0x08
79 83
84#define X25_MASK_CALLING_AE 0x10
85#define X25_MASK_CALLED_AE 0x20
80 86
81 87
82/* 88/*
@@ -99,6 +105,26 @@ struct x25_facilities {
99}; 105};
100 106
101/* 107/*
108* ITU DTE facilities
109* Only the called and calling address
110* extension are currently implemented.
111* The rest are in place to avoid the struct
112* changing size if someone needs them later
113*/
114
115struct x25_dte_facilities {
116 __u16 delay_cumul;
117 __u16 delay_target;
118 __u16 delay_max;
119 __u8 min_throughput;
120 __u8 expedited;
121 __u8 calling_len;
122 __u8 called_len;
123 __u8 calling_ae[20];
124 __u8 called_ae[20];
125};
126
127/*
102 * Call User Data structure. 128 * Call User Data structure.
103 */ 129 */
104struct x25_calluserdata { 130struct x25_calluserdata {
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 82fbb758e28f..6b42cc474c01 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -156,6 +156,10 @@ enum {
156 XFRM_MSG_FLUSHPOLICY, 156 XFRM_MSG_FLUSHPOLICY,
157#define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY 157#define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY
158 158
159 XFRM_MSG_NEWAE,
160#define XFRM_MSG_NEWAE XFRM_MSG_NEWAE
161 XFRM_MSG_GETAE,
162#define XFRM_MSG_GETAE XFRM_MSG_GETAE
159 __XFRM_MSG_MAX 163 __XFRM_MSG_MAX
160}; 164};
161#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 165#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -194,6 +198,21 @@ struct xfrm_encap_tmpl {
194 xfrm_address_t encap_oa; 198 xfrm_address_t encap_oa;
195}; 199};
196 200
201/* AEVENT flags */
202enum xfrm_ae_ftype_t {
203 XFRM_AE_UNSPEC,
204 XFRM_AE_RTHR=1, /* replay threshold*/
205 XFRM_AE_RVAL=2, /* replay value */
206 XFRM_AE_LVAL=4, /* lifetime value */
207 XFRM_AE_ETHR=8, /* expiry timer threshold */
208 XFRM_AE_CR=16, /* Event cause is replay update */
209 XFRM_AE_CE=32, /* Event cause is timer expiry */
210 XFRM_AE_CU=64, /* Event cause is policy update */
211 __XFRM_AE_MAX
212
213#define XFRM_AE_MAX (__XFRM_AE_MAX - 1)
214};
215
197/* Netlink message attributes. */ 216/* Netlink message attributes. */
198enum xfrm_attr_type_t { 217enum xfrm_attr_type_t {
199 XFRMA_UNSPEC, 218 XFRMA_UNSPEC,
@@ -205,6 +224,10 @@ enum xfrm_attr_type_t {
205 XFRMA_SA, 224 XFRMA_SA,
206 XFRMA_POLICY, 225 XFRMA_POLICY,
207 XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ 226 XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */
227 XFRMA_LTIME_VAL,
228 XFRMA_REPLAY_VAL,
229 XFRMA_REPLAY_THRESH,
230 XFRMA_ETIMER_THRESH,
208 __XFRMA_MAX 231 __XFRMA_MAX
209 232
210#define XFRMA_MAX (__XFRMA_MAX - 1) 233#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -235,6 +258,11 @@ struct xfrm_usersa_id {
235 __u8 proto; 258 __u8 proto;
236}; 259};
237 260
261struct xfrm_aevent_id {
262 struct xfrm_usersa_id sa_id;
263 __u32 flags;
264};
265
238struct xfrm_userspi_info { 266struct xfrm_userspi_info {
239 struct xfrm_usersa_info info; 267 struct xfrm_usersa_info info;
240 __u32 min; 268 __u32 min;
@@ -306,6 +334,8 @@ enum xfrm_nlgroups {
306#define XFRMNLGRP_SA XFRMNLGRP_SA 334#define XFRMNLGRP_SA XFRMNLGRP_SA
307 XFRMNLGRP_POLICY, 335 XFRMNLGRP_POLICY,
308#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY 336#define XFRMNLGRP_POLICY XFRMNLGRP_POLICY
337 XFRMNLGRP_AEVENTS,
338#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS
309 __XFRMNLGRP_MAX 339 __XFRMNLGRP_MAX
310}; 340};
311#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 341#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index ba5b72768bbe..2f135cf6eef1 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -271,39 +271,6 @@ static inline void zorro_set_drvdata (struct zorro_dev *z, void *data)
271} 271}
272 272
273 273
274/*
275 * A helper function which helps ensure correct zorro_driver
276 * setup and cleanup for commonly-encountered hotplug/modular cases
277 *
278 * This MUST stay in a header, as it checks for -DMODULE
279 */
280static inline int zorro_module_init(struct zorro_driver *drv)
281{
282 int rc = zorro_register_driver(drv);
283
284 if (rc > 0)
285 return 0;
286
287 /* iff CONFIG_HOTPLUG and built into kernel, we should
288 * leave the driver around for future hotplug events.
289 * For the module case, a hotplug daemon of some sort
290 * should load a module in response to an insert event. */
291#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
292 if (rc == 0)
293 return 0;
294#else
295 if (rc == 0)
296 rc = -ENODEV;
297#endif
298
299 /* if we get here, we need to clean up Zorro driver instance
300 * and return some sort of error */
301 zorro_unregister_driver(drv);
302
303 return rc;
304}
305
306
307 /* 274 /*
308 * Bitmask indicating portions of available Zorro II RAM that are unused 275 * Bitmask indicating portions of available Zorro II RAM that are unused
309 * by the system. Every bit represents a 64K chunk, for a maximum of 8MB 276 * by the system. Every bit represents a 64K chunk, for a maximum of 8MB
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
index 295d256ee811..1fd4a2207574 100644
--- a/include/media/audiochip.h
+++ b/include/media/audiochip.h
@@ -21,18 +21,4 @@ enum audiochip {
21 AUDIO_CHIP_MSP34XX 21 AUDIO_CHIP_MSP34XX
22}; 22};
23 23
24/* ---------------------------------------------------------------------- */
25
26/* audio inputs */
27#define AUDIO_TUNER 0x00
28#define AUDIO_RADIO 0x01
29#define AUDIO_EXTERN 0x02
30#define AUDIO_INTERN 0x03
31#define AUDIO_OFF 0x04
32#define AUDIO_ON 0x05
33#define AUDIO_EXTERN_1 AUDIO_EXTERN
34#define AUDIO_EXTERN_2 0x06
35#define AUDIO_MUTE 0x80
36#define AUDIO_UNMUTE 0x81
37
38#endif /* AUDIOCHIP_H */ 24#endif /* AUDIOCHIP_H */
diff --git a/include/media/cs53l32a.h b/include/media/cs53l32a.h
new file mode 100644
index 000000000000..bf76197d3790
--- /dev/null
+++ b/include/media/cs53l32a.h
@@ -0,0 +1,34 @@
1/*
2 cs53l32a.h - definition for cs53l32a inputs and outputs
3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _CS53L32A_H_
22#define _CS53L32A_H_
23
24/* There are 2 physical inputs, but the second input can be
25 placed in two modes, the first mode bypasses the PGA (gain),
26 the second goes through the PGA. Hence there are three
27 possible inputs to choose from. */
28
29/* CS53L32A HW inputs */
30#define CS53L32A_IN0 0
31#define CS53L32A_IN1 1
32#define CS53L32A_IN2 2
33
34#endif
diff --git a/include/media/i2c-addr.h b/include/media/i2c-addr.h
new file mode 100644
index 000000000000..e7ff44a35ca0
--- /dev/null
+++ b/include/media/i2c-addr.h
@@ -0,0 +1,44 @@
1/*
2 * V4L I2C address list
3 *
4 *
5 * Copyright (C) 2006 Mauro Carvalho Chehab <mchehab@infradead.org>
6 * Based on a previous mapping by
7 * Ralph Metzler (rjkm@thp.uni-koeln.de)
8 * Gerd Knorr <kraxel@goldbach.in-berlin.de>
9 *
10 */
11
12/* bttv address list */
13#define I2C_ADDR_TSA5522 0xc2
14#define I2C_ADDR_TDA7432 0x8a
15#define I2C_ADDR_BT832_ALT1 0x88
16#define I2C_ADDR_BT832_ALT2 0x8a // alternate setting
17#define I2C_ADDR_TDA8425 0x82
18#define I2C_ADDR_TDA9840 0x84
19#define I2C_ADDR_TDA9850 0xb6 /* also used by 9855,9873 */
20#define I2C_ADDR_TDA9874 0xb0 /* also used by 9875 */
21#define I2C_ADDR_TDA9875 0xb0
22#define I2C_ADDR_HAUPEE 0xa0
23#define I2C_ADDR_STBEE 0xae
24#define I2C_ADDR_VHX 0xc0
25#define I2C_ADDR_MSP3400 0x80
26#define I2C_ADDR_MSP3400_ALT 0x88
27#define I2C_ADDR_TEA6300 0x80 /* also used by 6320 */
28#define I2C_ADDR_DPL3518 0x84
29#define I2C_ADDR_TDA9887 0x86
30
31/*
32 * i2c bus addresses for the chips supported by tvaudio.c
33 */
34
35#define I2C_ADDR_TDA8425 0x82
36#define I2C_ADDR_TDA9840 0x84 /* also used by TA8874Z */
37#define I2C_ADDR_TDA985x_L 0xb4 /* also used by 9873 */
38#define I2C_ADDR_TDA985x_H 0xb6
39#define I2C_ADDR_TDA9874 0xb0 /* also used by 9875 */
40
41#define I2C_ADDR_TEA6300 0x80 /* also used by 6320 */
42#define I2C_ADDR_TEA6420 0x98
43
44#define I2C_ADDR_PIC16C54 0x96 /* PV951 */
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index ad3e9bb670c3..302d5b3946e7 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -47,13 +47,6 @@ struct ir_input_state {
47 int keypressed; /* current state */ 47 int keypressed; /* current state */
48}; 48};
49 49
50extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE];
51extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE];
52extern IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE];
53extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE];
54extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE];
55extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE];
56
57void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 50void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
58 int ir_type, IR_KEYTAB_TYPE *ir_codes); 51 int ir_type, IR_KEYTAB_TYPE *ir_codes);
59void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); 52void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
@@ -64,6 +57,39 @@ int ir_dump_samples(u32 *samples, int count);
64int ir_decode_biphase(u32 *samples, int count, int low, int high); 57int ir_decode_biphase(u32 *samples, int count, int low, int high);
65int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); 58int ir_decode_pulsedistance(u32 *samples, int count, int low, int high);
66 59
60/* Keymaps to be used by other modules */
61
62extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE];
63extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE];
64extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE];
65extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE];
66extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE];
67extern IR_KEYTAB_TYPE ir_codes_nebula[IR_KEYTAB_SIZE];
68extern IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE];
69extern IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE];
70extern IR_KEYTAB_TYPE ir_codes_adstech_dvb_t_pci[IR_KEYTAB_SIZE];
71extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE];
72extern IR_KEYTAB_TYPE ir_codes_cinergy_1400[IR_KEYTAB_SIZE];
73extern IR_KEYTAB_TYPE ir_codes_avertv_303[IR_KEYTAB_SIZE];
74extern IR_KEYTAB_TYPE ir_codes_dntv_live_dvbt_pro[IR_KEYTAB_SIZE];
75extern IR_KEYTAB_TYPE ir_codes_em_terratec[IR_KEYTAB_SIZE];
76extern IR_KEYTAB_TYPE ir_codes_em_pinnacle_usb[IR_KEYTAB_SIZE];
77extern IR_KEYTAB_TYPE ir_codes_flyvideo[IR_KEYTAB_SIZE];
78extern IR_KEYTAB_TYPE ir_codes_flydvb[IR_KEYTAB_SIZE];
79extern IR_KEYTAB_TYPE ir_codes_cinergy[IR_KEYTAB_SIZE];
80extern IR_KEYTAB_TYPE ir_codes_eztv[IR_KEYTAB_SIZE];
81extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE];
82extern IR_KEYTAB_TYPE ir_codes_videomate_tv_pvr[IR_KEYTAB_SIZE];
83extern IR_KEYTAB_TYPE ir_codes_manli[IR_KEYTAB_SIZE];
84extern IR_KEYTAB_TYPE ir_codes_gotview7135[IR_KEYTAB_SIZE];
85extern IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE];
86extern IR_KEYTAB_TYPE ir_codes_pctv_sedna[IR_KEYTAB_SIZE];
87extern IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE];
88extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE];
89extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE];
90extern IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE];
91extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE];
92
67#endif 93#endif
68 94
69/* 95/*
diff --git a/include/media/msp3400.h b/include/media/msp3400.h
new file mode 100644
index 000000000000..0be61a021d45
--- /dev/null
+++ b/include/media/msp3400.h
@@ -0,0 +1,226 @@
1/*
2 msp3400.h - definition for msp3400 inputs and outputs
3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _MSP3400_H_
22#define _MSP3400_H_
23
24/* msp3400 routing
25 ===============
26
27 The msp3400 has a complicated routing scheme with many possible
28 combinations. The details are all in the datasheets but I will try
29 to give a short description here.
30
31 Inputs
32 ======
33
34 There are 1) tuner inputs, 2) I2S inputs, 3) SCART inputs. You will have
35 to select which tuner input to use and which SCART input to use. The
36 selected tuner input, the selected SCART input and all I2S inputs go to
37 the DSP (the tuner input first goes through the demodulator).
38
39 The DSP handles things like volume, bass/treble, balance, and some chips
40 have support for surround sound. It has several outputs: MAIN, AUX, I2S
41 and SCART1/2. Each output can select which DSP input to use. So the MAIN
42 output can select the tuner input while at the same time the SCART1 output
43 uses the I2S input.
44
45 Outputs
46 =======
47
48 Most DSP outputs are also the outputs of the msp3400. However, the SCART
49 outputs of the msp3400 can select which input to use: either the SCART1 or
50 SCART2 output from the DSP, or the msp3400 SCART inputs, thus completely
51 bypassing the DSP.
52
53 Summary
54 =======
55
56 So to specify a complete routing scheme for the msp3400 you will have to
57 specify in the 'input' field of the v4l2_routing struct:
58
59 1) which tuner input to use
60 2) which SCART input to use
61 3) which DSP input to use for each DSP output
62
63 And in the 'output' field of the v4l2_routing struct you specify:
64
65 1) which SCART input to use for each SCART output
66
67 Depending on how the msp is wired to the other components you can
68 ignore or mute certain inputs or outputs.
69
70 Also, depending on the msp version only a subset of the inputs or
71 outputs may be present. At the end of this header some tables are
72 added containing a list of what is available for each msp version.
73 */
74
75/* Inputs to the DSP unit: two independent selections have to be made:
76 1) the tuner (SIF) input
77 2) the SCART input
78 Bits 0-2 are used for the SCART input select, bit 3 is used for the tuner
79 input, bits 4-7 are reserved.
80 */
81
82/* SCART input to DSP selection */
83#define MSP_IN_SCART_1 0 /* Pin SC1_IN */
84#define MSP_IN_SCART_2 1 /* Pin SC2_IN */
85#define MSP_IN_SCART_3 2 /* Pin SC3_IN */
86#define MSP_IN_SCART_4 3 /* Pin SC4_IN */
87#define MSP_IN_MONO 6 /* Pin MONO_IN */
88#define MSP_IN_MUTE 7 /* Mute DSP input */
89#define MSP_SCART_TO_DSP(in) (in)
90/* Tuner input to demodulator and DSP selection */
91#define MSP_IN_TUNER_1 0 /* Analog Sound IF input pin ANA_IN1 */
92#define MSP_IN_TUNER_2 1 /* Analog Sound IF input pin ANA_IN2 */
93#define MSP_TUNER_TO_DSP(in) ((in) << 3)
94
95/* The msp has up to 5 DSP outputs, each output can independently select
96 a DSP input.
97
98 The DSP outputs are: loudspeaker output (aka MAIN), headphones output
99 (aka AUX), SCART1 DA output, SCART2 DA output and an I2S output.
100 There also is a quasi-peak detector output, but that is not used by
101 this driver and is set to the same input as the loudspeaker output.
102 Not all outputs are supported by all msp models. Setting the input
103 of an unsupported output will be ignored by the driver.
104
105 There are up to 16 DSP inputs to choose from, so each output is
106 assigned 4 bits.
107
108 Note: the 44x8G can mix two inputs and feed the result back to the
109 DSP. This is currently not implemented. Also not implemented is the
110 multi-channel capable I2S3 input of the 44x0G. If someone can demonstrate
111 a need for one of those features then additional support can be added. */
112#define MSP_DSP_OUT_TUNER 0 /* Tuner output */
113#define MSP_DSP_OUT_SCART 2 /* SCART output */
114#define MSP_DSP_OUT_I2S1 5 /* I2S1 output */
115#define MSP_DSP_OUT_I2S2 6 /* I2S2 output */
116#define MSP_DSP_OUT_I2S3 7 /* I2S3 output */
117#define MSP_DSP_OUT_MAIN_AVC 11 /* MAIN AVC processed output */
118#define MSP_DSP_OUT_MAIN 12 /* MAIN output */
119#define MSP_DSP_OUT_AUX 13 /* AUX output */
120#define MSP_DSP_TO_MAIN(in) ((in) << 4)
121#define MSP_DSP_TO_AUX(in) ((in) << 8)
122#define MSP_DSP_TO_SCART1(in) ((in) << 12)
123#define MSP_DSP_TO_SCART2(in) ((in) << 16)
124#define MSP_DSP_TO_I2S(in) ((in) << 20)
125
126/* Output SCART select: the SCART outputs can select which input
127 to use. */
128#define MSP_OUT_SCART1 0 /* SCART1 input, bypassing the DSP */
129#define MSP_OUT_SCART2 1 /* SCART2 input, bypassing the DSP */
130#define MSP_OUT_SCART3 2 /* SCART3 input, bypassing the DSP */
131#define MSP_OUT_SCART4 3 /* SCART4 input, bypassing the DSP */
132#define MSP_OUT_SCART1_DA 4 /* DSP SCART1 output */
133#define MSP_OUT_SCART2_DA 5 /* DSP SCART2 output */
134#define MSP_OUT_MONO 6 /* MONO input, bypassing the DSP */
135#define MSP_OUT_MUTE 7 /* MUTE output */
136#define MSP_OUT_TO_SCART1(in) (in)
137#define MSP_OUT_TO_SCART2(in) ((in) << 4)
138
139/* Shortcut macros */
140#define MSP_INPUT(sc, t, main_aux_src, sc_i2s_src) \
141 (MSP_SCART_TO_DSP(sc) | \
142 MSP_TUNER_TO_DSP(t) | \
143 MSP_DSP_TO_MAIN(main_aux_src) | \
144 MSP_DSP_TO_AUX(main_aux_src) | \
145 MSP_DSP_TO_SCART1(sc_i2s_src) | \
146 MSP_DSP_TO_SCART2(sc_i2s_src) | \
147 MSP_DSP_TO_I2S(sc_i2s_src))
148#define MSP_INPUT_DEFAULT MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, \
149 MSP_DSP_OUT_TUNER, MSP_DSP_OUT_TUNER)
150#define MSP_OUTPUT(sc) \
151 (MSP_OUT_TO_SCART1(sc) | \
152 MSP_OUT_TO_SCART2(sc))
153/* This equals the RESET position of the msp3400 ACB register */
154#define MSP_OUTPUT_DEFAULT (MSP_OUT_TO_SCART1(MSP_OUT_SCART3) | \
155 MSP_OUT_TO_SCART2(MSP_OUT_SCART1_DA))
156
157/* Tuner inputs vs. msp version */
158/* Chip TUNER_1 TUNER_2
159 -------------------------
160 msp34x0b y y
161 msp34x0c y y
162 msp34x0d y y
163 msp34x5d y n
164 msp34x7d y n
165 msp34x0g y y
166 msp34x1g y y
167 msp34x2g y y
168 msp34x5g y n
169 msp34x7g y n
170 msp44x0g y y
171 msp44x8g y y
172 */
173
174/* SCART inputs vs. msp version */
175/* Chip SC1 SC2 SC3 SC4
176 -------------------------
177 msp34x0b y y y n
178 msp34x0c y y y n
179 msp34x0d y y y y
180 msp34x5d y y n n
181 msp34x7d y n n n
182 msp34x0g y y y y
183 msp34x1g y y y y
184 msp34x2g y y y y
185 msp34x5g y y n n
186 msp34x7g y n n n
187 msp44x0g y y y y
188 msp44x8g y y y y
189 */
190
191/* DSP inputs vs. msp version (tuner and SCART inputs are always available) */
192/* Chip I2S1 I2S2 I2S3 MAIN_AVC MAIN AUX
193 ------------------------------------------
194 msp34x0b y n n n n n
195 msp34x0c y y n n n n
196 msp34x0d y y n n n n
197 msp34x5d y y n n n n
198 msp34x7d n n n n n n
199 msp34x0g y y n n n n
200 msp34x1g y y n n n n
201 msp34x2g y y n y y y
202 msp34x5g y y n n n n
203 msp34x7g n n n n n n
204 msp44x0g y y y y y y
205 msp44x8g y y y n n n
206 */
207
208/* DSP outputs vs. msp version */
209/* Chip MAIN AUX SCART1 SCART2 I2S
210 ------------------------------------
211 msp34x0b y y y n y
212 msp34x0c y y y n y
213 msp34x0d y y y y y
214 msp34x5d y n y n y
215 msp34x7d y n y n n
216 msp34x0g y y y y y
217 msp34x1g y y y y y
218 msp34x2g y y y y y
219 msp34x5g y n y n y
220 msp34x7g y n y n n
221 msp44x0g y y y y y
222 msp44x8g y y y y y
223 */
224
225#endif /* MSP3400_H */
226
diff --git a/include/media/rds.h b/include/media/rds.h
new file mode 100644
index 000000000000..951c1ae0be74
--- /dev/null
+++ b/include/media/rds.h
@@ -0,0 +1,44 @@
1/*
2
3 Types and defines needed for RDS. This is included by
4 saa6588.c and every driver (e.g. bttv-driver.c) that wants
5 to use the saa6588 module.
6
7 Instead of having a seperate rds.h, I'd prefer to include
8 this stuff in one of the already existing files like tuner.h
9
10 (c) 2005 by Hans J. Koch
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
26*/
27
28#ifndef _RDS_H
29#define _RDS_H
30
31struct rds_command {
32 unsigned int block_count;
33 int result;
34 unsigned char __user *buffer;
35 struct file *instance;
36 poll_table *event_list;
37};
38
39#define RDS_CMD_OPEN _IOW('R',1,int)
40#define RDS_CMD_CLOSE _IOW('R',2,int)
41#define RDS_CMD_READ _IOR('R',3,int)
42#define RDS_CMD_POLL _IOR('R',4,int)
43
44#endif
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 2bc634fcb7bb..fee579f10b32 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -11,6 +11,8 @@
11#include <linux/i2c.h> /* for i2c subsystem */ 11#include <linux/i2c.h> /* for i2c subsystem */
12#include <asm/io.h> /* for accessing devices */ 12#include <asm/io.h> /* for accessing devices */
13#include <linux/stringify.h> 13#include <linux/stringify.h>
14#include <linux/mutex.h>
15
14#include <linux/vmalloc.h> /* for vmalloc() */ 16#include <linux/vmalloc.h> /* for vmalloc() */
15#include <linux/mm.h> /* for vmalloc_to_page() */ 17#include <linux/mm.h> /* for vmalloc_to_page() */
16 18
@@ -112,7 +114,7 @@ struct saa7146_dev
112 114
113 /* different device locks */ 115 /* different device locks */
114 spinlock_t slock; 116 spinlock_t slock;
115 struct semaphore lock; 117 struct mutex lock;
116 118
117 unsigned char __iomem *mem; /* pointer to mapped IO memory */ 119 unsigned char __iomem *mem; /* pointer to mapped IO memory */
118 int revision; /* chip revision; needed for bug-workarounds*/ 120 int revision; /* chip revision; needed for bug-workarounds*/
@@ -133,15 +135,16 @@ struct saa7146_dev
133 void (*vv_callback)(struct saa7146_dev *dev, unsigned long status); 135 void (*vv_callback)(struct saa7146_dev *dev, unsigned long status);
134 136
135 /* i2c-stuff */ 137 /* i2c-stuff */
136 struct semaphore i2c_lock; 138 struct mutex i2c_lock;
137 u32 i2c_bitrate; 139
138 struct saa7146_dma d_i2c; /* pointer to i2c memory */ 140 u32 i2c_bitrate;
139 wait_queue_head_t i2c_wq; 141 struct saa7146_dma d_i2c; /* pointer to i2c memory */
140 int i2c_op; 142 wait_queue_head_t i2c_wq;
143 int i2c_op;
141 144
142 /* memories */ 145 /* memories */
143 struct saa7146_dma d_rps0; 146 struct saa7146_dma d_rps0;
144 struct saa7146_dma d_rps1; 147 struct saa7146_dma d_rps1;
145}; 148};
146 149
147/* from saa7146_i2c.c */ 150/* from saa7146_i2c.c */
@@ -150,7 +153,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *saa, const struct i2c_msg *msgs, in
150 153
151/* from saa7146_core.c */ 154/* from saa7146_core.c */
152extern struct list_head saa7146_devices; 155extern struct list_head saa7146_devices;
153extern struct semaphore saa7146_devices_lock; 156extern struct mutex saa7146_devices_lock;
154int saa7146_register_extension(struct saa7146_extension*); 157int saa7146_register_extension(struct saa7146_extension*);
155int saa7146_unregister_extension(struct saa7146_extension*); 158int saa7146_unregister_extension(struct saa7146_extension*);
156struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc); 159struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc);
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index e5e749e984ee..4507cb61ae93 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -197,7 +197,8 @@ void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,
197void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); 197void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi);
198int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); 198int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf);
199void saa7146_buffer_timeout(unsigned long data); 199void saa7146_buffer_timeout(unsigned long data);
200void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf); 200void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q,
201 struct saa7146_buf *buf);
201 202
202int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); 203int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv);
203int saa7146_vv_release(struct saa7146_dev* dev); 204int saa7146_vv_release(struct saa7146_dev* dev);
diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h
index 15821ab14a9e..ad9c171bfa07 100644
--- a/include/media/tuner-types.h
+++ b/include/media/tuner-types.h
@@ -14,6 +14,7 @@ enum param_type {
14 14
15struct tuner_range { 15struct tuner_range {
16 unsigned short limit; 16 unsigned short limit;
17 unsigned char config;
17 unsigned char cb; 18 unsigned char cb;
18}; 19};
19 20
@@ -38,7 +39,6 @@ struct tuner_params {
38 * static unless the control byte was sent first. 39 * static unless the control byte was sent first.
39 */ 40 */
40 unsigned int cb_first_if_lower_freq:1; 41 unsigned int cb_first_if_lower_freq:1;
41 unsigned char config; /* to be moved into struct tuner_range for dvb-pll merge */
42 42
43 unsigned int count; 43 unsigned int count;
44 struct tuner_range *ranges; 44 struct tuner_range *ranges;
@@ -46,6 +46,7 @@ struct tuner_params {
46 46
47struct tunertype { 47struct tunertype {
48 char *name; 48 char *name;
49 unsigned int count;
49 struct tuner_params *params; 50 struct tuner_params *params;
50}; 51};
51 52
diff --git a/include/media/tuner.h b/include/media/tuner.h
index a5beeac495c7..017fed7d5e4d 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -110,12 +110,15 @@
110 110
111#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */ 111#define TUNER_LG_TDVS_H062F 64 /* DViCO FusionHDTV 5 */
112#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */ 112#define TUNER_YMEC_TVF66T5_B_DFF 65 /* Acorp Y878F */
113#define TUNER_LG_NTSC_TALN_MINI 66 113#define TUNER_LG_TALN 66
114#define TUNER_PHILIPS_TD1316 67 114#define TUNER_PHILIPS_TD1316 67
115 115
116#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */ 116#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */
117#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */ 117#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */
118#define TUNER_SAMSUNG_TCPN_2121P30A 70 /* Hauppauge PVR-500MCE NTSC */ 118#define TUNER_SAMSUNG_TCPN_2121P30A 70 /* Hauppauge PVR-500MCE NTSC */
119#define TUNER_XCEIVE_XC3028 71
120
121#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */
119 122
120/* tv card specific */ 123/* tv card specific */
121#define TDA9887_PRESENT (1<<0) 124#define TDA9887_PRESENT (1<<0)
@@ -209,6 +212,7 @@ struct tuner {
209extern unsigned const int tuner_count; 212extern unsigned const int tuner_count;
210 213
211extern int microtune_init(struct i2c_client *c); 214extern int microtune_init(struct i2c_client *c);
215extern int xc3028_init(struct i2c_client *c);
212extern int tda8290_init(struct i2c_client *c); 216extern int tda8290_init(struct i2c_client *c);
213extern int tda8290_probe(struct i2c_client *c); 217extern int tda8290_probe(struct i2c_client *c);
214extern int tea5767_tuner_init(struct i2c_client *c); 218extern int tea5767_tuner_init(struct i2c_client *c);
diff --git a/include/media/tvaudio.h b/include/media/tvaudio.h
new file mode 100644
index 000000000000..6915aafc875a
--- /dev/null
+++ b/include/media/tvaudio.h
@@ -0,0 +1,30 @@
1/*
2 tvaudio.h - definition for tvaudio inputs
3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _TVAUDIO_H
22#define _TVAUDIO_H
23
24/* The tvaudio module accepts the following inputs: */
25#define TVAUDIO_INPUT_TUNER 0
26#define TVAUDIO_INPUT_RADIO 1
27#define TVAUDIO_INPUT_EXTERN 2
28#define TVAUDIO_INPUT_INTERN 3
29
30#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index d4030a7e16e0..642520acdfa7 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -58,6 +58,9 @@
58/* Prints the ioctl in a human-readable format */ 58/* Prints the ioctl in a human-readable format */
59extern void v4l_printk_ioctl(unsigned int cmd); 59extern void v4l_printk_ioctl(unsigned int cmd);
60 60
61/* Prints the ioctl and arg in a human-readable format */
62extern void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg);
63
61/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */ 64/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
62#define v4l_print_ioctl(name, cmd) \ 65#define v4l_print_ioctl(name, cmd) \
63 do { \ 66 do { \
@@ -100,6 +103,7 @@ enum v4l2_chip_ident {
100 V4L2_IDENT_UNKNOWN = 0, 103 V4L2_IDENT_UNKNOWN = 0,
101 104
102 /* module saa7115: reserved range 100-149 */ 105 /* module saa7115: reserved range 100-149 */
106 V4L2_IDENT_SAA7113 = 103,
103 V4L2_IDENT_SAA7114 = 104, 107 V4L2_IDENT_SAA7114 = 104,
104 V4L2_IDENT_SAA7115 = 105, 108 V4L2_IDENT_SAA7115 = 105,
105 109
@@ -115,25 +119,30 @@ enum v4l2_chip_ident {
115}; 119};
116 120
117/* audio ioctls */ 121/* 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 122
123/* msp3400 ioctl: will be removed in the near future */ 123/* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */
124struct msp_matrix { 124#define AUDC_SET_RADIO _IO('d',88)
125 int input;
126 int output;
127};
128#define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix)
129 125
130/* tuner ioctls */ 126/* tuner ioctls */
127
131/* Sets tuner type and its I2C addr */ 128/* Sets tuner type and its I2C addr */
132#define TUNER_SET_TYPE_ADDR _IOW('d',90,int) 129#define TUNER_SET_TYPE_ADDR _IOW('d', 90, int)
133/* Puts tuner on powersaving state, disabling it, except for i2c */ 130
134#define TUNER_SET_STANDBY _IOW('d',91,int) 131/* Puts tuner on powersaving state, disabling it, except for i2c. To be replaced
132 by VIDIOC_INT_S_STANDBY. */
133#define TUNER_SET_STANDBY _IOW('d', 91, int)
134
135/* Sets tda9887 specific stuff, like port1, port2 and qss */ 135/* Sets tda9887 specific stuff, like port1, port2 and qss */
136#define TDA9887_SET_CONFIG _IOW('d',92,int) 136#define TDA9887_SET_CONFIG _IOW('d', 92, int)
137
138/* Switch the tuner to a specific tuner mode. Replacement of AUDC_SET_RADIO */
139#define VIDIOC_INT_S_TUNER_MODE _IOW('d', 93, enum v4l2_tuner_type)
140
141/* Generic standby command. Passing -1 (all bits set to 1) will put the whole
142 chip into standby mode, value 0 will make the chip fully active. Specific
143 bits can be used by certain chips to enable/disable specific subsystems.
144 Replacement of TUNER_SET_STANDBY. */
145#define VIDIOC_INT_S_STANDBY _IOW('d', 94, u32)
137 146
138/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 147/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
139#define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register) 148#define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register)
@@ -160,7 +169,8 @@ struct msp_matrix {
160 169
161/* Used to generate VBI signals on a video signal. v4l2_sliced_vbi_data is 170/* Used to generate VBI signals on a video signal. v4l2_sliced_vbi_data is
162 filled with the data packets that should be output. Note that if you set 171 filled with the data packets that should be output. Note that if you set
163 the line field to 0, then that VBI signal is disabled. */ 172 the line field to 0, then that VBI signal is disabled. If no
173 valid VBI data was found, then the type field is set to 0 on return. */
164#define VIDIOC_INT_S_VBI_DATA _IOW ('d', 105, struct v4l2_sliced_vbi_data) 174#define VIDIOC_INT_S_VBI_DATA _IOW ('d', 105, struct v4l2_sliced_vbi_data)
165 175
166/* Used to obtain the sliced VBI packet from a readback register. Not all 176/* Used to obtain the sliced VBI packet from a readback register. Not all
@@ -168,11 +178,11 @@ struct msp_matrix {
168 register contains invalid or erroneous data -EIO is returned. Note that 178 register contains invalid or erroneous data -EIO is returned. Note that
169 you must fill in the 'id' member and the 'field' member (to determine 179 you must fill in the 'id' member and the 'field' member (to determine
170 whether CC data from the first or second field should be obtained). */ 180 whether CC data from the first or second field should be obtained). */
171#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data *) 181#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data)
172 182
173/* Returns the chip identifier or V4L2_IDENT_UNKNOWN if no identification can 183/* Returns the chip identifier or V4L2_IDENT_UNKNOWN if no identification can
174 be made. */ 184 be made. */
175#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *) 185#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident)
176 186
177/* Sets I2S speed in bps. This is used to provide a standard way to select I2S 187/* 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. 188 clock used by driving digital audio streams at some board designs.
@@ -180,4 +190,25 @@ struct msp_matrix {
180 If the frequency is not supported, then -EINVAL is returned. */ 190 If the frequency is not supported, then -EINVAL is returned. */
181#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32) 191#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32)
182 192
193/* Routing definition, device dependent. It specifies which inputs (if any)
194 should be routed to which outputs (if any). */
195struct v4l2_routing {
196 u32 input;
197 u32 output;
198};
199
200/* These internal commands should be used to define the inputs and outputs
201 of an audio/video chip. They will replace the v4l2 API commands
202 VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT
203 that are meant to be used by the user.
204 The internal commands should be used to switch inputs/outputs
205 because only the driver knows how to map a 'Television' input to the precise
206 input/output routing of an A/D converter, or a DSP, or a video digitizer.
207 These four commands should only be sent directly to an i2c device, they
208 should not be broadcast as the routing is very device specific. */
209#define VIDIOC_INT_S_AUDIO_ROUTING _IOW ('d', 109, struct v4l2_routing)
210#define VIDIOC_INT_G_AUDIO_ROUTING _IOR ('d', 110, struct v4l2_routing)
211#define VIDIOC_INT_S_VIDEO_ROUTING _IOW ('d', 111, struct v4l2_routing)
212#define VIDIOC_INT_G_VIDEO_ROUTING _IOR ('d', 112, struct v4l2_routing)
213
183#endif /* V4L2_COMMON_H_ */ 214#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/video-buf-dvb.h b/include/media/video-buf-dvb.h
index ad0a07a3a895..b78d90fe629f 100644
--- a/include/media/video-buf-dvb.h
+++ b/include/media/video-buf-dvb.h
@@ -11,7 +11,7 @@ struct videobuf_dvb {
11 struct videobuf_queue dvbq; 11 struct videobuf_queue dvbq;
12 12
13 /* video-buf-dvb state info */ 13 /* video-buf-dvb state info */
14 struct semaphore lock; 14 struct mutex lock;
15 struct task_struct *thread; 15 struct task_struct *thread;
16 int nfeeds; 16 int nfeeds;
17 17
diff --git a/include/media/video-buf.h b/include/media/video-buf.h
index 8ecfd78e0027..fff3fd0fbf94 100644
--- a/include/media/video-buf.h
+++ b/include/media/video-buf.h
@@ -1,15 +1,20 @@
1/* 1/*
2 * 2 *
3 * generic helper functions for video4linux capture buffers, to handle 3 * generic helper functions for video4linux capture buffers, to handle
4 * memory management and PCI DMA. Right now bttv + saa7134 use it. 4 * memory management and PCI DMA.
5 * Right now, bttv, saa7134, saa7146 and cx88 use it.
5 * 6 *
6 * The functions expect the hardware being able to scatter gatter 7 * The functions expect the hardware being able to scatter gatter
7 * (i.e. the buffers are not linear in physical memory, but fragmented 8 * (i.e. the buffers are not linear in physical memory, but fragmented
8 * into PAGE_SIZE chunks). They also assume the driver does not need 9 * into PAGE_SIZE chunks). They also assume the driver does not need
9 * to touch the video data (thus it is probably not useful for USB as 10 * to touch the video data.
10 * data often must be uncompressed by the drivers). 11 *
12 * device specific map/unmap/sync stuff now are mapped as file operations
13 * to allow its usage by USB and virtual devices.
11 * 14 *
12 * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> 15 * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org>
16 * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org>
17 * (c) 2006 Ted Walther and John Sokol
13 * 18 *
14 * This program is free software; you can redistribute it and/or modify 19 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by 20 * it under the terms of the GNU General Public License as published by
@@ -38,6 +43,9 @@ struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages);
38struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, 43struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages,
39 int offset); 44 int offset);
40 45
46struct videobuf_buffer;
47struct videobuf_queue;
48
41/* --------------------------------------------------------------------- */ 49/* --------------------------------------------------------------------- */
42 50
43/* 51/*
@@ -49,7 +57,7 @@ struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages,
49 * pointer + length. The kernel version just wants the size and 57 * pointer + length. The kernel version just wants the size and
50 * does memory allocation too using vmalloc_32(). 58 * does memory allocation too using vmalloc_32().
51 * 59 *
52 * videobuf_dma_pci_*() 60 * videobuf_dma_*()
53 * see Documentation/DMA-mapping.txt, these functions to 61 * see Documentation/DMA-mapping.txt, these functions to
54 * basically the same. The map function does also build a 62 * basically the same. The map function does also build a
55 * scatterlist for the buffer (and unmap frees it ...) 63 * scatterlist for the buffer (and unmap frees it ...)
@@ -86,12 +94,18 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction,
86 int nr_pages); 94 int nr_pages);
87int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, 95int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
88 dma_addr_t addr, int nr_pages); 96 dma_addr_t addr, int nr_pages);
89int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma);
90int videobuf_dma_pci_sync(struct pci_dev *dev,
91 struct videobuf_dmabuf *dma);
92int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma);
93int videobuf_dma_free(struct videobuf_dmabuf *dma); 97int videobuf_dma_free(struct videobuf_dmabuf *dma);
94 98
99int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma);
100int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma);
101int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma);
102
103 /*FIXME: these variants are used only on *-alsa code, where videobuf is
104 * used without queue
105 */
106int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma);
107int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma);
108
95/* --------------------------------------------------------------------- */ 109/* --------------------------------------------------------------------- */
96 110
97/* 111/*
@@ -115,9 +129,6 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma);
115 * 129 *
116 */ 130 */
117 131
118struct videobuf_buffer;
119struct videobuf_queue;
120
121struct videobuf_mapping { 132struct videobuf_mapping {
122 unsigned int count; 133 unsigned int count;
123 unsigned long start; 134 unsigned long start;
@@ -164,6 +175,10 @@ struct videobuf_buffer {
164 struct timeval ts; 175 struct timeval ts;
165}; 176};
166 177
178typedef int (vb_map_sg_t)(void *dev,struct scatterlist *sglist,int nr_pages,
179 int direction);
180
181
167struct videobuf_queue_ops { 182struct videobuf_queue_ops {
168 int (*buf_setup)(struct videobuf_queue *q, 183 int (*buf_setup)(struct videobuf_queue *q,
169 unsigned int *count, unsigned int *size); 184 unsigned int *count, unsigned int *size);
@@ -174,12 +189,20 @@ struct videobuf_queue_ops {
174 struct videobuf_buffer *vb); 189 struct videobuf_buffer *vb);
175 void (*buf_release)(struct videobuf_queue *q, 190 void (*buf_release)(struct videobuf_queue *q,
176 struct videobuf_buffer *vb); 191 struct videobuf_buffer *vb);
192
193 /* Helper operations - device dependent.
194 * If null, videobuf_init defaults all to PCI handling
195 */
196
197 vb_map_sg_t *vb_map_sg;
198 vb_map_sg_t *vb_dma_sync_sg;
199 vb_map_sg_t *vb_unmap_sg;
177}; 200};
178 201
179struct videobuf_queue { 202struct videobuf_queue {
180 struct semaphore lock; 203 struct mutex lock;
181 spinlock_t *irqlock; 204 spinlock_t *irqlock;
182 struct pci_dev *pci; 205 void *dev; /* on pci, points to struct pci_dev */
183 206
184 enum v4l2_buf_type type; 207 enum v4l2_buf_type type;
185 unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */ 208 unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */
@@ -204,12 +227,15 @@ struct videobuf_queue {
204 227
205void* videobuf_alloc(unsigned int size); 228void* videobuf_alloc(unsigned int size);
206int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); 229int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
207int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, 230int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb,
208 struct v4l2_framebuffer *fbuf); 231 struct v4l2_framebuffer *fbuf);
232
233/* Maps fops to PCI stuff */
234void videobuf_queue_pci(struct videobuf_queue* q);
209 235
210void videobuf_queue_init(struct videobuf_queue *q, 236void videobuf_queue_init(struct videobuf_queue *q,
211 struct videobuf_queue_ops *ops, 237 struct videobuf_queue_ops *ops,
212 struct pci_dev *pci, 238 void *dev,
213 spinlock_t *irqlock, 239 spinlock_t *irqlock,
214 enum v4l2_buf_type type, 240 enum v4l2_buf_type type,
215 enum v4l2_field field, 241 enum v4l2_field field,
diff --git a/include/media/wm8775.h b/include/media/wm8775.h
new file mode 100644
index 000000000000..60739c5a23ae
--- /dev/null
+++ b/include/media/wm8775.h
@@ -0,0 +1,35 @@
1/*
2 wm8775.h - definition for wm8775 inputs and outputs
3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _WM8775_H_
22#define _WM8775_H_
23
24/* The WM8775 has 4 inputs and one output. Zero or more inputs
25 are multiplexed together to the output. Hence there are
26 16 combinations.
27 If only one input is active (the normal case) then the
28 input values 1, 2, 4 or 8 should be used. */
29
30#define WM8775_AIN1 1
31#define WM8775_AIN2 2
32#define WM8775_AIN3 4
33#define WM8775_AIN4 8
34
35#endif
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index bfc1779fc753..427dac94bc7e 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -4,6 +4,7 @@
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/socket.h> 5#include <linux/socket.h>
6#include <linux/un.h> 6#include <linux/un.h>
7#include <linux/mutex.h>
7#include <net/sock.h> 8#include <net/sock.h>
8 9
9extern void unix_inflight(struct file *fp); 10extern void unix_inflight(struct file *fp);
@@ -71,7 +72,7 @@ struct unix_sock {
71 struct unix_address *addr; 72 struct unix_address *addr;
72 struct dentry *dentry; 73 struct dentry *dentry;
73 struct vfsmount *mnt; 74 struct vfsmount *mnt;
74 struct semaphore readsem; 75 struct mutex readlock;
75 struct sock *peer; 76 struct sock *peer;
76 struct sock *other; 77 struct sock *other;
77 struct sock *gc_tree; 78 struct sock *gc_tree;
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 2250a18b0cbb..d052b221dbcd 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -110,8 +110,15 @@ enum {
110enum { 110enum {
111 AX25_PROTO_STD_SIMPLEX, 111 AX25_PROTO_STD_SIMPLEX,
112 AX25_PROTO_STD_DUPLEX, 112 AX25_PROTO_STD_DUPLEX,
113#ifdef CONFIG_AX25_DAMA_SLAVE
113 AX25_PROTO_DAMA_SLAVE, 114 AX25_PROTO_DAMA_SLAVE,
114 AX25_PROTO_DAMA_MASTER 115#ifdef CONFIG_AX25_DAMA_MASTER
116 AX25_PROTO_DAMA_MASTER,
117#define AX25_PROTO_MAX AX25_PROTO_DAMA_MASTER
118#endif
119#endif
120 __AX25_PROTO_MAX,
121 AX25_PROTO_MAX = __AX25_PROTO_MAX -1
115}; 122};
116 123
117enum { 124enum {
diff --git a/include/net/compat.h b/include/net/compat.h
index 290bab46d457..8662b8f43df5 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -23,6 +23,9 @@ struct compat_cmsghdr {
23 compat_int_t cmsg_type; 23 compat_int_t cmsg_type;
24}; 24};
25 25
26struct sock;
27extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
28
26#else /* defined(CONFIG_COMPAT) */ 29#else /* defined(CONFIG_COMPAT) */
27#define compat_msghdr msghdr /* to avoid compiler warnings */ 30#define compat_msghdr msghdr /* to avoid compiler warnings */
28#endif /* defined(CONFIG_COMPAT) */ 31#endif /* defined(CONFIG_COMPAT) */
@@ -34,7 +37,6 @@ extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsi
34extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); 37extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
35extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); 38extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
36 39
37struct sock;
38extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int); 40extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
39 41
40#endif /* NET_COMPAT_H */ 42#endif /* NET_COMPAT_H */
diff --git a/include/net/dn.h b/include/net/dn.h
index a4b6168e1e25..465b78302782 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -6,10 +6,8 @@
6#include <net/tcp.h> 6#include <net/tcp.h>
7#include <asm/byteorder.h> 7#include <asm/byteorder.h>
8 8
9typedef unsigned short dn_address; 9#define dn_ntohs(x) le16_to_cpu(x)
10 10#define dn_htons(x) cpu_to_le16(x)
11#define dn_ntohs(x) le16_to_cpu((unsigned short)(x))
12#define dn_htons(x) cpu_to_le16((unsigned short)(x))
13 11
14struct dn_scp /* Session Control Port */ 12struct dn_scp /* Session Control Port */
15{ 13{
@@ -31,36 +29,36 @@ struct dn_scp /* Session Control Port */
31#define DN_CL 15 /* Closed */ 29#define DN_CL 15 /* Closed */
32#define DN_CN 16 /* Closed Notification */ 30#define DN_CN 16 /* Closed Notification */
33 31
34 unsigned short addrloc; 32 __le16 addrloc;
35 unsigned short addrrem; 33 __le16 addrrem;
36 unsigned short numdat; 34 __u16 numdat;
37 unsigned short numoth; 35 __u16 numoth;
38 unsigned short numoth_rcv; 36 __u16 numoth_rcv;
39 unsigned short numdat_rcv; 37 __u16 numdat_rcv;
40 unsigned short ackxmt_dat; 38 __u16 ackxmt_dat;
41 unsigned short ackxmt_oth; 39 __u16 ackxmt_oth;
42 unsigned short ackrcv_dat; 40 __u16 ackrcv_dat;
43 unsigned short ackrcv_oth; 41 __u16 ackrcv_oth;
44 unsigned char flowrem_sw; 42 __u8 flowrem_sw;
45 unsigned char flowloc_sw; 43 __u8 flowloc_sw;
46#define DN_SEND 2 44#define DN_SEND 2
47#define DN_DONTSEND 1 45#define DN_DONTSEND 1
48#define DN_NOCHANGE 0 46#define DN_NOCHANGE 0
49 unsigned short flowrem_dat; 47 __u16 flowrem_dat;
50 unsigned short flowrem_oth; 48 __u16 flowrem_oth;
51 unsigned short flowloc_dat; 49 __u16 flowloc_dat;
52 unsigned short flowloc_oth; 50 __u16 flowloc_oth;
53 unsigned char services_rem; 51 __u8 services_rem;
54 unsigned char services_loc; 52 __u8 services_loc;
55 unsigned char info_rem; 53 __u8 info_rem;
56 unsigned char info_loc; 54 __u8 info_loc;
57 55
58 unsigned short segsize_rem; 56 __u16 segsize_rem;
59 unsigned short segsize_loc; 57 __u16 segsize_loc;
60 58
61 unsigned char nonagle; 59 __u8 nonagle;
62 unsigned char multi_ireq; 60 __u8 multi_ireq;
63 unsigned char accept_mode; 61 __u8 accept_mode;
64 unsigned long seg_total; /* Running total of current segment */ 62 unsigned long seg_total; /* Running total of current segment */
65 63
66 struct optdata_dn conndata_in; 64 struct optdata_dn conndata_in;
@@ -160,40 +158,41 @@ static inline struct dn_scp *DN_SK(struct sock *sk)
160 */ 158 */
161#define DN_SKB_CB(skb) ((struct dn_skb_cb *)(skb)->cb) 159#define DN_SKB_CB(skb) ((struct dn_skb_cb *)(skb)->cb)
162struct dn_skb_cb { 160struct dn_skb_cb {
163 unsigned short dst; 161 __le16 dst;
164 unsigned short src; 162 __le16 src;
165 unsigned short hops; 163 __u16 hops;
166 unsigned short dst_port; 164 __le16 dst_port;
167 unsigned short src_port; 165 __le16 src_port;
168 unsigned char services; 166 __u8 services;
169 unsigned char info; 167 __u8 info;
170 unsigned char rt_flags; 168 __u8 rt_flags;
171 unsigned char nsp_flags; 169 __u8 nsp_flags;
172 unsigned short segsize; 170 __u16 segsize;
173 unsigned short segnum; 171 __u16 segnum;
174 unsigned short xmit_count; 172 __u16 xmit_count;
175 unsigned long stamp; 173 unsigned long stamp;
176 int iif; 174 int iif;
177}; 175};
178 176
179static inline dn_address dn_eth2dn(unsigned char *ethaddr) 177static inline __le16 dn_eth2dn(unsigned char *ethaddr)
180{ 178{
181 return ethaddr[4] | (ethaddr[5] << 8); 179 return dn_htons(ethaddr[4] | (ethaddr[5] << 8));
182} 180}
183 181
184static inline dn_address dn_saddr2dn(struct sockaddr_dn *saddr) 182static inline __le16 dn_saddr2dn(struct sockaddr_dn *saddr)
185{ 183{
186 return *(dn_address *)saddr->sdn_nodeaddr; 184 return *(__le16 *)saddr->sdn_nodeaddr;
187} 185}
188 186
189static inline void dn_dn2eth(unsigned char *ethaddr, dn_address addr) 187static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr)
190{ 188{
189 __u16 a = dn_ntohs(addr);
191 ethaddr[0] = 0xAA; 190 ethaddr[0] = 0xAA;
192 ethaddr[1] = 0x00; 191 ethaddr[1] = 0x00;
193 ethaddr[2] = 0x04; 192 ethaddr[2] = 0x04;
194 ethaddr[3] = 0x00; 193 ethaddr[3] = 0x00;
195 ethaddr[4] = (unsigned char)(addr & 0xff); 194 ethaddr[4] = (__u8)(a & 0xff);
196 ethaddr[5] = (unsigned char)(addr >> 8); 195 ethaddr[5] = (__u8)(a >> 8);
197} 196}
198 197
199static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp) 198static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp)
@@ -202,7 +201,7 @@ static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp)
202 fl->uli_u.dnports.dport = scp->addrrem; 201 fl->uli_u.dnports.dport = scp->addrrem;
203 fl->uli_u.dnports.objnum = scp->addr.sdn_objnum; 202 fl->uli_u.dnports.objnum = scp->addr.sdn_objnum;
204 if (fl->uli_u.dnports.objnum == 0) { 203 if (fl->uli_u.dnports.objnum == 0) {
205 fl->uli_u.dnports.objnamel = scp->addr.sdn_objnamel; 204 fl->uli_u.dnports.objnamel = (__u8)dn_ntohs(scp->addr.sdn_objnamel);
206 memcpy(fl->uli_u.dnports.objname, scp->addr.sdn_objname, 16); 205 memcpy(fl->uli_u.dnports.objname, scp->addr.sdn_objname, 16);
207 } 206 }
208} 207}
@@ -217,7 +216,7 @@ extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu);
217extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr); 216extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr);
218extern struct sock *dn_find_by_skb(struct sk_buff *skb); 217extern struct sock *dn_find_by_skb(struct sk_buff *skb);
219#define DN_ASCBUF_LEN 9 218#define DN_ASCBUF_LEN 9
220extern char *dn_addr2asc(dn_address, char *); 219extern char *dn_addr2asc(__u16, char *);
221extern int dn_destroy_timer(struct sock *sk); 220extern int dn_destroy_timer(struct sock *sk);
222 221
223extern int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf, unsigned char type); 222extern int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf, unsigned char type);
@@ -226,7 +225,7 @@ extern int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn
226extern void dn_start_slow_timer(struct sock *sk); 225extern void dn_start_slow_timer(struct sock *sk);
227extern void dn_stop_slow_timer(struct sock *sk); 226extern void dn_stop_slow_timer(struct sock *sk);
228 227
229extern dn_address decnet_address; 228extern __le16 decnet_address;
230extern int decnet_debug_level; 229extern int decnet_debug_level;
231extern int decnet_time_wait; 230extern int decnet_time_wait;
232extern int decnet_dn_count; 231extern int decnet_dn_count;
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h
index 5a86e78081bf..cee46821dc53 100644
--- a/include/net/dn_dev.h
+++ b/include/net/dn_dev.h
@@ -7,11 +7,11 @@ struct dn_dev;
7struct dn_ifaddr { 7struct dn_ifaddr {
8 struct dn_ifaddr *ifa_next; 8 struct dn_ifaddr *ifa_next;
9 struct dn_dev *ifa_dev; 9 struct dn_dev *ifa_dev;
10 dn_address ifa_local; 10 __le16 ifa_local;
11 dn_address ifa_address; 11 __le16 ifa_address;
12 unsigned char ifa_flags; 12 __u8 ifa_flags;
13 unsigned char ifa_scope; 13 __u8 ifa_scope;
14 char ifa_label[IFNAMSIZ]; 14 char ifa_label[IFNAMSIZ];
15}; 15};
16 16
17#define DN_DEV_S_RU 0 /* Run - working normally */ 17#define DN_DEV_S_RU 0 /* Run - working normally */
@@ -91,7 +91,7 @@ struct dn_dev {
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 __u8 addr[ETH_ALEN];
95 struct neighbour *router; /* Default router on circuit */ 95 struct neighbour *router; /* Default router on circuit */
96 struct neighbour *peer; /* Peer on pointopoint links */ 96 struct neighbour *peer; /* Peer on pointopoint links */
97 unsigned long uptime; /* Time device went up in jiffies */ 97 unsigned long uptime; /* Time device went up in jiffies */
@@ -99,56 +99,56 @@ struct dn_dev {
99 99
100struct dn_short_packet 100struct dn_short_packet
101{ 101{
102 unsigned char msgflg; 102 __u8 msgflg;
103 unsigned short dstnode; 103 __le16 dstnode;
104 unsigned short srcnode; 104 __le16 srcnode;
105 unsigned char forward; 105 __u8 forward;
106} __attribute__((packed)); 106} __attribute__((packed));
107 107
108struct dn_long_packet 108struct dn_long_packet
109{ 109{
110 unsigned char msgflg; 110 __u8 msgflg;
111 unsigned char d_area; 111 __u8 d_area;
112 unsigned char d_subarea; 112 __u8 d_subarea;
113 unsigned char d_id[6]; 113 __u8 d_id[6];
114 unsigned char s_area; 114 __u8 s_area;
115 unsigned char s_subarea; 115 __u8 s_subarea;
116 unsigned char s_id[6]; 116 __u8 s_id[6];
117 unsigned char nl2; 117 __u8 nl2;
118 unsigned char visit_ct; 118 __u8 visit_ct;
119 unsigned char s_class; 119 __u8 s_class;
120 unsigned char pt; 120 __u8 pt;
121} __attribute__((packed)); 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; 127 __u8 msgflg;
128 unsigned char tiver[3]; 128 __u8 tiver[3];
129 unsigned char id[6]; 129 __u8 id[6];
130 unsigned char iinfo; 130 __u8 iinfo;
131 unsigned short blksize; 131 __le16 blksize;
132 unsigned char area; 132 __u8 area;
133 unsigned char seed[8]; 133 __u8 seed[8];
134 unsigned char neighbor[6]; 134 __u8 neighbor[6];
135 unsigned short timer; 135 __le16 timer;
136 unsigned char mpd; 136 __u8 mpd;
137 unsigned char datalen; 137 __u8 datalen;
138 unsigned char data[2]; 138 __u8 data[2];
139} __attribute__((packed)); 139} __attribute__((packed));
140 140
141struct rtnode_hello_message 141struct rtnode_hello_message
142{ 142{
143 unsigned char msgflg; 143 __u8 msgflg;
144 unsigned char tiver[3]; 144 __u8 tiver[3];
145 unsigned char id[6]; 145 __u8 id[6];
146 unsigned char iinfo; 146 __u8 iinfo;
147 unsigned short blksize; 147 __le16 blksize;
148 unsigned char priority; 148 __u8 priority;
149 unsigned char area; 149 __u8 area;
150 unsigned short timer; 150 __le16 timer;
151 unsigned char mpd; 151 __u8 mpd;
152} __attribute__((packed)); 152} __attribute__((packed));
153 153
154 154
@@ -169,12 +169,12 @@ extern void dn_dev_down(struct net_device *);
169 169
170extern int dn_dev_set_default(struct net_device *dev, int force); 170extern int dn_dev_set_default(struct net_device *dev, int force);
171extern struct net_device *dn_dev_get_default(void); 171extern struct net_device *dn_dev_get_default(void);
172extern int dn_dev_bind_default(dn_address *addr); 172extern int dn_dev_bind_default(__le16 *addr);
173 173
174extern int register_dnaddr_notifier(struct notifier_block *nb); 174extern int register_dnaddr_notifier(struct notifier_block *nb);
175extern int unregister_dnaddr_notifier(struct notifier_block *nb); 175extern int unregister_dnaddr_notifier(struct notifier_block *nb);
176 176
177static inline int dn_dev_islocal(struct net_device *dev, dn_address addr) 177static inline int dn_dev_islocal(struct net_device *dev, __le16 addr)
178{ 178{
179 struct dn_dev *dn_db = dev->dn_ptr; 179 struct dn_dev *dn_db = dev->dn_ptr;
180 struct dn_ifaddr *ifa; 180 struct dn_ifaddr *ifa;
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index cd3c96d9601b..a15dcf0d5c1e 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -37,7 +37,7 @@ struct dn_fib_nh {
37 int nh_weight; 37 int nh_weight;
38 int nh_power; 38 int nh_power;
39 int nh_oif; 39 int nh_oif;
40 u32 nh_gw; 40 __le16 nh_gw;
41}; 41};
42 42
43struct dn_fib_info { 43struct dn_fib_info {
@@ -48,7 +48,7 @@ struct dn_fib_info {
48 int fib_dead; 48 int fib_dead;
49 unsigned fib_flags; 49 unsigned fib_flags;
50 int fib_protocol; 50 int fib_protocol;
51 dn_address fib_prefsrc; 51 __le16 fib_prefsrc;
52 __u32 fib_priority; 52 __u32 fib_priority;
53 __u32 fib_metrics[RTAX_MAX]; 53 __u32 fib_metrics[RTAX_MAX];
54#define dn_fib_mtu fib_metrics[RTAX_MTU-1] 54#define dn_fib_mtu fib_metrics[RTAX_MTU-1]
@@ -71,15 +71,15 @@ struct dn_fib_info {
71#define DN_FIB_RES_OIF(res) (DN_FIB_RES_NH(res).nh_oif) 71#define DN_FIB_RES_OIF(res) (DN_FIB_RES_NH(res).nh_oif)
72 72
73typedef struct { 73typedef struct {
74 u16 datum; 74 __le16 datum;
75} dn_fib_key_t; 75} dn_fib_key_t;
76 76
77typedef struct { 77typedef struct {
78 u16 datum; 78 __le16 datum;
79} dn_fib_hash_t; 79} dn_fib_hash_t;
80 80
81typedef struct { 81typedef struct {
82 u16 datum; 82 __u16 datum;
83} dn_fib_idx_t; 83} dn_fib_idx_t;
84 84
85struct dn_fib_node { 85struct dn_fib_node {
@@ -126,11 +126,11 @@ extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi,
126 const struct flowi *fl, 126 const struct flowi *fl,
127 struct dn_fib_res *res); 127 struct dn_fib_res *res);
128extern void dn_fib_release_info(struct dn_fib_info *fi); 128extern void dn_fib_release_info(struct dn_fib_info *fi);
129extern u16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); 129extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type);
130extern void dn_fib_flush(void); 130extern void dn_fib_flush(void);
131extern void dn_fib_select_multipath(const struct flowi *fl, 131extern void dn_fib_select_multipath(const struct flowi *fl,
132 struct dn_fib_res *res); 132 struct dn_fib_res *res);
133extern int dn_fib_sync_down(dn_address local, struct net_device *dev, 133extern int dn_fib_sync_down(__le16 local, struct net_device *dev,
134 int force); 134 int force);
135extern int dn_fib_sync_up(struct net_device *dev); 135extern int dn_fib_sync_up(struct net_device *dev);
136 136
@@ -148,8 +148,8 @@ extern void dn_fib_table_cleanup(void);
148extern void dn_fib_rules_init(void); 148extern void dn_fib_rules_init(void);
149extern void dn_fib_rules_cleanup(void); 149extern void dn_fib_rules_cleanup(void);
150extern void dn_fib_rule_put(struct dn_fib_rule *); 150extern void dn_fib_rule_put(struct dn_fib_rule *);
151extern __u16 dn_fib_rules_policy(__u16 saddr, struct dn_fib_res *res, unsigned *flags); 151extern __le16 dn_fib_rules_policy(__le16 saddr, struct dn_fib_res *res, unsigned *flags);
152extern unsigned dnet_addr_type(__u16 addr); 152extern unsigned dnet_addr_type(__le16 addr);
153extern int dn_fib_lookup(const struct flowi *fl, struct dn_fib_res *res); 153extern int dn_fib_lookup(const struct flowi *fl, struct dn_fib_res *res);
154 154
155/* 155/*
@@ -194,10 +194,10 @@ extern struct dn_fib_table *dn_fib_tables[];
194 194
195#endif /* CONFIG_DECNET_ROUTER */ 195#endif /* CONFIG_DECNET_ROUTER */
196 196
197static inline u16 dnet_make_mask(int n) 197static inline __le16 dnet_make_mask(int n)
198{ 198{
199 if (n) 199 if (n)
200 return htons(~((1<<(16-n))-1)); 200 return dn_htons(~((1<<(16-n))-1));
201 return 0; 201 return 0;
202} 202}
203 203
diff --git a/include/net/dn_neigh.h b/include/net/dn_neigh.h
index 4b1eb038d637..4cb4ae7fb81f 100644
--- a/include/net/dn_neigh.h
+++ b/include/net/dn_neigh.h
@@ -7,13 +7,13 @@
7 */ 7 */
8struct dn_neigh { 8struct dn_neigh {
9 struct neighbour n; 9 struct neighbour n;
10 dn_address addr; 10 __le16 addr;
11 unsigned long flags; 11 unsigned long flags;
12#define DN_NDFLAG_R1 0x0001 /* Router L1 */ 12#define DN_NDFLAG_R1 0x0001 /* Router L1 */
13#define DN_NDFLAG_R2 0x0002 /* Router L2 */ 13#define DN_NDFLAG_R2 0x0002 /* Router L2 */
14#define DN_NDFLAG_P3 0x0004 /* Phase III Node */ 14#define DN_NDFLAG_P3 0x0004 /* Phase III Node */
15 unsigned long blksize; 15 unsigned long blksize;
16 unsigned char priority; 16 __u8 priority;
17}; 17};
18 18
19extern void dn_neigh_init(void); 19extern void dn_neigh_init(void);
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h
index e6182b86262b..96e816b6974d 100644
--- a/include/net/dn_nsp.h
+++ b/include/net/dn_nsp.h
@@ -72,77 +72,77 @@ 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; 75 __u8 msgflg;
76 unsigned short dstaddr; 76 __le16 dstaddr;
77 unsigned short srcaddr; 77 __le16 srcaddr;
78} __attribute__((packed)); 78} __attribute__((packed));
79 79
80struct nsp_data_opt_msg 80struct nsp_data_opt_msg
81{ 81{
82 unsigned short acknum; 82 __le16 acknum;
83 unsigned short segnum; 83 __le16 segnum;
84 unsigned short lsflgs; 84 __le16 lsflgs;
85} __attribute__((packed)); 85} __attribute__((packed));
86 86
87struct nsp_data_opt_msg1 87struct nsp_data_opt_msg1
88{ 88{
89 unsigned short acknum; 89 __le16 acknum;
90 unsigned short segnum; 90 __le16 segnum;
91} __attribute__((packed)); 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; 97 __u8 msgflg;
98 unsigned short dstaddr; 98 __le16 dstaddr;
99 unsigned short srcaddr; 99 __le16 srcaddr;
100 unsigned short acknum; 100 __le16 acknum;
101} __attribute__((packed)); 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; 106 __u8 msgflg;
107 unsigned short dstaddr; 107 __le16 dstaddr;
108} __attribute__((packed)); 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; 114 __u8 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; 117 __le16 dstaddr;
118 unsigned short srcaddr; 118 __le16 srcaddr;
119 unsigned char services; 119 __u8 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; 124 __u8 info;
125 unsigned short segsize; 125 __le16 segsize;
126} __attribute__((packed)); 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; 131 __u8 msgflg;
132 unsigned short dstaddr; 132 __le16 dstaddr;
133 unsigned short srcaddr; 133 __le16 srcaddr;
134 unsigned short reason; 134 __le16 reason;
135} __attribute__((packed)); 135} __attribute__((packed));
136 136
137 137
138 138
139struct srcobj_fmt 139struct srcobj_fmt
140{ 140{
141 char format; 141 __u8 format;
142 unsigned char task; 142 __u8 task;
143 unsigned short grpcode; 143 __le16 grpcode;
144 unsigned short usrcode; 144 __le16 usrcode;
145 char dlen; 145 __u8 dlen;
146} __attribute__((packed)); 146} __attribute__((packed));
147 147
148/* 148/*
@@ -150,7 +150,7 @@ struct srcobj_fmt
150 * numbers used in NSP. Similar in operation to the functions 150 * numbers used in NSP. Similar in operation to the functions
151 * of the same name in TCP. 151 * of the same name in TCP.
152 */ 152 */
153static __inline__ int dn_before(unsigned short seq1, unsigned short seq2) 153static __inline__ int dn_before(__u16 seq1, __u16 seq2)
154{ 154{
155 seq1 &= 0x0fff; 155 seq1 &= 0x0fff;
156 seq2 &= 0x0fff; 156 seq2 &= 0x0fff;
@@ -159,7 +159,7 @@ static __inline__ int dn_before(unsigned short seq1, unsigned short seq2)
159} 159}
160 160
161 161
162static __inline__ int dn_after(unsigned short seq1, unsigned short seq2) 162static __inline__ int dn_after(__u16 seq1, __u16 seq2)
163{ 163{
164 seq1 &= 0x0fff; 164 seq1 &= 0x0fff;
165 seq2 &= 0x0fff; 165 seq2 &= 0x0fff;
@@ -167,23 +167,23 @@ static __inline__ int dn_after(unsigned short seq1, unsigned short seq2)
167 return (int)((seq2 - seq1) & 0x0fff) > 2048; 167 return (int)((seq2 - seq1) & 0x0fff) > 2048;
168} 168}
169 169
170static __inline__ int dn_equal(unsigned short seq1, unsigned short seq2) 170static __inline__ int dn_equal(__u16 seq1, __u16 seq2)
171{ 171{
172 return ((seq1 ^ seq2) & 0x0fff) == 0; 172 return ((seq1 ^ seq2) & 0x0fff) == 0;
173} 173}
174 174
175static __inline__ int dn_before_or_equal(unsigned short seq1, unsigned short seq2) 175static __inline__ int dn_before_or_equal(__u16 seq1, __u16 seq2)
176{ 176{
177 return (dn_before(seq1, seq2) || dn_equal(seq1, seq2)); 177 return (dn_before(seq1, seq2) || dn_equal(seq1, seq2));
178} 178}
179 179
180static __inline__ void seq_add(unsigned short *seq, unsigned short off) 180static __inline__ void seq_add(__u16 *seq, __u16 off)
181{ 181{
182 (*seq) += off; 182 (*seq) += off;
183 (*seq) &= 0x0fff; 183 (*seq) &= 0x0fff;
184} 184}
185 185
186static __inline__ int seq_next(unsigned short seq1, unsigned short seq2) 186static __inline__ int seq_next(__u16 seq1, __u16 seq2)
187{ 187{
188 return dn_equal(seq1 + 1, seq2); 188 return dn_equal(seq1 + 1, seq2);
189} 189}
@@ -191,7 +191,7 @@ static __inline__ int seq_next(unsigned short seq1, unsigned short seq2)
191/* 191/*
192 * Can we delay the ack ? 192 * Can we delay the ack ?
193 */ 193 */
194static __inline__ int sendack(unsigned short seq) 194static __inline__ int sendack(__u16 seq)
195{ 195{
196 return (int)((seq & 0x1000) ? 0 : 1); 196 return (int)((seq & 0x1000) ? 0 : 1);
197} 197}
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 5122da3f2eb3..76f957e258b0 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -71,12 +71,12 @@ struct dn_route {
71 struct dn_route *rt_next; 71 struct dn_route *rt_next;
72 } u; 72 } u;
73 73
74 __u16 rt_saddr; 74 __le16 rt_saddr;
75 __u16 rt_daddr; 75 __le16 rt_daddr;
76 __u16 rt_gateway; 76 __le16 rt_gateway;
77 __u16 rt_local_src; /* Source used for forwarding packets */ 77 __le16 rt_local_src; /* Source used for forwarding packets */
78 __u16 rt_src_map; 78 __le16 rt_src_map;
79 __u16 rt_dst_map; 79 __le16 rt_dst_map;
80 80
81 unsigned rt_flags; 81 unsigned rt_flags;
82 unsigned rt_type; 82 unsigned rt_type;
diff --git a/include/net/flow.h b/include/net/flow.h
index ec7eb86eb203..04d89f763451 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -30,8 +30,8 @@ struct flowi {
30 } ip6_u; 30 } ip6_u;
31 31
32 struct { 32 struct {
33 __u16 daddr; 33 __le16 daddr;
34 __u16 saddr; 34 __le16 saddr;
35 __u32 fwmark; 35 __u32 fwmark;
36 __u8 scope; 36 __u8 scope;
37 } dn_u; 37 } dn_u;
@@ -64,8 +64,8 @@ struct flowi {
64 } icmpt; 64 } icmpt;
65 65
66 struct { 66 struct {
67 __u16 sport; 67 __le16 sport;
68 __u16 dport; 68 __le16 dport;
69 __u8 objnum; 69 __u8 objnum;
70 __u8 objnamel; /* Not 16 bits since max val is 16 */ 70 __u8 objnamel; /* Not 16 bits since max val is 16 */
71 __u8 objname[16]; /* Not zero terminated */ 71 __u8 objname[16]; /* Not zero terminated */
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 9a92aef8b0b2..4725ff861c57 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -220,6 +220,7 @@ struct ieee80211_snap_hdr {
220/* Authentication algorithms */ 220/* Authentication algorithms */
221#define WLAN_AUTH_OPEN 0 221#define WLAN_AUTH_OPEN 0
222#define WLAN_AUTH_SHARED_KEY 1 222#define WLAN_AUTH_SHARED_KEY 1
223#define WLAN_AUTH_LEAP 2
223 224
224#define WLAN_AUTH_CHALLENGE_LEN 128 225#define WLAN_AUTH_CHALLENGE_LEN 128
225 226
@@ -299,6 +300,23 @@ enum ieee80211_reasoncode {
299 WLAN_REASON_CIPHER_SUITE_REJECTED = 24, 300 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
300}; 301};
301 302
303/* Action categories - 802.11h */
304enum ieee80211_actioncategories {
305 WLAN_ACTION_SPECTRUM_MGMT = 0,
306 /* Reserved 1-127 */
307 /* Error 128-255 */
308};
309
310/* Action details - 802.11h */
311enum ieee80211_actiondetails {
312 WLAN_ACTION_CATEGORY_MEASURE_REQUEST = 0,
313 WLAN_ACTION_CATEGORY_MEASURE_REPORT = 1,
314 WLAN_ACTION_CATEGORY_TPC_REQUEST = 2,
315 WLAN_ACTION_CATEGORY_TPC_REPORT = 3,
316 WLAN_ACTION_CATEGORY_CHANNEL_SWITCH = 4,
317 /* 5 - 255 Reserved */
318};
319
302#define IEEE80211_STATMASK_SIGNAL (1<<0) 320#define IEEE80211_STATMASK_SIGNAL (1<<0)
303#define IEEE80211_STATMASK_RSSI (1<<1) 321#define IEEE80211_STATMASK_RSSI (1<<1)
304#define IEEE80211_STATMASK_NOISE (1<<2) 322#define IEEE80211_STATMASK_NOISE (1<<2)
@@ -377,6 +395,8 @@ struct ieee80211_rx_stats {
377 u8 mask; 395 u8 mask;
378 u8 freq; 396 u8 freq;
379 u16 len; 397 u16 len;
398 u64 tsf;
399 u32 beacon_time;
380}; 400};
381 401
382/* IEEE 802.11 requires that STA supports concurrent reception of at least 402/* IEEE 802.11 requires that STA supports concurrent reception of at least
@@ -608,6 +628,28 @@ struct ieee80211_auth {
608 struct ieee80211_info_element info_element[0]; 628 struct ieee80211_info_element info_element[0];
609} __attribute__ ((packed)); 629} __attribute__ ((packed));
610 630
631struct ieee80211_channel_switch {
632 u8 id;
633 u8 len;
634 u8 mode;
635 u8 channel;
636 u8 count;
637} __attribute__ ((packed));
638
639struct ieee80211_action {
640 struct ieee80211_hdr_3addr header;
641 u8 category;
642 u8 action;
643 union {
644 struct ieee80211_action_exchange {
645 u8 token;
646 struct ieee80211_info_element info_element[0];
647 } exchange;
648 struct ieee80211_channel_switch channel_switch;
649
650 } format;
651} __attribute__ ((packed));
652
611struct ieee80211_disassoc { 653struct ieee80211_disassoc {
612 struct ieee80211_hdr_3addr header; 654 struct ieee80211_hdr_3addr header;
613 __le16 reason; 655 __le16 reason;
@@ -692,7 +734,15 @@ struct ieee80211_txb {
692/* QoS structure */ 734/* QoS structure */
693#define NETWORK_HAS_QOS_PARAMETERS (1<<3) 735#define NETWORK_HAS_QOS_PARAMETERS (1<<3)
694#define NETWORK_HAS_QOS_INFORMATION (1<<4) 736#define NETWORK_HAS_QOS_INFORMATION (1<<4)
695#define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | NETWORK_HAS_QOS_INFORMATION) 737#define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
738 NETWORK_HAS_QOS_INFORMATION)
739
740/* 802.11h */
741#define NETWORK_HAS_POWER_CONSTRAINT (1<<5)
742#define NETWORK_HAS_CSA (1<<6)
743#define NETWORK_HAS_QUIET (1<<7)
744#define NETWORK_HAS_IBSS_DFS (1<<8)
745#define NETWORK_HAS_TPC_REPORT (1<<9)
696 746
697#define QOS_QUEUE_NUM 4 747#define QOS_QUEUE_NUM 4
698#define QOS_OUI_LEN 3 748#define QOS_OUI_LEN 3
@@ -748,6 +798,91 @@ struct ieee80211_tim_parameters {
748 798
749/*******************************************************/ 799/*******************************************************/
750 800
801enum { /* ieee80211_basic_report.map */
802 IEEE80211_BASIC_MAP_BSS = (1 << 0),
803 IEEE80211_BASIC_MAP_OFDM = (1 << 1),
804 IEEE80211_BASIC_MAP_UNIDENTIFIED = (1 << 2),
805 IEEE80211_BASIC_MAP_RADAR = (1 << 3),
806 IEEE80211_BASIC_MAP_UNMEASURED = (1 << 4),
807 /* Bits 5-7 are reserved */
808
809};
810struct ieee80211_basic_report {
811 u8 channel;
812 __le64 start_time;
813 __le16 duration;
814 u8 map;
815} __attribute__ ((packed));
816
817enum { /* ieee80211_measurement_request.mode */
818 /* Bit 0 is reserved */
819 IEEE80211_MEASUREMENT_ENABLE = (1 << 1),
820 IEEE80211_MEASUREMENT_REQUEST = (1 << 2),
821 IEEE80211_MEASUREMENT_REPORT = (1 << 3),
822 /* Bits 4-7 are reserved */
823};
824
825enum {
826 IEEE80211_REPORT_BASIC = 0, /* required */
827 IEEE80211_REPORT_CCA = 1, /* optional */
828 IEEE80211_REPORT_RPI = 2, /* optional */
829 /* 3-255 reserved */
830};
831
832struct ieee80211_measurement_params {
833 u8 channel;
834 __le64 start_time;
835 __le16 duration;
836} __attribute__ ((packed));
837
838struct ieee80211_measurement_request {
839 struct ieee80211_info_element ie;
840 u8 token;
841 u8 mode;
842 u8 type;
843 struct ieee80211_measurement_params params[0];
844} __attribute__ ((packed));
845
846struct ieee80211_measurement_report {
847 struct ieee80211_info_element ie;
848 u8 token;
849 u8 mode;
850 u8 type;
851 union {
852 struct ieee80211_basic_report basic[0];
853 } u;
854} __attribute__ ((packed));
855
856struct ieee80211_tpc_report {
857 u8 transmit_power;
858 u8 link_margin;
859} __attribute__ ((packed));
860
861struct ieee80211_channel_map {
862 u8 channel;
863 u8 map;
864} __attribute__ ((packed));
865
866struct ieee80211_ibss_dfs {
867 struct ieee80211_info_element ie;
868 u8 owner[ETH_ALEN];
869 u8 recovery_interval;
870 struct ieee80211_channel_map channel_map[0];
871};
872
873struct ieee80211_csa {
874 u8 mode;
875 u8 channel;
876 u8 count;
877} __attribute__ ((packed));
878
879struct ieee80211_quiet {
880 u8 count;
881 u8 period;
882 u8 duration;
883 u8 offset;
884} __attribute__ ((packed));
885
751struct ieee80211_network { 886struct ieee80211_network {
752 /* These entries are used to identify a unique network */ 887 /* These entries are used to identify a unique network */
753 u8 bssid[ETH_ALEN]; 888 u8 bssid[ETH_ALEN];
@@ -767,7 +902,7 @@ struct ieee80211_network {
767 u8 rates_ex_len; 902 u8 rates_ex_len;
768 unsigned long last_scanned; 903 unsigned long last_scanned;
769 u8 mode; 904 u8 mode;
770 u8 flags; 905 u32 flags;
771 u32 last_associate; 906 u32 last_associate;
772 u32 time_stamp[2]; 907 u32 time_stamp[2];
773 u16 beacon_interval; 908 u16 beacon_interval;
@@ -779,6 +914,25 @@ struct ieee80211_network {
779 u8 rsn_ie[MAX_WPA_IE_LEN]; 914 u8 rsn_ie[MAX_WPA_IE_LEN];
780 size_t rsn_ie_len; 915 size_t rsn_ie_len;
781 struct ieee80211_tim_parameters tim; 916 struct ieee80211_tim_parameters tim;
917
918 /* 802.11h info */
919
920 /* Power Constraint - mandatory if spctrm mgmt required */
921 u8 power_constraint;
922
923 /* TPC Report - mandatory if spctrm mgmt required */
924 struct ieee80211_tpc_report tpc_report;
925
926 /* IBSS DFS - mandatory if spctrm mgmt required and IBSS
927 * NOTE: This is variable length and so must be allocated dynamically */
928 struct ieee80211_ibss_dfs *ibss_dfs;
929
930 /* Channel Switch Announcement - optional if spctrm mgmt required */
931 struct ieee80211_csa csa;
932
933 /* Quiet - optional if spctrm mgmt required */
934 struct ieee80211_quiet quiet;
935
782 struct list_head list; 936 struct list_head list;
783}; 937};
784 938
@@ -924,7 +1078,10 @@ struct ieee80211_device {
924 int (*handle_auth) (struct net_device * dev, 1078 int (*handle_auth) (struct net_device * dev,
925 struct ieee80211_auth * auth); 1079 struct ieee80211_auth * auth);
926 int (*handle_deauth) (struct net_device * dev, 1080 int (*handle_deauth) (struct net_device * dev,
927 struct ieee80211_auth * auth); 1081 struct ieee80211_deauth * auth);
1082 int (*handle_action) (struct net_device * dev,
1083 struct ieee80211_action * action,
1084 struct ieee80211_rx_stats * stats);
928 int (*handle_disassoc) (struct net_device * dev, 1085 int (*handle_disassoc) (struct net_device * dev,
929 struct ieee80211_disassoc * assoc); 1086 struct ieee80211_disassoc * assoc);
930 int (*handle_beacon) (struct net_device * dev, 1087 int (*handle_beacon) (struct net_device * dev,
@@ -1093,6 +1250,7 @@ extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
1093extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, 1250extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
1094 struct ieee80211_hdr_4addr *header, 1251 struct ieee80211_hdr_4addr *header,
1095 struct ieee80211_rx_stats *stats); 1252 struct ieee80211_rx_stats *stats);
1253extern void ieee80211_network_reset(struct ieee80211_network *network);
1096 1254
1097/* ieee80211_geo.c */ 1255/* ieee80211_geo.c */
1098extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device 1256extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device
@@ -1105,6 +1263,11 @@ extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee,
1105extern int ieee80211_channel_to_index(struct ieee80211_device *ieee, 1263extern int ieee80211_channel_to_index(struct ieee80211_device *ieee,
1106 u8 channel); 1264 u8 channel);
1107extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq); 1265extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq);
1266extern u8 ieee80211_get_channel_flags(struct ieee80211_device *ieee,
1267 u8 channel);
1268extern const struct ieee80211_channel *ieee80211_get_channel(struct
1269 ieee80211_device
1270 *ieee, u8 channel);
1108 1271
1109/* ieee80211_wx.c */ 1272/* ieee80211_wx.c */
1110extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, 1273extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
@@ -1122,6 +1285,14 @@ extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee,
1122extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, 1285extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee,
1123 struct iw_request_info *info, 1286 struct iw_request_info *info,
1124 union iwreq_data *wrqu, char *extra); 1287 union iwreq_data *wrqu, char *extra);
1288extern int ieee80211_wx_set_auth(struct net_device *dev,
1289 struct iw_request_info *info,
1290 union iwreq_data *wrqu,
1291 char *extra);
1292extern int ieee80211_wx_get_auth(struct net_device *dev,
1293 struct iw_request_info *info,
1294 union iwreq_data *wrqu,
1295 char *extra);
1125 1296
1126static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) 1297static inline void ieee80211_increment_scans(struct ieee80211_device *ieee)
1127{ 1298{
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
index cd82c3e998e4..eb476414fd72 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/ieee80211_crypt.h
@@ -47,7 +47,8 @@ struct ieee80211_crypto_ops {
47 /* deinitialize crypto context and free allocated private data */ 47 /* deinitialize crypto context and free allocated private data */
48 void (*deinit) (void *priv); 48 void (*deinit) (void *priv);
49 49
50 int (*build_iv) (struct sk_buff * skb, int hdr_len, void *priv); 50 int (*build_iv) (struct sk_buff * skb, int hdr_len,
51 u8 *key, int keylen, void *priv);
51 52
52 /* encrypt/decrypt return < 0 on error or >= 0 on success. The return 53 /* encrypt/decrypt return < 0 on error or >= 0 on success. The return
53 * value from decrypt_mpdu is passed as the keyidx value for 54 * value from decrypt_mpdu is passed as the keyidx value for
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h
new file mode 100644
index 000000000000..b971d8c82bdd
--- /dev/null
+++ b/include/net/ieee80211softmac.h
@@ -0,0 +1,292 @@
1/*
2 * ieee80211softmac.h - public interface to the softmac
3 *
4 * Copyright (c) 2005 Johannes Berg <johannes@sipsolutions.net>
5 * Joseph Jezak <josejx@gentoo.org>
6 * Larry Finger <Larry.Finger@lwfinger.net>
7 * Danny van Dyk <kugelfang@gentoo.org>
8 * Michael Buesch <mbuesch@freenet.de>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 * The full GNU General Public License is included in this distribution in the
24 * file called COPYING.
25 */
26
27#ifndef IEEE80211SOFTMAC_H_
28#define IEEE80211SOFTMAC_H_
29
30#include <linux/kernel.h>
31#include <linux/spinlock.h>
32#include <linux/workqueue.h>
33#include <linux/list.h>
34#include <net/ieee80211.h>
35
36/* Once the API is considered more or less stable,
37 * this should be incremented on API incompatible changes.
38 */
39#define IEEE80211SOFTMAC_API 0
40
41#define IEEE80211SOFTMAC_MAX_RATES_LEN 8
42#define IEEE80211SOFTMAC_MAX_EX_RATES_LEN 255
43
44struct ieee80211softmac_ratesinfo {
45 u8 count;
46 u8 rates[IEEE80211SOFTMAC_MAX_RATES_LEN + IEEE80211SOFTMAC_MAX_EX_RATES_LEN];
47};
48
49/* internal structures */
50struct ieee80211softmac_network;
51struct ieee80211softmac_scaninfo;
52
53struct ieee80211softmac_essid {
54 u8 len;
55 char data[IW_ESSID_MAX_SIZE+1];
56};
57
58struct ieee80211softmac_wpa {
59 char *IE;
60 int IElen;
61 int IEbuflen;
62};
63
64/*
65 * Information about association
66 *
67 * Do we need a lock for this?
68 * We only ever use this structure inlined
69 * into our global struct. I've used its lock,
70 * but maybe we need a local one here?
71 */
72struct ieee80211softmac_assoc_info {
73 /*
74 * This is the requested ESSID. It is written
75 * only by the WX handlers.
76 *
77 */
78 struct ieee80211softmac_essid req_essid;
79 /*
80 * the ESSID of the network we're currently
81 * associated (or trying) to. This is
82 * updated to the network's actual ESSID
83 * even if the requested ESSID was 'ANY'
84 */
85 struct ieee80211softmac_essid associate_essid;
86
87 /* BSSID we're trying to associate to */
88 char bssid[ETH_ALEN];
89
90 /* some flags.
91 * static_essid is valid if the essid is constant,
92 * this is for use by the wx handlers only.
93 *
94 * associating is true, if the network has been
95 * auth'ed on and we are in the process of associating.
96 *
97 * bssvalid is true if we found a matching network
98 * and saved it's BSSID into the bssid above.
99 */
100 u8 static_essid:1,
101 associating:1,
102 bssvalid:1;
103
104 /* Scan retries remaining */
105 int scan_retry;
106
107 struct work_struct work;
108 struct work_struct timeout;
109};
110
111enum {
112 IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1,
113 IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2,
114};
115
116enum {
117 IEEE80211SOFTMAC_AUTH_SHARED_REQUEST = 1,
118 IEEE80211SOFTMAC_AUTH_SHARED_CHALLENGE = 2,
119 IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE = 3,
120 IEEE80211SOFTMAC_AUTH_SHARED_PASS = 4,
121};
122
123/* We should make these tunable
124 * AUTH_TIMEOUT seems really long, but that's what it is in BSD */
125#define IEEE80211SOFTMAC_AUTH_TIMEOUT (12 * HZ)
126#define IEEE80211SOFTMAC_AUTH_RETRY_LIMIT 5
127#define IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT 3
128
129struct ieee80211softmac_txrates {
130 /* The Bit-Rate to be used for multicast frames. */
131 u8 mcast_rate;
132 /* The Bit-Rate to be used for multicast fallback
133 * (If the device supports fallback and hardware-retry)
134 */
135 u8 mcast_fallback;
136 /* The Bit-Rate to be used for any other (normal) data packet. */
137 u8 default_rate;
138 /* The Bit-Rate to be used for default fallback
139 * (If the device supports fallback and hardware-retry)
140 */
141 u8 default_fallback;
142};
143
144/* Bits for txrates_change callback. */
145#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */
146#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */
147#define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */
148#define IEEE80211SOFTMAC_TXRATECHG_MCAST_FBACK (1 << 3) /* mcast_fallback */
149
150struct ieee80211softmac_device {
151 /* 802.11 structure for data stuff */
152 struct ieee80211_device *ieee;
153 struct net_device *dev;
154
155 /* only valid if associated, then holds the Association ID */
156 u16 association_id;
157
158 /* the following methods are callbacks that the driver
159 * using this framework has to assign
160 */
161
162 /* always assign these */
163 void (*set_bssid_filter)(struct net_device *dev, const u8 *bssid);
164 void (*set_channel)(struct net_device *dev, u8 channel);
165
166 /* assign if you need it, informational only */
167 void (*link_change)(struct net_device *dev);
168
169 /* If the hardware can do scanning, assign _all_ three of these callbacks.
170 * When the scan finishes, call ieee80211softmac_scan_finished().
171 */
172
173 /* when called, start_scan is guaranteed to not be called again
174 * until you call ieee80211softmac_scan_finished.
175 * Return 0 if scanning could start, error otherwise.
176 * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_start_scan */
177 int (*start_scan)(struct net_device *dev);
178 /* this should block until after ieee80211softmac_scan_finished was called
179 * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_wait_for_scan */
180 void (*wait_for_scan)(struct net_device *dev);
181 /* stop_scan aborts a scan, but is asynchronous.
182 * if you want to wait for it too, use wait_for_scan
183 * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_stop_scan */
184 void (*stop_scan)(struct net_device *dev);
185
186 /* we'll need something about beacons here too, for AP or ad-hoc modes */
187
188 /* Transmission rates to be used by the driver.
189 * The SoftMAC figures out the best possible rates.
190 * The driver just needs to read them.
191 */
192 struct ieee80211softmac_txrates txrates;
193 /* If the driver needs to do stuff on TX rate changes, assign this callback. */
194 void (*txrates_change)(struct net_device *dev,
195 u32 changes, /* see IEEE80211SOFTMAC_TXRATECHG flags */
196 const struct ieee80211softmac_txrates *rates_before_change);
197
198 /* private stuff follows */
199 /* this lock protects this structure */
200 spinlock_t lock;
201
202 /* couple of flags */
203 u8 scanning:1, /* protects scanning from being done multiple times at once */
204 associated:1;
205
206 struct ieee80211softmac_scaninfo *scaninfo;
207 struct ieee80211softmac_assoc_info associnfo;
208
209 struct list_head auth_queue;
210 struct list_head events;
211
212 struct ieee80211softmac_ratesinfo ratesinfo;
213 int txrate_badness;
214
215 /* WPA stuff */
216 struct ieee80211softmac_wpa wpa;
217
218 /* we need to keep a list of network structs we copied */
219 struct list_head network_list;
220
221 /* This must be the last item so that it points to the data
222 * allocated beyond this structure by alloc_ieee80211 */
223 u8 priv[0];
224};
225
226extern void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm);
227
228static inline void * ieee80211softmac_priv(struct net_device *dev)
229{
230 return ((struct ieee80211softmac_device *)ieee80211_priv(dev))->priv;
231}
232
233extern struct net_device * alloc_ieee80211softmac(int sizeof_priv);
234extern void free_ieee80211softmac(struct net_device *dev);
235
236/* Call this function if you detect a lost TX fragment.
237 * (If the device indicates failure of ACK RX, for example.)
238 * It is wise to call this function if you are able to detect lost packets,
239 * because it contributes to the TX Rates auto adjustment.
240 */
241extern void ieee80211softmac_fragment_lost(struct net_device *dev,
242 u16 wireless_sequence_number);
243/* Call this function before _start to tell the softmac what rates
244 * the hw supports. The rates parameter is copied, so you can
245 * free it right after calling this function.
246 * Note that the rates need to be sorted. */
247extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates);
248
249/* Start the SoftMAC. Call this after you initialized the device
250 * and it is ready to run.
251 */
252extern void ieee80211softmac_start(struct net_device *dev);
253/* Stop the SoftMAC. Call this before you shutdown the device. */
254extern void ieee80211softmac_stop(struct net_device *dev);
255
256/*
257 * Event system
258 */
259
260/* valid event types */
261#define IEEE80211SOFTMAC_EVENT_ANY -1 /*private use only*/
262#define IEEE80211SOFTMAC_EVENT_SCAN_FINISHED 0
263#define IEEE80211SOFTMAC_EVENT_ASSOCIATED 1
264#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED 2
265#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_TIMEOUT 3
266#define IEEE80211SOFTMAC_EVENT_AUTHENTICATED 4
267#define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5
268#define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6
269#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7
270/* keep this updated! */
271#define IEEE80211SOFTMAC_EVENT_LAST 7
272/*
273 * If you want to be notified of certain events, you can call
274 * ieee80211softmac_notify[_atomic] with
275 * - event set to one of the constants below
276 * - fun set to a function pointer of the appropriate type
277 * - context set to the context data you want passed
278 * The return value is 0, or an error.
279 */
280typedef void (*notify_function_ptr)(struct net_device *dev, void *context);
281
282#define ieee80211softmac_notify(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_KERNEL);
283#define ieee80211softmac_notify_atomic(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_ATOMIC);
284
285extern int ieee80211softmac_notify_gfp(struct net_device *dev,
286 int event, notify_function_ptr fun, void *context, gfp_t gfp_mask);
287
288/* To clear pending work (for ifconfig down, etc.) */
289extern void
290ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm);
291
292#endif /* IEEE80211SOFTMAC_H_ */
diff --git a/include/net/ieee80211softmac_wx.h b/include/net/ieee80211softmac_wx.h
new file mode 100644
index 000000000000..3e0be453ecea
--- /dev/null
+++ b/include/net/ieee80211softmac_wx.h
@@ -0,0 +1,94 @@
1/*
2 * This file contains the prototypes for the wireless extension
3 * handlers that the softmac API provides. Include this file to
4 * use the wx handlers, you can assign these directly.
5 *
6 * Copyright (c) 2005 Johannes Berg <johannes@sipsolutions.net>
7 * Joseph Jezak <josejx@gentoo.org>
8 * Larry Finger <Larry.Finger@lwfinger.net>
9 * Danny van Dyk <kugelfang@gentoo.org>
10 * Michael Buesch <mbuesch@freenet.de>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 *
25 * The full GNU General Public License is included in this distribution in the
26 * file called COPYING.
27 */
28
29#ifndef _IEEE80211SOFTMAC_WX_H
30#define _IEEE80211SOFTMAC_WX_H
31
32#include <net/ieee80211softmac.h>
33#include <net/iw_handler.h>
34
35extern int
36ieee80211softmac_wx_trigger_scan(struct net_device *net_dev,
37 struct iw_request_info *info,
38 union iwreq_data *data,
39 char *extra);
40
41extern int
42ieee80211softmac_wx_get_scan_results(struct net_device *net_dev,
43 struct iw_request_info *info,
44 union iwreq_data *data,
45 char *extra);
46
47extern int
48ieee80211softmac_wx_set_essid(struct net_device *net_dev,
49 struct iw_request_info *info,
50 union iwreq_data *data,
51 char *extra);
52
53extern int
54ieee80211softmac_wx_get_essid(struct net_device *net_dev,
55 struct iw_request_info *info,
56 union iwreq_data *data,
57 char *extra);
58
59extern int
60ieee80211softmac_wx_set_rate(struct net_device *net_dev,
61 struct iw_request_info *info,
62 union iwreq_data *data,
63 char *extra);
64
65extern int
66ieee80211softmac_wx_get_rate(struct net_device *net_dev,
67 struct iw_request_info *info,
68 union iwreq_data *data,
69 char *extra);
70
71extern int
72ieee80211softmac_wx_get_wap(struct net_device *net_dev,
73 struct iw_request_info *info,
74 union iwreq_data *data,
75 char *extra);
76
77extern int
78ieee80211softmac_wx_set_wap(struct net_device *net_dev,
79 struct iw_request_info *info,
80 union iwreq_data *data,
81 char *extra);
82
83extern int
84ieee80211softmac_wx_set_genie(struct net_device *dev,
85 struct iw_request_info *info,
86 union iwreq_data *wrqu,
87 char *extra);
88
89extern int
90ieee80211softmac_wx_get_genie(struct net_device *dev,
91 struct iw_request_info *info,
92 union iwreq_data *wrqu,
93 char *extra);
94#endif /* _IEEE80211SOFTMAC_WX */
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index eb8afe3499a9..e459e1a0ae4a 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -180,11 +180,8 @@ struct inet6_dev
180 180
181#ifdef CONFIG_IPV6_PRIVACY 181#ifdef CONFIG_IPV6_PRIVACY
182 u8 rndid[8]; 182 u8 rndid[8];
183 u8 entropy[8];
184 struct timer_list regen_timer; 183 struct timer_list regen_timer;
185 struct inet6_ifaddr *tempaddr_list; 184 struct inet6_ifaddr *tempaddr_list;
186 __u8 work_eui64[8];
187 __u8 work_digest[16];
188#endif 185#endif
189 186
190 struct neigh_parms *nd_parms; 187 struct neigh_parms *nd_parms;
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index fa587c94e9d0..9bf73fe50948 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -50,6 +50,12 @@ struct inet_connection_sock_af_ops {
50 char __user *optval, int optlen); 50 char __user *optval, int optlen);
51 int (*getsockopt)(struct sock *sk, int level, int optname, 51 int (*getsockopt)(struct sock *sk, int level, int optname,
52 char __user *optval, int __user *optlen); 52 char __user *optval, int __user *optlen);
53 int (*compat_setsockopt)(struct sock *sk,
54 int level, int optname,
55 char __user *optval, int optlen);
56 int (*compat_getsockopt)(struct sock *sk,
57 int level, int optname,
58 char __user *optval, int __user *optlen);
53 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); 59 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
54 int sockaddr_len; 60 int sockaddr_len;
55}; 61};
@@ -72,6 +78,7 @@ struct inet_connection_sock_af_ops {
72 * @icsk_probes_out: unanswered 0 window probes 78 * @icsk_probes_out: unanswered 0 window probes
73 * @icsk_ext_hdr_len: Network protocol overhead (IP/IPv6 options) 79 * @icsk_ext_hdr_len: Network protocol overhead (IP/IPv6 options)
74 * @icsk_ack: Delayed ACK control data 80 * @icsk_ack: Delayed ACK control data
81 * @icsk_mtup; MTU probing control data
75 */ 82 */
76struct inet_connection_sock { 83struct inet_connection_sock {
77 /* inet_sock has to be the first member! */ 84 /* inet_sock has to be the first member! */
@@ -104,6 +111,16 @@ struct inet_connection_sock {
104 __u16 last_seg_size; /* Size of last incoming segment */ 111 __u16 last_seg_size; /* Size of last incoming segment */
105 __u16 rcv_mss; /* MSS used for delayed ACK decisions */ 112 __u16 rcv_mss; /* MSS used for delayed ACK decisions */
106 } icsk_ack; 113 } icsk_ack;
114 struct {
115 int enabled;
116
117 /* Range of MTUs to search */
118 int search_high;
119 int search_low;
120
121 /* Information on the current probe. */
122 int probe_size;
123 } icsk_mtup;
107 u32 icsk_ca_priv[16]; 124 u32 icsk_ca_priv[16];
108#define ICSK_CA_PRIV_SIZE (16 * sizeof(u32)) 125#define ICSK_CA_PRIV_SIZE (16 * sizeof(u32))
109}; 126};
@@ -310,4 +327,13 @@ extern void inet_csk_listen_stop(struct sock *sk);
310 327
311extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 328extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
312 329
330extern int inet_csk_ctl_sock_create(struct socket **sock,
331 unsigned short family,
332 unsigned short type,
333 unsigned char protocol);
334
335extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
336 char __user *optval, int __user *optlen);
337extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
338 char __user *optval, int optlen);
313#endif /* _INET_CONNECTION_SOCK_H */ 339#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/ip.h b/include/net/ip.h
index fab3d5b3ab1c..8fe6156ca9b0 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -356,6 +356,10 @@ extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
356extern int ip_cmsg_send(struct msghdr *msg, struct ipcm_cookie *ipc); 356extern int ip_cmsg_send(struct msghdr *msg, struct ipcm_cookie *ipc);
357extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen); 357extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen);
358extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); 358extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen);
359extern int compat_ip_setsockopt(struct sock *sk, int level,
360 int optname, char __user *optval, int optlen);
361extern int compat_ip_getsockopt(struct sock *sk, int level,
362 int optname, char __user *optval, int __user *optlen);
359extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); 363extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *));
360 364
361extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); 365extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len);
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 1f2e428ca364..a398ae5e30f9 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -7,6 +7,23 @@
7#define IP6_RT_PRIO_KERN 512 7#define IP6_RT_PRIO_KERN 512
8#define IP6_RT_FLOW_MASK 0x00ff 8#define IP6_RT_FLOW_MASK 0x00ff
9 9
10struct route_info {
11 __u8 type;
12 __u8 length;
13 __u8 prefix_len;
14#if defined(__BIG_ENDIAN_BITFIELD)
15 __u8 reserved_h:3,
16 route_pref:2,
17 reserved_l:3;
18#elif defined(__LITTLE_ENDIAN_BITFIELD)
19 __u8 reserved_l:3,
20 route_pref:2,
21 reserved_h:3;
22#endif
23 __u32 lifetime;
24 __u8 prefix[0]; /* 0,8 or 16 */
25};
26
10#ifdef __KERNEL__ 27#ifdef __KERNEL__
11 28
12#include <net/flow.h> 29#include <net/flow.h>
@@ -87,11 +104,14 @@ extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
87extern struct rt6_info * rt6_get_dflt_router(struct in6_addr *addr, 104extern struct rt6_info * rt6_get_dflt_router(struct in6_addr *addr,
88 struct net_device *dev); 105 struct net_device *dev);
89extern struct rt6_info * rt6_add_dflt_router(struct in6_addr *gwaddr, 106extern struct rt6_info * rt6_add_dflt_router(struct in6_addr *gwaddr,
90 struct net_device *dev); 107 struct net_device *dev,
108 unsigned int pref);
91 109
92extern void rt6_purge_dflt_routers(void); 110extern void rt6_purge_dflt_routers(void);
93 111
94extern void rt6_reset_dflt_pointer(struct rt6_info *rt); 112extern int rt6_route_rcv(struct net_device *dev,
113 u8 *opt, int len,
114 struct in6_addr *gwaddr);
95 115
96extern void rt6_redirect(struct in6_addr *dest, 116extern void rt6_redirect(struct in6_addr *dest,
97 struct in6_addr *saddr, 117 struct in6_addr *saddr,
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 3b1d963d396c..6d6f0634ae41 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -282,6 +282,18 @@ static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr
282 return memcmp((const void *) a1, (const void *) a2, sizeof(struct in6_addr)); 282 return memcmp((const void *) a1, (const void *) a2, sizeof(struct in6_addr));
283} 283}
284 284
285static inline int
286ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m,
287 const struct in6_addr *a2)
288{
289 unsigned int i;
290
291 for (i = 0; i < 4; i++)
292 if ((a1->s6_addr32[i] ^ a2->s6_addr32[i]) & m->s6_addr32[i])
293 return 1;
294 return 0;
295}
296
285static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2) 297static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2)
286{ 298{
287 memcpy((void *) a1, (const void *) a2, sizeof(struct in6_addr)); 299 memcpy((void *) a1, (const void *) a2, sizeof(struct in6_addr));
@@ -508,6 +520,16 @@ extern int ipv6_getsockopt(struct sock *sk, int level,
508 int optname, 520 int optname,
509 char __user *optval, 521 char __user *optval,
510 int __user *optlen); 522 int __user *optlen);
523extern int compat_ipv6_setsockopt(struct sock *sk,
524 int level,
525 int optname,
526 char __user *optval,
527 int optlen);
528extern int compat_ipv6_getsockopt(struct sock *sk,
529 int level,
530 int optname,
531 char __user *optval,
532 int __user *optlen);
511 533
512extern void ipv6_packet_init(void); 534extern void ipv6_packet_init(void);
513 535
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index a2c5e0b88422..10559e937d27 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -4,7 +4,7 @@
4 * Version : 7 18.3.05 4 * Version : 7 18.3.05
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 2001-2005 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 2001-2006 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _IW_HANDLER_H 10#ifndef _IW_HANDLER_H
@@ -436,6 +436,16 @@ extern int dev_get_wireless_info(char * buffer, char **start, off_t offset,
436/* Handle IOCTLs, called in net/core/dev.c */ 436/* Handle IOCTLs, called in net/core/dev.c */
437extern int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd); 437extern int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd);
438 438
439/* Handle RtNetlink requests, called in net/core/rtnetlink.c */
440extern int wireless_rtnetlink_set(struct net_device * dev,
441 char * data,
442 int len);
443extern int wireless_rtnetlink_get(struct net_device * dev,
444 char * data,
445 int len,
446 char ** p_buf,
447 int * p_len);
448
439/* Second : functions that may be called by driver modules */ 449/* Second : functions that may be called by driver modules */
440 450
441/* Send a single event to user space */ 451/* Send a single event to user space */
diff --git a/include/net/llc.h b/include/net/llc.h
index 1adb2ef3f6f7..f5024583fc8b 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -71,7 +71,7 @@ extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
71 struct packet_type *pt, struct net_device *orig_dev); 71 struct packet_type *pt, struct net_device *orig_dev);
72 72
73extern int llc_mac_hdr_init(struct sk_buff *skb, 73extern int llc_mac_hdr_init(struct sk_buff *skb,
74 unsigned char *sa, unsigned char *da); 74 const unsigned char *sa, const unsigned char *da);
75 75
76extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap, 76extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap,
77 struct sk_buff *skb)); 77 struct sk_buff *skb));
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index bbac87eeb422..91fa271a0064 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -22,6 +22,8 @@ enum {
22 ND_OPT_PREFIX_INFO = 3, /* RFC2461 */ 22 ND_OPT_PREFIX_INFO = 3, /* RFC2461 */
23 ND_OPT_REDIRECT_HDR = 4, /* RFC2461 */ 23 ND_OPT_REDIRECT_HDR = 4, /* RFC2461 */
24 ND_OPT_MTU = 5, /* RFC2461 */ 24 ND_OPT_MTU = 5, /* RFC2461 */
25 __ND_OPT_ARRAY_MAX,
26 ND_OPT_ROUTE_INFO = 24, /* RFC4191 */
25 __ND_OPT_MAX 27 __ND_OPT_MAX
26}; 28};
27 29
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 6fa9ae190741..b0666d66293f 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -68,6 +68,7 @@ struct neigh_parms
68 struct net_device *dev; 68 struct net_device *dev;
69 struct neigh_parms *next; 69 struct neigh_parms *next;
70 int (*neigh_setup)(struct neighbour *); 70 int (*neigh_setup)(struct neighbour *);
71 void (*neigh_destructor)(struct neighbour *);
71 struct neigh_table *tbl; 72 struct neigh_table *tbl;
72 73
73 void *sysctl_table; 74 void *sysctl_table;
@@ -145,7 +146,6 @@ struct neighbour
145struct neigh_ops 146struct neigh_ops
146{ 147{
147 int family; 148 int family;
148 void (*destructor)(struct neighbour *);
149 void (*solicit)(struct neighbour *, struct sk_buff*); 149 void (*solicit)(struct neighbour *, struct sk_buff*);
150 void (*error_report)(struct neighbour *, struct sk_buff*); 150 void (*error_report)(struct neighbour *, struct sk_buff*);
151 int (*output)(struct sk_buff*); 151 int (*output)(struct sk_buff*);
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 6d075ca16e6e..916013ca4a5c 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -67,6 +67,18 @@ do { \
67 67
68struct nf_conntrack_helper; 68struct nf_conntrack_helper;
69 69
70/* nf_conn feature for connections that have a helper */
71struct nf_conn_help {
72 /* Helper. if any */
73 struct nf_conntrack_helper *helper;
74
75 union nf_conntrack_help help;
76
77 /* Current number of expected connections */
78 unsigned int expecting;
79};
80
81
70#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> 82#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
71struct nf_conn 83struct nf_conn
72{ 84{
@@ -81,6 +93,9 @@ struct nf_conn
81 /* Have we seen traffic both ways yet? (bitset) */ 93 /* Have we seen traffic both ways yet? (bitset) */
82 unsigned long status; 94 unsigned long status;
83 95
96 /* If we were expected by an expectation, this will be it */
97 struct nf_conn *master;
98
84 /* Timer function; drops refcnt when it goes off. */ 99 /* Timer function; drops refcnt when it goes off. */
85 struct timer_list timeout; 100 struct timer_list timeout;
86 101
@@ -88,38 +103,22 @@ struct nf_conn
88 /* Accounting Information (same cache line as other written members) */ 103 /* Accounting Information (same cache line as other written members) */
89 struct ip_conntrack_counter counters[IP_CT_DIR_MAX]; 104 struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
90#endif 105#endif
91 /* If we were expected by an expectation, this will be it */
92 struct nf_conn *master;
93
94 /* Current number of expected connections */
95 unsigned int expecting;
96 106
97 /* Unique ID that identifies this conntrack*/ 107 /* Unique ID that identifies this conntrack*/
98 unsigned int id; 108 unsigned int id;
99 109
100 /* Helper. if any */
101 struct nf_conntrack_helper *helper;
102
103 /* features - nat, helper, ... used by allocating system */ 110 /* features - nat, helper, ... used by allocating system */
104 u_int32_t features; 111 u_int32_t features;
105 112
106 /* Storage reserved for other modules: */
107
108 union nf_conntrack_proto proto;
109
110#if defined(CONFIG_NF_CONNTRACK_MARK) 113#if defined(CONFIG_NF_CONNTRACK_MARK)
111 u_int32_t mark; 114 u_int32_t mark;
112#endif 115#endif
113 116
114 /* These members are dynamically allocated. */ 117 /* Storage reserved for other modules: */
115 118 union nf_conntrack_proto proto;
116 union nf_conntrack_help *help;
117 119
118 /* Layer 3 dependent members. (ex: NAT) */ 120 /* features dynamically at the end: helper, nat (both optional) */
119 union { 121 char data[0];
120 struct nf_conntrack_ipv4 *ipv4;
121 } l3proto;
122 void *data[0];
123}; 122};
124 123
125struct nf_conntrack_expect 124struct nf_conntrack_expect
@@ -196,6 +195,10 @@ static inline void nf_ct_put(struct nf_conn *ct)
196 nf_conntrack_put(&ct->ct_general); 195 nf_conntrack_put(&ct->ct_general);
197} 196}
198 197
198/* Protocol module loading */
199extern int nf_ct_l3proto_try_module_get(unsigned short l3proto);
200extern void nf_ct_l3proto_module_put(unsigned short l3proto);
201
199extern struct nf_conntrack_tuple_hash * 202extern struct nf_conntrack_tuple_hash *
200__nf_conntrack_find(const struct nf_conntrack_tuple *tuple, 203__nf_conntrack_find(const struct nf_conntrack_tuple *tuple,
201 const struct nf_conn *ignored_conntrack); 204 const struct nf_conn *ignored_conntrack);
@@ -297,29 +300,30 @@ DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
297 300
298#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x) 301#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
299 302
300extern struct notifier_block *nf_conntrack_chain; 303extern struct atomic_notifier_head nf_conntrack_chain;
301extern struct notifier_block *nf_conntrack_expect_chain; 304extern struct atomic_notifier_head nf_conntrack_expect_chain;
302 305
303static inline int nf_conntrack_register_notifier(struct notifier_block *nb) 306static inline int nf_conntrack_register_notifier(struct notifier_block *nb)
304{ 307{
305 return notifier_chain_register(&nf_conntrack_chain, nb); 308 return atomic_notifier_chain_register(&nf_conntrack_chain, nb);
306} 309}
307 310
308static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb) 311static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb)
309{ 312{
310 return notifier_chain_unregister(&nf_conntrack_chain, nb); 313 return atomic_notifier_chain_unregister(&nf_conntrack_chain, nb);
311} 314}
312 315
313static inline int 316static inline int
314nf_conntrack_expect_register_notifier(struct notifier_block *nb) 317nf_conntrack_expect_register_notifier(struct notifier_block *nb)
315{ 318{
316 return notifier_chain_register(&nf_conntrack_expect_chain, nb); 319 return atomic_notifier_chain_register(&nf_conntrack_expect_chain, nb);
317} 320}
318 321
319static inline int 322static inline int
320nf_conntrack_expect_unregister_notifier(struct notifier_block *nb) 323nf_conntrack_expect_unregister_notifier(struct notifier_block *nb)
321{ 324{
322 return notifier_chain_unregister(&nf_conntrack_expect_chain, nb); 325 return atomic_notifier_chain_unregister(&nf_conntrack_expect_chain,
326 nb);
323} 327}
324 328
325extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); 329extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
@@ -344,14 +348,14 @@ static inline void nf_conntrack_event(enum ip_conntrack_events event,
344 struct nf_conn *ct) 348 struct nf_conn *ct)
345{ 349{
346 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) 350 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
347 notifier_call_chain(&nf_conntrack_chain, event, ct); 351 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
348} 352}
349 353
350static inline void 354static inline void
351nf_conntrack_expect_event(enum ip_conntrack_expect_events event, 355nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
352 struct nf_conntrack_expect *exp) 356 struct nf_conntrack_expect *exp)
353{ 357{
354 notifier_call_chain(&nf_conntrack_expect_chain, event, exp); 358 atomic_notifier_call_chain(&nf_conntrack_expect_chain, event, exp);
355} 359}
356#else /* CONFIG_NF_CONNTRACK_EVENTS */ 360#else /* CONFIG_NF_CONNTRACK_EVENTS */
357static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, 361static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
@@ -373,10 +377,23 @@ nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
373#define NF_CT_F_NUM 4 377#define NF_CT_F_NUM 4
374 378
375extern int 379extern int
376nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size, 380nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size);
377 int (*init_conntrack)(struct nf_conn *, u_int32_t));
378extern void 381extern void
379nf_conntrack_unregister_cache(u_int32_t features); 382nf_conntrack_unregister_cache(u_int32_t features);
380 383
384/* valid combinations:
385 * basic: nf_conn, nf_conn .. nf_conn_help
386 * nat: nf_conn .. nf_conn_nat, nf_conn .. nf_conn_nat, nf_conn help
387 */
388static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
389{
390 unsigned int offset = sizeof(struct nf_conn);
391
392 if (!(ct->features & NF_CT_F_HELP))
393 return NULL;
394
395 return (struct nf_conn_help *) ((void *)ct + offset);
396}
397
381#endif /* __KERNEL__ */ 398#endif /* __KERNEL__ */
382#endif /* _NF_CONNTRACK_H */ 399#endif /* _NF_CONNTRACK_H */
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 11641c9384f7..c5d7f920c352 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -145,7 +145,7 @@ static inline struct request_sock *
145{ 145{
146 struct request_sock *req = queue->rskq_accept_head; 146 struct request_sock *req = queue->rskq_accept_head;
147 147
148 queue->rskq_accept_head = queue->rskq_accept_head = NULL; 148 queue->rskq_accept_head = NULL;
149 return req; 149 return req;
150} 150}
151 151
diff --git a/include/net/route.h b/include/net/route.h
index 9c04f15090d2..98c915abdec8 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -110,7 +110,7 @@ extern struct ip_rt_acct *ip_rt_acct;
110struct in_device; 110struct in_device;
111extern int ip_rt_init(void); 111extern int ip_rt_init(void);
112extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw, 112extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw,
113 u32 src, u8 tos, struct net_device *dev); 113 u32 src, struct net_device *dev);
114extern void ip_rt_advice(struct rtable **rp, int advice); 114extern void ip_rt_advice(struct rtable **rp, int advice);
115extern void rt_cache_flush(int how); 115extern void rt_cache_flush(int how);
116extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); 116extern int __ip_route_output_key(struct rtable **, const struct flowi *flp);
diff --git a/include/net/scm.h b/include/net/scm.h
index c3fa3d5ab606..540619cb7160 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -37,10 +37,12 @@ static __inline__ void scm_destroy(struct scm_cookie *scm)
37static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, 37static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
38 struct scm_cookie *scm) 38 struct scm_cookie *scm)
39{ 39{
40 memset(scm, 0, sizeof(*scm)); 40 struct task_struct *p = current;
41 scm->creds.uid = current->uid; 41 scm->creds.uid = p->uid;
42 scm->creds.gid = current->gid; 42 scm->creds.gid = p->gid;
43 scm->creds.pid = current->tgid; 43 scm->creds.pid = p->tgid;
44 scm->fp = NULL;
45 scm->seq = 0;
44 if (msg->msg_controllen <= 0) 46 if (msg->msg_controllen <= 0)
45 return 0; 47 return 0;
46 return __scm_send(sock, msg, scm); 48 return __scm_send(sock, msg, scm);
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 072f407848a6..eba99f375517 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -514,6 +514,16 @@ struct sctp_af {
514 int optname, 514 int optname,
515 char __user *optval, 515 char __user *optval,
516 int __user *optlen); 516 int __user *optlen);
517 int (*compat_setsockopt) (struct sock *sk,
518 int level,
519 int optname,
520 char __user *optval,
521 int optlen);
522 int (*compat_getsockopt) (struct sock *sk,
523 int level,
524 int optname,
525 char __user *optval,
526 int __user *optlen);
517 struct dst_entry *(*get_dst) (struct sctp_association *asoc, 527 struct dst_entry *(*get_dst) (struct sctp_association *asoc,
518 union sctp_addr *daddr, 528 union sctp_addr *daddr,
519 union sctp_addr *saddr); 529 union sctp_addr *saddr);
diff --git a/include/net/sock.h b/include/net/sock.h
index 30758035d616..af2b0544586e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -210,6 +210,7 @@ struct sock {
210 gfp_t sk_allocation; 210 gfp_t sk_allocation;
211 int sk_sndbuf; 211 int sk_sndbuf;
212 int sk_route_caps; 212 int sk_route_caps;
213 int sk_rcvlowat;
213 unsigned long sk_flags; 214 unsigned long sk_flags;
214 unsigned long sk_lingertime; 215 unsigned long sk_lingertime;
215 /* 216 /*
@@ -230,7 +231,6 @@ struct sock {
230 unsigned short sk_max_ack_backlog; 231 unsigned short sk_max_ack_backlog;
231 __u32 sk_priority; 232 __u32 sk_priority;
232 struct ucred sk_peercred; 233 struct ucred sk_peercred;
233 int sk_rcvlowat;
234 long sk_rcvtimeo; 234 long sk_rcvtimeo;
235 long sk_sndtimeo; 235 long sk_sndtimeo;
236 struct sk_filter *sk_filter; 236 struct sk_filter *sk_filter;
@@ -478,9 +478,9 @@ static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb)
478 rc = __condition; \ 478 rc = __condition; \
479 if (!rc) { \ 479 if (!rc) { \
480 *(__timeo) = schedule_timeout(*(__timeo)); \ 480 *(__timeo) = schedule_timeout(*(__timeo)); \
481 rc = __condition; \
482 } \ 481 } \
483 lock_sock(__sk); \ 482 lock_sock(__sk); \
483 rc = __condition; \
484 rc; \ 484 rc; \
485}) 485})
486 486
@@ -520,6 +520,14 @@ struct proto {
520 int (*getsockopt)(struct sock *sk, int level, 520 int (*getsockopt)(struct sock *sk, int level,
521 int optname, char __user *optval, 521 int optname, char __user *optval,
522 int __user *option); 522 int __user *option);
523 int (*compat_setsockopt)(struct sock *sk,
524 int level,
525 int optname, char __user *optval,
526 int optlen);
527 int (*compat_getsockopt)(struct sock *sk,
528 int level,
529 int optname, char __user *optval,
530 int __user *option);
523 int (*sendmsg)(struct kiocb *iocb, struct sock *sk, 531 int (*sendmsg)(struct kiocb *iocb, struct sock *sk,
524 struct msghdr *msg, size_t len); 532 struct msghdr *msg, size_t len);
525 int (*recvmsg)(struct kiocb *iocb, struct sock *sk, 533 int (*recvmsg)(struct kiocb *iocb, struct sock *sk,
@@ -816,6 +824,10 @@ extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
816 struct msghdr *msg, size_t size, int flags); 824 struct msghdr *msg, size_t size, int flags);
817extern int sock_common_setsockopt(struct socket *sock, int level, int optname, 825extern int sock_common_setsockopt(struct socket *sock, int level, int optname,
818 char __user *optval, int optlen); 826 char __user *optval, int optlen);
827extern int compat_sock_common_getsockopt(struct socket *sock, int level,
828 int optname, char __user *optval, int __user *optlen);
829extern int compat_sock_common_setsockopt(struct socket *sock, int level,
830 int optname, char __user *optval, int optlen);
819 831
820extern void sk_common_release(struct sock *sk); 832extern void sk_common_release(struct sock *sk);
821 833
@@ -926,28 +938,7 @@ static inline void sock_put(struct sock *sk)
926 sk_free(sk); 938 sk_free(sk);
927} 939}
928 940
929static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb) 941extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb);
930{
931 int rc = NET_RX_SUCCESS;
932
933 if (sk_filter(sk, skb, 0))
934 goto discard_and_relse;
935
936 skb->dev = NULL;
937
938 bh_lock_sock(sk);
939 if (!sock_owned_by_user(sk))
940 rc = sk->sk_backlog_rcv(sk, skb);
941 else
942 sk_add_backlog(sk, skb);
943 bh_unlock_sock(sk);
944out:
945 sock_put(sk);
946 return rc;
947discard_and_relse:
948 kfree_skb(skb);
949 goto out;
950}
951 942
952/* Detach socket from process context. 943/* Detach socket from process context.
953 * Announce socket dead, detach it from wait queue and inode. 944 * Announce socket dead, detach it from wait queue and inode.
@@ -1032,33 +1023,9 @@ sk_dst_reset(struct sock *sk)
1032 write_unlock(&sk->sk_dst_lock); 1023 write_unlock(&sk->sk_dst_lock);
1033} 1024}
1034 1025
1035static inline struct dst_entry * 1026extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1036__sk_dst_check(struct sock *sk, u32 cookie)
1037{
1038 struct dst_entry *dst = sk->sk_dst_cache;
1039 1027
1040 if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) { 1028extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1041 sk->sk_dst_cache = NULL;
1042 dst_release(dst);
1043 return NULL;
1044 }
1045
1046 return dst;
1047}
1048
1049static inline struct dst_entry *
1050sk_dst_check(struct sock *sk, u32 cookie)
1051{
1052 struct dst_entry *dst = sk_dst_get(sk);
1053
1054 if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
1055 sk_dst_reset(sk);
1056 dst_release(dst);
1057 return NULL;
1058 }
1059
1060 return dst;
1061}
1062 1029
1063static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) 1030static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
1064{ 1031{
@@ -1128,45 +1095,7 @@ extern void sk_reset_timer(struct sock *sk, struct timer_list* timer,
1128 1095
1129extern void sk_stop_timer(struct sock *sk, struct timer_list* timer); 1096extern void sk_stop_timer(struct sock *sk, struct timer_list* timer);
1130 1097
1131static inline int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) 1098extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
1132{
1133 int err = 0;
1134 int skb_len;
1135
1136 /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
1137 number of warnings when compiling with -W --ANK
1138 */
1139 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
1140 (unsigned)sk->sk_rcvbuf) {
1141 err = -ENOMEM;
1142 goto out;
1143 }
1144
1145 /* It would be deadlock, if sock_queue_rcv_skb is used
1146 with socket lock! We assume that users of this
1147 function are lock free.
1148 */
1149 err = sk_filter(sk, skb, 1);
1150 if (err)
1151 goto out;
1152
1153 skb->dev = NULL;
1154 skb_set_owner_r(skb, sk);
1155
1156 /* Cache the SKB length before we tack it onto the receive
1157 * queue. Once it is added it no longer belongs to us and
1158 * may be freed by other threads of control pulling packets
1159 * from the queue.
1160 */
1161 skb_len = skb->len;
1162
1163 skb_queue_tail(&sk->sk_receive_queue, skb);
1164
1165 if (!sock_flag(sk, SOCK_DEAD))
1166 sk->sk_data_ready(sk, skb_len);
1167out:
1168 return err;
1169}
1170 1099
1171static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) 1100static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
1172{ 1101{
diff --git a/include/net/tc_act/tc_ipt.h b/include/net/tc_act/tc_ipt.h
index 02eccebd55ae..cb37ad08427f 100644
--- a/include/net/tc_act/tc_ipt.h
+++ b/include/net/tc_act/tc_ipt.h
@@ -3,14 +3,14 @@
3 3
4#include <net/act_api.h> 4#include <net/act_api.h>
5 5
6struct ipt_entry_target; 6struct xt_entry_target;
7 7
8struct tcf_ipt 8struct tcf_ipt
9{ 9{
10 tca_gen(ipt); 10 tca_gen(ipt);
11 u32 hook; 11 u32 hook;
12 char *tname; 12 char *tname;
13 struct ipt_entry_target *t; 13 struct xt_entry_target *t;
14}; 14};
15 15
16#endif 16#endif
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 77f21c65bbca..3c989db8a7aa 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -60,6 +60,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
60/* Minimal RCV_MSS. */ 60/* Minimal RCV_MSS. */
61#define TCP_MIN_RCVMSS 536U 61#define TCP_MIN_RCVMSS 536U
62 62
63/* The least MTU to use for probing */
64#define TCP_BASE_MSS 512
65
63/* After receiving this amount of duplicate ACKs fast retransmit starts. */ 66/* After receiving this amount of duplicate ACKs fast retransmit starts. */
64#define TCP_FASTRETRANS_THRESH 3 67#define TCP_FASTRETRANS_THRESH 3
65 68
@@ -219,6 +222,9 @@ extern int sysctl_tcp_nometrics_save;
219extern int sysctl_tcp_moderate_rcvbuf; 222extern int sysctl_tcp_moderate_rcvbuf;
220extern int sysctl_tcp_tso_win_divisor; 223extern int sysctl_tcp_tso_win_divisor;
221extern int sysctl_tcp_abc; 224extern int sysctl_tcp_abc;
225extern int sysctl_tcp_mtu_probing;
226extern int sysctl_tcp_base_mss;
227extern int sysctl_tcp_workaround_signed_windows;
222 228
223extern atomic_t tcp_memory_allocated; 229extern atomic_t tcp_memory_allocated;
224extern atomic_t tcp_sockets_allocated; 230extern atomic_t tcp_sockets_allocated;
@@ -347,6 +353,12 @@ extern int tcp_getsockopt(struct sock *sk, int level,
347extern int tcp_setsockopt(struct sock *sk, int level, 353extern int tcp_setsockopt(struct sock *sk, int level,
348 int optname, char __user *optval, 354 int optname, char __user *optval,
349 int optlen); 355 int optlen);
356extern int compat_tcp_getsockopt(struct sock *sk,
357 int level, int optname,
358 char __user *optval, int __user *optlen);
359extern int compat_tcp_setsockopt(struct sock *sk,
360 int level, int optname,
361 char __user *optval, int optlen);
350extern void tcp_set_keepalive(struct sock *sk, int val); 362extern void tcp_set_keepalive(struct sock *sk, int val);
351extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, 363extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
352 struct msghdr *msg, 364 struct msghdr *msg,
@@ -393,9 +405,6 @@ extern int tcp_disconnect(struct sock *sk, int flags);
393 405
394extern void tcp_unhash(struct sock *sk); 406extern void tcp_unhash(struct sock *sk);
395 407
396extern int tcp_v4_hash_connecting(struct sock *sk);
397
398
399/* From syncookies.c */ 408/* From syncookies.c */
400extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 409extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
401 struct ip_options *opt); 410 struct ip_options *opt);
@@ -447,6 +456,10 @@ extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
447 456
448extern void tcp_initialize_rcv_mss(struct sock *sk); 457extern void tcp_initialize_rcv_mss(struct sock *sk);
449 458
459extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
460extern int tcp_mss_to_mtu(struct sock *sk, int mss);
461extern void tcp_mtup_init(struct sock *sk);
462
450static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 463static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
451{ 464{
452 tp->pred_flags = htonl((tp->tcp_header_len << 26) | 465 tp->pred_flags = htonl((tp->tcp_header_len << 26) |
diff --git a/include/net/x25.h b/include/net/x25.h
index fee62ff8c194..0ad90ebcf86e 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -101,9 +101,17 @@ enum {
101#define X25_FAC_PACKET_SIZE 0x42 101#define X25_FAC_PACKET_SIZE 0x42
102#define X25_FAC_WINDOW_SIZE 0x43 102#define X25_FAC_WINDOW_SIZE 0x43
103 103
104#define X25_MAX_FAC_LEN 20 /* Plenty to spare */ 104#define X25_MAX_FAC_LEN 60
105#define X25_MAX_CUD_LEN 128 105#define X25_MAX_CUD_LEN 128
106 106
107#define X25_FAC_CALLING_AE 0xCB
108#define X25_FAC_CALLED_AE 0xC9
109
110#define X25_MARKER 0x00
111#define X25_DTE_SERVICES 0x0F
112#define X25_MAX_AE_LEN 40 /* Max num of semi-octets in AE - OSI Nw */
113#define X25_MAX_DTE_FACIL_LEN 21 /* Max length of DTE facility params */
114
107/** 115/**
108 * struct x25_route - x25 routing entry 116 * struct x25_route - x25 routing entry
109 * @node - entry in x25_list_lock 117 * @node - entry in x25_list_lock
@@ -148,6 +156,7 @@ struct x25_sock {
148 struct timer_list timer; 156 struct timer_list timer;
149 struct x25_causediag causediag; 157 struct x25_causediag causediag;
150 struct x25_facilities facilities; 158 struct x25_facilities facilities;
159 struct x25_dte_facilities dte_facilities;
151 struct x25_calluserdata calluserdata; 160 struct x25_calluserdata calluserdata;
152 unsigned long vc_facil_mask; /* inc_call facilities mask */ 161 unsigned long vc_facil_mask; /* inc_call facilities mask */
153}; 162};
@@ -180,9 +189,13 @@ extern void x25_establish_link(struct x25_neigh *);
180extern void x25_terminate_link(struct x25_neigh *); 189extern void x25_terminate_link(struct x25_neigh *);
181 190
182/* x25_facilities.c */ 191/* x25_facilities.c */
183extern int x25_parse_facilities(struct sk_buff *, struct x25_facilities *, unsigned long *); 192extern int x25_parse_facilities(struct sk_buff *, struct x25_facilities *,
184extern int x25_create_facilities(unsigned char *, struct x25_facilities *, unsigned long); 193 struct x25_dte_facilities *, unsigned long *);
185extern int x25_negotiate_facilities(struct sk_buff *, struct sock *, struct x25_facilities *); 194extern int x25_create_facilities(unsigned char *, struct x25_facilities *,
195 struct x25_dte_facilities *, unsigned long);
196extern int x25_negotiate_facilities(struct sk_buff *, struct sock *,
197 struct x25_facilities *,
198 struct x25_dte_facilities *);
186extern void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *); 199extern void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *);
187 200
188/* x25_in.c */ 201/* x25_in.c */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 8d362c49b8a9..e100291e43f4 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -11,6 +11,7 @@
11#include <linux/crypto.h> 11#include <linux/crypto.h>
12#include <linux/pfkeyv2.h> 12#include <linux/pfkeyv2.h>
13#include <linux/in6.h> 13#include <linux/in6.h>
14#include <linux/mutex.h>
14 15
15#include <net/sock.h> 16#include <net/sock.h>
16#include <net/dst.h> 17#include <net/dst.h>
@@ -20,7 +21,11 @@
20 21
21#define XFRM_ALIGN8(len) (((len) + 7) & ~7) 22#define XFRM_ALIGN8(len) (((len) + 7) & ~7)
22 23
23extern struct semaphore xfrm_cfg_sem; 24extern struct sock *xfrm_nl;
25extern u32 sysctl_xfrm_aevent_etime;
26extern u32 sysctl_xfrm_aevent_rseqth;
27
28extern struct mutex xfrm_cfg_mutex;
24 29
25/* Organization of SPD aka "XFRM rules" 30/* Organization of SPD aka "XFRM rules"
26 ------------------------------------ 31 ------------------------------------
@@ -135,6 +140,16 @@ struct xfrm_state
135 /* State for replay detection */ 140 /* State for replay detection */
136 struct xfrm_replay_state replay; 141 struct xfrm_replay_state replay;
137 142
143 /* Replay detection state at the time we sent the last notification */
144 struct xfrm_replay_state preplay;
145
146 /* Replay detection notification settings */
147 u32 replay_maxage;
148 u32 replay_maxdiff;
149
150 /* Replay detection notification timer */
151 struct timer_list rtimer;
152
138 /* Statistics */ 153 /* Statistics */
139 struct xfrm_stats stats; 154 struct xfrm_stats stats;
140 155
@@ -169,6 +184,7 @@ struct km_event
169 u32 hard; 184 u32 hard;
170 u32 proto; 185 u32 proto;
171 u32 byid; 186 u32 byid;
187 u32 aevent;
172 } data; 188 } data;
173 189
174 u32 seq; 190 u32 seq;
@@ -199,10 +215,13 @@ extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo);
199extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); 215extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo);
200extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c); 216extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c);
201extern void km_state_notify(struct xfrm_state *x, struct km_event *c); 217extern void km_state_notify(struct xfrm_state *x, struct km_event *c);
202
203#define XFRM_ACQ_EXPIRES 30 218#define XFRM_ACQ_EXPIRES 30
204 219
205struct xfrm_tmpl; 220struct xfrm_tmpl;
221extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol);
222extern void km_state_expired(struct xfrm_state *x, int hard, u32 pid);
223extern int __xfrm_state_delete(struct xfrm_state *x);
224
206struct xfrm_state_afinfo { 225struct xfrm_state_afinfo {
207 unsigned short family; 226 unsigned short family;
208 rwlock_t lock; 227 rwlock_t lock;
@@ -305,7 +324,21 @@ struct xfrm_policy
305 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 324 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
306}; 325};
307 326
308#define XFRM_KM_TIMEOUT 30 327#define XFRM_KM_TIMEOUT 30
328/* which seqno */
329#define XFRM_REPLAY_SEQ 1
330#define XFRM_REPLAY_OSEQ 2
331#define XFRM_REPLAY_SEQ_MASK 3
332/* what happened */
333#define XFRM_REPLAY_UPDATE XFRM_AE_CR
334#define XFRM_REPLAY_TIMEOUT XFRM_AE_CE
335
336/* default aevent timeout in units of 100ms */
337#define XFRM_AE_ETIME 10
338/* Async Event timer multiplier */
339#define XFRM_AE_ETH_M 10
340/* default seq threshold size */
341#define XFRM_AE_SEQT_SIZE 2
309 342
310struct xfrm_mgr 343struct xfrm_mgr
311{ 344{
@@ -831,13 +864,19 @@ struct xfrm_algo_desc {
831/* XFRM tunnel handlers. */ 864/* XFRM tunnel handlers. */
832struct xfrm_tunnel { 865struct xfrm_tunnel {
833 int (*handler)(struct sk_buff *skb); 866 int (*handler)(struct sk_buff *skb);
834 void (*err_handler)(struct sk_buff *skb, __u32 info); 867 int (*err_handler)(struct sk_buff *skb, __u32 info);
868
869 struct xfrm_tunnel *next;
870 int priority;
835}; 871};
836 872
837struct xfrm6_tunnel { 873struct xfrm6_tunnel {
838 int (*handler)(struct sk_buff **pskb); 874 int (*handler)(struct sk_buff *skb);
839 void (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, 875 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
840 int type, int code, int offset, __u32 info); 876 int type, int code, int offset, __u32 info);
877
878 struct xfrm6_tunnel *next;
879 int priority;
841}; 880};
842 881
843extern void xfrm_init(void); 882extern void xfrm_init(void);
@@ -865,6 +904,7 @@ extern int xfrm_state_delete(struct xfrm_state *x);
865extern void xfrm_state_flush(u8 proto); 904extern void xfrm_state_flush(u8 proto);
866extern int xfrm_replay_check(struct xfrm_state *x, u32 seq); 905extern int xfrm_replay_check(struct xfrm_state *x, u32 seq);
867extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq); 906extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq);
907extern void xfrm_replay_notify(struct xfrm_state *x, int event);
868extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); 908extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb);
869extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 909extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
870extern int xfrm_init_state(struct xfrm_state *x); 910extern int xfrm_init_state(struct xfrm_state *x);
@@ -872,7 +912,7 @@ extern int xfrm4_rcv(struct sk_buff *skb);
872extern int xfrm4_output(struct sk_buff *skb); 912extern int xfrm4_output(struct sk_buff *skb);
873extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); 913extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
874extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); 914extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
875extern int xfrm6_rcv_spi(struct sk_buff **pskb, u32 spi); 915extern int xfrm6_rcv_spi(struct sk_buff *skb, u32 spi);
876extern int xfrm6_rcv(struct sk_buff **pskb); 916extern int xfrm6_rcv(struct sk_buff **pskb);
877extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); 917extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler);
878extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); 918extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler);
@@ -924,7 +964,7 @@ extern void xfrm_init_pmtu(struct dst_entry *dst);
924 964
925extern wait_queue_head_t km_waitq; 965extern wait_queue_head_t km_waitq;
926extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); 966extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport);
927extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard); 967extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid);
928 968
929extern void xfrm_input_init(void); 969extern void xfrm_input_init(void);
930extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq); 970extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq);
@@ -965,4 +1005,24 @@ static inline int xfrm_policy_id2dir(u32 index)
965 return index & 7; 1005 return index & 7;
966} 1006}
967 1007
1008static inline int xfrm_aevent_is_on(void)
1009{
1010 struct sock *nlsk;
1011 int ret = 0;
1012
1013 rcu_read_lock();
1014 nlsk = rcu_dereference(xfrm_nl);
1015 if (nlsk)
1016 ret = netlink_has_listeners(nlsk, XFRMNLGRP_AEVENTS);
1017 rcu_read_unlock();
1018 return ret;
1019}
1020
1021static inline void xfrm_aevent_doreplay(struct xfrm_state *x)
1022{
1023 if (xfrm_aevent_is_on())
1024 xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
1025}
1026
1027
968#endif /* _NET_XFRM_H */ 1028#endif /* _NET_XFRM_H */
diff --git a/include/rdma/ib_fmr_pool.h b/include/rdma/ib_fmr_pool.h
index 86b7e93f198b..4ace54cd0cce 100644
--- a/include/rdma/ib_fmr_pool.h
+++ b/include/rdma/ib_fmr_pool.h
@@ -43,6 +43,7 @@ struct ib_fmr_pool;
43/** 43/**
44 * struct ib_fmr_pool_param - Parameters for creating FMR pool 44 * struct ib_fmr_pool_param - Parameters for creating FMR pool
45 * @max_pages_per_fmr:Maximum number of pages per map request. 45 * @max_pages_per_fmr:Maximum number of pages per map request.
46 * @page_shift: Log2 of sizeof "pages" mapped by this fmr
46 * @access:Access flags for FMRs in pool. 47 * @access:Access flags for FMRs in pool.
47 * @pool_size:Number of FMRs to allocate for pool. 48 * @pool_size:Number of FMRs to allocate for pool.
48 * @dirty_watermark:Flush is triggered when @dirty_watermark dirty 49 * @dirty_watermark:Flush is triggered when @dirty_watermark dirty
@@ -55,6 +56,7 @@ struct ib_fmr_pool;
55 */ 56 */
56struct ib_fmr_pool_param { 57struct ib_fmr_pool_param {
57 int max_pages_per_fmr; 58 int max_pages_per_fmr;
59 int page_shift;
58 enum ib_access_flags access; 60 enum ib_access_flags access;
59 int pool_size; 61 int pool_size;
60 int dirty_watermark; 62 int dirty_watermark;
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index 2c133506742b..5ff77558013b 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -3,7 +3,7 @@
3 * Copyright (c) 2004 Infinicon Corporation. All rights reserved. 3 * Copyright (c) 2004 Infinicon Corporation. All rights reserved.
4 * Copyright (c) 2004 Intel Corporation. All rights reserved. 4 * Copyright (c) 2004 Intel Corporation. All rights reserved.
5 * Copyright (c) 2004 Topspin Corporation. All rights reserved. 5 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
6 * Copyright (c) 2004 Voltaire Corporation. All rights reserved. 6 * Copyright (c) 2004-2006 Voltaire Corporation. All rights reserved.
7 * 7 *
8 * This software is available to you under a choice of one of two 8 * This software is available to you under a choice of one of two
9 * licenses. You may choose to be licensed under the terms of the GNU 9 * licenses. You may choose to be licensed under the terms of the GNU
@@ -33,7 +33,7 @@
33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 * SOFTWARE. 34 * SOFTWARE.
35 * 35 *
36 * $Id: ib_mad.h 2775 2005-07-02 13:42:12Z halr $ 36 * $Id: ib_mad.h 5596 2006-03-03 01:00:07Z sean.hefty $
37 */ 37 */
38 38
39#if !defined( IB_MAD_H ) 39#if !defined( IB_MAD_H )
@@ -55,6 +55,10 @@
55#define IB_MGMT_CLASS_DEVICE_MGMT 0x06 55#define IB_MGMT_CLASS_DEVICE_MGMT 0x06
56#define IB_MGMT_CLASS_CM 0x07 56#define IB_MGMT_CLASS_CM 0x07
57#define IB_MGMT_CLASS_SNMP 0x08 57#define IB_MGMT_CLASS_SNMP 0x08
58#define IB_MGMT_CLASS_DEVICE_ADM 0x10
59#define IB_MGMT_CLASS_BOOT_MGMT 0x11
60#define IB_MGMT_CLASS_BIS 0x12
61#define IB_MGMT_CLASS_CONG_MGMT 0x21
58#define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30 62#define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30
59#define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F 63#define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F
60 64
@@ -117,6 +121,8 @@ enum {
117 IB_MGMT_VENDOR_DATA = 216, 121 IB_MGMT_VENDOR_DATA = 216,
118 IB_MGMT_SA_HDR = 56, 122 IB_MGMT_SA_HDR = 56,
119 IB_MGMT_SA_DATA = 200, 123 IB_MGMT_SA_DATA = 200,
124 IB_MGMT_DEVICE_HDR = 64,
125 IB_MGMT_DEVICE_DATA = 192,
120}; 126};
121 127
122struct ib_mad_hdr { 128struct ib_mad_hdr {
@@ -208,15 +214,23 @@ struct ib_class_port_info
208/** 214/**
209 * ib_mad_send_buf - MAD data buffer and work request for sends. 215 * ib_mad_send_buf - MAD data buffer and work request for sends.
210 * @next: A pointer used to chain together MADs for posting. 216 * @next: A pointer used to chain together MADs for posting.
211 * @mad: References an allocated MAD data buffer. 217 * @mad: References an allocated MAD data buffer for MADs that do not have
218 * RMPP active. For MADs using RMPP, references the common and management
219 * class specific headers.
212 * @mad_agent: MAD agent that allocated the buffer. 220 * @mad_agent: MAD agent that allocated the buffer.
213 * @ah: The address handle to use when sending the MAD. 221 * @ah: The address handle to use when sending the MAD.
214 * @context: User-controlled context fields. 222 * @context: User-controlled context fields.
223 * @hdr_len: Indicates the size of the data header of the MAD. This length
224 * includes the common MAD, RMPP, and class specific headers.
225 * @data_len: Indicates the total size of user-transferred data.
226 * @seg_count: The number of RMPP segments allocated for this send.
227 * @seg_size: Size of each RMPP segment.
215 * @timeout_ms: Time to wait for a response. 228 * @timeout_ms: Time to wait for a response.
216 * @retries: Number of times to retry a request for a response. 229 * @retries: Number of times to retry a request for a response.
217 * 230 *
218 * Users are responsible for initializing the MAD buffer itself, with the 231 * Users are responsible for initializing the MAD buffer itself, with the
219 * exception of specifying the payload length field in any RMPP MAD. 232 * exception of any RMPP header. Additional segment buffer space allocated
233 * beyond data_len is padding.
220 */ 234 */
221struct ib_mad_send_buf { 235struct ib_mad_send_buf {
222 struct ib_mad_send_buf *next; 236 struct ib_mad_send_buf *next;
@@ -224,6 +238,10 @@ struct ib_mad_send_buf {
224 struct ib_mad_agent *mad_agent; 238 struct ib_mad_agent *mad_agent;
225 struct ib_ah *ah; 239 struct ib_ah *ah;
226 void *context[2]; 240 void *context[2];
241 int hdr_len;
242 int data_len;
243 int seg_count;
244 int seg_size;
227 int timeout_ms; 245 int timeout_ms;
228 int retries; 246 int retries;
229}; 247};
@@ -299,7 +317,7 @@ typedef void (*ib_mad_snoop_handler)(struct ib_mad_agent *mad_agent,
299 * @mad_recv_wc: Received work completion information on the received MAD. 317 * @mad_recv_wc: Received work completion information on the received MAD.
300 * 318 *
301 * MADs received in response to a send request operation will be handed to 319 * MADs received in response to a send request operation will be handed to
302 * the user after the send operation completes. All data buffers given 320 * the user before the send operation completes. All data buffers given
303 * to registered agents through this routine are owned by the receiving 321 * to registered agents through this routine are owned by the receiving
304 * client, except for snooping agents. Clients snooping MADs should not 322 * client, except for snooping agents. Clients snooping MADs should not
305 * modify the data referenced by @mad_recv_wc. 323 * modify the data referenced by @mad_recv_wc.
@@ -485,17 +503,6 @@ int ib_unregister_mad_agent(struct ib_mad_agent *mad_agent);
485int ib_post_send_mad(struct ib_mad_send_buf *send_buf, 503int ib_post_send_mad(struct ib_mad_send_buf *send_buf,
486 struct ib_mad_send_buf **bad_send_buf); 504 struct ib_mad_send_buf **bad_send_buf);
487 505
488/**
489 * ib_coalesce_recv_mad - Coalesces received MAD data into a single buffer.
490 * @mad_recv_wc: Work completion information for a received MAD.
491 * @buf: User-provided data buffer to receive the coalesced buffers. The
492 * referenced buffer should be at least the size of the mad_len specified
493 * by @mad_recv_wc.
494 *
495 * This call copies a chain of received MAD segments into a single data buffer,
496 * removing duplicated headers.
497 */
498void ib_coalesce_recv_mad(struct ib_mad_recv_wc *mad_recv_wc, void *buf);
499 506
500/** 507/**
501 * ib_free_recv_mad - Returns data buffers used to receive a MAD. 508 * ib_free_recv_mad - Returns data buffers used to receive a MAD.
@@ -590,9 +597,10 @@ int ib_process_mad_wc(struct ib_mad_agent *mad_agent,
590 * with an initialized work request structure. Users may modify the returned 597 * with an initialized work request structure. Users may modify the returned
591 * MAD data buffer before posting the send. 598 * MAD data buffer before posting the send.
592 * 599 *
593 * The returned data buffer will be cleared. Users are responsible for 600 * The returned MAD header, class specific headers, and any padding will be
594 * initializing the common MAD and any class specific headers. If @rmpp_active 601 * cleared. Users are responsible for initializing the common MAD header,
595 * is set, the RMPP header will be initialized for sending. 602 * any class specific header, and MAD data area.
603 * If @rmpp_active is set, the RMPP header will be initialized for sending.
596 */ 604 */
597struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent, 605struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent,
598 u32 remote_qpn, u16 pkey_index, 606 u32 remote_qpn, u16 pkey_index,
@@ -601,6 +609,35 @@ struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent,
601 gfp_t gfp_mask); 609 gfp_t gfp_mask);
602 610
603/** 611/**
612 * ib_is_mad_class_rmpp - returns whether given management class
613 * supports RMPP.
614 * @mgmt_class: management class
615 *
616 * This routine returns whether the management class supports RMPP.
617 */
618int ib_is_mad_class_rmpp(u8 mgmt_class);
619
620/**
621 * ib_get_mad_data_offset - returns the data offset for a given
622 * management class.
623 * @mgmt_class: management class
624 *
625 * This routine returns the data offset in the MAD for the management
626 * class requested.
627 */
628int ib_get_mad_data_offset(u8 mgmt_class);
629
630/**
631 * ib_get_rmpp_segment - returns the data buffer for a given RMPP segment.
632 * @send_buf: Previously allocated send data buffer.
633 * @seg_num: number of segment to return
634 *
635 * This routine returns a pointer to the data buffer of an RMPP MAD.
636 * Users must provide synchronization to @send_buf around this call.
637 */
638void *ib_get_rmpp_segment(struct ib_mad_send_buf *send_buf, int seg_num);
639
640/**
604 * ib_free_send_mad - Returns data buffers used to send a MAD. 641 * ib_free_send_mad - Returns data buffers used to send a MAD.
605 * @send_buf: Previously allocated send data buffer. 642 * @send_buf: Previously allocated send data buffer.
606 */ 643 */
diff --git a/include/rdma/ib_user_verbs.h b/include/rdma/ib_user_verbs.h
index 5ff1490c08db..338ed4333063 100644
--- a/include/rdma/ib_user_verbs.h
+++ b/include/rdma/ib_user_verbs.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * Copyright (c) 2005 Topspin Communications. All rights reserved. 2 * Copyright (c) 2005 Topspin Communications. All rights reserved.
3 * Copyright (c) 2005 Cisco Systems. All rights reserved. 3 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
4 * Copyright (c) 2005 PathScale, Inc. All rights reserved. 4 * Copyright (c) 2005 PathScale, Inc. All rights reserved.
5 * Copyright (c) 2006 Mellanox Technologies. All rights reserved.
5 * 6 *
6 * This software is available to you under a choice of one of two 7 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU 8 * licenses. You may choose to be licensed under the terms of the GNU
@@ -43,7 +44,7 @@
43 * Increment this value if any changes that break userspace ABI 44 * Increment this value if any changes that break userspace ABI
44 * compatibility are made. 45 * compatibility are made.
45 */ 46 */
46#define IB_USER_VERBS_ABI_VERSION 4 47#define IB_USER_VERBS_ABI_VERSION 6
47 48
48enum { 49enum {
49 IB_USER_VERBS_CMD_GET_CONTEXT, 50 IB_USER_VERBS_CMD_GET_CONTEXT,
@@ -265,6 +266,17 @@ struct ib_uverbs_create_cq_resp {
265 __u32 cqe; 266 __u32 cqe;
266}; 267};
267 268
269struct ib_uverbs_resize_cq {
270 __u64 response;
271 __u32 cq_handle;
272 __u32 cqe;
273 __u64 driver_data[0];
274};
275
276struct ib_uverbs_resize_cq_resp {
277 __u32 cqe;
278};
279
268struct ib_uverbs_poll_cq { 280struct ib_uverbs_poll_cq {
269 __u64 response; 281 __u64 response;
270 __u32 cq_handle; 282 __u32 cq_handle;
@@ -338,6 +350,7 @@ struct ib_uverbs_create_qp_resp {
338 __u32 max_send_sge; 350 __u32 max_send_sge;
339 __u32 max_recv_sge; 351 __u32 max_recv_sge;
340 __u32 max_inline_data; 352 __u32 max_inline_data;
353 __u32 reserved;
341}; 354};
342 355
343/* 356/*
@@ -359,6 +372,47 @@ struct ib_uverbs_qp_dest {
359 __u8 port_num; 372 __u8 port_num;
360}; 373};
361 374
375struct ib_uverbs_query_qp {
376 __u64 response;
377 __u32 qp_handle;
378 __u32 attr_mask;
379 __u64 driver_data[0];
380};
381
382struct ib_uverbs_query_qp_resp {
383 struct ib_uverbs_qp_dest dest;
384 struct ib_uverbs_qp_dest alt_dest;
385 __u32 max_send_wr;
386 __u32 max_recv_wr;
387 __u32 max_send_sge;
388 __u32 max_recv_sge;
389 __u32 max_inline_data;
390 __u32 qkey;
391 __u32 rq_psn;
392 __u32 sq_psn;
393 __u32 dest_qp_num;
394 __u32 qp_access_flags;
395 __u16 pkey_index;
396 __u16 alt_pkey_index;
397 __u8 qp_state;
398 __u8 cur_qp_state;
399 __u8 path_mtu;
400 __u8 path_mig_state;
401 __u8 en_sqd_async_notify;
402 __u8 max_rd_atomic;
403 __u8 max_dest_rd_atomic;
404 __u8 min_rnr_timer;
405 __u8 port_num;
406 __u8 timeout;
407 __u8 retry_cnt;
408 __u8 rnr_retry;
409 __u8 alt_port_num;
410 __u8 alt_timeout;
411 __u8 sq_sig_all;
412 __u8 reserved[5];
413 __u64 driver_data[0];
414};
415
362struct ib_uverbs_modify_qp { 416struct ib_uverbs_modify_qp {
363 struct ib_uverbs_qp_dest dest; 417 struct ib_uverbs_qp_dest dest;
364 struct ib_uverbs_qp_dest alt_dest; 418 struct ib_uverbs_qp_dest alt_dest;
@@ -415,7 +469,7 @@ struct ib_uverbs_sge {
415}; 469};
416 470
417struct ib_uverbs_send_wr { 471struct ib_uverbs_send_wr {
418 __u64 wr_id; 472 __u64 wr_id;
419 __u32 num_sge; 473 __u32 num_sge;
420 __u32 opcode; 474 __u32 opcode;
421 __u32 send_flags; 475 __u32 send_flags;
@@ -489,7 +543,7 @@ struct ib_uverbs_post_srq_recv_resp {
489 543
490struct ib_uverbs_global_route { 544struct ib_uverbs_global_route {
491 __u8 dgid[16]; 545 __u8 dgid[16];
492 __u32 flow_label; 546 __u32 flow_label;
493 __u8 sgid_index; 547 __u8 sgid_index;
494 __u8 hop_limit; 548 __u8 hop_limit;
495 __u8 traffic_class; 549 __u8 traffic_class;
@@ -551,6 +605,9 @@ struct ib_uverbs_create_srq {
551 605
552struct ib_uverbs_create_srq_resp { 606struct ib_uverbs_create_srq_resp {
553 __u32 srq_handle; 607 __u32 srq_handle;
608 __u32 max_wr;
609 __u32 max_sge;
610 __u32 reserved;
554}; 611};
555 612
556struct ib_uverbs_modify_srq { 613struct ib_uverbs_modify_srq {
@@ -561,6 +618,20 @@ struct ib_uverbs_modify_srq {
561 __u64 driver_data[0]; 618 __u64 driver_data[0];
562}; 619};
563 620
621struct ib_uverbs_query_srq {
622 __u64 response;
623 __u32 srq_handle;
624 __u32 reserved;
625 __u64 driver_data[0];
626};
627
628struct ib_uverbs_query_srq_resp {
629 __u32 max_wr;
630 __u32 max_sge;
631 __u32 srq_limit;
632 __u32 reserved;
633};
634
564struct ib_uverbs_destroy_srq { 635struct ib_uverbs_destroy_srq {
565 __u64 response; 636 __u64 response;
566 __u32 srq_handle; 637 __u32 srq_handle;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 22fc886b9695..c1ad6273ac6c 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -5,7 +5,7 @@
5 * Copyright (c) 2004 Topspin Corporation. All rights reserved. 5 * Copyright (c) 2004 Topspin Corporation. All rights reserved.
6 * Copyright (c) 2004 Voltaire Corporation. All rights reserved. 6 * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
7 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. 7 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
8 * Copyright (c) 2005 Cisco Systems. All rights reserved. 8 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
9 * 9 *
10 * This software is available to you under a choice of one of two 10 * This software is available to you under a choice of one of two
11 * licenses. You may choose to be licensed under the terms of the GNU 11 * licenses. You may choose to be licensed under the terms of the GNU
@@ -222,11 +222,13 @@ struct ib_port_attr {
222}; 222};
223 223
224enum ib_device_modify_flags { 224enum ib_device_modify_flags {
225 IB_DEVICE_MODIFY_SYS_IMAGE_GUID = 1 225 IB_DEVICE_MODIFY_SYS_IMAGE_GUID = 1 << 0,
226 IB_DEVICE_MODIFY_NODE_DESC = 1 << 1
226}; 227};
227 228
228struct ib_device_modify { 229struct ib_device_modify {
229 u64 sys_image_guid; 230 u64 sys_image_guid;
231 char node_desc[64];
230}; 232};
231 233
232enum ib_port_modify_flags { 234enum ib_port_modify_flags {
@@ -649,7 +651,7 @@ struct ib_mw_bind {
649struct ib_fmr_attr { 651struct ib_fmr_attr {
650 int max_pages; 652 int max_pages;
651 int max_maps; 653 int max_maps;
652 u8 page_size; 654 u8 page_shift;
653}; 655};
654 656
655struct ib_ucontext { 657struct ib_ucontext {
@@ -880,7 +882,8 @@ struct ib_device {
880 struct ib_ucontext *context, 882 struct ib_ucontext *context,
881 struct ib_udata *udata); 883 struct ib_udata *udata);
882 int (*destroy_cq)(struct ib_cq *cq); 884 int (*destroy_cq)(struct ib_cq *cq);
883 int (*resize_cq)(struct ib_cq *cq, int cqe); 885 int (*resize_cq)(struct ib_cq *cq, int cqe,
886 struct ib_udata *udata);
884 int (*poll_cq)(struct ib_cq *cq, int num_entries, 887 int (*poll_cq)(struct ib_cq *cq, int num_entries,
885 struct ib_wc *wc); 888 struct ib_wc *wc);
886 int (*peek_cq)(struct ib_cq *cq, int wc_cnt); 889 int (*peek_cq)(struct ib_cq *cq, int wc_cnt);
@@ -950,6 +953,7 @@ struct ib_device {
950 u64 uverbs_cmd_mask; 953 u64 uverbs_cmd_mask;
951 int uverbs_abi_ver; 954 int uverbs_abi_ver;
952 955
956 char node_desc[64];
953 __be64 node_guid; 957 __be64 node_guid;
954 u8 node_type; 958 u8 node_type;
955 u8 phys_port_cnt; 959 u8 phys_port_cnt;
@@ -986,6 +990,24 @@ static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len
986 return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0; 990 return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0;
987} 991}
988 992
993/**
994 * ib_modify_qp_is_ok - Check that the supplied attribute mask
995 * contains all required attributes and no attributes not allowed for
996 * the given QP state transition.
997 * @cur_state: Current QP state
998 * @next_state: Next QP state
999 * @type: QP type
1000 * @mask: Mask of supplied QP attributes
1001 *
1002 * This function is a helper function that a low-level driver's
1003 * modify_qp method can use to validate the consumer's input. It
1004 * checks that cur_state and next_state are valid QP states, that a
1005 * transition from cur_state to next_state is allowed by the IB spec,
1006 * and that the attribute mask supplied is allowed for the transition.
1007 */
1008int ib_modify_qp_is_ok(enum ib_qp_state cur_state, enum ib_qp_state next_state,
1009 enum ib_qp_type type, enum ib_qp_attr_mask mask);
1010
989int ib_register_event_handler (struct ib_event_handler *event_handler); 1011int ib_register_event_handler (struct ib_event_handler *event_handler);
990int ib_unregister_event_handler(struct ib_event_handler *event_handler); 1012int ib_unregister_event_handler(struct ib_event_handler *event_handler);
991void ib_dispatch_event(struct ib_event *event); 1013void ib_dispatch_event(struct ib_event *event);
@@ -1078,7 +1100,9 @@ int ib_destroy_ah(struct ib_ah *ah);
1078 * ib_create_srq - Creates a SRQ associated with the specified protection 1100 * ib_create_srq - Creates a SRQ associated with the specified protection
1079 * domain. 1101 * domain.
1080 * @pd: The protection domain associated with the SRQ. 1102 * @pd: The protection domain associated with the SRQ.
1081 * @srq_init_attr: A list of initial attributes required to create the SRQ. 1103 * @srq_init_attr: A list of initial attributes required to create the
1104 * SRQ. If SRQ creation succeeds, then the attributes are updated to
1105 * the actual capabilities of the created SRQ.
1082 * 1106 *
1083 * srq_attr->max_wr and srq_attr->max_sge are read the determine the 1107 * srq_attr->max_wr and srq_attr->max_sge are read the determine the
1084 * requested size of the SRQ, and set to the actual values allocated 1108 * requested size of the SRQ, and set to the actual values allocated
@@ -1137,7 +1161,9 @@ static inline int ib_post_srq_recv(struct ib_srq *srq,
1137 * ib_create_qp - Creates a QP associated with the specified protection 1161 * ib_create_qp - Creates a QP associated with the specified protection
1138 * domain. 1162 * domain.
1139 * @pd: The protection domain associated with the QP. 1163 * @pd: The protection domain associated with the QP.
1140 * @qp_init_attr: A list of initial attributes required to create the QP. 1164 * @qp_init_attr: A list of initial attributes required to create the
1165 * QP. If QP creation succeeds, then the attributes are updated to
1166 * the actual capabilities of the created QP.
1141 */ 1167 */
1142struct ib_qp *ib_create_qp(struct ib_pd *pd, 1168struct ib_qp *ib_create_qp(struct ib_pd *pd,
1143 struct ib_qp_init_attr *qp_init_attr); 1169 struct ib_qp_init_attr *qp_init_attr);
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 9c331258bc27..c60b8ff2f5e4 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -433,6 +433,4 @@ struct scsi_lun {
433/* Used to obtain the PCI location of a device */ 433/* Used to obtain the PCI location of a device */
434#define SCSI_IOCTL_GET_PCI 0x5387 434#define SCSI_IOCTL_GET_PCI 0x5387
435 435
436int scsi_execute_in_process_context(void (*fn)(void *data), void *data);
437
438#endif /* _SCSI_SCSI_H */ 436#endif /* _SCSI_SCSI_H */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 7529f4388bb4..1ace1b9fe537 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -104,10 +104,10 @@ struct scsi_cmnd {
104 working on */ 104 working on */
105 105
106#define SCSI_SENSE_BUFFERSIZE 96 106#define SCSI_SENSE_BUFFERSIZE 96
107 unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE]; /* obtained by REQUEST SENSE 107 unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE];
108 * when CHECK CONDITION is 108 /* obtained by REQUEST SENSE when
109 * received on original command 109 * CHECK CONDITION is received on original
110 * (auto-sense) */ 110 * command (auto-sense) */
111 111
112 /* Low-level done function - can be used by low-level driver to point 112 /* Low-level done function - can be used by low-level driver to point
113 * to completion function. Not used by mid/upper level code. */ 113 * to completion function. Not used by mid/upper level code. */
@@ -120,12 +120,12 @@ struct scsi_cmnd {
120 struct scsi_pointer SCp; /* Scratchpad used by some host adapters */ 120 struct scsi_pointer SCp; /* Scratchpad used by some host adapters */
121 121
122 unsigned char *host_scribble; /* The host adapter is allowed to 122 unsigned char *host_scribble; /* The host adapter is allowed to
123 * call scsi_malloc and get some memory 123 * call scsi_malloc and get some memory
124 * and hang it here. The host adapter 124 * and hang it here. The host adapter
125 * is also expected to call scsi_free 125 * is also expected to call scsi_free
126 * to release this memory. (The memory 126 * to release this memory. (The memory
127 * obtained by scsi_malloc is guaranteed 127 * obtained by scsi_malloc is guaranteed
128 * to be at an address < 16Mb). */ 128 * to be at an address < 16Mb). */
129 129
130 int result; /* Status code from lower level driver */ 130 int result; /* Status code from lower level driver */
131 131
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 290e3b4d2aec..895d212864cd 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -4,6 +4,7 @@
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/workqueue.h>
7#include <asm/atomic.h> 8#include <asm/atomic.h>
8 9
9struct request_queue; 10struct request_queue;
@@ -73,7 +74,6 @@ struct scsi_device {
73 unsigned sector_size; /* size in bytes */ 74 unsigned sector_size; /* size in bytes */
74 75
75 void *hostdata; /* available to low-level driver */ 76 void *hostdata; /* available to low-level driver */
76 char devfs_name[256]; /* devfs junk */
77 char type; 77 char type;
78 char scsi_level; 78 char scsi_level;
79 char inq_periph_qual; /* PQ from INQUIRY data */ 79 char inq_periph_qual; /* PQ from INQUIRY data */
@@ -138,6 +138,8 @@ struct scsi_device {
138 struct device sdev_gendev; 138 struct device sdev_gendev;
139 struct class_device sdev_classdev; 139 struct class_device sdev_classdev;
140 140
141 struct execute_work ew; /* used to get process context on put */
142
141 enum scsi_device_state sdev_state; 143 enum scsi_device_state sdev_state;
142 unsigned long sdev_data[0]; 144 unsigned long sdev_data[0];
143} __attribute__((aligned(sizeof(unsigned long)))); 145} __attribute__((aligned(sizeof(unsigned long))));
@@ -154,6 +156,11 @@ struct scsi_device {
154#define scmd_printk(prefix, scmd, fmt, a...) \ 156#define scmd_printk(prefix, scmd, fmt, a...) \
155 dev_printk(prefix, &(scmd)->device->sdev_gendev, fmt, ##a) 157 dev_printk(prefix, &(scmd)->device->sdev_gendev, fmt, ##a)
156 158
159enum scsi_target_state {
160 STARGET_RUNNING = 1,
161 STARGET_DEL,
162};
163
157/* 164/*
158 * scsi_target: representation of a scsi target, for now, this is only 165 * scsi_target: representation of a scsi target, for now, this is only
159 * used for single_lun devices. If no one has active IO to the target, 166 * used for single_lun devices. If no one has active IO to the target,
@@ -168,8 +175,13 @@ struct scsi_target {
168 unsigned int channel; 175 unsigned int channel;
169 unsigned int id; /* target id ... replace 176 unsigned int id; /* target id ... replace
170 * scsi_device.id eventually */ 177 * scsi_device.id eventually */
171 unsigned long create:1; /* signal that it needs to be added */ 178 unsigned int create:1; /* signal that it needs to be added */
179 unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */
180 /* means no lun present */
181
172 char scsi_level; 182 char scsi_level;
183 struct execute_work ew;
184 enum scsi_target_state state;
173 void *hostdata; /* available to low-level driver */ 185 void *hostdata; /* available to low-level driver */
174 unsigned long starget_data[0]; /* for the transport */ 186 unsigned long starget_data[0]; /* for the transport */
175 /* starget_data must be the last element!!!! */ 187 /* starget_data must be the last element!!!! */
@@ -249,6 +261,11 @@ extern int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
249 unsigned char *buffer, int len, int timeout, 261 unsigned char *buffer, int len, int timeout,
250 int retries, struct scsi_mode_data *data, 262 int retries, struct scsi_mode_data *data,
251 struct scsi_sense_hdr *); 263 struct scsi_sense_hdr *);
264extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp,
265 int modepage, unsigned char *buffer, int len,
266 int timeout, int retries,
267 struct scsi_mode_data *data,
268 struct scsi_sense_hdr *);
252extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, 269extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout,
253 int retries); 270 int retries);
254extern int scsi_device_set_state(struct scsi_device *sdev, 271extern int scsi_device_set_state(struct scsi_device *sdev,
@@ -281,6 +298,11 @@ extern int scsi_execute_async(struct scsi_device *sdev,
281 void (*done)(void *, char *, int, int), 298 void (*done)(void *, char *, int, int),
282 gfp_t gfp); 299 gfp_t gfp);
283 300
301static inline void scsi_device_reprobe(struct scsi_device *sdev)
302{
303 device_reprobe(&sdev->sdev_gendev);
304}
305
284static inline unsigned int sdev_channel(struct scsi_device *sdev) 306static inline unsigned int sdev_channel(struct scsi_device *sdev)
285{ 307{
286 return sdev->channel; 308 return sdev->channel;
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index fabd879c2f2e..d160880b2a87 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -35,6 +35,9 @@ static inline int scsi_sense_valid(struct scsi_sense_hdr *sshdr)
35} 35}
36 36
37 37
38extern void scsi_eh_finish_cmd(struct scsi_cmnd *scmd,
39 struct list_head *done_q);
40extern void scsi_eh_flush_done_q(struct list_head *done_q);
38extern void scsi_report_bus_reset(struct Scsi_Host *, int); 41extern void scsi_report_bus_reset(struct Scsi_Host *, int);
39extern void scsi_report_device_reset(struct Scsi_Host *, int, int); 42extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
40extern int scsi_block_when_processing_errors(struct scsi_device *); 43extern int scsi_block_when_processing_errors(struct scsi_device *);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 827992949c4b..dc6862d09e53 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -147,20 +147,6 @@ struct scsi_host_template {
147 int (* eh_host_reset_handler)(struct scsi_cmnd *); 147 int (* eh_host_reset_handler)(struct scsi_cmnd *);
148 148
149 /* 149 /*
150 * This is an optional routine to notify the host that the scsi
151 * timer just fired. The returns tell the timer routine what to
152 * do about this:
153 *
154 * EH_HANDLED: I fixed the error, please complete the command
155 * EH_RESET_TIMER: I need more time, reset the timer and
156 * begin counting again
157 * EH_NOT_HANDLED Begin normal error recovery
158 *
159 * Status: OPTIONAL
160 */
161 enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
162
163 /*
164 * Before the mid layer attempts to scan for a new device where none 150 * Before the mid layer attempts to scan for a new device where none
165 * currently exists, it will call this entry in your driver. Should 151 * currently exists, it will call this entry in your driver. Should
166 * your driver need to allocate any structs or perform any other init 152 * your driver need to allocate any structs or perform any other init
@@ -300,7 +286,7 @@ struct scsi_host_template {
300 * suspend support 286 * suspend support
301 */ 287 */
302 int (*resume)(struct scsi_device *); 288 int (*resume)(struct scsi_device *);
303 int (*suspend)(struct scsi_device *); 289 int (*suspend)(struct scsi_device *, pm_message_t state);
304 290
305 /* 291 /*
306 * Name of proc directory 292 * Name of proc directory
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index e7b1054adf86..b3657f111937 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -48,6 +48,17 @@ struct scsi_transport_template {
48 * True if the transport wants to use a host-based work-queue 48 * True if the transport wants to use a host-based work-queue
49 */ 49 */
50 unsigned int create_work_queue : 1; 50 unsigned int create_work_queue : 1;
51
52 /*
53 * This is an optional routine that allows the transport to become
54 * involved when a scsi io timer fires. The return value tells the
55 * timer routine how to finish the io timeout handling:
56 * EH_HANDLED: I fixed the error, please complete the command
57 * EH_RESET_TIMER: I need more time, reset the timer and
58 * begin counting again
59 * EH_NOT_HANDLED Begin normal error recovery
60 */
61 enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
51}; 62};
52 63
53#define transport_class_to_shost(tc) \ 64#define transport_class_to_shost(tc) \
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index b91400bfb02a..93cfb4bf4211 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -30,6 +30,7 @@ enum sas_linkrate {
30 SAS_SATA_PORT_SELECTOR, 30 SAS_SATA_PORT_SELECTOR,
31 SAS_LINK_RATE_1_5_GBPS, 31 SAS_LINK_RATE_1_5_GBPS,
32 SAS_LINK_RATE_3_0_GBPS, 32 SAS_LINK_RATE_3_0_GBPS,
33 SAS_LINK_RATE_6_0_GBPS,
33 SAS_LINK_VIRTUAL, 34 SAS_LINK_VIRTUAL,
34}; 35};
35 36
@@ -89,11 +90,45 @@ struct sas_rphy {
89 dev_to_rphy((cdev)->dev) 90 dev_to_rphy((cdev)->dev)
90#define rphy_to_shost(rphy) \ 91#define rphy_to_shost(rphy) \
91 dev_to_shost((rphy)->dev.parent) 92 dev_to_shost((rphy)->dev.parent)
93#define target_to_rphy(targ) \
94 dev_to_rphy((targ)->dev.parent)
95
96struct sas_end_device {
97 struct sas_rphy rphy;
98 /* flags */
99 unsigned ready_led_meaning:1;
100 /* parameters */
101 u16 I_T_nexus_loss_timeout;
102 u16 initiator_response_timeout;
103};
104#define rphy_to_end_device(r) \
105 container_of((r), struct sas_end_device, rphy)
106
107struct sas_expander_device {
108 int level;
109
110 #define SAS_EXPANDER_VENDOR_ID_LEN 8
111 char vendor_id[SAS_EXPANDER_VENDOR_ID_LEN+1];
112 #define SAS_EXPANDER_PRODUCT_ID_LEN 16
113 char product_id[SAS_EXPANDER_PRODUCT_ID_LEN+1];
114 #define SAS_EXPANDER_PRODUCT_REV_LEN 4
115 char product_rev[SAS_EXPANDER_PRODUCT_REV_LEN+1];
116 #define SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN 8
117 char component_vendor_id[SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN+1];
118 u16 component_id;
119 u8 component_revision_id;
92 120
121 struct sas_rphy rphy;
122
123};
124#define rphy_to_expander_device(r) \
125 container_of((r), struct sas_expander_device, rphy)
93 126
94/* The functions by which the transport class and the driver communicate */ 127/* The functions by which the transport class and the driver communicate */
95struct sas_function_template { 128struct sas_function_template {
96 int (*get_linkerrors)(struct sas_phy *); 129 int (*get_linkerrors)(struct sas_phy *);
130 int (*get_enclosure_identifier)(struct sas_rphy *, u64 *);
131 int (*get_bay_identifier)(struct sas_rphy *);
97 int (*phy_reset)(struct sas_phy *, int); 132 int (*phy_reset)(struct sas_phy *, int);
98}; 133};
99 134
@@ -106,7 +141,8 @@ extern int sas_phy_add(struct sas_phy *);
106extern void sas_phy_delete(struct sas_phy *); 141extern void sas_phy_delete(struct sas_phy *);
107extern int scsi_is_sas_phy(const struct device *); 142extern int scsi_is_sas_phy(const struct device *);
108 143
109extern struct sas_rphy *sas_rphy_alloc(struct sas_phy *); 144extern struct sas_rphy *sas_end_device_alloc(struct sas_phy *);
145extern struct sas_rphy *sas_expander_alloc(struct sas_phy *, enum sas_device_type);
110void sas_rphy_free(struct sas_rphy *); 146void sas_rphy_free(struct sas_rphy *);
111extern int sas_rphy_add(struct sas_rphy *); 147extern int sas_rphy_add(struct sas_rphy *);
112extern void sas_rphy_delete(struct sas_rphy *); 148extern void sas_rphy_delete(struct sas_rphy *);
@@ -115,5 +151,17 @@ extern int scsi_is_sas_rphy(const struct device *);
115extern struct scsi_transport_template * 151extern struct scsi_transport_template *
116sas_attach_transport(struct sas_function_template *); 152sas_attach_transport(struct sas_function_template *);
117extern void sas_release_transport(struct scsi_transport_template *); 153extern void sas_release_transport(struct scsi_transport_template *);
154int sas_read_port_mode_page(struct scsi_device *);
155
156static inline int
157scsi_is_sas_expander_device(struct device *dev)
158{
159 struct sas_rphy *rphy;
160 if (!scsi_is_sas_rphy(dev))
161 return 0;
162 rphy = dev_to_rphy(dev);
163 return rphy->identify.device_type == SAS_FANOUT_EXPANDER_DEVICE ||
164 rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE;
165}
118 166
119#endif /* SCSI_TRANSPORT_SAS_H */ 167#endif /* SCSI_TRANSPORT_SAS_H */
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index fb5a2ffae939..5e1d61913d4e 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -148,5 +148,9 @@ void spi_schedule_dv_device(struct scsi_device *);
148void spi_dv_device(struct scsi_device *); 148void spi_dv_device(struct scsi_device *);
149void spi_display_xfer_agreement(struct scsi_target *); 149void spi_display_xfer_agreement(struct scsi_target *);
150int spi_print_msg(const unsigned char *); 150int spi_print_msg(const unsigned char *);
151int spi_populate_width_msg(unsigned char *msg, int width);
152int spi_populate_sync_msg(unsigned char *msg, int period, int offset);
153int spi_populate_ppr_msg(unsigned char *msg, int period, int offset, int width,
154 int options);
151 155
152#endif /* SCSI_TRANSPORT_SPI_H */ 156#endif /* SCSI_TRANSPORT_SPI_H */
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index b0b3ea7b365e..b45a73712748 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -433,6 +433,12 @@ struct snd_ac97_bus {
433 struct snd_info_entry *proc; 433 struct snd_info_entry *proc;
434}; 434};
435 435
436/* static resolution table */
437struct snd_ac97_res_table {
438 unsigned short reg; /* register */
439 unsigned short bits; /* resolution bitmask */
440};
441
436struct snd_ac97_template { 442struct snd_ac97_template {
437 void *private_data; 443 void *private_data;
438 void (*private_free) (struct snd_ac97 *ac97); 444 void (*private_free) (struct snd_ac97 *ac97);
@@ -440,8 +446,7 @@ struct snd_ac97_template {
440 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ 446 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */
441 unsigned short addr; /* physical address of codec [0-3] */ 447 unsigned short addr; /* physical address of codec [0-3] */
442 unsigned int scaps; /* driver capabilities */ 448 unsigned int scaps; /* driver capabilities */
443 unsigned int limited_regs; /* allow limited registers only */ 449 const struct snd_ac97_res_table *res_table; /* static resolution */
444 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */
445}; 450};
446 451
447struct snd_ac97 { 452struct snd_ac97 {
@@ -456,20 +461,20 @@ struct snd_ac97 {
456 struct snd_info_entry *proc_regs; 461 struct snd_info_entry *proc_regs;
457 unsigned short subsystem_vendor; 462 unsigned short subsystem_vendor;
458 unsigned short subsystem_device; 463 unsigned short subsystem_device;
459 struct semaphore reg_mutex; 464 struct mutex reg_mutex;
460 struct semaphore page_mutex; /* mutex for AD18xx multi-codecs and paging (2.3) */ 465 struct mutex page_mutex; /* mutex for AD18xx multi-codecs and paging (2.3) */
461 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ 466 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */
462 unsigned short addr; /* physical address of codec [0-3] */ 467 unsigned short addr; /* physical address of codec [0-3] */
463 unsigned int id; /* identification of codec */ 468 unsigned int id; /* identification of codec */
464 unsigned short caps; /* capabilities (register 0) */ 469 unsigned short caps; /* capabilities (register 0) */
465 unsigned short ext_id; /* extended feature identification (register 28) */ 470 unsigned short ext_id; /* extended feature identification (register 28) */
466 unsigned short ext_mid; /* extended modem ID (register 3C) */ 471 unsigned short ext_mid; /* extended modem ID (register 3C) */
472 const struct snd_ac97_res_table *res_table; /* static resolution */
467 unsigned int scaps; /* driver capabilities */ 473 unsigned int scaps; /* driver capabilities */
468 unsigned int flags; /* specific code */ 474 unsigned int flags; /* specific code */
469 unsigned int rates[6]; /* see AC97_RATES_* defines */ 475 unsigned int rates[6]; /* see AC97_RATES_* defines */
470 unsigned int spdif_status; 476 unsigned int spdif_status;
471 unsigned short regs[0x80]; /* register cache */ 477 unsigned short regs[0x80]; /* register cache */
472 unsigned int limited_regs; /* allow limited registers only */
473 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */ 478 DECLARE_BITMAP(reg_accessed, 0x80); /* bit flags */
474 union { /* vendor specific code */ 479 union { /* vendor specific code */
475 struct { 480 struct {
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index 1a2759f3a292..57af1fe7b309 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -154,7 +154,7 @@ struct snd_ad1848 {
154#endif 154#endif
155 155
156 spinlock_t reg_lock; 156 spinlock_t reg_lock;
157 struct semaphore open_mutex; 157 struct mutex open_mutex;
158}; 158};
159 159
160/* exported functions */ 160/* exported functions */
diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h
index edf04070ce7c..fb30faab43a8 100644
--- a/include/sound/ak4531_codec.h
+++ b/include/sound/ak4531_codec.h
@@ -71,7 +71,7 @@ struct snd_ak4531 {
71 void (*private_free) (struct snd_ak4531 *ak4531); 71 void (*private_free) (struct snd_ak4531 *ak4531);
72 /* --- */ 72 /* --- */
73 unsigned char regs[0x20]; 73 unsigned char regs[0x20];
74 struct semaphore reg_mutex; 74 struct mutex reg_mutex;
75}; 75};
76 76
77int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531, 77int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
diff --git a/include/sound/core.h b/include/sound/core.h
index 3093e3ddcf36..7f32c12b4a0a 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include <linux/sched.h> /* wake_up() */ 25#include <linux/sched.h> /* wake_up() */
26#include <asm/semaphore.h> /* struct semaphore */ 26#include <linux/mutex.h> /* struct mutex */
27#include <linux/rwsem.h> /* struct rw_semaphore */ 27#include <linux/rwsem.h> /* struct rw_semaphore */
28#include <linux/workqueue.h> /* struct workqueue_struct */ 28#include <linux/workqueue.h> /* struct workqueue_struct */
29#include <linux/pm.h> /* pm_message_t */ 29#include <linux/pm.h> /* pm_message_t */
@@ -137,7 +137,7 @@ struct snd_card {
137 137
138#ifdef CONFIG_PM 138#ifdef CONFIG_PM
139 unsigned int power_state; /* power state */ 139 unsigned int power_state; /* power state */
140 struct semaphore power_lock; /* power lock */ 140 struct mutex power_lock; /* power lock */
141 wait_queue_head_t power_sleep; 141 wait_queue_head_t power_sleep;
142#endif 142#endif
143 143
@@ -150,12 +150,12 @@ struct snd_card {
150#ifdef CONFIG_PM 150#ifdef CONFIG_PM
151static inline void snd_power_lock(struct snd_card *card) 151static inline void snd_power_lock(struct snd_card *card)
152{ 152{
153 down(&card->power_lock); 153 mutex_lock(&card->power_lock);
154} 154}
155 155
156static inline void snd_power_unlock(struct snd_card *card) 156static inline void snd_power_unlock(struct snd_card *card)
157{ 157{
158 up(&card->power_lock); 158 mutex_unlock(&card->power_lock);
159} 159}
160 160
161static inline unsigned int snd_power_get_state(struct snd_card *card) 161static inline unsigned int snd_power_get_state(struct snd_card *card)
@@ -186,7 +186,7 @@ struct snd_minor {
186 int type; /* SNDRV_DEVICE_TYPE_XXX */ 186 int type; /* SNDRV_DEVICE_TYPE_XXX */
187 int card; /* card number */ 187 int card; /* card number */
188 int device; /* device number */ 188 int device; /* device number */
189 struct file_operations *f_ops; /* file operations */ 189 const struct file_operations *f_ops; /* file operations */
190 void *private_data; /* private data for f_ops->open */ 190 void *private_data; /* private data for f_ops->open */
191 char name[0]; /* device name (keep at the end of 191 char name[0]; /* device name (keep at the end of
192 structure) */ 192 structure) */
@@ -200,14 +200,14 @@ extern int snd_ecards_limit;
200void snd_request_card(int card); 200void snd_request_card(int card);
201 201
202int snd_register_device(int type, struct snd_card *card, int dev, 202int snd_register_device(int type, struct snd_card *card, int dev,
203 struct file_operations *f_ops, void *private_data, 203 const struct file_operations *f_ops, void *private_data,
204 const char *name); 204 const char *name);
205int snd_unregister_device(int type, struct snd_card *card, int dev); 205int snd_unregister_device(int type, struct snd_card *card, int dev);
206void *snd_lookup_minor_data(unsigned int minor, int type); 206void *snd_lookup_minor_data(unsigned int minor, int type);
207 207
208#ifdef CONFIG_SND_OSSEMUL 208#ifdef CONFIG_SND_OSSEMUL
209int snd_register_oss_device(int type, struct snd_card *card, int dev, 209int snd_register_oss_device(int type, struct snd_card *card, int dev,
210 struct file_operations *f_ops, void *private_data, 210 const struct file_operations *f_ops, void *private_data,
211 const char *name); 211 const char *name);
212int snd_unregister_oss_device(int type, struct snd_card *card, int dev); 212int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
213void *snd_lookup_oss_minor_data(unsigned int minor, int type); 213void *snd_lookup_oss_minor_data(unsigned int minor, int type);
diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h
index ac6a5d882088..60b5b92a1319 100644
--- a/include/sound/cs4231.h
+++ b/include/sound/cs4231.h
@@ -248,8 +248,8 @@ struct snd_cs4231 {
248 unsigned int c_dma_size; 248 unsigned int c_dma_size;
249 249
250 spinlock_t reg_lock; 250 spinlock_t reg_lock;
251 struct semaphore mce_mutex; 251 struct mutex mce_mutex;
252 struct semaphore open_mutex; 252 struct mutex open_mutex;
253 253
254 int (*rate_constraint) (struct snd_pcm_runtime *runtime); 254 int (*rate_constraint) (struct snd_pcm_runtime *runtime);
255 void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr); 255 void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index 199b5098ff7e..80b2979c0cba 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -1711,7 +1711,7 @@ struct snd_cs46xx {
1711 int current_gpio; 1711 int current_gpio;
1712#endif 1712#endif
1713#ifdef CONFIG_SND_CS46XX_NEW_DSP 1713#ifdef CONFIG_SND_CS46XX_NEW_DSP
1714 struct semaphore spos_mutex; 1714 struct mutex spos_mutex;
1715 1715
1716 struct dsp_spos_instance * dsp_spos_instance; 1716 struct dsp_spos_instance * dsp_spos_instance;
1717 1717
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 951e40d720d9..186e00ad9e79 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -33,6 +33,7 @@
33#include <sound/pcm-indirect.h> 33#include <sound/pcm-indirect.h>
34#include <sound/timer.h> 34#include <sound/timer.h>
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <linux/mutex.h>
36#include <asm/io.h> 37#include <asm/io.h>
37 38
38/* ------------------- DEFINES -------------------- */ 39/* ------------------- DEFINES -------------------- */
@@ -1022,7 +1023,7 @@ struct snd_emu10k1_fx8010 {
1022 int gpr_size; /* size of allocated GPR controls */ 1023 int gpr_size; /* size of allocated GPR controls */
1023 int gpr_count; /* count of used kcontrols */ 1024 int gpr_count; /* count of used kcontrols */
1024 struct list_head gpr_ctl; /* GPR controls */ 1025 struct list_head gpr_ctl; /* GPR controls */
1025 struct semaphore lock; 1026 struct mutex lock;
1026 struct snd_emu10k1_fx8010_pcm pcm[8]; 1027 struct snd_emu10k1_fx8010_pcm pcm[8];
1027 spinlock_t irq_lock; 1028 spinlock_t irq_lock;
1028 struct snd_emu10k1_fx8010_irq *irq_handlers; 1029 struct snd_emu10k1_fx8010_irq *irq_handlers;
@@ -1122,7 +1123,6 @@ struct snd_emu10k1 {
1122 spinlock_t reg_lock; 1123 spinlock_t reg_lock;
1123 spinlock_t emu_lock; 1124 spinlock_t emu_lock;
1124 spinlock_t voice_lock; 1125 spinlock_t voice_lock;
1125 struct semaphore ptb_lock;
1126 1126
1127 struct snd_emu10k1_voice voices[NUM_G]; 1127 struct snd_emu10k1_voice voices[NUM_G];
1128 struct snd_emu10k1_voice p16v_voices[4]; 1128 struct snd_emu10k1_voice p16v_voices[4];
diff --git a/include/sound/emux_synth.h b/include/sound/emux_synth.h
index b2d6b2acc7c7..d8cb51b86c20 100644
--- a/include/sound/emux_synth.h
+++ b/include/sound/emux_synth.h
@@ -113,7 +113,7 @@ struct snd_emux {
113 struct snd_emux_voice *voices; /* Voices (EMU 'channel') */ 113 struct snd_emux_voice *voices; /* Voices (EMU 'channel') */
114 int use_time; /* allocation counter */ 114 int use_time; /* allocation counter */
115 spinlock_t voice_lock; /* Lock for voice access */ 115 spinlock_t voice_lock; /* Lock for voice access */
116 struct semaphore register_mutex; 116 struct mutex register_mutex;
117 int client; /* For the sequencer client */ 117 int client; /* For the sequencer client */
118 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */ 118 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */
119 struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS]; 119 struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS];
diff --git a/include/sound/gus.h b/include/sound/gus.h
index 63da50fae773..68a664ab97f3 100644
--- a/include/sound/gus.h
+++ b/include/sound/gus.h
@@ -209,7 +209,7 @@ struct snd_gf1_mem {
209 struct snd_gf1_bank_info banks_16[4]; 209 struct snd_gf1_bank_info banks_16[4];
210 struct snd_gf1_mem_block *first; 210 struct snd_gf1_mem_block *first;
211 struct snd_gf1_mem_block *last; 211 struct snd_gf1_mem_block *last;
212 struct semaphore memory_mutex; 212 struct mutex memory_mutex;
213}; 213};
214 214
215struct snd_gf1_dma_block { 215struct snd_gf1_dma_block {
@@ -467,8 +467,8 @@ struct snd_gus_card {
467 spinlock_t dma_lock; 467 spinlock_t dma_lock;
468 spinlock_t pcm_volume_level_lock; 468 spinlock_t pcm_volume_level_lock;
469 spinlock_t uart_cmd_lock; 469 spinlock_t uart_cmd_lock;
470 struct semaphore dma_mutex; 470 struct mutex dma_mutex;
471 struct semaphore register_mutex; 471 struct mutex register_mutex;
472}; 472};
473 473
474/* I/O functions for GF1/InterWave chip - gus_io.c */ 474/* I/O functions for GF1/InterWave chip - gus_io.c */
diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h
index c679e5b31111..94c387b5d724 100644
--- a/include/sound/hwdep.h
+++ b/include/sound/hwdep.h
@@ -60,7 +60,7 @@ struct snd_hwdep {
60 void *private_data; 60 void *private_data;
61 void (*private_free) (struct snd_hwdep *hwdep); 61 void (*private_free) (struct snd_hwdep *hwdep);
62 62
63 struct semaphore open_mutex; 63 struct mutex open_mutex;
64 int used; 64 int used;
65 unsigned int dsp_loaded; 65 unsigned int dsp_loaded;
66 unsigned int exclusive: 1; 66 unsigned int exclusive: 1;
diff --git a/include/sound/i2c.h b/include/sound/i2c.h
index 81eb23ed761f..d125ff8c85e8 100644
--- a/include/sound/i2c.h
+++ b/include/sound/i2c.h
@@ -55,7 +55,7 @@ struct snd_i2c_bus {
55 struct snd_card *card; /* card which I2C belongs to */ 55 struct snd_card *card; /* card which I2C belongs to */
56 char name[32]; /* some useful label */ 56 char name[32]; /* some useful label */
57 57
58 struct semaphore lock_mutex; 58 struct mutex lock_mutex;
59 59
60 struct snd_i2c_bus *master; /* master bus when SCK/SCL is shared */ 60 struct snd_i2c_bus *master; /* master bus when SCK/SCL is shared */
61 struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */ 61 struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */
@@ -84,17 +84,17 @@ int snd_i2c_device_free(struct snd_i2c_device *device);
84static inline void snd_i2c_lock(struct snd_i2c_bus *bus) 84static inline void snd_i2c_lock(struct snd_i2c_bus *bus)
85{ 85{
86 if (bus->master) 86 if (bus->master)
87 down(&bus->master->lock_mutex); 87 mutex_lock(&bus->master->lock_mutex);
88 else 88 else
89 down(&bus->lock_mutex); 89 mutex_lock(&bus->lock_mutex);
90} 90}
91 91
92static inline void snd_i2c_unlock(struct snd_i2c_bus *bus) 92static inline void snd_i2c_unlock(struct snd_i2c_bus *bus)
93{ 93{
94 if (bus->master) 94 if (bus->master)
95 up(&bus->master->lock_mutex); 95 mutex_unlock(&bus->master->lock_mutex);
96 else 96 else
97 up(&bus->lock_mutex); 97 mutex_unlock(&bus->lock_mutex);
98} 98}
99 99
100int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count); 100int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
diff --git a/include/sound/info.h b/include/sound/info.h
index 8ea5c7497c03..f23d8381c216 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -84,7 +84,7 @@ struct snd_info_entry {
84 void *private_data; 84 void *private_data;
85 void (*private_free)(struct snd_info_entry *entry); 85 void (*private_free)(struct snd_info_entry *entry);
86 struct proc_dir_entry *p; 86 struct proc_dir_entry *p;
87 struct semaphore access; 87 struct mutex access;
88}; 88};
89 89
90#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) 90#if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)
diff --git a/include/sound/mixer_oss.h b/include/sound/mixer_oss.h
index ca5b4822b62c..197b9e3d612b 100644
--- a/include/sound/mixer_oss.h
+++ b/include/sound/mixer_oss.h
@@ -61,7 +61,7 @@ struct snd_mixer_oss {
61 unsigned int active_index); 61 unsigned int active_index);
62 void *private_data_recsrc; 62 void *private_data_recsrc;
63 void (*private_free_recsrc)(struct snd_mixer_oss *mixer); 63 void (*private_free_recsrc)(struct snd_mixer_oss *mixer);
64 struct semaphore reg_mutex; 64 struct mutex reg_mutex;
65 struct snd_info_entry *proc_entry; 65 struct snd_info_entry *proc_entry;
66 int oss_dev_alloc; 66 int oss_dev_alloc;
67 /* --- */ 67 /* --- */
diff --git a/include/sound/opl3.h b/include/sound/opl3.h
index 83392641cb47..82fdb0930720 100644
--- a/include/sound/opl3.h
+++ b/include/sound/opl3.h
@@ -53,6 +53,7 @@
53 53
54#include "driver.h" 54#include "driver.h"
55#include <linux/time.h> 55#include <linux/time.h>
56#include <linux/mutex.h>
56#include "core.h" 57#include "core.h"
57#include "hwdep.h" 58#include "hwdep.h"
58#include "timer.h" 59#include "timer.h"
@@ -229,7 +230,6 @@
229#define OPL3_HW_OPL3_CS 0x0302 /* CS4232/CS4236+ */ 230#define OPL3_HW_OPL3_CS 0x0302 /* CS4232/CS4236+ */
230#define OPL3_HW_OPL3_FM801 0x0303 /* FM801 */ 231#define OPL3_HW_OPL3_FM801 0x0303 /* FM801 */
231#define OPL3_HW_OPL3_CS4281 0x0304 /* CS4281 */ 232#define OPL3_HW_OPL3_CS4281 0x0304 /* CS4281 */
232#define OPL3_HW_OPL3_PC98 0x0305 /* PC9800 */
233#define OPL3_HW_OPL4 0x0400 /* YMF278B/YMF295 */ 233#define OPL3_HW_OPL4 0x0400 /* YMF278B/YMF295 */
234#define OPL3_HW_OPL4_ML 0x0401 /* YMF704/YMF721 */ 234#define OPL3_HW_OPL4_ML 0x0401 /* YMF704/YMF721 */
235#define OPL3_HW_MASK 0xff00 235#define OPL3_HW_MASK 0xff00
@@ -312,7 +312,7 @@ struct snd_opl3 {
312 int sys_timer_status; /* system timer run status */ 312 int sys_timer_status; /* system timer run status */
313 spinlock_t sys_timer_lock; /* Lock for system timer access */ 313 spinlock_t sys_timer_lock; /* Lock for system timer access */
314#endif 314#endif
315 struct semaphore access_mutex; /* locking */ 315 struct mutex access_mutex; /* locking */
316}; 316};
317 317
318/* opl3.c */ 318/* opl3.c */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 314268a11048..15b885660bf0 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -420,7 +420,7 @@ struct snd_pcm {
420 char id[64]; 420 char id[64];
421 char name[80]; 421 char name[80];
422 struct snd_pcm_str streams[2]; 422 struct snd_pcm_str streams[2];
423 struct semaphore open_mutex; 423 struct mutex open_mutex;
424 wait_queue_head_t open_wait; 424 wait_queue_head_t open_wait;
425 void *private_data; 425 void *private_data;
426 void (*private_free) (struct snd_pcm *pcm); 426 void (*private_free) (struct snd_pcm *pcm);
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
index fddaddde47b4..bff0778e1969 100644
--- a/include/sound/pcm_oss.h
+++ b/include/sound/pcm_oss.h
@@ -56,8 +56,10 @@ struct snd_pcm_oss_runtime {
56 size_t mmap_bytes; 56 size_t mmap_bytes;
57 char *buffer; /* vmallocated period */ 57 char *buffer; /* vmallocated period */
58 size_t buffer_used; /* used length from period buffer */ 58 size_t buffer_used; /* used length from period buffer */
59#ifdef CONFIG_SND_PCM_OSS_PLUGINS
59 struct snd_pcm_plugin *plugin_first; 60 struct snd_pcm_plugin *plugin_first;
60 struct snd_pcm_plugin *plugin_last; 61 struct snd_pcm_plugin *plugin_last;
62#endif
61 unsigned int prev_hw_ptr_interrupt; 63 unsigned int prev_hw_ptr_interrupt;
62}; 64};
63 65
@@ -73,7 +75,7 @@ struct snd_pcm_oss_substream {
73 75
74struct snd_pcm_oss_stream { 76struct snd_pcm_oss_stream {
75 struct snd_pcm_oss_setup *setup_list; /* setup list */ 77 struct snd_pcm_oss_setup *setup_list; /* setup list */
76 struct semaphore setup_mutex; 78 struct mutex setup_mutex;
77 struct snd_info_entry *proc_entry; 79 struct snd_info_entry *proc_entry;
78}; 80};
79 81
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index d19bddfbf995..584e73dd4793 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -26,7 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/wait.h> 28#include <linux/wait.h>
29#include <asm/semaphore.h> 29#include <linux/mutex.h>
30 30
31#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 31#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
32#include "seq_device.h" 32#include "seq_device.h"
@@ -130,7 +130,7 @@ struct snd_rawmidi {
130 void *private_data; 130 void *private_data;
131 void (*private_free) (struct snd_rawmidi *rmidi); 131 void (*private_free) (struct snd_rawmidi *rmidi);
132 132
133 struct semaphore open_mutex; 133 struct mutex open_mutex;
134 wait_queue_head_t open_wait; 134 wait_queue_head_t open_wait;
135 135
136 struct snd_info_entry *dev; 136 struct snd_info_entry *dev;
diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
index 3b44d4b370f5..caf6fe21514d 100644
--- a/include/sound/sb16_csp.h
+++ b/include/sound/sb16_csp.h
@@ -158,7 +158,7 @@ struct snd_sb_csp {
158 struct snd_kcontrol *qsound_switch; 158 struct snd_kcontrol *qsound_switch;
159 struct snd_kcontrol *qsound_space; 159 struct snd_kcontrol *qsound_space;
160 160
161 struct semaphore access_mutex; /* locking */ 161 struct mutex access_mutex; /* locking */
162}; 162};
163 163
164int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep); 164int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
diff --git a/include/sound/seq_instr.h b/include/sound/seq_instr.h
index db764f09efb7..f2db03bfd74e 100644
--- a/include/sound/seq_instr.h
+++ b/include/sound/seq_instr.h
@@ -64,7 +64,7 @@ struct snd_seq_kinstr_list {
64 64
65 spinlock_t lock; 65 spinlock_t lock;
66 spinlock_t ops_lock; 66 spinlock_t ops_lock;
67 struct semaphore ops_mutex; 67 struct mutex ops_mutex;
68 unsigned long ops_flags; 68 unsigned long ops_flags;
69}; 69};
70 70
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h
index 61a010c65d02..f95d99ba7f74 100644
--- a/include/sound/soundfont.h
+++ b/include/sound/soundfont.h
@@ -93,7 +93,7 @@ struct snd_sf_list {
93 int sample_locked; /* locked time for sample */ 93 int sample_locked; /* locked time for sample */
94 struct snd_sf_callback callback; /* callback functions */ 94 struct snd_sf_callback callback; /* callback functions */
95 int presets_locked; 95 int presets_locked;
96 struct semaphore presets_mutex; 96 struct mutex presets_mutex;
97 spinlock_t lock; 97 spinlock_t lock;
98 struct snd_util_memhdr *memhdr; 98 struct snd_util_memhdr *memhdr;
99}; 99};
diff --git a/include/sound/util_mem.h b/include/sound/util_mem.h
index 69944bbb5445..a1fb706b59a6 100644
--- a/include/sound/util_mem.h
+++ b/include/sound/util_mem.h
@@ -1,5 +1,7 @@
1#ifndef __SOUND_UTIL_MEM_H 1#ifndef __SOUND_UTIL_MEM_H
2#define __SOUND_UTIL_MEM_H 2#define __SOUND_UTIL_MEM_H
3
4#include <linux/mutex.h>
3/* 5/*
4 * Copyright (C) 2000 Takashi Iwai <tiwai@suse.de> 6 * Copyright (C) 2000 Takashi Iwai <tiwai@suse.de>
5 * 7 *
@@ -40,7 +42,7 @@ struct snd_util_memhdr {
40 int nblocks; /* # of allocated blocks */ 42 int nblocks; /* # of allocated blocks */
41 unsigned int used; /* used memory size */ 43 unsigned int used; /* used memory size */
42 int block_extra_size; /* extra data size of chunk */ 44 int block_extra_size; /* extra data size of chunk */
43 struct semaphore block_mutex; /* lock */ 45 struct mutex block_mutex; /* lock */
44}; 46};
45 47
46/* 48/*
diff --git a/include/sound/version.h b/include/sound/version.h
index 919da0dd001c..4f0e65808cf1 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by configure. */ 1/* include/version.h. Generated by configure. */
2#define CONFIG_SND_VERSION "1.0.11rc2" 2#define CONFIG_SND_VERSION "1.0.11rc4"
3#define CONFIG_SND_DATE " (Wed Jan 04 08:57:20 2006 UTC)" 3#define CONFIG_SND_DATE " (Wed Mar 22 10:27:24 2006 UTC)"
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 5fd6f3305e0d..9821a6194caa 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -206,7 +206,7 @@ struct vx_core {
206 int audio_monitor[4]; /* playback hw-monitor level */ 206 int audio_monitor[4]; /* playback hw-monitor level */
207 unsigned char audio_monitor_active[4]; /* playback hw-monitor mute/unmute */ 207 unsigned char audio_monitor_active[4]; /* playback hw-monitor mute/unmute */
208 208
209 struct semaphore mixer_mutex; 209 struct mutex mixer_mutex;
210 210
211 const struct firmware *firmware[4]; /* loaded firmware data */ 211 const struct firmware *firmware[4]; /* loaded firmware data */
212}; 212};
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index d567bfdbf513..d41cda97e952 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -269,9 +269,10 @@ struct snd_ymfpci_pcm {
269 enum snd_ymfpci_pcm_type type; 269 enum snd_ymfpci_pcm_type type;
270 struct snd_pcm_substream *substream; 270 struct snd_pcm_substream *substream;
271 struct snd_ymfpci_voice *voices[2]; /* playback only */ 271 struct snd_ymfpci_voice *voices[2]; /* playback only */
272 unsigned int running: 1; 272 unsigned int running: 1,
273 unsigned int output_front: 1; 273 output_front: 1,
274 unsigned int output_rear: 1; 274 output_rear: 1,
275 swap_rear: 1;
275 unsigned int update_pcm_vol; 276 unsigned int update_pcm_vol;
276 u32 period_size; /* cached from runtime->period_size */ 277 u32 period_size; /* cached from runtime->period_size */
277 u32 buffer_size; /* cached from runtime->buffer_size */ 278 u32 buffer_size; /* cached from runtime->buffer_size */
@@ -344,6 +345,7 @@ struct snd_ymfpci {
344 struct snd_kcontrol *spdif_pcm_ctl; 345 struct snd_kcontrol *spdif_pcm_ctl;
345 int mode_dup4ch; 346 int mode_dup4ch;
346 int rear_opened; 347 int rear_opened;
348 int rear_swap;
347 int spdif_opened; 349 int spdif_opened;
348 struct { 350 struct {
349 u16 left; 351 u16 left;
@@ -376,7 +378,7 @@ int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
376int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); 378int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
377int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); 379int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
378int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); 380int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
379int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch); 381int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch, int rear_swap);
380int snd_ymfpci_timer(struct snd_ymfpci *chip, int device); 382int snd_ymfpci_timer(struct snd_ymfpci *chip, int device);
381 383
382#endif /* __SOUND_YMFPCI_H */ 384#endif /* __SOUND_YMFPCI_H */
diff --git a/include/video/pm3fb.h b/include/video/pm3fb.h
index 6f4ea808cf74..ac021379ac40 100644
--- a/include/video/pm3fb.h
+++ b/include/video/pm3fb.h
@@ -1128,10 +1128,7 @@
1128#endif 1128#endif
1129 1129
1130/* max number of simultaneous board */ 1130/* max number of simultaneous board */
1131/* warning : make sure module array def's are coherent with PM3_MAX_BOARD */
1132#define PM3_MAX_BOARD 4 1131#define PM3_MAX_BOARD 4
1133#define PM3_MAX_BOARD_MODULE_ARRAY_SHORT "1-4h"
1134#define PM3_MAX_BOARD_MODULE_ARRAY_STRING "1-4s"
1135 1132
1136/* max size of options */ 1133/* max size of options */
1137#define PM3_OPTIONS_SIZE 256 1134#define PM3_OPTIONS_SIZE 256