aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-12-08 01:07:56 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-12-08 01:07:56 -0500
commitbef986502fa398b1785a3979b1aa17cd902d3527 (patch)
treeb59c1afe7b1dfcc001b86e54863f550d7ddc8c34 /include
parent4bdbd2807deeccc0793d57fb5120d7a53f2c0b3c (diff)
parentc99767974ebd2a719d849fdeaaa1674456f5283f (diff)
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/usb/input/hid.h
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/acpi/platform/aclinux.h2
-rw-r--r--include/asm-alpha/checksum.h34
-rw-r--r--include/asm-alpha/device.h7
-rw-r--r--include/asm-alpha/dma-mapping.h4
-rw-r--r--include/asm-alpha/unistd.h182
-rw-r--r--include/asm-arm/arch-aaec2000/memory.h40
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_aic.h53
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_dbgu.h45
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_ecc.h38
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_lcdc.h148
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_mci.h (renamed from include/asm-arm/arch-at91rm9200/at91rm9200_mci.h)24
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_pdc.h (renamed from include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h)6
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_pio.h49
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_pit.h29
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_pmc.h92
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_rstc.h39
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_rtc.h75
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_rtt.h32
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_shdwc.h33
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_spi.h (renamed from include/asm-arm/arch-at91rm9200/at91rm9200_spi.h)8
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_ssc.h (renamed from include/asm-arm/arch-at91rm9200/at91rm9200_ssc.h)16
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_st.h49
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_tc.h (renamed from include/asm-arm/arch-at91rm9200/at91rm9200_tc.h)6
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_twi.h (renamed from include/asm-arm/arch-at91rm9200/at91rm9200_twi.h)10
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_wdt.h34
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200.h16
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_mc.h160
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_sys.h438
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200_udp.h77
-rw-r--r--include/asm-arm/arch-at91rm9200/at91sam9260.h125
-rw-r--r--include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h78
-rw-r--r--include/asm-arm/arch-at91rm9200/at91sam9261.h292
-rw-r--r--include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h62
-rw-r--r--include/asm-arm/arch-at91rm9200/at91sam926x_mc.h134
-rw-r--r--include/asm-arm/arch-at91rm9200/board.h6
-rw-r--r--include/asm-arm/arch-at91rm9200/cpu.h49
-rw-r--r--include/asm-arm/arch-at91rm9200/debug-macro.S1
-rw-r--r--include/asm-arm/arch-at91rm9200/entry-macro.S1
-rw-r--r--include/asm-arm/arch-at91rm9200/hardware.h40
-rw-r--r--include/asm-arm/arch-at91rm9200/irqs.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/system.h20
-rw-r--r--include/asm-arm/arch-at91rm9200/timex.h9
-rw-r--r--include/asm-arm/arch-at91rm9200/uncompress.h4
-rw-r--r--include/asm-arm/arch-at91rm9200/vmalloc.h2
-rw-r--r--include/asm-arm/arch-clps711x/memory.h53
-rw-r--r--include/asm-arm/arch-ebsa110/io.h16
-rw-r--r--include/asm-arm/arch-imx/timex.h3
-rw-r--r--include/asm-arm/arch-iop13xx/debug-macro.S26
-rw-r--r--include/asm-arm/arch-iop13xx/dma.h3
-rw-r--r--include/asm-arm/arch-iop13xx/entry-macro.S39
-rw-r--r--include/asm-arm/arch-iop13xx/hardware.h28
-rw-r--r--include/asm-arm/arch-iop13xx/io.h41
-rw-r--r--include/asm-arm/arch-iop13xx/iop13xx.h492
-rw-r--r--include/asm-arm/arch-iop13xx/iq81340.h31
-rw-r--r--include/asm-arm/arch-iop13xx/irqs.h207
-rw-r--r--include/asm-arm/arch-iop13xx/memory.h64
-rw-r--r--include/asm-arm/arch-iop13xx/pci.h57
-rw-r--r--include/asm-arm/arch-iop13xx/system.h59
-rw-r--r--include/asm-arm/arch-iop13xx/timex.h3
-rw-r--r--include/asm-arm/arch-iop13xx/uncompress.h24
-rw-r--r--include/asm-arm/arch-iop13xx/vmalloc.h4
-rw-r--r--include/asm-arm/arch-ixp4xx/nslu2.h5
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h13
-rw-r--r--include/asm-arm/arch-ixp4xx/udc.h8
-rw-r--r--include/asm-arm/arch-l7200/io.h56
-rw-r--r--include/asm-arm/arch-lh7a40x/memory.h12
-rw-r--r--include/asm-arm/arch-omap/irda.h2
-rw-r--r--include/asm-arm/arch-pxa/memory.h36
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h21
-rw-r--r--include/asm-arm/arch-pxa/udc.h17
-rw-r--r--include/asm-arm/arch-s3c2410/h1940.h21
-rw-r--r--include/asm-arm/arch-s3c2410/system.h2
-rw-r--r--include/asm-arm/arch-sa1100/jornada720.h42
-rw-r--r--include/asm-arm/arch-sa1100/memory.h34
-rw-r--r--include/asm-arm/bug.h4
-rw-r--r--include/asm-arm/checksum.h83
-rw-r--r--include/asm-arm/cnt32_to_63.h78
-rw-r--r--include/asm-arm/device.h7
-rw-r--r--include/asm-arm/div64.h180
-rw-r--r--include/asm-arm/dma-mapping.h6
-rw-r--r--include/asm-arm/elf.h150
-rw-r--r--include/asm-arm/io.h8
-rw-r--r--include/asm-arm/mach/irq.h12
-rw-r--r--include/asm-arm/mach/udc_pxa2xx.h26
-rw-r--r--include/asm-arm/memory.h39
-rw-r--r--include/asm-arm/pgtable-nommu.h1
-rw-r--r--include/asm-arm/pgtable.h3
-rw-r--r--include/asm-arm/processor.h1
-rw-r--r--include/asm-arm/procinfo.h21
-rw-r--r--include/asm-arm/setup.h104
-rw-r--r--include/asm-arm/thread_info.h14
-rw-r--r--include/asm-arm/unistd.h150
-rw-r--r--include/asm-arm26/checksum.h63
-rw-r--r--include/asm-arm26/device.h7
-rw-r--r--include/asm-arm26/pgalloc.h2
-rw-r--r--include/asm-arm26/setup.h4
-rw-r--r--include/asm-arm26/unistd.h133
-rw-r--r--include/asm-avr32/arch-at32ap/at91_pdc.h (renamed from include/asm-avr32/arch-at32ap/at91rm9200_pdc.h)6
-rw-r--r--include/asm-avr32/checksum.h40
-rw-r--r--include/asm-avr32/device.h7
-rw-r--r--include/asm-avr32/dma-mapping.h5
-rw-r--r--include/asm-avr32/setup.h4
-rw-r--r--include/asm-avr32/types.h5
-rw-r--r--include/asm-avr32/unistd.h3
-rw-r--r--include/asm-cris/arch-v10/bitops.h10
-rw-r--r--include/asm-cris/arch-v10/checksum.h10
-rw-r--r--include/asm-cris/arch-v32/checksum.h10
-rw-r--r--include/asm-cris/checksum.h34
-rw-r--r--include/asm-cris/device.h7
-rw-r--r--include/asm-cris/dma-mapping.h4
-rw-r--r--include/asm-cris/semaphore-helper.h8
-rw-r--r--include/asm-frv/checksum.h41
-rw-r--r--include/asm-frv/device.h7
-rw-r--r--include/asm-frv/dma-mapping.h4
-rw-r--r--include/asm-frv/highmem.h5
-rw-r--r--include/asm-frv/param.h1
-rw-r--r--include/asm-frv/setup.h6
-rw-r--r--include/asm-frv/unistd.h119
-rw-r--r--include/asm-generic/Kbuild1
-rw-r--r--include/asm-generic/Kbuild.asm1
-rw-r--r--include/asm-generic/atomic.h7
-rw-r--r--include/asm-generic/device.h12
-rw-r--r--include/asm-generic/dma-mapping.h4
-rw-r--r--include/asm-generic/futex.h4
-rw-r--r--include/asm-generic/vmlinux.lds.h25
-rw-r--r--include/asm-h8300/checksum.h31
-rw-r--r--include/asm-h8300/delay.h4
-rw-r--r--include/asm-h8300/device.h7
-rw-r--r--include/asm-h8300/mmu_context.h4
-rw-r--r--include/asm-h8300/pci.h4
-rw-r--r--include/asm-h8300/tlbflush.h4
-rw-r--r--include/asm-h8300/types.h6
-rw-r--r--include/asm-h8300/unistd.h166
-rw-r--r--include/asm-i386/Kbuild1
-rw-r--r--include/asm-i386/acpi.h1
-rw-r--r--include/asm-i386/alternative.h13
-rw-r--r--include/asm-i386/apic.h15
-rw-r--r--include/asm-i386/atomic.h8
-rw-r--r--include/asm-i386/boot.h6
-rw-r--r--include/asm-i386/bugs.h4
-rw-r--r--include/asm-i386/checksum.h65
-rw-r--r--include/asm-i386/cpu.h3
-rw-r--r--include/asm-i386/cpufeature.h8
-rw-r--r--include/asm-i386/current.h7
-rw-r--r--include/asm-i386/delay.h13
-rw-r--r--include/asm-i386/desc.h95
-rw-r--r--include/asm-i386/device.h15
-rw-r--r--include/asm-i386/dma-mapping.h4
-rw-r--r--include/asm-i386/e820.h5
-rw-r--r--include/asm-i386/elf.h2
-rw-r--r--include/asm-i386/futex.h4
-rw-r--r--include/asm-i386/genapic.h2
-rw-r--r--include/asm-i386/i387.h5
-rw-r--r--include/asm-i386/io.h8
-rw-r--r--include/asm-i386/irq.h5
-rw-r--r--include/asm-i386/irq_regs.h28
-rw-r--r--include/asm-i386/irqflags.h42
-rw-r--r--include/asm-i386/mach-default/setup_arch.h2
-rw-r--r--include/asm-i386/mach-summit/mach_apic.h4
-rw-r--r--include/asm-i386/math_emu.h1
-rw-r--r--include/asm-i386/mmu_context.h8
-rw-r--r--include/asm-i386/mmzone.h27
-rw-r--r--include/asm-i386/module.h10
-rw-r--r--include/asm-i386/mpspec_def.h2
-rw-r--r--include/asm-i386/msr.h18
-rw-r--r--include/asm-i386/nmi.h8
-rw-r--r--include/asm-i386/page.h8
-rw-r--r--include/asm-i386/param.h1
-rw-r--r--include/asm-i386/paravirt.h505
-rw-r--r--include/asm-i386/pda.h100
-rw-r--r--include/asm-i386/percpu.h25
-rw-r--r--include/asm-i386/pgtable-2level.h10
-rw-r--r--include/asm-i386/pgtable-3level.h45
-rw-r--r--include/asm-i386/pgtable.h28
-rw-r--r--include/asm-i386/processor.h204
-rw-r--r--include/asm-i386/ptrace.h2
-rw-r--r--include/asm-i386/rwsem.h4
-rw-r--r--include/asm-i386/segment.h7
-rw-r--r--include/asm-i386/setup.h7
-rw-r--r--include/asm-i386/smp.h3
-rw-r--r--include/asm-i386/spinlock.h19
-rw-r--r--include/asm-i386/spinlock_types.h4
-rw-r--r--include/asm-i386/suspend.h21
-rw-r--r--include/asm-i386/system.h16
-rw-r--r--include/asm-i386/thread_info.h10
-rw-r--r--include/asm-i386/time.h41
-rw-r--r--include/asm-i386/tlbflush.h18
-rw-r--r--include/asm-i386/types.h10
-rw-r--r--include/asm-i386/unistd.h98
-rw-r--r--include/asm-i386/unwind.h13
-rw-r--r--include/asm-i386/vm86.h17
-rw-r--r--include/asm-ia64/Kbuild1
-rw-r--r--include/asm-ia64/checksum.h37
-rw-r--r--include/asm-ia64/device.h15
-rw-r--r--include/asm-ia64/dma-mapping.h5
-rw-r--r--include/asm-ia64/futex.h4
-rw-r--r--include/asm-ia64/io.h2
-rw-r--r--include/asm-ia64/kexec.h47
-rw-r--r--include/asm-ia64/machvec.h17
-rw-r--r--include/asm-ia64/machvec_sn2.h4
-rw-r--r--include/asm-ia64/meminit.h3
-rw-r--r--include/asm-ia64/page.h11
-rw-r--r--include/asm-ia64/pal.h64
-rw-r--r--include/asm-ia64/pci.h21
-rw-r--r--include/asm-ia64/pgalloc.h2
-rw-r--r--include/asm-ia64/sn/acpi.h16
-rw-r--r--include/asm-ia64/sn/addrs.h6
-rw-r--r--include/asm-ia64/sn/pcidev.h22
-rw-r--r--include/asm-ia64/sn/sn_feature_sets.h6
-rw-r--r--include/asm-ia64/sn/sn_sal.h10
-rw-r--r--include/asm-m32r/checksum.h52
-rw-r--r--include/asm-m32r/device.h7
-rw-r--r--include/asm-m32r/setup.h9
-rw-r--r--include/asm-m32r/unistd.h111
-rw-r--r--include/asm-m68k/checksum.h46
-rw-r--r--include/asm-m68k/device.h7
-rw-r--r--include/asm-m68k/dma-mapping.h4
-rw-r--r--include/asm-m68k/setup.h6
-rw-r--r--include/asm-m68k/unistd.h97
-rw-r--r--include/asm-m68knommu/checksum.h46
-rw-r--r--include/asm-m68knommu/device.h7
-rw-r--r--include/asm-m68knommu/dma-mapping.h3
-rw-r--r--include/asm-m68knommu/irq.h1
-rw-r--r--include/asm-m68knommu/irq_regs.h1
-rw-r--r--include/asm-m68knommu/irqnode.h8
-rw-r--r--include/asm-m68knommu/m520xsim.h12
-rw-r--r--include/asm-m68knommu/machdep.h2
-rw-r--r--include/asm-m68knommu/mcfmbus.h2
-rw-r--r--include/asm-m68knommu/rtc.h1
-rw-r--r--include/asm-m68knommu/scatterlist.h2
-rw-r--r--include/asm-m68knommu/setup.h5
-rw-r--r--include/asm-m68knommu/ucontext.h6
-rw-r--r--include/asm-m68knommu/unistd.h150
-rw-r--r--include/asm-mips/addrspace.h40
-rw-r--r--include/asm-mips/atomic.h49
-rw-r--r--include/asm-mips/barrier.h132
-rw-r--r--include/asm-mips/bitops.h92
-rw-r--r--include/asm-mips/bug.h12
-rw-r--r--include/asm-mips/checksum.h55
-rw-r--r--include/asm-mips/compat.h68
-rw-r--r--include/asm-mips/cpu-info.h10
-rw-r--r--include/asm-mips/dec/kn02.h2
-rw-r--r--include/asm-mips/device.h7
-rw-r--r--include/asm-mips/dma-mapping.h4
-rw-r--r--include/asm-mips/dma.h2
-rw-r--r--include/asm-mips/futex.h26
-rw-r--r--include/asm-mips/gt64120.h14
-rw-r--r--include/asm-mips/highmem.h10
-rw-r--r--include/asm-mips/i8259.h37
-rw-r--r--include/asm-mips/io.h2
-rw-r--r--include/asm-mips/irq.h12
-rw-r--r--include/asm-mips/kexec.h32
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h6
-rw-r--r--include/asm-mips/mach-cobalt/cobalt.h29
-rw-r--r--include/asm-mips/mach-cobalt/mach-gt64120.h28
-rw-r--r--include/asm-mips/mipsregs.h56
-rw-r--r--include/asm-mips/page.h16
-rw-r--r--include/asm-mips/pgtable-32.h6
-rw-r--r--include/asm-mips/pgtable-64.h17
-rw-r--r--include/asm-mips/pgtable.h2
-rw-r--r--include/asm-mips/ptrace.h2
-rw-r--r--include/asm-mips/setup.h2
-rw-r--r--include/asm-mips/sn/klconfig.h2
-rw-r--r--include/asm-mips/spinlock.h53
-rw-r--r--include/asm-mips/system.h156
-rw-r--r--include/asm-mips/time.h9
-rw-r--r--include/asm-mips/types.h10
-rw-r--r--include/asm-mips/unistd.h262
-rw-r--r--include/asm-parisc/checksum.h55
-rw-r--r--include/asm-parisc/device.h7
-rw-r--r--include/asm-parisc/dma-mapping.h4
-rw-r--r--include/asm-parisc/dma.h6
-rw-r--r--include/asm-parisc/futex.h4
-rw-r--r--include/asm-parisc/pci.h2
-rw-r--r--include/asm-parisc/ropes.h2
-rw-r--r--include/asm-parisc/semaphore.h6
-rw-r--r--include/asm-powerpc/Kbuild1
-rw-r--r--include/asm-powerpc/cell-pmu.h113
-rw-r--r--include/asm-powerpc/checksum.h59
-rw-r--r--include/asm-powerpc/cputable.h31
-rw-r--r--include/asm-powerpc/dbdma.h8
-rw-r--r--include/asm-powerpc/dcr-mmio.h51
-rw-r--r--include/asm-powerpc/dcr-native.h39
-rw-r--r--include/asm-powerpc/dcr.h42
-rw-r--r--include/asm-powerpc/device.h24
-rw-r--r--include/asm-powerpc/dma-mapping.h188
-rw-r--r--include/asm-powerpc/eeh.h213
-rw-r--r--include/asm-powerpc/elf.h15
-rw-r--r--include/asm-powerpc/firmware.h17
-rw-r--r--include/asm-powerpc/futex.h4
-rw-r--r--include/asm-powerpc/hw_irq.h44
-rw-r--r--include/asm-powerpc/ibmebus.h1
-rw-r--r--include/asm-powerpc/ide.h8
-rw-r--r--include/asm-powerpc/immap_qe.h17
-rw-r--r--include/asm-powerpc/io-defs.h59
-rw-r--r--include/asm-powerpc/io.h845
-rw-r--r--include/asm-powerpc/iommu.h34
-rw-r--r--include/asm-powerpc/irq.h4
-rw-r--r--include/asm-powerpc/iseries/iommu.h4
-rw-r--r--include/asm-powerpc/lv1call.h345
-rw-r--r--include/asm-powerpc/machdep.h18
-rw-r--r--include/asm-powerpc/mmu.h15
-rw-r--r--include/asm-powerpc/mpc52xx.h254
-rw-r--r--include/asm-powerpc/mpc85xx.h8
-rw-r--r--include/asm-powerpc/mpic.h39
-rw-r--r--include/asm-powerpc/of_device.h36
-rw-r--r--include/asm-powerpc/of_platform.h60
-rw-r--r--include/asm-powerpc/oprofile_impl.h3
-rw-r--r--include/asm-powerpc/paca.h3
-rw-r--r--include/asm-powerpc/pci-bridge.h1
-rw-r--r--include/asm-powerpc/pci.h30
-rw-r--r--include/asm-powerpc/pgalloc.h2
-rw-r--r--include/asm-powerpc/ppc-pci.h13
-rw-r--r--include/asm-powerpc/processor.h4
-rw-r--r--include/asm-powerpc/prom.h15
-rw-r--r--include/asm-powerpc/ps3.h462
-rw-r--r--include/asm-powerpc/rtas.h2
-rw-r--r--include/asm-powerpc/setup.h3
-rw-r--r--include/asm-powerpc/sparsemem.h6
-rw-r--r--include/asm-powerpc/spu.h30
-rw-r--r--include/asm-powerpc/spu_csa.h1
-rw-r--r--include/asm-powerpc/spu_info.h54
-rw-r--r--include/asm-powerpc/spu_priv1.h46
-rw-r--r--include/asm-powerpc/systbl.h1
-rw-r--r--include/asm-powerpc/time.h4
-rw-r--r--include/asm-powerpc/todc.h487
-rw-r--r--include/asm-powerpc/topology.h15
-rw-r--r--include/asm-powerpc/tsi108.h4
-rw-r--r--include/asm-powerpc/types.h10
-rw-r--r--include/asm-powerpc/uaccess.h4
-rw-r--r--include/asm-powerpc/unistd.h124
-rw-r--r--include/asm-powerpc/vio.h1
-rw-r--r--include/asm-powerpc/xmon.h2
-rw-r--r--include/asm-ppc/device.h7
-rw-r--r--include/asm-ppc/highmem.h8
-rw-r--r--include/asm-ppc/io.h28
-rw-r--r--include/asm-ppc/m48t35.h2
-rw-r--r--include/asm-ppc/mpc52xx.h11
-rw-r--r--include/asm-ppc/mpc83xx.h8
-rw-r--r--include/asm-ppc/mpc85xx.h8
-rw-r--r--include/asm-ppc/pci-bridge.h1
-rw-r--r--include/asm-s390/checksum.h45
-rw-r--r--include/asm-s390/cio.h9
-rw-r--r--include/asm-s390/cpcmd.h10
-rw-r--r--include/asm-s390/device.h7
-rw-r--r--include/asm-s390/kexec.h2
-rw-r--r--include/asm-s390/lowcore.h8
-rw-r--r--include/asm-s390/pgtable.h15
-rw-r--r--include/asm-s390/reset.h23
-rw-r--r--include/asm-s390/setup.h18
-rw-r--r--include/asm-s390/smp.h8
-rw-r--r--include/asm-s390/system.h10
-rw-r--r--include/asm-s390/termios.h34
-rw-r--r--include/asm-s390/types.h10
-rw-r--r--include/asm-s390/uaccess.h18
-rw-r--r--include/asm-s390/unistd.h154
-rw-r--r--include/asm-s390/zcrypt.h91
-rw-r--r--include/asm-sh/atomic.h48
-rw-r--r--include/asm-sh/bugs.h8
-rw-r--r--include/asm-sh/checksum.h59
-rw-r--r--include/asm-sh/clock.h12
-rw-r--r--include/asm-sh/cpu-sh2/cache.h22
-rw-r--r--include/asm-sh/cpu-sh2/freq.h18
-rw-r--r--include/asm-sh/cpu-sh2/mmu_context.h16
-rw-r--r--include/asm-sh/cpu-sh2/timer.h6
-rw-r--r--include/asm-sh/cpu-sh2a/addrspace.h1
-rw-r--r--include/asm-sh/cpu-sh2a/cache.h39
-rw-r--r--include/asm-sh/cpu-sh2a/cacheflush.h1
-rw-r--r--include/asm-sh/cpu-sh2a/dma.h1
-rw-r--r--include/asm-sh/cpu-sh2a/freq.h18
-rw-r--r--include/asm-sh/cpu-sh2a/mmu_context.h1
-rw-r--r--include/asm-sh/cpu-sh2a/timer.h1
-rw-r--r--include/asm-sh/cpu-sh2a/ubc.h1
-rw-r--r--include/asm-sh/cpu-sh2a/watchdog.h1
-rw-r--r--include/asm-sh/device.h7
-rw-r--r--include/asm-sh/dma-mapping.h2
-rw-r--r--include/asm-sh/dma.h40
-rw-r--r--include/asm-sh/elf.h2
-rw-r--r--include/asm-sh/entry-macros.S33
-rw-r--r--include/asm-sh/irq-sh73180.h314
-rw-r--r--include/asm-sh/irq-sh7343.h317
-rw-r--r--include/asm-sh/irq-sh7780.h311
-rw-r--r--include/asm-sh/irq.h620
-rw-r--r--include/asm-sh/irqflags.h123
-rw-r--r--include/asm-sh/mmu_context.h44
-rw-r--r--include/asm-sh/page.h35
-rw-r--r--include/asm-sh/pgalloc.h20
-rw-r--r--include/asm-sh/pgtable-2level.h70
-rw-r--r--include/asm-sh/pgtable.h371
-rw-r--r--include/asm-sh/processor.h24
-rw-r--r--include/asm-sh/push-switch.h28
-rw-r--r--include/asm-sh/rwsem.h27
-rw-r--r--include/asm-sh/se7206.h13
-rw-r--r--include/asm-sh/setup.h6
-rw-r--r--include/asm-sh/system.h101
-rw-r--r--include/asm-sh/thread_info.h8
-rw-r--r--include/asm-sh/timer.h23
-rw-r--r--include/asm-sh/titan.h32
-rw-r--r--include/asm-sh/types.h10
-rw-r--r--include/asm-sh/unistd.h119
-rw-r--r--include/asm-sh64/checksum.h41
-rw-r--r--include/asm-sh64/device.h7
-rw-r--r--include/asm-sh64/dma-mapping.h2
-rw-r--r--include/asm-sh64/setup.h6
-rw-r--r--include/asm-sh64/unistd.h142
-rw-r--r--include/asm-sparc/checksum.h103
-rw-r--r--include/asm-sparc/device.h7
-rw-r--r--include/asm-sparc/unistd.h139
-rw-r--r--include/asm-sparc64/checksum.h77
-rw-r--r--include/asm-sparc64/device.h7
-rw-r--r--include/asm-sparc64/dma-mapping.h4
-rw-r--r--include/asm-sparc64/futex.h4
-rw-r--r--include/asm-sparc64/pci.h6
-rw-r--r--include/asm-sparc64/pgalloc.h2
-rw-r--r--include/asm-sparc64/unistd.h128
-rw-r--r--include/asm-um/device.h7
-rw-r--r--include/asm-um/dma-mapping.h4
-rw-r--r--include/asm-v850/checksum.h38
-rw-r--r--include/asm-v850/device.h7
-rw-r--r--include/asm-v850/irq.h2
-rw-r--r--include/asm-v850/unistd.h160
-rw-r--r--include/asm-x86_64/Kbuild2
-rw-r--r--include/asm-x86_64/acpi.h1
-rw-r--r--include/asm-x86_64/alternative.h12
-rw-r--r--include/asm-x86_64/atomic.h8
-rw-r--r--include/asm-x86_64/calgary.h2
-rw-r--r--include/asm-x86_64/checksum.h54
-rw-r--r--include/asm-x86_64/cpufeature.h7
-rw-r--r--include/asm-x86_64/delay.h7
-rw-r--r--include/asm-x86_64/desc.h53
-rw-r--r--include/asm-x86_64/desc_defs.h69
-rw-r--r--include/asm-x86_64/device.h15
-rw-r--r--include/asm-x86_64/dma-mapping.h5
-rw-r--r--include/asm-x86_64/elf.h1
-rw-r--r--include/asm-x86_64/futex.h4
-rw-r--r--include/asm-x86_64/genapic.h2
-rw-r--r--include/asm-x86_64/io_apic.h34
-rw-r--r--include/asm-x86_64/msr.h17
-rw-r--r--include/asm-x86_64/nmi.h3
-rw-r--r--include/asm-x86_64/pci-direct.h1
-rw-r--r--include/asm-x86_64/pda.h9
-rw-r--r--include/asm-x86_64/pgtable.h22
-rw-r--r--include/asm-x86_64/processor.h8
-rw-r--r--include/asm-x86_64/proto.h2
-rw-r--r--include/asm-x86_64/rio.h74
-rw-r--r--include/asm-x86_64/smp.h12
-rw-r--r--include/asm-x86_64/spinlock.h29
-rw-r--r--include/asm-x86_64/spinlock_types.h4
-rw-r--r--include/asm-x86_64/stacktrace.h2
-rw-r--r--include/asm-x86_64/types.h3
-rw-r--r--include/asm-x86_64/uaccess.h1
-rw-r--r--include/asm-x86_64/unistd.h99
-rw-r--r--include/asm-x86_64/unwind.h8
-rw-r--r--include/asm-x86_64/vsyscall.h3
-rw-r--r--include/asm-xtensa/checksum.h64
-rw-r--r--include/asm-xtensa/device.h7
-rw-r--r--include/asm-xtensa/dma-mapping.h4
-rw-r--r--include/asm-xtensa/unistd.h184
-rw-r--r--include/crypto/b128ops.h80
-rw-r--r--include/crypto/gf128mul.h198
-rw-r--r--include/linux/Kbuild8
-rw-r--r--include/linux/acct.h1
-rw-r--r--include/linux/aio.h4
-rw-r--r--include/linux/ata.h14
-rw-r--r--include/linux/atmarp.h2
-rw-r--r--include/linux/atmbr2684.h4
-rw-r--r--include/linux/atmmpc.h16
-rw-r--r--include/linux/audit.h6
-rw-r--r--include/linux/blkdev.h7
-rw-r--r--include/linux/blktrace_api.h12
-rw-r--r--include/linux/bootmem.h3
-rw-r--r--include/linux/bottom_half.h10
-rw-r--r--include/linux/carta_random32.h29
-rw-r--r--include/linux/cciss_ioctl.h2
-rw-r--r--include/linux/cdev.h4
-rw-r--r--include/linux/connector.h4
-rw-r--r--include/linux/cpu.h39
-rw-r--r--include/linux/cpuset.h4
-rw-r--r--include/linux/crypto.h22
-rw-r--r--include/linux/dccp.h63
-rw-r--r--include/linux/debug_locks.h2
-rw-r--r--include/linux/delayacct.h2
-rw-r--r--include/linux/device.h57
-rw-r--r--include/linux/divert.h132
-rw-r--r--include/linux/efi.h3
-rw-r--r--include/linux/elevator.h4
-rw-r--r--include/linux/elf.h11
-rw-r--r--include/linux/ext3_jbd.h76
-rw-r--r--include/linux/ext4_jbd2.h76
-rw-r--r--include/linux/fb.h8
-rw-r--r--include/linux/fib_rules.h3
-rw-r--r--include/linux/file.h4
-rw-r--r--include/linux/freezer.h87
-rw-r--r--include/linux/fs.h57
-rw-r--r--include/linux/fs_struct.h2
-rw-r--r--include/linux/ftape-header-segment.h122
-rw-r--r--include/linux/ftape-vendors.h137
-rw-r--r--include/linux/ftape.h201
-rw-r--r--include/linux/fuse.h24
-rw-r--r--include/linux/genetlink.h6
-rw-r--r--include/linux/gfp.h3
-rw-r--r--include/linux/gfs2_ondisk.h138
-rw-r--r--include/linux/highmem.h8
-rw-r--r--include/linux/htirq.h16
-rw-r--r--include/linux/hugetlb.h11
-rw-r--r--include/linux/i2c-pxa.h31
-rw-r--r--include/linux/i2o.h22
-rw-r--r--include/linux/icmp.h2
-rw-r--r--include/linux/icmpv6.h12
-rw-r--r--include/linux/if_packet.h6
-rw-r--r--include/linux/if_tunnel.h8
-rw-r--r--include/linux/igmp.h5
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/in6.h16
-rw-r--r--include/linux/inet.h4
-rw-r--r--include/linux/inetdevice.h14
-rw-r--r--include/linux/init.h8
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/interrupt.h7
-rw-r--r--include/linux/ioport.h1
-rw-r--r--include/linux/ip.h2
-rw-r--r--include/linux/ip6_tunnel.h2
-rw-r--r--include/linux/ipmi.h45
-rw-r--r--include/linux/ipmi_msgdefs.h15
-rw-r--r--include/linux/ipmi_smi.h8
-rw-r--r--include/linux/ipv6.h2
-rw-r--r--include/linux/ipx.h14
-rw-r--r--include/linux/ixjuser.h2
-rw-r--r--include/linux/jbd.h3
-rw-r--r--include/linux/jbd2.h3
-rw-r--r--include/linux/jiffies.h2
-rw-r--r--include/linux/kbd_kern.h2
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/kernelcapi.h2
-rw-r--r--include/linux/kexec.h8
-rw-r--r--include/linux/kobject.h8
-rw-r--r--include/linux/kprobes.h2
-rw-r--r--include/linux/ktime.h4
-rw-r--r--include/linux/libata.h59
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/lockdep.h11
-rw-r--r--include/linux/miscdevice.h5
-rw-r--r--include/linux/mm.h81
-rw-r--r--include/linux/mmc/card.h13
-rw-r--r--include/linux/mmc/host.h10
-rw-r--r--include/linux/mmc/protocol.h74
-rw-r--r--include/linux/mmzone.h87
-rw-r--r--include/linux/module.h14
-rw-r--r--include/linux/moduleparam.h3
-rw-r--r--include/linux/mqueue.h2
-rw-r--r--include/linux/msdos_fs.h2
-rw-r--r--include/linux/msg.h6
-rw-r--r--include/linux/mutex.h2
-rw-r--r--include/linux/mv643xx.h4
-rw-r--r--include/linux/nbd.h1
-rw-r--r--include/linux/ncp_fs_sb.h8
-rw-r--r--include/linux/net.h2
-rw-r--r--include/linux/netdevice.h19
-rw-r--r--include/linux/netfilter.h44
-rw-r--r--include/linux/netfilter/Kbuild2
-rw-r--r--include/linux/netfilter/nf_conntrack_amanda.h10
-rw-r--r--include/linux/netfilter/nf_conntrack_ftp.h20
-rw-r--r--include/linux/netfilter/nf_conntrack_h323.h92
-rw-r--r--include/linux/netfilter/nf_conntrack_h323_asn1.h (renamed from include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h)10
-rw-r--r--include/linux/netfilter/nf_conntrack_h323_types.h (renamed from include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h)12
-rw-r--r--include/linux/netfilter/nf_conntrack_irc.h15
-rw-r--r--include/linux/netfilter/nf_conntrack_pptp.h322
-rw-r--r--include/linux/netfilter/nf_conntrack_proto_gre.h112
-rw-r--r--include/linux/netfilter/nf_conntrack_sctp.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h41
-rw-r--r--include/linux/netfilter/nf_conntrack_tftp.h20
-rw-r--r--include/linux/netfilter/nfnetlink.h2
-rw-r--r--include/linux/netfilter/nfnetlink_log.h12
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h19
-rw-r--r--include/linux/netfilter/x_tables.h16
-rw-r--r--include/linux/netfilter/xt_NFLOG.h18
-rw-r--r--include/linux/netfilter/xt_conntrack.h4
-rw-r--r--include/linux/netfilter/xt_hashlimit.h40
-rw-r--r--include/linux/netfilter/xt_policy.h2
-rw-r--r--include/linux/netfilter_arp/arp_tables.h25
-rw-r--r--include/linux/netfilter_bridge.h2
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h10
-rw-r--r--include/linux/netfilter_bridge/ebt_among.h2
-rw-r--r--include/linux/netfilter_bridge/ebt_arp.h14
-rw-r--r--include/linux/netfilter_bridge/ebt_ip.h8
-rw-r--r--include/linux/netfilter_bridge/ebt_nat.h1
-rw-r--r--include/linux/netfilter_bridge/ebt_vlan.h2
-rw-r--r--include/linux/netfilter_bridge/ebtables.h25
-rw-r--r--include/linux/netfilter_ipv4.h2
-rw-r--r--include/linux/netfilter_ipv4/Kbuild2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h3
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_ftp.h40
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h4
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sip.h34
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tftp.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h27
-rw-r--r--include/linux/netfilter_ipv4/ipt_LOG.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_hashlimit.h42
-rw-r--r--include/linux/netfilter_ipv6.h2
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h27
-rw-r--r--include/linux/netfilter_ipv6/ip6t_LOG.h2
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/netpoll.h15
-rw-r--r--include/linux/nfs_fs.h39
-rw-r--r--include/linux/nfs_fs_sb.h2
-rw-r--r--include/linux/nfs_page.h7
-rw-r--r--include/linux/nfs_xdr.h2
-rw-r--r--include/linux/nfsd/nfsd.h2
-rw-r--r--include/linux/nmi.h5
-rw-r--r--include/linux/nsproxy.h4
-rw-r--r--include/linux/pata_platform.h13
-rw-r--r--include/linux/pci.h3
-rw-r--r--include/linux/pci_ids.h21
-rw-r--r--include/linux/pci_regs.h7
-rw-r--r--include/linux/personality.h2
-rw-r--r--include/linux/pfkeyv2.h5
-rw-r--r--include/linux/phy.h30
-rw-r--r--include/linux/platform_device.h6
-rw-r--r--include/linux/poll.h3
-rw-r--r--include/linux/profile.h24
-rw-r--r--include/linux/quotaops.h3
-rw-r--r--include/linux/radix-tree.h102
-rw-r--r--include/linux/raid/raid5.h2
-rw-r--r--include/linux/random.h20
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/reiserfs_fs_sb.h5
-rw-r--r--include/linux/relay.h4
-rw-r--r--include/linux/rmap.h4
-rw-r--r--include/linux/rtmutex.h2
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/rwsem-spinlock.h3
-rw-r--r--include/linux/sched.h111
-rw-r--r--include/linux/screen_info.h3
-rw-r--r--include/linux/sctp.h72
-rw-r--r--include/linux/security.h56
-rw-r--r--include/linux/seq_file.h4
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/skbuff.h56
-rw-r--r--include/linux/slab.h92
-rw-r--r--include/linux/smp.h7
-rw-r--r--include/linux/socket.h3
-rw-r--r--include/linux/sockios.h4
-rw-r--r--include/linux/spinlock.h15
-rw-r--r--include/linux/spinlock_api_smp.h2
-rw-r--r--include/linux/start_kernel.h12
-rw-r--r--include/linux/sunrpc/auth_gss.h2
-rw-r--r--include/linux/sunrpc/clnt.h1
-rw-r--r--include/linux/sunrpc/debug.h6
-rw-r--r--include/linux/sunrpc/gss_krb5.h6
-rw-r--r--include/linux/sunrpc/gss_spkm3.h34
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--include/linux/sunrpc/sched.h15
-rw-r--r--include/linux/sunrpc/xdr.h25
-rw-r--r--include/linux/sunrpc/xprt.h37
-rw-r--r--include/linux/suspend.h9
-rw-r--r--include/linux/swap.h6
-rw-r--r--include/linux/sysctl.h35
-rw-r--r--include/linux/sysfs.h8
-rw-r--r--include/linux/taskstats_kern.h43
-rw-r--r--include/linux/tcp.h190
-rw-r--r--include/linux/textsearch.h4
-rw-r--r--include/linux/tfrc.h20
-rw-r--r--include/linux/tipc_config.h32
-rw-r--r--include/linux/tty.h7
-rw-r--r--include/linux/types.h18
-rw-r--r--include/linux/uaccess.h49
-rw-r--r--include/linux/udp.h14
-rw-r--r--include/linux/usb.h183
-rw-r--r--include/linux/vmalloc.h3
-rw-r--r--include/linux/wireless.h2
-rw-r--r--include/linux/workqueue.h154
-rw-r--r--include/linux/xfrm.h6
-rw-r--r--include/linux/zftape.h87
-rw-r--r--include/net/addrconf.h8
-rw-r--r--include/net/arp.h2
-rw-r--r--include/net/atmclip.h2
-rw-r--r--include/net/bluetooth/rfcomm.h4
-rw-r--r--include/net/checksum.h43
-rw-r--r--include/net/cipso_ipv4.h4
-rw-r--r--include/net/dsfield.h10
-rw-r--r--include/net/dst.h2
-rw-r--r--include/net/fib_rules.h10
-rw-r--r--include/net/flow.h9
-rw-r--r--include/net/genetlink.h54
-rw-r--r--include/net/ieee80211.h6
-rw-r--r--include/net/ieee80211softmac.h4
-rw-r--r--include/net/if_inet6.h1
-rw-r--r--include/net/inet6_connection_sock.h4
-rw-r--r--include/net/inet6_hashtables.h16
-rw-r--r--include/net/inet_connection_sock.h8
-rw-r--r--include/net/inet_ecn.h12
-rw-r--r--include/net/inet_hashtables.h6
-rw-r--r--include/net/inet_timewait_sock.h2
-rw-r--r--include/net/ip.h21
-rw-r--r--include/net/ip6_checksum.h76
-rw-r--r--include/net/ip6_fib.h5
-rw-r--r--include/net/ip6_route.h2
-rw-r--r--include/net/ip_fib.h2
-rw-r--r--include/net/ip_mp_alg.h4
-rw-r--r--include/net/ip_vs.h17
-rw-r--r--include/net/ipconfig.h8
-rw-r--r--include/net/ipip.h6
-rw-r--r--include/net/ipv6.h62
-rw-r--r--include/net/ipx.h26
-rw-r--r--include/net/irda/irlan_filter.h2
-rw-r--r--include/net/irda/irlap_frame.h16
-rw-r--r--include/net/irda/timer.h1
-rw-r--r--include/net/llc_pdu.h10
-rw-r--r--include/net/ndisc.h4
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_ipv4.h29
-rw-r--r--include/net/netfilter/ipv6/nf_conntrack_ipv6.h25
-rw-r--r--include/net/netfilter/nf_conntrack.h172
-rw-r--r--include/net/netfilter/nf_conntrack_core.h16
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h95
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h80
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h22
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h15
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h (renamed from include/net/netfilter/nf_conntrack_protocol.h)49
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h34
-rw-r--r--include/net/netfilter/nf_nat.h77
-rw-r--r--include/net/netfilter/nf_nat_core.h27
-rw-r--r--include/net/netfilter/nf_nat_helper.h32
-rw-r--r--include/net/netfilter/nf_nat_protocol.h70
-rw-r--r--include/net/netfilter/nf_nat_rule.h35
-rw-r--r--include/net/netlabel.h123
-rw-r--r--include/net/netlink.h22
-rw-r--r--include/net/protocol.h4
-rw-r--r--include/net/rawv6.h2
-rw-r--r--include/net/request_sock.h14
-rw-r--r--include/net/sch_generic.h6
-rw-r--r--include/net/sctp/command.h4
-rw-r--r--include/net/sctp/constants.h2
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sctp/sm.h6
-rw-r--r--include/net/sctp/structs.h23
-rw-r--r--include/net/sctp/tsnmap.h4
-rw-r--r--include/net/sock.h50
-rw-r--r--include/net/tcp.h159
-rw-r--r--include/net/timewait_sock.h5
-rw-r--r--include/net/tipc/tipc_bearer.h2
-rw-r--r--include/net/tipc/tipc_msg.h2
-rw-r--r--include/net/transp_v6.h2
-rw-r--r--include/net/udp.h97
-rw-r--r--include/net/udplite.h151
-rw-r--r--include/net/xfrm.h90
-rw-r--r--include/pcmcia/ss.h5
-rw-r--r--include/rdma/ib_cm.h16
-rw-r--r--include/rdma/ib_user_cm.h7
-rw-r--r--include/scsi/libiscsi.h2
-rw-r--r--include/scsi/libsas.h42
-rw-r--r--include/scsi/libsrp.h77
-rw-r--r--include/scsi/scsi_cmnd.h10
-rw-r--r--include/scsi/scsi_device.h30
-rw-r--r--include/scsi/scsi_host.h69
-rw-r--r--include/scsi/scsi_tgt.h19
-rw-r--r--include/scsi/scsi_tgt_if.h90
-rw-r--r--include/scsi/scsi_transport_fc.h4
-rw-r--r--include/scsi/scsi_transport_iscsi.h2
-rw-r--r--include/scsi/scsi_transport_sas.h2
-rw-r--r--include/sound/ac97_codec.h2
-rw-r--r--include/sound/ak4114.h2
-rw-r--r--include/sound/core.h8
-rw-r--r--include/sound/pcm.h1
-rw-r--r--include/sound/version.h2
769 files changed, 15088 insertions, 11317 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f338e40bd544..fdd10953b2b6 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -357,7 +357,7 @@ struct device *acpi_get_physical_device(acpi_handle);
357/* helper */ 357/* helper */
358acpi_handle acpi_get_child(acpi_handle, acpi_integer); 358acpi_handle acpi_get_child(acpi_handle, acpi_integer);
359acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); 359acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
360#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data)) 360#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
361 361
362#endif /* CONFIG_ACPI */ 362#endif /* CONFIG_ACPI */
363 363
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 47faf27913a5..7f1e92930b62 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -64,7 +64,7 @@
64/* Host-dependent types and defines */ 64/* Host-dependent types and defines */
65 65
66#define ACPI_MACHINE_WIDTH BITS_PER_LONG 66#define ACPI_MACHINE_WIDTH BITS_PER_LONG
67#define acpi_cache_t kmem_cache_t 67#define acpi_cache_t struct kmem_cache
68#define acpi_spinlock spinlock_t * 68#define acpi_spinlock spinlock_t *
69#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); 69#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
70#define strtoul simple_strtoul 70#define strtoul simple_strtoul
diff --git a/include/asm-alpha/checksum.h b/include/asm-alpha/checksum.h
index a5c9f08447fb..d3854bbf0a9e 100644
--- a/include/asm-alpha/checksum.h
+++ b/include/asm-alpha/checksum.h
@@ -7,21 +7,20 @@
7 * This is a version of ip_compute_csum() optimized for IP headers, 7 * This is a version of ip_compute_csum() optimized for IP headers,
8 * which always checksum on 4 octet boundaries. 8 * which always checksum on 4 octet boundaries.
9 */ 9 */
10extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); 10extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
11 11
12/* 12/*
13 * computes the checksum of the TCP/UDP pseudo-header 13 * computes the checksum of the TCP/UDP pseudo-header
14 * returns a 16-bit checksum, already complemented 14 * returns a 16-bit checksum, already complemented
15 */ 15 */
16extern unsigned short int csum_tcpudp_magic(unsigned long saddr, 16extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
17 unsigned long daddr,
18 unsigned short len, 17 unsigned short len,
19 unsigned short proto, 18 unsigned short proto,
20 unsigned int sum); 19 __wsum sum);
21 20
22unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 21__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
23 unsigned short len, unsigned short proto, 22 unsigned short len, unsigned short proto,
24 unsigned int sum); 23 __wsum sum);
25 24
26/* 25/*
27 * computes the checksum of a memory block at buff, length len, 26 * computes the checksum of a memory block at buff, length len,
@@ -35,7 +34,7 @@ unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
35 * 34 *
36 * it's best to have buff aligned on a 32-bit boundary 35 * it's best to have buff aligned on a 32-bit boundary
37 */ 36 */
38extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 37extern __wsum csum_partial(const void *buff, int len, __wsum sum);
39 38
40/* 39/*
41 * the same as csum_partial, but copies from src while it 40 * the same as csum_partial, but copies from src while it
@@ -44,9 +43,9 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
44 * here even more important to align src and dst on a 32-bit (or even 43 * here even more important to align src and dst on a 32-bit (or even
45 * better 64-bit) boundary 44 * better 64-bit) boundary
46 */ 45 */
47unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int sum, int *errp); 46__wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *errp);
48 47
49unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum); 48__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
50 49
51 50
52/* 51/*
@@ -54,24 +53,23 @@ unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsi
54 * in icmp.c 53 * in icmp.c
55 */ 54 */
56 55
57extern unsigned short ip_compute_csum(unsigned char * buff, int len); 56extern __sum16 ip_compute_csum(const void *buff, int len);
58 57
59/* 58/*
60 * Fold a partial checksum without adding pseudo headers 59 * Fold a partial checksum without adding pseudo headers
61 */ 60 */
62 61
63static inline unsigned short csum_fold(unsigned int sum) 62static inline __sum16 csum_fold(__wsum csum)
64{ 63{
64 u32 sum = (__force u32)csum;
65 sum = (sum & 0xffff) + (sum >> 16); 65 sum = (sum & 0xffff) + (sum >> 16);
66 sum = (sum & 0xffff) + (sum >> 16); 66 sum = (sum & 0xffff) + (sum >> 16);
67 return ~sum; 67 return (__force __sum16)~sum;
68} 68}
69 69
70#define _HAVE_ARCH_IPV6_CSUM 70#define _HAVE_ARCH_IPV6_CSUM
71extern unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 71extern __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
72 struct in6_addr *daddr, 72 const struct in6_addr *daddr,
73 __u32 len, 73 __u32 len, unsigned short proto,
74 unsigned short proto, 74 __wsum sum);
75 unsigned int sum);
76
77#endif 75#endif
diff --git a/include/asm-alpha/device.h b/include/asm-alpha/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-alpha/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-alpha/dma-mapping.h b/include/asm-alpha/dma-mapping.h
index b9ff4d8cb33a..57e09f5e3424 100644
--- a/include/asm-alpha/dma-mapping.h
+++ b/include/asm-alpha/dma-mapping.h
@@ -51,7 +51,7 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
51 51
52#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 52#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
53#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 53#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
54#define dma_is_consistent(dev) (1) 54#define dma_is_consistent(d, h) (1)
55 55
56int dma_set_mask(struct device *dev, u64 mask); 56int dma_set_mask(struct device *dev, u64 mask);
57 57
@@ -60,7 +60,7 @@ int dma_set_mask(struct device *dev, u64 mask);
60#define dma_sync_single_range(dev, addr, off, size, dir) do { } while (0) 60#define dma_sync_single_range(dev, addr, off, size, dir) do { } while (0)
61#define dma_sync_sg_for_cpu(dev, sg, nents, dir) do { } while (0) 61#define dma_sync_sg_for_cpu(dev, sg, nents, dir) do { } while (0)
62#define dma_sync_sg_for_device(dev, sg, nents, dir) do { } while (0) 62#define dma_sync_sg_for_device(dev, sg, nents, dir) do { } while (0)
63#define dma_cache_sync(va, size, dir) do { } while (0) 63#define dma_cache_sync(dev, va, size, dir) do { } while (0)
64 64
65#define dma_get_cache_alignment() L1_CACHE_BYTES 65#define dma_get_cache_alignment() L1_CACHE_BYTES
66 66
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index 2cabbd465c0c..84313d14e780 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -387,188 +387,6 @@
387 387
388#define NR_SYSCALLS 447 388#define NR_SYSCALLS 447
389 389
390#if defined(__GNUC__)
391
392#define _syscall_return(type) \
393 return (_sc_err ? errno = _sc_ret, _sc_ret = -1L : 0), (type) _sc_ret
394
395#define _syscall_clobbers \
396 "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
397 "$22", "$23", "$24", "$25", "$27", "$28" \
398
399#define _syscall0(type, name) \
400type name(void) \
401{ \
402 long _sc_ret, _sc_err; \
403 { \
404 register long _sc_0 __asm__("$0"); \
405 register long _sc_19 __asm__("$19"); \
406 \
407 _sc_0 = __NR_##name; \
408 __asm__("callsys # %0 %1 %2" \
409 : "=r"(_sc_0), "=r"(_sc_19) \
410 : "0"(_sc_0) \
411 : _syscall_clobbers); \
412 _sc_ret = _sc_0, _sc_err = _sc_19; \
413 } \
414 _syscall_return(type); \
415}
416
417#define _syscall1(type,name,type1,arg1) \
418type name(type1 arg1) \
419{ \
420 long _sc_ret, _sc_err; \
421 { \
422 register long _sc_0 __asm__("$0"); \
423 register long _sc_16 __asm__("$16"); \
424 register long _sc_19 __asm__("$19"); \
425 \
426 _sc_0 = __NR_##name; \
427 _sc_16 = (long) (arg1); \
428 __asm__("callsys # %0 %1 %2 %3" \
429 : "=r"(_sc_0), "=r"(_sc_19) \
430 : "0"(_sc_0), "r"(_sc_16) \
431 : _syscall_clobbers); \
432 _sc_ret = _sc_0, _sc_err = _sc_19; \
433 } \
434 _syscall_return(type); \
435}
436
437#define _syscall2(type,name,type1,arg1,type2,arg2) \
438type name(type1 arg1,type2 arg2) \
439{ \
440 long _sc_ret, _sc_err; \
441 { \
442 register long _sc_0 __asm__("$0"); \
443 register long _sc_16 __asm__("$16"); \
444 register long _sc_17 __asm__("$17"); \
445 register long _sc_19 __asm__("$19"); \
446 \
447 _sc_0 = __NR_##name; \
448 _sc_16 = (long) (arg1); \
449 _sc_17 = (long) (arg2); \
450 __asm__("callsys # %0 %1 %2 %3 %4" \
451 : "=r"(_sc_0), "=r"(_sc_19) \
452 : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17) \
453 : _syscall_clobbers); \
454 _sc_ret = _sc_0, _sc_err = _sc_19; \
455 } \
456 _syscall_return(type); \
457}
458
459#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
460type name(type1 arg1,type2 arg2,type3 arg3) \
461{ \
462 long _sc_ret, _sc_err; \
463 { \
464 register long _sc_0 __asm__("$0"); \
465 register long _sc_16 __asm__("$16"); \
466 register long _sc_17 __asm__("$17"); \
467 register long _sc_18 __asm__("$18"); \
468 register long _sc_19 __asm__("$19"); \
469 \
470 _sc_0 = __NR_##name; \
471 _sc_16 = (long) (arg1); \
472 _sc_17 = (long) (arg2); \
473 _sc_18 = (long) (arg3); \
474 __asm__("callsys # %0 %1 %2 %3 %4 %5" \
475 : "=r"(_sc_0), "=r"(_sc_19) \
476 : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17), \
477 "r"(_sc_18) \
478 : _syscall_clobbers); \
479 _sc_ret = _sc_0, _sc_err = _sc_19; \
480 } \
481 _syscall_return(type); \
482}
483
484#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
485type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
486{ \
487 long _sc_ret, _sc_err; \
488 { \
489 register long _sc_0 __asm__("$0"); \
490 register long _sc_16 __asm__("$16"); \
491 register long _sc_17 __asm__("$17"); \
492 register long _sc_18 __asm__("$18"); \
493 register long _sc_19 __asm__("$19"); \
494 \
495 _sc_0 = __NR_##name; \
496 _sc_16 = (long) (arg1); \
497 _sc_17 = (long) (arg2); \
498 _sc_18 = (long) (arg3); \
499 _sc_19 = (long) (arg4); \
500 __asm__("callsys # %0 %1 %2 %3 %4 %5 %6" \
501 : "=r"(_sc_0), "=r"(_sc_19) \
502 : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17), \
503 "r"(_sc_18), "1"(_sc_19) \
504 : _syscall_clobbers); \
505 _sc_ret = _sc_0, _sc_err = _sc_19; \
506 } \
507 _syscall_return(type); \
508}
509
510#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
511 type5,arg5) \
512type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
513{ \
514 long _sc_ret, _sc_err; \
515 { \
516 register long _sc_0 __asm__("$0"); \
517 register long _sc_16 __asm__("$16"); \
518 register long _sc_17 __asm__("$17"); \
519 register long _sc_18 __asm__("$18"); \
520 register long _sc_19 __asm__("$19"); \
521 register long _sc_20 __asm__("$20"); \
522 \
523 _sc_0 = __NR_##name; \
524 _sc_16 = (long) (arg1); \
525 _sc_17 = (long) (arg2); \
526 _sc_18 = (long) (arg3); \
527 _sc_19 = (long) (arg4); \
528 _sc_20 = (long) (arg5); \
529 __asm__("callsys # %0 %1 %2 %3 %4 %5 %6 %7" \
530 : "=r"(_sc_0), "=r"(_sc_19) \
531 : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17), \
532 "r"(_sc_18), "1"(_sc_19), "r"(_sc_20) \
533 : _syscall_clobbers); \
534 _sc_ret = _sc_0, _sc_err = _sc_19; \
535 } \
536 _syscall_return(type); \
537}
538
539#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
540 type5,arg5,type6,arg6) \
541type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6)\
542{ \
543 long _sc_ret, _sc_err; \
544 { \
545 register long _sc_0 __asm__("$0"); \
546 register long _sc_16 __asm__("$16"); \
547 register long _sc_17 __asm__("$17"); \
548 register long _sc_18 __asm__("$18"); \
549 register long _sc_19 __asm__("$19"); \
550 register long _sc_20 __asm__("$20"); \
551 register long _sc_21 __asm__("$21"); \
552 \
553 _sc_0 = __NR_##name; \
554 _sc_16 = (long) (arg1); \
555 _sc_17 = (long) (arg2); \
556 _sc_18 = (long) (arg3); \
557 _sc_19 = (long) (arg4); \
558 _sc_20 = (long) (arg5); \
559 _sc_21 = (long) (arg6); \
560 __asm__("callsys # %0 %1 %2 %3 %4 %5 %6 %7 %8" \
561 : "=r"(_sc_0), "=r"(_sc_19) \
562 : "0"(_sc_0), "r"(_sc_16), "r"(_sc_17), \
563 "r"(_sc_18), "1"(_sc_19), "r"(_sc_20), "r"(_sc_21) \
564 : _syscall_clobbers); \
565 _sc_ret = _sc_0, _sc_err = _sc_19; \
566 } \
567 _syscall_return(type); \
568}
569
570#endif /* __GNUC__ */
571
572#define __ARCH_WANT_IPC_PARSE_VERSION 390#define __ARCH_WANT_IPC_PARSE_VERSION
573#define __ARCH_WANT_OLD_READDIR 391#define __ARCH_WANT_OLD_READDIR
574#define __ARCH_WANT_STAT64 392#define __ARCH_WANT_STAT64
diff --git a/include/asm-arm/arch-aaec2000/memory.h b/include/asm-arm/arch-aaec2000/memory.h
index 24b51cccde8f..9eceb4148922 100644
--- a/include/asm-arm/arch-aaec2000/memory.h
+++ b/include/asm-arm/arch-aaec2000/memory.h
@@ -17,8 +17,6 @@
17#define __virt_to_bus(x) __virt_to_phys(x) 17#define __virt_to_bus(x) __virt_to_phys(x)
18#define __bus_to_virt(x) __phys_to_virt(x) 18#define __bus_to_virt(x) __phys_to_virt(x)
19 19
20#ifdef CONFIG_DISCONTIGMEM
21
22/* 20/*
23 * The nodes are the followings: 21 * The nodes are the followings:
24 * 22 *
@@ -27,42 +25,6 @@
27 * node 2: 0xf800.0000 - 0xfbff.ffff 25 * node 2: 0xf800.0000 - 0xfbff.ffff
28 * node 3: 0xfc00.0000 - 0xffff.ffff 26 * node 3: 0xfc00.0000 - 0xffff.ffff
29 */ 27 */
30 28#define NODE_MEM_SIZE_BITS 26
31/*
32 * Given a kernel address, find the home node of the underlying memory.
33 */
34#define KVADDR_TO_NID(addr) \
35 (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MAX_MEM_SHIFT)
36
37/*
38 * Given a page frame number, convert it to a node id.
39 */
40#define PFN_TO_NID(pfn) \
41 (((pfn) - PHYS_PFN_OFFSET) >> (NODE_MAX_MEM_SHIFT - PAGE_SHIFT))
42
43/*
44 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
45 * and return the mem_map of that node.
46 */
47#define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
48
49/*
50 * Given a page frame number, find the owning node of the memory
51 * and return the mem_map of that node.
52 */
53#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
54
55/*
56 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
57 * and returns the index corresponding to the appropriate page in the
58 * node's mem_map.
59 */
60#define LOCAL_MAP_NR(addr) \
61 (((unsigned long)(addr) & (NODE_MAX_MEM_SIZE - 1)) >> PAGE_SHIFT)
62
63#define NODE_MAX_MEM_SHIFT 26
64#define NODE_MAX_MEM_SIZE (1 << NODE_MAX_MEM_SHIFT)
65
66#endif /* CONFIG_DISCONTIGMEM */
67 29
68#endif /* __ASM_ARCH_MEMORY_H */ 30#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/include/asm-arm/arch-at91rm9200/at91_aic.h b/include/asm-arm/arch-at91rm9200/at91_aic.h
new file mode 100644
index 000000000000..267e69812e26
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_aic.h
@@ -0,0 +1,53 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_aic.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Advanced Interrupt Controller (AIC) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_AIC_H
17#define AT91_AIC_H
18
19#define AT91_AIC_SMR(n) (AT91_AIC + ((n) * 4)) /* Source Mode Registers 0-31 */
20#define AT91_AIC_PRIOR (7 << 0) /* Priority Level */
21#define AT91_AIC_SRCTYPE (3 << 5) /* Interrupt Source Type */
22#define AT91_AIC_SRCTYPE_LOW (0 << 5)
23#define AT91_AIC_SRCTYPE_FALLING (1 << 5)
24#define AT91_AIC_SRCTYPE_HIGH (2 << 5)
25#define AT91_AIC_SRCTYPE_RISING (3 << 5)
26
27#define AT91_AIC_SVR(n) (AT91_AIC + 0x80 + ((n) * 4)) /* Source Vector Registers 0-31 */
28#define AT91_AIC_IVR (AT91_AIC + 0x100) /* Interrupt Vector Register */
29#define AT91_AIC_FVR (AT91_AIC + 0x104) /* Fast Interrupt Vector Register */
30#define AT91_AIC_ISR (AT91_AIC + 0x108) /* Interrupt Status Register */
31#define AT91_AIC_IRQID (0x1f << 0) /* Current Interrupt Identifier */
32
33#define AT91_AIC_IPR (AT91_AIC + 0x10c) /* Interrupt Pending Register */
34#define AT91_AIC_IMR (AT91_AIC + 0x110) /* Interrupt Mask Register */
35#define AT91_AIC_CISR (AT91_AIC + 0x114) /* Core Interrupt Status Register */
36#define AT91_AIC_NFIQ (1 << 0) /* nFIQ Status */
37#define AT91_AIC_NIRQ (1 << 1) /* nIRQ Status */
38
39#define AT91_AIC_IECR (AT91_AIC + 0x120) /* Interrupt Enable Command Register */
40#define AT91_AIC_IDCR (AT91_AIC + 0x124) /* Interrupt Disable Command Register */
41#define AT91_AIC_ICCR (AT91_AIC + 0x128) /* Interrupt Clear Command Register */
42#define AT91_AIC_ISCR (AT91_AIC + 0x12c) /* Interrupt Set Command Register */
43#define AT91_AIC_EOICR (AT91_AIC + 0x130) /* End of Interrupt Command Register */
44#define AT91_AIC_SPU (AT91_AIC + 0x134) /* Spurious Interrupt Vector Register */
45#define AT91_AIC_DCR (AT91_AIC + 0x138) /* Debug Control Register */
46#define AT91_AIC_DCR_PROT (1 << 0) /* Protection Mode */
47#define AT91_AIC_DCR_GMSK (1 << 1) /* General Mask */
48
49#define AT91_AIC_FFER (AT91_AIC + 0x140) /* Fast Forcing Enable Register [SAM9 only] */
50#define AT91_AIC_FFDR (AT91_AIC + 0x144) /* Fast Forcing Disable Register [SAM9 only] */
51#define AT91_AIC_FFSR (AT91_AIC + 0x148) /* Fast Forcing Status Register [SAM9 only] */
52
53#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_dbgu.h b/include/asm-arm/arch-at91rm9200/at91_dbgu.h
new file mode 100644
index 000000000000..e4b8b27acfca
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_dbgu.h
@@ -0,0 +1,45 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_dbgu.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Debug Unit (DBGU) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_DBGU_H
17#define AT91_DBGU_H
18
19#define AT91_DBGU_CR (AT91_DBGU + 0x00) /* Control Register */
20#define AT91_DBGU_MR (AT91_DBGU + 0x04) /* Mode Register */
21#define AT91_DBGU_IER (AT91_DBGU + 0x08) /* Interrupt Enable Register */
22#define AT91_DBGU_TXRDY (1 << 1) /* Transmitter Ready */
23#define AT91_DBGU_TXEMPTY (1 << 9) /* Transmitter Empty */
24#define AT91_DBGU_IDR (AT91_DBGU + 0x0c) /* Interrupt Disable Register */
25#define AT91_DBGU_IMR (AT91_DBGU + 0x10) /* Interrupt Mask Register */
26#define AT91_DBGU_SR (AT91_DBGU + 0x14) /* Status Register */
27#define AT91_DBGU_RHR (AT91_DBGU + 0x18) /* Receiver Holding Register */
28#define AT91_DBGU_THR (AT91_DBGU + 0x1c) /* Transmitter Holding Register */
29#define AT91_DBGU_BRGR (AT91_DBGU + 0x20) /* Baud Rate Generator Register */
30
31#define AT91_DBGU_CIDR (AT91_DBGU + 0x40) /* Chip ID Register */
32#define AT91_DBGU_EXID (AT91_DBGU + 0x44) /* Chip ID Extension Register */
33#define AT91_CIDR_VERSION (0x1f << 0) /* Version of the Device */
34#define AT91_CIDR_EPROC (7 << 5) /* Embedded Processor */
35#define AT91_CIDR_NVPSIZ (0xf << 8) /* Nonvolatile Program Memory Size */
36#define AT91_CIDR_NVPSIZ2 (0xf << 12) /* Second Nonvolatile Program Memory Size */
37#define AT91_CIDR_SRAMSIZ (0xf << 16) /* Internal SRAM Size */
38#define AT91_CIDR_ARCH (0xff << 20) /* Architecture Identifier */
39#define AT91_CIDR_NVPTYP (7 << 28) /* Nonvolatile Program Memory Type */
40#define AT91_CIDR_EXT (1 << 31) /* Extension Flag */
41
42#define AT91_DBGU_FNR (AT91_DBGU + 0x48) /* Force NTRST Register [SAM9 only] */
43#define AT91_DBGU_FNTRST (1 << 0) /* Force NTRST */
44
45#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_ecc.h b/include/asm-arm/arch-at91rm9200/at91_ecc.h
new file mode 100644
index 000000000000..fddf256a98d3
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_ecc.h
@@ -0,0 +1,38 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_ecc.h
3 *
4 * Error Corrected Code Controller (ECC) - System peripherals regsters.
5 * Based on AT91SAM9260 datasheet revision B.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef AT91_ECC_H
14#define AT91_ECC_H
15
16#define AT91_ECC_CR (AT91_ECC + 0x00) /* Control register */
17#define AT91_ECC_RST (1 << 0) /* Reset parity */
18
19#define AT91_ECC_MR (AT91_ECC + 0x04) /* Mode register */
20#define AT91_ECC_PAGESIZE (3 << 0) /* Page Size */
21#define AT91_ECC_PAGESIZE_528 (0)
22#define AT91_ECC_PAGESIZE_1056 (1)
23#define AT91_ECC_PAGESIZE_2112 (2)
24#define AT91_ECC_PAGESIZE_4224 (3)
25
26#define AT91_ECC_SR (AT91_ECC + 0x08) /* Status register */
27#define AT91_ECC_RECERR (1 << 0) /* Recoverable Error */
28#define AT91_ECC_ECCERR (1 << 1) /* ECC Single Bit Error */
29#define AT91_ECC_MULERR (1 << 2) /* Multiple Errors */
30
31#define AT91_ECC_PR (AT91_ECC + 0x0c) /* Parity register */
32#define AT91_ECC_BITADDR (0xf << 0) /* Bit Error Address */
33#define AT91_ECC_WORDADDR (0xfff << 4) /* Word Error Address */
34
35#define AT91_ECC_NPR (AT91_ECC + 0x10) /* NParity register */
36#define AT91_ECC_NPARITY (0xffff << 0) /* NParity */
37
38#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_lcdc.h b/include/asm-arm/arch-at91rm9200/at91_lcdc.h
new file mode 100644
index 000000000000..9cbfcdd3c471
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_lcdc.h
@@ -0,0 +1,148 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_lcdc.h
3 *
4 * LCD Controller (LCDC).
5 * Based on AT91SAM9261 datasheet revision E.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_LCDC_H
14#define AT91_LCDC_H
15
16#define AT91_LCDC_DMABADDR1 0x00 /* DMA Base Address Register 1 */
17#define AT91_LCDC_DMABADDR2 0x04 /* DMA Base Address Register 2 */
18#define AT91_LCDC_DMAFRMPT1 0x08 /* DMA Frame Pointer Register 1 */
19#define AT91_LCDC_DMAFRMPT2 0x0c /* DMA Frame Pointer Register 2 */
20#define AT91_LCDC_DMAFRMADD1 0x10 /* DMA Frame Address Register 1 */
21#define AT91_LCDC_DMAFRMADD2 0x14 /* DMA Frame Address Register 2 */
22
23#define AT91_LCDC_DMAFRMCFG 0x18 /* DMA Frame Configuration Register */
24#define AT91_LCDC_FRSIZE (0x7fffff << 0) /* Frame Size */
25#define AT91_LCDC_BLENGTH (0x7f << 24) /* Burst Length */
26
27#define AT91_LCDC_DMACON 0x1c /* DMA Control Register */
28#define AT91_LCDC_DMAEN (0x1 << 0) /* DMA Enable */
29#define AT91_LCDC_DMARST (0x1 << 1) /* DMA Reset */
30#define AT91_LCDC_DMABUSY (0x1 << 2) /* DMA Busy */
31
32#define AT91_LCDC_LCDCON1 0x0800 /* LCD Control Register 1 */
33#define AT91_LCDC_BYPASS (1 << 0) /* Bypass lcd_dotck divider */
34#define AT91_LCDC_CLKVAL (0x1ff << 12) /* Clock Divider */
35#define AT91_LCDC_LINCNT (0x7ff << 21) /* Line Counter */
36
37#define AT91_LCDC_LCDCON2 0x0804 /* LCD Control Register 2 */
38#define AT91_LCDC_DISTYPE (3 << 0) /* Display Type */
39#define AT91_LCDC_DISTYPE_STNMONO (0 << 0)
40#define AT91_LCDC_DISTYPE_STNCOLOR (1 << 0)
41#define AT91_LCDC_DISTYPE_TFT (2 << 0)
42#define AT91_LCDC_SCANMOD (1 << 2) /* Scan Mode */
43#define AT91_LCDC_SCANMOD_SINGLE (0 << 2)
44#define AT91_LCDC_SCANMOD_DUAL (1 << 2)
45#define AT91_LCDC_IFWIDTH (3 << 3) /*Interface Width */
46#define AT91_LCDC_IFWIDTH_4 (0 << 3)
47#define AT91_LCDC_IFWIDTH_8 (1 << 3)
48#define AT91_LCDC_IFWIDTH_16 (2 << 3)
49#define AT91_LCDC_PIXELSIZE (7 << 5) /* Bits per pixel */
50#define AT91_LCDC_PIXELSIZE_1 (0 << 5)
51#define AT91_LCDC_PIXELSIZE_2 (1 << 5)
52#define AT91_LCDC_PIXELSIZE_4 (2 << 5)
53#define AT91_LCDC_PIXELSIZE_8 (3 << 5)
54#define AT91_LCDC_PIXELSIZE_16 (4 << 5)
55#define AT91_LCDC_PIXELSIZE_24 (5 << 5)
56#define AT91_LCDC_INVVD (1 << 8) /* LCD Data polarity */
57#define AT91_LCDC_INVVD_NORMAL (0 << 8)
58#define AT91_LCDC_INVVD_INVERTED (1 << 8)
59#define AT91_LCDC_INVFRAME (1 << 9 ) /* LCD VSync polarity */
60#define AT91_LCDC_INVFRAME_NORMAL (0 << 9)
61#define AT91_LCDC_INVFRAME_INVERTED (1 << 9)
62#define AT91_LCDC_INVLINE (1 << 10) /* LCD HSync polarity */
63#define AT91_LCDC_INVLINE_NORMAL (0 << 10)
64#define AT91_LCDC_INVLINE_INVERTED (1 << 10)
65#define AT91_LCDC_INVCLK (1 << 11) /* LCD dotclk polarity */
66#define AT91_LCDC_INVCLK_NORMAL (0 << 11)
67#define AT91_LCDC_INVCLK_INVERTED (1 << 11)
68#define AT91_LCDC_INVDVAL (1 << 12) /* LCD dval polarity */
69#define AT91_LCDC_INVDVAL_NORMAL (0 << 12)
70#define AT91_LCDC_INVDVAL_INVERTED (1 << 12)
71#define AT91_LCDC_CLKMOD (1 << 15) /* LCD dotclk mode */
72#define AT91_LCDC_CLKMOD_ACTIVEDISPLAY (0 << 15)
73#define AT91_LCDC_CLKMOD_ALWAYSACTIVE (1 << 15)
74#define AT91_LCDC_MEMOR (1 << 31) /* Memory Ordering Format */
75#define AT91_LCDC_MEMOR_BIG (0 << 31)
76#define AT91_LCDC_MEMOR_LITTLE (1 << 31)
77
78#define AT91_LCDC_TIM1 0x0808 /* LCD Timing Register 1 */
79#define AT91_LCDC_VFP (0xff << 0) /* Vertical Front Porch */
80#define AT91_LCDC_VBP (0xff << 8) /* Vertical Back Porch */
81#define AT91_LCDC_VPW (0x3f << 16) /* Vertical Synchronization Pulse Width */
82#define AT91_LCDC_VHDLY (0xf << 24) /* Vertical to Horizontal Delay */
83
84#define AT91_LCDC_TIM2 0x080c /* LCD Timing Register 2 */
85#define AT91_LCDC_HBP (0xff << 0) /* Horizontal Back Porch */
86#define AT91_LCDC_HPW (0x3f << 8) /* Horizontal Synchronization Pulse Width */
87#define AT91_LCDC_HFP (0x7ff << 21) /* Horizontal Front Porch */
88
89#define AT91_LCDC_LCDFRMCFG 0x0810 /* LCD Frame Configuration Register */
90#define AT91_LCDC_LINEVAL (0x7ff << 0) /* Vertical Size of LCD Module */
91#define AT91_LCDC_HOZVAL (0x7ff << 21) /* Horizontal Size of LCD Module */
92
93#define AT91_LCDC_FIFO 0x0814 /* LCD FIFO Register */
94#define AT91_LCDC_FIFOTH (0xffff) /* FIFO Threshold */
95
96#define AT91_LCDC_DP1_2 0x081c /* Dithering Pattern DP1_2 Register */
97#define AT91_LCDC_DP4_7 0x0820 /* Dithering Pattern DP4_7 Register */
98#define AT91_LCDC_DP3_5 0x0824 /* Dithering Pattern DP3_5 Register */
99#define AT91_LCDC_DP2_3 0x0828 /* Dithering Pattern DP2_3 Register */
100#define AT91_LCDC_DP5_7 0x082c /* Dithering Pattern DP5_7 Register */
101#define AT91_LCDC_DP3_4 0x0830 /* Dithering Pattern DP3_4 Register */
102#define AT91_LCDC_DP4_5 0x0834 /* Dithering Pattern DP4_5 Register */
103#define AT91_LCDC_DP6_7 0x0838 /* Dithering Pattern DP6_7 Register */
104#define AT91_LCDC_DP1_2_VAL (0xff)
105#define AT91_LCDC_DP4_7_VAL (0xfffffff)
106#define AT91_LCDC_DP3_5_VAL (0xfffff)
107#define AT91_LCDC_DP2_3_VAL (0xfff)
108#define AT91_LCDC_DP5_7_VAL (0xfffffff)
109#define AT91_LCDC_DP3_4_VAL (0xffff)
110#define AT91_LCDC_DP4_5_VAL (0xfffff)
111#define AT91_LCDC_DP6_7_VAL (0xfffffff)
112
113#define AT91_LCDC_PWRCON 0x083c /* Power Control Register */
114#define AT91_LCDC_PWR (1 << 0) /* LCD Module Power Control */
115#define AT91_LCDC_GUARDT (0x7f << 1) /* Delay in Frame Period */
116#define AT91_LCDC_BUSY (1 << 31) /* LCD Busy */
117
118#define AT91_LCDC_CONTRAST_CTR 0x0840 /* Contrast Control Register */
119#define AT91_LCDC_PS (3 << 0) /* Contrast Counter Prescaler */
120#define AT91_LCDC_PS_DIV1 (0 << 0)
121#define AT91_LCDC_PS_DIV2 (1 << 0)
122#define AT91_LCDC_PS_DIV4 (2 << 0)
123#define AT91_LCDC_PS_DIV8 (3 << 0)
124#define AT91_LCDC_POL (1 << 2) /* Polarity of output Pulse */
125#define AT91_LCDC_POL_NEGATIVE (0 << 2)
126#define AT91_LCDC_POL_POSITIVE (1 << 2)
127#define AT91_LCDC_ENA (1 << 3) /* PWM generator Control */
128#define AT91_LCDC_ENA_PWMDISABLE (0 << 3)
129#define AT91_LCDC_ENA_PWMENABLE (1 << 3)
130
131#define AT91_LCDC_CONTRAST_VAL 0x0844 /* Contrast Value Register */
132#define AT91_LCDC_CVAL (0xff) /* PWM compare value */
133
134#define AT91_LCDC_IER 0x0848 /* Interrupt Enable Register */
135#define AT91_LCDC_IDR 0x084c /* Interrupt Disable Register */
136#define AT91_LCDC_IMR 0x0850 /* Interrupt Mask Register */
137#define AT91_LCDC_ISR 0x0854 /* Interrupt Enable Register */
138#define AT91_LCDC_ICR 0x0858 /* Interrupt Clear Register */
139#define AT91_LCDC_LNI (1 << 0) /* Line Interrupt */
140#define AT91_LCDC_LSTLNI (1 << 1) /* Last Line Interrupt */
141#define AT91_LCDC_EOFI (1 << 2) /* DMA End Of Frame Interrupt */
142#define AT91_LCDC_UFLWI (1 << 4) /* FIFO Underflow Interrupt */
143#define AT91_LCDC_OWRI (1 << 5) /* FIFO Overwrite Interrupt */
144#define AT91_LCDC_MERI (1 << 6) /* DMA Memory Error Interrupt */
145
146#define AT91_LCDC_LUT_(n) (0x0c00 + ((n)*4)) /* Palette Entry 0..255 */
147
148#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_mci.h b/include/asm-arm/arch-at91rm9200/at91_mci.h
index f28636d61e39..9a552cb743c0 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_mci.h
+++ b/include/asm-arm/arch-at91rm9200/at91_mci.h
@@ -1,11 +1,11 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_mci.h 2 * include/asm-arm/arch-at91rm9200/at91_mci.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
6 * 6 *
7 * MultiMedia Card Interface (MCI) registers. 7 * MultiMedia Card Interface (MCI) registers.
8 * Based on AT91RM9200 datasheet revision E. 8 * Based on AT91RM9200 datasheet revision F.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -13,8 +13,8 @@
13 * (at your option) any later version. 13 * (at your option) any later version.
14 */ 14 */
15 15
16#ifndef AT91RM9200_MCI_H 16#ifndef AT91_MCI_H
17#define AT91RM9200_MCI_H 17#define AT91_MCI_H
18 18
19#define AT91_MCI_CR 0x00 /* Control Register */ 19#define AT91_MCI_CR 0x00 /* Control Register */
20#define AT91_MCI_MCIEN (1 << 0) /* Multi-Media Interface Enable */ 20#define AT91_MCI_MCIEN (1 << 0) /* Multi-Media Interface Enable */
@@ -25,10 +25,10 @@
25 25
26#define AT91_MCI_MR 0x04 /* Mode Register */ 26#define AT91_MCI_MR 0x04 /* Mode Register */
27#define AT91_MCI_CLKDIV (0xff << 0) /* Clock Divider */ 27#define AT91_MCI_CLKDIV (0xff << 0) /* Clock Divider */
28#define AT91_MCI_PWSDIV (3 << 8) /* Power Saving Divider */ 28#define AT91_MCI_PWSDIV (7 << 8) /* Power Saving Divider */
29#define AT91_MCI_PDCPADV (1 << 14) /* PDC Padding Value */ 29#define AT91_MCI_PDCPADV (1 << 14) /* PDC Padding Value */
30#define AT91_MCI_PDCMODE (1 << 15) /* PDC-orientated Mode */ 30#define AT91_MCI_PDCMODE (1 << 15) /* PDC-orientated Mode */
31#define AT91_MCI_BLKLEN (0xfff << 18) /* Data Block Length */ 31#define AT91_MCI_BLKLEN (0xfff << 18) /* Data Block Length */
32 32
33#define AT91_MCI_DTOR 0x08 /* Data Timeout Register */ 33#define AT91_MCI_DTOR 0x08 /* Data Timeout Register */
34#define AT91_MCI_DTOCYC (0xf << 0) /* Data Timeout Cycle Number */ 34#define AT91_MCI_DTOCYC (0xf << 0) /* Data Timeout Cycle Number */
@@ -43,8 +43,8 @@
43#define AT91_MCI_DTOMUL_1M (7 << 4) 43#define AT91_MCI_DTOMUL_1M (7 << 4)
44 44
45#define AT91_MCI_SDCR 0x0c /* SD Card Register */ 45#define AT91_MCI_SDCR 0x0c /* SD Card Register */
46#define AT91_MCI_SDCSEL (0xf << 0) /* SD Card Selector */ 46#define AT91_MCI_SDCSEL (3 << 0) /* SD Card Selector */
47#define AT91_MCI_SDCBUS (1 << 7) /* 1-bit or 4-bit bus */ 47#define AT91_MCI_SDCBUS (1 << 7) /* 1-bit or 4-bit bus */
48 48
49#define AT91_MCI_ARGR 0x10 /* Argument Register */ 49#define AT91_MCI_ARGR 0x10 /* Argument Register */
50 50
@@ -78,18 +78,20 @@
78 78
79#define AT91_MCI_SR 0x40 /* Status Register */ 79#define AT91_MCI_SR 0x40 /* Status Register */
80#define AT91_MCI_CMDRDY (1 << 0) /* Command Ready */ 80#define AT91_MCI_CMDRDY (1 << 0) /* Command Ready */
81#define AT91_MCI_RXRDY (1 << 1) /* Receiver Ready */ 81#define AT91_MCI_RXRDY (1 << 1) /* Receiver Ready */
82#define AT91_MCI_TXRDY (1 << 2) /* Transmit Ready */ 82#define AT91_MCI_TXRDY (1 << 2) /* Transmit Ready */
83#define AT91_MCI_BLKE (1 << 3) /* Data Block Ended */ 83#define AT91_MCI_BLKE (1 << 3) /* Data Block Ended */
84#define AT91_MCI_DTIP (1 << 4) /* Data Transfer in Progress */ 84#define AT91_MCI_DTIP (1 << 4) /* Data Transfer in Progress */
85#define AT91_MCI_NOTBUSY (1 << 5) /* Data Not Busy */ 85#define AT91_MCI_NOTBUSY (1 << 5) /* Data Not Busy */
86#define AT91_MCI_ENDRX (1 << 6) /* End of RX Buffer */ 86#define AT91_MCI_ENDRX (1 << 6) /* End of RX Buffer */
87#define AT91_MCI_ENDTX (1 << 7) /* End fo TX Buffer */ 87#define AT91_MCI_ENDTX (1 << 7) /* End fo TX Buffer */
88#define AT91_MCI_SDIOIRQA (1 << 8) /* SDIO Interrupt for Slot A */
89#define At91_MCI_SDIOIRQB (1 << 9) /* SDIO Interrupt for Slot B [AT91RM9200 only] */
88#define AT91_MCI_RXBUFF (1 << 14) /* RX Buffer Full */ 90#define AT91_MCI_RXBUFF (1 << 14) /* RX Buffer Full */
89#define AT91_MCI_TXBUFE (1 << 15) /* TX Buffer Empty */ 91#define AT91_MCI_TXBUFE (1 << 15) /* TX Buffer Empty */
90#define AT91_MCI_RINDE (1 << 16) /* Response Index Error */ 92#define AT91_MCI_RINDE (1 << 16) /* Response Index Error */
91#define AT91_MCI_RDIRE (1 << 17) /* Response Direction Error */ 93#define AT91_MCI_RDIRE (1 << 17) /* Response Direction Error */
92#define AT91_MCI_RCRCE (1 << 18) /* Response CRC Error */ 94#define AT91_MCI_RCRCE (1 << 18) /* Response CRC Error */
93#define AT91_MCI_RENDE (1 << 19) /* Response End Bit Error */ 95#define AT91_MCI_RENDE (1 << 19) /* Response End Bit Error */
94#define AT91_MCI_RTOE (1 << 20) /* Reponse Time-out Error */ 96#define AT91_MCI_RTOE (1 << 20) /* Reponse Time-out Error */
95#define AT91_MCI_DCRCE (1 << 21) /* Data CRC Error */ 97#define AT91_MCI_DCRCE (1 << 21) /* Data CRC Error */
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h b/include/asm-arm/arch-at91rm9200/at91_pdc.h
index ce1150d4438d..79d6e02fa45e 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h
+++ b/include/asm-arm/arch-at91rm9200/at91_pdc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h 2 * include/asm-arm/arch-at91rm9200/at91_pdc.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
@@ -13,8 +13,8 @@
13 * (at your option) any later version. 13 * (at your option) any later version.
14 */ 14 */
15 15
16#ifndef AT91RM9200_PDC_H 16#ifndef AT91_PDC_H
17#define AT91RM9200_PDC_H 17#define AT91_PDC_H
18 18
19#define AT91_PDC_RPR 0x100 /* Receive Pointer Register */ 19#define AT91_PDC_RPR 0x100 /* Receive Pointer Register */
20#define AT91_PDC_RCR 0x104 /* Receive Counter Register */ 20#define AT91_PDC_RCR 0x104 /* Receive Counter Register */
diff --git a/include/asm-arm/arch-at91rm9200/at91_pio.h b/include/asm-arm/arch-at91rm9200/at91_pio.h
new file mode 100644
index 000000000000..680eaa1f5915
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_pio.h
@@ -0,0 +1,49 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_pio.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Parallel I/O Controller (PIO) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_PIO_H
17#define AT91_PIO_H
18
19#define PIO_PER 0x00 /* Enable Register */
20#define PIO_PDR 0x04 /* Disable Register */
21#define PIO_PSR 0x08 /* Status Register */
22#define PIO_OER 0x10 /* Output Enable Register */
23#define PIO_ODR 0x14 /* Output Disable Register */
24#define PIO_OSR 0x18 /* Output Status Register */
25#define PIO_IFER 0x20 /* Glitch Input Filter Enable */
26#define PIO_IFDR 0x24 /* Glitch Input Filter Disable */
27#define PIO_IFSR 0x28 /* Glitch Input Filter Status */
28#define PIO_SODR 0x30 /* Set Output Data Register */
29#define PIO_CODR 0x34 /* Clear Output Data Register */
30#define PIO_ODSR 0x38 /* Output Data Status Register */
31#define PIO_PDSR 0x3c /* Pin Data Status Register */
32#define PIO_IER 0x40 /* Interrupt Enable Register */
33#define PIO_IDR 0x44 /* Interrupt Disable Register */
34#define PIO_IMR 0x48 /* Interrupt Mask Register */
35#define PIO_ISR 0x4c /* Interrupt Status Register */
36#define PIO_MDER 0x50 /* Multi-driver Enable Register */
37#define PIO_MDDR 0x54 /* Multi-driver Disable Register */
38#define PIO_MDSR 0x58 /* Multi-driver Status Register */
39#define PIO_PUDR 0x60 /* Pull-up Disable Register */
40#define PIO_PUER 0x64 /* Pull-up Enable Register */
41#define PIO_PUSR 0x68 /* Pull-up Status Register */
42#define PIO_ASR 0x70 /* Peripheral A Select Register */
43#define PIO_BSR 0x74 /* Peripheral B Select Register */
44#define PIO_ABSR 0x78 /* AB Status Register */
45#define PIO_OWER 0xa0 /* Output Write Enable Register */
46#define PIO_OWDR 0xa4 /* Output Write Disable Register */
47#define PIO_OWSR 0xa8 /* Output Write Status Register */
48
49#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_pit.h b/include/asm-arm/arch-at91rm9200/at91_pit.h
new file mode 100644
index 000000000000..4a30d009c588
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_pit.h
@@ -0,0 +1,29 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_pit.h
3 *
4 * Periodic Interval Timer (PIT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_PIT_H
14#define AT91_PIT_H
15
16#define AT91_PIT_MR (AT91_PIT + 0x00) /* Mode Register */
17#define AT91_PIT_PITIEN (1 << 25) /* Timer Interrupt Enable */
18#define AT91_PIT_PITEN (1 << 24) /* Timer Enabled */
19#define AT91_PIT_PIV (0xfffff) /* Periodic Interval Value */
20
21#define AT91_PIT_SR (AT91_PIT + 0x04) /* Status Register */
22#define AT91_PIT_PITS (1 << 0) /* Timer Status */
23
24#define AT91_PIT_PIVR (AT91_PIT + 0x08) /* Periodic Interval Value Register */
25#define AT91_PIT_PIIR (AT91_PIT + 0x0c) /* Periodic Interval Image Register */
26#define AT91_PIT_PICNT (0xfff << 20) /* Interval Counter */
27#define AT91_PIT_CPIV (0xfffff) /* Inverval Value */
28
29#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_pmc.h b/include/asm-arm/arch-at91rm9200/at91_pmc.h
new file mode 100644
index 000000000000..de8c3da74a01
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_pmc.h
@@ -0,0 +1,92 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_pmc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Power Management Controller (PMC) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_PMC_H
17#define AT91_PMC_H
18
19#define AT91_PMC_SCER (AT91_PMC + 0x00) /* System Clock Enable Register */
20#define AT91_PMC_SCDR (AT91_PMC + 0x04) /* System Clock Disable Register */
21
22#define AT91_PMC_SCSR (AT91_PMC + 0x08) /* System Clock Status Register */
23#define AT91_PMC_PCK (1 << 0) /* Processor Clock */
24#define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */
25#define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */
26#define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */
27#define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */
28#define AT91SAM926x_PMC_UDP (1 << 7) /* USB Devcice Port Clock [AT91SAM926x only] */
29#define AT91_PMC_PCK0 (1 << 8) /* Programmable Clock 0 */
30#define AT91_PMC_PCK1 (1 << 9) /* Programmable Clock 1 */
31#define AT91_PMC_PCK2 (1 << 10) /* Programmable Clock 2 */
32#define AT91_PMC_PCK3 (1 << 11) /* Programmable Clock 3 */
33#define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */
34#define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */
35
36#define AT91_PMC_PCER (AT91_PMC + 0x10) /* Peripheral Clock Enable Register */
37#define AT91_PMC_PCDR (AT91_PMC + 0x14) /* Peripheral Clock Disable Register */
38#define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */
39
40#define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register */
41#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
42#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass [AT91SAM926x only] */
43#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */
44
45#define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */
46#define AT91_PMC_MAINF (0xffff << 0) /* Main Clock Frequency */
47#define AT91_PMC_MAINRDY (1 << 16) /* Main Clock Ready */
48
49#define AT91_CKGR_PLLAR (AT91_PMC + 0x28) /* PLL A Register */
50#define AT91_CKGR_PLLBR (AT91_PMC + 0x2c) /* PLL B Register */
51#define AT91_PMC_DIV (0xff << 0) /* Divider */
52#define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */
53#define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */
54#define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */
55#define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */
56
57#define AT91_PMC_MCKR (AT91_PMC + 0x30) /* Master Clock Register */
58#define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */
59#define AT91_PMC_CSS_SLOW (0 << 0)
60#define AT91_PMC_CSS_MAIN (1 << 0)
61#define AT91_PMC_CSS_PLLA (2 << 0)
62#define AT91_PMC_CSS_PLLB (3 << 0)
63#define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */
64#define AT91_PMC_PRES_1 (0 << 2)
65#define AT91_PMC_PRES_2 (1 << 2)
66#define AT91_PMC_PRES_4 (2 << 2)
67#define AT91_PMC_PRES_8 (3 << 2)
68#define AT91_PMC_PRES_16 (4 << 2)
69#define AT91_PMC_PRES_32 (5 << 2)
70#define AT91_PMC_PRES_64 (6 << 2)
71#define AT91_PMC_MDIV (3 << 8) /* Master Clock Division */
72#define AT91_PMC_MDIV_1 (0 << 8)
73#define AT91_PMC_MDIV_2 (1 << 8)
74#define AT91_PMC_MDIV_3 (2 << 8)
75#define AT91_PMC_MDIV_4 (3 << 8)
76
77#define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-3 Registers */
78
79#define AT91_PMC_IER (AT91_PMC + 0x60) /* Interrupt Enable Register */
80#define AT91_PMC_IDR (AT91_PMC + 0x64) /* Interrupt Disable Register */
81#define AT91_PMC_SR (AT91_PMC + 0x68) /* Status Register */
82#define AT91_PMC_MOSCS (1 << 0) /* MOSCS Flag */
83#define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */
84#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
85#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
86#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
87#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
88#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
89#define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */
90#define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */
91
92#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_rstc.h b/include/asm-arm/arch-at91rm9200/at91_rstc.h
new file mode 100644
index 000000000000..ccdc52da973d
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_rstc.h
@@ -0,0 +1,39 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_rstc.h
3 *
4 * Reset Controller (RSTC) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_RSTC_H
14#define AT91_RSTC_H
15
16#define AT91_RSTC_CR (AT91_RSTC + 0x00) /* Reset Controller Control Register */
17#define AT91_RSTC_PROCRST (1 << 0) /* Processor Reset */
18#define AT91_RSTC_PERRST (1 << 2) /* Peripheral Reset */
19#define AT91_RSTC_EXTRST (1 << 3) /* External Reset */
20#define AT01_RSTC_KEY (0xff << 24) /* KEY Password */
21
22#define AT91_RSTC_SR (AT91_RSTC + 0x04) /* Reset Controller Status Register */
23#define AT91_RSTC_URSTS (1 << 0) /* User Reset Status */
24#define AT91_RSTC_RSTTYP (7 << 8) /* Reset Type */
25#define AT91_RSTC_RSTTYP_GENERAL (0 << 8)
26#define AT91_RSTC_RSTTYP_WAKEUP (1 << 8)
27#define AT91_RSTC_RSTTYP_WATCHDOG (2 << 8)
28#define AT91_RSTC_RSTTYP_SOFTWARE (3 << 8)
29#define AT91_RSTC_RSTTYP_USER (4 << 8)
30#define AT91_RSTC_NRSTL (1 << 16) /* NRST Pin Level */
31#define AT91_RSTC_SRCMP (1 << 17) /* Software Reset Command in Progress */
32
33#define AT91_RSTC_MR (AT91_RSTC + 0x08) /* Reset Controller Mode Register */
34#define AT91_RSTC_URSTEN (1 << 0) /* User Reset Enable */
35#define AT91_RSTC_URSTIEN (1 << 4) /* User Reset Interrupt Enable */
36#define AT91_RSTC_ERSTL (0xf << 8) /* External Reset Length */
37#define AT91_RSTC_KEY (0xff << 24) /* KEY Password */
38
39#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_rtc.h b/include/asm-arm/arch-at91rm9200/at91_rtc.h
new file mode 100644
index 000000000000..6e5065d56260
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_rtc.h
@@ -0,0 +1,75 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_rtc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Real Time Clock (RTC) - System peripheral 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 AT91_RTC_H
17#define AT91_RTC_H
18
19#define AT91_RTC_CR (AT91_RTC + 0x00) /* Control Register */
20#define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */
21#define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */
22#define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */
23#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8)
24#define AT91_RTC_TIMEVSEL_HOUR (1 << 8)
25#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8)
26#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8)
27#define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */
28#define AT91_RTC_CALEVSEL_WEEK (0 << 16)
29#define AT91_RTC_CALEVSEL_MONTH (1 << 16)
30#define AT91_RTC_CALEVSEL_YEAR (2 << 16)
31
32#define AT91_RTC_MR (AT91_RTC + 0x04) /* Mode Register */
33#define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */
34
35#define AT91_RTC_TIMR (AT91_RTC + 0x08) /* Time Register */
36#define AT91_RTC_SEC (0x7f << 0) /* Current Second */
37#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */
38#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */
39#define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */
40
41#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */
42#define AT91_RTC_CENT (0x7f << 0) /* Current Century */
43#define AT91_RTC_YEAR (0xff << 8) /* Current Year */
44#define AT91_RTC_MONTH (0x1f << 16) /* Current Month */
45#define AT91_RTC_DAY (7 << 21) /* Current Day */
46#define AT91_RTC_DATE (0x3f << 24) /* Current Date */
47
48#define AT91_RTC_TIMALR (AT91_RTC + 0x10) /* Time Alarm Register */
49#define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */
50#define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */
51#define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */
52
53#define AT91_RTC_CALALR (AT91_RTC + 0x14) /* Calendar Alarm Register */
54#define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */
55#define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */
56
57#define AT91_RTC_SR (AT91_RTC + 0x18) /* Status Register */
58#define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */
59#define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */
60#define AT91_RTC_SECEV (1 << 2) /* Second Event */
61#define AT91_RTC_TIMEV (1 << 3) /* Time Event */
62#define AT91_RTC_CALEV (1 << 4) /* Calendar Event */
63
64#define AT91_RTC_SCCR (AT91_RTC + 0x1c) /* Status Clear Command Register */
65#define AT91_RTC_IER (AT91_RTC + 0x20) /* Interrupt Enable Register */
66#define AT91_RTC_IDR (AT91_RTC + 0x24) /* Interrupt Disable Register */
67#define AT91_RTC_IMR (AT91_RTC + 0x28) /* Interrupt Mask Register */
68
69#define AT91_RTC_VER (AT91_RTC + 0x2c) /* Valid Entry Register */
70#define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
71#define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */
72#define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */
73#define AT91_RTC_NVCALALR (1 << 3) /* Non valid Calendar Alarm */
74
75#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_rtt.h b/include/asm-arm/arch-at91rm9200/at91_rtt.h
new file mode 100644
index 000000000000..c6751ba3cccc
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_rtt.h
@@ -0,0 +1,32 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_rtt.h
3 *
4 * Real-time Timer (RTT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_RTT_H
14#define AT91_RTT_H
15
16#define AT91_RTT_MR (AT91_RTT + 0x00) /* Real-time Mode Register */
17#define AT91_RTT_RTPRES (0xffff << 0) /* Real-time Timer Prescaler Value */
18#define AT91_RTT_ALMIEN (1 << 16) /* Alarm Interrupt Enable */
19#define AT91_RTT_RTTINCIEN (1 << 17) /* Real Time Timer Increment Interrupt Enable */
20#define AT91_RTT_RTTRST (1 << 18) /* Real Time Timer Restart */
21
22#define AT91_RTT_AR (AT91_RTT + 0x04) /* Real-time Alarm Register */
23#define AT91_RTT_ALMV (0xffffffff) /* Alarm Value */
24
25#define AT91_RTT_VR (AT91_RTT + 0x08) /* Real-time Value Register */
26#define AT91_RTT_CRTV (0xffffffff) /* Current Real-time Value */
27
28#define AT91_RTT_SR (AT91_RTT + 0x0c) /* Real-time Status Register */
29#define AT91_RTT_ALMS (1 << 0) /* Real-time Alarm Status */
30#define AT91_RTT_RTTINC (1 << 1) /* Real-time Timer Increment */
31
32#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_shdwc.h b/include/asm-arm/arch-at91rm9200/at91_shdwc.h
new file mode 100644
index 000000000000..0439250553c9
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_shdwc.h
@@ -0,0 +1,33 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_shdwc.h
3 *
4 * Shutdown Controller (SHDWC) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_SHDWC_H
14#define AT91_SHDWC_H
15
16#define AT91_SHDW_CR (AT91_SHDWC + 0x00) /* Shut Down Control Register */
17#define AT91_SHDW_SHDW (1 << 0) /* Processor Reset */
18#define AT91_SHDW_KEY (0xff << 24) /* KEY Password */
19
20#define AT91_SHDW_MR (AT91_SHDWC + 0x04) /* Shut Down Mode Register */
21#define AT91_SHDW_WKMODE0 (3 << 0) /* Wake-up 0 Mode Selection */
22#define AT91_SHDW_WKMODE0_NONE 0
23#define AT91_SHDW_WKMODE0_HIGH 1
24#define AT91_SHDW_WKMODE0_LOW 2
25#define AT91_SHDW_WKMODE0_ANYLEVEL 3
26#define AT91_SHDW_CPTWK0 (0xf << 4) /* Counter On Wake Up 0 */
27#define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */
28
29#define AT91_SHDW_SR (AT91_SHDWC + 0x08) /* Shut Down Status Register */
30#define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */
31#define AT91_SHDW_RTTWK (1 << 16) /* Real-time Timer Wake-up */
32
33#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_spi.h b/include/asm-arm/arch-at91rm9200/at91_spi.h
index bff5ea45f604..bec48ca89bba 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_spi.h
+++ b/include/asm-arm/arch-at91rm9200/at91_spi.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_spi.h 2 * include/asm-arm/arch-at91rm9200/at91_spi.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
@@ -13,8 +13,8 @@
13 * (at your option) any later version. 13 * (at your option) any later version.
14 */ 14 */
15 15
16#ifndef AT91RM9200_SPI_H 16#ifndef AT91_SPI_H
17#define AT91RM9200_SPI_H 17#define AT91_SPI_H
18 18
19#define AT91_SPI_CR 0x00 /* Control Register */ 19#define AT91_SPI_CR 0x00 /* Control Register */
20#define AT91_SPI_SPIEN (1 << 0) /* SPI Enable */ 20#define AT91_SPI_SPIEN (1 << 0) /* SPI Enable */
@@ -28,7 +28,7 @@
28#define AT91_SPI_PS_FIXED (0 << 1) 28#define AT91_SPI_PS_FIXED (0 << 1)
29#define AT91_SPI_PS_VARIABLE (1 << 1) 29#define AT91_SPI_PS_VARIABLE (1 << 1)
30#define AT91_SPI_PCSDEC (1 << 2) /* Chip Select Decode */ 30#define AT91_SPI_PCSDEC (1 << 2) /* Chip Select Decode */
31#define AT91_SPI_DIV32 (1 << 3) /* Clock Selection */ 31#define AT91_SPI_DIV32 (1 << 3) /* Clock Selection [AT91RM9200 only] */
32#define AT91_SPI_MODFDIS (1 << 4) /* Mode Fault Detection */ 32#define AT91_SPI_MODFDIS (1 << 4) /* Mode Fault Detection */
33#define AT91_SPI_LLB (1 << 7) /* Local Loopback Enable */ 33#define AT91_SPI_LLB (1 << 7) /* Local Loopback Enable */
34#define AT91_SPI_PCS (0xf << 16) /* Peripheral Chip Select */ 34#define AT91_SPI_PCS (0xf << 16) /* Peripheral Chip Select */
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_ssc.h b/include/asm-arm/arch-at91rm9200/at91_ssc.h
index ac880227147f..694bcaa8f7c2 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_ssc.h
+++ b/include/asm-arm/arch-at91rm9200/at91_ssc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_ssc.h 2 * include/asm-arm/arch-at91rm9200/at91_ssc.h
3 * 3 *
4 * Copyright (C) SAN People 4 * Copyright (C) SAN People
5 * 5 *
@@ -12,8 +12,8 @@
12 * (at your option) any later version. 12 * (at your option) any later version.
13 */ 13 */
14 14
15#ifndef AT91RM9200_SSC_H 15#ifndef AT91_SSC_H
16#define AT91RM9200_SSC_H 16#define AT91_SSC_H
17 17
18#define AT91_SSC_CR 0x00 /* Control Register */ 18#define AT91_SSC_CR 0x00 /* Control Register */
19#define AT91_SSC_RXEN (1 << 0) /* Receive Enable */ 19#define AT91_SSC_RXEN (1 << 0) /* Receive Enable */
@@ -36,6 +36,10 @@
36#define AT91_SSC_CKI (1 << 5) /* Clock Inversion */ 36#define AT91_SSC_CKI (1 << 5) /* Clock Inversion */
37#define AT91_SSC_CKI_FALLING (0 << 5) 37#define AT91_SSC_CKI_FALLING (0 << 5)
38#define AT91_SSC_CK_RISING (1 << 5) 38#define AT91_SSC_CK_RISING (1 << 5)
39#define AT91_SSC_CKG (1 << 6) /* Receive Clock Gating Selection [AT91SAM9261 only] */
40#define AT91_SSC_CKG_NONE (0 << 6)
41#define AT91_SSC_CKG_RFLOW (1 << 6)
42#define AT91_SSC_CKG_RFHIGH (2 << 6)
39#define AT91_SSC_START (0xf << 8) /* Start Selection */ 43#define AT91_SSC_START (0xf << 8) /* Start Selection */
40#define AT91_SSC_START_CONTINUOUS (0 << 8) 44#define AT91_SSC_START_CONTINUOUS (0 << 8)
41#define AT91_SSC_START_TX_RX (1 << 8) 45#define AT91_SSC_START_TX_RX (1 << 8)
@@ -45,6 +49,7 @@
45#define AT91_SSC_START_RISING_RF (5 << 8) 49#define AT91_SSC_START_RISING_RF (5 << 8)
46#define AT91_SSC_START_LEVEL_RF (6 << 8) 50#define AT91_SSC_START_LEVEL_RF (6 << 8)
47#define AT91_SSC_START_EDGE_RF (7 << 8) 51#define AT91_SSC_START_EDGE_RF (7 << 8)
52#define AT91_SSC_STOP (1 << 12) /* Receive Stop Selection [AT91SAM9261 only] */
48#define AT91_SSC_STTDLY (0xff << 16) /* Start Delay */ 53#define AT91_SSC_STTDLY (0xff << 16) /* Start Delay */
49#define AT91_SSC_PERIOD (0xff << 24) /* Period Divider Selection */ 54#define AT91_SSC_PERIOD (0xff << 24) /* Period Divider Selection */
50 55
@@ -75,6 +80,9 @@
75#define AT91_SSC_RSHR 0x30 /* Receive Sync Holding Register */ 80#define AT91_SSC_RSHR 0x30 /* Receive Sync Holding Register */
76#define AT91_SSC_TSHR 0x34 /* Transmit Sync Holding Register */ 81#define AT91_SSC_TSHR 0x34 /* Transmit Sync Holding Register */
77 82
83#define AT91_SSC_RC0R 0x38 /* Receive Compare 0 Register [AT91SAM9261 only] */
84#define AT91_SSC_RC1R 0x3c /* Receive Compare 1 Register [AT91SAM9261 only] */
85
78#define AT91_SSC_SR 0x40 /* Status Register */ 86#define AT91_SSC_SR 0x40 /* Status Register */
79#define AT91_SSC_TXRDY (1 << 0) /* Transmit Ready */ 87#define AT91_SSC_TXRDY (1 << 0) /* Transmit Ready */
80#define AT91_SSC_TXEMPTY (1 << 1) /* Transmit Empty */ 88#define AT91_SSC_TXEMPTY (1 << 1) /* Transmit Empty */
@@ -84,6 +92,8 @@
84#define AT91_SSC_OVRUN (1 << 5) /* Receive Overrun */ 92#define AT91_SSC_OVRUN (1 << 5) /* Receive Overrun */
85#define AT91_SSC_ENDRX (1 << 6) /* End of Reception */ 93#define AT91_SSC_ENDRX (1 << 6) /* End of Reception */
86#define AT91_SSC_RXBUFF (1 << 7) /* Receive Buffer Full */ 94#define AT91_SSC_RXBUFF (1 << 7) /* Receive Buffer Full */
95#define AT91_SSC_CP0 (1 << 8) /* Compare 0 [AT91SAM9261 only] */
96#define AT91_SSC_CP1 (1 << 9) /* Compare 1 [AT91SAM9261 only] */
87#define AT91_SSC_TXSYN (1 << 10) /* Transmit Sync */ 97#define AT91_SSC_TXSYN (1 << 10) /* Transmit Sync */
88#define AT91_SSC_RXSYN (1 << 11) /* Receive Sync */ 98#define AT91_SSC_RXSYN (1 << 11) /* Receive Sync */
89#define AT91_SSC_TXENA (1 << 16) /* Transmit Enable */ 99#define AT91_SSC_TXENA (1 << 16) /* Transmit Enable */
diff --git a/include/asm-arm/arch-at91rm9200/at91_st.h b/include/asm-arm/arch-at91rm9200/at91_st.h
new file mode 100644
index 000000000000..2432ddfc6c47
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_st.h
@@ -0,0 +1,49 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_st.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * System Timer (ST) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_ST_H
17#define AT91_ST_H
18
19#define AT91_ST_CR (AT91_ST + 0x00) /* Control Register */
20#define AT91_ST_WDRST (1 << 0) /* Watchdog Timer Restart */
21
22#define AT91_ST_PIMR (AT91_ST + 0x04) /* Period Interval Mode Register */
23#define AT91_ST_PIV (0xffff << 0) /* Period Interval Value */
24
25#define AT91_ST_WDMR (AT91_ST + 0x08) /* Watchdog Mode Register */
26#define AT91_ST_WDV (0xffff << 0) /* Watchdog Counter Value */
27#define AT91_ST_RSTEN (1 << 16) /* Reset Enable */
28#define AT91_ST_EXTEN (1 << 17) /* External Signal Assertion Enable */
29
30#define AT91_ST_RTMR (AT91_ST + 0x0c) /* Real-time Mode Register */
31#define AT91_ST_RTPRES (0xffff << 0) /* Real-time Prescalar Value */
32
33#define AT91_ST_SR (AT91_ST + 0x10) /* Status Register */
34#define AT91_ST_PITS (1 << 0) /* Period Interval Timer Status */
35#define AT91_ST_WDOVF (1 << 1) /* Watchdog Overflow */
36#define AT91_ST_RTTINC (1 << 2) /* Real-time Timer Increment */
37#define AT91_ST_ALMS (1 << 3) /* Alarm Status */
38
39#define AT91_ST_IER (AT91_ST + 0x14) /* Interrupt Enable Register */
40#define AT91_ST_IDR (AT91_ST + 0x18) /* Interrupt Disable Register */
41#define AT91_ST_IMR (AT91_ST + 0x1c) /* Interrupt Mask Register */
42
43#define AT91_ST_RTAR (AT91_ST + 0x20) /* Real-time Alarm Register */
44#define AT91_ST_ALMV (0xfffff << 0) /* Alarm Value */
45
46#define AT91_ST_CRTR (AT91_ST + 0x24) /* Current Real-time Register */
47#define AT91_ST_CRTV (0xfffff << 0) /* Current Real-Time Value */
48
49#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_tc.h b/include/asm-arm/arch-at91rm9200/at91_tc.h
index f4da752bb0c8..8d06eb078e1d 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_tc.h
+++ b/include/asm-arm/arch-at91rm9200/at91_tc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_tc.h 2 * include/asm-arm/arch-at91rm9200/at91_tc.h
3 * 3 *
4 * Copyright (C) SAN People 4 * Copyright (C) SAN People
5 * 5 *
@@ -12,8 +12,8 @@
12 * (at your option) any later version. 12 * (at your option) any later version.
13 */ 13 */
14 14
15#ifndef AT91RM9200_TC_H 15#ifndef AT91_TC_H
16#define AT91RM9200_TC_H 16#define AT91_TC_H
17 17
18#define AT91_TC_BCR 0xc0 /* TC Block Control Register */ 18#define AT91_TC_BCR 0xc0 /* TC Block Control Register */
19#define AT91_TC_SYNC (1 << 0) /* Synchro Command */ 19#define AT91_TC_SYNC (1 << 0) /* Synchro Command */
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_twi.h b/include/asm-arm/arch-at91rm9200/at91_twi.h
index 93547d7482bd..cda914f1e740 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_twi.h
+++ b/include/asm-arm/arch-at91rm9200/at91_twi.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_twi.h 2 * include/asm-arm/arch-at91rm9200/at91_twi.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
@@ -13,8 +13,8 @@
13 * (at your option) any later version. 13 * (at your option) any later version.
14 */ 14 */
15 15
16#ifndef AT91RM9200_TWI_H 16#ifndef AT91_TWI_H
17#define AT91RM9200_TWI_H 17#define AT91_TWI_H
18 18
19#define AT91_TWI_CR 0x00 /* Control Register */ 19#define AT91_TWI_CR 0x00 /* Control Register */
20#define AT91_TWI_START (1 << 0) /* Send a Start Condition */ 20#define AT91_TWI_START (1 << 0) /* Send a Start Condition */
@@ -43,8 +43,8 @@
43#define AT91_TWI_TXCOMP (1 << 0) /* Transmission Complete */ 43#define AT91_TWI_TXCOMP (1 << 0) /* Transmission Complete */
44#define AT91_TWI_RXRDY (1 << 1) /* Receive Holding Register Ready */ 44#define AT91_TWI_RXRDY (1 << 1) /* Receive Holding Register Ready */
45#define AT91_TWI_TXRDY (1 << 2) /* Transmit Holding Register Ready */ 45#define AT91_TWI_TXRDY (1 << 2) /* Transmit Holding Register Ready */
46#define AT91_TWI_OVRE (1 << 6) /* Overrun Error */ 46#define AT91_TWI_OVRE (1 << 6) /* Overrun Error [AT91RM9200 only] */
47#define AT91_TWI_UNRE (1 << 7) /* Underrun Error */ 47#define AT91_TWI_UNRE (1 << 7) /* Underrun Error [AT91RM9200 only] */
48#define AT91_TWI_NACK (1 << 8) /* Not Acknowledged */ 48#define AT91_TWI_NACK (1 << 8) /* Not Acknowledged */
49 49
50#define AT91_TWI_IER 0x24 /* Interrupt Enable Register */ 50#define AT91_TWI_IER 0x24 /* Interrupt Enable Register */
diff --git a/include/asm-arm/arch-at91rm9200/at91_wdt.h b/include/asm-arm/arch-at91rm9200/at91_wdt.h
new file mode 100644
index 000000000000..ac63e775772c
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91_wdt.h
@@ -0,0 +1,34 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_wdt.h
3 *
4 * Watchdog Timer (WDT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91_WDT_H
14#define AT91_WDT_H
15
16#define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */
17#define AT91_WDT_WDRSTT (1 << 0) /* Restart */
18#define AT91_WDT_KEY (0xff << 24) /* KEY Password */
19
20#define AT91_WDT_MR (AT91_WDT + 0x04) /* Watchdog Mode Register */
21#define AT91_WDT_WDV (0xfff << 0) /* Counter Value */
22#define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */
23#define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */
24#define AT91_WDT_WDRPROC (1 << 14) /* Timer Restart */
25#define AT91_WDT_WDDIS (1 << 15) /* Watchdog Disable */
26#define AT91_WDT_WDD (0xfff << 16) /* Delta Value */
27#define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */
28#define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */
29
30#define AT91_WDT_SR (AT91_WDT + 0x08) /* Watchdog Status Register */
31#define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */
32#define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */
33
34#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200.h b/include/asm-arm/arch-at91rm9200/at91rm9200.h
index a5a86b1ff886..4d51177efddd 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200.h
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200.h
@@ -80,6 +80,22 @@
80 80
81 81
82/* 82/*
83 * System Peripherals (offset from AT91_BASE_SYS)
84 */
85#define AT91_AIC (0xfffff000 - AT91_BASE_SYS) /* Advanced Interrupt Controller */
86#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) /* Debug Unit */
87#define AT91_PIOA (0xfffff400 - AT91_BASE_SYS) /* PIO Controller A */
88#define AT91_PIOB (0xfffff600 - AT91_BASE_SYS) /* PIO Controller B */
89#define AT91_PIOC (0xfffff800 - AT91_BASE_SYS) /* PIO Controller C */
90#define AT91_PIOD (0xfffffa00 - AT91_BASE_SYS) /* PIO Controller D */
91#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) /* Power Management Controller */
92#define AT91_ST (0xfffffd00 - AT91_BASE_SYS) /* System Timer */
93#define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) /* Real-Time Clock */
94#define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */
95
96#define AT91_MATRIX 0 /* not supported */
97
98/*
83 * Internal Memory. 99 * Internal Memory.
84 */ 100 */
85#define AT91RM9200_ROM_BASE 0x00100000 /* Internal ROM base address */ 101#define AT91RM9200_ROM_BASE 0x00100000 /* Internal ROM base address */
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_mc.h b/include/asm-arm/arch-at91rm9200/at91rm9200_mc.h
new file mode 100644
index 000000000000..0c0d81480b3a
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200_mc.h
@@ -0,0 +1,160 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_mc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Memory Controllers (MC, EBI, SMC, SDRAMC, BFC) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_MC_H
17#define AT91RM9200_MC_H
18
19/* Memory Controller */
20#define AT91_MC_RCR (AT91_MC + 0x00) /* MC Remap Control Register */
21#define AT91_MC_RCB (1 << 0) /* Remap Command Bit */
22
23#define AT91_MC_ASR (AT91_MC + 0x04) /* MC Abort Status Register */
24#define AT91_MC_UNADD (1 << 0) /* Undefined Address Abort Status */
25#define AT91_MC_MISADD (1 << 1) /* Misaligned Address Abort Status */
26#define AT91_MC_ABTSZ (3 << 8) /* Abort Size Status */
27#define AT91_MC_ABTSZ_BYTE (0 << 8)
28#define AT91_MC_ABTSZ_HALFWORD (1 << 8)
29#define AT91_MC_ABTSZ_WORD (2 << 8)
30#define AT91_MC_ABTTYP (3 << 10) /* Abort Type Status */
31#define AT91_MC_ABTTYP_DATAREAD (0 << 10)
32#define AT91_MC_ABTTYP_DATAWRITE (1 << 10)
33#define AT91_MC_ABTTYP_FETCH (2 << 10)
34#define AT91_MC_MST0 (1 << 16) /* ARM920T Abort Source */
35#define AT91_MC_MST1 (1 << 17) /* PDC Abort Source */
36#define AT91_MC_MST2 (1 << 18) /* UHP Abort Source */
37#define AT91_MC_MST3 (1 << 19) /* EMAC Abort Source */
38#define AT91_MC_SVMST0 (1 << 24) /* Saved ARM920T Abort Source */
39#define AT91_MC_SVMST1 (1 << 25) /* Saved PDC Abort Source */
40#define AT91_MC_SVMST2 (1 << 26) /* Saved UHP Abort Source */
41#define AT91_MC_SVMST3 (1 << 27) /* Saved EMAC Abort Source */
42
43#define AT91_MC_AASR (AT91_MC + 0x08) /* MC Abort Address Status Register */
44
45#define AT91_MC_MPR (AT91_MC + 0x0c) /* MC Master Priority Register */
46#define AT91_MPR_MSTP0 (7 << 0) /* ARM920T Priority */
47#define AT91_MPR_MSTP1 (7 << 4) /* PDC Priority */
48#define AT91_MPR_MSTP2 (7 << 8) /* UHP Priority */
49#define AT91_MPR_MSTP3 (7 << 12) /* EMAC Priority */
50
51/* External Bus Interface (EBI) registers */
52#define AT91_EBI_CSA (AT91_MC + 0x60) /* Chip Select Assignment Register */
53#define AT91_EBI_CS0A (1 << 0) /* Chip Select 0 Assignment */
54#define AT91_EBI_CS0A_SMC (0 << 0)
55#define AT91_EBI_CS0A_BFC (1 << 0)
56#define AT91_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
57#define AT91_EBI_CS1A_SMC (0 << 1)
58#define AT91_EBI_CS1A_SDRAMC (1 << 1)
59#define AT91_EBI_CS3A (1 << 3) /* Chip Select 2 Assignment */
60#define AT91_EBI_CS3A_SMC (0 << 3)
61#define AT91_EBI_CS3A_SMC_SMARTMEDIA (1 << 3)
62#define AT91_EBI_CS4A (1 << 4) /* Chip Select 3 Assignment */
63#define AT91_EBI_CS4A_SMC (0 << 4)
64#define AT91_EBI_CS4A_SMC_COMPACTFLASH (1 << 4)
65#define AT91_EBI_CFGR (AT91_MC + 0x64) /* Configuration Register */
66#define AT91_EBI_DBPUC (1 << 0) /* Data Bus Pull-Up Configuration */
67
68/* Static Memory Controller (SMC) registers */
69#define AT91_SMC_CSR(n) (AT91_MC + 0x70 + ((n) * 4))/* SMC Chip Select Register */
70#define AT91_SMC_NWS (0x7f << 0) /* Number of Wait States */
71#define AT91_SMC_NWS_(x) ((x) << 0)
72#define AT91_SMC_WSEN (1 << 7) /* Wait State Enable */
73#define AT91_SMC_TDF (0xf << 8) /* Data Float Time */
74#define AT91_SMC_TDF_(x) ((x) << 8)
75#define AT91_SMC_BAT (1 << 12) /* Byte Access Type */
76#define AT91_SMC_DBW (3 << 13) /* Data Bus Width */
77#define AT91_SMC_DBW_16 (1 << 13)
78#define AT91_SMC_DBW_8 (2 << 13)
79#define AT91_SMC_DPR (1 << 15) /* Data Read Protocol */
80#define AT91_SMC_ACSS (3 << 16) /* Address to Chip Select Setup */
81#define AT91_SMC_ACSS_STD (0 << 16)
82#define AT91_SMC_ACSS_1 (1 << 16)
83#define AT91_SMC_ACSS_2 (2 << 16)
84#define AT91_SMC_ACSS_3 (3 << 16)
85#define AT91_SMC_RWSETUP (7 << 24) /* Read & Write Signal Time Setup */
86#define AT91_SMC_RWSETUP_(x) ((x) << 24)
87#define AT91_SMC_RWHOLD (7 << 28) /* Read & Write Signal Hold Time */
88#define AT91_SMC_RWHOLD_(x) ((x) << 28)
89
90/* SDRAM Controller registers */
91#define AT91_SDRAMC_MR (AT91_MC + 0x90) /* Mode Register */
92#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
93#define AT91_SDRAMC_MODE_NORMAL (0 << 0)
94#define AT91_SDRAMC_MODE_NOP (1 << 0)
95#define AT91_SDRAMC_MODE_PRECHARGE (2 << 0)
96#define AT91_SDRAMC_MODE_LMR (3 << 0)
97#define AT91_SDRAMC_MODE_REFRESH (4 << 0)
98#define AT91_SDRAMC_DBW (1 << 4) /* Data Bus Width */
99#define AT91_SDRAMC_DBW_32 (0 << 4)
100#define AT91_SDRAMC_DBW_16 (1 << 4)
101
102#define AT91_SDRAMC_TR (AT91_MC + 0x94) /* Refresh Timer Register */
103#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Count */
104
105#define AT91_SDRAMC_CR (AT91_MC + 0x98) /* Configuration Register */
106#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
107#define AT91_SDRAMC_NC_8 (0 << 0)
108#define AT91_SDRAMC_NC_9 (1 << 0)
109#define AT91_SDRAMC_NC_10 (2 << 0)
110#define AT91_SDRAMC_NC_11 (3 << 0)
111#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
112#define AT91_SDRAMC_NR_11 (0 << 2)
113#define AT91_SDRAMC_NR_12 (1 << 2)
114#define AT91_SDRAMC_NR_13 (2 << 2)
115#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
116#define AT91_SDRAMC_NB_2 (0 << 4)
117#define AT91_SDRAMC_NB_4 (1 << 4)
118#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
119#define AT91_SDRAMC_CAS_2 (2 << 5)
120#define AT91_SDRAMC_TWR (0xf << 7) /* Write Recovery Delay */
121#define AT91_SDRAMC_TRC (0xf << 11) /* Row Cycle Delay */
122#define AT91_SDRAMC_TRP (0xf << 15) /* Row Precharge Delay */
123#define AT91_SDRAMC_TRCD (0xf << 19) /* Row to Column Delay */
124#define AT91_SDRAMC_TRAS (0xf << 23) /* Active to Precharge Delay */
125#define AT91_SDRAMC_TXSR (0xf << 27) /* Exit Self Refresh to Active Delay */
126
127#define AT91_SDRAMC_SRR (AT91_MC + 0x9c) /* Self Refresh Register */
128#define AT91_SDRAMC_LPR (AT91_MC + 0xa0) /* Low Power Register */
129#define AT91_SDRAMC_IER (AT91_MC + 0xa4) /* Interrupt Enable Register */
130#define AT91_SDRAMC_IDR (AT91_MC + 0xa8) /* Interrupt Disable Register */
131#define AT91_SDRAMC_IMR (AT91_MC + 0xac) /* Interrupt Mask Register */
132#define AT91_SDRAMC_ISR (AT91_MC + 0xb0) /* Interrupt Status Register */
133
134/* Burst Flash Controller register */
135#define AT91_BFC_MR (AT91_MC + 0xc0) /* Mode Register */
136#define AT91_BFC_BFCOM (3 << 0) /* Burst Flash Controller Operating Mode */
137#define AT91_BFC_BFCOM_DISABLED (0 << 0)
138#define AT91_BFC_BFCOM_ASYNC (1 << 0)
139#define AT91_BFC_BFCOM_BURST (2 << 0)
140#define AT91_BFC_BFCC (3 << 2) /* Burst Flash Controller Clock */
141#define AT91_BFC_BFCC_MCK (1 << 2)
142#define AT91_BFC_BFCC_DIV2 (2 << 2)
143#define AT91_BFC_BFCC_DIV4 (3 << 2)
144#define AT91_BFC_AVL (0xf << 4) /* Address Valid Latency */
145#define AT91_BFC_PAGES (7 << 8) /* Page Size */
146#define AT91_BFC_PAGES_NO_PAGE (0 << 8)
147#define AT91_BFC_PAGES_16 (1 << 8)
148#define AT91_BFC_PAGES_32 (2 << 8)
149#define AT91_BFC_PAGES_64 (3 << 8)
150#define AT91_BFC_PAGES_128 (4 << 8)
151#define AT91_BFC_PAGES_256 (5 << 8)
152#define AT91_BFC_PAGES_512 (6 << 8)
153#define AT91_BFC_PAGES_1024 (7 << 8)
154#define AT91_BFC_OEL (3 << 12) /* Output Enable Latency */
155#define AT91_BFC_BAAEN (1 << 16) /* Burst Address Advance Enable */
156#define AT91_BFC_BFOEH (1 << 17) /* Burst Flash Output Enable Handling */
157#define AT91_BFC_MUXEN (1 << 18) /* Multiplexed Bus Enable */
158#define AT91_BFC_RDYEN (1 << 19) /* Ready Enable Mode */
159
160#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h b/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
deleted file mode 100644
index 73693fea76a2..000000000000
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
+++ /dev/null
@@ -1,438 +0,0 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_sys.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91RM9200_SYS_H
17#define AT91RM9200_SYS_H
18
19/*
20 * Advanced Interrupt Controller.
21 */
22#define AT91_AIC 0x000
23
24#define AT91_AIC_SMR(n) (AT91_AIC + ((n) * 4)) /* Source Mode Registers 0-31 */
25#define AT91_AIC_PRIOR (7 << 0) /* Priority Level */
26#define AT91_AIC_SRCTYPE (3 << 5) /* Interrupt Source Type */
27#define AT91_AIC_SRCTYPE_LOW (0 << 5)
28#define AT91_AIC_SRCTYPE_FALLING (1 << 5)
29#define AT91_AIC_SRCTYPE_HIGH (2 << 5)
30#define AT91_AIC_SRCTYPE_RISING (3 << 5)
31
32#define AT91_AIC_SVR(n) (AT91_AIC + 0x80 + ((n) * 4)) /* Source Vector Registers 0-31 */
33#define AT91_AIC_IVR (AT91_AIC + 0x100) /* Interrupt Vector Register */
34#define AT91_AIC_FVR (AT91_AIC + 0x104) /* Fast Interrupt Vector Register */
35#define AT91_AIC_ISR (AT91_AIC + 0x108) /* Interrupt Status Register */
36#define AT91_AIC_IRQID (0x1f << 0) /* Current Interrupt Identifier */
37
38#define AT91_AIC_IPR (AT91_AIC + 0x10c) /* Interrupt Pending Register */
39#define AT91_AIC_IMR (AT91_AIC + 0x110) /* Interrupt Mask Register */
40#define AT91_AIC_CISR (AT91_AIC + 0x114) /* Core Interrupt Status Register */
41#define AT91_AIC_NFIQ (1 << 0) /* nFIQ Status */
42#define AT91_AIC_NIRQ (1 << 1) /* nIRQ Status */
43
44#define AT91_AIC_IECR (AT91_AIC + 0x120) /* Interrupt Enable Command Register */
45#define AT91_AIC_IDCR (AT91_AIC + 0x124) /* Interrupt Disable Command Register */
46#define AT91_AIC_ICCR (AT91_AIC + 0x128) /* Interrupt Clear Command Register */
47#define AT91_AIC_ISCR (AT91_AIC + 0x12c) /* Interrupt Set Command Register */
48#define AT91_AIC_EOICR (AT91_AIC + 0x130) /* End of Interrupt Command Register */
49#define AT91_AIC_SPU (AT91_AIC + 0x134) /* Spurious Interrupt Vector Register */
50#define AT91_AIC_DCR (AT91_AIC + 0x138) /* Debug Control Register */
51#define AT91_AIC_DCR_PROT (1 << 0) /* Protection Mode */
52#define AT91_AIC_DCR_GMSK (1 << 1) /* General Mask */
53
54
55/*
56 * Debug Unit.
57 */
58#define AT91_DBGU 0x200
59
60#define AT91_DBGU_CR (AT91_DBGU + 0x00) /* Control Register */
61#define AT91_DBGU_MR (AT91_DBGU + 0x04) /* Mode Register */
62#define AT91_DBGU_IER (AT91_DBGU + 0x08) /* Interrupt Enable Register */
63#define AT91_DBGU_TXRDY (1 << 1) /* Transmitter Ready */
64#define AT91_DBGU_TXEMPTY (1 << 9) /* Transmitter Empty */
65#define AT91_DBGU_IDR (AT91_DBGU + 0x0c) /* Interrupt Disable Register */
66#define AT91_DBGU_IMR (AT91_DBGU + 0x10) /* Interrupt Mask Register */
67#define AT91_DBGU_SR (AT91_DBGU + 0x14) /* Status Register */
68#define AT91_DBGU_RHR (AT91_DBGU + 0x18) /* Receiver Holding Register */
69#define AT91_DBGU_THR (AT91_DBGU + 0x1c) /* Transmitter Holding Register */
70#define AT91_DBGU_BRGR (AT91_DBGU + 0x20) /* Baud Rate Generator Register */
71
72#define AT91_DBGU_CIDR (AT91_DBGU + 0x40) /* Chip ID Register */
73#define AT91_DBGU_EXID (AT91_DBGU + 0x44) /* Chip ID Extension Register */
74#define AT91_CIDR_VERSION (0x1f << 0) /* Version of the Device */
75#define AT91_CIDR_EPROC (7 << 5) /* Embedded Processor */
76#define AT91_CIDR_NVPSIZ (0xf << 8) /* Nonvolatile Program Memory Size */
77#define AT91_CIDR_NVPSIZ2 (0xf << 12) /* Second Nonvolatile Program Memory Size */
78#define AT91_CIDR_SRAMSIZ (0xf << 16) /* Internal SRAM Size */
79#define AT91_CIDR_ARCH (0xff << 20) /* Architecture Identifier */
80#define AT91_CIDR_NVPTYP (7 << 28) /* Nonvolatile Program Memory Type */
81#define AT91_CIDR_EXT (1 << 31) /* Extension Flag */
82
83#define AT91_AIC_FFER (AT91_AIC + 0x140) /* Fast Forcing Enable Register [SAM9 only] */
84#define AT91_AIC_FFDR (AT91_AIC + 0x144) /* Fast Forcing Disable Register [SAM9 only] */
85#define AT91_AIC_FFSR (AT91_AIC + 0x148) /* Fast Forcing Status Register [SAM9 only] */
86
87/*
88 * PIO Controllers.
89 */
90#define AT91_PIOA 0x400
91#define AT91_PIOB 0x600
92#define AT91_PIOC 0x800
93#define AT91_PIOD 0xa00
94
95#define PIO_PER 0x00 /* Enable Register */
96#define PIO_PDR 0x04 /* Disable Register */
97#define PIO_PSR 0x08 /* Status Register */
98#define PIO_OER 0x10 /* Output Enable Register */
99#define PIO_ODR 0x14 /* Output Disable Register */
100#define PIO_OSR 0x18 /* Output Status Register */
101#define PIO_IFER 0x20 /* Glitch Input Filter Enable */
102#define PIO_IFDR 0x24 /* Glitch Input Filter Disable */
103#define PIO_IFSR 0x28 /* Glitch Input Filter Status */
104#define PIO_SODR 0x30 /* Set Output Data Register */
105#define PIO_CODR 0x34 /* Clear Output Data Register */
106#define PIO_ODSR 0x38 /* Output Data Status Register */
107#define PIO_PDSR 0x3c /* Pin Data Status Register */
108#define PIO_IER 0x40 /* Interrupt Enable Register */
109#define PIO_IDR 0x44 /* Interrupt Disable Register */
110#define PIO_IMR 0x48 /* Interrupt Mask Register */
111#define PIO_ISR 0x4c /* Interrupt Status Register */
112#define PIO_MDER 0x50 /* Multi-driver Enable Register */
113#define PIO_MDDR 0x54 /* Multi-driver Disable Register */
114#define PIO_MDSR 0x58 /* Multi-driver Status Register */
115#define PIO_PUDR 0x60 /* Pull-up Disable Register */
116#define PIO_PUER 0x64 /* Pull-up Enable Register */
117#define PIO_PUSR 0x68 /* Pull-up Status Register */
118#define PIO_ASR 0x70 /* Peripheral A Select Register */
119#define PIO_BSR 0x74 /* Peripheral B Select Register */
120#define PIO_ABSR 0x78 /* AB Status Register */
121#define PIO_OWER 0xa0 /* Output Write Enable Register */
122#define PIO_OWDR 0xa4 /* Output Write Disable Register */
123#define PIO_OWSR 0xa8 /* Output Write Status Register */
124
125#define AT91_PIO_P(n) (1 << (n))
126
127
128/*
129 * Power Management Controller.
130 */
131#define AT91_PMC 0xc00
132
133#define AT91_PMC_SCER (AT91_PMC + 0x00) /* System Clock Enable Register */
134#define AT91_PMC_SCDR (AT91_PMC + 0x04) /* System Clock Disable Register */
135
136#define AT91_PMC_SCSR (AT91_PMC + 0x08) /* System Clock Status Register */
137#define AT91_PMC_PCK (1 << 0) /* Processor Clock */
138#define AT91_PMC_UDP (1 << 1) /* USB Devcice Port Clock */
139#define AT91_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend */
140#define AT91_PMC_UHP (1 << 4) /* USB Host Port Clock */
141#define AT91_PMC_PCK0 (1 << 8) /* Programmable Clock 0 */
142#define AT91_PMC_PCK1 (1 << 9) /* Programmable Clock 1 */
143#define AT91_PMC_PCK2 (1 << 10) /* Programmable Clock 2 */
144#define AT91_PMC_PCK3 (1 << 11) /* Programmable Clock 3 */
145
146#define AT91_PMC_PCER (AT91_PMC + 0x10) /* Peripheral Clock Enable Register */
147#define AT91_PMC_PCDR (AT91_PMC + 0x14) /* Peripheral Clock Disable Register */
148#define AT91_PMC_PCSR (AT91_PMC + 0x18) /* Peripheral Clock Status Register */
149
150#define AT91_CKGR_MOR (AT91_PMC + 0x20) /* Main Oscillator Register */
151#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
152#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */
153
154#define AT91_CKGR_MCFR (AT91_PMC + 0x24) /* Main Clock Frequency Register */
155#define AT91_PMC_MAINF (0xffff << 0) /* Main Clock Frequency */
156#define AT91_PMC_MAINRDY (1 << 16) /* Main Clock Ready */
157
158#define AT91_CKGR_PLLAR (AT91_PMC + 0x28) /* PLL A Register */
159#define AT91_CKGR_PLLBR (AT91_PMC + 0x2c) /* PLL B Register */
160#define AT91_PMC_DIV (0xff << 0) /* Divider */
161#define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */
162#define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */
163#define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */
164#define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */
165
166#define AT91_PMC_MCKR (AT91_PMC + 0x30) /* Master Clock Register */
167#define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */
168#define AT91_PMC_CSS_SLOW (0 << 0)
169#define AT91_PMC_CSS_MAIN (1 << 0)
170#define AT91_PMC_CSS_PLLA (2 << 0)
171#define AT91_PMC_CSS_PLLB (3 << 0)
172#define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */
173#define AT91_PMC_PRES_1 (0 << 2)
174#define AT91_PMC_PRES_2 (1 << 2)
175#define AT91_PMC_PRES_4 (2 << 2)
176#define AT91_PMC_PRES_8 (3 << 2)
177#define AT91_PMC_PRES_16 (4 << 2)
178#define AT91_PMC_PRES_32 (5 << 2)
179#define AT91_PMC_PRES_64 (6 << 2)
180#define AT91_PMC_MDIV (3 << 8) /* Master Clock Division */
181#define AT91_PMC_MDIV_1 (0 << 8)
182#define AT91_PMC_MDIV_2 (1 << 8)
183#define AT91_PMC_MDIV_3 (2 << 8)
184#define AT91_PMC_MDIV_4 (3 << 8)
185
186#define AT91_PMC_PCKR(n) (AT91_PMC + 0x40 + ((n) * 4)) /* Programmable Clock 0-3 Registers */
187
188#define AT91_PMC_IER (AT91_PMC + 0x60) /* Interrupt Enable Register */
189#define AT91_PMC_IDR (AT91_PMC + 0x64) /* Interrupt Disable Register */
190#define AT91_PMC_SR (AT91_PMC + 0x68) /* Status Register */
191#define AT91_PMC_MOSCS (1 << 0) /* MOSCS Flag */
192#define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */
193#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
194#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
195#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
196#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
197#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
198#define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */
199#define AT91_PMC_IMR (AT91_PMC + 0x6c) /* Interrupt Mask Register */
200
201
202/*
203 * System Timer.
204 */
205#define AT91_ST 0xd00
206
207#define AT91_ST_CR (AT91_ST + 0x00) /* Control Register */
208#define AT91_ST_WDRST (1 << 0) /* Watchdog Timer Restart */
209#define AT91_ST_PIMR (AT91_ST + 0x04) /* Period Interval Mode Register */
210#define AT91_ST_PIV (0xffff << 0) /* Period Interval Value */
211#define AT91_ST_WDMR (AT91_ST + 0x08) /* Watchdog Mode Register */
212#define AT91_ST_WDV (0xffff << 0) /* Watchdog Counter Value */
213#define AT91_ST_RSTEN (1 << 16) /* Reset Enable */
214#define AT91_ST_EXTEN (1 << 17) /* External Signal Assertion Enable */
215#define AT91_ST_RTMR (AT91_ST + 0x0c) /* Real-time Mode Register */
216#define AT91_ST_RTPRES (0xffff << 0) /* Real-time Prescalar Value */
217#define AT91_ST_SR (AT91_ST + 0x10) /* Status Register */
218#define AT91_ST_PITS (1 << 0) /* Period Interval Timer Status */
219#define AT91_ST_WDOVF (1 << 1) /* Watchdog Overflow */
220#define AT91_ST_RTTINC (1 << 2) /* Real-time Timer Increment */
221#define AT91_ST_ALMS (1 << 3) /* Alarm Status */
222#define AT91_ST_IER (AT91_ST + 0x14) /* Interrupt Enable Register */
223#define AT91_ST_IDR (AT91_ST + 0x18) /* Interrupt Disable Register */
224#define AT91_ST_IMR (AT91_ST + 0x1c) /* Interrupt Mask Register */
225#define AT91_ST_RTAR (AT91_ST + 0x20) /* Real-time Alarm Register */
226#define AT91_ST_ALMV (0xfffff << 0) /* Alarm Value */
227#define AT91_ST_CRTR (AT91_ST + 0x24) /* Current Real-time Register */
228#define AT91_ST_CRTV (0xfffff << 0) /* Current Real-Time Value */
229
230
231/*
232 * Real-time Clock.
233 */
234#define AT91_RTC 0xe00
235
236#define AT91_RTC_CR (AT91_RTC + 0x00) /* Control Register */
237#define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */
238#define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */
239#define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */
240#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8)
241#define AT91_RTC_TIMEVSEL_HOUR (1 << 8)
242#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8)
243#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8)
244#define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */
245#define AT91_RTC_CALEVSEL_WEEK (0 << 16)
246#define AT91_RTC_CALEVSEL_MONTH (1 << 16)
247#define AT91_RTC_CALEVSEL_YEAR (2 << 16)
248
249#define AT91_RTC_MR (AT91_RTC + 0x04) /* Mode Register */
250#define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */
251
252#define AT91_RTC_TIMR (AT91_RTC + 0x08) /* Time Register */
253#define AT91_RTC_SEC (0x7f << 0) /* Current Second */
254#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */
255#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */
256#define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */
257
258#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */
259#define AT91_RTC_CENT (0x7f << 0) /* Current Century */
260#define AT91_RTC_YEAR (0xff << 8) /* Current Year */
261#define AT91_RTC_MONTH (0x1f << 16) /* Current Month */
262#define AT91_RTC_DAY (7 << 21) /* Current Day */
263#define AT91_RTC_DATE (0x3f << 24) /* Current Date */
264
265#define AT91_RTC_TIMALR (AT91_RTC + 0x10) /* Time Alarm Register */
266#define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */
267#define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */
268#define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */
269
270#define AT91_RTC_CALALR (AT91_RTC + 0x14) /* Calendar Alarm Register */
271#define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */
272#define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */
273
274#define AT91_RTC_SR (AT91_RTC + 0x18) /* Status Register */
275#define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */
276#define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */
277#define AT91_RTC_SECEV (1 << 2) /* Second Event */
278#define AT91_RTC_TIMEV (1 << 3) /* Time Event */
279#define AT91_RTC_CALEV (1 << 4) /* Calendar Event */
280
281#define AT91_RTC_SCCR (AT91_RTC + 0x1c) /* Status Clear Command Register */
282#define AT91_RTC_IER (AT91_RTC + 0x20) /* Interrupt Enable Register */
283#define AT91_RTC_IDR (AT91_RTC + 0x24) /* Interrupt Disable Register */
284#define AT91_RTC_IMR (AT91_RTC + 0x28) /* Interrupt Mask Register */
285
286#define AT91_RTC_VER (AT91_RTC + 0x2c) /* Valid Entry Register */
287#define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
288#define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */
289#define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */
290#define AT91_RTC_NVCALALR (1 << 3) /* Non valid Calendar Alarm */
291
292
293/*
294 * Memory Controller.
295 */
296#define AT91_MC 0xf00
297
298#define AT91_MC_RCR (AT91_MC + 0x00) /* MC Remap Control Register */
299#define AT91_MC_RCB (1 << 0) /* Remap Command Bit */
300
301#define AT91_MC_ASR (AT91_MC + 0x04) /* MC Abort Status Register */
302#define AT91_MC_UNADD (1 << 0) /* Undefined Address Abort Status */
303#define AT91_MC_MISADD (1 << 1) /* Misaligned Address Abort Status */
304#define AT91_MC_ABTSZ (3 << 8) /* Abort Size Status */
305#define AT91_MC_ABTSZ_BYTE (0 << 8)
306#define AT91_MC_ABTSZ_HALFWORD (1 << 8)
307#define AT91_MC_ABTSZ_WORD (2 << 8)
308#define AT91_MC_ABTTYP (3 << 10) /* Abort Type Status */
309#define AT91_MC_ABTTYP_DATAREAD (0 << 10)
310#define AT91_MC_ABTTYP_DATAWRITE (1 << 10)
311#define AT91_MC_ABTTYP_FETCH (2 << 10)
312#define AT91_MC_MST0 (1 << 16) /* ARM920T Abort Source */
313#define AT91_MC_MST1 (1 << 17) /* PDC Abort Source */
314#define AT91_MC_MST2 (1 << 18) /* UHP Abort Source */
315#define AT91_MC_MST3 (1 << 19) /* EMAC Abort Source */
316#define AT91_MC_SVMST0 (1 << 24) /* Saved ARM920T Abort Source */
317#define AT91_MC_SVMST1 (1 << 25) /* Saved PDC Abort Source */
318#define AT91_MC_SVMST2 (1 << 26) /* Saved UHP Abort Source */
319#define AT91_MC_SVMST3 (1 << 27) /* Saved EMAC Abort Source */
320
321#define AT91_MC_AASR (AT91_MC + 0x08) /* MC Abort Address Status Register */
322
323#define AT91_MC_MPR (AT91_MC + 0x0c) /* MC Master Priority Register */
324#define AT91_MPR_MSTP0 (7 << 0) /* ARM920T Priority */
325#define AT91_MPR_MSTP1 (7 << 4) /* PDC Priority */
326#define AT91_MPR_MSTP2 (7 << 8) /* UHP Priority */
327#define AT91_MPR_MSTP3 (7 << 12) /* EMAC Priority */
328
329/* External Bus Interface (EBI) registers */
330#define AT91_EBI_CSA (AT91_MC + 0x60) /* Chip Select Assignment Register */
331#define AT91_EBI_CS0A (1 << 0) /* Chip Select 0 Assignment */
332#define AT91_EBI_CS0A_SMC (0 << 0)
333#define AT91_EBI_CS0A_BFC (1 << 0)
334#define AT91_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
335#define AT91_EBI_CS1A_SMC (0 << 1)
336#define AT91_EBI_CS1A_SDRAMC (1 << 1)
337#define AT91_EBI_CS3A (1 << 3) /* Chip Select 2 Assignment */
338#define AT91_EBI_CS3A_SMC (0 << 3)
339#define AT91_EBI_CS3A_SMC_SMARTMEDIA (1 << 3)
340#define AT91_EBI_CS4A (1 << 4) /* Chip Select 3 Assignment */
341#define AT91_EBI_CS4A_SMC (0 << 4)
342#define AT91_EBI_CS4A_SMC_COMPACTFLASH (1 << 4)
343#define AT91_EBI_CFGR (AT91_MC + 0x64) /* Configuration Register */
344#define AT91_EBI_DBPUC (1 << 0) /* Data Bus Pull-Up Configuration */
345
346/* Static Memory Controller (SMC) registers */
347#define AT91_SMC_CSR(n) (AT91_MC + 0x70 + ((n) * 4))/* SMC Chip Select Register */
348#define AT91_SMC_NWS (0x7f << 0) /* Number of Wait States */
349#define AT91_SMC_NWS_(x) ((x) << 0)
350#define AT91_SMC_WSEN (1 << 7) /* Wait State Enable */
351#define AT91_SMC_TDF (0xf << 8) /* Data Float Time */
352#define AT91_SMC_TDF_(x) ((x) << 8)
353#define AT91_SMC_BAT (1 << 12) /* Byte Access Type */
354#define AT91_SMC_DBW (3 << 13) /* Data Bus Width */
355#define AT91_SMC_DBW_16 (1 << 13)
356#define AT91_SMC_DBW_8 (2 << 13)
357#define AT91_SMC_DPR (1 << 15) /* Data Read Protocol */
358#define AT91_SMC_ACSS (3 << 16) /* Address to Chip Select Setup */
359#define AT91_SMC_ACSS_STD (0 << 16)
360#define AT91_SMC_ACSS_1 (1 << 16)
361#define AT91_SMC_ACSS_2 (2 << 16)
362#define AT91_SMC_ACSS_3 (3 << 16)
363#define AT91_SMC_RWSETUP (7 << 24) /* Read & Write Signal Time Setup */
364#define AT91_SMC_RWSETUP_(x) ((x) << 24)
365#define AT91_SMC_RWHOLD (7 << 28) /* Read & Write Signal Hold Time */
366#define AT91_SMC_RWHOLD_(x) ((x) << 28)
367
368/* SDRAM Controller registers */
369#define AT91_SDRAMC_MR (AT91_MC + 0x90) /* Mode Register */
370#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
371#define AT91_SDRAMC_MODE_NORMAL (0 << 0)
372#define AT91_SDRAMC_MODE_NOP (1 << 0)
373#define AT91_SDRAMC_MODE_PRECHARGE (2 << 0)
374#define AT91_SDRAMC_MODE_LMR (3 << 0)
375#define AT91_SDRAMC_MODE_REFRESH (4 << 0)
376#define AT91_SDRAMC_DBW (1 << 4) /* Data Bus Width */
377#define AT91_SDRAMC_DBW_32 (0 << 4)
378#define AT91_SDRAMC_DBW_16 (1 << 4)
379
380#define AT91_SDRAMC_TR (AT91_MC + 0x94) /* Refresh Timer Register */
381#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Count */
382
383#define AT91_SDRAMC_CR (AT91_MC + 0x98) /* Configuration Register */
384#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
385#define AT91_SDRAMC_NC_8 (0 << 0)
386#define AT91_SDRAMC_NC_9 (1 << 0)
387#define AT91_SDRAMC_NC_10 (2 << 0)
388#define AT91_SDRAMC_NC_11 (3 << 0)
389#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
390#define AT91_SDRAMC_NR_11 (0 << 2)
391#define AT91_SDRAMC_NR_12 (1 << 2)
392#define AT91_SDRAMC_NR_13 (2 << 2)
393#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
394#define AT91_SDRAMC_NB_2 (0 << 4)
395#define AT91_SDRAMC_NB_4 (1 << 4)
396#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
397#define AT91_SDRAMC_CAS_2 (2 << 5)
398#define AT91_SDRAMC_TWR (0xf << 7) /* Write Recovery Delay */
399#define AT91_SDRAMC_TRC (0xf << 11) /* Row Cycle Delay */
400#define AT91_SDRAMC_TRP (0xf << 15) /* Row Precharge Delay */
401#define AT91_SDRAMC_TRCD (0xf << 19) /* Row to Column Delay */
402#define AT91_SDRAMC_TRAS (0xf << 23) /* Active to Precharge Delay */
403#define AT91_SDRAMC_TXSR (0xf << 27) /* Exit Self Refresh to Active Delay */
404
405#define AT91_SDRAMC_SRR (AT91_MC + 0x9c) /* Self Refresh Register */
406#define AT91_SDRAMC_LPR (AT91_MC + 0xa0) /* Low Power Register */
407#define AT91_SDRAMC_IER (AT91_MC + 0xa4) /* Interrupt Enable Register */
408#define AT91_SDRAMC_IDR (AT91_MC + 0xa8) /* Interrupt Disable Register */
409#define AT91_SDRAMC_IMR (AT91_MC + 0xac) /* Interrupt Mask Register */
410#define AT91_SDRAMC_ISR (AT91_MC + 0xb0) /* Interrupt Status Register */
411
412/* Burst Flash Controller register */
413#define AT91_BFC_MR (AT91_MC + 0xc0) /* Mode Register */
414#define AT91_BFC_BFCOM (3 << 0) /* Burst Flash Controller Operating Mode */
415#define AT91_BFC_BFCOM_DISABLED (0 << 0)
416#define AT91_BFC_BFCOM_ASYNC (1 << 0)
417#define AT91_BFC_BFCOM_BURST (2 << 0)
418#define AT91_BFC_BFCC (3 << 2) /* Burst Flash Controller Clock */
419#define AT91_BFC_BFCC_MCK (1 << 2)
420#define AT91_BFC_BFCC_DIV2 (2 << 2)
421#define AT91_BFC_BFCC_DIV4 (3 << 2)
422#define AT91_BFC_AVL (0xf << 4) /* Address Valid Latency */
423#define AT91_BFC_PAGES (7 << 8) /* Page Size */
424#define AT91_BFC_PAGES_NO_PAGE (0 << 8)
425#define AT91_BFC_PAGES_16 (1 << 8)
426#define AT91_BFC_PAGES_32 (2 << 8)
427#define AT91_BFC_PAGES_64 (3 << 8)
428#define AT91_BFC_PAGES_128 (4 << 8)
429#define AT91_BFC_PAGES_256 (5 << 8)
430#define AT91_BFC_PAGES_512 (6 << 8)
431#define AT91_BFC_PAGES_1024 (7 << 8)
432#define AT91_BFC_OEL (3 << 12) /* Output Enable Latency */
433#define AT91_BFC_BAAEN (1 << 16) /* Burst Address Advance Enable */
434#define AT91_BFC_BFOEH (1 << 17) /* Burst Flash Output Enable Handling */
435#define AT91_BFC_MUXEN (1 << 18) /* Multiplexed Bus Enable */
436#define AT91_BFC_RDYEN (1 << 19) /* Ready Enable Mode */
437
438#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_udp.h b/include/asm-arm/arch-at91rm9200/at91rm9200_udp.h
deleted file mode 100644
index 951e3f61cef4..000000000000
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_udp.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_udp.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * USB Device Port (UDP) 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_UDP_H
17#define AT91RM9200_UDP_H
18
19#define AT91_UDP_FRM_NUM 0x00 /* Frame Number Register */
20#define AT91_UDP_NUM (0x7ff << 0) /* Frame Number */
21#define AT91_UDP_FRM_ERR (1 << 16) /* Frame Error */
22#define AT91_UDP_FRM_OK (1 << 17) /* Frame OK */
23
24#define AT91_UDP_GLB_STAT 0x04 /* Global State Register */
25#define AT91_UDP_FADDEN (1 << 0) /* Function Address Enable */
26#define AT91_UDP_CONFG (1 << 1) /* Configured */
27#define AT91_UDP_ESR (1 << 2) /* Enable Send Resume */
28#define AT91_UDP_RSMINPR (1 << 3) /* Resume has been sent */
29#define AT91_UDP_RMWUPE (1 << 4) /* Remote Wake Up Enable */
30
31#define AT91_UDP_FADDR 0x08 /* Function Address Register */
32#define AT91_UDP_FADD (0x7f << 0) /* Function Address Value */
33#define AT91_UDP_FEN (1 << 8) /* Function Enable */
34
35#define AT91_UDP_IER 0x10 /* Interrupt Enable Register */
36#define AT91_UDP_IDR 0x14 /* Interrupt Disable Register */
37#define AT91_UDP_IMR 0x18 /* Interrupt Mask Register */
38
39#define AT91_UDP_ISR 0x1c /* Interrupt Status Register */
40#define AT91_UDP_EP(n) (1 << (n)) /* Endpoint Interrupt Status */
41#define AT91_UDP_RXSUSP (1 << 8) /* USB Suspend Interrupt Status */
42#define AT91_UDP_RXRSM (1 << 9) /* USB Resume Interrupt Status */
43#define AT91_UDP_EXTRSM (1 << 10) /* External Resume Interrupt Status */
44#define AT91_UDP_SOFINT (1 << 11) /* Start of Frame Interrupt Status */
45#define AT91_UDP_ENDBUSRES (1 << 12) /* End of Bus Reset Interrpt Status */
46#define AT91_UDP_WAKEUP (1 << 13) /* USB Wakeup Interrupt Status */
47
48#define AT91_UDP_ICR 0x20 /* Interrupt Clear Register */
49#define AT91_UDP_RST_EP 0x28 /* Reset Endpoint Register */
50
51#define AT91_UDP_CSR(n) (0x30 + ((n) * 4)) /* Endpoint Control/Status Registers 0-7 */
52#define AT91_UDP_TXCOMP (1 << 0) /* Generates IN packet with data previously written in DPR */
53#define AT91_UDP_RX_DATA_BK0 (1 << 1) /* Receive Data Bank 0 */
54#define AT91_UDP_RXSETUP (1 << 2) /* Send STALL to the host */
55#define AT91_UDP_STALLSENT (1 << 3) /* Stall Sent / Isochronous error (Isochronous endpoints) */
56#define AT91_UDP_TXPKTRDY (1 << 4) /* Transmit Packet Ready */
57#define AT91_UDP_FORCESTALL (1 << 5) /* Force Stall */
58#define AT91_UDP_RX_DATA_BK1 (1 << 6) /* Receive Data Bank 1 */
59#define AT91_UDP_DIR (1 << 7) /* Transfer Direction */
60#define AT91_UDP_EPTYPE (7 << 8) /* Endpoint Type */
61#define AT91_UDP_EPTYPE_CTRL (0 << 8)
62#define AT91_UDP_EPTYPE_ISO_OUT (1 << 8)
63#define AT91_UDP_EPTYPE_BULK_OUT (2 << 8)
64#define AT91_UDP_EPTYPE_INT_OUT (3 << 8)
65#define AT91_UDP_EPTYPE_ISO_IN (5 << 8)
66#define AT91_UDP_EPTYPE_BULK_IN (6 << 8)
67#define AT91_UDP_EPTYPE_INT_IN (7 << 8)
68#define AT91_UDP_DTGLE (1 << 11) /* Data Toggle */
69#define AT91_UDP_EPEDS (1 << 15) /* Endpoint Enable/Disable */
70#define AT91_UDP_RXBYTECNT (0x7ff << 16) /* Number of bytes in FIFO */
71
72#define AT91_UDP_FDR(n) (0x50 + ((n) * 4)) /* Endpoint FIFO Data Registers 0-7 */
73
74#define AT91_UDP_TXVC 0x74 /* Transceiver Control Register */
75#define AT91_UDP_TXVC_TXVDIS (1 << 8) /* Transceiver Disable */
76
77#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91sam9260.h b/include/asm-arm/arch-at91rm9200/at91sam9260.h
new file mode 100644
index 000000000000..46f4dd65c035
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91sam9260.h
@@ -0,0 +1,125 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91sam9260.h
3 *
4 * (C) 2006 Andrew Victor
5 *
6 * Common definitions.
7 * Based on AT91SAM9260 datasheet revision A (Preliminary).
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef AT91SAM9260_H
16#define AT91SAM9260_H
17
18/*
19 * Peripheral identifiers/interrupts.
20 */
21#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
22#define AT91_ID_SYS 1 /* System Peripherals */
23#define AT91SAM9260_ID_PIOA 2 /* Parallel IO Controller A */
24#define AT91SAM9260_ID_PIOB 3 /* Parallel IO Controller B */
25#define AT91SAM9260_ID_PIOC 4 /* Parallel IO Controller C */
26#define AT91SAM9260_ID_ADC 5 /* Analog-to-Digital Converter */
27#define AT91SAM9260_ID_US0 6 /* USART 0 */
28#define AT91SAM9260_ID_US1 7 /* USART 1 */
29#define AT91SAM9260_ID_US2 8 /* USART 2 */
30#define AT91SAM9260_ID_MCI 9 /* Multimedia Card Interface */
31#define AT91SAM9260_ID_UDP 10 /* USB Device Port */
32#define AT91SAM9260_ID_TWI 11 /* Two-Wire Interface */
33#define AT91SAM9260_ID_SPI0 12 /* Serial Peripheral Interface 0 */
34#define AT91SAM9260_ID_SPI1 13 /* Serial Peripheral Interface 1 */
35#define AT91SAM9260_ID_SSC 14 /* Serial Synchronous Controller */
36#define AT91SAM9260_ID_TC0 17 /* Timer Counter 0 */
37#define AT91SAM9260_ID_TC1 18 /* Timer Counter 1 */
38#define AT91SAM9260_ID_TC2 19 /* Timer Counter 2 */
39#define AT91SAM9260_ID_UHP 20 /* USB Host port */
40#define AT91SAM9260_ID_EMAC 21 /* Ethernet */
41#define AT91SAM9260_ID_ISI 22 /* Image Sensor Interface */
42#define AT91SAM9260_ID_US3 23 /* USART 3 */
43#define AT91SAM9260_ID_US4 24 /* USART 4 */
44#define AT91SAM9260_ID_US5 25 /* USART 5 */
45#define AT91SAM9260_ID_TC3 26 /* Timer Counter 3 */
46#define AT91SAM9260_ID_TC4 27 /* Timer Counter 4 */
47#define AT91SAM9260_ID_TC5 28 /* Timer Counter 5 */
48#define AT91SAM9260_ID_IRQ0 29 /* Advanced Interrupt Controller (IRQ0) */
49#define AT91SAM9260_ID_IRQ1 30 /* Advanced Interrupt Controller (IRQ1) */
50#define AT91SAM9260_ID_IRQ2 31 /* Advanced Interrupt Controller (IRQ2) */
51
52
53/*
54 * User Peripheral physical base addresses.
55 */
56#define AT91SAM9260_BASE_TCB0 0xfffa0000
57#define AT91SAM9260_BASE_TC0 0xfffa0000
58#define AT91SAM9260_BASE_TC1 0xfffa0040
59#define AT91SAM9260_BASE_TC2 0xfffa0080
60#define AT91SAM9260_BASE_UDP 0xfffa4000
61#define AT91SAM9260_BASE_MCI 0xfffa8000
62#define AT91SAM9260_BASE_TWI 0xfffac000
63#define AT91SAM9260_BASE_US0 0xfffb0000
64#define AT91SAM9260_BASE_US1 0xfffb4000
65#define AT91SAM9260_BASE_US2 0xfffb8000
66#define AT91SAM9260_BASE_SSC 0xfffbc000
67#define AT91SAM9260_BASE_ISI 0xfffc0000
68#define AT91SAM9260_BASE_EMAC 0xfffc4000
69#define AT91SAM9260_BASE_SPI0 0xfffc8000
70#define AT91SAM9260_BASE_SPI1 0xfffcc000
71#define AT91SAM9260_BASE_US3 0xfffd0000
72#define AT91SAM9260_BASE_US4 0xfffd4000
73#define AT91SAM9260_BASE_US5 0xfffd8000
74#define AT91SAM9260_BASE_TCB1 0xfffdc000
75#define AT91SAM9260_BASE_TC3 0xfffdc000
76#define AT91SAM9260_BASE_TC4 0xfffdc040
77#define AT91SAM9260_BASE_TC5 0xfffdc080
78#define AT91SAM9260_BASE_ADC 0xfffe0000
79#define AT91_BASE_SYS 0xffffe800
80
81/*
82 * System Peripherals (offset from AT91_BASE_SYS)
83 */
84#define AT91_ECC (0xffffe800 - AT91_BASE_SYS)
85#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS)
86#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
87#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
88#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS)
89#define AT91_AIC (0xfffff000 - AT91_BASE_SYS)
90#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS)
91#define AT91_PIOA (0xfffff400 - AT91_BASE_SYS)
92#define AT91_PIOB (0xfffff600 - AT91_BASE_SYS)
93#define AT91_PIOC (0xfffff800 - AT91_BASE_SYS)
94#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
95#define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS)
96#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS)
97#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS)
98#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS)
99#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
100#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS)
101
102
103/*
104 * Internal Memory.
105 */
106#define AT91SAM9260_ROM_BASE 0x00100000 /* Internal ROM base address */
107#define AT91SAM9260_ROM_SIZE SZ_32K /* Internal ROM size (32Kb) */
108
109#define AT91SAM9260_SRAM0_BASE 0x00200000 /* Internal SRAM 0 base address */
110#define AT91SAM9260_SRAM0_SIZE SZ_4K /* Internal SRAM 0 size (4Kb) */
111#define AT91SAM9260_SRAM1_BASE 0x00300000 /* Internal SRAM 1 base address */
112#define AT91SAM9260_SRAM1_SIZE SZ_4K /* Internal SRAM 1 size (4Kb) */
113
114#define AT91SAM9260_UHP_BASE 0x00500000 /* USB Host controller */
115
116#if 0
117/*
118 * PIO pin definitions (peripheral A/B multiplexing).
119 */
120
121// TODO: Add
122
123#endif
124
125#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h b/include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h
new file mode 100644
index 000000000000..746d973705bf
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h
@@ -0,0 +1,78 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h
3 *
4 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
5 * Based on AT91SAM9260 datasheet revision B.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91SAM9260_MATRIX_H
14#define AT91SAM9260_MATRIX_H
15
16#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */
17#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */
18#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */
19#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */
20#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */
21#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x04) /* Master Configuration Register 5 */
22#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
23#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
24#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
25#define AT91_MATRIX_ULBT_FOUR (2 << 0)
26#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
27#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
28
29#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */
30#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */
31#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */
32#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */
33#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */
34#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
35#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
36#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
37#define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16)
38#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
39#define AT91_MATRIX_FIXED_DEFMSTR (7 << 18) /* Fixed Index of Default Master */
40#define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */
41#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
42#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
43
44#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */
45#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */
46#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */
47#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */
48#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */
49#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
50#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
51#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
52#define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */
53#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */
54#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */
55
56#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */
57#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
58#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
59
60#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x11C) /* EBI Chip Select Assignment Register */
61#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
62#define AT91_MATRIX_CS1A_SMC (0 << 1)
63#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
64#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */
65#define AT91_MATRIX_CS3A_SMC (0 << 3)
66#define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3)
67#define AT91_MATRIX_CS4A (1 << 4) /* Chip Select 4 Assignment */
68#define AT91_MATRIX_CS4A_SMC (0 << 4)
69#define AT91_MATRIX_CS4A_SMC_CF1 (1 << 4)
70#define AT91_MATRIX_CS5A (1 << 5 ) /* Chip Select 5 Assignment */
71#define AT91_MATRIX_CS5A_SMC (0 << 5)
72#define AT91_MATRIX_CS5A_SMC_CF2 (1 << 5)
73#define AT91_MATRIX_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
74#define AT91_MATRIX_VDDIOMSEL (1 << 16) /* Memory voltage selection */
75#define AT91_MATRIX_VDDIOMSEL_1_8V (0 << 16)
76#define AT91_MATRIX_VDDIOMSEL_3_3V (1 << 16)
77
78#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91sam9261.h b/include/asm-arm/arch-at91rm9200/at91sam9261.h
new file mode 100644
index 000000000000..8d39672d5b82
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91sam9261.h
@@ -0,0 +1,292 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91sam9261.h
3 *
4 * Copyright (C) SAN People
5 *
6 * Common definitions.
7 * Based on AT91SAM9261 datasheet revision E. (Preliminary)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef AT91SAM9261_H
16#define AT91SAM9261_H
17
18/*
19 * Peripheral identifiers/interrupts.
20 */
21#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
22#define AT91_ID_SYS 1 /* System Peripherals */
23#define AT91SAM9261_ID_PIOA 2 /* Parallel IO Controller A */
24#define AT91SAM9261_ID_PIOB 3 /* Parallel IO Controller B */
25#define AT91SAM9261_ID_PIOC 4 /* Parallel IO Controller C */
26#define AT91SAM9261_ID_US0 6 /* USART 0 */
27#define AT91SAM9261_ID_US1 7 /* USART 1 */
28#define AT91SAM9261_ID_US2 8 /* USART 2 */
29#define AT91SAM9261_ID_MCI 9 /* Multimedia Card Interface */
30#define AT91SAM9261_ID_UDP 10 /* USB Device Port */
31#define AT91SAM9261_ID_TWI 11 /* Two-Wire Interface */
32#define AT91SAM9261_ID_SPI0 12 /* Serial Peripheral Interface 0 */
33#define AT91SAM9261_ID_SPI1 13 /* Serial Peripheral Interface 1 */
34#define AT91SAM9261_ID_SSC0 14 /* Serial Synchronous Controller 0 */
35#define AT91SAM9261_ID_SSC1 15 /* Serial Synchronous Controller 1 */
36#define AT91SAM9261_ID_SSC2 16 /* Serial Synchronous Controller 2 */
37#define AT91SAM9261_ID_TC0 17 /* Timer Counter 0 */
38#define AT91SAM9261_ID_TC1 18 /* Timer Counter 1 */
39#define AT91SAM9261_ID_TC2 19 /* Timer Counter 2 */
40#define AT91SAM9261_ID_UHP 20 /* USB Host port */
41#define AT91SAM9261_ID_LCDC 21 /* LDC Controller */
42#define AT91SAM9261_ID_IRQ0 29 /* Advanced Interrupt Controller (IRQ0) */
43#define AT91SAM9261_ID_IRQ1 30 /* Advanced Interrupt Controller (IRQ1) */
44#define AT91SAM9261_ID_IRQ2 31 /* Advanced Interrupt Controller (IRQ2) */
45
46
47/*
48 * User Peripheral physical base addresses.
49 */
50#define AT91SAM9261_BASE_TCB0 0xfffa0000
51#define AT91SAM9261_BASE_TC0 0xfffa0000
52#define AT91SAM9261_BASE_TC1 0xfffa0040
53#define AT91SAM9261_BASE_TC2 0xfffa0080
54#define AT91SAM9261_BASE_UDP 0xfffa4000
55#define AT91SAM9261_BASE_MCI 0xfffa8000
56#define AT91SAM9261_BASE_TWI 0xfffac000
57#define AT91SAM9261_BASE_US0 0xfffb0000
58#define AT91SAM9261_BASE_US1 0xfffb4000
59#define AT91SAM9261_BASE_US2 0xfffb8000
60#define AT91SAM9261_BASE_SSC0 0xfffbc000
61#define AT91SAM9261_BASE_SSC1 0xfffc0000
62#define AT91SAM9261_BASE_SSC2 0xfffc4000
63#define AT91SAM9261_BASE_SPI0 0xfffc8000
64#define AT91SAM9261_BASE_SPI1 0xfffcc000
65#define AT91_BASE_SYS 0xffffea00
66
67
68/*
69 * System Peripherals (offset from AT91_BASE_SYS)
70 */
71#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS)
72#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
73#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
74#define AT91_AIC (0xfffff000 - AT91_BASE_SYS)
75#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS)
76#define AT91_PIOA (0xfffff400 - AT91_BASE_SYS)
77#define AT91_PIOB (0xfffff600 - AT91_BASE_SYS)
78#define AT91_PIOC (0xfffff800 - AT91_BASE_SYS)
79#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
80#define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS)
81#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS)
82#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS)
83#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS)
84#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
85#define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS)
86
87
88/*
89 * Internal Memory.
90 */
91#define AT91SAM9261_SRAM_BASE 0x00300000 /* Internal SRAM base address */
92#define AT91SAM9261_SRAM_SIZE 0x00028000 /* Internal SRAM size (160Kb) */
93
94#define AT91SAM9261_ROM_BASE 0x00400000 /* Internal ROM base address */
95#define AT91SAM9261_ROM_SIZE SZ_32K /* Internal ROM size (32Kb) */
96
97#define AT91SAM9261_UHP_BASE 0x00500000 /* USB Host controller */
98#define AT91SAM9261_LCDC_BASE 0x00600000 /* LDC controller */
99
100
101#if 0
102/*
103 * PIO pin definitions (peripheral A/B multiplexing).
104 */
105#define AT91_PA0_SPI0_MISO (1 << 0) /* A: SPI0 Master In Slave */
106#define AT91_PA0_MCDA0 (1 << 0) /* B: Multimedia Card A Data 0 */
107#define AT91_PA1_SPI0_MOSI (1 << 1) /* A: SPI0 Master Out Slave */
108#define AT91_PA1_MCCDA (1 << 1) /* B: Multimedia Card A Command */
109#define AT91_PA2_SPI0_SPCK (1 << 2) /* A: SPI0 Serial Clock */
110#define AT91_PA2_MCCK (1 << 2) /* B: Multimedia Card Clock */
111#define AT91_PA3_SPI0_NPCS0 (1 << 3) /* A: SPI0 Peripheral Chip Select 0 */
112#define AT91_PA4_SPI0_NPCS1 (1 << 4) /* A: SPI0 Peripheral Chip Select 1 */
113#define AT91_PA4_MCDA1 (1 << 4) /* B: Multimedia Card A Data 1 */
114#define AT91_PA5_SPI0_NPCS2 (1 << 5) /* A: SPI0 Peripheral Chip Select 2 */
115#define AT91_PA5_MCDA2 (1 << 5) /* B: Multimedia Card A Data 2 */
116#define AT91_PA6_SPI0_NPCS3 (1 << 6) /* A: SPI0 Peripheral Chip Select 3 */
117#define AT91_PA6_MCDA3 (1 << 6) /* B: Multimedia Card A Data 3 */
118#define AT91_PA7_TWD (1 << 7) /* A: TWI Two-wire Serial Data */
119#define AT91_PA7_PCK0 (1 << 7) /* B: PMC Programmable clock Output 0 */
120#define AT91_PA8_TWCK (1 << 8) /* A: TWI Two-wire Serial Clock */
121#define AT91_PA8_PCK1 (1 << 8) /* B: PMC Programmable clock Output 1 */
122#define AT91_PA9_DRXD (1 << 9) /* A: DBGU Debug Receive Data */
123#define AT91_PA9_PCK2 (1 << 9) /* B: PMC Programmable clock Output 2 */
124#define AT91_PA10_DTXD (1 << 10) /* A: DBGU Debug Transmit Data */
125#define AT91_PA10_PCK3 (1 << 10) /* B: PMC Programmable clock Output 3 */
126#define AT91_PA11_TSYNC (1 << 11) /* A: Trace Synchronization Signal */
127#define AT91_PA11_SCK1 (1 << 11) /* B: USART1 Serial Clock */
128#define AT91_PA12_TCLK (1 << 12) /* A: Trace Clock */
129#define AT91_PA12_RTS1 (1 << 12) /* B: USART1 Ready To Send */
130#define AT91_PA13_TPS0 (1 << 13) /* A: Trace ARM Pipeline Status 0 */
131#define AT91_PA13_CTS1 (1 << 13) /* B: USART1 Clear To Send */
132#define AT91_PA14_TPS1 (1 << 14) /* A: Trace ARM Pipeline Status 1 */
133#define AT91_PA14_SCK2 (1 << 14) /* B: USART2 Serial Clock */
134#define AT91_PA15_TPS2 (1 << 15) /* A: Trace ARM Pipeline Status 2 */
135#define AT91_PA15_RTS2 (1 << 15) /* B: USART2 Ready To Send */
136#define AT91_PA16_TPK0 (1 << 16) /* A: Trace Packet Port 0 */
137#define AT91_PA16_CTS2 (1 << 16) /* B: USART2 Clear To Send */
138#define AT91_PA17_TPK1 (1 << 17) /* A: Trace Packet Port 1 */
139#define AT91_PA17_TF1 (1 << 17) /* B: SSC1 Transmit Frame Sync */
140#define AT91_PA18_TPK2 (1 << 18) /* A: Trace Packet Port 2 */
141#define AT91_PA18_TK1 (1 << 18) /* B: SSC1 Transmit Clock */
142#define AT91_PA19_TPK3 (1 << 19) /* A: Trace Packet Port 3 */
143#define AT91_PA19_TD1 (1 << 19) /* B: SSC1 Transmit Data */
144#define AT91_PA20_TPK4 (1 << 20) /* A: Trace Packet Port 4 */
145#define AT91_PA20_RD1 (1 << 20) /* B: SSC1 Receive Data */
146#define AT91_PA21_TPK5 (1 << 21) /* A: Trace Packet Port 5 */
147#define AT91_PA21_RK1 (1 << 21) /* B: SSC1 Receive Clock */
148#define AT91_PA22_TPK6 (1 << 22) /* A: Trace Packet Port 6 */
149#define AT91_PA22_RF1 (1 << 22) /* B: SSC1 Receive Frame Sync */
150#define AT91_PA23_TPK7 (1 << 23) /* A: Trace Packet Port 7 */
151#define AT91_PA23_RTS0 (1 << 23) /* B: USART0 Ready To Send */
152#define AT91_PA24_TPK8 (1 << 24) /* A: Trace Packet Port 8 */
153#define AT91_PA24_SPI1_NPCS1 (1 << 24) /* B: SPI1 Peripheral Chip Select 1 */
154#define AT91_PA25_TPK9 (1 << 25) /* A: Trace Packet Port 9 */
155#define AT91_PA25_SPI1_NPCS2 (1 << 25) /* B: SPI1 Peripheral Chip Select 2 */
156#define AT91_PA26_TPK10 (1 << 26) /* A: Trace Packet Port 10 */
157#define AT91_PA26_SPI1_NPCS3 (1 << 26) /* B: SPI1 Peripheral Chip Select 3 */
158#define AT91_PA27_TPK11 (1 << 27) /* A: Trace Packet Port 11 */
159#define AT91_PA27_SPI0_NPCS1 (1 << 27) /* B: SPI0 Peripheral Chip Select 1 */
160#define AT91_PA28_TPK12 (1 << 28) /* A: Trace Packet Port 12 */
161#define AT91_PA28_SPI0_NPCS2 (1 << 28) /* B: SPI0 Peripheral Chip Select 2 */
162#define AT91_PA29_TPK13 (1 << 29) /* A: Trace Packet Port 13 */
163#define AT91_PA29_SPI0_NPCS3 (1 << 29) /* B: SPI0 Peripheral Chip Select 3 */
164#define AT91_PA30_TPK14 (1 << 30) /* A: Trace Packet Port 14 */
165#define AT91_PA30_A23 (1 << 30) /* B: Address Bus bit 23 */
166#define AT91_PA31_TPK15 (1 << 31) /* A: Trace Packet Port 15 */
167#define AT91_PA31_A24 (1 << 31) /* B: Address Bus bit 24 */
168
169#define AT91_PB0_LCDVSYNC (1 << 0) /* A: LCD Vertical Synchronization */
170#define AT91_PB1_LCDHSYNC (1 << 1) /* A: LCD Horizontal Synchronization */
171#define AT91_PB2_LCDDOTCK (1 << 2) /* A: LCD Dot Clock */
172#define AT91_PB2_PCK0 (1 << 2) /* B: PMC Programmable clock Output 0 */
173#define AT91_PB3_LCDDEN (1 << 3) /* A: LCD Data Enable */
174#define AT91_PB4_LCDCC (1 << 4) /* A: LCD Contrast Control */
175#define AT91_PB4_LCDD2 (1 << 4) /* B: LCD Data Bus Bit 2 */
176#define AT91_PB5_LCDD0 (1 << 5) /* A: LCD Data Bus Bit 0 */
177#define AT91_PB5_LCDD3 (1 << 5) /* B: LCD Data Bus Bit 3 */
178#define AT91_PB6_LCDD1 (1 << 6) /* A: LCD Data Bus Bit 1 */
179#define AT91_PB6_LCDD4 (1 << 6) /* B: LCD Data Bus Bit 4 */
180#define AT91_PB7_LCDD2 (1 << 7) /* A: LCD Data Bus Bit 2 */
181#define AT91_PB7_LCDD5 (1 << 7) /* B: LCD Data Bus Bit 5 */
182#define AT91_PB8_LCDD3 (1 << 8) /* A: LCD Data Bus Bit 3 */
183#define AT91_PB8_LCDD6 (1 << 8) /* B: LCD Data Bus Bit 6 */
184#define AT91_PB9_LCDD4 (1 << 9) /* A: LCD Data Bus Bit 4 */
185#define AT91_PB9_LCDD7 (1 << 9) /* B: LCD Data Bus Bit 7 */
186#define AT91_PB10_LCDD5 (1 << 10) /* A: LCD Data Bus Bit 5 */
187#define AT91_PB10_LCDD10 (1 << 10) /* B: LCD Data Bus Bit 10 */
188#define AT91_PB11_LCDD6 (1 << 11) /* A: LCD Data Bus Bit 6 */
189#define AT91_PB11_LCDD11 (1 << 11) /* B: LCD Data Bus Bit 11 */
190#define AT91_PB12_LCDD7 (1 << 12) /* A: LCD Data Bus Bit 7 */
191#define AT91_PB12_LCDD12 (1 << 12) /* B: LCD Data Bus Bit 12 */
192#define AT91_PB13_LCDD8 (1 << 13) /* A: LCD Data Bus Bit 8 */
193#define AT91_PB13_LCDD13 (1 << 13) /* B: LCD Data Bus Bit 13 */
194#define AT91_PB14_LCDD9 (1 << 14) /* A: LCD Data Bus Bit 9 */
195#define AT91_PB14_LCDD14 (1 << 14) /* B: LCD Data Bus Bit 14 */
196#define AT91_PB15_LCDD10 (1 << 15) /* A: LCD Data Bus Bit 10 */
197#define AT91_PB15_LCDD15 (1 << 15) /* B: LCD Data Bus Bit 15 */
198#define AT91_PB16_LCDD11 (1 << 16) /* A: LCD Data Bus Bit 11 */
199#define AT91_PB16_LCDD19 (1 << 16) /* B: LCD Data Bus Bit 19 */
200#define AT91_PB17_LCDD12 (1 << 17) /* A: LCD Data Bus Bit 12 */
201#define AT91_PB17_LCDD20 (1 << 17) /* B: LCD Data Bus Bit 20 */
202#define AT91_PB18_LCDD13 (1 << 18) /* A: LCD Data Bus Bit 13 */
203#define AT91_PB18_LCDD21 (1 << 18) /* B: LCD Data Bus Bit 21 */
204#define AT91_PB19_LCDD14 (1 << 19) /* A: LCD Data Bus Bit 14 */
205#define AT91_PB19_LCDD22 (1 << 19) /* B: LCD Data Bus Bit 22 */
206#define AT91_PB20_LCDD15 (1 << 20) /* A: LCD Data Bus Bit 15 */
207#define AT91_PB20_LCDD23 (1 << 20) /* B: LCD Data Bus Bit 23 */
208#define AT91_PB21_TF0 (1 << 21) /* A: SSC0 Transmit Frame Sync */
209#define AT91_PB21_LCDD16 (1 << 21) /* B: LCD Data Bus Bit 16 */
210#define AT91_PB22_TK0 (1 << 22) /* A: SSC0 Transmit Clock */
211#define AT91_PB22_LCDD17 (1 << 22) /* B: LCD Data Bus Bit 17 */
212#define AT91_PB23_TD0 (1 << 23) /* A: SSC0 Transmit Data */
213#define AT91_PB23_LCDD18 (1 << 23) /* B: LCD Data Bus Bit 18 */
214#define AT91_PB24_RD0 (1 << 24) /* A: SSC0 Receive Data */
215#define AT91_PB24_LCDD19 (1 << 24) /* B: LCD Data Bus Bit 19 */
216#define AT91_PB25_RK0 (1 << 25) /* A: SSC0 Receive Clock */
217#define AT91_PB25_LCDD20 (1 << 25) /* B: LCD Data Bus Bit 20 */
218#define AT91_PB26_RF0 (1 << 26) /* A: SSC0 Receive Frame Sync */
219#define AT91_PB26_LCDD21 (1 << 26) /* B: LCD Data Bus Bit 21 */
220#define AT91_PB27_SPI1_NPCS1 (1 << 27) /* A: SPI1 Peripheral Chip Select 1 */
221#define AT91_PB27_LCDD22 (1 << 27) /* B: LCD Data Bus Bit 22 */
222#define AT91_PB28_SPI1_NPCS0 (1 << 28) /* A: SPI1 Peripheral Chip Select 0 */
223#define AT91_PB28_LCDD23 (1 << 28) /* B: LCD Data Bus Bit 23 */
224#define AT91_PB29_SPI1_SPCK (1 << 29) /* A: SPI1 Serial Clock */
225#define AT91_PB29_IRQ2 (1 << 29) /* B: Interrupt input 2 */
226#define AT91_PB30_SPI1_MISO (1 << 30) /* A: SPI1 Master In Slave */
227#define AT91_PB30_IRQ1 (1 << 30) /* B: Interrupt input 1 */
228#define AT91_PB31_SPI1_MOSI (1 << 31) /* A: SPI1 Master Out Slave */
229#define AT91_PB31_PCK2 (1 << 31) /* B: PMC Programmable clock Output 2 */
230
231#define AT91_PC0_SMOE (1 << 0) /* A: SmartMedia Output Enable */
232#define AT91_PC0_NCS6 (1 << 0) /* B: Chip Select 6 */
233#define AT91_PC1_SMWE (1 << 1) /* A: SmartMedia Write Enable */
234#define AT91_PC1_NCS7 (1 << 1) /* B: Chip Select 7 */
235#define AT91_PC2_NWAIT (1 << 2) /* A: NWAIT */
236#define AT91_PC2_IRQ0 (1 << 2) /* B: Interrupt input 0 */
237#define AT91_PC3_A25_CFRNW (1 << 3) /* A: Address Bus[25] / Compact Flash Read Not Write */
238#define AT91_PC4_NCS4_CFCS0 (1 << 4) /* A: Chip Select 4 / CompactFlash Chip Select 0 */
239#define AT91_PC5_NCS5_CFCS1 (1 << 5) /* A: Chip Select 5 / CompactFlash Chip Select 1 */
240#define AT91_PC6_CFCE1 (1 << 6) /* A: CompactFlash Chip Enable 1 */
241#define AT91_PC7_CFCE2 (1 << 7) /* A: CompactFlash Chip Enable 2 */
242#define AT91_PC8_TXD0 (1 << 8) /* A: USART0 Transmit Data */
243#define AT91_PC8_PCK2 (1 << 8) /* B: PMC Programmable clock Output 2 */
244#define AT91_PC9_RXD0 (1 << 9) /* A: USART0 Receive Data */
245#define AT91_PC9_PCK3 (1 << 9) /* B: PMC Programmable clock Output 3 */
246#define AT91_PC10_RTS0 (1 << 10) /* A: USART0 Ready To Send */
247#define AT91_PC10_SCK0 (1 << 10) /* B: USART0 Serial Clock */
248#define AT91_PC11_CTS0 (1 << 11) /* A: USART0 Clear To Send */
249#define AT91_PC11_FIQ (1 << 11) /* B: AIC Fast Interrupt Input */
250#define AT91_PC12_TXD1 (1 << 12) /* A: USART1 Transmit Data */
251#define AT91_PC12_NCS6 (1 << 12) /* B: Chip Select 6 */
252#define AT91_PC13_RXD1 (1 << 13) /* A: USART1 Receive Data */
253#define AT91_PC13_NCS7 (1 << 13) /* B: Chip Select 7 */
254#define AT91_PC14_TXD2 (1 << 14) /* A: USART2 Transmit Data */
255#define AT91_PC14_SPI1_NPCS2 (1 << 14) /* B: SPI1 Peripheral Chip Select 2 */
256#define AT91_PC15_RXD2 (1 << 15) /* A: USART2 Receive Data */
257#define AT91_PC15_SPI1_NPCS3 (1 << 15) /* B: SPI1 Peripheral Chip Select 3 */
258#define AT91_PC16_D16 (1 << 16) /* A: Data Bus [16] */
259#define AT91_PC16_TCLK0 (1 << 16) /* B: Timer Counter 0 external clock input */
260#define AT91_PC17_D17 (1 << 17) /* A: Data Bus [17] */
261#define AT91_PC17_TCLK1 (1 << 17) /* B: Timer Counter 1 external clock input */
262#define AT91_PC18_D18 (1 << 18) /* A: Data Bus [18] */
263#define AT91_PC18_TCLK2 (1 << 18) /* B: Timer Counter 2 external clock input */
264#define AT91_PC19_D19 (1 << 19) /* A: Data Bus [19] */
265#define AT91_PC19_TIOA0 (1 << 19) /* B: Timer Counter 0 Multipurpose Timer I/O Pin A */
266#define AT91_PC20_D20 (1 << 20) /* A: Data Bus [20] */
267#define AT91_PC20_TIOB0 (1 << 20) /* B: Timer Counter 0 Multipurpose Timer I/O Pin B */
268#define AT91_PC21_D21 (1 << 21) /* A: Data Bus [21] */
269#define AT91_PC21_TIOA1 (1 << 21) /* B: Timer Counter 1 Multipurpose Timer I/O Pin A */
270#define AT91_PC22_D22 (1 << 22) /* A: Data Bus [22] */
271#define AT91_PC22_TIOB1 (1 << 22) /* B: Timer Counter 1 Multipurpose Timer I/O Pin B */
272#define AT91_PC23_D23 (1 << 23) /* A: Data Bus [23] */
273#define AT91_PC23_TIOA2 (1 << 23) /* B: Timer Counter 2 Multipurpose Timer I/O Pin A */
274#define AT91_PC24_D24 (1 << 24) /* A: Data Bus [24] */
275#define AT91_PC24_TIOB2 (1 << 24) /* B: Timer Counter 2 Multipurpose Timer I/O Pin B */
276#define AT91_PC25_D25 (1 << 25) /* A: Data Bus [25] */
277#define AT91_PC25_TF2 (1 << 25) /* B: SSC2 Transmit Frame Sync */
278#define AT91_PC26_D26 (1 << 26) /* A: Data Bus [26] */
279#define AT91_PC26_TK2 (1 << 26) /* B: SSC2 Transmit Clock */
280#define AT91_PC27_D27 (1 << 27) /* A: Data Bus [27] */
281#define AT91_PC27_TD2 (1 << 27) /* B: SSC2 Transmit Data */
282#define AT91_PC28_D28 (1 << 28) /* A: Data Bus [28] */
283#define AT91_PC28_RD2 (1 << 28) /* B: SSC2 Receive Data */
284#define AT91_PC29_D29 (1 << 29) /* A: Data Bus [29] */
285#define AT91_PC29_RK2 (1 << 29) /* B: SSC2 Receive Clock */
286#define AT91_PC30_D30 (1 << 30) /* A: Data Bus [30] */
287#define AT91_PC30_RF2 (1 << 30) /* B: SSC2 Receive Frame Sync */
288#define AT91_PC31_D31 (1 << 31) /* A: Data Bus [31] */
289#define AT91_PC31_PCK1 (1 << 31) /* B: PMC Programmable clock Output 1 */
290#endif
291
292#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h b/include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h
new file mode 100644
index 000000000000..270a5dcdf1cd
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h
@@ -0,0 +1,62 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h
3 *
4 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91SAM9261_MATRIX_H
14#define AT91SAM9261_MATRIX_H
15
16#define AT91_MATRIX_MCFG (AT91_MATRIX + 0x00) /* Master Configuration Register */
17#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
18#define AT01_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
19
20#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x04) /* Slave Configuration Register 0 */
21#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x08) /* Slave Configuration Register 1 */
22#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x0C) /* Slave Configuration Register 2 */
23#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x10) /* Slave Configuration Register 3 */
24#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x14) /* Slave Configuration Register 4 */
25#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
26#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
27#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
28#define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16)
29#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
30#define AT91_MATRIX_FIXED_DEFMSTR (7 << 18) /* Fixed Index of Default Master */
31
32#define AT91_MATRIX_TCR (AT91_MATRIX + 0x24) /* TCM Configuration Register */
33#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */
34#define AT91_MATRIX_ITCM_0 (0 << 0)
35#define AT91_MATRIX_ITCM_16 (5 << 0)
36#define AT91_MATRIX_ITCM_32 (6 << 0)
37#define AT91_MATRIX_ITCM_64 (7 << 0)
38#define AT91_MATRIX_DTCM_SIZE (0xf << 4) /* Size of DTCM enabled memory block */
39#define AT91_MATRIX_DTCM_0 (0 << 4)
40#define AT91_MATRIX_DTCM_16 (5 << 4)
41#define AT91_MATRIX_DTCM_32 (6 << 4)
42#define AT91_MATRIX_DTCM_64 (7 << 4)
43
44#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x30) /* EBI Chip Select Assignment Register */
45#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
46#define AT91_MATRIX_CS1A_SMC (0 << 1)
47#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
48#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */
49#define AT91_MATRIX_CS3A_SMC (0 << 3)
50#define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3)
51#define AT91_MATRIX_CS4A (1 << 4) /* Chip Select 4 Assignment */
52#define AT91_MATRIX_CS4A_SMC (0 << 4)
53#define AT91_MATRIX_CS4A_SMC_CF1 (1 << 4)
54#define AT91_MATRIX_CS5A (1 << 5) /* Chip Select 5 Assignment */
55#define AT91_MATRIX_CS5A_SMC (0 << 5)
56#define AT91_MATRIX_CS5A_SMC_CF2 (1 << 5)
57#define AT91_MATRIX_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
58
59#define AT91_MATRIX_USBPUCR (AT91_MATRIX + 0x34) /* USB Pad Pull-Up Control Register */
60#define AT91_MATRIX_USBPUCR_PUON (1 << 30) /* USB Device PAD Pull-up Enable */
61
62#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91sam926x_mc.h b/include/asm-arm/arch-at91rm9200/at91sam926x_mc.h
new file mode 100644
index 000000000000..7d94968b5d57
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/at91sam926x_mc.h
@@ -0,0 +1,134 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91sam926x_mc.h
3 *
4 * Memory Controllers (SMC, SDRAMC) - System peripherals registers.
5 * Based on AT91SAM9261 datasheet revision D.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef AT91SAM926x_MC_H
14#define AT91SAM926x_MC_H
15
16/* SDRAM Controller (SDRAMC) registers */
17#define AT91_SDRAMC_MR (AT91_SDRAMC + 0x00) /* SDRAM Controller Mode Register */
18#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
19#define AT91_SDRAMC_MODE_NORMAL 0
20#define AT91_SDRAMC_MODE_NOP 1
21#define AT91_SDRAMC_MODE_PRECHARGE 2
22#define AT91_SDRAMC_MODE_LMR 3
23#define AT91_SDRAMC_MODE_REFRESH 4
24#define AT91_SDRAMC_MODE_EXT_LMR 5
25#define AT91_SDRAMC_MODE_DEEP 6
26
27#define AT91_SDRAMC_TR (AT91_SDRAMC + 0x04) /* SDRAM Controller Refresh Timer Register */
28#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Counter */
29
30#define AT91_SDRAMC_CR (AT91_SDRAMC + 0x08) /* SDRAM Controller Configuration Register */
31#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
32#define AT91_SDRAMC_NC_8 (0 << 0)
33#define AT91_SDRAMC_NC_9 (1 << 0)
34#define AT91_SDRAMC_NC_10 (2 << 0)
35#define AT91_SDRAMC_NC_11 (3 << 0)
36#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
37#define AT91_SDRAMC_NR_11 (0 << 2)
38#define AT91_SDRAMC_NR_12 (1 << 2)
39#define AT91_SDRAMC_NR_13 (2 << 2)
40#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
41#define AT91_SDRAMC_NB_2 (0 << 4)
42#define AT91_SDRAMC_NB_4 (1 << 4)
43#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
44#define AT91_SDRAMC_CAS_1 (1 << 5)
45#define AT91_SDRAMC_CAS_2 (2 << 5)
46#define AT91_SDRAMC_CAS_3 (3 << 5)
47#define AT91_SDRAMC_DBW (1 << 7) /* Data Bus Width */
48#define AT91_SDRAMC_DBW_32 (0 << 7)
49#define AT91_SDRAMC_DBW_16 (1 << 7)
50#define AT91_SDRAMC_TWR (0xf << 8) /* Write Recovery Delay */
51#define AT91_SDRAMC_TRC (0xf << 12) /* Row Cycle Delay */
52#define AT91_SDRAMC_TRP (0xf << 16) /* Row Precharge Delay */
53#define AT91_SDRAMC_TRCD (0xf << 20) /* Row to Column Delay */
54#define AT91_SDRAMC_TRAS (0xf << 24) /* Active to Precharge Delay */
55#define AT91_SDRAMC_TXSR (0xf << 28) /* Exit Self Refresh to Active Delay */
56
57#define AT91_SDRAMC_LPR (AT91_SDRAMC + 0x10) /* SDRAM Controller Low Power Register */
58#define AT91_SDRAMC_LPCB (3 << 0) /* Low-power Configurations */
59#define AT91_SDRAMC_LPCB_DISABLE 0
60#define AT91_SDRAMC_LPCB_SELF_REFRESH 1
61#define AT91_SDRAMC_LPCB_POWER_DOWN 2
62#define AT91_SDRAMC_LPCB_DEEP_POWER_DOWN 3
63#define AT91_SDRAMC_PASR (7 << 4) /* Partial Array Self Refresh */
64#define AT91_SDRAMC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
65#define AT91_SDRAMC_DS (3 << 10) /* Drive Strenght */
66#define AT91_SDRAMC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
67#define AT91_SDRAMC_TIMEOUT_0_CLK_CYCLES (0 << 12)
68#define AT91_SDRAMC_TIMEOUT_64_CLK_CYCLES (1 << 12)
69#define AT91_SDRAMC_TIMEOUT_128_CLK_CYCLES (2 << 12)
70
71#define AT91_SDRAMC_IER (AT91_SDRAMC + 0x14) /* SDRAM Controller Interrupt Enable Register */
72#define AT91_SDRAMC_IDR (AT91_SDRAMC + 0x18) /* SDRAM Controller Interrupt Disable Register */
73#define AT91_SDRAMC_IMR (AT91_SDRAMC + 0x1C) /* SDRAM Controller Interrupt Mask Register */
74#define AT91_SDRAMC_ISR (AT91_SDRAMC + 0x20) /* SDRAM Controller Interrupt Status Register */
75#define AT91_SDRAMC_RES (1 << 0) /* Refresh Error Status */
76
77#define AT91_SDRAMC_MDR (AT91_SDRAMC + 0x24) /* SDRAM Memory Device Register */
78#define AT91_SDRAMC_MD (3 << 0) /* Memory Device Type */
79#define AT91_SDRAMC_MD_SDRAM 0
80#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1
81
82
83/* Static Memory Controller (SMC) registers */
84#define AT91_SMC_SETUP(n) (AT91_SMC + 0x00 + ((n)*0x10)) /* Setup Register for CS n */
85#define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */
86#define AT91_SMC_NWESETUP_(x) ((x) << 0)
87#define AT91_SMC_NCS_WRSETUP (0x3f << 8) /* NCS Setup Length in Write Access */
88#define AT91_SMC_NCS_WRSETUP_(x) ((x) << 8)
89#define AT91_SMC_NRDSETUP (0x3f << 16) /* NRD Setup Length */
90#define AT91_SMC_NRDSETUP_(x) ((x) << 16)
91#define AT91_SMC_NCS_RDSETUP (0x3f << 24) /* NCS Setup Length in Read Access */
92#define AT91_SMC_NCS_RDSETUP_(x) ((x) << 24)
93
94#define AT91_SMC_PULSE(n) (AT91_SMC + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */
95#define AT91_SMC_NWEPULSE (0x7f << 0) /* NWE Pulse Length */
96#define AT91_SMC_NWEPULSE_(x) ((x) << 0)
97#define AT91_SMC_NCS_WRPULSE (0x7f << 8) /* NCS Pulse Length in Write Access */
98#define AT91_SMC_NCS_WRPULSE_(x)((x) << 8)
99#define AT91_SMC_NRDPULSE (0x7f << 16) /* NRD Pulse Length */
100#define AT91_SMC_NRDPULSE_(x) ((x) << 16)
101#define AT91_SMC_NCS_RDPULSE (0x7f << 24) /* NCS Pulse Length in Read Access */
102#define AT91_SMC_NCS_RDPULSE_(x)((x) << 24)
103
104#define AT91_SMC_CYCLE(n) (AT91_SMC + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */
105#define AT91_SMC_NWECYCLE (0x1ff << 0 ) /* Total Write Cycle Length */
106#define AT91_SMC_NWECYCLE_(x) ((x) << 0)
107#define AT91_SMC_NRDCYCLE (0x1ff << 16) /* Total Read Cycle Length */
108#define AT91_SMC_NRDCYCLE_(x) ((x) << 16)
109
110#define AT91_SMC_MODE(n) (AT91_SMC + 0x0c + ((n)*0x10)) /* Mode Register for CS n */
111#define AT91_SMC_READMODE (1 << 0) /* Read Mode */
112#define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */
113#define AT91_SMC_EXNWMODE (3 << 5) /* NWAIT Mode */
114#define AT91_SMC_EXNWMODE_DISABLE (0 << 5)
115#define AT91_SMC_EXNWMODE_FROZEN (2 << 5)
116#define AT91_SMC_EXNWMODE_READY (3 << 5)
117#define AT91_SMC_BAT (1 << 8) /* Byte Access Type */
118#define AT91_SMC_BAT_SELECT (0 << 8)
119#define AT91_SMC_BAT_WRITE (1 << 8)
120#define AT91_SMC_DBW (3 << 12) /* Data Bus Width */
121#define AT91_SMC_DBW_8 (0 << 12)
122#define AT91_SMC_DBW_16 (1 << 12)
123#define AT91_SMC_DBW_32 (2 << 12)
124#define AT91_SMC_TDF (0xf << 16) /* Data Float Time. */
125#define AT91_SMC_TDF_(x) ((x) << 16)
126#define AT91_SMC_TDFMODE (1 << 20) /* TDF Optimization - Enabled */
127#define AT91_SMC_PMEN (1 << 24) /* Page Mode Enabled */
128#define AT91_SMC_PS (3 << 28) /* Page Size */
129#define AT91_SMC_PS_4 (0 << 28)
130#define AT91_SMC_PS_8 (1 << 28)
131#define AT91_SMC_PS_16 (2 << 28)
132#define AT91_SMC_PS_32 (3 << 28)
133
134#endif
diff --git a/include/asm-arm/arch-at91rm9200/board.h b/include/asm-arm/arch-at91rm9200/board.h
index 3cc9aec80f9d..768e0fc6aa2f 100644
--- a/include/asm-arm/arch-at91rm9200/board.h
+++ b/include/asm-arm/arch-at91rm9200/board.h
@@ -48,13 +48,14 @@ struct at91_cf_data {
48 u8 det_pin; /* Card detect */ 48 u8 det_pin; /* Card detect */
49 u8 vcc_pin; /* power switching */ 49 u8 vcc_pin; /* power switching */
50 u8 rst_pin; /* card reset */ 50 u8 rst_pin; /* card reset */
51 u8 chipselect; /* EBI Chip Select number */
51}; 52};
52extern void __init at91_add_device_cf(struct at91_cf_data *data); 53extern void __init at91_add_device_cf(struct at91_cf_data *data);
53 54
54 /* MMC / SD */ 55 /* MMC / SD */
55struct at91_mmc_data { 56struct at91_mmc_data {
56 u8 det_pin; /* card detect IRQ */ 57 u8 det_pin; /* card detect IRQ */
57 unsigned is_b:1; /* uses B side (vs A) */ 58 unsigned slot_b:1; /* uses Slot B */
58 unsigned wire4:1; /* (SD) supports DAT0..DAT3 */ 59 unsigned wire4:1; /* (SD) supports DAT0..DAT3 */
59 u8 wp_pin; /* (SD) writeprotect detect */ 60 u8 wp_pin; /* (SD) writeprotect detect */
60 u8 vcc_pin; /* power switching (high == on) */ 61 u8 vcc_pin; /* power switching (high == on) */
@@ -81,7 +82,8 @@ struct at91_nand_data {
81 u8 rdy_pin; /* ready/busy */ 82 u8 rdy_pin; /* ready/busy */
82 u8 ale; /* address line number connected to ALE */ 83 u8 ale; /* address line number connected to ALE */
83 u8 cle; /* address line number connected to CLE */ 84 u8 cle; /* address line number connected to CLE */
84 struct mtd_partition* (*partition_info)(int, int*); 85 u8 bus_width_16; /* buswidth is 16 bit */
86 struct mtd_partition* (*partition_info)(int, int*);
85}; 87};
86extern void __init at91_add_device_nand(struct at91_nand_data *data); 88extern void __init at91_add_device_nand(struct at91_nand_data *data);
87 89
diff --git a/include/asm-arm/arch-at91rm9200/cpu.h b/include/asm-arm/arch-at91rm9200/cpu.h
new file mode 100644
index 000000000000..6f8d09b08692
--- /dev/null
+++ b/include/asm-arm/arch-at91rm9200/cpu.h
@@ -0,0 +1,49 @@
1/*
2 * include/asm-arm/arch-at91rm9200/cpu.h
3 *
4 * Copyright (C) 2006 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12
13#ifndef __ASM_ARCH_CPU_H
14#define __ASM_ARCH_CPU_H
15
16#include <asm/hardware.h>
17#include <asm/arch/at91_dbgu.h>
18
19
20#define ARCH_ID_AT91RM9200 0x09290780
21#define ARCH_ID_AT91SAM9260 0x019803a0
22#define ARCH_ID_AT91SAM9261 0x019703a0
23
24
25static inline unsigned long at91_cpu_identify(void)
26{
27 return (at91_sys_read(AT91_DBGU_CIDR) & ~AT91_CIDR_VERSION);
28}
29
30
31#ifdef CONFIG_ARCH_AT91RM9200
32#define cpu_is_at91rm9200() (at91_cpu_identify() == ARCH_ID_AT91RM9200)
33#else
34#define cpu_is_at91rm9200() (0)
35#endif
36
37#ifdef CONFIG_ARCH_AT91SAM9260
38#define cpu_is_at91sam9260() (at91_cpu_identify() == ARCH_ID_AT91SAM9260)
39#else
40#define cpu_is_at91sam9260() (0)
41#endif
42
43#ifdef CONFIG_ARCH_AT91SAM9261
44#define cpu_is_at91sam9261() (at91_cpu_identify() == ARCH_ID_AT91SAM9261)
45#else
46#define cpu_is_at91sam9261() (0)
47#endif
48
49#endif
diff --git a/include/asm-arm/arch-at91rm9200/debug-macro.S b/include/asm-arm/arch-at91rm9200/debug-macro.S
index f496b54c4c3e..85cdadf26634 100644
--- a/include/asm-arm/arch-at91rm9200/debug-macro.S
+++ b/include/asm-arm/arch-at91rm9200/debug-macro.S
@@ -12,6 +12,7 @@
12*/ 12*/
13 13
14#include <asm/hardware.h> 14#include <asm/hardware.h>
15#include <asm/arch/at91_dbgu.h>
15 16
16 .macro addruart,rx 17 .macro addruart,rx
17 mrc p15, 0, \rx, c1, c0 18 mrc p15, 0, \rx, c1, c0
diff --git a/include/asm-arm/arch-at91rm9200/entry-macro.S b/include/asm-arm/arch-at91rm9200/entry-macro.S
index 61a326e94909..57248a796472 100644
--- a/include/asm-arm/arch-at91rm9200/entry-macro.S
+++ b/include/asm-arm/arch-at91rm9200/entry-macro.S
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <asm/hardware.h> 13#include <asm/hardware.h>
14#include <asm/arch/at91_aic.h>
14 15
15 .macro disable_fiq 16 .macro disable_fiq
16 .endm 17 .endm
diff --git a/include/asm-arm/arch-at91rm9200/hardware.h b/include/asm-arm/arch-at91rm9200/hardware.h
index 9ca4cc9c0b2e..9ea5bfe06320 100644
--- a/include/asm-arm/arch-at91rm9200/hardware.h
+++ b/include/asm-arm/arch-at91rm9200/hardware.h
@@ -16,8 +16,16 @@
16 16
17#include <asm/sizes.h> 17#include <asm/sizes.h>
18 18
19#if defined(CONFIG_ARCH_AT91RM9200)
19#include <asm/arch/at91rm9200.h> 20#include <asm/arch/at91rm9200.h>
20#include <asm/arch/at91rm9200_sys.h> 21#elif defined(CONFIG_ARCH_AT91SAM9260)
22#include <asm/arch/at91sam9260.h>
23#elif defined(CONFIG_ARCH_AT91SAM9261)
24#include <asm/arch/at91sam9261.h>
25#else
26#error "Unsupported AT91 processor"
27#endif
28
21 29
22/* 30/*
23 * Remap the peripherals from address 0xFFFA0000 .. 0xFFFFFFFF 31 * Remap the peripherals from address 0xFFFA0000 .. 0xFFFFFFFF
@@ -34,29 +42,27 @@
34 * Virtual to Physical Address mapping for IO devices. 42 * Virtual to Physical Address mapping for IO devices.
35 */ 43 */
36#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS) 44#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS)
37#define AT91_VA_BASE_SPI AT91_IO_P2V(AT91RM9200_BASE_SPI)
38#define AT91_VA_BASE_EMAC AT91_IO_P2V(AT91RM9200_BASE_EMAC) 45#define AT91_VA_BASE_EMAC AT91_IO_P2V(AT91RM9200_BASE_EMAC)
39#define AT91_VA_BASE_TWI AT91_IO_P2V(AT91RM9200_BASE_TWI)
40#define AT91_VA_BASE_MCI AT91_IO_P2V(AT91RM9200_BASE_MCI)
41#define AT91_VA_BASE_UDP AT91_IO_P2V(AT91RM9200_BASE_UDP)
42 46
43 /* Internal SRAM is mapped below the IO devices */ 47 /* Internal SRAM is mapped below the IO devices */
44#define AT91_SRAM_VIRT_BASE (AT91_IO_VIRT_BASE - AT91RM9200_SRAM_SIZE) 48#define AT91_SRAM_MAX SZ_1M
49#define AT91_VIRT_BASE (AT91_IO_VIRT_BASE - AT91_SRAM_MAX)
45 50
46/* Serial ports */ 51/* Serial ports */
47#define ATMEL_MAX_UART 5 /* 4 USART3's and one DBGU port */ 52#define ATMEL_MAX_UART 7 /* 6 USART3's and one DBGU port (SAM9260) */
48 53
49/* FLASH */ 54/* External Memory Map */
50#define AT91_FLASH_BASE 0x10000000 /* NCS0: Flash physical base address */ 55#define AT91_CHIPSELECT_0 0x10000000
56#define AT91_CHIPSELECT_1 0x20000000
57#define AT91_CHIPSELECT_2 0x30000000
58#define AT91_CHIPSELECT_3 0x40000000
59#define AT91_CHIPSELECT_4 0x50000000
60#define AT91_CHIPSELECT_5 0x60000000
61#define AT91_CHIPSELECT_6 0x70000000
62#define AT91_CHIPSELECT_7 0x80000000
51 63
52/* SDRAM */ 64/* SDRAM */
53#define AT91_SDRAM_BASE 0x20000000 /* NCS1: SDRAM physical base address */ 65#define AT91_SDRAM_BASE AT91_CHIPSELECT_1
54
55/* SmartMedia */
56#define AT91_SMARTMEDIA_BASE 0x40000000 /* NCS3: Smartmedia physical base address */
57
58/* Compact Flash */
59#define AT91_CF_BASE 0x50000000 /* NCS4-NCS6: Compact Flash physical base address */
60 66
61/* Clocks */ 67/* Clocks */
62#define AT91_SLOW_CLOCK 32768 /* slow clock */ 68#define AT91_SLOW_CLOCK 32768 /* slow clock */
diff --git a/include/asm-arm/arch-at91rm9200/irqs.h b/include/asm-arm/arch-at91rm9200/irqs.h
index 763cb96c418b..c0679eaefaf2 100644
--- a/include/asm-arm/arch-at91rm9200/irqs.h
+++ b/include/asm-arm/arch-at91rm9200/irqs.h
@@ -21,6 +21,8 @@
21#ifndef __ASM_ARCH_IRQS_H 21#ifndef __ASM_ARCH_IRQS_H
22#define __ASM_ARCH_IRQS_H 22#define __ASM_ARCH_IRQS_H
23 23
24#include <asm/arch/at91_aic.h>
25
24#define NR_AIC_IRQS 32 26#define NR_AIC_IRQS 32
25 27
26 28
diff --git a/include/asm-arm/arch-at91rm9200/system.h b/include/asm-arm/arch-at91rm9200/system.h
index 8a2ff472e4cf..9c67130603b2 100644
--- a/include/asm-arm/arch-at91rm9200/system.h
+++ b/include/asm-arm/arch-at91rm9200/system.h
@@ -22,6 +22,8 @@
22#define __ASM_ARCH_SYSTEM_H 22#define __ASM_ARCH_SYSTEM_H
23 23
24#include <asm/hardware.h> 24#include <asm/hardware.h>
25#include <asm/arch/at91_st.h>
26#include <asm/arch/at91_dbgu.h>
25 27
26static inline void arch_idle(void) 28static inline void arch_idle(void)
27{ 29{
@@ -39,21 +41,13 @@ static inline void arch_idle(void)
39 cpu_do_idle(); 41 cpu_do_idle();
40} 42}
41 43
42static inline void arch_reset(char mode) 44void (*at91_arch_reset)(void);
43{
44 /*
45 * Perform a hardware reset with the use of the Watchdog timer.
46 */
47 at91_sys_write(AT91_ST_WDMR, AT91_ST_RSTEN | AT91_ST_EXTEN | 1);
48 at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
49}
50
51#define ARCH_ID_AT91RM9200 0x09200080
52#define ARCH_ID_AT91SAM9261 0x019000a0
53 45
54static inline unsigned long arch_identify(void) 46static inline void arch_reset(char mode)
55{ 47{
56 return at91_sys_read(AT91_DBGU_CIDR) & (AT91_CIDR_EPROC | AT91_CIDR_ARCH); 48 /* call the CPU-specific reset function */
49 if (at91_arch_reset)
50 (at91_arch_reset)();
57} 51}
58 52
59#endif 53#endif
diff --git a/include/asm-arm/arch-at91rm9200/timex.h b/include/asm-arm/arch-at91rm9200/timex.h
index 88687cefe6eb..faeca45a8d44 100644
--- a/include/asm-arm/arch-at91rm9200/timex.h
+++ b/include/asm-arm/arch-at91rm9200/timex.h
@@ -23,6 +23,15 @@
23 23
24#include <asm/hardware.h> 24#include <asm/hardware.h>
25 25
26#if defined(CONFIG_ARCH_AT91RM9200)
27
26#define CLOCK_TICK_RATE (AT91_SLOW_CLOCK) 28#define CLOCK_TICK_RATE (AT91_SLOW_CLOCK)
27 29
30#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9261)
31
32#define AT91SAM9_MASTER_CLOCK 99300000
33#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
34
35#endif
36
28#endif 37#endif
diff --git a/include/asm-arm/arch-at91rm9200/uncompress.h b/include/asm-arm/arch-at91rm9200/uncompress.h
index ec7811ab0a52..34b4b93fa015 100644
--- a/include/asm-arm/arch-at91rm9200/uncompress.h
+++ b/include/asm-arm/arch-at91rm9200/uncompress.h
@@ -22,11 +22,11 @@
22#define __ASM_ARCH_UNCOMPRESS_H 22#define __ASM_ARCH_UNCOMPRESS_H
23 23
24#include <asm/hardware.h> 24#include <asm/hardware.h>
25#include <asm/arch/at91_dbgu.h>
25 26
26/* 27/*
27 * The following code assumes the serial port has already been 28 * The following code assumes the serial port has already been
28 * initialized by the bootloader. We search for the first enabled 29 * initialized by the bootloader. If you didn't setup a port in
29 * port in the most probable order. If you didn't setup a port in
30 * your bootloader then nothing will appear (which might be desired). 30 * your bootloader then nothing will appear (which might be desired).
31 * 31 *
32 * This does not append a newline 32 * This does not append a newline
diff --git a/include/asm-arm/arch-at91rm9200/vmalloc.h b/include/asm-arm/arch-at91rm9200/vmalloc.h
index 4c367eb57f47..0a23b8c562b9 100644
--- a/include/asm-arm/arch-at91rm9200/vmalloc.h
+++ b/include/asm-arm/arch-at91rm9200/vmalloc.h
@@ -21,6 +21,6 @@
21#ifndef __ASM_ARCH_VMALLOC_H 21#ifndef __ASM_ARCH_VMALLOC_H
22#define __ASM_ARCH_VMALLOC_H 22#define __ASM_ARCH_VMALLOC_H
23 23
24#define VMALLOC_END (AT91_SRAM_VIRT_BASE & PGDIR_MASK) 24#define VMALLOC_END (AT91_VIRT_BASE & PGDIR_MASK)
25 25
26#endif 26#endif
diff --git a/include/asm-arm/arch-clps711x/memory.h b/include/asm-arm/arch-clps711x/memory.h
index c6e8dcf674de..42768cc8bfb4 100644
--- a/include/asm-arm/arch-clps711x/memory.h
+++ b/include/asm-arm/arch-clps711x/memory.h
@@ -62,7 +62,15 @@
62 * memory bank. For those systems, simply undefine CONFIG_DISCONTIGMEM. 62 * memory bank. For those systems, simply undefine CONFIG_DISCONTIGMEM.
63 */ 63 */
64 64
65#ifdef CONFIG_DISCONTIGMEM 65/*
66 * The PS7211 allows up to 256MB max per DRAM bank, but the EDB7211
67 * uses only one of the two banks (bank #1). However, even within
68 * bank #1, memory is discontiguous.
69 *
70 * The EDB7211 has two 8MB DRAM areas with 8MB of empty space between
71 * them, so we use 24 for the node max shift to get 16MB node sizes.
72 */
73
66/* 74/*
67 * Because of the wide memory address space between physical RAM banks on the 75 * Because of the wide memory address space between physical RAM banks on the
68 * SA1100, it's much more convenient to use Linux's NUMA support to implement 76 * SA1100, it's much more convenient to use Linux's NUMA support to implement
@@ -80,48 +88,7 @@
80 * node 2: 0xd0000000 - 0xd7ffffff 88 * node 2: 0xd0000000 - 0xd7ffffff
81 * node 3: 0xd8000000 - 0xdfffffff 89 * node 3: 0xd8000000 - 0xdfffffff
82 */ 90 */
83 91#define NODE_MEM_SIZE_BITS 24
84/*
85 * Given a kernel address, find the home node of the underlying memory.
86 */
87#define KVADDR_TO_NID(addr) \
88 (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MAX_MEM_SHIFT)
89
90/*
91 * Given a page frame number, convert it to a node id.
92 */
93#define PFN_TO_NID(pfn) \
94 (((pfn) - PHYS_PFN_OFFSET) >> (NODE_MAX_MEM_SHIFT - PAGE_SHIFT))
95
96/*
97 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
98 * and returns the mem_map of that node.
99 */
100#define ADDR_TO_MAPBASE(kaddr) \
101 NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr)))
102
103#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
104
105/*
106 * Given a kaddr, LOCAL_MAR_NR finds the owning node of the memory
107 * and returns the index corresponding to the appropriate page in the
108 * node's mem_map.
109 */
110#define LOCAL_MAP_NR(addr) \
111 (((unsigned long)(addr) & (NODE_MAX_MEM_SIZE - 1)) >> PAGE_SHIFT)
112
113/*
114 * The PS7211 allows up to 256MB max per DRAM bank, but the EDB7211
115 * uses only one of the two banks (bank #1). However, even within
116 * bank #1, memory is discontiguous.
117 *
118 * The EDB7211 has two 8MB DRAM areas with 8MB of empty space between
119 * them, so we use 24 for the node max shift to get 16MB node sizes.
120 */
121#define NODE_MAX_MEM_SHIFT 24
122#define NODE_MAX_MEM_SIZE (1<<NODE_MAX_MEM_SHIFT)
123
124#endif /* CONFIG_DISCONTIGMEM */
125 92
126#endif 93#endif
127 94
diff --git a/include/asm-arm/arch-ebsa110/io.h b/include/asm-arm/arch-ebsa110/io.h
index ae048441c9ed..722c5e086285 100644
--- a/include/asm-arm/arch-ebsa110/io.h
+++ b/include/asm-arm/arch-ebsa110/io.h
@@ -27,9 +27,9 @@ void __outw(u16 val, unsigned int port);
27u32 __inl(unsigned int port); 27u32 __inl(unsigned int port);
28void __outl(u32 val, unsigned int port); 28void __outl(u32 val, unsigned int port);
29 29
30u8 __readb(void __iomem *addr); 30u8 __readb(const volatile void __iomem *addr);
31u16 __readw(void __iomem *addr); 31u16 __readw(const volatile void __iomem *addr);
32u32 __readl(void __iomem *addr); 32u32 __readl(const volatile void __iomem *addr);
33 33
34void __writeb(u8 val, void __iomem *addr); 34void __writeb(u8 val, void __iomem *addr);
35void __writew(u16 val, void __iomem *addr); 35void __writew(u16 val, void __iomem *addr);
@@ -64,8 +64,14 @@ void __writel(u32 val, void __iomem *addr);
64#define writew(v,b) __writew(v,b) 64#define writew(v,b) __writew(v,b)
65#define writel(v,b) __writel(v,b) 65#define writel(v,b) __writel(v,b)
66 66
67#define __arch_ioremap(cookie,sz,c) ((void __iomem *)(cookie)) 67static inline void __iomem *__arch_ioremap(unsigned long cookie, size_t size,
68#define __arch_iounmap(cookie) do { } while (0) 68 unsigned int flags)
69{
70 return (void __iomem *)cookie;
71}
72
73#define __arch_ioremap __arch_ioremap
74#define __arch_iounmap(cookie) do { } while (0)
69 75
70extern void insb(unsigned int port, void *buf, int sz); 76extern void insb(unsigned int port, void *buf, int sz);
71extern void insw(unsigned int port, void *buf, int sz); 77extern void insw(unsigned int port, void *buf, int sz);
diff --git a/include/asm-arm/arch-imx/timex.h b/include/asm-arm/arch-imx/timex.h
index 8c91674706b1..e22ba789546c 100644
--- a/include/asm-arm/arch-imx/timex.h
+++ b/include/asm-arm/arch-imx/timex.h
@@ -21,7 +21,6 @@
21#ifndef __ASM_ARCH_TIMEX_H 21#ifndef __ASM_ARCH_TIMEX_H
22#define __ASM_ARCH_TIMEX_H 22#define __ASM_ARCH_TIMEX_H
23 23
24#include <asm/hardware.h> 24#define CLOCK_TICK_RATE (16000000)
25#define CLOCK_TICK_RATE (CLK32)
26 25
27#endif 26#endif
diff --git a/include/asm-arm/arch-iop13xx/debug-macro.S b/include/asm-arm/arch-iop13xx/debug-macro.S
new file mode 100644
index 000000000000..788b4e386c16
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/debug-macro.S
@@ -0,0 +1,26 @@
1/*
2 * include/asm-arm/arch-iop13xx/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
14 .macro addruart, rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1 @ mmu enabled?
17 moveq \rx, #0xff000000 @ physical
18 orreq \rx, \rx, #0x00d80000
19 movne \rx, #0xfe000000 @ virtual
20 orrne \rx, \rx, #0x00e80000
21 orr \rx, \rx, #0x00002300
22 orr \rx, \rx, #0x00000040
23 .endm
24
25#define UART_SHIFT 2
26#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-iop13xx/dma.h b/include/asm-arm/arch-iop13xx/dma.h
new file mode 100644
index 000000000000..2e15da53ff79
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/dma.h
@@ -0,0 +1,3 @@
1#ifndef _IOP13XX_DMA_H
2#define _IOP13XX_DMA_H_
3#endif
diff --git a/include/asm-arm/arch-iop13xx/entry-macro.S b/include/asm-arm/arch-iop13xx/entry-macro.S
new file mode 100644
index 000000000000..94c50283dc56
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/entry-macro.S
@@ -0,0 +1,39 @@
1/*
2 * iop13xx low level irq macros
3 * Copyright (c) 2005-2006, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 */
19 .macro disable_fiq
20 .endm
21
22 /*
23 * Note: a 1-cycle window exists where iintvec will return the value
24 * of iintbase, so we explicitly check for "bad zeros"
25 */
26 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
27 mrc p15, 0, \tmp, c15, c1, 0
28 orr \tmp, \tmp, #(1 << 6)
29 mcr p15, 0, \tmp, c15, c1, 0 @ Enable cp6 access
30
31 mrc p6, 0, \irqnr, c3, c2, 0 @ Read IINTVEC
32 cmp \irqnr, #0
33 mrceq p6, 0, \irqnr, c3, c2, 0 @ Re-read on potentially bad zero
34 adds \irqstat, \irqnr, #1 @ Check for 0xffffffff
35 movne \irqnr, \irqnr, lsr #2 @ Convert to irqnr
36
37 biceq \tmp, \tmp, #(1 << 6)
38 mcreq p15, 0, \tmp, c15, c1, 0 @ Disable cp6 access if no more interrupts
39 .endm
diff --git a/include/asm-arm/arch-iop13xx/hardware.h b/include/asm-arm/arch-iop13xx/hardware.h
new file mode 100644
index 000000000000..8e1d56289846
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/hardware.h
@@ -0,0 +1,28 @@
1#ifndef __ASM_ARCH_HARDWARE_H
2#define __ASM_ARCH_HARDWARE_H
3#include <asm/types.h>
4
5#define pcibios_assign_all_busses() 1
6
7#ifndef __ASSEMBLY__
8extern unsigned long iop13xx_pcibios_min_io;
9extern unsigned long iop13xx_pcibios_min_mem;
10extern u16 iop13xx_dev_id(void);
11extern void iop13xx_set_atu_mmr_bases(void);
12#endif
13
14#define PCIBIOS_MIN_IO (iop13xx_pcibios_min_io)
15#define PCIBIOS_MIN_MEM (iop13xx_pcibios_min_mem)
16
17/*
18 * Generic chipset bits
19 *
20 */
21#include "iop13xx.h"
22
23/*
24 * Board specific bits
25 */
26#include "iq81340.h"
27
28#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/include/asm-arm/arch-iop13xx/io.h b/include/asm-arm/arch-iop13xx/io.h
new file mode 100644
index 000000000000..db6de2480a24
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/io.h
@@ -0,0 +1,41 @@
1/*
2 * iop13xx custom ioremap implementation
3 * Copyright (c) 2005-2006, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 */
19#ifndef __ASM_ARM_ARCH_IO_H
20#define __ASM_ARM_ARCH_IO_H
21
22#define IO_SPACE_LIMIT 0xffffffff
23
24#define __io(a) (a)
25#define __mem_pci(a) (a)
26#define __mem_isa(a) (a)
27
28extern void __iomem * __ioremap(unsigned long, size_t, unsigned long);
29extern void __iomem *__iop13xx_ioremap(unsigned long cookie, size_t size,
30 unsigned long flags);
31extern void __iop13xx_iounmap(void __iomem *addr);
32
33extern u32 iop13xx_atue_mem_base;
34extern u32 iop13xx_atux_mem_base;
35extern size_t iop13xx_atue_mem_size;
36extern size_t iop13xx_atux_mem_size;
37
38#define __arch_ioremap(a, s, f) __iop13xx_ioremap(a, s, f)
39#define __arch_iounmap(a) __iop13xx_iounmap(a)
40
41#endif
diff --git a/include/asm-arm/arch-iop13xx/iop13xx.h b/include/asm-arm/arch-iop13xx/iop13xx.h
new file mode 100644
index 000000000000..a88522a0ff8e
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/iop13xx.h
@@ -0,0 +1,492 @@
1#ifndef _IOP13XX_HW_H_
2#define _IOP13XX_HW_H_
3
4#ifndef __ASSEMBLY__
5/* The ATU offsets can change based on the strapping */
6extern u32 iop13xx_atux_pmmr_offset;
7extern u32 iop13xx_atue_pmmr_offset;
8void iop13xx_init_irq(void);
9void iop13xx_map_io(void);
10void iop13xx_platform_init(void);
11void iop13xx_init_irq(void);
12void iop13xx_init_time(unsigned long tickrate);
13unsigned long iop13xx_gettimeoffset(void);
14
15/* handle cp6 access
16 * to do: handle access in entry-armv5.S and unify with
17 * the iop3xx implementation
18 * note: use iop13xx_cp6_enable_irq_save and iop13xx_cp6_irq_restore (irq.h)
19 * when interrupts are enabled
20 */
21static inline unsigned long iop13xx_cp6_save(void)
22{
23 u32 temp, cp_flags;
24
25 asm volatile (
26 "mrc p15, 0, %1, c15, c1, 0\n\t"
27 "orr %0, %1, #(1 << 6)\n\t"
28 "mcr p15, 0, %0, c15, c1, 0\n\t"
29 : "=r" (temp), "=r"(cp_flags));
30
31 return cp_flags;
32}
33
34static inline void iop13xx_cp6_restore(unsigned long cp_flags)
35{
36 asm volatile (
37 "mcr p15, 0, %0, c15, c1, 0\n\t"
38 : : "r" (cp_flags) );
39}
40
41/* CPUID CP6 R0 Page 0 */
42static inline int iop13xx_cpu_id(void)
43{
44 int id;
45 asm volatile("mrc p6, 0, %0, c0, c0, 0":"=r" (id));
46 return id;
47}
48
49#endif
50
51/*
52 * IOP13XX I/O and Mem space regions for PCI autoconfiguration
53 */
54#define IOP13XX_MAX_RAM_SIZE 0x80000000UL /* 2GB */
55#define IOP13XX_PCI_OFFSET IOP13XX_MAX_RAM_SIZE
56
57/* PCI MAP
58 * 0x0000.0000 - 0x8000.0000 1:1 mapping with Physical RAM
59 * 0x8000.0000 - 0x8800.0000 PCIX/PCIE memory window (128MB)
60*/
61#define IOP13XX_PCIX_IO_WINDOW_SIZE 0x10000UL
62#define IOP13XX_PCIX_LOWER_IO_PA 0xfffb0000UL
63#define IOP13XX_PCIX_LOWER_IO_VA 0xfec60000UL
64#define IOP13XX_PCIX_LOWER_IO_BA 0x0fff0000UL
65#define IOP13XX_PCIX_UPPER_IO_PA (IOP13XX_PCIX_LOWER_IO_PA +\
66 IOP13XX_PCIX_IO_WINDOW_SIZE - 1)
67#define IOP13XX_PCIX_UPPER_IO_VA (IOP13XX_PCIX_LOWER_IO_VA +\
68 IOP13XX_PCIX_IO_WINDOW_SIZE - 1)
69#define IOP13XX_PCIX_IO_OFFSET (IOP13XX_PCIX_LOWER_IO_VA -\
70 IOP13XX_PCIX_LOWER_IO_BA)
71#define IOP13XX_PCIX_IO_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\
72 (IOP13XX_PCIX_LOWER_IO_PA\
73 - IOP13XX_PCIX_LOWER_IO_VA))
74
75#define IOP13XX_PCIX_MEM_PHYS_OFFSET 0x100000000ULL
76#define IOP13XX_PCIX_MEM_WINDOW_SIZE 0x3a000000UL
77#define IOP13XX_PCIX_LOWER_MEM_BA (PHYS_OFFSET + IOP13XX_PCI_OFFSET)
78#define IOP13XX_PCIX_LOWER_MEM_PA (IOP13XX_PCIX_MEM_PHYS_OFFSET +\
79 IOP13XX_PCIX_LOWER_MEM_BA)
80#define IOP13XX_PCIX_UPPER_MEM_PA (IOP13XX_PCIX_LOWER_MEM_PA +\
81 IOP13XX_PCIX_MEM_WINDOW_SIZE - 1)
82#define IOP13XX_PCIX_UPPER_MEM_BA (IOP13XX_PCIX_LOWER_MEM_BA +\
83 IOP13XX_PCIX_MEM_WINDOW_SIZE - 1)
84
85#define IOP13XX_PCIX_MEM_COOKIE 0x80000000UL
86#define IOP13XX_PCIX_LOWER_MEM_RA IOP13XX_PCIX_MEM_COOKIE
87#define IOP13XX_PCIX_UPPER_MEM_RA (IOP13XX_PCIX_LOWER_MEM_RA +\
88 IOP13XX_PCIX_MEM_WINDOW_SIZE - 1)
89#define IOP13XX_PCIX_MEM_OFFSET (IOP13XX_PCIX_MEM_COOKIE -\
90 IOP13XX_PCIX_LOWER_MEM_BA)
91
92/* PCI-E ranges */
93#define IOP13XX_PCIE_IO_WINDOW_SIZE 0x10000UL
94#define IOP13XX_PCIE_LOWER_IO_PA 0xfffd0000UL
95#define IOP13XX_PCIE_LOWER_IO_VA 0xfed70000UL
96#define IOP13XX_PCIE_LOWER_IO_BA 0x0fff0000UL
97#define IOP13XX_PCIE_UPPER_IO_PA (IOP13XX_PCIE_LOWER_IO_PA +\
98 IOP13XX_PCIE_IO_WINDOW_SIZE - 1)
99#define IOP13XX_PCIE_UPPER_IO_VA (IOP13XX_PCIE_LOWER_IO_VA +\
100 IOP13XX_PCIE_IO_WINDOW_SIZE - 1)
101#define IOP13XX_PCIE_UPPER_IO_BA (IOP13XX_PCIE_LOWER_IO_BA +\
102 IOP13XX_PCIE_IO_WINDOW_SIZE - 1)
103#define IOP13XX_PCIE_IO_OFFSET (IOP13XX_PCIE_LOWER_IO_VA -\
104 IOP13XX_PCIE_LOWER_IO_BA)
105#define IOP13XX_PCIE_IO_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\
106 (IOP13XX_PCIE_LOWER_IO_PA\
107 - IOP13XX_PCIE_LOWER_IO_VA))
108
109#define IOP13XX_PCIE_MEM_PHYS_OFFSET 0x200000000ULL
110#define IOP13XX_PCIE_MEM_WINDOW_SIZE 0x3a000000UL
111#define IOP13XX_PCIE_LOWER_MEM_BA (PHYS_OFFSET + IOP13XX_PCI_OFFSET)
112#define IOP13XX_PCIE_LOWER_MEM_PA (IOP13XX_PCIE_MEM_PHYS_OFFSET +\
113 IOP13XX_PCIE_LOWER_MEM_BA)
114#define IOP13XX_PCIE_UPPER_MEM_PA (IOP13XX_PCIE_LOWER_MEM_PA +\
115 IOP13XX_PCIE_MEM_WINDOW_SIZE - 1)
116#define IOP13XX_PCIE_UPPER_MEM_BA (IOP13XX_PCIE_LOWER_MEM_BA +\
117 IOP13XX_PCIE_MEM_WINDOW_SIZE - 1)
118
119/* All 0xc000.0000 - 0xfdff.ffff addresses belong to PCIe */
120#define IOP13XX_PCIE_MEM_COOKIE 0xc0000000UL
121#define IOP13XX_PCIE_LOWER_MEM_RA IOP13XX_PCIE_MEM_COOKIE
122#define IOP13XX_PCIE_UPPER_MEM_RA (IOP13XX_PCIE_LOWER_MEM_RA +\
123 IOP13XX_PCIE_MEM_WINDOW_SIZE - 1)
124#define IOP13XX_PCIE_MEM_OFFSET (IOP13XX_PCIE_MEM_COOKIE -\
125 IOP13XX_PCIE_LOWER_MEM_BA)
126
127/* PBI Ranges */
128#define IOP13XX_PBI_LOWER_MEM_PA 0xf0000000UL
129#define IOP13XX_PBI_MEM_WINDOW_SIZE 0x04000000UL
130#define IOP13XX_PBI_MEM_COOKIE 0xfa000000UL
131#define IOP13XX_PBI_LOWER_MEM_RA IOP13XX_PBI_MEM_COOKIE
132#define IOP13XX_PBI_UPPER_MEM_RA (IOP13XX_PBI_LOWER_MEM_RA +\
133 IOP13XX_PBI_MEM_WINDOW_SIZE - 1)
134
135/*
136 * IOP13XX chipset registers
137 */
138#define IOP13XX_PMMR_PHYS_MEM_BASE 0xffd80000UL /* PMMR phys. address */
139#define IOP13XX_PMMR_VIRT_MEM_BASE 0xfee80000UL /* PMMR phys. address */
140#define IOP13XX_PMMR_MEM_WINDOW_SIZE 0x80000
141#define IOP13XX_PMMR_UPPER_MEM_VA (IOP13XX_PMMR_VIRT_MEM_BASE +\
142 IOP13XX_PMMR_MEM_WINDOW_SIZE - 1)
143#define IOP13XX_PMMR_UPPER_MEM_PA (IOP13XX_PMMR_PHYS_MEM_BASE +\
144 IOP13XX_PMMR_MEM_WINDOW_SIZE - 1)
145#define IOP13XX_PMMR_VIRT_TO_PHYS(addr) (u32) ((u32) addr +\
146 (IOP13XX_PMMR_PHYS_MEM_BASE\
147 - IOP13XX_PMMR_VIRT_MEM_BASE))
148#define IOP13XX_PMMR_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\
149 (IOP13XX_PMMR_PHYS_MEM_BASE\
150 - IOP13XX_PMMR_VIRT_MEM_BASE))
151#define IOP13XX_REG_ADDR32(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
152#define IOP13XX_REG_ADDR16(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
153#define IOP13XX_REG_ADDR8(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
154#define IOP13XX_REG_ADDR32_PHYS(reg) (IOP13XX_PMMR_PHYS_MEM_BASE + (reg))
155#define IOP13XX_REG_ADDR16_PHYS(reg) (IOP13XX_PMMR_PHYS_MEM_BASE + (reg))
156#define IOP13XX_REG_ADDR8_PHYS(reg) (IOP13XX_PMMR_PHYS_MEM_BASE + (reg))
157#define IOP13XX_PMMR_SIZE 0x00080000
158
159/*=================== Defines for Platform Devices =====================*/
160#define IOP13XX_UART0_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002300)
161#define IOP13XX_UART1_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002340)
162#define IOP13XX_UART0_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002300)
163#define IOP13XX_UART1_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002340)
164
165#define IOP13XX_I2C0_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002500)
166#define IOP13XX_I2C1_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002520)
167#define IOP13XX_I2C2_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002540)
168#define IOP13XX_I2C0_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002500)
169#define IOP13XX_I2C1_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002520)
170#define IOP13XX_I2C2_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002540)
171
172/* ATU selection flags */
173/* IOP13XX_INIT_ATU_DEFAULT = Rely on CONFIG_IOP13XX_ATU* */
174#define IOP13XX_INIT_ATU_DEFAULT (0)
175#define IOP13XX_INIT_ATU_ATUX (1 << 0)
176#define IOP13XX_INIT_ATU_ATUE (1 << 1)
177#define IOP13XX_INIT_ATU_NONE (1 << 2)
178
179/* UART selection flags */
180/* IOP13XX_INIT_UART_DEFAULT = Rely on CONFIG_IOP13XX_UART* */
181#define IOP13XX_INIT_UART_DEFAULT (0)
182#define IOP13XX_INIT_UART_0 (1 << 0)
183#define IOP13XX_INIT_UART_1 (1 << 1)
184
185/* I2C selection flags */
186/* IOP13XX_INIT_I2C_DEFAULT = Rely on CONFIG_IOP13XX_I2C* */
187#define IOP13XX_INIT_I2C_DEFAULT (0)
188#define IOP13XX_INIT_I2C_0 (1 << 0)
189#define IOP13XX_INIT_I2C_1 (1 << 1)
190#define IOP13XX_INIT_I2C_2 (1 << 2)
191
192#define IQ81340_NUM_UART 2
193#define IQ81340_NUM_I2C 3
194#define IQ81340_NUM_PHYS_MAP_FLASH 1
195#define IQ81340_MAX_PLAT_DEVICES (IQ81340_NUM_UART +\
196 IQ81340_NUM_I2C +\
197 IQ81340_NUM_PHYS_MAP_FLASH)
198
199/*========================== PMMR offsets for key registers ============*/
200#define IOP13XX_ATU0_PMMR_OFFSET 0x00048000
201#define IOP13XX_ATU1_PMMR_OFFSET 0x0004c000
202#define IOP13XX_ATU2_PMMR_OFFSET 0x0004d000
203#define IOP13XX_ADMA0_PMMR_OFFSET 0x00000000
204#define IOP13XX_ADMA1_PMMR_OFFSET 0x00000200
205#define IOP13XX_ADMA2_PMMR_OFFSET 0x00000400
206#define IOP13XX_PBI_PMMR_OFFSET 0x00001580
207#define IOP13XX_ESSR0_PMMR_OFFSET 0x00002188
208#define IOP13XX_ESSR0 IOP13XX_REG_ADDR32(0x00002188)
209
210#define IOP13XX_ESSR0_IFACE_MASK 0x00004000 /* Interface PCI-X / PCI-E */
211#define IOP13XX_CONTROLLER_ONLY (1 << 14)
212#define IOP13XX_INTERFACE_SEL_PCIX (1 << 15)
213
214#define IOP13XX_PMON_PMMR_OFFSET 0x0001A000
215#define IOP13XX_PMON_BASE (IOP13XX_PMMR_VIRT_MEM_BASE +\
216 IOP13XX_PMON_PMMR_OFFSET)
217#define IOP13XX_PMON_PHYSBASE (IOP13XX_PMMR_PHYS_MEM_BASE +\
218 IOP13XX_PMON_PMMR_OFFSET)
219
220#define IOP13XX_PMON_CMD0 (IOP13XX_PMON_BASE + 0x0)
221#define IOP13XX_PMON_EVR0 (IOP13XX_PMON_BASE + 0x4)
222#define IOP13XX_PMON_STS0 (IOP13XX_PMON_BASE + 0x8)
223#define IOP13XX_PMON_DATA0 (IOP13XX_PMON_BASE + 0xC)
224
225#define IOP13XX_PMON_CMD3 (IOP13XX_PMON_BASE + 0x30)
226#define IOP13XX_PMON_EVR3 (IOP13XX_PMON_BASE + 0x34)
227#define IOP13XX_PMON_STS3 (IOP13XX_PMON_BASE + 0x38)
228#define IOP13XX_PMON_DATA3 (IOP13XX_PMON_BASE + 0x3C)
229
230#define IOP13XX_PMON_CMD7 (IOP13XX_PMON_BASE + 0x70)
231#define IOP13XX_PMON_EVR7 (IOP13XX_PMON_BASE + 0x74)
232#define IOP13XX_PMON_STS7 (IOP13XX_PMON_BASE + 0x78)
233#define IOP13XX_PMON_DATA7 (IOP13XX_PMON_BASE + 0x7C)
234
235#define IOP13XX_PMONEN (IOP13XX_PMMR_VIRT_MEM_BASE + 0x4E040)
236#define IOP13XX_PMONSTAT (IOP13XX_PMMR_VIRT_MEM_BASE + 0x4E044)
237
238/*================================ATU===================================*/
239#define IOP13XX_ATUX_OFFSET(ofs) IOP13XX_REG_ADDR32(\
240 iop13xx_atux_pmmr_offset + (ofs))
241
242#define IOP13XX_ATUX_DID IOP13XX_REG_ADDR16(\
243 iop13xx_atux_pmmr_offset + 0x2)
244
245#define IOP13XX_ATUX_ATUCMD IOP13XX_REG_ADDR16(\
246 iop13xx_atux_pmmr_offset + 0x4)
247#define IOP13XX_ATUX_ATUSR IOP13XX_REG_ADDR16(\
248 iop13xx_atux_pmmr_offset + 0x6)
249
250#define IOP13XX_ATUX_IABAR0 IOP13XX_ATUX_OFFSET(0x10)
251#define IOP13XX_ATUX_IAUBAR0 IOP13XX_ATUX_OFFSET(0x14)
252#define IOP13XX_ATUX_IABAR1 IOP13XX_ATUX_OFFSET(0x18)
253#define IOP13XX_ATUX_IAUBAR1 IOP13XX_ATUX_OFFSET(0x1c)
254#define IOP13XX_ATUX_IABAR2 IOP13XX_ATUX_OFFSET(0x20)
255#define IOP13XX_ATUX_IAUBAR2 IOP13XX_ATUX_OFFSET(0x24)
256#define IOP13XX_ATUX_IALR0 IOP13XX_ATUX_OFFSET(0x40)
257#define IOP13XX_ATUX_IATVR0 IOP13XX_ATUX_OFFSET(0x44)
258#define IOP13XX_ATUX_IAUTVR0 IOP13XX_ATUX_OFFSET(0x48)
259#define IOP13XX_ATUX_IALR1 IOP13XX_ATUX_OFFSET(0x4c)
260#define IOP13XX_ATUX_IATVR1 IOP13XX_ATUX_OFFSET(0x50)
261#define IOP13XX_ATUX_IAUTVR1 IOP13XX_ATUX_OFFSET(0x54)
262#define IOP13XX_ATUX_IALR2 IOP13XX_ATUX_OFFSET(0x58)
263#define IOP13XX_ATUX_IATVR2 IOP13XX_ATUX_OFFSET(0x5c)
264#define IOP13XX_ATUX_IAUTVR2 IOP13XX_ATUX_OFFSET(0x60)
265#define IOP13XX_ATUX_ATUCR IOP13XX_ATUX_OFFSET(0x70)
266#define IOP13XX_ATUX_PCSR IOP13XX_ATUX_OFFSET(0x74)
267#define IOP13XX_ATUX_ATUISR IOP13XX_ATUX_OFFSET(0x78)
268#define IOP13XX_ATUX_PCIXSR IOP13XX_ATUX_OFFSET(0xD4)
269#define IOP13XX_ATUX_IABAR3 IOP13XX_ATUX_OFFSET(0x200)
270#define IOP13XX_ATUX_IAUBAR3 IOP13XX_ATUX_OFFSET(0x204)
271#define IOP13XX_ATUX_IALR3 IOP13XX_ATUX_OFFSET(0x208)
272#define IOP13XX_ATUX_IATVR3 IOP13XX_ATUX_OFFSET(0x20c)
273#define IOP13XX_ATUX_IAUTVR3 IOP13XX_ATUX_OFFSET(0x210)
274
275#define IOP13XX_ATUX_OIOBAR IOP13XX_ATUX_OFFSET(0x300)
276#define IOP13XX_ATUX_OIOWTVR IOP13XX_ATUX_OFFSET(0x304)
277#define IOP13XX_ATUX_OUMBAR0 IOP13XX_ATUX_OFFSET(0x308)
278#define IOP13XX_ATUX_OUMWTVR0 IOP13XX_ATUX_OFFSET(0x30c)
279#define IOP13XX_ATUX_OUMBAR1 IOP13XX_ATUX_OFFSET(0x310)
280#define IOP13XX_ATUX_OUMWTVR1 IOP13XX_ATUX_OFFSET(0x314)
281#define IOP13XX_ATUX_OUMBAR2 IOP13XX_ATUX_OFFSET(0x318)
282#define IOP13XX_ATUX_OUMWTVR2 IOP13XX_ATUX_OFFSET(0x31c)
283#define IOP13XX_ATUX_OUMBAR3 IOP13XX_ATUX_OFFSET(0x320)
284#define IOP13XX_ATUX_OUMWTVR3 IOP13XX_ATUX_OFFSET(0x324)
285#define IOP13XX_ATUX_OUDMABAR IOP13XX_ATUX_OFFSET(0x328)
286#define IOP13XX_ATUX_OUMSIBAR IOP13XX_ATUX_OFFSET(0x32c)
287#define IOP13XX_ATUX_OCCAR IOP13XX_ATUX_OFFSET(0x330)
288#define IOP13XX_ATUX_OCCDR IOP13XX_ATUX_OFFSET(0x334)
289
290#define IOP13XX_ATUX_ATUCR_OUT_EN (1 << 1)
291#define IOP13XX_ATUX_PCSR_CENTRAL_RES (1 << 25)
292#define IOP13XX_ATUX_PCSR_P_RSTOUT (1 << 21)
293#define IOP13XX_ATUX_PCSR_OUT_Q_BUSY (1 << 15)
294#define IOP13XX_ATUX_PCSR_IN_Q_BUSY (1 << 14)
295#define IOP13XX_ATUX_PCSR_FREQ_OFFSET (16)
296
297#define IOP13XX_ATUX_STAT_PCI_IFACE_ERR (1 << 18)
298#define IOP13XX_ATUX_STAT_VPD_ADDR (1 << 17)
299#define IOP13XX_ATUX_STAT_INT_PAR_ERR (1 << 16)
300#define IOP13XX_ATUX_STAT_CFG_WRITE (1 << 15)
301#define IOP13XX_ATUX_STAT_ERR_COR (1 << 14)
302#define IOP13XX_ATUX_STAT_TX_SCEM (1 << 13)
303#define IOP13XX_ATUX_STAT_REC_SCEM (1 << 12)
304#define IOP13XX_ATUX_STAT_POWER_TRAN (1 << 11)
305#define IOP13XX_ATUX_STAT_TX_SERR (1 << 10)
306#define IOP13XX_ATUX_STAT_DET_PAR_ERR (1 << 9 )
307#define IOP13XX_ATUX_STAT_BIST (1 << 8 )
308#define IOP13XX_ATUX_STAT_INT_REC_MABORT (1 << 7 )
309#define IOP13XX_ATUX_STAT_REC_SERR (1 << 4 )
310#define IOP13XX_ATUX_STAT_EXT_REC_MABORT (1 << 3 )
311#define IOP13XX_ATUX_STAT_EXT_REC_TABORT (1 << 2 )
312#define IOP13XX_ATUX_STAT_EXT_SIG_TABORT (1 << 1 )
313#define IOP13XX_ATUX_STAT_MASTER_DATA_PAR (1 << 0 )
314
315#define IOP13XX_ATUX_PCIXSR_BUS_NUM (8)
316#define IOP13XX_ATUX_PCIXSR_DEV_NUM (3)
317#define IOP13XX_ATUX_PCIXSR_FUNC_NUM (0)
318
319#define IOP13XX_ATUX_IALR_DISABLE 0x00000001
320#define IOP13XX_ATUX_OUMBAR_ENABLE 0x80000000
321
322#define IOP13XX_ATUE_OFFSET(ofs) IOP13XX_REG_ADDR32(\
323 iop13xx_atue_pmmr_offset + (ofs))
324
325#define IOP13XX_ATUE_DID IOP13XX_REG_ADDR16(\
326 iop13xx_atue_pmmr_offset + 0x2)
327#define IOP13XX_ATUE_ATUCMD IOP13XX_REG_ADDR16(\
328 iop13xx_atue_pmmr_offset + 0x4)
329#define IOP13XX_ATUE_ATUSR IOP13XX_REG_ADDR16(\
330 iop13xx_atue_pmmr_offset + 0x6)
331
332#define IOP13XX_ATUE_IABAR0 IOP13XX_ATUE_OFFSET(0x10)
333#define IOP13XX_ATUE_IAUBAR0 IOP13XX_ATUE_OFFSET(0x14)
334#define IOP13XX_ATUE_IABAR1 IOP13XX_ATUE_OFFSET(0x18)
335#define IOP13XX_ATUE_IAUBAR1 IOP13XX_ATUE_OFFSET(0x1c)
336#define IOP13XX_ATUE_IABAR2 IOP13XX_ATUE_OFFSET(0x20)
337#define IOP13XX_ATUE_IAUBAR2 IOP13XX_ATUE_OFFSET(0x24)
338#define IOP13XX_ATUE_IALR0 IOP13XX_ATUE_OFFSET(0x40)
339#define IOP13XX_ATUE_IATVR0 IOP13XX_ATUE_OFFSET(0x44)
340#define IOP13XX_ATUE_IAUTVR0 IOP13XX_ATUE_OFFSET(0x48)
341#define IOP13XX_ATUE_IALR1 IOP13XX_ATUE_OFFSET(0x4c)
342#define IOP13XX_ATUE_IATVR1 IOP13XX_ATUE_OFFSET(0x50)
343#define IOP13XX_ATUE_IAUTVR1 IOP13XX_ATUE_OFFSET(0x54)
344#define IOP13XX_ATUE_IALR2 IOP13XX_ATUE_OFFSET(0x58)
345#define IOP13XX_ATUE_IATVR2 IOP13XX_ATUE_OFFSET(0x5c)
346#define IOP13XX_ATUE_IAUTVR2 IOP13XX_ATUE_OFFSET(0x60)
347#define IOP13XX_ATUE_PE_LSTS IOP13XX_REG_ADDR16(\
348 iop13xx_atue_pmmr_offset + 0xe2)
349#define IOP13XX_ATUE_OIOWTVR IOP13XX_ATUE_OFFSET(0x304)
350#define IOP13XX_ATUE_OUMBAR0 IOP13XX_ATUE_OFFSET(0x308)
351#define IOP13XX_ATUE_OUMWTVR0 IOP13XX_ATUE_OFFSET(0x30c)
352#define IOP13XX_ATUE_OUMBAR1 IOP13XX_ATUE_OFFSET(0x310)
353#define IOP13XX_ATUE_OUMWTVR1 IOP13XX_ATUE_OFFSET(0x314)
354#define IOP13XX_ATUE_OUMBAR2 IOP13XX_ATUE_OFFSET(0x318)
355#define IOP13XX_ATUE_OUMWTVR2 IOP13XX_ATUE_OFFSET(0x31c)
356#define IOP13XX_ATUE_OUMBAR3 IOP13XX_ATUE_OFFSET(0x320)
357#define IOP13XX_ATUE_OUMWTVR3 IOP13XX_ATUE_OFFSET(0x324)
358
359#define IOP13XX_ATUE_ATUCR IOP13XX_ATUE_OFFSET(0x70)
360#define IOP13XX_ATUE_PCSR IOP13XX_ATUE_OFFSET(0x74)
361#define IOP13XX_ATUE_ATUISR IOP13XX_ATUE_OFFSET(0x78)
362#define IOP13XX_ATUE_OIOBAR IOP13XX_ATUE_OFFSET(0x300)
363#define IOP13XX_ATUE_OCCAR IOP13XX_ATUE_OFFSET(0x32c)
364#define IOP13XX_ATUE_OCCDR IOP13XX_ATUE_OFFSET(0x330)
365
366#define IOP13XX_ATUE_PIE_STS IOP13XX_ATUE_OFFSET(0x384)
367#define IOP13XX_ATUE_PIE_MSK IOP13XX_ATUE_OFFSET(0x388)
368
369#define IOP13XX_ATUE_ATUCR_IVM (1 << 6)
370#define IOP13XX_ATUE_ATUCR_OUT_EN (1 << 1)
371#define IOP13XX_ATUE_OCCAR_BUS_NUM (24)
372#define IOP13XX_ATUE_OCCAR_DEV_NUM (19)
373#define IOP13XX_ATUE_OCCAR_FUNC_NUM (16)
374#define IOP13XX_ATUE_OCCAR_EXT_REG (8)
375#define IOP13XX_ATUE_OCCAR_REG (2)
376
377#define IOP13XX_ATUE_PCSR_BUS_NUM (24)
378#define IOP13XX_ATUE_PCSR_DEV_NUM (19)
379#define IOP13XX_ATUE_PCSR_FUNC_NUM (16)
380#define IOP13XX_ATUE_PCSR_OUT_Q_BUSY (1 << 15)
381#define IOP13XX_ATUE_PCSR_IN_Q_BUSY (1 << 14)
382#define IOP13XX_ATUE_PCSR_END_POINT (1 << 13)
383#define IOP13XX_ATUE_PCSR_LLRB_BUSY (1 << 12)
384
385#define IOP13XX_ATUE_PCSR_BUS_NUM_MASK (0xff)
386#define IOP13XX_ATUE_PCSR_DEV_NUM_MASK (0x1f)
387#define IOP13XX_ATUE_PCSR_FUNC_NUM_MASK (0x7)
388
389#define IOP13XX_ATUE_PCSR_CORE_RESET (8)
390#define IOP13XX_ATUE_PCSR_FUNC_NUM (16)
391
392#define IOP13XX_ATUE_LSTS_TRAINING (1 << 11)
393#define IOP13XX_ATUE_STAT_SLOT_PWR_MSG (1 << 28)
394#define IOP13XX_ATUE_STAT_PME (1 << 27)
395#define IOP13XX_ATUE_STAT_HOT_PLUG_MSG (1 << 26)
396#define IOP13XX_ATUE_STAT_IVM (1 << 25)
397#define IOP13XX_ATUE_STAT_BIST (1 << 24)
398#define IOP13XX_ATUE_STAT_CFG_WRITE (1 << 18)
399#define IOP13XX_ATUE_STAT_VPD_ADDR (1 << 17)
400#define IOP13XX_ATUE_STAT_POWER_TRAN (1 << 16)
401#define IOP13XX_ATUE_STAT_HALT_ON_ERROR (1 << 13)
402#define IOP13XX_ATUE_STAT_ROOT_SYS_ERR (1 << 12)
403#define IOP13XX_ATUE_STAT_ROOT_ERR_MSG (1 << 11)
404#define IOP13XX_ATUE_STAT_PCI_IFACE_ERR (1 << 10)
405#define IOP13XX_ATUE_STAT_ERR_COR (1 << 9 )
406#define IOP13XX_ATUE_STAT_ERR_UNCOR (1 << 8 )
407#define IOP13XX_ATUE_STAT_CRS (1 << 7 )
408#define IOP13XX_ATUE_STAT_LNK_DWN (1 << 6 )
409#define IOP13XX_ATUE_STAT_INT_REC_MABORT (1 << 5 )
410#define IOP13XX_ATUE_STAT_DET_PAR_ERR (1 << 4 )
411#define IOP13XX_ATUE_STAT_EXT_REC_MABORT (1 << 3 )
412#define IOP13XX_ATUE_STAT_SIG_TABORT (1 << 2 )
413#define IOP13XX_ATUE_STAT_EXT_REC_TABORT (1 << 1 )
414#define IOP13XX_ATUE_STAT_MASTER_DATA_PAR (1 << 0 )
415
416#define IOP13XX_ATUE_ESTAT_REC_UNSUPPORTED_COMP_REQ (1 << 31)
417#define IOP13XX_ATUE_ESTAT_REC_COMPLETER_ABORT (1 << 30)
418#define IOP13XX_ATUE_ESTAT_TX_POISONED_TLP (1 << 29)
419#define IOP13XX_ATUE_ESTAT_TX_PAR_ERR (1 << 28)
420#define IOP13XX_ATUE_ESTAT_REC_UNSUPPORTED_REQ (1 << 20)
421#define IOP13XX_ATUE_ESTAT_REC_ECRC_ERR (1 << 19)
422#define IOP13XX_ATUE_ESTAT_REC_MALFORMED_TLP (1 << 18)
423#define IOP13XX_ATUE_ESTAT_TX_RECEIVER_OVERFLOW (1 << 17)
424#define IOP13XX_ATUE_ESTAT_REC_UNEXPECTED_COMP (1 << 16)
425#define IOP13XX_ATUE_ESTAT_INT_COMP_ABORT (1 << 15)
426#define IOP13XX_ATUE_ESTAT_COMP_TIMEOUT (1 << 14)
427#define IOP13XX_ATUE_ESTAT_FLOW_CONTROL_ERR (1 << 13)
428#define IOP13XX_ATUE_ESTAT_REC_POISONED_TLP (1 << 12)
429#define IOP13XX_ATUE_ESTAT_DATA_LNK_ERR (1 << 4 )
430#define IOP13XX_ATUE_ESTAT_TRAINING_ERR (1 << 0 )
431
432#define IOP13XX_ATUE_IALR_DISABLE (0x00000001)
433#define IOP13XX_ATUE_OUMBAR_ENABLE (0x80000000)
434#define IOP13XX_ATU_OUMBAR_FUNC_NUM (28)
435#define IOP13XX_ATU_OUMBAR_FUNC_NUM_MASK (0x7)
436/*=======================================================================*/
437
438/*==============================ADMA UNITS===============================*/
439#define IOP13XX_ADMA_PHYS_BASE(chan) IOP13XX_REG_ADDR32_PHYS((chan << 9))
440#define IOP13XX_ADMA_UPPER_PA(chan) (IOP13XX_ADMA_PHYS_BASE(chan) + 0xc0)
441#define IOP13XX_ADMA_OFFSET(chan, ofs) IOP13XX_REG_ADDR32((chan << 9) + (ofs))
442
443#define IOP13XX_ADMA_ACCR(chan) IOP13XX_ADMA_OFFSET(chan, 0x0)
444#define IOP13XX_ADMA_ACSR(chan) IOP13XX_ADMA_OFFSET(chan, 0x4)
445#define IOP13XX_ADMA_ADAR(chan) IOP13XX_ADMA_OFFSET(chan, 0x8)
446#define IOP13XX_ADMA_IIPCR(chan) IOP13XX_ADMA_OFFSET(chan, 0x18)
447#define IOP13XX_ADMA_IIPAR(chan) IOP13XX_ADMA_OFFSET(chan, 0x1c)
448#define IOP13XX_ADMA_IIPUAR(chan) IOP13XX_ADMA_OFFSET(chan, 0x20)
449#define IOP13XX_ADMA_ANDAR(chan) IOP13XX_ADMA_OFFSET(chan, 0x24)
450#define IOP13XX_ADMA_ADCR(chan) IOP13XX_ADMA_OFFSET(chan, 0x28)
451#define IOP13XX_ADMA_CARMD(chan) IOP13XX_ADMA_OFFSET(chan, 0x2c)
452#define IOP13XX_ADMA_ABCR(chan) IOP13XX_ADMA_OFFSET(chan, 0x30)
453#define IOP13XX_ADMA_DLADR(chan) IOP13XX_ADMA_OFFSET(chan, 0x34)
454#define IOP13XX_ADMA_DUADR(chan) IOP13XX_ADMA_OFFSET(chan, 0x38)
455#define IOP13XX_ADMA_SLAR(src, chan) IOP13XX_ADMA_OFFSET(chan, 0x3c + (src <<3))
456#define IOP13XX_ADMA_SUAR(src, chan) IOP13XX_ADMA_OFFSET(chan, 0x40 + (src <<3))
457
458/*==============================XSI BRIDGE===============================*/
459#define IOP13XX_XBG_BECSR IOP13XX_REG_ADDR32(0x178c)
460#define IOP13XX_XBG_BERAR IOP13XX_REG_ADDR32(0x1790)
461#define IOP13XX_XBG_BERUAR IOP13XX_REG_ADDR32(0x1794)
462#define is_atue_occdr_error(x) ((__raw_readl(IOP13XX_XBG_BERAR) == \
463 IOP13XX_PMMR_VIRT_TO_PHYS(\
464 IOP13XX_ATUE_OCCDR))\
465 && (__raw_readl(IOP13XX_XBG_BECSR) & 1))
466#define is_atux_occdr_error(x) ((__raw_readl(IOP13XX_XBG_BERAR) == \
467 IOP13XX_PMMR_VIRT_TO_PHYS(\
468 IOP13XX_ATUX_OCCDR))\
469 && (__raw_readl(IOP13XX_XBG_BECSR) & 1))
470/*=======================================================================*/
471
472#define IOP13XX_PBI_OFFSET(ofs) IOP13XX_REG_ADDR32(IOP13XX_PBI_PMMR_OFFSET +\
473 (ofs))
474
475#define IOP13XX_PBI_CR IOP13XX_PBI_OFFSET(0x0)
476#define IOP13XX_PBI_SR IOP13XX_PBI_OFFSET(0x4)
477#define IOP13XX_PBI_BAR0 IOP13XX_PBI_OFFSET(0x8)
478#define IOP13XX_PBI_LR0 IOP13XX_PBI_OFFSET(0xc)
479#define IOP13XX_PBI_BAR1 IOP13XX_PBI_OFFSET(0x10)
480#define IOP13XX_PBI_LR1 IOP13XX_PBI_OFFSET(0x14)
481
482#define IOP13XX_TMR_TC 0x01
483#define IOP13XX_TMR_EN 0x02
484#define IOP13XX_TMR_RELOAD 0x04
485#define IOP13XX_TMR_PRIVILEGED 0x08
486
487#define IOP13XX_TMR_RATIO_1_1 0x00
488#define IOP13XX_TMR_RATIO_4_1 0x10
489#define IOP13XX_TMR_RATIO_8_1 0x20
490#define IOP13XX_TMR_RATIO_16_1 0x30
491
492#endif /* _IOP13XX_HW_H_ */
diff --git a/include/asm-arm/arch-iop13xx/iq81340.h b/include/asm-arm/arch-iop13xx/iq81340.h
new file mode 100644
index 000000000000..b98f8f109c22
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/iq81340.h
@@ -0,0 +1,31 @@
1#ifndef _IQ81340_H_
2#define _IQ81340_H_
3
4#define IQ81340_PCE_BAR0 IOP13XX_PBI_LOWER_MEM_RA
5#define IQ81340_PCE_BAR1 (IQ81340_PCE_BAR0 + 0x02000000)
6
7#define IQ81340_FLASHBASE IQ81340_PCE_BAR0 /* Flash */
8
9#define IQ81340_PCE_BAR1_OFFSET(a) (IQ81340_PCE_BAR1 + (a))
10
11#define IQ81340_PRD_CODE IQ81340_PCE_BAR1_OFFSET(0)
12#define IQ81340_BRD_STEP IQ81340_PCE_BAR1_OFFSET(0x10000)
13#define IQ81340_CPLD_REV IQ81340_PCE_BAR1_OFFSET(0x20000)
14#define IQ81340_LED IQ81340_PCE_BAR1_OFFSET(0x30000)
15#define IQ81340_LHEX IQ81340_PCE_BAR1_OFFSET(0x40000)
16#define IQ81340_RHEX IQ81340_PCE_BAR1_OFFSET(0x50000)
17#define IQ81340_BUZZER IQ81340_PCE_BAR1_OFFSET(0x60000)
18#define IQ81340_32K_NVRAM IQ81340_PCE_BAR1_OFFSET(0x70000)
19#define IQ81340_256K_NVRAM IQ81340_PCE_BAR1_OFFSET(0x80000)
20#define IQ81340_ROTARY_SW IQ81340_PCE_BAR1_OFFSET(0xd0000)
21#define IQ81340_BATT_STAT IQ81340_PCE_BAR1_OFFSET(0xf0000)
22#define IQ81340_CMP_FLSH IQ81340_PCE_BAR1_OFFSET(0x1000000) /* 16MB */
23
24#define PBI_CF_IDE_BASE (IQ81340_CMP_FLSH)
25#define PBI_CF_BAR_ADDR (IOP13XX_PBI_BAR1)
26
27/* These are the values used in the Machine description */
28#define PHYS_IO 0xfeffff00
29#define IO_PG_OFFSET 0xffffff00
30#define BOOT_PARAM_OFFSET 0x00000100
31#endif /* _IQ81340_H_ */
diff --git a/include/asm-arm/arch-iop13xx/irqs.h b/include/asm-arm/arch-iop13xx/irqs.h
new file mode 100644
index 000000000000..442e35a40359
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/irqs.h
@@ -0,0 +1,207 @@
1#ifndef _IOP13XX_IRQS_H_
2#define _IOP13XX_IRQS_H_
3
4#ifndef __ASSEMBLER__
5#include <linux/types.h>
6#include <asm/system.h> /* local_irq_save */
7#include <asm/arch/iop13xx.h> /* iop13xx_cp6_* */
8
9/* INTPND0 CP6 R0 Page 3
10 */
11static inline u32 read_intpnd_0(void)
12{
13 u32 val;
14 asm volatile("mrc p6, 0, %0, c0, c3, 0":"=r" (val));
15 return val;
16}
17
18/* INTPND1 CP6 R1 Page 3
19 */
20static inline u32 read_intpnd_1(void)
21{
22 u32 val;
23 asm volatile("mrc p6, 0, %0, c1, c3, 0":"=r" (val));
24 return val;
25}
26
27/* INTPND2 CP6 R2 Page 3
28 */
29static inline u32 read_intpnd_2(void)
30{
31 u32 val;
32 asm volatile("mrc p6, 0, %0, c2, c3, 0":"=r" (val));
33 return val;
34}
35
36/* INTPND3 CP6 R3 Page 3
37 */
38static inline u32 read_intpnd_3(void)
39{
40 u32 val;
41 asm volatile("mrc p6, 0, %0, c3, c3, 0":"=r" (val));
42 return val;
43}
44
45static inline void
46iop13xx_cp6_enable_irq_save(unsigned long *cp_flags, unsigned long *irq_flags)
47{
48 local_irq_save(*irq_flags);
49 *cp_flags = iop13xx_cp6_save();
50}
51
52static inline void
53iop13xx_cp6_irq_restore(unsigned long *cp_flags,
54 unsigned long *irq_flags)
55{
56 iop13xx_cp6_restore(*cp_flags);
57 local_irq_restore(*irq_flags);
58}
59#endif
60
61#define INTBASE 0
62#define INTSIZE_4 1
63
64/*
65 * iop34x chipset interrupts
66 */
67#define IOP13XX_IRQ(x) (IOP13XX_IRQ_OFS + (x))
68
69/*
70 * On IRQ or FIQ register
71 */
72#define IRQ_IOP13XX_ADMA0_EOT (0)
73#define IRQ_IOP13XX_ADMA0_EOC (1)
74#define IRQ_IOP13XX_ADMA1_EOT (2)
75#define IRQ_IOP13XX_ADMA1_EOC (3)
76#define IRQ_IOP13XX_ADMA2_EOT (4)
77#define IRQ_IOP13XX_ADMA2_EOC (5)
78#define IRQ_IOP134_WATCHDOG (6)
79#define IRQ_IOP13XX_RSVD_7 (7)
80#define IRQ_IOP13XX_TIMER0 (8)
81#define IRQ_IOP13XX_TIMER1 (9)
82#define IRQ_IOP13XX_I2C_0 (10)
83#define IRQ_IOP13XX_I2C_1 (11)
84#define IRQ_IOP13XX_MSG (12)
85#define IRQ_IOP13XX_MSGIBQ (13)
86#define IRQ_IOP13XX_ATU_IM (14)
87#define IRQ_IOP13XX_ATU_BIST (15)
88#define IRQ_IOP13XX_PPMU (16)
89#define IRQ_IOP13XX_COREPMU (17)
90#define IRQ_IOP13XX_CORECACHE (18)
91#define IRQ_IOP13XX_RSVD_19 (19)
92#define IRQ_IOP13XX_RSVD_20 (20)
93#define IRQ_IOP13XX_RSVD_21 (21)
94#define IRQ_IOP13XX_RSVD_22 (22)
95#define IRQ_IOP13XX_RSVD_23 (23)
96#define IRQ_IOP13XX_XINT0 (24)
97#define IRQ_IOP13XX_XINT1 (25)
98#define IRQ_IOP13XX_XINT2 (26)
99#define IRQ_IOP13XX_XINT3 (27)
100#define IRQ_IOP13XX_XINT4 (28)
101#define IRQ_IOP13XX_XINT5 (29)
102#define IRQ_IOP13XX_XINT6 (30)
103#define IRQ_IOP13XX_XINT7 (31)
104 /* IINTSRC1 bit */
105#define IRQ_IOP13XX_XINT8 (32) /* 0 */
106#define IRQ_IOP13XX_XINT9 (33) /* 1 */
107#define IRQ_IOP13XX_XINT10 (34) /* 2 */
108#define IRQ_IOP13XX_XINT11 (35) /* 3 */
109#define IRQ_IOP13XX_XINT12 (36) /* 4 */
110#define IRQ_IOP13XX_XINT13 (37) /* 5 */
111#define IRQ_IOP13XX_XINT14 (38) /* 6 */
112#define IRQ_IOP13XX_XINT15 (39) /* 7 */
113#define IRQ_IOP13XX_RSVD_40 (40) /* 8 */
114#define IRQ_IOP13XX_RSVD_41 (41) /* 9 */
115#define IRQ_IOP13XX_RSVD_42 (42) /* 10 */
116#define IRQ_IOP13XX_RSVD_43 (43) /* 11 */
117#define IRQ_IOP13XX_RSVD_44 (44) /* 12 */
118#define IRQ_IOP13XX_RSVD_45 (45) /* 13 */
119#define IRQ_IOP13XX_RSVD_46 (46) /* 14 */
120#define IRQ_IOP13XX_RSVD_47 (47) /* 15 */
121#define IRQ_IOP13XX_RSVD_48 (48) /* 16 */
122#define IRQ_IOP13XX_RSVD_49 (49) /* 17 */
123#define IRQ_IOP13XX_RSVD_50 (50) /* 18 */
124#define IRQ_IOP13XX_UART0 (51) /* 19 */
125#define IRQ_IOP13XX_UART1 (52) /* 20 */
126#define IRQ_IOP13XX_PBIE (53) /* 21 */
127#define IRQ_IOP13XX_ATU_CRW (54) /* 22 */
128#define IRQ_IOP13XX_ATU_ERR (55) /* 23 */
129#define IRQ_IOP13XX_MCU_ERR (56) /* 24 */
130#define IRQ_IOP13XX_ADMA0_ERR (57) /* 25 */
131#define IRQ_IOP13XX_ADMA1_ERR (58) /* 26 */
132#define IRQ_IOP13XX_ADMA2_ERR (59) /* 27 */
133#define IRQ_IOP13XX_RSVD_60 (60) /* 28 */
134#define IRQ_IOP13XX_RSVD_61 (61) /* 29 */
135#define IRQ_IOP13XX_MSG_ERR (62) /* 30 */
136#define IRQ_IOP13XX_RSVD_63 (63) /* 31 */
137 /* IINTSRC2 bit */
138#define IRQ_IOP13XX_INTERPROC (64) /* 0 */
139#define IRQ_IOP13XX_RSVD_65 (65) /* 1 */
140#define IRQ_IOP13XX_RSVD_66 (66) /* 2 */
141#define IRQ_IOP13XX_RSVD_67 (67) /* 3 */
142#define IRQ_IOP13XX_RSVD_68 (68) /* 4 */
143#define IRQ_IOP13XX_RSVD_69 (69) /* 5 */
144#define IRQ_IOP13XX_RSVD_70 (70) /* 6 */
145#define IRQ_IOP13XX_RSVD_71 (71) /* 7 */
146#define IRQ_IOP13XX_RSVD_72 (72) /* 8 */
147#define IRQ_IOP13XX_RSVD_73 (73) /* 9 */
148#define IRQ_IOP13XX_RSVD_74 (74) /* 10 */
149#define IRQ_IOP13XX_RSVD_75 (75) /* 11 */
150#define IRQ_IOP13XX_RSVD_76 (76) /* 12 */
151#define IRQ_IOP13XX_RSVD_77 (77) /* 13 */
152#define IRQ_IOP13XX_RSVD_78 (78) /* 14 */
153#define IRQ_IOP13XX_RSVD_79 (79) /* 15 */
154#define IRQ_IOP13XX_RSVD_80 (80) /* 16 */
155#define IRQ_IOP13XX_RSVD_81 (81) /* 17 */
156#define IRQ_IOP13XX_RSVD_82 (82) /* 18 */
157#define IRQ_IOP13XX_RSVD_83 (83) /* 19 */
158#define IRQ_IOP13XX_RSVD_84 (84) /* 20 */
159#define IRQ_IOP13XX_RSVD_85 (85) /* 21 */
160#define IRQ_IOP13XX_RSVD_86 (86) /* 22 */
161#define IRQ_IOP13XX_RSVD_87 (87) /* 23 */
162#define IRQ_IOP13XX_RSVD_88 (88) /* 24 */
163#define IRQ_IOP13XX_RSVD_89 (89) /* 25 */
164#define IRQ_IOP13XX_RSVD_90 (90) /* 26 */
165#define IRQ_IOP13XX_RSVD_91 (91) /* 27 */
166#define IRQ_IOP13XX_RSVD_92 (92) /* 28 */
167#define IRQ_IOP13XX_RSVD_93 (93) /* 29 */
168#define IRQ_IOP13XX_SIB_ERR (94) /* 30 */
169#define IRQ_IOP13XX_SRAM_ERR (95) /* 31 */
170 /* IINTSRC3 bit */
171#define IRQ_IOP13XX_I2C_2 (96) /* 0 */
172#define IRQ_IOP13XX_ATUE_BIST (97) /* 1 */
173#define IRQ_IOP13XX_ATUE_CRW (98) /* 2 */
174#define IRQ_IOP13XX_ATUE_ERR (99) /* 3 */
175#define IRQ_IOP13XX_IMU (100) /* 4 */
176#define IRQ_IOP13XX_RSVD_101 (101) /* 5 */
177#define IRQ_IOP13XX_RSVD_102 (102) /* 6 */
178#define IRQ_IOP13XX_TPMI0_OUT (103) /* 7 */
179#define IRQ_IOP13XX_TPMI1_OUT (104) /* 8 */
180#define IRQ_IOP13XX_TPMI2_OUT (105) /* 9 */
181#define IRQ_IOP13XX_TPMI3_OUT (106) /* 10 */
182#define IRQ_IOP13XX_ATUE_IMA (107) /* 11 */
183#define IRQ_IOP13XX_ATUE_IMB (108) /* 12 */
184#define IRQ_IOP13XX_ATUE_IMC (109) /* 13 */
185#define IRQ_IOP13XX_ATUE_IMD (110) /* 14 */
186#define IRQ_IOP13XX_MU_MSI_TB (111) /* 15 */
187#define IRQ_IOP13XX_RSVD_112 (112) /* 16 */
188#define IRQ_IOP13XX_RSVD_113 (113) /* 17 */
189#define IRQ_IOP13XX_RSVD_114 (114) /* 18 */
190#define IRQ_IOP13XX_RSVD_115 (115) /* 19 */
191#define IRQ_IOP13XX_RSVD_116 (116) /* 20 */
192#define IRQ_IOP13XX_RSVD_117 (117) /* 21 */
193#define IRQ_IOP13XX_RSVD_118 (118) /* 22 */
194#define IRQ_IOP13XX_RSVD_119 (119) /* 23 */
195#define IRQ_IOP13XX_RSVD_120 (120) /* 24 */
196#define IRQ_IOP13XX_RSVD_121 (121) /* 25 */
197#define IRQ_IOP13XX_RSVD_122 (122) /* 26 */
198#define IRQ_IOP13XX_RSVD_123 (123) /* 27 */
199#define IRQ_IOP13XX_RSVD_124 (124) /* 28 */
200#define IRQ_IOP13XX_RSVD_125 (125) /* 29 */
201#define IRQ_IOP13XX_RSVD_126 (126) /* 30 */
202#define IRQ_IOP13XX_HPI (127) /* 31 */
203
204#define NR_IOP13XX_IRQS (IRQ_IOP13XX_HPI + 1)
205#define NR_IRQS NR_IOP13XX_IRQS
206
207#endif /* _IOP13XX_IRQ_H_ */
diff --git a/include/asm-arm/arch-iop13xx/memory.h b/include/asm-arm/arch-iop13xx/memory.h
new file mode 100644
index 000000000000..031a0fa78eff
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/memory.h
@@ -0,0 +1,64 @@
1#ifndef __ASM_ARCH_MEMORY_H
2#define __ASM_ARCH_MEMORY_H
3
4#include <asm/arch/hardware.h>
5
6/*
7 * Physical DRAM offset.
8 */
9#define PHYS_OFFSET UL(0x00000000)
10#define TASK_SIZE UL(0x3f000000)
11#define PAGE_OFFSET UL(0x40000000)
12#define TASK_UNMAPPED_BASE ((TASK_SIZE + 0x01000000) / 3)
13
14#ifndef __ASSEMBLY__
15
16#if defined(CONFIG_ARCH_IOP13XX)
17#define IOP13XX_PMMR_V_START (IOP13XX_PMMR_VIRT_MEM_BASE)
18#define IOP13XX_PMMR_V_END (IOP13XX_PMMR_VIRT_MEM_BASE + IOP13XX_PMMR_SIZE)
19#define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE)
20#define IOP13XX_PMMR_P_END (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE)
21
22/*
23 * Virtual view <-> PCI DMA view memory address translations
24 * virt_to_bus: Used to translate the virtual address to an
25 * address suitable to be passed to set_dma_addr
26 * bus_to_virt: Used to convert an address for DMA operations
27 * to an address that the kernel can use.
28 */
29
30/* RAM has 1:1 mapping on the PCIe/x Busses */
31#define __virt_to_bus(x) (__virt_to_phys(x))
32#define __bus_to_virt(x) (__phys_to_virt(x))
33
34#define virt_to_lbus(x) \
35(( ((void*)(x) >= (void*)IOP13XX_PMMR_V_START) && \
36((void*)(x) < (void*)IOP13XX_PMMR_V_END) ) ? \
37((x) - IOP13XX_PMMR_VIRT_MEM_BASE + IOP13XX_PMMR_PHYS_MEM_BASE) : \
38((x) - PAGE_OFFSET + PHYS_OFFSET))
39
40#define lbus_to_virt(x) \
41(( ((x) >= IOP13XX_PMMR_P_START) && ((x) < IOP13XX_PMMR_P_END) ) ? \
42((x) - IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_VIRT_MEM_BASE ) : \
43((x) - PHYS_OFFSET + PAGE_OFFSET))
44
45/* Device is an lbus device if it is on the platform bus of the IOP13XX */
46#define is_lbus_device(dev) (dev &&\
47 (strncmp(dev->bus->name, "platform", 8) == 0))
48
49#define __arch_page_to_dma(dev, page) \
50({is_lbus_device(dev) ? (dma_addr_t)virt_to_lbus(page_address(page)) : \
51(dma_addr_t)__virt_to_bus(page_address(page));})
52
53#define __arch_dma_to_virt(dev, addr) \
54({is_lbus_device(dev) ? lbus_to_virt(addr) : __bus_to_virt(addr);})
55
56#define __arch_virt_to_dma(dev, addr) \
57({is_lbus_device(dev) ? virt_to_lbus(addr) : __virt_to_bus(addr);})
58
59#endif /* CONFIG_ARCH_IOP13XX */
60#endif /* !ASSEMBLY */
61
62#define PFN_TO_NID(addr) (0)
63
64#endif
diff --git a/include/asm-arm/arch-iop13xx/pci.h b/include/asm-arm/arch-iop13xx/pci.h
new file mode 100644
index 000000000000..4041f30d4cd3
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/pci.h
@@ -0,0 +1,57 @@
1#ifndef _IOP13XX_PCI_H_
2#define _IOP13XX_PCI_H_
3#include <asm/arch/irqs.h>
4#include <asm/io.h>
5
6struct pci_sys_data;
7struct hw_pci;
8int iop13xx_pci_setup(int nr, struct pci_sys_data *sys);
9struct pci_bus *iop13xx_scan_bus(int nr, struct pci_sys_data *);
10void iop13xx_atu_select(struct hw_pci *plat_pci);
11void iop13xx_pci_init(void);
12void iop13xx_map_pci_memory(void);
13
14#define IOP_PCI_STATUS_ERROR (PCI_STATUS_PARITY | \
15 PCI_STATUS_SIG_TARGET_ABORT | \
16 PCI_STATUS_REC_TARGET_ABORT | \
17 PCI_STATUS_REC_TARGET_ABORT | \
18 PCI_STATUS_REC_MASTER_ABORT | \
19 PCI_STATUS_SIG_SYSTEM_ERROR | \
20 PCI_STATUS_DETECTED_PARITY)
21
22#define IOP13XX_ATUE_ATUISR_ERROR (IOP13XX_ATUE_STAT_HALT_ON_ERROR | \
23 IOP13XX_ATUE_STAT_ROOT_SYS_ERR | \
24 IOP13XX_ATUE_STAT_PCI_IFACE_ERR | \
25 IOP13XX_ATUE_STAT_ERR_COR | \
26 IOP13XX_ATUE_STAT_ERR_UNCOR | \
27 IOP13XX_ATUE_STAT_CRS | \
28 IOP13XX_ATUE_STAT_DET_PAR_ERR | \
29 IOP13XX_ATUE_STAT_EXT_REC_MABORT | \
30 IOP13XX_ATUE_STAT_SIG_TABORT | \
31 IOP13XX_ATUE_STAT_EXT_REC_TABORT | \
32 IOP13XX_ATUE_STAT_MASTER_DATA_PAR)
33
34#define IOP13XX_ATUX_ATUISR_ERROR (IOP13XX_ATUX_STAT_TX_SCEM | \
35 IOP13XX_ATUX_STAT_REC_SCEM | \
36 IOP13XX_ATUX_STAT_TX_SERR | \
37 IOP13XX_ATUX_STAT_DET_PAR_ERR | \
38 IOP13XX_ATUX_STAT_INT_REC_MABORT | \
39 IOP13XX_ATUX_STAT_REC_SERR | \
40 IOP13XX_ATUX_STAT_EXT_REC_MABORT | \
41 IOP13XX_ATUX_STAT_EXT_REC_TABORT | \
42 IOP13XX_ATUX_STAT_EXT_SIG_TABORT | \
43 IOP13XX_ATUX_STAT_MASTER_DATA_PAR)
44
45/* PCI interrupts
46 */
47#define ATUX_INTA IRQ_IOP13XX_XINT0
48#define ATUX_INTB IRQ_IOP13XX_XINT1
49#define ATUX_INTC IRQ_IOP13XX_XINT2
50#define ATUX_INTD IRQ_IOP13XX_XINT3
51
52#define ATUE_INTA IRQ_IOP13XX_ATUE_IMA
53#define ATUE_INTB IRQ_IOP13XX_ATUE_IMB
54#define ATUE_INTC IRQ_IOP13XX_ATUE_IMC
55#define ATUE_INTD IRQ_IOP13XX_ATUE_IMD
56
57#endif /* _IOP13XX_PCI_H_ */
diff --git a/include/asm-arm/arch-iop13xx/system.h b/include/asm-arm/arch-iop13xx/system.h
new file mode 100644
index 000000000000..ee3a62530af2
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/system.h
@@ -0,0 +1,59 @@
1/*
2 * linux/include/asm-arm/arch-iop13xx/system.h
3 *
4 * Copyright (C) 2004 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#include <asm/arch/iop13xx.h>
11static inline void arch_idle(void)
12{
13 cpu_do_idle();
14}
15
16/* WDTCR CP6 R7 Page 9 */
17static inline u32 read_wdtcr(void)
18{
19 u32 val;
20 asm volatile("mrc p6, 0, %0, c7, c9, 0":"=r" (val));
21 return val;
22}
23static inline void write_wdtcr(u32 val)
24{
25 asm volatile("mcr p6, 0, %0, c7, c9, 0"::"r" (val));
26}
27
28/* WDTSR CP6 R8 Page 9 */
29static inline u32 read_wdtsr(void)
30{
31 u32 val;
32 asm volatile("mrc p6, 0, %0, c8, c9, 0":"=r" (val));
33 return val;
34}
35static inline void write_wdtsr(u32 val)
36{
37 asm volatile("mcr p6, 0, %0, c8, c9, 0"::"r" (val));
38}
39
40#define IOP13XX_WDTCR_EN_ARM 0x1e1e1e1e
41#define IOP13XX_WDTCR_EN 0xe1e1e1e1
42#define IOP13XX_WDTCR_DIS_ARM 0x1f1f1f1f
43#define IOP13XX_WDTCR_DIS 0xf1f1f1f1
44#define IOP13XX_WDTSR_WRITE_EN (1 << 31)
45#define IOP13XX_WDTCR_IB_RESET (1 << 0)
46static inline void arch_reset(char mode)
47{
48 /*
49 * Reset the internal bus (warning both cores are reset)
50 */
51 u32 cp_flags = iop13xx_cp6_save();
52 write_wdtcr(IOP13XX_WDTCR_EN_ARM);
53 write_wdtcr(IOP13XX_WDTCR_EN);
54 write_wdtsr(IOP13XX_WDTSR_WRITE_EN | IOP13XX_WDTCR_IB_RESET);
55 write_wdtcr(0x1000);
56 iop13xx_cp6_restore(cp_flags);
57
58 for(;;);
59}
diff --git a/include/asm-arm/arch-iop13xx/timex.h b/include/asm-arm/arch-iop13xx/timex.h
new file mode 100644
index 000000000000..f0c51dd97ed8
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/timex.h
@@ -0,0 +1,3 @@
1#include <asm/hardware.h>
2
3#define CLOCK_TICK_RATE (100 * HZ)
diff --git a/include/asm-arm/arch-iop13xx/uncompress.h b/include/asm-arm/arch-iop13xx/uncompress.h
new file mode 100644
index 000000000000..b9525d59b7ad
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/uncompress.h
@@ -0,0 +1,24 @@
1#include <asm/types.h>
2#include <linux/serial_reg.h>
3#include <asm/hardware.h>
4#include <asm/processor.h>
5
6#define UART_BASE ((volatile u32 *)IOP13XX_UART1_PHYS)
7#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
8
9static inline void putc(char c)
10{
11 while ((UART_BASE[UART_LSR] & TX_DONE) != TX_DONE)
12 cpu_relax();
13 UART_BASE[UART_TX] = c;
14}
15
16static inline void flush(void)
17{
18}
19
20/*
21 * nothing to do
22 */
23#define arch_decomp_setup()
24#define arch_decomp_wdog()
diff --git a/include/asm-arm/arch-iop13xx/vmalloc.h b/include/asm-arm/arch-iop13xx/vmalloc.h
new file mode 100644
index 000000000000..c53456740345
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/vmalloc.h
@@ -0,0 +1,4 @@
1#ifndef _VMALLOC_H_
2#define _VMALLOC_H_
3#define VMALLOC_END 0xfa000000UL
4#endif
diff --git a/include/asm-arm/arch-ixp4xx/nslu2.h b/include/asm-arm/arch-ixp4xx/nslu2.h
index 4281838873ef..6b437f7c9955 100644
--- a/include/asm-arm/arch-ixp4xx/nslu2.h
+++ b/include/asm-arm/arch-ixp4xx/nslu2.h
@@ -76,6 +76,7 @@
76 76
77#define NSLU2_GPIO_BUZZ 4 77#define NSLU2_GPIO_BUZZ 4
78#define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ) 78#define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ)
79
79/* LEDs */ 80/* LEDs */
80 81
81#define NSLU2_LED_RED NSLU2_GPIO0 82#define NSLU2_LED_RED NSLU2_GPIO0
@@ -84,8 +85,8 @@
84#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED) 85#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED)
85#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN) 86#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN)
86 87
87#define NSLU2_LED_DISK1 NSLU2_GPIO2 88#define NSLU2_LED_DISK1 NSLU2_GPIO3
88#define NSLU2_LED_DISK2 NSLU2_GPIO3 89#define NSLU2_LED_DISK2 NSLU2_GPIO2
89 90
90#define NSLU2_LED_DISK1_BM (1L << NSLU2_GPIO2) 91#define NSLU2_LED_DISK1_BM (1L << NSLU2_GPIO2)
91#define NSLU2_LED_DISK2_BM (1L << NSLU2_GPIO3) 92#define NSLU2_LED_DISK2_BM (1L << NSLU2_GPIO3)
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index 8d10a9187693..ab194e5f6653 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -86,6 +86,19 @@ struct ixp4xx_i2c_pins {
86 unsigned long scl_pin; 86 unsigned long scl_pin;
87}; 87};
88 88
89/*
90 * This structure provide a means for the board setup code
91 * to give information to th pata_ixp4xx driver. It is
92 * passed as platform_data.
93 */
94struct ixp4xx_pata_data {
95 volatile u32 *cs0_cfg;
96 volatile u32 *cs1_cfg;
97 unsigned long cs0_bits;
98 unsigned long cs1_bits;
99 void __iomem *cs0;
100 void __iomem *cs1;
101};
89 102
90struct sys_timer; 103struct sys_timer;
91 104
diff --git a/include/asm-arm/arch-ixp4xx/udc.h b/include/asm-arm/arch-ixp4xx/udc.h
new file mode 100644
index 000000000000..dbdec36ff0d1
--- /dev/null
+++ b/include/asm-arm/arch-ixp4xx/udc.h
@@ -0,0 +1,8 @@
1/*
2 * linux/include/asm-arm/arch-ixp4xx/udc.h
3 *
4 */
5#include <asm/mach/udc_pxa2xx.h>
6
7extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info);
8
diff --git a/include/asm-arm/arch-l7200/io.h b/include/asm-arm/arch-l7200/io.h
index d744d97c18a5..645dbdfb3908 100644
--- a/include/asm-arm/arch-l7200/io.h
+++ b/include/asm-arm/arch-l7200/io.h
@@ -17,59 +17,11 @@
17/* 17/*
18 * There are not real ISA nor PCI buses, so we fake it. 18 * There are not real ISA nor PCI buses, so we fake it.
19 */ 19 */
20#define __io_pci(a) ((void __iomem *)(PCIO_BASE + (a))) 20static inline void __iomem *__io(unsigned long addr)
21#define __mem_pci(a) (a)
22
23#define __ioaddr(p) __io_pci(p)
24
25/*
26 * Generic virtual read/write
27 */
28#define __arch_getb(a) (*(volatile unsigned char *)(a))
29#define __arch_getl(a) (*(volatile unsigned int *)(a))
30
31static inline unsigned int __arch_getw(unsigned long a)
32{
33 unsigned int value;
34 __asm__ __volatile__("ldrh %0, [%1, #0] @ getw"
35 : "=&r" (value)
36 : "r" (a) : "cc");
37 return value;
38}
39
40#define __arch_putb(v,a) (*(volatile unsigned char *)(a) = (v))
41#define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v))
42
43static inline void __arch_putw(unsigned int value, unsigned long a)
44{ 21{
45 __asm__ __volatile__("strh %0, [%1, #0] @ putw" 22 return (void __iomem *)addr;
46 : : "r" (value), "r" (a) : "cc");
47} 23}
48 24#define __io(a) __io(a)
49/* 25#define __mem_pci(a) (a)
50 * Translated address IO functions
51 *
52 * IO address has already been translated to a virtual address
53 */
54#define outb_t(v,p) (*(volatile unsigned char *)(p) = (v))
55#define inb_t(p) (*(volatile unsigned char *)(p))
56#define outw_t(v,p) (*(volatile unsigned int *)(p) = (v))
57#define inw_t(p) (*(volatile unsigned int *)(p))
58#define outl_t(v,p) (*(volatile unsigned long *)(p) = (v))
59#define inl_t(p) (*(volatile unsigned long *)(p))
60
61/*
62 * FIXME - These are to allow for linking. On all the other
63 * ARM platforms, the entire IO space is contiguous.
64 * The 7200 has three separate IO spaces. The below
65 * macros will eventually become more involved. Use
66 * with caution and don't be surprised by kernel oopses!!!
67 */
68#define inb(p) inb_t(p)
69#define inw(p) inw_t(p)
70#define inl(p) inl_t(p)
71#define outb(v,p) outb_t(v,p)
72#define outw(v,p) outw_t(v,p)
73#define outl(v,p) outl_t(v,p)
74 26
75#endif 27#endif
diff --git a/include/asm-arm/arch-lh7a40x/memory.h b/include/asm-arm/arch-lh7a40x/memory.h
index 9f1a58cbf407..9b0c8012e713 100644
--- a/include/asm-arm/arch-lh7a40x/memory.h
+++ b/include/asm-arm/arch-lh7a40x/memory.h
@@ -58,18 +58,6 @@
58#endif 58#endif
59 59
60/* 60/*
61 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
62 * and return the mem_map of that node.
63 */
64# define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
65
66/*
67 * Given a page frame number, find the owning node of the memory
68 * and return the mem_map of that node.
69 */
70# define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
71
72/*
73 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory 61 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
74 * and returns the index corresponding to the appropriate page in the 62 * and returns the index corresponding to the appropriate page in the
75 * node's mem_map. 63 * node's mem_map.
diff --git a/include/asm-arm/arch-omap/irda.h b/include/asm-arm/arch-omap/irda.h
index 805ae3575e44..345a649ec838 100644
--- a/include/asm-arm/arch-omap/irda.h
+++ b/include/asm-arm/arch-omap/irda.h
@@ -24,7 +24,7 @@ struct omap_irda_config {
24 /* Very specific to the needs of some platforms (h3,h4) 24 /* Very specific to the needs of some platforms (h3,h4)
25 * having calls which can sleep in irda_set_speed. 25 * having calls which can sleep in irda_set_speed.
26 */ 26 */
27 struct work_struct gpio_expa; 27 struct delayed_work gpio_expa;
28 int rx_channel; 28 int rx_channel;
29 int tx_channel; 29 int tx_channel;
30 unsigned long dest_start; 30 unsigned long dest_start;
diff --git a/include/asm-arm/arch-pxa/memory.h b/include/asm-arm/arch-pxa/memory.h
index eaf6d43939e9..e17f9881faf0 100644
--- a/include/asm-arm/arch-pxa/memory.h
+++ b/include/asm-arm/arch-pxa/memory.h
@@ -27,7 +27,6 @@
27#define __virt_to_bus(x) __virt_to_phys(x) 27#define __virt_to_bus(x) __virt_to_phys(x)
28#define __bus_to_virt(x) __phys_to_virt(x) 28#define __bus_to_virt(x) __phys_to_virt(x)
29 29
30#ifdef CONFIG_DISCONTIGMEM
31/* 30/*
32 * The nodes are matched with the physical SDRAM banks as follows: 31 * The nodes are matched with the physical SDRAM banks as follows:
33 * 32 *
@@ -35,38 +34,9 @@
35 * node 1: 0xa4000000-0xa7ffffff --> 0xc4000000-0xc7ffffff 34 * node 1: 0xa4000000-0xa7ffffff --> 0xc4000000-0xc7ffffff
36 * node 2: 0xa8000000-0xabffffff --> 0xc8000000-0xcbffffff 35 * node 2: 0xa8000000-0xabffffff --> 0xc8000000-0xcbffffff
37 * node 3: 0xac000000-0xafffffff --> 0xcc000000-0xcfffffff 36 * node 3: 0xac000000-0xafffffff --> 0xcc000000-0xcfffffff
37 *
38 * This needs a node mem size of 26 bits.
38 */ 39 */
39 40#define NODE_MEM_SIZE_BITS 26
40/*
41 * Given a kernel address, find the home node of the underlying memory.
42 */
43#define KVADDR_TO_NID(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> 26)
44
45/*
46 * Given a page frame number, convert it to a node id.
47 */
48#define PFN_TO_NID(pfn) (((pfn) - PHYS_PFN_OFFSET) >> (26 - PAGE_SHIFT))
49
50/*
51 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
52 * and returns the mem_map of that node.
53 */
54#define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
55
56/*
57 * Given a page frame number, find the owning node of the memory
58 * and returns the mem_map of that node.
59 */
60#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
61
62/*
63 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
64 * and returns the index corresponding to the appropriate page in the
65 * node's mem_map.
66 */
67#define LOCAL_MAP_NR(addr) \
68 (((unsigned long)(addr) & 0x03ffffff) >> PAGE_SHIFT)
69
70#endif
71 41
72#endif 42#endif
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index 68731e0923a4..083e03c5639f 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -99,7 +99,7 @@
99#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */ 99#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */
100#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */ 100#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */
101#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */ 101#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */
102#define DCSR_ENRINTR (1 << 9) /* The end of Receive */ 102#define DCSR_EORINTR (1 << 9) /* The end of Receive */
103#endif 103#endif
104#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */ 104#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */
105#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */ 105#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */
@@ -803,12 +803,11 @@
803#define UDCISR0 __REG(0x4060000C) /* UDC Interrupt Status Register 0 */ 803#define UDCISR0 __REG(0x4060000C) /* UDC Interrupt Status Register 0 */
804#define UDCISR1 __REG(0x40600010) /* UDC Interrupt Status Register 1 */ 804#define UDCISR1 __REG(0x40600010) /* UDC Interrupt Status Register 1 */
805#define UDCISR_INT(n,intr) (((intr) & 0x03) << (((n) & 0x0F) * 2)) 805#define UDCISR_INT(n,intr) (((intr) & 0x03) << (((n) & 0x0F) * 2))
806#define UDCISR1_IECC (1 << 31) /* IntEn - Configuration Change */ 806#define UDCISR1_IRCC (1 << 31) /* IntReq - Configuration Change */
807#define UDCISR1_IESOF (1 << 30) /* IntEn - Start of Frame */ 807#define UDCISR1_IRSOF (1 << 30) /* IntReq - Start of Frame */
808#define UDCISR1_IERU (1 << 29) /* IntEn - Resume */ 808#define UDCISR1_IRRU (1 << 29) /* IntReq - Resume */
809#define UDCISR1_IESU (1 << 28) /* IntEn - Suspend */ 809#define UDCISR1_IRSU (1 << 28) /* IntReq - Suspend */
810#define UDCISR1_IERS (1 << 27) /* IntEn - Reset */ 810#define UDCISR1_IRRS (1 << 27) /* IntReq - Reset */
811
812 811
813#define UDCFNR __REG(0x40600014) /* UDC Frame Number Register */ 812#define UDCFNR __REG(0x40600014) /* UDC Frame Number Register */
814#define UDCOTGICR __REG(0x40600018) /* UDC On-The-Go interrupt control */ 813#define UDCOTGICR __REG(0x40600018) /* UDC On-The-Go interrupt control */
@@ -2242,7 +2241,7 @@
2242 2241
2243#define CICR1_TBIT (1 << 31) /* Transparency bit */ 2242#define CICR1_TBIT (1 << 31) /* Transparency bit */
2244#define CICR1_RGBT_CONV (0x3 << 30) /* RGBT conversion mask */ 2243#define CICR1_RGBT_CONV (0x3 << 30) /* RGBT conversion mask */
2245#define CICR1_PPL (0x3f << 15) /* Pixels per line mask */ 2244#define CICR1_PPL (0x7ff << 15) /* Pixels per line mask */
2246#define CICR1_RGB_CONV (0x7 << 12) /* RGB conversion mask */ 2245#define CICR1_RGB_CONV (0x7 << 12) /* RGB conversion mask */
2247#define CICR1_RGB_F (1 << 11) /* RGB format */ 2246#define CICR1_RGB_F (1 << 11) /* RGB format */
2248#define CICR1_YCBCR_F (1 << 10) /* YCbCr format */ 2247#define CICR1_YCBCR_F (1 << 10) /* YCbCr format */
@@ -2268,7 +2267,7 @@
2268#define CICR3_VSW (0x3f << 10) /* Vertical sync pulse width mask */ 2267#define CICR3_VSW (0x3f << 10) /* Vertical sync pulse width mask */
2269#define CICR3_BFPW (0x3f << 3) /* Beginning-of-frame pixel clock 2268#define CICR3_BFPW (0x3f << 3) /* Beginning-of-frame pixel clock
2270 wait count mask */ 2269 wait count mask */
2271#define CICR3_LPF (0x3ff << 0) /* Lines per frame mask */ 2270#define CICR3_LPF (0x7ff << 0) /* Lines per frame mask */
2272 2271
2273#define CICR4_MCLK_DLY (0x3 << 24) /* MCLK Data Capture Delay mask */ 2272#define CICR4_MCLK_DLY (0x3 << 24) /* MCLK Data Capture Delay mask */
2274#define CICR4_PCLK_EN (1 << 23) /* Pixel clock enable */ 2273#define CICR4_PCLK_EN (1 << 23) /* Pixel clock enable */
@@ -2289,8 +2288,8 @@
2289#define CISR_EOL (1 << 8) /* End of line */ 2288#define CISR_EOL (1 << 8) /* End of line */
2290#define CISR_PAR_ERR (1 << 7) /* Parity error */ 2289#define CISR_PAR_ERR (1 << 7) /* Parity error */
2291#define CISR_CQD (1 << 6) /* Camera interface quick disable */ 2290#define CISR_CQD (1 << 6) /* Camera interface quick disable */
2292#define CISR_SOF (1 << 5) /* Start of frame */ 2291#define CISR_CDD (1 << 5) /* Camera interface disable done */
2293#define CISR_CDD (1 << 4) /* Camera interface disable done */ 2292#define CISR_SOF (1 << 4) /* Start of frame */
2294#define CISR_EOF (1 << 3) /* End of frame */ 2293#define CISR_EOF (1 << 3) /* End of frame */
2295#define CISR_IFO_2 (1 << 2) /* FIFO overrun for Channel 2 */ 2294#define CISR_IFO_2 (1 << 2) /* FIFO overrun for Channel 2 */
2296#define CISR_IFO_1 (1 << 1) /* FIFO overrun for Channel 1 */ 2295#define CISR_IFO_1 (1 << 1) /* FIFO overrun for Channel 1 */
diff --git a/include/asm-arm/arch-pxa/udc.h b/include/asm-arm/arch-pxa/udc.h
index 121cd241115d..646480d37256 100644
--- a/include/asm-arm/arch-pxa/udc.h
+++ b/include/asm-arm/arch-pxa/udc.h
@@ -4,23 +4,8 @@
4 * This supports machine-specific differences in how the PXA2xx 4 * This supports machine-specific differences in how the PXA2xx
5 * USB Device Controller (UDC) is wired. 5 * USB Device Controller (UDC) is wired.
6 * 6 *
7 * It is set in linux/arch/arm/mach-pxa/<machine>.c and used in
8 * the probe routine of linux/drivers/usb/gadget/pxa2xx_udc.c
9 */ 7 */
10struct pxa2xx_udc_mach_info { 8#include <asm/mach/udc_pxa2xx.h>
11 int (*udc_is_connected)(void); /* do we see host? */
12 void (*udc_command)(int cmd);
13#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
14#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
15
16 /* Boards following the design guidelines in the developer's manual,
17 * with on-chip GPIOs not Lubbock's wierd hardware, can have a sane
18 * VBUS IRQ and omit the methods above. Store the GPIO number
19 * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits.
20 */
21 u16 gpio_vbus; /* high == vbus present */
22 u16 gpio_pullup; /* high == pullup activated */
23};
24 9
25extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); 10extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
26 11
diff --git a/include/asm-arm/arch-s3c2410/h1940.h b/include/asm-arm/arch-s3c2410/h1940.h
new file mode 100644
index 000000000000..6135592e60f2
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/h1940.h
@@ -0,0 +1,21 @@
1/* linux/include/asm-arm/arch-s3c2410/h1940.h
2 *
3 * Copyright 2006 Ben Dooks <ben-linux@fluff.org>
4 *
5 * H1940 definitions
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_H1940_H
13#define __ASM_ARCH_H1940_H
14
15#define H1940_SUSPEND_CHECKSUM (0x30003ff8)
16#define H1940_SUSPEND_RESUMEAT (0x30081000)
17#define H1940_SUSPEND_CHECK (0x30080000)
18
19extern void h1940_pm_return(void);
20
21#endif /* __ASM_ARCH_H1940_H */
diff --git a/include/asm-arm/arch-s3c2410/system.h b/include/asm-arm/arch-s3c2410/system.h
index 718246d85952..4f72a853a5cf 100644
--- a/include/asm-arm/arch-s3c2410/system.h
+++ b/include/asm-arm/arch-s3c2410/system.h
@@ -71,7 +71,7 @@ arch_reset(char mode)
71 71
72 /* set the watchdog to go and reset... */ 72 /* set the watchdog to go and reset... */
73 __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN | 73 __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN |
74 S3C2410_WTCON_PRESCALE(0x80), S3C2410_WTCON); 74 S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON);
75 75
76 /* wait for reset to assert... */ 76 /* wait for reset to assert... */
77 mdelay(5000); 77 mdelay(5000);
diff --git a/include/asm-arm/arch-sa1100/jornada720.h b/include/asm-arm/arch-sa1100/jornada720.h
deleted file mode 100644
index 3f37ca07806d..000000000000
--- a/include/asm-arm/arch-sa1100/jornada720.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * linux/include/asm-arm/arch-sa1100/jornada720.h
3 *
4 * Created 2000/11/29 by John Ankcorn <jca@lcs.mit.edu>
5 *
6 * This file contains the hardware specific definitions for HP Jornada 720
7 *
8 */
9
10#ifndef __ASM_ARCH_HARDWARE_H
11#error "include <asm/hardware.h> instead"
12#endif
13
14#define SA1111_BASE (0x40000000)
15
16#define GPIO_JORNADA720_KEYBOARD GPIO_GPIO(0)
17#define GPIO_JORNADA720_MOUSE GPIO_GPIO(9)
18
19#define GPIO_JORNADA720_KEYBOARD_IRQ IRQ_GPIO0
20#define GPIO_JORNADA720_MOUSE_IRQ IRQ_GPIO9
21
22/* MCU COMMANDS */
23#define MCU_GetBatteryData 0xc0
24#define MCU_GetScanKeyCode 0x90
25#define MCU_GetTouchSamples 0xa0
26#define MCU_GetContrast 0xD0
27#define MCU_SetContrast 0xD1
28#define MCU_GetBrightness 0xD2
29#define MCU_SetBrightness 0xD3
30#define MCU_ContrastOff 0xD8
31#define MCU_BrightnessOff 0xD9
32#define MCU_PWMOFF 0xDF
33#define MCU_TxDummy 0x11
34#define MCU_ErrorCode 0x00
35
36#ifndef __ASSEMBLY__
37
38void jornada720_mcu_init(void);
39void jornada_contrast(int arg_contrast);
40void jornada720_battery(void);
41int jornada720_getkey(unsigned char *data, int size);
42#endif
diff --git a/include/asm-arm/arch-sa1100/memory.h b/include/asm-arm/arch-sa1100/memory.h
index 1ff172dc8e33..0e907fc6d42a 100644
--- a/include/asm-arm/arch-sa1100/memory.h
+++ b/include/asm-arm/arch-sa1100/memory.h
@@ -39,7 +39,6 @@ void sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes);
39#define __virt_to_bus(x) __virt_to_phys(x) 39#define __virt_to_bus(x) __virt_to_phys(x)
40#define __bus_to_virt(x) __phys_to_virt(x) 40#define __bus_to_virt(x) __phys_to_virt(x)
41 41
42#ifdef CONFIG_DISCONTIGMEM
43/* 42/*
44 * Because of the wide memory address space between physical RAM banks on the 43 * Because of the wide memory address space between physical RAM banks on the
45 * SA1100, it's much convenient to use Linux's NUMA support to implement our 44 * SA1100, it's much convenient to use Linux's NUMA support to implement our
@@ -57,38 +56,7 @@ void sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes);
57 * node 2: 0xd0000000 - 0xd7ffffff 56 * node 2: 0xd0000000 - 0xd7ffffff
58 * node 3: 0xd8000000 - 0xdfffffff 57 * node 3: 0xd8000000 - 0xdfffffff
59 */ 58 */
60 59#define NODE_MEM_SIZE_BITS 27
61/*
62 * Given a kernel address, find the home node of the underlying memory.
63 */
64#define KVADDR_TO_NID(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> 27)
65
66/*
67 * Given a page frame number, convert it to a node id.
68 */
69#define PFN_TO_NID(pfn) (((pfn) - PHYS_PFN_OFFSET) >> (27 - PAGE_SHIFT))
70
71/*
72 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
73 * and return the mem_map of that node.
74 */
75#define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
76
77/*
78 * Given a page frame number, find the owning node of the memory
79 * and return the mem_map of that node.
80 */
81#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
82
83/*
84 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
85 * and returns the index corresponding to the appropriate page in the
86 * node's mem_map.
87 */
88#define LOCAL_MAP_NR(addr) \
89 (((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT)
90
91#endif
92 60
93/* 61/*
94 * Cache flushing area - SA1100 zero bank 62 * Cache flushing area - SA1100 zero bank
diff --git a/include/asm-arm/bug.h b/include/asm-arm/bug.h
index 0e36fd5d87df..7b62351f097d 100644
--- a/include/asm-arm/bug.h
+++ b/include/asm-arm/bug.h
@@ -4,10 +4,10 @@
4 4
5#ifdef CONFIG_BUG 5#ifdef CONFIG_BUG
6#ifdef CONFIG_DEBUG_BUGVERBOSE 6#ifdef CONFIG_DEBUG_BUGVERBOSE
7extern void __bug(const char *file, int line, void *data) __attribute__((noreturn)); 7extern void __bug(const char *file, int line) __attribute__((noreturn));
8 8
9/* give file/line information */ 9/* give file/line information */
10#define BUG() __bug(__FILE__, __LINE__, NULL) 10#define BUG() __bug(__FILE__, __LINE__)
11 11
12#else 12#else
13 13
diff --git a/include/asm-arm/checksum.h b/include/asm-arm/checksum.h
index 747bdd31a74b..8c0bb5bb14ee 100644
--- a/include/asm-arm/checksum.h
+++ b/include/asm-arm/checksum.h
@@ -23,7 +23,7 @@
23 * 23 *
24 * it's best to have buff aligned on a 32-bit boundary 24 * it's best to have buff aligned on a 32-bit boundary
25 */ 25 */
26unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 26__wsum csum_partial(const void *buff, int len, __wsum sum);
27 27
28/* 28/*
29 * the same as csum_partial, but copies from src while it 29 * the same as csum_partial, but copies from src while it
@@ -33,26 +33,18 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
33 * better 64-bit) boundary 33 * better 64-bit) boundary
34 */ 34 */
35 35
36unsigned int 36__wsum
37csum_partial_copy_nocheck(const char *src, char *dst, int len, int sum); 37csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
38 38
39unsigned int 39__wsum
40csum_partial_copy_from_user(const char __user *src, char *dst, int len, int sum, int *err_ptr); 40csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr);
41
42/*
43 * This is the old (and unsafe) way of doing checksums, a warning message will
44 * be printed if it is used and an exception occurs.
45 *
46 * this functions should go away after some time.
47 */
48#define csum_partial_copy(src,dst,len,sum) csum_partial_copy_nocheck(src,dst,len,sum)
49 41
50/* 42/*
51 * This is a version of ip_compute_csum() optimized for IP headers, 43 * This is a version of ip_compute_csum() optimized for IP headers,
52 * which always checksum on 4 octet boundaries. 44 * which always checksum on 4 octet boundaries.
53 */ 45 */
54static inline unsigned short 46static inline __sum16
55ip_fast_csum(unsigned char * iph, unsigned int ihl) 47ip_fast_csum(const void *iph, unsigned int ihl)
56{ 48{
57 unsigned int sum, tmp1; 49 unsigned int sum, tmp1;
58 50
@@ -78,14 +70,13 @@ ip_fast_csum(unsigned char * iph, unsigned int ihl)
78 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1) 70 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1)
79 : "1" (iph), "2" (ihl) 71 : "1" (iph), "2" (ihl)
80 : "cc", "memory"); 72 : "cc", "memory");
81 return sum; 73 return (__force __sum16)sum;
82} 74}
83 75
84/* 76/*
85 * Fold a partial checksum without adding pseudo headers 77 * Fold a partial checksum without adding pseudo headers
86 */ 78 */
87static inline unsigned int 79static inline __sum16 csum_fold(__wsum sum)
88csum_fold(unsigned int sum)
89{ 80{
90 __asm__( 81 __asm__(
91 "adds %0, %1, %1, lsl #16 @ csum_fold \n\ 82 "adds %0, %1, %1, lsl #16 @ csum_fold \n\
@@ -93,21 +84,25 @@ csum_fold(unsigned int sum)
93 : "=r" (sum) 84 : "=r" (sum)
94 : "r" (sum) 85 : "r" (sum)
95 : "cc"); 86 : "cc");
96 return (~sum) >> 16; 87 return (__force __sum16)(~(__force u32)sum >> 16);
97} 88}
98 89
99static inline unsigned int 90static inline __wsum
100csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 91csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
101 unsigned int proto, unsigned int sum) 92 unsigned short proto, __wsum sum)
102{ 93{
103 __asm__( 94 __asm__(
104 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\ 95 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\
105 adcs %0, %0, %3 \n\ 96 adcs %0, %0, %3 \n"
106 adcs %0, %0, %4 \n\ 97#ifdef __ARMEB__
107 adcs %0, %0, %5 \n\ 98 "adcs %0, %0, %4 \n"
99#else
100 "adcs %0, %0, %4, lsl #8 \n"
101#endif
102 "adcs %0, %0, %5 \n\
108 adc %0, %0, #0" 103 adc %0, %0, #0"
109 : "=&r"(sum) 104 : "=&r"(sum)
110 : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto)) 105 : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto))
111 : "cc"); 106 : "cc");
112 return sum; 107 return sum;
113} 108}
@@ -115,23 +110,27 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
115 * computes the checksum of the TCP/UDP pseudo-header 110 * computes the checksum of the TCP/UDP pseudo-header
116 * returns a 16-bit checksum, already complemented 111 * returns a 16-bit checksum, already complemented
117 */ 112 */
118static inline unsigned short int 113static inline __sum16
119csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 114csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
120 unsigned int proto, unsigned int sum) 115 unsigned short proto, __wsum sum)
121{ 116{
122 __asm__( 117 __asm__(
123 "adds %0, %1, %2 @ csum_tcpudp_magic \n\ 118 "adds %0, %1, %2 @ csum_tcpudp_magic \n\
124 adcs %0, %0, %3 \n\ 119 adcs %0, %0, %3 \n"
125 adcs %0, %0, %4 \n\ 120#ifdef __ARMEB__
126 adcs %0, %0, %5 \n\ 121 "adcs %0, %0, %4 \n"
122#else
123 "adcs %0, %0, %4, lsl #8 \n"
124#endif
125 "adcs %0, %0, %5 \n\
127 adc %0, %0, #0 \n\ 126 adc %0, %0, #0 \n\
128 adds %0, %0, %0, lsl #16 \n\ 127 adds %0, %0, %0, lsl #16 \n\
129 addcs %0, %0, #0x10000 \n\ 128 addcs %0, %0, #0x10000 \n\
130 mvn %0, %0" 129 mvn %0, %0"
131 : "=&r"(sum) 130 : "=&r"(sum)
132 : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto)) 131 : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto))
133 : "cc"); 132 : "cc");
134 return sum >> 16; 133 return (__force __sum16)((__force u32)sum >> 16);
135} 134}
136 135
137 136
@@ -139,20 +138,20 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
139 * this routine is used for miscellaneous IP-like checksums, mainly 138 * this routine is used for miscellaneous IP-like checksums, mainly
140 * in icmp.c 139 * in icmp.c
141 */ 140 */
142static inline unsigned short 141static inline __sum16
143ip_compute_csum(unsigned char * buff, int len) 142ip_compute_csum(const void *buff, int len)
144{ 143{
145 return csum_fold(csum_partial(buff, len, 0)); 144 return csum_fold(csum_partial(buff, len, 0));
146} 145}
147 146
148#define _HAVE_ARCH_IPV6_CSUM 147#define _HAVE_ARCH_IPV6_CSUM
149extern unsigned long 148extern __wsum
150__csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, __u32 len, 149__csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __be32 len,
151 __u32 proto, unsigned int sum); 150 __be32 proto, __wsum sum);
152 151
153static inline unsigned short int 152static inline __sum16
154csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, __u32 len, 153csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __u32 len,
155 unsigned short proto, unsigned int sum) 154 unsigned short proto, __wsum sum)
156{ 155{
157 return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len), 156 return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len),
158 htonl(proto), sum)); 157 htonl(proto), sum));
diff --git a/include/asm-arm/cnt32_to_63.h b/include/asm-arm/cnt32_to_63.h
new file mode 100644
index 000000000000..480c873fa746
--- /dev/null
+++ b/include/asm-arm/cnt32_to_63.h
@@ -0,0 +1,78 @@
1/*
2 * include/asm/cnt32_to_63.h -- extend a 32-bit counter to 63 bits
3 *
4 * Author: Nicolas Pitre
5 * Created: December 3, 2006
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
10 * as published by the Free Software Foundation.
11 */
12
13#ifndef __INCLUDE_CNT32_TO_63_H__
14#define __INCLUDE_CNT32_TO_63_H__
15
16#include <linux/compiler.h>
17#include <asm/types.h>
18#include <asm/byteorder.h>
19
20/*
21 * Prototype: u64 cnt32_to_63(u32 cnt)
22 * Many hardware clock counters are only 32 bits wide and therefore have
23 * a relatively short period making wrap-arounds rather frequent. This
24 * is a problem when implementing sched_clock() for example, where a 64-bit
25 * non-wrapping monotonic value is expected to be returned.
26 *
27 * To overcome that limitation, let's extend a 32-bit counter to 63 bits
28 * in a completely lock free fashion. Bits 0 to 31 of the clock are provided
29 * by the hardware while bits 32 to 62 are stored in memory. The top bit in
30 * memory is used to synchronize with the hardware clock half-period. When
31 * the top bit of both counters (hardware and in memory) differ then the
32 * memory is updated with a new value, incrementing it when the hardware
33 * counter wraps around.
34 *
35 * Because a word store in memory is atomic then the incremented value will
36 * always be in synch with the top bit indicating to any potential concurrent
37 * reader if the value in memory is up to date or not with regards to the
38 * needed increment. And any race in updating the value in memory is harmless
39 * as the same value would simply be stored more than once.
40 *
41 * The only restriction for the algorithm to work properly is that this
42 * code must be executed at least once per each half period of the 32-bit
43 * counter to properly update the state bit in memory. This is usually not a
44 * problem in practice, but if it is then a kernel timer could be scheduled
45 * to manage for this code to be executed often enough.
46 *
47 * Note that the top bit (bit 63) in the returned value should be considered
48 * as garbage. It is not cleared here because callers are likely to use a
49 * multiplier on the returned value which can get rid of the top bit
50 * implicitly by making the multiplier even, therefore saving on a runtime
51 * clear-bit instruction. Otherwise caller must remember to clear the top
52 * bit explicitly.
53 */
54
55/* this is used only to give gcc a clue about good code generation */
56typedef union {
57 struct {
58#if defined(__LITTLE_ENDIAN)
59 u32 lo, hi;
60#elif defined(__BIG_ENDIAN)
61 u32 hi, lo;
62#endif
63 };
64 u64 val;
65} cnt32_to_63_t;
66
67#define cnt32_to_63(cnt_lo) \
68({ \
69 static volatile u32 __m_cnt_hi = 0; \
70 cnt32_to_63_t __x; \
71 __x.hi = __m_cnt_hi; \
72 __x.lo = (cnt_lo); \
73 if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \
74 __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \
75 __x.val; \
76})
77
78#endif
diff --git a/include/asm-arm/device.h b/include/asm-arm/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-arm/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-arm/div64.h b/include/asm-arm/div64.h
index 3682616804ca..37e0a96e8789 100644
--- a/include/asm-arm/div64.h
+++ b/include/asm-arm/div64.h
@@ -27,7 +27,7 @@
27#define __xh "r1" 27#define __xh "r1"
28#endif 28#endif
29 29
30#define do_div(n,base) \ 30#define __do_div_asm(n, base) \
31({ \ 31({ \
32 register unsigned int __base asm("r4") = base; \ 32 register unsigned int __base asm("r4") = base; \
33 register unsigned long long __n asm("r0") = n; \ 33 register unsigned long long __n asm("r0") = n; \
@@ -45,4 +45,182 @@
45 __rem; \ 45 __rem; \
46}) 46})
47 47
48#if __GNUC__ < 4
49
50/*
51 * gcc versions earlier than 4.0 are simply too problematic for the
52 * optimized implementation below. First there is gcc PR 15089 that
53 * tend to trig on more complex constructs, spurious .global __udivsi3
54 * are inserted even if none of those symbols are referenced in the
55 * generated code, and those gcc versions are not able to do constant
56 * propagation on long long values anyway.
57 */
58#define do_div(n, base) __do_div_asm(n, base)
59
60#elif __GNUC__ >= 4
61
62#include <asm/bug.h>
63
64/*
65 * If the divisor happens to be constant, we determine the appropriate
66 * inverse at compile time to turn the division into a few inline
67 * multiplications instead which is much faster. And yet only if compiling
68 * for ARMv4 or higher (we need umull/umlal) and if the gcc version is
69 * sufficiently recent to perform proper long long constant propagation.
70 * (It is unfortunate that gcc doesn't perform all this internally.)
71 */
72#define do_div(n, base) \
73({ \
74 unsigned int __r, __b = (base); \
75 if (!__builtin_constant_p(__b) || __b == 0 || \
76 (__LINUX_ARM_ARCH__ < 4 && (__b & (__b - 1)) != 0)) { \
77 /* non-constant divisor (or zero): slow path */ \
78 __r = __do_div_asm(n, __b); \
79 } else if ((__b & (__b - 1)) == 0) { \
80 /* Trivial: __b is constant and a power of 2 */ \
81 /* gcc does the right thing with this code. */ \
82 __r = n; \
83 __r &= (__b - 1); \
84 n /= __b; \
85 } else { \
86 /* Multiply by inverse of __b: n/b = n*(p/b)/p */ \
87 /* We rely on the fact that most of this code gets */ \
88 /* optimized away at compile time due to constant */ \
89 /* propagation and only a couple inline assembly */ \
90 /* instructions should remain. Better avoid any */ \
91 /* code construct that might prevent that. */ \
92 unsigned long long __res, __x, __t, __m, __n = n; \
93 unsigned int __c, __p, __z = 0; \
94 /* preserve low part of n for reminder computation */ \
95 __r = __n; \
96 /* determine number of bits to represent __b */ \
97 __p = 1 << __div64_fls(__b); \
98 /* compute __m = ((__p << 64) + __b - 1) / __b */ \
99 __m = (~0ULL / __b) * __p; \
100 __m += (((~0ULL % __b + 1) * __p) + __b - 1) / __b; \
101 /* compute __res = __m*(~0ULL/__b*__b-1)/(__p << 64) */ \
102 __x = ~0ULL / __b * __b - 1; \
103 __res = (__m & 0xffffffff) * (__x & 0xffffffff); \
104 __res >>= 32; \
105 __res += (__m & 0xffffffff) * (__x >> 32); \
106 __t = __res; \
107 __res += (__x & 0xffffffff) * (__m >> 32); \
108 __t = (__res < __t) ? (1ULL << 32) : 0; \
109 __res = (__res >> 32) + __t; \
110 __res += (__m >> 32) * (__x >> 32); \
111 __res /= __p; \
112 /* Now sanitize and optimize what we've got. */ \
113 if (~0ULL % (__b / (__b & -__b)) == 0) { \
114 /* those cases can be simplified with: */ \
115 __n /= (__b & -__b); \
116 __m = ~0ULL / (__b / (__b & -__b)); \
117 __p = 1; \
118 __c = 1; \
119 } else if (__res != __x / __b) { \
120 /* We can't get away without a correction */ \
121 /* to compensate for bit truncation errors. */ \
122 /* To avoid it we'd need an additional bit */ \
123 /* to represent __m which would overflow it. */ \
124 /* Instead we do m=p/b and n/b=(n*m+m)/p. */ \
125 __c = 1; \
126 /* Compute __m = (__p << 64) / __b */ \
127 __m = (~0ULL / __b) * __p; \
128 __m += ((~0ULL % __b + 1) * __p) / __b; \
129 } else { \
130 /* Reduce __m/__p, and try to clear bit 31 */ \
131 /* of __m when possible otherwise that'll */ \
132 /* need extra overflow handling later. */ \
133 unsigned int __bits = -(__m & -__m); \
134 __bits |= __m >> 32; \
135 __bits = (~__bits) << 1; \
136 /* If __bits == 0 then setting bit 31 is */ \
137 /* unavoidable. Simply apply the maximum */ \
138 /* possible reduction in that case. */ \
139 /* Otherwise the MSB of __bits indicates the */ \
140 /* best reduction we should apply. */ \
141 if (!__bits) { \
142 __p /= (__m & -__m); \
143 __m /= (__m & -__m); \
144 } else { \
145 __p >>= __div64_fls(__bits); \
146 __m >>= __div64_fls(__bits); \
147 } \
148 /* No correction needed. */ \
149 __c = 0; \
150 } \
151 /* Now we have a combination of 2 conditions: */ \
152 /* 1) whether or not we need a correction (__c), and */ \
153 /* 2) whether or not there might be an overflow in */ \
154 /* the cross product (__m & ((1<<63) | (1<<31))) */ \
155 /* Select the best insn combination to perform the */ \
156 /* actual __m * __n / (__p << 64) operation. */ \
157 if (!__c) { \
158 asm ( "umull %Q0, %R0, %1, %Q2\n\t" \
159 "mov %Q0, #0" \
160 : "=&r" (__res) \
161 : "r" (__m), "r" (__n) \
162 : "cc" ); \
163 } else if (!(__m & ((1ULL << 63) | (1ULL << 31)))) { \
164 __res = __m; \
165 asm ( "umlal %Q0, %R0, %Q1, %Q2\n\t" \
166 "mov %Q0, #0" \
167 : "+r" (__res) \
168 : "r" (__m), "r" (__n) \
169 : "cc" ); \
170 } else { \
171 asm ( "umull %Q0, %R0, %Q1, %Q2\n\t" \
172 "cmn %Q0, %Q1\n\t" \
173 "adcs %R0, %R0, %R1\n\t" \
174 "adc %Q0, %3, #0" \
175 : "=&r" (__res) \
176 : "r" (__m), "r" (__n), "r" (__z) \
177 : "cc" ); \
178 } \
179 if (!(__m & ((1ULL << 63) | (1ULL << 31)))) { \
180 asm ( "umlal %R0, %Q0, %R1, %Q2\n\t" \
181 "umlal %R0, %Q0, %Q1, %R2\n\t" \
182 "mov %R0, #0\n\t" \
183 "umlal %Q0, %R0, %R1, %R2" \
184 : "+r" (__res) \
185 : "r" (__m), "r" (__n) \
186 : "cc" ); \
187 } else { \
188 asm ( "umlal %R0, %Q0, %R2, %Q3\n\t" \
189 "umlal %R0, %1, %Q2, %R3\n\t" \
190 "mov %R0, #0\n\t" \
191 "adds %Q0, %1, %Q0\n\t" \
192 "adc %R0, %R0, #0\n\t" \
193 "umlal %Q0, %R0, %R2, %R3" \
194 : "+r" (__res), "+r" (__z) \
195 : "r" (__m), "r" (__n) \
196 : "cc" ); \
197 } \
198 __res /= __p; \
199 /* The reminder can be computed with 32-bit regs */ \
200 /* only, and gcc is good at that. */ \
201 { \
202 unsigned int __res0 = __res; \
203 unsigned int __b0 = __b; \
204 __r -= __res0 * __b0; \
205 } \
206 /* BUG_ON(__r >= __b || __res * __b + __r != n); */ \
207 n = __res; \
208 } \
209 __r; \
210})
211
212/* our own fls implementation to make sure constant propagation is fine */
213#define __div64_fls(bits) \
214({ \
215 unsigned int __left = (bits), __nr = 0; \
216 if (__left & 0xffff0000) __nr += 16, __left >>= 16; \
217 if (__left & 0x0000ff00) __nr += 8, __left >>= 8; \
218 if (__left & 0x000000f0) __nr += 4, __left >>= 4; \
219 if (__left & 0x0000000c) __nr += 2, __left >>= 2; \
220 if (__left & 0x00000002) __nr += 1; \
221 __nr; \
222})
223
224#endif
225
48#endif 226#endif
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
index 55eb4dc3253d..9bc46b486afb 100644
--- a/include/asm-arm/dma-mapping.h
+++ b/include/asm-arm/dma-mapping.h
@@ -12,6 +12,10 @@
12 * uncached, unwrite-buffered mapped memory space for use with DMA 12 * uncached, unwrite-buffered mapped memory space for use with DMA
13 * devices. This is the "generic" version. The PCI specific version 13 * devices. This is the "generic" version. The PCI specific version
14 * is in pci.h 14 * is in pci.h
15 *
16 * Note: Drivers should NOT use this function directly, as it will break
17 * platforms with CONFIG_DMABOUNCE.
18 * Use the driver DMA support - see dma-mapping.h (dma_sync_*)
15 */ 19 */
16extern void consistent_sync(void *kaddr, size_t size, int rw); 20extern void consistent_sync(void *kaddr, size_t size, int rw);
17 21
@@ -44,7 +48,7 @@ static inline int dma_get_cache_alignment(void)
44 return 32; 48 return 32;
45} 49}
46 50
47static inline int dma_is_consistent(dma_addr_t handle) 51static inline int dma_is_consistent(struct device *dev, dma_addr_t handle)
48{ 52{
49 return !!arch_is_coherent(); 53 return !!arch_is_coherent();
50} 54}
diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h
index 17f0c656d272..642382d2c9f0 100644
--- a/include/asm-arm/elf.h
+++ b/include/asm-arm/elf.h
@@ -1,17 +1,22 @@
1#ifndef __ASMARM_ELF_H 1#ifndef __ASMARM_ELF_H
2#define __ASMARM_ELF_H 2#define __ASMARM_ELF_H
3 3
4 4#ifndef __ASSEMBLY__
5/* 5/*
6 * ELF register definitions.. 6 * ELF register definitions..
7 */ 7 */
8
9#include <asm/ptrace.h> 8#include <asm/ptrace.h>
10#include <asm/user.h> 9#include <asm/user.h>
11 10
12typedef unsigned long elf_greg_t; 11typedef unsigned long elf_greg_t;
13typedef unsigned long elf_freg_t[3]; 12typedef unsigned long elf_freg_t[3];
14 13
14#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
15typedef elf_greg_t elf_gregset_t[ELF_NGREG];
16
17typedef struct user_fp elf_fpregset_t;
18#endif
19
15#define EM_ARM 40 20#define EM_ARM 40
16#define EF_ARM_APCS26 0x08 21#define EF_ARM_APCS26 0x08
17#define EF_ARM_SOFT_FLOAT 0x200 22#define EF_ARM_SOFT_FLOAT 0x200
@@ -23,11 +28,6 @@ typedef unsigned long elf_freg_t[3];
23#define R_ARM_CALL 28 28#define R_ARM_CALL 28
24#define R_ARM_JUMP24 29 29#define R_ARM_JUMP24 29
25 30
26#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
27typedef elf_greg_t elf_gregset_t[ELF_NGREG];
28
29typedef struct user_fp elf_fpregset_t;
30
31/* 31/*
32 * These are used to set parameters in the core dumps. 32 * These are used to set parameters in the core dumps.
33 */ 33 */
@@ -39,97 +39,99 @@ typedef struct user_fp elf_fpregset_t;
39#endif 39#endif
40#define ELF_ARCH EM_ARM 40#define ELF_ARCH EM_ARM
41 41
42#ifdef __KERNEL__
43#include <asm/procinfo.h>
44
45/* 42/*
46 * This is used to ensure we don't load something for the wrong architecture. 43 * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP
47 */ 44 */
48#define elf_check_arch(x) ( ((x)->e_machine == EM_ARM) && (ELF_PROC_OK((x))) ) 45#define HWCAP_SWP 1
49 46#define HWCAP_HALF 2
50#define USE_ELF_CORE_DUMP 47#define HWCAP_THUMB 4
51#define ELF_EXEC_PAGESIZE 4096 48#define HWCAP_26BIT 8 /* Play it safe */
52 49#define HWCAP_FAST_MULT 16
53/* This is the location that an ET_DYN program is loaded if exec'ed. Typical 50#define HWCAP_FPA 32
54 use of this is to invoke "./ld.so someprog" to test out a new version of 51#define HWCAP_VFP 64
55 the loader. We need to make sure that it is out of the way of the program 52#define HWCAP_EDSP 128
56 that it will "exec", and that there is sufficient room for the brk. */ 53#define HWCAP_JAVA 256
57 54#define HWCAP_IWMMXT 512
58#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
59
60/* When the program starts, a1 contains a pointer to a function to be
61 registered with atexit, as per the SVR4 ABI. A value of 0 means we
62 have no such handler. */
63#define ELF_PLAT_INIT(_r, load_addr) (_r)->ARM_r0 = 0
64
65/* This yields a mask that user programs can use to figure out what
66 instruction set this cpu supports. */
67 55
56#ifdef __KERNEL__
57#ifndef __ASSEMBLY__
58/*
59 * This yields a mask that user programs can use to figure out what
60 * instruction set this cpu supports.
61 */
68#define ELF_HWCAP (elf_hwcap) 62#define ELF_HWCAP (elf_hwcap)
63extern unsigned int elf_hwcap;
69 64
70/* This yields a string that ld.so will use to load implementation 65/*
71 specific libraries for optimization. This is more specific in 66 * This yields a string that ld.so will use to load implementation
72 intent than poking at uname or /proc/cpuinfo. */ 67 * specific libraries for optimization. This is more specific in
73 68 * intent than poking at uname or /proc/cpuinfo.
74/* For now we just provide a fairly general string that describes the 69 *
75 processor family. This could be made more specific later if someone 70 * For now we just provide a fairly general string that describes the
76 implemented optimisations that require it. 26-bit CPUs give you 71 * processor family. This could be made more specific later if someone
77 "v1l" for ARM2 (no SWP) and "v2l" for anything else (ARM1 isn't 72 * implemented optimisations that require it. 26-bit CPUs give you
78 supported). 32-bit CPUs give you "v3[lb]" for anything based on an 73 * "v1l" for ARM2 (no SWP) and "v2l" for anything else (ARM1 isn't
79 ARM6 or ARM7 core and "armv4[lb]" for anything based on a StrongARM-1 74 * supported). 32-bit CPUs give you "v3[lb]" for anything based on an
80 core. */ 75 * ARM6 or ARM7 core and "armv4[lb]" for anything based on a StrongARM-1
81 76 * core.
77 */
82#define ELF_PLATFORM_SIZE 8 78#define ELF_PLATFORM_SIZE 8
83extern char elf_platform[];
84#define ELF_PLATFORM (elf_platform) 79#define ELF_PLATFORM (elf_platform)
85 80
81extern char elf_platform[];
82#endif
83
84/*
85 * This is used to ensure we don't load something for the wrong architecture.
86 */
87#define elf_check_arch(x) ((x)->e_machine == EM_ARM && ELF_PROC_OK(x))
88
86/* 89/*
87 * 32-bit code is always OK. Some cpus can do 26-bit, some can't. 90 * 32-bit code is always OK. Some cpus can do 26-bit, some can't.
88 */ 91 */
89#define ELF_PROC_OK(x) (ELF_THUMB_OK(x) && ELF_26BIT_OK(x)) 92#define ELF_PROC_OK(x) (ELF_THUMB_OK(x) && ELF_26BIT_OK(x))
90 93
91#define ELF_THUMB_OK(x) \ 94#define ELF_THUMB_OK(x) \
92 (( (elf_hwcap & HWCAP_THUMB) && ((x)->e_entry & 1) == 1) || \ 95 ((elf_hwcap & HWCAP_THUMB && ((x)->e_entry & 1) == 1) || \
93 ((x)->e_entry & 3) == 0) 96 ((x)->e_entry & 3) == 0)
94 97
95#define ELF_26BIT_OK(x) \ 98#define ELF_26BIT_OK(x) \
96 (( (elf_hwcap & HWCAP_26BIT) && (x)->e_flags & EF_ARM_APCS26) || \ 99 ((elf_hwcap & HWCAP_26BIT && (x)->e_flags & EF_ARM_APCS26) || \
97 ((x)->e_flags & EF_ARM_APCS26) == 0) 100 ((x)->e_flags & EF_ARM_APCS26) == 0)
98 101
99#ifndef CONFIG_IWMMXT 102#define USE_ELF_CORE_DUMP
103#define ELF_EXEC_PAGESIZE 4096
100 104
101/* Old NetWinder binaries were compiled in such a way that the iBCS 105/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
102 heuristic always trips on them. Until these binaries become uncommon 106 use of this is to invoke "./ld.so someprog" to test out a new version of
103 enough not to care, don't trust the `ibcs' flag here. In any case 107 the loader. We need to make sure that it is out of the way of the program
104 there is no other ELF system currently supported by iBCS. 108 that it will "exec", and that there is sufficient room for the brk. */
105 @@ Could print a warning message to encourage users to upgrade. */
106#define SET_PERSONALITY(ex,ibcs2) \
107 set_personality(((ex).e_flags&EF_ARM_APCS26 ?PER_LINUX :PER_LINUX_32BIT))
108 109
109#else 110#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
111
112/* When the program starts, a1 contains a pointer to a function to be
113 registered with atexit, as per the SVR4 ABI. A value of 0 means we
114 have no such handler. */
115#define ELF_PLAT_INIT(_r, load_addr) (_r)->ARM_r0 = 0
110 116
111/* 117/*
112 * All iWMMXt capable CPUs don't support 26-bit mode. Yet they can run 118 * Since the FPA coprocessor uses CP1 and CP2, and iWMMXt uses CP0
113 * legacy binaries which used to contain FPA11 floating point instructions 119 * and CP1, we only enable access to the iWMMXt coprocessor if the
114 * that have always been emulated by the kernel. PFA11 and iWMMXt overlap 120 * binary is EABI or softfloat (and thus, guaranteed not to use
115 * on coprocessor 1 space though. We therefore must decide if given task 121 * FPA instructions.)
116 * is allowed to use CP 0 and 1 for iWMMXt, or if they should be blocked
117 * at all times for the prefetch exception handler to catch FPA11 opcodes
118 * and emulate them. The best indication to discriminate those two cases
119 * is the SOFT_FLOAT flag in the ELF header.
120 */ 122 */
121 123#define SET_PERSONALITY(ex, ibcs2) \
122#define SET_PERSONALITY(ex,ibcs2) \ 124 do { \
123do { \ 125 if ((ex).e_flags & EF_ARM_APCS26) { \
124 set_personality(PER_LINUX_32BIT); \ 126 set_personality(PER_LINUX); \
125 if (((ex).e_flags & EF_ARM_EABI_MASK) || \ 127 } else { \
126 ((ex).e_flags & EF_ARM_SOFT_FLOAT)) \ 128 set_personality(PER_LINUX_32BIT); \
127 set_thread_flag(TIF_USING_IWMMXT); \ 129 if (elf_hwcap & HWCAP_IWMMXT && (ex).e_flags & (EF_ARM_EABI_MASK | EF_ARM_SOFT_FLOAT)) \
128 else \ 130 set_thread_flag(TIF_USING_IWMMXT); \
129 clear_thread_flag(TIF_USING_IWMMXT); \ 131 else \
130} while (0) 132 clear_thread_flag(TIF_USING_IWMMXT); \
131 133 } \
132#endif 134 } while (0)
133 135
134#endif 136#endif
135 137
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index ae999fd5dc67..288f76b166d0 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -75,14 +75,6 @@ extern void __readwrite_bug(const char *fn);
75 */ 75 */
76#include <asm/arch/io.h> 76#include <asm/arch/io.h>
77 77
78#ifdef __io_pci
79#warning machine class uses buggy __io_pci
80#endif
81#if defined(__arch_putb) || defined(__arch_putw) || defined(__arch_putl) || \
82 defined(__arch_getb) || defined(__arch_getw) || defined(__arch_getl)
83#warning machine class uses old __arch_putw or __arch_getw
84#endif
85
86/* 78/*
87 * IO port access primitives 79 * IO port access primitives
88 * ------------------------- 80 * -------------------------
diff --git a/include/asm-arm/mach/irq.h b/include/asm-arm/mach/irq.h
index 0e017ecf2096..eb0bfba6570d 100644
--- a/include/asm-arm/mach/irq.h
+++ b/include/asm-arm/mach/irq.h
@@ -22,12 +22,6 @@ extern void init_FIQ(void);
22extern int show_fiq_list(struct seq_file *, void *); 22extern int show_fiq_list(struct seq_file *, void *);
23 23
24/* 24/*
25 * Function wrappers
26 */
27#define set_irq_chipdata(irq, d) set_irq_chip_data(irq, d)
28#define get_irq_chipdata(irq) get_irq_chip_data(irq)
29
30/*
31 * Obsolete inline function for calling irq descriptor handlers. 25 * Obsolete inline function for calling irq descriptor handlers.
32 */ 26 */
33static inline void desc_handle_irq(unsigned int irq, struct irq_desc *desc) 27static inline void desc_handle_irq(unsigned int irq, struct irq_desc *desc)
@@ -44,12 +38,6 @@ void set_irq_flags(unsigned int irq, unsigned int flags);
44/* 38/*
45 * This is for easy migration, but should be changed in the source 39 * This is for easy migration, but should be changed in the source
46 */ 40 */
47#define do_level_IRQ handle_level_irq
48#define do_edge_IRQ handle_edge_irq
49#define do_simple_IRQ handle_simple_irq
50#define irqdesc irq_desc
51#define irqchip irq_chip
52
53#define do_bad_IRQ(irq,desc) \ 41#define do_bad_IRQ(irq,desc) \
54do { \ 42do { \
55 spin_lock(&desc->lock); \ 43 spin_lock(&desc->lock); \
diff --git a/include/asm-arm/mach/udc_pxa2xx.h b/include/asm-arm/mach/udc_pxa2xx.h
new file mode 100644
index 000000000000..ff0a95715a07
--- /dev/null
+++ b/include/asm-arm/mach/udc_pxa2xx.h
@@ -0,0 +1,26 @@
1/*
2 * linux/include/asm-arm/mach/udc_pxa2xx.h
3 *
4 * This supports machine-specific differences in how the PXA2xx
5 * USB Device Controller (UDC) is wired.
6 *
7 * It is set in linux/arch/arm/mach-pxa/<machine>.c or in
8 * linux/arch/mach-ixp4xx/<machine>.c and used in
9 * the probe routine of linux/drivers/usb/gadget/pxa2xx_udc.c
10 */
11
12struct pxa2xx_udc_mach_info {
13 int (*udc_is_connected)(void); /* do we see host? */
14 void (*udc_command)(int cmd);
15#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
16#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
17
18 /* Boards following the design guidelines in the developer's manual,
19 * with on-chip GPIOs not Lubbock's wierd hardware, can have a sane
20 * VBUS IRQ and omit the methods above. Store the GPIO number
21 * here; for GPIO 0, also mask in one of the pxa_gpio_mode() bits.
22 */
23 u16 gpio_vbus; /* high == vbus present */
24 u16 gpio_pullup; /* high == pullup activated */
25};
26
diff --git a/include/asm-arm/memory.h b/include/asm-arm/memory.h
index 91d536c215d7..d9bfb39adabf 100644
--- a/include/asm-arm/memory.h
+++ b/include/asm-arm/memory.h
@@ -215,6 +215,7 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
215 * virt_addr_valid(k) indicates whether a virtual address is valid 215 * virt_addr_valid(k) indicates whether a virtual address is valid
216 */ 216 */
217#ifndef CONFIG_DISCONTIGMEM 217#ifndef CONFIG_DISCONTIGMEM
218
218#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET 219#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
219#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr)) 220#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
220 221
@@ -230,6 +231,7 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
230 * around in memory. 231 * around in memory.
231 */ 232 */
232#include <linux/numa.h> 233#include <linux/numa.h>
234
233#define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn) 235#define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn)
234#define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT) 236#define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT)
235 237
@@ -256,6 +258,43 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
256 */ 258 */
257#define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT) 259#define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT)
258 260
261/*
262 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
263 * and returns the mem_map of that node.
264 */
265#define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
266
267/*
268 * Given a page frame number, find the owning node of the memory
269 * and returns the mem_map of that node.
270 */
271#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
272
273#ifdef NODE_MEM_SIZE_BITS
274#define NODE_MEM_SIZE_MASK ((1 << NODE_MEM_SIZE_BITS) - 1)
275
276/*
277 * Given a kernel address, find the home node of the underlying memory.
278 */
279#define KVADDR_TO_NID(addr) \
280 (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MEM_SIZE_BITS)
281
282/*
283 * Given a page frame number, convert it to a node id.
284 */
285#define PFN_TO_NID(pfn) \
286 (((pfn) - PHYS_PFN_OFFSET) >> (NODE_MEM_SIZE_BITS - PAGE_SHIFT))
287
288/*
289 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
290 * and returns the index corresponding to the appropriate page in the
291 * node's mem_map.
292 */
293#define LOCAL_MAP_NR(addr) \
294 (((unsigned long)(addr) & NODE_MEM_SIZE_MASK) >> PAGE_SHIFT)
295
296#endif /* NODE_MEM_SIZE_BITS */
297
259#endif /* !CONFIG_DISCONTIGMEM */ 298#endif /* !CONFIG_DISCONTIGMEM */
260 299
261/* 300/*
diff --git a/include/asm-arm/pgtable-nommu.h b/include/asm-arm/pgtable-nommu.h
index c1b264dff287..7b1c9acdf79a 100644
--- a/include/asm-arm/pgtable-nommu.h
+++ b/include/asm-arm/pgtable-nommu.h
@@ -44,7 +44,6 @@
44#define PAGE_READONLY __pgprot(0) 44#define PAGE_READONLY __pgprot(0)
45#define PAGE_KERNEL __pgprot(0) 45#define PAGE_KERNEL __pgprot(0)
46 46
47//extern void paging_init(struct meminfo *, struct machine_desc *);
48#define swapper_pg_dir ((pgd_t *) 0) 47#define swapper_pg_dir ((pgd_t *) 0)
49 48
50#define __swp_type(x) (0) 49#define __swp_type(x) (0)
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index ed8cb5963e99..88cd5c784ef0 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -169,8 +169,7 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
169#define L_PTE_WRITE (1 << 5) 169#define L_PTE_WRITE (1 << 5)
170#define L_PTE_EXEC (1 << 6) 170#define L_PTE_EXEC (1 << 6)
171#define L_PTE_DIRTY (1 << 7) 171#define L_PTE_DIRTY (1 << 7)
172#define L_PTE_COHERENT (1 << 9) /* I/O coherent (xsc3) */ 172#define L_PTE_SHARED (1 << 10) /* shared(v6), coherent(xsc3) */
173#define L_PTE_SHARED (1 << 10) /* shared between CPUs (v6) */
174#define L_PTE_ASID (1 << 11) /* non-global (use ASID, v6) */ 173#define L_PTE_ASID (1 << 11) /* non-global (use ASID, v6) */
175 174
176#ifndef __ASSEMBLY__ 175#ifndef __ASSEMBLY__
diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h
index 04f4d34c6317..b442e8e2a809 100644
--- a/include/asm-arm/processor.h
+++ b/include/asm-arm/processor.h
@@ -20,7 +20,6 @@
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22#include <asm/ptrace.h> 22#include <asm/ptrace.h>
23#include <asm/procinfo.h>
24#include <asm/types.h> 23#include <asm/types.h>
25 24
26union debug_insn { 25union debug_insn {
diff --git a/include/asm-arm/procinfo.h b/include/asm-arm/procinfo.h
index 91a31adfa8a8..4d3c685075e0 100644
--- a/include/asm-arm/procinfo.h
+++ b/include/asm-arm/procinfo.h
@@ -10,7 +10,7 @@
10#ifndef __ASM_PROCINFO_H 10#ifndef __ASM_PROCINFO_H
11#define __ASM_PROCINFO_H 11#define __ASM_PROCINFO_H
12 12
13#ifndef __ASSEMBLY__ 13#ifdef __KERNEL__
14 14
15struct cpu_tlb_fns; 15struct cpu_tlb_fns;
16struct cpu_user_fns; 16struct cpu_user_fns;
@@ -42,19 +42,8 @@ struct proc_info_list {
42 struct cpu_cache_fns *cache; 42 struct cpu_cache_fns *cache;
43}; 43};
44 44
45extern unsigned int elf_hwcap; 45#else /* __KERNEL__ */
46 46#include <asm/elf.h>
47#endif /* __ASSEMBLY__ */ 47#warning "Please include asm/elf.h instead"
48 48#endif /* __KERNEL__ */
49#define HWCAP_SWP 1
50#define HWCAP_HALF 2
51#define HWCAP_THUMB 4
52#define HWCAP_26BIT 8 /* Play it safe */
53#define HWCAP_FAST_MULT 16
54#define HWCAP_FPA 32
55#define HWCAP_VFP 64
56#define HWCAP_EDSP 128
57#define HWCAP_JAVA 256
58#define HWCAP_IWMMXT 512
59
60#endif 49#endif
diff --git a/include/asm-arm/setup.h b/include/asm-arm/setup.h
index aa4b5782f0c9..e5407392afca 100644
--- a/include/asm-arm/setup.h
+++ b/include/asm-arm/setup.h
@@ -14,55 +14,57 @@
14#ifndef __ASMARM_SETUP_H 14#ifndef __ASMARM_SETUP_H
15#define __ASMARM_SETUP_H 15#define __ASMARM_SETUP_H
16 16
17#include <asm/types.h>
18
17#define COMMAND_LINE_SIZE 1024 19#define COMMAND_LINE_SIZE 1024
18 20
19/* The list ends with an ATAG_NONE node. */ 21/* The list ends with an ATAG_NONE node. */
20#define ATAG_NONE 0x00000000 22#define ATAG_NONE 0x00000000
21 23
22struct tag_header { 24struct tag_header {
23 u32 size; 25 __u32 size;
24 u32 tag; 26 __u32 tag;
25}; 27};
26 28
27/* The list must start with an ATAG_CORE node */ 29/* The list must start with an ATAG_CORE node */
28#define ATAG_CORE 0x54410001 30#define ATAG_CORE 0x54410001
29 31
30struct tag_core { 32struct tag_core {
31 u32 flags; /* bit 0 = read-only */ 33 __u32 flags; /* bit 0 = read-only */
32 u32 pagesize; 34 __u32 pagesize;
33 u32 rootdev; 35 __u32 rootdev;
34}; 36};
35 37
36/* it is allowed to have multiple ATAG_MEM nodes */ 38/* it is allowed to have multiple ATAG_MEM nodes */
37#define ATAG_MEM 0x54410002 39#define ATAG_MEM 0x54410002
38 40
39struct tag_mem32 { 41struct tag_mem32 {
40 u32 size; 42 __u32 size;
41 u32 start; /* physical start address */ 43 __u32 start; /* physical start address */
42}; 44};
43 45
44/* VGA text type displays */ 46/* VGA text type displays */
45#define ATAG_VIDEOTEXT 0x54410003 47#define ATAG_VIDEOTEXT 0x54410003
46 48
47struct tag_videotext { 49struct tag_videotext {
48 u8 x; 50 __u8 x;
49 u8 y; 51 __u8 y;
50 u16 video_page; 52 __u16 video_page;
51 u8 video_mode; 53 __u8 video_mode;
52 u8 video_cols; 54 __u8 video_cols;
53 u16 video_ega_bx; 55 __u16 video_ega_bx;
54 u8 video_lines; 56 __u8 video_lines;
55 u8 video_isvga; 57 __u8 video_isvga;
56 u16 video_points; 58 __u16 video_points;
57}; 59};
58 60
59/* describes how the ramdisk will be used in kernel */ 61/* describes how the ramdisk will be used in kernel */
60#define ATAG_RAMDISK 0x54410004 62#define ATAG_RAMDISK 0x54410004
61 63
62struct tag_ramdisk { 64struct tag_ramdisk {
63 u32 flags; /* bit 0 = load, bit 1 = prompt */ 65 __u32 flags; /* bit 0 = load, bit 1 = prompt */
64 u32 size; /* decompressed ramdisk size in _kilo_ bytes */ 66 __u32 size; /* decompressed ramdisk size in _kilo_ bytes */
65 u32 start; /* starting block of floppy-based RAM disk image */ 67 __u32 start; /* starting block of floppy-based RAM disk image */
66}; 68};
67 69
68/* describes where the compressed ramdisk image lives (virtual address) */ 70/* describes where the compressed ramdisk image lives (virtual address) */
@@ -76,23 +78,23 @@ struct tag_ramdisk {
76#define ATAG_INITRD2 0x54420005 78#define ATAG_INITRD2 0x54420005
77 79
78struct tag_initrd { 80struct tag_initrd {
79 u32 start; /* physical start address */ 81 __u32 start; /* physical start address */
80 u32 size; /* size of compressed ramdisk image in bytes */ 82 __u32 size; /* size of compressed ramdisk image in bytes */
81}; 83};
82 84
83/* board serial number. "64 bits should be enough for everybody" */ 85/* board serial number. "64 bits should be enough for everybody" */
84#define ATAG_SERIAL 0x54410006 86#define ATAG_SERIAL 0x54410006
85 87
86struct tag_serialnr { 88struct tag_serialnr {
87 u32 low; 89 __u32 low;
88 u32 high; 90 __u32 high;
89}; 91};
90 92
91/* board revision */ 93/* board revision */
92#define ATAG_REVISION 0x54410007 94#define ATAG_REVISION 0x54410007
93 95
94struct tag_revision { 96struct tag_revision {
95 u32 rev; 97 __u32 rev;
96}; 98};
97 99
98/* initial values for vesafb-type framebuffers. see struct screen_info 100/* initial values for vesafb-type framebuffers. see struct screen_info
@@ -101,20 +103,20 @@ struct tag_revision {
101#define ATAG_VIDEOLFB 0x54410008 103#define ATAG_VIDEOLFB 0x54410008
102 104
103struct tag_videolfb { 105struct tag_videolfb {
104 u16 lfb_width; 106 __u16 lfb_width;
105 u16 lfb_height; 107 __u16 lfb_height;
106 u16 lfb_depth; 108 __u16 lfb_depth;
107 u16 lfb_linelength; 109 __u16 lfb_linelength;
108 u32 lfb_base; 110 __u32 lfb_base;
109 u32 lfb_size; 111 __u32 lfb_size;
110 u8 red_size; 112 __u8 red_size;
111 u8 red_pos; 113 __u8 red_pos;
112 u8 green_size; 114 __u8 green_size;
113 u8 green_pos; 115 __u8 green_pos;
114 u8 blue_size; 116 __u8 blue_size;
115 u8 blue_pos; 117 __u8 blue_pos;
116 u8 rsvd_size; 118 __u8 rsvd_size;
117 u8 rsvd_pos; 119 __u8 rsvd_pos;
118}; 120};
119 121
120/* command line: \0 terminated string */ 122/* command line: \0 terminated string */
@@ -128,17 +130,17 @@ struct tag_cmdline {
128#define ATAG_ACORN 0x41000101 130#define ATAG_ACORN 0x41000101
129 131
130struct tag_acorn { 132struct tag_acorn {
131 u32 memc_control_reg; 133 __u32 memc_control_reg;
132 u32 vram_pages; 134 __u32 vram_pages;
133 u8 sounddefault; 135 __u8 sounddefault;
134 u8 adfsdrives; 136 __u8 adfsdrives;
135}; 137};
136 138
137/* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */ 139/* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */
138#define ATAG_MEMCLK 0x41000402 140#define ATAG_MEMCLK 0x41000402
139 141
140struct tag_memclk { 142struct tag_memclk {
141 u32 fmemclk; 143 __u32 fmemclk;
142}; 144};
143 145
144struct tag { 146struct tag {
@@ -167,24 +169,26 @@ struct tag {
167}; 169};
168 170
169struct tagtable { 171struct tagtable {
170 u32 tag; 172 __u32 tag;
171 int (*parse)(const struct tag *); 173 int (*parse)(const struct tag *);
172}; 174};
173 175
174#define __tag __attribute_used__ __attribute__((__section__(".taglist.init")))
175#define __tagtable(tag, fn) \
176static struct tagtable __tagtable_##fn __tag = { tag, fn }
177
178#define tag_member_present(tag,member) \ 176#define tag_member_present(tag,member) \
179 ((unsigned long)(&((struct tag *)0L)->member + 1) \ 177 ((unsigned long)(&((struct tag *)0L)->member + 1) \
180 <= (tag)->hdr.size * 4) 178 <= (tag)->hdr.size * 4)
181 179
182#define tag_next(t) ((struct tag *)((u32 *)(t) + (t)->hdr.size)) 180#define tag_next(t) ((struct tag *)((__u32 *)(t) + (t)->hdr.size))
183#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2) 181#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
184 182
185#define for_each_tag(t,base) \ 183#define for_each_tag(t,base) \
186 for (t = base; t->hdr.size; t = tag_next(t)) 184 for (t = base; t->hdr.size; t = tag_next(t))
187 185
186#ifdef __KERNEL__
187
188#define __tag __attribute_used__ __attribute__((__section__(".taglist.init")))
189#define __tagtable(tag, fn) \
190static struct tagtable __tagtable_##fn __tag = { tag, fn }
191
188/* 192/*
189 * Memory map description 193 * Memory map description
190 */ 194 */
@@ -217,4 +221,6 @@ struct early_params {
217static struct early_params __early_##fn __attribute_used__ \ 221static struct early_params __early_##fn __attribute_used__ \
218__attribute__((__section__(".early_param.init"))) = { name, fn } 222__attribute__((__section__(".early_param.init"))) = { name, fn }
219 223
224#endif /* __KERNEL__ */
225
220#endif 226#endif
diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h
index f28b236139ed..d9b8bddc8732 100644
--- a/include/asm-arm/thread_info.h
+++ b/include/asm-arm/thread_info.h
@@ -94,8 +94,18 @@ static inline struct thread_info *current_thread_info(void)
94 return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); 94 return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
95} 95}
96 96
97extern struct thread_info *alloc_thread_info(struct task_struct *task); 97/* thread information allocation */
98extern void free_thread_info(struct thread_info *); 98#ifdef CONFIG_DEBUG_STACK_USAGE
99#define alloc_thread_info(tsk) \
100 ((struct thread_info *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, \
101 THREAD_SIZE_ORDER))
102#else
103#define alloc_thread_info(tsk) \
104 ((struct thread_info *)__get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
105#endif
106
107#define free_thread_info(info) \
108 free_pages((unsigned long)info, THREAD_SIZE_ORDER);
99 109
100#define thread_saved_pc(tsk) \ 110#define thread_saved_pc(tsk) \
101 ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc))) 111 ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 14a87eec5a2d..d44c629d8424 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -377,156 +377,6 @@
377#endif 377#endif
378 378
379#ifdef __KERNEL__ 379#ifdef __KERNEL__
380#include <linux/err.h>
381#include <linux/linkage.h>
382
383#define __sys2(x) #x
384#define __sys1(x) __sys2(x)
385
386#ifndef __syscall
387#if defined(__thumb__) || defined(__ARM_EABI__)
388#define __SYS_REG(name) register long __sysreg __asm__("r7") = __NR_##name;
389#define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs
390#define __syscall(name) "swi\t0"
391#else
392#define __SYS_REG(name)
393#define __SYS_REG_LIST(regs...) regs
394#define __syscall(name) "swi\t" __sys1(__NR_##name) ""
395#endif
396#endif
397
398#define __syscall_return(type, res) \
399do { \
400 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
401 errno = -(res); \
402 res = -1; \
403 } \
404 return (type) (res); \
405} while (0)
406
407#define _syscall0(type,name) \
408type name(void) { \
409 __SYS_REG(name) \
410 register long __res_r0 __asm__("r0"); \
411 long __res; \
412 __asm__ __volatile__ ( \
413 __syscall(name) \
414 : "=r" (__res_r0) \
415 : __SYS_REG_LIST() \
416 : "memory" ); \
417 __res = __res_r0; \
418 __syscall_return(type,__res); \
419}
420
421#define _syscall1(type,name,type1,arg1) \
422type name(type1 arg1) { \
423 __SYS_REG(name) \
424 register long __r0 __asm__("r0") = (long)arg1; \
425 register long __res_r0 __asm__("r0"); \
426 long __res; \
427 __asm__ __volatile__ ( \
428 __syscall(name) \
429 : "=r" (__res_r0) \
430 : __SYS_REG_LIST( "0" (__r0) ) \
431 : "memory" ); \
432 __res = __res_r0; \
433 __syscall_return(type,__res); \
434}
435
436#define _syscall2(type,name,type1,arg1,type2,arg2) \
437type name(type1 arg1,type2 arg2) { \
438 __SYS_REG(name) \
439 register long __r0 __asm__("r0") = (long)arg1; \
440 register long __r1 __asm__("r1") = (long)arg2; \
441 register long __res_r0 __asm__("r0"); \
442 long __res; \
443 __asm__ __volatile__ ( \
444 __syscall(name) \
445 : "=r" (__res_r0) \
446 : __SYS_REG_LIST( "0" (__r0), "r" (__r1) ) \
447 : "memory" ); \
448 __res = __res_r0; \
449 __syscall_return(type,__res); \
450}
451
452
453#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
454type name(type1 arg1,type2 arg2,type3 arg3) { \
455 __SYS_REG(name) \
456 register long __r0 __asm__("r0") = (long)arg1; \
457 register long __r1 __asm__("r1") = (long)arg2; \
458 register long __r2 __asm__("r2") = (long)arg3; \
459 register long __res_r0 __asm__("r0"); \
460 long __res; \
461 __asm__ __volatile__ ( \
462 __syscall(name) \
463 : "=r" (__res_r0) \
464 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2) ) \
465 : "memory" ); \
466 __res = __res_r0; \
467 __syscall_return(type,__res); \
468}
469
470
471#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\
472type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
473 __SYS_REG(name) \
474 register long __r0 __asm__("r0") = (long)arg1; \
475 register long __r1 __asm__("r1") = (long)arg2; \
476 register long __r2 __asm__("r2") = (long)arg3; \
477 register long __r3 __asm__("r3") = (long)arg4; \
478 register long __res_r0 __asm__("r0"); \
479 long __res; \
480 __asm__ __volatile__ ( \
481 __syscall(name) \
482 : "=r" (__res_r0) \
483 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), "r" (__r3) ) \
484 : "memory" ); \
485 __res = __res_r0; \
486 __syscall_return(type,__res); \
487}
488
489
490#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
491type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \
492 __SYS_REG(name) \
493 register long __r0 __asm__("r0") = (long)arg1; \
494 register long __r1 __asm__("r1") = (long)arg2; \
495 register long __r2 __asm__("r2") = (long)arg3; \
496 register long __r3 __asm__("r3") = (long)arg4; \
497 register long __r4 __asm__("r4") = (long)arg5; \
498 register long __res_r0 __asm__("r0"); \
499 long __res; \
500 __asm__ __volatile__ ( \
501 __syscall(name) \
502 : "=r" (__res_r0) \
503 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \
504 "r" (__r3), "r" (__r4) ) \
505 : "memory" ); \
506 __res = __res_r0; \
507 __syscall_return(type,__res); \
508}
509
510#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
511type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \
512 __SYS_REG(name) \
513 register long __r0 __asm__("r0") = (long)arg1; \
514 register long __r1 __asm__("r1") = (long)arg2; \
515 register long __r2 __asm__("r2") = (long)arg3; \
516 register long __r3 __asm__("r3") = (long)arg4; \
517 register long __r4 __asm__("r4") = (long)arg5; \
518 register long __r5 __asm__("r5") = (long)arg6; \
519 register long __res_r0 __asm__("r0"); \
520 long __res; \
521 __asm__ __volatile__ ( \
522 __syscall(name) \
523 : "=r" (__res_r0) \
524 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \
525 "r" (__r3), "r" (__r4), "r" (__r5) ) \
526 : "memory" ); \
527 __res = __res_r0; \
528 __syscall_return(type,__res); \
529}
530 380
531#define __ARCH_WANT_IPC_PARSE_VERSION 381#define __ARCH_WANT_IPC_PARSE_VERSION
532#define __ARCH_WANT_STAT64 382#define __ARCH_WANT_STAT64
diff --git a/include/asm-arm26/checksum.h b/include/asm-arm26/checksum.h
index d4256d5f3a7c..f2b4b0a403bd 100644
--- a/include/asm-arm26/checksum.h
+++ b/include/asm-arm26/checksum.h
@@ -23,7 +23,7 @@
23 * 23 *
24 * it's best to have buff aligned on a 32-bit boundary 24 * it's best to have buff aligned on a 32-bit boundary
25 */ 25 */
26unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 26__wsum csum_partial(const void *buff, int len, __wsum sum);
27 27
28/* 28/*
29 * the same as csum_partial, but copies from src while it 29 * the same as csum_partial, but copies from src while it
@@ -33,26 +33,18 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
33 * better 64-bit) boundary 33 * better 64-bit) boundary
34 */ 34 */
35 35
36unsigned int 36__wsum
37csum_partial_copy_nocheck(const char *src, char *dst, int len, int sum); 37csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
38 38
39unsigned int 39__wsum
40csum_partial_copy_from_user(const char __user *src, char *dst, int len, int sum, int *err_ptr); 40csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr);
41
42/*
43 * This is the old (and unsafe) way of doing checksums, a warning message will
44 * be printed if it is used and an exception occurs.
45 *
46 * this functions should go away after some time.
47 */
48#define csum_partial_copy(src,dst,len,sum) csum_partial_copy_nocheck(src,dst,len,sum)
49 41
50/* 42/*
51 * This is a version of ip_compute_csum() optimized for IP headers, 43 * This is a version of ip_compute_csum() optimized for IP headers,
52 * which always checksum on 4 octet boundaries. 44 * which always checksum on 4 octet boundaries.
53 */ 45 */
54static inline unsigned short 46static inline __sum16
55ip_fast_csum(unsigned char * iph, unsigned int ihl) 47ip_fast_csum(const void *iph, unsigned int ihl)
56{ 48{
57 unsigned int sum, tmp1; 49 unsigned int sum, tmp1;
58 50
@@ -78,14 +70,13 @@ ip_fast_csum(unsigned char * iph, unsigned int ihl)
78 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1) 70 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1)
79 : "1" (iph), "2" (ihl) 71 : "1" (iph), "2" (ihl)
80 : "cc"); 72 : "cc");
81 return sum; 73 return (__force __sum16)sum;
82} 74}
83 75
84/* 76/*
85 * Fold a partial checksum without adding pseudo headers 77 * Fold a partial checksum without adding pseudo headers
86 */ 78 */
87static inline unsigned int 79static inline __sum16 csum_fold(__wsum sum)
88csum_fold(unsigned int sum)
89{ 80{
90 __asm__( 81 __asm__(
91 "adds %0, %1, %1, lsl #16 @ csum_fold \n\ 82 "adds %0, %1, %1, lsl #16 @ csum_fold \n\
@@ -93,12 +84,12 @@ csum_fold(unsigned int sum)
93 : "=r" (sum) 84 : "=r" (sum)
94 : "r" (sum) 85 : "r" (sum)
95 : "cc"); 86 : "cc");
96 return (~sum) >> 16; 87 return (__force __sum16)(~(__force u32)sum >> 16);
97} 88}
98 89
99static inline unsigned int 90static inline __wsum
100csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 91csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
101 unsigned int proto, unsigned int sum) 92 unsigned short proto, __wsum sum)
102{ 93{
103 __asm__( 94 __asm__(
104 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\ 95 "adds %0, %1, %2 @ csum_tcpudp_nofold \n\
@@ -107,7 +98,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
107 adcs %0, %0, %5 \n\ 98 adcs %0, %0, %5 \n\
108 adc %0, %0, #0" 99 adc %0, %0, #0"
109 : "=&r"(sum) 100 : "=&r"(sum)
110 : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto)) 101 : "r" (sum), "r" (daddr), "r" (saddr), "r" (htons(len)), "Ir" (htons(proto))
111 : "cc"); 102 : "cc");
112 return sum; 103 return sum;
113} 104}
@@ -115,9 +106,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
115 * computes the checksum of the TCP/UDP pseudo-header 106 * computes the checksum of the TCP/UDP pseudo-header
116 * returns a 16-bit checksum, already complemented 107 * returns a 16-bit checksum, already complemented
117 */ 108 */
118static inline unsigned short int 109static inline __sum16
119csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 110csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
120 unsigned int proto, unsigned int sum) 111 unsigned short proto, __wsum sum)
121{ 112{
122 __asm__( 113 __asm__(
123 "adds %0, %1, %2 @ csum_tcpudp_magic \n\ 114 "adds %0, %1, %2 @ csum_tcpudp_magic \n\
@@ -129,9 +120,9 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
129 addcs %0, %0, #0x10000 \n\ 120 addcs %0, %0, #0x10000 \n\
130 mvn %0, %0" 121 mvn %0, %0"
131 : "=&r"(sum) 122 : "=&r"(sum)
132 : "r" (sum), "r" (daddr), "r" (saddr), "r" (ntohs(len)), "Ir" (ntohs(proto)) 123 : "r" (sum), "r" (daddr), "r" (saddr), "r" (htons(len)), "Ir" (htons(proto))
133 : "cc"); 124 : "cc");
134 return sum >> 16; 125 return (__force __sum16)((__force u32)sum >> 16);
135} 126}
136 127
137 128
@@ -139,20 +130,20 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
139 * this routine is used for miscellaneous IP-like checksums, mainly 130 * this routine is used for miscellaneous IP-like checksums, mainly
140 * in icmp.c 131 * in icmp.c
141 */ 132 */
142static inline unsigned short 133static inline __sum16
143ip_compute_csum(unsigned char * buff, int len) 134ip_compute_csum(const void *buff, int len)
144{ 135{
145 return csum_fold(csum_partial(buff, len, 0)); 136 return csum_fold(csum_partial(buff, len, 0));
146} 137}
147 138
148#define _HAVE_ARCH_IPV6_CSUM 139#define _HAVE_ARCH_IPV6_CSUM
149extern unsigned long 140extern __wsum
150__csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, __u32 len, 141__csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __be32 len,
151 __u32 proto, unsigned int sum); 142 __be32 proto, __wsum sum);
152 143
153static inline unsigned short int 144static inline __sum16
154csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, __u32 len, 145csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __u32 len,
155 unsigned short proto, unsigned int sum) 146 unsigned short proto, __wsum sum)
156{ 147{
157 return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len), 148 return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len),
158 htonl(proto), sum)); 149 htonl(proto), sum));
diff --git a/include/asm-arm26/device.h b/include/asm-arm26/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-arm26/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-arm26/pgalloc.h b/include/asm-arm26/pgalloc.h
index 6437167b1ffe..7725af3ddb4d 100644
--- a/include/asm-arm26/pgalloc.h
+++ b/include/asm-arm26/pgalloc.h
@@ -15,7 +15,7 @@
15#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17 17
18extern kmem_cache_t *pte_cache; 18extern struct kmem_cache *pte_cache;
19 19
20static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr){ 20static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr){
21 return kmem_cache_alloc(pte_cache, GFP_KERNEL); 21 return kmem_cache_alloc(pte_cache, GFP_KERNEL);
diff --git a/include/asm-arm26/setup.h b/include/asm-arm26/setup.h
index 6348931be65d..1a867b4e8d53 100644
--- a/include/asm-arm26/setup.h
+++ b/include/asm-arm26/setup.h
@@ -16,6 +16,8 @@
16 16
17#define COMMAND_LINE_SIZE 1024 17#define COMMAND_LINE_SIZE 1024
18 18
19#ifdef __KERNEL__
20
19/* The list ends with an ATAG_NONE node. */ 21/* The list ends with an ATAG_NONE node. */
20#define ATAG_NONE 0x00000000 22#define ATAG_NONE 0x00000000
21 23
@@ -202,4 +204,6 @@ struct meminfo {
202 204
203extern struct meminfo meminfo; 205extern struct meminfo meminfo;
204 206
207#endif /* __KERNEL__ */
208
205#endif 209#endif
diff --git a/include/asm-arm26/unistd.h b/include/asm-arm26/unistd.h
index 25a5eead85be..4c3b919177e5 100644
--- a/include/asm-arm26/unistd.h
+++ b/include/asm-arm26/unistd.h
@@ -311,139 +311,6 @@
311#define __ARM_NR_usr26 (__ARM_NR_BASE+3) 311#define __ARM_NR_usr26 (__ARM_NR_BASE+3)
312 312
313#ifdef __KERNEL__ 313#ifdef __KERNEL__
314#include <linux/err.h>
315#include <linux/linkage.h>
316
317#define __sys2(x) #x
318#define __sys1(x) __sys2(x)
319
320#ifndef __syscall
321#define __syscall(name) "swi\t" __sys1(__NR_##name) ""
322#endif
323
324#define __syscall_return(type, res) \
325do { \
326 if ((unsigned long)(res) >= (unsigned long)-MAX_ERRNO) { \
327 errno = -(res); \
328 res = -1; \
329 } \
330 return (type) (res); \
331} while (0)
332
333#define _syscall0(type,name) \
334type name(void) { \
335 register long __res_r0 __asm__("r0"); \
336 long __res; \
337 __asm__ __volatile__ ( \
338 __syscall(name) \
339 : "=r" (__res_r0) \
340 : \
341 : "lr"); \
342 __res = __res_r0; \
343 __syscall_return(type,__res); \
344}
345
346#define _syscall1(type,name,type1,arg1) \
347type name(type1 arg1) { \
348 register long __r0 __asm__("r0") = (long)arg1; \
349 register long __res_r0 __asm__("r0"); \
350 long __res; \
351 __asm__ __volatile__ ( \
352 __syscall(name) \
353 : "=r" (__res_r0) \
354 : "r" (__r0) \
355 : "lr"); \
356 __res = __res_r0; \
357 __syscall_return(type,__res); \
358}
359
360#define _syscall2(type,name,type1,arg1,type2,arg2) \
361type name(type1 arg1,type2 arg2) { \
362 register long __r0 __asm__("r0") = (long)arg1; \
363 register long __r1 __asm__("r1") = (long)arg2; \
364 register long __res_r0 __asm__("r0"); \
365 long __res; \
366 __asm__ __volatile__ ( \
367 __syscall(name) \
368 : "=r" (__res_r0) \
369 : "r" (__r0),"r" (__r1) \
370 : "lr"); \
371 __res = __res_r0; \
372 __syscall_return(type,__res); \
373}
374
375
376#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
377type name(type1 arg1,type2 arg2,type3 arg3) { \
378 register long __r0 __asm__("r0") = (long)arg1; \
379 register long __r1 __asm__("r1") = (long)arg2; \
380 register long __r2 __asm__("r2") = (long)arg3; \
381 register long __res_r0 __asm__("r0"); \
382 long __res; \
383 __asm__ __volatile__ ( \
384 __syscall(name) \
385 : "=r" (__res_r0) \
386 : "r" (__r0),"r" (__r1),"r" (__r2) \
387 : "lr"); \
388 __res = __res_r0; \
389 __syscall_return(type,__res); \
390}
391
392
393#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\
394type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
395 register long __r0 __asm__("r0") = (long)arg1; \
396 register long __r1 __asm__("r1") = (long)arg2; \
397 register long __r2 __asm__("r2") = (long)arg3; \
398 register long __r3 __asm__("r3") = (long)arg4; \
399 register long __res_r0 __asm__("r0"); \
400 long __res; \
401 __asm__ __volatile__ ( \
402 __syscall(name) \
403 : "=r" (__res_r0) \
404 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3) \
405 : "lr"); \
406 __res = __res_r0; \
407 __syscall_return(type,__res); \
408}
409
410
411#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
412type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \
413 register long __r0 __asm__("r0") = (long)arg1; \
414 register long __r1 __asm__("r1") = (long)arg2; \
415 register long __r2 __asm__("r2") = (long)arg3; \
416 register long __r3 __asm__("r3") = (long)arg4; \
417 register long __r4 __asm__("r4") = (long)arg5; \
418 register long __res_r0 __asm__("r0"); \
419 long __res; \
420 __asm__ __volatile__ ( \
421 __syscall(name) \
422 : "=r" (__res_r0) \
423 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3),"r" (__r4) \
424 : "lr"); \
425 __res = __res_r0; \
426 __syscall_return(type,__res); \
427}
428
429#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
430type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \
431 register long __r0 __asm__("r0") = (long)arg1; \
432 register long __r1 __asm__("r1") = (long)arg2; \
433 register long __r2 __asm__("r2") = (long)arg3; \
434 register long __r3 __asm__("r3") = (long)arg4; \
435 register long __r4 __asm__("r4") = (long)arg5; \
436 register long __r5 __asm__("r5") = (long)arg6; \
437 register long __res_r0 __asm__("r0"); \
438 long __res; \
439 __asm__ __volatile__ ( \
440 __syscall(name) \
441 : "=r" (__res_r0) \
442 : "r" (__r0),"r" (__r1),"r" (__r2),"r" (__r3), "r" (__r4),"r" (__r5) \
443 : "lr"); \
444 __res = __res_r0; \
445 __syscall_return(type,__res); \
446}
447 314
448#define __ARCH_WANT_IPC_PARSE_VERSION 315#define __ARCH_WANT_IPC_PARSE_VERSION
449#define __ARCH_WANT_OLD_READDIR 316#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-avr32/arch-at32ap/at91rm9200_pdc.h b/include/asm-avr32/arch-at32ap/at91_pdc.h
index ce1150d4438d..79d6e02fa45e 100644
--- a/include/asm-avr32/arch-at32ap/at91rm9200_pdc.h
+++ b/include/asm-avr32/arch-at32ap/at91_pdc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_pdc.h 2 * include/asm-arm/arch-at91rm9200/at91_pdc.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
@@ -13,8 +13,8 @@
13 * (at your option) any later version. 13 * (at your option) any later version.
14 */ 14 */
15 15
16#ifndef AT91RM9200_PDC_H 16#ifndef AT91_PDC_H
17#define AT91RM9200_PDC_H 17#define AT91_PDC_H
18 18
19#define AT91_PDC_RPR 0x100 /* Receive Pointer Register */ 19#define AT91_PDC_RPR 0x100 /* Receive Pointer Register */
20#define AT91_PDC_RCR 0x104 /* Receive Counter Register */ 20#define AT91_PDC_RCR 0x104 /* Receive Counter Register */
diff --git a/include/asm-avr32/checksum.h b/include/asm-avr32/checksum.h
index 41b7af09edc4..af9d53f0f5d2 100644
--- a/include/asm-avr32/checksum.h
+++ b/include/asm-avr32/checksum.h
@@ -20,8 +20,7 @@
20 * 20 *
21 * it's best to have buff aligned on a 32-bit boundary 21 * it's best to have buff aligned on a 32-bit boundary
22 */ 22 */
23unsigned int csum_partial(const unsigned char * buff, int len, 23__wsum csum_partial(const void *buff, int len, __wsum sum);
24 unsigned int sum);
25 24
26/* 25/*
27 * the same as csum_partial, but copies from src while it 26 * the same as csum_partial, but copies from src while it
@@ -30,8 +29,8 @@ unsigned int csum_partial(const unsigned char * buff, int len,
30 * here even more important to align src and dst on a 32-bit (or even 29 * here even more important to align src and dst on a 32-bit (or even
31 * better 64-bit) boundary 30 * better 64-bit) boundary
32 */ 31 */
33unsigned int csum_partial_copy_generic(const char *src, char *dst, int len, 32__wsum csum_partial_copy_generic(const void *src, void *dst, int len,
34 int sum, int *src_err_ptr, 33 __wsum sum, int *src_err_ptr,
35 int *dst_err_ptr); 34 int *dst_err_ptr);
36 35
37/* 36/*
@@ -42,17 +41,17 @@ unsigned int csum_partial_copy_generic(const char *src, char *dst, int len,
42 * verify_area(). 41 * verify_area().
43 */ 42 */
44static inline 43static inline
45unsigned int csum_partial_copy_nocheck(const char *src, char *dst, 44__wsum csum_partial_copy_nocheck(const void *src, void *dst,
46 int len, int sum) 45 int len, __wsum sum)
47{ 46{
48 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL); 47 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
49} 48}
50 49
51static inline 50static inline
52unsigned int csum_partial_copy_from_user (const char __user *src, char *dst, 51__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
53 int len, int sum, int *err_ptr) 52 int len, __wsum sum, int *err_ptr)
54{ 53{
55 return csum_partial_copy_generic((const char __force *)src, dst, len, 54 return csum_partial_copy_generic((const void __force *)src, dst, len,
56 sum, err_ptr, NULL); 55 sum, err_ptr, NULL);
57} 56}
58 57
@@ -60,8 +59,7 @@ unsigned int csum_partial_copy_from_user (const char __user *src, char *dst,
60 * This is a version of ip_compute_csum() optimized for IP headers, 59 * This is a version of ip_compute_csum() optimized for IP headers,
61 * which always checksum on 4 octet boundaries. 60 * which always checksum on 4 octet boundaries.
62 */ 61 */
63static inline unsigned short ip_fast_csum(unsigned char *iph, 62static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
64 unsigned int ihl)
65{ 63{
66 unsigned int sum, tmp; 64 unsigned int sum, tmp;
67 65
@@ -90,14 +88,14 @@ static inline unsigned short ip_fast_csum(unsigned char *iph,
90 : "=r"(sum), "=r"(iph), "=r"(ihl), "=r"(tmp) 88 : "=r"(sum), "=r"(iph), "=r"(ihl), "=r"(tmp)
91 : "1"(iph), "2"(ihl) 89 : "1"(iph), "2"(ihl)
92 : "memory", "cc"); 90 : "memory", "cc");
93 return sum; 91 return (__force __sum16)sum;
94} 92}
95 93
96/* 94/*
97 * Fold a partial checksum 95 * Fold a partial checksum
98 */ 96 */
99 97
100static inline unsigned int csum_fold(unsigned int sum) 98static inline __sum16 csum_fold(__wsum sum)
101{ 99{
102 unsigned int tmp; 100 unsigned int tmp;
103 101
@@ -109,21 +107,20 @@ static inline unsigned int csum_fold(unsigned int sum)
109 : "=&r"(sum), "=&r"(tmp) 107 : "=&r"(sum), "=&r"(tmp)
110 : "0"(sum)); 108 : "0"(sum));
111 109
112 return ~sum; 110 return (__force __sum16)~sum;
113} 111}
114 112
115static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 113static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
116 unsigned long daddr,
117 unsigned short len, 114 unsigned short len,
118 unsigned short proto, 115 unsigned short proto,
119 unsigned int sum) 116 __wsum sum)
120{ 117{
121 asm(" add %0, %1\n" 118 asm(" add %0, %1\n"
122 " adc %0, %0, %2\n" 119 " adc %0, %0, %2\n"
123 " adc %0, %0, %3\n" 120 " adc %0, %0, %3\n"
124 " acr %0" 121 " acr %0"
125 : "=r"(sum) 122 : "=r"(sum)
126 : "r"(daddr), "r"(saddr), "r"(ntohs(len) | (proto << 16)), 123 : "r"(daddr), "r"(saddr), "r"(len + proto),
127 "0"(sum) 124 "0"(sum)
128 : "cc"); 125 : "cc");
129 126
@@ -134,11 +131,10 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
134 * computes the checksum of the TCP/UDP pseudo-header 131 * computes the checksum of the TCP/UDP pseudo-header
135 * returns a 16-bit checksum, already complemented 132 * returns a 16-bit checksum, already complemented
136 */ 133 */
137static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 134static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
138 unsigned long daddr,
139 unsigned short len, 135 unsigned short len,
140 unsigned short proto, 136 unsigned short proto,
141 unsigned int sum) 137 __wsum sum)
142{ 138{
143 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 139 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
144} 140}
@@ -148,7 +144,7 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
148 * in icmp.c 144 * in icmp.c
149 */ 145 */
150 146
151static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 147static inline __sum16 ip_compute_csum(const void *buff, int len)
152{ 148{
153 return csum_fold(csum_partial(buff, len, 0)); 149 return csum_fold(csum_partial(buff, len, 0));
154} 150}
diff --git a/include/asm-avr32/device.h b/include/asm-avr32/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-avr32/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
index 4c40cb41cdf8..0580b5d62bba 100644
--- a/include/asm-avr32/dma-mapping.h
+++ b/include/asm-avr32/dma-mapping.h
@@ -8,7 +8,8 @@
8#include <asm/cacheflush.h> 8#include <asm/cacheflush.h>
9#include <asm/io.h> 9#include <asm/io.h>
10 10
11extern void dma_cache_sync(void *vaddr, size_t size, int direction); 11extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
12 int direction);
12 13
13/* 14/*
14 * Return whether the given device DMA address mask can be supported 15 * Return whether the given device DMA address mask can be supported
@@ -307,7 +308,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
307#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 308#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
308#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 309#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
309 310
310static inline int dma_is_consistent(dma_addr_t dma_addr) 311static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
311{ 312{
312 return 1; 313 return 1;
313} 314}
diff --git a/include/asm-avr32/setup.h b/include/asm-avr32/setup.h
index 10193da4113b..0a5224245e44 100644
--- a/include/asm-avr32/setup.h
+++ b/include/asm-avr32/setup.h
@@ -13,6 +13,8 @@
13 13
14#define COMMAND_LINE_SIZE 256 14#define COMMAND_LINE_SIZE 256
15 15
16#ifdef __KERNEL__
17
16/* Magic number indicating that a tag table is present */ 18/* Magic number indicating that a tag table is present */
17#define ATAG_MAGIC 0xa2a25441 19#define ATAG_MAGIC 0xa2a25441
18 20
@@ -138,4 +140,6 @@ void chip_enable_sdram(void);
138 140
139#endif /* !__ASSEMBLY__ */ 141#endif /* !__ASSEMBLY__ */
140 142
143#endif /* __KERNEL__ */
144
141#endif /* __ASM_AVR32_SETUP_H__ */ 145#endif /* __ASM_AVR32_SETUP_H__ */
diff --git a/include/asm-avr32/types.h b/include/asm-avr32/types.h
index 3f47db9675af..2bff153a32ed 100644
--- a/include/asm-avr32/types.h
+++ b/include/asm-avr32/types.h
@@ -57,11 +57,6 @@ typedef unsigned long long u64;
57 57
58typedef u32 dma_addr_t; 58typedef u32 dma_addr_t;
59 59
60#ifdef CONFIG_LBD
61typedef u64 sector_t;
62#define HAVE_SECTOR_T
63#endif
64
65#endif /* __ASSEMBLY__ */ 60#endif /* __ASSEMBLY__ */
66 61
67#endif /* __KERNEL__ */ 62#endif /* __KERNEL__ */
diff --git a/include/asm-avr32/unistd.h b/include/asm-avr32/unistd.h
index a50e5004550c..56ed1f9d348a 100644
--- a/include/asm-avr32/unistd.h
+++ b/include/asm-avr32/unistd.h
@@ -280,9 +280,10 @@
280#define __NR_sync_file_range 262 280#define __NR_sync_file_range 262
281#define __NR_tee 263 281#define __NR_tee 263
282#define __NR_vmsplice 264 282#define __NR_vmsplice 264
283#define __NR_epoll_pwait 265
283 284
284#ifdef __KERNEL__ 285#ifdef __KERNEL__
285#define NR_syscalls 265 286#define NR_syscalls 266
286 287
287 288
288#define __ARCH_WANT_IPC_PARSE_VERSION 289#define __ARCH_WANT_IPC_PARSE_VERSION
diff --git a/include/asm-cris/arch-v10/bitops.h b/include/asm-cris/arch-v10/bitops.h
index b73f5396e5a6..be85f6de25d3 100644
--- a/include/asm-cris/arch-v10/bitops.h
+++ b/include/asm-cris/arch-v10/bitops.h
@@ -10,7 +10,7 @@
10 * number. They differ in that the first function also inverts all bits 10 * number. They differ in that the first function also inverts all bits
11 * in the input. 11 * in the input.
12 */ 12 */
13extern inline unsigned long cris_swapnwbrlz(unsigned long w) 13static inline unsigned long cris_swapnwbrlz(unsigned long w)
14{ 14{
15 /* Let's just say we return the result in the same register as the 15 /* Let's just say we return the result in the same register as the
16 input. Saying we clobber the input but can return the result 16 input. Saying we clobber the input but can return the result
@@ -26,7 +26,7 @@ extern inline unsigned long cris_swapnwbrlz(unsigned long w)
26 return res; 26 return res;
27} 27}
28 28
29extern inline unsigned long cris_swapwbrlz(unsigned long w) 29static inline unsigned long cris_swapwbrlz(unsigned long w)
30{ 30{
31 unsigned res; 31 unsigned res;
32 __asm__ ("swapwbr %0 \n\t" 32 __asm__ ("swapwbr %0 \n\t"
@@ -40,7 +40,7 @@ extern inline unsigned long cris_swapwbrlz(unsigned long w)
40 * ffz = Find First Zero in word. Undefined if no zero exists, 40 * ffz = Find First Zero in word. Undefined if no zero exists,
41 * so code should check against ~0UL first.. 41 * so code should check against ~0UL first..
42 */ 42 */
43extern inline unsigned long ffz(unsigned long w) 43static inline unsigned long ffz(unsigned long w)
44{ 44{
45 return cris_swapnwbrlz(w); 45 return cris_swapnwbrlz(w);
46} 46}
@@ -51,7 +51,7 @@ extern inline unsigned long ffz(unsigned long w)
51 * 51 *
52 * Undefined if no bit exists, so code should check against 0 first. 52 * Undefined if no bit exists, so code should check against 0 first.
53 */ 53 */
54extern inline unsigned long __ffs(unsigned long word) 54static inline unsigned long __ffs(unsigned long word)
55{ 55{
56 return cris_swapnwbrlz(~word); 56 return cris_swapnwbrlz(~word);
57} 57}
@@ -65,7 +65,7 @@ extern inline unsigned long __ffs(unsigned long word)
65 * differs in spirit from the above ffz (man ffs). 65 * differs in spirit from the above ffz (man ffs).
66 */ 66 */
67 67
68extern inline unsigned long kernel_ffs(unsigned long w) 68static inline unsigned long kernel_ffs(unsigned long w)
69{ 69{
70 return w ? cris_swapwbrlz (w) + 1 : 0; 70 return w ? cris_swapwbrlz (w) + 1 : 0;
71} 71}
diff --git a/include/asm-cris/arch-v10/checksum.h b/include/asm-cris/arch-v10/checksum.h
index 633f234f336b..b8000c5d7fe1 100644
--- a/include/asm-cris/arch-v10/checksum.h
+++ b/include/asm-cris/arch-v10/checksum.h
@@ -8,11 +8,11 @@
8 * to split all of those into 16-bit components, then add. 8 * to split all of those into 16-bit components, then add.
9 */ 9 */
10 10
11static inline unsigned int 11static inline __wsum
12csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 12csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
13 unsigned short proto, unsigned int sum) 13 unsigned short proto, __wsum sum)
14{ 14{
15 int res; 15 __wsum res;
16 __asm__ ("add.d %2, %0\n\t" 16 __asm__ ("add.d %2, %0\n\t"
17 "ax\n\t" 17 "ax\n\t"
18 "add.d %3, %0\n\t" 18 "add.d %3, %0\n\t"
@@ -21,7 +21,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
21 "ax\n\t" 21 "ax\n\t"
22 "addq 0, %0\n" 22 "addq 0, %0\n"
23 : "=r" (res) 23 : "=r" (res)
24 : "0" (sum), "r" (daddr), "r" (saddr), "r" ((ntohs(len) << 16) + (proto << 8))); 24 : "0" (sum), "r" (daddr), "r" (saddr), "r" ((len + proto) << 8));
25 25
26 return res; 26 return res;
27} 27}
diff --git a/include/asm-cris/arch-v32/checksum.h b/include/asm-cris/arch-v32/checksum.h
index 97ef89efea62..e5dcfce6e0dc 100644
--- a/include/asm-cris/arch-v32/checksum.h
+++ b/include/asm-cris/arch-v32/checksum.h
@@ -9,11 +9,11 @@
9 * checksum. Which means it would be necessary to split all those into 9 * checksum. Which means it would be necessary to split all those into
10 * 16-bit components and then add. 10 * 16-bit components and then add.
11 */ 11 */
12static inline unsigned int 12static inline __wsum
13csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 13csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
14 unsigned short len, unsigned short proto, unsigned int sum) 14 unsigned short len, unsigned short proto, __wsum sum)
15{ 15{
16 int res; 16 __wsum res;
17 17
18 __asm__ __volatile__ ("add.d %2, %0\n\t" 18 __asm__ __volatile__ ("add.d %2, %0\n\t"
19 "addc %3, %0\n\t" 19 "addc %3, %0\n\t"
@@ -21,7 +21,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
21 "addc 0, %0\n\t" 21 "addc 0, %0\n\t"
22 : "=r" (res) 22 : "=r" (res)
23 : "0" (sum), "r" (daddr), "r" (saddr), \ 23 : "0" (sum), "r" (daddr), "r" (saddr), \
24 "r" ((ntohs(len) << 16) + (proto << 8))); 24 "r" ((len + proto) << 8));
25 25
26 return res; 26 return res;
27} 27}
diff --git a/include/asm-cris/checksum.h b/include/asm-cris/checksum.h
index 26a7719bbb84..180dbf2757b0 100644
--- a/include/asm-cris/checksum.h
+++ b/include/asm-cris/checksum.h
@@ -17,7 +17,7 @@
17 * 17 *
18 * it's best to have buff aligned on a 32-bit boundary 18 * it's best to have buff aligned on a 32-bit boundary
19 */ 19 */
20unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 20__wsum csum_partial(const void *buff, int len, __wsum sum);
21 21
22/* 22/*
23 * the same as csum_partial, but copies from src while it 23 * the same as csum_partial, but copies from src while it
@@ -27,26 +27,23 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
27 * better 64-bit) boundary 27 * better 64-bit) boundary
28 */ 28 */
29 29
30unsigned int csum_partial_copy_nocheck(const char *src, char *dst, 30__wsum csum_partial_copy_nocheck(const void *src, void *dst,
31 int len, unsigned int sum); 31 int len, __wsum sum);
32 32
33/* 33/*
34 * Fold a partial checksum into a word 34 * Fold a partial checksum into a word
35 */ 35 */
36 36
37static inline unsigned int csum_fold(unsigned int sum) 37static inline __sum16 csum_fold(__wsum csum)
38{ 38{
39 /* the while loop is unnecessary really, it's always enough with two 39 u32 sum = (__force u32)csum;
40 iterations */ 40 sum = (sum & 0xffff) + (sum >> 16); /* add in end-around carry */
41 41 sum = (sum & 0xffff) + (sum >> 16); /* add in end-around carry */
42 while(sum >> 16) 42 return (__force __sum16)~sum;
43 sum = (sum & 0xffff) + (sum >> 16); /* add in end-around carry */
44
45 return ~sum;
46} 43}
47 44
48extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, 45extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
49 int len, unsigned int sum, 46 int len, __wsum sum,
50 int *errptr); 47 int *errptr);
51 48
52/* 49/*
@@ -55,8 +52,7 @@ extern unsigned int csum_partial_copy_from_user(const char *src, char *dst,
55 * 52 *
56 */ 53 */
57 54
58static inline unsigned short ip_fast_csum(unsigned char * iph, 55static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
59 unsigned int ihl)
60{ 56{
61 return csum_fold(csum_partial(iph, ihl * 4, 0)); 57 return csum_fold(csum_partial(iph, ihl * 4, 0));
62} 58}
@@ -66,11 +62,10 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
66 * returns a 16-bit checksum, already complemented 62 * returns a 16-bit checksum, already complemented
67 */ 63 */
68 64
69static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 65static inline __sum16 int csum_tcpudp_magic(__be32 saddr, __be32 daddr,
70 unsigned long daddr,
71 unsigned short len, 66 unsigned short len,
72 unsigned short proto, 67 unsigned short proto,
73 unsigned int sum) 68 __wsum sum)
74{ 69{
75 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 70 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
76} 71}
@@ -80,7 +75,8 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
80 * in icmp.c 75 * in icmp.c
81 */ 76 */
82 77
83static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { 78static inline __sum16 ip_compute_csum(const void *buff, int len)
79{
84 return csum_fold (csum_partial(buff, len, 0)); 80 return csum_fold (csum_partial(buff, len, 0));
85} 81}
86 82
diff --git a/include/asm-cris/device.h b/include/asm-cris/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-cris/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-cris/dma-mapping.h b/include/asm-cris/dma-mapping.h
index cbf1a98f0129..662cea70152d 100644
--- a/include/asm-cris/dma-mapping.h
+++ b/include/asm-cris/dma-mapping.h
@@ -156,10 +156,10 @@ dma_get_cache_alignment(void)
156 return (1 << INTERNODE_CACHE_SHIFT); 156 return (1 << INTERNODE_CACHE_SHIFT);
157} 157}
158 158
159#define dma_is_consistent(d) (1) 159#define dma_is_consistent(d, h) (1)
160 160
161static inline void 161static inline void
162dma_cache_sync(void *vaddr, size_t size, 162dma_cache_sync(struct device *dev, void *vaddr, size_t size,
163 enum dma_data_direction direction) 163 enum dma_data_direction direction)
164{ 164{
165} 165}
diff --git a/include/asm-cris/semaphore-helper.h b/include/asm-cris/semaphore-helper.h
index dbd0f30b85b6..a8e1e6cb7cd0 100644
--- a/include/asm-cris/semaphore-helper.h
+++ b/include/asm-cris/semaphore-helper.h
@@ -20,12 +20,12 @@
20/* 20/*
21 * These two _must_ execute atomically wrt each other. 21 * These two _must_ execute atomically wrt each other.
22 */ 22 */
23extern inline void wake_one_more(struct semaphore * sem) 23static inline void wake_one_more(struct semaphore * sem)
24{ 24{
25 atomic_inc(&sem->waking); 25 atomic_inc(&sem->waking);
26} 26}
27 27
28extern inline int waking_non_zero(struct semaphore *sem) 28static inline int waking_non_zero(struct semaphore *sem)
29{ 29{
30 unsigned long flags; 30 unsigned long flags;
31 int ret = 0; 31 int ret = 0;
@@ -40,7 +40,7 @@ extern inline int waking_non_zero(struct semaphore *sem)
40 return ret; 40 return ret;
41} 41}
42 42
43extern inline int waking_non_zero_interruptible(struct semaphore *sem, 43static inline int waking_non_zero_interruptible(struct semaphore *sem,
44 struct task_struct *tsk) 44 struct task_struct *tsk)
45{ 45{
46 int ret = 0; 46 int ret = 0;
@@ -59,7 +59,7 @@ extern inline int waking_non_zero_interruptible(struct semaphore *sem,
59 return ret; 59 return ret;
60} 60}
61 61
62extern inline int waking_non_zero_trylock(struct semaphore *sem) 62static inline int waking_non_zero_trylock(struct semaphore *sem)
63{ 63{
64 int ret = 1; 64 int ret = 1;
65 unsigned long flags; 65 unsigned long flags;
diff --git a/include/asm-frv/checksum.h b/include/asm-frv/checksum.h
index 42bf0db2287a..9b1689850187 100644
--- a/include/asm-frv/checksum.h
+++ b/include/asm-frv/checksum.h
@@ -26,7 +26,7 @@
26 * 26 *
27 * it's best to have buff aligned on a 32-bit boundary 27 * it's best to have buff aligned on a 32-bit boundary
28 */ 28 */
29unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 29__wsum csum_partial(const void *buff, int len, __wsum sum);
30 30
31/* 31/*
32 * the same as csum_partial, but copies from src while it 32 * the same as csum_partial, but copies from src while it
@@ -35,7 +35,7 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
35 * here even more important to align src and dst on a 32-bit (or even 35 * here even more important to align src and dst on a 32-bit (or even
36 * better 64-bit) boundary 36 * better 64-bit) boundary
37 */ 37 */
38unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); 38__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
39 39
40/* 40/*
41 * the same as csum_partial_copy, but copies from user space. 41 * the same as csum_partial_copy, but copies from user space.
@@ -43,11 +43,8 @@ unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum);
43 * here even more important to align src and dst on a 32-bit (or even 43 * here even more important to align src and dst on a 32-bit (or even
44 * better 64-bit) boundary 44 * better 64-bit) boundary
45 */ 45 */
46extern unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, 46extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
47 int len, int sum, int *csum_err); 47 int len, __wsum sum, int *csum_err);
48
49#define csum_partial_copy_nocheck(src, dst, len, sum) \
50 csum_partial_copy((src), (dst), (len), (sum))
51 48
52/* 49/*
53 * This is a version of ip_compute_csum() optimized for IP headers, 50 * This is a version of ip_compute_csum() optimized for IP headers,
@@ -55,7 +52,7 @@ extern unsigned int csum_partial_copy_from_user(const char __user *src, char *ds
55 * 52 *
56 */ 53 */
57static inline 54static inline
58unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) 55__sum16 ip_fast_csum(const void *iph, unsigned int ihl)
59{ 56{
60 unsigned int tmp, inc, sum = 0; 57 unsigned int tmp, inc, sum = 0;
61 58
@@ -81,13 +78,13 @@ unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
81 : "icc0", "icc1" 78 : "icc0", "icc1"
82 ); 79 );
83 80
84 return ~sum; 81 return (__force __sum16)~sum;
85} 82}
86 83
87/* 84/*
88 * Fold a partial checksum 85 * Fold a partial checksum
89 */ 86 */
90static inline unsigned int csum_fold(unsigned int sum) 87static inline __sum16 csum_fold(__wsum sum)
91{ 88{
92 unsigned int tmp; 89 unsigned int tmp;
93 90
@@ -100,16 +97,16 @@ static inline unsigned int csum_fold(unsigned int sum)
100 : "0"(sum) 97 : "0"(sum)
101 ); 98 );
102 99
103 return ~sum; 100 return (__force __sum16)~sum;
104} 101}
105 102
106/* 103/*
107 * computes the checksum of the TCP/UDP pseudo-header 104 * computes the checksum of the TCP/UDP pseudo-header
108 * returns a 16-bit checksum, already complemented 105 * returns a 16-bit checksum, already complemented
109 */ 106 */
110static inline unsigned int 107static inline __wsum
111csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 108csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
112 unsigned short proto, unsigned int sum) 109 unsigned short proto, __wsum sum)
113{ 110{
114 asm(" addcc %1,%0,%0,icc0 \n" 111 asm(" addcc %1,%0,%0,icc0 \n"
115 " addxcc %2,%0,%0,icc0 \n" 112 " addxcc %2,%0,%0,icc0 \n"
@@ -122,9 +119,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
122 return sum; 119 return sum;
123} 120}
124 121
125static inline unsigned short int 122static inline __sum16
126csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 123csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
127 unsigned short proto, unsigned int sum) 124 unsigned short proto, __wsum sum)
128{ 125{
129 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 126 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
130} 127}
@@ -133,12 +130,12 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
133 * this routine is used for miscellaneous IP-like checksums, mainly 130 * this routine is used for miscellaneous IP-like checksums, mainly
134 * in icmp.c 131 * in icmp.c
135 */ 132 */
136extern unsigned short ip_compute_csum(const unsigned char * buff, int len); 133extern __sum16 ip_compute_csum(const void *buff, int len);
137 134
138#define _HAVE_ARCH_IPV6_CSUM 135#define _HAVE_ARCH_IPV6_CSUM
139static inline unsigned short int 136static inline __sum16
140csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, 137csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
141 __u32 len, unsigned short proto, unsigned int sum) 138 __u32 len, unsigned short proto, __wsum sum)
142{ 139{
143 unsigned long tmp, tmp2; 140 unsigned long tmp, tmp2;
144 141
@@ -177,7 +174,7 @@ csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr,
177 : "icc0" 174 : "icc0"
178 ); 175 );
179 176
180 return ~sum; 177 return (__force __sum16)~sum;
181} 178}
182 179
183#endif /* _ASM_CHECKSUM_H */ 180#endif /* _ASM_CHECKSUM_H */
diff --git a/include/asm-frv/device.h b/include/asm-frv/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-frv/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-frv/dma-mapping.h b/include/asm-frv/dma-mapping.h
index e9fc1d47797e..bcb2df68496e 100644
--- a/include/asm-frv/dma-mapping.h
+++ b/include/asm-frv/dma-mapping.h
@@ -172,10 +172,10 @@ int dma_get_cache_alignment(void)
172 return 1 << L1_CACHE_SHIFT; 172 return 1 << L1_CACHE_SHIFT;
173} 173}
174 174
175#define dma_is_consistent(d) (1) 175#define dma_is_consistent(d, h) (1)
176 176
177static inline 177static inline
178void dma_cache_sync(void *vaddr, size_t size, 178void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
179 enum dma_data_direction direction) 179 enum dma_data_direction direction)
180{ 180{
181 flush_write_buffers(); 181 flush_write_buffers();
diff --git a/include/asm-frv/highmem.h b/include/asm-frv/highmem.h
index 0f390f41f816..ff4d6cdeb152 100644
--- a/include/asm-frv/highmem.h
+++ b/include/asm-frv/highmem.h
@@ -115,7 +115,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
115{ 115{
116 unsigned long paddr; 116 unsigned long paddr;
117 117
118 inc_preempt_count(); 118 pagefault_disable();
119 paddr = page_to_phys(page); 119 paddr = page_to_phys(page);
120 120
121 switch (type) { 121 switch (type) {
@@ -170,8 +170,7 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
170 default: 170 default:
171 BUG(); 171 BUG();
172 } 172 }
173 dec_preempt_count(); 173 pagefault_enable();
174 preempt_check_resched();
175} 174}
176 175
177#endif /* !__ASSEMBLY__ */ 176#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-frv/param.h b/include/asm-frv/param.h
index 168381ebb41a..365653b1726c 100644
--- a/include/asm-frv/param.h
+++ b/include/asm-frv/param.h
@@ -18,6 +18,5 @@
18#endif 18#endif
19 19
20#define MAXHOSTNAMELEN 64 /* max length of hostname */ 20#define MAXHOSTNAMELEN 64 /* max length of hostname */
21#define COMMAND_LINE_SIZE 512
22 21
23#endif /* _ASM_PARAM_H */ 22#endif /* _ASM_PARAM_H */
diff --git a/include/asm-frv/setup.h b/include/asm-frv/setup.h
index 0d293b9a5857..afd787ceede6 100644
--- a/include/asm-frv/setup.h
+++ b/include/asm-frv/setup.h
@@ -12,6 +12,10 @@
12#ifndef _ASM_SETUP_H 12#ifndef _ASM_SETUP_H
13#define _ASM_SETUP_H 13#define _ASM_SETUP_H
14 14
15#define COMMAND_LINE_SIZE 512
16
17#ifdef __KERNEL__
18
15#include <linux/init.h> 19#include <linux/init.h>
16 20
17#ifndef __ASSEMBLY__ 21#ifndef __ASSEMBLY__
@@ -22,4 +26,6 @@ extern unsigned long __initdata num_mappedpages;
22 26
23#endif /* !__ASSEMBLY__ */ 27#endif /* !__ASSEMBLY__ */
24 28
29#endif /* __KERNEL__ */
30
25#endif /* _ASM_SETUP_H */ 31#endif /* _ASM_SETUP_H */
diff --git a/include/asm-frv/unistd.h b/include/asm-frv/unistd.h
index 725e854928cf..584c0417ae4d 100644
--- a/include/asm-frv/unistd.h
+++ b/include/asm-frv/unistd.h
@@ -320,125 +320,6 @@
320#ifdef __KERNEL__ 320#ifdef __KERNEL__
321 321
322#define NR_syscalls 310 322#define NR_syscalls 310
323#include <linux/err.h>
324
325/*
326 * process the return value of a syscall, consigning it to one of two possible fates
327 * - user-visible error numbers are in the range -1 - -4095: see <asm-frv/errno.h>
328 */
329#undef __syscall_return
330#define __syscall_return(type, res) \
331do { \
332 unsigned long __sr2 = (res); \
333 if (__builtin_expect(__sr2 >= (unsigned long)(-MAX_ERRNO), 0)) { \
334 errno = (-__sr2); \
335 __sr2 = ~0UL; \
336 } \
337 return (type) __sr2; \
338} while (0)
339
340/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
341
342#undef _syscall0
343#define _syscall0(type,name) \
344type name(void) \
345{ \
346 register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
347 register unsigned long __sc0 __asm__ ("gr8"); \
348 __asm__ __volatile__ ("tira gr0,#0" \
349 : "=r" (__sc0) \
350 : "r" (__scnum)); \
351 __syscall_return(type, __sc0); \
352}
353
354#undef _syscall1
355#define _syscall1(type,name,type1,arg1) \
356type name(type1 arg1) \
357{ \
358 register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
359 register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
360 __asm__ __volatile__ ("tira gr0,#0" \
361 : "+r" (__sc0) \
362 : "r" (__scnum)); \
363 __syscall_return(type, __sc0); \
364}
365
366#undef _syscall2
367#define _syscall2(type,name,type1,arg1,type2,arg2) \
368type name(type1 arg1,type2 arg2) \
369{ \
370 register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
371 register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
372 register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) arg2; \
373 __asm__ __volatile__ ("tira gr0,#0" \
374 : "+r" (__sc0) \
375 : "r" (__scnum), "r" (__sc1)); \
376 __syscall_return(type, __sc0); \
377}
378
379#undef _syscall3
380#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
381type name(type1 arg1,type2 arg2,type3 arg3) \
382{ \
383 register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
384 register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
385 register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) arg2; \
386 register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) arg3; \
387 __asm__ __volatile__ ("tira gr0,#0" \
388 : "+r" (__sc0) \
389 : "r" (__scnum), "r" (__sc1), "r" (__sc2)); \
390 __syscall_return(type, __sc0); \
391}
392
393#undef _syscall4
394#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
395type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
396{ \
397 register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
398 register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
399 register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) arg2; \
400 register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) arg3; \
401 register unsigned long __sc3 __asm__ ("gr11") = (unsigned long) arg4; \
402 __asm__ __volatile__ ("tira gr0,#0" \
403 : "+r" (__sc0) \
404 : "r" (__scnum), "r" (__sc1), "r" (__sc2), "r" (__sc3)); \
405 __syscall_return(type, __sc0); \
406}
407
408#undef _syscall5
409#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
410type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
411{ \
412 register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
413 register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
414 register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) arg2; \
415 register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) arg3; \
416 register unsigned long __sc3 __asm__ ("gr11") = (unsigned long) arg4; \
417 register unsigned long __sc4 __asm__ ("gr12") = (unsigned long) arg5; \
418 __asm__ __volatile__ ("tira gr0,#0" \
419 : "+r" (__sc0) \
420 : "r" (__scnum), "r" (__sc1), "r" (__sc2), \
421 "r" (__sc3), "r" (__sc4)); \
422 __syscall_return(type, __sc0); \
423}
424
425#undef _syscall6
426#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5, type6, arg6) \
427type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
428{ \
429 register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
430 register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
431 register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) arg2; \
432 register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) arg3; \
433 register unsigned long __sc3 __asm__ ("gr11") = (unsigned long) arg4; \
434 register unsigned long __sc4 __asm__ ("gr12") = (unsigned long) arg5; \
435 register unsigned long __sc5 __asm__ ("gr13") = (unsigned long) arg6; \
436 __asm__ __volatile__ ("tira gr0,#0" \
437 : "+r" (__sc0) \
438 : "r" (__scnum), "r" (__sc1), "r" (__sc2), \
439 "r" (__sc3), "r" (__sc4), "r" (__sc5)); \
440 __syscall_return(type, __sc0); \
441}
442 323
443#define __ARCH_WANT_IPC_PARSE_VERSION 324#define __ARCH_WANT_IPC_PARSE_VERSION
444/* #define __ARCH_WANT_OLD_READDIR */ 325/* #define __ARCH_WANT_OLD_READDIR */
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index 3c06be381701..fa14f8cd30c5 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -1,4 +1,3 @@
1header-y += atomic.h
2header-y += errno-base.h 1header-y += errno-base.h
3header-y += errno.h 2header-y += errno.h
4header-y += fcntl.h 3header-y += fcntl.h
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index a84c3d88a189..a37e95fe58d6 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -14,6 +14,7 @@ unifdef-y += posix_types.h
14unifdef-y += ptrace.h 14unifdef-y += ptrace.h
15unifdef-y += resource.h 15unifdef-y += resource.h
16unifdef-y += sembuf.h 16unifdef-y += sembuf.h
17unifdef-y += setup.h
17unifdef-y += shmbuf.h 18unifdef-y += shmbuf.h
18unifdef-y += sigcontext.h 19unifdef-y += sigcontext.h
19unifdef-y += siginfo.h 20unifdef-y += siginfo.h
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 42a95d9a0641..b7e4a0467cb1 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -66,7 +66,7 @@ static inline void atomic_long_sub(long i, atomic_long_t *l)
66 atomic64_sub(i, v); 66 atomic64_sub(i, v);
67} 67}
68 68
69#else 69#else /* BITS_PER_LONG == 64 */
70 70
71typedef atomic_t atomic_long_t; 71typedef atomic_t atomic_long_t;
72 72
@@ -113,5 +113,6 @@ static inline void atomic_long_sub(long i, atomic_long_t *l)
113 atomic_sub(i, v); 113 atomic_sub(i, v);
114} 114}
115 115
116#endif 116#endif /* BITS_PER_LONG == 64 */
117#endif 117
118#endif /* _ASM_GENERIC_ATOMIC_H */
diff --git a/include/asm-generic/device.h b/include/asm-generic/device.h
new file mode 100644
index 000000000000..c17c9600f220
--- /dev/null
+++ b/include/asm-generic/device.h
@@ -0,0 +1,12 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef _ASM_GENERIC_DEVICE_H
7#define _ASM_GENERIC_DEVICE_H
8
9struct dev_archdata {
10};
11
12#endif /* _ASM_GENERIC_DEVICE_H */
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index b541e48cc545..783ab9944d70 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -266,7 +266,7 @@ dma_error(dma_addr_t dma_addr)
266 266
267#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 267#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
268#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 268#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
269#define dma_is_consistent(d) (1) 269#define dma_is_consistent(d, h) (1)
270 270
271static inline int 271static inline int
272dma_get_cache_alignment(void) 272dma_get_cache_alignment(void)
@@ -295,7 +295,7 @@ dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
295} 295}
296 296
297static inline void 297static inline void
298dma_cache_sync(void *vaddr, size_t size, 298dma_cache_sync(struct device *dev, void *vaddr, size_t size,
299 enum dma_data_direction direction) 299 enum dma_data_direction direction)
300{ 300{
301 /* could define this in terms of the dma_cache ... operations, 301 /* could define this in terms of the dma_cache ... operations,
diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h
index df893c160318..f422df0956a2 100644
--- a/include/asm-generic/futex.h
+++ b/include/asm-generic/futex.h
@@ -21,7 +21,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT; 22 return -EFAULT;
23 23
24 inc_preempt_count(); 24 pagefault_disable();
25 25
26 switch (op) { 26 switch (op) {
27 case FUTEX_OP_SET: 27 case FUTEX_OP_SET:
@@ -33,7 +33,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
33 ret = -ENOSYS; 33 ret = -ENOSYS;
34 } 34 }
35 35
36 dec_preempt_count(); 36 pagefault_enable();
37 37
38 if (!ret) { 38 if (!ret) {
39 switch (cmp) { 39 switch (cmp) {
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9d873163a7ab..4d4c62d11059 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -11,8 +11,8 @@
11 11
12#define RODATA \ 12#define RODATA \
13 . = ALIGN(4096); \ 13 . = ALIGN(4096); \
14 __start_rodata = .; \
15 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ 14 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
15 VMLINUX_SYMBOL(__start_rodata) = .; \
16 *(.rodata) *(.rodata.*) \ 16 *(.rodata) *(.rodata.*) \
17 *(__vermagic) /* Kernel version magic */ \ 17 *(__vermagic) /* Kernel version magic */ \
18 } \ 18 } \
@@ -119,17 +119,16 @@
119 *(__ksymtab_strings) \ 119 *(__ksymtab_strings) \
120 } \ 120 } \
121 \ 121 \
122 EH_FRAME \
123 \
122 /* Built-in module parameters. */ \ 124 /* Built-in module parameters. */ \
123 __param : AT(ADDR(__param) - LOAD_OFFSET) { \ 125 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
124 VMLINUX_SYMBOL(__start___param) = .; \ 126 VMLINUX_SYMBOL(__start___param) = .; \
125 *(__param) \ 127 *(__param) \
126 VMLINUX_SYMBOL(__stop___param) = .; \ 128 VMLINUX_SYMBOL(__stop___param) = .; \
129 VMLINUX_SYMBOL(__end_rodata) = .; \
127 } \ 130 } \
128 \ 131 \
129 /* Unwind data binary search table */ \
130 EH_FRAME_HDR \
131 \
132 __end_rodata = .; \
133 . = ALIGN(4096); 132 . = ALIGN(4096);
134 133
135#define SECURITY_INIT \ 134#define SECURITY_INIT \
@@ -162,15 +161,23 @@
162 VMLINUX_SYMBOL(__kprobes_text_end) = .; 161 VMLINUX_SYMBOL(__kprobes_text_end) = .;
163 162
164#ifdef CONFIG_STACK_UNWIND 163#ifdef CONFIG_STACK_UNWIND
165 /* Unwind data binary search table */ 164#define EH_FRAME \
166#define EH_FRAME_HDR \ 165 /* Unwind data binary search table */ \
166 . = ALIGN(8); \
167 .eh_frame_hdr : AT(ADDR(.eh_frame_hdr) - LOAD_OFFSET) { \ 167 .eh_frame_hdr : AT(ADDR(.eh_frame_hdr) - LOAD_OFFSET) { \
168 VMLINUX_SYMBOL(__start_unwind_hdr) = .; \ 168 VMLINUX_SYMBOL(__start_unwind_hdr) = .; \
169 *(.eh_frame_hdr) \ 169 *(.eh_frame_hdr) \
170 VMLINUX_SYMBOL(__end_unwind_hdr) = .; \ 170 VMLINUX_SYMBOL(__end_unwind_hdr) = .; \
171 } \
172 /* Unwind data */ \
173 . = ALIGN(8); \
174 .eh_frame : AT(ADDR(.eh_frame) - LOAD_OFFSET) { \
175 VMLINUX_SYMBOL(__start_unwind) = .; \
176 *(.eh_frame) \
177 VMLINUX_SYMBOL(__end_unwind) = .; \
171 } 178 }
172#else 179#else
173#define EH_FRAME_HDR 180#define EH_FRAME
174#endif 181#endif
175 182
176 /* DWARF debug sections. 183 /* DWARF debug sections.
@@ -215,6 +222,8 @@
215 .notes : { *(.note.*) } :note 222 .notes : { *(.note.*) } :note
216 223
217#define INITCALLS \ 224#define INITCALLS \
225 *(.initcall0.init) \
226 *(.initcall0s.init) \
218 *(.initcall1.init) \ 227 *(.initcall1.init) \
219 *(.initcall1s.init) \ 228 *(.initcall1s.init) \
220 *(.initcall2.init) \ 229 *(.initcall2.init) \
diff --git a/include/asm-h8300/checksum.h b/include/asm-h8300/checksum.h
index 3051931dd301..98724e12508c 100644
--- a/include/asm-h8300/checksum.h
+++ b/include/asm-h8300/checksum.h
@@ -13,7 +13,7 @@
13 * 13 *
14 * it's best to have buff aligned on a 32-bit boundary 14 * it's best to have buff aligned on a 32-bit boundary
15 */ 15 */
16unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 16__wsum csum_partial(const void *buff, int len, __wsum sum);
17 17
18/* 18/*
19 * the same as csum_partial, but copies from src while it 19 * the same as csum_partial, but copies from src while it
@@ -23,7 +23,7 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
23 * better 64-bit) boundary 23 * better 64-bit) boundary
24 */ 24 */
25 25
26unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum); 26__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
27 27
28 28
29/* 29/*
@@ -33,20 +33,17 @@ unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum);
33 * better 64-bit) boundary 33 * better 64-bit) boundary
34 */ 34 */
35 35
36extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, 36extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
37 int len, int sum, int *csum_err); 37 int len, __wsum sum, int *csum_err);
38 38
39#define csum_partial_copy_nocheck(src, dst, len, sum) \ 39__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
40 csum_partial_copy((src), (dst), (len), (sum))
41
42unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl);
43 40
44 41
45/* 42/*
46 * Fold a partial checksum 43 * Fold a partial checksum
47 */ 44 */
48 45
49static inline unsigned int csum_fold(unsigned int sum) 46static inline __sum16 csum_fold(__wsum sum)
50{ 47{
51 __asm__("mov.l %0,er0\n\t" 48 __asm__("mov.l %0,er0\n\t"
52 "add.w e0,r0\n\t" 49 "add.w e0,r0\n\t"
@@ -58,7 +55,7 @@ static inline unsigned int csum_fold(unsigned int sum)
58 : "=r"(sum) 55 : "=r"(sum)
59 : "0"(sum) 56 : "0"(sum)
60 : "er0"); 57 : "er0");
61 return ~sum; 58 return (__force __sum16)~sum;
62} 59}
63 60
64 61
@@ -67,9 +64,9 @@ static inline unsigned int csum_fold(unsigned int sum)
67 * returns a 16-bit checksum, already complemented 64 * returns a 16-bit checksum, already complemented
68 */ 65 */
69 66
70static inline unsigned int 67static inline __wsum
71csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 68csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
72 unsigned short proto, unsigned int sum) 69 unsigned short proto, __wsum sum)
73{ 70{
74 __asm__ ("sub.l er0,er0\n\t" 71 __asm__ ("sub.l er0,er0\n\t"
75 "add.l %2,%0\n\t" 72 "add.l %2,%0\n\t"
@@ -88,9 +85,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
88 return sum; 85 return sum;
89} 86}
90 87
91static inline unsigned short int 88static inline __sum16
92csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 89csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
93 unsigned short proto, unsigned int sum) 90 unsigned short proto, __wsum sum)
94{ 91{
95 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 92 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
96} 93}
@@ -100,6 +97,6 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
100 * in icmp.c 97 * in icmp.c
101 */ 98 */
102 99
103extern unsigned short ip_compute_csum(const unsigned char * buff, int len); 100extern __sum16 ip_compute_csum(const void *buff, int len);
104 101
105#endif /* _H8300_CHECKSUM_H */ 102#endif /* _H8300_CHECKSUM_H */
diff --git a/include/asm-h8300/delay.h b/include/asm-h8300/delay.h
index cbccbbdd640f..743beba70f82 100644
--- a/include/asm-h8300/delay.h
+++ b/include/asm-h8300/delay.h
@@ -9,7 +9,7 @@
9 * Delay routines, using a pre-computed "loops_per_second" value. 9 * Delay routines, using a pre-computed "loops_per_second" value.
10 */ 10 */
11 11
12extern __inline__ void __delay(unsigned long loops) 12static inline void __delay(unsigned long loops)
13{ 13{
14 __asm__ __volatile__ ("1:\n\t" 14 __asm__ __volatile__ ("1:\n\t"
15 "dec.l #1,%0\n\t" 15 "dec.l #1,%0\n\t"
@@ -27,7 +27,7 @@ extern __inline__ void __delay(unsigned long loops)
27 27
28extern unsigned long loops_per_jiffy; 28extern unsigned long loops_per_jiffy;
29 29
30extern __inline__ void udelay(unsigned long usecs) 30static inline void udelay(unsigned long usecs)
31{ 31{
32 usecs *= 4295; /* 2**32 / 1000000 */ 32 usecs *= 4295; /* 2**32 / 1000000 */
33 usecs /= (loops_per_jiffy*HZ); 33 usecs /= (loops_per_jiffy*HZ);
diff --git a/include/asm-h8300/device.h b/include/asm-h8300/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-h8300/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-h8300/mmu_context.h b/include/asm-h8300/mmu_context.h
index 855721a5dcc9..5c165f7bee0e 100644
--- a/include/asm-h8300/mmu_context.h
+++ b/include/asm-h8300/mmu_context.h
@@ -9,7 +9,7 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
9{ 9{
10} 10}
11 11
12extern inline int 12static inline int
13init_new_context(struct task_struct *tsk, struct mm_struct *mm) 13init_new_context(struct task_struct *tsk, struct mm_struct *mm)
14{ 14{
15 // mm->context = virt_to_phys(mm->pgd); 15 // mm->context = virt_to_phys(mm->pgd);
@@ -23,7 +23,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str
23{ 23{
24} 24}
25 25
26extern inline void activate_mm(struct mm_struct *prev_mm, 26static inline void activate_mm(struct mm_struct *prev_mm,
27 struct mm_struct *next_mm) 27 struct mm_struct *next_mm)
28{ 28{
29} 29}
diff --git a/include/asm-h8300/pci.h b/include/asm-h8300/pci.h
index 5edad5b70fd5..0c771b05fdd5 100644
--- a/include/asm-h8300/pci.h
+++ b/include/asm-h8300/pci.h
@@ -10,12 +10,12 @@
10#define pcibios_assign_all_busses() 0 10#define pcibios_assign_all_busses() 0
11#define pcibios_scan_all_fns(a, b) 0 11#define pcibios_scan_all_fns(a, b) 0
12 12
13extern inline void pcibios_set_master(struct pci_dev *dev) 13static inline void pcibios_set_master(struct pci_dev *dev)
14{ 14{
15 /* No special bus mastering setup handling */ 15 /* No special bus mastering setup handling */
16} 16}
17 17
18extern inline void pcibios_penalize_isa_irq(int irq, int active) 18static inline void pcibios_penalize_isa_irq(int irq, int active)
19{ 19{
20 /* We don't do dynamic PCI IRQ allocation */ 20 /* We don't do dynamic PCI IRQ allocation */
21} 21}
diff --git a/include/asm-h8300/tlbflush.h b/include/asm-h8300/tlbflush.h
index bbdffbeeedef..9a2c5c9fd700 100644
--- a/include/asm-h8300/tlbflush.h
+++ b/include/asm-h8300/tlbflush.h
@@ -47,12 +47,12 @@ static inline void flush_tlb_range(struct mm_struct *mm,
47 BUG(); 47 BUG();
48} 48}
49 49
50extern inline void flush_tlb_kernel_page(unsigned long addr) 50static inline void flush_tlb_kernel_page(unsigned long addr)
51{ 51{
52 BUG(); 52 BUG();
53} 53}
54 54
55extern inline void flush_tlb_pgtables(struct mm_struct *mm, 55static inline void flush_tlb_pgtables(struct mm_struct *mm,
56 unsigned long start, unsigned long end) 56 unsigned long start, unsigned long end)
57{ 57{
58 BUG(); 58 BUG();
diff --git a/include/asm-h8300/types.h b/include/asm-h8300/types.h
index da2402b86540..2a8b1b2be782 100644
--- a/include/asm-h8300/types.h
+++ b/include/asm-h8300/types.h
@@ -55,12 +55,6 @@ typedef unsigned long long u64;
55 55
56typedef u32 dma_addr_t; 56typedef u32 dma_addr_t;
57 57
58#define HAVE_SECTOR_T
59typedef u64 sector_t;
60
61#define HAVE_BLKCNT_T
62typedef u64 blkcnt_t;
63
64#endif /* __KERNEL__ */ 58#endif /* __KERNEL__ */
65 59
66#endif /* __ASSEMBLY__ */ 60#endif /* __ASSEMBLY__ */
diff --git a/include/asm-h8300/unistd.h b/include/asm-h8300/unistd.h
index 747788d629ae..7ddd414f8d16 100644
--- a/include/asm-h8300/unistd.h
+++ b/include/asm-h8300/unistd.h
@@ -295,172 +295,6 @@
295#ifdef __KERNEL__ 295#ifdef __KERNEL__
296 296
297#define NR_syscalls 289 297#define NR_syscalls 289
298#include <linux/err.h>
299
300/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
301 <asm-m68k/errno.h> */
302
303#define __syscall_return(type, res) \
304do { \
305 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
306 /* avoid using res which is declared to be in register d0; \
307 errno might expand to a function call and clobber it. */ \
308 int __err = -(res); \
309 errno = __err; \
310 res = -1; \
311 } \
312 return (type) (res); \
313} while (0)
314
315#define _syscall0(type, name) \
316type name(void) \
317{ \
318 register long __res __asm__("er0"); \
319 __asm__ __volatile__ ("mov.l %1,er0\n\t" \
320 "trapa #0\n\t" \
321 : "=r" (__res) \
322 : "g" (__NR_##name) \
323 : "cc", "memory"); \
324 __syscall_return(type, __res); \
325}
326
327#define _syscall1(type, name, atype, a) \
328type name(atype a) \
329{ \
330 register long __res __asm__("er0"); \
331 register long _a __asm__("er1"); \
332 _a = (long)a; \
333 __asm__ __volatile__ ("mov.l %1,er0\n\t" \
334 "trapa #0\n\t" \
335 : "=r" (__res) \
336 : "g" (__NR_##name), \
337 "g" (_a) \
338 : "cc", "memory"); \
339 __syscall_return(type, __res); \
340}
341
342#define _syscall2(type, name, atype, a, btype, b) \
343type name(atype a, btype b) \
344{ \
345 register long __res __asm__("er0"); \
346 register long _a __asm__("er1"); \
347 register long _b __asm__("er2"); \
348 _a = (long)a; \
349 _b = (long)b; \
350 __asm__ __volatile__ ("mov.l %1,er0\n\t" \
351 "trapa #0\n\t" \
352 : "=r" (__res) \
353 : "g" (__NR_##name), \
354 "g" (_a), \
355 "g" (_b) \
356 : "cc", "memory"); \
357 __syscall_return(type, __res); \
358}
359
360#define _syscall3(type, name, atype, a, btype, b, ctype, c) \
361type name(atype a, btype b, ctype c) \
362{ \
363 register long __res __asm__("er0"); \
364 register long _a __asm__("er1"); \
365 register long _b __asm__("er2"); \
366 register long _c __asm__("er3"); \
367 _a = (long)a; \
368 _b = (long)b; \
369 _c = (long)c; \
370 __asm__ __volatile__ ("mov.l %1,er0\n\t" \
371 "trapa #0\n\t" \
372 : "=r" (__res) \
373 : "g" (__NR_##name), \
374 "g" (_a), \
375 "g" (_b), \
376 "g" (_c) \
377 : "cc", "memory"); \
378 __syscall_return(type, __res); \
379}
380
381#define _syscall4(type, name, atype, a, btype, b, \
382 ctype, c, dtype, d) \
383type name(atype a, btype b, ctype c, dtype d) \
384{ \
385 register long __res __asm__("er0"); \
386 register long _a __asm__("er1"); \
387 register long _b __asm__("er2"); \
388 register long _c __asm__("er3"); \
389 register long _d __asm__("er4"); \
390 _a = (long)a; \
391 _b = (long)b; \
392 _c = (long)c; \
393 _d = (long)d; \
394 __asm__ __volatile__ ("mov.l %1,er0\n\t" \
395 "trapa #0\n\t" \
396 : "=r" (__res) \
397 : "g" (__NR_##name), \
398 "g" (_a), \
399 "g" (_b), \
400 "g" (_c), \
401 "g" (_d) \
402 : "cc", "memory"); \
403 __syscall_return(type, __res); \
404}
405
406#define _syscall5(type, name, atype, a, btype, b, \
407 ctype, c, dtype, d, etype, e) \
408type name(atype a, btype b, ctype c, dtype d, etype e) \
409{ \
410 register long __res __asm__("er0"); \
411 register long _a __asm__("er1"); \
412 register long _b __asm__("er2"); \
413 register long _c __asm__("er3"); \
414 register long _d __asm__("er4"); \
415 register long _e __asm__("er5"); \
416 _a = (long)a; \
417 _b = (long)b; \
418 _c = (long)c; \
419 _d = (long)d; \
420 _e = (long)e; \
421 __asm__ __volatile__ ("mov.l %1,er0\n\t" \
422 "trapa #0\n\t" \
423 : "=r" (__res) \
424 : "g" (__NR_##name), \
425 "g" (_a), \
426 "g" (_b), \
427 "g" (_c), \
428 "g" (_d), \
429 "g" (_e) \
430 : "cc", "memory"); \
431 __syscall_return(type, __res); \
432}
433
434#define _syscall6(type, name, atype, a, btype, b, \
435 ctype, c, dtype, d, etype, e, ftype, f) \
436type name(atype a, btype b, ctype c, dtype d, etype e, ftype f) \
437{ \
438 register long __res __asm__("er0"); \
439 register long _a __asm__("er1"); \
440 register long _b __asm__("er2"); \
441 register long _c __asm__("er3"); \
442 register long _d __asm__("er4"); \
443 register long _e __asm__("er5"); \
444 register long _f __asm__("er6"); \
445 _a = (long)a; \
446 _b = (long)b; \
447 _c = (long)c; \
448 _d = (long)d; \
449 _e = (long)e; \
450 _f = (long)f; \
451 __asm__ __volatile__ ("mov.l %1,er0\n\t" \
452 "trapa #0\n\t" \
453 : "=r" (__res) \
454 : "g" (__NR_##name), \
455 "g" (_a), \
456 "g" (_b), \
457 "g" (_c), \
458 "g" (_d), \
459 "g" (_e) \
460 "g" (_f) \
461 : "cc", "memory"); \
462 __syscall_return(type, __res); \
463}
464 298
465#define __ARCH_WANT_IPC_PARSE_VERSION 299#define __ARCH_WANT_IPC_PARSE_VERSION
466#define __ARCH_WANT_OLD_READDIR 300#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-i386/Kbuild b/include/asm-i386/Kbuild
index 147e4ac1ebf0..5ae93afc67e1 100644
--- a/include/asm-i386/Kbuild
+++ b/include/asm-i386/Kbuild
@@ -7,5 +7,4 @@ header-y += ptrace-abi.h
7header-y += ucontext.h 7header-y += ucontext.h
8 8
9unifdef-y += mtrr.h 9unifdef-y += mtrr.h
10unifdef-y += setup.h
11unifdef-y += vm86.h 10unifdef-y += vm86.h
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h
index 6016632d032f..c80b3a94511a 100644
--- a/include/asm-i386/acpi.h
+++ b/include/asm-i386/acpi.h
@@ -132,6 +132,7 @@ extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
132 132
133#ifdef CONFIG_X86_IO_APIC 133#ifdef CONFIG_X86_IO_APIC
134extern int acpi_skip_timer_override; 134extern int acpi_skip_timer_override;
135extern int acpi_use_timer_override;
135#endif 136#endif
136 137
137static inline void acpi_noirq_set(void) { acpi_noirq = 1; } 138static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
diff --git a/include/asm-i386/alternative.h b/include/asm-i386/alternative.h
index b01a7ec409ce..b8fa9557c532 100644
--- a/include/asm-i386/alternative.h
+++ b/include/asm-i386/alternative.h
@@ -4,7 +4,7 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/types.h> 6#include <asm/types.h>
7 7#include <linux/stddef.h>
8#include <linux/types.h> 8#include <linux/types.h>
9 9
10struct alt_instr { 10struct alt_instr {
@@ -118,4 +118,15 @@ static inline void alternatives_smp_switch(int smp) {}
118#define LOCK_PREFIX "" 118#define LOCK_PREFIX ""
119#endif 119#endif
120 120
121struct paravirt_patch;
122#ifdef CONFIG_PARAVIRT
123void apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end);
124#else
125static inline void
126apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end)
127{}
128#define __start_parainstructions NULL
129#define __stop_parainstructions NULL
130#endif
131
121#endif /* _I386_ALTERNATIVE_H */ 132#endif /* _I386_ALTERNATIVE_H */
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index b9529578fc37..41a44319905f 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -37,18 +37,27 @@ extern void generic_apic_probe(void);
37/* 37/*
38 * Basic functions accessing APICs. 38 * Basic functions accessing APICs.
39 */ 39 */
40#ifdef CONFIG_PARAVIRT
41#include <asm/paravirt.h>
42#else
43#define apic_write native_apic_write
44#define apic_write_atomic native_apic_write_atomic
45#define apic_read native_apic_read
46#endif
40 47
41static __inline void apic_write(unsigned long reg, unsigned long v) 48static __inline fastcall void native_apic_write(unsigned long reg,
49 unsigned long v)
42{ 50{
43 *((volatile unsigned long *)(APIC_BASE+reg)) = v; 51 *((volatile unsigned long *)(APIC_BASE+reg)) = v;
44} 52}
45 53
46static __inline void apic_write_atomic(unsigned long reg, unsigned long v) 54static __inline fastcall void native_apic_write_atomic(unsigned long reg,
55 unsigned long v)
47{ 56{
48 xchg((volatile unsigned long *)(APIC_BASE+reg), v); 57 xchg((volatile unsigned long *)(APIC_BASE+reg), v);
49} 58}
50 59
51static __inline unsigned long apic_read(unsigned long reg) 60static __inline fastcall unsigned long native_apic_read(unsigned long reg)
52{ 61{
53 return *((volatile unsigned long *)(APIC_BASE+reg)); 62 return *((volatile unsigned long *)(APIC_BASE+reg));
54} 63}
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index 51a166242522..c57441bb2905 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -14,7 +14,7 @@
14 * on us. We need to use _exactly_ the address the user gave us, 14 * on us. We need to use _exactly_ the address the user gave us,
15 * not some alias that contains the same information. 15 * not some alias that contains the same information.
16 */ 16 */
17typedef struct { volatile int counter; } atomic_t; 17typedef struct { int counter; } atomic_t;
18 18
19#define ATOMIC_INIT(i) { (i) } 19#define ATOMIC_INIT(i) { (i) }
20 20
@@ -187,9 +187,9 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
187 /* Modern 486+ processor */ 187 /* Modern 486+ processor */
188 __i = i; 188 __i = i;
189 __asm__ __volatile__( 189 __asm__ __volatile__(
190 LOCK_PREFIX "xaddl %0, %1;" 190 LOCK_PREFIX "xaddl %0, %1"
191 :"=r"(i) 191 :"+r" (i), "+m" (v->counter)
192 :"m"(v->counter), "0"(i)); 192 : : "memory");
193 return i + __i; 193 return i + __i;
194 194
195#ifdef CONFIG_M386 195#ifdef CONFIG_M386
diff --git a/include/asm-i386/boot.h b/include/asm-i386/boot.h
index 96b228e6e79c..8ce79a6fa891 100644
--- a/include/asm-i386/boot.h
+++ b/include/asm-i386/boot.h
@@ -12,4 +12,8 @@
12#define EXTENDED_VGA 0xfffe /* 80x50 mode */ 12#define EXTENDED_VGA 0xfffe /* 80x50 mode */
13#define ASK_VGA 0xfffd /* ask for it at bootup */ 13#define ASK_VGA 0xfffd /* ask for it at bootup */
14 14
15#endif 15/* Physical address where kenrel should be loaded. */
16#define LOAD_PHYSICAL_ADDR ((0x100000 + CONFIG_PHYSICAL_ALIGN - 1) \
17 & ~(CONFIG_PHYSICAL_ALIGN - 1))
18
19#endif /* _LINUX_BOOT_H */
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
index 592ffeeda45e..38f1aebbbdb5 100644
--- a/include/asm-i386/bugs.h
+++ b/include/asm-i386/bugs.h
@@ -21,6 +21,7 @@
21#include <asm/processor.h> 21#include <asm/processor.h>
22#include <asm/i387.h> 22#include <asm/i387.h>
23#include <asm/msr.h> 23#include <asm/msr.h>
24#include <asm/paravirt.h>
24 25
25static int __init no_halt(char *s) 26static int __init no_halt(char *s)
26{ 27{
@@ -91,6 +92,9 @@ static void __init check_fpu(void)
91 92
92static void __init check_hlt(void) 93static void __init check_hlt(void)
93{ 94{
95 if (paravirt_enabled())
96 return;
97
94 printk(KERN_INFO "Checking 'hlt' instruction... "); 98 printk(KERN_INFO "Checking 'hlt' instruction... ");
95 if (!boot_cpu_data.hlt_works_ok) { 99 if (!boot_cpu_data.hlt_works_ok) {
96 printk("disabled\n"); 100 printk("disabled\n");
diff --git a/include/asm-i386/checksum.h b/include/asm-i386/checksum.h
index 67d3630c4e89..75194abbe8ee 100644
--- a/include/asm-i386/checksum.h
+++ b/include/asm-i386/checksum.h
@@ -17,7 +17,7 @@
17 * 17 *
18 * it's best to have buff aligned on a 32-bit boundary 18 * it's best to have buff aligned on a 32-bit boundary
19 */ 19 */
20asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 20asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
21 21
22/* 22/*
23 * the same as csum_partial, but copies from src while it 23 * the same as csum_partial, but copies from src while it
@@ -27,8 +27,8 @@ asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsign
27 * better 64-bit) boundary 27 * better 64-bit) boundary
28 */ 28 */
29 29
30asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsigned char *dst, 30asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst,
31 int len, int sum, int *src_err_ptr, int *dst_err_ptr); 31 int len, __wsum sum, int *src_err_ptr, int *dst_err_ptr);
32 32
33/* 33/*
34 * Note: when you get a NULL pointer exception here this means someone 34 * Note: when you get a NULL pointer exception here this means someone
@@ -38,18 +38,18 @@ asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsi
38 * access_ok(). 38 * access_ok().
39 */ 39 */
40static __inline__ 40static __inline__
41unsigned int csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, 41__wsum csum_partial_copy_nocheck (const void *src, void *dst,
42 int len, int sum) 42 int len, __wsum sum)
43{ 43{
44 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); 44 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL);
45} 45}
46 46
47static __inline__ 47static __inline__
48unsigned int csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, 48__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
49 int len, int sum, int *err_ptr) 49 int len, __wsum sum, int *err_ptr)
50{ 50{
51 might_sleep(); 51 might_sleep();
52 return csum_partial_copy_generic((__force unsigned char *)src, dst, 52 return csum_partial_copy_generic((__force void *)src, dst,
53 len, sum, err_ptr, NULL); 53 len, sum, err_ptr, NULL);
54} 54}
55 55
@@ -60,8 +60,7 @@ unsigned int csum_partial_copy_from_user(const unsigned char __user *src, unsign
60 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by 60 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
61 * Arnt Gulbrandsen. 61 * Arnt Gulbrandsen.
62 */ 62 */
63static inline unsigned short ip_fast_csum(unsigned char * iph, 63static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
64 unsigned int ihl)
65{ 64{
66 unsigned int sum; 65 unsigned int sum;
67 66
@@ -89,29 +88,29 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
89 : "=r" (sum), "=r" (iph), "=r" (ihl) 88 : "=r" (sum), "=r" (iph), "=r" (ihl)
90 : "1" (iph), "2" (ihl) 89 : "1" (iph), "2" (ihl)
91 : "memory"); 90 : "memory");
92 return(sum); 91 return (__force __sum16)sum;
93} 92}
94 93
95/* 94/*
96 * Fold a partial checksum 95 * Fold a partial checksum
97 */ 96 */
98 97
99static inline unsigned int csum_fold(unsigned int sum) 98static inline __sum16 csum_fold(__wsum sum)
100{ 99{
101 __asm__( 100 __asm__(
102 "addl %1, %0 ;\n" 101 "addl %1, %0 ;\n"
103 "adcl $0xffff, %0 ;\n" 102 "adcl $0xffff, %0 ;\n"
104 : "=r" (sum) 103 : "=r" (sum)
105 : "r" (sum << 16), "0" (sum & 0xffff0000) 104 : "r" ((__force u32)sum << 16),
105 "0" ((__force u32)sum & 0xffff0000)
106 ); 106 );
107 return (~sum) >> 16; 107 return (__force __sum16)(~(__force u32)sum >> 16);
108} 108}
109 109
110static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 110static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
111 unsigned long daddr, 111 unsigned short len,
112 unsigned short len, 112 unsigned short proto,
113 unsigned short proto, 113 __wsum sum)
114 unsigned int sum)
115{ 114{
116 __asm__( 115 __asm__(
117 "addl %1, %0 ;\n" 116 "addl %1, %0 ;\n"
@@ -119,7 +118,7 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
119 "adcl %3, %0 ;\n" 118 "adcl %3, %0 ;\n"
120 "adcl $0, %0 ;\n" 119 "adcl $0, %0 ;\n"
121 : "=r" (sum) 120 : "=r" (sum)
122 : "g" (daddr), "g"(saddr), "g"((ntohs(len)<<16)+proto*256), "0"(sum)); 121 : "g" (daddr), "g"(saddr), "g"((len + proto) << 8), "0"(sum));
123 return sum; 122 return sum;
124} 123}
125 124
@@ -127,11 +126,10 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
127 * computes the checksum of the TCP/UDP pseudo-header 126 * computes the checksum of the TCP/UDP pseudo-header
128 * returns a 16-bit checksum, already complemented 127 * returns a 16-bit checksum, already complemented
129 */ 128 */
130static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 129static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
131 unsigned long daddr,
132 unsigned short len, 130 unsigned short len,
133 unsigned short proto, 131 unsigned short proto,
134 unsigned int sum) 132 __wsum sum)
135{ 133{
136 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 134 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
137} 135}
@@ -141,17 +139,16 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
141 * in icmp.c 139 * in icmp.c
142 */ 140 */
143 141
144static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 142static inline __sum16 ip_compute_csum(const void *buff, int len)
145{ 143{
146 return csum_fold (csum_partial(buff, len, 0)); 144 return csum_fold (csum_partial(buff, len, 0));
147} 145}
148 146
149#define _HAVE_ARCH_IPV6_CSUM 147#define _HAVE_ARCH_IPV6_CSUM
150static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 148static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
151 struct in6_addr *daddr, 149 const struct in6_addr *daddr,
152 __u32 len, 150 __u32 len, unsigned short proto,
153 unsigned short proto, 151 __wsum sum)
154 unsigned int sum)
155{ 152{
156 __asm__( 153 __asm__(
157 "addl 0(%1), %0 ;\n" 154 "addl 0(%1), %0 ;\n"
@@ -176,19 +173,19 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
176 * Copy and checksum to user 173 * Copy and checksum to user
177 */ 174 */
178#define HAVE_CSUM_COPY_USER 175#define HAVE_CSUM_COPY_USER
179static __inline__ unsigned int csum_and_copy_to_user(const unsigned char *src, 176static __inline__ __wsum csum_and_copy_to_user(const void *src,
180 unsigned char __user *dst, 177 void __user *dst,
181 int len, int sum, 178 int len, __wsum sum,
182 int *err_ptr) 179 int *err_ptr)
183{ 180{
184 might_sleep(); 181 might_sleep();
185 if (access_ok(VERIFY_WRITE, dst, len)) 182 if (access_ok(VERIFY_WRITE, dst, len))
186 return csum_partial_copy_generic(src, (__force unsigned char *)dst, len, sum, NULL, err_ptr); 183 return csum_partial_copy_generic(src, (__force void *)dst, len, sum, NULL, err_ptr);
187 184
188 if (len) 185 if (len)
189 *err_ptr = -EFAULT; 186 *err_ptr = -EFAULT;
190 187
191 return -1; /* invalid checksum */ 188 return (__force __wsum)-1; /* invalid checksum */
192} 189}
193 190
194#endif 191#endif
diff --git a/include/asm-i386/cpu.h b/include/asm-i386/cpu.h
index b1bc7b1b64b0..9d914e1e4aad 100644
--- a/include/asm-i386/cpu.h
+++ b/include/asm-i386/cpu.h
@@ -13,6 +13,9 @@ struct i386_cpu {
13extern int arch_register_cpu(int num); 13extern int arch_register_cpu(int num);
14#ifdef CONFIG_HOTPLUG_CPU 14#ifdef CONFIG_HOTPLUG_CPU
15extern void arch_unregister_cpu(int); 15extern void arch_unregister_cpu(int);
16extern int enable_cpu_hotplug;
17#else
18#define enable_cpu_hotplug 0
16#endif 19#endif
17 20
18DECLARE_PER_CPU(int, cpu_state); 21DECLARE_PER_CPU(int, cpu_state);
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index d314ebb3d59e..3f92b94e0d75 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -31,7 +31,7 @@
31#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */ 31#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */
32#define X86_FEATURE_PN (0*32+18) /* Processor serial number */ 32#define X86_FEATURE_PN (0*32+18) /* Processor serial number */
33#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */ 33#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */
34#define X86_FEATURE_DTES (0*32+21) /* Debug Trace Store */ 34#define X86_FEATURE_DS (0*32+21) /* Debug Store */
35#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */ 35#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */
36#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */ 36#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */
37#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */ 37#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */
@@ -73,6 +73,8 @@
73#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */ 73#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */
74#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* FXSAVE leaks FOP/FIP/FOP */ 74#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* FXSAVE leaks FOP/FIP/FOP */
75#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */ 75#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
76#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
77#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
76 78
77/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 79/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
78#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 80#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
@@ -134,6 +136,10 @@
134#define cpu_has_phe_enabled boot_cpu_has(X86_FEATURE_PHE_EN) 136#define cpu_has_phe_enabled boot_cpu_has(X86_FEATURE_PHE_EN)
135#define cpu_has_pmm boot_cpu_has(X86_FEATURE_PMM) 137#define cpu_has_pmm boot_cpu_has(X86_FEATURE_PMM)
136#define cpu_has_pmm_enabled boot_cpu_has(X86_FEATURE_PMM_EN) 138#define cpu_has_pmm_enabled boot_cpu_has(X86_FEATURE_PMM_EN)
139#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS)
140#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
141#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
142#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
137 143
138#endif /* __ASM_I386_CPUFEATURE_H */ 144#endif /* __ASM_I386_CPUFEATURE_H */
139 145
diff --git a/include/asm-i386/current.h b/include/asm-i386/current.h
index 3cbbecd79016..5252ee0f6d7a 100644
--- a/include/asm-i386/current.h
+++ b/include/asm-i386/current.h
@@ -1,13 +1,14 @@
1#ifndef _I386_CURRENT_H 1#ifndef _I386_CURRENT_H
2#define _I386_CURRENT_H 2#define _I386_CURRENT_H
3 3
4#include <linux/thread_info.h> 4#include <asm/pda.h>
5#include <linux/compiler.h>
5 6
6struct task_struct; 7struct task_struct;
7 8
8static __always_inline struct task_struct * get_current(void) 9static __always_inline struct task_struct *get_current(void)
9{ 10{
10 return current_thread_info()->task; 11 return read_pda(pcurrent);
11} 12}
12 13
13#define current get_current() 14#define current get_current()
diff --git a/include/asm-i386/delay.h b/include/asm-i386/delay.h
index b1c7650dc7b9..32d6678d0bbf 100644
--- a/include/asm-i386/delay.h
+++ b/include/asm-i386/delay.h
@@ -7,6 +7,7 @@
7 * Delay routines calling functions in arch/i386/lib/delay.c 7 * Delay routines calling functions in arch/i386/lib/delay.c
8 */ 8 */
9 9
10/* Undefined functions to get compile-time errors */
10extern void __bad_udelay(void); 11extern void __bad_udelay(void);
11extern void __bad_ndelay(void); 12extern void __bad_ndelay(void);
12 13
@@ -15,13 +16,23 @@ extern void __ndelay(unsigned long nsecs);
15extern void __const_udelay(unsigned long usecs); 16extern void __const_udelay(unsigned long usecs);
16extern void __delay(unsigned long loops); 17extern void __delay(unsigned long loops);
17 18
19#if defined(CONFIG_PARAVIRT) && !defined(USE_REAL_TIME_DELAY)
20#define udelay(n) paravirt_ops.const_udelay((n) * 0x10c7ul)
21
22#define ndelay(n) paravirt_ops.const_udelay((n) * 5ul)
23
24#else /* !PARAVIRT || USE_REAL_TIME_DELAY */
25
26/* 0x10c7 is 2**32 / 1000000 (rounded up) */
18#define udelay(n) (__builtin_constant_p(n) ? \ 27#define udelay(n) (__builtin_constant_p(n) ? \
19 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ 28 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \
20 __udelay(n)) 29 __udelay(n))
21 30
31/* 0x5 is 2**32 / 1000000000 (rounded up) */
22#define ndelay(n) (__builtin_constant_p(n) ? \ 32#define ndelay(n) (__builtin_constant_p(n) ? \
23 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ 33 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
24 __ndelay(n)) 34 __ndelay(n))
35#endif
25 36
26void use_tsc_delay(void); 37void use_tsc_delay(void);
27 38
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index 5874ef119ffd..f398cc456448 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -4,8 +4,6 @@
4#include <asm/ldt.h> 4#include <asm/ldt.h>
5#include <asm/segment.h> 5#include <asm/segment.h>
6 6
7#define CPU_16BIT_STACK_SIZE 1024
8
9#ifndef __ASSEMBLY__ 7#ifndef __ASSEMBLY__
10 8
11#include <linux/preempt.h> 9#include <linux/preempt.h>
@@ -16,8 +14,6 @@
16 14
17extern struct desc_struct cpu_gdt_table[GDT_ENTRIES]; 15extern struct desc_struct cpu_gdt_table[GDT_ENTRIES];
18 16
19DECLARE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]);
20
21struct Xgt_desc_struct { 17struct Xgt_desc_struct {
22 unsigned short size; 18 unsigned short size;
23 unsigned long address __attribute__((packed)); 19 unsigned long address __attribute__((packed));
@@ -33,11 +29,6 @@ static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
33 return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address; 29 return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address;
34} 30}
35 31
36/*
37 * This is the ldt that every process will get unless we need
38 * something other than this.
39 */
40extern struct desc_struct default_ldt[];
41extern struct desc_struct idt_table[]; 32extern struct desc_struct idt_table[];
42extern void set_intr_gate(unsigned int irq, void * addr); 33extern void set_intr_gate(unsigned int irq, void * addr);
43 34
@@ -64,8 +55,10 @@ static inline void pack_gate(__u32 *a, __u32 *b,
64#define DESCTYPE_DPL3 0x60 /* DPL-3 */ 55#define DESCTYPE_DPL3 0x60 /* DPL-3 */
65#define DESCTYPE_S 0x10 /* !system */ 56#define DESCTYPE_S 0x10 /* !system */
66 57
58#ifdef CONFIG_PARAVIRT
59#include <asm/paravirt.h>
60#else
67#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) 61#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
68#define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8))
69 62
70#define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr)) 63#define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr))
71#define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr)) 64#define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr))
@@ -88,6 +81,10 @@ static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
88#undef C 81#undef C
89} 82}
90 83
84#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
85#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
86#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b)
87
91static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b) 88static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b)
92{ 89{
93 __u32 *lp = (__u32 *)((char *)dt + entry*8); 90 __u32 *lp = (__u32 *)((char *)dt + entry*8);
@@ -95,9 +92,25 @@ static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entr
95 *(lp+1) = entry_b; 92 *(lp+1) = entry_b;
96} 93}
97 94
98#define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 95#define set_ldt native_set_ldt
99#define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 96#endif /* CONFIG_PARAVIRT */
100#define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 97
98static inline fastcall void native_set_ldt(const void *addr,
99 unsigned int entries)
100{
101 if (likely(entries == 0))
102 __asm__ __volatile__("lldt %w0"::"q" (0));
103 else {
104 unsigned cpu = smp_processor_id();
105 __u32 a, b;
106
107 pack_descriptor(&a, &b, (unsigned long)addr,
108 entries * sizeof(struct desc_struct) - 1,
109 DESCTYPE_LDT, 0);
110 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, a, b);
111 __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8));
112 }
113}
101 114
102static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg) 115static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg)
103{ 116{
@@ -115,14 +128,6 @@ static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const vo
115 write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b); 128 write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b);
116} 129}
117 130
118static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int entries)
119{
120 __u32 a, b;
121 pack_descriptor(&a, &b, (unsigned long)addr,
122 entries * sizeof(struct desc_struct) - 1,
123 DESCTYPE_LDT, 0);
124 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, a, b);
125}
126 131
127#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) 132#define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)
128 133
@@ -153,35 +158,22 @@ static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int entri
153 158
154static inline void clear_LDT(void) 159static inline void clear_LDT(void)
155{ 160{
156 int cpu = get_cpu(); 161 set_ldt(NULL, 0);
157
158 set_ldt_desc(cpu, &default_ldt[0], 5);
159 load_LDT_desc();
160 put_cpu();
161} 162}
162 163
163/* 164/*
164 * load one particular LDT into the current CPU 165 * load one particular LDT into the current CPU
165 */ 166 */
166static inline void load_LDT_nolock(mm_context_t *pc, int cpu) 167static inline void load_LDT_nolock(mm_context_t *pc)
167{ 168{
168 void *segments = pc->ldt; 169 set_ldt(pc->ldt, pc->size);
169 int count = pc->size;
170
171 if (likely(!count)) {
172 segments = &default_ldt[0];
173 count = 5;
174 }
175
176 set_ldt_desc(cpu, segments, count);
177 load_LDT_desc();
178} 170}
179 171
180static inline void load_LDT(mm_context_t *pc) 172static inline void load_LDT(mm_context_t *pc)
181{ 173{
182 int cpu = get_cpu(); 174 preempt_disable();
183 load_LDT_nolock(pc, cpu); 175 load_LDT_nolock(pc);
184 put_cpu(); 176 preempt_enable();
185} 177}
186 178
187static inline unsigned long get_desc_base(unsigned long *desc) 179static inline unsigned long get_desc_base(unsigned long *desc)
@@ -193,6 +185,29 @@ static inline unsigned long get_desc_base(unsigned long *desc)
193 return base; 185 return base;
194} 186}
195 187
188#else /* __ASSEMBLY__ */
189
190/*
191 * GET_DESC_BASE reads the descriptor base of the specified segment.
192 *
193 * Args:
194 * idx - descriptor index
195 * gdt - GDT pointer
196 * base - 32bit register to which the base will be written
197 * lo_w - lo word of the "base" register
198 * lo_b - lo byte of the "base" register
199 * hi_b - hi byte of the low word of the "base" register
200 *
201 * Example:
202 * GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah)
203 * Will read the base address of GDT_ENTRY_ESPFIX_SS and put it into %eax.
204 */
205#define GET_DESC_BASE(idx, gdt, base, lo_w, lo_b, hi_b) \
206 movb idx*8+4(gdt), lo_b; \
207 movb idx*8+7(gdt), hi_b; \
208 shll $16, base; \
209 movw idx*8+2(gdt), lo_w;
210
196#endif /* !__ASSEMBLY__ */ 211#endif /* !__ASSEMBLY__ */
197 212
198#endif 213#endif
diff --git a/include/asm-i386/device.h b/include/asm-i386/device.h
new file mode 100644
index 000000000000..849604c70e6b
--- /dev/null
+++ b/include/asm-i386/device.h
@@ -0,0 +1,15 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef _ASM_I386_DEVICE_H
7#define _ASM_I386_DEVICE_H
8
9struct dev_archdata {
10#ifdef CONFIG_ACPI
11 void *acpi_handle;
12#endif
13};
14
15#endif /* _ASM_I386_DEVICE_H */
diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h
index 81999a3ebe7c..183eebeebbdc 100644
--- a/include/asm-i386/dma-mapping.h
+++ b/include/asm-i386/dma-mapping.h
@@ -156,10 +156,10 @@ dma_get_cache_alignment(void)
156 return (1 << INTERNODE_CACHE_SHIFT); 156 return (1 << INTERNODE_CACHE_SHIFT);
157} 157}
158 158
159#define dma_is_consistent(d) (1) 159#define dma_is_consistent(d, h) (1)
160 160
161static inline void 161static inline void
162dma_cache_sync(void *vaddr, size_t size, 162dma_cache_sync(struct device *dev, void *vaddr, size_t size,
163 enum dma_data_direction direction) 163 enum dma_data_direction direction)
164{ 164{
165 flush_write_buffers(); 165 flush_write_buffers();
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
index f7514fb6e8e4..395077aba583 100644
--- a/include/asm-i386/e820.h
+++ b/include/asm-i386/e820.h
@@ -38,6 +38,11 @@ extern struct e820map e820;
38 38
39extern int e820_all_mapped(unsigned long start, unsigned long end, 39extern int e820_all_mapped(unsigned long start, unsigned long end,
40 unsigned type); 40 unsigned type);
41extern void find_max_pfn(void);
42extern void register_bootmem_low_pages(unsigned long max_low_pfn);
43extern void register_memory(void);
44extern void limit_regions(unsigned long long size);
45extern void print_memory_map(char *who);
41 46
42#endif/*!__ASSEMBLY__*/ 47#endif/*!__ASSEMBLY__*/
43 48
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 3a05436f31c0..45d21a0c95bf 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -91,7 +91,7 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
91 pr_reg[7] = regs->xds; \ 91 pr_reg[7] = regs->xds; \
92 pr_reg[8] = regs->xes; \ 92 pr_reg[8] = regs->xes; \
93 savesegment(fs,pr_reg[9]); \ 93 savesegment(fs,pr_reg[9]); \
94 savesegment(gs,pr_reg[10]); \ 94 pr_reg[10] = regs->xgs; \
95 pr_reg[11] = regs->orig_eax; \ 95 pr_reg[11] = regs->orig_eax; \
96 pr_reg[12] = regs->eip; \ 96 pr_reg[12] = regs->eip; \
97 pr_reg[13] = regs->xcs; \ 97 pr_reg[13] = regs->xcs; \
diff --git a/include/asm-i386/futex.h b/include/asm-i386/futex.h
index 946d97cfea23..438ef0ec7101 100644
--- a/include/asm-i386/futex.h
+++ b/include/asm-i386/futex.h
@@ -56,7 +56,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
56 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 56 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
57 return -EFAULT; 57 return -EFAULT;
58 58
59 inc_preempt_count(); 59 pagefault_disable();
60 60
61 if (op == FUTEX_OP_SET) 61 if (op == FUTEX_OP_SET)
62 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg); 62 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
@@ -88,7 +88,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
88 } 88 }
89 } 89 }
90 90
91 dec_preempt_count(); 91 pagefault_enable();
92 92
93 if (!ret) { 93 if (!ret) {
94 switch (cmp) { 94 switch (cmp) {
diff --git a/include/asm-i386/genapic.h b/include/asm-i386/genapic.h
index 8ffbb0f07457..fd2be593b06e 100644
--- a/include/asm-i386/genapic.h
+++ b/include/asm-i386/genapic.h
@@ -122,6 +122,6 @@ struct genapic {
122 APICFUNC(phys_pkg_id) \ 122 APICFUNC(phys_pkg_id) \
123 } 123 }
124 124
125extern struct genapic *genapic; 125extern struct genapic *genapic, apic_default;
126 126
127#endif 127#endif
diff --git a/include/asm-i386/i387.h b/include/asm-i386/i387.h
index bc1d6edae1ed..434936c732d6 100644
--- a/include/asm-i386/i387.h
+++ b/include/asm-i386/i387.h
@@ -76,7 +76,9 @@ static inline void __save_init_fpu( struct task_struct *tsk )
76 76
77#define __unlazy_fpu( tsk ) do { \ 77#define __unlazy_fpu( tsk ) do { \
78 if (task_thread_info(tsk)->status & TS_USEDFPU) \ 78 if (task_thread_info(tsk)->status & TS_USEDFPU) \
79 save_init_fpu( tsk ); \ 79 save_init_fpu( tsk ); \
80 else \
81 tsk->fpu_counter = 0; \
80} while (0) 82} while (0)
81 83
82#define __clear_fpu( tsk ) \ 84#define __clear_fpu( tsk ) \
@@ -118,6 +120,7 @@ static inline void save_init_fpu( struct task_struct *tsk )
118extern unsigned short get_fpu_cwd( struct task_struct *tsk ); 120extern unsigned short get_fpu_cwd( struct task_struct *tsk );
119extern unsigned short get_fpu_swd( struct task_struct *tsk ); 121extern unsigned short get_fpu_swd( struct task_struct *tsk );
120extern unsigned short get_fpu_mxcsr( struct task_struct *tsk ); 122extern unsigned short get_fpu_mxcsr( struct task_struct *tsk );
123extern asmlinkage void math_state_restore(void);
121 124
122/* 125/*
123 * Signal frame handlers... 126 * Signal frame handlers...
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index 68df0dc3ab8f..86ff5e83be2f 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -256,11 +256,11 @@ static inline void flush_write_buffers(void)
256 256
257#endif /* __KERNEL__ */ 257#endif /* __KERNEL__ */
258 258
259#ifdef SLOW_IO_BY_JUMPING 259#if defined(CONFIG_PARAVIRT)
260#define __SLOW_DOWN_IO "jmp 1f; 1: jmp 1f; 1:" 260#include <asm/paravirt.h>
261#else 261#else
262
262#define __SLOW_DOWN_IO "outb %%al,$0x80;" 263#define __SLOW_DOWN_IO "outb %%al,$0x80;"
263#endif
264 264
265static inline void slow_down_io(void) { 265static inline void slow_down_io(void) {
266 __asm__ __volatile__( 266 __asm__ __volatile__(
@@ -271,6 +271,8 @@ static inline void slow_down_io(void) {
271 : : ); 271 : : );
272} 272}
273 273
274#endif
275
274#ifdef CONFIG_X86_NUMAQ 276#ifdef CONFIG_X86_NUMAQ
275extern void *xquad_portio; /* Where the IO area was mapped */ 277extern void *xquad_portio; /* Where the IO area was mapped */
276#define XQUAD_PORT_ADDR(port, quad) (xquad_portio + (XQUAD_PORTIO_QUAD*quad) + port) 278#define XQUAD_PORT_ADDR(port, quad) (xquad_portio + (XQUAD_PORTIO_QUAD*quad) + port)
diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h
index 331726b41128..11761cdaae19 100644
--- a/include/asm-i386/irq.h
+++ b/include/asm-i386/irq.h
@@ -37,8 +37,13 @@ static __inline__ int irq_canonicalize(int irq)
37extern int irqbalance_disable(char *str); 37extern int irqbalance_disable(char *str);
38#endif 38#endif
39 39
40extern void quirk_intel_irqbalance(void);
41
40#ifdef CONFIG_HOTPLUG_CPU 42#ifdef CONFIG_HOTPLUG_CPU
41extern void fixup_irqs(cpumask_t map); 43extern void fixup_irqs(cpumask_t map);
42#endif 44#endif
43 45
46void init_IRQ(void);
47void __init native_init_IRQ(void);
48
44#endif /* _ASM_IRQ_H */ 49#endif /* _ASM_IRQ_H */
diff --git a/include/asm-i386/irq_regs.h b/include/asm-i386/irq_regs.h
index 3dd9c0b70270..a1b3f7f594a2 100644
--- a/include/asm-i386/irq_regs.h
+++ b/include/asm-i386/irq_regs.h
@@ -1 +1,27 @@
1#include <asm-generic/irq_regs.h> 1/*
2 * Per-cpu current frame pointer - the location of the last exception frame on
3 * the stack, stored in the PDA.
4 *
5 * Jeremy Fitzhardinge <jeremy@goop.org>
6 */
7#ifndef _ASM_I386_IRQ_REGS_H
8#define _ASM_I386_IRQ_REGS_H
9
10#include <asm/pda.h>
11
12static inline struct pt_regs *get_irq_regs(void)
13{
14 return read_pda(irq_regs);
15}
16
17static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs)
18{
19 struct pt_regs *old_regs;
20
21 old_regs = read_pda(irq_regs);
22 write_pda(irq_regs, new_regs);
23
24 return old_regs;
25}
26
27#endif /* _ASM_I386_IRQ_REGS_H */
diff --git a/include/asm-i386/irqflags.h b/include/asm-i386/irqflags.h
index e1bdb97c07fa..17b18cf4fe9d 100644
--- a/include/asm-i386/irqflags.h
+++ b/include/asm-i386/irqflags.h
@@ -10,6 +10,9 @@
10#ifndef _ASM_IRQFLAGS_H 10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H 11#define _ASM_IRQFLAGS_H
12 12
13#ifdef CONFIG_PARAVIRT
14#include <asm/paravirt.h>
15#else
13#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
14 17
15static inline unsigned long __raw_local_save_flags(void) 18static inline unsigned long __raw_local_save_flags(void)
@@ -25,9 +28,6 @@ static inline unsigned long __raw_local_save_flags(void)
25 return flags; 28 return flags;
26} 29}
27 30
28#define raw_local_save_flags(flags) \
29 do { (flags) = __raw_local_save_flags(); } while (0)
30
31static inline void raw_local_irq_restore(unsigned long flags) 31static inline void raw_local_irq_restore(unsigned long flags)
32{ 32{
33 __asm__ __volatile__( 33 __asm__ __volatile__(
@@ -66,18 +66,6 @@ static inline void halt(void)
66 __asm__ __volatile__("hlt": : :"memory"); 66 __asm__ __volatile__("hlt": : :"memory");
67} 67}
68 68
69static inline int raw_irqs_disabled_flags(unsigned long flags)
70{
71 return !(flags & (1 << 9));
72}
73
74static inline int raw_irqs_disabled(void)
75{
76 unsigned long flags = __raw_local_save_flags();
77
78 return raw_irqs_disabled_flags(flags);
79}
80
81/* 69/*
82 * For spinlocks, etc: 70 * For spinlocks, etc:
83 */ 71 */
@@ -90,9 +78,33 @@ static inline unsigned long __raw_local_irq_save(void)
90 return flags; 78 return flags;
91} 79}
92 80
81#else
82#define DISABLE_INTERRUPTS(clobbers) cli
83#define ENABLE_INTERRUPTS(clobbers) sti
84#define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit
85#define INTERRUPT_RETURN iret
86#define GET_CR0_INTO_EAX movl %cr0, %eax
87#endif /* __ASSEMBLY__ */
88#endif /* CONFIG_PARAVIRT */
89
90#ifndef __ASSEMBLY__
91#define raw_local_save_flags(flags) \
92 do { (flags) = __raw_local_save_flags(); } while (0)
93
93#define raw_local_irq_save(flags) \ 94#define raw_local_irq_save(flags) \
94 do { (flags) = __raw_local_irq_save(); } while (0) 95 do { (flags) = __raw_local_irq_save(); } while (0)
95 96
97static inline int raw_irqs_disabled_flags(unsigned long flags)
98{
99 return !(flags & (1 << 9));
100}
101
102static inline int raw_irqs_disabled(void)
103{
104 unsigned long flags = __raw_local_save_flags();
105
106 return raw_irqs_disabled_flags(flags);
107}
96#endif /* __ASSEMBLY__ */ 108#endif /* __ASSEMBLY__ */
97 109
98/* 110/*
diff --git a/include/asm-i386/mach-default/setup_arch.h b/include/asm-i386/mach-default/setup_arch.h
index fb42099e7bd4..605e3ccb991b 100644
--- a/include/asm-i386/mach-default/setup_arch.h
+++ b/include/asm-i386/mach-default/setup_arch.h
@@ -2,4 +2,6 @@
2 2
3/* no action for generic */ 3/* no action for generic */
4 4
5#ifndef ARCH_SETUP
5#define ARCH_SETUP 6#define ARCH_SETUP
7#endif
diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h
index ef0671e5d5c5..43e5bd8f4a19 100644
--- a/include/asm-i386/mach-summit/mach_apic.h
+++ b/include/asm-i386/mach-summit/mach_apic.h
@@ -88,7 +88,11 @@ static inline void clustered_apic_check(void)
88 88
89static inline int apicid_to_node(int logical_apicid) 89static inline int apicid_to_node(int logical_apicid)
90{ 90{
91#ifdef CONFIG_SMP
91 return apicid_2_node[hard_smp_processor_id()]; 92 return apicid_2_node[hard_smp_processor_id()];
93#else
94 return 0;
95#endif
92} 96}
93 97
94/* Mapping from cpu number to logical apicid */ 98/* Mapping from cpu number to logical apicid */
diff --git a/include/asm-i386/math_emu.h b/include/asm-i386/math_emu.h
index 697673b555ce..a4b0aa3320e6 100644
--- a/include/asm-i386/math_emu.h
+++ b/include/asm-i386/math_emu.h
@@ -21,6 +21,7 @@ struct info {
21 long ___eax; 21 long ___eax;
22 long ___ds; 22 long ___ds;
23 long ___es; 23 long ___es;
24 long ___fs;
24 long ___orig_eax; 25 long ___orig_eax;
25 long ___eip; 26 long ___eip;
26 long ___cs; 27 long ___cs;
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
index 62b7bf184094..68ff102d6f5e 100644
--- a/include/asm-i386/mmu_context.h
+++ b/include/asm-i386/mmu_context.h
@@ -44,7 +44,7 @@ static inline void switch_mm(struct mm_struct *prev,
44 * load the LDT, if the LDT is different: 44 * load the LDT, if the LDT is different:
45 */ 45 */
46 if (unlikely(prev->context.ldt != next->context.ldt)) 46 if (unlikely(prev->context.ldt != next->context.ldt))
47 load_LDT_nolock(&next->context, cpu); 47 load_LDT_nolock(&next->context);
48 } 48 }
49#ifdef CONFIG_SMP 49#ifdef CONFIG_SMP
50 else { 50 else {
@@ -56,14 +56,14 @@ static inline void switch_mm(struct mm_struct *prev,
56 * tlb flush IPI delivery. We must reload %cr3. 56 * tlb flush IPI delivery. We must reload %cr3.
57 */ 57 */
58 load_cr3(next->pgd); 58 load_cr3(next->pgd);
59 load_LDT_nolock(&next->context, cpu); 59 load_LDT_nolock(&next->context);
60 } 60 }
61 } 61 }
62#endif 62#endif
63} 63}
64 64
65#define deactivate_mm(tsk, mm) \ 65#define deactivate_mm(tsk, mm) \
66 asm("movl %0,%%fs ; movl %0,%%gs": :"r" (0)) 66 asm("movl %0,%%fs": :"r" (0));
67 67
68#define activate_mm(prev, next) \ 68#define activate_mm(prev, next) \
69 switch_mm((prev),(next),NULL) 69 switch_mm((prev),(next),NULL)
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h
index 61b073322006..3503ad66945e 100644
--- a/include/asm-i386/mmzone.h
+++ b/include/asm-i386/mmzone.h
@@ -120,13 +120,26 @@ static inline int pfn_valid(int pfn)
120 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 120 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
121#define alloc_bootmem_low_pages(x) \ 121#define alloc_bootmem_low_pages(x) \
122 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) 122 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0)
123#define alloc_bootmem_node(ignore, x) \ 123#define alloc_bootmem_node(pgdat, x) \
124 __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 124({ \
125#define alloc_bootmem_pages_node(ignore, x) \ 125 struct pglist_data __attribute__ ((unused)) \
126 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 126 *__alloc_bootmem_node__pgdat = (pgdat); \
127#define alloc_bootmem_low_pages_node(ignore, x) \ 127 __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, \
128 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0) 128 __pa(MAX_DMA_ADDRESS)); \
129 129})
130#define alloc_bootmem_pages_node(pgdat, x) \
131({ \
132 struct pglist_data __attribute__ ((unused)) \
133 *__alloc_bootmem_node__pgdat = (pgdat); \
134 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, \
135 __pa(MAX_DMA_ADDRESS)) \
136})
137#define alloc_bootmem_low_pages_node(pgdat, x) \
138({ \
139 struct pglist_data __attribute__ ((unused)) \
140 *__alloc_bootmem_node__pgdat = (pgdat); \
141 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0); \
142})
130#endif /* CONFIG_NEED_MULTIPLE_NODES */ 143#endif /* CONFIG_NEED_MULTIPLE_NODES */
131 144
132#endif /* _ASM_MMZONE_H_ */ 145#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-i386/module.h b/include/asm-i386/module.h
index 424661d25bd3..02f8f541cbe0 100644
--- a/include/asm-i386/module.h
+++ b/include/asm-i386/module.h
@@ -20,6 +20,8 @@ struct mod_arch_specific
20#define MODULE_PROC_FAMILY "586TSC " 20#define MODULE_PROC_FAMILY "586TSC "
21#elif defined CONFIG_M586MMX 21#elif defined CONFIG_M586MMX
22#define MODULE_PROC_FAMILY "586MMX " 22#define MODULE_PROC_FAMILY "586MMX "
23#elif defined CONFIG_MCORE2
24#define MODULE_PROC_FAMILY "CORE2 "
23#elif defined CONFIG_M686 25#elif defined CONFIG_M686
24#define MODULE_PROC_FAMILY "686 " 26#define MODULE_PROC_FAMILY "686 "
25#elif defined CONFIG_MPENTIUMII 27#elif defined CONFIG_MPENTIUMII
@@ -60,18 +62,12 @@ struct mod_arch_specific
60#error unknown processor family 62#error unknown processor family
61#endif 63#endif
62 64
63#ifdef CONFIG_REGPARM
64#define MODULE_REGPARM "REGPARM "
65#else
66#define MODULE_REGPARM ""
67#endif
68
69#ifdef CONFIG_4KSTACKS 65#ifdef CONFIG_4KSTACKS
70#define MODULE_STACKSIZE "4KSTACKS " 66#define MODULE_STACKSIZE "4KSTACKS "
71#else 67#else
72#define MODULE_STACKSIZE "" 68#define MODULE_STACKSIZE ""
73#endif 69#endif
74 70
75#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_REGPARM MODULE_STACKSIZE 71#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE
76 72
77#endif /* _ASM_I386_MODULE_H */ 73#endif /* _ASM_I386_MODULE_H */
diff --git a/include/asm-i386/mpspec_def.h b/include/asm-i386/mpspec_def.h
index 76feedf85a8a..13bafb16e7af 100644
--- a/include/asm-i386/mpspec_def.h
+++ b/include/asm-i386/mpspec_def.h
@@ -97,7 +97,6 @@ struct mpc_config_bus
97#define BUSTYPE_TC "TC" 97#define BUSTYPE_TC "TC"
98#define BUSTYPE_VME "VME" 98#define BUSTYPE_VME "VME"
99#define BUSTYPE_XPRESS "XPRESS" 99#define BUSTYPE_XPRESS "XPRESS"
100#define BUSTYPE_NEC98 "NEC98"
101 100
102struct mpc_config_ioapic 101struct mpc_config_ioapic
103{ 102{
@@ -182,7 +181,6 @@ enum mp_bustype {
182 MP_BUS_EISA, 181 MP_BUS_EISA,
183 MP_BUS_PCI, 182 MP_BUS_PCI,
184 MP_BUS_MCA, 183 MP_BUS_MCA,
185 MP_BUS_NEC98
186}; 184};
187#endif 185#endif
188 186
diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h
index 62b76cd96957..5679d4993072 100644
--- a/include/asm-i386/msr.h
+++ b/include/asm-i386/msr.h
@@ -1,6 +1,10 @@
1#ifndef __ASM_MSR_H 1#ifndef __ASM_MSR_H
2#define __ASM_MSR_H 2#define __ASM_MSR_H
3 3
4#ifdef CONFIG_PARAVIRT
5#include <asm/paravirt.h>
6#else
7
4/* 8/*
5 * Access to machine-specific registers (available on 586 and better only) 9 * Access to machine-specific registers (available on 586 and better only)
6 * Note: the rd* operations modify the parameters directly (without using 10 * Note: the rd* operations modify the parameters directly (without using
@@ -77,6 +81,7 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val)
77 __asm__ __volatile__("rdpmc" \ 81 __asm__ __volatile__("rdpmc" \
78 : "=a" (low), "=d" (high) \ 82 : "=a" (low), "=d" (high) \
79 : "c" (counter)) 83 : "c" (counter))
84#endif /* !CONFIG_PARAVIRT */
80 85
81/* symbolic names for some interesting MSRs */ 86/* symbolic names for some interesting MSRs */
82/* Intel defined MSRs. */ 87/* Intel defined MSRs. */
@@ -141,6 +146,10 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val)
141#define MSR_IA32_MC0_ADDR 0x402 146#define MSR_IA32_MC0_ADDR 0x402
142#define MSR_IA32_MC0_MISC 0x403 147#define MSR_IA32_MC0_MISC 0x403
143 148
149#define MSR_IA32_PEBS_ENABLE 0x3f1
150#define MSR_IA32_DS_AREA 0x600
151#define MSR_IA32_PERF_CAPABILITIES 0x345
152
144/* Pentium IV performance counter MSRs */ 153/* Pentium IV performance counter MSRs */
145#define MSR_P4_BPU_PERFCTR0 0x300 154#define MSR_P4_BPU_PERFCTR0 0x300
146#define MSR_P4_BPU_PERFCTR1 0x301 155#define MSR_P4_BPU_PERFCTR1 0x301
@@ -284,4 +293,13 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val)
284#define MSR_TMTA_LRTI_READOUT 0x80868018 293#define MSR_TMTA_LRTI_READOUT 0x80868018
285#define MSR_TMTA_LRTI_VOLT_MHZ 0x8086801a 294#define MSR_TMTA_LRTI_VOLT_MHZ 0x8086801a
286 295
296/* Intel Core-based CPU performance counters */
297#define MSR_CORE_PERF_FIXED_CTR0 0x309
298#define MSR_CORE_PERF_FIXED_CTR1 0x30a
299#define MSR_CORE_PERF_FIXED_CTR2 0x30b
300#define MSR_CORE_PERF_FIXED_CTR_CTRL 0x38d
301#define MSR_CORE_PERF_GLOBAL_STATUS 0x38e
302#define MSR_CORE_PERF_GLOBAL_CTRL 0x38f
303#define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x390
304
287#endif /* __ASM_MSR_H */ 305#endif /* __ASM_MSR_H */
diff --git a/include/asm-i386/nmi.h b/include/asm-i386/nmi.h
index 269d315719ca..b04333ea6f31 100644
--- a/include/asm-i386/nmi.h
+++ b/include/asm-i386/nmi.h
@@ -5,6 +5,9 @@
5#define ASM_NMI_H 5#define ASM_NMI_H
6 6
7#include <linux/pm.h> 7#include <linux/pm.h>
8#include <asm/irq.h>
9
10#ifdef ARCH_HAS_NMI_WATCHDOG
8 11
9/** 12/**
10 * do_nmi_callback 13 * do_nmi_callback
@@ -42,4 +45,9 @@ extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
42 void __user *, size_t *, loff_t *); 45 void __user *, size_t *, loff_t *);
43extern int unknown_nmi_panic; 46extern int unknown_nmi_panic;
44 47
48void __trigger_all_cpu_backtrace(void);
49#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
50
51#endif
52
45#endif /* ASM_NMI_H */ 53#endif /* ASM_NMI_H */
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index f5bf544c729a..fd3f64ace248 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -52,6 +52,7 @@ typedef struct { unsigned long long pgprot; } pgprot_t;
52#define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) 52#define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
53#define __pmd(x) ((pmd_t) { (x) } ) 53#define __pmd(x) ((pmd_t) { (x) } )
54#define HPAGE_SHIFT 21 54#define HPAGE_SHIFT 21
55#include <asm-generic/pgtable-nopud.h>
55#else 56#else
56typedef struct { unsigned long pte_low; } pte_t; 57typedef struct { unsigned long pte_low; } pte_t;
57typedef struct { unsigned long pgd; } pgd_t; 58typedef struct { unsigned long pgd; } pgd_t;
@@ -59,6 +60,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
59#define boot_pte_t pte_t /* or would you rather have a typedef */ 60#define boot_pte_t pte_t /* or would you rather have a typedef */
60#define pte_val(x) ((x).pte_low) 61#define pte_val(x) ((x).pte_low)
61#define HPAGE_SHIFT 22 62#define HPAGE_SHIFT 22
63#include <asm-generic/pgtable-nopmd.h>
62#endif 64#endif
63#define PTE_MASK PAGE_MASK 65#define PTE_MASK PAGE_MASK
64 66
@@ -112,18 +114,18 @@ extern int page_is_ram(unsigned long pagenr);
112 114
113#ifdef __ASSEMBLY__ 115#ifdef __ASSEMBLY__
114#define __PAGE_OFFSET CONFIG_PAGE_OFFSET 116#define __PAGE_OFFSET CONFIG_PAGE_OFFSET
115#define __PHYSICAL_START CONFIG_PHYSICAL_START
116#else 117#else
117#define __PAGE_OFFSET ((unsigned long)CONFIG_PAGE_OFFSET) 118#define __PAGE_OFFSET ((unsigned long)CONFIG_PAGE_OFFSET)
118#define __PHYSICAL_START ((unsigned long)CONFIG_PHYSICAL_START)
119#endif 119#endif
120#define __KERNEL_START (__PAGE_OFFSET + __PHYSICAL_START)
121 120
122 121
123#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) 122#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
124#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) 123#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
125#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) 124#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
126#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 125#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
126/* __pa_symbol should be used for C visible symbols.
127 This seems to be the official gcc blessed way to do such arithmetic. */
128#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))
127#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) 129#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
128#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 130#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
129#ifdef CONFIG_FLATMEM 131#ifdef CONFIG_FLATMEM
diff --git a/include/asm-i386/param.h b/include/asm-i386/param.h
index 745dc5bd0fbc..21b32466fcdc 100644
--- a/include/asm-i386/param.h
+++ b/include/asm-i386/param.h
@@ -18,6 +18,5 @@
18#endif 18#endif
19 19
20#define MAXHOSTNAMELEN 64 /* max length of hostname */ 20#define MAXHOSTNAMELEN 64 /* max length of hostname */
21#define COMMAND_LINE_SIZE 256
22 21
23#endif 22#endif
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
new file mode 100644
index 000000000000..9f06265065f4
--- /dev/null
+++ b/include/asm-i386/paravirt.h
@@ -0,0 +1,505 @@
1#ifndef __ASM_PARAVIRT_H
2#define __ASM_PARAVIRT_H
3/* Various instructions on x86 need to be replaced for
4 * para-virtualization: those hooks are defined here. */
5#include <linux/linkage.h>
6#include <linux/stringify.h>
7#include <asm/page.h>
8
9#ifdef CONFIG_PARAVIRT
10/* These are the most performance critical ops, so we want to be able to patch
11 * callers */
12#define PARAVIRT_IRQ_DISABLE 0
13#define PARAVIRT_IRQ_ENABLE 1
14#define PARAVIRT_RESTORE_FLAGS 2
15#define PARAVIRT_SAVE_FLAGS 3
16#define PARAVIRT_SAVE_FLAGS_IRQ_DISABLE 4
17#define PARAVIRT_INTERRUPT_RETURN 5
18#define PARAVIRT_STI_SYSEXIT 6
19
20/* Bitmask of what can be clobbered: usually at least eax. */
21#define CLBR_NONE 0x0
22#define CLBR_EAX 0x1
23#define CLBR_ECX 0x2
24#define CLBR_EDX 0x4
25#define CLBR_ANY 0x7
26
27#ifndef __ASSEMBLY__
28struct thread_struct;
29struct Xgt_desc_struct;
30struct tss_struct;
31struct mm_struct;
32struct paravirt_ops
33{
34 unsigned int kernel_rpl;
35 int paravirt_enabled;
36 const char *name;
37
38 /*
39 * Patch may replace one of the defined code sequences with arbitrary
40 * code, subject to the same register constraints. This generally
41 * means the code is not free to clobber any registers other than EAX.
42 * The patch function should return the number of bytes of code
43 * generated, as we nop pad the rest in generic code.
44 */
45 unsigned (*patch)(u8 type, u16 clobber, void *firstinsn, unsigned len);
46
47 void (*arch_setup)(void);
48 char *(*memory_setup)(void);
49 void (*init_IRQ)(void);
50
51 void (*banner)(void);
52
53 unsigned long (*get_wallclock)(void);
54 int (*set_wallclock)(unsigned long);
55 void (*time_init)(void);
56
57 /* All the function pointers here are declared as "fastcall"
58 so that we get a specific register-based calling
59 convention. This makes it easier to implement inline
60 assembler replacements. */
61
62 void (fastcall *cpuid)(unsigned int *eax, unsigned int *ebx,
63 unsigned int *ecx, unsigned int *edx);
64
65 unsigned long (fastcall *get_debugreg)(int regno);
66 void (fastcall *set_debugreg)(int regno, unsigned long value);
67
68 void (fastcall *clts)(void);
69
70 unsigned long (fastcall *read_cr0)(void);
71 void (fastcall *write_cr0)(unsigned long);
72
73 unsigned long (fastcall *read_cr2)(void);
74 void (fastcall *write_cr2)(unsigned long);
75
76 unsigned long (fastcall *read_cr3)(void);
77 void (fastcall *write_cr3)(unsigned long);
78
79 unsigned long (fastcall *read_cr4_safe)(void);
80 unsigned long (fastcall *read_cr4)(void);
81 void (fastcall *write_cr4)(unsigned long);
82
83 unsigned long (fastcall *save_fl)(void);
84 void (fastcall *restore_fl)(unsigned long);
85 void (fastcall *irq_disable)(void);
86 void (fastcall *irq_enable)(void);
87 void (fastcall *safe_halt)(void);
88 void (fastcall *halt)(void);
89 void (fastcall *wbinvd)(void);
90
91 /* err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */
92 u64 (fastcall *read_msr)(unsigned int msr, int *err);
93 int (fastcall *write_msr)(unsigned int msr, u64 val);
94
95 u64 (fastcall *read_tsc)(void);
96 u64 (fastcall *read_pmc)(void);
97
98 void (fastcall *load_tr_desc)(void);
99 void (fastcall *load_gdt)(const struct Xgt_desc_struct *);
100 void (fastcall *load_idt)(const struct Xgt_desc_struct *);
101 void (fastcall *store_gdt)(struct Xgt_desc_struct *);
102 void (fastcall *store_idt)(struct Xgt_desc_struct *);
103 void (fastcall *set_ldt)(const void *desc, unsigned entries);
104 unsigned long (fastcall *store_tr)(void);
105 void (fastcall *load_tls)(struct thread_struct *t, unsigned int cpu);
106 void (fastcall *write_ldt_entry)(void *dt, int entrynum,
107 u32 low, u32 high);
108 void (fastcall *write_gdt_entry)(void *dt, int entrynum,
109 u32 low, u32 high);
110 void (fastcall *write_idt_entry)(void *dt, int entrynum,
111 u32 low, u32 high);
112 void (fastcall *load_esp0)(struct tss_struct *tss,
113 struct thread_struct *thread);
114
115 void (fastcall *set_iopl_mask)(unsigned mask);
116
117 void (fastcall *io_delay)(void);
118 void (*const_udelay)(unsigned long loops);
119
120#ifdef CONFIG_X86_LOCAL_APIC
121 void (fastcall *apic_write)(unsigned long reg, unsigned long v);
122 void (fastcall *apic_write_atomic)(unsigned long reg, unsigned long v);
123 unsigned long (fastcall *apic_read)(unsigned long reg);
124#endif
125
126 void (fastcall *flush_tlb_user)(void);
127 void (fastcall *flush_tlb_kernel)(void);
128 void (fastcall *flush_tlb_single)(u32 addr);
129
130 void (fastcall *set_pte)(pte_t *ptep, pte_t pteval);
131 void (fastcall *set_pte_at)(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval);
132 void (fastcall *set_pmd)(pmd_t *pmdp, pmd_t pmdval);
133 void (fastcall *pte_update)(struct mm_struct *mm, u32 addr, pte_t *ptep);
134 void (fastcall *pte_update_defer)(struct mm_struct *mm, u32 addr, pte_t *ptep);
135#ifdef CONFIG_X86_PAE
136 void (fastcall *set_pte_atomic)(pte_t *ptep, pte_t pteval);
137 void (fastcall *set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte);
138 void (fastcall *set_pud)(pud_t *pudp, pud_t pudval);
139 void (fastcall *pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
140 void (fastcall *pmd_clear)(pmd_t *pmdp);
141#endif
142
143 /* These two are jmp to, not actually called. */
144 void (fastcall *irq_enable_sysexit)(void);
145 void (fastcall *iret)(void);
146};
147
148/* Mark a paravirt probe function. */
149#define paravirt_probe(fn) \
150 static asmlinkage void (*__paravirtprobe_##fn)(void) __attribute_used__ \
151 __attribute__((__section__(".paravirtprobe"))) = fn
152
153extern struct paravirt_ops paravirt_ops;
154
155#define paravirt_enabled() (paravirt_ops.paravirt_enabled)
156
157static inline void load_esp0(struct tss_struct *tss,
158 struct thread_struct *thread)
159{
160 paravirt_ops.load_esp0(tss, thread);
161}
162
163#define ARCH_SETUP paravirt_ops.arch_setup();
164static inline unsigned long get_wallclock(void)
165{
166 return paravirt_ops.get_wallclock();
167}
168
169static inline int set_wallclock(unsigned long nowtime)
170{
171 return paravirt_ops.set_wallclock(nowtime);
172}
173
174static inline void do_time_init(void)
175{
176 return paravirt_ops.time_init();
177}
178
179/* The paravirtualized CPUID instruction. */
180static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
181 unsigned int *ecx, unsigned int *edx)
182{
183 paravirt_ops.cpuid(eax, ebx, ecx, edx);
184}
185
186/*
187 * These special macros can be used to get or set a debugging register
188 */
189#define get_debugreg(var, reg) var = paravirt_ops.get_debugreg(reg)
190#define set_debugreg(val, reg) paravirt_ops.set_debugreg(reg, val)
191
192#define clts() paravirt_ops.clts()
193
194#define read_cr0() paravirt_ops.read_cr0()
195#define write_cr0(x) paravirt_ops.write_cr0(x)
196
197#define read_cr2() paravirt_ops.read_cr2()
198#define write_cr2(x) paravirt_ops.write_cr2(x)
199
200#define read_cr3() paravirt_ops.read_cr3()
201#define write_cr3(x) paravirt_ops.write_cr3(x)
202
203#define read_cr4() paravirt_ops.read_cr4()
204#define read_cr4_safe(x) paravirt_ops.read_cr4_safe()
205#define write_cr4(x) paravirt_ops.write_cr4(x)
206
207static inline void raw_safe_halt(void)
208{
209 paravirt_ops.safe_halt();
210}
211
212static inline void halt(void)
213{
214 paravirt_ops.safe_halt();
215}
216#define wbinvd() paravirt_ops.wbinvd()
217
218#define get_kernel_rpl() (paravirt_ops.kernel_rpl)
219
220#define rdmsr(msr,val1,val2) do { \
221 int _err; \
222 u64 _l = paravirt_ops.read_msr(msr,&_err); \
223 val1 = (u32)_l; \
224 val2 = _l >> 32; \
225} while(0)
226
227#define wrmsr(msr,val1,val2) do { \
228 u64 _l = ((u64)(val2) << 32) | (val1); \
229 paravirt_ops.write_msr((msr), _l); \
230} while(0)
231
232#define rdmsrl(msr,val) do { \
233 int _err; \
234 val = paravirt_ops.read_msr((msr),&_err); \
235} while(0)
236
237#define wrmsrl(msr,val) (paravirt_ops.write_msr((msr),(val)))
238#define wrmsr_safe(msr,a,b) ({ \
239 u64 _l = ((u64)(b) << 32) | (a); \
240 paravirt_ops.write_msr((msr),_l); \
241})
242
243/* rdmsr with exception handling */
244#define rdmsr_safe(msr,a,b) ({ \
245 int _err; \
246 u64 _l = paravirt_ops.read_msr(msr,&_err); \
247 (*a) = (u32)_l; \
248 (*b) = _l >> 32; \
249 _err; })
250
251#define rdtsc(low,high) do { \
252 u64 _l = paravirt_ops.read_tsc(); \
253 low = (u32)_l; \
254 high = _l >> 32; \
255} while(0)
256
257#define rdtscl(low) do { \
258 u64 _l = paravirt_ops.read_tsc(); \
259 low = (int)_l; \
260} while(0)
261
262#define rdtscll(val) (val = paravirt_ops.read_tsc())
263
264#define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
265
266#define rdpmc(counter,low,high) do { \
267 u64 _l = paravirt_ops.read_pmc(); \
268 low = (u32)_l; \
269 high = _l >> 32; \
270} while(0)
271
272#define load_TR_desc() (paravirt_ops.load_tr_desc())
273#define load_gdt(dtr) (paravirt_ops.load_gdt(dtr))
274#define load_idt(dtr) (paravirt_ops.load_idt(dtr))
275#define set_ldt(addr, entries) (paravirt_ops.set_ldt((addr), (entries)))
276#define store_gdt(dtr) (paravirt_ops.store_gdt(dtr))
277#define store_idt(dtr) (paravirt_ops.store_idt(dtr))
278#define store_tr(tr) ((tr) = paravirt_ops.store_tr())
279#define load_TLS(t,cpu) (paravirt_ops.load_tls((t),(cpu)))
280#define write_ldt_entry(dt, entry, low, high) \
281 (paravirt_ops.write_ldt_entry((dt), (entry), (low), (high)))
282#define write_gdt_entry(dt, entry, low, high) \
283 (paravirt_ops.write_gdt_entry((dt), (entry), (low), (high)))
284#define write_idt_entry(dt, entry, low, high) \
285 (paravirt_ops.write_idt_entry((dt), (entry), (low), (high)))
286#define set_iopl_mask(mask) (paravirt_ops.set_iopl_mask(mask))
287
288/* The paravirtualized I/O functions */
289static inline void slow_down_io(void) {
290 paravirt_ops.io_delay();
291#ifdef REALLY_SLOW_IO
292 paravirt_ops.io_delay();
293 paravirt_ops.io_delay();
294 paravirt_ops.io_delay();
295#endif
296}
297
298#ifdef CONFIG_X86_LOCAL_APIC
299/*
300 * Basic functions accessing APICs.
301 */
302static inline void apic_write(unsigned long reg, unsigned long v)
303{
304 paravirt_ops.apic_write(reg,v);
305}
306
307static inline void apic_write_atomic(unsigned long reg, unsigned long v)
308{
309 paravirt_ops.apic_write_atomic(reg,v);
310}
311
312static inline unsigned long apic_read(unsigned long reg)
313{
314 return paravirt_ops.apic_read(reg);
315}
316#endif
317
318
319#define __flush_tlb() paravirt_ops.flush_tlb_user()
320#define __flush_tlb_global() paravirt_ops.flush_tlb_kernel()
321#define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr)
322
323static inline void set_pte(pte_t *ptep, pte_t pteval)
324{
325 paravirt_ops.set_pte(ptep, pteval);
326}
327
328static inline void set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval)
329{
330 paravirt_ops.set_pte_at(mm, addr, ptep, pteval);
331}
332
333static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval)
334{
335 paravirt_ops.set_pmd(pmdp, pmdval);
336}
337
338static inline void pte_update(struct mm_struct *mm, u32 addr, pte_t *ptep)
339{
340 paravirt_ops.pte_update(mm, addr, ptep);
341}
342
343static inline void pte_update_defer(struct mm_struct *mm, u32 addr, pte_t *ptep)
344{
345 paravirt_ops.pte_update_defer(mm, addr, ptep);
346}
347
348#ifdef CONFIG_X86_PAE
349static inline void set_pte_atomic(pte_t *ptep, pte_t pteval)
350{
351 paravirt_ops.set_pte_atomic(ptep, pteval);
352}
353
354static inline void set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte)
355{
356 paravirt_ops.set_pte_present(mm, addr, ptep, pte);
357}
358
359static inline void set_pud(pud_t *pudp, pud_t pudval)
360{
361 paravirt_ops.set_pud(pudp, pudval);
362}
363
364static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
365{
366 paravirt_ops.pte_clear(mm, addr, ptep);
367}
368
369static inline void pmd_clear(pmd_t *pmdp)
370{
371 paravirt_ops.pmd_clear(pmdp);
372}
373#endif
374
375/* These all sit in the .parainstructions section to tell us what to patch. */
376struct paravirt_patch {
377 u8 *instr; /* original instructions */
378 u8 instrtype; /* type of this instruction */
379 u8 len; /* length of original instruction */
380 u16 clobbers; /* what registers you may clobber */
381};
382
383#define paravirt_alt(insn_string, typenum, clobber) \
384 "771:\n\t" insn_string "\n" "772:\n" \
385 ".pushsection .parainstructions,\"a\"\n" \
386 " .long 771b\n" \
387 " .byte " __stringify(typenum) "\n" \
388 " .byte 772b-771b\n" \
389 " .short " __stringify(clobber) "\n" \
390 ".popsection"
391
392static inline unsigned long __raw_local_save_flags(void)
393{
394 unsigned long f;
395
396 __asm__ __volatile__(paravirt_alt( "pushl %%ecx; pushl %%edx;"
397 "call *%1;"
398 "popl %%edx; popl %%ecx",
399 PARAVIRT_SAVE_FLAGS, CLBR_NONE)
400 : "=a"(f): "m"(paravirt_ops.save_fl)
401 : "memory", "cc");
402 return f;
403}
404
405static inline void raw_local_irq_restore(unsigned long f)
406{
407 __asm__ __volatile__(paravirt_alt( "pushl %%ecx; pushl %%edx;"
408 "call *%1;"
409 "popl %%edx; popl %%ecx",
410 PARAVIRT_RESTORE_FLAGS, CLBR_EAX)
411 : "=a"(f) : "m" (paravirt_ops.restore_fl), "0"(f)
412 : "memory", "cc");
413}
414
415static inline void raw_local_irq_disable(void)
416{
417 __asm__ __volatile__(paravirt_alt( "pushl %%ecx; pushl %%edx;"
418 "call *%0;"
419 "popl %%edx; popl %%ecx",
420 PARAVIRT_IRQ_DISABLE, CLBR_EAX)
421 : : "m" (paravirt_ops.irq_disable)
422 : "memory", "eax", "cc");
423}
424
425static inline void raw_local_irq_enable(void)
426{
427 __asm__ __volatile__(paravirt_alt( "pushl %%ecx; pushl %%edx;"
428 "call *%0;"
429 "popl %%edx; popl %%ecx",
430 PARAVIRT_IRQ_ENABLE, CLBR_EAX)
431 : : "m" (paravirt_ops.irq_enable)
432 : "memory", "eax", "cc");
433}
434
435static inline unsigned long __raw_local_irq_save(void)
436{
437 unsigned long f;
438
439 __asm__ __volatile__(paravirt_alt( "pushl %%ecx; pushl %%edx;"
440 "call *%1; pushl %%eax;"
441 "call *%2; popl %%eax;"
442 "popl %%edx; popl %%ecx",
443 PARAVIRT_SAVE_FLAGS_IRQ_DISABLE,
444 CLBR_NONE)
445 : "=a"(f)
446 : "m" (paravirt_ops.save_fl),
447 "m" (paravirt_ops.irq_disable)
448 : "memory", "cc");
449 return f;
450}
451
452#define CLI_STRING paravirt_alt("pushl %%ecx; pushl %%edx;" \
453 "call *paravirt_ops+%c[irq_disable];" \
454 "popl %%edx; popl %%ecx", \
455 PARAVIRT_IRQ_DISABLE, CLBR_EAX)
456
457#define STI_STRING paravirt_alt("pushl %%ecx; pushl %%edx;" \
458 "call *paravirt_ops+%c[irq_enable];" \
459 "popl %%edx; popl %%ecx", \
460 PARAVIRT_IRQ_ENABLE, CLBR_EAX)
461#define CLI_STI_CLOBBERS , "%eax"
462#define CLI_STI_INPUT_ARGS \
463 , \
464 [irq_disable] "i" (offsetof(struct paravirt_ops, irq_disable)), \
465 [irq_enable] "i" (offsetof(struct paravirt_ops, irq_enable))
466
467#else /* __ASSEMBLY__ */
468
469#define PARA_PATCH(ptype, clobbers, ops) \
470771:; \
471 ops; \
472772:; \
473 .pushsection .parainstructions,"a"; \
474 .long 771b; \
475 .byte ptype; \
476 .byte 772b-771b; \
477 .short clobbers; \
478 .popsection
479
480#define INTERRUPT_RETURN \
481 PARA_PATCH(PARAVIRT_INTERRUPT_RETURN, CLBR_ANY, \
482 jmp *%cs:paravirt_ops+PARAVIRT_iret)
483
484#define DISABLE_INTERRUPTS(clobbers) \
485 PARA_PATCH(PARAVIRT_IRQ_DISABLE, clobbers, \
486 pushl %ecx; pushl %edx; \
487 call *paravirt_ops+PARAVIRT_irq_disable; \
488 popl %edx; popl %ecx) \
489
490#define ENABLE_INTERRUPTS(clobbers) \
491 PARA_PATCH(PARAVIRT_IRQ_ENABLE, clobbers, \
492 pushl %ecx; pushl %edx; \
493 call *%cs:paravirt_ops+PARAVIRT_irq_enable; \
494 popl %edx; popl %ecx)
495
496#define ENABLE_INTERRUPTS_SYSEXIT \
497 PARA_PATCH(PARAVIRT_STI_SYSEXIT, CLBR_ANY, \
498 jmp *%cs:paravirt_ops+PARAVIRT_irq_enable_sysexit)
499
500#define GET_CR0_INTO_EAX \
501 call *paravirt_ops+PARAVIRT_read_cr0
502
503#endif /* __ASSEMBLY__ */
504#endif /* CONFIG_PARAVIRT */
505#endif /* __ASM_PARAVIRT_H */
diff --git a/include/asm-i386/pda.h b/include/asm-i386/pda.h
new file mode 100644
index 000000000000..2ba2736aa109
--- /dev/null
+++ b/include/asm-i386/pda.h
@@ -0,0 +1,100 @@
1/*
2 Per-processor Data Areas
3 Jeremy Fitzhardinge <jeremy@goop.org> 2006
4 Based on asm-x86_64/pda.h by Andi Kleen.
5 */
6#ifndef _I386_PDA_H
7#define _I386_PDA_H
8
9#include <linux/stddef.h>
10#include <linux/types.h>
11
12struct i386_pda
13{
14 struct i386_pda *_pda; /* pointer to self */
15
16 int cpu_number;
17 struct task_struct *pcurrent; /* current process */
18 struct pt_regs *irq_regs;
19};
20
21extern struct i386_pda *_cpu_pda[];
22
23#define cpu_pda(i) (_cpu_pda[i])
24
25#define pda_offset(field) offsetof(struct i386_pda, field)
26
27extern void __bad_pda_field(void);
28
29/* This variable is never instantiated. It is only used as a stand-in
30 for the real per-cpu PDA memory, so that gcc can understand what
31 memory operations the inline asms() below are performing. This
32 eliminates the need to make the asms volatile or have memory
33 clobbers, so gcc can readily analyse them. */
34extern struct i386_pda _proxy_pda;
35
36#define pda_to_op(op,field,val) \
37 do { \
38 typedef typeof(_proxy_pda.field) T__; \
39 if (0) { T__ tmp__; tmp__ = (val); } \
40 switch (sizeof(_proxy_pda.field)) { \
41 case 1: \
42 asm(op "b %1,%%gs:%c2" \
43 : "+m" (_proxy_pda.field) \
44 :"ri" ((T__)val), \
45 "i"(pda_offset(field))); \
46 break; \
47 case 2: \
48 asm(op "w %1,%%gs:%c2" \
49 : "+m" (_proxy_pda.field) \
50 :"ri" ((T__)val), \
51 "i"(pda_offset(field))); \
52 break; \
53 case 4: \
54 asm(op "l %1,%%gs:%c2" \
55 : "+m" (_proxy_pda.field) \
56 :"ri" ((T__)val), \
57 "i"(pda_offset(field))); \
58 break; \
59 default: __bad_pda_field(); \
60 } \
61 } while (0)
62
63#define pda_from_op(op,field) \
64 ({ \
65 typeof(_proxy_pda.field) ret__; \
66 switch (sizeof(_proxy_pda.field)) { \
67 case 1: \
68 asm(op "b %%gs:%c1,%0" \
69 : "=r" (ret__) \
70 : "i" (pda_offset(field)), \
71 "m" (_proxy_pda.field)); \
72 break; \
73 case 2: \
74 asm(op "w %%gs:%c1,%0" \
75 : "=r" (ret__) \
76 : "i" (pda_offset(field)), \
77 "m" (_proxy_pda.field)); \
78 break; \
79 case 4: \
80 asm(op "l %%gs:%c1,%0" \
81 : "=r" (ret__) \
82 : "i" (pda_offset(field)), \
83 "m" (_proxy_pda.field)); \
84 break; \
85 default: __bad_pda_field(); \
86 } \
87 ret__; })
88
89/* Return a pointer to a pda field */
90#define pda_addr(field) \
91 ((typeof(_proxy_pda.field) *)((unsigned char *)read_pda(_pda) + \
92 pda_offset(field)))
93
94#define read_pda(field) pda_from_op("mov",field)
95#define write_pda(field,val) pda_to_op("mov",field,val)
96#define add_pda(field,val) pda_to_op("add",field,val)
97#define sub_pda(field,val) pda_to_op("sub",field,val)
98#define or_pda(field,val) pda_to_op("or",field,val)
99
100#endif /* _I386_PDA_H */
diff --git a/include/asm-i386/percpu.h b/include/asm-i386/percpu.h
index 5764afa4b6a4..510ae1d3486c 100644
--- a/include/asm-i386/percpu.h
+++ b/include/asm-i386/percpu.h
@@ -1,6 +1,31 @@
1#ifndef __ARCH_I386_PERCPU__ 1#ifndef __ARCH_I386_PERCPU__
2#define __ARCH_I386_PERCPU__ 2#define __ARCH_I386_PERCPU__
3 3
4#ifndef __ASSEMBLY__
4#include <asm-generic/percpu.h> 5#include <asm-generic/percpu.h>
6#else
7
8/*
9 * PER_CPU finds an address of a per-cpu variable.
10 *
11 * Args:
12 * var - variable name
13 * cpu - 32bit register containing the current CPU number
14 *
15 * The resulting address is stored in the "cpu" argument.
16 *
17 * Example:
18 * PER_CPU(cpu_gdt_descr, %ebx)
19 */
20#ifdef CONFIG_SMP
21#define PER_CPU(var, cpu) \
22 movl __per_cpu_offset(,cpu,4), cpu; \
23 addl $per_cpu__/**/var, cpu;
24#else /* ! SMP */
25#define PER_CPU(var, cpu) \
26 movl $per_cpu__/**/var, cpu;
27#endif /* SMP */
28
29#endif /* !__ASSEMBLY__ */
5 30
6#endif /* __ARCH_I386_PERCPU__ */ 31#endif /* __ARCH_I386_PERCPU__ */
diff --git a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h
index 8d8d3b9ecdb0..38c3fcc0676d 100644
--- a/include/asm-i386/pgtable-2level.h
+++ b/include/asm-i386/pgtable-2level.h
@@ -1,8 +1,6 @@
1#ifndef _I386_PGTABLE_2LEVEL_H 1#ifndef _I386_PGTABLE_2LEVEL_H
2#define _I386_PGTABLE_2LEVEL_H 2#define _I386_PGTABLE_2LEVEL_H
3 3
4#include <asm-generic/pgtable-nopmd.h>
5
6#define pte_ERROR(e) \ 4#define pte_ERROR(e) \
7 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low) 5 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low)
8#define pgd_ERROR(e) \ 6#define pgd_ERROR(e) \
@@ -13,17 +11,19 @@
13 * within a page table are directly modified. Thus, the following 11 * within a page table are directly modified. Thus, the following
14 * hook is made available. 12 * hook is made available.
15 */ 13 */
14#ifndef CONFIG_PARAVIRT
16#define set_pte(pteptr, pteval) (*(pteptr) = pteval) 15#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
17#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 16#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
17#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
18#endif
19
18#define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval) 20#define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval)
19#define set_pte_present(mm,addr,ptep,pteval) set_pte_at(mm,addr,ptep,pteval) 21#define set_pte_present(mm,addr,ptep,pteval) set_pte_at(mm,addr,ptep,pteval)
20#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
21 22
22#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) 23#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
23#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) 24#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
24 25
25#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 26#define raw_ptep_get_and_clear(xp) __pte(xchg(&(xp)->pte_low, 0))
26#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte_low, 0))
27 27
28#define pte_page(x) pfn_to_page(pte_pfn(x)) 28#define pte_page(x) pfn_to_page(pte_pfn(x))
29#define pte_none(x) (!(x).pte_low) 29#define pte_none(x) (!(x).pte_low)
diff --git a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h
index c2d701ea35be..7a2318f38303 100644
--- a/include/asm-i386/pgtable-3level.h
+++ b/include/asm-i386/pgtable-3level.h
@@ -1,8 +1,6 @@
1#ifndef _I386_PGTABLE_3LEVEL_H 1#ifndef _I386_PGTABLE_3LEVEL_H
2#define _I386_PGTABLE_3LEVEL_H 2#define _I386_PGTABLE_3LEVEL_H
3 3
4#include <asm-generic/pgtable-nopud.h>
5
6/* 4/*
7 * Intel Physical Address Extension (PAE) Mode - three-level page 5 * Intel Physical Address Extension (PAE) Mode - three-level page
8 * tables on PPro+ CPUs. 6 * tables on PPro+ CPUs.
@@ -44,6 +42,7 @@ static inline int pte_exec_kernel(pte_t pte)
44 return pte_x(pte); 42 return pte_x(pte);
45} 43}
46 44
45#ifndef CONFIG_PARAVIRT
47/* Rules for using set_pte: the pte being assigned *must* be 46/* Rules for using set_pte: the pte being assigned *must* be
48 * either not present or in a state where the hardware will 47 * either not present or in a state where the hardware will
49 * not attempt to update the pte. In places where this is 48 * not attempt to update the pte. In places where this is
@@ -81,25 +80,6 @@ static inline void set_pte_present(struct mm_struct *mm, unsigned long addr, pte
81 (*(pudptr) = (pudval)) 80 (*(pudptr) = (pudval))
82 81
83/* 82/*
84 * Pentium-II erratum A13: in PAE mode we explicitly have to flush
85 * the TLB via cr3 if the top-level pgd is changed...
86 * We do not let the generic code free and clear pgd entries due to
87 * this erratum.
88 */
89static inline void pud_clear (pud_t * pud) { }
90
91#define pud_page(pud) \
92((struct page *) __va(pud_val(pud) & PAGE_MASK))
93
94#define pud_page_vaddr(pud) \
95((unsigned long) __va(pud_val(pud) & PAGE_MASK))
96
97
98/* Find an entry in the second-level page table.. */
99#define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \
100 pmd_index(address))
101
102/*
103 * For PTEs and PDEs, we must clear the P-bit first when clearing a page table 83 * For PTEs and PDEs, we must clear the P-bit first when clearing a page table
104 * entry, so clear the bottom half first and enforce ordering with a compiler 84 * entry, so clear the bottom half first and enforce ordering with a compiler
105 * barrier. 85 * barrier.
@@ -118,9 +98,28 @@ static inline void pmd_clear(pmd_t *pmd)
118 smp_wmb(); 98 smp_wmb();
119 *(tmp + 1) = 0; 99 *(tmp + 1) = 0;
120} 100}
101#endif
102
103/*
104 * Pentium-II erratum A13: in PAE mode we explicitly have to flush
105 * the TLB via cr3 if the top-level pgd is changed...
106 * We do not let the generic code free and clear pgd entries due to
107 * this erratum.
108 */
109static inline void pud_clear (pud_t * pud) { }
110
111#define pud_page(pud) \
112((struct page *) __va(pud_val(pud) & PAGE_MASK))
113
114#define pud_page_vaddr(pud) \
115((unsigned long) __va(pud_val(pud) & PAGE_MASK))
116
117
118/* Find an entry in the second-level page table.. */
119#define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \
120 pmd_index(address))
121 121
122#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 122static inline pte_t raw_ptep_get_and_clear(pte_t *ptep)
123static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
124{ 123{
125 pte_t res; 124 pte_t res;
126 125
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index 7d398f493dde..e6a4723f0eb1 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -15,6 +15,7 @@
15#include <asm/processor.h> 15#include <asm/processor.h>
16#include <asm/fixmap.h> 16#include <asm/fixmap.h>
17#include <linux/threads.h> 17#include <linux/threads.h>
18#include <asm/paravirt.h>
18 19
19#ifndef _I386_BITOPS_H 20#ifndef _I386_BITOPS_H
20#include <asm/bitops.h> 21#include <asm/bitops.h>
@@ -34,14 +35,14 @@ struct vm_area_struct;
34#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) 35#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
35extern unsigned long empty_zero_page[1024]; 36extern unsigned long empty_zero_page[1024];
36extern pgd_t swapper_pg_dir[1024]; 37extern pgd_t swapper_pg_dir[1024];
37extern kmem_cache_t *pgd_cache; 38extern struct kmem_cache *pgd_cache;
38extern kmem_cache_t *pmd_cache; 39extern struct kmem_cache *pmd_cache;
39extern spinlock_t pgd_lock; 40extern spinlock_t pgd_lock;
40extern struct page *pgd_list; 41extern struct page *pgd_list;
41 42
42void pmd_ctor(void *, kmem_cache_t *, unsigned long); 43void pmd_ctor(void *, struct kmem_cache *, unsigned long);
43void pgd_ctor(void *, kmem_cache_t *, unsigned long); 44void pgd_ctor(void *, struct kmem_cache *, unsigned long);
44void pgd_dtor(void *, kmem_cache_t *, unsigned long); 45void pgd_dtor(void *, struct kmem_cache *, unsigned long);
45void pgtable_cache_init(void); 46void pgtable_cache_init(void);
46void paging_init(void); 47void paging_init(void);
47 48
@@ -246,6 +247,7 @@ static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return p
246# include <asm/pgtable-2level.h> 247# include <asm/pgtable-2level.h>
247#endif 248#endif
248 249
250#ifndef CONFIG_PARAVIRT
249/* 251/*
250 * Rules for using pte_update - it must be called after any PTE update which 252 * Rules for using pte_update - it must be called after any PTE update which
251 * has not been done using the set_pte / clear_pte interfaces. It is used by 253 * has not been done using the set_pte / clear_pte interfaces. It is used by
@@ -261,7 +263,7 @@ static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return p
261 */ 263 */
262#define pte_update(mm, addr, ptep) do { } while (0) 264#define pte_update(mm, addr, ptep) do { } while (0)
263#define pte_update_defer(mm, addr, ptep) do { } while (0) 265#define pte_update_defer(mm, addr, ptep) do { } while (0)
264 266#endif
265 267
266/* 268/*
267 * We only update the dirty/accessed state if we set 269 * We only update the dirty/accessed state if we set
@@ -275,7 +277,7 @@ static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return p
275do { \ 277do { \
276 if (dirty) { \ 278 if (dirty) { \
277 (ptep)->pte_low = (entry).pte_low; \ 279 (ptep)->pte_low = (entry).pte_low; \
278 pte_update_defer((vma)->vm_mm, (addr), (ptep)); \ 280 pte_update_defer((vma)->vm_mm, (address), (ptep)); \
279 flush_tlb_page(vma, address); \ 281 flush_tlb_page(vma, address); \
280 } \ 282 } \
281} while (0) 283} while (0)
@@ -305,7 +307,7 @@ do { \
305 __dirty = pte_dirty(*(ptep)); \ 307 __dirty = pte_dirty(*(ptep)); \
306 if (__dirty) { \ 308 if (__dirty) { \
307 clear_bit(_PAGE_BIT_DIRTY, &(ptep)->pte_low); \ 309 clear_bit(_PAGE_BIT_DIRTY, &(ptep)->pte_low); \
308 pte_update_defer((vma)->vm_mm, (addr), (ptep)); \ 310 pte_update_defer((vma)->vm_mm, (address), (ptep)); \
309 flush_tlb_page(vma, address); \ 311 flush_tlb_page(vma, address); \
310 } \ 312 } \
311 __dirty; \ 313 __dirty; \
@@ -318,12 +320,20 @@ do { \
318 __young = pte_young(*(ptep)); \ 320 __young = pte_young(*(ptep)); \
319 if (__young) { \ 321 if (__young) { \
320 clear_bit(_PAGE_BIT_ACCESSED, &(ptep)->pte_low); \ 322 clear_bit(_PAGE_BIT_ACCESSED, &(ptep)->pte_low); \
321 pte_update_defer((vma)->vm_mm, (addr), (ptep)); \ 323 pte_update_defer((vma)->vm_mm, (address), (ptep)); \
322 flush_tlb_page(vma, address); \ 324 flush_tlb_page(vma, address); \
323 } \ 325 } \
324 __young; \ 326 __young; \
325}) 327})
326 328
329#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
330static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
331{
332 pte_t pte = raw_ptep_get_and_clear(ptep);
333 pte_update(mm, addr, ptep);
334 return pte;
335}
336
327#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL 337#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
328static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) 338static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full)
329{ 339{
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index e0ddca94d50c..a52d65440429 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -20,6 +20,7 @@
20#include <linux/threads.h> 20#include <linux/threads.h>
21#include <asm/percpu.h> 21#include <asm/percpu.h>
22#include <linux/cpumask.h> 22#include <linux/cpumask.h>
23#include <linux/init.h>
23 24
24/* flag for disabling the tsc */ 25/* flag for disabling the tsc */
25extern int tsc_disable; 26extern int tsc_disable;
@@ -72,6 +73,7 @@ struct cpuinfo_x86 {
72#endif 73#endif
73 unsigned char x86_max_cores; /* cpuid returned max cores value */ 74 unsigned char x86_max_cores; /* cpuid returned max cores value */
74 unsigned char apicid; 75 unsigned char apicid;
76 unsigned short x86_clflush_size;
75#ifdef CONFIG_SMP 77#ifdef CONFIG_SMP
76 unsigned char booted_cores; /* number of cores as seen by OS */ 78 unsigned char booted_cores; /* number of cores as seen by OS */
77 __u8 phys_proc_id; /* Physical processor id. */ 79 __u8 phys_proc_id; /* Physical processor id. */
@@ -111,6 +113,8 @@ extern struct cpuinfo_x86 cpu_data[];
111extern int cpu_llc_id[NR_CPUS]; 113extern int cpu_llc_id[NR_CPUS];
112extern char ignore_fpu_irq; 114extern char ignore_fpu_irq;
113 115
116void __init cpu_detect(struct cpuinfo_x86 *c);
117
114extern void identify_cpu(struct cpuinfo_x86 *); 118extern void identify_cpu(struct cpuinfo_x86 *);
115extern void print_cpu_info(struct cpuinfo_x86 *); 119extern void print_cpu_info(struct cpuinfo_x86 *);
116extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c); 120extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
@@ -143,8 +147,8 @@ static inline void detect_ht(struct cpuinfo_x86 *c) {}
143#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ 147#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
144#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ 148#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
145 149
146static inline void __cpuid(unsigned int *eax, unsigned int *ebx, 150static inline fastcall void native_cpuid(unsigned int *eax, unsigned int *ebx,
147 unsigned int *ecx, unsigned int *edx) 151 unsigned int *ecx, unsigned int *edx)
148{ 152{
149 /* ecx is often an input as well as an output. */ 153 /* ecx is often an input as well as an output. */
150 __asm__("cpuid" 154 __asm__("cpuid"
@@ -155,59 +159,6 @@ static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
155 : "0" (*eax), "2" (*ecx)); 159 : "0" (*eax), "2" (*ecx));
156} 160}
157 161
158/*
159 * Generic CPUID function
160 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
161 * resulting in stale register contents being returned.
162 */
163static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx)
164{
165 *eax = op;
166 *ecx = 0;
167 __cpuid(eax, ebx, ecx, edx);
168}
169
170/* Some CPUID calls want 'count' to be placed in ecx */
171static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx,
172 int *edx)
173{
174 *eax = op;
175 *ecx = count;
176 __cpuid(eax, ebx, ecx, edx);
177}
178
179/*
180 * CPUID functions returning a single datum
181 */
182static inline unsigned int cpuid_eax(unsigned int op)
183{
184 unsigned int eax, ebx, ecx, edx;
185
186 cpuid(op, &eax, &ebx, &ecx, &edx);
187 return eax;
188}
189static inline unsigned int cpuid_ebx(unsigned int op)
190{
191 unsigned int eax, ebx, ecx, edx;
192
193 cpuid(op, &eax, &ebx, &ecx, &edx);
194 return ebx;
195}
196static inline unsigned int cpuid_ecx(unsigned int op)
197{
198 unsigned int eax, ebx, ecx, edx;
199
200 cpuid(op, &eax, &ebx, &ecx, &edx);
201 return ecx;
202}
203static inline unsigned int cpuid_edx(unsigned int op)
204{
205 unsigned int eax, ebx, ecx, edx;
206
207 cpuid(op, &eax, &ebx, &ecx, &edx);
208 return edx;
209}
210
211#define load_cr3(pgdir) write_cr3(__pa(pgdir)) 162#define load_cr3(pgdir) write_cr3(__pa(pgdir))
212 163
213/* 164/*
@@ -473,6 +424,7 @@ struct thread_struct {
473 .vm86_info = NULL, \ 424 .vm86_info = NULL, \
474 .sysenter_cs = __KERNEL_CS, \ 425 .sysenter_cs = __KERNEL_CS, \
475 .io_bitmap_ptr = NULL, \ 426 .io_bitmap_ptr = NULL, \
427 .gs = __KERNEL_PDA, \
476} 428}
477 429
478/* 430/*
@@ -489,18 +441,9 @@ struct thread_struct {
489 .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \ 441 .io_bitmap = { [ 0 ... IO_BITMAP_LONGS] = ~0 }, \
490} 442}
491 443
492static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread)
493{
494 tss->esp0 = thread->esp0;
495 /* This can only happen when SEP is enabled, no need to test "SEP"arately */
496 if (unlikely(tss->ss1 != thread->sysenter_cs)) {
497 tss->ss1 = thread->sysenter_cs;
498 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
499 }
500}
501
502#define start_thread(regs, new_eip, new_esp) do { \ 444#define start_thread(regs, new_eip, new_esp) do { \
503 __asm__("movl %0,%%fs ; movl %0,%%gs": :"r" (0)); \ 445 __asm__("movl %0,%%fs": :"r" (0)); \
446 regs->xgs = 0; \
504 set_fs(USER_DS); \ 447 set_fs(USER_DS); \
505 regs->xds = __USER_DS; \ 448 regs->xds = __USER_DS; \
506 regs->xes = __USER_DS; \ 449 regs->xes = __USER_DS; \
@@ -510,33 +453,6 @@ static inline void load_esp0(struct tss_struct *tss, struct thread_struct *threa
510 regs->esp = new_esp; \ 453 regs->esp = new_esp; \
511} while (0) 454} while (0)
512 455
513/*
514 * These special macros can be used to get or set a debugging register
515 */
516#define get_debugreg(var, register) \
517 __asm__("movl %%db" #register ", %0" \
518 :"=r" (var))
519#define set_debugreg(value, register) \
520 __asm__("movl %0,%%db" #register \
521 : /* no output */ \
522 :"r" (value))
523
524/*
525 * Set IOPL bits in EFLAGS from given mask
526 */
527static inline void set_iopl_mask(unsigned mask)
528{
529 unsigned int reg;
530 __asm__ __volatile__ ("pushfl;"
531 "popl %0;"
532 "andl %1, %0;"
533 "orl %2, %0;"
534 "pushl %0;"
535 "popfl"
536 : "=&r" (reg)
537 : "i" (~X86_EFLAGS_IOPL), "r" (mask));
538}
539
540/* Forward declaration, a strange C thing */ 456/* Forward declaration, a strange C thing */
541struct task_struct; 457struct task_struct;
542struct mm_struct; 458struct mm_struct;
@@ -628,6 +544,105 @@ static inline void rep_nop(void)
628 544
629#define cpu_relax() rep_nop() 545#define cpu_relax() rep_nop()
630 546
547#ifdef CONFIG_PARAVIRT
548#include <asm/paravirt.h>
549#else
550#define paravirt_enabled() 0
551#define __cpuid native_cpuid
552
553static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread)
554{
555 tss->esp0 = thread->esp0;
556 /* This can only happen when SEP is enabled, no need to test "SEP"arately */
557 if (unlikely(tss->ss1 != thread->sysenter_cs)) {
558 tss->ss1 = thread->sysenter_cs;
559 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
560 }
561}
562
563/*
564 * These special macros can be used to get or set a debugging register
565 */
566#define get_debugreg(var, register) \
567 __asm__("movl %%db" #register ", %0" \
568 :"=r" (var))
569#define set_debugreg(value, register) \
570 __asm__("movl %0,%%db" #register \
571 : /* no output */ \
572 :"r" (value))
573
574#define set_iopl_mask native_set_iopl_mask
575#endif /* CONFIG_PARAVIRT */
576
577/*
578 * Set IOPL bits in EFLAGS from given mask
579 */
580static fastcall inline void native_set_iopl_mask(unsigned mask)
581{
582 unsigned int reg;
583 __asm__ __volatile__ ("pushfl;"
584 "popl %0;"
585 "andl %1, %0;"
586 "orl %2, %0;"
587 "pushl %0;"
588 "popfl"
589 : "=&r" (reg)
590 : "i" (~X86_EFLAGS_IOPL), "r" (mask));
591}
592
593/*
594 * Generic CPUID function
595 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
596 * resulting in stale register contents being returned.
597 */
598static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx)
599{
600 *eax = op;
601 *ecx = 0;
602 __cpuid(eax, ebx, ecx, edx);
603}
604
605/* Some CPUID calls want 'count' to be placed in ecx */
606static inline void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx,
607 int *edx)
608{
609 *eax = op;
610 *ecx = count;
611 __cpuid(eax, ebx, ecx, edx);
612}
613
614/*
615 * CPUID functions returning a single datum
616 */
617static inline unsigned int cpuid_eax(unsigned int op)
618{
619 unsigned int eax, ebx, ecx, edx;
620
621 cpuid(op, &eax, &ebx, &ecx, &edx);
622 return eax;
623}
624static inline unsigned int cpuid_ebx(unsigned int op)
625{
626 unsigned int eax, ebx, ecx, edx;
627
628 cpuid(op, &eax, &ebx, &ecx, &edx);
629 return ebx;
630}
631static inline unsigned int cpuid_ecx(unsigned int op)
632{
633 unsigned int eax, ebx, ecx, edx;
634
635 cpuid(op, &eax, &ebx, &ecx, &edx);
636 return ecx;
637}
638static inline unsigned int cpuid_edx(unsigned int op)
639{
640 unsigned int eax, ebx, ecx, edx;
641
642 cpuid(op, &eax, &ebx, &ecx, &edx);
643 return edx;
644}
645
631/* generic versions from gas */ 646/* generic versions from gas */
632#define GENERIC_NOP1 ".byte 0x90\n" 647#define GENERIC_NOP1 ".byte 0x90\n"
633#define GENERIC_NOP2 ".byte 0x89,0xf6\n" 648#define GENERIC_NOP2 ".byte 0x89,0xf6\n"
@@ -727,4 +742,7 @@ extern unsigned long boot_option_idle_override;
727extern void enable_sep_cpu(void); 742extern void enable_sep_cpu(void);
728extern int sysenter_setup(void); 743extern int sysenter_setup(void);
729 744
745extern int init_gdt(int cpu, struct task_struct *idle);
746extern void secondary_cpu_init(void);
747
730#endif /* __ASM_I386_PROCESSOR_H */ 748#endif /* __ASM_I386_PROCESSOR_H */
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
index d505f501077a..bdbc894339b4 100644
--- a/include/asm-i386/ptrace.h
+++ b/include/asm-i386/ptrace.h
@@ -16,6 +16,8 @@ struct pt_regs {
16 long eax; 16 long eax;
17 int xds; 17 int xds;
18 int xes; 18 int xes;
19 /* int xfs; */
20 int xgs;
19 long orig_eax; 21 long orig_eax;
20 long eip; 22 long eip;
21 int xcs; 23 int xcs;
diff --git a/include/asm-i386/rwsem.h b/include/asm-i386/rwsem.h
index bc598d6388e3..041906f3c6df 100644
--- a/include/asm-i386/rwsem.h
+++ b/include/asm-i386/rwsem.h
@@ -75,8 +75,8 @@ struct rw_semaphore {
75 75
76 76
77#define __RWSEM_INITIALIZER(name) \ 77#define __RWSEM_INITIALIZER(name) \
78{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \ 78{ RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
79 __RWSEM_DEP_MAP_INIT(name) } 79 LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
80 80
81#define DECLARE_RWSEM(name) \ 81#define DECLARE_RWSEM(name) \
82 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 82 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h
index b7ab59685ba7..3c796af33776 100644
--- a/include/asm-i386/segment.h
+++ b/include/asm-i386/segment.h
@@ -39,7 +39,7 @@
39 * 25 - APM BIOS support 39 * 25 - APM BIOS support
40 * 40 *
41 * 26 - ESPFIX small SS 41 * 26 - ESPFIX small SS
42 * 27 - unused 42 * 27 - PDA [ per-cpu private data area ]
43 * 28 - unused 43 * 28 - unused
44 * 29 - unused 44 * 29 - unused
45 * 30 - unused 45 * 30 - unused
@@ -74,6 +74,9 @@
74#define GDT_ENTRY_ESPFIX_SS (GDT_ENTRY_KERNEL_BASE + 14) 74#define GDT_ENTRY_ESPFIX_SS (GDT_ENTRY_KERNEL_BASE + 14)
75#define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8) 75#define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8)
76 76
77#define GDT_ENTRY_PDA (GDT_ENTRY_KERNEL_BASE + 15)
78#define __KERNEL_PDA (GDT_ENTRY_PDA * 8)
79
77#define GDT_ENTRY_DOUBLEFAULT_TSS 31 80#define GDT_ENTRY_DOUBLEFAULT_TSS 31
78 81
79/* 82/*
@@ -128,5 +131,7 @@
128#define SEGMENT_LDT 0x4 131#define SEGMENT_LDT 0x4
129#define SEGMENT_GDT 0x0 132#define SEGMENT_GDT 0x0
130 133
134#ifndef CONFIG_PARAVIRT
131#define get_kernel_rpl() 0 135#define get_kernel_rpl() 0
132#endif 136#endif
137#endif
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h
index 2734909eff84..67659dbaf120 100644
--- a/include/asm-i386/setup.h
+++ b/include/asm-i386/setup.h
@@ -6,6 +6,8 @@
6#ifndef _i386_SETUP_H 6#ifndef _i386_SETUP_H
7#define _i386_SETUP_H 7#define _i386_SETUP_H
8 8
9#define COMMAND_LINE_SIZE 256
10
9#ifdef __KERNEL__ 11#ifdef __KERNEL__
10#include <linux/pfn.h> 12#include <linux/pfn.h>
11 13
@@ -14,10 +16,8 @@
14 */ 16 */
15#define MAXMEM_PFN PFN_DOWN(MAXMEM) 17#define MAXMEM_PFN PFN_DOWN(MAXMEM)
16#define MAX_NONPAE_PFN (1 << 20) 18#define MAX_NONPAE_PFN (1 << 20)
17#endif
18 19
19#define PARAM_SIZE 4096 20#define PARAM_SIZE 4096
20#define COMMAND_LINE_SIZE 256
21 21
22#define OLD_CL_MAGIC_ADDR 0x90020 22#define OLD_CL_MAGIC_ADDR 0x90020
23#define OLD_CL_MAGIC 0xA33F 23#define OLD_CL_MAGIC 0xA33F
@@ -70,6 +70,7 @@ extern unsigned char boot_params[PARAM_SIZE];
70struct e820entry; 70struct e820entry;
71 71
72char * __init machine_specific_memory_setup(void); 72char * __init machine_specific_memory_setup(void);
73char *memory_setup(void);
73 74
74int __init copy_e820_map(struct e820entry * biosmap, int nr_map); 75int __init copy_e820_map(struct e820entry * biosmap, int nr_map);
75int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map); 76int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map);
@@ -78,4 +79,6 @@ void __init add_memory_region(unsigned long long start,
78 79
79#endif /* __ASSEMBLY__ */ 80#endif /* __ASSEMBLY__ */
80 81
82#endif /* __KERNEL__ */
83
81#endif /* _i386_SETUP_H */ 84#endif /* _i386_SETUP_H */
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index bd59c1508e71..64fe624c02ca 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -8,6 +8,7 @@
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/threads.h> 9#include <linux/threads.h>
10#include <linux/cpumask.h> 10#include <linux/cpumask.h>
11#include <asm/pda.h>
11#endif 12#endif
12 13
13#ifdef CONFIG_X86_LOCAL_APIC 14#ifdef CONFIG_X86_LOCAL_APIC
@@ -56,7 +57,7 @@ extern void cpu_uninit(void);
56 * from the initial startup. We map APIC_BASE very early in page_setup(), 57 * from the initial startup. We map APIC_BASE very early in page_setup(),
57 * so this is correct in the x86 case. 58 * so this is correct in the x86 case.
58 */ 59 */
59#define raw_smp_processor_id() (current_thread_info()->cpu) 60#define raw_smp_processor_id() (read_pda(cpu_number))
60 61
61extern cpumask_t cpu_callout_map; 62extern cpumask_t cpu_callout_map;
62extern cpumask_t cpu_callin_map; 63extern cpumask_t cpu_callin_map;
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
index c18b71fae6b3..d3bcebed60ca 100644
--- a/include/asm-i386/spinlock.h
+++ b/include/asm-i386/spinlock.h
@@ -7,8 +7,14 @@
7#include <asm/processor.h> 7#include <asm/processor.h>
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9 9
10#ifdef CONFIG_PARAVIRT
11#include <asm/paravirt.h>
12#else
10#define CLI_STRING "cli" 13#define CLI_STRING "cli"
11#define STI_STRING "sti" 14#define STI_STRING "sti"
15#define CLI_STI_CLOBBERS
16#define CLI_STI_INPUT_ARGS
17#endif /* CONFIG_PARAVIRT */
12 18
13/* 19/*
14 * Your basic SMP spinlocks, allowing only a single CPU anywhere 20 * Your basic SMP spinlocks, allowing only a single CPU anywhere
@@ -53,25 +59,28 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long fla
53{ 59{
54 asm volatile( 60 asm volatile(
55 "\n1:\t" 61 "\n1:\t"
56 LOCK_PREFIX " ; decb %0\n\t" 62 LOCK_PREFIX " ; decb %[slock]\n\t"
57 "jns 5f\n" 63 "jns 5f\n"
58 "2:\t" 64 "2:\t"
59 "testl $0x200, %1\n\t" 65 "testl $0x200, %[flags]\n\t"
60 "jz 4f\n\t" 66 "jz 4f\n\t"
61 STI_STRING "\n" 67 STI_STRING "\n"
62 "3:\t" 68 "3:\t"
63 "rep;nop\n\t" 69 "rep;nop\n\t"
64 "cmpb $0, %0\n\t" 70 "cmpb $0, %[slock]\n\t"
65 "jle 3b\n\t" 71 "jle 3b\n\t"
66 CLI_STRING "\n\t" 72 CLI_STRING "\n\t"
67 "jmp 1b\n" 73 "jmp 1b\n"
68 "4:\t" 74 "4:\t"
69 "rep;nop\n\t" 75 "rep;nop\n\t"
70 "cmpb $0, %0\n\t" 76 "cmpb $0, %[slock]\n\t"
71 "jg 1b\n\t" 77 "jg 1b\n\t"
72 "jmp 4b\n" 78 "jmp 4b\n"
73 "5:\n\t" 79 "5:\n\t"
74 : "+m" (lock->slock) : "r" (flags) : "memory"); 80 : [slock] "+m" (lock->slock)
81 : [flags] "r" (flags)
82 CLI_STI_INPUT_ARGS
83 : "memory" CLI_STI_CLOBBERS);
75} 84}
76#endif 85#endif
77 86
diff --git a/include/asm-i386/spinlock_types.h b/include/asm-i386/spinlock_types.h
index 59efe849f351..4da9345c1500 100644
--- a/include/asm-i386/spinlock_types.h
+++ b/include/asm-i386/spinlock_types.h
@@ -6,13 +6,13 @@
6#endif 6#endif
7 7
8typedef struct { 8typedef struct {
9 volatile unsigned int slock; 9 unsigned int slock;
10} raw_spinlock_t; 10} raw_spinlock_t;
11 11
12#define __RAW_SPIN_LOCK_UNLOCKED { 1 } 12#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
13 13
14typedef struct { 14typedef struct {
15 volatile unsigned int lock; 15 unsigned int lock;
16} raw_rwlock_t; 16} raw_rwlock_t;
17 17
18#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } 18#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
diff --git a/include/asm-i386/suspend.h b/include/asm-i386/suspend.h
index 08be1e5009d4..8dbaafe611ff 100644
--- a/include/asm-i386/suspend.h
+++ b/include/asm-i386/suspend.h
@@ -6,29 +6,14 @@
6#include <asm/desc.h> 6#include <asm/desc.h>
7#include <asm/i387.h> 7#include <asm/i387.h>
8 8
9static inline int 9static inline int arch_prepare_suspend(void) { return 0; }
10arch_prepare_suspend(void)
11{
12 /* If you want to make non-PSE machine work, turn off paging
13 in swsusp_arch_suspend. swsusp_pg_dir should have identity mapping, so
14 it could work... */
15 if (!cpu_has_pse) {
16 printk(KERN_ERR "PSE is required for swsusp.\n");
17 return -EPERM;
18 }
19 return 0;
20}
21 10
22/* image of the saved processor state */ 11/* image of the saved processor state */
23struct saved_context { 12struct saved_context {
24 u16 es, fs, gs, ss; 13 u16 es, fs, gs, ss;
25 unsigned long cr0, cr2, cr3, cr4; 14 unsigned long cr0, cr2, cr3, cr4;
26 u16 gdt_pad; 15 struct Xgt_desc_struct gdt;
27 u16 gdt_limit; 16 struct Xgt_desc_struct idt;
28 unsigned long gdt_base;
29 u16 idt_pad;
30 u16 idt_limit;
31 unsigned long idt_base;
32 u16 ldt; 17 u16 ldt;
33 u16 tss; 18 u16 tss;
34 unsigned long tr; 19 unsigned long tr;
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index a6dabbcd6e6a..a6d20d9a1a30 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -88,6 +88,9 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
88#define savesegment(seg, value) \ 88#define savesegment(seg, value) \
89 asm volatile("mov %%" #seg ",%0":"=rm" (value)) 89 asm volatile("mov %%" #seg ",%0":"=rm" (value))
90 90
91#ifdef CONFIG_PARAVIRT
92#include <asm/paravirt.h>
93#else
91#define read_cr0() ({ \ 94#define read_cr0() ({ \
92 unsigned int __dummy; \ 95 unsigned int __dummy; \
93 __asm__ __volatile__( \ 96 __asm__ __volatile__( \
@@ -139,17 +142,18 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
139#define write_cr4(x) \ 142#define write_cr4(x) \
140 __asm__ __volatile__("movl %0,%%cr4": :"r" (x)) 143 __asm__ __volatile__("movl %0,%%cr4": :"r" (x))
141 144
142/* 145#define wbinvd() \
143 * Clear and set 'TS' bit respectively 146 __asm__ __volatile__ ("wbinvd": : :"memory")
144 */ 147
148/* Clear the 'TS' bit */
145#define clts() __asm__ __volatile__ ("clts") 149#define clts() __asm__ __volatile__ ("clts")
150#endif/* CONFIG_PARAVIRT */
151
152/* Set the 'TS' bit */
146#define stts() write_cr0(8 | read_cr0()) 153#define stts() write_cr0(8 | read_cr0())
147 154
148#endif /* __KERNEL__ */ 155#endif /* __KERNEL__ */
149 156
150#define wbinvd() \
151 __asm__ __volatile__ ("wbinvd": : :"memory")
152
153static inline unsigned long get_limit(unsigned long segment) 157static inline unsigned long get_limit(unsigned long segment)
154{ 158{
155 unsigned long __limit; 159 unsigned long __limit;
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index 54d6d7aea938..46d32ad92082 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -95,15 +95,7 @@ static inline struct thread_info *current_thread_info(void)
95 95
96/* thread information allocation */ 96/* thread information allocation */
97#ifdef CONFIG_DEBUG_STACK_USAGE 97#ifdef CONFIG_DEBUG_STACK_USAGE
98#define alloc_thread_info(tsk) \ 98#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
99 ({ \
100 struct thread_info *ret; \
101 \
102 ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \
103 if (ret) \
104 memset(ret, 0, THREAD_SIZE); \
105 ret; \
106 })
107#else 99#else
108#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL) 100#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
109#endif 101#endif
diff --git a/include/asm-i386/time.h b/include/asm-i386/time.h
new file mode 100644
index 000000000000..ea8065af825a
--- /dev/null
+++ b/include/asm-i386/time.h
@@ -0,0 +1,41 @@
1#ifndef _ASMi386_TIME_H
2#define _ASMi386_TIME_H
3
4#include <linux/efi.h>
5#include "mach_time.h"
6
7static inline unsigned long native_get_wallclock(void)
8{
9 unsigned long retval;
10
11 if (efi_enabled)
12 retval = efi_get_time();
13 else
14 retval = mach_get_cmos_time();
15
16 return retval;
17}
18
19static inline int native_set_wallclock(unsigned long nowtime)
20{
21 int retval;
22
23 if (efi_enabled)
24 retval = efi_set_rtc_mmss(nowtime);
25 else
26 retval = mach_set_rtc_mmss(nowtime);
27
28 return retval;
29}
30
31#ifdef CONFIG_PARAVIRT
32#include <asm/paravirt.h>
33#else /* !CONFIG_PARAVIRT */
34
35#define get_wallclock() native_get_wallclock()
36#define set_wallclock(x) native_set_wallclock(x)
37#define do_time_init() time_init_hook()
38
39#endif /* CONFIG_PARAVIRT */
40
41#endif
diff --git a/include/asm-i386/tlbflush.h b/include/asm-i386/tlbflush.h
index 360648b0f2b3..4dd82840d53b 100644
--- a/include/asm-i386/tlbflush.h
+++ b/include/asm-i386/tlbflush.h
@@ -4,7 +4,15 @@
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/processor.h> 5#include <asm/processor.h>
6 6
7#define __flush_tlb() \ 7#ifdef CONFIG_PARAVIRT
8#include <asm/paravirt.h>
9#else
10#define __flush_tlb() __native_flush_tlb()
11#define __flush_tlb_global() __native_flush_tlb_global()
12#define __flush_tlb_single(addr) __native_flush_tlb_single(addr)
13#endif
14
15#define __native_flush_tlb() \
8 do { \ 16 do { \
9 unsigned int tmpreg; \ 17 unsigned int tmpreg; \
10 \ 18 \
@@ -19,7 +27,7 @@
19 * Global pages have to be flushed a bit differently. Not a real 27 * Global pages have to be flushed a bit differently. Not a real
20 * performance problem because this does not happen often. 28 * performance problem because this does not happen often.
21 */ 29 */
22#define __flush_tlb_global() \ 30#define __native_flush_tlb_global() \
23 do { \ 31 do { \
24 unsigned int tmpreg, cr4, cr4_orig; \ 32 unsigned int tmpreg, cr4, cr4_orig; \
25 \ 33 \
@@ -36,6 +44,9 @@
36 : "memory"); \ 44 : "memory"); \
37 } while (0) 45 } while (0)
38 46
47#define __native_flush_tlb_single(addr) \
48 __asm__ __volatile__("invlpg (%0)" ::"r" (addr) : "memory")
49
39# define __flush_tlb_all() \ 50# define __flush_tlb_all() \
40 do { \ 51 do { \
41 if (cpu_has_pge) \ 52 if (cpu_has_pge) \
@@ -46,9 +57,6 @@
46 57
47#define cpu_has_invlpg (boot_cpu_data.x86 > 3) 58#define cpu_has_invlpg (boot_cpu_data.x86 > 3)
48 59
49#define __flush_tlb_single(addr) \
50 __asm__ __volatile__("invlpg (%0)" ::"r" (addr) : "memory")
51
52#ifdef CONFIG_X86_INVLPG 60#ifdef CONFIG_X86_INVLPG
53# define __flush_tlb_one(addr) __flush_tlb_single(addr) 61# define __flush_tlb_one(addr) __flush_tlb_single(addr)
54#else 62#else
diff --git a/include/asm-i386/types.h b/include/asm-i386/types.h
index 4b4b295ccdb9..ad0a55bd782f 100644
--- a/include/asm-i386/types.h
+++ b/include/asm-i386/types.h
@@ -57,16 +57,6 @@ typedef u32 dma_addr_t;
57#endif 57#endif
58typedef u64 dma64_addr_t; 58typedef u64 dma64_addr_t;
59 59
60#ifdef CONFIG_LBD
61typedef u64 sector_t;
62#define HAVE_SECTOR_T
63#endif
64
65#ifdef CONFIG_LSF
66typedef u64 blkcnt_t;
67#define HAVE_BLKCNT_T
68#endif
69
70#endif /* __ASSEMBLY__ */ 60#endif /* __ASSEMBLY__ */
71 61
72#endif /* __KERNEL__ */ 62#endif /* __KERNEL__ */
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index beeeaf6b054a..833fa1704ff9 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -329,104 +329,6 @@
329#ifdef __KERNEL__ 329#ifdef __KERNEL__
330 330
331#define NR_syscalls 320 331#define NR_syscalls 320
332#include <linux/err.h>
333
334/*
335 * user-visible error numbers are in the range -1 - -MAX_ERRNO: see
336 * <asm-i386/errno.h>
337 */
338#define __syscall_return(type, res) \
339do { \
340 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
341 errno = -(res); \
342 res = -1; \
343 } \
344 return (type) (res); \
345} while (0)
346
347/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
348#define _syscall0(type,name) \
349type name(void) \
350{ \
351long __res; \
352__asm__ volatile ("int $0x80" \
353 : "=a" (__res) \
354 : "0" (__NR_##name)); \
355__syscall_return(type,__res); \
356}
357
358#define _syscall1(type,name,type1,arg1) \
359type name(type1 arg1) \
360{ \
361long __res; \
362__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
363 : "=a" (__res) \
364 : "0" (__NR_##name),"ri" ((long)(arg1)) : "memory"); \
365__syscall_return(type,__res); \
366}
367
368#define _syscall2(type,name,type1,arg1,type2,arg2) \
369type name(type1 arg1,type2 arg2) \
370{ \
371long __res; \
372__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
373 : "=a" (__res) \
374 : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)) \
375 : "memory"); \
376__syscall_return(type,__res); \
377}
378
379#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
380type name(type1 arg1,type2 arg2,type3 arg3) \
381{ \
382long __res; \
383__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
384 : "=a" (__res) \
385 : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \
386 "d" ((long)(arg3)) : "memory"); \
387__syscall_return(type,__res); \
388}
389
390#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
391type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
392{ \
393long __res; \
394__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
395 : "=a" (__res) \
396 : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \
397 "d" ((long)(arg3)),"S" ((long)(arg4)) : "memory"); \
398__syscall_return(type,__res); \
399}
400
401#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
402 type5,arg5) \
403type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
404{ \
405long __res; \
406__asm__ volatile ("push %%ebx ; movl %2,%%ebx ; movl %1,%%eax ; " \
407 "int $0x80 ; pop %%ebx" \
408 : "=a" (__res) \
409 : "i" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \
410 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) \
411 : "memory"); \
412__syscall_return(type,__res); \
413}
414
415#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
416 type5,arg5,type6,arg6) \
417type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
418{ \
419long __res; \
420 struct { long __a1; long __a6; } __s = { (long)arg1, (long)arg6 }; \
421__asm__ volatile ("push %%ebp ; push %%ebx ; movl 4(%2),%%ebp ; " \
422 "movl 0(%2),%%ebx ; movl %1,%%eax ; int $0x80 ; " \
423 "pop %%ebx ; pop %%ebp" \
424 : "=a" (__res) \
425 : "i" (__NR_##name),"0" ((long)(&__s)),"c" ((long)(arg2)), \
426 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) \
427 : "memory"); \
428__syscall_return(type,__res); \
429}
430 332
431#define __ARCH_WANT_IPC_PARSE_VERSION 333#define __ARCH_WANT_IPC_PARSE_VERSION
432#define __ARCH_WANT_OLD_READDIR 334#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-i386/unwind.h b/include/asm-i386/unwind.h
index 5031d693b89d..aa2c931e30db 100644
--- a/include/asm-i386/unwind.h
+++ b/include/asm-i386/unwind.h
@@ -71,6 +71,7 @@ static inline void arch_unw_init_blocked(struct unwind_frame_info *info)
71 info->regs.xss = __KERNEL_DS; 71 info->regs.xss = __KERNEL_DS;
72 info->regs.xds = __USER_DS; 72 info->regs.xds = __USER_DS;
73 info->regs.xes = __USER_DS; 73 info->regs.xes = __USER_DS;
74 info->regs.xgs = __KERNEL_PDA;
74} 75}
75 76
76extern asmlinkage int arch_unwind_init_running(struct unwind_frame_info *, 77extern asmlinkage int arch_unwind_init_running(struct unwind_frame_info *,
@@ -78,17 +79,13 @@ extern asmlinkage int arch_unwind_init_running(struct unwind_frame_info *,
78 void *arg), 79 void *arg),
79 void *arg); 80 void *arg);
80 81
81static inline int arch_unw_user_mode(const struct unwind_frame_info *info) 82static inline int arch_unw_user_mode(/*const*/ struct unwind_frame_info *info)
82{ 83{
83#if 0 /* This can only work when selector register and EFLAGS saves/restores 84 return user_mode_vm(&info->regs)
84 are properly annotated (and tracked in UNW_REGISTER_INFO). */ 85 || info->regs.eip < PAGE_OFFSET
85 return user_mode_vm(&info->regs);
86#else
87 return info->regs.eip < PAGE_OFFSET
88 || (info->regs.eip >= __fix_to_virt(FIX_VDSO) 86 || (info->regs.eip >= __fix_to_virt(FIX_VDSO)
89 && info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE) 87 && info->regs.eip < __fix_to_virt(FIX_VDSO) + PAGE_SIZE)
90 || info->regs.esp < PAGE_OFFSET; 88 || info->regs.esp < PAGE_OFFSET;
91#endif
92} 89}
93 90
94#else 91#else
diff --git a/include/asm-i386/vm86.h b/include/asm-i386/vm86.h
index 952fd6957380..a5edf517b992 100644
--- a/include/asm-i386/vm86.h
+++ b/include/asm-i386/vm86.h
@@ -145,26 +145,13 @@ struct vm86plus_struct {
145 * at the end of the structure. Look at ptrace.h to see the "normal" 145 * at the end of the structure. Look at ptrace.h to see the "normal"
146 * setup. For user space layout see 'struct vm86_regs' above. 146 * setup. For user space layout see 'struct vm86_regs' above.
147 */ 147 */
148#include <asm/ptrace.h>
148 149
149struct kernel_vm86_regs { 150struct kernel_vm86_regs {
150/* 151/*
151 * normal regs, with special meaning for the segment descriptors.. 152 * normal regs, with special meaning for the segment descriptors..
152 */ 153 */
153 long ebx; 154 struct pt_regs pt;
154 long ecx;
155 long edx;
156 long esi;
157 long edi;
158 long ebp;
159 long eax;
160 long __null_ds;
161 long __null_es;
162 long orig_eax;
163 long eip;
164 unsigned short cs, __csh;
165 long eflags;
166 long esp;
167 unsigned short ss, __ssh;
168/* 155/*
169 * these are specific to v86 mode: 156 * these are specific to v86 mode:
170 */ 157 */
diff --git a/include/asm-ia64/Kbuild b/include/asm-ia64/Kbuild
index 15818a18bc52..4a1e48b9f403 100644
--- a/include/asm-ia64/Kbuild
+++ b/include/asm-ia64/Kbuild
@@ -10,7 +10,6 @@ header-y += intrinsics.h
10header-y += perfmon_default_smpl.h 10header-y += perfmon_default_smpl.h
11header-y += ptrace_offsets.h 11header-y += ptrace_offsets.h
12header-y += rse.h 12header-y += rse.h
13header-y += setup.h
14header-y += ucontext.h 13header-y += ucontext.h
15 14
16unifdef-y += perfmon.h 15unifdef-y += perfmon.h
diff --git a/include/asm-ia64/checksum.h b/include/asm-ia64/checksum.h
index 1f230ff8ea81..2b78582cbd61 100644
--- a/include/asm-ia64/checksum.h
+++ b/include/asm-ia64/checksum.h
@@ -10,23 +10,21 @@
10 * This is a version of ip_compute_csum() optimized for IP headers, 10 * This is a version of ip_compute_csum() optimized for IP headers,
11 * which always checksum on 4 octet boundaries. 11 * which always checksum on 4 octet boundaries.
12 */ 12 */
13extern unsigned short ip_fast_csum (unsigned char * iph, unsigned int ihl); 13extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
14 14
15/* 15/*
16 * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit 16 * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit
17 * checksum, already complemented 17 * checksum, already complemented
18 */ 18 */
19extern unsigned short int csum_tcpudp_magic (unsigned long saddr, 19extern __sum16 csum_tcpudp_magic (__be32 saddr, __be32 daddr,
20 unsigned long daddr,
21 unsigned short len, 20 unsigned short len,
22 unsigned short proto, 21 unsigned short proto,
23 unsigned int sum); 22 __wsum sum);
24 23
25extern unsigned int csum_tcpudp_nofold (unsigned long saddr, 24extern __wsum csum_tcpudp_nofold (__be32 saddr, __be32 daddr,
26 unsigned long daddr,
27 unsigned short len, 25 unsigned short len,
28 unsigned short proto, 26 unsigned short proto,
29 unsigned int sum); 27 __wsum sum);
30 28
31/* 29/*
32 * Computes the checksum of a memory block at buff, length len, 30 * Computes the checksum of a memory block at buff, length len,
@@ -40,8 +38,7 @@ extern unsigned int csum_tcpudp_nofold (unsigned long saddr,
40 * 38 *
41 * it's best to have buff aligned on a 32-bit boundary 39 * it's best to have buff aligned on a 32-bit boundary
42 */ 40 */
43extern unsigned int csum_partial (const unsigned char * buff, int len, 41extern __wsum csum_partial(const void *buff, int len, __wsum sum);
44 unsigned int sum);
45 42
46/* 43/*
47 * Same as csum_partial, but copies from src while it checksums. 44 * Same as csum_partial, but copies from src while it checksums.
@@ -49,28 +46,34 @@ extern unsigned int csum_partial (const unsigned char * buff, int len,
49 * Here it is even more important to align src and dst on a 32-bit (or 46 * Here it is even more important to align src and dst on a 32-bit (or
50 * even better 64-bit) boundary. 47 * even better 64-bit) boundary.
51 */ 48 */
52extern unsigned int csum_partial_copy_from_user (const char *src, char *dst, 49extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
53 int len, unsigned int sum, 50 int len, __wsum sum,
54 int *errp); 51 int *errp);
55 52
56extern unsigned int csum_partial_copy_nocheck (const char *src, char *dst, 53extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,
57 int len, unsigned int sum); 54 int len, __wsum sum);
58 55
59/* 56/*
60 * This routine is used for miscellaneous IP-like checksums, mainly in 57 * This routine is used for miscellaneous IP-like checksums, mainly in
61 * icmp.c 58 * icmp.c
62 */ 59 */
63extern unsigned short ip_compute_csum (unsigned char *buff, int len); 60extern __sum16 ip_compute_csum(const void *buff, int len);
64 61
65/* 62/*
66 * Fold a partial checksum without adding pseudo headers. 63 * Fold a partial checksum without adding pseudo headers.
67 */ 64 */
68static inline unsigned short 65static inline __sum16 csum_fold(__wsum csum)
69csum_fold (unsigned int sum)
70{ 66{
67 u32 sum = (__force u32)csum;
71 sum = (sum & 0xffff) + (sum >> 16); 68 sum = (sum & 0xffff) + (sum >> 16);
72 sum = (sum & 0xffff) + (sum >> 16); 69 sum = (sum & 0xffff) + (sum >> 16);
73 return ~sum; 70 return (__force __sum16)~sum;
74} 71}
75 72
73#define _HAVE_ARCH_IPV6_CSUM 1
74struct in6_addr;
75extern unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
76 struct in6_addr *daddr, __u32 len, unsigned short proto,
77 unsigned int csum);
78
76#endif /* _ASM_IA64_CHECKSUM_H */ 79#endif /* _ASM_IA64_CHECKSUM_H */
diff --git a/include/asm-ia64/device.h b/include/asm-ia64/device.h
new file mode 100644
index 000000000000..3db6daf7f251
--- /dev/null
+++ b/include/asm-ia64/device.h
@@ -0,0 +1,15 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef _ASM_IA64_DEVICE_H
7#define _ASM_IA64_DEVICE_H
8
9struct dev_archdata {
10#ifdef CONFIG_ACPI
11 void *acpi_handle;
12#endif
13};
14
15#endif /* _ASM_IA64_DEVICE_H */
diff --git a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h
index 99a8f8e1218c..ebd5887f4b1a 100644
--- a/include/asm-ia64/dma-mapping.h
+++ b/include/asm-ia64/dma-mapping.h
@@ -50,7 +50,8 @@ dma_set_mask (struct device *dev, u64 mask)
50extern int dma_get_cache_alignment(void); 50extern int dma_get_cache_alignment(void);
51 51
52static inline void 52static inline void
53dma_cache_sync (void *vaddr, size_t size, enum dma_data_direction dir) 53dma_cache_sync (struct device *dev, void *vaddr, size_t size,
54 enum dma_data_direction dir)
54{ 55{
55 /* 56 /*
56 * IA-64 is cache-coherent, so this is mostly a no-op. However, we do need to 57 * IA-64 is cache-coherent, so this is mostly a no-op. However, we do need to
@@ -59,6 +60,6 @@ dma_cache_sync (void *vaddr, size_t size, enum dma_data_direction dir)
59 mb(); 60 mb();
60} 61}
61 62
62#define dma_is_consistent(dma_handle) (1) /* all we do is coherent memory... */ 63#define dma_is_consistent(d, h) (1) /* all we do is coherent memory... */
63 64
64#endif /* _ASM_IA64_DMA_MAPPING_H */ 65#endif /* _ASM_IA64_DMA_MAPPING_H */
diff --git a/include/asm-ia64/futex.h b/include/asm-ia64/futex.h
index 07d77f3a8cbe..8a98a2654139 100644
--- a/include/asm-ia64/futex.h
+++ b/include/asm-ia64/futex.h
@@ -59,7 +59,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
59 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 59 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
60 return -EFAULT; 60 return -EFAULT;
61 61
62 inc_preempt_count(); 62 pagefault_disable();
63 63
64 switch (op) { 64 switch (op) {
65 case FUTEX_OP_SET: 65 case FUTEX_OP_SET:
@@ -83,7 +83,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
83 ret = -ENOSYS; 83 ret = -ENOSYS;
84 } 84 }
85 85
86 dec_preempt_count(); 86 pagefault_enable();
87 87
88 if (!ret) { 88 if (!ret) {
89 switch (cmp) { 89 switch (cmp) {
diff --git a/include/asm-ia64/io.h b/include/asm-ia64/io.h
index 855c30af72a9..6311e168cd34 100644
--- a/include/asm-ia64/io.h
+++ b/include/asm-ia64/io.h
@@ -32,7 +32,7 @@
32 */ 32 */
33#define IO_SPACE_LIMIT 0xffffffffffffffffUL 33#define IO_SPACE_LIMIT 0xffffffffffffffffUL
34 34
35#define MAX_IO_SPACES_BITS 4 35#define MAX_IO_SPACES_BITS 8
36#define MAX_IO_SPACES (1UL << MAX_IO_SPACES_BITS) 36#define MAX_IO_SPACES (1UL << MAX_IO_SPACES_BITS)
37#define IO_SPACE_BITS 24 37#define IO_SPACE_BITS 24
38#define IO_SPACE_SIZE (1UL << IO_SPACE_BITS) 38#define IO_SPACE_SIZE (1UL << IO_SPACE_BITS)
diff --git a/include/asm-ia64/kexec.h b/include/asm-ia64/kexec.h
new file mode 100644
index 000000000000..01c36b004747
--- /dev/null
+++ b/include/asm-ia64/kexec.h
@@ -0,0 +1,47 @@
1#ifndef _ASM_IA64_KEXEC_H
2#define _ASM_IA64_KEXEC_H
3
4
5/* Maximum physical address we can use pages from */
6#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
7/* Maximum address we can reach in physical address mode */
8#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
9/* Maximum address we can use for the control code buffer */
10#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
11
12#define KEXEC_CONTROL_CODE_SIZE (8192 + 8192 + 4096)
13
14/* The native architecture */
15#define KEXEC_ARCH KEXEC_ARCH_IA_64
16
17#define MAX_NOTE_BYTES 1024
18
19#define kexec_flush_icache_page(page) do { \
20 unsigned long page_addr = (unsigned long)page_address(page); \
21 flush_icache_range(page_addr, page_addr + PAGE_SIZE); \
22 } while(0)
23
24extern struct kimage *ia64_kimage;
25DECLARE_PER_CPU(u64, ia64_mca_pal_base);
26const extern unsigned int relocate_new_kernel_size;
27extern void relocate_new_kernel(unsigned long, unsigned long,
28 struct ia64_boot_param *, unsigned long);
29static inline void
30crash_setup_regs(struct pt_regs *newregs, struct pt_regs *oldregs)
31{
32}
33extern struct resource efi_memmap_res;
34extern struct resource boot_param_res;
35extern void kdump_smp_send_stop(void);
36extern void kdump_smp_send_init(void);
37extern void kexec_disable_iosapic(void);
38extern void crash_save_this_cpu(void);
39struct rsvd_region;
40extern unsigned long kdump_find_rsvd_region(unsigned long size,
41 struct rsvd_region *rsvd_regions, int n);
42extern void kdump_cpu_freeze(struct unw_frame_info *info, void *arg);
43extern int kdump_status[];
44extern atomic_t kdump_cpu_freezed;
45extern atomic_t kdump_in_progress;
46
47#endif /* _ASM_IA64_KEXEC_H */
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index 7ffbddf5306f..a3891eb3f217 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -36,6 +36,8 @@ typedef int ia64_mv_pci_legacy_read_t (struct pci_bus *, u16 port, u32 *val,
36typedef 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,
37 u8 size); 37 u8 size);
38typedef void ia64_mv_migrate_t(struct task_struct * task); 38typedef void ia64_mv_migrate_t(struct task_struct * task);
39typedef void ia64_mv_pci_fixup_bus_t (struct pci_bus *);
40typedef void ia64_mv_kernel_launch_event_t(void);
39 41
40/* DMA-mapping interface: */ 42/* DMA-mapping interface: */
41typedef void ia64_mv_dma_init (void); 43typedef void ia64_mv_dma_init (void);
@@ -95,6 +97,11 @@ machvec_noop_task (struct task_struct *task)
95{ 97{
96} 98}
97 99
100static inline void
101machvec_noop_bus (struct pci_bus *bus)
102{
103}
104
98extern void machvec_setup (char **); 105extern void machvec_setup (char **);
99extern void machvec_timer_interrupt (int, void *); 106extern void machvec_timer_interrupt (int, void *);
100extern void machvec_dma_sync_single (struct device *, dma_addr_t, size_t, int); 107extern void machvec_dma_sync_single (struct device *, dma_addr_t, size_t, int);
@@ -159,6 +166,7 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
159# define platform_migrate ia64_mv.migrate 166# define platform_migrate ia64_mv.migrate
160# define platform_setup_msi_irq ia64_mv.setup_msi_irq 167# define platform_setup_msi_irq ia64_mv.setup_msi_irq
161# define platform_teardown_msi_irq ia64_mv.teardown_msi_irq 168# define platform_teardown_msi_irq ia64_mv.teardown_msi_irq
169# define platform_pci_fixup_bus ia64_mv.pci_fixup_bus
162# endif 170# endif
163 171
164/* __attribute__((__aligned__(16))) is required to make size of the 172/* __attribute__((__aligned__(16))) is required to make size of the
@@ -210,6 +218,8 @@ struct ia64_machine_vector {
210 ia64_mv_migrate_t *migrate; 218 ia64_mv_migrate_t *migrate;
211 ia64_mv_setup_msi_irq_t *setup_msi_irq; 219 ia64_mv_setup_msi_irq_t *setup_msi_irq;
212 ia64_mv_teardown_msi_irq_t *teardown_msi_irq; 220 ia64_mv_teardown_msi_irq_t *teardown_msi_irq;
221 ia64_mv_pci_fixup_bus_t *pci_fixup_bus;
222 ia64_mv_kernel_launch_event_t *kernel_launch_event;
213} __attribute__((__aligned__(16))); /* align attrib? see above comment */ 223} __attribute__((__aligned__(16))); /* align attrib? see above comment */
214 224
215#define MACHVEC_INIT(name) \ 225#define MACHVEC_INIT(name) \
@@ -257,6 +267,7 @@ struct ia64_machine_vector {
257 platform_migrate, \ 267 platform_migrate, \
258 platform_setup_msi_irq, \ 268 platform_setup_msi_irq, \
259 platform_teardown_msi_irq, \ 269 platform_teardown_msi_irq, \
270 platform_pci_fixup_bus, \
260} 271}
261 272
262extern struct ia64_machine_vector ia64_mv; 273extern struct ia64_machine_vector ia64_mv;
@@ -309,6 +320,9 @@ extern ia64_mv_dma_supported swiotlb_dma_supported;
309#ifndef platform_tlb_migrate_finish 320#ifndef platform_tlb_migrate_finish
310# define platform_tlb_migrate_finish machvec_noop_mm 321# define platform_tlb_migrate_finish machvec_noop_mm
311#endif 322#endif
323#ifndef platform_kernel_launch_event
324# define platform_kernel_launch_event machvec_noop
325#endif
312#ifndef platform_dma_init 326#ifndef platform_dma_init
313# define platform_dma_init swiotlb_init 327# define platform_dma_init swiotlb_init
314#endif 328#endif
@@ -416,5 +430,8 @@ extern int ia64_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size
416#ifndef platform_teardown_msi_irq 430#ifndef platform_teardown_msi_irq
417# define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL) 431# define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL)
418#endif 432#endif
433#ifndef platform_pci_fixup_bus
434# define platform_pci_fixup_bus machvec_noop_bus
435#endif
419 436
420#endif /* _ASM_IA64_MACHVEC_H */ 437#endif /* _ASM_IA64_MACHVEC_H */
diff --git a/include/asm-ia64/machvec_sn2.h b/include/asm-ia64/machvec_sn2.h
index c54b165b1c17..eaa2fce0fecd 100644
--- a/include/asm-ia64/machvec_sn2.h
+++ b/include/asm-ia64/machvec_sn2.h
@@ -67,8 +67,10 @@ extern 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; 69extern ia64_mv_migrate_t sn_migrate;
70extern ia64_mv_kernel_launch_event_t sn_kernel_launch_event;
70extern ia64_mv_setup_msi_irq_t sn_setup_msi_irq; 71extern ia64_mv_setup_msi_irq_t sn_setup_msi_irq;
71extern ia64_mv_teardown_msi_irq_t sn_teardown_msi_irq; 72extern ia64_mv_teardown_msi_irq_t sn_teardown_msi_irq;
73extern ia64_mv_pci_fixup_bus_t sn_pci_fixup_bus;
72 74
73 75
74/* 76/*
@@ -120,6 +122,7 @@ extern ia64_mv_teardown_msi_irq_t sn_teardown_msi_irq;
120#define platform_dma_mapping_error sn_dma_mapping_error 122#define platform_dma_mapping_error sn_dma_mapping_error
121#define platform_dma_supported sn_dma_supported 123#define platform_dma_supported sn_dma_supported
122#define platform_migrate sn_migrate 124#define platform_migrate sn_migrate
125#define platform_kernel_launch_event sn_kernel_launch_event
123#ifdef CONFIG_PCI_MSI 126#ifdef CONFIG_PCI_MSI
124#define platform_setup_msi_irq sn_setup_msi_irq 127#define platform_setup_msi_irq sn_setup_msi_irq
125#define platform_teardown_msi_irq sn_teardown_msi_irq 128#define platform_teardown_msi_irq sn_teardown_msi_irq
@@ -127,6 +130,7 @@ extern ia64_mv_teardown_msi_irq_t sn_teardown_msi_irq;
127#define platform_setup_msi_irq ((ia64_mv_setup_msi_irq_t*)NULL) 130#define platform_setup_msi_irq ((ia64_mv_setup_msi_irq_t*)NULL)
128#define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL) 131#define platform_teardown_msi_irq ((ia64_mv_teardown_msi_irq_t*)NULL)
129#endif 132#endif
133#define platform_pci_fixup_bus sn_pci_fixup_bus
130 134
131#include <asm/sn/io.h> 135#include <asm/sn/io.h>
132 136
diff --git a/include/asm-ia64/meminit.h b/include/asm-ia64/meminit.h
index c3b1f862e6e7..c8df75901083 100644
--- a/include/asm-ia64/meminit.h
+++ b/include/asm-ia64/meminit.h
@@ -15,11 +15,12 @@
15 * - initrd (optional) 15 * - initrd (optional)
16 * - command line string 16 * - command line string
17 * - kernel code & data 17 * - kernel code & data
18 * - crash dumping code reserved region
18 * - Kernel memory map built from EFI memory map 19 * - Kernel memory map built from EFI memory map
19 * 20 *
20 * More could be added if necessary 21 * More could be added if necessary
21 */ 22 */
22#define IA64_MAX_RSVD_REGIONS 6 23#define IA64_MAX_RSVD_REGIONS 7
23 24
24struct rsvd_region { 25struct rsvd_region {
25 unsigned long start; /* virtual address of beginning of element */ 26 unsigned long start; /* virtual address of beginning of element */
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index 947cb72b520e..485759ba9e36 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -101,7 +101,7 @@ do { \
101 101
102#ifdef CONFIG_VIRTUAL_MEM_MAP 102#ifdef CONFIG_VIRTUAL_MEM_MAP
103extern int ia64_pfn_valid (unsigned long pfn); 103extern int ia64_pfn_valid (unsigned long pfn);
104#elif defined(CONFIG_FLATMEM) 104#else
105# define ia64_pfn_valid(pfn) 1 105# define ia64_pfn_valid(pfn) 1
106#endif 106#endif
107 107
@@ -110,12 +110,11 @@ extern struct page *vmem_map;
110#ifdef CONFIG_DISCONTIGMEM 110#ifdef CONFIG_DISCONTIGMEM
111# define page_to_pfn(page) ((unsigned long) (page - vmem_map)) 111# define page_to_pfn(page) ((unsigned long) (page - vmem_map))
112# define pfn_to_page(pfn) (vmem_map + (pfn)) 112# define pfn_to_page(pfn) (vmem_map + (pfn))
113#else
114# include <asm-generic/memory_model.h>
113#endif 115#endif
114#endif 116#else
115 117# include <asm-generic/memory_model.h>
116#if defined(CONFIG_FLATMEM) || defined(CONFIG_SPARSEMEM)
117/* FLATMEM always configures mem_map (mem_map = vmem_map if necessary) */
118#include <asm-generic/memory_model.h>
119#endif 118#endif
120 119
121#ifdef CONFIG_FLATMEM 120#ifdef CONFIG_FLATMEM
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index 4283ddcc25fb..bc768153f3c9 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -20,6 +20,8 @@
20 * 00/05/24 eranian Updated to latest PAL spec, fix structures bugs, added 20 * 00/05/24 eranian Updated to latest PAL spec, fix structures bugs, added
21 * 00/05/25 eranian Support for stack calls, and static physical calls 21 * 00/05/25 eranian Support for stack calls, and static physical calls
22 * 00/06/18 eranian Support for stacked physical calls 22 * 00/06/18 eranian Support for stacked physical calls
23 * 06/10/26 rja Support for Intel Itanium Architecture Software Developer's
24 * Manual Rev 2.2 (Jan 2006)
23 */ 25 */
24 26
25/* 27/*
@@ -69,6 +71,8 @@
69#define PAL_PREFETCH_VISIBILITY 41 /* Make Processor Prefetches Visible */ 71#define PAL_PREFETCH_VISIBILITY 41 /* Make Processor Prefetches Visible */
70#define PAL_LOGICAL_TO_PHYSICAL 42 /* returns information on logical to physical processor mapping */ 72#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 */ 73#define PAL_CACHE_SHARED_INFO 43 /* returns information on caches shared by logical processor */
74#define PAL_GET_HW_POLICY 48 /* Get current hardware resource sharing policy */
75#define PAL_SET_HW_POLICY 49 /* Set current hardware resource sharing policy */
72 76
73#define PAL_COPY_PAL 256 /* relocate PAL procedures and PAL PMI */ 77#define PAL_COPY_PAL 256 /* relocate PAL procedures and PAL PMI */
74#define PAL_HALT_INFO 257 /* return the low power capabilities of processor */ 78#define PAL_HALT_INFO 257 /* return the low power capabilities of processor */
@@ -80,6 +84,11 @@
80#define PAL_SET_PSTATE 263 /* set the P-state */ 84#define PAL_SET_PSTATE 263 /* set the P-state */
81#define PAL_BRAND_INFO 274 /* Processor branding information */ 85#define PAL_BRAND_INFO 274 /* Processor branding information */
82 86
87#define PAL_GET_PSTATE_TYPE_LASTSET 0
88#define PAL_GET_PSTATE_TYPE_AVGANDRESET 1
89#define PAL_GET_PSTATE_TYPE_AVGNORESET 2
90#define PAL_GET_PSTATE_TYPE_INSTANT 3
91
83#ifndef __ASSEMBLY__ 92#ifndef __ASSEMBLY__
84 93
85#include <linux/types.h> 94#include <linux/types.h>
@@ -102,6 +111,7 @@ typedef s64 pal_status_t;
102 * cache without sideeffects 111 * cache without sideeffects
103 * and "restrict" was 1 112 * and "restrict" was 1
104 */ 113 */
114#define PAL_STATUS_REQUIRES_MEMORY (-9) /* Call requires PAL memory buffer */
105 115
106/* Processor cache level in the heirarchy */ 116/* Processor cache level in the heirarchy */
107typedef u64 pal_cache_level_t; 117typedef u64 pal_cache_level_t;
@@ -456,7 +466,9 @@ typedef struct pal_process_state_info_s {
456 * by the processor 466 * by the processor
457 */ 467 */
458 468
459 reserved2 : 11, 469 se : 1, /* Shared error. MCA in a
470 shared structure */
471 reserved2 : 10,
460 cc : 1, /* Cache check */ 472 cc : 1, /* Cache check */
461 tc : 1, /* TLB check */ 473 tc : 1, /* TLB check */
462 bc : 1, /* Bus check */ 474 bc : 1, /* Bus check */
@@ -487,10 +499,12 @@ typedef struct pal_cache_check_info_s {
487 * error occurred 499 * error occurred
488 */ 500 */
489 wiv : 1, /* Way field valid */ 501 wiv : 1, /* Way field valid */
490 reserved2 : 10, 502 reserved2 : 1,
503 dp : 1, /* Data poisoned on MBE */
504 reserved3 : 8,
491 505
492 index : 20, /* Cache line index */ 506 index : 20, /* Cache line index */
493 reserved3 : 2, 507 reserved4 : 2,
494 508
495 is : 1, /* instruction set (1 == ia32) */ 509 is : 1, /* instruction set (1 == ia32) */
496 iv : 1, /* instruction set field valid */ 510 iv : 1, /* instruction set field valid */
@@ -557,7 +571,7 @@ typedef struct pal_bus_check_info_s {
557 type : 8, /* Bus xaction type*/ 571 type : 8, /* Bus xaction type*/
558 sev : 5, /* Bus error severity*/ 572 sev : 5, /* Bus error severity*/
559 hier : 2, /* Bus hierarchy level */ 573 hier : 2, /* Bus hierarchy level */
560 reserved1 : 1, 574 dp : 1, /* Data poisoned on MBE */
561 bsi : 8, /* Bus error status 575 bsi : 8, /* Bus error status
562 * info 576 * info
563 */ 577 */
@@ -834,7 +848,9 @@ typedef union pal_bus_features_u {
834 u64 pbf_req_bus_parking : 1; 848 u64 pbf_req_bus_parking : 1;
835 u64 pbf_bus_lock_mask : 1; 849 u64 pbf_bus_lock_mask : 1;
836 u64 pbf_enable_half_xfer_rate : 1; 850 u64 pbf_enable_half_xfer_rate : 1;
837 u64 pbf_reserved2 : 22; 851 u64 pbf_reserved2 : 20;
852 u64 pbf_enable_shared_line_replace : 1;
853 u64 pbf_enable_exclusive_line_replace : 1;
838 u64 pbf_disable_xaction_queueing : 1; 854 u64 pbf_disable_xaction_queueing : 1;
839 u64 pbf_disable_resp_err_check : 1; 855 u64 pbf_disable_resp_err_check : 1;
840 u64 pbf_disable_berr_check : 1; 856 u64 pbf_disable_berr_check : 1;
@@ -1077,6 +1093,24 @@ ia64_pal_freq_ratios (struct pal_freq_ratio *proc_ratio, struct pal_freq_ratio *
1077 return iprv.status; 1093 return iprv.status;
1078} 1094}
1079 1095
1096/*
1097 * Get the current hardware resource sharing policy of the processor
1098 */
1099static inline s64
1100ia64_pal_get_hw_policy (u64 proc_num, u64 *cur_policy, u64 *num_impacted,
1101 u64 *la)
1102{
1103 struct ia64_pal_retval iprv;
1104 PAL_CALL(iprv, PAL_GET_HW_POLICY, proc_num, 0, 0);
1105 if (cur_policy)
1106 *cur_policy = iprv.v0;
1107 if (num_impacted)
1108 *num_impacted = iprv.v1;
1109 if (la)
1110 *la = iprv.v2;
1111 return iprv.status;
1112}
1113
1080/* Make the processor enter HALT or one of the implementation dependent low 1114/* Make the processor enter HALT or one of the implementation dependent low
1081 * power states where prefetching and execution are suspended and cache and 1115 * power states where prefetching and execution are suspended and cache and
1082 * TLB coherency is not maintained. 1116 * TLB coherency is not maintained.
@@ -1112,10 +1146,10 @@ ia64_pal_halt_info (pal_power_mgmt_info_u_t *power_buf)
1112 1146
1113/* Get the current P-state information */ 1147/* Get the current P-state information */
1114static inline s64 1148static inline s64
1115ia64_pal_get_pstate (u64 *pstate_index) 1149ia64_pal_get_pstate (u64 *pstate_index, unsigned long type)
1116{ 1150{
1117 struct ia64_pal_retval iprv; 1151 struct ia64_pal_retval iprv;
1118 PAL_CALL_STK(iprv, PAL_GET_PSTATE, 0, 0, 0); 1152 PAL_CALL_STK(iprv, PAL_GET_PSTATE, type, 0, 0);
1119 *pstate_index = iprv.v0; 1153 *pstate_index = iprv.v0;
1120 return iprv.status; 1154 return iprv.status;
1121} 1155}
@@ -1401,6 +1435,17 @@ ia64_pal_rse_info (u64 *num_phys_stacked, pal_hints_u_t *hints)
1401 return iprv.status; 1435 return iprv.status;
1402} 1436}
1403 1437
1438/*
1439 * Set the current hardware resource sharing policy of the processor
1440 */
1441static inline s64
1442ia64_pal_set_hw_policy (u64 policy)
1443{
1444 struct ia64_pal_retval iprv;
1445 PAL_CALL(iprv, PAL_SET_HW_POLICY, policy, 0, 0);
1446 return iprv.status;
1447}
1448
1404/* Cause the processor to enter SHUTDOWN state, where prefetching and execution are 1449/* Cause the processor to enter SHUTDOWN state, where prefetching and execution are
1405 * suspended, but cause cache and TLB coherency to be maintained. 1450 * suspended, but cause cache and TLB coherency to be maintained.
1406 * This is usually called in IA-32 mode. 1451 * This is usually called in IA-32 mode.
@@ -1524,12 +1569,15 @@ typedef union pal_vm_info_1_u {
1524 } pal_vm_info_1_s; 1569 } pal_vm_info_1_s;
1525} pal_vm_info_1_u_t; 1570} pal_vm_info_1_u_t;
1526 1571
1572#define PAL_MAX_PURGES 0xFFFF /* all ones is means unlimited */
1573
1527typedef union pal_vm_info_2_u { 1574typedef union pal_vm_info_2_u {
1528 u64 pvi2_val; 1575 u64 pvi2_val;
1529 struct { 1576 struct {
1530 u64 impl_va_msb : 8, 1577 u64 impl_va_msb : 8,
1531 rid_size : 8, 1578 rid_size : 8,
1532 reserved : 48; 1579 max_purges : 16,
1580 reserved : 32;
1533 } pal_vm_info_2_s; 1581 } pal_vm_info_2_s;
1534} pal_vm_info_2_u_t; 1582} pal_vm_info_2_u_t;
1535 1583
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index ef616fd4cb1b..825eb7d882e6 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -26,16 +26,18 @@ void pcibios_config_init(void);
26struct pci_dev; 26struct pci_dev;
27 27
28/* 28/*
29 * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct correspondence 29 * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct
30 * between device bus addresses and CPU physical addresses. Platforms with a hardware I/O 30 * correspondence between device bus addresses and CPU physical addresses.
31 * MMU _must_ turn this off to suppress the bounce buffer handling code in the block and 31 * Platforms with a hardware I/O MMU _must_ turn this off to suppress the
32 * network device layers. Platforms with separate bus address spaces _must_ turn this off 32 * bounce buffer handling code in the block and network device layers.
33 * and provide a device DMA mapping implementation that takes care of the necessary 33 * Platforms with separate bus address spaces _must_ turn this off and provide
34 * a device DMA mapping implementation that takes care of the necessary
34 * address translation. 35 * address translation.
35 * 36 *
36 * For now, the ia64 platforms which may have separate/multiple bus address spaces all 37 * For now, the ia64 platforms which may have separate/multiple bus address
37 * have I/O MMUs which support the merging of physically discontiguous buffers, so we can 38 * spaces all have I/O MMUs which support the merging of physically
38 * use that as the sole factor to determine the setting of PCI_DMA_BUS_IS_PHYS. 39 * discontiguous buffers, so we can use that as the sole factor to determine
40 * the setting of PCI_DMA_BUS_IS_PHYS.
39 */ 41 */
40extern unsigned long ia64_max_iommu_merge_mask; 42extern unsigned long ia64_max_iommu_merge_mask;
41#define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL) 43#define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL)
@@ -52,9 +54,6 @@ pcibios_penalize_isa_irq (int irq, int active)
52 /* We don't do dynamic PCI IRQ allocation */ 54 /* We don't do dynamic PCI IRQ allocation */
53} 55}
54 56
55#define HAVE_ARCH_PCI_MWI 1
56extern int pcibios_prep_mwi (struct pci_dev *);
57
58#include <asm-generic/pci-dma-compat.h> 57#include <asm-generic/pci-dma-compat.h>
59 58
60/* pci_unmap_{single,page} is not a nop, thus... */ 59/* pci_unmap_{single,page} is not a nop, thus... */
diff --git a/include/asm-ia64/pgalloc.h b/include/asm-ia64/pgalloc.h
index 9cb68e9b377e..393e04c42a2c 100644
--- a/include/asm-ia64/pgalloc.h
+++ b/include/asm-ia64/pgalloc.h
@@ -60,7 +60,7 @@ static inline void *pgtable_quicklist_alloc(void)
60static inline void pgtable_quicklist_free(void *pgtable_entry) 60static inline void pgtable_quicklist_free(void *pgtable_entry)
61{ 61{
62#ifdef CONFIG_NUMA 62#ifdef CONFIG_NUMA
63 unsigned long nid = page_to_nid(virt_to_page(pgtable_entry)); 63 int nid = page_to_nid(virt_to_page(pgtable_entry));
64 64
65 if (unlikely(nid != numa_node_id())) { 65 if (unlikely(nid != numa_node_id())) {
66 free_page((unsigned long)pgtable_entry); 66 free_page((unsigned long)pgtable_entry);
diff --git a/include/asm-ia64/sn/acpi.h b/include/asm-ia64/sn/acpi.h
new file mode 100644
index 000000000000..2850a7ef5e71
--- /dev/null
+++ b/include/asm-ia64/sn/acpi.h
@@ -0,0 +1,16 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006 Silicon Graphics, Inc. All rights reserved.
7 */
8
9#ifndef _ASM_IA64_SN_ACPI_H
10#define _ASM_IA64_SN_ACPI_H
11
12#include "acpi/acglobal.h"
13
14#define SN_ACPI_BASE_SUPPORT() (acpi_gbl_DSDT->oem_revision >= 0x20101)
15
16#endif /* _ASM_IA64_SN_ACPI_H */
diff --git a/include/asm-ia64/sn/addrs.h b/include/asm-ia64/sn/addrs.h
index 1d9efe541662..e715c794b186 100644
--- a/include/asm-ia64/sn/addrs.h
+++ b/include/asm-ia64/sn/addrs.h
@@ -136,9 +136,13 @@
136 */ 136 */
137#define TO_PHYS(x) (TO_PHYS_MASK & (x)) 137#define TO_PHYS(x) (TO_PHYS_MASK & (x))
138#define TO_CAC(x) (CAC_BASE | TO_PHYS(x)) 138#define TO_CAC(x) (CAC_BASE | TO_PHYS(x))
139#ifdef CONFIG_SGI_SN
139#define TO_AMO(x) (AMO_BASE | TO_PHYS(x)) 140#define TO_AMO(x) (AMO_BASE | TO_PHYS(x))
140#define TO_GET(x) (GET_BASE | TO_PHYS(x)) 141#define TO_GET(x) (GET_BASE | TO_PHYS(x))
141 142#else
143#define TO_AMO(x) ({ BUG(); x; })
144#define TO_GET(x) ({ BUG(); x; })
145#endif
142 146
143/* 147/*
144 * Covert from processor physical address to II/TIO physical address: 148 * Covert from processor physical address to II/TIO physical address:
diff --git a/include/asm-ia64/sn/pcidev.h b/include/asm-ia64/sn/pcidev.h
index eac3561574be..9fe89a93d880 100644
--- a/include/asm-ia64/sn/pcidev.h
+++ b/include/asm-ia64/sn/pcidev.h
@@ -3,7 +3,7 @@
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) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 1992 - 1997, 2000-2006 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8#ifndef _ASM_IA64_SN_PCI_PCIDEV_H 8#ifndef _ASM_IA64_SN_PCI_PCIDEV_H
9#define _ASM_IA64_SN_PCI_PCIDEV_H 9#define _ASM_IA64_SN_PCI_PCIDEV_H
@@ -12,31 +12,29 @@
12 12
13/* 13/*
14 * In ia64, pci_dev->sysdata must be a *pci_controller. To provide access to 14 * In ia64, pci_dev->sysdata must be a *pci_controller. To provide access to
15 * the pcidev_info structs for all devices under a controller, we extend the 15 * the pcidev_info structs for all devices under a controller, we keep a
16 * definition of pci_controller, via sn_pci_controller, to include a list 16 * list of pcidev_info under pci_controller->platform_data.
17 * of pcidev_info.
18 */ 17 */
19struct sn_pci_controller { 18struct sn_platform_data {
20 struct pci_controller pci_controller; 19 void *provider_soft;
21 struct list_head pcidev_info; 20 struct list_head pcidev_info;
22}; 21};
23 22
24#define SN_PCI_CONTROLLER(dev) ((struct sn_pci_controller *) dev->sysdata) 23#define SN_PLATFORM_DATA(busdev) \
24 ((struct sn_platform_data *)(PCI_CONTROLLER(busdev)->platform_data))
25 25
26#define SN_PCIDEV_INFO(dev) sn_pcidev_info_get(dev) 26#define SN_PCIDEV_INFO(dev) sn_pcidev_info_get(dev)
27 27
28#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \
29 (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data))
30/* 28/*
31 * Given a pci_bus, return the sn pcibus_bussoft struct. Note that 29 * Given a pci_bus, return the sn pcibus_bussoft struct. Note that
32 * this only works for root busses, not for busses represented by PPB's. 30 * this only works for root busses, not for busses represented by PPB's.
33 */ 31 */
34 32
35#define SN_PCIBUS_BUSSOFT(pci_bus) \ 33#define SN_PCIBUS_BUSSOFT(pci_bus) \
36 ((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data)) 34 ((struct pcibus_bussoft *)(SN_PLATFORM_DATA(pci_bus)->provider_soft))
37 35
38#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \ 36#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \
39 (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data)) 37 ((struct pcibus_info *)(SN_PLATFORM_DATA(pci_bus)->provider_soft))
40/* 38/*
41 * Given a struct pci_dev, return the sn pcibus_bussoft struct. Note 39 * Given a struct pci_dev, return the sn pcibus_bussoft struct. Note
42 * that this is not equivalent to SN_PCIBUS_BUSSOFT(pci_dev->bus) due 40 * that this is not equivalent to SN_PCIBUS_BUSSOFT(pci_dev->bus) due
@@ -72,8 +70,6 @@ extern void sn_irq_fixup(struct pci_dev *pci_dev,
72 struct sn_irq_info *sn_irq_info); 70 struct sn_irq_info *sn_irq_info);
73extern void sn_irq_unfixup(struct pci_dev *pci_dev); 71extern void sn_irq_unfixup(struct pci_dev *pci_dev);
74extern struct pcidev_info * sn_pcidev_info_get(struct pci_dev *); 72extern struct pcidev_info * sn_pcidev_info_get(struct pci_dev *);
75extern void sn_pci_controller_fixup(int segment, int busnum,
76 struct pci_bus *bus);
77extern void sn_bus_store_sysdata(struct pci_dev *dev); 73extern void sn_bus_store_sysdata(struct pci_dev *dev);
78extern void sn_bus_free_sysdata(void); 74extern void sn_bus_free_sysdata(void);
79extern void sn_generate_path(struct pci_bus *pci_bus, char *address); 75extern void sn_generate_path(struct pci_bus *pci_bus, char *address);
diff --git a/include/asm-ia64/sn/sn_feature_sets.h b/include/asm-ia64/sn/sn_feature_sets.h
index 30dcfa442e53..bfdc36273ed4 100644
--- a/include/asm-ia64/sn/sn_feature_sets.h
+++ b/include/asm-ia64/sn/sn_feature_sets.h
@@ -44,8 +44,14 @@ extern int sn_prom_feature_available(int id);
44 * Once enabled, a feature cannot be disabled. 44 * Once enabled, a feature cannot be disabled.
45 * 45 *
46 * By default, features are disabled unless explicitly enabled. 46 * By default, features are disabled unless explicitly enabled.
47 *
48 * These defines must be kept in sync with the corresponding
49 * PROM definitions in feature_sets.h.
47 */ 50 */
48#define OSF_MCA_SLV_TO_OS_INIT_SLV 0 51#define OSF_MCA_SLV_TO_OS_INIT_SLV 0
49#define OSF_FEAT_LOG_SBES 1 52#define OSF_FEAT_LOG_SBES 1
53#define OSF_ACPI_ENABLE 2
54#define OSF_PCISEGMENT_ENABLE 3
55
50 56
51#endif /* _ASM_IA64_SN_FEATURE_SETS_H */ 57#endif /* _ASM_IA64_SN_FEATURE_SETS_H */
diff --git a/include/asm-ia64/sn/sn_sal.h b/include/asm-ia64/sn/sn_sal.h
index ba826b3f75bb..2c4004eb5a68 100644
--- a/include/asm-ia64/sn/sn_sal.h
+++ b/include/asm-ia64/sn/sn_sal.h
@@ -77,6 +77,7 @@
77#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058 // deprecated 77#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058 // deprecated
78#define SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST 0x0200005a 78#define SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST 0x0200005a
79 79
80#define SN_SAL_IOIF_INIT 0x0200005f
80#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060 81#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060
81#define SN_SAL_BTE_RECOVER 0x02000061 82#define SN_SAL_BTE_RECOVER 0x02000061
82#define SN_SAL_RESERVED_DO_NOT_USE 0x02000062 83#define SN_SAL_RESERVED_DO_NOT_USE 0x02000062
@@ -87,6 +88,8 @@
87#define SN_SAL_INJECT_ERROR 0x02000067 88#define SN_SAL_INJECT_ERROR 0x02000067
88#define SN_SAL_SET_CPU_NUMBER 0x02000068 89#define SN_SAL_SET_CPU_NUMBER 0x02000068
89 90
91#define SN_SAL_KERNEL_LAUNCH_EVENT 0x02000069
92
90/* 93/*
91 * Service-specific constants 94 * Service-specific constants
92 */ 95 */
@@ -1154,4 +1157,11 @@ ia64_sn_set_cpu_number(int cpu)
1154 SAL_CALL_NOLOCK(rv, SN_SAL_SET_CPU_NUMBER, cpu, 0, 0, 0, 0, 0, 0); 1157 SAL_CALL_NOLOCK(rv, SN_SAL_SET_CPU_NUMBER, cpu, 0, 0, 0, 0, 0, 0);
1155 return rv.status; 1158 return rv.status;
1156} 1159}
1160static inline int
1161ia64_sn_kernel_launch_event(void)
1162{
1163 struct ia64_sal_retval rv;
1164 SAL_CALL_NOLOCK(rv, SN_SAL_KERNEL_LAUNCH_EVENT, 0, 0, 0, 0, 0, 0, 0);
1165 return rv.status;
1166}
1157#endif /* _ASM_IA64_SN_SN_SAL_H */ 1167#endif /* _ASM_IA64_SN_SN_SAL_H */
diff --git a/include/asm-m32r/checksum.h b/include/asm-m32r/checksum.h
index 877ebf46e9ff..a7a7c4f44abe 100644
--- a/include/asm-m32r/checksum.h
+++ b/include/asm-m32r/checksum.h
@@ -31,8 +31,7 @@
31 * 31 *
32 * it's best to have buff aligned on a 32-bit boundary 32 * it's best to have buff aligned on a 32-bit boundary
33 */ 33 */
34asmlinkage unsigned int csum_partial(const unsigned char *buff, 34asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
35 int len, unsigned int sum);
36 35
37/* 36/*
38 * The same as csum_partial, but copies from src while it checksums. 37 * The same as csum_partial, but copies from src while it checksums.
@@ -40,24 +39,22 @@ asmlinkage unsigned int csum_partial(const unsigned char *buff,
40 * Here even more important to align src and dst on a 32-bit (or even 39 * Here even more important to align src and dst on a 32-bit (or even
41 * better 64-bit) boundary 40 * better 64-bit) boundary
42 */ 41 */
43extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, 42extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,
44 unsigned char *dst, 43 int len, __wsum sum);
45 int len, unsigned int sum);
46 44
47/* 45/*
48 * This is a new version of the above that records errors it finds in *errp, 46 * This is a new version of the above that records errors it finds in *errp,
49 * but continues and zeros thre rest of the buffer. 47 * but continues and zeros thre rest of the buffer.
50 */ 48 */
51extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src, 49extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
52 unsigned char *dst, 50 int len, __wsum sum,
53 int len, unsigned int sum,
54 int *err_ptr); 51 int *err_ptr);
55 52
56/* 53/*
57 * Fold a partial checksum 54 * Fold a partial checksum
58 */ 55 */
59 56
60static inline unsigned int csum_fold(unsigned int sum) 57static inline __sum16 csum_fold(__wsum sum)
61{ 58{
62 unsigned long tmpreg; 59 unsigned long tmpreg;
63 __asm__( 60 __asm__(
@@ -72,16 +69,17 @@ static inline unsigned int csum_fold(unsigned int sum)
72 : "0" (sum) 69 : "0" (sum)
73 : "cbit" 70 : "cbit"
74 ); 71 );
75 return sum; 72 return (__force __sum16)sum;
76} 73}
77 74
78/* 75/*
79 * This is a version of ip_compute_csum() optimized for IP headers, 76 * This is a version of ip_compute_csum() optimized for IP headers,
80 * which always checksum on 4 octet boundaries. 77 * which always checksum on 4 octet boundaries.
81 */ 78 */
82static inline unsigned short ip_fast_csum(unsigned char * iph, 79static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
83 unsigned int ihl) { 80{
84 unsigned long sum, tmpreg0, tmpreg1; 81 unsigned long tmpreg0, tmpreg1;
82 __wsum sum;
85 83
86 __asm__ __volatile__( 84 __asm__ __volatile__(
87 " ld %0, @%1+ \n" 85 " ld %0, @%1+ \n"
@@ -115,16 +113,15 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
115 return csum_fold(sum); 113 return csum_fold(sum);
116} 114}
117 115
118static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 116static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
119 unsigned long daddr,
120 unsigned short len, 117 unsigned short len,
121 unsigned short proto, 118 unsigned short proto,
122 unsigned int sum) 119 __wsum sum)
123{ 120{
124#if defined(__LITTLE_ENDIAN) 121#if defined(__LITTLE_ENDIAN)
125 unsigned long len_proto = (ntohs(len)<<16)+proto*256; 122 unsigned long len_proto = (proto + len) << 8;
126#else 123#else
127 unsigned long len_proto = (proto<<16)+len; 124 unsigned long len_proto = proto + len;
128#endif 125#endif
129 unsigned long tmpreg; 126 unsigned long tmpreg;
130 127
@@ -147,11 +144,10 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
147 * computes the checksum of the TCP/UDP pseudo-header 144 * computes the checksum of the TCP/UDP pseudo-header
148 * returns a 16-bit checksum, already complemented 145 * returns a 16-bit checksum, already complemented
149 */ 146 */
150static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 147static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
151 unsigned long daddr,
152 unsigned short len, 148 unsigned short len,
153 unsigned short proto, 149 unsigned short proto,
154 unsigned int sum) 150 __wsum sum)
155{ 151{
156 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 152 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
157} 153}
@@ -161,16 +157,16 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
161 * in icmp.c 157 * in icmp.c
162 */ 158 */
163 159
164static inline unsigned short ip_compute_csum(unsigned char * buff, int len) { 160static inline __sum16 ip_compute_csum(const void *buff, int len)
161{
165 return csum_fold (csum_partial(buff, len, 0)); 162 return csum_fold (csum_partial(buff, len, 0));
166} 163}
167 164
168#define _HAVE_ARCH_IPV6_CSUM 165#define _HAVE_ARCH_IPV6_CSUM
169static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 166static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
170 struct in6_addr *daddr, 167 const struct in6_addr *daddr,
171 __u16 len, 168 __u32 len, unsigned short proto,
172 unsigned short proto, 169 __wsum sum)
173 unsigned int sum)
174{ 170{
175 unsigned long tmpreg0, tmpreg1, tmpreg2, tmpreg3; 171 unsigned long tmpreg0, tmpreg1, tmpreg2, tmpreg3;
176 __asm__( 172 __asm__(
@@ -197,7 +193,7 @@ static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
197 : "=&r" (sum), "=&r" (tmpreg0), "=&r" (tmpreg1), 193 : "=&r" (sum), "=&r" (tmpreg0), "=&r" (tmpreg1),
198 "=&r" (tmpreg2), "=&r" (tmpreg3) 194 "=&r" (tmpreg2), "=&r" (tmpreg3)
199 : "r" (saddr), "r" (daddr), 195 : "r" (saddr), "r" (daddr),
200 "r" (htonl((__u32) (len))), "r" (htonl(proto)), "0" (sum) 196 "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)
201 : "cbit" 197 : "cbit"
202 ); 198 );
203 199
diff --git a/include/asm-m32r/device.h b/include/asm-m32r/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-m32r/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-m32r/setup.h b/include/asm-m32r/setup.h
index 52f4fa29abfc..6a0b32202d4e 100644
--- a/include/asm-m32r/setup.h
+++ b/include/asm-m32r/setup.h
@@ -1,6 +1,11 @@
1/* 1/*
2 * This is set up by the setup-routine at boot-time 2 * This is set up by the setup-routine at boot-time
3 */ 3 */
4
5#define COMMAND_LINE_SIZE 512
6
7#ifdef __KERNEL__
8
4#define PARAM ((unsigned char *)empty_zero_page) 9#define PARAM ((unsigned char *)empty_zero_page)
5 10
6#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) 11#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000))
@@ -18,8 +23,6 @@
18 23
19#define SCREEN_INFO (*(struct screen_info *) (PARAM+0x200)) 24#define SCREEN_INFO (*(struct screen_info *) (PARAM+0x200))
20 25
21#define COMMAND_LINE_SIZE (512)
22
23#define RAMDISK_IMAGE_START_MASK (0x07FF) 26#define RAMDISK_IMAGE_START_MASK (0x07FF)
24#define RAMDISK_PROMPT_FLAG (0x8000) 27#define RAMDISK_PROMPT_FLAG (0x8000)
25#define RAMDISK_LOAD_FLAG (0x4000) 28#define RAMDISK_LOAD_FLAG (0x4000)
@@ -27,3 +30,5 @@
27extern unsigned long memory_start; 30extern unsigned long memory_start;
28extern unsigned long memory_end; 31extern unsigned long memory_end;
29 32
33#endif /* __KERNEL__ */
34
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index 95aa34298d82..5b66bd3c6ed6 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -296,117 +296,6 @@
296#ifdef __KERNEL__ 296#ifdef __KERNEL__
297 297
298#define NR_syscalls 285 298#define NR_syscalls 285
299#include <linux/err.h>
300
301/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
302 * <asm-m32r/errno.h>
303 */
304
305#include <asm/syscall.h> /* SYSCALL_* */
306
307#define __syscall_return(type, res) \
308do { \
309 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
310 /* Avoid using "res" which is declared to be in register r0; \
311 errno might expand to a function call and clobber it. */ \
312 int __err = -(res); \
313 errno = __err; \
314 res = -1; \
315 } \
316 return (type) (res); \
317} while (0)
318
319#define _syscall0(type,name) \
320type name(void) \
321{ \
322register long __scno __asm__ ("r7") = __NR_##name; \
323register long __res __asm__("r0"); \
324__asm__ __volatile__ (\
325 "trap #" SYSCALL_VECTOR "|| nop"\
326 : "=r" (__res) \
327 : "r" (__scno) \
328 : "memory"); \
329__syscall_return(type,__res); \
330}
331
332#define _syscall1(type,name,type1,arg1) \
333type name(type1 arg1) \
334{ \
335register long __scno __asm__ ("r7") = __NR_##name; \
336register long __res __asm__ ("r0") = (long)(arg1); \
337__asm__ __volatile__ (\
338 "trap #" SYSCALL_VECTOR "|| nop"\
339 : "=r" (__res) \
340 : "r" (__scno), "0" (__res) \
341 : "memory"); \
342__syscall_return(type,__res); \
343}
344
345#define _syscall2(type,name,type1,arg1,type2,arg2) \
346type name(type1 arg1,type2 arg2) \
347{ \
348register long __scno __asm__ ("r7") = __NR_##name; \
349register long __arg2 __asm__ ("r1") = (long)(arg2); \
350register long __res __asm__ ("r0") = (long)(arg1); \
351__asm__ __volatile__ (\
352 "trap #" SYSCALL_VECTOR "|| nop"\
353 : "=r" (__res) \
354 : "r" (__scno), "0" (__res), "r" (__arg2) \
355 : "memory"); \
356__syscall_return(type,__res); \
357}
358
359#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
360type name(type1 arg1,type2 arg2,type3 arg3) \
361{ \
362register long __scno __asm__ ("r7") = __NR_##name; \
363register long __arg3 __asm__ ("r2") = (long)(arg3); \
364register long __arg2 __asm__ ("r1") = (long)(arg2); \
365register long __res __asm__ ("r0") = (long)(arg1); \
366__asm__ __volatile__ (\
367 "trap #" SYSCALL_VECTOR "|| nop"\
368 : "=r" (__res) \
369 : "r" (__scno), "0" (__res), "r" (__arg2), \
370 "r" (__arg3) \
371 : "memory"); \
372__syscall_return(type,__res); \
373}
374
375#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
376type name(type1 arg1,type2 arg2,type3 arg3,type4 arg4) \
377{ \
378register long __scno __asm__ ("r7") = __NR_##name; \
379register long __arg4 __asm__ ("r3") = (long)(arg4); \
380register long __arg3 __asm__ ("r2") = (long)(arg3); \
381register long __arg2 __asm__ ("r1") = (long)(arg2); \
382register long __res __asm__ ("r0") = (long)(arg1); \
383__asm__ __volatile__ (\
384 "trap #" SYSCALL_VECTOR "|| nop"\
385 : "=r" (__res) \
386 : "r" (__scno), "0" (__res), "r" (__arg2), \
387 "r" (__arg3), "r" (__arg4) \
388 : "memory"); \
389__syscall_return(type,__res); \
390}
391
392#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
393 type5,arg5) \
394type name(type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
395{ \
396register long __scno __asm__ ("r7") = __NR_##name; \
397register long __arg5 __asm__ ("r4") = (long)(arg5); \
398register long __arg4 __asm__ ("r3") = (long)(arg4); \
399register long __arg3 __asm__ ("r2") = (long)(arg3); \
400register long __arg2 __asm__ ("r1") = (long)(arg2); \
401register long __res __asm__ ("r0") = (long)(arg1); \
402__asm__ __volatile__ (\
403 "trap #" SYSCALL_VECTOR "|| nop"\
404 : "=r" (__res) \
405 : "r" (__scno), "0" (__res), "r" (__arg2), \
406 "r" (__arg3), "r" (__arg4), "r" (__arg5) \
407 : "memory"); \
408__syscall_return(type,__res); \
409}
410 299
411#define __ARCH_WANT_IPC_PARSE_VERSION 300#define __ARCH_WANT_IPC_PARSE_VERSION
412#define __ARCH_WANT_STAT64 301#define __ARCH_WANT_STAT64
diff --git a/include/asm-m68k/checksum.h b/include/asm-m68k/checksum.h
index 17280ef719f5..494f9aec37ea 100644
--- a/include/asm-m68k/checksum.h
+++ b/include/asm-m68k/checksum.h
@@ -15,7 +15,7 @@
15 * 15 *
16 * it's best to have buff aligned on a 32-bit boundary 16 * it's best to have buff aligned on a 32-bit boundary
17 */ 17 */
18unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 18__wsum csum_partial(const void *buff, int len, __wsum sum);
19 19
20/* 20/*
21 * the same as csum_partial, but copies from src while it 21 * the same as csum_partial, but copies from src while it
@@ -25,22 +25,21 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
25 * better 64-bit) boundary 25 * better 64-bit) boundary
26 */ 26 */
27 27
28extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src, 28extern __wsum csum_partial_copy_from_user(const void __user *src,
29 unsigned char *dst, 29 void *dst,
30 int len, int sum, 30 int len, __wsum sum,
31 int *csum_err); 31 int *csum_err);
32 32
33extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, 33extern __wsum csum_partial_copy_nocheck(const void *src,
34 unsigned char *dst, int len, 34 void *dst, int len,
35 int sum); 35 __wsum sum);
36 36
37/* 37/*
38 * This is a version of ip_compute_csum() optimized for IP headers, 38 * This is a version of ip_compute_csum() optimized for IP headers,
39 * which always checksum on 4 octet boundaries. 39 * which always checksum on 4 octet boundaries.
40 * 40 *
41 */ 41 */
42static inline unsigned short 42static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
43ip_fast_csum(unsigned char *iph, unsigned int ihl)
44{ 43{
45 unsigned int sum = 0; 44 unsigned int sum = 0;
46 unsigned long tmp; 45 unsigned long tmp;
@@ -58,29 +57,29 @@ ip_fast_csum(unsigned char *iph, unsigned int ihl)
58 : "=d" (sum), "=&a" (iph), "=&d" (ihl), "=&d" (tmp) 57 : "=d" (sum), "=&a" (iph), "=&d" (ihl), "=&d" (tmp)
59 : "0" (sum), "1" (iph), "2" (ihl) 58 : "0" (sum), "1" (iph), "2" (ihl)
60 : "memory"); 59 : "memory");
61 return ~sum; 60 return (__force __sum16)~sum;
62} 61}
63 62
64/* 63/*
65 * Fold a partial checksum 64 * Fold a partial checksum
66 */ 65 */
67 66
68static inline unsigned int csum_fold(unsigned int sum) 67static inline __sum16 csum_fold(__wsum sum)
69{ 68{
70 unsigned int tmp = sum; 69 unsigned int tmp = (__force u32)sum;
71 __asm__("swap %1\n\t" 70 __asm__("swap %1\n\t"
72 "addw %1, %0\n\t" 71 "addw %1, %0\n\t"
73 "clrw %1\n\t" 72 "clrw %1\n\t"
74 "addxw %1, %0" 73 "addxw %1, %0"
75 : "=&d" (sum), "=&d" (tmp) 74 : "=&d" (sum), "=&d" (tmp)
76 : "0" (sum), "1" (tmp)); 75 : "0" (sum), "1" (tmp));
77 return ~sum; 76 return (__force __sum16)~sum;
78} 77}
79 78
80 79
81static inline unsigned int 80static inline __wsum
82csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 81csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
83 unsigned short proto, unsigned int sum) 82 unsigned short proto, __wsum sum)
84{ 83{
85 __asm__ ("addl %2,%0\n\t" 84 __asm__ ("addl %2,%0\n\t"
86 "addxl %3,%0\n\t" 85 "addxl %3,%0\n\t"
@@ -98,9 +97,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
98 * computes the checksum of the TCP/UDP pseudo-header 97 * computes the checksum of the TCP/UDP pseudo-header
99 * returns a 16-bit checksum, already complemented 98 * returns a 16-bit checksum, already complemented
100 */ 99 */
101static inline unsigned short int 100static inline __sum16
102csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 101csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
103 unsigned short proto, unsigned int sum) 102 unsigned short proto, __wsum sum)
104{ 103{
105 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 104 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
106} 105}
@@ -110,16 +109,15 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
110 * in icmp.c 109 * in icmp.c
111 */ 110 */
112 111
113static inline unsigned short 112static inline __sum16 ip_compute_csum(const void *buff, int len)
114ip_compute_csum(unsigned char * buff, int len)
115{ 113{
116 return csum_fold (csum_partial(buff, len, 0)); 114 return csum_fold (csum_partial(buff, len, 0));
117} 115}
118 116
119#define _HAVE_ARCH_IPV6_CSUM 117#define _HAVE_ARCH_IPV6_CSUM
120static __inline__ unsigned short int 118static __inline__ __sum16
121csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, 119csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
122 __u32 len, unsigned short proto, unsigned int sum) 120 __u32 len, unsigned short proto, __wsum sum)
123{ 121{
124 register unsigned long tmp; 122 register unsigned long tmp;
125 __asm__("addl %2@,%0\n\t" 123 __asm__("addl %2@,%0\n\t"
diff --git a/include/asm-m68k/device.h b/include/asm-m68k/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-m68k/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-m68k/dma-mapping.h b/include/asm-m68k/dma-mapping.h
index d90d841d3dfd..00259ed6fc95 100644
--- a/include/asm-m68k/dma-mapping.h
+++ b/include/asm-m68k/dma-mapping.h
@@ -21,7 +21,7 @@ static inline int dma_get_cache_alignment(void)
21 return 1 << L1_CACHE_SHIFT; 21 return 1 << L1_CACHE_SHIFT;
22} 22}
23 23
24static inline int dma_is_consistent(dma_addr_t dma_addr) 24static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
25{ 25{
26 return 0; 26 return 0;
27} 27}
@@ -41,7 +41,7 @@ static inline void dma_free_noncoherent(struct device *dev, size_t size,
41{ 41{
42 dma_free_coherent(dev, size, addr, handle); 42 dma_free_coherent(dev, size, addr, handle);
43} 43}
44static inline void dma_cache_sync(void *vaddr, size_t size, 44static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
45 enum dma_data_direction dir) 45 enum dma_data_direction dir)
46{ 46{
47 /* we use coherent allocation, so not much to do here. */ 47 /* we use coherent allocation, so not much to do here. */
diff --git a/include/asm-m68k/setup.h b/include/asm-m68k/setup.h
index 7facc9a46e74..2a8853cd6554 100644
--- a/include/asm-m68k/setup.h
+++ b/include/asm-m68k/setup.h
@@ -41,8 +41,12 @@
41#define MACH_Q40 10 41#define MACH_Q40 10
42#define MACH_SUN3X 11 42#define MACH_SUN3X 11
43 43
44#define COMMAND_LINE_SIZE 256
45
44#ifdef __KERNEL__ 46#ifdef __KERNEL__
45 47
48#define CL_SIZE COMMAND_LINE_SIZE
49
46#ifndef __ASSEMBLY__ 50#ifndef __ASSEMBLY__
47extern unsigned long m68k_machtype; 51extern unsigned long m68k_machtype;
48#endif /* !__ASSEMBLY__ */ 52#endif /* !__ASSEMBLY__ */
@@ -355,8 +359,6 @@ extern int m68k_is040or060;
355 */ 359 */
356 360
357#define NUM_MEMINFO 4 361#define NUM_MEMINFO 4
358#define CL_SIZE 256
359#define COMMAND_LINE_SIZE CL_SIZE
360 362
361#ifndef __ASSEMBLY__ 363#ifndef __ASSEMBLY__
362struct mem_info { 364struct mem_info {
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
index ad4348058c66..fdbb60e6a0d4 100644
--- a/include/asm-m68k/unistd.h
+++ b/include/asm-m68k/unistd.h
@@ -317,103 +317,6 @@
317#ifdef __KERNEL__ 317#ifdef __KERNEL__
318 318
319#define NR_syscalls 311 319#define NR_syscalls 311
320#include <linux/err.h>
321
322/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
323 <asm-m68k/errno.h> */
324
325#define __syscall_return(type, res) \
326do { \
327 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
328 /* avoid using res which is declared to be in register d0; \
329 errno might expand to a function call and clobber it. */ \
330 int __err = -(res); \
331 errno = __err; \
332 res = -1; \
333 } \
334 return (type) (res); \
335} while (0)
336
337#define _syscall0(type,name) \
338type name(void) \
339{ \
340register long __res __asm__ ("%d0") = __NR_##name; \
341__asm__ __volatile__ ("trap #0" \
342 : "+d" (__res) ); \
343__syscall_return(type,__res); \
344}
345
346#define _syscall1(type,name,atype,a) \
347type name(atype a) \
348{ \
349register long __res __asm__ ("%d0") = __NR_##name; \
350register long __a __asm__ ("%d1") = (long)(a); \
351__asm__ __volatile__ ("trap #0" \
352 : "+d" (__res) \
353 : "d" (__a) ); \
354__syscall_return(type,__res); \
355}
356
357#define _syscall2(type,name,atype,a,btype,b) \
358type name(atype a,btype b) \
359{ \
360register long __res __asm__ ("%d0") = __NR_##name; \
361register long __a __asm__ ("%d1") = (long)(a); \
362register long __b __asm__ ("%d2") = (long)(b); \
363__asm__ __volatile__ ("trap #0" \
364 : "+d" (__res) \
365 : "d" (__a), "d" (__b) \
366 ); \
367__syscall_return(type,__res); \
368}
369
370#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
371type name(atype a,btype b,ctype c) \
372{ \
373register long __res __asm__ ("%d0") = __NR_##name; \
374register long __a __asm__ ("%d1") = (long)(a); \
375register long __b __asm__ ("%d2") = (long)(b); \
376register long __c __asm__ ("%d3") = (long)(c); \
377__asm__ __volatile__ ("trap #0" \
378 : "+d" (__res) \
379 : "d" (__a), "d" (__b), \
380 "d" (__c) \
381 ); \
382__syscall_return(type,__res); \
383}
384
385#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
386type name (atype a, btype b, ctype c, dtype d) \
387{ \
388register long __res __asm__ ("%d0") = __NR_##name; \
389register long __a __asm__ ("%d1") = (long)(a); \
390register long __b __asm__ ("%d2") = (long)(b); \
391register long __c __asm__ ("%d3") = (long)(c); \
392register long __d __asm__ ("%d4") = (long)(d); \
393__asm__ __volatile__ ("trap #0" \
394 : "+d" (__res) \
395 : "d" (__a), "d" (__b), \
396 "d" (__c), "d" (__d) \
397 ); \
398__syscall_return(type,__res); \
399}
400
401#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
402type name (atype a,btype b,ctype c,dtype d,etype e) \
403{ \
404register long __res __asm__ ("%d0") = __NR_##name; \
405register long __a __asm__ ("%d1") = (long)(a); \
406register long __b __asm__ ("%d2") = (long)(b); \
407register long __c __asm__ ("%d3") = (long)(c); \
408register long __d __asm__ ("%d4") = (long)(d); \
409register long __e __asm__ ("%d5") = (long)(e); \
410__asm__ __volatile__ ("trap #0" \
411 : "+d" (__res) \
412 : "d" (__a), "d" (__b), \
413 "d" (__c), "d" (__d), "d" (__e) \
414 ); \
415__syscall_return(type,__res); \
416}
417 320
418#define __ARCH_WANT_IPC_PARSE_VERSION 321#define __ARCH_WANT_IPC_PARSE_VERSION
419#define __ARCH_WANT_OLD_READDIR 322#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-m68knommu/checksum.h b/include/asm-m68knommu/checksum.h
index 294ec7583ac9..81883482ffb1 100644
--- a/include/asm-m68knommu/checksum.h
+++ b/include/asm-m68knommu/checksum.h
@@ -15,7 +15,7 @@
15 * 15 *
16 * it's best to have buff aligned on a 32-bit boundary 16 * it's best to have buff aligned on a 32-bit boundary
17 */ 17 */
18unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 18__wsum csum_partial(const void *buff, int len, __wsum sum);
19 19
20/* 20/*
21 * the same as csum_partial, but copies from src while it 21 * the same as csum_partial, but copies from src while it
@@ -25,8 +25,8 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
25 * better 64-bit) boundary 25 * better 64-bit) boundary
26 */ 26 */
27 27
28unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, 28__wsum csum_partial_copy_nocheck(const void *src, void *dst,
29 int len, int sum); 29 int len, __wsum sum);
30 30
31 31
32/* 32/*
@@ -36,33 +36,31 @@ unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst,
36 * better 64-bit) boundary 36 * better 64-bit) boundary
37 */ 37 */
38 38
39extern unsigned int csum_partial_copy_from_user(const unsigned char *src, 39extern __wsum csum_partial_copy_from_user(const void __user *src,
40 unsigned char *dst, int len, int sum, int *csum_err); 40 void *dst, int len, __wsum sum, int *csum_err);
41 41
42#define csum_partial_copy_nocheck(src, dst, len, sum) \ 42__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
43 csum_partial_copy((src), (dst), (len), (sum))
44
45unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl);
46 43
47/* 44/*
48 * Fold a partial checksum 45 * Fold a partial checksum
49 */ 46 */
50 47
51static inline unsigned int csum_fold(unsigned int sum) 48static inline __sum16 csum_fold(__wsum sum)
52{ 49{
50 unsigned int tmp = (__force u32)sum;
53#ifdef CONFIG_COLDFIRE 51#ifdef CONFIG_COLDFIRE
54 sum = (sum & 0xffff) + (sum >> 16); 52 tmp = (tmp & 0xffff) + (tmp >> 16);
55 sum = (sum & 0xffff) + (sum >> 16); 53 tmp = (tmp & 0xffff) + (tmp >> 16);
54 return (__force __sum16)~tmp;
56#else 55#else
57 unsigned int tmp = sum;
58 __asm__("swap %1\n\t" 56 __asm__("swap %1\n\t"
59 "addw %1, %0\n\t" 57 "addw %1, %0\n\t"
60 "clrw %1\n\t" 58 "clrw %1\n\t"
61 "addxw %1, %0" 59 "addxw %1, %0"
62 : "=&d" (sum), "=&d" (tmp) 60 : "=&d" (sum), "=&d" (tmp)
63 : "0" (sum), "1" (sum)); 61 : "0" (sum), "1" (sum));
62 return (__force __sum16)~sum;
64#endif 63#endif
65 return ~sum;
66} 64}
67 65
68 66
@@ -71,9 +69,9 @@ static inline unsigned int csum_fold(unsigned int sum)
71 * returns a 16-bit checksum, already complemented 69 * returns a 16-bit checksum, already complemented
72 */ 70 */
73 71
74static inline unsigned int 72static inline __wsum
75csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 73csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
76 unsigned short proto, unsigned int sum) 74 unsigned short proto, __wsum sum)
77{ 75{
78 __asm__ ("addl %1,%0\n\t" 76 __asm__ ("addl %1,%0\n\t"
79 "addxl %4,%0\n\t" 77 "addxl %4,%0\n\t"
@@ -86,9 +84,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
86 return sum; 84 return sum;
87} 85}
88 86
89static inline unsigned short int 87static inline __sum16
90csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 88csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
91 unsigned short proto, unsigned int sum) 89 unsigned short proto, __wsum sum)
92{ 90{
93 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 91 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
94} 92}
@@ -98,12 +96,12 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
98 * in icmp.c 96 * in icmp.c
99 */ 97 */
100 98
101extern unsigned short ip_compute_csum(const unsigned char * buff, int len); 99extern __sum16 ip_compute_csum(const void *buff, int len);
102 100
103#define _HAVE_ARCH_IPV6_CSUM 101#define _HAVE_ARCH_IPV6_CSUM
104static __inline__ unsigned short int 102static __inline__ __sum16
105csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, 103csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
106 __u32 len, unsigned short proto, unsigned int sum) 104 __u32 len, unsigned short proto, __wsum sum)
107{ 105{
108 register unsigned long tmp; 106 register unsigned long tmp;
109 __asm__("addl %2@,%0\n\t" 107 __asm__("addl %2@,%0\n\t"
diff --git a/include/asm-m68knommu/device.h b/include/asm-m68knommu/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-m68knommu/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-m68knommu/dma-mapping.h b/include/asm-m68knommu/dma-mapping.h
index 5622b855a577..6aeab18e58bd 100644
--- a/include/asm-m68knommu/dma-mapping.h
+++ b/include/asm-m68knommu/dma-mapping.h
@@ -1,9 +1,10 @@
1#ifndef _M68KNOMMU_DMA_MAPPING_H 1#ifndef _M68KNOMMU_DMA_MAPPING_H
2#define _M68KNOMMU_DMA_MAPPING_H 2#define _M68KNOMMU_DMA_MAPPING_H
3 3
4
5#ifdef CONFIG_PCI 4#ifdef CONFIG_PCI
6#include <asm-generic/dma-mapping.h> 5#include <asm-generic/dma-mapping.h>
6#else
7#include <asm-generic/dma-mapping-broken.h>
7#endif 8#endif
8 9
9#endif /* _M68KNOMMU_DMA_MAPPING_H */ 10#endif /* _M68KNOMMU_DMA_MAPPING_H */
diff --git a/include/asm-m68knommu/irq.h b/include/asm-m68knommu/irq.h
index 45e7a2fd1689..7b8f874f8429 100644
--- a/include/asm-m68knommu/irq.h
+++ b/include/asm-m68knommu/irq.h
@@ -86,5 +86,6 @@ extern void (*mach_disable_irq)(unsigned int);
86#define enable_irq(x) do { } while (0) 86#define enable_irq(x) do { } while (0)
87#define disable_irq(x) do { } while (0) 87#define disable_irq(x) do { } while (0)
88#define disable_irq_nosync(x) disable_irq(x) 88#define disable_irq_nosync(x) disable_irq(x)
89#define irq_canonicalize(irq) (irq)
89 90
90#endif /* _M68K_IRQ_H_ */ 91#endif /* _M68K_IRQ_H_ */
diff --git a/include/asm-m68knommu/irq_regs.h b/include/asm-m68knommu/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-m68knommu/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/include/asm-m68knommu/irqnode.h b/include/asm-m68knommu/irqnode.h
index a2503dfc554c..6132a9858b52 100644
--- a/include/asm-m68knommu/irqnode.h
+++ b/include/asm-m68knommu/irqnode.h
@@ -8,7 +8,7 @@
8 * interrupt source (if it supports chaining). 8 * interrupt source (if it supports chaining).
9 */ 9 */
10typedef struct irq_node { 10typedef struct irq_node {
11 irqreturn_t (*handler)(int, void *, struct pt_regs *); 11 irq_handler_t handler;
12 unsigned long flags; 12 unsigned long flags;
13 void *dev_id; 13 void *dev_id;
14 const char *devname; 14 const char *devname;
@@ -18,12 +18,12 @@ typedef struct irq_node {
18/* 18/*
19 * This structure has only 4 elements for speed reasons 19 * This structure has only 4 elements for speed reasons
20 */ 20 */
21typedef struct irq_handler { 21struct irq_entry {
22 irqreturn_t (*handler)(int, void *, struct pt_regs *); 22 irq_handler_t handler;
23 unsigned long flags; 23 unsigned long flags;
24 void *dev_id; 24 void *dev_id;
25 const char *devname; 25 const char *devname;
26} irq_handler_t; 26};
27 27
28/* count of spurious interrupts */ 28/* count of spurious interrupts */
29extern volatile unsigned int num_spurious; 29extern volatile unsigned int num_spurious;
diff --git a/include/asm-m68knommu/m520xsim.h b/include/asm-m68knommu/m520xsim.h
index 1dac22ea95ba..49d016e6391a 100644
--- a/include/asm-m68knommu/m520xsim.h
+++ b/include/asm-m68knommu/m520xsim.h
@@ -31,6 +31,16 @@
31#define MCFINT_QSPI 31 /* Interrupt number for QSPI */ 31#define MCFINT_QSPI 31 /* Interrupt number for QSPI */
32#define MCFINT_PIT1 4 /* Interrupt number for PIT1 (PIT0 in processor) */ 32#define MCFINT_PIT1 4 /* Interrupt number for PIT1 (PIT0 in processor) */
33 33
34/*
35 * SDRAM configuration registers.
36 */
37#define MCFSIM_SDMR 0x000a8000 /* SDRAM Mode/Extended Mode Register */
38#define MCFSIM_SDCR 0x000a8004 /* SDRAM Control Register */
39#define MCFSIM_SDCFG1 0x000a8008 /* SDRAM Configuration Register 1 */
40#define MCFSIM_SDCFG2 0x000a800c /* SDRAM Configuration Register 2 */
41#define MCFSIM_SDCS0 0x000a8110 /* SDRAM Chip Select 0 Configuration */
42#define MCFSIM_SDCS1 0x000a8114 /* SDRAM Chip Select 1 Configuration */
43
34 44
35#define MCF_GPIO_PAR_UART (0xA4036) 45#define MCF_GPIO_PAR_UART (0xA4036)
36#define MCF_GPIO_PAR_FECI2C (0xA4033) 46#define MCF_GPIO_PAR_FECI2C (0xA4033)
@@ -47,7 +57,7 @@
47 57
48#define ICR_INTRCONF 0x05 58#define ICR_INTRCONF 0x05
49#define MCFPIT_IMR MCFINTC_IMRL 59#define MCFPIT_IMR MCFINTC_IMRL
50#define MCFPIT_IMR_IBIT (1 << MCFINT_PIT1) 60#define MCFPIT_IMR_IBIT (1 << MCFINT_PIT1)
51 61
52/****************************************************************************/ 62/****************************************************************************/
53#endif /* m520xsim_h */ 63#endif /* m520xsim_h */
diff --git a/include/asm-m68knommu/machdep.h b/include/asm-m68knommu/machdep.h
index 27c90afd3339..6ce28f8e0ead 100644
--- a/include/asm-m68knommu/machdep.h
+++ b/include/asm-m68knommu/machdep.h
@@ -18,7 +18,7 @@ extern int (*mach_kbdrate) (struct kbd_repeat *);
18extern void (*mach_kbd_leds) (unsigned int); 18extern void (*mach_kbd_leds) (unsigned int);
19/* machine dependent irq functions */ 19/* machine dependent irq functions */
20extern void (*mach_init_IRQ) (void); 20extern void (*mach_init_IRQ) (void);
21extern irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *); 21extern irq_handler_t mach_default_handler;
22extern int (*mach_request_irq) (unsigned int irq, void (*handler)(int, void *, struct pt_regs *), 22extern int (*mach_request_irq) (unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
23 unsigned long flags, const char *devname, void *dev_id); 23 unsigned long flags, const char *devname, void *dev_id);
24extern void (*mach_free_irq) (unsigned int irq, void *dev_id); 24extern void (*mach_free_irq) (unsigned int irq, void *dev_id);
diff --git a/include/asm-m68knommu/mcfmbus.h b/include/asm-m68knommu/mcfmbus.h
index 13df9d41bd1a..319899c47a2c 100644
--- a/include/asm-m68knommu/mcfmbus.h
+++ b/include/asm-m68knommu/mcfmbus.h
@@ -37,7 +37,7 @@
37#define MCFMBUS_MFDR_MBC(a) ((a)&0x3F) /*M-Bus Clock*/ 37#define MCFMBUS_MFDR_MBC(a) ((a)&0x3F) /*M-Bus Clock*/
38 38
39/* 39/*
40* Define bit flags in Controll Register 40* Define bit flags in Control Register
41*/ 41*/
42 42
43#define MCFMBUS_MBCR_MEN (0x80) /* M-Bus Enable */ 43#define MCFMBUS_MBCR_MEN (0x80) /* M-Bus Enable */
diff --git a/include/asm-m68knommu/rtc.h b/include/asm-m68knommu/rtc.h
new file mode 100644
index 000000000000..eaf18ec83c8e
--- /dev/null
+++ b/include/asm-m68knommu/rtc.h
@@ -0,0 +1 @@
#include <asm-m68k/rtc.h>
diff --git a/include/asm-m68knommu/scatterlist.h b/include/asm-m68knommu/scatterlist.h
index 12309b181d29..2085d6ff8782 100644
--- a/include/asm-m68knommu/scatterlist.h
+++ b/include/asm-m68knommu/scatterlist.h
@@ -10,7 +10,7 @@ struct scatterlist {
10 unsigned int length; 10 unsigned int length;
11}; 11};
12 12
13#define sg_address(sg) (page_address((sg)->page) + (sg)->offset 13#define sg_address(sg) (page_address((sg)->page) + (sg)->offset)
14#define sg_dma_address(sg) ((sg)->dma_address) 14#define sg_dma_address(sg) ((sg)->dma_address)
15#define sg_dma_len(sg) ((sg)->length) 15#define sg_dma_len(sg) ((sg)->length)
16 16
diff --git a/include/asm-m68knommu/setup.h b/include/asm-m68knommu/setup.h
index d2b0fcce41b2..fb86bb2a6078 100644
--- a/include/asm-m68knommu/setup.h
+++ b/include/asm-m68knommu/setup.h
@@ -1,5 +1,10 @@
1#ifdef __KERNEL__
2
1#include <asm-m68k/setup.h> 3#include <asm-m68k/setup.h>
2 4
3/* We have a bigger command line buffer. */ 5/* We have a bigger command line buffer. */
4#undef COMMAND_LINE_SIZE 6#undef COMMAND_LINE_SIZE
7
8#endif /* __KERNEL__ */
9
5#define COMMAND_LINE_SIZE 512 10#define COMMAND_LINE_SIZE 512
diff --git a/include/asm-m68knommu/ucontext.h b/include/asm-m68knommu/ucontext.h
index 5d570cedbb02..713a27f901cd 100644
--- a/include/asm-m68knommu/ucontext.h
+++ b/include/asm-m68knommu/ucontext.h
@@ -5,21 +5,17 @@ typedef int greg_t;
5#define NGREG 18 5#define NGREG 18
6typedef greg_t gregset_t[NGREG]; 6typedef greg_t gregset_t[NGREG];
7 7
8#ifdef CONFIG_FPU
9typedef struct fpregset { 8typedef struct fpregset {
10 int f_pcr; 9 int f_pcr;
11 int f_psr; 10 int f_psr;
12 int f_fpiaddr; 11 int f_fpiaddr;
13 int f_fpregs[8][3]; 12 int f_fpregs[8][3];
14} fpregset_t; 13} fpregset_t;
15#endif
16 14
17struct mcontext { 15struct mcontext {
18 int version; 16 int version;
19 gregset_t gregs; 17 gregset_t gregs;
20#ifdef CONFIG_FPU
21 fpregset_t fpregs; 18 fpregset_t fpregs;
22#endif
23}; 19};
24 20
25#define MCONTEXT_VERSION 2 21#define MCONTEXT_VERSION 2
@@ -29,9 +25,7 @@ struct ucontext {
29 struct ucontext *uc_link; 25 struct ucontext *uc_link;
30 stack_t uc_stack; 26 stack_t uc_stack;
31 struct mcontext uc_mcontext; 27 struct mcontext uc_mcontext;
32#ifdef CONFIG_FPU
33 unsigned long uc_filler[80]; 28 unsigned long uc_filler[80];
34#endif
35 sigset_t uc_sigmask; /* mask last for extensibility */ 29 sigset_t uc_sigmask; /* mask last for extensibility */
36}; 30};
37 31
diff --git a/include/asm-m68knommu/unistd.h b/include/asm-m68knommu/unistd.h
index ebaf03197114..82e03195f325 100644
--- a/include/asm-m68knommu/unistd.h
+++ b/include/asm-m68knommu/unistd.h
@@ -318,156 +318,6 @@
318#ifdef __KERNEL__ 318#ifdef __KERNEL__
319 319
320#define NR_syscalls 311 320#define NR_syscalls 311
321#include <linux/err.h>
322
323/* user-visible error numbers are in the range -1 - -MAX_ERRNO: see
324 <asm-m68k/errno.h> */
325
326#define __syscall_return(type, res) \
327do { \
328 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
329 /* avoid using res which is declared to be in register d0; \
330 errno might expand to a function call and clobber it. */ \
331 int __err = -(res); \
332 errno = __err; \
333 res = -1; \
334 } \
335 return (type) (res); \
336} while (0)
337
338#define _syscall0(type, name) \
339type name(void) \
340{ \
341 long __res; \
342 __asm__ __volatile__ ("movel %1, %%d0\n\t" \
343 "trap #0\n\t" \
344 "movel %%d0, %0" \
345 : "=g" (__res) \
346 : "i" (__NR_##name) \
347 : "cc", "%d0"); \
348 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
349 errno = -__res; \
350 __res = -1; \
351 } \
352 return (type)__res; \
353}
354
355#define _syscall1(type, name, atype, a) \
356type name(atype a) \
357{ \
358 long __res; \
359 __asm__ __volatile__ ("movel %2, %%d1\n\t" \
360 "movel %1, %%d0\n\t" \
361 "trap #0\n\t" \
362 "movel %%d0, %0" \
363 : "=g" (__res) \
364 : "i" (__NR_##name), \
365 "g" ((long)a) \
366 : "cc", "%d0", "%d1"); \
367 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
368 errno = -__res; \
369 __res = -1; \
370 } \
371 return (type)__res; \
372}
373
374#define _syscall2(type, name, atype, a, btype, b) \
375type name(atype a, btype b) \
376{ \
377 long __res; \
378 __asm__ __volatile__ ("movel %3, %%d2\n\t" \
379 "movel %2, %%d1\n\t" \
380 "movel %1, %%d0\n\t" \
381 "trap #0\n\t" \
382 "movel %%d0, %0" \
383 : "=g" (__res) \
384 : "i" (__NR_##name), \
385 "a" ((long)a), \
386 "g" ((long)b) \
387 : "cc", "%d0", "%d1", "%d2"); \
388 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
389 errno = -__res; \
390 __res = -1; \
391 } \
392 return (type)__res; \
393}
394
395#define _syscall3(type, name, atype, a, btype, b, ctype, c) \
396type name(atype a, btype b, ctype c) \
397{ \
398 long __res; \
399 __asm__ __volatile__ ("movel %4, %%d3\n\t" \
400 "movel %3, %%d2\n\t" \
401 "movel %2, %%d1\n\t" \
402 "movel %1, %%d0\n\t" \
403 "trap #0\n\t" \
404 "movel %%d0, %0" \
405 : "=g" (__res) \
406 : "i" (__NR_##name), \
407 "a" ((long)a), \
408 "a" ((long)b), \
409 "g" ((long)c) \
410 : "cc", "%d0", "%d1", "%d2", "%d3"); \
411 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
412 errno = -__res; \
413 __res = -1; \
414 } \
415 return (type)__res; \
416}
417
418#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \
419type name(atype a, btype b, ctype c, dtype d) \
420{ \
421 long __res; \
422 __asm__ __volatile__ ("movel %5, %%d4\n\t" \
423 "movel %4, %%d3\n\t" \
424 "movel %3, %%d2\n\t" \
425 "movel %2, %%d1\n\t" \
426 "movel %1, %%d0\n\t" \
427 "trap #0\n\t" \
428 "movel %%d0, %0" \
429 : "=g" (__res) \
430 : "i" (__NR_##name), \
431 "a" ((long)a), \
432 "a" ((long)b), \
433 "a" ((long)c), \
434 "g" ((long)d) \
435 : "cc", "%d0", "%d1", "%d2", "%d3", \
436 "%d4"); \
437 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
438 errno = -__res; \
439 __res = -1; \
440 } \
441 return (type)__res; \
442}
443
444#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e) \
445type name(atype a, btype b, ctype c, dtype d, etype e) \
446{ \
447 long __res; \
448 __asm__ __volatile__ ("movel %6, %%d5\n\t" \
449 "movel %5, %%d4\n\t" \
450 "movel %4, %%d3\n\t" \
451 "movel %3, %%d2\n\t" \
452 "movel %2, %%d1\n\t" \
453 "movel %1, %%d0\n\t" \
454 "trap #0\n\t" \
455 "movel %%d0, %0" \
456 : "=g" (__res) \
457 : "i" (__NR_##name), \
458 "a" ((long)a), \
459 "a" ((long)b), \
460 "a" ((long)c), \
461 "a" ((long)d), \
462 "g" ((long)e) \
463 : "cc", "%d0", "%d1", "%d2", "%d3", \
464 "%d4", "%d5"); \
465 if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
466 errno = -__res; \
467 __res = -1; \
468 } \
469 return (type)__res; \
470}
471 321
472#define __ARCH_WANT_IPC_PARSE_VERSION 322#define __ARCH_WANT_IPC_PARSE_VERSION
473#define __ARCH_WANT_OLD_READDIR 323#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
index 45c706e34df1..c6275088cf65 100644
--- a/include/asm-mips/addrspace.h
+++ b/include/asm-mips/addrspace.h
@@ -19,12 +19,16 @@
19#define _ATYPE_ 19#define _ATYPE_
20#define _ATYPE32_ 20#define _ATYPE32_
21#define _ATYPE64_ 21#define _ATYPE64_
22#define _LLCONST_(x) x 22#define _CONST64_(x) x
23#else 23#else
24#define _ATYPE_ __PTRDIFF_TYPE__ 24#define _ATYPE_ __PTRDIFF_TYPE__
25#define _ATYPE32_ int 25#define _ATYPE32_ int
26#define _ATYPE64_ long long 26#define _ATYPE64_ __s64
27#define _LLCONST_(x) x ## LL 27#ifdef CONFIG_64BIT
28#define _CONST64_(x) x ## L
29#else
30#define _CONST64_(x) x ## LL
31#endif
28#endif 32#endif
29 33
30/* 34/*
@@ -48,7 +52,7 @@
48 */ 52 */
49#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff) 53#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
50#define XPHYSADDR(a) ((_ACAST64_(a)) & \ 54#define XPHYSADDR(a) ((_ACAST64_(a)) & \
51 _LLCONST_(0x000000ffffffffff)) 55 _CONST64_(0x000000ffffffffff))
52 56
53#ifdef CONFIG_64BIT 57#ifdef CONFIG_64BIT
54 58
@@ -57,14 +61,14 @@
57 * The compatibility segments use the full 64-bit sign extended value. Note 61 * The compatibility segments use the full 64-bit sign extended value. Note
58 * the R8000 doesn't have them so don't reference these in generic MIPS code. 62 * the R8000 doesn't have them so don't reference these in generic MIPS code.
59 */ 63 */
60#define XKUSEG _LLCONST_(0x0000000000000000) 64#define XKUSEG _CONST64_(0x0000000000000000)
61#define XKSSEG _LLCONST_(0x4000000000000000) 65#define XKSSEG _CONST64_(0x4000000000000000)
62#define XKPHYS _LLCONST_(0x8000000000000000) 66#define XKPHYS _CONST64_(0x8000000000000000)
63#define XKSEG _LLCONST_(0xc000000000000000) 67#define XKSEG _CONST64_(0xc000000000000000)
64#define CKSEG0 _LLCONST_(0xffffffff80000000) 68#define CKSEG0 _CONST64_(0xffffffff80000000)
65#define CKSEG1 _LLCONST_(0xffffffffa0000000) 69#define CKSEG1 _CONST64_(0xffffffffa0000000)
66#define CKSSEG _LLCONST_(0xffffffffc0000000) 70#define CKSSEG _CONST64_(0xffffffffc0000000)
67#define CKSEG3 _LLCONST_(0xffffffffe0000000) 71#define CKSEG3 _CONST64_(0xffffffffe0000000)
68 72
69#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0) 73#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0)
70#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1) 74#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1)
@@ -122,7 +126,7 @@
122#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED,(p)) 126#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED,(p))
123#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE,(p)) 127#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE,(p))
124#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK) 128#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
125#define PHYS_TO_XKPHYS(cm,a) (_LLCONST_(0x8000000000000000) | \ 129#define PHYS_TO_XKPHYS(cm,a) (_CONST64_(0x8000000000000000) | \
126 ((cm)<<59) | (a)) 130 ((cm)<<59) | (a))
127 131
128#if defined (CONFIG_CPU_R4300) \ 132#if defined (CONFIG_CPU_R4300) \
@@ -132,20 +136,20 @@
132 || defined (CONFIG_CPU_NEVADA) \ 136 || defined (CONFIG_CPU_NEVADA) \
133 || defined (CONFIG_CPU_TX49XX) \ 137 || defined (CONFIG_CPU_TX49XX) \
134 || defined (CONFIG_CPU_MIPS64) 138 || defined (CONFIG_CPU_MIPS64)
135#define TO_PHYS_MASK _LLCONST_(0x0000000fffffffff) /* 2^^36 - 1 */ 139#define TO_PHYS_MASK _CONST64_(0x0000000fffffffff) /* 2^^36 - 1 */
136#endif 140#endif
137 141
138#if defined (CONFIG_CPU_R8000) 142#if defined (CONFIG_CPU_R8000)
139/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */ 143/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */
140#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */ 144#define TO_PHYS_MASK _CONST64_(0x000000ffffffffff) /* 2^^40 - 1 */
141#endif 145#endif
142 146
143#if defined (CONFIG_CPU_R10000) 147#if defined (CONFIG_CPU_R10000)
144#define TO_PHYS_MASK _LLCONST_(0x000000ffffffffff) /* 2^^40 - 1 */ 148#define TO_PHYS_MASK _CONST64_(0x000000ffffffffff) /* 2^^40 - 1 */
145#endif 149#endif
146 150
147#if defined(CONFIG_CPU_SB1) || defined(CONFIG_CPU_SB1A) 151#if defined(CONFIG_CPU_SB1) || defined(CONFIG_CPU_SB1A)
148#define TO_PHYS_MASK _LLCONST_(0x00000fffffffffff) /* 2^^44 - 1 */ 152#define TO_PHYS_MASK _CONST64_(0x00000fffffffffff) /* 2^^44 - 1 */
149#endif 153#endif
150 154
151#ifndef CONFIG_CPU_R8000 155#ifndef CONFIG_CPU_R8000
@@ -155,7 +159,7 @@
155 * in order to catch bugs in the source code. 159 * in order to catch bugs in the source code.
156 */ 160 */
157 161
158#define COMPAT_K1BASE32 _LLCONST_(0xffffffffa0000000) 162#define COMPAT_K1BASE32 _CONST64_(0xffffffffa0000000)
159#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */ 163#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */
160 164
161#endif 165#endif
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index e64abc0d8221..c1a2409bb52a 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -9,20 +9,13 @@
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details. 10 * for more details.
11 * 11 *
12 * Copyright (C) 1996, 97, 99, 2000, 03, 04 by Ralf Baechle 12 * Copyright (C) 1996, 97, 99, 2000, 03, 04, 06 by Ralf Baechle
13 */ 13 */
14
15/*
16 * As workaround for the ATOMIC_DEC_AND_LOCK / atomic_dec_and_lock mess in
17 * <linux/spinlock.h> we have to include <linux/spinlock.h> outside the
18 * main big wrapper ...
19 */
20#include <linux/spinlock.h>
21
22#ifndef _ASM_ATOMIC_H 14#ifndef _ASM_ATOMIC_H
23#define _ASM_ATOMIC_H 15#define _ASM_ATOMIC_H
24 16
25#include <linux/irqflags.h> 17#include <linux/irqflags.h>
18#include <asm/barrier.h>
26#include <asm/cpu-features.h> 19#include <asm/cpu-features.h>
27#include <asm/war.h> 20#include <asm/war.h>
28 21
@@ -138,6 +131,8 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
138{ 131{
139 unsigned long result; 132 unsigned long result;
140 133
134 smp_mb();
135
141 if (cpu_has_llsc && R10000_LLSC_WAR) { 136 if (cpu_has_llsc && R10000_LLSC_WAR) {
142 unsigned long temp; 137 unsigned long temp;
143 138
@@ -148,7 +143,6 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
148 " sc %0, %2 \n" 143 " sc %0, %2 \n"
149 " beqzl %0, 1b \n" 144 " beqzl %0, 1b \n"
150 " addu %0, %1, %3 \n" 145 " addu %0, %1, %3 \n"
151 " sync \n"
152 " .set mips0 \n" 146 " .set mips0 \n"
153 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 147 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
154 : "Ir" (i), "m" (v->counter) 148 : "Ir" (i), "m" (v->counter)
@@ -163,7 +157,6 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
163 " sc %0, %2 \n" 157 " sc %0, %2 \n"
164 " beqz %0, 1b \n" 158 " beqz %0, 1b \n"
165 " addu %0, %1, %3 \n" 159 " addu %0, %1, %3 \n"
166 " sync \n"
167 " .set mips0 \n" 160 " .set mips0 \n"
168 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 161 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
169 : "Ir" (i), "m" (v->counter) 162 : "Ir" (i), "m" (v->counter)
@@ -178,6 +171,8 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
178 local_irq_restore(flags); 171 local_irq_restore(flags);
179 } 172 }
180 173
174 smp_mb();
175
181 return result; 176 return result;
182} 177}
183 178
@@ -185,6 +180,8 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
185{ 180{
186 unsigned long result; 181 unsigned long result;
187 182
183 smp_mb();
184
188 if (cpu_has_llsc && R10000_LLSC_WAR) { 185 if (cpu_has_llsc && R10000_LLSC_WAR) {
189 unsigned long temp; 186 unsigned long temp;
190 187
@@ -195,7 +192,6 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
195 " sc %0, %2 \n" 192 " sc %0, %2 \n"
196 " beqzl %0, 1b \n" 193 " beqzl %0, 1b \n"
197 " subu %0, %1, %3 \n" 194 " subu %0, %1, %3 \n"
198 " sync \n"
199 " .set mips0 \n" 195 " .set mips0 \n"
200 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 196 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
201 : "Ir" (i), "m" (v->counter) 197 : "Ir" (i), "m" (v->counter)
@@ -210,7 +206,6 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
210 " sc %0, %2 \n" 206 " sc %0, %2 \n"
211 " beqz %0, 1b \n" 207 " beqz %0, 1b \n"
212 " subu %0, %1, %3 \n" 208 " subu %0, %1, %3 \n"
213 " sync \n"
214 " .set mips0 \n" 209 " .set mips0 \n"
215 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 210 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
216 : "Ir" (i), "m" (v->counter) 211 : "Ir" (i), "m" (v->counter)
@@ -225,6 +220,8 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
225 local_irq_restore(flags); 220 local_irq_restore(flags);
226 } 221 }
227 222
223 smp_mb();
224
228 return result; 225 return result;
229} 226}
230 227
@@ -240,6 +237,8 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
240{ 237{
241 unsigned long result; 238 unsigned long result;
242 239
240 smp_mb();
241
243 if (cpu_has_llsc && R10000_LLSC_WAR) { 242 if (cpu_has_llsc && R10000_LLSC_WAR) {
244 unsigned long temp; 243 unsigned long temp;
245 244
@@ -253,7 +252,6 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
253 " beqzl %0, 1b \n" 252 " beqzl %0, 1b \n"
254 " subu %0, %1, %3 \n" 253 " subu %0, %1, %3 \n"
255 " .set reorder \n" 254 " .set reorder \n"
256 " sync \n"
257 "1: \n" 255 "1: \n"
258 " .set mips0 \n" 256 " .set mips0 \n"
259 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 257 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
@@ -272,7 +270,6 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
272 " beqz %0, 1b \n" 270 " beqz %0, 1b \n"
273 " subu %0, %1, %3 \n" 271 " subu %0, %1, %3 \n"
274 " .set reorder \n" 272 " .set reorder \n"
275 " sync \n"
276 "1: \n" 273 "1: \n"
277 " .set mips0 \n" 274 " .set mips0 \n"
278 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 275 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
@@ -289,6 +286,8 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
289 local_irq_restore(flags); 286 local_irq_restore(flags);
290 } 287 }
291 288
289 smp_mb();
290
292 return result; 291 return result;
293} 292}
294 293
@@ -383,7 +382,7 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
383 382
384#ifdef CONFIG_64BIT 383#ifdef CONFIG_64BIT
385 384
386typedef struct { volatile __s64 counter; } atomic64_t; 385typedef struct { volatile long counter; } atomic64_t;
387 386
388#define ATOMIC64_INIT(i) { (i) } 387#define ATOMIC64_INIT(i) { (i) }
389 388
@@ -492,6 +491,8 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
492{ 491{
493 unsigned long result; 492 unsigned long result;
494 493
494 smp_mb();
495
495 if (cpu_has_llsc && R10000_LLSC_WAR) { 496 if (cpu_has_llsc && R10000_LLSC_WAR) {
496 unsigned long temp; 497 unsigned long temp;
497 498
@@ -502,7 +503,6 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
502 " scd %0, %2 \n" 503 " scd %0, %2 \n"
503 " beqzl %0, 1b \n" 504 " beqzl %0, 1b \n"
504 " addu %0, %1, %3 \n" 505 " addu %0, %1, %3 \n"
505 " sync \n"
506 " .set mips0 \n" 506 " .set mips0 \n"
507 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 507 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
508 : "Ir" (i), "m" (v->counter) 508 : "Ir" (i), "m" (v->counter)
@@ -517,7 +517,6 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
517 " scd %0, %2 \n" 517 " scd %0, %2 \n"
518 " beqz %0, 1b \n" 518 " beqz %0, 1b \n"
519 " addu %0, %1, %3 \n" 519 " addu %0, %1, %3 \n"
520 " sync \n"
521 " .set mips0 \n" 520 " .set mips0 \n"
522 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 521 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
523 : "Ir" (i), "m" (v->counter) 522 : "Ir" (i), "m" (v->counter)
@@ -532,6 +531,8 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
532 local_irq_restore(flags); 531 local_irq_restore(flags);
533 } 532 }
534 533
534 smp_mb();
535
535 return result; 536 return result;
536} 537}
537 538
@@ -539,6 +540,8 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
539{ 540{
540 unsigned long result; 541 unsigned long result;
541 542
543 smp_mb();
544
542 if (cpu_has_llsc && R10000_LLSC_WAR) { 545 if (cpu_has_llsc && R10000_LLSC_WAR) {
543 unsigned long temp; 546 unsigned long temp;
544 547
@@ -549,7 +552,6 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
549 " scd %0, %2 \n" 552 " scd %0, %2 \n"
550 " beqzl %0, 1b \n" 553 " beqzl %0, 1b \n"
551 " subu %0, %1, %3 \n" 554 " subu %0, %1, %3 \n"
552 " sync \n"
553 " .set mips0 \n" 555 " .set mips0 \n"
554 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 556 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
555 : "Ir" (i), "m" (v->counter) 557 : "Ir" (i), "m" (v->counter)
@@ -564,7 +566,6 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
564 " scd %0, %2 \n" 566 " scd %0, %2 \n"
565 " beqz %0, 1b \n" 567 " beqz %0, 1b \n"
566 " subu %0, %1, %3 \n" 568 " subu %0, %1, %3 \n"
567 " sync \n"
568 " .set mips0 \n" 569 " .set mips0 \n"
569 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 570 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
570 : "Ir" (i), "m" (v->counter) 571 : "Ir" (i), "m" (v->counter)
@@ -579,6 +580,8 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
579 local_irq_restore(flags); 580 local_irq_restore(flags);
580 } 581 }
581 582
583 smp_mb();
584
582 return result; 585 return result;
583} 586}
584 587
@@ -594,6 +597,8 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
594{ 597{
595 unsigned long result; 598 unsigned long result;
596 599
600 smp_mb();
601
597 if (cpu_has_llsc && R10000_LLSC_WAR) { 602 if (cpu_has_llsc && R10000_LLSC_WAR) {
598 unsigned long temp; 603 unsigned long temp;
599 604
@@ -607,7 +612,6 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
607 " beqzl %0, 1b \n" 612 " beqzl %0, 1b \n"
608 " dsubu %0, %1, %3 \n" 613 " dsubu %0, %1, %3 \n"
609 " .set reorder \n" 614 " .set reorder \n"
610 " sync \n"
611 "1: \n" 615 "1: \n"
612 " .set mips0 \n" 616 " .set mips0 \n"
613 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 617 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
@@ -626,7 +630,6 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
626 " beqz %0, 1b \n" 630 " beqz %0, 1b \n"
627 " dsubu %0, %1, %3 \n" 631 " dsubu %0, %1, %3 \n"
628 " .set reorder \n" 632 " .set reorder \n"
629 " sync \n"
630 "1: \n" 633 "1: \n"
631 " .set mips0 \n" 634 " .set mips0 \n"
632 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 635 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
@@ -643,6 +646,8 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
643 local_irq_restore(flags); 646 local_irq_restore(flags);
644 } 647 }
645 648
649 smp_mb();
650
646 return result; 651 return result;
647} 652}
648 653
diff --git a/include/asm-mips/barrier.h b/include/asm-mips/barrier.h
new file mode 100644
index 000000000000..ed82631b0017
--- /dev/null
+++ b/include/asm-mips/barrier.h
@@ -0,0 +1,132 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_BARRIER_H
9#define __ASM_BARRIER_H
10
11/*
12 * read_barrier_depends - Flush all pending reads that subsequents reads
13 * depend on.
14 *
15 * No data-dependent reads from memory-like regions are ever reordered
16 * over this barrier. All reads preceding this primitive are guaranteed
17 * to access memory (but not necessarily other CPUs' caches) before any
18 * reads following this primitive that depend on the data return by
19 * any of the preceding reads. This primitive is much lighter weight than
20 * rmb() on most CPUs, and is never heavier weight than is
21 * rmb().
22 *
23 * These ordering constraints are respected by both the local CPU
24 * and the compiler.
25 *
26 * Ordering is not guaranteed by anything other than these primitives,
27 * not even by data dependencies. See the documentation for
28 * memory_barrier() for examples and URLs to more information.
29 *
30 * For example, the following code would force ordering (the initial
31 * value of "a" is zero, "b" is one, and "p" is "&a"):
32 *
33 * <programlisting>
34 * CPU 0 CPU 1
35 *
36 * b = 2;
37 * memory_barrier();
38 * p = &b; q = p;
39 * read_barrier_depends();
40 * d = *q;
41 * </programlisting>
42 *
43 * because the read of "*q" depends on the read of "p" and these
44 * two reads are separated by a read_barrier_depends(). However,
45 * the following code, with the same initial values for "a" and "b":
46 *
47 * <programlisting>
48 * CPU 0 CPU 1
49 *
50 * a = 2;
51 * memory_barrier();
52 * b = 3; y = b;
53 * read_barrier_depends();
54 * x = a;
55 * </programlisting>
56 *
57 * does not enforce ordering, since there is no data dependency between
58 * the read of "a" and the read of "b". Therefore, on some CPUs, such
59 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
60 * in cases like this where there are no data dependencies.
61 */
62
63#define read_barrier_depends() do { } while(0)
64#define smp_read_barrier_depends() do { } while(0)
65
66#ifdef CONFIG_CPU_HAS_SYNC
67#define __sync() \
68 __asm__ __volatile__( \
69 ".set push\n\t" \
70 ".set noreorder\n\t" \
71 ".set mips2\n\t" \
72 "sync\n\t" \
73 ".set pop" \
74 : /* no output */ \
75 : /* no input */ \
76 : "memory")
77#else
78#define __sync() do { } while(0)
79#endif
80
81#define __fast_iob() \
82 __asm__ __volatile__( \
83 ".set push\n\t" \
84 ".set noreorder\n\t" \
85 "lw $0,%0\n\t" \
86 "nop\n\t" \
87 ".set pop" \
88 : /* no output */ \
89 : "m" (*(int *)CKSEG1) \
90 : "memory")
91
92#define fast_wmb() __sync()
93#define fast_rmb() __sync()
94#define fast_mb() __sync()
95#define fast_iob() \
96 do { \
97 __sync(); \
98 __fast_iob(); \
99 } while (0)
100
101#ifdef CONFIG_CPU_HAS_WB
102
103#include <asm/wbflush.h>
104
105#define wmb() fast_wmb()
106#define rmb() fast_rmb()
107#define mb() wbflush()
108#define iob() wbflush()
109
110#else /* !CONFIG_CPU_HAS_WB */
111
112#define wmb() fast_wmb()
113#define rmb() fast_rmb()
114#define mb() fast_mb()
115#define iob() fast_iob()
116
117#endif /* !CONFIG_CPU_HAS_WB */
118
119#if defined(CONFIG_WEAK_ORDERING) && defined(CONFIG_SMP)
120#define __WEAK_ORDERING_MB " sync \n"
121#else
122#define __WEAK_ORDERING_MB " \n"
123#endif
124
125#define smp_mb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
126#define smp_rmb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
127#define smp_wmb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
128
129#define set_mb(var, value) \
130 do { var = value; smp_mb(); } while (0)
131
132#endif /* __ASM_BARRIER_H */
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 1bb89c5a10ee..06445de1324b 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -3,38 +3,34 @@
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) 1994 - 1997, 1999, 2000 Ralf Baechle (ralf@gnu.org) 6 * Copyright (c) 1994 - 1997, 1999, 2000, 06 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (c) 1999, 2000 Silicon Graphics, Inc. 7 * Copyright (c) 1999, 2000 Silicon Graphics, Inc.
8 */ 8 */
9#ifndef _ASM_BITOPS_H 9#ifndef _ASM_BITOPS_H
10#define _ASM_BITOPS_H 10#define _ASM_BITOPS_H
11 11
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13#include <linux/irqflags.h>
13#include <linux/types.h> 14#include <linux/types.h>
15#include <asm/barrier.h>
14#include <asm/bug.h> 16#include <asm/bug.h>
15#include <asm/byteorder.h> /* sigh ... */ 17#include <asm/byteorder.h> /* sigh ... */
16#include <asm/cpu-features.h> 18#include <asm/cpu-features.h>
19#include <asm/sgidefs.h>
20#include <asm/war.h>
17 21
18#if (_MIPS_SZLONG == 32) 22#if (_MIPS_SZLONG == 32)
19#define SZLONG_LOG 5 23#define SZLONG_LOG 5
20#define SZLONG_MASK 31UL 24#define SZLONG_MASK 31UL
21#define __LL "ll " 25#define __LL "ll "
22#define __SC "sc " 26#define __SC "sc "
23#define cpu_to_lelongp(x) cpu_to_le32p((__u32 *) (x))
24#elif (_MIPS_SZLONG == 64) 27#elif (_MIPS_SZLONG == 64)
25#define SZLONG_LOG 6 28#define SZLONG_LOG 6
26#define SZLONG_MASK 63UL 29#define SZLONG_MASK 63UL
27#define __LL "lld " 30#define __LL "lld "
28#define __SC "scd " 31#define __SC "scd "
29#define cpu_to_lelongp(x) cpu_to_le64p((__u64 *) (x))
30#endif 32#endif
31 33
32#ifdef __KERNEL__
33
34#include <linux/irqflags.h>
35#include <asm/sgidefs.h>
36#include <asm/war.h>
37
38/* 34/*
39 * clear_bit() doesn't provide any barrier for the compiler. 35 * clear_bit() doesn't provide any barrier for the compiler.
40 */ 36 */
@@ -42,20 +38,6 @@
42#define smp_mb__after_clear_bit() smp_mb() 38#define smp_mb__after_clear_bit() smp_mb()
43 39
44/* 40/*
45 * Only disable interrupt for kernel mode stuff to keep usermode stuff
46 * that dares to use kernel include files alive.
47 */
48
49#define __bi_flags unsigned long flags
50#define __bi_local_irq_save(x) local_irq_save(x)
51#define __bi_local_irq_restore(x) local_irq_restore(x)
52#else
53#define __bi_flags
54#define __bi_local_irq_save(x)
55#define __bi_local_irq_restore(x)
56#endif /* __KERNEL__ */
57
58/*
59 * set_bit - Atomically set a bit in memory 41 * set_bit - Atomically set a bit in memory
60 * @nr: the bit to set 42 * @nr: the bit to set
61 * @addr: the address to start counting from 43 * @addr: the address to start counting from
@@ -93,13 +75,13 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
93 } else { 75 } else {
94 volatile unsigned long *a = addr; 76 volatile unsigned long *a = addr;
95 unsigned long mask; 77 unsigned long mask;
96 __bi_flags; 78 unsigned long flags;
97 79
98 a += nr >> SZLONG_LOG; 80 a += nr >> SZLONG_LOG;
99 mask = 1UL << (nr & SZLONG_MASK); 81 mask = 1UL << (nr & SZLONG_MASK);
100 __bi_local_irq_save(flags); 82 local_irq_save(flags);
101 *a |= mask; 83 *a |= mask;
102 __bi_local_irq_restore(flags); 84 local_irq_restore(flags);
103 } 85 }
104} 86}
105 87
@@ -141,13 +123,13 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
141 } else { 123 } else {
142 volatile unsigned long *a = addr; 124 volatile unsigned long *a = addr;
143 unsigned long mask; 125 unsigned long mask;
144 __bi_flags; 126 unsigned long flags;
145 127
146 a += nr >> SZLONG_LOG; 128 a += nr >> SZLONG_LOG;
147 mask = 1UL << (nr & SZLONG_MASK); 129 mask = 1UL << (nr & SZLONG_MASK);
148 __bi_local_irq_save(flags); 130 local_irq_save(flags);
149 *a &= ~mask; 131 *a &= ~mask;
150 __bi_local_irq_restore(flags); 132 local_irq_restore(flags);
151 } 133 }
152} 134}
153 135
@@ -191,13 +173,13 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
191 } else { 173 } else {
192 volatile unsigned long *a = addr; 174 volatile unsigned long *a = addr;
193 unsigned long mask; 175 unsigned long mask;
194 __bi_flags; 176 unsigned long flags;
195 177
196 a += nr >> SZLONG_LOG; 178 a += nr >> SZLONG_LOG;
197 mask = 1UL << (nr & SZLONG_MASK); 179 mask = 1UL << (nr & SZLONG_MASK);
198 __bi_local_irq_save(flags); 180 local_irq_save(flags);
199 *a ^= mask; 181 *a ^= mask;
200 __bi_local_irq_restore(flags); 182 local_irq_restore(flags);
201 } 183 }
202} 184}
203 185
@@ -223,9 +205,6 @@ static inline int test_and_set_bit(unsigned long nr,
223 " " __SC "%2, %1 \n" 205 " " __SC "%2, %1 \n"
224 " beqzl %2, 1b \n" 206 " beqzl %2, 1b \n"
225 " and %2, %0, %3 \n" 207 " and %2, %0, %3 \n"
226#ifdef CONFIG_SMP
227 " sync \n"
228#endif
229 " .set mips0 \n" 208 " .set mips0 \n"
230 : "=&r" (temp), "=m" (*m), "=&r" (res) 209 : "=&r" (temp), "=m" (*m), "=&r" (res)
231 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 210 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
@@ -245,9 +224,6 @@ static inline int test_and_set_bit(unsigned long nr,
245 " " __SC "%2, %1 \n" 224 " " __SC "%2, %1 \n"
246 " beqz %2, 1b \n" 225 " beqz %2, 1b \n"
247 " and %2, %0, %3 \n" 226 " and %2, %0, %3 \n"
248#ifdef CONFIG_SMP
249 " sync \n"
250#endif
251 " .set pop \n" 227 " .set pop \n"
252 : "=&r" (temp), "=m" (*m), "=&r" (res) 228 : "=&r" (temp), "=m" (*m), "=&r" (res)
253 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 229 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
@@ -258,17 +234,19 @@ static inline int test_and_set_bit(unsigned long nr,
258 volatile unsigned long *a = addr; 234 volatile unsigned long *a = addr;
259 unsigned long mask; 235 unsigned long mask;
260 int retval; 236 int retval;
261 __bi_flags; 237 unsigned long flags;
262 238
263 a += nr >> SZLONG_LOG; 239 a += nr >> SZLONG_LOG;
264 mask = 1UL << (nr & SZLONG_MASK); 240 mask = 1UL << (nr & SZLONG_MASK);
265 __bi_local_irq_save(flags); 241 local_irq_save(flags);
266 retval = (mask & *a) != 0; 242 retval = (mask & *a) != 0;
267 *a |= mask; 243 *a |= mask;
268 __bi_local_irq_restore(flags); 244 local_irq_restore(flags);
269 245
270 return retval; 246 return retval;
271 } 247 }
248
249 smp_mb();
272} 250}
273 251
274/* 252/*
@@ -294,9 +272,6 @@ static inline int test_and_clear_bit(unsigned long nr,
294 " " __SC "%2, %1 \n" 272 " " __SC "%2, %1 \n"
295 " beqzl %2, 1b \n" 273 " beqzl %2, 1b \n"
296 " and %2, %0, %3 \n" 274 " and %2, %0, %3 \n"
297#ifdef CONFIG_SMP
298 " sync \n"
299#endif
300 " .set mips0 \n" 275 " .set mips0 \n"
301 : "=&r" (temp), "=m" (*m), "=&r" (res) 276 : "=&r" (temp), "=m" (*m), "=&r" (res)
302 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 277 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
@@ -317,9 +292,6 @@ static inline int test_and_clear_bit(unsigned long nr,
317 " " __SC "%2, %1 \n" 292 " " __SC "%2, %1 \n"
318 " beqz %2, 1b \n" 293 " beqz %2, 1b \n"
319 " and %2, %0, %3 \n" 294 " and %2, %0, %3 \n"
320#ifdef CONFIG_SMP
321 " sync \n"
322#endif
323 " .set pop \n" 295 " .set pop \n"
324 : "=&r" (temp), "=m" (*m), "=&r" (res) 296 : "=&r" (temp), "=m" (*m), "=&r" (res)
325 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 297 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
@@ -330,17 +302,19 @@ static inline int test_and_clear_bit(unsigned long nr,
330 volatile unsigned long *a = addr; 302 volatile unsigned long *a = addr;
331 unsigned long mask; 303 unsigned long mask;
332 int retval; 304 int retval;
333 __bi_flags; 305 unsigned long flags;
334 306
335 a += nr >> SZLONG_LOG; 307 a += nr >> SZLONG_LOG;
336 mask = 1UL << (nr & SZLONG_MASK); 308 mask = 1UL << (nr & SZLONG_MASK);
337 __bi_local_irq_save(flags); 309 local_irq_save(flags);
338 retval = (mask & *a) != 0; 310 retval = (mask & *a) != 0;
339 *a &= ~mask; 311 *a &= ~mask;
340 __bi_local_irq_restore(flags); 312 local_irq_restore(flags);
341 313
342 return retval; 314 return retval;
343 } 315 }
316
317 smp_mb();
344} 318}
345 319
346/* 320/*
@@ -365,9 +339,6 @@ static inline int test_and_change_bit(unsigned long nr,
365 " " __SC "%2, %1 \n" 339 " " __SC "%2, %1 \n"
366 " beqzl %2, 1b \n" 340 " beqzl %2, 1b \n"
367 " and %2, %0, %3 \n" 341 " and %2, %0, %3 \n"
368#ifdef CONFIG_SMP
369 " sync \n"
370#endif
371 " .set mips0 \n" 342 " .set mips0 \n"
372 : "=&r" (temp), "=m" (*m), "=&r" (res) 343 : "=&r" (temp), "=m" (*m), "=&r" (res)
373 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 344 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
@@ -387,9 +358,6 @@ static inline int test_and_change_bit(unsigned long nr,
387 " " __SC "\t%2, %1 \n" 358 " " __SC "\t%2, %1 \n"
388 " beqz %2, 1b \n" 359 " beqz %2, 1b \n"
389 " and %2, %0, %3 \n" 360 " and %2, %0, %3 \n"
390#ifdef CONFIG_SMP
391 " sync \n"
392#endif
393 " .set pop \n" 361 " .set pop \n"
394 : "=&r" (temp), "=m" (*m), "=&r" (res) 362 : "=&r" (temp), "=m" (*m), "=&r" (res)
395 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 363 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m)
@@ -399,22 +367,20 @@ static inline int test_and_change_bit(unsigned long nr,
399 } else { 367 } else {
400 volatile unsigned long *a = addr; 368 volatile unsigned long *a = addr;
401 unsigned long mask, retval; 369 unsigned long mask, retval;
402 __bi_flags; 370 unsigned long flags;
403 371
404 a += nr >> SZLONG_LOG; 372 a += nr >> SZLONG_LOG;
405 mask = 1UL << (nr & SZLONG_MASK); 373 mask = 1UL << (nr & SZLONG_MASK);
406 __bi_local_irq_save(flags); 374 local_irq_save(flags);
407 retval = (mask & *a) != 0; 375 retval = (mask & *a) != 0;
408 *a ^= mask; 376 *a ^= mask;
409 __bi_local_irq_restore(flags); 377 local_irq_restore(flags);
410 378
411 return retval; 379 return retval;
412 } 380 }
413}
414 381
415#undef __bi_flags 382 smp_mb();
416#undef __bi_local_irq_save 383}
417#undef __bi_local_irq_restore
418 384
419#include <asm-generic/bitops/non-atomic.h> 385#include <asm-generic/bitops/non-atomic.h>
420 386
diff --git a/include/asm-mips/bug.h b/include/asm-mips/bug.h
index 7b4739dc8f3f..4d560a533940 100644
--- a/include/asm-mips/bug.h
+++ b/include/asm-mips/bug.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_BUG_H 1#ifndef __ASM_BUG_H
2#define __ASM_BUG_H 2#define __ASM_BUG_H
3 3
4#include <asm/sgidefs.h>
4 5
5#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
6 7
@@ -13,6 +14,17 @@ do { \
13 14
14#define HAVE_ARCH_BUG 15#define HAVE_ARCH_BUG
15 16
17#if (_MIPS_ISA > _MIPS_ISA_MIPS1)
18
19#define BUG_ON(condition) \
20do { \
21 __asm__ __volatile__("tne $0, %0" : : "r" (condition)); \
22} while (0)
23
24#define HAVE_ARCH_BUG_ON
25
26#endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
27
16#endif 28#endif
17 29
18#include <asm-generic/bug.h> 30#include <asm-generic/bug.h>
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
index a5e6050ec0f3..9b768c3b96b3 100644
--- a/include/asm-mips/checksum.h
+++ b/include/asm-mips/checksum.h
@@ -27,23 +27,22 @@
27 * 27 *
28 * it's best to have buff aligned on a 32-bit boundary 28 * it's best to have buff aligned on a 32-bit boundary
29 */ 29 */
30unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum); 30__wsum csum_partial(const void *buff, int len, __wsum sum);
31 31
32/* 32/*
33 * this is a new version of the above that records errors it finds in *errp, 33 * this is a new version of the above that records errors it finds in *errp,
34 * but continues and zeros the rest of the buffer. 34 * but continues and zeros the rest of the buffer.
35 */ 35 */
36unsigned int csum_partial_copy_from_user(const unsigned char __user *src, 36__wsum csum_partial_copy_from_user(const void __user *src,
37 unsigned char *dst, int len, 37 void *dst, int len,
38 unsigned int sum, int *errp); 38 __wsum sum, int *errp);
39 39
40/* 40/*
41 * Copy and checksum to user 41 * Copy and checksum to user
42 */ 42 */
43#define HAVE_CSUM_COPY_USER 43#define HAVE_CSUM_COPY_USER
44static inline unsigned int csum_and_copy_to_user (const unsigned char *src, 44static inline __wsum csum_and_copy_to_user (const void *src, void __user *dst,
45 unsigned char __user *dst, 45 int len, __wsum sum,
46 int len, int sum,
47 int *err_ptr) 46 int *err_ptr)
48{ 47{
49 might_sleep(); 48 might_sleep();
@@ -51,7 +50,7 @@ static inline unsigned int csum_and_copy_to_user (const unsigned char *src,
51 50
52 if (copy_to_user(dst, src, len)) { 51 if (copy_to_user(dst, src, len)) {
53 *err_ptr = -EFAULT; 52 *err_ptr = -EFAULT;
54 return -1; 53 return (__force __wsum)-1;
55 } 54 }
56 55
57 return sum; 56 return sum;
@@ -61,13 +60,13 @@ static inline unsigned int csum_and_copy_to_user (const unsigned char *src,
61 * the same as csum_partial, but copies from user space (but on MIPS 60 * the same as csum_partial, but copies from user space (but on MIPS
62 * we have just one address space, so this is identical to the above) 61 * we have just one address space, so this is identical to the above)
63 */ 62 */
64unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst, 63__wsum csum_partial_copy_nocheck(const void *src, void *dst,
65 int len, unsigned int sum); 64 int len, __wsum sum);
66 65
67/* 66/*
68 * Fold a partial checksum without adding pseudo headers 67 * Fold a partial checksum without adding pseudo headers
69 */ 68 */
70static inline unsigned short int csum_fold(unsigned int sum) 69static inline __sum16 csum_fold(__wsum sum)
71{ 70{
72 __asm__( 71 __asm__(
73 " .set push # csum_fold\n" 72 " .set push # csum_fold\n"
@@ -82,7 +81,7 @@ static inline unsigned short int csum_fold(unsigned int sum)
82 : "=r" (sum) 81 : "=r" (sum)
83 : "0" (sum)); 82 : "0" (sum));
84 83
85 return sum; 84 return (__force __sum16)sum;
86} 85}
87 86
88/* 87/*
@@ -92,10 +91,10 @@ static inline unsigned short int csum_fold(unsigned int sum)
92 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by 91 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
93 * Arnt Gulbrandsen. 92 * Arnt Gulbrandsen.
94 */ 93 */
95static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) 94static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
96{ 95{
97 unsigned int *word = (unsigned int *) iph; 96 const unsigned int *word = iph;
98 unsigned int *stop = word + ihl; 97 const unsigned int *stop = word + ihl;
99 unsigned int csum; 98 unsigned int csum;
100 int carry; 99 int carry;
101 100
@@ -123,9 +122,9 @@ static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
123 return csum_fold(csum); 122 return csum_fold(csum);
124} 123}
125 124
126static inline unsigned int csum_tcpudp_nofold(unsigned long saddr, 125static inline __wsum csum_tcpudp_nofold(__be32 saddr,
127 unsigned long daddr, unsigned short len, unsigned short proto, 126 __be32 daddr, unsigned short len, unsigned short proto,
128 unsigned int sum) 127 __wsum sum)
129{ 128{
130 __asm__( 129 __asm__(
131 " .set push # csum_tcpudp_nofold\n" 130 " .set push # csum_tcpudp_nofold\n"
@@ -155,9 +154,9 @@ static inline unsigned int csum_tcpudp_nofold(unsigned long saddr,
155 : "=r" (sum) 154 : "=r" (sum)
156 : "0" (daddr), "r"(saddr), 155 : "0" (daddr), "r"(saddr),
157#ifdef __MIPSEL__ 156#ifdef __MIPSEL__
158 "r" (((unsigned long)htons(len)<<16) + proto*256), 157 "r" ((proto + len) << 8),
159#else 158#else
160 "r" (((unsigned long)(proto)<<16) + len), 159 "r" (proto + len),
161#endif 160#endif
162 "r" (sum)); 161 "r" (sum));
163 162
@@ -168,11 +167,10 @@ static inline unsigned int csum_tcpudp_nofold(unsigned long saddr,
168 * computes the checksum of the TCP/UDP pseudo-header 167 * computes the checksum of the TCP/UDP pseudo-header
169 * returns a 16-bit checksum, already complemented 168 * returns a 16-bit checksum, already complemented
170 */ 169 */
171static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 170static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
172 unsigned long daddr,
173 unsigned short len, 171 unsigned short len,
174 unsigned short proto, 172 unsigned short proto,
175 unsigned int sum) 173 __wsum sum)
176{ 174{
177 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 175 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
178} 176}
@@ -181,17 +179,16 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
181 * this routine is used for miscellaneous IP-like checksums, mainly 179 * this routine is used for miscellaneous IP-like checksums, mainly
182 * in icmp.c 180 * in icmp.c
183 */ 181 */
184static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 182static inline __sum16 ip_compute_csum(const void *buff, int len)
185{ 183{
186 return csum_fold(csum_partial(buff, len, 0)); 184 return csum_fold(csum_partial(buff, len, 0));
187} 185}
188 186
189#define _HAVE_ARCH_IPV6_CSUM 187#define _HAVE_ARCH_IPV6_CSUM
190static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 188static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
191 struct in6_addr *daddr, 189 const struct in6_addr *daddr,
192 __u32 len, 190 __u32 len, unsigned short proto,
193 unsigned short proto, 191 __wsum sum)
194 unsigned int sum)
195{ 192{
196 __asm__( 193 __asm__(
197 " .set push # csum_ipv6_magic\n" 194 " .set push # csum_ipv6_magic\n"
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
index 900f472fdd2b..55a0152feb08 100644
--- a/include/asm-mips/compat.h
+++ b/include/asm-mips/compat.h
@@ -32,6 +32,7 @@ typedef struct {
32 s32 val[2]; 32 s32 val[2];
33} compat_fsid_t; 33} compat_fsid_t;
34typedef s32 compat_timer_t; 34typedef s32 compat_timer_t;
35typedef s32 compat_key_t;
35 36
36typedef s32 compat_int_t; 37typedef s32 compat_int_t;
37typedef s32 compat_long_t; 38typedef s32 compat_long_t;
@@ -146,4 +147,71 @@ static inline void __user *compat_alloc_user_space(long len)
146 return (void __user *) (regs->regs[29] - len); 147 return (void __user *) (regs->regs[29] - len);
147} 148}
148 149
150struct compat_ipc64_perm {
151 compat_key_t key;
152 __compat_uid32_t uid;
153 __compat_gid32_t gid;
154 __compat_uid32_t cuid;
155 __compat_gid32_t cgid;
156 compat_mode_t mode;
157 unsigned short seq;
158 unsigned short __pad2;
159 compat_ulong_t __unused1;
160 compat_ulong_t __unused2;
161};
162
163struct compat_semid64_ds {
164 struct compat_ipc64_perm sem_perm;
165 compat_time_t sem_otime;
166 compat_time_t sem_ctime;
167 compat_ulong_t sem_nsems;
168 compat_ulong_t __unused1;
169 compat_ulong_t __unused2;
170};
171
172struct compat_msqid64_ds {
173 struct compat_ipc64_perm msg_perm;
174#ifndef CONFIG_CPU_LITTLE_ENDIAN
175 compat_ulong_t __unused1;
176#endif
177 compat_time_t msg_stime;
178#ifdef CONFIG_CPU_LITTLE_ENDIAN
179 compat_ulong_t __unused1;
180#endif
181#ifndef CONFIG_CPU_LITTLE_ENDIAN
182 compat_ulong_t __unused2;
183#endif
184 compat_time_t msg_rtime;
185#ifdef CONFIG_CPU_LITTLE_ENDIAN
186 compat_ulong_t __unused2;
187#endif
188#ifndef CONFIG_CPU_LITTLE_ENDIAN
189 compat_ulong_t __unused3;
190#endif
191 compat_time_t msg_ctime;
192#ifdef CONFIG_CPU_LITTLE_ENDIAN
193 compat_ulong_t __unused3;
194#endif
195 compat_ulong_t msg_cbytes;
196 compat_ulong_t msg_qnum;
197 compat_ulong_t msg_qbytes;
198 compat_pid_t msg_lspid;
199 compat_pid_t msg_lrpid;
200 compat_ulong_t __unused4;
201 compat_ulong_t __unused5;
202};
203
204struct compat_shmid64_ds {
205 struct compat_ipc64_perm shm_perm;
206 compat_size_t shm_segsz;
207 compat_time_t shm_atime;
208 compat_time_t shm_dtime;
209 compat_time_t shm_ctime;
210 compat_pid_t shm_cpid;
211 compat_pid_t shm_lpid;
212 compat_ulong_t shm_nattch;
213 compat_ulong_t __unused1;
214 compat_ulong_t __unused2;
215};
216
149#endif /* _ASM_COMPAT_H */ 217#endif /* _ASM_COMPAT_H */
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index a2f0c8ea9160..610d0cdeaa9e 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -22,12 +22,12 @@
22 * Descriptor for a cache 22 * Descriptor for a cache
23 */ 23 */
24struct cache_desc { 24struct cache_desc {
25 unsigned short linesz; /* Size of line in bytes */
26 unsigned short ways; /* Number of ways */
27 unsigned short sets; /* Number of lines per set */
28 unsigned int waysize; /* Bytes per way */ 25 unsigned int waysize; /* Bytes per way */
29 unsigned int waybit; /* Bits to select in a cache set */ 26 unsigned short sets; /* Number of lines per set */
30 unsigned int flags; /* Flags describing cache properties */ 27 unsigned char ways; /* Number of ways */
28 unsigned char linesz; /* Size of line in bytes */
29 unsigned char waybit; /* Bits to select in a cache set */
30 unsigned char flags; /* Flags describing cache properties */
31}; 31};
32 32
33/* 33/*
diff --git a/include/asm-mips/dec/kn02.h b/include/asm-mips/dec/kn02.h
index 8319ad77b250..93430b5f4724 100644
--- a/include/asm-mips/dec/kn02.h
+++ b/include/asm-mips/dec/kn02.h
@@ -82,11 +82,9 @@
82 82
83#ifndef __ASSEMBLY__ 83#ifndef __ASSEMBLY__
84 84
85#include <linux/spinlock.h>
86#include <linux/types.h> 85#include <linux/types.h>
87 86
88extern u32 cached_kn02_csr; 87extern u32 cached_kn02_csr;
89extern spinlock_t kn02_lock;
90extern void init_kn02_irqs(int base); 88extern void init_kn02_irqs(int base);
91#endif 89#endif
92 90
diff --git a/include/asm-mips/device.h b/include/asm-mips/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-mips/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-mips/dma-mapping.h b/include/asm-mips/dma-mapping.h
index 43288634c38a..236d1a467cc7 100644
--- a/include/asm-mips/dma-mapping.h
+++ b/include/asm-mips/dma-mapping.h
@@ -63,9 +63,9 @@ dma_get_cache_alignment(void)
63 return 128; 63 return 128;
64} 64}
65 65
66extern int dma_is_consistent(dma_addr_t dma_addr); 66extern int dma_is_consistent(struct device *dev, dma_addr_t dma_addr);
67 67
68extern void dma_cache_sync(void *vaddr, size_t size, 68extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
69 enum dma_data_direction direction); 69 enum dma_data_direction direction);
70 70
71#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 71#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
index e85849ac165f..23f789c80845 100644
--- a/include/asm-mips/dma.h
+++ b/include/asm-mips/dma.h
@@ -74,7 +74,9 @@
74 * 74 *
75 */ 75 */
76 76
77#ifndef GENERIC_ISA_DMA_SUPPORT_BROKEN
77#define MAX_DMA_CHANNELS 8 78#define MAX_DMA_CHANNELS 8
79#endif
78 80
79/* 81/*
80 * The maximum address in KSEG0 that we can perform a DMA transfer to on this 82 * The maximum address in KSEG0 that we can perform a DMA transfer to on this
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
index ed023eae0674..47e5679c2353 100644
--- a/include/asm-mips/futex.h
+++ b/include/asm-mips/futex.h
@@ -1,19 +1,21 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2006 Ralf Baechle (ralf@linux-mips.org)
7 */
1#ifndef _ASM_FUTEX_H 8#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H 9#define _ASM_FUTEX_H
3 10
4#ifdef __KERNEL__ 11#ifdef __KERNEL__
5 12
6#include <linux/futex.h> 13#include <linux/futex.h>
14#include <asm/barrier.h>
7#include <asm/errno.h> 15#include <asm/errno.h>
8#include <asm/uaccess.h> 16#include <asm/uaccess.h>
9#include <asm/war.h> 17#include <asm/war.h>
10 18
11#ifdef CONFIG_SMP
12#define __FUTEX_SMP_SYNC " sync \n"
13#else
14#define __FUTEX_SMP_SYNC
15#endif
16
17#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ 19#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
18{ \ 20{ \
19 if (cpu_has_llsc && R10000_LLSC_WAR) { \ 21 if (cpu_has_llsc && R10000_LLSC_WAR) { \
@@ -27,7 +29,7 @@
27 " .set mips3 \n" \ 29 " .set mips3 \n" \
28 "2: sc $1, %2 \n" \ 30 "2: sc $1, %2 \n" \
29 " beqzl $1, 1b \n" \ 31 " beqzl $1, 1b \n" \
30 __FUTEX_SMP_SYNC \ 32 __WEAK_ORDERING_MB \
31 "3: \n" \ 33 "3: \n" \
32 " .set pop \n" \ 34 " .set pop \n" \
33 " .set mips0 \n" \ 35 " .set mips0 \n" \
@@ -53,7 +55,7 @@
53 " .set mips3 \n" \ 55 " .set mips3 \n" \
54 "2: sc $1, %2 \n" \ 56 "2: sc $1, %2 \n" \
55 " beqz $1, 1b \n" \ 57 " beqz $1, 1b \n" \
56 __FUTEX_SMP_SYNC \ 58 __WEAK_ORDERING_MB \
57 "3: \n" \ 59 "3: \n" \
58 " .set pop \n" \ 60 " .set pop \n" \
59 " .set mips0 \n" \ 61 " .set mips0 \n" \
@@ -86,7 +88,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
86 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 88 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
87 return -EFAULT; 89 return -EFAULT;
88 90
89 inc_preempt_count(); 91 pagefault_disable();
90 92
91 switch (op) { 93 switch (op) {
92 case FUTEX_OP_SET: 94 case FUTEX_OP_SET:
@@ -113,7 +115,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
113 ret = -ENOSYS; 115 ret = -ENOSYS;
114 } 116 }
115 117
116 dec_preempt_count(); 118 pagefault_enable();
117 119
118 if (!ret) { 120 if (!ret) {
119 switch (cmp) { 121 switch (cmp) {
@@ -150,7 +152,7 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
150 " .set mips3 \n" 152 " .set mips3 \n"
151 "2: sc $1, %1 \n" 153 "2: sc $1, %1 \n"
152 " beqzl $1, 1b \n" 154 " beqzl $1, 1b \n"
153 __FUTEX_SMP_SYNC 155 __WEAK_ORDERING_MB
154 "3: \n" 156 "3: \n"
155 " .set pop \n" 157 " .set pop \n"
156 " .section .fixup,\"ax\" \n" 158 " .section .fixup,\"ax\" \n"
@@ -177,7 +179,7 @@ futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
177 " .set mips3 \n" 179 " .set mips3 \n"
178 "2: sc $1, %1 \n" 180 "2: sc $1, %1 \n"
179 " beqz $1, 1b \n" 181 " beqz $1, 1b \n"
180 __FUTEX_SMP_SYNC 182 __WEAK_ORDERING_MB
181 "3: \n" 183 "3: \n"
182 " .set pop \n" 184 " .set pop \n"
183 " .section .fixup,\"ax\" \n" 185 " .section .fixup,\"ax\" \n"
diff --git a/include/asm-mips/gt64120.h b/include/asm-mips/gt64120.h
index 2edd171bb6cd..4bf8e28f8850 100644
--- a/include/asm-mips/gt64120.h
+++ b/include/asm-mips/gt64120.h
@@ -451,6 +451,13 @@
451#define GT_SDRAM_OPMODE_OP_MODE 3 451#define GT_SDRAM_OPMODE_OP_MODE 3
452#define GT_SDRAM_OPMODE_OP_CBR 4 452#define GT_SDRAM_OPMODE_OP_CBR 4
453 453
454#define GT_TC_CONTROL_ENTC0_SHF 0
455#define GT_TC_CONTROL_ENTC0_MSK (MSK(1) << GT_TC_CONTROL_ENTC0_SHF)
456#define GT_TC_CONTROL_ENTC0_BIT GT_TC_CONTROL_ENTC0_MSK
457#define GT_TC_CONTROL_SELTC0_SHF 1
458#define GT_TC_CONTROL_SELTC0_MSK (MSK(1) << GT_TC_CONTROL_SELTC0_SHF)
459#define GT_TC_CONTROL_SELTC0_BIT GT_TC_CONTROL_SELTC0_MSK
460
454 461
455#define GT_PCI0_BARE_SWSCS3BOOTDIS_SHF 0 462#define GT_PCI0_BARE_SWSCS3BOOTDIS_SHF 0
456#define GT_PCI0_BARE_SWSCS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS3BOOTDIS_SHF) 463#define GT_PCI0_BARE_SWSCS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS3BOOTDIS_SHF)
@@ -523,6 +530,13 @@
523#define GT_PCI0_CMD_SWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_SWORDSWAP_SHF) 530#define GT_PCI0_CMD_SWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_SWORDSWAP_SHF)
524#define GT_PCI0_CMD_SWORDSWAP_BIT GT_PCI0_CMD_SWORDSWAP_MSK 531#define GT_PCI0_CMD_SWORDSWAP_BIT GT_PCI0_CMD_SWORDSWAP_MSK
525 532
533#define GT_INTR_T0EXP_SHF 8
534#define GT_INTR_T0EXP_MSK (MSK(1) << GT_INTR_T0EXP_SHF)
535#define GT_INTR_T0EXP_BIT GT_INTR_T0EXP_MSK
536#define GT_INTR_RETRYCTR0_SHF 20
537#define GT_INTR_RETRYCTR0_MSK (MSK(1) << GT_INTR_RETRYCTR0_SHF)
538#define GT_INTR_RETRYCTR0_BIT GT_INTR_RETRYCTR0_MSK
539
526/* 540/*
527 * Misc 541 * Misc
528 */ 542 */
diff --git a/include/asm-mips/highmem.h b/include/asm-mips/highmem.h
index c976bfaaba83..f8c8182f7f2e 100644
--- a/include/asm-mips/highmem.h
+++ b/include/asm-mips/highmem.h
@@ -21,6 +21,7 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/uaccess.h>
24#include <asm/kmap_types.h> 25#include <asm/kmap_types.h>
25 26
26/* undef for production */ 27/* undef for production */
@@ -70,11 +71,16 @@ static inline void *kmap(struct page *page)
70 71
71static inline void *kmap_atomic(struct page *page, enum km_type type) 72static inline void *kmap_atomic(struct page *page, enum km_type type)
72{ 73{
74 pagefault_disable();
73 return page_address(page); 75 return page_address(page);
74} 76}
75 77
76static inline void kunmap_atomic(void *kvaddr, enum km_type type) { } 78static inline void kunmap_atomic(void *kvaddr, enum km_type type)
77#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) 79{
80 pagefault_enable();
81}
82
83#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx))
78 84
79#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 85#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
80 86
diff --git a/include/asm-mips/i8259.h b/include/asm-mips/i8259.h
index 0214abe3f0af..4df8d8b118c0 100644
--- a/include/asm-mips/i8259.h
+++ b/include/asm-mips/i8259.h
@@ -19,10 +19,31 @@
19 19
20#include <asm/io.h> 20#include <asm/io.h>
21 21
22/* i8259A PIC registers */
23#define PIC_MASTER_CMD 0x20
24#define PIC_MASTER_IMR 0x21
25#define PIC_MASTER_ISR PIC_MASTER_CMD
26#define PIC_MASTER_POLL PIC_MASTER_ISR
27#define PIC_MASTER_OCW3 PIC_MASTER_ISR
28#define PIC_SLAVE_CMD 0xa0
29#define PIC_SLAVE_IMR 0xa1
30
31/* i8259A PIC related value */
32#define PIC_CASCADE_IR 2
33#define MASTER_ICW4_DEFAULT 0x01
34#define SLAVE_ICW4_DEFAULT 0x01
35#define PIC_ICW4_AEOI 2
36
22extern spinlock_t i8259A_lock; 37extern spinlock_t i8259A_lock;
23 38
39extern void init_8259A(int auto_eoi);
40extern void enable_8259A_irq(unsigned int irq);
41extern void disable_8259A_irq(unsigned int irq);
42
24extern void init_i8259_irqs(void); 43extern void init_i8259_irqs(void);
25 44
45#define I8259A_IRQ_BASE 0
46
26/* 47/*
27 * Do the traditional i8259 interrupt polling thing. This is for the few 48 * Do the traditional i8259 interrupt polling thing. This is for the few
28 * cases where no better interrupt acknowledge method is available and we 49 * cases where no better interrupt acknowledge method is available and we
@@ -35,15 +56,15 @@ static inline int i8259_irq(void)
35 spin_lock(&i8259A_lock); 56 spin_lock(&i8259A_lock);
36 57
37 /* Perform an interrupt acknowledge cycle on controller 1. */ 58 /* Perform an interrupt acknowledge cycle on controller 1. */
38 outb(0x0C, 0x20); /* prepare for poll */ 59 outb(0x0C, PIC_MASTER_CMD); /* prepare for poll */
39 irq = inb(0x20) & 7; 60 irq = inb(PIC_MASTER_CMD) & 7;
40 if (irq == 2) { 61 if (irq == PIC_CASCADE_IR) {
41 /* 62 /*
42 * Interrupt is cascaded so perform interrupt 63 * Interrupt is cascaded so perform interrupt
43 * acknowledge on controller 2. 64 * acknowledge on controller 2.
44 */ 65 */
45 outb(0x0C, 0xA0); /* prepare for poll */ 66 outb(0x0C, PIC_SLAVE_CMD); /* prepare for poll */
46 irq = (inb(0xA0) & 7) + 8; 67 irq = (inb(PIC_SLAVE_CMD) & 7) + 8;
47 } 68 }
48 69
49 if (unlikely(irq == 7)) { 70 if (unlikely(irq == 7)) {
@@ -54,14 +75,14 @@ static inline int i8259_irq(void)
54 * significant bit is not set then there is no valid 75 * significant bit is not set then there is no valid
55 * interrupt. 76 * interrupt.
56 */ 77 */
57 outb(0x0B, 0x20); /* ISR register */ 78 outb(0x0B, PIC_MASTER_ISR); /* ISR register */
58 if(~inb(0x20) & 0x80) 79 if(~inb(PIC_MASTER_ISR) & 0x80)
59 irq = -1; 80 irq = -1;
60 } 81 }
61 82
62 spin_unlock(&i8259A_lock); 83 spin_unlock(&i8259A_lock);
63 84
64 return irq; 85 return likely(irq >= 0) ? irq + I8259A_IRQ_BASE : irq;
65} 86}
66 87
67#endif /* _ASM_I8259_H */ 88#endif /* _ASM_I8259_H */
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index bc5f3c53155f..d77b657c09c7 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -113,7 +113,7 @@ static inline void set_io_port_base(unsigned long base)
113 * almost all conceivable cases a device driver should not be using 113 * almost all conceivable cases a device driver should not be using
114 * this function 114 * this function
115 */ 115 */
116static inline unsigned long virt_to_phys(volatile void * address) 116static inline unsigned long virt_to_phys(volatile const void *address)
117{ 117{
118 return (unsigned long)address - PAGE_OFFSET; 118 return (unsigned long)address - PAGE_OFFSET;
119} 119}
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 0ce2a80b689e..67657089efa7 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -24,8 +24,6 @@ static inline int irq_canonicalize(int irq)
24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */ 24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
25#endif 25#endif
26 26
27extern asmlinkage unsigned int do_IRQ(unsigned int irq);
28
29#ifdef CONFIG_MIPS_MT_SMTC 27#ifdef CONFIG_MIPS_MT_SMTC
30/* 28/*
31 * Clear interrupt mask handling "backstop" if irq_hwmask 29 * Clear interrupt mask handling "backstop" if irq_hwmask
@@ -43,8 +41,6 @@ do { \
43#define __DO_IRQ_SMTC_HOOK() do { } while (0) 41#define __DO_IRQ_SMTC_HOOK() do { } while (0)
44#endif 42#endif
45 43
46#ifdef CONFIG_PREEMPT
47
48/* 44/*
49 * do_IRQ handles all normal device IRQ's (the special 45 * do_IRQ handles all normal device IRQ's (the special
50 * SMP cross-CPU interrupts have their own specific 46 * SMP cross-CPU interrupts have their own specific
@@ -57,12 +53,10 @@ do { \
57do { \ 53do { \
58 irq_enter(); \ 54 irq_enter(); \
59 __DO_IRQ_SMTC_HOOK(); \ 55 __DO_IRQ_SMTC_HOOK(); \
60 __do_IRQ((irq)); \ 56 generic_handle_irq(irq); \
61 irq_exit(); \ 57 irq_exit(); \
62} while (0) 58} while (0)
63 59
64#endif
65
66extern void arch_init_irq(void); 60extern void arch_init_irq(void);
67extern void spurious_interrupt(void); 61extern void spurious_interrupt(void);
68 62
@@ -74,4 +68,8 @@ extern int setup_irq_smtc(unsigned int irq, struct irqaction * new,
74 unsigned long hwmask); 68 unsigned long hwmask);
75#endif /* CONFIG_MIPS_MT_SMTC */ 69#endif /* CONFIG_MIPS_MT_SMTC */
76 70
71extern int allocate_irqno(void);
72extern void alloc_legacy_irqno(void);
73extern void free_irqno(unsigned int irq);
74
77#endif /* _ASM_IRQ_H */ 75#endif /* _ASM_IRQ_H */
diff --git a/include/asm-mips/kexec.h b/include/asm-mips/kexec.h
new file mode 100644
index 000000000000..b25267ebcb09
--- /dev/null
+++ b/include/asm-mips/kexec.h
@@ -0,0 +1,32 @@
1/*
2 * kexec.h for kexec
3 * Created by <nschichan@corp.free.fr> on Thu Oct 12 14:59:34 2006
4 *
5 * This source code is licensed under the GNU General Public License,
6 * Version 2. See the file COPYING for more details.
7 */
8
9#ifndef _MIPS_KEXEC
10# define _MIPS_KEXEC
11
12/* Maximum physical address we can use pages from */
13#define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000)
14/* Maximum address we can reach in physical address mode */
15#define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000)
16 /* Maximum address we can use for the control code buffer */
17#define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000)
18
19#define KEXEC_CONTROL_CODE_SIZE 4096
20
21/* The native architecture */
22#define KEXEC_ARCH KEXEC_ARCH_MIPS
23
24#define MAX_NOTE_BYTES 1024
25
26static inline void crash_setup_regs(struct pt_regs *newregs,
27 struct pt_regs *oldregs)
28{
29 /* Dummy implementation for now */
30}
31
32#endif /* !_MIPS_KEXEC */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index 301e71300779..e9fa252f8a3f 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -170,10 +170,8 @@ int __init auide_probe(void);
170 static int auide_dma_host_on(ide_drive_t *drive); 170 static int auide_dma_host_on(ide_drive_t *drive);
171 static int auide_dma_lostirq(ide_drive_t *drive); 171 static int auide_dma_lostirq(ide_drive_t *drive);
172 static int auide_dma_on(ide_drive_t *drive); 172 static int auide_dma_on(ide_drive_t *drive);
173 static void auide_ddma_tx_callback(int irq, void *param, 173 static void auide_ddma_tx_callback(int irq, void *param);
174 struct pt_regs *regs); 174 static void auide_ddma_rx_callback(int irq, void *param);
175 static void auide_ddma_rx_callback(int irq, void *param,
176 struct pt_regs *regs);
177 static int auide_dma_off_quietly(ide_drive_t *drive); 175 static int auide_dma_off_quietly(ide_drive_t *drive);
178#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ 176#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
179 177
diff --git a/include/asm-mips/mach-cobalt/cobalt.h b/include/asm-mips/mach-cobalt/cobalt.h
index b3c5ecbec03c..00b0fc68d5cb 100644
--- a/include/asm-mips/mach-cobalt/cobalt.h
+++ b/include/asm-mips/mach-cobalt/cobalt.h
@@ -67,34 +67,9 @@
67#define COBALT_BRD_ID_QUBE2 0x5 67#define COBALT_BRD_ID_QUBE2 0x5
68#define COBALT_BRD_ID_RAQ2 0x6 68#define COBALT_BRD_ID_RAQ2 0x6
69 69
70/*
71 * Galileo chipset access macros for the Cobalt. The base address for
72 * the GT64111 chip is 0x14000000
73 *
74 * Most of this really should go into a separate GT64111 header file.
75 */
76#define GT64111_IO_BASE 0x10000000UL
77#define GT64111_IO_END 0x11ffffffUL
78#define GT64111_MEM_BASE 0x12000000UL
79#define GT64111_MEM_END 0x13ffffffUL
80#define GT64111_BASE 0x14000000UL
81#define GALILEO_REG(ofs) CKSEG1ADDR(GT64111_BASE + (unsigned long)(ofs))
82
83#define GALILEO_INL(port) (*(volatile unsigned int *) GALILEO_REG(port))
84#define GALILEO_OUTL(val, port) \
85do { \
86 *(volatile unsigned int *) GALILEO_REG(port) = (val); \
87} while (0)
88
89#define GALILEO_INTR_T0EXP (1 << 8)
90#define GALILEO_INTR_RETRY_CTR (1 << 20)
91
92#define GALILEO_ENTC0 0x01
93#define GALILEO_SELTC0 0x02
94
95#define PCI_CFG_SET(devfn,where) \ 70#define PCI_CFG_SET(devfn,where) \
96 GALILEO_OUTL((0x80000000 | (PCI_SLOT (devfn) << 11) | \ 71 GT_WRITE(GT_PCI0_CFGADDR_OFS, (0x80000000 | (PCI_SLOT (devfn) << 11) | \
97 (PCI_FUNC (devfn) << 8) | (where)), GT_PCI0_CFGADDR_OFS) 72 (PCI_FUNC (devfn) << 8) | (where)))
98 73
99#define COBALT_LED_PORT (*(volatile unsigned char *) CKSEG1ADDR(0x1c000000)) 74#define COBALT_LED_PORT (*(volatile unsigned char *) CKSEG1ADDR(0x1c000000))
100# define COBALT_LED_BAR_LEFT (1 << 0) /* Qube */ 75# define COBALT_LED_BAR_LEFT (1 << 0) /* Qube */
diff --git a/include/asm-mips/mach-cobalt/mach-gt64120.h b/include/asm-mips/mach-cobalt/mach-gt64120.h
index 587fc4378f44..ae9c5523c7ef 100644
--- a/include/asm-mips/mach-cobalt/mach-gt64120.h
+++ b/include/asm-mips/mach-cobalt/mach-gt64120.h
@@ -1 +1,27 @@
1/* there's something here ... in the dark */ 1/*
2 * Copyright (C) 2006 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef _COBALT_MACH_GT64120_H
19#define _COBALT_MACH_GT64120_H
20
21/*
22 * Cobalt uses GT64111. GT64111 is almost the same as GT64120.
23 */
24
25#define GT64120_BASE CKSEG1ADDR(GT_DEF_BASE)
26
27#endif /* _COBALT_MACH_GT64120_H */
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
index 1f318d707998..9985cb7c16e7 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -545,62 +545,6 @@
545#define MIPS_FPIR_L (_ULCAST_(1) << 21) 545#define MIPS_FPIR_L (_ULCAST_(1) << 21)
546#define MIPS_FPIR_F64 (_ULCAST_(1) << 22) 546#define MIPS_FPIR_F64 (_ULCAST_(1) << 22)
547 547
548/*
549 * R10000 performance counter definitions.
550 *
551 * FIXME: The R10000 performance counter opens a nice way to implement CPU
552 * time accounting with a precission of one cycle. I don't have
553 * R10000 silicon but just a manual, so ...
554 */
555
556/*
557 * Events counted by counter #0
558 */
559#define CE0_CYCLES 0
560#define CE0_INSN_ISSUED 1
561#define CE0_LPSC_ISSUED 2
562#define CE0_S_ISSUED 3
563#define CE0_SC_ISSUED 4
564#define CE0_SC_FAILED 5
565#define CE0_BRANCH_DECODED 6
566#define CE0_QW_WB_SECONDARY 7
567#define CE0_CORRECTED_ECC_ERRORS 8
568#define CE0_ICACHE_MISSES 9
569#define CE0_SCACHE_I_MISSES 10
570#define CE0_SCACHE_I_WAY_MISSPREDICTED 11
571#define CE0_EXT_INTERVENTIONS_REQ 12
572#define CE0_EXT_INVALIDATE_REQ 13
573#define CE0_VIRTUAL_COHERENCY_COND 14
574#define CE0_INSN_GRADUATED 15
575
576/*
577 * Events counted by counter #1
578 */
579#define CE1_CYCLES 0
580#define CE1_INSN_GRADUATED 1
581#define CE1_LPSC_GRADUATED 2
582#define CE1_S_GRADUATED 3
583#define CE1_SC_GRADUATED 4
584#define CE1_FP_INSN_GRADUATED 5
585#define CE1_QW_WB_PRIMARY 6
586#define CE1_TLB_REFILL 7
587#define CE1_BRANCH_MISSPREDICTED 8
588#define CE1_DCACHE_MISS 9
589#define CE1_SCACHE_D_MISSES 10
590#define CE1_SCACHE_D_WAY_MISSPREDICTED 11
591#define CE1_EXT_INTERVENTION_HITS 12
592#define CE1_EXT_INVALIDATE_REQ 13
593#define CE1_SP_HINT_TO_CEXCL_SC_BLOCKS 14
594#define CE1_SP_HINT_TO_SHARED_SC_BLOCKS 15
595
596/*
597 * These flags define in which privilege mode the counters count events
598 */
599#define CEB_USER 8 /* Count events in user mode, EXL = ERL = 0 */
600#define CEB_SUPERVISOR 4 /* Count events in supvervisor mode EXL = ERL = 0 */
601#define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */
602#define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */
603
604#ifndef __ASSEMBLY__ 548#ifndef __ASSEMBLY__
605 549
606/* 550/*
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 85b258ee7090..0dc1a45c27ed 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -34,7 +34,9 @@
34 34
35#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
36 36
37#include <linux/pfn.h>
37#include <asm/cpu-features.h> 38#include <asm/cpu-features.h>
39#include <asm/io.h>
38 40
39extern void clear_page(void * page); 41extern void clear_page(void * page);
40extern void copy_page(void * to, void * from); 42extern void copy_page(void * to, void * from);
@@ -134,8 +136,14 @@ typedef struct { unsigned long pgprot; } pgprot_t;
134/* to align the pointer to the (next) page boundary */ 136/* to align the pointer to the (next) page boundary */
135#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) 137#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
136 138
137#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 139#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
138#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 140#define __pa_page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)
141#else
142#define __pa_page_offset(x) PAGE_OFFSET
143#endif
144#define __pa(x) ((unsigned long)(x) - __pa_page_offset(x))
145#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))
146#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
139 147
140#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 148#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
141 149
@@ -160,8 +168,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
160 168
161#endif 169#endif
162 170
163#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 171#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr)))
164#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 172#define virt_addr_valid(kaddr) pfn_valid(PFN_DOWN(virt_to_phys(kaddr)))
165 173
166#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 174#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
167 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 175 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index d20f2e9b28be..2fbd47eba32d 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -156,9 +156,9 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
156#define __pte_offset(address) \ 156#define __pte_offset(address) \
157 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 157 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
158#define pte_offset(dir, address) \ 158#define pte_offset(dir, address) \
159 ((pte_t *) (pmd_page_vaddr(*dir)) + __pte_offset(address)) 159 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
160#define pte_offset_kernel(dir, address) \ 160#define pte_offset_kernel(dir, address) \
161 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) 161 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
162 162
163#define pte_offset_map(dir, address) \ 163#define pte_offset_map(dir, address) \
164 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) 164 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index 7e7320300aa3..a5b18710b6a4 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -14,6 +14,7 @@
14#include <asm/addrspace.h> 14#include <asm/addrspace.h>
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/cachectl.h> 16#include <asm/cachectl.h>
17#include <asm/fixmap.h>
17 18
18#include <asm-generic/pgtable-nopud.h> 19#include <asm-generic/pgtable-nopud.h>
19 20
@@ -103,6 +104,13 @@
103#define VMALLOC_START MAP_BASE 104#define VMALLOC_START MAP_BASE
104#define VMALLOC_END \ 105#define VMALLOC_END \
105 (VMALLOC_START + PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE) 106 (VMALLOC_START + PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE)
107#if defined(CONFIG_MODULES) && !defined(CONFIG_BUILD_ELF64) && \
108 VMALLOC_START != CKSSEG
109/* Load modules into 32bit-compatible segment. */
110#define MODULE_START CKSSEG
111#define MODULE_END (FIXADDR_START-2*PAGE_SIZE)
112extern pgd_t module_pg_dir[PTRS_PER_PGD];
113#endif
106 114
107#define pte_ERROR(e) \ 115#define pte_ERROR(e) \
108 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) 116 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
@@ -174,7 +182,12 @@ static inline void pud_clear(pud_t *pudp)
174#define __pmd_offset(address) pmd_index(address) 182#define __pmd_offset(address) pmd_index(address)
175 183
176/* to find an entry in a kernel page-table-directory */ 184/* to find an entry in a kernel page-table-directory */
185#ifdef MODULE_START
186#define pgd_offset_k(address) \
187 ((address) >= MODULE_START ? module_pg_dir : pgd_offset(&init_mm, 0UL))
188#else
177#define pgd_offset_k(address) pgd_offset(&init_mm, 0UL) 189#define pgd_offset_k(address) pgd_offset(&init_mm, 0UL)
190#endif
178 191
179#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 192#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
180#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) 193#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
@@ -199,9 +212,9 @@ static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address)
199#define __pte_offset(address) \ 212#define __pte_offset(address) \
200 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 213 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
201#define pte_offset(dir, address) \ 214#define pte_offset(dir, address) \
202 ((pte_t *) (pmd_page_vaddr(*dir)) + __pte_offset(address)) 215 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
203#define pte_offset_kernel(dir, address) \ 216#define pte_offset_kernel(dir, address) \
204 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) 217 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
205#define pte_offset_map(dir, address) \ 218#define pte_offset_map(dir, address) \
206 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) 219 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
207#define pte_offset_map_nested(dir, address) \ 220#define pte_offset_map_nested(dir, address) \
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 1ca4d1e185c7..f2e1325fec6c 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -67,7 +67,7 @@ extern unsigned long empty_zero_page;
67extern unsigned long zero_page_mask; 67extern unsigned long zero_page_mask;
68 68
69#define ZERO_PAGE(vaddr) \ 69#define ZERO_PAGE(vaddr) \
70 (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))) 70 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
71 71
72#define __HAVE_ARCH_MOVE_PTE 72#define __HAVE_ARCH_MOVE_PTE
73#define move_pte(pte, prot, old_addr, new_addr) \ 73#define move_pte(pte, prot, old_addr, new_addr) \
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index 5f3a9075cd28..30bf555faeaa 100644
--- a/include/asm-mips/ptrace.h
+++ b/include/asm-mips/ptrace.h
@@ -80,8 +80,6 @@ struct pt_regs {
80#define instruction_pointer(regs) ((regs)->cp0_epc) 80#define instruction_pointer(regs) ((regs)->cp0_epc)
81#define profile_pc(regs) instruction_pointer(regs) 81#define profile_pc(regs) instruction_pointer(regs)
82 82
83extern void show_regs(struct pt_regs *);
84
85extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit); 83extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
86 84
87#endif 85#endif
diff --git a/include/asm-mips/setup.h b/include/asm-mips/setup.h
index 737fa4a6912e..70009a902639 100644
--- a/include/asm-mips/setup.h
+++ b/include/asm-mips/setup.h
@@ -1,8 +1,6 @@
1#ifdef __KERNEL__
2#ifndef _MIPS_SETUP_H 1#ifndef _MIPS_SETUP_H
3#define _MIPS_SETUP_H 2#define _MIPS_SETUP_H
4 3
5#define COMMAND_LINE_SIZE 256 4#define COMMAND_LINE_SIZE 256
6 5
7#endif /* __SETUP_H */ 6#endif /* __SETUP_H */
8#endif /* __KERNEL__ */
diff --git a/include/asm-mips/sn/klconfig.h b/include/asm-mips/sn/klconfig.h
index b63cd0655b3d..15d70ca56187 100644
--- a/include/asm-mips/sn/klconfig.h
+++ b/include/asm-mips/sn/klconfig.h
@@ -176,7 +176,7 @@ typedef struct kl_config_hdr {
176/* --- New Macros for the changed kl_config_hdr_t structure --- */ 176/* --- New Macros for the changed kl_config_hdr_t structure --- */
177 177
178#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\ 178#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\
179 (unsigned long)_k + (_k->ch_malloc_hdr_off))) 179 ((unsigned long)_k + (_k->ch_malloc_hdr_off)))
180 180
181#define KL_CONFIG_CH_MALLOC_HDR(_n) PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n)) 181#define KL_CONFIG_CH_MALLOC_HDR(_n) PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))
182 182
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index c8d5587467bb..fc3217fc1118 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -3,12 +3,13 @@
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) 1999, 2000 by Ralf Baechle 6 * Copyright (C) 1999, 2000, 06 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */ 8 */
9#ifndef _ASM_SPINLOCK_H 9#ifndef _ASM_SPINLOCK_H
10#define _ASM_SPINLOCK_H 10#define _ASM_SPINLOCK_H
11 11
12#include <asm/barrier.h>
12#include <asm/war.h> 13#include <asm/war.h>
13 14
14/* 15/*
@@ -40,7 +41,6 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
40 " sc %1, %0 \n" 41 " sc %1, %0 \n"
41 " beqzl %1, 1b \n" 42 " beqzl %1, 1b \n"
42 " nop \n" 43 " nop \n"
43 " sync \n"
44 " .set reorder \n" 44 " .set reorder \n"
45 : "=m" (lock->lock), "=&r" (tmp) 45 : "=m" (lock->lock), "=&r" (tmp)
46 : "m" (lock->lock) 46 : "m" (lock->lock)
@@ -53,19 +53,22 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
53 " li %1, 1 \n" 53 " li %1, 1 \n"
54 " sc %1, %0 \n" 54 " sc %1, %0 \n"
55 " beqz %1, 1b \n" 55 " beqz %1, 1b \n"
56 " sync \n" 56 " nop \n"
57 " .set reorder \n" 57 " .set reorder \n"
58 : "=m" (lock->lock), "=&r" (tmp) 58 : "=m" (lock->lock), "=&r" (tmp)
59 : "m" (lock->lock) 59 : "m" (lock->lock)
60 : "memory"); 60 : "memory");
61 } 61 }
62
63 smp_mb();
62} 64}
63 65
64static inline void __raw_spin_unlock(raw_spinlock_t *lock) 66static inline void __raw_spin_unlock(raw_spinlock_t *lock)
65{ 67{
68 smp_mb();
69
66 __asm__ __volatile__( 70 __asm__ __volatile__(
67 " .set noreorder # __raw_spin_unlock \n" 71 " .set noreorder # __raw_spin_unlock \n"
68 " sync \n"
69 " sw $0, %0 \n" 72 " sw $0, %0 \n"
70 " .set\treorder \n" 73 " .set\treorder \n"
71 : "=m" (lock->lock) 74 : "=m" (lock->lock)
@@ -86,7 +89,6 @@ static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock)
86 " beqzl %2, 1b \n" 89 " beqzl %2, 1b \n"
87 " nop \n" 90 " nop \n"
88 " andi %2, %0, 1 \n" 91 " andi %2, %0, 1 \n"
89 " sync \n"
90 " .set reorder" 92 " .set reorder"
91 : "=&r" (temp), "=m" (lock->lock), "=&r" (res) 93 : "=&r" (temp), "=m" (lock->lock), "=&r" (res)
92 : "m" (lock->lock) 94 : "m" (lock->lock)
@@ -99,13 +101,14 @@ static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock)
99 " sc %2, %1 \n" 101 " sc %2, %1 \n"
100 " beqz %2, 1b \n" 102 " beqz %2, 1b \n"
101 " andi %2, %0, 1 \n" 103 " andi %2, %0, 1 \n"
102 " sync \n"
103 " .set reorder" 104 " .set reorder"
104 : "=&r" (temp), "=m" (lock->lock), "=&r" (res) 105 : "=&r" (temp), "=m" (lock->lock), "=&r" (res)
105 : "m" (lock->lock) 106 : "m" (lock->lock)
106 : "memory"); 107 : "memory");
107 } 108 }
108 109
110 smp_mb();
111
109 return res == 0; 112 return res == 0;
110} 113}
111 114
@@ -143,7 +146,6 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
143 " sc %1, %0 \n" 146 " sc %1, %0 \n"
144 " beqzl %1, 1b \n" 147 " beqzl %1, 1b \n"
145 " nop \n" 148 " nop \n"
146 " sync \n"
147 " .set reorder \n" 149 " .set reorder \n"
148 : "=m" (rw->lock), "=&r" (tmp) 150 : "=m" (rw->lock), "=&r" (tmp)
149 : "m" (rw->lock) 151 : "m" (rw->lock)
@@ -156,12 +158,14 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
156 " addu %1, 1 \n" 158 " addu %1, 1 \n"
157 " sc %1, %0 \n" 159 " sc %1, %0 \n"
158 " beqz %1, 1b \n" 160 " beqz %1, 1b \n"
159 " sync \n" 161 " nop \n"
160 " .set reorder \n" 162 " .set reorder \n"
161 : "=m" (rw->lock), "=&r" (tmp) 163 : "=m" (rw->lock), "=&r" (tmp)
162 : "m" (rw->lock) 164 : "m" (rw->lock)
163 : "memory"); 165 : "memory");
164 } 166 }
167
168 smp_mb();
165} 169}
166 170
167/* Note the use of sub, not subu which will make the kernel die with an 171/* Note the use of sub, not subu which will make the kernel die with an
@@ -171,13 +175,14 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
171{ 175{
172 unsigned int tmp; 176 unsigned int tmp;
173 177
178 smp_mb();
179
174 if (R10000_LLSC_WAR) { 180 if (R10000_LLSC_WAR) {
175 __asm__ __volatile__( 181 __asm__ __volatile__(
176 "1: ll %1, %2 # __raw_read_unlock \n" 182 "1: ll %1, %2 # __raw_read_unlock \n"
177 " sub %1, 1 \n" 183 " sub %1, 1 \n"
178 " sc %1, %0 \n" 184 " sc %1, %0 \n"
179 " beqzl %1, 1b \n" 185 " beqzl %1, 1b \n"
180 " sync \n"
181 : "=m" (rw->lock), "=&r" (tmp) 186 : "=m" (rw->lock), "=&r" (tmp)
182 : "m" (rw->lock) 187 : "m" (rw->lock)
183 : "memory"); 188 : "memory");
@@ -188,7 +193,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
188 " sub %1, 1 \n" 193 " sub %1, 1 \n"
189 " sc %1, %0 \n" 194 " sc %1, %0 \n"
190 " beqz %1, 1b \n" 195 " beqz %1, 1b \n"
191 " sync \n" 196 " nop \n"
192 " .set reorder \n" 197 " .set reorder \n"
193 : "=m" (rw->lock), "=&r" (tmp) 198 : "=m" (rw->lock), "=&r" (tmp)
194 : "m" (rw->lock) 199 : "m" (rw->lock)
@@ -208,7 +213,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
208 " lui %1, 0x8000 \n" 213 " lui %1, 0x8000 \n"
209 " sc %1, %0 \n" 214 " sc %1, %0 \n"
210 " beqzl %1, 1b \n" 215 " beqzl %1, 1b \n"
211 " sync \n" 216 " nop \n"
212 " .set reorder \n" 217 " .set reorder \n"
213 : "=m" (rw->lock), "=&r" (tmp) 218 : "=m" (rw->lock), "=&r" (tmp)
214 : "m" (rw->lock) 219 : "m" (rw->lock)
@@ -221,18 +226,22 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
221 " lui %1, 0x8000 \n" 226 " lui %1, 0x8000 \n"
222 " sc %1, %0 \n" 227 " sc %1, %0 \n"
223 " beqz %1, 1b \n" 228 " beqz %1, 1b \n"
224 " sync \n" 229 " nop \n"
225 " .set reorder \n" 230 " .set reorder \n"
226 : "=m" (rw->lock), "=&r" (tmp) 231 : "=m" (rw->lock), "=&r" (tmp)
227 : "m" (rw->lock) 232 : "m" (rw->lock)
228 : "memory"); 233 : "memory");
229 } 234 }
235
236 smp_mb();
230} 237}
231 238
232static inline void __raw_write_unlock(raw_rwlock_t *rw) 239static inline void __raw_write_unlock(raw_rwlock_t *rw)
233{ 240{
241 smp_mb();
242
234 __asm__ __volatile__( 243 __asm__ __volatile__(
235 " sync # __raw_write_unlock \n" 244 " # __raw_write_unlock \n"
236 " sw $0, %0 \n" 245 " sw $0, %0 \n"
237 : "=m" (rw->lock) 246 : "=m" (rw->lock)
238 : "m" (rw->lock) 247 : "m" (rw->lock)
@@ -252,11 +261,10 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
252 " bnez %1, 2f \n" 261 " bnez %1, 2f \n"
253 " addu %1, 1 \n" 262 " addu %1, 1 \n"
254 " sc %1, %0 \n" 263 " sc %1, %0 \n"
255 " beqzl %1, 1b \n"
256 " .set reorder \n" 264 " .set reorder \n"
257#ifdef CONFIG_SMP 265 " beqzl %1, 1b \n"
258 " sync \n" 266 " nop \n"
259#endif 267 __WEAK_ORDERING_MB
260 " li %2, 1 \n" 268 " li %2, 1 \n"
261 "2: \n" 269 "2: \n"
262 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret) 270 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
@@ -271,10 +279,9 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
271 " addu %1, 1 \n" 279 " addu %1, 1 \n"
272 " sc %1, %0 \n" 280 " sc %1, %0 \n"
273 " beqz %1, 1b \n" 281 " beqz %1, 1b \n"
282 " nop \n"
274 " .set reorder \n" 283 " .set reorder \n"
275#ifdef CONFIG_SMP 284 __WEAK_ORDERING_MB
276 " sync \n"
277#endif
278 " li %2, 1 \n" 285 " li %2, 1 \n"
279 "2: \n" 286 "2: \n"
280 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret) 287 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
@@ -299,7 +306,8 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
299 " lui %1, 0x8000 \n" 306 " lui %1, 0x8000 \n"
300 " sc %1, %0 \n" 307 " sc %1, %0 \n"
301 " beqzl %1, 1b \n" 308 " beqzl %1, 1b \n"
302 " sync \n" 309 " nop \n"
310 __WEAK_ORDERING_MB
303 " li %2, 1 \n" 311 " li %2, 1 \n"
304 " .set reorder \n" 312 " .set reorder \n"
305 "2: \n" 313 "2: \n"
@@ -315,7 +323,8 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
315 " lui %1, 0x8000 \n" 323 " lui %1, 0x8000 \n"
316 " sc %1, %0 \n" 324 " sc %1, %0 \n"
317 " beqz %1, 1b \n" 325 " beqz %1, 1b \n"
318 " sync \n" 326 " nop \n"
327 __WEAK_ORDERING_MB
319 " li %2, 1 \n" 328 " li %2, 1 \n"
320 " .set reorder \n" 329 " .set reorder \n"
321 "2: \n" 330 "2: \n"
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 3056feed5a36..9428057a50cf 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -3,7 +3,7 @@
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) 1994, 95, 96, 97, 98, 99, 2003 by Ralf Baechle 6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003, 06 by Ralf Baechle
7 * Copyright (C) 1996 by Paul M. Antoine 7 * Copyright (C) 1996 by Paul M. Antoine
8 * Copyright (C) 1999 Silicon Graphics 8 * Copyright (C) 1999 Silicon Graphics
9 * Kevin D. Kissell, kevink@mips.org and Carsten Langgaard, carstenl@mips.com 9 * Kevin D. Kissell, kevink@mips.org and Carsten Langgaard, carstenl@mips.com
@@ -16,132 +16,12 @@
16#include <linux/irqflags.h> 16#include <linux/irqflags.h>
17 17
18#include <asm/addrspace.h> 18#include <asm/addrspace.h>
19#include <asm/barrier.h>
19#include <asm/cpu-features.h> 20#include <asm/cpu-features.h>
20#include <asm/dsp.h> 21#include <asm/dsp.h>
21#include <asm/ptrace.h> 22#include <asm/ptrace.h>
22#include <asm/war.h> 23#include <asm/war.h>
23 24
24/*
25 * read_barrier_depends - Flush all pending reads that subsequents reads
26 * depend on.
27 *
28 * No data-dependent reads from memory-like regions are ever reordered
29 * over this barrier. All reads preceding this primitive are guaranteed
30 * to access memory (but not necessarily other CPUs' caches) before any
31 * reads following this primitive that depend on the data return by
32 * any of the preceding reads. This primitive is much lighter weight than
33 * rmb() on most CPUs, and is never heavier weight than is
34 * rmb().
35 *
36 * These ordering constraints are respected by both the local CPU
37 * and the compiler.
38 *
39 * Ordering is not guaranteed by anything other than these primitives,
40 * not even by data dependencies. See the documentation for
41 * memory_barrier() for examples and URLs to more information.
42 *
43 * For example, the following code would force ordering (the initial
44 * value of "a" is zero, "b" is one, and "p" is "&a"):
45 *
46 * <programlisting>
47 * CPU 0 CPU 1
48 *
49 * b = 2;
50 * memory_barrier();
51 * p = &b; q = p;
52 * read_barrier_depends();
53 * d = *q;
54 * </programlisting>
55 *
56 * because the read of "*q" depends on the read of "p" and these
57 * two reads are separated by a read_barrier_depends(). However,
58 * the following code, with the same initial values for "a" and "b":
59 *
60 * <programlisting>
61 * CPU 0 CPU 1
62 *
63 * a = 2;
64 * memory_barrier();
65 * b = 3; y = b;
66 * read_barrier_depends();
67 * x = a;
68 * </programlisting>
69 *
70 * does not enforce ordering, since there is no data dependency between
71 * the read of "a" and the read of "b". Therefore, on some CPUs, such
72 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
73 * in cases like this where there are no data dependencies.
74 */
75
76#define read_barrier_depends() do { } while(0)
77
78#ifdef CONFIG_CPU_HAS_SYNC
79#define __sync() \
80 __asm__ __volatile__( \
81 ".set push\n\t" \
82 ".set noreorder\n\t" \
83 ".set mips2\n\t" \
84 "sync\n\t" \
85 ".set pop" \
86 : /* no output */ \
87 : /* no input */ \
88 : "memory")
89#else
90#define __sync() do { } while(0)
91#endif
92
93#define __fast_iob() \
94 __asm__ __volatile__( \
95 ".set push\n\t" \
96 ".set noreorder\n\t" \
97 "lw $0,%0\n\t" \
98 "nop\n\t" \
99 ".set pop" \
100 : /* no output */ \
101 : "m" (*(int *)CKSEG1) \
102 : "memory")
103
104#define fast_wmb() __sync()
105#define fast_rmb() __sync()
106#define fast_mb() __sync()
107#define fast_iob() \
108 do { \
109 __sync(); \
110 __fast_iob(); \
111 } while (0)
112
113#ifdef CONFIG_CPU_HAS_WB
114
115#include <asm/wbflush.h>
116
117#define wmb() fast_wmb()
118#define rmb() fast_rmb()
119#define mb() wbflush()
120#define iob() wbflush()
121
122#else /* !CONFIG_CPU_HAS_WB */
123
124#define wmb() fast_wmb()
125#define rmb() fast_rmb()
126#define mb() fast_mb()
127#define iob() fast_iob()
128
129#endif /* !CONFIG_CPU_HAS_WB */
130
131#ifdef CONFIG_SMP
132#define smp_mb() mb()
133#define smp_rmb() rmb()
134#define smp_wmb() wmb()
135#define smp_read_barrier_depends() read_barrier_depends()
136#else
137#define smp_mb() barrier()
138#define smp_rmb() barrier()
139#define smp_wmb() barrier()
140#define smp_read_barrier_depends() do { } while(0)
141#endif
142
143#define set_mb(var, value) \
144do { var = value; mb(); } while (0)
145 25
146/* 26/*
147 * switch_to(n) should switch tasks to task nr n, first 27 * switch_to(n) should switch tasks to task nr n, first
@@ -217,9 +97,6 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
217 " .set mips3 \n" 97 " .set mips3 \n"
218 " sc %2, %1 \n" 98 " sc %2, %1 \n"
219 " beqzl %2, 1b \n" 99 " beqzl %2, 1b \n"
220#ifdef CONFIG_SMP
221 " sync \n"
222#endif
223 " .set mips0 \n" 100 " .set mips0 \n"
224 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 101 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
225 : "R" (*m), "Jr" (val) 102 : "R" (*m), "Jr" (val)
@@ -235,9 +112,6 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
235 " .set mips3 \n" 112 " .set mips3 \n"
236 " sc %2, %1 \n" 113 " sc %2, %1 \n"
237 " beqz %2, 1b \n" 114 " beqz %2, 1b \n"
238#ifdef CONFIG_SMP
239 " sync \n"
240#endif
241 " .set mips0 \n" 115 " .set mips0 \n"
242 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 116 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
243 : "R" (*m), "Jr" (val) 117 : "R" (*m), "Jr" (val)
@@ -251,6 +125,8 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
251 local_irq_restore(flags); /* implies memory barrier */ 125 local_irq_restore(flags); /* implies memory barrier */
252 } 126 }
253 127
128 smp_mb();
129
254 return retval; 130 return retval;
255} 131}
256 132
@@ -268,9 +144,6 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
268 " move %2, %z4 \n" 144 " move %2, %z4 \n"
269 " scd %2, %1 \n" 145 " scd %2, %1 \n"
270 " beqzl %2, 1b \n" 146 " beqzl %2, 1b \n"
271#ifdef CONFIG_SMP
272 " sync \n"
273#endif
274 " .set mips0 \n" 147 " .set mips0 \n"
275 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 148 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
276 : "R" (*m), "Jr" (val) 149 : "R" (*m), "Jr" (val)
@@ -284,9 +157,6 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
284 " move %2, %z4 \n" 157 " move %2, %z4 \n"
285 " scd %2, %1 \n" 158 " scd %2, %1 \n"
286 " beqz %2, 1b \n" 159 " beqz %2, 1b \n"
287#ifdef CONFIG_SMP
288 " sync \n"
289#endif
290 " .set mips0 \n" 160 " .set mips0 \n"
291 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 161 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
292 : "R" (*m), "Jr" (val) 162 : "R" (*m), "Jr" (val)
@@ -300,6 +170,8 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
300 local_irq_restore(flags); /* implies memory barrier */ 170 local_irq_restore(flags); /* implies memory barrier */
301 } 171 }
302 172
173 smp_mb();
174
303 return retval; 175 return retval;
304} 176}
305#else 177#else
@@ -345,9 +217,6 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
345 " .set mips3 \n" 217 " .set mips3 \n"
346 " sc $1, %1 \n" 218 " sc $1, %1 \n"
347 " beqzl $1, 1b \n" 219 " beqzl $1, 1b \n"
348#ifdef CONFIG_SMP
349 " sync \n"
350#endif
351 "2: \n" 220 "2: \n"
352 " .set pop \n" 221 " .set pop \n"
353 : "=&r" (retval), "=R" (*m) 222 : "=&r" (retval), "=R" (*m)
@@ -365,9 +234,6 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
365 " .set mips3 \n" 234 " .set mips3 \n"
366 " sc $1, %1 \n" 235 " sc $1, %1 \n"
367 " beqz $1, 1b \n" 236 " beqz $1, 1b \n"
368#ifdef CONFIG_SMP
369 " sync \n"
370#endif
371 "2: \n" 237 "2: \n"
372 " .set pop \n" 238 " .set pop \n"
373 : "=&r" (retval), "=R" (*m) 239 : "=&r" (retval), "=R" (*m)
@@ -383,6 +249,8 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
383 local_irq_restore(flags); /* implies memory barrier */ 249 local_irq_restore(flags); /* implies memory barrier */
384 } 250 }
385 251
252 smp_mb();
253
386 return retval; 254 return retval;
387} 255}
388 256
@@ -402,9 +270,6 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
402 " move $1, %z4 \n" 270 " move $1, %z4 \n"
403 " scd $1, %1 \n" 271 " scd $1, %1 \n"
404 " beqzl $1, 1b \n" 272 " beqzl $1, 1b \n"
405#ifdef CONFIG_SMP
406 " sync \n"
407#endif
408 "2: \n" 273 "2: \n"
409 " .set pop \n" 274 " .set pop \n"
410 : "=&r" (retval), "=R" (*m) 275 : "=&r" (retval), "=R" (*m)
@@ -420,9 +285,6 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
420 " move $1, %z4 \n" 285 " move $1, %z4 \n"
421 " scd $1, %1 \n" 286 " scd $1, %1 \n"
422 " beqz $1, 1b \n" 287 " beqz $1, 1b \n"
423#ifdef CONFIG_SMP
424 " sync \n"
425#endif
426 "2: \n" 288 "2: \n"
427 " .set pop \n" 289 " .set pop \n"
428 : "=&r" (retval), "=R" (*m) 290 : "=&r" (retval), "=R" (*m)
@@ -438,6 +300,8 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
438 local_irq_restore(flags); /* implies memory barrier */ 300 local_irq_restore(flags); /* implies memory barrier */
439 } 301 }
440 302
303 smp_mb();
304
441 return retval; 305 return retval;
442} 306}
443#else 307#else
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index 625acd337bc3..a632cef830a2 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -21,6 +21,7 @@
21#include <linux/ptrace.h> 21#include <linux/ptrace.h>
22#include <linux/rtc.h> 22#include <linux/rtc.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/clocksource.h>
24 25
25extern spinlock_t rtc_lock; 26extern spinlock_t rtc_lock;
26 27
@@ -44,12 +45,10 @@ extern int (*mips_timer_state)(void);
44extern void (*mips_timer_ack)(void); 45extern void (*mips_timer_ack)(void);
45 46
46/* 47/*
47 * High precision timer functions. 48 * High precision timer clocksource.
48 * If mips_hpt_read is NULL, an R4k-compatible timer setup is attempted. 49 * If .read is NULL, an R4k-compatible timer setup is attempted.
49 */ 50 */
50extern unsigned int (*mips_hpt_read)(void); 51extern struct clocksource clocksource_mips;
51extern void (*mips_hpt_init)(void);
52extern unsigned int mips_hpt_mask;
53 52
54/* 53/*
55 * to_tm() converts system time back to (year, mon, day, hour, min, sec). 54 * to_tm() converts system time back to (year, mon, day, hour, min, sec).
diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h
index 2b52e180c6f2..63a13c5bd832 100644
--- a/include/asm-mips/types.h
+++ b/include/asm-mips/types.h
@@ -93,16 +93,6 @@ typedef unsigned long long phys_t;
93typedef unsigned long phys_t; 93typedef unsigned long phys_t;
94#endif 94#endif
95 95
96#ifdef CONFIG_LBD
97typedef u64 sector_t;
98#define HAVE_SECTOR_T
99#endif
100
101#ifdef CONFIG_LSF
102typedef u64 blkcnt_t;
103#define HAVE_BLKCNT_T
104#endif
105
106#endif /* __ASSEMBLY__ */ 96#endif /* __ASSEMBLY__ */
107 97
108#endif /* __KERNEL__ */ 98#endif /* __KERNEL__ */
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index ec56aa52f669..696cff39a1d3 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -933,268 +933,6 @@
933 933
934#ifndef __ASSEMBLY__ 934#ifndef __ASSEMBLY__
935 935
936/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
937#define _syscall0(type,name) \
938type name(void) \
939{ \
940 register unsigned long __a3 asm("$7"); \
941 unsigned long __v0; \
942 \
943 __asm__ volatile ( \
944 ".set\tnoreorder\n\t" \
945 "li\t$2, %2\t\t\t# " #name "\n\t" \
946 "syscall\n\t" \
947 "move\t%0, $2\n\t" \
948 ".set\treorder" \
949 : "=&r" (__v0), "=r" (__a3) \
950 : "i" (__NR_##name) \
951 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
952 "memory"); \
953 \
954 if (__a3 == 0) \
955 return (type) __v0; \
956 errno = __v0; \
957 return (type) -1; \
958}
959
960/*
961 * DANGER: This macro isn't usable for the pipe(2) call
962 * which has a unusual return convention.
963 */
964#define _syscall1(type,name,atype,a) \
965type name(atype a) \
966{ \
967 register unsigned long __a0 asm("$4") = (unsigned long) a; \
968 register unsigned long __a3 asm("$7"); \
969 unsigned long __v0; \
970 \
971 __asm__ volatile ( \
972 ".set\tnoreorder\n\t" \
973 "li\t$2, %3\t\t\t# " #name "\n\t" \
974 "syscall\n\t" \
975 "move\t%0, $2\n\t" \
976 ".set\treorder" \
977 : "=&r" (__v0), "=r" (__a3) \
978 : "r" (__a0), "i" (__NR_##name) \
979 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
980 "memory"); \
981 \
982 if (__a3 == 0) \
983 return (type) __v0; \
984 errno = __v0; \
985 return (type) -1; \
986}
987
988#define _syscall2(type,name,atype,a,btype,b) \
989type name(atype a, btype b) \
990{ \
991 register unsigned long __a0 asm("$4") = (unsigned long) a; \
992 register unsigned long __a1 asm("$5") = (unsigned long) b; \
993 register unsigned long __a3 asm("$7"); \
994 unsigned long __v0; \
995 \
996 __asm__ volatile ( \
997 ".set\tnoreorder\n\t" \
998 "li\t$2, %4\t\t\t# " #name "\n\t" \
999 "syscall\n\t" \
1000 "move\t%0, $2\n\t" \
1001 ".set\treorder" \
1002 : "=&r" (__v0), "=r" (__a3) \
1003 : "r" (__a0), "r" (__a1), "i" (__NR_##name) \
1004 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
1005 "memory"); \
1006 \
1007 if (__a3 == 0) \
1008 return (type) __v0; \
1009 errno = __v0; \
1010 return (type) -1; \
1011}
1012
1013#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
1014type name(atype a, btype b, ctype c) \
1015{ \
1016 register unsigned long __a0 asm("$4") = (unsigned long) a; \
1017 register unsigned long __a1 asm("$5") = (unsigned long) b; \
1018 register unsigned long __a2 asm("$6") = (unsigned long) c; \
1019 register unsigned long __a3 asm("$7"); \
1020 unsigned long __v0; \
1021 \
1022 __asm__ volatile ( \
1023 ".set\tnoreorder\n\t" \
1024 "li\t$2, %5\t\t\t# " #name "\n\t" \
1025 "syscall\n\t" \
1026 "move\t%0, $2\n\t" \
1027 ".set\treorder" \
1028 : "=&r" (__v0), "=r" (__a3) \
1029 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \
1030 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
1031 "memory"); \
1032 \
1033 if (__a3 == 0) \
1034 return (type) __v0; \
1035 errno = __v0; \
1036 return (type) -1; \
1037}
1038
1039#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
1040type name(atype a, btype b, ctype c, dtype d) \
1041{ \
1042 register unsigned long __a0 asm("$4") = (unsigned long) a; \
1043 register unsigned long __a1 asm("$5") = (unsigned long) b; \
1044 register unsigned long __a2 asm("$6") = (unsigned long) c; \
1045 register unsigned long __a3 asm("$7") = (unsigned long) d; \
1046 unsigned long __v0; \
1047 \
1048 __asm__ volatile ( \
1049 ".set\tnoreorder\n\t" \
1050 "li\t$2, %5\t\t\t# " #name "\n\t" \
1051 "syscall\n\t" \
1052 "move\t%0, $2\n\t" \
1053 ".set\treorder" \
1054 : "=&r" (__v0), "+r" (__a3) \
1055 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name) \
1056 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
1057 "memory"); \
1058 \
1059 if (__a3 == 0) \
1060 return (type) __v0; \
1061 errno = __v0; \
1062 return (type) -1; \
1063}
1064
1065#if (_MIPS_SIM == _MIPS_SIM_ABI32)
1066
1067/*
1068 * Using those means your brain needs more than an oil change ;-)
1069 */
1070
1071#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
1072type name(atype a, btype b, ctype c, dtype d, etype e) \
1073{ \
1074 register unsigned long __a0 asm("$4") = (unsigned long) a; \
1075 register unsigned long __a1 asm("$5") = (unsigned long) b; \
1076 register unsigned long __a2 asm("$6") = (unsigned long) c; \
1077 register unsigned long __a3 asm("$7") = (unsigned long) d; \
1078 unsigned long __v0; \
1079 \
1080 __asm__ volatile ( \
1081 ".set\tnoreorder\n\t" \
1082 "lw\t$2, %6\n\t" \
1083 "subu\t$29, 32\n\t" \
1084 "sw\t$2, 16($29)\n\t" \
1085 "li\t$2, %5\t\t\t# " #name "\n\t" \
1086 "syscall\n\t" \
1087 "move\t%0, $2\n\t" \
1088 "addiu\t$29, 32\n\t" \
1089 ".set\treorder" \
1090 : "=&r" (__v0), "+r" (__a3) \
1091 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name), \
1092 "m" ((unsigned long)e) \
1093 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
1094 "memory"); \
1095 \
1096 if (__a3 == 0) \
1097 return (type) __v0; \
1098 errno = __v0; \
1099 return (type) -1; \
1100}
1101
1102#define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
1103type name(atype a, btype b, ctype c, dtype d, etype e, ftype f) \
1104{ \
1105 register unsigned long __a0 asm("$4") = (unsigned long) a; \
1106 register unsigned long __a1 asm("$5") = (unsigned long) b; \
1107 register unsigned long __a2 asm("$6") = (unsigned long) c; \
1108 register unsigned long __a3 asm("$7") = (unsigned long) d; \
1109 unsigned long __v0; \
1110 \
1111 __asm__ volatile ( \
1112 ".set\tnoreorder\n\t" \
1113 "lw\t$2, %6\n\t" \
1114 "lw\t$8, %7\n\t" \
1115 "subu\t$29, 32\n\t" \
1116 "sw\t$2, 16($29)\n\t" \
1117 "sw\t$8, 20($29)\n\t" \
1118 "li\t$2, %5\t\t\t# " #name "\n\t" \
1119 "syscall\n\t" \
1120 "move\t%0, $2\n\t" \
1121 "addiu\t$29, 32\n\t" \
1122 ".set\treorder" \
1123 : "=&r" (__v0), "+r" (__a3) \
1124 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_##name), \
1125 "m" ((unsigned long)e), "m" ((unsigned long)f) \
1126 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
1127 "memory"); \
1128 \
1129 if (__a3 == 0) \
1130 return (type) __v0; \
1131 errno = __v0; \
1132 return (type) -1; \
1133}
1134
1135#endif /* (_MIPS_SIM == _MIPS_SIM_ABI32) */
1136
1137#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
1138
1139#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
1140type name (atype a,btype b,ctype c,dtype d,etype e) \
1141{ \
1142 register unsigned long __a0 asm("$4") = (unsigned long) a; \
1143 register unsigned long __a1 asm("$5") = (unsigned long) b; \
1144 register unsigned long __a2 asm("$6") = (unsigned long) c; \
1145 register unsigned long __a3 asm("$7") = (unsigned long) d; \
1146 register unsigned long __a4 asm("$8") = (unsigned long) e; \
1147 unsigned long __v0; \
1148 \
1149 __asm__ volatile ( \
1150 ".set\tnoreorder\n\t" \
1151 "li\t$2, %6\t\t\t# " #name "\n\t" \
1152 "syscall\n\t" \
1153 "move\t%0, $2\n\t" \
1154 ".set\treorder" \
1155 : "=&r" (__v0), "+r" (__a3) \
1156 : "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), "i" (__NR_##name) \
1157 : "$2", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
1158 "memory"); \
1159 \
1160 if (__a3 == 0) \
1161 return (type) __v0; \
1162 errno = __v0; \
1163 return (type) -1; \
1164}
1165
1166#define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
1167type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
1168{ \
1169 register unsigned long __a0 asm("$4") = (unsigned long) a; \
1170 register unsigned long __a1 asm("$5") = (unsigned long) b; \
1171 register unsigned long __a2 asm("$6") = (unsigned long) c; \
1172 register unsigned long __a3 asm("$7") = (unsigned long) d; \
1173 register unsigned long __a4 asm("$8") = (unsigned long) e; \
1174 register unsigned long __a5 asm("$9") = (unsigned long) f; \
1175 unsigned long __v0; \
1176 \
1177 __asm__ volatile ( \
1178 ".set\tnoreorder\n\t" \
1179 "li\t$2, %7\t\t\t# " #name "\n\t" \
1180 "syscall\n\t" \
1181 "move\t%0, $2\n\t" \
1182 ".set\treorder" \
1183 : "=&r" (__v0), "+r" (__a3) \
1184 : "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), "r" (__a5), \
1185 "i" (__NR_##name) \
1186 : "$2", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
1187 "memory"); \
1188 \
1189 if (__a3 == 0) \
1190 return (type) __v0; \
1191 errno = __v0; \
1192 return (type) -1; \
1193}
1194
1195#endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
1196
1197
1198#define __ARCH_OMIT_COMPAT_SYS_GETDENTS64 936#define __ARCH_OMIT_COMPAT_SYS_GETDENTS64
1199#define __ARCH_WANT_IPC_PARSE_VERSION 937#define __ARCH_WANT_IPC_PARSE_VERSION
1200#define __ARCH_WANT_OLD_READDIR 938#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-parisc/checksum.h b/include/asm-parisc/checksum.h
index 229cb56fdb7a..cc3ec1bd8919 100644
--- a/include/asm-parisc/checksum.h
+++ b/include/asm-parisc/checksum.h
@@ -15,7 +15,7 @@
15 * 15 *
16 * it's best to have buff aligned on a 32-bit boundary 16 * it's best to have buff aligned on a 32-bit boundary
17 */ 17 */
18extern unsigned int csum_partial(const unsigned char *, int, unsigned int); 18extern __wsum csum_partial(const void *, int, __wsum);
19 19
20/* 20/*
21 * The same as csum_partial, but copies from src while it checksums. 21 * The same as csum_partial, but copies from src while it checksums.
@@ -23,15 +23,14 @@ extern unsigned int csum_partial(const unsigned char *, int, unsigned int);
23 * Here even more important to align src and dst on a 32-bit (or even 23 * Here even more important to align src and dst on a 32-bit (or even
24 * better 64-bit) boundary 24 * better 64-bit) boundary
25 */ 25 */
26extern unsigned int csum_partial_copy_nocheck(const unsigned char *, unsigned char *, 26extern __wsum csum_partial_copy_nocheck(const void *, void *, int, __wsum);
27 int, unsigned int);
28 27
29/* 28/*
30 * this is a new version of the above that records errors it finds in *errp, 29 * this is a new version of the above that records errors it finds in *errp,
31 * but continues and zeros the rest of the buffer. 30 * but continues and zeros the rest of the buffer.
32 */ 31 */
33extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src, 32extern __wsum csum_partial_copy_from_user(const void __user *src,
34 unsigned char *dst, int len, unsigned int sum, int *errp); 33 void *dst, int len, __wsum sum, int *errp);
35 34
36/* 35/*
37 * Optimized for IP headers, which always checksum on 4 octet boundaries. 36 * Optimized for IP headers, which always checksum on 4 octet boundaries.
@@ -39,11 +38,10 @@ extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
39 * Written by Randolph Chung <tausq@debian.org>, and then mucked with by 38 * Written by Randolph Chung <tausq@debian.org>, and then mucked with by
40 * LaMont Jones <lamont@debian.org> 39 * LaMont Jones <lamont@debian.org>
41 */ 40 */
42static inline unsigned short ip_fast_csum(unsigned char * iph, 41static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
43 unsigned int ihl) { 42{
44 unsigned int sum; 43 unsigned int sum;
45 44
46
47 __asm__ __volatile__ ( 45 __asm__ __volatile__ (
48" ldws,ma 4(%1), %0\n" 46" ldws,ma 4(%1), %0\n"
49" addib,<= -4, %2, 2f\n" 47" addib,<= -4, %2, 2f\n"
@@ -69,27 +67,27 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
69 : "1" (iph), "2" (ihl) 67 : "1" (iph), "2" (ihl)
70 : "r19", "r20", "r21" ); 68 : "r19", "r20", "r21" );
71 69
72 return(sum); 70 return (__force __sum16)sum;
73} 71}
74 72
75/* 73/*
76 * Fold a partial checksum 74 * Fold a partial checksum
77 */ 75 */
78static inline unsigned int csum_fold(unsigned int sum) 76static inline __sum16 csum_fold(__wsum csum)
79{ 77{
78 u32 sum = (__force u32)csum;
80 /* add the swapped two 16-bit halves of sum, 79 /* add the swapped two 16-bit halves of sum,
81 a possible carry from adding the two 16-bit halves, 80 a possible carry from adding the two 16-bit halves,
82 will carry from the lower half into the upper half, 81 will carry from the lower half into the upper half,
83 giving us the correct sum in the upper half. */ 82 giving us the correct sum in the upper half. */
84 sum += (sum << 16) + (sum >> 16); 83 sum += (sum << 16) + (sum >> 16);
85 return (~sum) >> 16; 84 return (__force __sum16)(~sum >> 16);
86} 85}
87 86
88static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 87static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
89 unsigned long daddr,
90 unsigned short len, 88 unsigned short len,
91 unsigned short proto, 89 unsigned short proto,
92 unsigned int sum) 90 __wsum sum)
93{ 91{
94 __asm__( 92 __asm__(
95 " add %1, %0, %0\n" 93 " add %1, %0, %0\n"
@@ -97,19 +95,18 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
97 " addc %3, %0, %0\n" 95 " addc %3, %0, %0\n"
98 " addc %%r0, %0, %0\n" 96 " addc %%r0, %0, %0\n"
99 : "=r" (sum) 97 : "=r" (sum)
100 : "r" (daddr), "r"(saddr), "r"((proto<<16)+len), "0"(sum)); 98 : "r" (daddr), "r"(saddr), "r"(proto+len), "0"(sum));
101 return sum; 99 return sum;
102} 100}
103 101
104/* 102/*
105 * computes the checksum of the TCP/UDP pseudo-header 103 * computes the checksum of the TCP/UDP pseudo-header
106 * returns a 16-bit checksum, already complemented 104 * returns a 16-bit checksum, already complemented
107 */ 105 */
108static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 106static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
109 unsigned long daddr,
110 unsigned short len, 107 unsigned short len,
111 unsigned short proto, 108 unsigned short proto,
112 unsigned int sum) 109 __wsum sum)
113{ 110{
114 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 111 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
115} 112}
@@ -118,17 +115,17 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
118 * this routine is used for miscellaneous IP-like checksums, mainly 115 * this routine is used for miscellaneous IP-like checksums, mainly
119 * in icmp.c 116 * in icmp.c
120 */ 117 */
121static inline unsigned short ip_compute_csum(unsigned char * buf, int len) { 118static inline __sum16 ip_compute_csum(const void *buf, int len)
119{
122 return csum_fold (csum_partial(buf, len, 0)); 120 return csum_fold (csum_partial(buf, len, 0));
123} 121}
124 122
125 123
126#define _HAVE_ARCH_IPV6_CSUM 124#define _HAVE_ARCH_IPV6_CSUM
127static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 125static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
128 struct in6_addr *daddr, 126 const struct in6_addr *daddr,
129 __u16 len, 127 __u32 len, unsigned short proto,
130 unsigned short proto, 128 __wsum sum)
131 unsigned int sum)
132{ 129{
133 __asm__ __volatile__ ( 130 __asm__ __volatile__ (
134 131
@@ -193,9 +190,9 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
193 * Copy and checksum to user 190 * Copy and checksum to user
194 */ 191 */
195#define HAVE_CSUM_COPY_USER 192#define HAVE_CSUM_COPY_USER
196static __inline__ unsigned int csum_and_copy_to_user (const unsigned char *src, 193static __inline__ __wsum csum_and_copy_to_user(const void *src,
197 unsigned char __user *dst, 194 void __user *dst,
198 int len, int sum, 195 int len, __wsum sum,
199 int *err_ptr) 196 int *err_ptr)
200{ 197{
201 /* code stolen from include/asm-mips64 */ 198 /* code stolen from include/asm-mips64 */
@@ -203,7 +200,7 @@ static __inline__ unsigned int csum_and_copy_to_user (const unsigned char *src,
203 200
204 if (copy_to_user(dst, src, len)) { 201 if (copy_to_user(dst, src, len)) {
205 *err_ptr = -EFAULT; 202 *err_ptr = -EFAULT;
206 return -1; 203 return (__force __wsum)-1;
207 } 204 }
208 205
209 return sum; 206 return sum;
diff --git a/include/asm-parisc/device.h b/include/asm-parisc/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-parisc/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-parisc/dma-mapping.h b/include/asm-parisc/dma-mapping.h
index 1e387e1dad30..66f0b408c669 100644
--- a/include/asm-parisc/dma-mapping.h
+++ b/include/asm-parisc/dma-mapping.h
@@ -191,13 +191,13 @@ dma_get_cache_alignment(void)
191} 191}
192 192
193static inline int 193static inline int
194dma_is_consistent(dma_addr_t dma_addr) 194dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
195{ 195{
196 return (hppa_dma_ops->dma_sync_single_for_cpu == NULL); 196 return (hppa_dma_ops->dma_sync_single_for_cpu == NULL);
197} 197}
198 198
199static inline void 199static inline void
200dma_cache_sync(void *vaddr, size_t size, 200dma_cache_sync(struct device *dev, void *vaddr, size_t size,
201 enum dma_data_direction direction) 201 enum dma_data_direction direction)
202{ 202{
203 if(hppa_dma_ops->dma_sync_single_for_cpu) 203 if(hppa_dma_ops->dma_sync_single_for_cpu)
diff --git a/include/asm-parisc/dma.h b/include/asm-parisc/dma.h
index da2cf373e31c..31ad0f05af3d 100644
--- a/include/asm-parisc/dma.h
+++ b/include/asm-parisc/dma.h
@@ -17,10 +17,10 @@
17 17
18/* 18/*
19** DMA_CHUNK_SIZE is used by the SCSI mid-layer to break up 19** DMA_CHUNK_SIZE is used by the SCSI mid-layer to break up
20** (or rather not merge) DMA's into managable chunks. 20** (or rather not merge) DMAs into manageable chunks.
21** On parisc, this is more of the software/tuning constraint 21** On parisc, this is more of the software/tuning constraint
22** rather than the HW. I/O MMU allocation alogorithms can be 22** rather than the HW. I/O MMU allocation algorithms can be
23** faster with smaller size is (to some degree). 23** faster with smaller sizes (to some degree).
24*/ 24*/
25#define DMA_CHUNK_SIZE (BITS_PER_LONG*PAGE_SIZE) 25#define DMA_CHUNK_SIZE (BITS_PER_LONG*PAGE_SIZE)
26 26
diff --git a/include/asm-parisc/futex.h b/include/asm-parisc/futex.h
index d84bbb283fd1..dbee6e60aa81 100644
--- a/include/asm-parisc/futex.h
+++ b/include/asm-parisc/futex.h
@@ -21,7 +21,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT; 22 return -EFAULT;
23 23
24 inc_preempt_count(); 24 pagefault_disable();
25 25
26 switch (op) { 26 switch (op) {
27 case FUTEX_OP_SET: 27 case FUTEX_OP_SET:
@@ -33,7 +33,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
33 ret = -ENOSYS; 33 ret = -ENOSYS;
34 } 34 }
35 35
36 dec_preempt_count(); 36 pagefault_enable();
37 37
38 if (!ret) { 38 if (!ret) {
39 switch (cmp) { 39 switch (cmp) {
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
index 7b8ad118d2fe..7b3be9ac0dda 100644
--- a/include/asm-parisc/pci.h
+++ b/include/asm-parisc/pci.h
@@ -149,7 +149,7 @@ extern int parisc_bus_is_phys; /* in arch/parisc/kernel/setup.c */
149/* 149/*
150** Most PCI devices (eg Tulip, NCR720) also export the same registers 150** Most PCI devices (eg Tulip, NCR720) also export the same registers
151** to both MMIO and I/O port space. Due to poor performance of I/O Port 151** to both MMIO and I/O port space. Due to poor performance of I/O Port
152** access under HP PCI bus adapters, strongly reccomend use of MMIO 152** access under HP PCI bus adapters, strongly recommend the use of MMIO
153** address space. 153** address space.
154** 154**
155** While I'm at it more PA programming notes: 155** While I'm at it more PA programming notes:
diff --git a/include/asm-parisc/ropes.h b/include/asm-parisc/ropes.h
index 5542dd00472b..007a880615eb 100644
--- a/include/asm-parisc/ropes.h
+++ b/include/asm-parisc/ropes.h
@@ -14,7 +14,7 @@
14#endif 14#endif
15 15
16/* 16/*
17** The number of pdir entries to "free" before issueing 17** The number of pdir entries to "free" before issuing
18** a read to PCOM register to flush out PCOM writes. 18** a read to PCOM register to flush out PCOM writes.
19** Interacts with allocation granularity (ie 4 or 8 entries 19** Interacts with allocation granularity (ie 4 or 8 entries
20** allocated and free'd/purged at a time might make this 20** allocated and free'd/purged at a time might make this
diff --git a/include/asm-parisc/semaphore.h b/include/asm-parisc/semaphore.h
index c9ee41cd0707..d45827a21f94 100644
--- a/include/asm-parisc/semaphore.h
+++ b/include/asm-parisc/semaphore.h
@@ -115,7 +115,8 @@ extern __inline__ int down_interruptible(struct semaphore * sem)
115 */ 115 */
116extern __inline__ int down_trylock(struct semaphore * sem) 116extern __inline__ int down_trylock(struct semaphore * sem)
117{ 117{
118 int flags, count; 118 unsigned long flags;
119 int count;
119 120
120 spin_lock_irqsave(&sem->sentry, flags); 121 spin_lock_irqsave(&sem->sentry, flags);
121 count = sem->count - 1; 122 count = sem->count - 1;
@@ -131,7 +132,8 @@ extern __inline__ int down_trylock(struct semaphore * sem)
131 */ 132 */
132extern __inline__ void up(struct semaphore * sem) 133extern __inline__ void up(struct semaphore * sem)
133{ 134{
134 int flags; 135 unsigned long flags;
136
135 spin_lock_irqsave(&sem->sentry, flags); 137 spin_lock_irqsave(&sem->sentry, flags);
136 if (sem->count < 0) { 138 if (sem->count < 0) {
137 __up(sem); 139 __up(sem);
diff --git a/include/asm-powerpc/Kbuild b/include/asm-powerpc/Kbuild
index 9827849953a3..1e637381c118 100644
--- a/include/asm-powerpc/Kbuild
+++ b/include/asm-powerpc/Kbuild
@@ -17,6 +17,7 @@ header-y += ipc.h
17header-y += poll.h 17header-y += poll.h
18header-y += shmparam.h 18header-y += shmparam.h
19header-y += sockios.h 19header-y += sockios.h
20header-y += spu_info.h
20header-y += ucontext.h 21header-y += ucontext.h
21header-y += ioctl.h 22header-y += ioctl.h
22header-y += linkage.h 23header-y += linkage.h
diff --git a/include/asm-powerpc/cell-pmu.h b/include/asm-powerpc/cell-pmu.h
new file mode 100644
index 000000000000..e8c2ebd3ddda
--- /dev/null
+++ b/include/asm-powerpc/cell-pmu.h
@@ -0,0 +1,113 @@
1/*
2 * Cell Broadband Engine Performance Monitor
3 *
4 * (C) Copyright IBM Corporation 2006
5 *
6 * Author:
7 * David Erb (djerb@us.ibm.com)
8 * Kevin Corry (kevcorry@us.ibm.com)
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#ifndef __ASM_CELL_PMU_H__
26#define __ASM_CELL_PMU_H__
27
28/* The Cell PMU has four hardware performance counters, which can be
29 * configured as four 32-bit counters or eight 16-bit counters.
30 */
31#define NR_PHYS_CTRS 4
32#define NR_CTRS (NR_PHYS_CTRS * 2)
33
34/* Macros for the pm_control register. */
35#define CBE_PM_16BIT_CTR(ctr) (1 << (24 - ((ctr) & (NR_PHYS_CTRS - 1))))
36#define CBE_PM_ENABLE_PERF_MON 0x80000000
37#define CBE_PM_STOP_AT_MAX 0x40000000
38#define CBE_PM_TRACE_MODE_GET(pm_control) (((pm_control) >> 28) & 0x3)
39#define CBE_PM_TRACE_MODE_SET(mode) (((mode) & 0x3) << 28)
40#define CBE_PM_COUNT_MODE_SET(count) (((count) & 0x3) << 18)
41#define CBE_PM_FREEZE_ALL_CTRS 0x00100000
42#define CBE_PM_ENABLE_EXT_TRACE 0x00008000
43
44/* Macros for the trace_address register. */
45#define CBE_PM_TRACE_BUF_FULL 0x00000800
46#define CBE_PM_TRACE_BUF_EMPTY 0x00000400
47#define CBE_PM_TRACE_BUF_DATA_COUNT(ta) ((ta) & 0x3ff)
48#define CBE_PM_TRACE_BUF_MAX_COUNT 0x400
49
50/* Macros for the pm07_control registers. */
51#define CBE_PM_CTR_INPUT_MUX(pm07_control) (((pm07_control) >> 26) & 0x3f)
52#define CBE_PM_CTR_INPUT_CONTROL 0x02000000
53#define CBE_PM_CTR_POLARITY 0x01000000
54#define CBE_PM_CTR_COUNT_CYCLES 0x00800000
55#define CBE_PM_CTR_ENABLE 0x00400000
56
57/* Macros for the pm_status register. */
58#define CBE_PM_CTR_OVERFLOW_INTR(ctr) (1 << (31 - ((ctr) & 7)))
59
60enum pm_reg_name {
61 group_control,
62 debug_bus_control,
63 trace_address,
64 ext_tr_timer,
65 pm_status,
66 pm_control,
67 pm_interval,
68 pm_start_stop,
69};
70
71/* Routines for reading/writing the PMU registers. */
72extern u32 cbe_read_phys_ctr(u32 cpu, u32 phys_ctr);
73extern void cbe_write_phys_ctr(u32 cpu, u32 phys_ctr, u32 val);
74extern u32 cbe_read_ctr(u32 cpu, u32 ctr);
75extern void cbe_write_ctr(u32 cpu, u32 ctr, u32 val);
76
77extern u32 cbe_read_pm07_control(u32 cpu, u32 ctr);
78extern void cbe_write_pm07_control(u32 cpu, u32 ctr, u32 val);
79extern u32 cbe_read_pm(u32 cpu, enum pm_reg_name reg);
80extern void cbe_write_pm(u32 cpu, enum pm_reg_name reg, u32 val);
81
82extern u32 cbe_get_ctr_size(u32 cpu, u32 phys_ctr);
83extern void cbe_set_ctr_size(u32 cpu, u32 phys_ctr, u32 ctr_size);
84
85extern void cbe_enable_pm(u32 cpu);
86extern void cbe_disable_pm(u32 cpu);
87
88extern void cbe_read_trace_buffer(u32 cpu, u64 *buf);
89
90extern void cbe_enable_pm_interrupts(u32 cpu, u32 thread, u32 mask);
91extern void cbe_disable_pm_interrupts(u32 cpu);
92extern u32 cbe_query_pm_interrupts(u32 cpu);
93extern u32 cbe_clear_pm_interrupts(u32 cpu);
94extern void cbe_sync_irq(int node);
95
96/* Utility functions, macros */
97extern u32 cbe_get_hw_thread_id(int cpu);
98
99#define cbe_cpu_to_node(cpu) ((cpu) >> 1)
100
101#define CBE_COUNT_SUPERVISOR_MODE 0
102#define CBE_COUNT_HYPERVISOR_MODE 1
103#define CBE_COUNT_PROBLEM_MODE 2
104#define CBE_COUNT_ALL_MODES 3
105
106/* Macros for the pm07_control registers. */
107#define PM07_CTR_INPUT_MUX(x) (((x) & 0x3F) << 26)
108#define PM07_CTR_INPUT_CONTROL(x) (((x) & 1) << 25)
109#define PM07_CTR_POLARITY(x) (((x) & 1) << 24)
110#define PM07_CTR_COUNT_CYCLES(x) (((x) & 1) << 23)
111#define PM07_CTR_ENABLE(x) (((x) & 1) << 22)
112
113#endif /* __ASM_CELL_PMU_H__ */
diff --git a/include/asm-powerpc/checksum.h b/include/asm-powerpc/checksum.h
index 609ecbbd7210..7cdf358337cf 100644
--- a/include/asm-powerpc/checksum.h
+++ b/include/asm-powerpc/checksum.h
@@ -14,17 +14,16 @@
14 * which always checksum on 4 octet boundaries. ihl is the number 14 * which always checksum on 4 octet boundaries. ihl is the number
15 * of 32-bit words and is always >= 5. 15 * of 32-bit words and is always >= 5.
16 */ 16 */
17extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); 17extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
18 18
19/* 19/*
20 * computes the checksum of the TCP/UDP pseudo-header 20 * computes the checksum of the TCP/UDP pseudo-header
21 * returns a 16-bit checksum, already complemented 21 * returns a 16-bit checksum, already complemented
22 */ 22 */
23extern unsigned short csum_tcpudp_magic(unsigned long saddr, 23extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
24 unsigned long daddr,
25 unsigned short len, 24 unsigned short len,
26 unsigned short proto, 25 unsigned short proto,
27 unsigned int sum); 26 __wsum sum);
28 27
29/* 28/*
30 * computes the checksum of a memory block at buff, length len, 29 * computes the checksum of a memory block at buff, length len,
@@ -38,8 +37,7 @@ extern unsigned short csum_tcpudp_magic(unsigned long saddr,
38 * 37 *
39 * it's best to have buff aligned on a 32-bit boundary 38 * it's best to have buff aligned on a 32-bit boundary
40 */ 39 */
41extern unsigned int csum_partial(const unsigned char * buff, int len, 40extern __wsum csum_partial(const void *buff, int len, __wsum sum);
42 unsigned int sum);
43 41
44/* 42/*
45 * Computes the checksum of a memory block at src, length len, 43 * Computes the checksum of a memory block at src, length len,
@@ -51,20 +49,15 @@ extern unsigned int csum_partial(const unsigned char * buff, int len,
51 * Like csum_partial, this must be called with even lengths, 49 * Like csum_partial, this must be called with even lengths,
52 * except for the last fragment. 50 * except for the last fragment.
53 */ 51 */
54extern unsigned int csum_partial_copy_generic(const char *src, char *dst, 52extern __wsum csum_partial_copy_generic(const void *src, void *dst,
55 int len, unsigned int sum, 53 int len, __wsum sum,
56 int *src_err, int *dst_err); 54 int *src_err, int *dst_err);
57/* 55/*
58 * the same as csum_partial, but copies from src to dst while it 56 * the same as csum_partial, but copies from src to dst while it
59 * checksums. 57 * checksums.
60 */ 58 */
61unsigned int csum_partial_copy_nocheck(const char *src,
62 char *dst,
63 int len,
64 unsigned int sum);
65
66#define csum_partial_copy_from_user(src, dst, len, sum, errp) \ 59#define csum_partial_copy_from_user(src, dst, len, sum, errp) \
67 csum_partial_copy_generic((src), (dst), (len), (sum), (errp), NULL) 60 csum_partial_copy_generic((__force const void *)(src), (dst), (len), (sum), (errp), NULL)
68 61
69#define csum_partial_copy_nocheck(src, dst, len, sum) \ 62#define csum_partial_copy_nocheck(src, dst, len, sum) \
70 csum_partial_copy_generic((src), (dst), (len), (sum), NULL, NULL) 63 csum_partial_copy_generic((src), (dst), (len), (sum), NULL, NULL)
@@ -74,7 +67,7 @@ unsigned int csum_partial_copy_nocheck(const char *src,
74 * turns a 32-bit partial checksum (e.g. from csum_partial) into a 67 * turns a 32-bit partial checksum (e.g. from csum_partial) into a
75 * 1's complement 16-bit checksum. 68 * 1's complement 16-bit checksum.
76 */ 69 */
77static inline unsigned int csum_fold(unsigned int sum) 70static inline __sum16 csum_fold(__wsum sum)
78{ 71{
79 unsigned int tmp; 72 unsigned int tmp;
80 73
@@ -83,41 +76,32 @@ static inline unsigned int csum_fold(unsigned int sum)
83 /* if there is a carry from adding the two 16-bit halves, 76 /* if there is a carry from adding the two 16-bit halves,
84 it will carry from the lower half into the upper half, 77 it will carry from the lower half into the upper half,
85 giving us the correct sum in the upper half. */ 78 giving us the correct sum in the upper half. */
86 sum = ~(sum + tmp) >> 16; 79 return (__force __sum16)(~((__force u32)sum + tmp) >> 16);
87 return sum;
88} 80}
89 81
90/* 82/*
91 * this routine is used for miscellaneous IP-like checksums, mainly 83 * this routine is used for miscellaneous IP-like checksums, mainly
92 * in icmp.c 84 * in icmp.c
93 */ 85 */
94static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 86static inline __sum16 ip_compute_csum(const void *buff, int len)
95{ 87{
96 return csum_fold(csum_partial(buff, len, 0)); 88 return csum_fold(csum_partial(buff, len, 0));
97} 89}
98 90
99#ifdef __powerpc64__ 91static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
100static inline u32 csum_tcpudp_nofold(u32 saddr,
101 u32 daddr,
102 unsigned short len, 92 unsigned short len,
103 unsigned short proto, 93 unsigned short proto,
104 unsigned int sum) 94 __wsum sum)
105{ 95{
106 unsigned long s = sum; 96#ifdef __powerpc64__
97 unsigned long s = (__force u32)sum;
107 98
108 s += saddr; 99 s += (__force u32)saddr;
109 s += daddr; 100 s += (__force u32)daddr;
110 s += (proto << 16) + len; 101 s += proto + len;
111 s += (s >> 32); 102 s += (s >> 32);
112 return (u32) s; 103 return (__force __wsum) s;
113}
114#else 104#else
115static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
116 unsigned long daddr,
117 unsigned short len,
118 unsigned short proto,
119 unsigned int sum)
120{
121 __asm__("\n\ 105 __asm__("\n\
122 addc %0,%0,%1 \n\ 106 addc %0,%0,%1 \n\
123 adde %0,%0,%2 \n\ 107 adde %0,%0,%2 \n\
@@ -125,10 +109,9 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
125 addze %0,%0 \n\ 109 addze %0,%0 \n\
126 " 110 "
127 : "=r" (sum) 111 : "=r" (sum)
128 : "r" (daddr), "r"(saddr), "r"((proto<<16)+len), "0"(sum)); 112 : "r" (daddr), "r"(saddr), "r"(proto + len), "0"(sum));
129 return sum; 113 return sum;
130}
131
132#endif 114#endif
115}
133#endif /* __KERNEL__ */ 116#endif /* __KERNEL__ */
134#endif 117#endif
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index a9a40149a7c0..6fe5c9d4ca3b 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -24,6 +24,8 @@
24#define PPC_FEATURE_ICACHE_SNOOP 0x00002000 24#define PPC_FEATURE_ICACHE_SNOOP 0x00002000
25#define PPC_FEATURE_ARCH_2_05 0x00001000 25#define PPC_FEATURE_ARCH_2_05 0x00001000
26#define PPC_FEATURE_PA6T 0x00000800 26#define PPC_FEATURE_PA6T 0x00000800
27#define PPC_FEATURE_HAS_DFP 0x00000400
28#define PPC_FEATURE_POWER6_EXT 0x00000200
27 29
28#define PPC_FEATURE_TRUE_LE 0x00000002 30#define PPC_FEATURE_TRUE_LE 0x00000002
29#define PPC_FEATURE_PPC_LE 0x00000001 31#define PPC_FEATURE_PPC_LE 0x00000001
@@ -45,6 +47,7 @@ enum powerpc_oprofile_type {
45 PPC_OPROFILE_POWER4 = 2, 47 PPC_OPROFILE_POWER4 = 2,
46 PPC_OPROFILE_G4 = 3, 48 PPC_OPROFILE_G4 = 3,
47 PPC_OPROFILE_BOOKE = 4, 49 PPC_OPROFILE_BOOKE = 4,
50 PPC_OPROFILE_CELL = 5,
48}; 51};
49 52
50struct cpu_spec { 53struct cpu_spec {
@@ -91,7 +94,7 @@ extern struct cpu_spec *cur_cpu_spec;
91 94
92extern unsigned int __start___ftr_fixup, __stop___ftr_fixup; 95extern unsigned int __start___ftr_fixup, __stop___ftr_fixup;
93 96
94extern struct cpu_spec *identify_cpu(unsigned long offset); 97extern struct cpu_spec *identify_cpu(unsigned long offset, unsigned int pvr);
95extern void do_feature_fixups(unsigned long value, void *fixup_start, 98extern void do_feature_fixups(unsigned long value, void *fixup_start,
96 void *fixup_end); 99 void *fixup_end);
97 100
@@ -148,19 +151,13 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
148#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000) 151#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000)
149#define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000) 152#define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000)
150#define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000800000000000) 153#define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000800000000000)
154#define CPU_FTR_SPURR LONG_ASM_CONST(0x0001000000000000)
151 155
152#ifndef __ASSEMBLY__ 156#ifndef __ASSEMBLY__
153 157
154#define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \ 158#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_SLB | \
155 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \ 159 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \
156 CPU_FTR_NODSISRALIGN) 160 CPU_FTR_NODSISRALIGN | CPU_FTR_16M_PAGE)
157
158/* iSeries doesn't support large pages */
159#ifdef CONFIG_PPC_ISERIES
160#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE)
161#else
162#define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE | CPU_FTR_16M_PAGE)
163#endif /* CONFIG_PPC_ISERIES */
164 161
165/* We only set the altivec features if the kernel was compiled with altivec 162/* We only set the altivec features if the kernel was compiled with altivec
166 * support 163 * support
@@ -311,7 +308,8 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
311#define CPU_FTRS_E500_2 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 308#define CPU_FTRS_E500_2 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
312 CPU_FTR_BIG_PHYS | CPU_FTR_NODSISRALIGN) 309 CPU_FTR_BIG_PHYS | CPU_FTR_NODSISRALIGN)
313#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) 310#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
314#ifdef __powerpc64__ 311
312/* 64-bit CPUs */
315#define CPU_FTRS_POWER3 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 313#define CPU_FTRS_POWER3 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
316 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | CPU_FTR_PPC_LE) 314 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | CPU_FTR_PPC_LE)
317#define CPU_FTRS_RS64 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 315#define CPU_FTRS_RS64 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
@@ -332,7 +330,13 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
332 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 330 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
333 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 331 CPU_FTR_MMCRA | CPU_FTR_SMT | \
334 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 332 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
335 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE) 333 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE)
334#define CPU_FTRS_POWER6X (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
335 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
336 CPU_FTR_MMCRA | CPU_FTR_SMT | \
337 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
338 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | \
339 CPU_FTR_SPURR | CPU_FTR_REAL_LE)
336#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 340#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
337 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 341 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
338 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 342 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -343,7 +347,6 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
343 CPU_FTR_PURR | CPU_FTR_REAL_LE) 347 CPU_FTR_PURR | CPU_FTR_REAL_LE)
344#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 348#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
345 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2) 349 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
346#endif
347 350
348#ifdef __powerpc64__ 351#ifdef __powerpc64__
349#define CPU_FTRS_POSSIBLE \ 352#define CPU_FTRS_POSSIBLE \
diff --git a/include/asm-powerpc/dbdma.h b/include/asm-powerpc/dbdma.h
index 8973565f95d3..e23f07e73cb3 100644
--- a/include/asm-powerpc/dbdma.h
+++ b/include/asm-powerpc/dbdma.h
@@ -95,7 +95,13 @@ struct dbdma_cmd {
95#define DBDMA_DO_STOP(regs) do { \ 95#define DBDMA_DO_STOP(regs) do { \
96 out_le32(&((regs)->control), (RUN|FLUSH)<<16); \ 96 out_le32(&((regs)->control), (RUN|FLUSH)<<16); \
97 while(in_le32(&((regs)->status)) & (ACTIVE|FLUSH)) \ 97 while(in_le32(&((regs)->status)) & (ACTIVE|FLUSH)) \
98 ; \ 98 ; \
99} while(0)
100
101#define DBDMA_DO_RESET(regs) do { \
102 out_le32(&((regs)->control), (ACTIVE|DEAD|WAKE|FLUSH|PAUSE|RUN)<<16);\
103 while(in_le32(&((regs)->status)) & (RUN)) \
104 ; \
99} while(0) 105} while(0)
100 106
101#endif /* _ASM_DBDMA_H_ */ 107#endif /* _ASM_DBDMA_H_ */
diff --git a/include/asm-powerpc/dcr-mmio.h b/include/asm-powerpc/dcr-mmio.h
new file mode 100644
index 000000000000..5dbfca8dde36
--- /dev/null
+++ b/include/asm-powerpc/dcr-mmio.h
@@ -0,0 +1,51 @@
1/*
2 * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 * the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef _ASM_POWERPC_DCR_MMIO_H
21#define _ASM_POWERPC_DCR_MMIO_H
22#ifdef __KERNEL__
23
24#include <asm/io.h>
25
26typedef struct { void __iomem *token; unsigned int stride; } dcr_host_t;
27
28#define DCR_MAP_OK(host) ((host).token != NULL)
29
30extern dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
31 unsigned int dcr_c);
32extern void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c);
33
34static inline u32 dcr_read(dcr_host_t host, unsigned int dcr_n)
35{
36 return in_be32(host.token + dcr_n * host.stride);
37}
38
39static inline void dcr_write(dcr_host_t host, unsigned int dcr_n, u32 value)
40{
41 out_be32(host.token + dcr_n * host.stride, value);
42}
43
44extern u64 of_translate_dcr_address(struct device_node *dev,
45 unsigned int dcr_n,
46 unsigned int *stride);
47
48#endif /* __KERNEL__ */
49#endif /* _ASM_POWERPC_DCR_MMIO_H */
50
51
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h
new file mode 100644
index 000000000000..fd4a5f5e33d1
--- /dev/null
+++ b/include/asm-powerpc/dcr-native.h
@@ -0,0 +1,39 @@
1/*
2 * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 * the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef _ASM_POWERPC_DCR_NATIVE_H
21#define _ASM_POWERPC_DCR_NATIVE_H
22#ifdef __KERNEL__
23
24#include <asm/reg.h>
25
26typedef struct {} dcr_host_t;
27
28#define DCR_MAP_OK(host) (1)
29
30#define dcr_map(dev, dcr_n, dcr_c) {}
31#define dcr_unmap(host, dcr_n, dcr_c) {}
32#define dcr_read(host, dcr_n) mfdcr(dcr_n)
33#define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value)
34
35
36#endif /* __KERNEL__ */
37#endif /* _ASM_POWERPC_DCR_NATIVE_H */
38
39
diff --git a/include/asm-powerpc/dcr.h b/include/asm-powerpc/dcr.h
new file mode 100644
index 000000000000..473f2c7fd892
--- /dev/null
+++ b/include/asm-powerpc/dcr.h
@@ -0,0 +1,42 @@
1/*
2 * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 * the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef _ASM_POWERPC_DCR_H
21#define _ASM_POWERPC_DCR_H
22#ifdef __KERNEL__
23
24#ifdef CONFIG_PPC_DCR_NATIVE
25#include <asm/dcr-native.h>
26#else
27#include <asm/dcr-mmio.h>
28#endif
29
30/*
31 * On CONFIG_PPC_MERGE, we have additional helpers to read the DCR
32 * base from the device-tree
33 */
34#ifdef CONFIG_PPC_MERGE
35extern unsigned int dcr_resource_start(struct device_node *np,
36 unsigned int index);
37extern unsigned int dcr_resource_len(struct device_node *np,
38 unsigned int index);
39#endif /* CONFIG_PPC_MERGE */
40
41#endif /* __KERNEL__ */
42#endif /* _ASM_POWERPC_DCR_H */
diff --git a/include/asm-powerpc/device.h b/include/asm-powerpc/device.h
new file mode 100644
index 000000000000..228ab2a315b9
--- /dev/null
+++ b/include/asm-powerpc/device.h
@@ -0,0 +1,24 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef _ASM_POWERPC_DEVICE_H
7#define _ASM_POWERPC_DEVICE_H
8
9struct dma_mapping_ops;
10struct device_node;
11
12struct dev_archdata {
13 /* Optional pointer to an OF device node */
14 struct device_node *of_node;
15
16 /* DMA operations on that device */
17 struct dma_mapping_ops *dma_ops;
18 void *dma_data;
19
20 /* NUMA node if applicable */
21 int numa_node;
22};
23
24#endif /* _ASM_POWERPC_DEVICE_H */
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 2ab9baf78bb4..7c7de87bd8ae 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -44,26 +44,150 @@ extern void __dma_sync_page(struct page *page, unsigned long offset,
44#endif /* ! CONFIG_NOT_COHERENT_CACHE */ 44#endif /* ! CONFIG_NOT_COHERENT_CACHE */
45 45
46#ifdef CONFIG_PPC64 46#ifdef CONFIG_PPC64
47/*
48 * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO
49 */
50struct dma_mapping_ops {
51 void * (*alloc_coherent)(struct device *dev, size_t size,
52 dma_addr_t *dma_handle, gfp_t flag);
53 void (*free_coherent)(struct device *dev, size_t size,
54 void *vaddr, dma_addr_t dma_handle);
55 dma_addr_t (*map_single)(struct device *dev, void *ptr,
56 size_t size, enum dma_data_direction direction);
57 void (*unmap_single)(struct device *dev, dma_addr_t dma_addr,
58 size_t size, enum dma_data_direction direction);
59 int (*map_sg)(struct device *dev, struct scatterlist *sg,
60 int nents, enum dma_data_direction direction);
61 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
62 int nents, enum dma_data_direction direction);
63 int (*dma_supported)(struct device *dev, u64 mask);
64 int (*dac_dma_supported)(struct device *dev, u64 mask);
65 int (*set_dma_mask)(struct device *dev, u64 dma_mask);
66};
67
68static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
69{
70 /* We don't handle the NULL dev case for ISA for now. We could
71 * do it via an out of line call but it is not needed for now. The
72 * only ISA DMA device we support is the floppy and we have a hack
73 * in the floppy driver directly to get a device for us.
74 */
75 if (unlikely(dev == NULL || dev->archdata.dma_ops == NULL))
76 return NULL;
77 return dev->archdata.dma_ops;
78}
47 79
48extern int dma_supported(struct device *dev, u64 mask); 80static inline int dma_supported(struct device *dev, u64 mask)
49extern int dma_set_mask(struct device *dev, u64 dma_mask); 81{
50extern void *dma_alloc_coherent(struct device *dev, size_t size, 82 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
51 dma_addr_t *dma_handle, gfp_t flag); 83
52extern void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, 84 if (unlikely(dma_ops == NULL))
53 dma_addr_t dma_handle); 85 return 0;
54extern dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, 86 if (dma_ops->dma_supported == NULL)
55 size_t size, enum dma_data_direction direction); 87 return 1;
56extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, 88 return dma_ops->dma_supported(dev, mask);
57 size_t size, enum dma_data_direction direction); 89}
58extern dma_addr_t dma_map_page(struct device *dev, struct page *page, 90
59 unsigned long offset, size_t size, 91static inline int dma_set_mask(struct device *dev, u64 dma_mask)
60 enum dma_data_direction direction); 92{
61extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address, 93 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
62 size_t size, enum dma_data_direction direction); 94
63extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 95 if (unlikely(dma_ops == NULL))
64 enum dma_data_direction direction); 96 return -EIO;
65extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg, 97 if (dma_ops->set_dma_mask != NULL)
66 int nhwentries, enum dma_data_direction direction); 98 return dma_ops->set_dma_mask(dev, dma_mask);
99 if (!dev->dma_mask || !dma_supported(dev, *dev->dma_mask))
100 return -EIO;
101 *dev->dma_mask = dma_mask;
102 return 0;
103}
104
105static inline void *dma_alloc_coherent(struct device *dev, size_t size,
106 dma_addr_t *dma_handle, gfp_t flag)
107{
108 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
109
110 BUG_ON(!dma_ops);
111 return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
112}
113
114static inline void dma_free_coherent(struct device *dev, size_t size,
115 void *cpu_addr, dma_addr_t dma_handle)
116{
117 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
118
119 BUG_ON(!dma_ops);
120 dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
121}
122
123static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
124 size_t size,
125 enum dma_data_direction direction)
126{
127 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
128
129 BUG_ON(!dma_ops);
130 return dma_ops->map_single(dev, cpu_addr, size, direction);
131}
132
133static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
134 size_t size,
135 enum dma_data_direction direction)
136{
137 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
138
139 BUG_ON(!dma_ops);
140 dma_ops->unmap_single(dev, dma_addr, size, direction);
141}
142
143static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
144 unsigned long offset, size_t size,
145 enum dma_data_direction direction)
146{
147 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
148
149 BUG_ON(!dma_ops);
150 return dma_ops->map_single(dev, page_address(page) + offset, size,
151 direction);
152}
153
154static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
155 size_t size,
156 enum dma_data_direction direction)
157{
158 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
159
160 BUG_ON(!dma_ops);
161 dma_ops->unmap_single(dev, dma_address, size, direction);
162}
163
164static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
165 int nents, enum dma_data_direction direction)
166{
167 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
168
169 BUG_ON(!dma_ops);
170 return dma_ops->map_sg(dev, sg, nents, direction);
171}
172
173static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
174 int nhwentries,
175 enum dma_data_direction direction)
176{
177 struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
178
179 BUG_ON(!dma_ops);
180 dma_ops->unmap_sg(dev, sg, nhwentries, direction);
181}
182
183
184/*
185 * Available generic sets of operations
186 */
187extern struct dma_mapping_ops dma_iommu_ops;
188extern struct dma_mapping_ops dma_direct_ops;
189
190extern unsigned long dma_direct_offset;
67 191
68#else /* CONFIG_PPC64 */ 192#else /* CONFIG_PPC64 */
69 193
@@ -218,9 +342,9 @@ static inline int dma_mapping_error(dma_addr_t dma_addr)
218#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 342#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
219#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 343#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
220#ifdef CONFIG_NOT_COHERENT_CACHE 344#ifdef CONFIG_NOT_COHERENT_CACHE
221#define dma_is_consistent(d) (0) 345#define dma_is_consistent(d, h) (0)
222#else 346#else
223#define dma_is_consistent(d) (1) 347#define dma_is_consistent(d, h) (1)
224#endif 348#endif
225 349
226static inline int dma_get_cache_alignment(void) 350static inline int dma_get_cache_alignment(void)
@@ -254,32 +378,12 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
254 dma_sync_single_for_device(dev, dma_handle, offset + size, direction); 378 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
255} 379}
256 380
257static inline void dma_cache_sync(void *vaddr, size_t size, 381static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
258 enum dma_data_direction direction) 382 enum dma_data_direction direction)
259{ 383{
260 BUG_ON(direction == DMA_NONE); 384 BUG_ON(direction == DMA_NONE);
261 __dma_sync(vaddr, size, (int)direction); 385 __dma_sync(vaddr, size, (int)direction);
262} 386}
263 387
264/*
265 * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO
266 */
267struct dma_mapping_ops {
268 void * (*alloc_coherent)(struct device *dev, size_t size,
269 dma_addr_t *dma_handle, gfp_t flag);
270 void (*free_coherent)(struct device *dev, size_t size,
271 void *vaddr, dma_addr_t dma_handle);
272 dma_addr_t (*map_single)(struct device *dev, void *ptr,
273 size_t size, enum dma_data_direction direction);
274 void (*unmap_single)(struct device *dev, dma_addr_t dma_addr,
275 size_t size, enum dma_data_direction direction);
276 int (*map_sg)(struct device *dev, struct scatterlist *sg,
277 int nents, enum dma_data_direction direction);
278 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
279 int nents, enum dma_data_direction direction);
280 int (*dma_supported)(struct device *dev, u64 mask);
281 int (*dac_dma_supported)(struct device *dev, u64 mask);
282};
283
284#endif /* __KERNEL__ */ 388#endif /* __KERNEL__ */
285#endif /* _ASM_DMA_MAPPING_H */ 389#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h
index 6a784396660b..b886bec67016 100644
--- a/include/asm-powerpc/eeh.h
+++ b/include/asm-powerpc/eeh.h
@@ -120,10 +120,6 @@ static inline u8 eeh_readb(const volatile void __iomem *addr)
120 return eeh_check_failure(addr, val); 120 return eeh_check_failure(addr, val);
121 return val; 121 return val;
122} 122}
123static inline void eeh_writeb(u8 val, volatile void __iomem *addr)
124{
125 out_8(addr, val);
126}
127 123
128static inline u16 eeh_readw(const volatile void __iomem *addr) 124static inline u16 eeh_readw(const volatile void __iomem *addr)
129{ 125{
@@ -132,21 +128,6 @@ static inline u16 eeh_readw(const volatile void __iomem *addr)
132 return eeh_check_failure(addr, val); 128 return eeh_check_failure(addr, val);
133 return val; 129 return val;
134} 130}
135static inline void eeh_writew(u16 val, volatile void __iomem *addr)
136{
137 out_le16(addr, val);
138}
139static inline u16 eeh_raw_readw(const volatile void __iomem *addr)
140{
141 u16 val = in_be16(addr);
142 if (EEH_POSSIBLE_ERROR(val, u16))
143 return eeh_check_failure(addr, val);
144 return val;
145}
146static inline void eeh_raw_writew(u16 val, volatile void __iomem *addr) {
147 volatile u16 __iomem *vaddr = (volatile u16 __iomem *) addr;
148 out_be16(vaddr, val);
149}
150 131
151static inline u32 eeh_readl(const volatile void __iomem *addr) 132static inline u32 eeh_readl(const volatile void __iomem *addr)
152{ 133{
@@ -155,205 +136,75 @@ static inline u32 eeh_readl(const volatile void __iomem *addr)
155 return eeh_check_failure(addr, val); 136 return eeh_check_failure(addr, val);
156 return val; 137 return val;
157} 138}
158static inline void eeh_writel(u32 val, volatile void __iomem *addr) 139
159{ 140static inline u64 eeh_readq(const volatile void __iomem *addr)
160 out_le32(addr, val);
161}
162static inline u32 eeh_raw_readl(const volatile void __iomem *addr)
163{ 141{
164 u32 val = in_be32(addr); 142 u64 val = in_le64(addr);
165 if (EEH_POSSIBLE_ERROR(val, u32)) 143 if (EEH_POSSIBLE_ERROR(val, u64))
166 return eeh_check_failure(addr, val); 144 return eeh_check_failure(addr, val);
167 return val; 145 return val;
168} 146}
169static inline void eeh_raw_writel(u32 val, volatile void __iomem *addr)
170{
171 out_be32(addr, val);
172}
173 147
174static inline u64 eeh_readq(const volatile void __iomem *addr) 148static inline u16 eeh_readw_be(const volatile void __iomem *addr)
175{ 149{
176 u64 val = in_le64(addr); 150 u16 val = in_be16(addr);
177 if (EEH_POSSIBLE_ERROR(val, u64)) 151 if (EEH_POSSIBLE_ERROR(val, u16))
178 return eeh_check_failure(addr, val); 152 return eeh_check_failure(addr, val);
179 return val; 153 return val;
180} 154}
181static inline void eeh_writeq(u64 val, volatile void __iomem *addr) 155
156static inline u32 eeh_readl_be(const volatile void __iomem *addr)
182{ 157{
183 out_le64(addr, val); 158 u32 val = in_be32(addr);
159 if (EEH_POSSIBLE_ERROR(val, u32))
160 return eeh_check_failure(addr, val);
161 return val;
184} 162}
185static inline u64 eeh_raw_readq(const volatile void __iomem *addr) 163
164static inline u64 eeh_readq_be(const volatile void __iomem *addr)
186{ 165{
187 u64 val = in_be64(addr); 166 u64 val = in_be64(addr);
188 if (EEH_POSSIBLE_ERROR(val, u64)) 167 if (EEH_POSSIBLE_ERROR(val, u64))
189 return eeh_check_failure(addr, val); 168 return eeh_check_failure(addr, val);
190 return val; 169 return val;
191} 170}
192static inline void eeh_raw_writeq(u64 val, volatile void __iomem *addr)
193{
194 out_be64(addr, val);
195}
196
197#define EEH_CHECK_ALIGN(v,a) \
198 ((((unsigned long)(v)) & ((a) - 1)) == 0)
199 171
200static inline void eeh_memset_io(volatile void __iomem *addr, int c, 172static inline void eeh_memcpy_fromio(void *dest, const
201 unsigned long n) 173 volatile void __iomem *src,
202{
203 void *p = (void __force *)addr;
204 u32 lc = c;
205 lc |= lc << 8;
206 lc |= lc << 16;
207
208 __asm__ __volatile__ ("sync" : : : "memory");
209 while(n && !EEH_CHECK_ALIGN(p, 4)) {
210 *((volatile u8 *)p) = c;
211 p++;
212 n--;
213 }
214 while(n >= 4) {
215 *((volatile u32 *)p) = lc;
216 p += 4;
217 n -= 4;
218 }
219 while(n) {
220 *((volatile u8 *)p) = c;
221 p++;
222 n--;
223 }
224 __asm__ __volatile__ ("sync" : : : "memory");
225}
226static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *src,
227 unsigned long n) 174 unsigned long n)
228{ 175{
229 void *vsrc = (void __force *) src; 176 _memcpy_fromio(dest, src, n);
230 void *destsave = dest;
231 unsigned long nsave = n;
232
233 __asm__ __volatile__ ("sync" : : : "memory");
234 while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) {
235 *((u8 *)dest) = *((volatile u8 *)vsrc);
236 __asm__ __volatile__ ("eieio" : : : "memory");
237 vsrc++;
238 dest++;
239 n--;
240 }
241 while(n > 4) {
242 *((u32 *)dest) = *((volatile u32 *)vsrc);
243 __asm__ __volatile__ ("eieio" : : : "memory");
244 vsrc += 4;
245 dest += 4;
246 n -= 4;
247 }
248 while(n) {
249 *((u8 *)dest) = *((volatile u8 *)vsrc);
250 __asm__ __volatile__ ("eieio" : : : "memory");
251 vsrc++;
252 dest++;
253 n--;
254 }
255 __asm__ __volatile__ ("sync" : : : "memory");
256 177
257 /* Look for ffff's here at dest[n]. Assume that at least 4 bytes 178 /* Look for ffff's here at dest[n]. Assume that at least 4 bytes
258 * were copied. Check all four bytes. 179 * were copied. Check all four bytes.
259 */ 180 */
260 if ((nsave >= 4) && 181 if (n >= 4 && EEH_POSSIBLE_ERROR(*((u32 *)(dest + n - 4)), u32))
261 (EEH_POSSIBLE_ERROR((*((u32 *) destsave+nsave-4)), u32))) { 182 eeh_check_failure(src, *((u32 *)(dest + n - 4)));
262 eeh_check_failure(src, (*((u32 *) destsave+nsave-4)));
263 }
264}
265
266static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src,
267 unsigned long n)
268{
269 void *vdest = (void __force *) dest;
270
271 __asm__ __volatile__ ("sync" : : : "memory");
272 while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) {
273 *((volatile u8 *)vdest) = *((u8 *)src);
274 src++;
275 vdest++;
276 n--;
277 }
278 while(n > 4) {
279 *((volatile u32 *)vdest) = *((volatile u32 *)src);
280 src += 4;
281 vdest += 4;
282 n-=4;
283 }
284 while(n) {
285 *((volatile u8 *)vdest) = *((u8 *)src);
286 src++;
287 vdest++;
288 n--;
289 }
290 __asm__ __volatile__ ("sync" : : : "memory");
291}
292
293#undef EEH_CHECK_ALIGN
294
295static inline u8 eeh_inb(unsigned long port)
296{
297 u8 val;
298 val = in_8((u8 __iomem *)(port+pci_io_base));
299 if (EEH_POSSIBLE_ERROR(val, u8))
300 return eeh_check_failure((void __iomem *)(port), val);
301 return val;
302}
303
304static inline void eeh_outb(u8 val, unsigned long port)
305{
306 out_8((u8 __iomem *)(port+pci_io_base), val);
307}
308
309static inline u16 eeh_inw(unsigned long port)
310{
311 u16 val;
312 val = in_le16((u16 __iomem *)(port+pci_io_base));
313 if (EEH_POSSIBLE_ERROR(val, u16))
314 return eeh_check_failure((void __iomem *)(port), val);
315 return val;
316}
317
318static inline void eeh_outw(u16 val, unsigned long port)
319{
320 out_le16((u16 __iomem *)(port+pci_io_base), val);
321}
322
323static inline u32 eeh_inl(unsigned long port)
324{
325 u32 val;
326 val = in_le32((u32 __iomem *)(port+pci_io_base));
327 if (EEH_POSSIBLE_ERROR(val, u32))
328 return eeh_check_failure((void __iomem *)(port), val);
329 return val;
330}
331
332static inline void eeh_outl(u32 val, unsigned long port)
333{
334 out_le32((u32 __iomem *)(port+pci_io_base), val);
335} 183}
336 184
337/* in-string eeh macros */ 185/* in-string eeh macros */
338static inline void eeh_insb(unsigned long port, void * buf, int ns) 186static inline void eeh_readsb(const volatile void __iomem *addr, void * buf,
187 int ns)
339{ 188{
340 _insb((u8 __iomem *)(port+pci_io_base), buf, ns); 189 _insb(addr, buf, ns);
341 if (EEH_POSSIBLE_ERROR((*(((u8*)buf)+ns-1)), u8)) 190 if (EEH_POSSIBLE_ERROR((*(((u8*)buf)+ns-1)), u8))
342 eeh_check_failure((void __iomem *)(port), *(u8*)buf); 191 eeh_check_failure(addr, *(u8*)buf);
343} 192}
344 193
345static inline void eeh_insw_ns(unsigned long port, void * buf, int ns) 194static inline void eeh_readsw(const volatile void __iomem *addr, void * buf,
195 int ns)
346{ 196{
347 _insw_ns((u16 __iomem *)(port+pci_io_base), buf, ns); 197 _insw(addr, buf, ns);
348 if (EEH_POSSIBLE_ERROR((*(((u16*)buf)+ns-1)), u16)) 198 if (EEH_POSSIBLE_ERROR((*(((u16*)buf)+ns-1)), u16))
349 eeh_check_failure((void __iomem *)(port), *(u16*)buf); 199 eeh_check_failure(addr, *(u16*)buf);
350} 200}
351 201
352static inline void eeh_insl_ns(unsigned long port, void * buf, int nl) 202static inline void eeh_readsl(const volatile void __iomem *addr, void * buf,
203 int nl)
353{ 204{
354 _insl_ns((u32 __iomem *)(port+pci_io_base), buf, nl); 205 _insl(addr, buf, nl);
355 if (EEH_POSSIBLE_ERROR((*(((u32*)buf)+nl-1)), u32)) 206 if (EEH_POSSIBLE_ERROR((*(((u32*)buf)+nl-1)), u32))
356 eeh_check_failure((void __iomem *)(port), *(u32*)buf); 207 eeh_check_failure(addr, *(u32*)buf);
357} 208}
358 209
359#endif /* __KERNEL__ */ 210#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index 9a83a987d396..d36426c01b6b 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -124,12 +124,10 @@ typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG];
124# define ELF_DATA ELFDATA2MSB 124# define ELF_DATA ELFDATA2MSB
125 typedef elf_greg_t64 elf_greg_t; 125 typedef elf_greg_t64 elf_greg_t;
126 typedef elf_gregset_t64 elf_gregset_t; 126 typedef elf_gregset_t64 elf_gregset_t;
127# define elf_addr_t unsigned long
128#else 127#else
129 /* Assumption: ELF_ARCH == EM_PPC and ELF_CLASS == ELFCLASS32 */ 128 /* Assumption: ELF_ARCH == EM_PPC and ELF_CLASS == ELFCLASS32 */
130 typedef elf_greg_t32 elf_greg_t; 129 typedef elf_greg_t32 elf_greg_t;
131 typedef elf_gregset_t32 elf_gregset_t; 130 typedef elf_gregset_t32 elf_gregset_t;
132# define elf_addr_t __u32
133#endif /* ELF_ARCH */ 131#endif /* ELF_ARCH */
134 132
135/* Floating point registers */ 133/* Floating point registers */
@@ -411,4 +409,17 @@ do { \
411/* Keep this the last entry. */ 409/* Keep this the last entry. */
412#define R_PPC64_NUM 107 410#define R_PPC64_NUM 107
413 411
412#ifdef CONFIG_SPU_BASE
413/* Notes used in ET_CORE. Note name is "SPU/<fd>/<filename>". */
414#define NT_SPU 1
415
416extern int arch_notes_size(void);
417extern void arch_write_notes(struct file *file);
418
419#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size()
420#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file)
421
422#define ARCH_HAVE_EXTRA_ELF_NOTES
423#endif /* CONFIG_PPC_CELL */
424
414#endif /* _ASM_POWERPC_ELF_H */ 425#endif /* _ASM_POWERPC_ELF_H */
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h
index fdf9aff71150..98f7b62422c9 100644
--- a/include/asm-powerpc/firmware.h
+++ b/include/asm-powerpc/firmware.h
@@ -42,6 +42,7 @@
42#define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000) 42#define FW_FEATURE_SPLPAR ASM_CONST(0x0000000000100000)
43#define FW_FEATURE_ISERIES ASM_CONST(0x0000000000200000) 43#define FW_FEATURE_ISERIES ASM_CONST(0x0000000000200000)
44#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000) 44#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000)
45#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000)
45 46
46#ifndef __ASSEMBLY__ 47#ifndef __ASSEMBLY__
47 48
@@ -58,6 +59,10 @@ enum {
58 FW_FEATURE_PSERIES_ALWAYS = 0, 59 FW_FEATURE_PSERIES_ALWAYS = 0,
59 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, 60 FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
60 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, 61 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
62 FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
63 FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
64 FW_FEATURE_NATIVE_POSSIBLE = 0,
65 FW_FEATURE_NATIVE_ALWAYS = 0,
61 FW_FEATURE_POSSIBLE = 66 FW_FEATURE_POSSIBLE =
62#ifdef CONFIG_PPC_PSERIES 67#ifdef CONFIG_PPC_PSERIES
63 FW_FEATURE_PSERIES_POSSIBLE | 68 FW_FEATURE_PSERIES_POSSIBLE |
@@ -65,6 +70,12 @@ enum {
65#ifdef CONFIG_PPC_ISERIES 70#ifdef CONFIG_PPC_ISERIES
66 FW_FEATURE_ISERIES_POSSIBLE | 71 FW_FEATURE_ISERIES_POSSIBLE |
67#endif 72#endif
73#ifdef CONFIG_PPC_PS3
74 FW_FEATURE_PS3_POSSIBLE |
75#endif
76#ifdef CONFIG_PPC_NATIVE
77 FW_FEATURE_NATIVE_ALWAYS |
78#endif
68 0, 79 0,
69 FW_FEATURE_ALWAYS = 80 FW_FEATURE_ALWAYS =
70#ifdef CONFIG_PPC_PSERIES 81#ifdef CONFIG_PPC_PSERIES
@@ -73,6 +84,12 @@ enum {
73#ifdef CONFIG_PPC_ISERIES 84#ifdef CONFIG_PPC_ISERIES
74 FW_FEATURE_ISERIES_ALWAYS & 85 FW_FEATURE_ISERIES_ALWAYS &
75#endif 86#endif
87#ifdef CONFIG_PPC_PS3
88 FW_FEATURE_PS3_ALWAYS &
89#endif
90#ifdef CONFIG_PPC_NATIVE
91 FW_FEATURE_NATIVE_ALWAYS &
92#endif
76 FW_FEATURE_POSSIBLE, 93 FW_FEATURE_POSSIBLE,
77 94
78#else /* CONFIG_PPC64 */ 95#else /* CONFIG_PPC64 */
diff --git a/include/asm-powerpc/futex.h b/include/asm-powerpc/futex.h
index 936422e54891..3f3673fd3ff3 100644
--- a/include/asm-powerpc/futex.h
+++ b/include/asm-powerpc/futex.h
@@ -43,7 +43,7 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
43 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 43 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
44 return -EFAULT; 44 return -EFAULT;
45 45
46 inc_preempt_count(); 46 pagefault_disable();
47 47
48 switch (op) { 48 switch (op) {
49 case FUTEX_OP_SET: 49 case FUTEX_OP_SET:
@@ -65,7 +65,7 @@ static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
65 ret = -ENOSYS; 65 ret = -ENOSYS;
66 } 66 }
67 67
68 dec_preempt_count(); 68 pagefault_enable();
69 69
70 if (!ret) { 70 if (!ret) {
71 switch (cmp) { 71 switch (cmp) {
diff --git a/include/asm-powerpc/hw_irq.h b/include/asm-powerpc/hw_irq.h
index d40359204aba..d604863d72fb 100644
--- a/include/asm-powerpc/hw_irq.h
+++ b/include/asm-powerpc/hw_irq.h
@@ -7,16 +7,40 @@
7#ifdef __KERNEL__ 7#ifdef __KERNEL__
8 8
9#include <linux/errno.h> 9#include <linux/errno.h>
10#include <linux/compiler.h>
10#include <asm/ptrace.h> 11#include <asm/ptrace.h>
11#include <asm/processor.h> 12#include <asm/processor.h>
12 13
13extern void timer_interrupt(struct pt_regs *); 14extern void timer_interrupt(struct pt_regs *);
14 15
15#ifdef CONFIG_PPC_ISERIES 16#ifdef CONFIG_PPC64
17#include <asm/paca.h>
18
19static inline unsigned long local_get_flags(void)
20{
21 unsigned long flags;
22
23 __asm__ __volatile__("lbz %0,%1(13)"
24 : "=r" (flags)
25 : "i" (offsetof(struct paca_struct, soft_enabled)));
26
27 return flags;
28}
29
30static inline unsigned long local_irq_disable(void)
31{
32 unsigned long flags, zero;
33
34 __asm__ __volatile__("li %1,0; lbz %0,%2(13); stb %1,%2(13)"
35 : "=r" (flags), "=&r" (zero)
36 : "i" (offsetof(struct paca_struct, soft_enabled))
37 : "memory");
38
39 return flags;
40}
16 41
17extern unsigned long local_get_flags(void);
18extern unsigned long local_irq_disable(void);
19extern void local_irq_restore(unsigned long); 42extern void local_irq_restore(unsigned long);
43extern void iseries_handle_interrupts(void);
20 44
21#define local_irq_enable() local_irq_restore(1) 45#define local_irq_enable() local_irq_restore(1)
22#define local_save_flags(flags) ((flags) = local_get_flags()) 46#define local_save_flags(flags) ((flags) = local_get_flags())
@@ -24,17 +48,14 @@ extern void local_irq_restore(unsigned long);
24 48
25#define irqs_disabled() (local_get_flags() == 0) 49#define irqs_disabled() (local_get_flags() == 0)
26 50
51#define hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1)
52#define hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1)
53
27#else 54#else
28 55
29#if defined(CONFIG_BOOKE) 56#if defined(CONFIG_BOOKE)
30#define SET_MSR_EE(x) mtmsr(x) 57#define SET_MSR_EE(x) mtmsr(x)
31#define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory") 58#define local_irq_restore(flags) __asm__ __volatile__("wrtee %0" : : "r" (flags) : "memory")
32#elif defined(__powerpc64__)
33#define SET_MSR_EE(x) __mtmsrd(x, 1)
34#define local_irq_restore(flags) do { \
35 __asm__ __volatile__("": : :"memory"); \
36 __mtmsrd((flags), 1); \
37} while(0)
38#else 59#else
39#define SET_MSR_EE(x) mtmsr(x) 60#define SET_MSR_EE(x) mtmsr(x)
40#define local_irq_restore(flags) mtmsr(flags) 61#define local_irq_restore(flags) mtmsr(flags)
@@ -81,7 +102,10 @@ static inline void local_irq_save_ptr(unsigned long *flags)
81#define local_irq_save(flags) local_irq_save_ptr(&flags) 102#define local_irq_save(flags) local_irq_save_ptr(&flags)
82#define irqs_disabled() ((mfmsr() & MSR_EE) == 0) 103#define irqs_disabled() ((mfmsr() & MSR_EE) == 0)
83 104
84#endif /* CONFIG_PPC_ISERIES */ 105#define hard_irq_enable() local_irq_enable()
106#define hard_irq_disable() local_irq_disable()
107
108#endif /* CONFIG_PPC64 */
85 109
86#define mask_irq(irq) \ 110#define mask_irq(irq) \
87 ({ \ 111 ({ \
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h
index 3493429b70f5..66112114b8c5 100644
--- a/include/asm-powerpc/ibmebus.h
+++ b/include/asm-powerpc/ibmebus.h
@@ -44,7 +44,6 @@
44#include <linux/mod_devicetable.h> 44#include <linux/mod_devicetable.h>
45#include <asm/of_device.h> 45#include <asm/of_device.h>
46 46
47extern struct dma_mapping_ops ibmebus_dma_ops;
48extern struct bus_type ibmebus_bus_type; 47extern struct bus_type ibmebus_bus_type;
49 48
50struct ibmebus_dev { 49struct ibmebus_dev {
diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h
index c8390f9485de..0f66f0f82c32 100644
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -22,10 +22,10 @@
22#endif 22#endif
23#endif 23#endif
24 24
25#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c)) 25#define __ide_mm_insw(p, a, c) readsw((void __iomem *)(p), (a), (c))
26#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c)) 26#define __ide_mm_insl(p, a, c) readsl((void __iomem *)(p), (a), (c))
27#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c)) 27#define __ide_mm_outsw(p, a, c) writesw((void __iomem *)(p), (a), (c))
28#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c)) 28#define __ide_mm_outsl(p, a, c) writesl((void __iomem *)(p), (a), (c))
29 29
30#ifndef __powerpc64__ 30#ifndef __powerpc64__
31#include <linux/hdreg.h> 31#include <linux/hdreg.h>
diff --git a/include/asm-powerpc/immap_qe.h b/include/asm-powerpc/immap_qe.h
index ce12f85fff9b..9fdd0491f6a3 100644
--- a/include/asm-powerpc/immap_qe.h
+++ b/include/asm-powerpc/immap_qe.h
@@ -136,22 +136,7 @@ struct qe_timers {
136 136
137/* BRG */ 137/* BRG */
138struct qe_brg { 138struct qe_brg {
139 __be32 brgc1; /* BRG1 configuration register */ 139 __be32 brgc[16]; /* BRG configuration registers */
140 __be32 brgc2; /* BRG2 configuration register */
141 __be32 brgc3; /* BRG3 configuration register */
142 __be32 brgc4; /* BRG4 configuration register */
143 __be32 brgc5; /* BRG5 configuration register */
144 __be32 brgc6; /* BRG6 configuration register */
145 __be32 brgc7; /* BRG7 configuration register */
146 __be32 brgc8; /* BRG8 configuration register */
147 __be32 brgc9; /* BRG9 configuration register */
148 __be32 brgc10; /* BRG10 configuration register */
149 __be32 brgc11; /* BRG11 configuration register */
150 __be32 brgc12; /* BRG12 configuration register */
151 __be32 brgc13; /* BRG13 configuration register */
152 __be32 brgc14; /* BRG14 configuration register */
153 __be32 brgc15; /* BRG15 configuration register */
154 __be32 brgc16; /* BRG16 configuration register */
155 u8 res0[0x40]; 140 u8 res0[0x40];
156} __attribute__ ((packed)); 141} __attribute__ ((packed));
157 142
diff --git a/include/asm-powerpc/io-defs.h b/include/asm-powerpc/io-defs.h
new file mode 100644
index 000000000000..03691ab69217
--- /dev/null
+++ b/include/asm-powerpc/io-defs.h
@@ -0,0 +1,59 @@
1/* This file is meant to be include multiple times by other headers */
2
3DEF_PCI_AC_RET(readb, u8, (const PCI_IO_ADDR addr), (addr))
4DEF_PCI_AC_RET(readw, u16, (const PCI_IO_ADDR addr), (addr))
5DEF_PCI_AC_RET(readl, u32, (const PCI_IO_ADDR addr), (addr))
6DEF_PCI_AC_RET(readw_be, u16, (const PCI_IO_ADDR addr), (addr))
7DEF_PCI_AC_RET(readl_be, u32, (const PCI_IO_ADDR addr), (addr))
8DEF_PCI_AC_NORET(writeb, (u8 val, PCI_IO_ADDR addr), (val, addr))
9DEF_PCI_AC_NORET(writew, (u16 val, PCI_IO_ADDR addr), (val, addr))
10DEF_PCI_AC_NORET(writel, (u32 val, PCI_IO_ADDR addr), (val, addr))
11DEF_PCI_AC_NORET(writew_be, (u16 val, PCI_IO_ADDR addr), (val, addr))
12DEF_PCI_AC_NORET(writel_be, (u32 val, PCI_IO_ADDR addr), (val, addr))
13
14#ifdef __powerpc64__
15DEF_PCI_AC_RET(readq, u64, (const PCI_IO_ADDR addr), (addr))
16DEF_PCI_AC_RET(readq_be, u64, (const PCI_IO_ADDR addr), (addr))
17DEF_PCI_AC_NORET(writeq, (u64 val, PCI_IO_ADDR addr), (val, addr))
18DEF_PCI_AC_NORET(writeq_be, (u64 val, PCI_IO_ADDR addr), (val, addr))
19#endif /* __powerpc64__ */
20
21DEF_PCI_AC_RET(inb, u8, (unsigned long port), (port))
22DEF_PCI_AC_RET(inw, u16, (unsigned long port), (port))
23DEF_PCI_AC_RET(inl, u32, (unsigned long port), (port))
24DEF_PCI_AC_NORET(outb, (u8 val, unsigned long port), (val, port))
25DEF_PCI_AC_NORET(outw, (u16 val, unsigned long port), (val, port))
26DEF_PCI_AC_NORET(outl, (u32 val, unsigned long port), (val, port))
27
28DEF_PCI_AC_NORET(readsb, (const PCI_IO_ADDR a, void *b, unsigned long c), \
29 (a, b, c))
30DEF_PCI_AC_NORET(readsw, (const PCI_IO_ADDR a, void *b, unsigned long c), \
31 (a, b, c))
32DEF_PCI_AC_NORET(readsl, (const PCI_IO_ADDR a, void *b, unsigned long c), \
33 (a, b, c))
34DEF_PCI_AC_NORET(writesb, (PCI_IO_ADDR a, const void *b, unsigned long c), \
35 (a, b, c))
36DEF_PCI_AC_NORET(writesw, (PCI_IO_ADDR a, const void *b, unsigned long c), \
37 (a, b, c))
38DEF_PCI_AC_NORET(writesl, (PCI_IO_ADDR a, const void *b, unsigned long c), \
39 (a, b, c))
40
41DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c), \
42 (p, b, c))
43DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c), \
44 (p, b, c))
45DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c), \
46 (p, b, c))
47DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c), \
48 (p, b, c))
49DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c), \
50 (p, b, c))
51DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c), \
52 (p, b, c))
53
54DEF_PCI_AC_NORET(memset_io, (PCI_IO_ADDR a, int c, unsigned long n), \
55 (a, c, n))
56DEF_PCI_AC_NORET(memcpy_fromio,(void *d,const PCI_IO_ADDR s,unsigned long n), \
57 (d, s, n))
58DEF_PCI_AC_NORET(memcpy_toio,(PCI_IO_ADDR d,const void *s,unsigned long n), \
59 (d, s, n))
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index c2c5f14b5f5f..1cd532379c30 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -13,154 +13,530 @@
13extern int check_legacy_ioport(unsigned long base_port); 13extern int check_legacy_ioport(unsigned long base_port);
14#define PNPBIOS_BASE 0xf000 /* only relevant for PReP */ 14#define PNPBIOS_BASE 0xf000 /* only relevant for PReP */
15 15
16#ifndef CONFIG_PPC64
17#include <asm-ppc/io.h>
18#else
19
20#include <linux/compiler.h> 16#include <linux/compiler.h>
21#include <asm/page.h> 17#include <asm/page.h>
22#include <asm/byteorder.h> 18#include <asm/byteorder.h>
23#include <asm/paca.h>
24#include <asm/synch.h> 19#include <asm/synch.h>
25#include <asm/delay.h> 20#include <asm/delay.h>
21#include <asm/mmu.h>
26 22
27#include <asm-generic/iomap.h> 23#include <asm-generic/iomap.h>
28 24
25#ifdef CONFIG_PPC64
26#include <asm/paca.h>
27#endif
28
29#define SIO_CONFIG_RA 0x398 29#define SIO_CONFIG_RA 0x398
30#define SIO_CONFIG_RD 0x399 30#define SIO_CONFIG_RD 0x399
31 31
32#define SLOW_DOWN_IO 32#define SLOW_DOWN_IO
33 33
34/* 32 bits uses slightly different variables for the various IO
35 * bases. Most of this file only uses _IO_BASE though which we
36 * define properly based on the platform
37 */
38#ifndef CONFIG_PCI
39#define _IO_BASE 0
40#define _ISA_MEM_BASE 0
41#define PCI_DRAM_OFFSET 0
42#elif defined(CONFIG_PPC32)
43#define _IO_BASE isa_io_base
44#define _ISA_MEM_BASE isa_mem_base
45#define PCI_DRAM_OFFSET pci_dram_offset
46#else
47#define _IO_BASE pci_io_base
48#define _ISA_MEM_BASE 0
49#define PCI_DRAM_OFFSET 0
50#endif
51
34extern unsigned long isa_io_base; 52extern unsigned long isa_io_base;
53extern unsigned long isa_mem_base;
35extern unsigned long pci_io_base; 54extern unsigned long pci_io_base;
55extern unsigned long pci_dram_offset;
56
57#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_INDIRECT_IO)
58#error CONFIG_PPC_INDIRECT_IO is not yet supported on 32 bits
59#endif
60
61/*
62 *
63 * Low level MMIO accessors
64 *
65 * This provides the non-bus specific accessors to MMIO. Those are PowerPC
66 * specific and thus shouldn't be used in generic code. The accessors
67 * provided here are:
68 *
69 * in_8, in_le16, in_be16, in_le32, in_be32, in_le64, in_be64
70 * out_8, out_le16, out_be16, out_le32, out_be32, out_le64, out_be64
71 * _insb, _insw_ns, _insl_ns, _outsb, _outsw_ns, _outsl_ns
72 *
73 * Those operate directly on a kernel virtual address. Note that the prototype
74 * for the out_* accessors has the arguments in opposite order from the usual
75 * linux PCI accessors. Unlike those, they take the address first and the value
76 * next.
77 *
78 * Note: I might drop the _ns suffix on the stream operations soon as it is
79 * simply normal for stream operations to not swap in the first place.
80 *
81 */
82
83#ifdef CONFIG_PPC64
84#define IO_SET_SYNC_FLAG() do { get_paca()->io_sync = 1; } while(0)
85#else
86#define IO_SET_SYNC_FLAG()
87#endif
88
89#define DEF_MMIO_IN(name, type, insn) \
90static inline type name(const volatile type __iomem *addr) \
91{ \
92 type ret; \
93 __asm__ __volatile__("sync;" insn ";twi 0,%0,0;isync" \
94 : "=r" (ret) : "r" (addr), "m" (*addr)); \
95 return ret; \
96}
97
98#define DEF_MMIO_OUT(name, type, insn) \
99static inline void name(volatile type __iomem *addr, type val) \
100{ \
101 __asm__ __volatile__("sync;" insn \
102 : "=m" (*addr) : "r" (val), "r" (addr)); \
103 IO_SET_SYNC_FLAG(); \
104}
105
106
107#define DEF_MMIO_IN_BE(name, size, insn) \
108 DEF_MMIO_IN(name, u##size, __stringify(insn)"%U2%X2 %0,%2")
109#define DEF_MMIO_IN_LE(name, size, insn) \
110 DEF_MMIO_IN(name, u##size, __stringify(insn)" %0,0,%1")
111
112#define DEF_MMIO_OUT_BE(name, size, insn) \
113 DEF_MMIO_OUT(name, u##size, __stringify(insn)"%U0%X0 %1,%0")
114#define DEF_MMIO_OUT_LE(name, size, insn) \
115 DEF_MMIO_OUT(name, u##size, __stringify(insn)" %1,0,%2")
116
117DEF_MMIO_IN_BE(in_8, 8, lbz);
118DEF_MMIO_IN_BE(in_be16, 16, lhz);
119DEF_MMIO_IN_BE(in_be32, 32, lwz);
120DEF_MMIO_IN_LE(in_le16, 16, lhbrx);
121DEF_MMIO_IN_LE(in_le32, 32, lwbrx);
122
123DEF_MMIO_OUT_BE(out_8, 8, stb);
124DEF_MMIO_OUT_BE(out_be16, 16, sth);
125DEF_MMIO_OUT_BE(out_be32, 32, stw);
126DEF_MMIO_OUT_LE(out_le16, 16, sthbrx);
127DEF_MMIO_OUT_LE(out_le32, 32, stwbrx);
128
129#ifdef __powerpc64__
130DEF_MMIO_OUT_BE(out_be64, 64, std);
131DEF_MMIO_IN_BE(in_be64, 64, ld);
132
133/* There is no asm instructions for 64 bits reverse loads and stores */
134static inline u64 in_le64(const volatile u64 __iomem *addr)
135{
136 return le64_to_cpu(in_be64(addr));
137}
138
139static inline void out_le64(volatile u64 __iomem *addr, u64 val)
140{
141 out_be64(addr, cpu_to_le64(val));
142}
143#endif /* __powerpc64__ */
144
145/*
146 * Low level IO stream instructions are defined out of line for now
147 */
148extern void _insb(const volatile u8 __iomem *addr, void *buf, long count);
149extern void _outsb(volatile u8 __iomem *addr,const void *buf,long count);
150extern void _insw_ns(const volatile u16 __iomem *addr, void *buf, long count);
151extern void _outsw_ns(volatile u16 __iomem *addr, const void *buf, long count);
152extern void _insl_ns(const volatile u32 __iomem *addr, void *buf, long count);
153extern void _outsl_ns(volatile u32 __iomem *addr, const void *buf, long count);
154
155/* The _ns naming is historical and will be removed. For now, just #define
156 * the non _ns equivalent names
157 */
158#define _insw _insw_ns
159#define _insl _insl_ns
160#define _outsw _outsw_ns
161#define _outsl _outsl_ns
162
163
164/*
165 * memset_io, memcpy_toio, memcpy_fromio base implementations are out of line
166 */
167
168extern void _memset_io(volatile void __iomem *addr, int c, unsigned long n);
169extern void _memcpy_fromio(void *dest, const volatile void __iomem *src,
170 unsigned long n);
171extern void _memcpy_toio(volatile void __iomem *dest, const void *src,
172 unsigned long n);
173
174/*
175 *
176 * PCI and standard ISA accessors
177 *
178 * Those are globally defined linux accessors for devices on PCI or ISA
179 * busses. They follow the Linux defined semantics. The current implementation
180 * for PowerPC is as close as possible to the x86 version of these, and thus
181 * provides fairly heavy weight barriers for the non-raw versions
182 *
183 * In addition, they support a hook mechanism when CONFIG_PPC_INDIRECT_IO
184 * allowing the platform to provide its own implementation of some or all
185 * of the accessors.
186 */
187
188/*
189 * Include the EEH definitions when EEH is enabled only so they don't get
190 * in the way when building for 32 bits
191 */
192#ifdef CONFIG_EEH
193#include <asm/eeh.h>
194#endif
195
196/* Shortcut to the MMIO argument pointer */
197#define PCI_IO_ADDR volatile void __iomem *
198
199/* Indirect IO address tokens:
200 *
201 * When CONFIG_PPC_INDIRECT_IO is set, the platform can provide hooks
202 * on all IOs. (Note that this is all 64 bits only for now)
203 *
204 * To help platforms who may need to differenciate MMIO addresses in
205 * their hooks, a bitfield is reserved for use by the platform near the
206 * top of MMIO addresses (not PIO, those have to cope the hard way).
207 *
208 * This bit field is 12 bits and is at the top of the IO virtual
209 * addresses PCI_IO_INDIRECT_TOKEN_MASK.
210 *
211 * The kernel virtual space is thus:
212 *
213 * 0xD000000000000000 : vmalloc
214 * 0xD000080000000000 : PCI PHB IO space
215 * 0xD000080080000000 : ioremap
216 * 0xD0000fffffffffff : end of ioremap region
217 *
218 * Since the top 4 bits are reserved as the region ID, we use thus
219 * the next 12 bits and keep 4 bits available for the future if the
220 * virtual address space is ever to be extended.
221 *
222 * The direct IO mapping operations will then mask off those bits
223 * before doing the actual access, though that only happen when
224 * CONFIG_PPC_INDIRECT_IO is set, thus be careful when you use that
225 * mechanism
226 */
227
228#ifdef CONFIG_PPC_INDIRECT_IO
229#define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul
230#define PCI_IO_IND_TOKEN_SHIFT 48
231#define PCI_FIX_ADDR(addr) \
232 ((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK))
233#define PCI_GET_ADDR_TOKEN(addr) \
234 (((unsigned long)(addr) & PCI_IO_IND_TOKEN_MASK) >> \
235 PCI_IO_IND_TOKEN_SHIFT)
236#define PCI_SET_ADDR_TOKEN(addr, token) \
237do { \
238 unsigned long __a = (unsigned long)(addr); \
239 __a &= ~PCI_IO_IND_TOKEN_MASK; \
240 __a |= ((unsigned long)(token)) << PCI_IO_IND_TOKEN_SHIFT; \
241 (addr) = (void __iomem *)__a; \
242} while(0)
243#else
244#define PCI_FIX_ADDR(addr) (addr)
245#endif
36 246
37#ifdef CONFIG_PPC_ISERIES 247
38 248/*
39extern int in_8(const volatile unsigned char __iomem *addr); 249 * Non ordered and non-swapping "raw" accessors
40extern void out_8(volatile unsigned char __iomem *addr, int val); 250 */
41extern int in_le16(const volatile unsigned short __iomem *addr);
42extern int in_be16(const volatile unsigned short __iomem *addr);
43extern void out_le16(volatile unsigned short __iomem *addr, int val);
44extern void out_be16(volatile unsigned short __iomem *addr, int val);
45extern unsigned in_le32(const volatile unsigned __iomem *addr);
46extern unsigned in_be32(const volatile unsigned __iomem *addr);
47extern void out_le32(volatile unsigned __iomem *addr, int val);
48extern void out_be32(volatile unsigned __iomem *addr, int val);
49extern unsigned long in_le64(const volatile unsigned long __iomem *addr);
50extern unsigned long in_be64(const volatile unsigned long __iomem *addr);
51extern void out_le64(volatile unsigned long __iomem *addr, unsigned long val);
52extern void out_be64(volatile unsigned long __iomem *addr, unsigned long val);
53
54extern unsigned char __raw_readb(const volatile void __iomem *addr);
55extern unsigned short __raw_readw(const volatile void __iomem *addr);
56extern unsigned int __raw_readl(const volatile void __iomem *addr);
57extern unsigned long __raw_readq(const volatile void __iomem *addr);
58extern void __raw_writeb(unsigned char v, volatile void __iomem *addr);
59extern void __raw_writew(unsigned short v, volatile void __iomem *addr);
60extern void __raw_writel(unsigned int v, volatile void __iomem *addr);
61extern void __raw_writeq(unsigned long v, volatile void __iomem *addr);
62
63extern void memset_io(volatile void __iomem *addr, int c, unsigned long n);
64extern void memcpy_fromio(void *dest, const volatile void __iomem *src,
65 unsigned long n);
66extern void memcpy_toio(volatile void __iomem *dest, const void *src,
67 unsigned long n);
68
69#else /* CONFIG_PPC_ISERIES */
70
71#define in_8(addr) __in_8((addr))
72#define out_8(addr, val) __out_8((addr), (val))
73#define in_le16(addr) __in_le16((addr))
74#define in_be16(addr) __in_be16((addr))
75#define out_le16(addr, val) __out_le16((addr), (val))
76#define out_be16(addr, val) __out_be16((addr), (val))
77#define in_le32(addr) __in_le32((addr))
78#define in_be32(addr) __in_be32((addr))
79#define out_le32(addr, val) __out_le32((addr), (val))
80#define out_be32(addr, val) __out_be32((addr), (val))
81#define in_le64(addr) __in_le64((addr))
82#define in_be64(addr) __in_be64((addr))
83#define out_le64(addr, val) __out_le64((addr), (val))
84#define out_be64(addr, val) __out_be64((addr), (val))
85 251
86static inline unsigned char __raw_readb(const volatile void __iomem *addr) 252static inline unsigned char __raw_readb(const volatile void __iomem *addr)
87{ 253{
88 return *(volatile unsigned char __force *)addr; 254 return *(volatile unsigned char __force *)PCI_FIX_ADDR(addr);
89} 255}
90static inline unsigned short __raw_readw(const volatile void __iomem *addr) 256static inline unsigned short __raw_readw(const volatile void __iomem *addr)
91{ 257{
92 return *(volatile unsigned short __force *)addr; 258 return *(volatile unsigned short __force *)PCI_FIX_ADDR(addr);
93} 259}
94static inline unsigned int __raw_readl(const volatile void __iomem *addr) 260static inline unsigned int __raw_readl(const volatile void __iomem *addr)
95{ 261{
96 return *(volatile unsigned int __force *)addr; 262 return *(volatile unsigned int __force *)PCI_FIX_ADDR(addr);
97}
98static inline unsigned long __raw_readq(const volatile void __iomem *addr)
99{
100 return *(volatile unsigned long __force *)addr;
101} 263}
102static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr) 264static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
103{ 265{
104 *(volatile unsigned char __force *)addr = v; 266 *(volatile unsigned char __force *)PCI_FIX_ADDR(addr) = v;
105} 267}
106static inline void __raw_writew(unsigned short v, volatile void __iomem *addr) 268static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)
107{ 269{
108 *(volatile unsigned short __force *)addr = v; 270 *(volatile unsigned short __force *)PCI_FIX_ADDR(addr) = v;
109} 271}
110static inline void __raw_writel(unsigned int v, volatile void __iomem *addr) 272static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
111{ 273{
112 *(volatile unsigned int __force *)addr = v; 274 *(volatile unsigned int __force *)PCI_FIX_ADDR(addr) = v;
275}
276
277#ifdef __powerpc64__
278static inline unsigned long __raw_readq(const volatile void __iomem *addr)
279{
280 return *(volatile unsigned long __force *)PCI_FIX_ADDR(addr);
113} 281}
114static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) 282static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
115{ 283{
116 *(volatile unsigned long __force *)addr = v; 284 *(volatile unsigned long __force *)PCI_FIX_ADDR(addr) = v;
285}
286#endif /* __powerpc64__ */
287
288/*
289 *
290 * PCI PIO and MMIO accessors.
291 *
292 *
293 * On 32 bits, PIO operations have a recovery mechanism in case they trigger
294 * machine checks (which they occasionally do when probing non existing
295 * IO ports on some platforms, like PowerMac and 8xx).
296 * I always found it to be of dubious reliability and I am tempted to get
297 * rid of it one of these days. So if you think it's important to keep it,
298 * please voice up asap. We never had it for 64 bits and I do not intend
299 * to port it over
300 */
301
302#ifdef CONFIG_PPC32
303
304#define __do_in_asm(name, op) \
305static inline unsigned int name(unsigned int port) \
306{ \
307 unsigned int x; \
308 __asm__ __volatile__( \
309 "sync\n" \
310 "0:" op " %0,0,%1\n" \
311 "1: twi 0,%0,0\n" \
312 "2: isync\n" \
313 "3: nop\n" \
314 "4:\n" \
315 ".section .fixup,\"ax\"\n" \
316 "5: li %0,-1\n" \
317 " b 4b\n" \
318 ".previous\n" \
319 ".section __ex_table,\"a\"\n" \
320 " .align 2\n" \
321 " .long 0b,5b\n" \
322 " .long 1b,5b\n" \
323 " .long 2b,5b\n" \
324 " .long 3b,5b\n" \
325 ".previous" \
326 : "=&r" (x) \
327 : "r" (port + _IO_BASE)); \
328 return x; \
329}
330
331#define __do_out_asm(name, op) \
332static inline void name(unsigned int val, unsigned int port) \
333{ \
334 __asm__ __volatile__( \
335 "sync\n" \
336 "0:" op " %0,0,%1\n" \
337 "1: sync\n" \
338 "2:\n" \
339 ".section __ex_table,\"a\"\n" \
340 " .align 2\n" \
341 " .long 0b,2b\n" \
342 " .long 1b,2b\n" \
343 ".previous" \
344 : : "r" (val), "r" (port + _IO_BASE)); \
345}
346
347__do_in_asm(_rec_inb, "lbzx")
348__do_in_asm(_rec_inw, "lhbrx")
349__do_in_asm(_rec_inl, "lwbrx")
350__do_out_asm(_rec_outb, "stbx")
351__do_out_asm(_rec_outw, "sthbrx")
352__do_out_asm(_rec_outl, "stwbrx")
353
354#endif /* CONFIG_PPC32 */
355
356/* The "__do_*" operations below provide the actual "base" implementation
357 * for each of the defined acccessor. Some of them use the out_* functions
358 * directly, some of them still use EEH, though we might change that in the
359 * future. Those macros below provide the necessary argument swapping and
360 * handling of the IO base for PIO.
361 *
362 * They are themselves used by the macros that define the actual accessors
363 * and can be used by the hooks if any.
364 *
365 * Note that PIO operations are always defined in terms of their corresonding
366 * MMIO operations. That allows platforms like iSeries who want to modify the
367 * behaviour of both to only hook on the MMIO version and get both. It's also
368 * possible to hook directly at the toplevel PIO operation if they have to
369 * be handled differently
370 */
371#define __do_writeb(val, addr) out_8(PCI_FIX_ADDR(addr), val)
372#define __do_writew(val, addr) out_le16(PCI_FIX_ADDR(addr), val)
373#define __do_writel(val, addr) out_le32(PCI_FIX_ADDR(addr), val)
374#define __do_writeq(val, addr) out_le64(PCI_FIX_ADDR(addr), val)
375#define __do_writew_be(val, addr) out_be16(PCI_FIX_ADDR(addr), val)
376#define __do_writel_be(val, addr) out_be32(PCI_FIX_ADDR(addr), val)
377#define __do_writeq_be(val, addr) out_be64(PCI_FIX_ADDR(addr), val)
378
379#ifdef CONFIG_EEH
380#define __do_readb(addr) eeh_readb(PCI_FIX_ADDR(addr))
381#define __do_readw(addr) eeh_readw(PCI_FIX_ADDR(addr))
382#define __do_readl(addr) eeh_readl(PCI_FIX_ADDR(addr))
383#define __do_readq(addr) eeh_readq(PCI_FIX_ADDR(addr))
384#define __do_readw_be(addr) eeh_readw_be(PCI_FIX_ADDR(addr))
385#define __do_readl_be(addr) eeh_readl_be(PCI_FIX_ADDR(addr))
386#define __do_readq_be(addr) eeh_readq_be(PCI_FIX_ADDR(addr))
387#else /* CONFIG_EEH */
388#define __do_readb(addr) in_8(PCI_FIX_ADDR(addr))
389#define __do_readw(addr) in_le16(PCI_FIX_ADDR(addr))
390#define __do_readl(addr) in_le32(PCI_FIX_ADDR(addr))
391#define __do_readq(addr) in_le64(PCI_FIX_ADDR(addr))
392#define __do_readw_be(addr) in_be16(PCI_FIX_ADDR(addr))
393#define __do_readl_be(addr) in_be32(PCI_FIX_ADDR(addr))
394#define __do_readq_be(addr) in_be64(PCI_FIX_ADDR(addr))
395#endif /* !defined(CONFIG_EEH) */
396
397#ifdef CONFIG_PPC32
398#define __do_outb(val, port) _rec_outb(val, port)
399#define __do_outw(val, port) _rec_outw(val, port)
400#define __do_outl(val, port) _rec_outl(val, port)
401#define __do_inb(port) _rec_inb(port)
402#define __do_inw(port) _rec_inw(port)
403#define __do_inl(port) _rec_inl(port)
404#else /* CONFIG_PPC32 */
405#define __do_outb(val, port) writeb(val,(PCI_IO_ADDR)_IO_BASE+port);
406#define __do_outw(val, port) writew(val,(PCI_IO_ADDR)_IO_BASE+port);
407#define __do_outl(val, port) writel(val,(PCI_IO_ADDR)_IO_BASE+port);
408#define __do_inb(port) readb((PCI_IO_ADDR)_IO_BASE + port);
409#define __do_inw(port) readw((PCI_IO_ADDR)_IO_BASE + port);
410#define __do_inl(port) readl((PCI_IO_ADDR)_IO_BASE + port);
411#endif /* !CONFIG_PPC32 */
412
413#ifdef CONFIG_EEH
414#define __do_readsb(a, b, n) eeh_readsb(PCI_FIX_ADDR(a), (b), (n))
415#define __do_readsw(a, b, n) eeh_readsw(PCI_FIX_ADDR(a), (b), (n))
416#define __do_readsl(a, b, n) eeh_readsl(PCI_FIX_ADDR(a), (b), (n))
417#else /* CONFIG_EEH */
418#define __do_readsb(a, b, n) _insb(PCI_FIX_ADDR(a), (b), (n))
419#define __do_readsw(a, b, n) _insw(PCI_FIX_ADDR(a), (b), (n))
420#define __do_readsl(a, b, n) _insl(PCI_FIX_ADDR(a), (b), (n))
421#endif /* !CONFIG_EEH */
422#define __do_writesb(a, b, n) _outsb(PCI_FIX_ADDR(a),(b),(n))
423#define __do_writesw(a, b, n) _outsw(PCI_FIX_ADDR(a),(b),(n))
424#define __do_writesl(a, b, n) _outsl(PCI_FIX_ADDR(a),(b),(n))
425
426#define __do_insb(p, b, n) readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
427#define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
428#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
429#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
430#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
431#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
432
433#define __do_memset_io(addr, c, n) \
434 _memset_io(PCI_FIX_ADDR(addr), c, n)
435#define __do_memcpy_toio(dst, src, n) \
436 _memcpy_toio(PCI_FIX_ADDR(dst), src, n)
437
438#ifdef CONFIG_EEH
439#define __do_memcpy_fromio(dst, src, n) \
440 eeh_memcpy_fromio(dst, PCI_FIX_ADDR(src), n)
441#else /* CONFIG_EEH */
442#define __do_memcpy_fromio(dst, src, n) \
443 _memcpy_fromio(dst,PCI_FIX_ADDR(src),n)
444#endif /* !CONFIG_EEH */
445
446#ifdef CONFIG_PPC_INDIRECT_IO
447#define DEF_PCI_HOOK(x) x
448#else
449#define DEF_PCI_HOOK(x) NULL
450#endif
451
452/* Structure containing all the hooks */
453extern struct ppc_pci_io {
454
455#define DEF_PCI_AC_RET(name, ret, at, al) ret (*name) at;
456#define DEF_PCI_AC_NORET(name, at, al) void (*name) at;
457
458#include <asm/io-defs.h>
459
460#undef DEF_PCI_AC_RET
461#undef DEF_PCI_AC_NORET
462
463} ppc_pci_io;
464
465/* The inline wrappers */
466#define DEF_PCI_AC_RET(name, ret, at, al) \
467static inline ret name at \
468{ \
469 if (DEF_PCI_HOOK(ppc_pci_io.name) != NULL) \
470 return ppc_pci_io.name al; \
471 return __do_##name al; \
472}
473
474#define DEF_PCI_AC_NORET(name, at, al) \
475static inline void name at \
476{ \
477 if (DEF_PCI_HOOK(ppc_pci_io.name) != NULL) \
478 ppc_pci_io.name al; \
479 else \
480 __do_##name al; \
117} 481}
118#define memset_io(a,b,c) eeh_memset_io((a),(b),(c))
119#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c))
120#define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c))
121 482
122#endif /* CONFIG_PPC_ISERIES */ 483#include <asm/io-defs.h>
484
485#undef DEF_PCI_AC_RET
486#undef DEF_PCI_AC_NORET
487
488/* Some drivers check for the presence of readq & writeq with
489 * a #ifdef, so we make them happy here.
490 */
491#ifdef __powerpc64__
492#define readq readq
493#define writeq writeq
494#endif
495
496#ifdef CONFIG_NOT_COHERENT_CACHE
497
498#define dma_cache_inv(_start,_size) \
499 invalidate_dcache_range(_start, (_start + _size))
500#define dma_cache_wback(_start,_size) \
501 clean_dcache_range(_start, (_start + _size))
502#define dma_cache_wback_inv(_start,_size) \
503 flush_dcache_range(_start, (_start + _size))
504
505#else /* CONFIG_NOT_COHERENT_CACHE */
506
507#define dma_cache_inv(_start,_size) do { } while (0)
508#define dma_cache_wback(_start,_size) do { } while (0)
509#define dma_cache_wback_inv(_start,_size) do { } while (0)
510
511#endif /* !CONFIG_NOT_COHERENT_CACHE */
123 512
124/* 513/*
125 * The insw/outsw/insl/outsl macros don't do byte-swapping. 514 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
126 * They are only used in practice for transferring buffers which 515 * access
127 * are arrays of bytes, and byte-swapping is not appropriate in 516 */
128 * that case. - paulus */ 517#define xlate_dev_mem_ptr(p) __va(p)
129#define insb(port, buf, ns) eeh_insb((port), (buf), (ns)) 518
130#define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) 519/*
131#define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) 520 * Convert a virtual cached pointer to an uncached pointer
132 521 */
133#define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) 522#define xlate_dev_kmem_ptr(p) p
134#define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
135#define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
136
137#define readb(addr) eeh_readb(addr)
138#define readw(addr) eeh_readw(addr)
139#define readl(addr) eeh_readl(addr)
140#define readq(addr) eeh_readq(addr)
141#define writeb(data, addr) eeh_writeb((data), (addr))
142#define writew(data, addr) eeh_writew((data), (addr))
143#define writel(data, addr) eeh_writel((data), (addr))
144#define writeq(data, addr) eeh_writeq((data), (addr))
145#define inb(port) eeh_inb((unsigned long)port)
146#define outb(val, port) eeh_outb(val, (unsigned long)port)
147#define inw(port) eeh_inw((unsigned long)port)
148#define outw(val, port) eeh_outw(val, (unsigned long)port)
149#define inl(port) eeh_inl((unsigned long)port)
150#define outl(val, port) eeh_outl(val, (unsigned long)port)
151 523
524/*
525 * We don't do relaxed operations yet, at least not with this semantic
526 */
152#define readb_relaxed(addr) readb(addr) 527#define readb_relaxed(addr) readb(addr)
153#define readw_relaxed(addr) readw(addr) 528#define readw_relaxed(addr) readw(addr)
154#define readl_relaxed(addr) readl(addr) 529#define readl_relaxed(addr) readl(addr)
155#define readq_relaxed(addr) readq(addr) 530#define readq_relaxed(addr) readq(addr)
156 531
157extern void _insb(volatile u8 __iomem *port, void *buf, long count); 532#ifdef CONFIG_PPC32
158extern void _outsb(volatile u8 __iomem *port, const void *buf, long count); 533#define mmiowb()
159extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count); 534#else
160extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count); 535/*
161extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count); 536 * Enforce synchronisation of stores vs. spin_unlock
162extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count); 537 * (this does it explicitely, though our implementation of spin_unlock
163 538 * does it implicitely too)
539 */
164static inline void mmiowb(void) 540static inline void mmiowb(void)
165{ 541{
166 unsigned long tmp; 542 unsigned long tmp;
@@ -169,6 +545,24 @@ static inline void mmiowb(void)
169 : "=&r" (tmp) : "i" (offsetof(struct paca_struct, io_sync)) 545 : "=&r" (tmp) : "i" (offsetof(struct paca_struct, io_sync))
170 : "memory"); 546 : "memory");
171} 547}
548#endif /* !CONFIG_PPC32 */
549
550static inline void iosync(void)
551{
552 __asm__ __volatile__ ("sync" : : : "memory");
553}
554
555/* Enforce in-order execution of data I/O.
556 * No distinction between read/write on PPC; use eieio for all three.
557 * Those are fairly week though. They don't provide a barrier between
558 * MMIO and cacheable storage nor do they provide a barrier vs. locks,
559 * they only provide barriers between 2 __raw MMIO operations and
560 * possibly break write combining.
561 */
562#define iobarrier_rw() eieio()
563#define iobarrier_r() eieio()
564#define iobarrier_w() eieio()
565
172 566
173/* 567/*
174 * output pause versions need a delay at least for the 568 * output pause versions need a delay at least for the
@@ -185,11 +579,6 @@ static inline void mmiowb(void)
185#define IO_SPACE_LIMIT ~(0UL) 579#define IO_SPACE_LIMIT ~(0UL)
186 580
187 581
188extern int __ioremap_explicit(unsigned long p_addr, unsigned long v_addr,
189 unsigned long size, unsigned long flags);
190extern void __iomem *__ioremap(unsigned long address, unsigned long size,
191 unsigned long flags);
192
193/** 582/**
194 * ioremap - map bus memory into CPU space 583 * ioremap - map bus memory into CPU space
195 * @address: bus address of the memory 584 * @address: bus address of the memory
@@ -200,14 +589,77 @@ extern void __iomem *__ioremap(unsigned long address, unsigned long size,
200 * writew/writel functions and the other mmio helpers. The returned 589 * writew/writel functions and the other mmio helpers. The returned
201 * address is not guaranteed to be usable directly as a virtual 590 * address is not guaranteed to be usable directly as a virtual
202 * address. 591 * address.
592 *
593 * We provide a few variations of it:
594 *
595 * * ioremap is the standard one and provides non-cacheable guarded mappings
596 * and can be hooked by the platform via ppc_md
597 *
598 * * ioremap_flags allows to specify the page flags as an argument and can
599 * also be hooked by the platform via ppc_md
600 *
601 * * ioremap_nocache is identical to ioremap
602 *
603 * * iounmap undoes such a mapping and can be hooked
604 *
605 * * __ioremap_explicit (and the pending __iounmap_explicit) are low level
606 * functions to create hand-made mappings for use only by the PCI code
607 * and cannot currently be hooked.
608 *
609 * * __ioremap is the low level implementation used by ioremap and
610 * ioremap_flags and cannot be hooked (but can be used by a hook on one
611 * of the previous ones)
612 *
613 * * __iounmap, is the low level implementation used by iounmap and cannot
614 * be hooked (but can be used by a hook on iounmap)
615 *
203 */ 616 */
204extern void __iomem *ioremap(unsigned long address, unsigned long size); 617extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
205 618extern void __iomem *ioremap_flags(phys_addr_t address, unsigned long size,
619 unsigned long flags);
206#define ioremap_nocache(addr, size) ioremap((addr), (size)) 620#define ioremap_nocache(addr, size) ioremap((addr), (size))
207extern int iounmap_explicit(volatile void __iomem *addr, unsigned long size);
208extern void iounmap(volatile void __iomem *addr); 621extern void iounmap(volatile void __iomem *addr);
622
623extern void __iomem *__ioremap(phys_addr_t, unsigned long size,
624 unsigned long flags);
625extern void __iounmap(volatile void __iomem *addr);
626
627extern int __ioremap_explicit(phys_addr_t p_addr, unsigned long v_addr,
628 unsigned long size, unsigned long flags);
629extern int __iounmap_explicit(volatile void __iomem *start,
630 unsigned long size);
631
209extern void __iomem * reserve_phb_iospace(unsigned long size); 632extern void __iomem * reserve_phb_iospace(unsigned long size);
210 633
634/* Those are more 32 bits only functions */
635extern unsigned long iopa(unsigned long addr);
636extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
637extern void io_block_mapping(unsigned long virt, phys_addr_t phys,
638 unsigned int size, int flags);
639
640
641/*
642 * When CONFIG_PPC_INDIRECT_IO is set, we use the generic iomap implementation
643 * which needs some additional definitions here. They basically allow PIO
644 * space overall to be 1GB. This will work as long as we never try to use
645 * iomap to map MMIO below 1GB which should be fine on ppc64
646 */
647#define HAVE_ARCH_PIO_SIZE 1
648#define PIO_OFFSET 0x00000000UL
649#define PIO_MASK 0x3fffffffUL
650#define PIO_RESERVED 0x40000000UL
651
652#define mmio_read16be(addr) readw_be(addr)
653#define mmio_read32be(addr) readl_be(addr)
654#define mmio_write16be(val, addr) writew_be(val, addr)
655#define mmio_write32be(val, addr) writel_be(val, addr)
656#define mmio_insb(addr, dst, count) readsb(addr, dst, count)
657#define mmio_insw(addr, dst, count) readsw(addr, dst, count)
658#define mmio_insl(addr, dst, count) readsl(addr, dst, count)
659#define mmio_outsb(addr, src, count) writesb(addr, src, count)
660#define mmio_outsw(addr, src, count) writesw(addr, src, count)
661#define mmio_outsl(addr, src, count) writesl(addr, src, count)
662
211/** 663/**
212 * virt_to_phys - map virtual addresses to physical 664 * virt_to_phys - map virtual addresses to physical
213 * @address: address to remap 665 * @address: address to remap
@@ -254,178 +706,33 @@ static inline void * phys_to_virt(unsigned long address)
254 */ 706 */
255#define BIO_VMERGE_BOUNDARY 0 707#define BIO_VMERGE_BOUNDARY 0
256 708
257static inline void iosync(void)
258{
259 __asm__ __volatile__ ("sync" : : : "memory");
260}
261
262/* Enforce in-order execution of data I/O.
263 * No distinction between read/write on PPC; use eieio for all three.
264 */
265#define iobarrier_rw() eieio()
266#define iobarrier_r() eieio()
267#define iobarrier_w() eieio()
268
269/* 709/*
270 * 8, 16 and 32 bit, big and little endian I/O operations, with barrier. 710 * 32 bits still uses virt_to_bus() for it's implementation of DMA
271 * These routines do not perform EEH-related I/O address translation, 711 * mappings se we have to keep it defined here. We also have some old
272 * and should not be used directly by device drivers. Use inb/readb 712 * drivers (shame shame shame) that use bus_to_virt() and haven't been
273 * instead. 713 * fixed yet so I need to define it here.
274 */ 714 */
275static inline int __in_8(const volatile unsigned char __iomem *addr) 715#ifdef CONFIG_PPC32
276{
277 int ret;
278 716
279 __asm__ __volatile__("sync; lbz%U1%X1 %0,%1; twi 0,%0,0; isync" 717static inline unsigned long virt_to_bus(volatile void * address)
280 : "=r" (ret) : "m" (*addr));
281 return ret;
282}
283
284static inline void __out_8(volatile unsigned char __iomem *addr, int val)
285{
286 __asm__ __volatile__("sync; stb%U0%X0 %1,%0"
287 : "=m" (*addr) : "r" (val));
288 get_paca()->io_sync = 1;
289}
290
291static inline int __in_le16(const volatile unsigned short __iomem *addr)
292{ 718{
293 int ret; 719 if (address == NULL)
294 720 return 0;
295 __asm__ __volatile__("sync; lhbrx %0,0,%1; twi 0,%0,0; isync" 721 return __pa(address) + PCI_DRAM_OFFSET;
296 : "=r" (ret) : "r" (addr), "m" (*addr));
297 return ret;
298} 722}
299 723
300static inline int __in_be16(const volatile unsigned short __iomem *addr) 724static inline void * bus_to_virt(unsigned long address)
301{ 725{
302 int ret; 726 if (address == 0)
303 727 return NULL;
304 __asm__ __volatile__("sync; lhz%U1%X1 %0,%1; twi 0,%0,0; isync" 728 return __va(address - PCI_DRAM_OFFSET);
305 : "=r" (ret) : "m" (*addr));
306 return ret;
307} 729}
308 730
309static inline void __out_le16(volatile unsigned short __iomem *addr, int val) 731#define page_to_bus(page) (page_to_phys(page) + PCI_DRAM_OFFSET)
310{
311 __asm__ __volatile__("sync; sthbrx %1,0,%2"
312 : "=m" (*addr) : "r" (val), "r" (addr));
313 get_paca()->io_sync = 1;
314}
315
316static inline void __out_be16(volatile unsigned short __iomem *addr, int val)
317{
318 __asm__ __volatile__("sync; sth%U0%X0 %1,%0"
319 : "=m" (*addr) : "r" (val));
320 get_paca()->io_sync = 1;
321}
322
323static inline unsigned __in_le32(const volatile unsigned __iomem *addr)
324{
325 unsigned ret;
326
327 __asm__ __volatile__("sync; lwbrx %0,0,%1; twi 0,%0,0; isync"
328 : "=r" (ret) : "r" (addr), "m" (*addr));
329 return ret;
330}
331 732
332static inline unsigned __in_be32(const volatile unsigned __iomem *addr) 733#endif /* CONFIG_PPC32 */
333{
334 unsigned ret;
335
336 __asm__ __volatile__("sync; lwz%U1%X1 %0,%1; twi 0,%0,0; isync"
337 : "=r" (ret) : "m" (*addr));
338 return ret;
339}
340
341static inline void __out_le32(volatile unsigned __iomem *addr, int val)
342{
343 __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr)
344 : "r" (val), "r" (addr));
345 get_paca()->io_sync = 1;
346}
347
348static inline void __out_be32(volatile unsigned __iomem *addr, int val)
349{
350 __asm__ __volatile__("sync; stw%U0%X0 %1,%0"
351 : "=m" (*addr) : "r" (val));
352 get_paca()->io_sync = 1;
353}
354
355static inline unsigned long __in_le64(const volatile unsigned long __iomem *addr)
356{
357 unsigned long tmp, ret;
358
359 __asm__ __volatile__(
360 "sync\n"
361 "ld %1,0(%2)\n"
362 "twi 0,%1,0\n"
363 "isync\n"
364 "rldimi %0,%1,5*8,1*8\n"
365 "rldimi %0,%1,3*8,2*8\n"
366 "rldimi %0,%1,1*8,3*8\n"
367 "rldimi %0,%1,7*8,4*8\n"
368 "rldicl %1,%1,32,0\n"
369 "rlwimi %0,%1,8,8,31\n"
370 "rlwimi %0,%1,24,16,23\n"
371 : "=r" (ret) , "=r" (tmp) : "b" (addr) , "m" (*addr));
372 return ret;
373}
374
375static inline unsigned long __in_be64(const volatile unsigned long __iomem *addr)
376{
377 unsigned long ret;
378 734
379 __asm__ __volatile__("sync; ld%U1%X1 %0,%1; twi 0,%0,0; isync"
380 : "=r" (ret) : "m" (*addr));
381 return ret;
382}
383
384static inline void __out_le64(volatile unsigned long __iomem *addr, unsigned long val)
385{
386 unsigned long tmp;
387
388 __asm__ __volatile__(
389 "rldimi %0,%1,5*8,1*8\n"
390 "rldimi %0,%1,3*8,2*8\n"
391 "rldimi %0,%1,1*8,3*8\n"
392 "rldimi %0,%1,7*8,4*8\n"
393 "rldicl %1,%1,32,0\n"
394 "rlwimi %0,%1,8,8,31\n"
395 "rlwimi %0,%1,24,16,23\n"
396 "sync\n"
397 "std %0,0(%3)"
398 : "=&r" (tmp) , "=&r" (val) : "1" (val) , "b" (addr) , "m" (*addr));
399 get_paca()->io_sync = 1;
400}
401
402static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned long val)
403{
404 __asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
405 get_paca()->io_sync = 1;
406}
407
408#include <asm/eeh.h>
409
410/* Nothing to do */
411
412#define dma_cache_inv(_start,_size) do { } while (0)
413#define dma_cache_wback(_start,_size) do { } while (0)
414#define dma_cache_wback_inv(_start,_size) do { } while (0)
415
416
417/*
418 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
419 * access
420 */
421#define xlate_dev_mem_ptr(p) __va(p)
422
423/*
424 * Convert a virtual cached pointer to an uncached pointer
425 */
426#define xlate_dev_kmem_ptr(p) p
427 735
428#endif /* __KERNEL__ */ 736#endif /* __KERNEL__ */
429 737
430#endif /* CONFIG_PPC64 */
431#endif /* _ASM_POWERPC_IO_H */ 738#endif /* _ASM_POWERPC_IO_H */
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index 39fad685ffab..f85dbd305558 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -34,7 +34,9 @@
34#define IOMMU_PAGE_MASK (~((1 << IOMMU_PAGE_SHIFT) - 1)) 34#define IOMMU_PAGE_MASK (~((1 << IOMMU_PAGE_SHIFT) - 1))
35#define IOMMU_PAGE_ALIGN(addr) _ALIGN_UP(addr, IOMMU_PAGE_SIZE) 35#define IOMMU_PAGE_ALIGN(addr) _ALIGN_UP(addr, IOMMU_PAGE_SIZE)
36 36
37#ifndef __ASSEMBLY__ 37/* Boot time flags */
38extern int iommu_is_off;
39extern int iommu_force_on;
38 40
39/* Pure 2^n version of get_order */ 41/* Pure 2^n version of get_order */
40static __inline__ __attribute_const__ int get_iommu_order(unsigned long size) 42static __inline__ __attribute_const__ int get_iommu_order(unsigned long size)
@@ -42,8 +44,6 @@ static __inline__ __attribute_const__ int get_iommu_order(unsigned long size)
42 return __ilog2((size - 1) >> IOMMU_PAGE_SHIFT) + 1; 44 return __ilog2((size - 1) >> IOMMU_PAGE_SHIFT) + 1;
43} 45}
44 46
45#endif /* __ASSEMBLY__ */
46
47 47
48/* 48/*
49 * IOMAP_MAX_ORDER defines the largest contiguous block 49 * IOMAP_MAX_ORDER defines the largest contiguous block
@@ -70,39 +70,31 @@ struct iommu_table {
70struct scatterlist; 70struct scatterlist;
71struct device_node; 71struct device_node;
72 72
73#ifdef CONFIG_PPC_MULTIPLATFORM
74
75/* Walks all buses and creates iommu tables */
76extern void iommu_setup_pSeries(void);
77extern void iommu_setup_dart(void);
78
79/* Frees table for an individual device node */ 73/* Frees table for an individual device node */
80extern void iommu_free_table(struct device_node *dn); 74extern void iommu_free_table(struct device_node *dn);
81 75
82#endif /* CONFIG_PPC_MULTIPLATFORM */
83
84/* Initializes an iommu_table based in values set in the passed-in 76/* Initializes an iommu_table based in values set in the passed-in
85 * structure 77 * structure
86 */ 78 */
87extern struct iommu_table *iommu_init_table(struct iommu_table * tbl, 79extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
88 int nid); 80 int nid);
89 81
90extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, 82extern int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
91 struct scatterlist *sglist, int nelems, unsigned long mask, 83 int nelems, unsigned long mask,
92 enum dma_data_direction direction); 84 enum dma_data_direction direction);
93extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, 85extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
94 int nelems, enum dma_data_direction direction); 86 int nelems, enum dma_data_direction direction);
95 87
96extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size, 88extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
97 dma_addr_t *dma_handle, unsigned long mask, 89 dma_addr_t *dma_handle, unsigned long mask,
98 gfp_t flag, int node); 90 gfp_t flag, int node);
99extern void iommu_free_coherent(struct iommu_table *tbl, size_t size, 91extern void iommu_free_coherent(struct iommu_table *tbl, size_t size,
100 void *vaddr, dma_addr_t dma_handle); 92 void *vaddr, dma_addr_t dma_handle);
101extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr, 93extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
102 size_t size, unsigned long mask, 94 size_t size, unsigned long mask,
103 enum dma_data_direction direction); 95 enum dma_data_direction direction);
104extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, 96extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
105 size_t size, enum dma_data_direction direction); 97 size_t size, enum dma_data_direction direction);
106 98
107extern void iommu_init_early_pSeries(void); 99extern void iommu_init_early_pSeries(void);
108extern void iommu_init_early_iSeries(void); 100extern void iommu_init_early_iSeries(void);
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index f960f5346f40..46476e9a494a 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -135,6 +135,10 @@ struct irq_map_entry {
135 135
136extern struct irq_map_entry irq_map[NR_IRQS]; 136extern struct irq_map_entry irq_map[NR_IRQS];
137 137
138static inline irq_hw_number_t virq_to_hw(unsigned int virq)
139{
140 return irq_map[virq].hwirq;
141}
138 142
139/** 143/**
140 * irq_alloc_host - Allocate a new irq_host data structure 144 * irq_alloc_host - Allocate a new irq_host data structure
diff --git a/include/asm-powerpc/iseries/iommu.h b/include/asm-powerpc/iseries/iommu.h
index 0edbfe10cb37..6e323a13ac30 100644
--- a/include/asm-powerpc/iseries/iommu.h
+++ b/include/asm-powerpc/iseries/iommu.h
@@ -21,11 +21,13 @@
21 * Boston, MA 02111-1307 USA 21 * Boston, MA 02111-1307 USA
22 */ 22 */
23 23
24struct pci_dev;
24struct device_node; 25struct device_node;
25struct iommu_table; 26struct iommu_table;
26 27
27/* Creates table for an individual device node */ 28/* Creates table for an individual device node */
28extern void iommu_devnode_init_iSeries(struct device_node *dn); 29extern void iommu_devnode_init_iSeries(struct pci_dev *pdev,
30 struct device_node *dn);
29 31
30/* Get table parameters from HV */ 32/* Get table parameters from HV */
31extern void iommu_table_getparms_iSeries(unsigned long busno, 33extern void iommu_table_getparms_iSeries(unsigned long busno,
diff --git a/include/asm-powerpc/lv1call.h b/include/asm-powerpc/lv1call.h
new file mode 100644
index 000000000000..f733beeea63a
--- /dev/null
+++ b/include/asm-powerpc/lv1call.h
@@ -0,0 +1,345 @@
1/*
2 * PS3 hvcall interface.
3 *
4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp.
6 * Copyright 2003, 2004 (c) 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 as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#if !defined(_ASM_POWERPC_LV1CALL_H)
23#define _ASM_POWERPC_LV1CALL_H
24
25#if !defined(__ASSEMBLY__)
26
27#include <linux/types.h>
28
29/* lv1 call declaration macros */
30
31#define LV1_1_IN_ARG_DECL u64 in_1
32#define LV1_2_IN_ARG_DECL LV1_1_IN_ARG_DECL, u64 in_2
33#define LV1_3_IN_ARG_DECL LV1_2_IN_ARG_DECL, u64 in_3
34#define LV1_4_IN_ARG_DECL LV1_3_IN_ARG_DECL, u64 in_4
35#define LV1_5_IN_ARG_DECL LV1_4_IN_ARG_DECL, u64 in_5
36#define LV1_6_IN_ARG_DECL LV1_5_IN_ARG_DECL, u64 in_6
37#define LV1_7_IN_ARG_DECL LV1_6_IN_ARG_DECL, u64 in_7
38#define LV1_8_IN_ARG_DECL LV1_7_IN_ARG_DECL, u64 in_8
39#define LV1_1_OUT_ARG_DECL u64 *out_1
40#define LV1_2_OUT_ARG_DECL LV1_1_OUT_ARG_DECL, u64 *out_2
41#define LV1_3_OUT_ARG_DECL LV1_2_OUT_ARG_DECL, u64 *out_3
42#define LV1_4_OUT_ARG_DECL LV1_3_OUT_ARG_DECL, u64 *out_4
43#define LV1_5_OUT_ARG_DECL LV1_4_OUT_ARG_DECL, u64 *out_5
44#define LV1_6_OUT_ARG_DECL LV1_5_OUT_ARG_DECL, u64 *out_6
45#define LV1_7_OUT_ARG_DECL LV1_6_OUT_ARG_DECL, u64 *out_7
46
47#define LV1_0_IN_0_OUT_ARG_DECL void
48#define LV1_1_IN_0_OUT_ARG_DECL LV1_1_IN_ARG_DECL
49#define LV1_2_IN_0_OUT_ARG_DECL LV1_2_IN_ARG_DECL
50#define LV1_3_IN_0_OUT_ARG_DECL LV1_3_IN_ARG_DECL
51#define LV1_4_IN_0_OUT_ARG_DECL LV1_4_IN_ARG_DECL
52#define LV1_5_IN_0_OUT_ARG_DECL LV1_5_IN_ARG_DECL
53#define LV1_6_IN_0_OUT_ARG_DECL LV1_6_IN_ARG_DECL
54#define LV1_7_IN_0_OUT_ARG_DECL LV1_7_IN_ARG_DECL
55
56#define LV1_0_IN_1_OUT_ARG_DECL LV1_1_OUT_ARG_DECL
57#define LV1_1_IN_1_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
58#define LV1_2_IN_1_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
59#define LV1_3_IN_1_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
60#define LV1_4_IN_1_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
61#define LV1_5_IN_1_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
62#define LV1_6_IN_1_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
63#define LV1_7_IN_1_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
64#define LV1_8_IN_1_OUT_ARG_DECL LV1_8_IN_ARG_DECL, LV1_1_OUT_ARG_DECL
65
66#define LV1_0_IN_2_OUT_ARG_DECL LV1_2_OUT_ARG_DECL
67#define LV1_1_IN_2_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
68#define LV1_2_IN_2_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
69#define LV1_3_IN_2_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
70#define LV1_4_IN_2_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
71#define LV1_5_IN_2_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
72#define LV1_6_IN_2_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
73#define LV1_7_IN_2_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_2_OUT_ARG_DECL
74
75#define LV1_0_IN_3_OUT_ARG_DECL LV1_3_OUT_ARG_DECL
76#define LV1_1_IN_3_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
77#define LV1_2_IN_3_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
78#define LV1_3_IN_3_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
79#define LV1_4_IN_3_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
80#define LV1_5_IN_3_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
81#define LV1_6_IN_3_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
82#define LV1_7_IN_3_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_3_OUT_ARG_DECL
83
84#define LV1_0_IN_4_OUT_ARG_DECL LV1_4_OUT_ARG_DECL
85#define LV1_1_IN_4_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
86#define LV1_2_IN_4_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
87#define LV1_3_IN_4_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
88#define LV1_4_IN_4_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
89#define LV1_5_IN_4_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
90#define LV1_6_IN_4_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
91#define LV1_7_IN_4_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_4_OUT_ARG_DECL
92
93#define LV1_0_IN_5_OUT_ARG_DECL LV1_5_OUT_ARG_DECL
94#define LV1_1_IN_5_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
95#define LV1_2_IN_5_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
96#define LV1_3_IN_5_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
97#define LV1_4_IN_5_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
98#define LV1_5_IN_5_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
99#define LV1_6_IN_5_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
100#define LV1_7_IN_5_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_5_OUT_ARG_DECL
101
102#define LV1_0_IN_6_OUT_ARG_DECL LV1_6_OUT_ARG_DECL
103#define LV1_1_IN_6_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
104#define LV1_2_IN_6_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
105#define LV1_3_IN_6_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
106#define LV1_4_IN_6_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
107#define LV1_5_IN_6_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
108#define LV1_6_IN_6_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
109#define LV1_7_IN_6_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_6_OUT_ARG_DECL
110
111#define LV1_0_IN_7_OUT_ARG_DECL LV1_7_OUT_ARG_DECL
112#define LV1_1_IN_7_OUT_ARG_DECL LV1_1_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
113#define LV1_2_IN_7_OUT_ARG_DECL LV1_2_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
114#define LV1_3_IN_7_OUT_ARG_DECL LV1_3_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
115#define LV1_4_IN_7_OUT_ARG_DECL LV1_4_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
116#define LV1_5_IN_7_OUT_ARG_DECL LV1_5_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
117#define LV1_6_IN_7_OUT_ARG_DECL LV1_6_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
118#define LV1_7_IN_7_OUT_ARG_DECL LV1_7_IN_ARG_DECL, LV1_7_OUT_ARG_DECL
119
120#define LV1_1_IN_ARGS in_1
121#define LV1_2_IN_ARGS LV1_1_IN_ARGS, in_2
122#define LV1_3_IN_ARGS LV1_2_IN_ARGS, in_3
123#define LV1_4_IN_ARGS LV1_3_IN_ARGS, in_4
124#define LV1_5_IN_ARGS LV1_4_IN_ARGS, in_5
125#define LV1_6_IN_ARGS LV1_5_IN_ARGS, in_6
126#define LV1_7_IN_ARGS LV1_6_IN_ARGS, in_7
127#define LV1_8_IN_ARGS LV1_7_IN_ARGS, in_8
128
129#define LV1_1_OUT_ARGS out_1
130#define LV1_2_OUT_ARGS LV1_1_OUT_ARGS, out_2
131#define LV1_3_OUT_ARGS LV1_2_OUT_ARGS, out_3
132#define LV1_4_OUT_ARGS LV1_3_OUT_ARGS, out_4
133#define LV1_5_OUT_ARGS LV1_4_OUT_ARGS, out_5
134#define LV1_6_OUT_ARGS LV1_5_OUT_ARGS, out_6
135#define LV1_7_OUT_ARGS LV1_6_OUT_ARGS, out_7
136
137#define LV1_0_IN_0_OUT_ARGS
138#define LV1_1_IN_0_OUT_ARGS LV1_1_IN_ARGS
139#define LV1_2_IN_0_OUT_ARGS LV1_2_IN_ARGS
140#define LV1_3_IN_0_OUT_ARGS LV1_3_IN_ARGS
141#define LV1_4_IN_0_OUT_ARGS LV1_4_IN_ARGS
142#define LV1_5_IN_0_OUT_ARGS LV1_5_IN_ARGS
143#define LV1_6_IN_0_OUT_ARGS LV1_6_IN_ARGS
144#define LV1_7_IN_0_OUT_ARGS LV1_7_IN_ARGS
145
146#define LV1_0_IN_1_OUT_ARGS LV1_1_OUT_ARGS
147#define LV1_1_IN_1_OUT_ARGS LV1_1_IN_ARGS, LV1_1_OUT_ARGS
148#define LV1_2_IN_1_OUT_ARGS LV1_2_IN_ARGS, LV1_1_OUT_ARGS
149#define LV1_3_IN_1_OUT_ARGS LV1_3_IN_ARGS, LV1_1_OUT_ARGS
150#define LV1_4_IN_1_OUT_ARGS LV1_4_IN_ARGS, LV1_1_OUT_ARGS
151#define LV1_5_IN_1_OUT_ARGS LV1_5_IN_ARGS, LV1_1_OUT_ARGS
152#define LV1_6_IN_1_OUT_ARGS LV1_6_IN_ARGS, LV1_1_OUT_ARGS
153#define LV1_7_IN_1_OUT_ARGS LV1_7_IN_ARGS, LV1_1_OUT_ARGS
154#define LV1_8_IN_1_OUT_ARGS LV1_8_IN_ARGS, LV1_1_OUT_ARGS
155
156#define LV1_0_IN_2_OUT_ARGS LV1_2_OUT_ARGS
157#define LV1_1_IN_2_OUT_ARGS LV1_1_IN_ARGS, LV1_2_OUT_ARGS
158#define LV1_2_IN_2_OUT_ARGS LV1_2_IN_ARGS, LV1_2_OUT_ARGS
159#define LV1_3_IN_2_OUT_ARGS LV1_3_IN_ARGS, LV1_2_OUT_ARGS
160#define LV1_4_IN_2_OUT_ARGS LV1_4_IN_ARGS, LV1_2_OUT_ARGS
161#define LV1_5_IN_2_OUT_ARGS LV1_5_IN_ARGS, LV1_2_OUT_ARGS
162#define LV1_6_IN_2_OUT_ARGS LV1_6_IN_ARGS, LV1_2_OUT_ARGS
163#define LV1_7_IN_2_OUT_ARGS LV1_7_IN_ARGS, LV1_2_OUT_ARGS
164
165#define LV1_0_IN_3_OUT_ARGS LV1_3_OUT_ARGS
166#define LV1_1_IN_3_OUT_ARGS LV1_1_IN_ARGS, LV1_3_OUT_ARGS
167#define LV1_2_IN_3_OUT_ARGS LV1_2_IN_ARGS, LV1_3_OUT_ARGS
168#define LV1_3_IN_3_OUT_ARGS LV1_3_IN_ARGS, LV1_3_OUT_ARGS
169#define LV1_4_IN_3_OUT_ARGS LV1_4_IN_ARGS, LV1_3_OUT_ARGS
170#define LV1_5_IN_3_OUT_ARGS LV1_5_IN_ARGS, LV1_3_OUT_ARGS
171#define LV1_6_IN_3_OUT_ARGS LV1_6_IN_ARGS, LV1_3_OUT_ARGS
172#define LV1_7_IN_3_OUT_ARGS LV1_7_IN_ARGS, LV1_3_OUT_ARGS
173
174#define LV1_0_IN_4_OUT_ARGS LV1_4_OUT_ARGS
175#define LV1_1_IN_4_OUT_ARGS LV1_1_IN_ARGS, LV1_4_OUT_ARGS
176#define LV1_2_IN_4_OUT_ARGS LV1_2_IN_ARGS, LV1_4_OUT_ARGS
177#define LV1_3_IN_4_OUT_ARGS LV1_3_IN_ARGS, LV1_4_OUT_ARGS
178#define LV1_4_IN_4_OUT_ARGS LV1_4_IN_ARGS, LV1_4_OUT_ARGS
179#define LV1_5_IN_4_OUT_ARGS LV1_5_IN_ARGS, LV1_4_OUT_ARGS
180#define LV1_6_IN_4_OUT_ARGS LV1_6_IN_ARGS, LV1_4_OUT_ARGS
181#define LV1_7_IN_4_OUT_ARGS LV1_7_IN_ARGS, LV1_4_OUT_ARGS
182
183#define LV1_0_IN_5_OUT_ARGS LV1_5_OUT_ARGS
184#define LV1_1_IN_5_OUT_ARGS LV1_1_IN_ARGS, LV1_5_OUT_ARGS
185#define LV1_2_IN_5_OUT_ARGS LV1_2_IN_ARGS, LV1_5_OUT_ARGS
186#define LV1_3_IN_5_OUT_ARGS LV1_3_IN_ARGS, LV1_5_OUT_ARGS
187#define LV1_4_IN_5_OUT_ARGS LV1_4_IN_ARGS, LV1_5_OUT_ARGS
188#define LV1_5_IN_5_OUT_ARGS LV1_5_IN_ARGS, LV1_5_OUT_ARGS
189#define LV1_6_IN_5_OUT_ARGS LV1_6_IN_ARGS, LV1_5_OUT_ARGS
190#define LV1_7_IN_5_OUT_ARGS LV1_7_IN_ARGS, LV1_5_OUT_ARGS
191
192#define LV1_0_IN_6_OUT_ARGS LV1_6_OUT_ARGS
193#define LV1_1_IN_6_OUT_ARGS LV1_1_IN_ARGS, LV1_6_OUT_ARGS
194#define LV1_2_IN_6_OUT_ARGS LV1_2_IN_ARGS, LV1_6_OUT_ARGS
195#define LV1_3_IN_6_OUT_ARGS LV1_3_IN_ARGS, LV1_6_OUT_ARGS
196#define LV1_4_IN_6_OUT_ARGS LV1_4_IN_ARGS, LV1_6_OUT_ARGS
197#define LV1_5_IN_6_OUT_ARGS LV1_5_IN_ARGS, LV1_6_OUT_ARGS
198#define LV1_6_IN_6_OUT_ARGS LV1_6_IN_ARGS, LV1_6_OUT_ARGS
199#define LV1_7_IN_6_OUT_ARGS LV1_7_IN_ARGS, LV1_6_OUT_ARGS
200
201#define LV1_0_IN_7_OUT_ARGS LV1_7_OUT_ARGS
202#define LV1_1_IN_7_OUT_ARGS LV1_1_IN_ARGS, LV1_7_OUT_ARGS
203#define LV1_2_IN_7_OUT_ARGS LV1_2_IN_ARGS, LV1_7_OUT_ARGS
204#define LV1_3_IN_7_OUT_ARGS LV1_3_IN_ARGS, LV1_7_OUT_ARGS
205#define LV1_4_IN_7_OUT_ARGS LV1_4_IN_ARGS, LV1_7_OUT_ARGS
206#define LV1_5_IN_7_OUT_ARGS LV1_5_IN_ARGS, LV1_7_OUT_ARGS
207#define LV1_6_IN_7_OUT_ARGS LV1_6_IN_ARGS, LV1_7_OUT_ARGS
208#define LV1_7_IN_7_OUT_ARGS LV1_7_IN_ARGS, LV1_7_OUT_ARGS
209
210/*
211 * This LV1_CALL() macro is for use by callers. It expands into an
212 * inline call wrapper and an underscored HV call declaration. The
213 * wrapper can be used to instrument the lv1 call interface. The
214 * file lv1call.S defines its own LV1_CALL() macro to expand into
215 * the actual underscored call definition.
216 */
217
218#if !defined(LV1_CALL)
219#define LV1_CALL(name, in, out, num) \
220 extern s64 _lv1_##name(LV1_##in##_IN_##out##_OUT_ARG_DECL); \
221 static inline int lv1_##name(LV1_##in##_IN_##out##_OUT_ARG_DECL) \
222 {return _lv1_##name(LV1_##in##_IN_##out##_OUT_ARGS);}
223#endif
224
225#endif /* !defined(__ASSEMBLY__) */
226
227/* lv1 call table */
228
229LV1_CALL(allocate_memory, 4, 2, 0 )
230LV1_CALL(write_htab_entry, 4, 0, 1 )
231LV1_CALL(construct_virtual_address_space, 3, 2, 2 )
232LV1_CALL(invalidate_htab_entries, 5, 0, 3 )
233LV1_CALL(get_virtual_address_space_id_of_ppe, 1, 1, 4 )
234LV1_CALL(query_logical_partition_address_region_info, 1, 5, 6 )
235LV1_CALL(select_virtual_address_space, 1, 0, 7 )
236LV1_CALL(pause, 1, 0, 9 )
237LV1_CALL(destruct_virtual_address_space, 1, 0, 10 )
238LV1_CALL(configure_irq_state_bitmap, 3, 0, 11 )
239LV1_CALL(connect_irq_plug_ext, 5, 0, 12 )
240LV1_CALL(release_memory, 1, 0, 13 )
241LV1_CALL(disconnect_irq_plug_ext, 3, 0, 17 )
242LV1_CALL(construct_event_receive_port, 0, 1, 18 )
243LV1_CALL(destruct_event_receive_port, 1, 0, 19 )
244LV1_CALL(send_event_locally, 1, 0, 24 )
245LV1_CALL(end_of_interrupt, 1, 0, 27 )
246LV1_CALL(connect_irq_plug, 2, 0, 28 )
247LV1_CALL(disconnect_irq_plug, 1, 0, 29 )
248LV1_CALL(end_of_interrupt_ext, 3, 0, 30 )
249LV1_CALL(did_update_interrupt_mask, 2, 0, 31 )
250LV1_CALL(shutdown_logical_partition, 1, 0, 44 )
251LV1_CALL(destruct_logical_spe, 1, 0, 54 )
252LV1_CALL(construct_logical_spe, 7, 6, 57 )
253LV1_CALL(set_spe_interrupt_mask, 3, 0, 61 )
254LV1_CALL(set_spe_transition_notifier, 3, 0, 64 )
255LV1_CALL(disable_logical_spe, 2, 0, 65 )
256LV1_CALL(clear_spe_interrupt_status, 4, 0, 66 )
257LV1_CALL(get_spe_interrupt_status, 2, 1, 67 )
258LV1_CALL(get_logical_ppe_id, 0, 1, 69 )
259LV1_CALL(set_interrupt_mask, 5, 0, 73 )
260LV1_CALL(get_logical_partition_id, 0, 1, 74 )
261LV1_CALL(configure_execution_time_variable, 1, 0, 77 )
262LV1_CALL(get_spe_irq_outlet, 2, 1, 78 )
263LV1_CALL(set_spe_privilege_state_area_1_register, 3, 0, 79 )
264LV1_CALL(create_repository_node, 6, 0, 90 )
265LV1_CALL(get_repository_node_value, 5, 2, 91 )
266LV1_CALL(modify_repository_node_value, 6, 0, 92 )
267LV1_CALL(remove_repository_node, 4, 0, 93 )
268LV1_CALL(read_htab_entries, 2, 5, 95 )
269LV1_CALL(set_dabr, 2, 0, 96 )
270LV1_CALL(get_total_execution_time, 2, 1, 103 )
271LV1_CALL(construct_io_irq_outlet, 1, 1, 120 )
272LV1_CALL(destruct_io_irq_outlet, 1, 0, 121 )
273LV1_CALL(map_htab, 1, 1, 122 )
274LV1_CALL(unmap_htab, 1, 0, 123 )
275LV1_CALL(get_version_info, 0, 1, 127 )
276LV1_CALL(insert_htab_entry, 6, 3, 158 )
277LV1_CALL(read_virtual_uart, 3, 1, 162 )
278LV1_CALL(write_virtual_uart, 3, 1, 163 )
279LV1_CALL(set_virtual_uart_param, 3, 0, 164 )
280LV1_CALL(get_virtual_uart_param, 2, 1, 165 )
281LV1_CALL(configure_virtual_uart_irq, 1, 1, 166 )
282LV1_CALL(open_device, 3, 0, 170 )
283LV1_CALL(close_device, 2, 0, 171 )
284LV1_CALL(map_device_mmio_region, 5, 1, 172 )
285LV1_CALL(unmap_device_mmio_region, 3, 0, 173 )
286LV1_CALL(allocate_device_dma_region, 5, 1, 174 )
287LV1_CALL(free_device_dma_region, 3, 0, 175 )
288LV1_CALL(map_device_dma_region, 6, 0, 176 )
289LV1_CALL(unmap_device_dma_region, 4, 0, 177 )
290LV1_CALL(net_add_multicast_address, 4, 0, 185 )
291LV1_CALL(net_remove_multicast_address, 4, 0, 186 )
292LV1_CALL(net_start_tx_dma, 4, 0, 187 )
293LV1_CALL(net_stop_tx_dma, 3, 0, 188 )
294LV1_CALL(net_start_rx_dma, 4, 0, 189 )
295LV1_CALL(net_stop_rx_dma, 3, 0, 190 )
296LV1_CALL(net_set_interrupt_status_indicator, 4, 0, 191 )
297LV1_CALL(net_set_interrupt_mask, 4, 0, 193 )
298LV1_CALL(net_control, 6, 2, 194 )
299LV1_CALL(connect_interrupt_event_receive_port, 4, 0, 197 )
300LV1_CALL(disconnect_interrupt_event_receive_port, 4, 0, 198 )
301LV1_CALL(get_spe_all_interrupt_statuses, 1, 1, 199 )
302LV1_CALL(deconfigure_virtual_uart_irq, 0, 0, 202 )
303LV1_CALL(enable_logical_spe, 2, 0, 207 )
304LV1_CALL(gpu_open, 1, 0, 210 )
305LV1_CALL(gpu_close, 0, 0, 211 )
306LV1_CALL(gpu_device_map, 1, 2, 212 )
307LV1_CALL(gpu_device_unmap, 1, 0, 213 )
308LV1_CALL(gpu_memory_allocate, 5, 2, 214 )
309LV1_CALL(gpu_memory_free, 1, 0, 216 )
310LV1_CALL(gpu_context_allocate, 2, 5, 217 )
311LV1_CALL(gpu_context_free, 1, 0, 218 )
312LV1_CALL(gpu_context_iomap, 5, 0, 221 )
313LV1_CALL(gpu_context_attribute, 6, 0, 225 )
314LV1_CALL(gpu_context_intr, 1, 1, 227 )
315LV1_CALL(gpu_attribute, 5, 0, 228 )
316LV1_CALL(get_rtc, 0, 2, 232 )
317LV1_CALL(set_ppe_periodic_tracer_frequency, 1, 0, 240 )
318LV1_CALL(start_ppe_periodic_tracer, 5, 0, 241 )
319LV1_CALL(stop_ppe_periodic_tracer, 1, 1, 242 )
320LV1_CALL(storage_read, 6, 1, 245 )
321LV1_CALL(storage_write, 6, 1, 246 )
322LV1_CALL(storage_send_device_command, 6, 1, 248 )
323LV1_CALL(storage_get_async_status, 1, 2, 249 )
324LV1_CALL(storage_check_async_status, 2, 1, 254 )
325LV1_CALL(panic, 1, 0, 255 )
326LV1_CALL(construct_lpm, 6, 3, 140 )
327LV1_CALL(destruct_lpm, 1, 0, 141 )
328LV1_CALL(start_lpm, 1, 0, 142 )
329LV1_CALL(stop_lpm, 1, 1, 143 )
330LV1_CALL(copy_lpm_trace_buffer, 3, 1, 144 )
331LV1_CALL(add_lpm_event_bookmark, 5, 0, 145 )
332LV1_CALL(delete_lpm_event_bookmark, 3, 0, 146 )
333LV1_CALL(set_lpm_interrupt_mask, 3, 1, 147 )
334LV1_CALL(get_lpm_interrupt_status, 1, 1, 148 )
335LV1_CALL(set_lpm_general_control, 5, 2, 149 )
336LV1_CALL(set_lpm_interval, 3, 1, 150 )
337LV1_CALL(set_lpm_trigger_control, 3, 1, 151 )
338LV1_CALL(set_lpm_counter_control, 4, 1, 152 )
339LV1_CALL(set_lpm_group_control, 3, 1, 153 )
340LV1_CALL(set_lpm_debug_bus_control, 3, 1, 154 )
341LV1_CALL(set_lpm_counter, 5, 2, 155 )
342LV1_CALL(set_lpm_signal, 7, 0, 156 )
343LV1_CALL(set_lpm_spr_trigger, 2, 0, 157 )
344
345#endif
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index dac90dc341cb..1b04e5723548 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -26,6 +26,7 @@ struct device_node;
26struct iommu_table; 26struct iommu_table;
27struct rtc_time; 27struct rtc_time;
28struct file; 28struct file;
29struct pci_controller;
29#ifdef CONFIG_KEXEC 30#ifdef CONFIG_KEXEC
30struct kimage; 31struct kimage;
31#endif 32#endif
@@ -84,9 +85,12 @@ struct machdep_calls {
84 unsigned long (*tce_get)(struct iommu_table *tbl, 85 unsigned long (*tce_get)(struct iommu_table *tbl,
85 long index); 86 long index);
86 void (*tce_flush)(struct iommu_table *tbl); 87 void (*tce_flush)(struct iommu_table *tbl);
87 void (*iommu_dev_setup)(struct pci_dev *dev); 88 void (*pci_dma_dev_setup)(struct pci_dev *dev);
88 void (*iommu_bus_setup)(struct pci_bus *bus); 89 void (*pci_dma_bus_setup)(struct pci_bus *bus);
89 void (*irq_bus_setup)(struct pci_bus *bus); 90
91 void __iomem * (*ioremap)(phys_addr_t addr, unsigned long size,
92 unsigned long flags);
93 void (*iounmap)(volatile void __iomem *token);
90#endif /* CONFIG_PPC64 */ 94#endif /* CONFIG_PPC64 */
91 95
92 int (*probe)(void); 96 int (*probe)(void);
@@ -106,6 +110,10 @@ struct machdep_calls {
106 /* Called after scanning the bus, before allocating resources */ 110 /* Called after scanning the bus, before allocating resources */
107 void (*pcibios_fixup)(void); 111 void (*pcibios_fixup)(void);
108 int (*pci_probe_mode)(struct pci_bus *); 112 int (*pci_probe_mode)(struct pci_bus *);
113 void (*pci_irq_fixup)(struct pci_dev *dev);
114
115 /* To setup PHBs when using automatic OF platform driver for PCI */
116 int (*pci_setup_phb)(struct pci_controller *host);
109 117
110 void (*restart)(char *cmd); 118 void (*restart)(char *cmd);
111 void (*power_off)(void); 119 void (*power_off)(void);
@@ -199,10 +207,6 @@ struct machdep_calls {
199 * Returns 0 to allow assignment/enabling of the device. */ 207 * Returns 0 to allow assignment/enabling of the device. */
200 int (*pcibios_enable_device_hook)(struct pci_dev *, int initial); 208 int (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
201 209
202 /* For interrupt routing */
203 unsigned char (*pci_swizzle)(struct pci_dev *, unsigned char *);
204 int (*pci_map_irq)(struct pci_dev *, unsigned char, unsigned char);
205
206 /* Called in indirect_* to avoid touching devices */ 210 /* Called in indirect_* to avoid touching devices */
207 int (*pci_exclude_device)(unsigned char, unsigned char); 211 int (*pci_exclude_device)(unsigned char, unsigned char);
208 212
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index c3fc7a28e3cd..41c8c9c5a254 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -248,21 +248,6 @@ extern void hpte_init_native(void);
248extern void hpte_init_lpar(void); 248extern void hpte_init_lpar(void);
249extern void hpte_init_iSeries(void); 249extern void hpte_init_iSeries(void);
250 250
251extern long pSeries_lpar_hpte_insert(unsigned long hpte_group,
252 unsigned long va, unsigned long prpn,
253 unsigned long rflags,
254 unsigned long vflags, int psize);
255
256extern long native_hpte_insert(unsigned long hpte_group,
257 unsigned long va, unsigned long prpn,
258 unsigned long rflags,
259 unsigned long vflags, int psize);
260
261extern long iSeries_hpte_insert(unsigned long hpte_group,
262 unsigned long va, unsigned long prpn,
263 unsigned long rflags,
264 unsigned long vflags, int psize);
265
266extern void stabs_alloc(void); 251extern void stabs_alloc(void);
267extern void slb_initialize(void); 252extern void slb_initialize(void);
268extern void slb_flush_and_rebolt(void); 253extern void slb_flush_and_rebolt(void);
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
new file mode 100644
index 000000000000..4a28a850998c
--- /dev/null
+++ b/include/asm-powerpc/mpc52xx.h
@@ -0,0 +1,254 @@
1/*
2 * Prototypes, etc. for the Freescale MPC52xx embedded cpu chips
3 * May need to be cleaned as the port goes on ...
4 *
5 * Copyright (C) 2004-2005 Sylvain Munaut <tnt@246tNt.com>
6 * Copyright (C) 2003 MontaVista, Software, Inc.
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 */
12
13#ifndef __ASM_POWERPC_MPC52xx_H__
14#define __ASM_POWERPC_MPC52xx_H__
15
16#ifndef __ASSEMBLY__
17#include <asm/types.h>
18#include <asm/prom.h>
19#endif /* __ASSEMBLY__ */
20
21
22/* ======================================================================== */
23/* Structures mapping of some unit register set */
24/* ======================================================================== */
25
26#ifndef __ASSEMBLY__
27
28/* Memory Mapping Control */
29struct mpc52xx_mmap_ctl {
30 u32 mbar; /* MMAP_CTRL + 0x00 */
31
32 u32 cs0_start; /* MMAP_CTRL + 0x04 */
33 u32 cs0_stop; /* MMAP_CTRL + 0x08 */
34 u32 cs1_start; /* MMAP_CTRL + 0x0c */
35 u32 cs1_stop; /* MMAP_CTRL + 0x10 */
36 u32 cs2_start; /* MMAP_CTRL + 0x14 */
37 u32 cs2_stop; /* MMAP_CTRL + 0x18 */
38 u32 cs3_start; /* MMAP_CTRL + 0x1c */
39 u32 cs3_stop; /* MMAP_CTRL + 0x20 */
40 u32 cs4_start; /* MMAP_CTRL + 0x24 */
41 u32 cs4_stop; /* MMAP_CTRL + 0x28 */
42 u32 cs5_start; /* MMAP_CTRL + 0x2c */
43 u32 cs5_stop; /* MMAP_CTRL + 0x30 */
44
45 u32 sdram0; /* MMAP_CTRL + 0x34 */
46 u32 sdram1; /* MMAP_CTRL + 0X38 */
47
48 u32 reserved[4]; /* MMAP_CTRL + 0x3c .. 0x48 */
49
50 u32 boot_start; /* MMAP_CTRL + 0x4c */
51 u32 boot_stop; /* MMAP_CTRL + 0x50 */
52
53 u32 ipbi_ws_ctrl; /* MMAP_CTRL + 0x54 */
54
55 u32 cs6_start; /* MMAP_CTRL + 0x58 */
56 u32 cs6_stop; /* MMAP_CTRL + 0x5c */
57 u32 cs7_start; /* MMAP_CTRL + 0x60 */
58 u32 cs7_stop; /* MMAP_CTRL + 0x64 */
59};
60
61/* SDRAM control */
62struct mpc52xx_sdram {
63 u32 mode; /* SDRAM + 0x00 */
64 u32 ctrl; /* SDRAM + 0x04 */
65 u32 config1; /* SDRAM + 0x08 */
66 u32 config2; /* SDRAM + 0x0c */
67};
68
69/* SDMA */
70struct mpc52xx_sdma {
71 u32 taskBar; /* SDMA + 0x00 */
72 u32 currentPointer; /* SDMA + 0x04 */
73 u32 endPointer; /* SDMA + 0x08 */
74 u32 variablePointer; /* SDMA + 0x0c */
75
76 u8 IntVect1; /* SDMA + 0x10 */
77 u8 IntVect2; /* SDMA + 0x11 */
78 u16 PtdCntrl; /* SDMA + 0x12 */
79
80 u32 IntPend; /* SDMA + 0x14 */
81 u32 IntMask; /* SDMA + 0x18 */
82
83 u16 tcr[16]; /* SDMA + 0x1c .. 0x3a */
84
85 u8 ipr[32]; /* SDMA + 0x3c .. 0x5b */
86
87 u32 cReqSelect; /* SDMA + 0x5c */
88 u32 task_size0; /* SDMA + 0x60 */
89 u32 task_size1; /* SDMA + 0x64 */
90 u32 MDEDebug; /* SDMA + 0x68 */
91 u32 ADSDebug; /* SDMA + 0x6c */
92 u32 Value1; /* SDMA + 0x70 */
93 u32 Value2; /* SDMA + 0x74 */
94 u32 Control; /* SDMA + 0x78 */
95 u32 Status; /* SDMA + 0x7c */
96 u32 PTDDebug; /* SDMA + 0x80 */
97};
98
99/* GPT */
100struct mpc52xx_gpt {
101 u32 mode; /* GPTx + 0x00 */
102 u32 count; /* GPTx + 0x04 */
103 u32 pwm; /* GPTx + 0x08 */
104 u32 status; /* GPTx + 0X0c */
105};
106
107/* GPIO */
108struct mpc52xx_gpio {
109 u32 port_config; /* GPIO + 0x00 */
110 u32 simple_gpioe; /* GPIO + 0x04 */
111 u32 simple_ode; /* GPIO + 0x08 */
112 u32 simple_ddr; /* GPIO + 0x0c */
113 u32 simple_dvo; /* GPIO + 0x10 */
114 u32 simple_ival; /* GPIO + 0x14 */
115 u8 outo_gpioe; /* GPIO + 0x18 */
116 u8 reserved1[3]; /* GPIO + 0x19 */
117 u8 outo_dvo; /* GPIO + 0x1c */
118 u8 reserved2[3]; /* GPIO + 0x1d */
119 u8 sint_gpioe; /* GPIO + 0x20 */
120 u8 reserved3[3]; /* GPIO + 0x21 */
121 u8 sint_ode; /* GPIO + 0x24 */
122 u8 reserved4[3]; /* GPIO + 0x25 */
123 u8 sint_ddr; /* GPIO + 0x28 */
124 u8 reserved5[3]; /* GPIO + 0x29 */
125 u8 sint_dvo; /* GPIO + 0x2c */
126 u8 reserved6[3]; /* GPIO + 0x2d */
127 u8 sint_inten; /* GPIO + 0x30 */
128 u8 reserved7[3]; /* GPIO + 0x31 */
129 u16 sint_itype; /* GPIO + 0x34 */
130 u16 reserved8; /* GPIO + 0x36 */
131 u8 gpio_control; /* GPIO + 0x38 */
132 u8 reserved9[3]; /* GPIO + 0x39 */
133 u8 sint_istat; /* GPIO + 0x3c */
134 u8 sint_ival; /* GPIO + 0x3d */
135 u8 bus_errs; /* GPIO + 0x3e */
136 u8 reserved10; /* GPIO + 0x3f */
137};
138
139#define MPC52xx_GPIO_PSC_CONFIG_UART_WITHOUT_CD 4
140#define MPC52xx_GPIO_PSC_CONFIG_UART_WITH_CD 5
141#define MPC52xx_GPIO_PCI_DIS (1<<15)
142
143/* GPIO with WakeUp*/
144struct mpc52xx_gpio_wkup {
145 u8 wkup_gpioe; /* GPIO_WKUP + 0x00 */
146 u8 reserved1[3]; /* GPIO_WKUP + 0x03 */
147 u8 wkup_ode; /* GPIO_WKUP + 0x04 */
148 u8 reserved2[3]; /* GPIO_WKUP + 0x05 */
149 u8 wkup_ddr; /* GPIO_WKUP + 0x08 */
150 u8 reserved3[3]; /* GPIO_WKUP + 0x09 */
151 u8 wkup_dvo; /* GPIO_WKUP + 0x0C */
152 u8 reserved4[3]; /* GPIO_WKUP + 0x0D */
153 u8 wkup_inten; /* GPIO_WKUP + 0x10 */
154 u8 reserved5[3]; /* GPIO_WKUP + 0x11 */
155 u8 wkup_iinten; /* GPIO_WKUP + 0x14 */
156 u8 reserved6[3]; /* GPIO_WKUP + 0x15 */
157 u16 wkup_itype; /* GPIO_WKUP + 0x18 */
158 u8 reserved7[2]; /* GPIO_WKUP + 0x1A */
159 u8 wkup_maste; /* GPIO_WKUP + 0x1C */
160 u8 reserved8[3]; /* GPIO_WKUP + 0x1D */
161 u8 wkup_ival; /* GPIO_WKUP + 0x20 */
162 u8 reserved9[3]; /* GPIO_WKUP + 0x21 */
163 u8 wkup_istat; /* GPIO_WKUP + 0x24 */
164 u8 reserved10[3]; /* GPIO_WKUP + 0x25 */
165};
166
167/* XLB Bus control */
168struct mpc52xx_xlb {
169 u8 reserved[0x40];
170 u32 config; /* XLB + 0x40 */
171 u32 version; /* XLB + 0x44 */
172 u32 status; /* XLB + 0x48 */
173 u32 int_enable; /* XLB + 0x4c */
174 u32 addr_capture; /* XLB + 0x50 */
175 u32 bus_sig_capture; /* XLB + 0x54 */
176 u32 addr_timeout; /* XLB + 0x58 */
177 u32 data_timeout; /* XLB + 0x5c */
178 u32 bus_act_timeout; /* XLB + 0x60 */
179 u32 master_pri_enable; /* XLB + 0x64 */
180 u32 master_priority; /* XLB + 0x68 */
181 u32 base_address; /* XLB + 0x6c */
182 u32 snoop_window; /* XLB + 0x70 */
183};
184
185#define MPC52xx_XLB_CFG_PLDIS (1 << 31)
186#define MPC52xx_XLB_CFG_SNOOP (1 << 15)
187
188/* Clock Distribution control */
189struct mpc52xx_cdm {
190 u32 jtag_id; /* CDM + 0x00 reg0 read only */
191 u32 rstcfg; /* CDM + 0x04 reg1 read only */
192 u32 breadcrumb; /* CDM + 0x08 reg2 */
193
194 u8 mem_clk_sel; /* CDM + 0x0c reg3 byte0 */
195 u8 xlb_clk_sel; /* CDM + 0x0d reg3 byte1 read only */
196 u8 ipb_clk_sel; /* CDM + 0x0e reg3 byte2 */
197 u8 pci_clk_sel; /* CDM + 0x0f reg3 byte3 */
198
199 u8 ext_48mhz_en; /* CDM + 0x10 reg4 byte0 */
200 u8 fd_enable; /* CDM + 0x11 reg4 byte1 */
201 u16 fd_counters; /* CDM + 0x12 reg4 byte2,3 */
202
203 u32 clk_enables; /* CDM + 0x14 reg5 */
204
205 u8 osc_disable; /* CDM + 0x18 reg6 byte0 */
206 u8 reserved0[3]; /* CDM + 0x19 reg6 byte1,2,3 */
207
208 u8 ccs_sleep_enable; /* CDM + 0x1c reg7 byte0 */
209 u8 osc_sleep_enable; /* CDM + 0x1d reg7 byte1 */
210 u8 reserved1; /* CDM + 0x1e reg7 byte2 */
211 u8 ccs_qreq_test; /* CDM + 0x1f reg7 byte3 */
212
213 u8 soft_reset; /* CDM + 0x20 u8 byte0 */
214 u8 no_ckstp; /* CDM + 0x21 u8 byte0 */
215 u8 reserved2[2]; /* CDM + 0x22 u8 byte1,2,3 */
216
217 u8 pll_lock; /* CDM + 0x24 reg9 byte0 */
218 u8 pll_looselock; /* CDM + 0x25 reg9 byte1 */
219 u8 pll_sm_lockwin; /* CDM + 0x26 reg9 byte2 */
220 u8 reserved3; /* CDM + 0x27 reg9 byte3 */
221
222 u16 reserved4; /* CDM + 0x28 reg10 byte0,1 */
223 u16 mclken_div_psc1; /* CDM + 0x2a reg10 byte2,3 */
224
225 u16 reserved5; /* CDM + 0x2c reg11 byte0,1 */
226 u16 mclken_div_psc2; /* CDM + 0x2e reg11 byte2,3 */
227
228 u16 reserved6; /* CDM + 0x30 reg12 byte0,1 */
229 u16 mclken_div_psc3; /* CDM + 0x32 reg12 byte2,3 */
230
231 u16 reserved7; /* CDM + 0x34 reg13 byte0,1 */
232 u16 mclken_div_psc6; /* CDM + 0x36 reg13 byte2,3 */
233};
234
235#endif /* __ASSEMBLY__ */
236
237
238/* ========================================================================= */
239/* Prototypes for MPC52xx sysdev */
240/* ========================================================================= */
241
242#ifndef __ASSEMBLY__
243
244extern void __iomem * mpc52xx_find_and_map(const char *);
245extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
246extern void mpc52xx_setup_cpu(void);
247
248extern void mpc52xx_init_irq(void);
249extern unsigned int mpc52xx_get_irq(void);
250
251#endif /* __ASSEMBLY__ */
252
253#endif /* __ASM_POWERPC_MPC52xx_H__ */
254
diff --git a/include/asm-powerpc/mpc85xx.h b/include/asm-powerpc/mpc85xx.h
index ccdb8a21138f..54142997a584 100644
--- a/include/asm-powerpc/mpc85xx.h
+++ b/include/asm-powerpc/mpc85xx.h
@@ -31,14 +31,6 @@
31#include <platforms/85xx/mpc85xx_cds.h> 31#include <platforms/85xx/mpc85xx_cds.h>
32#endif 32#endif
33 33
34#define _IO_BASE isa_io_base
35#define _ISA_MEM_BASE isa_mem_base
36#ifdef CONFIG_PCI
37#define PCI_DRAM_OFFSET pci_dram_offset
38#else
39#define PCI_DRAM_OFFSET 0
40#endif
41
42/* Let modules/drivers get at CCSRBAR */ 34/* Let modules/drivers get at CCSRBAR */
43extern phys_addr_t get_ccsrbar(void); 35extern phys_addr_t get_ccsrbar(void);
44 36
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index ef0a5458d2b2..b71e7b32a555 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -3,6 +3,7 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/irq.h> 5#include <linux/irq.h>
6#include <asm/dcr.h>
6 7
7/* 8/*
8 * Global registers 9 * Global registers
@@ -225,6 +226,23 @@ struct mpic_irq_fixup
225#endif /* CONFIG_MPIC_BROKEN_U3 */ 226#endif /* CONFIG_MPIC_BROKEN_U3 */
226 227
227 228
229enum mpic_reg_type {
230 mpic_access_mmio_le,
231 mpic_access_mmio_be,
232#ifdef CONFIG_PPC_DCR
233 mpic_access_dcr
234#endif
235};
236
237struct mpic_reg_bank {
238 u32 __iomem *base;
239#ifdef CONFIG_PPC_DCR
240 dcr_host_t dhost;
241 unsigned int dbase;
242 unsigned int doff;
243#endif /* CONFIG_PPC_DCR */
244};
245
228/* The instance data of a given MPIC */ 246/* The instance data of a given MPIC */
229struct mpic 247struct mpic
230{ 248{
@@ -264,11 +282,18 @@ struct mpic
264 spinlock_t fixup_lock; 282 spinlock_t fixup_lock;
265#endif 283#endif
266 284
285 /* Register access method */
286 enum mpic_reg_type reg_type;
287
267 /* The various ioremap'ed bases */ 288 /* The various ioremap'ed bases */
268 volatile u32 __iomem *gregs; 289 struct mpic_reg_bank gregs;
269 volatile u32 __iomem *tmregs; 290 struct mpic_reg_bank tmregs;
270 volatile u32 __iomem *cpuregs[MPIC_MAX_CPUS]; 291 struct mpic_reg_bank cpuregs[MPIC_MAX_CPUS];
271 volatile u32 __iomem *isus[MPIC_MAX_ISU]; 292 struct mpic_reg_bank isus[MPIC_MAX_ISU];
293
294#ifdef CONFIG_PPC_DCR
295 unsigned int dcr_base;
296#endif
272 297
273#ifdef CONFIG_MPIC_WEIRD 298#ifdef CONFIG_MPIC_WEIRD
274 /* Pointer to HW info array */ 299 /* Pointer to HW info array */
@@ -305,6 +330,8 @@ struct mpic
305#define MPIC_SPV_EOI 0x00000020 330#define MPIC_SPV_EOI 0x00000020
306/* No passthrough disable */ 331/* No passthrough disable */
307#define MPIC_NO_PTHROU_DIS 0x00000040 332#define MPIC_NO_PTHROU_DIS 0x00000040
333/* DCR based MPIC */
334#define MPIC_USES_DCR 0x00000080
308 335
309/* MPIC HW modification ID */ 336/* MPIC HW modification ID */
310#define MPIC_REGSET_MASK 0xf0000000 337#define MPIC_REGSET_MASK 0xf0000000
@@ -337,7 +364,7 @@ struct mpic
337 * that is senses[0] correspond to linux irq "irq_offset". 364 * that is senses[0] correspond to linux irq "irq_offset".
338 */ 365 */
339extern struct mpic *mpic_alloc(struct device_node *node, 366extern struct mpic *mpic_alloc(struct device_node *node,
340 unsigned long phys_addr, 367 phys_addr_t phys_addr,
341 unsigned int flags, 368 unsigned int flags,
342 unsigned int isu_size, 369 unsigned int isu_size,
343 unsigned int irq_count, 370 unsigned int irq_count,
@@ -350,7 +377,7 @@ extern struct mpic *mpic_alloc(struct device_node *node,
350 * @phys_addr: physical address of the ISU 377 * @phys_addr: physical address of the ISU
351 */ 378 */
352extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num, 379extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
353 unsigned long phys_addr); 380 phys_addr_t phys_addr);
354 381
355/* Set default sense codes 382/* Set default sense codes
356 * 383 *
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index c5c0b0b3cd52..a889b2005bf5 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -6,12 +6,6 @@
6#include <linux/mod_devicetable.h> 6#include <linux/mod_devicetable.h>
7#include <asm/prom.h> 7#include <asm/prom.h>
8 8
9/*
10 * The of_platform_bus_type is a bus type used by drivers that do not
11 * attach to a macio or similar bus but still use OF probing
12 * mechanism
13 */
14extern struct bus_type of_platform_bus_type;
15 9
16/* 10/*
17 * The of_device is a kind of "base class" that is a superset of 11 * The of_device is a kind of "base class" that is a superset of
@@ -20,46 +14,22 @@ extern struct bus_type of_platform_bus_type;
20 */ 14 */
21struct of_device 15struct of_device
22{ 16{
23 struct device_node *node; /* OF device node */ 17 struct device_node *node; /* to be obsoleted */
24 u64 dma_mask; /* DMA mask */ 18 u64 dma_mask; /* DMA mask */
25 struct device dev; /* Generic device interface */ 19 struct device dev; /* Generic device interface */
26}; 20};
27#define to_of_device(d) container_of(d, struct of_device, dev) 21#define to_of_device(d) container_of(d, struct of_device, dev)
28 22
23extern const struct of_device_id *of_match_node(
24 const struct of_device_id *matches, const struct device_node *node);
29extern const struct of_device_id *of_match_device( 25extern const struct of_device_id *of_match_device(
30 const struct of_device_id *matches, const struct of_device *dev); 26 const struct of_device_id *matches, const struct of_device *dev);
31 27
32extern struct of_device *of_dev_get(struct of_device *dev); 28extern struct of_device *of_dev_get(struct of_device *dev);
33extern void of_dev_put(struct of_device *dev); 29extern void of_dev_put(struct of_device *dev);
34 30
35/*
36 * An of_platform_driver driver is attached to a basic of_device on
37 * the "platform bus" (of_platform_bus_type)
38 */
39struct of_platform_driver
40{
41 char *name;
42 struct of_device_id *match_table;
43 struct module *owner;
44
45 int (*probe)(struct of_device* dev, const struct of_device_id *match);
46 int (*remove)(struct of_device* dev);
47
48 int (*suspend)(struct of_device* dev, pm_message_t state);
49 int (*resume)(struct of_device* dev);
50 int (*shutdown)(struct of_device* dev);
51
52 struct device_driver driver;
53};
54#define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
55
56extern int of_register_driver(struct of_platform_driver *drv);
57extern void of_unregister_driver(struct of_platform_driver *drv);
58extern int of_device_register(struct of_device *ofdev); 31extern int of_device_register(struct of_device *ofdev);
59extern void of_device_unregister(struct of_device *ofdev); 32extern void of_device_unregister(struct of_device *ofdev);
60extern struct of_device *of_platform_device_create(struct device_node *np,
61 const char *bus_id,
62 struct device *parent);
63extern void of_release_dev(struct device *dev); 33extern void of_release_dev(struct device *dev);
64 34
65#endif /* __KERNEL__ */ 35#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/of_platform.h b/include/asm-powerpc/of_platform.h
new file mode 100644
index 000000000000..217eafb167e9
--- /dev/null
+++ b/include/asm-powerpc/of_platform.h
@@ -0,0 +1,60 @@
1/*
2 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org>
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 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 *
10 */
11
12#include <asm/of_device.h>
13
14/*
15 * The of_platform_bus_type is a bus type used by drivers that do not
16 * attach to a macio or similar bus but still use OF probing
17 * mechanism
18 */
19extern struct bus_type of_platform_bus_type;
20
21/*
22 * An of_platform_driver driver is attached to a basic of_device on
23 * the "platform bus" (of_platform_bus_type)
24 */
25struct of_platform_driver
26{
27 char *name;
28 struct of_device_id *match_table;
29 struct module *owner;
30
31 int (*probe)(struct of_device* dev,
32 const struct of_device_id *match);
33 int (*remove)(struct of_device* dev);
34
35 int (*suspend)(struct of_device* dev, pm_message_t state);
36 int (*resume)(struct of_device* dev);
37 int (*shutdown)(struct of_device* dev);
38
39 struct device_driver driver;
40};
41#define to_of_platform_driver(drv) \
42 container_of(drv,struct of_platform_driver, driver)
43
44/* Platform drivers register/unregister */
45extern int of_register_platform_driver(struct of_platform_driver *drv);
46extern void of_unregister_platform_driver(struct of_platform_driver *drv);
47
48/* Platform devices and busses creation */
49extern struct of_device *of_platform_device_create(struct device_node *np,
50 const char *bus_id,
51 struct device *parent);
52/* pseudo "matches" value to not do deep probe */
53#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
54
55extern int of_platform_bus_probe(struct device_node *root,
56 struct of_device_id *matches,
57 struct device *parent);
58
59extern struct of_device *of_find_device_by_node(struct device_node *np);
60extern struct of_device *of_find_device_by_phandle(phandle ph);
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 07a10e590c1d..71043bf3641f 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -44,7 +44,9 @@ struct op_powerpc_model {
44 int num_counters); 44 int num_counters);
45 void (*cpu_setup) (struct op_counter_config *); 45 void (*cpu_setup) (struct op_counter_config *);
46 void (*start) (struct op_counter_config *); 46 void (*start) (struct op_counter_config *);
47 void (*global_start) (struct op_counter_config *);
47 void (*stop) (void); 48 void (*stop) (void);
49 void (*global_stop) (void);
48 void (*handle_interrupt) (struct pt_regs *, 50 void (*handle_interrupt) (struct pt_regs *,
49 struct op_counter_config *); 51 struct op_counter_config *);
50 int num_counters; 52 int num_counters;
@@ -54,6 +56,7 @@ extern struct op_powerpc_model op_model_fsl_booke;
54extern struct op_powerpc_model op_model_rs64; 56extern struct op_powerpc_model op_model_rs64;
55extern struct op_powerpc_model op_model_power4; 57extern struct op_powerpc_model op_model_power4;
56extern struct op_powerpc_model op_model_7450; 58extern struct op_powerpc_model op_model_7450;
59extern struct op_powerpc_model op_model_cell;
57 60
58#ifndef CONFIG_FSL_BOOKE 61#ifndef CONFIG_FSL_BOOKE
59 62
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index 0a4e5c93e8e6..0d3adc09c847 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -93,7 +93,8 @@ struct paca_struct {
93 u64 stab_rr; /* stab/slb round-robin counter */ 93 u64 stab_rr; /* stab/slb round-robin counter */
94 u64 saved_r1; /* r1 save for RTAS calls */ 94 u64 saved_r1; /* r1 save for RTAS calls */
95 u64 saved_msr; /* MSR saved here by enter_rtas */ 95 u64 saved_msr; /* MSR saved here by enter_rtas */
96 u8 proc_enabled; /* irq soft-enable flag */ 96 u8 soft_enabled; /* irq soft-enable flag */
97 u8 hard_enabled; /* set if irqs are enabled in MSR */
97 u8 io_sync; /* writel() needs spin_unlock sync */ 98 u8 io_sync; /* writel() needs spin_unlock sync */
98 99
99 /* Stuff for accurate time accounting */ 100 /* Stuff for accurate time accounting */
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index 86ee46b09b8a..7bb7f9009806 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -25,6 +25,7 @@ struct pci_controller {
25 int node; 25 int node;
26 void *arch_data; 26 void *arch_data;
27 struct list_head list_node; 27 struct list_head list_node;
28 struct device *parent;
28 29
29 int first_busno; 30 int first_busno;
30 int last_busno; 31 int last_busno;
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index 46afd29b904e..16f13319c769 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -62,29 +62,23 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
62} 62}
63 63
64#ifdef CONFIG_PPC64 64#ifdef CONFIG_PPC64
65#define HAVE_ARCH_PCI_MWI 1
66static inline int pcibios_prep_mwi(struct pci_dev *dev)
67{
68 /*
69 * We would like to avoid touching the cacheline size or MWI bit
70 * but we cant do that with the current pcibios_prep_mwi
71 * interface. pSeries firmware sets the cacheline size (which is not
72 * the cpu cacheline size in all cases) and hardware treats MWI
73 * the same as memory write. So we dont touch the cacheline size
74 * here and allow the generic code to set the MWI bit.
75 */
76 return 0;
77}
78 65
79extern struct dma_mapping_ops pci_dma_ops; 66/*
67 * We want to avoid touching the cacheline size or MWI bit.
68 * pSeries firmware sets the cacheline size (which is not the cpu cacheline
69 * size in all cases) and hardware treats MWI the same as memory write.
70 */
71#define PCI_DISABLE_MWI
72
73extern struct dma_mapping_ops *pci_dma_ops;
80 74
81/* For DAC DMA, we currently don't support it by default, but 75/* For DAC DMA, we currently don't support it by default, but
82 * we let 64-bit platforms override this. 76 * we let 64-bit platforms override this.
83 */ 77 */
84static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask) 78static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
85{ 79{
86 if (pci_dma_ops.dac_dma_supported) 80 if (pci_dma_ops && pci_dma_ops->dac_dma_supported)
87 return pci_dma_ops.dac_dma_supported(&hwdev->dev, mask); 81 return pci_dma_ops->dac_dma_supported(&hwdev->dev, mask);
88 return 0; 82 return 0;
89} 83}
90 84
@@ -216,6 +210,8 @@ extern int remap_bus_range(struct pci_bus *bus);
216extern void pcibios_fixup_device_resources(struct pci_dev *dev, 210extern void pcibios_fixup_device_resources(struct pci_dev *dev,
217 struct pci_bus *bus); 211 struct pci_bus *bus);
218 212
213extern void pcibios_setup_new_device(struct pci_dev *dev);
214
219extern void pcibios_claim_one_bus(struct pci_bus *b); 215extern void pcibios_claim_one_bus(struct pci_bus *b);
220 216
221extern struct pci_controller *init_phb_dynamic(struct device_node *dn); 217extern struct pci_controller *init_phb_dynamic(struct device_node *dn);
@@ -238,12 +234,10 @@ extern pgprot_t pci_phys_mem_access_prot(struct file *file,
238 unsigned long size, 234 unsigned long size,
239 pgprot_t prot); 235 pgprot_t prot);
240 236
241#if defined(CONFIG_PPC_MULTIPLATFORM) || defined(CONFIG_PPC32)
242#define HAVE_ARCH_PCI_RESOURCE_TO_USER 237#define HAVE_ARCH_PCI_RESOURCE_TO_USER
243extern void pci_resource_to_user(const struct pci_dev *dev, int bar, 238extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
244 const struct resource *rsrc, 239 const struct resource *rsrc,
245 resource_size_t *start, resource_size_t *end); 240 resource_size_t *start, resource_size_t *end);
246#endif /* CONFIG_PPC_MULTIPLATFORM || CONFIG_PPC32 */
247 241
248#endif /* __KERNEL__ */ 242#endif /* __KERNEL__ */
249#endif /* __ASM_POWERPC_PCI_H */ 243#endif /* __ASM_POWERPC_PCI_H */
diff --git a/include/asm-powerpc/pgalloc.h b/include/asm-powerpc/pgalloc.h
index ae63db7b3e7d..b0830db68f8a 100644
--- a/include/asm-powerpc/pgalloc.h
+++ b/include/asm-powerpc/pgalloc.h
@@ -11,7 +11,7 @@
11#include <linux/cpumask.h> 11#include <linux/cpumask.h>
12#include <linux/percpu.h> 12#include <linux/percpu.h>
13 13
14extern kmem_cache_t *pgtable_cache[]; 14extern struct kmem_cache *pgtable_cache[];
15 15
16#ifdef CONFIG_PPC_64K_PAGES 16#ifdef CONFIG_PPC_64K_PAGES
17#define PTE_CACHE_NUM 0 17#define PTE_CACHE_NUM 0
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index 1115756c79f9..ab6eddb518c7 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -36,18 +36,17 @@ typedef void *(*traverse_func)(struct device_node *me, void *data);
36void *traverse_pci_devices(struct device_node *start, traverse_func pre, 36void *traverse_pci_devices(struct device_node *start, traverse_func pre,
37 void *data); 37 void *data);
38 38
39void pci_devs_phb_init(void); 39extern void pci_devs_phb_init(void);
40void pci_devs_phb_init_dynamic(struct pci_controller *phb); 40extern void pci_devs_phb_init_dynamic(struct pci_controller *phb);
41int setup_phb(struct device_node *dev, struct pci_controller *phb); 41extern void scan_phb(struct pci_controller *hose);
42void __devinit scan_phb(struct pci_controller *hose);
43 42
44/* From rtas_pci.h */ 43/* From rtas_pci.h */
45void init_pci_config_tokens (void); 44extern void init_pci_config_tokens (void);
46unsigned long get_phb_buid (struct device_node *); 45extern unsigned long get_phb_buid (struct device_node *);
46extern int rtas_setup_phb(struct pci_controller *phb);
47 47
48/* From pSeries_pci.h */ 48/* From pSeries_pci.h */
49extern void pSeries_final_fixup(void); 49extern void pSeries_final_fixup(void);
50extern void pSeries_irq_bus_setup(struct pci_bus *bus);
51 50
52extern unsigned long pci_probe_only; 51extern unsigned long pci_probe_only;
53 52
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index 6cb6fb19e57f..a26c32ee5527 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -53,10 +53,6 @@ extern unsigned char ucBoardRevMaj, ucBoardRevMin;
53 53
54#endif /* CONFIG_PPC_PREP */ 54#endif /* CONFIG_PPC_PREP */
55 55
56#ifndef CONFIG_PPC_MULTIPLATFORM
57#define _machine 0
58#endif /* CONFIG_PPC_MULTIPLATFORM */
59
60#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */ 56#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */
61 57
62/* 58/*
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index ec11d44eaeb5..0afee17f33b4 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -17,6 +17,7 @@
17 */ 17 */
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/proc_fs.h> 19#include <linux/proc_fs.h>
20#include <linux/platform_device.h>
20#include <asm/atomic.h> 21#include <asm/atomic.h>
21 22
22/* Definitions used by the flattened device tree */ 23/* Definitions used by the flattened device tree */
@@ -333,6 +334,20 @@ extern int of_irq_map_one(struct device_node *device, int index,
333struct pci_dev; 334struct pci_dev;
334extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); 335extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
335 336
337static inline int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
338{
339 int irq = irq_of_parse_and_map(dev, index);
340
341 /* Only dereference the resource if both the
342 * resource and the irq are valid. */
343 if (r && irq != NO_IRQ) {
344 r->start = r->end = irq;
345 r->flags = IORESOURCE_IRQ;
346 }
347
348 return irq;
349}
350
336 351
337#endif /* __KERNEL__ */ 352#endif /* __KERNEL__ */
338#endif /* _POWERPC_PROM_H */ 353#endif /* _POWERPC_PROM_H */
diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h
new file mode 100644
index 000000000000..52a69ed0d90a
--- /dev/null
+++ b/include/asm-powerpc/ps3.h
@@ -0,0 +1,462 @@
1/*
2 * PS3 platform declarations.
3 *
4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp.
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; version 2 of the License.
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#if !defined(_ASM_POWERPC_PS3_H)
22#define _ASM_POWERPC_PS3_H
23
24#include <linux/compiler.h> /* for __deprecated */
25#include <linux/init.h>
26#include <linux/types.h>
27#include <linux/device.h>
28
29/**
30 * struct ps3_device_id - HV bus device identifier from the system repository
31 * @bus_id: HV bus id, {1..} (zero invalid)
32 * @dev_id: HV device id, {0..}
33 */
34
35struct ps3_device_id {
36 unsigned int bus_id;
37 unsigned int dev_id;
38};
39
40
41/* dma routines */
42
43enum ps3_dma_page_size {
44 PS3_DMA_4K = 12U,
45 PS3_DMA_64K = 16U,
46 PS3_DMA_1M = 20U,
47 PS3_DMA_16M = 24U,
48};
49
50enum ps3_dma_region_type {
51 PS3_DMA_OTHER = 0,
52 PS3_DMA_INTERNAL = 2,
53};
54
55/**
56 * struct ps3_dma_region - A per device dma state variables structure
57 * @did: The HV device id.
58 * @page_size: The ioc pagesize.
59 * @region_type: The HV region type.
60 * @bus_addr: The 'translated' bus address of the region.
61 * @len: The length in bytes of the region.
62 * @chunk_list: Opaque variable used by the ioc page manager.
63 */
64
65struct ps3_dma_region {
66 struct ps3_device_id did;
67 enum ps3_dma_page_size page_size;
68 enum ps3_dma_region_type region_type;
69 unsigned long bus_addr;
70 unsigned long len;
71 struct {
72 spinlock_t lock;
73 struct list_head head;
74 } chunk_list;
75};
76
77/**
78 * struct ps3_dma_region_init - Helper to initialize structure variables
79 *
80 * Helper to properly initialize variables prior to calling
81 * ps3_system_bus_device_register.
82 */
83
84static inline void ps3_dma_region_init(struct ps3_dma_region *r,
85 const struct ps3_device_id* did, enum ps3_dma_page_size page_size,
86 enum ps3_dma_region_type region_type)
87{
88 r->did = *did;
89 r->page_size = page_size;
90 r->region_type = region_type;
91}
92int ps3_dma_region_create(struct ps3_dma_region *r);
93int ps3_dma_region_free(struct ps3_dma_region *r);
94int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr,
95 unsigned long len, unsigned long *bus_addr);
96int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr,
97 unsigned long len);
98
99/* mmio routines */
100
101enum ps3_mmio_page_size {
102 PS3_MMIO_4K = 12U,
103 PS3_MMIO_64K = 16U
104};
105
106/**
107 * struct ps3_mmio_region - a per device mmio state variables structure
108 *
109 * Current systems can be supported with a single region per device.
110 */
111
112struct ps3_mmio_region {
113 struct ps3_device_id did;
114 unsigned long bus_addr;
115 unsigned long len;
116 enum ps3_mmio_page_size page_size;
117 unsigned long lpar_addr;
118};
119
120/**
121 * struct ps3_mmio_region_init - Helper to initialize structure variables
122 *
123 * Helper to properly initialize variables prior to calling
124 * ps3_system_bus_device_register.
125 */
126
127static inline void ps3_mmio_region_init(struct ps3_mmio_region *r,
128 const struct ps3_device_id* did, unsigned long bus_addr,
129 unsigned long len, enum ps3_mmio_page_size page_size)
130{
131 r->did = *did;
132 r->bus_addr = bus_addr;
133 r->len = len;
134 r->page_size = page_size;
135}
136int ps3_mmio_region_create(struct ps3_mmio_region *r);
137int ps3_free_mmio_region(struct ps3_mmio_region *r);
138unsigned long ps3_mm_phys_to_lpar(unsigned long phys_addr);
139
140/* inrerrupt routines */
141
142int ps3_alloc_io_irq(unsigned int interrupt_id, unsigned int *virq);
143int ps3_free_io_irq(unsigned int virq);
144int ps3_alloc_event_irq(unsigned int *virq);
145int ps3_free_event_irq(unsigned int virq);
146int ps3_send_event_locally(unsigned int virq);
147int ps3_connect_event_irq(const struct ps3_device_id *did,
148 unsigned int interrupt_id, unsigned int *virq);
149int ps3_disconnect_event_irq(const struct ps3_device_id *did,
150 unsigned int interrupt_id, unsigned int virq);
151int ps3_alloc_vuart_irq(void* virt_addr_bmp, unsigned int *virq);
152int ps3_free_vuart_irq(unsigned int virq);
153int ps3_alloc_spe_irq(unsigned long spe_id, unsigned int class,
154 unsigned int *virq);
155int ps3_free_spe_irq(unsigned int virq);
156
157/* lv1 result codes */
158
159enum lv1_result {
160 LV1_SUCCESS = 0,
161 /* not used -1 */
162 LV1_RESOURCE_SHORTAGE = -2,
163 LV1_NO_PRIVILEGE = -3,
164 LV1_DENIED_BY_POLICY = -4,
165 LV1_ACCESS_VIOLATION = -5,
166 LV1_NO_ENTRY = -6,
167 LV1_DUPLICATE_ENTRY = -7,
168 LV1_TYPE_MISMATCH = -8,
169 LV1_BUSY = -9,
170 LV1_EMPTY = -10,
171 LV1_WRONG_STATE = -11,
172 /* not used -12 */
173 LV1_NO_MATCH = -13,
174 LV1_ALREADY_CONNECTED = -14,
175 LV1_UNSUPPORTED_PARAMETER_VALUE = -15,
176 LV1_CONDITION_NOT_SATISFIED = -16,
177 LV1_ILLEGAL_PARAMETER_VALUE = -17,
178 LV1_BAD_OPTION = -18,
179 LV1_IMPLEMENTATION_LIMITATION = -19,
180 LV1_NOT_IMPLEMENTED = -20,
181 LV1_INVALID_CLASS_ID = -21,
182 LV1_CONSTRAINT_NOT_SATISFIED = -22,
183 LV1_ALIGNMENT_ERROR = -23,
184 LV1_INTERNAL_ERROR = -32768,
185};
186
187static inline const char* ps3_result(int result)
188{
189#if defined(DEBUG)
190 switch (result) {
191 case LV1_SUCCESS:
192 return "LV1_SUCCESS (0)";
193 case -1:
194 return "** unknown result ** (-1)";
195 case LV1_RESOURCE_SHORTAGE:
196 return "LV1_RESOURCE_SHORTAGE (-2)";
197 case LV1_NO_PRIVILEGE:
198 return "LV1_NO_PRIVILEGE (-3)";
199 case LV1_DENIED_BY_POLICY:
200 return "LV1_DENIED_BY_POLICY (-4)";
201 case LV1_ACCESS_VIOLATION:
202 return "LV1_ACCESS_VIOLATION (-5)";
203 case LV1_NO_ENTRY:
204 return "LV1_NO_ENTRY (-6)";
205 case LV1_DUPLICATE_ENTRY:
206 return "LV1_DUPLICATE_ENTRY (-7)";
207 case LV1_TYPE_MISMATCH:
208 return "LV1_TYPE_MISMATCH (-8)";
209 case LV1_BUSY:
210 return "LV1_BUSY (-9)";
211 case LV1_EMPTY:
212 return "LV1_EMPTY (-10)";
213 case LV1_WRONG_STATE:
214 return "LV1_WRONG_STATE (-11)";
215 case -12:
216 return "** unknown result ** (-12)";
217 case LV1_NO_MATCH:
218 return "LV1_NO_MATCH (-13)";
219 case LV1_ALREADY_CONNECTED:
220 return "LV1_ALREADY_CONNECTED (-14)";
221 case LV1_UNSUPPORTED_PARAMETER_VALUE:
222 return "LV1_UNSUPPORTED_PARAMETER_VALUE (-15)";
223 case LV1_CONDITION_NOT_SATISFIED:
224 return "LV1_CONDITION_NOT_SATISFIED (-16)";
225 case LV1_ILLEGAL_PARAMETER_VALUE:
226 return "LV1_ILLEGAL_PARAMETER_VALUE (-17)";
227 case LV1_BAD_OPTION:
228 return "LV1_BAD_OPTION (-18)";
229 case LV1_IMPLEMENTATION_LIMITATION:
230 return "LV1_IMPLEMENTATION_LIMITATION (-19)";
231 case LV1_NOT_IMPLEMENTED:
232 return "LV1_NOT_IMPLEMENTED (-20)";
233 case LV1_INVALID_CLASS_ID:
234 return "LV1_INVALID_CLASS_ID (-21)";
235 case LV1_CONSTRAINT_NOT_SATISFIED:
236 return "LV1_CONSTRAINT_NOT_SATISFIED (-22)";
237 case LV1_ALIGNMENT_ERROR:
238 return "LV1_ALIGNMENT_ERROR (-23)";
239 case LV1_INTERNAL_ERROR:
240 return "LV1_INTERNAL_ERROR (-32768)";
241 default:
242 BUG();
243 return "** unknown result **";
244 };
245#else
246 return "";
247#endif
248}
249
250/* repository bus info */
251
252enum ps3_bus_type {
253 PS3_BUS_TYPE_SB = 4,
254 PS3_BUS_TYPE_STORAGE = 5,
255};
256
257enum ps3_dev_type {
258 PS3_DEV_TYPE_SB_GELIC = 3,
259 PS3_DEV_TYPE_SB_USB = 4,
260 PS3_DEV_TYPE_SB_GPIO = 6,
261};
262
263int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str,
264 u64 *value);
265int ps3_repository_read_bus_id(unsigned int bus_index, unsigned int *bus_id);
266int ps3_repository_read_bus_type(unsigned int bus_index,
267 enum ps3_bus_type *bus_type);
268int ps3_repository_read_bus_num_dev(unsigned int bus_index,
269 unsigned int *num_dev);
270
271/* repository bus device info */
272
273enum ps3_interrupt_type {
274 PS3_INTERRUPT_TYPE_EVENT_PORT = 2,
275 PS3_INTERRUPT_TYPE_SB_OHCI = 3,
276 PS3_INTERRUPT_TYPE_SB_EHCI = 4,
277 PS3_INTERRUPT_TYPE_OTHER = 5,
278};
279
280enum ps3_region_type {
281 PS3_REGION_TYPE_SB_OHCI = 3,
282 PS3_REGION_TYPE_SB_EHCI = 4,
283 PS3_REGION_TYPE_SB_GPIO = 5,
284};
285
286int ps3_repository_read_dev_str(unsigned int bus_index,
287 unsigned int dev_index, const char *dev_str, u64 *value);
288int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index,
289 unsigned int *dev_id);
290int ps3_repository_read_dev_type(unsigned int bus_index,
291 unsigned int dev_index, enum ps3_dev_type *dev_type);
292int ps3_repository_read_dev_intr(unsigned int bus_index,
293 unsigned int dev_index, unsigned int intr_index,
294 enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id);
295int ps3_repository_read_dev_reg_type(unsigned int bus_index,
296 unsigned int dev_index, unsigned int reg_index,
297 enum ps3_region_type *reg_type);
298int ps3_repository_read_dev_reg_addr(unsigned int bus_index,
299 unsigned int dev_index, unsigned int reg_index, u64 *bus_addr,
300 u64 *len);
301int ps3_repository_read_dev_reg(unsigned int bus_index,
302 unsigned int dev_index, unsigned int reg_index,
303 enum ps3_region_type *reg_type, u64 *bus_addr, u64 *len);
304
305/* repository bus enumerators */
306
307struct ps3_repository_device {
308 unsigned int bus_index;
309 unsigned int dev_index;
310 struct ps3_device_id did;
311};
312
313int ps3_repository_find_device(enum ps3_bus_type bus_type,
314 enum ps3_dev_type dev_type,
315 const struct ps3_repository_device *start_dev,
316 struct ps3_repository_device *dev);
317static inline int ps3_repository_find_first_device(
318 enum ps3_bus_type bus_type, enum ps3_dev_type dev_type,
319 struct ps3_repository_device *dev)
320{
321 return ps3_repository_find_device(bus_type, dev_type, NULL, dev);
322}
323int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
324 enum ps3_interrupt_type intr_type, unsigned int *interrupt_id);
325int ps3_repository_find_region(const struct ps3_repository_device *dev,
326 enum ps3_region_type reg_type, u64 *bus_addr, u64 *len);
327
328/* repository block device info */
329
330int ps3_repository_read_dev_port(unsigned int bus_index,
331 unsigned int dev_index, u64 *port);
332int ps3_repository_read_dev_blk_size(unsigned int bus_index,
333 unsigned int dev_index, u64 *blk_size);
334int ps3_repository_read_dev_num_blocks(unsigned int bus_index,
335 unsigned int dev_index, u64 *num_blocks);
336int ps3_repository_read_dev_num_regions(unsigned int bus_index,
337 unsigned int dev_index, unsigned int *num_regions);
338int ps3_repository_read_dev_region_id(unsigned int bus_index,
339 unsigned int dev_index, unsigned int region_index,
340 unsigned int *region_id);
341int ps3_repository_read_dev_region_size(unsigned int bus_index,
342 unsigned int dev_index, unsigned int region_index, u64 *region_size);
343int ps3_repository_read_dev_region_start(unsigned int bus_index,
344 unsigned int dev_index, unsigned int region_index, u64 *region_start);
345
346/* repository pu and memory info */
347
348int ps3_repository_read_num_pu(unsigned int *num_pu);
349int ps3_repository_read_ppe_id(unsigned int *pu_index, unsigned int *ppe_id);
350int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base);
351int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size);
352int ps3_repository_read_region_total(u64 *region_total);
353int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size,
354 u64 *region_total);
355
356/* repository pme info */
357
358int ps3_repository_read_num_be(unsigned int *num_be);
359int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id);
360int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq);
361int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq);
362
363/* repository 'Other OS' area */
364
365int ps3_repository_read_boot_dat_addr(u64 *lpar_addr);
366int ps3_repository_read_boot_dat_size(unsigned int *size);
367int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size);
368
369/* repository spu info */
370
371/**
372 * enum spu_resource_type - Type of spu resource.
373 * @spu_resource_type_shared: Logical spu is shared with other partions.
374 * @spu_resource_type_exclusive: Logical spu is not shared with other partions.
375 *
376 * Returned by ps3_repository_read_spu_resource_id().
377 */
378
379enum ps3_spu_resource_type {
380 PS3_SPU_RESOURCE_TYPE_SHARED = 0,
381 PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL,
382};
383
384int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved);
385int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id);
386int ps3_repository_read_spu_resource_id(unsigned int res_index,
387 enum ps3_spu_resource_type* resource_type, unsigned int *resource_id);
388
389
390/* system bus routines */
391
392enum ps3_match_id {
393 PS3_MATCH_ID_EHCI = 1,
394 PS3_MATCH_ID_OHCI,
395 PS3_MATCH_ID_GELIC,
396 PS3_MATCH_ID_AV_SETTINGS,
397 PS3_MATCH_ID_SYSTEM_MANAGER,
398};
399
400/**
401 * struct ps3_system_bus_device - a device on the system bus
402 */
403
404struct ps3_system_bus_device {
405 enum ps3_match_id match_id;
406 struct ps3_device_id did;
407 unsigned int interrupt_id;
408/* struct iommu_table *iommu_table; -- waiting for Ben's cleanups */
409 struct ps3_dma_region *d_region;
410 struct ps3_mmio_region *m_region;
411 struct device core;
412};
413
414/**
415 * struct ps3_system_bus_driver - a driver for a device on the system bus
416 */
417
418struct ps3_system_bus_driver {
419 enum ps3_match_id match_id;
420 struct device_driver core;
421 int (*probe)(struct ps3_system_bus_device *);
422 int (*remove)(struct ps3_system_bus_device *);
423/* int (*suspend)(struct ps3_system_bus_device *, pm_message_t); */
424/* int (*resume)(struct ps3_system_bus_device *); */
425};
426
427int ps3_system_bus_device_register(struct ps3_system_bus_device *dev);
428int ps3_system_bus_driver_register(struct ps3_system_bus_driver *drv);
429void ps3_system_bus_driver_unregister(struct ps3_system_bus_driver *drv);
430static inline struct ps3_system_bus_driver *to_ps3_system_bus_driver(
431 struct device_driver *_drv)
432{
433 return container_of(_drv, struct ps3_system_bus_driver, core);
434}
435static inline struct ps3_system_bus_device *to_ps3_system_bus_device(
436 struct device *_dev)
437{
438 return container_of(_dev, struct ps3_system_bus_device, core);
439}
440
441/**
442 * ps3_system_bus_set_drvdata -
443 * @dev: device structure
444 * @data: Data to set
445 */
446
447static inline void ps3_system_bus_set_driver_data(
448 struct ps3_system_bus_device *dev, void *data)
449{
450 dev->core.driver_data = data;
451}
452static inline void *ps3_system_bus_get_driver_data(
453 struct ps3_system_bus_device *dev)
454{
455 return dev->core.driver_data;
456}
457
458/* These two need global scope for get_dma_ops(). */
459
460extern struct bus_type ps3_system_bus_type;
461
462#endif
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index d34f9e1f242c..5a0c136c0416 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -54,8 +54,6 @@ struct rtas_args {
54 rtas_arg_t *rets; /* Pointer to return values in args[]. */ 54 rtas_arg_t *rets; /* Pointer to return values in args[]. */
55}; 55};
56 56
57extern struct rtas_args rtas_stop_self_args;
58
59struct rtas_t { 57struct rtas_t {
60 unsigned long entry; /* physical address pointer */ 58 unsigned long entry; /* physical address pointer */
61 unsigned long base; /* physical address pointer */ 59 unsigned long base; /* physical address pointer */
diff --git a/include/asm-powerpc/setup.h b/include/asm-powerpc/setup.h
index 3d9740aae018..817fac0a0714 100644
--- a/include/asm-powerpc/setup.h
+++ b/include/asm-powerpc/setup.h
@@ -1,9 +1,6 @@
1#ifndef _ASM_POWERPC_SETUP_H 1#ifndef _ASM_POWERPC_SETUP_H
2#define _ASM_POWERPC_SETUP_H 2#define _ASM_POWERPC_SETUP_H
3 3
4#ifdef __KERNEL__
5
6#define COMMAND_LINE_SIZE 512 4#define COMMAND_LINE_SIZE 512
7 5
8#endif /* __KERNEL__ */
9#endif /* _ASM_POWERPC_SETUP_H */ 6#endif /* _ASM_POWERPC_SETUP_H */
diff --git a/include/asm-powerpc/sparsemem.h b/include/asm-powerpc/sparsemem.h
index 38b1ea3b58fd..48ad807a0b8a 100644
--- a/include/asm-powerpc/sparsemem.h
+++ b/include/asm-powerpc/sparsemem.h
@@ -9,8 +9,14 @@
9 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space 9 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
10 */ 10 */
11#define SECTION_SIZE_BITS 24 11#define SECTION_SIZE_BITS 24
12
13#if defined(CONFIG_PS3_USE_LPAR_ADDR)
14#define MAX_PHYSADDR_BITS 47
15#define MAX_PHYSMEM_BITS 47
16#else
12#define MAX_PHYSADDR_BITS 44 17#define MAX_PHYSADDR_BITS 44
13#define MAX_PHYSMEM_BITS 44 18#define MAX_PHYSMEM_BITS 44
19#endif
14 20
15#ifdef CONFIG_MEMORY_HOTPLUG 21#ifdef CONFIG_MEMORY_HOTPLUG
16extern void create_section_mapping(unsigned long start, unsigned long end); 22extern void create_section_mapping(unsigned long start, unsigned long end);
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index e73ea00efd8b..fdad4267b447 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -111,14 +111,12 @@ struct spu {
111 u8 *local_store; 111 u8 *local_store;
112 unsigned long problem_phys; 112 unsigned long problem_phys;
113 struct spu_problem __iomem *problem; 113 struct spu_problem __iomem *problem;
114 struct spu_priv1 __iomem *priv1;
115 struct spu_priv2 __iomem *priv2; 114 struct spu_priv2 __iomem *priv2;
116 struct list_head list; 115 struct list_head list;
117 struct list_head sched_list; 116 struct list_head sched_list;
117 struct list_head full_list;
118 int number; 118 int number;
119 int nid;
120 unsigned int irqs[3]; 119 unsigned int irqs[3];
121 u32 isrc;
122 u32 node; 120 u32 node;
123 u64 flags; 121 u64 flags;
124 u64 dar; 122 u64 dar;
@@ -144,6 +142,7 @@ struct spu {
144 char irq_c1[8]; 142 char irq_c1[8];
145 char irq_c2[8]; 143 char irq_c2[8];
146 144
145 void* pdata; /* platform private data */
147 struct sys_device sysdev; 146 struct sys_device sysdev;
148}; 147};
149 148
@@ -170,6 +169,13 @@ extern struct spufs_calls {
170 struct module *owner; 169 struct module *owner;
171} spufs_calls; 170} spufs_calls;
172 171
172/* coredump calls implemented in spufs */
173struct spu_coredump_calls {
174 asmlinkage int (*arch_notes_size)(void);
175 asmlinkage void (*arch_write_notes)(struct file *file);
176 struct module *owner;
177};
178
173/* return status from spu_run, same as in libspe */ 179/* return status from spu_run, same as in libspe */
174#define SPE_EVENT_DMA_ALIGNMENT 0x0008 /*A DMA alignment error */ 180#define SPE_EVENT_DMA_ALIGNMENT 0x0008 /*A DMA alignment error */
175#define SPE_EVENT_SPE_ERROR 0x0010 /*An illegal instruction error*/ 181#define SPE_EVENT_SPE_ERROR 0x0010 /*An illegal instruction error*/
@@ -182,8 +188,10 @@ extern struct spufs_calls {
182 */ 188 */
183#define SPU_CREATE_EVENTS_ENABLED 0x0001 189#define SPU_CREATE_EVENTS_ENABLED 0x0001
184#define SPU_CREATE_GANG 0x0002 190#define SPU_CREATE_GANG 0x0002
191#define SPU_CREATE_NOSCHED 0x0004
192#define SPU_CREATE_ISOLATE 0x0008
185 193
186#define SPU_CREATE_FLAG_ALL 0x0003 /* mask of all valid flags */ 194#define SPU_CREATE_FLAG_ALL 0x000f /* mask of all valid flags */
187 195
188 196
189#ifdef CONFIG_SPU_FS_MODULE 197#ifdef CONFIG_SPU_FS_MODULE
@@ -199,6 +207,15 @@ static inline void unregister_spu_syscalls(struct spufs_calls *calls)
199} 207}
200#endif /* MODULE */ 208#endif /* MODULE */
201 209
210int register_arch_coredump_calls(struct spu_coredump_calls *calls);
211void unregister_arch_coredump_calls(struct spu_coredump_calls *calls);
212
213int spu_add_sysdev_attr(struct sysdev_attribute *attr);
214void spu_remove_sysdev_attr(struct sysdev_attribute *attr);
215
216int spu_add_sysdev_attr_group(struct attribute_group *attrs);
217void spu_remove_sysdev_attr_group(struct attribute_group *attrs);
218
202 219
203/* 220/*
204 * Notifier blocks: 221 * Notifier blocks:
@@ -277,6 +294,7 @@ struct spu_problem {
277 u32 spu_runcntl_RW; /* 0x401c */ 294 u32 spu_runcntl_RW; /* 0x401c */
278#define SPU_RUNCNTL_STOP 0L 295#define SPU_RUNCNTL_STOP 0L
279#define SPU_RUNCNTL_RUNNABLE 1L 296#define SPU_RUNCNTL_RUNNABLE 1L
297#define SPU_RUNCNTL_ISOLATE 2L
280 u8 pad_0x4020_0x4024[0x4]; /* 0x4020 */ 298 u8 pad_0x4020_0x4024[0x4]; /* 0x4020 */
281 u32 spu_status_R; /* 0x4024 */ 299 u32 spu_status_R; /* 0x4024 */
282#define SPU_STOP_STATUS_SHIFT 16 300#define SPU_STOP_STATUS_SHIFT 16
@@ -289,8 +307,8 @@ struct spu_problem {
289#define SPU_STATUS_INVALID_INSTR 0x20 307#define SPU_STATUS_INVALID_INSTR 0x20
290#define SPU_STATUS_INVALID_CH 0x40 308#define SPU_STATUS_INVALID_CH 0x40
291#define SPU_STATUS_ISOLATED_STATE 0x80 309#define SPU_STATUS_ISOLATED_STATE 0x80
292#define SPU_STATUS_ISOLATED_LOAD_STAUTUS 0x200 310#define SPU_STATUS_ISOLATED_LOAD_STATUS 0x200
293#define SPU_STATUS_ISOLATED_EXIT_STAUTUS 0x400 311#define SPU_STATUS_ISOLATED_EXIT_STATUS 0x400
294 u8 pad_0x4028_0x402c[0x4]; /* 0x4028 */ 312 u8 pad_0x4028_0x402c[0x4]; /* 0x4028 */
295 u32 spu_spe_R; /* 0x402c */ 313 u32 spu_spe_R; /* 0x402c */
296 u8 pad_0x4030_0x4034[0x4]; /* 0x4030 */ 314 u8 pad_0x4030_0x4034[0x4]; /* 0x4030 */
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h
index 964c2d38ccb7..bdbf906a767f 100644
--- a/include/asm-powerpc/spu_csa.h
+++ b/include/asm-powerpc/spu_csa.h
@@ -151,7 +151,6 @@ struct spu_priv1_collapsed {
151 u64 mfc_fir_chkstp_enable_RW; 151 u64 mfc_fir_chkstp_enable_RW;
152 u64 smf_sbi_signal_sel; 152 u64 smf_sbi_signal_sel;
153 u64 smf_ato_signal_sel; 153 u64 smf_ato_signal_sel;
154 u64 mfc_sdr_RW;
155 u64 tlb_index_hint_RO; 154 u64 tlb_index_hint_RO;
156 u64 tlb_index_W; 155 u64 tlb_index_W;
157 u64 tlb_vpn_RW; 156 u64 tlb_vpn_RW;
diff --git a/include/asm-powerpc/spu_info.h b/include/asm-powerpc/spu_info.h
new file mode 100644
index 000000000000..3545efbf9891
--- /dev/null
+++ b/include/asm-powerpc/spu_info.h
@@ -0,0 +1,54 @@
1/*
2 * SPU info structures
3 *
4 * (C) Copyright 2006 IBM Corp.
5 *
6 * Author: Dwayne Grant McConnell <decimal@us.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _SPU_INFO_H
24#define _SPU_INFO_H
25
26#ifdef __KERNEL__
27#include <asm/spu.h>
28#include <linux/types.h>
29#else
30struct mfc_cq_sr {
31 __u64 mfc_cq_data0_RW;
32 __u64 mfc_cq_data1_RW;
33 __u64 mfc_cq_data2_RW;
34 __u64 mfc_cq_data3_RW;
35};
36#endif /* __KERNEL__ */
37
38struct spu_dma_info {
39 __u64 dma_info_type;
40 __u64 dma_info_mask;
41 __u64 dma_info_status;
42 __u64 dma_info_stall_and_notify;
43 __u64 dma_info_atomic_command_status;
44 struct mfc_cq_sr dma_info_command_data[16];
45};
46
47struct spu_proxydma_info {
48 __u64 proxydma_info_type;
49 __u64 proxydma_info_mask;
50 __u64 proxydma_info_status;
51 struct mfc_cq_sr proxydma_info_command_data[8];
52};
53
54#endif
diff --git a/include/asm-powerpc/spu_priv1.h b/include/asm-powerpc/spu_priv1.h
index 300c458b6d06..69dcb0c53884 100644
--- a/include/asm-powerpc/spu_priv1.h
+++ b/include/asm-powerpc/spu_priv1.h
@@ -21,12 +21,13 @@
21#define _SPU_PRIV1_H 21#define _SPU_PRIV1_H
22#if defined(__KERNEL__) 22#if defined(__KERNEL__)
23 23
24#include <linux/types.h>
25
24struct spu; 26struct spu;
25 27
26/* access to priv1 registers */ 28/* access to priv1 registers */
27 29
28struct spu_priv1_ops 30struct spu_priv1_ops {
29{
30 void (*int_mask_and) (struct spu *spu, int class, u64 mask); 31 void (*int_mask_and) (struct spu *spu, int class, u64 mask);
31 void (*int_mask_or) (struct spu *spu, int class, u64 mask); 32 void (*int_mask_or) (struct spu *spu, int class, u64 mask);
32 void (*int_mask_set) (struct spu *spu, int class, u64 mask); 33 void (*int_mask_set) (struct spu *spu, int class, u64 mask);
@@ -37,7 +38,7 @@ struct spu_priv1_ops
37 u64 (*mfc_dar_get) (struct spu *spu); 38 u64 (*mfc_dar_get) (struct spu *spu);
38 u64 (*mfc_dsisr_get) (struct spu *spu); 39 u64 (*mfc_dsisr_get) (struct spu *spu);
39 void (*mfc_dsisr_set) (struct spu *spu, u64 dsisr); 40 void (*mfc_dsisr_set) (struct spu *spu, u64 dsisr);
40 void (*mfc_sdr_set) (struct spu *spu, u64 sdr); 41 void (*mfc_sdr_setup) (struct spu *spu);
41 void (*mfc_sr1_set) (struct spu *spu, u64 sr1); 42 void (*mfc_sr1_set) (struct spu *spu, u64 sr1);
42 u64 (*mfc_sr1_get) (struct spu *spu); 43 u64 (*mfc_sr1_get) (struct spu *spu);
43 void (*mfc_tclass_id_set) (struct spu *spu, u64 tclass_id); 44 void (*mfc_tclass_id_set) (struct spu *spu, u64 tclass_id);
@@ -112,9 +113,9 @@ spu_mfc_dsisr_set (struct spu *spu, u64 dsisr)
112} 113}
113 114
114static inline void 115static inline void
115spu_mfc_sdr_set (struct spu *spu, u64 sdr) 116spu_mfc_sdr_setup (struct spu *spu)
116{ 117{
117 spu_priv1_ops->mfc_sdr_set(spu, sdr); 118 spu_priv1_ops->mfc_sdr_setup(spu);
118} 119}
119 120
120static inline void 121static inline void
@@ -171,12 +172,41 @@ spu_resource_allocation_enable_get (struct spu *spu)
171 return spu_priv1_ops->resource_allocation_enable_get(spu); 172 return spu_priv1_ops->resource_allocation_enable_get(spu);
172} 173}
173 174
174/* The declarations folowing are put here for convenience 175/* spu management abstraction */
175 * and only intended to be used by the platform setup code 176
176 * for initializing spu_priv1_ops. 177struct spu_management_ops {
178 int (*enumerate_spus)(int (*fn)(void *data));
179 int (*create_spu)(struct spu *spu, void *data);
180 int (*destroy_spu)(struct spu *spu);
181};
182
183extern const struct spu_management_ops* spu_management_ops;
184
185static inline int
186spu_enumerate_spus (int (*fn)(void *data))
187{
188 return spu_management_ops->enumerate_spus(fn);
189}
190
191static inline int
192spu_create_spu (struct spu *spu, void *data)
193{
194 return spu_management_ops->create_spu(spu, data);
195}
196
197static inline int
198spu_destroy_spu (struct spu *spu)
199{
200 return spu_management_ops->destroy_spu(spu);
201}
202
203/*
204 * The declarations folowing are put here for convenience
205 * and only intended to be used by the platform setup code.
177 */ 206 */
178 207
179extern const struct spu_priv1_ops spu_priv1_mmio_ops; 208extern const struct spu_priv1_ops spu_priv1_mmio_ops;
209extern const struct spu_management_ops spu_management_of_ops;
180 210
181#endif /* __KERNEL__ */ 211#endif /* __KERNEL__ */
182#endif 212#endif
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index c6a03187f932..97b435484177 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -304,3 +304,4 @@ SYSCALL_SPU(fchmodat)
304SYSCALL_SPU(faccessat) 304SYSCALL_SPU(faccessat)
305COMPAT_SYS_SPU(get_robust_list) 305COMPAT_SYS_SPU(get_robust_list)
306COMPAT_SYS_SPU(set_robust_list) 306COMPAT_SYS_SPU(set_robust_list)
307COMPAT_SYS(move_pages)
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index a78285010d62..4cff977ad526 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -39,10 +39,6 @@ extern void generic_calibrate_decr(void);
39extern void wakeup_decrementer(void); 39extern void wakeup_decrementer(void);
40extern void snapshot_timebase(void); 40extern void snapshot_timebase(void);
41 41
42#ifdef CONFIG_RTC_CLASS
43extern int __init rtc_class_hookup(void);
44#endif
45
46/* Some sane defaults: 125 MHz timebase, 1GHz processor */ 42/* Some sane defaults: 125 MHz timebase, 1GHz processor */
47extern unsigned long ppc_proc_freq; 43extern unsigned long ppc_proc_freq;
48#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) 44#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
diff --git a/include/asm-powerpc/todc.h b/include/asm-powerpc/todc.h
deleted file mode 100644
index 60a8c39b8c11..000000000000
--- a/include/asm-powerpc/todc.h
+++ /dev/null
@@ -1,487 +0,0 @@
1/*
2 * Definitions for the M48Txx and mc146818 series of Time of day/Real Time
3 * Clock chips.
4 *
5 * Author: Mark A. Greer <mgreer@mvista.com>
6 *
7 * 2001 (c) MontaVista, Software, Inc. This file is licensed under
8 * the terms of the GNU General Public License version 2. This program
9 * is licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 */
12
13/*
14 * Support for the M48T37/M48T59/.../mc146818 Real Time Clock chips.
15 * Purpose is to make one generic file that handles all of these chips instead
16 * of every platform implementing the same code over & over again.
17 */
18
19#ifndef __PPC_KERNEL_TODC_H
20#define __PPC_KERNEL_TODC_H
21
22typedef struct {
23 uint rtc_type; /* your particular chip */
24
25 /*
26 * Following are the addresses of the AS0, AS1, and DATA registers
27 * of these chips. Note that these are board-specific.
28 */
29 unsigned int nvram_as0;
30 unsigned int nvram_as1;
31 unsigned int nvram_data;
32
33 /*
34 * Define bits to stop external set of regs from changing so
35 * the chip can be read/written reliably.
36 */
37 unsigned char enable_read;
38 unsigned char enable_write;
39
40 /*
41 * Following is the number of AS0 address bits. This is normally
42 * 8 but some bad hardware routes address lines incorrectly.
43 */
44 int as0_bits;
45
46 int nvram_size; /* Size of NVRAM on chip */
47 int sw_flags; /* Software control flags */
48
49 /* Following are the register offsets for the particular chip */
50 int year;
51 int month;
52 int day_of_month;
53 int day_of_week;
54 int hours;
55 int minutes;
56 int seconds;
57 int control_b;
58 int control_a;
59 int watchdog;
60 int interrupts;
61 int alarm_date;
62 int alarm_hour;
63 int alarm_minutes;
64 int alarm_seconds;
65 int century;
66 int flags;
67
68 /*
69 * Some RTC chips have their NVRAM buried behind a addr/data pair of
70 * regs on the first level/clock registers. The following fields
71 * are the addresses for those addr/data regs.
72 */
73 int nvram_addr_reg;
74 int nvram_data_reg;
75} todc_info_t;
76
77/*
78 * Define the types of TODC/RTC variants that are supported in
79 * arch/ppc/kernel/todc_time.c
80 * Make a new one of these for any chip somehow differs from what's already
81 * defined. That way, if you ever need to put in code to touch those
82 * bits/registers in todc_time.c, you can put it inside an
83 * 'if (todc_info->rtc_type == TODC_TYPE_XXX)' so you won't break
84 * anyone else.
85 */
86#define TODC_TYPE_MK48T35 1
87#define TODC_TYPE_MK48T37 2
88#define TODC_TYPE_MK48T59 3
89#define TODC_TYPE_DS1693 4 /* Dallas DS1693 RTC */
90#define TODC_TYPE_DS1743 5 /* Dallas DS1743 RTC */
91#define TODC_TYPE_DS1746 6 /* Dallas DS1746 RTC */
92#define TODC_TYPE_DS1747 7 /* Dallas DS1747 RTC */
93#define TODC_TYPE_DS1501 8 /* Dallas DS1501 RTC */
94#define TODC_TYPE_DS1643 9 /* Dallas DS1643 RTC */
95#define TODC_TYPE_PC97307 10 /* PC97307 internal RTC */
96#define TODC_TYPE_DS1557 11 /* Dallas DS1557 RTC */
97#define TODC_TYPE_DS17285 12 /* Dallas DS17285 RTC */
98#define TODC_TYPE_DS1553 13 /* Dallas DS1553 RTC */
99#define TODC_TYPE_MC146818 100 /* Leave room for m48txx's */
100
101/*
102 * Bit to clear/set to enable reads/writes to the chip
103 */
104#define TODC_MK48TXX_CNTL_A_R 0x40
105#define TODC_MK48TXX_CNTL_A_W 0x80
106#define TODC_MK48TXX_DAY_CB 0x80
107
108#define TODC_DS1501_CNTL_B_TE 0x80
109
110/*
111 * Define flag bits used by todc routines.
112 */
113#define TODC_FLAG_2_LEVEL_NVRAM 0x00000001
114
115/*
116 * Define the values for the various RTC's that should to into the todc_info
117 * table.
118 * Note: The XXX_NVRAM_SIZE, XXX_NVRAM_ADDR_REG, and XXX_NVRAM_DATA_REG only
119 * matter if XXX_SW_FLAGS has TODC_FLAG_2_LEVEL_NVRAM set.
120 */
121#define TODC_TYPE_MK48T35_NVRAM_SIZE 0x7ff8
122#define TODC_TYPE_MK48T35_SW_FLAGS 0
123#define TODC_TYPE_MK48T35_YEAR 0x7fff
124#define TODC_TYPE_MK48T35_MONTH 0x7ffe
125#define TODC_TYPE_MK48T35_DOM 0x7ffd /* Day of Month */
126#define TODC_TYPE_MK48T35_DOW 0x7ffc /* Day of Week */
127#define TODC_TYPE_MK48T35_HOURS 0x7ffb
128#define TODC_TYPE_MK48T35_MINUTES 0x7ffa
129#define TODC_TYPE_MK48T35_SECONDS 0x7ff9
130#define TODC_TYPE_MK48T35_CNTL_B 0x7ff9
131#define TODC_TYPE_MK48T35_CNTL_A 0x7ff8
132#define TODC_TYPE_MK48T35_WATCHDOG 0x0000
133#define TODC_TYPE_MK48T35_INTERRUPTS 0x0000
134#define TODC_TYPE_MK48T35_ALARM_DATE 0x0000
135#define TODC_TYPE_MK48T35_ALARM_HOUR 0x0000
136#define TODC_TYPE_MK48T35_ALARM_MINUTES 0x0000
137#define TODC_TYPE_MK48T35_ALARM_SECONDS 0x0000
138#define TODC_TYPE_MK48T35_CENTURY 0x0000
139#define TODC_TYPE_MK48T35_FLAGS 0x0000
140#define TODC_TYPE_MK48T35_NVRAM_ADDR_REG 0
141#define TODC_TYPE_MK48T35_NVRAM_DATA_REG 0
142
143#define TODC_TYPE_MK48T37_NVRAM_SIZE 0x7ff0
144#define TODC_TYPE_MK48T37_SW_FLAGS 0
145#define TODC_TYPE_MK48T37_YEAR 0x7fff
146#define TODC_TYPE_MK48T37_MONTH 0x7ffe
147#define TODC_TYPE_MK48T37_DOM 0x7ffd /* Day of Month */
148#define TODC_TYPE_MK48T37_DOW 0x7ffc /* Day of Week */
149#define TODC_TYPE_MK48T37_HOURS 0x7ffb
150#define TODC_TYPE_MK48T37_MINUTES 0x7ffa
151#define TODC_TYPE_MK48T37_SECONDS 0x7ff9
152#define TODC_TYPE_MK48T37_CNTL_B 0x7ff9
153#define TODC_TYPE_MK48T37_CNTL_A 0x7ff8
154#define TODC_TYPE_MK48T37_WATCHDOG 0x7ff7
155#define TODC_TYPE_MK48T37_INTERRUPTS 0x7ff6
156#define TODC_TYPE_MK48T37_ALARM_DATE 0x7ff5
157#define TODC_TYPE_MK48T37_ALARM_HOUR 0x7ff4
158#define TODC_TYPE_MK48T37_ALARM_MINUTES 0x7ff3
159#define TODC_TYPE_MK48T37_ALARM_SECONDS 0x7ff2
160#define TODC_TYPE_MK48T37_CENTURY 0x7ff1
161#define TODC_TYPE_MK48T37_FLAGS 0x7ff0
162#define TODC_TYPE_MK48T37_NVRAM_ADDR_REG 0
163#define TODC_TYPE_MK48T37_NVRAM_DATA_REG 0
164
165#define TODC_TYPE_MK48T59_NVRAM_SIZE 0x1ff0
166#define TODC_TYPE_MK48T59_SW_FLAGS 0
167#define TODC_TYPE_MK48T59_YEAR 0x1fff
168#define TODC_TYPE_MK48T59_MONTH 0x1ffe
169#define TODC_TYPE_MK48T59_DOM 0x1ffd /* Day of Month */
170#define TODC_TYPE_MK48T59_DOW 0x1ffc /* Day of Week */
171#define TODC_TYPE_MK48T59_HOURS 0x1ffb
172#define TODC_TYPE_MK48T59_MINUTES 0x1ffa
173#define TODC_TYPE_MK48T59_SECONDS 0x1ff9
174#define TODC_TYPE_MK48T59_CNTL_B 0x1ff9
175#define TODC_TYPE_MK48T59_CNTL_A 0x1ff8
176#define TODC_TYPE_MK48T59_WATCHDOG 0x1fff
177#define TODC_TYPE_MK48T59_INTERRUPTS 0x1fff
178#define TODC_TYPE_MK48T59_ALARM_DATE 0x1fff
179#define TODC_TYPE_MK48T59_ALARM_HOUR 0x1fff
180#define TODC_TYPE_MK48T59_ALARM_MINUTES 0x1fff
181#define TODC_TYPE_MK48T59_ALARM_SECONDS 0x1fff
182#define TODC_TYPE_MK48T59_CENTURY 0x1fff
183#define TODC_TYPE_MK48T59_FLAGS 0x1fff
184#define TODC_TYPE_MK48T59_NVRAM_ADDR_REG 0
185#define TODC_TYPE_MK48T59_NVRAM_DATA_REG 0
186
187#define TODC_TYPE_DS1501_NVRAM_SIZE 0x100
188#define TODC_TYPE_DS1501_SW_FLAGS TODC_FLAG_2_LEVEL_NVRAM
189#define TODC_TYPE_DS1501_YEAR (TODC_TYPE_DS1501_NVRAM_SIZE + 0x06)
190#define TODC_TYPE_DS1501_MONTH (TODC_TYPE_DS1501_NVRAM_SIZE + 0x05)
191#define TODC_TYPE_DS1501_DOM (TODC_TYPE_DS1501_NVRAM_SIZE + 0x04)
192#define TODC_TYPE_DS1501_DOW (TODC_TYPE_DS1501_NVRAM_SIZE + 0x03)
193#define TODC_TYPE_DS1501_HOURS (TODC_TYPE_DS1501_NVRAM_SIZE + 0x02)
194#define TODC_TYPE_DS1501_MINUTES (TODC_TYPE_DS1501_NVRAM_SIZE + 0x01)
195#define TODC_TYPE_DS1501_SECONDS (TODC_TYPE_DS1501_NVRAM_SIZE + 0x00)
196#define TODC_TYPE_DS1501_CNTL_B (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0f)
197#define TODC_TYPE_DS1501_CNTL_A (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0f)
198#define TODC_TYPE_DS1501_WATCHDOG (TODC_TYPE_DS1501_NVRAM_SIZE + 0xff)
199#define TODC_TYPE_DS1501_INTERRUPTS (TODC_TYPE_DS1501_NVRAM_SIZE + 0xff)
200#define TODC_TYPE_DS1501_ALARM_DATE (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0b)
201#define TODC_TYPE_DS1501_ALARM_HOUR (TODC_TYPE_DS1501_NVRAM_SIZE + 0x0a)
202#define TODC_TYPE_DS1501_ALARM_MINUTES (TODC_TYPE_DS1501_NVRAM_SIZE + 0x09)
203#define TODC_TYPE_DS1501_ALARM_SECONDS (TODC_TYPE_DS1501_NVRAM_SIZE + 0x08)
204#define TODC_TYPE_DS1501_CENTURY (TODC_TYPE_DS1501_NVRAM_SIZE + 0x07)
205#define TODC_TYPE_DS1501_FLAGS (TODC_TYPE_DS1501_NVRAM_SIZE + 0xff)
206#define TODC_TYPE_DS1501_NVRAM_ADDR_REG 0x10
207#define TODC_TYPE_DS1501_NVRAM_DATA_REG 0x13
208
209#define TODC_TYPE_DS1553_NVRAM_SIZE 0x1ff0
210#define TODC_TYPE_DS1553_SW_FLAGS 0
211#define TODC_TYPE_DS1553_YEAR 0x1fff
212#define TODC_TYPE_DS1553_MONTH 0x1ffe
213#define TODC_TYPE_DS1553_DOM 0x1ffd /* Day of Month */
214#define TODC_TYPE_DS1553_DOW 0x1ffc /* Day of Week */
215#define TODC_TYPE_DS1553_HOURS 0x1ffb
216#define TODC_TYPE_DS1553_MINUTES 0x1ffa
217#define TODC_TYPE_DS1553_SECONDS 0x1ff9
218#define TODC_TYPE_DS1553_CNTL_B 0x1ff9
219#define TODC_TYPE_DS1553_CNTL_A 0x1ff8 /* control_a R/W regs */
220#define TODC_TYPE_DS1553_WATCHDOG 0x1ff7
221#define TODC_TYPE_DS1553_INTERRUPTS 0x1ff6
222#define TODC_TYPE_DS1553_ALARM_DATE 0x1ff5
223#define TODC_TYPE_DS1553_ALARM_HOUR 0x1ff4
224#define TODC_TYPE_DS1553_ALARM_MINUTES 0x1ff3
225#define TODC_TYPE_DS1553_ALARM_SECONDS 0x1ff2
226#define TODC_TYPE_DS1553_CENTURY 0x1ff8
227#define TODC_TYPE_DS1553_FLAGS 0x1ff0
228#define TODC_TYPE_DS1553_NVRAM_ADDR_REG 0
229#define TODC_TYPE_DS1553_NVRAM_DATA_REG 0
230
231#define TODC_TYPE_DS1557_NVRAM_SIZE 0x7fff0
232#define TODC_TYPE_DS1557_SW_FLAGS 0
233#define TODC_TYPE_DS1557_YEAR 0x7ffff
234#define TODC_TYPE_DS1557_MONTH 0x7fffe
235#define TODC_TYPE_DS1557_DOM 0x7fffd /* Day of Month */
236#define TODC_TYPE_DS1557_DOW 0x7fffc /* Day of Week */
237#define TODC_TYPE_DS1557_HOURS 0x7fffb
238#define TODC_TYPE_DS1557_MINUTES 0x7fffa
239#define TODC_TYPE_DS1557_SECONDS 0x7fff9
240#define TODC_TYPE_DS1557_CNTL_B 0x7fff9
241#define TODC_TYPE_DS1557_CNTL_A 0x7fff8 /* control_a R/W regs */
242#define TODC_TYPE_DS1557_WATCHDOG 0x7fff7
243#define TODC_TYPE_DS1557_INTERRUPTS 0x7fff6
244#define TODC_TYPE_DS1557_ALARM_DATE 0x7fff5
245#define TODC_TYPE_DS1557_ALARM_HOUR 0x7fff4
246#define TODC_TYPE_DS1557_ALARM_MINUTES 0x7fff3
247#define TODC_TYPE_DS1557_ALARM_SECONDS 0x7fff2
248#define TODC_TYPE_DS1557_CENTURY 0x7fff8
249#define TODC_TYPE_DS1557_FLAGS 0x7fff0
250#define TODC_TYPE_DS1557_NVRAM_ADDR_REG 0
251#define TODC_TYPE_DS1557_NVRAM_DATA_REG 0
252
253#define TODC_TYPE_DS1643_NVRAM_SIZE 0x1ff8
254#define TODC_TYPE_DS1643_SW_FLAGS 0
255#define TODC_TYPE_DS1643_YEAR 0x1fff
256#define TODC_TYPE_DS1643_MONTH 0x1ffe
257#define TODC_TYPE_DS1643_DOM 0x1ffd /* Day of Month */
258#define TODC_TYPE_DS1643_DOW 0x1ffc /* Day of Week */
259#define TODC_TYPE_DS1643_HOURS 0x1ffb
260#define TODC_TYPE_DS1643_MINUTES 0x1ffa
261#define TODC_TYPE_DS1643_SECONDS 0x1ff9
262#define TODC_TYPE_DS1643_CNTL_B 0x1ff9
263#define TODC_TYPE_DS1643_CNTL_A 0x1ff8 /* control_a R/W regs */
264#define TODC_TYPE_DS1643_WATCHDOG 0x1fff
265#define TODC_TYPE_DS1643_INTERRUPTS 0x1fff
266#define TODC_TYPE_DS1643_ALARM_DATE 0x1fff
267#define TODC_TYPE_DS1643_ALARM_HOUR 0x1fff
268#define TODC_TYPE_DS1643_ALARM_MINUTES 0x1fff
269#define TODC_TYPE_DS1643_ALARM_SECONDS 0x1fff
270#define TODC_TYPE_DS1643_CENTURY 0x1ff8
271#define TODC_TYPE_DS1643_FLAGS 0x1fff
272#define TODC_TYPE_DS1643_NVRAM_ADDR_REG 0
273#define TODC_TYPE_DS1643_NVRAM_DATA_REG 0
274
275#define TODC_TYPE_DS1693_NVRAM_SIZE 0 /* Not handled yet */
276#define TODC_TYPE_DS1693_SW_FLAGS 0
277#define TODC_TYPE_DS1693_YEAR 0x09
278#define TODC_TYPE_DS1693_MONTH 0x08
279#define TODC_TYPE_DS1693_DOM 0x07 /* Day of Month */
280#define TODC_TYPE_DS1693_DOW 0x06 /* Day of Week */
281#define TODC_TYPE_DS1693_HOURS 0x04
282#define TODC_TYPE_DS1693_MINUTES 0x02
283#define TODC_TYPE_DS1693_SECONDS 0x00
284#define TODC_TYPE_DS1693_CNTL_B 0x0b
285#define TODC_TYPE_DS1693_CNTL_A 0x0a
286#define TODC_TYPE_DS1693_WATCHDOG 0xff
287#define TODC_TYPE_DS1693_INTERRUPTS 0xff
288#define TODC_TYPE_DS1693_ALARM_DATE 0x49
289#define TODC_TYPE_DS1693_ALARM_HOUR 0x05
290#define TODC_TYPE_DS1693_ALARM_MINUTES 0x03
291#define TODC_TYPE_DS1693_ALARM_SECONDS 0x01
292#define TODC_TYPE_DS1693_CENTURY 0x48
293#define TODC_TYPE_DS1693_FLAGS 0xff
294#define TODC_TYPE_DS1693_NVRAM_ADDR_REG 0
295#define TODC_TYPE_DS1693_NVRAM_DATA_REG 0
296
297#define TODC_TYPE_DS1743_NVRAM_SIZE 0x1ff8
298#define TODC_TYPE_DS1743_SW_FLAGS 0
299#define TODC_TYPE_DS1743_YEAR 0x1fff
300#define TODC_TYPE_DS1743_MONTH 0x1ffe
301#define TODC_TYPE_DS1743_DOM 0x1ffd /* Day of Month */
302#define TODC_TYPE_DS1743_DOW 0x1ffc /* Day of Week */
303#define TODC_TYPE_DS1743_HOURS 0x1ffb
304#define TODC_TYPE_DS1743_MINUTES 0x1ffa
305#define TODC_TYPE_DS1743_SECONDS 0x1ff9
306#define TODC_TYPE_DS1743_CNTL_B 0x1ff9
307#define TODC_TYPE_DS1743_CNTL_A 0x1ff8 /* control_a R/W regs */
308#define TODC_TYPE_DS1743_WATCHDOG 0x1fff
309#define TODC_TYPE_DS1743_INTERRUPTS 0x1fff
310#define TODC_TYPE_DS1743_ALARM_DATE 0x1fff
311#define TODC_TYPE_DS1743_ALARM_HOUR 0x1fff
312#define TODC_TYPE_DS1743_ALARM_MINUTES 0x1fff
313#define TODC_TYPE_DS1743_ALARM_SECONDS 0x1fff
314#define TODC_TYPE_DS1743_CENTURY 0x1ff8
315#define TODC_TYPE_DS1743_FLAGS 0x1fff
316#define TODC_TYPE_DS1743_NVRAM_ADDR_REG 0
317#define TODC_TYPE_DS1743_NVRAM_DATA_REG 0
318
319#define TODC_TYPE_DS1746_NVRAM_SIZE 0x1fff8
320#define TODC_TYPE_DS1746_SW_FLAGS 0
321#define TODC_TYPE_DS1746_YEAR 0x1ffff
322#define TODC_TYPE_DS1746_MONTH 0x1fffe
323#define TODC_TYPE_DS1746_DOM 0x1fffd /* Day of Month */
324#define TODC_TYPE_DS1746_DOW 0x1fffc /* Day of Week */
325#define TODC_TYPE_DS1746_HOURS 0x1fffb
326#define TODC_TYPE_DS1746_MINUTES 0x1fffa
327#define TODC_TYPE_DS1746_SECONDS 0x1fff9
328#define TODC_TYPE_DS1746_CNTL_B 0x1fff9
329#define TODC_TYPE_DS1746_CNTL_A 0x1fff8 /* control_a R/W regs */
330#define TODC_TYPE_DS1746_WATCHDOG 0x00000
331#define TODC_TYPE_DS1746_INTERRUPTS 0x00000
332#define TODC_TYPE_DS1746_ALARM_DATE 0x00000
333#define TODC_TYPE_DS1746_ALARM_HOUR 0x00000
334#define TODC_TYPE_DS1746_ALARM_MINUTES 0x00000
335#define TODC_TYPE_DS1746_ALARM_SECONDS 0x00000
336#define TODC_TYPE_DS1746_CENTURY 0x00000
337#define TODC_TYPE_DS1746_FLAGS 0x00000
338#define TODC_TYPE_DS1746_NVRAM_ADDR_REG 0
339#define TODC_TYPE_DS1746_NVRAM_DATA_REG 0
340
341#define TODC_TYPE_DS1747_NVRAM_SIZE 0x7fff8
342#define TODC_TYPE_DS1747_SW_FLAGS 0
343#define TODC_TYPE_DS1747_YEAR 0x7ffff
344#define TODC_TYPE_DS1747_MONTH 0x7fffe
345#define TODC_TYPE_DS1747_DOM 0x7fffd /* Day of Month */
346#define TODC_TYPE_DS1747_DOW 0x7fffc /* Day of Week */
347#define TODC_TYPE_DS1747_HOURS 0x7fffb
348#define TODC_TYPE_DS1747_MINUTES 0x7fffa
349#define TODC_TYPE_DS1747_SECONDS 0x7fff9
350#define TODC_TYPE_DS1747_CNTL_B 0x7fff9
351#define TODC_TYPE_DS1747_CNTL_A 0x7fff8 /* control_a R/W regs */
352#define TODC_TYPE_DS1747_WATCHDOG 0x00000
353#define TODC_TYPE_DS1747_INTERRUPTS 0x00000
354#define TODC_TYPE_DS1747_ALARM_DATE 0x00000
355#define TODC_TYPE_DS1747_ALARM_HOUR 0x00000
356#define TODC_TYPE_DS1747_ALARM_MINUTES 0x00000
357#define TODC_TYPE_DS1747_ALARM_SECONDS 0x00000
358#define TODC_TYPE_DS1747_CENTURY 0x00000
359#define TODC_TYPE_DS1747_FLAGS 0x00000
360#define TODC_TYPE_DS1747_NVRAM_ADDR_REG 0
361#define TODC_TYPE_DS1747_NVRAM_DATA_REG 0
362
363#define TODC_TYPE_DS17285_NVRAM_SIZE (0x1000-0x80) /* 4Kx8 NVRAM (minus RTC regs) */
364#define TODC_TYPE_DS17285_SW_FLAGS TODC_FLAG_2_LEVEL_NVRAM
365#define TODC_TYPE_DS17285_SECONDS (TODC_TYPE_DS17285_NVRAM_SIZE + 0x00)
366#define TODC_TYPE_DS17285_ALARM_SECONDS (TODC_TYPE_DS17285_NVRAM_SIZE + 0x01)
367#define TODC_TYPE_DS17285_MINUTES (TODC_TYPE_DS17285_NVRAM_SIZE + 0x02)
368#define TODC_TYPE_DS17285_ALARM_MINUTES (TODC_TYPE_DS17285_NVRAM_SIZE + 0x03)
369#define TODC_TYPE_DS17285_HOURS (TODC_TYPE_DS17285_NVRAM_SIZE + 0x04)
370#define TODC_TYPE_DS17285_ALARM_HOUR (TODC_TYPE_DS17285_NVRAM_SIZE + 0x05)
371#define TODC_TYPE_DS17285_DOW (TODC_TYPE_DS17285_NVRAM_SIZE + 0x06)
372#define TODC_TYPE_DS17285_DOM (TODC_TYPE_DS17285_NVRAM_SIZE + 0x07)
373#define TODC_TYPE_DS17285_MONTH (TODC_TYPE_DS17285_NVRAM_SIZE + 0x08)
374#define TODC_TYPE_DS17285_YEAR (TODC_TYPE_DS17285_NVRAM_SIZE + 0x09)
375#define TODC_TYPE_DS17285_CNTL_A (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0A)
376#define TODC_TYPE_DS17285_CNTL_B (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0B)
377#define TODC_TYPE_DS17285_CNTL_C (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0C)
378#define TODC_TYPE_DS17285_CNTL_D (TODC_TYPE_DS17285_NVRAM_SIZE + 0x0D)
379#define TODC_TYPE_DS17285_WATCHDOG 0
380#define TODC_TYPE_DS17285_INTERRUPTS 0
381#define TODC_TYPE_DS17285_ALARM_DATE 0
382#define TODC_TYPE_DS17285_CENTURY 0
383#define TODC_TYPE_DS17285_FLAGS 0
384#define TODC_TYPE_DS17285_NVRAM_ADDR_REG 0x50
385#define TODC_TYPE_DS17285_NVRAM_DATA_REG 0x53
386
387#define TODC_TYPE_MC146818_NVRAM_SIZE 0 /* XXXX */
388#define TODC_TYPE_MC146818_SW_FLAGS 0
389#define TODC_TYPE_MC146818_YEAR 0x09
390#define TODC_TYPE_MC146818_MONTH 0x08
391#define TODC_TYPE_MC146818_DOM 0x07 /* Day of Month */
392#define TODC_TYPE_MC146818_DOW 0x06 /* Day of Week */
393#define TODC_TYPE_MC146818_HOURS 0x04
394#define TODC_TYPE_MC146818_MINUTES 0x02
395#define TODC_TYPE_MC146818_SECONDS 0x00
396#define TODC_TYPE_MC146818_CNTL_B 0x0a
397#define TODC_TYPE_MC146818_CNTL_A 0x0b /* control_a R/W regs */
398#define TODC_TYPE_MC146818_WATCHDOG 0
399#define TODC_TYPE_MC146818_INTERRUPTS 0x0c
400#define TODC_TYPE_MC146818_ALARM_DATE 0xff
401#define TODC_TYPE_MC146818_ALARM_HOUR 0x05
402#define TODC_TYPE_MC146818_ALARM_MINUTES 0x03
403#define TODC_TYPE_MC146818_ALARM_SECONDS 0x01
404#define TODC_TYPE_MC146818_CENTURY 0xff
405#define TODC_TYPE_MC146818_FLAGS 0xff
406#define TODC_TYPE_MC146818_NVRAM_ADDR_REG 0
407#define TODC_TYPE_MC146818_NVRAM_DATA_REG 0
408
409#define TODC_TYPE_PC97307_NVRAM_SIZE 0 /* No NVRAM? */
410#define TODC_TYPE_PC97307_SW_FLAGS 0
411#define TODC_TYPE_PC97307_YEAR 0x09
412#define TODC_TYPE_PC97307_MONTH 0x08
413#define TODC_TYPE_PC97307_DOM 0x07 /* Day of Month */
414#define TODC_TYPE_PC97307_DOW 0x06 /* Day of Week */
415#define TODC_TYPE_PC97307_HOURS 0x04
416#define TODC_TYPE_PC97307_MINUTES 0x02
417#define TODC_TYPE_PC97307_SECONDS 0x00
418#define TODC_TYPE_PC97307_CNTL_B 0x0a
419#define TODC_TYPE_PC97307_CNTL_A 0x0b /* control_a R/W regs */
420#define TODC_TYPE_PC97307_WATCHDOG 0x0c
421#define TODC_TYPE_PC97307_INTERRUPTS 0x0d
422#define TODC_TYPE_PC97307_ALARM_DATE 0xff
423#define TODC_TYPE_PC97307_ALARM_HOUR 0x05
424#define TODC_TYPE_PC97307_ALARM_MINUTES 0x03
425#define TODC_TYPE_PC97307_ALARM_SECONDS 0x01
426#define TODC_TYPE_PC97307_CENTURY 0xff
427#define TODC_TYPE_PC97307_FLAGS 0xff
428#define TODC_TYPE_PC97307_NVRAM_ADDR_REG 0
429#define TODC_TYPE_PC97307_NVRAM_DATA_REG 0
430
431/*
432 * Define macros to allocate and init the todc_info_t table that will
433 * be used by the todc_time.c routines.
434 */
435#define TODC_ALLOC() \
436 static todc_info_t todc_info_alloc; \
437 todc_info_t *todc_info = &todc_info_alloc;
438
439#define TODC_INIT(clock_type, as0, as1, data, bits) { \
440 todc_info->rtc_type = clock_type; \
441 \
442 todc_info->nvram_as0 = (unsigned int)(as0); \
443 todc_info->nvram_as1 = (unsigned int)(as1); \
444 todc_info->nvram_data = (unsigned int)(data); \
445 \
446 todc_info->as0_bits = (bits); \
447 \
448 todc_info->nvram_size = clock_type ##_NVRAM_SIZE; \
449 todc_info->sw_flags = clock_type ##_SW_FLAGS; \
450 \
451 todc_info->year = clock_type ##_YEAR; \
452 todc_info->month = clock_type ##_MONTH; \
453 todc_info->day_of_month = clock_type ##_DOM; \
454 todc_info->day_of_week = clock_type ##_DOW; \
455 todc_info->hours = clock_type ##_HOURS; \
456 todc_info->minutes = clock_type ##_MINUTES; \
457 todc_info->seconds = clock_type ##_SECONDS; \
458 todc_info->control_b = clock_type ##_CNTL_B; \
459 todc_info->control_a = clock_type ##_CNTL_A; \
460 todc_info->watchdog = clock_type ##_WATCHDOG; \
461 todc_info->interrupts = clock_type ##_INTERRUPTS; \
462 todc_info->alarm_date = clock_type ##_ALARM_DATE; \
463 todc_info->alarm_hour = clock_type ##_ALARM_HOUR; \
464 todc_info->alarm_minutes = clock_type ##_ALARM_MINUTES; \
465 todc_info->alarm_seconds = clock_type ##_ALARM_SECONDS; \
466 todc_info->century = clock_type ##_CENTURY; \
467 todc_info->flags = clock_type ##_FLAGS; \
468 \
469 todc_info->nvram_addr_reg = clock_type ##_NVRAM_ADDR_REG; \
470 todc_info->nvram_data_reg = clock_type ##_NVRAM_DATA_REG; \
471}
472
473extern todc_info_t *todc_info;
474
475unsigned char todc_direct_read_val(int addr);
476void todc_direct_write_val(int addr, unsigned char val);
477unsigned char todc_m48txx_read_val(int addr);
478void todc_m48txx_write_val(int addr, unsigned char val);
479unsigned char todc_mc146818_read_val(int addr);
480void todc_mc146818_write_val(int addr, unsigned char val);
481
482long todc_time_init(void);
483void todc_get_rtc_time(struct rtc_time *);
484int todc_set_rtc_time(struct rtc_time *);
485void todc_calibrate_decr(void);
486
487#endif /* __PPC_KERNEL_TODC_H */
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index 8f7ee16781a4..50c014007de7 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -32,7 +32,14 @@ static inline int node_to_first_cpu(int node)
32int of_node_to_nid(struct device_node *device); 32int of_node_to_nid(struct device_node *device);
33 33
34struct pci_bus; 34struct pci_bus;
35#ifdef CONFIG_PCI
35extern int pcibus_to_node(struct pci_bus *bus); 36extern int pcibus_to_node(struct pci_bus *bus);
37#else
38static inline int pcibus_to_node(struct pci_bus *bus)
39{
40 return -1;
41}
42#endif
36 43
37#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \ 44#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
38 CPU_MASK_ALL : \ 45 CPU_MASK_ALL : \
@@ -96,7 +103,13 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev,
96 103
97#ifdef CONFIG_SMP 104#ifdef CONFIG_SMP
98#include <asm/cputable.h> 105#include <asm/cputable.h>
99#define smt_capable() (cpu_has_feature(CPU_FTR_SMT)) 106#define smt_capable() (cpu_has_feature(CPU_FTR_SMT))
107
108#ifdef CONFIG_PPC64
109#include <asm/smp.h>
110
111#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
112#endif
100#endif 113#endif
101 114
102#endif /* __KERNEL__ */ 115#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/tsi108.h b/include/asm-powerpc/tsi108.h
index 2c702d35a7cf..4e95d153be84 100644
--- a/include/asm-powerpc/tsi108.h
+++ b/include/asm-powerpc/tsi108.h
@@ -98,12 +98,12 @@ typedef struct {
98extern u32 get_vir_csrbase(void); 98extern u32 get_vir_csrbase(void);
99extern u32 tsi108_csr_vir_base; 99extern u32 tsi108_csr_vir_base;
100 100
101extern inline u32 tsi108_read_reg(u32 reg_offset) 101static inline u32 tsi108_read_reg(u32 reg_offset)
102{ 102{
103 return in_be32((volatile u32 *)(tsi108_csr_vir_base + reg_offset)); 103 return in_be32((volatile u32 *)(tsi108_csr_vir_base + reg_offset));
104} 104}
105 105
106extern inline void tsi108_write_reg(u32 reg_offset, u32 val) 106static inline void tsi108_write_reg(u32 reg_offset, u32 val)
107{ 107{
108 out_be32((volatile u32 *)(tsi108_csr_vir_base + reg_offset), val); 108 out_be32((volatile u32 *)(tsi108_csr_vir_base + reg_offset), val);
109} 109}
diff --git a/include/asm-powerpc/types.h b/include/asm-powerpc/types.h
index d6fb56b80453..3b363757a2bb 100644
--- a/include/asm-powerpc/types.h
+++ b/include/asm-powerpc/types.h
@@ -97,16 +97,6 @@ typedef struct {
97 unsigned long env; 97 unsigned long env;
98} func_descr_t; 98} func_descr_t;
99 99
100#ifdef CONFIG_LBD
101typedef u64 sector_t;
102#define HAVE_SECTOR_T
103#endif
104
105#ifdef CONFIG_LSF
106typedef u64 blkcnt_t;
107#define HAVE_BLKCNT_T
108#endif
109
110#endif /* __ASSEMBLY__ */ 100#endif /* __ASSEMBLY__ */
111 101
112#endif /* __KERNEL__ */ 102#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h
index d83fc29c2bbf..adbf16b8cfbb 100644
--- a/include/asm-powerpc/uaccess.h
+++ b/include/asm-powerpc/uaccess.h
@@ -304,7 +304,7 @@ extern unsigned long __copy_tofrom_user(void __user *to,
304 304
305#ifndef __powerpc64__ 305#ifndef __powerpc64__
306 306
307extern inline unsigned long copy_from_user(void *to, 307static inline unsigned long copy_from_user(void *to,
308 const void __user *from, unsigned long n) 308 const void __user *from, unsigned long n)
309{ 309{
310 unsigned long over; 310 unsigned long over;
@@ -319,7 +319,7 @@ extern inline unsigned long copy_from_user(void *to,
319 return n; 319 return n;
320} 320}
321 321
322extern inline unsigned long copy_to_user(void __user *to, 322static inline unsigned long copy_to_user(void __user *to,
323 const void *from, unsigned long n) 323 const void *from, unsigned long n)
324{ 324{
325 unsigned long over; 325 unsigned long over;
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index b5fe93291c96..0ae954e3d258 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -323,129 +323,20 @@
323#define __NR_faccessat 298 323#define __NR_faccessat 298
324#define __NR_get_robust_list 299 324#define __NR_get_robust_list 299
325#define __NR_set_robust_list 300 325#define __NR_set_robust_list 300
326#define __NR_move_pages 301
326 327
327#ifdef __KERNEL__ 328#ifdef __KERNEL__
328 329
329#define __NR_syscalls 301 330#define __NR_syscalls 302
330 331
331#define __NR__exit __NR_exit 332#define __NR__exit __NR_exit
332#define NR_syscalls __NR_syscalls 333#define NR_syscalls __NR_syscalls
333 334
334#ifndef __ASSEMBLY__ 335#ifndef __ASSEMBLY__
335 336
336/* On powerpc a system call basically clobbers the same registers like a
337 * function call, with the exception of LR (which is needed for the
338 * "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal
339 * an error return status).
340 */
341
342#define __syscall_nr(nr, type, name, args...) \
343 unsigned long __sc_ret, __sc_err; \
344 { \
345 register unsigned long __sc_0 __asm__ ("r0"); \
346 register unsigned long __sc_3 __asm__ ("r3"); \
347 register unsigned long __sc_4 __asm__ ("r4"); \
348 register unsigned long __sc_5 __asm__ ("r5"); \
349 register unsigned long __sc_6 __asm__ ("r6"); \
350 register unsigned long __sc_7 __asm__ ("r7"); \
351 register unsigned long __sc_8 __asm__ ("r8"); \
352 \
353 __sc_loadargs_##nr(name, args); \
354 __asm__ __volatile__ \
355 ("sc \n\t" \
356 "mfcr %0 " \
357 : "=&r" (__sc_0), \
358 "=&r" (__sc_3), "=&r" (__sc_4), \
359 "=&r" (__sc_5), "=&r" (__sc_6), \
360 "=&r" (__sc_7), "=&r" (__sc_8) \
361 : __sc_asm_input_##nr \
362 : "cr0", "ctr", "memory", \
363 "r9", "r10","r11", "r12"); \
364 __sc_ret = __sc_3; \
365 __sc_err = __sc_0; \
366 } \
367 if (__sc_err & 0x10000000) \
368 { \
369 errno = __sc_ret; \
370 __sc_ret = -1; \
371 } \
372 return (type) __sc_ret
373
374#define __sc_loadargs_0(name, dummy...) \
375 __sc_0 = __NR_##name
376#define __sc_loadargs_1(name, arg1) \
377 __sc_loadargs_0(name); \
378 __sc_3 = (unsigned long) (arg1)
379#define __sc_loadargs_2(name, arg1, arg2) \
380 __sc_loadargs_1(name, arg1); \
381 __sc_4 = (unsigned long) (arg2)
382#define __sc_loadargs_3(name, arg1, arg2, arg3) \
383 __sc_loadargs_2(name, arg1, arg2); \
384 __sc_5 = (unsigned long) (arg3)
385#define __sc_loadargs_4(name, arg1, arg2, arg3, arg4) \
386 __sc_loadargs_3(name, arg1, arg2, arg3); \
387 __sc_6 = (unsigned long) (arg4)
388#define __sc_loadargs_5(name, arg1, arg2, arg3, arg4, arg5) \
389 __sc_loadargs_4(name, arg1, arg2, arg3, arg4); \
390 __sc_7 = (unsigned long) (arg5)
391#define __sc_loadargs_6(name, arg1, arg2, arg3, arg4, arg5, arg6) \
392 __sc_loadargs_5(name, arg1, arg2, arg3, arg4, arg5); \
393 __sc_8 = (unsigned long) (arg6)
394
395#define __sc_asm_input_0 "0" (__sc_0)
396#define __sc_asm_input_1 __sc_asm_input_0, "1" (__sc_3)
397#define __sc_asm_input_2 __sc_asm_input_1, "2" (__sc_4)
398#define __sc_asm_input_3 __sc_asm_input_2, "3" (__sc_5)
399#define __sc_asm_input_4 __sc_asm_input_3, "4" (__sc_6)
400#define __sc_asm_input_5 __sc_asm_input_4, "5" (__sc_7)
401#define __sc_asm_input_6 __sc_asm_input_5, "6" (__sc_8)
402
403#define _syscall0(type,name) \
404type name(void) \
405{ \
406 __syscall_nr(0, type, name); \
407}
408
409#define _syscall1(type,name,type1,arg1) \
410type name(type1 arg1) \
411{ \
412 __syscall_nr(1, type, name, arg1); \
413}
414
415#define _syscall2(type,name,type1,arg1,type2,arg2) \
416type name(type1 arg1, type2 arg2) \
417{ \
418 __syscall_nr(2, type, name, arg1, arg2); \
419}
420
421#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
422type name(type1 arg1, type2 arg2, type3 arg3) \
423{ \
424 __syscall_nr(3, type, name, arg1, arg2, arg3); \
425}
426
427#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
428type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
429{ \
430 __syscall_nr(4, type, name, arg1, arg2, arg3, arg4); \
431}
432
433#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
434type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
435{ \
436 __syscall_nr(5, type, name, arg1, arg2, arg3, arg4, arg5); \
437}
438#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
439type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
440{ \
441 __syscall_nr(6, type, name, arg1, arg2, arg3, arg4, arg5, arg6); \
442}
443
444
445#include <linux/types.h> 337#include <linux/types.h>
446#include <linux/compiler.h> 338#include <linux/compiler.h>
447#include <linux/linkage.h> 339#include <linux/linkage.h>
448#include <asm/syscalls.h>
449 340
450#define __ARCH_WANT_IPC_PARSE_VERSION 341#define __ARCH_WANT_IPC_PARSE_VERSION
451#define __ARCH_WANT_OLD_READDIR 342#define __ARCH_WANT_OLD_READDIR
@@ -480,16 +371,9 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
480 371
481/* 372/*
482 * "Conditional" syscalls 373 * "Conditional" syscalls
483 *
484 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
485 * but it doesn't work on all toolchains, so we just do it by hand
486 */ 374 */
487#ifdef CONFIG_PPC32 375#define cond_syscall(x) \
488#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 376 asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
489#else
490#define cond_syscall(x) asm(".weak\t." #x "\n\t.set\t." #x ",.sys_ni_syscall")
491#endif
492
493 377
494#endif /* __ASSEMBLY__ */ 378#endif /* __ASSEMBLY__ */
495#endif /* __KERNEL__ */ 379#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index 4b51d42e1419..0117b544ecbc 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -45,7 +45,6 @@ struct iommu_table;
45 * The vio_dev structure is used to describe virtual I/O devices. 45 * The vio_dev structure is used to describe virtual I/O devices.
46 */ 46 */
47struct vio_dev { 47struct vio_dev {
48 struct iommu_table *iommu_table; /* vio_map_* uses this */
49 const char *name; 48 const char *name;
50 const char *type; 49 const char *type;
51 uint32_t unit_address; 50 uint32_t unit_address;
diff --git a/include/asm-powerpc/xmon.h b/include/asm-powerpc/xmon.h
index f1d337ed68d5..88320a05f0a8 100644
--- a/include/asm-powerpc/xmon.h
+++ b/include/asm-powerpc/xmon.h
@@ -14,8 +14,10 @@
14 14
15#ifdef CONFIG_XMON 15#ifdef CONFIG_XMON
16extern void xmon_setup(void); 16extern void xmon_setup(void);
17extern void xmon_register_spus(struct list_head *list);
17#else 18#else
18static inline void xmon_setup(void) { }; 19static inline void xmon_setup(void) { };
20static inline void xmon_register_spus(struct list_head *list) { };
19#endif 21#endif
20 22
21#endif /* __KERNEL __ */ 23#endif /* __KERNEL __ */
diff --git a/include/asm-ppc/device.h b/include/asm-ppc/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-ppc/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-ppc/highmem.h b/include/asm-ppc/highmem.h
index 1d2c4ef81c22..f7b21ee302b4 100644
--- a/include/asm-ppc/highmem.h
+++ b/include/asm-ppc/highmem.h
@@ -79,7 +79,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type)
79 unsigned long vaddr; 79 unsigned long vaddr;
80 80
81 /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */ 81 /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
82 inc_preempt_count(); 82 pagefault_disable();
83 if (!PageHighMem(page)) 83 if (!PageHighMem(page))
84 return page_address(page); 84 return page_address(page);
85 85
@@ -101,8 +101,7 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
101 unsigned int idx = type + KM_TYPE_NR*smp_processor_id(); 101 unsigned int idx = type + KM_TYPE_NR*smp_processor_id();
102 102
103 if (vaddr < KMAP_FIX_BEGIN) { // FIXME 103 if (vaddr < KMAP_FIX_BEGIN) { // FIXME
104 dec_preempt_count(); 104 pagefault_enable();
105 preempt_check_resched();
106 return; 105 return;
107 } 106 }
108 107
@@ -115,8 +114,7 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type)
115 pte_clear(&init_mm, vaddr, kmap_pte+idx); 114 pte_clear(&init_mm, vaddr, kmap_pte+idx);
116 flush_tlb_page(NULL, vaddr); 115 flush_tlb_page(NULL, vaddr);
117#endif 116#endif
118 dec_preempt_count(); 117 pagefault_enable();
119 preempt_check_resched();
120} 118}
121 119
122static inline struct page *kmap_atomic_to_page(void *ptr) 120static inline struct page *kmap_atomic_to_page(void *ptr)
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index a4c411b753ef..ccf1a9bb2e43 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -26,17 +26,11 @@
26 26
27#if defined(CONFIG_4xx) 27#if defined(CONFIG_4xx)
28#include <asm/ibm4xx.h> 28#include <asm/ibm4xx.h>
29#elif defined(CONFIG_PPC_MPC52xx)
30#include <asm/mpc52xx.h>
31#elif defined(CONFIG_8xx) 29#elif defined(CONFIG_8xx)
32#include <asm/mpc8xx.h> 30#include <asm/mpc8xx.h>
33#elif defined(CONFIG_8260) 31#elif defined(CONFIG_8260)
34#include <asm/mpc8260.h> 32#include <asm/mpc8260.h>
35#elif defined(CONFIG_83xx) 33#elif defined(CONFIG_APUS) || !defined(CONFIG_PCI)
36#include <asm/mpc83xx.h>
37#elif defined(CONFIG_85xx)
38#include <asm/mpc85xx.h>
39#elif defined(CONFIG_APUS)
40#define _IO_BASE 0 34#define _IO_BASE 0
41#define _ISA_MEM_BASE 0 35#define _ISA_MEM_BASE 0
42#define PCI_DRAM_OFFSET 0 36#define PCI_DRAM_OFFSET 0
@@ -237,6 +231,14 @@ static inline void __raw_writel(__u32 b, volatile void __iomem *addr)
237#define insl(port, buf, nl) _insl_ns((port)+___IO_BASE, (buf), (nl)) 231#define insl(port, buf, nl) _insl_ns((port)+___IO_BASE, (buf), (nl))
238#define outsl(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl)) 232#define outsl(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl))
239 233
234#define readsb(a, b, n) _insb((a), (b), (n))
235#define readsw(a, b, n) _insw_ns((a), (b), (n))
236#define readsl(a, b, n) _insl_ns((a), (b), (n))
237#define writesb(a, b, n) _outsb((a),(b),(n))
238#define writesw(a, b, n) _outsw_ns((a),(b),(n))
239#define writesl(a, b, n) _outsl_ns((a),(b),(n))
240
241
240/* 242/*
241 * On powermacs and 8xx we will get a machine check exception 243 * On powermacs and 8xx we will get a machine check exception
242 * if we try to read data from a non-existent I/O port. Because 244 * if we try to read data from a non-existent I/O port. Because
@@ -327,12 +329,12 @@ __do_out_asm(outl, "stwbrx")
327#define inl_p(port) inl((port)) 329#define inl_p(port) inl((port))
328#define outl_p(val, port) outl((val), (port)) 330#define outl_p(val, port) outl((val), (port))
329 331
330extern void _insb(volatile u8 __iomem *port, void *buf, long count); 332extern void _insb(const volatile u8 __iomem *addr, void *buf, long count);
331extern void _outsb(volatile u8 __iomem *port, const void *buf, long count); 333extern void _outsb(volatile u8 __iomem *addr,const void *buf,long count);
332extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count); 334extern void _insw_ns(const volatile u16 __iomem *addr, void *buf, long count);
333extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count); 335extern void _outsw_ns(volatile u16 __iomem *addr, const void *buf, long count);
334extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count); 336extern void _insl_ns(const volatile u32 __iomem *addr, void *buf, long count);
335extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count); 337extern void _outsl_ns(volatile u32 __iomem *addr, const void *buf, long count);
336 338
337 339
338#define IO_SPACE_LIMIT ~0 340#define IO_SPACE_LIMIT ~0
diff --git a/include/asm-ppc/m48t35.h b/include/asm-ppc/m48t35.h
index f3c5e5dfa986..a5277ea4b194 100644
--- a/include/asm-ppc/m48t35.h
+++ b/include/asm-ppc/m48t35.h
@@ -39,7 +39,7 @@
39#define M48T35_RTC_WATCHDOG_RB 0x03 39#define M48T35_RTC_WATCHDOG_RB 0x03
40#define M48T35_RTC_WATCHDOG_BMB 0x7c 40#define M48T35_RTC_WATCHDOG_BMB 0x7c
41#define M48T35_RTC_WATCHDOG_WDS 0x80 41#define M48T35_RTC_WATCHDOG_WDS 0x80
42#define M48T35_RTC_WATCHDOG_ALL (M48T35_RTC_WATCHDOG_RB|M48T35_RTC_WATCHDOG_BMB|M48T35_RTC_W 42#define M48T35_RTC_WATCHDOG_ALL (M48T35_RTC_WATCHDOG_RB|M48T35_RTC_WATCHDOG_BMB|M48T35_RTC_W)
43 43
44#define M48T35_RTC_CONTROL_WRITE 0x80 44#define M48T35_RTC_CONTROL_WRITE 0x80
45#define M48T35_RTC_CONTROL_READ 0x40 45#define M48T35_RTC_CONTROL_READ 0x40
diff --git a/include/asm-ppc/mpc52xx.h b/include/asm-ppc/mpc52xx.h
index 64c8874618dc..d9d21aa68ba3 100644
--- a/include/asm-ppc/mpc52xx.h
+++ b/include/asm-ppc/mpc52xx.h
@@ -29,17 +29,6 @@ struct pt_regs;
29#endif /* __ASSEMBLY__ */ 29#endif /* __ASSEMBLY__ */
30 30
31 31
32#ifdef CONFIG_PCI
33#define _IO_BASE isa_io_base
34#define _ISA_MEM_BASE isa_mem_base
35#define PCI_DRAM_OFFSET pci_dram_offset
36#else
37#define _IO_BASE 0
38#define _ISA_MEM_BASE 0
39#define PCI_DRAM_OFFSET 0
40#endif
41
42
43/* ======================================================================== */ 32/* ======================================================================== */
44/* PPC Sys devices definition */ 33/* PPC Sys devices definition */
45/* ======================================================================== */ 34/* ======================================================================== */
diff --git a/include/asm-ppc/mpc83xx.h b/include/asm-ppc/mpc83xx.h
index 02ed2c325714..c3061972309b 100644
--- a/include/asm-ppc/mpc83xx.h
+++ b/include/asm-ppc/mpc83xx.h
@@ -25,14 +25,6 @@
25#include <platforms/83xx/mpc834x_sys.h> 25#include <platforms/83xx/mpc834x_sys.h>
26#endif 26#endif
27 27
28#define _IO_BASE isa_io_base
29#define _ISA_MEM_BASE isa_mem_base
30#ifdef CONFIG_PCI
31#define PCI_DRAM_OFFSET pci_dram_offset
32#else
33#define PCI_DRAM_OFFSET 0
34#endif
35
36/* 28/*
37 * The "residual" board information structure the boot loader passes 29 * The "residual" board information structure the boot loader passes
38 * into the kernel. 30 * into the kernel.
diff --git a/include/asm-ppc/mpc85xx.h b/include/asm-ppc/mpc85xx.h
index 9b4851199c76..d7e4a79d77fb 100644
--- a/include/asm-ppc/mpc85xx.h
+++ b/include/asm-ppc/mpc85xx.h
@@ -44,14 +44,6 @@
44#include <platforms/85xx/tqm85xx.h> 44#include <platforms/85xx/tqm85xx.h>
45#endif 45#endif
46 46
47#define _IO_BASE isa_io_base
48#define _ISA_MEM_BASE isa_mem_base
49#ifdef CONFIG_PCI
50#define PCI_DRAM_OFFSET pci_dram_offset
51#else
52#define PCI_DRAM_OFFSET 0
53#endif
54
55/* 47/*
56 * The "residual" board information structure the boot loader passes 48 * The "residual" board information structure the boot loader passes
57 * into the kernel. 49 * into the kernel.
diff --git a/include/asm-ppc/pci-bridge.h b/include/asm-ppc/pci-bridge.h
index 9d5230689b31..6c955d0c1ef0 100644
--- a/include/asm-ppc/pci-bridge.h
+++ b/include/asm-ppc/pci-bridge.h
@@ -43,6 +43,7 @@ struct pci_controller {
43 struct pci_controller *next; 43 struct pci_controller *next;
44 struct pci_bus *bus; 44 struct pci_bus *bus;
45 void *arch_data; 45 void *arch_data;
46 struct device *parent;
46 47
47 int first_busno; 48 int first_busno;
48 int last_busno; 49 int last_busno;
diff --git a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h
index 37c362d89fad..0a3cd7ec8451 100644
--- a/include/asm-s390/checksum.h
+++ b/include/asm-s390/checksum.h
@@ -27,8 +27,8 @@
27 * 27 *
28 * it's best to have buff aligned on a 32-bit boundary 28 * it's best to have buff aligned on a 32-bit boundary
29 */ 29 */
30static inline unsigned int 30static inline __wsum
31csum_partial(const unsigned char * buff, int len, unsigned int sum) 31csum_partial(const void *buff, int len, __wsum sum)
32{ 32{
33 register unsigned long reg2 asm("2") = (unsigned long) buff; 33 register unsigned long reg2 asm("2") = (unsigned long) buff;
34 register unsigned long reg3 asm("3") = (unsigned long) len; 34 register unsigned long reg3 asm("3") = (unsigned long) len;
@@ -49,9 +49,9 @@ csum_partial(const unsigned char * buff, int len, unsigned int sum)
49 * Copy from userspace and compute checksum. If we catch an exception 49 * Copy from userspace and compute checksum. If we catch an exception
50 * then zero the rest of the buffer. 50 * then zero the rest of the buffer.
51 */ 51 */
52static inline unsigned int 52static inline __wsum
53csum_partial_copy_from_user(const char __user *src, char *dst, 53csum_partial_copy_from_user(const void __user *src, void *dst,
54 int len, unsigned int sum, 54 int len, __wsum sum,
55 int *err_ptr) 55 int *err_ptr)
56{ 56{
57 int missing; 57 int missing;
@@ -66,8 +66,8 @@ csum_partial_copy_from_user(const char __user *src, char *dst,
66} 66}
67 67
68 68
69static inline unsigned int 69static inline __wsum
70csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum) 70csum_partial_copy_nocheck (const void *src, void *dst, int len, __wsum sum)
71{ 71{
72 memcpy(dst,src,len); 72 memcpy(dst,src,len);
73 return csum_partial(dst, len, sum); 73 return csum_partial(dst, len, sum);
@@ -76,8 +76,7 @@ csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum
76/* 76/*
77 * Fold a partial checksum without adding pseudo headers 77 * Fold a partial checksum without adding pseudo headers
78 */ 78 */
79static inline unsigned short 79static inline __sum16 csum_fold(__wsum sum)
80csum_fold(unsigned int sum)
81{ 80{
82#ifndef __s390x__ 81#ifndef __s390x__
83 register_pair rp; 82 register_pair rp;
@@ -100,7 +99,7 @@ csum_fold(unsigned int sum)
100 " srl %0,16\n" /* %0 = H+L+C */ 99 " srl %0,16\n" /* %0 = H+L+C */
101 : "+&d" (sum) : : "cc", "2", "3"); 100 : "+&d" (sum) : : "cc", "2", "3");
102#endif /* __s390x__ */ 101#endif /* __s390x__ */
103 return ((unsigned short) ~sum); 102 return (__force __sum16) ~sum;
104} 103}
105 104
106/* 105/*
@@ -108,8 +107,7 @@ csum_fold(unsigned int sum)
108 * which always checksum on 4 octet boundaries. 107 * which always checksum on 4 octet boundaries.
109 * 108 *
110 */ 109 */
111static inline unsigned short 110static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
112ip_fast_csum(unsigned char *iph, unsigned int ihl)
113{ 111{
114 return csum_fold(csum_partial(iph, ihl*4, 0)); 112 return csum_fold(csum_partial(iph, ihl*4, 0));
115} 113}
@@ -118,10 +116,10 @@ ip_fast_csum(unsigned char *iph, unsigned int ihl)
118 * computes the checksum of the TCP/UDP pseudo-header 116 * computes the checksum of the TCP/UDP pseudo-header
119 * returns a 32-bit checksum 117 * returns a 32-bit checksum
120 */ 118 */
121static inline unsigned int 119static inline __wsum
122csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 120csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
123 unsigned short len, unsigned short proto, 121 unsigned short len, unsigned short proto,
124 unsigned int sum) 122 __wsum sum)
125{ 123{
126#ifndef __s390x__ 124#ifndef __s390x__
127 asm volatile( 125 asm volatile(
@@ -137,12 +135,12 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
137 "1:" 135 "1:"
138 : "+&d" (sum) : "d" (daddr) : "cc"); 136 : "+&d" (sum) : "d" (daddr) : "cc");
139 asm volatile( 137 asm volatile(
140 " alr %0,%1\n" /* sum += (len<<16) + (proto<<8) */ 138 " alr %0,%1\n" /* sum += len + proto */
141 " brc 12,2f\n" 139 " brc 12,2f\n"
142 " ahi %0,1\n" /* add carry */ 140 " ahi %0,1\n" /* add carry */
143 "2:" 141 "2:"
144 : "+&d" (sum) 142 : "+&d" (sum)
145 : "d" (((unsigned int) len<<16) + (unsigned int) proto) 143 : "d" (len + proto)
146 : "cc"); 144 : "cc");
147#else /* __s390x__ */ 145#else /* __s390x__ */
148 asm volatile( 146 asm volatile(
@@ -153,7 +151,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
153 "0: algr %0,%2\n" /* sum += daddr */ 151 "0: algr %0,%2\n" /* sum += daddr */
154 " brc 12,1f\n" 152 " brc 12,1f\n"
155 " aghi %0,1\n" /* add carry */ 153 " aghi %0,1\n" /* add carry */
156 "1: algfr %0,%3\n" /* sum += (len<<16) + proto */ 154 "1: algfr %0,%3\n" /* sum += len + proto */
157 " brc 12,2f\n" 155 " brc 12,2f\n"
158 " aghi %0,1\n" /* add carry */ 156 " aghi %0,1\n" /* add carry */
159 "2: srlg 0,%0,32\n" 157 "2: srlg 0,%0,32\n"
@@ -163,7 +161,7 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
163 "3: llgfr %0,%0" 161 "3: llgfr %0,%0"
164 : "+&d" (sum) 162 : "+&d" (sum)
165 : "d" (saddr), "d" (daddr), 163 : "d" (saddr), "d" (daddr),
166 "d" (((unsigned int) len<<16) + (unsigned int) proto) 164 "d" (len + proto)
167 : "cc", "0"); 165 : "cc", "0");
168#endif /* __s390x__ */ 166#endif /* __s390x__ */
169 return sum; 167 return sum;
@@ -174,10 +172,10 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
174 * returns a 16-bit checksum, already complemented 172 * returns a 16-bit checksum, already complemented
175 */ 173 */
176 174
177static inline unsigned short int 175static inline __sum16
178csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, 176csum_tcpudp_magic(__be32 saddr, __be32 daddr,
179 unsigned short len, unsigned short proto, 177 unsigned short len, unsigned short proto,
180 unsigned int sum) 178 __wsum sum)
181{ 179{
182 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 180 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
183} 181}
@@ -187,8 +185,7 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr,
187 * in icmp.c 185 * in icmp.c
188 */ 186 */
189 187
190static inline unsigned short 188static inline __sum16 ip_compute_csum(const void *buff, int len)
191ip_compute_csum(unsigned char * buff, int len)
192{ 189{
193 return csum_fold(csum_partial(buff, len, 0)); 190 return csum_fold(csum_partial(buff, len, 0));
194} 191}
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index 81287d86329d..d92785030980 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -278,17 +278,16 @@ struct ccw_dev_id {
278static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1, 278static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
279 struct ccw_dev_id *dev_id2) 279 struct ccw_dev_id *dev_id2)
280{ 280{
281 return !memcmp(dev_id1, dev_id2, sizeof(struct ccw_dev_id)); 281 if ((dev_id1->ssid == dev_id2->ssid) &&
282 (dev_id1->devno == dev_id2->devno))
283 return 1;
284 return 0;
282} 285}
283 286
284extern int diag210(struct diag210 *addr); 287extern int diag210(struct diag210 *addr);
285 288
286extern void wait_cons_dev(void); 289extern void wait_cons_dev(void);
287 290
288extern void clear_all_subchannels(void);
289
290extern void cio_reset_channel_paths(void);
291
292extern void css_schedule_reprobe(void); 291extern void css_schedule_reprobe(void);
293 292
294extern void reipl_ccw_dev(struct ccw_dev_id *id); 293extern void reipl_ccw_dev(struct ccw_dev_id *id);
diff --git a/include/asm-s390/cpcmd.h b/include/asm-s390/cpcmd.h
index 1fcf65be7a23..48a9eab16429 100644
--- a/include/asm-s390/cpcmd.h
+++ b/include/asm-s390/cpcmd.h
@@ -7,8 +7,8 @@
7 * Christian Borntraeger (cborntra@de.ibm.com), 7 * Christian Borntraeger (cborntra@de.ibm.com),
8 */ 8 */
9 9
10#ifndef __CPCMD__ 10#ifndef _ASM_S390_CPCMD_H
11#define __CPCMD__ 11#define _ASM_S390_CPCMD_H
12 12
13/* 13/*
14 * the lowlevel function for cpcmd 14 * the lowlevel function for cpcmd
@@ -16,9 +16,6 @@
16 */ 16 */
17extern int __cpcmd(const char *cmd, char *response, int rlen, int *response_code); 17extern int __cpcmd(const char *cmd, char *response, int rlen, int *response_code);
18 18
19#ifndef __s390x__
20#define cpcmd __cpcmd
21#else
22/* 19/*
23 * cpcmd is the in-kernel interface for issuing CP commands 20 * cpcmd is the in-kernel interface for issuing CP commands
24 * 21 *
@@ -33,6 +30,5 @@ extern int __cpcmd(const char *cmd, char *response, int rlen, int *response_code
33 * NOTE: If the response buffer is not below 2 GB, cpcmd can sleep 30 * NOTE: If the response buffer is not below 2 GB, cpcmd can sleep
34 */ 31 */
35extern int cpcmd(const char *cmd, char *response, int rlen, int *response_code); 32extern int cpcmd(const char *cmd, char *response, int rlen, int *response_code);
36#endif /*__s390x__*/
37 33
38#endif 34#endif /* _ASM_S390_CPCMD_H */
diff --git a/include/asm-s390/device.h b/include/asm-s390/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-s390/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-s390/kexec.h b/include/asm-s390/kexec.h
index ce28ddda0f50..9c35c8ad1afd 100644
--- a/include/asm-s390/kexec.h
+++ b/include/asm-s390/kexec.h
@@ -26,7 +26,7 @@
26 26
27/* Maximum address we can use for the control pages */ 27/* Maximum address we can use for the control pages */
28/* Not more than 2GB */ 28/* Not more than 2GB */
29#define KEXEC_CONTROL_MEMORY_LIMIT (1<<31) 29#define KEXEC_CONTROL_MEMORY_LIMIT (1UL<<31)
30 30
31/* Allocate one page for the pdp and the second for the code */ 31/* Allocate one page for the pdp and the second for the code */
32#define KEXEC_CONTROL_CODE_SIZE 4096 32#define KEXEC_CONTROL_CODE_SIZE 4096
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index 06583ed0bde7..74f7389bd3ee 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -362,6 +362,14 @@ static inline void set_prefix(__u32 address)
362 asm volatile("spx %0" : : "m" (address) : "memory"); 362 asm volatile("spx %0" : : "m" (address) : "memory");
363} 363}
364 364
365static inline __u32 store_prefix(void)
366{
367 __u32 address;
368
369 asm volatile("stpx %0" : "=m" (address));
370 return address;
371}
372
365#define __PANIC_MAGIC 0xDEADC0DE 373#define __PANIC_MAGIC 0xDEADC0DE
366 374
367#endif 375#endif
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 36bb6dacf008..2d968a69ed1f 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -110,13 +110,22 @@ extern char empty_zero_page[PAGE_SIZE];
110#define VMALLOC_OFFSET (8*1024*1024) 110#define VMALLOC_OFFSET (8*1024*1024)
111#define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) \ 111#define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) \
112 & ~(VMALLOC_OFFSET-1)) 112 & ~(VMALLOC_OFFSET-1))
113
114/*
115 * We need some free virtual space to be able to do vmalloc.
116 * VMALLOC_MIN_SIZE defines the minimum size of the vmalloc
117 * area. On a machine with 2GB memory we make sure that we
118 * have at least 128MB free space for vmalloc. On a machine
119 * with 4TB we make sure we have at least 1GB.
120 */
113#ifndef __s390x__ 121#ifndef __s390x__
114# define VMALLOC_END (0x7fffffffL) 122#define VMALLOC_MIN_SIZE 0x8000000UL
123#define VMALLOC_END 0x80000000UL
115#else /* __s390x__ */ 124#else /* __s390x__ */
116# define VMALLOC_END (0x40000000000L) 125#define VMALLOC_MIN_SIZE 0x40000000UL
126#define VMALLOC_END 0x40000000000UL
117#endif /* __s390x__ */ 127#endif /* __s390x__ */
118 128
119
120/* 129/*
121 * A 31 bit pagetable entry of S390 has following format: 130 * A 31 bit pagetable entry of S390 has following format:
122 * | PFRA | | OS | 131 * | PFRA | | OS |
diff --git a/include/asm-s390/reset.h b/include/asm-s390/reset.h
new file mode 100644
index 000000000000..9b439cf67800
--- /dev/null
+++ b/include/asm-s390/reset.h
@@ -0,0 +1,23 @@
1/*
2 * include/asm-s390/reset.h
3 *
4 * Copyright IBM Corp. 2006
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_RESET_H
9#define _ASM_S390_RESET_H
10
11#include <linux/list.h>
12
13struct reset_call {
14 struct list_head list;
15 void (*fn)(void);
16};
17
18extern void register_reset_call(struct reset_call *reset);
19extern void unregister_reset_call(struct reset_call *reset);
20extern void s390_reset_system(void);
21extern void (*s390_reset_mcck_handler)(void);
22
23#endif /* _ASM_S390_RESET_H */
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h
index 5d72eda8a11b..9574fe80a046 100644
--- a/include/asm-s390/setup.h
+++ b/include/asm-s390/setup.h
@@ -2,18 +2,19 @@
2 * include/asm-s390/setup.h 2 * include/asm-s390/setup.h
3 * 3 *
4 * S390 version 4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 5 * Copyright IBM Corp. 1999,2006
6 */ 6 */
7 7
8#ifndef _ASM_S390_SETUP_H 8#ifndef _ASM_S390_SETUP_H
9#define _ASM_S390_SETUP_H 9#define _ASM_S390_SETUP_H
10 10
11#define COMMAND_LINE_SIZE 896
12
11#ifdef __KERNEL__ 13#ifdef __KERNEL__
12 14
13#include <asm/types.h> 15#include <asm/types.h>
14 16
15#define PARMAREA 0x10400 17#define PARMAREA 0x10400
16#define COMMAND_LINE_SIZE 896
17#define MEMORY_CHUNKS 16 /* max 0x7fff */ 18#define MEMORY_CHUNKS 16 /* max 0x7fff */
18#define IPL_PARMBLOCK_ORIGIN 0x2000 19#define IPL_PARMBLOCK_ORIGIN 0x2000
19 20
@@ -30,6 +31,17 @@
30#endif /* __s390x__ */ 31#endif /* __s390x__ */
31#define COMMAND_LINE ((char *) (0x10480)) 32#define COMMAND_LINE ((char *) (0x10480))
32 33
34#define CHUNK_READ_WRITE 0
35#define CHUNK_READ_ONLY 1
36
37struct mem_chunk {
38 unsigned long addr;
39 unsigned long size;
40 unsigned long type;
41};
42
43extern struct mem_chunk memory_chunk[];
44
33/* 45/*
34 * Machine features detected in head.S 46 * Machine features detected in head.S
35 */ 47 */
@@ -53,7 +65,6 @@ extern unsigned long machine_flags;
53#define MACHINE_HAS_MVCOS (machine_flags & 512) 65#define MACHINE_HAS_MVCOS (machine_flags & 512)
54#endif /* __s390x__ */ 66#endif /* __s390x__ */
55 67
56
57#define MACHINE_HAS_SCLP (!MACHINE_IS_P390) 68#define MACHINE_HAS_SCLP (!MACHINE_IS_P390)
58 69
59/* 70/*
@@ -71,7 +82,6 @@ extern unsigned int console_irq;
71#define SET_CONSOLE_3215 do { console_mode = 2; } while (0) 82#define SET_CONSOLE_3215 do { console_mode = 2; } while (0)
72#define SET_CONSOLE_3270 do { console_mode = 3; } while (0) 83#define SET_CONSOLE_3270 do { console_mode = 3; } while (0)
73 84
74
75struct ipl_list_hdr { 85struct ipl_list_hdr {
76 u32 len; 86 u32 len;
77 u8 reserved1[3]; 87 u8 reserved1[3];
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h
index c3cf030ada4d..7097c96ed026 100644
--- a/include/asm-s390/smp.h
+++ b/include/asm-s390/smp.h
@@ -18,6 +18,7 @@
18 18
19#include <asm/lowcore.h> 19#include <asm/lowcore.h>
20#include <asm/sigp.h> 20#include <asm/sigp.h>
21#include <asm/ptrace.h>
21 22
22/* 23/*
23 s390 specific smp.c headers 24 s390 specific smp.c headers
@@ -101,6 +102,13 @@ smp_call_function_on(void (*func) (void *info), void *info,
101 func(info); 102 func(info);
102 return 0; 103 return 0;
103} 104}
105
106static inline void smp_send_stop(void)
107{
108 /* Disable all interrupts/machine checks */
109 __load_psw_mask(PSW_KERNEL_BITS & ~PSW_MASK_MCHECK);
110}
111
104#define smp_cpu_not_running(cpu) 1 112#define smp_cpu_not_running(cpu) 1
105#define smp_get_cpu(cpu) ({ 0; }) 113#define smp_get_cpu(cpu) ({ 0; })
106#define smp_put_cpu(cpu) ({ 0; }) 114#define smp_put_cpu(cpu) ({ 0; })
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index ccbafe4bf2cb..bd0b05ae87d2 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -115,6 +115,16 @@ extern void account_system_vtime(struct task_struct *);
115#define account_vtime(x) do { /* empty */ } while (0) 115#define account_vtime(x) do { /* empty */ } while (0)
116#endif 116#endif
117 117
118#ifdef CONFIG_PFAULT
119extern void pfault_irq_init(void);
120extern int pfault_init(void);
121extern void pfault_fini(void);
122#else /* CONFIG_PFAULT */
123#define pfault_irq_init() do { } while (0)
124#define pfault_init() ({-1;})
125#define pfault_fini() do { } while (0)
126#endif /* CONFIG_PFAULT */
127
118#define finish_arch_switch(prev) do { \ 128#define finish_arch_switch(prev) do { \
119 set_fs(current->thread.mm_segment); \ 129 set_fs(current->thread.mm_segment); \
120 account_vtime(prev); \ 130 account_vtime(prev); \
diff --git a/include/asm-s390/termios.h b/include/asm-s390/termios.h
index d1e29cca54c9..62b23caf370e 100644
--- a/include/asm-s390/termios.h
+++ b/include/asm-s390/termios.h
@@ -75,39 +75,7 @@ struct termio {
75*/ 75*/
76#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" 76#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
77 77
78/* 78#include <asm-generic/termios.h>
79 * Translate a "termio" structure into a "termios". Ugh.
80 */
81#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
82 unsigned short __tmp; \
83 get_user(__tmp,&(termio)->x); \
84 (termios)->x = (0xffff0000 & ((termios)->x)) | __tmp; \
85}
86
87#define user_termio_to_kernel_termios(termios, termio) \
88({ \
89 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
90 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
91 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
92 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
93 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
94})
95
96/*
97 * Translate a "termios" structure into a "termio". Ugh.
98 */
99#define kernel_termios_to_user_termio(termio, termios) \
100({ \
101 put_user((termios)->c_iflag, &(termio)->c_iflag); \
102 put_user((termios)->c_oflag, &(termio)->c_oflag); \
103 put_user((termios)->c_cflag, &(termio)->c_cflag); \
104 put_user((termios)->c_lflag, &(termio)->c_lflag); \
105 put_user((termios)->c_line, &(termio)->c_line); \
106 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
107})
108
109#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
110#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
111 79
112#endif /* __KERNEL__ */ 80#endif /* __KERNEL__ */
113 81
diff --git a/include/asm-s390/types.h b/include/asm-s390/types.h
index ae2951cc83ac..fc5d7cf19324 100644
--- a/include/asm-s390/types.h
+++ b/include/asm-s390/types.h
@@ -87,16 +87,6 @@ typedef union {
87 } subreg; 87 } subreg;
88} register_pair; 88} register_pair;
89 89
90#ifdef CONFIG_LBD
91typedef u64 sector_t;
92#define HAVE_SECTOR_T
93#endif
94
95#ifdef CONFIG_LSF
96typedef u64 blkcnt_t;
97#define HAVE_BLKCNT_T
98#endif
99
100#endif /* ! __s390x__ */ 90#endif /* ! __s390x__ */
101#endif /* __ASSEMBLY__ */ 91#endif /* __ASSEMBLY__ */
102#endif /* __KERNEL__ */ 92#endif /* __KERNEL__ */
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index 72ae4efddb49..73ac4e82217b 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -201,7 +201,7 @@ extern int __get_user_bad(void) __attribute__((noreturn));
201 * Returns number of bytes that could not be copied. 201 * Returns number of bytes that could not be copied.
202 * On success, this will be zero. 202 * On success, this will be zero.
203 */ 203 */
204static inline unsigned long 204static inline unsigned long __must_check
205__copy_to_user(void __user *to, const void *from, unsigned long n) 205__copy_to_user(void __user *to, const void *from, unsigned long n)
206{ 206{
207 if (__builtin_constant_p(n) && (n <= 256)) 207 if (__builtin_constant_p(n) && (n <= 256))
@@ -226,7 +226,7 @@ __copy_to_user(void __user *to, const void *from, unsigned long n)
226 * Returns number of bytes that could not be copied. 226 * Returns number of bytes that could not be copied.
227 * On success, this will be zero. 227 * On success, this will be zero.
228 */ 228 */
229static inline unsigned long 229static inline unsigned long __must_check
230copy_to_user(void __user *to, const void *from, unsigned long n) 230copy_to_user(void __user *to, const void *from, unsigned long n)
231{ 231{
232 might_sleep(); 232 might_sleep();
@@ -252,7 +252,7 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
252 * If some data could not be copied, this function will pad the copied 252 * If some data could not be copied, this function will pad the copied
253 * data to the requested size using zero bytes. 253 * data to the requested size using zero bytes.
254 */ 254 */
255static inline unsigned long 255static inline unsigned long __must_check
256__copy_from_user(void *to, const void __user *from, unsigned long n) 256__copy_from_user(void *to, const void __user *from, unsigned long n)
257{ 257{
258 if (__builtin_constant_p(n) && (n <= 256)) 258 if (__builtin_constant_p(n) && (n <= 256))
@@ -277,7 +277,7 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
277 * If some data could not be copied, this function will pad the copied 277 * If some data could not be copied, this function will pad the copied
278 * data to the requested size using zero bytes. 278 * data to the requested size using zero bytes.
279 */ 279 */
280static inline unsigned long 280static inline unsigned long __must_check
281copy_from_user(void *to, const void __user *from, unsigned long n) 281copy_from_user(void *to, const void __user *from, unsigned long n)
282{ 282{
283 might_sleep(); 283 might_sleep();
@@ -288,13 +288,13 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
288 return n; 288 return n;
289} 289}
290 290
291static inline unsigned long 291static inline unsigned long __must_check
292__copy_in_user(void __user *to, const void __user *from, unsigned long n) 292__copy_in_user(void __user *to, const void __user *from, unsigned long n)
293{ 293{
294 return uaccess.copy_in_user(n, to, from); 294 return uaccess.copy_in_user(n, to, from);
295} 295}
296 296
297static inline unsigned long 297static inline unsigned long __must_check
298copy_in_user(void __user *to, const void __user *from, unsigned long n) 298copy_in_user(void __user *to, const void __user *from, unsigned long n)
299{ 299{
300 might_sleep(); 300 might_sleep();
@@ -306,7 +306,7 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n)
306/* 306/*
307 * Copy a null terminated string from userspace. 307 * Copy a null terminated string from userspace.
308 */ 308 */
309static inline long 309static inline long __must_check
310strncpy_from_user(char *dst, const char __user *src, long count) 310strncpy_from_user(char *dst, const char __user *src, long count)
311{ 311{
312 long res = -EFAULT; 312 long res = -EFAULT;
@@ -343,13 +343,13 @@ strnlen_user(const char __user * src, unsigned long n)
343 * Zero Userspace 343 * Zero Userspace
344 */ 344 */
345 345
346static inline unsigned long 346static inline unsigned long __must_check
347__clear_user(void __user *to, unsigned long n) 347__clear_user(void __user *to, unsigned long n)
348{ 348{
349 return uaccess.clear_user(n, to); 349 return uaccess.clear_user(n, to);
350} 350}
351 351
352static inline unsigned long 352static inline unsigned long __must_check
353clear_user(void __user *to, unsigned long n) 353clear_user(void __user *to, unsigned long n)
354{ 354{
355 might_sleep(); 355 might_sleep();
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index 71d3c21b84f0..fb6fef97d739 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -345,160 +345,6 @@
345 345
346#ifdef __KERNEL__ 346#ifdef __KERNEL__
347 347
348#include <linux/err.h>
349
350#define __syscall_return(type, res) \
351do { \
352 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
353 errno = -(res); \
354 res = -1; \
355 } \
356 return (type) (res); \
357} while (0)
358
359#define _svc_clobber "1", "cc", "memory"
360
361#define _syscall0(type,name) \
362type name(void) { \
363 register long __svcres asm("2"); \
364 long __res; \
365 asm volatile( \
366 " .if %1 < 256\n" \
367 " svc %b1\n" \
368 " .else\n" \
369 " la %%r1,%1\n" \
370 " svc 0\n" \
371 " .endif" \
372 : "=d" (__svcres) \
373 : "i" (__NR_##name) \
374 : _svc_clobber); \
375 __res = __svcres; \
376 __syscall_return(type,__res); \
377}
378
379#define _syscall1(type,name,type1,arg1) \
380type name(type1 arg1) { \
381 register type1 __arg1 asm("2") = arg1; \
382 register long __svcres asm("2"); \
383 long __res; \
384 asm volatile( \
385 " .if %1 < 256\n" \
386 " svc %b1\n" \
387 " .else\n" \
388 " la %%r1,%1\n" \
389 " svc 0\n" \
390 " .endif" \
391 : "=d" (__svcres) \
392 : "i" (__NR_##name), \
393 "0" (__arg1) \
394 : _svc_clobber); \
395 __res = __svcres; \
396 __syscall_return(type,__res); \
397}
398
399#define _syscall2(type,name,type1,arg1,type2,arg2) \
400type name(type1 arg1, type2 arg2) { \
401 register type1 __arg1 asm("2") = arg1; \
402 register type2 __arg2 asm("3") = arg2; \
403 register long __svcres asm("2"); \
404 long __res; \
405 asm volatile( \
406 " .if %1 < 256\n" \
407 " svc %b1\n" \
408 " .else\n" \
409 " la %%r1,%1\n" \
410 " svc 0\n" \
411 " .endif" \
412 : "=d" (__svcres) \
413 : "i" (__NR_##name), \
414 "0" (__arg1), \
415 "d" (__arg2) \
416 : _svc_clobber ); \
417 __res = __svcres; \
418 __syscall_return(type,__res); \
419}
420
421#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
422type name(type1 arg1, type2 arg2, type3 arg3) { \
423 register type1 __arg1 asm("2") = arg1; \
424 register type2 __arg2 asm("3") = arg2; \
425 register type3 __arg3 asm("4") = arg3; \
426 register long __svcres asm("2"); \
427 long __res; \
428 asm volatile( \
429 " .if %1 < 256\n" \
430 " svc %b1\n" \
431 " .else\n" \
432 " la %%r1,%1\n" \
433 " svc 0\n" \
434 " .endif" \
435 : "=d" (__svcres) \
436 : "i" (__NR_##name), \
437 "0" (__arg1), \
438 "d" (__arg2), \
439 "d" (__arg3) \
440 : _svc_clobber); \
441 __res = __svcres; \
442 __syscall_return(type,__res); \
443}
444
445#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
446 type4,name4) \
447type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
448 register type1 __arg1 asm("2") = arg1; \
449 register type2 __arg2 asm("3") = arg2; \
450 register type3 __arg3 asm("4") = arg3; \
451 register type4 __arg4 asm("5") = arg4; \
452 register long __svcres asm("2"); \
453 long __res; \
454 asm volatile( \
455 " .if %1 < 256\n" \
456 " svc %b1\n" \
457 " .else\n" \
458 " la %%r1,%1\n" \
459 " svc 0\n" \
460 " .endif" \
461 : "=d" (__svcres) \
462 : "i" (__NR_##name), \
463 "0" (__arg1), \
464 "d" (__arg2), \
465 "d" (__arg3), \
466 "d" (__arg4) \
467 : _svc_clobber); \
468 __res = __svcres; \
469 __syscall_return(type,__res); \
470}
471
472#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
473 type4,name4,type5,name5) \
474type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
475 type5 arg5) { \
476 register type1 __arg1 asm("2") = arg1; \
477 register type2 __arg2 asm("3") = arg2; \
478 register type3 __arg3 asm("4") = arg3; \
479 register type4 __arg4 asm("5") = arg4; \
480 register type5 __arg5 asm("6") = arg5; \
481 register long __svcres asm("2"); \
482 long __res; \
483 asm volatile( \
484 " .if %1 < 256\n" \
485 " svc %b1\n" \
486 " .else\n" \
487 " la %%r1,%1\n" \
488 " svc 0\n" \
489 " .endif" \
490 : "=d" (__svcres) \
491 : "i" (__NR_##name), \
492 "0" (__arg1), \
493 "d" (__arg2), \
494 "d" (__arg3), \
495 "d" (__arg4), \
496 "d" (__arg5) \
497 : _svc_clobber); \
498 __res = __svcres; \
499 __syscall_return(type,__res); \
500}
501
502#define __ARCH_WANT_IPC_PARSE_VERSION 348#define __ARCH_WANT_IPC_PARSE_VERSION
503#define __ARCH_WANT_OLD_READDIR 349#define __ARCH_WANT_OLD_READDIR
504#define __ARCH_WANT_SYS_ALARM 350#define __ARCH_WANT_SYS_ALARM
diff --git a/include/asm-s390/zcrypt.h b/include/asm-s390/zcrypt.h
index 7244c68464f2..b90e55888a55 100644
--- a/include/asm-s390/zcrypt.h
+++ b/include/asm-s390/zcrypt.h
@@ -180,40 +180,8 @@ struct ica_xcRB {
180 * for the implementation details for the contents of the 180 * for the implementation details for the contents of the
181 * block 181 * block
182 * 182 *
183 * Z90STAT_TOTALCOUNT 183 * ZSECSENDCPRB
184 * Return an integer count of all device types together. 184 * Send an arbitrary CPRB to a crypto card.
185 *
186 * Z90STAT_PCICACOUNT
187 * Return an integer count of all PCICAs.
188 *
189 * Z90STAT_PCICCCOUNT
190 * Return an integer count of all PCICCs.
191 *
192 * Z90STAT_PCIXCCMCL2COUNT
193 * Return an integer count of all MCL2 PCIXCCs.
194 *
195 * Z90STAT_PCIXCCMCL3COUNT
196 * Return an integer count of all MCL3 PCIXCCs.
197 *
198 * Z90STAT_CEX2CCOUNT
199 * Return an integer count of all CEX2Cs.
200 *
201 * Z90STAT_CEX2ACOUNT
202 * Return an integer count of all CEX2As.
203 *
204 * Z90STAT_REQUESTQ_COUNT
205 * Return an integer count of the number of entries waiting to be
206 * sent to a device.
207 *
208 * Z90STAT_PENDINGQ_COUNT
209 * Return an integer count of the number of entries sent to a
210 * device awaiting the reply.
211 *
212 * Z90STAT_TOTALOPEN_COUNT
213 * Return an integer count of the number of open file handles.
214 *
215 * Z90STAT_DOMAIN_INDEX
216 * Return the integer value of the Cryptographic Domain.
217 * 185 *
218 * Z90STAT_STATUS_MASK 186 * Z90STAT_STATUS_MASK
219 * Return an 64 element array of unsigned chars for the status of 187 * Return an 64 element array of unsigned chars for the status of
@@ -235,28 +203,51 @@ struct ica_xcRB {
235 * of successfully completed requests per device since the device 203 * of successfully completed requests per device since the device
236 * was detected and made available. 204 * was detected and made available.
237 * 205 *
238 * ICAZ90STATUS (deprecated) 206 * Z90STAT_REQUESTQ_COUNT
207 * Return an integer count of the number of entries waiting to be
208 * sent to a device.
209 *
210 * Z90STAT_PENDINGQ_COUNT
211 * Return an integer count of the number of entries sent to all
212 * devices awaiting the reply.
213 *
214 * Z90STAT_TOTALOPEN_COUNT
215 * Return an integer count of the number of open file handles.
216 *
217 * Z90STAT_DOMAIN_INDEX
218 * Return the integer value of the Cryptographic Domain.
219 *
220 * The following ioctls are deprecated and should be no longer used:
221 *
222 * Z90STAT_TOTALCOUNT
223 * Return an integer count of all device types together.
224 *
225 * Z90STAT_PCICACOUNT
226 * Return an integer count of all PCICAs.
227 *
228 * Z90STAT_PCICCCOUNT
229 * Return an integer count of all PCICCs.
230 *
231 * Z90STAT_PCIXCCMCL2COUNT
232 * Return an integer count of all MCL2 PCIXCCs.
233 *
234 * Z90STAT_PCIXCCMCL3COUNT
235 * Return an integer count of all MCL3 PCIXCCs.
236 *
237 * Z90STAT_CEX2CCOUNT
238 * Return an integer count of all CEX2Cs.
239 *
240 * Z90STAT_CEX2ACOUNT
241 * Return an integer count of all CEX2As.
242 *
243 * ICAZ90STATUS
239 * Return some device driver status in a ica_z90_status struct 244 * Return some device driver status in a ica_z90_status struct
240 * This takes an ica_z90_status struct as its arg. 245 * This takes an ica_z90_status struct as its arg.
241 * 246 *
242 * NOTE: this ioctl() is deprecated, and has been replaced with 247 * Z90STAT_PCIXCCCOUNT
243 * single ioctl()s for each type of status being requested
244 *
245 * Z90STAT_PCIXCCCOUNT (deprecated)
246 * Return an integer count of all PCIXCCs (MCL2 + MCL3). 248 * Return an integer count of all PCIXCCs (MCL2 + MCL3).
247 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from 249 * This is DEPRECATED now that MCL3 PCIXCCs are treated differently from
248 * MCL2 PCIXCCs. 250 * MCL2 PCIXCCs.
249 *
250 * Z90QUIESCE (not recommended)
251 * Quiesce the driver. This is intended to stop all new
252 * requests from being processed. Its use is NOT recommended,
253 * except in circumstances where there is no other way to stop
254 * callers from accessing the driver. Its original use was to
255 * allow the driver to be "drained" of work in preparation for
256 * a system shutdown.
257 *
258 * NOTE: once issued, this ban on new work cannot be undone
259 * except by unloading and reloading the driver.
260 */ 251 */
261 252
262/** 253/**
diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h
index 8bdc1ba56f73..28305c3cbddf 100644
--- a/include/asm-sh/atomic.h
+++ b/include/asm-sh/atomic.h
@@ -28,11 +28,11 @@ static inline void atomic_add(int i, atomic_t *v)
28 unsigned long tmp; 28 unsigned long tmp;
29 29
30 __asm__ __volatile__ ( 30 __asm__ __volatile__ (
31"1: movli.l @%3, %0 ! atomic_add \n" 31"1: movli.l @%2, %0 ! atomic_add \n"
32" add %2, %0 \n" 32" add %1, %0 \n"
33" movco.l %0, @%3 \n" 33" movco.l %0, @%2 \n"
34" bf 1b \n" 34" bf 1b \n"
35 : "=&z" (tmp), "=r" (&v->counter) 35 : "=&z" (tmp)
36 : "r" (i), "r" (&v->counter) 36 : "r" (i), "r" (&v->counter)
37 : "t"); 37 : "t");
38#else 38#else
@@ -50,11 +50,11 @@ static inline void atomic_sub(int i, atomic_t *v)
50 unsigned long tmp; 50 unsigned long tmp;
51 51
52 __asm__ __volatile__ ( 52 __asm__ __volatile__ (
53"1: movli.l @%3, %0 ! atomic_sub \n" 53"1: movli.l @%2, %0 ! atomic_sub \n"
54" sub %2, %0 \n" 54" sub %1, %0 \n"
55" movco.l %0, @%3 \n" 55" movco.l %0, @%2 \n"
56" bf 1b \n" 56" bf 1b \n"
57 : "=&z" (tmp), "=r" (&v->counter) 57 : "=&z" (tmp)
58 : "r" (i), "r" (&v->counter) 58 : "r" (i), "r" (&v->counter)
59 : "t"); 59 : "t");
60#else 60#else
@@ -80,12 +80,12 @@ static inline int atomic_add_return(int i, atomic_t *v)
80 80
81#ifdef CONFIG_CPU_SH4A 81#ifdef CONFIG_CPU_SH4A
82 __asm__ __volatile__ ( 82 __asm__ __volatile__ (
83"1: movli.l @%3, %0 ! atomic_add_return \n" 83"1: movli.l @%2, %0 ! atomic_add_return \n"
84" add %2, %0 \n" 84" add %1, %0 \n"
85" movco.l %0, @%3 \n" 85" movco.l %0, @%2 \n"
86" bf 1b \n" 86" bf 1b \n"
87" synco \n" 87" synco \n"
88 : "=&z" (temp), "=r" (&v->counter) 88 : "=&z" (temp)
89 : "r" (i), "r" (&v->counter) 89 : "r" (i), "r" (&v->counter)
90 : "t"); 90 : "t");
91#else 91#else
@@ -109,12 +109,12 @@ static inline int atomic_sub_return(int i, atomic_t *v)
109 109
110#ifdef CONFIG_CPU_SH4A 110#ifdef CONFIG_CPU_SH4A
111 __asm__ __volatile__ ( 111 __asm__ __volatile__ (
112"1: movli.l @%3, %0 ! atomic_sub_return \n" 112"1: movli.l @%2, %0 ! atomic_sub_return \n"
113" sub %2, %0 \n" 113" sub %1, %0 \n"
114" movco.l %0, @%3 \n" 114" movco.l %0, @%2 \n"
115" bf 1b \n" 115" bf 1b \n"
116" synco \n" 116" synco \n"
117 : "=&z" (temp), "=r" (&v->counter) 117 : "=&z" (temp)
118 : "r" (i), "r" (&v->counter) 118 : "r" (i), "r" (&v->counter)
119 : "t"); 119 : "t");
120#else 120#else
@@ -186,11 +186,11 @@ static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
186 unsigned long tmp; 186 unsigned long tmp;
187 187
188 __asm__ __volatile__ ( 188 __asm__ __volatile__ (
189"1: movli.l @%3, %0 ! atomic_clear_mask \n" 189"1: movli.l @%2, %0 ! atomic_clear_mask \n"
190" and %2, %0 \n" 190" and %1, %0 \n"
191" movco.l %0, @%3 \n" 191" movco.l %0, @%2 \n"
192" bf 1b \n" 192" bf 1b \n"
193 : "=&z" (tmp), "=r" (&v->counter) 193 : "=&z" (tmp)
194 : "r" (~mask), "r" (&v->counter) 194 : "r" (~mask), "r" (&v->counter)
195 : "t"); 195 : "t");
196#else 196#else
@@ -208,11 +208,11 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
208 unsigned long tmp; 208 unsigned long tmp;
209 209
210 __asm__ __volatile__ ( 210 __asm__ __volatile__ (
211"1: movli.l @%3, %0 ! atomic_set_mask \n" 211"1: movli.l @%2, %0 ! atomic_set_mask \n"
212" or %2, %0 \n" 212" or %1, %0 \n"
213" movco.l %0, @%3 \n" 213" movco.l %0, @%2 \n"
214" bf 1b \n" 214" bf 1b \n"
215 : "=&z" (tmp), "=r" (&v->counter) 215 : "=&z" (tmp)
216 : "r" (mask), "r" (&v->counter) 216 : "r" (mask), "r" (&v->counter)
217 : "t"); 217 : "t");
218#else 218#else
diff --git a/include/asm-sh/bugs.h b/include/asm-sh/bugs.h
index beeea40f549e..795047da5e17 100644
--- a/include/asm-sh/bugs.h
+++ b/include/asm-sh/bugs.h
@@ -23,16 +23,20 @@ static void __init check_bugs(void)
23 cpu_data->loops_per_jiffy = loops_per_jiffy; 23 cpu_data->loops_per_jiffy = loops_per_jiffy;
24 24
25 switch (cpu_data->type) { 25 switch (cpu_data->type) {
26 case CPU_SH7604: 26 case CPU_SH7604 ... CPU_SH7619:
27 *p++ = '2'; 27 *p++ = '2';
28 break; 28 break;
29 case CPU_SH7206:
30 *p++ = '2';
31 *p++ = 'a';
32 break;
29 case CPU_SH7705 ... CPU_SH7300: 33 case CPU_SH7705 ... CPU_SH7300:
30 *p++ = '3'; 34 *p++ = '3';
31 break; 35 break;
32 case CPU_SH7750 ... CPU_SH4_501: 36 case CPU_SH7750 ... CPU_SH4_501:
33 *p++ = '4'; 37 *p++ = '4';
34 break; 38 break;
35 case CPU_SH7770 ... CPU_SH7781: 39 case CPU_SH7770 ... CPU_SH7785:
36 *p++ = '4'; 40 *p++ = '4';
37 *p++ = 'a'; 41 *p++ = 'a';
38 break; 42 break;
diff --git a/include/asm-sh/checksum.h b/include/asm-sh/checksum.h
index 08168afe6746..d44344c88e73 100644
--- a/include/asm-sh/checksum.h
+++ b/include/asm-sh/checksum.h
@@ -23,7 +23,7 @@
23 * 23 *
24 * it's best to have buff aligned on a 32-bit boundary 24 * it's best to have buff aligned on a 32-bit boundary
25 */ 25 */
26asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 26asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
27 27
28/* 28/*
29 * the same as csum_partial, but copies from src while it 29 * the same as csum_partial, but copies from src while it
@@ -33,8 +33,8 @@ asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsign
33 * better 64-bit) boundary 33 * better 64-bit) boundary
34 */ 34 */
35 35
36asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsigned char *dst, 36asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst,
37 int len, int sum, int *src_err_ptr, int *dst_err_ptr); 37 int len, __wsum sum, int *src_err_ptr, int *dst_err_ptr);
38 38
39/* 39/*
40 * Note: when you get a NULL pointer exception here this means someone 40 * Note: when you get a NULL pointer exception here this means someone
@@ -44,24 +44,25 @@ asmlinkage unsigned int csum_partial_copy_generic(const unsigned char *src, unsi
44 * access_ok(). 44 * access_ok().
45 */ 45 */
46static __inline__ 46static __inline__
47unsigned int csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, 47__wsum csum_partial_copy_nocheck(const void *src, void *dst,
48 int len, int sum) 48 int len, __wsum sum)
49{ 49{
50 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); 50 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL);
51} 51}
52 52
53static __inline__ 53static __inline__
54unsigned int csum_partial_copy_from_user (const unsigned char *src, unsigned char *dst, 54__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
55 int len, int sum, int *err_ptr) 55 int len, __wsum sum, int *err_ptr)
56{ 56{
57 return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL); 57 return csum_partial_copy_generic((__force const void *)src, dst,
58 len, sum, err_ptr, NULL);
58} 59}
59 60
60/* 61/*
61 * Fold a partial checksum 62 * Fold a partial checksum
62 */ 63 */
63 64
64static __inline__ unsigned int csum_fold(unsigned int sum) 65static __inline__ __sum16 csum_fold(__wsum sum)
65{ 66{
66 unsigned int __dummy; 67 unsigned int __dummy;
67 __asm__("swap.w %0, %1\n\t" 68 __asm__("swap.w %0, %1\n\t"
@@ -74,7 +75,7 @@ static __inline__ unsigned int csum_fold(unsigned int sum)
74 : "=r" (sum), "=&r" (__dummy) 75 : "=r" (sum), "=&r" (__dummy)
75 : "0" (sum) 76 : "0" (sum)
76 : "t"); 77 : "t");
77 return sum; 78 return (__force __sum16)sum;
78} 79}
79 80
80/* 81/*
@@ -84,7 +85,7 @@ static __inline__ unsigned int csum_fold(unsigned int sum)
84 * i386 version by Jorge Cwik <jorge@laser.satlink.net>, adapted 85 * i386 version by Jorge Cwik <jorge@laser.satlink.net>, adapted
85 * for linux by * Arnt Gulbrandsen. 86 * for linux by * Arnt Gulbrandsen.
86 */ 87 */
87static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) 88static __inline__ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
88{ 89{
89 unsigned int sum, __dummy0, __dummy1; 90 unsigned int sum, __dummy0, __dummy1;
90 91
@@ -112,16 +113,15 @@ static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int
112 return csum_fold(sum); 113 return csum_fold(sum);
113} 114}
114 115
115static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, 116static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
116 unsigned long daddr,
117 unsigned short len, 117 unsigned short len,
118 unsigned short proto, 118 unsigned short proto,
119 unsigned int sum) 119 __wsum sum)
120{ 120{
121#ifdef __LITTLE_ENDIAN__ 121#ifdef __LITTLE_ENDIAN__
122 unsigned long len_proto = (ntohs(len)<<16)+proto*256; 122 unsigned long len_proto = (proto + len) << 8;
123#else 123#else
124 unsigned long len_proto = (proto<<16)+len; 124 unsigned long len_proto = proto + len;
125#endif 125#endif
126 __asm__("clrt\n\t" 126 __asm__("clrt\n\t"
127 "addc %0, %1\n\t" 127 "addc %0, %1\n\t"
@@ -139,11 +139,10 @@ static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr,
139 * computes the checksum of the TCP/UDP pseudo-header 139 * computes the checksum of the TCP/UDP pseudo-header
140 * returns a 16-bit checksum, already complemented 140 * returns a 16-bit checksum, already complemented
141 */ 141 */
142static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr, 142static __inline__ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
143 unsigned long daddr,
144 unsigned short len, 143 unsigned short len,
145 unsigned short proto, 144 unsigned short proto,
146 unsigned int sum) 145 __wsum sum)
147{ 146{
148 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 147 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
149} 148}
@@ -153,18 +152,17 @@ static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr,
153 * in icmp.c 152 * in icmp.c
154 */ 153 */
155 154
156static __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len) 155static __inline__ __sum16 ip_compute_csum(const void *buff, int len)
157{ 156{
158 return csum_fold (csum_partial(buff, len, 0)); 157 return csum_fold (csum_partial(buff, len, 0));
159} 158}
160 159
161#define _HAVE_ARCH_IPV6_CSUM 160#define _HAVE_ARCH_IPV6_CSUM
162#ifdef CONFIG_IPV6 161#ifdef CONFIG_IPV6
163static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 162static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
164 struct in6_addr *daddr, 163 const struct in6_addr *daddr,
165 __u32 len, 164 __u32 len, unsigned short proto,
166 unsigned short proto, 165 __wsum sum)
167 unsigned int sum)
168{ 166{
169 unsigned int __dummy; 167 unsigned int __dummy;
170 __asm__("clrt\n\t" 168 __asm__("clrt\n\t"
@@ -201,17 +199,18 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
201 * Copy and checksum to user 199 * Copy and checksum to user
202 */ 200 */
203#define HAVE_CSUM_COPY_USER 201#define HAVE_CSUM_COPY_USER
204static __inline__ unsigned int csum_and_copy_to_user (const unsigned char *src, 202static __inline__ __wsum csum_and_copy_to_user (const void *src,
205 unsigned char __user *dst, 203 void __user *dst,
206 int len, int sum, 204 int len, __wsum sum,
207 int *err_ptr) 205 int *err_ptr)
208{ 206{
209 if (access_ok(VERIFY_WRITE, dst, len)) 207 if (access_ok(VERIFY_WRITE, dst, len))
210 return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr); 208 return csum_partial_copy_generic((__force const void *)src,
209 dst, len, sum, NULL, err_ptr);
211 210
212 if (len) 211 if (len)
213 *err_ptr = -EFAULT; 212 *err_ptr = -EFAULT;
214 213
215 return -1; /* invalid checksum */ 214 return (__force __wsum)-1; /* invalid checksum */
216} 215}
217#endif /* __ASM_SH_CHECKSUM_H */ 216#endif /* __ASM_SH_CHECKSUM_H */
diff --git a/include/asm-sh/clock.h b/include/asm-sh/clock.h
index fdfb75b30f0d..1df92807f8c5 100644
--- a/include/asm-sh/clock.h
+++ b/include/asm-sh/clock.h
@@ -4,6 +4,7 @@
4#include <linux/kref.h> 4#include <linux/kref.h>
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/seq_file.h> 6#include <linux/seq_file.h>
7#include <linux/clk.h>
7 8
8struct clk; 9struct clk;
9 10
@@ -18,7 +19,7 @@ struct clk_ops {
18struct clk { 19struct clk {
19 struct list_head node; 20 struct list_head node;
20 const char *name; 21 const char *name;
21 22 int id;
22 struct module *owner; 23 struct module *owner;
23 24
24 struct clk *parent; 25 struct clk *parent;
@@ -40,22 +41,13 @@ void arch_init_clk_ops(struct clk_ops **, int type);
40int clk_init(void); 41int clk_init(void);
41 42
42int __clk_enable(struct clk *); 43int __clk_enable(struct clk *);
43int clk_enable(struct clk *);
44
45void __clk_disable(struct clk *); 44void __clk_disable(struct clk *);
46void clk_disable(struct clk *);
47 45
48int clk_set_rate(struct clk *, unsigned long rate);
49unsigned long clk_get_rate(struct clk *);
50void clk_recalc_rate(struct clk *); 46void clk_recalc_rate(struct clk *);
51 47
52struct clk *clk_get(const char *id);
53void clk_put(struct clk *);
54
55int clk_register(struct clk *); 48int clk_register(struct clk *);
56void clk_unregister(struct clk *); 49void clk_unregister(struct clk *);
57 50
58int show_clocks(struct seq_file *m); 51int show_clocks(struct seq_file *m);
59 52
60#endif /* __ASM_SH_CLOCK_H */ 53#endif /* __ASM_SH_CLOCK_H */
61
diff --git a/include/asm-sh/cpu-sh2/cache.h b/include/asm-sh/cpu-sh2/cache.h
index cd96402e8562..20b9796842dc 100644
--- a/include/asm-sh/cpu-sh2/cache.h
+++ b/include/asm-sh/cpu-sh2/cache.h
@@ -12,6 +12,7 @@
12 12
13#define L1_CACHE_SHIFT 4 13#define L1_CACHE_SHIFT 4
14 14
15#if defined(CONFIG_CPU_SUBTYPE_SH7604)
15#define CCR 0xfffffe92 /* Address of Cache Control Register */ 16#define CCR 0xfffffe92 /* Address of Cache Control Register */
16 17
17#define CCR_CACHE_CE 0x01 /* Cache enable */ 18#define CCR_CACHE_CE 0x01 /* Cache enable */
@@ -27,5 +28,26 @@
27#define CCR_CACHE_ORA CCR_CACHE_TW 28#define CCR_CACHE_ORA CCR_CACHE_TW
28#define CCR_CACHE_WT 0x00 /* SH-2 is _always_ write-through */ 29#define CCR_CACHE_WT 0x00 /* SH-2 is _always_ write-through */
29 30
31#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
32#define CCR1 0xffffffec
33#define CCR CCR1
34
35#define CCR_CACHE_CE 0x01 /* Cache enable */
36#define CCR_CACHE_WT 0x06 /* CCR[bit1=1,bit2=1] */
37 /* 0x00000000-0x7fffffff: Write-through */
38 /* 0x80000000-0x9fffffff: Write-back */
39 /* 0xc0000000-0xdfffffff: Write-through */
40#define CCR_CACHE_CB 0x00 /* CCR[bit1=0,bit2=0] */
41 /* 0x00000000-0x7fffffff: Write-back */
42 /* 0x80000000-0x9fffffff: Write-through */
43 /* 0xc0000000-0xdfffffff: Write-back */
44#define CCR_CACHE_CF 0x08 /* Cache invalidate */
45
46#define CACHE_OC_ADDRESS_ARRAY 0xf0000000
47#define CACHE_OC_DATA_ARRAY 0xf1000000
48
49#define CCR_CACHE_ENABLE CCR_CACHE_CE
50#define CCR_CACHE_INVALIDATE CCR_CACHE_CF
51#endif
30#endif /* __ASM_CPU_SH2_CACHE_H */ 52#endif /* __ASM_CPU_SH2_CACHE_H */
31 53
diff --git a/include/asm-sh/cpu-sh2/freq.h b/include/asm-sh/cpu-sh2/freq.h
new file mode 100644
index 000000000000..31de475da70b
--- /dev/null
+++ b/include/asm-sh/cpu-sh2/freq.h
@@ -0,0 +1,18 @@
1/*
2 * include/asm-sh/cpu-sh2/freq.h
3 *
4 * Copyright (C) 2006 Yoshinori Sato
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH2_FREQ_H
11#define __ASM_CPU_SH2_FREQ_H
12
13#if defined(CONFIG_CPU_SUBTYPE_SH7619)
14#define FREQCR 0xf815ff80
15#endif
16
17#endif /* __ASM_CPU_SH2_FREQ_H */
18
diff --git a/include/asm-sh/cpu-sh2/mmu_context.h b/include/asm-sh/cpu-sh2/mmu_context.h
new file mode 100644
index 000000000000..beeb299e01ec
--- /dev/null
+++ b/include/asm-sh/cpu-sh2/mmu_context.h
@@ -0,0 +1,16 @@
1/*
2 * include/asm-sh/cpu-sh2/mmu_context.h
3 *
4 * Copyright (C) 2003 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH2_MMU_CONTEXT_H
11#define __ASM_CPU_SH2_MMU_CONTEXT_H
12
13/* No MMU */
14
15#endif /* __ASM_CPU_SH2_MMU_CONTEXT_H */
16
diff --git a/include/asm-sh/cpu-sh2/timer.h b/include/asm-sh/cpu-sh2/timer.h
new file mode 100644
index 000000000000..a39c241e8195
--- /dev/null
+++ b/include/asm-sh/cpu-sh2/timer.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_CPU_SH2_TIMER_H
2#define __ASM_CPU_SH2_TIMER_H
3
4/* Nothing needed yet */
5
6#endif /* __ASM_CPU_SH2_TIMER_H */
diff --git a/include/asm-sh/cpu-sh2a/addrspace.h b/include/asm-sh/cpu-sh2a/addrspace.h
new file mode 100644
index 000000000000..3d2e9aa21522
--- /dev/null
+++ b/include/asm-sh/cpu-sh2a/addrspace.h
@@ -0,0 +1 @@
#include <asm/cpu-sh2/addrspace.h>
diff --git a/include/asm-sh/cpu-sh2a/cache.h b/include/asm-sh/cpu-sh2a/cache.h
new file mode 100644
index 000000000000..3e4b9e480982
--- /dev/null
+++ b/include/asm-sh/cpu-sh2a/cache.h
@@ -0,0 +1,39 @@
1/*
2 * include/asm-sh/cpu-sh2a/cache.h
3 *
4 * Copyright (C) 2004 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH2A_CACHE_H
11#define __ASM_CPU_SH2A_CACHE_H
12
13#define L1_CACHE_SHIFT 4
14
15#define CCR1 0xfffc1000
16#define CCR2 0xfffc1004
17
18/* CCR1 behaves more like the traditional CCR */
19#define CCR CCR1
20
21/*
22 * Most of the SH-2A CCR1 definitions resemble the SH-4 ones. All others not
23 * listed here are reserved.
24 */
25#define CCR_CACHE_CB 0x0000 /* Hack */
26#define CCR_CACHE_OCE 0x0001
27#define CCR_CACHE_WT 0x0002
28#define CCR_CACHE_OCI 0x0008 /* OCF */
29#define CCR_CACHE_ICE 0x0100
30#define CCR_CACHE_ICI 0x0800 /* ICF */
31
32#define CACHE_IC_ADDRESS_ARRAY 0xf0000000
33#define CACHE_OC_ADDRESS_ARRAY 0xf0800000
34
35#define CCR_CACHE_ENABLE (CCR_CACHE_OCE | CCR_CACHE_ICE)
36#define CCR_CACHE_INVALIDATE (CCR_CACHE_OCI | CCR_CACHE_ICI)
37
38#endif /* __ASM_CPU_SH2A_CACHE_H */
39
diff --git a/include/asm-sh/cpu-sh2a/cacheflush.h b/include/asm-sh/cpu-sh2a/cacheflush.h
new file mode 100644
index 000000000000..fa3186c73350
--- /dev/null
+++ b/include/asm-sh/cpu-sh2a/cacheflush.h
@@ -0,0 +1 @@
#include <asm/cpu-sh2/cacheflush.h>
diff --git a/include/asm-sh/cpu-sh2a/dma.h b/include/asm-sh/cpu-sh2a/dma.h
new file mode 100644
index 000000000000..0d5ad85c1de8
--- /dev/null
+++ b/include/asm-sh/cpu-sh2a/dma.h
@@ -0,0 +1 @@
#include <asm/cpu-sh2/dma.h>
diff --git a/include/asm-sh/cpu-sh2a/freq.h b/include/asm-sh/cpu-sh2a/freq.h
new file mode 100644
index 000000000000..e518fff6d10f
--- /dev/null
+++ b/include/asm-sh/cpu-sh2a/freq.h
@@ -0,0 +1,18 @@
1/*
2 * include/asm-sh/cpu-sh2a/freq.h
3 *
4 * Copyright (C) 2006 Yoshinori Sato
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH2A_FREQ_H
11#define __ASM_CPU_SH2A_FREQ_H
12
13#if defined(CONFIG_CPU_SUBTYPE_SH7206)
14#define FREQCR 0xfffe0010
15#endif
16
17#endif /* __ASM_CPU_SH2A_FREQ_H */
18
diff --git a/include/asm-sh/cpu-sh2a/mmu_context.h b/include/asm-sh/cpu-sh2a/mmu_context.h
new file mode 100644
index 000000000000..cd2387f7db9e
--- /dev/null
+++ b/include/asm-sh/cpu-sh2a/mmu_context.h
@@ -0,0 +1 @@
#include <asm/cpu-sh2/mmu_context.h>
diff --git a/include/asm-sh/cpu-sh2a/timer.h b/include/asm-sh/cpu-sh2a/timer.h
new file mode 100644
index 000000000000..fee504adf11e
--- /dev/null
+++ b/include/asm-sh/cpu-sh2a/timer.h
@@ -0,0 +1 @@
#include <asm/cpu-sh2/timer.h>
diff --git a/include/asm-sh/cpu-sh2a/ubc.h b/include/asm-sh/cpu-sh2a/ubc.h
new file mode 100644
index 000000000000..cf28062b96a2
--- /dev/null
+++ b/include/asm-sh/cpu-sh2a/ubc.h
@@ -0,0 +1 @@
#include <asm/cpu-sh2/ubc.h>
diff --git a/include/asm-sh/cpu-sh2a/watchdog.h b/include/asm-sh/cpu-sh2a/watchdog.h
new file mode 100644
index 000000000000..c1b3e2488478
--- /dev/null
+++ b/include/asm-sh/cpu-sh2a/watchdog.h
@@ -0,0 +1 @@
#include <asm/cpu-sh2/watchdog.h>
diff --git a/include/asm-sh/device.h b/include/asm-sh/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-sh/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h
index 56cd4b977232..37ab0c131a4d 100644
--- a/include/asm-sh/dma-mapping.h
+++ b/include/asm-sh/dma-mapping.h
@@ -53,7 +53,7 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
53 consistent_free(vaddr, size); 53 consistent_free(vaddr, size);
54} 54}
55 55
56static inline void dma_cache_sync(void *vaddr, size_t size, 56static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
57 enum dma_data_direction dir) 57 enum dma_data_direction dir)
58{ 58{
59 consistent_sync(vaddr, size, (int)dir); 59 consistent_sync(vaddr, size, (int)dir);
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h
index d9daa028689f..faf3051cd429 100644
--- a/include/asm-sh/dma.h
+++ b/include/asm-sh/dma.h
@@ -14,9 +14,7 @@
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/wait.h> 15#include <linux/wait.h>
16#include <linux/sysdev.h> 16#include <linux/sysdev.h>
17#include <linux/device.h>
18#include <asm/cpu/dma.h> 17#include <asm/cpu/dma.h>
19#include <asm/semaphore.h>
20 18
21/* The maximum address that we can perform a DMA transfer to on this platform */ 19/* The maximum address that we can perform a DMA transfer to on this platform */
22/* Don't define MAX_DMA_ADDRESS; it's useless on the SuperH and any 20/* Don't define MAX_DMA_ADDRESS; it's useless on the SuperH and any
@@ -46,16 +44,21 @@
46 * DMAC (dma_info) flags 44 * DMAC (dma_info) flags
47 */ 45 */
48enum { 46enum {
49 DMAC_CHANNELS_CONFIGURED = 0x00, 47 DMAC_CHANNELS_CONFIGURED = 0x01,
50 DMAC_CHANNELS_TEI_CAPABLE = 0x01, 48 DMAC_CHANNELS_TEI_CAPABLE = 0x02, /* Transfer end interrupt */
51}; 49};
52 50
53/* 51/*
54 * DMA channel capabilities / flags 52 * DMA channel capabilities / flags
55 */ 53 */
56enum { 54enum {
57 DMA_TEI_CAPABLE = 0x01, 55 DMA_CONFIGURED = 0x01,
58 DMA_CONFIGURED = 0x02, 56
57 /*
58 * Transfer end interrupt, inherited from DMAC.
59 * wait_queue used in dma_wait_for_completion.
60 */
61 DMA_TEI_CAPABLE = 0x02,
59}; 62};
60 63
61extern spinlock_t dma_spin_lock; 64extern spinlock_t dma_spin_lock;
@@ -68,28 +71,31 @@ struct dma_ops {
68 71
69 int (*get_residue)(struct dma_channel *chan); 72 int (*get_residue)(struct dma_channel *chan);
70 int (*xfer)(struct dma_channel *chan); 73 int (*xfer)(struct dma_channel *chan);
71 void (*configure)(struct dma_channel *chan, unsigned long flags); 74 int (*configure)(struct dma_channel *chan, unsigned long flags);
75 int (*extend)(struct dma_channel *chan, unsigned long op, void *param);
72}; 76};
73 77
74struct dma_channel { 78struct dma_channel {
75 char dev_id[16]; 79 char dev_id[16]; /* unique name per DMAC of channel */
76 80
77 unsigned int chan; /* Physical channel number */ 81 unsigned int chan; /* DMAC channel number */
78 unsigned int vchan; /* Virtual channel number */ 82 unsigned int vchan; /* Virtual channel number */
83
79 unsigned int mode; 84 unsigned int mode;
80 unsigned int count; 85 unsigned int count;
81 86
82 unsigned long sar; 87 unsigned long sar;
83 unsigned long dar; 88 unsigned long dar;
84 89
90 const char **caps;
91
85 unsigned long flags; 92 unsigned long flags;
86 atomic_t busy; 93 atomic_t busy;
87 94
88 struct semaphore sem;
89 wait_queue_head_t wait_queue; 95 wait_queue_head_t wait_queue;
90 96
91 struct sys_device dev; 97 struct sys_device dev;
92 char *name; 98 void *priv_data;
93}; 99};
94 100
95struct dma_info { 101struct dma_info {
@@ -103,6 +109,12 @@ struct dma_info {
103 struct dma_channel *channels; 109 struct dma_channel *channels;
104 110
105 struct list_head list; 111 struct list_head list;
112 int first_channel_nr;
113};
114
115struct dma_chan_caps {
116 int ch_num;
117 const char **caplist;
106}; 118};
107 119
108#define to_dma_channel(channel) container_of(channel, struct dma_channel, dev) 120#define to_dma_channel(channel) container_of(channel, struct dma_channel, dev)
@@ -121,6 +133,8 @@ extern int dma_xfer(unsigned int chan, unsigned long from,
121#define dma_read_page(chan, from, to) \ 133#define dma_read_page(chan, from, to) \
122 dma_read(chan, from, to, PAGE_SIZE) 134 dma_read(chan, from, to, PAGE_SIZE)
123 135
136extern int request_dma_bycap(const char **dmac, const char **caps,
137 const char *dev_id);
124extern int request_dma(unsigned int chan, const char *dev_id); 138extern int request_dma(unsigned int chan, const char *dev_id);
125extern void free_dma(unsigned int chan); 139extern void free_dma(unsigned int chan);
126extern int get_dma_residue(unsigned int chan); 140extern int get_dma_residue(unsigned int chan);
@@ -131,6 +145,10 @@ extern void dma_configure_channel(unsigned int chan, unsigned long flags);
131 145
132extern int register_dmac(struct dma_info *info); 146extern int register_dmac(struct dma_info *info);
133extern void unregister_dmac(struct dma_info *info); 147extern void unregister_dmac(struct dma_info *info);
148extern struct dma_info *get_dma_info_by_name(const char *dmac_name);
149
150extern int dma_extend(unsigned int chan, unsigned long op, void *param);
151extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist);
134 152
135#ifdef CONFIG_SYSFS 153#ifdef CONFIG_SYSFS
136/* arch/sh/drivers/dma/dma-sysfs.c */ 154/* arch/sh/drivers/dma/dma-sysfs.c */
diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h
index fc050fd7645e..43ca244564b1 100644
--- a/include/asm-sh/elf.h
+++ b/include/asm-sh/elf.h
@@ -74,7 +74,7 @@ typedef struct user_fpu_struct elf_fpregset_t;
74#define ELF_ARCH EM_SH 74#define ELF_ARCH EM_SH
75 75
76#define USE_ELF_CORE_DUMP 76#define USE_ELF_CORE_DUMP
77#define ELF_EXEC_PAGESIZE 4096 77#define ELF_EXEC_PAGESIZE PAGE_SIZE
78 78
79/* This is the location that an ET_DYN program is loaded if exec'ed. Typical 79/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
80 use of this is to invoke "./ld.so someprog" to test out a new version of 80 use of this is to invoke "./ld.so someprog" to test out a new version of
diff --git a/include/asm-sh/entry-macros.S b/include/asm-sh/entry-macros.S
new file mode 100644
index 000000000000..500030eae7aa
--- /dev/null
+++ b/include/asm-sh/entry-macros.S
@@ -0,0 +1,33 @@
1! entry.S macro define
2
3 .macro cli
4 stc sr, r0
5 or #0xf0, r0
6 ldc r0, sr
7 .endm
8
9 .macro sti
10 mov #0xf0, r11
11 extu.b r11, r11
12 not r11, r11
13 stc sr, r10
14 and r11, r10
15#ifdef CONFIG_HAS_SR_RB
16 stc k_g_imask, r11
17 or r11, r10
18#endif
19 ldc r10, sr
20 .endm
21
22 .macro get_current_thread_info, ti, tmp
23#ifdef CONFIG_HAS_SR_RB
24 stc r7_bank, \ti
25#else
26 mov #((THREAD_SIZE - 1) >> 10) ^ 0xff, \tmp
27 shll8 \tmp
28 shll2 \tmp
29 mov r15, \ti
30 and \tmp, \ti
31#endif
32 .endm
33
diff --git a/include/asm-sh/irq-sh73180.h b/include/asm-sh/irq-sh73180.h
deleted file mode 100644
index b28af9a69d72..000000000000
--- a/include/asm-sh/irq-sh73180.h
+++ /dev/null
@@ -1,314 +0,0 @@
1#ifndef __ASM_SH_IRQ_SH73180_H
2#define __ASM_SH_IRQ_SH73180_H
3
4/*
5 * linux/include/asm-sh/irq-sh73180.h
6 *
7 * Copyright (C) 2004 Takashi SHUDO <shudo@hitachi-ul.co.jp>
8 */
9
10#undef INTC_IPRA
11#undef INTC_IPRB
12#undef INTC_IPRC
13#undef INTC_IPRD
14
15#undef DMTE0_IRQ
16#undef DMTE1_IRQ
17#undef DMTE2_IRQ
18#undef DMTE3_IRQ
19#undef DMTE4_IRQ
20#undef DMTE5_IRQ
21#undef DMTE6_IRQ
22#undef DMTE7_IRQ
23#undef DMAE_IRQ
24#undef DMA_IPR_ADDR
25#undef DMA_IPR_POS
26#undef DMA_PRIORITY
27
28#undef INTC_IMCR0
29#undef INTC_IMCR1
30#undef INTC_IMCR2
31#undef INTC_IMCR3
32#undef INTC_IMCR4
33#undef INTC_IMCR5
34#undef INTC_IMCR6
35#undef INTC_IMCR7
36#undef INTC_IMCR8
37#undef INTC_IMCR9
38#undef INTC_IMCR10
39
40
41#define INTC_IPRA 0xA4080000UL
42#define INTC_IPRB 0xA4080004UL
43#define INTC_IPRC 0xA4080008UL
44#define INTC_IPRD 0xA408000CUL
45#define INTC_IPRE 0xA4080010UL
46#define INTC_IPRF 0xA4080014UL
47#define INTC_IPRG 0xA4080018UL
48#define INTC_IPRH 0xA408001CUL
49#define INTC_IPRI 0xA4080020UL
50#define INTC_IPRJ 0xA4080024UL
51#define INTC_IPRK 0xA4080028UL
52
53#define INTC_IMR0 0xA4080080UL
54#define INTC_IMR1 0xA4080084UL
55#define INTC_IMR2 0xA4080088UL
56#define INTC_IMR3 0xA408008CUL
57#define INTC_IMR4 0xA4080090UL
58#define INTC_IMR5 0xA4080094UL
59#define INTC_IMR6 0xA4080098UL
60#define INTC_IMR7 0xA408009CUL
61#define INTC_IMR8 0xA40800A0UL
62#define INTC_IMR9 0xA40800A4UL
63#define INTC_IMR10 0xA40800A8UL
64#define INTC_IMR11 0xA40800ACUL
65
66#define INTC_IMCR0 0xA40800C0UL
67#define INTC_IMCR1 0xA40800C4UL
68#define INTC_IMCR2 0xA40800C8UL
69#define INTC_IMCR3 0xA40800CCUL
70#define INTC_IMCR4 0xA40800D0UL
71#define INTC_IMCR5 0xA40800D4UL
72#define INTC_IMCR6 0xA40800D8UL
73#define INTC_IMCR7 0xA40800DCUL
74#define INTC_IMCR8 0xA40800E0UL
75#define INTC_IMCR9 0xA40800E4UL
76#define INTC_IMCR10 0xA40800E8UL
77#define INTC_IMCR11 0xA40800ECUL
78
79#define INTC_ICR0 0xA4140000UL
80#define INTC_ICR1 0xA414001CUL
81
82#define INTMSK0 0xa4140044
83#define INTMSKCLR0 0xa4140064
84#define INTC_INTPRI0 0xa4140010
85
86/*
87 NOTE:
88
89 *_IRQ = (INTEVT2 - 0x200)/0x20
90*/
91
92/* TMU0 */
93#define TMU0_IRQ 16
94#define TMU0_IPR_ADDR INTC_IPRA
95#define TMU0_IPR_POS 3
96#define TMU0_PRIORITY 2
97
98#define TIMER_IRQ 16
99#define TIMER_IPR_ADDR INTC_IPRA
100#define TIMER_IPR_POS 3
101#define TIMER_PRIORITY 2
102
103/* TMU1 */
104#define TMU1_IRQ 17
105#define TMU1_IPR_ADDR INTC_IPRA
106#define TMU1_IPR_POS 2
107#define TMU1_PRIORITY 2
108
109/* TMU2 */
110#define TMU2_IRQ 18
111#define TMU2_IPR_ADDR INTC_IPRA
112#define TMU2_IPR_POS 1
113#define TMU2_PRIORITY 2
114
115/* LCDC */
116#define LCDC_IRQ 28
117#define LCDC_IPR_ADDR INTC_IPRB
118#define LCDC_IPR_POS 2
119#define LCDC_PRIORITY 2
120
121/* VIO (Video I/O) */
122#define CEU_IRQ 52
123#define BEU_IRQ 53
124#define VEU_IRQ 54
125#define VOU_IRQ 55
126#define VIO_IPR_ADDR INTC_IPRE
127#define VIO_IPR_POS 2
128#define VIO_PRIORITY 2
129
130/* MFI (Multi Functional Interface) */
131#define MFI_IRQ 56
132#define MFI_IPR_ADDR INTC_IPRE
133#define MFI_IPR_POS 1
134#define MFI_PRIORITY 2
135
136/* VPU (Video Processing Unit) */
137#define VPU_IRQ 60
138#define VPU_IPR_ADDR INTC_IPRE
139#define VPU_IPR_POS 0
140#define VPU_PRIORITY 2
141
142/* 3DG */
143#define TDG_IRQ 63
144#define TDG_IPR_ADDR INTC_IPRJ
145#define TDG_IPR_POS 2
146#define TDG_PRIORITY 2
147
148/* DMAC(1) */
149#define DMTE0_IRQ 48
150#define DMTE1_IRQ 49
151#define DMTE2_IRQ 50
152#define DMTE3_IRQ 51
153#define DMA1_IPR_ADDR INTC_IPRE
154#define DMA1_IPR_POS 3
155#define DMA1_PRIORITY 7
156
157/* DMAC(2) */
158#define DMTE4_IRQ 76
159#define DMTE5_IRQ 77
160#define DMA2_IPR_ADDR INTC_IPRF
161#define DMA2_IPR_POS 2
162#define DMA2_PRIORITY 7
163
164/* SCIF0 */
165#define SCIF_ERI_IRQ 80
166#define SCIF_RXI_IRQ 81
167#define SCIF_BRI_IRQ 82
168#define SCIF_TXI_IRQ 83
169#define SCIF_IPR_ADDR INTC_IPRG
170#define SCIF_IPR_POS 3
171#define SCIF_PRIORITY 3
172
173/* SIOF0 */
174#define SIOF0_IRQ 84
175#define SIOF0_IPR_ADDR INTC_IPRH
176#define SIOF0_IPR_POS 3
177#define SIOF0_PRIORITY 3
178
179/* FLCTL (Flash Memory Controller) */
180#define FLSTE_IRQ 92
181#define FLTEND_IRQ 93
182#define FLTRQ0_IRQ 94
183#define FLTRQ1_IRQ 95
184#define FLCTL_IPR_ADDR INTC_IPRH
185#define FLCTL_IPR_POS 1
186#define FLCTL_PRIORITY 3
187
188/* IIC(0) (IIC Bus Interface) */
189#define IIC0_ALI_IRQ 96
190#define IIC0_TACKI_IRQ 97
191#define IIC0_WAITI_IRQ 98
192#define IIC0_DTEI_IRQ 99
193#define IIC0_IPR_ADDR INTC_IPRH
194#define IIC0_IPR_POS 0
195#define IIC0_PRIORITY 3
196
197/* IIC(1) (IIC Bus Interface) */
198#define IIC1_ALI_IRQ 44
199#define IIC1_TACKI_IRQ 45
200#define IIC1_WAITI_IRQ 46
201#define IIC1_DTEI_IRQ 47
202#define IIC1_IPR_ADDR INTC_IPRG
203#define IIC1_IPR_POS 0
204#define IIC1_PRIORITY 3
205
206/* SIO0 */
207#define SIO0_IRQ 88
208#define SIO0_IPR_ADDR INTC_IPRI
209#define SIO0_IPR_POS 3
210#define SIO0_PRIORITY 3
211
212/* SDHI */
213#define SDHI_SDHII0_IRQ 100
214#define SDHI_SDHII1_IRQ 101
215#define SDHI_SDHII2_IRQ 102
216#define SDHI_SDHII3_IRQ 103
217#define SDHI_IPR_ADDR INTC_IPRK
218#define SDHI_IPR_POS 0
219#define SDHI_PRIORITY 3
220
221/* SIU (Sound Interface Unit) */
222#define SIU_IRQ 108
223#define SIU_IPR_ADDR INTC_IPRJ
224#define SIU_IPR_POS 1
225#define SIU_PRIORITY 3
226
227#define PORT_PACR 0xA4050100UL
228#define PORT_PBCR 0xA4050102UL
229#define PORT_PCCR 0xA4050104UL
230#define PORT_PDCR 0xA4050106UL
231#define PORT_PECR 0xA4050108UL
232#define PORT_PFCR 0xA405010AUL
233#define PORT_PGCR 0xA405010CUL
234#define PORT_PHCR 0xA405010EUL
235#define PORT_PJCR 0xA4050110UL
236#define PORT_PKCR 0xA4050112UL
237#define PORT_PLCR 0xA4050114UL
238#define PORT_SCPCR 0xA4050116UL
239#define PORT_PMCR 0xA4050118UL
240#define PORT_PNCR 0xA405011AUL
241#define PORT_PQCR 0xA405011CUL
242#define PORT_PRCR 0xA405011EUL
243#define PORT_PTCR 0xA405014CUL
244#define PORT_PUCR 0xA405014EUL
245#define PORT_PVCR 0xA4050150UL
246
247#define PORT_PSELA 0xA4050140UL
248#define PORT_PSELB 0xA4050142UL
249#define PORT_PSELC 0xA4050144UL
250#define PORT_PSELE 0xA4050158UL
251
252#define PORT_HIZCRA 0xA4050146UL
253#define PORT_HIZCRB 0xA4050148UL
254#define PORT_DRVCR 0xA405014AUL
255
256#define PORT_PADR 0xA4050120UL
257#define PORT_PBDR 0xA4050122UL
258#define PORT_PCDR 0xA4050124UL
259#define PORT_PDDR 0xA4050126UL
260#define PORT_PEDR 0xA4050128UL
261#define PORT_PFDR 0xA405012AUL
262#define PORT_PGDR 0xA405012CUL
263#define PORT_PHDR 0xA405012EUL
264#define PORT_PJDR 0xA4050130UL
265#define PORT_PKDR 0xA4050132UL
266#define PORT_PLDR 0xA4050134UL
267#define PORT_SCPDR 0xA4050136UL
268#define PORT_PMDR 0xA4050138UL
269#define PORT_PNDR 0xA405013AUL
270#define PORT_PQDR 0xA405013CUL
271#define PORT_PRDR 0xA405013EUL
272#define PORT_PTDR 0xA405016CUL
273#define PORT_PUDR 0xA405016EUL
274#define PORT_PVDR 0xA4050170UL
275
276#define IRQ0_IRQ 32
277#define IRQ1_IRQ 33
278#define IRQ2_IRQ 34
279#define IRQ3_IRQ 35
280#define IRQ4_IRQ 36
281#define IRQ5_IRQ 37
282#define IRQ6_IRQ 38
283#define IRQ7_IRQ 39
284
285#define INTPRI00 0xA4140010UL
286
287#define IRQ0_IPR_ADDR INTPRI00
288#define IRQ1_IPR_ADDR INTPRI00
289#define IRQ2_IPR_ADDR INTPRI00
290#define IRQ3_IPR_ADDR INTPRI00
291#define IRQ4_IPR_ADDR INTPRI00
292#define IRQ5_IPR_ADDR INTPRI00
293#define IRQ6_IPR_ADDR INTPRI00
294#define IRQ7_IPR_ADDR INTPRI00
295
296#define IRQ0_IPR_POS 7
297#define IRQ1_IPR_POS 6
298#define IRQ2_IPR_POS 5
299#define IRQ3_IPR_POS 4
300#define IRQ4_IPR_POS 3
301#define IRQ5_IPR_POS 2
302#define IRQ6_IPR_POS 1
303#define IRQ7_IPR_POS 0
304
305#define IRQ0_PRIORITY 1
306#define IRQ1_PRIORITY 1
307#define IRQ2_PRIORITY 1
308#define IRQ3_PRIORITY 1
309#define IRQ4_PRIORITY 1
310#define IRQ5_PRIORITY 1
311#define IRQ6_PRIORITY 1
312#define IRQ7_PRIORITY 1
313
314#endif /* __ASM_SH_IRQ_SH73180_H */
diff --git a/include/asm-sh/irq-sh7343.h b/include/asm-sh/irq-sh7343.h
deleted file mode 100644
index 5d15419b53b0..000000000000
--- a/include/asm-sh/irq-sh7343.h
+++ /dev/null
@@ -1,317 +0,0 @@
1#ifndef __ASM_SH_IRQ_SH7343_H
2#define __ASM_SH_IRQ_SH7343_H
3
4/*
5 * linux/include/asm-sh/irq-sh7343.h
6 *
7 * Copyright (C) 2006 Kenati Technologies Inc.
8 * Andre Mccurdy <andre@kenati.com>
9 * Ranjit Deshpande <ranjit@kenati.com>
10 */
11
12#undef INTC_IPRA
13#undef INTC_IPRB
14#undef INTC_IPRC
15#undef INTC_IPRD
16
17#undef DMTE0_IRQ
18#undef DMTE1_IRQ
19#undef DMTE2_IRQ
20#undef DMTE3_IRQ
21#undef DMTE4_IRQ
22#undef DMTE5_IRQ
23#undef DMTE6_IRQ
24#undef DMTE7_IRQ
25#undef DMAE_IRQ
26#undef DMA_IPR_ADDR
27#undef DMA_IPR_POS
28#undef DMA_PRIORITY
29
30#undef INTC_IMCR0
31#undef INTC_IMCR1
32#undef INTC_IMCR2
33#undef INTC_IMCR3
34#undef INTC_IMCR4
35#undef INTC_IMCR5
36#undef INTC_IMCR6
37#undef INTC_IMCR7
38#undef INTC_IMCR8
39#undef INTC_IMCR9
40#undef INTC_IMCR10
41
42
43#define INTC_IPRA 0xA4080000UL
44#define INTC_IPRB 0xA4080004UL
45#define INTC_IPRC 0xA4080008UL
46#define INTC_IPRD 0xA408000CUL
47#define INTC_IPRE 0xA4080010UL
48#define INTC_IPRF 0xA4080014UL
49#define INTC_IPRG 0xA4080018UL
50#define INTC_IPRH 0xA408001CUL
51#define INTC_IPRI 0xA4080020UL
52#define INTC_IPRJ 0xA4080024UL
53#define INTC_IPRK 0xA4080028UL
54#define INTC_IPRL 0xA408002CUL
55
56#define INTC_IMR0 0xA4080080UL
57#define INTC_IMR1 0xA4080084UL
58#define INTC_IMR2 0xA4080088UL
59#define INTC_IMR3 0xA408008CUL
60#define INTC_IMR4 0xA4080090UL
61#define INTC_IMR5 0xA4080094UL
62#define INTC_IMR6 0xA4080098UL
63#define INTC_IMR7 0xA408009CUL
64#define INTC_IMR8 0xA40800A0UL
65#define INTC_IMR9 0xA40800A4UL
66#define INTC_IMR10 0xA40800A8UL
67#define INTC_IMR11 0xA40800ACUL
68
69#define INTC_IMCR0 0xA40800C0UL
70#define INTC_IMCR1 0xA40800C4UL
71#define INTC_IMCR2 0xA40800C8UL
72#define INTC_IMCR3 0xA40800CCUL
73#define INTC_IMCR4 0xA40800D0UL
74#define INTC_IMCR5 0xA40800D4UL
75#define INTC_IMCR6 0xA40800D8UL
76#define INTC_IMCR7 0xA40800DCUL
77#define INTC_IMCR8 0xA40800E0UL
78#define INTC_IMCR9 0xA40800E4UL
79#define INTC_IMCR10 0xA40800E8UL
80#define INTC_IMCR11 0xA40800ECUL
81
82#define INTC_ICR0 0xA4140000UL
83#define INTC_ICR1 0xA414001CUL
84
85#define INTMSK0 0xa4140044
86#define INTMSKCLR0 0xa4140064
87#define INTC_INTPRI0 0xa4140010
88
89/*
90 NOTE:
91
92 *_IRQ = (INTEVT2 - 0x200)/0x20
93*/
94
95/* TMU0 */
96#define TMU0_IRQ 16
97#define TMU0_IPR_ADDR INTC_IPRA
98#define TMU0_IPR_POS 3
99#define TMU0_PRIORITY 2
100
101#define TIMER_IRQ 16
102#define TIMER_IPR_ADDR INTC_IPRA
103#define TIMER_IPR_POS 3
104#define TIMER_PRIORITY 2
105
106/* TMU1 */
107#define TMU1_IRQ 17
108#define TMU1_IPR_ADDR INTC_IPRA
109#define TMU1_IPR_POS 2
110#define TMU1_PRIORITY 2
111
112/* TMU2 */
113#define TMU2_IRQ 18
114#define TMU2_IPR_ADDR INTC_IPRA
115#define TMU2_IPR_POS 1
116#define TMU2_PRIORITY 2
117
118/* LCDC */
119#define LCDC_IRQ 28
120#define LCDC_IPR_ADDR INTC_IPRB
121#define LCDC_IPR_POS 2
122#define LCDC_PRIORITY 2
123
124/* VIO (Video I/O) */
125#define CEU_IRQ 52
126#define BEU_IRQ 53
127#define VEU_IRQ 54
128#define VOU_IRQ 55
129#define VIO_IPR_ADDR INTC_IPRE
130#define VIO_IPR_POS 2
131#define VIO_PRIORITY 2
132
133/* MFI (Multi Functional Interface) */
134#define MFI_IRQ 56
135#define MFI_IPR_ADDR INTC_IPRE
136#define MFI_IPR_POS 1
137#define MFI_PRIORITY 2
138
139/* VPU (Video Processing Unit) */
140#define VPU_IRQ 60
141#define VPU_IPR_ADDR INTC_IPRE
142#define VPU_IPR_POS 0
143#define VPU_PRIORITY 2
144
145/* 3DG */
146#define TDG_IRQ 63
147#define TDG_IPR_ADDR INTC_IPRJ
148#define TDG_IPR_POS 2
149#define TDG_PRIORITY 2
150
151/* DMAC(1) */
152#define DMTE0_IRQ 48
153#define DMTE1_IRQ 49
154#define DMTE2_IRQ 50
155#define DMTE3_IRQ 51
156#define DMA1_IPR_ADDR INTC_IPRE
157#define DMA1_IPR_POS 3
158#define DMA1_PRIORITY 7
159
160/* DMAC(2) */
161#define DMTE4_IRQ 76
162#define DMTE5_IRQ 77
163#define DMA2_IPR_ADDR INTC_IPRF
164#define DMA2_IPR_POS 2
165#define DMA2_PRIORITY 7
166
167/* SCIF0 */
168#define SCIF_ERI_IRQ 80
169#define SCIF_RXI_IRQ 81
170#define SCIF_BRI_IRQ 82
171#define SCIF_TXI_IRQ 83
172#define SCIF_IPR_ADDR INTC_IPRG
173#define SCIF_IPR_POS 3
174#define SCIF_PRIORITY 3
175
176/* SIOF0 */
177#define SIOF0_IRQ 84
178#define SIOF0_IPR_ADDR INTC_IPRH
179#define SIOF0_IPR_POS 3
180#define SIOF0_PRIORITY 3
181
182/* FLCTL (Flash Memory Controller) */
183#define FLSTE_IRQ 92
184#define FLTEND_IRQ 93
185#define FLTRQ0_IRQ 94
186#define FLTRQ1_IRQ 95
187#define FLCTL_IPR_ADDR INTC_IPRH
188#define FLCTL_IPR_POS 1
189#define FLCTL_PRIORITY 3
190
191/* IIC(0) (IIC Bus Interface) */
192#define IIC0_ALI_IRQ 96
193#define IIC0_TACKI_IRQ 97
194#define IIC0_WAITI_IRQ 98
195#define IIC0_DTEI_IRQ 99
196#define IIC0_IPR_ADDR INTC_IPRH
197#define IIC0_IPR_POS 0
198#define IIC0_PRIORITY 3
199
200/* IIC(1) (IIC Bus Interface) */
201#define IIC1_ALI_IRQ 44
202#define IIC1_TACKI_IRQ 45
203#define IIC1_WAITI_IRQ 46
204#define IIC1_DTEI_IRQ 47
205#define IIC1_IPR_ADDR INTC_IPRI
206#define IIC1_IPR_POS 0
207#define IIC1_PRIORITY 3
208
209/* SIO0 */
210#define SIO0_IRQ 88
211#define SIO0_IPR_ADDR INTC_IPRI
212#define SIO0_IPR_POS 3
213#define SIO0_PRIORITY 3
214
215/* SDHI */
216#define SDHI_SDHII0_IRQ 100
217#define SDHI_SDHII1_IRQ 101
218#define SDHI_SDHII2_IRQ 102
219#define SDHI_SDHII3_IRQ 103
220#define SDHI_IPR_ADDR INTC_IPRK
221#define SDHI_IPR_POS 0
222#define SDHI_PRIORITY 3
223
224/* SIU (Sound Interface Unit) */
225#define SIU_IRQ 108
226#define SIU_IPR_ADDR INTC_IPRJ
227#define SIU_IPR_POS 1
228#define SIU_PRIORITY 3
229
230#define PORT_PACR 0xA4050100UL
231#define PORT_PBCR 0xA4050102UL
232#define PORT_PCCR 0xA4050104UL
233#define PORT_PDCR 0xA4050106UL
234#define PORT_PECR 0xA4050108UL
235#define PORT_PFCR 0xA405010AUL
236#define PORT_PGCR 0xA405010CUL
237#define PORT_PHCR 0xA405010EUL
238#define PORT_PJCR 0xA4050110UL
239#define PORT_PKCR 0xA4050112UL
240#define PORT_PLCR 0xA4050114UL
241#define PORT_SCPCR 0xA4050116UL
242#define PORT_PMCR 0xA4050118UL
243#define PORT_PNCR 0xA405011AUL
244#define PORT_PQCR 0xA405011CUL
245#define PORT_PRCR 0xA405011EUL
246#define PORT_PTCR 0xA405014CUL
247#define PORT_PUCR 0xA405014EUL
248#define PORT_PVCR 0xA4050150UL
249
250#define PORT_PSELA 0xA4050140UL
251#define PORT_PSELB 0xA4050142UL
252#define PORT_PSELC 0xA4050144UL
253#define PORT_PSELE 0xA4050158UL
254
255#define PORT_HIZCRA 0xA4050146UL
256#define PORT_HIZCRB 0xA4050148UL
257#define PORT_DRVCR 0xA405014AUL
258
259#define PORT_PADR 0xA4050120UL
260#define PORT_PBDR 0xA4050122UL
261#define PORT_PCDR 0xA4050124UL
262#define PORT_PDDR 0xA4050126UL
263#define PORT_PEDR 0xA4050128UL
264#define PORT_PFDR 0xA405012AUL
265#define PORT_PGDR 0xA405012CUL
266#define PORT_PHDR 0xA405012EUL
267#define PORT_PJDR 0xA4050130UL
268#define PORT_PKDR 0xA4050132UL
269#define PORT_PLDR 0xA4050134UL
270#define PORT_SCPDR 0xA4050136UL
271#define PORT_PMDR 0xA4050138UL
272#define PORT_PNDR 0xA405013AUL
273#define PORT_PQDR 0xA405013CUL
274#define PORT_PRDR 0xA405013EUL
275#define PORT_PTDR 0xA405016CUL
276#define PORT_PUDR 0xA405016EUL
277#define PORT_PVDR 0xA4050170UL
278
279#define IRQ0_IRQ 32
280#define IRQ1_IRQ 33
281#define IRQ2_IRQ 34
282#define IRQ3_IRQ 35
283#define IRQ4_IRQ 36
284#define IRQ5_IRQ 37
285#define IRQ6_IRQ 38
286#define IRQ7_IRQ 39
287
288#define INTPRI00 0xA4140010UL
289
290#define IRQ0_IPR_ADDR INTPRI00
291#define IRQ1_IPR_ADDR INTPRI00
292#define IRQ2_IPR_ADDR INTPRI00
293#define IRQ3_IPR_ADDR INTPRI00
294#define IRQ4_IPR_ADDR INTPRI00
295#define IRQ5_IPR_ADDR INTPRI00
296#define IRQ6_IPR_ADDR INTPRI00
297#define IRQ7_IPR_ADDR INTPRI00
298
299#define IRQ0_IPR_POS 7
300#define IRQ1_IPR_POS 6
301#define IRQ2_IPR_POS 5
302#define IRQ3_IPR_POS 4
303#define IRQ4_IPR_POS 3
304#define IRQ5_IPR_POS 2
305#define IRQ6_IPR_POS 1
306#define IRQ7_IPR_POS 0
307
308#define IRQ0_PRIORITY 1
309#define IRQ1_PRIORITY 1
310#define IRQ2_PRIORITY 1
311#define IRQ3_PRIORITY 1
312#define IRQ4_PRIORITY 1
313#define IRQ5_PRIORITY 1
314#define IRQ6_PRIORITY 1
315#define IRQ7_PRIORITY 1
316
317#endif /* __ASM_SH_IRQ_SH7343_H */
diff --git a/include/asm-sh/irq-sh7780.h b/include/asm-sh/irq-sh7780.h
deleted file mode 100644
index 19912ae6a7f7..000000000000
--- a/include/asm-sh/irq-sh7780.h
+++ /dev/null
@@ -1,311 +0,0 @@
1#ifndef __ASM_SH_IRQ_SH7780_H
2#define __ASM_SH_IRQ_SH7780_H
3
4/*
5 * linux/include/asm-sh/irq-sh7780.h
6 *
7 * Copyright (C) 2004 Takashi SHUDO <shudo@hitachi-ul.co.jp>
8 */
9#define INTC_BASE 0xffd00000
10#define INTC_ICR0 (INTC_BASE+0x0)
11#define INTC_ICR1 (INTC_BASE+0x1c)
12#define INTC_INTPRI (INTC_BASE+0x10)
13#define INTC_INTREQ (INTC_BASE+0x24)
14#define INTC_INTMSK0 (INTC_BASE+0x44)
15#define INTC_INTMSK1 (INTC_BASE+0x48)
16#define INTC_INTMSK2 (INTC_BASE+0x40080)
17#define INTC_INTMSKCLR0 (INTC_BASE+0x64)
18#define INTC_INTMSKCLR1 (INTC_BASE+0x68)
19#define INTC_INTMSKCLR2 (INTC_BASE+0x40084)
20#define INTC_NMIFCR (INTC_BASE+0xc0)
21#define INTC_USERIMASK (INTC_BASE+0x30000)
22
23#define INTC_INT2PRI0 (INTC_BASE+0x40000)
24#define INTC_INT2PRI1 (INTC_BASE+0x40004)
25#define INTC_INT2PRI2 (INTC_BASE+0x40008)
26#define INTC_INT2PRI3 (INTC_BASE+0x4000c)
27#define INTC_INT2PRI4 (INTC_BASE+0x40010)
28#define INTC_INT2PRI5 (INTC_BASE+0x40014)
29#define INTC_INT2PRI6 (INTC_BASE+0x40018)
30#define INTC_INT2PRI7 (INTC_BASE+0x4001c)
31#define INTC_INT2A0 (INTC_BASE+0x40030)
32#define INTC_INT2A1 (INTC_BASE+0x40034)
33#define INTC_INT2MSKR (INTC_BASE+0x40038)
34#define INTC_INT2MSKCR (INTC_BASE+0x4003c)
35#define INTC_INT2B0 (INTC_BASE+0x40040)
36#define INTC_INT2B1 (INTC_BASE+0x40044)
37#define INTC_INT2B2 (INTC_BASE+0x40048)
38#define INTC_INT2B3 (INTC_BASE+0x4004c)
39#define INTC_INT2B4 (INTC_BASE+0x40050)
40#define INTC_INT2B5 (INTC_BASE+0x40054)
41#define INTC_INT2B6 (INTC_BASE+0x40058)
42#define INTC_INT2B7 (INTC_BASE+0x4005c)
43#define INTC_INT2GPIC (INTC_BASE+0x40090)
44/*
45 NOTE:
46 *_IRQ = (INTEVT2 - 0x200)/0x20
47*/
48/* IRQ 0-7 line external int*/
49#define IRQ0_IRQ 2
50#define IRQ0_IPR_ADDR INTC_INTPRI
51#define IRQ0_IPR_POS 7
52#define IRQ0_PRIORITY 2
53
54#define IRQ1_IRQ 4
55#define IRQ1_IPR_ADDR INTC_INTPRI
56#define IRQ1_IPR_POS 6
57#define IRQ1_PRIORITY 2
58
59#define IRQ2_IRQ 6
60#define IRQ2_IPR_ADDR INTC_INTPRI
61#define IRQ2_IPR_POS 5
62#define IRQ2_PRIORITY 2
63
64#define IRQ3_IRQ 8
65#define IRQ3_IPR_ADDR INTC_INTPRI
66#define IRQ3_IPR_POS 4
67#define IRQ3_PRIORITY 2
68
69#define IRQ4_IRQ 10
70#define IRQ4_IPR_ADDR INTC_INTPRI
71#define IRQ4_IPR_POS 3
72#define IRQ4_PRIORITY 2
73
74#define IRQ5_IRQ 12
75#define IRQ5_IPR_ADDR INTC_INTPRI
76#define IRQ5_IPR_POS 2
77#define IRQ5_PRIORITY 2
78
79#define IRQ6_IRQ 14
80#define IRQ6_IPR_ADDR INTC_INTPRI
81#define IRQ6_IPR_POS 1
82#define IRQ6_PRIORITY 2
83
84#define IRQ7_IRQ 0
85#define IRQ7_IPR_ADDR INTC_INTPRI
86#define IRQ7_IPR_POS 0
87#define IRQ7_PRIORITY 2
88
89/* TMU */
90/* ch0 */
91#define TMU_IRQ 28
92#define TMU_IPR_ADDR INTC_INT2PRI0
93#define TMU_IPR_POS 3
94#define TMU_PRIORITY 2
95
96#define TIMER_IRQ 28
97#define TIMER_IPR_ADDR INTC_INT2PRI0
98#define TIMER_IPR_POS 3
99#define TIMER_PRIORITY 2
100
101/* ch 1*/
102#define TMU_CH1_IRQ 29
103#define TMU_CH1_IPR_ADDR INTC_INT2PRI0
104#define TMU_CH1_IPR_POS 2
105#define TMU_CH1_PRIORITY 2
106
107#define TIMER1_IRQ 29
108#define TIMER1_IPR_ADDR INTC_INT2PRI0
109#define TIMER1_IPR_POS 2
110#define TIMER1_PRIORITY 2
111
112/* ch 2*/
113#define TMU_CH2_IRQ 30
114#define TMU_CH2_IPR_ADDR INTC_INT2PRI0
115#define TMU_CH2_IPR_POS 1
116#define TMU_CH2_PRIORITY 2
117/* ch 2 Input capture */
118#define TMU_CH2IC_IRQ 31
119#define TMU_CH2IC_IPR_ADDR INTC_INT2PRI0
120#define TMU_CH2IC_IPR_POS 0
121#define TMU_CH2IC_PRIORITY 2
122/* ch 3 */
123#define TMU_CH3_IRQ 96
124#define TMU_CH3_IPR_ADDR INTC_INT2PRI1
125#define TMU_CH3_IPR_POS 3
126#define TMU_CH3_PRIORITY 2
127/* ch 4 */
128#define TMU_CH4_IRQ 97
129#define TMU_CH4_IPR_ADDR INTC_INT2PRI1
130#define TMU_CH4_IPR_POS 2
131#define TMU_CH4_PRIORITY 2
132/* ch 5*/
133#define TMU_CH5_IRQ 98
134#define TMU_CH5_IPR_ADDR INTC_INT2PRI1
135#define TMU_CH5_IPR_POS 1
136#define TMU_CH5_PRIORITY 2
137
138/* SCIF0 */
139#define SCIF0_ERI_IRQ 40
140#define SCIF0_RXI_IRQ 41
141#define SCIF0_BRI_IRQ 42
142#define SCIF0_TXI_IRQ 43
143#define SCIF0_IPR_ADDR INTC_INT2PRI2
144#define SCIF0_IPR_POS 3
145#define SCIF0_PRIORITY 3
146
147/* SCIF1 */
148#define SCIF1_ERI_IRQ 76
149#define SCIF1_RXI_IRQ 77
150#define SCIF1_BRI_IRQ 78
151#define SCIF1_TXI_IRQ 79
152#define SCIF1_IPR_ADDR INTC_INT2PRI2
153#define SCIF1_IPR_POS 2
154#define SCIF1_PRIORITY 3
155
156#define WDT_IRQ 27
157#define WDT_IPR_ADDR INTC_INT2PRI2
158#define WDT_IPR_POS 1
159#define WDT_PRIORITY 2
160
161/* DMAC(0) */
162#define DMINT0_IRQ 34
163#define DMINT1_IRQ 35
164#define DMINT2_IRQ 36
165#define DMINT3_IRQ 37
166#define DMINT4_IRQ 44
167#define DMINT5_IRQ 45
168#define DMINT6_IRQ 46
169#define DMINT7_IRQ 47
170#define DMAE_IRQ 38
171#define DMA0_IPR_ADDR INTC_INT2PRI3
172#define DMA0_IPR_POS 2
173#define DMA0_PRIORITY 7
174
175/* DMAC(1) */
176#define DMINT8_IRQ 92
177#define DMINT9_IRQ 93
178#define DMINT10_IRQ 94
179#define DMINT11_IRQ 95
180#define DMA1_IPR_ADDR INTC_INT2PRI3
181#define DMA1_IPR_POS 1
182#define DMA1_PRIORITY 7
183
184#define DMTE0_IRQ DMINT0_IRQ
185#define DMTE4_IRQ DMINT4_IRQ
186#define DMA_IPR_ADDR DMA0_IPR_ADDR
187#define DMA_IPR_POS DMA0_IPR_POS
188#define DMA_PRIORITY DMA0_PRIORITY
189
190/* CMT */
191#define CMT_IRQ 56
192#define CMT_IPR_ADDR INTC_INT2PRI4
193#define CMT_IPR_POS 3
194#define CMT_PRIORITY 0
195
196/* HAC */
197#define HAC_IRQ 60
198#define HAC_IPR_ADDR INTC_INT2PRI4
199#define HAC_IPR_POS 2
200#define CMT_PRIORITY 0
201
202/* PCIC(0) */
203#define PCIC0_IRQ 64
204#define PCIC0_IPR_ADDR INTC_INT2PRI4
205#define PCIC0_IPR_POS 1
206#define PCIC0_PRIORITY 2
207
208/* PCIC(1) */
209#define PCIC1_IRQ 65
210#define PCIC1_IPR_ADDR INTC_INT2PRI4
211#define PCIC1_IPR_POS 0
212#define PCIC1_PRIORITY 2
213
214/* PCIC(2) */
215#define PCIC2_IRQ 66
216#define PCIC2_IPR_ADDR INTC_INT2PRI5
217#define PCIC2_IPR_POS 3
218#define PCIC2_PRIORITY 2
219
220/* PCIC(3) */
221#define PCIC3_IRQ 67
222#define PCIC3_IPR_ADDR INTC_INT2PRI5
223#define PCIC3_IPR_POS 2
224#define PCIC3_PRIORITY 2
225
226/* PCIC(4) */
227#define PCIC4_IRQ 68
228#define PCIC4_IPR_ADDR INTC_INT2PRI5
229#define PCIC4_IPR_POS 1
230#define PCIC4_PRIORITY 2
231
232/* PCIC(5) */
233#define PCICERR_IRQ 69
234#define PCICPWD3_IRQ 70
235#define PCICPWD2_IRQ 71
236#define PCICPWD1_IRQ 72
237#define PCICPWD0_IRQ 73
238#define PCIC5_IPR_ADDR INTC_INT2PRI5
239#define PCIC5_IPR_POS 0
240#define PCIC5_PRIORITY 2
241
242/* SIOF */
243#define SIOF_IRQ 80
244#define SIOF_IPR_ADDR INTC_INT2PRI6
245#define SIOF_IPR_POS 3
246#define SIOF_PRIORITY 3
247
248/* HSPI */
249#define HSPI_IRQ 84
250#define HSPI_IPR_ADDR INTC_INT2PRI6
251#define HSPI_IPR_POS 2
252#define HSPI_PRIORITY 3
253
254/* MMCIF */
255#define MMCIF_FSTAT_IRQ 88
256#define MMCIF_TRAN_IRQ 89
257#define MMCIF_ERR_IRQ 90
258#define MMCIF_FRDY_IRQ 91
259#define MMCIF_IPR_ADDR INTC_INT2PRI6
260#define MMCIF_IPR_POS 1
261#define HSPI_PRIORITY 3
262
263/* SSI */
264#define SSI_IRQ 100
265#define SSI_IPR_ADDR INTC_INT2PRI6
266#define SSI_IPR_POS 0
267#define SSI_PRIORITY 3
268
269/* FLCTL */
270#define FLCTL_FLSTE_IRQ 104
271#define FLCTL_FLTEND_IRQ 105
272#define FLCTL_FLTRQ0_IRQ 106
273#define FLCTL_FLTRQ1_IRQ 107
274#define FLCTL_IPR_ADDR INTC_INT2PRI7
275#define FLCTL_IPR_POS 3
276#define FLCTL_PRIORITY 3
277
278/* GPIO */
279#define GPIO0_IRQ 108
280#define GPIO1_IRQ 109
281#define GPIO2_IRQ 110
282#define GPIO3_IRQ 111
283#define GPIO_IPR_ADDR INTC_INT2PRI7
284#define GPIO_IPR_POS 2
285#define GPIO_PRIORITY 3
286
287#define INTC_TMU0_MSK 0
288#define INTC_TMU3_MSK 1
289#define INTC_RTC_MSK 2
290#define INTC_SCIF0_MSK 3
291#define INTC_SCIF1_MSK 4
292#define INTC_WDT_MSK 5
293#define INTC_HUID_MSK 7
294#define INTC_DMAC0_MSK 8
295#define INTC_DMAC1_MSK 9
296#define INTC_CMT_MSK 12
297#define INTC_HAC_MSK 13
298#define INTC_PCIC0_MSK 14
299#define INTC_PCIC1_MSK 15
300#define INTC_PCIC2_MSK 16
301#define INTC_PCIC3_MSK 17
302#define INTC_PCIC4_MSK 18
303#define INTC_PCIC5_MSK 19
304#define INTC_SIOF_MSK 20
305#define INTC_HSPI_MSK 21
306#define INTC_MMCIF_MSK 22
307#define INTC_SSI_MSK 23
308#define INTC_FLCTL_MSK 24
309#define INTC_GPIO_MSK 25
310
311#endif /* __ASM_SH_IRQ_SH7780_H */
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index 6cd3e9e2a76a..fd576088e47e 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -1,233 +1,9 @@
1#ifndef __ASM_SH_IRQ_H 1#ifndef __ASM_SH_IRQ_H
2#define __ASM_SH_IRQ_H 2#define __ASM_SH_IRQ_H
3 3
4/*
5 *
6 * linux/include/asm-sh/irq.h
7 *
8 * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi
9 * Copyright (C) 2000 Kazumoto Kojima
10 * Copyright (C) 2003 Paul Mundt
11 *
12 */
13
14#include <asm/machvec.h> 4#include <asm/machvec.h>
15#include <asm/ptrace.h> /* for pt_regs */ 5#include <asm/ptrace.h> /* for pt_regs */
16 6
17#ifndef CONFIG_CPU_SUBTYPE_SH7780
18
19#define INTC_DMAC0_MSK 0
20
21#if defined(CONFIG_CPU_SH3)
22#define INTC_IPRA 0xfffffee2UL
23#define INTC_IPRB 0xfffffee4UL
24#elif defined(CONFIG_CPU_SH4)
25#define INTC_IPRA 0xffd00004UL
26#define INTC_IPRB 0xffd00008UL
27#define INTC_IPRC 0xffd0000cUL
28#define INTC_IPRD 0xffd00010UL
29#endif
30
31#define TIMER_IRQ 16
32#define TIMER_IPR_ADDR INTC_IPRA
33#define TIMER_IPR_POS 3
34#define TIMER_PRIORITY 2
35
36#define TIMER1_IRQ 17
37#define TIMER1_IPR_ADDR INTC_IPRA
38#define TIMER1_IPR_POS 2
39#define TIMER1_PRIORITY 4
40
41#define RTC_IRQ 22
42#define RTC_IPR_ADDR INTC_IPRA
43#define RTC_IPR_POS 0
44#define RTC_PRIORITY TIMER_PRIORITY
45
46#if defined(CONFIG_CPU_SH3)
47#define DMTE0_IRQ 48
48#define DMTE1_IRQ 49
49#define DMTE2_IRQ 50
50#define DMTE3_IRQ 51
51#define DMA_IPR_ADDR INTC_IPRE
52#define DMA_IPR_POS 3
53#define DMA_PRIORITY 7
54#if defined(CONFIG_CPU_SUBTYPE_SH7300)
55/* TMU2 */
56#define TIMER2_IRQ 18
57#define TIMER2_IPR_ADDR INTC_IPRA
58#define TIMER2_IPR_POS 1
59#define TIMER2_PRIORITY 2
60
61/* WDT */
62#define WDT_IRQ 27
63#define WDT_IPR_ADDR INTC_IPRB
64#define WDT_IPR_POS 3
65#define WDT_PRIORITY 2
66
67/* SIM (SIM Card Module) */
68#define SIM_ERI_IRQ 23
69#define SIM_RXI_IRQ 24
70#define SIM_TXI_IRQ 25
71#define SIM_TEND_IRQ 26
72#define SIM_IPR_ADDR INTC_IPRB
73#define SIM_IPR_POS 1
74#define SIM_PRIORITY 2
75
76/* VIO (Video I/O) */
77#define VIO_IRQ 52
78#define VIO_IPR_ADDR INTC_IPRE
79#define VIO_IPR_POS 2
80#define VIO_PRIORITY 2
81
82/* MFI (Multi Functional Interface) */
83#define MFI_IRQ 56
84#define MFI_IPR_ADDR INTC_IPRE
85#define MFI_IPR_POS 1
86#define MFI_PRIORITY 2
87
88/* VPU (Video Processing Unit) */
89#define VPU_IRQ 60
90#define VPU_IPR_ADDR INTC_IPRE
91#define VPU_IPR_POS 0
92#define VPU_PRIORITY 2
93
94/* KEY (Key Scan Interface) */
95#define KEY_IRQ 79
96#define KEY_IPR_ADDR INTC_IPRF
97#define KEY_IPR_POS 3
98#define KEY_PRIORITY 2
99
100/* CMT (Compare Match Timer) */
101#define CMT_IRQ 104
102#define CMT_IPR_ADDR INTC_IPRF
103#define CMT_IPR_POS 0
104#define CMT_PRIORITY 2
105
106/* DMAC(1) */
107#define DMTE0_IRQ 48
108#define DMTE1_IRQ 49
109#define DMTE2_IRQ 50
110#define DMTE3_IRQ 51
111#define DMA1_IPR_ADDR INTC_IPRE
112#define DMA1_IPR_POS 3
113#define DMA1_PRIORITY 7
114
115/* DMAC(2) */
116#define DMTE4_IRQ 76
117#define DMTE5_IRQ 77
118#define DMA2_IPR_ADDR INTC_IPRF
119#define DMA2_IPR_POS 2
120#define DMA2_PRIORITY 7
121
122/* SIOF0 */
123#define SIOF0_IRQ 84
124#define SIOF0_IPR_ADDR INTC_IPRH
125#define SIOF0_IPR_POS 3
126#define SIOF0_PRIORITY 3
127
128/* FLCTL (Flash Memory Controller) */
129#define FLSTE_IRQ 92
130#define FLTEND_IRQ 93
131#define FLTRQ0_IRQ 94
132#define FLTRQ1_IRQ 95
133#define FLCTL_IPR_ADDR INTC_IPRH
134#define FLCTL_IPR_POS 1
135#define FLCTL_PRIORITY 3
136
137/* IIC (IIC Bus Interface) */
138#define IIC_ALI_IRQ 96
139#define IIC_TACKI_IRQ 97
140#define IIC_WAITI_IRQ 98
141#define IIC_DTEI_IRQ 99
142#define IIC_IPR_ADDR INTC_IPRH
143#define IIC_IPR_POS 0
144#define IIC_PRIORITY 3
145
146/* SIO0 */
147#define SIO0_IRQ 88
148#define SIO0_IPR_ADDR INTC_IPRI
149#define SIO0_IPR_POS 3
150#define SIO0_PRIORITY 3
151
152/* SIU (Sound Interface Unit) */
153#define SIU_IRQ 108
154#define SIU_IPR_ADDR INTC_IPRJ
155#define SIU_IPR_POS 1
156#define SIU_PRIORITY 3
157
158#endif
159#elif defined(CONFIG_CPU_SH4)
160#define DMTE0_IRQ 34
161#define DMTE1_IRQ 35
162#define DMTE2_IRQ 36
163#define DMTE3_IRQ 37
164#define DMTE4_IRQ 44 /* 7751R only */
165#define DMTE5_IRQ 45 /* 7751R only */
166#define DMTE6_IRQ 46 /* 7751R only */
167#define DMTE7_IRQ 47 /* 7751R only */
168#define DMAE_IRQ 38
169#define DMA_IPR_ADDR INTC_IPRC
170#define DMA_IPR_POS 2
171#define DMA_PRIORITY 7
172#endif
173
174#if defined (CONFIG_CPU_SUBTYPE_SH7707) || defined (CONFIG_CPU_SUBTYPE_SH7708) || \
175 defined (CONFIG_CPU_SUBTYPE_SH7709) || defined (CONFIG_CPU_SUBTYPE_SH7750) || \
176 defined (CONFIG_CPU_SUBTYPE_SH7751) || defined (CONFIG_CPU_SUBTYPE_SH7706)
177#define SCI_ERI_IRQ 23
178#define SCI_RXI_IRQ 24
179#define SCI_TXI_IRQ 25
180#define SCI_IPR_ADDR INTC_IPRB
181#define SCI_IPR_POS 1
182#define SCI_PRIORITY 3
183#endif
184
185#if defined(CONFIG_CPU_SUBTYPE_SH7300)
186#define SCIF0_IRQ 80
187#define SCIF0_IPR_ADDR INTC_IPRG
188#define SCIF0_IPR_POS 3
189#define SCIF0_PRIORITY 3
190#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
191 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
192 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
193 defined(CONFIG_CPU_SUBTYPE_SH7709)
194#define SCIF_ERI_IRQ 56
195#define SCIF_RXI_IRQ 57
196#define SCIF_BRI_IRQ 58
197#define SCIF_TXI_IRQ 59
198#define SCIF_IPR_ADDR INTC_IPRE
199#define SCIF_IPR_POS 1
200#define SCIF_PRIORITY 3
201
202#define IRDA_ERI_IRQ 52
203#define IRDA_RXI_IRQ 53
204#define IRDA_BRI_IRQ 54
205#define IRDA_TXI_IRQ 55
206#define IRDA_IPR_ADDR INTC_IPRE
207#define IRDA_IPR_POS 2
208#define IRDA_PRIORITY 3
209#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \
210 defined(CONFIG_CPU_SUBTYPE_ST40STB1) || defined(CONFIG_CPU_SUBTYPE_SH4_202)
211#define SCIF_ERI_IRQ 40
212#define SCIF_RXI_IRQ 41
213#define SCIF_BRI_IRQ 42
214#define SCIF_TXI_IRQ 43
215#define SCIF_IPR_ADDR INTC_IPRC
216#define SCIF_IPR_POS 1
217#define SCIF_PRIORITY 3
218#if defined(CONFIG_CPU_SUBTYPE_ST40STB1)
219#define SCIF1_ERI_IRQ 23
220#define SCIF1_RXI_IRQ 24
221#define SCIF1_BRI_IRQ 25
222#define SCIF1_TXI_IRQ 26
223#define SCIF1_IPR_ADDR INTC_IPRB
224#define SCIF1_IPR_POS 1
225#define SCIF1_PRIORITY 3
226#endif /* ST40STB1 */
227
228#endif /* 775x / SH4-202 / ST40STB1 */
229#endif /* 7780 */
230
231/* NR_IRQS is made from three components: 7/* NR_IRQS is made from three components:
232 * 1. ONCHIP_NR_IRQS - number of IRLS + on-chip peripherial modules 8 * 1. ONCHIP_NR_IRQS - number of IRLS + on-chip peripherial modules
233 * 2. PINT_NR_IRQS - number of PINT interrupts 9 * 2. PINT_NR_IRQS - number of PINT interrupts
@@ -265,6 +41,10 @@
265# define ONCHIP_NR_IRQS 109 41# define ONCHIP_NR_IRQS 109
266#elif defined(CONFIG_CPU_SUBTYPE_SH7780) 42#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
267# define ONCHIP_NR_IRQS 111 43# define ONCHIP_NR_IRQS 111
44#elif defined(CONFIG_CPU_SUBTYPE_SH7206)
45# define ONCHIP_NR_IRQS 256
46#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
47# define ONCHIP_NR_IRQS 128
268#elif defined(CONFIG_SH_UNKNOWN) /* Most be last */ 48#elif defined(CONFIG_SH_UNKNOWN) /* Most be last */
269# define ONCHIP_NR_IRQS 144 49# define ONCHIP_NR_IRQS 144
270#endif 50#endif
@@ -312,9 +92,11 @@
312/* NR_IRQS. 1+2+3 */ 92/* NR_IRQS. 1+2+3 */
313#define NR_IRQS (ONCHIP_NR_IRQS + PINT_NR_IRQS + OFFCHIP_NR_IRQS) 93#define NR_IRQS (ONCHIP_NR_IRQS + PINT_NR_IRQS + OFFCHIP_NR_IRQS)
314 94
315extern void disable_irq(unsigned int); 95/*
316extern void disable_irq_nosync(unsigned int); 96 * Convert back and forth between INTEVT and IRQ values.
317extern void enable_irq(unsigned int); 97 */
98#define evt2irq(evt) (((evt) >> 5) - 16)
99#define irq2evt(irq) (((irq) + 16) << 5)
318 100
319/* 101/*
320 * Simple Mask Register Support 102 * Simple Mask Register Support
@@ -327,362 +109,36 @@ extern unsigned short *irq_mask_register;
327 */ 109 */
328void init_IRQ_pint(void); 110void init_IRQ_pint(void);
329 111
112/*
113 * The shift value is now the number of bits to shift, not the number of
114 * bits/4. This is to make it easier to read the value directly from the
115 * datasheets. The IPR address, addr, will be set from ipr_idx via the
116 * map_ipridx_to_addr function.
117 */
330struct ipr_data { 118struct ipr_data {
331 unsigned int irq; 119 unsigned int irq;
332 unsigned int addr; /* Address of Interrupt Priority Register */ 120 int ipr_idx; /* Index for the IPR registered */
333 int shift; /* Shifts of the 16-bit data */ 121 int shift; /* Number of bits to shift the data */
334 int priority; /* The priority */ 122 int priority; /* The priority */
123 unsigned int addr; /* Address of Interrupt Priority Register */
335}; 124};
336 125
337/* 126/*
338 * Function for "on chip support modules". 127 * Given an IPR IDX, map the value to an IPR register address.
339 */ 128 */
340extern void make_ipr_irq(struct ipr_data *table, unsigned int nr_irqs); 129unsigned int map_ipridx_to_addr(int idx);
341extern void make_imask_irq(unsigned int irq);
342
343#if defined(CONFIG_CPU_SUBTYPE_SH7300)
344#undef INTC_IPRA
345#undef INTC_IPRB
346#define INTC_IPRA 0xA414FEE2UL
347#define INTC_IPRB 0xA414FEE4UL
348#define INTC_IPRC 0xA4140016UL
349#define INTC_IPRD 0xA4140018UL
350#define INTC_IPRE 0xA414001AUL
351#define INTC_IPRF 0xA4080000UL
352#define INTC_IPRG 0xA4080002UL
353#define INTC_IPRH 0xA4080004UL
354#define INTC_IPRI 0xA4080006UL
355#define INTC_IPRJ 0xA4080008UL
356
357#define INTC_IMR0 0xA4080040UL
358#define INTC_IMR1 0xA4080042UL
359#define INTC_IMR2 0xA4080044UL
360#define INTC_IMR3 0xA4080046UL
361#define INTC_IMR4 0xA4080048UL
362#define INTC_IMR5 0xA408004AUL
363#define INTC_IMR6 0xA408004CUL
364#define INTC_IMR7 0xA408004EUL
365#define INTC_IMR8 0xA4080050UL
366#define INTC_IMR9 0xA4080052UL
367#define INTC_IMR10 0xA4080054UL
368
369#define INTC_IMCR0 0xA4080060UL
370#define INTC_IMCR1 0xA4080062UL
371#define INTC_IMCR2 0xA4080064UL
372#define INTC_IMCR3 0xA4080066UL
373#define INTC_IMCR4 0xA4080068UL
374#define INTC_IMCR5 0xA408006AUL
375#define INTC_IMCR6 0xA408006CUL
376#define INTC_IMCR7 0xA408006EUL
377#define INTC_IMCR8 0xA4080070UL
378#define INTC_IMCR9 0xA4080072UL
379#define INTC_IMCR10 0xA4080074UL
380
381#define INTC_ICR0 0xA414FEE0UL
382#define INTC_ICR1 0xA4140010UL
383
384#define INTC_IRR0 0xA4140004UL
385
386#define PORT_PACR 0xA4050100UL
387#define PORT_PBCR 0xA4050102UL
388#define PORT_PCCR 0xA4050104UL
389#define PORT_PDCR 0xA4050106UL
390#define PORT_PECR 0xA4050108UL
391#define PORT_PFCR 0xA405010AUL
392#define PORT_PGCR 0xA405010CUL
393#define PORT_PHCR 0xA405010EUL
394#define PORT_PJCR 0xA4050110UL
395#define PORT_PKCR 0xA4050112UL
396#define PORT_PLCR 0xA4050114UL
397#define PORT_SCPCR 0xA4050116UL
398#define PORT_PMCR 0xA4050118UL
399#define PORT_PNCR 0xA405011AUL
400#define PORT_PQCR 0xA405011CUL
401
402#define PORT_PSELA 0xA4050140UL
403#define PORT_PSELB 0xA4050142UL
404#define PORT_PSELC 0xA4050144UL
405
406#define PORT_HIZCRA 0xA4050146UL
407#define PORT_HIZCRB 0xA4050148UL
408#define PORT_DRVCR 0xA4050150UL
409
410#define PORT_PADR 0xA4050120UL
411#define PORT_PBDR 0xA4050122UL
412#define PORT_PCDR 0xA4050124UL
413#define PORT_PDDR 0xA4050126UL
414#define PORT_PEDR 0xA4050128UL
415#define PORT_PFDR 0xA405012AUL
416#define PORT_PGDR 0xA405012CUL
417#define PORT_PHDR 0xA405012EUL
418#define PORT_PJDR 0xA4050130UL
419#define PORT_PKDR 0xA4050132UL
420#define PORT_PLDR 0xA4050134UL
421#define PORT_SCPDR 0xA4050136UL
422#define PORT_PMDR 0xA4050138UL
423#define PORT_PNDR 0xA405013AUL
424#define PORT_PQDR 0xA405013CUL
425
426#define IRQ0_IRQ 32
427#define IRQ1_IRQ 33
428#define IRQ2_IRQ 34
429#define IRQ3_IRQ 35
430#define IRQ4_IRQ 36
431#define IRQ5_IRQ 37
432
433#define IRQ0_IPR_ADDR INTC_IPRC
434#define IRQ1_IPR_ADDR INTC_IPRC
435#define IRQ2_IPR_ADDR INTC_IPRC
436#define IRQ3_IPR_ADDR INTC_IPRC
437#define IRQ4_IPR_ADDR INTC_IPRD
438#define IRQ5_IPR_ADDR INTC_IPRD
439
440#define IRQ0_IPR_POS 0
441#define IRQ1_IPR_POS 1
442#define IRQ2_IPR_POS 2
443#define IRQ3_IPR_POS 3
444#define IRQ4_IPR_POS 0
445#define IRQ5_IPR_POS 1
446 130
447#define IRQ0_PRIORITY 1 131/*
448#define IRQ1_PRIORITY 1 132 * Enable individual interrupt mode for external IPR IRQs.
449#define IRQ2_PRIORITY 1 133 */
450#define IRQ3_PRIORITY 1 134void ipr_irq_enable_irlm(void);
451#define IRQ4_PRIORITY 1
452#define IRQ5_PRIORITY 1
453
454extern int ipr_irq_demux(int irq);
455#define __irq_demux(irq) ipr_irq_demux(irq)
456
457#elif defined(CONFIG_CPU_SUBTYPE_SH7604)
458#define INTC_IPRA 0xfffffee2UL
459#define INTC_IPRB 0xfffffe60UL
460
461#define INTC_VCRA 0xfffffe62UL
462#define INTC_VCRB 0xfffffe64UL
463#define INTC_VCRC 0xfffffe66UL
464#define INTC_VCRD 0xfffffe68UL
465
466#define INTC_VCRWDT 0xfffffee4UL
467#define INTC_VCRDIV 0xffffff0cUL
468#define INTC_VCRDMA0 0xffffffa0UL
469#define INTC_VCRDMA1 0xffffffa8UL
470
471#define INTC_ICR 0xfffffee0UL
472#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
473 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
474 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
475 defined(CONFIG_CPU_SUBTYPE_SH7709) || \
476 defined(CONFIG_CPU_SUBTYPE_SH7710)
477#define INTC_IRR0 0xa4000004UL
478#define INTC_IRR1 0xa4000006UL
479#define INTC_IRR2 0xa4000008UL
480
481#define INTC_ICR0 0xfffffee0UL
482#define INTC_ICR1 0xa4000010UL
483#define INTC_ICR2 0xa4000012UL
484#define INTC_INTER 0xa4000014UL
485
486#define INTC_IPRC 0xa4000016UL
487#define INTC_IPRD 0xa4000018UL
488#define INTC_IPRE 0xa400001aUL
489#if defined(CONFIG_CPU_SUBTYPE_SH7707)
490#define INTC_IPRF 0xa400001cUL
491#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
492#define INTC_IPRF 0xa4080000UL
493#define INTC_IPRG 0xa4080002UL
494#define INTC_IPRH 0xa4080004UL
495#elif defined(CONFIG_CPU_SUBTYPE_SH7710)
496/* Interrupt Controller Registers */
497#undef INTC_IPRA
498#undef INTC_IPRB
499#define INTC_IPRA 0xA414FEE2UL
500#define INTC_IPRB 0xA414FEE4UL
501#define INTC_IPRF 0xA4080000UL
502#define INTC_IPRG 0xA4080002UL
503#define INTC_IPRH 0xA4080004UL
504#define INTC_IPRI 0xA4080006UL
505
506#undef INTC_ICR0
507#undef INTC_ICR1
508#define INTC_ICR0 0xA414FEE0UL
509#define INTC_ICR1 0xA4140010UL
510
511#define INTC_IRR0 0xa4000004UL
512#define INTC_IRR1 0xa4000006UL
513#define INTC_IRR2 0xa4000008UL
514#define INTC_IRR3 0xa400000AUL
515#define INTC_IRR4 0xa400000CUL
516#define INTC_IRR5 0xa4080020UL
517#define INTC_IRR7 0xa4080024UL
518#define INTC_IRR8 0xa4080026UL
519
520/* Interrupt numbers */
521#define TIMER2_IRQ 18
522#define TIMER2_IPR_ADDR INTC_IPRA
523#define TIMER2_IPR_POS 1
524#define TIMER2_PRIORITY 2
525
526/* WDT */
527#define WDT_IRQ 27
528#define WDT_IPR_ADDR INTC_IPRB
529#define WDT_IPR_POS 3
530#define WDT_PRIORITY 2
531
532#define SCIF0_ERI_IRQ 52
533#define SCIF0_RXI_IRQ 53
534#define SCIF0_BRI_IRQ 54
535#define SCIF0_TXI_IRQ 55
536#define SCIF0_IPR_ADDR INTC_IPRE
537#define SCIF0_IPR_POS 2
538#define SCIF0_PRIORITY 3
539
540#define DMTE4_IRQ 76
541#define DMTE5_IRQ 77
542#define DMA2_IPR_ADDR INTC_IPRF
543#define DMA2_IPR_POS 2
544#define DMA2_PRIORITY 7
545
546#define IPSEC_IRQ 79
547#define IPSEC_IPR_ADDR INTC_IPRF
548#define IPSEC_IPR_POS 3
549#define IPSEC_PRIORITY 3
550
551/* EDMAC */
552#define EDMAC0_IRQ 80
553#define EDMAC0_IPR_ADDR INTC_IPRG
554#define EDMAC0_IPR_POS 3
555#define EDMAC0_PRIORITY 3
556
557#define EDMAC1_IRQ 81
558#define EDMAC1_IPR_ADDR INTC_IPRG
559#define EDMAC1_IPR_POS 2
560#define EDMAC1_PRIORITY 3
561
562#define EDMAC2_IRQ 82
563#define EDMAC2_IPR_ADDR INTC_IPRG
564#define EDMAC2_IPR_POS 1
565#define EDMAC2_PRIORITY 3
566
567/* SIOF */
568#define SIOF0_ERI_IRQ 96
569#define SIOF0_TXI_IRQ 97
570#define SIOF0_RXI_IRQ 98
571#define SIOF0_CCI_IRQ 99
572#define SIOF0_IPR_ADDR INTC_IPRH
573#define SIOF0_IPR_POS 0
574#define SIOF0_PRIORITY 7
575
576#define SIOF1_ERI_IRQ 100
577#define SIOF1_TXI_IRQ 101
578#define SIOF1_RXI_IRQ 102
579#define SIOF1_CCI_IRQ 103
580#define SIOF1_IPR_ADDR INTC_IPRI
581#define SIOF1_IPR_POS 1
582#define SIOF1_PRIORITY 7
583#endif /* CONFIG_CPU_SUBTYPE_SH7710 */
584
585#if defined(CONFIG_CPU_SUBTYPE_SH7710)
586#define PORT_PACR 0xa4050100UL
587#define PORT_PBCR 0xa4050102UL
588#define PORT_PCCR 0xa4050104UL
589#define PORT_PETCR 0xa4050106UL
590#define PORT_PADR 0xa4050120UL
591#define PORT_PBDR 0xa4050122UL
592#define PORT_PCDR 0xa4050124UL
593#else
594#define PORT_PACR 0xa4000100UL
595#define PORT_PBCR 0xa4000102UL
596#define PORT_PCCR 0xa4000104UL
597#define PORT_PFCR 0xa400010aUL
598#define PORT_PADR 0xa4000120UL
599#define PORT_PBDR 0xa4000122UL
600#define PORT_PCDR 0xa4000124UL
601#define PORT_PFDR 0xa400012aUL
602#endif
603
604#define IRQ0_IRQ 32
605#define IRQ1_IRQ 33
606#define IRQ2_IRQ 34
607#define IRQ3_IRQ 35
608#define IRQ4_IRQ 36
609#define IRQ5_IRQ 37
610
611#define IRQ0_IPR_ADDR INTC_IPRC
612#define IRQ1_IPR_ADDR INTC_IPRC
613#define IRQ2_IPR_ADDR INTC_IPRC
614#define IRQ3_IPR_ADDR INTC_IPRC
615#define IRQ4_IPR_ADDR INTC_IPRD
616#define IRQ5_IPR_ADDR INTC_IPRD
617
618#define IRQ0_IPR_POS 0
619#define IRQ1_IPR_POS 1
620#define IRQ2_IPR_POS 2
621#define IRQ3_IPR_POS 3
622#define IRQ4_IPR_POS 0
623#define IRQ5_IPR_POS 1
624
625#define IRQ0_PRIORITY 1
626#define IRQ1_PRIORITY 1
627#define IRQ2_PRIORITY 1
628#define IRQ3_PRIORITY 1
629#define IRQ4_PRIORITY 1
630#define IRQ5_PRIORITY 1
631
632#define PINT0_IRQ 40
633#define PINT8_IRQ 41
634
635#define PINT0_IPR_ADDR INTC_IPRD
636#define PINT8_IPR_ADDR INTC_IPRD
637
638#define PINT0_IPR_POS 3
639#define PINT8_IPR_POS 2
640#define PINT0_PRIORITY 2
641#define PINT8_PRIORITY 2
642
643extern int ipr_irq_demux(int irq);
644#define __irq_demux(irq) ipr_irq_demux(irq)
645#endif /* CONFIG_CPU_SUBTYPE_SH7707 || CONFIG_CPU_SUBTYPE_SH7709 */
646
647#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \
648 defined(CONFIG_CPU_SUBTYPE_ST40STB1) || defined(CONFIG_CPU_SUBTYPE_SH4_202)
649#define INTC_ICR 0xffd00000
650#define INTC_ICR_NMIL (1<<15)
651#define INTC_ICR_MAI (1<<14)
652#define INTC_ICR_NMIB (1<<9)
653#define INTC_ICR_NMIE (1<<8)
654#define INTC_ICR_IRLM (1<<7)
655#endif
656
657#ifdef CONFIG_CPU_SUBTYPE_SH7780
658#include <asm/irq-sh7780.h>
659#endif
660
661/* SH with INTC2-style interrupts */
662#ifdef CONFIG_CPU_HAS_INTC2_IRQ
663#if defined(CONFIG_CPU_SUBTYPE_ST40STB1)
664#define INTC2_BASE 0xfe080000
665#define INTC2_FIRST_IRQ 64
666#define INTC2_INTREQ_OFFSET 0x20
667#define INTC2_INTMSK_OFFSET 0x40
668#define INTC2_INTMSKCLR_OFFSET 0x60
669#define NR_INTC2_IRQS 25
670#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
671#define INTC2_BASE 0xfe080000
672#define INTC2_FIRST_IRQ 48 /* INTEVT 0x800 */
673#define INTC2_INTREQ_OFFSET 0x20
674#define INTC2_INTMSK_OFFSET 0x40
675#define INTC2_INTMSKCLR_OFFSET 0x60
676#define NR_INTC2_IRQS 64
677#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
678#define INTC2_BASE 0xffd40000
679#define INTC2_FIRST_IRQ 21
680#define INTC2_INTMSK_OFFSET (0x38)
681#define INTC2_INTMSKCLR_OFFSET (0x3c)
682#define NR_INTC2_IRQS 60
683#endif
684 135
685#define INTC2_INTPRI_OFFSET 0x00 136/*
137 * Function for "on chip support modules".
138 */
139void make_ipr_irq(struct ipr_data *table, unsigned int nr_irqs);
140void make_imask_irq(unsigned int irq);
141void init_IRQ_ipr(void);
686 142
687struct intc2_data { 143struct intc2_data {
688 unsigned short irq; 144 unsigned short irq;
@@ -693,20 +149,14 @@ struct intc2_data {
693 149
694void make_intc2_irq(struct intc2_data *, unsigned int nr_irqs); 150void make_intc2_irq(struct intc2_data *, unsigned int nr_irqs);
695void init_IRQ_intc2(void); 151void init_IRQ_intc2(void);
696#endif
697
698extern int shmse_irq_demux(int irq);
699 152
700static inline int generic_irq_demux(int irq) 153static inline int generic_irq_demux(int irq)
701{ 154{
702 return irq; 155 return irq;
703} 156}
704 157
705#ifndef __irq_demux
706#define __irq_demux(irq) (irq)
707#endif
708#define irq_canonicalize(irq) (irq) 158#define irq_canonicalize(irq) (irq)
709#define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq)) 159#define irq_demux(irq) sh_mv.mv_irq_demux(irq)
710 160
711#ifdef CONFIG_4KSTACKS 161#ifdef CONFIG_4KSTACKS
712extern void irq_ctx_init(int cpu); 162extern void irq_ctx_init(int cpu);
@@ -717,12 +167,4 @@ extern void irq_ctx_exit(int cpu);
717# define irq_ctx_exit(cpu) do { } while (0) 167# define irq_ctx_exit(cpu) do { } while (0)
718#endif 168#endif
719 169
720#if defined(CONFIG_CPU_SUBTYPE_SH73180)
721#include <asm/irq-sh73180.h>
722#endif
723
724#if defined(CONFIG_CPU_SUBTYPE_SH7343)
725#include <asm/irq-sh7343.h>
726#endif
727
728#endif /* __ASM_SH_IRQ_H */ 170#endif /* __ASM_SH_IRQ_H */
diff --git a/include/asm-sh/irqflags.h b/include/asm-sh/irqflags.h
new file mode 100644
index 000000000000..9dedc1b693e3
--- /dev/null
+++ b/include/asm-sh/irqflags.h
@@ -0,0 +1,123 @@
1#ifndef __ASM_SH_IRQFLAGS_H
2#define __ASM_SH_IRQFLAGS_H
3
4static inline void raw_local_irq_enable(void)
5{
6 unsigned long __dummy0, __dummy1;
7
8 __asm__ __volatile__ (
9 "stc sr, %0\n\t"
10 "and %1, %0\n\t"
11#ifdef CONFIG_CPU_HAS_SR_RB
12 "stc r6_bank, %1\n\t"
13 "or %1, %0\n\t"
14#endif
15 "ldc %0, sr\n\t"
16 : "=&r" (__dummy0), "=r" (__dummy1)
17 : "1" (~0x000000f0)
18 : "memory"
19 );
20}
21
22static inline void raw_local_irq_disable(void)
23{
24 unsigned long flags;
25
26 __asm__ __volatile__ (
27 "stc sr, %0\n\t"
28 "or #0xf0, %0\n\t"
29 "ldc %0, sr\n\t"
30 : "=&z" (flags)
31 : /* no inputs */
32 : "memory"
33 );
34}
35
36static inline void set_bl_bit(void)
37{
38 unsigned long __dummy0, __dummy1;
39
40 __asm__ __volatile__ (
41 "stc sr, %0\n\t"
42 "or %2, %0\n\t"
43 "and %3, %0\n\t"
44 "ldc %0, sr\n\t"
45 : "=&r" (__dummy0), "=r" (__dummy1)
46 : "r" (0x10000000), "r" (0xffffff0f)
47 : "memory"
48 );
49}
50
51static inline void clear_bl_bit(void)
52{
53 unsigned long __dummy0, __dummy1;
54
55 __asm__ __volatile__ (
56 "stc sr, %0\n\t"
57 "and %2, %0\n\t"
58 "ldc %0, sr\n\t"
59 : "=&r" (__dummy0), "=r" (__dummy1)
60 : "1" (~0x10000000)
61 : "memory"
62 );
63}
64
65static inline unsigned long __raw_local_save_flags(void)
66{
67 unsigned long flags;
68
69 __asm__ __volatile__ (
70 "stc sr, %0\n\t"
71 "and #0xf0, %0\n\t"
72 : "=&z" (flags)
73 : /* no inputs */
74 : "memory"
75 );
76
77 return flags;
78}
79
80#define raw_local_save_flags(flags) \
81 do { (flags) = __raw_local_save_flags(); } while (0)
82
83static inline int raw_irqs_disabled_flags(unsigned long flags)
84{
85 return (flags != 0);
86}
87
88static inline int raw_irqs_disabled(void)
89{
90 unsigned long flags = __raw_local_save_flags();
91
92 return raw_irqs_disabled_flags(flags);
93}
94
95static inline unsigned long __raw_local_irq_save(void)
96{
97 unsigned long flags, __dummy;
98
99 __asm__ __volatile__ (
100 "stc sr, %1\n\t"
101 "mov %1, %0\n\t"
102 "or #0xf0, %0\n\t"
103 "ldc %0, sr\n\t"
104 "mov %1, %0\n\t"
105 "and #0xf0, %0\n\t"
106 : "=&z" (flags), "=&r" (__dummy)
107 : /* no inputs */
108 : "memory"
109 );
110
111 return flags;
112}
113
114#define raw_local_irq_save(flags) \
115 do { (flags) = __raw_local_irq_save(); } while (0)
116
117static inline void raw_local_irq_restore(unsigned long flags)
118{
119 if ((flags & 0xf0) != 0xf0)
120 raw_local_irq_enable();
121}
122
123#endif /* __ASM_SH_IRQFLAGS_H */
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h
index c7088efe579a..46f04e23bd45 100644
--- a/include/asm-sh/mmu_context.h
+++ b/include/asm-sh/mmu_context.h
@@ -10,7 +10,6 @@
10 10
11#include <asm/cpu/mmu_context.h> 11#include <asm/cpu/mmu_context.h>
12#include <asm/tlbflush.h> 12#include <asm/tlbflush.h>
13#include <asm/pgalloc.h>
14#include <asm/uaccess.h> 13#include <asm/uaccess.h>
15#include <asm/io.h> 14#include <asm/io.h>
16 15
@@ -42,10 +41,8 @@ extern unsigned long mmu_context_cache;
42/* 41/*
43 * Get MMU context if needed. 42 * Get MMU context if needed.
44 */ 43 */
45static __inline__ void 44static inline void get_mmu_context(struct mm_struct *mm)
46get_mmu_context(struct mm_struct *mm)
47{ 45{
48 extern void flush_tlb_all(void);
49 unsigned long mc = mmu_context_cache; 46 unsigned long mc = mmu_context_cache;
50 47
51 /* Check if we have old version of context. */ 48 /* Check if we have old version of context. */
@@ -61,6 +58,7 @@ get_mmu_context(struct mm_struct *mm)
61 * Flush all TLB and start new cycle. 58 * Flush all TLB and start new cycle.
62 */ 59 */
63 flush_tlb_all(); 60 flush_tlb_all();
61
64 /* 62 /*
65 * Fix version; Note that we avoid version #0 63 * Fix version; Note that we avoid version #0
66 * to distingush NO_CONTEXT. 64 * to distingush NO_CONTEXT.
@@ -75,11 +73,10 @@ get_mmu_context(struct mm_struct *mm)
75 * Initialize the context related info for a new mm_struct 73 * Initialize the context related info for a new mm_struct
76 * instance. 74 * instance.
77 */ 75 */
78static __inline__ int init_new_context(struct task_struct *tsk, 76static inline int init_new_context(struct task_struct *tsk,
79 struct mm_struct *mm) 77 struct mm_struct *mm)
80{ 78{
81 mm->context.id = NO_CONTEXT; 79 mm->context.id = NO_CONTEXT;
82
83 return 0; 80 return 0;
84} 81}
85 82
@@ -87,12 +84,12 @@ static __inline__ int init_new_context(struct task_struct *tsk,
87 * Destroy context related info for an mm_struct that is about 84 * Destroy context related info for an mm_struct that is about
88 * to be put to rest. 85 * to be put to rest.
89 */ 86 */
90static __inline__ void destroy_context(struct mm_struct *mm) 87static inline void destroy_context(struct mm_struct *mm)
91{ 88{
92 /* Do nothing */ 89 /* Do nothing */
93} 90}
94 91
95static __inline__ void set_asid(unsigned long asid) 92static inline void set_asid(unsigned long asid)
96{ 93{
97 unsigned long __dummy; 94 unsigned long __dummy;
98 95
@@ -105,7 +102,7 @@ static __inline__ void set_asid(unsigned long asid)
105 "r" (0xffffff00)); 102 "r" (0xffffff00));
106} 103}
107 104
108static __inline__ unsigned long get_asid(void) 105static inline unsigned long get_asid(void)
109{ 106{
110 unsigned long asid; 107 unsigned long asid;
111 108
@@ -120,24 +117,29 @@ static __inline__ unsigned long get_asid(void)
120 * After we have set current->mm to a new value, this activates 117 * After we have set current->mm to a new value, this activates
121 * the context for the new mm so we see the new mappings. 118 * the context for the new mm so we see the new mappings.
122 */ 119 */
123static __inline__ void activate_context(struct mm_struct *mm) 120static inline void activate_context(struct mm_struct *mm)
124{ 121{
125 get_mmu_context(mm); 122 get_mmu_context(mm);
126 set_asid(mm->context.id & MMU_CONTEXT_ASID_MASK); 123 set_asid(mm->context.id & MMU_CONTEXT_ASID_MASK);
127} 124}
128 125
129/* MMU_TTB can be used for optimizing the fault handling. 126/* MMU_TTB is used for optimizing the fault handling. */
130 (Currently not used) */ 127static inline void set_TTB(pgd_t *pgd)
131static __inline__ void switch_mm(struct mm_struct *prev,
132 struct mm_struct *next,
133 struct task_struct *tsk)
134{ 128{
135 if (likely(prev != next)) { 129 ctrl_outl((unsigned long)pgd, MMU_TTB);
136 unsigned long __pgdir = (unsigned long)next->pgd; 130}
137 131
138 __asm__ __volatile__("mov.l %0, %1" 132static inline pgd_t *get_TTB(void)
139 : /* no output */ 133{
140 : "r" (__pgdir), "m" (__m(MMU_TTB))); 134 return (pgd_t *)ctrl_inl(MMU_TTB);
135}
136
137static inline void switch_mm(struct mm_struct *prev,
138 struct mm_struct *next,
139 struct task_struct *tsk)
140{
141 if (likely(prev != next)) {
142 set_TTB(next->pgd);
141 activate_context(next); 143 activate_context(next);
142 } 144 }
143} 145}
@@ -147,7 +149,7 @@ static __inline__ void switch_mm(struct mm_struct *prev,
147#define activate_mm(prev, next) \ 149#define activate_mm(prev, next) \
148 switch_mm((prev),(next),NULL) 150 switch_mm((prev),(next),NULL)
149 151
150static __inline__ void 152static inline void
151enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 153enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
152{ 154{
153} 155}
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index ca8b26d90475..380fd62dd05a 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -13,9 +13,16 @@
13 [ P4 control ] 0xE0000000 13 [ P4 control ] 0xE0000000
14 */ 14 */
15 15
16
17/* PAGE_SHIFT determines the page size */ 16/* PAGE_SHIFT determines the page size */
18#define PAGE_SHIFT 12 17#if defined(CONFIG_PAGE_SIZE_4KB)
18# define PAGE_SHIFT 12
19#elif defined(CONFIG_PAGE_SIZE_8KB)
20# define PAGE_SHIFT 13
21#elif defined(CONFIG_PAGE_SIZE_64KB)
22# define PAGE_SHIFT 16
23#else
24# error "Bogus kernel page size?"
25#endif
19 26
20#ifdef __ASSEMBLY__ 27#ifdef __ASSEMBLY__
21#define PAGE_SIZE (1 << PAGE_SHIFT) 28#define PAGE_SIZE (1 << PAGE_SHIFT)
@@ -28,8 +35,14 @@
28 35
29#if defined(CONFIG_HUGETLB_PAGE_SIZE_64K) 36#if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
30#define HPAGE_SHIFT 16 37#define HPAGE_SHIFT 16
38#elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
39#define HPAGE_SHIFT 18
31#elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB) 40#elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
32#define HPAGE_SHIFT 20 41#define HPAGE_SHIFT 20
42#elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
43#define HPAGE_SHIFT 22
44#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
45#define HPAGE_SHIFT 26
33#endif 46#endif
34 47
35#ifdef CONFIG_HUGETLB_PAGE 48#ifdef CONFIG_HUGETLB_PAGE
@@ -69,15 +82,25 @@ extern void __copy_user_page(void *to, void *from, void *orig_to);
69/* 82/*
70 * These are used to make use of C type-checking.. 83 * These are used to make use of C type-checking..
71 */ 84 */
72typedef struct { unsigned long pte; } pte_t; 85#ifdef CONFIG_X2TLB
73typedef struct { unsigned long pgd; } pgd_t; 86typedef struct { unsigned long pte_low, pte_high; } pte_t;
87typedef struct { unsigned long long pgprot; } pgprot_t;
88#define pte_val(x) \
89 ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
90#define __pte(x) \
91 ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
92#else
93typedef struct { unsigned long pte_low; } pte_t;
74typedef struct { unsigned long pgprot; } pgprot_t; 94typedef struct { unsigned long pgprot; } pgprot_t;
95#define pte_val(x) ((x).pte_low)
96#define __pte(x) ((pte_t) { (x) } )
97#endif
98
99typedef struct { unsigned long pgd; } pgd_t;
75 100
76#define pte_val(x) ((x).pte)
77#define pgd_val(x) ((x).pgd) 101#define pgd_val(x) ((x).pgd)
78#define pgprot_val(x) ((x).pgprot) 102#define pgprot_val(x) ((x).pgprot)
79 103
80#define __pte(x) ((pte_t) { (x) } )
81#define __pgd(x) ((pgd_t) { (x) } ) 104#define __pgd(x) ((pgd_t) { (x) } )
82#define __pgprot(x) ((pgprot_t) { (x) } ) 105#define __pgprot(x) ((pgprot_t) { (x) } )
83 106
diff --git a/include/asm-sh/pgalloc.h b/include/asm-sh/pgalloc.h
index e841465ab4d2..888e4529e6fe 100644
--- a/include/asm-sh/pgalloc.h
+++ b/include/asm-sh/pgalloc.h
@@ -1,13 +1,16 @@
1#ifndef __ASM_SH_PGALLOC_H 1#ifndef __ASM_SH_PGALLOC_H
2#define __ASM_SH_PGALLOC_H 2#define __ASM_SH_PGALLOC_H
3 3
4#define pmd_populate_kernel(mm, pmd, pte) \ 4static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
5 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) 5 pte_t *pte)
6{
7 set_pmd(pmd, __pmd((unsigned long)pte));
8}
6 9
7static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, 10static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
8 struct page *pte) 11 struct page *pte)
9{ 12{
10 set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte))); 13 set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
11} 14}
12 15
13/* 16/*
@@ -15,7 +18,16 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
15 */ 18 */
16static inline pgd_t *pgd_alloc(struct mm_struct *mm) 19static inline pgd_t *pgd_alloc(struct mm_struct *mm)
17{ 20{
18 return (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); 21 pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT);
22
23 if (pgd) {
24 memset(pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
25 memcpy(pgd + USER_PTRS_PER_PGD,
26 swapper_pg_dir + USER_PTRS_PER_PGD,
27 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
28 }
29
30 return pgd;
19} 31}
20 32
21static inline void pgd_free(pgd_t *pgd) 33static inline void pgd_free(pgd_t *pgd)
diff --git a/include/asm-sh/pgtable-2level.h b/include/asm-sh/pgtable-2level.h
deleted file mode 100644
index b525db6f61c6..000000000000
--- a/include/asm-sh/pgtable-2level.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef __ASM_SH_PGTABLE_2LEVEL_H
2#define __ASM_SH_PGTABLE_2LEVEL_H
3
4/*
5 * traditional two-level paging structure:
6 */
7
8#define PGDIR_SHIFT 22
9#define PTRS_PER_PGD 1024
10
11/*
12 * this is two-level, so we don't really have any
13 * PMD directory physically.
14 */
15#define PMD_SHIFT 22
16#define PTRS_PER_PMD 1
17
18#define PTRS_PER_PTE 1024
19
20#ifndef __ASSEMBLY__
21#define pte_ERROR(e) \
22 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
23#define pmd_ERROR(e) \
24 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
25#define pgd_ERROR(e) \
26 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
27
28/*
29 * The "pgd_xxx()" functions here are trivial for a folded two-level
30 * setup: the pgd is never bad, and a pmd always exists (as it's folded
31 * into the pgd entry)
32 */
33static inline int pgd_none(pgd_t pgd) { return 0; }
34static inline int pgd_bad(pgd_t pgd) { return 0; }
35static inline int pgd_present(pgd_t pgd) { return 1; }
36static inline void pgd_clear (pgd_t * pgdp) { }
37
38/*
39 * Certain architectures need to do special things when PTEs
40 * within a page table are directly modified. Thus, the following
41 * hook is made available.
42 */
43#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
44#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
45
46/*
47 * (pmds are folded into pgds so this doesn't get actually called,
48 * but the define is needed for a generic inline function.)
49 */
50#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
51#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval)
52
53#define pgd_page_vaddr(pgd) \
54((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
55
56#define pgd_page(pgd) \
57 (phys_to_page(pgd_val(pgd)))
58
59static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
60{
61 return (pmd_t *) dir;
62}
63
64#define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT)))
65#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
66#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
67
68#endif /* !__ASSEMBLY__ */
69
70#endif /* __ASM_SH_PGTABLE_2LEVEL_H */
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index 2c8682ad1012..c84901dbd8e5 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -15,15 +15,10 @@
15#include <asm-generic/pgtable-nopmd.h> 15#include <asm-generic/pgtable-nopmd.h>
16#include <asm/page.h> 16#include <asm/page.h>
17 17
18#define PTRS_PER_PGD 1024
19
20#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
21#include <asm/addrspace.h> 19#include <asm/addrspace.h>
22#include <asm/fixmap.h> 20#include <asm/fixmap.h>
23 21
24extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
25extern void paging_init(void);
26
27/* 22/*
28 * ZERO_PAGE is a global shared page that is always zero: used 23 * ZERO_PAGE is a global shared page that is always zero: used
29 * for zero-mapped memory areas etc.. 24 * for zero-mapped memory areas etc..
@@ -33,15 +28,28 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
33 28
34#endif /* !__ASSEMBLY__ */ 29#endif /* !__ASSEMBLY__ */
35 30
36/* traditional two-level paging structure */ 31/*
37#define PGDIR_SHIFT 22 32 * traditional two-level paging structure
38#define PTRS_PER_PMD 1 33 */
39#define PTRS_PER_PTE 1024 34/* PTE bits */
40#define PMD_SIZE (1UL << PMD_SHIFT) 35#ifdef CONFIG_X2TLB
41#define PMD_MASK (~(PMD_SIZE-1)) 36# define PTE_MAGNITUDE 3 /* 64-bit PTEs on extended mode SH-X2 TLB */
42#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 37#else
38# define PTE_MAGNITUDE 2 /* 32-bit PTEs */
39#endif
40#define PTE_SHIFT PAGE_SHIFT
41#define PTE_BITS (PTE_SHIFT - PTE_MAGNITUDE)
42
43/* PGD bits */
44#define PGDIR_SHIFT (PTE_SHIFT + PTE_BITS)
45#define PGDIR_BITS (32 - PGDIR_SHIFT)
46#define PGDIR_SIZE (1 << PGDIR_SHIFT)
43#define PGDIR_MASK (~(PGDIR_SIZE-1)) 47#define PGDIR_MASK (~(PGDIR_SIZE-1))
44 48
49/* Entries per level */
50#define PTRS_PER_PTE (PAGE_SIZE / 4)
51#define PTRS_PER_PGD (PAGE_SIZE / 4)
52
45#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) 53#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
46#define FIRST_USER_ADDRESS 0 54#define FIRST_USER_ADDRESS 0
47 55
@@ -49,7 +57,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
49 57
50/* 58/*
51 * First 1MB map is used by fixed purpose. 59 * First 1MB map is used by fixed purpose.
52 * Currently only 4-enty (16kB) is used (see arch/sh/mm/cache.c) 60 * Currently only 4-entry (16kB) is used (see arch/sh/mm/cache.c)
53 */ 61 */
54#define VMALLOC_START (P3SEG+0x00100000) 62#define VMALLOC_START (P3SEG+0x00100000)
55#define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) 63#define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE)
@@ -57,7 +65,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
57/* 65/*
58 * Linux PTEL encoding. 66 * Linux PTEL encoding.
59 * 67 *
60 * Hardware and software bit definitions for the PTEL value: 68 * Hardware and software bit definitions for the PTEL value (see below for
69 * notes on SH-X2 MMUs and 64-bit PTEs):
61 * 70 *
62 * - Bits 0 and 7 are reserved on SH-3 (_PAGE_WT and _PAGE_SZ1 on SH-4). 71 * - Bits 0 and 7 are reserved on SH-3 (_PAGE_WT and _PAGE_SZ1 on SH-4).
63 * 72 *
@@ -76,20 +85,57 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
76 * 85 *
77 * - Bits 31, 30, and 29 remain unused by everyone and can be used for future 86 * - Bits 31, 30, and 29 remain unused by everyone and can be used for future
78 * software flags, although care must be taken to update _PAGE_CLEAR_FLAGS. 87 * software flags, although care must be taken to update _PAGE_CLEAR_FLAGS.
88 *
89 * XXX: Leave the _PAGE_FILE and _PAGE_WT overhaul for a rainy day.
90 *
91 * SH-X2 MMUs and extended PTEs
92 *
93 * SH-X2 supports an extended mode TLB with split data arrays due to the
94 * number of bits needed for PR and SZ (now EPR and ESZ) encodings. The PR and
95 * SZ bit placeholders still exist in data array 1, but are implemented as
96 * reserved bits, with the real logic existing in data array 2.
97 *
98 * The downside to this is that we can no longer fit everything in to a 32-bit
99 * PTE encoding, so a 64-bit pte_t is necessary for these parts. On the plus
100 * side, this gives us quite a few spare bits to play with for future usage.
79 */ 101 */
102/* Legacy and compat mode bits */
80#define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */ 103#define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */
81#define _PAGE_HW_SHARED 0x002 /* SH-bit : shared among processes */ 104#define _PAGE_HW_SHARED 0x002 /* SH-bit : shared among processes */
82#define _PAGE_DIRTY 0x004 /* D-bit : page changed */ 105#define _PAGE_DIRTY 0x004 /* D-bit : page changed */
83#define _PAGE_CACHABLE 0x008 /* C-bit : cachable */ 106#define _PAGE_CACHABLE 0x008 /* C-bit : cachable */
84#define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */ 107#ifndef CONFIG_X2TLB
85#define _PAGE_RW 0x020 /* PR0-bit : write access allowed */ 108# define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */
86#define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */ 109# define _PAGE_RW 0x020 /* PR0-bit : write access allowed */
87#define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */ 110# define _PAGE_USER 0x040 /* PR1-bit : user space access allowed*/
111# define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */
112#endif
88#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ 113#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */
89#define _PAGE_PROTNONE 0x200 /* software: if not present */ 114#define _PAGE_PROTNONE 0x200 /* software: if not present */
90#define _PAGE_ACCESSED 0x400 /* software: page referenced */ 115#define _PAGE_ACCESSED 0x400 /* software: page referenced */
91#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */ 116#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */
92 117
118/* Extended mode bits */
119#define _PAGE_EXT_ESZ0 0x0010 /* ESZ0-bit: Size of page */
120#define _PAGE_EXT_ESZ1 0x0020 /* ESZ1-bit: Size of page */
121#define _PAGE_EXT_ESZ2 0x0040 /* ESZ2-bit: Size of page */
122#define _PAGE_EXT_ESZ3 0x0080 /* ESZ3-bit: Size of page */
123
124#define _PAGE_EXT_USER_EXEC 0x0100 /* EPR0-bit: User space executable */
125#define _PAGE_EXT_USER_WRITE 0x0200 /* EPR1-bit: User space writable */
126#define _PAGE_EXT_USER_READ 0x0400 /* EPR2-bit: User space readable */
127
128#define _PAGE_EXT_KERN_EXEC 0x0800 /* EPR3-bit: Kernel space executable */
129#define _PAGE_EXT_KERN_WRITE 0x1000 /* EPR4-bit: Kernel space writable */
130#define _PAGE_EXT_KERN_READ 0x2000 /* EPR5-bit: Kernel space readable */
131
132/* Wrapper for extended mode pgprot twiddling */
133#ifdef CONFIG_X2TLB
134# define _PAGE_EXT(x) ((unsigned long long)(x) << 32)
135#else
136# define _PAGE_EXT(x) (0)
137#endif
138
93/* software: moves to PTEA.TC (Timing Control) */ 139/* software: moves to PTEA.TC (Timing Control) */
94#define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */ 140#define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */
95#define _PAGE_PCC_AREA6 0x80000000 /* use BSC registers for area6 */ 141#define _PAGE_PCC_AREA6 0x80000000 /* use BSC registers for area6 */
@@ -114,37 +160,160 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
114 160
115#define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS)) 161#define _PAGE_FLAGS_HARDWARE_MASK (0x1fffffff & ~(_PAGE_CLEAR_FLAGS))
116 162
117/* Hardware flags: SZ0=1 (4k-byte) */ 163/* Hardware flags, page size encoding */
118#define _PAGE_FLAGS_HARD _PAGE_SZ0 164#if defined(CONFIG_X2TLB)
165# if defined(CONFIG_PAGE_SIZE_4KB)
166# define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ0)
167# elif defined(CONFIG_PAGE_SIZE_8KB)
168# define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ1)
169# elif defined(CONFIG_PAGE_SIZE_64KB)
170# define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ2)
171# endif
172#else
173# if defined(CONFIG_PAGE_SIZE_4KB)
174# define _PAGE_FLAGS_HARD _PAGE_SZ0
175# elif defined(CONFIG_PAGE_SIZE_64KB)
176# define _PAGE_FLAGS_HARD _PAGE_SZ1
177# endif
178#endif
119 179
120#if defined(CONFIG_HUGETLB_PAGE_SIZE_64K) 180#if defined(CONFIG_X2TLB)
121#define _PAGE_SZHUGE (_PAGE_SZ1) 181# if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
122#elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB) 182# define _PAGE_SZHUGE (_PAGE_EXT_ESZ2)
123#define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1) 183# elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
184# define _PAGE_SZHUGE (_PAGE_EXT_ESZ0 | _PAGE_EXT_ESZ2)
185# elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
186# define _PAGE_SZHUGE (_PAGE_EXT_ESZ0 | _PAGE_EXT_ESZ1 | _PAGE_EXT_ESZ2)
187# elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
188# define _PAGE_SZHUGE (_PAGE_EXT_ESZ3)
189# elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
190# define _PAGE_SZHUGE (_PAGE_EXT_ESZ2 | _PAGE_EXT_ESZ3)
191# endif
192#else
193# if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
194# define _PAGE_SZHUGE (_PAGE_SZ1)
195# elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
196# define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1)
197# endif
198#endif
199
200/*
201 * Stub out _PAGE_SZHUGE if we don't have a good definition for it,
202 * to make pte_mkhuge() happy.
203 */
204#ifndef _PAGE_SZHUGE
205# define _PAGE_SZHUGE (_PAGE_FLAGS_HARD)
124#endif 206#endif
125 207
126#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) 208#define _PAGE_CHG_MASK \
127#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) 209 (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY)
128#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY)
129 210
130#ifndef __ASSEMBLY__ 211#ifndef __ASSEMBLY__
131 212
132#ifdef CONFIG_MMU 213#if defined(CONFIG_X2TLB) /* SH-X2 TLB */
133#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD) 214#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | \
134#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_CACHABLE |_PAGE_ACCESSED | _PAGE_FLAGS_HARD) 215 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
135#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) 216
136#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | _PAGE_ACCESSED | _PAGE_FLAGS_HARD) 217#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
137#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD) 218 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
219 _PAGE_EXT(_PAGE_EXT_USER_READ | \
220 _PAGE_EXT_USER_WRITE))
221
222#define PAGE_EXECREAD __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
223 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
224 _PAGE_EXT(_PAGE_EXT_USER_EXEC | \
225 _PAGE_EXT_USER_READ))
226
227#define PAGE_COPY PAGE_EXECREAD
228
229#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
230 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
231 _PAGE_EXT(_PAGE_EXT_USER_READ))
232
233#define PAGE_WRITEONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
234 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
235 _PAGE_EXT(_PAGE_EXT_USER_WRITE))
236
237#define PAGE_RWX __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
238 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
239 _PAGE_EXT(_PAGE_EXT_USER_WRITE | \
240 _PAGE_EXT_USER_READ | \
241 _PAGE_EXT_USER_EXEC))
242
243#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
244 _PAGE_DIRTY | _PAGE_ACCESSED | \
245 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD | \
246 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
247 _PAGE_EXT_KERN_WRITE | \
248 _PAGE_EXT_KERN_EXEC))
249
138#define PAGE_KERNEL_NOCACHE \ 250#define PAGE_KERNEL_NOCACHE \
139 __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD) 251 __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \
140#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_HW_SHARED | _PAGE_FLAGS_HARD) 252 _PAGE_ACCESSED | _PAGE_HW_SHARED | \
253 _PAGE_FLAGS_HARD | \
254 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
255 _PAGE_EXT_KERN_WRITE | \
256 _PAGE_EXT_KERN_EXEC))
257
258#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
259 _PAGE_DIRTY | _PAGE_ACCESSED | \
260 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD | \
261 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
262 _PAGE_EXT_KERN_EXEC))
263
264#define PAGE_KERNEL_PCC(slot, type) \
265 __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \
266 _PAGE_ACCESSED | _PAGE_FLAGS_HARD | \
267 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
268 _PAGE_EXT_KERN_WRITE | \
269 _PAGE_EXT_KERN_EXEC) \
270 (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | \
271 (type))
272
273#elif defined(CONFIG_MMU) /* SH-X TLB */
274#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | \
275 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
276
277#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
278 _PAGE_CACHABLE | _PAGE_ACCESSED | \
279 _PAGE_FLAGS_HARD)
280
281#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | \
282 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
283
284#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | \
285 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
286
287#define PAGE_EXECREAD PAGE_READONLY
288#define PAGE_RWX PAGE_SHARED
289#define PAGE_WRITEONLY PAGE_SHARED
290
291#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | \
292 _PAGE_DIRTY | _PAGE_ACCESSED | \
293 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
294
295#define PAGE_KERNEL_NOCACHE \
296 __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \
297 _PAGE_ACCESSED | _PAGE_HW_SHARED | \
298 _PAGE_FLAGS_HARD)
299
300#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
301 _PAGE_DIRTY | _PAGE_ACCESSED | \
302 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
303
141#define PAGE_KERNEL_PCC(slot, type) \ 304#define PAGE_KERNEL_PCC(slot, type) \
142 __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_FLAGS_HARD | (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | (type)) 305 __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \
306 _PAGE_ACCESSED | _PAGE_FLAGS_HARD | \
307 (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | \
308 (type))
143#else /* no mmu */ 309#else /* no mmu */
144#define PAGE_NONE __pgprot(0) 310#define PAGE_NONE __pgprot(0)
145#define PAGE_SHARED __pgprot(0) 311#define PAGE_SHARED __pgprot(0)
146#define PAGE_COPY __pgprot(0) 312#define PAGE_COPY __pgprot(0)
313#define PAGE_EXECREAD __pgprot(0)
314#define PAGE_RWX __pgprot(0)
147#define PAGE_READONLY __pgprot(0) 315#define PAGE_READONLY __pgprot(0)
316#define PAGE_WRITEONLY __pgprot(0)
148#define PAGE_KERNEL __pgprot(0) 317#define PAGE_KERNEL __pgprot(0)
149#define PAGE_KERNEL_NOCACHE __pgprot(0) 318#define PAGE_KERNEL_NOCACHE __pgprot(0)
150#define PAGE_KERNEL_RO __pgprot(0) 319#define PAGE_KERNEL_RO __pgprot(0)
@@ -154,27 +323,32 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
154#endif /* __ASSEMBLY__ */ 323#endif /* __ASSEMBLY__ */
155 324
156/* 325/*
157 * As i386 and MIPS, SuperH can't do page protection for execute, and 326 * SH-X and lower (legacy) SuperH parts (SH-3, SH-4, some SH-4A) can't do page
158 * considers that the same as a read. Also, write permissions imply 327 * protection for execute, and considers it the same as a read. Also, write
159 * read permissions. This is the closest we can get.. 328 * permission implies read permission. This is the closest we can get..
329 *
330 * SH-X2 (SH7785) and later parts take this to the opposite end of the extreme,
331 * not only supporting separate execute, read, and write bits, but having
332 * completely separate permission bits for user and kernel space.
160 */ 333 */
334 /*xwr*/
161#define __P000 PAGE_NONE 335#define __P000 PAGE_NONE
162#define __P001 PAGE_READONLY 336#define __P001 PAGE_READONLY
163#define __P010 PAGE_COPY 337#define __P010 PAGE_COPY
164#define __P011 PAGE_COPY 338#define __P011 PAGE_COPY
165#define __P100 PAGE_READONLY 339#define __P100 PAGE_EXECREAD
166#define __P101 PAGE_READONLY 340#define __P101 PAGE_EXECREAD
167#define __P110 PAGE_COPY 341#define __P110 PAGE_COPY
168#define __P111 PAGE_COPY 342#define __P111 PAGE_COPY
169 343
170#define __S000 PAGE_NONE 344#define __S000 PAGE_NONE
171#define __S001 PAGE_READONLY 345#define __S001 PAGE_READONLY
172#define __S010 PAGE_SHARED 346#define __S010 PAGE_WRITEONLY
173#define __S011 PAGE_SHARED 347#define __S011 PAGE_SHARED
174#define __S100 PAGE_READONLY 348#define __S100 PAGE_EXECREAD
175#define __S101 PAGE_READONLY 349#define __S101 PAGE_EXECREAD
176#define __S110 PAGE_SHARED 350#define __S110 PAGE_RWX
177#define __S111 PAGE_SHARED 351#define __S111 PAGE_RWX
178 352
179#ifndef __ASSEMBLY__ 353#ifndef __ASSEMBLY__
180 354
@@ -183,7 +357,17 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
183 * within a page table are directly modified. Thus, the following 357 * within a page table are directly modified. Thus, the following
184 * hook is made available. 358 * hook is made available.
185 */ 359 */
360#ifdef CONFIG_X2TLB
361static inline void set_pte(pte_t *ptep, pte_t pte)
362{
363 ptep->pte_high = pte.pte_high;
364 smp_wmb();
365 ptep->pte_low = pte.pte_low;
366}
367#else
186#define set_pte(pteptr, pteval) (*(pteptr) = pteval) 368#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
369#endif
370
187#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 371#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
188 372
189/* 373/*
@@ -192,18 +376,18 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
192 */ 376 */
193#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) 377#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
194 378
195#define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT))) 379#define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT)))
196#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 380#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
197#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 381#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
198 382
199#define pte_none(x) (!pte_val(x)) 383#define pte_none(x) (!pte_val(x))
200#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE)) 384#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))
201#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) 385#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
202 386
203#define pmd_none(x) (!pmd_val(x)) 387#define pmd_none(x) (!pmd_val(x))
204#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) 388#define pmd_present(x) (pmd_val(x))
205#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) 389#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
206#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) 390#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
207 391
208#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) 392#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
209#define pte_page(x) phys_to_page(pte_val(x)&PTE_PHYS_MASK) 393#define pte_page(x) phys_to_page(pte_val(x)&PTE_PHYS_MASK)
@@ -212,28 +396,52 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
212 * The following only work if pte_present() is true. 396 * The following only work if pte_present() is true.
213 * Undefined behaviour if not.. 397 * Undefined behaviour if not..
214 */ 398 */
215static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 399#define pte_not_present(pte) (!(pte_val(pte) & _PAGE_PRESENT))
216static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 400#define pte_dirty(pte) (pte_val(pte) & _PAGE_DIRTY)
217static inline int pte_dirty(pte_t pte){ return pte_val(pte) & _PAGE_DIRTY; } 401#define pte_young(pte) (pte_val(pte) & _PAGE_ACCESSED)
218static inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; } 402#define pte_file(pte) (pte_val(pte) & _PAGE_FILE)
219static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 403
220static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_RW; } 404#ifdef CONFIG_X2TLB
221static inline int pte_not_present(pte_t pte){ return !(pte_val(pte) & _PAGE_PRESENT); } 405#define pte_read(pte) ((pte).pte_high & _PAGE_EXT_USER_READ)
222 406#define pte_exec(pte) ((pte).pte_high & _PAGE_EXT_USER_EXEC)
223static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } 407#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE)
224static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; } 408#else
225static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 409#define pte_read(pte) (pte_val(pte) & _PAGE_USER)
226static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } 410#define pte_exec(pte) (pte_val(pte) & _PAGE_USER)
227static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } 411#define pte_write(pte) (pte_val(pte) & _PAGE_RW)
228static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
229static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
230static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
231static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
232static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
233#ifdef CONFIG_HUGETLB_PAGE
234static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; }
235#endif 412#endif
236 413
414#define PTE_BIT_FUNC(h,fn,op) \
415static inline pte_t pte_##fn(pte_t pte) { pte.pte_##h op; return pte; }
416
417#ifdef CONFIG_X2TLB
418/*
419 * We cheat a bit in the SH-X2 TLB case. As the permission bits are
420 * individually toggled (and user permissions are entirely decoupled from
421 * kernel permissions), we attempt to couple them a bit more sanely here.
422 */
423PTE_BIT_FUNC(high, rdprotect, &= ~_PAGE_EXT_USER_READ);
424PTE_BIT_FUNC(high, mkread, |= _PAGE_EXT_USER_READ | _PAGE_EXT_KERN_READ);
425PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE);
426PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE);
427PTE_BIT_FUNC(high, exprotect, &= ~_PAGE_EXT_USER_EXEC);
428PTE_BIT_FUNC(high, mkexec, |= _PAGE_EXT_USER_EXEC | _PAGE_EXT_KERN_EXEC);
429PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE);
430#else
431PTE_BIT_FUNC(low, rdprotect, &= ~_PAGE_USER);
432PTE_BIT_FUNC(low, mkread, |= _PAGE_USER);
433PTE_BIT_FUNC(low, wrprotect, &= ~_PAGE_RW);
434PTE_BIT_FUNC(low, mkwrite, |= _PAGE_RW);
435PTE_BIT_FUNC(low, exprotect, &= ~_PAGE_USER);
436PTE_BIT_FUNC(low, mkexec, |= _PAGE_USER);
437PTE_BIT_FUNC(low, mkhuge, |= _PAGE_SZHUGE);
438#endif
439
440PTE_BIT_FUNC(low, mkclean, &= ~_PAGE_DIRTY);
441PTE_BIT_FUNC(low, mkdirty, |= _PAGE_DIRTY);
442PTE_BIT_FUNC(low, mkold, &= ~_PAGE_ACCESSED);
443PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED);
444
237/* 445/*
238 * Macro and implementation to make a page protection as uncachable. 446 * Macro and implementation to make a page protection as uncachable.
239 */ 447 */
@@ -258,13 +466,14 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
258#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 466#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
259 467
260static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 468static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
261{ set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } 469{
262 470 set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) |
263#define pmd_page_vaddr(pmd) \ 471 pgprot_val(newprot)));
264((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 472 return pte;
473}
265 474
266#define pmd_page(pmd) \ 475#define pmd_page_vaddr(pmd) pmd_val(pmd)
267 (phys_to_page(pmd_val(pmd))) 476#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
268 477
269/* to find an entry in a page-table-directory. */ 478/* to find an entry in a page-table-directory. */
270#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 479#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
@@ -283,8 +492,15 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
283#define pte_unmap(pte) do { } while (0) 492#define pte_unmap(pte) do { } while (0)
284#define pte_unmap_nested(pte) do { } while (0) 493#define pte_unmap_nested(pte) do { } while (0)
285 494
495#ifdef CONFIG_X2TLB
496#define pte_ERROR(e) \
497 printk("%s:%d: bad pte %p(%08lx%08lx).\n", __FILE__, __LINE__, \
498 &(e), (e).pte_high, (e).pte_low)
499#else
286#define pte_ERROR(e) \ 500#define pte_ERROR(e) \
287 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) 501 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
502#endif
503
288#define pgd_ERROR(e) \ 504#define pgd_ERROR(e) \
289 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) 505 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
290 506
@@ -337,6 +553,9 @@ extern unsigned int kobjsize(const void *objp);
337extern pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); 553extern pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
338#endif 554#endif
339 555
556extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
557extern void paging_init(void);
558
340#include <asm-generic/pgtable.h> 559#include <asm-generic/pgtable.h>
341 560
342#endif /* !__ASSEMBLY__ */ 561#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
index 45bb74e35d32..6f1dd7ca1b1d 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -36,7 +36,10 @@
36 */ 36 */
37enum cpu_type { 37enum cpu_type {
38 /* SH-2 types */ 38 /* SH-2 types */
39 CPU_SH7604, 39 CPU_SH7604, CPU_SH7619,
40
41 /* SH-2A types */
42 CPU_SH7206,
40 43
41 /* SH-3 types */ 44 /* SH-3 types */
42 CPU_SH7705, CPU_SH7706, CPU_SH7707, 45 CPU_SH7705, CPU_SH7706, CPU_SH7707,
@@ -47,7 +50,10 @@ enum cpu_type {
47 /* SH-4 types */ 50 /* SH-4 types */
48 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R, 51 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
49 CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501, 52 CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501,
53
54 /* SH-4A types */
50 CPU_SH73180, CPU_SH7343, CPU_SH7770, CPU_SH7780, CPU_SH7781, 55 CPU_SH73180, CPU_SH7343, CPU_SH7770, CPU_SH7780, CPU_SH7781,
56 CPU_SH7785,
51 57
52 /* Unknown subtype */ 58 /* Unknown subtype */
53 CPU_SH_NONE 59 CPU_SH_NONE
@@ -130,12 +136,11 @@ union sh_fpu_union {
130}; 136};
131 137
132struct thread_struct { 138struct thread_struct {
139 /* Saved registers when thread is descheduled */
133 unsigned long sp; 140 unsigned long sp;
134 unsigned long pc; 141 unsigned long pc;
135 142
136 unsigned long trap_no, error_code; 143 /* Hardware debugging registers */
137 unsigned long address;
138 /* Hardware debugging registers may come here */
139 unsigned long ubc_pc; 144 unsigned long ubc_pc;
140 145
141 /* floating point info */ 146 /* floating point info */
@@ -150,12 +155,7 @@ typedef struct {
150extern int ubc_usercnt; 155extern int ubc_usercnt;
151 156
152#define INIT_THREAD { \ 157#define INIT_THREAD { \
153 sizeof(init_stack) + (long) &init_stack, /* sp */ \ 158 .sp = sizeof(init_stack) + (long) &init_stack, \
154 0, /* pc */ \
155 0, 0, \
156 0, \
157 0, \
158 {{{0,}},} /* fpu state */ \
159} 159}
160 160
161/* 161/*
@@ -259,8 +259,8 @@ void show_trace(struct task_struct *tsk, unsigned long *sp,
259 struct pt_regs *regs); 259 struct pt_regs *regs);
260extern unsigned long get_wchan(struct task_struct *p); 260extern unsigned long get_wchan(struct task_struct *p);
261 261
262#define KSTK_EIP(tsk) ((tsk)->thread.pc) 262#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
263#define KSTK_ESP(tsk) ((tsk)->thread.sp) 263#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[15])
264 264
265#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory") 265#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
266#define cpu_relax() barrier() 266#define cpu_relax() barrier()
diff --git a/include/asm-sh/push-switch.h b/include/asm-sh/push-switch.h
new file mode 100644
index 000000000000..dfc6bad567f0
--- /dev/null
+++ b/include/asm-sh/push-switch.h
@@ -0,0 +1,28 @@
1#ifndef __ASM_SH_PUSH_SWITCH_H
2#define __ASM_SH_PUSH_SWITCH_H
3
4#include <linux/timer.h>
5#include <linux/interrupt.h>
6#include <linux/workqueue.h>
7
8struct push_switch {
9 /* switch state */
10 unsigned int state:1;
11 /* debounce timer */
12 struct timer_list debounce;
13 /* workqueue */
14 struct work_struct work;
15};
16
17struct push_switch_platform_info {
18 /* IRQ handler */
19 irqreturn_t (*irq_handler)(int irq, void *data);
20 /* Special IRQ flags */
21 unsigned int irq_flags;
22 /* Bit location of switch */
23 unsigned int bit;
24 /* Symbolic switch name */
25 const char *name;
26};
27
28#endif /* __ASM_SH_PUSH_SWITCH_H */
diff --git a/include/asm-sh/rwsem.h b/include/asm-sh/rwsem.h
index 9d2aea5e8488..4931ba817d73 100644
--- a/include/asm-sh/rwsem.h
+++ b/include/asm-sh/rwsem.h
@@ -25,11 +25,21 @@ struct rw_semaphore {
25#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 25#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
26 spinlock_t wait_lock; 26 spinlock_t wait_lock;
27 struct list_head wait_list; 27 struct list_head wait_list;
28#ifdef CONFIG_DEBUG_LOCK_ALLOC
29 struct lockdep_map dep_map;
30#endif
28}; 31};
29 32
33#ifdef CONFIG_DEBUG_LOCK_ALLOC
34# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
35#else
36# define __RWSEM_DEP_MAP_INIT(lockname)
37#endif
38
30#define __RWSEM_INITIALIZER(name) \ 39#define __RWSEM_INITIALIZER(name) \
31 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ 40 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
32 LIST_HEAD_INIT((name).wait_list) } 41 LIST_HEAD_INIT((name).wait_list) \
42 __RWSEM_DEP_MAP_INIT(name) }
33 43
34#define DECLARE_RWSEM(name) \ 44#define DECLARE_RWSEM(name) \
35 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 45 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -39,6 +49,16 @@ extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
39extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); 49extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem);
40extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 50extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
41 51
52extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
53 struct lock_class_key *key);
54
55#define init_rwsem(sem) \
56do { \
57 static struct lock_class_key __key; \
58 \
59 __init_rwsem((sem), #sem, &__key); \
60} while (0)
61
42static inline void init_rwsem(struct rw_semaphore *sem) 62static inline void init_rwsem(struct rw_semaphore *sem)
43{ 63{
44 sem->count = RWSEM_UNLOCKED_VALUE; 64 sem->count = RWSEM_UNLOCKED_VALUE;
@@ -141,6 +161,11 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
141 rwsem_downgrade_wake(sem); 161 rwsem_downgrade_wake(sem);
142} 162}
143 163
164static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
165{
166 __down_write(sem);
167}
168
144/* 169/*
145 * implement exchange and add functionality 170 * implement exchange and add functionality
146 */ 171 */
diff --git a/include/asm-sh/se7206.h b/include/asm-sh/se7206.h
new file mode 100644
index 000000000000..698eb80389ab
--- /dev/null
+++ b/include/asm-sh/se7206.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_SH_SE7206_H
2#define __ASM_SH_SE7206_H
3
4#define PA_SMSC 0x30000000
5#define PA_MRSHPC 0x34000000
6#define PA_LED 0x31400000
7
8void init_se7206_IRQ(void);
9
10#define __IO_PREFIX se7206
11#include <asm/io_generic.h>
12
13#endif /* __ASM_SH_SE7206_H */
diff --git a/include/asm-sh/setup.h b/include/asm-sh/setup.h
index 34ca8a7f06ba..1583c6b7bdaa 100644
--- a/include/asm-sh/setup.h
+++ b/include/asm-sh/setup.h
@@ -1,10 +1,12 @@
1#ifdef __KERNEL__
2#ifndef _SH_SETUP_H 1#ifndef _SH_SETUP_H
3#define _SH_SETUP_H 2#define _SH_SETUP_H
4 3
5#define COMMAND_LINE_SIZE 256 4#define COMMAND_LINE_SIZE 256
6 5
6#ifdef __KERNEL__
7
7int setup_early_printk(char *); 8int setup_early_printk(char *);
8 9
9#endif /* _SH_SETUP_H */
10#endif /* __KERNEL__ */ 10#endif /* __KERNEL__ */
11
12#endif /* _SH_SETUP_H */
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index 3340126f4e0f..b1e42e7f998b 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -6,6 +6,7 @@
6 * Copyright (C) 2002 Paul Mundt 6 * Copyright (C) 2002 Paul Mundt
7 */ 7 */
8 8
9#include <linux/irqflags.h>
9#include <asm/types.h> 10#include <asm/types.h>
10 11
11/* 12/*
@@ -131,103 +132,6 @@ static inline unsigned long tas(volatile int *m)
131 132
132#define set_mb(var, value) do { xchg(&var, value); } while (0) 133#define set_mb(var, value) do { xchg(&var, value); } while (0)
133 134
134/* Interrupt Control */
135#ifdef CONFIG_CPU_HAS_SR_RB
136static inline void local_irq_enable(void)
137{
138 unsigned long __dummy0, __dummy1;
139
140 __asm__ __volatile__("stc sr, %0\n\t"
141 "and %1, %0\n\t"
142 "stc r6_bank, %1\n\t"
143 "or %1, %0\n\t"
144 "ldc %0, sr"
145 : "=&r" (__dummy0), "=r" (__dummy1)
146 : "1" (~0x000000f0)
147 : "memory");
148}
149#else
150static inline void local_irq_enable(void)
151{
152 unsigned long __dummy0, __dummy1;
153
154 __asm__ __volatile__ (
155 "stc sr, %0\n\t"
156 "and %1, %0\n\t"
157 "ldc %0, sr\n\t"
158 : "=&r" (__dummy0), "=r" (__dummy1)
159 : "1" (~0x000000f0)
160 : "memory");
161}
162#endif
163
164static inline void local_irq_disable(void)
165{
166 unsigned long __dummy;
167 __asm__ __volatile__("stc sr, %0\n\t"
168 "or #0xf0, %0\n\t"
169 "ldc %0, sr"
170 : "=&z" (__dummy)
171 : /* no inputs */
172 : "memory");
173}
174
175static inline void set_bl_bit(void)
176{
177 unsigned long __dummy0, __dummy1;
178
179 __asm__ __volatile__ ("stc sr, %0\n\t"
180 "or %2, %0\n\t"
181 "and %3, %0\n\t"
182 "ldc %0, sr"
183 : "=&r" (__dummy0), "=r" (__dummy1)
184 : "r" (0x10000000), "r" (0xffffff0f)
185 : "memory");
186}
187
188static inline void clear_bl_bit(void)
189{
190 unsigned long __dummy0, __dummy1;
191
192 __asm__ __volatile__ ("stc sr, %0\n\t"
193 "and %2, %0\n\t"
194 "ldc %0, sr"
195 : "=&r" (__dummy0), "=r" (__dummy1)
196 : "1" (~0x10000000)
197 : "memory");
198}
199
200#define local_save_flags(x) \
201 __asm__("stc sr, %0; and #0xf0, %0" : "=&z" (x) :/**/: "memory" )
202
203#define irqs_disabled() \
204({ \
205 unsigned long flags; \
206 local_save_flags(flags); \
207 (flags != 0); \
208})
209
210static inline unsigned long local_irq_save(void)
211{
212 unsigned long flags, __dummy;
213
214 __asm__ __volatile__("stc sr, %1\n\t"
215 "mov %1, %0\n\t"
216 "or #0xf0, %0\n\t"
217 "ldc %0, sr\n\t"
218 "mov %1, %0\n\t"
219 "and #0xf0, %0"
220 : "=&z" (flags), "=&r" (__dummy)
221 :/**/
222 : "memory" );
223 return flags;
224}
225
226#define local_irq_restore(x) do { \
227 if ((x & 0x000000f0) != 0x000000f0) \
228 local_irq_enable(); \
229} while (0)
230
231/* 135/*
232 * Jump to P2 area. 136 * Jump to P2 area.
233 * When handling TLB or caches, we need to do it from P2 area. 137 * When handling TLB or caches, we need to do it from P2 area.
@@ -264,9 +168,6 @@ do { \
264 : "=&r" (__dummy)); \ 168 : "=&r" (__dummy)); \
265} while (0) 169} while (0)
266 170
267/* For spinlocks etc */
268#define local_irq_save(x) x = local_irq_save()
269
270static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val) 171static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val)
271{ 172{
272 unsigned long flags, retval; 173 unsigned long flags, retval;
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 3ebc3f9039eb..0c01dc550819 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -90,13 +90,7 @@ static inline struct thread_info *current_thread_info(void)
90#endif 90#endif
91#define free_thread_info(ti) kfree(ti) 91#define free_thread_info(ti) kfree(ti)
92 92
93#else /* !__ASSEMBLY__ */ 93#endif /* __ASSEMBLY__ */
94
95/* how to get the thread information struct from ASM */
96#define GET_THREAD_INFO(reg) \
97 stc r7_bank, reg
98
99#endif
100 94
101/* 95/*
102 * thread information flags 96 * thread information flags
diff --git a/include/asm-sh/timer.h b/include/asm-sh/timer.h
index 5df842bcf7b6..17b5e76a4c31 100644
--- a/include/asm-sh/timer.h
+++ b/include/asm-sh/timer.h
@@ -18,11 +18,32 @@ struct sys_timer {
18 18
19 struct sys_device dev; 19 struct sys_device dev;
20 struct sys_timer_ops *ops; 20 struct sys_timer_ops *ops;
21
22#ifdef CONFIG_NO_IDLE_HZ
23 struct dyn_tick_timer *dyn_tick;
24#endif
21}; 25};
22 26
27#ifdef CONFIG_NO_IDLE_HZ
28#define DYN_TICK_ENABLED (1 << 1)
29
30struct dyn_tick_timer {
31 spinlock_t lock;
32 unsigned int state; /* Current state */
33 int (*enable)(void); /* Enables dynamic tick */
34 int (*disable)(void); /* Disables dynamic tick */
35 void (*reprogram)(unsigned long); /* Reprograms the timer */
36 int (*handler)(int, void *);
37};
38
39void timer_dyn_reprogram(void);
40#else
41#define timer_dyn_reprogram() do { } while (0)
42#endif
43
23#define TICK_SIZE (tick_nsec / 1000) 44#define TICK_SIZE (tick_nsec / 1000)
24 45
25extern struct sys_timer tmu_timer; 46extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer;
26extern struct sys_timer *sys_timer; 47extern struct sys_timer *sys_timer;
27 48
28#ifndef CONFIG_GENERIC_TIME 49#ifndef CONFIG_GENERIC_TIME
diff --git a/include/asm-sh/titan.h b/include/asm-sh/titan.h
index 270a4f4bc8a9..03f3583c8918 100644
--- a/include/asm-sh/titan.h
+++ b/include/asm-sh/titan.h
@@ -1,9 +1,8 @@
1/* 1/*
2 * Platform defintions for Titan 2 * Platform defintions for Titan
3 */ 3 */
4 4#ifndef _ASM_SH_TITAN_H
5#ifndef _ASM_SH_TITAN_TITAN_H 5#define _ASM_SH_TITAN_H
6#define _ASM_SH_TITAN_TITAN_H
7 6
8#define __IO_PREFIX titan 7#define __IO_PREFIX titan
9#include <asm/io_generic.h> 8#include <asm/io_generic.h>
@@ -15,29 +14,4 @@
15#define TITAN_IRQ_MPCIB 11 /* mPCI B */ 14#define TITAN_IRQ_MPCIB 11 /* mPCI B */
16#define TITAN_IRQ_USB 11 /* USB */ 15#define TITAN_IRQ_USB 11 /* USB */
17 16
18/* 17#endif /* __ASM_SH_TITAN_H */
19 * The external interrupt lines, these take up ints 0 - 15 inclusive
20 * depending on the priority for the interrupt. In fact the priority
21 * is the interrupt :-)
22 */
23#define IRL0_IRQ 0
24#define IRL0_IPR_ADDR INTC_IPRD
25#define IRL0_IPR_POS 3
26#define IRL0_PRIORITY 8
27
28#define IRL1_IRQ 1
29#define IRL1_IPR_ADDR INTC_IPRD
30#define IRL1_IPR_POS 2
31#define IRL1_PRIORITY 8
32
33#define IRL2_IRQ 2
34#define IRL2_IPR_ADDR INTC_IPRD
35#define IRL2_IPR_POS 1
36#define IRL2_PRIORITY 8
37
38#define IRL3_IRQ 3
39#define IRL3_IPR_ADDR INTC_IPRD
40#define IRL3_IPR_POS 0
41#define IRL3_PRIORITY 8
42
43#endif
diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h
index 3c09dd4ca31c..fd00dbb82f84 100644
--- a/include/asm-sh/types.h
+++ b/include/asm-sh/types.h
@@ -52,16 +52,6 @@ typedef unsigned long long u64;
52 52
53typedef u32 dma_addr_t; 53typedef u32 dma_addr_t;
54 54
55#ifdef CONFIG_LBD
56typedef u64 sector_t;
57#define HAVE_SECTOR_T
58#endif
59
60#ifdef CONFIG_LSF
61typedef u64 blkcnt_t;
62#define HAVE_BLKCNT_T
63#endif
64
65#endif /* __ASSEMBLY__ */ 55#endif /* __ASSEMBLY__ */
66 56
67#endif /* __KERNEL__ */ 57#endif /* __KERNEL__ */
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index 1c2abde122cd..f982073dc6c6 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -332,125 +332,6 @@
332 332
333#ifdef __KERNEL__ 333#ifdef __KERNEL__
334 334
335#include <linux/err.h>
336
337/* user-visible error numbers are in the range -1 - -MAX_ERRNO:
338 * see <asm-sh/errno.h> */
339
340#define __syscall_return(type, res) \
341do { \
342 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
343 /* Avoid using "res" which is declared to be in register r0; \
344 errno might expand to a function call and clobber it. */ \
345 int __err = -(res); \
346 errno = __err; \
347 res = -1; \
348 } \
349 return (type) (res); \
350} while (0)
351
352/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
353#define _syscall0(type,name) \
354type name(void) \
355{ \
356register long __sc0 __asm__ ("r3") = __NR_##name; \
357__asm__ __volatile__ ("trapa #0x10" \
358 : "=z" (__sc0) \
359 : "0" (__sc0) \
360 : "memory" ); \
361__syscall_return(type,__sc0); \
362}
363
364#define _syscall1(type,name,type1,arg1) \
365type name(type1 arg1) \
366{ \
367register long __sc0 __asm__ ("r3") = __NR_##name; \
368register long __sc4 __asm__ ("r4") = (long) arg1; \
369__asm__ __volatile__ ("trapa #0x11" \
370 : "=z" (__sc0) \
371 : "0" (__sc0), "r" (__sc4) \
372 : "memory"); \
373__syscall_return(type,__sc0); \
374}
375
376#define _syscall2(type,name,type1,arg1,type2,arg2) \
377type name(type1 arg1,type2 arg2) \
378{ \
379register long __sc0 __asm__ ("r3") = __NR_##name; \
380register long __sc4 __asm__ ("r4") = (long) arg1; \
381register long __sc5 __asm__ ("r5") = (long) arg2; \
382__asm__ __volatile__ ("trapa #0x12" \
383 : "=z" (__sc0) \
384 : "0" (__sc0), "r" (__sc4), "r" (__sc5) \
385 : "memory"); \
386__syscall_return(type,__sc0); \
387}
388
389#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
390type name(type1 arg1,type2 arg2,type3 arg3) \
391{ \
392register long __sc0 __asm__ ("r3") = __NR_##name; \
393register long __sc4 __asm__ ("r4") = (long) arg1; \
394register long __sc5 __asm__ ("r5") = (long) arg2; \
395register long __sc6 __asm__ ("r6") = (long) arg3; \
396__asm__ __volatile__ ("trapa #0x13" \
397 : "=z" (__sc0) \
398 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) \
399 : "memory"); \
400__syscall_return(type,__sc0); \
401}
402
403#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
404type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
405{ \
406register long __sc0 __asm__ ("r3") = __NR_##name; \
407register long __sc4 __asm__ ("r4") = (long) arg1; \
408register long __sc5 __asm__ ("r5") = (long) arg2; \
409register long __sc6 __asm__ ("r6") = (long) arg3; \
410register long __sc7 __asm__ ("r7") = (long) arg4; \
411__asm__ __volatile__ ("trapa #0x14" \
412 : "=z" (__sc0) \
413 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), \
414 "r" (__sc7) \
415 : "memory" ); \
416__syscall_return(type,__sc0); \
417}
418
419#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
420type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
421{ \
422register long __sc3 __asm__ ("r3") = __NR_##name; \
423register long __sc4 __asm__ ("r4") = (long) arg1; \
424register long __sc5 __asm__ ("r5") = (long) arg2; \
425register long __sc6 __asm__ ("r6") = (long) arg3; \
426register long __sc7 __asm__ ("r7") = (long) arg4; \
427register long __sc0 __asm__ ("r0") = (long) arg5; \
428__asm__ __volatile__ ("trapa #0x15" \
429 : "=z" (__sc0) \
430 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \
431 "r" (__sc3) \
432 : "memory" ); \
433__syscall_return(type,__sc0); \
434}
435
436#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
437type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
438{ \
439register long __sc3 __asm__ ("r3") = __NR_##name; \
440register long __sc4 __asm__ ("r4") = (long) arg1; \
441register long __sc5 __asm__ ("r5") = (long) arg2; \
442register long __sc6 __asm__ ("r6") = (long) arg3; \
443register long __sc7 __asm__ ("r7") = (long) arg4; \
444register long __sc0 __asm__ ("r0") = (long) arg5; \
445register long __sc1 __asm__ ("r1") = (long) arg6; \
446__asm__ __volatile__ ("trapa #0x16" \
447 : "=z" (__sc0) \
448 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \
449 "r" (__sc3), "r" (__sc1) \
450 : "memory" ); \
451__syscall_return(type,__sc0); \
452}
453
454#define __ARCH_WANT_IPC_PARSE_VERSION 335#define __ARCH_WANT_IPC_PARSE_VERSION
455#define __ARCH_WANT_OLD_READDIR 336#define __ARCH_WANT_OLD_READDIR
456#define __ARCH_WANT_OLD_STAT 337#define __ARCH_WANT_OLD_STAT
diff --git a/include/asm-sh64/checksum.h b/include/asm-sh64/checksum.h
index fd034e9ae6e3..ba594ccb42e5 100644
--- a/include/asm-sh64/checksum.h
+++ b/include/asm-sh64/checksum.h
@@ -26,8 +26,7 @@
26 * 26 *
27 * it's best to have buff aligned on a 32-bit boundary 27 * it's best to have buff aligned on a 32-bit boundary
28 */ 28 */
29asmlinkage unsigned int csum_partial(const unsigned char *buff, int len, 29asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
30 unsigned int sum);
31 30
32/* 31/*
33 * Note: when you get a NULL pointer exception here this means someone 32 * Note: when you get a NULL pointer exception here this means someone
@@ -38,46 +37,34 @@ asmlinkage unsigned int csum_partial(const unsigned char *buff, int len,
38 */ 37 */
39 38
40 39
41unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, 40__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len,
42 unsigned int sum); 41 __wsum sum);
43 42
44unsigned int csum_partial_copy_from_user(const char *src, char *dst, 43__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
45 int len, int sum, int *err_ptr); 44 int len, __wsum sum, int *err_ptr);
46 45
47/* 46static inline __sum16 csum_fold(__wsum csum)
48 * These are the old (and unsafe) way of doing checksums, a warning message will be
49 * printed if they are used and an exeption occurs.
50 *
51 * these functions should go away after some time.
52 */
53
54#define csum_partial_copy_fromuser csum_partial_copy
55
56unsigned int csum_partial_copy(const char *src, char *dst, int len,
57 unsigned int sum);
58
59static inline unsigned short csum_fold(unsigned int sum)
60{ 47{
48 u32 sum = (__force u32)csum;
61 sum = (sum & 0xffff) + (sum >> 16); 49 sum = (sum & 0xffff) + (sum >> 16);
62 sum = (sum & 0xffff) + (sum >> 16); 50 sum = (sum & 0xffff) + (sum >> 16);
63 return ~(sum); 51 return (__force __sum16)~sum;
64} 52}
65 53
66unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); 54__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
67 55
68unsigned long csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 56__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
69 unsigned short len, unsigned short proto, 57 unsigned short len, unsigned short proto,
70 unsigned int sum); 58 __wsum sum);
71 59
72/* 60/*
73 * computes the checksum of the TCP/UDP pseudo-header 61 * computes the checksum of the TCP/UDP pseudo-header
74 * returns a 16-bit checksum, already complemented 62 * returns a 16-bit checksum, already complemented
75 */ 63 */
76static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 64static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
77 unsigned long daddr,
78 unsigned short len, 65 unsigned short len,
79 unsigned short proto, 66 unsigned short proto,
80 unsigned int sum) 67 __wsum sum)
81{ 68{
82 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 69 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
83} 70}
@@ -86,7 +73,7 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
86 * this routine is used for miscellaneous IP-like checksums, mainly 73 * this routine is used for miscellaneous IP-like checksums, mainly
87 * in icmp.c 74 * in icmp.c
88 */ 75 */
89static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 76static inline __sum16 ip_compute_csum(const void *buff, int len)
90{ 77{
91 return csum_fold(csum_partial(buff, len, 0)); 78 return csum_fold(csum_partial(buff, len, 0));
92} 79}
diff --git a/include/asm-sh64/device.h b/include/asm-sh64/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-sh64/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h
index 68e27a8fca31..5efe906c59f7 100644
--- a/include/asm-sh64/dma-mapping.h
+++ b/include/asm-sh64/dma-mapping.h
@@ -35,7 +35,7 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
35 consistent_free(NULL, size, vaddr, dma_handle); 35 consistent_free(NULL, size, vaddr, dma_handle);
36} 36}
37 37
38static inline void dma_cache_sync(void *vaddr, size_t size, 38static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
39 enum dma_data_direction dir) 39 enum dma_data_direction dir)
40{ 40{
41 dma_cache_wback_inv((unsigned long)vaddr, size); 41 dma_cache_wback_inv((unsigned long)vaddr, size);
diff --git a/include/asm-sh64/setup.h b/include/asm-sh64/setup.h
index ebd42eb1b709..5b07b14c2927 100644
--- a/include/asm-sh64/setup.h
+++ b/include/asm-sh64/setup.h
@@ -1,6 +1,10 @@
1#ifndef __ASM_SH64_SETUP_H 1#ifndef __ASM_SH64_SETUP_H
2#define __ASM_SH64_SETUP_H 2#define __ASM_SH64_SETUP_H
3 3
4#define COMMAND_LINE_SIZE 256
5
6#ifdef __KERNEL__
7
4#define PARAM ((unsigned char *)empty_zero_page) 8#define PARAM ((unsigned char *)empty_zero_page)
5#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) 9#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000))
6#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004)) 10#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004))
@@ -12,5 +16,7 @@
12#define COMMAND_LINE ((char *) (PARAM+256)) 16#define COMMAND_LINE ((char *) (PARAM+256))
13#define COMMAND_LINE_SIZE 256 17#define COMMAND_LINE_SIZE 256
14 18
19#endif /* __KERNEL__ */
20
15#endif /* __ASM_SH64_SETUP_H */ 21#endif /* __ASM_SH64_SETUP_H */
16 22
diff --git a/include/asm-sh64/unistd.h b/include/asm-sh64/unistd.h
index ee7828b27ad1..1f38a7aacaaf 100644
--- a/include/asm-sh64/unistd.h
+++ b/include/asm-sh64/unistd.h
@@ -347,148 +347,6 @@
347#ifdef __KERNEL__ 347#ifdef __KERNEL__
348 348
349#define NR_syscalls 321 349#define NR_syscalls 321
350#include <linux/err.h>
351
352/* user-visible error numbers are in the range -1 - -MAX_ERRNO:
353 * see <asm-sh64/errno.h> */
354
355#define __syscall_return(type, res) \
356do { \
357 /* Note: when returning from kernel the return value is in r9 \
358 ** This prevents conflicts between return value and arg1 \
359 ** when dispatching signal handler, in other words makes \
360 ** life easier in the system call epilogue (see entry.S) \
361 */ \
362 register unsigned long __sr2 __asm__ ("r2") = res; \
363 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
364 errno = -(res); \
365 __sr2 = -1; \
366 } \
367 return (type) (__sr2); \
368} while (0)
369
370/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
371
372#define _syscall0(type,name) \
373type name(void) \
374{ \
375register unsigned long __sc0 __asm__ ("r9") = ((0x10 << 16) | __NR_##name); \
376__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "()" \
377 : "=r" (__sc0) \
378 : "r" (__sc0) ); \
379__syscall_return(type,__sc0); \
380}
381
382 /*
383 * The apparent spurious "dummy" assembler comment is *needed*,
384 * as without it, the compiler treats the arg<n> variables
385 * as no longer live just before the asm. The compiler can
386 * then optimize the storage into any registers it wishes.
387 * The additional dummy statement forces the compiler to put
388 * the arguments into the correct registers before the TRAPA.
389 */
390#define _syscall1(type,name,type1,arg1) \
391type name(type1 arg1) \
392{ \
393register unsigned long __sc0 __asm__ ("r9") = ((0x11 << 16) | __NR_##name); \
394register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
395__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2)" \
396 : "=r" (__sc0) \
397 : "r" (__sc0), "r" (__sc2)); \
398__asm__ __volatile__ ("!dummy %0 %1" \
399 : \
400 : "r" (__sc0), "r" (__sc2)); \
401__syscall_return(type,__sc0); \
402}
403
404#define _syscall2(type,name,type1,arg1,type2,arg2) \
405type name(type1 arg1,type2 arg2) \
406{ \
407register unsigned long __sc0 __asm__ ("r9") = ((0x12 << 16) | __NR_##name); \
408register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
409register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
410__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2,%3)" \
411 : "=r" (__sc0) \
412 : "r" (__sc0), "r" (__sc2), "r" (__sc3) ); \
413__asm__ __volatile__ ("!dummy %0 %1 %2" \
414 : \
415 : "r" (__sc0), "r" (__sc2), "r" (__sc3) ); \
416__syscall_return(type,__sc0); \
417}
418
419#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
420type name(type1 arg1,type2 arg2,type3 arg3) \
421{ \
422register unsigned long __sc0 __asm__ ("r9") = ((0x13 << 16) | __NR_##name); \
423register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
424register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
425register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
426__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2,%3,%4)" \
427 : "=r" (__sc0) \
428 : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) ); \
429__asm__ __volatile__ ("!dummy %0 %1 %2 %3" \
430 : \
431 : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) ); \
432__syscall_return(type,__sc0); \
433}
434
435#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
436type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
437{ \
438register unsigned long __sc0 __asm__ ("r9") = ((0x14 << 16) | __NR_##name); \
439register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
440register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
441register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
442register unsigned long __sc5 __asm__ ("r5") = (unsigned long) arg4; \
443__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2,%3,%4,%5)" \
444 : "=r" (__sc0) \
445 : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5) );\
446__asm__ __volatile__ ("!dummy %0 %1 %2 %3 %4" \
447 : \
448 : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5) );\
449__syscall_return(type,__sc0); \
450}
451
452#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
453type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
454{ \
455register unsigned long __sc0 __asm__ ("r9") = ((0x15 << 16) | __NR_##name); \
456register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
457register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
458register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
459register unsigned long __sc5 __asm__ ("r5") = (unsigned long) arg4; \
460register unsigned long __sc6 __asm__ ("r6") = (unsigned long) arg5; \
461__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2,%3,%4,%5,%6)" \
462 : "=r" (__sc0) \
463 : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
464 "r" (__sc6)); \
465__asm__ __volatile__ ("!dummy %0 %1 %2 %3 %4 %5" \
466 : \
467 : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
468 "r" (__sc6)); \
469__syscall_return(type,__sc0); \
470}
471
472#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5, type6, arg6) \
473type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
474{ \
475register unsigned long __sc0 __asm__ ("r9") = ((0x16 << 16) | __NR_##name); \
476register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
477register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
478register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
479register unsigned long __sc5 __asm__ ("r5") = (unsigned long) arg4; \
480register unsigned long __sc6 __asm__ ("r6") = (unsigned long) arg5; \
481register unsigned long __sc7 __asm__ ("r7") = (unsigned long) arg6; \
482__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2,%3,%4,%5,%6,%7)" \
483 : "=r" (__sc0) \
484 : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
485 "r" (__sc6), "r" (__sc7)); \
486__asm__ __volatile__ ("!dummy %0 %1 %2 %3 %4 %5 %6" \
487 : \
488 : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
489 "r" (__sc6), "r" (__sc7)); \
490__syscall_return(type,__sc0); \
491}
492 350
493#define __ARCH_WANT_IPC_PARSE_VERSION 351#define __ARCH_WANT_IPC_PARSE_VERSION
494#define __ARCH_WANT_OLD_READDIR 352#define __ARCH_WANT_OLD_READDIR
diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h
index 286158108974..267e631e9bbc 100644
--- a/include/asm-sparc/checksum.h
+++ b/include/asm-sparc/checksum.h
@@ -30,7 +30,7 @@
30 * 30 *
31 * it's best to have buff aligned on a 32-bit boundary 31 * it's best to have buff aligned on a 32-bit boundary
32 */ 32 */
33extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 33extern __wsum csum_partial(const void *buff, int len, __wsum sum);
34 34
35/* the same as csum_partial, but copies from fs:src while it 35/* the same as csum_partial, but copies from fs:src while it
36 * checksums 36 * checksums
@@ -41,9 +41,8 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
41 41
42extern unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *); 42extern unsigned int __csum_partial_copy_sparc_generic (const unsigned char *, unsigned char *);
43 43
44static inline unsigned int 44static inline __wsum
45csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, int len, 45csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
46 unsigned int sum)
47{ 46{
48 register unsigned int ret asm("o0") = (unsigned int)src; 47 register unsigned int ret asm("o0") = (unsigned int)src;
49 register char *d asm("o1") = dst; 48 register char *d asm("o1") = dst;
@@ -57,42 +56,36 @@ csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, int len
57 : "o2", "o3", "o4", "o5", "o7", 56 : "o2", "o3", "o4", "o5", "o7",
58 "g2", "g3", "g4", "g5", "g7", 57 "g2", "g3", "g4", "g5", "g7",
59 "memory", "cc"); 58 "memory", "cc");
60 return ret; 59 return (__force __wsum)ret;
61} 60}
62 61
63static inline unsigned int 62static inline __wsum
64csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, int len, 63csum_partial_copy_from_user(const void __user *src, void *dst, int len,
65 unsigned int sum, int *err) 64 __wsum sum, int *err)
66 { 65 {
67 if (!access_ok (VERIFY_READ, src, len)) { 66 register unsigned long ret asm("o0") = (unsigned long)src;
68 *err = -EFAULT; 67 register char *d asm("o1") = dst;
69 memset (dst, 0, len); 68 register int l asm("g1") = len;
70 return sum; 69 register __wsum s asm("g7") = sum;
71 } else {
72 register unsigned long ret asm("o0") = (unsigned long)src;
73 register char *d asm("o1") = dst;
74 register int l asm("g1") = len;
75 register unsigned int s asm("g7") = sum;
76 70
77 __asm__ __volatile__ ( 71 __asm__ __volatile__ (
78 ".section __ex_table,#alloc\n\t" 72 ".section __ex_table,#alloc\n\t"
79 ".align 4\n\t" 73 ".align 4\n\t"
80 ".word 1f,2\n\t" 74 ".word 1f,2\n\t"
81 ".previous\n" 75 ".previous\n"
82 "1:\n\t" 76 "1:\n\t"
83 "call __csum_partial_copy_sparc_generic\n\t" 77 "call __csum_partial_copy_sparc_generic\n\t"
84 " st %8, [%%sp + 64]\n" 78 " st %8, [%%sp + 64]\n"
85 : "=&r" (ret), "=&r" (d), "=&r" (l), "=&r" (s) 79 : "=&r" (ret), "=&r" (d), "=&r" (l), "=&r" (s)
86 : "0" (ret), "1" (d), "2" (l), "3" (s), "r" (err) 80 : "0" (ret), "1" (d), "2" (l), "3" (s), "r" (err)
87 : "o2", "o3", "o4", "o5", "o7", "g2", "g3", "g4", "g5", 81 : "o2", "o3", "o4", "o5", "o7", "g2", "g3", "g4", "g5",
88 "cc", "memory"); 82 "cc", "memory");
89 return ret; 83 return (__force __wsum)ret;
90 } 84}
91 }
92 85
93static inline unsigned int 86static inline __wsum
94csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, int len, 87csum_partial_copy_to_user(const void *src, void __user *dst, int len,
95 unsigned int sum, int *err) 88 __wsum sum, int *err)
96{ 89{
97 if (!access_ok (VERIFY_WRITE, dst, len)) { 90 if (!access_ok (VERIFY_WRITE, dst, len)) {
98 *err = -EFAULT; 91 *err = -EFAULT;
@@ -101,7 +94,7 @@ csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, i
101 register unsigned long ret asm("o0") = (unsigned long)src; 94 register unsigned long ret asm("o0") = (unsigned long)src;
102 register char __user *d asm("o1") = dst; 95 register char __user *d asm("o1") = dst;
103 register int l asm("g1") = len; 96 register int l asm("g1") = len;
104 register unsigned int s asm("g7") = sum; 97 register __wsum s asm("g7") = sum;
105 98
106 __asm__ __volatile__ ( 99 __asm__ __volatile__ (
107 ".section __ex_table,#alloc\n\t" 100 ".section __ex_table,#alloc\n\t"
@@ -116,7 +109,7 @@ csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, i
116 : "o2", "o3", "o4", "o5", "o7", 109 : "o2", "o3", "o4", "o5", "o7",
117 "g2", "g3", "g4", "g5", 110 "g2", "g3", "g4", "g5",
118 "cc", "memory"); 111 "cc", "memory");
119 return ret; 112 return (__force __wsum)ret;
120 } 113 }
121} 114}
122 115
@@ -126,10 +119,9 @@ csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, i
126/* ihl is always 5 or greater, almost always is 5, and iph is word aligned 119/* ihl is always 5 or greater, almost always is 5, and iph is word aligned
127 * the majority of the time. 120 * the majority of the time.
128 */ 121 */
129static inline unsigned short ip_fast_csum(const unsigned char *iph, 122static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
130 unsigned int ihl)
131{ 123{
132 unsigned short sum; 124 __sum16 sum;
133 125
134 /* Note: We must read %2 before we touch %0 for the first time, 126 /* Note: We must read %2 before we touch %0 for the first time,
135 * because GCC can legitimately use the same register for 127 * because GCC can legitimately use the same register for
@@ -164,7 +156,7 @@ static inline unsigned short ip_fast_csum(const unsigned char *iph,
164} 156}
165 157
166/* Fold a partial checksum without adding pseudo headers. */ 158/* Fold a partial checksum without adding pseudo headers. */
167static inline unsigned int csum_fold(unsigned int sum) 159static inline __sum16 csum_fold(__wsum sum)
168{ 160{
169 unsigned int tmp; 161 unsigned int tmp;
170 162
@@ -173,23 +165,22 @@ static inline unsigned int csum_fold(unsigned int sum)
173 "addx\t%1, %%g0, %1\n\t" 165 "addx\t%1, %%g0, %1\n\t"
174 "xnor\t%%g0, %1, %0" 166 "xnor\t%%g0, %1, %0"
175 : "=&r" (sum), "=r" (tmp) 167 : "=&r" (sum), "=r" (tmp)
176 : "0" (sum), "1" (sum<<16) 168 : "0" (sum), "1" ((__force u32)sum<<16)
177 : "cc"); 169 : "cc");
178 return sum; 170 return (__force __sum16)sum;
179} 171}
180 172
181static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 173static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
182 unsigned long daddr, 174 unsigned short len,
183 unsigned int len,
184 unsigned short proto, 175 unsigned short proto,
185 unsigned int sum) 176 __wsum sum)
186{ 177{
187 __asm__ __volatile__("addcc\t%1, %0, %0\n\t" 178 __asm__ __volatile__("addcc\t%1, %0, %0\n\t"
188 "addxcc\t%2, %0, %0\n\t" 179 "addxcc\t%2, %0, %0\n\t"
189 "addxcc\t%3, %0, %0\n\t" 180 "addxcc\t%3, %0, %0\n\t"
190 "addx\t%0, %%g0, %0\n\t" 181 "addx\t%0, %%g0, %0\n\t"
191 : "=r" (sum), "=r" (saddr) 182 : "=r" (sum), "=r" (saddr)
192 : "r" (daddr), "r" ((proto<<16)+len), "0" (sum), 183 : "r" (daddr), "r" (proto + len), "0" (sum),
193 "1" (saddr) 184 "1" (saddr)
194 : "cc"); 185 : "cc");
195 return sum; 186 return sum;
@@ -199,22 +190,20 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
199 * computes the checksum of the TCP/UDP pseudo-header 190 * computes the checksum of the TCP/UDP pseudo-header
200 * returns a 16-bit checksum, already complemented 191 * returns a 16-bit checksum, already complemented
201 */ 192 */
202static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 193static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
203 unsigned long daddr,
204 unsigned short len, 194 unsigned short len,
205 unsigned short proto, 195 unsigned short proto,
206 unsigned int sum) 196 __wsum sum)
207{ 197{
208 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 198 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
209} 199}
210 200
211#define _HAVE_ARCH_IPV6_CSUM 201#define _HAVE_ARCH_IPV6_CSUM
212 202
213static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 203static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
214 struct in6_addr *daddr, 204 const struct in6_addr *daddr,
215 __u32 len, 205 __u32 len, unsigned short proto,
216 unsigned short proto, 206 __wsum sum)
217 unsigned int sum)
218{ 207{
219 __asm__ __volatile__ ( 208 __asm__ __volatile__ (
220 "addcc %3, %4, %%g4\n\t" 209 "addcc %3, %4, %%g4\n\t"
@@ -245,7 +234,7 @@ static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
245} 234}
246 235
247/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */ 236/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */
248static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 237static inline __sum16 ip_compute_csum(const void *buff, int len)
249{ 238{
250 return csum_fold(csum_partial(buff, len, 0)); 239 return csum_fold(csum_partial(buff, len, 0));
251} 240}
diff --git a/include/asm-sparc/device.h b/include/asm-sparc/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-sparc/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index c7a495afc82e..d5b2f8053b3b 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -318,144 +318,17 @@
318#define __NR_unshare 299 318#define __NR_unshare 299
319#define __NR_set_robust_list 300 319#define __NR_set_robust_list 300
320#define __NR_get_robust_list 301 320#define __NR_get_robust_list 301
321#define __NR_migrate_pages 302
322
323#define NR_SYSCALLS 303
321 324
322#ifdef __KERNEL__ 325#ifdef __KERNEL__
323/* WARNING: You MAY NOT add syscall numbers larger than 301, since 326/* WARNING: You MAY NOT add syscall numbers larger than 302, since
324 * all of the syscall tables in the Sparc kernel are 327 * all of the syscall tables in the Sparc kernel are
325 * sized to have 301 entries (starting at zero). Therefore 328 * sized to have 302 entries (starting at zero). Therefore
326 * find a free slot in the 0-301 range. 329 * find a free slot in the 0-302 range.
327 */ 330 */
328 331
329#define _syscall0(type,name) \
330type name(void) \
331{ \
332long __res; \
333register long __g1 __asm__ ("g1") = __NR_##name; \
334__asm__ __volatile__ ("t 0x10\n\t" \
335 "bcc 1f\n\t" \
336 "mov %%o0, %0\n\t" \
337 "sub %%g0, %%o0, %0\n\t" \
338 "1:\n\t" \
339 : "=r" (__res)\
340 : "r" (__g1) \
341 : "o0", "cc"); \
342if (__res < -255 || __res >= 0) \
343 return (type) __res; \
344errno = -__res; \
345return -1; \
346}
347
348#define _syscall1(type,name,type1,arg1) \
349type name(type1 arg1) \
350{ \
351long __res; \
352register long __g1 __asm__ ("g1") = __NR_##name; \
353register long __o0 __asm__ ("o0") = (long)(arg1); \
354__asm__ __volatile__ ("t 0x10\n\t" \
355 "bcc 1f\n\t" \
356 "mov %%o0, %0\n\t" \
357 "sub %%g0, %%o0, %0\n\t" \
358 "1:\n\t" \
359 : "=r" (__res), "=&r" (__o0) \
360 : "1" (__o0), "r" (__g1) \
361 : "cc"); \
362if (__res < -255 || __res >= 0) \
363 return (type) __res; \
364errno = -__res; \
365return -1; \
366}
367
368#define _syscall2(type,name,type1,arg1,type2,arg2) \
369type name(type1 arg1,type2 arg2) \
370{ \
371long __res; \
372register long __g1 __asm__ ("g1") = __NR_##name; \
373register long __o0 __asm__ ("o0") = (long)(arg1); \
374register long __o1 __asm__ ("o1") = (long)(arg2); \
375__asm__ __volatile__ ("t 0x10\n\t" \
376 "bcc 1f\n\t" \
377 "mov %%o0, %0\n\t" \
378 "sub %%g0, %%o0, %0\n\t" \
379 "1:\n\t" \
380 : "=r" (__res), "=&r" (__o0) \
381 : "1" (__o0), "r" (__o1), "r" (__g1) \
382 : "cc"); \
383if (__res < -255 || __res >= 0) \
384 return (type) __res; \
385errno = -__res; \
386return -1; \
387}
388
389#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
390type name(type1 arg1,type2 arg2,type3 arg3) \
391{ \
392long __res; \
393register long __g1 __asm__ ("g1") = __NR_##name; \
394register long __o0 __asm__ ("o0") = (long)(arg1); \
395register long __o1 __asm__ ("o1") = (long)(arg2); \
396register long __o2 __asm__ ("o2") = (long)(arg3); \
397__asm__ __volatile__ ("t 0x10\n\t" \
398 "bcc 1f\n\t" \
399 "mov %%o0, %0\n\t" \
400 "sub %%g0, %%o0, %0\n\t" \
401 "1:\n\t" \
402 : "=r" (__res), "=&r" (__o0) \
403 : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
404 : "cc"); \
405if (__res < -255 || __res>=0) \
406 return (type) __res; \
407errno = -__res; \
408return -1; \
409}
410
411#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
412type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
413{ \
414long __res; \
415register long __g1 __asm__ ("g1") = __NR_##name; \
416register long __o0 __asm__ ("o0") = (long)(arg1); \
417register long __o1 __asm__ ("o1") = (long)(arg2); \
418register long __o2 __asm__ ("o2") = (long)(arg3); \
419register long __o3 __asm__ ("o3") = (long)(arg4); \
420__asm__ __volatile__ ("t 0x10\n\t" \
421 "bcc 1f\n\t" \
422 "mov %%o0, %0\n\t" \
423 "sub %%g0, %%o0, %0\n\t" \
424 "1:\n\t" \
425 : "=r" (__res), "=&r" (__o0) \
426 : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
427 : "cc"); \
428if (__res < -255 || __res>=0) \
429 return (type) __res; \
430errno = -__res; \
431return -1; \
432}
433
434#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
435 type5,arg5) \
436type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
437{ \
438long __res; \
439register long __g1 __asm__ ("g1") = __NR_##name; \
440register long __o0 __asm__ ("o0") = (long)(arg1); \
441register long __o1 __asm__ ("o1") = (long)(arg2); \
442register long __o2 __asm__ ("o2") = (long)(arg3); \
443register long __o3 __asm__ ("o3") = (long)(arg4); \
444register long __o4 __asm__ ("o4") = (long)(arg5); \
445__asm__ __volatile__ ("t 0x10\n\t" \
446 "bcc 1f\n\t" \
447 "mov %%o0, %0\n\t" \
448 "sub %%g0, %%o0, %0\n\t" \
449 "1:\n\t" \
450 : "=r" (__res), "=&r" (__o0) \
451 : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
452 : "cc"); \
453if (__res < -255 || __res>=0) \
454 return (type) __res; \
455errno = -__res; \
456return -1; \
457}
458
459#define __ARCH_WANT_IPC_PARSE_VERSION 332#define __ARCH_WANT_IPC_PARSE_VERSION
460#define __ARCH_WANT_OLD_READDIR 333#define __ARCH_WANT_OLD_READDIR
461#define __ARCH_WANT_STAT64 334#define __ARCH_WANT_STAT64
diff --git a/include/asm-sparc64/checksum.h b/include/asm-sparc64/checksum.h
index dc8bed246fc9..70a006da7634 100644
--- a/include/asm-sparc64/checksum.h
+++ b/include/asm-sparc64/checksum.h
@@ -30,7 +30,7 @@
30 * 30 *
31 * it's best to have buff aligned on a 32-bit boundary 31 * it's best to have buff aligned on a 32-bit boundary
32 */ 32 */
33extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 33extern __wsum csum_partial(const void * buff, int len, __wsum sum);
34 34
35/* the same as csum_partial, but copies from user space while it 35/* the same as csum_partial, but copies from user space while it
36 * checksums 36 * checksums
@@ -38,52 +38,50 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
38 * here even more important to align src and dst on a 32-bit (or even 38 * here even more important to align src and dst on a 32-bit (or even
39 * better 64-bit) boundary 39 * better 64-bit) boundary
40 */ 40 */
41extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, 41extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,
42 unsigned char *dst, 42 int len, __wsum sum);
43 int len, unsigned int sum); 43
44 44extern long __csum_partial_copy_from_user(const void __user *src,
45extern long __csum_partial_copy_from_user(const unsigned char __user *src, 45 void *dst, int len,
46 unsigned char *dst, int len, 46 __wsum sum);
47 unsigned int sum); 47
48 48static inline __wsum
49static inline unsigned int 49csum_partial_copy_from_user(const void __user *src,
50csum_partial_copy_from_user(const unsigned char __user *src, 50 void *dst, int len,
51 unsigned char *dst, int len, 51 __wsum sum, int *err)
52 unsigned int sum, int *err)
53{ 52{
54 long ret = __csum_partial_copy_from_user(src, dst, len, sum); 53 long ret = __csum_partial_copy_from_user(src, dst, len, sum);
55 if (ret < 0) 54 if (ret < 0)
56 *err = -EFAULT; 55 *err = -EFAULT;
57 return (unsigned int) ret; 56 return (__force __wsum) ret;
58} 57}
59 58
60/* 59/*
61 * Copy and checksum to user 60 * Copy and checksum to user
62 */ 61 */
63#define HAVE_CSUM_COPY_USER 62#define HAVE_CSUM_COPY_USER
64extern long __csum_partial_copy_to_user(const unsigned char *src, 63extern long __csum_partial_copy_to_user(const void *src,
65 unsigned char __user *dst, int len, 64 void __user *dst, int len,
66 unsigned int sum); 65 __wsum sum);
67 66
68static inline unsigned int 67static inline __wsum
69csum_and_copy_to_user(const unsigned char *src, 68csum_and_copy_to_user(const void *src,
70 unsigned char __user *dst, int len, 69 void __user *dst, int len,
71 unsigned int sum, int *err) 70 __wsum sum, int *err)
72{ 71{
73 long ret = __csum_partial_copy_to_user(src, dst, len, sum); 72 long ret = __csum_partial_copy_to_user(src, dst, len, sum);
74 if (ret < 0) 73 if (ret < 0)
75 *err = -EFAULT; 74 *err = -EFAULT;
76 return (unsigned int) ret; 75 return (__force __wsum) ret;
77} 76}
78 77
79/* ihl is always 5 or greater, almost always is 5, and iph is word aligned 78/* ihl is always 5 or greater, almost always is 5, and iph is word aligned
80 * the majority of the time. 79 * the majority of the time.
81 */ 80 */
82extern unsigned short ip_fast_csum(__const__ unsigned char *iph, 81extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
83 unsigned int ihl);
84 82
85/* Fold a partial checksum without adding pseudo headers. */ 83/* Fold a partial checksum without adding pseudo headers. */
86static inline unsigned short csum_fold(unsigned int sum) 84static inline __sum16 csum_fold(__wsum sum)
87{ 85{
88 unsigned int tmp; 86 unsigned int tmp;
89 87
@@ -93,16 +91,15 @@ static inline unsigned short csum_fold(unsigned int sum)
93" addc %1, %%g0, %1\n" 91" addc %1, %%g0, %1\n"
94" xnor %%g0, %1, %0\n" 92" xnor %%g0, %1, %0\n"
95 : "=&r" (sum), "=r" (tmp) 93 : "=&r" (sum), "=r" (tmp)
96 : "0" (sum), "1" (sum<<16) 94 : "0" (sum), "1" ((__force u32)sum<<16)
97 : "cc"); 95 : "cc");
98 return (sum & 0xffff); 96 return (__force __sum16)sum;
99} 97}
100 98
101static inline unsigned long csum_tcpudp_nofold(unsigned long saddr, 99static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
102 unsigned long daddr,
103 unsigned int len, 100 unsigned int len,
104 unsigned short proto, 101 unsigned short proto,
105 unsigned int sum) 102 __wsum sum)
106{ 103{
107 __asm__ __volatile__( 104 __asm__ __volatile__(
108" addcc %1, %0, %0\n" 105" addcc %1, %0, %0\n"
@@ -110,7 +107,7 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
110" addccc %3, %0, %0\n" 107" addccc %3, %0, %0\n"
111" addc %0, %%g0, %0\n" 108" addc %0, %%g0, %0\n"
112 : "=r" (sum), "=r" (saddr) 109 : "=r" (sum), "=r" (saddr)
113 : "r" (daddr), "r" ((proto<<16)+len), "0" (sum), "1" (saddr) 110 : "r" (daddr), "r" (proto + len), "0" (sum), "1" (saddr)
114 : "cc"); 111 : "cc");
115 return sum; 112 return sum;
116} 113}
@@ -119,22 +116,20 @@ static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
119 * computes the checksum of the TCP/UDP pseudo-header 116 * computes the checksum of the TCP/UDP pseudo-header
120 * returns a 16-bit checksum, already complemented 117 * returns a 16-bit checksum, already complemented
121 */ 118 */
122static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 119static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
123 unsigned long daddr,
124 unsigned short len, 120 unsigned short len,
125 unsigned short proto, 121 unsigned short proto,
126 unsigned int sum) 122 __wsum sum)
127{ 123{
128 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 124 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
129} 125}
130 126
131#define _HAVE_ARCH_IPV6_CSUM 127#define _HAVE_ARCH_IPV6_CSUM
132 128
133static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 129static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
134 struct in6_addr *daddr, 130 const struct in6_addr *daddr,
135 __u32 len, 131 __u32 len, unsigned short proto,
136 unsigned short proto, 132 __wsum sum)
137 unsigned int sum)
138{ 133{
139 __asm__ __volatile__ ( 134 __asm__ __volatile__ (
140" addcc %3, %4, %%g7\n" 135" addcc %3, %4, %%g7\n"
@@ -165,7 +160,7 @@ static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
165} 160}
166 161
167/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */ 162/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */
168static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 163static inline __sum16 ip_compute_csum(const void *buff, int len)
169{ 164{
170 return csum_fold(csum_partial(buff, len, 0)); 165 return csum_fold(csum_partial(buff, len, 0));
171} 166}
diff --git a/include/asm-sparc64/device.h b/include/asm-sparc64/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-sparc64/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h
index 27c46fbeebd6..2f858a2df94a 100644
--- a/include/asm-sparc64/dma-mapping.h
+++ b/include/asm-sparc64/dma-mapping.h
@@ -181,7 +181,7 @@ dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t siz
181 181
182#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 182#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
183#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 183#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
184#define dma_is_consistent(d) (1) 184#define dma_is_consistent(d, h) (1)
185 185
186static inline int 186static inline int
187dma_get_cache_alignment(void) 187dma_get_cache_alignment(void)
@@ -210,7 +210,7 @@ dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
210} 210}
211 211
212static inline void 212static inline void
213dma_cache_sync(void *vaddr, size_t size, 213dma_cache_sync(struct device *dev, void *vaddr, size_t size,
214 enum dma_data_direction direction) 214 enum dma_data_direction direction)
215{ 215{
216 /* could define this in terms of the dma_cache ... operations, 216 /* could define this in terms of the dma_cache ... operations,
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h
index 7392fc4a954e..876312fe82cc 100644
--- a/include/asm-sparc64/futex.h
+++ b/include/asm-sparc64/futex.h
@@ -45,7 +45,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
45 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) 45 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
46 oparg = 1 << oparg; 46 oparg = 1 << oparg;
47 47
48 inc_preempt_count(); 48 pagefault_disable();
49 49
50 switch (op) { 50 switch (op) {
51 case FUTEX_OP_SET: 51 case FUTEX_OP_SET:
@@ -67,7 +67,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
67 ret = -ENOSYS; 67 ret = -ENOSYS;
68 } 68 }
69 69
70 dec_preempt_count(); 70 pagefault_enable();
71 71
72 if (!ret) { 72 if (!ret) {
73 switch (cmp) { 73 switch (cmp) {
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index e1ea67bc32f2..ca6560288ae8 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -18,6 +18,8 @@
18 18
19#define PCI_IRQ_NONE 0xffffffff 19#define PCI_IRQ_NONE 0xffffffff
20 20
21#define PCI_CACHE_LINE_BYTES 64
22
21static inline void pcibios_set_master(struct pci_dev *dev) 23static inline void pcibios_set_master(struct pci_dev *dev)
22{ 24{
23 /* No special bus mastering setup handling */ 25 /* No special bus mastering setup handling */
@@ -291,10 +293,6 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
291 enum pci_mmap_state mmap_state, 293 enum pci_mmap_state mmap_state,
292 int write_combine); 294 int write_combine);
293 295
294/* Platform specific MWI support. */
295#define HAVE_ARCH_PCI_MWI
296extern int pcibios_prep_mwi(struct pci_dev *dev);
297
298extern void 296extern void
299pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 297pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
300 struct resource *res); 298 struct resource *res);
diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h
index 010f9cd0a672..5891ff7ba760 100644
--- a/include/asm-sparc64/pgalloc.h
+++ b/include/asm-sparc64/pgalloc.h
@@ -13,7 +13,7 @@
13#include <asm/page.h> 13#include <asm/page.h>
14 14
15/* Page table allocation/freeing. */ 15/* Page table allocation/freeing. */
16extern kmem_cache_t *pgtable_cache; 16extern struct kmem_cache *pgtable_cache;
17 17
18static inline pgd_t *pgd_alloc(struct mm_struct *mm) 18static inline pgd_t *pgd_alloc(struct mm_struct *mm)
19{ 19{
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 124cf076717f..47047536f261 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -320,132 +320,18 @@
320#define __NR_unshare 299 320#define __NR_unshare 299
321#define __NR_set_robust_list 300 321#define __NR_set_robust_list 300
322#define __NR_get_robust_list 301 322#define __NR_get_robust_list 301
323#define __NR_migrate_pages 302
324
325#define NR_SYSCALLS 303
323 326
324#ifdef __KERNEL__ 327#ifdef __KERNEL__
325/* WARNING: You MAY NOT add syscall numbers larger than 301, since 328
329/* WARNING: You MAY NOT add syscall numbers larger than 302, since
326 * all of the syscall tables in the Sparc kernel are 330 * all of the syscall tables in the Sparc kernel are
327 * sized to have 301 entries (starting at zero). Therefore 331 * sized to have 302 entries (starting at zero). Therefore
328 * find a free slot in the 0-301 range. 332 * find a free slot in the 0-302 range.
329 */ 333 */
330 334
331#define _syscall0(type,name) \
332type name(void) \
333{ \
334long __res; \
335register long __g1 __asm__ ("g1") = __NR_##name; \
336__asm__ __volatile__ ("t 0x6d\n\t" \
337 "sub %%g0, %%o0, %0\n\t" \
338 "movcc %%xcc, %%o0, %0\n\t" \
339 : "=r" (__res)\
340 : "r" (__g1) \
341 : "o0", "cc"); \
342if (__res >= 0) \
343 return (type) __res; \
344errno = -__res; \
345return -1; \
346}
347
348#define _syscall1(type,name,type1,arg1) \
349type name(type1 arg1) \
350{ \
351long __res; \
352register long __g1 __asm__ ("g1") = __NR_##name; \
353register long __o0 __asm__ ("o0") = (long)(arg1); \
354__asm__ __volatile__ ("t 0x6d\n\t" \
355 "sub %%g0, %%o0, %0\n\t" \
356 "movcc %%xcc, %%o0, %0\n\t" \
357 : "=r" (__res), "=&r" (__o0) \
358 : "1" (__o0), "r" (__g1) \
359 : "cc"); \
360if (__res >= 0) \
361 return (type) __res; \
362errno = -__res; \
363return -1; \
364}
365
366#define _syscall2(type,name,type1,arg1,type2,arg2) \
367type name(type1 arg1,type2 arg2) \
368{ \
369long __res; \
370register long __g1 __asm__ ("g1") = __NR_##name; \
371register long __o0 __asm__ ("o0") = (long)(arg1); \
372register long __o1 __asm__ ("o1") = (long)(arg2); \
373__asm__ __volatile__ ("t 0x6d\n\t" \
374 "sub %%g0, %%o0, %0\n\t" \
375 "movcc %%xcc, %%o0, %0\n\t" \
376 : "=r" (__res), "=&r" (__o0) \
377 : "1" (__o0), "r" (__o1), "r" (__g1) \
378 : "cc"); \
379if (__res >= 0) \
380 return (type) __res; \
381errno = -__res; \
382return -1; \
383}
384
385#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
386type name(type1 arg1,type2 arg2,type3 arg3) \
387{ \
388long __res; \
389register long __g1 __asm__ ("g1") = __NR_##name; \
390register long __o0 __asm__ ("o0") = (long)(arg1); \
391register long __o1 __asm__ ("o1") = (long)(arg2); \
392register long __o2 __asm__ ("o2") = (long)(arg3); \
393__asm__ __volatile__ ("t 0x6d\n\t" \
394 "sub %%g0, %%o0, %0\n\t" \
395 "movcc %%xcc, %%o0, %0\n\t" \
396 : "=r" (__res), "=&r" (__o0) \
397 : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \
398 : "cc"); \
399if (__res>=0) \
400 return (type) __res; \
401errno = -__res; \
402return -1; \
403}
404
405#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
406type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
407{ \
408long __res; \
409register long __g1 __asm__ ("g1") = __NR_##name; \
410register long __o0 __asm__ ("o0") = (long)(arg1); \
411register long __o1 __asm__ ("o1") = (long)(arg2); \
412register long __o2 __asm__ ("o2") = (long)(arg3); \
413register long __o3 __asm__ ("o3") = (long)(arg4); \
414__asm__ __volatile__ ("t 0x6d\n\t" \
415 "sub %%g0, %%o0, %0\n\t" \
416 "movcc %%xcc, %%o0, %0\n\t" \
417 : "=r" (__res), "=&r" (__o0) \
418 : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \
419 : "cc"); \
420if (__res>=0) \
421 return (type) __res; \
422errno = -__res; \
423return -1; \
424}
425
426#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
427 type5,arg5) \
428type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
429{ \
430long __res; \
431register long __g1 __asm__ ("g1") = __NR_##name; \
432register long __o0 __asm__ ("o0") = (long)(arg1); \
433register long __o1 __asm__ ("o1") = (long)(arg2); \
434register long __o2 __asm__ ("o2") = (long)(arg3); \
435register long __o3 __asm__ ("o3") = (long)(arg4); \
436register long __o4 __asm__ ("o4") = (long)(arg5); \
437__asm__ __volatile__ ("t 0x6d\n\t" \
438 "sub %%g0, %%o0, %0\n\t" \
439 "movcc %%xcc, %%o0, %0\n\t" \
440 : "=r" (__res), "=&r" (__o0) \
441 : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__g1) \
442 : "cc"); \
443if (__res>=0) \
444 return (type) __res; \
445errno = -__res; \
446return -1; \
447}
448
449/* sysconf options, for SunOS compatibility */ 335/* sysconf options, for SunOS compatibility */
450#define _SC_ARG_MAX 1 336#define _SC_ARG_MAX 1
451#define _SC_CHILD_MAX 2 337#define _SC_CHILD_MAX 2
diff --git a/include/asm-um/device.h b/include/asm-um/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-um/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-um/dma-mapping.h b/include/asm-um/dma-mapping.h
index babd29895114..f0ee4fb55911 100644
--- a/include/asm-um/dma-mapping.h
+++ b/include/asm-um/dma-mapping.h
@@ -94,7 +94,7 @@ dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems,
94 94
95#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 95#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
96#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 96#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
97#define dma_is_consistent(d) (1) 97#define dma_is_consistent(d, h) (1)
98 98
99static inline int 99static inline int
100dma_get_cache_alignment(void) 100dma_get_cache_alignment(void)
@@ -112,7 +112,7 @@ dma_sync_single_range(struct device *dev, dma_addr_t dma_handle,
112} 112}
113 113
114static inline void 114static inline void
115dma_cache_sync(void *vaddr, size_t size, 115dma_cache_sync(struct device *dev, void *vaddr, size_t size,
116 enum dma_data_direction direction) 116 enum dma_data_direction direction)
117{ 117{
118 BUG(); 118 BUG();
diff --git a/include/asm-v850/checksum.h b/include/asm-v850/checksum.h
index 4df5e71098f9..d1dddd938262 100644
--- a/include/asm-v850/checksum.h
+++ b/include/asm-v850/checksum.h
@@ -26,8 +26,7 @@
26 * 26 *
27 * it's best to have buff aligned on a 32-bit boundary 27 * it's best to have buff aligned on a 32-bit boundary
28 */ 28 */
29extern unsigned int csum_partial (const unsigned char * buff, int len, 29extern __wsum csum_partial(const void *buff, int len, __wsum sum);
30 unsigned int sum);
31 30
32/* 31/*
33 * the same as csum_partial, but copies from src while it 32 * the same as csum_partial, but copies from src while it
@@ -36,8 +35,8 @@ extern unsigned int csum_partial (const unsigned char * buff, int len,
36 * here even more important to align src and dst on a 32-bit (or even 35 * here even more important to align src and dst on a 32-bit (or even
37 * better 64-bit) boundary 36 * better 64-bit) boundary
38 */ 37 */
39extern unsigned csum_partial_copy (const unsigned char *src, 38extern __wsum csum_partial_copy_nocheck(const void *src,
40 unsigned char *dst, int len, unsigned sum); 39 void *dst, int len, __wsum sum);
41 40
42 41
43/* 42/*
@@ -46,20 +45,17 @@ extern unsigned csum_partial_copy (const unsigned char *src,
46 * here even more important to align src and dst on a 32-bit (or even 45 * here even more important to align src and dst on a 32-bit (or even
47 * better 64-bit) boundary 46 * better 64-bit) boundary
48 */ 47 */
49extern unsigned csum_partial_copy_from_user (const unsigned char *src, 48extern __wsum csum_partial_copy_from_user (const void *src,
50 unsigned char *dst, 49 void *dst,
51 int len, unsigned sum, 50 int len, __wsum sum,
52 int *csum_err); 51 int *csum_err);
53 52
54#define csum_partial_copy_nocheck(src, dst, len, sum) \ 53__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
55 csum_partial_copy ((src), (dst), (len), (sum))
56
57unsigned short ip_fast_csum (unsigned char *iph, unsigned int ihl);
58 54
59/* 55/*
60 * Fold a partial checksum 56 * Fold a partial checksum
61 */ 57 */
62static inline unsigned int csum_fold (unsigned long sum) 58static inline __sum16 csum_fold (__wsum sum)
63{ 59{
64 unsigned int result; 60 unsigned int result;
65 /* 61 /*
@@ -68,7 +64,7 @@ static inline unsigned int csum_fold (unsigned long sum)
68 add %1, %0 H L H+L+C H+L 64 add %1, %0 H L H+L+C H+L
69 */ 65 */
70 asm ("hsw %1, %0; add %1, %0" : "=&r" (result) : "r" (sum)); 66 asm ("hsw %1, %0; add %1, %0" : "=&r" (result) : "r" (sum));
71 return (~result) >> 16; 67 return (__force __sum16)(~result >> 16);
72} 68}
73 69
74 70
@@ -76,10 +72,10 @@ static inline unsigned int csum_fold (unsigned long sum)
76 * computes the checksum of the TCP/UDP pseudo-header 72 * computes the checksum of the TCP/UDP pseudo-header
77 * returns a 16-bit checksum, already complemented 73 * returns a 16-bit checksum, already complemented
78 */ 74 */
79static inline unsigned int 75static inline __wsum
80csum_tcpudp_nofold (unsigned long saddr, unsigned long daddr, 76csum_tcpudp_nofold (__be32 saddr, __be32 daddr,
81 unsigned short len, 77 unsigned short len,
82 unsigned short proto, unsigned int sum) 78 unsigned short proto, __wsum sum)
83{ 79{
84 int __carry; 80 int __carry;
85 __asm__ ("add %2, %0;" 81 __asm__ ("add %2, %0;"
@@ -93,15 +89,15 @@ csum_tcpudp_nofold (unsigned long saddr, unsigned long daddr,
93 "add %1, %0" 89 "add %1, %0"
94 : "=&r" (sum), "=&r" (__carry) 90 : "=&r" (sum), "=&r" (__carry)
95 : "r" (daddr), "r" (saddr), 91 : "r" (daddr), "r" (saddr),
96 "r" (ntohs (len) + (proto << 8)), 92 "r" ((len + proto) << 8),
97 "0" (sum)); 93 "0" (sum));
98 return sum; 94 return sum;
99} 95}
100 96
101static inline unsigned short int 97static inline __sum16
102csum_tcpudp_magic (unsigned long saddr, unsigned long daddr, 98csum_tcpudp_magic (__be32 saddr, __be32 daddr,
103 unsigned short len, 99 unsigned short len,
104 unsigned short proto, unsigned int sum) 100 unsigned short proto, __wsum sum)
105{ 101{
106 return csum_fold (csum_tcpudp_nofold (saddr, daddr, len, proto, sum)); 102 return csum_fold (csum_tcpudp_nofold (saddr, daddr, len, proto, sum));
107} 103}
@@ -110,7 +106,7 @@ csum_tcpudp_magic (unsigned long saddr, unsigned long daddr,
110 * this routine is used for miscellaneous IP-like checksums, mainly 106 * this routine is used for miscellaneous IP-like checksums, mainly
111 * in icmp.c 107 * in icmp.c
112 */ 108 */
113extern unsigned short ip_compute_csum (const unsigned char * buff, int len); 109extern __sum16 ip_compute_csum(const void *buff, int len);
114 110
115 111
116#endif /* __V850_CHECKSUM_H__ */ 112#endif /* __V850_CHECKSUM_H__ */
diff --git a/include/asm-v850/device.h b/include/asm-v850/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-v850/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-v850/irq.h b/include/asm-v850/irq.h
index 1bf096db8f4c..88687c181f01 100644
--- a/include/asm-v850/irq.h
+++ b/include/asm-v850/irq.h
@@ -46,8 +46,6 @@ extern void
46init_irq_handlers (int base_irq, int num, int interval, 46init_irq_handlers (int base_irq, int num, int interval,
47 struct hw_interrupt_type *irq_type); 47 struct hw_interrupt_type *irq_type);
48 48
49typedef void (*irq_handler_t)(int irq, void *data, struct pt_regs *regs);
50
51/* Handle interrupt IRQ. REGS are the registers at the time of ther 49/* Handle interrupt IRQ. REGS are the registers at the time of ther
52 interrupt. */ 50 interrupt. */
53extern unsigned int handle_irq (int irq, struct pt_regs *regs); 51extern unsigned int handle_irq (int irq, struct pt_regs *regs);
diff --git a/include/asm-v850/unistd.h b/include/asm-v850/unistd.h
index 737401e7d3ad..2241ed45ecfe 100644
--- a/include/asm-v850/unistd.h
+++ b/include/asm-v850/unistd.h
@@ -204,168 +204,8 @@
204#define __NR_gettid 201 204#define __NR_gettid 201
205#define __NR_tkill 202 205#define __NR_tkill 202
206 206
207
208/* Syscall protocol:
209 Syscall number in r12, args in r6-r9, r13-r14
210 Return value in r10
211 Trap 0 for `short' syscalls, where all the args can fit in function
212 call argument registers, and trap 1 when there are additional args in
213 r13-r14. */
214
215#define SYSCALL_NUM "r12"
216#define SYSCALL_ARG0 "r6"
217#define SYSCALL_ARG1 "r7"
218#define SYSCALL_ARG2 "r8"
219#define SYSCALL_ARG3 "r9"
220#define SYSCALL_ARG4 "r13"
221#define SYSCALL_ARG5 "r14"
222#define SYSCALL_RET "r10"
223
224#define SYSCALL_SHORT_TRAP "0"
225#define SYSCALL_LONG_TRAP "1"
226
227/* Registers clobbered by any syscall. This _doesn't_ include the syscall
228 number (r12) or the `extended arg' registers (r13, r14), even though
229 they are actually clobbered too (this is because gcc's `asm' statement
230 doesn't allow a clobber to be used as an input or output). */
231#define SYSCALL_CLOBBERS "r1", "r5", "r11", "r15", "r16", \
232 "r17", "r18", "r19"
233
234/* Registers clobbered by a `short' syscall. This includes all clobbers
235 except the syscall number (r12). */
236#define SYSCALL_SHORT_CLOBBERS SYSCALL_CLOBBERS, "r13", "r14"
237
238#ifdef __KERNEL__ 207#ifdef __KERNEL__
239 208
240#include <asm/clinkage.h>
241#include <linux/err.h>
242
243#define __syscall_return(type, res) \
244 do { \
245 /* user-visible error numbers are in the range -1 - -MAX_ERRNO: \
246 see <asm-v850/errno.h> */ \
247 if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO), 0)) { \
248 errno = -(res); \
249 res = -1; \
250 } \
251 return (type) (res); \
252 } while (0)
253
254
255#define _syscall0(type, name) \
256type name (void) \
257{ \
258 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
259 register unsigned long __ret __asm__ (SYSCALL_RET); \
260 __asm__ __volatile__ ("trap " SYSCALL_SHORT_TRAP \
261 : "=r" (__ret), "=r" (__syscall) \
262 : "1" (__syscall) \
263 : SYSCALL_SHORT_CLOBBERS); \
264 __syscall_return (type, __ret); \
265}
266
267#define _syscall1(type, name, atype, a) \
268type name (atype a) \
269{ \
270 register atype __a __asm__ (SYSCALL_ARG0) = a; \
271 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
272 register unsigned long __ret __asm__ (SYSCALL_RET); \
273 __asm__ __volatile__ ("trap " SYSCALL_SHORT_TRAP \
274 : "=r" (__ret), "=r" (__syscall) \
275 : "1" (__syscall), "r" (__a) \
276 : SYSCALL_SHORT_CLOBBERS); \
277 __syscall_return (type, __ret); \
278}
279
280#define _syscall2(type, name, atype, a, btype, b) \
281type name (atype a, btype b) \
282{ \
283 register atype __a __asm__ (SYSCALL_ARG0) = a; \
284 register btype __b __asm__ (SYSCALL_ARG1) = b; \
285 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
286 register unsigned long __ret __asm__ (SYSCALL_RET); \
287 __asm__ __volatile__ ("trap " SYSCALL_SHORT_TRAP \
288 : "=r" (__ret), "=r" (__syscall) \
289 : "1" (__syscall), "r" (__a), "r" (__b) \
290 : SYSCALL_SHORT_CLOBBERS); \
291 __syscall_return (type, __ret); \
292}
293
294#define _syscall3(type, name, atype, a, btype, b, ctype, c) \
295type name (atype a, btype b, ctype c) \
296{ \
297 register atype __a __asm__ (SYSCALL_ARG0) = a; \
298 register btype __b __asm__ (SYSCALL_ARG1) = b; \
299 register ctype __c __asm__ (SYSCALL_ARG2) = c; \
300 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
301 register unsigned long __ret __asm__ (SYSCALL_RET); \
302 __asm__ __volatile__ ("trap " SYSCALL_SHORT_TRAP \
303 : "=r" (__ret), "=r" (__syscall) \
304 : "1" (__syscall), "r" (__a), "r" (__b), "r" (__c) \
305 : SYSCALL_SHORT_CLOBBERS); \
306 __syscall_return (type, __ret); \
307}
308
309#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \
310type name (atype a, btype b, ctype c, dtype d) \
311{ \
312 register atype __a __asm__ (SYSCALL_ARG0) = a; \
313 register btype __b __asm__ (SYSCALL_ARG1) = b; \
314 register ctype __c __asm__ (SYSCALL_ARG2) = c; \
315 register dtype __d __asm__ (SYSCALL_ARG3) = d; \
316 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
317 register unsigned long __ret __asm__ (SYSCALL_RET); \
318 __asm__ __volatile__ ("trap " SYSCALL_SHORT_TRAP \
319 : "=r" (__ret), "=r" (__syscall) \
320 : "1" (__syscall), \
321 "r" (__a), "r" (__b), "r" (__c), "r" (__d) \
322 : SYSCALL_SHORT_CLOBBERS); \
323 __syscall_return (type, __ret); \
324}
325
326#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype,e)\
327type name (atype a, btype b, ctype c, dtype d, etype e) \
328{ \
329 register atype __a __asm__ (SYSCALL_ARG0) = a; \
330 register btype __b __asm__ (SYSCALL_ARG1) = b; \
331 register ctype __c __asm__ (SYSCALL_ARG2) = c; \
332 register dtype __d __asm__ (SYSCALL_ARG3) = d; \
333 register etype __e __asm__ (SYSCALL_ARG4) = e; \
334 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
335 register unsigned long __ret __asm__ (SYSCALL_RET); \
336 __asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP \
337 : "=r" (__ret), "=r" (__syscall), "=r" (__e) \
338 : "1" (__syscall), \
339 "r" (__a), "r" (__b), "r" (__c), "r" (__d), "2" (__e) \
340 : SYSCALL_CLOBBERS); \
341 __syscall_return (type, __ret); \
342}
343
344#define __SYSCALL6_TRAP(syscall, ret, a, b, c, d, e, f) \
345 __asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP \
346 : "=r" (ret), "=r" (syscall), \
347 "=r" (e), "=r" (f) \
348 : "1" (syscall), \
349 "r" (a), "r" (b), "r" (c), "r" (d), \
350 "2" (e), "3" (f) \
351 : SYSCALL_CLOBBERS);
352
353#define _syscall6(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e, ftype, f) \
354type name (atype a, btype b, ctype c, dtype d, etype e, ftype f) \
355{ \
356 register atype __a __asm__ (SYSCALL_ARG0) = a; \
357 register btype __b __asm__ (SYSCALL_ARG1) = b; \
358 register ctype __c __asm__ (SYSCALL_ARG2) = c; \
359 register dtype __d __asm__ (SYSCALL_ARG3) = d; \
360 register etype __e __asm__ (SYSCALL_ARG4) = e; \
361 register etype __f __asm__ (SYSCALL_ARG5) = f; \
362 register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
363 register unsigned long __ret __asm__ (SYSCALL_RET); \
364 __SYSCALL6_TRAP(__syscall, __ret, __a, __b, __c, __d, __e, __f); \
365 __syscall_return (type, __ret); \
366}
367
368
369#define __ARCH_WANT_IPC_PARSE_VERSION 209#define __ARCH_WANT_IPC_PARSE_VERSION
370#define __ARCH_WANT_OLD_READDIR 210#define __ARCH_WANT_OLD_READDIR
371#define __ARCH_WANT_STAT64 211#define __ARCH_WANT_STAT64
diff --git a/include/asm-x86_64/Kbuild b/include/asm-x86_64/Kbuild
index 1ee9b07f3fe6..ebd7117782a6 100644
--- a/include/asm-x86_64/Kbuild
+++ b/include/asm-x86_64/Kbuild
@@ -6,13 +6,11 @@ ALTARCHDEF := defined __i386__
6 6
7header-y += boot.h 7header-y += boot.h
8header-y += bootsetup.h 8header-y += bootsetup.h
9header-y += cpufeature.h
10header-y += debugreg.h 9header-y += debugreg.h
11header-y += ldt.h 10header-y += ldt.h
12header-y += msr.h 11header-y += msr.h
13header-y += prctl.h 12header-y += prctl.h
14header-y += ptrace-abi.h 13header-y += ptrace-abi.h
15header-y += setup.h
16header-y += sigcontext32.h 14header-y += sigcontext32.h
17header-y += ucontext.h 15header-y += ucontext.h
18header-y += vsyscall32.h 16header-y += vsyscall32.h
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h
index ed59aa4c6ff9..9d1916e59c04 100644
--- a/include/asm-x86_64/acpi.h
+++ b/include/asm-x86_64/acpi.h
@@ -163,6 +163,7 @@ extern u8 x86_acpiid_to_apicid[];
163#define ARCH_HAS_POWER_INIT 1 163#define ARCH_HAS_POWER_INIT 1
164 164
165extern int acpi_skip_timer_override; 165extern int acpi_skip_timer_override;
166extern int acpi_use_timer_override;
166 167
167#endif /*__KERNEL__*/ 168#endif /*__KERNEL__*/
168 169
diff --git a/include/asm-x86_64/alternative.h b/include/asm-x86_64/alternative.h
index a584826cc570..a6657b4f3e0e 100644
--- a/include/asm-x86_64/alternative.h
+++ b/include/asm-x86_64/alternative.h
@@ -4,6 +4,7 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/stddef.h>
7#include <asm/cpufeature.h> 8#include <asm/cpufeature.h>
8 9
9struct alt_instr { 10struct alt_instr {
@@ -133,4 +134,15 @@ static inline void alternatives_smp_switch(int smp) {}
133#define LOCK_PREFIX "" 134#define LOCK_PREFIX ""
134#endif 135#endif
135 136
137struct paravirt_patch;
138#ifdef CONFIG_PARAVIRT
139void apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end);
140#else
141static inline void
142apply_paravirt(struct paravirt_patch *start, struct paravirt_patch *end)
143{}
144#define __start_parainstructions NULL
145#define __stop_parainstructions NULL
146#endif
147
136#endif /* _X86_64_ALTERNATIVE_H */ 148#endif /* _X86_64_ALTERNATIVE_H */
diff --git a/include/asm-x86_64/atomic.h b/include/asm-x86_64/atomic.h
index 007e88d6d43f..706ca4b60000 100644
--- a/include/asm-x86_64/atomic.h
+++ b/include/asm-x86_64/atomic.h
@@ -21,7 +21,7 @@
21 * on us. We need to use _exactly_ the address the user gave us, 21 * on us. We need to use _exactly_ the address the user gave us,
22 * not some alias that contains the same information. 22 * not some alias that contains the same information.
23 */ 23 */
24typedef struct { volatile int counter; } atomic_t; 24typedef struct { int counter; } atomic_t;
25 25
26#define ATOMIC_INIT(i) { (i) } 26#define ATOMIC_INIT(i) { (i) }
27 27
@@ -189,9 +189,9 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
189{ 189{
190 int __i = i; 190 int __i = i;
191 __asm__ __volatile__( 191 __asm__ __volatile__(
192 LOCK_PREFIX "xaddl %0, %1;" 192 LOCK_PREFIX "xaddl %0, %1"
193 :"=r"(i) 193 :"+r" (i), "+m" (v->counter)
194 :"m"(v->counter), "0"(i)); 194 : : "memory");
195 return i + __i; 195 return i + __i;
196} 196}
197 197
diff --git a/include/asm-x86_64/calgary.h b/include/asm-x86_64/calgary.h
index 6b93f5a3a5c8..7ee900645719 100644
--- a/include/asm-x86_64/calgary.h
+++ b/include/asm-x86_64/calgary.h
@@ -51,6 +51,8 @@ struct iommu_table {
51#define TCE_TABLE_SIZE_4M 6 51#define TCE_TABLE_SIZE_4M 6
52#define TCE_TABLE_SIZE_8M 7 52#define TCE_TABLE_SIZE_8M 7
53 53
54extern int use_calgary;
55
54#ifdef CONFIG_CALGARY_IOMMU 56#ifdef CONFIG_CALGARY_IOMMU
55extern int calgary_iommu_init(void); 57extern int calgary_iommu_init(void);
56extern void detect_calgary(void); 58extern void detect_calgary(void);
diff --git a/include/asm-x86_64/checksum.h b/include/asm-x86_64/checksum.h
index 989469e8e0b7..419fe88a0342 100644
--- a/include/asm-x86_64/checksum.h
+++ b/include/asm-x86_64/checksum.h
@@ -19,15 +19,16 @@
19 * the last step before putting a checksum into a packet. 19 * the last step before putting a checksum into a packet.
20 * Make sure not to mix with 64bit checksums. 20 * Make sure not to mix with 64bit checksums.
21 */ 21 */
22static inline unsigned int csum_fold(unsigned int sum) 22static inline __sum16 csum_fold(__wsum sum)
23{ 23{
24 __asm__( 24 __asm__(
25 " addl %1,%0\n" 25 " addl %1,%0\n"
26 " adcl $0xffff,%0" 26 " adcl $0xffff,%0"
27 : "=r" (sum) 27 : "=r" (sum)
28 : "r" (sum << 16), "0" (sum & 0xffff0000) 28 : "r" ((__force u32)sum << 16),
29 "0" ((__force u32)sum & 0xffff0000)
29 ); 30 );
30 return (~sum) >> 16; 31 return (__force __sum16)(~(__force u32)sum >> 16);
31} 32}
32 33
33/* 34/*
@@ -43,7 +44,7 @@ static inline unsigned int csum_fold(unsigned int sum)
43 * iph: ipv4 header 44 * iph: ipv4 header
44 * ihl: length of header / 4 45 * ihl: length of header / 4
45 */ 46 */
46static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) 47static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
47{ 48{
48 unsigned int sum; 49 unsigned int sum;
49 50
@@ -70,7 +71,7 @@ static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
70 : "=r" (sum), "=r" (iph), "=r" (ihl) 71 : "=r" (sum), "=r" (iph), "=r" (ihl)
71 : "1" (iph), "2" (ihl) 72 : "1" (iph), "2" (ihl)
72 : "memory"); 73 : "memory");
73 return(sum); 74 return (__force __sum16)sum;
74} 75}
75 76
76/** 77/**
@@ -84,16 +85,17 @@ static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
84 * Returns the pseudo header checksum the input data. Result is 85 * Returns the pseudo header checksum the input data. Result is
85 * 32bit unfolded. 86 * 32bit unfolded.
86 */ 87 */
87static inline unsigned long 88static inline __wsum
88csum_tcpudp_nofold(unsigned saddr, unsigned daddr, unsigned short len, 89csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
89 unsigned short proto, unsigned int sum) 90 unsigned short proto, __wsum sum)
90{ 91{
91 asm(" addl %1, %0\n" 92 asm(" addl %1, %0\n"
92 " adcl %2, %0\n" 93 " adcl %2, %0\n"
93 " adcl %3, %0\n" 94 " adcl %3, %0\n"
94 " adcl $0, %0\n" 95 " adcl $0, %0\n"
95 : "=r" (sum) 96 : "=r" (sum)
96 : "g" (daddr), "g" (saddr), "g" ((ntohs(len)<<16)+proto*256), "0" (sum)); 97 : "g" (daddr), "g" (saddr),
98 "g" ((len + proto)<<8), "0" (sum));
97 return sum; 99 return sum;
98} 100}
99 101
@@ -109,9 +111,9 @@ csum_tcpudp_nofold(unsigned saddr, unsigned daddr, unsigned short len,
109 * Returns the 16bit pseudo header checksum the input data already 111 * Returns the 16bit pseudo header checksum the input data already
110 * complemented and ready to be filled in. 112 * complemented and ready to be filled in.
111 */ 113 */
112static inline unsigned short int 114static inline __sum16
113csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, 115csum_tcpudp_magic(__be32 saddr, __be32 daddr,
114 unsigned short len, unsigned short proto, unsigned int sum) 116 unsigned short len, unsigned short proto, __wsum sum)
115{ 117{
116 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 118 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
117} 119}
@@ -126,25 +128,25 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr,
126 * Before filling it in it needs to be csum_fold()'ed. 128 * Before filling it in it needs to be csum_fold()'ed.
127 * buff should be aligned to a 64bit boundary if possible. 129 * buff should be aligned to a 64bit boundary if possible.
128 */ 130 */
129extern unsigned int csum_partial(const unsigned char *buff, unsigned len, unsigned int sum); 131extern __wsum csum_partial(const void *buff, int len, __wsum sum);
130 132
131#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 1 133#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 1
132#define HAVE_CSUM_COPY_USER 1 134#define HAVE_CSUM_COPY_USER 1
133 135
134 136
135/* Do not call this directly. Use the wrappers below */ 137/* Do not call this directly. Use the wrappers below */
136extern unsigned long csum_partial_copy_generic(const unsigned char *src, const unsigned char *dst, 138extern __wsum csum_partial_copy_generic(const void *src, const void *dst,
137 unsigned len, 139 int len,
138 unsigned sum, 140 __wsum sum,
139 int *src_err_ptr, int *dst_err_ptr); 141 int *src_err_ptr, int *dst_err_ptr);
140 142
141 143
142extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, 144extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
143 int len, unsigned int isum, int *errp); 145 int len, __wsum isum, int *errp);
144extern unsigned int csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, 146extern __wsum csum_partial_copy_to_user(const void *src, void __user *dst,
145 int len, unsigned int isum, int *errp); 147 int len, __wsum isum, int *errp);
146extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst, int len, 148extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, int len,
147 unsigned int sum); 149 __wsum sum);
148 150
149/* Old names. To be removed. */ 151/* Old names. To be removed. */
150#define csum_and_copy_to_user csum_partial_copy_to_user 152#define csum_and_copy_to_user csum_partial_copy_to_user
@@ -158,7 +160,7 @@ extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned
158 * Returns the 16bit folded/inverted checksum of the passed buffer. 160 * Returns the 16bit folded/inverted checksum of the passed buffer.
159 * Ready to fill in. 161 * Ready to fill in.
160 */ 162 */
161extern unsigned short ip_compute_csum(unsigned char * buff, int len); 163extern __sum16 ip_compute_csum(const void *buff, int len);
162 164
163/** 165/**
164 * csum_ipv6_magic - Compute checksum of an IPv6 pseudo header. 166 * csum_ipv6_magic - Compute checksum of an IPv6 pseudo header.
@@ -176,9 +178,9 @@ extern unsigned short ip_compute_csum(unsigned char * buff, int len);
176struct in6_addr; 178struct in6_addr;
177 179
178#define _HAVE_ARCH_IPV6_CSUM 1 180#define _HAVE_ARCH_IPV6_CSUM 1
179extern unsigned short 181extern __sum16
180csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, 182csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
181 __u32 len, unsigned short proto, unsigned int sum); 183 __u32 len, unsigned short proto, __wsum sum);
182 184
183static inline unsigned add32_with_carry(unsigned a, unsigned b) 185static inline unsigned add32_with_carry(unsigned a, unsigned b)
184{ 186{
diff --git a/include/asm-x86_64/cpufeature.h b/include/asm-x86_64/cpufeature.h
index ee792faaca01..0b3c686139f1 100644
--- a/include/asm-x86_64/cpufeature.h
+++ b/include/asm-x86_64/cpufeature.h
@@ -29,7 +29,7 @@
29#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */ 29#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */
30#define X86_FEATURE_PN (0*32+18) /* Processor serial number */ 30#define X86_FEATURE_PN (0*32+18) /* Processor serial number */
31#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */ 31#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */
32#define X86_FEATURE_DTES (0*32+21) /* Debug Trace Store */ 32#define X86_FEATURE_DS (0*32+21) /* Debug Store */
33#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */ 33#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */
34#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */ 34#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */
35#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */ 35#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */
@@ -68,6 +68,8 @@
68#define X86_FEATURE_FXSAVE_LEAK (3*32+7) /* FIP/FOP/FDP leaks through FXSAVE */ 68#define X86_FEATURE_FXSAVE_LEAK (3*32+7) /* FIP/FOP/FDP leaks through FXSAVE */
69#define X86_FEATURE_UP (3*32+8) /* SMP kernel running on UP */ 69#define X86_FEATURE_UP (3*32+8) /* SMP kernel running on UP */
70#define X86_FEATURE_ARCH_PERFMON (3*32+9) /* Intel Architectural PerfMon */ 70#define X86_FEATURE_ARCH_PERFMON (3*32+9) /* Intel Architectural PerfMon */
71#define X86_FEATURE_PEBS (3*32+10) /* Precise-Event Based Sampling */
72#define X86_FEATURE_BTS (3*32+11) /* Branch Trace Store */
71 73
72/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 74/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
73#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 75#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
@@ -112,5 +114,8 @@
112#define cpu_has_cyrix_arr 0 114#define cpu_has_cyrix_arr 0
113#define cpu_has_centaur_mcr 0 115#define cpu_has_centaur_mcr 0
114#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH) 116#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
117#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS)
118#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
119#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
115 120
116#endif /* __ASM_X8664_CPUFEATURE_H */ 121#endif /* __ASM_X8664_CPUFEATURE_H */
diff --git a/include/asm-x86_64/delay.h b/include/asm-x86_64/delay.h
index 65f64acc5319..c2669f1f5529 100644
--- a/include/asm-x86_64/delay.h
+++ b/include/asm-x86_64/delay.h
@@ -7,18 +7,21 @@
7 * Delay routines calling functions in arch/x86_64/lib/delay.c 7 * Delay routines calling functions in arch/x86_64/lib/delay.c
8 */ 8 */
9 9
10/* Undefined functions to get compile-time errors */
10extern void __bad_udelay(void); 11extern void __bad_udelay(void);
11extern void __bad_ndelay(void); 12extern void __bad_ndelay(void);
12 13
13extern void __udelay(unsigned long usecs); 14extern void __udelay(unsigned long usecs);
14extern void __ndelay(unsigned long usecs); 15extern void __ndelay(unsigned long nsecs);
15extern void __const_udelay(unsigned long usecs); 16extern void __const_udelay(unsigned long usecs);
16extern void __delay(unsigned long loops); 17extern void __delay(unsigned long loops);
17 18
19/* 0x10c7 is 2**32 / 1000000 (rounded up) */
18#define udelay(n) (__builtin_constant_p(n) ? \ 20#define udelay(n) (__builtin_constant_p(n) ? \
19 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \ 21 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \
20 __udelay(n)) 22 __udelay(n))
21 23
24/* 0x5 is 2**32 / 1000000000 (rounded up) */
22#define ndelay(n) (__builtin_constant_p(n) ? \ 25#define ndelay(n) (__builtin_constant_p(n) ? \
23 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ 26 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
24 __ndelay(n)) 27 __ndelay(n))
diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h
index eb7723a46790..913d6ac00033 100644
--- a/include/asm-x86_64/desc.h
+++ b/include/asm-x86_64/desc.h
@@ -9,64 +9,13 @@
9 9
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/smp.h> 11#include <linux/smp.h>
12#include <asm/desc_defs.h>
12 13
13#include <asm/segment.h> 14#include <asm/segment.h>
14#include <asm/mmu.h> 15#include <asm/mmu.h>
15 16
16// 8 byte segment descriptor
17struct desc_struct {
18 u16 limit0;
19 u16 base0;
20 unsigned base1 : 8, type : 4, s : 1, dpl : 2, p : 1;
21 unsigned limit : 4, avl : 1, l : 1, d : 1, g : 1, base2 : 8;
22} __attribute__((packed));
23
24struct n_desc_struct {
25 unsigned int a,b;
26};
27
28extern struct desc_struct cpu_gdt_table[GDT_ENTRIES]; 17extern struct desc_struct cpu_gdt_table[GDT_ENTRIES];
29 18
30enum {
31 GATE_INTERRUPT = 0xE,
32 GATE_TRAP = 0xF,
33 GATE_CALL = 0xC,
34};
35
36// 16byte gate
37struct gate_struct {
38 u16 offset_low;
39 u16 segment;
40 unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1;
41 u16 offset_middle;
42 u32 offset_high;
43 u32 zero1;
44} __attribute__((packed));
45
46#define PTR_LOW(x) ((unsigned long)(x) & 0xFFFF)
47#define PTR_MIDDLE(x) (((unsigned long)(x) >> 16) & 0xFFFF)
48#define PTR_HIGH(x) ((unsigned long)(x) >> 32)
49
50enum {
51 DESC_TSS = 0x9,
52 DESC_LDT = 0x2,
53};
54
55// LDT or TSS descriptor in the GDT. 16 bytes.
56struct ldttss_desc {
57 u16 limit0;
58 u16 base0;
59 unsigned base1 : 8, type : 5, dpl : 2, p : 1;
60 unsigned limit1 : 4, zero0 : 3, g : 1, base2 : 8;
61 u32 base3;
62 u32 zero1;
63} __attribute__((packed));
64
65struct desc_ptr {
66 unsigned short size;
67 unsigned long address;
68} __attribute__((packed)) ;
69
70#define load_TR_desc() asm volatile("ltr %w0"::"r" (GDT_ENTRY_TSS*8)) 19#define load_TR_desc() asm volatile("ltr %w0"::"r" (GDT_ENTRY_TSS*8))
71#define load_LDT_desc() asm volatile("lldt %w0"::"r" (GDT_ENTRY_LDT*8)) 20#define load_LDT_desc() asm volatile("lldt %w0"::"r" (GDT_ENTRY_LDT*8))
72#define clear_LDT() asm volatile("lldt %w0"::"r" (0)) 21#define clear_LDT() asm volatile("lldt %w0"::"r" (0))
diff --git a/include/asm-x86_64/desc_defs.h b/include/asm-x86_64/desc_defs.h
new file mode 100644
index 000000000000..089004070099
--- /dev/null
+++ b/include/asm-x86_64/desc_defs.h
@@ -0,0 +1,69 @@
1/* Written 2000 by Andi Kleen */
2#ifndef __ARCH_DESC_DEFS_H
3#define __ARCH_DESC_DEFS_H
4
5/*
6 * Segment descriptor structure definitions, usable from both x86_64 and i386
7 * archs.
8 */
9
10#ifndef __ASSEMBLY__
11
12#include <linux/types.h>
13
14// 8 byte segment descriptor
15struct desc_struct {
16 u16 limit0;
17 u16 base0;
18 unsigned base1 : 8, type : 4, s : 1, dpl : 2, p : 1;
19 unsigned limit : 4, avl : 1, l : 1, d : 1, g : 1, base2 : 8;
20} __attribute__((packed));
21
22struct n_desc_struct {
23 unsigned int a,b;
24};
25
26enum {
27 GATE_INTERRUPT = 0xE,
28 GATE_TRAP = 0xF,
29 GATE_CALL = 0xC,
30};
31
32// 16byte gate
33struct gate_struct {
34 u16 offset_low;
35 u16 segment;
36 unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1;
37 u16 offset_middle;
38 u32 offset_high;
39 u32 zero1;
40} __attribute__((packed));
41
42#define PTR_LOW(x) ((unsigned long)(x) & 0xFFFF)
43#define PTR_MIDDLE(x) (((unsigned long)(x) >> 16) & 0xFFFF)
44#define PTR_HIGH(x) ((unsigned long)(x) >> 32)
45
46enum {
47 DESC_TSS = 0x9,
48 DESC_LDT = 0x2,
49};
50
51// LDT or TSS descriptor in the GDT. 16 bytes.
52struct ldttss_desc {
53 u16 limit0;
54 u16 base0;
55 unsigned base1 : 8, type : 5, dpl : 2, p : 1;
56 unsigned limit1 : 4, zero0 : 3, g : 1, base2 : 8;
57 u32 base3;
58 u32 zero1;
59} __attribute__((packed));
60
61struct desc_ptr {
62 unsigned short size;
63 unsigned long address;
64} __attribute__((packed)) ;
65
66
67#endif /* !__ASSEMBLY__ */
68
69#endif
diff --git a/include/asm-x86_64/device.h b/include/asm-x86_64/device.h
new file mode 100644
index 000000000000..3afa03f33a36
--- /dev/null
+++ b/include/asm-x86_64/device.h
@@ -0,0 +1,15 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#ifndef _ASM_X86_64_DEVICE_H
7#define _ASM_X86_64_DEVICE_H
8
9struct dev_archdata {
10#ifdef CONFIG_ACPI
11 void *acpi_handle;
12#endif
13};
14
15#endif /* _ASM_X86_64_DEVICE_H */
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index 10174b110a5c..be9ec6890723 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -180,12 +180,13 @@ static inline int dma_get_cache_alignment(void)
180 return boot_cpu_data.x86_clflush_size; 180 return boot_cpu_data.x86_clflush_size;
181} 181}
182 182
183#define dma_is_consistent(h) 1 183#define dma_is_consistent(d, h) 1
184 184
185extern int dma_set_mask(struct device *dev, u64 mask); 185extern int dma_set_mask(struct device *dev, u64 mask);
186 186
187static inline void 187static inline void
188dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction dir) 188dma_cache_sync(struct device *dev, void *vaddr, size_t size,
189 enum dma_data_direction dir)
189{ 190{
190 flush_write_buffers(); 191 flush_write_buffers();
191} 192}
diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h
index a406fcb1e924..6d24ea7c4d9d 100644
--- a/include/asm-x86_64/elf.h
+++ b/include/asm-x86_64/elf.h
@@ -45,7 +45,6 @@ typedef struct user_i387_struct elf_fpregset_t;
45 45
46#ifdef __KERNEL__ 46#ifdef __KERNEL__
47#include <asm/processor.h> 47#include <asm/processor.h>
48#include <asm/compat.h>
49 48
50/* 49/*
51 * This is used to ensure we don't load something for the wrong architecture. 50 * This is used to ensure we don't load something for the wrong architecture.
diff --git a/include/asm-x86_64/futex.h b/include/asm-x86_64/futex.h
index 9804bf07b092..5cdfb08013c3 100644
--- a/include/asm-x86_64/futex.h
+++ b/include/asm-x86_64/futex.h
@@ -55,7 +55,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
55 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 55 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
56 return -EFAULT; 56 return -EFAULT;
57 57
58 inc_preempt_count(); 58 pagefault_disable();
59 59
60 switch (op) { 60 switch (op) {
61 case FUTEX_OP_SET: 61 case FUTEX_OP_SET:
@@ -78,7 +78,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
78 ret = -ENOSYS; 78 ret = -ENOSYS;
79 } 79 }
80 80
81 dec_preempt_count(); 81 pagefault_enable();
82 82
83 if (!ret) { 83 if (!ret) {
84 switch (cmp) { 84 switch (cmp) {
diff --git a/include/asm-x86_64/genapic.h b/include/asm-x86_64/genapic.h
index a0e9a4b93484..b80f4bb5f273 100644
--- a/include/asm-x86_64/genapic.h
+++ b/include/asm-x86_64/genapic.h
@@ -30,6 +30,6 @@ struct genapic {
30}; 30};
31 31
32 32
33extern struct genapic *genapic; 33extern struct genapic *genapic, *genapic_force, apic_flat;
34 34
35#endif 35#endif
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h
index 171ec2dc8c04..561ecbfd4cb5 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -12,10 +12,6 @@
12 12
13#define APIC_MISMATCH_DEBUG 13#define APIC_MISMATCH_DEBUG
14 14
15#define IO_APIC_BASE(idx) \
16 ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \
17 + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK)))
18
19/* 15/*
20 * The structure of the IO-APIC: 16 * The structure of the IO-APIC:
21 */ 17 */
@@ -119,36 +115,6 @@ extern struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
119/* non-0 if default (table-less) MP configuration */ 115/* non-0 if default (table-less) MP configuration */
120extern int mpc_default_type; 116extern int mpc_default_type;
121 117
122static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
123{
124 *IO_APIC_BASE(apic) = reg;
125 return *(IO_APIC_BASE(apic)+4);
126}
127
128static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
129{
130 *IO_APIC_BASE(apic) = reg;
131 *(IO_APIC_BASE(apic)+4) = value;
132}
133
134/*
135 * Re-write a value: to be used for read-modify-write
136 * cycles where the read already set up the index register.
137 */
138static inline void io_apic_modify(unsigned int apic, unsigned int value)
139{
140 *(IO_APIC_BASE(apic)+4) = value;
141}
142
143/*
144 * Synchronize the IO-APIC and the CPU by doing
145 * a dummy read from the IO-APIC
146 */
147static inline void io_apic_sync(unsigned int apic)
148{
149 (void) *(IO_APIC_BASE(apic)+4);
150}
151
152/* 1 if "noapic" boot option passed */ 118/* 1 if "noapic" boot option passed */
153extern int skip_ioapic_setup; 119extern int skip_ioapic_setup;
154 120
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h
index 37e194169fac..952783d35c7b 100644
--- a/include/asm-x86_64/msr.h
+++ b/include/asm-x86_64/msr.h
@@ -169,8 +169,8 @@ static inline unsigned int cpuid_edx(unsigned int op)
169#define MSR_LSTAR 0xc0000082 /* long mode SYSCALL target */ 169#define MSR_LSTAR 0xc0000082 /* long mode SYSCALL target */
170#define MSR_CSTAR 0xc0000083 /* compatibility mode SYSCALL target */ 170#define MSR_CSTAR 0xc0000083 /* compatibility mode SYSCALL target */
171#define MSR_SYSCALL_MASK 0xc0000084 /* EFLAGS mask for syscall */ 171#define MSR_SYSCALL_MASK 0xc0000084 /* EFLAGS mask for syscall */
172#define MSR_FS_BASE 0xc0000100 /* 64bit GS base */ 172#define MSR_FS_BASE 0xc0000100 /* 64bit FS base */
173#define MSR_GS_BASE 0xc0000101 /* 64bit FS base */ 173#define MSR_GS_BASE 0xc0000101 /* 64bit GS base */
174#define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow (or USER_GS from kernel) */ 174#define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow (or USER_GS from kernel) */
175/* EFER bits: */ 175/* EFER bits: */
176#define _EFER_SCE 0 /* SYSCALL/SYSRET */ 176#define _EFER_SCE 0 /* SYSCALL/SYSRET */
@@ -210,6 +210,10 @@ static inline unsigned int cpuid_edx(unsigned int op)
210#define MSR_IA32_LASTINTFROMIP 0x1dd 210#define MSR_IA32_LASTINTFROMIP 0x1dd
211#define MSR_IA32_LASTINTTOIP 0x1de 211#define MSR_IA32_LASTINTTOIP 0x1de
212 212
213#define MSR_IA32_PEBS_ENABLE 0x3f1
214#define MSR_IA32_DS_AREA 0x600
215#define MSR_IA32_PERF_CAPABILITIES 0x345
216
213#define MSR_MTRRfix64K_00000 0x250 217#define MSR_MTRRfix64K_00000 0x250
214#define MSR_MTRRfix16K_80000 0x258 218#define MSR_MTRRfix16K_80000 0x258
215#define MSR_MTRRfix16K_A0000 0x259 219#define MSR_MTRRfix16K_A0000 0x259
@@ -407,4 +411,13 @@ static inline unsigned int cpuid_edx(unsigned int op)
407#define MSR_P4_U2L_ESCR0 0x3b0 411#define MSR_P4_U2L_ESCR0 0x3b0
408#define MSR_P4_U2L_ESCR1 0x3b1 412#define MSR_P4_U2L_ESCR1 0x3b1
409 413
414/* Intel Core-based CPU performance counters */
415#define MSR_CORE_PERF_FIXED_CTR0 0x309
416#define MSR_CORE_PERF_FIXED_CTR1 0x30a
417#define MSR_CORE_PERF_FIXED_CTR2 0x30b
418#define MSR_CORE_PERF_FIXED_CTR_CTRL 0x38d
419#define MSR_CORE_PERF_GLOBAL_STATUS 0x38e
420#define MSR_CORE_PERF_GLOBAL_CTRL 0x38f
421#define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x390
422
410#endif 423#endif
diff --git a/include/asm-x86_64/nmi.h b/include/asm-x86_64/nmi.h
index f367d4014b42..72375e7d32a8 100644
--- a/include/asm-x86_64/nmi.h
+++ b/include/asm-x86_64/nmi.h
@@ -77,4 +77,7 @@ extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
77 77
78extern int unknown_nmi_panic; 78extern int unknown_nmi_panic;
79 79
80void __trigger_all_cpu_backtrace(void);
81#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
82
80#endif /* ASM_NMI_H */ 83#endif /* ASM_NMI_H */
diff --git a/include/asm-x86_64/pci-direct.h b/include/asm-x86_64/pci-direct.h
index eba9cb471df3..6823fa4f1afa 100644
--- a/include/asm-x86_64/pci-direct.h
+++ b/include/asm-x86_64/pci-direct.h
@@ -10,6 +10,7 @@ extern u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset);
10extern u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset); 10extern u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset);
11extern u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset); 11extern u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset);
12extern void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, u32 val); 12extern void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, u32 val);
13extern void write_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset, u8 val);
13 14
14extern int early_pci_allowed(void); 15extern int early_pci_allowed(void);
15 16
diff --git a/include/asm-x86_64/pda.h b/include/asm-x86_64/pda.h
index 14996d962bac..5642634843c4 100644
--- a/include/asm-x86_64/pda.h
+++ b/include/asm-x86_64/pda.h
@@ -109,6 +109,15 @@ extern struct x8664_pda _proxy_pda;
109#define sub_pda(field,val) pda_to_op("sub",field,val) 109#define sub_pda(field,val) pda_to_op("sub",field,val)
110#define or_pda(field,val) pda_to_op("or",field,val) 110#define or_pda(field,val) pda_to_op("or",field,val)
111 111
112/* This is not atomic against other CPUs -- CPU preemption needs to be off */
113#define test_and_clear_bit_pda(bit,field) ({ \
114 int old__; \
115 asm volatile("btr %2,%%gs:%c3\n\tsbbl %0,%0" \
116 : "=r" (old__), "+m" (_proxy_pda.field) \
117 : "dIr" (bit), "i" (pda_offset(field)) : "memory"); \
118 old__; \
119})
120
112#endif 121#endif
113 122
114#define PDA_STACKOFFSET (5*8) 123#define PDA_STACKOFFSET (5*8)
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 0555c1c4d8fa..59901c690a0d 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -221,20 +221,19 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
221#define __S110 PAGE_SHARED_EXEC 221#define __S110 PAGE_SHARED_EXEC
222#define __S111 PAGE_SHARED_EXEC 222#define __S111 PAGE_SHARED_EXEC
223 223
224static inline unsigned long pgd_bad(pgd_t pgd) 224static inline unsigned long pgd_bad(pgd_t pgd)
225{ 225{
226 unsigned long val = pgd_val(pgd); 226 return pgd_val(pgd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER);
227 val &= ~PTE_MASK; 227}
228 val &= ~(_PAGE_USER | _PAGE_DIRTY);
229 return val & ~(_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED);
230}
231 228
232static inline unsigned long pud_bad(pud_t pud) 229static inline unsigned long pud_bad(pud_t pud)
233{ 230{
234 unsigned long val = pud_val(pud); 231 return pud_val(pud) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER);
235 val &= ~PTE_MASK; 232}
236 val &= ~(_PAGE_USER | _PAGE_DIRTY); 233
237 return val & ~(_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED); 234static inline unsigned long pmd_bad(pmd_t pmd)
235{
236 return pmd_val(pmd) & ~(PTE_MASK | _KERNPG_TABLE | _PAGE_USER);
238} 237}
239 238
240#define pte_none(x) (!pte_val(x)) 239#define pte_none(x) (!pte_val(x))
@@ -347,7 +346,6 @@ static inline int pmd_large(pmd_t pte) {
347#define pmd_none(x) (!pmd_val(x)) 346#define pmd_none(x) (!pmd_val(x))
348#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) 347#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
349#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) 348#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
350#define pmd_bad(x) ((pmd_val(x) & (~PTE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE )
351#define pfn_pmd(nr,prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val(prot))) 349#define pfn_pmd(nr,prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val(prot)))
352#define pmd_pfn(x) ((pmd_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT) 350#define pmd_pfn(x) ((pmd_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT)
353 351
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index cef17e0f828c..76552d72804c 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -475,6 +475,14 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
475 : :"a" (eax), "c" (ecx)); 475 : :"a" (eax), "c" (ecx));
476} 476}
477 477
478static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
479{
480 /* "mwait %eax,%ecx;" */
481 asm volatile(
482 "sti; .byte 0x0f,0x01,0xc9;"
483 : :"a" (eax), "c" (ecx));
484}
485
478extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); 486extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
479 487
480#define stack_current() \ 488#define stack_current() \
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index e72cfcdf5344..6d324b838972 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -61,7 +61,6 @@ extern void numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn);
61extern unsigned long numa_free_all_bootmem(void); 61extern unsigned long numa_free_all_bootmem(void);
62 62
63extern void reserve_bootmem_generic(unsigned long phys, unsigned len); 63extern void reserve_bootmem_generic(unsigned long phys, unsigned len);
64extern void free_bootmem_generic(unsigned long phys, unsigned len);
65 64
66extern void load_gs_index(unsigned gs); 65extern void load_gs_index(unsigned gs);
67 66
@@ -88,6 +87,7 @@ extern void syscall32_cpu_init(void);
88extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); 87extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end);
89 88
90extern void early_quirks(void); 89extern void early_quirks(void);
90extern void quirk_intel_irqbalance(void);
91extern void check_efer(void); 91extern void check_efer(void);
92 92
93extern int unhandled_signal(struct task_struct *tsk, int sig); 93extern int unhandled_signal(struct task_struct *tsk, int sig);
diff --git a/include/asm-x86_64/rio.h b/include/asm-x86_64/rio.h
new file mode 100644
index 000000000000..c7350f6d2015
--- /dev/null
+++ b/include/asm-x86_64/rio.h
@@ -0,0 +1,74 @@
1/*
2 * Derived from include/asm-i386/mach-summit/mach_mpparse.h
3 * and include/asm-i386/mach-default/bios_ebda.h
4 *
5 * Author: Laurent Vivier <Laurent.Vivier@bull.net>
6 */
7
8#ifndef __ASM_RIO_H
9#define __ASM_RIO_H
10
11#define RIO_TABLE_VERSION 3
12
13struct rio_table_hdr {
14 u8 version; /* Version number of this data structure */
15 u8 num_scal_dev; /* # of Scalability devices */
16 u8 num_rio_dev; /* # of RIO I/O devices */
17} __attribute__((packed));
18
19struct scal_detail {
20 u8 node_id; /* Scalability Node ID */
21 u32 CBAR; /* Address of 1MB register space */
22 u8 port0node; /* Node ID port connected to: 0xFF=None */
23 u8 port0port; /* Port num port connected to: 0,1,2, or */
24 /* 0xFF=None */
25 u8 port1node; /* Node ID port connected to: 0xFF = None */
26 u8 port1port; /* Port num port connected to: 0,1,2, or */
27 /* 0xFF=None */
28 u8 port2node; /* Node ID port connected to: 0xFF = None */
29 u8 port2port; /* Port num port connected to: 0,1,2, or */
30 /* 0xFF=None */
31 u8 chassis_num; /* 1 based Chassis number (1 = boot node) */
32} __attribute__((packed));
33
34struct rio_detail {
35 u8 node_id; /* RIO Node ID */
36 u32 BBAR; /* Address of 1MB register space */
37 u8 type; /* Type of device */
38 u8 owner_id; /* Node ID of Hurricane that owns this */
39 /* node */
40 u8 port0node; /* Node ID port connected to: 0xFF=None */
41 u8 port0port; /* Port num port connected to: 0,1,2, or */
42 /* 0xFF=None */
43 u8 port1node; /* Node ID port connected to: 0xFF=None */
44 u8 port1port; /* Port num port connected to: 0,1,2, or */
45 /* 0xFF=None */
46 u8 first_slot; /* Lowest slot number below this Calgary */
47 u8 status; /* Bit 0 = 1 : the XAPIC is used */
48 /* = 0 : the XAPIC is not used, ie: */
49 /* ints fwded to another XAPIC */
50 /* Bits1:7 Reserved */
51 u8 WP_index; /* instance index - lower ones have */
52 /* lower slot numbers/PCI bus numbers */
53 u8 chassis_num; /* 1 based Chassis number */
54} __attribute__((packed));
55
56enum {
57 HURR_SCALABILTY = 0, /* Hurricane Scalability info */
58 HURR_RIOIB = 2, /* Hurricane RIOIB info */
59 COMPAT_CALGARY = 4, /* Compatibility Calgary */
60 ALT_CALGARY = 5, /* Second Planar Calgary */
61};
62
63/*
64 * there is a real-mode segmented pointer pointing to the
65 * 4K EBDA area at 0x40E.
66 */
67static inline unsigned long get_bios_ebda(void)
68{
69 unsigned long address = *(unsigned short *)phys_to_virt(0x40EUL);
70 address <<= 4;
71 return address;
72}
73
74#endif /* __ASM_RIO_H */
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index d6b7c057edba..e17b9ec42e98 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -82,11 +82,6 @@ extern u8 x86_cpu_to_apicid[NR_CPUS]; /* physical ID */
82extern u8 x86_cpu_to_log_apicid[NR_CPUS]; 82extern u8 x86_cpu_to_log_apicid[NR_CPUS];
83extern u8 bios_cpu_apicid[]; 83extern u8 bios_cpu_apicid[];
84 84
85static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
86{
87 return cpus_addr(cpumask)[0];
88}
89
90static inline int cpu_present_to_apicid(int mps_cpu) 85static inline int cpu_present_to_apicid(int mps_cpu)
91{ 86{
92 if (mps_cpu < NR_CPUS) 87 if (mps_cpu < NR_CPUS)
@@ -118,13 +113,6 @@ static __inline int logical_smp_processor_id(void)
118#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] 113#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
119#else 114#else
120#define cpu_physical_id(cpu) boot_cpu_id 115#define cpu_physical_id(cpu) boot_cpu_id
121static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
122 void *info, int retry, int wait)
123{
124 /* Disable interrupts here? */
125 func(info);
126 return 0;
127}
128#endif /* !CONFIG_SMP */ 116#endif /* !CONFIG_SMP */
129#endif 117#endif
130 118
diff --git a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h
index 05ef097ba55b..88bf981e73cf 100644
--- a/include/asm-x86_64/spinlock.h
+++ b/include/asm-x86_64/spinlock.h
@@ -36,7 +36,34 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
36 "2:\t" : "=m" (lock->slock) : : "memory"); 36 "2:\t" : "=m" (lock->slock) : : "memory");
37} 37}
38 38
39#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 39/*
40 * Same as __raw_spin_lock, but reenable interrupts during spinning.
41 */
42#ifndef CONFIG_PROVE_LOCKING
43static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
44{
45 asm volatile(
46 "\n1:\t"
47 LOCK_PREFIX " ; decl %0\n\t"
48 "jns 5f\n"
49 "testl $0x200, %1\n\t" /* interrupts were disabled? */
50 "jz 4f\n\t"
51 "sti\n"
52 "3:\t"
53 "rep;nop\n\t"
54 "cmpl $0, %0\n\t"
55 "jle 3b\n\t"
56 "cli\n\t"
57 "jmp 1b\n"
58 "4:\t"
59 "rep;nop\n\t"
60 "cmpl $0, %0\n\t"
61 "jg 1b\n\t"
62 "jmp 4b\n"
63 "5:\n\t"
64 : "+m" (lock->slock) : "r" ((unsigned)flags) : "memory");
65}
66#endif
40 67
41static inline int __raw_spin_trylock(raw_spinlock_t *lock) 68static inline int __raw_spin_trylock(raw_spinlock_t *lock)
42{ 69{
diff --git a/include/asm-x86_64/spinlock_types.h b/include/asm-x86_64/spinlock_types.h
index 59efe849f351..4da9345c1500 100644
--- a/include/asm-x86_64/spinlock_types.h
+++ b/include/asm-x86_64/spinlock_types.h
@@ -6,13 +6,13 @@
6#endif 6#endif
7 7
8typedef struct { 8typedef struct {
9 volatile unsigned int slock; 9 unsigned int slock;
10} raw_spinlock_t; 10} raw_spinlock_t;
11 11
12#define __RAW_SPIN_LOCK_UNLOCKED { 1 } 12#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
13 13
14typedef struct { 14typedef struct {
15 volatile unsigned int lock; 15 unsigned int lock;
16} raw_rwlock_t; 16} raw_rwlock_t;
17 17
18#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } 18#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
diff --git a/include/asm-x86_64/stacktrace.h b/include/asm-x86_64/stacktrace.h
index 5eb9799bef76..6f0b54594307 100644
--- a/include/asm-x86_64/stacktrace.h
+++ b/include/asm-x86_64/stacktrace.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_STACKTRACE_H 1#ifndef _ASM_STACKTRACE_H
2#define _ASM_STACKTRACE_H 1 2#define _ASM_STACKTRACE_H 1
3 3
4extern int kstack_depth_to_print;
5
4/* Generic stack tracer with callbacks */ 6/* Generic stack tracer with callbacks */
5 7
6struct stacktrace_ops { 8struct stacktrace_ops {
diff --git a/include/asm-x86_64/types.h b/include/asm-x86_64/types.h
index c86c2e6793e2..2d4491aae281 100644
--- a/include/asm-x86_64/types.h
+++ b/include/asm-x86_64/types.h
@@ -48,9 +48,6 @@ typedef unsigned long long u64;
48typedef u64 dma64_addr_t; 48typedef u64 dma64_addr_t;
49typedef u64 dma_addr_t; 49typedef u64 dma_addr_t;
50 50
51typedef u64 sector_t;
52#define HAVE_SECTOR_T
53
54#endif /* __ASSEMBLY__ */ 51#endif /* __ASSEMBLY__ */
55 52
56#endif /* __KERNEL__ */ 53#endif /* __KERNEL__ */
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index 19f99178fe83..d5dbc87274f8 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -6,7 +6,6 @@
6 */ 6 */
7#include <linux/compiler.h> 7#include <linux/compiler.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/sched.h>
10#include <linux/prefetch.h> 9#include <linux/prefetch.h>
11#include <asm/page.h> 10#include <asm/page.h>
12 11
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 777288eb7e75..c5f596e71faa 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -622,25 +622,7 @@ __SYSCALL(__NR_move_pages, sys_move_pages)
622 622
623#define __NR_syscall_max __NR_move_pages 623#define __NR_syscall_max __NR_move_pages
624 624
625#ifdef __KERNEL__
626#include <linux/err.h>
627#endif
628
629#ifndef __NO_STUBS 625#ifndef __NO_STUBS
630
631/* user-visible error numbers are in the range -1 - -MAX_ERRNO */
632
633#define __syscall_clobber "r11","rcx","memory"
634
635#define __syscall_return(type, res) \
636do { \
637 if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \
638 errno = -(res); \
639 res = -1; \
640 } \
641 return (type) (res); \
642} while (0)
643
644#define __ARCH_WANT_OLD_READDIR 626#define __ARCH_WANT_OLD_READDIR
645#define __ARCH_WANT_OLD_STAT 627#define __ARCH_WANT_OLD_STAT
646#define __ARCH_WANT_SYS_ALARM 628#define __ARCH_WANT_SYS_ALARM
@@ -664,87 +646,6 @@ do { \
664#define __ARCH_WANT_SYS_TIME 646#define __ARCH_WANT_SYS_TIME
665#define __ARCH_WANT_COMPAT_SYS_TIME 647#define __ARCH_WANT_COMPAT_SYS_TIME
666 648
667#define __syscall "syscall"
668
669#define _syscall0(type,name) \
670type name(void) \
671{ \
672long __res; \
673__asm__ volatile (__syscall \
674 : "=a" (__res) \
675 : "0" (__NR_##name) : __syscall_clobber ); \
676__syscall_return(type,__res); \
677}
678
679#define _syscall1(type,name,type1,arg1) \
680type name(type1 arg1) \
681{ \
682long __res; \
683__asm__ volatile (__syscall \
684 : "=a" (__res) \
685 : "0" (__NR_##name),"D" ((long)(arg1)) : __syscall_clobber ); \
686__syscall_return(type,__res); \
687}
688
689#define _syscall2(type,name,type1,arg1,type2,arg2) \
690type name(type1 arg1,type2 arg2) \
691{ \
692long __res; \
693__asm__ volatile (__syscall \
694 : "=a" (__res) \
695 : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)) : __syscall_clobber ); \
696__syscall_return(type,__res); \
697}
698
699#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
700type name(type1 arg1,type2 arg2,type3 arg3) \
701{ \
702long __res; \
703__asm__ volatile (__syscall \
704 : "=a" (__res) \
705 : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \
706 "d" ((long)(arg3)) : __syscall_clobber); \
707__syscall_return(type,__res); \
708}
709
710#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
711type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
712{ \
713long __res; \
714__asm__ volatile ("movq %5,%%r10 ;" __syscall \
715 : "=a" (__res) \
716 : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \
717 "d" ((long)(arg3)),"g" ((long)(arg4)) : __syscall_clobber,"r10" ); \
718__syscall_return(type,__res); \
719}
720
721#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
722 type5,arg5) \
723type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
724{ \
725long __res; \
726__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall \
727 : "=a" (__res) \
728 : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \
729 "d" ((long)(arg3)),"g" ((long)(arg4)),"g" ((long)(arg5)) : \
730 __syscall_clobber,"r8","r10" ); \
731__syscall_return(type,__res); \
732}
733
734#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
735 type5,arg5,type6,arg6) \
736type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
737{ \
738long __res; \
739__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; movq %7,%%r9 ; " __syscall \
740 : "=a" (__res) \
741 : "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)), \
742 "d" ((long)(arg3)), "g" ((long)(arg4)), "g" ((long)(arg5)), \
743 "g" ((long)(arg6)) : \
744 __syscall_clobber,"r8","r10","r9" ); \
745__syscall_return(type,__res); \
746}
747
748#ifdef __KERNEL__ 649#ifdef __KERNEL__
749#ifndef __ASSEMBLY__ 650#ifndef __ASSEMBLY__
750 651
diff --git a/include/asm-x86_64/unwind.h b/include/asm-x86_64/unwind.h
index 2e7ff10fd775..2f6349e48717 100644
--- a/include/asm-x86_64/unwind.h
+++ b/include/asm-x86_64/unwind.h
@@ -87,14 +87,10 @@ extern int arch_unwind_init_running(struct unwind_frame_info *,
87 87
88static inline int arch_unw_user_mode(const struct unwind_frame_info *info) 88static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
89{ 89{
90#if 0 /* This can only work when selector register saves/restores 90 return user_mode(&info->regs)
91 are properly annotated (and tracked in UNW_REGISTER_INFO). */ 91 || (long)info->regs.rip >= 0
92 return user_mode(&info->regs);
93#else
94 return (long)info->regs.rip >= 0
95 || (info->regs.rip >= VSYSCALL_START && info->regs.rip < VSYSCALL_END) 92 || (info->regs.rip >= VSYSCALL_START && info->regs.rip < VSYSCALL_END)
96 || (long)info->regs.rsp >= 0; 93 || (long)info->regs.rsp >= 0;
97#endif
98} 94}
99 95
100#else 96#else
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h
index fd452fc2c037..05cb8dd200de 100644
--- a/include/asm-x86_64/vsyscall.h
+++ b/include/asm-x86_64/vsyscall.h
@@ -10,6 +10,7 @@ enum vsyscall_num {
10#define VSYSCALL_START (-10UL << 20) 10#define VSYSCALL_START (-10UL << 20)
11#define VSYSCALL_SIZE 1024 11#define VSYSCALL_SIZE 1024
12#define VSYSCALL_END (-2UL << 20) 12#define VSYSCALL_END (-2UL << 20)
13#define VSYSCALL_MAPPED_PAGES 1
13#define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr)) 14#define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr))
14 15
15#ifdef __KERNEL__ 16#ifdef __KERNEL__
@@ -59,8 +60,6 @@ extern seqlock_t xtime_lock;
59 60
60extern int sysctl_vsyscall; 61extern int sysctl_vsyscall;
61 62
62extern void vsyscall_set_cpu(int cpu);
63
64#define ARCH_HAVE_XTIME_LOCK 1 63#define ARCH_HAVE_XTIME_LOCK 1
65 64
66#endif /* __KERNEL__ */ 65#endif /* __KERNEL__ */
diff --git a/include/asm-xtensa/checksum.h b/include/asm-xtensa/checksum.h
index 03114f8d1e18..5435aff9a4b7 100644
--- a/include/asm-xtensa/checksum.h
+++ b/include/asm-xtensa/checksum.h
@@ -26,7 +26,7 @@
26 * 26 *
27 * it's best to have buff aligned on a 32-bit boundary 27 * it's best to have buff aligned on a 32-bit boundary
28 */ 28 */
29asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 29asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
30 30
31/* 31/*
32 * the same as csum_partial, but copies from src while it 32 * the same as csum_partial, but copies from src while it
@@ -36,7 +36,7 @@ asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsign
36 * better 64-bit) boundary 36 * better 64-bit) boundary
37 */ 37 */
38 38
39asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, int len, int sum, 39asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst, int len, __wsum sum,
40 int *src_err_ptr, int *dst_err_ptr); 40 int *src_err_ptr, int *dst_err_ptr);
41 41
42/* 42/*
@@ -46,34 +46,25 @@ asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, i
46 * If you use these functions directly please don't forget the access_ok(). 46 * If you use these functions directly please don't forget the access_ok().
47 */ 47 */
48static inline 48static inline
49unsigned int csum_partial_copy_nocheck ( const char *src, char *dst, 49__wsum csum_partial_copy_nocheck(const void *src, void *dst,
50 int len, int sum) 50 int len, __wsum sum)
51{ 51{
52 return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); 52 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
53} 53}
54 54
55static inline 55static inline
56unsigned int csum_partial_copy_from_user ( const char *src, char *dst, 56__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
57 int len, int sum, int *err_ptr) 57 int len, __wsum sum, int *err_ptr)
58{ 58{
59 return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL); 59 return csum_partial_copy_generic((__force const void *)src, dst,
60 len, sum, err_ptr, NULL);
60} 61}
61 62
62/* 63/*
63 * These are the old (and unsafe) way of doing checksums, a warning message will be
64 * printed if they are used and an exeption occurs.
65 *
66 * these functions should go away after some time.
67 */
68
69#define csum_partial_copy_fromuser csum_partial_copy
70unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum);
71
72/*
73 * Fold a partial checksum 64 * Fold a partial checksum
74 */ 65 */
75 66
76static __inline__ unsigned int csum_fold(unsigned int sum) 67static __inline__ __sum16 csum_fold(__wsum sum)
77{ 68{
78 unsigned int __dummy; 69 unsigned int __dummy;
79 __asm__("extui %1, %0, 16, 16\n\t" 70 __asm__("extui %1, %0, 16, 16\n\t"
@@ -87,14 +78,14 @@ static __inline__ unsigned int csum_fold(unsigned int sum)
87 "extui %0, %0, 0, 16\n\t" 78 "extui %0, %0, 0, 16\n\t"
88 : "=r" (sum), "=&r" (__dummy) 79 : "=r" (sum), "=&r" (__dummy)
89 : "0" (sum)); 80 : "0" (sum));
90 return sum; 81 return (__force __sum16)sum;
91} 82}
92 83
93/* 84/*
94 * This is a version of ip_compute_csum() optimized for IP headers, 85 * This is a version of ip_compute_csum() optimized for IP headers,
95 * which always checksum on 4 octet boundaries. 86 * which always checksum on 4 octet boundaries.
96 */ 87 */
97static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) 88static __inline__ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
98{ 89{
99 unsigned int sum, tmp, endaddr; 90 unsigned int sum, tmp, endaddr;
100 91
@@ -127,17 +118,16 @@ static __inline__ unsigned short ip_fast_csum(unsigned char * iph, unsigned int
127 return csum_fold(sum); 118 return csum_fold(sum);
128} 119}
129 120
130static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, 121static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
131 unsigned long daddr,
132 unsigned short len, 122 unsigned short len,
133 unsigned short proto, 123 unsigned short proto,
134 unsigned int sum) 124 __wsum sum)
135{ 125{
136 126
137#ifdef __XTENSA_EL__ 127#ifdef __XTENSA_EL__
138 unsigned long len_proto = (ntohs(len)<<16)+proto*256; 128 unsigned long len_proto = (len + proto) << 8;
139#elif defined(__XTENSA_EB__) 129#elif defined(__XTENSA_EB__)
140 unsigned long len_proto = (proto<<16)+len; 130 unsigned long len_proto = len + proto;
141#else 131#else
142# error processor byte order undefined! 132# error processor byte order undefined!
143#endif 133#endif
@@ -162,11 +152,10 @@ static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr,
162 * computes the checksum of the TCP/UDP pseudo-header 152 * computes the checksum of the TCP/UDP pseudo-header
163 * returns a 16-bit checksum, already complemented 153 * returns a 16-bit checksum, already complemented
164 */ 154 */
165static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr, 155static __inline__ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
166 unsigned long daddr,
167 unsigned short len, 156 unsigned short len,
168 unsigned short proto, 157 unsigned short proto,
169 unsigned int sum) 158 __wsum sum)
170{ 159{
171 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 160 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
172} 161}
@@ -176,17 +165,16 @@ static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr,
176 * in icmp.c 165 * in icmp.c
177 */ 166 */
178 167
179static __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len) 168static __inline__ __sum16 ip_compute_csum(const void *buff, int len)
180{ 169{
181 return csum_fold (csum_partial(buff, len, 0)); 170 return csum_fold (csum_partial(buff, len, 0));
182} 171}
183 172
184#define _HAVE_ARCH_IPV6_CSUM 173#define _HAVE_ARCH_IPV6_CSUM
185static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 174static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
186 struct in6_addr *daddr, 175 const struct in6_addr *daddr,
187 __u32 len, 176 __u32 len, unsigned short proto,
188 unsigned short proto, 177 __wsum sum)
189 unsigned int sum)
190{ 178{
191 unsigned int __dummy; 179 unsigned int __dummy;
192 __asm__("l32i %1, %2, 0\n\t" 180 __asm__("l32i %1, %2, 0\n\t"
@@ -248,8 +236,8 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
248 * Copy and checksum to user 236 * Copy and checksum to user
249 */ 237 */
250#define HAVE_CSUM_COPY_USER 238#define HAVE_CSUM_COPY_USER
251static __inline__ unsigned int csum_and_copy_to_user (const char *src, char *dst, 239static __inline__ __wsum csum_and_copy_to_user(const void *src, void __user *dst,
252 int len, int sum, int *err_ptr) 240 int len, __wsum sum, int *err_ptr)
253{ 241{
254 if (access_ok(VERIFY_WRITE, dst, len)) 242 if (access_ok(VERIFY_WRITE, dst, len))
255 return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr); 243 return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr);
@@ -257,6 +245,6 @@ static __inline__ unsigned int csum_and_copy_to_user (const char *src, char *dst
257 if (len) 245 if (len)
258 *err_ptr = -EFAULT; 246 *err_ptr = -EFAULT;
259 247
260 return -1; /* invalid checksum */ 248 return (__force __wsum)-1; /* invalid checksum */
261} 249}
262#endif 250#endif
diff --git a/include/asm-xtensa/device.h b/include/asm-xtensa/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/include/asm-xtensa/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-xtensa/dma-mapping.h b/include/asm-xtensa/dma-mapping.h
index c39c91dfcc69..82b03b3a2ee6 100644
--- a/include/asm-xtensa/dma-mapping.h
+++ b/include/asm-xtensa/dma-mapping.h
@@ -170,10 +170,10 @@ dma_get_cache_alignment(void)
170 return L1_CACHE_BYTES; 170 return L1_CACHE_BYTES;
171} 171}
172 172
173#define dma_is_consistent(d) (1) 173#define dma_is_consistent(d, h) (1)
174 174
175static inline void 175static inline void
176dma_cache_sync(void *vaddr, size_t size, 176dma_cache_sync(struct device *dev, void *vaddr, size_t size,
177 enum dma_data_direction direction) 177 enum dma_data_direction direction)
178{ 178{
179 consistent_sync(vaddr, size, direction); 179 consistent_sync(vaddr, size, direction);
diff --git a/include/asm-xtensa/unistd.h b/include/asm-xtensa/unistd.h
index 411f810a55c6..2e1a1b997e7d 100644
--- a/include/asm-xtensa/unistd.h
+++ b/include/asm-xtensa/unistd.h
@@ -218,190 +218,6 @@
218 218
219#define SYSXTENSA_COUNT 5 /* count of syscall0 functions*/ 219#define SYSXTENSA_COUNT 5 /* count of syscall0 functions*/
220 220
221#ifdef __KERNEL__
222#include <linux/linkage.h>
223
224#define __syscall_return(type, res) return ((type)(res))
225
226/* Tensilica's xt-xcc compiler is much more agressive at code
227 * optimization than gcc. Multiple __asm__ statements are
228 * insufficient for xt-xcc because subsequent optimization passes
229 * (beyond the front-end that knows of __asm__ statements and other
230 * such GNU Extensions to C) can modify the register selection for
231 * containment of C variables.
232 *
233 * xt-xcc cannot modify the contents of a single __asm__ statement, so
234 * we create single-asm versions of the syscall macros that are
235 * suitable and optimal for both xt-xcc and gcc.
236 *
237 * Linux takes system-call arguments in registers. The following
238 * design is optimized for user-land apps (e.g., glibc) which
239 * typically have a function wrapper around the "syscall" assembly
240 * instruction. It satisfies the Xtensa ABI while minizing argument
241 * shifting.
242 *
243 * The Xtensa ABI and software conventions require the system-call
244 * number in a2. If an argument exists in a2, we move it to the next
245 * available register. Note that for improved efficiency, we do NOT
246 * shift all parameters down one register to maintain the original
247 * order.
248 *
249 * At best case (zero arguments), we just write the syscall number to
250 * a2. At worst case (1 to 6 arguments), we move the argument in a2
251 * to the next available register, then write the syscall number to
252 * a2.
253 *
254 * For clarity, the following truth table enumerates all possibilities.
255 *
256 * arguments syscall number arg0, arg1, arg2, arg3, arg4, arg5
257 * --------- -------------- ----------------------------------
258 * 0 a2
259 * 1 a2 a3
260 * 2 a2 a4, a3
261 * 3 a2 a5, a3, a4
262 * 4 a2 a6, a3, a4, a5
263 * 5 a2 a7, a3, a4, a5, a6
264 * 6 a2 a8, a3, a4, a5, a6, a7
265 */
266
267#define _syscall0(type,name) \
268type name(void) \
269{ \
270long __res; \
271__asm__ __volatile__ ( \
272 " movi a2, %1 \n" \
273 " syscall \n" \
274 " mov %0, a2 \n" \
275 : "=a" (__res) \
276 : "i" (__NR_##name) \
277 : "a2" \
278 ); \
279__syscall_return(type,__res); \
280}
281
282#define _syscall1(type,name,type0,arg0) \
283type name(type0 arg0) \
284{ \
285long __res; \
286__asm__ __volatile__ ( \
287 " mov a3, %2 \n" \
288 " movi a2, %1 \n" \
289 " syscall \n" \
290 " mov %0, a2 \n" \
291 : "=a" (__res) \
292 : "i" (__NR_##name), "a" (arg0) \
293 : "a2", "a3" \
294 ); \
295__syscall_return(type,__res); \
296}
297
298#define _syscall2(type,name,type0,arg0,type1,arg1) \
299type name(type0 arg0,type1 arg1) \
300{ \
301long __res; \
302__asm__ __volatile__ ( \
303 " mov a4, %2 \n" \
304 " mov a3, %3 \n" \
305 " movi a2, %1 \n" \
306 " syscall \n" \
307 " mov %0, a2 \n" \
308 : "=a" (__res) \
309 : "i" (__NR_##name), "a" (arg0), "a" (arg1) \
310 : "a2", "a3", "a4" \
311 ); \
312__syscall_return(type,__res); \
313}
314
315#define _syscall3(type,name,type0,arg0,type1,arg1,type2,arg2) \
316type name(type0 arg0,type1 arg1,type2 arg2) \
317{ \
318long __res; \
319__asm__ __volatile__ ( \
320 " mov a5, %2 \n" \
321 " mov a4, %4 \n" \
322 " mov a3, %3 \n" \
323 " movi a2, %1 \n" \
324 " syscall \n" \
325 " mov %0, a2 \n" \
326 : "=a" (__res) \
327 : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2) \
328 : "a2", "a3", "a4", "a5" \
329 ); \
330__syscall_return(type,__res); \
331}
332
333#define _syscall4(type,name,type0,arg0,type1,arg1,type2,arg2,type3,arg3) \
334type name(type0 arg0,type1 arg1,type2 arg2,type3 arg3) \
335{ \
336long __res; \
337__asm__ __volatile__ ( \
338 " mov a6, %2 \n" \
339 " mov a5, %5 \n" \
340 " mov a4, %4 \n" \
341 " mov a3, %3 \n" \
342 " movi a2, %1 \n" \
343 " syscall \n" \
344 " mov %0, a2 \n" \
345 : "=a" (__res) \
346 : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2), "a" (arg3) \
347 : "a2", "a3", "a4", "a5", "a6" \
348 ); \
349__syscall_return(type,__res); \
350}
351
352/* Note that we save and restore the a7 frame pointer.
353 * Including a7 in the clobber list doesn't do what you'd expect.
354 */
355#define _syscall5(type,name,type0,arg0,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
356type name(type0 arg0,type1 arg1,type2 arg2,type3 arg3,type4 arg4) \
357{ \
358long __res; \
359__asm__ __volatile__ ( \
360 " mov a9, a7 \n" \
361 " mov a7, %2 \n" \
362 " mov a6, %6 \n" \
363 " mov a5, %5 \n" \
364 " mov a4, %4 \n" \
365 " mov a3, %3 \n" \
366 " movi a2, %1 \n" \
367 " syscall \n" \
368 " mov a7, a9 \n" \
369 " mov %0, a2 \n" \
370 : "=a" (__res) \
371 : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2), \
372 "a" (arg3), "a" (arg4) \
373 : "a2", "a3", "a4", "a5", "a6", "a9" \
374 ); \
375__syscall_return(type,__res); \
376}
377
378/* Note that we save and restore the a7 frame pointer.
379 * Including a7 in the clobber list doesn't do what you'd expect.
380 */
381#define _syscall6(type,name,type0,arg0,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
382type name(type0 arg0,type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
383{ \
384long __res; \
385__asm__ __volatile__ ( \
386 " mov a9, a7 \n" \
387 " mov a8, %2 \n" \
388 " mov a7, %7 \n" \
389 " mov a6, %6 \n" \
390 " mov a5, %5 \n" \
391 " mov a4, %4 \n" \
392 " mov a3, %3 \n" \
393 " movi a2, %1 \n" \
394 " syscall \n" \
395 " mov a7, a9 \n" \
396 " mov %0, a2 \n" \
397 : "=a" (__res) \
398 : "i" (__NR_##name), "a" (arg0), "a" (arg1), "a" (arg2), \
399 "a" (arg3), "a" (arg4), "a" (arg5) \
400 : "a2", "a3", "a4", "a5", "a6", "a8", "a9" \
401 ); \
402__syscall_return(type,__res); \
403}
404
405/* 221/*
406 * "Conditional" syscalls 222 * "Conditional" syscalls
407 * 223 *
diff --git a/include/crypto/b128ops.h b/include/crypto/b128ops.h
new file mode 100644
index 000000000000..0b8e6bc55301
--- /dev/null
+++ b/include/crypto/b128ops.h
@@ -0,0 +1,80 @@
1/* b128ops.h - common 128-bit block operations
2 *
3 * Copyright (c) 2003, Dr Brian Gladman, Worcester, UK.
4 * Copyright (c) 2006, Rik Snel <rsnel@cube.dyndns.org>
5 *
6 * Based on Dr Brian Gladman's (GPL'd) work published at
7 * http://fp.gladman.plus.com/cryptography_technology/index.htm
8 * See the original copyright notice below.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
14 */
15/*
16 ---------------------------------------------------------------------------
17 Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved.
18
19 LICENSE TERMS
20
21 The free distribution and use of this software in both source and binary
22 form is allowed (with or without changes) provided that:
23
24 1. distributions of this source code include the above copyright
25 notice, this list of conditions and the following disclaimer;
26
27 2. distributions in binary form include the above copyright
28 notice, this list of conditions and the following disclaimer
29 in the documentation and/or other associated materials;
30
31 3. the copyright holder's name is not used to endorse products
32 built using this software without specific written permission.
33
34 ALTERNATIVELY, provided that this notice is retained in full, this product
35 may be distributed under the terms of the GNU General Public License (GPL),
36 in which case the provisions of the GPL apply INSTEAD OF those given above.
37
38 DISCLAIMER
39
40 This software is provided 'as is' with no explicit or implied warranties
41 in respect of its properties, including, but not limited to, correctness
42 and/or fitness for purpose.
43 ---------------------------------------------------------------------------
44 Issue Date: 13/06/2006
45*/
46
47#ifndef _CRYPTO_B128OPS_H
48#define _CRYPTO_B128OPS_H
49
50#include <linux/types.h>
51
52typedef struct {
53 u64 a, b;
54} u128;
55
56typedef struct {
57 __be64 a, b;
58} be128;
59
60typedef struct {
61 __le64 b, a;
62} le128;
63
64static inline void u128_xor(u128 *r, const u128 *p, const u128 *q)
65{
66 r->a = p->a ^ q->a;
67 r->b = p->b ^ q->b;
68}
69
70static inline void be128_xor(be128 *r, const be128 *p, const be128 *q)
71{
72 u128_xor((u128 *)r, (u128 *)p, (u128 *)q);
73}
74
75static inline void le128_xor(le128 *r, const le128 *p, const le128 *q)
76{
77 u128_xor((u128 *)r, (u128 *)p, (u128 *)q);
78}
79
80#endif /* _CRYPTO_B128OPS_H */
diff --git a/include/crypto/gf128mul.h b/include/crypto/gf128mul.h
new file mode 100644
index 000000000000..4fd315202442
--- /dev/null
+++ b/include/crypto/gf128mul.h
@@ -0,0 +1,198 @@
1/* gf128mul.h - GF(2^128) multiplication functions
2 *
3 * Copyright (c) 2003, Dr Brian Gladman, Worcester, UK.
4 * Copyright (c) 2006 Rik Snel <rsnel@cube.dyndns.org>
5 *
6 * Based on Dr Brian Gladman's (GPL'd) work published at
7 * http://fp.gladman.plus.com/cryptography_technology/index.htm
8 * See the original copyright notice below.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
14 */
15/*
16 ---------------------------------------------------------------------------
17 Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved.
18
19 LICENSE TERMS
20
21 The free distribution and use of this software in both source and binary
22 form is allowed (with or without changes) provided that:
23
24 1. distributions of this source code include the above copyright
25 notice, this list of conditions and the following disclaimer;
26
27 2. distributions in binary form include the above copyright
28 notice, this list of conditions and the following disclaimer
29 in the documentation and/or other associated materials;
30
31 3. the copyright holder's name is not used to endorse products
32 built using this software without specific written permission.
33
34 ALTERNATIVELY, provided that this notice is retained in full, this product
35 may be distributed under the terms of the GNU General Public License (GPL),
36 in which case the provisions of the GPL apply INSTEAD OF those given above.
37
38 DISCLAIMER
39
40 This software is provided 'as is' with no explicit or implied warranties
41 in respect of its properties, including, but not limited to, correctness
42 and/or fitness for purpose.
43 ---------------------------------------------------------------------------
44 Issue Date: 31/01/2006
45
46 An implementation of field multiplication in Galois Field GF(128)
47*/
48
49#ifndef _CRYPTO_GF128MUL_H
50#define _CRYPTO_GF128MUL_H
51
52#include <crypto/b128ops.h>
53#include <linux/slab.h>
54
55/* Comment by Rik:
56 *
57 * For some background on GF(2^128) see for example: http://-
58 * csrc.nist.gov/CryptoToolkit/modes/proposedmodes/gcm/gcm-revised-spec.pdf
59 *
60 * The elements of GF(2^128) := GF(2)[X]/(X^128-X^7-X^2-X^1-1) can
61 * be mapped to computer memory in a variety of ways. Let's examine
62 * three common cases.
63 *
64 * Take a look at the 16 binary octets below in memory order. The msb's
65 * are left and the lsb's are right. char b[16] is an array and b[0] is
66 * the first octet.
67 *
68 * 80000000 00000000 00000000 00000000 .... 00000000 00000000 00000000
69 * b[0] b[1] b[2] b[3] b[13] b[14] b[15]
70 *
71 * Every bit is a coefficient of some power of X. We can store the bits
72 * in every byte in little-endian order and the bytes themselves also in
73 * little endian order. I will call this lle (little-little-endian).
74 * The above buffer represents the polynomial 1, and X^7+X^2+X^1+1 looks
75 * like 11100001 00000000 .... 00000000 = { 0xE1, 0x00, }.
76 * This format was originally implemented in gf128mul and is used
77 * in GCM (Galois/Counter mode) and in ABL (Arbitrary Block Length).
78 *
79 * Another convention says: store the bits in bigendian order and the
80 * bytes also. This is bbe (big-big-endian). Now the buffer above
81 * represents X^127. X^7+X^2+X^1+1 looks like 00000000 .... 10000111,
82 * b[15] = 0x87 and the rest is 0. LRW uses this convention and bbe
83 * is partly implemented.
84 *
85 * Both of the above formats are easy to implement on big-endian
86 * machines.
87 *
88 * EME (which is patent encumbered) uses the ble format (bits are stored
89 * in big endian order and the bytes in little endian). The above buffer
90 * represents X^7 in this case and the primitive polynomial is b[0] = 0x87.
91 *
92 * The common machine word-size is smaller than 128 bits, so to make
93 * an efficient implementation we must split into machine word sizes.
94 * This file uses one 32bit for the moment. Machine endianness comes into
95 * play. The lle format in relation to machine endianness is discussed
96 * below by the original author of gf128mul Dr Brian Gladman.
97 *
98 * Let's look at the bbe and ble format on a little endian machine.
99 *
100 * bbe on a little endian machine u32 x[4]:
101 *
102 * MS x[0] LS MS x[1] LS
103 * ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls
104 * 103..96 111.104 119.112 127.120 71...64 79...72 87...80 95...88
105 *
106 * MS x[2] LS MS x[3] LS
107 * ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls
108 * 39...32 47...40 55...48 63...56 07...00 15...08 23...16 31...24
109 *
110 * ble on a little endian machine
111 *
112 * MS x[0] LS MS x[1] LS
113 * ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls
114 * 31...24 23...16 15...08 07...00 63...56 55...48 47...40 39...32
115 *
116 * MS x[2] LS MS x[3] LS
117 * ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls
118 * 95...88 87...80 79...72 71...64 127.120 199.112 111.104 103..96
119 *
120 * Multiplications in GF(2^128) are mostly bit-shifts, so you see why
121 * ble (and lbe also) are easier to implement on a little-endian
122 * machine than on a big-endian machine. The converse holds for bbe
123 * and lle.
124 *
125 * Note: to have good alignment, it seems to me that it is sufficient
126 * to keep elements of GF(2^128) in type u64[2]. On 32-bit wordsize
127 * machines this will automatically aligned to wordsize and on a 64-bit
128 * machine also.
129 */
130/* Multiply a GF128 field element by x. Field elements are held in arrays
131 of bytes in which field bits 8n..8n + 7 are held in byte[n], with lower
132 indexed bits placed in the more numerically significant bit positions
133 within bytes.
134
135 On little endian machines the bit indexes translate into the bit
136 positions within four 32-bit words in the following way
137
138 MS x[0] LS MS x[1] LS
139 ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls
140 24...31 16...23 08...15 00...07 56...63 48...55 40...47 32...39
141
142 MS x[2] LS MS x[3] LS
143 ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls
144 88...95 80...87 72...79 64...71 120.127 112.119 104.111 96..103
145
146 On big endian machines the bit indexes translate into the bit
147 positions within four 32-bit words in the following way
148
149 MS x[0] LS MS x[1] LS
150 ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls
151 00...07 08...15 16...23 24...31 32...39 40...47 48...55 56...63
152
153 MS x[2] LS MS x[3] LS
154 ms ls ms ls ms ls ms ls ms ls ms ls ms ls ms ls
155 64...71 72...79 80...87 88...95 96..103 104.111 112.119 120.127
156*/
157
158/* A slow generic version of gf_mul, implemented for lle and bbe
159 * It multiplies a and b and puts the result in a */
160void gf128mul_lle(be128 *a, const be128 *b);
161
162void gf128mul_bbe(be128 *a, const be128 *b);
163
164
165/* 4k table optimization */
166
167struct gf128mul_4k {
168 be128 t[256];
169};
170
171struct gf128mul_4k *gf128mul_init_4k_lle(const be128 *g);
172struct gf128mul_4k *gf128mul_init_4k_bbe(const be128 *g);
173void gf128mul_4k_lle(be128 *a, struct gf128mul_4k *t);
174void gf128mul_4k_bbe(be128 *a, struct gf128mul_4k *t);
175
176static inline void gf128mul_free_4k(struct gf128mul_4k *t)
177{
178 kfree(t);
179}
180
181
182/* 64k table optimization, implemented for lle and bbe */
183
184struct gf128mul_64k {
185 struct gf128mul_4k *t[16];
186};
187
188/* first initialize with the constant factor with which you
189 * want to multiply and then call gf128_64k_lle with the other
190 * factor in the first argument, the table in the second and a
191 * scratch register in the third. Afterwards *a = *r. */
192struct gf128mul_64k *gf128mul_init_64k_lle(const be128 *g);
193struct gf128mul_64k *gf128mul_init_64k_bbe(const be128 *g);
194void gf128mul_free_64k(struct gf128mul_64k *t);
195void gf128mul_64k_lle(be128 *a, struct gf128mul_64k *t);
196void gf128mul_64k_bbe(be128 *a, struct gf128mul_64k *t);
197
198#endif /* _CRYPTO_GF128MUL_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index a1155a2beb32..e618b25b5add 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -60,8 +60,6 @@ header-y += fadvise.h
60header-y += fd.h 60header-y += fd.h
61header-y += fdreg.h 61header-y += fdreg.h
62header-y += fib_rules.h 62header-y += fib_rules.h
63header-y += ftape-header-segment.h
64header-y += ftape-vendors.h
65header-y += fuse.h 63header-y += fuse.h
66header-y += futex.h 64header-y += futex.h
67header-y += genetlink.h 65header-y += genetlink.h
@@ -193,7 +191,6 @@ unifdef-y += cuda.h
193unifdef-y += cyclades.h 191unifdef-y += cyclades.h
194unifdef-y += dccp.h 192unifdef-y += dccp.h
195unifdef-y += dirent.h 193unifdef-y += dirent.h
196unifdef-y += divert.h
197unifdef-y += dlm.h 194unifdef-y += dlm.h
198unifdef-y += elfcore.h 195unifdef-y += elfcore.h
199unifdef-y += errno.h 196unifdef-y += errno.h
@@ -207,7 +204,6 @@ unifdef-y += fcntl.h
207unifdef-y += filter.h 204unifdef-y += filter.h
208unifdef-y += flat.h 205unifdef-y += flat.h
209unifdef-y += fs.h 206unifdef-y += fs.h
210unifdef-y += ftape.h
211unifdef-y += gameport.h 207unifdef-y += gameport.h
212unifdef-y += generic_serial.h 208unifdef-y += generic_serial.h
213unifdef-y += genhd.h 209unifdef-y += genhd.h
@@ -225,6 +221,7 @@ unifdef-y += if_bridge.h
225unifdef-y += if_ec.h 221unifdef-y += if_ec.h
226unifdef-y += if_eql.h 222unifdef-y += if_eql.h
227unifdef-y += if_ether.h 223unifdef-y += if_ether.h
224unifdef-y += if_fddi.h
228unifdef-y += if_frad.h 225unifdef-y += if_frad.h
229unifdef-y += if_ltalk.h 226unifdef-y += if_ltalk.h
230unifdef-y += if_pppox.h 227unifdef-y += if_pppox.h
@@ -286,6 +283,7 @@ unifdef-y += nvram.h
286unifdef-y += parport.h 283unifdef-y += parport.h
287unifdef-y += patchkey.h 284unifdef-y += patchkey.h
288unifdef-y += pci.h 285unifdef-y += pci.h
286unifdef-y += personality.h
289unifdef-y += pktcdvd.h 287unifdef-y += pktcdvd.h
290unifdef-y += pmu.h 288unifdef-y += pmu.h
291unifdef-y += poll.h 289unifdef-y += poll.h
@@ -341,7 +339,7 @@ unifdef-y += videodev.h
341unifdef-y += wait.h 339unifdef-y += wait.h
342unifdef-y += wanrouter.h 340unifdef-y += wanrouter.h
343unifdef-y += watchdog.h 341unifdef-y += watchdog.h
342unifdef-y += wireless.h
344unifdef-y += xfrm.h 343unifdef-y += xfrm.h
345unifdef-y += zftape.h
346 344
347objhdr-y += version.h 345objhdr-y += version.h
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 0496d1f09952..302eb727ecb8 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -119,6 +119,7 @@ struct acct_v3
119#ifdef CONFIG_BSD_PROCESS_ACCT 119#ifdef CONFIG_BSD_PROCESS_ACCT
120struct vfsmount; 120struct vfsmount;
121struct super_block; 121struct super_block;
122struct pacct_struct;
122extern void acct_auto_close_mnt(struct vfsmount *m); 123extern void acct_auto_close_mnt(struct vfsmount *m);
123extern void acct_auto_close(struct super_block *sb); 124extern void acct_auto_close(struct super_block *sb);
124extern void acct_init_pacct(struct pacct_struct *pacct); 125extern void acct_init_pacct(struct pacct_struct *pacct);
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 0d71c0041f13..3372ec6bf53a 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -111,7 +111,6 @@ struct kiocb {
111 size_t ki_nbytes; /* copy of iocb->aio_nbytes */ 111 size_t ki_nbytes; /* copy of iocb->aio_nbytes */
112 char __user *ki_buf; /* remaining iocb->aio_buf */ 112 char __user *ki_buf; /* remaining iocb->aio_buf */
113 size_t ki_left; /* remaining bytes */ 113 size_t ki_left; /* remaining bytes */
114 long ki_retried; /* just for testing */
115 struct iovec ki_inline_vec; /* inline vector */ 114 struct iovec ki_inline_vec; /* inline vector */
116 struct iovec *ki_iovec; 115 struct iovec *ki_iovec;
117 unsigned long ki_nr_segs; 116 unsigned long ki_nr_segs;
@@ -194,7 +193,7 @@ struct kioctx {
194 193
195 struct aio_ring_info ring_info; 194 struct aio_ring_info ring_info;
196 195
197 struct work_struct wq; 196 struct delayed_work wq;
198}; 197};
199 198
200/* prototypes */ 199/* prototypes */
@@ -238,7 +237,6 @@ do { \
238} while (0) 237} while (0)
239 238
240#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) 239#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
241#define is_retried_kiocb(iocb) ((iocb)->ki_retried > 1)
242 240
243#include <linux/aio_abi.h> 241#include <linux/aio_abi.h>
244 242
diff --git a/include/linux/ata.h b/include/linux/ata.h
index d89441907024..1df941648a57 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -200,8 +200,9 @@ enum {
200 ATA_CBL_NONE = 0, 200 ATA_CBL_NONE = 0,
201 ATA_CBL_PATA40 = 1, 201 ATA_CBL_PATA40 = 1,
202 ATA_CBL_PATA80 = 2, 202 ATA_CBL_PATA80 = 2,
203 ATA_CBL_PATA_UNK = 3, 203 ATA_CBL_PATA40_SHORT = 3, /* 40 wire cable to high UDMA spec */
204 ATA_CBL_SATA = 4, 204 ATA_CBL_PATA_UNK = 4,
205 ATA_CBL_SATA = 5,
205 206
206 /* SATA Status and Control Registers */ 207 /* SATA Status and Control Registers */
207 SCR_STATUS = 0, 208 SCR_STATUS = 0,
@@ -342,6 +343,15 @@ static inline int ata_id_is_cfa(const u16 *id)
342 return 0; 343 return 0;
343} 344}
344 345
346static inline int ata_drive_40wire(const u16 *dev_id)
347{
348 if (ata_id_major_version(dev_id) >= 5 && ata_id_is_sata(dev_id))
349 return 0; /* SATA */
350 if (dev_id[93] & 0x4000)
351 return 0; /* 80 wire */
352 return 1;
353}
354
345static inline int atapi_cdb_len(const u16 *dev_id) 355static inline int atapi_cdb_len(const u16 *dev_id)
346{ 356{
347 u16 tmp = dev_id[0] & 0x3; 357 u16 tmp = dev_id[0] & 0x3;
diff --git a/include/linux/atmarp.h b/include/linux/atmarp.h
index 24f82338f59a..ee108f9e9cb7 100644
--- a/include/linux/atmarp.h
+++ b/include/linux/atmarp.h
@@ -37,7 +37,7 @@ enum atmarp_ctrl_type {
37struct atmarp_ctrl { 37struct atmarp_ctrl {
38 enum atmarp_ctrl_type type; /* message type */ 38 enum atmarp_ctrl_type type; /* message type */
39 int itf_num;/* interface number (if present) */ 39 int itf_num;/* interface number (if present) */
40 uint32_t ip; /* IP address (act_need only) */ 40 __be32 ip; /* IP address (act_need only) */
41}; 41};
42 42
43#endif 43#endif
diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h
index 7981b733f1ef..969fb6c9e1cc 100644
--- a/include/linux/atmbr2684.h
+++ b/include/linux/atmbr2684.h
@@ -86,8 +86,8 @@ struct atm_backend_br2684 {
86 * efficient per-if in/out filters, this support will be removed 86 * efficient per-if in/out filters, this support will be removed
87 */ 87 */
88struct br2684_filter { 88struct br2684_filter {
89 __u32 prefix; /* network byte order */ 89 __be32 prefix; /* network byte order */
90 __u32 netmask; /* 0 = disable filter */ 90 __be32 netmask; /* 0 = disable filter */
91}; 91};
92 92
93struct br2684_filter_set { 93struct br2684_filter_set {
diff --git a/include/linux/atmmpc.h b/include/linux/atmmpc.h
index 5fbfa68136d3..ea1650425a12 100644
--- a/include/linux/atmmpc.h
+++ b/include/linux/atmmpc.h
@@ -13,7 +13,7 @@
13 13
14struct atmmpc_ioc { 14struct atmmpc_ioc {
15 int dev_num; 15 int dev_num;
16 uint32_t ipaddr; /* the IP address of the shortcut */ 16 __be32 ipaddr; /* the IP address of the shortcut */
17 int type; /* ingress or egress */ 17 int type; /* ingress or egress */
18}; 18};
19 19
@@ -21,8 +21,8 @@ typedef struct in_ctrl_info {
21 uint8_t Last_NHRP_CIE_code; 21 uint8_t Last_NHRP_CIE_code;
22 uint8_t Last_Q2931_cause_value; 22 uint8_t Last_Q2931_cause_value;
23 uint8_t eg_MPC_ATM_addr[ATM_ESA_LEN]; 23 uint8_t eg_MPC_ATM_addr[ATM_ESA_LEN];
24 uint32_t tag; 24 __be32 tag;
25 uint32_t in_dst_ip; /* IP address this ingress MPC sends packets to */ 25 __be32 in_dst_ip; /* IP address this ingress MPC sends packets to */
26 uint16_t holding_time; 26 uint16_t holding_time;
27 uint32_t request_id; 27 uint32_t request_id;
28} in_ctrl_info; 28} in_ctrl_info;
@@ -30,10 +30,10 @@ typedef struct in_ctrl_info {
30typedef struct eg_ctrl_info { 30typedef struct eg_ctrl_info {
31 uint8_t DLL_header[256]; 31 uint8_t DLL_header[256];
32 uint8_t DH_length; 32 uint8_t DH_length;
33 uint32_t cache_id; 33 __be32 cache_id;
34 uint32_t tag; 34 __be32 tag;
35 uint32_t mps_ip; 35 __be32 mps_ip;
36 uint32_t eg_dst_ip; /* IP address to which ingress MPC sends packets */ 36 __be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */
37 uint8_t in_MPC_data_ATM_addr[ATM_ESA_LEN]; 37 uint8_t in_MPC_data_ATM_addr[ATM_ESA_LEN];
38 uint16_t holding_time; 38 uint16_t holding_time;
39} eg_ctrl_info; 39} eg_ctrl_info;
@@ -49,7 +49,7 @@ struct mpc_parameters {
49 49
50struct k_message { 50struct k_message {
51 uint16_t type; 51 uint16_t type;
52 uint32_t ip_mask; 52 __be32 ip_mask;
53 uint8_t MPS_ctrl[ATM_ESA_LEN]; 53 uint8_t MPS_ctrl[ATM_ESA_LEN];
54 union { 54 union {
55 in_ctrl_info in_info; 55 in_ctrl_info in_info;
diff --git a/include/linux/audit.h b/include/linux/audit.h
index b2ca666d9997..0e07db6cc0d0 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -101,6 +101,10 @@
101#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */ 101#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
102#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */ 102#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
103#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */ 103#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
104#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Add a XFRM state */
105#define AUDIT_MAC_IPSEC_DELSA 1412 /* Delete a XFRM state */
106#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Add a XFRM policy */
107#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Delete a XFRM policy */
104 108
105#define AUDIT_FIRST_KERN_ANOM_MSG 1700 109#define AUDIT_FIRST_KERN_ANOM_MSG 1700
106#define AUDIT_LAST_KERN_ANOM_MSG 1799 110#define AUDIT_LAST_KERN_ANOM_MSG 1799
@@ -377,6 +381,7 @@ extern void auditsc_get_stamp(struct audit_context *ctx,
377 struct timespec *t, unsigned int *serial); 381 struct timespec *t, unsigned int *serial);
378extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); 382extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
379extern uid_t audit_get_loginuid(struct audit_context *ctx); 383extern uid_t audit_get_loginuid(struct audit_context *ctx);
384extern void audit_log_task_context(struct audit_buffer *ab);
380extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp); 385extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
381extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 386extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
382extern int audit_bprm(struct linux_binprm *bprm); 387extern int audit_bprm(struct linux_binprm *bprm);
@@ -449,6 +454,7 @@ extern int audit_n_rules;
449#define audit_inode_update(i) do { ; } while (0) 454#define audit_inode_update(i) do { ; } while (0)
450#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) 455#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
451#define audit_get_loginuid(c) ({ -1; }) 456#define audit_get_loginuid(c) ({ -1; })
457#define audit_log_task_context(b) do { ; } while (0)
452#define audit_ipc_obj(i) ({ 0; }) 458#define audit_ipc_obj(i) ({ 0; })
453#define audit_ipc_set_perm(q,u,g,m) ({ 0; }) 459#define audit_ipc_set_perm(q,u,g,m) ({ 0; })
454#define audit_bprm(p) ({ 0; }) 460#define audit_bprm(p) ({ 0; })
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7bfcde2d5578..e1c7286165ff 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -678,10 +678,11 @@ extern void __blk_stop_queue(request_queue_t *q);
678extern void blk_run_queue(request_queue_t *); 678extern void blk_run_queue(request_queue_t *);
679extern void blk_start_queueing(request_queue_t *); 679extern void blk_start_queueing(request_queue_t *);
680extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *); 680extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *);
681extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned int); 681extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned long);
682extern int blk_rq_unmap_user(struct bio *, unsigned int); 682extern int blk_rq_unmap_user(struct request *);
683extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, gfp_t); 683extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, gfp_t);
684extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); 684extern int blk_rq_map_user_iov(request_queue_t *, struct request *,
685 struct sg_iovec *, int, unsigned int);
685extern int blk_execute_rq(request_queue_t *, struct gendisk *, 686extern int blk_execute_rq(request_queue_t *, struct gendisk *,
686 struct request *, int); 687 struct request *, int);
687extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *, 688extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *,
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index b99a714fcac6..3680ff9a30ed 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -50,6 +50,15 @@ enum blktrace_act {
50}; 50};
51 51
52/* 52/*
53 * Notify events.
54 */
55enum blktrace_notify {
56 __BLK_TN_PROCESS = 0, /* establish pid/name mapping */
57 __BLK_TN_TIMESTAMP, /* include system clock */
58};
59
60
61/*
53 * Trace actions in full. Additionally, read or write is masked 62 * Trace actions in full. Additionally, read or write is masked
54 */ 63 */
55#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE)) 64#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE))
@@ -68,6 +77,9 @@ enum blktrace_act {
68#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) 77#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
69#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) 78#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
70 79
80#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
81#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
82
71#define BLK_IO_TRACE_MAGIC 0x65617400 83#define BLK_IO_TRACE_MAGIC 0x65617400
72#define BLK_IO_TRACE_VERSION 0x07 84#define BLK_IO_TRACE_VERSION 0x07
73 85
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 31e9abb6d977..2275f2748708 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -119,8 +119,7 @@ extern void *alloc_large_system_hash(const char *tablename,
119 unsigned int *_hash_mask, 119 unsigned int *_hash_mask,
120 unsigned long limit); 120 unsigned long limit);
121 121
122#define HASH_HIGHMEM 0x00000001 /* Consider highmem? */ 122#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
123#define HASH_EARLY 0x00000002 /* Allocating during early boot? */
124 123
125/* Only NUMA needs hash distribution. 124/* Only NUMA needs hash distribution.
126 * IA64 is known to have sufficient vmalloc space. 125 * IA64 is known to have sufficient vmalloc space.
diff --git a/include/linux/bottom_half.h b/include/linux/bottom_half.h
new file mode 100644
index 000000000000..777dbf695d44
--- /dev/null
+++ b/include/linux/bottom_half.h
@@ -0,0 +1,10 @@
1#ifndef _LINUX_BH_H
2#define _LINUX_BH_H
3
4extern void local_bh_disable(void);
5extern void __local_bh_enable(void);
6extern void _local_bh_enable(void);
7extern void local_bh_enable(void);
8extern void local_bh_enable_ip(unsigned long ip);
9
10#endif /* _LINUX_BH_H */
diff --git a/include/linux/carta_random32.h b/include/linux/carta_random32.h
deleted file mode 100644
index f6f3bd9f20b5..000000000000
--- a/include/linux/carta_random32.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Fast, simple, yet decent quality random number generator based on
3 * a paper by David G. Carta ("Two Fast Implementations of the
4 * `Minimal Standard' Random Number Generator," Communications of the
5 * ACM, January, 1990).
6 *
7 * Copyright (c) 2002-2006 Hewlett-Packard Development Company, L.P.
8 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 * 02111-1307 USA
23 */
24#ifndef _LINUX_CARTA_RANDOM32_H_
25#define _LINUX_CARTA_RANDOM32_H_
26
27u64 carta_random32(u64 seed);
28
29#endif /* _LINUX_CARTA_RANDOM32_H_ */
diff --git a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h
index 6e27f42e3a57..cb57c30081a8 100644
--- a/include/linux/cciss_ioctl.h
+++ b/include/linux/cciss_ioctl.h
@@ -80,7 +80,7 @@ typedef __u32 DriverVer_type;
80#define HWORD __u16 80#define HWORD __u16
81#define DWORD __u32 81#define DWORD __u32
82 82
83#define CISS_MAX_LUN 16 83#define CISS_MAX_LUN 1024
84 84
85#define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping 85#define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping
86#define LEVEL3LUN 0 86#define LEVEL3LUN 0
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index ee5f53f2ca15..f309b00e986e 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -2,6 +2,10 @@
2#define _LINUX_CDEV_H 2#define _LINUX_CDEV_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/kobject.h>
6#include <linux/kdev_t.h>
7#include <linux/list.h>
8
5struct cdev { 9struct cdev {
6 struct kobject kobj; 10 struct kobject kobj;
7 struct module *owner; 11 struct module *owner;
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 4c02119c6ab9..3ea1cd58de97 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -133,7 +133,7 @@ struct cn_callback_data {
133struct cn_callback_entry { 133struct cn_callback_entry {
134 struct list_head callback_entry; 134 struct list_head callback_entry;
135 struct cn_callback *cb; 135 struct cn_callback *cb;
136 struct work_struct work; 136 struct delayed_work work;
137 struct cn_queue_dev *pdev; 137 struct cn_queue_dev *pdev;
138 138
139 struct cn_callback_id id; 139 struct cn_callback_id id;
@@ -170,7 +170,7 @@ void cn_queue_free_dev(struct cn_queue_dev *dev);
170 170
171int cn_cb_equal(struct cb_id *, struct cb_id *); 171int cn_cb_equal(struct cb_id *, struct cb_id *);
172 172
173void cn_queue_wrapper(void *data); 173void cn_queue_wrapper(struct work_struct *work);
174 174
175extern int cn_already_initialized; 175extern int cn_already_initialized;
176 176
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 3fef7d67aedc..bfb520212d71 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -24,15 +24,24 @@
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/cpumask.h> 25#include <linux/cpumask.h>
26#include <asm/semaphore.h> 26#include <asm/semaphore.h>
27#include <linux/mutex.h>
27 28
28struct cpu { 29struct cpu {
29 int node_id; /* The node which contains the CPU */ 30 int node_id; /* The node which contains the CPU */
30 int no_control; /* Should the sysfs control file be created? */ 31 int hotpluggable; /* creates sysfs control file if hotpluggable */
31 struct sys_device sysdev; 32 struct sys_device sysdev;
32}; 33};
33 34
34extern int register_cpu(struct cpu *cpu, int num); 35extern int register_cpu(struct cpu *cpu, int num);
35extern struct sys_device *get_cpu_sysdev(unsigned cpu); 36extern struct sys_device *get_cpu_sysdev(unsigned cpu);
37
38extern int cpu_add_sysdev_attr(struct sysdev_attribute *attr);
39extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr);
40
41extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs);
42extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs);
43
44
36#ifdef CONFIG_HOTPLUG_CPU 45#ifdef CONFIG_HOTPLUG_CPU
37extern void unregister_cpu(struct cpu *cpu); 46extern void unregister_cpu(struct cpu *cpu);
38#endif 47#endif
@@ -66,6 +75,17 @@ extern struct sysdev_class cpu_sysdev_class;
66 75
67#ifdef CONFIG_HOTPLUG_CPU 76#ifdef CONFIG_HOTPLUG_CPU
68/* Stop CPUs going up and down. */ 77/* Stop CPUs going up and down. */
78
79static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
80{
81 mutex_lock(cpu_hp_mutex);
82}
83
84static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
85{
86 mutex_unlock(cpu_hp_mutex);
87}
88
69extern void lock_cpu_hotplug(void); 89extern void lock_cpu_hotplug(void);
70extern void unlock_cpu_hotplug(void); 90extern void unlock_cpu_hotplug(void);
71#define hotcpu_notifier(fn, pri) { \ 91#define hotcpu_notifier(fn, pri) { \
@@ -77,17 +97,24 @@ extern void unlock_cpu_hotplug(void);
77#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 97#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
78int cpu_down(unsigned int cpu); 98int cpu_down(unsigned int cpu);
79#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 99#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
80#else 100
101#else /* CONFIG_HOTPLUG_CPU */
102
103static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
104{ }
105static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
106{ }
107
81#define lock_cpu_hotplug() do { } while (0) 108#define lock_cpu_hotplug() do { } while (0)
82#define unlock_cpu_hotplug() do { } while (0) 109#define unlock_cpu_hotplug() do { } while (0)
83#define lock_cpu_hotplug_interruptible() 0 110#define lock_cpu_hotplug_interruptible() 0
84#define hotcpu_notifier(fn, pri) do { } while (0) 111#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
85#define register_hotcpu_notifier(nb) do { } while (0) 112#define register_hotcpu_notifier(nb) do { (void)(nb); } while (0)
86#define unregister_hotcpu_notifier(nb) do { } while (0) 113#define unregister_hotcpu_notifier(nb) do { (void)(nb); } while (0)
87 114
88/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */ 115/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
89static inline int cpu_is_offline(int cpu) { return 0; } 116static inline int cpu_is_offline(int cpu) { return 0; }
90#endif 117#endif /* CONFIG_HOTPLUG_CPU */
91 118
92#ifdef CONFIG_SUSPEND_SMP 119#ifdef CONFIG_SUSPEND_SMP
93extern int disable_nonboot_cpus(void); 120extern int disable_nonboot_cpus(void);
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 4d8adf663681..8821e1f75b44 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -23,6 +23,7 @@ extern void cpuset_fork(struct task_struct *p);
23extern void cpuset_exit(struct task_struct *p); 23extern void cpuset_exit(struct task_struct *p);
24extern cpumask_t cpuset_cpus_allowed(struct task_struct *p); 24extern cpumask_t cpuset_cpus_allowed(struct task_struct *p);
25extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 25extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
26#define cpuset_current_mems_allowed (current->mems_allowed)
26void cpuset_init_current_mems_allowed(void); 27void cpuset_init_current_mems_allowed(void);
27void cpuset_update_task_memory_state(void); 28void cpuset_update_task_memory_state(void);
28#define cpuset_nodes_subset_current_mems_allowed(nodes) \ 29#define cpuset_nodes_subset_current_mems_allowed(nodes) \
@@ -45,7 +46,7 @@ extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
45extern int cpuset_memory_pressure_enabled; 46extern int cpuset_memory_pressure_enabled;
46extern void __cpuset_memory_pressure_bump(void); 47extern void __cpuset_memory_pressure_bump(void);
47 48
48extern struct file_operations proc_cpuset_operations; 49extern const struct file_operations proc_cpuset_operations;
49extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); 50extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
50 51
51extern void cpuset_lock(void); 52extern void cpuset_lock(void);
@@ -83,6 +84,7 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
83 return node_possible_map; 84 return node_possible_map;
84} 85}
85 86
87#define cpuset_current_mems_allowed (node_online_map)
86static inline void cpuset_init_current_mems_allowed(void) {} 88static inline void cpuset_init_current_mems_allowed(void) {}
87static inline void cpuset_update_task_memory_state(void) {} 89static inline void cpuset_update_task_memory_state(void) {}
88#define cpuset_nodes_subset_current_mems_allowed(nodes) (1) 90#define cpuset_nodes_subset_current_mems_allowed(nodes) (1)
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 8f2ffa4caabf..4aa9046601da 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -241,12 +241,8 @@ int crypto_unregister_alg(struct crypto_alg *alg);
241 * Algorithm query interface. 241 * Algorithm query interface.
242 */ 242 */
243#ifdef CONFIG_CRYPTO 243#ifdef CONFIG_CRYPTO
244int crypto_alg_available(const char *name, u32 flags)
245 __deprecated_for_modules;
246int crypto_has_alg(const char *name, u32 type, u32 mask); 244int crypto_has_alg(const char *name, u32 type, u32 mask);
247#else 245#else
248static int crypto_alg_available(const char *name, u32 flags);
249 __deprecated_for_modules;
250static inline int crypto_alg_available(const char *name, u32 flags) 246static inline int crypto_alg_available(const char *name, u32 flags)
251{ 247{
252 return 0; 248 return 0;
@@ -707,16 +703,6 @@ static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm,
707 dst, src); 703 dst, src);
708} 704}
709 705
710void crypto_digest_init(struct crypto_tfm *tfm) __deprecated_for_modules;
711void crypto_digest_update(struct crypto_tfm *tfm,
712 struct scatterlist *sg, unsigned int nsg)
713 __deprecated_for_modules;
714void crypto_digest_final(struct crypto_tfm *tfm, u8 *out)
715 __deprecated_for_modules;
716void crypto_digest_digest(struct crypto_tfm *tfm,
717 struct scatterlist *sg, unsigned int nsg, u8 *out)
718 __deprecated_for_modules;
719
720static inline struct crypto_hash *__crypto_hash_cast(struct crypto_tfm *tfm) 706static inline struct crypto_hash *__crypto_hash_cast(struct crypto_tfm *tfm)
721{ 707{
722 return (struct crypto_hash *)tfm; 708 return (struct crypto_hash *)tfm;
@@ -729,14 +715,6 @@ static inline struct crypto_hash *crypto_hash_cast(struct crypto_tfm *tfm)
729 return __crypto_hash_cast(tfm); 715 return __crypto_hash_cast(tfm);
730} 716}
731 717
732static int crypto_digest_setkey(struct crypto_tfm *tfm, const u8 *key,
733 unsigned int keylen) __deprecated;
734static inline int crypto_digest_setkey(struct crypto_tfm *tfm,
735 const u8 *key, unsigned int keylen)
736{
737 return tfm->crt_hash.setkey(crypto_hash_cast(tfm), key, keylen);
738}
739
740static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name, 718static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name,
741 u32 type, u32 mask) 719 u32 type, u32 mask)
742{ 720{
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 53553c99cad6..ed6cc8962d87 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -30,7 +30,7 @@ struct dccp_hdr {
30#else 30#else
31#error "Adjust your <asm/byteorder.h> defines" 31#error "Adjust your <asm/byteorder.h> defines"
32#endif 32#endif
33 __u16 dccph_checksum; 33 __sum16 dccph_checksum;
34#if defined(__LITTLE_ENDIAN_BITFIELD) 34#if defined(__LITTLE_ENDIAN_BITFIELD)
35 __u8 dccph_x:1, 35 __u8 dccph_x:1,
36 dccph_type:4, 36 dccph_type:4,
@@ -175,17 +175,21 @@ enum {
175 DCCPC_CCID3 = 3, 175 DCCPC_CCID3 = 3,
176}; 176};
177 177
178/* DCCP features */ 178/* DCCP features (RFC 4340 section 6.4) */
179enum { 179 enum {
180 DCCPF_RESERVED = 0, 180 DCCPF_RESERVED = 0,
181 DCCPF_CCID = 1, 181 DCCPF_CCID = 1,
182 DCCPF_SEQUENCE_WINDOW = 3, 182 DCCPF_SHORT_SEQNOS = 2, /* XXX: not yet implemented */
183 DCCPF_ACK_RATIO = 5, 183 DCCPF_SEQUENCE_WINDOW = 3,
184 DCCPF_SEND_ACK_VECTOR = 6, 184 DCCPF_ECN_INCAPABLE = 4, /* XXX: not yet implemented */
185 DCCPF_SEND_NDP_COUNT = 7, 185 DCCPF_ACK_RATIO = 5,
186 /* 10-127 reserved */ 186 DCCPF_SEND_ACK_VECTOR = 6,
187 DCCPF_MIN_CCID_SPECIFIC = 128, 187 DCCPF_SEND_NDP_COUNT = 7,
188 DCCPF_MAX_CCID_SPECIFIC = 255, 188 DCCPF_MIN_CSUM_COVER = 8,
189 DCCPF_DATA_CHECKSUM = 9, /* XXX: not yet implemented */
190 /* 10-127 reserved */
191 DCCPF_MIN_CCID_SPECIFIC = 128,
192 DCCPF_MAX_CCID_SPECIFIC = 255,
189}; 193};
190 194
191/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */ 195/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */
@@ -196,13 +200,16 @@ struct dccp_so_feat {
196}; 200};
197 201
198/* DCCP socket options */ 202/* DCCP socket options */
199#define DCCP_SOCKOPT_PACKET_SIZE 1 203#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
200#define DCCP_SOCKOPT_SERVICE 2 204#define DCCP_SOCKOPT_SERVICE 2
201#define DCCP_SOCKOPT_CHANGE_L 3 205#define DCCP_SOCKOPT_CHANGE_L 3
202#define DCCP_SOCKOPT_CHANGE_R 4 206#define DCCP_SOCKOPT_CHANGE_R 4
207#define DCCP_SOCKOPT_SEND_CSCOV 10
208#define DCCP_SOCKOPT_RECV_CSCOV 11
203#define DCCP_SOCKOPT_CCID_RX_INFO 128 209#define DCCP_SOCKOPT_CCID_RX_INFO 128
204#define DCCP_SOCKOPT_CCID_TX_INFO 192 210#define DCCP_SOCKOPT_CCID_TX_INFO 192
205 211
212/* maximum number of services provided on the same listening port */
206#define DCCP_SERVICE_LIST_MAX_LEN 32 213#define DCCP_SERVICE_LIST_MAX_LEN 32
207 214
208#ifdef __KERNEL__ 215#ifdef __KERNEL__
@@ -256,6 +263,13 @@ static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
256 return (struct dccp_hdr *)skb->h.raw; 263 return (struct dccp_hdr *)skb->h.raw;
257} 264}
258 265
266static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
267{
268 skb->h.raw = skb_push(skb, headlen);
269 memset(skb->h.raw, 0, headlen);
270 return dccp_hdr(skb);
271}
272
259static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb) 273static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb)
260{ 274{
261 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); 275 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr));
@@ -342,6 +356,9 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
342 * @dccpms_ccid - Congestion Control Id (CCID) (section 10) 356 * @dccpms_ccid - Congestion Control Id (CCID) (section 10)
343 * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5) 357 * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5)
344 * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2) 358 * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2)
359 * @dccpms_ack_ratio - Ack Ratio Feature (section 11.3)
360 * @dccpms_pending - List of features being negotiated
361 * @dccpms_conf -
345 */ 362 */
346struct dccp_minisock { 363struct dccp_minisock {
347 __u64 dccpms_sequence_window; 364 __u64 dccpms_sequence_window;
@@ -439,12 +456,25 @@ struct dccp_ackvec;
439 * @dccps_gss - greatest sequence number sent 456 * @dccps_gss - greatest sequence number sent
440 * @dccps_gsr - greatest valid sequence number received 457 * @dccps_gsr - greatest valid sequence number received
441 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss 458 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
459 * @dccps_service - first (passive sock) or unique (active sock) service code
460 * @dccps_service_list - second .. last service code on passive socket
442 * @dccps_timestamp_time - time of latest TIMESTAMP option 461 * @dccps_timestamp_time - time of latest TIMESTAMP option
443 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 462 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
444 * @dccps_packet_size - Set thru setsockopt 463 * @dccps_l_ack_ratio -
445 * @dccps_role - Role of this sock, one of %dccp_role 464 * @dccps_r_ack_ratio -
465 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
466 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
446 * @dccps_ndp_count - number of Non Data Packets since last data packet 467 * @dccps_ndp_count - number of Non Data Packets since last data packet
468 * @dccps_mss_cache -
469 * @dccps_minisock -
447 * @dccps_hc_rx_ackvec - rx half connection ack vector 470 * @dccps_hc_rx_ackvec - rx half connection ack vector
471 * @dccps_hc_rx_ccid -
472 * @dccps_hc_tx_ccid -
473 * @dccps_options_received -
474 * @dccps_epoch -
475 * @dccps_role - Role of this sock, one of %dccp_role
476 * @dccps_hc_rx_insert_options -
477 * @dccps_hc_tx_insert_options -
448 * @dccps_xmit_timer - timer for when CCID is not ready to send 478 * @dccps_xmit_timer - timer for when CCID is not ready to send
449 */ 479 */
450struct dccp_sock { 480struct dccp_sock {
@@ -464,9 +494,10 @@ struct dccp_sock {
464 struct dccp_service_list *dccps_service_list; 494 struct dccp_service_list *dccps_service_list;
465 struct timeval dccps_timestamp_time; 495 struct timeval dccps_timestamp_time;
466 __u32 dccps_timestamp_echo; 496 __u32 dccps_timestamp_echo;
467 __u32 dccps_packet_size;
468 __u16 dccps_l_ack_ratio; 497 __u16 dccps_l_ack_ratio;
469 __u16 dccps_r_ack_ratio; 498 __u16 dccps_r_ack_ratio;
499 __u16 dccps_pcslen;
500 __u16 dccps_pcrlen;
470 unsigned long dccps_ndp_count; 501 unsigned long dccps_ndp_count;
471 __u32 dccps_mss_cache; 502 __u32 dccps_mss_cache;
472 struct dccp_minisock dccps_minisock; 503 struct dccp_minisock dccps_minisock;
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 952bee79a8f3..a1c10b0c4cf0 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -24,7 +24,7 @@ extern int debug_locks_off(void);
24 int __ret = 0; \ 24 int __ret = 0; \
25 \ 25 \
26 if (unlikely(c)) { \ 26 if (unlikely(c)) { \
27 if (debug_locks_off()) \ 27 if (debug_locks_silent || debug_locks_off()) \
28 WARN_ON(1); \ 28 WARN_ON(1); \
29 __ret = 1; \ 29 __ret = 1; \
30 } \ 30 } \
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index 561e2a77805c..55d1ca5e60f5 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -30,7 +30,7 @@
30#ifdef CONFIG_TASK_DELAY_ACCT 30#ifdef CONFIG_TASK_DELAY_ACCT
31 31
32extern int delayacct_on; /* Delay accounting turned on/off */ 32extern int delayacct_on; /* Delay accounting turned on/off */
33extern kmem_cache_t *delayacct_cache; 33extern struct kmem_cache *delayacct_cache;
34extern void delayacct_init(void); 34extern void delayacct_init(void);
35extern void __delayacct_tsk_init(struct task_struct *); 35extern void __delayacct_tsk_init(struct task_struct *);
36extern void __delayacct_tsk_exit(struct task_struct *); 36extern void __delayacct_tsk_exit(struct task_struct *);
diff --git a/include/linux/device.h b/include/linux/device.h
index 9d4f6a963936..49ab53ce92dc 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -21,6 +21,7 @@
21#include <linux/pm.h> 21#include <linux/pm.h>
22#include <asm/semaphore.h> 22#include <asm/semaphore.h>
23#include <asm/atomic.h> 23#include <asm/atomic.h>
24#include <asm/device.h>
24 25
25#define DEVICE_NAME_SIZE 50 26#define DEVICE_NAME_SIZE 50
26#define DEVICE_NAME_HALF __stringify(20) /* Less than half to accommodate slop */ 27#define DEVICE_NAME_HALF __stringify(20) /* Less than half to accommodate slop */
@@ -42,6 +43,8 @@ struct bus_type {
42 struct klist klist_devices; 43 struct klist klist_devices;
43 struct klist klist_drivers; 44 struct klist klist_drivers;
44 45
46 struct blocking_notifier_head bus_notifier;
47
45 struct bus_attribute * bus_attrs; 48 struct bus_attribute * bus_attrs;
46 struct device_attribute * dev_attrs; 49 struct device_attribute * dev_attrs;
47 struct driver_attribute * drv_attrs; 50 struct driver_attribute * drv_attrs;
@@ -75,6 +78,29 @@ int __must_check bus_for_each_drv(struct bus_type *bus,
75 struct device_driver *start, void *data, 78 struct device_driver *start, void *data,
76 int (*fn)(struct device_driver *, void *)); 79 int (*fn)(struct device_driver *, void *));
77 80
81/*
82 * Bus notifiers: Get notified of addition/removal of devices
83 * and binding/unbinding of drivers to devices.
84 * In the long run, it should be a replacement for the platform
85 * notify hooks.
86 */
87struct notifier_block;
88
89extern int bus_register_notifier(struct bus_type *bus,
90 struct notifier_block *nb);
91extern int bus_unregister_notifier(struct bus_type *bus,
92 struct notifier_block *nb);
93
94/* All 4 notifers below get called with the target struct device *
95 * as an argument. Note that those functions are likely to be called
96 * with the device semaphore held in the core, so be careful.
97 */
98#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
99#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */
100#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */
101#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
102 unbound */
103
78/* driverfs interface for exporting bus attributes */ 104/* driverfs interface for exporting bus attributes */
79 105
80struct bus_attribute { 106struct bus_attribute {
@@ -343,10 +369,11 @@ struct device {
343 void *driver_data; /* data private to the driver */ 369 void *driver_data; /* data private to the driver */
344 void *platform_data; /* Platform specific data, device 370 void *platform_data; /* Platform specific data, device
345 core doesn't touch it */ 371 core doesn't touch it */
346 void *firmware_data; /* Firmware specific data (e.g. ACPI,
347 BIOS data),reserved for device core*/
348 struct dev_pm_info power; 372 struct dev_pm_info power;
349 373
374#ifdef CONFIG_NUMA
375 int numa_node; /* NUMA node this device is close to */
376#endif
350 u64 *dma_mask; /* dma mask (if dma'able device) */ 377 u64 *dma_mask; /* dma mask (if dma'able device) */
351 u64 coherent_dma_mask;/* Like dma_mask, but for 378 u64 coherent_dma_mask;/* Like dma_mask, but for
352 alloc_coherent mappings as 379 alloc_coherent mappings as
@@ -358,6 +385,8 @@ struct device {
358 385
359 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 386 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
360 override */ 387 override */
388 /* arch specific additions */
389 struct dev_archdata archdata;
361 390
362 /* class_device migration path */ 391 /* class_device migration path */
363 struct list_head node; 392 struct list_head node;
@@ -368,6 +397,25 @@ struct device {
368 void (*release)(struct device * dev); 397 void (*release)(struct device * dev);
369}; 398};
370 399
400#ifdef CONFIG_NUMA
401static inline int dev_to_node(struct device *dev)
402{
403 return dev->numa_node;
404}
405static inline void set_dev_node(struct device *dev, int node)
406{
407 dev->numa_node = node;
408}
409#else
410static inline int dev_to_node(struct device *dev)
411{
412 return -1;
413}
414static inline void set_dev_node(struct device *dev, int node)
415{
416}
417#endif
418
371static inline void * 419static inline void *
372dev_get_drvdata (struct device *dev) 420dev_get_drvdata (struct device *dev)
373{ 421{
@@ -395,7 +443,10 @@ extern int __must_check device_add(struct device * dev);
395extern void device_del(struct device * dev); 443extern void device_del(struct device * dev);
396extern int device_for_each_child(struct device *, void *, 444extern int device_for_each_child(struct device *, void *,
397 int (*fn)(struct device *, void *)); 445 int (*fn)(struct device *, void *));
446extern struct device *device_find_child(struct device *, void *data,
447 int (*match)(struct device *, void *));
398extern int device_rename(struct device *dev, char *new_name); 448extern int device_rename(struct device *dev, char *new_name);
449extern int device_move(struct device *dev, struct device *new_parent);
399 450
400/* 451/*
401 * Manual binding of a device to driver. See drivers/base/bus.c 452 * Manual binding of a device to driver. See drivers/base/bus.c
@@ -415,8 +466,6 @@ extern struct device *device_create(struct class *cls, struct device *parent,
415 __attribute__((format(printf,4,5))); 466 __attribute__((format(printf,4,5)));
416extern void device_destroy(struct class *cls, dev_t devt); 467extern void device_destroy(struct class *cls, dev_t devt);
417 468
418extern int virtual_device_parent(struct device *dev);
419
420/* 469/*
421 * Platform "fixup" functions - allow the platform to have their say 470 * Platform "fixup" functions - allow the platform to have their say
422 * about devices and actions that the general device layer doesn't 471 * about devices and actions that the general device layer doesn't
diff --git a/include/linux/divert.h b/include/linux/divert.h
deleted file mode 100644
index 8fb4e9de6843..000000000000
--- a/include/linux/divert.h
+++ /dev/null
@@ -1,132 +0,0 @@
1/*
2 * Frame Diversion, Benoit Locher <Benoit.Locher@skf.com>
3 *
4 * Changes:
5 * 06/09/2000 BL: initial version
6 *
7 */
8
9#ifndef _LINUX_DIVERT_H
10#define _LINUX_DIVERT_H
11
12#include <asm/types.h>
13
14#define MAX_DIVERT_PORTS 8 /* Max number of ports to divert (tcp, udp) */
15
16/* Divertable protocols */
17#define DIVERT_PROTO_NONE 0x0000
18#define DIVERT_PROTO_IP 0x0001
19#define DIVERT_PROTO_ICMP 0x0002
20#define DIVERT_PROTO_TCP 0x0004
21#define DIVERT_PROTO_UDP 0x0008
22
23/*
24 * This is an Ethernet Frame Diverter option block
25 */
26struct divert_blk
27{
28 int divert; /* are we active */
29 unsigned int protos; /* protocols */
30 __u16 tcp_dst[MAX_DIVERT_PORTS]; /* specific tcp dst ports to divert */
31 __u16 tcp_src[MAX_DIVERT_PORTS]; /* specific tcp src ports to divert */
32 __u16 udp_dst[MAX_DIVERT_PORTS]; /* specific udp dst ports to divert */
33 __u16 udp_src[MAX_DIVERT_PORTS]; /* specific udp src ports to divert */
34};
35
36/*
37 * Diversion control block, for configuration with the userspace tool
38 * divert
39 */
40
41typedef union _divert_cf_arg
42{
43 __s16 int16;
44 __u16 uint16;
45 __s32 int32;
46 __u32 uint32;
47 __s64 int64;
48 __u64 uint64;
49 void __user *ptr;
50} divert_cf_arg;
51
52
53struct divert_cf
54{
55 int cmd; /* Command */
56 divert_cf_arg arg1,
57 arg2,
58 arg3;
59 int dev_index; /* device index (eth0=0, etc...) */
60};
61
62
63/* Diversion commands */
64#define DIVCMD_DIVERT 1 /* ENABLE/DISABLE diversion */
65#define DIVCMD_IP 2 /* ENABLE/DISABLE whold IP diversion */
66#define DIVCMD_TCP 3 /* ENABLE/DISABLE whold TCP diversion */
67#define DIVCMD_TCPDST 4 /* ADD/REMOVE TCP DST port for diversion */
68#define DIVCMD_TCPSRC 5 /* ADD/REMOVE TCP SRC port for diversion */
69#define DIVCMD_UDP 6 /* ENABLE/DISABLE whole UDP diversion */
70#define DIVCMD_UDPDST 7 /* ADD/REMOVE UDP DST port for diversion */
71#define DIVCMD_UDPSRC 8 /* ADD/REMOVE UDP SRC port for diversion */
72#define DIVCMD_ICMP 9 /* ENABLE/DISABLE whole ICMP diversion */
73#define DIVCMD_GETSTATUS 10 /* GET the status of the diverter */
74#define DIVCMD_RESET 11 /* Reset the diverter on the specified dev */
75#define DIVCMD_GETVERSION 12 /* Retrieve the diverter code version (char[32]) */
76
77/* General syntax of the commands:
78 *
79 * DIVCMD_xxxxxx(arg1, arg2, arg3, dev_index)
80 *
81 * SIOCSIFDIVERT:
82 * DIVCMD_DIVERT(DIVARG1_ENABLE|DIVARG1_DISABLE, , ,ifindex)
83 * DIVCMD_IP(DIVARG1_ENABLE|DIVARG1_DISABLE, , , ifindex)
84 * DIVCMD_TCP(DIVARG1_ENABLE|DIVARG1_DISABLE, , , ifindex)
85 * DIVCMD_TCPDST(DIVARG1_ADD|DIVARG1_REMOVE, port, , ifindex)
86 * DIVCMD_TCPSRC(DIVARG1_ADD|DIVARG1_REMOVE, port, , ifindex)
87 * DIVCMD_UDP(DIVARG1_ENABLE|DIVARG1_DISABLE, , , ifindex)
88 * DIVCMD_UDPDST(DIVARG1_ADD|DIVARG1_REMOVE, port, , ifindex)
89 * DIVCMD_UDPSRC(DIVARG1_ADD|DIVARG1_REMOVE, port, , ifindex)
90 * DIVCMD_ICMP(DIVARG1_ENABLE|DIVARG1_DISABLE, , , ifindex)
91 * DIVCMD_RESET(, , , ifindex)
92 *
93 * SIOGIFDIVERT:
94 * DIVCMD_GETSTATUS(divert_blk, , , ifindex)
95 * DIVCMD_GETVERSION(string[3])
96 */
97
98
99/* Possible values for arg1 */
100#define DIVARG1_ENABLE 0 /* ENABLE something */
101#define DIVARG1_DISABLE 1 /* DISABLE something */
102#define DIVARG1_ADD 2 /* ADD something */
103#define DIVARG1_REMOVE 3 /* REMOVE something */
104
105
106#ifdef __KERNEL__
107
108/* diverter functions */
109#include <linux/skbuff.h>
110
111#ifdef CONFIG_NET_DIVERT
112#include <linux/netdevice.h>
113
114int alloc_divert_blk(struct net_device *);
115void free_divert_blk(struct net_device *);
116int divert_ioctl(unsigned int cmd, struct divert_cf __user *arg);
117void divert_frame(struct sk_buff *skb);
118static inline void handle_diverter(struct sk_buff *skb)
119{
120 /* if diversion is supported on device, then divert */
121 if (skb->dev->divert && skb->dev->divert->divert)
122 divert_frame(skb);
123}
124
125#else
126# define alloc_divert_blk(dev) (0)
127# define free_divert_blk(dev) do {} while (0)
128# define divert_ioctl(cmd, arg) (-ENOPKG)
129# define handle_diverter(skb) do {} while (0)
130#endif
131#endif
132#endif /* _LINUX_DIVERT_H */
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 66d621dbcb6c..df1c91855f0e 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -300,8 +300,9 @@ extern int efi_mem_attribute_range (unsigned long phys_addr, unsigned long size,
300extern int __init efi_uart_console_only (void); 300extern int __init efi_uart_console_only (void);
301extern void efi_initialize_iomem_resources(struct resource *code_resource, 301extern void efi_initialize_iomem_resources(struct resource *code_resource,
302 struct resource *data_resource); 302 struct resource *data_resource);
303extern unsigned long __init efi_get_time(void); 303extern unsigned long efi_get_time(void);
304extern int __init efi_set_rtc_mmss(unsigned long nowtime); 304extern int __init efi_set_rtc_mmss(unsigned long nowtime);
305extern int is_available_memory(efi_memory_desc_t * md);
305extern struct efi_memory_map memmap; 306extern struct efi_memory_map memmap;
306 307
307/** 308/**
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 2fa9f1144228..a24931d24404 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -21,11 +21,11 @@ typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *);
21typedef int (elevator_may_queue_fn) (request_queue_t *, int); 21typedef int (elevator_may_queue_fn) (request_queue_t *, int);
22 22
23typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, gfp_t); 23typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, gfp_t);
24typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); 24typedef void (elevator_put_req_fn) (struct request *);
25typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); 25typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *);
26typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); 26typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
27 27
28typedef void *(elevator_init_fn) (request_queue_t *, elevator_t *); 28typedef void *(elevator_init_fn) (request_queue_t *);
29typedef void (elevator_exit_fn) (elevator_t *); 29typedef void (elevator_exit_fn) (elevator_t *);
30 30
31struct elevator_ops 31struct elevator_ops
diff --git a/include/linux/elf.h b/include/linux/elf.h
index b70d1d2c8d28..60713e6ea297 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -6,6 +6,8 @@
6#include <linux/elf-em.h> 6#include <linux/elf-em.h>
7#include <asm/elf.h> 7#include <asm/elf.h>
8 8
9struct file;
10
9#ifndef elf_read_implies_exec 11#ifndef elf_read_implies_exec
10 /* Executables for which elf_read_implies_exec() returns TRUE will 12 /* Executables for which elf_read_implies_exec() returns TRUE will
11 have the READ_IMPLIES_EXEC personality flag set automatically. 13 have the READ_IMPLIES_EXEC personality flag set automatically.
@@ -358,6 +360,7 @@ extern Elf32_Dyn _DYNAMIC [];
358#define elfhdr elf32_hdr 360#define elfhdr elf32_hdr
359#define elf_phdr elf32_phdr 361#define elf_phdr elf32_phdr
360#define elf_note elf32_note 362#define elf_note elf32_note
363#define elf_addr_t Elf32_Off
361 364
362#else 365#else
363 366
@@ -365,8 +368,16 @@ extern Elf64_Dyn _DYNAMIC [];
365#define elfhdr elf64_hdr 368#define elfhdr elf64_hdr
366#define elf_phdr elf64_phdr 369#define elf_phdr elf64_phdr
367#define elf_note elf64_note 370#define elf_note elf64_note
371#define elf_addr_t Elf64_Off
368 372
369#endif 373#endif
370 374
375#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
376static inline int arch_notes_size(void) { return 0; }
377static inline void arch_write_notes(struct file *file) { }
378
379#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size()
380#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file)
381#endif /* ARCH_HAVE_EXTRA_ELF_NOTES */
371 382
372#endif /* _LINUX_ELF_H */ 383#endif /* _LINUX_ELF_H */
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index ce0e6109aff0..8c43b13a02fe 100644
--- a/include/linux/ext3_jbd.h
+++ b/include/linux/ext3_jbd.h
@@ -109,74 +109,32 @@ int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode);
109 * been done yet. 109 * been done yet.
110 */ 110 */
111 111
112void ext3_journal_abort_handle(const char *caller, const char *err_fn, 112static inline void ext3_journal_release_buffer(handle_t *handle,
113 struct buffer_head *bh, handle_t *handle, int err); 113 struct buffer_head *bh)
114
115static inline int
116__ext3_journal_get_undo_access(const char *where, handle_t *handle,
117 struct buffer_head *bh)
118{ 114{
119 int err = journal_get_undo_access(handle, bh); 115 journal_release_buffer(handle, bh);
120 if (err)
121 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
122 return err;
123} 116}
124 117
125static inline int 118void ext3_journal_abort_handle(const char *caller, const char *err_fn,
126__ext3_journal_get_write_access(const char *where, handle_t *handle, 119 struct buffer_head *bh, handle_t *handle, int err);
127 struct buffer_head *bh)
128{
129 int err = journal_get_write_access(handle, bh);
130 if (err)
131 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
132 return err;
133}
134 120
135static inline void 121int __ext3_journal_get_undo_access(const char *where, handle_t *handle,
136ext3_journal_release_buffer(handle_t *handle, struct buffer_head *bh) 122 struct buffer_head *bh);
137{
138 journal_release_buffer(handle, bh);
139}
140 123
141static inline int 124int __ext3_journal_get_write_access(const char *where, handle_t *handle,
142__ext3_journal_forget(const char *where, handle_t *handle, struct buffer_head *bh) 125 struct buffer_head *bh);
143{
144 int err = journal_forget(handle, bh);
145 if (err)
146 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
147 return err;
148}
149 126
150static inline int 127int __ext3_journal_forget(const char *where, handle_t *handle,
151__ext3_journal_revoke(const char *where, handle_t *handle, 128 struct buffer_head *bh);
152 unsigned long blocknr, struct buffer_head *bh)
153{
154 int err = journal_revoke(handle, blocknr, bh);
155 if (err)
156 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
157 return err;
158}
159 129
160static inline int 130int __ext3_journal_revoke(const char *where, handle_t *handle,
161__ext3_journal_get_create_access(const char *where, 131 unsigned long blocknr, struct buffer_head *bh);
162 handle_t *handle, struct buffer_head *bh)
163{
164 int err = journal_get_create_access(handle, bh);
165 if (err)
166 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
167 return err;
168}
169 132
170static inline int 133int __ext3_journal_get_create_access(const char *where,
171__ext3_journal_dirty_metadata(const char *where, 134 handle_t *handle, struct buffer_head *bh);
172 handle_t *handle, struct buffer_head *bh)
173{
174 int err = journal_dirty_metadata(handle, bh);
175 if (err)
176 ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
177 return err;
178}
179 135
136int __ext3_journal_dirty_metadata(const char *where,
137 handle_t *handle, struct buffer_head *bh);
180 138
181#define ext3_journal_get_undo_access(handle, bh) \ 139#define ext3_journal_get_undo_access(handle, bh) \
182 __ext3_journal_get_undo_access(__FUNCTION__, (handle), (bh)) 140 __ext3_journal_get_undo_access(__FUNCTION__, (handle), (bh))
diff --git a/include/linux/ext4_jbd2.h b/include/linux/ext4_jbd2.h
index 72dd631912e4..d716e6392cf6 100644
--- a/include/linux/ext4_jbd2.h
+++ b/include/linux/ext4_jbd2.h
@@ -114,74 +114,32 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode);
114 * been done yet. 114 * been done yet.
115 */ 115 */
116 116
117void ext4_journal_abort_handle(const char *caller, const char *err_fn, 117static inline void ext4_journal_release_buffer(handle_t *handle,
118 struct buffer_head *bh, handle_t *handle, int err); 118 struct buffer_head *bh)
119
120static inline int
121__ext4_journal_get_undo_access(const char *where, handle_t *handle,
122 struct buffer_head *bh)
123{ 119{
124 int err = jbd2_journal_get_undo_access(handle, bh); 120 jbd2_journal_release_buffer(handle, bh);
125 if (err)
126 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
127 return err;
128} 121}
129 122
130static inline int 123void ext4_journal_abort_handle(const char *caller, const char *err_fn,
131__ext4_journal_get_write_access(const char *where, handle_t *handle, 124 struct buffer_head *bh, handle_t *handle, int err);
132 struct buffer_head *bh)
133{
134 int err = jbd2_journal_get_write_access(handle, bh);
135 if (err)
136 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
137 return err;
138}
139 125
140static inline void 126int __ext4_journal_get_undo_access(const char *where, handle_t *handle,
141ext4_journal_release_buffer(handle_t *handle, struct buffer_head *bh) 127 struct buffer_head *bh);
142{
143 jbd2_journal_release_buffer(handle, bh);
144}
145 128
146static inline int 129int __ext4_journal_get_write_access(const char *where, handle_t *handle,
147__ext4_journal_forget(const char *where, handle_t *handle, struct buffer_head *bh) 130 struct buffer_head *bh);
148{
149 int err = jbd2_journal_forget(handle, bh);
150 if (err)
151 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
152 return err;
153}
154 131
155static inline int 132int __ext4_journal_forget(const char *where, handle_t *handle,
156__ext4_journal_revoke(const char *where, handle_t *handle, 133 struct buffer_head *bh);
157 ext4_fsblk_t blocknr, struct buffer_head *bh)
158{
159 int err = jbd2_journal_revoke(handle, blocknr, bh);
160 if (err)
161 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
162 return err;
163}
164 134
165static inline int 135int __ext4_journal_revoke(const char *where, handle_t *handle,
166__ext4_journal_get_create_access(const char *where, 136 ext4_fsblk_t blocknr, struct buffer_head *bh);
167 handle_t *handle, struct buffer_head *bh)
168{
169 int err = jbd2_journal_get_create_access(handle, bh);
170 if (err)
171 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
172 return err;
173}
174 137
175static inline int 138int __ext4_journal_get_create_access(const char *where,
176__ext4_journal_dirty_metadata(const char *where, 139 handle_t *handle, struct buffer_head *bh);
177 handle_t *handle, struct buffer_head *bh)
178{
179 int err = jbd2_journal_dirty_metadata(handle, bh);
180 if (err)
181 ext4_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
182 return err;
183}
184 140
141int __ext4_journal_dirty_metadata(const char *where,
142 handle_t *handle, struct buffer_head *bh);
185 143
186#define ext4_journal_get_undo_access(handle, bh) \ 144#define ext4_journal_get_undo_access(handle, bh) \
187 __ext4_journal_get_undo_access(__FUNCTION__, (handle), (bh)) 145 __ext4_journal_get_undo_access(__FUNCTION__, (handle), (bh))
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 3e69241e6a81..fa23e0671bb3 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -774,8 +774,8 @@ struct fb_info {
774#endif 774#endif
775 775
776 struct fb_ops *fbops; 776 struct fb_ops *fbops;
777 struct device *device; 777 struct device *device; /* This is the parent */
778 struct class_device *class_device; /* sysfs per device attrs */ 778 struct device *dev; /* This is this fb device */
779 int class_flag; /* private sysfs flags */ 779 int class_flag; /* private sysfs flags */
780#ifdef CONFIG_FB_TILEBLITTING 780#ifdef CONFIG_FB_TILEBLITTING
781 struct fb_tile_ops *tileops; /* Tile Blitting */ 781 struct fb_tile_ops *tileops; /* Tile Blitting */
@@ -910,8 +910,8 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
910/* drivers/video/fbsysfs.c */ 910/* drivers/video/fbsysfs.c */
911extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); 911extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
912extern void framebuffer_release(struct fb_info *info); 912extern void framebuffer_release(struct fb_info *info);
913extern int fb_init_class_device(struct fb_info *fb_info); 913extern int fb_init_device(struct fb_info *fb_info);
914extern void fb_cleanup_class_device(struct fb_info *head); 914extern void fb_cleanup_device(struct fb_info *head);
915extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max); 915extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max);
916 916
917/* drivers/video/fbmon.c */ 917/* drivers/video/fbmon.c */
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 4418c8d9d479..8270aac2aa5d 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -6,6 +6,7 @@
6 6
7/* rule is permanent, and cannot be deleted */ 7/* rule is permanent, and cannot be deleted */
8#define FIB_RULE_PERMANENT 1 8#define FIB_RULE_PERMANENT 1
9#define FIB_RULE_INVERT 2
9 10
10struct fib_rule_hdr 11struct fib_rule_hdr
11{ 12{
@@ -34,7 +35,7 @@ enum
34 FRA_UNUSED3, 35 FRA_UNUSED3,
35 FRA_UNUSED4, 36 FRA_UNUSED4,
36 FRA_UNUSED5, 37 FRA_UNUSED5,
37 FRA_FWMARK, /* netfilter mark */ 38 FRA_FWMARK, /* mark */
38 FRA_FLOW, /* flow/class id */ 39 FRA_FLOW, /* flow/class id */
39 FRA_UNUSED6, 40 FRA_UNUSED6,
40 FRA_UNUSED7, 41 FRA_UNUSED7,
diff --git a/include/linux/file.h b/include/linux/file.h
index 74183e6f7f45..6e77b9177f9e 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -64,6 +64,8 @@ struct files_struct {
64 64
65#define files_fdtable(files) (rcu_dereference((files)->fdt)) 65#define files_fdtable(files) (rcu_dereference((files)->fdt))
66 66
67extern struct kmem_cache *filp_cachep;
68
67extern void FASTCALL(__fput(struct file *)); 69extern void FASTCALL(__fput(struct file *));
68extern void FASTCALL(fput(struct file *)); 70extern void FASTCALL(fput(struct file *));
69 71
@@ -114,4 +116,6 @@ struct files_struct *get_files_struct(struct task_struct *);
114void FASTCALL(put_files_struct(struct files_struct *fs)); 116void FASTCALL(put_files_struct(struct files_struct *fs));
115void reset_files_struct(struct task_struct *, struct files_struct *); 117void reset_files_struct(struct task_struct *, struct files_struct *);
116 118
119extern struct kmem_cache *files_cachep;
120
117#endif /* __LINUX_FILE_H */ 121#endif /* __LINUX_FILE_H */
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
new file mode 100644
index 000000000000..6e05e3e7ce39
--- /dev/null
+++ b/include/linux/freezer.h
@@ -0,0 +1,87 @@
1/* Freezer declarations */
2
3#ifdef CONFIG_PM
4/*
5 * Check if a process has been frozen
6 */
7static inline int frozen(struct task_struct *p)
8{
9 return p->flags & PF_FROZEN;
10}
11
12/*
13 * Check if there is a request to freeze a process
14 */
15static inline int freezing(struct task_struct *p)
16{
17 return p->flags & PF_FREEZE;
18}
19
20/*
21 * Request that a process be frozen
22 * FIXME: SMP problem. We may not modify other process' flags!
23 */
24static inline void freeze(struct task_struct *p)
25{
26 p->flags |= PF_FREEZE;
27}
28
29/*
30 * Sometimes we may need to cancel the previous 'freeze' request
31 */
32static inline void do_not_freeze(struct task_struct *p)
33{
34 p->flags &= ~PF_FREEZE;
35}
36
37/*
38 * Wake up a frozen process
39 */
40static inline int thaw_process(struct task_struct *p)
41{
42 if (frozen(p)) {
43 p->flags &= ~PF_FROZEN;
44 wake_up_process(p);
45 return 1;
46 }
47 return 0;
48}
49
50/*
51 * freezing is complete, mark process as frozen
52 */
53static inline void frozen_process(struct task_struct *p)
54{
55 p->flags = (p->flags & ~PF_FREEZE) | PF_FROZEN;
56}
57
58extern void refrigerator(void);
59extern int freeze_processes(void);
60extern void thaw_processes(void);
61
62static inline int try_to_freeze(void)
63{
64 if (freezing(current)) {
65 refrigerator();
66 return 1;
67 } else
68 return 0;
69}
70
71extern void thaw_some_processes(int all);
72
73#else
74static inline int frozen(struct task_struct *p) { return 0; }
75static inline int freezing(struct task_struct *p) { return 0; }
76static inline void freeze(struct task_struct *p) { BUG(); }
77static inline int thaw_process(struct task_struct *p) { return 1; }
78static inline void frozen_process(struct task_struct *p) { BUG(); }
79
80static inline void refrigerator(void) {}
81static inline int freeze_processes(void) { BUG(); return 0; }
82static inline void thaw_processes(void) {}
83
84static inline int try_to_freeze(void) { return 0; }
85
86
87#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2fe6e3f900ba..70b99fbb560b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -276,7 +276,7 @@ extern int dir_notify_enable;
276#include <linux/radix-tree.h> 276#include <linux/radix-tree.h>
277#include <linux/prio_tree.h> 277#include <linux/prio_tree.h>
278#include <linux/init.h> 278#include <linux/init.h>
279#include <linux/sched.h> 279#include <linux/pid.h>
280#include <linux/mutex.h> 280#include <linux/mutex.h>
281 281
282#include <asm/atomic.h> 282#include <asm/atomic.h>
@@ -543,19 +543,22 @@ struct inode {
543 struct list_head i_dentry; 543 struct list_head i_dentry;
544 unsigned long i_ino; 544 unsigned long i_ino;
545 atomic_t i_count; 545 atomic_t i_count;
546 umode_t i_mode;
547 unsigned int i_nlink; 546 unsigned int i_nlink;
548 uid_t i_uid; 547 uid_t i_uid;
549 gid_t i_gid; 548 gid_t i_gid;
550 dev_t i_rdev; 549 dev_t i_rdev;
550 unsigned long i_version;
551 loff_t i_size; 551 loff_t i_size;
552#ifdef __NEED_I_SIZE_ORDERED
553 seqcount_t i_size_seqcount;
554#endif
552 struct timespec i_atime; 555 struct timespec i_atime;
553 struct timespec i_mtime; 556 struct timespec i_mtime;
554 struct timespec i_ctime; 557 struct timespec i_ctime;
555 unsigned int i_blkbits; 558 unsigned int i_blkbits;
556 unsigned long i_version;
557 blkcnt_t i_blocks; 559 blkcnt_t i_blocks;
558 unsigned short i_bytes; 560 unsigned short i_bytes;
561 umode_t i_mode;
559 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 562 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
560 struct mutex i_mutex; 563 struct mutex i_mutex;
561 struct rw_semaphore i_alloc_sem; 564 struct rw_semaphore i_alloc_sem;
@@ -598,9 +601,6 @@ struct inode {
598 void *i_security; 601 void *i_security;
599#endif 602#endif
600 void *i_private; /* fs or device private pointer */ 603 void *i_private; /* fs or device private pointer */
601#ifdef __NEED_I_SIZE_ORDERED
602 seqcount_t i_size_seqcount;
603#endif
604}; 604};
605 605
606/* 606/*
@@ -636,7 +636,7 @@ extern void inode_double_unlock(struct inode *inode1, struct inode *inode2);
636 * cmpxchg8b without the need of the lock prefix). For SMP compiles 636 * cmpxchg8b without the need of the lock prefix). For SMP compiles
637 * and 64bit archs it makes no difference if preempt is enabled or not. 637 * and 64bit archs it makes no difference if preempt is enabled or not.
638 */ 638 */
639static inline loff_t i_size_read(struct inode *inode) 639static inline loff_t i_size_read(const struct inode *inode)
640{ 640{
641#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 641#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
642 loff_t i_size; 642 loff_t i_size;
@@ -679,12 +679,12 @@ static inline void i_size_write(struct inode *inode, loff_t i_size)
679#endif 679#endif
680} 680}
681 681
682static inline unsigned iminor(struct inode *inode) 682static inline unsigned iminor(const struct inode *inode)
683{ 683{
684 return MINOR(inode->i_rdev); 684 return MINOR(inode->i_rdev);
685} 685}
686 686
687static inline unsigned imajor(struct inode *inode) 687static inline unsigned imajor(const struct inode *inode)
688{ 688{
689 return MAJOR(inode->i_rdev); 689 return MAJOR(inode->i_rdev);
690} 690}
@@ -977,36 +977,13 @@ enum {
977#define vfs_check_frozen(sb, level) \ 977#define vfs_check_frozen(sb, level) \
978 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) 978 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
979 979
980static inline void get_fs_excl(void) 980#define get_fs_excl() atomic_inc(&current->fs_excl)
981{ 981#define put_fs_excl() atomic_dec(&current->fs_excl)
982 atomic_inc(&current->fs_excl); 982#define has_fs_excl() atomic_read(&current->fs_excl)
983}
984
985static inline void put_fs_excl(void)
986{
987 atomic_dec(&current->fs_excl);
988}
989
990static inline int has_fs_excl(void)
991{
992 return atomic_read(&current->fs_excl);
993}
994 983
995 984/* not quite ready to be deprecated, but... */
996/* 985extern void lock_super(struct super_block *);
997 * Superblock locking. 986extern void unlock_super(struct super_block *);
998 */
999static inline void lock_super(struct super_block * sb)
1000{
1001 get_fs_excl();
1002 mutex_lock(&sb->s_lock);
1003}
1004
1005static inline void unlock_super(struct super_block * sb)
1006{
1007 put_fs_excl();
1008 mutex_unlock(&sb->s_lock);
1009}
1010 987
1011/* 988/*
1012 * VFS helper functions.. 989 * VFS helper functions..
@@ -1504,7 +1481,9 @@ extern char * getname(const char __user *);
1504extern void __init vfs_caches_init_early(void); 1481extern void __init vfs_caches_init_early(void);
1505extern void __init vfs_caches_init(unsigned long); 1482extern void __init vfs_caches_init(unsigned long);
1506 1483
1507#define __getname() kmem_cache_alloc(names_cachep, SLAB_KERNEL) 1484extern struct kmem_cache *names_cachep;
1485
1486#define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL)
1508#define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) 1487#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
1509#ifndef CONFIG_AUDITSYSCALL 1488#ifndef CONFIG_AUDITSYSCALL
1510#define putname(name) __putname(name) 1489#define putname(name) __putname(name)
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index c623d12a486e..11a36ceddf73 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -18,6 +18,8 @@ struct fs_struct {
18 .umask = 0022, \ 18 .umask = 0022, \
19} 19}
20 20
21extern struct kmem_cache *fs_cachep;
22
21extern void exit_fs(struct task_struct *); 23extern void exit_fs(struct task_struct *);
22extern void set_fs_altroot(void); 24extern void set_fs_altroot(void);
23extern void set_fs_root(struct fs_struct *, struct vfsmount *, struct dentry *); 25extern void set_fs_root(struct fs_struct *, struct vfsmount *, struct dentry *);
diff --git a/include/linux/ftape-header-segment.h b/include/linux/ftape-header-segment.h
deleted file mode 100644
index 4732218f0708..000000000000
--- a/include/linux/ftape-header-segment.h
+++ /dev/null
@@ -1,122 +0,0 @@
1#ifndef _FTAPE_HEADER_SEGMENT_H
2#define _FTAPE_HEADER_SEGMENT_H
3
4/*
5 * Copyright (C) 1996-1997 Claus-Justus Heine.
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, or (at your option)
10 any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 *
22 * $Source: /homes/cvs/ftape-stacked/include/linux/ftape-header-segment.h,v $
23 * $Revision: 1.2 $
24 * $Date: 1997/10/05 19:19:28 $
25 *
26 * This file defines some offsets into the header segment of a
27 * floppy tape cartridge. For use with the QIC-40/80/3010/3020
28 * floppy-tape driver "ftape" for Linux.
29 */
30
31#define FT_SIGNATURE 0 /* must be 0xaa55aa55 */
32#define FT_FMT_CODE 4
33#define FT_REV_LEVEL 5 /* only for QIC-80 since. Rev. L (== 0x0c) */
34#define FT_HSEG_1 6 /* first header segment, except for format code 6 */
35#define FT_HSEG_2 8 /* second header segment, except for format code 6 */
36#define FT_FRST_SEG 10 /* first data segment, except for format code 6 */
37#define FT_LAST_SEG 12 /* last data segment, except for format code 6 */
38#define FT_FMT_DATE 14 /* date and time of most recent format, see below */
39#define FT_WR_DATE 18 /* date and time of most recent write or format */
40#define FT_SPT 24 /* segments per track */
41#define FT_TPC 26 /* tracks per cartridge */
42#define FT_FHM 27 /* floppy drive head (maximum of it) */
43#define FT_FTM 28 /* floppy track max. */
44#define FT_FSM 29 /* floppy sector max. (128) */
45#define FT_LABEL 30 /* floppy tape label */
46#define FT_LABEL_DATE 74 /* date and time the tape label was written */
47#define FT_LABEL_SZ (FT_LABEL_DATE - FT_LABEL)
48#define FT_CMAP_START 78 /* starting segment of compression map */
49#define FT_FMT_ERROR 128 /* must be set to 0xff if remainder gets lost during
50 * tape format
51 */
52#define FT_SEG_CNT 130 /* number of seg. written, formatted or verified
53 * through lifetime of tape (why not read?)
54 */
55#define FT_INIT_DATE 138 /* date and time of initial tape format */
56#define FT_FMT_CNT 142 /* number of times tape has been formatted */
57#define FT_FSL_CNT 144 /* number of segments in failed sector log */
58#define FT_MK_CODE 146 /* id string of tape manufacturer */
59#define FT_LOT_CODE 190 /* tape manufacturer lot code */
60#define FT_6_HSEG_1 234 /* first header segment for format code 6 */
61#define FT_6_HSEG_2 238 /* second header segment for format code 6 */
62#define FT_6_FRST_SEG 242 /* first data segment for format code 6 */
63#define FT_6_LAST_SEG 246 /* last data segment for format code 6 */
64
65#define FT_FSL 256
66#define FT_HEADER_END 256 /* space beyond this point:
67 * format codes 2, 3 and 5:
68 * - failed sector log until byte 2047
69 * - bad sector map in the reamining part of segment
70 * format codes 4 and 6:
71 * - bad sector map starts hear
72 */
73
74
75/* value to be stored at the FT_SIGNATURE offset
76 */
77#define FT_HSEG_MAGIC 0xaa55aa55
78#define FT_D2G_MAGIC 0x82288228 /* Ditto 2GB */
79
80/* data and time encoding: */
81#define FT_YEAR_SHIFT 25
82#define FT_YEAR_MASK 0xfe000000
83#define FT_YEAR_0 1970
84#define FT_YEAR_MAX 127
85#define FT_YEAR(year) ((((year)-FT_YEAR_0)<<FT_YEAR_SHIFT)&FT_YEAR_MASK)
86
87#define FT_TIME_SHIFT 0
88#define FT_TIME_MASK 0x01FFFFFF
89#define FT_TIME_MAX 0x01ea6dff /* last second of a year */
90#define FT_TIME(mo,d,h,m,s) \
91 ((((s)+60*((m)+60*((h)+24*((d)+31*(mo))))) & FT_TIME_MASK))
92
93#define FT_TIME_STAMP(y,mo,d,h,m,s) (FT_YEAR(y) | FT_TIME(mo,d,h,m,s))
94
95/* values for the format code field */
96typedef enum {
97 fmt_normal = 2, /* QIC-80 post Rev. B 205Ft or 307Ft tape */
98 fmt_1100ft = 3, /* QIC-80 post Rev. B 1100Ft tape */
99 fmt_var = 4, /* QIC-80 post Rev. B variabel length format */
100 fmt_425ft = 5, /* QIC-80 post Rev. B 425Ft tape */
101 fmt_big = 6 /* QIC-3010/3020 variable length tape with more
102 * than 2^16 segments per tape
103 */
104} ft_format_type;
105
106/* definitions for the failed sector log */
107#define FT_FSL_SIZE (2 * FT_SECTOR_SIZE - FT_HEADER_END)
108#define FT_FSL_MAX_ENTRIES (FT_FSL_SIZE/sizeof(__u32))
109
110typedef struct ft_fsl_entry {
111 __u16 segment;
112 __u16 date;
113} __attribute__ ((packed)) ft_fsl_entry;
114
115
116/* date encoding for the failed sector log
117 * month: 1..12, day: 1..31, year: 1970..2097
118 */
119#define FT_FSL_TIME_STAMP(y,m,d) \
120 (((((y) - FT_YEAR_0)<<9)&0xfe00) | (((m)<<5)&0x01e0) | ((d)&0x001f))
121
122#endif /* _FTAPE_HEADER_SEGMENT_H */
diff --git a/include/linux/ftape-vendors.h b/include/linux/ftape-vendors.h
deleted file mode 100644
index ec1a81f059e5..000000000000
--- a/include/linux/ftape-vendors.h
+++ /dev/null
@@ -1,137 +0,0 @@
1#ifndef _FTAPE_VENDORS_H
2#define _FTAPE_VENDORS_H
3
4/*
5 * Copyright (C) 1993-1996 Bas Laarhoven,
6 * (C) 1996-1997 Claus-Justus Heine.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 *
23 * $Source: /homes/cvs/ftape-stacked/include/linux/ftape-vendors.h,v $
24 * $Revision: 1.6 $
25 * $Date: 1997/10/09 15:38:11 $
26 *
27 * This file contains the supported drive types with their
28 * QIC-117 spec. vendor code and drive dependent configuration
29 * information.
30 */
31
32typedef enum {
33 unknown_wake_up = 0,
34 no_wake_up,
35 wake_up_colorado,
36 wake_up_mountain,
37 wake_up_insight,
38} wake_up_types;
39
40typedef struct {
41 wake_up_types wake_up; /* see wake_up_types */
42 char *name; /* Text describing the drive */
43} wakeup_method;
44
45/* Note: order of entries in WAKEUP_METHODS must be so that a variable
46 * of type wake_up_types can be used as an index in the array.
47 */
48#define WAKEUP_METHODS { \
49 { unknown_wake_up, "Unknown" }, \
50 { no_wake_up, "None" }, \
51 { wake_up_colorado, "Colorado" }, \
52 { wake_up_mountain, "Mountain" }, \
53 { wake_up_insight, "Motor-on" }, \
54}
55
56typedef struct {
57 unsigned int vendor_id; /* vendor id from drive */
58 int speed; /* maximum tape transport speed (ips) */
59 wake_up_types wake_up; /* see wake_up_types */
60 char *name; /* Text describing the drive */
61} vendor_struct;
62
63#define UNKNOWN_VENDOR (-1)
64
65#define QIC117_VENDORS { \
66/* see _vendor_struct */ \
67 { 0x00000, 82, wake_up_colorado, "Colorado DJ-10 (old)" }, \
68 { 0x00047, 90, wake_up_colorado, "Colorado DJ-10/DJ-20" }, \
69 { 0x011c2, 84, wake_up_colorado, "Colorado 700" }, \
70 { 0x011c3, 90, wake_up_colorado, "Colorado 1400" }, \
71 { 0x011c4, 84, wake_up_colorado, "Colorado DJ-10/DJ-20 (new)" }, \
72 { 0x011c5, 84, wake_up_colorado, "HP Colorado T1000" }, \
73 { 0x011c6, 90, wake_up_colorado, "HP Colorado T3000" }, \
74 { 0x00005, 45, wake_up_mountain, "Archive 5580i" }, \
75 { 0x10005, 50, wake_up_insight, "Insight 80Mb, Irwin 80SX" }, \
76 { 0x00140, 74, wake_up_mountain, "Archive S.Hornet [Identity/Escom]" }, \
77 { 0x00146, 72, wake_up_mountain, "Archive 31250Q [Escom]" }, \
78 { 0x0014a, 100, wake_up_mountain, "Archive XL9250i [Conner/Escom]" }, \
79 { 0x0014c, 98, wake_up_mountain, "Conner C250MQT" }, \
80 { 0x0014e, 80, wake_up_mountain, "Conner C250MQ" }, \
81 { 0x00150, 80, wake_up_mountain, "Conner TSM420R/TST800R" }, \
82 { 0x00152, 80, wake_up_mountain, "Conner TSM850R" }, \
83 { 0x00156, 80, wake_up_mountain, "Conner TSM850R/1700R/TST3200R" }, \
84 { 0x00180, 0, wake_up_mountain, "Summit SE 150" }, \
85 { 0x00181, 85, wake_up_mountain, "Summit SE 250, Mountain FS8000" }, \
86 { 0x001c1, 82, no_wake_up, "Wangtek 3040F" }, \
87 { 0x001c8, 64, no_wake_up, "Wangtek 3080F" }, \
88 { 0x001c8, 64, wake_up_colorado, "Wangtek 3080F" }, \
89 { 0x001ca, 67, no_wake_up, "Wangtek 3080F (new)" }, \
90 { 0x001cc, 77, wake_up_colorado, "Wangtek 3200 / Teac 700" }, \
91 { 0x001cd, 75, wake_up_colorado, "Reveal TB1400" }, \
92 { 0x00380, 85, wake_up_colorado, "Exabyte Eagle-96" }, \
93 { 0x00381, 85, wake_up_colorado, "Exabyte Eagle TR-3" }, \
94 { 0x00382, 85, wake_up_colorado, "Exabyte Eagle TR-3" }, \
95 { 0x003ce, 77, wake_up_colorado, "Teac 800" }, \
96 { 0x003cf, 0, wake_up_colorado, "Teac FT3010TR" }, \
97 { 0x08880, 64, no_wake_up, "Iomega 250, Ditto 800" }, \
98 { 0x08880, 64, wake_up_colorado, "Iomega 250, Ditto 800" }, \
99 { 0x08880, 64, wake_up_insight, "Iomega 250, Ditto 800" }, \
100 { 0x08881, 80, wake_up_colorado, "Iomega 700" }, \
101 { 0x08882, 80, wake_up_colorado, "Iomega 3200" }, \
102 { 0x08883, 80, wake_up_colorado, "Iomega DITTO 2GB" }, \
103 { 0x00021, 70, no_wake_up, "AIWA CT-803" }, \
104 { 0x004c0, 80, no_wake_up, "AIWA TD-S1600" }, \
105 { 0x00021, 0, wake_up_mountain, "COREtape QIC80" }, \
106 { 0x00441, 0, wake_up_mountain, "ComByte DoublePlay" }, \
107 { 0x00481, 127, wake_up_mountain, "PERTEC MyTape 800" }, \
108 { 0x00483, 130, wake_up_mountain, "PERTEC MyTape 3200" }, \
109 { UNKNOWN_VENDOR, 0, no_wake_up, "unknown" } \
110}
111
112#define QIC117_MAKE_CODES { \
113 { 0, "Unassigned" }, \
114 { 1, "Alloy Computer Products" }, \
115 { 2, "3M" }, \
116 { 3, "Tandberg Data" }, \
117 { 4, "Colorado" }, \
118 { 5, "Archive/Conner" }, \
119 { 6, "Mountain/Summit Memory Systems" }, \
120 { 7, "Wangtek/Rexon/Tecmar" }, \
121 { 8, "Sony" }, \
122 { 9, "Cipher Data Products" }, \
123 { 10, "Irwin Magnetic Systems" }, \
124 { 11, "Braemar" }, \
125 { 12, "Verbatim" }, \
126 { 13, "Core International" }, \
127 { 14, "Exabyte" }, \
128 { 15, "Teac" }, \
129 { 16, "Gigatek" }, \
130 { 17, "ComByte" }, \
131 { 18, "PERTEC Memories" }, \
132 { 19, "Aiwa" }, \
133 { 71, "Colorado" }, \
134 { 546, "Iomega Inc" }, \
135}
136
137#endif /* _FTAPE_VENDORS_H */
diff --git a/include/linux/ftape.h b/include/linux/ftape.h
deleted file mode 100644
index 7e7038cba86a..000000000000
--- a/include/linux/ftape.h
+++ /dev/null
@@ -1,201 +0,0 @@
1#ifndef _FTAPE_H
2#define _FTAPE_H
3
4/*
5 * Copyright (C) 1994-1996 Bas Laarhoven,
6 * (C) 1996-1997 Claus-Justus Heine.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 *
23 * $Source: /homes/cvs/ftape-stacked/include/linux/ftape.h,v $
24 * $Revision: 1.17.6.4 $
25 * $Date: 1997/11/25 01:52:54 $
26 *
27 * This file contains global definitions, typedefs and macro's
28 * for the QIC-40/80/3010/3020 floppy-tape driver for Linux.
29 */
30
31#define FTAPE_VERSION "ftape v3.04d 25/11/97"
32
33#ifdef __KERNEL__
34#include <linux/interrupt.h>
35#include <linux/mm.h>
36#endif
37#include <linux/types.h>
38#include <linux/mtio.h>
39
40#define FT_SECTOR(x) (x+1) /* sector offset into real sector */
41#define FT_SECTOR_SIZE 1024
42#define FT_SECTORS_PER_SEGMENT 32
43#define FT_ECC_SECTORS 3
44#define FT_SEGMENT_SIZE ((FT_SECTORS_PER_SEGMENT - FT_ECC_SECTORS) * FT_SECTOR_SIZE)
45#define FT_BUFF_SIZE (FT_SECTORS_PER_SEGMENT * FT_SECTOR_SIZE)
46
47/*
48 * bits of the minor device number that define drive selection
49 * methods. Could be used one day to access multiple tape
50 * drives on the same controller.
51 */
52#define FTAPE_SEL_A 0
53#define FTAPE_SEL_B 1
54#define FTAPE_SEL_C 2
55#define FTAPE_SEL_D 3
56#define FTAPE_SEL_MASK 3
57#define FTAPE_SEL(unit) ((unit) & FTAPE_SEL_MASK)
58#define FTAPE_NO_REWIND 4 /* mask for minor nr */
59
60/* the following two may be reported when MTIOCGET is requested ... */
61typedef union {
62 struct {
63 __u8 error;
64 __u8 command;
65 } error;
66 long space;
67} ft_drive_error;
68typedef union {
69 struct {
70 __u8 drive_status;
71 __u8 drive_config;
72 __u8 tape_status;
73 } status;
74 long space;
75} ft_drive_status;
76
77#ifdef __KERNEL__
78
79#define FT_RQM_DELAY 12
80#define FT_MILLISECOND 1
81#define FT_SECOND 1000
82#define FT_FOREVER -1
83#ifndef HZ
84#error "HZ undefined."
85#endif
86#define FT_USPT (1000000/HZ) /* microseconds per tick */
87
88/* This defines the number of retries that the driver will allow
89 * before giving up (and letting a higher level handle the error).
90 */
91#ifdef TESTING
92#define FT_SOFT_RETRIES 1 /* number of low level retries */
93#define FT_RETRIES_ON_ECC_ERROR 3 /* ecc error when correcting segment */
94#else
95#define FT_SOFT_RETRIES 6 /* number of low level retries (triple) */
96#define FT_RETRIES_ON_ECC_ERROR 3 /* ecc error when correcting segment */
97#endif
98
99#ifndef THE_FTAPE_MAINTAINER
100#define THE_FTAPE_MAINTAINER "the ftape maintainer"
101#endif
102
103/* Initialize missing configuration parameters.
104 */
105#ifndef CONFIG_FT_NR_BUFFERS
106# define CONFIG_FT_NR_BUFFERS 3
107#endif
108#ifndef CONFIG_FT_FDC_THR
109# define CONFIG_FT_FDC_THR 8
110#endif
111#ifndef CONFIG_FT_FDC_MAX_RATE
112# define CONFIG_FT_FDC_MAX_RATE 2000
113#endif
114#ifndef CONFIG_FT_FDC_BASE
115# define CONFIG_FT_FDC_BASE 0
116#endif
117#ifndef CONFIG_FT_FDC_IRQ
118# define CONFIG_FT_FDC_IRQ 0
119#endif
120#ifndef CONFIG_FT_FDC_DMA
121# define CONFIG_FT_FDC_DMA 0
122#endif
123
124/* Turn some booleans into numbers.
125 */
126#ifdef CONFIG_FT_PROBE_FC10
127# undef CONFIG_FT_PROBE_FC10
128# define CONFIG_FT_PROBE_FC10 1
129#else
130# define CONFIG_FT_PROBE_FC10 0
131#endif
132#ifdef CONFIG_FT_MACH2
133# undef CONFIG_FT_MACH2
134# define CONFIG_FT_MACH2 1
135#else
136# define CONFIG_FT_MACH2 0
137#endif
138
139/* Insert default settings
140 */
141#if CONFIG_FT_PROBE_FC10 == 1
142# if CONFIG_FT_FDC_BASE == 0
143# undef CONFIG_FT_FDC_BASE
144# define CONFIG_FT_FDC_BASE 0x180
145# endif
146# if CONFIG_FT_FDC_IRQ == 0
147# undef CONFIG_FT_FDC_IRQ
148# define CONFIG_FT_FDC_IRQ 9
149# endif
150# if CONFIG_FT_FDC_DMA == 0
151# undef CONFIG_FT_FDC_DMA
152# define CONFIG_FT_FDC_DMA 3
153# endif
154#elif CONFIG_FT_MACH2 == 1 /* CONFIG_FT_PROBE_FC10 == 1 */
155# if CONFIG_FT_FDC_BASE == 0
156# undef CONFIG_FT_FDC_BASE
157# define CONFIG_FT_FDC_BASE 0x1E0
158# endif
159# if CONFIG_FT_FDC_IRQ == 0
160# undef CONFIG_FT_FDC_IRQ
161# define CONFIG_FT_FDC_IRQ 6
162# endif
163# if CONFIG_FT_FDC_DMA == 0
164# undef CONFIG_FT_FDC_DMA
165# define CONFIG_FT_FDC_DMA 2
166# endif
167#elif defined(CONFIG_FT_ALT_FDC) /* CONFIG_FT_MACH2 */
168# if CONFIG_FT_FDC_BASE == 0
169# undef CONFIG_FT_FDC_BASE
170# define CONFIG_FT_FDC_BASE 0x370
171# endif
172# if CONFIG_FT_FDC_IRQ == 0
173# undef CONFIG_FT_FDC_IRQ
174# define CONFIG_FT_FDC_IRQ 6
175# endif
176# if CONFIG_FT_FDC_DMA == 0
177# undef CONFIG_FT_FDC_DMA
178# define CONFIG_FT_FDC_DMA 2
179# endif
180#else /* CONFIG_FT_ALT_FDC */
181# if CONFIG_FT_FDC_BASE == 0
182# undef CONFIG_FT_FDC_BASE
183# define CONFIG_FT_FDC_BASE 0x3f0
184# endif
185# if CONFIG_FT_FDC_IRQ == 0
186# undef CONFIG_FT_FDC_IRQ
187# define CONFIG_FT_FDC_IRQ 6
188# endif
189# if CONFIG_FT_FDC_DMA == 0
190# undef CONFIG_FT_FDC_DMA
191# define CONFIG_FT_FDC_DMA 2
192# endif
193#endif /* standard FDC */
194
195/* some useful macro's
196 */
197#define NR_ITEMS(x) (int)(sizeof(x)/ sizeof(*x))
198
199#endif /* __KERNEL__ */
200
201#endif
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 9fc48a674b82..534744efe30d 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -15,7 +15,7 @@
15#define FUSE_KERNEL_VERSION 7 15#define FUSE_KERNEL_VERSION 7
16 16
17/** Minor version number of this interface */ 17/** Minor version number of this interface */
18#define FUSE_KERNEL_MINOR_VERSION 7 18#define FUSE_KERNEL_MINOR_VERSION 8
19 19
20/** The node ID of the root inode */ 20/** The node ID of the root inode */
21#define FUSE_ROOT_ID 1 21#define FUSE_ROOT_ID 1
@@ -92,6 +92,11 @@ struct fuse_file_lock {
92#define FUSE_ASYNC_READ (1 << 0) 92#define FUSE_ASYNC_READ (1 << 0)
93#define FUSE_POSIX_LOCKS (1 << 1) 93#define FUSE_POSIX_LOCKS (1 << 1)
94 94
95/**
96 * Release flags
97 */
98#define FUSE_RELEASE_FLUSH (1 << 0)
99
95enum fuse_opcode { 100enum fuse_opcode {
96 FUSE_LOOKUP = 1, 101 FUSE_LOOKUP = 1,
97 FUSE_FORGET = 2, /* no reply */ 102 FUSE_FORGET = 2, /* no reply */
@@ -127,6 +132,8 @@ enum fuse_opcode {
127 FUSE_ACCESS = 34, 132 FUSE_ACCESS = 34,
128 FUSE_CREATE = 35, 133 FUSE_CREATE = 35,
129 FUSE_INTERRUPT = 36, 134 FUSE_INTERRUPT = 36,
135 FUSE_BMAP = 37,
136 FUSE_DESTROY = 38,
130}; 137};
131 138
132/* The read buffer is required to be at least 8k, but may be much larger */ 139/* The read buffer is required to be at least 8k, but may be much larger */
@@ -205,12 +212,13 @@ struct fuse_open_out {
205struct fuse_release_in { 212struct fuse_release_in {
206 __u64 fh; 213 __u64 fh;
207 __u32 flags; 214 __u32 flags;
208 __u32 padding; 215 __u32 release_flags;
216 __u64 lock_owner;
209}; 217};
210 218
211struct fuse_flush_in { 219struct fuse_flush_in {
212 __u64 fh; 220 __u64 fh;
213 __u32 flush_flags; 221 __u32 unused;
214 __u32 padding; 222 __u32 padding;
215 __u64 lock_owner; 223 __u64 lock_owner;
216}; 224};
@@ -296,6 +304,16 @@ struct fuse_interrupt_in {
296 __u64 unique; 304 __u64 unique;
297}; 305};
298 306
307struct fuse_bmap_in {
308 __u64 block;
309 __u32 blocksize;
310 __u32 padding;
311};
312
313struct fuse_bmap_out {
314 __u64 block;
315};
316
299struct fuse_in_header { 317struct fuse_in_header {
300 __u32 len; 318 __u32 len;
301 __u32 opcode; 319 __u32 opcode;
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 9049dc65ae51..f7a93770e1be 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -17,6 +17,9 @@ struct genlmsghdr {
17#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) 17#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
18 18
19#define GENL_ADMIN_PERM 0x01 19#define GENL_ADMIN_PERM 0x01
20#define GENL_CMD_CAP_DO 0x02
21#define GENL_CMD_CAP_DUMP 0x04
22#define GENL_CMD_CAP_HASPOL 0x08
20 23
21/* 24/*
22 * List of reserved static generic netlink identifiers: 25 * List of reserved static generic netlink identifiers:
@@ -58,9 +61,6 @@ enum {
58 CTRL_ATTR_OP_UNSPEC, 61 CTRL_ATTR_OP_UNSPEC,
59 CTRL_ATTR_OP_ID, 62 CTRL_ATTR_OP_ID,
60 CTRL_ATTR_OP_FLAGS, 63 CTRL_ATTR_OP_FLAGS,
61 CTRL_ATTR_OP_POLICY,
62 CTRL_ATTR_OP_DOIT,
63 CTRL_ATTR_OP_DUMPIT,
64 __CTRL_ATTR_OP_MAX, 64 __CTRL_ATTR_OP_MAX,
65}; 65};
66 66
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index bf2b6bc3f6fd..00c314aedab7 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -116,6 +116,9 @@ static inline enum zone_type gfp_zone(gfp_t flags)
116#ifndef HAVE_ARCH_FREE_PAGE 116#ifndef HAVE_ARCH_FREE_PAGE
117static inline void arch_free_page(struct page *page, int order) { } 117static inline void arch_free_page(struct page *page, int order) { }
118#endif 118#endif
119#ifndef HAVE_ARCH_ALLOC_PAGE
120static inline void arch_alloc_page(struct page *page, int order) { }
121#endif
119 122
120extern struct page * 123extern struct page *
121FASTCALL(__alloc_pages(gfp_t, unsigned int, struct zonelist *)); 124FASTCALL(__alloc_pages(gfp_t, unsigned int, struct zonelist *));
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index a7ae7c177cac..8b7e4c1e32ae 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -54,8 +54,13 @@ struct gfs2_inum {
54 __be64 no_addr; 54 __be64 no_addr;
55}; 55};
56 56
57static inline int gfs2_inum_equal(const struct gfs2_inum *ino1, 57struct gfs2_inum_host {
58 const struct gfs2_inum *ino2) 58 __u64 no_formal_ino;
59 __u64 no_addr;
60};
61
62static inline int gfs2_inum_equal(const struct gfs2_inum_host *ino1,
63 const struct gfs2_inum_host *ino2)
59{ 64{
60 return ino1->no_formal_ino == ino2->no_formal_ino && 65 return ino1->no_formal_ino == ino2->no_formal_ino &&
61 ino1->no_addr == ino2->no_addr; 66 ino1->no_addr == ino2->no_addr;
@@ -89,6 +94,12 @@ struct gfs2_meta_header {
89 __be32 __pad1; /* Was incarnation number in gfs1 */ 94 __be32 __pad1; /* Was incarnation number in gfs1 */
90}; 95};
91 96
97struct gfs2_meta_header_host {
98 __u32 mh_magic;
99 __u32 mh_type;
100 __u32 mh_format;
101};
102
92/* 103/*
93 * super-block structure 104 * super-block structure
94 * 105 *
@@ -128,6 +139,23 @@ struct gfs2_sb {
128 /* In gfs1, quota and license dinodes followed */ 139 /* In gfs1, quota and license dinodes followed */
129}; 140};
130 141
142struct gfs2_sb_host {
143 struct gfs2_meta_header_host sb_header;
144
145 __u32 sb_fs_format;
146 __u32 sb_multihost_format;
147
148 __u32 sb_bsize;
149 __u32 sb_bsize_shift;
150
151 struct gfs2_inum_host sb_master_dir; /* Was jindex dinode in gfs1 */
152 struct gfs2_inum_host sb_root_dir;
153
154 char sb_lockproto[GFS2_LOCKNAME_LEN];
155 char sb_locktable[GFS2_LOCKNAME_LEN];
156 /* In gfs1, quota and license dinodes followed */
157};
158
131/* 159/*
132 * resource index structure 160 * resource index structure
133 */ 161 */
@@ -145,6 +173,14 @@ struct gfs2_rindex {
145 __u8 ri_reserved[64]; 173 __u8 ri_reserved[64];
146}; 174};
147 175
176struct gfs2_rindex_host {
177 __u64 ri_addr; /* grp block disk address */
178 __u64 ri_data0; /* first data location */
179 __u32 ri_length; /* length of rgrp header in fs blocks */
180 __u32 ri_data; /* num of data blocks in rgrp */
181 __u32 ri_bitbytes; /* number of bytes in data bitmaps */
182};
183
148/* 184/*
149 * resource group header structure 185 * resource group header structure
150 */ 186 */
@@ -176,6 +212,13 @@ struct gfs2_rgrp {
176 __u8 rg_reserved[80]; /* Several fields from gfs1 now reserved */ 212 __u8 rg_reserved[80]; /* Several fields from gfs1 now reserved */
177}; 213};
178 214
215struct gfs2_rgrp_host {
216 __u32 rg_flags;
217 __u32 rg_free;
218 __u32 rg_dinodes;
219 __u64 rg_igeneration;
220};
221
179/* 222/*
180 * quota structure 223 * quota structure
181 */ 224 */
@@ -187,6 +230,12 @@ struct gfs2_quota {
187 __u8 qu_reserved[64]; 230 __u8 qu_reserved[64];
188}; 231};
189 232
233struct gfs2_quota_host {
234 __u64 qu_limit;
235 __u64 qu_warn;
236 __u64 qu_value;
237};
238
190/* 239/*
191 * dinode structure 240 * dinode structure
192 */ 241 */
@@ -270,6 +319,27 @@ struct gfs2_dinode {
270 __u8 di_reserved[56]; 319 __u8 di_reserved[56];
271}; 320};
272 321
322struct gfs2_dinode_host {
323 __u64 di_size; /* number of bytes in file */
324 __u64 di_blocks; /* number of blocks in file */
325
326 /* This section varies from gfs1. Padding added to align with
327 * remainder of dinode
328 */
329 __u64 di_goal_meta; /* rgrp to alloc from next */
330 __u64 di_goal_data; /* data block goal */
331 __u64 di_generation; /* generation number for NFS */
332
333 __u32 di_flags; /* GFS2_DIF_... */
334 __u16 di_height; /* height of metadata */
335
336 /* These only apply to directories */
337 __u16 di_depth; /* Number of bits in the table */
338 __u32 di_entries; /* The number of entries in the directory */
339
340 __u64 di_eattr; /* extended attribute block number */
341};
342
273/* 343/*
274 * directory structure - many of these per directory file 344 * directory structure - many of these per directory file
275 */ 345 */
@@ -344,6 +414,16 @@ struct gfs2_log_header {
344 __be32 lh_hash; 414 __be32 lh_hash;
345}; 415};
346 416
417struct gfs2_log_header_host {
418 struct gfs2_meta_header_host lh_header;
419
420 __u64 lh_sequence; /* Sequence number of this transaction */
421 __u32 lh_flags; /* GFS2_LOG_HEAD_... */
422 __u32 lh_tail; /* Block number of log tail */
423 __u32 lh_blkno;
424 __u32 lh_hash;
425};
426
347/* 427/*
348 * Log type descriptor 428 * Log type descriptor
349 */ 429 */
@@ -384,6 +464,11 @@ struct gfs2_inum_range {
384 __be64 ir_length; 464 __be64 ir_length;
385}; 465};
386 466
467struct gfs2_inum_range_host {
468 __u64 ir_start;
469 __u64 ir_length;
470};
471
387/* 472/*
388 * Statfs change 473 * Statfs change
389 * Describes an change to the pool of free and allocated 474 * Describes an change to the pool of free and allocated
@@ -396,6 +481,12 @@ struct gfs2_statfs_change {
396 __be64 sc_dinodes; 481 __be64 sc_dinodes;
397}; 482};
398 483
484struct gfs2_statfs_change_host {
485 __u64 sc_total;
486 __u64 sc_free;
487 __u64 sc_dinodes;
488};
489
399/* 490/*
400 * Quota change 491 * Quota change
401 * Describes an allocation change for a particular 492 * Describes an allocation change for a particular
@@ -410,33 +501,38 @@ struct gfs2_quota_change {
410 __be32 qc_id; 501 __be32 qc_id;
411}; 502};
412 503
504struct gfs2_quota_change_host {
505 __u64 qc_change;
506 __u32 qc_flags; /* GFS2_QCF_... */
507 __u32 qc_id;
508};
509
413#ifdef __KERNEL__ 510#ifdef __KERNEL__
414/* Translation functions */ 511/* Translation functions */
415 512
416extern void gfs2_inum_in(struct gfs2_inum *no, const void *buf); 513extern void gfs2_inum_in(struct gfs2_inum_host *no, const void *buf);
417extern void gfs2_inum_out(const struct gfs2_inum *no, void *buf); 514extern void gfs2_inum_out(const struct gfs2_inum_host *no, void *buf);
418extern void gfs2_sb_in(struct gfs2_sb *sb, const void *buf); 515extern void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf);
419extern void gfs2_rindex_in(struct gfs2_rindex *ri, const void *buf); 516extern void gfs2_rindex_in(struct gfs2_rindex_host *ri, const void *buf);
420extern void gfs2_rindex_out(const struct gfs2_rindex *ri, void *buf); 517extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf);
421extern void gfs2_rgrp_in(struct gfs2_rgrp *rg, const void *buf); 518extern void gfs2_rgrp_in(struct gfs2_rgrp_host *rg, const void *buf);
422extern void gfs2_rgrp_out(const struct gfs2_rgrp *rg, void *buf); 519extern void gfs2_rgrp_out(const struct gfs2_rgrp_host *rg, void *buf);
423extern void gfs2_quota_in(struct gfs2_quota *qu, const void *buf); 520extern void gfs2_quota_in(struct gfs2_quota_host *qu, const void *buf);
424extern void gfs2_quota_out(const struct gfs2_quota *qu, void *buf); 521struct gfs2_inode;
425extern void gfs2_dinode_in(struct gfs2_dinode *di, const void *buf); 522extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
426extern void gfs2_dinode_out(const struct gfs2_dinode *di, void *buf);
427extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, const void *buf); 523extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, const void *buf);
428extern void gfs2_ea_header_out(const struct gfs2_ea_header *ea, void *buf); 524extern void gfs2_ea_header_out(const struct gfs2_ea_header *ea, void *buf);
429extern void gfs2_log_header_in(struct gfs2_log_header *lh, const void *buf); 525extern void gfs2_log_header_in(struct gfs2_log_header_host *lh, const void *buf);
430extern void gfs2_inum_range_in(struct gfs2_inum_range *ir, const void *buf); 526extern void gfs2_inum_range_in(struct gfs2_inum_range_host *ir, const void *buf);
431extern void gfs2_inum_range_out(const struct gfs2_inum_range *ir, void *buf); 527extern void gfs2_inum_range_out(const struct gfs2_inum_range_host *ir, void *buf);
432extern void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, const void *buf); 528extern void gfs2_statfs_change_in(struct gfs2_statfs_change_host *sc, const void *buf);
433extern void gfs2_statfs_change_out(const struct gfs2_statfs_change *sc, void *buf); 529extern void gfs2_statfs_change_out(const struct gfs2_statfs_change_host *sc, void *buf);
434extern void gfs2_quota_change_in(struct gfs2_quota_change *qc, const void *buf); 530extern void gfs2_quota_change_in(struct gfs2_quota_change_host *qc, const void *buf);
435 531
436/* Printing functions */ 532/* Printing functions */
437 533
438extern void gfs2_rindex_print(const struct gfs2_rindex *ri); 534extern void gfs2_rindex_print(const struct gfs2_rindex_host *ri);
439extern void gfs2_dinode_print(const struct gfs2_dinode *di); 535extern void gfs2_dinode_print(const struct gfs2_inode *ip);
440 536
441#endif /* __KERNEL__ */ 537#endif /* __KERNEL__ */
442 538
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index fd7d12daa94f..3d8768b619e9 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <linux/uaccess.h>
6 7
7#include <asm/cacheflush.h> 8#include <asm/cacheflush.h>
8 9
@@ -41,9 +42,10 @@ static inline void *kmap(struct page *page)
41 42
42#define kunmap(page) do { (void) (page); } while (0) 43#define kunmap(page) do { (void) (page); } while (0)
43 44
44#define kmap_atomic(page, idx) page_address(page) 45#define kmap_atomic(page, idx) \
45#define kunmap_atomic(addr, idx) do { } while (0) 46 ({ pagefault_disable(); page_address(page); })
46#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) 47#define kunmap_atomic(addr, idx) do { pagefault_enable(); } while (0)
48#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx))
47#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 49#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
48#endif 50#endif
49 51
diff --git a/include/linux/htirq.h b/include/linux/htirq.h
index 1f15ce279a23..c96ea46737d0 100644
--- a/include/linux/htirq.h
+++ b/include/linux/htirq.h
@@ -1,15 +1,23 @@
1#ifndef LINUX_HTIRQ_H 1#ifndef LINUX_HTIRQ_H
2#define LINUX_HTIRQ_H 2#define LINUX_HTIRQ_H
3 3
4struct ht_irq_msg {
5 u32 address_lo; /* low 32 bits of the ht irq message */
6 u32 address_hi; /* high 32 bits of the it irq message */
7};
8
4/* Helper functions.. */ 9/* Helper functions.. */
5void write_ht_irq_low(unsigned int irq, u32 data); 10void fetch_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg);
6void write_ht_irq_high(unsigned int irq, u32 data); 11void write_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg);
7u32 read_ht_irq_low(unsigned int irq);
8u32 read_ht_irq_high(unsigned int irq);
9void mask_ht_irq(unsigned int irq); 12void mask_ht_irq(unsigned int irq);
10void unmask_ht_irq(unsigned int irq); 13void unmask_ht_irq(unsigned int irq);
11 14
12/* The arch hook for getting things started */ 15/* The arch hook for getting things started */
13int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev); 16int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev);
14 17
18/* For drivers of buggy hardware */
19typedef void (ht_irq_update_t)(struct pci_dev *dev, int irq,
20 struct ht_irq_msg *msg);
21int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update);
22
15#endif /* LINUX_HTIRQ_H */ 23#endif /* LINUX_HTIRQ_H */
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 5081d27bfa27..a60995afe334 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -35,6 +35,7 @@ extern int sysctl_hugetlb_shm_group;
35 35
36pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr); 36pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr);
37pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr); 37pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr);
38int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep);
38struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, 39struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
39 int write); 40 int write);
40struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, 41struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
@@ -60,8 +61,11 @@ void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
60 * If the arch doesn't supply something else, assume that hugepage 61 * If the arch doesn't supply something else, assume that hugepage
61 * size aligned regions are ok without further preparation. 62 * size aligned regions are ok without further preparation.
62 */ 63 */
63static inline int prepare_hugepage_range(unsigned long addr, unsigned long len) 64static inline int prepare_hugepage_range(unsigned long addr, unsigned long len,
65 pgoff_t pgoff)
64{ 66{
67 if (pgoff & (~HPAGE_MASK >> PAGE_SHIFT))
68 return -EINVAL;
65 if (len & ~HPAGE_MASK) 69 if (len & ~HPAGE_MASK)
66 return -EINVAL; 70 return -EINVAL;
67 if (addr & ~HPAGE_MASK) 71 if (addr & ~HPAGE_MASK)
@@ -69,7 +73,8 @@ static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
69 return 0; 73 return 0;
70} 74}
71#else 75#else
72int prepare_hugepage_range(unsigned long addr, unsigned long len); 76int prepare_hugepage_range(unsigned long addr, unsigned long len,
77 pgoff_t pgoff);
73#endif 78#endif
74 79
75#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE 80#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE
@@ -107,7 +112,7 @@ static inline unsigned long hugetlb_total_pages(void)
107#define hugetlb_report_meminfo(buf) 0 112#define hugetlb_report_meminfo(buf) 0
108#define hugetlb_report_node_meminfo(n, buf) 0 113#define hugetlb_report_node_meminfo(n, buf) 0
109#define follow_huge_pmd(mm, addr, pmd, write) NULL 114#define follow_huge_pmd(mm, addr, pmd, write) NULL
110#define prepare_hugepage_range(addr, len) (-EINVAL) 115#define prepare_hugepage_range(addr,len,pgoff) (-EINVAL)
111#define pmd_huge(x) 0 116#define pmd_huge(x) 0
112#define is_hugepage_only_range(mm, addr, len) 0 117#define is_hugepage_only_range(mm, addr, len) 0
113#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) 118#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
diff --git a/include/linux/i2c-pxa.h b/include/linux/i2c-pxa.h
index 5f3eaf802223..41dcdfe7f625 100644
--- a/include/linux/i2c-pxa.h
+++ b/include/linux/i2c-pxa.h
@@ -1,29 +1,6 @@
1#ifndef _LINUX_I2C_ALGO_PXA_H 1#ifndef _LINUX_I2C_ALGO_PXA_H
2#define _LINUX_I2C_ALGO_PXA_H 2#define _LINUX_I2C_ALGO_PXA_H
3 3
4struct i2c_eeprom_emu_watcher {
5 void (*write)(void *, unsigned int addr, unsigned char newval);
6};
7
8struct i2c_eeprom_emu_watch {
9 struct list_head node;
10 unsigned int start;
11 unsigned int end;
12 struct i2c_eeprom_emu_watcher *ops;
13 void *data;
14};
15
16#define I2C_EEPROM_EMU_SIZE (256)
17
18struct i2c_eeprom_emu {
19 unsigned int size;
20 unsigned int ptr;
21 unsigned int seen_start;
22 struct list_head watch;
23
24 unsigned char bytes[I2C_EEPROM_EMU_SIZE];
25};
26
27typedef enum i2c_slave_event_e { 4typedef enum i2c_slave_event_e {
28 I2C_SLAVE_EVENT_START_READ, 5 I2C_SLAVE_EVENT_START_READ,
29 I2C_SLAVE_EVENT_START_WRITE, 6 I2C_SLAVE_EVENT_START_WRITE,
@@ -37,12 +14,4 @@ struct i2c_slave_client {
37 void (*write)(void *ptr, unsigned int val); 14 void (*write)(void *ptr, unsigned int val);
38}; 15};
39 16
40extern int i2c_eeprom_emu_addwatcher(struct i2c_eeprom_emu *, void *data,
41 unsigned int addr, unsigned int size,
42 struct i2c_eeprom_emu_watcher *);
43
44extern void i2c_eeprom_emu_delwatcher(struct i2c_eeprom_emu *, void *data, struct i2c_eeprom_emu_watcher *watcher);
45
46extern struct i2c_eeprom_emu *i2c_pxa_get_eeprom(void);
47
48#endif /* _LINUX_I2C_ALGO_PXA_H */ 17#endif /* _LINUX_I2C_ALGO_PXA_H */
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index c115e9e840b4..52f53e2e70c3 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -461,7 +461,7 @@ struct i2o_driver {
461 int (*reply) (struct i2o_controller *, u32, struct i2o_message *); 461 int (*reply) (struct i2o_controller *, u32, struct i2o_message *);
462 462
463 /* Event handler */ 463 /* Event handler */
464 void (*event) (struct i2o_event *); 464 work_func_t event;
465 465
466 struct workqueue_struct *event_queue; /* Event queue */ 466 struct workqueue_struct *event_queue; /* Event queue */
467 467
@@ -490,7 +490,7 @@ struct i2o_dma {
490 */ 490 */
491struct i2o_pool { 491struct i2o_pool {
492 char *name; 492 char *name;
493 kmem_cache_t *slab; 493 struct kmem_cache *slab;
494 mempool_t *mempool; 494 mempool_t *mempool;
495}; 495};
496 496
@@ -986,7 +986,8 @@ extern void i2o_driver_unregister(struct i2o_driver *);
986 986
987/** 987/**
988 * i2o_driver_notify_controller_add - Send notification of added controller 988 * i2o_driver_notify_controller_add - Send notification of added controller
989 * to a single I2O driver 989 * @drv: I2O driver
990 * @c: I2O controller
990 * 991 *
991 * Send notification of added controller to a single registered driver. 992 * Send notification of added controller to a single registered driver.
992 */ 993 */
@@ -998,8 +999,9 @@ static inline void i2o_driver_notify_controller_add(struct i2o_driver *drv,
998}; 999};
999 1000
1000/** 1001/**
1001 * i2o_driver_notify_controller_remove - Send notification of removed 1002 * i2o_driver_notify_controller_remove - Send notification of removed controller
1002 * controller to a single I2O driver 1003 * @drv: I2O driver
1004 * @c: I2O controller
1003 * 1005 *
1004 * Send notification of removed controller to a single registered driver. 1006 * Send notification of removed controller to a single registered driver.
1005 */ 1007 */
@@ -1011,8 +1013,9 @@ static inline void i2o_driver_notify_controller_remove(struct i2o_driver *drv,
1011}; 1013};
1012 1014
1013/** 1015/**
1014 * i2o_driver_notify_device_add - Send notification of added device to a 1016 * i2o_driver_notify_device_add - Send notification of added device
1015 * single I2O driver 1017 * @drv: I2O driver
1018 * @i2o_dev: the added i2o_device
1016 * 1019 *
1017 * Send notification of added device to a single registered driver. 1020 * Send notification of added device to a single registered driver.
1018 */ 1021 */
@@ -1025,7 +1028,8 @@ static inline void i2o_driver_notify_device_add(struct i2o_driver *drv,
1025 1028
1026/** 1029/**
1027 * i2o_driver_notify_device_remove - Send notification of removed device 1030 * i2o_driver_notify_device_remove - Send notification of removed device
1028 * to a single I2O driver 1031 * @drv: I2O driver
1032 * @i2o_dev: the added i2o_device
1029 * 1033 *
1030 * Send notification of removed device to a single registered driver. 1034 * Send notification of removed device to a single registered driver.
1031 */ 1035 */
@@ -1148,7 +1152,7 @@ static inline void i2o_msg_post(struct i2o_controller *c,
1148/** 1152/**
1149 * i2o_msg_post_wait - Post and wait a message and wait until return 1153 * i2o_msg_post_wait - Post and wait a message and wait until return
1150 * @c: controller 1154 * @c: controller
1151 * @m: message to post 1155 * @msg: message to post
1152 * @timeout: time in seconds to wait 1156 * @timeout: time in seconds to wait
1153 * 1157 *
1154 * This API allows an OSM to post a message and then be told whether or 1158 * This API allows an OSM to post a message and then be told whether or
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index 878cfe4e587f..24da4fbc1a2f 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -68,7 +68,7 @@
68struct icmphdr { 68struct icmphdr {
69 __u8 type; 69 __u8 type;
70 __u8 code; 70 __u8 code;
71 __be16 checksum; 71 __sum16 checksum;
72 union { 72 union {
73 struct { 73 struct {
74 __be16 id; 74 __be16 id;
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index c771a7db9871..68d3526c3a05 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -7,17 +7,17 @@ struct icmp6hdr {
7 7
8 __u8 icmp6_type; 8 __u8 icmp6_type;
9 __u8 icmp6_code; 9 __u8 icmp6_code;
10 __u16 icmp6_cksum; 10 __sum16 icmp6_cksum;
11 11
12 12
13 union { 13 union {
14 __u32 un_data32[1]; 14 __be32 un_data32[1];
15 __u16 un_data16[2]; 15 __be16 un_data16[2];
16 __u8 un_data8[4]; 16 __u8 un_data8[4];
17 17
18 struct icmpv6_echo { 18 struct icmpv6_echo {
19 __u16 identifier; 19 __be16 identifier;
20 __u16 sequence; 20 __be16 sequence;
21 } u_echo; 21 } u_echo;
22 22
23 struct icmpv6_nd_advt { 23 struct icmpv6_nd_advt {
@@ -53,7 +53,7 @@ struct icmp6hdr {
53#else 53#else
54#error "Please fix <asm/byteorder.h>" 54#error "Please fix <asm/byteorder.h>"
55#endif 55#endif
56 __u16 rt_lifetime; 56 __be16 rt_lifetime;
57 } u_nd_ra; 57 } u_nd_ra;
58 58
59 } icmp6_dataun; 59 } icmp6_dataun;
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index b92558549d27..99393ef3af39 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -1,17 +1,19 @@
1#ifndef __LINUX_IF_PACKET_H 1#ifndef __LINUX_IF_PACKET_H
2#define __LINUX_IF_PACKET_H 2#define __LINUX_IF_PACKET_H
3 3
4#include <linux/types.h>
5
4struct sockaddr_pkt 6struct sockaddr_pkt
5{ 7{
6 unsigned short spkt_family; 8 unsigned short spkt_family;
7 unsigned char spkt_device[14]; 9 unsigned char spkt_device[14];
8 unsigned short spkt_protocol; 10 __be16 spkt_protocol;
9}; 11};
10 12
11struct sockaddr_ll 13struct sockaddr_ll
12{ 14{
13 unsigned short sll_family; 15 unsigned short sll_family;
14 unsigned short sll_protocol; 16 __be16 sll_protocol;
15 int sll_ifindex; 17 int sll_ifindex;
16 unsigned short sll_hatype; 18 unsigned short sll_hatype;
17 unsigned char sll_pkttype; 19 unsigned char sll_pkttype;
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index bef9f8fd93b3..8de079ba1107 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -19,10 +19,10 @@ struct ip_tunnel_parm
19{ 19{
20 char name[IFNAMSIZ]; 20 char name[IFNAMSIZ];
21 int link; 21 int link;
22 __u16 i_flags; 22 __be16 i_flags;
23 __u16 o_flags; 23 __be16 o_flags;
24 __u32 i_key; 24 __be32 i_key;
25 __u32 o_key; 25 __be32 o_key;
26 struct iphdr iph; 26 struct iphdr iph;
27}; 27};
28 28
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 03f43e2893a4..9dbb525c5178 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -30,7 +30,7 @@ struct igmphdr
30{ 30{
31 __u8 type; 31 __u8 type;
32 __u8 code; /* For newer IGMP */ 32 __u8 code; /* For newer IGMP */
33 __be16 csum; 33 __sum16 csum;
34 __be32 group; 34 __be32 group;
35}; 35};
36 36
@@ -127,6 +127,7 @@ struct igmpv3_query {
127 127
128#ifdef __KERNEL__ 128#ifdef __KERNEL__
129#include <linux/skbuff.h> 129#include <linux/skbuff.h>
130#include <linux/timer.h>
130#include <linux/in.h> 131#include <linux/in.h>
131 132
132extern int sysctl_igmp_max_memberships; 133extern int sysctl_igmp_max_memberships;
@@ -191,7 +192,7 @@ struct ip_mc_list
191#define IGMPV3_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value)) 192#define IGMPV3_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value))
192#define IGMPV3_EXP(thresh, nbmant, nbexp, value) \ 193#define IGMPV3_EXP(thresh, nbmant, nbexp, value) \
193 ((value) < (thresh) ? (value) : \ 194 ((value) < (thresh) ? (value) : \
194 ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant+nbexp))) << \ 195 ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant))) << \
195 (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp)))) 196 (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp))))
196 197
197#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) 198#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
diff --git a/include/linux/in.h b/include/linux/in.h
index 2619859f6e1b..1912e7c0bc26 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -45,6 +45,7 @@ enum {
45 45
46 IPPROTO_COMP = 108, /* Compression Header protocol */ 46 IPPROTO_COMP = 108, /* Compression Header protocol */
47 IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */ 47 IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
48 IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */
48 49
49 IPPROTO_RAW = 255, /* Raw IP packets */ 50 IPPROTO_RAW = 255, /* Raw IP packets */
50 IPPROTO_MAX 51 IPPROTO_MAX
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 9be6a4756f0b..4e8350ae8869 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -54,7 +54,7 @@ extern const struct in6_addr in6addr_loopback;
54struct sockaddr_in6 { 54struct sockaddr_in6 {
55 unsigned short int sin6_family; /* AF_INET6 */ 55 unsigned short int sin6_family; /* AF_INET6 */
56 __be16 sin6_port; /* Transport layer port # */ 56 __be16 sin6_port; /* Transport layer port # */
57 __u32 sin6_flowinfo; /* IPv6 flow information */ 57 __be32 sin6_flowinfo; /* IPv6 flow information */
58 struct in6_addr sin6_addr; /* IPv6 address */ 58 struct in6_addr sin6_addr; /* IPv6 address */
59 __u32 sin6_scope_id; /* scope id (new in RFC2553) */ 59 __u32 sin6_scope_id; /* scope id (new in RFC2553) */
60}; 60};
@@ -72,7 +72,7 @@ struct ipv6_mreq {
72struct in6_flowlabel_req 72struct in6_flowlabel_req
73{ 73{
74 struct in6_addr flr_dst; 74 struct in6_addr flr_dst;
75 __u32 flr_label; 75 __be32 flr_label;
76 __u8 flr_action; 76 __u8 flr_action;
77 __u8 flr_share; 77 __u8 flr_share;
78 __u16 flr_flags; 78 __u16 flr_flags;
@@ -225,7 +225,7 @@ struct in6_flowlabel_req
225#endif 225#endif
226 226
227/* 227/*
228 * Netfilter 228 * Netfilter (1)
229 * 229 *
230 * Following socket options are used in ip6_tables; 230 * Following socket options are used in ip6_tables;
231 * see include/linux/netfilter_ipv6/ip6_tables.h. 231 * see include/linux/netfilter_ipv6/ip6_tables.h.
@@ -240,4 +240,14 @@ struct in6_flowlabel_req
240#define IPV6_RECVTCLASS 66 240#define IPV6_RECVTCLASS 66
241#define IPV6_TCLASS 67 241#define IPV6_TCLASS 67
242 242
243/*
244 * Netfilter (2)
245 *
246 * Following socket options are used in ip6_tables;
247 * see include/linux/netfilter_ipv6/ip6_tables.h.
248 *
249 * IP6T_SO_GET_REVISION_MATCH 68
250 * IP6T_SO_GET_REVISION_TARGET 69
251 */
252
243#endif 253#endif
diff --git a/include/linux/inet.h b/include/linux/inet.h
index b7c6da7d6d32..675a7dbe86f8 100644
--- a/include/linux/inet.h
+++ b/include/linux/inet.h
@@ -46,7 +46,7 @@
46#include <linux/types.h> 46#include <linux/types.h>
47 47
48extern __be32 in_aton(const char *str); 48extern __be32 in_aton(const char *str);
49extern int in4_pton(const char *src, int srclen, u8 *dst, char delim, const char **end); 49extern int in4_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
50extern int in6_pton(const char *src, int srclen, u8 *dst, char delim, const char **end); 50extern int in6_pton(const char *src, int srclen, u8 *dst, int delim, const char **end);
51#endif 51#endif
52#endif /* _LINUX_INET_H */ 52#endif /* _LINUX_INET_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 5a0ab04627bc..c0f7aec331c2 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -124,12 +124,13 @@ static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
124 * Check if a mask is acceptable. 124 * Check if a mask is acceptable.
125 */ 125 */
126 126
127static __inline__ int bad_mask(u32 mask, u32 addr) 127static __inline__ int bad_mask(__be32 mask, __be32 addr)
128{ 128{
129 __u32 hmask;
129 if (addr & (mask = ~mask)) 130 if (addr & (mask = ~mask))
130 return 1; 131 return 1;
131 mask = ntohl(mask); 132 hmask = ntohl(mask);
132 if (mask & (mask+1)) 133 if (hmask & (hmask+1))
133 return 1; 134 return 1;
134 return 0; 135 return 0;
135} 136}
@@ -190,11 +191,12 @@ static __inline__ __be32 inet_make_mask(int logmask)
190 return 0; 191 return 0;
191} 192}
192 193
193static __inline__ int inet_mask_len(__u32 mask) 194static __inline__ int inet_mask_len(__be32 mask)
194{ 195{
195 if (!(mask = ntohl(mask))) 196 __u32 hmask = ntohl(mask);
197 if (!hmask)
196 return 0; 198 return 0;
197 return 32 - ffz(~mask); 199 return 32 - ffz(~hmask);
198} 200}
199 201
200 202
diff --git a/include/linux/init.h b/include/linux/init.h
index ff40ea118e3a..5eb5d24b7680 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -93,6 +93,14 @@ extern void setup_arch(char **);
93 static initcall_t __initcall_##fn##id __attribute_used__ \ 93 static initcall_t __initcall_##fn##id __attribute_used__ \
94 __attribute__((__section__(".initcall" level ".init"))) = fn 94 __attribute__((__section__(".initcall" level ".init"))) = fn
95 95
96/*
97 * A "pure" initcall has no dependencies on anything else, and purely
98 * initializes variables that couldn't be statically initialized.
99 *
100 * This only exists for built-in code, not for modules.
101 */
102#define pure_initcall(fn) __define_initcall("0",fn,1)
103
96#define core_initcall(fn) __define_initcall("1",fn,1) 104#define core_initcall(fn) __define_initcall("1",fn,1)
97#define core_initcall_sync(fn) __define_initcall("1s",fn,1s) 105#define core_initcall_sync(fn) __define_initcall("1s",fn,1s)
98#define postcore_initcall(fn) __define_initcall("2",fn,2) 106#define postcore_initcall(fn) __define_initcall("2",fn,2)
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 33c5daacc743..733790d4f7db 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -73,7 +73,7 @@
73extern struct nsproxy init_nsproxy; 73extern struct nsproxy init_nsproxy;
74#define INIT_NSPROXY(nsproxy) { \ 74#define INIT_NSPROXY(nsproxy) { \
75 .count = ATOMIC_INIT(1), \ 75 .count = ATOMIC_INIT(1), \
76 .nslock = SPIN_LOCK_UNLOCKED, \ 76 .nslock = __SPIN_LOCK_UNLOCKED(nsproxy.nslock), \
77 .uts_ns = &init_uts_ns, \ 77 .uts_ns = &init_uts_ns, \
78 .namespace = NULL, \ 78 .namespace = NULL, \
79 INIT_IPC_NS(ipc_ns) \ 79 INIT_IPC_NS(ipc_ns) \
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5b83e7b59621..de7593f4e895 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -11,6 +11,7 @@
11#include <linux/hardirq.h> 11#include <linux/hardirq.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/irqflags.h> 13#include <linux/irqflags.h>
14#include <linux/bottom_half.h>
14#include <asm/atomic.h> 15#include <asm/atomic.h>
15#include <asm/ptrace.h> 16#include <asm/ptrace.h>
16#include <asm/system.h> 17#include <asm/system.h>
@@ -217,12 +218,6 @@ static inline void __deprecated save_and_cli(unsigned long *x)
217#define save_and_cli(x) save_and_cli(&x) 218#define save_and_cli(x) save_and_cli(&x)
218#endif /* CONFIG_SMP */ 219#endif /* CONFIG_SMP */
219 220
220extern void local_bh_disable(void);
221extern void __local_bh_enable(void);
222extern void _local_bh_enable(void);
223extern void local_bh_enable(void);
224extern void local_bh_enable_ip(unsigned long ip);
225
226/* PLEASE, avoid to allocate new softirqs, if you need not _really_ high 221/* PLEASE, avoid to allocate new softirqs, if you need not _really_ high
227 frequency threaded job scheduling. For almost all the purposes 222 frequency threaded job scheduling. For almost all the purposes
228 tasklets are more than enough. F.e. all serial device BHs et 223 tasklets are more than enough. F.e. all serial device BHs et
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index d42c83399071..cf8696d4a138 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -89,6 +89,7 @@ struct resource_list {
89#define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */ 89#define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */
90#define IORESOURCE_ROM_SHADOW (1<<1) /* ROM is copy at C000:0 */ 90#define IORESOURCE_ROM_SHADOW (1<<1) /* ROM is copy at C000:0 */
91#define IORESOURCE_ROM_COPY (1<<2) /* ROM is alloc'd copy, resource field overlaid */ 91#define IORESOURCE_ROM_COPY (1<<2) /* ROM is alloc'd copy, resource field overlaid */
92#define IORESOURCE_ROM_BIOS_COPY (1<<3) /* ROM is BIOS copy, resource field overlaid */
92 93
93/* PC/ISA/whatever - the normal PC address spaces: IO and memory */ 94/* PC/ISA/whatever - the normal PC address spaces: IO and memory */
94extern struct resource ioport_resource; 95extern struct resource ioport_resource;
diff --git a/include/linux/ip.h b/include/linux/ip.h
index ecee9bb27d0e..1d36b971a8b5 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -98,7 +98,7 @@ struct iphdr {
98 __be16 frag_off; 98 __be16 frag_off;
99 __u8 ttl; 99 __u8 ttl;
100 __u8 protocol; 100 __u8 protocol;
101 __be16 check; 101 __sum16 check;
102 __be32 saddr; 102 __be32 saddr;
103 __be32 daddr; 103 __be32 daddr;
104 /*The options start here. */ 104 /*The options start here. */
diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h
index 5c23aeb104ca..af3f4a70f3df 100644
--- a/include/linux/ip6_tunnel.h
+++ b/include/linux/ip6_tunnel.h
@@ -25,7 +25,7 @@ struct ip6_tnl_parm {
25 __u8 proto; /* tunnel protocol */ 25 __u8 proto; /* tunnel protocol */
26 __u8 encap_limit; /* encapsulation limit for tunnel */ 26 __u8 encap_limit; /* encapsulation limit for tunnel */
27 __u8 hop_limit; /* hop limit for tunnel */ 27 __u8 hop_limit; /* hop limit for tunnel */
28 __u32 flowinfo; /* traffic class and flowlabel for tunnel */ 28 __be32 flowinfo; /* traffic class and flowlabel for tunnel */
29 __u32 flags; /* tunnel flags */ 29 __u32 flags; /* tunnel flags */
30 struct in6_addr laddr; /* local tunnel end-point address */ 30 struct in6_addr laddr; /* local tunnel end-point address */
31 struct in6_addr raddr; /* remote tunnel end-point address */ 31 struct in6_addr raddr; /* remote tunnel end-point address */
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 796ca009fd46..7a9db390c56a 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -208,6 +208,15 @@ struct kernel_ipmi_msg
208 code as the first byte of the incoming data, unlike a response. */ 208 code as the first byte of the incoming data, unlike a response. */
209 209
210 210
211/*
212 * Modes for ipmi_set_maint_mode() and the userland IOCTL. The AUTO
213 * setting is the default and means it will be set on certain
214 * commands. Hard setting it on and off will override automatic
215 * operation.
216 */
217#define IPMI_MAINTENANCE_MODE_AUTO 0
218#define IPMI_MAINTENANCE_MODE_OFF 1
219#define IPMI_MAINTENANCE_MODE_ON 2
211 220
212#ifdef __KERNEL__ 221#ifdef __KERNEL__
213 222
@@ -374,6 +383,35 @@ int ipmi_unregister_for_cmd(ipmi_user_t user,
374 unsigned int chans); 383 unsigned int chans);
375 384
376/* 385/*
386 * Go into a mode where the driver will not autonomously attempt to do
387 * things with the interface. It will still respond to attentions and
388 * interrupts, and it will expect that commands will complete. It
389 * will not automatcially check for flags, events, or things of that
390 * nature.
391 *
392 * This is primarily used for firmware upgrades. The idea is that
393 * when you go into firmware upgrade mode, you do this operation
394 * and the driver will not attempt to do anything but what you tell
395 * it or what the BMC asks for.
396 *
397 * Note that if you send a command that resets the BMC, the driver
398 * will still expect a response from that command. So the BMC should
399 * reset itself *after* the response is sent. Resetting before the
400 * response is just silly.
401 *
402 * If in auto maintenance mode, the driver will automatically go into
403 * maintenance mode for 30 seconds if it sees a cold reset, a warm
404 * reset, or a firmware NetFN. This means that code that uses only
405 * firmware NetFN commands to do upgrades will work automatically
406 * without change, assuming it sends a message every 30 seconds or
407 * less.
408 *
409 * See the IPMI_MAINTENANCE_MODE_xxx defines for what the mode means.
410 */
411int ipmi_get_maintenance_mode(ipmi_user_t user);
412int ipmi_set_maintenance_mode(ipmi_user_t user, int mode);
413
414/*
377 * Allow run-to-completion mode to be set for the interface of 415 * Allow run-to-completion mode to be set for the interface of
378 * a specific user. 416 * a specific user.
379 */ 417 */
@@ -656,4 +694,11 @@ struct ipmi_timing_parms
656#define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \ 694#define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \
657 struct ipmi_timing_parms) 695 struct ipmi_timing_parms)
658 696
697/*
698 * Set the maintenance mode. See ipmi_set_maintenance_mode() above
699 * for a description of what this does.
700 */
701#define IPMICTL_GET_MAINTENANCE_MODE_CMD _IOR(IPMI_IOC_MAGIC, 30, int)
702#define IPMICTL_SET_MAINTENANCE_MODE_CMD _IOW(IPMI_IOC_MAGIC, 31, int)
703
659#endif /* __LINUX_IPMI_H */ 704#endif /* __LINUX_IPMI_H */
diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h
index 22f5e2afda4f..b56a158d587a 100644
--- a/include/linux/ipmi_msgdefs.h
+++ b/include/linux/ipmi_msgdefs.h
@@ -46,6 +46,8 @@
46#define IPMI_NETFN_APP_REQUEST 0x06 46#define IPMI_NETFN_APP_REQUEST 0x06
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_COLD_RESET_CMD 0x02
50#define IPMI_WARM_RESET_CMD 0x03
49#define IPMI_CLEAR_MSG_FLAGS_CMD 0x30 51#define IPMI_CLEAR_MSG_FLAGS_CMD 0x30
50#define IPMI_GET_DEVICE_GUID_CMD 0x08 52#define IPMI_GET_DEVICE_GUID_CMD 0x08
51#define IPMI_GET_MSG_FLAGS_CMD 0x31 53#define IPMI_GET_MSG_FLAGS_CMD 0x31
@@ -60,21 +62,30 @@
60#define IPMI_NETFN_STORAGE_RESPONSE 0x0b 62#define IPMI_NETFN_STORAGE_RESPONSE 0x0b
61#define IPMI_ADD_SEL_ENTRY_CMD 0x44 63#define IPMI_ADD_SEL_ENTRY_CMD 0x44
62 64
65#define IPMI_NETFN_FIRMWARE_REQUEST 0x08
66#define IPMI_NETFN_FIRMWARE_RESPONSE 0x09
67
63/* The default slave address */ 68/* The default slave address */
64#define IPMI_BMC_SLAVE_ADDR 0x20 69#define IPMI_BMC_SLAVE_ADDR 0x20
65 70
66/* The BT interface on high-end HP systems supports up to 255 bytes in 71/* The BT interface on high-end HP systems supports up to 255 bytes in
67 * one transfer. Its "virtual" BMC supports some commands that are longer 72 * one transfer. Its "virtual" BMC supports some commands that are longer
68 * than 128 bytes. Use the full 256, plus NetFn/LUN, Cmd, cCode, plus 73 * than 128 bytes. Use the full 256, plus NetFn/LUN, Cmd, cCode, plus
69 * some overhead. It would be nice to base this on the "BT Capabilities" 74 * some overhead; it's not worth the effort to dynamically size this based
70 * but that's too hard to propagate to the rest of the driver. */ 75 * on the results of the "Get BT Capabilities" command. */
71#define IPMI_MAX_MSG_LENGTH 272 /* multiple of 16 */ 76#define IPMI_MAX_MSG_LENGTH 272 /* multiple of 16 */
72 77
73#define IPMI_CC_NO_ERROR 0x00 78#define IPMI_CC_NO_ERROR 0x00
74#define IPMI_NODE_BUSY_ERR 0xc0 79#define IPMI_NODE_BUSY_ERR 0xc0
75#define IPMI_INVALID_COMMAND_ERR 0xc1 80#define IPMI_INVALID_COMMAND_ERR 0xc1
81#define IPMI_TIMEOUT_ERR 0xc3
76#define IPMI_ERR_MSG_TRUNCATED 0xc6 82#define IPMI_ERR_MSG_TRUNCATED 0xc6
83#define IPMI_REQ_LEN_INVALID_ERR 0xc7
84#define IPMI_REQ_LEN_EXCEEDED_ERR 0xc8
85#define IPMI_NOT_IN_MY_STATE_ERR 0xd5 /* IPMI 2.0 */
77#define IPMI_LOST_ARBITRATION_ERR 0x81 86#define IPMI_LOST_ARBITRATION_ERR 0x81
87#define IPMI_BUS_ERR 0x82
88#define IPMI_NAK_ON_WRITE_ERR 0x83
78#define IPMI_ERR_UNSPECIFIED 0xff 89#define IPMI_ERR_UNSPECIFIED 0xff
79 90
80#define IPMI_CHANNEL_PROTOCOL_IPMB 1 91#define IPMI_CHANNEL_PROTOCOL_IPMB 1
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 6d9c7e4da472..c0633108d05d 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -115,6 +115,13 @@ struct ipmi_smi_handlers
115 poll for operations during things like crash dumps. */ 115 poll for operations during things like crash dumps. */
116 void (*poll)(void *send_info); 116 void (*poll)(void *send_info);
117 117
118 /* Enable/disable firmware maintenance mode. Note that this
119 is *not* the modes defined, this is simply an on/off
120 setting. The message handler does the mode handling. Note
121 that this is called from interupt context, so it cannot
122 block. */
123 void (*set_maintenance_mode)(void *send_info, int enable);
124
118 /* Tell the handler that we are using it/not using it. The 125 /* Tell the handler that we are using it/not using it. The
119 message handler get the modules that this handler belongs 126 message handler get the modules that this handler belongs
120 to; this function lets the SMI claim any modules that it 127 to; this function lets the SMI claim any modules that it
@@ -173,6 +180,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
173 void *send_info, 180 void *send_info,
174 struct ipmi_device_id *device_id, 181 struct ipmi_device_id *device_id,
175 struct device *dev, 182 struct device *dev,
183 const char *sysfs_name,
176 unsigned char slave_addr); 184 unsigned char slave_addr);
177 185
178/* 186/*
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 4f435c59de06..f8241130f5ea 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -274,7 +274,7 @@ struct ipv6_pinfo {
274 struct in6_addr *saddr_cache; 274 struct in6_addr *saddr_cache;
275#endif 275#endif
276 276
277 __u32 flow_label; 277 __be32 flow_label;
278 __u32 frag_size; 278 __u32 frag_size;
279 __s16 hop_limit; 279 __s16 hop_limit;
280 __s16 mcast_hops; 280 __s16 mcast_hops;
diff --git a/include/linux/ipx.h b/include/linux/ipx.h
index 4f29c60964c4..eb19b4ea84f4 100644
--- a/include/linux/ipx.h
+++ b/include/linux/ipx.h
@@ -7,8 +7,8 @@
7 7
8struct sockaddr_ipx { 8struct sockaddr_ipx {
9 sa_family_t sipx_family; 9 sa_family_t sipx_family;
10 __u16 sipx_port; 10 __be16 sipx_port;
11 __u32 sipx_network; 11 __be32 sipx_network;
12 unsigned char sipx_node[IPX_NODE_LEN]; 12 unsigned char sipx_node[IPX_NODE_LEN];
13 __u8 sipx_type; 13 __u8 sipx_type;
14 unsigned char sipx_zero; /* 16 byte fill */ 14 unsigned char sipx_zero; /* 16 byte fill */
@@ -23,13 +23,13 @@ struct sockaddr_ipx {
23#define IPX_CRTITF 1 23#define IPX_CRTITF 1
24 24
25struct ipx_route_definition { 25struct ipx_route_definition {
26 __u32 ipx_network; 26 __be32 ipx_network;
27 __u32 ipx_router_network; 27 __be32 ipx_router_network;
28 unsigned char ipx_router_node[IPX_NODE_LEN]; 28 unsigned char ipx_router_node[IPX_NODE_LEN];
29}; 29};
30 30
31struct ipx_interface_definition { 31struct ipx_interface_definition {
32 __u32 ipx_network; 32 __be32 ipx_network;
33 unsigned char ipx_device[16]; 33 unsigned char ipx_device[16];
34 unsigned char ipx_dlink_type; 34 unsigned char ipx_dlink_type;
35#define IPX_FRAME_NONE 0 35#define IPX_FRAME_NONE 0
@@ -55,8 +55,8 @@ struct ipx_config_data {
55 */ 55 */
56 56
57struct ipx_route_def { 57struct ipx_route_def {
58 __u32 ipx_network; 58 __be32 ipx_network;
59 __u32 ipx_router_network; 59 __be32 ipx_router_network;
60#define IPX_ROUTE_NO_ROUTER 0 60#define IPX_ROUTE_NO_ROUTER 0
61 unsigned char ipx_router_node[IPX_NODE_LEN]; 61 unsigned char ipx_router_node[IPX_NODE_LEN];
62 unsigned char ipx_device[16]; 62 unsigned char ipx_device[16];
diff --git a/include/linux/ixjuser.h b/include/linux/ixjuser.h
index fd1756d3a47e..88b45895746d 100644
--- a/include/linux/ixjuser.h
+++ b/include/linux/ixjuser.h
@@ -315,7 +315,7 @@ typedef struct {
315* structures. If the freq0 variable is non-zero, the tone table contents 315* structures. If the freq0 variable is non-zero, the tone table contents
316* for the tone_index are updated to the frequencies and gains defined. It 316* for the tone_index are updated to the frequencies and gains defined. It
317* should be noted that DTMF tones cannot be reassigned, so if DTMF tone 317* should be noted that DTMF tones cannot be reassigned, so if DTMF tone
318* table indexs are used in a cadence the frequency and gain variables will 318* table indexes are used in a cadence the frequency and gain variables will
319* be ignored. 319* be ignored.
320* 320*
321* If the array elements contain frequency parameters the driver will 321* If the array elements contain frequency parameters the driver will
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index fe89444b1c6f..452737551260 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -839,7 +839,6 @@ struct journal_s
839 */ 839 */
840 840
841/* Filing buffers */ 841/* Filing buffers */
842extern void __journal_temp_unlink_buffer(struct journal_head *jh);
843extern void journal_unfile_buffer(journal_t *, struct journal_head *); 842extern void journal_unfile_buffer(journal_t *, struct journal_head *);
844extern void __journal_unfile_buffer(struct journal_head *); 843extern void __journal_unfile_buffer(struct journal_head *);
845extern void __journal_refile_buffer(struct journal_head *); 844extern void __journal_refile_buffer(struct journal_head *);
@@ -949,7 +948,7 @@ void journal_put_journal_head(struct journal_head *jh);
949/* 948/*
950 * handle management 949 * handle management
951 */ 950 */
952extern kmem_cache_t *jbd_handle_cache; 951extern struct kmem_cache *jbd_handle_cache;
953 952
954static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags) 953static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags)
955{ 954{
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index ddb128795781..0e0fedd2039a 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -848,7 +848,6 @@ struct journal_s
848 */ 848 */
849 849
850/* Filing buffers */ 850/* Filing buffers */
851extern void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh);
852extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *); 851extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *);
853extern void __jbd2_journal_unfile_buffer(struct journal_head *); 852extern void __jbd2_journal_unfile_buffer(struct journal_head *);
854extern void __jbd2_journal_refile_buffer(struct journal_head *); 853extern void __jbd2_journal_refile_buffer(struct journal_head *);
@@ -958,7 +957,7 @@ void jbd2_journal_put_journal_head(struct journal_head *jh);
958/* 957/*
959 * handle management 958 * handle management
960 */ 959 */
961extern kmem_cache_t *jbd2_handle_cache; 960extern struct kmem_cache *jbd2_handle_cache;
962 961
963static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags) 962static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags)
964{ 963{
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index c8d5f207c3d4..0ec6e28bccd2 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -74,7 +74,7 @@
74#define __jiffy_data __attribute__((section(".data"))) 74#define __jiffy_data __attribute__((section(".data")))
75 75
76/* 76/*
77 * The 64-bit value is not volatile - you MUST NOT read it 77 * The 64-bit value is not atomic - you MUST NOT read it
78 * without sampling the sequence number in xtime_lock. 78 * without sampling the sequence number in xtime_lock.
79 * get_jiffies_64() will do this for you as appropriate. 79 * get_jiffies_64() will do this for you as appropriate.
80 */ 80 */
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index efe0ee4cc80b..06c58c423fe1 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -158,7 +158,7 @@ static inline void con_schedule_flip(struct tty_struct *t)
158 if (t->buf.tail != NULL) 158 if (t->buf.tail != NULL)
159 t->buf.tail->commit = t->buf.tail->used; 159 t->buf.tail->commit = t->buf.tail->used;
160 spin_unlock_irqrestore(&t->buf.lock, flags); 160 spin_unlock_irqrestore(&t->buf.lock, flags);
161 schedule_work(&t->buf.work); 161 schedule_delayed_work(&t->buf.work, 0);
162} 162}
163 163
164#endif 164#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 24b611147adb..6738283ac385 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -30,8 +30,10 @@ extern const char linux_banner[];
30 30
31#define STACK_MAGIC 0xdeadbeef 31#define STACK_MAGIC 0xdeadbeef
32 32
33#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
34#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
35
33#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 36#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
34#define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL))
35#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 37#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
36#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 38#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
37#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 39#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
@@ -63,7 +65,7 @@ struct user;
63 * context (spinlock, irq-handler, ...). 65 * context (spinlock, irq-handler, ...).
64 * 66 *
65 * This is a useful debugging help to be able to catch problems early and not 67 * This is a useful debugging help to be able to catch problems early and not
66 * be biten later when the calling function happens to sleep when it is not 68 * be bitten later when the calling function happens to sleep when it is not
67 * supposed to. 69 * supposed to.
68 */ 70 */
69#ifdef CONFIG_PREEMPT_VOLUNTARY 71#ifdef CONFIG_PREEMPT_VOLUNTARY
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index 891bb2cf0aa8..aea34e74c496 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -47,6 +47,8 @@ typedef struct kcapi_carddef {
47 47
48#include <linux/list.h> 48#include <linux/list.h>
49#include <linux/skbuff.h> 49#include <linux/skbuff.h>
50#include <linux/workqueue.h>
51#include <asm/semaphore.h>
50 52
51#define KCI_CONTRUP 0 /* arg: struct capi_profile */ 53#define KCI_CONTRUP 0 /* arg: struct capi_profile */
52#define KCI_CONTRDOWN 1 /* arg: NULL */ 54#define KCI_CONTRDOWN 1 /* arg: NULL */
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 6427949ddf99..d02425cdd801 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -105,9 +105,14 @@ extern struct page *kimage_alloc_control_pages(struct kimage *image,
105 unsigned int order); 105 unsigned int order);
106extern void crash_kexec(struct pt_regs *); 106extern void crash_kexec(struct pt_regs *);
107int kexec_should_crash(struct task_struct *); 107int kexec_should_crash(struct task_struct *);
108void crash_save_cpu(struct pt_regs *regs, int cpu);
108extern struct kimage *kexec_image; 109extern struct kimage *kexec_image;
109extern struct kimage *kexec_crash_image; 110extern struct kimage *kexec_crash_image;
110 111
112#ifndef kexec_flush_icache_page
113#define kexec_flush_icache_page(page)
114#endif
115
111#define KEXEC_ON_CRASH 0x00000001 116#define KEXEC_ON_CRASH 0x00000001
112#define KEXEC_ARCH_MASK 0xffff0000 117#define KEXEC_ARCH_MASK 0xffff0000
113 118
@@ -122,6 +127,8 @@ extern struct kimage *kexec_crash_image;
122#define KEXEC_ARCH_IA_64 (50 << 16) 127#define KEXEC_ARCH_IA_64 (50 << 16)
123#define KEXEC_ARCH_S390 (22 << 16) 128#define KEXEC_ARCH_S390 (22 << 16)
124#define KEXEC_ARCH_SH (42 << 16) 129#define KEXEC_ARCH_SH (42 << 16)
130#define KEXEC_ARCH_MIPS_LE (10 << 16)
131#define KEXEC_ARCH_MIPS ( 8 << 16)
125 132
126#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ 133#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */
127 134
@@ -131,6 +138,7 @@ extern struct resource crashk_res;
131typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; 138typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
132extern note_buf_t *crash_notes; 139extern note_buf_t *crash_notes;
133 140
141
134#else /* !CONFIG_KEXEC */ 142#else /* !CONFIG_KEXEC */
135struct pt_regs; 143struct pt_regs;
136struct task_struct; 144struct task_struct;
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index bcd9cd173c2c..d1c8d28fa92e 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -47,6 +47,7 @@ enum kobject_action {
47 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */ 47 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */
48 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */ 48 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */
49 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */ 49 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */
50 KOBJ_MOVE = (__force kobject_action_t) 0x08, /* device move */
50}; 51};
51 52
52struct kobject { 53struct kobject {
@@ -76,6 +77,7 @@ extern int __must_check kobject_add(struct kobject *);
76extern void kobject_del(struct kobject *); 77extern void kobject_del(struct kobject *);
77 78
78extern int __must_check kobject_rename(struct kobject *, const char *new_name); 79extern int __must_check kobject_rename(struct kobject *, const char *new_name);
80extern int __must_check kobject_move(struct kobject *, struct kobject *);
79 81
80extern int __must_check kobject_register(struct kobject *); 82extern int __must_check kobject_register(struct kobject *);
81extern void kobject_unregister(struct kobject *); 83extern void kobject_unregister(struct kobject *);
@@ -264,6 +266,8 @@ extern int __must_check subsys_create_file(struct subsystem * ,
264 266
265#if defined(CONFIG_HOTPLUG) 267#if defined(CONFIG_HOTPLUG)
266void kobject_uevent(struct kobject *kobj, enum kobject_action action); 268void kobject_uevent(struct kobject *kobj, enum kobject_action action);
269void kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
270 char *envp[]);
267 271
268int add_uevent_var(char **envp, int num_envp, int *cur_index, 272int add_uevent_var(char **envp, int num_envp, int *cur_index,
269 char *buffer, int buffer_size, int *cur_len, 273 char *buffer, int buffer_size, int *cur_len,
@@ -271,6 +275,10 @@ int add_uevent_var(char **envp, int num_envp, int *cur_index,
271 __attribute__((format (printf, 7, 8))); 275 __attribute__((format (printf, 7, 8)));
272#else 276#else
273static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { } 277static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { }
278static inline void kobject_uevent_env(struct kobject *kobj,
279 enum kobject_action action,
280 char *envp[])
281{ }
274 282
275static inline int add_uevent_var(char **envp, int num_envp, int *cur_index, 283static inline int add_uevent_var(char **envp, int num_envp, int *cur_index,
276 char *buffer, int buffer_size, int *cur_len, 284 char *buffer, int buffer_size, int *cur_len,
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index ac4c0559f751..769be39b9681 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -165,7 +165,7 @@ extern void arch_disarm_kprobe(struct kprobe *p);
165extern int arch_init_kprobes(void); 165extern int arch_init_kprobes(void);
166extern void show_registers(struct pt_regs *regs); 166extern void show_registers(struct pt_regs *regs);
167extern kprobe_opcode_t *get_insn_slot(void); 167extern kprobe_opcode_t *get_insn_slot(void);
168extern void free_insn_slot(kprobe_opcode_t *slot); 168extern void free_insn_slot(kprobe_opcode_t *slot, int dirty);
169extern void kprobes_inc_nmissed_count(struct kprobe *p); 169extern void kprobes_inc_nmissed_count(struct kprobe *p);
170 170
171/* Get the kprobe at this addr (if any) - called with preemption disabled */ 171/* Get the kprobe at this addr (if any) - called with preemption disabled */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 84eeecd60a02..611f17f79eef 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -248,9 +248,9 @@ static inline struct timeval ktime_to_timeval(const ktime_t kt)
248 * 248 *
249 * Returns the scalar nanoseconds representation of kt 249 * Returns the scalar nanoseconds representation of kt
250 */ 250 */
251static inline u64 ktime_to_ns(const ktime_t kt) 251static inline s64 ktime_to_ns(const ktime_t kt)
252{ 252{
253 return (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec; 253 return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
254} 254}
255 255
256#endif 256#endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index abd2debebca2..ab2754830322 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -140,6 +140,7 @@ enum {
140 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */ 140 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */
141 ATA_DFLAG_CDB_INTR = (1 << 2), /* device asserts INTRQ when ready for CDB */ 141 ATA_DFLAG_CDB_INTR = (1 << 2), /* device asserts INTRQ when ready for CDB */
142 ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */ 142 ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */
143 ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */
143 ATA_DFLAG_CFG_MASK = (1 << 8) - 1, 144 ATA_DFLAG_CFG_MASK = (1 << 8) - 1,
144 145
145 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */ 146 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */
@@ -175,6 +176,7 @@ enum {
175 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H 176 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H
176 * Register FIS clearing BSY */ 177 * Register FIS clearing BSY */
177 ATA_FLAG_DEBUGMSG = (1 << 13), 178 ATA_FLAG_DEBUGMSG = (1 << 13),
179 ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */
178 180
179 /* The following flag belongs to ap->pflags but is kept in 181 /* The following flag belongs to ap->pflags but is kept in
180 * ap->flags because it's referenced in many LLDs and will be 182 * ap->flags because it's referenced in many LLDs and will be
@@ -283,6 +285,9 @@ enum {
283 ATA_EHI_QUIET = (1 << 3), /* be quiet */ 285 ATA_EHI_QUIET = (1 << 3), /* be quiet */
284 286
285 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ 287 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */
288 ATA_EHI_PRINTINFO = (1 << 17), /* print configuration info */
289 ATA_EHI_SETMODE = (1 << 18), /* configure transfer mode */
290 ATA_EHI_POST_SETMODE = (1 << 19), /* revaildating after setmode */
286 291
287 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, 292 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
288 293
@@ -307,10 +312,11 @@ enum {
307 (some horkage may be drive/controller pair dependant */ 312 (some horkage may be drive/controller pair dependant */
308 313
309 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ 314 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */
315 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */
316 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
310}; 317};
311 318
312enum hsm_task_states { 319enum hsm_task_states {
313 HSM_ST_UNKNOWN, /* state unknown */
314 HSM_ST_IDLE, /* no command on going */ 320 HSM_ST_IDLE, /* no command on going */
315 HSM_ST, /* (waiting the device to) transfer data */ 321 HSM_ST, /* (waiting the device to) transfer data */
316 HSM_ST_LAST, /* (waiting the device to) complete command */ 322 HSM_ST_LAST, /* (waiting the device to) complete command */
@@ -329,6 +335,7 @@ enum ata_completion_errors {
329 AC_ERR_SYSTEM = (1 << 6), /* system error */ 335 AC_ERR_SYSTEM = (1 << 6), /* system error */
330 AC_ERR_INVALID = (1 << 7), /* invalid argument */ 336 AC_ERR_INVALID = (1 << 7), /* invalid argument */
331 AC_ERR_OTHER = (1 << 8), /* unknown */ 337 AC_ERR_OTHER = (1 << 8), /* unknown */
338 AC_ERR_NODEV_HINT = (1 << 9), /* polling device detection hint */
332}; 339};
333 340
334/* forward declarations */ 341/* forward declarations */
@@ -568,8 +575,9 @@ struct ata_port {
568 struct ata_host *host; 575 struct ata_host *host;
569 struct device *dev; 576 struct device *dev;
570 577
571 struct work_struct port_task; 578 void *port_task_data;
572 struct work_struct hotplug_task; 579 struct delayed_work port_task;
580 struct delayed_work hotplug_task;
573 struct work_struct scsi_rescan_task; 581 struct work_struct scsi_rescan_task;
574 582
575 unsigned int hsm_task_state; 583 unsigned int hsm_task_state;
@@ -700,6 +708,8 @@ extern int sata_phy_debounce(struct ata_port *ap, const unsigned long *param);
700extern int sata_phy_resume(struct ata_port *ap, const unsigned long *param); 708extern int sata_phy_resume(struct ata_port *ap, const unsigned long *param);
701extern int ata_std_prereset(struct ata_port *ap); 709extern int ata_std_prereset(struct ata_port *ap);
702extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes); 710extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes);
711extern int sata_port_hardreset(struct ata_port *ap,
712 const unsigned long *timing);
703extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class); 713extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class);
704extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); 714extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes);
705extern void ata_port_disable(struct ata_port *); 715extern void ata_port_disable(struct ata_port *);
@@ -744,10 +754,9 @@ extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg);
744extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 754extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
745extern void ata_host_resume(struct ata_host *host); 755extern void ata_host_resume(struct ata_host *host);
746extern int ata_ratelimit(void); 756extern int ata_ratelimit(void);
747extern unsigned int ata_busy_sleep(struct ata_port *ap, 757extern int ata_busy_sleep(struct ata_port *ap,
748 unsigned long timeout_pat, 758 unsigned long timeout_pat, unsigned long timeout);
749 unsigned long timeout); 759extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
750extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *),
751 void *data, unsigned long delay); 760 void *data, unsigned long delay);
752extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 761extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
753 unsigned long interval_msec, 762 unsigned long interval_msec,
@@ -787,6 +796,7 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
787 unsigned int ofs, unsigned int len); 796 unsigned int ofs, unsigned int len);
788extern void ata_id_c_string(const u16 *id, unsigned char *s, 797extern void ata_id_c_string(const u16 *id, unsigned char *s,
789 unsigned int ofs, unsigned int len); 798 unsigned int ofs, unsigned int len);
799extern unsigned long ata_device_blacklisted(const struct ata_device *dev);
790extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 800extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
791extern void ata_bmdma_start (struct ata_queued_cmd *qc); 801extern void ata_bmdma_start (struct ata_queued_cmd *qc);
792extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 802extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
@@ -1061,7 +1071,7 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
1061 udelay(10); 1071 udelay(10);
1062 status = ata_chk_status(ap); 1072 status = ata_chk_status(ap);
1063 max--; 1073 max--;
1064 } while ((status & bits) && (max > 0)); 1074 } while (status != 0xff && (status & bits) && (max > 0));
1065 1075
1066 return status; 1076 return status;
1067} 1077}
@@ -1082,7 +1092,7 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
1082{ 1092{
1083 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 1093 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1084 1094
1085 if (status & (ATA_BUSY | ATA_DRQ)) { 1095 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) {
1086 unsigned long l = ap->ioaddr.status_addr; 1096 unsigned long l = ap->ioaddr.status_addr;
1087 if (ata_msg_warn(ap)) 1097 if (ata_msg_warn(ap))
1088 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n", 1098 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
@@ -1148,37 +1158,6 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1148} 1158}
1149 1159
1150/** 1160/**
1151 * ata_irq_on - Enable interrupts on a port.
1152 * @ap: Port on which interrupts are enabled.
1153 *
1154 * Enable interrupts on a legacy IDE device using MMIO or PIO,
1155 * wait for idle, clear any pending interrupts.
1156 *
1157 * LOCKING:
1158 * Inherited from caller.
1159 */
1160
1161static inline u8 ata_irq_on(struct ata_port *ap)
1162{
1163 struct ata_ioports *ioaddr = &ap->ioaddr;
1164 u8 tmp;
1165
1166 ap->ctl &= ~ATA_NIEN;
1167 ap->last_ctl = ap->ctl;
1168
1169 if (ap->flags & ATA_FLAG_MMIO)
1170 writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr);
1171 else
1172 outb(ap->ctl, ioaddr->ctl_addr);
1173 tmp = ata_wait_idle(ap);
1174
1175 ap->ops->irq_clear(ap);
1176
1177 return tmp;
1178}
1179
1180
1181/**
1182 * ata_irq_ack - Acknowledge a device interrupt. 1161 * ata_irq_ack - Acknowledge a device interrupt.
1183 * @ap: Port on which interrupts are enabled. 1162 * @ap: Port on which interrupts are enabled.
1184 * 1163 *
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 862d9730a60d..8c39654549d8 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -164,14 +164,12 @@ void nlmclnt_next_cookie(struct nlm_cookie *);
164 */ 164 */
165struct nlm_host * nlmclnt_lookup_host(const struct sockaddr_in *, int, int, const char *, int); 165struct nlm_host * nlmclnt_lookup_host(const struct sockaddr_in *, int, int, const char *, int);
166struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *, const char *, int); 166struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *, const char *, int);
167struct nlm_host * nlm_lookup_host(int server, const struct sockaddr_in *, int, int, const char *, int);
168struct rpc_clnt * nlm_bind_host(struct nlm_host *); 167struct rpc_clnt * nlm_bind_host(struct nlm_host *);
169void nlm_rebind_host(struct nlm_host *); 168void nlm_rebind_host(struct nlm_host *);
170struct nlm_host * nlm_get_host(struct nlm_host *); 169struct nlm_host * nlm_get_host(struct nlm_host *);
171void nlm_release_host(struct nlm_host *); 170void nlm_release_host(struct nlm_host *);
172void nlm_shutdown_hosts(void); 171void nlm_shutdown_hosts(void);
173extern void nlm_host_rebooted(const struct sockaddr_in *, const char *, int, u32); 172extern void nlm_host_rebooted(const struct sockaddr_in *, const char *, int, u32);
174struct nsm_handle *nsm_find(const struct sockaddr_in *, const char *, int);
175void nsm_release(struct nsm_handle *); 173void nsm_release(struct nsm_handle *);
176 174
177 175
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 819f08f1310d..498bfbd3b4e1 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -193,7 +193,6 @@ extern void lockdep_free_key_range(void *start, unsigned long size);
193 193
194extern void lockdep_off(void); 194extern void lockdep_off(void);
195extern void lockdep_on(void); 195extern void lockdep_on(void);
196extern int lockdep_internal(void);
197 196
198/* 197/*
199 * These methods are used by specific locking variants (spinlocks, 198 * These methods are used by specific locking variants (spinlocks,
@@ -243,6 +242,8 @@ extern void lock_release(struct lockdep_map *lock, int nested,
243 242
244# define INIT_LOCKDEP .lockdep_recursion = 0, 243# define INIT_LOCKDEP .lockdep_recursion = 0,
245 244
245#define lockdep_depth(tsk) ((tsk)->lockdep_depth)
246
246#else /* !LOCKDEP */ 247#else /* !LOCKDEP */
247 248
248static inline void lockdep_off(void) 249static inline void lockdep_off(void)
@@ -253,11 +254,6 @@ static inline void lockdep_on(void)
253{ 254{
254} 255}
255 256
256static inline int lockdep_internal(void)
257{
258 return 0;
259}
260
261# define lock_acquire(l, s, t, r, c, i) do { } while (0) 257# define lock_acquire(l, s, t, r, c, i) do { } while (0)
262# define lock_release(l, n, i) do { } while (0) 258# define lock_release(l, n, i) do { } while (0)
263# define lockdep_init() do { } while (0) 259# define lockdep_init() do { } while (0)
@@ -277,6 +273,9 @@ static inline int lockdep_internal(void)
277 * The class key takes no space if lockdep is disabled: 273 * The class key takes no space if lockdep is disabled:
278 */ 274 */
279struct lock_class_key { }; 275struct lock_class_key { };
276
277#define lockdep_depth(tsk) (0)
278
280#endif /* !LOCKDEP */ 279#endif /* !LOCKDEP */
281 280
282#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS) 281#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS)
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index b03cfb91e228..326da7d500c7 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -31,15 +31,14 @@
31#define HPET_MINOR 228 31#define HPET_MINOR 228
32 32
33struct device; 33struct device;
34struct class_device;
35 34
36struct miscdevice { 35struct miscdevice {
37 int minor; 36 int minor;
38 const char *name; 37 const char *name;
39 const struct file_operations *fops; 38 const struct file_operations *fops;
40 struct list_head list; 39 struct list_head list;
41 struct device *dev; 40 struct device *parent;
42 struct class_device *class; 41 struct device *this_device;
43}; 42};
44 43
45extern int misc_register(struct miscdevice * misc); 44extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d538de901965..a17b147c61e7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -114,6 +114,8 @@ struct vm_area_struct {
114#endif 114#endif
115}; 115};
116 116
117extern struct kmem_cache *vm_area_cachep;
118
117/* 119/*
118 * This struct defines the per-mm list of VMAs for uClinux. If CONFIG_MMU is 120 * This struct defines the per-mm list of VMAs for uClinux. If CONFIG_MMU is
119 * disabled, then there's a single shared list of VMAs maintained by the 121 * disabled, then there's a single shared list of VMAs maintained by the
@@ -294,6 +296,24 @@ void put_pages_list(struct list_head *pages);
294void split_page(struct page *page, unsigned int order); 296void split_page(struct page *page, unsigned int order);
295 297
296/* 298/*
299 * Compound pages have a destructor function. Provide a
300 * prototype for that function and accessor functions.
301 * These are _only_ valid on the head of a PG_compound page.
302 */
303typedef void compound_page_dtor(struct page *);
304
305static inline void set_compound_page_dtor(struct page *page,
306 compound_page_dtor *dtor)
307{
308 page[1].lru.next = (void *)dtor;
309}
310
311static inline compound_page_dtor *get_compound_page_dtor(struct page *page)
312{
313 return (compound_page_dtor *)page[1].lru.next;
314}
315
316/*
297 * Multiple processes may "see" the same page. E.g. for untouched 317 * Multiple processes may "see" the same page. E.g. for untouched
298 * mappings of /dev/null, all processes see the same page full of 318 * mappings of /dev/null, all processes see the same page full of
299 * zeroes, and text pages of executables and shared libraries have 319 * zeroes, and text pages of executables and shared libraries have
@@ -396,7 +416,9 @@ void split_page(struct page *page, unsigned int order);
396 * We are going to use the flags for the page to node mapping if its in 416 * We are going to use the flags for the page to node mapping if its in
397 * there. This includes the case where there is no node, so it is implicit. 417 * there. This includes the case where there is no node, so it is implicit.
398 */ 418 */
399#define FLAGS_HAS_NODE (NODES_WIDTH > 0 || NODES_SHIFT == 0) 419#if !(NODES_WIDTH > 0 || NODES_SHIFT == 0)
420#define NODE_NOT_IN_PAGE_FLAGS
421#endif
400 422
401#ifndef PFN_SECTION_SHIFT 423#ifndef PFN_SECTION_SHIFT
402#define PFN_SECTION_SHIFT 0 424#define PFN_SECTION_SHIFT 0
@@ -411,13 +433,18 @@ void split_page(struct page *page, unsigned int order);
411#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0)) 433#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0))
412#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0)) 434#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0))
413 435
414/* NODE:ZONE or SECTION:ZONE is used to lookup the zone from a page. */ 436/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allcator */
415#if FLAGS_HAS_NODE 437#ifdef NODE_NOT_IN_PAGEFLAGS
416#define ZONETABLE_SHIFT (NODES_SHIFT + ZONES_SHIFT) 438#define ZONEID_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT)
439#else
440#define ZONEID_SHIFT (NODES_SHIFT + ZONES_SHIFT)
441#endif
442
443#if ZONES_WIDTH > 0
444#define ZONEID_PGSHIFT ZONES_PGSHIFT
417#else 445#else
418#define ZONETABLE_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT) 446#define ZONEID_PGSHIFT NODES_PGOFF
419#endif 447#endif
420#define ZONETABLE_PGSHIFT ZONES_PGSHIFT
421 448
422#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 449#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
423#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 450#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
@@ -426,26 +453,28 @@ void split_page(struct page *page, unsigned int order);
426#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 453#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
427#define NODES_MASK ((1UL << NODES_WIDTH) - 1) 454#define NODES_MASK ((1UL << NODES_WIDTH) - 1)
428#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 455#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
429#define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1) 456#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
430 457
431static inline enum zone_type page_zonenum(struct page *page) 458static inline enum zone_type page_zonenum(struct page *page)
432{ 459{
433 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; 460 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
434} 461}
435 462
436struct zone; 463/*
437extern struct zone *zone_table[]; 464 * The identification function is only used by the buddy allocator for
438 465 * determining if two pages could be buddies. We are not really
466 * identifying a zone since we could be using a the section number
467 * id if we have not node id available in page flags.
468 * We guarantee only that it will return the same value for two
469 * combinable pages in a zone.
470 */
439static inline int page_zone_id(struct page *page) 471static inline int page_zone_id(struct page *page)
440{ 472{
441 return (page->flags >> ZONETABLE_PGSHIFT) & ZONETABLE_MASK; 473 BUILD_BUG_ON(ZONEID_PGSHIFT == 0 && ZONEID_MASK);
442} 474 return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
443static inline struct zone *page_zone(struct page *page)
444{
445 return zone_table[page_zone_id(page)];
446} 475}
447 476
448static inline unsigned long zone_to_nid(struct zone *zone) 477static inline int zone_to_nid(struct zone *zone)
449{ 478{
450#ifdef CONFIG_NUMA 479#ifdef CONFIG_NUMA
451 return zone->node; 480 return zone->node;
@@ -454,13 +483,20 @@ static inline unsigned long zone_to_nid(struct zone *zone)
454#endif 483#endif
455} 484}
456 485
457static inline unsigned long page_to_nid(struct page *page) 486#ifdef NODE_NOT_IN_PAGE_FLAGS
487extern int page_to_nid(struct page *page);
488#else
489static inline int page_to_nid(struct page *page)
490{
491 return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
492}
493#endif
494
495static inline struct zone *page_zone(struct page *page)
458{ 496{
459 if (FLAGS_HAS_NODE) 497 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
460 return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
461 else
462 return zone_to_nid(page_zone(page));
463} 498}
499
464static inline unsigned long page_to_section(struct page *page) 500static inline unsigned long page_to_section(struct page *page)
465{ 501{
466 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; 502 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
@@ -477,6 +513,7 @@ static inline void set_page_node(struct page *page, unsigned long node)
477 page->flags &= ~(NODES_MASK << NODES_PGSHIFT); 513 page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
478 page->flags |= (node & NODES_MASK) << NODES_PGSHIFT; 514 page->flags |= (node & NODES_MASK) << NODES_PGSHIFT;
479} 515}
516
480static inline void set_page_section(struct page *page, unsigned long section) 517static inline void set_page_section(struct page *page, unsigned long section)
481{ 518{
482 page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); 519 page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT);
@@ -947,8 +984,6 @@ extern void mem_init(void);
947extern void show_mem(void); 984extern void show_mem(void);
948extern void si_meminfo(struct sysinfo * val); 985extern void si_meminfo(struct sysinfo * val);
949extern void si_meminfo_node(struct sysinfo *val, int nid); 986extern void si_meminfo_node(struct sysinfo *val, int nid);
950extern void zonetable_add(struct zone *zone, int nid, enum zone_type zid,
951 unsigned long pfn, unsigned long size);
952 987
953#ifdef CONFIG_NUMA 988#ifdef CONFIG_NUMA
954extern void setup_per_cpu_pageset(void); 989extern void setup_per_cpu_pageset(void);
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 991a37382a22..d0e6a5497614 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -39,6 +39,10 @@ struct mmc_csd {
39 write_misalign:1; 39 write_misalign:1;
40}; 40};
41 41
42struct mmc_ext_csd {
43 unsigned int hs_max_dtr;
44};
45
42struct sd_scr { 46struct sd_scr {
43 unsigned char sda_vsn; 47 unsigned char sda_vsn;
44 unsigned char bus_widths; 48 unsigned char bus_widths;
@@ -46,6 +50,10 @@ struct sd_scr {
46#define SD_SCR_BUS_WIDTH_4 (1<<2) 50#define SD_SCR_BUS_WIDTH_4 (1<<2)
47}; 51};
48 52
53struct sd_switch_caps {
54 unsigned int hs_max_dtr;
55};
56
49struct mmc_host; 57struct mmc_host;
50 58
51/* 59/*
@@ -62,12 +70,15 @@ struct mmc_card {
62#define MMC_STATE_BAD (1<<2) /* unrecognised device */ 70#define MMC_STATE_BAD (1<<2) /* unrecognised device */
63#define MMC_STATE_SDCARD (1<<3) /* is an SD card */ 71#define MMC_STATE_SDCARD (1<<3) /* is an SD card */
64#define MMC_STATE_READONLY (1<<4) /* card is read-only */ 72#define MMC_STATE_READONLY (1<<4) /* card is read-only */
73#define MMC_STATE_HIGHSPEED (1<<5) /* card is in high speed mode */
65 u32 raw_cid[4]; /* raw card CID */ 74 u32 raw_cid[4]; /* raw card CID */
66 u32 raw_csd[4]; /* raw card CSD */ 75 u32 raw_csd[4]; /* raw card CSD */
67 u32 raw_scr[2]; /* raw card SCR */ 76 u32 raw_scr[2]; /* raw card SCR */
68 struct mmc_cid cid; /* card identification */ 77 struct mmc_cid cid; /* card identification */
69 struct mmc_csd csd; /* card specific */ 78 struct mmc_csd csd; /* card specific */
79 struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */
70 struct sd_scr scr; /* extra SD information */ 80 struct sd_scr scr; /* extra SD information */
81 struct sd_switch_caps sw_caps; /* switch (CMD6) caps */
71}; 82};
72 83
73#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 84#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
@@ -75,12 +86,14 @@ struct mmc_card {
75#define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) 86#define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD)
76#define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD) 87#define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD)
77#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 88#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
89#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
78 90
79#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 91#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
80#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) 92#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD)
81#define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) 93#define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD)
82#define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD) 94#define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD)
83#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 95#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
96#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
84 97
85#define mmc_card_name(c) ((c)->cid.prod_name) 98#define mmc_card_name(c) ((c)->cid.prod_name)
86#define mmc_card_id(c) ((c)->dev.bus_id) 99#define mmc_card_id(c) ((c)->dev.bus_id)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 587264a58d56..c15ae1986b98 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -74,8 +74,8 @@ struct mmc_card;
74struct device; 74struct device;
75 75
76struct mmc_host { 76struct mmc_host {
77 struct device *dev; 77 struct device *parent;
78 struct class_device class_dev; 78 struct device class_dev;
79 int index; 79 int index;
80 const struct mmc_host_ops *ops; 80 const struct mmc_host_ops *ops;
81 unsigned int f_min; 81 unsigned int f_min;
@@ -110,7 +110,7 @@ struct mmc_host {
110 struct mmc_card *card_busy; /* the MMC card claiming host */ 110 struct mmc_card *card_busy; /* the MMC card claiming host */
111 struct mmc_card *card_selected; /* the selected MMC card */ 111 struct mmc_card *card_selected; /* the selected MMC card */
112 112
113 struct work_struct detect; 113 struct delayed_work detect;
114 114
115 unsigned long private[0] ____cacheline_aligned; 115 unsigned long private[0] ____cacheline_aligned;
116}; 116};
@@ -125,8 +125,8 @@ static inline void *mmc_priv(struct mmc_host *host)
125 return (void *)host->private; 125 return (void *)host->private;
126} 126}
127 127
128#define mmc_dev(x) ((x)->dev) 128#define mmc_dev(x) ((x)->parent)
129#define mmc_hostname(x) ((x)->class_dev.class_id) 129#define mmc_hostname(x) ((x)->class_dev.bus_id)
130 130
131extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 131extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
132extern int mmc_resume_host(struct mmc_host *); 132extern int mmc_resume_host(struct mmc_host *);
diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h
index 08dec8d9e703..2dce60c43f4b 100644
--- a/include/linux/mmc/protocol.h
+++ b/include/linux/mmc/protocol.h
@@ -25,14 +25,16 @@
25#ifndef MMC_MMC_PROTOCOL_H 25#ifndef MMC_MMC_PROTOCOL_H
26#define MMC_MMC_PROTOCOL_H 26#define MMC_MMC_PROTOCOL_H
27 27
28/* Standard MMC commands (3.1) type argument response */ 28/* Standard MMC commands (4.1) type argument response */
29 /* class 1 */ 29 /* class 1 */
30#define MMC_GO_IDLE_STATE 0 /* bc */ 30#define MMC_GO_IDLE_STATE 0 /* bc */
31#define MMC_SEND_OP_COND 1 /* bcr [31:0] OCR R3 */ 31#define MMC_SEND_OP_COND 1 /* bcr [31:0] OCR R3 */
32#define MMC_ALL_SEND_CID 2 /* bcr R2 */ 32#define MMC_ALL_SEND_CID 2 /* bcr R2 */
33#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */ 33#define MMC_SET_RELATIVE_ADDR 3 /* ac [31:16] RCA R1 */
34#define MMC_SET_DSR 4 /* bc [31:16] RCA */ 34#define MMC_SET_DSR 4 /* bc [31:16] RCA */
35#define MMC_SWITCH 6 /* ac [31:0] See below R1b */
35#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */ 36#define MMC_SELECT_CARD 7 /* ac [31:16] RCA R1 */
37#define MMC_SEND_EXT_CSD 8 /* adtc R1 */
36#define MMC_SEND_CSD 9 /* ac [31:16] RCA R2 */ 38#define MMC_SEND_CSD 9 /* ac [31:16] RCA R2 */
37#define MMC_SEND_CID 10 /* ac [31:16] RCA R2 */ 39#define MMC_SEND_CID 10 /* ac [31:16] RCA R2 */
38#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */ 40#define MMC_READ_DAT_UNTIL_STOP 11 /* adtc [31:0] dadr R1 */
@@ -80,6 +82,7 @@
80 /* class 8 */ 82 /* class 8 */
81/* This is basically the same command as for MMC with some quirks. */ 83/* This is basically the same command as for MMC with some quirks. */
82#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */ 84#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
85#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
83 86
84 /* Application commands */ 87 /* Application commands */
85#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ 88#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
@@ -88,6 +91,30 @@
88#define SD_APP_SEND_SCR 51 /* adtc R1 */ 91#define SD_APP_SEND_SCR 51 /* adtc R1 */
89 92
90/* 93/*
94 * MMC_SWITCH argument format:
95 *
96 * [31:26] Always 0
97 * [25:24] Access Mode
98 * [23:16] Location of target Byte in EXT_CSD
99 * [15:08] Value Byte
100 * [07:03] Always 0
101 * [02:00] Command Set
102 */
103
104/*
105 * SD_SWITCH argument format:
106 *
107 * [31] Check (0) or switch (1)
108 * [30:24] Reserved (0)
109 * [23:20] Function group 6
110 * [19:16] Function group 5
111 * [15:12] Function group 4
112 * [11:8] Function group 3
113 * [7:4] Function group 2
114 * [3:0] Function group 1
115 */
116
117/*
91 MMC status in R1 118 MMC status in R1
92 Type 119 Type
93 e : error bit 120 e : error bit
@@ -230,13 +257,54 @@ struct _mmc_csd {
230 257
231#define CSD_STRUCT_VER_1_0 0 /* Valid for system specification 1.0 - 1.2 */ 258#define CSD_STRUCT_VER_1_0 0 /* Valid for system specification 1.0 - 1.2 */
232#define CSD_STRUCT_VER_1_1 1 /* Valid for system specification 1.4 - 2.2 */ 259#define CSD_STRUCT_VER_1_1 1 /* Valid for system specification 1.4 - 2.2 */
233#define CSD_STRUCT_VER_1_2 2 /* Valid for system specification 3.1 */ 260#define CSD_STRUCT_VER_1_2 2 /* Valid for system specification 3.1 - 3.2 - 3.31 - 4.0 - 4.1 */
261#define CSD_STRUCT_EXT_CSD 3 /* Version is coded in CSD_STRUCTURE in EXT_CSD */
234 262
235#define CSD_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.2 */ 263#define CSD_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.2 */
236#define CSD_SPEC_VER_1 1 /* Implements system specification 1.4 */ 264#define CSD_SPEC_VER_1 1 /* Implements system specification 1.4 */
237#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */ 265#define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */
238#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 */ 266#define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 - 3.2 - 3.31 */
267#define CSD_SPEC_VER_4 4 /* Implements system specification 4.0 - 4.1 */
268
269/*
270 * EXT_CSD fields
271 */
272
273#define EXT_CSD_BUS_WIDTH 183 /* R/W */
274#define EXT_CSD_HS_TIMING 185 /* R/W */
275#define EXT_CSD_CARD_TYPE 196 /* RO */
276
277/*
278 * EXT_CSD field definitions
279 */
280
281#define EXT_CSD_CMD_SET_NORMAL (1<<0)
282#define EXT_CSD_CMD_SET_SECURE (1<<1)
283#define EXT_CSD_CMD_SET_CPSECURE (1<<2)
284
285#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
286#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
287
288#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
289#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
290#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */
291
292/*
293 * MMC_SWITCH access modes
294 */
295
296#define MMC_SWITCH_MODE_CMD_SET 0x00 /* Change the command set */
297#define MMC_SWITCH_MODE_SET_BITS 0x01 /* Set bits which are 1 in value */
298#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */
299#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */
300
301/*
302 * SCR field definitions
303 */
239 304
305#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */
306#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */
307#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */
240 308
241/* 309/*
242 * SD bus widths 310 * SD bus widths
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index e06683e2bea3..e339a7345f25 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -278,7 +278,7 @@ struct zone {
278 /* 278 /*
279 * rarely used fields: 279 * rarely used fields:
280 */ 280 */
281 char *name; 281 const char *name;
282} ____cacheline_internodealigned_in_smp; 282} ____cacheline_internodealigned_in_smp;
283 283
284/* 284/*
@@ -288,19 +288,94 @@ struct zone {
288 */ 288 */
289#define DEF_PRIORITY 12 289#define DEF_PRIORITY 12
290 290
291/* Maximum number of zones on a zonelist */
292#define MAX_ZONES_PER_ZONELIST (MAX_NUMNODES * MAX_NR_ZONES)
293
294#ifdef CONFIG_NUMA
295/*
296 * We cache key information from each zonelist for smaller cache
297 * footprint when scanning for free pages in get_page_from_freelist().
298 *
299 * 1) The BITMAP fullzones tracks which zones in a zonelist have come
300 * up short of free memory since the last time (last_fullzone_zap)
301 * we zero'd fullzones.
302 * 2) The array z_to_n[] maps each zone in the zonelist to its node
303 * id, so that we can efficiently evaluate whether that node is
304 * set in the current tasks mems_allowed.
305 *
306 * Both fullzones and z_to_n[] are one-to-one with the zonelist,
307 * indexed by a zones offset in the zonelist zones[] array.
308 *
309 * The get_page_from_freelist() routine does two scans. During the
310 * first scan, we skip zones whose corresponding bit in 'fullzones'
311 * is set or whose corresponding node in current->mems_allowed (which
312 * comes from cpusets) is not set. During the second scan, we bypass
313 * this zonelist_cache, to ensure we look methodically at each zone.
314 *
315 * Once per second, we zero out (zap) fullzones, forcing us to
316 * reconsider nodes that might have regained more free memory.
317 * The field last_full_zap is the time we last zapped fullzones.
318 *
319 * This mechanism reduces the amount of time we waste repeatedly
320 * reexaming zones for free memory when they just came up low on
321 * memory momentarilly ago.
322 *
323 * The zonelist_cache struct members logically belong in struct
324 * zonelist. However, the mempolicy zonelists constructed for
325 * MPOL_BIND are intentionally variable length (and usually much
326 * shorter). A general purpose mechanism for handling structs with
327 * multiple variable length members is more mechanism than we want
328 * here. We resort to some special case hackery instead.
329 *
330 * The MPOL_BIND zonelists don't need this zonelist_cache (in good
331 * part because they are shorter), so we put the fixed length stuff
332 * at the front of the zonelist struct, ending in a variable length
333 * zones[], as is needed by MPOL_BIND.
334 *
335 * Then we put the optional zonelist cache on the end of the zonelist
336 * struct. This optional stuff is found by a 'zlcache_ptr' pointer in
337 * the fixed length portion at the front of the struct. This pointer
338 * both enables us to find the zonelist cache, and in the case of
339 * MPOL_BIND zonelists, (which will just set the zlcache_ptr to NULL)
340 * to know that the zonelist cache is not there.
341 *
342 * The end result is that struct zonelists come in two flavors:
343 * 1) The full, fixed length version, shown below, and
344 * 2) The custom zonelists for MPOL_BIND.
345 * The custom MPOL_BIND zonelists have a NULL zlcache_ptr and no zlcache.
346 *
347 * Even though there may be multiple CPU cores on a node modifying
348 * fullzones or last_full_zap in the same zonelist_cache at the same
349 * time, we don't lock it. This is just hint data - if it is wrong now
350 * and then, the allocator will still function, perhaps a bit slower.
351 */
352
353
354struct zonelist_cache {
355 unsigned short z_to_n[MAX_ZONES_PER_ZONELIST]; /* zone->nid */
356 DECLARE_BITMAP(fullzones, MAX_ZONES_PER_ZONELIST); /* zone full? */
357 unsigned long last_full_zap; /* when last zap'd (jiffies) */
358};
359#else
360struct zonelist_cache;
361#endif
362
291/* 363/*
292 * One allocation request operates on a zonelist. A zonelist 364 * One allocation request operates on a zonelist. A zonelist
293 * is a list of zones, the first one is the 'goal' of the 365 * is a list of zones, the first one is the 'goal' of the
294 * allocation, the other zones are fallback zones, in decreasing 366 * allocation, the other zones are fallback zones, in decreasing
295 * priority. 367 * priority.
296 * 368 *
297 * Right now a zonelist takes up less than a cacheline. We never 369 * If zlcache_ptr is not NULL, then it is just the address of zlcache,
298 * modify it apart from boot-up, and only a few indices are used, 370 * as explained above. If zlcache_ptr is NULL, there is no zlcache.
299 * so despite the zonelist table being relatively big, the cache
300 * footprint of this construct is very small.
301 */ 371 */
372
302struct zonelist { 373struct zonelist {
303 struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited 374 struct zonelist_cache *zlcache_ptr; // NULL or &zlcache
375 struct zone *zones[MAX_ZONES_PER_ZONELIST + 1]; // NULL delimited
376#ifdef CONFIG_NUMA
377 struct zonelist_cache zlcache; // optional ...
378#endif
304}; 379};
305 380
306#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 381#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
diff --git a/include/linux/module.h b/include/linux/module.h
index d1d00ce8f4ed..d33df2408e05 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -6,7 +6,6 @@
6 * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996 6 * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996
7 * Rewritten again by Rusty Russell, 2002 7 * Rewritten again by Rusty Russell, 2002
8 */ 8 */
9#include <linux/sched.h>
10#include <linux/spinlock.h> 9#include <linux/spinlock.h>
11#include <linux/list.h> 10#include <linux/list.h>
12#include <linux/stat.h> 11#include <linux/stat.h>
@@ -264,6 +263,7 @@ struct module
264 struct module_attribute *modinfo_attrs; 263 struct module_attribute *modinfo_attrs;
265 const char *version; 264 const char *version;
266 const char *srcversion; 265 const char *srcversion;
266 struct kobject *drivers_dir;
267 267
268 /* Exported symbols */ 268 /* Exported symbols */
269 const struct kernel_symbol *syms; 269 const struct kernel_symbol *syms;
@@ -410,17 +410,7 @@ static inline int try_module_get(struct module *module)
410 return ret; 410 return ret;
411} 411}
412 412
413static inline void module_put(struct module *module) 413extern void module_put(struct module *module);
414{
415 if (module) {
416 unsigned int cpu = get_cpu();
417 local_dec(&module->ref[cpu].count);
418 /* Maybe they're waiting for us to drop reference? */
419 if (unlikely(!module_is_live(module)))
420 wake_up_process(module->waiter);
421 put_cpu();
422 }
423}
424 414
425#else /*!CONFIG_MODULE_UNLOAD*/ 415#else /*!CONFIG_MODULE_UNLOAD*/
426static inline int try_module_get(struct module *module) 416static inline int try_module_get(struct module *module)
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 7c0c2c198f1f..4a189dadb160 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -63,6 +63,9 @@ struct kparam_array
63 not there, read bits mean it's readable, write bits mean it's 63 not there, read bits mean it's readable, write bits mean it's
64 writable. */ 64 writable. */
65#define __module_param_call(prefix, name, set, get, arg, perm) \ 65#define __module_param_call(prefix, name, set, get, arg, perm) \
66 /* Default value instead of permissions? */ \
67 static int __param_perm_check_##name __attribute__((unused)) = \
68 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
66 static char __param_str_##name[] = prefix #name; \ 69 static char __param_str_##name[] = prefix #name; \
67 static struct kernel_param const __param_##name \ 70 static struct kernel_param const __param_##name \
68 __attribute_used__ \ 71 __attribute_used__ \
diff --git a/include/linux/mqueue.h b/include/linux/mqueue.h
index 8db9d75541a6..8b5a79615fbf 100644
--- a/include/linux/mqueue.h
+++ b/include/linux/mqueue.h
@@ -18,8 +18,6 @@
18#ifndef _LINUX_MQUEUE_H 18#ifndef _LINUX_MQUEUE_H
19#define _LINUX_MQUEUE_H 19#define _LINUX_MQUEUE_H
20 20
21#include <linux/types.h>
22
23#define MQ_PRIO_MAX 32768 21#define MQ_PRIO_MAX 32768
24/* per-uid limit of kernel memory used by mqueue, in bytes */ 22/* per-uid limit of kernel memory used by mqueue, in bytes */
25#define MQ_BYTES_MAX 819200 23#define MQ_BYTES_MAX 819200
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index ce6c85815cbd..24a9ef1506b6 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -402,6 +402,8 @@ extern const struct file_operations fat_file_operations;
402extern struct inode_operations fat_file_inode_operations; 402extern struct inode_operations fat_file_inode_operations;
403extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); 403extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
404extern void fat_truncate(struct inode *inode); 404extern void fat_truncate(struct inode *inode);
405extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry,
406 struct kstat *stat);
405 407
406/* fat/inode.c */ 408/* fat/inode.c */
407extern void fat_attach(struct inode *inode, loff_t i_pos); 409extern void fat_attach(struct inode *inode, loff_t i_pos);
diff --git a/include/linux/msg.h b/include/linux/msg.h
index acc7c174ff00..f1b60740d641 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -92,6 +92,12 @@ struct msg_queue {
92 struct list_head q_senders; 92 struct list_head q_senders;
93}; 93};
94 94
95/* Helper routines for sys_msgsnd and sys_msgrcv */
96extern long do_msgsnd(int msqid, long mtype, void __user *mtext,
97 size_t msgsz, int msgflg);
98extern long do_msgrcv(int msqid, long *pmtype, void __user *mtext,
99 size_t msgsz, long msgtyp, int msgflg);
100
95#endif /* __KERNEL__ */ 101#endif /* __KERNEL__ */
96 102
97#endif /* _LINUX_MSG_H */ 103#endif /* _LINUX_MSG_H */
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 27c48daa3183..b2b91c477563 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -94,7 +94,7 @@ do { \
94 94
95#define __MUTEX_INITIALIZER(lockname) \ 95#define __MUTEX_INITIALIZER(lockname) \
96 { .count = ATOMIC_INIT(1) \ 96 { .count = ATOMIC_INIT(1) \
97 , .wait_lock = SPIN_LOCK_UNLOCKED \ 97 , .wait_lock = __SPIN_LOCK_UNLOCKED(lockname.wait_lock) \
98 , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \ 98 , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \
99 __DEBUG_MUTEX_INITIALIZER(lockname) \ 99 __DEBUG_MUTEX_INITIALIZER(lockname) \
100 __DEP_MAP_MUTEX_INITIALIZER(lockname) } 100 __DEP_MAP_MUTEX_INITIALIZER(lockname) }
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index edfa012fad3a..aff25c000abf 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -724,7 +724,7 @@
724#define MV643XX_ETH_RX_FIFO_URGENT_THRESHOLD_REG(port) (0x2470 + (port<<10)) 724#define MV643XX_ETH_RX_FIFO_URGENT_THRESHOLD_REG(port) (0x2470 + (port<<10))
725#define MV643XX_ETH_TX_FIFO_URGENT_THRESHOLD_REG(port) (0x2474 + (port<<10)) 725#define MV643XX_ETH_TX_FIFO_URGENT_THRESHOLD_REG(port) (0x2474 + (port<<10))
726#define MV643XX_ETH_RX_MINIMAL_FRAME_SIZE_REG(port) (0x247c + (port<<10)) 726#define MV643XX_ETH_RX_MINIMAL_FRAME_SIZE_REG(port) (0x247c + (port<<10))
727#define MV643XX_ETH_RX_DISCARDED_FRAMES_COUNTER(port) (0x2484 + (port<<10) 727#define MV643XX_ETH_RX_DISCARDED_FRAMES_COUNTER(port) (0x2484 + (port<<10))
728#define MV643XX_ETH_PORT_DEBUG_0_REG(port) (0x248c + (port<<10)) 728#define MV643XX_ETH_PORT_DEBUG_0_REG(port) (0x248c + (port<<10))
729#define MV643XX_ETH_PORT_DEBUG_1_REG(port) (0x2490 + (port<<10)) 729#define MV643XX_ETH_PORT_DEBUG_1_REG(port) (0x2490 + (port<<10))
730#define MV643XX_ETH_PORT_INTERNAL_ADDR_ERROR_REG(port) (0x2494 + (port<<10)) 730#define MV643XX_ETH_PORT_INTERNAL_ADDR_ERROR_REG(port) (0x2494 + (port<<10))
@@ -1135,7 +1135,7 @@ struct mv64xxx_i2c_pdata {
1135#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_1 (1<<19) 1135#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_1 (1<<19)
1136#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_2 (1<<20) 1136#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_2 (1<<20)
1137#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_3 ((1<<20) | (1<<19)) 1137#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_3 ((1<<20) | (1<<19))
1138#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_4 ((1<<21) 1138#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_4 (1<<21)
1139#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_5 ((1<<21) | (1<<19)) 1139#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_5 ((1<<21) | (1<<19))
1140#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_6 ((1<<21) | (1<<20)) 1140#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_6 ((1<<21) | (1<<20))
1141#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_7 ((1<<21) | (1<<20) | (1<<19)) 1141#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_7 ((1<<21) | (1<<20) | (1<<19))
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index d6b6dc09ad97..0f3e69302540 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -64,6 +64,7 @@ struct nbd_device {
64 struct gendisk *disk; 64 struct gendisk *disk;
65 int blksize; 65 int blksize;
66 u64 bytesize; 66 u64 bytesize;
67 pid_t pid; /* pid of nbd-client, if attached */
67}; 68};
68 69
69#endif 70#endif
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index b089d9506283..a503052138bd 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -127,10 +127,10 @@ struct ncp_server {
127 } unexpected_packet; 127 } unexpected_packet;
128}; 128};
129 129
130extern void ncp_tcp_rcv_proc(void *server); 130extern void ncp_tcp_rcv_proc(struct work_struct *work);
131extern void ncp_tcp_tx_proc(void *server); 131extern void ncp_tcp_tx_proc(struct work_struct *work);
132extern void ncpdgram_rcv_proc(void *server); 132extern void ncpdgram_rcv_proc(struct work_struct *work);
133extern void ncpdgram_timeout_proc(void *server); 133extern void ncpdgram_timeout_proc(struct work_struct *work);
134extern void ncpdgram_timeout_call(unsigned long server); 134extern void ncpdgram_timeout_call(unsigned long server);
135extern void ncp_tcp_data_ready(struct sock* sk, int len); 135extern void ncp_tcp_data_ready(struct sock* sk, int len);
136extern void ncp_tcp_write_space(struct sock* sk); 136extern void ncp_tcp_write_space(struct sock* sk);
diff --git a/include/linux/net.h b/include/linux/net.h
index 15c733b816f0..6f0dfeba509a 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -196,7 +196,7 @@ extern struct socket *sockfd_lookup(int fd, int *err);
196extern int net_ratelimit(void); 196extern int net_ratelimit(void);
197 197
198#define net_random() random32() 198#define net_random() random32()
199#define net_srandom(seed) srandom32(seed) 199#define net_srandom(seed) srandom32((__force u32)seed)
200 200
201extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, 201extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
202 struct kvec *vec, size_t num, size_t len); 202 struct kvec *vec, size_t num, size_t len);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9264139bd8df..c57088f575a3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -30,6 +30,7 @@
30#include <linux/if_packet.h> 30#include <linux/if_packet.h>
31 31
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
33#include <linux/timer.h>
33#include <asm/atomic.h> 34#include <asm/atomic.h>
34#include <asm/cache.h> 35#include <asm/cache.h>
35#include <asm/byteorder.h> 36#include <asm/byteorder.h>
@@ -38,7 +39,6 @@
38#include <linux/percpu.h> 39#include <linux/percpu.h>
39#include <linux/dmaengine.h> 40#include <linux/dmaengine.h>
40 41
41struct divert_blk;
42struct vlan_group; 42struct vlan_group;
43struct ethtool_ops; 43struct ethtool_ops;
44struct netpoll_info; 44struct netpoll_info;
@@ -67,6 +67,10 @@ struct netpoll_info;
67#define NET_RX_CN_HIGH 4 /* The storm is here */ 67#define NET_RX_CN_HIGH 4 /* The storm is here */
68#define NET_RX_BAD 5 /* packet dropped due to kernel error */ 68#define NET_RX_BAD 5 /* packet dropped due to kernel error */
69 69
70/* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It
71 * indicates that the device will soon be dropping packets, or already drops
72 * some packets of the same priority; prompting us to send less aggressively. */
73#define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e))
70#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) 74#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
71 75
72#endif 76#endif
@@ -93,8 +97,10 @@ struct netpoll_info;
93#endif 97#endif
94#endif 98#endif
95 99
96#if !defined(CONFIG_NET_IPIP) && \ 100#if !defined(CONFIG_NET_IPIP) && !defined(CONFIG_NET_IPIP_MODULE) && \
97 !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) 101 !defined(CONFIG_NET_IPGRE) && !defined(CONFIG_NET_IPGRE_MODULE) && \
102 !defined(CONFIG_IPV6_SIT) && !defined(CONFIG_IPV6_SIT_MODULE) && \
103 !defined(CONFIG_IPV6_TUNNEL) && !defined(CONFIG_IPV6_TUNNEL_MODULE)
98#define MAX_HEADER LL_MAX_HEADER 104#define MAX_HEADER LL_MAX_HEADER
99#else 105#else
100#define MAX_HEADER (LL_MAX_HEADER + 48) 106#define MAX_HEADER (LL_MAX_HEADER + 48)
@@ -191,7 +197,7 @@ struct hh_cache
191 * NOTE: For VLANs, this will be the 197 * NOTE: For VLANs, this will be the
192 * encapuslated type. --BLG 198 * encapuslated type. --BLG
193 */ 199 */
194 int hh_len; /* length of header */ 200 u16 hh_len; /* length of header */
195 int (*hh_output)(struct sk_buff *skb); 201 int (*hh_output)(struct sk_buff *skb);
196 rwlock_t hh_lock; 202 rwlock_t hh_lock;
197 203
@@ -515,11 +521,6 @@ struct net_device
515 /* bridge stuff */ 521 /* bridge stuff */
516 struct net_bridge_port *br_port; 522 struct net_bridge_port *br_port;
517 523
518#ifdef CONFIG_NET_DIVERT
519 /* this will get initialized at each interface type init routine */
520 struct divert_blk *divert;
521#endif /* CONFIG_NET_DIVERT */
522
523 /* class/net/name entry */ 524 /* class/net/name entry */
524 struct class_device class_dev; 525 struct class_device class_dev;
525 /* space for optional statistics and wireless sysfs groups */ 526 /* space for optional statistics and wireless sysfs groups */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index b7e67d1d4382..d4c4c5120bc0 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -117,6 +117,16 @@ void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
117int nf_register_sockopt(struct nf_sockopt_ops *reg); 117int nf_register_sockopt(struct nf_sockopt_ops *reg);
118void nf_unregister_sockopt(struct nf_sockopt_ops *reg); 118void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
119 119
120#ifdef CONFIG_SYSCTL
121/* Sysctl registration */
122struct ctl_table_header *nf_register_sysctl_table(struct ctl_table *path,
123 struct ctl_table *table);
124void nf_unregister_sysctl_table(struct ctl_table_header *header,
125 struct ctl_table *table);
126extern struct ctl_table nf_net_netfilter_sysctl_path[];
127extern struct ctl_table nf_net_ipv4_netfilter_sysctl_path[];
128#endif /* CONFIG_SYSCTL */
129
120extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; 130extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
121 131
122/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will 132/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will
@@ -282,15 +292,31 @@ extern void nf_invalidate_cache(int pf);
282 Returns true or false. */ 292 Returns true or false. */
283extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); 293extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
284 294
285extern u_int16_t nf_csum_update(u_int32_t oldval, u_int32_t newval, 295static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
286 u_int32_t csum); 296{
287extern u_int16_t nf_proto_csum_update(struct sk_buff *skb, 297 __be32 diff[] = { ~from, to };
288 u_int32_t oldval, u_int32_t newval, 298
289 u_int16_t csum, int pseudohdr); 299 *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
300}
301
302static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
303{
304 nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
305}
306
307extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
308 __be32 from, __be32 to, int pseudohdr);
309
310static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
311 __be16 from, __be16 to, int pseudohdr)
312{
313 nf_proto_csum_replace4(sum, skb, (__force __be32)from,
314 (__force __be32)to, pseudohdr);
315}
290 316
291struct nf_afinfo { 317struct nf_afinfo {
292 unsigned short family; 318 unsigned short family;
293 unsigned int (*checksum)(struct sk_buff *skb, unsigned int hook, 319 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
294 unsigned int dataoff, u_int8_t protocol); 320 unsigned int dataoff, u_int8_t protocol);
295 void (*saveroute)(const struct sk_buff *skb, 321 void (*saveroute)(const struct sk_buff *skb,
296 struct nf_info *info); 322 struct nf_info *info);
@@ -305,12 +331,12 @@ static inline struct nf_afinfo *nf_get_afinfo(unsigned short family)
305 return rcu_dereference(nf_afinfo[family]); 331 return rcu_dereference(nf_afinfo[family]);
306} 332}
307 333
308static inline unsigned int 334static inline __sum16
309nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, 335nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
310 u_int8_t protocol, unsigned short family) 336 u_int8_t protocol, unsigned short family)
311{ 337{
312 struct nf_afinfo *afinfo; 338 struct nf_afinfo *afinfo;
313 unsigned int csum = 0; 339 __sum16 csum = 0;
314 340
315 rcu_read_lock(); 341 rcu_read_lock();
316 afinfo = nf_get_afinfo(family); 342 afinfo = nf_get_afinfo(family);
@@ -331,7 +357,7 @@ extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
331static inline void 357static inline void
332nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) 358nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family)
333{ 359{
334#ifdef CONFIG_IP_NF_NAT_NEEDED 360#if defined(CONFIG_IP_NF_NAT_NEEDED) || defined(CONFIG_NF_NAT_NEEDED)
335 void (*decodefn)(struct sk_buff *, struct flowi *); 361 void (*decodefn)(struct sk_buff *, struct flowi *);
336 362
337 if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL) 363 if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL)
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 312bd2ffee33..6328175a1c3a 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -14,6 +14,7 @@ header-y += xt_dscp.h
14header-y += xt_DSCP.h 14header-y += xt_DSCP.h
15header-y += xt_esp.h 15header-y += xt_esp.h
16header-y += xt_helper.h 16header-y += xt_helper.h
17header-y += xt_hashlimit.h
17header-y += xt_length.h 18header-y += xt_length.h
18header-y += xt_limit.h 19header-y += xt_limit.h
19header-y += xt_mac.h 20header-y += xt_mac.h
@@ -21,6 +22,7 @@ header-y += xt_mark.h
21header-y += xt_MARK.h 22header-y += xt_MARK.h
22header-y += xt_multiport.h 23header-y += xt_multiport.h
23header-y += xt_NFQUEUE.h 24header-y += xt_NFQUEUE.h
25header-y += xt_NFLOG.h
24header-y += xt_pkttype.h 26header-y += xt_pkttype.h
25header-y += xt_policy.h 27header-y += xt_policy.h
26header-y += xt_realm.h 28header-y += xt_realm.h
diff --git a/include/linux/netfilter/nf_conntrack_amanda.h b/include/linux/netfilter/nf_conntrack_amanda.h
new file mode 100644
index 000000000000..26c223544ae8
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_amanda.h
@@ -0,0 +1,10 @@
1#ifndef _NF_CONNTRACK_AMANDA_H
2#define _NF_CONNTRACK_AMANDA_H
3/* AMANDA tracking. */
4
5extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff **pskb,
6 enum ip_conntrack_info ctinfo,
7 unsigned int matchoff,
8 unsigned int matchlen,
9 struct nf_conntrack_expect *exp);
10#endif /* _NF_CONNTRACK_AMANDA_H */
diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h
index ad4a41c9ce93..81453ea7e4c2 100644
--- a/include/linux/netfilter/nf_conntrack_ftp.h
+++ b/include/linux/netfilter/nf_conntrack_ftp.h
@@ -3,16 +3,16 @@
3/* FTP tracking. */ 3/* FTP tracking. */
4 4
5/* This enum is exposed to userspace */ 5/* This enum is exposed to userspace */
6enum ip_ct_ftp_type 6enum nf_ct_ftp_type
7{ 7{
8 /* PORT command from client */ 8 /* PORT command from client */
9 IP_CT_FTP_PORT, 9 NF_CT_FTP_PORT,
10 /* PASV response from server */ 10 /* PASV response from server */
11 IP_CT_FTP_PASV, 11 NF_CT_FTP_PASV,
12 /* EPRT command from client */ 12 /* EPRT command from client */
13 IP_CT_FTP_EPRT, 13 NF_CT_FTP_EPRT,
14 /* EPSV response from server */ 14 /* EPSV response from server */
15 IP_CT_FTP_EPSV, 15 NF_CT_FTP_EPSV,
16}; 16};
17 17
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
@@ -21,23 +21,23 @@ enum ip_ct_ftp_type
21 21
22#define NUM_SEQ_TO_REMEMBER 2 22#define NUM_SEQ_TO_REMEMBER 2
23/* This structure exists only once per master */ 23/* This structure exists only once per master */
24struct ip_ct_ftp_master { 24struct nf_ct_ftp_master {
25 /* Valid seq positions for cmd matching after newline */ 25 /* Valid seq positions for cmd matching after newline */
26 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER]; 26 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
27 /* 0 means seq_match_aft_nl not set */ 27 /* 0 means seq_match_aft_nl not set */
28 int seq_aft_nl_num[IP_CT_DIR_MAX]; 28 int seq_aft_nl_num[IP_CT_DIR_MAX];
29}; 29};
30 30
31struct ip_conntrack_expect; 31struct nf_conntrack_expect;
32 32
33/* For NAT to hook in when we find a packet which describes what other 33/* For NAT to hook in when we find a packet which describes what other
34 * connection we should expect. */ 34 * connection we should expect. */
35extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb, 35extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff **pskb,
36 enum ip_conntrack_info ctinfo, 36 enum ip_conntrack_info ctinfo,
37 enum ip_ct_ftp_type type, 37 enum nf_ct_ftp_type type,
38 unsigned int matchoff, 38 unsigned int matchoff,
39 unsigned int matchlen, 39 unsigned int matchlen,
40 struct ip_conntrack_expect *exp, 40 struct nf_conntrack_expect *exp,
41 u32 *seq); 41 u32 *seq);
42#endif /* __KERNEL__ */ 42#endif /* __KERNEL__ */
43 43
diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h
new file mode 100644
index 000000000000..08e2f4977c2e
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -0,0 +1,92 @@
1#ifndef _NF_CONNTRACK_H323_H
2#define _NF_CONNTRACK_H323_H
3
4#ifdef __KERNEL__
5
6#include <linux/netfilter/nf_conntrack_h323_asn1.h>
7
8#define RAS_PORT 1719
9#define Q931_PORT 1720
10#define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */
11
12/* This structure exists only once per master */
13struct nf_ct_h323_master {
14
15 /* Original and NATed Q.931 or H.245 signal ports */
16 __be16 sig_port[IP_CT_DIR_MAX];
17
18 /* Original and NATed RTP ports */
19 __be16 rtp_port[H323_RTP_CHANNEL_MAX][IP_CT_DIR_MAX];
20
21 union {
22 /* RAS connection timeout */
23 u_int32_t timeout;
24
25 /* Next TPKT length (for separate TPKT header and data) */
26 u_int16_t tpkt_len[IP_CT_DIR_MAX];
27 };
28};
29
30struct nf_conn;
31
32extern int get_h225_addr(struct nf_conn *ct, unsigned char *data,
33 TransportAddress *taddr,
34 union nf_conntrack_address *addr, __be16 *port);
35extern void nf_conntrack_h245_expect(struct nf_conn *new,
36 struct nf_conntrack_expect *this);
37extern void nf_conntrack_q931_expect(struct nf_conn *new,
38 struct nf_conntrack_expect *this);
39extern int (*set_h245_addr_hook) (struct sk_buff **pskb,
40 unsigned char **data, int dataoff,
41 H245_TransportAddress *taddr,
42 union nf_conntrack_address *addr,
43 __be16 port);
44extern int (*set_h225_addr_hook) (struct sk_buff **pskb,
45 unsigned char **data, int dataoff,
46 TransportAddress *taddr,
47 union nf_conntrack_address *addr,
48 __be16 port);
49extern int (*set_sig_addr_hook) (struct sk_buff **pskb,
50 struct nf_conn *ct,
51 enum ip_conntrack_info ctinfo,
52 unsigned char **data,
53 TransportAddress *taddr, int count);
54extern int (*set_ras_addr_hook) (struct sk_buff **pskb,
55 struct nf_conn *ct,
56 enum ip_conntrack_info ctinfo,
57 unsigned char **data,
58 TransportAddress *taddr, int count);
59extern int (*nat_rtp_rtcp_hook) (struct sk_buff **pskb,
60 struct nf_conn *ct,
61 enum ip_conntrack_info ctinfo,
62 unsigned char **data, int dataoff,
63 H245_TransportAddress *taddr,
64 __be16 port, __be16 rtp_port,
65 struct nf_conntrack_expect *rtp_exp,
66 struct nf_conntrack_expect *rtcp_exp);
67extern int (*nat_t120_hook) (struct sk_buff **pskb, struct nf_conn *ct,
68 enum ip_conntrack_info ctinfo,
69 unsigned char **data, int dataoff,
70 H245_TransportAddress *taddr, __be16 port,
71 struct nf_conntrack_expect *exp);
72extern int (*nat_h245_hook) (struct sk_buff **pskb, struct nf_conn *ct,
73 enum ip_conntrack_info ctinfo,
74 unsigned char **data, int dataoff,
75 TransportAddress *taddr, __be16 port,
76 struct nf_conntrack_expect *exp);
77extern int (*nat_callforwarding_hook) (struct sk_buff **pskb,
78 struct nf_conn *ct,
79 enum ip_conntrack_info ctinfo,
80 unsigned char **data, int dataoff,
81 TransportAddress *taddr,
82 __be16 port,
83 struct nf_conntrack_expect *exp);
84extern int (*nat_q931_hook) (struct sk_buff **pskb, struct nf_conn *ct,
85 enum ip_conntrack_info ctinfo,
86 unsigned char **data, TransportAddress *taddr,
87 int idx, __be16 port,
88 struct nf_conntrack_expect *exp);
89
90#endif
91
92#endif
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h b/include/linux/netfilter/nf_conntrack_h323_asn1.h
index c6e9a0b6d30b..8dab5968fc7e 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h
+++ b/include/linux/netfilter/nf_conntrack_h323_asn1.h
@@ -1,6 +1,6 @@
1/**************************************************************************** 1/****************************************************************************
2 * ip_conntrack_helper_h323_asn1.h - BER and PER decoding library for H.323 2 * ip_conntrack_h323_asn1.h - BER and PER decoding library for H.323
3 * conntrack/NAT module. 3 * conntrack/NAT module.
4 * 4 *
5 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net> 5 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net>
6 * 6 *
@@ -34,13 +34,13 @@
34 * 34 *
35 ****************************************************************************/ 35 ****************************************************************************/
36 36
37#ifndef _IP_CONNTRACK_HELPER_H323_ASN1_H_ 37#ifndef _NF_CONNTRACK_HELPER_H323_ASN1_H_
38#define _IP_CONNTRACK_HELPER_H323_ASN1_H_ 38#define _NF_CONNTRACK_HELPER_H323_ASN1_H_
39 39
40/***************************************************************************** 40/*****************************************************************************
41 * H.323 Types 41 * H.323 Types
42 ****************************************************************************/ 42 ****************************************************************************/
43#include "ip_conntrack_helper_h323_types.h" 43#include "nf_conntrack_h323_types.h"
44 44
45typedef struct { 45typedef struct {
46 enum { 46 enum {
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h b/include/linux/netfilter/nf_conntrack_h323_types.h
index 3d4a773799fc..38d74d5c9700 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_types.h
+++ b/include/linux/netfilter/nf_conntrack_h323_types.h
@@ -10,6 +10,11 @@ typedef struct TransportAddress_ipAddress { /* SEQUENCE */
10 unsigned ip; 10 unsigned ip;
11} TransportAddress_ipAddress; 11} TransportAddress_ipAddress;
12 12
13typedef struct TransportAddress_ip6Address { /* SEQUENCE */
14 int options; /* No use */
15 unsigned ip6;
16} TransportAddress_ip6Address;
17
13typedef struct TransportAddress { /* CHOICE */ 18typedef struct TransportAddress { /* CHOICE */
14 enum { 19 enum {
15 eTransportAddress_ipAddress, 20 eTransportAddress_ipAddress,
@@ -22,6 +27,7 @@ typedef struct TransportAddress { /* CHOICE */
22 } choice; 27 } choice;
23 union { 28 union {
24 TransportAddress_ipAddress ipAddress; 29 TransportAddress_ipAddress ipAddress;
30 TransportAddress_ip6Address ip6Address;
25 }; 31 };
26} TransportAddress; 32} TransportAddress;
27 33
@@ -93,6 +99,11 @@ typedef struct UnicastAddress_iPAddress { /* SEQUENCE */
93 unsigned network; 99 unsigned network;
94} UnicastAddress_iPAddress; 100} UnicastAddress_iPAddress;
95 101
102typedef struct UnicastAddress_iP6Address { /* SEQUENCE */
103 int options; /* No use */
104 unsigned network;
105} UnicastAddress_iP6Address;
106
96typedef struct UnicastAddress { /* CHOICE */ 107typedef struct UnicastAddress { /* CHOICE */
97 enum { 108 enum {
98 eUnicastAddress_iPAddress, 109 eUnicastAddress_iPAddress,
@@ -105,6 +116,7 @@ typedef struct UnicastAddress { /* CHOICE */
105 } choice; 116 } choice;
106 union { 117 union {
107 UnicastAddress_iPAddress iPAddress; 118 UnicastAddress_iPAddress iPAddress;
119 UnicastAddress_iP6Address iP6Address;
108 }; 120 };
109} UnicastAddress; 121} UnicastAddress;
110 122
diff --git a/include/linux/netfilter/nf_conntrack_irc.h b/include/linux/netfilter/nf_conntrack_irc.h
new file mode 100644
index 000000000000..2ab6b8255911
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_irc.h
@@ -0,0 +1,15 @@
1#ifndef _NF_CONNTRACK_IRC_H
2#define _NF_CONNTRACK_IRC_H
3
4#ifdef __KERNEL__
5
6#define IRC_PORT 6667
7
8extern unsigned int (*nf_nat_irc_hook)(struct sk_buff **pskb,
9 enum ip_conntrack_info ctinfo,
10 unsigned int matchoff,
11 unsigned int matchlen,
12 struct nf_conntrack_expect *exp);
13
14#endif /* __KERNEL__ */
15#endif /* _NF_CONNTRACK_IRC_H */
diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h
new file mode 100644
index 000000000000..9d8144a488cd
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_pptp.h
@@ -0,0 +1,322 @@
1/* PPTP constants and structs */
2#ifndef _NF_CONNTRACK_PPTP_H
3#define _NF_CONNTRACK_PPTP_H
4
5#include <linux/netfilter/nf_conntrack_common.h>
6
7/* state of the control session */
8enum pptp_ctrlsess_state {
9 PPTP_SESSION_NONE, /* no session present */
10 PPTP_SESSION_ERROR, /* some session error */
11 PPTP_SESSION_STOPREQ, /* stop_sess request seen */
12 PPTP_SESSION_REQUESTED, /* start_sess request seen */
13 PPTP_SESSION_CONFIRMED, /* session established */
14};
15
16/* state of the call inside the control session */
17enum pptp_ctrlcall_state {
18 PPTP_CALL_NONE,
19 PPTP_CALL_ERROR,
20 PPTP_CALL_OUT_REQ,
21 PPTP_CALL_OUT_CONF,
22 PPTP_CALL_IN_REQ,
23 PPTP_CALL_IN_REP,
24 PPTP_CALL_IN_CONF,
25 PPTP_CALL_CLEAR_REQ,
26};
27
28/* conntrack private data */
29struct nf_ct_pptp_master {
30 enum pptp_ctrlsess_state sstate; /* session state */
31 enum pptp_ctrlcall_state cstate; /* call state */
32 __be16 pac_call_id; /* call id of PAC */
33 __be16 pns_call_id; /* call id of PNS */
34
35 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
36 * and therefore imposes a fixed limit on the number of maps */
37 struct nf_ct_gre_keymap *keymap[IP_CT_DIR_MAX];
38};
39
40struct nf_nat_pptp {
41 __be16 pns_call_id; /* NAT'ed PNS call id */
42 __be16 pac_call_id; /* NAT'ed PAC call id */
43};
44
45#ifdef __KERNEL__
46
47#define PPTP_CONTROL_PORT 1723
48
49#define PPTP_PACKET_CONTROL 1
50#define PPTP_PACKET_MGMT 2
51
52#define PPTP_MAGIC_COOKIE 0x1a2b3c4d
53
54struct pptp_pkt_hdr {
55 __u16 packetLength;
56 __be16 packetType;
57 __be32 magicCookie;
58};
59
60/* PptpControlMessageType values */
61#define PPTP_START_SESSION_REQUEST 1
62#define PPTP_START_SESSION_REPLY 2
63#define PPTP_STOP_SESSION_REQUEST 3
64#define PPTP_STOP_SESSION_REPLY 4
65#define PPTP_ECHO_REQUEST 5
66#define PPTP_ECHO_REPLY 6
67#define PPTP_OUT_CALL_REQUEST 7
68#define PPTP_OUT_CALL_REPLY 8
69#define PPTP_IN_CALL_REQUEST 9
70#define PPTP_IN_CALL_REPLY 10
71#define PPTP_IN_CALL_CONNECT 11
72#define PPTP_CALL_CLEAR_REQUEST 12
73#define PPTP_CALL_DISCONNECT_NOTIFY 13
74#define PPTP_WAN_ERROR_NOTIFY 14
75#define PPTP_SET_LINK_INFO 15
76
77#define PPTP_MSG_MAX 15
78
79/* PptpGeneralError values */
80#define PPTP_ERROR_CODE_NONE 0
81#define PPTP_NOT_CONNECTED 1
82#define PPTP_BAD_FORMAT 2
83#define PPTP_BAD_VALUE 3
84#define PPTP_NO_RESOURCE 4
85#define PPTP_BAD_CALLID 5
86#define PPTP_REMOVE_DEVICE_ERROR 6
87
88struct PptpControlHeader {
89 __be16 messageType;
90 __u16 reserved;
91};
92
93/* FramingCapability Bitmap Values */
94#define PPTP_FRAME_CAP_ASYNC 0x1
95#define PPTP_FRAME_CAP_SYNC 0x2
96
97/* BearerCapability Bitmap Values */
98#define PPTP_BEARER_CAP_ANALOG 0x1
99#define PPTP_BEARER_CAP_DIGITAL 0x2
100
101struct PptpStartSessionRequest {
102 __be16 protocolVersion;
103 __u16 reserved1;
104 __be32 framingCapability;
105 __be32 bearerCapability;
106 __be16 maxChannels;
107 __be16 firmwareRevision;
108 __u8 hostName[64];
109 __u8 vendorString[64];
110};
111
112/* PptpStartSessionResultCode Values */
113#define PPTP_START_OK 1
114#define PPTP_START_GENERAL_ERROR 2
115#define PPTP_START_ALREADY_CONNECTED 3
116#define PPTP_START_NOT_AUTHORIZED 4
117#define PPTP_START_UNKNOWN_PROTOCOL 5
118
119struct PptpStartSessionReply {
120 __be16 protocolVersion;
121 __u8 resultCode;
122 __u8 generalErrorCode;
123 __be32 framingCapability;
124 __be32 bearerCapability;
125 __be16 maxChannels;
126 __be16 firmwareRevision;
127 __u8 hostName[64];
128 __u8 vendorString[64];
129};
130
131/* PptpStopReasons */
132#define PPTP_STOP_NONE 1
133#define PPTP_STOP_PROTOCOL 2
134#define PPTP_STOP_LOCAL_SHUTDOWN 3
135
136struct PptpStopSessionRequest {
137 __u8 reason;
138 __u8 reserved1;
139 __u16 reserved2;
140};
141
142/* PptpStopSessionResultCode */
143#define PPTP_STOP_OK 1
144#define PPTP_STOP_GENERAL_ERROR 2
145
146struct PptpStopSessionReply {
147 __u8 resultCode;
148 __u8 generalErrorCode;
149 __u16 reserved1;
150};
151
152struct PptpEchoRequest {
153 __be32 identNumber;
154};
155
156/* PptpEchoReplyResultCode */
157#define PPTP_ECHO_OK 1
158#define PPTP_ECHO_GENERAL_ERROR 2
159
160struct PptpEchoReply {
161 __be32 identNumber;
162 __u8 resultCode;
163 __u8 generalErrorCode;
164 __u16 reserved;
165};
166
167/* PptpFramingType */
168#define PPTP_ASYNC_FRAMING 1
169#define PPTP_SYNC_FRAMING 2
170#define PPTP_DONT_CARE_FRAMING 3
171
172/* PptpCallBearerType */
173#define PPTP_ANALOG_TYPE 1
174#define PPTP_DIGITAL_TYPE 2
175#define PPTP_DONT_CARE_BEARER_TYPE 3
176
177struct PptpOutCallRequest {
178 __be16 callID;
179 __be16 callSerialNumber;
180 __be32 minBPS;
181 __be32 maxBPS;
182 __be32 bearerType;
183 __be32 framingType;
184 __be16 packetWindow;
185 __be16 packetProcDelay;
186 __be16 phoneNumberLength;
187 __u16 reserved1;
188 __u8 phoneNumber[64];
189 __u8 subAddress[64];
190};
191
192/* PptpCallResultCode */
193#define PPTP_OUTCALL_CONNECT 1
194#define PPTP_OUTCALL_GENERAL_ERROR 2
195#define PPTP_OUTCALL_NO_CARRIER 3
196#define PPTP_OUTCALL_BUSY 4
197#define PPTP_OUTCALL_NO_DIAL_TONE 5
198#define PPTP_OUTCALL_TIMEOUT 6
199#define PPTP_OUTCALL_DONT_ACCEPT 7
200
201struct PptpOutCallReply {
202 __be16 callID;
203 __be16 peersCallID;
204 __u8 resultCode;
205 __u8 generalErrorCode;
206 __be16 causeCode;
207 __be32 connectSpeed;
208 __be16 packetWindow;
209 __be16 packetProcDelay;
210 __be32 physChannelID;
211};
212
213struct PptpInCallRequest {
214 __be16 callID;
215 __be16 callSerialNumber;
216 __be32 callBearerType;
217 __be32 physChannelID;
218 __be16 dialedNumberLength;
219 __be16 dialingNumberLength;
220 __u8 dialedNumber[64];
221 __u8 dialingNumber[64];
222 __u8 subAddress[64];
223};
224
225/* PptpInCallResultCode */
226#define PPTP_INCALL_ACCEPT 1
227#define PPTP_INCALL_GENERAL_ERROR 2
228#define PPTP_INCALL_DONT_ACCEPT 3
229
230struct PptpInCallReply {
231 __be16 callID;
232 __be16 peersCallID;
233 __u8 resultCode;
234 __u8 generalErrorCode;
235 __be16 packetWindow;
236 __be16 packetProcDelay;
237 __u16 reserved;
238};
239
240struct PptpInCallConnected {
241 __be16 peersCallID;
242 __u16 reserved;
243 __be32 connectSpeed;
244 __be16 packetWindow;
245 __be16 packetProcDelay;
246 __be32 callFramingType;
247};
248
249struct PptpClearCallRequest {
250 __be16 callID;
251 __u16 reserved;
252};
253
254struct PptpCallDisconnectNotify {
255 __be16 callID;
256 __u8 resultCode;
257 __u8 generalErrorCode;
258 __be16 causeCode;
259 __u16 reserved;
260 __u8 callStatistics[128];
261};
262
263struct PptpWanErrorNotify {
264 __be16 peersCallID;
265 __u16 reserved;
266 __be32 crcErrors;
267 __be32 framingErrors;
268 __be32 hardwareOverRuns;
269 __be32 bufferOverRuns;
270 __be32 timeoutErrors;
271 __be32 alignmentErrors;
272};
273
274struct PptpSetLinkInfo {
275 __be16 peersCallID;
276 __u16 reserved;
277 __be32 sendAccm;
278 __be32 recvAccm;
279};
280
281union pptp_ctrl_union {
282 struct PptpStartSessionRequest sreq;
283 struct PptpStartSessionReply srep;
284 struct PptpStopSessionRequest streq;
285 struct PptpStopSessionReply strep;
286 struct PptpOutCallRequest ocreq;
287 struct PptpOutCallReply ocack;
288 struct PptpInCallRequest icreq;
289 struct PptpInCallReply icack;
290 struct PptpInCallConnected iccon;
291 struct PptpClearCallRequest clrreq;
292 struct PptpCallDisconnectNotify disc;
293 struct PptpWanErrorNotify wanerr;
294 struct PptpSetLinkInfo setlink;
295};
296
297/* crap needed for nf_conntrack_compat.h */
298struct nf_conn;
299struct nf_conntrack_expect;
300
301extern int
302(*nf_nat_pptp_hook_outbound)(struct sk_buff **pskb,
303 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
304 struct PptpControlHeader *ctlh,
305 union pptp_ctrl_union *pptpReq);
306
307extern int
308(*nf_nat_pptp_hook_inbound)(struct sk_buff **pskb,
309 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
310 struct PptpControlHeader *ctlh,
311 union pptp_ctrl_union *pptpReq);
312
313extern void
314(*nf_nat_pptp_hook_exp_gre)(struct nf_conntrack_expect *exp_orig,
315 struct nf_conntrack_expect *exp_reply);
316
317extern void
318(*nf_nat_pptp_hook_expectfn)(struct nf_conn *ct,
319 struct nf_conntrack_expect *exp);
320
321#endif /* __KERNEL__ */
322#endif /* _NF_CONNTRACK_PPTP_H */
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h
new file mode 100644
index 000000000000..4e6bbce04ff8
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_proto_gre.h
@@ -0,0 +1,112 @@
1#ifndef _CONNTRACK_PROTO_GRE_H
2#define _CONNTRACK_PROTO_GRE_H
3#include <asm/byteorder.h>
4
5/* GRE PROTOCOL HEADER */
6
7/* GRE Version field */
8#define GRE_VERSION_1701 0x0
9#define GRE_VERSION_PPTP 0x1
10
11/* GRE Protocol field */
12#define GRE_PROTOCOL_PPTP 0x880B
13
14/* GRE Flags */
15#define GRE_FLAG_C 0x80
16#define GRE_FLAG_R 0x40
17#define GRE_FLAG_K 0x20
18#define GRE_FLAG_S 0x10
19#define GRE_FLAG_A 0x80
20
21#define GRE_IS_C(f) ((f)&GRE_FLAG_C)
22#define GRE_IS_R(f) ((f)&GRE_FLAG_R)
23#define GRE_IS_K(f) ((f)&GRE_FLAG_K)
24#define GRE_IS_S(f) ((f)&GRE_FLAG_S)
25#define GRE_IS_A(f) ((f)&GRE_FLAG_A)
26
27/* GRE is a mess: Four different standards */
28struct gre_hdr {
29#if defined(__LITTLE_ENDIAN_BITFIELD)
30 __u16 rec:3,
31 srr:1,
32 seq:1,
33 key:1,
34 routing:1,
35 csum:1,
36 version:3,
37 reserved:4,
38 ack:1;
39#elif defined(__BIG_ENDIAN_BITFIELD)
40 __u16 csum:1,
41 routing:1,
42 key:1,
43 seq:1,
44 srr:1,
45 rec:3,
46 ack:1,
47 reserved:4,
48 version:3;
49#else
50#error "Adjust your <asm/byteorder.h> defines"
51#endif
52 __be16 protocol;
53};
54
55/* modified GRE header for PPTP */
56struct gre_hdr_pptp {
57 __u8 flags; /* bitfield */
58 __u8 version; /* should be GRE_VERSION_PPTP */
59 __be16 protocol; /* should be GRE_PROTOCOL_PPTP */
60 __be16 payload_len; /* size of ppp payload, not inc. gre header */
61 __be16 call_id; /* peer's call_id for this session */
62 __be32 seq; /* sequence number. Present if S==1 */
63 __be32 ack; /* seq number of highest packet recieved by */
64 /* sender in this session */
65};
66
67struct nf_ct_gre {
68 unsigned int stream_timeout;
69 unsigned int timeout;
70};
71
72#ifdef __KERNEL__
73#include <net/netfilter/nf_conntrack_tuple.h>
74
75struct nf_conn;
76
77/* structure for original <-> reply keymap */
78struct nf_ct_gre_keymap {
79 struct list_head list;
80 struct nf_conntrack_tuple tuple;
81};
82
83/* add new tuple->key_reply pair to keymap */
84int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
85 struct nf_conntrack_tuple *t);
86
87/* delete keymap entries */
88void nf_ct_gre_keymap_destroy(struct nf_conn *ct);
89
90/* get pointer to gre key, if present */
91static inline __be32 *gre_key(struct gre_hdr *greh)
92{
93 if (!greh->key)
94 return NULL;
95 if (greh->csum || greh->routing)
96 return (__be32 *)(greh+sizeof(*greh)+4);
97 return (__be32 *)(greh+sizeof(*greh));
98}
99
100/* get pointer ot gre csum, if present */
101static inline __sum16 *gre_csum(struct gre_hdr *greh)
102{
103 if (!greh->csum)
104 return NULL;
105 return (__sum16 *)(greh+sizeof(*greh));
106}
107
108extern void nf_ct_gre_keymap_flush(void);
109extern void nf_nat_need_gre(void);
110
111#endif /* __KERNEL__ */
112#endif /* _CONNTRACK_PROTO_GRE_H */
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h
index b8994d9fd1a9..5cf2c115cce4 100644
--- a/include/linux/netfilter/nf_conntrack_sctp.h
+++ b/include/linux/netfilter/nf_conntrack_sctp.h
@@ -20,7 +20,7 @@ struct ip_ct_sctp
20{ 20{
21 enum sctp_conntrack state; 21 enum sctp_conntrack state;
22 22
23 u_int32_t vtag[IP_CT_DIR_MAX]; 23 __be32 vtag[IP_CT_DIR_MAX];
24 u_int32_t ttag[IP_CT_DIR_MAX]; 24 u_int32_t ttag[IP_CT_DIR_MAX];
25}; 25};
26 26
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
new file mode 100644
index 000000000000..bb7f2041db74
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -0,0 +1,41 @@
1#ifndef __NF_CONNTRACK_SIP_H__
2#define __NF_CONNTRACK_SIP_H__
3#ifdef __KERNEL__
4
5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600
7
8enum sip_header_pos {
9 POS_REG_REQ_URI,
10 POS_REQ_URI,
11 POS_FROM,
12 POS_TO,
13 POS_VIA,
14 POS_CONTACT,
15 POS_CONTENT,
16 POS_MEDIA,
17 POS_OWNER_IP4,
18 POS_CONNECTION_IP4,
19 POS_OWNER_IP6,
20 POS_CONNECTION_IP6,
21 POS_SDP_HEADER,
22};
23
24extern unsigned int (*nf_nat_sip_hook)(struct sk_buff **pskb,
25 enum ip_conntrack_info ctinfo,
26 struct nf_conn *ct,
27 const char **dptr);
28extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff **pskb,
29 enum ip_conntrack_info ctinfo,
30 struct nf_conntrack_expect *exp,
31 const char *dptr);
32
33extern int ct_sip_get_info(struct nf_conn *ct, const char *dptr, size_t dlen,
34 unsigned int *matchoff, unsigned int *matchlen,
35 enum sip_header_pos pos);
36extern int ct_sip_lnlen(const char *line, const char *limit);
37extern const char *ct_sip_search(const char *needle, const char *haystack,
38 size_t needle_len, size_t haystack_len,
39 int case_sensitive);
40#endif /* __KERNEL__ */
41#endif /* __NF_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter/nf_conntrack_tftp.h b/include/linux/netfilter/nf_conntrack_tftp.h
new file mode 100644
index 000000000000..0d79b7ae051f
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_tftp.h
@@ -0,0 +1,20 @@
1#ifndef _NF_CONNTRACK_TFTP_H
2#define _NF_CONNTRACK_TFTP_H
3
4#define TFTP_PORT 69
5
6struct tftphdr {
7 __be16 opcode;
8};
9
10#define TFTP_OPCODE_READ 1
11#define TFTP_OPCODE_WRITE 2
12#define TFTP_OPCODE_DATA 3
13#define TFTP_OPCODE_ACK 4
14#define TFTP_OPCODE_ERROR 5
15
16extern unsigned int (*nf_nat_tftp_hook)(struct sk_buff **pskb,
17 enum ip_conntrack_info ctinfo,
18 struct nf_conntrack_expect *exp);
19
20#endif /* _NF_CONNTRACK_TFTP_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 6d8e3e5a80e9..1e9c821f152d 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -78,7 +78,7 @@ struct nfattr
78struct nfgenmsg { 78struct nfgenmsg {
79 u_int8_t nfgen_family; /* AF_xxx */ 79 u_int8_t nfgen_family; /* AF_xxx */
80 u_int8_t version; /* nfnetlink version */ 80 u_int8_t version; /* nfnetlink version */
81 u_int16_t res_id; /* resource id */ 81 __be16 res_id; /* resource id */
82}; 82};
83 83
84#define NFNETLINK_V0 0 84#define NFNETLINK_V0 0
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index 87b92f8b988f..5966afa026e9 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -16,24 +16,22 @@ enum nfulnl_msg_types {
16}; 16};
17 17
18struct nfulnl_msg_packet_hdr { 18struct nfulnl_msg_packet_hdr {
19 u_int16_t hw_protocol; /* hw protocol (network order) */ 19 __be16 hw_protocol; /* hw protocol (network order) */
20 u_int8_t hook; /* netfilter hook */ 20 u_int8_t hook; /* netfilter hook */
21 u_int8_t _pad; 21 u_int8_t _pad;
22}; 22};
23 23
24struct nfulnl_msg_packet_hw { 24struct nfulnl_msg_packet_hw {
25 u_int16_t hw_addrlen; 25 __be16 hw_addrlen;
26 u_int16_t _pad; 26 u_int16_t _pad;
27 u_int8_t hw_addr[8]; 27 u_int8_t hw_addr[8];
28}; 28};
29 29
30struct nfulnl_msg_packet_timestamp { 30struct nfulnl_msg_packet_timestamp {
31 aligned_u64 sec; 31 aligned_be64 sec;
32 aligned_u64 usec; 32 aligned_be64 usec;
33}; 33};
34 34
35#define NFULNL_PREFIXLEN 30 /* just like old log target */
36
37enum nfulnl_attr_type { 35enum nfulnl_attr_type {
38 NFULA_UNSPEC, 36 NFULA_UNSPEC,
39 NFULA_PACKET_HDR, 37 NFULA_PACKET_HDR,
@@ -67,7 +65,7 @@ struct nfulnl_msg_config_cmd {
67} __attribute__ ((packed)); 65} __attribute__ ((packed));
68 66
69struct nfulnl_msg_config_mode { 67struct nfulnl_msg_config_mode {
70 u_int32_t copy_range; 68 __be32 copy_range;
71 u_int8_t copy_mode; 69 u_int8_t copy_mode;
72 u_int8_t _pad; 70 u_int8_t _pad;
73} __attribute__ ((packed)); 71} __attribute__ ((packed));
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index 36af0360b56d..83e789633e35 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -13,20 +13,20 @@ enum nfqnl_msg_types {
13}; 13};
14 14
15struct nfqnl_msg_packet_hdr { 15struct nfqnl_msg_packet_hdr {
16 u_int32_t packet_id; /* unique ID of packet in queue */ 16 __be32 packet_id; /* unique ID of packet in queue */
17 u_int16_t hw_protocol; /* hw protocol (network order) */ 17 __be16 hw_protocol; /* hw protocol (network order) */
18 u_int8_t hook; /* netfilter hook */ 18 u_int8_t hook; /* netfilter hook */
19} __attribute__ ((packed)); 19} __attribute__ ((packed));
20 20
21struct nfqnl_msg_packet_hw { 21struct nfqnl_msg_packet_hw {
22 u_int16_t hw_addrlen; 22 __be16 hw_addrlen;
23 u_int16_t _pad; 23 u_int16_t _pad;
24 u_int8_t hw_addr[8]; 24 u_int8_t hw_addr[8];
25}; 25};
26 26
27struct nfqnl_msg_packet_timestamp { 27struct nfqnl_msg_packet_timestamp {
28 aligned_u64 sec; 28 aligned_be64 sec;
29 aligned_u64 usec; 29 aligned_be64 usec;
30}; 30};
31 31
32enum nfqnl_attr_type { 32enum nfqnl_attr_type {
@@ -47,8 +47,8 @@ enum nfqnl_attr_type {
47#define NFQA_MAX (__NFQA_MAX - 1) 47#define NFQA_MAX (__NFQA_MAX - 1)
48 48
49struct nfqnl_msg_verdict_hdr { 49struct nfqnl_msg_verdict_hdr {
50 u_int32_t verdict; 50 __be32 verdict;
51 u_int32_t id; 51 __be32 id;
52}; 52};
53 53
54 54
@@ -63,7 +63,7 @@ enum nfqnl_msg_config_cmds {
63struct nfqnl_msg_config_cmd { 63struct nfqnl_msg_config_cmd {
64 u_int8_t command; /* nfqnl_msg_config_cmds */ 64 u_int8_t command; /* nfqnl_msg_config_cmds */
65 u_int8_t _pad; 65 u_int8_t _pad;
66 u_int16_t pf; /* AF_xxx for PF_[UN]BIND */ 66 __be16 pf; /* AF_xxx for PF_[UN]BIND */
67}; 67};
68 68
69enum nfqnl_config_mode { 69enum nfqnl_config_mode {
@@ -73,7 +73,7 @@ enum nfqnl_config_mode {
73}; 73};
74 74
75struct nfqnl_msg_config_params { 75struct nfqnl_msg_config_params {
76 u_int32_t copy_range; 76 __be32 copy_range;
77 u_int8_t copy_mode; /* enum nfqnl_config_mode */ 77 u_int8_t copy_mode; /* enum nfqnl_config_mode */
78} __attribute__ ((packed)); 78} __attribute__ ((packed));
79 79
@@ -82,6 +82,7 @@ enum nfqnl_attr_config {
82 NFQA_CFG_UNSPEC, 82 NFQA_CFG_UNSPEC,
83 NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */ 83 NFQA_CFG_CMD, /* nfqnl_msg_config_cmd */
84 NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */ 84 NFQA_CFG_PARAMS, /* nfqnl_msg_config_params */
85 NFQA_CFG_QUEUE_MAXLEN, /* u_int32_t */
85 __NFQA_CFG_MAX 86 __NFQA_CFG_MAX
86}; 87};
87#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1) 88#define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 04319a76103a..022edfa97ed9 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -96,22 +96,6 @@ struct _xt_align
96/* Error verdict. */ 96/* Error verdict. */
97#define XT_ERROR_TARGET "ERROR" 97#define XT_ERROR_TARGET "ERROR"
98 98
99/*
100 * New IP firewall options for [gs]etsockopt at the RAW IP level.
101 * Unlike BSD Linux inherits IP options so you don't have to use a raw
102 * socket for this. Instead we check rights in the calls. */
103#define XT_BASE_CTL 64 /* base for firewall socket options */
104
105#define XT_SO_SET_REPLACE (XT_BASE_CTL)
106#define XT_SO_SET_ADD_COUNTERS (XT_BASE_CTL + 1)
107#define XT_SO_SET_MAX XT_SO_SET_ADD_COUNTERS
108
109#define XT_SO_GET_INFO (XT_BASE_CTL)
110#define XT_SO_GET_ENTRIES (XT_BASE_CTL + 1)
111#define XT_SO_GET_REVISION_MATCH (XT_BASE_CTL + 2)
112#define XT_SO_GET_REVISION_TARGET (XT_BASE_CTL + 3)
113#define XT_SO_GET_MAX XT_SO_GET_REVISION_TARGET
114
115#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) 99#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
116#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) 100#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
117 101
diff --git a/include/linux/netfilter/xt_NFLOG.h b/include/linux/netfilter/xt_NFLOG.h
new file mode 100644
index 000000000000..cdcd0ed58f7a
--- /dev/null
+++ b/include/linux/netfilter/xt_NFLOG.h
@@ -0,0 +1,18 @@
1#ifndef _XT_NFLOG_TARGET
2#define _XT_NFLOG_TARGET
3
4#define XT_NFLOG_DEFAULT_GROUP 0x1
5#define XT_NFLOG_DEFAULT_THRESHOLD 1
6
7#define XT_NFLOG_MASK 0x0
8
9struct xt_nflog_info {
10 u_int32_t len;
11 u_int16_t group;
12 u_int16_t threshold;
13 u_int16_t flags;
14 u_int16_t pad;
15 char prefix[64];
16};
17
18#endif /* _XT_NFLOG_TARGET */
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 4c2d9945ca54..70b6f718cf4c 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -29,14 +29,14 @@
29struct ip_conntrack_old_tuple 29struct ip_conntrack_old_tuple
30{ 30{
31 struct { 31 struct {
32 __u32 ip; 32 __be32 ip;
33 union { 33 union {
34 __u16 all; 34 __u16 all;
35 } u; 35 } u;
36 } src; 36 } src;
37 37
38 struct { 38 struct {
39 __u32 ip; 39 __be32 ip;
40 union { 40 union {
41 __u16 all; 41 __u16 all;
42 } u; 42 } u;
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
new file mode 100644
index 000000000000..b4556b8edbfd
--- /dev/null
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -0,0 +1,40 @@
1#ifndef _XT_HASHLIMIT_H
2#define _XT_HASHLIMIT_H
3
4/* timings are in milliseconds. */
5#define XT_HASHLIMIT_SCALE 10000
6/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
7 seconds, or one every 59 hours. */
8
9/* details of this structure hidden by the implementation */
10struct xt_hashlimit_htable;
11
12#define XT_HASHLIMIT_HASH_DIP 0x0001
13#define XT_HASHLIMIT_HASH_DPT 0x0002
14#define XT_HASHLIMIT_HASH_SIP 0x0004
15#define XT_HASHLIMIT_HASH_SPT 0x0008
16
17struct hashlimit_cfg {
18 u_int32_t mode; /* bitmask of IPT_HASHLIMIT_HASH_* */
19 u_int32_t avg; /* Average secs between packets * scale */
20 u_int32_t burst; /* Period multiplier for upper limit. */
21
22 /* user specified */
23 u_int32_t size; /* how many buckets */
24 u_int32_t max; /* max number of entries */
25 u_int32_t gc_interval; /* gc interval */
26 u_int32_t expire; /* when do entries expire? */
27};
28
29struct xt_hashlimit_info {
30 char name [IFNAMSIZ]; /* name */
31 struct hashlimit_cfg cfg;
32 struct xt_hashlimit_htable *hinfo;
33
34 /* Used internally by the kernel */
35 union {
36 void *ptr;
37 struct xt_hashlimit_info *master;
38 } u;
39};
40#endif /*_XT_HASHLIMIT_H*/
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h
index a8132ec076fb..45654d359a68 100644
--- a/include/linux/netfilter/xt_policy.h
+++ b/include/linux/netfilter/xt_policy.h
@@ -39,7 +39,7 @@ struct xt_policy_elem
39 union xt_policy_addr smask; 39 union xt_policy_addr smask;
40 union xt_policy_addr daddr; 40 union xt_policy_addr daddr;
41 union xt_policy_addr dmask; 41 union xt_policy_addr dmask;
42 u_int32_t spi; 42 __be32 spi;
43 u_int32_t reqid; 43 u_int32_t reqid;
44 u_int8_t proto; 44 u_int8_t proto;
45 u_int8_t mode; 45 u_int8_t mode;
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 44e39b61d9e7..0be235418a2f 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -112,19 +112,20 @@ struct arpt_entry
112 * New IP firewall options for [gs]etsockopt at the RAW IP level. 112 * New IP firewall options for [gs]etsockopt at the RAW IP level.
113 * Unlike BSD Linux inherits IP options so you don't have to use a raw 113 * Unlike BSD Linux inherits IP options so you don't have to use a raw
114 * socket for this. Instead we check rights in the calls. 114 * socket for this. Instead we check rights in the calls.
115 *
116 * ATTENTION: check linux/in.h before adding new number here.
115 */ 117 */
116#define ARPT_CTL_OFFSET 32 118#define ARPT_BASE_CTL 96
117#define ARPT_BASE_CTL (XT_BASE_CTL+ARPT_CTL_OFFSET) 119
118 120#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL)
119#define ARPT_SO_SET_REPLACE (XT_SO_SET_REPLACE+ARPT_CTL_OFFSET) 121#define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1)
120#define ARPT_SO_SET_ADD_COUNTERS (XT_SO_SET_ADD_COUNTERS+ARPT_CTL_OFFSET) 122#define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS
121#define ARPT_SO_SET_MAX (XT_SO_SET_MAX+ARPT_CTL_OFFSET) 123
122 124#define ARPT_SO_GET_INFO (ARPT_BASE_CTL)
123#define ARPT_SO_GET_INFO (XT_SO_GET_INFO+ARPT_CTL_OFFSET) 125#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1)
124#define ARPT_SO_GET_ENTRIES (XT_SO_GET_ENTRIES+ARPT_CTL_OFFSET) 126/* #define ARPT_SO_GET_REVISION_MATCH (APRT_BASE_CTL + 2) */
125/* #define ARPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH */ 127#define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3)
126#define ARPT_SO_GET_REVISION_TARGET (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET) 128#define ARPT_SO_GET_MAX (ARPT_SO_GET_REVISION_TARGET)
127#define ARPT_SO_GET_MAX (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET)
128 129
129/* CONTINUE verdict for targets */ 130/* CONTINUE verdict for targets */
130#define ARPT_CONTINUE XT_CONTINUE 131#define ARPT_CONTINUE XT_CONTINUE
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 9a4dd11af86e..6c4613f8ad75 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -64,7 +64,7 @@ static inline int nf_bridge_pad(const struct sk_buff *skb)
64 64
65struct bridge_skb_cb { 65struct bridge_skb_cb {
66 union { 66 union {
67 __u32 ipv4; 67 __be32 ipv4;
68 } daddr; 68 } daddr;
69}; 69};
70 70
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index b9f712c14a0a..07f044ff1a6b 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -28,21 +28,21 @@ struct hdr_ui {
28 uint8_t ssap; 28 uint8_t ssap;
29 uint8_t ctrl; 29 uint8_t ctrl;
30 uint8_t orig[3]; 30 uint8_t orig[3];
31 uint16_t type; 31 __be16 type;
32}; 32};
33 33
34struct hdr_ni { 34struct hdr_ni {
35 uint8_t dsap; 35 uint8_t dsap;
36 uint8_t ssap; 36 uint8_t ssap;
37 uint16_t ctrl; 37 __be16 ctrl;
38 uint8_t orig[3]; 38 uint8_t orig[3];
39 uint16_t type; 39 __be16 type;
40}; 40};
41 41
42struct ebt_802_3_hdr { 42struct ebt_802_3_hdr {
43 uint8_t daddr[6]; 43 uint8_t daddr[6];
44 uint8_t saddr[6]; 44 uint8_t saddr[6];
45 uint16_t len; 45 __be16 len;
46 union { 46 union {
47 struct hdr_ui ui; 47 struct hdr_ui ui;
48 struct hdr_ni ni; 48 struct hdr_ni ni;
@@ -61,7 +61,7 @@ static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
61struct ebt_802_3_info 61struct ebt_802_3_info
62{ 62{
63 uint8_t sap; 63 uint8_t sap;
64 uint16_t type; 64 __be16 type;
65 uint8_t bitmask; 65 uint8_t bitmask;
66 uint8_t invflags; 66 uint8_t invflags;
67}; 67};
diff --git a/include/linux/netfilter_bridge/ebt_among.h b/include/linux/netfilter_bridge/ebt_among.h
index 307c1fed8511..7654069233ca 100644
--- a/include/linux/netfilter_bridge/ebt_among.h
+++ b/include/linux/netfilter_bridge/ebt_among.h
@@ -32,7 +32,7 @@
32struct ebt_mac_wormhash_tuple 32struct ebt_mac_wormhash_tuple
33{ 33{
34 uint32_t cmp[2]; 34 uint32_t cmp[2];
35 uint32_t ip; 35 __be32 ip;
36}; 36};
37 37
38struct ebt_mac_wormhash 38struct ebt_mac_wormhash
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h
index 537ec6b487a2..97e4dbde1f89 100644
--- a/include/linux/netfilter_bridge/ebt_arp.h
+++ b/include/linux/netfilter_bridge/ebt_arp.h
@@ -14,13 +14,13 @@
14 14
15struct ebt_arp_info 15struct ebt_arp_info
16{ 16{
17 uint16_t htype; 17 __be16 htype;
18 uint16_t ptype; 18 __be16 ptype;
19 uint16_t opcode; 19 __be16 opcode;
20 uint32_t saddr; 20 __be32 saddr;
21 uint32_t smsk; 21 __be32 smsk;
22 uint32_t daddr; 22 __be32 daddr;
23 uint32_t dmsk; 23 __be32 dmsk;
24 unsigned char smaddr[ETH_ALEN]; 24 unsigned char smaddr[ETH_ALEN];
25 unsigned char smmsk[ETH_ALEN]; 25 unsigned char smmsk[ETH_ALEN];
26 unsigned char dmaddr[ETH_ALEN]; 26 unsigned char dmaddr[ETH_ALEN];
diff --git a/include/linux/netfilter_bridge/ebt_ip.h b/include/linux/netfilter_bridge/ebt_ip.h
index 7247385cdcb1..d6847475bf2e 100644
--- a/include/linux/netfilter_bridge/ebt_ip.h
+++ b/include/linux/netfilter_bridge/ebt_ip.h
@@ -28,10 +28,10 @@
28/* the same values are used for the invflags */ 28/* the same values are used for the invflags */
29struct ebt_ip_info 29struct ebt_ip_info
30{ 30{
31 uint32_t saddr; 31 __be32 saddr;
32 uint32_t daddr; 32 __be32 daddr;
33 uint32_t smsk; 33 __be32 smsk;
34 uint32_t dmsk; 34 __be32 dmsk;
35 uint8_t tos; 35 uint8_t tos;
36 uint8_t protocol; 36 uint8_t protocol;
37 uint8_t bitmask; 37 uint8_t bitmask;
diff --git a/include/linux/netfilter_bridge/ebt_nat.h b/include/linux/netfilter_bridge/ebt_nat.h
index 26fd90da4cd6..435b886a51aa 100644
--- a/include/linux/netfilter_bridge/ebt_nat.h
+++ b/include/linux/netfilter_bridge/ebt_nat.h
@@ -1,6 +1,7 @@
1#ifndef __LINUX_BRIDGE_EBT_NAT_H 1#ifndef __LINUX_BRIDGE_EBT_NAT_H
2#define __LINUX_BRIDGE_EBT_NAT_H 2#define __LINUX_BRIDGE_EBT_NAT_H
3 3
4#define NAT_ARP_BIT (0x00000010)
4struct ebt_nat_info 5struct ebt_nat_info
5{ 6{
6 unsigned char mac[ETH_ALEN]; 7 unsigned char mac[ETH_ALEN];
diff --git a/include/linux/netfilter_bridge/ebt_vlan.h b/include/linux/netfilter_bridge/ebt_vlan.h
index cb1fcc41565f..1d98be4031e7 100644
--- a/include/linux/netfilter_bridge/ebt_vlan.h
+++ b/include/linux/netfilter_bridge/ebt_vlan.h
@@ -10,7 +10,7 @@
10struct ebt_vlan_info { 10struct ebt_vlan_info {
11 uint16_t id; /* VLAN ID {1-4095} */ 11 uint16_t id; /* VLAN ID {1-4095} */
12 uint8_t prio; /* VLAN User Priority {0-7} */ 12 uint8_t prio; /* VLAN User Priority {0-7} */
13 uint16_t encap; /* VLAN Encapsulated frame code {0-65535} */ 13 __be16 encap; /* VLAN Encapsulated frame code {0-65535} */
14 uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg, 14 uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg,
15 bit 2=1 User-Priority arg, bit 3=1 encap*/ 15 bit 2=1 User-Priority arg, bit 3=1 encap*/
16 uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, 16 uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg,
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index b1a7cc90877b..94e0a7dc0cb2 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -26,6 +26,10 @@
26#define EBT_CONTINUE -3 26#define EBT_CONTINUE -3
27#define EBT_RETURN -4 27#define EBT_RETURN -4
28#define NUM_STANDARD_TARGETS 4 28#define NUM_STANDARD_TARGETS 4
29/* ebtables target modules store the verdict inside an int. We can
30 * reclaim a part of this int for backwards compatible extensions.
31 * The 4 lsb are more than enough to store the verdict. */
32#define EBT_VERDICT_BITS 0x0000000F
29 33
30struct ebt_counter 34struct ebt_counter
31{ 35{
@@ -42,6 +46,23 @@ struct ebt_replace
42 /* total size of the entries */ 46 /* total size of the entries */
43 unsigned int entries_size; 47 unsigned int entries_size;
44 /* start of the chains */ 48 /* start of the chains */
49 struct ebt_entries __user *hook_entry[NF_BR_NUMHOOKS];
50 /* nr of counters userspace expects back */
51 unsigned int num_counters;
52 /* where the kernel will put the old counters */
53 struct ebt_counter __user *counters;
54 char __user *entries;
55};
56
57struct ebt_replace_kernel
58{
59 char name[EBT_TABLE_MAXNAMELEN];
60 unsigned int valid_hooks;
61 /* nr of rules in the table */
62 unsigned int nentries;
63 /* total size of the entries */
64 unsigned int entries_size;
65 /* start of the chains */
45 struct ebt_entries *hook_entry[NF_BR_NUMHOOKS]; 66 struct ebt_entries *hook_entry[NF_BR_NUMHOOKS];
46 /* nr of counters userspace expects back */ 67 /* nr of counters userspace expects back */
47 unsigned int num_counters; 68 unsigned int num_counters;
@@ -141,7 +162,7 @@ struct ebt_entry {
141 /* this needs to be the first field */ 162 /* this needs to be the first field */
142 unsigned int bitmask; 163 unsigned int bitmask;
143 unsigned int invflags; 164 unsigned int invflags;
144 uint16_t ethproto; 165 __be16 ethproto;
145 /* the physical in-dev */ 166 /* the physical in-dev */
146 char in[IFNAMSIZ]; 167 char in[IFNAMSIZ];
147 /* the logical in-dev */ 168 /* the logical in-dev */
@@ -251,7 +272,7 @@ struct ebt_table
251{ 272{
252 struct list_head list; 273 struct list_head list;
253 char name[EBT_TABLE_MAXNAMELEN]; 274 char name[EBT_TABLE_MAXNAMELEN];
254 struct ebt_replace *table; 275 struct ebt_replace_kernel *table;
255 unsigned int valid_hooks; 276 unsigned int valid_hooks;
256 rwlock_t lock; 277 rwlock_t lock;
257 /* e.g. could be the table explicitly only allows certain 278 /* e.g. could be the table explicitly only allows certain
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 5b63a231a76b..5821eb5a0a3e 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -79,7 +79,7 @@ enum nf_ip_hook_priorities {
79#ifdef __KERNEL__ 79#ifdef __KERNEL__
80extern int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type); 80extern int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type);
81extern int ip_xfrm_me_harder(struct sk_buff **pskb); 81extern int ip_xfrm_me_harder(struct sk_buff **pskb);
82extern unsigned int nf_ip_checksum(struct sk_buff *skb, unsigned int hook, 82extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
83 unsigned int dataoff, u_int8_t protocol); 83 unsigned int dataoff, u_int8_t protocol);
84#endif /*__KERNEL__*/ 84#endif /*__KERNEL__*/
85 85
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 591c1a809c00..180337801a86 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,6 +1,4 @@
1header-y += ip_conntrack_helper.h 1header-y += ip_conntrack_helper.h
2header-y += ip_conntrack_helper_h323_asn1.h
3header-y += ip_conntrack_helper_h323_types.h
4header-y += ip_conntrack_protocol.h 2header-y += ip_conntrack_protocol.h
5header-y += ip_conntrack_sctp.h 3header-y += ip_conntrack_sctp.h
6header-y += ip_conntrack_tcp.h 4header-y += ip_conntrack_tcp.h
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index 64e868034c4a..33581c13d947 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -9,6 +9,7 @@
9#include <linux/compiler.h> 9#include <linux/compiler.h>
10#include <asm/atomic.h> 10#include <asm/atomic.h>
11 11
12#include <linux/timer.h>
12#include <linux/netfilter_ipv4/ip_conntrack_tcp.h> 13#include <linux/netfilter_ipv4/ip_conntrack_tcp.h>
13#include <linux/netfilter_ipv4/ip_conntrack_icmp.h> 14#include <linux/netfilter_ipv4/ip_conntrack_icmp.h>
14#include <linux/netfilter_ipv4/ip_conntrack_proto_gre.h> 15#include <linux/netfilter_ipv4/ip_conntrack_proto_gre.h>
@@ -277,7 +278,7 @@ extern struct ip_conntrack_expect *
277__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple); 278__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple);
278 279
279extern struct ip_conntrack_expect * 280extern struct ip_conntrack_expect *
280ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple); 281ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple);
281 282
282extern struct ip_conntrack_tuple_hash * 283extern struct ip_conntrack_tuple_hash *
283__ip_conntrack_find(const struct ip_conntrack_tuple *tuple, 284__ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
index 63811934de4d..2129fc3972ac 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
@@ -1,6 +1,44 @@
1#ifndef _IP_CONNTRACK_FTP_H 1#ifndef _IP_CONNTRACK_FTP_H
2#define _IP_CONNTRACK_FTP_H 2#define _IP_CONNTRACK_FTP_H
3/* FTP tracking. */
3 4
4#include <linux/netfilter/nf_conntrack_ftp.h> 5/* This enum is exposed to userspace */
6enum ip_ct_ftp_type
7{
8 /* PORT command from client */
9 IP_CT_FTP_PORT,
10 /* PASV response from server */
11 IP_CT_FTP_PASV,
12 /* EPRT command from client */
13 IP_CT_FTP_EPRT,
14 /* EPSV response from server */
15 IP_CT_FTP_EPSV,
16};
17
18#ifdef __KERNEL__
19
20#define FTP_PORT 21
21
22#define NUM_SEQ_TO_REMEMBER 2
23/* This structure exists only once per master */
24struct ip_ct_ftp_master {
25 /* Valid seq positions for cmd matching after newline */
26 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
27 /* 0 means seq_match_aft_nl not set */
28 int seq_aft_nl_num[IP_CT_DIR_MAX];
29};
30
31struct ip_conntrack_expect;
32
33/* For NAT to hook in when we find a packet which describes what other
34 * connection we should expect. */
35extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb,
36 enum ip_conntrack_info ctinfo,
37 enum ip_ct_ftp_type type,
38 unsigned int matchoff,
39 unsigned int matchlen,
40 struct ip_conntrack_expect *exp,
41 u32 *seq);
42#endif /* __KERNEL__ */
5 43
6#endif /* _IP_CONNTRACK_FTP_H */ 44#endif /* _IP_CONNTRACK_FTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
index 943cc6a4871d..18f769818f4e 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
@@ -3,7 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h> 6#include <linux/netfilter/nf_conntrack_h323_asn1.h>
7 7
8#define RAS_PORT 1719 8#define RAS_PORT 1719
9#define Q931_PORT 1720 9#define Q931_PORT 1720
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
index 1d853aa873eb..e371e0fc1672 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
@@ -102,11 +102,11 @@ static inline __be32 *gre_key(struct gre_hdr *greh)
102} 102}
103 103
104/* get pointer ot gre csum, if present */ 104/* get pointer ot gre csum, if present */
105static inline u_int16_t *gre_csum(struct gre_hdr *greh) 105static inline __sum16 *gre_csum(struct gre_hdr *greh)
106{ 106{
107 if (!greh->csum) 107 if (!greh->csum)
108 return NULL; 108 return NULL;
109 return (u_int16_t *) (greh+sizeof(*greh)); 109 return (__sum16 *) (greh+sizeof(*greh));
110} 110}
111 111
112#endif /* __KERNEL__ */ 112#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sip.h b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
index 913dad66c0fb..bef6c646defa 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_sip.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
@@ -5,23 +5,18 @@
5#define SIP_PORT 5060 5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600 6#define SIP_TIMEOUT 3600
7 7
8#define POS_VIA 0 8enum sip_header_pos {
9#define POS_CONTACT 1 9 POS_REG_REQ_URI,
10#define POS_CONTENT 2 10 POS_REQ_URI,
11#define POS_MEDIA 3 11 POS_FROM,
12#define POS_OWNER 4 12 POS_TO,
13#define POS_CONNECTION 5 13 POS_VIA,
14#define POS_REQ_HEADER 6 14 POS_CONTACT,
15#define POS_SDP_HEADER 7 15 POS_CONTENT,
16 16 POS_MEDIA,
17struct sip_header_nfo { 17 POS_OWNER,
18 const char *lname; 18 POS_CONNECTION,
19 const char *sname; 19 POS_SDP_HEADER,
20 const char *ln_str;
21 size_t lnlen;
22 size_t snlen;
23 size_t ln_strlen;
24 int (*match_len)(const char *, const char *, int *);
25}; 20};
26 21
27extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb, 22extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb,
@@ -36,9 +31,10 @@ extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb,
36extern int ct_sip_get_info(const char *dptr, size_t dlen, 31extern int ct_sip_get_info(const char *dptr, size_t dlen,
37 unsigned int *matchoff, 32 unsigned int *matchoff,
38 unsigned int *matchlen, 33 unsigned int *matchlen,
39 struct sip_header_nfo *hnfo); 34 enum sip_header_pos pos);
40extern int ct_sip_lnlen(const char *line, const char *limit); 35extern int ct_sip_lnlen(const char *line, const char *limit);
41extern const char *ct_sip_search(const char *needle, const char *haystack, 36extern const char *ct_sip_search(const char *needle, const char *haystack,
42 size_t needle_len, size_t haystack_len); 37 size_t needle_len, size_t haystack_len,
38 int case_sensitive);
43#endif /* __KERNEL__ */ 39#endif /* __KERNEL__ */
44#endif /* __IP_CONNTRACK_SIP_H__ */ 40#endif /* __IP_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h b/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
index cde9729aa173..a404fc0abf0e 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
@@ -4,7 +4,7 @@
4#define TFTP_PORT 69 4#define TFTP_PORT 69
5 5
6struct tftphdr { 6struct tftphdr {
7 u_int16_t opcode; 7 __be16 opcode;
8}; 8};
9 9
10#define TFTP_OPCODE_READ 1 10#define TFTP_OPCODE_READ 1
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index a536bbdef145..4f06dad0bde9 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -101,18 +101,21 @@ struct ipt_entry
101/* 101/*
102 * New IP firewall options for [gs]etsockopt at the RAW IP level. 102 * New IP firewall options for [gs]etsockopt at the RAW IP level.
103 * Unlike BSD Linux inherits IP options so you don't have to use a raw 103 * Unlike BSD Linux inherits IP options so you don't have to use a raw
104 * socket for this. Instead we check rights in the calls. */ 104 * socket for this. Instead we check rights in the calls.
105#define IPT_BASE_CTL XT_BASE_CTL 105 *
106 106 * ATTENTION: check linux/in.h before adding new number here.
107#define IPT_SO_SET_REPLACE XT_SO_SET_REPLACE 107 */
108#define IPT_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS 108#define IPT_BASE_CTL 64
109#define IPT_SO_SET_MAX XT_SO_SET_MAX 109
110 110#define IPT_SO_SET_REPLACE (IPT_BASE_CTL)
111#define IPT_SO_GET_INFO XT_SO_GET_INFO 111#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1)
112#define IPT_SO_GET_ENTRIES XT_SO_GET_ENTRIES 112#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS
113#define IPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH 113
114#define IPT_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET 114#define IPT_SO_GET_INFO (IPT_BASE_CTL)
115#define IPT_SO_GET_MAX XT_SO_GET_REVISION_TARGET 115#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1)
116#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2)
117#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3)
118#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET
116 119
117#define IPT_CONTINUE XT_CONTINUE 120#define IPT_CONTINUE XT_CONTINUE
118#define IPT_RETURN XT_RETURN 121#define IPT_RETURN XT_RETURN
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h
index 892f9a33fea8..90fa6525ef9c 100644
--- a/include/linux/netfilter_ipv4/ipt_LOG.h
+++ b/include/linux/netfilter_ipv4/ipt_LOG.h
@@ -6,7 +6,7 @@
6#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */ 6#define IPT_LOG_TCPOPT 0x02 /* Log TCP options */
7#define IPT_LOG_IPOPT 0x04 /* Log IP options */ 7#define IPT_LOG_IPOPT 0x04 /* Log IP options */
8#define IPT_LOG_UID 0x08 /* Log UID owning local socket */ 8#define IPT_LOG_UID 0x08 /* Log UID owning local socket */
9#define IPT_LOG_NFLOG 0x10 /* Log using nf_log backend */ 9#define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */
10#define IPT_LOG_MASK 0x1f 10#define IPT_LOG_MASK 0x1f
11 11
12struct ipt_log_info { 12struct ipt_log_info {
diff --git a/include/linux/netfilter_ipv4/ipt_hashlimit.h b/include/linux/netfilter_ipv4/ipt_hashlimit.h
index ac2cb64ecd76..5662120a3d7b 100644
--- a/include/linux/netfilter_ipv4/ipt_hashlimit.h
+++ b/include/linux/netfilter_ipv4/ipt_hashlimit.h
@@ -1,40 +1,14 @@
1#ifndef _IPT_HASHLIMIT_H 1#ifndef _IPT_HASHLIMIT_H
2#define _IPT_HASHLIMIT_H 2#define _IPT_HASHLIMIT_H
3 3
4/* timings are in milliseconds. */ 4#include <linux/netfilter/xt_hashlimit.h>
5#define IPT_HASHLIMIT_SCALE 10000
6/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
7 seconds, or one every 59 hours. */
8 5
9/* details of this structure hidden by the implementation */ 6#define IPT_HASHLIMIT_SCALE XT_HASHLIMIT_SCALE
10struct ipt_hashlimit_htable; 7#define IPT_HASHLIMIT_HASH_DIP XT_HASHLIMIT_HASH_DIP
8#define IPT_HASHLIMIT_HASH_DPT XT_HASHLIMIT_HASH_DPT
9#define IPT_HASHLIMIT_HASH_SIP XT_HASHLIMIT_HASH_SIP
10#define IPT_HASHLIMIT_HASH_SPT XT_HASHLIMIT_HASH_SPT
11 11
12#define IPT_HASHLIMIT_HASH_DIP 0x0001 12#define ipt_hashlimit_info xt_hashlimit_info
13#define IPT_HASHLIMIT_HASH_DPT 0x0002
14#define IPT_HASHLIMIT_HASH_SIP 0x0004
15#define IPT_HASHLIMIT_HASH_SPT 0x0008
16 13
17struct hashlimit_cfg { 14#endif /* _IPT_HASHLIMIT_H */
18 u_int32_t mode; /* bitmask of IPT_HASHLIMIT_HASH_* */
19 u_int32_t avg; /* Average secs between packets * scale */
20 u_int32_t burst; /* Period multiplier for upper limit. */
21
22 /* user specified */
23 u_int32_t size; /* how many buckets */
24 u_int32_t max; /* max number of entries */
25 u_int32_t gc_interval; /* gc interval */
26 u_int32_t expire; /* when do entries expire? */
27};
28
29struct ipt_hashlimit_info {
30 char name [IFNAMSIZ]; /* name */
31 struct hashlimit_cfg cfg;
32 struct ipt_hashlimit_htable *hinfo;
33
34 /* Used internally by the kernel */
35 union {
36 void *ptr;
37 struct ipt_hashlimit_info *master;
38 } u;
39};
40#endif /*_IPT_HASHLIMIT_H*/
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index d97e268cdfe5..ab81a6dc94ea 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -74,7 +74,7 @@ enum nf_ip6_hook_priorities {
74 74
75#ifdef CONFIG_NETFILTER 75#ifdef CONFIG_NETFILTER
76extern int ip6_route_me_harder(struct sk_buff *skb); 76extern int ip6_route_me_harder(struct sk_buff *skb);
77extern unsigned int nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, 77extern __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
78 unsigned int dataoff, u_int8_t protocol); 78 unsigned int dataoff, u_int8_t protocol);
79 79
80extern int ipv6_netfilter_init(void); 80extern int ipv6_netfilter_init(void);
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index d7a8e9c0dad0..4aed340401db 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -107,18 +107,21 @@ struct ip6t_entry
107/* 107/*
108 * New IP firewall options for [gs]etsockopt at the RAW IP level. 108 * New IP firewall options for [gs]etsockopt at the RAW IP level.
109 * Unlike BSD Linux inherits IP options so you don't have to use 109 * Unlike BSD Linux inherits IP options so you don't have to use
110 * a raw socket for this. Instead we check rights in the calls. */ 110 * a raw socket for this. Instead we check rights in the calls.
111#define IP6T_BASE_CTL XT_BASE_CTL 111 *
112 112 * ATTENTION: check linux/in6.h before adding new number here.
113#define IP6T_SO_SET_REPLACE XT_SO_SET_REPLACE 113 */
114#define IP6T_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS 114#define IP6T_BASE_CTL 64
115#define IP6T_SO_SET_MAX XT_SO_SET_MAX 115
116 116#define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL)
117#define IP6T_SO_GET_INFO XT_SO_GET_INFO 117#define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1)
118#define IP6T_SO_GET_ENTRIES XT_SO_GET_ENTRIES 118#define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS
119#define IP6T_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH 119
120#define IP6T_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET 120#define IP6T_SO_GET_INFO (IP6T_BASE_CTL)
121#define IP6T_SO_GET_MAX XT_SO_GET_REVISION_TARGET 121#define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1)
122#define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4)
123#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5)
124#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET
122 125
123/* CONTINUE verdict for targets */ 126/* CONTINUE verdict for targets */
124#define IP6T_CONTINUE XT_CONTINUE 127#define IP6T_CONTINUE XT_CONTINUE
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h
index 060c1a1c6c60..0d0119b0458c 100644
--- a/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ b/include/linux/netfilter_ipv6/ip6t_LOG.h
@@ -6,7 +6,7 @@
6#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */ 6#define IP6T_LOG_TCPOPT 0x02 /* Log TCP options */
7#define IP6T_LOG_IPOPT 0x04 /* Log IP options */ 7#define IP6T_LOG_IPOPT 0x04 /* Log IP options */
8#define IP6T_LOG_UID 0x08 /* Log UID owning local socket */ 8#define IP6T_LOG_UID 0x08 /* Log UID owning local socket */
9#define IP6T_LOG_NFLOG 0x10 /* Log using nf_log backend */ 9#define IP6T_LOG_NFLOG 0x10 /* Unsupported, don't use */
10#define IP6T_LOG_MASK 0x1f 10#define IP6T_LOG_MASK 0x1f
11 11
12struct ip6t_log_info { 12struct ip6t_log_info {
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 66411622e06e..b3b9b609ee89 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -141,7 +141,6 @@ struct netlink_skb_parms
141{ 141{
142 struct ucred creds; /* Skb credentials */ 142 struct ucred creds; /* Skb credentials */
143 __u32 pid; 143 __u32 pid;
144 __u32 dst_pid;
145 __u32 dst_group; 144 __u32 dst_group;
146 kernel_cap_t eff_cap; 145 kernel_cap_t eff_cap;
147 __u32 loginuid; /* Login (audit) uid */ 146 __u32 loginuid; /* Login (audit) uid */
@@ -174,6 +173,7 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
174 */ 173 */
175#define NLMSG_GOODORDER 0 174#define NLMSG_GOODORDER 0
176#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER)) 175#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER))
176#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN)
177 177
178 178
179struct netlink_callback 179struct netlink_callback
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 1efe60c5c00c..29930b71a9aa 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -12,26 +12,27 @@
12#include <linux/rcupdate.h> 12#include <linux/rcupdate.h>
13#include <linux/list.h> 13#include <linux/list.h>
14 14
15struct netpoll;
16
17struct netpoll { 15struct netpoll {
18 struct net_device *dev; 16 struct net_device *dev;
19 char dev_name[16], *name; 17 char dev_name[IFNAMSIZ];
18 const char *name;
20 void (*rx_hook)(struct netpoll *, int, char *, int); 19 void (*rx_hook)(struct netpoll *, int, char *, int);
21 void (*drop)(struct sk_buff *skb); 20
22 u32 local_ip, remote_ip; 21 u32 local_ip, remote_ip;
23 u16 local_port, remote_port; 22 u16 local_port, remote_port;
24 unsigned char local_mac[6], remote_mac[6]; 23 u8 local_mac[ETH_ALEN], remote_mac[ETH_ALEN];
25}; 24};
26 25
27struct netpoll_info { 26struct netpoll_info {
27 atomic_t refcnt;
28 spinlock_t poll_lock; 28 spinlock_t poll_lock;
29 int poll_owner; 29 int poll_owner;
30 int tries;
31 int rx_flags; 30 int rx_flags;
32 spinlock_t rx_lock; 31 spinlock_t rx_lock;
33 struct netpoll *rx_np; /* netpoll that registered an rx_hook */ 32 struct netpoll *rx_np; /* netpoll that registered an rx_hook */
34 struct sk_buff_head arp_tx; /* list of arp requests to reply to */ 33 struct sk_buff_head arp_tx; /* list of arp requests to reply to */
34 struct sk_buff_head txq;
35 struct delayed_work tx_work;
35}; 36};
36 37
37void netpoll_poll(struct netpoll *np); 38void netpoll_poll(struct netpoll *np);
@@ -42,7 +43,7 @@ int netpoll_trap(void);
42void netpoll_set_trap(int trap); 43void netpoll_set_trap(int trap);
43void netpoll_cleanup(struct netpoll *np); 44void netpoll_cleanup(struct netpoll *np);
44int __netpoll_rx(struct sk_buff *skb); 45int __netpoll_rx(struct sk_buff *skb);
45void netpoll_queue(struct sk_buff *skb); 46
46 47
47#ifdef CONFIG_NETPOLL 48#ifdef CONFIG_NETPOLL
48static inline int netpoll_rx(struct sk_buff *skb) 49static inline int netpoll_rx(struct sk_buff *skb)
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 45228c1a1195..04963063e620 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -33,6 +33,7 @@
33#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 33#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
34#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */ 34#define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */
35#define FLUSH_INVALIDATE 64 /* Invalidate the page cache */ 35#define FLUSH_INVALIDATE 64 /* Invalidate the page cache */
36#define FLUSH_NOWRITEPAGE 128 /* Don't call writepage() */
36 37
37#ifdef __KERNEL__ 38#ifdef __KERNEL__
38 39
@@ -318,7 +319,7 @@ extern void put_nfs_open_context(struct nfs_open_context *ctx);
318extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 319extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
319 320
320/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 321/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
321extern u32 root_nfs_parse_addr(char *name); /*__init*/ 322extern __be32 root_nfs_parse_addr(char *name); /*__init*/
322 323
323static inline void nfs_fattr_init(struct nfs_fattr *fattr) 324static inline void nfs_fattr_init(struct nfs_fattr *fattr)
324{ 325{
@@ -427,19 +428,21 @@ extern int nfs_flush_incompatible(struct file *file, struct page *page);
427extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 428extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
428extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); 429extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
429extern void nfs_writedata_release(void *); 430extern void nfs_writedata_release(void *);
430 431extern int nfs_set_page_dirty(struct page *);
431#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
432struct nfs_write_data *nfs_commit_alloc(void);
433void nfs_commit_free(struct nfs_write_data *p);
434#endif
435 432
436/* 433/*
437 * Try to write back everything synchronously (but check the 434 * Try to write back everything synchronously (but check the
438 * return value!) 435 * return value!)
439 */ 436 */
440extern int nfs_sync_inode_wait(struct inode *, unsigned long, unsigned int, int); 437extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_control *, int);
438extern int nfs_sync_mapping_range(struct address_space *, loff_t, loff_t, int);
439extern int nfs_wb_all(struct inode *inode);
440extern int nfs_wb_page(struct inode *inode, struct page* page);
441extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how);
441#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 442#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
442extern int nfs_commit_inode(struct inode *, int); 443extern int nfs_commit_inode(struct inode *, int);
444extern struct nfs_write_data *nfs_commit_alloc(void);
445extern void nfs_commit_free(struct nfs_write_data *wdata);
443extern void nfs_commit_release(void *wdata); 446extern void nfs_commit_release(void *wdata);
444#else 447#else
445static inline int 448static inline int
@@ -455,28 +458,6 @@ nfs_have_writebacks(struct inode *inode)
455 return NFS_I(inode)->npages != 0; 458 return NFS_I(inode)->npages != 0;
456} 459}
457 460
458static inline int
459nfs_wb_all(struct inode *inode)
460{
461 int error = nfs_sync_inode_wait(inode, 0, 0, 0);
462 return (error < 0) ? error : 0;
463}
464
465/*
466 * Write back all requests on one page - we do this before reading it.
467 */
468static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how)
469{
470 int error = nfs_sync_inode_wait(inode, page->index, 1,
471 how | FLUSH_STABLE);
472 return (error < 0) ? error : 0;
473}
474
475static inline int nfs_wb_page(struct inode *inode, struct page* page)
476{
477 return nfs_wb_page_priority(inode, page, 0);
478}
479
480/* 461/*
481 * Allocate nfs_write_data structures 462 * Allocate nfs_write_data structures
482 */ 463 */
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 7ccfc7ef0a83..95796e6924f1 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -51,7 +51,7 @@ struct nfs_client {
51 51
52 unsigned long cl_lease_time; 52 unsigned long cl_lease_time;
53 unsigned long cl_last_renewal; 53 unsigned long cl_last_renewal;
54 struct work_struct cl_renewd; 54 struct delayed_work cl_renewd;
55 55
56 struct rpc_wait_queue cl_rpcwaitq; 56 struct rpc_wait_queue cl_rpcwaitq;
57 57
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 1f7bd287c230..2e555d49c9b7 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -30,6 +30,8 @@
30#define PG_BUSY 0 30#define PG_BUSY 0
31#define PG_NEED_COMMIT 1 31#define PG_NEED_COMMIT 1
32#define PG_NEED_RESCHED 2 32#define PG_NEED_RESCHED 2
33#define PG_NEED_FLUSH 3
34#define PG_FLUSHING 4
33 35
34struct nfs_inode; 36struct nfs_inode;
35struct nfs_page { 37struct nfs_page {
@@ -60,8 +62,9 @@ extern void nfs_clear_request(struct nfs_page *req);
60extern void nfs_release_request(struct nfs_page *req); 62extern void nfs_release_request(struct nfs_page *req);
61 63
62 64
63extern int nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst, 65extern long nfs_scan_dirty(struct address_space *mapping,
64 unsigned long idx_start, unsigned int npages); 66 struct writeback_control *wbc,
67 struct list_head *dst);
65extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, struct list_head *dst, 68extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *head, struct list_head *dst,
66 unsigned long idx_start, unsigned int npages); 69 unsigned long idx_start, unsigned int npages);
67extern int nfs_coalesce_requests(struct list_head *, struct list_head *, 70extern int nfs_coalesce_requests(struct list_head *, struct list_head *,
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 768c1ad5ff6f..9ee9da5e1cc9 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -785,8 +785,6 @@ struct nfs_rpc_ops {
785 int (*readlink)(struct inode *, struct page *, unsigned int, 785 int (*readlink)(struct inode *, struct page *, unsigned int,
786 unsigned int); 786 unsigned int);
787 int (*read) (struct nfs_read_data *); 787 int (*read) (struct nfs_read_data *);
788 int (*write) (struct nfs_write_data *);
789 int (*commit) (struct nfs_write_data *);
790 int (*create) (struct inode *, struct dentry *, 788 int (*create) (struct inode *, struct dentry *,
791 struct iattr *, int, struct nameidata *); 789 struct iattr *, int, struct nameidata *);
792 int (*remove) (struct inode *, struct qstr *); 790 int (*remove) (struct inode *, struct qstr *);
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index eb231143d579..edb54c3171b3 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -89,7 +89,7 @@ __be32 nfsd_access(struct svc_rqst *, struct svc_fh *, u32 *, u32 *);
89__be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *, 89__be32 nfsd_create_v3(struct svc_rqst *, struct svc_fh *,
90 char *name, int len, struct iattr *attrs, 90 char *name, int len, struct iattr *attrs,
91 struct svc_fh *res, int createmode, 91 struct svc_fh *res, int createmode,
92 u32 *verifier, int *truncp); 92 u32 *verifier, int *truncp, int *created);
93__be32 nfsd_commit(struct svc_rqst *, struct svc_fh *, 93__be32 nfsd_commit(struct svc_rqst *, struct svc_fh *,
94 loff_t, unsigned long); 94 loff_t, unsigned long);
95#endif /* CONFIG_NFSD_V3 */ 95#endif /* CONFIG_NFSD_V3 */
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index e16904e28c3a..acb4ed130247 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -15,9 +15,14 @@
15 * disables interrupts for a long time. This call is stateless. 15 * disables interrupts for a long time. This call is stateless.
16 */ 16 */
17#ifdef ARCH_HAS_NMI_WATCHDOG 17#ifdef ARCH_HAS_NMI_WATCHDOG
18#include <asm/nmi.h>
18extern void touch_nmi_watchdog(void); 19extern void touch_nmi_watchdog(void);
19#else 20#else
20# define touch_nmi_watchdog() touch_softlockup_watchdog() 21# define touch_nmi_watchdog() touch_softlockup_watchdog()
21#endif 22#endif
22 23
24#ifndef trigger_all_cpu_backtrace
25#define trigger_all_cpu_backtrace() do { } while (0)
26#endif
27
23#endif 28#endif
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index f6baecdeecd6..971d1c6dfc4b 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -45,8 +45,10 @@ static inline void exit_task_namespaces(struct task_struct *p)
45{ 45{
46 struct nsproxy *ns = p->nsproxy; 46 struct nsproxy *ns = p->nsproxy;
47 if (ns) { 47 if (ns) {
48 put_nsproxy(ns); 48 task_lock(p);
49 p->nsproxy = NULL; 49 p->nsproxy = NULL;
50 task_unlock(p);
51 put_nsproxy(ns);
50 } 52 }
51} 53}
52#endif 54#endif
diff --git a/include/linux/pata_platform.h b/include/linux/pata_platform.h
new file mode 100644
index 000000000000..2d5fd647e0e9
--- /dev/null
+++ b/include/linux/pata_platform.h
@@ -0,0 +1,13 @@
1#ifndef __LINUX_PATA_PLATFORM_H
2#define __LINUX_PATA_PLATFORM_H
3
4struct pata_platform_info {
5 /*
6 * I/O port shift, for platforms with ports that are
7 * constantly spaced and need larger than the 1-byte
8 * spacing used by ata_std_ports().
9 */
10 unsigned int ioport_shift;
11};
12
13#endif /* __LINUX_PATA_PLATFORM_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 09be0f81b27b..01c707261f9c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -51,6 +51,7 @@
51#include <linux/list.h> 51#include <linux/list.h>
52#include <linux/compiler.h> 52#include <linux/compiler.h>
53#include <linux/errno.h> 53#include <linux/errno.h>
54#include <asm/atomic.h>
54#include <linux/device.h> 55#include <linux/device.h>
55 56
56/* File state for mmap()s on /proc/bus/pci/X/Y */ 57/* File state for mmap()s on /proc/bus/pci/X/Y */
@@ -159,7 +160,6 @@ struct pci_dev {
159 unsigned int transparent:1; /* Transparent PCI bridge */ 160 unsigned int transparent:1; /* Transparent PCI bridge */
160 unsigned int multifunction:1;/* Part of multi-function device */ 161 unsigned int multifunction:1;/* Part of multi-function device */
161 /* keep track of device state */ 162 /* keep track of device state */
162 unsigned int is_enabled:1; /* pci_enable_device has been called */
163 unsigned int is_busmaster:1; /* device is busmaster */ 163 unsigned int is_busmaster:1; /* device is busmaster */
164 unsigned int no_msi:1; /* device may not use msi */ 164 unsigned int no_msi:1; /* device may not use msi */
165 unsigned int no_d1d2:1; /* only allow d0 or d3 */ 165 unsigned int no_d1d2:1; /* only allow d0 or d3 */
@@ -167,6 +167,7 @@ struct pci_dev {
167 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 167 unsigned int broken_parity_status:1; /* Device generates false positive parity */
168 unsigned int msi_enabled:1; 168 unsigned int msi_enabled:1;
169 unsigned int msix_enabled:1; 169 unsigned int msix_enabled:1;
170 atomic_t enable_cnt; /* pci_enable_device has been called */
170 171
171 u32 saved_config_space[16]; /* config space saved at suspend time */ 172 u32 saved_config_space[16]; /* config space saved at suspend time */
172 struct hlist_head saved_cap_space; 173 struct hlist_head saved_cap_space;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index fa4e1d799782..4d972bbef316 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -390,7 +390,7 @@
390#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d 390#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d
391#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e 391#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e
392#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f 392#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f
393#define PCI_DEVICE_ID_NS_CS5535_VIDEO 0x0030 393#define PCI_DEVICE_ID_NS_GX_VIDEO 0x0030
394#define PCI_DEVICE_ID_NS_SATURN 0x0035 394#define PCI_DEVICE_ID_NS_SATURN 0x0035
395#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 395#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500
396#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 396#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501
@@ -403,8 +403,7 @@
403#define PCI_DEVICE_ID_NS_SC1100_XBUS 0x0515 403#define PCI_DEVICE_ID_NS_SC1100_XBUS 0x0515
404#define PCI_DEVICE_ID_NS_87410 0xd001 404#define PCI_DEVICE_ID_NS_87410 0xd001
405 405
406#define PCI_DEVICE_ID_NS_CS5535_HOST_BRIDGE 0x0028 406#define PCI_DEVICE_ID_NS_GX_HOST_BRIDGE 0x0028
407#define PCI_DEVICE_ID_NS_CS5535_ISA_BRIDGE 0x002b
408 407
409#define PCI_VENDOR_ID_TSENG 0x100c 408#define PCI_VENDOR_ID_TSENG 0x100c
410#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 409#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202
@@ -1213,6 +1212,10 @@
1213#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 1212#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1214#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 1213#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
1215#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453 1214#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453
1215#define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C
1216#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D
1217#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E
1218#define PCI_DEVICE_ID_NVIDIA_NVENET_27 0x054F
1216#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 1219#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560
1217 1220
1218#define PCI_VENDOR_ID_IMS 0x10e0 1221#define PCI_VENDOR_ID_IMS 0x10e0
@@ -1860,6 +1863,7 @@
1860#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 1863#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511
1861#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 1864#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513
1862#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x9521 1865#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x9521
1866#define PCI_DEVICE_ID_OXSEMI_16PCI952PP 0x9523
1863 1867
1864#define PCI_VENDOR_ID_SAMSUNG 0x144d 1868#define PCI_VENDOR_ID_SAMSUNG 0x144d
1865 1869
@@ -1893,6 +1897,7 @@
1893#define PCI_VENDOR_ID_BROADCOM 0x14e4 1897#define PCI_VENDOR_ID_BROADCOM 0x14e4
1894#define PCI_DEVICE_ID_TIGON3_5752 0x1600 1898#define PCI_DEVICE_ID_TIGON3_5752 0x1600
1895#define PCI_DEVICE_ID_TIGON3_5752M 0x1601 1899#define PCI_DEVICE_ID_TIGON3_5752M 0x1601
1900#define PCI_DEVICE_ID_NX2_5709 0x1639
1896#define PCI_DEVICE_ID_TIGON3_5700 0x1644 1901#define PCI_DEVICE_ID_TIGON3_5700 0x1644
1897#define PCI_DEVICE_ID_TIGON3_5701 0x1645 1902#define PCI_DEVICE_ID_TIGON3_5701 0x1645
1898#define PCI_DEVICE_ID_TIGON3_5702 0x1646 1903#define PCI_DEVICE_ID_TIGON3_5702 0x1646
@@ -1926,6 +1931,7 @@
1926#define PCI_DEVICE_ID_TIGON3_5750M 0x167c 1931#define PCI_DEVICE_ID_TIGON3_5750M 0x167c
1927#define PCI_DEVICE_ID_TIGON3_5751M 0x167d 1932#define PCI_DEVICE_ID_TIGON3_5751M 0x167d
1928#define PCI_DEVICE_ID_TIGON3_5751F 0x167e 1933#define PCI_DEVICE_ID_TIGON3_5751F 0x167e
1934#define PCI_DEVICE_ID_TIGON3_5787F 0x167f
1929#define PCI_DEVICE_ID_TIGON3_5787M 0x1693 1935#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
1930#define PCI_DEVICE_ID_TIGON3_5782 0x1696 1936#define PCI_DEVICE_ID_TIGON3_5782 0x1696
1931#define PCI_DEVICE_ID_TIGON3_5786 0x169a 1937#define PCI_DEVICE_ID_TIGON3_5786 0x169a
@@ -1997,6 +2003,8 @@
1997#define PCI_DEVICE_ID_FARSITE_TE1 0x1610 2003#define PCI_DEVICE_ID_FARSITE_TE1 0x1610
1998#define PCI_DEVICE_ID_FARSITE_TE1C 0x1612 2004#define PCI_DEVICE_ID_FARSITE_TE1C 0x1612
1999 2005
2006#define PCI_VENDOR_ID_ARIMA 0x161f
2007
2000#define PCI_VENDOR_ID_SIBYTE 0x166d 2008#define PCI_VENDOR_ID_SIBYTE 0x166d
2001#define PCI_DEVICE_ID_BCM1250_PCI 0x0001 2009#define PCI_DEVICE_ID_BCM1250_PCI 0x0001
2002#define PCI_DEVICE_ID_BCM1250_HT 0x0002 2010#define PCI_DEVICE_ID_BCM1250_HT 0x0002
@@ -2211,6 +2219,13 @@
2211#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815 2219#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815
2212#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e 2220#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e
2213#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 2221#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850
2222#define PCI_DEVICE_ID_INTEL_ICH9_0 0x2910
2223#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2911
2224#define PCI_DEVICE_ID_INTEL_ICH9_2 0x2912
2225#define PCI_DEVICE_ID_INTEL_ICH9_3 0x2913
2226#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914
2227#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2915
2228#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930
2214#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2229#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2215#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2230#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2216#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 2231#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index c312a12ad2d6..064b1dc71c22 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -292,6 +292,12 @@
292#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ 292#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
293#define PCI_MSI_MASK_BIT 16 /* Mask bits register */ 293#define PCI_MSI_MASK_BIT 16 /* Mask bits register */
294 294
295/* MSI-X registers (these are at offset PCI_MSI_FLAGS) */
296#define PCI_MSIX_FLAGS_QSIZE 0x7FF
297#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
298#define PCI_MSIX_FLAGS_BIRMASK (7 << 0)
299#define PCI_MSIX_FLAGS_BITMASK (1 << 0)
300
295/* CompactPCI Hotswap Register */ 301/* CompactPCI Hotswap Register */
296 302
297#define PCI_CHSWP_CSR 2 /* Control and Status Register */ 303#define PCI_CHSWP_CSR 2 /* Control and Status Register */
@@ -371,6 +377,7 @@
371#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ 377#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
372#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ 378#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
373#define PCI_EXP_LNKCTL 16 /* Link Control */ 379#define PCI_EXP_LNKCTL 16 /* Link Control */
380#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */
374#define PCI_EXP_LNKSTA 18 /* Link Status */ 381#define PCI_EXP_LNKSTA 18 /* Link Status */
375#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ 382#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
376#define PCI_EXP_SLTCTL 24 /* Slot Control */ 383#define PCI_EXP_SLTCTL 24 /* Slot Control */
diff --git a/include/linux/personality.h b/include/linux/personality.h
index bf4cf2080e5c..012cd558189b 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -114,7 +114,7 @@ struct exec_domain {
114 * Change personality of the currently running process. 114 * Change personality of the currently running process.
115 */ 115 */
116#define set_personality(pers) \ 116#define set_personality(pers) \
117 ((current->personality == pers) ? 0 : __set_personality(pers)) 117 ((current->personality == (pers)) ? 0 : __set_personality(pers))
118 118
119#endif /* __KERNEL__ */ 119#endif /* __KERNEL__ */
120 120
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index d5dd471da225..265bafab6494 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -32,7 +32,7 @@ struct sadb_ext {
32struct sadb_sa { 32struct sadb_sa {
33 uint16_t sadb_sa_len; 33 uint16_t sadb_sa_len;
34 uint16_t sadb_sa_exttype; 34 uint16_t sadb_sa_exttype;
35 uint32_t sadb_sa_spi; 35 __be32 sadb_sa_spi;
36 uint8_t sadb_sa_replay; 36 uint8_t sadb_sa_replay;
37 uint8_t sadb_sa_state; 37 uint8_t sadb_sa_state;
38 uint8_t sadb_sa_auth; 38 uint8_t sadb_sa_auth;
@@ -211,7 +211,7 @@ struct sadb_x_nat_t_type {
211struct sadb_x_nat_t_port { 211struct sadb_x_nat_t_port {
212 uint16_t sadb_x_nat_t_port_len; 212 uint16_t sadb_x_nat_t_port_len;
213 uint16_t sadb_x_nat_t_port_exttype; 213 uint16_t sadb_x_nat_t_port_exttype;
214 uint16_t sadb_x_nat_t_port_port; 214 __be16 sadb_x_nat_t_port_port;
215 uint16_t sadb_x_nat_t_port_reserved; 215 uint16_t sadb_x_nat_t_port_reserved;
216} __attribute__((packed)); 216} __attribute__((packed));
217/* sizeof(struct sadb_x_nat_t_port) == 8 */ 217/* sizeof(struct sadb_x_nat_t_port) == 8 */
@@ -285,6 +285,7 @@ struct sadb_x_sec_ctx {
285#define SADB_X_AALG_SHA2_384HMAC 6 285#define SADB_X_AALG_SHA2_384HMAC 6
286#define SADB_X_AALG_SHA2_512HMAC 7 286#define SADB_X_AALG_SHA2_512HMAC 7
287#define SADB_X_AALG_RIPEMD160HMAC 8 287#define SADB_X_AALG_RIPEMD160HMAC 8
288#define SADB_X_AALG_AES_XCBC_MAC 9
288#define SADB_X_AALG_NULL 251 /* kame */ 289#define SADB_X_AALG_NULL 251 /* kame */
289#define SADB_AALG_MAX 251 290#define SADB_AALG_MAX 251
290 291
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9447a57ee8a9..edd4c88ca7d8 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -20,6 +20,10 @@
20 20
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/ethtool.h>
24#include <linux/mii.h>
25#include <linux/timer.h>
26#include <linux/workqueue.h>
23 27
24#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ 28#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \
25 SUPPORTED_10baseT_Full | \ 29 SUPPORTED_10baseT_Full | \
@@ -43,15 +47,26 @@
43#define PHY_HAS_INTERRUPT 0x00000001 47#define PHY_HAS_INTERRUPT 0x00000001
44#define PHY_HAS_MAGICANEG 0x00000002 48#define PHY_HAS_MAGICANEG 0x00000002
45 49
50/* Interface Mode definitions */
51typedef enum {
52 PHY_INTERFACE_MODE_MII,
53 PHY_INTERFACE_MODE_GMII,
54 PHY_INTERFACE_MODE_SGMII,
55 PHY_INTERFACE_MODE_TBI,
56 PHY_INTERFACE_MODE_RMII,
57 PHY_INTERFACE_MODE_RGMII,
58 PHY_INTERFACE_MODE_RTBI
59} phy_interface_t;
60
46#define MII_BUS_MAX 4 61#define MII_BUS_MAX 4
47 62
48 63
49#define PHY_INIT_TIMEOUT 100000 64#define PHY_INIT_TIMEOUT 100000
50#define PHY_STATE_TIME 1 65#define PHY_STATE_TIME 1
51#define PHY_FORCE_TIMEOUT 10 66#define PHY_FORCE_TIMEOUT 10
52#define PHY_AN_TIMEOUT 10 67#define PHY_AN_TIMEOUT 10
53 68
54#define PHY_MAX_ADDR 32 69#define PHY_MAX_ADDR 32
55 70
56/* Used when trying to connect to a specific phy (mii bus id:phy device id) */ 71/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
57#define PHY_ID_FMT "%x:%02x" 72#define PHY_ID_FMT "%x:%02x"
@@ -83,8 +98,8 @@ struct mii_bus {
83 int *irq; 98 int *irq;
84}; 99};
85 100
86#define PHY_INTERRUPT_DISABLED 0x0 101#define PHY_INTERRUPT_DISABLED 0x0
87#define PHY_INTERRUPT_ENABLED 0x80000000 102#define PHY_INTERRUPT_ENABLED 0x80000000
88 103
89/* PHY state machine states: 104/* PHY state machine states:
90 * 105 *
@@ -226,6 +241,8 @@ struct phy_device {
226 241
227 u32 dev_flags; 242 u32 dev_flags;
228 243
244 phy_interface_t interface;
245
229 /* Bus address of the PHY (0-32) */ 246 /* Bus address of the PHY (0-32) */
230 int addr; 247 int addr;
231 248
@@ -341,9 +358,10 @@ struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
341int phy_clear_interrupt(struct phy_device *phydev); 358int phy_clear_interrupt(struct phy_device *phydev);
342int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 359int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
343struct phy_device * phy_attach(struct net_device *dev, 360struct phy_device * phy_attach(struct net_device *dev,
344 const char *phy_id, u32 flags); 361 const char *phy_id, u32 flags, phy_interface_t interface);
345struct phy_device * phy_connect(struct net_device *dev, const char *phy_id, 362struct phy_device * phy_connect(struct net_device *dev, const char *phy_id,
346 void (*handler)(struct net_device *), u32 flags); 363 void (*handler)(struct net_device *), u32 flags,
364 phy_interface_t interface);
347void phy_disconnect(struct phy_device *phydev); 365void phy_disconnect(struct phy_device *phydev);
348void phy_detach(struct phy_device *phydev); 366void phy_detach(struct phy_device *phydev);
349void phy_start(struct phy_device *phydev); 367void phy_start(struct phy_device *phydev);
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 29cd6dee13db..20f47b81d3fa 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -58,6 +58,12 @@ struct platform_driver {
58extern int platform_driver_register(struct platform_driver *); 58extern int platform_driver_register(struct platform_driver *);
59extern void platform_driver_unregister(struct platform_driver *); 59extern void platform_driver_unregister(struct platform_driver *);
60 60
61/* non-hotpluggable platform devices may use this so that probe() and
62 * its support may live in __init sections, conserving runtime memory.
63 */
64extern int platform_driver_probe(struct platform_driver *driver,
65 int (*probe)(struct platform_device *));
66
61#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) 67#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
62#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) 68#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data))
63 69
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 51e1b56741fb..27690798623f 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -8,7 +8,8 @@
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9#include <linux/wait.h> 9#include <linux/wait.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/mm.h> 11#include <linux/fs.h>
12#include <linux/sched.h>
12#include <asm/uaccess.h> 13#include <asm/uaccess.h>
13 14
14/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating 15/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
diff --git a/include/linux/profile.h b/include/linux/profile.h
index acce53fd38b6..5670b340c4ef 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -6,10 +6,15 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/cpumask.h> 8#include <linux/cpumask.h>
9#include <linux/cache.h>
10
9#include <asm/errno.h> 11#include <asm/errno.h>
10 12
13extern int prof_on __read_mostly;
14
11#define CPU_PROFILING 1 15#define CPU_PROFILING 1
12#define SCHED_PROFILING 2 16#define SCHED_PROFILING 2
17#define SLEEP_PROFILING 3
13 18
14struct proc_dir_entry; 19struct proc_dir_entry;
15struct pt_regs; 20struct pt_regs;
@@ -18,7 +23,24 @@ struct notifier_block;
18/* init basic kernel profiler */ 23/* init basic kernel profiler */
19void __init profile_init(void); 24void __init profile_init(void);
20void profile_tick(int); 25void profile_tick(int);
21void profile_hit(int, void *); 26
27/*
28 * Add multiple profiler hits to a given address:
29 */
30void profile_hits(int, void *ip, unsigned int nr_hits);
31
32/*
33 * Single profiler hit:
34 */
35static inline void profile_hit(int type, void *ip)
36{
37 /*
38 * Speedup for the common (no profiling enabled) case:
39 */
40 if (unlikely(prof_on == type))
41 profile_hits(type, ip, 1);
42}
43
22#ifdef CONFIG_PROC_FS 44#ifdef CONFIG_PROC_FS
23void create_prof_cpu_mask(struct proc_dir_entry *); 45void create_prof_cpu_mask(struct proc_dir_entry *);
24#else 46#else
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 5110201a4159..90c23f690c0d 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -37,6 +37,9 @@ extern int dquot_release(struct dquot *dquot);
37extern int dquot_commit_info(struct super_block *sb, int type); 37extern int dquot_commit_info(struct super_block *sb, int type);
38extern int dquot_mark_dquot_dirty(struct dquot *dquot); 38extern int dquot_mark_dquot_dirty(struct dquot *dquot);
39 39
40int remove_inode_dquot_ref(struct inode *inode, int type,
41 struct list_head *tofree_head);
42
40extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path); 43extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path);
41extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 44extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
42 int format_id, int type); 45 int format_id, int type);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 9158a68140c9..0deb842541ac 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * Copyright (C) 2001 Momchil Velikov 2 * Copyright (C) 2001 Momchil Velikov
3 * Portions Copyright (C) 2001 Christoph Hellwig 3 * Portions Copyright (C) 2001 Christoph Hellwig
4 * Copyright (C) 2006 Nick Piggin
4 * 5 *
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as 7 * modify it under the terms of the GNU General Public License as
@@ -19,9 +20,37 @@
19#ifndef _LINUX_RADIX_TREE_H 20#ifndef _LINUX_RADIX_TREE_H
20#define _LINUX_RADIX_TREE_H 21#define _LINUX_RADIX_TREE_H
21 22
22#include <linux/sched.h>
23#include <linux/preempt.h> 23#include <linux/preempt.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/kernel.h>
26#include <linux/rcupdate.h>
27
28/*
29 * A direct pointer (root->rnode pointing directly to a data item,
30 * rather than another radix_tree_node) is signalled by the low bit
31 * set in the root->rnode pointer.
32 *
33 * In this case root->height is also NULL, but the direct pointer tests are
34 * needed for RCU lookups when root->height is unreliable.
35 */
36#define RADIX_TREE_DIRECT_PTR 1
37
38static inline void *radix_tree_ptr_to_direct(void *ptr)
39{
40 return (void *)((unsigned long)ptr | RADIX_TREE_DIRECT_PTR);
41}
42
43static inline void *radix_tree_direct_to_ptr(void *ptr)
44{
45 return (void *)((unsigned long)ptr & ~RADIX_TREE_DIRECT_PTR);
46}
47
48static inline int radix_tree_is_direct_ptr(void *ptr)
49{
50 return (int)((unsigned long)ptr & RADIX_TREE_DIRECT_PTR);
51}
52
53/*** radix-tree API starts here ***/
25 54
26#define RADIX_TREE_MAX_TAGS 2 55#define RADIX_TREE_MAX_TAGS 2
27 56
@@ -48,6 +77,77 @@ do { \
48 (root)->rnode = NULL; \ 77 (root)->rnode = NULL; \
49} while (0) 78} while (0)
50 79
80/**
81 * Radix-tree synchronization
82 *
83 * The radix-tree API requires that users provide all synchronisation (with
84 * specific exceptions, noted below).
85 *
86 * Synchronization of access to the data items being stored in the tree, and
87 * management of their lifetimes must be completely managed by API users.
88 *
89 * For API usage, in general,
90 * - any function _modifying_ the the tree or tags (inserting or deleting
91 * items, setting or clearing tags must exclude other modifications, and
92 * exclude any functions reading the tree.
93 * - any function _reading_ the the tree or tags (looking up items or tags,
94 * gang lookups) must exclude modifications to the tree, but may occur
95 * concurrently with other readers.
96 *
97 * The notable exceptions to this rule are the following functions:
98 * radix_tree_lookup
99 * radix_tree_tag_get
100 * radix_tree_gang_lookup
101 * radix_tree_gang_lookup_tag
102 * radix_tree_tagged
103 *
104 * The first 4 functions are able to be called locklessly, using RCU. The
105 * caller must ensure calls to these functions are made within rcu_read_lock()
106 * regions. Other readers (lock-free or otherwise) and modifications may be
107 * running concurrently.
108 *
109 * It is still required that the caller manage the synchronization and lifetimes
110 * of the items. So if RCU lock-free lookups are used, typically this would mean
111 * that the items have their own locks, or are amenable to lock-free access; and
112 * that the items are freed by RCU (or only freed after having been deleted from
113 * the radix tree *and* a synchronize_rcu() grace period).
114 *
115 * (Note, rcu_assign_pointer and rcu_dereference are not needed to control
116 * access to data items when inserting into or looking up from the radix tree)
117 *
118 * radix_tree_tagged is able to be called without locking or RCU.
119 */
120
121/**
122 * radix_tree_deref_slot - dereference a slot
123 * @pslot: pointer to slot, returned by radix_tree_lookup_slot
124 * Returns: item that was stored in that slot with any direct pointer flag
125 * removed.
126 *
127 * For use with radix_tree_lookup_slot(). Caller must hold tree at least read
128 * locked across slot lookup and dereference. More likely, will be used with
129 * radix_tree_replace_slot(), as well, so caller will hold tree write locked.
130 */
131static inline void *radix_tree_deref_slot(void **pslot)
132{
133 return radix_tree_direct_to_ptr(*pslot);
134}
135/**
136 * radix_tree_replace_slot - replace item in a slot
137 * @pslot: pointer to slot, returned by radix_tree_lookup_slot
138 * @item: new item to store in the slot.
139 *
140 * For use with radix_tree_lookup_slot(). Caller must hold tree write locked
141 * across slot lookup and replacement.
142 */
143static inline void radix_tree_replace_slot(void **pslot, void *item)
144{
145 BUG_ON(radix_tree_is_direct_ptr(item));
146 rcu_assign_pointer(*pslot,
147 (void *)((unsigned long)item |
148 ((unsigned long)*pslot & RADIX_TREE_DIRECT_PTR)));
149}
150
51int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); 151int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
52void *radix_tree_lookup(struct radix_tree_root *, unsigned long); 152void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
53void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); 153void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long);
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index f13299a15591..03636d7918fe 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -235,7 +235,7 @@ struct raid5_private_data {
235 */ 235 */
236 int active_name; 236 int active_name;
237 char cache_name[2][20]; 237 char cache_name[2][20];
238 kmem_cache_t *slab_cache; /* for allocating stripes */ 238 struct kmem_cache *slab_cache; /* for allocating stripes */
239 239
240 int seq_flush, seq_write; 240 int seq_flush, seq_write;
241 int quiesce; 241 int quiesce;
diff --git a/include/linux/random.h b/include/linux/random.h
index 0248b30e306d..01ad71033d65 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -51,16 +51,16 @@ extern void add_interrupt_randomness(int irq);
51extern void get_random_bytes(void *buf, int nbytes); 51extern void get_random_bytes(void *buf, int nbytes);
52void generate_random_uuid(unsigned char uuid_out[16]); 52void generate_random_uuid(unsigned char uuid_out[16]);
53 53
54extern __u32 secure_ip_id(__u32 daddr); 54extern __u32 secure_ip_id(__be32 daddr);
55extern u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport); 55extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
56extern u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, 56extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
57 __u16 dport); 57 __be16 dport);
58extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, 58extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
59 __u16 sport, __u16 dport); 59 __be16 sport, __be16 dport);
60extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, 60extern __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
61 __u16 sport, __u16 dport); 61 __be16 sport, __be16 dport);
62extern u64 secure_dccp_sequence_number(__u32 saddr, __u32 daddr, 62extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
63 __u16 sport, __u16 dport); 63 __be16 sport, __be16 dport);
64 64
65#ifndef MODULE 65#ifndef MODULE
66extern struct file_operations random_fops, urandom_fops; 66extern struct file_operations random_fops, urandom_fops;
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 7bc6bfb86253..d0e4dce33ad5 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -739,7 +739,7 @@ struct block_head {
739#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0) 739#define PUT_B_FREE_SPACE(p_s_bh,val) do { set_blkh_free_space(B_BLK_HEAD(p_s_bh),val); } while (0)
740 740
741/* Get right delimiting key. -- little endian */ 741/* Get right delimiting key. -- little endian */
742#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh)) 742#define B_PRIGHT_DELIM_KEY(p_s_bh) (&(blk_right_delim_key(B_BLK_HEAD(p_s_bh))))
743 743
744/* Does the buffer contain a disk leaf. */ 744/* Does the buffer contain a disk leaf. */
745#define B_IS_ITEMS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) == DISK_LEAF_NODE_LEVEL) 745#define B_IS_ITEMS_LEVEL(p_s_bh) (B_LEVEL(p_s_bh) == DISK_LEAF_NODE_LEVEL)
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 73e0becec086..3a28742d86f9 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -249,7 +249,8 @@ struct reiserfs_journal {
249 int j_errno; 249 int j_errno;
250 250
251 /* when flushing ordered buffers, throttle new ordered writers */ 251 /* when flushing ordered buffers, throttle new ordered writers */
252 struct work_struct j_work; 252 struct delayed_work j_work;
253 struct super_block *j_work_sb;
253 atomic_t j_async_throttle; 254 atomic_t j_async_throttle;
254}; 255};
255 256
@@ -429,7 +430,7 @@ enum reiserfs_mount_options {
429/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting 430/* -o hash={tea, rupasov, r5, detect} is meant for properly mounting
430** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option 431** reiserfs disks from 3.5.19 or earlier. 99% of the time, this option
431** is not required. If the normal autodection code can't determine which 432** is not required. If the normal autodection code can't determine which
432** hash to use (because both hases had the same value for a file) 433** hash to use (because both hashes had the same value for a file)
433** use this option to force a specific hash. It won't allow you to override 434** use this option to force a specific hash. It won't allow you to override
434** the existing hash on the FS, so if you have a tea hash disk, and mount 435** the existing hash on the FS, so if you have a tea hash disk, and mount
435** with -o hash=rupasov, the mount will fail. 436** with -o hash=rupasov, the mount will fail.
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 24accb483849..c6a48bfc8b14 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -38,7 +38,7 @@ struct rchan_buf
38 size_t subbufs_consumed; /* count of sub-buffers consumed */ 38 size_t subbufs_consumed; /* count of sub-buffers consumed */
39 struct rchan *chan; /* associated channel */ 39 struct rchan *chan; /* associated channel */
40 wait_queue_head_t read_wait; /* reader wait queue */ 40 wait_queue_head_t read_wait; /* reader wait queue */
41 struct work_struct wake_readers; /* reader wake-up work struct */ 41 struct delayed_work wake_readers; /* reader wake-up work struct */
42 struct dentry *dentry; /* channel file dentry */ 42 struct dentry *dentry; /* channel file dentry */
43 struct kref kref; /* channel buffer refcount */ 43 struct kref kref; /* channel buffer refcount */
44 struct page **page_array; /* array of current buffer pages */ 44 struct page **page_array; /* array of current buffer pages */
@@ -274,7 +274,7 @@ static inline void subbuf_start_reserve(struct rchan_buf *buf,
274/* 274/*
275 * exported relay file operations, kernel/relay.c 275 * exported relay file operations, kernel/relay.c
276 */ 276 */
277extern struct file_operations relay_file_operations; 277extern const struct file_operations relay_file_operations;
278 278
279#endif /* _LINUX_RELAY_H */ 279#endif /* _LINUX_RELAY_H */
280 280
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index db2c1df4fef9..36f850373d2c 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -30,11 +30,11 @@ struct anon_vma {
30 30
31#ifdef CONFIG_MMU 31#ifdef CONFIG_MMU
32 32
33extern kmem_cache_t *anon_vma_cachep; 33extern struct kmem_cache *anon_vma_cachep;
34 34
35static inline struct anon_vma *anon_vma_alloc(void) 35static inline struct anon_vma *anon_vma_alloc(void)
36{ 36{
37 return kmem_cache_alloc(anon_vma_cachep, SLAB_KERNEL); 37 return kmem_cache_alloc(anon_vma_cachep, GFP_KERNEL);
38} 38}
39 39
40static inline void anon_vma_free(struct anon_vma *anon_vma) 40static inline void anon_vma_free(struct anon_vma *anon_vma)
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 5d41dee82f80..b0090e9f7884 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -63,7 +63,7 @@ struct hrtimer_sleeper;
63#endif 63#endif
64 64
65#define __RT_MUTEX_INITIALIZER(mutexname) \ 65#define __RT_MUTEX_INITIALIZER(mutexname) \
66 { .wait_lock = SPIN_LOCK_UNLOCKED \ 66 { .wait_lock = __SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
67 , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list, mutexname.wait_lock) \ 67 , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list, mutexname.wait_lock) \
68 , .owner = NULL \ 68 , .owner = NULL \
69 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)} 69 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 3a18addaed4c..493297acdae8 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -81,8 +81,6 @@ enum {
81 81
82 RTM_NEWPREFIX = 52, 82 RTM_NEWPREFIX = 52,
83#define RTM_NEWPREFIX RTM_NEWPREFIX 83#define RTM_NEWPREFIX RTM_NEWPREFIX
84 RTM_GETPREFIX = 54,
85#define RTM_GETPREFIX RTM_GETPREFIX
86 84
87 RTM_GETMULTICAST = 58, 85 RTM_GETMULTICAST = 58,
88#define RTM_GETMULTICAST RTM_GETMULTICAST 86#define RTM_GETMULTICAST RTM_GETMULTICAST
@@ -587,6 +585,9 @@ extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
587 struct nlmsghdr *nlh, gfp_t flags); 585 struct nlmsghdr *nlh, gfp_t flags);
588extern void rtnl_set_sk_err(u32 group, int error); 586extern void rtnl_set_sk_err(u32 group, int error);
589extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); 587extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
588extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
589 u32 id, u32 ts, u32 tsage, long expires,
590 u32 error);
590 591
591extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data); 592extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data);
592 593
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index ae1fcadd598e..813cee13da0d 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -44,7 +44,8 @@ struct rw_semaphore {
44#endif 44#endif
45 45
46#define __RWSEM_INITIALIZER(name) \ 46#define __RWSEM_INITIALIZER(name) \
47{ 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } 47{ 0, __SPIN_LOCK_UNLOCKED(name.wait_lock), LIST_HEAD_INIT((name).wait_list) \
48 __RWSEM_DEP_MAP_INIT(name) }
48 49
49#define DECLARE_RWSEM(name) \ 50#define DECLARE_RWSEM(name) \
50 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 51 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index eafe4a7b8237..dede82c63445 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -194,7 +194,16 @@ extern void init_idle(struct task_struct *idle, int cpu);
194 194
195extern cpumask_t nohz_cpu_mask; 195extern cpumask_t nohz_cpu_mask;
196 196
197extern void show_state(void); 197/*
198 * Only dump TASK_* tasks. (-1 for all tasks)
199 */
200extern void show_state_filter(unsigned long state_filter);
201
202static inline void show_state(void)
203{
204 show_state_filter(-1);
205}
206
198extern void show_regs(struct pt_regs *); 207extern void show_regs(struct pt_regs *);
199 208
200/* 209/*
@@ -338,15 +347,23 @@ struct mm_struct {
338 347
339 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ 348 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
340 349
341 unsigned dumpable:2;
342 cpumask_t cpu_vm_mask; 350 cpumask_t cpu_vm_mask;
343 351
344 /* Architecture-specific MM context */ 352 /* Architecture-specific MM context */
345 mm_context_t context; 353 mm_context_t context;
346 354
347 /* Token based thrashing protection. */ 355 /* Swap token stuff */
348 unsigned long swap_token_time; 356 /*
349 char recent_pagein; 357 * Last value of global fault stamp as seen by this process.
358 * In other words, this value gives an indication of how long
359 * it has been since this task got the token.
360 * Look at mm/thrash.c
361 */
362 unsigned int faultstamp;
363 unsigned int token_priority;
364 unsigned int last_interval;
365
366 unsigned char dumpable:2;
350 367
351 /* coredumping support */ 368 /* coredumping support */
352 int core_waiters; 369 int core_waiters;
@@ -556,7 +573,7 @@ struct sched_info {
556#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ 573#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
557 574
558#ifdef CONFIG_SCHEDSTATS 575#ifdef CONFIG_SCHEDSTATS
559extern struct file_operations proc_schedstat_operations; 576extern const struct file_operations proc_schedstat_operations;
560#endif /* CONFIG_SCHEDSTATS */ 577#endif /* CONFIG_SCHEDSTATS */
561 578
562#ifdef CONFIG_TASK_DELAY_ACCT 579#ifdef CONFIG_TASK_DELAY_ACCT
@@ -1288,7 +1305,6 @@ extern int kill_pgrp(struct pid *pid, int sig, int priv);
1288extern int kill_pid(struct pid *pid, int sig, int priv); 1305extern int kill_pid(struct pid *pid, int sig, int priv);
1289extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); 1306extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp);
1290extern int kill_pg_info(int, struct siginfo *, pid_t); 1307extern int kill_pg_info(int, struct siginfo *, pid_t);
1291extern int kill_proc_info(int, struct siginfo *, pid_t);
1292extern void do_notify_parent(struct task_struct *, int); 1308extern void do_notify_parent(struct task_struct *, int);
1293extern void force_sig(int, struct task_struct *); 1309extern void force_sig(int, struct task_struct *);
1294extern void force_sig_specific(int, struct task_struct *); 1310extern void force_sig_specific(int, struct task_struct *);
@@ -1610,87 +1626,6 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
1610 1626
1611extern void normalize_rt_tasks(void); 1627extern void normalize_rt_tasks(void);
1612 1628
1613#ifdef CONFIG_PM
1614/*
1615 * Check if a process has been frozen
1616 */
1617static inline int frozen(struct task_struct *p)
1618{
1619 return p->flags & PF_FROZEN;
1620}
1621
1622/*
1623 * Check if there is a request to freeze a process
1624 */
1625static inline int freezing(struct task_struct *p)
1626{
1627 return p->flags & PF_FREEZE;
1628}
1629
1630/*
1631 * Request that a process be frozen
1632 * FIXME: SMP problem. We may not modify other process' flags!
1633 */
1634static inline void freeze(struct task_struct *p)
1635{
1636 p->flags |= PF_FREEZE;
1637}
1638
1639/*
1640 * Sometimes we may need to cancel the previous 'freeze' request
1641 */
1642static inline void do_not_freeze(struct task_struct *p)
1643{
1644 p->flags &= ~PF_FREEZE;
1645}
1646
1647/*
1648 * Wake up a frozen process
1649 */
1650static inline int thaw_process(struct task_struct *p)
1651{
1652 if (frozen(p)) {
1653 p->flags &= ~PF_FROZEN;
1654 wake_up_process(p);
1655 return 1;
1656 }
1657 return 0;
1658}
1659
1660/*
1661 * freezing is complete, mark process as frozen
1662 */
1663static inline void frozen_process(struct task_struct *p)
1664{
1665 p->flags = (p->flags & ~PF_FREEZE) | PF_FROZEN;
1666}
1667
1668extern void refrigerator(void);
1669extern int freeze_processes(void);
1670extern void thaw_processes(void);
1671
1672static inline int try_to_freeze(void)
1673{
1674 if (freezing(current)) {
1675 refrigerator();
1676 return 1;
1677 } else
1678 return 0;
1679}
1680#else
1681static inline int frozen(struct task_struct *p) { return 0; }
1682static inline int freezing(struct task_struct *p) { return 0; }
1683static inline void freeze(struct task_struct *p) { BUG(); }
1684static inline int thaw_process(struct task_struct *p) { return 1; }
1685static inline void frozen_process(struct task_struct *p) { BUG(); }
1686
1687static inline void refrigerator(void) {}
1688static inline int freeze_processes(void) { BUG(); return 0; }
1689static inline void thaw_processes(void) {}
1690
1691static inline int try_to_freeze(void) { return 0; }
1692
1693#endif /* CONFIG_PM */
1694#endif /* __KERNEL__ */ 1629#endif /* __KERNEL__ */
1695 1630
1696#endif 1631#endif
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 2925e66a6732..b02308ee7667 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -42,7 +42,8 @@ struct screen_info {
42 u16 pages; /* 0x32 */ 42 u16 pages; /* 0x32 */
43 u16 vesa_attributes; /* 0x34 */ 43 u16 vesa_attributes; /* 0x34 */
44 u32 capabilities; /* 0x36 */ 44 u32 capabilities; /* 0x36 */
45 /* 0x3a -- 0x3f reserved for future expansion */ 45 /* 0x3a -- 0x3b reserved for future expansion */
46 /* 0x3c -- 0x3f micro stack for relocatable kernels */
46}; 47};
47 48
48extern struct screen_info screen_info; 49extern struct screen_info screen_info;
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index 6ec66dec29f7..35108fe7a686 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -57,17 +57,17 @@
57 57
58/* Section 3.1. SCTP Common Header Format */ 58/* Section 3.1. SCTP Common Header Format */
59typedef struct sctphdr { 59typedef struct sctphdr {
60 __u16 source; 60 __be16 source;
61 __u16 dest; 61 __be16 dest;
62 __u32 vtag; 62 __be32 vtag;
63 __u32 checksum; 63 __be32 checksum;
64} __attribute__((packed)) sctp_sctphdr_t; 64} __attribute__((packed)) sctp_sctphdr_t;
65 65
66/* Section 3.2. Chunk Field Descriptions. */ 66/* Section 3.2. Chunk Field Descriptions. */
67typedef struct sctp_chunkhdr { 67typedef struct sctp_chunkhdr {
68 __u8 type; 68 __u8 type;
69 __u8 flags; 69 __u8 flags;
70 __u16 length; 70 __be16 length;
71} __attribute__((packed)) sctp_chunkhdr_t; 71} __attribute__((packed)) sctp_chunkhdr_t;
72 72
73 73
@@ -153,8 +153,8 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 };
153 */ 153 */
154 154
155typedef struct sctp_paramhdr { 155typedef struct sctp_paramhdr {
156 __u16 type; 156 __be16 type;
157 __u16 length; 157 __be16 length;
158} __attribute__((packed)) sctp_paramhdr_t; 158} __attribute__((packed)) sctp_paramhdr_t;
159 159
160typedef enum { 160typedef enum {
@@ -203,10 +203,10 @@ enum { SCTP_PARAM_ACTION_MASK = __constant_htons(0xc000), };
203/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */ 203/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
204 204
205typedef struct sctp_datahdr { 205typedef struct sctp_datahdr {
206 __u32 tsn; 206 __be32 tsn;
207 __u16 stream; 207 __be16 stream;
208 __u16 ssn; 208 __be16 ssn;
209 __u32 ppid; 209 __be32 ppid;
210 __u8 payload[0]; 210 __u8 payload[0];
211} __attribute__((packed)) sctp_datahdr_t; 211} __attribute__((packed)) sctp_datahdr_t;
212 212
@@ -232,11 +232,11 @@ enum { SCTP_DATA_FRAG_MASK = 0x03, };
232 * endpoints. 232 * endpoints.
233 */ 233 */
234typedef struct sctp_inithdr { 234typedef struct sctp_inithdr {
235 __u32 init_tag; 235 __be32 init_tag;
236 __u32 a_rwnd; 236 __be32 a_rwnd;
237 __u16 num_outbound_streams; 237 __be16 num_outbound_streams;
238 __u16 num_inbound_streams; 238 __be16 num_inbound_streams;
239 __u32 initial_tsn; 239 __be32 initial_tsn;
240 __u8 params[0]; 240 __u8 params[0];
241} __attribute__((packed)) sctp_inithdr_t; 241} __attribute__((packed)) sctp_inithdr_t;
242 242
@@ -261,7 +261,7 @@ typedef struct sctp_ipv6addr_param {
261/* Section 3.3.2.1 Cookie Preservative (9) */ 261/* Section 3.3.2.1 Cookie Preservative (9) */
262typedef struct sctp_cookie_preserve_param { 262typedef struct sctp_cookie_preserve_param {
263 sctp_paramhdr_t param_hdr; 263 sctp_paramhdr_t param_hdr;
264 uint32_t lifespan_increment; 264 __be32 lifespan_increment;
265} __attribute__((packed)) sctp_cookie_preserve_param_t; 265} __attribute__((packed)) sctp_cookie_preserve_param_t;
266 266
267/* Section 3.3.2.1 Host Name Address (11) */ 267/* Section 3.3.2.1 Host Name Address (11) */
@@ -273,7 +273,7 @@ typedef struct sctp_hostname_param {
273/* Section 3.3.2.1 Supported Address Types (12) */ 273/* Section 3.3.2.1 Supported Address Types (12) */
274typedef struct sctp_supported_addrs_param { 274typedef struct sctp_supported_addrs_param {
275 sctp_paramhdr_t param_hdr; 275 sctp_paramhdr_t param_hdr;
276 uint16_t types[0]; 276 __be16 types[0];
277} __attribute__((packed)) sctp_supported_addrs_param_t; 277} __attribute__((packed)) sctp_supported_addrs_param_t;
278 278
279/* Appendix A. ECN Capable (32768) */ 279/* Appendix A. ECN Capable (32768) */
@@ -284,7 +284,7 @@ typedef struct sctp_ecn_capable_param {
284/* ADDIP Section 3.2.6 Adaption Layer Indication */ 284/* ADDIP Section 3.2.6 Adaption Layer Indication */
285typedef struct sctp_adaption_ind_param { 285typedef struct sctp_adaption_ind_param {
286 struct sctp_paramhdr param_hdr; 286 struct sctp_paramhdr param_hdr;
287 __u32 adaption_ind; 287 __be32 adaption_ind;
288} __attribute__((packed)) sctp_adaption_ind_param_t; 288} __attribute__((packed)) sctp_adaption_ind_param_t;
289 289
290/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2): 290/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
@@ -316,11 +316,11 @@ typedef struct sctp_unrecognized_param {
316 */ 316 */
317 317
318typedef struct sctp_gap_ack_block { 318typedef struct sctp_gap_ack_block {
319 __u16 start; 319 __be16 start;
320 __u16 end; 320 __be16 end;
321} __attribute__((packed)) sctp_gap_ack_block_t; 321} __attribute__((packed)) sctp_gap_ack_block_t;
322 322
323typedef uint32_t sctp_dup_tsn_t; 323typedef __be32 sctp_dup_tsn_t;
324 324
325typedef union { 325typedef union {
326 sctp_gap_ack_block_t gab; 326 sctp_gap_ack_block_t gab;
@@ -328,10 +328,10 @@ typedef union {
328} sctp_sack_variable_t; 328} sctp_sack_variable_t;
329 329
330typedef struct sctp_sackhdr { 330typedef struct sctp_sackhdr {
331 __u32 cum_tsn_ack; 331 __be32 cum_tsn_ack;
332 __u32 a_rwnd; 332 __be32 a_rwnd;
333 __u16 num_gap_ack_blocks; 333 __be16 num_gap_ack_blocks;
334 __u16 num_dup_tsns; 334 __be16 num_dup_tsns;
335 sctp_sack_variable_t variable[0]; 335 sctp_sack_variable_t variable[0];
336} __attribute__((packed)) sctp_sackhdr_t; 336} __attribute__((packed)) sctp_sackhdr_t;
337 337
@@ -371,7 +371,7 @@ typedef struct sctp_abort_chunk {
371 * and the highest consecutive acking value. 371 * and the highest consecutive acking value.
372 */ 372 */
373typedef struct sctp_shutdownhdr { 373typedef struct sctp_shutdownhdr {
374 __u32 cum_tsn_ack; 374 __be32 cum_tsn_ack;
375} __attribute__((packed)) sctp_shutdownhdr_t; 375} __attribute__((packed)) sctp_shutdownhdr_t;
376 376
377struct sctp_shutdown_chunk_t { 377struct sctp_shutdown_chunk_t {
@@ -382,8 +382,8 @@ struct sctp_shutdown_chunk_t {
382/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ 382/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
383 383
384typedef struct sctp_errhdr { 384typedef struct sctp_errhdr {
385 __u16 cause; 385 __be16 cause;
386 __u16 length; 386 __be16 length;
387 __u8 variable[0]; 387 __u8 variable[0];
388} __attribute__((packed)) sctp_errhdr_t; 388} __attribute__((packed)) sctp_errhdr_t;
389 389
@@ -462,7 +462,7 @@ typedef enum {
462 * Explicit Congestion Notification Echo (ECNE) (12) 462 * Explicit Congestion Notification Echo (ECNE) (12)
463 */ 463 */
464typedef struct sctp_ecnehdr { 464typedef struct sctp_ecnehdr {
465 __u32 lowest_tsn; 465 __be32 lowest_tsn;
466} sctp_ecnehdr_t; 466} sctp_ecnehdr_t;
467 467
468typedef struct sctp_ecne_chunk { 468typedef struct sctp_ecne_chunk {
@@ -474,7 +474,7 @@ typedef struct sctp_ecne_chunk {
474 * Congestion Window Reduced (CWR) (13) 474 * Congestion Window Reduced (CWR) (13)
475 */ 475 */
476typedef struct sctp_cwrhdr { 476typedef struct sctp_cwrhdr {
477 __u32 lowest_tsn; 477 __be32 lowest_tsn;
478} sctp_cwrhdr_t; 478} sctp_cwrhdr_t;
479 479
480typedef struct sctp_cwr_chunk { 480typedef struct sctp_cwr_chunk {
@@ -529,12 +529,12 @@ typedef struct sctp_cwr_chunk {
529 * chunks this field MUST be filled in. 529 * chunks this field MUST be filled in.
530 */ 530 */
531struct sctp_fwdtsn_skip { 531struct sctp_fwdtsn_skip {
532 __u16 stream; 532 __be16 stream;
533 __u16 ssn; 533 __be16 ssn;
534} __attribute__((packed)); 534} __attribute__((packed));
535 535
536struct sctp_fwdtsn_hdr { 536struct sctp_fwdtsn_hdr {
537 __u32 new_cum_tsn; 537 __be32 new_cum_tsn;
538 struct sctp_fwdtsn_skip skip[0]; 538 struct sctp_fwdtsn_skip skip[0];
539} __attribute((packed)); 539} __attribute((packed));
540 540
@@ -578,11 +578,11 @@ struct sctp_fwdtsn_chunk {
578 */ 578 */
579typedef struct sctp_addip_param { 579typedef struct sctp_addip_param {
580 sctp_paramhdr_t param_hdr; 580 sctp_paramhdr_t param_hdr;
581 __u32 crr_id; 581 __be32 crr_id;
582} __attribute__((packed)) sctp_addip_param_t; 582} __attribute__((packed)) sctp_addip_param_t;
583 583
584typedef struct sctp_addiphdr { 584typedef struct sctp_addiphdr {
585 __u32 serial; 585 __be32 serial;
586 __u8 params[0]; 586 __u8 params[0];
587} __attribute__((packed)) sctp_addiphdr_t; 587} __attribute__((packed)) sctp_addiphdr_t;
588 588
diff --git a/include/linux/security.h b/include/linux/security.h
index b200b9856f32..83cdefae9931 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -826,6 +826,8 @@ struct request_sock;
826 * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid. 826 * Sets the openreq's sid to socket's sid with MLS portion taken from peer sid.
827 * @inet_csk_clone: 827 * @inet_csk_clone:
828 * Sets the new child socket's sid to the openreq sid. 828 * Sets the new child socket's sid to the openreq sid.
829 * @inet_conn_established:
830 * Sets the connection's peersid to the secmark on skb.
829 * @req_classify_flow: 831 * @req_classify_flow:
830 * Sets the flow's sid to the openreq sid. 832 * Sets the flow's sid to the openreq sid.
831 * 833 *
@@ -836,10 +838,8 @@ struct request_sock;
836 * used by the XFRM system. 838 * used by the XFRM system.
837 * @sec_ctx contains the security context information being provided by 839 * @sec_ctx contains the security context information being provided by
838 * the user-level policy update program (e.g., setkey). 840 * the user-level policy update program (e.g., setkey).
839 * @sk refers to the sock from which to derive the security context.
840 * Allocate a security structure to the xp->security field; the security 841 * Allocate a security structure to the xp->security field; the security
841 * field is initialized to NULL when the xfrm_policy is allocated. Only 842 * field is initialized to NULL when the xfrm_policy is allocated.
842 * one of sec_ctx or sock can be specified.
843 * Return 0 if operation was successful (memory to allocate, legal context) 843 * Return 0 if operation was successful (memory to allocate, legal context)
844 * @xfrm_policy_clone_security: 844 * @xfrm_policy_clone_security:
845 * @old contains an existing xfrm_policy in the SPD. 845 * @old contains an existing xfrm_policy in the SPD.
@@ -858,9 +858,6 @@ struct request_sock;
858 * Database by the XFRM system. 858 * Database by the XFRM system.
859 * @sec_ctx contains the security context information being provided by 859 * @sec_ctx contains the security context information being provided by
860 * the user-level SA generation program (e.g., setkey or racoon). 860 * the user-level SA generation program (e.g., setkey or racoon).
861 * @polsec contains the security context information associated with a xfrm
862 * policy rule from which to take the base context. polsec must be NULL
863 * when sec_ctx is specified.
864 * @secid contains the secid from which to take the mls portion of the context. 861 * @secid contains the secid from which to take the mls portion of the context.
865 * Allocate a security structure to the x->security field; the security 862 * Allocate a security structure to the x->security field; the security
866 * field is initialized to NULL when the xfrm_state is allocated. Set the 863 * field is initialized to NULL when the xfrm_state is allocated. Set the
@@ -889,11 +886,6 @@ struct request_sock;
889 * @xp contains the policy to check for a match. 886 * @xp contains the policy to check for a match.
890 * @fl contains the flow to check for a match. 887 * @fl contains the flow to check for a match.
891 * Return 1 if there is a match. 888 * Return 1 if there is a match.
892 * @xfrm_flow_state_match:
893 * @fl contains the flow key to match.
894 * @xfrm points to the xfrm_state to match.
895 * @xp points to the xfrm_policy to match.
896 * Return 1 if there is a match.
897 * @xfrm_decode_session: 889 * @xfrm_decode_session:
898 * @skb points to skb to decode. 890 * @skb points to skb to decode.
899 * @secid points to the flow key secid to set. 891 * @secid points to the flow key secid to set.
@@ -1373,25 +1365,24 @@ struct security_operations {
1373 int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb, 1365 int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb,
1374 struct request_sock *req); 1366 struct request_sock *req);
1375 void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req); 1367 void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req);
1368 void (*inet_conn_established)(struct sock *sk, struct sk_buff *skb);
1376 void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl); 1369 void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl);
1377#endif /* CONFIG_SECURITY_NETWORK */ 1370#endif /* CONFIG_SECURITY_NETWORK */
1378 1371
1379#ifdef CONFIG_SECURITY_NETWORK_XFRM 1372#ifdef CONFIG_SECURITY_NETWORK_XFRM
1380 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, 1373 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp,
1381 struct xfrm_user_sec_ctx *sec_ctx, struct sock *sk); 1374 struct xfrm_user_sec_ctx *sec_ctx);
1382 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); 1375 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
1383 void (*xfrm_policy_free_security) (struct xfrm_policy *xp); 1376 void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
1384 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); 1377 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp);
1385 int (*xfrm_state_alloc_security) (struct xfrm_state *x, 1378 int (*xfrm_state_alloc_security) (struct xfrm_state *x,
1386 struct xfrm_user_sec_ctx *sec_ctx, struct xfrm_sec_ctx *polsec, 1379 struct xfrm_user_sec_ctx *sec_ctx,
1387 u32 secid); 1380 u32 secid);
1388 void (*xfrm_state_free_security) (struct xfrm_state *x); 1381 void (*xfrm_state_free_security) (struct xfrm_state *x);
1389 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1382 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1390 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); 1383 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
1391 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, 1384 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
1392 struct xfrm_policy *xp, struct flowi *fl); 1385 struct xfrm_policy *xp, struct flowi *fl);
1393 int (*xfrm_flow_state_match)(struct flowi *fl, struct xfrm_state *xfrm,
1394 struct xfrm_policy *xp);
1395 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); 1386 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
1396#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1387#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1397 1388
@@ -2966,9 +2957,15 @@ static inline void security_inet_csk_clone(struct sock *newsk,
2966{ 2957{
2967 security_ops->inet_csk_clone(newsk, req); 2958 security_ops->inet_csk_clone(newsk, req);
2968} 2959}
2960
2961static inline void security_inet_conn_established(struct sock *sk,
2962 struct sk_buff *skb)
2963{
2964 security_ops->inet_conn_established(sk, skb);
2965}
2969#else /* CONFIG_SECURITY_NETWORK */ 2966#else /* CONFIG_SECURITY_NETWORK */
2970static inline int security_unix_stream_connect(struct socket * sock, 2967static inline int security_unix_stream_connect(struct socket * sock,
2971 struct socket * other, 2968 struct socket * other,
2972 struct sock * newsk) 2969 struct sock * newsk)
2973{ 2970{
2974 return 0; 2971 return 0;
@@ -3115,12 +3112,17 @@ static inline void security_inet_csk_clone(struct sock *newsk,
3115 const struct request_sock *req) 3112 const struct request_sock *req)
3116{ 3113{
3117} 3114}
3115
3116static inline void security_inet_conn_established(struct sock *sk,
3117 struct sk_buff *skb)
3118{
3119}
3118#endif /* CONFIG_SECURITY_NETWORK */ 3120#endif /* CONFIG_SECURITY_NETWORK */
3119 3121
3120#ifdef CONFIG_SECURITY_NETWORK_XFRM 3122#ifdef CONFIG_SECURITY_NETWORK_XFRM
3121static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) 3123static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
3122{ 3124{
3123 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx, NULL); 3125 return security_ops->xfrm_policy_alloc_security(xp, sec_ctx);
3124} 3126}
3125 3127
3126static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 3128static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
@@ -3141,7 +3143,7 @@ static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
3141static inline int security_xfrm_state_alloc(struct xfrm_state *x, 3143static inline int security_xfrm_state_alloc(struct xfrm_state *x,
3142 struct xfrm_user_sec_ctx *sec_ctx) 3144 struct xfrm_user_sec_ctx *sec_ctx)
3143{ 3145{
3144 return security_ops->xfrm_state_alloc_security(x, sec_ctx, NULL, 0); 3146 return security_ops->xfrm_state_alloc_security(x, sec_ctx, 0);
3145} 3147}
3146 3148
3147static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x, 3149static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
@@ -3149,7 +3151,11 @@ static inline int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
3149{ 3151{
3150 if (!polsec) 3152 if (!polsec)
3151 return 0; 3153 return 0;
3152 return security_ops->xfrm_state_alloc_security(x, NULL, polsec, secid); 3154 /*
3155 * We want the context to be taken from secid which is usually
3156 * from the sock.
3157 */
3158 return security_ops->xfrm_state_alloc_security(x, NULL, secid);
3153} 3159}
3154 3160
3155static inline int security_xfrm_state_delete(struct xfrm_state *x) 3161static inline int security_xfrm_state_delete(struct xfrm_state *x)
@@ -3173,12 +3179,6 @@ static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3173 return security_ops->xfrm_state_pol_flow_match(x, xp, fl); 3179 return security_ops->xfrm_state_pol_flow_match(x, xp, fl);
3174} 3180}
3175 3181
3176static inline int security_xfrm_flow_state_match(struct flowi *fl,
3177 struct xfrm_state *xfrm, struct xfrm_policy *xp)
3178{
3179 return security_ops->xfrm_flow_state_match(fl, xfrm, xp);
3180}
3181
3182static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) 3182static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
3183{ 3183{
3184 return security_ops->xfrm_decode_session(skb, secid, 1); 3184 return security_ops->xfrm_decode_session(skb, secid, 1);
@@ -3242,12 +3242,6 @@ static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
3242 return 1; 3242 return 1;
3243} 3243}
3244 3244
3245static inline int security_xfrm_flow_state_match(struct flowi *fl,
3246 struct xfrm_state *xfrm, struct xfrm_policy *xp)
3247{
3248 return 1;
3249}
3250
3251static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid) 3245static inline int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid)
3252{ 3246{
3253 return 0; 3247 return 0;
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index b95f6eb7254c..3e3cccbb1cac 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -20,7 +20,7 @@ struct seq_file {
20 loff_t index; 20 loff_t index;
21 loff_t version; 21 loff_t version;
22 struct mutex lock; 22 struct mutex lock;
23 struct seq_operations *op; 23 const struct seq_operations *op;
24 void *private; 24 void *private;
25}; 25};
26 26
@@ -31,7 +31,7 @@ struct seq_operations {
31 int (*show) (struct seq_file *m, void *v); 31 int (*show) (struct seq_file *m, void *v);
32}; 32};
33 33
34int seq_open(struct file *, struct seq_operations *); 34int seq_open(struct file *, const struct seq_operations *);
35ssize_t seq_read(struct file *, char __user *, size_t, loff_t *); 35ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
36loff_t seq_lseek(struct file *, loff_t, int); 36loff_t seq_lseek(struct file *, loff_t, int);
37int seq_release(struct inode *, struct file *); 37int seq_release(struct inode *, struct file *);
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 8e9681413726..71310d80c09a 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -41,6 +41,7 @@ enum {
41 PLAT8250_DEV_FOURPORT, 41 PLAT8250_DEV_FOURPORT,
42 PLAT8250_DEV_ACCENT, 42 PLAT8250_DEV_ACCENT,
43 PLAT8250_DEV_BOCA, 43 PLAT8250_DEV_BOCA,
44 PLAT8250_DEV_EXAR_ST16C554,
44 PLAT8250_DEV_HUB6, 45 PLAT8250_DEV_HUB6,
45 PLAT8250_DEV_MCA, 46 PLAT8250_DEV_MCA,
46 PLAT8250_DEV_AU1X00, 47 PLAT8250_DEV_AU1X00,
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 463ab953b092..827672136646 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -132,6 +132,8 @@
132 132
133#define PORT_S3C2412 73 133#define PORT_S3C2412 73
134 134
135/* Xilinx uartlite */
136#define PORT_UARTLITE 74
135 137
136#ifdef __KERNEL__ 138#ifdef __KERNEL__
137 139
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 117135e33d67..14749056dd63 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -241,6 +241,8 @@ extern int sigprocmask(int, sigset_t *, sigset_t *);
241struct pt_regs; 241struct pt_regs;
242extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 242extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
243 243
244extern struct kmem_cache *sighand_cachep;
245
244#endif /* __KERNEL__ */ 246#endif /* __KERNEL__ */
245 247
246#endif /* _LINUX_SIGNAL_H */ 248#endif /* _LINUX_SIGNAL_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 85577a4ffa61..4ff3940210d8 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -22,12 +22,10 @@
22#include <asm/atomic.h> 22#include <asm/atomic.h>
23#include <asm/types.h> 23#include <asm/types.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/mm.h>
26#include <linux/highmem.h>
27#include <linux/poll.h>
28#include <linux/net.h> 25#include <linux/net.h>
29#include <linux/textsearch.h> 26#include <linux/textsearch.h>
30#include <net/checksum.h> 27#include <net/checksum.h>
28#include <linux/rcupdate.h>
31#include <linux/dmaengine.h> 29#include <linux/dmaengine.h>
32 30
33#define HAVE_ALLOC_SKB /* For the drivers to know */ 31#define HAVE_ALLOC_SKB /* For the drivers to know */
@@ -139,7 +137,7 @@ struct skb_shared_info {
139 /* Warning: this field is not always filled in (UFO)! */ 137 /* Warning: this field is not always filled in (UFO)! */
140 unsigned short gso_segs; 138 unsigned short gso_segs;
141 unsigned short gso_type; 139 unsigned short gso_type;
142 unsigned int ip6_frag_id; 140 __be32 ip6_frag_id;
143 struct sk_buff *frag_list; 141 struct sk_buff *frag_list;
144 skb_frag_t frags[MAX_SKB_FRAGS]; 142 skb_frag_t frags[MAX_SKB_FRAGS];
145}; 143};
@@ -216,7 +214,7 @@ enum {
216 * @tail: Tail pointer 214 * @tail: Tail pointer
217 * @end: End pointer 215 * @end: End pointer
218 * @destructor: Destruct function 216 * @destructor: Destruct function
219 * @nfmark: Can be used for communication between hooks 217 * @mark: Generic packet mark
220 * @nfct: Associated connection, if any 218 * @nfct: Associated connection, if any
221 * @ipvs_property: skbuff is owned by ipvs 219 * @ipvs_property: skbuff is owned by ipvs
222 * @nfctinfo: Relationship of this skb to the connection 220 * @nfctinfo: Relationship of this skb to the connection
@@ -273,8 +271,11 @@ struct sk_buff {
273 271
274 unsigned int len, 272 unsigned int len,
275 data_len, 273 data_len,
276 mac_len, 274 mac_len;
277 csum; 275 union {
276 __wsum csum;
277 __u32 csum_offset;
278 };
278 __u32 priority; 279 __u32 priority;
279 __u8 local_df:1, 280 __u8 local_df:1,
280 cloned:1, 281 cloned:1,
@@ -295,7 +296,6 @@ struct sk_buff {
295#ifdef CONFIG_BRIDGE_NETFILTER 296#ifdef CONFIG_BRIDGE_NETFILTER
296 struct nf_bridge_info *nf_bridge; 297 struct nf_bridge_info *nf_bridge;
297#endif 298#endif
298 __u32 nfmark;
299#endif /* CONFIG_NETFILTER */ 299#endif /* CONFIG_NETFILTER */
300#ifdef CONFIG_NET_SCHED 300#ifdef CONFIG_NET_SCHED
301 __u16 tc_index; /* traffic control index */ 301 __u16 tc_index; /* traffic control index */
@@ -310,6 +310,7 @@ struct sk_buff {
310 __u32 secmark; 310 __u32 secmark;
311#endif 311#endif
312 312
313 __u32 mark;
313 314
314 /* These elements must be at the end, see alloc_skb() for details. */ 315 /* These elements must be at the end, see alloc_skb() for details. */
315 unsigned int truesize; 316 unsigned int truesize;
@@ -331,20 +332,20 @@ struct sk_buff {
331extern void kfree_skb(struct sk_buff *skb); 332extern void kfree_skb(struct sk_buff *skb);
332extern void __kfree_skb(struct sk_buff *skb); 333extern void __kfree_skb(struct sk_buff *skb);
333extern struct sk_buff *__alloc_skb(unsigned int size, 334extern struct sk_buff *__alloc_skb(unsigned int size,
334 gfp_t priority, int fclone); 335 gfp_t priority, int fclone, int node);
335static inline struct sk_buff *alloc_skb(unsigned int size, 336static inline struct sk_buff *alloc_skb(unsigned int size,
336 gfp_t priority) 337 gfp_t priority)
337{ 338{
338 return __alloc_skb(size, priority, 0); 339 return __alloc_skb(size, priority, 0, -1);
339} 340}
340 341
341static inline struct sk_buff *alloc_skb_fclone(unsigned int size, 342static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
342 gfp_t priority) 343 gfp_t priority)
343{ 344{
344 return __alloc_skb(size, priority, 1); 345 return __alloc_skb(size, priority, 1, -1);
345} 346}
346 347
347extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, 348extern struct sk_buff *alloc_skb_from_cache(struct kmem_cache *cp,
348 unsigned int size, 349 unsigned int size,
349 gfp_t priority); 350 gfp_t priority);
350extern void kfree_skbmem(struct sk_buff *skb); 351extern void kfree_skbmem(struct sk_buff *skb);
@@ -1199,8 +1200,7 @@ static inline int skb_add_data(struct sk_buff *skb,
1199 1200
1200 if (skb->ip_summed == CHECKSUM_NONE) { 1201 if (skb->ip_summed == CHECKSUM_NONE) {
1201 int err = 0; 1202 int err = 0;
1202 unsigned int csum = csum_and_copy_from_user(from, 1203 __wsum csum = csum_and_copy_from_user(from, skb_put(skb, copy),
1203 skb_put(skb, copy),
1204 copy, 0, &err); 1204 copy, 0, &err);
1205 if (!err) { 1205 if (!err) {
1206 skb->csum = csum_block_add(skb->csum, csum, off); 1206 skb->csum = csum_block_add(skb->csum, csum, off);
@@ -1293,24 +1293,6 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1293 return __pskb_trim(skb, len); 1293 return __pskb_trim(skb, len);
1294} 1294}
1295 1295
1296static inline void *kmap_skb_frag(const skb_frag_t *frag)
1297{
1298#ifdef CONFIG_HIGHMEM
1299 BUG_ON(in_irq());
1300
1301 local_bh_disable();
1302#endif
1303 return kmap_atomic(frag->page, KM_SKB_DATA_SOFTIRQ);
1304}
1305
1306static inline void kunmap_skb_frag(void *vaddr)
1307{
1308 kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ);
1309#ifdef CONFIG_HIGHMEM
1310 local_bh_enable();
1311#endif
1312}
1313
1314#define skb_queue_walk(queue, skb) \ 1296#define skb_queue_walk(queue, skb) \
1315 for (skb = (queue)->next; \ 1297 for (skb = (queue)->next; \
1316 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ 1298 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \
@@ -1335,15 +1317,15 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1335extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1317extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1336extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1318extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1337 unsigned int flags); 1319 unsigned int flags);
1338extern unsigned int skb_checksum(const struct sk_buff *skb, int offset, 1320extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
1339 int len, unsigned int csum); 1321 int len, __wsum csum);
1340extern int skb_copy_bits(const struct sk_buff *skb, int offset, 1322extern int skb_copy_bits(const struct sk_buff *skb, int offset,
1341 void *to, int len); 1323 void *to, int len);
1342extern int skb_store_bits(const struct sk_buff *skb, int offset, 1324extern int skb_store_bits(const struct sk_buff *skb, int offset,
1343 void *from, int len); 1325 void *from, int len);
1344extern unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, 1326extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb,
1345 int offset, u8 *to, int len, 1327 int offset, u8 *to, int len,
1346 unsigned int csum); 1328 __wsum csum);
1347extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 1329extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1348extern void skb_split(struct sk_buff *skb, 1330extern void skb_split(struct sk_buff *skb,
1349 struct sk_buff *skb1, const u32 len); 1331 struct sk_buff *skb1, const u32 len);
@@ -1399,7 +1381,7 @@ static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *
1399 1381
1400extern void __net_timestamp(struct sk_buff *skb); 1382extern void __net_timestamp(struct sk_buff *skb);
1401 1383
1402extern unsigned int __skb_checksum_complete(struct sk_buff *skb); 1384extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1403 1385
1404/** 1386/**
1405 * skb_checksum_complete - Calculate checksum of an entire packet 1387 * skb_checksum_complete - Calculate checksum of an entire packet
diff --git a/include/linux/slab.h b/include/linux/slab.h
index c4947b8a2c03..2271886744f8 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -7,27 +7,17 @@
7#ifndef _LINUX_SLAB_H 7#ifndef _LINUX_SLAB_H
8#define _LINUX_SLAB_H 8#define _LINUX_SLAB_H
9 9
10#if defined(__KERNEL__) 10#ifdef __KERNEL__
11 11
12typedef struct kmem_cache kmem_cache_t; 12#include <linux/gfp.h>
13#include <linux/init.h>
14#include <linux/types.h>
15#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */
16#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
17#include <linux/compiler.h>
13 18
14#include <linux/gfp.h> 19/* kmem_cache_t exists for legacy reasons and is not used by code in mm */
15#include <linux/init.h> 20typedef struct kmem_cache kmem_cache_t __deprecated;
16#include <linux/types.h>
17#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */
18#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
19
20/* flags for kmem_cache_alloc() */
21#define SLAB_NOFS GFP_NOFS
22#define SLAB_NOIO GFP_NOIO
23#define SLAB_ATOMIC GFP_ATOMIC
24#define SLAB_USER GFP_USER
25#define SLAB_KERNEL GFP_KERNEL
26#define SLAB_DMA GFP_DMA
27
28#define SLAB_LEVEL_MASK GFP_LEVEL_MASK
29
30#define SLAB_NO_GROW __GFP_NO_GROW /* don't grow a cache */
31 21
32/* flags to pass to kmem_cache_create(). 22/* flags to pass to kmem_cache_create().
33 * The first 3 are only valid when the allocator as been build 23 * The first 3 are only valid when the allocator as been build
@@ -57,22 +47,23 @@ typedef struct kmem_cache kmem_cache_t;
57/* prototypes */ 47/* prototypes */
58extern void __init kmem_cache_init(void); 48extern void __init kmem_cache_init(void);
59 49
60extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long, 50extern struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
61 void (*)(void *, kmem_cache_t *, unsigned long), 51 unsigned long,
62 void (*)(void *, kmem_cache_t *, unsigned long)); 52 void (*)(void *, struct kmem_cache *, unsigned long),
63extern void kmem_cache_destroy(kmem_cache_t *); 53 void (*)(void *, struct kmem_cache *, unsigned long));
64extern int kmem_cache_shrink(kmem_cache_t *); 54extern void kmem_cache_destroy(struct kmem_cache *);
65extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); 55extern int kmem_cache_shrink(struct kmem_cache *);
56extern void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
66extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); 57extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t);
67extern void kmem_cache_free(kmem_cache_t *, void *); 58extern void kmem_cache_free(struct kmem_cache *, void *);
68extern unsigned int kmem_cache_size(kmem_cache_t *); 59extern unsigned int kmem_cache_size(struct kmem_cache *);
69extern const char *kmem_cache_name(kmem_cache_t *); 60extern const char *kmem_cache_name(struct kmem_cache *);
70 61
71/* Size description struct for general caches. */ 62/* Size description struct for general caches. */
72struct cache_sizes { 63struct cache_sizes {
73 size_t cs_size; 64 size_t cs_size;
74 kmem_cache_t *cs_cachep; 65 struct kmem_cache *cs_cachep;
75 kmem_cache_t *cs_dmacachep; 66 struct kmem_cache *cs_dmacachep;
76}; 67};
77extern struct cache_sizes malloc_sizes[]; 68extern struct cache_sizes malloc_sizes[];
78 69
@@ -211,7 +202,7 @@ extern unsigned int ksize(const void *);
211extern int slab_is_available(void); 202extern int slab_is_available(void);
212 203
213#ifdef CONFIG_NUMA 204#ifdef CONFIG_NUMA
214extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); 205extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
215extern void *__kmalloc_node(size_t size, gfp_t flags, int node); 206extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
216 207
217static inline void *kmalloc_node(size_t size, gfp_t flags, int node) 208static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
@@ -236,8 +227,27 @@ found:
236 } 227 }
237 return __kmalloc_node(size, flags, node); 228 return __kmalloc_node(size, flags, node);
238} 229}
230
231/*
232 * kmalloc_node_track_caller is a special version of kmalloc_node that
233 * records the calling function of the routine calling it for slab leak
234 * tracking instead of just the calling function (confusing, eh?).
235 * It's useful when the call to kmalloc_node comes from a widely-used
236 * standard allocator where we care about the real place the memory
237 * allocation request comes from.
238 */
239#ifndef CONFIG_DEBUG_SLAB
240#define kmalloc_node_track_caller(size, flags, node) \
241 __kmalloc_node(size, flags, node)
239#else 242#else
240static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int node) 243extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, void *);
244#define kmalloc_node_track_caller(size, flags, node) \
245 __kmalloc_node_track_caller(size, flags, node, \
246 __builtin_return_address(0))
247#endif
248#else /* CONFIG_NUMA */
249static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
250 gfp_t flags, int node)
241{ 251{
242 return kmem_cache_alloc(cachep, flags); 252 return kmem_cache_alloc(cachep, flags);
243} 253}
@@ -245,10 +255,13 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
245{ 255{
246 return kmalloc(size, flags); 256 return kmalloc(size, flags);
247} 257}
258
259#define kmalloc_node_track_caller(size, flags, node) \
260 kmalloc_track_caller(size, flags)
248#endif 261#endif
249 262
250extern int FASTCALL(kmem_cache_reap(int)); 263extern int FASTCALL(kmem_cache_reap(int));
251extern int FASTCALL(kmem_ptr_validate(kmem_cache_t *cachep, void *ptr)); 264extern int FASTCALL(kmem_ptr_validate(struct kmem_cache *cachep, void *ptr));
252 265
253#else /* CONFIG_SLOB */ 266#else /* CONFIG_SLOB */
254 267
@@ -283,16 +296,9 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
283#define kzalloc(s, f) __kzalloc(s, f) 296#define kzalloc(s, f) __kzalloc(s, f)
284#define kmalloc_track_caller kmalloc 297#define kmalloc_track_caller kmalloc
285 298
286#endif /* CONFIG_SLOB */ 299#define kmalloc_node_track_caller kmalloc_node
287 300
288/* System wide caches */ 301#endif /* CONFIG_SLOB */
289extern kmem_cache_t *vm_area_cachep;
290extern kmem_cache_t *names_cachep;
291extern kmem_cache_t *files_cachep;
292extern kmem_cache_t *filp_cachep;
293extern kmem_cache_t *fs_cachep;
294extern kmem_cache_t *sighand_cachep;
295extern kmem_cache_t *bio_cachep;
296 302
297#endif /* __KERNEL__ */ 303#endif /* __KERNEL__ */
298 304
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 51649987f691..7ba23ec8211b 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -99,6 +99,13 @@ static inline int up_smp_call_function(void)
99static inline void smp_send_reschedule(int cpu) { } 99static inline void smp_send_reschedule(int cpu) { }
100#define num_booting_cpus() 1 100#define num_booting_cpus() 1
101#define smp_prepare_boot_cpu() do {} while (0) 101#define smp_prepare_boot_cpu() do {} while (0)
102static inline int smp_call_function_single(int cpuid, void (*func) (void *info),
103 void *info, int retry, int wait)
104{
105 /* Disable interrupts here? */
106 func(info);
107 return 0;
108}
102 109
103#endif /* !SMP */ 110#endif /* !SMP */
104 111
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 361409094649..92cd38efad7f 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -264,6 +264,7 @@ struct ucred {
264#define SOL_IPV6 41 264#define SOL_IPV6 41
265#define SOL_ICMPV6 58 265#define SOL_ICMPV6 58
266#define SOL_SCTP 132 266#define SOL_SCTP 132
267#define SOL_UDPLITE 136 /* UDP-Lite (RFC 3828) */
267#define SOL_RAW 255 268#define SOL_RAW 255
268#define SOL_IPX 256 269#define SOL_IPX 256
269#define SOL_AX25 257 270#define SOL_AX25 257
@@ -292,7 +293,7 @@ extern int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov,
292extern int csum_partial_copy_fromiovecend(unsigned char *kdata, 293extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
293 struct iovec *iov, 294 struct iovec *iov,
294 int offset, 295 int offset,
295 unsigned int len, int *csump); 296 unsigned int len, __wsum *csump);
296 297
297extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); 298extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode);
298extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); 299extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index e6b9d1d36ea2..abef7596655a 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -72,8 +72,8 @@
72#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 72#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
73#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 73#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
74 74
75#define SIOCGIFDIVERT 0x8944 /* Frame diversion support */ 75/* SIOCGIFDIVERT was: 0x8944 Frame diversion support */
76#define SIOCSIFDIVERT 0x8945 /* Set frame diversion options */ 76/* SIOCSIFDIVERT was: 0x8945 Set frame diversion options */
77 77
78#define SIOCETHTOOL 0x8946 /* Ethtool interface */ 78#define SIOCETHTOOL 0x8946 /* Ethtool interface */
79 79
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index b800d2d68b32..94b767d64275 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -52,6 +52,7 @@
52#include <linux/thread_info.h> 52#include <linux/thread_info.h>
53#include <linux/kernel.h> 53#include <linux/kernel.h>
54#include <linux/stringify.h> 54#include <linux/stringify.h>
55#include <linux/bottom_half.h>
55 56
56#include <asm/system.h> 57#include <asm/system.h>
57 58
@@ -183,13 +184,27 @@ do { \
183#define read_lock(lock) _read_lock(lock) 184#define read_lock(lock) _read_lock(lock)
184 185
185#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 186#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
187
186#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) 188#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock)
187#define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) 189#define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock)
188#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) 190#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock)
191
192#ifdef CONFIG_DEBUG_LOCK_ALLOC
193#define spin_lock_irqsave_nested(lock, flags, subclass) \
194 flags = _spin_lock_irqsave_nested(lock, subclass)
195#else
196#define spin_lock_irqsave_nested(lock, flags, subclass) \
197 flags = _spin_lock_irqsave(lock)
198#endif
199
189#else 200#else
201
190#define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags) 202#define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags)
191#define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags) 203#define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags)
192#define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags) 204#define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags)
205#define spin_lock_irqsave_nested(lock, flags, subclass) \
206 spin_lock_irqsave(lock, flags)
207
193#endif 208#endif
194 209
195#define spin_lock_irq(lock) _spin_lock_irq(lock) 210#define spin_lock_irq(lock) _spin_lock_irq(lock)
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 8828b8155e9c..8a2307ce7296 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -32,6 +32,8 @@ void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(lock);
32void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock); 32void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock);
33unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) 33unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
34 __acquires(lock); 34 __acquires(lock);
35unsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, int subclass)
36 __acquires(lock);
35unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) 37unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
36 __acquires(lock); 38 __acquires(lock);
37unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) 39unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
diff --git a/include/linux/start_kernel.h b/include/linux/start_kernel.h
new file mode 100644
index 000000000000..d3e5f2756545
--- /dev/null
+++ b/include/linux/start_kernel.h
@@ -0,0 +1,12 @@
1#ifndef _LINUX_START_KERNEL_H
2#define _LINUX_START_KERNEL_H
3
4#include <linux/linkage.h>
5#include <linux/init.h>
6
7/* Define the prototype for start_kernel here, rather than cluttering
8 up something else. */
9
10extern asmlinkage void __init start_kernel(void);
11
12#endif /* _LINUX_START_KERNEL_H */
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index 97b62e97dd8d..2db2fbf34947 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -90,8 +90,6 @@ struct gss_cred {
90#define gc_flags gc_base.cr_flags 90#define gc_flags gc_base.cr_flags
91#define gc_expire gc_base.cr_expire 91#define gc_expire gc_base.cr_expire
92 92
93void print_hexl(u32 *p, u_int length, u_int offset);
94
95#endif /* __KERNEL__ */ 93#endif /* __KERNEL__ */
96#endif /* _LINUX_SUNRPC_AUTH_GSS_H */ 94#endif /* _LINUX_SUNRPC_AUTH_GSS_H */
97 95
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index f6d1d646ce05..a1be89deb3af 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -53,6 +53,7 @@ struct rpc_clnt {
53 struct dentry * cl_dentry; /* inode */ 53 struct dentry * cl_dentry; /* inode */
54 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 54 struct rpc_clnt * cl_parent; /* Points to parent of clones */
55 struct rpc_rtt cl_rtt_default; 55 struct rpc_rtt cl_rtt_default;
56 struct rpc_program * cl_program;
56 char cl_inline_name[32]; 57 char cl_inline_name[32];
57}; 58};
58 59
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index e4729aa67654..60fce3c92857 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -62,12 +62,6 @@ extern unsigned int nlm_debug;
62# define RPC_IFDEBUG(x) 62# define RPC_IFDEBUG(x)
63#endif 63#endif
64 64
65#ifdef RPC_PROFILE
66# define pprintk(args...) printk(## args)
67#else
68# define pprintk(args...) do ; while (0)
69#endif
70
71/* 65/*
72 * Sysctl interface for RPC debugging 66 * Sysctl interface for RPC debugging
73 */ 67 */
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index e30ba201910a..5a4b1e0206e3 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -42,10 +42,6 @@
42 42
43struct krb5_ctx { 43struct krb5_ctx {
44 int initiate; /* 1 = initiating, 0 = accepting */ 44 int initiate; /* 1 = initiating, 0 = accepting */
45 int seed_init;
46 unsigned char seed[16];
47 int signalg;
48 int sealalg;
49 struct crypto_blkcipher *enc; 45 struct crypto_blkcipher *enc;
50 struct crypto_blkcipher *seq; 46 struct crypto_blkcipher *seq;
51 s32 endtime; 47 s32 endtime;
@@ -117,7 +113,7 @@ enum seal_alg {
117#define ENCTYPE_UNKNOWN 0x01ff 113#define ENCTYPE_UNKNOWN 0x01ff
118 114
119s32 115s32
120make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, 116make_checksum(char *, char *header, int hdrlen, struct xdr_buf *body,
121 int body_offset, struct xdr_netobj *cksum); 117 int body_offset, struct xdr_netobj *cksum);
122 118
123u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *, 119u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *,
diff --git a/include/linux/sunrpc/gss_spkm3.h b/include/linux/sunrpc/gss_spkm3.h
index 2cf3fbb40b4f..e3e6a3437f8b 100644
--- a/include/linux/sunrpc/gss_spkm3.h
+++ b/include/linux/sunrpc/gss_spkm3.h
@@ -12,27 +12,19 @@
12#include <linux/sunrpc/gss_asn1.h> 12#include <linux/sunrpc/gss_asn1.h>
13 13
14struct spkm3_ctx { 14struct spkm3_ctx {
15 struct xdr_netobj ctx_id; /* per message context id */ 15 struct xdr_netobj ctx_id; /* per message context id */
16 int qop; /* negotiated qop */ 16 int endtime; /* endtime of the context */
17 struct xdr_netobj mech_used; 17 struct xdr_netobj mech_used;
18 unsigned int ret_flags ; 18 unsigned int ret_flags ;
19 unsigned int req_flags ; 19 struct xdr_netobj conf_alg;
20 struct xdr_netobj share_key; 20 struct xdr_netobj derived_conf_key;
21 int conf_alg; 21 struct xdr_netobj intg_alg;
22 struct crypto_blkcipher *derived_conf_key; 22 struct xdr_netobj derived_integ_key;
23 int intg_alg;
24 struct crypto_blkcipher *derived_integ_key;
25 int keyestb_alg; /* alg used to get share_key */
26 int owf_alg; /* one way function */
27}; 23};
28 24
29/* from openssl/objects.h */ 25/* OIDs declarations for K-ALG, I-ALG, C-ALG, and OWF-ALG */
30/* XXX need SEAL_ALG_NONE */ 26extern const struct xdr_netobj hmac_md5_oid;
31#define NID_md5 4 27extern const struct xdr_netobj cast5_cbc_oid;
32#define NID_dhKeyAgreement 28
33#define NID_des_cbc 31
34#define NID_sha1 64
35#define NID_cast5_cbc 108
36 28
37/* SPKM InnerContext Token types */ 29/* SPKM InnerContext Token types */
38 30
@@ -46,11 +38,13 @@ u32 spkm3_make_token(struct spkm3_ctx *ctx, struct xdr_buf * text, struct xdr_ne
46u32 spkm3_read_token(struct spkm3_ctx *ctx, struct xdr_netobj *read_token, struct xdr_buf *message_buffer, int toktype); 38u32 spkm3_read_token(struct spkm3_ctx *ctx, struct xdr_netobj *read_token, struct xdr_buf *message_buffer, int toktype);
47 39
48#define CKSUMTYPE_RSA_MD5 0x0007 40#define CKSUMTYPE_RSA_MD5 0x0007
41#define CKSUMTYPE_HMAC_MD5 0x0008
49 42
50s32 make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, 43s32 make_spkm3_checksum(s32 cksumtype, struct xdr_netobj *key, char *header,
51 int body_offset, struct xdr_netobj *cksum); 44 unsigned int hdrlen, struct xdr_buf *body,
45 unsigned int body_offset, struct xdr_netobj *cksum);
52void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits); 46void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits);
53int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, 47int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen,
54 int explen); 48 int explen);
55void spkm3_mic_header(unsigned char **hdrbuf, unsigned int *hdrlen, 49void spkm3_mic_header(unsigned char **hdrbuf, unsigned int *hdrlen,
56 unsigned char *ctxhdr, int elen, int zbit); 50 unsigned char *ctxhdr, int elen, int zbit);
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index a2eb9b4a9de3..4a68125b6de6 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -30,7 +30,7 @@ struct rpc_inode {
30#define RPC_PIPE_WAIT_FOR_OPEN 1 30#define RPC_PIPE_WAIT_FOR_OPEN 1
31 int flags; 31 int flags;
32 struct rpc_pipe_ops *ops; 32 struct rpc_pipe_ops *ops;
33 struct work_struct queue_timeout; 33 struct delayed_work queue_timeout;
34}; 34};
35 35
36static inline struct rpc_inode * 36static inline struct rpc_inode *
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index f399c138f79d..97c761652581 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/timer.h> 12#include <linux/timer.h>
13#include <linux/sunrpc/types.h> 13#include <linux/sunrpc/types.h>
14#include <linux/rcupdate.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
15#include <linux/wait.h> 16#include <linux/wait.h>
16#include <linux/workqueue.h> 17#include <linux/workqueue.h>
@@ -85,6 +86,7 @@ struct rpc_task {
85 union { 86 union {
86 struct work_struct tk_work; /* Async task work queue */ 87 struct work_struct tk_work; /* Async task work queue */
87 struct rpc_wait tk_wait; /* RPC wait */ 88 struct rpc_wait tk_wait; /* RPC wait */
89 struct rcu_head tk_rcu; /* for task deletion */
88 } u; 90 } u;
89 91
90 unsigned short tk_timeouts; /* maj timeouts */ 92 unsigned short tk_timeouts; /* maj timeouts */
@@ -178,13 +180,6 @@ struct rpc_call_ops {
178 } while (0) 180 } while (0)
179 181
180#define RPC_IS_ACTIVATED(t) (test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)) 182#define RPC_IS_ACTIVATED(t) (test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate))
181#define rpc_set_active(t) (set_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate))
182#define rpc_clear_active(t) \
183 do { \
184 smp_mb__before_clear_bit(); \
185 clear_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate); \
186 smp_mb__after_clear_bit(); \
187 } while(0)
188 183
189/* 184/*
190 * Task priorities. 185 * Task priorities.
@@ -222,7 +217,7 @@ struct rpc_wait_queue {
222 217
223#ifndef RPC_DEBUG 218#ifndef RPC_DEBUG
224# define RPC_WAITQ_INIT(var,qname) { \ 219# define RPC_WAITQ_INIT(var,qname) { \
225 .lock = SPIN_LOCK_UNLOCKED, \ 220 .lock = __SPIN_LOCK_UNLOCKED(var.lock), \
226 .tasks = { \ 221 .tasks = { \
227 [0] = LIST_HEAD_INIT(var.tasks[0]), \ 222 [0] = LIST_HEAD_INIT(var.tasks[0]), \
228 [1] = LIST_HEAD_INIT(var.tasks[1]), \ 223 [1] = LIST_HEAD_INIT(var.tasks[1]), \
@@ -231,7 +226,7 @@ struct rpc_wait_queue {
231 } 226 }
232#else 227#else
233# define RPC_WAITQ_INIT(var,qname) { \ 228# define RPC_WAITQ_INIT(var,qname) { \
234 .lock = SPIN_LOCK_UNLOCKED, \ 229 .lock = __SPIN_LOCK_UNLOCKED(var.lock), \
235 .tasks = { \ 230 .tasks = { \
236 [0] = LIST_HEAD_INIT(var.tasks[0]), \ 231 [0] = LIST_HEAD_INIT(var.tasks[0]), \
237 [1] = LIST_HEAD_INIT(var.tasks[1]), \ 232 [1] = LIST_HEAD_INIT(var.tasks[1]), \
@@ -254,8 +249,10 @@ struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
254void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, 249void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
255 int flags, const struct rpc_call_ops *ops, 250 int flags, const struct rpc_call_ops *ops,
256 void *data); 251 void *data);
252void rpc_put_task(struct rpc_task *);
257void rpc_release_task(struct rpc_task *); 253void rpc_release_task(struct rpc_task *);
258void rpc_exit_task(struct rpc_task *); 254void rpc_exit_task(struct rpc_task *);
255void rpc_release_calldata(const struct rpc_call_ops *, void *);
259void rpc_killall_tasks(struct rpc_clnt *); 256void rpc_killall_tasks(struct rpc_clnt *);
260int rpc_execute(struct rpc_task *); 257int rpc_execute(struct rpc_task *);
261void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); 258void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index ac69e5511606..9e340fa23c06 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/uio.h> 12#include <linux/uio.h>
13#include <asm/byteorder.h> 13#include <asm/byteorder.h>
14#include <linux/scatterlist.h>
14 15
15/* 16/*
16 * Buffer adjustment 17 * Buffer adjustment
@@ -139,29 +140,30 @@ xdr_adjust_iovec(struct kvec *iov, __be32 *p)
139 */ 140 */
140extern void xdr_shift_buf(struct xdr_buf *, size_t); 141extern void xdr_shift_buf(struct xdr_buf *, size_t);
141extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *); 142extern void xdr_buf_from_iov(struct kvec *, struct xdr_buf *);
142extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, int, int); 143extern int xdr_buf_subsegment(struct xdr_buf *, struct xdr_buf *, unsigned int, unsigned int);
143extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, int); 144extern int xdr_buf_read_netobj(struct xdr_buf *, struct xdr_netobj *, unsigned int);
144extern int read_bytes_from_xdr_buf(struct xdr_buf *, int, void *, int); 145extern int read_bytes_from_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
145extern int write_bytes_to_xdr_buf(struct xdr_buf *, int, void *, int); 146extern int write_bytes_to_xdr_buf(struct xdr_buf *, unsigned int, void *, unsigned int);
146 147
147/* 148/*
148 * Helper structure for copying from an sk_buff. 149 * Helper structure for copying from an sk_buff.
149 */ 150 */
150typedef struct { 151struct xdr_skb_reader {
151 struct sk_buff *skb; 152 struct sk_buff *skb;
152 unsigned int offset; 153 unsigned int offset;
153 size_t count; 154 size_t count;
154 unsigned int csum; 155 __wsum csum;
155} skb_reader_t; 156};
156 157
157typedef size_t (*skb_read_actor_t)(skb_reader_t *desc, void *to, size_t len); 158typedef size_t (*xdr_skb_read_actor)(struct xdr_skb_reader *desc, void *to, size_t len);
158 159
160size_t xdr_skb_read_bits(struct xdr_skb_reader *desc, void *to, size_t len);
159extern int csum_partial_copy_to_xdr(struct xdr_buf *, struct sk_buff *); 161extern int csum_partial_copy_to_xdr(struct xdr_buf *, struct sk_buff *);
160extern ssize_t xdr_partial_copy_from_skb(struct xdr_buf *, unsigned int, 162extern ssize_t xdr_partial_copy_from_skb(struct xdr_buf *, unsigned int,
161 skb_reader_t *, skb_read_actor_t); 163 struct xdr_skb_reader *, xdr_skb_read_actor);
162 164
163extern int xdr_encode_word(struct xdr_buf *, int, u32); 165extern int xdr_encode_word(struct xdr_buf *, unsigned int, u32);
164extern int xdr_decode_word(struct xdr_buf *, int, u32 *); 166extern int xdr_decode_word(struct xdr_buf *, unsigned int, u32 *);
165 167
166struct xdr_array2_desc; 168struct xdr_array2_desc;
167typedef int (*xdr_xcode_elem_t)(struct xdr_array2_desc *desc, void *elem); 169typedef int (*xdr_xcode_elem_t)(struct xdr_array2_desc *desc, void *elem);
@@ -196,6 +198,7 @@ extern void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32
196extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes); 198extern __be32 *xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes);
197extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len); 199extern void xdr_read_pages(struct xdr_stream *xdr, unsigned int len);
198extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len); 200extern void xdr_enter_page(struct xdr_stream *xdr, unsigned int len);
201extern int xdr_process_buf(struct xdr_buf *buf, unsigned int offset, unsigned int len, int (*actor)(struct scatterlist *, void *), void *data);
199 202
200#endif /* __KERNEL__ */ 203#endif /* __KERNEL__ */
201 204
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 60394fbc4c70..f780e72fc417 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -106,7 +106,6 @@ struct rpc_rqst {
106 106
107struct rpc_xprt_ops { 107struct rpc_xprt_ops {
108 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); 108 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);
109 char * (*print_addr)(struct rpc_xprt *xprt, enum rpc_display_format_t format);
110 int (*reserve_xprt)(struct rpc_task *task); 109 int (*reserve_xprt)(struct rpc_task *task);
111 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 110 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
112 void (*rpcbind)(struct rpc_task *task); 111 void (*rpcbind)(struct rpc_task *task);
@@ -126,8 +125,6 @@ struct rpc_xprt_ops {
126struct rpc_xprt { 125struct rpc_xprt {
127 struct kref kref; /* Reference count */ 126 struct kref kref; /* Reference count */
128 struct rpc_xprt_ops * ops; /* transport methods */ 127 struct rpc_xprt_ops * ops; /* transport methods */
129 struct socket * sock; /* BSD socket layer */
130 struct sock * inet; /* INET layer */
131 128
132 struct rpc_timeout timeout; /* timeout parms */ 129 struct rpc_timeout timeout; /* timeout parms */
133 struct sockaddr_storage addr; /* server address */ 130 struct sockaddr_storage addr; /* server address */
@@ -137,9 +134,6 @@ struct rpc_xprt {
137 unsigned long cong; /* current congestion */ 134 unsigned long cong; /* current congestion */
138 unsigned long cwnd; /* congestion window */ 135 unsigned long cwnd; /* congestion window */
139 136
140 size_t rcvsize, /* transport rcv buffer size */
141 sndsize; /* transport send buffer size */
142
143 size_t max_payload; /* largest RPC payload size, 137 size_t max_payload; /* largest RPC payload size,
144 in bytes */ 138 in bytes */
145 unsigned int tsh_size; /* size of transport specific 139 unsigned int tsh_size; /* size of transport specific
@@ -158,27 +152,11 @@ struct rpc_xprt {
158 resvport : 1; /* use a reserved port */ 152 resvport : 1; /* use a reserved port */
159 153
160 /* 154 /*
161 * XID
162 */
163 __u32 xid; /* Next XID value to use */
164
165 /*
166 * State of TCP reply receive stuff
167 */
168 __be32 tcp_recm, /* Fragment header */
169 tcp_xid; /* Current XID */
170 u32 tcp_reclen, /* fragment length */
171 tcp_offset; /* fragment offset */
172 unsigned long tcp_copied, /* copied to request */
173 tcp_flags;
174 /*
175 * Connection of transports 155 * Connection of transports
176 */ 156 */
177 unsigned long connect_timeout, 157 unsigned long connect_timeout,
178 bind_timeout, 158 bind_timeout,
179 reestablish_timeout; 159 reestablish_timeout;
180 struct work_struct connect_worker;
181 unsigned short port;
182 160
183 /* 161 /*
184 * Disconnection of idle transports 162 * Disconnection of idle transports
@@ -193,8 +171,8 @@ struct rpc_xprt {
193 */ 171 */
194 spinlock_t transport_lock; /* lock transport info */ 172 spinlock_t transport_lock; /* lock transport info */
195 spinlock_t reserve_lock; /* lock slot table */ 173 spinlock_t reserve_lock; /* lock slot table */
174 u32 xid; /* Next XID value to use */
196 struct rpc_task * snd_task; /* Task blocked in send */ 175 struct rpc_task * snd_task; /* Task blocked in send */
197
198 struct list_head recv; 176 struct list_head recv;
199 177
200 struct { 178 struct {
@@ -210,18 +188,9 @@ struct rpc_xprt {
210 bklog_u; /* backlog queue utilization */ 188 bklog_u; /* backlog queue utilization */
211 } stat; 189 } stat;
212 190
213 void (*old_data_ready)(struct sock *, int);
214 void (*old_state_change)(struct sock *);
215 void (*old_write_space)(struct sock *);
216
217 char * address_strings[RPC_DISPLAY_MAX]; 191 char * address_strings[RPC_DISPLAY_MAX];
218}; 192};
219 193
220#define XPRT_LAST_FRAG (1 << 0)
221#define XPRT_COPY_RECM (1 << 1)
222#define XPRT_COPY_XID (1 << 2)
223#define XPRT_COPY_DATA (1 << 3)
224
225#ifdef __KERNEL__ 194#ifdef __KERNEL__
226 195
227/* 196/*
@@ -270,8 +239,8 @@ void xprt_disconnect(struct rpc_xprt *xprt);
270/* 239/*
271 * Socket transport setup operations 240 * Socket transport setup operations
272 */ 241 */
273int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to); 242struct rpc_xprt * xs_setup_udp(struct sockaddr *addr, size_t addrlen, struct rpc_timeout *to);
274int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to); 243struct rpc_xprt * xs_setup_tcp(struct sockaddr *addr, size_t addrlen, struct rpc_timeout *to);
275 244
276/* 245/*
277 * Reserved bit positions in xprt->state 246 * Reserved bit positions in xprt->state
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index b1237f16ecde..bf99bd49f8ef 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -9,10 +9,13 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/pm.h> 10#include <linux/pm.h>
11 11
12/* page backup entry */ 12/* struct pbe is used for creating lists of pages that should be restored
13 * atomically during the resume from disk, because the page frames they have
14 * occupied before the suspend are in use.
15 */
13struct pbe { 16struct pbe {
14 unsigned long address; /* address of the copy */ 17 void *address; /* address of the copy */
15 unsigned long orig_address; /* original address of page */ 18 void *orig_address; /* original address of a page */
16 struct pbe *next; 19 struct pbe *next;
17}; 20};
18 21
diff --git a/include/linux/swap.h b/include/linux/swap.h
index e7c36ba2a2db..add51cebc8d9 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -218,8 +218,6 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
218/* linux/mm/page_io.c */ 218/* linux/mm/page_io.c */
219extern int swap_readpage(struct file *, struct page *); 219extern int swap_readpage(struct file *, struct page *);
220extern int swap_writepage(struct page *page, struct writeback_control *wbc); 220extern int swap_writepage(struct page *page, struct writeback_control *wbc);
221extern int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page,
222 struct bio **bio_chain);
223extern int end_swap_bio_read(struct bio *bio, unsigned int bytes_done, int err); 221extern int end_swap_bio_read(struct bio *bio, unsigned int bytes_done, int err);
224 222
225/* linux/mm/swap_state.c */ 223/* linux/mm/swap_state.c */
@@ -247,9 +245,10 @@ extern int swap_duplicate(swp_entry_t);
247extern int valid_swaphandles(swp_entry_t, unsigned long *); 245extern int valid_swaphandles(swp_entry_t, unsigned long *);
248extern void swap_free(swp_entry_t); 246extern void swap_free(swp_entry_t);
249extern void free_swap_and_cache(swp_entry_t); 247extern void free_swap_and_cache(swp_entry_t);
250extern int swap_type_of(dev_t); 248extern int swap_type_of(dev_t, sector_t);
251extern unsigned int count_swap_pages(int, int); 249extern unsigned int count_swap_pages(int, int);
252extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); 250extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t);
251extern sector_t swapdev_block(int, pgoff_t);
253extern struct swap_info_struct *get_swap_info_struct(unsigned); 252extern struct swap_info_struct *get_swap_info_struct(unsigned);
254extern int can_share_swap_page(struct page *); 253extern int can_share_swap_page(struct page *);
255extern int remove_exclusive_swap_page(struct page *); 254extern int remove_exclusive_swap_page(struct page *);
@@ -259,7 +258,6 @@ extern spinlock_t swap_lock;
259 258
260/* linux/mm/thrash.c */ 259/* linux/mm/thrash.c */
261extern struct mm_struct * swap_token_mm; 260extern struct mm_struct * swap_token_mm;
262extern unsigned long swap_token_default_timeout;
263extern void grab_swap_token(void); 261extern void grab_swap_token(void);
264extern void __put_swap_token(struct mm_struct *); 262extern void __put_swap_token(struct mm_struct *);
265 263
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 1b24bd45e080..94316a98e0d0 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -6,10 +6,17 @@
6 **************************************************************** 6 ****************************************************************
7 **************************************************************** 7 ****************************************************************
8 ** 8 **
9 ** WARNING:
9 ** The values in this file are exported to user space via 10 ** The values in this file are exported to user space via
10 ** the sysctl() binary interface. However this interface 11 ** the sysctl() binary interface. Do *NOT* change the
11 ** is unstable and deprecated and will be removed in the future. 12 ** numbering of any existing values here, and do not change
12 ** For a stable interface use /proc/sys. 13 ** any numbers within any one set of values. If you have to
14 ** have to redefine an existing interface, use a new number for it.
15 ** The kernel will then return -ENOTDIR to any application using
16 ** the old binary interface.
17 **
18 ** For new interfaces unless you really need a binary number
19 ** please use CTL_UNNUMBERED.
13 ** 20 **
14 **************************************************************** 21 ****************************************************************
15 **************************************************************** 22 ****************************************************************
@@ -48,6 +55,7 @@ struct __sysctl_args {
48#ifdef __KERNEL__ 55#ifdef __KERNEL__
49#define CTL_ANY -1 /* Matches any name */ 56#define CTL_ANY -1 /* Matches any name */
50#define CTL_NONE 0 57#define CTL_NONE 0
58#define CTL_UNNUMBERED CTL_NONE /* sysctl without a binary number */
51#endif 59#endif
52 60
53enum 61enum
@@ -418,6 +426,8 @@ enum
418 NET_CIPSOV4_CACHE_BUCKET_SIZE=119, 426 NET_CIPSOV4_CACHE_BUCKET_SIZE=119,
419 NET_CIPSOV4_RBM_OPTFMT=120, 427 NET_CIPSOV4_RBM_OPTFMT=120,
420 NET_CIPSOV4_RBM_STRICTVALID=121, 428 NET_CIPSOV4_RBM_STRICTVALID=121,
429 NET_TCP_AVAIL_CONG_CONTROL=122,
430 NET_TCP_ALLOWED_CONG_CONTROL=123,
421}; 431};
422 432
423enum { 433enum {
@@ -596,16 +606,6 @@ enum {
596 NET_DCCP_DEFAULT=1, 606 NET_DCCP_DEFAULT=1,
597}; 607};
598 608
599/* /proc/sys/net/dccp/default */
600enum {
601 NET_DCCP_DEFAULT_SEQ_WINDOW = 1,
602 NET_DCCP_DEFAULT_RX_CCID = 2,
603 NET_DCCP_DEFAULT_TX_CCID = 3,
604 NET_DCCP_DEFAULT_ACK_RATIO = 4,
605 NET_DCCP_DEFAULT_SEND_ACKVEC = 5,
606 NET_DCCP_DEFAULT_SEND_NDP = 6,
607};
608
609/* /proc/sys/net/ipx */ 609/* /proc/sys/net/ipx */
610enum { 610enum {
611 NET_IPX_PPROP_BROADCASTING=1, 611 NET_IPX_PPROP_BROADCASTING=1,
@@ -961,8 +961,8 @@ extern ctl_handler sysctl_ms_jiffies;
961/* 961/*
962 * Register a set of sysctl names by calling register_sysctl_table 962 * Register a set of sysctl names by calling register_sysctl_table
963 * with an initialised array of ctl_table's. An entry with zero 963 * with an initialised array of ctl_table's. An entry with zero
964 * ctl_name terminates the table. table->de will be set up by the 964 * ctl_name and NULL procname terminates the table. table->de will be
965 * registration and need not be initialised in advance. 965 * set up by the registration and need not be initialised in advance.
966 * 966 *
967 * sysctl names can be mirrored automatically under /proc/sys. The 967 * sysctl names can be mirrored automatically under /proc/sys. The
968 * procname supplied controls /proc naming. 968 * procname supplied controls /proc naming.
@@ -973,7 +973,10 @@ extern ctl_handler sysctl_ms_jiffies;
973 * Leaf nodes in the sysctl tree will be represented by a single file 973 * Leaf nodes in the sysctl tree will be represented by a single file
974 * under /proc; non-leaf nodes will be represented by directories. A 974 * under /proc; non-leaf nodes will be represented by directories. A
975 * null procname disables /proc mirroring at this node. 975 * null procname disables /proc mirroring at this node.
976 * 976 *
977 * sysctl entries with a zero ctl_name will not be available through
978 * the binary sysctl interface.
979 *
977 * sysctl(2) can automatically manage read and write requests through 980 * sysctl(2) can automatically manage read and write requests through
978 * the sysctl table. The data and maxlen fields of the ctl_table 981 * the sysctl table. The data and maxlen fields of the ctl_table
979 * struct enable minimal validation of the values being written to be 982 * struct enable minimal validation of the values being written to be
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 6d5c43d31dec..2129d1b6c874 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -97,6 +97,9 @@ extern int __must_check
97sysfs_rename_dir(struct kobject *, const char *new_name); 97sysfs_rename_dir(struct kobject *, const char *new_name);
98 98
99extern int __must_check 99extern int __must_check
100sysfs_move_dir(struct kobject *, struct kobject *);
101
102extern int __must_check
100sysfs_create_file(struct kobject *, const struct attribute *); 103sysfs_create_file(struct kobject *, const struct attribute *);
101 104
102extern int __must_check 105extern int __must_check
@@ -142,6 +145,11 @@ static inline int sysfs_rename_dir(struct kobject * k, const char *new_name)
142 return 0; 145 return 0;
143} 146}
144 147
148static inline int sysfs_move_dir(struct kobject * k, struct kobject * new_parent)
149{
150 return 0;
151}
152
145static inline int sysfs_create_file(struct kobject * k, const struct attribute * a) 153static inline int sysfs_create_file(struct kobject * k, const struct attribute * a)
146{ 154{
147 return 0; 155 return 0;
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
index 6562a2050a25..7e9680f4afdd 100644
--- a/include/linux/taskstats_kern.h
+++ b/include/linux/taskstats_kern.h
@@ -12,64 +12,27 @@
12#include <net/genetlink.h> 12#include <net/genetlink.h>
13 13
14#ifdef CONFIG_TASKSTATS 14#ifdef CONFIG_TASKSTATS
15extern kmem_cache_t *taskstats_cache; 15extern struct kmem_cache *taskstats_cache;
16extern struct mutex taskstats_exit_mutex; 16extern struct mutex taskstats_exit_mutex;
17 17
18static inline void taskstats_exit_free(struct taskstats *tidstats)
19{
20 if (tidstats)
21 kmem_cache_free(taskstats_cache, tidstats);
22}
23
24static inline void taskstats_tgid_init(struct signal_struct *sig) 18static inline void taskstats_tgid_init(struct signal_struct *sig)
25{ 19{
26 sig->stats = NULL; 20 sig->stats = NULL;
27} 21}
28 22
29static inline void taskstats_tgid_alloc(struct task_struct *tsk)
30{
31 struct signal_struct *sig = tsk->signal;
32 struct taskstats *stats;
33
34 if (sig->stats != NULL)
35 return;
36
37 /* No problem if kmem_cache_zalloc() fails */
38 stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
39
40 spin_lock_irq(&tsk->sighand->siglock);
41 if (!sig->stats) {
42 sig->stats = stats;
43 stats = NULL;
44 }
45 spin_unlock_irq(&tsk->sighand->siglock);
46
47 if (stats)
48 kmem_cache_free(taskstats_cache, stats);
49}
50
51static inline void taskstats_tgid_free(struct signal_struct *sig) 23static inline void taskstats_tgid_free(struct signal_struct *sig)
52{ 24{
53 if (sig->stats) 25 if (sig->stats)
54 kmem_cache_free(taskstats_cache, sig->stats); 26 kmem_cache_free(taskstats_cache, sig->stats);
55} 27}
56 28
57extern void taskstats_exit_alloc(struct taskstats **, unsigned int *); 29extern void taskstats_exit(struct task_struct *, int group_dead);
58extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int, unsigned int);
59extern void taskstats_init_early(void); 30extern void taskstats_init_early(void);
60#else 31#else
61static inline void taskstats_exit_alloc(struct taskstats **ptidstats, unsigned int *mycpu) 32static inline void taskstats_exit(struct task_struct *tsk, int group_dead)
62{}
63static inline void taskstats_exit_free(struct taskstats *ptidstats)
64{}
65static inline void taskstats_exit_send(struct task_struct *tsk,
66 struct taskstats *tidstats,
67 int group_dead, unsigned int cpu)
68{} 33{}
69static inline void taskstats_tgid_init(struct signal_struct *sig) 34static inline void taskstats_tgid_init(struct signal_struct *sig)
70{} 35{}
71static inline void taskstats_tgid_alloc(struct task_struct *tsk)
72{}
73static inline void taskstats_tgid_free(struct signal_struct *sig) 36static inline void taskstats_tgid_free(struct signal_struct *sig)
74{} 37{}
75static inline void taskstats_init_early(void) 38static inline void taskstats_init_early(void)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 2d36f6db3706..3cc70d1a3504 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <asm/byteorder.h> 21#include <asm/byteorder.h>
22#include <linux/socket.h>
22 23
23struct tcphdr { 24struct tcphdr {
24 __be16 source; 25 __be16 source;
@@ -51,7 +52,7 @@ struct tcphdr {
51#error "Adjust your <asm/byteorder.h> defines" 52#error "Adjust your <asm/byteorder.h> defines"
52#endif 53#endif
53 __be16 window; 54 __be16 window;
54 __be16 check; 55 __sum16 check;
55 __be16 urg_ptr; 56 __be16 urg_ptr;
56}; 57};
57 58
@@ -94,6 +95,7 @@ enum {
94#define TCP_INFO 11 /* Information about this connection. */ 95#define TCP_INFO 11 /* Information about this connection. */
95#define TCP_QUICKACK 12 /* Block/reenable quick acks */ 96#define TCP_QUICKACK 12 /* Block/reenable quick acks */
96#define TCP_CONGESTION 13 /* Congestion control algorithm */ 97#define TCP_CONGESTION 13 /* Congestion control algorithm */
98#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
97 99
98#define TCPI_OPT_TIMESTAMPS 1 100#define TCPI_OPT_TIMESTAMPS 1
99#define TCPI_OPT_SACK 2 101#define TCPI_OPT_SACK 2
@@ -157,6 +159,17 @@ struct tcp_info
157 __u32 tcpi_total_retrans; 159 __u32 tcpi_total_retrans;
158}; 160};
159 161
162/* for TCP_MD5SIG socket option */
163#define TCP_MD5SIG_MAXKEYLEN 80
164
165struct tcp_md5sig {
166 struct __kernel_sockaddr_storage tcpm_addr; /* address associated */
167 __u16 __tcpm_pad1; /* zero */
168 __u16 tcpm_keylen; /* key length */
169 __u32 __tcpm_pad2; /* zero */
170 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */
171};
172
160#ifdef __KERNEL__ 173#ifdef __KERNEL__
161 174
162#include <linux/skbuff.h> 175#include <linux/skbuff.h>
@@ -172,17 +185,17 @@ struct tcp_sack_block_wire {
172}; 185};
173 186
174struct tcp_sack_block { 187struct tcp_sack_block {
175 __u32 start_seq; 188 u32 start_seq;
176 __u32 end_seq; 189 u32 end_seq;
177}; 190};
178 191
179struct tcp_options_received { 192struct tcp_options_received {
180/* PAWS/RTTM data */ 193/* PAWS/RTTM data */
181 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */ 194 long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
182 __u32 ts_recent; /* Time stamp to echo next */ 195 u32 ts_recent; /* Time stamp to echo next */
183 __u32 rcv_tsval; /* Time stamp value */ 196 u32 rcv_tsval; /* Time stamp value */
184 __u32 rcv_tsecr; /* Time stamp echo reply */ 197 u32 rcv_tsecr; /* Time stamp echo reply */
185 __u16 saw_tstamp : 1, /* Saw TIMESTAMP on last packet */ 198 u16 saw_tstamp : 1, /* Saw TIMESTAMP on last packet */
186 tstamp_ok : 1, /* TIMESTAMP seen on SYN packet */ 199 tstamp_ok : 1, /* TIMESTAMP seen on SYN packet */
187 dsack : 1, /* D-SACK is scheduled */ 200 dsack : 1, /* D-SACK is scheduled */
188 wscale_ok : 1, /* Wscale seen on SYN packet */ 201 wscale_ok : 1, /* Wscale seen on SYN packet */
@@ -190,16 +203,20 @@ struct tcp_options_received {
190 snd_wscale : 4, /* Window scaling received from sender */ 203 snd_wscale : 4, /* Window scaling received from sender */
191 rcv_wscale : 4; /* Window scaling to send to receiver */ 204 rcv_wscale : 4; /* Window scaling to send to receiver */
192/* SACKs data */ 205/* SACKs data */
193 __u8 eff_sacks; /* Size of SACK array to send with next packet */ 206 u8 eff_sacks; /* Size of SACK array to send with next packet */
194 __u8 num_sacks; /* Number of SACK blocks */ 207 u8 num_sacks; /* Number of SACK blocks */
195 __u16 user_mss; /* mss requested by user in ioctl */ 208 u16 user_mss; /* mss requested by user in ioctl */
196 __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ 209 u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
197}; 210};
198 211
199struct tcp_request_sock { 212struct tcp_request_sock {
200 struct inet_request_sock req; 213 struct inet_request_sock req;
201 __u32 rcv_isn; 214#ifdef CONFIG_TCP_MD5SIG
202 __u32 snt_isn; 215 /* Only used by TCP MD5 Signature so far. */
216 struct tcp_request_sock_ops *af_specific;
217#endif
218 u32 rcv_isn;
219 u32 snt_isn;
203}; 220};
204 221
205static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) 222static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
@@ -210,7 +227,8 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
210struct tcp_sock { 227struct tcp_sock {
211 /* inet_connection_sock has to be the first member of tcp_sock */ 228 /* inet_connection_sock has to be the first member of tcp_sock */
212 struct inet_connection_sock inet_conn; 229 struct inet_connection_sock inet_conn;
213 int tcp_header_len; /* Bytes of tcp header to send */ 230 u16 tcp_header_len; /* Bytes of tcp header to send */
231 u16 xmit_size_goal; /* Goal for segmenting output packets */
214 232
215/* 233/*
216 * Header prediction flags 234 * Header prediction flags
@@ -223,13 +241,13 @@ struct tcp_sock {
223 * read the code and the spec side by side (and laugh ...) 241 * read the code and the spec side by side (and laugh ...)
224 * See RFC793 and RFC1122. The RFC writes these in capitals. 242 * See RFC793 and RFC1122. The RFC writes these in capitals.
225 */ 243 */
226 __u32 rcv_nxt; /* What we want to receive next */ 244 u32 rcv_nxt; /* What we want to receive next */
227 __u32 snd_nxt; /* Next sequence we send */ 245 u32 snd_nxt; /* Next sequence we send */
228 246
229 __u32 snd_una; /* First byte we want an ack for */ 247 u32 snd_una; /* First byte we want an ack for */
230 __u32 snd_sml; /* Last byte of the most recently transmitted small packet */ 248 u32 snd_sml; /* Last byte of the most recently transmitted small packet */
231 __u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ 249 u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
232 __u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ 250 u32 lsndtime; /* timestamp of last sent data packet (for restart window) */
233 251
234 /* Data for direct copy to user */ 252 /* Data for direct copy to user */
235 struct { 253 struct {
@@ -247,32 +265,30 @@ struct tcp_sock {
247#endif 265#endif
248 } ucopy; 266 } ucopy;
249 267
250 __u32 snd_wl1; /* Sequence for window update */ 268 u32 snd_wl1; /* Sequence for window update */
251 __u32 snd_wnd; /* The window we expect to receive */ 269 u32 snd_wnd; /* The window we expect to receive */
252 __u32 max_window; /* Maximal window ever seen from peer */ 270 u32 max_window; /* Maximal window ever seen from peer */
253 __u32 mss_cache; /* Cached effective mss, not including SACKS */ 271 u32 mss_cache; /* Cached effective mss, not including SACKS */
254 __u16 xmit_size_goal; /* Goal for segmenting output packets */
255 /* XXX Two bytes hole, try to pack */
256 272
257 __u32 window_clamp; /* Maximal window to advertise */ 273 u32 window_clamp; /* Maximal window to advertise */
258 __u32 rcv_ssthresh; /* Current window clamp */ 274 u32 rcv_ssthresh; /* Current window clamp */
259 275
260 __u32 frto_highmark; /* snd_nxt when RTO occurred */ 276 u32 frto_highmark; /* snd_nxt when RTO occurred */
261 __u8 reordering; /* Packet reordering metric. */ 277 u8 reordering; /* Packet reordering metric. */
262 __u8 frto_counter; /* Number of new acks after RTO */ 278 u8 frto_counter; /* Number of new acks after RTO */
263 __u8 nonagle; /* Disable Nagle algorithm? */ 279 u8 nonagle; /* Disable Nagle algorithm? */
264 __u8 keepalive_probes; /* num of allowed keep alive probes */ 280 u8 keepalive_probes; /* num of allowed keep alive probes */
265 281
266/* RTT measurement */ 282/* RTT measurement */
267 __u32 srtt; /* smoothed round trip time << 3 */ 283 u32 srtt; /* smoothed round trip time << 3 */
268 __u32 mdev; /* medium deviation */ 284 u32 mdev; /* medium deviation */
269 __u32 mdev_max; /* maximal mdev for the last rtt period */ 285 u32 mdev_max; /* maximal mdev for the last rtt period */
270 __u32 rttvar; /* smoothed mdev_max */ 286 u32 rttvar; /* smoothed mdev_max */
271 __u32 rtt_seq; /* sequence number to update rttvar */ 287 u32 rtt_seq; /* sequence number to update rttvar */
272 288
273 __u32 packets_out; /* Packets which are "in flight" */ 289 u32 packets_out; /* Packets which are "in flight" */
274 __u32 left_out; /* Packets which leaved network */ 290 u32 left_out; /* Packets which leaved network */
275 __u32 retrans_out; /* Retransmitted packets out */ 291 u32 retrans_out; /* Retransmitted packets out */
276/* 292/*
277 * Options received (usually on last packet, some only on SYN packets). 293 * Options received (usually on last packet, some only on SYN packets).
278 */ 294 */
@@ -281,20 +297,20 @@ struct tcp_sock {
281/* 297/*
282 * Slow start and congestion control (see also Nagle, and Karn & Partridge) 298 * Slow start and congestion control (see also Nagle, and Karn & Partridge)
283 */ 299 */
284 __u32 snd_ssthresh; /* Slow start size threshold */ 300 u32 snd_ssthresh; /* Slow start size threshold */
285 __u32 snd_cwnd; /* Sending congestion window */ 301 u32 snd_cwnd; /* Sending congestion window */
286 __u16 snd_cwnd_cnt; /* Linear increase counter */ 302 u16 snd_cwnd_cnt; /* Linear increase counter */
287 __u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ 303 u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
288 __u32 snd_cwnd_used; 304 u32 snd_cwnd_used;
289 __u32 snd_cwnd_stamp; 305 u32 snd_cwnd_stamp;
290 306
291 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 307 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
292 308
293 __u32 rcv_wnd; /* Current receiver window */ 309 u32 rcv_wnd; /* Current receiver window */
294 __u32 rcv_wup; /* rcv_nxt on last window update sent */ 310 u32 rcv_wup; /* rcv_nxt on last window update sent */
295 __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 311 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
296 __u32 pushed_seq; /* Last pushed seq, required to talk to windows */ 312 u32 pushed_seq; /* Last pushed seq, required to talk to windows */
297 __u32 copied_seq; /* Head of yet unread data */ 313 u32 copied_seq; /* Head of yet unread data */
298 314
299/* SACKs data */ 315/* SACKs data */
300 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 316 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
@@ -315,26 +331,26 @@ struct tcp_sock {
315 int retransmit_cnt_hint; 331 int retransmit_cnt_hint;
316 int forward_cnt_hint; 332 int forward_cnt_hint;
317 333
318 __u16 advmss; /* Advertised MSS */ 334 u16 advmss; /* Advertised MSS */
319 __u16 prior_ssthresh; /* ssthresh saved at recovery start */ 335 u16 prior_ssthresh; /* ssthresh saved at recovery start */
320 __u32 lost_out; /* Lost packets */ 336 u32 lost_out; /* Lost packets */
321 __u32 sacked_out; /* SACK'd packets */ 337 u32 sacked_out; /* SACK'd packets */
322 __u32 fackets_out; /* FACK'd packets */ 338 u32 fackets_out; /* FACK'd packets */
323 __u32 high_seq; /* snd_nxt at onset of congestion */ 339 u32 high_seq; /* snd_nxt at onset of congestion */
324 340
325 __u32 retrans_stamp; /* Timestamp of the last retransmit, 341 u32 retrans_stamp; /* Timestamp of the last retransmit,
326 * also used in SYN-SENT to remember stamp of 342 * also used in SYN-SENT to remember stamp of
327 * the first SYN. */ 343 * the first SYN. */
328 __u32 undo_marker; /* tracking retrans started here. */ 344 u32 undo_marker; /* tracking retrans started here. */
329 int undo_retrans; /* number of undoable retransmissions. */ 345 int undo_retrans; /* number of undoable retransmissions. */
330 __u32 urg_seq; /* Seq of received urgent pointer */ 346 u32 urg_seq; /* Seq of received urgent pointer */
331 __u16 urg_data; /* Saved octet of OOB data and control flags */ 347 u16 urg_data; /* Saved octet of OOB data and control flags */
332 __u8 urg_mode; /* In urgent mode */ 348 u8 urg_mode; /* In urgent mode */
333 __u8 ecn_flags; /* ECN status bits. */ 349 u8 ecn_flags; /* ECN status bits. */
334 __u32 snd_up; /* Urgent pointer */ 350 u32 snd_up; /* Urgent pointer */
335 351
336 __u32 total_retrans; /* Total retransmits for entire connection */ 352 u32 total_retrans; /* Total retransmits for entire connection */
337 __u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */ 353 u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */
338 354
339 unsigned int keepalive_time; /* time before keep alive takes place */ 355 unsigned int keepalive_time; /* time before keep alive takes place */
340 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 356 unsigned int keepalive_intvl; /* time interval between keep alive probes */
@@ -342,27 +358,35 @@ struct tcp_sock {
342 358
343 unsigned long last_synq_overflow; 359 unsigned long last_synq_overflow;
344 360
345 __u32 tso_deferred; 361 u32 tso_deferred;
346 362
347/* Receiver side RTT estimation */ 363/* Receiver side RTT estimation */
348 struct { 364 struct {
349 __u32 rtt; 365 u32 rtt;
350 __u32 seq; 366 u32 seq;
351 __u32 time; 367 u32 time;
352 } rcv_rtt_est; 368 } rcv_rtt_est;
353 369
354/* Receiver queue space */ 370/* Receiver queue space */
355 struct { 371 struct {
356 int space; 372 int space;
357 __u32 seq; 373 u32 seq;
358 __u32 time; 374 u32 time;
359 } rcvq_space; 375 } rcvq_space;
360 376
361/* TCP-specific MTU probe information. */ 377/* TCP-specific MTU probe information. */
362 struct { 378 struct {
363 __u32 probe_seq_start; 379 u32 probe_seq_start;
364 __u32 probe_seq_end; 380 u32 probe_seq_end;
365 } mtu_probe; 381 } mtu_probe;
382
383#ifdef CONFIG_TCP_MD5SIG
384/* TCP AF-Specific parts; only used by MD5 Signature support so far */
385 struct tcp_sock_af_ops *af_specific;
386
387/* TCP MD5 Signagure Option information */
388 struct tcp_md5sig_info *md5sig_info;
389#endif
366}; 390};
367 391
368static inline struct tcp_sock *tcp_sk(const struct sock *sk) 392static inline struct tcp_sock *tcp_sk(const struct sock *sk)
@@ -372,11 +396,15 @@ static inline struct tcp_sock *tcp_sk(const struct sock *sk)
372 396
373struct tcp_timewait_sock { 397struct tcp_timewait_sock {
374 struct inet_timewait_sock tw_sk; 398 struct inet_timewait_sock tw_sk;
375 __u32 tw_rcv_nxt; 399 u32 tw_rcv_nxt;
376 __u32 tw_snd_nxt; 400 u32 tw_snd_nxt;
377 __u32 tw_rcv_wnd; 401 u32 tw_rcv_wnd;
378 __u32 tw_ts_recent; 402 u32 tw_ts_recent;
379 long tw_ts_recent_stamp; 403 long tw_ts_recent_stamp;
404#ifdef CONFIG_TCP_MD5SIG
405 u16 tw_md5_keylen;
406 u8 tw_md5_key[TCP_MD5SIG_MAXKEYLEN];
407#endif
380}; 408};
381 409
382static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) 410static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h
index 7dac8f04d28e..004808a6df1d 100644
--- a/include/linux/textsearch.h
+++ b/include/linux/textsearch.h
@@ -20,7 +20,7 @@ struct ts_config;
20/** 20/**
21 * struct ts_state - search state 21 * struct ts_state - search state
22 * @offset: offset for next match 22 * @offset: offset for next match
23 * @cb: control buffer, for persistant variables of get_next_block() 23 * @cb: control buffer, for persistent variables of get_next_block()
24 */ 24 */
25struct ts_state 25struct ts_state
26{ 26{
@@ -71,7 +71,7 @@ struct ts_config
71 * Called repeatedly until 0 is returned. Must assign the 71 * Called repeatedly until 0 is returned. Must assign the
72 * head of the next block of data to &*dst and return the length 72 * head of the next block of data to &*dst and return the length
73 * of the block or 0 if at the end. consumed == 0 indicates 73 * of the block or 0 if at the end. consumed == 0 indicates
74 * a new search. May store/read persistant values in state->cb. 74 * a new search. May store/read persistent values in state->cb.
75 */ 75 */
76 unsigned int (*get_next_block)(unsigned int consumed, 76 unsigned int (*get_next_block)(unsigned int consumed,
77 const u8 **dst, 77 const u8 **dst,
diff --git a/include/linux/tfrc.h b/include/linux/tfrc.h
index 7dab7831c3cb..31a9b25276fe 100644
--- a/include/linux/tfrc.h
+++ b/include/linux/tfrc.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_TFRC_H_ 1#ifndef _LINUX_TFRC_H_
2#define _LINUX_TFRC_H_ 2#define _LINUX_TFRC_H_
3/* 3/*
4 * include/linux/tfrc.h 4 * TFRC - Data Structures for the TCP-Friendly Rate Control congestion
5 * control mechanism as specified in RFC 3448.
5 * 6 *
6 * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand. 7 * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand.
7 * Copyright (c) 2005 Ian McDonald <iam4@cs.waikato.ac.nz> 8 * Copyright (c) 2005 Ian McDonald <iam4@cs.waikato.ac.nz>
@@ -13,15 +14,30 @@
13 * the Free Software Foundation; either version 2 of the License, or 14 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version. 15 * (at your option) any later version.
15 */ 16 */
16
17#include <linux/types.h> 17#include <linux/types.h>
18 18
19/** tfrc_rx_info - TFRC Receiver Data Structure
20 *
21 * @tfrcrx_x_recv: receiver estimate of sending rate (3.2.2)
22 * @tfrcrx_rtt: round-trip-time (communicated by sender)
23 * @tfrcrx_p: current estimate of loss event rate (3.2.2)
24 */
19struct tfrc_rx_info { 25struct tfrc_rx_info {
20 __u32 tfrcrx_x_recv; 26 __u32 tfrcrx_x_recv;
21 __u32 tfrcrx_rtt; 27 __u32 tfrcrx_rtt;
22 __u32 tfrcrx_p; 28 __u32 tfrcrx_p;
23}; 29};
24 30
31/** tfrc_tx_info - TFRC Sender Data Structure
32 *
33 * @tfrctx_x: computed transmit rate (4.3 (4))
34 * @tfrctx_x_recv: receiver estimate of send rate (4.3)
35 * @tfrctx_x_calc: return value of throughput equation (3.1)
36 * @tfrctx_rtt: (moving average) estimate of RTT (4.3)
37 * @tfrctx_p: current loss event rate (5.4)
38 * @tfrctx_rto: estimate of RTO, equals 4*RTT (4.3)
39 * @tfrctx_ipi: inter-packet interval (4.6)
40 */
25struct tfrc_tx_info { 41struct tfrc_tx_info {
26 __u32 tfrctx_x; 42 __u32 tfrctx_x;
27 __u32 tfrctx_x_recv; 43 __u32 tfrctx_x_recv;
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 33a653913d94..b0c916d1f375 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -194,34 +194,34 @@
194 194
195 195
196struct tipc_node_info { 196struct tipc_node_info {
197 __u32 addr; /* network address of node */ 197 __be32 addr; /* network address of node */
198 __u32 up; /* 0=down, 1= up */ 198 __be32 up; /* 0=down, 1= up */
199}; 199};
200 200
201struct tipc_link_info { 201struct tipc_link_info {
202 __u32 dest; /* network address of peer node */ 202 __be32 dest; /* network address of peer node */
203 __u32 up; /* 0=down, 1=up */ 203 __be32 up; /* 0=down, 1=up */
204 char str[TIPC_MAX_LINK_NAME]; /* link name */ 204 char str[TIPC_MAX_LINK_NAME]; /* link name */
205}; 205};
206 206
207struct tipc_bearer_config { 207struct tipc_bearer_config {
208 __u32 priority; /* Range [1,31]. Override per link */ 208 __be32 priority; /* Range [1,31]. Override per link */
209 __u32 detect_scope; 209 __be32 detect_scope;
210 char name[TIPC_MAX_BEARER_NAME]; 210 char name[TIPC_MAX_BEARER_NAME];
211}; 211};
212 212
213struct tipc_link_config { 213struct tipc_link_config {
214 __u32 value; 214 __be32 value;
215 char name[TIPC_MAX_LINK_NAME]; 215 char name[TIPC_MAX_LINK_NAME];
216}; 216};
217 217
218#define TIPC_NTQ_ALLTYPES 0x80000000 218#define TIPC_NTQ_ALLTYPES 0x80000000
219 219
220struct tipc_name_table_query { 220struct tipc_name_table_query {
221 __u32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */ 221 __be32 depth; /* 1:type, 2:+name info, 3:+port info, 4+:+debug info */
222 __u32 type; /* {t,l,u} info ignored if high bit of "depth" is set */ 222 __be32 type; /* {t,l,u} info ignored if high bit of "depth" is set */
223 __u32 lowbound; /* (i.e. displays all entries of name table) */ 223 __be32 lowbound; /* (i.e. displays all entries of name table) */
224 __u32 upbound; 224 __be32 upbound;
225}; 225};
226 226
227/* 227/*
@@ -262,8 +262,8 @@ struct tipc_route_info {
262 */ 262 */
263 263
264struct tlv_desc { 264struct tlv_desc {
265 __u16 tlv_len; /* TLV length (descriptor + value) */ 265 __be16 tlv_len; /* TLV length (descriptor + value) */
266 __u16 tlv_type; /* TLV identifier */ 266 __be16 tlv_type; /* TLV identifier */
267}; 267};
268 268
269#define TLV_ALIGNTO 4 269#define TLV_ALIGNTO 4
@@ -377,9 +377,9 @@ struct tipc_genlmsghdr {
377 377
378struct tipc_cfg_msg_hdr 378struct tipc_cfg_msg_hdr
379{ 379{
380 __u32 tcm_len; /* Message length (including header) */ 380 __be32 tcm_len; /* Message length (including header) */
381 __u16 tcm_type; /* Command type */ 381 __be16 tcm_type; /* Command type */
382 __u16 tcm_flags; /* Additional flags */ 382 __be16 tcm_flags; /* Additional flags */
383 char tcm_reserved[8]; /* Unused */ 383 char tcm_reserved[8]; /* Unused */
384}; 384};
385 385
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 44091c0db0b4..f717f0898238 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -53,7 +53,7 @@ struct tty_buffer {
53}; 53};
54 54
55struct tty_bufhead { 55struct tty_bufhead {
56 struct work_struct work; 56 struct delayed_work work;
57 struct semaphore pty_sem; 57 struct semaphore pty_sem;
58 spinlock_t lock; 58 spinlock_t lock;
59 struct tty_buffer *head; /* Queue head */ 59 struct tty_buffer *head; /* Queue head */
@@ -276,9 +276,8 @@ extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
276extern int tty_unregister_ldisc(int disc); 276extern int tty_unregister_ldisc(int disc);
277extern int tty_register_driver(struct tty_driver *driver); 277extern int tty_register_driver(struct tty_driver *driver);
278extern int tty_unregister_driver(struct tty_driver *driver); 278extern int tty_unregister_driver(struct tty_driver *driver);
279extern struct class_device *tty_register_device(struct tty_driver *driver, 279extern struct device *tty_register_device(struct tty_driver *driver,
280 unsigned index, 280 unsigned index, struct device *dev);
281 struct device *dev);
282extern void tty_unregister_device(struct tty_driver *driver, unsigned index); 281extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
283extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, 282extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
284 int buflen); 283 int buflen);
diff --git a/include/linux/types.h b/include/linux/types.h
index 750f085fa564..0351bf2fac85 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -128,21 +128,27 @@ typedef __s64 int64_t;
128 128
129/* this is a special 64bit data type that is 8-byte aligned */ 129/* this is a special 64bit data type that is 8-byte aligned */
130#define aligned_u64 unsigned long long __attribute__((aligned(8))) 130#define aligned_u64 unsigned long long __attribute__((aligned(8)))
131#define aligned_be64 __be64 __attribute__((aligned(8)))
132#define aligned_le64 __le64 __attribute__((aligned(8)))
131 133
132/** 134/**
133 * The type used for indexing onto a disc or disc partition. 135 * The type used for indexing onto a disc or disc partition.
134 * 136 *
135 * Linux always considers sectors to be 512 bytes long independently 137 * Linux always considers sectors to be 512 bytes long independently
136 * of the devices real block size. 138 * of the devices real block size.
137 *
138 * If required, asm/types.h can override it and define
139 * HAVE_SECTOR_T
140 */ 139 */
141#ifndef HAVE_SECTOR_T 140#ifdef CONFIG_LBD
141typedef u64 sector_t;
142#else
142typedef unsigned long sector_t; 143typedef unsigned long sector_t;
143#endif 144#endif
144 145
145#ifndef HAVE_BLKCNT_T 146/*
147 * The type of the inode's block count.
148 */
149#ifdef CONFIG_LSF
150typedef u64 blkcnt_t;
151#else
146typedef unsigned long blkcnt_t; 152typedef unsigned long blkcnt_t;
147#endif 153#endif
148 154
@@ -180,6 +186,8 @@ typedef __u32 __bitwise __be32;
180typedef __u64 __bitwise __le64; 186typedef __u64 __bitwise __le64;
181typedef __u64 __bitwise __be64; 187typedef __u64 __bitwise __be64;
182#endif 188#endif
189typedef __u16 __bitwise __sum16;
190typedef __u32 __bitwise __wsum;
183 191
184#ifdef __KERNEL__ 192#ifdef __KERNEL__
185typedef unsigned __bitwise__ gfp_t; 193typedef unsigned __bitwise__ gfp_t;
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index a48d7f11c7be..975c963e5789 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -1,8 +1,43 @@
1#ifndef __LINUX_UACCESS_H__ 1#ifndef __LINUX_UACCESS_H__
2#define __LINUX_UACCESS_H__ 2#define __LINUX_UACCESS_H__
3 3
4#include <linux/preempt.h>
4#include <asm/uaccess.h> 5#include <asm/uaccess.h>
5 6
7/*
8 * These routines enable/disable the pagefault handler in that
9 * it will not take any locks and go straight to the fixup table.
10 *
11 * They have great resemblance to the preempt_disable/enable calls
12 * and in fact they are identical; this is because currently there is
13 * no other way to make the pagefault handlers do this. So we do
14 * disable preemption but we don't necessarily care about that.
15 */
16static inline void pagefault_disable(void)
17{
18 inc_preempt_count();
19 /*
20 * make sure to have issued the store before a pagefault
21 * can hit.
22 */
23 barrier();
24}
25
26static inline void pagefault_enable(void)
27{
28 /*
29 * make sure to issue those last loads/stores before enabling
30 * the pagefault handler again.
31 */
32 barrier();
33 dec_preempt_count();
34 /*
35 * make sure we do..
36 */
37 barrier();
38 preempt_check_resched();
39}
40
6#ifndef ARCH_HAS_NOCACHE_UACCESS 41#ifndef ARCH_HAS_NOCACHE_UACCESS
7 42
8static inline unsigned long __copy_from_user_inatomic_nocache(void *to, 43static inline unsigned long __copy_from_user_inatomic_nocache(void *to,
@@ -30,14 +65,22 @@ static inline unsigned long __copy_from_user_nocache(void *to,
30 * do_page_fault() doesn't attempt to take mmap_sem. This makes 65 * do_page_fault() doesn't attempt to take mmap_sem. This makes
31 * probe_kernel_address() suitable for use within regions where the caller 66 * probe_kernel_address() suitable for use within regions where the caller
32 * already holds mmap_sem, or other locks which nest inside mmap_sem. 67 * already holds mmap_sem, or other locks which nest inside mmap_sem.
68 * This must be a macro because __get_user() needs to know the types of the
69 * args.
70 *
71 * We don't include enough header files to be able to do the set_fs(). We
72 * require that the probe_kernel_address() caller will do that.
33 */ 73 */
34#define probe_kernel_address(addr, retval) \ 74#define probe_kernel_address(addr, retval) \
35 ({ \ 75 ({ \
36 long ret; \ 76 long ret; \
77 mm_segment_t old_fs = get_fs(); \
37 \ 78 \
38 inc_preempt_count(); \ 79 set_fs(KERNEL_DS); \
39 ret = __get_user(retval, addr); \ 80 pagefault_disable(); \
40 dec_preempt_count(); \ 81 ret = __get_user(retval, (__force typeof(retval) __user *)(addr)); \
82 pagefault_enable(); \
83 set_fs(old_fs); \
41 ret; \ 84 ret; \
42 }) 85 })
43 86
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 014b41d1e308..7e08c07efe0f 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -23,7 +23,7 @@ struct udphdr {
23 __be16 source; 23 __be16 source;
24 __be16 dest; 24 __be16 dest;
25 __be16 len; 25 __be16 len;
26 __be16 check; 26 __sum16 check;
27}; 27};
28 28
29/* UDP socket options */ 29/* UDP socket options */
@@ -38,6 +38,7 @@ struct udphdr {
38#include <linux/types.h> 38#include <linux/types.h>
39 39
40#include <net/inet_sock.h> 40#include <net/inet_sock.h>
41#define UDP_HTABLE_SIZE 128
41 42
42struct udp_sock { 43struct udp_sock {
43 /* inet_sock has to be the first member */ 44 /* inet_sock has to be the first member */
@@ -50,12 +51,23 @@ struct udp_sock {
50 * when the socket is uncorked. 51 * when the socket is uncorked.
51 */ 52 */
52 __u16 len; /* total length of pending frames */ 53 __u16 len; /* total length of pending frames */
54 /*
55 * Fields specific to UDP-Lite.
56 */
57 __u16 pcslen;
58 __u16 pcrlen;
59/* indicator bits used by pcflag: */
60#define UDPLITE_BIT 0x1 /* set by udplite proto init function */
61#define UDPLITE_SEND_CC 0x2 /* set via udplite setsockopt */
62#define UDPLITE_RECV_CC 0x4 /* set via udplite setsocktopt */
63 __u8 pcflag; /* marks socket as UDP-Lite if > 0 */
53}; 64};
54 65
55static inline struct udp_sock *udp_sk(const struct sock *sk) 66static inline struct udp_sock *udp_sk(const struct sock *sk)
56{ 67{
57 return (struct udp_sock *)sk; 68 return (struct udp_sock *)sk;
58} 69}
70#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag)
59 71
60#endif 72#endif
61 73
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 5482bfb3303d..aab5b1b72021 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -313,8 +313,13 @@ struct usb_bus {
313/* This is arbitrary. 313/* This is arbitrary.
314 * From USB 2.0 spec Table 11-13, offset 7, a hub can 314 * From USB 2.0 spec Table 11-13, offset 7, a hub can
315 * have up to 255 ports. The most yet reported is 10. 315 * have up to 255 ports. The most yet reported is 10.
316 *
317 * Current Wireless USB host hardware (Intel i1480 for example) allows
318 * up to 22 devices to connect. Upcoming hardware might raise that
319 * limit. Because the arrays need to add a bit for hub status data, we
320 * do 31, so plus one evens out to four bytes.
316 */ 321 */
317#define USB_MAXCHILDREN (16) 322#define USB_MAXCHILDREN (31)
318 323
319struct usb_tt; 324struct usb_tt;
320 325
@@ -357,7 +362,8 @@ struct usb_device {
357 u8 portnum; /* Parent port number (origin 1) */ 362 u8 portnum; /* Parent port number (origin 1) */
358 u8 level; /* Number of USB hub ancestors */ 363 u8 level; /* Number of USB hub ancestors */
359 364
360 int have_langid; /* whether string_langid is valid */ 365 unsigned discon_suspended:1; /* Disconnected while suspended */
366 unsigned have_langid:1; /* whether string_langid is valid */
361 int string_langid; /* language ID for strings */ 367 int string_langid; /* language ID for strings */
362 368
363 /* static strings from the device */ 369 /* static strings from the device */
@@ -382,7 +388,7 @@ struct usb_device {
382 388
383 int pm_usage_cnt; /* usage counter for autosuspend */ 389 int pm_usage_cnt; /* usage counter for autosuspend */
384#ifdef CONFIG_PM 390#ifdef CONFIG_PM
385 struct work_struct autosuspend; /* for delayed autosuspends */ 391 struct delayed_work autosuspend; /* for delayed autosuspends */
386 struct mutex pm_mutex; /* protects PM operations */ 392 struct mutex pm_mutex; /* protects PM operations */
387 393
388 unsigned auto_pm:1; /* autosuspend/resume in progress */ 394 unsigned auto_pm:1; /* autosuspend/resume in progress */
@@ -410,14 +416,37 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
410 416
411/* USB autosuspend and autoresume */ 417/* USB autosuspend and autoresume */
412#ifdef CONFIG_USB_SUSPEND 418#ifdef CONFIG_USB_SUSPEND
419extern int usb_autopm_set_interface(struct usb_interface *intf);
413extern int usb_autopm_get_interface(struct usb_interface *intf); 420extern int usb_autopm_get_interface(struct usb_interface *intf);
414extern void usb_autopm_put_interface(struct usb_interface *intf); 421extern void usb_autopm_put_interface(struct usb_interface *intf);
415 422
423static inline void usb_autopm_enable(struct usb_interface *intf)
424{
425 intf->pm_usage_cnt = 0;
426 usb_autopm_set_interface(intf);
427}
428
429static inline void usb_autopm_disable(struct usb_interface *intf)
430{
431 intf->pm_usage_cnt = 1;
432 usb_autopm_set_interface(intf);
433}
434
416#else 435#else
417#define usb_autopm_get_interface(intf) 0
418#define usb_autopm_put_interface(intf) do {} while (0)
419#endif
420 436
437static inline int usb_autopm_set_interface(struct usb_interface *intf)
438{ return 0; }
439
440static inline int usb_autopm_get_interface(struct usb_interface *intf)
441{ return 0; }
442
443static inline void usb_autopm_put_interface(struct usb_interface *intf)
444{ }
445static inline void usb_autopm_enable(struct usb_interface *intf)
446{ }
447static inline void usb_autopm_disable(struct usb_interface *intf)
448{ }
449#endif
421 450
422/*-------------------------------------------------------------------------*/ 451/*-------------------------------------------------------------------------*/
423 452
@@ -490,17 +519,137 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
490 519
491/*-------------------------------------------------------------------------*/ 520/*-------------------------------------------------------------------------*/
492 521
493extern int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd); 522/**
494extern int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd); 523 * usb_endpoint_dir_in - check if the endpoint has IN direction
495extern int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd); 524 * @epd: endpoint to be checked
496extern int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd); 525 *
497extern int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd); 526 * Returns true if the endpoint is of type IN, otherwise it returns false.
498extern int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd); 527 */
499extern int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd); 528static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
500extern int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd); 529{
501extern int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd); 530 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
502extern int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd); 531}
503extern int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd); 532
533/**
534 * usb_endpoint_dir_out - check if the endpoint has OUT direction
535 * @epd: endpoint to be checked
536 *
537 * Returns true if the endpoint is of type OUT, otherwise it returns false.
538 */
539static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd)
540{
541 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
542}
543
544/**
545 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
546 * @epd: endpoint to be checked
547 *
548 * Returns true if the endpoint is of type bulk, otherwise it returns false.
549 */
550static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd)
551{
552 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
553 USB_ENDPOINT_XFER_BULK);
554}
555
556/**
557 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
558 * @epd: endpoint to be checked
559 *
560 * Returns true if the endpoint is of type interrupt, otherwise it returns
561 * false.
562 */
563static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd)
564{
565 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
566 USB_ENDPOINT_XFER_INT);
567}
568
569/**
570 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
571 * @epd: endpoint to be checked
572 *
573 * Returns true if the endpoint is of type isochronous, otherwise it returns
574 * false.
575 */
576static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd)
577{
578 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
579 USB_ENDPOINT_XFER_ISOC);
580}
581
582/**
583 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
584 * @epd: endpoint to be checked
585 *
586 * Returns true if the endpoint has bulk transfer type and IN direction,
587 * otherwise it returns false.
588 */
589static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd)
590{
591 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
592}
593
594/**
595 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
596 * @epd: endpoint to be checked
597 *
598 * Returns true if the endpoint has bulk transfer type and OUT direction,
599 * otherwise it returns false.
600 */
601static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd)
602{
603 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
604}
605
606/**
607 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
608 * @epd: endpoint to be checked
609 *
610 * Returns true if the endpoint has interrupt transfer type and IN direction,
611 * otherwise it returns false.
612 */
613static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd)
614{
615 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
616}
617
618/**
619 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
620 * @epd: endpoint to be checked
621 *
622 * Returns true if the endpoint has interrupt transfer type and OUT direction,
623 * otherwise it returns false.
624 */
625static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd)
626{
627 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
628}
629
630/**
631 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
632 * @epd: endpoint to be checked
633 *
634 * Returns true if the endpoint has isochronous transfer type and IN direction,
635 * otherwise it returns false.
636 */
637static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd)
638{
639 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
640}
641
642/**
643 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
644 * @epd: endpoint to be checked
645 *
646 * Returns true if the endpoint has isochronous transfer type and OUT direction,
647 * otherwise it returns false.
648 */
649static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd)
650{
651 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
652}
504 653
505/*-------------------------------------------------------------------------*/ 654/*-------------------------------------------------------------------------*/
506 655
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index dc9a29d84abc..924e502905d4 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -23,13 +23,14 @@ struct vm_area_struct;
23#endif 23#endif
24 24
25struct vm_struct { 25struct vm_struct {
26 /* keep next,addr,size together to speedup lookups */
27 struct vm_struct *next;
26 void *addr; 28 void *addr;
27 unsigned long size; 29 unsigned long size;
28 unsigned long flags; 30 unsigned long flags;
29 struct page **pages; 31 struct page **pages;
30 unsigned int nr_pages; 32 unsigned int nr_pages;
31 unsigned long phys_addr; 33 unsigned long phys_addr;
32 struct vm_struct *next;
33}; 34};
34 35
35/* 36/*
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index a50a0130fd9e..7c269f4992eb 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -546,6 +546,8 @@
546/* MLME requests (SIOCSIWMLME / struct iw_mlme) */ 546/* MLME requests (SIOCSIWMLME / struct iw_mlme) */
547#define IW_MLME_DEAUTH 0 547#define IW_MLME_DEAUTH 0
548#define IW_MLME_DISASSOC 1 548#define IW_MLME_DISASSOC 1
549#define IW_MLME_AUTH 2
550#define IW_MLME_ASSOC 3
549 551
550/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ 552/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */
551#define IW_AUTH_INDEX 0x0FFF 553#define IW_AUTH_INDEX 0x0FFF
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 9bca3539a1e5..edef8d50b26b 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -11,12 +11,23 @@
11 11
12struct workqueue_struct; 12struct workqueue_struct;
13 13
14struct work_struct;
15typedef void (*work_func_t)(struct work_struct *work);
16
14struct work_struct { 17struct work_struct {
15 unsigned long pending; 18 /* the first word is the work queue pointer and the flags rolled into
19 * one */
20 unsigned long management;
21#define WORK_STRUCT_PENDING 0 /* T if work item pending execution */
22#define WORK_STRUCT_NOAUTOREL 1 /* F if work item automatically released on exec */
23#define WORK_STRUCT_FLAG_MASK (3UL)
24#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
16 struct list_head entry; 25 struct list_head entry;
17 void (*func)(void *); 26 work_func_t func;
18 void *data; 27};
19 void *wq_data; 28
29struct delayed_work {
30 struct work_struct work;
20 struct timer_list timer; 31 struct timer_list timer;
21}; 32};
22 33
@@ -24,77 +35,160 @@ struct execute_work {
24 struct work_struct work; 35 struct work_struct work;
25}; 36};
26 37
27#define __WORK_INITIALIZER(n, f, d) { \ 38#define __WORK_INITIALIZER(n, f) { \
39 .management = 0, \
40 .entry = { &(n).entry, &(n).entry }, \
41 .func = (f), \
42 }
43
44#define __WORK_INITIALIZER_NAR(n, f) { \
45 .management = (1 << WORK_STRUCT_NOAUTOREL), \
28 .entry = { &(n).entry, &(n).entry }, \ 46 .entry = { &(n).entry, &(n).entry }, \
29 .func = (f), \ 47 .func = (f), \
30 .data = (d), \ 48 }
49
50#define __DELAYED_WORK_INITIALIZER(n, f) { \
51 .work = __WORK_INITIALIZER((n).work, (f)), \
52 .timer = TIMER_INITIALIZER(NULL, 0, 0), \
53 }
54
55#define __DELAYED_WORK_INITIALIZER_NAR(n, f) { \
56 .work = __WORK_INITIALIZER_NAR((n).work, (f)), \
31 .timer = TIMER_INITIALIZER(NULL, 0, 0), \ 57 .timer = TIMER_INITIALIZER(NULL, 0, 0), \
32 } 58 }
33 59
34#define DECLARE_WORK(n, f, d) \ 60#define DECLARE_WORK(n, f) \
35 struct work_struct n = __WORK_INITIALIZER(n, f, d) 61 struct work_struct n = __WORK_INITIALIZER(n, f)
62
63#define DECLARE_WORK_NAR(n, f) \
64 struct work_struct n = __WORK_INITIALIZER_NAR(n, f)
65
66#define DECLARE_DELAYED_WORK(n, f) \
67 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f)
68
69#define DECLARE_DELAYED_WORK_NAR(n, f) \
70 struct dwork_struct n = __DELAYED_WORK_INITIALIZER_NAR(n, f)
36 71
37/* 72/*
38 * initialize a work-struct's func and data pointers: 73 * initialize a work item's function pointer
39 */ 74 */
40#define PREPARE_WORK(_work, _func, _data) \ 75#define PREPARE_WORK(_work, _func) \
41 do { \ 76 do { \
42 (_work)->func = _func; \ 77 (_work)->func = (_func); \
43 (_work)->data = _data; \
44 } while (0) 78 } while (0)
45 79
80#define PREPARE_DELAYED_WORK(_work, _func) \
81 PREPARE_WORK(&(_work)->work, (_func))
82
46/* 83/*
47 * initialize all of a work-struct: 84 * initialize all of a work item in one go
48 */ 85 */
49#define INIT_WORK(_work, _func, _data) \ 86#define INIT_WORK(_work, _func) \
50 do { \ 87 do { \
88 (_work)->management = 0; \
51 INIT_LIST_HEAD(&(_work)->entry); \ 89 INIT_LIST_HEAD(&(_work)->entry); \
52 (_work)->pending = 0; \ 90 PREPARE_WORK((_work), (_func)); \
53 PREPARE_WORK((_work), (_func), (_data)); \ 91 } while (0)
92
93#define INIT_WORK_NAR(_work, _func) \
94 do { \
95 (_work)->management = (1 << WORK_STRUCT_NOAUTOREL); \
96 INIT_LIST_HEAD(&(_work)->entry); \
97 PREPARE_WORK((_work), (_func)); \
98 } while (0)
99
100#define INIT_DELAYED_WORK(_work, _func) \
101 do { \
102 INIT_WORK(&(_work)->work, (_func)); \
103 init_timer(&(_work)->timer); \
104 } while (0)
105
106#define INIT_DELAYED_WORK_NAR(_work, _func) \
107 do { \
108 INIT_WORK_NAR(&(_work)->work, (_func)); \
54 init_timer(&(_work)->timer); \ 109 init_timer(&(_work)->timer); \
55 } while (0) 110 } while (0)
56 111
112/**
113 * work_pending - Find out whether a work item is currently pending
114 * @work: The work item in question
115 */
116#define work_pending(work) \
117 test_bit(WORK_STRUCT_PENDING, &(work)->management)
118
119/**
120 * delayed_work_pending - Find out whether a delayable work item is currently
121 * pending
122 * @work: The work item in question
123 */
124#define delayed_work_pending(work) \
125 test_bit(WORK_STRUCT_PENDING, &(work)->work.management)
126
127/**
128 * work_release - Release a work item under execution
129 * @work: The work item to release
130 *
131 * This is used to release a work item that has been initialised with automatic
132 * release mode disabled (WORK_STRUCT_NOAUTOREL is set). This gives the work
133 * function the opportunity to grab auxiliary data from the container of the
134 * work_struct before clearing the pending bit as the work_struct may be
135 * subject to deallocation the moment the pending bit is cleared.
136 *
137 * In such a case, this should be called in the work function after it has
138 * fetched any data it may require from the containter of the work_struct.
139 * After this function has been called, the work_struct may be scheduled for
140 * further execution or it may be deallocated unless other precautions are
141 * taken.
142 *
143 * This should also be used to release a delayed work item.
144 */
145#define work_release(work) \
146 clear_bit(WORK_STRUCT_PENDING, &(work)->management)
147
148
57extern struct workqueue_struct *__create_workqueue(const char *name, 149extern struct workqueue_struct *__create_workqueue(const char *name,
58 int singlethread); 150 int singlethread,
59#define create_workqueue(name) __create_workqueue((name), 0) 151 int freezeable);
60#define create_singlethread_workqueue(name) __create_workqueue((name), 1) 152#define create_workqueue(name) __create_workqueue((name), 0, 0)
153#define create_freezeable_workqueue(name) __create_workqueue((name), 0, 1)
154#define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0)
61 155
62extern void destroy_workqueue(struct workqueue_struct *wq); 156extern void destroy_workqueue(struct workqueue_struct *wq);
63 157
64extern int FASTCALL(queue_work(struct workqueue_struct *wq, struct work_struct *work)); 158extern int FASTCALL(queue_work(struct workqueue_struct *wq, struct work_struct *work));
65extern int FASTCALL(queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay)); 159extern int FASTCALL(queue_delayed_work(struct workqueue_struct *wq, struct delayed_work *work, unsigned long delay));
66extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, 160extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
67 struct work_struct *work, unsigned long delay); 161 struct delayed_work *work, unsigned long delay);
68extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq)); 162extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq));
69 163
70extern int FASTCALL(schedule_work(struct work_struct *work)); 164extern int FASTCALL(schedule_work(struct work_struct *work));
71extern int FASTCALL(schedule_delayed_work(struct work_struct *work, unsigned long delay)); 165extern int FASTCALL(run_scheduled_work(struct work_struct *work));
166extern int FASTCALL(schedule_delayed_work(struct delayed_work *work, unsigned long delay));
72 167
73extern int schedule_delayed_work_on(int cpu, struct work_struct *work, unsigned long delay); 168extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, unsigned long delay);
74extern int schedule_on_each_cpu(void (*func)(void *info), void *info); 169extern int schedule_on_each_cpu(work_func_t func);
75extern void flush_scheduled_work(void); 170extern void flush_scheduled_work(void);
76extern int current_is_keventd(void); 171extern int current_is_keventd(void);
77extern int keventd_up(void); 172extern int keventd_up(void);
78 173
79extern void init_workqueues(void); 174extern void init_workqueues(void);
80void cancel_rearming_delayed_work(struct work_struct *work); 175void cancel_rearming_delayed_work(struct delayed_work *work);
81void cancel_rearming_delayed_workqueue(struct workqueue_struct *, 176void cancel_rearming_delayed_workqueue(struct workqueue_struct *,
82 struct work_struct *); 177 struct delayed_work *);
83int execute_in_process_context(void (*fn)(void *), void *, 178int execute_in_process_context(work_func_t fn, struct execute_work *);
84 struct execute_work *);
85 179
86/* 180/*
87 * Kill off a pending schedule_delayed_work(). Note that the work callback 181 * Kill off a pending schedule_delayed_work(). Note that the work callback
88 * function may still be running on return from cancel_delayed_work(). Run 182 * function may still be running on return from cancel_delayed_work(). Run
89 * flush_scheduled_work() to wait on it. 183 * flush_scheduled_work() to wait on it.
90 */ 184 */
91static inline int cancel_delayed_work(struct work_struct *work) 185static inline int cancel_delayed_work(struct delayed_work *work)
92{ 186{
93 int ret; 187 int ret;
94 188
95 ret = del_timer_sync(&work->timer); 189 ret = del_timer_sync(&work->timer);
96 if (ret) 190 if (ret)
97 clear_bit(0, &work->pending); 191 clear_bit(WORK_STRUCT_PENDING, &work->work.management);
98 return ret; 192 return ret;
99} 193}
100 194
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 8ae7f744917b..088ba8113f7e 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -211,8 +211,8 @@ struct xfrm_user_tmpl {
211 211
212struct xfrm_encap_tmpl { 212struct xfrm_encap_tmpl {
213 __u16 encap_type; 213 __u16 encap_type;
214 __u16 encap_sport; 214 __be16 encap_sport;
215 __u16 encap_dport; 215 __be16 encap_dport;
216 xfrm_address_t encap_oa; 216 xfrm_address_t encap_oa;
217}; 217};
218 218
@@ -289,7 +289,9 @@ struct xfrm_usersa_id {
289 289
290struct xfrm_aevent_id { 290struct xfrm_aevent_id {
291 struct xfrm_usersa_id sa_id; 291 struct xfrm_usersa_id sa_id;
292 xfrm_address_t saddr;
292 __u32 flags; 293 __u32 flags;
294 __u32 reqid;
293}; 295};
294 296
295struct xfrm_userspi_info { 297struct xfrm_userspi_info {
diff --git a/include/linux/zftape.h b/include/linux/zftape.h
deleted file mode 100644
index b057c65366c6..000000000000
--- a/include/linux/zftape.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef _ZFTAPE_H
2#define _ZFTAPE_H
3
4/*
5 * Copyright (C) 1996, 1997 Claus-Justus Heine.
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, or (at your option)
10 any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 *
22 * $Source: /homes/cvs/ftape-stacked/include/linux/zftape.h,v $
23 * $Revision: 1.12 $
24 * $Date: 1997/10/21 11:02:37 $
25 *
26 * Special ioctl and other global info for the zftape VFS
27 * interface for the QIC-40/80/3010/3020 floppy-tape driver for
28 * Linux.
29 */
30
31#define ZFTAPE_VERSION "zftape for " FTAPE_VERSION
32
33#include <linux/ftape.h>
34
35#define ZFTAPE_LABEL "Ftape - The Linux Floppy Tape Project!"
36
37/* Bits of the minor device number that control the operation mode */
38#define ZFT_Q80_MODE (1 << 3)
39#define ZFT_ZIP_MODE (1 << 4)
40#define ZFT_RAW_MODE (1 << 5)
41#define ZFT_MINOR_OP_MASK (ZFT_Q80_MODE | \
42 ZFT_ZIP_MODE | \
43 ZFT_RAW_MODE)
44#define ZFT_MINOR_MASK (FTAPE_SEL_MASK | \
45 ZFT_MINOR_OP_MASK | \
46 FTAPE_NO_REWIND)
47
48#ifdef ZFT_OBSOLETE
49struct mtblksz {
50 unsigned int mt_blksz;
51};
52#define MTIOC_ZFTAPE_GETBLKSZ _IOR('m', 104, struct mtblksz)
53#endif
54
55#ifdef __KERNEL__
56
57extern int zft_init(void);
58
59static inline __s64 zft_div_blksz(__s64 value, __u32 blk_sz)
60{
61 if (blk_sz == 1) {
62 return value;
63 } else {
64 return (__s64)(((__u32)(value >> 10) + (blk_sz >> 10) - 1)
65 / (blk_sz >> 10));
66 }
67}
68
69static inline __s64 zft_mul_blksz(__s64 value, __u32 blk_sz)
70{
71 if (blk_sz == 1) {
72 return value;
73 } else {
74 /* if blk_sz != 1, then it is a multiple of 1024. In
75 * this case, `value' will also fit into 32 bits.
76 *
77 * Actually, this limits the capacity to 42
78 * bits. This is (2^32)*1024, roughly a thousand
79 * times 2GB, or 3 Terabytes. Hopefully this is enough
80 */
81 return(__s64)(((__u32)(value)*(blk_sz>>10))<<10);
82 }
83}
84
85#endif
86
87#endif
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 44f1b673f916..88df8fc814e4 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -35,9 +35,9 @@ struct prefix_info {
35#else 35#else
36#error "Please fix <asm/byteorder.h>" 36#error "Please fix <asm/byteorder.h>"
37#endif 37#endif
38 __u32 valid; 38 __be32 valid;
39 __u32 prefered; 39 __be32 prefered;
40 __u32 reserved2; 40 __be32 reserved2;
41 41
42 struct in6_addr prefix; 42 struct in6_addr prefix;
43}; 43};
@@ -183,7 +183,7 @@ static __inline__ u8 ipv6_addr_hash(const struct in6_addr *addr)
183 * This will include the IEEE address token on links that support it. 183 * This will include the IEEE address token on links that support it.
184 */ 184 */
185 185
186 word = addr->s6_addr32[2] ^ addr->s6_addr32[3]; 186 word = (__force u32)(addr->s6_addr32[2] ^ addr->s6_addr32[3]);
187 word ^= (word >> 16); 187 word ^= (word >> 16);
188 word ^= (word >> 8); 188 word ^= (word >> 8);
189 189
diff --git a/include/net/arp.h b/include/net/arp.h
index 6a3d9a7d302b..f02664568600 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -16,7 +16,7 @@ extern void arp_send(int type, int ptype, __be32 dest_ip,
16 struct net_device *dev, __be32 src_ip, 16 struct net_device *dev, __be32 src_ip,
17 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); 17 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
18extern int arp_bind_neighbour(struct dst_entry *dst); 18extern int arp_bind_neighbour(struct dst_entry *dst);
19extern int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir); 19extern int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir);
20extern void arp_ifdown(struct net_device *dev); 20extern void arp_ifdown(struct net_device *dev);
21 21
22extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, 22extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
index 90fcc98e676f..b5a51a7bb364 100644
--- a/include/net/atmclip.h
+++ b/include/net/atmclip.h
@@ -36,7 +36,7 @@ struct clip_vcc {
36 36
37 37
38struct atmarp_entry { 38struct atmarp_entry {
39 u32 ip; /* IP address */ 39 __be32 ip; /* IP address */
40 struct clip_vcc *vccs; /* active VCCs; NULL if resolution is 40 struct clip_vcc *vccs; /* active VCCs; NULL if resolution is
41 pending */ 41 pending */
42 unsigned long expires; /* entry expiration time */ 42 unsigned long expires; /* entry expiration time */
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 89d743cfdfdf..3c563f02907c 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -124,7 +124,7 @@ struct rfcomm_pn {
124 u8 flow_ctrl; 124 u8 flow_ctrl;
125 u8 priority; 125 u8 priority;
126 u8 ack_timer; 126 u8 ack_timer;
127 u16 mtu; 127 __le16 mtu;
128 u8 max_retrans; 128 u8 max_retrans;
129 u8 credits; 129 u8 credits;
130} __attribute__ ((packed)); 130} __attribute__ ((packed));
@@ -136,7 +136,7 @@ struct rfcomm_rpn {
136 u8 flow_ctrl; 136 u8 flow_ctrl;
137 u8 xon_char; 137 u8 xon_char;
138 u8 xoff_char; 138 u8 xoff_char;
139 u16 param_mask; 139 __le16 param_mask;
140} __attribute__ ((packed)); 140} __attribute__ ((packed));
141 141
142struct rfcomm_rls { 142struct rfcomm_rls {
diff --git a/include/net/checksum.h b/include/net/checksum.h
index e3ea7cc2c728..124246172a88 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -27,8 +27,8 @@
27 27
28#ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 28#ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
29static inline 29static inline
30unsigned int csum_and_copy_from_user (const unsigned char __user *src, unsigned char *dst, 30__wsum csum_and_copy_from_user (const void __user *src, void *dst,
31 int len, int sum, int *err_ptr) 31 int len, __wsum sum, int *err_ptr)
32{ 32{
33 if (access_ok(VERIFY_READ, src, len)) 33 if (access_ok(VERIFY_READ, src, len))
34 return csum_partial_copy_from_user(src, dst, len, sum, err_ptr); 34 return csum_partial_copy_from_user(src, dst, len, sum, err_ptr);
@@ -41,8 +41,8 @@ unsigned int csum_and_copy_from_user (const unsigned char __user *src, unsigned
41#endif 41#endif
42 42
43#ifndef HAVE_CSUM_COPY_USER 43#ifndef HAVE_CSUM_COPY_USER
44static __inline__ unsigned int csum_and_copy_to_user 44static __inline__ __wsum csum_and_copy_to_user
45(const unsigned char *src, unsigned char __user *dst, int len, unsigned int sum, int *err_ptr) 45(const void *src, void __user *dst, int len, __wsum sum, int *err_ptr)
46{ 46{
47 sum = csum_partial(src, len, sum); 47 sum = csum_partial(src, len, sum);
48 48
@@ -53,35 +53,44 @@ static __inline__ unsigned int csum_and_copy_to_user
53 if (len) 53 if (len)
54 *err_ptr = -EFAULT; 54 *err_ptr = -EFAULT;
55 55
56 return -1; /* invalid checksum */ 56 return (__force __wsum)-1; /* invalid checksum */
57} 57}
58#endif 58#endif
59 59
60static inline unsigned int csum_add(unsigned int csum, unsigned int addend) 60static inline __wsum csum_add(__wsum csum, __wsum addend)
61{ 61{
62 csum += addend; 62 u32 res = (__force u32)csum;
63 return csum + (csum < addend); 63 res += (__force u32)addend;
64 return (__force __wsum)(res + (res < (__force u32)addend));
64} 65}
65 66
66static inline unsigned int csum_sub(unsigned int csum, unsigned int addend) 67static inline __wsum csum_sub(__wsum csum, __wsum addend)
67{ 68{
68 return csum_add(csum, ~addend); 69 return csum_add(csum, ~addend);
69} 70}
70 71
71static inline unsigned int 72static inline __wsum
72csum_block_add(unsigned int csum, unsigned int csum2, int offset) 73csum_block_add(__wsum csum, __wsum csum2, int offset)
73{ 74{
75 u32 sum = (__force u32)csum2;
74 if (offset&1) 76 if (offset&1)
75 csum2 = ((csum2&0xFF00FF)<<8)+((csum2>>8)&0xFF00FF); 77 sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF);
76 return csum_add(csum, csum2); 78 return csum_add(csum, (__force __wsum)sum);
77} 79}
78 80
79static inline unsigned int 81static inline __wsum
80csum_block_sub(unsigned int csum, unsigned int csum2, int offset) 82csum_block_sub(__wsum csum, __wsum csum2, int offset)
81{ 83{
84 u32 sum = (__force u32)csum2;
82 if (offset&1) 85 if (offset&1)
83 csum2 = ((csum2&0xFF00FF)<<8)+((csum2>>8)&0xFF00FF); 86 sum = ((sum&0xFF00FF)<<8)+((sum>>8)&0xFF00FF);
84 return csum_sub(csum, csum2); 87 return csum_sub(csum, (__force __wsum)sum);
85} 88}
86 89
90static inline __wsum csum_unfold(__sum16 n)
91{
92 return (__force __wsum)n;
93}
94
95#define CSUM_MANGLED_0 ((__force __sum16)0xffff)
87#endif 96#endif
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index 718b4d9c891f..4c9522c5178f 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -58,10 +58,10 @@
58#define CIPSO_V4_MAP_PASS 2 58#define CIPSO_V4_MAP_PASS 2
59 59
60/* limits */ 60/* limits */
61#define CIPSO_V4_MAX_REM_LVLS 256 61#define CIPSO_V4_MAX_REM_LVLS 255
62#define CIPSO_V4_INV_LVL 0x80000000 62#define CIPSO_V4_INV_LVL 0x80000000
63#define CIPSO_V4_MAX_LOC_LVLS (CIPSO_V4_INV_LVL - 1) 63#define CIPSO_V4_MAX_LOC_LVLS (CIPSO_V4_INV_LVL - 1)
64#define CIPSO_V4_MAX_REM_CATS 65536 64#define CIPSO_V4_MAX_REM_CATS 65534
65#define CIPSO_V4_INV_CAT 0x80000000 65#define CIPSO_V4_INV_CAT 0x80000000
66#define CIPSO_V4_MAX_LOC_CATS (CIPSO_V4_INV_CAT - 1) 66#define CIPSO_V4_MAX_LOC_CATS (CIPSO_V4_INV_CAT - 1)
67 67
diff --git a/include/net/dsfield.h b/include/net/dsfield.h
index a79c9e075f7f..eb65bf2e2502 100644
--- a/include/net/dsfield.h
+++ b/include/net/dsfield.h
@@ -20,14 +20,14 @@ static inline __u8 ipv4_get_dsfield(struct iphdr *iph)
20 20
21static inline __u8 ipv6_get_dsfield(struct ipv6hdr *ipv6h) 21static inline __u8 ipv6_get_dsfield(struct ipv6hdr *ipv6h)
22{ 22{
23 return ntohs(*(__u16 *) ipv6h) >> 4; 23 return ntohs(*(__be16 *) ipv6h) >> 4;
24} 24}
25 25
26 26
27static inline void ipv4_change_dsfield(struct iphdr *iph,__u8 mask, 27static inline void ipv4_change_dsfield(struct iphdr *iph,__u8 mask,
28 __u8 value) 28 __u8 value)
29{ 29{
30 __u32 check = ntohs(iph->check); 30 __u32 check = ntohs((__force __be16)iph->check);
31 __u8 dsfield; 31 __u8 dsfield;
32 32
33 dsfield = (iph->tos & mask) | value; 33 dsfield = (iph->tos & mask) | value;
@@ -35,7 +35,7 @@ static inline void ipv4_change_dsfield(struct iphdr *iph,__u8 mask,
35 if ((check+1) >> 16) check = (check+1) & 0xffff; 35 if ((check+1) >> 16) check = (check+1) & 0xffff;
36 check -= dsfield; 36 check -= dsfield;
37 check += check >> 16; /* adjust carry */ 37 check += check >> 16; /* adjust carry */
38 iph->check = htons(check); 38 iph->check = (__force __sum16)htons(check);
39 iph->tos = dsfield; 39 iph->tos = dsfield;
40} 40}
41 41
@@ -45,9 +45,9 @@ static inline void ipv6_change_dsfield(struct ipv6hdr *ipv6h,__u8 mask,
45{ 45{
46 __u16 tmp; 46 __u16 tmp;
47 47
48 tmp = ntohs(*(__u16 *) ipv6h); 48 tmp = ntohs(*(__be16 *) ipv6h);
49 tmp = (tmp & ((mask << 4) | 0xf00f)) | (value << 4); 49 tmp = (tmp & ((mask << 4) | 0xf00f)) | (value << 4);
50 *(__u16 *) ipv6h = htons(tmp); 50 *(__be16 *) ipv6h = htons(tmp);
51} 51}
52 52
53 53
diff --git a/include/net/dst.h b/include/net/dst.h
index e156e38e4ac3..62b7e7598e9a 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -98,7 +98,7 @@ struct dst_ops
98 int entry_size; 98 int entry_size;
99 99
100 atomic_t entries; 100 atomic_t entries;
101 kmem_cache_t *kmem_cachep; 101 struct kmem_cache *kmem_cachep;
102}; 102};
103 103
104#ifdef __KERNEL__ 104#ifdef __KERNEL__
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 8e2f473d3e82..bc3c26494c3d 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -13,6 +13,8 @@ struct fib_rule
13 atomic_t refcnt; 13 atomic_t refcnt;
14 int ifindex; 14 int ifindex;
15 char ifname[IFNAMSIZ]; 15 char ifname[IFNAMSIZ];
16 u32 mark;
17 u32 mark_mask;
16 u32 pref; 18 u32 pref;
17 u32 flags; 19 u32 flags;
18 u32 table; 20 u32 table;
@@ -50,6 +52,7 @@ struct fib_rules_ops
50 struct nlmsghdr *, 52 struct nlmsghdr *,
51 struct fib_rule_hdr *); 53 struct fib_rule_hdr *);
52 u32 (*default_pref)(void); 54 u32 (*default_pref)(void);
55 size_t (*nlmsg_payload)(struct fib_rule *);
53 56
54 int nlgroup; 57 int nlgroup;
55 struct nla_policy *policy; 58 struct nla_policy *policy;
@@ -57,6 +60,13 @@ struct fib_rules_ops
57 struct module *owner; 60 struct module *owner;
58}; 61};
59 62
63#define FRA_GENERIC_POLICY \
64 [FRA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
65 [FRA_PRIORITY] = { .type = NLA_U32 }, \
66 [FRA_FWMARK] = { .type = NLA_U32 }, \
67 [FRA_FWMASK] = { .type = NLA_U32 }, \
68 [FRA_TABLE] = { .type = NLA_U32 }
69
60static inline void fib_rule_get(struct fib_rule *rule) 70static inline void fib_rule_get(struct fib_rule *rule)
61{ 71{
62 atomic_inc(&rule->refcnt); 72 atomic_inc(&rule->refcnt);
diff --git a/include/net/flow.h b/include/net/flow.h
index 5cda27cd9deb..ce4b10d8b412 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -13,12 +13,12 @@
13struct flowi { 13struct flowi {
14 int oif; 14 int oif;
15 int iif; 15 int iif;
16 __u32 mark;
16 17
17 union { 18 union {
18 struct { 19 struct {
19 __be32 daddr; 20 __be32 daddr;
20 __be32 saddr; 21 __be32 saddr;
21 __u32 fwmark;
22 __u8 tos; 22 __u8 tos;
23 __u8 scope; 23 __u8 scope;
24 } ip4_u; 24 } ip4_u;
@@ -26,28 +26,23 @@ struct flowi {
26 struct { 26 struct {
27 struct in6_addr daddr; 27 struct in6_addr daddr;
28 struct in6_addr saddr; 28 struct in6_addr saddr;
29 __u32 fwmark; 29 __be32 flowlabel;
30 __u32 flowlabel;
31 } ip6_u; 30 } ip6_u;
32 31
33 struct { 32 struct {
34 __le16 daddr; 33 __le16 daddr;
35 __le16 saddr; 34 __le16 saddr;
36 __u32 fwmark;
37 __u8 scope; 35 __u8 scope;
38 } dn_u; 36 } dn_u;
39 } nl_u; 37 } nl_u;
40#define fld_dst nl_u.dn_u.daddr 38#define fld_dst nl_u.dn_u.daddr
41#define fld_src nl_u.dn_u.saddr 39#define fld_src nl_u.dn_u.saddr
42#define fld_fwmark nl_u.dn_u.fwmark
43#define fld_scope nl_u.dn_u.scope 40#define fld_scope nl_u.dn_u.scope
44#define fl6_dst nl_u.ip6_u.daddr 41#define fl6_dst nl_u.ip6_u.daddr
45#define fl6_src nl_u.ip6_u.saddr 42#define fl6_src nl_u.ip6_u.saddr
46#define fl6_fwmark nl_u.ip6_u.fwmark
47#define fl6_flowlabel nl_u.ip6_u.flowlabel 43#define fl6_flowlabel nl_u.ip6_u.flowlabel
48#define fl4_dst nl_u.ip4_u.daddr 44#define fl4_dst nl_u.ip4_u.daddr
49#define fl4_src nl_u.ip4_u.saddr 45#define fl4_src nl_u.ip4_u.saddr
50#define fl4_fwmark nl_u.ip4_u.fwmark
51#define fl4_tos nl_u.ip4_u.tos 46#define fl4_tos nl_u.ip4_u.tos
52#define fl4_scope nl_u.ip4_u.scope 47#define fl4_scope nl_u.ip4_u.scope
53 48
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index b619314218a6..adff4c898d50 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -53,6 +53,7 @@ struct genl_info
53 * @policy: attribute validation policy 53 * @policy: attribute validation policy
54 * @doit: standard command callback 54 * @doit: standard command callback
55 * @dumpit: callback for dumpers 55 * @dumpit: callback for dumpers
56 * @done: completion callback for dumps
56 * @ops_list: operations list 57 * @ops_list: operations list
57 */ 58 */
58struct genl_ops 59struct genl_ops
@@ -64,6 +65,7 @@ struct genl_ops
64 struct genl_info *info); 65 struct genl_info *info);
65 int (*dumpit)(struct sk_buff *skb, 66 int (*dumpit)(struct sk_buff *skb,
66 struct netlink_callback *cb); 67 struct netlink_callback *cb);
68 int (*done)(struct netlink_callback *cb);
67 struct list_head ops_list; 69 struct list_head ops_list;
68}; 70};
69 71
@@ -79,34 +81,51 @@ extern struct sock *genl_sock;
79 * @skb: socket buffer holding the message 81 * @skb: socket buffer holding the message
80 * @pid: netlink pid the message is addressed to 82 * @pid: netlink pid the message is addressed to
81 * @seq: sequence number (usually the one of the sender) 83 * @seq: sequence number (usually the one of the sender)
82 * @type: netlink message type 84 * @family: generic netlink family
83 * @hdrlen: length of the user specific header
84 * @flags netlink message flags 85 * @flags netlink message flags
85 * @cmd: generic netlink command 86 * @cmd: generic netlink command
86 * @version: version
87 * 87 *
88 * Returns pointer to user specific header 88 * Returns pointer to user specific header
89 */ 89 */
90static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, 90static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
91 int type, int hdrlen, int flags, 91 struct genl_family *family, int flags, u8 cmd)
92 u8 cmd, u8 version)
93{ 92{
94 struct nlmsghdr *nlh; 93 struct nlmsghdr *nlh;
95 struct genlmsghdr *hdr; 94 struct genlmsghdr *hdr;
96 95
97 nlh = nlmsg_put(skb, pid, seq, type, GENL_HDRLEN + hdrlen, flags); 96 nlh = nlmsg_put(skb, pid, seq, family->id, GENL_HDRLEN +
97 family->hdrsize, flags);
98 if (nlh == NULL) 98 if (nlh == NULL)
99 return NULL; 99 return NULL;
100 100
101 hdr = nlmsg_data(nlh); 101 hdr = nlmsg_data(nlh);
102 hdr->cmd = cmd; 102 hdr->cmd = cmd;
103 hdr->version = version; 103 hdr->version = family->version;
104 hdr->reserved = 0; 104 hdr->reserved = 0;
105 105
106 return (char *) hdr + GENL_HDRLEN; 106 return (char *) hdr + GENL_HDRLEN;
107} 107}
108 108
109/** 109/**
110 * genlmsg_put_reply - Add generic netlink header to a reply message
111 * @skb: socket buffer holding the message
112 * @info: receiver info
113 * @family: generic netlink family
114 * @flags: netlink message flags
115 * @cmd: generic netlink command
116 *
117 * Returns pointer to user specific header
118 */
119static inline void *genlmsg_put_reply(struct sk_buff *skb,
120 struct genl_info *info,
121 struct genl_family *family,
122 int flags, u8 cmd)
123{
124 return genlmsg_put(skb, info->snd_pid, info->snd_seq, family,
125 flags, cmd);
126}
127
128/**
110 * genlmsg_end - Finalize a generic netlink message 129 * genlmsg_end - Finalize a generic netlink message
111 * @skb: socket buffer the message is stored in 130 * @skb: socket buffer the message is stored in
112 * @hdr: user specific header 131 * @hdr: user specific header
@@ -150,6 +169,16 @@ static inline int genlmsg_unicast(struct sk_buff *skb, u32 pid)
150} 169}
151 170
152/** 171/**
172 * genlmsg_reply - reply to a request
173 * @skb: netlink message to be sent back
174 * @info: receiver information
175 */
176static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
177{
178 return genlmsg_unicast(skb, info->snd_pid);
179}
180
181/**
153 * gennlmsg_data - head of message payload 182 * gennlmsg_data - head of message payload
154 * @gnlh: genetlink messsage header 183 * @gnlh: genetlink messsage header
155 */ 184 */
@@ -187,4 +216,15 @@ static inline int genlmsg_total_size(int payload)
187 return NLMSG_ALIGN(genlmsg_msg_size(payload)); 216 return NLMSG_ALIGN(genlmsg_msg_size(payload));
188} 217}
189 218
219/**
220 * genlmsg_new - Allocate a new generic netlink message
221 * @payload: size of the message payload
222 * @flags: the type of memory to allocate.
223 */
224static inline struct sk_buff *genlmsg_new(size_t payload, gfp_t flags)
225{
226 return nlmsg_new(genlmsg_total_size(payload), flags);
227}
228
229
190#endif /* __NET_GENERIC_NETLINK_H */ 230#endif /* __NET_GENERIC_NETLINK_H */
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index b174ebb277a9..e6af381e206d 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -1037,6 +1037,10 @@ struct ieee80211_device {
1037 /* host performs multicast decryption */ 1037 /* host performs multicast decryption */
1038 int host_mc_decrypt; 1038 int host_mc_decrypt;
1039 1039
1040 /* host should strip IV and ICV from protected frames */
1041 /* meaningful only when hardware decryption is being used */
1042 int host_strip_iv_icv;
1043
1040 int host_open_frag; 1044 int host_open_frag;
1041 int host_build_iv; 1045 int host_build_iv;
1042 int ieee802_1x; /* is IEEE 802.1X used */ 1046 int ieee802_1x; /* is IEEE 802.1X used */
@@ -1076,6 +1080,8 @@ struct ieee80211_device {
1076 int perfect_rssi; 1080 int perfect_rssi;
1077 int worst_rssi; 1081 int worst_rssi;
1078 1082
1083 u16 prev_seq_ctl; /* used to drop duplicate frames */
1084
1079 /* Callback functions */ 1085 /* Callback functions */
1080 void (*set_security) (struct net_device * dev, 1086 void (*set_security) (struct net_device * dev,
1081 struct ieee80211_security * sec); 1087 struct ieee80211_security * sec);
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h
index 617b672b1132..89119277553d 100644
--- a/include/net/ieee80211softmac.h
+++ b/include/net/ieee80211softmac.h
@@ -108,8 +108,8 @@ struct ieee80211softmac_assoc_info {
108 /* Scan retries remaining */ 108 /* Scan retries remaining */
109 int scan_retry; 109 int scan_retry;
110 110
111 struct work_struct work; 111 struct delayed_work work;
112 struct work_struct timeout; 112 struct delayed_work timeout;
113}; 113};
114 114
115struct ieee80211softmac_bss_info { 115struct ieee80211softmac_bss_info {
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 34489c13c119..3ec7d07346d6 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -152,6 +152,7 @@ struct ifacaddr6
152 152
153struct ipv6_devstat { 153struct ipv6_devstat {
154 struct proc_dir_entry *proc_dir_entry; 154 struct proc_dir_entry *proc_dir_entry;
155 DEFINE_SNMP_STAT(struct ipstats_mib, ipv6);
155 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6); 156 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6);
156}; 157};
157 158
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index b33b438bffcc..16aa96a6a53b 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -27,7 +27,7 @@ extern int inet6_csk_bind_conflict(const struct sock *sk,
27 27
28extern struct request_sock *inet6_csk_search_req(const struct sock *sk, 28extern struct request_sock *inet6_csk_search_req(const struct sock *sk,
29 struct request_sock ***prevp, 29 struct request_sock ***prevp,
30 const __u16 rport, 30 const __be16 rport,
31 const struct in6_addr *raddr, 31 const struct in6_addr *raddr,
32 const struct in6_addr *laddr, 32 const struct in6_addr *laddr,
33 const int iif); 33 const int iif);
@@ -38,5 +38,5 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
38 38
39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
40 40
41extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok); 41extern int inet6_csk_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok);
42#endif /* _INET6_CONNECTION_SOCK_H */ 42#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index bc6a71dce984..c28e424f53d9 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -26,11 +26,11 @@ struct inet_hashinfo;
26 26
27/* I have no idea if this is a good hash for v6 or not. -DaveM */ 27/* I have no idea if this is a good hash for v6 or not. -DaveM */
28static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, 28static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport,
29 const struct in6_addr *faddr, const u16 fport) 29 const struct in6_addr *faddr, const __be16 fport)
30{ 30{
31 unsigned int hashent = (lport ^ fport); 31 unsigned int hashent = (lport ^ (__force u16)fport);
32 32
33 hashent ^= (laddr->s6_addr32[3] ^ faddr->s6_addr32[3]); 33 hashent ^= (__force u32)(laddr->s6_addr32[3] ^ faddr->s6_addr32[3]);
34 hashent ^= hashent >> 16; 34 hashent ^= hashent >> 16;
35 hashent ^= hashent >> 8; 35 hashent ^= hashent >> 8;
36 return hashent; 36 return hashent;
@@ -43,7 +43,7 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
43 const struct in6_addr *laddr = &np->rcv_saddr; 43 const struct in6_addr *laddr = &np->rcv_saddr;
44 const struct in6_addr *faddr = &np->daddr; 44 const struct in6_addr *faddr = &np->daddr;
45 const __u16 lport = inet->num; 45 const __u16 lport = inet->num;
46 const __u16 fport = inet->dport; 46 const __be16 fport = inet->dport;
47 return inet6_ehashfn(laddr, lport, faddr, fport); 47 return inet6_ehashfn(laddr, lport, faddr, fport);
48} 48}
49 49
@@ -57,7 +57,7 @@ extern void __inet6_hash(struct inet_hashinfo *hashinfo, struct sock *sk);
57 */ 57 */
58extern struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, 58extern struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
59 const struct in6_addr *saddr, 59 const struct in6_addr *saddr,
60 const u16 sport, 60 const __be16 sport,
61 const struct in6_addr *daddr, 61 const struct in6_addr *daddr,
62 const u16 hnum, 62 const u16 hnum,
63 const int dif); 63 const int dif);
@@ -69,7 +69,7 @@ extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo,
69 69
70static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo, 70static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo,
71 const struct in6_addr *saddr, 71 const struct in6_addr *saddr,
72 const u16 sport, 72 const __be16 sport,
73 const struct in6_addr *daddr, 73 const struct in6_addr *daddr,
74 const u16 hnum, 74 const u16 hnum,
75 const int dif) 75 const int dif)
@@ -83,8 +83,8 @@ static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo,
83} 83}
84 84
85extern struct sock *inet6_lookup(struct inet_hashinfo *hashinfo, 85extern struct sock *inet6_lookup(struct inet_hashinfo *hashinfo,
86 const struct in6_addr *saddr, const u16 sport, 86 const struct in6_addr *saddr, const __be16 sport,
87 const struct in6_addr *daddr, const u16 dport, 87 const struct in6_addr *daddr, const __be16 dport,
88 const int dif); 88 const int dif);
89#endif /* defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) */ 89#endif /* defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) */
90#endif /* _INET6_HASHTABLES_H */ 90#endif /* _INET6_HASHTABLES_H */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 0bcf9f237e1f..bf16d98d372c 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -18,6 +18,7 @@
18#include <linux/compiler.h> 18#include <linux/compiler.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/timer.h> 20#include <linux/timer.h>
21#include <linux/poll.h>
21 22
22#include <net/inet_sock.h> 23#include <net/inet_sock.h>
23#include <net/request_sock.h> 24#include <net/request_sock.h>
@@ -36,7 +37,8 @@ struct tcp_congestion_ops;
36 * (i.e. things that depend on the address family) 37 * (i.e. things that depend on the address family)
37 */ 38 */
38struct inet_connection_sock_af_ops { 39struct inet_connection_sock_af_ops {
39 int (*queue_xmit)(struct sk_buff *skb, int ipfragok); 40 int (*queue_xmit)(struct sk_buff *skb, struct sock *sk,
41 int ipfragok);
40 void (*send_check)(struct sock *sk, int len, 42 void (*send_check)(struct sock *sk, int len,
41 struct sk_buff *skb); 43 struct sk_buff *skb);
42 int (*rebuild_header)(struct sock *sk); 44 int (*rebuild_header)(struct sock *sk);
@@ -45,7 +47,8 @@ struct inet_connection_sock_af_ops {
45 struct request_sock *req, 47 struct request_sock *req,
46 struct dst_entry *dst); 48 struct dst_entry *dst);
47 int (*remember_stamp)(struct sock *sk); 49 int (*remember_stamp)(struct sock *sk);
48 __u16 net_header_len; 50 u16 net_header_len;
51 u16 sockaddr_len;
49 int (*setsockopt)(struct sock *sk, int level, int optname, 52 int (*setsockopt)(struct sock *sk, int level, int optname,
50 char __user *optval, int optlen); 53 char __user *optval, int optlen);
51 int (*getsockopt)(struct sock *sk, int level, int optname, 54 int (*getsockopt)(struct sock *sk, int level, int optname,
@@ -57,7 +60,6 @@ struct inet_connection_sock_af_ops {
57 int level, int optname, 60 int level, int optname,
58 char __user *optval, int __user *optlen); 61 char __user *optval, int __user *optlen);
59 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); 62 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
60 int sockaddr_len;
61}; 63};
62 64
63/** inet_connection_sock - INET connection oriented sock 65/** inet_connection_sock - INET connection oriented sock
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index d599c6bfbb86..10117c8503e8 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -48,12 +48,12 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
48 48
49#define IP6_ECN_flow_xmit(sk, label) do { \ 49#define IP6_ECN_flow_xmit(sk, label) do { \
50 if (INET_ECN_is_capable(inet_sk(sk)->tos)) \ 50 if (INET_ECN_is_capable(inet_sk(sk)->tos)) \
51 (label) |= __constant_htons(INET_ECN_ECT_0 << 4); \ 51 (label) |= htonl(INET_ECN_ECT_0 << 20); \
52 } while (0) 52 } while (0)
53 53
54static inline int IP_ECN_set_ce(struct iphdr *iph) 54static inline int IP_ECN_set_ce(struct iphdr *iph)
55{ 55{
56 u32 check = iph->check; 56 u32 check = (__force u32)iph->check;
57 u32 ecn = (iph->tos + 1) & INET_ECN_MASK; 57 u32 ecn = (iph->tos + 1) & INET_ECN_MASK;
58 58
59 /* 59 /*
@@ -71,9 +71,9 @@ static inline int IP_ECN_set_ce(struct iphdr *iph)
71 * INET_ECN_ECT_1 => check += htons(0xFFFD) 71 * INET_ECN_ECT_1 => check += htons(0xFFFD)
72 * INET_ECN_ECT_0 => check += htons(0xFFFE) 72 * INET_ECN_ECT_0 => check += htons(0xFFFE)
73 */ 73 */
74 check += htons(0xFFFB) + htons(ecn); 74 check += (__force u16)htons(0xFFFB) + (__force u16)htons(ecn);
75 75
76 iph->check = check + (check>=0xFFFF); 76 iph->check = (__force __sum16)(check + (check>=0xFFFF));
77 iph->tos |= INET_ECN_CE; 77 iph->tos |= INET_ECN_CE;
78 return 1; 78 return 1;
79} 79}
@@ -95,13 +95,13 @@ static inline int IP6_ECN_set_ce(struct ipv6hdr *iph)
95{ 95{
96 if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) 96 if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
97 return 0; 97 return 0;
98 *(u32*)iph |= htonl(INET_ECN_CE << 20); 98 *(__be32*)iph |= htonl(INET_ECN_CE << 20);
99 return 1; 99 return 1;
100} 100}
101 101
102static inline void IP6_ECN_clear(struct ipv6hdr *iph) 102static inline void IP6_ECN_clear(struct ipv6hdr *iph)
103{ 103{
104 *(u32*)iph &= ~htonl(INET_ECN_MASK << 20); 104 *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20);
105} 105}
106 106
107static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner) 107static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner)
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index a9eb2eaf094e..34cc76e3ddb4 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -125,7 +125,7 @@ struct inet_hashinfo {
125 rwlock_t lhash_lock ____cacheline_aligned; 125 rwlock_t lhash_lock ____cacheline_aligned;
126 atomic_t lhash_users; 126 atomic_t lhash_users;
127 wait_queue_head_t lhash_wait; 127 wait_queue_head_t lhash_wait;
128 kmem_cache_t *bind_bucket_cachep; 128 struct kmem_cache *bind_bucket_cachep;
129}; 129};
130 130
131static inline struct inet_ehash_bucket *inet_ehash_bucket( 131static inline struct inet_ehash_bucket *inet_ehash_bucket(
@@ -136,10 +136,10 @@ static inline struct inet_ehash_bucket *inet_ehash_bucket(
136} 136}
137 137
138extern struct inet_bind_bucket * 138extern struct inet_bind_bucket *
139 inet_bind_bucket_create(kmem_cache_t *cachep, 139 inet_bind_bucket_create(struct kmem_cache *cachep,
140 struct inet_bind_hashbucket *head, 140 struct inet_bind_hashbucket *head,
141 const unsigned short snum); 141 const unsigned short snum);
142extern void inet_bind_bucket_destroy(kmem_cache_t *cachep, 142extern void inet_bind_bucket_destroy(struct kmem_cache *cachep,
143 struct inet_bind_bucket *tb); 143 struct inet_bind_bucket *tb);
144 144
145static inline int inet_bhashfn(const __u16 lport, const int bhash_size) 145static inline int inet_bhashfn(const __u16 lport, const int bhash_size)
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 5f48748fe017..f7be1ac73601 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -84,7 +84,7 @@ struct inet_timewait_death_row {
84}; 84};
85 85
86extern void inet_twdr_hangman(unsigned long data); 86extern void inet_twdr_hangman(unsigned long data);
87extern void inet_twdr_twkill_work(void *data); 87extern void inet_twdr_twkill_work(struct work_struct *work);
88extern void inet_twdr_twcal_tick(unsigned long data); 88extern void inet_twdr_twcal_tick(unsigned long data);
89 89
90#if (BITS_PER_LONG == 64) 90#if (BITS_PER_LONG == 64)
diff --git a/include/net/ip.h b/include/net/ip.h
index b6d95e553401..83cb9ac5554e 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -97,7 +97,7 @@ extern int ip_mc_output(struct sk_buff *skb);
97extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); 97extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
98extern int ip_do_nat(struct sk_buff *skb); 98extern int ip_do_nat(struct sk_buff *skb);
99extern void ip_send_check(struct iphdr *ip); 99extern void ip_send_check(struct iphdr *ip);
100extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); 100extern int ip_queue_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok);
101extern void ip_init(void); 101extern void ip_init(void);
102extern int ip_append_data(struct sock *sk, 102extern int ip_append_data(struct sock *sk,
103 int getfrag(void *from, char *to, int offset, int len, 103 int getfrag(void *from, char *to, int offset, int len,
@@ -123,7 +123,7 @@ extern int ip4_datagram_connect(struct sock *sk,
123 * multicast packets. 123 * multicast packets.
124 */ 124 */
125 125
126static inline void ip_tr_mc_map(u32 addr, char *buf) 126static inline void ip_tr_mc_map(__be32 addr, char *buf)
127{ 127{
128 buf[0]=0xC0; 128 buf[0]=0xC0;
129 buf[1]=0x00; 129 buf[1]=0x00;
@@ -135,7 +135,7 @@ static inline void ip_tr_mc_map(u32 addr, char *buf)
135 135
136struct ip_reply_arg { 136struct ip_reply_arg {
137 struct kvec iov[1]; 137 struct kvec iov[1];
138 u32 csum; 138 __wsum csum;
139 int csumoffset; /* u16 offset of csum in iov[0].iov_base */ 139 int csumoffset; /* u16 offset of csum in iov[0].iov_base */
140 /* -1 if not needed */ 140 /* -1 if not needed */
141}; 141};
@@ -192,9 +192,9 @@ extern void ipfrag_init(void);
192static inline 192static inline
193int ip_decrease_ttl(struct iphdr *iph) 193int ip_decrease_ttl(struct iphdr *iph)
194{ 194{
195 u32 check = iph->check; 195 u32 check = (__force u32)iph->check;
196 check += htons(0x0100); 196 check += (__force u32)htons(0x0100);
197 iph->check = check + (check>=0xFFFF); 197 iph->check = (__force __sum16)(check + (check>=0xFFFF));
198 return --iph->ttl; 198 return --iph->ttl;
199} 199}
200 200
@@ -238,9 +238,9 @@ static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst
238 * Map a multicast IP onto multicast MAC for type ethernet. 238 * Map a multicast IP onto multicast MAC for type ethernet.
239 */ 239 */
240 240
241static inline void ip_eth_mc_map(u32 addr, char *buf) 241static inline void ip_eth_mc_map(__be32 naddr, char *buf)
242{ 242{
243 addr=ntohl(addr); 243 __u32 addr=ntohl(naddr);
244 buf[0]=0x01; 244 buf[0]=0x01;
245 buf[1]=0x00; 245 buf[1]=0x00;
246 buf[2]=0x5e; 246 buf[2]=0x5e;
@@ -256,13 +256,14 @@ static inline void ip_eth_mc_map(u32 addr, char *buf)
256 * Leave P_Key as 0 to be filled in by driver. 256 * Leave P_Key as 0 to be filled in by driver.
257 */ 257 */
258 258
259static inline void ip_ib_mc_map(u32 addr, char *buf) 259static inline void ip_ib_mc_map(__be32 naddr, char *buf)
260{ 260{
261 __u32 addr;
261 buf[0] = 0; /* Reserved */ 262 buf[0] = 0; /* Reserved */
262 buf[1] = 0xff; /* Multicast QPN */ 263 buf[1] = 0xff; /* Multicast QPN */
263 buf[2] = 0xff; 264 buf[2] = 0xff;
264 buf[3] = 0xff; 265 buf[3] = 0xff;
265 addr = ntohl(addr); 266 addr = ntohl(naddr);
266 buf[4] = 0xff; 267 buf[4] = 0xff;
267 buf[5] = 0x12; /* link local scope */ 268 buf[5] = 0x12; /* link local scope */
268 buf[6] = 0x40; /* IPv4 signature */ 269 buf[6] = 0x40; /* IPv4 signature */
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 3dfc885bdf25..68e2b32cf1d6 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -34,60 +34,60 @@
34 34
35#ifndef _HAVE_ARCH_IPV6_CSUM 35#ifndef _HAVE_ARCH_IPV6_CSUM
36 36
37static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 37static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
38 struct in6_addr *daddr, 38 const struct in6_addr *daddr,
39 __u16 len, 39 __u32 len, unsigned short proto,
40 unsigned short proto, 40 __wsum csum)
41 unsigned int csum)
42{ 41{
43 42
44 int carry; 43 int carry;
45 __u32 ulen; 44 __u32 ulen;
46 __u32 uproto; 45 __u32 uproto;
46 __u32 sum = (__force u32)csum;
47 47
48 csum += saddr->s6_addr32[0]; 48 sum += (__force u32)saddr->s6_addr32[0];
49 carry = (csum < saddr->s6_addr32[0]); 49 carry = (sum < (__force u32)saddr->s6_addr32[0]);
50 csum += carry; 50 sum += carry;
51 51
52 csum += saddr->s6_addr32[1]; 52 sum += (__force u32)saddr->s6_addr32[1];
53 carry = (csum < saddr->s6_addr32[1]); 53 carry = (sum < (__force u32)saddr->s6_addr32[1]);
54 csum += carry; 54 sum += carry;
55 55
56 csum += saddr->s6_addr32[2]; 56 sum += (__force u32)saddr->s6_addr32[2];
57 carry = (csum < saddr->s6_addr32[2]); 57 carry = (sum < (__force u32)saddr->s6_addr32[2]);
58 csum += carry; 58 sum += carry;
59 59
60 csum += saddr->s6_addr32[3]; 60 sum += (__force u32)saddr->s6_addr32[3];
61 carry = (csum < saddr->s6_addr32[3]); 61 carry = (sum < (__force u32)saddr->s6_addr32[3]);
62 csum += carry; 62 sum += carry;
63 63
64 csum += daddr->s6_addr32[0]; 64 sum += (__force u32)daddr->s6_addr32[0];
65 carry = (csum < daddr->s6_addr32[0]); 65 carry = (sum < (__force u32)daddr->s6_addr32[0]);
66 csum += carry; 66 sum += carry;
67 67
68 csum += daddr->s6_addr32[1]; 68 sum += (__force u32)daddr->s6_addr32[1];
69 carry = (csum < daddr->s6_addr32[1]); 69 carry = (sum < (__force u32)daddr->s6_addr32[1]);
70 csum += carry; 70 sum += carry;
71 71
72 csum += daddr->s6_addr32[2]; 72 sum += (__force u32)daddr->s6_addr32[2];
73 carry = (csum < daddr->s6_addr32[2]); 73 carry = (sum < (__force u32)daddr->s6_addr32[2]);
74 csum += carry; 74 sum += carry;
75 75
76 csum += daddr->s6_addr32[3]; 76 sum += (__force u32)daddr->s6_addr32[3];
77 carry = (csum < daddr->s6_addr32[3]); 77 carry = (sum < (__force u32)daddr->s6_addr32[3]);
78 csum += carry; 78 sum += carry;
79 79
80 ulen = htonl((__u32) len); 80 ulen = (__force u32)htonl((__u32) len);
81 csum += ulen; 81 sum += ulen;
82 carry = (csum < ulen); 82 carry = (sum < ulen);
83 csum += carry; 83 sum += carry;
84 84
85 uproto = htonl(proto); 85 uproto = (__force u32)htonl(proto);
86 csum += uproto; 86 sum += uproto;
87 carry = (csum < uproto); 87 carry = (sum < uproto);
88 csum += carry; 88 sum += carry;
89 89
90 return csum_fold(csum); 90 return csum_fold((__force __wsum)csum);
91} 91}
92 92
93#endif 93#endif
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index e4438de3bd6b..f9cde44f93b4 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -107,6 +107,11 @@ struct rt6_info
107 u8 rt6i_protocol; 107 u8 rt6i_protocol;
108}; 108};
109 109
110static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
111{
112 return ((struct rt6_info *)dst)->rt6i_idev;
113}
114
110struct fib6_walker_t 115struct fib6_walker_t
111{ 116{
112 struct fib6_walker_t *prev, *next; 117 struct fib6_walker_t *prev, *next;
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index c14b70ed4c57..4e927ebd1cb3 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -20,7 +20,7 @@ struct route_info {
20 route_pref:2, 20 route_pref:2,
21 reserved_h:3; 21 reserved_h:3;
22#endif 22#endif
23 __u32 lifetime; 23 __be32 lifetime;
24 __u8 prefix[0]; /* 0,8 or 16 */ 24 __u8 prefix[0]; /* 0,8 or 16 */
25}; 25};
26 26
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 949b932d2f08..36c635ca1aa6 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -115,7 +115,7 @@ struct fib_result {
115 115
116struct fib_result_nl { 116struct fib_result_nl {
117 __be32 fl_addr; /* To be looked up*/ 117 __be32 fl_addr; /* To be looked up*/
118 u32 fl_fwmark; 118 u32 fl_mark;
119 unsigned char fl_tos; 119 unsigned char fl_tos;
120 unsigned char fl_scope; 120 unsigned char fl_scope;
121 unsigned char tb_id_in; 121 unsigned char tb_id_in;
diff --git a/include/net/ip_mp_alg.h b/include/net/ip_mp_alg.h
index beffdd66ad74..25b56571e54b 100644
--- a/include/net/ip_mp_alg.h
+++ b/include/net/ip_mp_alg.h
@@ -88,9 +88,7 @@ static inline int multipath_comparekeys(const struct flowi *flp1,
88 return flp1->fl4_dst == flp2->fl4_dst && 88 return flp1->fl4_dst == flp2->fl4_dst &&
89 flp1->fl4_src == flp2->fl4_src && 89 flp1->fl4_src == flp2->fl4_src &&
90 flp1->oif == flp2->oif && 90 flp1->oif == flp2->oif &&
91#ifdef CONFIG_IP_ROUTE_FWMARK 91 flp1->mark == flp2->mark &&
92 flp1->fl4_fwmark == flp2->fl4_fwmark &&
93#endif
94 !((flp1->fl4_tos ^ flp2->fl4_tos) & 92 !((flp1->fl4_tos ^ flp2->fl4_tos) &
95 (IPTOS_RT_MASK | RTO_ONLINK)); 93 (IPTOS_RT_MASK | RTO_ONLINK));
96} 94}
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 49c717e3b040..672564e5a81d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -7,6 +7,7 @@
7#define _IP_VS_H 7#define _IP_VS_H
8 8
9#include <asm/types.h> /* For __uXX types */ 9#include <asm/types.h> /* For __uXX types */
10#include <linux/types.h> /* For __beXX types in userland */
10 11
11#define IP_VS_VERSION_CODE 0x010201 12#define IP_VS_VERSION_CODE 0x010201
12#define NVERSION(version) \ 13#define NVERSION(version) \
@@ -987,14 +988,20 @@ extern int ip_vs_make_skb_writable(struct sk_buff **pskb, int len);
987extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, 988extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
988 struct ip_vs_conn *cp, int dir); 989 struct ip_vs_conn *cp, int dir);
989 990
990extern u16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); 991extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset);
991 992
992static inline u16 ip_vs_check_diff(u32 old, u32 new, u16 oldsum) 993static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
993{ 994{
994 u32 diff[2] = { old, new }; 995 __be32 diff[2] = { ~old, new };
995 996
996 return csum_fold(csum_partial((char *) diff, sizeof(diff), 997 return csum_partial((char *) diff, sizeof(diff), oldsum);
997 oldsum ^ 0xFFFF)); 998}
999
1000static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
1001{
1002 __be16 diff[2] = { ~old, new };
1003
1004 return csum_partial((char *) diff, sizeof(diff), oldsum);
998} 1005}
999 1006
1000#endif /* __KERNEL__ */ 1007#endif /* __KERNEL__ */
diff --git a/include/net/ipconfig.h b/include/net/ipconfig.h
index 2a1fe996fbc6..3924d7d2cb11 100644
--- a/include/net/ipconfig.h
+++ b/include/net/ipconfig.h
@@ -11,12 +11,12 @@
11extern int ic_proto_enabled; /* Protocols enabled (see IC_xxx) */ 11extern int ic_proto_enabled; /* Protocols enabled (see IC_xxx) */
12extern int ic_set_manually; /* IPconfig parameters set manually */ 12extern int ic_set_manually; /* IPconfig parameters set manually */
13 13
14extern u32 ic_myaddr; /* My IP address */ 14extern __be32 ic_myaddr; /* My IP address */
15extern u32 ic_gateway; /* Gateway IP address */ 15extern __be32 ic_gateway; /* Gateway IP address */
16 16
17extern u32 ic_servaddr; /* Boot server IP address */ 17extern __be32 ic_servaddr; /* Boot server IP address */
18 18
19extern u32 root_server_addr; /* Address of NFS server */ 19extern __be32 root_server_addr; /* Address of NFS server */
20extern u8 root_server_path[]; /* Path to mount as root */ 20extern u8 root_server_path[]; /* Path to mount as root */
21 21
22 22
diff --git a/include/net/ipip.h b/include/net/ipip.h
index f490c3cbe377..7cdc914322f0 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -35,7 +35,7 @@ struct ip_tunnel
35 ip_send_check(iph); \ 35 ip_send_check(iph); \
36 \ 36 \
37 err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, dst_output);\ 37 err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, dst_output);\
38 if (err == NET_XMIT_SUCCESS || err == NET_XMIT_CN) { \ 38 if (net_xmit_eval(err) == 0) { \
39 stats->tx_bytes += pkt_len; \ 39 stats->tx_bytes += pkt_len; \
40 stats->tx_packets++; \ 40 stats->tx_packets++; \
41 } else { \ 41 } else { \
@@ -44,8 +44,4 @@ struct ip_tunnel
44 } \ 44 } \
45} while (0) 45} while (0)
46 46
47
48extern int sit_init(void);
49extern void sit_cleanup(void);
50
51#endif 47#endif
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 8223c4410b4b..00328b71a08c 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -95,10 +95,10 @@
95 */ 95 */
96 96
97struct frag_hdr { 97struct frag_hdr {
98 unsigned char nexthdr; 98 __u8 nexthdr;
99 unsigned char reserved; 99 __u8 reserved;
100 unsigned short frag_off; 100 __be16 frag_off;
101 __u32 identification; 101 __be32 identification;
102}; 102};
103 103
104#define IP6_MF 0x0001 104#define IP6_MF 0x0001
@@ -113,9 +113,24 @@ extern int sysctl_mld_max_msf;
113 113
114/* MIBs */ 114/* MIBs */
115DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); 115DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
116#define IP6_INC_STATS(field) SNMP_INC_STATS(ipv6_statistics, field) 116#define IP6_INC_STATS(idev,field) ({ \
117#define IP6_INC_STATS_BH(field) SNMP_INC_STATS_BH(ipv6_statistics, field) 117 struct inet6_dev *_idev = (idev); \
118#define IP6_INC_STATS_USER(field) SNMP_INC_STATS_USER(ipv6_statistics, field) 118 if (likely(_idev != NULL)) \
119 SNMP_INC_STATS(_idev->stats.ipv6, field); \
120 SNMP_INC_STATS(ipv6_statistics, field); \
121})
122#define IP6_INC_STATS_BH(idev,field) ({ \
123 struct inet6_dev *_idev = (idev); \
124 if (likely(_idev != NULL)) \
125 SNMP_INC_STATS_BH(_idev->stats.ipv6, field); \
126 SNMP_INC_STATS_BH(ipv6_statistics, field); \
127})
128#define IP6_INC_STATS_USER(idev,field) ({ \
129 struct inet6_dev *_idev = (idev); \
130 if (likely(_idev != NULL)) \
131 SNMP_INC_STATS_USER(_idev->stats.ipv6, field); \
132 SNMP_INC_STATS_USER(ipv6_statistics, field); \
133})
119DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); 134DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
120#define ICMP6_INC_STATS(idev, field) ({ \ 135#define ICMP6_INC_STATS(idev, field) ({ \
121 struct inet6_dev *_idev = (idev); \ 136 struct inet6_dev *_idev = (idev); \
@@ -143,9 +158,13 @@ DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
143 SNMP_INC_STATS_OFFSET_BH(icmpv6_statistics, field, _offset); \ 158 SNMP_INC_STATS_OFFSET_BH(icmpv6_statistics, field, _offset); \
144}) 159})
145DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); 160DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6);
146#define UDP6_INC_STATS(field) SNMP_INC_STATS(udp_stats_in6, field) 161DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
147#define UDP6_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_stats_in6, field) 162#define UDP6_INC_STATS_BH(field, is_udplite) do { \
148#define UDP6_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_stats_in6, field) 163 if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \
164 else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0)
165#define UDP6_INC_STATS_USER(field, is_udplite) do { \
166 if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \
167 else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0)
149 168
150int snmp6_register_dev(struct inet6_dev *idev); 169int snmp6_register_dev(struct inet6_dev *idev);
151int snmp6_unregister_dev(struct inet6_dev *idev); 170int snmp6_unregister_dev(struct inet6_dev *idev);
@@ -191,7 +210,7 @@ struct ipv6_txoptions
191struct ip6_flowlabel 210struct ip6_flowlabel
192{ 211{
193 struct ip6_flowlabel *next; 212 struct ip6_flowlabel *next;
194 u32 label; 213 __be32 label;
195 struct in6_addr dst; 214 struct in6_addr dst;
196 struct ipv6_txoptions *opt; 215 struct ipv6_txoptions *opt;
197 atomic_t users; 216 atomic_t users;
@@ -211,7 +230,7 @@ struct ipv6_fl_socklist
211 struct ip6_flowlabel *fl; 230 struct ip6_flowlabel *fl;
212}; 231};
213 232
214extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, u32 label); 233extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
215extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, 234extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space,
216 struct ip6_flowlabel * fl, 235 struct ip6_flowlabel * fl,
217 struct ipv6_txoptions * fopt); 236 struct ipv6_txoptions * fopt);
@@ -375,22 +394,15 @@ static inline int ipv6_addr_any(const struct in6_addr *a)
375 */ 394 */
376static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen) 395static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen)
377{ 396{
378 const __u32 *a1 = token1, *a2 = token2; 397 const __be32 *a1 = token1, *a2 = token2;
379 int i; 398 int i;
380 399
381 addrlen >>= 2; 400 addrlen >>= 2;
382 401
383 for (i = 0; i < addrlen; i++) { 402 for (i = 0; i < addrlen; i++) {
384 __u32 xb = a1[i] ^ a2[i]; 403 __be32 xb = a1[i] ^ a2[i];
385 if (xb) { 404 if (xb)
386 int j = 31; 405 return i * 32 + 32 - fls(ntohl(xb));
387
388 xb = ntohl(xb);
389 while ((xb & (1 << j)) == 0)
390 j--;
391
392 return (i * 32 + 31 - j);
393 }
394 } 406 }
395 407
396 /* 408 /*
@@ -544,7 +556,7 @@ extern int ip6_datagram_connect(struct sock *sk,
544 struct sockaddr *addr, int addr_len); 556 struct sockaddr *addr, int addr_len);
545 557
546extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); 558extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
547extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, u16 port, 559extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
548 u32 info, u8 *payload); 560 u32 info, u8 *payload);
549extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); 561extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info);
550 562
@@ -589,6 +601,8 @@ extern int tcp6_proc_init(void);
589extern void tcp6_proc_exit(void); 601extern void tcp6_proc_exit(void);
590extern int udp6_proc_init(void); 602extern int udp6_proc_init(void);
591extern void udp6_proc_exit(void); 603extern void udp6_proc_exit(void);
604extern int udplite6_proc_init(void);
605extern void udplite6_proc_exit(void);
592extern int ipv6_misc_proc_init(void); 606extern int ipv6_misc_proc_init(void);
593extern void ipv6_misc_proc_exit(void); 607extern void ipv6_misc_proc_exit(void);
594 608
diff --git a/include/net/ipx.h b/include/net/ipx.h
index 5c0cf33826c5..c6b2ee610866 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -15,9 +15,9 @@
15#include <linux/list.h> 15#include <linux/list.h>
16 16
17struct ipx_address { 17struct ipx_address {
18 __u32 net; 18 __be32 net;
19 __u8 node[IPX_NODE_LEN]; 19 __u8 node[IPX_NODE_LEN];
20 __u16 sock; 20 __be16 sock;
21}; 21};
22 22
23#define ipx_broadcast_node "\377\377\377\377\377\377" 23#define ipx_broadcast_node "\377\377\377\377\377\377"
@@ -26,9 +26,9 @@ struct ipx_address {
26#define IPX_MAX_PPROP_HOPS 8 26#define IPX_MAX_PPROP_HOPS 8
27 27
28struct ipxhdr { 28struct ipxhdr {
29 __u16 ipx_checksum __attribute__ ((packed)); 29 __be16 ipx_checksum __attribute__ ((packed));
30#define IPX_NO_CHECKSUM 0xFFFF 30#define IPX_NO_CHECKSUM __constant_htons(0xFFFF)
31 __u16 ipx_pktsize __attribute__ ((packed)); 31 __be16 ipx_pktsize __attribute__ ((packed));
32 __u8 ipx_tctrl; 32 __u8 ipx_tctrl;
33 __u8 ipx_type; 33 __u8 ipx_type;
34#define IPX_TYPE_UNKNOWN 0x00 34#define IPX_TYPE_UNKNOWN 0x00
@@ -48,14 +48,14 @@ static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
48 48
49struct ipx_interface { 49struct ipx_interface {
50 /* IPX address */ 50 /* IPX address */
51 __u32 if_netnum; 51 __be32 if_netnum;
52 unsigned char if_node[IPX_NODE_LEN]; 52 unsigned char if_node[IPX_NODE_LEN];
53 atomic_t refcnt; 53 atomic_t refcnt;
54 54
55 /* physical device info */ 55 /* physical device info */
56 struct net_device *if_dev; 56 struct net_device *if_dev;
57 struct datalink_proto *if_dlink; 57 struct datalink_proto *if_dlink;
58 unsigned short if_dlink_type; 58 __be16 if_dlink_type;
59 59
60 /* socket support */ 60 /* socket support */
61 unsigned short if_sknum; 61 unsigned short if_sknum;
@@ -71,7 +71,7 @@ struct ipx_interface {
71}; 71};
72 72
73struct ipx_route { 73struct ipx_route {
74 __u32 ir_net; 74 __be32 ir_net;
75 struct ipx_interface *ir_intrfc; 75 struct ipx_interface *ir_intrfc;
76 unsigned char ir_routed; 76 unsigned char ir_routed;
77 unsigned char ir_router_node[IPX_NODE_LEN]; 77 unsigned char ir_router_node[IPX_NODE_LEN];
@@ -82,10 +82,10 @@ struct ipx_route {
82#ifdef __KERNEL__ 82#ifdef __KERNEL__
83struct ipx_cb { 83struct ipx_cb {
84 u8 ipx_tctrl; 84 u8 ipx_tctrl;
85 u32 ipx_dest_net; 85 __be32 ipx_dest_net;
86 u32 ipx_source_net; 86 __be32 ipx_source_net;
87 struct { 87 struct {
88 u32 netnum; 88 __be32 netnum;
89 int index; 89 int index;
90 } last_hop; 90 } last_hop;
91}; 91};
@@ -97,7 +97,7 @@ struct ipx_sock {
97 struct sock sk; 97 struct sock sk;
98 struct ipx_address dest_addr; 98 struct ipx_address dest_addr;
99 struct ipx_interface *intrfc; 99 struct ipx_interface *intrfc;
100 unsigned short port; 100 __be16 port;
101#ifdef CONFIG_IPX_INTERN 101#ifdef CONFIG_IPX_INTERN
102 unsigned char node[IPX_NODE_LEN]; 102 unsigned char node[IPX_NODE_LEN];
103#endif 103#endif
@@ -132,7 +132,7 @@ extern struct ipx_interface *ipx_primary_net;
132extern int ipx_proc_init(void); 132extern int ipx_proc_init(void);
133extern void ipx_proc_exit(void); 133extern void ipx_proc_exit(void);
134 134
135extern const char *ipx_frame_name(unsigned short); 135extern const char *ipx_frame_name(__be16);
136extern const char *ipx_device_name(struct ipx_interface *intrfc); 136extern const char *ipx_device_name(struct ipx_interface *intrfc);
137 137
138static __inline__ void ipxitf_hold(struct ipx_interface *intrfc) 138static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
diff --git a/include/net/irda/irlan_filter.h b/include/net/irda/irlan_filter.h
index 492dedaa8ac1..1720539ac2c1 100644
--- a/include/net/irda/irlan_filter.h
+++ b/include/net/irda/irlan_filter.h
@@ -28,6 +28,8 @@
28void irlan_check_command_param(struct irlan_cb *self, char *param, 28void irlan_check_command_param(struct irlan_cb *self, char *param,
29 char *value); 29 char *value);
30void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb); 30void irlan_filter_request(struct irlan_cb *self, struct sk_buff *skb);
31#ifdef CONFIG_PROC_FS
31void irlan_print_filter(struct seq_file *seq, int filter_type); 32void irlan_print_filter(struct seq_file *seq, int filter_type);
33#endif
32 34
33#endif /* IRLAN_FILTER_H */ 35#endif /* IRLAN_FILTER_H */
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h
index 9dd54a5002b2..641f88e848bd 100644
--- a/include/net/irda/irlap_frame.h
+++ b/include/net/irda/irlap_frame.h
@@ -91,8 +91,8 @@ struct xid_frame {
91 __u8 caddr; /* Connection address */ 91 __u8 caddr; /* Connection address */
92 __u8 control; 92 __u8 control;
93 __u8 ident; /* Should always be XID_FORMAT */ 93 __u8 ident; /* Should always be XID_FORMAT */
94 __u32 saddr; /* Source device address */ 94 __le32 saddr; /* Source device address */
95 __u32 daddr; /* Destination device address */ 95 __le32 daddr; /* Destination device address */
96 __u8 flags; /* Discovery flags */ 96 __u8 flags; /* Discovery flags */
97 __u8 slotnr; 97 __u8 slotnr;
98 __u8 version; 98 __u8 version;
@@ -101,15 +101,15 @@ struct xid_frame {
101struct test_frame { 101struct test_frame {
102 __u8 caddr; /* Connection address */ 102 __u8 caddr; /* Connection address */
103 __u8 control; 103 __u8 control;
104 __u32 saddr; /* Source device address */ 104 __le32 saddr; /* Source device address */
105 __u32 daddr; /* Destination device address */ 105 __le32 daddr; /* Destination device address */
106} IRDA_PACK; 106} IRDA_PACK;
107 107
108struct ua_frame { 108struct ua_frame {
109 __u8 caddr; 109 __u8 caddr;
110 __u8 control; 110 __u8 control;
111 __u32 saddr; /* Source device address */ 111 __le32 saddr; /* Source device address */
112 __u32 daddr; /* Dest device address */ 112 __le32 daddr; /* Dest device address */
113} IRDA_PACK; 113} IRDA_PACK;
114 114
115struct dm_frame { 115struct dm_frame {
@@ -135,8 +135,8 @@ struct i_frame {
135struct snrm_frame { 135struct snrm_frame {
136 __u8 caddr; 136 __u8 caddr;
137 __u8 control; 137 __u8 control;
138 __u32 saddr; 138 __le32 saddr;
139 __u32 daddr; 139 __le32 daddr;
140 __u8 ncaddr; 140 __u8 ncaddr;
141} IRDA_PACK; 141} IRDA_PACK;
142 142
diff --git a/include/net/irda/timer.h b/include/net/irda/timer.h
index 2c5d8864ab77..cb61568547d1 100644
--- a/include/net/irda/timer.h
+++ b/include/net/irda/timer.h
@@ -28,6 +28,7 @@
28#define TIMER_H 28#define TIMER_H
29 29
30#include <linux/timer.h> 30#include <linux/timer.h>
31#include <linux/jiffies.h>
31 32
32#include <asm/param.h> /* for HZ */ 33#include <asm/param.h> /* for HZ */
33 34
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index 8f6306581fa7..aa33a477c3fb 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -252,9 +252,9 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
252 */ 252 */
253static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa) 253static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
254{ 254{
255 if (skb->protocol == ntohs(ETH_P_802_2)) 255 if (skb->protocol == htons(ETH_P_802_2))
256 memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN); 256 memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN);
257 else if (skb->protocol == ntohs(ETH_P_TR_802_2)) { 257 else if (skb->protocol == htons(ETH_P_TR_802_2)) {
258 memcpy(sa, tr_hdr(skb)->saddr, ETH_ALEN); 258 memcpy(sa, tr_hdr(skb)->saddr, ETH_ALEN);
259 *sa &= 0x7F; 259 *sa &= 0x7F;
260 } 260 }
@@ -269,9 +269,9 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
269 */ 269 */
270static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da) 270static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
271{ 271{
272 if (skb->protocol == ntohs(ETH_P_802_2)) 272 if (skb->protocol == htons(ETH_P_802_2))
273 memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN); 273 memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN);
274 else if (skb->protocol == ntohs(ETH_P_TR_802_2)) 274 else if (skb->protocol == htons(ETH_P_TR_802_2))
275 memcpy(da, tr_hdr(skb)->daddr, ETH_ALEN); 275 memcpy(da, tr_hdr(skb)->daddr, ETH_ALEN);
276} 276}
277 277
@@ -345,7 +345,7 @@ static inline void llc_pdu_init_as_test_rsp(struct sk_buff *skb,
345 pdu->ctrl_1 = LLC_PDU_TYPE_U; 345 pdu->ctrl_1 = LLC_PDU_TYPE_U;
346 pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST; 346 pdu->ctrl_1 |= LLC_1_PDU_CMD_TEST;
347 pdu->ctrl_1 |= LLC_U_PF_BIT_MASK; 347 pdu->ctrl_1 |= LLC_U_PF_BIT_MASK;
348 if (ev_skb->protocol == ntohs(ETH_P_802_2)) { 348 if (ev_skb->protocol == htons(ETH_P_802_2)) {
349 struct llc_pdu_un *ev_pdu = llc_pdu_un_hdr(ev_skb); 349 struct llc_pdu_un *ev_pdu = llc_pdu_un_hdr(ev_skb);
350 int dsize; 350 int dsize;
351 351
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index d3915dabe6de..475b10c575b3 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -66,8 +66,8 @@ struct rs_msg {
66 66
67struct ra_msg { 67struct ra_msg {
68 struct icmp6hdr icmph; 68 struct icmp6hdr icmph;
69 __u32 reachable_time; 69 __be32 reachable_time;
70 __u32 retrans_timer; 70 __be32 retrans_timer;
71}; 71};
72 72
73struct nd_opt_hdr { 73struct nd_opt_hdr {
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index c8aacbd2e333..23967031ddb7 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -160,7 +160,7 @@ struct neigh_table
160 atomic_t entries; 160 atomic_t entries;
161 rwlock_t lock; 161 rwlock_t lock;
162 unsigned long last_rand; 162 unsigned long last_rand;
163 kmem_cache_t *kmem_cachep; 163 struct kmem_cache *kmem_cachep;
164 struct neigh_statistics *stats; 164 struct neigh_statistics *stats;
165 struct neighbour **hash_buckets; 165 struct neighbour **hash_buckets;
166 unsigned int hash_mask; 166 unsigned int hash_mask;
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
index 91684436af8e..1401ccc051c4 100644
--- a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
@@ -9,32 +9,35 @@
9#ifndef _NF_CONNTRACK_IPV4_H 9#ifndef _NF_CONNTRACK_IPV4_H
10#define _NF_CONNTRACK_IPV4_H 10#define _NF_CONNTRACK_IPV4_H
11 11
12#ifdef CONFIG_IP_NF_NAT_NEEDED 12#ifdef CONFIG_NF_NAT_NEEDED
13#include <linux/netfilter_ipv4/ip_nat.h> 13#include <net/netfilter/nf_nat.h>
14#include <linux/netfilter/nf_conntrack_pptp.h>
14 15
15/* per conntrack: nat application helper private data */ 16/* per conntrack: nat application helper private data */
16union ip_conntrack_nat_help { 17union nf_conntrack_nat_help {
17 /* insert nat helper private data here */ 18 /* insert nat helper private data here */
19 struct nf_nat_pptp nat_pptp_info;
18}; 20};
19 21
20struct nf_conntrack_ipv4_nat { 22struct nf_conn_nat {
21 struct ip_nat_info info; 23 struct nf_nat_info info;
22 union ip_conntrack_nat_help help; 24 union nf_conntrack_nat_help help;
23#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \ 25#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
24 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) 26 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
25 int masq_index; 27 int masq_index;
26#endif 28#endif
27}; 29};
28#endif /* CONFIG_IP_NF_NAT_NEEDED */ 30#endif /* CONFIG_NF_NAT_NEEDED */
29
30struct nf_conntrack_ipv4 {
31#ifdef CONFIG_IP_NF_NAT_NEEDED
32 struct nf_conntrack_ipv4_nat *nat;
33#endif
34};
35 31
36/* Returns new sk_buff, or NULL */ 32/* Returns new sk_buff, or NULL */
37struct sk_buff * 33struct sk_buff *
38nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb); 34nf_ct_ipv4_ct_gather_frags(struct sk_buff *skb);
39 35
36extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;
37extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
38extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
39
40extern int nf_conntrack_ipv4_compat_init(void);
41extern void nf_conntrack_ipv4_compat_fini(void);
42
40#endif /*_NF_CONNTRACK_IPV4_H*/ 43#endif /*_NF_CONNTRACK_IPV4_H*/
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
new file mode 100644
index 000000000000..b4b6049e01fa
--- /dev/null
+++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
@@ -0,0 +1,25 @@
1#ifndef _NF_CONNTRACK_IPV6_H
2#define _NF_CONNTRACK_IPV6_H
3
4extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;
5
6extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
7extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
8extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
9
10extern int nf_ct_ipv6_skip_exthdr(struct sk_buff *skb, int start,
11 u8 *nexthdrp, int len);
12
13extern int nf_ct_frag6_init(void);
14extern void nf_ct_frag6_cleanup(void);
15extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb);
16extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
17 struct net_device *in,
18 struct net_device *out,
19 int (*okfn)(struct sk_buff *));
20
21extern unsigned int nf_ct_frag6_timeout;
22extern unsigned int nf_ct_frag6_low_thresh;
23extern unsigned int nf_ct_frag6_high_thresh;
24
25#endif /* _NF_CONNTRACK_IPV6_H*/
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 1fbd8193d5f1..bd01b4633ee2 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -21,6 +21,7 @@
21 21
22#include <linux/netfilter/nf_conntrack_tcp.h> 22#include <linux/netfilter/nf_conntrack_tcp.h>
23#include <linux/netfilter/nf_conntrack_sctp.h> 23#include <linux/netfilter/nf_conntrack_sctp.h>
24#include <linux/netfilter/nf_conntrack_proto_gre.h>
24#include <net/netfilter/ipv4/nf_conntrack_icmp.h> 25#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
25#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h> 26#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h>
26 27
@@ -33,6 +34,7 @@ union nf_conntrack_proto {
33 struct ip_ct_tcp tcp; 34 struct ip_ct_tcp tcp;
34 struct ip_ct_icmp icmp; 35 struct ip_ct_icmp icmp;
35 struct nf_ct_icmpv6 icmpv6; 36 struct nf_ct_icmpv6 icmpv6;
37 struct nf_ct_gre gre;
36}; 38};
37 39
38union nf_conntrack_expect_proto { 40union nf_conntrack_expect_proto {
@@ -41,15 +43,20 @@ union nf_conntrack_expect_proto {
41 43
42/* Add protocol helper include file here */ 44/* Add protocol helper include file here */
43#include <linux/netfilter/nf_conntrack_ftp.h> 45#include <linux/netfilter/nf_conntrack_ftp.h>
46#include <linux/netfilter/nf_conntrack_pptp.h>
47#include <linux/netfilter/nf_conntrack_h323.h>
44 48
45/* per conntrack: application helper private data */ 49/* per conntrack: application helper private data */
46union nf_conntrack_help { 50union nf_conntrack_help {
47 /* insert conntrack helper private data (master) here */ 51 /* insert conntrack helper private data (master) here */
48 struct ip_ct_ftp_master ct_ftp_info; 52 struct nf_ct_ftp_master ct_ftp_info;
53 struct nf_ct_pptp_master ct_pptp_info;
54 struct nf_ct_h323_master ct_h323_info;
49}; 55};
50 56
51#include <linux/types.h> 57#include <linux/types.h>
52#include <linux/skbuff.h> 58#include <linux/skbuff.h>
59#include <linux/timer.h>
53 60
54#ifdef CONFIG_NETFILTER_DEBUG 61#ifdef CONFIG_NETFILTER_DEBUG
55#define NF_CT_ASSERT(x) \ 62#define NF_CT_ASSERT(x) \
@@ -79,6 +86,8 @@ struct nf_conn_help {
79 86
80 87
81#include <net/netfilter/ipv4/nf_conntrack_ipv4.h> 88#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
89#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
90
82struct nf_conn 91struct nf_conn
83{ 92{
84 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, 93 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
@@ -124,44 +133,6 @@ struct nf_conn
124 char data[0]; 133 char data[0];
125}; 134};
126 135
127struct nf_conntrack_expect
128{
129 /* Internal linked list (global expectation list) */
130 struct list_head list;
131
132 /* We expect this tuple, with the following mask */
133 struct nf_conntrack_tuple tuple, mask;
134
135 /* Function to call after setup and insertion */
136 void (*expectfn)(struct nf_conn *new,
137 struct nf_conntrack_expect *this);
138
139 /* The conntrack of the master connection */
140 struct nf_conn *master;
141
142 /* Timer function; deletes the expectation. */
143 struct timer_list timeout;
144
145 /* Usage count. */
146 atomic_t use;
147
148 /* Unique ID */
149 unsigned int id;
150
151 /* Flags */
152 unsigned int flags;
153
154#ifdef CONFIG_NF_NAT_NEEDED
155 /* This is the original per-proto part, used to map the
156 * expected connection the way the recipient expects. */
157 union nf_conntrack_manip_proto saved_proto;
158 /* Direction relative to the master connection. */
159 enum ip_conntrack_dir dir;
160#endif
161};
162
163#define NF_CT_EXPECT_PERMANENT 0x1
164
165static inline struct nf_conn * 136static inline struct nf_conn *
166nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash) 137nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash)
167{ 138{
@@ -208,16 +179,6 @@ __nf_conntrack_find(const struct nf_conntrack_tuple *tuple,
208 179
209extern void nf_conntrack_hash_insert(struct nf_conn *ct); 180extern void nf_conntrack_hash_insert(struct nf_conn *ct);
210 181
211extern struct nf_conntrack_expect *
212__nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
213
214extern struct nf_conntrack_expect *
215nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
216
217extern void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
218
219extern void nf_ct_remove_expectations(struct nf_conn *ct);
220
221extern void nf_conntrack_flush(void); 182extern void nf_conntrack_flush(void);
222 183
223extern struct nf_conntrack_helper * 184extern struct nf_conntrack_helper *
@@ -289,89 +250,12 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
289 250
290extern unsigned int nf_conntrack_htable_size; 251extern unsigned int nf_conntrack_htable_size;
291extern int nf_conntrack_checksum; 252extern int nf_conntrack_checksum;
253extern atomic_t nf_conntrack_count;
254extern int nf_conntrack_max;
292 255
256DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
293#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) 257#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++)
294 258
295#ifdef CONFIG_NF_CONNTRACK_EVENTS
296#include <linux/notifier.h>
297#include <linux/interrupt.h>
298
299struct nf_conntrack_ecache {
300 struct nf_conn *ct;
301 unsigned int events;
302};
303DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
304
305#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
306
307extern struct atomic_notifier_head nf_conntrack_chain;
308extern struct atomic_notifier_head nf_conntrack_expect_chain;
309
310static inline int nf_conntrack_register_notifier(struct notifier_block *nb)
311{
312 return atomic_notifier_chain_register(&nf_conntrack_chain, nb);
313}
314
315static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb)
316{
317 return atomic_notifier_chain_unregister(&nf_conntrack_chain, nb);
318}
319
320static inline int
321nf_conntrack_expect_register_notifier(struct notifier_block *nb)
322{
323 return atomic_notifier_chain_register(&nf_conntrack_expect_chain, nb);
324}
325
326static inline int
327nf_conntrack_expect_unregister_notifier(struct notifier_block *nb)
328{
329 return atomic_notifier_chain_unregister(&nf_conntrack_expect_chain,
330 nb);
331}
332
333extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
334extern void __nf_ct_event_cache_init(struct nf_conn *ct);
335
336static inline void
337nf_conntrack_event_cache(enum ip_conntrack_events event,
338 const struct sk_buff *skb)
339{
340 struct nf_conn *ct = (struct nf_conn *)skb->nfct;
341 struct nf_conntrack_ecache *ecache;
342
343 local_bh_disable();
344 ecache = &__get_cpu_var(nf_conntrack_ecache);
345 if (ct != ecache->ct)
346 __nf_ct_event_cache_init(ct);
347 ecache->events |= event;
348 local_bh_enable();
349}
350
351static inline void nf_conntrack_event(enum ip_conntrack_events event,
352 struct nf_conn *ct)
353{
354 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
355 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
356}
357
358static inline void
359nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
360 struct nf_conntrack_expect *exp)
361{
362 atomic_notifier_call_chain(&nf_conntrack_expect_chain, event, exp);
363}
364#else /* CONFIG_NF_CONNTRACK_EVENTS */
365static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
366 const struct sk_buff *skb) {}
367static inline void nf_conntrack_event(enum ip_conntrack_events event,
368 struct nf_conn *ct) {}
369static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
370static inline void
371nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
372 struct nf_conntrack_expect *exp) {}
373#endif /* CONFIG_NF_CONNTRACK_EVENTS */
374
375/* no helper, no nat */ 259/* no helper, no nat */
376#define NF_CT_F_BASIC 0 260#define NF_CT_F_BASIC 0
377/* for helper */ 261/* for helper */
@@ -387,17 +271,45 @@ nf_conntrack_unregister_cache(u_int32_t features);
387 271
388/* valid combinations: 272/* valid combinations:
389 * basic: nf_conn, nf_conn .. nf_conn_help 273 * basic: nf_conn, nf_conn .. nf_conn_help
390 * nat: nf_conn .. nf_conn_nat, nf_conn .. nf_conn_nat, nf_conn help 274 * nat: nf_conn .. nf_conn_nat, nf_conn .. nf_conn_nat .. nf_conn help
391 */ 275 */
276#ifdef CONFIG_NF_NAT_NEEDED
277static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
278{
279 unsigned int offset = sizeof(struct nf_conn);
280
281 if (!(ct->features & NF_CT_F_NAT))
282 return NULL;
283
284 offset = ALIGN(offset, __alignof__(struct nf_conn_nat));
285 return (struct nf_conn_nat *) ((void *)ct + offset);
286}
287
392static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) 288static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
393{ 289{
394 unsigned int offset = sizeof(struct nf_conn); 290 unsigned int offset = sizeof(struct nf_conn);
395 291
396 if (!(ct->features & NF_CT_F_HELP)) 292 if (!(ct->features & NF_CT_F_HELP))
397 return NULL; 293 return NULL;
294 if (ct->features & NF_CT_F_NAT) {
295 offset = ALIGN(offset, __alignof__(struct nf_conn_nat));
296 offset += sizeof(struct nf_conn_nat);
297 }
398 298
299 offset = ALIGN(offset, __alignof__(struct nf_conn_help));
399 return (struct nf_conn_help *) ((void *)ct + offset); 300 return (struct nf_conn_help *) ((void *)ct + offset);
400} 301}
302#else /* No NAT */
303static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
304{
305 unsigned int offset = sizeof(struct nf_conn);
306
307 if (!(ct->features & NF_CT_F_HELP))
308 return NULL;
401 309
310 offset = ALIGN(offset, __alignof__(struct nf_conn_help));
311 return (struct nf_conn_help *) ((void *)ct + offset);
312}
313#endif /* CONFIG_NF_NAT_NEEDED */
402#endif /* __KERNEL__ */ 314#endif /* __KERNEL__ */
403#endif /* _NF_CONNTRACK_H */ 315#endif /* _NF_CONNTRACK_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index da254525a4ce..7fdc72c01356 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -13,6 +13,9 @@
13#define _NF_CONNTRACK_CORE_H 13#define _NF_CONNTRACK_CORE_H
14 14
15#include <linux/netfilter.h> 15#include <linux/netfilter.h>
16#include <net/netfilter/nf_conntrack_l3proto.h>
17#include <net/netfilter/nf_conntrack_l4proto.h>
18#include <net/netfilter/nf_conntrack_ecache.h>
16 19
17/* This header is used to share core functionality between the 20/* This header is used to share core functionality between the
18 standalone connection tracking module, and the compatibility layer's use 21 standalone connection tracking module, and the compatibility layer's use
@@ -29,7 +32,7 @@ extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf);
29/* Like above, but you already have conntrack read lock. */ 32/* Like above, but you already have conntrack read lock. */
30extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto); 33extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto);
31 34
32struct nf_conntrack_protocol; 35struct nf_conntrack_l4proto;
33 36
34extern int 37extern int
35nf_ct_get_tuple(const struct sk_buff *skb, 38nf_ct_get_tuple(const struct sk_buff *skb,
@@ -39,13 +42,13 @@ nf_ct_get_tuple(const struct sk_buff *skb,
39 u_int8_t protonum, 42 u_int8_t protonum,
40 struct nf_conntrack_tuple *tuple, 43 struct nf_conntrack_tuple *tuple,
41 const struct nf_conntrack_l3proto *l3proto, 44 const struct nf_conntrack_l3proto *l3proto,
42 const struct nf_conntrack_protocol *protocol); 45 const struct nf_conntrack_l4proto *l4proto);
43 46
44extern int 47extern int
45nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, 48nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
46 const struct nf_conntrack_tuple *orig, 49 const struct nf_conntrack_tuple *orig,
47 const struct nf_conntrack_l3proto *l3proto, 50 const struct nf_conntrack_l3proto *l3proto,
48 const struct nf_conntrack_protocol *protocol); 51 const struct nf_conntrack_l4proto *l4proto);
49 52
50/* Find a connection corresponding to a tuple. */ 53/* Find a connection corresponding to a tuple. */
51extern struct nf_conntrack_tuple_hash * 54extern struct nf_conntrack_tuple_hash *
@@ -70,7 +73,14 @@ static inline int nf_conntrack_confirm(struct sk_buff **pskb)
70 73
71extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb); 74extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb);
72 75
76int
77print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
78 struct nf_conntrack_l3proto *l3proto,
79 struct nf_conntrack_l4proto *proto);
80
73extern struct list_head *nf_conntrack_hash; 81extern struct list_head *nf_conntrack_hash;
74extern struct list_head nf_conntrack_expect_list; 82extern struct list_head nf_conntrack_expect_list;
75extern rwlock_t nf_conntrack_lock ; 83extern rwlock_t nf_conntrack_lock ;
84extern struct list_head unconfirmed;
85
76#endif /* _NF_CONNTRACK_CORE_H */ 86#endif /* _NF_CONNTRACK_CORE_H */
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
new file mode 100644
index 000000000000..b62a8a9ec9d8
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -0,0 +1,95 @@
1/*
2 * connection tracking event cache.
3 */
4
5#ifndef _NF_CONNTRACK_ECACHE_H
6#define _NF_CONNTRACK_ECACHE_H
7#include <net/netfilter/nf_conntrack.h>
8
9#include <linux/notifier.h>
10#include <linux/interrupt.h>
11#include <net/netfilter/nf_conntrack_expect.h>
12
13#ifdef CONFIG_NF_CONNTRACK_EVENTS
14struct nf_conntrack_ecache {
15 struct nf_conn *ct;
16 unsigned int events;
17};
18DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
19
20#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
21
22extern struct atomic_notifier_head nf_conntrack_chain;
23extern struct atomic_notifier_head nf_conntrack_expect_chain;
24
25static inline int nf_conntrack_register_notifier(struct notifier_block *nb)
26{
27 return atomic_notifier_chain_register(&nf_conntrack_chain, nb);
28}
29
30static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb)
31{
32 return atomic_notifier_chain_unregister(&nf_conntrack_chain, nb);
33}
34
35static inline int
36nf_conntrack_expect_register_notifier(struct notifier_block *nb)
37{
38 return atomic_notifier_chain_register(&nf_conntrack_expect_chain, nb);
39}
40
41static inline int
42nf_conntrack_expect_unregister_notifier(struct notifier_block *nb)
43{
44 return atomic_notifier_chain_unregister(&nf_conntrack_expect_chain,
45 nb);
46}
47
48extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
49extern void __nf_ct_event_cache_init(struct nf_conn *ct);
50extern void nf_ct_event_cache_flush(void);
51
52static inline void
53nf_conntrack_event_cache(enum ip_conntrack_events event,
54 const struct sk_buff *skb)
55{
56 struct nf_conn *ct = (struct nf_conn *)skb->nfct;
57 struct nf_conntrack_ecache *ecache;
58
59 local_bh_disable();
60 ecache = &__get_cpu_var(nf_conntrack_ecache);
61 if (ct != ecache->ct)
62 __nf_ct_event_cache_init(ct);
63 ecache->events |= event;
64 local_bh_enable();
65}
66
67static inline void nf_conntrack_event(enum ip_conntrack_events event,
68 struct nf_conn *ct)
69{
70 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
71 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
72}
73
74static inline void
75nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
76 struct nf_conntrack_expect *exp)
77{
78 atomic_notifier_call_chain(&nf_conntrack_expect_chain, event, exp);
79}
80
81#else /* CONFIG_NF_CONNTRACK_EVENTS */
82
83static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
84 const struct sk_buff *skb) {}
85static inline void nf_conntrack_event(enum ip_conntrack_events event,
86 struct nf_conn *ct) {}
87static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
88static inline void
89nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
90 struct nf_conntrack_expect *exp) {}
91static inline void nf_ct_event_cache_flush(void) {}
92#endif /* CONFIG_NF_CONNTRACK_EVENTS */
93
94#endif /*_NF_CONNTRACK_ECACHE_H*/
95
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
new file mode 100644
index 000000000000..41bcc9eb4206
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -0,0 +1,80 @@
1/*
2 * connection tracking expectations.
3 */
4
5#ifndef _NF_CONNTRACK_EXPECT_H
6#define _NF_CONNTRACK_EXPECT_H
7#include <net/netfilter/nf_conntrack.h>
8
9extern struct list_head nf_conntrack_expect_list;
10extern struct kmem_cache *nf_conntrack_expect_cachep;
11extern struct file_operations exp_file_ops;
12
13struct nf_conntrack_expect
14{
15 /* Internal linked list (global expectation list) */
16 struct list_head list;
17
18 /* We expect this tuple, with the following mask */
19 struct nf_conntrack_tuple tuple, mask;
20
21 /* Function to call after setup and insertion */
22 void (*expectfn)(struct nf_conn *new,
23 struct nf_conntrack_expect *this);
24
25 /* Helper to assign to new connection */
26 struct nf_conntrack_helper *helper;
27
28 /* The conntrack of the master connection */
29 struct nf_conn *master;
30
31 /* Timer function; deletes the expectation. */
32 struct timer_list timeout;
33
34 /* Usage count. */
35 atomic_t use;
36
37 /* Unique ID */
38 unsigned int id;
39
40 /* Flags */
41 unsigned int flags;
42
43#ifdef CONFIG_NF_NAT_NEEDED
44 __be32 saved_ip;
45 /* This is the original per-proto part, used to map the
46 * expected connection the way the recipient expects. */
47 union nf_conntrack_man_proto saved_proto;
48 /* Direction relative to the master connection. */
49 enum ip_conntrack_dir dir;
50#endif
51};
52
53#define NF_CT_EXPECT_PERMANENT 0x1
54
55
56struct nf_conntrack_expect *
57__nf_conntrack_expect_find(const struct nf_conntrack_tuple *tuple);
58
59struct nf_conntrack_expect *
60nf_conntrack_expect_find_get(const struct nf_conntrack_tuple *tuple);
61
62struct nf_conntrack_expect *
63find_expectation(const struct nf_conntrack_tuple *tuple);
64
65void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
66void nf_ct_remove_expectations(struct nf_conn *ct);
67void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp);
68
69/* Allocate space for an expectation: this is mandatory before calling
70 nf_conntrack_expect_related. You will have to call put afterwards. */
71struct nf_conntrack_expect *nf_conntrack_expect_alloc(struct nf_conn *me);
72void nf_conntrack_expect_init(struct nf_conntrack_expect *, int,
73 union nf_conntrack_address *,
74 union nf_conntrack_address *,
75 u_int8_t, __be16 *, __be16 *);
76void nf_conntrack_expect_put(struct nf_conntrack_expect *exp);
77int nf_conntrack_expect_related(struct nf_conntrack_expect *expect);
78
79#endif /*_NF_CONNTRACK_EXPECT_H*/
80
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 86ec8174ad02..8c72ac9f0ab8 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -34,20 +34,22 @@ struct nf_conntrack_helper
34 struct nf_conn *ct, 34 struct nf_conn *ct,
35 enum ip_conntrack_info conntrackinfo); 35 enum ip_conntrack_info conntrackinfo);
36 36
37 void (*destroy)(struct nf_conn *ct);
38
37 int (*to_nfattr)(struct sk_buff *skb, const struct nf_conn *ct); 39 int (*to_nfattr)(struct sk_buff *skb, const struct nf_conn *ct);
38}; 40};
39 41
40extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 42extern struct nf_conntrack_helper *
41extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 43__nf_ct_helper_find(const struct nf_conntrack_tuple *tuple);
42 44
43/* Allocate space for an expectation: this is mandatory before calling 45extern struct nf_conntrack_helper *
44 nf_conntrack_expect_related. You will have to call put afterwards. */ 46nf_ct_helper_find_get( const struct nf_conntrack_tuple *tuple);
45extern struct nf_conntrack_expect *
46nf_conntrack_expect_alloc(struct nf_conn *master);
47extern void nf_conntrack_expect_put(struct nf_conntrack_expect *exp);
48 47
49/* Add an expected connection: can have more than one per connection */ 48extern struct nf_conntrack_helper *
50extern int nf_conntrack_expect_related(struct nf_conntrack_expect *exp); 49__nf_conntrack_helper_find_byname(const char *name);
51extern void nf_conntrack_unexpect_related(struct nf_conntrack_expect *exp); 50
51extern void nf_ct_helper_put(struct nf_conntrack_helper *helper);
52extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
53extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
52 54
53#endif /*_NF_CONNTRACK_HELPER_H*/ 55#endif /*_NF_CONNTRACK_HELPER_H*/
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index dac43b15a5b0..664ddcffe00d 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -18,9 +18,6 @@ struct nfattr;
18 18
19struct nf_conntrack_l3proto 19struct nf_conntrack_l3proto
20{ 20{
21 /* Next pointer. */
22 struct list_head list;
23
24 /* L3 Protocol Family number. ex) PF_INET */ 21 /* L3 Protocol Family number. ex) PF_INET */
25 u_int16_t l3proto; 22 u_int16_t l3proto;
26 23
@@ -78,6 +75,12 @@ struct nf_conntrack_l3proto
78 int (*nfattr_to_tuple)(struct nfattr *tb[], 75 int (*nfattr_to_tuple)(struct nfattr *tb[],
79 struct nf_conntrack_tuple *t); 76 struct nf_conntrack_tuple *t);
80 77
78#ifdef CONFIG_SYSCTL
79 struct ctl_table_header *ctl_table_header;
80 struct ctl_table *ctl_table_path;
81 struct ctl_table *ctl_table;
82#endif /* CONFIG_SYSCTL */
83
81 /* Module (if any) which this is connected to. */ 84 /* Module (if any) which this is connected to. */
82 struct module *me; 85 struct module *me;
83}; 86};
@@ -86,7 +89,7 @@ extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX];
86 89
87/* Protocol registration. */ 90/* Protocol registration. */
88extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); 91extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
89extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); 92extern int nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto);
90 93
91extern struct nf_conntrack_l3proto * 94extern struct nf_conntrack_l3proto *
92nf_ct_l3proto_find_get(u_int16_t l3proto); 95nf_ct_l3proto_find_get(u_int16_t l3proto);
@@ -96,13 +99,13 @@ extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
96/* Existing built-in protocols */ 99/* Existing built-in protocols */
97extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4; 100extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4;
98extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6; 101extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6;
99extern struct nf_conntrack_l3proto nf_conntrack_generic_l3proto; 102extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic;
100 103
101static inline struct nf_conntrack_l3proto * 104static inline struct nf_conntrack_l3proto *
102__nf_ct_l3proto_find(u_int16_t l3proto) 105__nf_ct_l3proto_find(u_int16_t l3proto)
103{ 106{
104 if (unlikely(l3proto >= AF_MAX)) 107 if (unlikely(l3proto >= AF_MAX))
105 return &nf_conntrack_generic_l3proto; 108 return &nf_conntrack_l3proto_generic;
106 return nf_ct_l3protos[l3proto]; 109 return nf_ct_l3protos[l3proto];
107} 110}
108 111
diff --git a/include/net/netfilter/nf_conntrack_protocol.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 1f33737fcea5..fc8af08ff542 100644
--- a/include/net/netfilter/nf_conntrack_protocol.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Header for use in defining a given protocol for connection tracking. 2 * Header for use in defining a given L4 protocol for connection tracking.
3 * 3 *
4 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp> 4 * 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
5 * - generalized L3 protocol dependent part. 5 * - generalized L3 protocol dependent part.
@@ -7,23 +7,20 @@
7 * Derived from include/linux/netfiter_ipv4/ip_conntrack_protcol.h 7 * Derived from include/linux/netfiter_ipv4/ip_conntrack_protcol.h
8 */ 8 */
9 9
10#ifndef _NF_CONNTRACK_PROTOCOL_H 10#ifndef _NF_CONNTRACK_L4PROTO_H
11#define _NF_CONNTRACK_PROTOCOL_H 11#define _NF_CONNTRACK_L4PROTO_H
12#include <net/netfilter/nf_conntrack.h> 12#include <net/netfilter/nf_conntrack.h>
13 13
14struct seq_file; 14struct seq_file;
15struct nfattr; 15struct nfattr;
16 16
17struct nf_conntrack_protocol 17struct nf_conntrack_l4proto
18{ 18{
19 /* Next pointer. */
20 struct list_head list;
21
22 /* L3 Protocol number. */ 19 /* L3 Protocol number. */
23 u_int16_t l3proto; 20 u_int16_t l3proto;
24 21
25 /* Protocol number. */ 22 /* L4 Protocol number. */
26 u_int8_t proto; 23 u_int8_t l4proto;
27 24
28 /* Protocol name */ 25 /* Protocol name */
29 const char *name; 26 const char *name;
@@ -79,30 +76,40 @@ struct nf_conntrack_protocol
79 int (*nfattr_to_tuple)(struct nfattr *tb[], 76 int (*nfattr_to_tuple)(struct nfattr *tb[],
80 struct nf_conntrack_tuple *t); 77 struct nf_conntrack_tuple *t);
81 78
79#ifdef CONFIG_SYSCTL
80 struct ctl_table_header **ctl_table_header;
81 struct ctl_table *ctl_table;
82 unsigned int *ctl_table_users;
83#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
84 struct ctl_table_header *ctl_compat_table_header;
85 struct ctl_table *ctl_compat_table;
86#endif
87#endif
88
82 /* Module (if any) which this is connected to. */ 89 /* Module (if any) which this is connected to. */
83 struct module *me; 90 struct module *me;
84}; 91};
85 92
86/* Existing built-in protocols */ 93/* Existing built-in protocols */
87extern struct nf_conntrack_protocol nf_conntrack_protocol_tcp6; 94extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
88extern struct nf_conntrack_protocol nf_conntrack_protocol_udp4; 95extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
89extern struct nf_conntrack_protocol nf_conntrack_protocol_udp6; 96extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
90extern struct nf_conntrack_protocol nf_conntrack_generic_protocol; 97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
91 98
92#define MAX_NF_CT_PROTO 256 99#define MAX_NF_CT_PROTO 256
93extern struct nf_conntrack_protocol **nf_ct_protos[PF_MAX]; 100extern struct nf_conntrack_l4proto **nf_ct_protos[PF_MAX];
94 101
95extern struct nf_conntrack_protocol * 102extern struct nf_conntrack_l4proto *
96__nf_ct_proto_find(u_int16_t l3proto, u_int8_t protocol); 103__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
97 104
98extern struct nf_conntrack_protocol * 105extern struct nf_conntrack_l4proto *
99nf_ct_proto_find_get(u_int16_t l3proto, u_int8_t protocol); 106nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t protocol);
100 107
101extern void nf_ct_proto_put(struct nf_conntrack_protocol *p); 108extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
102 109
103/* Protocol registration. */ 110/* Protocol registration. */
104extern int nf_conntrack_protocol_register(struct nf_conntrack_protocol *proto); 111extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
105extern void nf_conntrack_protocol_unregister(struct nf_conntrack_protocol *proto); 112extern int nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);
106 113
107/* Generic netlink helpers */ 114/* Generic netlink helpers */
108extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb, 115extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb,
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index 530ef1f75283..5d72b16e876f 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -24,10 +24,10 @@
24 24
25/* The l3 protocol-specific manipulable parts of the tuple: always in 25/* The l3 protocol-specific manipulable parts of the tuple: always in
26 network order! */ 26 network order! */
27union nf_conntrack_man_l3proto { 27union nf_conntrack_address {
28 u_int32_t all[NF_CT_TUPLE_L3SIZE]; 28 u_int32_t all[NF_CT_TUPLE_L3SIZE];
29 u_int32_t ip; 29 __be32 ip;
30 u_int32_t ip6[4]; 30 __be32 ip6[4];
31}; 31};
32 32
33/* The protocol-specific manipulable parts of the tuple: always in 33/* The protocol-specific manipulable parts of the tuple: always in
@@ -38,23 +38,26 @@ union nf_conntrack_man_proto
38 u_int16_t all; 38 u_int16_t all;
39 39
40 struct { 40 struct {
41 u_int16_t port; 41 __be16 port;
42 } tcp; 42 } tcp;
43 struct { 43 struct {
44 u_int16_t port; 44 __be16 port;
45 } udp; 45 } udp;
46 struct { 46 struct {
47 u_int16_t id; 47 __be16 id;
48 } icmp; 48 } icmp;
49 struct { 49 struct {
50 u_int16_t port; 50 __be16 port;
51 } sctp; 51 } sctp;
52 struct {
53 __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
54 } gre;
52}; 55};
53 56
54/* The manipulable part of the tuple. */ 57/* The manipulable part of the tuple. */
55struct nf_conntrack_man 58struct nf_conntrack_man
56{ 59{
57 union nf_conntrack_man_l3proto u3; 60 union nf_conntrack_address u3;
58 union nf_conntrack_man_proto u; 61 union nf_conntrack_man_proto u;
59 /* Layer 3 protocol */ 62 /* Layer 3 protocol */
60 u_int16_t l3num; 63 u_int16_t l3num;
@@ -67,27 +70,26 @@ struct nf_conntrack_tuple
67 70
68 /* These are the parts of the tuple which are fixed. */ 71 /* These are the parts of the tuple which are fixed. */
69 struct { 72 struct {
70 union { 73 union nf_conntrack_address u3;
71 u_int32_t all[NF_CT_TUPLE_L3SIZE];
72 u_int32_t ip;
73 u_int32_t ip6[4];
74 } u3;
75 union { 74 union {
76 /* Add other protocols here. */ 75 /* Add other protocols here. */
77 u_int16_t all; 76 u_int16_t all;
78 77
79 struct { 78 struct {
80 u_int16_t port; 79 __be16 port;
81 } tcp; 80 } tcp;
82 struct { 81 struct {
83 u_int16_t port; 82 __be16 port;
84 } udp; 83 } udp;
85 struct { 84 struct {
86 u_int8_t type, code; 85 u_int8_t type, code;
87 } icmp; 86 } icmp;
88 struct { 87 struct {
89 u_int16_t port; 88 __be16 port;
90 } sctp; 89 } sctp;
90 struct {
91 __be16 key;
92 } gre;
91 } u; 93 } u;
92 94
93 /* The protocol. */ 95 /* The protocol. */
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
new file mode 100644
index 000000000000..61c62068ca6b
--- /dev/null
+++ b/include/net/netfilter/nf_nat.h
@@ -0,0 +1,77 @@
1#ifndef _NF_NAT_H
2#define _NF_NAT_H
3#include <linux/netfilter_ipv4.h>
4#include <net/netfilter/nf_conntrack_tuple.h>
5
6#define NF_NAT_MAPPING_TYPE_MAX_NAMELEN 16
7
8enum nf_nat_manip_type
9{
10 IP_NAT_MANIP_SRC,
11 IP_NAT_MANIP_DST
12};
13
14/* SRC manip occurs POST_ROUTING or LOCAL_IN */
15#define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN)
16
17#define IP_NAT_RANGE_MAP_IPS 1
18#define IP_NAT_RANGE_PROTO_SPECIFIED 2
19
20/* NAT sequence number modifications */
21struct nf_nat_seq {
22 /* position of the last TCP sequence number modification (if any) */
23 u_int32_t correction_pos;
24
25 /* sequence number offset before and after last modification */
26 int16_t offset_before, offset_after;
27};
28
29/* Single range specification. */
30struct nf_nat_range
31{
32 /* Set to OR of flags above. */
33 unsigned int flags;
34
35 /* Inclusive: network order. */
36 __be32 min_ip, max_ip;
37
38 /* Inclusive: network order */
39 union nf_conntrack_man_proto min, max;
40};
41
42/* For backwards compat: don't use in modern code. */
43struct nf_nat_multi_range_compat
44{
45 unsigned int rangesize; /* Must be 1. */
46
47 /* hangs off end. */
48 struct nf_nat_range range[1];
49};
50
51#ifdef __KERNEL__
52#include <linux/list.h>
53
54/* The structure embedded in the conntrack structure. */
55struct nf_nat_info
56{
57 struct list_head bysource;
58 struct nf_nat_seq seq[IP_CT_DIR_MAX];
59};
60
61struct nf_conn;
62
63/* Set up the info structure to map into this range. */
64extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
65 const struct nf_nat_range *range,
66 unsigned int hooknum);
67
68/* Is this tuple already taken? (not by us)*/
69extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
70 const struct nf_conn *ignored_conntrack);
71
72extern int nf_nat_module_is_loaded;
73
74#else /* !__KERNEL__: iptables wants this to compile. */
75#define nf_nat_multi_range nf_nat_multi_range_compat
76#endif /*__KERNEL__*/
77#endif
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
new file mode 100644
index 000000000000..9778ffa93440
--- /dev/null
+++ b/include/net/netfilter/nf_nat_core.h
@@ -0,0 +1,27 @@
1#ifndef _NF_NAT_CORE_H
2#define _NF_NAT_CORE_H
3#include <linux/list.h>
4#include <net/netfilter/nf_conntrack.h>
5
6/* This header used to share core functionality between the standalone
7 NAT module, and the compatibility layer's use of NAT for masquerading. */
8
9extern unsigned int nf_nat_packet(struct nf_conn *ct,
10 enum ip_conntrack_info ctinfo,
11 unsigned int hooknum,
12 struct sk_buff **pskb);
13
14extern int nf_nat_icmp_reply_translation(struct nf_conn *ct,
15 enum ip_conntrack_info ctinfo,
16 unsigned int hooknum,
17 struct sk_buff **pskb);
18
19static inline int nf_nat_initialized(struct nf_conn *ct,
20 enum nf_nat_manip_type manip)
21{
22 if (manip == IP_NAT_MANIP_SRC)
23 return test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status);
24 else
25 return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status);
26}
27#endif /* _NF_NAT_CORE_H */
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
new file mode 100644
index 000000000000..ec98ecf95fc8
--- /dev/null
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -0,0 +1,32 @@
1#ifndef _NF_NAT_HELPER_H
2#define _NF_NAT_HELPER_H
3/* NAT protocol helper routines. */
4
5#include <net/netfilter/nf_conntrack.h>
6
7struct sk_buff;
8
9/* These return true or false. */
10extern int nf_nat_mangle_tcp_packet(struct sk_buff **skb,
11 struct nf_conn *ct,
12 enum ip_conntrack_info ctinfo,
13 unsigned int match_offset,
14 unsigned int match_len,
15 const char *rep_buffer,
16 unsigned int rep_len);
17extern int nf_nat_mangle_udp_packet(struct sk_buff **skb,
18 struct nf_conn *ct,
19 enum ip_conntrack_info ctinfo,
20 unsigned int match_offset,
21 unsigned int match_len,
22 const char *rep_buffer,
23 unsigned int rep_len);
24extern int nf_nat_seq_adjust(struct sk_buff **pskb,
25 struct nf_conn *ct,
26 enum ip_conntrack_info ctinfo);
27
28/* Setup NAT on this expected conntrack so it follows master, but goes
29 * to port ct->master->saved_proto. */
30extern void nf_nat_follow_master(struct nf_conn *ct,
31 struct nf_conntrack_expect *this);
32#endif
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h
new file mode 100644
index 000000000000..a9ec5ef61468
--- /dev/null
+++ b/include/net/netfilter/nf_nat_protocol.h
@@ -0,0 +1,70 @@
1/* Header for use in defining a given protocol. */
2#ifndef _NF_NAT_PROTOCOL_H
3#define _NF_NAT_PROTOCOL_H
4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
6
7struct nf_nat_range;
8
9struct nf_nat_protocol
10{
11 /* Protocol name */
12 const char *name;
13
14 /* Protocol number. */
15 unsigned int protonum;
16
17 struct module *me;
18
19 /* Translate a packet to the target according to manip type.
20 Return true if succeeded. */
21 int (*manip_pkt)(struct sk_buff **pskb,
22 unsigned int iphdroff,
23 const struct nf_conntrack_tuple *tuple,
24 enum nf_nat_manip_type maniptype);
25
26 /* Is the manipable part of the tuple between min and max incl? */
27 int (*in_range)(const struct nf_conntrack_tuple *tuple,
28 enum nf_nat_manip_type maniptype,
29 const union nf_conntrack_man_proto *min,
30 const union nf_conntrack_man_proto *max);
31
32 /* Alter the per-proto part of the tuple (depending on
33 maniptype), to give a unique tuple in the given range if
34 possible; return false if not. Per-protocol part of tuple
35 is initialized to the incoming packet. */
36 int (*unique_tuple)(struct nf_conntrack_tuple *tuple,
37 const struct nf_nat_range *range,
38 enum nf_nat_manip_type maniptype,
39 const struct nf_conn *ct);
40
41 int (*range_to_nfattr)(struct sk_buff *skb,
42 const struct nf_nat_range *range);
43
44 int (*nfattr_to_range)(struct nfattr *tb[],
45 struct nf_nat_range *range);
46};
47
48/* Protocol registration. */
49extern int nf_nat_protocol_register(struct nf_nat_protocol *proto);
50extern void nf_nat_protocol_unregister(struct nf_nat_protocol *proto);
51
52extern struct nf_nat_protocol *nf_nat_proto_find_get(u_int8_t protocol);
53extern void nf_nat_proto_put(struct nf_nat_protocol *proto);
54
55/* Built-in protocols. */
56extern struct nf_nat_protocol nf_nat_protocol_tcp;
57extern struct nf_nat_protocol nf_nat_protocol_udp;
58extern struct nf_nat_protocol nf_nat_protocol_icmp;
59extern struct nf_nat_protocol nf_nat_unknown_protocol;
60
61extern int init_protocols(void) __init;
62extern void cleanup_protocols(void);
63extern struct nf_nat_protocol *find_nat_proto(u_int16_t protonum);
64
65extern int nf_nat_port_range_to_nfattr(struct sk_buff *skb,
66 const struct nf_nat_range *range);
67extern int nf_nat_port_nfattr_to_range(struct nfattr *tb[],
68 struct nf_nat_range *range);
69
70#endif /*_NF_NAT_PROTO_H*/
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
new file mode 100644
index 000000000000..f191c672bcc6
--- /dev/null
+++ b/include/net/netfilter/nf_nat_rule.h
@@ -0,0 +1,35 @@
1#ifndef _NF_NAT_RULE_H
2#define _NF_NAT_RULE_H
3#include <net/netfilter/nf_conntrack.h>
4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter_ipv4/ip_tables.h>
6
7/* Compatibility definitions for ipt_FOO modules */
8#define ip_nat_range nf_nat_range
9#define ip_conntrack_tuple nf_conntrack_tuple
10#define ip_conntrack_get nf_ct_get
11#define ip_conntrack nf_conn
12#define ip_nat_setup_info nf_nat_setup_info
13#define ip_nat_multi_range_compat nf_nat_multi_range_compat
14#define ip_ct_iterate_cleanup nf_ct_iterate_cleanup
15#define IP_NF_ASSERT NF_CT_ASSERT
16
17extern int nf_nat_rule_init(void) __init;
18extern void nf_nat_rule_cleanup(void);
19extern int nf_nat_rule_find(struct sk_buff **pskb,
20 unsigned int hooknum,
21 const struct net_device *in,
22 const struct net_device *out,
23 struct nf_conn *ct,
24 struct nf_nat_info *info);
25
26extern unsigned int
27alloc_null_binding(struct nf_conn *ct,
28 struct nf_nat_info *info,
29 unsigned int hooknum);
30
31extern unsigned int
32alloc_null_binding_confirmed(struct nf_conn *ct,
33 struct nf_nat_info *info,
34 unsigned int hooknum);
35#endif /* _NF_NAT_RULE_H */
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 12c214b9eadf..83da7e1f0d3d 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -111,13 +111,34 @@ struct netlbl_lsm_cache {
111 void (*free) (const void *data); 111 void (*free) (const void *data);
112 void *data; 112 void *data;
113}; 113};
114/* The catmap bitmap field MUST be a power of two in length and large
115 * enough to hold at least 240 bits. Special care (i.e. check the code!)
116 * should be used when changing these values as the LSM implementation
117 * probably has functions which rely on the sizes of these types to speed
118 * processing. */
119#define NETLBL_CATMAP_MAPTYPE u64
120#define NETLBL_CATMAP_MAPCNT 4
121#define NETLBL_CATMAP_MAPSIZE (sizeof(NETLBL_CATMAP_MAPTYPE) * 8)
122#define NETLBL_CATMAP_SIZE (NETLBL_CATMAP_MAPSIZE * \
123 NETLBL_CATMAP_MAPCNT)
124#define NETLBL_CATMAP_BIT (NETLBL_CATMAP_MAPTYPE)0x01
125struct netlbl_lsm_secattr_catmap {
126 u32 startbit;
127 NETLBL_CATMAP_MAPTYPE bitmap[NETLBL_CATMAP_MAPCNT];
128 struct netlbl_lsm_secattr_catmap *next;
129};
130#define NETLBL_SECATTR_NONE 0x00000000
131#define NETLBL_SECATTR_DOMAIN 0x00000001
132#define NETLBL_SECATTR_CACHE 0x00000002
133#define NETLBL_SECATTR_MLS_LVL 0x00000004
134#define NETLBL_SECATTR_MLS_CAT 0x00000008
114struct netlbl_lsm_secattr { 135struct netlbl_lsm_secattr {
136 u32 flags;
137
115 char *domain; 138 char *domain;
116 139
117 u32 mls_lvl; 140 u32 mls_lvl;
118 u32 mls_lvl_vld; 141 struct netlbl_lsm_secattr_catmap *mls_cat;
119 unsigned char *mls_cat;
120 size_t mls_cat_len;
121 142
122 struct netlbl_lsm_cache *cache; 143 struct netlbl_lsm_cache *cache;
123}; 144};
@@ -165,18 +186,54 @@ static inline void netlbl_secattr_cache_free(struct netlbl_lsm_cache *cache)
165} 186}
166 187
167/** 188/**
189 * netlbl_secattr_catmap_alloc - Allocate a LSM secattr catmap
190 * @flags: memory allocation flags
191 *
192 * Description:
193 * Allocate memory for a LSM secattr catmap, returns a pointer on success, NULL
194 * on failure.
195 *
196 */
197static inline struct netlbl_lsm_secattr_catmap *netlbl_secattr_catmap_alloc(
198 gfp_t flags)
199{
200 return kzalloc(sizeof(struct netlbl_lsm_secattr_catmap), flags);
201}
202
203/**
204 * netlbl_secattr_catmap_free - Free a LSM secattr catmap
205 * @catmap: the category bitmap
206 *
207 * Description:
208 * Free a LSM secattr catmap.
209 *
210 */
211static inline void netlbl_secattr_catmap_free(
212 struct netlbl_lsm_secattr_catmap *catmap)
213{
214 struct netlbl_lsm_secattr_catmap *iter;
215
216 do {
217 iter = catmap;
218 catmap = catmap->next;
219 kfree(iter);
220 } while (catmap);
221}
222
223/**
168 * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct 224 * netlbl_secattr_init - Initialize a netlbl_lsm_secattr struct
169 * @secattr: the struct to initialize 225 * @secattr: the struct to initialize
170 * 226 *
171 * Description: 227 * Description:
172 * Initialize an already allocated netlbl_lsm_secattr struct. Returns zero on 228 * Initialize an already allocated netlbl_lsm_secattr struct.
173 * success, negative values on error.
174 * 229 *
175 */ 230 */
176static inline int netlbl_secattr_init(struct netlbl_lsm_secattr *secattr) 231static inline void netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
177{ 232{
178 memset(secattr, 0, sizeof(*secattr)); 233 secattr->flags = 0;
179 return 0; 234 secattr->domain = NULL;
235 secattr->mls_cat = NULL;
236 secattr->cache = NULL;
180} 237}
181 238
182/** 239/**
@@ -193,7 +250,8 @@ static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr)
193 if (secattr->cache) 250 if (secattr->cache)
194 netlbl_secattr_cache_free(secattr->cache); 251 netlbl_secattr_cache_free(secattr->cache);
195 kfree(secattr->domain); 252 kfree(secattr->domain);
196 kfree(secattr->mls_cat); 253 if (secattr->mls_cat)
254 netlbl_secattr_catmap_free(secattr->mls_cat);
197} 255}
198 256
199/** 257/**
@@ -205,7 +263,7 @@ static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr)
205 * pointer on success, or NULL on failure. 263 * pointer on success, or NULL on failure.
206 * 264 *
207 */ 265 */
208static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(int flags) 266static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(gfp_t flags)
209{ 267{
210 return kzalloc(sizeof(struct netlbl_lsm_secattr), flags); 268 return kzalloc(sizeof(struct netlbl_lsm_secattr), flags);
211} 269}
@@ -224,6 +282,51 @@ static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr)
224 kfree(secattr); 282 kfree(secattr);
225} 283}
226 284
285#ifdef CONFIG_NETLABEL
286int netlbl_secattr_catmap_walk(struct netlbl_lsm_secattr_catmap *catmap,
287 u32 offset);
288int netlbl_secattr_catmap_walk_rng(struct netlbl_lsm_secattr_catmap *catmap,
289 u32 offset);
290int netlbl_secattr_catmap_setbit(struct netlbl_lsm_secattr_catmap *catmap,
291 u32 bit,
292 gfp_t flags);
293int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap,
294 u32 start,
295 u32 end,
296 gfp_t flags);
297#else
298static inline int netlbl_secattr_catmap_walk(
299 struct netlbl_lsm_secattr_catmap *catmap,
300 u32 offset)
301{
302 return -ENOENT;
303}
304
305static inline int netlbl_secattr_catmap_walk_rng(
306 struct netlbl_lsm_secattr_catmap *catmap,
307 u32 offset)
308{
309 return -ENOENT;
310}
311
312static inline int netlbl_secattr_catmap_setbit(
313 struct netlbl_lsm_secattr_catmap *catmap,
314 u32 bit,
315 gfp_t flags)
316{
317 return 0;
318}
319
320static inline int netlbl_secattr_catmap_setrng(
321 struct netlbl_lsm_secattr_catmap *catmap,
322 u32 start,
323 u32 end,
324 gfp_t flags)
325{
326 return 0;
327}
328#endif
329
227/* 330/*
228 * LSM protocol operations 331 * LSM protocol operations
229 */ 332 */
diff --git a/include/net/netlink.h b/include/net/netlink.h
index ce5cba19c393..bcaf67b7a19d 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netlink.h> 5#include <linux/netlink.h>
6#include <linux/jiffies.h>
6 7
7/* ======================================================================== 8/* ========================================================================
8 * Netlink Messages and Attributes Interface (As Seen On TV) 9 * Netlink Messages and Attributes Interface (As Seen On TV)
@@ -500,14 +501,15 @@ static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb,
500 501
501/** 502/**
502 * nlmsg_new - Allocate a new netlink message 503 * nlmsg_new - Allocate a new netlink message
503 * @size: maximum size of message 504 * @payload: size of the message payload
504 * @flags: the type of memory to allocate. 505 * @flags: the type of memory to allocate.
505 * 506 *
506 * Use NLMSG_GOODSIZE if size isn't know and you need a good default size. 507 * Use NLMSG_DEFAULT_SIZE if the size of the payload isn't known
508 * and a good default is needed.
507 */ 509 */
508static inline struct sk_buff *nlmsg_new(int size, gfp_t flags) 510static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags)
509{ 511{
510 return alloc_skb(size, flags); 512 return alloc_skb(nlmsg_total_size(payload), flags);
511} 513}
512 514
513/** 515/**
@@ -828,6 +830,9 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
828#define NLA_PUT_U16(skb, attrtype, value) \ 830#define NLA_PUT_U16(skb, attrtype, value) \
829 NLA_PUT_TYPE(skb, u16, attrtype, value) 831 NLA_PUT_TYPE(skb, u16, attrtype, value)
830 832
833#define NLA_PUT_LE16(skb, attrtype, value) \
834 NLA_PUT_TYPE(skb, __le16, attrtype, value)
835
831#define NLA_PUT_U32(skb, attrtype, value) \ 836#define NLA_PUT_U32(skb, attrtype, value) \
832 NLA_PUT_TYPE(skb, u32, attrtype, value) 837 NLA_PUT_TYPE(skb, u32, attrtype, value)
833 838
@@ -874,6 +879,15 @@ static inline u16 nla_get_u16(struct nlattr *nla)
874} 879}
875 880
876/** 881/**
882 * nla_get_le16 - return payload of __le16 attribute
883 * @nla: __le16 netlink attribute
884 */
885static inline __le16 nla_get_le16(struct nlattr *nla)
886{
887 return *(__le16 *) nla_data(nla);
888}
889
890/**
877 * nla_get_u8 - return payload of u8 attribute 891 * nla_get_u8 - return payload of u8 attribute
878 * @nla: u8 netlink attribute 892 * @nla: u8 netlink attribute
879 */ 893 */
diff --git a/include/net/protocol.h b/include/net/protocol.h
index c643bce64e55..105bf12b0c79 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -50,7 +50,7 @@ struct inet6_protocol
50 void (*err_handler)(struct sk_buff *skb, 50 void (*err_handler)(struct sk_buff *skb,
51 struct inet6_skb_parm *opt, 51 struct inet6_skb_parm *opt,
52 int type, int code, int offset, 52 int type, int code, int offset,
53 __u32 info); 53 __be32 info);
54 54
55 int (*gso_send_check)(struct sk_buff *skb); 55 int (*gso_send_check)(struct sk_buff *skb);
56 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 56 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
@@ -71,7 +71,7 @@ struct inet_protosw {
71 71
72 /* These two fields form the lookup key. */ 72 /* These two fields form the lookup key. */
73 unsigned short type; /* This is the 2nd argument to socket(2). */ 73 unsigned short type; /* This is the 2nd argument to socket(2). */
74 int protocol; /* This is the L4 protocol number. */ 74 unsigned short protocol; /* This is the L4 protocol number. */
75 75
76 struct proto *prot; 76 struct proto *prot;
77 const struct proto_ops *ops; 77 const struct proto_ops *ops;
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
index 14476a71725e..af8960878ef4 100644
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -21,7 +21,7 @@ extern void rawv6_err(struct sock *sk,
21 struct sk_buff *skb, 21 struct sk_buff *skb,
22 struct inet6_skb_parm *opt, 22 struct inet6_skb_parm *opt,
23 int type, int code, 23 int type, int code,
24 int offset, u32 info); 24 int offset, __be32 info);
25 25
26#endif 26#endif
27 27
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 8e165ca16bd8..7aed02ce2b65 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -28,14 +28,15 @@ struct proto;
28 28
29struct request_sock_ops { 29struct request_sock_ops {
30 int family; 30 int family;
31 kmem_cache_t *slab;
32 int obj_size; 31 int obj_size;
32 struct kmem_cache *slab;
33 int (*rtx_syn_ack)(struct sock *sk, 33 int (*rtx_syn_ack)(struct sock *sk,
34 struct request_sock *req, 34 struct request_sock *req,
35 struct dst_entry *dst); 35 struct dst_entry *dst);
36 void (*send_ack)(struct sk_buff *skb, 36 void (*send_ack)(struct sk_buff *skb,
37 struct request_sock *req); 37 struct request_sock *req);
38 void (*send_reset)(struct sk_buff *skb); 38 void (*send_reset)(struct sock *sk,
39 struct sk_buff *skb);
39 void (*destructor)(struct request_sock *req); 40 void (*destructor)(struct request_sock *req);
40}; 41};
41 42
@@ -51,14 +52,15 @@ struct request_sock {
51 u32 rcv_wnd; /* rcv_wnd offered first time */ 52 u32 rcv_wnd; /* rcv_wnd offered first time */
52 u32 ts_recent; 53 u32 ts_recent;
53 unsigned long expires; 54 unsigned long expires;
54 struct request_sock_ops *rsk_ops; 55 const struct request_sock_ops *rsk_ops;
55 struct sock *sk; 56 struct sock *sk;
56 u32 secid; 57 u32 secid;
58 u32 peer_secid;
57}; 59};
58 60
59static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops) 61static inline struct request_sock *reqsk_alloc(const struct request_sock_ops *ops)
60{ 62{
61 struct request_sock *req = kmem_cache_alloc(ops->slab, SLAB_ATOMIC); 63 struct request_sock *req = kmem_cache_alloc(ops->slab, GFP_ATOMIC);
62 64
63 if (req != NULL) 65 if (req != NULL)
64 req->rsk_ops = ops; 66 req->rsk_ops = ops;
@@ -120,7 +122,7 @@ struct request_sock_queue {
120}; 122};
121 123
122extern int reqsk_queue_alloc(struct request_sock_queue *queue, 124extern int reqsk_queue_alloc(struct request_sock_queue *queue,
123 const int nr_table_entries); 125 unsigned int nr_table_entries);
124 126
125static inline struct listen_sock *reqsk_queue_yank_listen_sk(struct request_sock_queue *queue) 127static inline struct listen_sock *reqsk_queue_yank_listen_sk(struct request_sock_queue *queue)
126{ 128{
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index b0e9108a4e18..82086392735a 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -60,6 +60,7 @@ struct Qdisc_class_ops
60 int (*graft)(struct Qdisc *, unsigned long cl, 60 int (*graft)(struct Qdisc *, unsigned long cl,
61 struct Qdisc *, struct Qdisc **); 61 struct Qdisc *, struct Qdisc **);
62 struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl); 62 struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl);
63 void (*qlen_notify)(struct Qdisc *, unsigned long);
63 64
64 /* Class manipulation routines */ 65 /* Class manipulation routines */
65 unsigned long (*get)(struct Qdisc *, u32 classid); 66 unsigned long (*get)(struct Qdisc *, u32 classid);
@@ -144,7 +145,7 @@ struct tcf_proto
144 void *root; 145 void *root;
145 int (*classify)(struct sk_buff*, struct tcf_proto*, 146 int (*classify)(struct sk_buff*, struct tcf_proto*,
146 struct tcf_result *); 147 struct tcf_result *);
147 u32 protocol; 148 __be16 protocol;
148 149
149 /* All the rest */ 150 /* All the rest */
150 u32 prio; 151 u32 prio;
@@ -172,9 +173,10 @@ extern void dev_activate(struct net_device *dev);
172extern void dev_deactivate(struct net_device *dev); 173extern void dev_deactivate(struct net_device *dev);
173extern void qdisc_reset(struct Qdisc *qdisc); 174extern void qdisc_reset(struct Qdisc *qdisc);
174extern void qdisc_destroy(struct Qdisc *qdisc); 175extern void qdisc_destroy(struct Qdisc *qdisc);
176extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n);
175extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops); 177extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops);
176extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, 178extern struct Qdisc *qdisc_create_dflt(struct net_device *dev,
177 struct Qdisc_ops *ops); 179 struct Qdisc_ops *ops, u32 parentid);
178 180
179static inline void 181static inline void
180tcf_destroy(struct tcf_proto *tp) 182tcf_destroy(struct tcf_proto *tp)
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 807d6f1ef4b5..6114c4f54b0a 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -116,9 +116,11 @@ typedef enum {
116typedef union { 116typedef union {
117 __s32 i32; 117 __s32 i32;
118 __u32 u32; 118 __u32 u32;
119 __be32 be32;
119 __u16 u16; 120 __u16 u16;
120 __u8 u8; 121 __u8 u8;
121 int error; 122 int error;
123 __be16 err;
122 sctp_state_t state; 124 sctp_state_t state;
123 sctp_event_timeout_t to; 125 sctp_event_timeout_t to;
124 unsigned long zero; 126 unsigned long zero;
@@ -164,9 +166,11 @@ SCTP_## name (type arg) \
164 166
165SCTP_ARG_CONSTRUCTOR(I32, __s32, i32) 167SCTP_ARG_CONSTRUCTOR(I32, __s32, i32)
166SCTP_ARG_CONSTRUCTOR(U32, __u32, u32) 168SCTP_ARG_CONSTRUCTOR(U32, __u32, u32)
169SCTP_ARG_CONSTRUCTOR(BE32, __be32, be32)
167SCTP_ARG_CONSTRUCTOR(U16, __u16, u16) 170SCTP_ARG_CONSTRUCTOR(U16, __u16, u16)
168SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) 171SCTP_ARG_CONSTRUCTOR(U8, __u8, u8)
169SCTP_ARG_CONSTRUCTOR(ERROR, int, error) 172SCTP_ARG_CONSTRUCTOR(ERROR, int, error)
173SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */
170SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) 174SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state)
171SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) 175SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
172SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr) 176SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr)
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 6c632e26f72d..5ddb85599863 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -356,7 +356,7 @@ typedef enum {
356 * addresses. 356 * addresses.
357 */ 357 */
358#define IS_IPV4_UNUSABLE_ADDRESS(a) \ 358#define IS_IPV4_UNUSABLE_ADDRESS(a) \
359 ((INADDR_BROADCAST == *a) || \ 359 ((htonl(INADDR_BROADCAST) == *a) || \
360 (MULTICAST(*a)) || \ 360 (MULTICAST(*a)) || \
361 (((unsigned char *)(a))[0] == 0) || \ 361 (((unsigned char *)(a))[0] == 0) || \
362 ((((unsigned char *)(a))[0] == 198) && \ 362 ((((unsigned char *)(a))[0] == 198) && \
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 764e3af5be93..215461f18db1 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -585,7 +585,7 @@ static inline int ipver2af(__u8 ipver)
585} 585}
586 586
587/* Convert from an address parameter type to an address family. */ 587/* Convert from an address parameter type to an address family. */
588static inline int param_type2af(__u16 type) 588static inline int param_type2af(__be16 type)
589{ 589{
590 switch (type) { 590 switch (type) {
591 case SCTP_PARAM_IPV4_ADDRESS: 591 case SCTP_PARAM_IPV4_ADDRESS:
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index de313de4fefe..3269ed1cc222 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -213,7 +213,7 @@ struct sctp_chunk *sctp_make_shutdown_ack(const struct sctp_association *asoc,
213 const struct sctp_chunk *); 213 const struct sctp_chunk *);
214struct sctp_chunk *sctp_make_shutdown_complete(const struct sctp_association *, 214struct sctp_chunk *sctp_make_shutdown_complete(const struct sctp_association *,
215 const struct sctp_chunk *); 215 const struct sctp_chunk *);
216void sctp_init_cause(struct sctp_chunk *, __u16 cause, const void *, size_t); 216void sctp_init_cause(struct sctp_chunk *, __be16 cause, const void *, size_t);
217struct sctp_chunk *sctp_make_abort(const struct sctp_association *, 217struct sctp_chunk *sctp_make_abort(const struct sctp_association *,
218 const struct sctp_chunk *, 218 const struct sctp_chunk *,
219 const size_t hint); 219 const size_t hint);
@@ -236,14 +236,14 @@ struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *,
236 const size_t paylen); 236 const size_t paylen);
237struct sctp_chunk *sctp_make_op_error(const struct sctp_association *, 237struct sctp_chunk *sctp_make_op_error(const struct sctp_association *,
238 const struct sctp_chunk *chunk, 238 const struct sctp_chunk *chunk,
239 __u16 cause_code, 239 __be16 cause_code,
240 const void *payload, 240 const void *payload,
241 size_t paylen); 241 size_t paylen);
242 242
243struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *, 243struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *,
244 union sctp_addr *, 244 union sctp_addr *,
245 struct sockaddr *, 245 struct sockaddr *,
246 int, __u16); 246 int, __be16);
247struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, 247struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc,
248 union sctp_addr *addr); 248 union sctp_addr *addr);
249struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, 249struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index c6d93bb0dcd2..c089f93ba591 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -537,7 +537,7 @@ struct sctp_af {
537 struct net_device *); 537 struct net_device *);
538 void (*dst_saddr) (union sctp_addr *saddr, 538 void (*dst_saddr) (union sctp_addr *saddr,
539 struct dst_entry *dst, 539 struct dst_entry *dst,
540 unsigned short port); 540 __be16 port);
541 int (*cmp_addr) (const union sctp_addr *addr1, 541 int (*cmp_addr) (const union sctp_addr *addr1,
542 const union sctp_addr *addr2); 542 const union sctp_addr *addr2);
543 void (*addr_copy) (union sctp_addr *dst, 543 void (*addr_copy) (union sctp_addr *dst,
@@ -553,14 +553,14 @@ struct sctp_af {
553 struct sock *sk); 553 struct sock *sk);
554 void (*from_addr_param) (union sctp_addr *, 554 void (*from_addr_param) (union sctp_addr *,
555 union sctp_addr_param *, 555 union sctp_addr_param *,
556 __u16 port, int iif); 556 __be16 port, int iif);
557 int (*to_addr_param) (const union sctp_addr *, 557 int (*to_addr_param) (const union sctp_addr *,
558 union sctp_addr_param *); 558 union sctp_addr_param *);
559 int (*addr_valid) (union sctp_addr *, 559 int (*addr_valid) (union sctp_addr *,
560 struct sctp_sock *, 560 struct sctp_sock *,
561 const struct sk_buff *); 561 const struct sk_buff *);
562 sctp_scope_t (*scope) (union sctp_addr *); 562 sctp_scope_t (*scope) (union sctp_addr *);
563 void (*inaddr_any) (union sctp_addr *, unsigned short); 563 void (*inaddr_any) (union sctp_addr *, __be16);
564 int (*is_any) (const union sctp_addr *); 564 int (*is_any) (const union sctp_addr *);
565 int (*available) (union sctp_addr *, 565 int (*available) (union sctp_addr *,
566 struct sctp_sock *); 566 struct sctp_sock *);
@@ -587,7 +587,7 @@ struct sctp_pf {
587 struct sctp_sock *); 587 struct sctp_sock *);
588 int (*bind_verify) (struct sctp_sock *, union sctp_addr *); 588 int (*bind_verify) (struct sctp_sock *, union sctp_addr *);
589 int (*send_verify) (struct sctp_sock *, union sctp_addr *); 589 int (*send_verify) (struct sctp_sock *, union sctp_addr *);
590 int (*supported_addrs)(const struct sctp_sock *, __u16 *); 590 int (*supported_addrs)(const struct sctp_sock *, __be16 *);
591 struct sock *(*create_accept_sk) (struct sock *sk, 591 struct sock *(*create_accept_sk) (struct sock *sk,
592 struct sctp_association *asoc); 592 struct sctp_association *asoc);
593 void (*addr_v4map) (struct sctp_sock *, union sctp_addr *); 593 void (*addr_v4map) (struct sctp_sock *, union sctp_addr *);
@@ -1030,7 +1030,7 @@ void sctp_inq_init(struct sctp_inq *);
1030void sctp_inq_free(struct sctp_inq *); 1030void sctp_inq_free(struct sctp_inq *);
1031void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet); 1031void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet);
1032struct sctp_chunk *sctp_inq_pop(struct sctp_inq *); 1032struct sctp_chunk *sctp_inq_pop(struct sctp_inq *);
1033void sctp_inq_set_th_handler(struct sctp_inq *, void (*)(void *), void *); 1033void sctp_inq_set_th_handler(struct sctp_inq *, work_func_t);
1034 1034
1035/* This is the structure we use to hold outbound chunks. You push 1035/* This is the structure we use to hold outbound chunks. You push
1036 * chunks in and they automatically pop out the other end as bundled 1036 * chunks in and they automatically pop out the other end as bundled
@@ -1270,7 +1270,7 @@ struct sctp_endpoint {
1270 * this here so we pre-allocate this once and can re-use 1270 * this here so we pre-allocate this once and can re-use
1271 * on every receive. 1271 * on every receive.
1272 */ 1272 */
1273 __u8 digest[SCTP_SIGNATURE_SIZE]; 1273 __u8 *digest;
1274 1274
1275 /* sendbuf acct. policy. */ 1275 /* sendbuf acct. policy. */
1276 __u32 sndbuf_policy; 1276 __u32 sndbuf_policy;
@@ -1314,6 +1314,13 @@ int sctp_process_init(struct sctp_association *, sctp_cid_t cid,
1314__u32 sctp_generate_tag(const struct sctp_endpoint *); 1314__u32 sctp_generate_tag(const struct sctp_endpoint *);
1315__u32 sctp_generate_tsn(const struct sctp_endpoint *); 1315__u32 sctp_generate_tsn(const struct sctp_endpoint *);
1316 1316
1317struct sctp_inithdr_host {
1318 __u32 init_tag;
1319 __u32 a_rwnd;
1320 __u16 num_outbound_streams;
1321 __u16 num_inbound_streams;
1322 __u32 initial_tsn;
1323};
1317 1324
1318/* RFC2960 1325/* RFC2960
1319 * 1326 *
@@ -1482,9 +1489,9 @@ struct sctp_association {
1482 /* This mask is used to disable sending the ASCONF chunk 1489 /* This mask is used to disable sending the ASCONF chunk
1483 * with specified parameter to peer. 1490 * with specified parameter to peer.
1484 */ 1491 */
1485 __u16 addip_disabled_mask; 1492 __be16 addip_disabled_mask;
1486 1493
1487 struct sctp_inithdr i; 1494 struct sctp_inithdr_host i;
1488 int cookie_len; 1495 int cookie_len;
1489 void *cookie; 1496 void *cookie;
1490 1497
diff --git a/include/net/sctp/tsnmap.h b/include/net/sctp/tsnmap.h
index 021947da70ea..70a824df6f60 100644
--- a/include/net/sctp/tsnmap.h
+++ b/include/net/sctp/tsnmap.h
@@ -105,7 +105,7 @@ struct sctp_tsnmap {
105 * every SACK. Store up to SCTP_MAX_DUP_TSNS worth of 105 * every SACK. Store up to SCTP_MAX_DUP_TSNS worth of
106 * information. 106 * information.
107 */ 107 */
108 __u32 dup_tsns[SCTP_MAX_DUP_TSNS]; 108 __be32 dup_tsns[SCTP_MAX_DUP_TSNS];
109 __u16 num_dup_tsns; 109 __u16 num_dup_tsns;
110 110
111 /* Record gap ack block information here. */ 111 /* Record gap ack block information here. */
@@ -162,7 +162,7 @@ static inline __u16 sctp_tsnmap_num_dups(struct sctp_tsnmap *map)
162} 162}
163 163
164/* Return pointer to duplicate tsn array as needed by SACK. */ 164/* Return pointer to duplicate tsn array as needed by SACK. */
165static inline __u32 *sctp_tsnmap_get_dups(struct sctp_tsnmap *map) 165static inline __be32 *sctp_tsnmap_get_dups(struct sctp_tsnmap *map)
166{ 166{
167 map->num_dup_tsns = 0; 167 map->num_dup_tsns = 0;
168 return map->dup_tsns; 168 return map->dup_tsns;
diff --git a/include/net/sock.h b/include/net/sock.h
index ac286a353032..03684e702d13 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -47,6 +47,7 @@
47#include <linux/lockdep.h> 47#include <linux/lockdep.h>
48#include <linux/netdevice.h> 48#include <linux/netdevice.h>
49#include <linux/skbuff.h> /* struct sk_buff */ 49#include <linux/skbuff.h> /* struct sk_buff */
50#include <linux/mm.h>
50#include <linux/security.h> 51#include <linux/security.h>
51 52
52#include <linux/filter.h> 53#include <linux/filter.h>
@@ -570,7 +571,7 @@ struct proto {
570 int *sysctl_rmem; 571 int *sysctl_rmem;
571 int max_header; 572 int max_header;
572 573
573 kmem_cache_t *slab; 574 struct kmem_cache *slab;
574 unsigned int obj_size; 575 unsigned int obj_size;
575 576
576 atomic_t *orphan_count; 577 atomic_t *orphan_count;
@@ -745,7 +746,32 @@ static inline int sk_stream_wmem_schedule(struct sock *sk, int size)
745 */ 746 */
746#define sock_owned_by_user(sk) ((sk)->sk_lock.owner) 747#define sock_owned_by_user(sk) ((sk)->sk_lock.owner)
747 748
748extern void FASTCALL(lock_sock(struct sock *sk)); 749/*
750 * Macro so as to not evaluate some arguments when
751 * lockdep is not enabled.
752 *
753 * Mark both the sk_lock and the sk_lock.slock as a
754 * per-address-family lock class.
755 */
756#define sock_lock_init_class_and_name(sk, sname, skey, name, key) \
757do { \
758 sk->sk_lock.owner = NULL; \
759 init_waitqueue_head(&sk->sk_lock.wq); \
760 spin_lock_init(&(sk)->sk_lock.slock); \
761 debug_check_no_locks_freed((void *)&(sk)->sk_lock, \
762 sizeof((sk)->sk_lock)); \
763 lockdep_set_class_and_name(&(sk)->sk_lock.slock, \
764 (skey), (sname)); \
765 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \
766} while (0)
767
768extern void FASTCALL(lock_sock_nested(struct sock *sk, int subclass));
769
770static inline void lock_sock(struct sock *sk)
771{
772 lock_sock_nested(sk, 0);
773}
774
749extern void FASTCALL(release_sock(struct sock *sk)); 775extern void FASTCALL(release_sock(struct sock *sk));
750 776
751/* BH context may only use the following locking interface. */ 777/* BH context may only use the following locking interface. */
@@ -883,18 +909,23 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
883} 909}
884 910
885/** 911/**
886 * sk_filter_release: Release a socket filter 912 * sk_filter_rcu_free: Free a socket filter
887 * @rcu: rcu_head that contains the sk_filter info to remove 913 * @rcu: rcu_head that contains the sk_filter to free
888 *
889 * Remove a filter from a socket and release its resources.
890 */ 914 */
891
892static inline void sk_filter_rcu_free(struct rcu_head *rcu) 915static inline void sk_filter_rcu_free(struct rcu_head *rcu)
893{ 916{
894 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); 917 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu);
895 kfree(fp); 918 kfree(fp);
896} 919}
897 920
921/**
922 * sk_filter_release: Release a socket filter
923 * @sk: socket
924 * @fp: filter to remove
925 *
926 * Remove a filter from a socket and release its resources.
927 */
928
898static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) 929static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp)
899{ 930{
900 unsigned int size = sk_filter_len(fp); 931 unsigned int size = sk_filter_len(fp);
@@ -943,7 +974,8 @@ static inline void sock_put(struct sock *sk)
943 sk_free(sk); 974 sk_free(sk);
944} 975}
945 976
946extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb); 977extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb,
978 const int nested);
947 979
948/* Detach socket from process context. 980/* Detach socket from process context.
949 * Announce socket dead, detach it from wait queue and inode. 981 * Announce socket dead, detach it from wait queue and inode.
@@ -1077,7 +1109,7 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from,
1077{ 1109{
1078 if (skb->ip_summed == CHECKSUM_NONE) { 1110 if (skb->ip_summed == CHECKSUM_NONE) {
1079 int err = 0; 1111 int err = 0;
1080 unsigned int csum = csum_and_copy_from_user(from, 1112 __wsum csum = csum_and_copy_from_user(from,
1081 page_address(page) + off, 1113 page_address(page) + off,
1082 copy, 0, &err); 1114 copy, 0, &err);
1083 if (err) 1115 if (err)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 7a093d0aa0fe..c99774f15eba 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -28,6 +28,7 @@
28#include <linux/percpu.h> 28#include <linux/percpu.h>
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30#include <linux/dmaengine.h> 30#include <linux/dmaengine.h>
31#include <linux/crypto.h>
31 32
32#include <net/inet_connection_sock.h> 33#include <net/inet_connection_sock.h>
33#include <net/inet_timewait_sock.h> 34#include <net/inet_timewait_sock.h>
@@ -138,7 +139,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
138#define MAX_TCP_SYNCNT 127 139#define MAX_TCP_SYNCNT 127
139 140
140#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */ 141#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */
141#define TCP_SYNQ_HSIZE 512 /* Size of SYNACK hash table */
142 142
143#define TCP_PAWS_24DAYS (60 * 60 * 24 * 24) 143#define TCP_PAWS_24DAYS (60 * 60 * 24 * 24)
144#define TCP_PAWS_MSL 60 /* Per-host timestamps are invalidated 144#define TCP_PAWS_MSL 60 /* Per-host timestamps are invalidated
@@ -162,6 +162,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
162#define TCPOPT_SACK_PERM 4 /* SACK Permitted */ 162#define TCPOPT_SACK_PERM 4 /* SACK Permitted */
163#define TCPOPT_SACK 5 /* SACK Block */ 163#define TCPOPT_SACK 5 /* SACK Block */
164#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ 164#define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */
165#define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */
165 166
166/* 167/*
167 * TCP option lengths 168 * TCP option lengths
@@ -171,6 +172,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
171#define TCPOLEN_WINDOW 3 172#define TCPOLEN_WINDOW 3
172#define TCPOLEN_SACK_PERM 2 173#define TCPOLEN_SACK_PERM 2
173#define TCPOLEN_TIMESTAMP 10 174#define TCPOLEN_TIMESTAMP 10
175#define TCPOLEN_MD5SIG 18
174 176
175/* But this is what stacks really send out. */ 177/* But this is what stacks really send out. */
176#define TCPOLEN_TSTAMP_ALIGNED 12 178#define TCPOLEN_TSTAMP_ALIGNED 12
@@ -179,6 +181,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
179#define TCPOLEN_SACK_BASE 2 181#define TCPOLEN_SACK_BASE 2
180#define TCPOLEN_SACK_BASE_ALIGNED 4 182#define TCPOLEN_SACK_BASE_ALIGNED 4
181#define TCPOLEN_SACK_PERBLOCK 8 183#define TCPOLEN_SACK_PERBLOCK 8
184#define TCPOLEN_MD5SIG_ALIGNED 20
182 185
183/* Flags in tp->nonagle */ 186/* Flags in tp->nonagle */
184#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */ 187#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */
@@ -300,6 +303,8 @@ extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
300extern int tcp_twsk_unique(struct sock *sk, 303extern int tcp_twsk_unique(struct sock *sk,
301 struct sock *sktw, void *twp); 304 struct sock *sktw, void *twp);
302 305
306extern void tcp_twsk_destructor(struct sock *sk);
307
303static inline void tcp_dec_quickack_mode(struct sock *sk, 308static inline void tcp_dec_quickack_mode(struct sock *sk,
304 const unsigned int pkts) 309 const unsigned int pkts)
305{ 310{
@@ -621,8 +626,12 @@ enum tcp_ca_event {
621 * Interface for adding new TCP congestion control handlers 626 * Interface for adding new TCP congestion control handlers
622 */ 627 */
623#define TCP_CA_NAME_MAX 16 628#define TCP_CA_NAME_MAX 16
629#define TCP_CA_MAX 128
630#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX)
631
624struct tcp_congestion_ops { 632struct tcp_congestion_ops {
625 struct list_head list; 633 struct list_head list;
634 int non_restricted;
626 635
627 /* initialize private data (optional) */ 636 /* initialize private data (optional) */
628 void (*init)(struct sock *sk); 637 void (*init)(struct sock *sk);
@@ -660,6 +669,9 @@ extern void tcp_init_congestion_control(struct sock *sk);
660extern void tcp_cleanup_congestion_control(struct sock *sk); 669extern void tcp_cleanup_congestion_control(struct sock *sk);
661extern int tcp_set_default_congestion_control(const char *name); 670extern int tcp_set_default_congestion_control(const char *name);
662extern void tcp_get_default_congestion_control(char *name); 671extern void tcp_get_default_congestion_control(char *name);
672extern void tcp_get_available_congestion_control(char *buf, size_t len);
673extern void tcp_get_allowed_congestion_control(char *buf, size_t len);
674extern int tcp_set_allowed_congestion_control(char *allowed);
663extern int tcp_set_congestion_control(struct sock *sk, const char *name); 675extern int tcp_set_congestion_control(struct sock *sk, const char *name);
664extern void tcp_slow_start(struct tcp_sock *tp); 676extern void tcp_slow_start(struct tcp_sock *tp);
665 677
@@ -795,14 +807,14 @@ static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
795/* 807/*
796 * Calculate(/check) TCP checksum 808 * Calculate(/check) TCP checksum
797 */ 809 */
798static inline u16 tcp_v4_check(struct tcphdr *th, int len, 810static inline __sum16 tcp_v4_check(struct tcphdr *th, int len,
799 unsigned long saddr, unsigned long daddr, 811 __be32 saddr, __be32 daddr,
800 unsigned long base) 812 __wsum base)
801{ 813{
802 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base); 814 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
803} 815}
804 816
805static inline int __tcp_checksum_complete(struct sk_buff *skb) 817static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb)
806{ 818{
807 return __skb_checksum_complete(skb); 819 return __skb_checksum_complete(skb);
808} 820}
@@ -1058,6 +1070,114 @@ static inline void clear_all_retrans_hints(struct tcp_sock *tp){
1058 tp->fastpath_skb_hint = NULL; 1070 tp->fastpath_skb_hint = NULL;
1059} 1071}
1060 1072
1073/* MD5 Signature */
1074struct crypto_hash;
1075
1076/* - key database */
1077struct tcp_md5sig_key {
1078 u8 *key;
1079 u8 keylen;
1080};
1081
1082struct tcp4_md5sig_key {
1083 u8 *key;
1084 u16 keylen;
1085 __be32 addr;
1086};
1087
1088struct tcp6_md5sig_key {
1089 u8 *key;
1090 u16 keylen;
1091#if 0
1092 u32 scope_id; /* XXX */
1093#endif
1094 struct in6_addr addr;
1095};
1096
1097/* - sock block */
1098struct tcp_md5sig_info {
1099 struct tcp4_md5sig_key *keys4;
1100#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
1101 struct tcp6_md5sig_key *keys6;
1102 u32 entries6;
1103 u32 alloced6;
1104#endif
1105 u32 entries4;
1106 u32 alloced4;
1107};
1108
1109/* - pseudo header */
1110struct tcp4_pseudohdr {
1111 __be32 saddr;
1112 __be32 daddr;
1113 __u8 pad;
1114 __u8 protocol;
1115 __be16 len;
1116};
1117
1118struct tcp6_pseudohdr {
1119 struct in6_addr saddr;
1120 struct in6_addr daddr;
1121 __be32 len;
1122 __be32 protocol; /* including padding */
1123};
1124
1125union tcp_md5sum_block {
1126 struct tcp4_pseudohdr ip4;
1127#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
1128 struct tcp6_pseudohdr ip6;
1129#endif
1130};
1131
1132/* - pool: digest algorithm, hash description and scratch buffer */
1133struct tcp_md5sig_pool {
1134 struct hash_desc md5_desc;
1135 union tcp_md5sum_block md5_blk;
1136};
1137
1138#define TCP_MD5SIG_MAXKEYS (~(u32)0) /* really?! */
1139
1140/* - functions */
1141extern int tcp_v4_calc_md5_hash(char *md5_hash,
1142 struct tcp_md5sig_key *key,
1143 struct sock *sk,
1144 struct dst_entry *dst,
1145 struct request_sock *req,
1146 struct tcphdr *th,
1147 int protocol, int tcplen);
1148extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1149 struct sock *addr_sk);
1150
1151extern int tcp_v4_md5_do_add(struct sock *sk,
1152 __be32 addr,
1153 u8 *newkey,
1154 u8 newkeylen);
1155
1156extern int tcp_v4_md5_do_del(struct sock *sk,
1157 __be32 addr);
1158
1159extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(void);
1160extern void tcp_free_md5sig_pool(void);
1161
1162extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu);
1163extern void __tcp_put_md5sig_pool(void);
1164
1165static inline
1166struct tcp_md5sig_pool *tcp_get_md5sig_pool(void)
1167{
1168 int cpu = get_cpu();
1169 struct tcp_md5sig_pool *ret = __tcp_get_md5sig_pool(cpu);
1170 if (!ret)
1171 put_cpu();
1172 return ret;
1173}
1174
1175static inline void tcp_put_md5sig_pool(void)
1176{
1177 __tcp_put_md5sig_pool();
1178 put_cpu();
1179}
1180
1061/* /proc */ 1181/* /proc */
1062enum tcp_seq_states { 1182enum tcp_seq_states {
1063 TCP_SEQ_STATE_LISTENING, 1183 TCP_SEQ_STATE_LISTENING,
@@ -1097,6 +1217,35 @@ extern int tcp4_proc_init(void);
1097extern void tcp4_proc_exit(void); 1217extern void tcp4_proc_exit(void);
1098#endif 1218#endif
1099 1219
1220/* TCP af-specific functions */
1221struct tcp_sock_af_ops {
1222#ifdef CONFIG_TCP_MD5SIG
1223 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk,
1224 struct sock *addr_sk);
1225 int (*calc_md5_hash) (char *location,
1226 struct tcp_md5sig_key *md5,
1227 struct sock *sk,
1228 struct dst_entry *dst,
1229 struct request_sock *req,
1230 struct tcphdr *th,
1231 int protocol, int len);
1232 int (*md5_add) (struct sock *sk,
1233 struct sock *addr_sk,
1234 u8 *newkey,
1235 u8 len);
1236 int (*md5_parse) (struct sock *sk,
1237 char __user *optval,
1238 int optlen);
1239#endif
1240};
1241
1242struct tcp_request_sock_ops {
1243#ifdef CONFIG_TCP_MD5SIG
1244 struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk,
1245 struct request_sock *req);
1246#endif
1247};
1248
1100extern void tcp_v4_init(struct net_proto_family *ops); 1249extern void tcp_v4_init(struct net_proto_family *ops);
1101extern void tcp_init(void); 1250extern void tcp_init(void);
1102 1251
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h
index be293d795e38..1e1ee3253fd8 100644
--- a/include/net/timewait_sock.h
+++ b/include/net/timewait_sock.h
@@ -15,7 +15,7 @@
15#include <net/sock.h> 15#include <net/sock.h>
16 16
17struct timewait_sock_ops { 17struct timewait_sock_ops {
18 kmem_cache_t *twsk_slab; 18 struct kmem_cache *twsk_slab;
19 unsigned int twsk_obj_size; 19 unsigned int twsk_obj_size;
20 int (*twsk_unique)(struct sock *sk, 20 int (*twsk_unique)(struct sock *sk,
21 struct sock *sktw, void *twp); 21 struct sock *sktw, void *twp);
@@ -31,6 +31,9 @@ static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
31 31
32static inline void twsk_destructor(struct sock *sk) 32static inline void twsk_destructor(struct sock *sk)
33{ 33{
34 BUG_ON(sk == NULL);
35 BUG_ON(sk->sk_prot == NULL);
36 BUG_ON(sk->sk_prot->twsk_prot == NULL);
34 if (sk->sk_prot->twsk_prot->twsk_destructor != NULL) 37 if (sk->sk_prot->twsk_prot->twsk_destructor != NULL)
35 sk->sk_prot->twsk_prot->twsk_destructor(sk); 38 sk->sk_prot->twsk_prot->twsk_destructor(sk);
36} 39}
diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h
index e07136d74c2f..2151a80cdf30 100644
--- a/include/net/tipc/tipc_bearer.h
+++ b/include/net/tipc/tipc_bearer.h
@@ -58,7 +58,7 @@
58 */ 58 */
59 59
60struct tipc_media_addr { 60struct tipc_media_addr {
61 __u32 type; /* bearer type (network byte order) */ 61 __be32 type; /* bearer type (network byte order) */
62 union { 62 union {
63 __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */ 63 __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */
64#if 0 64#if 0
diff --git a/include/net/tipc/tipc_msg.h b/include/net/tipc/tipc_msg.h
index 4d096eebc93f..fb42eb7a86a5 100644
--- a/include/net/tipc/tipc_msg.h
+++ b/include/net/tipc/tipc_msg.h
@@ -40,7 +40,7 @@
40#ifdef __KERNEL__ 40#ifdef __KERNEL__
41 41
42struct tipc_msg { 42struct tipc_msg {
43 u32 hdr[15]; 43 __be32 hdr[15];
44}; 44};
45 45
46 46
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 61f724c1036f..409da3a9a455 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -11,6 +11,7 @@
11 11
12extern struct proto rawv6_prot; 12extern struct proto rawv6_prot;
13extern struct proto udpv6_prot; 13extern struct proto udpv6_prot;
14extern struct proto udplitev6_prot;
14extern struct proto tcpv6_prot; 15extern struct proto tcpv6_prot;
15 16
16struct flowi; 17struct flowi;
@@ -24,6 +25,7 @@ extern void ipv6_destopt_init(void);
24/* transport protocols */ 25/* transport protocols */
25extern void rawv6_init(void); 26extern void rawv6_init(void);
26extern void udpv6_init(void); 27extern void udpv6_init(void);
28extern void udplitev6_init(void);
27extern void tcpv6_init(void); 29extern void tcpv6_init(void);
28 30
29extern int udpv6_connect(struct sock *sk, 31extern int udpv6_connect(struct sock *sk,
diff --git a/include/net/udp.h b/include/net/udp.h
index db0c05f67546..1b921fa81474 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -26,9 +26,29 @@
26#include <net/inet_sock.h> 26#include <net/inet_sock.h>
27#include <net/sock.h> 27#include <net/sock.h>
28#include <net/snmp.h> 28#include <net/snmp.h>
29#include <net/ip.h>
30#include <linux/ipv6.h>
29#include <linux/seq_file.h> 31#include <linux/seq_file.h>
32#include <linux/poll.h>
30 33
31#define UDP_HTABLE_SIZE 128 34/**
35 * struct udp_skb_cb - UDP(-Lite) private variables
36 *
37 * @header: private variables used by IPv4/IPv6
38 * @cscov: checksum coverage length (UDP-Lite only)
39 * @partial_cov: if set indicates partial csum coverage
40 */
41struct udp_skb_cb {
42 union {
43 struct inet_skb_parm h4;
44#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
45 struct inet6_skb_parm h6;
46#endif
47 } header;
48 __u16 cscov;
49 __u8 partial_cov;
50};
51#define UDP_SKB_CB(__skb) ((struct udp_skb_cb *)((__skb)->cb))
32 52
33extern struct hlist_head udp_hash[UDP_HTABLE_SIZE]; 53extern struct hlist_head udp_hash[UDP_HTABLE_SIZE];
34extern rwlock_t udp_hash_lock; 54extern rwlock_t udp_hash_lock;
@@ -47,6 +67,62 @@ extern struct proto udp_prot;
47 67
48struct sk_buff; 68struct sk_buff;
49 69
70/*
71 * Generic checksumming routines for UDP(-Lite) v4 and v6
72 */
73static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb)
74{
75 if (! UDP_SKB_CB(skb)->partial_cov)
76 return __skb_checksum_complete(skb);
77 return csum_fold(skb_checksum(skb, 0, UDP_SKB_CB(skb)->cscov,
78 skb->csum));
79}
80
81static inline int udp_lib_checksum_complete(struct sk_buff *skb)
82{
83 return skb->ip_summed != CHECKSUM_UNNECESSARY &&
84 __udp_lib_checksum_complete(skb);
85}
86
87/**
88 * udp_csum_outgoing - compute UDPv4/v6 checksum over fragments
89 * @sk: socket we are writing to
90 * @skb: sk_buff containing the filled-in UDP header
91 * (checksum field must be zeroed out)
92 */
93static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
94{
95 __wsum csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0);
96
97 skb_queue_walk(&sk->sk_write_queue, skb) {
98 csum = csum_add(csum, skb->csum);
99 }
100 return csum;
101}
102
103/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
104static inline void udp_lib_hash(struct sock *sk)
105{
106 BUG();
107}
108
109static inline void udp_lib_unhash(struct sock *sk)
110{
111 write_lock_bh(&udp_hash_lock);
112 if (sk_del_node_init(sk)) {
113 inet_sk(sk)->num = 0;
114 sock_prot_dec_use(sk->sk_prot);
115 }
116 write_unlock_bh(&udp_hash_lock);
117}
118
119static inline void udp_lib_close(struct sock *sk, long timeout)
120{
121 sk_common_release(sk);
122}
123
124
125/* net/ipv4/udp.c */
50extern int udp_get_port(struct sock *sk, unsigned short snum, 126extern int udp_get_port(struct sock *sk, unsigned short snum,
51 int (*saddr_cmp)(const struct sock *, const struct sock *)); 127 int (*saddr_cmp)(const struct sock *, const struct sock *));
52extern void udp_err(struct sk_buff *, u32); 128extern void udp_err(struct sk_buff *, u32);
@@ -59,23 +135,36 @@ extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
59extern int udp_disconnect(struct sock *sk, int flags); 135extern int udp_disconnect(struct sock *sk, int flags);
60extern unsigned int udp_poll(struct file *file, struct socket *sock, 136extern unsigned int udp_poll(struct file *file, struct socket *sock,
61 poll_table *wait); 137 poll_table *wait);
138extern int udp_lib_getsockopt(struct sock *sk, int level, int optname,
139 char __user *optval, int __user *optlen);
140extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
141 char __user *optval, int optlen,
142 int (*push_pending_frames)(struct sock *));
62 143
63DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); 144DECLARE_SNMP_STAT(struct udp_mib, udp_statistics);
64#define UDP_INC_STATS(field) SNMP_INC_STATS(udp_statistics, field) 145/*
65#define UDP_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_statistics, field) 146 * SNMP statistics for UDP and UDP-Lite
66#define UDP_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_statistics, field) 147 */
148#define UDP_INC_STATS_USER(field, is_udplite) do { \
149 if (is_udplite) SNMP_INC_STATS_USER(udplite_statistics, field); \
150 else SNMP_INC_STATS_USER(udp_statistics, field); } while(0)
151#define UDP_INC_STATS_BH(field, is_udplite) do { \
152 if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \
153 else SNMP_INC_STATS_BH(udp_statistics, field); } while(0)
67 154
68/* /proc */ 155/* /proc */
69struct udp_seq_afinfo { 156struct udp_seq_afinfo {
70 struct module *owner; 157 struct module *owner;
71 char *name; 158 char *name;
72 sa_family_t family; 159 sa_family_t family;
160 struct hlist_head *hashtable;
73 int (*seq_show) (struct seq_file *m, void *v); 161 int (*seq_show) (struct seq_file *m, void *v);
74 struct file_operations *seq_fops; 162 struct file_operations *seq_fops;
75}; 163};
76 164
77struct udp_iter_state { 165struct udp_iter_state {
78 sa_family_t family; 166 sa_family_t family;
167 struct hlist_head *hashtable;
79 int bucket; 168 int bucket;
80 struct seq_operations seq_ops; 169 struct seq_operations seq_ops;
81}; 170};
diff --git a/include/net/udplite.h b/include/net/udplite.h
new file mode 100644
index 000000000000..67ac51424307
--- /dev/null
+++ b/include/net/udplite.h
@@ -0,0 +1,151 @@
1/*
2 * Definitions for the UDP-Lite (RFC 3828) code.
3 */
4#ifndef _UDPLITE_H
5#define _UDPLITE_H
6
7#include <net/ip6_checksum.h>
8
9/* UDP-Lite socket options */
10#define UDPLITE_SEND_CSCOV 10 /* sender partial coverage (as sent) */
11#define UDPLITE_RECV_CSCOV 11 /* receiver partial coverage (threshold ) */
12
13extern struct proto udplite_prot;
14extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE];
15
16/* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */
17DECLARE_SNMP_STAT(struct udp_mib, udplite_statistics);
18
19/*
20 * Checksum computation is all in software, hence simpler getfrag.
21 */
22static __inline__ int udplite_getfrag(void *from, char *to, int offset,
23 int len, int odd, struct sk_buff *skb)
24{
25 return memcpy_fromiovecend(to, (struct iovec *) from, offset, len);
26}
27
28/* Designate sk as UDP-Lite socket */
29static inline int udplite_sk_init(struct sock *sk)
30{
31 udp_sk(sk)->pcflag = UDPLITE_BIT;
32 return 0;
33}
34
35/*
36 * Checksumming routines
37 */
38static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
39{
40 u16 cscov;
41
42 /* In UDPv4 a zero checksum means that the transmitter generated no
43 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets
44 * with a zero checksum field are illegal. */
45 if (uh->check == 0) {
46 LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: zeroed checksum field\n");
47 return 1;
48 }
49
50 UDP_SKB_CB(skb)->partial_cov = 0;
51 cscov = ntohs(uh->len);
52
53 if (cscov == 0) /* Indicates that full coverage is required. */
54 cscov = skb->len;
55 else if (cscov < 8 || cscov > skb->len) {
56 /*
57 * Coverage length violates RFC 3828: log and discard silently.
58 */
59 LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: bad csum coverage %d/%d\n",
60 cscov, skb->len);
61 return 1;
62
63 } else if (cscov < skb->len)
64 UDP_SKB_CB(skb)->partial_cov = 1;
65
66 UDP_SKB_CB(skb)->cscov = cscov;
67
68 /*
69 * There is no known NIC manufacturer supporting UDP-Lite yet,
70 * hence ip_summed is always (re-)set to CHECKSUM_NONE.
71 */
72 skb->ip_summed = CHECKSUM_NONE;
73
74 return 0;
75}
76
77static __inline__ int udplite4_csum_init(struct sk_buff *skb, struct udphdr *uh)
78{
79 int rc = udplite_checksum_init(skb, uh);
80
81 if (!rc)
82 skb->csum = csum_tcpudp_nofold(skb->nh.iph->saddr,
83 skb->nh.iph->daddr,
84 skb->len, IPPROTO_UDPLITE, 0);
85 return rc;
86}
87
88static __inline__ int udplite6_csum_init(struct sk_buff *skb, struct udphdr *uh)
89{
90 int rc = udplite_checksum_init(skb, uh);
91
92 if (!rc)
93 skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
94 &skb->nh.ipv6h->daddr,
95 skb->len, IPPROTO_UDPLITE, 0));
96 return rc;
97}
98
99static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
100{
101 int cscov = up->len;
102
103 /*
104 * Sender has set `partial coverage' option on UDP-Lite socket
105 */
106 if (up->pcflag & UDPLITE_SEND_CC) {
107 if (up->pcslen < up->len) {
108 /* up->pcslen == 0 means that full coverage is required,
109 * partial coverage only if 0 < up->pcslen < up->len */
110 if (0 < up->pcslen) {
111 cscov = up->pcslen;
112 }
113 uh->len = htons(up->pcslen);
114 }
115 /*
116 * NOTE: Causes for the error case `up->pcslen > up->len':
117 * (i) Application error (will not be penalized).
118 * (ii) Payload too big for send buffer: data is split
119 * into several packets, each with its own header.
120 * In this case (e.g. last segment), coverage may
121 * exceed packet length.
122 * Since packets with coverage length > packet length are
123 * illegal, we fall back to the defaults here.
124 */
125 }
126 return cscov;
127}
128
129static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
130{
131 int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh);
132 __wsum csum = 0;
133
134 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
135
136 skb_queue_walk(&sk->sk_write_queue, skb) {
137 off = skb->h.raw - skb->data;
138 len = skb->len - off;
139
140 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum);
141
142 if ((cscov -= len) <= 0)
143 break;
144 }
145 return csum;
146}
147
148extern void udplite4_register(void);
149extern int udplite_get_port(struct sock *sk, unsigned short snum,
150 int (*scmp)(const struct sock *, const struct sock *));
151#endif /* _UDPLITE_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 737fdb2ee8a4..e4765413cf80 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -310,6 +310,8 @@ struct xfrm_tmpl
310/* Source address of tunnel. Ignored, if it is not a tunnel. */ 310/* Source address of tunnel. Ignored, if it is not a tunnel. */
311 xfrm_address_t saddr; 311 xfrm_address_t saddr;
312 312
313 unsigned short encap_family;
314
313 __u32 reqid; 315 __u32 reqid;
314 316
315/* Mode: transport, tunnel etc. */ 317/* Mode: transport, tunnel etc. */
@@ -340,18 +342,19 @@ struct xfrm_policy
340 atomic_t refcnt; 342 atomic_t refcnt;
341 struct timer_list timer; 343 struct timer_list timer;
342 344
343 u8 type;
344 u32 priority; 345 u32 priority;
345 u32 index; 346 u32 index;
346 struct xfrm_selector selector; 347 struct xfrm_selector selector;
347 struct xfrm_lifetime_cfg lft; 348 struct xfrm_lifetime_cfg lft;
348 struct xfrm_lifetime_cur curlft; 349 struct xfrm_lifetime_cur curlft;
349 struct dst_entry *bundles; 350 struct dst_entry *bundles;
350 __u16 family; 351 u16 family;
351 __u8 action; 352 u8 type;
352 __u8 flags; 353 u8 action;
353 __u8 dead; 354 u8 flags;
354 __u8 xfrm_nr; 355 u8 dead;
356 u8 xfrm_nr;
357 /* XXX 1 byte hole, try to pack */
355 struct xfrm_sec_ctx *security; 358 struct xfrm_sec_ctx *security;
356 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 359 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
357}; 360};
@@ -379,7 +382,7 @@ struct xfrm_mgr
379 int (*notify)(struct xfrm_state *x, struct km_event *c); 382 int (*notify)(struct xfrm_state *x, struct km_event *c);
380 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); 383 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir);
381 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 384 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
382 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); 385 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
383 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 386 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
384 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 387 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
385}; 388};
@@ -389,6 +392,20 @@ extern int xfrm_unregister_km(struct xfrm_mgr *km);
389 392
390extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2]; 393extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2];
391 394
395/* Audit Information */
396struct xfrm_audit
397{
398 uid_t loginuid;
399 u32 secid;
400};
401
402#ifdef CONFIG_AUDITSYSCALL
403extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result,
404 struct xfrm_policy *xp, struct xfrm_state *x);
405#else
406#define xfrm_audit_log(a,s,t,r,p,x) do { ; } while (0)
407#endif /* CONFIG_AUDITSYSCALL */
408
392static inline void xfrm_pol_hold(struct xfrm_policy *policy) 409static inline void xfrm_pol_hold(struct xfrm_policy *policy)
393{ 410{
394 if (likely(policy != NULL)) 411 if (likely(policy != NULL))
@@ -468,6 +485,7 @@ __be16 xfrm_flowi_sport(struct flowi *fl)
468 switch(fl->proto) { 485 switch(fl->proto) {
469 case IPPROTO_TCP: 486 case IPPROTO_TCP:
470 case IPPROTO_UDP: 487 case IPPROTO_UDP:
488 case IPPROTO_UDPLITE:
471 case IPPROTO_SCTP: 489 case IPPROTO_SCTP:
472 port = fl->fl_ip_sport; 490 port = fl->fl_ip_sport;
473 break; 491 break;
@@ -493,6 +511,7 @@ __be16 xfrm_flowi_dport(struct flowi *fl)
493 switch(fl->proto) { 511 switch(fl->proto) {
494 case IPPROTO_TCP: 512 case IPPROTO_TCP:
495 case IPPROTO_UDP: 513 case IPPROTO_UDP:
514 case IPPROTO_UDPLITE:
496 case IPPROTO_SCTP: 515 case IPPROTO_SCTP:
497 port = fl->fl_ip_dport; 516 port = fl->fl_ip_dport;
498 break; 517 break;
@@ -506,40 +525,8 @@ __be16 xfrm_flowi_dport(struct flowi *fl)
506 return port; 525 return port;
507} 526}
508 527
509static inline int 528extern int xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl,
510__xfrm4_selector_match(struct xfrm_selector *sel, struct flowi *fl) 529 unsigned short family);
511{
512 return addr_match(&fl->fl4_dst, &sel->daddr, sel->prefixlen_d) &&
513 addr_match(&fl->fl4_src, &sel->saddr, sel->prefixlen_s) &&
514 !((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) &&
515 !((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) &&
516 (fl->proto == sel->proto || !sel->proto) &&
517 (fl->oif == sel->ifindex || !sel->ifindex);
518}
519
520static inline int
521__xfrm6_selector_match(struct xfrm_selector *sel, struct flowi *fl)
522{
523 return addr_match(&fl->fl6_dst, &sel->daddr, sel->prefixlen_d) &&
524 addr_match(&fl->fl6_src, &sel->saddr, sel->prefixlen_s) &&
525 !((xfrm_flowi_dport(fl) ^ sel->dport) & sel->dport_mask) &&
526 !((xfrm_flowi_sport(fl) ^ sel->sport) & sel->sport_mask) &&
527 (fl->proto == sel->proto || !sel->proto) &&
528 (fl->oif == sel->ifindex || !sel->ifindex);
529}
530
531static inline int
532xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl,
533 unsigned short family)
534{
535 switch (family) {
536 case AF_INET:
537 return __xfrm4_selector_match(sel, fl);
538 case AF_INET6:
539 return __xfrm6_selector_match(sel, fl);
540 }
541 return 0;
542}
543 530
544#ifdef CONFIG_SECURITY_NETWORK_XFRM 531#ifdef CONFIG_SECURITY_NETWORK_XFRM
545/* If neither has a context --> match 532/* If neither has a context --> match
@@ -887,8 +874,7 @@ struct xfrm_tunnel {
887struct xfrm6_tunnel { 874struct xfrm6_tunnel {
888 int (*handler)(struct sk_buff *skb); 875 int (*handler)(struct sk_buff *skb);
889 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, 876 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
890 int type, int code, int offset, __u32 info); 877 int type, int code, int offset, __be32 info);
891
892 struct xfrm6_tunnel *next; 878 struct xfrm6_tunnel *next;
893 int priority; 879 int priority;
894}; 880};
@@ -934,7 +920,7 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s
934#endif 920#endif
935extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 921extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
936extern int xfrm_state_delete(struct xfrm_state *x); 922extern int xfrm_state_delete(struct xfrm_state *x);
937extern void xfrm_state_flush(u8 proto); 923extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info);
938extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); 924extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
939extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); 925extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
940extern void xfrm_replay_notify(struct xfrm_state *x, int event); 926extern void xfrm_replay_notify(struct xfrm_state *x, int event);
@@ -951,9 +937,9 @@ extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
951 xfrm_address_t *saddr, u8 proto); 937 xfrm_address_t *saddr, u8 proto);
952extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); 938extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler);
953extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); 939extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler);
954extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); 940extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr);
955extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); 941extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr);
956extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); 942extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr);
957extern int xfrm6_output(struct sk_buff *skb); 943extern int xfrm6_output(struct sk_buff *skb);
958extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, 944extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
959 u8 **prevhdr); 945 u8 **prevhdr);
@@ -987,20 +973,20 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
987 struct xfrm_selector *sel, 973 struct xfrm_selector *sel,
988 struct xfrm_sec_ctx *ctx, int delete); 974 struct xfrm_sec_ctx *ctx, int delete);
989struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete); 975struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete);
990void xfrm_policy_flush(u8 type); 976void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
991u32 xfrm_get_acqseq(void); 977u32 xfrm_get_acqseq(void);
992void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi); 978void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
993struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, 979struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
994 xfrm_address_t *daddr, xfrm_address_t *saddr, 980 xfrm_address_t *daddr, xfrm_address_t *saddr,
995 int create, unsigned short family); 981 int create, unsigned short family);
996extern void xfrm_policy_flush(u8 type); 982extern void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
997extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 983extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
998extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, 984extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
999 struct flowi *fl, int family, int strict); 985 struct flowi *fl, int family, int strict);
1000extern void xfrm_init_pmtu(struct dst_entry *dst); 986extern void xfrm_init_pmtu(struct dst_entry *dst);
1001 987
1002extern wait_queue_head_t km_waitq; 988extern wait_queue_head_t km_waitq;
1003extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); 989extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
1004extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); 990extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid);
1005extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 991extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
1006 992
@@ -1033,7 +1019,7 @@ static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b,
1033 switch (family) { 1019 switch (family) {
1034 default: 1020 default:
1035 case AF_INET: 1021 case AF_INET:
1036 return a->a4 - b->a4; 1022 return (__force __u32)a->a4 - (__force __u32)b->a4;
1037 case AF_INET6: 1023 case AF_INET6:
1038 return ipv6_addr_cmp((struct in6_addr *)a, 1024 return ipv6_addr_cmp((struct in6_addr *)a,
1039 (struct in6_addr *)b); 1025 (struct in6_addr *)b);
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index ede639812f8a..623a0fc0dae1 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -262,9 +262,10 @@ struct pcmcia_socket {
262 u8 present:1, /* PCMCIA card is present in socket */ 262 u8 present:1, /* PCMCIA card is present in socket */
263 busy:1, /* "master" ioctl is used */ 263 busy:1, /* "master" ioctl is used */
264 dead:1, /* pcmcia module is being unloaded */ 264 dead:1, /* pcmcia module is being unloaded */
265 device_add_pending:1, /* a pseudo-multifunction-device 265 device_add_pending:1, /* a multifunction-device
266 * add event is pending */ 266 * add event is pending */
267 reserved:4; 267 mfc_pfc:1, /* the pending event adds a mfc (1) or pfc (0) */
268 reserved:3;
268 } pcmcia_state; 269 } pcmcia_state;
269 270
270 struct work_struct device_add; /* for adding further pseudo-multifunction 271 struct work_struct device_add; /* for adding further pseudo-multifunction
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index c9b4738be9d6..5c070176d9ab 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -60,6 +60,7 @@ enum ib_cm_state {
60}; 60};
61 61
62enum ib_cm_lap_state { 62enum ib_cm_lap_state {
63 IB_CM_LAP_UNINIT,
63 IB_CM_LAP_IDLE, 64 IB_CM_LAP_IDLE,
64 IB_CM_LAP_SENT, 65 IB_CM_LAP_SENT,
65 IB_CM_LAP_RCVD, 66 IB_CM_LAP_RCVD,
@@ -443,13 +444,20 @@ int ib_send_cm_drep(struct ib_cm_id *cm_id,
443 u8 private_data_len); 444 u8 private_data_len);
444 445
445/** 446/**
446 * ib_cm_establish - Forces a connection state to established. 447 * ib_cm_notify - Notifies the CM of an event reported to the consumer.
447 * @cm_id: Connection identifier to transition to established. 448 * @cm_id: Connection identifier to transition to established.
449 * @event: Type of event.
448 * 450 *
449 * This routine should be invoked by users who receive messages on a 451 * This routine should be invoked by users to notify the CM of relevant
450 * connected QP before an RTU has been received. 452 * communication events. Events that should be reported to the CM and
453 * when to report them are:
454 *
455 * IB_EVENT_COMM_EST - Used when a message is received on a connected
456 * QP before an RTU has been received.
457 * IB_EVENT_PATH_MIG - Notifies the CM that the connection has failed over
458 * to the alternate path.
451 */ 459 */
452int ib_cm_establish(struct ib_cm_id *cm_id); 460int ib_cm_notify(struct ib_cm_id *cm_id, enum ib_event_type event);
453 461
454/** 462/**
455 * ib_send_cm_rej - Sends a connection rejection message to the 463 * ib_send_cm_rej - Sends a connection rejection message to the
diff --git a/include/rdma/ib_user_cm.h b/include/rdma/ib_user_cm.h
index 066c20b7cdfb..37650afb982c 100644
--- a/include/rdma/ib_user_cm.h
+++ b/include/rdma/ib_user_cm.h
@@ -38,7 +38,7 @@
38 38
39#include <rdma/ib_user_sa.h> 39#include <rdma/ib_user_sa.h>
40 40
41#define IB_USER_CM_ABI_VERSION 4 41#define IB_USER_CM_ABI_VERSION 5
42 42
43enum { 43enum {
44 IB_USER_CM_CMD_CREATE_ID, 44 IB_USER_CM_CMD_CREATE_ID,
@@ -46,7 +46,7 @@ enum {
46 IB_USER_CM_CMD_ATTR_ID, 46 IB_USER_CM_CMD_ATTR_ID,
47 47
48 IB_USER_CM_CMD_LISTEN, 48 IB_USER_CM_CMD_LISTEN,
49 IB_USER_CM_CMD_ESTABLISH, 49 IB_USER_CM_CMD_NOTIFY,
50 50
51 IB_USER_CM_CMD_SEND_REQ, 51 IB_USER_CM_CMD_SEND_REQ,
52 IB_USER_CM_CMD_SEND_REP, 52 IB_USER_CM_CMD_SEND_REP,
@@ -117,8 +117,9 @@ struct ib_ucm_listen {
117 __u32 reserved; 117 __u32 reserved;
118}; 118};
119 119
120struct ib_ucm_establish { 120struct ib_ucm_notify {
121 __u32 id; 121 __u32 id;
122 __u32 event;
122}; 123};
123 124
124struct ib_ucm_private_data { 125struct ib_ucm_private_data {
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 61eebec00a7b..ea0816d4904d 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -25,6 +25,8 @@
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/timer.h>
29#include <linux/workqueue.h>
28#include <scsi/iscsi_proto.h> 30#include <scsi/iscsi_proto.h>
29#include <scsi/iscsi_if.h> 31#include <scsi/iscsi_if.h>
30 32
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 9582e8401669..0c775fceb675 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -35,6 +35,7 @@
35#include <scsi/scsi_device.h> 35#include <scsi/scsi_device.h>
36#include <scsi/scsi_cmnd.h> 36#include <scsi/scsi_cmnd.h>
37#include <scsi/scsi_transport_sas.h> 37#include <scsi/scsi_transport_sas.h>
38#include <asm/scatterlist.h>
38 39
39struct block_device; 40struct block_device;
40 41
@@ -200,9 +201,14 @@ struct domain_device {
200 void *lldd_dev; 201 void *lldd_dev;
201}; 202};
202 203
204struct sas_discovery_event {
205 struct work_struct work;
206 struct asd_sas_port *port;
207};
208
203struct sas_discovery { 209struct sas_discovery {
204 spinlock_t disc_event_lock; 210 spinlock_t disc_event_lock;
205 struct work_struct disc_work[DISC_NUM_EVENTS]; 211 struct sas_discovery_event disc_work[DISC_NUM_EVENTS];
206 unsigned long pending; 212 unsigned long pending;
207 u8 fanout_sas_addr[8]; 213 u8 fanout_sas_addr[8];
208 u8 eeds_a[8]; 214 u8 eeds_a[8];
@@ -248,14 +254,19 @@ struct asd_sas_port {
248 void *lldd_port; /* not touched by the sas class code */ 254 void *lldd_port; /* not touched by the sas class code */
249}; 255};
250 256
257struct asd_sas_event {
258 struct work_struct work;
259 struct asd_sas_phy *phy;
260};
261
251/* The phy pretty much is controlled by the LLDD. 262/* The phy pretty much is controlled by the LLDD.
252 * The class only reads those fields. 263 * The class only reads those fields.
253 */ 264 */
254struct asd_sas_phy { 265struct asd_sas_phy {
255/* private: */ 266/* private: */
256 /* protected by ha->event_lock */ 267 /* protected by ha->event_lock */
257 struct work_struct port_events[PORT_NUM_EVENTS]; 268 struct asd_sas_event port_events[PORT_NUM_EVENTS];
258 struct work_struct phy_events[PHY_NUM_EVENTS]; 269 struct asd_sas_event phy_events[PHY_NUM_EVENTS];
259 270
260 unsigned long port_events_pending; 271 unsigned long port_events_pending;
261 unsigned long phy_events_pending; 272 unsigned long phy_events_pending;
@@ -307,10 +318,15 @@ struct scsi_core {
307 int queue_thread_kill; 318 int queue_thread_kill;
308}; 319};
309 320
321struct sas_ha_event {
322 struct work_struct work;
323 struct sas_ha_struct *ha;
324};
325
310struct sas_ha_struct { 326struct sas_ha_struct {
311/* private: */ 327/* private: */
312 spinlock_t event_lock; 328 spinlock_t event_lock;
313 struct work_struct ha_events[HA_NUM_EVENTS]; 329 struct sas_ha_event ha_events[HA_NUM_EVENTS];
314 unsigned long pending; 330 unsigned long pending;
315 331
316 struct scsi_core core; 332 struct scsi_core core;
@@ -338,6 +354,8 @@ struct sas_ha_struct {
338 void (*notify_phy_event)(struct asd_sas_phy *, enum phy_event); 354 void (*notify_phy_event)(struct asd_sas_phy *, enum phy_event);
339 355
340 void *lldd_ha; /* not touched by sas class code */ 356 void *lldd_ha; /* not touched by sas class code */
357
358 struct list_head eh_done_q;
341}; 359};
342 360
343#define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata) 361#define SHOST_TO_SAS_HA(_shost) (*(struct sas_ha_struct **)(_shost)->hostdata)
@@ -526,17 +544,20 @@ struct sas_task {
526 544
527 void *lldd_task; /* for use by LLDDs */ 545 void *lldd_task; /* for use by LLDDs */
528 void *uldd_task; 546 void *uldd_task;
547
548 struct work_struct abort_work;
529}; 549};
530 550
531 551
532 552
533#define SAS_TASK_STATE_PENDING 1 553#define SAS_TASK_STATE_PENDING 1
534#define SAS_TASK_STATE_DONE 2 554#define SAS_TASK_STATE_DONE 2
535#define SAS_TASK_STATE_ABORTED 4 555#define SAS_TASK_STATE_ABORTED 4
556#define SAS_TASK_INITIATOR_ABORTED 8
536 557
537static inline struct sas_task *sas_alloc_task(gfp_t flags) 558static inline struct sas_task *sas_alloc_task(gfp_t flags)
538{ 559{
539 extern kmem_cache_t *sas_task_cache; 560 extern struct kmem_cache *sas_task_cache;
540 struct sas_task *task = kmem_cache_alloc(sas_task_cache, flags); 561 struct sas_task *task = kmem_cache_alloc(sas_task_cache, flags);
541 562
542 if (task) { 563 if (task) {
@@ -554,7 +575,7 @@ static inline struct sas_task *sas_alloc_task(gfp_t flags)
554static inline void sas_free_task(struct sas_task *task) 575static inline void sas_free_task(struct sas_task *task)
555{ 576{
556 if (task) { 577 if (task) {
557 extern kmem_cache_t *sas_task_cache; 578 extern struct kmem_cache *sas_task_cache;
558 BUG_ON(!list_empty(&task->list)); 579 BUG_ON(!list_empty(&task->list));
559 kmem_cache_free(sas_task_cache, task); 580 kmem_cache_free(sas_task_cache, task);
560 } 581 }
@@ -592,6 +613,7 @@ struct sas_domain_function_template {
592extern int sas_register_ha(struct sas_ha_struct *); 613extern int sas_register_ha(struct sas_ha_struct *);
593extern int sas_unregister_ha(struct sas_ha_struct *); 614extern int sas_unregister_ha(struct sas_ha_struct *);
594 615
616int sas_phy_reset(struct sas_phy *phy, int hard_reset);
595extern int sas_queuecommand(struct scsi_cmnd *, 617extern int sas_queuecommand(struct scsi_cmnd *,
596 void (*scsi_done)(struct scsi_cmnd *)); 618 void (*scsi_done)(struct scsi_cmnd *));
597extern int sas_target_alloc(struct scsi_target *); 619extern int sas_target_alloc(struct scsi_target *);
@@ -624,4 +646,6 @@ void sas_unregister_dev(struct domain_device *);
624 646
625void sas_init_dev(struct domain_device *); 647void sas_init_dev(struct domain_device *);
626 648
649void sas_task_abort(struct work_struct *);
650
627#endif /* _SASLIB_H_ */ 651#endif /* _SASLIB_H_ */
diff --git a/include/scsi/libsrp.h b/include/scsi/libsrp.h
new file mode 100644
index 000000000000..d143171896ae
--- /dev/null
+++ b/include/scsi/libsrp.h
@@ -0,0 +1,77 @@
1#ifndef __LIBSRP_H__
2#define __LIBSRP_H__
3
4#include <linux/list.h>
5#include <scsi/scsi_cmnd.h>
6#include <scsi/scsi_host.h>
7#include <scsi/srp.h>
8
9enum iue_flags {
10 V_DIOVER,
11 V_WRITE,
12 V_LINKED,
13 V_FLYING,
14};
15
16struct srp_buf {
17 dma_addr_t dma;
18 void *buf;
19};
20
21struct srp_queue {
22 void *pool;
23 void *items;
24 struct kfifo *queue;
25 spinlock_t lock;
26};
27
28struct srp_target {
29 struct Scsi_Host *shost;
30 struct device *dev;
31
32 spinlock_t lock;
33 struct list_head cmd_queue;
34
35 size_t srp_iu_size;
36 struct srp_queue iu_queue;
37 size_t rx_ring_size;
38 struct srp_buf **rx_ring;
39
40 void *ldata;
41};
42
43struct iu_entry {
44 struct srp_target *target;
45
46 struct list_head ilist;
47 dma_addr_t remote_token;
48 unsigned long flags;
49
50 struct srp_buf *sbuf;
51};
52
53typedef int (srp_rdma_t)(struct scsi_cmnd *, struct scatterlist *, int,
54 struct srp_direct_buf *, int,
55 enum dma_data_direction, unsigned int);
56extern int srp_target_alloc(struct srp_target *, struct device *, size_t, size_t);
57extern void srp_target_free(struct srp_target *);
58
59extern struct iu_entry *srp_iu_get(struct srp_target *);
60extern void srp_iu_put(struct iu_entry *);
61
62extern int srp_cmd_queue(struct Scsi_Host *, struct srp_cmd *, void *, u64);
63extern int srp_transfer_data(struct scsi_cmnd *, struct srp_cmd *,
64 srp_rdma_t, int, int);
65
66
67static inline struct srp_target *host_to_srp_target(struct Scsi_Host *host)
68{
69 return (struct srp_target *) host->hostdata;
70}
71
72static inline int srp_cmd_direction(struct srp_cmd *cmd)
73{
74 return (cmd->buf_fmt >> 4) ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
75}
76
77#endif
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index be117f812deb..d6948d0e8cdb 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -8,6 +8,7 @@
8 8
9struct request; 9struct request;
10struct scatterlist; 10struct scatterlist;
11struct Scsi_Host;
11struct scsi_device; 12struct scsi_device;
12 13
13 14
@@ -72,6 +73,9 @@ struct scsi_cmnd {
72 unsigned short use_sg; /* Number of pieces of scatter-gather */ 73 unsigned short use_sg; /* Number of pieces of scatter-gather */
73 unsigned short sglist_len; /* size of malloc'd scatter-gather list */ 74 unsigned short sglist_len; /* size of malloc'd scatter-gather list */
74 75
76 /* offset in cmd we are at (for multi-transfer tgt cmds) */
77 unsigned offset;
78
75 unsigned underflow; /* Return error if less than 79 unsigned underflow; /* Return error if less than
76 this amount is transferred */ 80 this amount is transferred */
77 81
@@ -119,7 +123,10 @@ struct scsi_cmnd {
119}; 123};
120 124
121extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 125extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
126extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);
122extern void scsi_put_command(struct scsi_cmnd *); 127extern void scsi_put_command(struct scsi_cmnd *);
128extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *,
129 struct device *);
123extern void scsi_io_completion(struct scsi_cmnd *, unsigned int); 130extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
124extern void scsi_finish_command(struct scsi_cmnd *cmd); 131extern void scsi_finish_command(struct scsi_cmnd *cmd);
125extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd); 132extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd);
@@ -128,4 +135,7 @@ extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
128 size_t *offset, size_t *len); 135 size_t *offset, size_t *len);
129extern void scsi_kunmap_atomic_sg(void *virt); 136extern void scsi_kunmap_atomic_sg(void *virt);
130 137
138extern struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *, gfp_t);
139extern void scsi_free_sgtable(struct scatterlist *, int);
140
131#endif /* _SCSI_SCSI_CMND_H */ 141#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index b401c82036be..ebf31b16dc49 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -223,13 +223,13 @@ extern struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *,
223 struct scsi_device *); 223 struct scsi_device *);
224 224
225/** 225/**
226 * shost_for_each_device - iterate over all devices of a host 226 * shost_for_each_device - iterate over all devices of a host
227 * @sdev: iterator 227 * @sdev: the &struct scsi_device to use as a cursor
228 * @host: host whiches devices we want to iterate over 228 * @shost: the &struct scsi_host to iterate over
229 * 229 *
230 * This traverses over each devices of @shost. The devices have 230 * Iterator that returns each device attached to @shost. This loop
231 * a reference that must be released by scsi_host_put when breaking 231 * takes a reference on each device and releases it at the end. If
232 * out of the loop. 232 * you break out of the loop, you must call scsi_device_put(sdev).
233 */ 233 */
234#define shost_for_each_device(sdev, shost) \ 234#define shost_for_each_device(sdev, shost) \
235 for ((sdev) = __scsi_iterate_devices((shost), NULL); \ 235 for ((sdev) = __scsi_iterate_devices((shost), NULL); \
@@ -237,17 +237,17 @@ extern struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *,
237 (sdev) = __scsi_iterate_devices((shost), (sdev))) 237 (sdev) = __scsi_iterate_devices((shost), (sdev)))
238 238
239/** 239/**
240 * __shost_for_each_device - iterate over all devices of a host (UNLOCKED) 240 * __shost_for_each_device - iterate over all devices of a host (UNLOCKED)
241 * @sdev: iterator 241 * @sdev: the &struct scsi_device to use as a cursor
242 * @host: host whiches devices we want to iterate over 242 * @shost: the &struct scsi_host to iterate over
243 * 243 *
244 * This traverses over each devices of @shost. It does _not_ take a 244 * Iterator that returns each device attached to @shost. It does _not_
245 * reference on the scsi_device, thus it the whole loop must be protected 245 * take a reference on the scsi_device, so the whole loop must be
246 * by shost->host_lock. 246 * protected by shost->host_lock.
247 * 247 *
248 * Note: The only reason why drivers would want to use this is because 248 * Note: The only reason to use this is because you need to access the
249 * they're need to access the device list in irq context. Otherwise you 249 * device list in interrupt context. Otherwise you really want to use
250 * really want to use shost_for_each_device instead. 250 * shost_for_each_device instead.
251 */ 251 */
252#define __shost_for_each_device(sdev, shost) \ 252#define __shost_for_each_device(sdev, shost) \
253 list_for_each_entry((sdev), &((shost)->__devices), siblings) 253 list_for_each_entry((sdev), &((shost)->__devices), siblings)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 39c6f8cc20c3..7f1f411d07af 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -7,6 +7,7 @@
7#include <linux/workqueue.h> 7#include <linux/workqueue.h>
8#include <linux/mutex.h> 8#include <linux/mutex.h>
9 9
10struct request_queue;
10struct block_device; 11struct block_device;
11struct completion; 12struct completion;
12struct module; 13struct module;
@@ -124,6 +125,39 @@ struct scsi_host_template {
124 void (*done)(struct scsi_cmnd *)); 125 void (*done)(struct scsi_cmnd *));
125 126
126 /* 127 /*
128 * The transfer functions are used to queue a scsi command to
129 * the LLD. When the driver is finished processing the command
130 * the done callback is invoked.
131 *
132 * return values: see queuecommand
133 *
134 * If the LLD accepts the cmd, it should set the result to an
135 * appropriate value when completed before calling the done function.
136 *
137 * STATUS: REQUIRED FOR TARGET DRIVERS
138 */
139 /* TODO: rename */
140 int (* transfer_response)(struct scsi_cmnd *,
141 void (*done)(struct scsi_cmnd *));
142 /*
143 * This is called to inform the LLD to transfer cmd->request_bufflen
144 * bytes of the cmd at cmd->offset in the cmd. The cmd->use_sg
145 * speciefies the number of scatterlist entried in the command
146 * and cmd->request_buffer contains the scatterlist.
147 *
148 * If the command cannot be processed in one transfer_data call
149 * becuase a scatterlist within the LLD's limits cannot be
150 * created then transfer_data will be called multiple times.
151 * It is initially called from process context, and later
152 * calls are from the interrup context.
153 */
154 int (* transfer_data)(struct scsi_cmnd *,
155 void (*done)(struct scsi_cmnd *));
156
157 /* Used as callback for the completion of task management request. */
158 int (* tsk_mgmt_response)(u64 mid, int result);
159
160 /*
127 * This is an error handling strategy routine. You don't need to 161 * This is an error handling strategy routine. You don't need to
128 * define one of these if you don't want to - there is a default 162 * define one of these if you don't want to - there is a default
129 * routine that is present that should work in most cases. For those 163 * routine that is present that should work in most cases. For those
@@ -241,6 +275,24 @@ struct scsi_host_template {
241 void (* target_destroy)(struct scsi_target *); 275 void (* target_destroy)(struct scsi_target *);
242 276
243 /* 277 /*
278 * If a host has the ability to discover targets on its own instead
279 * of scanning the entire bus, it can fill in this function and
280 * call scsi_scan_host(). This function will be called periodically
281 * until it returns 1 with the scsi_host and the elapsed time of
282 * the scan in jiffies.
283 *
284 * Status: OPTIONAL
285 */
286 int (* scan_finished)(struct Scsi_Host *, unsigned long);
287
288 /*
289 * If the host wants to be called before the scan starts, but
290 * after the midlayer has set up ready for the scan, it can fill
291 * in this function.
292 */
293 void (* scan_start)(struct Scsi_Host *);
294
295 /*
244 * fill in this function to allow the queue depth of this host 296 * fill in this function to allow the queue depth of this host
245 * to be changeable (on a per device basis). returns either 297 * to be changeable (on a per device basis). returns either
246 * the current queue depth setting (may be different from what 298 * the current queue depth setting (may be different from what
@@ -552,6 +604,9 @@ struct Scsi_Host {
552 /* task mgmt function in progress */ 604 /* task mgmt function in progress */
553 unsigned tmf_in_progress:1; 605 unsigned tmf_in_progress:1;
554 606
607 /* Asynchronous scan in progress */
608 unsigned async_scan:1;
609
555 /* 610 /*
556 * Optional work queue to be utilized by the transport 611 * Optional work queue to be utilized by the transport
557 */ 612 */
@@ -568,6 +623,12 @@ struct Scsi_Host {
568 */ 623 */
569 unsigned int max_host_blocked; 624 unsigned int max_host_blocked;
570 625
626 /*
627 * q used for scsi_tgt msgs, async events or any other requests that
628 * need to be processed in userspace
629 */
630 struct request_queue *uspace_req_q;
631
571 /* legacy crap */ 632 /* legacy crap */
572 unsigned long base; 633 unsigned long base;
573 unsigned long io_port; 634 unsigned long io_port;
@@ -648,11 +709,6 @@ extern const char *scsi_host_state_name(enum scsi_host_state);
648 709
649extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); 710extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
650 711
651static inline void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock)
652{
653 shost->host_lock = lock;
654}
655
656static inline struct device *scsi_get_device(struct Scsi_Host *shost) 712static inline struct device *scsi_get_device(struct Scsi_Host *shost)
657{ 713{
658 return shost->shost_gendev.parent; 714 return shost->shost_gendev.parent;
@@ -671,6 +727,9 @@ extern void scsi_unblock_requests(struct Scsi_Host *);
671extern void scsi_block_requests(struct Scsi_Host *); 727extern void scsi_block_requests(struct Scsi_Host *);
672 728
673struct class_container; 729struct class_container;
730
731extern struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,
732 void (*) (struct request_queue *));
674/* 733/*
675 * These two functions are used to allocate and free a pseudo device 734 * These two functions are used to allocate and free a pseudo device
676 * which will connect to the host adapter itself rather than any 735 * which will connect to the host adapter itself rather than any
diff --git a/include/scsi/scsi_tgt.h b/include/scsi/scsi_tgt.h
new file mode 100644
index 000000000000..4f4427937af2
--- /dev/null
+++ b/include/scsi/scsi_tgt.h
@@ -0,0 +1,19 @@
1/*
2 * SCSI target definitions
3 */
4
5#include <linux/dma-mapping.h>
6
7struct Scsi_Host;
8struct scsi_cmnd;
9struct scsi_lun;
10
11extern struct Scsi_Host *scsi_tgt_cmd_to_host(struct scsi_cmnd *);
12extern int scsi_tgt_alloc_queue(struct Scsi_Host *);
13extern void scsi_tgt_free_queue(struct Scsi_Host *);
14extern int scsi_tgt_queue_command(struct scsi_cmnd *, struct scsi_lun *, u64);
15extern int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *, int, u64, struct scsi_lun *,
16 void *);
17extern struct scsi_cmnd *scsi_host_get_command(struct Scsi_Host *,
18 enum dma_data_direction, gfp_t);
19extern void scsi_host_put_command(struct Scsi_Host *, struct scsi_cmnd *);
diff --git a/include/scsi/scsi_tgt_if.h b/include/scsi/scsi_tgt_if.h
new file mode 100644
index 000000000000..46d5e70d7215
--- /dev/null
+++ b/include/scsi/scsi_tgt_if.h
@@ -0,0 +1,90 @@
1/*
2 * SCSI target kernel/user interface
3 *
4 * Copyright (C) 2005 FUJITA Tomonori <tomof@acm.org>
5 * Copyright (C) 2005 Mike Christie <michaelc@cs.wisc.edu>
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 the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22#ifndef __SCSI_TARGET_IF_H
23#define __SCSI_TARGET_IF_H
24
25/* user -> kernel */
26#define TGT_UEVENT_CMD_RSP 0x0001
27#define TGT_UEVENT_TSK_MGMT_RSP 0x0002
28
29/* kernel -> user */
30#define TGT_KEVENT_CMD_REQ 0x1001
31#define TGT_KEVENT_CMD_DONE 0x1002
32#define TGT_KEVENT_TSK_MGMT_REQ 0x1003
33
34struct tgt_event_hdr {
35 uint16_t version;
36 uint16_t status;
37 uint16_t type;
38 uint16_t len;
39} __attribute__ ((aligned (sizeof(uint64_t))));
40
41struct tgt_event {
42 struct tgt_event_hdr hdr;
43
44 union {
45 /* user-> kernel */
46 struct {
47 int host_no;
48 uint32_t len;
49 int result;
50 aligned_u64 uaddr;
51 uint8_t rw;
52 aligned_u64 tag;
53 } cmd_rsp;
54 struct {
55 int host_no;
56 aligned_u64 mid;
57 int result;
58 } tsk_mgmt_rsp;
59
60
61 /* kernel -> user */
62 struct {
63 int host_no;
64 uint32_t data_len;
65 uint8_t scb[16];
66 uint8_t lun[8];
67 int attribute;
68 aligned_u64 tag;
69 } cmd_req;
70 struct {
71 int host_no;
72 aligned_u64 tag;
73 int result;
74 } cmd_done;
75 struct {
76 int host_no;
77 int function;
78 aligned_u64 tag;
79 uint8_t lun[8];
80 aligned_u64 mid;
81 } tsk_mgmt_req;
82 } p;
83} __attribute__ ((aligned (sizeof(uint64_t))));
84
85#define TGT_RING_SIZE (1UL << 16)
86#define TGT_RING_PAGES (TGT_RING_SIZE >> PAGE_SHIFT)
87#define TGT_EVENT_PER_PAGE (PAGE_SIZE / sizeof(struct tgt_event))
88#define TGT_MAX_EVENTS (TGT_EVENT_PER_PAGE * TGT_RING_PAGES)
89
90#endif
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index fd352323378b..798f7c7ee426 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -206,9 +206,9 @@ struct fc_rport { /* aka fc_starget_attrs */
206 u8 flags; 206 u8 flags;
207 struct list_head peers; 207 struct list_head peers;
208 struct device dev; 208 struct device dev;
209 struct work_struct dev_loss_work; 209 struct delayed_work dev_loss_work;
210 struct work_struct scan_work; 210 struct work_struct scan_work;
211 struct work_struct fail_io_work; 211 struct delayed_work fail_io_work;
212 struct work_struct stgt_delete_work; 212 struct work_struct stgt_delete_work;
213 struct work_struct rport_delete_work; 213 struct work_struct rport_delete_work;
214} __attribute__((aligned(sizeof(unsigned long)))); 214} __attribute__((aligned(sizeof(unsigned long))));
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 4b95c89c95c9..d5c218ddc527 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -176,7 +176,7 @@ struct iscsi_cls_session {
176 176
177 /* recovery fields */ 177 /* recovery fields */
178 int recovery_tmo; 178 int recovery_tmo;
179 struct work_struct recovery_work; 179 struct delayed_work recovery_work;
180 180
181 int target_id; 181 int target_id;
182 182
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 53024377f3b8..59633a82de47 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -73,6 +73,8 @@ struct sas_phy {
73 73
74 /* for the list of phys belonging to a port */ 74 /* for the list of phys belonging to a port */
75 struct list_head port_siblings; 75 struct list_head port_siblings;
76
77 struct work_struct reset_work;
76}; 78};
77 79
78#define dev_to_phy(d) \ 80#define dev_to_phy(d) \
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 4c43521cc493..33720397a904 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -511,7 +511,7 @@ struct snd_ac97 {
511#ifdef CONFIG_SND_AC97_POWER_SAVE 511#ifdef CONFIG_SND_AC97_POWER_SAVE
512 unsigned int power_up; /* power states */ 512 unsigned int power_up; /* power states */
513 struct workqueue_struct *power_workq; 513 struct workqueue_struct *power_workq;
514 struct work_struct power_work; 514 struct delayed_work power_work;
515#endif 515#endif
516 struct device dev; 516 struct device dev;
517}; 517};
diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h
index 11702aa0bea9..2ee061625fd0 100644
--- a/include/sound/ak4114.h
+++ b/include/sound/ak4114.h
@@ -182,7 +182,7 @@ struct ak4114 {
182 unsigned char rcs0; 182 unsigned char rcs0;
183 unsigned char rcs1; 183 unsigned char rcs1;
184 struct workqueue_struct *workqueue; 184 struct workqueue_struct *workqueue;
185 struct work_struct work; 185 struct delayed_work work;
186 void *change_callback_private; 186 void *change_callback_private;
187 void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1); 187 void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1);
188}; 188};
diff --git a/include/sound/core.h b/include/sound/core.h
index fa1ca0127bab..a994bea09cd6 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -132,6 +132,7 @@ struct snd_card {
132 int shutdown; /* this card is going down */ 132 int shutdown; /* this card is going down */
133 int free_on_last_close; /* free in context of file_release */ 133 int free_on_last_close; /* free in context of file_release */
134 wait_queue_head_t shutdown_sleep; 134 wait_queue_head_t shutdown_sleep;
135 struct device *parent;
135 struct device *dev; 136 struct device *dev;
136 137
137#ifdef CONFIG_PM 138#ifdef CONFIG_PM
@@ -187,13 +188,14 @@ struct snd_minor {
187 int device; /* device number */ 188 int device; /* device number */
188 const struct file_operations *f_ops; /* file operations */ 189 const struct file_operations *f_ops; /* file operations */
189 void *private_data; /* private data for f_ops->open */ 190 void *private_data; /* private data for f_ops->open */
190 struct class_device *class_dev; /* class device for sysfs */ 191 struct device *dev; /* device for sysfs */
191}; 192};
192 193
193/* sound.c */ 194/* sound.c */
194 195
195extern int snd_major; 196extern int snd_major;
196extern int snd_ecards_limit; 197extern int snd_ecards_limit;
198extern struct class *sound_class;
197 199
198void snd_request_card(int card); 200void snd_request_card(int card);
199 201
@@ -203,7 +205,7 @@ int snd_register_device(int type, struct snd_card *card, int dev,
203int snd_unregister_device(int type, struct snd_card *card, int dev); 205int snd_unregister_device(int type, struct snd_card *card, int dev);
204void *snd_lookup_minor_data(unsigned int minor, int type); 206void *snd_lookup_minor_data(unsigned int minor, int type);
205int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, 207int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev,
206 const struct class_device_attribute *attr); 208 struct device_attribute *attr);
207 209
208#ifdef CONFIG_SND_OSSEMUL 210#ifdef CONFIG_SND_OSSEMUL
209int snd_register_oss_device(int type, struct snd_card *card, int dev, 211int snd_register_oss_device(int type, struct snd_card *card, int dev,
@@ -255,7 +257,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file);
255int snd_card_file_remove(struct snd_card *card, struct file *file); 257int snd_card_file_remove(struct snd_card *card, struct file *file);
256 258
257#ifndef snd_card_set_dev 259#ifndef snd_card_set_dev
258#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) 260#define snd_card_set_dev(card,devptr) ((card)->parent = (devptr))
259#endif 261#endif
260 262
261/* device.c */ 263/* device.c */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index afaf3e88e086..2f645dfd7f70 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -26,6 +26,7 @@
26#include <sound/asound.h> 26#include <sound/asound.h>
27#include <sound/memalloc.h> 27#include <sound/memalloc.h>
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <linux/mm.h>
29#include <linux/bitops.h> 30#include <linux/bitops.h>
30 31
31#define snd_pcm_substream_chip(substream) ((substream)->private_data) 32#define snd_pcm_substream_chip(substream) ((substream)->private_data)
diff --git a/include/sound/version.h b/include/sound/version.h
index 52fd6879b86e..17137f3a3b6f 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.13" 2#define CONFIG_SND_VERSION "1.0.13"
3#define CONFIG_SND_DATE " (Sun Oct 22 08:56:16 2006 UTC)" 3#define CONFIG_SND_DATE " (Tue Nov 28 14:07:24 2006 UTC)"